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

⬆️ update black and ruff and 🎨 apply formatting #86

Merged
merged 6 commits into from
Mar 26, 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
4 changes: 3 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- uses: psf/black@24.3.0
with:
src: "./pydid"
- uses: chartboost/ruff-action@v1
with:
version: 0.3.4

test:
name: Tests
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ repos:
args: ["--config", ".commitlint.config.js"]
additional_dependencies: ['@commitlint/config-conventional']
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.3.0
hooks:
- id: black
stages: [commit]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
rev: v0.3.4
hooks:
- id: ruff
stages: [commit]
Expand Down
2,220 changes: 1,108 additions & 1,112 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pydid/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Common components."""

import re

DID_REGEX = "did:([a-z0-9]+):((?:[a-zA-Z0-9._%-]*:)*[a-zA-Z0-9._%-]+)"
Expand Down
1 change: 1 addition & 0 deletions pydid/did_url.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""DID URL Object."""

from typing import Dict, Optional, TYPE_CHECKING
from urllib.parse import parse_qsl, urlencode, urlparse

Expand Down
14 changes: 7 additions & 7 deletions pydid/doc/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(
did: DID,
*,
id_base: str = None,
methods: Optional[List[VerificationMethod]] = None
methods: Optional[List[VerificationMethod]] = None,
):
"""Initialize builder."""
self._did = did
Expand All @@ -42,7 +42,7 @@ def add(
type_: Type[VerificationMethod],
ident: Optional[str] = None,
controller: DID = None,
**kwargs
**kwargs,
):
"""Add verification method from parts and context."""
ident = ident or next(self._id_generator)
Expand All @@ -64,7 +64,7 @@ def __init__(
did: DID,
id_base: str,
*,
methods: Optional[List[Union[VerificationMethod, DIDUrl]]] = None
methods: Optional[List[Union[VerificationMethod, DIDUrl]]] = None,
):
"""Initialize builder."""
super().__init__(did, id_base=id_base)
Expand Down Expand Up @@ -132,7 +132,7 @@ def add(
id=self._did.ref(ident),
type=type_,
service_endpoint=service_endpoint,
**extra
**extra,
)
self.services.append(service)
return service
Expand All @@ -146,7 +146,7 @@ def add_didcomm(
priority: Optional[int] = None,
type_: Optional[str] = None,
ident: Optional[str] = None,
accept: Optional[List[str]] = None
accept: Optional[List[str]] = None,
):
"""Add DIDComm Service."""
ident = ident or next(self._id_generator)
Expand Down Expand Up @@ -184,7 +184,7 @@ def __init__(
context: List[str] = None,
*,
also_known_as: List[str] = None,
controller: Union[List[str], List[DID]] = None
controller: Union[List[str], List[DID]] = None,
):
"""Initliaze builder."""
self.id: DID = DID(id)
Expand Down Expand Up @@ -252,5 +252,5 @@ def build(self) -> DIDDocument:
capability_invocation=self.capability_invocation.methods or None,
capability_delegation=self.capability_delegation.methods or None,
service=self.service.services or None,
**self.extra
**self.extra,
)
6 changes: 2 additions & 4 deletions pydid/doc/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ class IDNotFoundError(DIDDocumentError):
class DIDDocumentRoot(Resource):
"""Representation of DID Document."""

context: Annotated[
List[Union[str, dict]], Field(alias="@context")
] = [ # noqa: F722
context: Annotated[List[Union[str, dict]], Field(alias="@context")] = [
"https://www.w3.org/ns/did/v1"
]
] # noqa: F722
id: DID
also_known_as: Optional[List[str]] = None
controller: Optional[List[DID]] = None
Expand Down
1 change: 1 addition & 0 deletions pydid/resource.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Resource class that forms the base of all DID Document components."""

from abc import ABC, abstractmethod
import json
from typing import Any, Dict, Type, TypeVar
Expand Down
6 changes: 3 additions & 3 deletions pydid/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class Config:

extra = Extra.forbid

type: Literal[
"IndyAgent", "did-communication", "DIDCommMessaging"
] = "did-communication"
type: Literal["IndyAgent", "did-communication", "DIDCommMessaging"] = (
"did-communication"
)
service_endpoint: EndpointStrings
recipient_keys: List[DIDUrl]
routing_keys: List[DIDUrl] = []
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ inflection = "^0.5.1"

[tool.poetry.dev-dependencies]
pytest = "^7.4.0"
black = "^23.7.0"
black = "^24.3.0"
poetry = "^1.5.0"
pre-commit = "^3.3.0"
ruff = "^0.0.287"
ruff = "^0.3.4"
pytest-coverage = "^0.0"
aiohttp = "^3.8.0"
pytest-asyncio = "^0.21.0"
Expand All @@ -45,9 +45,9 @@ precision = 2
show_missing = true

[tool.ruff]
select = ["E", "F", "C", "D"]
lint.select = ["E", "F", "C", "D"]

ignore = [
lint.ignore = [
# Google Python Doc Style
"D203", "D204", "D213", "D215", "D400", "D401", "D404", "D406", "D407",
"D408", "D409", "D413",
Expand All @@ -57,5 +57,5 @@ ignore = [

line-length = 90

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"**/{tests}/*" = ["F841", "D", "E501"]
1 change: 1 addition & 0 deletions tests/test_corrections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test DID Document corrections."""

import pytest

from pydid.doc.corrections import insert_missing_ids
Expand Down
Loading