adityassarode.codes 1.0.2__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.
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"
@@ -0,0 +1,435 @@
1
+ import os
2
+ import shutil
3
+ import sys
4
+ import getpass
5
+ import hashlib
6
+
7
+ import time
8
+ import threading
9
+ from importlib import resources
10
+
11
+ AUTHOR = "Aditya Sarode"
12
+ TOOL = "adityassarode.codes"
13
+ PACKAGE = "adityassarode_codes"
14
+ OWNER_PASSWORD_HASH = hashlib.sha256(
15
+ b"Aditya@#2509"
16
+ ).hexdigest()
17
+
18
+
19
+ OWNER_COMMAND = "__owner_list"
20
+
21
+ # ===== Colors =====
22
+ RESET = "\033[0m"
23
+ BOLD = "\033[1m"
24
+ CYAN = "\033[96m"
25
+ GREEN = "\033[92m"
26
+ YELLOW = "\033[93m"
27
+ RED = "\033[91m"
28
+
29
+ # ===== ASCII Logo =====
30
+ LOGO = f"""
31
+ {CYAN}{BOLD}
32
+ _ _ _ _
33
+ /_\ __| (_) |_ _ _ __ _
34
+ / _ \/ _` | | _| || / _` |
35
+ /_/_\_\__,_|_|\__|\_, \__,_|
36
+ / __| __ _ _ _ ___|__/| |___
37
+ \__ \/ _` | '_/ _ \/ _` / -_)
38
+ |___/\__,_|_| \___/\__,_\___|
39
+
40
+ adityassarode.codes
41
+ by Aditya Sarode
42
+ {RESET}
43
+ """
44
+
45
+
46
+ # ===== Owner check =====
47
+
48
+
49
+
50
+ def show_strict_notice_and_confirm():
51
+ README_URL = "https://github.com/adityassarode/adityassarode.codes/blob/main/README.md"
52
+
53
+ print(
54
+ RED + BOLD +
55
+ "\n============================================================\n"
56
+ "IMPORTANT – READ BEFORE CONTINUING\n"
57
+ "============================================================\n"
58
+ + RESET
59
+ )
60
+
61
+ print(
62
+ YELLOW +
63
+ "Before using this tool, you MUST read and understand\n"
64
+ "the rules, restrictions, and responsibility notice.\n\n"
65
+ "Read the full notice here:\n\n"
66
+ + RESET
67
+ + CYAN + BOLD + README_URL + RESET + "\n"
68
+ )
69
+
70
+ print(
71
+ RED + BOLD +
72
+ "\n============================================================\n"
73
+ + RESET
74
+ )
75
+
76
+ answer = input(
77
+ YELLOW +
78
+ "After reading the README, type YES to accept and continue: "
79
+ + RESET
80
+ ).strip().upper()
81
+
82
+ if answer != "YES":
83
+ print(
84
+ RED + BOLD +
85
+ "\nAccess denied. You must read and accept the README to continue.\n"
86
+ + RESET
87
+ )
88
+ sys.exit(1)
89
+
90
+
91
+
92
+
93
+ # ===== Typing animation =====
94
+ def type_print(text, delay=0.01):
95
+ for ch in text:
96
+ sys.stdout.write(ch)
97
+ sys.stdout.flush()
98
+ time.sleep(delay)
99
+ print()
100
+
101
+
102
+ # ===== Spinner animation =====
103
+ def spinner_task(message, stop_event):
104
+ frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
105
+ i = 0
106
+ while not stop_event.is_set():
107
+ sys.stdout.write(
108
+ f"\r{YELLOW}{message} {frames[i % len(frames)]}{RESET}"
109
+ )
110
+ sys.stdout.flush()
111
+ time.sleep(0.1)
112
+ i += 1
113
+ sys.stdout.write("\r" + " " * (len(message) + 6) + "\r")
114
+
115
+
116
+ # ===== Banner =====
117
+ def banner():
118
+ print(LOGO)
119
+
120
+
121
+ # ===== Show folder tree =====
122
+ def show_tree(path, indent=""):
123
+ for item in sorted(os.listdir(path)):
124
+ if item == "__pycache__" or item.endswith(".pyc"):
125
+ continue
126
+
127
+ full = os.path.join(path, item)
128
+ if os.path.isdir(full):
129
+ print(indent + CYAN + "📁 " + item + RESET)
130
+ show_tree(full, indent + " ")
131
+ else:
132
+ print(indent + GREEN + "📄 " + item + RESET)
133
+
134
+
135
+
136
+ def owner_auth():
137
+ try:
138
+ pwd = getpass.getpass("Owner password: ")
139
+ return hashlib.sha256(pwd.encode()).hexdigest() == OWNER_PASSWORD_HASH
140
+ except Exception:
141
+ return False
142
+
143
+ def owner_templates_path():
144
+ return resources.files(PACKAGE).joinpath("owner_templates")
145
+
146
+
147
+ # ===== Owner-only project list =====
148
+ def owner_list_projects():
149
+ if not is_owner():
150
+ return
151
+
152
+ templates_path = resources.files(PACKAGE).joinpath("templates")
153
+ print(YELLOW + "\n[OWNER MODE] Available projects:\n" + RESET)
154
+
155
+ for item in templates_path.iterdir():
156
+ if item.is_dir():
157
+ print(" -", item.name)
158
+
159
+ def download_selected_files(project_name):
160
+ banner()
161
+ show_strict_notice_and_confirm()
162
+
163
+ templates_path = resources.files(PACKAGE).joinpath("templates")
164
+ src = templates_path.joinpath(project_name)
165
+
166
+ if not src.exists():
167
+ print(RED + "Project not found." + RESET)
168
+ return
169
+
170
+ files = [
171
+ f for f in src.iterdir()
172
+ if f.is_file() and not f.name.endswith(".pyc")
173
+ ]
174
+
175
+ if not files:
176
+ print(YELLOW + "No files available to download." + RESET)
177
+ return
178
+
179
+ print(YELLOW + "\nAvailable files:\n" + RESET)
180
+ for i, f in enumerate(files, 1):
181
+ print(f" {i}. {f.name}")
182
+
183
+ choice = input(
184
+ YELLOW + "\nEnter file numbers (comma separated): " + RESET
185
+ ).strip()
186
+
187
+ try:
188
+ indexes = [int(x.strip()) - 1 for x in choice.split(",")]
189
+ except ValueError:
190
+ print(RED + "Invalid input." + RESET)
191
+ return
192
+
193
+ selected = []
194
+ for i in indexes:
195
+ if 0 <= i < len(files):
196
+ selected.append(files[i])
197
+
198
+ if not selected:
199
+ print(RED + "No valid files selected." + RESET)
200
+ return
201
+
202
+ for f in selected:
203
+ shutil.copy2(f, os.path.join(os.getcwd(), f.name))
204
+
205
+ print(
206
+ GREEN
207
+ + f"\n✔ Downloaded {len(selected)} file(s) successfully"
208
+ + RESET
209
+ )
210
+
211
+ # ===== Preview project (NO download) =====
212
+ def preview_project(project_name):
213
+ banner()
214
+ show_strict_notice_and_confirm()
215
+ templates_path = resources.files(PACKAGE).joinpath("templates")
216
+ src = templates_path.joinpath(project_name)
217
+
218
+ if not src.exists():
219
+ print(RED + "Project not found." + RESET)
220
+ return
221
+
222
+ type_print(YELLOW + "👀 Previewing project \n" + RESET)
223
+ show_tree(src)
224
+
225
+
226
+ # ===== Init project (download) =====
227
+ def init_project(project_name):
228
+ banner()
229
+ show_strict_notice_and_confirm()
230
+ templates_path = resources.files(PACKAGE).joinpath("templates")
231
+ src = templates_path.joinpath(project_name)
232
+
233
+ if not src.exists():
234
+ print(RED + "Error: project not found." + RESET)
235
+ return
236
+
237
+ dst = os.path.join(os.getcwd(), project_name)
238
+
239
+ if os.path.exists(dst):
240
+ print(YELLOW + "Folder already exists." + RESET)
241
+ return
242
+
243
+ stop_event = threading.Event()
244
+ spinner = threading.Thread(
245
+ target=spinner_task,
246
+ args=(f"Downloading {project_name}", stop_event),
247
+ )
248
+ spinner.start()
249
+
250
+ time.sleep(0.6)
251
+ shutil.copytree(src, dst)
252
+
253
+ stop_event.set()
254
+ spinner.join()
255
+
256
+ print(GREEN + "✔ Project downloaded successfully" + RESET)
257
+
258
+ print(CYAN + f"Author: {AUTHOR}\n" + RESET)
259
+
260
+ print(YELLOW + BOLD + "📂 Project structure:" + RESET)
261
+ show_tree(dst)
262
+
263
+ print("\n" + CYAN + f"Open with: code {project_name}" + RESET)
264
+ def owner_list():
265
+ base = owner_templates_path()
266
+
267
+ if not base.exists():
268
+ print(YELLOW + "No owner projects found." + RESET)
269
+ return
270
+
271
+ print(YELLOW + "\n[OWNER] Available owner projects:\n" + RESET)
272
+
273
+ for item in base.iterdir():
274
+ if item.is_dir():
275
+ print(" -", item.name)
276
+ def owner_view(project_name):
277
+ base = owner_templates_path()
278
+ src = base.joinpath(project_name)
279
+
280
+ if not src.exists():
281
+ print(RED + "Owner project not found." + RESET)
282
+ return
283
+
284
+ print(CYAN + "\n[OWNER] Project structure:\n" + RESET)
285
+ show_tree(src)
286
+ def owner_get(project_name):
287
+ base = owner_templates_path()
288
+ src = base.joinpath(project_name)
289
+
290
+ if not src.exists():
291
+ print(RED + "Owner project not found." + RESET)
292
+ return
293
+
294
+ dst = os.path.join(os.getcwd(), project_name)
295
+
296
+ if os.path.exists(dst):
297
+ print(YELLOW + "Folder already exists." + RESET)
298
+ return
299
+
300
+ shutil.copytree(src, dst)
301
+ print(GREEN + "✔ Owner project downloaded successfully" + RESET)
302
+ def owner_select(project_name):
303
+ base = owner_templates_path()
304
+ src = base.joinpath(project_name)
305
+
306
+ if not src.exists():
307
+ print(RED + "Owner project not found." + RESET)
308
+ return
309
+
310
+ files = [f for f in src.rglob("*") if f.is_file()]
311
+
312
+ if not files:
313
+ print(YELLOW + "No files found." + RESET)
314
+ return
315
+
316
+ print(YELLOW + "\nAvailable files:\n" + RESET)
317
+ for i, f in enumerate(files, 1):
318
+ print(f" {i}. {f.relative_to(src)}")
319
+
320
+ choice = input(
321
+ YELLOW + "\nEnter numbers (comma separated): " + RESET
322
+ ).strip()
323
+
324
+ try:
325
+ indexes = [int(x.strip()) - 1 for x in choice.split(",")]
326
+ except ValueError:
327
+ print(RED + "Invalid input." + RESET)
328
+ return
329
+
330
+ for i in indexes:
331
+ if 0 <= i < len(files):
332
+ dst = os.path.join(os.getcwd(), files[i].name)
333
+ shutil.copy2(files[i], dst)
334
+
335
+ print(GREEN + "✔ Selected files downloaded" + RESET)
336
+
337
+
338
+ # ===== Interactive selector =====
339
+ def interactive_select():
340
+ templates = resources.files(PACKAGE).joinpath("templates")
341
+ projects = sorted([p.name for p in templates.iterdir() if p.is_dir()])
342
+
343
+ banner()
344
+ print(YELLOW + "Select a project:\n" + RESET)
345
+
346
+ for i, p in enumerate(projects, 1):
347
+ print(f" {i}. {p}")
348
+
349
+ choice = input("\nEnter number: ").strip()
350
+
351
+ if not choice.isdigit():
352
+ print(RED + "Invalid selection." + RESET)
353
+ sys.exit(1)
354
+
355
+ idx = int(choice) - 1
356
+ if idx < 0 or idx >= len(projects):
357
+ print(RED + "Invalid selection." + RESET)
358
+ sys.exit(1)
359
+
360
+ return projects[idx]
361
+
362
+
363
+ # ===== Main =====
364
+ def main():
365
+ # ===== OWNER MODE =====
366
+ if len(sys.argv) > 1 and sys.argv[1] == "-owner":
367
+ banner()
368
+
369
+ if not owner_auth():
370
+ print(RED + "Access denied." + RESET)
371
+ sys.exit(1)
372
+
373
+ if len(sys.argv) > 2:
374
+ cmd = sys.argv[2]
375
+
376
+ if cmd == "list":
377
+ owner_list()
378
+ return
379
+
380
+ if cmd == "view" and len(sys.argv) > 3:
381
+ owner_view(sys.argv[3])
382
+ return
383
+
384
+ if cmd == "get" and len(sys.argv) > 3:
385
+ owner_get(sys.argv[3])
386
+ return
387
+
388
+ if cmd == "select" and len(sys.argv) > 3:
389
+ owner_select(sys.argv[3])
390
+ return
391
+
392
+ print(YELLOW + "Owner commands:" + RESET)
393
+ print(" adityassarode-codes -owner list")
394
+ print(" adityassarode-codes -owner view <project>")
395
+ print(" adityassarode-codes -owner get <project>")
396
+ print(" adityassarode-codes -owner select <project>")
397
+ return
398
+
399
+ # Owner-only hidden command
400
+ if len(sys.argv) > 1 and sys.argv[1] == OWNER_COMMAND:
401
+ owner_list_projects()
402
+ return
403
+
404
+ # Download selected files
405
+ if len(sys.argv) > 2 and sys.argv[1] == "get":
406
+ download_selected_files(sys.argv[2])
407
+ return
408
+
409
+ # Preview project
410
+ if len(sys.argv) > 2 and sys.argv[1] == "preview":
411
+ preview_project(sys.argv[2])
412
+ return
413
+
414
+ # Init project
415
+ if len(sys.argv) > 2 and sys.argv[1] == "init":
416
+ init_project(sys.argv[2])
417
+ return
418
+
419
+ # No arguments → interactive mode
420
+ if len(sys.argv) == 1:
421
+ project = interactive_select()
422
+ init_project(project)
423
+ return
424
+
425
+ # Fallback / help
426
+ banner()
427
+ print("Usage:")
428
+ print(" adityassarode-codes")
429
+ print(" adityassarode-codes init <project>")
430
+ print(" adityassarode-codes preview <project>")
431
+ print(" adityassarode-codes get <project>")
432
+
433
+
434
+ if __name__ == "__main__":
435
+ main()
File without changes
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ # DS Codes
2
+
3
+ Created by **Aditya Sarode**
@@ -0,0 +1 @@
1
+ print("hii")
@@ -0,0 +1,3 @@
1
+ # IOT Codes
2
+
3
+ Created by **Aditya Sarode**
@@ -0,0 +1 @@
1
+ print("hii")
@@ -0,0 +1,3 @@
1
+ # JAVA Codes
2
+
3
+ Created by **Aditya Sarode**
@@ -0,0 +1,5 @@
1
+ public class hi {
2
+
3
+ }
4
+
5
+
@@ -0,0 +1,3 @@
1
+ # MLS Codes
2
+
3
+ Created by **Aditya Sarode**
@@ -0,0 +1 @@
1
+ print("hii")
File without changes
@@ -0,0 +1,56 @@
1
+ Metadata-Version: 2.4
2
+ Name: adityassarode.codes
3
+ Version: 1.0.2
4
+ Summary: CLI tool by Aditya Sarode for learning and practice
5
+ Author: Aditya Sarode
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ ## ⚠️ Strict Warning – Read Carefully
10
+
11
+ This tool and the code it generates are provided **only for learning, practice, and skill building**.
12
+
13
+ The purpose of this tool is to help students understand concepts **before exams**, similar to textbooks, notes, tutorials, and practice problems.
14
+ It is **not** designed for shortcuts, copying, or cheating under any circumstances.
15
+
16
+ ---
17
+
18
+ ## User Rules (No Exceptions)
19
+
20
+ By using this tool, you agree to all of the following rules:
21
+
22
+ - You **must not** use this tool or its generated code during exams, tests, assignments, or any academic evaluation.
23
+ - You **must not** copy, submit, or present the generated code as your own work for marks or academic credit.
24
+ - You **must not** share generated code with others for cheating or gaining unfair academic advantage.
25
+ - This tool is for **learning only**, to understand logic, structure, and concepts.
26
+ - You are **fully responsible** for following your college or institution’s academic integrity rules. Ignorance is not an excuse.
27
+
28
+ ---
29
+
30
+ ## Academic Integrity
31
+
32
+ Any use of this tool for cheating is **strictly prohibited**.
33
+
34
+ If a student misuses this tool and is caught violating academic rules, **full responsibility lies with the student**.
35
+ There are **no exceptions**.
36
+
37
+ ---
38
+
39
+ ## Notice to Teachers, Faculty, and Authorities
40
+
41
+ The intent and limitations of this tool are clearly stated above.
42
+
43
+ If a student chooses to misuse this tool despite these warnings, the **author is not responsible** for that behavior.
44
+
45
+ The author, **Aditya Sarode**:
46
+
47
+ - Does **not** support cheating
48
+ - Does **not** encourage misuse
49
+ - Has **no control** over how users behave after installing or accessing this tool
50
+
51
+ Any attempt to hold the author responsible for a user’s misconduct is **unfair and unjustified**.
52
+
53
+ ---
54
+
55
+ By continuing to use this tool, you acknowledge that you have read, understood, and accepted all the rules above and take **full responsibility** for your actions.
56
+
@@ -0,0 +1,19 @@
1
+ adityassarode_codes/__init__.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
2
+ adityassarode_codes/cli.py,sha256=yXcU6yqVbvsihpIGAslGOQKqFEEOe7YNLPKP2iaoR4A,11099
3
+ adityassarode_codes/owner_templates/hhi.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ adityassarode_codes/owner_templates/hh/hhhh.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ adityassarode_codes/owner_templates/hh/aasd/hhhjhh.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ adityassarode_codes/templates/readme.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ adityassarode_codes/templates/adityassarode.CDS/README.md,sha256=mRULWDROlkiEjBhVsYbjGsckd7SZlgN_8Hz1VqOB8bA,41
8
+ adityassarode_codes/templates/adityassarode.CDS/t1.py,sha256=U-ybVNb3D8vlB3CldP0tIGWAyxaZZAjTnlEDk-Mju4U,12
9
+ adityassarode_codes/templates/adityassarode.CIOT/README.md,sha256=YmC4ZJ3SdGm5qCQNUp-zIZYm1Sg4RCR2TqpAKKayseM,41
10
+ adityassarode_codes/templates/adityassarode.CIOT/t2.py,sha256=U-ybVNb3D8vlB3CldP0tIGWAyxaZZAjTnlEDk-Mju4U,12
11
+ adityassarode_codes/templates/adityassarode.CJAVA/README.md,sha256=cfPJAN6gnko5ZZPMyypTC4QMGWmkC5WbJ6wrxrLXc8E,42
12
+ adityassarode_codes/templates/adityassarode.CJAVA/hi.java,sha256=fFdG2I9PF_GGRF5iBBg4bHbubibS-tA-1fJrYGVDK30,23
13
+ adityassarode_codes/templates/adityassarode.CML/README.md,sha256=691bIIEBgSBK3ShEhb5kB52Rx7CkNKS1PZNsBEsvEdg,41
14
+ adityassarode_codes/templates/adityassarode.CML/t3.py,sha256=U-ybVNb3D8vlB3CldP0tIGWAyxaZZAjTnlEDk-Mju4U,12
15
+ adityassarode_codes-1.0.2.dist-info/METADATA,sha256=a4kt5Hckc95VtIgMwJdhtjCTYumK6IGFALlwos2nzE0,2168
16
+ adityassarode_codes-1.0.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
17
+ adityassarode_codes-1.0.2.dist-info/entry_points.txt,sha256=bYl9F86YVMzGz1FuyzbUBAE3u6pEeZ_vWSCYi2tcBy8,69
18
+ adityassarode_codes-1.0.2.dist-info/top_level.txt,sha256=UBOK0KHSKpIu03PGv8O0GsYd2VfsSl5RmaARfvyMQKI,20
19
+ adityassarode_codes-1.0.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ adityassarode-codes = adityassarode_codes.cli:main
@@ -0,0 +1 @@
1
+ adityassarode_codes