Skip to content

Commit

Permalink
fixed linting
Browse files Browse the repository at this point in the history
  • Loading branch information
yctomwang authored and Kludex committed Mar 29, 2024
1 parent 98f0166 commit 628ed34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions bump_pydantic/codemods/replace_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

from __future__ import annotations

import sys
from dataclasses import dataclass
from importlib.util import find_spec
from typing import Sequence

import sys
import libcst as cst
import libcst.matchers as m
from libcst.codemod import CodemodContext, VisitorBasedCodemodCommand
from libcst.codemod.visitors import AddImportsVisitor
from importlib.util import find_spec

IMPORTS = {
"pydantic:BaseSettings": ("pydantic_settings", "BaseSettings"),
Expand Down Expand Up @@ -115,7 +115,7 @@ def leave_replace_import(self, _: cst.ImportFrom, updated_node: cst.ImportFrom)
# we need to remove only the one we're replacing.
package_not_installed = not find_package_install(import_info.to_import_str[0])
if package_not_installed:
import_info_part = import_info.to_import_str[0].split('.')[0]
import_info_part = import_info.to_import_str[0].split(".")[0]
to_do_warning = f" #todo: please install {import_info_part}\n"
if to_do_warning not in to_do_warnings:
sys.stdout.write(to_do_warning)
Expand Down
10 changes: 6 additions & 4 deletions tests/unit/test_replace_imports.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import pytest
import sys
import io
import importlib
from libcst.codemod import CodemodTest
import io
import sys
from contextlib import contextmanager

import pytest
from libcst.codemod import CodemodTest

from bump_pydantic.codemods.replace_imports import ReplaceImportsCodemod


Expand Down

0 comments on commit 628ed34

Please sign in to comment.