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

Add cloud event to core #16800

Merged
merged 54 commits into from
Mar 3, 2021
Merged
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
abe2389
Add cloud event to core
rakshith91 Feb 18, 2021
9ed935d
extensions
rakshith91 Feb 18, 2021
d11e02f
raise on both
rakshith91 Feb 18, 2021
ec3474c
minor
rakshith91 Feb 18, 2021
e658ce7
more changes
rakshith91 Feb 18, 2021
50de6e6
Update sdk/core/azure-core/azure/core/messaging.py
Feb 18, 2021
9f3624b
comments
rakshith91 Feb 18, 2021
04acd47
changes
rakshith91 Feb 19, 2021
f18f35d
test fix
rakshith91 Feb 19, 2021
9400e0e
test
rakshith91 Feb 19, 2021
70e08c0
comments
rakshith91 Feb 21, 2021
b69cd73
lint
rakshith91 Feb 21, 2021
89c80b5
mypy
rakshith91 Feb 21, 2021
10d81c3
type hint
rakshith91 Feb 22, 2021
a121adc
Apply suggestions from code review
Feb 22, 2021
428e35c
serialize date
rakshith91 Feb 24, 2021
c88c1e9
fix
rakshith91 Feb 24, 2021
f638961
fix
rakshith91 Feb 24, 2021
13335c1
fix
rakshith91 Feb 24, 2021
2dec996
Docstring
lmazuel Feb 24, 2021
c3368d5
change util
rakshith91 Feb 24, 2021
f461890
lint
rakshith91 Feb 24, 2021
248db3d
apply black
rakshith91 Feb 24, 2021
32b2532
utilize tz utc
rakshith91 Feb 25, 2021
2441222
comments
rakshith91 Feb 25, 2021
666bbd7
raise on unexpected kwargs
rakshith91 Feb 25, 2021
45d2a90
doc
rakshith91 Feb 25, 2021
8c1f9fc
lint
rakshith91 Feb 25, 2021
8dcf54c
more lint
rakshith91 Feb 25, 2021
f0d718f
attrs are optional
rakshith91 Feb 26, 2021
950ffed
add sentinel
rakshith91 Feb 26, 2021
c15a73a
falsy object
rakshith91 Feb 28, 2021
a756fe3
few more asserts
rakshith91 Feb 28, 2021
6b4a31f
lint
rakshith91 Feb 28, 2021
9371f77
pyt2 compat
rakshith91 Feb 28, 2021
78696ef
tests
rakshith91 Mar 1, 2021
79e74d4
comments
rakshith91 Mar 1, 2021
a9c05f4
update toc tree
rakshith91 Mar 1, 2021
57b1bd0
doc
rakshith91 Mar 1, 2021
e8b53b0
doc
rakshith91 Mar 1, 2021
3a16ca9
doc
rakshith91 Mar 1, 2021
37e887c
unconditional
rakshith91 Mar 1, 2021
8e196ef
test fix
rakshith91 Mar 1, 2021
b4c726e
mypy
rakshith91 Mar 1, 2021
3f49138
wrong import
rakshith91 Mar 1, 2021
22db8b8
type annotations
rakshith91 Mar 2, 2021
6e9ce14
data
rakshith91 Mar 2, 2021
43a79c1
coment
rakshith91 Mar 2, 2021
ba654a0
assets
rakshith91 Mar 2, 2021
4f9d80e
lint
rakshith91 Mar 2, 2021
0a3aa87
unnecessary none
rakshith91 Mar 3, 2021
5051034
format
rakshith91 Mar 3, 2021
c7afd6e
cast to str
rakshith91 Mar 3, 2021
9613fd4
remove cast
rakshith91 Mar 3, 2021
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
Prev Previous commit
Next Next commit
change util
  • Loading branch information
rakshith91 committed Feb 24, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit c3368d5e206ef8cd4f33fbaf067190134f9352d7
31 changes: 13 additions & 18 deletions sdk/core/azure-core/azure/core/_utils.py
Original file line number Diff line number Diff line change
@@ -35,27 +35,22 @@ def _convert_to_isoformat(date_time):
"""Deserialize a date in RFC 3339 format to datetime object.
Check https://tools.ietf.org/html/rfc3339#section-5.8 for examples.
"""
timestamp = re.split(r"([+|-])", re.sub(r"[:]|([-](?!((\d{2}[:]\d{2})|(\d{4}))$))", '', date_time))
if len(timestamp) == 3:
time, sign, tzone = timestamp
if date_time[-1] == 'Z':
delta = 0
timestamp = date_time[:-1]
else:
time = timestamp[0]
sign, tzone = None, None
timestamp = date_time[:-6]
sign, offset = date_time[-6], date_time[-5:]
delta = int(sign+offset[:1])*60 + int(sign+offset[-2:])

try:
deserialized = datetime.datetime.strptime(time, "%Y%m%dT%H%M%S.%fZ")
deserialized = datetime.datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%f')
except ValueError:
try:
deserialized = datetime.datetime.strptime(time, "%Y%m%dT%H%M%S.%f")
except ValueError:
deserialized = datetime.datetime.strptime(time, "%Y%m%dT%H%M%S")

if tzone:
minutes = int(sign+tzone[:-2])*60 + int(sign+tzone[-2:])
delta = datetime.timedelta(minutes=minutes)
try:
deserialized = deserialized.replace(tzinfo=datetime.timezone(delta))
except AttributeError:
deserialized = deserialized.replace(tzinfo=_FixedOffset(minutes))
deserialized = datetime.datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S')

try:
deserialized = deserialized.replace(tzinfo=datetime.timezone(datetime.timedelta(minutes=delta)))
except AttributeError:
deserialized = deserialized.replace(tzinfo=_FixedOffset(delta))

return deserialized