Skip to content

Commit

Permalink
Merge pull request #420 from SpiNNakerManchester/pylint_fix
Browse files Browse the repository at this point in the history
Pylint fix
  • Loading branch information
rowleya committed Feb 3, 2022
2 parents b01044a + 07719d5 commit 95b2ef1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ def set_governed_app_vertex(self, app_vertex):
@overrides(AbstractSplitterCommon.create_machine_vertices)
def create_machine_vertices(self, resource_tracker, machine_graph):
resource_tracker.allocate_constrained_resources(
self._resources_required, self._governed_app_vertex.constraints,
vertices=[self._machine_vertex])
self._resources_required, self._governed_app_vertex.constraints)
machine_graph.add_vertex(self._machine_vertex)
return self._machine_vertex

Expand Down
2 changes: 0 additions & 2 deletions pacman/model/resources/core_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def __init__(self, chip, preallocated_resources, cores_counter):
:param preallocated_resources:
:type preallocated_resources: PreAllocatedResourceContainer or None
"""
global _real_chips_with_n_cores_available
self._cores = OrderedSet()
for processor in chip.processors:
if not processor.is_monitor:
Expand Down Expand Up @@ -75,7 +74,6 @@ def is_available(self):
return self._n_cores > 0

def allocate(self, p):
global _real_chips_with_n_cores_available
if p is None:
p = self._cores.pop()
else:
Expand Down
2 changes: 1 addition & 1 deletion pacman/model/routing_tables/multicast_routing_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def from_json(j_router):
with gzip.open(j_router) as j_file:
j_router = json.load(j_file)
else:
with open(j_router) as j_file:
with open(j_router, encoding="utf-8") as j_file:
j_router = json.load(j_file)

tables = MulticastRoutingTables()
Expand Down
1 change: 1 addition & 0 deletions pacman/operations/placer_algorithms/spreader_placer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class _SpreaderPlacer(_OneToOnePlacer):
# 4. chip and core)
STEPS = 4

# pylint:disable=arguments-differ
def _run(self, machine_graph, machine, n_keys_map, plan_n_timesteps):
"""
:param MachineGraph machine_graph: the machine graph
Expand Down
2 changes: 1 addition & 1 deletion pacman/utilities/file_format_schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ def validate(json_obj, schema_filename):
If the JSON object isn't valid.
"""
schema_file = os.path.join(os.path.dirname(__file__), schema_filename)
with open(schema_file, "r") as f:
with open(schema_file, "r", encoding="utf-8") as f:
jsonschema.validate(json_obj, json.load(f))
2 changes: 1 addition & 1 deletion pacman/utilities/json_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def json_to_object(json_object):
with gzip.open(json_object) as j_file:
return json.load(j_file)
else:
with open(json_object) as j_file:
with open(json_object, encoding="utf-8") as j_file:
return json.load(j_file)
return json_object

Expand Down
9 changes: 4 additions & 5 deletions pacman/utilities/utility_objs/resource_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,10 @@ def _track_board(self, board_address):
if board_address not in self._tracked_ethernet_chips:
try:
eth_chip = self._untracked_ethernet_chips.pop(board_address)
except KeyError:
except KeyError as original:
raise PacmanInvalidParameterException(
"board_address", str(board_address),
"Unrecognised board address")
"Unrecognised board address") from original
for (x, y) in self._machine.get_existing_xys_on_board(eth_chip):
self._track_chip(x, y)
# track_chip updates tracked_ethernet_chips
Expand Down Expand Up @@ -599,7 +599,7 @@ def _is_tag_available(self, board_address, tag):
if tag is None:
return board_address in self._boards_with_ip_tags
else:
tag in self._tags_by_board[board_address]
return tag in self._tags_by_board[board_address]

def _is_ip_tag_available(self, board_address, ip_tag):
""" Check if an IP tag is available given the constraints
Expand Down Expand Up @@ -876,7 +876,7 @@ def _update_structures_for_reverse_ip_tag(self, board_address, tag, port):
self._listen_port_reverse_ip_tag[board_address, tag] = port

def allocate_constrained_resources(
self, resources, constraints, chips=None, vertices=None):
self, resources, constraints, chips=None):
""" Attempts to use the given resources of the machine, constrained\
by the given placement constraints.
Expand All @@ -887,7 +887,6 @@ def allocate_constrained_resources(
The optional list of (x, y) tuples of chip coordinates of chips
that can be used. Note that any chips passed in previously will
be ignored
:param vertices: the vertices related to these resources.
:return:
The x and y coordinates of the used chip, the processor_id,
and the IP tag and reverse IP tag allocation tuples
Expand Down

0 comments on commit 95b2ef1

Please sign in to comment.