1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Format files with black

- Format all files with black
- Update tox.ini flake8 arguments to be compatible
- Add black to requirements-extra.txt
- Reduce ignored flake8 rules and fix a few violations
This commit is contained in:
2019-12-31 20:16:27 -06:00
parent 359d6498f7
commit 7ba8aa3514
141 changed files with 5241 additions and 3648 deletions

View File

@@ -11,7 +11,8 @@ from hscommon.trans import trget
from ..details_dialog import DetailsDialog as DetailsDialogBase
from ..details_table import DetailsTable
tr = trget('ui')
tr = trget("ui")
class DetailsDialog(DetailsDialogBase):
def _setupUi(self):
@@ -26,4 +27,3 @@ class DetailsDialog(DetailsDialogBase):
self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
self.tableView.setShowGrid(False)
self.verticalLayout.addWidget(self.tableView)

View File

@@ -6,7 +6,12 @@
from PyQt5.QtCore import QSize
from PyQt5.QtWidgets import (
QVBoxLayout, QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QWidget,
QVBoxLayout,
QHBoxLayout,
QLabel,
QSizePolicy,
QSpacerItem,
QWidget,
)
from hscommon.trans import trget
@@ -15,7 +20,8 @@ from core.scanner import ScanType
from ..preferences_dialog import PreferencesDialogBase
tr = trget('ui')
tr = trget("ui")
class PreferencesDialog(PreferencesDialogBase):
def _setupPreferenceWidgets(self):
@@ -33,33 +39,40 @@ class PreferencesDialog(PreferencesDialogBase):
self.horizontalLayout_2.setSpacing(0)
spacerItem1 = QSpacerItem(15, 20, QSizePolicy.Fixed, QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self._setupAddCheckbox('tagTrackBox', tr("Track"), self.widget)
self._setupAddCheckbox("tagTrackBox", tr("Track"), self.widget)
self.horizontalLayout_2.addWidget(self.tagTrackBox)
self._setupAddCheckbox('tagArtistBox', tr("Artist"), self.widget)
self._setupAddCheckbox("tagArtistBox", tr("Artist"), self.widget)
self.horizontalLayout_2.addWidget(self.tagArtistBox)
self._setupAddCheckbox('tagAlbumBox', tr("Album"), self.widget)
self._setupAddCheckbox("tagAlbumBox", tr("Album"), self.widget)
self.horizontalLayout_2.addWidget(self.tagAlbumBox)
self._setupAddCheckbox('tagTitleBox', tr("Title"), self.widget)
self._setupAddCheckbox("tagTitleBox", tr("Title"), self.widget)
self.horizontalLayout_2.addWidget(self.tagTitleBox)
self._setupAddCheckbox('tagGenreBox', tr("Genre"), self.widget)
self._setupAddCheckbox("tagGenreBox", tr("Genre"), self.widget)
self.horizontalLayout_2.addWidget(self.tagGenreBox)
self._setupAddCheckbox('tagYearBox', tr("Year"), self.widget)
self._setupAddCheckbox("tagYearBox", tr("Year"), self.widget)
self.horizontalLayout_2.addWidget(self.tagYearBox)
self.verticalLayout_4.addLayout(self.horizontalLayout_2)
self.widgetsVLayout.addWidget(self.widget)
self._setupAddCheckbox('wordWeightingBox', tr("Word weighting"))
self._setupAddCheckbox("wordWeightingBox", tr("Word weighting"))
self.widgetsVLayout.addWidget(self.wordWeightingBox)
self._setupAddCheckbox('matchSimilarBox', tr("Match similar words"))
self._setupAddCheckbox("matchSimilarBox", tr("Match similar words"))
self.widgetsVLayout.addWidget(self.matchSimilarBox)
self._setupAddCheckbox('mixFileKindBox', tr("Can mix file kind"))
self._setupAddCheckbox("mixFileKindBox", tr("Can mix file kind"))
self.widgetsVLayout.addWidget(self.mixFileKindBox)
self._setupAddCheckbox('useRegexpBox', tr("Use regular expressions when filtering"))
self._setupAddCheckbox(
"useRegexpBox", tr("Use regular expressions when filtering")
)
self.widgetsVLayout.addWidget(self.useRegexpBox)
self._setupAddCheckbox('removeEmptyFoldersBox', tr("Remove empty folders on delete or move"))
self._setupAddCheckbox(
"removeEmptyFoldersBox", tr("Remove empty folders on delete or move")
)
self.widgetsVLayout.addWidget(self.removeEmptyFoldersBox)
self._setupAddCheckbox('ignoreHardlinkMatches', tr("Ignore duplicates hardlinking to the same file"))
self._setupAddCheckbox(
"ignoreHardlinkMatches",
tr("Ignore duplicates hardlinking to the same file"),
)
self.widgetsVLayout.addWidget(self.ignoreHardlinkMatches)
self._setupAddCheckbox('debugModeBox', tr("Debug mode (restart required)"))
self._setupAddCheckbox("debugModeBox", tr("Debug mode (restart required)"))
self.widgetsVLayout.addWidget(self.debugModeBox)
self._setupBottomPart()
@@ -76,8 +89,10 @@ class PreferencesDialog(PreferencesDialogBase):
# Update UI state based on selected scan type
scan_type = prefs.get_scan_type(AppMode.Music)
word_based = scan_type in (
ScanType.Filename, ScanType.Fields, ScanType.FieldsNoOrder,
ScanType.Tag
ScanType.Filename,
ScanType.Fields,
ScanType.FieldsNoOrder,
ScanType.Tag,
)
tag_based = scan_type == ScanType.Tag
self.filterHardnessSlider.setEnabled(word_based)
@@ -99,4 +114,3 @@ class PreferencesDialog(PreferencesDialogBase):
prefs.scan_tag_year = ischecked(self.tagYearBox)
prefs.match_similar = ischecked(self.matchSimilarBox)
prefs.word_weighting = ischecked(self.wordWeightingBox)

View File

@@ -7,26 +7,26 @@
from qtlib.column import Column
from ..results_model import ResultsModel as ResultsModelBase
class ResultsModel(ResultsModelBase):
COLUMNS = [
Column('marked', defaultWidth=30),
Column('name', defaultWidth=200),
Column('folder_path', defaultWidth=180),
Column('size', defaultWidth=60),
Column('duration', defaultWidth=60),
Column('bitrate', defaultWidth=50),
Column('samplerate', defaultWidth=60),
Column('extension', defaultWidth=40),
Column('mtime', defaultWidth=120),
Column('title', defaultWidth=120),
Column('artist', defaultWidth=120),
Column('album', defaultWidth=120),
Column('genre', defaultWidth=80),
Column('year', defaultWidth=40),
Column('track', defaultWidth=40),
Column('comment', defaultWidth=120),
Column('percentage', defaultWidth=60),
Column('words', defaultWidth=120),
Column('dupe_count', defaultWidth=80),
Column("marked", defaultWidth=30),
Column("name", defaultWidth=200),
Column("folder_path", defaultWidth=180),
Column("size", defaultWidth=60),
Column("duration", defaultWidth=60),
Column("bitrate", defaultWidth=50),
Column("samplerate", defaultWidth=60),
Column("extension", defaultWidth=40),
Column("mtime", defaultWidth=120),
Column("title", defaultWidth=120),
Column("artist", defaultWidth=120),
Column("album", defaultWidth=120),
Column("genre", defaultWidth=80),
Column("year", defaultWidth=40),
Column("track", defaultWidth=40),
Column("comment", defaultWidth=120),
Column("percentage", defaultWidth=60),
Column("words", defaultWidth=120),
Column("dupe_count", defaultWidth=80),
]