diff --git a/followthemoney/export/common.py b/followthemoney/export/common.py index 2852ab8e2..5e43f57d0 100644 --- a/followthemoney/export/common.py +++ b/followthemoney/export/common.py @@ -23,7 +23,7 @@ def exportable_fields( yield prop, proxy.get(prop) def write(self, proxy: E, extra: Optional[List[str]] = None) -> None: - raise NotImplemented + raise NotImplementedError def finalize(self) -> None: pass diff --git a/followthemoney/export/excel.py b/followthemoney/export/excel.py index 2d39751b7..a627c4cb1 100644 --- a/followthemoney/export/excel.py +++ b/followthemoney/export/excel.py @@ -61,7 +61,7 @@ def write(self, proxy: E, extra: Optional[List[str]] = None) -> None: headers.append(prop.label) sheet = self.make_sheet(proxy.schema.plural, headers) self.sheets[proxy.schema] = sheet - sheet = self.sheets.get(proxy.schema) + sheet = self.sheets[proxy.schema] try: cells = [proxy.id] cells.extend(extra or []) diff --git a/followthemoney/export/rdf.py b/followthemoney/export/rdf.py index 3265b58cb..196638da9 100644 --- a/followthemoney/export/rdf.py +++ b/followthemoney/export/rdf.py @@ -1,6 +1,6 @@ import logging -from typing import List, Optional, TextIO from rdflib import Graph +from typing import List, Optional, TextIO from followthemoney.export.common import Exporter from followthemoney.proxy import E diff --git a/followthemoney/mapping/csv.py b/followthemoney/mapping/csv.py index 4df1a86b3..e4402a605 100644 --- a/followthemoney/mapping/csv.py +++ b/followthemoney/mapping/csv.py @@ -5,7 +5,7 @@ import requests from csv import DictReader from urllib.parse import urlparse -from banal import keys_values, is_listish +from banal import keys_values from typing import ( TYPE_CHECKING, Any, diff --git a/followthemoney/mapping/entity.py b/followthemoney/mapping/entity.py index 9ac37f882..f2754787b 100644 --- a/followthemoney/mapping/entity.py +++ b/followthemoney/mapping/entity.py @@ -9,7 +9,7 @@ from followthemoney.proxy import EntityProxy from followthemoney.mapping.property import PropertyMapping from followthemoney.mapping.source import Record -from followthemoney.exc import InvalidData, InvalidMapping +from followthemoney.exc import InvalidMapping if TYPE_CHECKING: from followthemoney.model import Model diff --git a/followthemoney/mapping/property.py b/followthemoney/mapping/property.py index 0f9efb2b0..1cd76f3cf 100644 --- a/followthemoney/mapping/property.py +++ b/followthemoney/mapping/property.py @@ -8,7 +8,7 @@ from followthemoney.helpers import inline_names from followthemoney.exc import InvalidMapping from followthemoney.proxy import EntityProxy -from followthemoney.util import get_entity_id, sanitize_text +from followthemoney.util import sanitize_text from followthemoney.property import Property from followthemoney.mapping.source import Record diff --git a/followthemoney/mapping/source.py b/followthemoney/mapping/source.py index 187e6d52f..4c1a854a9 100644 --- a/followthemoney/mapping/source.py +++ b/followthemoney/mapping/source.py @@ -15,7 +15,7 @@ def __init__(self, query: "QueryMapping", data: Dict[str, Any]) -> None: @property def records(self) -> Generator[Record, None, None]: - raise NotImplemented + raise NotImplementedError def __len__(self) -> int: return 0 diff --git a/followthemoney/messages.py b/followthemoney/messages.py index 2bf497e42..d939ebbcc 100644 --- a/followthemoney/messages.py +++ b/followthemoney/messages.py @@ -1,5 +1,5 @@ import yaml -from typing import Any, Dict, Generator, List, TextIO, Tuple, Union +from typing import Any, Dict, Generator, List, TextIO, Tuple Message = Tuple[Any, Any, List[str], List[str]] diff --git a/followthemoney/namespace.py b/followthemoney/namespace.py index 9e1cbf1d7..391cf6a68 100644 --- a/followthemoney/namespace.py +++ b/followthemoney/namespace.py @@ -23,7 +23,7 @@ the server without compromising isolation. """ import hmac -from typing import Any, Optional, Tuple, Union, TypeVar +from typing import Any, Optional, Tuple, Union from followthemoney.types import registry from followthemoney.proxy import E diff --git a/followthemoney/types/__init__.py b/followthemoney/types/__init__.py index 73e460bc7..d306bd4a4 100644 --- a/followthemoney/types/__init__.py +++ b/followthemoney/types/__init__.py @@ -22,7 +22,6 @@ from followthemoney.types.number import NumberType from followthemoney.types.common import PropertyType - registry = Registry() registry.add(UrlType) registry.add(NameType) @@ -45,3 +44,5 @@ registry.add(HTMLType) registry.add(StringType) registry.add(NumberType) + +__all__ = ["PropertyType", "registry"] diff --git a/followthemoney/types/identifier.py b/followthemoney/types/identifier.py index 5aacaf075..24878e987 100644 --- a/followthemoney/types/identifier.py +++ b/followthemoney/types/identifier.py @@ -1,5 +1,4 @@ import re -from typing import Callable, Sequence from followthemoney.types.common import PropertyType from followthemoney.util import dampen, shortest, longest