Skip to content

Commit fec3863

Browse files
andystdaviddrysdale
authored andcommitted
Remove unused mentions of areaCodeOptional (daviddrysdale#106)
areaCodeOptional is about to get removed from the XML metadata.
1 parent e4ed6a1 commit fec3863

1 file changed

Lines changed: 8 additions & 17 deletions

File tree

tools/python/buildmetadatafromxml.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@
2929
# This code was originally developed from the XML file, and the DTD within it.
3030
# Subsequently, post-processing code was added to match the behaviour of
3131
# BuildMetadataFromXml.java
32-
#
33-
# OPEN QUERIES/ISSUES
34-
# - The XML includes territory/areaCodeOptional? elements, which are
35-
# PhoneNumberDesc instances; these do not appear to be used in the
36-
# libphonenumber Java source code.
3732

3833
# import to allow this code to work with Python2.5
3934
from __future__ import with_statement
@@ -442,8 +437,6 @@ def __init__(self, xterritory, short_data):
442437
# and it will be used to fill out missing fields in many of the other PhoneNumberDesc elements.
443438
self.o.general_desc = XPhoneNumberDesc(xterritory, 'generalDesc', general_desc=True).o
444439

445-
# areaCodeOptional is in the XML but not used in the code.
446-
self.o.area_code_optional = XPhoneNumberDesc(xterritory, 'areaCodeOptional', template=self.o.general_desc).o
447440
self.o.toll_free = XPhoneNumberDesc(xterritory, 'tollFree', template=self.o.general_desc).o
448441
self.o.premium_rate = XPhoneNumberDesc(xterritory, 'premiumRate', template=self.o.general_desc).o
449442
if not short_data:
@@ -460,13 +453,12 @@ def __init__(self, xterritory, short_data):
460453
self.o.no_international_dialling = XPhoneNumberDesc(xterritory, 'noInternationalDialling', template=self.o.general_desc).o
461454

462455
# Skip noInternationalDialling when combining possible length information
463-
sub_descs = (self.o.area_code_optional, self.o.toll_free, self.o.premium_rate,
464-
self.o.fixed_line, self.o.mobile, self.o.pager, self.o.shared_cost,
465-
self.o.personal_number, self.o.voip, self.o.uan, self.o.voicemail)
466-
all_descs = (self.o.area_code_optional, self.o.toll_free, self.o.premium_rate,
467-
self.o.fixed_line, self.o.mobile, self.o.pager, self.o.shared_cost,
468-
self.o.personal_number, self.o.voip, self.o.uan, self.o.voicemail,
469-
self.o.no_international_dialling)
456+
sub_descs = (self.o.toll_free, self.o.premium_rate, self.o.fixed_line, self.o.mobile,
457+
self.o.pager, self.o.shared_cost, self.o.personal_number, self.o.voip,
458+
self.o.uan, self.o.voicemail)
459+
all_descs = (self.o.toll_free, self.o.premium_rate, self.o.fixed_line, self.o.mobile,
460+
self.o.pager, self.o.shared_cost, self.o.personal_number, self.o.voip,
461+
self.o.uan, self.o.voicemail, self.o.no_international_dialling)
470462
else:
471463
self.o.standard_rate = XPhoneNumberDesc(xterritory, 'standardRate', template=self.o.general_desc).o
472464
self.o.short_code = XPhoneNumberDesc(xterritory, 'shortCode', template=self.o.general_desc).o
@@ -475,9 +467,8 @@ def __init__(self, xterritory, short_data):
475467
self.o.emergency = XPhoneNumberDesc(xterritory, 'emergency', template=self.o.general_desc).o
476468
# For short number metadata, copy the lengths from the "short code" section only.
477469
sub_descs = (self.o.short_code,)
478-
all_descs = (self.o.area_code_optional, self.o.toll_free, self.o.premium_rate,
479-
self.o.standard_rate, self.o.short_code, self.o.carrier_specific,
480-
self.o.emergency)
470+
all_descs = (self.o.toll_free, self.o.premium_rate, self.o.standard_rate,
471+
self.o.short_code, self.o.carrier_specific, self.o.emergency)
481472

482473
# Build the possible length information for general_desc based on all the different types of number.
483474
possible_lengths = set()

0 commit comments

Comments
 (0)