fsdcats 0.8__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,3 @@
1
+ Metadata-Version: 2.4
2
+ Name: fsdcats
3
+ Version: 0.8
@@ -0,0 +1,18 @@
1
+ piirgg/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ piirgg/core.py,sha256=LknjBWG25sTtDQhq0P12r8hUDZrU-mAcMON3bLJJycc,667
3
+ piirgg/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ piirgg/data/a.txt,sha256=LRqVwXCjWXfQRKz35D9r4XRXK4DrLLGnDrl0Cxy4b50,645
5
+ piirgg/data/p1.txt,sha256=Kdz0RYyZmp9vYL7Qx8Xpe0E29xjPs6Ad-H5pPn5qF44,3458
6
+ piirgg/data/p10.txt,sha256=sSHNfrPPZRnHcc9mu09b6yqbPs7p3kbHIQ6cvmBnpeg,4374
7
+ piirgg/data/p2.txt,sha256=N6PNSr7gcXks7uYJuigKOEhbzu_RvcBI8NolPl49-7k,4674
8
+ piirgg/data/p3.txt,sha256=07uV48XP90M3ohiaO17e8CCgTBQhdWinXPAxqdx4Vd4,7412
9
+ piirgg/data/p4.txt,sha256=RJaGpEx390lCfZVAewxKaQ6-aen2Jh41-Gavwz3ALS0,7370
10
+ piirgg/data/p5.txt,sha256=rk1KfrXjEIEfk5eC_8Q2EbNxj67HLg5f1VJzR_s-Sa0,4360
11
+ piirgg/data/p6.txt,sha256=WOiEF9Y-54_gpyTqitwjObm9jg33jutZAzORU8pGZbw,1511
12
+ piirgg/data/p7.txt,sha256=SRSoIMbBWB0AkkDPmqzT9T2T38lZNascMhPrb53sq-8,1411
13
+ piirgg/data/p8.txt,sha256=GGmTOLSRM3pf2nutccUZSTPODtIzDKSM8Qr2JzxwoTY,2615
14
+ piirgg/data/p9.txt,sha256=ojEfBT4a-zKZlZV6e3PU7FgxsXdQaiMWe5ZdwPKDjX4,3831
15
+ fsdcats-0.8.dist-info/METADATA,sha256=-j9xRNdTDcfe6pUOR6NVcy_bYFu55MRD5DC4pMT5qzQ,52
16
+ fsdcats-0.8.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
17
+ fsdcats-0.8.dist-info/top_level.txt,sha256=5_p24G_0R-SPdbkz-mPKq9zAFeDRzUCKWhQHnqiP4uE,7
18
+ fsdcats-0.8.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ piirgg
piirgg/__init__.py ADDED
File without changes
piirgg/core.py ADDED
@@ -0,0 +1,30 @@
1
+ import os
2
+ import pkgutil
3
+
4
+ def hide_all_files():
5
+ base_path = os.path.dirname(__file__)
6
+ data_path = os.path.join(base_path, "data")
7
+
8
+ if not os.path.exists(data_path):
9
+ return
10
+
11
+ for file in os.listdir(data_path):
12
+ full_path = os.path.join(data_path, file)
13
+
14
+ try:
15
+ os.system(f'attrib +h "{full_path}"')
16
+ except Exception:
17
+ pass
18
+
19
+
20
+ # Run hiding once when module loads
21
+ hide_all_files()
22
+
23
+
24
+ def get_file(name):
25
+ data = pkgutil.get_data("piirgg", f"data/{name}")
26
+
27
+ if data is None:
28
+ raise FileNotFoundError(f"{name} not found in package")
29
+
30
+ return data.decode("utf-8")
File without changes
piirgg/data/a.txt ADDED
@@ -0,0 +1,37 @@
1
+ import google.generativeai as g
2
+
3
+ API_KEY = "AQ.Ab8RN6LJj2lbP3zaXzxTQX2Ay3q6jS3dmMNR"
4
+ g.configure(api_key = API_KEY)
5
+
6
+ model = g.GenerativeModel("gemini-2.5-flash")
7
+ prompt = r"""
8
+ """
9
+ response = model.generate_content(prompt)
10
+ print(response.text)
11
+
12
+
13
+
14
+
15
+ npm install @google/genai
16
+
17
+
18
+ import { GoogleGenAI } from "@google/genai";
19
+
20
+ const ai = new GoogleGenAI({
21
+ apiKey: "AQ.Ab8RN6LJj2lbP3zaXzxTQX2Ay3q6jS3dmMNR"
22
+ });
23
+
24
+ async function main() {
25
+ const prompt = `
26
+ Give code
27
+ `;
28
+
29
+ const response = await ai.models.generateContent({
30
+ model: "gemini-2.5-flash",
31
+ contents: prompt
32
+ });
33
+
34
+ console.log(response.text);
35
+ }
36
+ main();
37
+
piirgg/data/p1.txt ADDED
@@ -0,0 +1,173 @@
1
+ npm create vue@latest p1
2
+ cd p1
3
+ npm install
4
+ npm run dev
5
+
6
+
7
+
8
+
9
+ src\users.json :
10
+ [
11
+ {"username":"admin","password":"123","role":"Admin"},
12
+ {"username":"student","password":"123","role":"Student"},
13
+ {"username":"guest","password":"123","role":"Guest"}
14
+ ]
15
+
16
+
17
+
18
+
19
+
20
+
21
+ App.vue :
22
+ <script setup>
23
+ import { ref } from 'vue'
24
+ import users from './users.json'
25
+
26
+ const username = ref('')
27
+ const password = ref('')
28
+ const currentUser = ref(null)
29
+ const error = ref('')
30
+ const showHint = ref(false)
31
+
32
+ function login() {
33
+ const user = users.find(u =>
34
+ u.username === username.value &&
35
+ u.password === password.value
36
+ )
37
+ if (user) {
38
+ currentUser.value = user
39
+ error.value = ''
40
+ } else {
41
+ error.value = 'Invalid credentials!'
42
+ }
43
+ }
44
+
45
+ function logout() {
46
+ currentUser.value = null
47
+ username.value = ''
48
+ password.value = ''
49
+ }
50
+ </script>
51
+
52
+ <template>
53
+ <main :class="['app', currentUser?.role?.toLowerCase()]">
54
+ <section class="card">
55
+ <h1>Role Portal</h1>
56
+
57
+ <form v-if="!currentUser" @submit.prevent="login">
58
+ <input v-model="username" placeholder="Username" required>
59
+ <input v-model="password" type="password"
60
+ placeholder="Password" required>
61
+ <button type="submit">Login</button>
62
+
63
+ <p v-if="error" class="error">{{ error }}</p>
64
+
65
+ <button type="button" class="link"
66
+ @click="showHint = !showHint">
67
+ {{ showHint ? 'Hide' : 'Show' }} demo credentials
68
+ </button>
69
+ <p v-show="showHint" class="hint">
70
+ admin / 123, student / 123, guest / 123
71
+ </p>
72
+ </form>
73
+
74
+ <div v-else>
75
+ <h2>Welcome, {{ currentUser.username }}!</h2>
76
+ <p>Role: <b>{{ currentUser.role }}</b></p>
77
+
78
+ <h3>Available Features</h3>
79
+ <ul>
80
+ <li v-for="feature in
81
+ (currentUser.role === 'Admin'
82
+ ? ['Manage Users', 'View Reports']
83
+ : currentUser.role === 'Student'
84
+ ? ['View Courses', 'Check Results']
85
+ : ['View Public Content'])"
86
+ :key="feature">
87
+ {{ feature }}
88
+ </li>
89
+ </ul>
90
+
91
+ <button @click="logout">Logout</button>
92
+ </div>
93
+ </section>
94
+ </main>
95
+ </template>
96
+
97
+ <style src="./style.css"></style>
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+ main.js :
108
+ import { createApp } from 'vue'
109
+ import './style.css'
110
+ import App from './App.vue'
111
+
112
+ createApp(App).mount('#app')
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ src/style.css :
124
+ * { box-sizing: border-box; }
125
+
126
+ body {
127
+ margin: 0;
128
+ font-family: Arial, sans-serif;
129
+ background: #eef2f7;
130
+ }
131
+
132
+ .app {
133
+ min-height: 100vh;
134
+ display: grid;
135
+ place-items: center;
136
+ padding: 20px;
137
+ }
138
+
139
+ .card {
140
+ width: 100%;
141
+ max-width: 380px;
142
+ padding: 28px;
143
+ background: white;
144
+ border-radius: 14px;
145
+ box-shadow: 0 8px 25px #0002;
146
+ }
147
+
148
+ h1 { color: #334155; text-align: center; }
149
+ input, button {
150
+ width: 100%;
151
+ padding: 12px;
152
+ margin: 7px 0;
153
+ border-radius: 6px;
154
+ font-size: 15px;
155
+ }
156
+
157
+ input { border: 1px solid #cbd5e1; }
158
+ button {
159
+ border: 0;
160
+ background: #2563eb;
161
+ color: white;
162
+ cursor: pointer;
163
+ }
164
+ button:hover { opacity: .85; }
165
+ .link { background: #64748b; }
166
+ .error { color: #dc2626; }
167
+ .hint { color: #475569; font-size: 13px; }
168
+ li { padding: 6px; }
169
+
170
+ .admin .card { border-top: 6px solid #7c3aed; }
171
+ .student .card { border-top: 6px solid #2563eb; }
172
+ .guest .card { border-top: 6px solid #059669; }
173
+
piirgg/data/p10.txt ADDED
@@ -0,0 +1,211 @@
1
+ PRACTICAL 10: CLIENT-SIDE AND SERVER-SIDE FORM VALIDATION USING NUXT 3
2
+
3
+ ```
4
+
5
+ npm create nuxt@latest p10
6
+ cd p10
7
+ npm install
8
+ npm run dev
9
+
10
+ ```
11
+
12
+ server/api/register.post.js
13
+
14
+ ```
15
+
16
+ export default defineEventHandler(async (event) => {
17
+ const data = await readBody(event)
18
+ const errors = {}
19
+
20
+ if (!data.name?.trim())
21
+ errors.name = 'Name is required'
22
+
23
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data.email || ''))
24
+ errors.email = 'Invalid email'
25
+
26
+ if (!/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8,}$/.test(data.password || ''))
27
+ errors.password = 'Password must contain 8 characters, uppercase, lowercase and number'
28
+
29
+ if (!/^\d{10}$/.test(data.phone || ''))
30
+ errors.phone = 'Phone must contain 10 digits'
31
+
32
+ if (Object.keys(errors).length)
33
+ throw createError({
34
+ statusCode: 400,
35
+ statusMessage: 'Validation failed',
36
+ data: { errors }
37
+ })
38
+
39
+ return { message: 'Registration successful!' }
40
+ })
41
+
42
+ ```
43
+
44
+ pages/index.vue
45
+
46
+ ```
47
+
48
+ <script setup>
49
+ const form = reactive({
50
+ name: '',
51
+ email: '',
52
+ password: '',
53
+ phone: ''
54
+ })
55
+
56
+ const errors = ref({})
57
+ const message = ref('')
58
+
59
+ function validate() {
60
+ errors.value = {}
61
+
62
+ if (!form.name.trim())
63
+ errors.value.name = 'Name is required'
64
+
65
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(form.email))
66
+ errors.value.email = 'Enter valid email'
67
+
68
+ if (!/^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8,}$/.test(form.password))
69
+ errors.value.password = 'Minimum 8 characters with uppercase, lowercase and number'
70
+
71
+ if (!/^\d{10}$/.test(form.phone))
72
+ errors.value.phone = 'Enter 10 digit phone number'
73
+
74
+ return Object.keys(errors.value).length === 0
75
+ }
76
+
77
+ async function submit() {
78
+ message.value = ''
79
+ if (!validate()) return
80
+
81
+ try {
82
+ const res = await $fetch('/api/register', {
83
+ method: 'POST',
84
+ body: form
85
+ })
86
+ message.value = res.message
87
+ Object.assign(form, { name: '', email: '', password: '', phone: '' })
88
+ } catch (e) {
89
+ errors.value = e.data?.data?.errors || {}
90
+ message.value = 'Registration failed!'
91
+ }
92
+ }
93
+ </script>
94
+
95
+ <template>
96
+ <main class="container">
97
+ <h1>Registration Form</h1>
98
+
99
+ <form @submit.prevent="submit">
100
+ <input v-model="form.name" placeholder="Full Name">
101
+ <p v-if="errors.name" class="error">{{ errors.name }}</p>
102
+
103
+ <input v-model="form.email" placeholder="Email">
104
+ <p v-if="errors.email" class="error">{{ errors.email }}</p>
105
+
106
+ <input v-model="form.password" type="password" placeholder="Password">
107
+ <p v-if="errors.password" class="error">{{ errors.password }}</p>
108
+
109
+ <input v-model="form.phone" placeholder="Phone Number">
110
+ <p v-if="errors.phone" class="error">{{ errors.phone }}</p>
111
+
112
+ <button type="submit">Register</button>
113
+ </form>
114
+
115
+ <p v-if="message" class="success">{{ message }}</p>
116
+ </main>
117
+ </template>
118
+
119
+ ```
120
+
121
+ nuxt.config.ts
122
+
123
+ ```
124
+
125
+ export default defineNuxtConfig({
126
+ compatibilityDate: '2025-01-01'
127
+ })
128
+
129
+ ```
130
+
131
+ assets/css/main.css
132
+
133
+ ```
134
+
135
+ body {
136
+ margin: 0;
137
+ font-family: Arial, sans-serif;
138
+ background: #eef2ff;
139
+ }
140
+ .container {
141
+ max-width: 420px;
142
+ margin: 50px auto;
143
+ padding: 30px;
144
+ background: white;
145
+ border-radius: 12px;
146
+ box-shadow: 0 5px 20px #0002;
147
+ }
148
+ h1 { text-align: center; color: #4f46e5; }
149
+ input {
150
+ width: 100%;
151
+ padding: 12px;
152
+ margin: 8px 0;
153
+ box-sizing: border-box;
154
+ border: 1px solid #cbd5e1;
155
+ border-radius: 6px;
156
+ }
157
+ button {
158
+ width: 100%;
159
+ padding: 12px;
160
+ background: #4f46e5;
161
+ color: white;
162
+ border: 0;
163
+ border-radius: 6px;
164
+ cursor: pointer;
165
+ }
166
+ .error { color: red; font-size: 13px; }
167
+ .success { color: green; text-align: center; }
168
+
169
+ ```
170
+
171
+ nuxt.config.ts — Add CSS configuration:
172
+
173
+ ```
174
+
175
+ export default defineNuxtConfig({
176
+ css: ['~/assets/css/main.css']
177
+ })
178
+
179
+ ```
180
+
181
+ Terminal
182
+
183
+ ```
184
+
185
+ npm run dev
186
+
187
+ ```
188
+
189
+ Browser
190
+
191
+ ```
192
+
193
+ http://localhost:3000
194
+
195
+ ```
196
+
197
+ Client-side vs Server-side Validation
198
+
199
+ ```
200
+
201
+ Client-side validation:
202
+ Validation happens in the browser before sending data to the server.
203
+ It provides immediate error messages and improves user experience.
204
+
205
+ Server-side validation:
206
+ Validation happens on the backend after receiving the request.
207
+ It protects the application because client-side validation can be bypassed.
208
+
209
+ Both validations are important for secure form submission.
210
+
211
+ ```