Skip to content

Commit

Permalink
remove dev dependence
Browse files Browse the repository at this point in the history
                 _                 _
                (_) ___  ___  _ __| |_
                | |/ _/ / _ \/ '__  _/
                | |\__ \/\_\/| |  | |_
                |_|\___/\___/\_/   \_/

      isort your imports, so you don't have to.

                    VERSION 5.13.2

Nothing to do: no files or paths have have been passed in!

Try one of the following:

    `isort .` - sort all Python files, starting from the current directory, recursively.
    `isort . --interactive` - Do the same, but ask before making any changes.
    `isort . --check --diff` - Check to see if imports are correctly sorted within this project.
    `isort --help` - In-depth information about isort's available command-line options.

Visit https://pycqa.github.io/isort/ for complete information about how to use isort.
  • Loading branch information
luwqz1 committed Jun 17, 2024
1 parent 35cbace commit 8707192
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ fntypes = "^0.1.2.post1"
[tool.poetry.group.dev.dependencies]
ruff = "^0.4.4"
basedpyright = "^1.12.1"
isort = "5.13.2"
sort-all = "1.2.0"
pytest = "^8.0.0"
pytest-asyncio = "^0.23.5"
Expand Down
18 changes: 9 additions & 9 deletions typegen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,24 +556,24 @@ def generate_node(
path_dir: str | None = None,
path_config_literals: str | None = None,
path_nicifications: str | None = None,
types_generator: ABCGenerator | None = None,
methods_generator: ABCGenerator | None = None,
object_generator: ABCGenerator | None = None,
method_generator: ABCGenerator | None = None,
) -> None:
path_dir = path_dir or "telegrinder/types"
if not os.path.exists(path_dir):
logger.warning(f"Path dir {path_dir!r} not found. Making dir...")
os.makedirs(path_dir)

if types_generator is None or methods_generator is None:
if object_generator is None or method_generator is None:
schema_json = get_schema_json()
schema_model = convert_schema_to_model(schema_json, TelegramBotAPISchema)
cfg_literal_types = read_config_literals(path_config_literals)
object_generator = types_generator or ObjectGenerator(
object_generator = object_generator or ObjectGenerator(
objects=schema_model.objects,
nicification_path=MAIN_DIR + (path_nicifications or "/nicifications.py"),
config_literal_types=cfg_literal_types.get("objects"),
)
method_generator = methods_generator or MethodGenerator(
method_generator = method_generator or MethodGenerator(
methods=schema_model.methods,
parent_types=(
object_generator.parent_types if isinstance(object_generator, ObjectGenerator) else {}
Expand All @@ -593,11 +593,11 @@ def generate_node(
else:
logger.info("Ruff formatter successfully formatted files.")

logger.debug("Run isort...")
if os.system(f"isort {path_dir}") != 0:
logger.error("Isort failed.")
logger.debug("Run ruff-isort...")
if os.system(f"ruff check {path_dir} --select I --select F401 --fix") != 0:
logger.error("ruff-isort failed.")
else:
logger.info("Isort successfully sorted imports.")
logger.info("Ruff-isort successfully sorted imports.")

logger.debug("Run sort-all...")
sort_all(pathlib.Path(path_dir))
Expand Down

0 comments on commit 8707192

Please sign in to comment.