-
Notifications
You must be signed in to change notification settings - Fork 36
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
86 changed files
with
4,860 additions
and
833 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""This module contains the logging configuration and methods for BQSKit.""" | ||
from __future__ import annotations | ||
|
||
import logging | ||
from sys import stdout as _stdout | ||
|
||
|
||
_logging_initialized = False | ||
|
||
|
||
def enable_logging(verbose: bool = False) -> None: | ||
""" | ||
Enable logging for BQSKit. | ||
Args: | ||
verbose (bool): If set to True, will print more verbose messages. | ||
Defaults to False. | ||
""" | ||
global _logging_initialized | ||
if not _logging_initialized: | ||
_logger = logging.getLogger('bqskit') | ||
_handler = logging.StreamHandler(_stdout) | ||
_handler.setLevel(0) | ||
_fmt_header = '%(asctime)s.%(msecs)03d - %(levelname)-8s |' | ||
_fmt_message = ' %(name)s: %(message)s' | ||
_fmt = _fmt_header + _fmt_message | ||
_formatter = logging.Formatter(_fmt, '%H:%M:%S') | ||
_handler.setFormatter(_formatter) | ||
_logger.addHandler(_handler) | ||
_logging_initialized = True | ||
|
||
level = logging.DEBUG if verbose else logging.INFO | ||
logging.getLogger('bqskit').setLevel(level) | ||
|
||
|
||
def disable_logging() -> None: | ||
"""Disable logging for BQSKit.""" | ||
logging.getLogger('bqskit').setLevel(logging.CRITICAL) |
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,4 +1,4 @@ | ||
"""This module contains the version information for BQSKit.""" | ||
from __future__ import annotations | ||
__version_info__ = ('1', '1', '2') | ||
__version_info__ = ('1', '2', '0') | ||
__version__ = '.'.join(__version_info__[:3]) + ''.join(__version_info__[3:]) |
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.