Make mypy as strict as practical #13
7 changed files with 53 additions and 5 deletions
Enable "no_implicit_reexport"
Also, remove the unused `orm_exc` import alias
commit
e4016db9fe
|
|
@ -469,8 +469,8 @@ enable_error_code = ["ignore-without-code"]
|
|||
# Check further edge cases that are rarely an issue in practice
|
||||
extra_checks = true
|
||||
|
||||
# Treat imported names as re-exported as long as some packages lack `__all__`
|
||||
no_implicit_reexport = false
|
||||
# Treat only names listed in `__all__` as re-exported
|
||||
no_implicit_reexport = true
|
||||
|
||||
# Disallow comparisons of non-overlapping types (e.g., `str` and `int`)
|
||||
strict_equality = true
|
||||
|
|
@ -749,7 +749,6 @@ banned-from = [
|
|||
"sqlalchemy.dialects.postgresql" = "psql"
|
||||
"sqlalchemy.exc" = "sa_exc"
|
||||
"sqlalchemy.ext.hybrid" = "sa_hybrid"
|
||||
"sqlalchemy.orm.exc" = "orm_exc"
|
||||
"statsmodels.tsa.api" = "tsa"
|
||||
"tests.config" = "test_config"
|
||||
"typing" = "t"
|
||||
|
|
|
|||
|
|
@ -15,6 +15,13 @@ from velofy import db
|
|||
from velofy import forecasts
|
||||
|
||||
|
||||
__all__ = [
|
||||
"config",
|
||||
"db",
|
||||
"forecasts",
|
||||
]
|
||||
|
||||
|
||||
try:
|
||||
_pkg_info = _metadata.metadata(__name__)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import sys
|
|||
|
||||
import click
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.orm import exc as orm_exc
|
||||
from sqlalchemy import exc as sa_exc
|
||||
|
||||
from velofy import config as pkg_config
|
||||
from velofy import db
|
||||
|
|
@ -69,7 +69,7 @@ def tactical_heuristic( # noqa:C901,D417,DOC001
|
|||
|
||||
try:
|
||||
city_obj = db.session.query(db.City).filter_by(name=city.title()).one()
|
||||
except orm_exc.NoResultFound:
|
||||
except sa_exc.NoResultFound:
|
||||
click.echo('NAME must be one of "Paris", "Lyon", or "Bordeaux"')
|
||||
sys.exit(1)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,3 +15,22 @@ from velofy.db.pixels import Pixel
|
|||
from velofy.db.replay import ReplayedOrder
|
||||
from velofy.db.replay import ReplaySimulation
|
||||
from velofy.db.restaurants import Restaurant
|
||||
|
||||
|
||||
__all__ = [
|
||||
"Address",
|
||||
"AddressPixelAssociation",
|
||||
"Base",
|
||||
"City",
|
||||
"Courier",
|
||||
"Customer",
|
||||
"Forecast",
|
||||
"Grid",
|
||||
"Order",
|
||||
"Path",
|
||||
"Pixel",
|
||||
"ReplaySimulation",
|
||||
"ReplayedOrder",
|
||||
"Restaurant",
|
||||
"session",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,3 +2,9 @@
|
|||
|
||||
from velofy.db.replay.orders import ReplayedOrder
|
||||
from velofy.db.replay.simulations import ReplaySimulation
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ReplaySimulation",
|
||||
"ReplayedOrder",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -3,3 +3,10 @@
|
|||
from velofy.db.utils.colors import make_random_cmap
|
||||
from velofy.db.utils.colors import rgb_to_hex
|
||||
from velofy.db.utils.locations import Location
|
||||
|
||||
|
||||
__all__ = [
|
||||
"Location",
|
||||
"make_random_cmap",
|
||||
"rgb_to_hex",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -35,3 +35,13 @@ from velofy.forecasts.models.tactical.horizontal import HorizontalSMAModel
|
|||
from velofy.forecasts.models.tactical.other import TrivialModel
|
||||
from velofy.forecasts.models.tactical.realtime import RealtimeARIMAModel
|
||||
from velofy.forecasts.models.tactical.vertical import VerticalARIMAModel
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ForecastingModelABC",
|
||||
"HorizontalETSModel",
|
||||
"HorizontalSMAModel",
|
||||
"RealtimeARIMAModel",
|
||||
"TrivialModel",
|
||||
"VerticalARIMAModel",
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue