Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: small fixes and chores #85

Merged
merged 9 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12

- name: Install poetry
run: |
Expand Down
3 changes: 2 additions & 1 deletion dsp_permissions_scripts/ap/ap_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dsp_permissions_scripts.ap.ap_model import Ap
from dsp_permissions_scripts.ap.ap_model import ApValue
from dsp_permissions_scripts.models.errors import ApiError
from dsp_permissions_scripts.models.group import Group
from dsp_permissions_scripts.utils.dsp_client import DspClient
from dsp_permissions_scripts.utils.get_logger import get_logger
from dsp_permissions_scripts.utils.project import (
Expand All @@ -16,7 +17,7 @@
def create_ap_from_admin_route_object(permission: dict[str, Any]) -> Ap:
"""Deserializes a AP from JSON as returned by /admin/permissions/ap/{project_iri}"""
ap = Ap(
forGroup=permission["forGroup"],
forGroup=Group(val=permission["forGroup"]),
forProject=permission["forProject"],
hasPermissions=frozenset(ApValue(p["name"]) for p in permission["hasPermissions"]),
iri=permission["iri"],
Expand Down
3 changes: 2 additions & 1 deletion dsp_permissions_scripts/doap/doap_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dsp_permissions_scripts.doap.doap_model import DoapTarget
from dsp_permissions_scripts.doap.doap_model import DoapTargetType
from dsp_permissions_scripts.models.errors import ApiError
from dsp_permissions_scripts.models.group import Group
from dsp_permissions_scripts.utils.dsp_client import DspClient
from dsp_permissions_scripts.utils.get_logger import get_logger
from dsp_permissions_scripts.utils.project import (
Expand Down Expand Up @@ -55,7 +56,7 @@ def create_doap_from_admin_route_response(permission: dict[str, Any]) -> Doap:
doap = Doap(
target=DoapTarget(
project=permission["forProject"],
group=permission["forGroup"],
group=Group(val=permission["forGroup"]),
resource_class=permission["forResourceClass"],
property=permission["forProperty"],
),
Expand Down
1 change: 1 addition & 0 deletions dsp_permissions_scripts/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from dsp_permissions_scripts.utils.dsp_client import DspClient
from dsp_permissions_scripts.utils.get_logger import log_start_of_script

# pylint: disable=R0801 # Similar lines in 2 files

def modify_aps(aps: list[Ap]) -> list[Ap]:
"""Adapt this sample to your needs."""
Expand Down
2 changes: 1 addition & 1 deletion dsp_permissions_scripts/utils/dsp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class DspClient:
server: str
token: Optional[str] = None
session: Session = field(init=False, default=Session())
timeout: int = field(init=False, default=20)
timeout: int = field(init=False, default=30)

def __post_init__(self) -> None:
self.session.headers["User-Agent"] = f"{PACKAGE_NAME.upper()}/{version(PACKAGE_NAME)}"
Expand Down
603 changes: 288 additions & 315 deletions poetry.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ readme = "README.md"
version = "0.1.0"

[tool.poetry.dependencies]
python = "^3.11"
python = "^3.12.0"
requests = "^2.31.0"
pydantic = "^2.4.2"
pydantic = "^2.6.4"

[tool.poetry.group.dev.dependencies]
mypy = "^1.6.1"
types-requests = "^2.31.0.10"
python-dotenv = "^1.0.0"
black = "^23.10.0"
pylint = "^3.0.1"
mypy = "^1.9.0"
types-requests = "^2.31.0.20240406"
python-dotenv = "^1.0.1"
black = "^24.3.0"
pylint = "^3.1.0"

[build-system]
build-backend = "poetry.core.masonry.api"
Expand Down