Skip to content

Commit 9138c95

Browse files
[Storage] [Datalake] Fixed next pylint errors in datalake storage (#35167)
1 parent d25c551 commit 9138c95

11 files changed

+117
-53
lines changed

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_directory_client.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ def delete_directory(self, **kwargs):
244244
This value is not tracked or validated on the client. To configure client-side network timesouts
245245
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
246246
#other-client--per-operation-configuration>`_.
247-
:return: None
247+
:returns: None.
248+
:rtype: None
248249
249250
.. admonition:: Example:
250251
@@ -303,7 +304,10 @@ def get_directory_properties(self, **kwargs):
303304
This value is not tracked or validated on the client. To configure client-side network timesouts
304305
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
305306
#other-client--per-operation-configuration>`_.
306-
:rtype: DirectoryProperties
307+
:returns:
308+
DirectoryProperties with all user-defined metadata, standard HTTP properties,
309+
and system properties for the directory. It does not return the content of the directory.
310+
:rtype: ~azure.storage.filedatalake.DirectoryProperties
307311
308312
.. admonition:: Example:
309313
@@ -396,7 +400,8 @@ def rename_directory(self, new_name, **kwargs):
396400
This value is not tracked or validated on the client. To configure client-side network timesouts
397401
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
398402
#other-client--per-operation-configuration>`_.
399-
:return: DataLakeDirectoryClient
403+
:returns: A DataLakeDirectoryClient with the renamed directory.
404+
:rtype: ~azure.storage.filedatalake.DataLakeDirectoryClient
400405
401406
.. admonition:: Example:
402407
@@ -496,7 +501,8 @@ def create_sub_directory(self, sub_directory, # type: Union[DirectoryProperties
496501
This value is not tracked or validated on the client. To configure client-side network timesouts
497502
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
498503
#other-client--per-operation-configuration>`_.
499-
:return: DataLakeDirectoryClient for the subdirectory.
504+
:returns: DataLakeDirectoryClient for the subdirectory.
505+
:rtype: ~azure.storage.filedatalake.DataLakeDirectoryClient
500506
"""
501507
subdir = self.get_sub_directory_client(sub_directory)
502508
subdir.create_directory(metadata=metadata, **kwargs)
@@ -540,7 +546,8 @@ def delete_sub_directory(self, sub_directory, # type: Union[DirectoryProperties
540546
This value is not tracked or validated on the client. To configure client-side network timesouts
541547
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
542548
#other-client--per-operation-configuration>`_.
543-
:return: DataLakeDirectoryClient for the subdirectory
549+
:returns: DataLakeDirectoryClient for the subdirectory.
550+
:rtype: ~azure.storage.filedatalake.DataLakeDirectoryClient
544551
"""
545552
subdir = self.get_sub_directory_client(sub_directory)
546553
subdir.delete_directory(**kwargs)
@@ -632,7 +639,8 @@ def create_file(self, file, # type: Union[FileProperties, str]
632639
This value is not tracked or validated on the client. To configure client-side network timesouts
633640
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
634641
#other-client--per-operation-configuration>`_.
635-
:return: DataLakeFileClient
642+
:returns: A DataLakeFileClient with newly created file.
643+
:rtype: ~azure.storage.filedatalake.DataLakeFileClient
636644
"""
637645
file_client = self.get_file_client(file)
638646
file_client.create_file(**kwargs)

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_file_client.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,10 @@ def create_file(self, content_settings=None, # type: Optional[ContentSettings]
213213
This value is not tracked or validated on the client. To configure client-side network timesouts
214214
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
215215
#other-client--per-operation-configuration>`_.
216-
:return: response dict (Etag and last modified).
217216
:keyword str encryption_context:
218217
Specifies the encryption context to set on the file.
218+
:returns: response dict (Etag and last modified).
219+
:rtype: dict[str, str] or dict[str, ~datetime.datetime]
219220
220221
.. admonition:: Example:
221222
@@ -261,7 +262,8 @@ def delete_file(self, **kwargs):
261262
This value is not tracked or validated on the client. To configure client-side network timesouts
262263
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
263264
#other-client--per-operation-configuration>`_.
264-
:return: None
265+
:returns: None.
266+
:rtype: None
265267
266268
.. admonition:: Example:
267269
@@ -426,6 +428,7 @@ def upload_data(
426428
Upload data to a file.
427429
428430
:param data: Content to be uploaded to file
431+
:type data: bytes, str, Iterable[AnyStr], or IO[AnyStr]
429432
:param int length: Size of the data in bytes.
430433
:param bool overwrite: to overwrite an existing file or not.
431434
:keyword ~azure.storage.filedatalake.ContentSettings content_settings:
@@ -490,7 +493,8 @@ def upload_data(
490493
Defaults to 100*1024*1024, or 100MB.
491494
:keyword str encryption_context:
492495
Specifies the encryption context to set on the file.
493-
:return: response dict (Etag and last modified).
496+
:returns: response dict (Etag and last modified).
497+
:rtype: dict[str, Any]
494498
"""
495499
options = self._upload_options(
496500
data,
@@ -541,8 +545,10 @@ def append_data(self, data, # type: Union[bytes, str, Iterable[AnyStr], IO[AnyS
541545
"""Append data to the file.
542546
543547
:param data: Content to be appended to file
544-
:param offset: start position of the data to be appended to.
548+
:type data: bytes, str, Iterable[AnyStr], or IO[AnyStr]
549+
:param int offset: start position of the data to be appended to.
545550
:param length: Size of the data in bytes.
551+
:type length: int or None
546552
:keyword bool flush:
547553
If true, will commit the data after it is appended.
548554
:keyword bool validate_content:
@@ -576,7 +582,8 @@ def append_data(self, data, # type: Union[bytes, str, Iterable[AnyStr], IO[AnyS
576582
:keyword ~azure.storage.filedatalake.CustomerProvidedEncryptionKey cpk:
577583
Encrypts the data on the service-side with the given key.
578584
Use of customer-provided keys must be done over HTTPS.
579-
:return: dict of the response header
585+
:returns: dict of the response header.
586+
:rtype: dict[str, str], dict[str, ~datetime.datetime], or dict[str, int]
580587
581588
.. admonition:: Example:
582589
@@ -637,8 +644,8 @@ def flush_data(self, offset, # type: int
637644
# type: (...) -> Dict[str, Union[str, datetime]]
638645
""" Commit the previous appended data.
639646
640-
:param offset: offset is equal to the length of the file after commit the
641-
previous appended data.
647+
:param int offset: offset is equal to the length of the file after commit
648+
the previous appended data.
642649
:param bool retain_uncommitted_data: Valid only for flush operations. If
643650
"true", uncommitted data is retained after the flush operation
644651
completes; otherwise, the uncommitted data is deleted after the flush
@@ -703,7 +710,8 @@ def flush_data(self, offset, # type: int
703710
:keyword ~azure.storage.filedatalake.CustomerProvidedEncryptionKey cpk:
704711
Encrypts the data on the service-side with the given key.
705712
Use of customer-provided keys must be done over HTTPS.
706-
:return: response header in dict
713+
:returns: response header in dict
714+
:rtype: dict[str, str] or dict[str, ~datetime.datetime]
707715
708716
.. admonition:: Example:
709717

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_service_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ def create_file_system(self, file_system, # type: Union[FileSystemProperties, s
294294
This value is not tracked or validated on the client. To configure client-side network timesouts
295295
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
296296
#other-client--per-operation-configuration>`_.
297+
:returns: A FileSystemClient with newly created file system.
297298
:rtype: ~azure.storage.filedatalake.FileSystemClient
298299
299300
.. admonition:: Example:
@@ -329,6 +330,7 @@ def _rename_file_system(self, name, new_name, **kwargs):
329330
This value is not tracked or validated on the client. To configure client-side network timesouts
330331
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
331332
#other-client--per-operation-configuration>`_.
333+
:returns: A FileSystemClient with the specified file system renamed.
332334
:rtype: ~azure.storage.filedatalake.FileSystemClient
333335
"""
334336
self._blob_service_client._rename_container(name, new_name, **kwargs) # pylint: disable=protected-access
@@ -406,7 +408,8 @@ def delete_file_system(self, file_system, # type: Union[FileSystemProperties, s
406408
This value is not tracked or validated on the client. To configure client-side network timesouts
407409
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
408410
#other-client--per-operation-configuration>`_.
409-
:rtype: None
411+
:returns: A FileSystemClient with the specified file system deleted.
412+
:rtype: ~azure.storage.filedatalake.FileSystemClient
410413
411414
.. admonition:: Example:
412415

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ def _rename_file_system(self, new_name, **kwargs):
331331
This value is not tracked or validated on the client. To configure client-side network timesouts
332332
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
333333
#other-client--per-operation-configuration>`_.
334+
:returns: FileSystemClient with renamed properties.
334335
:rtype: ~azure.storage.filedatalake.FileSystemClient
335336
"""
336337
self._container_client._rename_container(new_name, **kwargs) # pylint: disable=protected-access
@@ -674,7 +675,8 @@ def create_directory(self, directory, # type: Union[DirectoryProperties, str]
674675
This value is not tracked or validated on the client. To configure client-side network timesouts
675676
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
676677
#other-client--per-operation-configuration>`_.
677-
:return: DataLakeDirectoryClient
678+
:returns: DataLakeDirectoryClient with new directory and metadata.
679+
:rtype: ~azure.storage.file.datalake.DataLakeDirectoryClient
678680
679681
.. admonition:: Example:
680682
@@ -727,7 +729,8 @@ def delete_directory(self, directory, # type: Union[DirectoryProperties, str]
727729
This value is not tracked or validated on the client. To configure client-side network timesouts
728730
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
729731
#other-client--per-operation-configuration>`_.
730-
:return: DataLakeDirectoryClient
732+
:returns: DataLakeDirectoryClient after deleting specified directory.
733+
:rtype: ~azure.storage.file.datalake.DataLakeDirectoryClient
731734
732735
.. admonition:: Example:
733736
@@ -753,11 +756,11 @@ def create_file(self, file, # type: Union[FileProperties, str]
753756
The file with which to interact. This can either be the name of the file,
754757
or an instance of FileProperties.
755758
:type file: str or ~azure.storage.filedatalake.FileProperties
756-
:param ~azure.storage.filedatalake.ContentSettings content_settings:
759+
:keyword ~azure.storage.filedatalake.ContentSettings content_settings:
757760
ContentSettings object used to set path properties.
758-
:param metadata:
761+
:keyword metadata:
759762
Name-value pairs associated with the file as metadata.
760-
:type metadata: dict(str, str)
763+
:paramtype metadata: dict[str, str]
761764
:keyword lease:
762765
Required if the file has an active lease. Value can be a DataLakeLeaseClient object
763766
or the lease ID as a string.
@@ -825,7 +828,8 @@ def create_file(self, file, # type: Union[FileProperties, str]
825828
This value is not tracked or validated on the client. To configure client-side network timesouts
826829
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
827830
#other-client--per-operation-configuration>`_.
828-
:return: DataLakeFileClient
831+
:returns: DataLakeFileClient with new file created.
832+
:rtype: ~azure.storage.file.datalake.DataLakeFileClient
829833
830834
.. admonition:: Example:
831835
@@ -878,7 +882,8 @@ def delete_file(self, file, # type: Union[FileProperties, str]
878882
This value is not tracked or validated on the client. To configure client-side network timesouts
879883
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
880884
#other-client--per-operation-configuration>`_.
881-
:return: DataLakeFileClient
885+
:return: DataLakeFileClient after deleting specified file.
886+
:rtype: azure.storage.file.datalake.DataLakeFileClient
882887
883888
.. admonition:: Example:
884889

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_path_client.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,8 @@ def set_access_control(self, owner=None, # type: Optional[str]
449449
This value is not tracked or validated on the client. To configure client-side network timesouts
450450
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
451451
#other-client--per-operation-configuration>`_.
452-
:keyword: response dict (Etag and last modified).
452+
:returns: response dict containing access control options (Etag and last modified).
453+
:rtype: dict[str, str] or dict[str, ~datetime.datetime]
453454
"""
454455
if not any([owner, group, permissions, acl]):
455456
raise ValueError("At least one parameter should be set for set_access_control API")
@@ -519,7 +520,8 @@ def get_access_control(self, upn=None, # type: Optional[bool]
519520
This value is not tracked or validated on the client. To configure client-side network timesouts
520521
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
521522
#other-client--per-operation-configuration>`_.
522-
:keyword: response dict.
523+
:returns: response dict containing access control options with no modifications.
524+
:rtype: dict[str, Any]
523525
"""
524526
options = self._get_access_control_options(upn=upn, **kwargs)
525527
try:
@@ -583,7 +585,7 @@ def set_access_control_recursive(self, acl, **kwargs):
583585
#other-client--per-operation-configuration>`_.
584586
:return: A summary of the recursive operations, including the count of successes and failures,
585587
as well as a continuation token in case the operation was terminated prematurely.
586-
:rtype: :class:`~azure.storage.filedatalake.AccessControlChangeResult`
588+
:rtype: ~azure.storage.filedatalake.AccessControlChangeResult
587589
:raises ~azure.core.exceptions.AzureError:
588590
User can restart the operation using continuation_token field of AzureError if the token is available.
589591
"""
@@ -637,7 +639,7 @@ def update_access_control_recursive(self, acl, **kwargs):
637639
#other-client--per-operation-configuration>`_.
638640
:return: A summary of the recursive operations, including the count of successes and failures,
639641
as well as a continuation token in case the operation was terminated prematurely.
640-
:rtype: :class:`~azure.storage.filedatalake.AccessControlChangeResult`
642+
:rtype: ~azure.storage.filedatalake.AccessControlChangeResult
641643
:raises ~azure.core.exceptions.AzureError:
642644
User can restart the operation using continuation_token field of AzureError if the token is available.
643645
"""
@@ -690,7 +692,7 @@ def remove_access_control_recursive(self, acl, **kwargs):
690692
#other-client--per-operation-configuration>`_.
691693
:return: A summary of the recursive operations, including the count of successes and failures,
692694
as well as a continuation token in case the operation was terminated prematurely.
693-
:rtype: :class:`~azure.storage.filedatalake.AccessControlChangeResult`
695+
:rtype: ~azure.storage.filedatalake.AccessControlChangeResult
694696
:raises ~azure.core.exceptions.AzureError:
695697
User can restart the operation using continuation_token field of AzureError if the token is available.
696698
"""
@@ -879,6 +881,8 @@ def _rename_path(self, rename_source, **kwargs):
879881
This value is not tracked or validated on the client. To configure client-side network timesouts
880882
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
881883
#other-client--per-operation-configuration>`_.
884+
:returns: response dict containing information about the renamed path.
885+
:rtype: dict[str, Any]
882886
"""
883887
options = self._rename_path_options(
884888
rename_source,
@@ -933,6 +937,9 @@ def _get_path_properties(self, **kwargs):
933937
This value is not tracked or validated on the client. To configure client-side network timesouts
934938
see `here <https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/storage/azure-storage-file-datalake
935939
#other-client--per-operation-configuration>`_.
940+
:returns:
941+
Information including user-defined metadata, standard HTTP properties,
942+
and system properties for the file or directory.
936943
:rtype: DirectoryProperties or FileProperties
937944
938945
.. admonition:: Example:

sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import uuid
1313
from io import SEEK_SET, UnsupportedOperation
1414
from time import time
15-
from typing import Any, Dict, Optional, TYPE_CHECKING, Union
15+
from typing import Any, Dict, Optional, TYPE_CHECKING
1616
from urllib.parse import (
1717
parse_qsl,
1818
urlencode,
@@ -411,9 +411,8 @@ def _set_next_host_location(self, settings: Dict[str, Any], request: "PipelineRe
411411
"""
412412
A function which sets the next host location on the request, if applicable.
413413
414-
:param dict[str, Any]] settings: The configurable values pertaining to the next host location.
415-
:param request: A pipeline request object.
416-
:type request: ~azure.core.pipeline.PipelineRequest
414+
:param Dict[str, Any]] settings: The configurable values pertaining to the next host location.
415+
:param PipelineRequest request: A pipeline request object.
417416
"""
418417
if settings['hosts'] and all(settings['hosts'].values()):
419418
url = urlparse(request.url)

0 commit comments

Comments
 (0)