Skip to content

Commit

Permalink
Updating patterns to libphonenumber v8.12.18 (#24)
Browse files Browse the repository at this point in the history
* Updating patterns to libphonenumber v8.12.18
  • Loading branch information
tolstislon committed Feb 9, 2021
1 parent 182b019 commit 5ecbbf9
Show file tree
Hide file tree
Showing 8 changed files with 273 additions and 278 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

## Version 2:

* **2.0.1** Updating patterns to libphonenumber v8.12.18
* **2.0.0**
* Added support for mobile phone numbers
* Added separate calls to get mobile phone number and national phone number

----

## Version 1:

* **1.4.0** Added load_alt_patters function
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ verify_ssl = true
requests = "==2.25.1"
pytest = "==6.1.2"
pytest-cov = "==2.10.1"
phonenumbers = "==8.12.17"
phonenumbers = "==8.12.18"
black = "==20.8b1"
flake8 = "==3.8.4"
pep8-naming = "==0.11.1"
Expand Down
15 changes: 13 additions & 2 deletions phone_gen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@
* Modified strgen https://github.com/paul-wolf/strgen
"""

from ._generator import PhoneNumber, PhoneNumberNotFound, load_alt_patters, clean_alt_patters
from ._generator import (
PhoneNumber,
PhoneNumberNotFound,
load_alt_patters,
clean_alt_patters,
)

try:
from .__version__ import version as __version__
except ImportError: # pragma: no cover
__version__ = "unknown"

__all__ = ["PhoneNumber", "__version__", "PhoneNumberNotFound", "load_alt_patters", "clean_alt_patters"]
__all__ = [
"PhoneNumber",
"__version__",
"PhoneNumberNotFound",
"load_alt_patters",
"clean_alt_patters",
]
4 changes: 2 additions & 2 deletions phone_gen/__version__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# coding: utf-8
version = '2.0.0'
version_tuple = (2, 0, 0)
version = "2.0.1"
version_tuple = (2, 0, 1)
6 changes: 4 additions & 2 deletions phone_gen/_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ def __init__(self, value: str):
if not self._country:
raise PhoneNumberNotFound('Not found country "{}"'.format(value))
self._national = NumberGenerator(self._country["pattern"])
self._mobile = NumberGenerator(self._country.get("mobile", self._country["pattern"]))
self._mobile = NumberGenerator(
self._country.get("mobile", self._country["pattern"])
)

def __str__(self):
return "<PhoneNumber({})>".format(self.info())
Expand Down Expand Up @@ -344,7 +346,7 @@ def get_national(self, full: bool = True) -> str:
number = self._national.render()
# Could not find problem fixme
if (
number.startswith("49") and self._country["code"] == "49"
number.startswith("49") and self._country["code"] == "49"
): # pragma: no cover
return self.get_national(full)
return "+{}{}".format(self._country["code"], number) if full else number
518 changes: 251 additions & 267 deletions phone_gen/patterns.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
description="International phone number generation",
long_description=long_description,
long_description_content_type="text/markdown",
version='2.0.0',
version='2.0.1',
entry_points={
"console_scripts": ["phone-gen=phone_gen.cli:main"],
},
Expand Down
1 change: 0 additions & 1 deletion tests/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[pytest]
addopts =
--cov-report=html
--cov=phone_gen tests/
-l

Expand Down

0 comments on commit 5ecbbf9

Please sign in to comment.