Exemplo n.º 1
0
 def clean_text(
     self,
     text: str,
     fuzzy: bool = False,
     format: Optional[str] = None,
     proxy: Optional["EntityProxy"] = None,
 ) -> Optional[str]:
     """The classic: date parsing, every which way."""
     if format is not None:
         return parse_format(text, format).text
     return parse(text).text
Exemplo n.º 2
0
 def to_datetime(self, value: str) -> Optional[datetime]:
     return parse(value).dt
Exemplo n.º 3
0
 def validate(self, value: str) -> bool:
     """Check if a thing is a valid date."""
     prefix = parse(value)
     return prefix.precision != Precision.EMPTY