from .base import ProcessInfo
from .config import SanitizerConfig
+
class _PostcodeSanitizer:
def __init__(self, config: SanitizerConfig) -> None:
if default_pattern is not None and isinstance(default_pattern, str):
self.matcher.set_default_pattern(default_pattern)
-
def __call__(self, obj: ProcessInfo) -> None:
if not obj.address:
return
postcode.name = formatted[0]
postcode.set_attr('variant', formatted[1])
-
def scan(self, postcode: str, country: Optional[str]) -> Optional[Tuple[str, str]]:
""" Check the postcode for correct formatting and return the
normalized version. Returns None if the postcode does not
assert country is not None
- return self.matcher.normalize(country, match),\
- ' '.join(filter(lambda p: p is not None, match.groups()))
-
-
+ return self.matcher.normalize(country, match), \
+ ' '.join(filter(lambda p: p is not None, match.groups()))
def create(config: SanitizerConfig) -> Callable[[ProcessInfo], None]: