mycc 0.1.0__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.
- mycc-0.1.0/PKG-INFO +8 -0
- mycc-0.1.0/mycc/__init__.py +12 -0
- mycc-0.1.0/mycc/allprograms.py +228 -0
- mycc-0.1.0/mycc.egg-info/PKG-INFO +8 -0
- mycc-0.1.0/mycc.egg-info/SOURCES.txt +8 -0
- mycc-0.1.0/mycc.egg-info/dependency_links.txt +1 -0
- mycc-0.1.0/mycc.egg-info/requires.txt +3 -0
- mycc-0.1.0/mycc.egg-info/top_level.txt +2 -0
- mycc-0.1.0/pyproject.toml +15 -0
- mycc-0.1.0/setup.cfg +4 -0
mycc-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
def _write(filename, content):
|
|
4
|
+
with open(filename, "w") as f:
|
|
5
|
+
f.write(content)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def ex1A():
|
|
9
|
+
_write("ex1A.txt", "No code is available for this program")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def ex1B():
|
|
13
|
+
_write("ex1B.txt", "No code is available for this program")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def ex2():
|
|
17
|
+
code = """from flask import Flask, request, jsonify
|
|
18
|
+
|
|
19
|
+
app = Flask(__name__)
|
|
20
|
+
|
|
21
|
+
@app.route("/")
|
|
22
|
+
def generate_evens():
|
|
23
|
+
try:
|
|
24
|
+
n = int(request.args.get("n", 10))
|
|
25
|
+
if n < 1:
|
|
26
|
+
return jsonify({"error": "n must be >= 1"}), 400
|
|
27
|
+
|
|
28
|
+
even_numbers = [2*i for i in range(1, n + 1)]
|
|
29
|
+
|
|
30
|
+
return jsonify({
|
|
31
|
+
"count": n,
|
|
32
|
+
"even_numbers": even_numbers
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
except ValueError:
|
|
36
|
+
return jsonify({"error": "Invalid input. Provide an integer n."}), 400
|
|
37
|
+
|
|
38
|
+
if __name__ == "__main__":
|
|
39
|
+
app.run(host="0.0.0.0", port=8080)
|
|
40
|
+
"""
|
|
41
|
+
_write("ex2.py", code)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def ex3():
|
|
45
|
+
code = """from flask import Flask, jsonify
|
|
46
|
+
|
|
47
|
+
app = Flask(__name__)
|
|
48
|
+
|
|
49
|
+
@app.route("/")
|
|
50
|
+
def multiply():
|
|
51
|
+
A = [[1,2],[3,4]]
|
|
52
|
+
B = [[5,6],[7,8]]
|
|
53
|
+
R = [[sum(A[i][k]*B[k][j] for k in range(2)) for j in range(2)] for i in range(2)]
|
|
54
|
+
return jsonify({"A":A,"B":B,"Result":R})
|
|
55
|
+
|
|
56
|
+
app.run(port=8080)
|
|
57
|
+
"""
|
|
58
|
+
_write("ex3.py", code)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def ex4():
|
|
62
|
+
code = """from flask import Flask, request, jsonify, render_template_string
|
|
63
|
+
import cx_Oracle
|
|
64
|
+
|
|
65
|
+
app = Flask(__name__)
|
|
66
|
+
|
|
67
|
+
def get_connection():
|
|
68
|
+
return cx_Oracle.connect(
|
|
69
|
+
user="test58",
|
|
70
|
+
password="test58",
|
|
71
|
+
dsn="PSGCASLABS.labs-psgcas.com:1521/itora"
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
HTML_PAGE = "FULL HTML CODE HERE"
|
|
75
|
+
|
|
76
|
+
@app.route("/")
|
|
77
|
+
def home():
|
|
78
|
+
return render_template_string(HTML_PAGE)
|
|
79
|
+
|
|
80
|
+
@app.route("/login", methods=["POST"])
|
|
81
|
+
def login():
|
|
82
|
+
username = request.form["username"].strip()
|
|
83
|
+
password = request.form["password"].strip()
|
|
84
|
+
|
|
85
|
+
conn = get_connection()
|
|
86
|
+
cursor = conn.cursor()
|
|
87
|
+
|
|
88
|
+
cursor.execute(\"\"\"
|
|
89
|
+
SELECT * FROM usersmss
|
|
90
|
+
WHERE TRIM(UPPER(id)) = :id_val AND TRIM(password) = :pwd_val
|
|
91
|
+
\"\"\", {"id_val": username.upper(), "pwd_val": password})
|
|
92
|
+
|
|
93
|
+
user = cursor.fetchone()
|
|
94
|
+
|
|
95
|
+
cursor.close()
|
|
96
|
+
conn.close()
|
|
97
|
+
|
|
98
|
+
return jsonify({"status": "success" if user else "fail"})
|
|
99
|
+
|
|
100
|
+
@app.route("/signup", methods=["POST"])
|
|
101
|
+
def signup():
|
|
102
|
+
username = request.form["username"].strip()
|
|
103
|
+
password = request.form["password"].strip()
|
|
104
|
+
|
|
105
|
+
conn = get_connection()
|
|
106
|
+
cursor = conn.cursor()
|
|
107
|
+
|
|
108
|
+
cursor.execute(\"\"\"
|
|
109
|
+
SELECT COUNT(*) FROM usersmss
|
|
110
|
+
WHERE TRIM(UPPER(id)) = :id_val
|
|
111
|
+
\"\"\", {"id_val": username.upper()})
|
|
112
|
+
|
|
113
|
+
if cursor.fetchone()[0] > 0:
|
|
114
|
+
cursor.close()
|
|
115
|
+
conn.close()
|
|
116
|
+
return jsonify({"status": "fail"})
|
|
117
|
+
|
|
118
|
+
cursor.execute(\"\"\"
|
|
119
|
+
INSERT INTO usersmss (id, password)
|
|
120
|
+
VALUES (:id_val, :pwd_val)
|
|
121
|
+
\"\"\", {"id_val": username, "pwd_val": password})
|
|
122
|
+
|
|
123
|
+
conn.commit()
|
|
124
|
+
cursor.close()
|
|
125
|
+
conn.close()
|
|
126
|
+
|
|
127
|
+
return jsonify({"status": "success"})
|
|
128
|
+
|
|
129
|
+
if __name__ == "__main__":
|
|
130
|
+
app.run(debug=True)
|
|
131
|
+
"""
|
|
132
|
+
_write("ex4.py", code)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def ex5():
|
|
136
|
+
code = """import cx_Oracle
|
|
137
|
+
|
|
138
|
+
DB_USER = "test58"
|
|
139
|
+
DB_PASSWORD = "test58"
|
|
140
|
+
DB_DSN = "PSGCASLABS.labs-psgcas.com:1521/itora"
|
|
141
|
+
|
|
142
|
+
try:
|
|
143
|
+
conn = cx_Oracle.connect(user=DB_USER, password=DB_PASSWORD, dsn=DB_DSN)
|
|
144
|
+
cursor = conn.cursor()
|
|
145
|
+
print("Connection successful!\\n")
|
|
146
|
+
except cx_Oracle.DatabaseError as e:
|
|
147
|
+
print("Database connection failed:", e)
|
|
148
|
+
exit()
|
|
149
|
+
|
|
150
|
+
try:
|
|
151
|
+
cursor.execute("SELECT id, password FROM usersmss")
|
|
152
|
+
rows = cursor.fetchall()
|
|
153
|
+
|
|
154
|
+
if rows:
|
|
155
|
+
print("All records in usersmss table:")
|
|
156
|
+
print("-" * 30)
|
|
157
|
+
|
|
158
|
+
for row in rows:
|
|
159
|
+
print(f"ID: '{row[0]}', PASSWORD: '{row[1]}'")
|
|
160
|
+
|
|
161
|
+
print("-" * 30)
|
|
162
|
+
print(f"Total rows: {len(rows)}")
|
|
163
|
+
else:
|
|
164
|
+
print("usersmss table is empty!")
|
|
165
|
+
|
|
166
|
+
except cx_Oracle.DatabaseError as e:
|
|
167
|
+
print("Query failed:", e)
|
|
168
|
+
|
|
169
|
+
finally:
|
|
170
|
+
cursor.close()
|
|
171
|
+
conn.close()
|
|
172
|
+
"""
|
|
173
|
+
_write("ex5.py", code)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def ex6():
|
|
177
|
+
code = """from flask import Flask
|
|
178
|
+
|
|
179
|
+
app = Flask(__name__)
|
|
180
|
+
|
|
181
|
+
@app.route("/")
|
|
182
|
+
def nth_largest():
|
|
183
|
+
nums = [10, 45, 23, 67, 12, 89, 34]
|
|
184
|
+
n = 3
|
|
185
|
+
nums.sort(reverse=True)
|
|
186
|
+
result = nums[n-1]
|
|
187
|
+
return f"Numbers: {nums}<br>{n}rd Largest Number: {result}"
|
|
188
|
+
|
|
189
|
+
if __name__ == "__main__":
|
|
190
|
+
app.run(port=8080)
|
|
191
|
+
"""
|
|
192
|
+
_write("ex6.py", code)
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def ex7():
|
|
196
|
+
_write("ex7.txt", """git init
|
|
197
|
+
git status
|
|
198
|
+
git add .
|
|
199
|
+
git commit -m "Initial commit"
|
|
200
|
+
git remote add origin <URL>
|
|
201
|
+
git push -u origin main
|
|
202
|
+
git pull
|
|
203
|
+
git checkout -b <branch_name>
|
|
204
|
+
git checkout <branch_name>
|
|
205
|
+
git merge <branch_name>
|
|
206
|
+
""")
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def ex8():
|
|
210
|
+
_write("ex8.txt", "Install Git and verify using git --version")
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def ex9():
|
|
214
|
+
_write("ex9.txt", """chef generate repo chef-repo
|
|
215
|
+
cd chef-repo
|
|
216
|
+
knife configure
|
|
217
|
+
knife ssl fetch
|
|
218
|
+
knife ssl check
|
|
219
|
+
knife client list
|
|
220
|
+
knife node list
|
|
221
|
+
knife status
|
|
222
|
+
knife cookbook list
|
|
223
|
+
knife role list
|
|
224
|
+
""")
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def ex10():
|
|
228
|
+
_write("ex10.txt", "GCP Organisation setup - No code")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mycc"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "bb"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "bb" }
|
|
11
|
+
]
|
|
12
|
+
dependencies = ["flask","cx_Oracle","oracledb"]
|
|
13
|
+
|
|
14
|
+
[tool.setuptools.packages.find]
|
|
15
|
+
where = ["."]
|
mycc-0.1.0/setup.cfg
ADDED