Skip to content

Commit 628ed34

Browse files
yctomwangKludex
authored andcommitted
fixed linting
1 parent 98f0166 commit 628ed34

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

bump_pydantic/codemods/replace_imports.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
from __future__ import annotations
1212

13+
import sys
1314
from dataclasses import dataclass
15+
from importlib.util import find_spec
1416
from typing import Sequence
1517

16-
import sys
1718
import libcst as cst
1819
import libcst.matchers as m
1920
from libcst.codemod import CodemodContext, VisitorBasedCodemodCommand
2021
from libcst.codemod.visitors import AddImportsVisitor
21-
from importlib.util import find_spec
2222

2323
IMPORTS = {
2424
"pydantic:BaseSettings": ("pydantic_settings", "BaseSettings"),
@@ -115,7 +115,7 @@ def leave_replace_import(self, _: cst.ImportFrom, updated_node: cst.ImportFrom)
115115
# we need to remove only the one we're replacing.
116116
package_not_installed = not find_package_install(import_info.to_import_str[0])
117117
if package_not_installed:
118-
import_info_part = import_info.to_import_str[0].split('.')[0]
118+
import_info_part = import_info.to_import_str[0].split(".")[0]
119119
to_do_warning = f" #todo: please install {import_info_part}\n"
120120
if to_do_warning not in to_do_warnings:
121121
sys.stdout.write(to_do_warning)

tests/unit/test_replace_imports.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import pytest
2-
import sys
3-
import io
41
import importlib
5-
from libcst.codemod import CodemodTest
2+
import io
3+
import sys
64
from contextlib import contextmanager
5+
6+
import pytest
7+
from libcst.codemod import CodemodTest
8+
79
from bump_pydantic.codemods.replace_imports import ReplaceImportsCodemod
810

911

0 commit comments

Comments
 (0)