Skip to content

Commit 1234a05

Browse files
authored
Merge pull request #317 from gkreitz/colorlog_and_small_fixes
Colorlog and small fixes
2 parents bd92eee + f4d674c commit 1234a05

File tree

7 files changed

+22
-7
lines changed

7 files changed

+22
-7
lines changed

examples/guess/problem.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ source: Kattis
44
license: cc by-sa
55

66
type: interactive
7-
name: Guess the Number
7+
name:
8+
en: Guess the Number
9+
sv: Gissa talet
810

911
# Override standard limits: say that the TLE solutions provided should
1012
# be at least 4 times above the time limit in order for us to be

examples/oddecho/problem.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ license: cc by-sa
44
credits: Johan Sannemo
55
source: Principles of Algorithmic Problem Solving
66
type: scoring
7-
name: Odd Echo
7+
name:
8+
en: Odd Echo
9+
sv: Udda eko

guess.pdf

-17.8 KB
Binary file not shown.

problemtools/tex2html.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def convert(problem_root: Path, options: argparse.Namespace, statement_file: Pat
5252

5353
renderer.render(doc)
5454

55+
# Clean up the logger class plasTeX registers, and reset to the default
56+
logging.setLoggerClass(logging.Logger)
57+
5558
# Annoying: I have not figured out any way of stopping the plasTeX
5659
# renderer from generating a .paux file
5760
if os.path.isfile('.paux'):

problemtools/verifyproblem.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import uuid
2525
from pathlib import Path
2626

27+
import colorlog
2728
import yaml
2829

2930
from . import config
@@ -753,9 +754,13 @@ def check(self, context: Context) -> bool:
753754
self._check_res = True
754755

755756
if not self.statements:
756-
allowed_statements = ', '.join(
757-
f'problem.{ext}, problem.[a-z][a-z].{ext}' for ext in self.problem.format.statement_extensions
758-
)
757+
if self.problem.format is FormatVersion.LEGACY:
758+
allowed_statements = ', '.join(
759+
f'problem.{ext}, problem.<language>.{ext}' for ext in self.problem.format.statement_extensions
760+
)
761+
else:
762+
allowed_statements = ', '.join(f'problem.<language>.{ext}' for ext in self.problem.format.statement_extensions)
763+
759764
self.error(
760765
f'No problem statements found (expected file of one of following forms in directory {self.problem.format.statement_directory}/: {allowed_statements})'
761766
)
@@ -1986,8 +1991,8 @@ def argparser() -> argparse.ArgumentParser:
19861991
def initialize_logging(args: argparse.Namespace) -> None:
19871992
ProblemAspect.max_additional_info = args.max_additional_info
19881993

1989-
fmt = '%(levelname)s %(message)s'
1990-
logging.basicConfig(stream=sys.stdout, format=fmt, level=getattr(logging, args.log_level.upper()))
1994+
fmt = '%(log_color)s%(levelname)s %(message)s'
1995+
colorlog.basicConfig(stream=sys.stdout, format=fmt, level=getattr(logging, args.log_level.upper()))
19911996

19921997

19931998
def main() -> None:

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ license = "MIT"
1717
keywords = ["kattis", "problemtools", "icpc", "clics"]
1818

1919
dependencies = [
20+
"colorlog",
21+
"nh3",
2022
"PyYAML",
2123
"plasTeX>=3.0",
2224
"pydantic>=2.11",

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
colorlog
12
nh3
23
PyYAML
34
plasTeX>=3.0

0 commit comments

Comments
 (0)