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

migrate code from googleapis/python-documentai #8450

Closed
wants to merge 227 commits into from

Conversation

nicain
Copy link
Contributor

@nicain nicain commented Nov 2, 2022

Migrate documentai samples from https://github.com/googleapis/python-documentai/tree/main/samples, as a part of go/dee-lang-mono-repos migration pilot

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

yoshi-automation and others added 30 commits September 30, 2020 17:50
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/1b172ea4-6e2b-49f2-b1b9-cadea69c5d6e/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 324046932
Source-Link: googleapis/googleapis@26e80fe
PiperOrigin-RevId: 324035013
Source-Link: googleapis/googleapis@8cda089
PiperOrigin-RevId: 323630732
Source-Link: googleapis/googleapis@74e8cf8
PiperOrigin-RevId: 322700241
Source-Link: googleapis/googleapis@a1c9dba
PiperOrigin-RevId: 322659285
Source-Link: googleapis/googleapis@5d0eacc
PiperOrigin-RevId: 322174882
Source-Link: googleapis/googleapis@4ceb9b6
PiperOrigin-RevId: 321807443
Source-Link: googleapis/googleapis@abb30a0
PiperOrigin-RevId: 320253786
Source-Link: googleapis/googleapis@ad486bc
PiperOrigin-RevId: 319910951
Source-Link: googleapis/googleapis@8c85e06
* add noxfile and requirements.txt

* refactor requirements.txt

* add newline

* add newline

* add newline
* batch_process_sample. changing from async to synchronous

* add quick start and process_document samples and tests

* add test and sample for batch_process

* add test and sample for batch_process

* resolve formatting

* use os.environ

* remove os.path.join

* move tests

* descriptive variable

* specific Exception, formatting

* parse all pages in process_document

* add more helpful comments

* remove unused imports

* better exception handling

* rename test files

* ran linter, removed nested function in batch predict

* refactor tests

* format imports

* format imports

* format imports

* serialize as Document object

* extract get_text helper function

* fix file path

* delete test bucket

* Update samples/snippets/batch_process_documents_sample_v1beta3_test.py

Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>

* Update samples/snippets/batch_process_documents_sample_v1beta3_test.py

Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>

* add more specific assertion in batch_process

* add more specific assertion in process_document and quickstart

* fix output_uri name

* Apply suggestions from code review to resolve exception

Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>

* resolve exception

* lint

Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
* chores: fixed small issue with start index problem

* added missing update
autosynth cannot find the source of changes triggered by earlier changes in this
        repository, or by version upgrades to tools such as linters.
Fixes #62  🦕


Current version of sample doesnt check if blob is directory or .json file. Then, it  downloads as bytes and tries to parse json from the dir blob file which will cause error.
* samples: added test that covers the wrong file type case
* docs(python): update intersphinx for grpc and auth

* docs(python): update intersphinx for grpc and auth

* use https for python intersphinx

Co-authored-by: Tim Swast <swast@google.com>

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Wed Nov 18 14:37:25 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 9a7d9fbb7045c34c9d3d22c1ff766eeae51f04c9
Source-Link: googleapis/synthtool@9a7d9fb

* docs(python): fix intersphinx link for google-auth

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Thu Nov 19 10:16:05 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: a073c873f3928c561bdf87fdfbf1d081d1998984
Source-Link: googleapis/synthtool@a073c87

* chore: add config / docs for 'pre-commit' support

Source-Author: Tres Seaver <tseaver@palladion.com>
Source-Date: Tue Dec 1 16:01:20 2020 -0500
Source-Repo: googleapis/synthtool
Source-Sha: 32af6da519a6b042e3da62008e2a75e991efb6b4
Source-Link: googleapis/synthtool@32af6da

* chore(deps): update precommit hook pre-commit/pre-commit-hooks to v3.3.0

Source-Author: WhiteSource Renovate <bot@renovateapp.com>
Source-Date: Wed Dec 2 17:18:24 2020 +0100
Source-Repo: googleapis/synthtool
Source-Sha: 69629b64b83c6421d616be2b8e11795738ec8a6c
Source-Link: googleapis/synthtool@69629b6

* test(python): give filesystem paths to pytest-cov

https://pytest-cov.readthedocs.io/en/latest/config.html

The pytest-cov docs seem to suggest a filesystem path is expected.

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Wed Dec 2 09:28:04 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: f94318521f63085b9ccb43d42af89f153fb39f15
Source-Link: googleapis/synthtool@f943185

* chore: update noxfile.py.j2

* Update noxfile.py.j2

add changes from @glasnt to the template template to ensure that enforcing type hinting doesn't fail for repos with the sample noxfile (aka all samples repos)
See https://github.com/GoogleCloudPlatform/python-docs-samples/pull/4869/files for context

* fix typo

Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
Source-Date: Thu Dec 3 13:44:30 2020 -0800
Source-Repo: googleapis/synthtool
Source-Sha: 18c5dbdb4ac8cf75d4d8174e7b4558f48e76f8a1
Source-Link: googleapis/synthtool@18c5dbd

* chore(deps): update precommit hook pre-commit/pre-commit-hooks to v3.4.0

Co-authored-by: Tres Seaver <tseaver@palladion.com>

Source-Author: WhiteSource Renovate <bot@renovateapp.com>
Source-Date: Wed Dec 16 18:13:24 2020 +0100
Source-Repo: googleapis/synthtool
Source-Sha: aa255b15d52b6d8950cca48cfdf58f7d27a60c8a
Source-Link: googleapis/synthtool@aa255b1

* docs(python): document adding Python 3.9 support, dropping 3.5 support

Closes #787

Source-Author: Tres Seaver <tseaver@palladion.com>
Source-Date: Thu Dec 17 16:08:02 2020 -0500
Source-Repo: googleapis/synthtool
Source-Sha: b670a77a454f415d247907908e8ee7943e06d718
Source-Link: googleapis/synthtool@b670a77

* chore: exclude `.nox` directories from linting

The samples tests create `.nox` directories
with all dependencies installed. These directories
should be excluded from linting.

I've tested this change locally, and it significantly
speeds up linting on my machine.

Source-Author: Tim Swast <swast@google.com>
Source-Date: Tue Dec 22 13:04:04 2020 -0600
Source-Repo: googleapis/synthtool
Source-Sha: 373861061648b5fe5e0ac4f8a38b32d639ee93e4
Source-Link: googleapis/synthtool@3738610
* samples: migrate v1beta2 doc AI samples

* added noxfile

* reformatted code

* organized imports in right order

* lint

* finally fixed lint

* reorganized folders

* imports

* added from prefix imports

* renamed files

* renamed package on tests files

* nit
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [google-cloud-storage](https://togithub.com/googleapis/python-storage) | minor | `==1.33.0` -> `==1.35.0` |

---

### Release Notes

<details>
<summary>googleapis/python-storage</summary>

### [`v1.35.0`](https://togithub.com/googleapis/python-storage/blob/master/CHANGELOG.md#&#8203;1350-httpswwwgithubcomgoogleapispython-storagecomparev1340v1350-2020-12-14)

[Compare Source](https://togithub.com/googleapis/python-storage/compare/v1.34.0...v1.35.0)

##### Features

-   support ConnectionError retries for media operations ([#&#8203;342](https://www.github.com/googleapis/python-storage/issues/342)) ([e55b25b](https://www.github.com/googleapis/python-storage/commit/e55b25be1e32f17b17bffe1da99fca5062f180cb))

### [`v1.34.0`](https://togithub.com/googleapis/python-storage/blob/master/CHANGELOG.md#&#8203;1340-httpswwwgithubcomgoogleapispython-storagecomparev1330v1340-2020-12-11)

[Compare Source](https://togithub.com/googleapis/python-storage/compare/v1.33.0...v1.34.0)

##### Features

-   make retry parameter public and added in other methods ([#&#8203;331](https://www.github.com/googleapis/python-storage/issues/331)) ([910e34c](https://www.github.com/googleapis/python-storage/commit/910e34c57de5823bc3a04adbd87cbfe27fb41882))

##### Bug Fixes

-   avoid triggering global logging config ([#&#8203;333](https://www.github.com/googleapis/python-storage/issues/333)) ([602108a](https://www.github.com/googleapis/python-storage/commit/602108a976503271fe0d85c8d7891ce8083aca89)), closes [#&#8203;332](https://www.github.com/googleapis/python-storage/issues/332)
-   fall back to 'charset' of 'content_type' in 'download_as_text'  ([#&#8203;326](https://www.github.com/googleapis/python-storage/issues/326)) ([63ff233](https://www.github.com/googleapis/python-storage/commit/63ff23387f5873c609490be8e58d69ba34a10a5e)), closes [#&#8203;319](https://www.github.com/googleapis/python-storage/issues/319)
-   fix conditional retry handling of camelCase query params ([#&#8203;340](https://www.github.com/googleapis/python-storage/issues/340)) ([4ff6141](https://www.github.com/googleapis/python-storage/commit/4ff614161f6a2654a59706f4f72b5fbb614e70ec))
-   retry uploads only conditionally ([#&#8203;316](https://www.github.com/googleapis/python-storage/issues/316)) ([547740c](https://www.github.com/googleapis/python-storage/commit/547740c0a898492e76ce5e60dd20c7ddb8a53d1f))
-   update 'custom_time' setter to record change ([#&#8203;323](https://www.github.com/googleapis/python-storage/issues/323)) ([5174154](https://www.github.com/googleapis/python-storage/commit/5174154fe73bb6581efc3cd32ebe12014ceab306)), closes [#&#8203;322](https://www.github.com/googleapis/python-storage/issues/322)

</details>

---

### Renovate configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-documentai).
The samples tests create `.nox` directories
with all dependencies installed. These directories
should be excluded from linting.

I've tested this change locally, and it significantly
speeds up linting on my machine.

Source-Author: Tim Swast <swast@google.com>
Source-Date: Tue Dec 22 13:04:04 2020 -0600
Source-Repo: googleapis/synthtool
Source-Sha: 373861061648b5fe5e0ac4f8a38b32d639ee93e4
Source-Link: googleapis/synthtool@3738610
* fix: swaps 'continue' for 'return'
* fix: adds switching code for client_options based upon location
* chore(python): skip docfx in main presubmit

* fix: properly template the repo name

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Fri Jan 8 10:32:13 2021 -0700
Source-Repo: googleapis/synthtool
Source-Sha: fb53b6fb373b7c3edf4e55f3e8036bc6d73fa483
Source-Link: googleapis/synthtool@fb53b6f

* chore: add missing quotation mark

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Mon Jan 11 09:43:06 2021 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 16ec872dd898d7de6e1822badfac32484b5d9031
Source-Link: googleapis/synthtool@16ec872

* chore: add 3.9 to noxfile template

Since the python-docs-samples noxfile-template doesn't sync with this, I wanted to make sure the noxfile template matched the most recent change [here](https://github.com/GoogleCloudPlatform/python-docs-samples/pull/4968/files)

cc @tmatsuo

Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
Source-Date: Fri Jan 15 17:24:05 2021 -0800
Source-Repo: googleapis/synthtool
Source-Sha: 56ddc68f36b32341e9f22c2c59b4ce6aa3ba635f
Source-Link: googleapis/synthtool@56ddc68

* build(python): make `NOX_SESSION` optional

I added this accidentally in #889. `NOX_SESSION` should be passed down if it is set but not marked required.

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Tue Jan 19 09:38:04 2021 -0700
Source-Repo: googleapis/synthtool
Source-Sha: ba960d730416fe05c50547e975ce79fcee52c671
Source-Link: googleapis/synthtool@ba960d7

* chore: Add header checker config to python library synth

Now that we have it working in [python-docs-samples](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/header-checker-lint.yml) we should consider adding it to the 🐍 libraries :)

Source-Author: Leah E. Cole <6719667+leahecole@users.noreply.github.com>
Source-Date: Mon Jan 25 13:24:08 2021 -0800
Source-Repo: googleapis/synthtool
Source-Sha: 573f7655311b553a937f9123bee17bf78497db95
Source-Link: googleapis/synthtool@573f765

* chore: add noxfile parameters for extra dependencies

Also, add tests for some noxfile parameters for assurance that the
template generates valid Python.

Co-authored-by: Jeffrey Rennie <rennie@google.com>

Source-Author: Tim Swast <swast@google.com>
Source-Date: Tue Jan 26 12:26:57 2021 -0600
Source-Repo: googleapis/synthtool
Source-Sha: 778d8beae28d6d87eb01fdc839a4b4d966ed2ebe
Source-Link: googleapis/synthtool@778d8be

* build: migrate to flakybot

Source-Author: Justin Beckwith <justin.beckwith@gmail.com>
Source-Date: Thu Jan 28 22:22:38 2021 -0800
Source-Repo: googleapis/synthtool
Source-Sha: d1bb9173100f62c0cfc8f3138b62241e7f47ca6a
Source-Link: googleapis/synthtool@d1bb917

* chore(python): include py.typed files in release

A py.typed file must be included in the released package for it to be considered typed by type checkers. https://www.python.org/dev/peps/pep-0561/#packaging-type-information. See googleapis/python-secret-manager#79

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Fri Feb 5 17:32:06 2021 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 33366574ffb9e11737b3547eb6f020ecae0536e8
Source-Link: googleapis/synthtool@3336657

* docs: update python contributing guide

Adds details about blacken, updates version for system tests,
and shows how to pass through pytest arguments.

Source-Author: Chris Cotter <cjcotter@google.com>
Source-Date: Mon Feb 8 17:13:36 2021 -0500
Source-Repo: googleapis/synthtool
Source-Sha: 4679e7e415221f03ff2a71e3ffad75b9ec41d87e
Source-Link: googleapis/synthtool@4679e7e

* build(python): enable flakybot on library unit and system tests

Source-Author: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Source-Date: Wed Feb 17 14:10:46 2021 -0700
Source-Repo: googleapis/synthtool
Source-Sha: d17674372e27fb8f23013935e794aa37502071aa
Source-Link: googleapis/synthtool@d176743

* test: install pyopenssl for mtls testing

Source-Author: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com>
Source-Date: Tue Mar 2 12:27:56 2021 -0800
Source-Repo: googleapis/synthtool
Source-Sha: 0780323da96d5a53925fe0547757181fe76e8f1e
Source-Link: googleapis/synthtool@0780323
* samples: more updates for v1

* fix: lint

* fix: tests

* fix: tests

* fix: tests
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/60d94463-5a7c-4c76-829d-2ff8e6f3696f/targets

- [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.)

Source-Link: googleapis/synthtool@0a071b3
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-cloud-storage](https://togithub.com/googleapis/python-storage) | `==1.37.0` -> `==1.37.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.37.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.37.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.37.1/compatibility-slim/1.37.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-cloud-storage/1.37.1/confidence-slim/1.37.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-storage</summary>

### [`v1.37.1`](https://togithub.com/googleapis/python-storage/blob/master/CHANGELOG.md#&#8203;1371-httpswwwgithubcomgoogleapispython-storagecomparev1370v1371-2021-04-02)

[Compare Source](https://togithub.com/googleapis/python-storage/compare/v1.37.0...v1.37.1)

</details>

---

### Configuration

:date: **Schedule**: At any time (no schedule defined).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-documentai).
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pytest](https://docs.pytest.org/en/latest/) ([source](https://togithub.com/pytest-dev/pytest), [changelog](https://docs.pytest.org/en/stable/changelog.html)) | `==6.1.1` -> `==6.2.4` | [![age](https://badges.renovateapi.com/packages/pypi/pytest/6.2.4/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/pytest/6.2.4/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/pytest/6.2.4/compatibility-slim/6.1.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/pytest/6.2.4/confidence-slim/6.1.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>pytest-dev/pytest</summary>

### [`v6.2.4`](https://togithub.com/pytest-dev/pytest/releases/6.2.4)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.2.3...6.2.4)

# pytest 6.2.4 (2021-05-04)

## Bug Fixes

-   [#&#8203;8539](https://togithub.com/pytest-dev/pytest/issues/8539): Fixed assertion rewriting on Python 3.10.

### [`v6.2.3`](https://togithub.com/pytest-dev/pytest/releases/6.2.3)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.2.2...6.2.3)

# pytest 6.2.3 (2021-04-03)

## Bug Fixes

-   [#&#8203;8414](https://togithub.com/pytest-dev/pytest/issues/8414): pytest used to create directories under `/tmp` with world-readable
    permissions. This means that any user in the system was able to read
    information written by tests in temporary directories (such as those created by
    the `tmp_path`/`tmpdir` fixture). Now the directories are created with
    private permissions.

    pytest used silenty use a pre-existing `/tmp/pytest-of-<username>` directory,
    even if owned by another user. This means another user could pre-create such a
    directory and gain control of another user\\'s temporary directory. Now such a
    condition results in an error.

### [`v6.2.2`](https://togithub.com/pytest-dev/pytest/releases/6.2.2)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.2.1...6.2.2)

# pytest 6.2.2 (2021-01-25)

## Bug Fixes

-   [#&#8203;8152](https://togithub.com/pytest-dev/pytest/issues/8152): Fixed "(&lt;Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty.
-   [#&#8203;8249](https://togithub.com/pytest-dev/pytest/issues/8249): Fix the `faulthandler` plugin for occasions when running with `twisted.logger` and using `pytest --capture=no`.

### [`v6.2.1`](https://togithub.com/pytest-dev/pytest/releases/6.2.1)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.2.0...6.2.1)

# pytest 6.2.1 (2020-12-15)

## Bug Fixes

-   [#&#8203;7678](https://togithub.com/pytest-dev/pytest/issues/7678): Fixed bug where `ImportPathMismatchError` would be raised for files compiled in
    the host and loaded later from an UNC mounted path (Windows).
-   [#&#8203;8132](https://togithub.com/pytest-dev/pytest/issues/8132): Fixed regression in `approx`: in 6.2.0 `approx` no longer raises
    `TypeError` when dealing with non-numeric types, falling back to normal comparison.
    Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case,
    and happened to compare correctly to a scalar if they had only one element.
    After 6.2.0, these types began failing, because they inherited neither from
    standard Python number hierarchy nor from `numpy.ndarray`.

    `approx` now converts arguments to `numpy.ndarray` if they expose the array
    protocol and are not scalars. This treats array-like objects like numpy arrays,
    regardless of size.

### [`v6.2.0`](https://togithub.com/pytest-dev/pytest/releases/6.2.0)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.1.2...6.2.0)

# pytest 6.2.0 (2020-12-12)

## Breaking Changes

-   [#&#8203;7808](https://togithub.com/pytest-dev/pytest/issues/7808): pytest now supports python3.6+ only.

## Deprecations

-   [#&#8203;7469](https://togithub.com/pytest-dev/pytest/issues/7469): Directly constructing/calling the following classes/functions is now deprecated:

    -   `_pytest.cacheprovider.Cache`
    -   `_pytest.cacheprovider.Cache.for_config()`
    -   `_pytest.cacheprovider.Cache.clear_cache()`
    -   `_pytest.cacheprovider.Cache.cache_dir_from_config()`
    -   `_pytest.capture.CaptureFixture`
    -   `_pytest.fixtures.FixtureRequest`
    -   `_pytest.fixtures.SubRequest`
    -   `_pytest.logging.LogCaptureFixture`
    -   `_pytest.pytester.Pytester`
    -   `_pytest.pytester.Testdir`
    -   `_pytest.recwarn.WarningsRecorder`
    -   `_pytest.recwarn.WarningsChecker`
    -   `_pytest.tmpdir.TempPathFactory`
    -   `_pytest.tmpdir.TempdirFactory`

    These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0.

-   [#&#8203;7530](https://togithub.com/pytest-dev/pytest/issues/7530): The `--strict` command-line option has been deprecated, use `--strict-markers` instead.

    We have plans to maybe in the future to reintroduce `--strict` and make it an encompassing flag for all strictness
    related options (`--strict-markers` and `--strict-config` at the moment, more might be introduced in the future).

-   [#&#8203;7988](https://togithub.com/pytest-dev/pytest/issues/7988): The `@pytest.yield_fixture` decorator/function is now deprecated. Use pytest.fixture instead.

    `yield_fixture` has been an alias for `fixture` for a very long time, so can be search/replaced safely.

## Features

-   [#&#8203;5299](https://togithub.com/pytest-dev/pytest/issues/5299): pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8.
    See unraisable for more information.
-   [#&#8203;7425](https://togithub.com/pytest-dev/pytest/issues/7425): New pytester fixture, which is identical to testdir but its methods return pathlib.Path when appropriate instead of `py.path.local`.

    This is part of the movement to use pathlib.Path objects internally, in order to remove the dependency to `py` in the future.

    Internally, the old Testdir &lt;\_pytest.pytester.Testdir> is now a thin wrapper around Pytester &lt;\_pytest.pytester.Pytester>, preserving the old interface.

-   [#&#8203;7695](https://togithub.com/pytest-dev/pytest/issues/7695): A new hook was added, pytest_markeval_namespace which should return a dictionary.
    This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers.

    Pseudo example

    `conftest.py`:

    ```{.sourceCode .python}
    def pytest_markeval_namespace():
        return {"color": "red"}
    ```

    `test_func.py`:

    ```{.sourceCode .python}
    @&#8203;pytest.mark.skipif("color == 'blue'", reason="Color is not red")
    def test_func():
        assert False
    ```

-   [#&#8203;8006](https://togithub.com/pytest-dev/pytest/issues/8006): It is now possible to construct a ~pytest.MonkeyPatch object directly as `pytest.MonkeyPatch()`,
    in cases when the monkeypatch fixture cannot be used. Previously some users imported it
    from the private \_pytest.monkeypatch.MonkeyPatch namespace.

    Additionally, MonkeyPatch.context &lt;pytest.MonkeyPatch.context> is now a classmethod,
    and can be used as `with MonkeyPatch.context() as mp: ...`. This is the recommended way to use
    `MonkeyPatch` directly, since unlike the `monkeypatch` fixture, an instance created directly
    is not `undo()`-ed automatically.

## Improvements

-   [#&#8203;1265](https://togithub.com/pytest-dev/pytest/issues/1265): Added an `__str__` implementation to the ~pytest.pytester.LineMatcher class which is returned from `pytester.run_pytest().stdout` and similar. It returns the entire output, like the existing `str()` method.
-   [#&#8203;2044](https://togithub.com/pytest-dev/pytest/issues/2044): Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS".
-   [#&#8203;7469](https://togithub.com/pytest-dev/pytest/issues/7469) The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions.
    The newly-exported types are:

    -   `pytest.FixtureRequest` for the request fixture.
    -   `pytest.Cache` for the cache fixture.
    -   `pytest.CaptureFixture[str]` for the capfd and capsys fixtures.
    -   `pytest.CaptureFixture[bytes]` for the capfdbinary and capsysbinary fixtures.
    -   `pytest.LogCaptureFixture` for the caplog fixture.
    -   `pytest.Pytester` for the pytester fixture.
    -   `pytest.Testdir` for the testdir fixture.
    -   `pytest.TempdirFactory` for the tmpdir_factory fixture.
    -   `pytest.TempPathFactory` for the tmp_path_factory fixture.
    -   `pytest.MonkeyPatch` for the monkeypatch fixture.
    -   `pytest.WarningsRecorder` for the recwarn fixture.

    Constructing them is not supported (except for MonkeyPatch); they are only meant for use in type annotations.
    Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.

    Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.

-   [#&#8203;7527](https://togithub.com/pytest-dev/pytest/issues/7527): When a comparison between namedtuple &lt;collections.namedtuple> instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes.
-   [#&#8203;7615](https://togithub.com/pytest-dev/pytest/issues/7615): Node.warn &lt;\_pytest.nodes.Node.warn> now permits any subclass of Warning, not just PytestWarning &lt;pytest.PytestWarning>.
-   [#&#8203;7701](https://togithub.com/pytest-dev/pytest/issues/7701): Improved reporting when using `--collected-only`. It will now show the number of collected tests in the summary stats.
-   [#&#8203;7710](https://togithub.com/pytest-dev/pytest/issues/7710): Use strict equality comparison for non-numeric types in pytest.approx instead of
    raising TypeError.

    This was the undocumented behavior before 3.7, but is now officially a supported feature.

-   [#&#8203;7938](https://togithub.com/pytest-dev/pytest/issues/7938): New `--sw-skip` argument which is a shorthand for `--stepwise-skip`.
-   [#&#8203;8023](https://togithub.com/pytest-dev/pytest/issues/8023): Added `'node_modules'` to default value for norecursedirs.
-   [#&#8203;8032](https://togithub.com/pytest-dev/pytest/issues/8032): doClassCleanups &lt;unittest.TestCase.doClassCleanups> (introduced in unittest in Python and 3.8) is now called appropriately.

## Bug Fixes

-   [#&#8203;4824](https://togithub.com/pytest-dev/pytest/issues/4824): Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures.
-   [#&#8203;7758](https://togithub.com/pytest-dev/pytest/issues/7758): Fixed an issue where some files in packages are getting lost from `--lf` even though they contain tests that failed. Regressed in pytest 5.4.0.
-   [#&#8203;7911](https://togithub.com/pytest-dev/pytest/issues/7911): Directories created by by tmp_path and tmpdir are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites.
-   [#&#8203;7913](https://togithub.com/pytest-dev/pytest/issues/7913): Fixed a crash or hang in pytester.spawn &lt;\_pytest.pytester.Pytester.spawn> when the readline module is involved.
-   [#&#8203;7951](https://togithub.com/pytest-dev/pytest/issues/7951): Fixed handling of recursive symlinks when collecting tests.
-   [#&#8203;7981](https://togithub.com/pytest-dev/pytest/issues/7981): Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0.
-   [#&#8203;8016](https://togithub.com/pytest-dev/pytest/issues/8016): Fixed only one doctest being collected when using `pytest --doctest-modules path/to/an/__init__.py`.

## Improved Documentation

-   [#&#8203;7429](https://togithub.com/pytest-dev/pytest/issues/7429): Add more information and use cases about skipping doctests.
-   [#&#8203;7780](https://togithub.com/pytest-dev/pytest/issues/7780): Classes which should not be inherited from are now marked `final class` in the API reference.
-   [#&#8203;7872](https://togithub.com/pytest-dev/pytest/issues/7872): `_pytest.config.argparsing.Parser.addini()` accepts explicit `None` and `"string"`.
-   [#&#8203;7878](https://togithub.com/pytest-dev/pytest/issues/7878): In pull request section, ask to commit after editing changelog and authors file.

## Trivial/Internal Changes

-   [#&#8203;7802](https://togithub.com/pytest-dev/pytest/issues/7802): The `attrs` dependency requirement is now >=19.2.0 instead of >=17.4.0.
-   [#&#8203;8014](https://togithub.com/pytest-dev/pytest/issues/8014): .pyc files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7.
    (These files are internal and only interpreted by pytest itself.)

### [`v6.1.2`](https://togithub.com/pytest-dev/pytest/releases/6.1.2)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.1.1...6.1.2)

# pytest 6.1.2 (2020-10-28)

## Bug Fixes

-   [#&#8203;7758](https://togithub.com/pytest-dev/pytest/issues/7758): Fixed an issue where some files in packages are getting lost from `--lf` even though they contain tests that failed. Regressed in pytest 5.4.0.
-   [#&#8203;7911](https://togithub.com/pytest-dev/pytest/issues/7911): Directories created by tmpdir are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites.

## Improved Documentation

-   [#&#8203;7815](https://togithub.com/pytest-dev/pytest/issues/7815): Improve deprecation warning message for `pytest._fillfuncargs()`.

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-documentai).
renovate-bot and others added 22 commits January 3, 2023 14:44
- (Moved to Cloud Storage Bucket for Documentation)
- https://cloud.google.com/document-ai/docs/output

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
* docs(samples): Added Image Quality Output to Document OCR Processor

* docs(samples): Added `field_mask` to `batch_process` samples
Source-Link: googleapis/synthtool@6ed3a83
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore(deps): update dependency google-cloud-storage to v2.7.0

* docs(samples): removed batch_process_documents_sample_bad_input_test

Co-authored-by: Renovate Bot <bot@renovateapp.com>
@holtskinner
Copy link
Contributor

Replaced by #8862 due to duplicate commit history

@holtskinner holtskinner closed this Jan 5, 2023
@holtskinner holtskinner deleted the python-documentai-migration branch January 5, 2023 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet