[pytango] 37/483: implements #3365792
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:22 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.
commit c01b4fa4844934142f0682beb039735593d4df2d
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date: Wed Jul 13 08:12:40 2011 +0000
implements #3365792
git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@17242 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
PyTango/device_proxy.py | 35 ++++++++++++++++++++++++++---------
doc/revision.rst | 4 ++--
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/PyTango/device_proxy.py b/PyTango/device_proxy.py
index b124bfa..52aac69 100644
--- a/PyTango/device_proxy.py
+++ b/PyTango/device_proxy.py
@@ -56,7 +56,12 @@ def __check_read_attribute(dev_attr):
return dev_attr
def __DeviceProxy__refresh_cmd_cache(self):
- self.__cmd_cache = [cmd.cmd_name.lower() for cmd in self.command_list_query()]
+ cmd_list = self.command_list_query()
+ cmd_cache = {}
+ for cmd in cmd_list:
+ n = cmd.cmd_name.lower()
+ cmd_cache[n] = cmd, None
+ self.__dict__['__cmd_cache'] = cmd_cache
def __DeviceProxy__refresh_attr_cache(self):
attr_cache = [attr_name.lower() for attr_name in self.get_attribute_list()]
@@ -69,25 +74,37 @@ def __DeviceProxy__getattr(self, name):
if name[:2] == "__" or name == 'trait_names':
raise AttributeError, name
- find_cmd = True
- if not hasattr(self, '__cmd_cache') or name.lower() not in self.__cmd_cache:
+ name_l = name.lower()
+ cmd_info = None
+ if not hasattr(self, '__cmd_cache'):
try:
self.__refresh_cmd_cache()
except:
- find_cmd = False
-
- if find_cmd and name.lower() in self.__cmd_cache:
- def f(*args,**kwds): return self.command_inout(name, *args, **kwds)
+ pass
+ try:
+ cmd_info = self.__cmd_cache[name_l]
+ except:
+ pass
+
+ if cmd_info is not None:
+ d, f = cmd_info
+ if f is None:
+ doc = "%s(%s) -> %s\n\n" % (d.cmd_name, d.in_type, d.out_type)
+ doc += " - in (%s): %s\n" % (d.in_type, d.in_type_desc)
+ doc += " - out (%s): %s\n" % (d.out_type, d.out_type_desc)
+ def f(*args,**kwds): return self.command_inout(name, *args, **kwds)
+ f.__doc__ = doc
+ self.__cmd_cache[name_l] = d, f
return f
find_attr = True
- if not hasattr(self, '__attr_cache') or name.lower() not in self.__attr_cache:
+ if not hasattr(self, '__attr_cache') or name_l not in self.__attr_cache:
try:
self.__refresh_attr_cache()
except:
find_attr = False
- if not find_attr or name.lower() not in self.__attr_cache:
+ if not find_attr or name_l not in self.__attr_cache:
raise AttributeError, name
return self.read_attribute(name).value
diff --git a/doc/revision.rst b/doc/revision.rst
index 22cbe4a..c61d276 100644
--- a/doc/revision.rst
+++ b/doc/revision.rst
@@ -74,10 +74,10 @@ Version history
+============+==============================================================================================================================================================================+
| 7.2.1 | Features: |
| | - from sourceforge: |
-| | - `3305251: DS dynamic attributes discards some Attr properties <https://sourceforge.net/tracker/?func=detail&aid=3305251&group_id=57612&atid=484772>`_ |
+| | - `3305251: DS dynamic attributes discards some Attr properties <https://sourceforge.net/tracker/?func=detail&aid=3305251&group_id=57612&atid=484772>`_ |
+| | - `3365792: DeviceProxy.<cmd_name> could be documented <<https://sourceforge.net/tracker/?func=detail&aid=3365792&group_id=57612&atid=484772>`_ |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 7.2.0 | Features: |
-
| | - from sourceforge: |
| | - `3286678: Add missing EncodedAttribute JPEG methods <https://sourceforge.net/tracker/?func=detail&aid=3286678&group_id=57612&atid=484772>`_ |
+------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list