diff --git a/picard/pluginmanager.py b/picard/pluginmanager.py index 1936bce22..cada2765e 100644 --- a/picard/pluginmanager.py +++ b/picard/pluginmanager.py @@ -212,7 +212,7 @@ class PluginManager(QtCore.QObject): self.handle_plugin_updates() # now load found plugins names = set() - for path in [os.path.join(plugindir, file) for file in os.listdir(plugindir)]: + for path in (os.path.join(plugindir, file) for file in os.listdir(plugindir)): name = _plugin_name_from_path(path) if name: names.add(name) @@ -301,9 +301,10 @@ class PluginManager(QtCore.QObject): dirpath = os.path.join(self.plugins_directory, plugin_name) if not os.path.isdir(dirpath): dirpath = None + filenames = {plugin_name + ext for ext in fileexts} filepaths = [os.path.join(self.plugins_directory, f) for f in os.listdir(self.plugins_directory) - if f in [plugin_name + ext for ext in fileexts] + if f in filenames ] return (dirpath, filepaths) diff --git a/picard/ui/itemviews.py b/picard/ui/itemviews.py index 9030e8e52..4fdc0ca5a 100644 --- a/picard/ui/itemviews.py +++ b/picard/ui/itemviews.py @@ -889,11 +889,11 @@ class TreeItem(QtWidgets.QTreeWidgetItem): obj.item = self self.sortable = sortable self._sortkeys = {} - for column in [ + for column in ( MainPanel.LENGTH_COLUMN, MainPanel.TRACKNUMBER_COLUMN, MainPanel.DISCNUMBER_COLUMN, - ]: + ): self.setTextAlignment(column, QtCore.Qt.AlignmentFlag.AlignRight | QtCore.Qt.AlignmentFlag.AlignVCenter) self.setSizeHint(MainPanel.FINGERPRINT_COLUMN, ICON_SIZE) diff --git a/picard/ui/options/plugins.py b/picard/ui/options/plugins.py index 220ccb020..4f618839f 100644 --- a/picard/ui/options/plugins.py +++ b/picard/ui/options/plugins.py @@ -669,7 +669,7 @@ class PluginsOptionsPage(OptionsPage): event.accept() def dropEvent(self, event): - for path in [os.path.normpath(u.toLocalFile()) for u in event.mimeData().urls()]: + for path in (os.path.normpath(u.toLocalFile()) for u in event.mimeData().urls()): self.manager.install_plugin(path) diff --git a/test/formats/test_mp4.py b/test/formats/test_mp4.py index 569ab4e78..3d1b7e979 100644 --- a/test/formats/test_mp4.py +++ b/test/formats/test_mp4.py @@ -131,7 +131,7 @@ class CommonMP4Tests: @skipUnlessTestfile def test_invalid_int_tag(self): - for tag in ['bpm', 'movementnumber', 'movementtotal', 'showmovement']: + for tag in ('bpm', 'movementnumber', 'movementtotal', 'showmovement'): metadata = Metadata({tag: 'notanumber'}) loaded_metadata = save_and_load_metadata(self.filename, metadata) self.assertNotIn(tag, loaded_metadata) diff --git a/test/test_bytes2human.py b/test/test_bytes2human.py index eb1e4b234..dadbaaa96 100644 --- a/test/test_bytes2human.py +++ b/test/test_bytes2human.py @@ -89,11 +89,11 @@ class Testbytes2human(PicardTestCase): @staticmethod def _create_testlist(): values = [0, 1] - for n in [1000, 1024]: + for n in (1000, 1024): p = 1 for e in range(0, 6): p *= n - for x in [0.1, 0.5, 0.99, 0.9999, 1, 1.5]: + for x in (0.1, 0.5, 0.99, 0.9999, 1, 1.5): values.append(int(p * x)) list = [] for x in sorted(values):