Skip to content

mypy type checker fails on 5.4.0 ProjectFileManager raw method #3104

Description

@kesmik

Description of the problem, including code/CLI snippet

After update to 5.4.0 I have noticed that overloaded methods break my file download raw method type checking for both: tempfile and regular file stream.

Is this something I am doing something wrong, or 36d9b24 commit break this and needs to be addressed?

Expected Behavior

Passing mypy

Actual Behavior

        with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as f:
            self._tmp_file = f
            project = self._api.projects.get(file_info.prj_id, lazy=True)
            project.files.raw(
                file_path=file_info.path,
                ref=file_info.ref,
                streamed=True,
                action=f.write,
            )

error: No overload variant of "raw" of "ProjectFileManager" matches argument types "str", "str", "bool", overloaded function  [call-overload]
        with open("test.file", "wb") as f:
            self._tmp_file = f
            project = self._api.projects.get(file_info.prj_id, lazy=True)
            project.files.raw(
                file_path=file_info.path,
                ref=file_info.ref,
                streamed=True,
                action=f.write,
            )

error: No overload variant of "raw" of "ProjectFileManager" matches argument types "str", "str", "bool", "Callable[[Buffer], int]"  [call-overload]

Specifications

  • python-gitlab version: 5.4.0
  • Gitlab server version (or gitlab.com): v17.4.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions