Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix Pylint
  • Loading branch information
xiafu-msft committed Sep 9, 2019
commit 3c6b3e07bae88fb3529bd3722e8b64d96cb9173f
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def deserialize_file_stream(response, obj, headers):
return response.location_mode, obj


def deserialize_permission(response, obj, headers):
def deserialize_permission(response, obj, headers): # pylint: disable=unused-argument
'''
Extracts out file permission
'''

return obj.permission


def deserialize_permission_key(response, obj, headers):
def deserialize_permission_key(response, obj, headers): # pylint: disable=unused-argument
'''
Extracts out file permission key
'''
Expand Down
5 changes: 2 additions & 3 deletions sdk/storage/azure-storage-file/azure/storage/file/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def _get_file_permission(file_permission, file_permission_key, default_permissio
if empty_file_permission:
if empty_file_permission_key:
return default_permission
else:
return None

return None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious: if file_permission is empty and file_permission_key is not, shouldn't this return the key?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - if you check the function that call this one - file_permission_key is used independently. I checked as I had the same question ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. 😄


if empty_file_permission_key:
return file_permission
Expand All @@ -46,4 +46,3 @@ def _parse_datetime_from_str(string_datetime):

def _datetime_to_str(datetime_obj):
return datetime_obj if isinstance(datetime_obj, str) else datetime_obj.isoformat() + '0Z'

Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ async def create_file( # type: ignore

@distributed_trace_async
async def upload_file(
self,
data, # type: Any
self, data, # type: Any
length=None, # type: Optional[int]
metadata=None, # type: Optional[Dict[str, str]]
content_settings=None, # type: Optional[ContentSettings]
Expand All @@ -250,8 +249,8 @@ async def upload_file(
file_last_write_time="now", # type: Union[str, datetime]
file_permission=None, # type: Optional[str]
file_permission_key=None, # type: Optional[str]
timeout=None, # type: Optional[int]
encoding="UTF-8", # type: str
timeout=None, # type: Optional[int]
**kwargs # type: Any
):
# type: (...) -> Dict[str, Any]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
Optional, Union, Any, Dict, TYPE_CHECKING
)

from ._parser import _get_file_permission, _datetime_to_str
from ._shared.parser import _str

try:
from urllib.parse import urlparse, quote, unquote
except ImportError:
Expand All @@ -29,10 +26,12 @@
from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query
from ._shared.request_handlers import add_metadata_headers
from ._shared.response_handlers import return_response_headers, process_storage_error
from ._shared.parser import _str
from ._parser import _get_file_permission, _datetime_to_str
from ._deserialize import deserialize_directory_properties
from ._polling import CloseHandles
from .file_client import FileClient
from .models import DirectoryPropertiesPaged, HandlesPaged, NTFSAttributes
from .models import DirectoryPropertiesPaged, HandlesPaged, NTFSAttributes # pylint: disable=unused-import

if TYPE_CHECKING:
from .models import ShareProperties, DirectoryProperties, ContentSettings
Expand Down
15 changes: 7 additions & 8 deletions sdk/storage/azure-storage-file/azure/storage/file/file_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
TYPE_CHECKING
)

from ._parser import _get_file_permission, _datetime_to_str
from ._shared.parser import _str

try:
from urllib.parse import urlparse, quote, unquote
except ImportError:
Expand All @@ -33,9 +30,11 @@
from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query
from ._shared.request_handlers import add_metadata_headers, get_length
from ._shared.response_handlers import return_response_headers, process_storage_error
from ._shared.parser import _str
from ._parser import _get_file_permission, _datetime_to_str
from ._deserialize import deserialize_file_properties, deserialize_file_stream
from ._polling import CloseHandles
from .models import HandlesPaged, NTFSAttributes
from .models import HandlesPaged, NTFSAttributes # pylint: disable=unused-import
from ._shared_access_signature import FileSharedAccessSignature

if TYPE_CHECKING:
Expand Down Expand Up @@ -426,18 +425,18 @@ def create_file( # type: ignore

@distributed_trace
def upload_file(
self, data, # type: Any
length=None, # type: Optional[int]
self, data, # type: Any
length=None, # type: Optional[int]
metadata=None, # type: Optional[Dict[str, str]]
content_settings=None, # type: Optional[ContentSettings]
validate_content=False, # type: bool
max_connections=1, # type: Optional[int]
file_attributes="none", # type: Union[str, NTFSAttributes]
file_creation_time="now", # type: Union[str, datetime]
file_last_write_time="now", # type: Union[str, datetime]
file_permission=None, # type: Optional[str]
file_permission=None, # type: Optional[str]
file_permission_key=None, # type: Optional[str]
encoding='UTF-8', # type: str
encoding="UTF-8", # type: str
timeout=None, # type: Optional[int]
**kwargs # type: Any
):
Expand Down