Skip to content

Commit

Permalink
chore: Use black profile for isort
Browse files Browse the repository at this point in the history
- Avoid not really needed customization of isort configuration
- Move it to pyproject.toml
  • Loading branch information
nijel committed Apr 19, 2023
1 parent 9749e56 commit 615ffb1
Show file tree
Hide file tree
Showing 106 changed files with 24 additions and 134 deletions.
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import os
import sys


sys.path.insert(0, os.path.abspath("_ext"))
sys.path.insert(0, os.path.abspath("."))
sys.path.insert(0, os.path.abspath(".."))
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ requires = [
"setuptools_scm>=6.2"
]
build-backend = "setuptools.build_meta"

[tool.isort]
profile = "black"
known_third_party=[
"iniparse","lxml","vobject","sphinx","pytest","cheroot","phply","bs4","ruamel","pyparsing","setuptools"]
25 changes: 0 additions & 25 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -221,28 +221,3 @@ per-file-ignores =
translate/storage/placeables/__init__.py:F401,F403
translate/storage/po.py:F401,F403
translate/storage/wordfast.py:E262

[isort]
# Settings:
# https://github.com/timothycrosley/isort/wiki/isort-Settings#full-reference-of-isort-settings

# black compatible settings:
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 88

known_standard_library=
known_third_party=iniparse,lxml,vobject,sphinx,pytest,cheroot,phply,bs4,ruamel,pyparsing,setuptools
known_first_party=translate
default_section=FIRSTPARTY
sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
# Separate sections within "from" imports for CONSTANTS, Classes, and
# modules/functions.
order_by_type=True
# Combine as imports on the same line within for import statements. By default
# isort forces all as imports to display on their own lines.
combine_as_imports=True
lines_after_imports=2
1 change: 0 additions & 1 deletion tests/odf_xliff/test_odf_xliff.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from lxml import etree


# get directory of this test
dir = os.path.dirname(os.path.abspath(__file__))
# get top-level directory (moral equivalent of ../..)
Expand Down
1 change: 0 additions & 1 deletion tests/xliff_conformance/test_xliff_conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

from lxml import etree


schema = None


Expand Down
1 change: 0 additions & 1 deletion tools/mozilla/buildxpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
from subprocess import PIPE, CalledProcessError, Popen
from tempfile import mkdtemp


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion tools/mozilla/get_moz_enUS.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import shutil
from configparser import ConfigParser, NoSectionError


srccheckout = "mozilla"
l10ncheckout = "l10n"
product = "browser"
Expand Down
1 change: 0 additions & 1 deletion tools/mozilla/moz_l10n_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import time
from subprocess import PIPE, Popen


join = os.path.join

try:
Expand Down
1 change: 0 additions & 1 deletion tools/mozilla/mozcronbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from tools.mozilla import moz_l10n_builder


MOZDIR = os.path.join(os.path.expanduser("~"), "mozbuild")


Expand Down
1 change: 0 additions & 1 deletion translate/convert/accesskey.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from translate.storage.placeables.general import XMLEntityPlaceable


DEFAULT_ACCESSKEY_MARKER = "&"


Expand Down
1 change: 0 additions & 1 deletion translate/convert/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from translate.misc import optrecurse


# Don't import optparse ourselves, get the version from optrecurse.
optparse = optrecurse.optparse

Expand Down
1 change: 0 additions & 1 deletion translate/convert/csv2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from translate.storage import csvl10n, po


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion translate/convert/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import os


# from translate.convert import prop2po, po2prop, odf2xliff, xliff2odf


Expand Down
1 change: 0 additions & 1 deletion translate/convert/json2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from translate.storage import po


logger = logging.getLogger(__name__)


Expand Down
3 changes: 2 additions & 1 deletion translate/convert/mozlang2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"""

from translate.convert import convert
from translate.storage import mozilla_lang as lang, po
from translate.storage import mozilla_lang as lang
from translate.storage import po


class lang2po:
Expand Down
1 change: 0 additions & 1 deletion translate/convert/oo2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

from translate.storage import oo, po


# TODO: support using one GSI file as template, another as input (for when English is in one and translation in another)

logger = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion translate/convert/oo2xliff.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

from translate.storage import oo, xliff


# TODO: support using one GSI file as template, another as input (for when English is in one and translation in another)

logger = logging.getLogger(__name__)
Expand Down
1 change: 0 additions & 1 deletion translate/convert/po2oo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from translate.filters import autocorrect, checks, pofilter
from translate.storage import factory, oo


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion translate/convert/po2php.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from translate.convert import convert
from translate.storage import php, po


eol = "\n"


Expand Down
1 change: 0 additions & 1 deletion translate/convert/po2prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from translate.misc import quote
from translate.storage import po, properties


eol = "\n"


Expand Down
1 change: 0 additions & 1 deletion translate/convert/po2rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
generate_popup_pre_name,
)


NL = "\r\n"
BLOCK_START = "BEGIN"
BLOCK_END = "END"
Expand Down
1 change: 0 additions & 1 deletion translate/convert/prop2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from translate.convert.accesskey import UnitMixer
from translate.storage import po, properties


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion translate/convert/rc2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from translate.storage import po, rc


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion translate/convert/resx2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

from translate.storage import po


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion translate/convert/sub2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from translate.storage import po


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion translate/convert/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from translate.convert import convert


OPTION_RE = re.compile(r"^\s*-")


Expand Down
1 change: 0 additions & 1 deletion translate/convert/test_ini2po.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from translate.convert import ini2po, test_convert


importorskip("iniparse")


Expand Down
1 change: 0 additions & 1 deletion translate/convert/test_po2ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from translate.convert import po2ini, test_convert


importorskip("iniparse")


Expand Down
1 change: 0 additions & 1 deletion translate/convert/test_po2rc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from translate.convert import po2rc, test_convert
from translate.storage.rc import rcfile


RC_SOURCE = r"""
#include "other_file.h" // This must be ignored
Expand Down
1 change: 0 additions & 1 deletion translate/convert/test_po2sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from translate.convert import po2sub, test_convert
from translate.storage import po


# Technically subtitles can also use an older gaupol
importorskip("aeidon")

Expand Down
1 change: 0 additions & 1 deletion translate/convert/test_rc2po.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from translate.convert import rc2po, test_convert
from translate.storage.po import pofile


RC_SOURCE = r"""
#include "other_file.h" // This must be ignored
Expand Down
1 change: 0 additions & 1 deletion translate/convert/xliff2oo.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from translate.filters import autocorrect, checks, pofilter
from translate.storage import factory, oo


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion translate/filters/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from translate.filters.decorators import cosmetic, critical, extraction, functional
from translate.lang import data, factory


logger = logging.getLogger(__name__)

# These are some regular expressions that are compiled for use in some tests
Expand Down
4 changes: 2 additions & 2 deletions translate/filters/spelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import logging
from functools import lru_cache


logger = logging.getLogger(__name__)

available = False

try:
# Enchant
from enchant import Error as EnchantError, checker
from enchant import Error as EnchantError
from enchant import checker

available = True
checkers = {}
Expand Down
1 change: 0 additions & 1 deletion translate/lang/af.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

from translate.lang import common


articlere = re.compile(r"'n\b")


Expand Down
1 change: 0 additions & 1 deletion translate/lang/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@

from translate.lang import data


logger = logging.getLogger(__name__)


Expand Down
1 change: 0 additions & 1 deletion translate/lang/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import re
import unicodedata


try:
import pycountry
except ImportError:
Expand Down
1 change: 0 additions & 1 deletion translate/lang/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

from translate.lang import common, data


prefix = "code_"


Expand Down
1 change: 0 additions & 1 deletion translate/lang/ngram.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import sys
from os import path


nb_ngrams = 400
white_space_re = re.compile(r"\s+")

Expand Down
1 change: 0 additions & 1 deletion translate/lang/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import re


__all__ = ("LANG_TEAM_CONTACT_SNIPPETS", "guess_language")

LANG_TEAM_REGEX = (
Expand Down
1 change: 0 additions & 1 deletion translate/lang/test_identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from translate.lang.identify import LanguageIdentifier
from translate.storage.base import TranslationUnit


TEXT = """
Ästhetik des "Erhabenen" herangezogen.
kostete (hinzu kommen über 6 630 tote
Expand Down
1 change: 0 additions & 1 deletion translate/misc/ourdom.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

from xml.dom import expatbuilder, minidom


# helper functions we use to do xml the way we want, used by modified
# classes below

Expand Down
1 change: 0 additions & 1 deletion translate/misc/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from itertools import starmap
from wsgiref.util import shift_path_info


try:
from resolver import resolve
except ImportError:
Expand Down
1 change: 0 additions & 1 deletion translate/misc/xml_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from lxml import etree


# some useful xpath expressions
xml_preserve_ancestors = etree.XPath(
"ancestor-or-self::*[attribute::xml:space='preserve']"
Expand Down
1 change: 0 additions & 1 deletion translate/storage/_factory_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
xliff,
)


try:
from . import trados
except ImportError:
Expand Down
Loading

0 comments on commit 615ffb1

Please sign in to comment.