Python types.DictProxyType() Examples

The following are 2 code examples of types.DictProxyType(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module types , or try the search function .
Example #1
Source File:    From odoo-rpc-client with Mozilla Public License 2.0 5 votes vote down vote up
def __dir__(self):
            def get_attrs(obj):
                import types
                if not hasattr(obj, '__dict__'):
                    return []  # slots only
                if not isinstance(obj.__dict__, (dict, types.DictProxyType)):
                    raise TypeError("%s.__dict__ is not a dictionary"
                                    "" % obj.__name__)
                return obj.__dict__.keys()

            def dir2(obj):
                attrs = set()
                if not hasattr(obj, '__bases__'):
                    # obj is an instance
                    if not hasattr(obj, '__class__'):
                        # slots
                        return sorted(get_attrs(obj))
                    klass = obj.__class__
                    # obj is a class
                    klass = obj

                for cls in klass.__bases__:
                return list(attrs)

            return dir2(self) 
Example #2
Source File:    From zstack-utility with Apache License 2.0 5 votes vote down vote up
def _is_unsupported_type(obj):
    return isinstance(obj, (types.ComplexType, types.TupleType, types.FunctionType, types.LambdaType,
                           types.GeneratorType, types.MethodType, types.UnboundMethodType, types.BuiltinFunctionType, types.BuiltinMethodType, types.FileType,
                           types.XRangeType, types.TracebackType, types.FrameType, types.DictProxyType, types.NotImplementedType, types.GetSetDescriptorType,