How to use the ptype.ispcontainer function in ptype

To help you get started, we’ve selected a few ptype examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arizvisa / syringe / lib / ptypes / parray.py View on Github external
def load(self):
        obj = self._object_
        self.value = []

        # which kind of load are we
        if ptype.isptype(obj) and not ptype.ispcontainer(obj):
            self.load_block()

        elif ptype.ispcontainer(obj) or ptype.isresolveable(obj):
            self.load_container()

        if self.initialized:
            return self
        
#        assert len(self) == len(self.value), '%d != %d'% (len(self), len(self.value))

        # now that we know the length, read the array
        self.source.seek(self.getoffset())
        block = self.source.consume(self.size())
        return self.deserialize(block)