generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
This issue is similar to CDCgov/hubverse-annotator#72 in that it aims to have Python type checking via GitHub Actions or a pre-commit hook. The former seems the better of two approaches, given some constraints with how packages we want to use (e.g. ty or pyrefly, which are both written in Rust) operate with codebases locally v. remotely.
Completion of this issue would likely result in the closing of #61 .
Here are some examples of type-checking output:
Ty Check Output
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `list[str]`
--> forecasttools/daily_to_epiweekly.py:34:5
|
32 | value_col: str = "value",
33 | date_col: str = "date",
34 | id_cols: list[str] = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
35 | weekly_value_name: str = "weekly_value",
36 | strict: bool = True,
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-type-form]: Variable of type `def any(iterable: Iterable[object], /) -> bool` is not allowed in a type expression
--> forecasttools/idata_w_dates_to_df.py:31:49
|
31 | def convert_date_or_datetime_to_np(time_object: any) -> np.datetime64:
| ^^^
32 | """
33 | Converts a date or datetime object to
|
info: rule `invalid-type-form` is enabled by default
error[invalid-argument-type]: Argument to function `add_time_coords_to_idata_dimension` is incorrect
--> forecasttools/idata_w_dates_to_df.py:267:17
|
265 | variable=variable,
266 | dimension=dimension,
267 | start_date_iso=start_date_iso,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `date | datetime64[date | int | None]`, found `str | datetime`
268 | time_step=time_step,
269 | )
|
info: Function defined here
--> forecasttools/idata_w_dates_to_df.py:99:5
|
99 | def add_time_coords_to_idata_dimension(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100 | idata: az.InferenceData,
101 | group: str,
102 | variable: str,
103 | dimension: str,
104 | start_date_iso: datetime | date | np.datetime64,
| ----------------------------------------------- Parameter declared here
105 | time_step: timedelta | np.timedelta64,
106 | ) -> az.InferenceData:
|
info: rule `invalid-argument-type` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> forecasttools/idata_w_dates_to_df.py:297:13
|
295 | """
296 | # get dates from InferenceData's posterior_predictive group
297 | dates = idata_w_dates.posterior_predictive.coords[postp_dim_name].values
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
298 | # convert the dates to ISO8601 strings
299 | iso8601_dates = np.datetime_as_string(dates, unit="D")
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> forecasttools/idata_w_dates_to_df.py:301:33
|
299 | iso8601_dates = np.datetime_as_string(dates, unit="D")
300 | # stack posterior predictive samples by chain and draw
301 | stacked_post_pred_samples = idata_w_dates.posterior_predictive.stack(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
302 | sample=("chain", "draw")
303 | )[postp_val_name].to_pandas()
|
info: rule `unresolved-attribute` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str | date`
--> forecasttools/pull_data_cdc_gov.py:32:5
|
30 | def get_data_cdc_gov_dataset(
31 | dataset_key: str,
32 | start_date: str | date = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33 | end_date: str | date = None,
34 | additional_col_names: str | list[str] = None,
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str | date`
--> forecasttools/pull_data_cdc_gov.py:33:5
|
31 | dataset_key: str,
32 | start_date: str | date = None,
33 | end_date: str | date = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
34 | additional_col_names: str | list[str] = None,
35 | locations: str | list[str] = None,
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str | list[str]`
--> forecasttools/pull_data_cdc_gov.py:34:5
|
32 | start_date: str | date = None,
33 | end_date: str | date = None,
34 | additional_col_names: str | list[str] = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 | locations: str | list[str] = None,
36 | limit: int = 10000,
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str | list[str]`
--> forecasttools/pull_data_cdc_gov.py:35:5
|
33 | end_date: str | date = None,
34 | additional_col_names: str | list[str] = None,
35 | locations: str | list[str] = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36 | limit: int = 10000,
37 | app_token: str = None,
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str`
--> forecasttools/pull_data_cdc_gov.py:37:5
|
35 | locations: str | list[str] = None,
36 | limit: int = 10000,
37 | app_token: str = None,
| ^^^^^^^^^^^^^^^^^^^^^
38 | ) -> pl.DataFrame:
39 | """
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str | date`
--> forecasttools/pull_data_cdc_gov.py:113:5
|
112 | def get_nhsn(
113 | start_date: str | date = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114 | end_date: str | date = None,
115 | app_token: str = None,
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str | date`
--> forecasttools/pull_data_cdc_gov.py:114:5
|
112 | def get_nhsn(
113 | start_date: str | date = None,
114 | end_date: str | date = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
115 | app_token: str = None,
116 | dataset_key: str = "nhsn_hrd_prelim",
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str`
--> forecasttools/pull_data_cdc_gov.py:115:5
|
113 | start_date: str | date = None,
114 | end_date: str | date = None,
115 | app_token: str = None,
| ^^^^^^^^^^^^^^^^^^^^^
116 | dataset_key: str = "nhsn_hrd_prelim",
117 | additional_col_names: str | list[str] = "totalconfc19newadm",
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `str | list[str]`
--> forecasttools/pull_data_cdc_gov.py:118:5
|
116 | dataset_key: str = "nhsn_hrd_prelim",
117 | additional_col_names: str | list[str] = "totalconfc19newadm",
118 | locations: str | list[str] = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119 | limit: int = 10000,
120 | ) -> pl.DataFrame:
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-type-form]: Variable of type `def any(iterable: Iterable[object], /) -> bool` is not allowed in a type expression
--> forecasttools/sbc.py:90:26
|
88 | def _get_prior_predictive_samples(
89 | self,
90 | ) -> tuple[dict[str, any], dict[str, any]]:
| ^^^
91 | """
92 | Generate samples to use for the simulations by prior predictive
|
info: rule `invalid-type-form` is enabled by default
error[invalid-type-form]: Variable of type `def any(iterable: Iterable[object], /) -> bool` is not allowed in a type expression
--> forecasttools/sbc.py:90:42
|
88 | def _get_prior_predictive_samples(
89 | self,
90 | ) -> tuple[dict[str, any], dict[str, any]]:
| ^^^
91 | """
92 | Generate samples to use for the simulations by prior predictive
|
info: rule `invalid-type-form` is enabled by default
error[invalid-type-form]: Variable of type `def PRNGKey(seed: int | @Todo, *, impl: @Todo | None = None) -> Array` is not allowed in a type expression
--> forecasttools/sbc.py:118:21
|
117 | def _get_posterior_samples(
118 | self, seed: random.PRNGKey, prior_predictive_draw: dict[str, any]
| ^^^^^^^^^^^^^^
119 | ) -> tuple[az.InferenceData, int]:
120 | """
|
info: rule `invalid-type-form` is enabled by default
error[invalid-type-form]: Variable of type `def any(iterable: Iterable[object], /) -> bool` is not allowed in a type expression
--> forecasttools/sbc.py:118:70
|
117 | def _get_posterior_samples(
118 | self, seed: random.PRNGKey, prior_predictive_draw: dict[str, any]
| ^^^
119 | ) -> tuple[az.InferenceData, int]:
120 | """
|
info: rule `invalid-type-form` is enabled by default
error[missing-argument]: No arguments provided for required parameters `num_warmup`, `num_samples` of bound method `__init__`
--> forecasttools/sbc.py:139:16
|
137 | of posterior samples.
138 | """
139 | mcmc = MCMC(self.mcmc_kernel, **self.sample_kwargs)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140 | obs_vars = {**self.kwargs, **prior_predictive_draw}
141 | mcmc.run(seed, *self.args, **obs_vars)
|
info: rule `missing-argument` is enabled by default
error[invalid-assignment]: Object of type `list[int]` is not assignable to `list[str] | None`
--> forecasttools/to_hubverse.py:41:9
|
39 | # set default horizons in case of no specification
40 | if horizons is None:
41 | horizons = list(range(-1, 4))
| ^^^^^^^^
42 | # create list of ref. date, target, horizon, end date, and epidate
43 | reference_date_dt = datetime.strptime(reference_date, "%Y-%m-%d")
|
info: rule `invalid-assignment` is enabled by default
error[invalid-argument-type]: Argument to function `__new__` is incorrect
--> forecasttools/to_hubverse.py:58:17
|
56 | ),
57 | },
58 | horizons,
| ^^^^^^^^ Expected `Iterable[Unknown]`, found `list[str] | None`
59 | )
60 | )
|
info: Matching overload defined here
--> stdlib/builtins.pyi:3810:13
|
3808 | else:
3809 | @overload
3810 | def __new__(cls, func: Callable[[_T1], _S], iterable: Iterable[_T1], /) -> Self: ...
| ^^^^^^^ ----------------------- Parameter declared here
3811 | @overload
3812 | def __new__(cls, func: Callable[[_T1, _T2], _S], iterable: Iterable[_T1], iter2: Iterable[_T2], /) -> Self: ...
|
info: Non-matching overloads for function `__new__`:
info: (cls, func: (_T1, _T2, /) -> _S, iterable: Iterable[_T1], iter2: Iterable[_T2], /) -> Self
info: (cls, func: (_T1, _T2, _T3, /) -> _S, iterable: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /) -> Self
info: (cls, func: (_T1, _T2, _T3, _T4, /) -> _S, iterable: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], /) -> Self
info: (cls, func: (_T1, _T2, _T3, _T4, _T5, /) -> _S, iterable: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], iter5: Iterable[_T5], /) -> Self
info: (cls, func: (...) -> _S, iterable: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any], iter4: Iterable[Any], iter5: Iterable[Any], iter6: Iterable[Any], /, *iterables: Iterable[Any]) -> Self
info: rule `invalid-argument-type` is enabled by default
error[invalid-argument-type]: Argument to function `get_hubverse_target_end_dates` is incorrect
--> forecasttools/to_hubverse.py:139:61
|
137 | excluded_locations = ["60", "78"]
138 | # get target end dates
139 | targets = get_hubverse_target_end_dates(reference_date, horizons=horizons)
| ^^^^^^^^^^^^^^^^^ Expected `list[str] | None`, found `(Unknown & ~None) | list[int]`
140 | # filter and select relevant columns
141 | quants = quantile_forecasts.select(
|
info: Function defined here
--> forecasttools/to_hubverse.py:13:5
|
13 | def get_hubverse_target_end_dates(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 | reference_date: str,
15 | horizons: list[str] | None = None,
| --------------------------------- Parameter declared here
16 | ) -> pl.DataFrame:
17 | """
|
info: rule `invalid-argument-type` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `list[int | float]`
--> forecasttools/trajectories_to_quantiles.py:12:5
|
10 | def trajectories_to_quantiles(
11 | trajectories: pl.DataFrame,
12 | quantiles: list[float] = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13 | timepoint_cols: list[str] = None,
14 | value_col_name: str = "value",
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `list[str]`
--> forecasttools/trajectories_to_quantiles.py:13:5
|
11 | trajectories: pl.DataFrame,
12 | quantiles: list[float] = None,
13 | timepoint_cols: list[str] = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 | value_col_name: str = "value",
15 | quantile_value_name: str = "quantile_value",
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-parameter-default]: Default value of type `None` is not assignable to annotated parameter type `list[str]`
--> forecasttools/trajectories_to_quantiles.py:17:5
|
15 | quantile_value_name: str = "quantile_value",
16 | quantile_level_name: str = "quantile_level",
17 | id_cols: list[str] = None,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
18 | ) -> pl.DataFrame:
19 | """
|
info: rule `invalid-parameter-default` is enabled by default
error[invalid-type-form]: Variable of type `def any(iterable: Iterable[object], /) -> bool` is not allowed in a type expression
--> forecasttools/utils.py:13:12
|
12 | def validate_input_type(
13 | value: any, expected_type: type | tuple[type], param_name: str
| ^^^
14 | ):
15 | """Checks the type of a variable and
|
info: rule `invalid-type-form` is enabled by default
error[unresolved-import]: Cannot resolve imported module `pytest`
--> tests/test_add_time_coords_to_idata.py:15:8
|
13 | import arviz as az
14 | import numpy as np
15 | import pytest
| ^^^^^^
16 | import xarray as xr
|
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:79:29
|
77 | )
78 | # dim correctly updated?
79 | assert dimension in idata.posterior_predictive[variable].coords
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
80 | assert (
81 | len(idata.posterior_predictive[variable].coords[dimension])
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:81:17
|
79 | assert dimension in idata.posterior_predictive[variable].coords
80 | assert (
81 | len(idata.posterior_predictive[variable].coords[dimension])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
82 | == idata.posterior_predictive[variable].sizes[dimension]
83 | )
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:82:16
|
80 | assert (
81 | len(idata.posterior_predictive[variable].coords[dimension])
82 | == idata.posterior_predictive[variable].sizes[dimension]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
83 | )
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:102:27
|
100 | time_step,
101 | )
102 | assert "obs_dim_0" in idata.posterior_predictive["obs"].coords
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
103 | assert (
104 | len(idata.posterior_predictive["obs"].coords["obs_dim_0"])
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:104:13
|
102 | assert "obs_dim_0" in idata.posterior_predictive["obs"].coords
103 | assert (
104 | len(idata.posterior_predictive["obs"].coords["obs_dim_0"])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
105 | == idata.posterior_predictive["obs"].sizes["obs_dim_0"]
106 | )
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:105:12
|
103 | assert (
104 | len(idata.posterior_predictive["obs"].coords["obs_dim_0"])
105 | == idata.posterior_predictive["obs"].sizes["obs_dim_0"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
106 | )
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:262:29
|
260 | # validate that the function executed
261 | # correctly and the dimension has been modified
262 | assert dimension in idata_out.posterior_predictive[variable].coords
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
263 | assert (
264 | len(idata_out.posterior_predictive[variable].coords[dimension])
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:264:17
|
262 | assert dimension in idata_out.posterior_predictive[variable].coords
263 | assert (
264 | len(idata_out.posterior_predictive[variable].coords[dimension])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
265 | == idata_out.posterior_predictive[variable].sizes[dimension]
266 | )
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `posterior_predictive`
--> tests/test_add_time_coords_to_idata.py:265:16
|
263 | assert (
264 | len(idata_out.posterior_predictive[variable].coords[dimension])
265 | == idata_out.posterior_predictive[variable].sizes[dimension]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266 | )
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `observed_data`
--> tests/test_add_time_coords_to_idata.py:306:22
|
305 | # extract the updated time coordinates
306 | updated_coords = updated_idata.observed_data.coords[dimension].values
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
307 |
308 | # assert that the updated coordinates are equal to the expected dates
|
info: rule `unresolved-attribute` is enabled by default
error[unresolved-attribute]: Type `InferenceData` has no attribute `observed_data`
--> tests/test_add_time_coords_to_idata.py:349:22
|
348 | # extract the updated time coordinates
349 | updated_coords = updated_idata.observed_data.coords[dimension].values
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
350 |
351 | print(updated_coords)
|
info: rule `unresolved-attribute` is enabled by default
error[invalid-argument-type]: Argument to function `add_time_coords_to_idata_dimensions` is incorrect
--> tests/test_add_time_coords_to_idata.py:512:17
|
510 | variables=variables,
511 | dimensions=dimensions,
512 | start_date_iso=date(2022, 8, 1),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `str | datetime`, found `date`
513 | time_step=timedelta(days=1),
514 | )
|
info: Function defined here
--> forecasttools/idata_w_dates_to_df.py:185:5
|
185 | def add_time_coords_to_idata_dimensions(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
186 | idata: az.InferenceData,
187 | groups: str | list[str],
188 | variables: str | list[str],
189 | dimensions: str | list[str],
190 | start_date_iso: str | datetime,
| ------------------------------ Parameter declared here
191 | time_step: timedelta,
192 | ) -> az.InferenceData:
|
info: rule `invalid-argument-type` is enabled by default
error[invalid-argument-type]: Argument to function `add_time_coords_to_idata_dimensions` is incorrect
--> tests/test_add_time_coords_to_idata.py:521:13
|
519 | variables=variables,
520 | dimensions=dimensions,
521 | start_date_iso=date(2022, 8, 1),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected `str | datetime`, found `date`
522 | time_step=timedelta(days=1),
523 | )
|
info: Function defined here
--> forecasttools/idata_w_dates_to_df.py:185:5
|
185 | def add_time_coords_to_idata_dimensions(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
186 | idata: az.InferenceData,
187 | groups: str | list[str],
188 | variables: str | list[str],
189 | dimensions: str | list[str],
190 | start_date_iso: str | datetime,
| ------------------------------ Parameter declared here
191 | time_step: timedelta,
192 | ) -> az.InferenceData:
|
info: rule `invalid-argument-type` is enabled by default
error[unresolved-import]: Cannot resolve imported module `pytest`
--> tests/test_recoding_locations.py:7:8
|
6 | import polars as pl
7 | import pytest
| ^^^^^^
8 |
9 | import forecasttools
|
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default
error[unresolved-import]: Cannot resolve imported module `pytest`
--> tests/test_sbc.py:13:8
|
12 | import numpyro
13 | import pytest
| ^^^^^^
14 | from jax import random
15 | from numpyro.infer import NUTS
|
info: make sure your Python environment is properly configured: https://docs.astral.sh/ty/modules/#python-environment
info: rule `unresolved-import` is enabled by default
Found 42 diagnostics
PyRight Check
CFA/forecasttools-py/forecasttools/__init__.py:40:34 - error: Argument of type "Traversable" cannot be assigned to parameter "source" of type "FileSource"
Type "Traversable" is not assignable to type "FileSource"
"Traversable" is not assignable to "str"
"Traversable" is not assignable to "Path"
"Traversable" is not assignable to "IO[bytes]"
"Traversable" is not assignable to "bytes"
"Traversable" is not assignable to "list[str]"
"Traversable" is not assignable to "list[Path]"
"Traversable" is not assignable to "list[IO[bytes]]"
... (reportArgumentType)
CFA/forecasttools-py/forecasttools/__init__.py:50:47 - error: Argument of type "Traversable" cannot be assigned to parameter "source" of type "FileSource"
Type "Traversable" is not assignable to type "FileSource"
"Traversable" is not assignable to "str"
"Traversable" is not assignable to "Path"
"Traversable" is not assignable to "IO[bytes]"
"Traversable" is not assignable to "bytes"
"Traversable" is not assignable to "list[str]"
"Traversable" is not assignable to "list[Path]"
"Traversable" is not assignable to "list[IO[bytes]]"
... (reportArgumentType)
CFA/forecasttools-py/forecasttools/__init__.py:57:35 - error: Argument of type "Traversable" cannot be assigned to parameter "source" of type "FileSource"
Type "Traversable" is not assignable to type "FileSource"
"Traversable" is not assignable to "str"
"Traversable" is not assignable to "Path"
"Traversable" is not assignable to "IO[bytes]"
"Traversable" is not assignable to "bytes"
"Traversable" is not assignable to "list[str]"
"Traversable" is not assignable to "list[Path]"
"Traversable" is not assignable to "list[IO[bytes]]"
... (reportArgumentType)
CFA/forecasttools-py/forecasttools/__init__.py:64:33 - error: Argument of type "Traversable" cannot be assigned to parameter "source" of type "FileSource"
Type "Traversable" is not assignable to type "FileSource"
"Traversable" is not assignable to "str"
"Traversable" is not assignable to "Path"
"Traversable" is not assignable to "IO[bytes]"
"Traversable" is not assignable to "bytes"
"Traversable" is not assignable to "list[str]"
"Traversable" is not assignable to "list[Path]"
"Traversable" is not assignable to "list[IO[bytes]]"
... (reportArgumentType)
CFA/forecasttools-py/forecasttools/__init__.py:101:5 - warning: "validate_and_get_start_time" is specified in __all__ but is not present in module (reportUnsupportedDunderAll)
CFA/forecasttools-py/forecasttools/daily_to_epiweekly.py
CFA/forecasttools-py/forecasttools/daily_to_epiweekly.py:34:26 - error: Expression of type "None" cannot be assigned to parameter of type "list[str]"
"None" is not assignable to "list[str]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/daily_to_epiweekly.py:78:15 - error: Type "list[str] | list[Never]" is not assignable to declared type "list[str]"
Type "list[str] | list[Never]" is not assignable to type "list[str]"
"list[Never]" is not assignable to "list[str]"
Type parameter "_T@list" is invariant, but "Never" is not the same as "str"
Consider switching from "list" to "Sequence" which is covariant (reportAssignmentType)
CFA/forecasttools-py/forecasttools/data.py
CFA/forecasttools-py/forecasttools/data.py:40:12 - error: Except clause is unreachable because exception is already handled
"HTTPError" is a subclass of "URLError" (reportUnusedExcept)
CFA/forecasttools-py/forecasttools/idata_w_dates_to_df.py
CFA/forecasttools-py/forecasttools/idata_w_dates_to_df.py:31:49 - error: Expected class but received "(iterable: Iterable[object], /) -> bool" (reportGeneralTypeIssues)
CFA/forecasttools-py/forecasttools/idata_w_dates_to_df.py:267:32 - error: Argument of type "str | datetime" cannot be assigned to parameter "start_date_iso" of type "datetime | date | datetime64[date | int | None]" in function "add_time_coords_to_idata_dimension"
Type "str | datetime" is not assignable to type "datetime | date | datetime64[date | int | None]"
Type "str" is not assignable to type "datetime | date | datetime64[date | int | None]"
"str" is not assignable to "datetime"
"str" is not assignable to "date"
"str" is not assignable to "datetime64[date | int | None]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/idata_w_dates_to_df.py:297:27 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/forecasttools/idata_w_dates_to_df.py:301:47 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:4:6 - error: Import "cfasodapy" could not be resolved (reportMissingImports)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:32:30 - error: Expression of type "None" cannot be assigned to parameter of type "str | date"
Type "None" is not assignable to type "str | date"
"None" is not assignable to "str"
"None" is not assignable to "date" (reportArgumentType)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:33:28 - error: Expression of type "None" cannot be assigned to parameter of type "str | date"
Type "None" is not assignable to type "str | date"
"None" is not assignable to "str"
"None" is not assignable to "date" (reportArgumentType)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:34:45 - error: Expression of type "None" cannot be assigned to parameter of type "str | list[str]"
Type "None" is not assignable to type "str | list[str]"
"None" is not assignable to "str"
"None" is not assignable to "list[str]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:35:34 - error: Expression of type "None" cannot be assigned to parameter of type "str | list[str]"
Type "None" is not assignable to type "str | list[str]"
"None" is not assignable to "str"
"None" is not assignable to "list[str]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:37:22 - error: Expression of type "None" cannot be assigned to parameter of type "str"
"None" is not assignable to "str" (reportArgumentType)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:113:30 - error: Expression of type "None" cannot be assigned to parameter of type "str | date"
Type "None" is not assignable to type "str | date"
"None" is not assignable to "str"
"None" is not assignable to "date" (reportArgumentType)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:114:28 - error: Expression of type "None" cannot be assigned to parameter of type "str | date"
Type "None" is not assignable to type "str | date"
"None" is not assignable to "str"
"None" is not assignable to "date" (reportArgumentType)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:115:22 - error: Expression of type "None" cannot be assigned to parameter of type "str"
"None" is not assignable to "str" (reportArgumentType)
CFA/forecasttools-py/forecasttools/pull_data_cdc_gov.py:118:34 - error: Expression of type "None" cannot be assigned to parameter of type "str | list[str]"
Type "None" is not assignable to type "str | list[str]"
"None" is not assignable to "str"
"None" is not assignable to "list[str]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/sbc.py
CFA/forecasttools-py/forecasttools/sbc.py:61:34 - error: Cannot access attribute "model" for class "MCMCKernel"
Attribute "model" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/forecasttools/sbc.py:90:26 - error: Expected class but received "(iterable: Iterable[object], /) -> bool" (reportGeneralTypeIssues)
CFA/forecasttools-py/forecasttools/sbc.py:90:42 - error: Expected class but received "(iterable: Iterable[object], /) -> bool" (reportGeneralTypeIssues)
CFA/forecasttools-py/forecasttools/sbc.py:102:30 - error: Cannot access attribute "model" for class "MCMCKernel"
Attribute "model" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/forecasttools/sbc.py:118:21 - error: Expected class but received "(seed: ArrayLike, *, impl: PRNGSpecDesc | None = None) -> Array" (reportGeneralTypeIssues)
CFA/forecasttools-py/forecasttools/sbc.py:118:70 - error: Expected class but received "(iterable: Iterable[object], /) -> bool" (reportGeneralTypeIssues)
CFA/forecasttools-py/forecasttools/sbc.py:139:41 - error: Argument of type "int" cannot be assigned to parameter "chain_method" of type "str" in function "__init__"
"int" is not assignable to "str" (reportArgumentType)
CFA/forecasttools-py/forecasttools/sbc.py:139:41 - error: Argument of type "int" cannot be assigned to parameter "progress_bar" of type "bool" in function "__init__"
"int" is not assignable to "bool" (reportArgumentType)
CFA/forecasttools-py/forecasttools/sbc.py:139:41 - error: Argument of type "int" cannot be assigned to parameter "jit_model_args" of type "bool" in function "__init__"
"int" is not assignable to "bool" (reportArgumentType)
CFA/forecasttools-py/forecasttools/sbc.py:151:16 - error: Type "InferenceData" is not assignable to return type "tuple[InferenceData, int]"
"InferenceData" is not assignable to "tuple[InferenceData, int]" (reportReturnType)
CFA/forecasttools-py/forecasttools/sbc.py:209:61 - error: No overloads for "__getitem__" match the provided arguments (reportCallIssue)
CFA/forecasttools-py/forecasttools/sbc.py:209:61 - error: Argument of type "Literal['posterior']" cannot be assigned to parameter "key" of type "slice[Any, Any, Any]" in function "__getitem__"
"Literal['posterior']" is not assignable to "slice[Any, Any, Any]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/sbc_plots.py
CFA/forecasttools-py/forecasttools/sbc_plots.py:95:25 - error: "cdf" is possibly unbound (reportPossiblyUnboundVariable)
CFA/forecasttools-py/forecasttools/sbc_plots.py:98:38 - error: Argument of type "Literal['auto']" cannot be assigned to parameter "confidence_bands" of type "bool" in function "plot_ecdf"
"Literal['auto']" is not assignable to "bool" (reportArgumentType)
CFA/forecasttools-py/forecasttools/to_hubverse.py
CFA/forecasttools-py/forecasttools/to_hubverse.py:41:20 - error: Type "list[int]" is not assignable to declared type "list[str] | None"
Type "list[int]" is not assignable to type "list[str] | None"
"list[int]" is not assignable to "list[str]"
Type parameter "_T@list" is invariant, but "int" is not the same as "str"
Consider switching from "list" to "Sequence" which is covariant
"list[int]" is not assignable to "None" (reportAssignmentType)
CFA/forecasttools-py/forecasttools/to_hubverse.py:52:61 - error: Argument of type "str" cannot be assigned to parameter "weeks" of type "float" in function "__new__"
"str" is not assignable to "float" (reportArgumentType)
CFA/forecasttools-py/forecasttools/to_hubverse.py:55:61 - error: Argument of type "str" cannot be assigned to parameter "weeks" of type "float" in function "__new__"
"str" is not assignable to "float" (reportArgumentType)
CFA/forecasttools-py/forecasttools/to_hubverse.py:58:17 - error: Argument of type "list[str] | None" cannot be assigned to parameter "iterable" of type "Iterable[_T1@__new__]" in function "__new__"
Type "list[str] | None" is not assignable to type "Iterable[str]"
"None" is incompatible with protocol "Iterable[str]"
"__iter__" is not present (reportArgumentType)
CFA/forecasttools-py/forecasttools/to_hubverse.py:58:17 - error: Argument of type "list[str] | None" cannot be assigned to parameter "iterable" of type "Iterable[_T1@__new__]" in function "__new__"
Type "list[str] | None" is not assignable to type "Iterable[_T1@__new__]"
"None" is incompatible with protocol "Iterable[_T1@__new__]"
"__iter__" is not present (reportArgumentType)
CFA/forecasttools-py/forecasttools/to_hubverse.py:139:70 - error: Argument of type "list[int] | Unknown" cannot be assigned to parameter "horizons" of type "list[str] | None" in function "get_hubverse_target_end_dates"
Type "list[int] | Unknown" is not assignable to type "list[str] | None"
Type "list[int]" is not assignable to type "list[str] | None"
"list[int]" is not assignable to "list[str]"
Type parameter "_T@list" is invariant, but "int" is not the same as "str"
Consider switching from "list" to "Sequence" which is covariant
"list[int]" is not assignable to "None" (reportArgumentType)
CFA/forecasttools-py/forecasttools/trajectories_to_quantiles.py
CFA/forecasttools-py/forecasttools/trajectories_to_quantiles.py:12:30 - error: Expression of type "None" cannot be assigned to parameter of type "list[float]"
"None" is not assignable to "list[float]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/trajectories_to_quantiles.py:13:33 - error: Expression of type "None" cannot be assigned to parameter of type "list[str]"
"None" is not assignable to "list[str]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/trajectories_to_quantiles.py:17:26 - error: Expression of type "None" cannot be assigned to parameter of type "list[str]"
"None" is not assignable to "list[str]" (reportArgumentType)
CFA/forecasttools-py/forecasttools/utils.py
CFA/forecasttools-py/forecasttools/utils.py:13:12 - error: Expected class but received "(iterable: Iterable[object], /) -> bool" (reportGeneralTypeIssues)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:79:35 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:81:23 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:82:22 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:102:33 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:104:19 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:105:18 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:262:39 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:264:27 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:265:26 - error: Cannot access attribute "posterior_predictive" for class "InferenceData"
Attribute "posterior_predictive" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:306:36 - error: Cannot access attribute "observed_data" for class "InferenceData"
Attribute "observed_data" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:349:36 - error: Cannot access attribute "observed_data" for class "InferenceData"
Attribute "observed_data" is unknown (reportAttributeAccessIssue)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:512:32 - error: Argument of type "date" cannot be assigned to parameter "start_date_iso" of type "str | datetime" in function "add_time_coords_to_idata_dimensions"
Type "date" is not assignable to type "str | datetime"
"date" is not assignable to "str"
"date" is not assignable to "datetime" (reportArgumentType)
CFA/forecasttools-py/tests/test_add_time_coords_to_idata.py:521:28 - error: Argument of type "date" cannot be assigned to parameter "start_date_iso" of type "str | datetime" in function "add_time_coords_to_idata_dimensions"
Type "date" is not assignable to type "str | datetime"
"date" is not assignable to "str"
"date" is not assignable to "datetime" (reportArgumentType)
CFA/forecasttools-py/tests/test_sbc.py
CFA/forecasttools-py/tests/test_sbc.py:24:58 - error: Argument of type "ArrayLike" cannot be assigned to parameter "loc" of type "float" in function "__init__"
Type "ArrayLike" is not assignable to type "float"
"Array" is not assignable to "float" (reportArgumentType)
59 errors, 1 warning, 0 informations
Metadata
Metadata
Assignees
Labels
No labels