-
Notifications
You must be signed in to change notification settings - Fork 810
Convert to Python 3 #1128
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
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
10e7c84
More Python 3 fixes
6e404cb
Make syntax compliant
e4a18b3
More manual changes
f795f10
[config/main.py] Replace map calls with for loop
fb001ba
Remove unnecessary casts from range to list
2513adf
[config/main.py] Add spaces after commas, prettify line breaks
60b9d8b
[config/main.py] Simplify line
c4e1e9a
Simplify check
95e97f6
[conftest.py] Go back to aboslute import to work with new changes
13c77d3
Update comments
d6fe8f2
Convert new consutil/lib.py changes to Python 3
5bfa5ac
[show/fgnhg.py] Convert to Python 3
f78840b
More updates
2d08766
Fix conftest.py
48d4e8e
Fix tests/system_health_test.py
4b0d47a
Fix conftest.py
19f2c50
Don't pass 'decode_responses=True' to SonicV2Connector as it is no lo…
1977972
Convert sonic_sku_create.py and related tests to Python 3
14699f2
More unicode -> str
5b7aafb
Make syntax Python 3-compliant
5d917e6
Set universal_newlines=True for all subprocess commands where stdout …
cd6e41f
Fix up crm_test.py
824bbb4
Alphabetize
ee359a8
Update README.md to reflect building and testing Python 3 package
9417e85
Fix the path of the sonic_sku_create.py script
2a36866
[config/feature.py] Arrange imports
f585baa
Remove unnecessary conversion to list
165ba67
Don't pass 'version' to ArgumentParser constructor; deprecated in Pyt…
3c0a7ee
Replace some missed dict.iteritems() with dict.items()
eb4d163
[aclshow] Open COUNTER_POSITION file in text mode, not binary
318f918
Remove support for Python 2
ded2b3a
Replace 'universal_newline=True' with new (as of Python 3.7) alias 't…
6234a4e
Replace '__builtin__' with 'builtins'
fbb7c40
Update expected output for CRM tests (order changed)
cf8d3cc
Update expected output for fgnhg tests (order changed)
c8606f4
Fix filter_fdb_entries.py
24e86db
Update shebangs to python3
2b26277
Pickle fixes to work with Python 3
1a6ff76
itervalues -> values, iterkeys -> keys
e38a403
[intfutil] Fix print statements
ee02aa2
[intfutil] Fix another missed line which wasn't Python 3-compliant
3f224ee
Update expected output for drops_group_test tests (order changed)
f210dbf
More Python 3 fixes
0771e0b
Add 'text=True' param to all subprocess.check_output() calls
1c47985
Replace 'file.next()' with 'next(file)' to comply with Python 3
139aa89
Update expected output for system_health_test tests (order changed)
a14c529
Update expected output for vlan_test tests (order changed)
d39bae2
Python 3 fix for watermarkstat
a28fec8
[show/vlan] Remove unnecessary str() conversions
254d57a
[show/vlan] Fix '<' not supported between instances of 'tuple' and 'str'
75de4f2
[pcmping] xrange() -> range()
7472e21
Remove unnecessary list() conversions
bec1ae8
[acl_loader/main.py] Update methods from ipaddr module forms to ipadd…
bb029e1
Remove shebangs and main() functions from files which do not need them
6b019ab
[pcmping] Revert unnecessary changes
800350f
Remove duplicate import
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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()): | ||||||
|
||||||
| for key in list(In.keys()): | |
| for it in In: |
Contributor
Author
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:
for it, _ in In:I will not make a change like this in this PR. Plus, keeping .keys() makes it clear what the intention is.
This file contains hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.