예제 #1
0
	def __getattr__(self, attr):
		if attr == "name":
			return self.Name
		
		# check if attribute is in the property dictionary
		if self._props and attr in self._props:
			return self._props[attr][:-1]
		
		return MP_object.__getattr__(self, attr)
예제 #2
0
	def __getattr__(self, attr):
		if attr == "name":
			return self.device["name"]
		
		if attr == "command":
			return "%x" % self.cmd[0]
		
		if attr == "values":
			return " ".join([ "%x" % c for c in self.cmd[1:]])
		
		return MP_object.__getattr__(self, attr)
예제 #3
0
	def __getattr__(self, attr):
		if attr == "name":
			return self._obj.sys_name
		
		if attr in self._obj.keys():
			return self._obj[attr]
		if attr.upper() in self._obj.keys():
			return self._obj[attr.upper()]
		
		if hasattr(self._obj, attr):
			return getattr(self._obj, attr)
		
		if attr in self._obj.attributes.keys():
			return self._obj.attributes[attr]
		
		return MP_object.__getattr__(self, attr)