Skip to content

Commit

Permalink
refactor: Update dependencies and code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
titusz committed Feb 11, 2025
1 parent 4b54f56 commit 53f3454
Show file tree
Hide file tree
Showing 11 changed files with 600 additions and 670 deletions.
13 changes: 10 additions & 3 deletions iscc_schema/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
https://gist.github.com/yu-ichiro/87c29b96cbddb44bdd8fc50b68de5a77
"""

import re
from re import Pattern
from typing import Dict, Any, cast
Expand Down Expand Up @@ -77,7 +78,9 @@ class RFC3986Regex:
PATH_NO_SCHEME: Pattern = rf"{SEGMENT_NZ_NC}(/{SEGMENT})*"
PATH_ABSOLUTE: Pattern = rf"/({SEGMENT_NZ}(/{SEGMENT})*)?"
PATH_ABSOLUTE_EMPTY: Pattern = rf"(/{SEGMENT})*"
PATH: Pattern = rf"(?P<path>{PATH_ABSOLUTE_EMPTY}|{PATH_ABSOLUTE}|{PATH_NO_SCHEME}|{PATH_ROOTLESS}|{PATH_EMPTY})"
PATH: Pattern = (
rf"(?P<path>{PATH_ABSOLUTE_EMPTY}|{PATH_ABSOLUTE}|{PATH_NO_SCHEME}|{PATH_ROOTLESS}|{PATH_EMPTY})"
)

QUERY: Pattern = rf"({PATH_CHAR}|[/\?])*"
FRAGMENT: Pattern = rf"({PATH_CHAR}|[/\?])*"
Expand All @@ -89,7 +92,9 @@ class RFC3986Regex:
rf"(?P<path_rootless>{PATH_ROOTLESS})|"
rf"{PATH_EMPTY})"
)
URI: Pattern = rf"{SCHEME}:{HIERARCHY_PART}(?P<query_full>\?(?P<query>{QUERY}))?(?P<fragment_full>#(?P<fragment>{FRAGMENT}))?"
URI: Pattern = (
rf"{SCHEME}:{HIERARCHY_PART}(?P<query_full>\?(?P<query>{QUERY}))?(?P<fragment_full>#(?P<fragment>{FRAGMENT}))?"
)

RELATIVE_PART: Pattern = (
rf"(?P<relative_part>"
Expand All @@ -98,7 +103,9 @@ class RFC3986Regex:
rf"(?P<path_no_scheme>{PATH_NO_SCHEME})|"
rf"{PATH_EMPTY})"
)
RELATIVE_REFERENCE: Pattern = rf"{RELATIVE_PART}(?P<query_full>\?(?P<query>{QUERY}))?(?P<fragment_full>#(?P<fragment>{FRAGMENT}))?"
RELATIVE_REFERENCE: Pattern = (
rf"{RELATIVE_PART}(?P<query_full>\?(?P<query>{QUERY}))?(?P<fragment_full>#(?P<fragment>{FRAGMENT}))?"
)

def __init__(self):
self._cache = {}
Expand Down
1,241 changes: 583 additions & 658 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ keywords=["iscc", "identifier", "media", "content", "hash", "blockchain", "simil


[tool.poetry.dependencies]
python = ">=3.7,<4.0.0"
python = ">=3.9,<4.0.0"
pydantic = "*"
jcs = "^0.2"

Expand All @@ -31,8 +31,9 @@ requests = "*"

[tool.black]
line-length = 100
target-version = ['py37']
preview = true
enable-unstable-feature = ["string_processing"]
target-version = ['py310']


[tool.poe.tasks]
Expand Down
3 changes: 1 addition & 2 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def test_validate_uri_ipfs():

def test_json():
assert (
iss.IsccMeta().json()
== f"{{"
iss.IsccMeta().json() == f"{{"
f'"@context": "http://purl.org/iscc/context", "@type": '
f'"CreativeWork", "$schema": "http://purl.org/iscc/schema"'
f"}}"
Expand Down
1 change: 0 additions & 1 deletion tools/build_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pathlib
from datamodel_code_generator import InputFileType, generate, OpenAPIScope, PythonVersion


ROOT = pathlib.Path(__file__).parent.parent
CODE = ROOT / "iscc_schema"
APIS = CODE / "reference"
Expand Down
1 change: 1 addition & 0 deletions tools/build_docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Copy README.md to documentation index.md"""

from os.path import abspath, dirname, join
from textwrap import indent

Expand Down
1 change: 1 addition & 0 deletions tools/build_json_ld_context.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Build docs/context/<v>.json JSON-LD file from iscc_core.schema"""

from typing import Dict

import iscc_schema.schema
Expand Down
2 changes: 1 addition & 1 deletion tools/build_json_schema.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Build JSON Schema file from Pydantic model"""

import json
import yaml
from os.path import dirname, abspath, join
import iscc_schema


HERE = dirname(abspath(__file__))
PATH_YAML = join(HERE, f"../iscc_schema/models/iscc-collection.yaml")
PATH_LATEST = join(HERE, f"../docs/schema/iscc.json")
Expand Down
1 change: 0 additions & 1 deletion tools/build_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pathlib
import yaml


ROOT = pathlib.Path(__file__).parent.parent.absolute()
SCHEMAS = ROOT / "iscc_schema/models"
MARKDOWN_TERMS_SCHEMA = ROOT / "docs/includes/terms-schema.md"
Expand Down
1 change: 0 additions & 1 deletion tools/convert_lf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pathlib


HERE = pathlib.Path(__file__).parent.absolute()


Expand Down
1 change: 0 additions & 1 deletion tools/format_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import pathlib
import yaml


HERE = pathlib.Path(__file__).parent.absolute()


Expand Down

0 comments on commit 53f3454

Please sign in to comment.