Skip to content

Commit a81d5c5

Browse files
committed
Document format_by_pattern() expected param types
The upstream Java code has types for these parameters, which makes it clear what is needed for them. These types are obviously lost in the translation to Python, so add some text to describe what type of objects is expected. Fixes daviddrysdale#163.
1 parent ccce5f1 commit a81d5c5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

python/phonenumbers/phonenumberutil.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ def format_number(numobj, num_format):
993993

994994

995995
def format_by_pattern(numobj, number_format, user_defined_formats):
996-
"""Formats a phone number using client-defined formatting rules."
996+
"""Formats a phone number using client-defined formatting rules.
997997
998998
Note that if the phone number has a country calling code of zero or an
999999
otherwise invalid country calling code, we cannot work out things like
@@ -1003,8 +1003,10 @@ def format_by_pattern(numobj, number_format, user_defined_formats):
10031003
10041004
Arguments:
10051005
numobj -- The phone number to be formatted
1006-
num_format -- The format the phone number should be formatted into
1007-
user_defined_formats -- formatting rules specified by clients
1006+
number_format -- The format the phone number should be formatted into,
1007+
as a PhoneNumberFormat value.
1008+
user_defined_formats -- formatting rules specified by clients, as a list
1009+
of NumberFormat objects.
10081010
10091011
Returns the formatted phone number.
10101012
"""

0 commit comments

Comments
 (0)