Qwael 3.9.2__tar.gz → 3.9.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.
- {qwael-3.9.2 → qwael-3.9.4}/PKG-INFO +1 -1
- {qwael-3.9.2 → qwael-3.9.4}/Qwael/MultiDB.py +83 -12
- {qwael-3.9.2 → qwael-3.9.4}/Qwael.egg-info/PKG-INFO +1 -1
- {qwael-3.9.2 → qwael-3.9.4}/setup.py +1 -1
- {qwael-3.9.2 → qwael-3.9.4}/LICENSE +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/Qwael/DR/304/260VE.py" +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/Qwael/DoIP.py +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/Qwael/__init__.py +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/Qwael/filesz.py +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/Qwael.egg-info/SOURCES.txt +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/Qwael.egg-info/dependency_links.txt +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/Qwael.egg-info/requires.txt +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/Qwael.egg-info/top_level.txt +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/README.md +0 -0
- {qwael-3.9.2 → qwael-3.9.4}/setup.cfg +0 -0
|
@@ -110,7 +110,6 @@ class MultiDB:
|
|
|
110
110
|
return False
|
|
111
111
|
|
|
112
112
|
if r == "small":
|
|
113
|
-
# small kuralı artık tüm value için geçerli (domain dahil)
|
|
114
113
|
if not all(ch.islower() or ch.isdigit() or ch in "@." for ch in value):
|
|
115
114
|
return False
|
|
116
115
|
|
|
@@ -125,9 +124,13 @@ class MultiDB:
|
|
|
125
124
|
return True
|
|
126
125
|
|
|
127
126
|
# -----------------------------
|
|
128
|
-
# GIVE (
|
|
127
|
+
# GIVE (DEĞİŞKEN DESTEKLİ)
|
|
129
128
|
# -----------------------------
|
|
130
129
|
def give(self, table, values, output_list=None):
|
|
130
|
+
# Değişken → liste dönüşümü
|
|
131
|
+
if not isinstance(values, (list, tuple)):
|
|
132
|
+
values = [values]
|
|
133
|
+
|
|
131
134
|
try:
|
|
132
135
|
self._lock()
|
|
133
136
|
lines = self._read()
|
|
@@ -157,7 +160,7 @@ class MultiDB:
|
|
|
157
160
|
raise ValueError("Gönderilen veri sayısı yanlış!")
|
|
158
161
|
|
|
159
162
|
else:
|
|
160
|
-
final_values = values
|
|
163
|
+
final_values = list(values)
|
|
161
164
|
|
|
162
165
|
# VALIDATION
|
|
163
166
|
for i, col in enumerate(col_names):
|
|
@@ -165,7 +168,6 @@ class MultiDB:
|
|
|
165
168
|
if not self._validate(final_values[i], rule, lines, tpos, i):
|
|
166
169
|
raise ValueError(f"{col} alanı için veri kurala uymuyor: {rule}")
|
|
167
170
|
|
|
168
|
-
# Insert
|
|
169
171
|
lines.insert(tpos + 3, json.dumps(final_values, ensure_ascii=False))
|
|
170
172
|
self._write(lines)
|
|
171
173
|
self._unlock()
|
|
@@ -201,7 +203,7 @@ class MultiDB:
|
|
|
201
203
|
return result
|
|
202
204
|
|
|
203
205
|
# -----------------------------
|
|
204
|
-
# CLEAR DATA
|
|
206
|
+
# CLEAR DATA
|
|
205
207
|
# -----------------------------
|
|
206
208
|
def clear_full(self, table):
|
|
207
209
|
self._lock()
|
|
@@ -292,9 +294,12 @@ class MultiDB:
|
|
|
292
294
|
self._unlock()
|
|
293
295
|
|
|
294
296
|
# -----------------------------
|
|
295
|
-
# CONTROL SYSTEM
|
|
297
|
+
# CONTROL SYSTEM (DEĞİŞKEN DESTEKLİ)
|
|
296
298
|
# -----------------------------
|
|
297
299
|
def control(self, table, conditions: dict, output_list=None):
|
|
300
|
+
if not isinstance(conditions, dict):
|
|
301
|
+
raise ValueError("control koşulları dict olmalı. Örnek: {'kod': değişken}")
|
|
302
|
+
|
|
298
303
|
lines = self._read()
|
|
299
304
|
tpos = self._find_table(lines, table)
|
|
300
305
|
if tpos == -1:
|
|
@@ -307,11 +312,7 @@ class MultiDB:
|
|
|
307
312
|
idx = tpos + 3
|
|
308
313
|
while idx < len(lines) and not lines[idx].startswith("[TABLE"):
|
|
309
314
|
row = json.loads(lines[idx])
|
|
310
|
-
match =
|
|
311
|
-
for key, val in conditions.items():
|
|
312
|
-
if row[col_indexes[key]] != val:
|
|
313
|
-
match = False
|
|
314
|
-
break
|
|
315
|
+
match = all(row[col_indexes[k]] == v for k, v in conditions.items())
|
|
315
316
|
if match:
|
|
316
317
|
found = True
|
|
317
318
|
break
|
|
@@ -322,4 +323,74 @@ class MultiDB:
|
|
|
322
323
|
else:
|
|
323
324
|
output_list.append(found)
|
|
324
325
|
|
|
325
|
-
return found
|
|
326
|
+
return found
|
|
327
|
+
|
|
328
|
+
# -----------------------------
|
|
329
|
+
# FIND (DEĞİŞKEN DESTEKLİ)
|
|
330
|
+
# -----------------------------
|
|
331
|
+
def find(self, table, conditions: dict, output_list=None):
|
|
332
|
+
if not isinstance(conditions, dict):
|
|
333
|
+
raise ValueError("find koşulları dict olmalı. Örnek: {'mail': değişken}")
|
|
334
|
+
|
|
335
|
+
lines = self._read()
|
|
336
|
+
tpos = self._find_table(lines, table)
|
|
337
|
+
if tpos == -1:
|
|
338
|
+
raise ValueError("Tablo bulunamadı!")
|
|
339
|
+
|
|
340
|
+
col_names = json.loads(lines[tpos + 1])
|
|
341
|
+
col_indexes = {k: col_names.index(k) for k in conditions}
|
|
342
|
+
|
|
343
|
+
found_id = None
|
|
344
|
+
idx = tpos + 3
|
|
345
|
+
|
|
346
|
+
while idx < len(lines) and not lines[idx].startswith("[TABLE"):
|
|
347
|
+
row = json.loads(lines[idx])
|
|
348
|
+
if all(row[col_indexes[k]] == v for k, v in conditions.items()):
|
|
349
|
+
found_id = row[0]
|
|
350
|
+
break
|
|
351
|
+
idx += 1
|
|
352
|
+
|
|
353
|
+
if output_list is not None:
|
|
354
|
+
output_list.append(found_id)
|
|
355
|
+
|
|
356
|
+
return found_id
|
|
357
|
+
|
|
358
|
+
# -----------------------------
|
|
359
|
+
# PULL (DEĞİŞKEN DESTEKLİ)
|
|
360
|
+
# -----------------------------
|
|
361
|
+
def pull(self, row_id, columns: dict, output_list=None):
|
|
362
|
+
|
|
363
|
+
if not isinstance(columns, dict):
|
|
364
|
+
columns = {columns: None}
|
|
365
|
+
|
|
366
|
+
lines = self._read()
|
|
367
|
+
|
|
368
|
+
col_name = list(columns.keys())[0]
|
|
369
|
+
|
|
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
|
+
idx = tpos + 3
|
|
384
|
+
found_value = None
|
|
385
|
+
|
|
386
|
+
while idx < len(lines) and not lines[idx].startswith("[TABLE"):
|
|
387
|
+
row = json.loads(lines[idx])
|
|
388
|
+
if row[0] == str(row_id):
|
|
389
|
+
found_value = row[col_index]
|
|
390
|
+
break
|
|
391
|
+
idx += 1
|
|
392
|
+
|
|
393
|
+
if output_list is not None:
|
|
394
|
+
output_list.append(found_value)
|
|
395
|
+
|
|
396
|
+
return found_value
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|