Skip to content

Commit

Permalink
Make it ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus committed Jul 8, 2024
1 parent bfaba86 commit 72ba240
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 39 deletions.
38 changes: 10 additions & 28 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
repos:
# Fix end of files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args:
- '--fix=lf'

# Remove unused imports/variables
- repo: https://github.com/myint/autoflake
rev: v1.4
# Lint and format
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.4
hooks:
- id: autoflake
args:
- "--in-place"
- "--remove-all-unused-imports"
- "--remove-unused-variables"
- "--exclude=__init__.py"

# Sort imports
- repo: https://github.com/pycqa/isort
rev: "5.12.0"
hooks:
- id: isort
args: ["--profile", "black"]
# Run the linter.
- id: ruff
args: [ --fix ]

# Black formatting
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

# Lint files
- repo: https://github.com/pycqa/flake8
rev: "3.9.0"
hooks:
- id: flake8
# Run the formatter.
- id: ruff-format
2 changes: 0 additions & 2 deletions qfieldsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@

from __future__ import absolute_import

import os
import pathlib
import sys

import qgis.utils

src_dir = pathlib.Path(__file__).parent.resolve()

Expand Down
2 changes: 0 additions & 2 deletions qfieldsync/core/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def from_reply(reply: QNetworkReply) -> Optional[CloudException]:


class CloudNetworkAccessManager(QObject):

token_changed = pyqtSignal()
login_finished = pyqtSignal()
logout_success = pyqtSignal()
Expand Down Expand Up @@ -726,7 +725,6 @@ def __init__(self, reply: QNetworkReply):


class CloudProjectsCache(QObject):

projects_started = pyqtSignal()
projects_updated = pyqtSignal()
projects_error = pyqtSignal(str)
Expand Down
1 change: 0 additions & 1 deletion qfieldsync/core/cloud_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def __init__(
project: QgsProject,
export_dirname: str,
):

super(CloudConverter, self).__init__(parent=None)
self.project = project
self.__layers = list()
Expand Down
1 change: 0 additions & 1 deletion qfieldsync/core/cloud_transferrer.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def _on_logout_success(self) -> None:


class FileTransfer(QObject):

progress = pyqtSignal(int, int)
finished = pyqtSignal()

Expand Down
4 changes: 1 addition & 3 deletions qfieldsync/gui/cloud_transfer_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ def showEvent(self, event: QShowEvent) -> None:
else:
self.show_project_local_dir_selection()
else:
if (
self.network_manager.projects_cache.is_currently_open_project_cloud_local
):
if self.network_manager.projects_cache.is_currently_open_project_cloud_local:
reply = self.network_manager.projects_cache.refresh()
reply.finished.connect(lambda: self.show_project_compatibility_page())

Expand Down
5 changes: 3 additions & 2 deletions qfieldsync/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
***************************************************************************/
"""

# TODO check if this file should have any contents at all???
# import qgis libs so that ve set the correct sip api version
import pkgutil
import pkgutil # pylint: disable=W0611 # NOQA

import qgis # pylint: disable=W0611 # NOQA

import qfieldsync
import qfieldsync # pylint: disable=W0611 # NOQA

0 comments on commit 72ba240

Please sign in to comment.