Skip to content

Commit

Permalink
feat: support 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
philtweir committed Jul 1, 2024
1 parent 13524ec commit 9161871
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions arches_orm/adapter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
from uuid import UUID
from enum import Enum
Expand Down
2 changes: 2 additions & 0 deletions arches_orm/collection.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from enum import Enum
from pathlib import Path
from uuid import UUID
Expand Down
2 changes: 2 additions & 0 deletions arches_orm/static/adapter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
from pathlib import Path
from enum import Enum
Expand Down
13 changes: 10 additions & 3 deletions arches_orm/static/datatypes/concepts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from enum import Enum
from lxml import etree as ET
import json
Expand All @@ -6,7 +8,12 @@
from pathlib import Path
from dataclasses import dataclass
from functools import partial
from typing import TypedDict, NotRequired
from typing import TypedDict
try:
from typing import NotRequired
except ImportError: # 3.9
from typing_extensions import NotRequired

from rdflib import Graph, Literal, Namespace, RDF, URIRef
from rdflib.namespace import SKOS, DCTERMS
from arches_orm.collection import make_collection, CollectionEnum
Expand Down Expand Up @@ -244,7 +251,7 @@ def update_collections(collection: CollectionEnum, source_file: Path, arches_url
cgraph.bind("skos", Namespace("http://www.w3.org/2004/02/skos/core#"))
cgraph.bind("rdf", Namespace("http://www.w3.org/1999/02/22-rdf-syntax-ns#"))
cgraph.bind("dcterms", Namespace("http://purl.org/dc/terms/"))
xml_string = cgraph.serialize(format="pretty-xml")
xml_string = cgraph.serialize(format="pretty-xml").encode("utf-8")
etree = ET.ElementTree(ET.fromstring(xml_string))
ET.indent(etree)
etree.write(str(source_file), xml_declaration=True)
Expand All @@ -255,7 +262,7 @@ def save_concept(concept: ConceptValueViewModel, output_file: Path | None, arche
if output_file is None:
raise RuntimeError(f"Could not save concept {str(concept.title())} as no source/destination - perhaps you meant to use a parent concept?")
graph = concept_to_skos(static_concept, arches_url)
xml_string = graph.serialize(format="pretty-xml")
xml_string = graph.serialize(format="pretty-xml").encode("utf-8")
etree = ET.ElementTree(ET.fromstring(xml_string))
ET.indent(etree)
etree.write(str(output_file), xml_declaration=True)
Expand Down
2 changes: 2 additions & 0 deletions arches_orm/view_models/concepts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from enum import Enum
from typing import Union, Callable, Protocol, Any
import uuid
Expand Down
2 changes: 2 additions & 0 deletions arches_orm/view_models/resources.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import uuid
import logging
from collections import UserList
Expand Down
2 changes: 2 additions & 0 deletions arches_orm/wrapper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
from typing import Any
import uuid
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ classifiers = [
"Programming Language :: Python :: 3.10",
]
dependencies = [
"python-slugify",
"typing_extensions",
"lxml",
"tabulate",
"geojson",
"rdflib",
Expand Down

0 comments on commit 9161871

Please sign in to comment.