Skip to content

Commit

Permalink
Merge pull request #1770 from beeware/autoupdates/pre-commit
Browse files Browse the repository at this point in the history
Auto-update `pre-commit` hooks
  • Loading branch information
freakboy3742 authored Feb 6, 2023
2 parents 3c36e52 + 2291fda commit 3e3e458
Show file tree
Hide file tree
Showing 54 changed files with 8 additions and 80 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4.5.0
with:
python-version: ${{ env.min_python_version }}
python-version: "3.X"
- uses: pre-commit/action@v3.0.0

towncrier:
Expand All @@ -37,7 +37,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v4.5.0
with:
python-version: ${{ env.min_python_version }}
python-version: "3.X"
- name: Install dev dependencies
run: |
# We don't actually want to install toga-core;
Expand Down
19 changes: 5 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exclude: "^(attic|examples/.template|nursery)/"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-toml
- id: check-yaml
Expand All @@ -10,29 +10,20 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/PyCQA/isort
# For split_on_trailing_comma. Should be in the release after 5.10.1
rev: 12cc5fbd67eebf92eb2213b03c07b138ae1fb448
rev: 5.12.0
hooks:
- id: isort
additional_dependencies: [toml]
- repo: https://github.com/asottile/pyupgrade
rev: v3.2.0
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py37-plus]
# Docformatter is RST-unaware, and may break markup by inserting or removing newlines
# (see https://github.com/PyCQA/docformatter/issues/124 and linked issues). Until this
# is fixed, it's not safe to run it automatically.
# - repo: https://github.com/myint/docformatter
# rev: v1.5.0
# hooks:
# - id: docformatter
# args: [--in-place]
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
1 change: 1 addition & 0 deletions changes/1770.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated ``pre-commit`` hooks to the latest version.
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def cocoa_windowShouldClose(self):


class AppDelegate(NSObject):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class TogaDocument(NSDocument):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ def set_tab_index(self, tab_index):
# INTERFACE

def add_child(self, child):

if self.viewport:
# we are the the top level NSView
child.container = self
Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class TogaButton(NSButton):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@


class TogaCanvas(NSView):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/detailedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def attr_impl(value, attr):


class TogaList(NSTableView):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
2 changes: 0 additions & 2 deletions cocoa/src/toga_cocoa/widgets/internal/cells.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def setup(self):

@objc_method
def setImage_(self, image):

if not self.imageView:
self.setup()

Expand All @@ -139,7 +138,6 @@ def setImage_(self, image):

@objc_method
def setText_(self, text):

if not self.imageView:
self.setup()

Expand Down
2 changes: 0 additions & 2 deletions cocoa/src/toga_cocoa/widgets/internal/refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@


class RefreshableClipView(NSClipView):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down Expand Up @@ -73,7 +72,6 @@ def documentRect(self) -> NSRect:


class RefreshableScrollView(NSScrollView):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/numberinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@


class TogaStepper(NSStepper):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/optioncontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class TogaTabViewDelegate(NSObject):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/passwordinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class TogaSecureTextField(NSSecureTextField):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class TogaPopupButton(NSPopUpButton):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class TogaSlider(NSSlider):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/splitcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class TogaSplitViewDelegate(NSObject):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class TogaSwitch(NSButton):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
2 changes: 0 additions & 2 deletions cocoa/src/toga_cocoa/widgets/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


class TogaTable(NSTableView):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down Expand Up @@ -155,7 +154,6 @@ def onDoubleClick_(self, sender) -> None:

class Table(Widget):
def create(self):

self._view_for_row = dict()

# Create a table view, and put it in a scroll view.
Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class TogaTextField(NSTextField):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
4 changes: 0 additions & 4 deletions cocoa/src/toga_cocoa/widgets/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@


class TogaTree(NSOutlineView):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down Expand Up @@ -73,7 +72,6 @@ def outlineView_numberOfChildrenOfItem_(self, tree, item) -> int:

@objc_method
def outlineView_viewForTableColumn_item_(self, tree, column, item):

col_identifier = str(column.identifier)

try:
Expand Down Expand Up @@ -133,7 +131,6 @@ def outlineView_viewForTableColumn_item_(self, tree, column, item):

@objc_method
def outlineView_heightOfRowByItem_(self, tree, item) -> float:

default_row_height = self.rowHeight

if item is self:
Expand Down Expand Up @@ -229,7 +226,6 @@ def create(self):
for i, (heading, accessor) in enumerate(
zip(self.interface.headings, self.interface._accessors)
):

column_identifier = at(accessor)
self.column_identifiers[id(column_identifier)] = accessor
column = NSTableColumn.alloc().initWithIdentifier(column_identifier)
Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/widgets/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ async def evaluate_javascript(self, javascript):
future = loop.create_future()

def completion_handler(res: objc_id, error: objc_id) -> None:

if error:
error = py_from_ns(error)
exc = RuntimeError(str(error))
Expand Down
1 change: 0 additions & 1 deletion cocoa/src/toga_cocoa/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def height(self):


class WindowDelegate(NSObject):

interface = objc_property(object, weak=True)
impl = objc_property(object, weak=True)

Expand Down
1 change: 0 additions & 1 deletion core/src/toga/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def __init__(
parent=None,
label=None, # DEPRECATED!
):

##################################################################
# 2022-07: Backwards compatibility
##################################################################
Expand Down
1 change: 0 additions & 1 deletion core/src/toga/style/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def apply(self, prop, value):
)

def layout(self, node, viewport):

# Precompute `scale_factor` by providing it as a default param.
def scale(value, scale_factor=viewport.dpi / viewport.baseline_dpi):
return int(value * scale_factor)
Expand Down
3 changes: 0 additions & 3 deletions core/src/toga/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ def count(self, input_string: str):


class Integer(MatchRegex):

INTEGER_REGEX = r"^\d+$"

def __init__(self, error_message: Optional[str] = None, allow_empty: bool = True):
Expand All @@ -350,7 +349,6 @@ def __init__(self, error_message: Optional[str] = None, allow_empty: bool = True


class Number(MatchRegex):

NUMBER_REGEX = r"^[-+]?(\d+\.|\d*\.?\d+)([eE][-+]?\d+)?$"

def __init__(self, error_message: Optional[str] = None, allow_empty: bool = True):
Expand All @@ -362,7 +360,6 @@ def __init__(self, error_message: Optional[str] = None, allow_empty: bool = True


class Email(MatchRegex):

EMAIL_REGEX = (
r"^[a-zA-Z][a-zA-Z0-9\.]*[a-zA-Z0-9]@[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z0-9]+)+$"
)
Expand Down
2 changes: 0 additions & 2 deletions core/src/toga/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def add(self, *children):
"""
for child in children:
if child.parent is not self:

# remove from old parent
if child.parent:
child.parent.remove(child)
Expand Down Expand Up @@ -146,7 +145,6 @@ def insert(self, index, child):
:param child: The child to insert as a child of this node.
"""
if child.parent is not self:

# remove from old parent
if child.parent:
child.parent.remove(child)
Expand Down
1 change: 0 additions & 1 deletion core/src/toga/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ def __init__(
on_alt_drag=None,
factory=None, # DEPRECATED!
):

super().__init__(id=id, style=style)
######################################################################
# 2022-09: Backwards compatibility
Expand Down
1 change: 0 additions & 1 deletion core/src/toga/widgets/imageview.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def image(self):

@image.setter
def image(self, image):

if isinstance(image, str):
self._image = Image(image)
else:
Expand Down
2 changes: 0 additions & 2 deletions core/src/toga/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def __init__(
factory=None, # DEPRECATED !
on_close=None,
):

######################################################################
# 2022-09: Backwards compatibility
######################################################################
Expand Down Expand Up @@ -145,7 +144,6 @@ def content(self):

@content.setter
def content(self, widget):

# Set window of old content to None
if self._content:
self._content.window = None
Expand Down
1 change: 0 additions & 1 deletion core/tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ def test_set_app_after_content(self):
self.assertEqual(content.app, self.app)

def test_set_app_adds_window_widgets_to_app(self):

id0, id1, id2, id3 = "id0", "id1", "id2", "id3"
widget1, widget2, widget3 = (
toga.Label(id=id1, text="label 1"),
Expand Down
1 change: 0 additions & 1 deletion core/tests/widgets/test_scrollcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def test_set_vertical_position_when_unset_raises_an_error(self):
self.sc.vertical_position = 0.5

def test_set_app(self):

new_content = toga.Box(style=TestStyle())
self.sc.content = new_content
self.assertIsNone(new_content.app)
Expand Down
1 change: 0 additions & 1 deletion core/tests/widgets/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def test_add_column(self):
self.assertEqual(self.table.headings, expecting_headings)

def test_add_columns_accessor_in_use(self):

new_heading = "Heading 4"
accessor = "heading_2"

Expand Down
1 change: 0 additions & 1 deletion examples/activityindicator/activityindicator/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
class ExampleActivityIndicatorApp(toga.App):
# Button callback functions
def do_stuff(self, widget, **kwargs):

if self.spinner.is_running:
self.spinner.stop()
self.button.text = "Start"
Expand Down
Loading

0 comments on commit 3e3e458

Please sign in to comment.