kattis-cli 1.1.0__py3-none-any.whl → 1.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kattis_cli/client.py +2 -4
- kattis_cli/fireworks.py +2 -11
- kattis_cli/main.py +1 -1
- kattis_cli/utils/languages.py +11 -5
- kattis_cli/utils/utility.py +2 -0
- {kattis_cli-1.1.0.dist-info → kattis_cli-1.1.1.dist-info}/METADATA +1 -1
- {kattis_cli-1.1.0.dist-info → kattis_cli-1.1.1.dist-info}/RECORD +10 -10
- {kattis_cli-1.1.0.dist-info → kattis_cli-1.1.1.dist-info}/WHEEL +0 -0
- {kattis_cli-1.1.0.dist-info → kattis_cli-1.1.1.dist-info}/entry_points.txt +0 -0
- {kattis_cli-1.1.0.dist-info → kattis_cli-1.1.1.dist-info}/licenses/LICENSE +0 -0
kattis_cli/client.py
CHANGED
|
@@ -5,8 +5,8 @@ Object-oriented Kattis API client.
|
|
|
5
5
|
This class wraps login, submit and status-checking functionality previously
|
|
6
6
|
implemented as module-level functions in `kattis.py`.
|
|
7
7
|
"""
|
|
8
|
-
|
|
9
|
-
from typing import List, Any
|
|
8
|
+
|
|
9
|
+
from typing import List, Any
|
|
10
10
|
import sys
|
|
11
11
|
import os
|
|
12
12
|
import re
|
|
@@ -20,8 +20,6 @@ from rich.console import Console
|
|
|
20
20
|
from rich.align import Align
|
|
21
21
|
from rich.live import Live
|
|
22
22
|
from rich.prompt import Confirm
|
|
23
|
-
import subprocess
|
|
24
|
-
from pathlib import Path
|
|
25
23
|
|
|
26
24
|
from kattis_cli.utils import languages
|
|
27
25
|
from kattis_cli.utils import config
|
kattis_cli/fireworks.py
CHANGED
|
@@ -11,8 +11,6 @@ import sys
|
|
|
11
11
|
import locale
|
|
12
12
|
import time
|
|
13
13
|
from random import randint, choice
|
|
14
|
-
import subprocess
|
|
15
|
-
from pathlib import Path
|
|
16
14
|
|
|
17
15
|
|
|
18
16
|
def run_fireworks() -> None:
|
|
@@ -21,10 +19,9 @@ def run_fireworks() -> None:
|
|
|
21
19
|
Draws random bursts in the terminal using ANSI colors. Works in CI/Docker
|
|
22
20
|
and avoids external dependencies.
|
|
23
21
|
"""
|
|
24
|
-
frames =
|
|
22
|
+
frames = 5
|
|
25
23
|
width = 60
|
|
26
24
|
height = 20
|
|
27
|
-
message = None
|
|
28
25
|
symbols = ['*', '•', '✶', '✸']
|
|
29
26
|
colors = [
|
|
30
27
|
'\x1b[37m', # white
|
|
@@ -61,12 +58,6 @@ def run_fireworks() -> None:
|
|
|
61
58
|
# Simple ASCII fallback symbols
|
|
62
59
|
symbols = ['*', '+', 'o', '.']
|
|
63
60
|
# Replace message with ASCII-only fallback if necessary
|
|
64
|
-
if message:
|
|
65
|
-
try:
|
|
66
|
-
message.encode('ascii')
|
|
67
|
-
except (UnicodeEncodeError, TypeError):
|
|
68
|
-
message = (message.encode('ascii', 'replace')
|
|
69
|
-
.decode('ascii'))
|
|
70
61
|
# Inform interactive users why we fell back (but avoid noisy logs
|
|
71
62
|
# in captured/non-interactive runs).
|
|
72
63
|
if sys.stdout.isatty():
|
|
@@ -108,7 +99,7 @@ def run_fireworks() -> None:
|
|
|
108
99
|
time.sleep(0.12)
|
|
109
100
|
|
|
110
101
|
# final message
|
|
111
|
-
msg =
|
|
102
|
+
msg = '🎉 Congratulations — Accepted! 🎉'
|
|
112
103
|
sys.stdout.write('\n')
|
|
113
104
|
if use_color:
|
|
114
105
|
sys.stdout.write('\x1b[1;33m')
|
kattis_cli/main.py
CHANGED
|
@@ -7,7 +7,7 @@ build.sh script copies the contents of this file to main.py.
|
|
|
7
7
|
Change the __version__ to match in pyproject.toml
|
|
8
8
|
Has to be higher than the pypi version.
|
|
9
9
|
"""
|
|
10
|
-
__version__ = '1.1.
|
|
10
|
+
__version__ = '1.1.1'
|
|
11
11
|
|
|
12
12
|
from math import inf
|
|
13
13
|
from typing import Tuple
|
kattis_cli/utils/languages.py
CHANGED
|
@@ -13,6 +13,8 @@ from kattis_cli.utils.utility import find_problem_root_folder
|
|
|
13
13
|
|
|
14
14
|
LANGUAGE_GUESS = {
|
|
15
15
|
'.c': 'c',
|
|
16
|
+
'.h': 'c',
|
|
17
|
+
'.hpp': 'cpp',
|
|
16
18
|
'.c++': 'cpp',
|
|
17
19
|
'.cc': 'cpp',
|
|
18
20
|
'.c#': 'csharp',
|
|
@@ -129,6 +131,8 @@ def guess_language(ext: str, files: List[str]) -> str:
|
|
|
129
131
|
return "c"
|
|
130
132
|
else:
|
|
131
133
|
return "cpp"
|
|
134
|
+
if ext == '.hpp':
|
|
135
|
+
return "cpp"
|
|
132
136
|
if ext == ".py":
|
|
133
137
|
return "python3"
|
|
134
138
|
return LANGUAGE_GUESS.get(ext, '')
|
|
@@ -314,19 +318,21 @@ filename extension "{ext}"''')
|
|
|
314
318
|
return problemid, loc_language, mainclass, files, root_folder, lang_config
|
|
315
319
|
|
|
316
320
|
|
|
317
|
-
def get_coding_files() -> List[str]:
|
|
321
|
+
def get_coding_files(base_path: Path = Path.cwd()) -> List[str]:
|
|
318
322
|
"""Get coding files from current directory.
|
|
319
323
|
|
|
320
324
|
Returns:
|
|
321
325
|
List[str]: List of coding files.
|
|
322
326
|
"""
|
|
323
|
-
|
|
327
|
+
|
|
328
|
+
if Path(base_path / "src").is_dir():
|
|
329
|
+
base_path = base_path / "src"
|
|
324
330
|
console = Console()
|
|
325
|
-
files = [
|
|
326
|
-
|
|
331
|
+
files = [str(f) for f in base_path.rglob(
|
|
332
|
+
'*') if f.is_file() and valid_extension(str(f))]
|
|
327
333
|
if not files:
|
|
328
334
|
console.print(
|
|
329
|
-
'No source file(s) found in
|
|
335
|
+
f'No source file(s) found in {base_path}!',
|
|
330
336
|
style='bold red')
|
|
331
337
|
exit(1)
|
|
332
338
|
return files
|
kattis_cli/utils/utility.py
CHANGED
|
@@ -34,6 +34,8 @@ def find_problem_root_folder(
|
|
|
34
34
|
Returns:
|
|
35
35
|
bool: True if path exists, False otherwise
|
|
36
36
|
"""
|
|
37
|
+
if filename.startswith('/'):
|
|
38
|
+
filename = Path(filename).name
|
|
37
39
|
for file in path.glob(filename):
|
|
38
40
|
name, ext = os.path.splitext(file.name)
|
|
39
41
|
folder_name = path.parts[-1]
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
kattis_cli/.kattis-cli.toml,sha256=kGh0gmpFAnivyUC9hR8Y1ZqYJeTBWNyBQ9zOg4AInZ0,898
|
|
2
2
|
kattis_cli/__init__.py,sha256=afN92pog2fGyicY6KNBofYbCBYbYj4Fpi_INUSpsc-E,402
|
|
3
|
-
kattis_cli/client.py,sha256=
|
|
3
|
+
kattis_cli/client.py,sha256=5ef-pq737q-VBBxY1F-bEbP9Mf8145YppL4m9NlVCVY,16938
|
|
4
4
|
kattis_cli/download.py,sha256=IFjebvvxJyPKfsK8Voo06llSsybBqqylUWEv5lF2J7o,8651
|
|
5
|
-
kattis_cli/fireworks.py,sha256=
|
|
5
|
+
kattis_cli/fireworks.py,sha256=yKFXIvDDdNrzBhpEt2Pdy5zgfYjJffoOEf2yUFlu2TQ,4134
|
|
6
6
|
kattis_cli/kattis.py,sha256=wpnM6sC0a32kJYzEux27izug59bicexNnOFxcx0qWM8,2621
|
|
7
7
|
kattis_cli/kattis_setup.py,sha256=mic79GjOI_rC6Lfl5D5ORDMWdrcxR71ksYUM51yezu8,5659
|
|
8
|
-
kattis_cli/main.py,sha256=
|
|
8
|
+
kattis_cli/main.py,sha256=NoSSGZdtd3PO3TnAIi5stvTi8Zb_6Ppd9pLKv6CiYKE,4511
|
|
9
9
|
kattis_cli/settings.py,sha256=d5q4dYj9VqDSqPalleh2oZWtND-1bPB0T2IwdajFrBg,591
|
|
10
10
|
kattis_cli/solution_tester.py,sha256=hTXtryYs8lkO9CkSPtQNjhrAPPLaC4au5ueCQ3ioZWQ,7577
|
|
11
11
|
kattis_cli/ui.py,sha256=2qFWz9QB7cgjLfZKHrWUrKFVYLRLwl0c37ZTNljwmAI,4580
|
|
12
12
|
kattis_cli/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
kattis_cli/utils/config.py,sha256=6SIuiXA9sFADo8RZUj8A6rXb3uqmrWrmmArfZrqNQdw,2293
|
|
14
|
-
kattis_cli/utils/languages.py,sha256=
|
|
14
|
+
kattis_cli/utils/languages.py,sha256=gcJJJwkPS1Zpg76atwoo2O2Vd7ETKBQV-KD_cwclrmE,8928
|
|
15
15
|
kattis_cli/utils/run_program.py,sha256=NWQ6vtTeWgkaW75r91FIHGXR5cAbeu8yMb5hwzpYFsg,2613
|
|
16
|
-
kattis_cli/utils/utility.py,sha256=
|
|
17
|
-
kattis_cli-1.1.
|
|
18
|
-
kattis_cli-1.1.
|
|
19
|
-
kattis_cli-1.1.
|
|
20
|
-
kattis_cli-1.1.
|
|
21
|
-
kattis_cli-1.1.
|
|
16
|
+
kattis_cli/utils/utility.py,sha256=oUbydPbcC2wXvfku21YAWpaJjuBKaBRVybMAWCSfM9Y,2987
|
|
17
|
+
kattis_cli-1.1.1.dist-info/METADATA,sha256=TLE1BHoCDFfWPj0eKEQG4gk4F0ciOBROwlkG7_FnVcs,6962
|
|
18
|
+
kattis_cli-1.1.1.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
19
|
+
kattis_cli-1.1.1.dist-info/entry_points.txt,sha256=kyzGN20VqUPR_H0J_jJUKT-10-cAMFLVegQ6C7tbHss,47
|
|
20
|
+
kattis_cli-1.1.1.dist-info/licenses/LICENSE,sha256=JmBa4SEKBCDWEgiOZcISU4tUCpli6xSpVlSYgkBXSNQ,1067
|
|
21
|
+
kattis_cli-1.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|