Skip to content

Commit

Permalink
Add isort configuration to not spoil imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixoid committed Apr 19, 2024
1 parent 684b738 commit 58bf189
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 47 deletions.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ max-branches=50
max-nested-blocks=10
max-statements=200

[tool.isort]
profile = "black"
src_paths = ["src", "tests/ci", "tests/sqllogic"]

[tool.pylint.FORMAT]
#ignore-long-lines = (# )?<?https?://\S+>?$

Expand Down
3 changes: 0 additions & 3 deletions tests/ci/artifacts_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
from shutil import copy2
from typing import List, Optional, Union

# isort: off
from github.Commit import Commit

# isort: on

from build_download_helper import download_build_with_progress
from commit_status_helper import post_commit_status
from compress_files import SUFFIX, compress_fast, decompress_fast
Expand Down
3 changes: 0 additions & 3 deletions tests/ci/build_download_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
from pathlib import Path
from typing import Any, Callable, List, Optional, Union

# isort: off
import requests

# isort: on

import get_robot_token as grt # we need an updated ROBOT_TOKEN
from ci_config import CI_CONFIG

Expand Down
3 changes: 0 additions & 3 deletions tests/ci/commit_status_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from pathlib import Path
from typing import Dict, List, Optional, Union

# isort: off
from github import Github
from github.Commit import Commit
from github.CommitStatus import CommitStatus
Expand All @@ -18,8 +17,6 @@
from github.IssueComment import IssueComment
from github.Repository import Repository

# isort: on

from ci_config import CHECK_DESCRIPTIONS, REQUIRED_CHECKS, CheckDescription
from env_helper import GITHUB_REPOSITORY, GITHUB_RUN_URL, TEMP_PATH
from pr_info import SKIP_MERGEABLE_CHECK_LABEL, PRInfo
Expand Down
3 changes: 0 additions & 3 deletions tests/ci/compatibility_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
from pathlib import Path
from typing import List, Tuple

# isort: off
from pip._vendor.packaging.version import Version

# isort: on

from build_download_helper import download_builds_filter
from docker_images_helper import DockerImage, get_docker_image, pull_image
from env_helper import REPORT_PATH, TEMP_PATH
Expand Down
11 changes: 5 additions & 6 deletions tests/ci/docker_images_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
from pathlib import Path
from typing import List, Optional, Tuple

# isort: off
from github import Github

# isort: on

from clickhouse_helper import ClickHouseHelper, prepare_tests_results_for_clickhouse
from commit_status_helper import format_description, get_commit, post_commit_status
from docker_images_helper import DockerImageData, docker_login, get_images_oredered_list
Expand Down Expand Up @@ -225,9 +222,11 @@ def main():
parent_version = (
None
if not image.parent
else image_tags[image.parent]
if not args.suffix
else f"{image_tags[image.parent]}-{args.suffix}"
else (
image_tags[image.parent]
if not args.suffix
else f"{image_tags[image.parent]}-{args.suffix}"
)
)

res = process_single_image(
Expand Down
3 changes: 0 additions & 3 deletions tests/ci/docker_manifests_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
import sys
from typing import List, Tuple

# isort: off
from github import Github

# isort: on

from clickhouse_helper import ClickHouseHelper, prepare_tests_results_for_clickhouse
from commit_status_helper import format_description, get_commit, post_commit_status
from docker_images_helper import docker_login, get_images_oredered_list
Expand Down
3 changes: 0 additions & 3 deletions tests/ci/finish_check.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/usr/bin/env python3
import logging

# isort: off
from github import Github

# isort: on

from commit_status_helper import (
CI_STATUS_NAME,
get_commit,
Expand Down
3 changes: 0 additions & 3 deletions tests/ci/merge_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
from pprint import pformat
from typing import Dict, List

# isort: off
from github.PaginatedList import PaginatedList
from github.PullRequestReview import PullRequestReview
from github.WorkflowRun import WorkflowRun

# isort: on

from commit_status_helper import get_commit_filtered_statuses
from get_robot_token import get_best_robot_token
from github_helper import GitHub, NamedUser, PullRequest, Repository
Expand Down
3 changes: 0 additions & 3 deletions tests/ci/performance_comparison_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
import traceback
from pathlib import Path

# isort: off
from github import Github

# isort: on

from build_download_helper import download_builds_filter
from ci_config import CI_CONFIG
from clickhouse_helper import get_instance_id, get_instance_type
Expand Down
4 changes: 0 additions & 4 deletions tests/ci/pr_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
from typing import Dict, List, Set, Union
from urllib.parse import quote

# isort: off
# for some reason this line moves to the end
from unidiff import PatchSet # type: ignore

# isort: on

from build_download_helper import get_gh_api
from env_helper import (
GITHUB_EVENT_PATH,
Expand Down
3 changes: 0 additions & 3 deletions tests/ci/run_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
import sys
from typing import Tuple

# isort: off
from github import Github

# isort: on

from cherry_pick import Labels
from commit_status_helper import (
CI_STATUS_NAME,
Expand Down
3 changes: 0 additions & 3 deletions tests/sqllogic/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@
import os
from functools import reduce

# isort: off
from deepdiff import DeepDiff # pylint:disable=import-error; for style check

# isort: on

from connection import Engines, default_clickhouse_odbc_conn_str, setup_connection
from test_runner import RequestType, Status, TestRunner

Expand Down
15 changes: 8 additions & 7 deletions tests/sqllogic/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
from hashlib import md5
from itertools import chain

# isort: off
# pylint:disable=import-error; for style check
import sqlglot
from sqlglot.expressions import ColumnDef, PrimaryKeyColumnConstraint

# pylint:enable=import-error; for style check
# isort: on

from exceptions import (
DataResultDiffer,
Error,
Expand All @@ -23,6 +19,9 @@
QueryExecutionError,
)

# pylint:enable=import-error; for style check


logger = logging.getLogger("parser")
logger.setLevel(logging.DEBUG)

Expand Down Expand Up @@ -474,9 +473,11 @@ def __str__(self):
f"values_count: {self.values_count}" if self.values_count else "",
f"data_hash: {self.data_hash}" if self.data_hash else "",
f"exception: {self.exception}" if self.exception else "",
f"hash_threshold: {self.hash_threshold}"
if self.hash_threshold
else "",
(
f"hash_threshold: {self.hash_threshold}"
if self.hash_threshold
else ""
),
]
if x
)
Expand Down

0 comments on commit 58bf189

Please sign in to comment.