check from_string and to_string are counterparts
redesign standard value checks for this
Change-Id: I825cdba5955596096fd11ab52de571f05845d7ae
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/34737
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
Transported values in a change must be converted first.
As this is only relevant for the exotic "scaled" and "blob"
datatypes, this was not detected yet.
- add tests
- suppress warning PytestUnhandledThreadExceptionWarning in tests
+ change import_value methods to raise no other exceptions than
WrongTypeError and RangeError
+ simplify Command.do: as import_value already raises the
appropriate error, no more try/except is needed
Change-Id: I299e511468dc0fcecff4c20cf8a917da38b70786
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/32743
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
more descriptive error when trying to export OrType, NoneOr, ValueType
and DataTypeType
Change-Id: If13815e9d2b177042b24a1bb62b1ad1d1d88b502
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/32737
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de>
in the previous version FloatRange(max=100) was neither working
properly nor complaining, because the maxval=None default was
overriding the value for max.
possible fixes:
- raise an error when min/max used as argument (confusing for
the programmer, as it is a property)
- allow both versions minval/maxval and min/max (more code)
- use min/max and a pylint directive here (the only thing to
take care is not to use the min/max builtin in __init__)
this change uses the last option for the fix
Change-Id: Iff0e0c4d0d7b165003bdeffa67a93a1cd7f29eea
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/31982
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
- removed secop/metaclass.py
- moved code from ModuleMeta to modules.HasAccessibles.__init_subclass__
- reworked properties:
assignment obj.property = value now always allowed
- reworked Parameters and Command to be true descriptors
- Command must now be solely used as decorator
- renamed 'usercommand' to 'Command'
- command methods no longer start with 'do_'
- reworked mechanism to determine accessible order:
the attribute paramOrder, if given, determines order of accessibles
+ fixed some issues makeing the IDE more happy
+ simplified code for StatusType and added a test for it
Change-Id: I8045cf38ee6f4d4862428272df0b12a7c8abaca7
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/25049
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
in order to prevent modifying parameters without automatically
trigger updates, all datatypes must be immutable.
TupleOf and ArrayOf: change from list to tuple
StructOf: use ImmutableDict
most existing code should work properly, the only thing to consider are
equality comparisons with lists, which will result to False all the time
the changes in secop_psi/ppms.py (using tuples instead of lists for status values)
are not really necessary, but lead to less confusing code
Change-Id: I181f412b5cd55af296b2e5120af82449beb03f54
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/22972
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
- added also test for this
Change-Id: I1c3ad92bc10131d6cd096496230222c999f0097e
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/22737
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
A proxy module is a module with a known structure, but
accessed over a SECoP connection.
For the configuration, a Frappy module class has to be given.
The proxy class is created from this, but does not inherit from it.
However, the class of the returned object will be subclass of the
SECoP base classes (Readable, Drivable etc.).
A possible extension might be, that instead of the Frappy class,
the JSON module description can be given, as a separate file
or directly in the config file.
Or we might offer a tool to convert the JSON description to
a python class.
Change-Id: I9212d9f3fe82ec56dfc08611d0e1efc0b0112271
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/22386
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
all nested types need a specific copy method, as some information
of EnumType (its name) and TextType are not visible in the
exported form
Change-Id: I3ef765ca35cda11b10798c68a3e2115502554c2e
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21441
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
this change is triggered by the fact, that assigining a unit
in the config file did no longer work.
this change has several implications:
1) secop.properties must not import secop.datatypes:
- as ValueType can not be imported, the default behaviour with
'mandatory' and 'default' arguments was slightly changed
- instead of checking for DataType when exporting, a try/except
was used
2) the datatype of datatype properties is sometimes not yet defined.
a stub is used in this cases instead, which is later replaced by
the proper datatype. The number of stubs may be reduced, but this
should be done in a later change, as the diff will be much less
readable.
3) in config files, datatype properties can be changed like parameter
properties. HasProperties.setProperties/checkProperties/getProperties
are overridden for this.
the config editor seems still to work, an issue (probably py3) had
to be fixed there
Change-Id: I1efddf51f2c760510e913dbcaa099e8a89c9cab5
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21399
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
some u"" (double quotes) were not found in change before
Change-Id: I85912892bbe7b57afee758c69d1aa7073557adc0
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21326
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Bjoern Pedersen <bjoern.pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
- None <= 0 is invalid in py3
- restrict BLOBType to bytes (may be changed after migration to py3)
- remove long
- use list(<dict>.items()) when dict is changed within loop
- allow initialization of properties in HasProperties without
supercall to base class
- <dict>.values() can not be indexed
- adapted/removed various tests. additional tests might be added
after definitive migration to py3
after this change, all the tests run with py3, also secop-server and
secop-gui were tested with an example, but other code might still contain
py3 incompatibilities
Change-Id: I881c6972aeabb8494a21a6cbc7ffeddfd4f5d4f8
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21306
Tested-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
Reviewed-by: Bjoern Pedersen <bjoern.pedersen@frm2.tum.de>
- change from single element JSON-object to flattened JSON-object
with 'type' key.
- rename of some data properties (maxbytes, maxchars, maxlen)
- added isUTF8 to StringType
The rename of the SECoP property 'datatype' to 'datainfo' will
follow in an other change.
Change-Id: I7a75f0d025ff476dd19385db3487f18c4c746bcf
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21293
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
- modules and accessibles are changed back to a JSON object
- datatype is changed from a JSON array with 2 elements to
a JSON object with one element, with the basic type as key
- the client side is kept compatible with the old syntax
Change-Id: Icd640bbcdec26a895c96720e107e874529340a73
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21032
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
- Enum.__call__(self, value) should raise BadValueError when
value is not hashable
- added TextType.copy (DataType.copy will not work here)
Change-Id: I6c460991fa1e6595a939fb0814f490d2188c97b4
Reviewed-on: https://forge.frm2.tum.de/review/21015
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
TextType is intended for formatted text (multiple lines),
whereas StringType is intended for a single line of text (without '\n')
Change-Id: Ibce29ae6b4e426bd8685f2cf7ff6966d81b0c6aa
Reviewed-on: https://forge.frm2.tum.de/review/20951
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
+ DataType validators are shifted to __call__
+ as_json is moved to export_datatape()
+ new HasProperties Base Mixin for Modules/DataTypes
+ accessibles can be accessed via iterator of a module
+ properties are properly 'derived' and checked, are set with .setPropertyValue
remember: parameters only have properties, so use getPropertyValue()
Change-Id: Iae0273f971aacb00fe6bf05e6a4d24a6d1be881a
Reviewed-on: https://forge.frm2.tum.de/review/20635
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
as for most datatypes as_json had to be converted to properties
and as_json was only not used outside datatypes.py except in
the test, we implement export_datatypes instead
Change-Id: I4beaba9dbd5a350c230e72b571364bf8ee2901b6
Reviewed-on: https://forge.frm2.tum.de/review/20345
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
as Datatype got mutable, it has to be copied when inherited.
Params.copy must call the introduced method Datatype.copy.
in addition:
- fixed bugs in ScaledInteger.__repr__ and datatypes.DATATYPES['struct']
- do not export unit from Parameters
Change-Id: Id552c33843b1b2bedffc68d1bd909705dcfb5605
Reviewed-on: https://forge.frm2.tum.de/review/20324
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
also changed names: according to the meeting in 2019-01-16 we
decided to use absolute_resolution/relative_resolution
instead of _precision
Change-Id: I4a49bb745901b87c2aa2bc2728fd7a44026421e0
Reviewed-on: https://forge.frm2.tum.de/review/20321
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
as the unit property may be set in the config file, the datatype
might change after creation.
This proposed implementation changes the internal name of *_precision
to its full name, as this is easier for the way it is done.
IntRange is not yet modified, as anyway 'unit' (and 'fmtstr') should
not be applied to it, this is not forseen in the standard.
Questions for further work:
- should we also allow to configure 'fmtstr'?
- should it be allowed to change min, max from configuration?
- if yes, what is the proper way to do it?
Change-Id: I1fda7e8274109fdcca3c792c0a6e3dc6664cc45e
Reviewed-on: https://forge.frm2.tum.de/review/20304
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
needs a bigger rework, since READREPLY and EVENTREPLY are now different....
Also the format of the error-reply got changed :(
Change-Id: I1760743238227730ee49aaf92b54e0ff5f25423b
Reviewed-on: https://forge.frm2.tum.de/review/20246
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
on types where these can be useful.
Also fix some issues with ScaledInteger.
Change-Id: I9d456c4f237da3a37730c3e451e9fb59307ed982
Reviewed-on: https://forge.frm2.tum.de/review/20240
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
unfortunately IntEnum can't be bent like we would need it (extensible).
So we had to write our own....
The members of the Enum still behave like ints, but also have
.name and .value attributes, should they be needed.
needed adoptions to correctly use (and test) the EnumType are included.
Change-Id: Ie019d2f449a244c4fab00554b6c6daaac8948b59
Reviewed-on: https://forge.frm2.tum.de/review/17843
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
also make interface more explicit
Change-Id: Ib104e2c050d3e98e9d434d502951e33619784e2e
missing: test cases for *.from_string(input) methods
Reviewed-on: https://forge.frm2.tum.de/review/16893
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>