Skip to content

Commit

Permalink
fix sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Nov 2, 2024
1 parent e081deb commit d72cfff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
22 changes: 12 additions & 10 deletions pyprland/plugins/scratchpads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,18 @@ async def on_reload(self) -> None:
# Sanity checks
_scratch_classes: dict[str:Scratch] = {}
for scratch in self.config.values():
if scratch["class"] in _scratch_classes:
text = "Scratch class %s is duplicated (in %s and %s)"
args = (
scratch["class"],
scratch.uid,
_scratch_classes[scratch["class"].uid],
)
self.log.error(text, *args)
await self.notify_error(text % args)
_scratch_classes[scratch["class"]] = scratch
_klass = scratch.get("class")
if _klass:
if _klass in _scratch_classes:
text = "Scratch class %s is duplicated (in %s and %s)"
args = (
scratch["class"],
scratch.uid,
_scratch_classes[scratch["class"].uid],
)
self.log.error(text, *args)
await self.notify_error(text % args)
_scratch_classes[_klass] = scratch

# Create new scratches with fresh config items
scratches = {name: Scratch(name, self.config) for name, options in self.config.items()}
Expand Down
2 changes: 1 addition & 1 deletion pyprland/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Package version."""

VERSION = "2.4.0-66"
VERSION = "2.4.0-71"

0 comments on commit d72cfff

Please sign in to comment.