Skip to content

Commit

Permalink
Expand mypy CI checks to three more files
Browse files Browse the repository at this point in the history
  • Loading branch information
correctmost authored and DanielNoord committed Nov 17, 2024
1 parent 2d26795 commit 4c8af23
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion astroid/brain/brain_mechanize.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt

from astroid import nodes
from astroid.brain.helpers import register_module_extender
from astroid.builder import AstroidBuilder
from astroid.manager import AstroidManager


def mechanize_transform():
def mechanize_transform() -> nodes.Module:
return AstroidBuilder(AstroidManager()).string_build(
"""class Browser(object):
def __getattr__(self, name):
Expand Down
3 changes: 2 additions & 1 deletion astroid/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

if TYPE_CHECKING:
from astroid import constraint, nodes
from astroid.nodes.node_classes import Keyword, NodeNG
from astroid.nodes.node_classes import Keyword
from astroid.nodes.node_ng import NodeNG

_InferenceCache = dict[
tuple["NodeNG", Optional[str], Optional[str], Optional[str]], Sequence["NodeNG"]
Expand Down
6 changes: 3 additions & 3 deletions astroid/modutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def _get_relative_base_path(filename: str, path_to_check: str) -> list[str] | No

def modpath_from_file_with_callback(
filename: str,
path: Sequence[str] | None = None,
path: list[str] | None = None,
is_package_cb: Callable[[str, list[str]], bool] | None = None,
) -> list[str]:
filename = os.path.expanduser(_path_from_filename(filename))
Expand All @@ -298,7 +298,7 @@ def modpath_from_file_with_callback(
)


def modpath_from_file(filename: str, path: Sequence[str] | None = None) -> list[str]:
def modpath_from_file(filename: str, path: list[str] | None = None) -> list[str]:
"""Get the corresponding split module's name from a filename.
This function will return the name of a module or package split on `.`.
Expand Down Expand Up @@ -607,7 +607,7 @@ def is_relative(modname: str, from_file: str) -> bool:


@lru_cache(maxsize=1024)
def cached_os_path_isfile(path: str | os.PathLike) -> bool:
def cached_os_path_isfile(path: str | os.PathLike[str]) -> bool:
"""A cached version of os.path.isfile that helps avoid repetitive I/O"""
return os.path.isfile(path)

Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ files = [
"astroid/brain/brain_hashlib.py",
"astroid/brain/brain_http.py",
"astroid/brain/brain_hypothesis.py",
"astroid/brain/brain_mechanize.py",
"astroid/brain/brain_numpy_core_einsumfunc.py",
"astroid/brain/brain_numpy_core_fromnumeric.py",
"astroid/brain/brain_numpy_core_function_base.py",
Expand All @@ -95,7 +96,9 @@ files = [
"astroid/brain/brain_unittest.py",
"astroid/brain/brain_uuid.py",
"astroid/const.py",
"astroid/context.py",
"astroid/interpreter/_import/",
"astroid/modutils.py",
"astroid/nodes/const.py",
"astroid/nodes/utils.py",
]
Expand Down

0 comments on commit 4c8af23

Please sign in to comment.