-
Notifications
You must be signed in to change notification settings - Fork 3.2k
kwarg-ify methods #7611
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
Merged
rakshith91
merged 12 commits into
Azure:feature/storage-preview4
from
rakshith91:kwargsstorage
Oct 5, 2019
Merged
kwarg-ify methods #7611
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
cbbd3d5
changeset1
rakshith91 04553ff
changeset-2
rakshith91 0799ccf
changeset-3
rakshith91 faeddfe
changeset-4
rakshith91 95ba9d2
minor fix
rakshith91 d88e0c6
some final tweaks
rakshith91 0d05b3b
pylint
rakshith91 a6256f9
minor fixes
rakshith91 a742013
max_concurrency
rakshith91 198740d
lease_id
rakshith91 ff8ac6e
pylint
rakshith91 3f87850
fix
rakshith91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,7 +102,6 @@ def __init__( | |
| blob=None, # type: Optional[Union[str, BlobProperties]] | ||
| snapshot=None, # type: Optional[Union[str, Dict[str, Any]]] | ||
| credential=None, # type: Optional[Any] | ||
| loop=None, # type: Any | ||
| **kwargs # type: Any | ||
| ): | ||
| # type: (...) -> None | ||
|
|
@@ -113,10 +112,9 @@ def __init__( | |
| blob=blob, | ||
| snapshot=snapshot, | ||
| credential=credential, | ||
| loop=loop, | ||
| **kwargs) | ||
| self._client = AzureBlobStorage(url=self.url, pipeline=self._pipeline, loop=loop) | ||
| self._loop = loop | ||
| self._client = AzureBlobStorage(url=self.url, pipeline=self._pipeline) | ||
| self._loop = kwargs.get('loop', None) | ||
|
|
||
| @distributed_trace_async | ||
| async def get_account_information(self, **kwargs): # type: ignore | ||
|
|
@@ -138,12 +136,8 @@ async def get_account_information(self, **kwargs): # type: ignore | |
| async def upload_blob( | ||
| self, data, # type: Union[Iterable[AnyStr], IO[AnyStr]] | ||
| blob_type=BlobType.BlockBlob, # type: Union[str, BlobType] | ||
| overwrite=False, # type: bool | ||
| length=None, # type: Optional[int] | ||
| metadata=None, # type: Optional[Dict[str, str]] | ||
| content_settings=None, # type: Optional[ContentSettings] | ||
| validate_content=False, # type: Optional[bool] | ||
| max_concurrency=1, # type: int | ||
| **kwargs | ||
| ): | ||
| # type: (...) -> Any | ||
|
|
@@ -242,12 +236,8 @@ async def upload_blob( | |
| options = self._upload_blob_options( | ||
| data, | ||
| blob_type=blob_type, | ||
| overwrite=overwrite, | ||
| length=length, | ||
| metadata=metadata, | ||
| content_settings=content_settings, | ||
| validate_content=validate_content, | ||
| max_concurrency=max_concurrency, | ||
| **kwargs) | ||
| if blob_type == BlobType.BlockBlob: | ||
| return await upload_block_blob(**options) | ||
|
|
@@ -256,8 +246,8 @@ async def upload_blob( | |
| return await upload_append_blob(**options) | ||
|
|
||
| @distributed_trace_async | ||
| async def download_blob(self, offset=None, length=None, validate_content=False, **kwargs): | ||
| # type: (Optional[int], Optional[int], bool, Any) -> Iterable[bytes] | ||
| async def download_blob(self, offset=None, length=None, **kwargs): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove a bool from #type |
||
| # type: (Optional[int], Optional[int], Any) -> Iterable[bytes] | ||
| """Downloads a blob to a stream with automatic chunking. | ||
|
|
||
| :param int offset: | ||
|
|
@@ -324,7 +314,6 @@ async def download_blob(self, offset=None, length=None, validate_content=False, | |
| options = self._download_blob_options( | ||
| offset=offset, | ||
| length=length, | ||
| validate_content=validate_content, | ||
| **kwargs) | ||
| extra_properties = { | ||
| 'name': self.blob_name, | ||
|
|
@@ -601,7 +590,6 @@ async def set_blob_metadata(self, metadata=None, **kwargs): | |
| async def create_page_blob( # type: ignore | ||
| self, size, # type: int | ||
| content_settings=None, # type: Optional[ContentSettings] | ||
| sequence_number=None, # type: Optional[int] | ||
| metadata=None, # type: Optional[Dict[str, str]] | ||
| premium_page_blob_tier=None, # type: Optional[Union[str, PremiumPageBlobTier]] | ||
| **kwargs | ||
|
|
@@ -664,7 +652,6 @@ async def create_page_blob( # type: ignore | |
| options = self._create_page_blob_options( | ||
| size, | ||
| content_settings=content_settings, | ||
| sequence_number=sequence_number, | ||
| metadata=metadata, | ||
| premium_page_blob_tier=premium_page_blob_tier, | ||
| **kwargs) | ||
|
|
@@ -1079,7 +1066,6 @@ async def stage_block( | |
| self, block_id, # type: str | ||
| data, # type: Union[Iterable[AnyStr], IO[AnyStr]] | ||
| length=None, # type: Optional[int] | ||
| validate_content=False, # type: Optional[bool] | ||
| **kwargs | ||
| ): | ||
| # type: (...) -> None | ||
|
|
@@ -1119,7 +1105,6 @@ async def stage_block( | |
| block_id, | ||
| data, | ||
| length=length, | ||
| validate_content=validate_content, | ||
| **kwargs) | ||
| try: | ||
| await self._client.block_blob.stage_block(**options) | ||
|
|
@@ -1212,7 +1197,6 @@ async def commit_block_list( # type: ignore | |
| self, block_list, # type: List[BlobBlock] | ||
| content_settings=None, # type: Optional[ContentSettings] | ||
| metadata=None, # type: Optional[Dict[str, str]] | ||
| validate_content=False, # type: Optional[bool] | ||
| **kwargs | ||
| ): | ||
| # type: (...) -> Dict[str, Union[str, datetime]] | ||
|
|
@@ -1275,7 +1259,6 @@ async def commit_block_list( # type: ignore | |
| block_list, | ||
| content_settings=content_settings, | ||
| metadata=metadata, | ||
| validate_content=validate_content, | ||
| **kwargs) | ||
| try: | ||
| return await self._client.block_blob.commit_block_list(**options) # type: ignore | ||
|
|
@@ -1498,7 +1481,6 @@ async def upload_page( # type: ignore | |
| start_range, # type: int | ||
| end_range, # type: int | ||
| length=None, # type: Optional[int] | ||
| validate_content=False, # type: Optional[bool] | ||
| **kwargs | ||
| ): | ||
| # type: (...) -> Dict[str, Union[str, datetime]] | ||
|
|
@@ -1576,7 +1558,6 @@ async def upload_page( # type: ignore | |
| start_range=start_range, | ||
| end_range=end_range, | ||
| length=length, | ||
| validate_content=validate_content, | ||
| **kwargs) | ||
| try: | ||
| return await self._client.page_blob.upload_pages(**options) # type: ignore | ||
|
|
@@ -1588,7 +1569,6 @@ async def upload_pages_from_url(self, source_url, # type: str | |
| range_start, # type: int | ||
| range_end, # type: int | ||
| source_range_start, # type: int | ||
| source_content_md5=None, # type: Optional[bytes] | ||
| **kwargs | ||
| ): | ||
| # type: (...) -> Dict[str, Any] | ||
|
|
@@ -1680,7 +1660,6 @@ async def upload_pages_from_url(self, source_url, # type: str | |
| range_start=range_start, | ||
| range_end=range_end, | ||
| source_range_start=source_range_start, | ||
| source_content_md5=source_content_md5, | ||
| **kwargs | ||
| ) | ||
| try: | ||
|
|
@@ -1756,9 +1735,6 @@ async def clear_page(self, start_range, end_range, **kwargs): | |
| async def append_block( # type: ignore | ||
| self, data, # type: Union[AnyStr, Iterable[AnyStr], IO[AnyStr]] | ||
| length=None, # type: Optional[int] | ||
| validate_content=False, # type: Optional[bool] | ||
| maxsize_condition=None, # type: Optional[int] | ||
| appendpos_condition=None, # type: Optional[int] | ||
| **kwargs | ||
| ): | ||
| # type: (...) -> Dict[str, Union[str, datetime, int]] | ||
|
|
@@ -1827,9 +1803,6 @@ async def append_block( # type: ignore | |
| options = self._append_block_options( | ||
| data, | ||
| length=length, | ||
| validate_content=validate_content, | ||
| maxsize_condition=maxsize_condition, | ||
| appendpos_condition=appendpos_condition, | ||
| **kwargs | ||
| ) | ||
| try: | ||
|
|
@@ -1841,9 +1814,6 @@ async def append_block( # type: ignore | |
| async def append_block_from_url(self, copy_source_url, # type: str | ||
| source_range_start=None, # type Optional[int] | ||
| source_range_end=None, # type Optional[int] | ||
| source_content_md5=None, # type: Optional[bytearray] | ||
| maxsize_condition=None, # type: Optional[int] | ||
| appendpos_condition=None, # type: Optional[int] | ||
| **kwargs): | ||
| # type: (...) -> Dict[str, Union[str, datetime, int]] | ||
| """ | ||
|
|
@@ -1928,9 +1898,6 @@ async def append_block_from_url(self, copy_source_url, # type: str | |
| copy_source_url, | ||
| source_range_start=source_range_start, | ||
| source_range_end=source_range_end, | ||
| source_content_md5=source_content_md5, | ||
| maxsize_condition=maxsize_condition, | ||
| appendpos_condition=appendpos_condition, | ||
| **kwargs | ||
| ) | ||
| try: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please open an issue to change the :param: directive for the keyword parameter to :keyword: in the docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#7619