File tree Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ def __getattribute__(self, name):
4040 return env_val
4141 return value
4242
43- class Config (BaseModel ):
43+ class NodeConfig (BaseModel ):
4444 server : ServerConfig | None = Field (default_factory = ServerConfig )
4545 koi_net : KoiNetConfig
4646 _file_path : str = PrivateAttr (default = "config.yaml" )
@@ -49,7 +49,7 @@ class Config(BaseModel):
4949 @classmethod
5050 def load_from_yaml (
5151 cls ,
52- file_path : str | None = None ,
52+ file_path : str = "config.yaml" ,
5353 generate_missing : bool = True
5454 ):
5555 yaml = YAML ()
@@ -62,8 +62,14 @@ def load_from_yaml(
6262 config ._file_content = file_content
6363
6464 except FileNotFoundError :
65+ # empty_fields = {}
66+ # for name, field in cls.model_fields.items():
67+
68+ # if field.default is None or field.default_factory is None:
69+ # print(empty_fields)
6570 config = cls ()
6671
72+
6773 config ._file_path = file_path
6874
6975 if generate_missing :
@@ -92,4 +98,4 @@ def save_to_yaml(self):
9298 f .write (self ._file_content )
9399 raise e
94100
95- ConfigType = TypeVar ("ConfigType" , bound = Config )
101+ ConfigType = TypeVar ("ConfigType" , bound = NodeConfig )
Original file line number Diff line number Diff line change 33from rid_lib .ext .cache import Cache
44from rid_lib .types .koi_net_node import KoiNetNode
55
6- from .config import Config
6+ from .config import NodeConfig
77from .protocol .node import NodeProfile
88
99logger = logging .getLogger (__name__ )
1212class NodeIdentity :
1313 """Represents a node's identity (RID, profile, bundle)."""
1414
15- config : Config
15+ config : NodeConfig
1616 cache : Cache
1717
1818 def __init__ (
1919 self ,
20- config : Config ,
20+ config : NodeConfig ,
2121 cache : Cache
2222 ):
2323 """Initializes node identity from a name and profile.
Original file line number Diff line number Diff line change 1515from ..protocol .edge import EdgeType
1616from ..protocol .event import Event
1717from ..identity import NodeIdentity
18- from ..config import Config , ConfigType
18+ from ..config import ConfigType
1919
2020logger = logging .getLogger (__name__ )
2121
Original file line number Diff line number Diff line change 99from ..identity import NodeIdentity
1010from ..network import NetworkInterface
1111from ..protocol .event import Event , EventType
12- from ..config import Config
12+ from ..config import NodeConfig
1313from .handler import (
1414 KnowledgeHandler ,
1515 HandlerType ,
2828class ProcessorInterface ():
2929 """Provides access to this node's knowledge processing pipeline."""
3030
31- config : Config
31+ config : NodeConfig
3232 cache : Cache
3333 network : NetworkInterface
3434 identity : NodeIdentity
@@ -39,7 +39,7 @@ class ProcessorInterface():
3939
4040 def __init__ (
4141 self ,
42- config : Config ,
42+ config : NodeConfig ,
4343 cache : Cache ,
4444 network : NetworkInterface ,
4545 identity : NodeIdentity ,
You can’t perform that action at this time.
0 commit comments