def get_server_setting(self, protocol, host='<STR_LIT:127.0.0.1>', port=<NUM_LIT>,<EOL>debug=False, ssl=None, sock=None, workers=<NUM_LIT:1>,<EOL>loop=None, backlog=<NUM_LIT:100>, has_log=True):
if isinstance(ssl, dict):<EOL><INDENT>cert = ssl.get('<STR_LIT>') or ssl.get('<STR_LIT>')<EOL>key = ssl.get('<STR_LIT:key>') or ssl.get('<STR_LIT>')<EOL>if cert is None or key is None:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>context = create_default_context(purpose=Purpose.CLIENT_AUTH)<EOL>context.load_cert_chain(cert, keyfile=key)<EOL>ssl = context<EOL><DEDENT>server_settings = {<EOL>'<STR_LIT>': protocol,<EOL>'<STR_LIT>': self.request_handler,<EOL>'<STR_LIT>': self.log,<EOL>'<STR_LIT>': self.netlog,<EOL>'<STR_LIT:host>': host,<EOL>'<STR_LIT:port>': port,<EOL>'<STR_LIT>': sock,<EOL>'<STR_LIT>': ssl,<EOL>'<STR_LIT>': self.signal,<EOL>'<STR_LIT>': debug,<EOL>'<STR_LIT>': self.request_timeout,<EOL>'<STR_LIT>': self.request_max_size,<EOL>'<STR_LIT>': self.keep_alive,<EOL>'<STR_LIT>': loop,<EOL>'<STR_LIT>': backlog,<EOL>'<STR_LIT>': has_log<EOL>}<EOL>for event_name, settings_name, reverse in (<EOL>('<STR_LIT>', '<STR_LIT>', False),<EOL>('<STR_LIT>', '<STR_LIT>', False),<EOL>('<STR_LIT>', '<STR_LIT>', True),<EOL>('<STR_LIT>', '<STR_LIT>', True),<EOL>):<EOL><INDENT>listeners = self.listeners[event_name].copy()<EOL>if reverse:<EOL><INDENT>listeners.reverse()<EOL><DEDENT>listeners = [partial(listener, self.app) for listener in listeners]<EOL>server_settings[settings_name] = listeners<EOL><DEDENT>if debug:<EOL><INDENT>self.log.setLevel(logging.DEBUG)<EOL><DEDENT>if host and port:<EOL><INDENT>proto = '<STR_LIT:http>'<EOL>if ssl is not None:<EOL><INDENT>proto = '<STR_LIT>'<EOL><DEDENT>self.log.info('<STR_LIT>'.format(proto, host, port))<EOL><DEDENT>return server_settings<EOL>
Helper function used by `run`.