-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcery refactored main branch #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ class PropertyChangedCmd(QtWidgets.QUndoCommand): | |
|
||
def __init__(self, node, name, value): | ||
QtWidgets.QUndoCommand.__init__(self) | ||
self.setText('property "{}:{}"'.format(node.name(), name)) | ||
self.setText(f'property "{node.name()}:{name}"') | ||
self.node = node | ||
self.name = name | ||
self.old_val = node.get_property(name) | ||
|
@@ -344,7 +344,7 @@ class PortLockedCmd(QtWidgets.QUndoCommand): | |
|
||
def __init__(self, port): | ||
QtWidgets.QUndoCommand.__init__(self) | ||
self.setText('lock port "{}"'.format(port.name())) | ||
self.setText(f'lock port "{port.name()}"') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
self.port = port | ||
|
||
def undo(self): | ||
|
@@ -366,7 +366,7 @@ class PortUnlockedCmd(QtWidgets.QUndoCommand): | |
|
||
def __init__(self, port): | ||
QtWidgets.QUndoCommand.__init__(self) | ||
self.setText('unlock port "{}"'.format(port.name())) | ||
self.setText(f'unlock port "{port.name()}"') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
self.port = port | ||
|
||
def undo(self): | ||
|
@@ -391,9 +391,9 @@ def __init__(self, port, visible): | |
self.port = port | ||
self.visible = visible | ||
if visible: | ||
self.setText('show port {}'.format(self.port.name())) | ||
self.setText(f'show port {self.port.name()}') | ||
else: | ||
self.setText('hide port {}'.format(self.port.name())) | ||
self.setText(f'hide port {self.port.name()}') | ||
Comment on lines
-394
to
+396
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def set_visible(self, visible): | ||
self.port.model.visible = visible | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,8 +55,7 @@ def create_node_instance(self, node_type=None): | |
if node_type in self.aliases: | ||
node_type = self.aliases[node_type] | ||
|
||
_NodeClass = self.__nodes.get(node_type) | ||
if _NodeClass: | ||
if _NodeClass := self.__nodes.get(node_type): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
return _NodeClass() | ||
|
||
def register_node(self, node, alias=None): | ||
|
@@ -75,9 +74,8 @@ def register_node(self, node, alias=None): | |
|
||
if self.__nodes.get(node_type): | ||
raise NodeRegistrationError( | ||
'node type "{}" already registered to "{}"! ' | ||
'Please specify a new plugin class name or __identifier__.' | ||
.format(node_type, self.__nodes[node_type])) | ||
f'node type "{node_type}" already registered to "{self.__nodes[node_type]}"! Please specify a new plugin class name or __identifier__.' | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
self.__nodes[node_type] = node | ||
|
||
if self.__names.get(name): | ||
|
@@ -88,8 +86,7 @@ def register_node(self, node, alias=None): | |
if alias: | ||
if self.__aliases.get(alias): | ||
raise NodeRegistrationError( | ||
'Alias: "{}" already registered to "{}"' | ||
.format(alias, self.__aliases.get(alias)) | ||
f'Alias: "{alias}" already registered to "{self.__aliases.get(alias)}"' | ||
) | ||
self.__aliases[alias] = node_type | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
PropertyChangedCmd.__init__
refactored with the following changes:use-fstring-for-formatting
)