Skip to content

Commit

Permalink
style: Apply new isort (I) rules to existing code
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitriPapadopoulos committed Jan 4, 2024
1 parent af2bccd commit 9fc579f
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 22 deletions.
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# yamllint documentation build configuration file, created by
# sphinx-quickstart on Thu Jan 21 21:18:52 2016.

import sys
import os
import sys
from unittest.mock import MagicMock


sys.path.insert(0, os.path.abspath('..'))

from yamllint import __copyright__, APP_NAME, APP_VERSION # noqa
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from setuptools import setup


# This is only kept for backward-compatibility with older versions that don't
# support new packaging standards (e.g. PEP 517 or PEP 660):
setup()
2 changes: 1 addition & 1 deletion tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import yaml

from yamllint.config import YamlLintConfig
from yamllint import linter
from yamllint.config import YamlLintConfig


class RuleTestCase(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/rules/test_indentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from tests.common import RuleTestCase

from yamllint.parser import token_or_comment_generator, Comment
from yamllint.parser import Comment, token_or_comment_generator
from yamllint.rules.indentation import check


Expand Down
1 change: 0 additions & 1 deletion tests/rules/test_quoted_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from tests.common import RuleTestCase

from yamllint import config


Expand Down
6 changes: 2 additions & 4 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from io import StringIO
import fcntl
import locale
import os
Expand All @@ -22,11 +21,10 @@
import sys
import tempfile
import unittest
from io import StringIO

from tests.common import build_temp_workspace, temp_workspace

from yamllint import cli
from yamllint import config
from yamllint import cli, config


class RunContext:
Expand Down
6 changes: 2 additions & 4 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from io import StringIO
import os
import shutil
import sys
import tempfile
import unittest
from io import StringIO

from tests.common import build_temp_workspace

from yamllint import cli, config
from yamllint.config import YamlLintConfigError
from yamllint import cli
from yamllint import config


class SimpleConfigTestCase(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import io
import unittest

from yamllint.config import YamlLintConfig
from yamllint import linter
from yamllint.config import YamlLintConfig


class LinterTestCase(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import os
import shutil
import subprocess
import tempfile
import sys
import tempfile
import unittest


Expand Down
11 changes: 8 additions & 3 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@

import yaml

from yamllint.parser import (line_generator, token_or_comment_generator,
token_or_comment_or_line_generator,
Line, Token, Comment)
from yamllint.parser import (
Comment,
Line,
Token,
line_generator,
token_or_comment_generator,
token_or_comment_or_line_generator,
)


class ParserTestCase(unittest.TestCase):
Expand Down
1 change: 1 addition & 0 deletions yamllint/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from yamllint.cli import run


if __name__ == '__main__':
run()
3 changes: 1 addition & 2 deletions yamllint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
import platform
import sys

from yamllint import APP_DESCRIPTION, APP_NAME, APP_VERSION
from yamllint import linter
from yamllint import APP_DESCRIPTION, APP_NAME, APP_VERSION, linter
from yamllint.config import YamlLintConfig, YamlLintConfigError
from yamllint.linter import PROBLEM_LEVELS

Expand Down
2 changes: 1 addition & 1 deletion yamllint/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import re
import io
import re

import yaml

Expand Down
3 changes: 2 additions & 1 deletion yamllint/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
document_start,
empty_lines,
empty_values,
float_values,
hyphens,
indentation,
key_duplicates,
Expand All @@ -33,12 +34,12 @@
new_line_at_end_of_file,
new_lines,
octal_values,
float_values,
quoted_strings,
trailing_spaces,
truthy,
)


_RULES = {
anchors.ID: anchors,
braces.ID: braces,
Expand Down
1 change: 1 addition & 0 deletions yamllint/rules/quoted_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@

from yamllint.linter import LintProblem


ID = 'quoted-strings'
TYPE = 'token'
CONF = {'quote-type': ('any', 'single', 'double'),
Expand Down

0 comments on commit 9fc579f

Please sign in to comment.