Qwael 3.9.3__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.3 → qwael-3.9.4}/PKG-INFO +1 -1
- {qwael-3.9.3 → qwael-3.9.4}/Qwael/MultiDB.py +22 -23
- {qwael-3.9.3 → qwael-3.9.4}/Qwael.egg-info/PKG-INFO +1 -1
- {qwael-3.9.3 → qwael-3.9.4}/setup.py +1 -1
- {qwael-3.9.3 → qwael-3.9.4}/LICENSE +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/Qwael/DR/304/260VE.py" +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/Qwael/DoIP.py +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/Qwael/__init__.py +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/Qwael/filesz.py +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/Qwael.egg-info/SOURCES.txt +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/Qwael.egg-info/dependency_links.txt +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/Qwael.egg-info/requires.txt +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/Qwael.egg-info/top_level.txt +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/README.md +0 -0
- {qwael-3.9.3 → qwael-3.9.4}/setup.cfg +0 -0
|
@@ -124,9 +124,13 @@ class MultiDB:
|
|
|
124
124
|
return True
|
|
125
125
|
|
|
126
126
|
# -----------------------------
|
|
127
|
-
# GIVE
|
|
127
|
+
# GIVE (DEĞİŞKEN DESTEKLİ)
|
|
128
128
|
# -----------------------------
|
|
129
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
|
+
|
|
130
134
|
try:
|
|
131
135
|
self._lock()
|
|
132
136
|
lines = self._read()
|
|
@@ -156,7 +160,7 @@ class MultiDB:
|
|
|
156
160
|
raise ValueError("Gönderilen veri sayısı yanlış!")
|
|
157
161
|
|
|
158
162
|
else:
|
|
159
|
-
final_values = values
|
|
163
|
+
final_values = list(values)
|
|
160
164
|
|
|
161
165
|
# VALIDATION
|
|
162
166
|
for i, col in enumerate(col_names):
|
|
@@ -164,7 +168,6 @@ class MultiDB:
|
|
|
164
168
|
if not self._validate(final_values[i], rule, lines, tpos, i):
|
|
165
169
|
raise ValueError(f"{col} alanı için veri kurala uymuyor: {rule}")
|
|
166
170
|
|
|
167
|
-
# Insert
|
|
168
171
|
lines.insert(tpos + 3, json.dumps(final_values, ensure_ascii=False))
|
|
169
172
|
self._write(lines)
|
|
170
173
|
self._unlock()
|
|
@@ -291,9 +294,12 @@ class MultiDB:
|
|
|
291
294
|
self._unlock()
|
|
292
295
|
|
|
293
296
|
# -----------------------------
|
|
294
|
-
# CONTROL SYSTEM
|
|
297
|
+
# CONTROL SYSTEM (DEĞİŞKEN DESTEKLİ)
|
|
295
298
|
# -----------------------------
|
|
296
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
|
+
|
|
297
303
|
lines = self._read()
|
|
298
304
|
tpos = self._find_table(lines, table)
|
|
299
305
|
if tpos == -1:
|
|
@@ -306,11 +312,7 @@ class MultiDB:
|
|
|
306
312
|
idx = tpos + 3
|
|
307
313
|
while idx < len(lines) and not lines[idx].startswith("[TABLE"):
|
|
308
314
|
row = json.loads(lines[idx])
|
|
309
|
-
match =
|
|
310
|
-
for key, val in conditions.items():
|
|
311
|
-
if row[col_indexes[key]] != val:
|
|
312
|
-
match = False
|
|
313
|
-
break
|
|
315
|
+
match = all(row[col_indexes[k]] == v for k, v in conditions.items())
|
|
314
316
|
if match:
|
|
315
317
|
found = True
|
|
316
318
|
break
|
|
@@ -324,9 +326,12 @@ class MultiDB:
|
|
|
324
326
|
return found
|
|
325
327
|
|
|
326
328
|
# -----------------------------
|
|
327
|
-
# FIND (
|
|
329
|
+
# FIND (DEĞİŞKEN DESTEKLİ)
|
|
328
330
|
# -----------------------------
|
|
329
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
|
+
|
|
330
335
|
lines = self._read()
|
|
331
336
|
tpos = self._find_table(lines, table)
|
|
332
337
|
if tpos == -1:
|
|
@@ -336,20 +341,13 @@ class MultiDB:
|
|
|
336
341
|
col_indexes = {k: col_names.index(k) for k in conditions}
|
|
337
342
|
|
|
338
343
|
found_id = None
|
|
339
|
-
|
|
340
344
|
idx = tpos + 3
|
|
345
|
+
|
|
341
346
|
while idx < len(lines) and not lines[idx].startswith("[TABLE"):
|
|
342
347
|
row = json.loads(lines[idx])
|
|
343
|
-
|
|
344
|
-
for key, val in conditions.items():
|
|
345
|
-
if row[col_indexes[key]] != val:
|
|
346
|
-
match = False
|
|
347
|
-
break
|
|
348
|
-
|
|
349
|
-
if match:
|
|
348
|
+
if all(row[col_indexes[k]] == v for k, v in conditions.items()):
|
|
350
349
|
found_id = row[0]
|
|
351
350
|
break
|
|
352
|
-
|
|
353
351
|
idx += 1
|
|
354
352
|
|
|
355
353
|
if output_list is not None:
|
|
@@ -358,15 +356,17 @@ class MultiDB:
|
|
|
358
356
|
return found_id
|
|
359
357
|
|
|
360
358
|
# -----------------------------
|
|
361
|
-
# PULL (
|
|
359
|
+
# PULL (DEĞİŞKEN DESTEKLİ)
|
|
362
360
|
# -----------------------------
|
|
363
361
|
def pull(self, row_id, columns: dict, output_list=None):
|
|
362
|
+
|
|
363
|
+
if not isinstance(columns, dict):
|
|
364
|
+
columns = {columns: None}
|
|
365
|
+
|
|
364
366
|
lines = self._read()
|
|
365
367
|
|
|
366
|
-
# Çekilecek sütun adı
|
|
367
368
|
col_name = list(columns.keys())[0]
|
|
368
369
|
|
|
369
|
-
# Tabloları tek tek kontrol ederek bu sütun hangi tabloda öğren
|
|
370
370
|
tpos = -1
|
|
371
371
|
for i, line in enumerate(lines):
|
|
372
372
|
if line.startswith("[TABLE"):
|
|
@@ -380,7 +380,6 @@ class MultiDB:
|
|
|
380
380
|
|
|
381
381
|
col_index = col_names.index(col_name)
|
|
382
382
|
|
|
383
|
-
# Satırı ID'ye göre bul
|
|
384
383
|
idx = tpos + 3
|
|
385
384
|
found_value = None
|
|
386
385
|
|
|
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
|