forked from daviddrysdale/python-phonenumbers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphonenumbers.asyoutypeformatter.html
More file actions
108 lines (99 loc) · 7.36 KB
/
Copy pathphonenumbers.asyoutypeformatter.html
File metadata and controls
108 lines (99 loc) · 7.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module phonenumbers.asyoutypeformatter</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="phonenumbers.html"><font color="#ffffff">phonenumbers</font></a>.asyoutypeformatter</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="https://github.com/daviddrysdale/python-phonenumbers/blob/dev/python/phonenumbers/asyoutypeformatter.py">phonenumbers/asyoutypeformatter.py</a></font></td></tr></table>
<p><tt>A formatter which formats phone numbers as they are entered.<br>
<br>
An <a href="#AsYouTypeFormatter">AsYouTypeFormatter</a> can be created by invoking<br>
<a href="#AsYouTypeFormatter">AsYouTypeFormatter</a>(region_code). After that digits can be added by invoking<br>
input_digit() on the formatter instance, and the partially formatted phone<br>
number will be returned each time a digit is added. clear() should be invoked<br>
before a new number needs to be formatted.<br>
<br>
See the unit tests for more details on how the formatter is to be used.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="builtins.html#object">builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="phonenumbers.asyoutypeformatter.html#AsYouTypeFormatter">AsYouTypeFormatter</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom> <br>
<font color="#000000" face="helvetica, arial"><a name="AsYouTypeFormatter">class <strong>AsYouTypeFormatter</strong></a>(<a href="builtins.html#object">builtins.object</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
<td colspan=2><tt><a href="#AsYouTypeFormatter">AsYouTypeFormatter</a>(region_code)<br>
<br>
<br> </tt></td></tr>
<tr><td> </td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="AsYouTypeFormatter-__init__"><strong>__init__</strong></a>(self, region_code)</dt><dd><tt>Gets an <a href="#AsYouTypeFormatter">AsYouTypeFormatter</a> for the specific region.<br>
<br>
Arguments:<br>
region_code -- The region where the phone number is being entered<br>
<br>
Return an <a href="#AsYouTypeFormatter">AsYouTypeFormatter</a> <a href="builtins.html#object">object</a>, which could be used to format<br>
phone numbers in the specific region "as you type"</tt></dd></dl>
<dl><dt><a name="AsYouTypeFormatter-clear"><strong>clear</strong></a>(self)</dt><dd><tt>Clears the internal state of the formatter, so it can be reused.</tt></dd></dl>
<dl><dt><a name="AsYouTypeFormatter-get_remembered_position"><strong>get_remembered_position</strong></a>(self)</dt><dd><tt>Returns the current position in the partially formatted phone<br>
number of the character which was previously passed in as the<br>
parameter of <a href="#AsYouTypeFormatter-input_digit">input_digit</a>(remember_position=True).</tt></dd></dl>
<dl><dt><a name="AsYouTypeFormatter-input_digit"><strong>input_digit</strong></a>(self, next_char, remember_position=False)</dt><dd><tt>Formats a phone number on-the-fly as each digit is entered.<br>
<br>
If remember_position is set, remembers the position where next_char is<br>
inserted, so that it can be retrieved later by using<br>
get_remembered_position. The remembered position will be automatically<br>
adjusted if additional formatting characters are later<br>
inserted/removed in front of next_char.<br>
<br>
Arguments:<br>
<br>
next_char -- The most recently entered digit of a phone<br>
number. Formatting characters are allowed, but as soon as they<br>
are encountered this method formats the number as entered and<br>
not "as you type" anymore. Full width digits and Arabic-indic<br>
digits are allowed, and will be shown as they are.<br>
remember_position -- Whether to track the position where next_char is<br>
inserted.<br>
<br>
Returns the partially formatted phone number.</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary for instance variables (if defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list of weak references to the object (if defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom> <br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
<td width="100%"><strong>REGION_CODE_FOR_NON_GEO_ENTITY</strong> = '001'<br>
<strong>U_EMPTY_STRING</strong> = ''<br>
<strong>U_SPACE</strong> = ' '</td></tr></table>
</body></html>