Browse Source

Fix tests and remove lint.

port-types
Ben Niemann 3 years ago
parent
commit
02392ef186
  1. 5
      noisicaa/audioproc/audioproc_client.py
  2. 2
      noisicaa/audioproc/audioproc_client_test.py
  3. 6
      noisicaa/audioproc/engine/realm_test.py
  4. 4
      noisicaa/builtin_nodes/oscilloscope/node_ui.py
  5. 2
      noisicaa/music/graph.py
  6. 9
      noisicaa/music/project.py

5
noisicaa/audioproc/audioproc_client.py

@ -84,7 +84,8 @@ class AbstractAudioProcClient(object):
raise NotImplementedError
async def connect_ports(
self, realm: str, node1_id: str, port1_name: str, node2_id: str, port2_name: str
self, realm: str, node1_id: str, port1_name: str, node2_id: str, port2_name: str,
type: node_db.PortDescription.Type, # pylint: disable=redefined-builtin
) -> None:
raise NotImplementedError
@ -266,7 +267,7 @@ class AudioProcClient(AbstractAudioProcClient):
realm: str,
node1_id: str, port1_name: str,
node2_id: str, port2_name: str,
type: node_db.PortDescription.Type,
type: node_db.PortDescription.Type, # pylint: disable=redefined-builtin
) -> None:
await self.pipeline_mutation(
realm,

2
noisicaa/audioproc/audioproc_client_test.py

@ -108,7 +108,7 @@ class AudioProcClientTest(
'root',
id='child', child_realm='test', description=node_db.Builtins.ChildRealmDescription)
await client.connect_ports(
'root','child', 'out:left', 'sink', 'in:left', node_db.PortDescription.AUDIO)
'root', 'child', 'out:left', 'sink', 'in:left', node_db.PortDescription.AUDIO)
await client.connect_ports(
'root', 'child', 'out:right', 'sink', 'in:right', node_db.PortDescription.AUDIO)

6
noisicaa/audioproc/engine/realm_test.py

@ -319,8 +319,10 @@ class RealmTest(
await root_realm.setup_node(child_realm_node)
root_realm.update_spec()
root_sink.inputs['in:left'].connect(child_realm_node.outputs['out:left'])
root_sink.inputs['in:right'].connect(child_realm_node.outputs['out:right'])
root_sink.inputs['in:left'].connect(
child_realm_node.outputs['out:left'], node_db.PortDescription.AUDIO)
root_sink.inputs['in:right'].connect(
child_realm_node.outputs['out:right'], node_db.PortDescription.AUDIO)
root_realm.update_spec()
root_realm.process_block(root_realm.get_active_program())

4
noisicaa/builtin_nodes/oscilloscope/node_ui.py

@ -34,7 +34,6 @@ from PyQt5 import QtWidgets
from noisicaa import constants
from noisicaa import core
from noisicaa import music
from noisicaa import node_db
from noisicaa.ui import slots
from noisicaa.ui import dynamic_layout
from noisicaa.ui import int_dial
@ -237,7 +236,8 @@ class Oscilloscope(slots.SlotContainer, QtWidgets.QWidget):
self.__insert_pos += 1
while (self.__insert_pos < len(self.__signal)
and self.__signal[self.__insert_pos].screen_pos <= self.__screen_pos):
and (self.__signal[self.__insert_pos].screen_pos
<= self.__screen_pos)):
del self.__signal[self.__insert_pos]
self.__screen_pos += self.__density

2
noisicaa/music/graph.py

@ -452,7 +452,7 @@ class NodeConnection(_model.NodeConnection, model_base.ProjectChild):
source_port: Optional[str] = None,
dest_node: Optional[BaseNode] = None,
dest_port: Optional[str] = None,
type: node_db.PortDescription.Type = None,
type: node_db.PortDescription.Type = None, # pylint: disable=redefined-builtin
**kwargs: Any) -> None:
super().create(**kwargs)

9
noisicaa/music/project.py

@ -88,7 +88,9 @@ class BaseProject(_model.Project, model_base.ObjectBase):
conn.dest_node.connections_changed.call(change)
self.node_connections_changed.add(self.__node_connections_changed)
def __node_connections_changed(self, change: model_base.PropertyListChange[graph.NodeConnection]) -> None:
def __node_connections_changed(
self, change: model_base.PropertyListChange[graph.NodeConnection]
) -> None:
if isinstance(change, model_base.PropertyListInsert):
conn = change.new_value
elif isinstance(change, model_base.PropertyListDelete):
@ -203,7 +205,8 @@ class BaseProject(_model.Project, model_base.ObjectBase):
def add_node(self, node: graph.BaseNode) -> None:
for conn in self.node_connections:
if conn.source_node is node or conn.dest_node is node:
node.connections_changed.call(model_base.PropertyListInsert(self, 'node_connections', -1, conn))
node.connections_changed.call(
model_base.PropertyListInsert(self, 'node_connections', -1, conn))
for mutation in node.get_add_mutations():
self.handle_pipeline_mutation(mutation)
@ -231,7 +234,7 @@ class BaseProject(_model.Project, model_base.ObjectBase):
source_port: str,
dest_node: graph.BaseNode,
dest_port: str,
type: node_db_lib.PortDescription.Type = node_db_lib.PortDescription.UNDEFINED,
type: node_db_lib.PortDescription.Type = node_db_lib.PortDescription.UNDEFINED, # pylint: disable=redefined-builtin
) -> graph.NodeConnection:
if type == node_db_lib.PortDescription.UNDEFINED:
type = graph.get_preferred_connection_type(

Loading…
Cancel
Save