diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7b7129..9b5ed27 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,12 +27,12 @@ jobs: - name: Install dependencies run: uv sync --python ${{ matrix.python-version }} --frozen - - name: Run tests - run: scripts/test - - name: Run linters run: scripts/lint + - name: Run tests + run: scripts/test + # https://github.com/marketplace/actions/alls-green#why used for branch protection checks check: if: always() diff --git a/multipart/decoders.py b/multipart/decoders.py index 218abe4..135c56c 100644 --- a/multipart/decoders.py +++ b/multipart/decoders.py @@ -160,7 +160,7 @@ def finalize(self) -> None: call it. """ # If we have a cache, write and then remove it. - if len(self.cache) > 0: + if len(self.cache) > 0: # pragma: no cover self.underlying.write(binascii.a2b_qp(self.cache)) self.cache = b"" diff --git a/multipart/multipart.py b/multipart/multipart.py index eac3ff8..18d0f1d 100644 --- a/multipart/multipart.py +++ b/multipart/multipart.py @@ -142,10 +142,6 @@ class MultipartState(IntEnum): # fmt: on -def ord_char(c: int) -> int: - return c - - def parse_options_header(value: str | bytes) -> tuple[bytes, dict[bytes, bytes]]: """Parses a Content-Type header into a value in the following format: (content_type, {parameters}).""" # Uses email.message.Message to parse the header as described in PEP 594. @@ -473,7 +469,7 @@ def _get_disk_file(self) -> io.BufferedRandom | tempfile._TemporaryFileWrapper[b elif isinstance(file_dir, bytes): dir = file_dir.decode(sys.getfilesystemencoding()) else: - dir = file_dir + dir = file_dir # pragma: no cover # Create a temporary (named) file with the appropriate settings. self.logger.info( @@ -511,11 +507,7 @@ def on_data(self, data: bytes) -> int: Returns: The number of bytes written. """ - pos = self._fileobj.tell() bwritten = self._fileobj.write(data) - # true file objects write returns None - if bwritten is None: - bwritten = self._fileobj.tell() - pos # If the bytes written isn't the same as the length, just return. if bwritten != len(data): @@ -1381,7 +1373,7 @@ def data_callback(name: str, end_i: int, remaining: bool = False) -> None: elif state == MultipartState.END: # Do nothing and just consume a byte in the end state. if c not in (CR, LF): - self.logger.warning("Consuming a byte '0x%x' in the end state", c) + self.logger.warning("Consuming a byte '0x%x' in the end state", c) # pragma: no cover else: # pragma: no cover (error case) # We got into a strange state somehow! Just stop processing. diff --git a/pyproject.toml b/pyproject.toml index bc29d3e..f672c70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,7 +87,7 @@ branch = false omit = ["tests/*"] [tool.coverage.report] -# fail_under = 100 +fail_under = 100 skip_covered = true show_missing = true exclude_lines = [