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

Win py27 issue #13595

Merged
merged 4 commits into from
Sep 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def _from_entity_datetime(value):
def _from_entity_guid(value):
return UUID(value)

def _from_entity_str(value):
return EntityProperty(value=value, type=EdmType.STRING)

_EDM_TYPES = [EdmType.BINARY, EdmType.INT64, EdmType.GUID, EdmType.DATETIME,
EdmType.STRING, EdmType.INT32, EdmType.DOUBLE, EdmType.BOOLEAN]
Expand All @@ -103,6 +105,7 @@ def _from_entity_guid(value):
EdmType.DOUBLE: float,
EdmType.DATETIME: _from_entity_datetime,
EdmType.GUID: _from_entity_guid,
EdmType.STRING: _from_entity_str
}


Expand Down Expand Up @@ -162,6 +165,14 @@ def _convert_to_entity(entry_element):
if type(value) is int and mtype is None: # pylint:disable=C0123
mtype = EdmType.INT32

# Add type for String, keeps
try:
if type(value) is unicode and mtype is None: # pylint:disable=C0123
mtype = EdmType.STRING
except NameError:
if type(value) is str and mtype is None: # pylint:disable=C0123
mtype = EdmType.STRING

# no type info, property should parse automatically
if not mtype:
entity[name] = value
Expand Down
15 changes: 12 additions & 3 deletions sdk/tables/azure-data-tables/azure/data/tables/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _to_entity_int(value):


def _to_entity_str(value):
return None, value
return EdmType.STRING, value


def _to_entity_none(value): # pylint:disable=W0613
Expand All @@ -159,10 +159,19 @@ def _to_entity_none(value): # pylint:disable=W0613
bool: _to_entity_bool,
datetime: _to_entity_datetime,
float: _to_entity_float,
str: _to_entity_str,
bytes: _to_entity_binary,
UUID: _to_entity_guid
}
try:
_PYTHON_TO_ENTITY_CONVERSIONS.update({
unicode: _to_entity_str,
str: _to_entity_binary,
long: _to_entity_int32,
})
except NameError:
_PYTHON_TO_ENTITY_CONVERSIONS.update({
str: _to_entity_str,
bytes: _to_entity_binary,
})

# Conversion from Edm type to a function which returns a tuple of the
# type string and content string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class _TableQueryStringConstants(QueryStringConstants):
class _TableSharedAccessHelper(_SharedAccessHelper):

def __init__(self):
super().__init__()
super(_TableSharedAccessHelper, self).__init__()
self.query_dict = {}

def add_table_access_ranges(self, table_name, start_pk, start_rk,
Expand Down
Loading