-
Notifications
You must be signed in to change notification settings - Fork 665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert to Python 3 #1128
Merged
Merged
Convert to Python 3 #1128
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
8eba0b8
Conform with Python 3 syntax
jleveque 10e7c84
More Python 3 fixes
jleveque 6e404cb
Make syntax compliant
jleveque e4a18b3
More manual changes
jleveque f795f10
[config/main.py] Replace map calls with for loop
jleveque fb001ba
Remove unnecessary casts from range to list
jleveque 2513adf
[config/main.py] Add spaces after commas, prettify line breaks
jleveque 60b9d8b
[config/main.py] Simplify line
jleveque c4e1e9a
Simplify check
jleveque 95e97f6
[conftest.py] Go back to aboslute import to work with new changes
jleveque 13c77d3
Update comments
jleveque d6fe8f2
Convert new consutil/lib.py changes to Python 3
jleveque 5bfa5ac
[show/fgnhg.py] Convert to Python 3
jleveque f78840b
More updates
jleveque 2d08766
Fix conftest.py
jleveque 48d4e8e
Fix tests/system_health_test.py
jleveque 4b0d47a
Fix conftest.py
jleveque 19f2c50
Don't pass 'decode_responses=True' to SonicV2Connector as it is no lo…
jleveque 1977972
Convert sonic_sku_create.py and related tests to Python 3
jleveque 14699f2
More unicode -> str
jleveque 5b7aafb
Make syntax Python 3-compliant
jleveque 5d917e6
Set universal_newlines=True for all subprocess commands where stdout …
jleveque cd6e41f
Fix up crm_test.py
jleveque 824bbb4
Alphabetize
jleveque ee359a8
Update README.md to reflect building and testing Python 3 package
jleveque 9417e85
Fix the path of the sonic_sku_create.py script
jleveque 2a36866
[config/feature.py] Arrange imports
jleveque f585baa
Remove unnecessary conversion to list
jleveque 165ba67
Don't pass 'version' to ArgumentParser constructor; deprecated in Pyt…
jleveque 3c0a7ee
Replace some missed dict.iteritems() with dict.items()
jleveque eb4d163
[aclshow] Open COUNTER_POSITION file in text mode, not binary
jleveque 318f918
Remove support for Python 2
jleveque ded2b3a
Replace 'universal_newline=True' with new (as of Python 3.7) alias 't…
jleveque 6234a4e
Replace '__builtin__' with 'builtins'
jleveque fbb7c40
Update expected output for CRM tests (order changed)
jleveque cf8d3cc
Update expected output for fgnhg tests (order changed)
jleveque c8606f4
Fix filter_fdb_entries.py
jleveque 24e86db
Update shebangs to python3
jleveque 2b26277
Pickle fixes to work with Python 3
jleveque 1a6ff76
itervalues -> values, iterkeys -> keys
jleveque e38a403
[intfutil] Fix print statements
jleveque ee02aa2
[intfutil] Fix another missed line which wasn't Python 3-compliant
jleveque 3f224ee
Update expected output for drops_group_test tests (order changed)
jleveque f210dbf
More Python 3 fixes
jleveque 0771e0b
Add 'text=True' param to all subprocess.check_output() calls
jleveque 1c47985
Replace 'file.next()' with 'next(file)' to comply with Python 3
jleveque 139aa89
Update expected output for system_health_test tests (order changed)
jleveque a14c529
Update expected output for vlan_test tests (order changed)
jleveque d39bae2
Python 3 fix for watermarkstat
jleveque a28fec8
[show/vlan] Remove unnecessary str() conversions
jleveque 254d57a
[show/vlan] Fix '<' not supported between instances of 'tuple' and 'str'
jleveque 75de4f2
[pcmping] xrange() -> range()
jleveque 7472e21
Remove unnecessary list() conversions
jleveque bec1ae8
[acl_loader/main.py] Update methods from ipaddr module forms to ipadd…
jleveque bb029e1
Remove shebangs and main() functions from files which do not need them
jleveque 6b019ab
[pcmping] Revert unnecessary changes
jleveque 800350f
Remove duplicate import
jleveque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -77,7 +77,7 @@ def __init__(self, source="configDB", debug=False, allowTablesWithoutYang=True): | |||||
|
||||||
except Exception as e: | ||||||
self.sysLog(doPrint=True, logLevel=syslog.LOG_ERR, msg=str(e)) | ||||||
raise(Exception('ConfigMgmt Class creation failed')) | ||||||
raise Exception('ConfigMgmt Class creation failed') | ||||||
|
||||||
return | ||||||
|
||||||
|
@@ -168,7 +168,7 @@ def readConfigDBJson(self, source=CONFIG_DB_JSON_FILE): | |||||
self.configdbJsonIn = readJsonFile(source) | ||||||
#self.sysLog(msg=type(self.configdbJsonIn)) | ||||||
if not self.configdbJsonIn: | ||||||
raise(Exception("Can not load config from config DB json file")) | ||||||
raise Exception("Can not load config from config DB json file") | ||||||
self.sysLog(msg='Reading Input {}'.format(self.configdbJsonIn)) | ||||||
|
||||||
return | ||||||
|
@@ -247,7 +247,7 @@ def __init__(self, source="configDB", debug=False, allowTablesWithoutYang=True): | |||||
|
||||||
except Exception as e: | ||||||
self.sysLog(doPrint=True, logLevel=syslog.LOG_ERR, msg=str(e)) | ||||||
raise(Exception('ConfigMgmtDPB Class creation failed')) | ||||||
raise Exception('ConfigMgmtDPB Class creation failed') | ||||||
|
||||||
return | ||||||
|
||||||
|
@@ -331,8 +331,7 @@ def _verifyAsicDB(self, db, ports, portMap, timeout): | |||||
if waitTime + 1 == timeout: | ||||||
self.sysLog(syslog.LOG_CRIT, "!!! Critical Failure, Ports \ | ||||||
are not Deleted from ASIC DB, Bail Out !!!", doPrint=True) | ||||||
raise(Exception("Ports are present in ASIC DB after {} secs".\ | ||||||
format(timeout))) | ||||||
raise Exception("Ports are present in ASIC DB after {} secs".format(timeout)) | ||||||
|
||||||
except Exception as e: | ||||||
self.sysLog(doPrint=True, logLevel=syslog.LOG_ERR, msg=str(e)) | ||||||
|
@@ -470,7 +469,7 @@ def _addPorts(self, portJson=dict(), loadDefConfig=True): | |||||
(configToLoad, ret) (tuple)[dict, bool] | ||||||
''' | ||||||
configToLoad = None | ||||||
ports = portJson['PORT'].keys() | ||||||
ports = list(portJson['PORT'].keys()) | ||||||
try: | ||||||
self.sysLog(doPrint=True, msg='Start Port Addition') | ||||||
self.sysLog(msg="addPorts Args portjson: {} loadDefConfig: {}".\ | ||||||
|
@@ -546,7 +545,7 @@ def _mergeItems(it1, it2): | |||||
pass | ||||||
return | ||||||
|
||||||
for it in D1.keys(): | ||||||
for it in list(D1.keys()): | ||||||
# D2 has the key | ||||||
if D2.get(it): | ||||||
_mergeItems(D1[it], D2[it]) | ||||||
|
@@ -578,7 +577,7 @@ def _searchKeysInConfig(self, In, Out, skeys): | |||||
''' | ||||||
found = False | ||||||
if isinstance(In, dict): | ||||||
for key in In.keys(): | ||||||
for key in list(In.keys()): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will not work. It would need to be: for it, _ in In: I will not make a change like this in this PR. Plus, keeping |
||||||
for skey in skeys: | ||||||
# pattern is very specific to current primary keys in | ||||||
# config DB, may need to be updated later. | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
#!/usr/bin/env python | ||
|
||
import click | ||
|
||
import utilities_common.cli as clicommon | ||
|
||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will not work. It would need to be:
I will not make a change like this in this PR. Plus, keeping
.keys()
makes it clear what the intention is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will work. I think you are talking about
In reply to: 499074240 [](ancestors = 499074240)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're correct. I misread this one. Everything started blending together after all these changes :)
I will go back through and do a cleanup pass in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have opened a PR to clean up here.