obographs 0.0.5__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {obographs-0.0.5 → obographs-0.0.6}/PKG-INFO +1 -1
- {obographs-0.0.5 → obographs-0.0.6}/pyproject.toml +2 -2
- {obographs-0.0.5 → obographs-0.0.6}/src/obographs/model.py +13 -5
- {obographs-0.0.5 → obographs-0.0.6}/src/obographs/version.py +1 -1
- {obographs-0.0.5 → obographs-0.0.6}/LICENSE +0 -0
- {obographs-0.0.5 → obographs-0.0.6}/README.md +0 -0
- {obographs-0.0.5 → obographs-0.0.6}/src/obographs/__init__.py +0 -0
- {obographs-0.0.5 → obographs-0.0.6}/src/obographs/py.typed +0 -0
- {obographs-0.0.5 → obographs-0.0.6}/src/obographs/standardized.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "obographs"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.6"
|
|
8
8
|
description = "A python data model for OBO Graphs"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -232,7 +232,7 @@ known-first-party = [
|
|
|
232
232
|
docstring-code-format = true
|
|
233
233
|
|
|
234
234
|
[tool.bumpversion]
|
|
235
|
-
current_version = "0.0.
|
|
235
|
+
current_version = "0.0.6"
|
|
236
236
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(?:-(?P<release>[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+(?P<build>[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?"
|
|
237
237
|
serialize = [
|
|
238
238
|
"{major}.{minor}.{patch}-{release}+{build}",
|
|
@@ -21,7 +21,7 @@ from curies.vocabulary import SynonymScopeOIO
|
|
|
21
21
|
from pydantic import BaseModel, Field
|
|
22
22
|
|
|
23
23
|
if TYPE_CHECKING:
|
|
24
|
-
from .standardized import StandardizedGraph
|
|
24
|
+
from .standardized import StandardizedGraph, StandardizedGraphDocument
|
|
25
25
|
|
|
26
26
|
__all__ = [
|
|
27
27
|
"Definition",
|
|
@@ -197,6 +197,12 @@ class GraphDocument(BaseModel):
|
|
|
197
197
|
graphs: list[Graph]
|
|
198
198
|
meta: Meta | None = None
|
|
199
199
|
|
|
200
|
+
def standardize(self, converter: curies.Converter) -> StandardizedGraphDocument:
|
|
201
|
+
"""Standardize the graph."""
|
|
202
|
+
from .standardized import StandardizedGraphDocument
|
|
203
|
+
|
|
204
|
+
return StandardizedGraphDocument.from_obograph_raw(self, converter)
|
|
205
|
+
|
|
200
206
|
|
|
201
207
|
def get_id_to_node(graph: Graph) -> dict[str, Node]:
|
|
202
208
|
"""Get a dictionary from node ID to nodes."""
|
|
@@ -214,17 +220,19 @@ def get_id_to_edges(graph: Graph) -> dict[str, list[tuple[str, str]]]:
|
|
|
214
220
|
# docstr-coverage:excused `overload`
|
|
215
221
|
@overload
|
|
216
222
|
def read(
|
|
217
|
-
source: str, *, timeout: TimeoutHint = ..., squeeze: Literal[False] = ...
|
|
223
|
+
source: str | Path, *, timeout: TimeoutHint = ..., squeeze: Literal[False] = ...
|
|
218
224
|
) -> GraphDocument: ...
|
|
219
225
|
|
|
220
226
|
|
|
221
227
|
# docstr-coverage:excused `overload`
|
|
222
228
|
@overload
|
|
223
|
-
def read(
|
|
229
|
+
def read(
|
|
230
|
+
source: str | Path, *, timeout: TimeoutHint = ..., squeeze: Literal[True] = ...
|
|
231
|
+
) -> Graph: ...
|
|
224
232
|
|
|
225
233
|
|
|
226
234
|
def read(
|
|
227
|
-
source: str, *, timeout: TimeoutHint = None, squeeze: bool = True
|
|
235
|
+
source: str | Path, *, timeout: TimeoutHint = None, squeeze: bool = True
|
|
228
236
|
) -> Graph | GraphDocument:
|
|
229
237
|
"""Read an OBO Graph document.
|
|
230
238
|
|
|
@@ -239,7 +247,7 @@ def read(
|
|
|
239
247
|
|
|
240
248
|
:raises ValueError: If squeeze is set to true and multiple graphs are received
|
|
241
249
|
"""
|
|
242
|
-
if
|
|
250
|
+
if isinstance(source, str) and (source.startswith("https://") or source.startswith("http://")):
|
|
243
251
|
import requests
|
|
244
252
|
|
|
245
253
|
if source.endswith(".gz"):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|