Skip to content

Commit

Permalink
Fix python3.8 support
Browse files Browse the repository at this point in the history
Python 3.8 and 3.9 use outdated syntax.
Ideally this commit should be reverted on 3.8 and 3.9 support drop.

Resolves: #5
  • Loading branch information
koldakov committed Apr 8, 2024
1 parent b0197bc commit fc52950
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pycountries/languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LanguageUnitBase(BaseModel):
)


if sys.version_info >= (3, 9): # noqa: UP036
if sys.version_info >= (3, 10): # noqa: UP036

class LanguageUnit(LanguageUnitBase):
alpha_2: str | None = Field(
Expand Down
3 changes: 2 additions & 1 deletion src/pycountries/phones.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ class PhoneUnitBase(BaseModel):
calling_code: int = Field(
description="International calling code",
)
# prefixes: list[int] # Abstract property

def is_prefix_supported(self, prefix: int, /) -> bool:
if not self.prefixes or prefix is None:
return True
return prefix in self.prefixes


if sys.version_info >= (3, 9): # noqa: UP036
if sys.version_info >= (3, 10): # noqa: UP036

class PhoneUnit(PhoneUnitBase):
prefixes: list[int]
Expand Down

0 comments on commit fc52950

Please sign in to comment.