generated from Hazel/python-project
feat: refactored the versioning
This commit is contained in:
parent
62fd09b8de
commit
683895b66d
@ -1,2 +0,0 @@
|
|||||||
__version__ = "0.0.4"
|
|
||||||
__name__ = "pycountry_wrapper"
|
|
@ -1,6 +1,7 @@
|
|||||||
from .country import Country, EmptyCountry, EmptyCountryException
|
from .country import Country, EmptyCountry, EmptyCountryException
|
||||||
from . import config
|
from . import config
|
||||||
|
|
||||||
|
__name__ = "pycountry_wrapper"
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"Country",
|
"Country",
|
||||||
"EmptyCountry",
|
"EmptyCountry",
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
from .__about__ import __name__, __version__
|
from . import __name__
|
||||||
from . import Country, EmptyCountry, config
|
from . import Country, EmptyCountry, config
|
||||||
|
|
||||||
import pycountry
|
|
||||||
|
|
||||||
|
|
||||||
def cli():
|
def cli():
|
||||||
print(f"Running {__name__} version {__version__} from __main__.py")
|
print(f"Running {__name__} from __main__.py")
|
||||||
|
import pycountry
|
||||||
config.fallback_country = "US"
|
config.fallback_country = "US"
|
||||||
t = pycountry.countries.get(alpha_2="DE")
|
t = pycountry.countries.get(alpha_2="DE")
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from typing_extensions import Self
|
|
||||||
import pycountry
|
import pycountry
|
||||||
import pycountry.db
|
import pycountry.db
|
||||||
|
|
||||||
@ -120,7 +119,7 @@ class EmptyCountry(Country):
|
|||||||
This will be used if you don't want to use a fallback country but you still want to be able to not have None
|
This will be used if you don't want to use a fallback country but you still want to be able to not have None
|
||||||
You can access the same attributes but they will just return None
|
You can access the same attributes but they will just return None
|
||||||
"""
|
"""
|
||||||
def __new__(cls, country: Optional[str] = None, pycountry_object: Optional[pycountry.db.Country] = None, **kwargs):
|
def __new__(cls, country: Optional[str] = None, pycountry_object: Optional[pycountry.db.Country] = None, **kwargs) -> Union[Country, EmptyCountry]:
|
||||||
try:
|
try:
|
||||||
return Country(country=country, pycountry_object=pycountry_object, disable_fallback=True)
|
return Country(country=country, pycountry_object=pycountry_object, disable_fallback=True)
|
||||||
except EmptyCountryException:
|
except EmptyCountryException:
|
||||||
|
@ -3,7 +3,8 @@ name = "pycountry-wrapper"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"pycountry~=24.6.1",
|
"pycountry~=24.6.1",
|
||||||
]
|
]
|
||||||
dynamic = ["version"]
|
version = "1.0.0"
|
||||||
|
dynamic = []
|
||||||
authors = []
|
authors = []
|
||||||
description = "This is a wrapper for pycountry, to make said library more usable."
|
description = "This is a wrapper for pycountry, to make said library more usable."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
@ -32,6 +33,3 @@ packages = ["pycountry_wrapper"]
|
|||||||
|
|
||||||
[tool.hatch.metadata]
|
[tool.hatch.metadata]
|
||||||
allow-direct-references = true
|
allow-direct-references = true
|
||||||
|
|
||||||
[tool.hatch.version]
|
|
||||||
path = "pycountry_wrapper/__about__.py"
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user