Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion faker/providers/address/en_US/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Optional, Tuple

from ..en import Provider as AddressProvider

from .counties import ALL_COUNTIES, COUNTIES_BY_STATE

class Provider(AddressProvider):
city_prefixes = ("North", "East", "West", "South", "New", "Lake", "Port")
Expand Down Expand Up @@ -446,6 +446,21 @@ class Provider(AddressProvider):
"MH",
"PW",
)


counties = ALL_COUNTIES
counties_by_state = COUNTIES_BY_STATE

def county(self) -> str:
return self.random_element(self.counties)

def county_by_state(self, state: str) -> str:
return self.random_element(self.counties_by_state[state])

def county_with_state(self) -> str:
state = self.random_element(list(self.counties_by_state))
county = self.random_element(self.counties_by_state[state])
return f"{county}, {state}"

known_usps_abbr = states_abbr + territories_abbr + freely_associated_states_abbr

Expand Down
Loading
Loading