Python socket.AddressType() Examples

The following are 11 code examples of socket.AddressType(). 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 socket , or try the search function .
Example #1
Source File: _common.py    From vnpy_crypto with MIT License 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    else:  # pragma: no cover
        try:
            return socket.AddressType(num)
        except (ValueError, AttributeError):
            return num 
Example #2
Source File: _common.py    From teleport with Apache License 2.0 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    else:  # pragma: no cover
        try:
            return socket.AddressType(num)
        except (ValueError, AttributeError):
            return num 
Example #3
Source File: _common.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    try:
        return socket.AddressType(num)
    except (ValueError, AttributeError):
        return num


# --- Process.connections() 'kind' parameter mapping 
Example #4
Source File: _common.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    try:
        return socket.AddressType(num)
    except (ValueError, AttributeError):
        return num


# --- Process.connections() 'kind' parameter mapping 
Example #5
Source File: _common.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    try:
        return socket.AddressType(num)
    except (ValueError, AttributeError):
        return num


# --- Process.connections() 'kind' parameter mapping 
Example #6
Source File: _common.py    From NoobSec-Toolkit with GNU General Public License v2.0 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    try:
        return socket.AddressType(num)
    except (ValueError, AttributeError):
        return num


# --- Process.connections() 'kind' parameter mapping 
Example #7
Source File: _common.py    From Galaxy_Plugin_Bethesda with MIT License 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    else:  # pragma: no cover
        try:
            return socket.AddressType(num)
        except (ValueError, AttributeError):
            return num 
Example #8
Source File: _common.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    else:  # pragma: no cover
        try:
            return socket.AddressType(num)
        except (ValueError, AttributeError):
            return num 
Example #9
Source File: _common.py    From jarvis with GNU General Public License v2.0 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    else:  # pragma: no cover
        try:
            return socket.AddressType(num)
        except (ValueError, AttributeError):
            return num 
Example #10
Source File: _common.py    From backdoorme with MIT License 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    try:
        return socket.AddressType(num)
    except (ValueError, AttributeError):
        return num


# --- Process.connections() 'kind' parameter mapping 
Example #11
Source File: _common.py    From backdoorme with MIT License 5 votes vote down vote up
def socktype_to_enum(num):
    """Convert a numeric socket type value to an IntEnum member.
    If it's not a known member, return the numeric value itself.
    """
    if enum is None:
        return num
    try:
        return socket.AddressType(num)
    except (ValueError, AttributeError):
        return num


# --- Process.connections() 'kind' parameter mapping