Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
0137a7f0
Commit
0137a7f0
authored
Aug 6, 2021
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-271
: Make hardware_device and statistics device proper ABCs.
parent
60374227
No related branches found
No related tags found
1 merge request
!85
L2SS-271: Split statistics base classes off SSTs, cleaned those classes up a bit
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
devices/devices/hardware_device.py
+14
-3
14 additions, 3 deletions
devices/devices/hardware_device.py
devices/devices/sdp/statistics.py
+7
-2
7 additions, 2 deletions
devices/devices/sdp/statistics.py
with
21 additions
and
5 deletions
devices/devices/hardware_device.py
+
14
−
3
View file @
0137a7f0
...
...
@@ -11,8 +11,10 @@
"""
from
abc
import
ABCMeta
,
abstractmethod
# PyTango imports
from
tango.server
import
Device
,
command
from
tango.server
import
Device
,
command
,
DeviceMeta
from
tango
import
DevState
,
DebugIt
# Additional import
...
...
@@ -26,8 +28,12 @@ from devices.device_decorators import only_in_states, fault_on_error
import
logging
logger
=
logging
.
getLogger
()
class
AbstractDeviceMetas
(
DeviceMeta
,
ABCMeta
):
'''
Collects meta classes to allow hardware_device to be both a Device and an ABC.
'''
pass
#@log_exceptions()
class
hardware_device
(
Device
):
class
hardware_device
(
Device
,
metaclass
=
AbstractDeviceMetas
):
"""
**Properties:**
...
...
@@ -155,13 +161,18 @@ class hardware_device(Device):
self
.
set_state
(
DevState
.
FAULT
)
# functions that can be overloaded
# functions that can
or must
be overloaded
def
configure_for_fault
(
self
):
pass
@abstractmethod
def
configure_for_off
(
self
):
pass
def
configure_for_on
(
self
):
pass
@abstractmethod
def
configure_for_initialise
(
self
):
pass
...
...
This diff is collapsed.
Click to expand it.
devices/devices/sdp/statistics.py
+
7
−
2
View file @
0137a7f0
...
...
@@ -18,6 +18,8 @@ parentdir = os.path.dirname(currentdir)
parentdir
=
os
.
path
.
dirname
(
parentdir
)
sys
.
path
.
append
(
parentdir
)
from
abc
import
ABCMeta
,
abstractmethod
# PyTango imports
from
tango.server
import
run
from
tango.server
import
device_property
,
attribute
...
...
@@ -37,10 +39,13 @@ import numpy
__all__
=
[
"
Statistics
"
]
class
Statistics
(
hardware_device
):
class
Statistics
(
hardware_device
,
metaclass
=
ABCMeta
):
# In derived classes, set this to a subclass of StatisticsCollector
STATISTICS_COLLECTOR_CLASS
=
NotImplementedError
@property
@abstractmethod
def
STATISTICS_COLLECTOR_CLASS
(
self
):
pass
# -----------------
# Device Properties
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment