def phone_number(number, region_code=None, pattern=None, number_format=None, prefix_format=None):
    """
        for number +995595119925
        pattern="(\\d{3})(\\d{2})(\\d{2})(\\d{2})", format="\\1 \\2-\\3-\\4"
        result 595 11-99-25
    """
    if pattern is None or number_format is None or prefix_format is None:
        return number
    if type(number) is PhoneNumber:
        try:
            number = phonenumbers.parse(number.phone_number, number.region_code)
        except:
            return number
    elif type(number) is str:
        if region_code is None:
            return number
        try:
            number = phonenumbers.parse(number, region_code)
        except:
            return number

    new_number_format = NumberFormat(pattern=pattern, format=number_format)
    new_number_format._mutable = True
    new_number_format.national_prefix_formatting_rule = prefix_format % (number.country_code, '$FG')
    new_number_formats = [new_number_format]
    return phonenumbers.format_by_pattern(
        number,
        phonenumbers.PhoneNumberFormat.NATIONAL,
        new_number_formats
    )
def phone_number(number,
                 region_code=None,
                 pattern=None,
                 number_format=None,
                 prefix_format=None):
    """
        for number +995595119925
        pattern="(\\d{3})(\\d{2})(\\d{2})(\\d{2})", format="\\1 \\2-\\3-\\4"
        result 595 11-99-25
    """
    if pattern is None or number_format is None or prefix_format is None:
        return number
    if type(number) is PhoneNumber:
        try:
            number = phonenumbers.parse(number.phone_number,
                                        number.region_code)
        except:
            return number
    elif type(number) is str:
        if region_code is None:
            return number
        try:
            number = phonenumbers.parse(number, region_code)
        except:
            return number

    new_number_format = NumberFormat(pattern=pattern, format=number_format)
    new_number_format._mutable = True
    new_number_format.national_prefix_formatting_rule = prefix_format % (
        number.country_code, '$FG')
    new_number_formats = [new_number_format]
    return phonenumbers.format_by_pattern(
        number, phonenumbers.PhoneNumberFormat.NATIONAL, new_number_formats)
示例#3
0
 def testInternals(self):
     # Python-specific test: coverage of internals
     from phonenumbers.phonenumbermatcher import _limit, _verify, _is_national_prefix_present_if_required, _get_national_number_groups
     from phonenumbers import CountryCodeSource
     self.assertEqual("{1,2}", _limit(1, 2))
     self.assertRaises(Exception, _limit, *(-1, 2))
     self.assertRaises(Exception, _limit, *(1, 0))
     self.assertRaises(Exception, _limit, *(2, 1))
     number = PhoneNumber(country_code=44, national_number=7912345678L)
     self.assertRaises(Exception, _verify, *(99, number, "12345678"))
     self.assertRaises(ValueError, PhoneNumberMatcher, *("text", "US"),
                       **{"leniency": None})
     self.assertRaises(ValueError, PhoneNumberMatcher, *("text", "US"),
                       **{"max_tries": -2})
     # Invalid country looks like national prefix is present (no way to tell)
     number2 = PhoneNumber(
         country_code=99,
         national_number=12345678L,
         country_code_source=CountryCodeSource.FROM_DEFAULT_COUNTRY)
     self.assertTrue(_is_national_prefix_present_if_required(number2))
     # National prefix rule has no lead digits
     number3 = PhoneNumber(
         country_code=61,
         national_number=1234567890L,
         country_code_source=CountryCodeSource.FROM_DEFAULT_COUNTRY)
     self.assertTrue(_is_national_prefix_present_if_required(number3))
     # Coverage for _get_national_number_groups() with a formatting pattern provided
     us_number = PhoneNumber(country_code=1, national_number=6502530000L)
     num_format = NumberFormat(pattern="(\\d{3})(\\d{3})(\\d{4})",
                               format="\\1-\\2-\\3")
     self.assertEqual(["650", "253", "0000"],
                      _get_national_number_groups(us_number, num_format))
示例#4
0
 def testEdgeCases(self):
     # Python version extra tests for coverage
     metadataXX = PhoneMetadata(
         id='XX',
         country_code=384,
         international_prefix='011',
         general_desc=PhoneNumberDesc(national_number_pattern='\\d{10}',
                                      possible_number_pattern='\\d{6,10}'),
         fixed_line=PhoneNumberDesc(national_number_pattern='NA',
                                    possible_number_pattern='NA'),
         mobile=PhoneNumberDesc(national_number_pattern='NA',
                                possible_number_pattern='NA'),
         national_prefix=u'0',
         national_prefix_for_parsing=u'0',
         number_format=[
             NumberFormat(pattern='([135][246]|[246][123])(\\d{4})(\\d{4})',
                          format=u'\\1 \\2 \\3',
                          leading_digits_pattern=['[1-59]|[78]0'],
                          national_prefix_formatting_rule=u'(0\\1)')
         ])
     PhoneMetadata.region_metadata['XX'] = metadataXX
     phonenumberutil.SUPPORTED_REGIONS.add("XX")
     phonenumberutil.COUNTRY_CODE_TO_REGION_CODE[384] = ("XX", )
     formatter = AsYouTypeFormatter('XX')
     # A pattern with "|" in it doesn't get formatting
     self.assertEquals('1', formatter.input_digit('1'))
     self.assertEquals('12', formatter.input_digit('2'))
     self.assertEquals('123', formatter.input_digit('3'))
     self.assertEquals('1234', formatter.input_digit('4'))
     del phonenumberutil.COUNTRY_CODE_TO_REGION_CODE[384]
     phonenumberutil.SUPPORTED_REGIONS.remove('XX')
     del PhoneMetadata.region_metadata['XX']
     # Hit internal error arm
     formatter._national_number = ""
     self.assertEquals("", formatter._input_accrued_national_number())
def phone_number_format(number, region_code=None):
    if type(number) is str:
        if region_code is None:
            return number
        try:
            new_number = phonenumbers.parse(number, region_code)
        except:
            return number

    elif type(number) is PhoneNumber:
        try:
            region_code = number.region_code
            new_number = phonenumbers.parse(number.phone_number,
                                            number.region_code)
        except:
            return number

    if hasattr(settings, 'PHONE_NUMBERS_FORMATS_BY_REGION'):
        region_pattern = settings.PHONE_NUMBERS_FORMATS_BY_REGION.get(
            region_code, None)
        if region_pattern is None:
            return phonenumbers.format_number(
                new_number, phonenumbers.PhoneNumberFormat.NATIONAL)
        else:
            try:
                new_number_format = NumberFormat(
                    pattern=region_pattern.get('pattern'),
                    format=region_pattern.get('format'))
                new_number_format._mutable = True
                new_number_format.national_prefix_formatting_rule = region_pattern.get(
                    'prefix_format') % (new_number.country_code, '$FG')

                new_number_formats = [new_number_format]
                return phonenumbers.format_by_pattern(
                    new_number, phonenumbers.PhoneNumberFormat.NATIONAL,
                    new_number_formats)
            except:
                return phonenumbers.format_number(
                    new_number, phonenumbers.PhoneNumberFormat.NATIONAL)
    return phonenumbers.format_number(new_number,
                                      phonenumbers.PhoneNumberFormat.NATIONAL)
def phone_number_format(number, region_code=None):
    if type(number) is str:
        if region_code is None:
            return number
        try:
            new_number = phonenumbers.parse(number, region_code)
        except:
            return number

    elif type(number) is PhoneNumber:
        try:
            region_code = number.region_code
            new_number = phonenumbers.parse(number.phone_number, number.region_code)
        except:
            return number

    if hasattr(settings, 'PHONE_NUMBERS_FORMATS_BY_REGION'):
        region_pattern = settings.PHONE_NUMBERS_FORMATS_BY_REGION.get(region_code, None)
        if region_pattern is None:
            return phonenumbers.format_number(new_number, phonenumbers.PhoneNumberFormat.NATIONAL)
        else:
            try:
                new_number_format = NumberFormat(
                    pattern=region_pattern.get('pattern'),
                    format=region_pattern.get('format')
                )
                new_number_format._mutable = True
                new_number_format.national_prefix_formatting_rule = region_pattern.get('prefix_format') % (
                    new_number.country_code, '$FG'
                )

                new_number_formats = [new_number_format]
                return phonenumbers.format_by_pattern(
                    new_number,
                    phonenumbers.PhoneNumberFormat.NATIONAL,
                    new_number_formats
                )
            except:
                return phonenumbers.format_number(new_number, phonenumbers.PhoneNumberFormat.NATIONAL)
    return phonenumbers.format_number(new_number, phonenumbers.PhoneNumberFormat.NATIONAL)
示例#7
0
    general_desc=PhoneNumberDesc(national_number_pattern='[1-9]\\d{8}',
                                 possible_number_pattern='\\d{9}'),
    fixed_line=PhoneNumberDesc(national_number_pattern='[1-9]\\d{8}',
                               possible_number_pattern='\\d{9}'),
    mobile=PhoneNumberDesc(
        national_number_pattern='(?:5[01]|6[069]|7[289]|88)\\d{7}',
        possible_number_pattern='\\d{9}'),
    toll_free=PhoneNumberDesc(national_number_pattern='800\\d{6}',
                              possible_number_pattern='\\d{9}'),
    premium_rate=PhoneNumberDesc(national_number_pattern='70\\d{7}',
                                 possible_number_pattern='\\d{9}'),
    shared_cost=PhoneNumberDesc(national_number_pattern='NA',
                                possible_number_pattern='NA'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA',
                                    possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='NA',
                         possible_number_pattern='NA'),
    pager=PhoneNumberDesc(national_number_pattern='NA',
                          possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA',
                        possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                              possible_number_pattern='NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[
        NumberFormat(pattern='(\\d{2})(\\d{3})(\\d{2})(\\d{2})',
                     format=u'\\1 \\2 \\3 \\4',
                     national_prefix_formatting_rule=u'0\\1')
    ])
示例#8
0
"""Auto-generated file, do not edit by hand. GT metadata"""
from phonenumbers import NumberFormat, PhoneNumberDesc, PhoneMetadata

PHONE_METADATA_GT = PhoneMetadata(id='GT', country_code=502, international_prefix='00',
    general_desc=PhoneNumberDesc(national_number_pattern='[2-7]\\d{7}|1[89]\\d{9}', possible_number_pattern='\\d{8}(?:\\d{3})?'),
    fixed_line=PhoneNumberDesc(national_number_pattern='[267][2-9]\\d{6}', possible_number_pattern='\\d{8}', example_number='22456789'),
    mobile=PhoneNumberDesc(national_number_pattern='[345]\\d{7}', possible_number_pattern='\\d{8}', example_number='51234567'),
    toll_free=PhoneNumberDesc(national_number_pattern='18[01]\\d{8}', possible_number_pattern='\\d{11}', example_number='18001112222'),
    premium_rate=PhoneNumberDesc(national_number_pattern='19\\d{9}', possible_number_pattern='\\d{11}', example_number='19001112222'),
    shared_cost=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    pager=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    number_format=[NumberFormat(pattern='(\\d{4})(\\d{4})', format=u'\\1 \\2', leading_digits_pattern=['[2-7]']),
        NumberFormat(pattern='(\\d{4})(\\d{3})(\\d{4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['1'])])
示例#9
0
    shared_cost=PhoneNumberDesc(national_number_pattern='8(?:40|6[01])\\d{6}',
                                possible_number_pattern='\\d{9}',
                                example_number='840123456'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA',
                                    possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='41\\d{7}',
                         possible_number_pattern='\\d{9}',
                         example_number='412345678'),
    pager=PhoneNumberDesc(national_number_pattern='NA',
                          possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA',
                        possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                              possible_number_pattern='NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[
        NumberFormat(pattern='([24]\\d)(\\d{3})(\\d{4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['[24]'],
                     national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='([67]\\d{2})(\\d{3})(\\d{3})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['[67]'],
                     national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='([89]\\d{2})(\\d{2})(\\d{4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['[89]'],
                     national_prefix_formatting_rule=u'0\\1')
    ])
示例#10
0
"""Auto-generated file, do not edit by hand. FM metadata"""
from phonenumbers import NumberFormat, PhoneNumberDesc, PhoneMetadata

PHONE_METADATA_FM = PhoneMetadata(id='FM', country_code=691, international_prefix='00',
    general_desc=PhoneNumberDesc(national_number_pattern='[39]\\d{6}', possible_number_pattern='\\d{7}'),
    fixed_line=PhoneNumberDesc(national_number_pattern='3[2357]0[1-9]\\d{3}|9[2-6]\\d{5}', possible_number_pattern='\\d{7}', example_number='3201234'),
    mobile=PhoneNumberDesc(national_number_pattern='3[2357]0[1-9]\\d{3}|9[2-7]\\d{5}', possible_number_pattern='\\d{7}', example_number='3501234'),
    toll_free=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    premium_rate=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    shared_cost=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    pager=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    number_format=[NumberFormat(pattern='(\\d{3})(\\d{4})', format=u'\\1 \\2')])
示例#11
0
"""Auto-generated file, do not edit by hand. PS metadata"""
from phonenumbers import NumberFormat, PhoneNumberDesc, PhoneMetadata

PHONE_METADATA_PS = PhoneMetadata(id='PS', country_code=970, international_prefix='00',
    general_desc=PhoneNumberDesc(national_number_pattern='[24589]\\d{7,8}|1(?:[78]\\d{8}|[49]\\d{2,3})', possible_number_pattern='\\d{4,10}'),
    fixed_line=PhoneNumberDesc(national_number_pattern='(?:22[234789]|42[45]|82[01458]|92[369])\\d{5}', possible_number_pattern='\\d{7,8}', example_number='22234567'),
    mobile=PhoneNumberDesc(national_number_pattern='5[69]\\d{7}', possible_number_pattern='\\d{9}', example_number='599123456'),
    toll_free=PhoneNumberDesc(national_number_pattern='1800\\d{6}', possible_number_pattern='\\d{10}', example_number='1800123456'),
    premium_rate=PhoneNumberDesc(national_number_pattern='1(?:4|9\\d)\\d{2}', possible_number_pattern='\\d{4,5}', example_number='19123'),
    shared_cost=PhoneNumberDesc(national_number_pattern='1700\\d{6}', possible_number_pattern='\\d{10}', example_number='1700123456'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    pager=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA', possible_number_pattern='NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[NumberFormat(pattern='([2489])(2\\d{2})(\\d{4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['[2489]'], national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='(5[69]\\d)(\\d{3})(\\d{3})', format=u'\\1 \\2 \\3', leading_digits_pattern=['5'], national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='(1[78]00)(\\d{3})(\\d{3})', format=u'\\1 \\2 \\3', leading_digits_pattern=['1[78]'], national_prefix_formatting_rule=u'\\1')])
示例#12
0
"""Auto-generated file, do not edit by hand. MX metadata"""
from phonenumbers import NumberFormat, PhoneNumberDesc, PhoneMetadata

PHONE_METADATA_MX = PhoneMetadata(id='MX', country_code=52, international_prefix='0[09]',
    general_desc=PhoneNumberDesc(national_number_pattern=u'[1-9]\d{9,10}', possible_number_pattern=u'\d{7,11}'),
    fixed_line=PhoneNumberDesc(national_number_pattern=u'(?:33|55|81)\d{8}|(?:2(?:2[2-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-58]|9[467])|3(?:1[1-79]|[2458][1-9]|7[1-8]|9[1-5])|4(?:1[1-57-9]|[24-6][1-9]|[37][1-8]|8[1-35-9]|9[2-689])|5(?:88|9[1-79])|6(?:1[2-68]|[234][1-9]|5[1-3689]|6[12457-9]|7[1-7]|8[67]|9[4-8])|7(?:[13467][1-9]|2[1-8]|5[13-9]|8[1-69]|9[17])|8(?:2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|[69][1-9]|7[12]|8[1-8]))\d{7}', possible_number_pattern=u'\d{7,10}', example_number=u'2221234567'),
    mobile=PhoneNumberDesc(national_number_pattern=u'1(?:(?:33|55|81)\d{8}|(?:2(?:2[2-9]|3[1-35-8]|4[13-9]|7[1-689]|8[1-58]|9[467])|3(?:1[1-79]|[2458][1-9]|7[1-8]|9[1-5])|4(?:1[1-57-9]|[24-6][1-9]|[37][1-8]|8[1-35-9]|9[2-689])|5(?:88|9[1-79])|6(?:1[2-68]|[2-4][1-9]|5[1-3689]|6[12457-9]|7[1-7]|8[67]|9[4-8])|7(?:[13467][1-9]|2[1-8]|5[13-9]|8[1-69]|9[17])|8(?:2[13-689]|3[1-6]|4[124-6]|6[1246-9]|7[1-378]|9[12479])|9(?:1[346-9]|2[1-4]|3[2-46-8]|5[1348]|[69][1-9]|7[12]|8[1-8]))\d{7})', possible_number_pattern=u'\d{11}', example_number=u'12221234567'),
    toll_free=PhoneNumberDesc(national_number_pattern=u'800\d{7}', possible_number_pattern=u'\d{10}', example_number=u'8001234567'),
    premium_rate=PhoneNumberDesc(national_number_pattern=u'900\d{7}', possible_number_pattern=u'\d{10}', example_number=u'9001234567'),
    shared_cost=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    personal_number=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    voip=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    national_prefix=u'01',
    national_prefix_for_parsing=u'0[12]|04[45](\d{10})',
    national_prefix_transform_rule=u'1\\1',
    number_format=[NumberFormat(pattern='([358]\d)(\d{4})(\d{4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['33|55|81'], national_prefix_formatting_rule=u'01 \\1'),
        NumberFormat(pattern='(\d{3})(\d{3})(\d{4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['[2467]|3[12457-9]|5[89]|8[02-9]|9[0-35-9]'], national_prefix_formatting_rule=u'01 \\1'),
        NumberFormat(pattern='1([358]\d)(\d{4})(\d{4})', format=u'045 \\1 \\2 \\3', leading_digits_pattern=['1(?:33|55|81)'], national_prefix_formatting_rule=u'\\1'),
        NumberFormat(pattern='1(\d{3})(\d{3})(\d{4})', format=u'045 \\1 \\2 \\3', leading_digits_pattern=['1(?:[2467]|3[12457-9]|5[89]|8[2-9]|9[1-35-9])'], national_prefix_formatting_rule=u'\\1')],
    intl_number_format=[NumberFormat(pattern='([358]\d)(\d{4})(\d{4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['33|55|81'], national_prefix_formatting_rule=u'01 \\1'),
        NumberFormat(pattern='(\d{3})(\d{3})(\d{4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['[2467]|3[12457-9]|5[89]|8[02-9]|9[0-35-9]'], national_prefix_formatting_rule=u'01 \\1'),
        NumberFormat(pattern='(1)([358]\d)(\d{4})(\d{4})', format=u'\\1 \\2 \\3 \\4', leading_digits_pattern=['1(?:33|55|81)'], national_prefix_formatting_rule=u'01 \\1'),
        NumberFormat(pattern='(1)(\d{3})(\d{3})(\d{4})', format=u'\\1 \\2 \\3 \\4', leading_digits_pattern=['1(?:[2467]|3[12457-9]|5[89]|8[2-9]|9[1-35-9])'], national_prefix_formatting_rule=u'01 \\1')])
示例#13
0
                                 possible_number_pattern=u'\d{8}'),
    fixed_line=PhoneNumberDesc(national_number_pattern=u'2[2-6]\d{6}',
                               possible_number_pattern=u'\d{8}',
                               example_number=u'22345678'),
    mobile=PhoneNumberDesc(
        national_number_pattern=u'7777\d{4}|9(?:[69]\d|7[67])\d{5}',
        possible_number_pattern=u'\d{8}',
        example_number=u'96123456'),
    toll_free=PhoneNumberDesc(national_number_pattern=u'8000\d{4}',
                              possible_number_pattern=u'\d{8}',
                              example_number=u'80001234'),
    premium_rate=PhoneNumberDesc(national_number_pattern=u'9009\d{4}',
                                 possible_number_pattern=u'\d{8}',
                                 example_number=u'90091234'),
    shared_cost=PhoneNumberDesc(national_number_pattern=u'NA',
                                possible_number_pattern=u'NA'),
    personal_number=PhoneNumberDesc(national_number_pattern=u'700\d{5}',
                                    possible_number_pattern=u'\d{8}',
                                    example_number=u'70012345'),
    voip=PhoneNumberDesc(national_number_pattern=u'NA',
                         possible_number_pattern=u'NA'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA',
                          possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA',
                        possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA',
                                              possible_number_pattern=u'NA'),
    number_format=[
        NumberFormat(pattern='([27-9]\d)(\d{6})', format=u'\\1 \\2')
    ])
示例#14
0
"""Auto-generated file, do not edit by hand. AO metadata"""
from phonenumbers import NumberFormat, PhoneNumberDesc, PhoneMetadata

PHONE_METADATA_AO = PhoneMetadata(id='AO', country_code=244, international_prefix='00',
    general_desc=PhoneNumberDesc(national_number_pattern=u'[29]\d{8}', possible_number_pattern=u'\d{9}'),
    fixed_line=PhoneNumberDesc(national_number_pattern=u'2\d(?:[26-9]\d|\d[26-9])\d{5}', possible_number_pattern=u'\d{9}', example_number=u'222123456'),
    mobile=PhoneNumberDesc(national_number_pattern=u'9[1-3]\d{7}', possible_number_pattern=u'\d{9}', example_number=u'923123456'),
    toll_free=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    premium_rate=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    shared_cost=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    personal_number=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    voip=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    national_prefix=u'0~0',
    national_prefix_for_parsing=u'0~0',
    number_format=[NumberFormat(pattern='(\d{3})(\d{3})(\d{3})', format=u'\\1 \\2 \\3')])
示例#15
0
                                 example_number='700123456'),
 voip=PhoneNumberDesc(national_number_pattern='76\\d{7}',
                      possible_number_pattern='\\d{9}',
                      example_number='761234567'),
 pager=PhoneNumberDesc(national_number_pattern='NA',
                       possible_number_pattern='NA'),
 uan=PhoneNumberDesc(national_number_pattern='818\\d{6}',
                     possible_number_pattern='\\d{9}',
                     example_number='818123456'),
 no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                           possible_number_pattern='NA'),
 national_prefix=u'0',
 national_prefix_for_parsing=u'0',
 number_format=[
     NumberFormat(pattern='(1)(\\d{3,4})(\\d{4})',
                  format=u'\\1 \\2 \\3',
                  leading_digits_pattern=['1'],
                  national_prefix_formatting_rule=u'(0\\1)'),
     NumberFormat(
         pattern='(\\d{2})(\\d{5})',
         format=u'\\1 \\2',
         leading_digits_pattern=['2[2-9]|4[347]|5[2-58]|6[2-47-9]|9[3-9]'],
         national_prefix_formatting_rule=u'(0\\1)'),
     NumberFormat(pattern='(\\d{3})(\\d{5})',
                  format=u'\\1 \\2',
                  leading_digits_pattern=['40[24]|50[45]'],
                  national_prefix_formatting_rule=u'(0\\1)'),
     NumberFormat(pattern='(48)(\\d{4})(\\d{4})',
                  format=u'\\1 \\2 \\3',
                  leading_digits_pattern=['48'],
                  national_prefix_formatting_rule=u'(0\\1)'),
     NumberFormat(pattern='(818)(\\d{3})(\\d{3})',
示例#16
0
                                 possible_number_pattern=u'\d{9}',
                                 example_number=u'601234567'),
 voip=PhoneNumberDesc(national_number_pattern=u'50\d{8}',
                      possible_number_pattern=u'\d{10}',
                      example_number=u'5012345678'),
 pager=PhoneNumberDesc(national_number_pattern=u'NA',
                       possible_number_pattern=u'NA'),
 uan=PhoneNumberDesc(national_number_pattern=u'NA',
                     possible_number_pattern=u'NA'),
 no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA',
                                           possible_number_pattern=u'NA'),
 national_prefix=u'0',
 national_prefix_for_parsing=u'0',
 number_format=[
     NumberFormat(pattern='(\d{3})(\d{3})(\d{3})',
                  format=u'\\1-\\2-\\3',
                  leading_digits_pattern=['(?:12|99)0'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(pattern='(\d{2})(\d{4})(\d{4})',
                  format=u'\\1-\\2-\\3',
                  leading_digits_pattern=['[57-9]0'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
         pattern='(\d{4})(\d)(\d{4})',
         format=u'\\1-\\2-\\3',
         leading_digits_pattern=[
             '1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|5(?:76|97)|499|746|8(?:3[89]|63|47|51)|9(?:49|80|9[16])',
             '1(?:267|3(?:7[247]|9[278])|4(?:5[67]|66)|5(?:47|58|64|8[67])|6(?:3[245]|48|5[4-68]))|5(?:76|97)9|499[2468]|7468|8(?:3(?:8[78]|96)|636|477|51[24])|9(?:496|802|9(?:1[23]|69))',
             '1(?:267|3(?:7[247]|9[278])|4(?:5[67]|66)|5(?:47|58|64|8[67])|6(?:3[245]|48|5[4-68]))|5(?:769|979[2-69])|499[2468]|7468|8(?:3(?:8[78]|96[2457-9])|636[2-57-9]|477|51[24])|9(?:496|802|9(?:1[23]|69))'
         ],
         national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
示例#17
0
        national_number_pattern=
        '(?:5(?:0[0-25]|5\\d)|6(?:0[034679]|5[015-9]|6\\d|7[067]|99)|9(?:0[09]|4[049]|66|[79]\\d))\\d{5}',
        possible_number_pattern='\\d{8}',
        example_number='50012345'),
    toll_free=PhoneNumberDesc(national_number_pattern='NA',
                              possible_number_pattern='NA'),
    premium_rate=PhoneNumberDesc(national_number_pattern='NA',
                                 possible_number_pattern='NA'),
    shared_cost=PhoneNumberDesc(national_number_pattern='NA',
                                possible_number_pattern='NA'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA',
                                    possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='NA',
                         possible_number_pattern='NA'),
    pager=PhoneNumberDesc(national_number_pattern='NA',
                          possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA',
                        possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                              possible_number_pattern='NA'),
    number_format=[
        NumberFormat(pattern='(\\d{4})(\\d{3,4})',
                     format=u'\\1 \\2',
                     leading_digits_pattern=['[1269]'],
                     national_prefix_formatting_rule=u'\\1'),
        NumberFormat(pattern='(5[05]\\d)(\\d{5})',
                     format=u'\\1 \\2',
                     leading_digits_pattern=['5'],
                     national_prefix_formatting_rule=u'\\1')
    ])
示例#18
0
                           possible_number_pattern='\\d{9}',
                           example_number='712345678'),
    toll_free=PhoneNumberDesc(national_number_pattern='NA',
                              possible_number_pattern='NA'),
    premium_rate=PhoneNumberDesc(national_number_pattern='NA',
                                 possible_number_pattern='NA'),
    shared_cost=PhoneNumberDesc(national_number_pattern='NA',
                                possible_number_pattern='NA'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA',
                                    possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='NA',
                         possible_number_pattern='NA'),
    pager=PhoneNumberDesc(national_number_pattern='NA',
                          possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA',
                        possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                              possible_number_pattern='NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[
        NumberFormat(pattern='([1-7])(\\d{3})(\\d{3,4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['[1-6]|7[24-68]'],
                     national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='(7[137]\\d)(\\d{3})(\\d{3})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['7[137]'],
                     national_prefix_formatting_rule=u'0\\1')
    ])
示例#19
0
                                 possible_number_pattern=u'NA'),
 voip=PhoneNumberDesc(national_number_pattern=u'(?:59|8[1-3])\d{6}',
                      possible_number_pattern=u'\d{8}',
                      example_number=u'59012345'),
 pager=PhoneNumberDesc(national_number_pattern=u'NA',
                       possible_number_pattern=u'NA'),
 uan=PhoneNumberDesc(national_number_pattern=u'NA',
                     possible_number_pattern=u'NA'),
 no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA',
                                           possible_number_pattern=u'NA'),
 national_prefix=u'0',
 national_prefix_for_parsing=u'0',
 number_format=[
     NumberFormat(
         pattern='(\d)(\d{3})(\d{2})(\d{2})',
         format=u'\\1 \\2 \\3 \\4',
         leading_digits_pattern=['[12]|3[4-8]|4[24-8]|5[3-8]|7[3-8]'],
         national_prefix_formatting_rule=u'(0\\1)'),
     NumberFormat(pattern='([3-7]\d)(\d{3})(\d{3})',
                  format=u'\\1 \\2 \\3',
                  leading_digits_pattern=['[37][01]|4[019]|51|64'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(pattern='([89][09])(\d{3,6})',
                  format=u'\\1 \\2',
                  leading_digits_pattern=['[89][09]'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(pattern='([58]\d{2})(\d{5})',
                  format=u'\\1 \\2',
                  leading_digits_pattern=['59|8[1-3]'],
                  national_prefix_formatting_rule=u'0\\1')
 ])
示例#20
0
    fixed_line=PhoneNumberDesc(
        national_number_pattern=u'(?:[234]\d|50|8[1-5])\d{3}',
        possible_number_pattern=u'\d{5}',
        example_number=u'31234'),
    mobile=PhoneNumberDesc(national_number_pattern=u'[69]\d{4}',
                           possible_number_pattern=u'\d{5}',
                           example_number=u'61234'),
    toll_free=PhoneNumberDesc(national_number_pattern=u'NA',
                              possible_number_pattern=u'NA'),
    premium_rate=PhoneNumberDesc(national_number_pattern=u'NA',
                                 possible_number_pattern=u'NA'),
    shared_cost=PhoneNumberDesc(national_number_pattern=u'NA',
                                possible_number_pattern=u'NA'),
    personal_number=PhoneNumberDesc(national_number_pattern=u'NA',
                                    possible_number_pattern=u'NA'),
    voip=PhoneNumberDesc(national_number_pattern=u'NA',
                         possible_number_pattern=u'NA'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA',
                          possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA',
                        possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA',
                                              possible_number_pattern=u'NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[
        NumberFormat(pattern='(\d{5})',
                     format=u'\\1',
                     national_prefix_formatting_rule=u'0\\1')
    ])
示例#21
0
"""Auto-generated file, do not edit by hand. SY metadata"""
from phonenumbers import NumberFormat, PhoneNumberDesc, PhoneMetadata

PHONE_METADATA_SY = PhoneMetadata(id='SY', country_code=963, international_prefix='00',
    general_desc=PhoneNumberDesc(national_number_pattern=u'[1-59]\d{7,8}', possible_number_pattern=u'\d{6,9}'),
    fixed_line=PhoneNumberDesc(national_number_pattern=u'(?:1(?:1\d?|4\d|[2356])|2[1-35]|3(?:1\d|[34])|4[13]|5[1-3])\d{6}', possible_number_pattern=u'\d{6,9}', example_number=u'112345678'),
    mobile=PhoneNumberDesc(national_number_pattern=u'9(?:3[23]|4[457]|55|6[67]|88|9[19])\d{6}', possible_number_pattern=u'\d{9}', example_number=u'944567890'),
    toll_free=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    premium_rate=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    shared_cost=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    personal_number=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    voip=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[NumberFormat(pattern='(\d{2})(\d{3})(\d{3,4})', format=u'\\1 \\2 \\3', leading_digits_pattern=['[1-5]'], national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='(9[3-689])(\d{4})(\d{3})', format=u'\\1 \\2 \\3', leading_digits_pattern=['9'], national_prefix_formatting_rule=u'0\\1')])
示例#22
0
    country_code=253,
    international_prefix='00',
    general_desc=PhoneNumberDesc(national_number_pattern=u'[1-8]\d{5}',
                                 possible_number_pattern=u'\d{6}'),
    fixed_line=PhoneNumberDesc(
        national_number_pattern=u'(?:1[05]|[2-5]\d)\d{4}',
        possible_number_pattern=u'\d{6}',
        example_number=u'251234'),
    mobile=PhoneNumberDesc(national_number_pattern=u'[6-8]\d{5}',
                           possible_number_pattern=u'\d{6}',
                           example_number=u'601234'),
    toll_free=PhoneNumberDesc(national_number_pattern=u'NA',
                              possible_number_pattern=u'NA'),
    premium_rate=PhoneNumberDesc(national_number_pattern=u'NA',
                                 possible_number_pattern=u'NA'),
    shared_cost=PhoneNumberDesc(national_number_pattern=u'NA',
                                possible_number_pattern=u'NA'),
    personal_number=PhoneNumberDesc(national_number_pattern=u'NA',
                                    possible_number_pattern=u'NA'),
    voip=PhoneNumberDesc(national_number_pattern=u'NA',
                         possible_number_pattern=u'NA'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA',
                          possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA',
                        possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA',
                                              possible_number_pattern=u'NA'),
    number_format=[
        NumberFormat(pattern='(\d{2})(\d{2})(\d{2})', format=u'\\1 \\2 \\3')
    ])
示例#23
0
 personal_number=PhoneNumberDesc(national_number_pattern='NA',
                                 possible_number_pattern='NA'),
 voip=PhoneNumberDesc(national_number_pattern='780\\d{6,10}',
                      possible_number_pattern='\\d{9,13}',
                      example_number='780123456'),
 pager=PhoneNumberDesc(national_number_pattern='NA',
                       possible_number_pattern='NA'),
 uan=PhoneNumberDesc(national_number_pattern='NA',
                     possible_number_pattern='NA'),
 no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                           possible_number_pattern='NA'),
 national_prefix=u'0',
 national_prefix_for_parsing=u'0',
 number_format=[
     NumberFormat(pattern='([15])(\\d{3,12})',
                  format=u'\\1 \\2',
                  leading_digits_pattern=['1|5[079]'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
         pattern='(\\d{3})(\\d{3,10})',
         format=u'\\1 \\2',
         leading_digits_pattern=[
             '316|46|51|732|6(?:44|5[0-3579]|[6-9])|7(?:1|[28]0)|[89]'
         ],
         national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
         pattern='(\\d{4})(\\d{3,9})',
         format=u'\\1 \\2',
         leading_digits_pattern=[
             '2|3(?:1[1-578]|[3-8])|4[2378]|5[2-6]|6(?:[12]|4[1-35-9]|5[468])|7(?:2[1-8]|35|4[1-8]|[57-9])'
         ],
         national_prefix_formatting_rule=u'0\\1')
示例#24
0
                                example_number='700012345'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA',
                                    possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='NA',
                         possible_number_pattern='NA'),
    pager=PhoneNumberDesc(national_number_pattern='NA',
                          possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA',
                        possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                              possible_number_pattern='NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[
        NumberFormat(pattern='([2-4679])(\\d{3})(\\d{4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['[2-4679][2-8]'],
                     national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='(5[056])(\\d{3})(\\d{4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['5'],
                     national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='([4679]00)(\\d)(\\d{5})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['[4679]0'],
                     national_prefix_formatting_rule=u'\\1'),
        NumberFormat(pattern='(800)(\\d{2,9})',
                     format=u'\\1 \\2',
                     leading_digits_pattern=['8'],
                     national_prefix_formatting_rule=u'\\1')
    ])
示例#25
0
                                 possible_number_pattern=u'NA'),
 voip=PhoneNumberDesc(national_number_pattern=u'NA',
                      possible_number_pattern=u'NA'),
 pager=PhoneNumberDesc(national_number_pattern=u'NA',
                       possible_number_pattern=u'NA'),
 uan=PhoneNumberDesc(national_number_pattern=u'NA',
                     possible_number_pattern=u'NA'),
 no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA',
                                           possible_number_pattern=u'NA'),
 national_prefix=u'0',
 national_prefix_for_parsing=u'0',
 number_format=[
     NumberFormat(
         pattern='([3-69]\d)(\d{3})(\d{4})',
         format=u'\\1 \\2 \\3',
         leading_digits_pattern=[
             '39|4(?:[45][0-5]|87)|5(?:0|6[37]|7[37])|6[36-8]|9[1-9]',
             '39|4(?:[45][0-5]|87)|5(?:0|6(?:3[14-7]|7)|7[37])|6[36-8]|9[1-9]'
         ],
         national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
         pattern='([3-689]\d{2})(\d{3})(\d{3})',
         format=u'\\1 \\2 \\3',
         leading_digits_pattern=[
             '3[1-8]2|4[1378]2|5(?:[12457]2|6[24])|6(?:[49]2|[12][29]|5[24])|8|90',
             '3(?:[1-46-8]2[013-9]|52)|4[1378]2|5(?:[12457]2|6[24])|6(?:[49]2|[12][29]|5[24])|8|90'
         ],
         national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
         pattern='([3-6]\d{3})(\d{5})',
         format=u'\\1 \\2',
         leading_digits_pattern=[
示例#26
0
 voip=PhoneNumberDesc(national_number_pattern='70\\d{8}',
                      possible_number_pattern='\\d{10}',
                      example_number='7012345678'),
 pager=PhoneNumberDesc(national_number_pattern='NA',
                       possible_number_pattern='NA'),
 uan=PhoneNumberDesc(national_number_pattern='NA',
                     possible_number_pattern='NA'),
 no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                           possible_number_pattern='NA'),
 national_prefix=u'0',
 national_prefix_for_parsing=u'0(8[1-46-8]|85\d{2})?',
 number_format=[
     NumberFormat(pattern='(\\d{2})(\\d{4})(\\d{4})',
                  format=u'\\1-\\2-\\3',
                  leading_digits_pattern=[
                      '1(?:0|1[19]|[69]9|5[458])|[57]0',
                      '1(?:0|1[19]|[69]9|5(?:44|59|8))|[57]0'
                  ],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
         pattern='(\\d{2})(\\d{3})(\\d{4})',
         format=u'\\1-\\2-\\3',
         leading_digits_pattern=[
             '1(?:[169][2-8]|[78]|5[1-4])|[68]0|[3-9][1-9][2-9]',
             '1(?:[169][2-8]|[78]|5(?:[1-3]|4[56]))|[68]0|[3-9][1-9][2-9]'
         ],
         national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(pattern='(\\d{3})(\\d)(\\d{4})',
                  format=u'\\1-\\2-\\3',
                  leading_digits_pattern=['131', '1312'],
                  national_prefix_formatting_rule=u'0\\1'),
示例#27
0
 personal_number=PhoneNumberDesc(national_number_pattern='NA',
                                 possible_number_pattern='NA'),
 voip=PhoneNumberDesc(national_number_pattern='7[569]\\d{6}',
                      possible_number_pattern='\\d{8}',
                      example_number='75123456'),
 pager=PhoneNumberDesc(national_number_pattern='NA',
                       possible_number_pattern='NA'),
 uan=PhoneNumberDesc(national_number_pattern='NA',
                     possible_number_pattern='NA'),
 no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                           possible_number_pattern='NA'),
 national_prefix=u'0',
 national_prefix_for_parsing=u'0',
 number_format=[
     NumberFormat(pattern='([12]\\d)(\\d{2})(\\d{4})',
                  format=u'\\1 \\2 \\3',
                  leading_digits_pattern=['[12]1'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(pattern='([12]2\\d)(\\d{5,6})',
                  format=u'\\1 \\2',
                  leading_digits_pattern=['[12]2[1-3]'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(pattern='([12]\\d{3})(\\d{5})',
                  format=u'\\1 \\2',
                  leading_digits_pattern=[
                      '[12](?:27|[3-5])', '[12](?:27|[3-5]\\d)2'
                  ],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(pattern='(\\d{4})(\\d{4})',
                  format=u'\\1 \\2',
                  leading_digits_pattern=['[57-9]'],
                  national_prefix_formatting_rule=u'\\1'),
示例#28
0
                                 possible_number_pattern='NA'),
 voip=PhoneNumberDesc(national_number_pattern='NA',
                      possible_number_pattern='NA'),
 pager=PhoneNumberDesc(national_number_pattern='NA',
                       possible_number_pattern='NA'),
 uan=PhoneNumberDesc(national_number_pattern='NA',
                     possible_number_pattern='NA'),
 no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                           possible_number_pattern='NA'),
 national_prefix=u'0',
 national_prefix_for_parsing=
 u'0(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1-367])|3(?:[06]2|1[467]|2[02-6]|3[13-8]|[49][2-6]|5[2-8]|7)|47[3-578]|6(?:1|2[2-7]|4[6-8]?|5[125-8])|9(?:0[1-3]|[19]|2\d|3[1-6]|4[0-24-68]|5[2-4]|6[2-6]|72?|8[23]?))|3(?:3(?:2[79]|8[2578])|4(?:0[124-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6\d|7[126]|8[237-9]|9[1-36-8])|5(?:1|2[1245]|3[2-4]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|7(?:1[15-8]|2[125]|3[1245]|4[13]|5[124-8]|7[2-57]|8[1-36])|8(?:1|2[125-7]|3[23578]|4[13-6]|5[4-8]?|6[1-357-9]|7[5-8]?|8[4-7]?|9[124])))15)?',
 national_prefix_transform_rule=u'9\\1',
 number_format=[
     NumberFormat(pattern='([68]\\d{2})(\\d{3})(\\d{4})',
                  format=u'\\1-\\2-\\3',
                  leading_digits_pattern=['[68]'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(pattern='(9)(11)(\\d{4})(\\d{4})',
                  format=u'\\2 15-\\3-\\4',
                  leading_digits_pattern=['911'],
                  national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
         pattern='(9)(\\d{3})(\\d{3})(\\d{4})',
         format=u'\\2 15-\\3-\\4',
         leading_digits_pattern=[
             '9(?:2[2369]|3[458])',
             '9(?:2(?:2[013]|37|6[14]|9[179])|3(?:4[1235]|5[138]|8[1578]))'
         ],
         national_prefix_formatting_rule=u'0\\1'),
     NumberFormat(
         pattern='(9)(\\d{4})(\\d{2})(\\d{4})',
示例#29
0
        possible_number_pattern=u'\d{8}',
        example_number=u'21123456'),
    mobile=PhoneNumberDesc(national_number_pattern=u'8[24]\d{7}',
                           possible_number_pattern=u'\d{9}',
                           example_number=u'821234567'),
    toll_free=PhoneNumberDesc(national_number_pattern=u'800\d{6}',
                              possible_number_pattern=u'\d{9}',
                              example_number=u'800123456'),
    premium_rate=PhoneNumberDesc(national_number_pattern=u'NA',
                                 possible_number_pattern=u'NA'),
    shared_cost=PhoneNumberDesc(national_number_pattern=u'NA',
                                possible_number_pattern=u'NA'),
    personal_number=PhoneNumberDesc(national_number_pattern=u'NA',
                                    possible_number_pattern=u'NA'),
    voip=PhoneNumberDesc(national_number_pattern=u'NA',
                         possible_number_pattern=u'NA'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA',
                          possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA',
                        possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA',
                                              possible_number_pattern=u'NA'),
    number_format=[
        NumberFormat(pattern='([28]\d)(\d{3})(\d{3,4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['2|8[24]']),
        NumberFormat(pattern='(80\d)(\d{3})(\d{3})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['80'])
    ])
示例#30
0
    personal_number=PhoneNumberDesc(national_number_pattern=u'NA',
                                    possible_number_pattern=u'NA'),
    voip=PhoneNumberDesc(national_number_pattern=u'60\d{7}',
                         possible_number_pattern=u'\d{9}',
                         example_number=u'601234567'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA',
                          possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA',
                        possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA',
                                              possible_number_pattern=u'NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[
        NumberFormat(pattern='(2)(\d{3})(\d{4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['2'],
                     national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='([3-7]\d)(\d{3})(\d{3,4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['[3-7]'],
                     national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='(8)(\d{4})(\d{4})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['8'],
                     national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='(1[89]00)(\d{3})(\d{3})',
                     format=u'\\1 \\2 \\3',
                     leading_digits_pattern=['1'],
                     national_prefix_formatting_rule=u'\\1')
    ])
示例#31
0
"""Auto-generated file, do not edit by hand. KH metadata"""
from phonenumbers import NumberFormat, PhoneNumberDesc, PhoneMetadata

PHONE_METADATA_KH = PhoneMetadata(id='KH', country_code=855, international_prefix='00[178]',
    general_desc=PhoneNumberDesc(national_number_pattern=u'[1-9]\d{7,9}', possible_number_pattern=u'\d{6,10}'),
    fixed_line=PhoneNumberDesc(national_number_pattern=u'(?:2[3-6]|3[2-6]|4[2-4]|[5-7][2-5])[2-47-9]\d{5}', possible_number_pattern=u'\d{6,8}', example_number=u'23456789'),
    mobile=PhoneNumberDesc(national_number_pattern=u'(?:(?:1[0-35-9]|9[1-49])[1-9]|8(?:0[89]|5[2-689]))\d{5}', possible_number_pattern=u'\d{8}', example_number=u'91234567'),
    toll_free=PhoneNumberDesc(national_number_pattern=u'1800(?:1\d|2[09])\d{4}', possible_number_pattern=u'\d{10}', example_number=u'1800123456'),
    premium_rate=PhoneNumberDesc(national_number_pattern=u'1900(?:1\d|2[09])\d{4}', possible_number_pattern=u'\d{10}', example_number=u'1900123456'),
    shared_cost=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    personal_number=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    voip=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    pager=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    uan=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern=u'NA', possible_number_pattern=u'NA'),
    national_prefix=u'0',
    national_prefix_for_parsing=u'0',
    number_format=[NumberFormat(pattern='(\d{2})(\d{3})(\d{3})', format=u'\\1 \\2 \\3', leading_digits_pattern=['1\d[1-9]|[2-9]'], national_prefix_formatting_rule=u'0\\1'),
        NumberFormat(pattern='(1[89]00)(\d{3})(\d{3})', format=u'\\1 \\2 \\3', leading_digits_pattern=['1[89]0'])])
示例#32
0
        '(?:2(?:[034789]\\d|1[0-8]|2[0-79])|4(?:[013-8]\\d|2[4-7])|[56]\\d{2}|8(?:14|3[129]))\\d{4}',
        possible_number_pattern='\\d{7}',
        example_number='2012345'),
    mobile=PhoneNumberDesc(
        national_number_pattern=
        '(?:25\\d|4(?:2[12389]|9\\d)|7\\d{2}|87[15-7]|9[1-8]\\d)\\d{4}',
        possible_number_pattern='\\d{7}',
        example_number='2512345'),
    toll_free=PhoneNumberDesc(national_number_pattern='80[012]\\d{4}',
                              possible_number_pattern='\\d{7}',
                              example_number='8001234'),
    premium_rate=PhoneNumberDesc(national_number_pattern='30\\d{5}',
                                 possible_number_pattern='\\d{7}',
                                 example_number='3012345'),
    shared_cost=PhoneNumberDesc(national_number_pattern='NA',
                                possible_number_pattern='NA'),
    personal_number=PhoneNumberDesc(national_number_pattern='NA',
                                    possible_number_pattern='NA'),
    voip=PhoneNumberDesc(national_number_pattern='NA',
                         possible_number_pattern='NA'),
    pager=PhoneNumberDesc(national_number_pattern='NA',
                          possible_number_pattern='NA'),
    uan=PhoneNumberDesc(national_number_pattern='NA',
                        possible_number_pattern='NA'),
    no_international_dialling=PhoneNumberDesc(national_number_pattern='NA',
                                              possible_number_pattern='NA'),
    preferred_international_prefix=u'020',
    number_format=[
        NumberFormat(pattern='([2-9]\\d{2})(\\d{4})', format=u'\\1 \\2')
    ])