| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,8 +49,6 @@ fastapi = "^0.68.1" | |||
| 49 | 49 | requests = "^2.26.0" | |
| 50 | 50 | autoflake = "^1.4" | |
| 51 | 51 | isort = "^5.9.3" | |
| 52 | - async_generator = {version = "*", python = "~3.6"} | ||
| 53 | - async-exit-stack = {version = "*", python = "~3.6"} | ||
| 54 | 52 | ||
| 55 | 53 | [build-system] | |
| 56 | 54 | requires = ["poetry-core"] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,37 +22,15 @@ from sqlalchemy.sql.expression import Select as _Select | |||
| 22 | 22 | ||
| 23 | 23 | _TSelect = TypeVar("_TSelect") | |
| 24 | 24 | ||
| 25 | - # Workaround Generics incompatibility in Python 3.6 | ||
| 26 | - # Ref: https://github.com/python/typing/issues/449#issuecomment-316061322 | ||
| 27 | - if sys.version_info.minor >= 7: | ||
| 28 | - | ||
| 29 | - class Select(_Select, Generic[_TSelect]): | ||
| 30 | - inherit_cache = True | ||
| 31 | - | ||
| 32 | - # This is not comparable to sqlalchemy.sql.selectable.ScalarSelect, that has a different | ||
| 33 | - # purpose. This is the same as a normal SQLAlchemy Select class where there's only one | ||
| 34 | - # entity, so the result will be converted to a scalar by default. This way writing | ||
| 35 | - # for loops on the results will feel natural. | ||
| 36 | - class SelectOfScalar(_Select, Generic[_TSelect]): | ||
| 37 | - inherit_cache = True | ||
| 38 | - | ||
| 39 | - else: | ||
| 40 | - from typing import GenericMeta # type: ignore | ||
| 41 | - | ||
| 42 | - class GenericSelectMeta(GenericMeta, _Select.__class__): # type: ignore | ||
| 43 | - pass | ||
| 44 | - | ||
| 45 | - class _Py36Select(_Select, Generic[_TSelect], metaclass=GenericSelectMeta): | ||
| 46 | - inherit_cache = True | ||
| 47 | - | ||
| 48 | - class _Py36SelectOfScalar(_Select, Generic[_TSelect], metaclass=GenericSelectMeta): | ||
| 49 | - inherit_cache = True | ||
| 50 | - | ||
| 51 | - # Cast them for editors to work correctly, from several tricks tried, this works | ||
| 52 | - # for both VS Code and PyCharm | ||
| 53 | - Select = cast("Select", _Py36Select) # type: ignore | ||
| 54 | - SelectOfScalar = cast("SelectOfScalar", _Py36SelectOfScalar) # type: ignore | ||
| 55 | - | ||
| 25 | + class Select(_Select, Generic[_TSelect]): | ||
| 26 | + inherit_cache = True | ||
| 27 | + | ||
| 28 | + # This is not comparable to sqlalchemy.sql.selectable.ScalarSelect, that has a different | ||
| 29 | + # purpose. This is the same as a normal SQLAlchemy Select class where there's only one | ||
| 30 | + # entity, so the result will be converted to a scalar by default. This way writing | ||
| 31 | + # for loops on the results will feel natural. | ||
| 32 | + class SelectOfScalar(_Select, Generic[_TSelect]): | ||
| 33 | + inherit_cache = True | ||
| 56 | 34 | ||
| 57 | 35 | if TYPE_CHECKING: # pragma: no cover | |
| 58 | 36 | from ..main import SQLModel | |
| Back | FazBrowse Home | New Git URL |
0 commit comments