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>
This commit is contained in:
Anders Kaseorg
2020-06-10 15:54:34 -07:00
committed by Tim Abbott
parent b666aef2d3
commit 365fe0b3d5
528 changed files with 4801 additions and 3806 deletions

View File

@@ -1,9 +1,9 @@
#!/usr/bin/env python3
from pygments.lexers import get_all_lexers
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')

View File

@@ -5,14 +5,20 @@
import os
import shutil
import sys
import ujson
from typing import Any, Dict, Iterator, List, Optional
from emoji_setup_utils import generate_emoji_catalog, generate_codepoint_to_name_map, \
get_emoji_code, generate_name_to_codepoint_map, emoji_names_for_picker, \
EMOTICON_CONVERSIONS, REMAPPED_EMOJIS
import ujson
from emoji_names import EMOJI_NAME_MAPS
from emoji_setup_utils import (
EMOTICON_CONVERSIONS,
REMAPPED_EMOJIS,
emoji_names_for_picker,
generate_codepoint_to_name_map,
generate_emoji_catalog,
generate_name_to_codepoint_map,
get_emoji_code,
)
ZULIP_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../../')
sys.path.append(ZULIP_PATH)

View File

@@ -1,8 +1,6 @@
# This file contains various helper functions used by `build_emoji` tool.
# See docs/subsystems/emoji.md for details on how this system works.
from collections import defaultdict
from typing import Any, Dict, List
# Emojisets that we currently support.

View File

@@ -10,12 +10,12 @@ import argparse
import csv
import os
import re
from typing import Any, Dict, List
import ujson
from emoji_setup_utils import get_emoji_code
from typing import Any, Dict, List
TOOLS_DIR_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
ZULIP_PATH = os.path.dirname(TOOLS_DIR_PATH)
# `emoji.json` file is same in all four emoji-datasource packages.

View File

@@ -6,12 +6,12 @@
# sources' decisions about what names to provide to each unicode
# codepoint.
import os
import ujson
from typing import Any, Dict, List
from emoji_setup_utils import emoji_is_universal, get_emoji_code, EMOJISETS
import ujson
from emoji_names import EMOJI_NAME_MAPS
from emoji_setup_utils import EMOJISETS, emoji_is_universal, get_emoji_code
TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
ZULIP_PATH = os.path.dirname(TOOLS_DIR)

View File

@@ -13,7 +13,6 @@ import csv
import os
import re
import textwrap
from typing import Any, Dict, List, Set
EMOJI_DIR_PATH = os.path.dirname(os.path.abspath(__file__))

View File

@@ -3,8 +3,8 @@ import argparse
import difflib
import filecmp
import os
import subprocess
import shutil
import subprocess
import tempfile
TOOLS_DIR = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
import os
import sys
@@ -7,6 +6,7 @@ ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__f
if ZULIP_PATH not in sys.path:
sys.path.append(ZULIP_PATH)
from scripts.lib.setup_path import setup_path
setup_path()
os.environ["DJANGO_SETTINGS_MODULE"] = "zproject.settings"
@@ -20,9 +20,10 @@ import io
import cairosvg
from PIL import Image
from zerver.lib.upload import resize_avatar, DEFAULT_AVATAR_SIZE
from zerver.lib.integrations import WEBHOOK_INTEGRATIONS
from zerver.lib.storage import static_path
from zerver.lib.upload import DEFAULT_AVATAR_SIZE, resize_avatar
def create_square_image(png: bytes) -> bytes:
img = Image.open(io.BytesIO(png))

View File

@@ -1,19 +1,20 @@
#!/usr/bin/env python3
import glob
import os
import sys
import shutil
import sys
from typing import List
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
if ZULIP_PATH not in sys.path:
sys.path.append(ZULIP_PATH)
from scripts.lib.setup_path import setup_path
setup_path()
from zulip_bots.lib import get_bots_directory_path
def generate_zulip_bots_static_files() -> None:
bots_dir = 'static/generated/bots'
if os.path.isdir(bots_dir):