Skip to content

Commit

Permalink
{Pylint} Fix used-before-assignment in Storage (Azure#30362)
Browse files Browse the repository at this point in the history
* testpylint

* fix used-before-assignment

* fix merge removal

* avoid changing original code logic
  • Loading branch information
calvinhzy authored Nov 28, 2024
1 parent 9ef9f30 commit e98a4a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ def validator(cmd, namespace):
clear_content_settings = ns.pop('clear_content_settings', False)

# retrieve the existing object properties for an update
props = None
if update and not clear_content_settings:
account = ns.get('account_name')
key = ns.get('account_key')
Expand Down Expand Up @@ -677,7 +678,7 @@ def validator(cmd, namespace):
for attr in ['content_type', 'content_disposition', 'content_encoding', 'content_language',
'content_md5', 'cache_control']:
if getattr(new_props, attr) is None:
setattr(new_props, attr, getattr(props, attr)) # pylint: disable=used-before-assignment
setattr(new_props, attr, getattr(props, attr))
else:
if guess_from_file:
new_props = guess_content_type(ns[guess_from_file], new_props, settings_class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ def validator(cmd, namespace):
clear_content_settings = ns.pop('clear_content_settings', False)

# retrieve the existing object properties for an update
props = None
if update and not clear_content_settings:
account = ns.get('account_name')
key = ns.get('account_key')
Expand Down Expand Up @@ -443,7 +444,7 @@ def validator(cmd, namespace):
for attr in ['content_type', 'content_disposition', 'content_encoding', 'content_language',
'content_md5', 'cache_control']:
if getattr(new_props, attr) is None:
setattr(new_props, attr, getattr(props, attr)) # pylint: disable=used-before-assignment
setattr(new_props, attr, getattr(props, attr))
else:
if guess_from_file:
new_props = guess_content_type(ns[guess_from_file], new_props, settings_class)
Expand Down

0 comments on commit e98a4a2

Please sign in to comment.