コード例 #1
0
ファイル: alias.py プロジェクト: nervatura/nerva2py
    def applyAttributes(self, obj, attrs, codec=None):
        """
        Applies the collection of attributes C{attrs} to aliased object C{obj}.
        Called when decoding reading aliased objects from an AMF byte stream.

        Override this to provide fine grain control of application of
        attributes to C{obj}.

        @param codec: An optional argument that will contain the en/decoder
            instance calling this function.
        """
        if not self._compiled:
            self.compile()

        if not self.shortcut_decode:
            attrs = self.getDecodableAttributes(obj, attrs, codec=codec)
        else:
            if self.is_dict:
                obj.update(attrs)

                return

            if not self.sealed:
                obj.__dict__.update(attrs)

                return

        util.set_attrs(obj, attrs)
コード例 #2
0
ファイル: alias.py プロジェクト: startup-one/cogofly
    def applyAttributes(self, obj, attrs, codec=None):
        """
        Applies the collection of attributes C{attrs} to aliased object C{obj}.
        Called when decoding reading aliased objects from an AMF byte stream.

        Override this to provide fine grain control of application of
        attributes to C{obj}.

        @param codec: An optional argument that will contain the en/decoder
            instance calling this function.
        """
        if not self._compiled:
            self.compile()

        if not self.shortcut_decode:
            attrs = self.getDecodableAttributes(obj, attrs, codec=codec)
        else:
            if self.is_dict:
                obj.update(attrs)

                return

            if not self.sealed:
                obj.__dict__.update(attrs)

                return

        util.set_attrs(obj, attrs)
コード例 #3
0
ファイル: __init__.py プロジェクト: georgehedfors/AMFShell
    def applyAttributes(self, obj, attrs, codec=None):
        """
        Applies the collection of attributes C{attrs} to aliased object C{obj}.
        Called when decoding reading aliased objects from an AMF byte stream.

        Override this to provide fine grain control of application of
        attributes to C{obj}.

        @param codec: An optional argument that will contain the en/decoder
            instance calling this function.
        """
        attrs = self.getDecodableAttributes(obj, attrs, codec=codec)

        util.set_attrs(obj, attrs)
コード例 #4
0
ファイル: __init__.py プロジェクト: bopopescu/FatCatMap-Proto
    def applyAttributes(self, obj, attrs, codec=None):
        """
        Applies the collection of attributes C{attrs} to aliased object C{obj}.
        Called when decoding reading aliased objects from an AMF byte stream.

        Override this to provide fine grain control of application of
        attributes to C{obj}.

        @param codec: An optional argument that will contain the en/decoder
            instance calling this function.
        """
        attrs = self.getDecodableAttributes(obj, attrs, codec=codec)

        util.set_attrs(obj, attrs)
コード例 #5
0
ファイル: __init__.py プロジェクト: Hamid-K/deblaze
    def applyAttributes(self, obj, attrs):
        """
        Applies the collection of attributes C{attrs} to aliased object C{obj}.
        It is mainly used when reading aliased objects from an AMF byte stream.
        """
        if 'static' in self.metadata:
            s, d = self.getAttrs(obj)

            if s is not None:
                for k in attrs.keys():
                    if k not in s:
                        del attrs[k]

        util.set_attrs(obj, attrs)
コード例 #6
0
ファイル: __init__.py プロジェクト: sasqwatch/deblaze
    def applyAttributes(self, obj, attrs):
        """
        Applies the collection of attributes C{attrs} to aliased object C{obj}.
        It is mainly used when reading aliased objects from an AMF byte stream.
        """
        if 'static' in self.metadata:
            s, d = self.getAttrs(obj)

            if s is not None:
                for k in attrs.keys():
                    if k not in s:
                        del attrs[k]

        util.set_attrs(obj, attrs)
コード例 #7
0
ファイル: amf0.py プロジェクト: georgehedfors/AMFShell
    def _readObject(self, obj, alias=None):
        obj_attrs = dict()

        key = self.readString().encode('utf8')

        while self.stream.peek() != TYPE_OBJECTTERM:
            obj_attrs[key] = self.readElement()
            key = self.readString().encode('utf8')

        # discard the end marker (TYPE_OBJECTTERM)
        self.stream.read(1)

        if alias:
            alias.applyAttributes(obj, obj_attrs, codec=self)
        else:
            util.set_attrs(obj, obj_attrs)
コード例 #8
0
    def _readObject(self, obj, alias=None):
        obj_attrs = dict()

        key = self.readString().encode('utf8')

        while self.stream.peek() != TYPE_OBJECTTERM:
            obj_attrs[key] = self.readElement()
            key = self.readString().encode('utf8')

        # discard the end marker (TYPE_OBJECTTERM)
        self.stream.read(1)

        if alias:
            alias.applyAttributes(obj, obj_attrs, codec=self)
        else:
            util.set_attrs(obj, obj_attrs)
コード例 #9
0
    def applyAttributes(self, obj, attrs, codec=None):
        """
        Applies the collection of attributes C{attrs} to aliased object C{obj}.
        It is mainly used when reading aliased objects from an AMF byte stream.

        @param codec: An optional argument that will contain the en/decoder
            instance calling this function.
        """
        if 'static' in self.metadata:
            s, d = self.getAttrs(obj, codec=codec)

            if s is not None:
                for k in attrs.keys():
                    if k not in s:
                        del attrs[k]

        util.set_attrs(obj, attrs)
コード例 #10
0
ファイル: amf0.py プロジェクト: jmcguir4/BlueCop-XBMC-Plugins
    def _readObject(self, obj, alias=None):
        ot = chr(ASTypes.OBJECTTERM)
        obj_attrs = dict()

        key = self.readString().encode("utf8")

        while self.stream.peek() != ot:
            obj_attrs[key] = self.readElement()
            key = self.readString().encode("utf8")

        # discard the end marker (ASTypes.OBJECTTERM)
        self.stream.read(len(ot))

        if alias:
            alias.applyAttributes(obj, obj_attrs, codec=self)
        else:
            util.set_attrs(obj, obj_attrs)
コード例 #11
0
ファイル: amf0.py プロジェクト: sasqwatch/deblaze
    def _readObject(self, obj, alias=None):
        ot = chr(ASTypes.OBJECTTERM)
        obj_attrs = dict()

        key = self.readString()

        while self.stream.peek() != ot:
            obj_attrs[key] = self.readElement()
            key = self.readString()

        # discard the end marker (ASTypes.OBJECTTERM)
        self.stream.read(len(ot))

        if alias:
            alias.applyAttributes(obj, obj_attrs)
        else:
            util.set_attrs(obj, obj_attrs)