kattis-cli 1.1.0__tar.gz → 1.1.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kattis-cli
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: A command-line tool for Kattis
5
5
  License-File: LICENSE
6
6
  Author: Ram Basnet
@@ -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
- from pdb import run
9
- from typing import List, Any, final
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
@@ -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 = 40
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 = message or '🎉 Congratulations — Accepted! 🎉'
102
+ msg = '🎉 Congratulations — Accepted! 🎉'
112
103
  sys.stdout.write('\n')
113
104
  if use_color:
114
105
  sys.stdout.write('\x1b[1;33m')
@@ -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.0'
10
+ __version__ = '1.1.1'
11
11
 
12
12
  from math import inf
13
13
  from typing import Tuple
@@ -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
- cur_folder = str(Path.cwd())
327
+
328
+ if Path(base_path / "src").is_dir():
329
+ base_path = base_path / "src"
324
330
  console = Console()
325
- files = [
326
- f for f in os.listdir(cur_folder) if valid_extension(f)]
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 the current folder!',
335
+ f'No source file(s) found in {base_path}!',
330
336
  style='bold red')
331
337
  exit(1)
332
338
  return files
@@ -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,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kattis-cli"
3
- version = "1.1.0"
3
+ version = "1.1.1"
4
4
  authors = ["Ram Basnet <rbasnet@coloradomesa.edu>"]
5
5
  description = "A command-line tool for Kattis"
6
6
  readme = "README.md"
@@ -14,7 +14,7 @@ classifiers = [
14
14
  # PEP 621 metadata table for tools that expect [project].
15
15
  [project]
16
16
  name = "kattis-cli"
17
- version = "1.1.0"
17
+ version = "1.1.1"
18
18
  description = "A command-line tool for Kattis"
19
19
  readme = "README.md"
20
20
  authors = [
File without changes
File without changes
File without changes