obographs 0.0.4__py3-none-any.whl → 0.0.6__py3-none-any.whl

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/model.py CHANGED
@@ -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(source: str, *, timeout: TimeoutHint = ..., squeeze: Literal[True] = ...) -> Graph: ...
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 (isinstance(source, str) and source.startswith("https://")) or source.startswith("http://"):
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"):
obographs/standardized.py CHANGED
@@ -203,7 +203,7 @@ class StandardizedSynonym(StandardizedBaseModel[Synonym]):
203
203
  class StandardizedMeta(StandardizedBaseModel[Meta]):
204
204
  """A standardized meta object."""
205
205
 
206
- definition: StandardizedDefinition | None
206
+ definition: StandardizedDefinition | None = None
207
207
  subsets: list[Reference] | None = None
208
208
  xrefs: list[StandardizedXref] | None = None
209
209
  synonyms: list[StandardizedSynonym] | None = None
@@ -261,7 +261,9 @@ class StandardizedMeta(StandardizedBaseModel[Meta]):
261
261
  return cls(
262
262
  definition=StandardizedDefinition.from_obograph_raw(
263
263
  meta.definition, converter, strict=strict
264
- ),
264
+ )
265
+ if meta.definition is not None
266
+ else None,
265
267
  subsets=[
266
268
  _curie_or_uri_to_ref(subset, converter, strict=strict) for subset in meta.subsets
267
269
  ]
obographs/version.py CHANGED
@@ -12,7 +12,7 @@ __all__ = [
12
12
  "get_version",
13
13
  ]
14
14
 
15
- VERSION = "0.0.4"
15
+ VERSION = "0.0.6"
16
16
 
17
17
 
18
18
  def get_git_hash() -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: obographs
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: A python data model for OBO Graphs
5
5
  Keywords: snekpack,cookiecutter
6
6
  Author: Charles Tapley Hoyt
@@ -0,0 +1,10 @@
1
+ obographs/__init__.py,sha256=55f4bf18441bd7f6c41afa68d094532933b02b21dbdd20679cf8807c1791d494,1601
2
+ obographs/model.py,sha256=b788ef49c630062756c2f5b4d432b8211dd2461efde0b60163ea2e921de85e42,8771
3
+ obographs/py.typed,sha256=01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b,1
4
+ obographs/standardized.py,sha256=43ee42d342f33df38f24151339cdeb6525252af541366149c7719d188901a52f,25863
5
+ obographs/version.py,sha256=2a1a313b49e1a693ffa4dc1a6081dc40aaece02e67d214f42b5502ea75170500,961
6
+ obographs-0.0.6.dist-info/licenses/LICENSE,sha256=4be0ec343e3bf11fd54321a6b576d5616ebb7d18898f741f63c517209e33bcb2,1076
7
+ obographs-0.0.6.dist-info/WHEEL,sha256=65f6765ba93534713730ff2172cd912ef280aa42867625a73f77c2fef0639dae,78
8
+ obographs-0.0.6.dist-info/entry_points.txt,sha256=9a9819cedd2186e28d5d42ddce5e3de1417b0db2b07392ff35f9adc7c86a8619,50
9
+ obographs-0.0.6.dist-info/METADATA,sha256=686e6d277ab0221b4cc2556d637a77c68b3f1814aa204d52f3a681d7a3eaf3fb,12768
10
+ obographs-0.0.6.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- obographs/__init__.py,sha256=55f4bf18441bd7f6c41afa68d094532933b02b21dbdd20679cf8807c1791d494,1601
2
- obographs/model.py,sha256=1f1bda132b83d8e08d7301eddb9be8d58b7e61c5b30e9baab9c24fd22348db53,8457
3
- obographs/py.typed,sha256=01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b,1
4
- obographs/standardized.py,sha256=69d26bbd35b49232b8d4bc2ae462f864f4fffcadf3acb7d541783fc8745dbd5e,25791
5
- obographs/version.py,sha256=c50bb52fc81eb5b19dedfb8583a0c19b6127aff659301cb2d3d51f4d244fefc3,961
6
- obographs-0.0.4.dist-info/licenses/LICENSE,sha256=4be0ec343e3bf11fd54321a6b576d5616ebb7d18898f741f63c517209e33bcb2,1076
7
- obographs-0.0.4.dist-info/WHEEL,sha256=65f6765ba93534713730ff2172cd912ef280aa42867625a73f77c2fef0639dae,78
8
- obographs-0.0.4.dist-info/entry_points.txt,sha256=9a9819cedd2186e28d5d42ddce5e3de1417b0db2b07392ff35f9adc7c86a8619,50
9
- obographs-0.0.4.dist-info/METADATA,sha256=ac4daf3fa7f23379788e758debc91663ee15663ee1c9fabbf79bc69ca79c5e5b,12768
10
- obographs-0.0.4.dist-info/RECORD,,