Python pkg_resources.ResolutionError() Examples
The following are 30
code examples of pkg_resources.ResolutionError().
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
pkg_resources
, or try the search function
.
Example #1
Source File: config_utils.py From Decentralized-Internet with MIT License | 5 votes |
def load_validation_plugin(name=None): """Find and load the chosen validation plugin. Args: name (string): the name of the entry_point, as advertised in the setup.py of the providing package. Returns: an uninstantiated subclass of ``bigchaindb.validation.AbstractValidationRules`` """ if not name: return BaseValidationRules # TODO: This will return the first plugin with group `bigchaindb.validation` # and name `name` in the active WorkingSet. # We should probably support Requirements specs in the config, e.g. # validation_plugin: 'my-plugin-package==0.0.1;default' plugin = None for entry_point in iter_entry_points('bigchaindb.validation', name): plugin = entry_point.load() # No matching entry_point found if not plugin: raise ResolutionError( 'No plugin found in group `bigchaindb.validation` with name `{}`'. format(name)) # Is this strictness desireable? # It will probably reduce developer headaches in the wild. if not issubclass(plugin, (BaseValidationRules,)): raise TypeError('object of type "{}" does not implement `bigchaindb.' 'validation.BaseValidationRules`'.format(type(plugin))) return plugin
Example #2
Source File: nnictl.py From nni with MIT License | 5 votes |
def nni_info(*args): if args[0].version: try: print(pkg_resources.get_distribution('nni').version) except pkg_resources.ResolutionError: print_error('Get version failed, please use `pip3 list | grep nni` to check nni version!') else: print('please run "nnictl {positional argument} --help" to see nnictl guidance')
Example #3
Source File: trial_keeper.py From nni with MIT License | 5 votes |
def check_version(args): try: trial_keeper_version = pkg_resources.get_distribution('nni').version except pkg_resources.ResolutionError as err: # package nni does not exist, try nni-tool package nni_log(LogType.Error, 'Package nni does not exist!') os._exit(1) if not args.nni_manager_version: # skip version check nni_log(LogType.Warning, 'Skipping version check!') else: try: trial_keeper_version = regular.search(trial_keeper_version).group('version') nni_log(LogType.Info, 'trial_keeper_version is {0}'.format(trial_keeper_version)) nni_manager_version = regular.search(args.nni_manager_version).group('version') nni_log(LogType.Info, 'nni_manager_version is {0}'.format(nni_manager_version)) log_entry = {} if trial_keeper_version != nni_manager_version: nni_log(LogType.Error, 'Version does not match!') error_message = 'NNIManager version is {0}, TrialKeeper version is {1}, NNI version does not match!'.format( nni_manager_version, trial_keeper_version) log_entry['tag'] = 'VCFail' log_entry['msg'] = error_message rest_post(gen_send_version_url(args.nnimanager_ip, args.nnimanager_port), json.dumps(log_entry), 10, False) os._exit(1) else: nni_log(LogType.Info, 'Version match!') log_entry['tag'] = 'VCSuccess' rest_post(gen_send_version_url(args.nnimanager_ip, args.nnimanager_port), json.dumps(log_entry), 10, False) except AttributeError as err: nni_log(LogType.Error, err)
Example #4
Source File: trial_runner.py From nni with MIT License | 5 votes |
def check_version(args): try: trial_runner_version = pkg_resources.get_distribution('nni').version except pkg_resources.ResolutionError as err: # package nni does not exist, try nni-tool package nni_log(LogType.Error, 'Package nni does not exist!') os._exit(1) if not args.nni_manager_version: # skip version check nni_log(LogType.Warning, 'Skipping version check!') else: try: command_channel = args.command_channel trial_runner_version = regular.search(trial_runner_version).group('version') nni_log(LogType.Info, '{0}: runner_version is {1}'.format(args.node_id, trial_runner_version)) nni_manager_version = regular.search(args.nni_manager_version).group('version') nni_log(LogType.Info, '{0}: nni_manager_version is {1}'.format(args.node_id, nni_manager_version)) log_entry = {} if trial_runner_version != nni_manager_version: nni_log(LogType.Error, '{0}: Version does not match!'.format(args.node_id)) error_message = '{0}: NNIManager version is {1}, Trial runner version is {2}, NNI version does not match!'.format( args.node_id, nni_manager_version, trial_runner_version) log_entry['tag'] = 'VCFail' log_entry['msg'] = error_message command_channel.send(CommandType.VersionCheck, log_entry) while not command_channel.sent(): time.sleep(1) os._exit(1) else: nni_log(LogType.Info, '{0}: Version match!'.format(args.node_id)) log_entry['tag'] = 'VCSuccess' command_channel.send(CommandType.VersionCheck, log_entry) except AttributeError as err: nni_log(LogType.Error, '{0}: {1}'.format(args.node_id, err))
Example #5
Source File: ssl_support.py From ImageFusion with MIT License | 5 votes |
def find_ca_bundle(): """Return an existing CA bundle path, or None""" if os.name=='nt': return get_win_certfile() else: for cert_path in cert_paths: if os.path.isfile(cert_path): return cert_path try: return pkg_resources.resource_filename('certifi', 'cacert.pem') except (ImportError, ResolutionError, ExtractionError): return None
Example #6
Source File: ssl_support.py From Ansible with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #7
Source File: ssl_support.py From datafari with Apache License 2.0 | 5 votes |
def find_ca_bundle(): """Return an existing CA bundle path, or None""" if os.name=='nt': return get_win_certfile() else: for cert_path in cert_paths: if os.path.isfile(cert_path): return cert_path try: return pkg_resources.resource_filename('certifi', 'cacert.pem') except (ImportError, ResolutionError, ExtractionError): return None
Example #8
Source File: ssl_support.py From setuptools with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #9
Source File: ssl_support.py From PhonePi_SampleServer with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #10
Source File: test_config_utils.py From bigchaindb with Apache License 2.0 | 5 votes |
def test_load_validation_plugin_raises_with_unknown_name(): from pkg_resources import ResolutionError from bigchaindb import config_utils with pytest.raises(ResolutionError): config_utils.load_validation_plugin('bogus')
Example #11
Source File: config_utils.py From bigchaindb with Apache License 2.0 | 5 votes |
def load_validation_plugin(name=None): """Find and load the chosen validation plugin. Args: name (string): the name of the entry_point, as advertised in the setup.py of the providing package. Returns: an uninstantiated subclass of ``bigchaindb.validation.AbstractValidationRules`` """ if not name: return BaseValidationRules # TODO: This will return the first plugin with group `bigchaindb.validation` # and name `name` in the active WorkingSet. # We should probably support Requirements specs in the config, e.g. # validation_plugin: 'my-plugin-package==0.0.1;default' plugin = None for entry_point in iter_entry_points('bigchaindb.validation', name): plugin = entry_point.load() # No matching entry_point found if not plugin: raise ResolutionError( 'No plugin found in group `bigchaindb.validation` with name `{}`'. format(name)) # Is this strictness desireable? # It will probably reduce developer headaches in the wild. if not issubclass(plugin, (BaseValidationRules,)): raise TypeError('object of type "{}" does not implement `bigchaindb.' 'validation.BaseValidationRules`'.format(type(plugin))) return plugin
Example #12
Source File: config_utils.py From Decentralized-Internet with MIT License | 5 votes |
def load_validation_plugin(name=None): """Find and load the chosen validation plugin. Args: name (string): the name of the entry_point, as advertised in the setup.py of the providing package. Returns: an uninstantiated subclass of ``bigchaindb.validation.AbstractValidationRules`` """ if not name: return BaseValidationRules # TODO: This will return the first plugin with group `bigchaindb.validation` # and name `name` in the active WorkingSet. # We should probably support Requirements specs in the config, e.g. # validation_plugin: 'my-plugin-package==0.0.1;default' plugin = None for entry_point in iter_entry_points('bigchaindb.validation', name): plugin = entry_point.load() # No matching entry_point found if not plugin: raise ResolutionError( 'No plugin found in group `bigchaindb.validation` with name `{}`'. format(name)) # Is this strictness desireable? # It will probably reduce developer headaches in the wild. if not issubclass(plugin, (BaseValidationRules,)): raise TypeError('object of type "{}" does not implement `bigchaindb.' 'validation.BaseValidationRules`'.format(type(plugin))) return plugin
Example #13
Source File: test_config_utils.py From Decentralized-Internet with MIT License | 5 votes |
def test_load_validation_plugin_raises_with_unknown_name(): from pkg_resources import ResolutionError from bigchaindb import config_utils with pytest.raises(ResolutionError): config_utils.load_validation_plugin('bogus')
Example #14
Source File: ssl_support.py From rules_pip with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #15
Source File: ssl_support.py From syntheticmass with Apache License 2.0 | 5 votes |
def find_ca_bundle(): """Return an existing CA bundle path, or None""" if os.name=='nt': return get_win_certfile() else: for cert_path in cert_paths: if os.path.isfile(cert_path): return cert_path try: return pkg_resources.resource_filename('certifi', 'cacert.pem') except (ImportError, ResolutionError, ExtractionError): return None
Example #16
Source File: ssl_support.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def find_ca_bundle(): """Return an existing CA bundle path, or None""" if os.name == 'nt': return get_win_certfile() else: for cert_path in cert_paths: if os.path.isfile(cert_path): return cert_path try: import certifi return certifi.where() except (ImportError, ResolutionError, ExtractionError): return None
Example #17
Source File: ssl_support.py From coffeegrindsize with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #18
Source File: ssl_support.py From jarvis with GNU General Public License v2.0 | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #19
Source File: ssl_support.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #20
Source File: ssl_support.py From Hands-On-Deep-Learning-for-Games with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #21
Source File: ssl_support.py From aws-kube-codesuite with Apache License 2.0 | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #22
Source File: ssl_support.py From android_universal with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #23
Source File: ssl_support.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #24
Source File: ssl_support.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def find_ca_bundle(): """Return an existing CA bundle path, or None""" if os.name == 'nt': return get_win_certfile() else: for cert_path in cert_paths: if os.path.isfile(cert_path): return cert_path try: import certifi return certifi.where() except (ImportError, ResolutionError, ExtractionError): return None
Example #25
Source File: ssl_support.py From Flask with Apache License 2.0 | 5 votes |
def find_ca_bundle(): """Return an existing CA bundle path, or None""" if os.name=='nt': return get_win_certfile() else: for cert_path in cert_paths: if os.path.isfile(cert_path): return cert_path try: return pkg_resources.resource_filename('certifi', 'cacert.pem') except (ImportError, ResolutionError, ExtractionError): return None
Example #26
Source File: ssl_support.py From Flask with Apache License 2.0 | 5 votes |
def find_ca_bundle(): """Return an existing CA bundle path, or None""" if os.name=='nt': return get_win_certfile() else: for cert_path in cert_paths: if os.path.isfile(cert_path): return cert_path try: return pkg_resources.resource_filename('certifi', 'cacert.pem') except (ImportError, ResolutionError, ExtractionError): return None
Example #27
Source File: ssl_support.py From deepWordBug with Apache License 2.0 | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #28
Source File: ssl_support.py From jbox with MIT License | 5 votes |
def find_ca_bundle(): """Return an existing CA bundle path, or None""" if os.name=='nt': return get_win_certfile() else: for cert_path in cert_paths: if os.path.isfile(cert_path): return cert_path try: return pkg_resources.resource_filename('certifi', 'cacert.pem') except (ImportError, ResolutionError, ExtractionError): return None
Example #29
Source File: ssl_support.py From python-netsurv with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass
Example #30
Source File: ssl_support.py From python-netsurv with MIT License | 5 votes |
def _certifi_where(): try: return __import__('certifi').where() except (ImportError, ResolutionError, ExtractionError): pass