Skip to content

Commit

Permalink
Fixing docstring examples
Browse files Browse the repository at this point in the history
  • Loading branch information
whubsch committed Jul 30, 2024
1 parent 6413174 commit 786edec
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ pip install atlus
```python
>>> import atlus
>>> atlus.abbrs("St. Francis")
# "Saint Francis"
"Saint Francis"
>>> atlus.get_address("789 Oak Dr, Smallville California, 98765")
# {"addr:housenumber": "789", "addr:street": "Oak Drive", "addr:city": "Smallville", "addr:state": "CA", "addr:postcode": "98765"}
{"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"
"+1 202-900-9019"
```

## Docs

The documentation for our package is available online at our [pdoc page](https://whubsch.github.io/atlus_py/index.html). We would greatly appreciate your contributions to help improve the auto-generated docs; please submit any updates or corrections via pull requests.
The documentation for our package is available online at our [documentation page](https://whubsch.github.io/atlus_py/index.html). We would greatly appreciate your contributions to help improve the auto-generated docs; please submit any updates or corrections via pull requests.

## License

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ authors = [{ name = "Will", email = "[email protected]" }]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"License :: OSI Approved :: MIT License",
"Typing :: Typed",
]
dependencies = ["usaddress", "regex"]

Expand Down
6 changes: 3 additions & 3 deletions src/atlus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
```python
>>> import atlus
>>> atlus.abbrs("St. Francis")
# "Saint 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"}
{"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"
"+1 202-900-9019"
```
"""
Expand Down
34 changes: 17 additions & 17 deletions src/atlus/atlus.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def get_title(value: str, single_word: bool = False) -> str:
```python
>>> get_title("PALM BEACH")
# "Palm Beach"
"Palm Beach"
>>> get_title("BOSTON")
# "BOSTON"
"BOSTON"
>>> get_title("BOSTON", single_word=True)
# "Boston"
"Boston"
```
Args:
Expand All @@ -83,7 +83,7 @@ def us_replace(value: str) -> str:
```python
>>> us_replace("U.S. Route 15")
# "US Route 15"
"US Route 15"
```
Args:
Expand All @@ -100,7 +100,7 @@ def mc_replace(value: str) -> str:
```python
>>> mc_replace("Fort Mchenry")
# "Fort McHenry"
"Fort McHenry"
```
Args:
Expand All @@ -121,7 +121,7 @@ def ord_replace(value: str) -> str:
```python
>>> ord_replace("3Rd St. NW")
# "3rd St. NW"
"3rd St. NW"
```
Args:
Expand Down Expand Up @@ -197,11 +197,11 @@ def abbrs(value: str) -> str:
```python
>>> abbrs("St. Francis")
# "Saint Francis"
"Saint Francis"
>>> abbrs("E St.")
# "E Street"
"E Street"
>>> abbrs("E Sewell St")
# "East Sewell Street"
"East Sewell Street"
```
Args:
Expand Down Expand Up @@ -362,7 +362,7 @@ def collapse_list(seq: list) -> list:
```python
>>> collapse_list(["foo", "bar", "foo"])
# ["foo", "bar"]
["foo", "bar"]
```
Args:
Expand Down Expand Up @@ -412,15 +412,15 @@ def get_address(
```python
>>> get_address("345 MAPLE RD, COUNTRYSIDE, PA 24680-0198")[0]
# {"addr:housenumber": "345", "addr:street": "Maple Road",
{"addr:housenumber": "345", "addr:street": "Maple Road",
"addr:city": "Countryside", "addr:state": "PA", "addr:postcode": "24680-0198"}
>>> get_address("777 Strawberry St.")[0]
# {"addr:housenumber": "777", "addr:street": "Strawberry Street"}
{"addr:housenumber": "777", "addr:street": "Strawberry Street"}
>>> address = get_address("222 NW Pineapple Ave Suite A Unit B")
>>> address[0]
# {"addr:housenumber": "222", "addr:street": "Northwest Pineapple Avenue"}
{"addr:housenumber": "222", "addr:street": "Northwest Pineapple Avenue"}
>>> address[1]
# ["addr:unit"]
["addr:unit"]
```
Args:
Expand Down Expand Up @@ -492,11 +492,11 @@ def get_phone(phone: str) -> str:
```python
>>> get_phone("2029009019")
# "+1 202-900-9019"
"+1 202-900-9019"
>>> get_phone("(202) 900-9019")
# "+1 202-900-9019"
"+1 202-900-9019"
>>> get_phone("202-900-901")
# ValueError: Invalid phone number: 202-900-901
ValueError: Invalid phone number: 202-900-901
```
Args:
Expand Down

0 comments on commit 786edec

Please sign in to comment.