You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
frompathlibimportPathfromtypingimportDict, Literal, OptionalfrompydanticimportBaseModelfrompydantic_settingsimportBaseSettings, SettingsConfigDictfromsqlalchemy_bind_managerimportSQLAlchemyConfigTYPE_ENVIRONMENT=Literal["local", "test", "staging", "production"]
classCeleryConfig(BaseModel):
# https://docs.celeryq.dev/en/stable/userguide/configuration.html#configurationtimezone: str="UTC"# Broker configbroker_url: Optional[str] =Nonebroker_connection_retry_on_startup: bool=True# Results backend configresult_backend: Optional[str] =Noneredis_socket_keepalive: bool=True# Enable to ignore the results by default and not produce tombstonestask_ignore_result: bool=False# We want to use the default python logger configured using structlogworker_hijack_root_logger: bool=False# Events enabled for monitoringworker_send_task_events: bool=Truetask_send_sent_event: bool=True# Recurring tasks triggered directly by Celerybeat_schedule: dict= {}
# beat_schedule: dict = {# "recurrent_example": {# "task": "domains.books._tasks.book_cpu_intensive_task",# "schedule": 5.0,# "args": ("a-random-book-id",),# },# }classAppConfig(BaseSettings):
model_config=SettingsConfigDict(env_nested_delimiter="__")
APP_NAME: str="bootstrap"CELERY: CeleryConfig=CeleryConfig()
DEBUG: bool=FalseENVIRONMENT: TYPE_ENVIRONMENT="local"SQLALCHEMY_CONFIG: Dict[str, SQLAlchemyConfig] =dict(
default=SQLAlchemyConfig(
engine_url=f"sqlite+aiosqlite:///{Path(__file__).parent.parent.joinpath('sqlite.db')}",
engine_options=dict(
connect_args={
"check_same_thread": False,
},
echo=False,
future=True,
),
async_engine=True,
),
)
Command used: mypy --python-version 3.9 --no-incremental from the root repository directory.
Expected Behavior
Actual Behavior
Note that the file is 64 lines long
src/bootstrap/config.py:128: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:129: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:130: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:131: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:132: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:133: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:134: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:135: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:136: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:137: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:138: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:139: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:140: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:141: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:142: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:143: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:144: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:145: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:146: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:147: error: X | Y syntax for unions requires Python 3.10 [syntax]
src/bootstrap/config.py:148: error: X | Y syntax for unions requires Python 3.10 [syntax]
Found 21 errors in 1 file (checked 63 source files)
Your Environment
Mypy version used: mypy 1.11.2 (compiled: yes)
Mypy command-line flags: --python-version 3.9 (also --no-incremental to show line numbers but the error persists without)
Mypy configuration options from mypy.ini (and other config files): from pyproject.toml
[tool.mypy]
files = ["src", "tests"]
exclude = ["alembic"]
plugins = "pydantic.mypy,strawberry.ext.mypy_plugin"
# We can remove celery by installing `celery-types` but needs
# at least python 3.10. For now we maintain the override.
[[tool.mypy.overrides]]
module = [
"celery.*"
]
ignore_missing_imports = true
Python version used: Python 3.11.9 (but experienced also directly on 3.9 and 3.12)
The text was updated successfully, but these errors were encountered:
Bug Report
mypy identifies false positive
X | Y
errors on not existing lines.Note that I cannot find any instance of
X | Y
in the whole repository.To Reproduce
This is the file: https://github.com/febus982/bootstrap-python-fastapi/blob/main/src/bootstrap/config.py
Command used:
mypy --python-version 3.9 --no-incremental
from the root repository directory.Expected Behavior
Actual Behavior
Note that the file is 64 lines long
Your Environment
mypy 1.11.2 (compiled: yes)
--python-version 3.9
(also--no-incremental
to show line numbers but the error persists without)mypy.ini
(and other config files): from pyproject.tomlThe text was updated successfully, but these errors were encountered: