Browse files

Sort missing exports

  • Loading branch information...
1 parent 019cf8b commit a950af3edd65f83d0b4f56fa843c408ede1ff44e @daviddrysdale committed Nov 15, 2013
View
2 python/phonenumbers/__init__.py
@@ -84,6 +84,7 @@
convert_alpha_characters_in_number,
country_code_for_region,
country_code_for_valid_region,
+ country_mobile_token,
example_number,
example_number_for_type,
example_number_for_non_geo_entity,
@@ -145,6 +146,7 @@
'convert_alpha_characters_in_number',
'country_code_for_region',
'country_code_for_valid_region',
+ 'country_mobile_token',
'example_number',
'example_number_for_type',
'example_number_for_non_geo_entity',
View
9 python/phonenumbers/carrier.py
@@ -29,7 +29,7 @@
from .phonenumberutil import PhoneNumberType, number_type
from .phonenumberutil import region_code_for_number
from .phonenumberutil import is_mobile_number_portable_region
-from .prefix import prefix_description_for_number
+from .prefix import _prefix_description_for_number
try:
from .carrierdata import CARRIER_DATA, CARRIER_LONGEST_PREFIX
except ImportError: # pragma no cover
@@ -47,6 +47,9 @@
raise
+__all__ = ['name_for_valid_number', 'name_for_number', 'safe_display_name']
+
+
def name_for_valid_number(numobj, lang, script=None, region=None):
"""Returns a carrier name for the given PhoneNumber object, in the
language provided.
@@ -72,8 +75,8 @@ def name_for_valid_number(numobj, lang, script=None, region=None):
Returns a carrier name in the given language code, for the given phone
number, or an empty string if no description is available.
"""
- return prefix_description_for_number(CARRIER_DATA, CARRIER_LONGEST_PREFIX,
- numobj, lang, script, region)
+ return _prefix_description_for_number(CARRIER_DATA, CARRIER_LONGEST_PREFIX,
+ numobj, lang, script, region)
def name_for_number(numobj, lang, script=None, region=None):
View
12 python/phonenumbers/geocoder.py
@@ -48,7 +48,7 @@
from .phonenumberutil import region_code_for_number, PhoneNumberType, PhoneNumber
from .phonenumberutil import country_mobile_token, national_significant_number, number_type
from .phonenumberutil import region_code_for_country_code, parse, NumberParseException
-from .prefix import prefix_description_for_number
+from .prefix import _prefix_description_for_number
try:
from .geodata import GEOCODE_DATA, GEOCODE_LONGEST_PREFIX
from .geodata.locale import LOCALE_DATA
@@ -67,6 +67,8 @@
else:
raise
+__all__ = ['country_name_for_number', 'description_for_valid_number', 'description_for_number']
+
def country_name_for_number(numobj, lang, script=None, region=None):
"""Return the given PhoneNumber object's country name in the given language.
@@ -155,11 +157,11 @@ def description_for_valid_number(numobj, lang, script=None, region=None):
except NumberParseException:
# If this happens, just re-use what we had.
copied_numobj = numobj
- area_description = prefix_description_for_number(GEOCODE_DATA, GEOCODE_LONGEST_PREFIX,
- copied_numobj, lang, script, region)
+ area_description = _prefix_description_for_number(GEOCODE_DATA, GEOCODE_LONGEST_PREFIX,
+ copied_numobj, lang, script, region)
else:
- area_description = prefix_description_for_number(GEOCODE_DATA, GEOCODE_LONGEST_PREFIX,
- numobj, lang, script, region)
+ area_description = _prefix_description_for_number(GEOCODE_DATA, GEOCODE_LONGEST_PREFIX,
+ numobj, lang, script, region)
if area_description != "":
return area_description
else:
View
2 python/phonenumbers/prefix.py
@@ -56,7 +56,7 @@ def _find_lang(langdict, lang, script, region):
return None
-def prefix_description_for_number(data, longest_prefix, numobj, lang, script=None, region=None):
+def _prefix_description_for_number(data, longest_prefix, numobj, lang, script=None, region=None):
"""Return a text description of a PhoneNumber for the given language.
Arguments:
View
3 python/phonenumbers/timezone.py
@@ -37,7 +37,6 @@
from .util import prnt, u, U_PLUS
from .phonenumberutil import PhoneNumberType, number_type
from .phonenumberutil import PhoneNumberFormat, format_number
-from .prefix import prefix_description_for_number
try:
from .tzdata import TIMEZONE_DATA, TIMEZONE_LONGEST_PREFIX
except ImportError: # pragma no cover
@@ -54,6 +53,8 @@
else:
raise
+__all__ = ['UNKNOWN_TIMEZONE', 'time_zones_for_geographical_number', 'time_zones_for_number']
+
# This is defined by ICU as the unknown time zone.
UNKNOWN_TIMEZONE = u("Etc/Unknown")
_UNKNOWN_TIME_ZONE_LIST = (UNKNOWN_TIMEZONE,)
View
2 python/setup.py
@@ -39,7 +39,7 @@
author_email='dmd@lurklurk.org',
url='https://github.com/daviddrysdale/python-phonenumbers',
license='Apache License 2.0',
- packages=['phonenumbers', 'phonenumbers.data', 'phonenumbers.geodata', 'phonenumbers.shortdata',
+ packages=['phonenumbers', 'phonenumbers.data', 'phonenumbers.geodata', 'phonenumbers.shortdata',
'phonenumbers.carrierdata', 'phonenumbers.tzdata'],
test_suite="tests",
platforms='Posix; MacOS X; Windows',
View
4 python/tests/geocodertest.py
@@ -23,7 +23,7 @@
from phonenumbers import geocoder
from phonenumbers.geocoder import description_for_number, country_name_for_number
from phonenumbers.geocoder import description_for_valid_number
-from phonenumbers.prefix import prefix_description_for_number
+from phonenumbers.prefix import _prefix_description_for_number
from phonenumbers.util import u
# Allow override library geocoding metadata with the test metadata.
@@ -167,7 +167,7 @@ def testCoverage(self):
invalid_number = PhoneNumber(country_code=210, national_number=123456)
self.assertEqual("", country_name_for_number(invalid_number, "en"))
# Ensure we exercise all public entrypoints directly
- self.assertEqual("CA", prefix_description_for_number(TEST_GEOCODE_DATA, TEST_GEOCODE_LONGEST_PREFIX, US_NUMBER1, "en"))
+ self.assertEqual("CA", _prefix_description_for_number(TEST_GEOCODE_DATA, TEST_GEOCODE_LONGEST_PREFIX, US_NUMBER1, "en"))
self.assertEqual("CA", description_for_valid_number(US_NUMBER1, "en"))
self.assertEqual("", description_for_valid_number(US_INVALID_NUMBER, "en"))
# Add in some script and region specific fictional names
View
2 setup.py
@@ -42,7 +42,7 @@
author_email='dmd@lurklurk.org',
url='https://github.com/daviddrysdale/python-phonenumbers',
license='Apache License 2.0',
- packages=['phonenumbers', 'phonenumbers.data', 'phonenumbers.geodata', 'phonenumbers.shortdata',
+ packages=['phonenumbers', 'phonenumbers.data', 'phonenumbers.geodata', 'phonenumbers.shortdata',
'phonenumbers.carrierdata', 'phonenumbers.tzdata'],
package_dir={'': 'python'},
test_suite="tests",
View
8 tools/python/allcheck.py
@@ -7,6 +7,9 @@
sys.path.insert(0, '../../python')
import phonenumbers
+import phonenumbers.geocoder
+import phonenumbers.carrier
+import phonenumbers.timezone
# Manually grep for top-level identifiers
INTERNAL_FILES = ['../../python/phonenumbers/util.py',
@@ -33,7 +36,10 @@
grepped_all.add(m.group(1))
# Pull in the declared identifiers
-code_all = set(phonenumbers.__all__)
+code_all = (set(phonenumbers.__all__) |
+ set(phonenumbers.geocoder.__all__) |
+ set(phonenumbers.carrier.__all__) |
+ set(phonenumbers.timezone.__all__))
# Compare
code_not_grepped = (code_all - grepped_all)

0 comments on commit a950af3

Please sign in to comment.