Qwael 3.9.2__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
@@ -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 (True/False destekli)
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 (Keep structure)
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 = True
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 3.9.2
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=qxFRpN8GOumsOCY5v1fNFMrQ-sqHm0ySZFcQDiSCGNI,9845
4
- Qwael/__init__.py,sha256=g4xUZRKjtsdkDpjIvFCb9RNS8BJdJ0IBQjddxJjR-gM,205
5
- Qwael/filesz.py,sha256=M93tuP-BQxmySgjtYR5uQ3Otx2AfqbfAuKD6pyZDBC4,3859
6
- qwael-3.9.2.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- qwael-3.9.2.dist-info/METADATA,sha256=EGq4w39XxPcYRh57vr6EtXjBjqJPsSpBzbZITMeZzzY,2276
8
- qwael-3.9.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- qwael-3.9.2.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
10
- qwael-3.9.2.dist-info/RECORD,,
File without changes