From 0f882a7b012291108a5a57220d4b52aad169e3c3 Mon Sep 17 00:00:00 2001 From: drew2a Date: Mon, 28 Mar 2022 16:31:53 +0200 Subject: [PATCH 1/4] Remove pre-commit --- .flake8 | 2 +- .isort.cfg | 13 ----------- .pre-commit-config.yaml | 49 ----------------------------------------- 3 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 .isort.cfg delete mode 100644 .pre-commit-config.yaml diff --git a/.flake8 b/.flake8 index 7c36ff61a5c..770f8bffef0 100644 --- a/.flake8 +++ b/.flake8 @@ -2,4 +2,4 @@ max-line-length = 120 select=E901,E999,F821,F822,F823,I100,I101,I201,I202,T001,T002,T003,T004 ignore=E203,W503,C0330 -application-import-names=tribler,run_tribler +import-order-style=pycharm diff --git a/.isort.cfg b/.isort.cfg deleted file mode 100644 index 41aa578c58e..00000000000 --- a/.isort.cfg +++ /dev/null @@ -1,13 +0,0 @@ -[settings] -order_by_type = False -multi_line_output=3 -case_sensitive = True -include_trailing_comma=True -force_grid_wrap=0 -use_parentheses = True -combine_as_imports=True -force_sort_within_sections=True -line_length=120 -known_future_library=future -known_first_party=tribler,run_tribler -known_third_party=pony,twisted,six,anydex,ipv8,libtorrent,lz4,PyQt5,zope,aiohttp,psutil,configobj,ipv8_service,asynctest,numpy,networkx,async_timeout,cherrypy,nose,validate,check_os,matplotlib,pyqtgraph,_socket,aiohttp_apispec,marshmallow,PIL,anyio,freezegun,yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 92a6b8d97e9..00000000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,49 +0,0 @@ -default_language_version: - python: python3 -repos: -- repo: https://github.com/Tribler/mirrors-autoflake - rev: v1.4 - hooks: - - id: autoflake - args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] - types: [file, python] - -- repo: https://github.com/Tribler/isort - rev: 4.3.21-3-tribler - hooks: - - id: isort - types: [file, python] - -- repo: https://github.com/ambv/black - rev: 20.8b1 - hooks: - - id: black - files: | - (?x)( - ^src/tribler/gui/ - ) - types: [file, python] - -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.0 - hooks: - - id: flake8 - types: [file, python] - additional_dependencies: [ - 'flake8-import-order==0.18.1', - 'flake8-print', - ] - -- repo: local - hooks: - - id: pylint - name: pylint - entry: pylint - language: system - files: | - (?x)( - ^src/tribler/gui/| - ^src/tribler/core/ - ) - types: [file, python] - From 848c2c3a9d6e98d7ad5796421a971f4eff19f38d Mon Sep 17 00:00:00 2001 From: drew2a Date: Mon, 28 Mar 2022 16:54:12 +0200 Subject: [PATCH 2/4] Optimize imports for Upgrade Manager --- src/tribler/gui/upgrade_manager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tribler/gui/upgrade_manager.py b/src/tribler/gui/upgrade_manager.py index a6e1bbadf2f..96feb808fe5 100644 --- a/src/tribler/gui/upgrade_manager.py +++ b/src/tribler/gui/upgrade_manager.py @@ -4,10 +4,9 @@ from PyQt5.QtCore import QObject, QThread, pyqtSignal from PyQt5.QtWidgets import QMessageBox -from tribler.run_tribler_upgrader import upgrade_state_dir from tribler.core.upgrade.version_manager import TriblerVersion, VersionHistory - from tribler.gui.utilities import connect, format_size, tr +from tribler.run_tribler_upgrader import upgrade_state_dir class StateDirUpgradeWorker(QObject): From 6e6e282e738ad8b43fe11904da6e84a99677c2e0 Mon Sep 17 00:00:00 2001 From: drew2a Date: Tue, 29 Mar 2022 14:57:10 +0200 Subject: [PATCH 3/4] Remove select --- .flake8 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 770f8bffef0..33d5260fb67 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,4 @@ [flake8] max-line-length = 120 -select=E901,E999,F821,F822,F823,I100,I101,I201,I202,T001,T002,T003,T004 -ignore=E203,W503,C0330 +ignore=E127, E128, E131, E731, E722, E501, F401, F841, F722 , I202 import-order-style=pycharm From 541672cf99439df20c3661f04450e9494432ef39 Mon Sep 17 00:00:00 2001 From: Andrei Andreev Date: Tue, 29 Mar 2022 15:19:40 +0200 Subject: [PATCH 4/4] Update .flake8 Co-authored-by: Alexander Kozlovsky --- .flake8 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 33d5260fb67..280d141fb5d 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,14 @@ [flake8] max-line-length = 120 -ignore=E127, E128, E131, E731, E722, E501, F401, F841, F722 , I202 +extend-ignore = + I202, # Additional newline in a group of imports + E127, # continuation line over-indented for visual indent + E128, # continuation line under-indented for visual indent + E131, # continuation line unaligned for hanging indent + F722, # syntax error in forward annotation '20s' + E731, # do not assign a lambda expression, use a def + F401, # Pylint-checked, module imported but unused + F841, # Pylint-checked, local variable is assigned to but never used + E722, # Pylint-checked, do not use bare 'except' + E501 # Pylint-checked, line too long import-order-style=pycharm