Skip to content

Commit

Permalink
I knew it was a mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
InnocentBug committed Mar 13, 2024
1 parent 0ee6abb commit 90698b3
Show file tree
Hide file tree
Showing 18 changed files with 215 additions and 220 deletions.
22 changes: 12 additions & 10 deletions src/cript/nodes/primary_nodes/collection.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from dataclasses import dataclass, field, replace
from typing import Any, List, Optional
from typing import Any, List, Optional, Union

from beartype import beartype

from cript.nodes.primary_nodes.primary_base_node import PrimaryBaseNode
from cript.nodes.supporting_nodes import User
from cript.nodes.util.json import NodeUID
from cript.nodes.util.json import UIDProxy


class Collection(PrimaryBaseNode):
Expand Down Expand Up @@ -57,17 +57,19 @@ class JsonAttributes(PrimaryBaseNode.JsonAttributes):
"""

# TODO add proper typing in future, using Any for now to avoid circular import error
member: List[NodeUID[User]] = field(default_factory=list)
admin: List[NodeUID[User]] = field(default_factory=list)
experiment: List[NodeUID[Any]] = field(default_factory=list)
inventory: List[NodeUID[Any]] = field(default_factory=list)
member: List[Union[User, UIDProxy]] = field(default_factory=list)
admin: List[Union[User, UIDProxy]] = field(default_factory=list)
experiment: List[Union[Any, UIDProxy]] = field(default_factory=list)
inventory: List[Union[Any, UIDProxy]] = field(default_factory=list)
doi: str = ""
citation: List[NodeUID[Any]] = field(default_factory=list)
citation: List[Union[Any, UIDProxy]] = field(default_factory=list)

_json_attrs: JsonAttributes = JsonAttributes()

@beartype
def __init__(self, name: str, experiment: Optional[List[NodeUID[Any]]] = None, inventory: Optional[List[NodeUID[Any]]] = None, doi: str = "", citation: Optional[List[NodeUID[Any]]] = None, notes: str = "", **kwargs) -> None:
def __init__(
self, name: str, experiment: Optional[List[Union[Any, UIDProxy]]] = None, inventory: Optional[List[Union[Any, UIDProxy]]] = None, doi: str = "", citation: Optional[List[Union[Any, UIDProxy]]] = None, notes: str = "", **kwargs
) -> None:
"""
create a Collection with a name
add list of experiment, inventory, citation, doi, and notes if available.
Expand Down Expand Up @@ -118,12 +120,12 @@ def __init__(self, name: str, experiment: Optional[List[NodeUID[Any]]] = None, i

@property
@beartype
def member(self) -> List[User]:
def member(self) -> List[Union[User, UIDProxy]]:
return self._json_attrs.member.copy()

@property
@beartype
def admin(self) -> List[User]:
def admin(self) -> List[Union[User, UIDProxy]]:
return self._json_attrs.admin

@property
Expand Down
32 changes: 16 additions & 16 deletions src/cript/nodes/primary_nodes/computation.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dataclasses import dataclass, field, replace
from typing import Any, List, Optional
from typing import Any, List, Optional, Union

from beartype import beartype

from cript.nodes.primary_nodes.primary_base_node import PrimaryBaseNode
from cript.nodes.util.json import NodeUID
from cript.nodes.util.json import UIDProxy


class Computation(PrimaryBaseNode):
Expand Down Expand Up @@ -65,12 +65,12 @@ class JsonAttributes(PrimaryBaseNode.JsonAttributes):

type: str = ""
# TODO add proper typing in future, using Any for now to avoid circular import error
input_data: List[NodeUID[Any]] = field(default_factory=list)
output_data: List[NodeUID[Any]] = field(default_factory=list)
software_configuration: List[NodeUID[Any]] = field(default_factory=list)
condition: List[NodeUID[Any]] = field(default_factory=list)
prerequisite_computation: Optional[NodeUID["Computation"]] = None
citation: List[NodeUID[Any]] = field(default_factory=list)
input_data: List[Union[Any, UIDProxy]] = field(default_factory=list)
output_data: List[Union[Any, UIDProxy]] = field(default_factory=list)
software_configuration: List[Union[Any, UIDProxy]] = field(default_factory=list)
condition: List[Union[Any, UIDProxy]] = field(default_factory=list)
prerequisite_computation: Optional[Union["Computation", UIDProxy]] = None
citation: List[Union[Any, UIDProxy]] = field(default_factory=list)

_json_attrs: JsonAttributes = JsonAttributes()

Expand All @@ -79,12 +79,12 @@ def __init__(
self,
name: str,
type: str,
input_data: Optional[List[NodeUID[Any]]] = None,
output_data: Optional[List[NodeUID[Any]]] = None,
software_configuration: Optional[List[NodeUID[Any]]] = None,
condition: Optional[List[NodeUID[Any]]] = None,
prerequisite_computation: Optional[NodeUID["Computation"]] = None,
citation: Optional[List[NodeUID[Any]]] = None,
input_data: Optional[List[Union[Any, UIDProxy]]] = None,
output_data: Optional[List[Union[Any, UIDProxy]]] = None,
software_configuration: Optional[List[Union[Any, UIDProxy]]] = None,
condition: Optional[List[Union[Any, UIDProxy]]] = None,
prerequisite_computation: Optional[Union["Computation", UIDProxy]] = None,
citation: Optional[List[Union[Any, UIDProxy]]] = None,
notes: str = "",
**kwargs
) -> None:
Expand Down Expand Up @@ -365,7 +365,7 @@ def condition(self, new_condition_list: List[Any]) -> None:

@property
@beartype
def prerequisite_computation(self) -> Optional["Computation"]:
def prerequisite_computation(self) -> Optional[Union["Computation", UIDProxy]]:
"""
prerequisite computation
Expand All @@ -387,7 +387,7 @@ def prerequisite_computation(self) -> Optional["Computation"]:

@prerequisite_computation.setter
@beartype
def prerequisite_computation(self, new_prerequisite_computation: Optional["Computation"]) -> None:
def prerequisite_computation(self, new_prerequisite_computation: Optional[Union["Computation", UIDProxy]]) -> None:
"""
set new prerequisite_computation
Expand Down
32 changes: 16 additions & 16 deletions src/cript/nodes/primary_nodes/computation_process.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dataclasses import dataclass, field, replace
from typing import Any, List, Optional
from typing import Any, List, Optional, Union

from beartype import beartype

from cript.nodes.primary_nodes.primary_base_node import PrimaryBaseNode
from cript.nodes.util.json import NodeUID
from cript.nodes.util.json import UIDProxy


class ComputationProcess(PrimaryBaseNode):
Expand Down Expand Up @@ -114,13 +114,13 @@ class JsonAttributes(PrimaryBaseNode.JsonAttributes):

type: str = ""
# TODO add proper typing in future, using Any for now to avoid circular import error
input_data: List[NodeUID[Any]] = field(default_factory=list)
output_data: List[NodeUID[Any]] = field(default_factory=list)
ingredient: List[NodeUID[Any]] = field(default_factory=list)
software_configuration: List[NodeUID[Any]] = field(default_factory=list)
condition: List[NodeUID[Any]] = field(default_factory=list)
property: List[NodeUID[Any]] = field(default_factory=list)
citation: List[NodeUID[Any]] = field(default_factory=list)
input_data: List[Union[Any, UIDProxy]] = field(default_factory=list)
output_data: List[Union[Any, UIDProxy]] = field(default_factory=list)
ingredient: List[Union[Any, UIDProxy]] = field(default_factory=list)
software_configuration: List[Union[Any, UIDProxy]] = field(default_factory=list)
condition: List[Union[Any, UIDProxy]] = field(default_factory=list)
property: List[Union[Any, UIDProxy]] = field(default_factory=list)
citation: List[Union[Any, UIDProxy]] = field(default_factory=list)

_json_attrs: JsonAttributes = JsonAttributes()

Expand All @@ -129,13 +129,13 @@ def __init__(
self,
name: str,
type: str,
input_data: List[NodeUID[Any]],
ingredient: List[NodeUID[Any]],
output_data: Optional[List[NodeUID[Any]]] = None,
software_configuration: Optional[List[NodeUID[Any]]] = None,
condition: Optional[List[NodeUID[Any]]] = None,
property: Optional[List[NodeUID[Any]]] = None,
citation: Optional[List[NodeUID[Any]]] = None,
input_data: List[Union[Any, UIDProxy]],
ingredient: List[Union[Any, UIDProxy]],
output_data: Optional[List[Union[Any, UIDProxy]]] = None,
software_configuration: Optional[List[Union[Any, UIDProxy]]] = None,
condition: Optional[List[Union[Any, UIDProxy]]] = None,
property: Optional[List[Union[Any, UIDProxy]]] = None,
citation: Optional[List[Union[Any, UIDProxy]]] = None,
notes: str = "",
**kwargs
):
Expand Down
30 changes: 15 additions & 15 deletions src/cript/nodes/primary_nodes/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from beartype import beartype

from cript.nodes.primary_nodes.primary_base_node import PrimaryBaseNode
from cript.nodes.util.json import NodeUID
from cript.nodes.util.json import UIDProxy


class Data(PrimaryBaseNode):
Expand Down Expand Up @@ -75,13 +75,13 @@ class JsonAttributes(PrimaryBaseNode.JsonAttributes):

type: str = ""
# TODO add proper typing in future, using Any for now to avoid circular import error
file: List[NodeUID[Any]] = field(default_factory=list)
sample_preparation: NodeUID[Any] = field(default_factory=list)
computation: List[NodeUID[Any]] = field(default_factory=list)
computation_process: NodeUID[Any] = field(default_factory=list)
material: List[NodeUID[Any]] = field(default_factory=list)
process: List[NodeUID[Any]] = field(default_factory=list)
citation: List[NodeUID[Any]] = field(default_factory=list)
file: List[Union[Any, UIDProxy]] = field(default_factory=list)
sample_preparation: Union[Any, UIDProxy] = field(default_factory=list)
computation: List[Union[Any, UIDProxy]] = field(default_factory=list)
computation_process: Union[Any, UIDProxy] = field(default_factory=list)
material: List[Union[Any, UIDProxy]] = field(default_factory=list)
process: List[Union[Any, UIDProxy]] = field(default_factory=list)
citation: List[Union[Any, UIDProxy]] = field(default_factory=list)

_json_attrs: JsonAttributes = JsonAttributes()

Expand All @@ -90,13 +90,13 @@ def __init__(
self,
name: str,
type: str,
file: List[NodeUID[Any]],
sample_preparation: NodeUID[Any] = None,
computation: Optional[List[NodeUID[Any]]] = None,
computation_process: Optional[NodeUID[Any]] = None,
material: Optional[List[NodeUID[Any]]] = None,
process: Optional[List[NodeUID[Any]]] = None,
citation: Optional[List[NodeUID[Any]]] = None,
file: List[Union[Any, UIDProxy]],
sample_preparation: Union[Any, UIDProxy] = None,
computation: Optional[List[Union[Any, UIDProxy]]] = None,
computation_process: Optional[Union[Any, UIDProxy]] = None,
material: Optional[List[Union[Any, UIDProxy]]] = None,
process: Optional[List[Union[Any, UIDProxy]]] = None,
citation: Optional[List[Union[Any, UIDProxy]]] = None,
notes: str = "",
**kwargs
) -> None:
Expand Down
24 changes: 12 additions & 12 deletions src/cript/nodes/primary_nodes/experiment.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from dataclasses import dataclass, field, replace
from typing import Any, List, Optional
from typing import Any, List, Optional, Union

from beartype import beartype

from cript.nodes.primary_nodes.primary_base_node import PrimaryBaseNode
from cript.nodes.util.json import NodeUID
from cript.nodes.util.json import UIDProxy


class Experiment(PrimaryBaseNode):
Expand Down Expand Up @@ -66,25 +66,25 @@ class JsonAttributes(PrimaryBaseNode.JsonAttributes):
all Collection attributes
"""

process: List[NodeUID[Any]] = field(default_factory=list)
computation: List[NodeUID[Any]] = field(default_factory=list)
computation_process: List[NodeUID[Any]] = field(default_factory=list)
data: List[NodeUID[Any]] = field(default_factory=list)
process: List[Union[Any, UIDProxy]] = field(default_factory=list)
computation: List[Union[Any, UIDProxy]] = field(default_factory=list)
computation_process: List[Union[Any, UIDProxy]] = field(default_factory=list)
data: List[Union[Any, UIDProxy]] = field(default_factory=list)
funding: List[str] = field(default_factory=list)
citation: List[NodeUID[Any]] = field(default_factory=list)
citation: List[Union[Any, UIDProxy]] = field(default_factory=list)

_json_attrs: JsonAttributes = JsonAttributes()

@beartype
def __init__(
self,
name: str,
process: Optional[List[NodeUID[Any]]] = None,
computation: Optional[List[NodeUID[Any]]] = None,
computation_process: Optional[List[NodeUID[Any]]] = None,
data: Optional[List[NodeUID[Any]]] = None,
process: Optional[List[Union[Any, UIDProxy]]] = None,
computation: Optional[List[Union[Any, UIDProxy]]] = None,
computation_process: Optional[List[Union[Any, UIDProxy]]] = None,
data: Optional[List[Union[Any, UIDProxy]]] = None,
funding: Optional[List[str]] = None,
citation: Optional[List[NodeUID[Any]]] = None,
citation: Optional[List[Union[Any, UIDProxy]]] = None,
notes: str = "",
**kwargs
):
Expand Down
12 changes: 6 additions & 6 deletions src/cript/nodes/primary_nodes/inventory.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from dataclasses import dataclass, field, replace
from typing import List
from typing import List, Union

from beartype import beartype

from cript.nodes.primary_nodes.material import Material
from cript.nodes.primary_nodes.primary_base_node import PrimaryBaseNode
from cript.nodes.util.json import NodeUID
from cript.nodes.util.json import UIDProxy


class Inventory(PrimaryBaseNode):
Expand Down Expand Up @@ -60,12 +60,12 @@ class JsonAttributes(PrimaryBaseNode.JsonAttributes):
all Inventory attributes
"""

material: List[NodeUID[Material]] = field(default_factory=list)
material: List[Union[Material, UIDProxy]] = field(default_factory=list)

_json_attrs: JsonAttributes = JsonAttributes()

@beartype
def __init__(self, name: str, material: List[NodeUID[Material]], notes: str = "", **kwargs) -> None:
def __init__(self, name: str, material: List[Union[Material, UIDProxy]], notes: str = "", **kwargs) -> None:
"""
Instantiate an inventory node
Expand Down Expand Up @@ -105,7 +105,7 @@ def __init__(self, name: str, material: List[NodeUID[Material]], notes: str = ""

@property
@beartype
def material(self) -> List[Material]:
def material(self) -> List[Union[Material, UIDProxy]]:
"""
List of [material](../material) in this inventory
Expand All @@ -132,7 +132,7 @@ def material(self) -> List[Material]:

@material.setter
@beartype
def material(self, new_material_list: List[Material]):
def material(self, new_material_list: List[Union[Material, UIDProxy]]):
"""
set the list of material for this inventory node
Expand Down
Loading

0 comments on commit 90698b3

Please sign in to comment.