diff options
author | eschcam <cameron.scholes@est.tech> | 2023-06-19 17:39:10 +0100 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2023-06-20 10:14:27 +0000 |
commit | a622b7fe17a94698c1d242772d5d1b1d48761a29 (patch) | |
tree | e35dd9070a008a0c9b65494dc6094e44fe3a8f23 /asdctool/src/main/resources/scripts/python/duplicates.py | |
parent | f845ac23cdd262b7624785283531952e38557deb (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 'asdctool/src/main/resources/scripts/python/duplicates.py')
-rw-r--r-- | asdctool/src/main/resources/scripts/python/duplicates.py | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/asdctool/src/main/resources/scripts/python/duplicates.py b/asdctool/src/main/resources/scripts/python/duplicates.py index be60b05909..7228677734 100644 --- a/asdctool/src/main/resources/scripts/python/duplicates.py +++ b/asdctool/src/main/resources/scripts/python/duplicates.py @@ -1,47 +1,49 @@ import json import sys -dict = {} -dupliacteUid = {} -#debugFlag = True -debugFlag = False +dict = {} +dupliacteUid = {} +# debugFlag = True +debugFlag = False + def debug(str1, str2=""): 'print only if debug enabled' - if (debugFlag == True): print str1, str2 + if debugFlag: + print(str1, str2) -print 'Number of arguments:', len(sys.argv), 'arguments.' +print('Number of arguments:', len(sys.argv), 'arguments.') with open(sys.argv[1]) as json_file: json_data = json.load(json_file) for x in json_data['vertices']: - uid = None - nodeLabel=x.get('nodeLabel') - debug(nodeLabel) - if ( nodeLabel == 'user' ): - uid = x['userId'] - elif ( nodeLabel == 'tag' ): - uid = x['name'] - elif ( nodeLabel == None ): - pass - elif ( nodeLabel == 'lockNode' ): - uid = x.get('uid') - else: uid = x['uid'] - - debug(nodeLabel, uid) - - existId = dict.get(uid) - if (existId == None): - dict[uid] = x.get('_id') - else: - dupliacteUid[uid] = existId - - print dupliacteUid + uid = None + nodeLabel = x.get('nodeLabel') + debug(nodeLabel) + if nodeLabel == 'user': + uid = x['userId'] + elif nodeLabel == 'tag': + uid = x['name'] + elif nodeLabel is None: + pass + elif nodeLabel == 'lockNode': + uid = x.get('uid') + else: + uid = x['uid'] + + debug(nodeLabel, uid) + + existId = dict.get(uid) + if existId == None: + dict[uid] = x.get('_id') + else: + dupliacteUid[uid] = existId + + print(dupliacteUid) # with open('data.txt', 'w') as outfile: # json.dump(json_data, outfile) - # print x['uid'] |