Файловый менеджер - Редактировать - /home/beautybuzzbeyond/public_html/private/exceptions.py.tar
Назад
usr/lib/python3.6/site-packages/tuned/exceptions.py 0000644 00000001070 14720513577 0016276 0 ustar 00 import tuned.logs import sys import traceback exception_logger = tuned.logs.get() class TunedException(Exception): """ """ def log(self, logger = None): if logger is None: logger = exception_logger logger.error(str(self)) self._log_trace(logger) def _log_trace(self, logger): (exc_type, exc_value, exc_traceback) = sys.exc_info() if exc_value != self: logger.debug("stack trace is no longer available") else: exception_info = "".join(traceback.format_exception(exc_type, exc_value, exc_traceback)).rstrip() logger.debug(exception_info) usr/lib/python3.6/site-packages/dnf/exceptions.py 0000644 00000013331 14720514343 0015721 0 ustar 00 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Library General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Copyright 2004 Duke University """ Core DNF Errors. """ from __future__ import unicode_literals from dnf.i18n import ucd, _, P_ import dnf.util import libdnf import warnings class DeprecationWarning(DeprecationWarning): # :api pass class Error(Exception): # :api """Base Error. All other Errors thrown by DNF should inherit from this. :api """ def __init__(self, value=None): super(Error, self).__init__() self.value = None if value is None else ucd(value) def __str__(self): return "{}".format(self.value) def __unicode__(self): return ucd(self.__str__()) class CompsError(Error): # :api pass class ConfigError(Error): def __init__(self, value=None, raw_error=None): super(ConfigError, self).__init__(value) self.raw_error = ucd(raw_error) if raw_error is not None else None class DatabaseError(Error): pass class DepsolveError(Error): # :api pass class DownloadError(Error): # :api def __init__(self, errmap): super(DownloadError, self).__init__() self.errmap = errmap @staticmethod def errmap2str(errmap): errstrings = [] for key in errmap: for error in errmap[key]: msg = '%s: %s' % (key, error) if key else '%s' % error errstrings.append(msg) return '\n'.join(errstrings) def __str__(self): return self.errmap2str(self.errmap) class LockError(Error): pass class MarkingError(Error): # :api def __init__(self, value=None, pkg_spec=None): """Initialize the marking error instance.""" super(MarkingError, self).__init__(value) self.pkg_spec = None if pkg_spec is None else ucd(pkg_spec) def __str__(self): string = super(MarkingError, self).__str__() if self.pkg_spec: string += ': ' + self.pkg_spec return string class MarkingErrors(Error): # :api def __init__(self, no_match_group_specs=(), error_group_specs=(), no_match_pkg_specs=(), error_pkg_specs=(), module_depsolv_errors=()): """Initialize the marking error instance.""" msg = _("Problems in request:") if (no_match_pkg_specs): msg += "\n" + _("missing packages: ") + ", ".join(no_match_pkg_specs) if (error_pkg_specs): msg += "\n" + _("broken packages: ") + ", ".join(error_pkg_specs) if (no_match_group_specs): msg += "\n" + _("missing groups or modules: ") + ", ".join(no_match_group_specs) if (error_group_specs): msg += "\n" + _("broken groups or modules: ") + ", ".join(error_group_specs) if (module_depsolv_errors): msg_mod = dnf.util._format_resolve_problems(module_depsolv_errors[0]) if module_depsolv_errors[1] == \ libdnf.module.ModulePackageContainer.ModuleErrorType_ERROR_IN_DEFAULTS: msg += "\n" + "\n".join([P_('Modular dependency problem with Defaults:', 'Modular dependency problems with Defaults:', len(module_depsolv_errors)), msg_mod]) else: msg += "\n" + "\n".join([P_('Modular dependency problem:', 'Modular dependency problems:', len(module_depsolv_errors)), msg_mod]) super(MarkingErrors, self).__init__(msg) self.no_match_group_specs = no_match_group_specs self.error_group_specs = error_group_specs self.no_match_pkg_specs = no_match_pkg_specs self.error_pkg_specs = error_pkg_specs self.module_depsolv_errors = module_depsolv_errors @property def module_debsolv_errors(self): msg = "Attribute module_debsolv_errors is deprecated. Use module_depsolv_errors " \ "attribute instead." warnings.warn(msg, DeprecationWarning, stacklevel=2) return self.module_depsolv_errors class MetadataError(Error): pass class MiscError(Error): pass class PackagesNotAvailableError(MarkingError): def __init__(self, value=None, pkg_spec=None, packages=None): super(PackagesNotAvailableError, self).__init__(value, pkg_spec) self.packages = packages or [] class PackageNotFoundError(MarkingError): pass class PackagesNotInstalledError(MarkingError): def __init__(self, value=None, pkg_spec=None, packages=None): super(PackagesNotInstalledError, self).__init__(value, pkg_spec) self.packages = packages or [] class ProcessLockError(LockError): def __init__(self, value, pid): super(ProcessLockError, self).__init__(value) self.pid = pid def __reduce__(self): """Pickling support.""" return (ProcessLockError, (self.value, self.pid)) class RepoError(Error): # :api pass class ThreadLockError(LockError): pass class TransactionCheckError(Error): pass usr/lib/python2.7/site-packages/pip/exceptions.py 0000644 00000017671 14720516440 0015755 0 ustar 00 """Exceptions used throughout package""" from __future__ import absolute_import from itertools import chain, groupby, repeat from pip._vendor.six import iteritems class PipError(Exception): """Base pip exception""" class InstallationError(PipError): """General exception during installation""" class UninstallationError(PipError): """General exception during uninstallation""" class DistributionNotFound(InstallationError): """Raised when a distribution cannot be found to satisfy a requirement""" class RequirementsFileParseError(InstallationError): """Raised when a general error occurs parsing a requirements file line.""" class BestVersionAlreadyInstalled(PipError): """Raised when the most up-to-date version of a package is already installed.""" class BadCommand(PipError): """Raised when virtualenv or a command is not found""" class CommandError(PipError): """Raised when there is an error in command-line arguments""" class PreviousBuildDirError(PipError): """Raised when there's a previous conflicting build directory""" class InvalidWheelFilename(InstallationError): """Invalid wheel filename.""" class UnsupportedWheel(InstallationError): """Unsupported wheel.""" class HashErrors(InstallationError): """Multiple HashError instances rolled into one for reporting""" def __init__(self): self.errors = [] def append(self, error): self.errors.append(error) def __str__(self): lines = [] self.errors.sort(key=lambda e: e.order) for cls, errors_of_cls in groupby(self.errors, lambda e: e.__class__): lines.append(cls.head) lines.extend(e.body() for e in errors_of_cls) if lines: return '\n'.join(lines) def __nonzero__(self): return bool(self.errors) def __bool__(self): return self.__nonzero__() class HashError(InstallationError): """ A failure to verify a package against known-good hashes :cvar order: An int sorting hash exception classes by difficulty of recovery (lower being harder), so the user doesn't bother fretting about unpinned packages when he has deeper issues, like VCS dependencies, to deal with. Also keeps error reports in a deterministic order. :cvar head: A section heading for display above potentially many exceptions of this kind :ivar req: The InstallRequirement that triggered this error. This is pasted on after the exception is instantiated, because it's not typically available earlier. """ req = None head = '' def body(self): """Return a summary of me for display under the heading. This default implementation simply prints a description of the triggering requirement. :param req: The InstallRequirement that provoked this error, with populate_link() having already been called """ return ' %s' % self._requirement_name() def __str__(self): return '%s\n%s' % (self.head, self.body()) def _requirement_name(self): """Return a description of the requirement that triggered me. This default implementation returns long description of the req, with line numbers """ return str(self.req) if self.req else 'unknown package' class VcsHashUnsupported(HashError): """A hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.""" order = 0 head = ("Can't verify hashes for these requirements because we don't " "have a way to hash version control repositories:") class DirectoryUrlHashUnsupported(HashError): """A hash was provided for a version-control-system-based requirement, but we don't have a method for hashing those.""" order = 1 head = ("Can't verify hashes for these file:// requirements because they " "point to directories:") class HashMissing(HashError): """A hash was needed for a requirement but is absent.""" order = 2 head = ('Hashes are required in --require-hashes mode, but they are ' 'missing from some requirements. Here is a list of those ' 'requirements along with the hashes their downloaded archives ' 'actually had. Add lines like these to your requirements files to ' 'prevent tampering. (If you did not enable --require-hashes ' 'manually, note that it turns on automatically when any package ' 'has a hash.)') def __init__(self, gotten_hash): """ :param gotten_hash: The hash of the (possibly malicious) archive we just downloaded """ self.gotten_hash = gotten_hash def body(self): from pip.utils.hashes import FAVORITE_HASH # Dodge circular import. package = None if self.req: # In the case of URL-based requirements, display the original URL # seen in the requirements file rather than the package name, # so the output can be directly copied into the requirements file. package = (self.req.original_link if self.req.original_link # In case someone feeds something downright stupid # to InstallRequirement's constructor. else getattr(self.req, 'req', None)) return ' %s --hash=%s:%s' % (package or 'unknown package', FAVORITE_HASH, self.gotten_hash) class HashUnpinned(HashError): """A requirement had a hash specified but was not pinned to a specific version.""" order = 3 head = ('In --require-hashes mode, all requirements must have their ' 'versions pinned with ==. These do not:') class HashMismatch(HashError): """ Distribution file hash values don't match. :ivar package_name: The name of the package that triggered the hash mismatch. Feel free to write to this after the exception is raise to improve its error message. """ order = 4 head = ('THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS ' 'FILE. If you have updated the package versions, please update ' 'the hashes. Otherwise, examine the package contents carefully; ' 'someone may have tampered with them.') def __init__(self, allowed, gots): """ :param allowed: A dict of algorithm names pointing to lists of allowed hex digests :param gots: A dict of algorithm names pointing to hashes we actually got from the files under suspicion """ self.allowed = allowed self.gots = gots def body(self): return ' %s:\n%s' % (self._requirement_name(), self._hash_comparison()) def _hash_comparison(self): """ Return a comparison of actual and expected hash values. Example:: Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde or 123451234512345123451234512345123451234512345 Got bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef """ def hash_then_or(hash_name): # For now, all the decent hashes have 6-char names, so we can get # away with hard-coding space literals. return chain([hash_name], repeat(' or')) lines = [] for hash_name, expecteds in iteritems(self.allowed): prefix = hash_then_or(hash_name) lines.extend((' Expected %s %s' % (next(prefix), e)) for e in expecteds) lines.append(' Got %s\n' % self.gots[hash_name].hexdigest()) prefix = ' or' return '\n'.join(lines) class UnsupportedPythonVersion(InstallationError): """Unsupported python version according to Requires-Python package metadata."""
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка