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

Allow generic decorators on abstarct classes #13398

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

ilevkivskyi
Copy link
Member

Fixes #5374

As discussed in the issue, we should allow this common use case, although it may be technically unsafe (e.g. if one would instantiate a class in a class decorator body).

@ilevkivskyi
Copy link
Member Author

I will probably not even wait for review, as the fix is trivial. I will merge if/when all tests pass.

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/packaging/base.py:29: error: Only concrete class can be given where "Type[PackageManifest]" is expected
- src/prefect/packaging/base.py:46: error: Only concrete class can be given where "Type[Packager]" is expected

@ilevkivskyi
Copy link
Member Author

mypy_primer is totally expected.

@ilevkivskyi ilevkivskyi merged commit 52f1dd3 into python:master Aug 12, 2022
@ilevkivskyi ilevkivskyi deleted the enable-abstract-deco branch August 12, 2022 20:53
achantavy added a commit to lyft/cartography that referenced this pull request Nov 23, 2022
achantavy added a commit to lyft/cartography that referenced this pull request Dec 16, 2022
* Build ingest query

* Linter

* Save cleanup query for another PR

* Implement schema

* bump mypy to 0.981 for python/mypy#13398

* linter

* make load_graph_data interface make more sense

* fix comment

* Docs and some better names

* add a todo

* Doc updates, rename some fields

* Fix pre-commit

* Code commment suggestions

Co-authored-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>

* Stackoverflow comment for clarity)

* Support ingesting only parts of a schema without breaking the others

* Doc comment

* Linter

* Support matching on one or more properties

* Correctly name test

* Change key_refs to TargetNodeMatcher to enforce it as a mandatory field

* Remove use of hacky default_field()

* Support subset of schema relationships for query generation, test multiple node labels

* Docstrings

* Comments in tests

* Better comments

* Test for exception conditions

* Remove irrelevant comment

Co-authored-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
chandanchowdhury pushed a commit to juju4/cartography that referenced this pull request Jun 26, 2024
* Build ingest query

* Linter

* Save cleanup query for another PR

* Implement schema

* bump mypy to 0.981 for python/mypy#13398

* linter

* make load_graph_data interface make more sense

* fix comment

* Docs and some better names

* add a todo

* Doc updates, rename some fields

* Fix pre-commit

* Code commment suggestions

Co-authored-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>

* Stackoverflow comment for clarity)

* Support ingesting only parts of a schema without breaking the others

* Doc comment

* Linter

* Support matching on one or more properties

* Correctly name test

* Change key_refs to TargetNodeMatcher to enforce it as a mandatory field

* Remove use of hacky default_field()

* Support subset of schema relationships for query generation, test multiple node labels

* Docstrings

* Comments in tests

* Better comments

* Test for exception conditions

* Remove irrelevant comment

Co-authored-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
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.

abstract dataclass inheritance gives Only concrete class can be given where "Type[Abstract]" is expected
1 participant