Compare commits

..

No commits in common. "d956ea6b2446734bbf68e1d0d476440a72addc8c" and "8f0b3a824fc44011345da98d39310b6c3c852196" have entirely different histories.

3 changed files with 3 additions and 27 deletions

View File

@ -1,2 +1,2 @@
__version__ = "0.0.2"
__version__ = "0.0.1"
__name__ = "pycountry_wrapper"

View File

@ -15,9 +15,7 @@ class Country:
If the country couldn't be found, it raises the pycountry_wrapper.CountryDoesNotExist exception.
"""
def __new__(cls, country: str = None, pycountry_object = None, silent: bool = False):
self = super().__new__(cls)
def __init__(self, country: str = None, pycountry_object = None):
if country is not None:
# auto detect if alpha_2 or alpha_3
if len(country) == 2:
@ -26,31 +24,9 @@ class Country:
pycountry_object = pycountry.countries.get(alpha_3=country.upper())
if pycountry_object is None:
if silent:
return None
raise CountryDoesNotExist()
self.pycountry_object = pycountry_object
return self
def __init__(self, country: str = None, pycountry_object = None, silent: bool = False) -> None: ...
"""
def __init__(self, ):
if country is not None:
# auto detect if alpha_2 or alpha_3
if len(country) == 2:
pycountry_object = pycountry.countries.get(alpha_2=country.upper())
elif len(country) == 3:
pycountry_object = pycountry.countries.get(alpha_3=country.upper())
if pycountry_object is None and not silent:
raise CountryDoesNotExist()
self.pycountry_object = pycountry_object
print("init")
"""
@classmethod
def from_alpha_2(cls, alpha_2: str) -> Country:

View File

@ -5,4 +5,4 @@ from . import Country
def cli():
print(f"Running {__name__} version {__version__} from __main__.py")
print(Country(country="DE"))
print(Country("DEU"))