kattis-cli 1.2.0__tar.gz → 1.2.2__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.
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/PKG-INFO +1 -1
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/pyproject.toml +1 -1
- kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python/tests/__init__.py +5 -0
- kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python3/Makefile +0 -0
- kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python3/src/problemid.py +0 -0
- kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python3/tests/__init__.py +5 -0
- kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python3/tests/test_problemid.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/main.py +1 -1
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/template.py +24 -20
- kattis_cli-1.2.2/src/kattis_cli/utils/__init__.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/utils/languages.py +1 -1
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/LICENSE +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/README.md +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/.kattis-cli.toml +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/__init__.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/client.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/download.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/fireworks.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_setup.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/__init__.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/main/c.txt +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/main/cpp.txt +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/main/java.txt +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/main/python.txt +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/main/python3.txt +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/project_structure/c/Makefile +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/project_structure/c/src/problemid/problemid.c +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/project_structure/c/tests/test_problemid.c +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/project_structure/cpp/Makefile +0 -0
- {kattis_cli-1.2.0/src/kattis_cli/kattis_templates/project_structure/cpp/src/problemid → kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/cpp/src}/problemid.cpp +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/project_structure/cpp/tests/test_problemid.cpp +0 -0
- /kattis_cli-1.2.0/src/kattis_cli/kattis_templates/project_structure/python3/Makefile → /kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/java/src/problemid.java +0 -0
- /kattis_cli-1.2.0/src/kattis_cli/kattis_templates/project_structure/python3/src/problemid/__init__.py → /kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/java/tests/tests_problemid.java +0 -0
- /kattis_cli-1.2.0/src/kattis_cli/kattis_templates/project_structure/python3/src/problemid/problemid.py → /kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python/Makefile +0 -0
- /kattis_cli-1.2.0/src/kattis_cli/kattis_templates/project_structure/python3/tests/test_problemid.py → /kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python/src/problemid.py +0 -0
- /kattis_cli-1.2.0/src/kattis_cli/utils/__init__.py → /kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python/tests/test_problemid.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/settings.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/solution_tester.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/ui.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/utils/config.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/utils/run_program.py +0 -0
- {kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/utils/utility.py +0 -0
|
File without changes
|
|
File without changes
|
kattis_cli-1.2.2/src/kattis_cli/kattis_templates/project_structure/python3/tests/test_problemid.py
ADDED
|
File without changes
|
|
@@ -69,8 +69,8 @@ def create_template(
|
|
|
69
69
|
shutil.copytree(str(src), home_templates)
|
|
70
70
|
except Exception as e:
|
|
71
71
|
console.print(
|
|
72
|
-
f"[bold red]❌
|
|
73
|
-
copy templates: {e}")
|
|
72
|
+
f"[bold red]❌ Could not \
|
|
73
|
+
copy templates: [/bold red] {e} ")
|
|
74
74
|
return False
|
|
75
75
|
return True
|
|
76
76
|
|
|
@@ -85,8 +85,8 @@ copy templates: {e}")
|
|
|
85
85
|
console = Console()
|
|
86
86
|
if not _check_kattis_templates():
|
|
87
87
|
console.print(
|
|
88
|
-
f"[bold red]❌
|
|
89
|
-
not found in {home_templates}!")
|
|
88
|
+
f"[bold red]❌ Templates '{language}' \
|
|
89
|
+
not found in [/bold red] {home_templates}! ")
|
|
90
90
|
return
|
|
91
91
|
|
|
92
92
|
def _copytree_with_problemid(src: str,
|
|
@@ -94,14 +94,18 @@ not found in {home_templates}!")
|
|
|
94
94
|
problemid: str) -> None:
|
|
95
95
|
for root, _, files in os.walk(src):
|
|
96
96
|
rel = os.path.relpath(root, src)
|
|
97
|
-
rel = rel.replace('problemid', problemid)
|
|
98
97
|
target_root = os.path.join(dst, rel) if rel != '.' else dst
|
|
99
98
|
os.makedirs(target_root, exist_ok=True)
|
|
100
99
|
for f in files:
|
|
101
100
|
src_file = os.path.join(root, f)
|
|
102
101
|
dst_file = os.path.join(
|
|
103
102
|
target_root, f.replace('problemid', problemid))
|
|
104
|
-
|
|
103
|
+
if os.path.exists(dst_file):
|
|
104
|
+
console.print(
|
|
105
|
+
f"[bold yellow]⚠️ File \
|
|
106
|
+
'{dst_file}' exists. Skipping copy. [/bold yellow]")
|
|
107
|
+
else:
|
|
108
|
+
shutil.copy2(src_file, dst_file)
|
|
105
109
|
|
|
106
110
|
# If src_layout, copy the project structure for the language
|
|
107
111
|
if src_layout:
|
|
@@ -111,9 +115,9 @@ not found in {home_templates}!")
|
|
|
111
115
|
_copytree_with_problemid(
|
|
112
116
|
str(lang_src_struct), os.getcwd(), problemid)
|
|
113
117
|
console.print(
|
|
114
|
-
f"[bold
|
|
115
|
-
structure for {language}.")
|
|
116
|
-
target_dir = os.path.join("src"
|
|
118
|
+
f"[bold green]✅ Created project \
|
|
119
|
+
structure for {language}. [/bold green]")
|
|
120
|
+
target_dir = os.path.join("src")
|
|
117
121
|
else:
|
|
118
122
|
target_dir = "."
|
|
119
123
|
|
|
@@ -125,8 +129,8 @@ structure for {language}.")
|
|
|
125
129
|
template_content = tf.read()
|
|
126
130
|
except OSError:
|
|
127
131
|
console.print(
|
|
128
|
-
f"[bold red] ❌
|
|
129
|
-
template file: {main_template}")
|
|
132
|
+
f"[bold red] ❌ Could not read \
|
|
133
|
+
template file: {main_template} [/bold red]")
|
|
130
134
|
return
|
|
131
135
|
|
|
132
136
|
if not main_template:
|
|
@@ -141,21 +145,21 @@ template file: {main_template}")
|
|
|
141
145
|
filename = f"{problemid}{extension}"
|
|
142
146
|
content = template_content
|
|
143
147
|
|
|
144
|
-
|
|
148
|
+
dest_path = os.path.join(target_dir, filename)
|
|
145
149
|
|
|
146
|
-
if os.path.exists(
|
|
150
|
+
if os.path.exists(dest_path) and os.path.getsize(dest_path) > 0:
|
|
147
151
|
console.print(
|
|
148
|
-
f"[bold yellow]
|
|
149
|
-
|
|
152
|
+
f"[bold yellow]⚠️ File '{dest_path}' exists \
|
|
153
|
+
with content. Skipping. [/bold yellow]")
|
|
150
154
|
return
|
|
151
155
|
|
|
152
156
|
try:
|
|
153
|
-
with open(
|
|
157
|
+
with open(dest_path, 'w', encoding='utf-8') as f:
|
|
154
158
|
f.write(content)
|
|
155
159
|
console.print(
|
|
156
|
-
f"[bold green]✅
|
|
157
|
-
'{
|
|
160
|
+
f"[bold green]✅ Created template \
|
|
161
|
+
'{dest_path}' for {language}.[/bold green]")
|
|
158
162
|
except OSError as e:
|
|
159
163
|
console.print(
|
|
160
|
-
f"[bold red]❌
|
|
161
|
-
'{
|
|
164
|
+
f"[bold red]❌ Failed to create template \
|
|
165
|
+
'{dest_path}': {e} [/bold red]")
|
|
File without changes
|
|
@@ -154,7 +154,7 @@ def guess_mainfile(
|
|
|
154
154
|
str: main file
|
|
155
155
|
"""
|
|
156
156
|
if len(files) == 1:
|
|
157
|
-
return files[0]
|
|
157
|
+
return Path(files[0]).name
|
|
158
158
|
# check .kattis-cli.toml file
|
|
159
159
|
if 'mainfile' in lang_config:
|
|
160
160
|
return lang_config['mainfile'].replace(('{problemid}'), problemid)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/project_structure/c/Makefile
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{kattis_cli-1.2.0 → kattis_cli-1.2.2}/src/kattis_cli/kattis_templates/project_structure/cpp/Makefile
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|