Skip to content

Commit

Permalink
pylint fixes (please work) and warnings bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kieran-Fishwick-TfN committed Oct 29, 2024
1 parent fd84360 commit 6e2dc71
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/caf/distribute/gravity_model/multi_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class MultiCostDistribution:

distributions: list[MGMCostDistribution]

# pylint: disable=Too many arguments

@classmethod
def from_pandas(
cls,
Expand Down Expand Up @@ -237,6 +237,7 @@ def from_pandas(
--------
`validate`
"""
# pylint: disable=too-many-arguments

distributions: list[MGMCostDistribution] = []

Expand Down Expand Up @@ -352,7 +353,6 @@ class MGMCostDistribution:
# TODO(kf) validate params

# TODO(kf) validate cost distributions
# pylint: disable=too-many-arguments, too-many-locals
@classmethod
def from_pandas(
cls,
Expand Down Expand Up @@ -411,6 +411,8 @@ def from_pandas(
ValueError
if zones in `cat_zone_correspondence` are not present in `ordered_zones`
"""
# pylint: disable=too-many-arguments, too-many-locals

# get a list of zones that use this category of TLD
cat_zones = cat_zone_correspondence.loc[
cat_zone_correspondence[lookup_cat_col] == category, lookup_zone_col
Expand Down Expand Up @@ -603,26 +605,20 @@ def calibrate(
if max_cost > max_binning:
warnings.warn(
"the maximum cost in the cost matrix for"
" category %s, was %s, "
f" category {dist.name}, was {max_cost}, "
"whereas the highest bin edge in cost"
" distribution was %s, "
f" distribution was {max_binning}, "
"you will not be fitting to trips"
" with a cost greater than the binning",
dist.name,
max_cost,
max_binning,
" with a cost greater than the binning"
)
if min_cost < min_binning:
warnings.warn(
"the min cost in the cost matrix for"
" category %s, was %s,"
f" category {dist.name}, was {min_cost},"
" whereas the lowest bin edge in cost"
" distribution was %s, "
f" distribution was {min_binning}, "
" you will not be fitting to trips"
" with a cost less than the binning",
dist.name,
min_cost,
min_binning,
" with a cost less than the binning"
)

gravity_kwargs: dict[str, Any] = {
Expand Down

0 comments on commit 6e2dc71

Please sign in to comment.