-
Notifications
You must be signed in to change notification settings - Fork 3.2k
File rest parity #7001
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
annatisch
merged 14 commits into
Azure:feature/storage-preview3
from
xiafu-msft:file-rest-parity
Sep 9, 2019
Merged
File rest parity #7001
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
512d5a4
[File][RestParity]Rest Parity Sync
xiafu-msft 8bed721
[File][RestParity]Rest Parity Async
xiafu-msft 22b801a
[File][RestParity]Add Rest Parity Async Recording Files
xiafu-msft bfd3fbd
[File][RestParity]Fix CI
xiafu-msft 7707acf
[File][RestParity]Recording again to fix CI
xiafu-msft e945a70
Add Generated Code
xiafu-msft 8c821a6
Stylistic Things and Record
xiafu-msft 8c5c22c
[Swagger][BugFix]workaround to fix swagger generated code
xiafu-msft d46e3dc
[File][RestParity]Add Create_Permission API and Test
xiafu-msft fcf0ec6
Fix Test
xiafu-msft 3c6b3e0
Fix Pylint
xiafu-msft 62dc377
Revert the workaround
xiafu-msft 3d00c52
[File][RestParity]Tweak Documentation and Tests
xiafu-msft 9afed1d
delete .dat file
xiafu-msft 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
Next
Next commit
[File][RestParity]Rest Parity Sync
Add Rest Parity Sync part(except create permission) tweak _shared package a bit
- Loading branch information
commit 512d5a4444cbbf7c6390a99e868ed41fdf93f917
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
sdk/storage/azure-storage-blob/azure/storage/blob/_shared/parser.py
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import sys | ||
|
|
||
| if sys.version_info < (3,): | ||
| def _str(value): | ||
| if isinstance(value, unicode): # pylint: disable=undefined-variable | ||
| return value.encode('utf-8') | ||
|
|
||
| return str(value) | ||
| else: | ||
| _str = str | ||
|
|
||
|
|
||
| def _to_utc_datetime(value): | ||
| return value.strftime('%Y-%m-%dT%H:%M:%SZ') | ||
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
Binary file not shown.
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
41 changes: 41 additions & 0 deletions
41
sdk/storage/azure-storage-file/azure/storage/file/_parser.py
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 |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| from datetime import datetime, timedelta | ||
xiafu-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| _ERROR_TOO_MANY_FILE_PERMISSIONS = 'file_permission and file_permission_key should not be set at the same time' | ||
| _FILE_PERMISSION_TOO_LONG = 'Size of file_permission is too large. file_permission should be <=8KB, else' \ | ||
| 'please use file_permission_key' | ||
|
|
||
|
|
||
| def _get_file_permission(file_permission, file_permission_key, default_permission): | ||
| # if file_permission and file_permission_key are both empty, then use the default_permission | ||
| # value as file permission, file_permission size should be <= 8KB, else file permission_key should be used | ||
| empty_file_permission = file_permission is None or len(file_permission) == 0 | ||
xiafu-msft marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| empty_file_permission_key = file_permission_key is None or len(file_permission_key) == 0 | ||
| file_permission_size_too_big = False if file_permission is None \ | ||
| else len(str(file_permission).encode('utf-8')) > 8 * 1024 | ||
|
|
||
| if file_permission_size_too_big: | ||
| raise ValueError(_FILE_PERMISSION_TOO_LONG) | ||
|
|
||
| if empty_file_permission: | ||
| if empty_file_permission_key: | ||
| return default_permission | ||
| else: | ||
| return None | ||
|
|
||
| if empty_file_permission_key: | ||
| return file_permission | ||
|
|
||
| raise ValueError(_ERROR_TOO_MANY_FILE_PERMISSIONS) | ||
|
|
||
|
|
||
| def _parse_datetime_from_str(string_datetime): | ||
| dt, _, us = string_datetime.partition(".") | ||
| dt = datetime.strptime(dt, "%Y-%m-%dT%H:%M:%S") | ||
| us = int(us[:-2]) # microseconds | ||
| datetime_obj = dt + timedelta(microseconds=us) | ||
| return datetime_obj | ||
|
|
||
|
|
||
| def _datetime_to_str(datetime_obj): | ||
| return datetime_obj if isinstance(datetime_obj, str) else datetime_obj.isoformat() + '0Z' | ||
|
|
||
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
14 changes: 14 additions & 0 deletions
14
sdk/storage/azure-storage-file/azure/storage/file/_shared/parser.py
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import sys | ||
|
|
||
| if sys.version_info < (3,): | ||
| def _str(value): | ||
| if isinstance(value, unicode): # pylint: disable=undefined-variable | ||
| return value.encode('utf-8') | ||
|
|
||
| return str(value) | ||
| else: | ||
| _str = str | ||
|
|
||
|
|
||
| def _to_utc_datetime(value): | ||
| return value.strftime('%Y-%m-%dT%H:%M:%SZ') |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.