Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions NodeGraphQt/base/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"')
Copy link
Author

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:

self.node = node
self.name = name
self.old_val = node.get_property(name)
Expand Down Expand Up @@ -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()}"')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PortLockedCmd.__init__ refactored with the following changes:

self.port = port

def undo(self):
Expand All @@ -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()}"')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PortUnlockedCmd.__init__ refactored with the following changes:

self.port = port

def undo(self):
Expand All @@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PortVisibleCmd.__init__ refactored with the following changes:


def set_visible(self, visible):
self.port.model.visible = visible
Expand Down
11 changes: 4 additions & 7 deletions NodeGraphQt/base/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function NodeFactory.create_node_instance refactored with the following changes:

return _NodeClass()

def register_node(self, node, alias=None):
Expand All @@ -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__.'
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function NodeFactory.register_node refactored with the following changes:

self.__nodes[node_type] = node

if self.__names.get(name):
Expand All @@ -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

Expand Down
Loading