Skip to content

Commit

Permalink
fix #2 dateutil
Browse files Browse the repository at this point in the history
  • Loading branch information
LibbaLawrence committed Jul 16, 2020
1 parent 1f8e970 commit a799d47
Show file tree
Hide file tree
Showing 64 changed files with 1,038 additions and 1,043 deletions.
11 changes: 7 additions & 4 deletions sdk/table/azure-table/azure/table/_deserialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
# license information.
# --------------------------------------------------------------------------
# pylint: disable=unused-argument
import datetime
from uuid import UUID
from dateutil.parser import parse
from azure.table._shared import url_quote
from azure.table._entity import EntityProperty, EdmType, Entity
from azure.table._shared._common_conversion import _decode_base64_to_bytes
from azure.table._generated.models import TableProperties
from azure.core.exceptions import ResourceExistsError


from ._shared.models import TableErrorCode


Expand Down Expand Up @@ -54,7 +53,9 @@ def _from_entity_int32(value):


def _from_entity_datetime(value):
return parse(value)
# TODO: Fix this
local_timezone = datetime.datetime.now(datetime.timezone(datetime.timedelta(0))).tzinfo
return datetime.datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=local_timezone)


def _from_entity_guid(value):
Expand Down Expand Up @@ -119,7 +120,9 @@ def _convert_to_entity(entry_element):
# Timestamp is a known property
timestamp = properties.pop('Timestamp', None)
if timestamp:
entity['Timestamp'] = _from_entity_datetime(timestamp)
# TODO: verify change here
# entity['Timestamp'] = _from_entity_datetime(timestamp)
entity['Timestamp'] = timestamp

for name, value in properties.items():
mtype = edmtypes.get(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:46 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:46 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
x-ms-version:
- '2019-07-07'
method: POST
Expand All @@ -33,7 +33,7 @@ interactions:
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:23 GMT
location:
- https://storagename.table.core.windows.net/Tables('uttable99fe1256')
server:
Expand Down Expand Up @@ -64,27 +64,27 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
x-ms-version:
- '2019-07-07'
method: POST
uri: https://storagename.table.core.windows.net/uttable99fe1256
response:
body:
string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable99fe1256/@Element","odata.etag":"W/\"datetime''2020-07-16T15%3A32%3A45.7387783Z''\"","PartitionKey":"pk99fe1256","RowKey":"rk99fe1256","Timestamp":"2020-07-16T15:32:45.7387783Z","binary@odata.type":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}'
string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable99fe1256/@Element","odata.etag":"W/\"datetime''2020-07-16T19%3A35%3A24.5973502Z''\"","PartitionKey":"pk99fe1256","RowKey":"rk99fe1256","Timestamp":"2020-07-16T19:35:24.5973502Z","binary@odata.type":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:23 GMT
etag:
- W/"datetime'2020-07-16T15%3A32%3A45.7387783Z'"
- W/"datetime'2020-07-16T19%3A35%3A24.5973502Z'"
location:
- https://storagename.table.core.windows.net/uttable99fe1256(PartitionKey='pk99fe1256',RowKey='rk99fe1256')
server:
Expand All @@ -110,27 +110,27 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
x-ms-version:
- '2019-07-07'
method: GET
uri: https://storagename.table.core.windows.net/uttable99fe1256(PartitionKey='pk99fe1256',RowKey='rk99fe1256')
response:
body:
string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable99fe1256/@Element","odata.etag":"W/\"datetime''2020-07-16T15%3A32%3A45.7387783Z''\"","PartitionKey":"pk99fe1256","RowKey":"rk99fe1256","Timestamp":"2020-07-16T15:32:45.7387783Z","binary@odata.type":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}'
string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable99fe1256/@Element","odata.etag":"W/\"datetime''2020-07-16T19%3A35%3A24.5973502Z''\"","PartitionKey":"pk99fe1256","RowKey":"rk99fe1256","Timestamp":"2020-07-16T19:35:24.5973502Z","binary@odata.type":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:24 GMT
etag:
- W/"datetime'2020-07-16T15%3A32%3A45.7387783Z'"
- W/"datetime'2020-07-16T19%3A35%3A24.5973502Z'"
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
Expand All @@ -154,11 +154,11 @@ interactions:
Content-Length:
- '0'
Date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
x-ms-version:
- '2019-07-07'
method: DELETE
Expand All @@ -172,7 +172,7 @@ interactions:
content-length:
- '0'
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:24 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-content-type-options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
x-ms-version:
- '2019-07-07'
method: POST
Expand All @@ -33,7 +33,7 @@ interactions:
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:24 GMT
location:
- https://storagename.table.core.windows.net/Tables('uttable12440ee0')
server:
Expand Down Expand Up @@ -69,27 +69,27 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
x-ms-version:
- '2019-07-07'
method: POST
uri: https://storagename.table.core.windows.net/uttable12440ee0
response:
body:
string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable12440ee0/@Element","odata.etag":"W/\"datetime''2020-07-16T15%3A32%3A46.3623741Z''\"","PartitionKey":"pk12440ee0","RowKey":"rk12440ee0","Timestamp":"2020-07-16T15:32:46.3623741Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}'
string: '{"odata.metadata":"https://storagename.table.core.windows.net/$metadata#uttable12440ee0/@Element","odata.etag":"W/\"datetime''2020-07-16T19%3A35%3A25.2397166Z''\"","PartitionKey":"pk12440ee0","RowKey":"rk12440ee0","Timestamp":"2020-07-16T19:35:25.2397166Z","age@odata.type":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"large@odata.type":"Edm.Int64","large":"933311100","Birthday@odata.type":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","birthday@odata.type":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","binary@odata.type":"Edm.Binary","binary":"YmluYXJ5","other":20,"clsid@odata.type":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:24 GMT
etag:
- W/"datetime'2020-07-16T15%3A32%3A46.3623741Z'"
- W/"datetime'2020-07-16T19%3A35%3A25.2397166Z'"
location:
- https://storagename.table.core.windows.net/uttable12440ee0(PartitionKey='pk12440ee0',RowKey='rk12440ee0')
server:
Expand Down Expand Up @@ -117,13 +117,13 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
If-Match:
- '*'
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
x-ms-version:
- '2019-07-07'
method: DELETE
Expand All @@ -137,7 +137,7 @@ interactions:
content-length:
- '0'
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:24 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-content-type-options:
Expand All @@ -159,26 +159,26 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
x-ms-version:
- '2019-07-07'
method: GET
uri: https://storagename.table.core.windows.net/uttable12440ee0(PartitionKey='pk12440ee0',RowKey='rk12440ee0')
response:
body:
string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The
specified resource does not exist.\nRequestId:0039691e-c002-0048-2b86-5becfc000000\nTime:2020-07-16T15:32:46.5465021Z"}}}'
specified resource does not exist.\nRequestId:960daaec-1002-0098-48a8-5b1b32000000\nTime:2020-07-16T19:35:25.4118369Z"}}}'
headers:
cache-control:
- no-cache
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:24 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
Expand All @@ -202,11 +202,11 @@ interactions:
Content-Length:
- '0'
Date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:47 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
x-ms-version:
- '2019-07-07'
method: DELETE
Expand All @@ -220,7 +220,7 @@ interactions:
content-length:
- '0'
date:
- Thu, 16 Jul 2020 15:32:45 GMT
- Thu, 16 Jul 2020 19:35:24 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-content-type-options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:48 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:48 GMT
- Thu, 16 Jul 2020 19:35:26 GMT
x-ms-version:
- '2019-07-07'
method: POST
Expand All @@ -33,7 +33,7 @@ interactions:
content-type:
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
date:
- Thu, 16 Jul 2020 15:32:46 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
location:
- https://storagename.table.core.windows.net/Tables('uttablef9b6145a')
server:
Expand Down Expand Up @@ -61,13 +61,13 @@ interactions:
DataServiceVersion:
- '3.0'
Date:
- Thu, 16 Jul 2020 15:32:48 GMT
- Thu, 16 Jul 2020 19:35:27 GMT
If-Match:
- '*'
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:48 GMT
- Thu, 16 Jul 2020 19:35:27 GMT
x-ms-version:
- '2019-07-07'
method: DELETE
Expand All @@ -77,16 +77,16 @@ interactions:
string: '<?xml version="1.0" encoding="utf-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>ResourceNotFound</code><message
xml:lang="en-US">The specified resource does not exist.
RequestId:e79a8321-4002-0016-3886-5b1fff000000
RequestId:5fd974b4-e002-0041-54a8-5bbd1e000000
Time:2020-07-16T15:32:47.1038039Z</message></error>'
Time:2020-07-16T19:35:25.9441993Z</message></error>'
headers:
cache-control:
- no-cache
content-type:
- application/xml;charset=utf-8
date:
- Thu, 16 Jul 2020 15:32:46 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
transfer-encoding:
Expand All @@ -110,11 +110,11 @@ interactions:
Content-Length:
- '0'
Date:
- Thu, 16 Jul 2020 15:32:48 GMT
- Thu, 16 Jul 2020 19:35:27 GMT
User-Agent:
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
x-ms-date:
- Thu, 16 Jul 2020 15:32:48 GMT
- Thu, 16 Jul 2020 19:35:27 GMT
x-ms-version:
- '2019-07-07'
method: DELETE
Expand All @@ -128,7 +128,7 @@ interactions:
content-length:
- '0'
date:
- Thu, 16 Jul 2020 15:32:46 GMT
- Thu, 16 Jul 2020 19:35:25 GMT
server:
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
x-content-type-options:
Expand Down
Loading

0 comments on commit a799d47

Please sign in to comment.