Skip to content

Commit 5b6d5c2

Browse files
authored
Merge pull request #4 from BlockScience/dev
v1.0.0-beta.16
2 parents ddc17f1 + bb1ccc8 commit 5b6d5c2

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "koi-net"
7-
version = "1.0.0-beta.15"
7+
version = "1.0.0-beta.16"
88
description = "Implementation of KOI-net protocol in Python"
99
authors = [
1010
{name = "Luke Miller", email = "[email protected]"}

src/koi_net/config.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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)

src/koi_net/identity.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from rid_lib.ext.cache import Cache
44
from rid_lib.types.koi_net_node import KoiNetNode
55

6-
from .config import Config
6+
from .config import NodeConfig
77
from .protocol.node import NodeProfile
88

99
logger = logging.getLogger(__name__)
@@ -12,12 +12,12 @@
1212
class 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.

src/koi_net/network/interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from ..protocol.edge import EdgeType
1616
from ..protocol.event import Event
1717
from ..identity import NodeIdentity
18-
from ..config import Config, ConfigType
18+
from ..config import ConfigType
1919

2020
logger = logging.getLogger(__name__)
2121

src/koi_net/processor/interface.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from ..identity import NodeIdentity
1010
from ..network import NetworkInterface
1111
from ..protocol.event import Event, EventType
12-
from ..config import Config
12+
from ..config import NodeConfig
1313
from .handler import (
1414
KnowledgeHandler,
1515
HandlerType,
@@ -28,7 +28,7 @@
2828
class 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,

0 commit comments

Comments
 (0)