Skip to content

Commit

Permalink
Auto format
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Mar 30, 2023
1 parent 6514825 commit 7679aed
Show file tree
Hide file tree
Showing 239 changed files with 21,033 additions and 13,412 deletions.
55 changes: 34 additions & 21 deletions conda/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""OS-agnostic, system-level binary package manager."""
from json import JSONEncoder
import os
from os.path import abspath, dirname
import sys
from json import JSONEncoder
from os.path import abspath, dirname

from .__version__ import __version__
from .deprecations import deprecated


__all__ = (
"__name__", "__version__", "__author__", "__email__", "__license__", "__summary__", "__url__",
"CONDA_PACKAGE_ROOT", "CondaError", "CondaMultiError", "CondaExitZero", "conda_signal_handler",
"__name__",
"__version__",
"__author__",
"__email__",
"__license__",
"__summary__",
"__url__",
"CONDA_PACKAGE_ROOT",
"CondaError",
"CondaMultiError",
"CondaExitZero",
"conda_signal_handler",
"__copyright__",
)

Expand Down Expand Up @@ -40,6 +49,7 @@
def another_to_unicode(val):
return val


class CondaError(Exception):
return_code = 1
reportable = False # Exception may be reported to core maintainers
Expand All @@ -57,14 +67,16 @@ def __str__(self):
try:
return str(self.message % self._kwargs)
except Exception:
debug_message = "\n".join((
"class: " + self.__class__.__name__,
"message:",
self.message,
"kwargs:",
str(self._kwargs),
"",
))
debug_message = "\n".join(
(
"class: " + self.__class__.__name__,
"message:",
self.message,
"kwargs:",
str(self._kwargs),
"",
)
)
print(debug_message, file=sys.stderr)
raise

Expand All @@ -76,13 +88,12 @@ def dump_map(self):
message=str(self),
error=repr(self),
caused_by=repr(self._caused_by),
**self._kwargs
**self._kwargs,
)
return result


class CondaMultiError(CondaError):

def __init__(self, errors):
self.errors = errors
super().__init__(None)
Expand All @@ -97,18 +108,19 @@ def __repr__(self):
# by using e.__repr__() instead of repr(e)
# https://github.com/scrapy/cssselect/issues/34
errs.append(e.__repr__())
res = '\n'.join(errs)
res = "\n".join(errs)
return res

def __str__(self):
return "\n".join(str(e) for e in self.errors) + "\n"

def dump_map(self):
return dict(exception_type=str(type(self)),
exception_name=self.__class__.__name__,
errors=tuple(error.dump_map() for error in self.errors),
error="Multiple Errors Encountered.",
)
return dict(
exception_type=str(type(self)),
exception_name=self.__class__.__name__,
errors=tuple(error.dump_map() for error in self.errors),
error="Multiple Errors Encountered.",
)

def contains(self, exception_class):
return any(isinstance(e, exception_class) for e in self.errors)
Expand All @@ -130,6 +142,7 @@ def conda_signal_handler(signum, frame):
p.send_signal(signum)

from .exceptions import CondaSignalInterrupt

raise CondaSignalInterrupt(signum)


Expand Down
Loading

0 comments on commit 7679aed

Please sign in to comment.