File tree Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Expand file tree Collapse file tree 4 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ def __init__(
2424 _cache_age : Optional [int ] = None ,
2525 _cache_keys : Optional [List [str ]] = None ,
2626 _max_retries : Optional [int ] = None ,
27- _depends : List ["CoreNode" ] = [] ,
27+ _depends : Optional [ List ["CoreNode" ]] = None ,
2828 ** attr ,
2929 ):
3030 self ._out_type = out_type
@@ -35,7 +35,7 @@ def __init__(
3535 self ._cache_age = _cache_age
3636 self ._cache_keys = _cache_keys
3737 self ._max_retries = _max_retries
38- self ._depends = _depends
38+ self ._depends = [] if _depends is None else _depends
3939 self ._should_output_globally : bool = not hide
4040 self .SG = nx .DiGraph ()
4141 if attr :
@@ -54,6 +54,10 @@ def __init__(
5454 for referenced_future in depend_node .futures_from_args :
5555 self .futures_from_args .append (referenced_future )
5656
57+ @property
58+ def explicit_depends (self ) -> List ["CoreNode" ]:
59+ return self ._depends
60+
5761 @property
5862 def dependent_futures (self ) -> List [Future ]:
5963 return find_futures_client (self .init_attrs )
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ class TraceOperation:
8989@dataclass
9090class TraceDirective (BaseDirective ):
9191 op_stack : List [TraceOperation ]
92- origin_node : Any # Should be CoreNode, but am running into circular import
92+ origin_node : " CoreNode"
9393 type : Literal ["trace" ] = "trace"
9494
9595 def to_dict (self ) -> Dict :
Original file line number Diff line number Diff line change @@ -11,13 +11,13 @@ class RunPython(CoreNode[RunPythonOut]):
1111 def __init__ (
1212 self ,
1313 function : Callable ,
14- kwargs : Dict [ str , Any ] = {} ,
14+ kwargs = None ,
1515 pip_install : Optional [List [str ]] = None ,
1616 hide : bool = False ,
1717 _cache_age : Optional [int ] = None ,
1818 _cache_keys : Optional [List [str ]] = None ,
1919 _max_retries : Optional [int ] = None ,
20- _depends : List [CoreNode ] = [] ,
20+ _depends : Optional [ List [CoreNode ]] = None ,
2121 ):
2222 """
2323 Args:
@@ -41,7 +41,7 @@ def __init__(
4141 python_version = sys .version .split ()[0 ]
4242 super ().__init__ (
4343 pkl_function = fn_str ,
44- kwargs = kwargs ,
44+ kwargs = {} if kwargs is None else kwargs ,
4545 pip_install = pip_install ,
4646 hide = hide ,
4747 python_version = python_version ,
Original file line number Diff line number Diff line change 11import json
2+ from typing import Optional , Any , Dict
3+
24import zlib
35import base64
4- from typing import Any , Dict
56
67from substrate .streaming import SubstrateStreamingResponse
78
@@ -21,11 +22,13 @@ def __init__(
2122 api_key : str ,
2223 base_url : str = "https://api.substrate.run" ,
2324 timeout : float = 60 * 5.0 ,
24- additional_headers : Dict [str , Any ] = {} ,
25+ additional_headers : Optional [ Dict [str , Any ]] = None ,
2526 ):
2627 """
2728 Initialize the Substrate SDK.
2829 """
30+ if additional_headers is None :
31+ additional_headers = {}
2932 self .api_key = api_key
3033 self ._client = APIClient (
3134 api_key = api_key ,
@@ -98,7 +101,7 @@ def collect_nodes(node):
98101 for node in all_nodes :
99102 if not graph .DAG .has_node (node ):
100103 graph .add_node (node )
101- for depend_node in node ._depends :
104+ for depend_node in node .explicit_depends :
102105 graph .add_edge (depend_node , node )
103106 graph_serialized = graph .to_dict ()
104107 return graph_serialized
You can’t perform that action at this time.
0 commit comments