bug: Fix DataLocations defaulting to all get_config.
This commit is contained in:
@@ -64,6 +64,10 @@ AVALON_DATA_LOC = DataLocations(
|
||||
"_get_fault_light",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -70,6 +70,10 @@ VNISH_DATA_LOC = DataLocations(
|
||||
"_get_fans",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
str(DataOptions.UPTIME): DataFunction(
|
||||
"_get_uptime",
|
||||
[RPCAPICommand("api_stats", "stats")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -89,6 +89,9 @@ class DataFunction:
|
||||
Union[RPCAPICommand, WebAPICommand, GRPCCommand, GraphQLCommand]
|
||||
] = field(default_factory=list)
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return self
|
||||
|
||||
|
||||
DataLocations = make_dataclass(
|
||||
"DataLocations",
|
||||
@@ -96,11 +99,12 @@ DataLocations = make_dataclass(
|
||||
(
|
||||
enum_value.value,
|
||||
DataFunction,
|
||||
field(default_factory=lambda: DataFunction(enum_value.default_command())),
|
||||
field(default_factory=DataFunction(enum_value.default_command())),
|
||||
)
|
||||
for enum_value in DataOptions
|
||||
],
|
||||
)
|
||||
print(DataLocations())
|
||||
|
||||
|
||||
class MinerProtocol(Protocol):
|
||||
|
||||
Reference in New Issue
Block a user