我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用gevent.__version__()。
def main(self): logging.info("Version: %s r%s, Python %s, Gevent: %s" % (config.version, config.rev, sys.version, gevent.__version__)) global ui_server, file_server from File import FileServer from Ui import UiServer logging.info("Creating FileServer....") file_server = FileServer() logging.info("Creating UiServer....") ui_server = UiServer() logging.info("Removing old SSL certs...") from Crypt import CryptConnection CryptConnection.manager.removeCerts() logging.info("Starting servers....") gevent.joinall([gevent.spawn(ui_server.start), gevent.spawn(file_server.start)]) # Site commands
def formatError(self, title, message, details=True): import sys import gevent if details: details = {key: val for key, val in self.env.items() if hasattr(val, "endswith") and "COOKIE" not in key} details["version_zeronet"] = "%s r%s" % (config.version, config.rev) details["version_python"] = sys.version details["version_gevent"] = gevent.__version__ details["plugins"] = PluginManager.plugin_manager.plugin_names arguments = {key: val for key, val in vars(config.arguments).items() if "password" not in key} details["arguments"] = arguments return """ <style> * { font-family: Consolas, Monospace; color: #333 } pre { padding: 10px; background-color: #EEE } </style> <h1>%s</h1> <h2>%s</h3> <h3>Please <a href="https://github.com/HelloZeroNet/ZeroNet/issues" target="_blank">report it</a> if you think this an error.</h3> <h4>Details:</h4> <pre>%s</pre> """ % (title, message, json.dumps(details, indent=4, sort_keys=True)) else: return """ <h1>%s</h1> <h2>%s</h3> """ % (title, message) # - Reload for eaiser developing - # def reload(): # import imp, sys # global UiWebsocket # UiWebsocket = imp.load_source("UiWebsocket", "src/Ui/UiWebsocket.py").UiWebsocket # reload(sys.modules["User.UserManager"]) # UserManager.reloadModule() # self.user = UserManager.user_manager.getCurrent()
def info(self): info = '' info += '------------------------------------------------------\n' info += 'PHP Proxy Version : %s (python/%s gevent/%s pyopenssl/%s)\n' % (__version__, platform.python_version(), gevent.__version__, OpenSSL.__version__) info += 'Uvent Version : %s (pyuv/%s libuv/%s)\n' % (__import__('uvent').__version__, __import__('pyuv').__version__, __import__('pyuv').LIBUV_VERSION) if all(x in sys.modules for x in ('pyuv', 'uvent')) else '' info += 'Local Proxy : %s:%s\n' % (self.PROXY_HOST, self.PROXY_PORT) if self.PROXY_ENABLE else '' info += 'Debug INFO : %s\n' % self.LISTEN_DEBUGINFO if self.LISTEN_DEBUGINFO else '' if common.GAE_ENABLE: info += 'Listen Address : %s:%d\n' % (self.LISTEN_IP, self.LISTEN_PORT) info += 'GAE Mode : %s\n' % self.GAE_MODE info += 'GAE IPv6 : %s\n' % self.GAE_IPV6 if self.GAE_IPV6 else '' info += 'GAE APPID : %s\n' % '|'.join(self.GAE_APPIDS) info += 'GAE Validate : %s\n' % self.GAE_VALIDATE if self.GAE_VALIDATE else '' info += 'GAE Obfuscate : %s\n' % self.GAE_OBFUSCATE if self.GAE_OBFUSCATE else '' if common.PAC_ENABLE: info += 'Pac Server : http://%s:%d/%s\n' % (self.PAC_IP if self.PAC_IP and self.PAC_IP != '0.0.0.0' else ProxyUtil.get_listen_ip(), self.PAC_PORT, self.PAC_FILE) info += 'Pac File : file://%s\n' % os.path.abspath(self.PAC_FILE) if common.PHP_ENABLE: info += 'PHP Listen : %s\n' % common.PHP_LISTEN info += 'PHP FetchServers : %s\n' % common.PHP_FETCHSERVERS if common.DNS_ENABLE: info += 'DNS Listen : %s\n' % common.DNS_LISTEN info += 'DNS Servers : %s\n' % '|'.join(common.DNS_SERVERS) info += '------------------------------------------------------\n' return info
def test_gevent_version(self): try: import gevent except ImportError: raise SkipTest('gevent not available.') env_version = os.environ.get('GEVENT_VERSION') if env_version: self.assertEqual(env_version, gevent.__version__)
def summary(self): info = '' info += '------------------------------------------------------\n' info += 'GoAgent Version : %s (python/%s gevent/%s pyopenssl/%s)\n' % (__version__, sys.version[:5], gevent.__version__, OpenSSL.__version__) info += 'Uvent Version : %s (pyuv/%s libuv/%s)\n' % (__import__('uvent').__version__, __import__('pyuv').__version__, __import__('pyuv').LIBUV_VERSION) if all(x in sys.modules for x in ('pyuv', 'uvent')) else '' info += 'Listen Address : %s:%d\n' % (self.LISTEN_IP, self.LISTEN_PORT) info += 'Local Proxy : %s:%s\n' % (self.PROXY_HOST, self.PROXY_PORT) if self.PROXY_ENABLE else '' info += 'Debug INFO : %s\n' % self.LISTEN_DEBUGINFO if self.LISTEN_DEBUGINFO else '' info += 'GAE Mode : %s\n' % ('%s (%s)' % (self.GAE_MODE, self.GAE_SSLVERSION) if common.GAE_MODE == 'https' else self.GAE_MODE) info += 'GAE IPv6 : %s\n' % self.GAE_IPV6 if self.GAE_IPV6 else '' info += 'GAE APPID : %s\n' % '|'.join(self.GAE_APPIDS) info += 'GAE Validate : %s\n' % self.GAE_VALIDATE if self.GAE_VALIDATE else '' info += 'GAE Obfuscate : %s\n' % self.GAE_OBFUSCATE if self.GAE_OBFUSCATE else '' if common.PAC_ENABLE: info += 'Pac Server : http://%s:%d/%s\n' % (self.PAC_IP if self.PAC_IP and self.PAC_IP != '0.0.0.0' else ProxyUtil.get_listen_ip(), self.PAC_PORT, self.PAC_FILE) info += 'Pac File : file://%s\n' % os.path.abspath(self.PAC_FILE) if common.PHP_ENABLE: info += 'PHP Listen : %s\n' % common.PHP_LISTEN info += 'PHP FetchServer : %s\n' % common.PHP_FETCHSERVER if common.VPS_ENABLE: info += 'VPS Listen : %s\n' % common.VPS_LISTEN info += 'VPS FetchServer : %s\n' % common.VPS_FETCHSERVER if common.DNS_ENABLE: info += 'DNS Listen : %s\n' % common.DNS_LISTEN info += 'DNS Servers : %s\n' % '|'.join(common.DNS_SERVERS) info += '------------------------------------------------------\n' return info