Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bliss
bliss
Commits
03d419ad
Commit
03d419ad
authored
Jun 01, 2021
by
Samuel Debionne
Browse files
Fix documentation typos in the dev/controller section
parent
195e4a39
Pipeline
#47800
passed with stages
in 7 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
doc/docs/dev_write_ctrl.md
View file @
03d419ad
# Writing a BLISS controller
Here
you can find
som
t
tips
about the
wri
n
ting
of
a BLISS controller.
Here
are
som
e
tips
to help you
writing a BLISS controller.
## @autocomplete_property decorator
In many controllers, the
`@property`
decorator is heavily used to protect certain
attributes of the instance or to limit the access to read-only. When using the
bliss command line interface the autocompletion will
**not**
suggest
e
any
bliss command line interface the autocompletion will
**not**
suggest any
completion based on the return value of the method underneath the property.
This is a wanted behavior e.g. in case this would trigger hardware
communication. There are however also usecases where a
*deeper*
autocompletion
communication. There are however also use
cases where a
*deeper*
autocompletion
is wanted.
!!! note
...
...
@@ -58,11 +58,11 @@ In Bliss, `__info__()` is used by the command line interface (Bliss shell or Bli
repl) to enquire information of the internal state of any object / controller in
case it is available.
Th
is is used to have simple way to get (detailed) information that is need
ed
from
a
**
user p
oint of view**
to use the object
. This is in contrast to the
build-in python function
`__repr__()`
, which should return a short summary of the
concerned object from
the
**developer p
oint of view
**
. The Protocol that is put
in place in the Bliss
shell is the following:
Th
at way, a user can get information how to use the object, detail
ed
**
from
the
user p
erspective**
. This is in contrast to the
built-in python function
`__repr__()`
, which should return a short summary of the
concerned object from
the
**developer p
erspective
**
. The Protocol that is put
in place in the Bliss
shell is the following:
*
if the return value of a statement entered into the Bliss shel is a python
object with
`__info__()`
implemented this
`__info__()`
function will be called
...
...
@@ -112,7 +112,7 @@ LIMA [5]: my_detectors
object
at
0x7f2f535b5f60
>
}
```
In this case it is desirable that the python objects themselves are clearly
In this case
,
it is desirable that the python objects themselves are clearly
represented, which is exactly the role of
`__repr__`
(in this example the
`lima_simulator`
has a custom
`__repr__`
while in
`simu1`
there is no
`__repr__`
implemented so the bulid in python implementation is used).
...
...
@@ -143,7 +143,7 @@ BLISS [4]: [a]
If, for any reason, there is an exception raised inside `__info__`, the
fallback option will be used and `__repr__` is evaluated in this case.
And **this will hide the error**. So, *any* error mus
s
t be treated
And **this will hide the error**. So, *any* error must be treated
before returning.
...
...
@@ -156,7 +156,7 @@ BLISS [4]: [a]
return info_str
```
The equivalent of
`repr(obj)`
or
`str(obj)`
is also availabe in
The equivalent of
`repr(obj)`
or
`str(obj)`
is also availab
l
e in
`bliss.shell.standard`
as
`info(obj)`
which can be used also outside the Bliss
shell.
...
...
@@ -191,7 +191,7 @@ If implemented in a Python class, `__repr__` and `__str__` methods are
build-in functions Python to return information about an object instantiating this class.
*
`__str__`
should print a readable message
*
`__repr__`
should print a __short__ message
o
bout the objec that is unambigous (e.g. name of an identifier, class name, etc).
*
`__repr__`
should print a __short__ message
a
bout the objec
t
that is unambig
u
ous (e.g. name of an identifier, class name, etc
.
).
*
`__str__`
is called:
-
when the object is passed to the print() function (e.g.
`print(my_obj)`
).
...
...
@@ -207,6 +207,3 @@ build-in functions Python to return information about an object instantiating th
By default when no
`__str__`
or
`__repr__`
methods are defined, the
`__repr__`
returns the name of the class (Length) and
`__str__`
calls
`__repr__`
.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment