Files
zulip/tools/setup/build_pygments_data
Anders Kaseorg 365fe0b3d5 python: Sort imports with isort.
Fixes #2665.

Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.

Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start.  I expect this change will increase pressure for us to split
those files, which isn't a bad thing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -07:00

22 lines
571 B
Python
Executable File

#!/usr/bin/env python3
import json
import os
from pygments.lexers import get_all_lexers
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../')
DATA_PATH = os.path.join(ZULIP_PATH, 'tools', 'setup', 'lang.json')
OUT_PATH = os.path.join(ZULIP_PATH, 'static', 'generated', 'pygments_data.json')
with open(DATA_PATH) as f:
langs = json.load(f)
lexers = get_all_lexers()
for lexer in lexers:
for name in lexer[1]:
if name not in langs:
langs[name] = 0
with open(OUT_PATH, 'w') as f:
json.dump({"langs": langs}, f)