summaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/build/scripts
diff options
context:
space:
mode:
authoreschcam <cameron.scholes@est.tech>2023-06-19 17:39:10 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-06-20 10:14:27 +0000
commita622b7fe17a94698c1d242772d5d1b1d48761a29 (patch)
treee35dd9070a008a0c9b65494dc6094e44fe3a8f23 /openecomp-be/tools/build/scripts
parentf845ac23cdd262b7624785283531952e38557deb (diff)
Migrate Python 2 files to Python 3
Issue-ID: SDC-4498 Signed-off-by: eschcam <cameron.scholes@est.tech> Change-Id: I6b55fcd799371dd209898607c90d5c348e242c36
Diffstat (limited to 'openecomp-be/tools/build/scripts')
-rw-r--r--openecomp-be/tools/build/scripts/action_library_client/action_library_client.py59
-rw-r--r--openecomp-be/tools/build/scripts/parse-json.py14
2 files changed, 38 insertions, 35 deletions
diff --git a/openecomp-be/tools/build/scripts/action_library_client/action_library_client.py b/openecomp-be/tools/build/scripts/action_library_client/action_library_client.py
index 7f513afe86..0537128665 100644
--- a/openecomp-be/tools/build/scripts/action_library_client/action_library_client.py
+++ b/openecomp-be/tools/build/scripts/action_library_client/action_library_client.py
@@ -147,6 +147,7 @@ class FinalizeStatus(object):
class ArgsDict(dict):
"""A dict which makes attributes accessible as properties."""
+
def __getattr__(self, attr):
return self[attr]
@@ -221,33 +222,33 @@ class ArgumentParser(object):
def usage():
"""Print usage message."""
print("" +
- "Usage: action_library_client.py [--help] [--url <url>] [--in <filename>]\n" +
- " [--out <filename>] [--config <filename>]\n" +
- " [--log <filename>] [--uuid <uuid>]\n" +
- " [--curl] [--dryrun] [--verbose] [--version]\n" +
- " [--list | --create | --update= | --delete |\n" +
- " --checkout | --undocheckout | --checkin | --submit]\n" +
- "\n" +
- "Optional arguments:\n" +
- " --help Show this help message and exit\n" +
- " --url <url> REST endpoint URL\n" +
- " --in <filename> Path to JSON input file (else STDIN)\n" +
- " --out <filename> Path to JSON output file (else STDOUT or logfile)\n" +
- " --config <filename> Path to configuration file\n" +
- " --log <filename> Path to logfile (else STDOUT)\n" +
- " --uuid <uuid> Action UUID, (=='actionInvariantUUID')\n" +
- " --curl Use curl transport impl\n" +
- " --dryrun Describe what will happen, execute nothing\n" +
- " --verbose Verbose diagnostic output\n" +
- " --version Print script version and exit\n" +
- " --list List actions\n" +
- " --create Create new action (requires --in)\n" +
- " --update Update existing action (requires --uuid, --in)\n" +
- " --delete Delete existing action (requires --uuid)\n" +
- " --checkout Create minor version candidate (requires --uuid)\n" +
- " --undocheckout Discard minor version candidate (requires --uuid)\n" +
- " --checkin Create minor version from candidate (requires --uuid)\n" +
- " --submit Create next major version (requires --uuid)")
+ "Usage: action_library_client.py [--help] [--url <url>] [--in <filename>]\n" +
+ " [--out <filename>] [--config <filename>]\n" +
+ " [--log <filename>] [--uuid <uuid>]\n" +
+ " [--curl] [--dryrun] [--verbose] [--version]\n" +
+ " [--list | --create | --update= | --delete |\n" +
+ " --checkout | --undocheckout | --checkin | --submit]\n" +
+ "\n" +
+ "Optional arguments:\n" +
+ " --help Show this help message and exit\n" +
+ " --url <url> REST endpoint URL\n" +
+ " --in <filename> Path to JSON input file (else STDIN)\n" +
+ " --out <filename> Path to JSON output file (else STDOUT or logfile)\n" +
+ " --config <filename> Path to configuration file\n" +
+ " --log <filename> Path to logfile (else STDOUT)\n" +
+ " --uuid <uuid> Action UUID, (=='actionInvariantUUID')\n" +
+ " --curl Use curl transport impl\n" +
+ " --dryrun Describe what will happen, execute nothing\n" +
+ " --verbose Verbose diagnostic output\n" +
+ " --version Print script version and exit\n" +
+ " --list List actions\n" +
+ " --create Create new action (requires --in)\n" +
+ " --update Update existing action (requires --uuid, --in)\n" +
+ " --delete Delete existing action (requires --uuid)\n" +
+ " --checkout Create minor version candidate (requires --uuid)\n" +
+ " --undocheckout Discard minor version candidate (requires --uuid)\n" +
+ " --checkin Create minor version from candidate (requires --uuid)\n" +
+ " --submit Create next major version (requires --uuid)")
###############################################################################
@@ -533,7 +534,7 @@ class CURLRESTClient(IRESTClient):
"""Debug curl command, for diags and dryrun."""
buf = ""
for token in cmd:
- if token is "curl" or token.startswith("-"):
+ if token == "curl" or token.startswith("-"):
buf = "{0}{1} ".format(buf, token)
else:
buf = "{0}\"{1}\" ".format(buf, token)
@@ -556,7 +557,7 @@ class CURLRESTClient(IRESTClient):
try:
separator = output.index("\r\n\r\n{")
self.logger.debug("HTTP preamble:\n{0}".format(output[:separator]))
- json_body = json.loads(output[(separator+4):])
+ json_body = json.loads(output[(separator + 4):])
self.log_json_response(method, json_body)
return json_body
except ValueError:
diff --git a/openecomp-be/tools/build/scripts/parse-json.py b/openecomp-be/tools/build/scripts/parse-json.py
index 46537ceac5..83c70aac01 100644
--- a/openecomp-be/tools/build/scripts/parse-json.py
+++ b/openecomp-be/tools/build/scripts/parse-json.py
@@ -41,17 +41,19 @@ from collections import OrderedDict
def readJsonFile(file, type):
- with open(file, 'r') as f:
- data = json.load(f, object_pairs_hook=OrderedDict)
- return data[type]
+ with open(file, 'r') as f:
+ data = json.load(f, object_pairs_hook=OrderedDict)
+ return data[type]
+
def printJsonTypeEntries(jsonData):
- for i in jsonData.keys():
- print jsonData[i] + ';'
+ for i in jsonData.keys():
+ print(jsonData[i] + ';')
def usage():
- print 'parseJsonFile.py [-f <json-file> & -t <cql-type: drop|create|insert|update|select]'
+ print('parseJsonFile.py [-f <json-file> & -t <cql-type: drop|create|insert|update|select]')
+
def main(argv):
action = ''