File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed
Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 66
77.. automodule :: localflavor.kw.forms
88 :members:
9+
10+ Utilities
11+ ---------
12+
13+ .. automodule :: localflavor.kw.utils
14+ :members:
15+
16+ Data
17+ ____
18+
19+
20+ .. autodata :: localflavor.kw.kw_areas.AREA_CHOICES
21+
22+ .. autodata :: localflavor.kw.kw_governorates.GOVERNORATE_CHOICES
Original file line number Diff line number Diff line change 33
44def is_valid_civil_id (cid ):
55 """
6- Checks the validity of a Kuwaiti Civil ID number
7- by verifying the following:
8- * The number should consist of 12 digits
9- * The first digit should be 1, 2, or 3
10- * The extracted birthdate should be a valid date
11- * The checksum should be equal to the last digit of the Civil ID
6+ Checks the validity of a Kuwaiti Civil ID number by verifying the following:
7+
8+ * The number should consist of 12 digits
9+ * The first digit should be 1, 2, or 3
10+ * The extracted birthdate should be a valid date
11+ * The checksum should be equal to the last digit of the Civil ID
1212 """
1313 # Civil ID can only start with 1, 2, or 3 till year 2100
1414 if len (cid ) != 12 or not cid .isdigit () or cid [0 ] not in ('1' , '2' , '3' ):
@@ -36,7 +36,7 @@ def get_birthdate_from_civil_id(cid):
3636 by_century = {
3737 '1' : '18' ,
3838 '2' : '19' ,
39- '3' : '20'
39+ '3' : '20' ,
4040 }
4141 if cid [0 ] not in ('1' , '2' , '3' ):
4242 raise ValueError ('Invalid first digit' )
You can’t perform that action at this time.
0 commit comments