diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-06-09 14:39:19 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-06-09 14:39:19 +0300 |
commit | c04b663c7bb4b750deeb8f48f620497ec13da8fa (patch) | |
tree | 151ebc8bfdd2ad918caf5e6e2d8013e14272ddf8 /contrib/python/Pygments/py3/pygments/lexers/_sourcemod_builtins.py | |
parent | 0d55ca22c507d18c2f35718687e0b06d9915397b (diff) | |
download | ydb-c04b663c7bb4b750deeb8f48f620497ec13da8fa.tar.gz |
intermediate changes
ref:2d4f292087954c9344efdabb7b2a67f466263c65
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/_sourcemod_builtins.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/_sourcemod_builtins.py | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/_sourcemod_builtins.py b/contrib/python/Pygments/py3/pygments/lexers/_sourcemod_builtins.py index 2977a2c04f9..3884b4b603e 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/_sourcemod_builtins.py +++ b/contrib/python/Pygments/py3/pygments/lexers/_sourcemod_builtins.py @@ -3,11 +3,12 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This file contains the names of SourceMod functions. - It is able to re-generate itself. Do not edit the FUNCTIONS list by hand. - :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + Run with `python -I` to regenerate. + + :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ @@ -1093,19 +1094,10 @@ FUNCTIONS = ( if __name__ == '__main__': # pragma: no cover import re import sys - try: - from urllib import FancyURLopener - except ImportError: - from urllib.request import FancyURLopener + from urllib.request import FancyURLopener from pygments.util import format_lines - # urllib ends up wanting to import a module called 'math' -- if - # pygments/lexers is in the path, this ends badly. - for i in range(len(sys.path)-1, -1, -1): - if sys.path[i].endswith('/lexers'): - del sys.path[i] - class Opener(FancyURLopener): version = 'Mozilla/5.0 (Pygments Sourcemod Builtins Update)' @@ -1115,7 +1107,7 @@ if __name__ == '__main__': # pragma: no cover f = opener.open('http://docs.sourcemod.net/api/index.php') r = re.compile(r'SourceMod v\.<b>([\d\.]+(?:-\w+)?)</td>') for line in f: - m = r.search(line) + m = r.search(line.decode()) if m is not None: return m.groups()[0] raise ValueError('No version in api docs') @@ -1125,7 +1117,7 @@ if __name__ == '__main__': # pragma: no cover r = re.compile(r'SMfunctions\[\d+\] = Array \("(?:public )?([^,]+)",".+"\);') functions = [] for line in f: - m = r.match(line) + m = r.match(line.decode()) if m is not None: functions.append(m.groups()[0]) return functions @@ -1141,7 +1133,7 @@ if __name__ == '__main__': # pragma: no cover with open(filename, 'w') as fp: fp.write(header) fp.write(format_lines('FUNCTIONS', natives)) - fp.write(footer) + fp.write('\n\n' + footer) def run(): version = get_version() |