Skip to content

Commit

Permalink
Merge pull request #466 from SpiNNakerManchester/pylint_fix
Browse files Browse the repository at this point in the history
Pylint fix
  • Loading branch information
rowleya committed Jan 11, 2023
2 parents d27f8b4 + 608ac27 commit 572e260
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/python_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
uses: ./support/actions/pylint
with:
package: ${{ env.BASE_PKG }}
exitcheck: 39

- name: Run rat copyright enforcement
if: matrix.python-version == 3.8
Expand Down
1 change: 1 addition & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ init-import=no
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
__call__,
_clear,
_hard_reset,
setUp
Expand Down
1 change: 1 addition & 0 deletions pacman/model/graphs/application/application_fpga_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def get_incoming_slice_for_link(self, link, index):
:rtype: ~pacman.model.graphs.common.Slice
"""
# pylint: disable=unused-argument
atoms_per_slice = self.n_atoms // self._n_machine_vertices_per_link
low_atom = atoms_per_slice * index
hi_atom = (atoms_per_slice * (index + 1)) - 1
Expand Down
1 change: 0 additions & 1 deletion pacman/model/graphs/application/application_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,3 @@ def add_incoming_edge(self, edge, partition):
""" Add an edge incoming to this vertex. This is ignored by default,
but could be used to track incoming edges, and/or report faults.
"""
pass
16 changes: 8 additions & 8 deletions pacman/model/graphs/common/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def get_slice(self, n):
"""
try:
return slice(self.start[n], self.start[n] + self.shape[n])
except IndexError:
except IndexError as exc:
raise IndexError(f"{n} is invalid for slice with {len(self.shape)}"
" dimensions")
" dimensions") from exc

@property
def slices(self):
Expand Down Expand Up @@ -122,18 +122,18 @@ def __str__(self):
if len(self.shape) <= 1:
return (f"({self.lo_atom}:{self.hi_atom})")
value = ""
for slice in self.slices:
value += f"({slice.start}:{slice.stop})"
for a_slice in self.slices:
value += f"({a_slice.start}:{a_slice.stop})"
return f"{self.lo_atom}{value}"

@classmethod
def from_string(cls, str):
if str[0] == "(":
parts = str[1:-1].split(":")
def from_string(cls, as_str):
if as_str[0] == "(":
parts = as_str[1:-1].split(":")
lo_atom = int(parts[0])
hi_atom = int(parts[1])
return Slice(lo_atom, hi_atom)
parts = str.split("(")
parts = as_str.split("(")
lo_atom = int(parts[0])
shape = []
start = []
Expand Down
3 changes: 2 additions & 1 deletion pacman/model/graphs/machine/machine_vertex.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def get_n_keys_for_partition(self, partition_id):
:return: The number of keys required
:rtype: int
"""
# pylint: disable=unused-argument
return 1 << get_n_bits_for_fields(self._vertex_slice.shape)

@property
Expand Down Expand Up @@ -152,5 +153,5 @@ def get_fixed_location(self):
if self._fixed_location:
return self._fixed_location
if self._app_vertex:
return self._app_vertex._fixed_location
return self._app_vertex.get_fixed_location()
return None
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SplitterFixedLegacy(AbstractSplitterCommon):

__slots__ = ["__slices"]

def __init__(self, splitter_name=None):
def __init__(self):
super().__init__()
self.__slices = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ class SplitterOneAppOneMachine(AbstractSplitterCommon):

__slots__ = []

def __init__(self):
super().__init__()

@overrides(AbstractSplitterCommon.set_governed_app_vertex)
def set_governed_app_vertex(self, app_vertex):
if not isinstance(app_vertex, AbstractOneAppOneMachineVertex):
Expand Down
2 changes: 1 addition & 1 deletion pacman/operations/router_algorithms/application_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def _find_target_xy(target_xys, routes, source_mappings):
for xy in target_xys:
if xy in routes:
return xy, None
return xy, None
return xy, None # pylint:disable=undefined-loop-variable


def _get_outgoing_mapping(app_vertex, partition_id):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class _Merge(object):
"key",
# int
"mask",
# Number of ``X``\ s in the key - mask pair generated by this merge. # noqa W605
# Number of ``X``s in the key - mask pair generated by this merge.
# int
"generality",
# Measure of how "good" this merge is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ class ZonedRoutingInfoAllocator(object):
# True if all partitions are fixed
"__all_fixed"
]
# pylint: disable=attribute-defined-outside-init

def __call__(self, extra_allocations, flexible):
"""
Expand Down Expand Up @@ -191,6 +190,7 @@ def __find_fixed(self):
raise PacmanRouteInfoAllocationException(
f"On {pre} only a fixed app key has been provided,"
" but there is more than one machine vertex.")
# pylint:disable=undefined-loop-variable
self.__fixed_partitions[
identifier, vert] = app_key_and_mask
self.__fixed_partitions[identifier, pre] = app_key_and_mask
Expand Down
2 changes: 1 addition & 1 deletion pacman/utilities/algorithm_utilities/routing_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class RoutingTree(object):
Each instance represents a single hop in a route and recursively refers to
following steps.
""" # noqa W605
"""

# A *lot* of instances of this data structure are created and so its memory
# consumption is a sensitive matter. The following optimisations have been
Expand Down

0 comments on commit 572e260

Please sign in to comment.