Qwael 3.9.3__py3-none-any.whl → 3.9.4__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 CHANGED
@@ -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 = True
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 (koşula göre ID döndürür)
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
- 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:
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 (ID’ye göre belirli sütun verisi getir)
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 3.9.3
3
+ Version: 3.9.4
4
4
  Summary: Qwael: İşlevsel ve kolaylaştırılmış Python kütüphanesi
5
5
  Author: Bedirhan
6
6
  Author-email: bedirhan.oytpass@gmail.com
@@ -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=kbGDba1wDa8cU4d3LRX1Nscy3OmIOywyvg-PkB0uh20,12031
4
+ Qwael/__init__.py,sha256=g4xUZRKjtsdkDpjIvFCb9RNS8BJdJ0IBQjddxJjR-gM,205
5
+ Qwael/filesz.py,sha256=M93tuP-BQxmySgjtYR5uQ3Otx2AfqbfAuKD6pyZDBC4,3859
6
+ qwael-3.9.4.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ qwael-3.9.4.dist-info/METADATA,sha256=_SDptsCuZkx1fpi-VUvWcsO3YSZRIv1tLxo0BxsED_E,2276
8
+ qwael-3.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ qwael-3.9.4.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
10
+ qwael-3.9.4.dist-info/RECORD,,
@@ -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=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,,
File without changes