Python sys.api_version() Examples
The following are 30
code examples of sys.api_version().
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
sys
, or try the search function
.
Example #1
Source File: test_sys.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def test_attributes(self): if not test.test_support.is_jython: self.assert_(isinstance(sys.api_version, int)) self.assert_(isinstance(sys.argv, list)) self.assert_(sys.byteorder in ("little", "big")) self.assert_(isinstance(sys.builtin_module_names, tuple)) self.assert_(isinstance(sys.copyright, basestring)) self.assert_(isinstance(sys.exec_prefix, basestring)) self.assert_(isinstance(sys.executable, basestring)) self.assert_(isinstance(sys.hexversion, int)) self.assert_(isinstance(sys.maxint, int)) self.assert_(isinstance(sys.maxunicode, int)) self.assert_(isinstance(sys.platform, basestring)) self.assert_(isinstance(sys.prefix, basestring)) self.assert_(isinstance(sys.version, basestring)) vi = sys.version_info self.assert_(isinstance(vi, tuple)) self.assertEqual(len(vi), 5) self.assert_(isinstance(vi[0], int)) self.assert_(isinstance(vi[1], int)) self.assert_(isinstance(vi[2], int)) self.assert_(vi[3] in ("alpha", "beta", "candidate", "final")) self.assert_(isinstance(vi[4], int))
Example #2
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 6 votes |
def initialize(): '''Initializes FIRST by installing hooks and populating required data strucutres.''' global g_network_headers g_network_headers['User-Agent'] = "FIRST {} {} Cython {}({}.{}.{}) {}".format( FIRST.VERSION, FIRST.DATE, sys.api_version, sys.version_info.major, sys.version_info.minor, sys.version_info.releaselevel, sys.platform ) FIRST.installed_hooks = [FIRST.Hook.IDP(), FIRST.Hook.UI()] [x.hook() for x in FIRST.installed_hooks] FIRST.plugin = FIRST_FormClass()
Example #3
Source File: clusters.py From clusterdock with Apache License 2.0 | 6 votes |
def create_cluster(resource_root, name, version=None, fullVersion=None): """ Create a cluster @param resource_root: The root Resource object. @param name: Cluster name @param version: Cluster CDH major version (eg: "CDH4") - The CDH minor version will be assumed to be the latest released version for CDH4, or 5.0 for CDH5. @param fullVersion: Cluster's full CDH version. (eg: "5.1.1") - If specified, 'version' will be ignored. - Since: v6 @return: An ApiCluster object """ if version is None and fullVersion is None: raise Exception("Either 'version' or 'fullVersion' must be specified") if fullVersion is not None: api_version = 6 version = None else: api_version = 1 apicluster = ApiCluster(resource_root, name, version, fullVersion) return call(resource_root.post, CLUSTERS_PATH, ApiCluster, True, data=[apicluster], api_version=api_version)[0]
Example #4
Source File: clusters.py From clusterdock with Apache License 2.0 | 6 votes |
def configure_for_kerberos(self, datanode_transceiver_port=None, datanode_web_port=None): """ Command to configure the cluster to use Kerberos for authentication. This command will configure all relevant services on a cluster for Kerberos usage. This command will trigger a GenerateCredentials command to create Kerberos keytabs for all roles in the cluster. @param datanode_transceiver_port: The HDFS DataNode transceiver port to use. This will be applied to all DataNode role configuration groups. If not specified, this will default to 1004. @param datanode_web_port: The HDFS DataNode web port to use. This will be applied to all DataNode role configuration groups. If not specified, this will default to 1006. @return: Reference to the submitted command. @since: API v11 """ args = dict() if datanode_transceiver_port: args['datanodeTransceiverPort'] = datanode_transceiver_port if datanode_web_port: args['datanodeWebPort'] = datanode_web_port return self._cmd('configureForKerberos', data=args, api_version=11)
Example #5
Source File: test_sys.py From medicare-demo with Apache License 2.0 | 6 votes |
def test_attributes(self): if not test.test_support.is_jython: self.assert_(isinstance(sys.api_version, int)) self.assert_(isinstance(sys.argv, list)) self.assert_(sys.byteorder in ("little", "big")) self.assert_(isinstance(sys.builtin_module_names, tuple)) self.assert_(isinstance(sys.copyright, basestring)) self.assert_(isinstance(sys.exec_prefix, basestring)) self.assert_(isinstance(sys.executable, basestring)) self.assert_(isinstance(sys.hexversion, int)) self.assert_(isinstance(sys.maxint, int)) self.assert_(isinstance(sys.maxunicode, int)) self.assert_(isinstance(sys.platform, basestring)) self.assert_(isinstance(sys.prefix, basestring)) self.assert_(isinstance(sys.version, basestring)) vi = sys.version_info self.assert_(isinstance(vi, tuple)) self.assertEqual(len(vi), 5) self.assert_(isinstance(vi[0], int)) self.assert_(isinstance(vi[1], int)) self.assert_(isinstance(vi[2], int)) self.assert_(vi[3] in ("alpha", "beta", "candidate", "final")) self.assert_(isinstance(vi[4], int))
Example #6
Source File: test_sys.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_attributes(self): if not test.test_support.is_jython: self.assert_(isinstance(sys.api_version, int)) self.assert_(isinstance(sys.argv, list)) self.assert_(sys.byteorder in ("little", "big")) self.assert_(isinstance(sys.builtin_module_names, tuple)) self.assert_(isinstance(sys.copyright, basestring)) self.assert_(isinstance(sys.exec_prefix, basestring)) self.assert_(isinstance(sys.executable, basestring)) self.assert_(isinstance(sys.hexversion, int)) self.assert_(isinstance(sys.maxint, int)) self.assert_(isinstance(sys.maxunicode, int)) self.assert_(isinstance(sys.platform, basestring)) self.assert_(isinstance(sys.prefix, basestring)) self.assert_(isinstance(sys.version, basestring)) vi = sys.version_info self.assert_(isinstance(vi, tuple)) self.assertEqual(len(vi), 5) self.assert_(isinstance(vi[0], int)) self.assert_(isinstance(vi[1], int)) self.assert_(isinstance(vi[2], int)) self.assert_(vi[3] in ("alpha", "beta", "candidate", "final")) self.assert_(isinstance(vi[4], int))
Example #7
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def auto_assign_roles(self): """ Automatically assign roles to hosts and create the roles for all the services in a cluster. Assignments are done based on services in the cluster and hardware specifications. Existing roles will be taken into account and their assignments will be not be modified. @since: API v6 """ self._put("autoAssignRoles", None, api_version=6)
Example #8
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def deploy_cluster_client_config(self, hostIds=[]): """ Deploys Cluster client configuration (Kerberos configuration) to the hosts on the cluster. Any hosts that are decommissioned or have running roles will be skipped. @param hostIds: hostIds of hosts to deploy to. If empty, deploys to all hosts in the cluster. @return: Reference to the submitted command. @since: API v7 """ return self._cmd('deployClusterClientConfig', data=hostIds, api_version=7)
Example #9
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def add_hosts(self, hostIds): """ Adds a host to the cluster. @param hostIds: List of IDs of hosts to add to cluster. @return: A list of ApiHostRef objects of the new hosts that were added to the cluster @since: API v3 """ hostRefList = [ApiHostRef(self._get_resource_root(), x) for x in hostIds] return self._post("hosts", ApiHostRef, True, data=hostRefList, api_version=3)
Example #10
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def remove_all_hosts(self): """ Removes the association of all the hosts with the cluster. @return: A list of ApiHostRef objects of the hosts that were removed. @since: API v3 """ return self._delete("hosts", ApiHostRef, True, api_version=3)
Example #11
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def remove_host(self, hostId): """ Removes the association of the host with the cluster. @return: A ApiHostRef of the host that was removed. @since: API v3 """ return self._delete("hosts/" + hostId, ApiHostRef, api_version=3)
Example #12
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def list_hosts(self): """ Lists all the hosts that are associated with this cluster. @return: A list of ApiHostRef objects of the hosts in the cluster. @since: API v3 """ return self._get("hosts", ApiHostRef, True, api_version=3)
Example #13
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def auto_configure(self): """ Automatically configures roles and services in a cluster. Overwrites some existing configurations. Might create new role config groups. Only default role config groups must exist before calling this endpoint. Other role config groups must not exist. If they do, an exception will be thrown preventing any configuration. Ignores the Cloudera Management Service even if colocated with roles of this cluster. To avoid over-committing the heap on hosts, assign hosts to this cluster that are not being used by the Cloudera Management Service. @since: API v6 """ self._put("autoConfigure", None, api_version=6)
Example #14
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def export(self, export_auto_config=False): """ Export the cluster template for the given cluster. ccluster must have host templates defined. It cluster does not have host templates defined it will export host templates based on roles assignment. @param export_auto_config: Also export auto configured configs @return: Return cluster template @since: API v12 """ return self._get("export", ApiClusterTemplate, False, params=dict(exportAutoConfig=export_auto_config), api_version=12)
Example #15
Source File: clusters.py From clusterdock with Apache License 2.0 | 5 votes |
def pools_refresh(self): """ Refresh Dynamic Pools configurations for relevant services.. @return: Reference to the submitted command. @since: API v6 """ return self._cmd('poolsRefresh', api_version=6)
Example #16
Source File: test_sys.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_api_version(self): # api_version self.assertEqual(sys.api_version, 0)
Example #17
Source File: test.py From SourcetrailPythonIndexer with GNU General Public License v3.0 | 5 votes |
def test_indexer_records_import_of_multiple_aliased_variables_with_single_import_statement(self): client = self.indexSourceCode( 'from sys import float_info as FI, api_version as AI\n' ) self.assertTrue('USAGE: virtual_file -> sys at [1:6|1:8]' in client.references) self.assertTrue('IMPORT: virtual_file -> sys.float_info at [1:17|1:26]' in client.references) self.assertTrue('IMPORT: virtual_file -> sys.float_info at [1:31|1:32]' in client.references) self.assertTrue('IMPORT: virtual_file -> sys.api_version at [1:35|1:45]' in client.references) self.assertTrue('IMPORT: virtual_file -> sys.api_version at [1:50|1:51]' in client.references)
Example #18
Source File: test_sys.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_api_version(self): # api_version self.assertEqual(sys.api_version, 0)
Example #19
Source File: testapp.py From data with GNU General Public License v3.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #20
Source File: testapp.py From appengine-try-python-flask with Apache License 2.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #21
Source File: testapp.py From data with GNU General Public License v3.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #22
Source File: testapp.py From data with GNU General Public License v3.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #23
Source File: testapp.py From data with GNU General Public License v3.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #24
Source File: clusters.py From clusterdock with Apache License 2.0 | 4 votes |
def upgrade_cdh(self, deploy_client_config=True, start_all_services=True, cdh_parcel_version=None, cdh_package_version=None, rolling_restart=False, slave_batch_size=None, sleep_seconds=None, slave_fail_count_threshold=None): """ Perform CDH upgrade to the next major version. In v9+, also supports minor CDH 5 upgrades (5.a.b to 5.x.y where x > a) and supports maintenance release changes (a.b.x to a.b.y). If using packages, CDH packages on all hosts of the cluster must be manually upgraded before this command is issued. The command will upgrade the services and their configuration to the requested version. All running services will be stopped before proceeding, unless rolling restart is requested and is available. @param deploy_client_config: Whether to deploy client configurations after the upgrade. Default is True. Has no effect in v9+; client configurations are always deployed. @param start_all_services: Whether to start all services after the upgrade. Default is True. Has no effect in v9+; services are always restarted. @param cdh_parcel_version: If upgrading to parcels, the full version of an already distributed parcel for the next CDH version. Default is None. Example versions are: '5.0.0-1.cdh5.0.0.p0.11' or '5.0.2-1.cdh5.0.2.p0.32'. @param cdh_package_version: If upgrading to packages, the full version of an already installed package for the next CDH version. Default is None. Example versions are: '5.2.0' or '4.5.0'. Only available since v9. @param rolling_restart: If you'd like to do a rolling restart, set this to True. Default is False. Only available since v9. @param slave_batch_size: Controls the rolling restart slave batch size. Only applicable when rolling_restart is True. @param sleep_seconds: Controls how many seconds to sleep betweein rolling restart batches. Only applicable when rolling_restart is True. @param slave_fail_count_threshold: Controls how many slave restart failures are tolerated in a rolling restart. Only applicable when rolling_restart is True. @return: Reference to the submitted command. @since: API v6 for major upgrades only, v9 for maintenance and CDH 5 minor releases. """ args = dict() args['deployClientConfig'] = deploy_client_config args['startAllServices'] = start_all_services if cdh_parcel_version: args['cdhParcelVersion'] = cdh_parcel_version if cdh_package_version: args['cdhPackageVersion'] = cdh_package_version if rolling_restart: args['rollingRestartArgs'] = { 'slaveBatchSize' : slave_batch_size, 'sleepSeconds' : sleep_seconds, 'slaveFailCountThreshold' : slave_fail_count_threshold } return self._cmd('upgradeCdh', data=args, api_version=6)
Example #25
Source File: testapp.py From data with GNU General Public License v3.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #26
Source File: testapp.py From android_universal with MIT License | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #27
Source File: testapp.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #28
Source File: testapp.py From Flask with Apache License 2.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')
Example #29
Source File: testapp.py From recruit with Apache License 2.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = "unknown" python_eggs.append( "<li>%s <small>[%s]</small>" % (escape(egg.project_name), escape(version)) ) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append( "<tr><th>%s<td><code>%s</code>" % (escape(str(key)), " ".join(wrap(escape(repr(value))))) ) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append("virtual") if expanded: class_.append("exp") sys_path.append( "<li%s>%s" % (' class="%s"' % " ".join(class_) if class_ else "", escape(item)) ) return ( TEMPLATE % { "python_version": "<br>".join(escape(sys.version).splitlines()), "platform": escape(sys.platform), "os": escape(os.name), "api_version": sys.api_version, "byteorder": sys.byteorder, "werkzeug_version": werkzeug.__version__, "python_eggs": "\n".join(python_eggs), "wsgi_env": "\n".join(wsgi_env), "sys_path": "\n".join(sys_path), } ).encode("utf-8")
Example #30
Source File: testapp.py From Flask with Apache License 2.0 | 4 votes |
def render_testapp(req): try: import pkg_resources except ImportError: eggs = () else: eggs = sorted(pkg_resources.working_set, key=lambda x: x.project_name.lower()) python_eggs = [] for egg in eggs: try: version = egg.version except (ValueError, AttributeError): version = 'unknown' python_eggs.append('<li>%s <small>[%s]</small>' % ( escape(egg.project_name), escape(version) )) wsgi_env = [] sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) for key, value in sorted_environ: wsgi_env.append('<tr><th>%s<td><code>%s</code>' % ( escape(str(key)), ' '.join(wrap(escape(repr(value)))) )) sys_path = [] for item, virtual, expanded in iter_sys_path(): class_ = [] if virtual: class_.append('virtual') if expanded: class_.append('exp') sys_path.append('<li%s>%s' % ( class_ and ' class="%s"' % ' '.join(class_) or '', escape(item) )) return (TEMPLATE % { 'python_version': '<br>'.join(escape(sys.version).splitlines()), 'platform': escape(sys.platform), 'os': escape(os.name), 'api_version': sys.api_version, 'byteorder': sys.byteorder, 'werkzeug_version': werkzeug.__version__, 'python_eggs': '\n'.join(python_eggs), 'wsgi_env': '\n'.join(wsgi_env), 'sys_path': '\n'.join(sys_path) }).encode('utf-8')