Python struct.errors() Examples

The following are code examples for showing how to use struct.errors(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: hostapd-mana   Author: adde88   File: xdrlib.py    (license) View Source Project 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 2
Project: oil   Author: oilshell   File: xdrlib.py    (license) View Source Project 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 3
Project: python2-tracer   Author: extremecoders-re   File: xdrlib.py    (license) View Source Project 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 4
Project: sslstrip-hsts-openwrt   Author: adde88   File: xdrlib.py    (license) View Source Project 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 5
Project: pefile.pypy   Author: cloudtracer   File: xdrlib.py    (license) View Source Project 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result 
Example 6
Project: ouroboros   Author: pybee   File: xdrlib.py    (license) View Source Project 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0]) from None
    return result 
Example 7
Project: empyrion-python-api   Author: huhlig   File: xdrlib.py    (license) View Source Project 5 votes vote down vote up
def raise_conversion_error(function):
    """ Wrap any raised struct.errors in a ConversionError. """

    @wraps(function)
    def result(self, value):
        try:
            return function(self, value)
        except struct.error as e:
            raise ConversionError(e.args[0])
    return result