Skip to content

Commit

Permalink
More spellings
Browse files Browse the repository at this point in the history
  • Loading branch information
dkfellows committed Apr 6, 2023
1 parent 3d6a809 commit a455fb5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 19 deletions.
11 changes: 11 additions & 0 deletions .pylint_dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ sPyNNaker
CFF
Zenodo
DBs
LCM

# Sphinx keyword
py
Expand Down Expand Up @@ -51,6 +52,8 @@ abstractmethod
abstractproperty
classmethod
classproperty
getx
setx

# Python packages
math
Expand All @@ -59,6 +62,7 @@ configparser
numpy
testfixtures
abc
zipfile

# Misc
haha
Expand All @@ -67,3 +71,10 @@ whitespace
ids
submessage
subclassed
src
dest
msg
spynnaker
cfg
X'th
etc
2 changes: 0 additions & 2 deletions spinn_utilities/abstract_context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
class AbstractContextManager(object, metaclass=AbstractBase):
"""
Closable class that supports being used as a simple context manager.
Deluberate speelign erorr.
"""

__slots__ = []
Expand Down
15 changes: 7 additions & 8 deletions spinn_utilities/conf_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,25 +153,24 @@ def _check_config(cfg_file, default_configs, strict):
logger.warning(msg)


def _read_a_config(configs, cfg_file, default_configs, strict):
def _read_a_config(configuration, cfg_file, default_configs, strict):
"""
Reads in a configuration file and then directly its `machine_spec_file`.
:param CamelCaseConfigParser configs:
:param CamelCaseConfigParser configuration:
configuration to be updated by the reading of a file
:param str cfg_file: path to file which should be read in
:param CamelCaseConfigParser default_configs:
configuration with just the default files in
:param bool strict: Flag to say checker should raise an exception
:return: None
"""
_check_config(cfg_file, default_configs, strict)
configs.read(cfg_file)
if configs.has_option("Machine", "machine_spec_file"):
machine_spec_file = configs.get("Machine", "machine_spec_file")
configuration.read(cfg_file)
if configuration.has_option("Machine", "machine_spec_file"):
machine_spec_file = configuration.get("Machine", "machine_spec_file")
_check_config(machine_spec_file, default_configs, strict)
configs.read(machine_spec_file)
configs.remove_option("Machine", "machine_spec_file")
configuration.read(machine_spec_file)
configuration.remove_option("Machine", "machine_spec_file")


def _config_locations(filename):
Expand Down
2 changes: 1 addition & 1 deletion spinn_utilities/find_max_success.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def find_max_success(max_possible, check):
:type max_possible: int
:param check: A boolean function that given an int value returns
True for every value up and including the cut-off and
False for every value greater than the cutoff
False for every value greater than the cut-off
:type check: ~typing.Callable[[int], bool]
:return: The highest value that returns true for the check
but is not more than the max_possible
Expand Down
16 changes: 8 additions & 8 deletions spinn_utilities/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class Ping(object):
unreachable = set()

@staticmethod
def ping(ipaddr):
def ping(ip_address):
"""
Send a ping (ICMP ECHO request) to the given host.
SpiNNaker boards support ICMP ECHO when booted.
:param str ipaddr:
:param str ip_address:
The IP address to ping. Hostnames can be used, but are not
recommended.
:return:
Expand All @@ -43,33 +43,33 @@ def ping(ipaddr):
else:
cmd = "ping -c 1 -W 1 "
process = subprocess.Popen(
cmd + ipaddr, shell=True, stdout=subprocess.PIPE)
cmd + ip_address, shell=True, stdout=subprocess.PIPE)
time.sleep(1.2)
process.stdout.close()
process.wait()
return process.returncode

@staticmethod
def host_is_reachable(ipaddr):
def host_is_reachable(ip_address):
"""
Test if a host is unreachable via ICMP ECHO.
.. note::
This information may be cached in various ways. Transient failures
are not necessarily detected or recovered from.
:param str ipaddr:
:param str ip_address:
The IP address to ping. Hostnames can be used, but are not
recommended.
:rtype: bool
"""
if ipaddr in Ping.unreachable:
if ip_address in Ping.unreachable:
return False
tries = 0
while (True):
if Ping.ping(ipaddr) == 0:
if Ping.ping(ip_address) == 0:
return True
tries += 1
if tries > 10:
Ping.unreachable.add(ipaddr)
Ping.unreachable.add(ip_address)
return False

0 comments on commit a455fb5

Please sign in to comment.