# Path: pypeman/helpers/lazyload.py
# def load_class(module, class_, deps):
# def load(selfmodname, module, class_, dep=None):
#     def init(*args, **kwargs):
#     def __init__(self, wrapped):
#     def add_lazy(self, module, name, deps):
#     def __getattr__(self, name):
#         C = load_class(module, class_, dep)
# class Wrapper(object):


import asyncio
import logging
import socket
from pypeman.helpers import lazyload  # noqa: E402
                try:
                    host, port = sock.split(":")
                    port = int(port)
                    if not host:
                        raise
                    bind_param = (host, port)
                except Exception:
                    logger.exception('error on sock params in socket endpoint')
                    raise
                sock_obj = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            else:
                bind_param = sock.split(":", 1)[1]
                sock_obj = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
            if reuse_port:
                SO_REUSEPORT = 15
                sock_obj.setsockopt(socket.SOL_SOCKET, SO_REUSEPORT, 1)
            sock_obj.bind(bind_param)
        else:
            sock_obj = sock

        return sock_obj

    def make_socket(self):
        """
            make and bind socket if string object is passed
        """
        self.sock_obj = self.mk_socket(self.sock, self.reuse_port)




# Path: pypeman/helpers/lazyload.py
# def load_class(module, class_, deps):
# def load(selfmodname, module, class_, dep=None):
#     def init(*args, **kwargs):
#     def __init__(self, wrapped):
#     def add_lazy(self, module, name, deps):
#     def __getattr__(self, name):
#         C = load_class(module, class_, dep)
# class Wrapper(object):


# Path: pypeman/endpoints.py
import asyncio
import logging
import socket
from pypeman.helpers import lazyload  # noqa: E402

                try:
                    host, port = sock.split(":")
                    port = int(port)
                    if not host:
                        raise
                    bind_param = (host, port)
                except Exception:
                    logger.exception('error on sock params in socket endpoint')
                    raise
                sock_obj = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            else:
                bind_param = sock.split(":", 1)[1]
                sock_obj = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
            if reuse_port:
                SO_REUSEPORT = 15
                sock_obj.setsockopt(socket.SOL_SOCKET, SO_REUSEPORT, 1)
            sock_obj.bind(bind_param)
        else:
            sock_obj = sock

        return sock_obj

    def make_socket(self):
        """
            make and bind socket if string object is passed
        """
        self.sock_obj = self.mk_socket(self.sock, self.reuse_port)




wrap = lazyload.Wrapper(__name__)