Skip to content
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

[Datalake] Added support for PurePosixPath #16400

Merged
merged 6 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down