Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 17 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"sdk/eventhub/azure-eventhub-checkpointstoreblob/**",
"sdk/eventhub/azure-eventhub/**",
"sdk/graphrbac/azure-graphrbac/**",
"sdk/formrecognizer/azure-ai-formrecognizer/**",
"sdk/formrecognizer/azure-ai-formrecognizer/samples/sample_forms/**",
"sdk/identity/azure-identity/tests/pod-identity/**",
"sdk/identity/azure-identity/tests/managed-identity-live/service-fabric/**",
"sdk/keyvault/azure-keyvault-certificates/tests/certs.py",
Expand Down Expand Up @@ -116,6 +116,7 @@
"adfs",
"adls",
"aiohttp",
"allinone",
"amqp",
"apim",
"asyncio",
Expand Down Expand Up @@ -146,6 +147,7 @@
"delenv",
"dependened",
"deserialization",
"dmac",
"docfx",
"dotenv",
"DWORD",
Expand All @@ -168,6 +170,7 @@
"hexlify",
"himds",
"hmac",
"ierr",
"illumos",
"imds",
"inotify",
Expand Down Expand Up @@ -233,6 +236,7 @@
"plex",
"pluggy",
"popen",
"prebuilts",
"pschema",
"PSECRET",
"pygobject",
Expand Down Expand Up @@ -369,6 +373,18 @@
"Zwiz",
"nypg"
]
},
{
"filename": "sdk/formrecognizer/azure-ai-formrecognizer/tests/*.py",
"words": [
"WDLABCD"
]
},
{
"filename": "sdk/formrecognizer/azure-ai-formrecognizer/**",
"words": [
"mymodel"
]
}
],
"allowCompoundWords": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def recognize_custom_forms(self, labeled_model_id, unlabeled_model_id):
model_id=model_trained_without_labels_id, form=form
)

# Calling result() after kicking off each call allows for server-side paralellization
# Calling result() after kicking off each call allows for server-side parallelization
forms_with_labeled_model = forms_with_labeled_model_poller.result()
forms_with_unlabeled_model = forms_with_unlabeled_model_poller.result()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
formrecognizer_selection_mark_storage_container_sas_url_v2="https://blob_sas_url",
formrecognizer_table_variable_rows_container_sas_url_v2="https://blob_sas_url",
formrecognizer_table_fixed_rows_container_sas_url_v2="https://blob_sas_url",
formrecognizer_resource_id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.CognitiveServices/accounts/frname",
formrecognizer_resource_id="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.CognitiveServices/accounts/formrecognizername",
formrecognizer_region="region"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@
}
],
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
},
"StatusCode": 202,
Expand Down Expand Up @@ -502,11 +502,11 @@
"apiVersion": "2022-01-30-preview",
"description": "my composed model",
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
},
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
}
],
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
},
"StatusCode": 202,
Expand Down Expand Up @@ -496,11 +496,11 @@
"apiVersion": "2022-01-30-preview",
"description": "my composed model",
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
},
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"containerUrl": "https://blob_sas_url"
},
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
},
"StatusCode": 202,
Expand Down Expand Up @@ -143,11 +143,11 @@
"apiVersion": "2022-01-30-preview",
"description": "a v3 model",
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
},
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"containerUrl": "https://blob_sas_url"
},
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
},
"StatusCode": 202,
Expand Down Expand Up @@ -141,11 +141,11 @@
"apiVersion": "2022-01-30-preview",
"description": "a v3 model",
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
},
"tags": {
"frtests": "testvalue"
"testkey": "testvalue"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def test_pdf(self):

def test_pdf_bytes(self):
with open(self.invoice_pdf, "rb") as fd:
myfile = fd.read()
content_type = get_content_type(myfile)
my_file = fd.read()
content_type = get_content_type(my_file)
assert content_type == "application/pdf"

def test_jpg(self):
Expand All @@ -29,8 +29,8 @@ def test_jpg(self):

def test_jpg_bytes(self):
with open(self.form_jpg, "rb") as fd:
myfile = fd.read()
content_type = get_content_type(myfile)
my_file = fd.read()
content_type = get_content_type(my_file)
assert content_type == "image/jpeg"

def test_png(self):
Expand All @@ -40,8 +40,8 @@ def test_png(self):

def test_png_bytes(self):
with open(self.receipt_png, "rb") as fd:
myfile = fd.read()
content_type = get_content_type(myfile)
my_file = fd.read()
content_type = get_content_type(my_file)
assert content_type == "image/png"

def test_tiff_little_endian(self):
Expand All @@ -51,8 +51,8 @@ def test_tiff_little_endian(self):

def test_tiff_little_endian_bytes(self):
with open(self.invoice_tiff, "rb") as fd:
myfile = fd.read()
content_type = get_content_type(myfile)
my_file = fd.read()
content_type = get_content_type(my_file)
assert content_type == "image/tiff"

def test_tiff_big_endian(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def callback(raw_response, _, headers):
responses.append(document)

with open(self.form_jpg, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

poller = da_client.begin_analyze_document(
model.model_id,
myfile,
my_file,
cls=callback
)
document = poller.result()
Expand Down Expand Up @@ -99,11 +99,11 @@ def callback(raw_response, _, headers):
responses.append(document)

with open(self.multipage_invoice_pdf, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

poller = da_client.begin_analyze_document(
model.model_id,
myfile,
my_file,
cls=callback
)
document = poller.result()
Expand Down Expand Up @@ -137,7 +137,7 @@ def test_custom_document_selection_mark(self, client, formrecognizer_selection_m
model = poller.result()

with open(self.selection_form_pdf, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

responses = []

Expand All @@ -149,7 +149,7 @@ def callback(raw_response, _, headers):

poller = da_client.begin_analyze_document(
model.model_id,
myfile,
my_file,
cls=callback
)
document = poller.result()
Expand Down Expand Up @@ -180,12 +180,12 @@ def test_pages_kwarg_specified(self, client, formrecognizer_storage_container_sa
da_client = client.get_document_analysis_client()

with open(self.form_jpg, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

build_poller = client.begin_build_model(formrecognizer_storage_container_sas_url, "template")
model = build_poller.result()

poller = da_client.begin_analyze_document(model.model_id, myfile, pages="1")
poller = da_client.begin_analyze_document(model.model_id, my_file, pages="1")
assert '1' == poller._polling_method._initial_response.http_response.request.query['pages']
result = poller.result()
assert result
Expand All @@ -198,14 +198,14 @@ def test_custom_document_signature_field(self, client, formrecognizer_storage_co
da_client = client.get_document_analysis_client()

with open(self.form_jpg, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

build_polling = client.begin_build_model(formrecognizer_storage_container_sas_url, "template")
model = build_polling.result()

poller = da_client.begin_analyze_document(
model.model_id,
myfile,
my_file,
)
result = poller.result()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def callback(raw_response, _, headers):
responses.append(document)

with open(self.form_jpg, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

async with client:
build_polling = await client.begin_build_model(formrecognizer_storage_container_sas_url, "template")
Expand All @@ -65,7 +65,7 @@ def callback(raw_response, _, headers):
async with da_client:
poller = await da_client.begin_analyze_document(
model.model_id,
myfile,
my_file,
cls=callback
)
document = await poller.result()
Expand Down Expand Up @@ -104,7 +104,7 @@ def callback(raw_response, _, headers):
responses.append(document)

with open(self.multipage_invoice_pdf, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

async with client:
build_poller = await client.begin_build_model(formrecognizer_multipage_storage_container_sas_url, "template")
Expand All @@ -113,7 +113,7 @@ def callback(raw_response, _, headers):
async with da_client:
poller = await da_client.begin_analyze_document(
model.model_id,
myfile,
my_file,
cls=callback
)
document = await poller.result()
Expand Down Expand Up @@ -143,7 +143,7 @@ async def test_custom_document_selection_mark(self, client, formrecognizer_selec
set_bodiless_matcher()
da_client = client.get_document_analysis_client()
with open(self.selection_form_pdf, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

responses = []

Expand All @@ -159,7 +159,7 @@ def callback(raw_response, _, headers):

poller = await da_client.begin_analyze_document(
model.model_id,
myfile,
my_file,
cls=callback
)
document = await poller.result()
Expand Down Expand Up @@ -190,14 +190,14 @@ async def test_pages_kwarg_specified(self, client, formrecognizer_storage_contai
da_client = client.get_document_analysis_client()

with open(self.form_jpg, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

async with client:
build_poller = await client.begin_build_model(formrecognizer_storage_container_sas_url, "template")
model = await build_poller.result()

async with da_client:
poller = await da_client.begin_analyze_document(model.model_id, myfile, pages="1")
poller = await da_client.begin_analyze_document(model.model_id, my_file, pages="1")
assert '1' == poller._polling_method._initial_response.http_response.request.query['pages']
result = await poller.result()
assert result
Expand All @@ -210,7 +210,7 @@ async def test_custom_document_signature_field(self, client, formrecognizer_stor
da_client = client.get_document_analysis_client()

with open(self.form_jpg, "rb") as fd:
myfile = fd.read()
my_file = fd.read()

async with client:
build_polling = await client.begin_build_model(formrecognizer_storage_container_sas_url, "template")
Expand All @@ -219,7 +219,7 @@ async def test_custom_document_signature_field(self, client, formrecognizer_stor
async with da_client:
poller = await da_client.begin_analyze_document(
model.model_id,
myfile,
my_file,
)
result = await poller.result()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def callback(raw_response, _, headers):
@recorded_by_proxy
def test_document_multipage_table_span_pdf(self, client):
with open(self.multipage_table_pdf, "rb") as fd:
myfile = fd.read()
poller = client.begin_analyze_document("prebuilt-document", myfile)
my_file = fd.read()
poller = client.begin_analyze_document("prebuilt-document", my_file)
document = poller.result()
assert len(document.tables) == 3
assert document.tables[0].row_count == 30
Expand Down
Loading