Skip to content

Commit

Permalink
Merge pull request #53
Browse files Browse the repository at this point in the history
v3.1.1
  • Loading branch information
MatteoCampinoti94 authored Oct 3, 2024
2 parents b948dc1 + 7085a7e commit d791ef9
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 13 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: abatilo/actions-poetry@v2
- uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
- run: poetry install
Expand Down Expand Up @@ -46,15 +46,18 @@ jobs:
pytest:
name: pytest
runs-on: ubuntu-latest
needs:
- linting
- version
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: abatilo/actions-poetry@v2
- uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ env.POETRY_VERSION }}
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
- run: poetry install
- run: go install github.com/richardlehane/siegfried/cmd/sf@latest
- name: Unit test
Expand Down
2 changes: 1 addition & 1 deletion acacore/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.1.0"
__version__ = "3.1.1"
10 changes: 6 additions & 4 deletions acacore/models/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,13 @@ def get_action(
action: Action | None = reduce(lambda acc, cur: acc or actions.get(cur), identifiers, None)

if action and action.alternatives and (new_puid := action.alternatives.get(self.suffixes.lower(), None)):
puid: str = self.puid
puid: str | None = self.puid
self.puid = new_puid
if new_action := self.get_action(actions, file_classes, set_match=set_match):
return new_action
self.puid = puid
if new_action := self.get_action(actions, file_classes):
action = new_action
self.signature = action.name
else:
self.puid = puid

if set_match:
self.action, self.action_data = (
Expand Down
13 changes: 11 additions & 2 deletions acacore/models/reference_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@ class CustomSignature(BaseModel):
:param extension: The file extension associated with the signature.
"""

puid: str
signature: str
bof: str | None = None
eof: str | None = None
operator: str | None = None
puid: str | None = None
signature: str | None = None
extension: str | None = None

# noinspection PyNestedDecorators
@model_validator(mode="after")
def _validate_model(self) -> Self:
if not self.bof and not self.eof:
raise ValueError("One of bof or eof must be set.")
if self.bof and self.eof and not self.operator:
raise ValueError("Operator must be set if both bof and eof are set.")
return self


class IgnoreIfAction(NoDefaultsModel):
"""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "acacore"
version = "3.1.0"
version = "3.1.1"
description = ""
authors = ["Matteo Campinoti <[email protected]>"]
license = "GPL-3.0"
Expand Down

0 comments on commit d791ef9

Please sign in to comment.