forked from dzmitryashkinadze/PDBCor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,074 additions
and
164 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from . import clustering | ||
from .cli import cli | ||
from .cli import CLI | ||
from .correlation_extraction import CorrelationExtraction | ||
|
||
__all__ = ["CorrelationExtraction", "cli", "clustering"] | ||
__all__ = ["CorrelationExtraction", "CLI", "clustering"] |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from . import cli | ||
from . import CLI | ||
|
||
cli() | ||
CLI.run() |
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,55 @@ | ||
import sys | ||
|
||
from rich.console import Console as RichConsole | ||
from rich.markdown import Markdown | ||
from tqdm import tqdm as tqdm_base | ||
|
||
|
||
class Console(RichConsole): | ||
def __init__(self, *args, **kwargs): | ||
self.quiet = False | ||
super().__init__(*args, **kwargs) | ||
|
||
def set_quiet(self, quiet=True): | ||
self.quiet = quiet | ||
|
||
def print(self, *args, **kwargs): | ||
if not self.quiet: | ||
super().print(*args, **kwargs) | ||
|
||
def _h(self, text, level): | ||
"""Print header with given level (e.g. `h1` for `level = 1`).""" | ||
if not isinstance(level, int) or not 1 <= level <= 6: | ||
raise ValueError(f"Invalid header level: {level}") | ||
md = f"{'#'*level} {text}" | ||
self.print(Markdown(md)) | ||
|
||
def h1(self, text): | ||
self._h(text, 1) | ||
|
||
def h2(self, text): | ||
self._h(text.upper(), 2) | ||
|
||
def h3(self, text): | ||
self._h(text, 3) | ||
|
||
def h4(self, text): | ||
self._h(text, 4) | ||
|
||
def tqdm(self, *args, **kwargs): | ||
return self._Tqdm(*args, outer=self, **kwargs) | ||
|
||
class _Tqdm(tqdm_base): | ||
kwargs_default = { | ||
"file": sys.stdout, | ||
"disable": None, | ||
} | ||
|
||
def __init__(self, *args, outer=None, **kwargs): | ||
if outer is not None and outer.quiet: | ||
kwargs.update(disable=True) | ||
|
||
super().__init__(*args, **{**self.kwargs_default, **kwargs}) | ||
|
||
|
||
console = Console() |
Oops, something went wrong.