aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/tld/gen_tld.py
diff options
context:
space:
mode:
authorabolkhovityanov <abolkhovityanov@yandex-team.ru>2022-02-10 16:50:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:49 +0300
commit19ffdf9058e1d3256bb9ed882514581b7d4df261 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/tld/gen_tld.py
parent812751ae6997d4a9efaca424ef7b2e1d06fa3771 (diff)
downloadydb-19ffdf9058e1d3256bb9ed882514581b7d4df261.tar.gz
Restoring authorship annotation for <abolkhovityanov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/tld/gen_tld.py')
-rwxr-xr-xlibrary/cpp/tld/gen_tld.py112
1 files changed, 56 insertions, 56 deletions
diff --git a/library/cpp/tld/gen_tld.py b/library/cpp/tld/gen_tld.py
index ab3569b93a..882b701e1d 100755
--- a/library/cpp/tld/gen_tld.py
+++ b/library/cpp/tld/gen_tld.py
@@ -1,57 +1,57 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import sys, os
-
-def main():
- alphabet = 'abcdefghijklmnopqrstuvwxyz'
- tlds = dict()
-
- for s in alphabet:
- tlds[s] = list()
- tlds['xn--'] = list()
-
- tld_file = open(sys.argv[1], 'r')
- for line in tld_file.readlines():
- domain = line.strip().lower()
- for label in tlds:
- if domain.startswith('xn--'):
- tlds['xn--'].append(domain)
- break
- elif domain.startswith('x'):
- tlds['x'].append(domain)
- break
- else:
- if domain.startswith(label):
- tlds[label].append(domain)
- break
-
- print '// actual list can be found at http://data.iana.org/TLD/tlds-alpha-by-domain.txt'
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import sys, os
+
+def main():
+ alphabet = 'abcdefghijklmnopqrstuvwxyz'
+ tlds = dict()
+
+ for s in alphabet:
+ tlds[s] = list()
+ tlds['xn--'] = list()
+
+ tld_file = open(sys.argv[1], 'r')
+ for line in tld_file.readlines():
+ domain = line.strip().lower()
+ for label in tlds:
+ if domain.startswith('xn--'):
+ tlds['xn--'].append(domain)
+ break
+ elif domain.startswith('x'):
+ tlds['x'].append(domain)
+ break
+ else:
+ if domain.startswith(label):
+ tlds[label].append(domain)
+ break
+
+ print '// actual list can be found at http://data.iana.org/TLD/tlds-alpha-by-domain.txt'
print 'static const char* const TopLevelDomains[] = {'
-
- for label, value in sorted(tlds.iteritems()):
- if label == 'xn--':
- sys.stdout.write(' /* ')
- str = ''
- for n in value:
- unicode_domain = n.decode('idna').encode('utf-8')
- str += ('%s, ' % unicode_domain)
- sys.stdout.write('%s*/\n' % str.rstrip())
-
- sys.stdout.write(' ')
- str = ''
- for n in value:
- str += ('"%s", ' % n)
- sys.stdout.write('%s\n' % str.rstrip())
- else:
- sys.stdout.write(' ')
- str = ''
- for n in value:
- str += ('"%s", ' % n)
- sys.stdout.write('%s\n' % str.rstrip())
-
- print ' 0'
- print '};'
-
-if __name__ == '__main__':
- main()
+
+ for label, value in sorted(tlds.iteritems()):
+ if label == 'xn--':
+ sys.stdout.write(' /* ')
+ str = ''
+ for n in value:
+ unicode_domain = n.decode('idna').encode('utf-8')
+ str += ('%s, ' % unicode_domain)
+ sys.stdout.write('%s*/\n' % str.rstrip())
+
+ sys.stdout.write(' ')
+ str = ''
+ for n in value:
+ str += ('"%s", ' % n)
+ sys.stdout.write('%s\n' % str.rstrip())
+ else:
+ sys.stdout.write(' ')
+ str = ''
+ for n in value:
+ str += ('"%s", ' % n)
+ sys.stdout.write('%s\n' % str.rstrip())
+
+ print ' 0'
+ print '};'
+
+if __name__ == '__main__':
+ main()