Skip to content

Commit

Permalink
Lint.
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Moorhouse <[email protected]>
  • Loading branch information
joemoorhouse committed Oct 20, 2024
1 parent bbe057c commit efe8427
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ @techreport{huizinga2017global
author={Huizinga, Jan and De Moel, Hans and Szewczyk, Wojciech},
year={2017},
institution={Joint Research Centre}
}
}
2 changes: 1 addition & 1 deletion docs/user_guide/vulnerability/vulnerability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Flood

vulnerability_functions/inundation_jrc/onboard

.. bibliography::
.. bibliography::
37 changes: 15 additions & 22 deletions src/physrisk/vulnerability_models/configuration/config_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@


def build_all_config():
"""Build all of the configuration.
"""
"""Build all of the configuration."""
config_items: list[VulnerabilityConfigItem] = []
config_builders = [
ConfigBuilderJRCFlood()
]
config_builders = [ConfigBuilderJRCFlood()]
for builder in config_builders:
config_items += builder.build_config()
config_items_to_csv(
Expand All @@ -33,25 +30,19 @@ def build_all_config():


def vulnerability_config_dir():
"""Path of the vulnerability configuration directory.
"""
path = (
Path(__file__).parents[2]
/ "data"
/ "static"
/ "vulnerability"
)
"""Path of the vulnerability configuration directory."""
path = Path(__file__).parents[2] / "data" / "static" / "vulnerability"
return path


class ConfigBuilder(Protocol):
def build_config() -> List[VulnerabilityConfigItem]:
...
def build_config(self) -> List[VulnerabilityConfigItem]: ...


class ConfigBuilderBase:
def __init__(self,
source_dir: Optional[str] = None,
fs: Optional[AbstractFileSystem] = None):
def __init__(
self, source_dir: Optional[str] = None, fs: Optional[AbstractFileSystem] = None
):
"""_summary_
Args:
Expand All @@ -63,12 +54,14 @@ def __init__(self,
Defaults to None, in which case a LocalFileSystem is assumed.
"""
self.fs = fs if fs is not None else LocalFileSystem()
self.source_dir = Path(source_dir) if source_dir is not None else self.vulnerability_onboarding_dir()

self.source_dir = (
Path(source_dir)
if source_dir is not None
else self.vulnerability_onboarding_dir()
)

def vulnerability_onboarding_dir(self):
"""Path of the vulnerability on-boarding directory.
"""
"""Path of the vulnerability on-boarding directory."""
path = (
Path(__file__).parents[4]
/ "docs"
Expand Down

0 comments on commit efe8427

Please sign in to comment.