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

[translation] fix spelling according to cspell #22858

Merged
merged 1 commit into from
Feb 1, 2022
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
7 changes: 6 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
"sdk/videoanalyzer/azure-media-videoanalyzer-edge/**",
"sdk/synapse/azure-synapse-artifacts/**",
"sdk/webpubsub/azure-messaging-webpubsubservice/**",
"sdk/translation/azure-ai-translation-document/**",
"sdk/translation/azure-ai-translation-document/samples/assets/**",
"sdk/translation/azure-ai-translation-document/tests/glossaries-valid.csv",
"sdk/tables/azure-data-tables/**",
"sdk/textanalytics/azure-ai-textanalytics/**",
"sdk/storage/azure-storage-blob/**",
Expand All @@ -119,6 +120,8 @@
"adls",
"aiohttp",
"amqp",
"apim",
"Apim",
"asyncio",
"azcmagent",
"azsdk",
Expand Down Expand Up @@ -159,6 +162,7 @@
"imds",
"inotify",
"iohttp",
"inprogress",
"ipconfiguration",
"ipconfigurations",
"iscoroutine",
Expand Down Expand Up @@ -203,6 +207,7 @@
"pschema",
"PSECRET",
"pygobject",
"pytz",
"pywin",
"rdbms",
"reauthenticated",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def list_translation_statuses(self, **kwargs):
:keyword int top: the total number of operations to return (across all pages) from all submitted translations.
:keyword int skip: the number of operations to skip (from beginning of all submitted operations).
By default, we sort by all submitted operations descendingly by start time.
By default, we sort by all submitted operations in descending order by start time.
:keyword int results_per_page: is the number of operations returned per page.
:keyword list[str] translation_ids: translation operations ids to filter by.
:keyword list[str] statuses: translation operation statuses to filter by. Options include
Expand Down Expand Up @@ -324,7 +324,7 @@ def list_document_statuses(self, translation_id, **kwargs):
:param str translation_id: ID of translation operation to list documents for.
:keyword int top: the total number of documents to return (across all pages).
:keyword int skip: the number of documents to skip (from beginning).
By default, we sort by all documents descendingly by start time.
By default, we sort by all documents in descending order by start time.
:keyword int results_per_page: is the number of documents returned per page.
:keyword list[str] document_ids: document IDs to filter by.
:keyword list[str] statuses: document statuses to filter by. Options include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def list_translation_statuses(self, **kwargs):

:keyword int top: the total number of operations to return (across all pages) from all submitted translations.
:keyword int skip: the number of operations to skip (from beginning of all submitted operations).
By default, we sort by all submitted operations descendingly by start time.
By default, we sort by all submitted operations in descending order by start time.
:keyword int results_per_page: is the number of operations returned per page.
:keyword list[str] translation_ids: translation operations ids to filter by.
:keyword list[str] statuses: translation operation statuses to filter by. Options include
Expand Down Expand Up @@ -333,7 +333,7 @@ def list_document_statuses(self, translation_id, **kwargs):
:param str translation_id: ID of translation operation to list documents for.
:keyword int top: the total number of documents to return (across all pages).
:keyword int skip: the number of documents to skip (from beginning).
By default, we sort by all documents descendingly by start time.
By default, we sort by all documents in descending order by start time.
:keyword int results_per_page: is the number of documents returned per page.
:keyword list[str] document_ids: document IDs to filter by.
:keyword list[str] statuses: document statuses to filter by. Options include
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
6) AZURE_STORAGE_SOURCE_CONTAINER_NAME - the name of your source container
7) AZURE_STORAGE_TARGET_CONTAINER_NAME - the name of your target container
8) AZURE_DOCUMENT_NAME - the name and file extension of your document in this directory
e.g. "mydocument.txt"
e.g. "document.txt"
"""

import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
6) AZURE_STORAGE_SOURCE_CONTAINER_NAME - the name of your source container
7) AZURE_STORAGE_TARGET_CONTAINER_NAME - the name of your target container
8) AZURE_DOCUMENT_NAME - the name and file extension of your document in this directory
e.g. "mydocument.txt"
e.g. "document.txt"
"""

import os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async def _begin_multiple_translations_async(self, async_client, operations_coun
return result_ids

async def _begin_and_validate_translation_with_multiple_docs_async(self, async_client, docs_count, **kwargs):
# get input parms
# get input params
wait_for_operation = kwargs.pop('wait', False)
language_code = kwargs.pop('language_code', "es")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ def test_list_document_statuses_order_by_creation_time_asc(self, client):
doc_statuses = list(client.list_document_statuses(poller.id, order_by=["created_on asc"])) # convert from generic iterator to list
self.assertEqual(len(doc_statuses), docs_count)

curr = datetime.min
current = datetime.min
for document in doc_statuses:
assert(document.created_on.replace(tzinfo=None) >= curr.replace(tzinfo=None))
curr = document.created_on
assert(document.created_on.replace(tzinfo=None) >= current.replace(tzinfo=None))
current = document.created_on


@DocumentTranslationPreparer()
Expand All @@ -152,10 +152,10 @@ def test_list_document_statuses_order_by_creation_time_desc(self, client):
doc_statuses = list(client.list_document_statuses(poller.id, order_by=["created_on desc"])) # convert from generic iterator to list
self.assertEqual(len(doc_statuses), docs_count)

curr = datetime.max
current = datetime.max
for document in doc_statuses:
assert(document.created_on.replace(tzinfo=None) <= curr.replace(tzinfo=None))
curr = document.created_on
assert(document.created_on.replace(tzinfo=None) <= current.replace(tzinfo=None))
current = document.created_on

@DocumentTranslationPreparer()
@DocumentTranslationClientPreparer()
Expand Down Expand Up @@ -190,15 +190,15 @@ def test_list_document_statuses_mixed_filters(self, client):

# check statuses
counter = 0
curr_time = datetime.min
current_time = datetime.min
for page in filtered_docs:
page_docs = list(page)
self.assertLessEqual(len(page_docs), results_per_page) # assert paging
for doc in page_docs:
counter += 1
# assert ordering
assert(doc.created_on.replace(tzinfo=None) >= curr_time.replace(tzinfo=None))
curr_time = doc.created_on
assert(doc.created_on.replace(tzinfo=None) >= current_time.replace(tzinfo=None))
current_time = doc.created_on
# assert filters
self.assertIn(doc.status, statuses)
self.assertIn(doc.id, ids)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ async def test_list_document_statuses_order_by_creation_time_asc(self, client):
# check doc statuses
doc_statuses = client.list_document_statuses(poller.id, order_by=["created_on asc"])

curr = datetime.min
current = datetime.min
docs = []
async for document in doc_statuses:
docs.append(document)
assert(document.created_on.replace(tzinfo=None) >= curr.replace(tzinfo=None))
curr = document.created_on
assert(document.created_on.replace(tzinfo=None) >= current.replace(tzinfo=None))
current = document.created_on

self.assertEqual(len(docs), docs_count)

Expand All @@ -177,12 +177,12 @@ async def test_list_document_statuses_order_by_creation_time_desc(self, client):
# check doc statuses
doc_statuses = client.list_document_statuses(poller.id, order_by=["created_on desc"])

curr = datetime.max
current = datetime.max
docs = []
async for document in doc_statuses:
docs.append(document)
assert(document.created_on.replace(tzinfo=None) <= curr.replace(tzinfo=None))
curr = document.created_on
assert(document.created_on.replace(tzinfo=None) <= current.replace(tzinfo=None))
current = document.created_on

self.assertEqual(len(docs), docs_count)

Expand Down Expand Up @@ -218,15 +218,15 @@ async def test_list_document_statuses_mixed_filters(self, client):

# check statuses
counter = 0
curr_time = datetime.min
current_time = datetime.min
async for page in filtered_docs:
page_docs = []
async for doc in page:
counter += 1
page_docs.append(doc)
# assert ordering
assert(doc.created_on.replace(tzinfo=None) >= curr_time.replace(tzinfo=None))
curr_time = doc.created_on
assert(doc.created_on.replace(tzinfo=None) >= current_time.replace(tzinfo=None))
current_time = doc.created_on
# assert filters
self.assertIn(doc.status, statuses)
self.assertIn(doc.id, ids)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ def test_list_translations_order_by_creation_time_asc(self, client):
self.assertIsNotNone(submitted_translations)

# check statuses
curr = datetime.min
current = datetime.min
for translation in submitted_translations:
assert(translation.created_on.replace(tzinfo=None) >= curr.replace(tzinfo=None))
curr = translation.created_on
assert(translation.created_on.replace(tzinfo=None) >= current.replace(tzinfo=None))
current = translation.created_on


@DocumentTranslationPreparer()
Expand All @@ -199,10 +199,10 @@ def test_list_translations_order_by_creation_time_desc(self, client):
self.assertIsNotNone(submitted_translations)

# check statuses
curr = datetime.max
current = datetime.max
for translation in submitted_translations:
assert(translation.created_on.replace(tzinfo=None) <= curr.replace(tzinfo=None))
curr = translation.created_on
assert(translation.created_on.replace(tzinfo=None) <= current.replace(tzinfo=None))
current = translation.created_on

@pytest.mark.live_test_only()
@DocumentTranslationPreparer()
Expand Down Expand Up @@ -234,15 +234,15 @@ def test_list_translations_mixed_filters(self, client):
).by_page()

# check statuses
curr_time = datetime.min
current_time = datetime.min
for page in submitted_translations:
page_translations = list(page)
self.assertLessEqual(len(page_translations), results_per_page) # assert paging
for translation in page_translations:
self.assertIn(translation.id, successful_translation_ids)
# assert ordering
assert(translation.created_on.replace(tzinfo=None) >= curr_time.replace(tzinfo=None))
curr_time = translation.created_on
assert(translation.created_on.replace(tzinfo=None) >= current_time.replace(tzinfo=None))
current_time = translation.created_on
# assert filters
assert(translation.created_on.replace(tzinfo=None) <= end.replace(tzinfo=None))
assert(translation.created_on.replace(tzinfo=None) >= start.replace(tzinfo=None))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ async def test_list_translations_order_by_creation_time_asc(self, client):
self.assertIsNotNone(submitted_translations)

# check statuses
curr = datetime.min
current = datetime.min
async for translation in submitted_translations:
assert(translation.created_on.replace(tzinfo=None) >= curr.replace(tzinfo=None))
curr = translation.created_on
assert(translation.created_on.replace(tzinfo=None) >= current.replace(tzinfo=None))
current = translation.created_on


@DocumentTranslationPreparer()
Expand All @@ -211,10 +211,10 @@ async def test_list_translations_order_by_creation_time_desc(self, client):
self.assertIsNotNone(submitted_translations)

# check statuses
curr = datetime.max
current = datetime.max
async for translation in submitted_translations:
assert(translation.created_on.replace(tzinfo=None) <= curr.replace(tzinfo=None))
curr = translation.created_on
assert(translation.created_on.replace(tzinfo=None) <= current.replace(tzinfo=None))
current = translation.created_on

@pytest.mark.live_test_only()
@DocumentTranslationPreparer()
Expand Down Expand Up @@ -246,16 +246,16 @@ async def test_list_translations_mixed_filters(self, client):
).by_page()

# check statuses
curr_time = datetime.min
current_time = datetime.min
async for page in submitted_translations:
counter = 0
async for translation in page:
counter += 1
# assert id
self.assertIn(translation.id, successful_translation_ids)
# assert ordering
assert(translation.created_on.replace(tzinfo=None) >= curr_time.replace(tzinfo=None))
curr_time = translation.created_on
assert(translation.created_on.replace(tzinfo=None) >= current_time.replace(tzinfo=None))
current_time = translation.created_on
# assert filters
assert(translation.created_on.replace(tzinfo=None) <= end.replace(tzinfo=None))
assert(translation.created_on.replace(tzinfo=None) >= start.replace(tzinfo=None))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,6 @@ def test_translation_with_glossary(self, client):

with open(document, "rb") as fd:
translated = fd.readline()

# cSpell:ignore essai
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend using an override like this in the config so we don't couple our source code to the cspell tool.

    ...
    "overrides": [
      {
        "filename": "sdk/translation/azure-ai-translation-document/tests/*.py",
        "words": [
          "essai"
        ]
      },
      ...
    ]...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it - thanks. I somehow missed that way of ignoring while reading the docs. Opened a PR to fix here: #22865

assert b'essai' in translated # glossary worked
os.remove(document)
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,6 @@ async def test_translation_with_glossary(self, client):

with open(document, "rb") as fd:
translated = fd.readline()

# cSpell:ignore essai
assert b'essai' in translated # glossary worked
os.remove(document)
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _begin_multiple_translations(self, client, operations_count, **kwargs):
return result_job_ids

def _begin_and_validate_translation_with_multiple_docs(self, client, docs_count, **kwargs):
# get input parms
# get input params
wait_for_operation = kwargs.pop('wait', False)
language_code = kwargs.pop('language_code', "es")

Expand Down