commit 2074102da884bc6adc916931a56c7a4f9e9456a1 from: Jelmer Vernooij via: GitHub date: Mon Oct 14 23:57:00 2024 UTC Fix typing error (#1379) commit - cd0ec49d745b8cd3de2170795a4131267161230f commit + 2074102da884bc6adc916931a56c7a4f9e9456a1 blob - 93ac6d6a31f7190a2a9253b542b0b6c5d6a69c0e blob + bb4215ea1f2906e20592677462f22f889d0d7900 --- .github/workflows/pythontest.yml +++ .github/workflows/pythontest.yml @@ -43,7 +43,7 @@ jobs: python -m ruff format --check . - name: Typing checks run: | - pip install --upgrade mypy types-paramiko types-requests + pip install --upgrade types-paramiko types-requests python -m mypy dulwich if: "matrix.python-version != 'pypy3'" - name: Build blob - f9eb79992473cc7479ecb8059acbb64a20559a54 blob + 1a7f1ef606ed5fb248a3af5e30f2bbd8d948fd23 --- dulwich/refs.py +++ dulwich/refs.py @@ -24,7 +24,7 @@ import os import warnings from contextlib import suppress -from typing import Any, Dict, Optional, Set +from typing import Any, Dict, List, Optional, Set, Tuple from .errors import PackedRefsException, RefFormatError from .file import GitFile, ensure_dir_exists @@ -53,7 +53,7 @@ class SymrefLoop(Exception): self.depth = depth -def parse_symref_value(contents): +def parse_symref_value(contents: bytes) -> bytes: """Parse a symref value. Args: @@ -291,7 +291,7 @@ class RefsContainer: """ raise NotImplementedError(self.read_loose_ref) - def follow(self, name): + def follow(self, name) -> Tuple[List[bytes], bytes]: """Follow a reference name. Returns: a tuple of (refnames, sha), wheres refnames are the names of @@ -1188,7 +1188,7 @@ def _set_origin_head(refs, origin, origin_head): def _set_default_branch( refs: RefsContainer, origin: bytes, - origin_head: bytes, + origin_head: Optional[bytes], branch: bytes, ref_message: Optional[bytes], ) -> bytes: blob - dc05031da191a42d5bef36153a2399a196a8273b blob + 518414d3d6ee7e1b06dcdaf75a9274c364e2405e --- pyproject.toml +++ pyproject.toml @@ -42,7 +42,8 @@ https = ["urllib3>=1.24.1"] pgp = ["gpg"] paramiko = ["paramiko"] dev = [ - "ruff==0.6.9" + "ruff==0.6.9", + "mypy==1.12.0" ] [project.scripts]