Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
4 changes: 2 additions & 2 deletions dissect/executable/elf/elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io
from functools import cached_property, lru_cache
from operator import itemgetter
from typing import TYPE_CHECKING, BinaryIO, Callable, Generic, TypeVar
from typing import TYPE_CHECKING, BinaryIO, Generic, TypeVar

from dissect.executable.elf.c_elf import (
SHN,
Expand All @@ -19,7 +19,7 @@
from dissect.executable.exception import InvalidSignatureError

if TYPE_CHECKING:
from collections.abc import Iterator
from collections.abc import Callable, Iterator

from dissect.cstruct import cstruct

Expand Down
3 changes: 1 addition & 2 deletions dissect/executable/pe/c_pe.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Generated by cstruct-stubgen
from typing import BinaryIO, Literal, overload
from typing import BinaryIO, Literal, TypeAlias, overload

import dissect.cstruct as __cs__
from typing_extensions import TypeAlias

class _c_pe(__cs__.cstruct):
IMAGE_DOS_SIGNATURE: Literal[23117] = ...
Expand Down
2 changes: 1 addition & 1 deletion dissect/executable/pe/directory/delay_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def functions(self) -> list[DelayImportFunction]:
return [
DelayImportFunction(self, name_thunk, address_thunk, bound_thunk, unload_thunk)
for name_thunk, address_thunk, bound_thunk, unload_thunk in zip(
name_table, address_table, bound_table, unload_table
name_table, address_table, bound_table, unload_table, strict=False
)
]

Expand Down
2 changes: 1 addition & 1 deletion dissect/executable/pe/directory/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def functions(self) -> list[ExportFunction]:
self.pe.vfh.seek(self.header.AddressOfNameOrdinals)
ordinals = c_pe.USHORT[self.header.NumberOfNames](self.pe.vfh)

for name_ptr, ordinal in zip(names, ordinals):
for name_ptr, ordinal in zip(names, ordinals, strict=False):
self.pe.vfh.seek(name_ptr)
name = c_pe.CHAR[None](self.pe.vfh).decode()

Expand Down
2 changes: 1 addition & 1 deletion dissect/executable/pe/directory/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def functions(self) -> list[ImportFunction]:

return [
ImportFunction(self, lookup_thunk, address_thunk)
for lookup_thunk, address_thunk in zip(lookup_table, address_table)
for lookup_thunk, address_thunk in zip(lookup_table, address_table, strict=False)
]

@cached_property
Expand Down
4 changes: 2 additions & 2 deletions dissect/executable/pe/directory/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from functools import cached_property
from io import BytesIO
from typing import TYPE_CHECKING, Any, BinaryIO, Union
from typing import TYPE_CHECKING, Any, BinaryIO

from dissect.util.ts import from_unix, wintimestamp

Expand Down Expand Up @@ -268,7 +268,7 @@ def vs_version_info(self, language: str | int | None = None) -> dict | None:
if len(version) != 1:
raise ValueError(f"Expected exactly one version resource, found {len(version)}")

_Node: TypeAlias = tuple[str, Union[str, bytes, None], list["_Node"]]
_Node: TypeAlias = tuple[str, str | bytes | None, list["_Node"]]

def _parse_lvt(fh: BinaryIO) -> _Node | None:
start = fh.tell()
Expand Down
26 changes: 23 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[build-system]
requires = ["setuptools>=65.5.0", "setuptools_scm[toml]>=6.4.0"]
requires = ["setuptools>=77.0.0", "setuptools_scm[toml]>=6.4.0"]
build-backend = "setuptools.build_meta"

[project]
name = "dissect.executable"
description = "A Dissect module implementing a parsers for various executable formats such as PE, ELF and Macho-O"
readme = "README.md"
requires-python = "~=3.9"
requires-python = ">=3.10"
license = "AGPL-3.0-or-later"
license-files = ["LICENSE", "COPYRIGHT"]
authors = [
Expand Down Expand Up @@ -41,9 +41,29 @@ dev = [
"dissect.util>=3.0.dev,<4.0.dev",
]

[dependency-groups]
test = [
"pytest",
]
lint = [
"ruff==0.13.1",
"vermin",
]
build = [
"build",
]
debug = [
"ipdb",
]
dev = [
{include-group = "test"},
{include-group = "lint"},
{include-group = "debug"},
]

[tool.ruff]
line-length = 120
required-version = ">=0.12.0"
required-version = ">=0.13.1"

[tool.ruff.format]
docstring-code-format = true
Expand Down
18 changes: 8 additions & 10 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ envlist = lint, py3, pypy3
# requires if they are not available on the host system. This requires the
# locally installed tox to have a minimum version 3.3.0. This means the names
# of the configuration options are still according to the tox 3.x syntax.
minversion = 4.4.3
minversion = 4.27.0
# This version of virtualenv will install setuptools version 68.2.2 and pip
# 23.3.1. These versions fully support python projects defined only through a
# pyproject.toml file (PEP-517/PEP-518/PEP-621). This pip version also support
Expand All @@ -14,36 +14,34 @@ requires = virtualenv>=20.24.6
[testenv]
extras = dev
deps =
pytest
pytest-cov
coverage
dependency_groups = test
commands =
pytest --basetemp="{envtmpdir}" {posargs:--color=yes --cov=dissect --cov-report=term-missing -v tests}
coverage report
coverage xml

[testenv:build]
package = skip
deps =
build
dependency_groups = build
commands =
pyproject-build

[testenv:fix]
package = skip
deps =
ruff==0.12.3
dependency_groups = lint
commands =
ruff check --fix dissect tests
ruff format dissect tests

[testenv:lint]
package = skip
deps =
ruff==0.12.3
vermin
dependency_groups = lint
commands =
ruff check dissect tests
vermin -t=3.9- --no-tips --lint dissect tests
ruff format --check dissect tests
vermin -t=3.10- --no-tips --lint dissect tests

[flake8]
max-line-length = 120
Expand Down
Loading