Qwael 3.9.1__py3-none-any.whl → 3.9.3__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/MultiDB.py +91 -22
- {qwael-3.9.1.dist-info → qwael-3.9.3.dist-info}/METADATA +1 -1
- qwael-3.9.3.dist-info/RECORD +10 -0
- qwael-3.9.1.dist-info/RECORD +0 -10
- {qwael-3.9.1.dist-info → qwael-3.9.3.dist-info}/WHEEL +0 -0
- {qwael-3.9.1.dist-info → qwael-3.9.3.dist-info}/licenses/LICENSE +0 -0
- {qwael-3.9.1.dist-info → qwael-3.9.3.dist-info}/top_level.txt +0 -0
Qwael/MultiDB.py
CHANGED
|
@@ -42,13 +42,19 @@ class MultiDB:
|
|
|
42
42
|
return -1
|
|
43
43
|
|
|
44
44
|
# -----------------------------
|
|
45
|
-
# RULE SPLITTER
|
|
45
|
+
# RULE SPLITTER (25 LIMIT)
|
|
46
46
|
# -----------------------------
|
|
47
47
|
def _split_rules(self, rule):
|
|
48
48
|
if not rule:
|
|
49
49
|
return []
|
|
50
|
+
|
|
50
51
|
rule = rule.replace(" ", "").replace("+", ",").replace("#-", ",#-")
|
|
51
|
-
|
|
52
|
+
rules = [r for r in rule.split(",") if r]
|
|
53
|
+
|
|
54
|
+
if len(rules) > 25:
|
|
55
|
+
raise ValueError("Bir sütun için maksimum 25 kural eklenebilir!")
|
|
56
|
+
|
|
57
|
+
return rules
|
|
52
58
|
|
|
53
59
|
# -----------------------------
|
|
54
60
|
# CREATE TABLE
|
|
@@ -104,7 +110,7 @@ class MultiDB:
|
|
|
104
110
|
return False
|
|
105
111
|
|
|
106
112
|
if r == "small":
|
|
107
|
-
if not all(ch.islower() or ch.isdigit() for ch in value):
|
|
113
|
+
if not all(ch.islower() or ch.isdigit() or ch in "@." for ch in value):
|
|
108
114
|
return False
|
|
109
115
|
|
|
110
116
|
if r == "#-":
|
|
@@ -118,7 +124,7 @@ class MultiDB:
|
|
|
118
124
|
return True
|
|
119
125
|
|
|
120
126
|
# -----------------------------
|
|
121
|
-
# GIVE
|
|
127
|
+
# GIVE
|
|
122
128
|
# -----------------------------
|
|
123
129
|
def give(self, table, values, output_list=None):
|
|
124
130
|
try:
|
|
@@ -158,7 +164,7 @@ class MultiDB:
|
|
|
158
164
|
if not self._validate(final_values[i], rule, lines, tpos, i):
|
|
159
165
|
raise ValueError(f"{col} alanı için veri kurala uymuyor: {rule}")
|
|
160
166
|
|
|
161
|
-
# Insert
|
|
167
|
+
# Insert
|
|
162
168
|
lines.insert(tpos + 3, json.dumps(final_values, ensure_ascii=False))
|
|
163
169
|
self._write(lines)
|
|
164
170
|
self._unlock()
|
|
@@ -194,12 +200,11 @@ class MultiDB:
|
|
|
194
200
|
return result
|
|
195
201
|
|
|
196
202
|
# -----------------------------
|
|
197
|
-
# CLEAR
|
|
203
|
+
# CLEAR DATA
|
|
198
204
|
# -----------------------------
|
|
199
205
|
def clear_full(self, table):
|
|
200
206
|
self._lock()
|
|
201
207
|
lines = self._read()
|
|
202
|
-
|
|
203
208
|
tpos = self._find_table(lines, table)
|
|
204
209
|
if tpos == -1:
|
|
205
210
|
self._unlock()
|
|
@@ -213,14 +218,13 @@ class MultiDB:
|
|
|
213
218
|
i += 1
|
|
214
219
|
continue
|
|
215
220
|
|
|
216
|
-
new_lines.append(lines[i])
|
|
221
|
+
new_lines.append(lines[i])
|
|
217
222
|
new_lines.append(lines[i + 1])
|
|
218
223
|
new_lines.append(lines[i + 2])
|
|
219
224
|
|
|
220
225
|
j = i + 3
|
|
221
226
|
while j < len(lines) and not lines[j].startswith("[TABLE"):
|
|
222
227
|
j += 1
|
|
223
|
-
|
|
224
228
|
i = j
|
|
225
229
|
|
|
226
230
|
self._write(new_lines)
|
|
@@ -232,7 +236,6 @@ class MultiDB:
|
|
|
232
236
|
def table_update(self, table, columns):
|
|
233
237
|
self._lock()
|
|
234
238
|
lines = self._read()
|
|
235
|
-
|
|
236
239
|
tpos = self._find_table(lines, table)
|
|
237
240
|
if tpos == -1:
|
|
238
241
|
self._unlock()
|
|
@@ -243,9 +246,8 @@ class MultiDB:
|
|
|
243
246
|
for col in columns:
|
|
244
247
|
if isinstance(col, dict):
|
|
245
248
|
key = list(col.keys())[0]
|
|
246
|
-
rule = col[key]
|
|
247
249
|
col_names.append(key)
|
|
248
|
-
rules[key] =
|
|
250
|
+
rules[key] = col[key]
|
|
249
251
|
else:
|
|
250
252
|
col_names.append(col)
|
|
251
253
|
rules[col] = ""
|
|
@@ -257,13 +259,12 @@ class MultiDB:
|
|
|
257
259
|
idx += 1
|
|
258
260
|
|
|
259
261
|
new_data_rows = []
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
old_cols = json.loads(lines[tpos + 1])
|
|
262
263
|
for row in data_rows:
|
|
263
264
|
new_row = []
|
|
264
265
|
for col in col_names:
|
|
265
|
-
if col in
|
|
266
|
-
new_row.append(row[
|
|
266
|
+
if col in old_cols:
|
|
267
|
+
new_row.append(row[old_cols.index(col)])
|
|
267
268
|
else:
|
|
268
269
|
new_row.append("")
|
|
269
270
|
new_data_rows.append(new_row)
|
|
@@ -282,7 +283,6 @@ class MultiDB:
|
|
|
282
283
|
while j < len(lines) and not lines[j].startswith("[TABLE"):
|
|
283
284
|
j += 1
|
|
284
285
|
i = j
|
|
285
|
-
|
|
286
286
|
else:
|
|
287
287
|
new_lines.append(lines[i])
|
|
288
288
|
i += 1
|
|
@@ -304,20 +304,16 @@ class MultiDB:
|
|
|
304
304
|
|
|
305
305
|
found = False
|
|
306
306
|
idx = tpos + 3
|
|
307
|
-
|
|
308
307
|
while idx < len(lines) and not lines[idx].startswith("[TABLE"):
|
|
309
308
|
row = json.loads(lines[idx])
|
|
310
|
-
|
|
311
309
|
match = True
|
|
312
310
|
for key, val in conditions.items():
|
|
313
311
|
if row[col_indexes[key]] != val:
|
|
314
312
|
match = False
|
|
315
313
|
break
|
|
316
|
-
|
|
317
314
|
if match:
|
|
318
315
|
found = True
|
|
319
316
|
break
|
|
320
|
-
|
|
321
317
|
idx += 1
|
|
322
318
|
|
|
323
319
|
if output_list is None:
|
|
@@ -325,4 +321,77 @@ class MultiDB:
|
|
|
325
321
|
else:
|
|
326
322
|
output_list.append(found)
|
|
327
323
|
|
|
328
|
-
return found
|
|
324
|
+
return found
|
|
325
|
+
|
|
326
|
+
# -----------------------------
|
|
327
|
+
# FIND (koşula göre ID döndürür)
|
|
328
|
+
# -----------------------------
|
|
329
|
+
def find(self, table, conditions: dict, output_list=None):
|
|
330
|
+
lines = self._read()
|
|
331
|
+
tpos = self._find_table(lines, table)
|
|
332
|
+
if tpos == -1:
|
|
333
|
+
raise ValueError("Tablo bulunamadı!")
|
|
334
|
+
|
|
335
|
+
col_names = json.loads(lines[tpos + 1])
|
|
336
|
+
col_indexes = {k: col_names.index(k) for k in conditions}
|
|
337
|
+
|
|
338
|
+
found_id = None
|
|
339
|
+
|
|
340
|
+
idx = tpos + 3
|
|
341
|
+
while idx < len(lines) and not lines[idx].startswith("[TABLE"):
|
|
342
|
+
row = json.loads(lines[idx])
|
|
343
|
+
match = True
|
|
344
|
+
for key, val in conditions.items():
|
|
345
|
+
if row[col_indexes[key]] != val:
|
|
346
|
+
match = False
|
|
347
|
+
break
|
|
348
|
+
|
|
349
|
+
if match:
|
|
350
|
+
found_id = row[0]
|
|
351
|
+
break
|
|
352
|
+
|
|
353
|
+
idx += 1
|
|
354
|
+
|
|
355
|
+
if output_list is not None:
|
|
356
|
+
output_list.append(found_id)
|
|
357
|
+
|
|
358
|
+
return found_id
|
|
359
|
+
|
|
360
|
+
# -----------------------------
|
|
361
|
+
# PULL (ID’ye göre belirli sütun verisi getir)
|
|
362
|
+
# -----------------------------
|
|
363
|
+
def pull(self, row_id, columns: dict, output_list=None):
|
|
364
|
+
lines = self._read()
|
|
365
|
+
|
|
366
|
+
# Çekilecek sütun adı
|
|
367
|
+
col_name = list(columns.keys())[0]
|
|
368
|
+
|
|
369
|
+
# Tabloları tek tek kontrol ederek bu sütun hangi tabloda öğren
|
|
370
|
+
tpos = -1
|
|
371
|
+
for i, line in enumerate(lines):
|
|
372
|
+
if line.startswith("[TABLE"):
|
|
373
|
+
col_names = json.loads(lines[i + 1])
|
|
374
|
+
if col_name in col_names:
|
|
375
|
+
tpos = i
|
|
376
|
+
break
|
|
377
|
+
|
|
378
|
+
if tpos == -1:
|
|
379
|
+
raise ValueError("Bu sütun hiçbir tabloda bulunamadı!")
|
|
380
|
+
|
|
381
|
+
col_index = col_names.index(col_name)
|
|
382
|
+
|
|
383
|
+
# Satırı ID'ye göre bul
|
|
384
|
+
idx = tpos + 3
|
|
385
|
+
found_value = None
|
|
386
|
+
|
|
387
|
+
while idx < len(lines) and not lines[idx].startswith("[TABLE"):
|
|
388
|
+
row = json.loads(lines[idx])
|
|
389
|
+
if row[0] == str(row_id):
|
|
390
|
+
found_value = row[col_index]
|
|
391
|
+
break
|
|
392
|
+
idx += 1
|
|
393
|
+
|
|
394
|
+
if output_list is not None:
|
|
395
|
+
output_list.append(found_value)
|
|
396
|
+
|
|
397
|
+
return found_value
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Qwael/DRİVE.py,sha256=OTiyoXFb5iFP7hXr2QHnH3c0pHZijZr1sFsqguXtMfc,12976
|
|
2
|
+
Qwael/DoIP.py,sha256=5ujPzbZGepFZN0-tMI9Unodvo2gJG3PDL2ShqdBJjdE,418
|
|
3
|
+
Qwael/MultiDB.py,sha256=DB75-ek04WakUxma3s7RcbmPiV6Tzn1S2fasVzi6ED0,11916
|
|
4
|
+
Qwael/__init__.py,sha256=g4xUZRKjtsdkDpjIvFCb9RNS8BJdJ0IBQjddxJjR-gM,205
|
|
5
|
+
Qwael/filesz.py,sha256=M93tuP-BQxmySgjtYR5uQ3Otx2AfqbfAuKD6pyZDBC4,3859
|
|
6
|
+
qwael-3.9.3.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
qwael-3.9.3.dist-info/METADATA,sha256=tU4zEG__QHBZXJEq0fyvZQj9Sj89uGORPg6CzHb-0EM,2276
|
|
8
|
+
qwael-3.9.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
qwael-3.9.3.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
|
|
10
|
+
qwael-3.9.3.dist-info/RECORD,,
|
qwael-3.9.1.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
Qwael/DRİVE.py,sha256=OTiyoXFb5iFP7hXr2QHnH3c0pHZijZr1sFsqguXtMfc,12976
|
|
2
|
-
Qwael/DoIP.py,sha256=5ujPzbZGepFZN0-tMI9Unodvo2gJG3PDL2ShqdBJjdE,418
|
|
3
|
-
Qwael/MultiDB.py,sha256=EZXOcVwIQ2yXoZ_BZPHdDLUL_04cN-zY9vHIBYO43Pw,9664
|
|
4
|
-
Qwael/__init__.py,sha256=g4xUZRKjtsdkDpjIvFCb9RNS8BJdJ0IBQjddxJjR-gM,205
|
|
5
|
-
Qwael/filesz.py,sha256=M93tuP-BQxmySgjtYR5uQ3Otx2AfqbfAuKD6pyZDBC4,3859
|
|
6
|
-
qwael-3.9.1.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
qwael-3.9.1.dist-info/METADATA,sha256=QG_WdlEIvQZd1LieQ0VBHw6FxbhyKB6XbsBECTfOO5I,2276
|
|
8
|
-
qwael-3.9.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
qwael-3.9.1.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
|
|
10
|
-
qwael-3.9.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|