Skip to content

Commit

Permalink
Merge branch 'master' into slash
Browse files Browse the repository at this point in the history
  • Loading branch information
dkfellows committed Jun 19, 2022
2 parents 3c3770c + 2b424a5 commit 78ae494
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
8 changes: 1 addition & 7 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,6 @@ max-line-length=100
# Maximum number of lines in a module
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand Down Expand Up @@ -386,6 +379,7 @@ init-import=no
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
__call__,
setUp

# List of member names, which should be excluded from the protected access
Expand Down
8 changes: 3 additions & 5 deletions spinn_utilities/make_tools/log_sqllite_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
_SECONDS_TO_MICRO_SECONDS_CONVERSION = 1000
DB_FILE_NAME = "logs.sqlite3"

database_file = None


def _timestamp():
return int(time.time() * _SECONDS_TO_MICRO_SECONDS_CONVERSION)
Expand Down Expand Up @@ -60,8 +58,8 @@ def __init__(self, new_dict=False):
database_file = os.environ.get('C_LOGS_DICT', None)
if database_file is None:
script = sys.modules[self.__module__].__file__
dir = os.path.dirname(script)
database_file = os.path.join(dir, DB_FILE_NAME)
directory = os.path.dirname(script)
database_file = os.path.join(directory, DB_FILE_NAME)

if not new_dict and not os.path.exists(database_file):
message = f"Unable to locate c_logs_dict at {database_file}. "
Expand Down Expand Up @@ -124,7 +122,7 @@ def __init_db(self):
self._db.row_factory = sqlite3.Row
# Don't use memoryview / buffer as hard to deal with difference
self._db.text_factory = str
with open(_DDL_FILE) as f:
with open(_DDL_FILE, encoding="utf-8") as f:
sql = f.read()
self._db.executescript(sql)

Expand Down
6 changes: 3 additions & 3 deletions spinn_utilities/make_tools/replacer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _hexes_to_double(self, upper, lower):


if __name__ == '__main__':
original = sys.argv[1]
short = "".join([c if c.isalnum() else TOKEN for c in original])
encoded = sys.argv[1]
line = "".join([c if c.isalnum() else TOKEN for c in encoded])
with Replacer() as replacer:
print(replacer.replace(short))
print(replacer.replace(line))
2 changes: 1 addition & 1 deletion spinn_utilities/ranged/ranged_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class RangedList(AbstractList):
that all have the same value.
"""
__slots__ = [
"_default", "_key", "_ranged_based", "_ranges"]
"_default", "_ranged_based", "_ranges"]

def __init__(
self, size=None, value=None, key=None, use_list_as_value=False):
Expand Down
9 changes: 5 additions & 4 deletions unittests/ranged/single_over_none_list_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import numpy
from spinn_utilities.ranged import RangedList, SingleList


Expand All @@ -34,17 +35,17 @@ def test_muliple():


def create_lambda():
import numpy
machine_time_step = 1000
return lambda x: numpy.exp(float(-machine_time_step) / (1000.0 * x))


def test_complex():
a_list = RangedList(5, [2, 1, 2, 3, 4], "many")
single = SingleList(a_list=a_list, operation=create_lambda())
assert single == [0.60653065971263342, 0.36787944117144233,
0.60653065971263342, 0.716531310573789272,
0.77880078307140488]
assert numpy.allclose(
single,
[0.60653065971263342, 0.36787944117144233, 0.60653065971263342,
0.716531310573789272, 0.77880078307140488])


def test_get_value():
Expand Down
1 change: 0 additions & 1 deletion unittests/test_conf_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

# pylint: disable=redefined-outer-name, unused-argument
import os
import pytest
import random
Expand Down

0 comments on commit 78ae494

Please sign in to comment.