Skip to content

Commit f2ec277

Browse files
committed
renamed PyDSS to pydss in DEFAULT_REGISTRY
1 parent 0f0b87b commit f2ec277

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

src/pydss/registry.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,25 @@
2121
"name": "NO_VRT",
2222
"filename": os.path.join(
2323
os.path.dirname(getattr(pydss, "__path__")[0]),
24-
"PyDSS/pyControllers/Controllers/Settings/PvControllers.toml"
24+
"pydss/pyControllers/Controllers/Settings/PvControllers.toml",
2525
),
2626
},
2727
{
2828
"name": "cpf",
2929
"filename": os.path.join(
3030
os.path.dirname(getattr(pydss, "__path__")[0]),
31-
"PyDSS/pyControllers/Controllers/Settings/PvControllers.toml"
31+
"pydss/pyControllers/Controllers/Settings/PvControllers.toml",
3232
),
3333
},
3434
{
3535
"name": "volt-var",
3636
"filename": os.path.join(
3737
os.path.dirname(getattr(pydss, "__path__")[0]),
38-
"PyDSS/pyControllers/Controllers/Settings/PvControllers.toml"
38+
"pydss/pyControllers/Controllers/Settings/PvControllers.toml",
3939
),
4040
},
41-
],
42-
ControllerType.PV_VOLTAGE_RIDETHROUGH.value: [
4341
],
42+
ControllerType.PV_VOLTAGE_RIDETHROUGH.value: [],
4443
ControllerType.SOCKET_CONTROLLER.value: [],
4544
ControllerType.STORAGE_CONTROLLER.value: [],
4645
ControllerType.XMFR_CONTROLLER.value: [],
@@ -52,24 +51,26 @@
5251

5352
REQUIRED_CONTROLLER_FIELDS = ("name", "filename")
5453

54+
5555
class Registry:
5656
"""Manages controllers registered with pydss."""
57+
5758
_REGISTRY_FILENAME = ".pydss-registry.json"
5859

5960
def __init__(self, registry_filename=None):
6061
if registry_filename is None:
6162
self._registry_filename = Path.home() / self._REGISTRY_FILENAME
6263
else:
6364
self._registry_filename = Path(registry_filename)
64-
65+
6566
self._controllers = {x: {} for x in CONTROLLER_TYPES}
6667
data = copy.deepcopy(DEFAULT_REGISTRY)
6768
for controller_type, controllers in DEFAULT_REGISTRY["Controllers"].items():
6869
for controller in controllers:
6970
path = Path(controller["filename"])
7071
if not path.exists():
7172
raise InvalidConfiguration(f"Default controller file={path} does not exist")
72-
73+
7374
# This is written to work with legacy versions where default controllers were
7475
# written to the registry.
7576
if self._registry_filename.exists():
@@ -80,15 +81,20 @@ def __init__(self, registry_filename=None):
8081
path = Path(controller["filename"])
8182
if not path.exists():
8283
name = controller["name"]
83-
msg = f"The registry contains a controller with an invalid file. " \
84-
f"Type={controller_type} name={name} file={path}.\nWould you like to " \
85-
"delete it? (y/n) -> "
84+
msg = (
85+
f"The registry contains a controller with an invalid file. "
86+
f"Type={controller_type} name={name} file={path}.\nWould you like to "
87+
"delete it? (y/n) -> "
88+
)
8689
response = input(msg).lower()
8790
if response == "y":
8891
to_delete.append((controller_type, i))
8992
continue
9093
else:
91-
logger.error("Exiting because the registry %s is invalid", self._registry_filename)
94+
logger.error(
95+
"Exiting because the registry %s is invalid",
96+
self._registry_filename,
97+
)
9298
sys.exit(1)
9399
if not self._is_default_controller(controller_type, controller["name"]):
94100
data["Controllers"][controller_type].append(controller)
@@ -231,9 +237,7 @@ def unregister_controller(self, controller_type, name):
231237
232238
"""
233239
if not self.is_controller_registered(controller_type, name):
234-
raise InvalidParameter(
235-
f"{controller_type} / {name} isn't registered"
236-
)
240+
raise InvalidParameter(f"{controller_type} / {name} isn't registered")
237241
if self._is_default_controller(controller_type, name):
238242
raise InvalidParameter(f"Cannot unregister a default controller")
239243

0 commit comments

Comments
 (0)