Skip to content

Commit

Permalink
[Tables] Fixed cspell typos in data-tables (Azure#25906)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonhyeongseo authored and mccoyp committed Sep 22, 2022
1 parent a819f8a commit 105db92
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 50 deletions.
28 changes: 27 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
"sdk/webpubsub/azure-messaging-webpubsubservice/**",
"sdk/translation/azure-ai-translation-document/samples/assets/**",
"sdk/translation/azure-ai-translation-document/tests/glossaries-valid.csv",
"sdk/tables/azure-data-tables/**",
"sdk/storage/azure-storage-blob/**",
"sdk/ml/azure-ai-ml/azure/ai/ml/_restclient/**",
"sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/job_name_generator.py",
Expand Down Expand Up @@ -366,6 +365,33 @@
"Phong"
]
},
{
"filename": "sdk/tables/azure-data-tables/tests/**/*.py",
"words": [
"tzutc",
"tzoffset",
"BRST",
"uttable",
"pytablesync",
"pytableasync",
"mydomain",
"myaccount",
"testid",
"clsid",
"doesnt",
"doesntexist"
]
},
{
"filename": "sdk/tables/azure-data-tables/**/*.py",
"words": [
"astimezone",
"myasynctable",
"mytableasync",
"mytable",
"edmtypes"
]
},
{
"filename": "sdk/translation/azure-ai-translation-document/tests/*.py",
"words": [
Expand Down
4 changes: 4 additions & 0 deletions sdk/tables/azure-data-tables/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
### Bugs Fixed
* Fixed bug where odmtype tag was not being included for boolean and int32 types even when a full EdmProperty tuple was passed in. This is needed for CLI compatibility.

[comment]: # ( cspell:ignore odmtype )

## 12.3.0 (2022-03-10)

### Bugs Fixed
Expand All @@ -45,6 +47,8 @@
### Features Added
* Added support for async iterators in `aio.TableClient.submit_transaction (#21083, thank you yashbhutoria).

[comment]: # ( cspell:ignore yashbhutoria )

### Other Changes
* Bumped dependency on `msrest` to `>=0.6.21`

Expand Down
4 changes: 3 additions & 1 deletion sdk/tables/azure-data-tables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ Common uses of the Table service included:
* Quickly querying data using a clustered index
* Accessing data using the OData protocol and LINQ filter expressions

[comment]: # ( cspell:ignore LINQ )

The following components make up the Azure Tables Service:
* The account
* A table within the account, which contains a set of entities
Expand Down Expand Up @@ -210,7 +212,7 @@ Querying entities in the table:
```python
from azure.data.tables import TableClient
my_filter = "PartitionKey eq 'RedMarker'"
table_client = TableClient.from_connection_string(conn_str="<connection_string>", table_name="mytable")
table_client = TableClient.from_connection_string(conn_str="<connection_string>", table_name="myTable")
entities = table_client.query_entities(my_filter)
for entity in entities:
for key in entity.keys():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
AsyncHttpTransport = None # type: ignore

try:
from yarl import URL
from yarl import URL # cspell:disable-line
except ImportError:
pass

Expand Down
10 changes: 5 additions & 5 deletions sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def _convert_to_entity(entry_element):
"IsActive":true,
"[email protected]":"Edm.Int64",
"NumberOfOrders":"255",
"PartitionKey":"mypartitionkey",
"RowKey":"myrowkey"
"PartitionKey":"my_partition_key",
"RowKey":"my_row_key"
}
"""
entity = TableEntity()
Expand Down Expand Up @@ -199,9 +199,9 @@ def _convert_to_entity(entry_element):
elif mtype in [EdmType.STRING, EdmType.INT32]:
entity[name] = value
else: # need an object to hold the property
conv = _ENTITY_TO_PYTHON_CONVERSIONS.get(mtype)
if conv is not None:
new_property = conv(value)
convert = _ENTITY_TO_PYTHON_CONVERSIONS.get(mtype)
if convert is not None:
new_property = convert(value)
else:
new_property = EntityProperty(mtype, value)
entity[name] = new_property
Expand Down
2 changes: 1 addition & 1 deletion sdk/tables/azure-data-tables/azure/data/tables/_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class EdmType(str, Enum): # pylint: disable=enum-must-inherit-case-insensitive-e
""" Represents a double. This type will be inferred for Python floating point numbers. """

BOOLEAN = "Edm.Boolean"
""" Represents a boolean. This type will be inferred for Python bools. """
""" Represents a boolean. This type will be inferred for Python booleans. """


EntityProperty = NamedTuple("EntityProperty", [("value", Any), ("edm_type", Union[str, EdmType])])
Expand Down
2 changes: 1 addition & 1 deletion sdk/tables/azure-data-tables/azure/data/tables/_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _validate_cosmos_tablename(table_name):

def _validate_tablename_error(decoded_error, table_name):
if (decoded_error.error_code == 'InvalidResourceName' and
'The specifed resource name contains invalid characters' in decoded_error.message):
'The specified resource name contains invalid characters' in decoded_error.message):
# This error is raised by Storage for any table/entity operations where the table name contains
# forbidden characters.
_validate_storage_tablename(table_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class TablesRetryPolicy(RetryPolicy):
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
(most errors are resolved immediately by a second try without a delay).
In fixed mode, retry policy will alwasy sleep for {backoff factor}.
In fixed mode, retry policy will always sleep for {backoff factor}.
In 'exponential' mode, retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))`
seconds. If the backoff_factor is 0.1, then the retry will sleep
for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8.
Expand Down
31 changes: 17 additions & 14 deletions sdk/tables/azure-data-tables/azure/data/tables/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ def _to_entity_int32(value):

def _to_entity_int64(value):
if sys.version_info < (3,):
ivalue = int(value)
int_value = int(value)
else:
ivalue = int(value)
if ivalue >= 2 ** 63 or ivalue < -(2 ** 63):
int_value = int(value)
if int_value >= 2 ** 63 or int_value < -(2 ** 63):
raise TypeError(_ERROR_VALUE_TOO_LARGE.format(str(value), EdmType.INT64))
return EdmType.INT64, str(value)

Expand Down Expand Up @@ -165,6 +165,8 @@ def _to_entity_none(value): # pylint: disable=unused-argument
}
)

# cspell:ignore Odatatype

# Conversion from Edm type to a function which returns a tuple of the
# type string and content string. These conversions are only used when the
# full EdmProperty tuple is specified. As a result, in this case we ALWAYS add
Expand Down Expand Up @@ -198,8 +200,8 @@ def _add_entity_properties(source):
"IsActive":true,
"[email protected]":"Edm.Int64",
"NumberOfOrders":"255",
"PartitionKey":"mypartitionkey",
"RowKey":"myrowkey"
"PartitionKey":"my_partition_key",
"RowKey":"my_row_key"
}
"""

Expand All @@ -214,23 +216,23 @@ def _add_entity_properties(source):

if isinstance(value, Enum):
try:
conv = _PYTHON_TO_ENTITY_CONVERSIONS.get(unicode) # type: ignore
convert = _PYTHON_TO_ENTITY_CONVERSIONS.get(unicode) # type: ignore
except NameError:
conv = _PYTHON_TO_ENTITY_CONVERSIONS.get(str)
mtype, value = conv(value)
convert = _PYTHON_TO_ENTITY_CONVERSIONS.get(str)
mtype, value = convert(value)
elif isinstance(value, datetime):
mtype, value = _to_entity_datetime(value)
elif isinstance(value, tuple):
conv = _EDM_TO_ENTITY_CONVERSIONS.get(value[1])
mtype, value = conv(value[0])
convert = _EDM_TO_ENTITY_CONVERSIONS.get(value[1])
mtype, value = convert(value[0])
else:
conv = _PYTHON_TO_ENTITY_CONVERSIONS.get(type(value))
if conv is None and value is not None:
convert = _PYTHON_TO_ENTITY_CONVERSIONS.get(type(value))
if convert is None and value is not None:
raise TypeError(_ERROR_TYPE_NOT_SUPPORTED.format(type(value)))
if value is None:
conv = _to_entity_none
convert = _to_entity_none

mtype, value = conv(value)
mtype, value = convert(value)

# form the property node
if value is not None:
Expand Down Expand Up @@ -260,6 +262,7 @@ def serialize_iso(attr):
raise OverflowError("Hit max or min date")

date = "{:04}-{:02}-{:02}T{:02}:{:02}:{:02}".format(
# cspell:disable-next-line
utc.tm_year, utc.tm_mon, utc.tm_mday, utc.tm_hour, utc.tm_min, utc.tm_sec
)
return date + "Z"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def generate_account(

return sas.get_token()


# cspell:ignoreRegExp rsc.
class QueryStringConstants(object):
SIGNED_SIGNATURE = "sig"
SIGNED_PERMISSION = "sp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,22 +229,22 @@ def generate_table(
is https,http. See :class:`~azure.cosmosdb.table.common.models.Protocol` for possible values.
:param str start_pk:
The minimum partition key accessible with this shared access
signature. startpk must accompany startrk. Key values are inclusive.
signature. startpk must accompany start_rk. Key values are inclusive.
If omitted, there is no lower bound on the table entities that can
be accessed.
:param str start_rk:
The minimum row key accessible with this shared access signature.
startpk must accompany startrk. Key values are inclusive. If
startpk must accompany start_rk. Key values are inclusive. If
omitted, there is no lower bound on the table entities that can be
accessed.
:param str end_pk:
The maximum partition key accessible with this shared access
signature. endpk must accompany endrk. Key values are inclusive. If
signature. end_pk must accompany end_rk. Key values are inclusive. If
omitted, there is no upper bound on the table entities that can be
accessed.
:param str end_rk:
The maximum row key accessible with this shared access signature.
endpk must accompany endrk. Key values are inclusive. If omitted,
end_pk must accompany end_rk. Key values are inclusive. If omitted,
there is no upper bound on the table entities that can be accessed.
"""
sas = _TableSharedAccessHelper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AsyncTablesRetryPolicy(AsyncRetryPolicy):
:keyword float retry_backoff_factor: A backoff factor to apply between attempts after the second try
(most errors are resolved immediately by a second try without a delay).
In fixed mode, retry policy will alwasy sleep for {backoff factor}.
In fixed mode, retry policy will always sleep for {backoff factor}.
In 'exponential' mode, retry policy will sleep for: `{backoff factor} * (2 ** ({number of total retries} - 1))`
seconds. If the backoff_factor is 0.1, then the retry will sleep
for [0.0s, 0.2s, 0.4s, ...] between retries. The default value is 0.8.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self):
"last_updated": datetime.today(),
"product_id": uuid4(),
"inventory_count": 42,
"barcode": b"135aefg8oj0ld58"
"barcode": b"135aefg8oj0ld58" # cspell:disable-line
}

async def create_entity(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def create_and_get_entities(self):
"last_updated": datetime.today(),
"product_id": uuid4(),
"inventory_count": 42,
"barcode": b"135aefg8oj0ld58"
"barcode": b"135aefg8oj0ld58" # cspell:disable-line
}

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self):
"last_updated": datetime.today(),
"product_id": uuid4(),
"inventory_count": 42,
"barcode": b"135aefg8oj0ld58"
"barcode": b"135aefg8oj0ld58" # cspell:disable-line
}

def create_entity(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create_and_get_entities(self):
"last_updated": datetime.today(),
"product_id": uuid4(),
"inventory_count": 42,
"barcode": b"135aefg8oj0ld58"
"barcode": b"135aefg8oj0ld58" # cspell:disable-line
}
try:
# [START create_entity]
Expand Down
18 changes: 9 additions & 9 deletions sdk/tables/azure-data-tables/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
ResourceTypes
)
from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
from azure.core.exceptions import ResourceExistsError
from azure.core.exceptions import ResourceExistsError, HttpResponseError

from _shared.testcase import TableTestCase, TEST_TABLE_PREFIX
from preparers import tables_decorator, tables_decorator
Expand Down Expand Up @@ -459,24 +459,24 @@ def test_account_sas(self, tables_storage_account_name, tables_primary_storage_a

@tables_decorator
@recorded_by_proxy
def test_unicode_create_table_unicode_name(self, tables_storage_account_name, tables_primary_storage_account_key):
def test_unicode_create_table_unicode_name(self, tables_storage_account_name, tables_primary_storage_account_key, **kwargs):
account_url = self.account_url(tables_storage_account_name, "table")
tsc = TableServiceClient(account_url, credential=tables_primary_storage_account_key)
tsc = TableServiceClient(credential=tables_primary_storage_account_key, endpoint=account_url)
invalid_table_name = u'啊齄丂狛狜'

with pytest.raises(ValueError) as excinfo:
with pytest.raises(HttpResponseError) as excinfo:
tsc.create_table(invalid_table_name)
assert "Storage table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str(
assert "Storage table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long." in str(
excinfo)

@tables_decorator
@recorded_by_proxy
def test_create_table_invalid_name(self, tables_storage_account_name, tables_primary_storage_account_key):
def test_create_table_invalid_name(self, tables_storage_account_name, tables_primary_storage_account_key, **kwargs):
account_url = self.account_url(tables_storage_account_name, "table")
tsc = TableServiceClient(account_url, credential=tables_primary_storage_account_key)
tsc = TableServiceClient(credential=tables_primary_storage_account_key, endpoint=account_url)
invalid_table_name = "my_table"

with pytest.raises(ValueError) as excinfo:
with pytest.raises(HttpResponseError) as excinfo:
tsc.create_table(invalid_table_name)
assert "Storage table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str(
assert "Storage table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long." in str(
excinfo)
10 changes: 5 additions & 5 deletions sdk/tables/azure-data-tables/tests/test_table_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from devtools_testutils.aio import recorded_by_proxy_async

from azure.core.credentials import AzureNamedKeyCredential, AzureSasCredential
from azure.core.exceptions import ResourceExistsError
from azure.core.exceptions import ResourceExistsError, HttpResponseError
from azure.data.tables import (
TableAccessPolicy,
TableSasPermissions,
Expand Down Expand Up @@ -405,25 +405,25 @@ async def test_account_sas(self, tables_storage_account_name, tables_primary_sto

@tables_decorator_async
@recorded_by_proxy_async
async def test_unicode_create_table_unicode_name(self, tables_storage_account_name, tables_primary_storage_account_key):
async def test_unicode_create_table_unicode_name(self, tables_storage_account_name, tables_primary_storage_account_key, **kwargs):
account_url = self.account_url(tables_storage_account_name, "table")
tsc = TableServiceClient(account_url, credential=tables_primary_storage_account_key)
invalid_table_name = u'啊齄丂狛狜'

with pytest.raises(ValueError) as excinfo:
with pytest.raises(HttpResponseError) as excinfo:
async with tsc:
await tsc.create_table(invalid_table_name)
assert "Storage table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str(
excinfo)

@tables_decorator_async
@recorded_by_proxy_async
async def test_create_table_invalid_name(self, tables_storage_account_name, tables_primary_storage_account_key):
async def test_create_table_invalid_name(self, tables_storage_account_name, tables_primary_storage_account_key, **kwargs):
account_url = self.account_url(tables_storage_account_name, "table")
tsc = TableServiceClient(account_url, credential=tables_primary_storage_account_key)
invalid_table_name = "my_table"

with pytest.raises(ValueError) as excinfo:
with pytest.raises(HttpResponseError) as excinfo:
async with tsc:
await tsc.create_table(table_name=invalid_table_name)
assert "Storage table names must be alphanumeric, cannot begin with a number, and must be between 3-63 characters long.""" in str(
Expand Down
2 changes: 1 addition & 1 deletion sdk/tables/azure-data-tables/tests/test_table_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from multiprocessing.sharedctypes import Value
from multiprocessing.sharedctypes import Value # cspell:disable-line
import pytest
import platform

Expand Down

0 comments on commit 105db92

Please sign in to comment.