Make pylint a bit more happy.

looper
Ben Niemann 5 years ago
parent afca7b2264
commit bbc749a721

@ -1,6 +1,5 @@
# -*- org-tags-column: -98 -*-
* 3rdparty setup.py downloads source, even if it doesn't need to build it :CLEANUP:
* Builtin pylint test improvements :CLEANUP:
- mark all files currently with pylint issues with a "# TODO: pylint-unclean" string
- test reads first 1K bytes and checks for that string
@ -11,10 +10,27 @@
- raise error, if file has not messages reported, but is tagges as pylint-unclean
- do not autogenerated modules (*_pb2)
- look for some easy to fix issues, fix them everywhere and add to whitelist
- attribute-defined-outside-init
- bad-classmethod-argument
- logging-not-lazy
- useless-super-delegation
* Handle async calls using a "queue pump" :CLEANUP:
- separate class
- items to publish are pushed onto a queue
- setup creates an async 'main' task
- 'main' task fetches items from the queue and publishes synchronously
- on cleanup:
- set lameduck flag
- inserts into queue will fail
- 'main' task works off queue, exists when empty
- wait for 'main' task
- get result from 'main' task (to collect any exceptions)
* 3rdparty setup.py downloads source, even if it doesn't need to build it :CLEANUP:
- 'pip install' unconditionally calls 'setup.py install' on all 3rdparty packages.
- 'build' runs in a fresh temp dir everytime(?), so everything is triggered.
- 'install' then sees the sentinel file and is a no-op
- move all steps into 'install', guarded by the sentinel file?
- better: make pip know that the version is already installed and skip it altogether?
- then the sentinel file would be needed
* Improve project rendering :FR:
- persist most recently used path and settings.

@ -141,7 +141,7 @@ class AudioProcClientMixin(object):
'UPDATE_PROJECT_PROPERTIES', self._session_id, kwargs)
def handle_pipeline_mutation(self, mutation):
logger.info("Mutation received: %s" % mutation)
logger.info("Mutation received: %s", mutation)
def handle_pipeline_status(self, status):
self.listeners.call('pipeline_status', status)

@ -126,6 +126,7 @@ class AudioProcProcess(core.ProcessBase):
self.__host_data = None
self.__vm = None
self.sessions = {}
self.nodecls_db = None
async def setup(self):
await super().setup()

@ -745,7 +745,7 @@ class SubprocessMixin(object):
logger.info("Closing event loop...")
pending_tasks = asyncio.Task.all_tasks(self.event_loop)
if pending_tasks:
logger.info("Waiting for %d tasks to complete..." % len(pending_tasks))
logger.info("Waiting for %d tasks to complete...", len(pending_tasks))
self.event_loop.run_until_complete(asyncio.gather(*pending_tasks))
self.event_loop.stop()
self.event_loop.close()

@ -40,9 +40,6 @@ class Value(object):
class ValueSet(collections.UserDict):
def __init__(self, data=None):
super().__init__(data)
def select(self, name):
result = ValueSet()
for value_name, value in self.data.items():
@ -53,9 +50,6 @@ class ValueSet(collections.UserDict):
class Timeseries(collections.UserList):
def __init__(self, values=None):
super().__init__(values)
def rate(self):
result = Timeseries()
prev_value = None
@ -81,9 +75,6 @@ class Timeseries(collections.UserList):
class TimeseriesSet(collections.UserDict):
def __init__(self, data=None):
super().__init__(data)
def select(self, name):
result = TimeseriesSet()
for ts_name, ts in self.data.items():

@ -361,7 +361,7 @@ class ABCImporter(object):
if len(line) > 0 and line[0] in self.decoration_start_chars:
decoration, line = self.parse_decoration(line)
logger.warning("Ignoring unsupported decoration %s" % decoration)
logger.warning("Ignoring unsupported decoration %s", decoration)
accidental = ''
if len(line) > 0 and line[0] in self.accidental_start_chars:
@ -500,9 +500,7 @@ class ABCImporter(object):
if line[0] in self.grace_notes_start:
grace_notes, line = self.parse_grace_notes(line)
logger.warning(
"Ignoring grace notes %s" % ''.join(str(n)
for n in grace_notes))
logger.warning("Ignoring grace notes %s", ''.join(str(n) for n in grace_notes))
continue
if line[0] == '|':

@ -80,7 +80,7 @@ class InstrumentDBClientMixin(object):
def handle_mutation(self, mutation_list):
for mutation in mutation_list:
logger.info("Mutation received: %s" % mutation)
logger.info("Mutation received: %s", mutation)
if isinstance(mutation, mutations.AddInstrumentDescription):
self._instruments[mutation.description.uri] = mutation.description
else:

@ -34,9 +34,6 @@ logger = logging.getLogger(__name__)
class SampleScanner(scanner.Scanner):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def scan(self, path):
if not path.endswith('.wav'):
return

@ -32,9 +32,6 @@ logger = logging.getLogger(__name__)
class SoundFontScanner(scanner.Scanner):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def scan(self, path):
if not path.endswith('.sf2'):
return
@ -43,7 +40,7 @@ class SoundFontScanner(scanner.Scanner):
try:
sf.parse(path)
except riff.Error as exc:
logger.error("Failed to parse %s: %s" % (path, exc))
logger.error("Failed to parse %s: %s", path, exc)
return
for preset in sf.presets:

@ -239,9 +239,6 @@ class Track(model.Track, state.StateBase):
class Measure(model.Measure, state.StateBase):
def __init__(self, state=None):
super().__init__(state)
@property
def empty(self):
return False

@ -239,6 +239,7 @@ class Player(object):
self.audioproc_backend = None
self.audioproc_backend_last_crash_time = None
self.audioproc_address = None
self.audioproc_shm = None
self.audioproc_client = None
self.audioproc_status_listener = None
self.audioproc_player_state_listener = None

@ -201,11 +201,11 @@ class RenderTest(ProjectClientTestBase):
await super().cleanup_testcase()
async def test_success(self):
self.header = bytearray()
header = bytearray()
def handle_data(data):
if len(self.header) < 4:
self.header.extend(data)
if len(header) < 4:
header.extend(data)
return self._handle_data(data)
self.handle_data = handle_data
@ -216,7 +216,7 @@ class RenderTest(ProjectClientTestBase):
self.assertEqual(self.current_progress, fractions.Fraction(1))
self.assertEqual(self.current_state, 'complete')
self.assertGreater(self.bytes_received, 0)
self.assertEqual(self.header[:4], b'fLaC')
self.assertEqual(header[:4], b'fLaC')
async def test_encoder_fails(self):
settings = render_settings_pb2.RenderSettings()

@ -83,7 +83,7 @@ class NodeDBClientMixin(object):
return await self._stub.call('START_SCAN', self._session_id)
def handle_mutation(self, mutation):
logger.info("Mutation received: %s" % mutation)
logger.info("Mutation received: %s", mutation)
if isinstance(mutation, mutations.AddNodeDescription):
assert mutation.uri not in self._nodes
self._nodes[mutation.uri] = mutation.description

@ -229,9 +229,6 @@ CustomCSoundDescription = node_db.ProcessorDescription(
class BuiltinScanner(scanner.Scanner):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def scan(self):
yield ('builtin://track_mixer', TrackMixerDescription)
yield ('builtin://ipc', IPCDescription)

@ -34,9 +34,6 @@ logger = logging.getLogger(__name__)
class CSoundScanner(scanner.Scanner):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def scan(self):
rootdir = os.path.join(constants.DATA_DIR, 'csound')
for dirpath, dirnames, filenames in os.walk(rootdir):

@ -33,9 +33,6 @@ logger = logging.getLogger(__name__)
class LadspaScanner(scanner.Scanner):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def scan(self):
# TODO: support configurable searchpaths
rootdir = '/usr/lib/ladspa'

@ -31,9 +31,6 @@ logger = logging.getLogger(__name__)
class LV2Scanner(scanner.Scanner):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def scan(self):
world = lilv.World()
ns = world.ns

@ -135,6 +135,7 @@ class BaseEditorApp(object):
self.project_registry = None
self.sequencer = None
self.midi_hub = None
self.show_edit_areas_action = None
self.audioproc_client = None
self.audioproc_process = None
self.node_db = None

@ -141,18 +141,13 @@ class TrackProperties(ui_base.ProjectMixin, QtWidgets.QWidget):
class TrackGroupProperties(TrackProperties):
def __init__(self, **kwargs):
super().__init__(**kwargs)
pass
class ControlTrackProperties(TrackProperties):
def __init__(self, **kwargs):
super().__init__(**kwargs)
pass
class SampleTrackProperties(TrackProperties):
def __init__(self, **kwargs):
super().__init__(**kwargs)
pass
class ScoreTrackProperties(TrackProperties):

@ -38,6 +38,9 @@ class UISubprocess(core.SubprocessMixin, core.ProcessBase):
def __init__(self, *, runtime_settings, paths, **kwargs):
super().__init__(**kwargs)
self._shutting_down = None
self.exit_code = None
self.app = self.create_app(
process=self,
runtime_settings=runtime_settings,

@ -183,7 +183,9 @@ class MockApp(BaseEditorApp, QtCore.QCoreApplication):
return MockSequencer()
class Bunch(object): pass
class MockProjectConnection(object):
def __init__(self, *, name):
self.name = name
class UITest(unittest.AsyncTestCase):
@ -234,8 +236,7 @@ class UITest(unittest.AsyncTestCase):
await UITest.app.setup()
self.window = None
self.project_connection = Bunch()
self.project_connection.name = 'test project'
self.project_connection = MockProjectConnection(name='test project')
self.project_client = None
self.selection_set = selection_set.SelectionSet()

@ -94,6 +94,10 @@ class BuiltinPyTests(unittest.TestCase):
pylint_whitelist = [
'trailing-whitespace',
'unused-import',
'attribute-defined-outside-init',
'bad-classmethod-argument',
'logging-not-lazy',
'useless-super-delegation',
]
def test_pylint(self):

Loading…
Cancel
Save