Skip to content

Commit a799d47

Browse files
committed
fix #2 dateutil
1 parent 1f8e970 commit a799d47

File tree

64 files changed

+1038
-1043
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1038
-1043
lines changed

sdk/table/azure-table/azure/table/_deserialize.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
# license information.
55
# --------------------------------------------------------------------------
66
# pylint: disable=unused-argument
7+
import datetime
78
from uuid import UUID
8-
from dateutil.parser import parse
99
from azure.table._shared import url_quote
1010
from azure.table._entity import EntityProperty, EdmType, Entity
1111
from azure.table._shared._common_conversion import _decode_base64_to_bytes
1212
from azure.table._generated.models import TableProperties
1313
from azure.core.exceptions import ResourceExistsError
1414

15-
1615
from ._shared.models import TableErrorCode
1716

1817

@@ -54,7 +53,9 @@ def _from_entity_int32(value):
5453

5554

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

5960

6061
def _from_entity_guid(value):
@@ -119,7 +120,9 @@ def _convert_to_entity(entry_element):
119120
# Timestamp is a known property
120121
timestamp = properties.pop('Timestamp', None)
121122
if timestamp:
122-
entity['Timestamp'] = _from_entity_datetime(timestamp)
123+
# TODO: verify change here
124+
# entity['Timestamp'] = _from_entity_datetime(timestamp)
125+
entity['Timestamp'] = timestamp
123126

124127
for name, value in properties.items():
125128
mtype = edmtypes.get(name)

sdk/table/azure-table/tests/recordings/test_table_entity.test_binary_property_value.yaml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ interactions:
1515
DataServiceVersion:
1616
- '3.0'
1717
Date:
18-
- Thu, 16 Jul 2020 15:32:46 GMT
18+
- Thu, 16 Jul 2020 19:35:25 GMT
1919
User-Agent:
2020
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
2121
x-ms-date:
22-
- Thu, 16 Jul 2020 15:32:46 GMT
22+
- Thu, 16 Jul 2020 19:35:25 GMT
2323
x-ms-version:
2424
- '2019-07-07'
2525
method: POST
@@ -33,7 +33,7 @@ interactions:
3333
content-type:
3434
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
3535
date:
36-
- Thu, 16 Jul 2020 15:32:45 GMT
36+
- Thu, 16 Jul 2020 19:35:23 GMT
3737
location:
3838
- https://storagename.table.core.windows.net/Tables('uttable99fe1256')
3939
server:
@@ -64,27 +64,27 @@ interactions:
6464
DataServiceVersion:
6565
- '3.0'
6666
Date:
67-
- Thu, 16 Jul 2020 15:32:47 GMT
67+
- Thu, 16 Jul 2020 19:35:25 GMT
6868
User-Agent:
6969
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
7070
x-ms-date:
71-
- Thu, 16 Jul 2020 15:32:47 GMT
71+
- Thu, 16 Jul 2020 19:35:25 GMT
7272
x-ms-version:
7373
- '2019-07-07'
7474
method: POST
7575
uri: https://storagename.table.core.windows.net/uttable99fe1256
7676
response:
7777
body:
78-
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","[email protected]":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}'
78+
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","[email protected]":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}'
7979
headers:
8080
cache-control:
8181
- no-cache
8282
content-type:
8383
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
8484
date:
85-
- Thu, 16 Jul 2020 15:32:45 GMT
85+
- Thu, 16 Jul 2020 19:35:23 GMT
8686
etag:
87-
- W/"datetime'2020-07-16T15%3A32%3A45.7387783Z'"
87+
- W/"datetime'2020-07-16T19%3A35%3A24.5973502Z'"
8888
location:
8989
- https://storagename.table.core.windows.net/uttable99fe1256(PartitionKey='pk99fe1256',RowKey='rk99fe1256')
9090
server:
@@ -110,27 +110,27 @@ interactions:
110110
DataServiceVersion:
111111
- '3.0'
112112
Date:
113-
- Thu, 16 Jul 2020 15:32:47 GMT
113+
- Thu, 16 Jul 2020 19:35:25 GMT
114114
User-Agent:
115115
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
116116
x-ms-date:
117-
- Thu, 16 Jul 2020 15:32:47 GMT
117+
- Thu, 16 Jul 2020 19:35:25 GMT
118118
x-ms-version:
119119
- '2019-07-07'
120120
method: GET
121121
uri: https://storagename.table.core.windows.net/uttable99fe1256(PartitionKey='pk99fe1256',RowKey='rk99fe1256')
122122
response:
123123
body:
124-
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","[email protected]":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}'
124+
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","[email protected]":"Edm.Binary","binary":"AQIDBAUGBwgJCg=="}'
125125
headers:
126126
cache-control:
127127
- no-cache
128128
content-type:
129129
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
130130
date:
131-
- Thu, 16 Jul 2020 15:32:45 GMT
131+
- Thu, 16 Jul 2020 19:35:24 GMT
132132
etag:
133-
- W/"datetime'2020-07-16T15%3A32%3A45.7387783Z'"
133+
- W/"datetime'2020-07-16T19%3A35%3A24.5973502Z'"
134134
server:
135135
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
136136
transfer-encoding:
@@ -154,11 +154,11 @@ interactions:
154154
Content-Length:
155155
- '0'
156156
Date:
157-
- Thu, 16 Jul 2020 15:32:47 GMT
157+
- Thu, 16 Jul 2020 19:35:26 GMT
158158
User-Agent:
159159
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
160160
x-ms-date:
161-
- Thu, 16 Jul 2020 15:32:47 GMT
161+
- Thu, 16 Jul 2020 19:35:26 GMT
162162
x-ms-version:
163163
- '2019-07-07'
164164
method: DELETE
@@ -172,7 +172,7 @@ interactions:
172172
content-length:
173173
- '0'
174174
date:
175-
- Thu, 16 Jul 2020 15:32:45 GMT
175+
- Thu, 16 Jul 2020 19:35:24 GMT
176176
server:
177177
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
178178
x-content-type-options:

sdk/table/azure-table/tests/recordings/test_table_entity.test_delete_entity.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ interactions:
1515
DataServiceVersion:
1616
- '3.0'
1717
Date:
18-
- Thu, 16 Jul 2020 15:32:47 GMT
18+
- Thu, 16 Jul 2020 19:35:26 GMT
1919
User-Agent:
2020
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
2121
x-ms-date:
22-
- Thu, 16 Jul 2020 15:32:47 GMT
22+
- Thu, 16 Jul 2020 19:35:26 GMT
2323
x-ms-version:
2424
- '2019-07-07'
2525
method: POST
@@ -33,7 +33,7 @@ interactions:
3333
content-type:
3434
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
3535
date:
36-
- Thu, 16 Jul 2020 15:32:45 GMT
36+
- Thu, 16 Jul 2020 19:35:24 GMT
3737
location:
3838
- https://storagename.table.core.windows.net/Tables('uttable12440ee0')
3939
server:
@@ -69,27 +69,27 @@ interactions:
6969
DataServiceVersion:
7070
- '3.0'
7171
Date:
72-
- Thu, 16 Jul 2020 15:32:47 GMT
72+
- Thu, 16 Jul 2020 19:35:26 GMT
7373
User-Agent:
7474
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
7575
x-ms-date:
76-
- Thu, 16 Jul 2020 15:32:47 GMT
76+
- Thu, 16 Jul 2020 19:35:26 GMT
7777
x-ms-version:
7878
- '2019-07-07'
7979
method: POST
8080
uri: https://storagename.table.core.windows.net/uttable12440ee0
8181
response:
8282
body:
83-
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","[email protected]":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"[email protected]":"Edm.Int64","large":"933311100","[email protected]":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","[email protected]":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","[email protected]":"Edm.Binary","binary":"YmluYXJ5","other":20,"[email protected]":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}'
83+
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","[email protected]":"Edm.Int64","age":"39","sex":"male","married":true,"deceased":false,"ratio":3.1,"evenratio":3.0,"[email protected]":"Edm.Int64","large":"933311100","[email protected]":"Edm.DateTime","Birthday":"1973-10-04T00:00:00Z","[email protected]":"Edm.DateTime","birthday":"1970-10-04T00:00:00Z","[email protected]":"Edm.Binary","binary":"YmluYXJ5","other":20,"[email protected]":"Edm.Guid","clsid":"c9da6455-213d-42c9-9a79-3e9149a57833"}'
8484
headers:
8585
cache-control:
8686
- no-cache
8787
content-type:
8888
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
8989
date:
90-
- Thu, 16 Jul 2020 15:32:45 GMT
90+
- Thu, 16 Jul 2020 19:35:24 GMT
9191
etag:
92-
- W/"datetime'2020-07-16T15%3A32%3A46.3623741Z'"
92+
- W/"datetime'2020-07-16T19%3A35%3A25.2397166Z'"
9393
location:
9494
- https://storagename.table.core.windows.net/uttable12440ee0(PartitionKey='pk12440ee0',RowKey='rk12440ee0')
9595
server:
@@ -117,13 +117,13 @@ interactions:
117117
DataServiceVersion:
118118
- '3.0'
119119
Date:
120-
- Thu, 16 Jul 2020 15:32:47 GMT
120+
- Thu, 16 Jul 2020 19:35:26 GMT
121121
If-Match:
122122
- '*'
123123
User-Agent:
124124
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
125125
x-ms-date:
126-
- Thu, 16 Jul 2020 15:32:47 GMT
126+
- Thu, 16 Jul 2020 19:35:26 GMT
127127
x-ms-version:
128128
- '2019-07-07'
129129
method: DELETE
@@ -137,7 +137,7 @@ interactions:
137137
content-length:
138138
- '0'
139139
date:
140-
- Thu, 16 Jul 2020 15:32:45 GMT
140+
- Thu, 16 Jul 2020 19:35:24 GMT
141141
server:
142142
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
143143
x-content-type-options:
@@ -159,26 +159,26 @@ interactions:
159159
DataServiceVersion:
160160
- '3.0'
161161
Date:
162-
- Thu, 16 Jul 2020 15:32:47 GMT
162+
- Thu, 16 Jul 2020 19:35:26 GMT
163163
User-Agent:
164164
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
165165
x-ms-date:
166-
- Thu, 16 Jul 2020 15:32:47 GMT
166+
- Thu, 16 Jul 2020 19:35:26 GMT
167167
x-ms-version:
168168
- '2019-07-07'
169169
method: GET
170170
uri: https://storagename.table.core.windows.net/uttable12440ee0(PartitionKey='pk12440ee0',RowKey='rk12440ee0')
171171
response:
172172
body:
173173
string: '{"odata.error":{"code":"ResourceNotFound","message":{"lang":"en-US","value":"The
174-
specified resource does not exist.\nRequestId:0039691e-c002-0048-2b86-5becfc000000\nTime:2020-07-16T15:32:46.5465021Z"}}}'
174+
specified resource does not exist.\nRequestId:960daaec-1002-0098-48a8-5b1b32000000\nTime:2020-07-16T19:35:25.4118369Z"}}}'
175175
headers:
176176
cache-control:
177177
- no-cache
178178
content-type:
179179
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
180180
date:
181-
- Thu, 16 Jul 2020 15:32:45 GMT
181+
- Thu, 16 Jul 2020 19:35:24 GMT
182182
server:
183183
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
184184
transfer-encoding:
@@ -202,11 +202,11 @@ interactions:
202202
Content-Length:
203203
- '0'
204204
Date:
205-
- Thu, 16 Jul 2020 15:32:47 GMT
205+
- Thu, 16 Jul 2020 19:35:26 GMT
206206
User-Agent:
207207
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
208208
x-ms-date:
209-
- Thu, 16 Jul 2020 15:32:47 GMT
209+
- Thu, 16 Jul 2020 19:35:26 GMT
210210
x-ms-version:
211211
- '2019-07-07'
212212
method: DELETE
@@ -220,7 +220,7 @@ interactions:
220220
content-length:
221221
- '0'
222222
date:
223-
- Thu, 16 Jul 2020 15:32:45 GMT
223+
- Thu, 16 Jul 2020 19:35:24 GMT
224224
server:
225225
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
226226
x-content-type-options:

sdk/table/azure-table/tests/recordings/test_table_entity.test_delete_entity_not_existing.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ interactions:
1515
DataServiceVersion:
1616
- '3.0'
1717
Date:
18-
- Thu, 16 Jul 2020 15:32:48 GMT
18+
- Thu, 16 Jul 2020 19:35:26 GMT
1919
User-Agent:
2020
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
2121
x-ms-date:
22-
- Thu, 16 Jul 2020 15:32:48 GMT
22+
- Thu, 16 Jul 2020 19:35:26 GMT
2323
x-ms-version:
2424
- '2019-07-07'
2525
method: POST
@@ -33,7 +33,7 @@ interactions:
3333
content-type:
3434
- application/json;odata=minimalmetadata;streaming=true;charset=utf-8
3535
date:
36-
- Thu, 16 Jul 2020 15:32:46 GMT
36+
- Thu, 16 Jul 2020 19:35:25 GMT
3737
location:
3838
- https://storagename.table.core.windows.net/Tables('uttablef9b6145a')
3939
server:
@@ -61,13 +61,13 @@ interactions:
6161
DataServiceVersion:
6262
- '3.0'
6363
Date:
64-
- Thu, 16 Jul 2020 15:32:48 GMT
64+
- Thu, 16 Jul 2020 19:35:27 GMT
6565
If-Match:
6666
- '*'
6767
User-Agent:
6868
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
6969
x-ms-date:
70-
- Thu, 16 Jul 2020 15:32:48 GMT
70+
- Thu, 16 Jul 2020 19:35:27 GMT
7171
x-ms-version:
7272
- '2019-07-07'
7373
method: DELETE
@@ -77,16 +77,16 @@ interactions:
7777
string: '<?xml version="1.0" encoding="utf-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>ResourceNotFound</code><message
7878
xml:lang="en-US">The specified resource does not exist.
7979
80-
RequestId:e79a8321-4002-0016-3886-5b1fff000000
80+
RequestId:5fd974b4-e002-0041-54a8-5bbd1e000000
8181
82-
Time:2020-07-16T15:32:47.1038039Z</message></error>'
82+
Time:2020-07-16T19:35:25.9441993Z</message></error>'
8383
headers:
8484
cache-control:
8585
- no-cache
8686
content-type:
8787
- application/xml;charset=utf-8
8888
date:
89-
- Thu, 16 Jul 2020 15:32:46 GMT
89+
- Thu, 16 Jul 2020 19:35:25 GMT
9090
server:
9191
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
9292
transfer-encoding:
@@ -110,11 +110,11 @@ interactions:
110110
Content-Length:
111111
- '0'
112112
Date:
113-
- Thu, 16 Jul 2020 15:32:48 GMT
113+
- Thu, 16 Jul 2020 19:35:27 GMT
114114
User-Agent:
115115
- azsdk-python-storage-table/2019-07-07 Python/3.8.3 (Windows-10-10.0.19041-SP0)
116116
x-ms-date:
117-
- Thu, 16 Jul 2020 15:32:48 GMT
117+
- Thu, 16 Jul 2020 19:35:27 GMT
118118
x-ms-version:
119119
- '2019-07-07'
120120
method: DELETE
@@ -128,7 +128,7 @@ interactions:
128128
content-length:
129129
- '0'
130130
date:
131-
- Thu, 16 Jul 2020 15:32:46 GMT
131+
- Thu, 16 Jul 2020 19:35:25 GMT
132132
server:
133133
- Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0
134134
x-content-type-options:

0 commit comments

Comments
 (0)