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
cephfs-shell: Fix flake8 errors (E302, E502, E128, F821, W605, 5128, E122) #34254
Closed
Closed
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cf2cb51
cephfs-shell: Added blank line before poutput definition
me-diru 22c126c
cephfs-shell: Removed blackslash between brackets in to_bytes definition
me-diru 246ae69
cephfs-shell: Added blank line before and after ls() definition
me-diru 5355b5e
cephfs-shell: Indent under-intended code in do_du()
me-diru 402f74a
cephfs-shell: Removed unused exception instance in do_snap()
me-diru e36541b
cephfs-shell: Removed extra backslash in do_stat()
me-diru 44f5f8c
cephfs-shell: Indent under-intened code in do_stat()
me-diru f5dbcd8
cephfs-shell: Indent outdented code in do_help()
me-diru File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,7 @@ shell = None # holds instance of class CephFSShell | |
# | ||
####################################################################### | ||
|
||
|
||
def poutput(s, end='\n'): | ||
shell.poutput(s, end=end) | ||
|
||
|
@@ -111,13 +112,14 @@ def to_bytes(param): | |
elif isinstance(param, str): | ||
return bytes(param, encoding='utf-8') | ||
elif isinstance(param, list): | ||
return [i.encode('utf-8') if isinstance(i, str) else to_bytes(i) for \ | ||
return [i.encode('utf-8') if isinstance(i, str) else to_bytes(i) for | ||
i in param] | ||
elif isinstance(param, int) or isinstance(param, float): | ||
return str(param).encode('utf-8') | ||
elif param is None: | ||
return None | ||
|
||
|
||
def ls(path, opts=''): | ||
# opts tries to be like /bin/ls opts | ||
almost_all = 'A' in opts | ||
|
@@ -134,6 +136,7 @@ def ls(path, opts=''): | |
perror(e) | ||
shell.exit_code = e.get_error_code() | ||
|
||
|
||
def glob(path, pattern): | ||
paths = [] | ||
parent_dir = os.path.dirname(path) | ||
|
@@ -1220,7 +1223,7 @@ class CephFSShell(Cmd): | |
if f[0] is ord('/'): | ||
f = b'.' + f | ||
poutput('{:10s} {}'.format(humansize(dusage), | ||
f.decode('utf-8'))) | ||
f.decode('utf-8'))) | ||
except libcephfs.Error as e: | ||
perror(e) | ||
self.exit_code = e.get_error_code() | ||
|
@@ -1354,7 +1357,6 @@ class CephFSShell(Cmd): | |
else: | ||
self.perror("snapshot can only be created or deleted; check - " | ||
"help snap") | ||
self.exit_code = e.get_error_code() | ||
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 change is wrong. Exit code is required and it should return |
||
|
||
def do_help(self, line): | ||
""" | ||
|
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.
Move this change to a different commit.