コード例 #1
0
ファイル: core.py プロジェクト: jankoprowski/google-gdata
 def __getattr__(self, name):
     if name.startswith('_'):
         object.__getattribute__(self, name)
     else:
         try:
             return object.__getattribute__(self,
                                            '_dict')[_to_jsonc_name(name)]
         except KeyError:
             raise AttributeError('No member for %s or [\'%s\']' %
                                  (name, _to_jsonc_name(name)))
コード例 #2
0
ファイル: utils.py プロジェクト: rambo/python-holviapi
 def __setattr__(self, attr, val):
     try:
         object.__getattribute__(self, attr)
         object.__setattr__(self, attr, val)
     except AttributeError as e:
         try:
             self._jsondata[attr] = val
         except KeyError as e:
             if six.PY2:
                 raise_from(AttributeError(e.message), e)
             else:
                 raise_from(AttributeError(e), e)
コード例 #3
0
 def __setattr__(self, attr, val):
     try:
         object.__getattribute__(self, attr)
         object.__setattr__(self, attr, val)
     except AttributeError as e:
         try:
             self._jsondata[attr] = val
         except KeyError as e:
             if six.PY2:
                 raise_from(AttributeError(e.message), e)
             else:
                 raise_from(AttributeError(e), e)
コード例 #4
0
ファイル: utils.py プロジェクト: rambo/python-holviapi
 def __getattr__(self, attr):
     if object.__getattribute__(self, '_lazy'):
         #print("We're lazy instance!")
         if attr == 'code':  # Do not fetch full object if we're just getting the code
             return object.__getattribute__(self, '_jsondata')['code']
         f = object.__getattribute__(self, '_fetch_method')
         if f is not None:
             #print("Trying to fetch full one with %s" % f)
             new = f(object.__getattribute__(self, '_jsondata')['code'])
             self._jsondata = new._jsondata
             self._map_holvi_json_properties()
             self._lazy = False
         else:
             #print("No fetch method, giving up")
             pass
     return super(HolviObject, self).__getattr__(attr)
コード例 #5
0
ファイル: utils.py プロジェクト: ExTechOp/python-holviapi
 def __getattr__(self, attr):
     if object.__getattribute__(self, '_lazy'):
         #print("We're lazy instance!")
         if attr == 'code':  # Do not fetch full object if we're just getting the code
             return object.__getattribute__(self, '_jsondata')['code']
         f = object.__getattribute__(self, '_fetch_method')
         if f is not None:
             #print("Trying to fetch full one with %s" % f)
             new = f(object.__getattribute__(self, '_jsondata')['code'])
             self._jsondata = new._jsondata
             self._map_holvi_json_properties()
             self._lazy = False
         else:
             #print("No fetch method, giving up")
             pass
     return super(HolviObject, self).__getattr__(attr)
コード例 #6
0
    def __getattribute__(self, name):
        attr = object.__getattribute__(self, name)
        if name.startswith('_') or not callable(attr):
            return attr

        @lock
        def wrapper(*args, **kwargs):
            return attr(*args[1:], **kwargs)

        return wrapper
コード例 #7
0
ファイル: lock.py プロジェクト: GammaC0de/pyload
    def __getattribute__(self, name):
        attr = object.__getattribute__(self, name)
        if name.startswith('_') or not callable(attr):
            return attr

        @lock
        def wrapper(*args, **kwargs):
            return attr(*args[1:], **kwargs)

        return wrapper
コード例 #8
0
ファイル: utils.py プロジェクト: rambo/python-holviapi
 def __getattr__(self, attr):
     try:
         return object.__getattribute__(self, attr)
     except AttributeError as e:
         try:
             return self._jsondata[attr]
         except KeyError as e:
             if six.PY2:
                 raise_from(AttributeError(e.message), e)
             else:
                 raise_from(AttributeError(e), e)
コード例 #9
0
 def __getattr__(self, attr):
     try:
         return object.__getattribute__(self, attr)
     except AttributeError as e:
         try:
             return self._jsondata[attr]
         except KeyError as e:
             if six.PY2:
                 raise_from(AttributeError(e.message), e)
             else:
                 raise_from(AttributeError(e), e)
コード例 #10
0
ファイル: core.py プロジェクト: jankoprowski/google-gdata
 def __setattr__(self, name, value):
     if name.startswith('_'):
         object.__setattr__(self, name, value)
     else:
         object.__getattribute__(
             self, '_dict')[_to_jsonc_name(name)] = _convert_to_jsonc(value)