-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
133 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,44 @@ | ||
"""`atlus` is a Python package to convert raw address strings into the OSM format. | ||
"""`atlus` is a Python package to convert raw address and phone number strings into the OSM format. | ||
It's designed to be used with US and Canadian phone numbers and addresses. | ||
```python | ||
>> import atlus | ||
>> atlus.abbrs("St. Francis") | ||
# "Saint Francis" | ||
>> atlus.get_address("789 Oak Dr, Smallville California, 98765")[0] | ||
# {"addr:housenumber": "789", "addr:street": "Oak Drive:, "addr:city": "Smallville", "addr:state": "CA", "addr:postcode": "98765"} | ||
>> atlus.get_phone("(202) 900-9019") | ||
# "+1 202-900-9019" | ||
``` | ||
""" | ||
|
||
# SPDX-FileCopyrightText: 2024-present Will <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
from .atlus import ( | ||
get_address, | ||
get_phone, | ||
abbrs, | ||
get_title, | ||
mc_replace, | ||
us_replace, | ||
ord_replace, | ||
clean, | ||
) | ||
from . import atlus | ||
from . import resources | ||
|
||
__all__ = [ | ||
"get_address", | ||
"get_phone", | ||
"abbrs", | ||
"get_title", | ||
"mc_replace", | ||
"us_replace", | ||
"ord_replace", | ||
"clean", | ||
"atlus", | ||
"resources", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Define objects for parsing fields.""" | ||
|
||
from pydantic import BaseModel, Field | ||
|
||
|
||
class Address(BaseModel): | ||
"""Define address parsing fields.""" | ||
|
||
addr_housenumber: int | str | None = Field( | ||
alias="addr:housenumber", | ||
description="The house number that is included in the address.", | ||
examples=[200, "1200-29"], | ||
default=None, | ||
) | ||
addr_street: str | None = Field( | ||
alias="addr:street", | ||
description="The street that the address is located on.", | ||
examples=["North Spring Street"], | ||
default=None, | ||
) | ||
addr_unit: str | None = Field( | ||
alias="addr:unit", | ||
description="The unit number or letter that is included in the address.", | ||
examples=["B"], | ||
default=None, | ||
) | ||
addr_city: str | None = Field( | ||
alias="addr:city", | ||
description="The city that the address is located in.", | ||
examples=["Los Angeles"], | ||
default=None, | ||
) | ||
addr_state: str | None = Field( | ||
alias="addr:state", | ||
pattern=r"^[A-Z]{2}$", | ||
description="The state or territory of the address.", | ||
examples=["CA"], | ||
default=None, | ||
) | ||
addr_postcode: str | None = Field( | ||
alias="addr:postcode", | ||
pattern=r"^\d{5}(?:\-\d{4})?$", | ||
description="The postal code of the address.", | ||
examples=["90012", "90012-4801"], | ||
default=None, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters