Пример #1
0
 def __getattr__(self, tag):
     # type: (str) -> PCollection
     # Special methods which may be accessed before the object is
     # fully constructed (e.g. in unpickling).
     if tag[:2] == tag[-2:] == '__':
         return object.__getattr__(self, tag)  # type: ignore
     return self[tag]
Пример #2
0
 def __getattr__(self, attr):
     if attr == "playlist":
         return self.getPlaylistFilenames()
     else:
         try:
             return object.__getattr__(self, attr)
         except AttributeError:
             raise AttributeError(attr)
Пример #3
0
    def __getattr__(self, name):
        """Return the attribute of self._impl, or ._impl if it is requested
        Parameters:
        -----------
            name : string
                name of the attribute requested
        Returns:
        --------
            attribute : object
                the attribute of self._impl for the requested name
        """

        if name == '_impl':
            return object.__getattr__(self, name)

        if not (hasattr(self, "_impl") and self._impl):
            raise AttributeError("Device has no _impl attached")

        try:
            return getattr(self._impl, name)
        except AttributeError:
            raise AttributeError("Device %s has no attribute \"%s\"" %
                                 (self.name, name))
Пример #4
0
 def __getattr__(self, tag):
   # Special methods which may be accessed before the object is
   # fully constructed (e.g. in unpickling).
   if tag[:2] == tag[-2:] == '__':
     return object.__getattr__(self, tag)
   return self[tag]