Skip to content

Commit

Permalink
Fix bug in Spec.__str__ (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
glorialeezero authored Nov 25, 2024
2 parents 85c3281 + 52a2f1d commit 8dc880c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
11 changes: 7 additions & 4 deletions qupsy/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ def __str__(self) -> str:
testcases_string.append(
f" ( Input: {input_str},\n Output: {output_str}),"
)
return f"""Spec(
gates: [{", ".join(map(lambda g: g.__name__, self.gates))}],
return """Spec(
gates: [{}],
testcases: [
{"\n".join(testcases_string)}
{}
],
)"""
)""".format(
", ".join(map(lambda g: g.__name__, self.gates)),
"\n".join(testcases_string),
)


def make_spec(data: SpecData) -> Spec:
Expand Down
18 changes: 1 addition & 17 deletions qupsy/utils.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
import logging
import os

from rich.console import Console
from rich.logging import RichHandler

console = Console()


_log_level = os.environ.get("LOG_LEVEL")
if _log_level is not None:
_log_level = _log_level.upper()
_log_level = logging.getLevelNamesMapping()[_log_level]


_hander = RichHandler(
console=console,
show_path=_log_level is not None and _log_level == logging.DEBUG,
)

_hander = RichHandler(console=console, show_path=False)
_hander.setFormatter(logging.Formatter(fmt="%(message)s", datefmt="[%X]"))

logger = logging.getLogger("quspy")
logger.addHandler(_hander)
if _log_level is not None:
logger.setLevel(_log_level)

0 comments on commit 8dc880c

Please sign in to comment.