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

style: Fix W0246: Useless parent or super() delegation in method '__init__' (useless-parent-delegation) #4887

Merged
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
9 changes: 0 additions & 9 deletions gui/wxpython/gui_core/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,17 +618,11 @@ class DragImage(wx.GenericDragImage if wxPythonPhoenix else wx.DragImage):
"""Wrapper around wx.DragImage to have more control
over the widget on different platforms/wxpython versions"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


class PseudoDC(wx.adv.PseudoDC if wxPythonPhoenix else wx.PseudoDC):
"""Wrapper around wx.PseudoDC to have more control
over the widget on different platforms/wxpython versions"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def DrawLinePoint(self, *args, **kwargs):
args = convertToInt(argsOrKwargs=args, roundVal=True)
kwargs = convertToInt(argsOrKwargs=kwargs, roundVal=True)
Expand Down Expand Up @@ -671,9 +665,6 @@ class ClientDC(wx.ClientDC):
"""Wrapper around wx.ClientDC to have more control
over the widget on different platforms/wxpython versions"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def GetFullMultiLineTextExtent(self, string, font=None):
if wxPythonPhoenix:
return super().GetFullMultiLineTextExtent(string, font)
Expand Down
15 changes: 0 additions & 15 deletions gui/wxpython/mapdisp/gprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,6 @@ def __init__(self, canvas):
wx.Printout.__init__(self)
self.canvas = canvas

def OnBeginDocument(self, start, end):
return super().OnBeginDocument(start, end)

def OnEndDocument(self):
super().OnEndDocument()

def OnBeginPrinting(self):
super().OnBeginPrinting()

def OnEndPrinting(self):
super().OnEndPrinting()

def OnPreparePrinting(self):
super().OnPreparePrinting()

def HasPage(self, page) -> bool:
return page <= 2

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ disable = [
"W0223", # Method %r is abstract in class %r but is not overridden in child class %r (abstract-method)
"W0231", # __init__ method from base class %r is not called (super-init-not-called)
"W0237", # (arguments-renamed)
"W0246", # Useless parent or super() delegation in method %r (useless-parent-delegation)
"W0401", # Wildcard import %s (wildcard-import)
"W0404", # Reimport %r (imported line %s) (reimported)
"W0511", # (fixme)
Expand Down
3 changes: 0 additions & 3 deletions python/grass/gunittest/reporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,9 +959,6 @@ def __init__(self, stream):
super().__init__()
self._stream = stream

def start(self, results_dir):
super().start(results_dir)

def finish(self):
super().finish()

Expand Down
3 changes: 0 additions & 3 deletions python/grass/pygrass/raster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ class RasterRow(RasterAbstractBase):

"""

def __init__(self, name, mapset="", *args, **kargs):
super().__init__(name, mapset, *args, **kargs)

# mode = "r", method = "row",
@must_be_open
def get_row(self, row, row_buffer=None):
Expand Down
66 changes: 23 additions & 43 deletions python/grass/pygrass/vector/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,47 @@
@author: pietro
"""

import grass.lib.vector as libvect
from __future__ import annotations

from typing import TYPE_CHECKING

import grass.lib.vector as libvect
from grass.pygrass.errors import must_be_open
from grass.pygrass.vector.basic import BoxList, Ilist
from grass.pygrass.vector.geometry import Area, Isle, Node, read_line

from grass.pygrass.vector.basic import Ilist, BoxList
from grass.pygrass.vector.geometry import read_line, Isle, Area, Node
if TYPE_CHECKING:
from grass.pygrass.vector.table import Table

# For test purposes
test_vector_name = "find_doctest_map"


class AbstractFinder:
def __init__(self, c_mapinfo, table=None, writeable=False):
"""Abstract finder
-----------------

Find geometry feature around a point.
def __init__(
self, c_mapinfo, table: Table | None = None, writeable: bool = False
) -> None:
"""Find geometry feature(s) around a point or that are inside or intersect
with a bounding box.

:param c_mapinfo: Pointer to the vector layer mapinfo structure
:type c_mapinfo: ctypes pointer to mapinfo structure
:param table: Attribute table of the vector layer
:param writable: True or False
"""
self.c_mapinfo = c_mapinfo
self.table = table
self.writeable = writeable
self.vtype = {
self.table: Table | None = table
self.writeable: bool = writeable
self.vtype: dict[str, int] = {
"point": libvect.GV_POINT, # 1
"line": libvect.GV_LINE, # 2
"boundary": libvect.GV_BOUNDARY, # 3
"centroid": libvect.GV_CENTROID, # 4
"all": -1,
}

def is_open(self):
def is_open(self) -> bool:
"""Check if the vector map is open or not"""
from . import abstract

Expand All @@ -48,20 +59,6 @@ class PointFinder(AbstractFinder):
is part of a topological vector map object.
"""

def __init__(self, c_mapinfo, table=None, writeable=False):
"""Find geometry feature(s) around a point.

:param c_mapinfo: Pointer to the vector layer mapinfo structure
:type c_mapinfo: ctypes pointer to mapinfo structure

:param table: Attribute table of the vector layer
:type table: Class Table from grass.pygrass.table

:param writable: True or False
:type writeable: boolean
"""
super().__init__(c_mapinfo, table, writeable)

@must_be_open
def node(self, point, maxdist):
"""Find the nearest node around a specific point.
Expand Down Expand Up @@ -397,21 +394,6 @@ class BboxFinder(AbstractFinder):

"""

def __init__(self, c_mapinfo, table=None, writeable=False):
"""Find geometry feature(s)that are insider or intersect
with a boundingbox.

:param c_mapinfo: Pointer to the vector layer mapinfo structure
:type c_mapinfo: ctypes pointer to mapinfo structure

:param table: Attribute table of the vector layer
:type table: Class Table from grass.pygrass.table

:param writable: True or False
:type writeable: boolean
"""
super().__init__(c_mapinfo, table, writeable)

@must_be_open
def geos(self, bbox, type="all", bboxlist_only=False):
"""Find vector features inside a boundingbox.
Expand Down Expand Up @@ -662,9 +644,6 @@ def islands(self, bbox, bboxlist_only=False):


class PolygonFinder(AbstractFinder):
def __init__(self, c_mapinfo, table=None, writeable=False):
super().__init__(c_mapinfo, table, writeable)

def lines(self, polygon, isles=None):
pass

Expand All @@ -674,6 +653,7 @@ def areas(self, polygon, isles=None):

if __name__ == "__main__":
import doctest

from grass.pygrass import utils

utils.create_test_vector_map(test_vector_name)
Expand Down
Loading