8 :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. |
8 :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. |
9 :license: BSD, see LICENSE for details. |
9 :license: BSD, see LICENSE for details. |
10 """ |
10 """ |
11 |
11 |
12 from __future__ import unicode_literals # __IGNORE_WARNING__ |
12 from __future__ import unicode_literals # __IGNORE_WARNING__ |
|
13 try: |
|
14 str = unicode # __IGNORE_WARNING__ |
|
15 import urllib2 as request |
|
16 except (NameError): |
|
17 import urllib.request as request # __IGNORE_WARNING__ |
13 |
18 |
14 import re |
19 import re |
15 import urllib.request, urllib.parse, urllib.error |
|
16 |
20 |
17 # One man's constant is another man's variable. |
21 # One man's constant is another man's variable. |
18 SOURCE_URL = 'https://github.com/postgres/postgres/raw/master' |
22 SOURCE_URL = 'https://github.com/postgres/postgres/raw/master' |
19 KEYWORDS_URL = SOURCE_URL + '/doc/src/sgml/keywords.sgml' |
23 KEYWORDS_URL = SOURCE_URL + '/doc/src/sgml/keywords.sgml' |
20 DATATYPES_URL = SOURCE_URL + '/doc/src/sgml/datatype.sgml' |
24 DATATYPES_URL = SOURCE_URL + '/doc/src/sgml/datatype.sgml' |
97 raise ValueError('pseudo datatypes not found') |
101 raise ValueError('pseudo datatypes not found') |
98 |
102 |
99 return dt |
103 return dt |
100 |
104 |
101 def fetch(url): |
105 def fetch(url): |
102 return urllib.request.urlopen(url) |
106 return request.urlopen(url) |
103 |
107 |
104 def update_consts(filename, constname, content): |
108 def update_consts(filename, constname, content): |
105 f = open(filename) |
109 f = open(filename) |
106 lines = f.readlines() |
110 lines = f.readlines() |
107 f.close() |
111 f.close() |