Skip to content

Commit

Permalink
merged in remote/remove_unused
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Aug 16, 2022
2 parents 1b425e9 + 52c3b4b commit 15279a0
Show file tree
Hide file tree
Showing 23 changed files with 2,200 additions and 59 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
18 changes: 18 additions & 0 deletions spinn_utilities/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2021-2022 The University of Manchester
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from .utils_data_view import UtilsDataView

__all__ = ["UtilsDataView"]
46 changes: 46 additions & 0 deletions spinn_utilities/data/data_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (c) 2021-2022 The University of Manchester
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from enum import Enum
from spinn_utilities.exceptions import (
DataNotMocked, DataNotYetAvialable, NotSetupException, ShutdownException)


class DataStatus(Enum):
"""
Different states the Data can be in.
This class is designed to used internally by UtilsDataView
"""
NOT_SETUP = (0, NotSetupException)
MOCKED = (1, DataNotMocked)
SETUP = (2, DataNotYetAvialable)
SHUTDOWN = (3, ShutdownException)

def __new__(cls, value, exception):
# pylint: disable=protected-access
obj = object.__new__(cls)
obj._value_ = value
obj._exception = exception
return obj

def exception(self, data):
"""
Returns the most suitable data not available exception
:param data:
:rtype: ~pinn_utilities.exceptions.SpiNNUtilsException
"""
return self._exception(data)
35 changes: 35 additions & 0 deletions spinn_utilities/data/reset_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (c) 2021-2022 The University of Manchester
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from enum import Enum


class ResetStatus(Enum):
"""
Different states the reset could be in
This class is design to used internally by UtilsDataView
"""
NOT_SETUP = (0)
SETUP = (1)
HAS_RUN = (2)
SOFT_RESET = (3)
HARD_RESET = (4)

def __new__(cls, value):
# pylint: disable=protected-access
obj = object.__new__(cls)
obj._value_ = value
return obj
42 changes: 42 additions & 0 deletions spinn_utilities/data/run_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (c) 2021-2022 The University of Manchester
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from enum import Enum


class RunStatus(Enum):
"""
Different states the run could be in
This is from the prespective of the users script.
It says nothing about if there is c code running.
Ie Has a sim.run (or similar) call started but not yet returned.
This is combined with the ResetStatus to get the needed status
This class is design to used internally by UtilsDataView
"""
NOT_SETUP = (0)
NOT_RUNNING = (12)
IN_RUN = (2)
STOP_REQUESTED = (3)
STOPPING = (4)
SHUTDOWN = (5)

def __new__(cls, value):
# pylint: disable=protected-access
obj = object.__new__(cls)
obj._value_ = value
return obj
Loading

0 comments on commit 15279a0

Please sign in to comment.