cg-code 0.1.3__tar.gz → 0.1.4__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.
- cg_code-0.1.4/PKG-INFO +146 -0
- cg_code-0.1.4/README.md +133 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/__init__.py +2 -1
- cg_code-0.1.4/cg_code/file.py +60 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_all.py +727 -344
- cg_code-0.1.4/cg_code.egg-info/PKG-INFO +146 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code.egg-info/SOURCES.txt +2 -1
- {cg_code-0.1.3 → cg_code-0.1.4}/pyproject.toml +1 -1
- cg_code-0.1.3/PKG-INFO +0 -149
- cg_code-0.1.3/README.md +0 -136
- cg_code-0.1.3/cg_code.egg-info/PKG-INFO +0 -149
- {cg_code-0.1.3 → cg_code-0.1.4}/LICENSE +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/__init__.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p1.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p10.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p2.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p3.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p4.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p5.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p6.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p7.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p8.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/hci/hci_p9.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/nlp/__init__.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/__init__.py +0 -0
- /cg_code-0.1.3/cg_code/om/om_al.txt → /cg_code-0.1.4/cg_code/om/om_all.txt +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p1_1.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p1_2.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p1_3.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p1_4.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p2_1.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p3_1.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p3_4.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p4_1.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p_2_2.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p_2_3.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p_3_2.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p_3_3.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/om/om_p_4_2.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/__init__.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p1.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p10.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p2.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p3.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p4.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p5.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p6.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p7.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p8.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code/qc/qc_p9.py +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code.egg-info/dependency_links.txt +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/cg_code.egg-info/top_level.txt +0 -0
- {cg_code-0.1.3 → cg_code-0.1.4}/setup.cfg +0 -0
cg_code-0.1.4/PKG-INFO
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cg-code
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: Unique work Python library
|
|
5
|
+
Author-email: Deepu Mondal <deepu143w@gmail.com>
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# `cg_code` - Multi-Subject Practical Code Library
|
|
15
|
+
|
|
16
|
+
`cg_code` ek Python library hai jisme alag-alag subjects ke practical questions, unke solutions aur numerical implementations organized tareeke se rakhe gaye hain. Is library ka main purpose students aur developers ko quick reference aur ready-to-use practical files provide karna hai.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📦 Installation
|
|
21
|
+
|
|
22
|
+
Is library ko install ya update karne ke liye apne terminal mein niche diya gaya command chalayein:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install --upgrade cg-code
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
*(Note: Package install `cg-code` naam se hota hai, lekin Python code mein import `cg_code` naam se kiya jata hai).*
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## ⚡ Sabse Aasan Tareeka: Sidha Apne Folder Mein File Copy Karein (`get_code`)
|
|
33
|
+
|
|
34
|
+
Ab aapko manually code copy-paste karne ki zaroorat nahi hai! Bas `cg_code.get_code()` function mein **subject** aur **practical number** pass karein, aur wo `.py` file automatically aapke current working folder mein aa jayegi:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import cg_code
|
|
38
|
+
|
|
39
|
+
# 1. Human-Computer Interaction (HCI) ka Practical 1 copy karne ke liye:
|
|
40
|
+
cg_code.get_code("hci", "p1")
|
|
41
|
+
|
|
42
|
+
# 2. Optimization Methods (OM) ka Unit 1 Practical 1 copy karne ke liye:
|
|
43
|
+
cg_code.get_code("om", "p1_1")
|
|
44
|
+
|
|
45
|
+
# 3. Optimization Methods ka Unit 2 Practical 2 copy karne ke liye:
|
|
46
|
+
cg_code.get_code("om", "p_2_2")
|
|
47
|
+
|
|
48
|
+
# 4. OM ke saare practicals (Numerical Solution + Code) ek hi file mein pane ke liye:
|
|
49
|
+
cg_code.get_code("om", "all")
|
|
50
|
+
|
|
51
|
+
# 5. Quantum Computing (QC) ka Practical 5 kisi naye naam se save karne ke liye:
|
|
52
|
+
cg_code.get_code("qc", "p5", save_as="quantum_q5.py")
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> **Tip:** Agar aap galat practical number daal dete hain, toh `get_code()` aapko us subject mein available saari files ki list screen par dikha dega.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 📚 Subjects & Naming Convention
|
|
60
|
+
|
|
61
|
+
Is library mein currently niche diye gaye subjects shamil hain:
|
|
62
|
+
|
|
63
|
+
1. **`om`** — Optimization Methods
|
|
64
|
+
2. **`qc`** — Quantum Computing
|
|
65
|
+
3. **`hci`** — Human-Computer Interaction
|
|
66
|
+
4. **`nlp`** — Natural Language Processing *(Coming Soon)*
|
|
67
|
+
|
|
68
|
+
### Naming Convention (Files ko kaise samjhein?)
|
|
69
|
+
* `p1` se `p10` = **Practical Question 1** se **Practical Question 10**
|
|
70
|
+
* `p1_1` ya `p_2_2` = **Unit 1 Practical 1**, **Unit 2 Practical 2** *(Pehla number Unit aur doosra number Practical darshata hai)*
|
|
71
|
+
* `all` = Us subject ke saare practicals ka complete collection
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 🛠️ Subject-Wise Detailed File Guide
|
|
76
|
+
|
|
77
|
+
### 1. Optimization Methods (`om`)
|
|
78
|
+
Is module mein Optimization Methods ke unit-wise practicals hain.
|
|
79
|
+
* **`om_all.py`** : Is file mein Optimization Methods ke saare practicals ka **Numerical Solution aur Python Code dono** ek saath diye gaye hain.
|
|
80
|
+
* **Unit 1:**
|
|
81
|
+
* `om_p1_1.py` : Unit 1 — Practical 1
|
|
82
|
+
* `om_p1_2.py` : Unit 1 — Practical 2
|
|
83
|
+
* `om_p1_3.py` : Unit 1 — Practical 3
|
|
84
|
+
* `om_p1_4.py` : Unit 1 — Practical 4
|
|
85
|
+
* **Unit 2:**
|
|
86
|
+
* `om_p2_1.py` : Unit 2 — Practical 1
|
|
87
|
+
* `om_p_2_2.py` : Unit 2 — Practical 2
|
|
88
|
+
* `om_p_2_3.py` : Unit 2 — Practical 3
|
|
89
|
+
* **Unit 3:**
|
|
90
|
+
* `om_p3_1.py` : Unit 3 — Practical 1
|
|
91
|
+
* `om_p_3_2.py` : Unit 3 — Practical 2
|
|
92
|
+
* `om_p_3_3.py` : Unit 3 — Practical 3
|
|
93
|
+
* `om_p3_4.py` : Unit 3 — Practical 4
|
|
94
|
+
* **Unit 4:**
|
|
95
|
+
* `om_p4_1.py` : Unit 4 — Practical 1
|
|
96
|
+
* `om_p_4_2.py` : Unit 4 — Practical 2
|
|
97
|
+
|
|
98
|
+
**Direct Import Example:**
|
|
99
|
+
```python
|
|
100
|
+
from cg_code.om import om_p1_1, om_all
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### 2. Quantum Computing (`qc`)
|
|
106
|
+
Is module mein Quantum Computing ke Practical 1 se Practical 10 tak ke solutions hain.
|
|
107
|
+
* `qc_p1.py` se `qc_p10.py` : Practical Question 1 se Practical Question 10 tak.
|
|
108
|
+
|
|
109
|
+
**Direct Import Example:**
|
|
110
|
+
```python
|
|
111
|
+
from cg_code.qc import qc_p1, qc_p5
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### 3. Human-Computer Interaction (`hci`)
|
|
117
|
+
Is module mein Human-Computer Interaction (HCI) ke Practical 1 se Practical 10 tak ke codes hain.
|
|
118
|
+
* `hci_p1.py` se `hci_p10.py` : Practical Question 1 se Practical Question 10 tak.
|
|
119
|
+
|
|
120
|
+
**Direct Import Example:**
|
|
121
|
+
```python
|
|
122
|
+
from cg_code.hci import hci_p1
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### 4. Natural Language Processing (`nlp`)
|
|
128
|
+
* Yeh module abhi empty hai aur aane wale versions mein ismein NLP ke practical codes add kiye jayenge.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 💡 Quick Tip: Bina File Copy Kiye Terminal Mein Code Dekhein
|
|
133
|
+
|
|
134
|
+
Agar aap file copy kiye bina sirf kisi practical ka code screen par print karke dekhna chahte hain, toh Python ke `inspect` module ka use karein:
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
import inspect
|
|
138
|
+
from cg_code.qc import qc_p1
|
|
139
|
+
|
|
140
|
+
print(inspect.getsource(qc_p1))
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 📄 License
|
|
146
|
+
Yeh project **MIT License** ke antargat licensed hai.
|
cg_code-0.1.4/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# `cg_code` - Multi-Subject Practical Code Library
|
|
2
|
+
|
|
3
|
+
`cg_code` ek Python library hai jisme alag-alag subjects ke practical questions, unke solutions aur numerical implementations organized tareeke se rakhe gaye hain. Is library ka main purpose students aur developers ko quick reference aur ready-to-use practical files provide karna hai.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 📦 Installation
|
|
8
|
+
|
|
9
|
+
Is library ko install ya update karne ke liye apne terminal mein niche diya gaya command chalayein:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install --upgrade cg-code
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
*(Note: Package install `cg-code` naam se hota hai, lekin Python code mein import `cg_code` naam se kiya jata hai).*
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## ⚡ Sabse Aasan Tareeka: Sidha Apne Folder Mein File Copy Karein (`get_code`)
|
|
20
|
+
|
|
21
|
+
Ab aapko manually code copy-paste karne ki zaroorat nahi hai! Bas `cg_code.get_code()` function mein **subject** aur **practical number** pass karein, aur wo `.py` file automatically aapke current working folder mein aa jayegi:
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
import cg_code
|
|
25
|
+
|
|
26
|
+
# 1. Human-Computer Interaction (HCI) ka Practical 1 copy karne ke liye:
|
|
27
|
+
cg_code.get_code("hci", "p1")
|
|
28
|
+
|
|
29
|
+
# 2. Optimization Methods (OM) ka Unit 1 Practical 1 copy karne ke liye:
|
|
30
|
+
cg_code.get_code("om", "p1_1")
|
|
31
|
+
|
|
32
|
+
# 3. Optimization Methods ka Unit 2 Practical 2 copy karne ke liye:
|
|
33
|
+
cg_code.get_code("om", "p_2_2")
|
|
34
|
+
|
|
35
|
+
# 4. OM ke saare practicals (Numerical Solution + Code) ek hi file mein pane ke liye:
|
|
36
|
+
cg_code.get_code("om", "all")
|
|
37
|
+
|
|
38
|
+
# 5. Quantum Computing (QC) ka Practical 5 kisi naye naam se save karne ke liye:
|
|
39
|
+
cg_code.get_code("qc", "p5", save_as="quantum_q5.py")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
> **Tip:** Agar aap galat practical number daal dete hain, toh `get_code()` aapko us subject mein available saari files ki list screen par dikha dega.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 📚 Subjects & Naming Convention
|
|
47
|
+
|
|
48
|
+
Is library mein currently niche diye gaye subjects shamil hain:
|
|
49
|
+
|
|
50
|
+
1. **`om`** — Optimization Methods
|
|
51
|
+
2. **`qc`** — Quantum Computing
|
|
52
|
+
3. **`hci`** — Human-Computer Interaction
|
|
53
|
+
4. **`nlp`** — Natural Language Processing *(Coming Soon)*
|
|
54
|
+
|
|
55
|
+
### Naming Convention (Files ko kaise samjhein?)
|
|
56
|
+
* `p1` se `p10` = **Practical Question 1** se **Practical Question 10**
|
|
57
|
+
* `p1_1` ya `p_2_2` = **Unit 1 Practical 1**, **Unit 2 Practical 2** *(Pehla number Unit aur doosra number Practical darshata hai)*
|
|
58
|
+
* `all` = Us subject ke saare practicals ka complete collection
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 🛠️ Subject-Wise Detailed File Guide
|
|
63
|
+
|
|
64
|
+
### 1. Optimization Methods (`om`)
|
|
65
|
+
Is module mein Optimization Methods ke unit-wise practicals hain.
|
|
66
|
+
* **`om_all.py`** : Is file mein Optimization Methods ke saare practicals ka **Numerical Solution aur Python Code dono** ek saath diye gaye hain.
|
|
67
|
+
* **Unit 1:**
|
|
68
|
+
* `om_p1_1.py` : Unit 1 — Practical 1
|
|
69
|
+
* `om_p1_2.py` : Unit 1 — Practical 2
|
|
70
|
+
* `om_p1_3.py` : Unit 1 — Practical 3
|
|
71
|
+
* `om_p1_4.py` : Unit 1 — Practical 4
|
|
72
|
+
* **Unit 2:**
|
|
73
|
+
* `om_p2_1.py` : Unit 2 — Practical 1
|
|
74
|
+
* `om_p_2_2.py` : Unit 2 — Practical 2
|
|
75
|
+
* `om_p_2_3.py` : Unit 2 — Practical 3
|
|
76
|
+
* **Unit 3:**
|
|
77
|
+
* `om_p3_1.py` : Unit 3 — Practical 1
|
|
78
|
+
* `om_p_3_2.py` : Unit 3 — Practical 2
|
|
79
|
+
* `om_p_3_3.py` : Unit 3 — Practical 3
|
|
80
|
+
* `om_p3_4.py` : Unit 3 — Practical 4
|
|
81
|
+
* **Unit 4:**
|
|
82
|
+
* `om_p4_1.py` : Unit 4 — Practical 1
|
|
83
|
+
* `om_p_4_2.py` : Unit 4 — Practical 2
|
|
84
|
+
|
|
85
|
+
**Direct Import Example:**
|
|
86
|
+
```python
|
|
87
|
+
from cg_code.om import om_p1_1, om_all
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### 2. Quantum Computing (`qc`)
|
|
93
|
+
Is module mein Quantum Computing ke Practical 1 se Practical 10 tak ke solutions hain.
|
|
94
|
+
* `qc_p1.py` se `qc_p10.py` : Practical Question 1 se Practical Question 10 tak.
|
|
95
|
+
|
|
96
|
+
**Direct Import Example:**
|
|
97
|
+
```python
|
|
98
|
+
from cg_code.qc import qc_p1, qc_p5
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### 3. Human-Computer Interaction (`hci`)
|
|
104
|
+
Is module mein Human-Computer Interaction (HCI) ke Practical 1 se Practical 10 tak ke codes hain.
|
|
105
|
+
* `hci_p1.py` se `hci_p10.py` : Practical Question 1 se Practical Question 10 tak.
|
|
106
|
+
|
|
107
|
+
**Direct Import Example:**
|
|
108
|
+
```python
|
|
109
|
+
from cg_code.hci import hci_p1
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 4. Natural Language Processing (`nlp`)
|
|
115
|
+
* Yeh module abhi empty hai aur aane wale versions mein ismein NLP ke practical codes add kiye jayenge.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 💡 Quick Tip: Bina File Copy Kiye Terminal Mein Code Dekhein
|
|
120
|
+
|
|
121
|
+
Agar aap file copy kiye bina sirf kisi practical ka code screen par print karke dekhna chahte hain, toh Python ke `inspect` module ka use karein:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
import inspect
|
|
125
|
+
from cg_code.qc import qc_p1
|
|
126
|
+
|
|
127
|
+
print(inspect.getsource(qc_p1))
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 📄 License
|
|
133
|
+
Yeh project **MIT License** ke antargat licensed hai.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
__version__ = "0.1.2"
|
|
6
|
+
|
|
7
|
+
def get_code(subject: str, question: str, save_as: str = None):
|
|
8
|
+
"""
|
|
9
|
+
Package ke andar se practical file ko current working directory mein copy karta hai.
|
|
10
|
+
|
|
11
|
+
Parameters:
|
|
12
|
+
- subject: 'hci', 'om', 'qc', ya 'nlp'
|
|
13
|
+
- question: Practical number ya file name (jaise 'p1', 'p1_1', 'p_2_2', 'all', ya poora naam 'hci_p1.py')
|
|
14
|
+
- save_as: (Optional) Agar current folder mein kisi doosre naam se save karna ho
|
|
15
|
+
"""
|
|
16
|
+
# Package ka base directory path nikalna
|
|
17
|
+
base_dir = Path(__file__).parent
|
|
18
|
+
subject = subject.strip().lower()
|
|
19
|
+
question = question.strip().lower()
|
|
20
|
+
|
|
21
|
+
# Subject folder check karna
|
|
22
|
+
subject_dir = base_dir / subject
|
|
23
|
+
if not subject_dir.exists() or not subject_dir.is_dir():
|
|
24
|
+
available_subjects = [d.name for d in base_dir.iterdir() if d.is_dir() and not d.name.startswith("__")]
|
|
25
|
+
print(f"Error: Subject '{subject}' nahi mila. Available subjects: {available_subjects}")
|
|
26
|
+
return
|
|
27
|
+
|
|
28
|
+
# Agar user ne '.py' nahi lagaya hai toh handle karna aur smart match dhundhna
|
|
29
|
+
clean_q = question.replace(".py", "")
|
|
30
|
+
|
|
31
|
+
# Possible file name patterns (jaise 'p1' -> 'hci_p1.py', '1_1' -> 'om_p1_1.py', etc.)
|
|
32
|
+
possible_names = [
|
|
33
|
+
f"{clean_q}.py",
|
|
34
|
+
f"{subject}_{clean_q}.py",
|
|
35
|
+
f"{subject}_p{clean_q}.py",
|
|
36
|
+
f"{subject}_p_{clean_q}.py",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
target_file = None
|
|
40
|
+
for name in possible_names:
|
|
41
|
+
candidate = subject_dir / name
|
|
42
|
+
if candidate.exists():
|
|
43
|
+
target_file = candidate
|
|
44
|
+
break
|
|
45
|
+
|
|
46
|
+
# Agar exact match na mile toh available files ki list dikhana
|
|
47
|
+
if not target_file:
|
|
48
|
+
available_files = [f.name for f in subject_dir.glob("*.py") if f.name != "__init__.py"]
|
|
49
|
+
print(f"Error: '{subject}' mein '{question}' nahi mila.")
|
|
50
|
+
print(f"Available files in '{subject}': {available_files}")
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
# Current working directory mein copy karna
|
|
54
|
+
dest_name = save_as if save_as else target_file.name
|
|
55
|
+
if not dest_name.endswith(".py"):
|
|
56
|
+
dest_name += ".py"
|
|
57
|
+
|
|
58
|
+
dest_path = Path.cwd() / dest_name
|
|
59
|
+
shutil.copy2(target_file, dest_path)
|
|
60
|
+
print(f"Success! '{target_file.name}' aapke current folder mein copy ho gayi hai -> {dest_path}")
|