From 105db92cea8c4429a17dcbb6c7deedeb73bd7142 Mon Sep 17 00:00:00 2001 From: Wonhyeong Seo Date: Tue, 13 Sep 2022 04:59:28 +0900 Subject: [PATCH] [Tables] Fixed cspell typos in data-tables (#25906) --- .vscode/cspell.json | 28 ++++++++++++++++- sdk/tables/azure-data-tables/CHANGELOG.md | 4 +++ sdk/tables/azure-data-tables/README.md | 4 ++- .../azure/data/tables/_authentication.py | 2 +- .../azure/data/tables/_deserialize.py | 10 +++--- .../azure/data/tables/_entity.py | 2 +- .../azure/data/tables/_error.py | 2 +- .../azure/data/tables/_policies.py | 2 +- .../azure/data/tables/_serialize.py | 31 ++++++++++--------- .../data/tables/_shared_access_signature.py | 2 +- .../tables/_table_shared_access_signature.py | 8 ++--- .../azure/data/tables/aio/_policies_async.py | 2 +- .../sample_insert_delete_entities_async.py | 2 +- ...mple_update_upsert_merge_entities_async.py | 2 +- .../samples/sample_insert_delete_entities.py | 2 +- .../sample_update_upsert_merge_entities.py | 2 +- .../azure-data-tables/tests/test_table.py | 18 +++++------ .../tests/test_table_async.py | 10 +++--- .../tests/test_table_client.py | 2 +- 19 files changed, 85 insertions(+), 50 deletions(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index d2c5fb4ebd4b..71869518c92e 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -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", @@ -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": [ diff --git a/sdk/tables/azure-data-tables/CHANGELOG.md b/sdk/tables/azure-data-tables/CHANGELOG.md index 918a4bc8f004..d818b065ce4d 100644 --- a/sdk/tables/azure-data-tables/CHANGELOG.md +++ b/sdk/tables/azure-data-tables/CHANGELOG.md @@ -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 @@ -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` diff --git a/sdk/tables/azure-data-tables/README.md b/sdk/tables/azure-data-tables/README.md index 1eeadd39ca42..2e976e7e1870 100644 --- a/sdk/tables/azure-data-tables/README.md +++ b/sdk/tables/azure-data-tables/README.md @@ -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 @@ -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="", table_name="mytable") +table_client = TableClient.from_connection_string(conn_str="", table_name="myTable") entities = table_client.query_entities(my_filter) for entity in entities: for key in entity.keys(): diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py b/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py index 83dd8c639fdf..0ff2afef945f 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_authentication.py @@ -20,7 +20,7 @@ AsyncHttpTransport = None # type: ignore try: - from yarl import URL + from yarl import URL # cspell:disable-line except ImportError: pass diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py index e81c5ada9a85..f1cfcae8eee9 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_deserialize.py @@ -144,8 +144,8 @@ def _convert_to_entity(entry_element): "IsActive":true, "NumberOfOrders@odata.type":"Edm.Int64", "NumberOfOrders":"255", - "PartitionKey":"mypartitionkey", - "RowKey":"myrowkey" + "PartitionKey":"my_partition_key", + "RowKey":"my_row_key" } """ entity = TableEntity() @@ -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 diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_entity.py b/sdk/tables/azure-data-tables/azure/data/tables/_entity.py index 385f0f6e2f12..dd7baa398a07 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_entity.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_entity.py @@ -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])]) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_error.py b/sdk/tables/azure-data-tables/azure/data/tables/_error.py index 439ed6e2892f..2a5a1b9bff89 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_error.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_error.py @@ -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) diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py index 1cb05388280d..54d083928682 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_policies.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_policies.py @@ -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. diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py index de91dbd046a3..b22b1fdb9f59 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_serialize.py @@ -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) @@ -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 @@ -198,8 +200,8 @@ def _add_entity_properties(source): "IsActive":true, "NumberOfOrders@odata.type":"Edm.Int64", "NumberOfOrders":"255", - "PartitionKey":"mypartitionkey", - "RowKey":"myrowkey" + "PartitionKey":"my_partition_key", + "RowKey":"my_row_key" } """ @@ -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: @@ -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" diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py index e80c725156d0..dea674439082 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_shared_access_signature.py @@ -108,7 +108,7 @@ def generate_account( return sas.get_token() - +# cspell:ignoreRegExp rsc. class QueryStringConstants(object): SIGNED_SIGNATURE = "sig" SIGNED_PERMISSION = "sp" diff --git a/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py b/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py index eec1aac2110b..e948754c4250 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/_table_shared_access_signature.py @@ -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() diff --git a/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py b/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py index 5f23dece3524..62011bd72d8e 100644 --- a/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py +++ b/sdk/tables/azure-data-tables/azure/data/tables/aio/_policies_async.py @@ -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. diff --git a/sdk/tables/azure-data-tables/samples/async_samples/sample_insert_delete_entities_async.py b/sdk/tables/azure-data-tables/samples/async_samples/sample_insert_delete_entities_async.py index 13659abd7847..5e3897855bdb 100644 --- a/sdk/tables/azure-data-tables/samples/async_samples/sample_insert_delete_entities_async.py +++ b/sdk/tables/azure-data-tables/samples/async_samples/sample_insert_delete_entities_async.py @@ -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): diff --git a/sdk/tables/azure-data-tables/samples/async_samples/sample_update_upsert_merge_entities_async.py b/sdk/tables/azure-data-tables/samples/async_samples/sample_update_upsert_merge_entities_async.py index 6c29de97d124..69167fa91a75 100644 --- a/sdk/tables/azure-data-tables/samples/async_samples/sample_update_upsert_merge_entities_async.py +++ b/sdk/tables/azure-data-tables/samples/async_samples/sample_update_upsert_merge_entities_async.py @@ -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: diff --git a/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py b/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py index a68542247fc1..7a0b726f8264 100644 --- a/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py +++ b/sdk/tables/azure-data-tables/samples/sample_insert_delete_entities.py @@ -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): diff --git a/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py b/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py index cccfac8b355a..1f0f15b2ad4f 100644 --- a/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py +++ b/sdk/tables/azure-data-tables/samples/sample_update_upsert_merge_entities.py @@ -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] diff --git a/sdk/tables/azure-data-tables/tests/test_table.py b/sdk/tables/azure-data-tables/tests/test_table.py index 5372274764b6..8b61f1a588ea 100644 --- a/sdk/tables/azure-data-tables/tests/test_table.py +++ b/sdk/tables/azure-data-tables/tests/test_table.py @@ -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 @@ -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) diff --git a/sdk/tables/azure-data-tables/tests/test_table_async.py b/sdk/tables/azure-data-tables/tests/test_table_async.py index 01b21c4a0c87..7628ad44e824 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_async.py +++ b/sdk/tables/azure-data-tables/tests/test_table_async.py @@ -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, @@ -405,12 +405,12 @@ 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( @@ -418,12 +418,12 @@ async def test_unicode_create_table_unicode_name(self, tables_storage_account_na @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( diff --git a/sdk/tables/azure-data-tables/tests/test_table_client.py b/sdk/tables/azure-data-tables/tests/test_table_client.py index 94172e3f87f7..727dd4423b1a 100644 --- a/sdk/tables/azure-data-tables/tests/test_table_client.py +++ b/sdk/tables/azure-data-tables/tests/test_table_client.py @@ -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