Qwael 0.0.1__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.
Qwael/Prihops.py ADDED
@@ -0,0 +1,376 @@
1
+ import tkinter as tk
2
+ from google.oauth2 import service_account
3
+ from googleapiclient.discovery import build
4
+ from googleapiclient.http import MediaIoBaseDownload, MediaFileUpload, MediaIoBaseUpload
5
+ from PIL import Image, ImageTk
6
+ import io
7
+
8
+ class DRİVE():
9
+
10
+ def info():
11
+ infoc = "Prihops: 0.1"
12
+ print(infoc)
13
+
14
+
15
+ def Control(ID, ge, dax=None, fop=None, es=None, os=None, girp=None, girpx=None, girp_header=None, girpx_header=None, dex_ID=None):
16
+ import io
17
+ from google.oauth2 import service_account
18
+ from googleapiclient.discovery import build
19
+ from googleapiclient.http import MediaIoBaseDownload
20
+
21
+ creds = service_account.Credentials.from_service_account_info(es)
22
+ service = build('drive', 'v3', credentials=creds)
23
+
24
+ query = f"'{os}' in parents and name='{ID}'"
25
+ results = service.files().list(q=query, fields="files(id)").execute()
26
+ files = results.get('files', [])
27
+
28
+ if not files:
29
+ print(f"{ID} dosyası bulunamadı.")
30
+ if isinstance(fop, list):
31
+ fop.append(False)
32
+ return
33
+
34
+ file_id = files[0]['id']
35
+ request = service.files().get_media(fileId=file_id)
36
+ file_io = io.BytesIO()
37
+ downloader = MediaIoBaseDownload(file_io, request)
38
+ done = False
39
+ while not done:
40
+ _, done = downloader.next_chunk()
41
+
42
+ content = file_io.getvalue().decode('utf-8')
43
+ lines = content.strip().split('\n')
44
+
45
+
46
+ real_ge = ge
47
+ if girpx and not real_ge.startswith(girpx):
48
+ real_ge = girpx + real_ge
49
+ if girp and not real_ge.endswith(girp):
50
+ real_ge = real_ge + girp
51
+ if dex_ID:
52
+ real_ge = f"{dex_ID}; {real_ge}"
53
+
54
+
55
+ real_dax = dax
56
+ if girpx_header and real_dax and not real_dax.startswith(girpx_header):
57
+ real_dax = girpx_header + real_dax
58
+ if girp_header and real_dax and not real_dax.endswith(girp_header):
59
+ real_dax = real_dax + girp_header
60
+
61
+ current_header = None
62
+ in_target_header = False
63
+
64
+ for line in lines:
65
+ stripped = line.strip()
66
+ if stripped.endswith(':'):
67
+ current_header = stripped[:-1]
68
+ in_target_header = (current_header == real_dax) if real_dax else True
69
+ elif in_target_header:
70
+ if stripped == real_ge:
71
+ print(f"Veri '{real_ge}' başlık '{current_header}' içinde bulundu.")
72
+ if isinstance(fop, list):
73
+ fop.append(True)
74
+ return
75
+
76
+ if dax:
77
+ print(f"Veri '{real_ge}' başlık '{real_dax}' içinde bulunamadı.")
78
+ else:
79
+ print(f"Veri '{real_ge}' hiçbir başlık altında bulunamadı.")
80
+ if isinstance(fop, list):
81
+ fop.append(False)
82
+
83
+ def delete(ID, delete_header=None, dex_ID=None, fop=None, es=None, os=None):
84
+ import io
85
+ from google.oauth2 import service_account
86
+ from googleapiclient.discovery import build
87
+ from googleapiclient.http import MediaIoBaseDownload, MediaIoBaseUpload
88
+
89
+ creds = service_account.Credentials.from_service_account_info(es)
90
+ service = build('drive', 'v3', credentials=creds)
91
+
92
+ query = f"'{os}' in parents and name='{ID}'"
93
+ results = service.files().list(q=query, fields="files(id)").execute()
94
+ files = results.get('files', [])
95
+
96
+ if not files:
97
+ print(f"{ID} dosyası bulunamadı.")
98
+ if isinstance(fop, list):
99
+ fop.append(False)
100
+ return
101
+
102
+ file_id = files[0]['id']
103
+
104
+ request = service.files().get_media(fileId=file_id)
105
+ file_io = io.BytesIO()
106
+ downloader = MediaIoBaseDownload(file_io, request)
107
+ done = False
108
+ while not done:
109
+ _, done = downloader.next_chunk()
110
+ content = file_io.getvalue().decode('utf-8')
111
+
112
+ lines = content.strip().split('\n')
113
+ new_lines = []
114
+ skip = False
115
+ found = False
116
+
117
+ if delete_header:
118
+
119
+ for line in lines:
120
+ if line.strip().endswith(':'):
121
+ if line.strip()[:-1] == delete_header:
122
+ skip = True
123
+ found = True
124
+ continue
125
+ else:
126
+ skip = False
127
+ if not skip:
128
+ new_lines.append(line)
129
+
130
+ if not found:
131
+ print(f"'{delete_header}' başlığı bulunamadı.")
132
+ if isinstance(fop, list):
133
+ fop.append(False)
134
+ return
135
+ else:
136
+ print(f"'{delete_header}' başlığı ve altındaki veriler silindi.")
137
+
138
+ elif dex_ID:
139
+
140
+ target_header = dex_ID[0]
141
+ target_data = dex_ID[1]
142
+ in_target_header = False
143
+ header_found = False
144
+ data_found = False
145
+
146
+ for i, line in enumerate(lines):
147
+ stripped = line.strip()
148
+ if stripped.endswith(':'):
149
+ if stripped[:-1] == target_header:
150
+ in_target_header = True
151
+ header_found = True
152
+ new_lines.append(line)
153
+ continue
154
+ else:
155
+ in_target_header = False
156
+
157
+ if in_target_header:
158
+ if stripped.startswith(f"{target_data};"):
159
+ data_found = True
160
+ continue
161
+ else:
162
+ new_lines.append(line)
163
+ else:
164
+ new_lines.append(line)
165
+
166
+ if not header_found:
167
+ print(f"'{target_header}' başlığı bulunamadı.")
168
+ if isinstance(fop, list):
169
+ fop.append(False)
170
+ return
171
+ if not data_found:
172
+ print(f"'{target_data}' verisi bulunamadı.")
173
+ if isinstance(fop, list):
174
+ fop.append(False)
175
+ return
176
+ else:
177
+ print(f"'{target_header}' başlığı altındaki '{target_data}' verisi silindi.")
178
+
179
+ else:
180
+ print("Hiçbir işlem yapılmadı. 'delete_header' veya 'dex_ID' parametresi girilmelidir.")
181
+ if isinstance(fop, list):
182
+ fop.append(False)
183
+ return
184
+
185
+ updated_content = '\n'.join(new_lines)
186
+
187
+ updated_file = io.BytesIO(updated_content.encode('utf-8'))
188
+ media = MediaIoBaseUpload(updated_file, mimetype='text/plain')
189
+ service.files().update(fileId=file_id, media_body=media).execute()
190
+
191
+ if isinstance(fop, list):
192
+ fop.append(True)
193
+
194
+ def get(ID="dosya.txt", Hup=None, Pen=None, go=None, fop=None, es=None, os=None):
195
+ import io
196
+ from google.oauth2 import service_account
197
+ from googleapiclient.discovery import build
198
+ from googleapiclient.http import MediaIoBaseDownload
199
+
200
+ creds = service_account.Credentials.from_service_account_info(es)
201
+ service = build('drive', 'v3', credentials=creds)
202
+
203
+ query = f"'{os}' in parents and name='{ID}'"
204
+ results = service.files().list(q=query, fields="files(id)").execute()
205
+ files = results.get('files', [])
206
+
207
+ if not files:
208
+ print(f"{ID} dosyası bulunamadı.")
209
+ if Pen is not None:
210
+ Pen.append(None)
211
+ if isinstance(fop, list):
212
+ fop.append(False)
213
+ return
214
+
215
+ file_id = files[0]['id']
216
+ request = service.files().get_media(fileId=file_id)
217
+ file_io = io.BytesIO()
218
+ downloader = MediaIoBaseDownload(file_io, request)
219
+ done = False
220
+ while not done:
221
+ _, done = downloader.next_chunk()
222
+
223
+ content = file_io.getvalue().decode('utf-8')
224
+ lines = content.splitlines()
225
+
226
+
227
+ if isinstance(Hup, tuple) and len(Hup) == 2:
228
+ header = Hup[0]
229
+ target = Hup[1]
230
+ capture = False
231
+ result = None
232
+ for line in lines:
233
+ if line.strip().endswith(":"):
234
+ capture = (line.strip()[:-1] == header)
235
+ continue
236
+ if capture:
237
+ if line.strip().startswith(f"{target};"):
238
+ parts = line.split(";", 1)
239
+ if len(parts) == 2:
240
+ result = parts[1].strip()
241
+ break
242
+
243
+ if Pen is not None:
244
+ Pen.append(result if result else "")
245
+ if isinstance(go, list) and result is not None:
246
+ go.append(result)
247
+ if isinstance(fop, list):
248
+ fop.append(result is not None)
249
+
250
+
251
+ elif isinstance(Hup, str):
252
+ capture = False
253
+ result = ""
254
+ found = False
255
+ for line in lines:
256
+ if line.strip().startswith(Hup + ":"):
257
+ capture = True
258
+ found = True
259
+ continue
260
+ elif capture and ":" in line:
261
+ break
262
+ elif capture:
263
+ result += line + "\n"
264
+ if Pen is not None:
265
+ Pen.append(result.strip())
266
+ if isinstance(fop, list):
267
+ fop.append(found)
268
+
269
+
270
+ else:
271
+ if Pen is not None:
272
+ Pen.append(content)
273
+ if isinstance(fop, list):
274
+ fop.append(True)
275
+
276
+ def give(dex, dax, dox, es, os, fop=None, girp=None, girpx=None, girp_header=None, girpx_header=None, dex_ID=None):
277
+ import io
278
+ from google.oauth2 import service_account
279
+ from googleapiclient.discovery import build
280
+ from googleapiclient.http import MediaIoBaseDownload, MediaIoBaseUpload
281
+
282
+
283
+ real_dex = dex
284
+ if girpx and not real_dex.startswith(girpx):
285
+ real_dex = girpx + real_dex
286
+ if girp and not real_dex.endswith(girp):
287
+ real_dex = real_dex + girp
288
+
289
+
290
+ real_dax = dax
291
+ if girpx_header and not real_dax.startswith(girpx_header):
292
+ real_dax = girpx_header + real_dax
293
+ if girp_header and not real_dax.endswith(girp_header):
294
+ real_dax = real_dax + girp_header
295
+
296
+ creds = service_account.Credentials.from_service_account_info(es)
297
+ service = build('drive', 'v3', credentials=creds)
298
+
299
+ query = f"'{os}' in parents and name='{dox}'"
300
+ results = service.files().list(q=query, fields="files(id)").execute()
301
+ files = results.get('files', [])
302
+
303
+ if not files:
304
+ print(f"{dox} dosyası bulunamadı.")
305
+ if isinstance(fop, list):
306
+ fop.append(False)
307
+ return
308
+
309
+ file_id = files[0]['id']
310
+ request = service.files().get_media(fileId=file_id)
311
+ file_io = io.BytesIO()
312
+ downloader = MediaIoBaseDownload(file_io, request)
313
+ done = False
314
+ while not done:
315
+ _, done = downloader.next_chunk()
316
+
317
+ content = file_io.getvalue().decode('utf-8')
318
+ lines = content.strip().split('\n')
319
+
320
+ found_header = False
321
+ updated = False
322
+ new_lines = []
323
+ i = 0
324
+ while i < len(lines):
325
+ line = lines[i]
326
+ new_lines.append(line)
327
+ if line.strip() == real_dax + ":":
328
+ found_header = True
329
+ i += 1
330
+ while i < len(lines):
331
+ current_line = lines[i].strip()
332
+ if current_line.endswith(":"):
333
+ break
334
+
335
+
336
+ if dex_ID and current_line.startswith(f"{dex_ID};"):
337
+ parts = lines[i].split(";", 1)
338
+ if len(parts) == 2:
339
+
340
+ existing_data = parts[1].strip()
341
+ new_data = f"{parts[0]}; {existing_data} {real_dex}".strip()
342
+ new_lines.append(new_data)
343
+ updated = True
344
+ i += 1
345
+ continue
346
+
347
+
348
+ if lines[i].strip() == real_dex:
349
+ updated = True
350
+
351
+ new_lines.append(lines[i])
352
+ i += 1
353
+
354
+ if not updated:
355
+ if dex_ID:
356
+ new_lines.append(f"{dex_ID}; {real_dex}")
357
+ else:
358
+ new_lines.append(real_dex)
359
+ continue
360
+ i += 1
361
+
362
+ if not found_header:
363
+ new_lines.append(f"{real_dax}:")
364
+ if dex_ID:
365
+ new_lines.append(f"{dex_ID}; {real_dex}")
366
+ else:
367
+ new_lines.append(real_dex)
368
+
369
+ new_content = '\n'.join(new_lines)
370
+ file_io = io.BytesIO(new_content.encode('utf-8'))
371
+ media = MediaIoBaseUpload(file_io, mimetype='text/plain', resumable=True)
372
+
373
+ service.files().update(fileId=file_id, media_body=media).execute()
374
+
375
+ if isinstance(fop, list):
376
+ fop.append(True if not updated else False)
Qwael/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from .Prihops import DRİVE
@@ -0,0 +1,25 @@
1
+ Custom Software License for Qwael
2
+
3
+ Copyright © 2025 Bedirhan
4
+ All rights reserved.
5
+
6
+ Software Name: Prihops
7
+
8
+ This software is provided under the following license terms:
9
+
10
+ 1. Prihops may be freely used and integrated into any software project, application, or platform, whether commercial or non-commercial.
11
+
12
+ 2. Applications or systems using Prihops *may be distributed or sold, provided that the **core functionality offered by Prihops itself is not monetized*.
13
+
14
+ 3. Specifically, you may not charge users for:
15
+ - Access to any features or outputs that are directly provided by Prihops.
16
+ - Any result generated by Prihops (e.g., images, text, data, etc.).
17
+
18
+ 4. Prihops may not be modified, reverse engineered, or redistributed in its original or modified form without explicit written permission from the author.
19
+
20
+ 5. This software is provided "as is", without warranty of any kind.
21
+
22
+ Violations of this license may result in legal action or revocation of usage rights.
23
+
24
+ Author: Bedirhan
25
+ Contact: bedirhan.oytpass@gmail.com
@@ -0,0 +1,38 @@
1
+ Metadata-Version: 2.1
2
+ Name: Qwael
3
+ Version: 0.0.1
4
+ Summary: Easy Coding
5
+ Home-page:
6
+ Author: Bedirhan
7
+ Author-email: bedirhan.oytpass@gmail.com
8
+ License: Proprietary
9
+ Keywords: Google,coding,Easy
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: License :: Other/Proprietary License
12
+ Classifier: Operating System :: OS Independent
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: google-auth
16
+ Requires-Dist: google-api-python-client
17
+ Requires-Dist: google-auth-httplib2
18
+ Requires-Dist: google-auth-oauthlib
19
+ Requires-Dist: Pillow
20
+
21
+ # DRIVE: Google Drive File Management Library
22
+
23
+ DRIVE is a Python library that allows you to interact with files on Google Drive. With simple function calls, you can download, upload, update, delete, and retrieve file content in a structured format. This library leverages the Google Drive API and allows seamless integration into your applications.
24
+
25
+ ## Features
26
+
27
+ - *Download* files from Google Drive.
28
+ - *Upload* updated files back to Google Drive.
29
+ - *Update* file content by adding or modifying data.
30
+ - *Delete* specific sections of a file.
31
+ - *Search* for specific data within files based on headers.
32
+
33
+ ## Installation
34
+
35
+ To install DRIVE, you can use pip:
36
+
37
+ ```bash
38
+ pip install Qwael
@@ -0,0 +1,7 @@
1
+ Qwael/Prihops.py,sha256=5zS0YEmFqKduP7-Z-4nM_S9eow9baqrf3neza8o4f6E,13632
2
+ Qwael/__init__.py,sha256=6xql-vvNC0xaA5fnnQ34HmiclElCG38qUs-MVnc-uG8,27
3
+ Qwael-0.0.1.dist-info/LICENSE,sha256=RSRqjAl4RmFUhxW2BdZOLyjtIavh5JaeFOy33wTJnVc,1050
4
+ Qwael-0.0.1.dist-info/METADATA,sha256=NbESsEn_msZHrxB-wONsJ0JZjSvuJBkB1U0WM6DjXtU,1277
5
+ Qwael-0.0.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
6
+ Qwael-0.0.1.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
7
+ Qwael-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.45.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ Qwael