Skip to content

Commit

Permalink
Removed pandas XML dependency on countries download
Browse files Browse the repository at this point in the history
  • Loading branch information
canimus committed Jan 28, 2024
1 parent 0f475ce commit dda3a13
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions cuallee/iso/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from functools import lru_cache
import pandas as pd
from toolz import first
from i18n_iso_countries import get_alpha2_codes


@dataclass
Expand Down Expand Up @@ -35,11 +36,7 @@ def _get_ccy(element):
@lru_cache
def _load_countries():
"""External download from Google shared data of country codes and locations"""
DEFAULT_ENDPOINT_3166 = (
"https://developers.google.com/public-data/docs/canonical/countries_csv"
)
response = pd.read_html(os.getenv("ISO_3166_ENDPOINT", DEFAULT_ENDPOINT_3166))
return first(response)["country"].str.upper().dropna().tolist()
return list(get_alpha2_codes().values())


class ISO:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ dependencies = [
"toolz >= 0.12.0",
"pygments >= 2.15.1",
"requests >= 2.28.2",
"pandas>=1.5.3"
"pandas>=1.5.3",
"i18n-iso-countries==1.0.0",
]

[project.optional-dependencies]
Expand Down

0 comments on commit dda3a13

Please sign in to comment.