Skip to content

Commit

Permalink
chore: Fix ruff issues and ignore more rules
Browse files Browse the repository at this point in the history
  • Loading branch information
TheEvilSkeleton committed Jan 9, 2025
1 parent 1e94450 commit 74b33e3
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
rev: v0.8.2
hooks:
- id: ruff
args: [ "--fix", "--ignore", "F401" ]
args: [ "--fix", "--ignore", "F401,F402,E722,E741" ]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
Expand Down
2 changes: 1 addition & 1 deletion bottles/backend/managers/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def set(self, key, value, of_type=None):
else:
self.__data[key] = value
else:
if of_type == list:
if of_type is list:
self.__data[key] = [value]
else:
self.__data[key] = value
Expand Down
1 change: 1 addition & 0 deletions bottles/frontend/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

signal.signal(signal.SIGINT, signal.SIG_DFL)

# ruff: noqa: E402
from gi.repository import Gio

from bottles.frontend.params import APP_ID
Expand Down
5 changes: 1 addition & 4 deletions bottles/frontend/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,11 @@
from typing import Dict
from uuid import UUID

import gi
from gi.repository import Gtk, Adw

from bottles.backend.models.result import Result
from bottles.backend.state import TaskManager

gi.require_version("Adw", "1")
from gi.repository import Gtk, Adw


@Gtk.Template(resource_path="/com/usebottles/bottles/task-entry.ui")
class TaskEntry(Adw.ActionRow):
Expand Down
2 changes: 2 additions & 0 deletions bottles/frontend/utils/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from gettext import gettext as _

from gi.repository import Gtk


Expand Down
2 changes: 2 additions & 0 deletions bottles/frontend/widgets/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

from gettext import gettext as _

from gi.repository import Gtk, Adw

from bottles.backend.utils.manager import ManagerUtils
Expand Down
1 change: 1 addition & 0 deletions bottles/frontend/widgets/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

from datetime import datetime
from gettext import gettext as _

from gi.repository import Gtk, Adw

Expand Down
2 changes: 1 addition & 1 deletion bottles/frontend/windows/crash.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, window, log, **kwargs):
super().__init__(**kwargs)
self.set_transient_for(window)

if type(log) == list:
if type(log) is list:
log = "".join(log)

# connect signals
Expand Down
2 changes: 1 addition & 1 deletion bottles/frontend/windows/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def update(result, error=False):
)

if (
self.expander_virtual_desktop.get_enable_expansion() == True
self.expander_virtual_desktop.get_enable_expansion()
and resolution != self.parameters.virtual_desktop_res
):
"""Set virtual desktop resolution"""
Expand Down
2 changes: 2 additions & 0 deletions bottles/frontend/windows/dlloverrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

from gettext import gettext as _

from gi.repository import Gtk, GLib, Adw

from bottles.backend.dlls.dll import DLLComponent
Expand Down
2 changes: 2 additions & 0 deletions bottles/frontend/windows/drives.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import string

from gettext import gettext as _

from gi.repository import Gtk, GLib, Adw

from bottles.backend.wine.drives import Drives
Expand Down
2 changes: 2 additions & 0 deletions bottles/frontend/windows/envvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

from gettext import gettext as _

from gi.repository import Gtk, GLib, Adw

from bottles.frontend.utils.gtk import GtkUtils
Expand Down
2 changes: 2 additions & 0 deletions bottles/frontend/windows/exclusionpatterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

from gettext import gettext as _

from gi.repository import Gtk, GLib, Adw


Expand Down
2 changes: 2 additions & 0 deletions bottles/frontend/windows/fsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from gettext import gettext as _

from gi.repository import Gtk, GLib, Adw
from bottles.backend.logger import Logger

Expand Down
2 changes: 1 addition & 1 deletion bottles/frontend/windows/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def __build_ui(self):
btn_copy.connect("clicked", self.__copy_text)
btn_copy.set_tooltip_text(_("Copy to clipboard"))

webview.load_html(self.message, "file://")
# webview.load_html(self.message, "file://")
# scrolled.append(webview)

box.append(headerbar)
Expand Down
1 change: 1 addition & 0 deletions bottles/frontend/windows/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import urllib.request

from gettext import gettext as _
from gi.repository import Gtk, GLib, Gio, GdkPixbuf, Adw

from bottles.backend.utils.threading import RunAsync
Expand Down
6 changes: 3 additions & 3 deletions bottles/frontend/windows/vkbasalt.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ def __init__(self, window, config, **kwargs):

# Check if subeffects are used
for conf in subeffects:
if conf[0] != None:
if conf[0] is not None:
conf[1].set_value(float(conf[0]))

if VkBasaltSettings.smaa_edge_detection != None:
if VkBasaltSettings.smaa_edge_detection is not None:
if VkBasaltSettings.smaa_edge_detection == "color":
self.toggle_color.set_active(True)
self.smaa_edge_detection = "color"
Expand Down Expand Up @@ -186,7 +186,7 @@ def __check_state(self, *args):
# Enable and disable other buttons depending on default button when necessary
def __default(self, widget, state):
self.group_effects.set_sensitive(not state)
if self.check_effects_states() == False:
if not self.check_effects_states():
self.btn_save.set_sensitive(state)

# Change edge detection type
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@
log_cli = true
log_cli_level = "INFO"
log_cli_format = "%(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)"

[tool.ruff]
exclude = [
"bottles/backend/utils/nvidia.py",
"bottles/backend/utils/vdf.py",
]

0 comments on commit 74b33e3

Please sign in to comment.