def __init__(self): self.__enviorment = Environment() self.__arg_reader = ArgReader() self.__arg_reader.parse() self.__enviorment.read() self.__socket = socket(AF_INET, SOCK_STREAM) self.__socket.connect(('localhost', int(self.__enviorment["port"]))) atexit.register(self.clean)
def __init__(self): self.__environment = Environment() self.__arg_reader = ArgReader() self.__arg_reader.parse() self.__environment.read() self.__lib_spec_reader = None self.__logger = None self.__service = None
def __init__(self, host): asyncore.dispatcher.__init__(self) self.__logger = Logger("Service", "Dispatcher") self.create_socket() self.set_reuse_addr() self.__env = Environment() self.bind((host, int(self.__env["port"]))) self.listen(5)
class Client(): def __init__(self): self.__enviorment = Environment() self.__arg_reader = ArgReader() self.__arg_reader.parse() self.__enviorment.read() self.__socket = socket(AF_INET, SOCK_STREAM) self.__socket.connect(('localhost', int(self.__enviorment["port"]))) atexit.register(self.clean) def clean(self): self.__socket.close() def send(self, json): try: self.__socket.send(dumps(json).encode()) except ValueError as _: self.__socket.send(json.encode()) def recv(self): return loads(self.__socket.recv(BUFFER_SIZE))
def __init__(self): self.__arg_parser = ArgumentParser(description="Hook Runner Service.") _mutuall_exclusisve_group = \ self.__arg_parser.add_mutually_exclusive_group(required=True) _mutuall_exclusisve_group.add_argument("-v", "--version", help="Show" " version and exit.", action='store_true') _mutuall_exclusisve_group.add_argument("-c", "--configuration_file", help="Configuration file.", action='store') self.__env_singleton = Environment()
class Application: def __init__(self): self.__environment = Environment() self.__arg_reader = ArgReader() self.__arg_reader.parse() self.__environment.read() self.__lib_spec_reader = None self.__logger = None self.__service = None def run(self): self.__lib_spec_reader = LibsSingleton() self.__logger = Logger("Application") self.__logger.log("Info", "HookRunner is running.") self.__lib_spec_reader.init() self.__service = ServiceThread('localhost') self.__service.start() self.__logger.log("Info", "Server is ready...") self.__logger.log( "Info", "Is ServerThread alive?" " {status}".format(status=str(self.__service.is_alive()))) self.__logger.log("Info", "On any input server will close.") input() self.__service.stop()
def __init__(self): self.__env_singleton = Environment() self.__logger = Logger("LibrariesSingleton") self.__lib_cfg_reader = None self.__cmds = None