Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flake8 tweaks #1835

Merged
merged 3 commits into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ defaults:
run:
shell: bash

# Cancel active CI runs for a PR before starting another run
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
name: Pre-commit checks
Expand Down
1 change: 1 addition & 0 deletions changes/1835.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed unnecessary ``noqa`` markers for flake8 and simplified the configuration.
4 changes: 2 additions & 2 deletions cocoa/src/toga_cocoa/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def set_content(self, widget):
# bigger. If the window is resizable, using >= allows the window to
# be dragged larged; if not resizable, it enforces the smallest
# size that can be programmattically set on the window.
self._min_width_constraint = NSLayoutConstraint.constraintWithItem_attribute_relatedBy_toItem_attribute_multiplier_constant_( # NOQA: E501
self._min_width_constraint = NSLayoutConstraint.constraintWithItem_attribute_relatedBy_toItem_attribute_multiplier_constant_( # noqa: E501
widget.native,
NSLayoutAttributeRight,
NSLayoutRelationGreaterThanOrEqual,
Expand All @@ -224,7 +224,7 @@ def set_content(self, widget):
)
widget.native.addConstraint(self._min_width_constraint)

self._min_height_constraint = NSLayoutConstraint.constraintWithItem_attribute_relatedBy_toItem_attribute_multiplier_constant_( # NOQA: E501
self._min_height_constraint = NSLayoutConstraint.constraintWithItem_attribute_relatedBy_toItem_attribute_multiplier_constant_( # noqa: E501
widget.native,
NSLayoutAttributeBottom,
NSLayoutRelationGreaterThanOrEqual,
Expand Down
2 changes: 1 addition & 1 deletion core/src/toga/colors.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Use the Travertino color definitions as-is
from travertino.colors import * # noqa: F401,F403
from travertino.colors import * # noqa: F401, F403
2 changes: 1 addition & 1 deletion core/src/toga/constants/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from travertino.constants import * # noqa: F401,F403
from travertino.constants import * # noqa: F401, F403
4 changes: 2 additions & 2 deletions core/src/toga/fonts.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import warnings

# Use the Travertino font definitions as-is
from travertino import constants # noqa: F401
from travertino import constants
from travertino.constants import ITALIC # noqa: F401
from travertino.constants import ( # noqa: F401
BOLD,
Expand All @@ -17,7 +17,7 @@
SYSTEM,
)
from travertino.fonts import font # noqa: F401
from travertino.fonts import Font as BaseFont # noqa: F401
from travertino.fonts import Font as BaseFont

from toga.platform import get_platform_factory

Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def do_size_allocate(self, allocation):
and that new geometry will be applied to all child widgets of the
container.
"""
# print(self._content, f"Container layout {allocation.width}x{allocation.height} @ {allocation.x}x{allocation.y}")
# print(self._content, f"Container layout {allocation.width}x{allocation.height} @ {allocation.x}x{allocation.y}") # noqa: E501

# The container will occupy the full space it has been allocated.
resized = (allocation.width, allocation.height) != (self.width, self.height)
Expand Down
8 changes: 4 additions & 4 deletions gtk/src/toga_gtk/libs/gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
gi.require_version("Gdk", "3.0")
gi.require_version("Gtk", "3.0")

from gi.repository import Gdk, GdkPixbuf, Gio, GLib, GObject, Gtk # noqa: F401, E402
from gi.repository import Gdk, GdkPixbuf, Gio, GLib, GObject, Gtk # noqa: E402, F401

# The following import will fail if WebKit or its API wrappers aren't
# installed; handle failure gracefully
Expand All @@ -13,19 +13,19 @@
for version in ["4.0", "3.0"]:
try:
gi.require_version("WebKit2", version)
from gi.repository import WebKit2 # noqa: F401, E402
from gi.repository import WebKit2 # noqa: F401

break
except (ImportError, ValueError):
pass

try:
gi.require_version("Pango", "1.0")
from gi.repository import Pango # noqa: F401, E402
from gi.repository import Pango
except ImportError:
Pango = None

try:
import cairo # noqa: F401, E402
import cairo
except ImportError:
cairo = None
6 changes: 4 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[flake8]
max-complexity = 30
max-line-length = 119
ignore = E203,E266,E501,W503
extend-ignore =
# whitespace before :
# See https://github.com/PyCQA/pycodestyle/issues/373
E203,