diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_directory_client.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_directory_client.py index d23f24552dbe..b46c43d761b4 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_directory_client.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_data_lake_directory_client.py @@ -11,7 +11,7 @@ from ._deserialize import deserialize_dir_properties from ._shared.base_client import TransportWrapper, parse_connection_str from ._data_lake_file_client import DataLakeFileClient -from ._models import DirectoryProperties +from ._models import DirectoryProperties, FileProperties from ._path_client import PathClient @@ -502,12 +502,12 @@ def get_file_client(self, file # type: Union[FileProperties, str] or an instance of FileProperties. eg. directory/subdirectory/file :type file: str or ~azure.storage.filedatalake.FileProperties :returns: A DataLakeFileClient. - :rtype: ~azure.storage.filedatalake..DataLakeFileClient + :rtype: ~azure.storage.filedatalake.DataLakeFileClient """ try: - file_path = file.name + file_path = file.get('name') except AttributeError: - file_path = self.path_name + '/' + file + file_path = self.path_name + '/' + str(file) _pipeline = Pipeline( transport=TransportWrapper(self._pipeline._transport), # pylint: disable = protected-access @@ -535,9 +535,9 @@ def get_sub_directory_client(self, sub_directory # type: Union[DirectoryPropert :rtype: ~azure.storage.filedatalake.DataLakeDirectoryClient """ try: - subdir_path = sub_directory.name + subdir_path = sub_directory.get('name') except AttributeError: - subdir_path = self.path_name + '/' + sub_directory + subdir_path = self.path_name + '/' + str(sub_directory) _pipeline = Pipeline( transport=TransportWrapper(self._pipeline._transport), # pylint: disable = protected-access diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py index 31f3b18fa2c8..a1a5f114e538 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_file_system_client.py @@ -17,7 +17,7 @@ from azure.storage.blob import ContainerClient from ._shared.base_client import TransportWrapper, StorageAccountHostsMixin, parse_query, parse_connection_str from ._serialize import convert_dfs_url_to_blob_url -from ._models import LocationMode, FileSystemProperties, PublicAccess +from ._models import LocationMode, FileSystemProperties, PublicAccess, FileProperties, DirectoryProperties from ._data_lake_file_client import DataLakeFileClient from ._data_lake_directory_client import DataLakeDirectoryClient from ._data_lake_lease import DataLakeLeaseClient @@ -737,9 +737,9 @@ def get_directory_client(self, directory # type: Union[DirectoryProperties, str :caption: Getting the directory client to interact with a specific directory. """ try: - directory_name = directory.name + directory_name = directory.get('name') except AttributeError: - directory_name = directory + directory_name = str(directory) _pipeline = Pipeline( transport=TransportWrapper(self._pipeline._transport), # pylint: disable = protected-access policies=self._pipeline._impl_policies # pylint: disable = protected-access @@ -777,9 +777,9 @@ def get_file_client(self, file_path # type: Union[FileProperties, str] :caption: Getting the file client to interact with a specific file. """ try: - file_path = file_path.name + file_path = file_path.get('name') except AttributeError: - pass + file_path = str(file_path) _pipeline = Pipeline( transport=TransportWrapper(self._pipeline._transport), # pylint: disable = protected-access policies=self._pipeline._impl_policies # pylint: disable = protected-access diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py index 3b399d6fd37b..23b26feea82c 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_data_lake_directory_client_async.py @@ -11,7 +11,7 @@ from azure.core.pipeline import AsyncPipeline from ._data_lake_file_client_async import DataLakeFileClient from .._data_lake_directory_client import DataLakeDirectoryClient as DataLakeDirectoryClientBase -from .._models import DirectoryProperties +from .._models import DirectoryProperties, FileProperties from .._deserialize import deserialize_dir_properties from ._path_client_async import PathClient from .._shared.base_client_async import AsyncTransportWrapper @@ -483,9 +483,9 @@ def get_file_client(self, file # type: Union[FileProperties, str] :caption: Getting the file client to interact with a specific file. """ try: - file_path = file.name + file_path = file.get('name') except AttributeError: - file_path = self.path_name + '/' + file + file_path = self.path_name + '/' + str(file) _pipeline = AsyncPipeline( transport=AsyncTransportWrapper(self._pipeline._transport), # pylint: disable = protected-access @@ -522,9 +522,9 @@ def get_sub_directory_client(self, sub_directory # type: Union[DirectoryPropert :caption: Getting the directory client to interact with a specific directory. """ try: - subdir_path = sub_directory.name + subdir_path = sub_directory.get('name') except AttributeError: - subdir_path = self.path_name + '/' + sub_directory + subdir_path = self.path_name + '/' + str(sub_directory) _pipeline = AsyncPipeline( transport=AsyncTransportWrapper(self._pipeline._transport), # pylint: disable = protected-access diff --git a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py index ebd6d996e656..eba7740aa53e 100644 --- a/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py +++ b/sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/aio/_file_system_client_async.py @@ -26,7 +26,7 @@ from .._generated.aio import AzureDataLakeStorageRESTAPI from .._shared.base_client_async import AsyncTransportWrapper, AsyncStorageAccountHostsMixin from .._shared.policies_async import ExponentialRetry -from .._models import FileSystemProperties, PublicAccess +from .._models import FileSystemProperties, PublicAccess, DirectoryProperties, FileProperties if TYPE_CHECKING: from datetime import datetime @@ -696,9 +696,9 @@ def get_directory_client(self, directory # type: Union[DirectoryProperties, str :caption: Getting the directory client to interact with a specific directory. """ try: - directory_name = directory.name + directory_name = directory.get('name') except AttributeError: - directory_name = directory + directory_name = str(directory) _pipeline = AsyncPipeline( transport=AsyncTransportWrapper(self._pipeline._transport), # pylint: disable = protected-access policies=self._pipeline._impl_policies # pylint: disable = protected-access @@ -737,9 +737,9 @@ def get_file_client(self, file_path # type: Union[FileProperties, str] :caption: Getting the file client to interact with a specific file. """ try: - file_path = file_path.name + file_path = file_path.get('name') except AttributeError: - pass + file_path = str(file_path) _pipeline = AsyncPipeline( transport=AsyncTransportWrapper(self._pipeline._transport), # pylint: disable = protected-access policies=self._pipeline._impl_policies # pylint: disable = protected-access