mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-05-08 01:39:50 +00:00
Merge pull request #1089 from arsenetar/as/pre-commit
feat: Add pre-commit, include python 3.11 in tests
This commit is contained in:
commit
1e651a1603
45
.github/workflows/default.yml
vendored
45
.github/workflows/default.yml
vendored
@ -9,43 +9,22 @@ on:
|
|||||||
branches: [master]
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
pre-commit:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python 3.10
|
- name: Set up Python 3.11
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.11"
|
||||||
- name: Install dependencies
|
- uses: pre-commit/action@v3.0.0
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install -r requirements.txt -r requirements-extra.txt
|
|
||||||
- name: Lint with flake8
|
|
||||||
run: |
|
|
||||||
flake8 .
|
|
||||||
format:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set up Python 3.10
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: "3.10"
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install -r requirements.txt -r requirements-extra.txt
|
|
||||||
- name: Check format with black
|
|
||||||
run: |
|
|
||||||
black .
|
|
||||||
test:
|
test:
|
||||||
needs: [lint, format]
|
needs: [pre-commit]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
python-version: [3.7, 3.8, 3.9, "3.10"]
|
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
|
||||||
exclude:
|
exclude:
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
@ -53,17 +32,21 @@ jobs:
|
|||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
python-version: 3.9
|
python-version: 3.9
|
||||||
|
- os: macos-latest
|
||||||
|
python-version: "3.10"
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
python-version: 3.9
|
python-version: 3.9
|
||||||
|
- os: windows-latest
|
||||||
|
python-version: "3.10"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
24
.pre-commit-config.yaml
Normal file
24
.pre-commit-config.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v2.3.0
|
||||||
|
hooks:
|
||||||
|
- id: check-yaml
|
||||||
|
- id: check-toml
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
exclude: ".*.json"
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 22.10.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
- repo: https://github.com/PyCQA/flake8
|
||||||
|
rev: 6.0.0
|
||||||
|
hooks:
|
||||||
|
- id: flake8
|
||||||
|
exclude: ^(.tox|env|build|dist|help|qt/dg_rc.py|pkg).*
|
||||||
|
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
|
||||||
|
rev: v9.3.0
|
||||||
|
hooks:
|
||||||
|
- id: commitlint
|
||||||
|
stages: [commit-msg]
|
||||||
|
additional_dependencies: ["@commitlint/config-conventional"]
|
@ -1 +1 @@
|
|||||||
sonar.python.version=3.7, 3.8, 3.9, 3.10
|
sonar.python.version=3.7, 3.8, 3.9, 3.10, 3.11
|
||||||
|
@ -18,4 +18,3 @@ file_filter = locale/<lang>/LC_MESSAGES/ui.po
|
|||||||
source_file = locale/ui.pot
|
source_file = locale/ui.pot
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = PO
|
type = PO
|
||||||
|
|
||||||
|
1
LICENSE
1
LICENSE
@ -619,4 +619,3 @@ Program, unless a warranty or assumption of liability accompanies a
|
|||||||
copy of the Program in return for a fee.
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
17
commitlint.config.js
Normal file
17
commitlint.config.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const Configuration = {
|
||||||
|
/*
|
||||||
|
* Resolve and load @commitlint/config-conventional from node_modules.
|
||||||
|
* Referenced packages must be installed
|
||||||
|
*/
|
||||||
|
extends: ['@commitlint/config-conventional'],
|
||||||
|
/*
|
||||||
|
* Any rules defined here will override rules from @commitlint/config-conventional
|
||||||
|
*/
|
||||||
|
rules: {
|
||||||
|
'header-max-length': [2, 'always', 72],
|
||||||
|
'subject-case': [2, 'always', 'sentence-case'],
|
||||||
|
'scope-enum': [2, 'always'],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = Configuration;
|
@ -97,12 +97,14 @@ class FilesDB:
|
|||||||
schema_version = 1
|
schema_version = 1
|
||||||
schema_version_description = "Changed from md5 to xxhash if available."
|
schema_version_description = "Changed from md5 to xxhash if available."
|
||||||
|
|
||||||
create_table_query = "CREATE TABLE IF NOT EXISTS files (path TEXT PRIMARY KEY, size INTEGER, mtime_ns INTEGER, entry_dt DATETIME, digest BLOB, digest_partial BLOB, digest_samples BLOB)"
|
create_table_query = """CREATE TABLE IF NOT EXISTS files (path TEXT PRIMARY KEY, size INTEGER, mtime_ns INTEGER,
|
||||||
|
entry_dt DATETIME, digest BLOB, digest_partial BLOB, digest_samples BLOB)"""
|
||||||
drop_table_query = "DROP TABLE IF EXISTS files;"
|
drop_table_query = "DROP TABLE IF EXISTS files;"
|
||||||
select_query = "SELECT {key} FROM files WHERE path=:path AND size=:size and mtime_ns=:mtime_ns"
|
select_query = "SELECT {key} FROM files WHERE path=:path AND size=:size and mtime_ns=:mtime_ns"
|
||||||
select_query_ignore_mtime = "SELECT {key} FROM files WHERE path=:path AND size=:size"
|
select_query_ignore_mtime = "SELECT {key} FROM files WHERE path=:path AND size=:size"
|
||||||
insert_query = """
|
insert_query = """
|
||||||
INSERT INTO files (path, size, mtime_ns, entry_dt, {key}) VALUES (:path, :size, :mtime_ns, datetime('now'), :value)
|
INSERT INTO files (path, size, mtime_ns, entry_dt, {key})
|
||||||
|
VALUES (:path, :size, :mtime_ns, datetime('now'), :value)
|
||||||
ON CONFLICT(path) DO UPDATE SET size=:size, mtime_ns=:mtime_ns, entry_dt=datetime('now'), {key}=:value;
|
ON CONFLICT(path) DO UPDATE SET size=:size, mtime_ns=:mtime_ns, entry_dt=datetime('now'), {key}=:value;
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -153,7 +155,8 @@ class FilesDB:
|
|||||||
self.cur.execute(self.select_query_ignore_mtime.format(key=key), {"path": str(path), "size": size})
|
self.cur.execute(self.select_query_ignore_mtime.format(key=key), {"path": str(path), "size": size})
|
||||||
else:
|
else:
|
||||||
self.cur.execute(
|
self.cur.execute(
|
||||||
self.select_query.format(key=key), {"path": str(path), "size": size, "mtime_ns": mtime_ns}
|
self.select_query.format(key=key),
|
||||||
|
{"path": str(path), "size": size, "mtime_ns": mtime_ns},
|
||||||
)
|
)
|
||||||
result = self.cur.fetchone()
|
result = self.cur.fetchone()
|
||||||
|
|
||||||
|
@ -15,4 +15,3 @@ hscommon.gui.progress_window
|
|||||||
.. autoclass:: ProgressWindowView
|
.. autoclass:: ProgressWindowView
|
||||||
:members:
|
:members:
|
||||||
:private-members:
|
:private-members:
|
||||||
|
|
||||||
|
@ -15,4 +15,3 @@ hscommon.gui.tree
|
|||||||
.. autoclass:: Node
|
.. autoclass:: Node
|
||||||
:members:
|
:members:
|
||||||
:private-members:
|
:private-members:
|
||||||
|
|
||||||
|
@ -13,4 +13,3 @@ hscommon
|
|||||||
util
|
util
|
||||||
jobprogress/*
|
jobprogress/*
|
||||||
gui/*
|
gui/*
|
||||||
|
|
||||||
|
@ -14,4 +14,3 @@ hscommon.jobprogress.job
|
|||||||
|
|
||||||
.. autoclass:: NullJob
|
.. autoclass:: NullJob
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
@ -9,4 +9,3 @@ hscommon.jobprogress.performer
|
|||||||
|
|
||||||
.. autoclass:: ThreadedJobPerformer
|
.. autoclass:: ThreadedJobPerformer
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
@ -178,4 +178,3 @@ Preferences are stored elsewhere:
|
|||||||
|
|
||||||
.. _Github: https://github.com/arsenetar/dupeguru
|
.. _Github: https://github.com/arsenetar/dupeguru
|
||||||
.. _open an issue: https://github.com/arsenetar/dupeguru/wiki/issue-labels
|
.. _open an issue: https://github.com/arsenetar/dupeguru/wiki/issue-labels
|
||||||
|
|
||||||
|
@ -12,4 +12,3 @@
|
|||||||
* Եթե համոզված եք, որ կրկնօրինակը արդյունքներում կա, ապա սեղմեք **Խմբագրել-->Նշել բոլորը**, և ապա **Գործողություններ-->Ուղարկել Նշվածը Աղբարկղ**:
|
* Եթե համոզված եք, որ կրկնօրինակը արդյունքներում կա, ապա սեղմեք **Խմբագրել-->Նշել բոլորը**, և ապա **Գործողություններ-->Ուղարկել Նշվածը Աղբարկղ**:
|
||||||
|
|
||||||
Սա միայն բազային ստուգում է: Կան բազմաթիվ կարգավորումներ, որոնք հնարավորություն են տալիս նշելու տարբեր արդյունքներ և մի քանի եղանակներ արդյունքների փոփոխման: Մանրամասների համար կարդացեք Օգնության ֆայլը:
|
Սա միայն բազային ստուգում է: Կան բազմաթիվ կարգավորումներ, որոնք հնարավորություն են տալիս նշելու տարբեր արդյունքներ և մի քանի եղանակներ արդյունքների փոփոխման: Մանրամասների համար կարդացեք Օգնության ֆայլը:
|
||||||
|
|
||||||
|
@ -23,4 +23,3 @@ dupeGuru-ը փորձում է որոշել, թե որ կրկնօրինակներ
|
|||||||
մեծագույն ֆայլը և եթե երկու կամ ավելի ֆայլեր ունեն նույն չափը, ապա մեկը ունի ֆայլի անուն, որը
|
մեծագույն ֆայլը և եթե երկու կամ ավելի ֆայլեր ունեն նույն չափը, ապա մեկը ունի ֆայլի անուն, որը
|
||||||
չի ավարտվում թվով, կօգտագործվի: Երբ փաստարկի արդյունքը կապված է, կարգը, որի սխալները
|
չի ավարտվում թվով, կօգտագործվի: Երբ փաստարկի արդյունքը կապված է, կարգը, որի սխալները
|
||||||
նախկինում էին, խումբը պետք է օգտագործվի:
|
նախկինում էին, խումբը պետք է օգտագործվի:
|
||||||
|
|
||||||
|
@ -114,4 +114,3 @@
|
|||||||
Якщо все це не так, `контакт УГ підтримки <http://www.hardcoded.net/support>`_, ми зрозуміти це.
|
Якщо все це не так, `контакт УГ підтримки <http://www.hardcoded.net/support>`_, ми зрозуміти це.
|
||||||
|
|
||||||
.. todo:: This FAQ qestion is outdated, see english version.
|
.. todo:: This FAQ qestion is outdated, see english version.
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ def trget(domain: str) -> Callable[[str], str]:
|
|||||||
|
|
||||||
|
|
||||||
def set_tr(
|
def set_tr(
|
||||||
new_tr: Callable[[str, Union[str, None]], str], new_trget: Union[Callable[[str], Callable[[str], str]], None] = None
|
new_tr: Callable[[str, Union[str, None]], str],
|
||||||
|
new_trget: Union[Callable[[str], Callable[[str], str]], None] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
global _trfunc, _trget
|
global _trfunc, _trget
|
||||||
_trfunc = new_tr
|
_trfunc = new_tr
|
||||||
|
@ -114,4 +114,3 @@ msgstr ""
|
|||||||
#: core\prioritize.py:158
|
#: core\prioritize.py:158
|
||||||
msgid "Size"
|
msgid "Size"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -243,4 +243,3 @@ msgstr ""
|
|||||||
#: core\se\scanner.py:18
|
#: core\se\scanner.py:18
|
||||||
msgid "Folders"
|
msgid "Folders"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
|
||||||
"Content-Transfer-Encoding: utf-8\n"
|
|
||||||
|
|
@ -1114,3 +1114,10 @@ msgstr ""
|
|||||||
#: qt\progress_window.py:65
|
#: qt\progress_window.py:65
|
||||||
msgid "Are you sure you want to cancel? All progress will be lost."
|
msgid "Are you sure you want to cancel? All progress will be lost."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: qt\exclude_list_dialog.py:161
|
||||||
|
msgid ""
|
||||||
|
"These (case sensitive) python regular expressions will filter out files during scans.<br>Directores will also have their <strong>default state</strong> set to Excluded in the Directories tab if their name happens to match one of the selected regular expressions.<br>For each file collected, two tests are performed to determine whether or not to completely ignore it:<br><li>1. Regular expressions with no path separator in them will be compared to the file name only.</li>\n"
|
||||||
|
"<li>2. Regular expressions with at least one path separator in them will be compared to the full path to the file.</li><br>Example: if you want to filter out .PNG files from the \"My Pictures\" directory only:<br><code>.*My\\sPictures\\\\.*\\.png</code><br><br>You can test the regular expression with the \"test string\" button after pasting a fake path in the test field:<br><code>C:\\\\User\\My Pictures\\test.png</code><br><br>\n"
|
||||||
|
"Matching regular expressions will be highlighted.<br>If there is at least one highlight, the path or filename tested will be ignored during scans.<br><br>Directories and files starting with a period '.' are filtered out by default.<br><br>"
|
||||||
|
msgstr ""
|
||||||
|
@ -348,4 +348,3 @@ dupeguru (2.9.2-1) unstable; urgency=low
|
|||||||
* Fixed selection glitches, especially while renaming. (#93)
|
* Fixed selection glitches, especially while renaming. (#93)
|
||||||
|
|
||||||
-- Virgil Dupras <hsoft@hardcoded.net> Wed, 10 Feb 2010 00:00:00 +0000
|
-- Virgil Dupras <hsoft@hardcoded.net> Wed, 10 Feb 2010 00:00:00 +0000
|
||||||
|
|
||||||
|
@ -165,8 +165,8 @@ Directores will also have their <strong>default state</strong> set to Excluded \
|
|||||||
in the Directories tab if their name happens to match one of the selected regular expressions.<br>\
|
in the Directories tab if their name happens to match one of the selected regular expressions.<br>\
|
||||||
For each file collected, two tests are performed to determine whether or not to completely ignore it:<br>\
|
For each file collected, two tests are performed to determine whether or not to completely ignore it:<br>\
|
||||||
<li>1. Regular expressions with no path separator in them will be compared to the file name only.</li>
|
<li>1. Regular expressions with no path separator in them will be compared to the file name only.</li>
|
||||||
<li>2. Regular expressions with at least one path separator in them will be compared to the full path to the file.</li><br>
|
<li>2. Regular expressions with at least one path separator in them will be compared to the full path to the file.</li>\
|
||||||
Example: if you want to filter out .PNG files from the "My Pictures" directory only:<br>\
|
<br>Example: if you want to filter out .PNG files from the "My Pictures" directory only:<br>\
|
||||||
<code>.*My\\sPictures\\\\.*\\.png</code><br><br>\
|
<code>.*My\\sPictures\\\\.*\\.png</code><br><br>\
|
||||||
You can test the regular expression with the "test string" button after pasting a fake path in the test field:<br>\
|
You can test the regular expression with the "test string" button after pasting a fake path in the test field:<br>\
|
||||||
<code>C:\\\\User\\My Pictures\\test.png</code><br><br>
|
<code>C:\\\\User\\My Pictures\\test.png</code><br><br>
|
||||||
|
@ -31,7 +31,10 @@ class File(PhotoBase):
|
|||||||
image = image.convertToFormat(QImage.Format_RGB888)
|
image = image.convertToFormat(QImage.Format_RGB888)
|
||||||
if type(orientation) != int:
|
if type(orientation) != int:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
"Orientation for file '%s' was a %s '%s', not an int.", str(self.path), type(orientation), orientation
|
"Orientation for file '%s' was a %s '%s', not an int.",
|
||||||
|
str(self.path),
|
||||||
|
type(orientation),
|
||||||
|
orientation,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
orientation = int(orientation)
|
orientation = int(orientation)
|
||||||
|
@ -146,7 +146,8 @@ On MacOS, the tab bar will fill up the window's width instead."
|
|||||||
)
|
)
|
||||||
self.use_native_dialogs.setToolTip(
|
self.use_native_dialogs.setToolTip(
|
||||||
tr(
|
tr(
|
||||||
"For actions such as file/folder selection use the OS native dialogs.\nSome native dialogs have limited functionality."
|
"For actions such as file/folder selection use the OS native dialogs.\n\
|
||||||
|
Some native dialogs have limited functionality."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
layout.addWidget(self.use_native_dialogs)
|
layout.addWidget(self.use_native_dialogs)
|
||||||
@ -217,7 +218,8 @@ use the modifier key to drag the floating window around"
|
|||||||
def _setup_advanced_page(self):
|
def _setup_advanced_page(self):
|
||||||
tab_label = QLabel(
|
tab_label = QLabel(
|
||||||
tr(
|
tr(
|
||||||
"These options are for advanced users or for very specific situations, most users should not have to modify these."
|
"These options are for advanced users or for very specific situations, \
|
||||||
|
most users should not have to modify these."
|
||||||
),
|
),
|
||||||
wordWrap=True,
|
wordWrap=True,
|
||||||
)
|
)
|
||||||
|
4
tox.ini
4
tox.ini
@ -16,7 +16,7 @@ deps =
|
|||||||
-r{toxinidir}/requirements-extra.txt
|
-r{toxinidir}/requirements-extra.txt
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude = .tox,env,build,cocoalib,cocoa,help,./qt/dg_rc.py,cocoa/run_template.py,./pkg
|
exclude = .tox,env*,build,help,qt/dg_rc.py,pkg
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
select = C,E,F,W,B,B950
|
select = C,E,F,W,B,B950
|
||||||
extend-ignore = E203, E501, W503
|
extend-ignore = E203,W503
|
||||||
|
Loading…
x
Reference in New Issue
Block a user