Skip to content

Commit

Permalink
fix typing/mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Nov 15, 2023
1 parent 9394221 commit 714062b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/collective/elastic/ingest/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@

STATE = {
"initial": True,
"fieldmap": None,
"fieldmap": {},
}

DETECTOR_METHODS: dict[str, typing.Callable] = {}


def get_field_map() -> dict:
if STATE["fieldmap"] is None:
if STATE["fieldmap"] == {}:
_mappings_file = os.environ.get("MAPPINGS_FILE", None)
if not _mappings_file:
raise ValueError("No mappings file configured.")
with open(_mappings_file) as fp:
STATE["fieldmap"] = json.load(fp)
assert isinstance(STATE["fieldmap"], dict)
return STATE["fieldmap"]


Expand Down

0 comments on commit 714062b

Please sign in to comment.