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

New MyPy configuration for per-module type completeness #1596

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ required-imports = ["from __future__ import annotations"]

[tool.mypy]
files = "river"
strict = true

[[tool.mypy.overrides]]
module = [
Expand All @@ -144,3 +145,59 @@ module = [
"requests.*"
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
# Disable strict mode for all non fully-typed modules
module = [
"river.base.*",
"river.metrics.*",
"river.utils.*",
"river.stats.*",
"river.optim.*",
"river.datasets.*",
"river.tree.*",
"river.preprocessing.*",
"river.stream.*",
"river.linear_model.*",
"river.evaluate.*",
"river.drift.*",
"river.compose.*",
"river.bandit.*",
"river.cluster.*",
"river.anomaly.*",
"river.time_series.*",
"river.feature_extraction.*",
"river.ensemble.*",
"river.proba.*",
"river.multioutput.*",
"river.naive_bayes.*",
"river.checks.*",
"river.rules.*",
"river.model_selection.*",
"river.forest.*",
"river.neighbors.*",
"river.sketch.*",
"river.facto.*",
"river.covariance.*",
"river.compat.*",
"river.multiclass.*",
"river.reco.*",
"river.imblearn.*",
"river.feature_selection.*",
"river.misc.*",
"river.active.*",
"river.conf.*",
"river.neural_net.*",
"river.test_estimators",
"river.dummy",
]
# The strict option is global, the checks must be disabled one by one
warn_unused_ignores = false
check_untyped_defs = false
allow_subclassing_any = true
allow_any_generics = true
allow_untyped_calls = true
allow_incomplete_defs = true
allow_untyped_defs = true
implicit_reexport = true
warn_return_any = false
4 changes: 2 additions & 2 deletions river/bandit/envs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

RIVER_NAMESPACE = "river_bandits"

if (env_id := f"{RIVER_NAMESPACE}/CandyCaneContest-v0") not in gym.envs.registry:
if (env_id := f"{RIVER_NAMESPACE}/CandyCaneContest-v0") not in gym.envs.registration.registry:
gym.envs.registration.register(
id=env_id,
entry_point="river.bandit.envs:CandyCaneContest",
max_episode_steps=CandyCaneContest.n_steps,
)
if (env_id := f"{RIVER_NAMESPACE}/KArmedTestbed-v0") not in gym.envs.registry:
if (env_id := f"{RIVER_NAMESPACE}/KArmedTestbed-v0") not in gym.envs.registration.registry:
gym.envs.registration.register(
id=env_id,
entry_point="river.bandit.envs:KArmedTestbed",
Expand Down
Loading