-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/7.13' into main
- Loading branch information
Showing
87 changed files
with
1,701 additions
and
770 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Set, TYPE_CHECKING, Type | ||
|
||
if TYPE_CHECKING: | ||
from tribler.core.components.component import Component | ||
|
||
|
||
class ComponentError(Exception): | ||
pass | ||
|
||
|
||
class ComponentStartupException(ComponentError): | ||
def __init__(self, component: Component, cause: Exception): | ||
super().__init__(component.__class__.__name__) | ||
self.component = component | ||
self.__cause__ = cause | ||
|
||
|
||
class MissedDependency(ComponentError): | ||
def __init__(self, component: Component, dependency: Type[Component]): | ||
msg = f'Missed dependency: {component.__class__.__name__} requires {dependency.__name__} to be active' | ||
super().__init__(msg) | ||
self.component = component | ||
self.dependency = dependency | ||
|
||
|
||
class MultipleComponentsFound(ComponentError): | ||
def __init__(self, comp_cls: Type[Component], candidates: Set[Component]): | ||
msg = f'Found multiple subclasses for the class {comp_cls}. Candidates are: {candidates}.' | ||
super().__init__(msg) | ||
|
||
|
||
class NoneComponent: | ||
def __getattr__(self, item): | ||
return NoneComponent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.