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

Use covariant type for @retried(on=[...]) #486

Merged
merged 2 commits into from
Dec 20, 2023
Merged

Use covariant type for @retried(on=[...]) #486

merged 2 commits into from
Dec 20, 2023

Conversation

nfx
Copy link
Contributor

@nfx nfx commented Dec 20, 2023

Changes

This PR fixes mypy error in downstream projects:

src/databricks/labs/ucx/workspace_access/scim.py:121: error: Argument "on" to "retried" has incompatible type "list[type[DatabricksError]]"; expected "list[type[BaseException]]"  [arg-type]
src/databricks/labs/ucx/workspace_access/scim.py:121: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
src/databricks/labs/ucx/workspace_access/scim.py:121: note: Consider using "Sequence" instead, which is covariant
src/databricks/labs/ucx/workspace_access/generic.py:143: error: Argument "on" to "retried" has incompatible type "list[type[DatabricksError]]"; expected "list[type[BaseException]]"  [arg-type]
src/databricks/labs/ucx/workspace_access/generic.py:143: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
src/databricks/labs/ucx/workspace_access/generic.py:143: note: Consider using "Sequence" instead, which is covariant

Tests

  • make test run locally
  • make fmt applied
  • relevant integration tests applied

This PR fixes `mypy` error in downstream projects:

```
src/databricks/labs/ucx/workspace_access/scim.py:121: error: Argument "on" to "retried" has incompatible type "list[type[DatabricksError]]"; expected "list[type[BaseException]]"  [arg-type]
src/databricks/labs/ucx/workspace_access/scim.py:121: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
src/databricks/labs/ucx/workspace_access/scim.py:121: note: Consider using "Sequence" instead, which is covariant
src/databricks/labs/ucx/workspace_access/generic.py:143: error: Argument "on" to "retried" has incompatible type "list[type[DatabricksError]]"; expected "list[type[BaseException]]"  [arg-type]
src/databricks/labs/ucx/workspace_access/generic.py:143: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance
src/databricks/labs/ucx/workspace_access/generic.py:143: note: Consider using "Sequence" instead, which is covariant
```
@nfx nfx requested a review from kartikgupta-db December 20, 2023 14:14
@nfx nfx enabled auto-merge December 20, 2023 14:15
@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (76a1933) 57.80% compared to head (8f50008) 57.80%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #486   +/-   ##
=======================================
  Coverage   57.80%   57.80%           
=======================================
  Files          38       38           
  Lines       26367    26367           
=======================================
  Hits        15241    15241           
  Misses      11126    11126           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nfx nfx added this pull request to the merge queue Dec 20, 2023
Merged via the queue into main with commit 358126e Dec 20, 2023
9 checks passed
@nfx nfx deleted the fix/mypy-retried branch December 20, 2023 14:26
tanmay-db added a commit that referenced this pull request Jan 10, 2024
* Use covariant type for `@retried(on=[...])` ([#486](#486)).
* Configure request timeout using existing parameter from Config ([#489](#489)).
* Make contents of `__init__.py` equal across projects ([#488](#488)).
* Update SDK to Latest OpenAPI Specification ([#501](#501)).

API Changes:

 * Changed `list()` method for [w.external_locations](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/external_locations.html) workspace-level service to require request of `databricks.sdk.service.catalog.ListExternalLocationsRequest` dataclass.
 * Changed `list()` method for [w.storage_credentials](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/storage_credentials.html) workspace-level service to require request of `databricks.sdk.service.catalog.ListStorageCredentialsRequest` dataclass.
 * Added `next_page_token` field for `databricks.sdk.service.catalog.ListExternalLocationsResponse`.
 * Added `max_results` field for `databricks.sdk.service.catalog.ListFunctionsRequest`.
 * Added `page_token` field for `databricks.sdk.service.catalog.ListFunctionsRequest`.
 * Added `next_page_token` field for `databricks.sdk.service.catalog.ListFunctionsResponse`.
 * Added `max_results` field for `databricks.sdk.service.catalog.ListSchemasRequest`.
 * Added `page_token` field for `databricks.sdk.service.catalog.ListSchemasRequest`.
 * Added `next_page_token` field for `databricks.sdk.service.catalog.ListSchemasResponse`.
 * Added `next_page_token` field for `databricks.sdk.service.catalog.ListStorageCredentialsResponse`.
 * Added `omit_columns` field for `databricks.sdk.service.catalog.ListTablesRequest`.
 * Added `omit_properties` field for `databricks.sdk.service.catalog.ListTablesRequest`.
 * Removed `databricks.sdk.service.catalog.TableConstraintList` dataclass.
 * Added `databricks.sdk.service.catalog.ListExternalLocationsRequest` dataclass.
 * Added `databricks.sdk.service.catalog.ListStorageCredentialsRequest` dataclass.
 * Added `init_scripts` field for `databricks.sdk.service.pipelines.PipelineCluster`.
 * Added `validate_only` field for `databricks.sdk.service.pipelines.StartUpdate`.
 * Added `validate_only` field for `databricks.sdk.service.pipelines.UpdateInfo`.
 * Changed `list()` method for [w.tokens](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/tokens.html) workspace-level service to return `databricks.sdk.service.settings.ListPublicTokensResponse` dataclass.
 * Added `databricks.sdk.service.settings.ListPublicTokensResponse` dataclass.
 * Changed `create()` method for [w.dashboards](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/dashboards.html) workspace-level service . New request type is `databricks.sdk.service.sql.DashboardPostContent` dataclass.
 * Added `update()` method for [w.dashboards](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/dashboards.html) workspace-level service.
 * Removed `databricks.sdk.service.sql.CreateDashboardRequest` dataclass.
 * Added `http_headers` field for `databricks.sdk.service.sql.ExternalLink`.
 * Added `run_as_role` field for `databricks.sdk.service.sql.QueryEditContent`.
 * Added `databricks.sdk.service.sql.DashboardEditContent` dataclass.
 * Added `databricks.sdk.service.sql.DashboardPostContent` dataclass.
 * Added `databricks.sdk.service.dashboards` package.
 * Added `databricks.sdk.service.vectorsearch` package.

OpenAPI SHA: 0e0d4cbe87193e36c73b8b2be3b0dd0f1b013e00, Date: 2024-01-10
@tanmay-db tanmay-db mentioned this pull request Jan 10, 2024
github-merge-queue bot pushed a commit that referenced this pull request Jan 11, 2024
* Use covariant type for `@retried(on=[...])`
([#486](#486)).
* Configure request timeout using existing parameter from Config
([#489](#489)).
* Make contents of `__init__.py` equal across projects
([#488](#488)).
* Update SDK to Latest OpenAPI Specification
([#501](#501)).

Note: This release contains breaking changes, please see below for more
details.

API Changes:

* [Breaking] Changed `list()` method for
[w.tokens](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/tokens.html)
workspace-level service to return
`databricks.sdk.service.settings.ListPublicTokensResponse` dataclass.
* Changed `list()` method for
[w.external_locations](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/external_locations.html)
workspace-level service to require request of
`databricks.sdk.service.catalog.ListExternalLocationsRequest` dataclass
and
[w.storage_credentials](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/storage_credentials.html)
workspace-level service to require request of
`databricks.sdk.service.catalog.ListStorageCredentialsRequest`
dataclass.
* Added `next_page_token` field for
`databricks.sdk.service.catalog.ListExternalLocationsResponse`,
`databricks.sdk.service.catalog.ListFunctionsResponse`,
`databricks.sdk.service.catalog.ListSchemasResponse` and
`databricks.sdk.service.catalog.ListStorageCredentialsResponse`.
* Added `max_results` field for
`databricks.sdk.service.catalog.ListFunctionsRequest` and
`databricks.sdk.service.catalog.ListSchemasRequest`.
* Added `page_token` field for
`databricks.sdk.service.catalog.ListFunctionsRequest` and
`databricks.sdk.service.catalog.ListSchemasRequest`.
* Added `omit_columns` field for
`databricks.sdk.service.catalog.ListTablesRequest`.
* Added `omit_properties` field for
`databricks.sdk.service.catalog.ListTablesRequest`.
* Added `init_scripts` field for
`databricks.sdk.service.pipelines.PipelineCluster`.
* Added `validate_only` field for
`databricks.sdk.service.pipelines.StartUpdate` and
`databricks.sdk.service.pipelines.UpdateInfo`.
* Changed `create()` method for
[w.dashboards](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/dashboards.html)
workspace-level service . New request type is
`databricks.sdk.service.sql.DashboardPostContent` dataclass.
* Added `update()` method for
[w.dashboards](https://databricks-sdk-py.readthedocs.io/en/latest/workspace/dashboards.html)
workspace-level service.
* Added `http_headers` field for
`databricks.sdk.service.sql.ExternalLink`.
* Added `run_as_role` field for
`databricks.sdk.service.sql.QueryEditContent`.
* Added package: `databricks.sdk.service.dashboards` and
`databricks.sdk.service.vectorsearch`.
* Added dataclass:
`databricks.sdk.service.catalog.ListExternalLocationsRequest`,
`databricks.sdk.service.catalog.ListStorageCredentialsRequest`,
`databricks.sdk.service.settings.ListPublicTokensResponse`,
`databricks.sdk.service.sql.DashboardEditContent` and
`databricks.sdk.service.sql.DashboardPostContent`.
* Removed dataclass:
`databricks.sdk.service.catalog.TableConstraintList` and
`databricks.sdk.service.sql.CreateDashboardRequest`.

OpenAPI SHA: 0e0d4cbe87193e36c73b8b2be3b0dd0f1b013e00, Date: 2024-01-10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants