Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand mypy CI checks to three more files #2636

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading