Update idna to 2.7

This commit is contained in:
Pradyun Gedam 2018-06-21 18:39:29 +05:30
parent b1aee4b387
commit 7b97a38c6b
No known key found for this signature in database
GPG Key ID: DA17C4B29CB32E4B
10 changed files with 1294 additions and 428 deletions

1
news/idna.vendor Normal file
View File

@ -0,0 +1 @@
Update idna to 2.7

0
src/pip/_vendor/idna/__init__.py Normal file → Executable file
View File

0
src/pip/_vendor/idna/codec.py Normal file → Executable file
View File

0
src/pip/_vendor/idna/compat.py Normal file → Executable file
View File

40
src/pip/_vendor/idna/core.py Normal file → Executable file
View File

@ -34,7 +34,11 @@ class InvalidCodepointContext(IDNAError):
def _combining_class(cp):
return unicodedata.combining(unichr(cp))
v = unicodedata.combining(unichr(cp))
if v == 0:
if not unicodedata.name(unichr(cp)):
raise ValueError("Unknown character in unicodedata")
return v
def _is_script(cp, script):
return intranges_contain(ord(cp), idnadata.scripts[script])
@ -71,7 +75,6 @@ def check_bidi(label, check_ltr=False):
raise IDNABidiError('Unknown directionality in label {0} at position {1}'.format(repr(label), idx))
if direction in ['R', 'AL', 'AN']:
bidi_label = True
break
if not bidi_label and not check_ltr:
return True
@ -244,8 +247,13 @@ def check_label(label):
if intranges_contain(cp_value, idnadata.codepoint_classes['PVALID']):
continue
elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTJ']):
if not valid_contextj(label, pos):
raise InvalidCodepointContext('Joiner {0} not allowed at position {1} in {2}'.format(_unot(cp_value), pos+1, repr(label)))
try:
if not valid_contextj(label, pos):
raise InvalidCodepointContext('Joiner {0} not allowed at position {1} in {2}'.format(
_unot(cp_value), pos+1, repr(label)))
except ValueError:
raise IDNAError('Unknown codepoint adjacent to joiner {0} at position {1} in {2}'.format(
_unot(cp_value), pos+1, repr(label)))
elif intranges_contain(cp_value, idnadata.codepoint_classes['CONTEXTO']):
if not valid_contexto(label, pos):
raise InvalidCodepointContext('Codepoint {0} not allowed at position {1} in {2}'.format(_unot(cp_value), pos+1, repr(label)))
@ -317,10 +325,10 @@ def uts46_remap(domain, std3_rules=True, transitional=False):
replacement = uts46row[2] if len(uts46row) == 3 else None
if (status == "V" or
(status == "D" and not transitional) or
(status == "3" and std3_rules and replacement is None)):
(status == "3" and not std3_rules and replacement is None)):
output += char
elif replacement is not None and (status == "M" or
(status == "3" and std3_rules) or
(status == "3" and not std3_rules) or
(status == "D" and transitional)):
output += replacement
elif status != "I":
@ -344,15 +352,17 @@ def encode(s, strict=False, uts46=False, std3_rules=False, transitional=False):
labels = s.split('.')
else:
labels = _unicode_dots_re.split(s)
while labels and not labels[0]:
del labels[0]
if not labels:
if not labels or labels == ['']:
raise IDNAError('Empty domain')
if labels[-1] == '':
del labels[-1]
trailing_dot = True
for label in labels:
result.append(alabel(label))
s = alabel(label)
if s:
result.append(s)
else:
raise IDNAError('Empty label')
if trailing_dot:
result.append(b'')
s = b'.'.join(result)
@ -373,15 +383,17 @@ def decode(s, strict=False, uts46=False, std3_rules=False):
labels = _unicode_dots_re.split(s)
else:
labels = s.split(u'.')
while labels and not labels[0]:
del labels[0]
if not labels:
if not labels or labels == ['']:
raise IDNAError('Empty domain')
if not labels[-1]:
del labels[-1]
trailing_dot = True
for label in labels:
result.append(ulabel(label))
s = ulabel(label)
if s:
result.append(s)
else:
raise IDNAError('Empty label')
if trailing_dot:
result.append(u'')
return u'.'.join(result)

398
src/pip/_vendor/idna/idnadata.py Normal file → Executable file
View File

@ -1,11 +1,12 @@
# This file is automatically generated by tools/idna-data
__version__ = "6.3.0"
__version__ = "10.0.0"
scripts = {
'Greek': (
0x37000000374,
0x37500000378,
0x37a0000037e,
0x37f00000380,
0x38400000385,
0x38600000387,
0x3880000038b,
@ -34,7 +35,9 @@ scripts = {
0x1ff200001ff5,
0x1ff600001fff,
0x212600002127,
0x101400001018b,
0xab650000ab66,
0x101400001018f,
0x101a0000101a1,
0x1d2000001d246,
),
'Han': (
@ -46,12 +49,14 @@ scripts = {
0x30210000302a,
0x30380000303c,
0x340000004db6,
0x4e0000009fcd,
0x4e0000009feb,
0xf9000000fa6e,
0xfa700000fada,
0x200000002a6d7,
0x2a7000002b735,
0x2b7400002b81e,
0x2b8200002cea2,
0x2ceb00002ebe1,
0x2f8000002fa1e,
),
'Hebrew': (
@ -68,7 +73,7 @@ scripts = {
'Hiragana': (
0x304100003097,
0x309d000030a0,
0x1b0010001b002,
0x1b0010001b11f,
0x1f2000001f201,
),
'Katakana': (
@ -88,6 +93,7 @@ joining_types = {
0x602: 85,
0x603: 85,
0x604: 85,
0x605: 85,
0x608: 85,
0x60b: 85,
0x620: 68,
@ -365,7 +371,7 @@ joining_types = {
0x844: 68,
0x845: 68,
0x846: 82,
0x847: 68,
0x847: 82,
0x848: 68,
0x849: 82,
0x84a: 68,
@ -373,7 +379,7 @@ joining_types = {
0x84c: 68,
0x84d: 68,
0x84e: 68,
0x84f: 82,
0x84f: 68,
0x850: 68,
0x851: 68,
0x852: 68,
@ -383,7 +389,19 @@ joining_types = {
0x856: 85,
0x857: 85,
0x858: 85,
0x860: 68,
0x861: 85,
0x862: 68,
0x863: 68,
0x864: 68,
0x865: 68,
0x866: 85,
0x867: 82,
0x868: 68,
0x869: 82,
0x86a: 82,
0x8a0: 68,
0x8a1: 68,
0x8a2: 68,
0x8a3: 68,
0x8a4: 68,
@ -395,6 +413,23 @@ joining_types = {
0x8aa: 82,
0x8ab: 82,
0x8ac: 82,
0x8ad: 85,
0x8ae: 82,
0x8af: 68,
0x8b0: 68,
0x8b1: 82,
0x8b2: 82,
0x8b3: 68,
0x8b4: 68,
0x8b6: 68,
0x8b7: 68,
0x8b8: 68,
0x8b9: 82,
0x8ba: 68,
0x8bb: 68,
0x8bc: 68,
0x8bd: 68,
0x8e2: 85,
0x1806: 85,
0x1807: 68,
0x180a: 67,
@ -492,8 +527,8 @@ joining_types = {
0x1882: 85,
0x1883: 85,
0x1884: 85,
0x1885: 85,
0x1886: 85,
0x1885: 84,
0x1886: 84,
0x1887: 68,
0x1888: 68,
0x1889: 68,
@ -531,6 +566,7 @@ joining_types = {
0x18aa: 68,
0x200c: 85,
0x200d: 67,
0x202f: 85,
0x2066: 85,
0x2067: 85,
0x2068: 85,
@ -587,6 +623,141 @@ joining_types = {
0xa871: 68,
0xa872: 76,
0xa873: 85,
0x10ac0: 68,
0x10ac1: 68,
0x10ac2: 68,
0x10ac3: 68,
0x10ac4: 68,
0x10ac5: 82,
0x10ac6: 85,
0x10ac7: 82,
0x10ac8: 85,
0x10ac9: 82,
0x10aca: 82,
0x10acb: 85,
0x10acc: 85,
0x10acd: 76,
0x10ace: 82,
0x10acf: 82,
0x10ad0: 82,
0x10ad1: 82,
0x10ad2: 82,
0x10ad3: 68,
0x10ad4: 68,
0x10ad5: 68,
0x10ad6: 68,
0x10ad7: 76,
0x10ad8: 68,
0x10ad9: 68,
0x10ada: 68,
0x10adb: 68,
0x10adc: 68,
0x10add: 82,
0x10ade: 68,
0x10adf: 68,
0x10ae0: 68,
0x10ae1: 82,
0x10ae2: 85,
0x10ae3: 85,
0x10ae4: 82,
0x10aeb: 68,
0x10aec: 68,
0x10aed: 68,
0x10aee: 68,
0x10aef: 82,
0x10b80: 68,
0x10b81: 82,
0x10b82: 68,
0x10b83: 82,
0x10b84: 82,
0x10b85: 82,
0x10b86: 68,
0x10b87: 68,
0x10b88: 68,
0x10b89: 82,
0x10b8a: 68,
0x10b8b: 68,
0x10b8c: 82,
0x10b8d: 68,
0x10b8e: 82,
0x10b8f: 82,
0x10b90: 68,
0x10b91: 82,
0x10ba9: 82,
0x10baa: 82,
0x10bab: 82,
0x10bac: 82,
0x10bad: 68,
0x10bae: 68,
0x10baf: 85,
0x1e900: 68,
0x1e901: 68,
0x1e902: 68,
0x1e903: 68,
0x1e904: 68,
0x1e905: 68,
0x1e906: 68,
0x1e907: 68,
0x1e908: 68,
0x1e909: 68,
0x1e90a: 68,
0x1e90b: 68,
0x1e90c: 68,
0x1e90d: 68,
0x1e90e: 68,
0x1e90f: 68,
0x1e910: 68,
0x1e911: 68,
0x1e912: 68,
0x1e913: 68,
0x1e914: 68,
0x1e915: 68,
0x1e916: 68,
0x1e917: 68,
0x1e918: 68,
0x1e919: 68,
0x1e91a: 68,
0x1e91b: 68,
0x1e91c: 68,
0x1e91d: 68,
0x1e91e: 68,
0x1e91f: 68,
0x1e920: 68,
0x1e921: 68,
0x1e922: 68,
0x1e923: 68,
0x1e924: 68,
0x1e925: 68,
0x1e926: 68,
0x1e927: 68,
0x1e928: 68,
0x1e929: 68,
0x1e92a: 68,
0x1e92b: 68,
0x1e92c: 68,
0x1e92d: 68,
0x1e92e: 68,
0x1e92f: 68,
0x1e930: 68,
0x1e931: 68,
0x1e932: 68,
0x1e933: 68,
0x1e934: 68,
0x1e935: 68,
0x1e936: 68,
0x1e937: 68,
0x1e938: 68,
0x1e939: 68,
0x1e93a: 68,
0x1e93b: 68,
0x1e93c: 68,
0x1e93d: 68,
0x1e93e: 68,
0x1e93f: 68,
0x1e940: 68,
0x1e941: 68,
0x1e942: 68,
0x1e943: 68,
}
codepoint_classes = {
'PVALID': (
@ -858,6 +1029,10 @@ codepoint_classes = {
0x52300000524,
0x52500000526,
0x52700000528,
0x5290000052a,
0x52b0000052c,
0x52d0000052e,
0x52f00000530,
0x5590000055a,
0x56100000587,
0x591000005be,
@ -881,15 +1056,14 @@ codepoint_classes = {
0x7c0000007f6,
0x8000000082e,
0x8400000085c,
0x8a0000008a1,
0x8a2000008ad,
0x8e4000008ff,
0x90000000958,
0x8600000086b,
0x8a0000008b5,
0x8b6000008be,
0x8d4000008e2,
0x8e300000958,
0x96000000964,
0x96600000970,
0x97100000978,
0x97900000980,
0x98100000984,
0x97100000984,
0x9850000098d,
0x98f00000991,
0x993000009a9,
@ -902,6 +1076,7 @@ codepoint_classes = {
0x9d7000009d8,
0x9e0000009e4,
0x9e6000009f2,
0x9fc000009fd,
0xa0100000a04,
0xa0500000a0b,
0xa0f00000a11,
@ -930,6 +1105,7 @@ codepoint_classes = {
0xad000000ad1,
0xae000000ae4,
0xae600000af0,
0xaf900000b00,
0xb0100000b04,
0xb0500000b0d,
0xb0f00000b11,
@ -960,20 +1136,19 @@ codepoint_classes = {
0xbd000000bd1,
0xbd700000bd8,
0xbe600000bf0,
0xc0100000c04,
0xc0000000c04,
0xc0500000c0d,
0xc0e00000c11,
0xc1200000c29,
0xc2a00000c34,
0xc3500000c3a,
0xc2a00000c3a,
0xc3d00000c45,
0xc4600000c49,
0xc4a00000c4e,
0xc5500000c57,
0xc5800000c5a,
0xc5800000c5b,
0xc6000000c64,
0xc6600000c70,
0xc8200000c84,
0xc8000000c84,
0xc8500000c8d,
0xc8e00000c91,
0xc9200000ca9,
@ -987,15 +1162,14 @@ codepoint_classes = {
0xce000000ce4,
0xce600000cf0,
0xcf100000cf3,
0xd0200000d04,
0xd0000000d04,
0xd0500000d0d,
0xd0e00000d11,
0xd1200000d3b,
0xd3d00000d45,
0xd1200000d45,
0xd4600000d49,
0xd4a00000d4f,
0xd5700000d58,
0xd6000000d64,
0xd5400000d58,
0xd5f00000d64,
0xd6600000d70,
0xd7a00000d80,
0xd8200000d84,
@ -1008,6 +1182,7 @@ codepoint_classes = {
0xdcf00000dd5,
0xdd600000dd7,
0xdd800000de0,
0xde600000df0,
0xdf200000df4,
0xe0100000e33,
0xe3400000e3b,
@ -1082,11 +1257,12 @@ codepoint_classes = {
0x13180000135b,
0x135d00001360,
0x138000001390,
0x13a0000013f5,
0x13a0000013f6,
0x14010000166d,
0x166f00001680,
0x16810000169b,
0x16a0000016eb,
0x16f1000016f9,
0x17000000170d,
0x170e00001715,
0x172000001735,
@ -1103,7 +1279,7 @@ codepoint_classes = {
0x182000001878,
0x1880000018ab,
0x18b0000018f6,
0x19000000191d,
0x19000000191f,
0x19200000192c,
0x19300000193c,
0x19460000196e,
@ -1117,6 +1293,7 @@ codepoint_classes = {
0x1a7f00001a8a,
0x1a9000001a9a,
0x1aa700001aa8,
0x1ab000001abe,
0x1b0000001b4c,
0x1b5000001b5a,
0x1b6b00001b74,
@ -1125,15 +1302,15 @@ codepoint_classes = {
0x1c4000001c4a,
0x1c4d00001c7e,
0x1cd000001cd3,
0x1cd400001cf7,
0x1cd400001cfa,
0x1d0000001d2c,
0x1d2f00001d30,
0x1d3b00001d3c,
0x1d4e00001d4f,
0x1d6b00001d78,
0x1d7900001d9b,
0x1dc000001de7,
0x1dfc00001e00,
0x1dc000001dfa,
0x1dfb00001e00,
0x1e0100001e02,
0x1e0300001e04,
0x1e0500001e06,
@ -1367,11 +1544,11 @@ codepoint_classes = {
0x309d0000309f,
0x30a1000030fb,
0x30fc000030ff,
0x31050000312e,
0x31050000312f,
0x31a0000031bb,
0x31f000003200,
0x340000004db6,
0x4e0000009fcd,
0x4e0000009feb,
0xa0000000a48d,
0xa4d00000a4fe,
0xa5000000a60d,
@ -1413,7 +1590,9 @@ codepoint_classes = {
0xa6930000a694,
0xa6950000a696,
0xa6970000a698,
0xa69f0000a6e6,
0xa6990000a69a,
0xa69b0000a69c,
0xa69e0000a6e6,
0xa6f00000a6f2,
0xa7170000a720,
0xa7230000a724,
@ -1463,30 +1642,39 @@ codepoint_classes = {
0xa7850000a786,
0xa7870000a789,
0xa78c0000a78d,
0xa78e0000a78f,
0xa78e0000a790,
0xa7910000a792,
0xa7930000a794,
0xa7930000a796,
0xa7970000a798,
0xa7990000a79a,
0xa79b0000a79c,
0xa79d0000a79e,
0xa79f0000a7a0,
0xa7a10000a7a2,
0xa7a30000a7a4,
0xa7a50000a7a6,
0xa7a70000a7a8,
0xa7a90000a7aa,
0xa7b50000a7b6,
0xa7b70000a7b8,
0xa7f70000a7f8,
0xa7fa0000a828,
0xa8400000a874,
0xa8800000a8c5,
0xa8800000a8c6,
0xa8d00000a8da,
0xa8e00000a8f8,
0xa8fb0000a8fc,
0xa8fd0000a8fe,
0xa9000000a92e,
0xa9300000a954,
0xa9800000a9c1,
0xa9cf0000a9da,
0xa9e00000a9ff,
0xaa000000aa37,
0xaa400000aa4e,
0xaa500000aa5a,
0xaa600000aa77,
0xaa7a0000aa7c,
0xaa800000aac3,
0xaa7a0000aac3,
0xaadb0000aade,
0xaae00000aaf0,
0xaaf20000aaf7,
@ -1495,6 +1683,8 @@ codepoint_classes = {
0xab110000ab17,
0xab200000ab27,
0xab280000ab2f,
0xab300000ab5b,
0xab600000ab66,
0xabc00000abeb,
0xabec0000abee,
0xabf00000abfa,
@ -1507,7 +1697,7 @@ codepoint_classes = {
0xfa230000fa25,
0xfa270000fa2a,
0xfb1e0000fb1f,
0xfe200000fe27,
0xfe200000fe30,
0xfe730000fe74,
0x100000001000c,
0x1000d00010027,
@ -1519,20 +1709,32 @@ codepoint_classes = {
0x101fd000101fe,
0x102800001029d,
0x102a0000102d1,
0x103000001031f,
0x1033000010341,
0x102e0000102e1,
0x1030000010320,
0x1032d00010341,
0x103420001034a,
0x103500001037b,
0x103800001039e,
0x103a0000103c4,
0x103c8000103d0,
0x104280001049e,
0x104a0000104aa,
0x104d8000104fc,
0x1050000010528,
0x1053000010564,
0x1060000010737,
0x1074000010756,
0x1076000010768,
0x1080000010806,
0x1080800010809,
0x1080a00010836,
0x1083700010839,
0x1083c0001083d,
0x1083f00010856,
0x1086000010877,
0x108800001089f,
0x108e0000108f3,
0x108f4000108f6,
0x1090000010916,
0x109200001093a,
0x10980000109b8,
@ -1545,31 +1747,137 @@ codepoint_classes = {
0x10a3800010a3b,
0x10a3f00010a40,
0x10a6000010a7d,
0x10a8000010a9d,
0x10ac000010ac8,
0x10ac900010ae7,
0x10b0000010b36,
0x10b4000010b56,
0x10b6000010b73,
0x10b8000010b92,
0x10c0000010c49,
0x10cc000010cf3,
0x1100000011047,
0x1106600011070,
0x11080000110bb,
0x1107f000110bb,
0x110d0000110e9,
0x110f0000110fa,
0x1110000011135,
0x1113600011140,
0x1115000011174,
0x1117600011177,
0x11180000111c5,
0x111d0000111da,
0x111ca000111cd,
0x111d0000111db,
0x111dc000111dd,
0x1120000011212,
0x1121300011238,
0x1123e0001123f,
0x1128000011287,
0x1128800011289,
0x1128a0001128e,
0x1128f0001129e,
0x1129f000112a9,
0x112b0000112eb,
0x112f0000112fa,
0x1130000011304,
0x113050001130d,
0x1130f00011311,
0x1131300011329,
0x1132a00011331,
0x1133200011334,
0x113350001133a,
0x1133c00011345,
0x1134700011349,
0x1134b0001134e,
0x1135000011351,
0x1135700011358,
0x1135d00011364,
0x113660001136d,
0x1137000011375,
0x114000001144b,
0x114500001145a,
0x11480000114c6,
0x114c7000114c8,
0x114d0000114da,
0x11580000115b6,
0x115b8000115c1,
0x115d8000115de,
0x1160000011641,
0x1164400011645,
0x116500001165a,
0x11680000116b8,
0x116c0000116ca,
0x120000001236f,
0x117000001171a,
0x1171d0001172c,
0x117300001173a,
0x118c0000118ea,
0x118ff00011900,
0x11a0000011a3f,
0x11a4700011a48,
0x11a5000011a84,
0x11a8600011a9a,
0x11ac000011af9,
0x11c0000011c09,
0x11c0a00011c37,
0x11c3800011c41,
0x11c5000011c5a,
0x11c7200011c90,
0x11c9200011ca8,
0x11ca900011cb7,
0x11d0000011d07,
0x11d0800011d0a,
0x11d0b00011d37,
0x11d3a00011d3b,
0x11d3c00011d3e,
0x11d3f00011d48,
0x11d5000011d5a,
0x120000001239a,
0x1248000012544,
0x130000001342f,
0x1440000014647,
0x1680000016a39,
0x16a4000016a5f,
0x16a6000016a6a,
0x16ad000016aee,
0x16af000016af5,
0x16b0000016b37,
0x16b4000016b44,
0x16b5000016b5a,
0x16b6300016b78,
0x16b7d00016b90,
0x16f0000016f45,
0x16f5000016f7f,
0x16f8f00016fa0,
0x1b0000001b002,
0x16fe000016fe2,
0x17000000187ed,
0x1880000018af3,
0x1b0000001b11f,
0x1b1700001b2fc,
0x1bc000001bc6b,
0x1bc700001bc7d,
0x1bc800001bc89,
0x1bc900001bc9a,
0x1bc9d0001bc9f,
0x1da000001da37,
0x1da3b0001da6d,
0x1da750001da76,
0x1da840001da85,
0x1da9b0001daa0,
0x1daa10001dab0,
0x1e0000001e007,
0x1e0080001e019,
0x1e01b0001e022,
0x1e0230001e025,
0x1e0260001e02b,
0x1e8000001e8c5,
0x1e8d00001e8d7,
0x1e9220001e94b,
0x1e9500001e95a,
0x200000002a6d7,
0x2a7000002b735,
0x2b7400002b81e,
0x2b8200002cea2,
0x2ceb00002ebe1,
),
'CONTEXTJ': (
0x200c0000200e,

0
src/pip/_vendor/idna/intranges.py Normal file → Executable file
View File

2
src/pip/_vendor/idna/package_data.py Normal file → Executable file
View File

@ -1,2 +1,2 @@
__version__ = '2.6'
__version__ = '2.7'

1279
src/pip/_vendor/idna/uts46data.py Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@ pytoml==0.1.16
retrying==1.3.3
requests==2.18.4
chardet==3.0.4
idna==2.6
idna==2.7
urllib3==1.23
certifi==2018.4.16
setuptools==39.2.0