Qwael 3.9.3__tar.gz → 3.9.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 3.9.3
3
+ Version: 3.9.5
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
@@ -1,8 +1,24 @@
1
1
  import os
2
2
  import json
3
3
 
4
+ # --- KIVY ANDROID DOSYA DESTEĞİ EKLENDİ ---
5
+ try:
6
+ from kivy.utils import platform
7
+ from kivy.app import App
8
+ except:
9
+ platform = None
10
+ # ------------------------------------------
11
+
12
+
4
13
  class MultiDB:
5
14
  def __init__(self, filename="database.mdb"):
15
+
16
+ # --- Android için doğru klasör ayarı ---
17
+ if platform == "android":
18
+ app = App.get_running_app()
19
+ filename = os.path.join(app.user_data_dir, filename)
20
+ # ---------------------------------------
21
+
6
22
  self.filename = filename
7
23
  self.lockfile = filename + ".lock"
8
24
 
@@ -124,9 +140,12 @@ class MultiDB:
124
140
  return True
125
141
 
126
142
  # -----------------------------
127
- # GIVE
143
+ # GIVE (DEĞİŞKEN DESTEKLİ)
128
144
  # -----------------------------
129
145
  def give(self, table, values, output_list=None):
146
+ if not isinstance(values, (list, tuple)):
147
+ values = [values]
148
+
130
149
  try:
131
150
  self._lock()
132
151
  lines = self._read()
@@ -140,7 +159,6 @@ class MultiDB:
140
159
 
141
160
  final_values = []
142
161
 
143
- # AUTO ID
144
162
  if len(values) + 1 == len(col_names) and "ID" in rules.values():
145
163
  auto_id = 1
146
164
  idx = tpos + 3
@@ -156,15 +174,13 @@ class MultiDB:
156
174
  raise ValueError("Gönderilen veri sayısı yanlış!")
157
175
 
158
176
  else:
159
- final_values = values[:]
177
+ final_values = list(values)
160
178
 
161
- # VALIDATION
162
179
  for i, col in enumerate(col_names):
163
180
  rule = rules[col]
164
181
  if not self._validate(final_values[i], rule, lines, tpos, i):
165
182
  raise ValueError(f"{col} alanı için veri kurala uymuyor: {rule}")
166
183
 
167
- # Insert
168
184
  lines.insert(tpos + 3, json.dumps(final_values, ensure_ascii=False))
169
185
  self._write(lines)
170
186
  self._unlock()
@@ -294,6 +310,9 @@ class MultiDB:
294
310
  # CONTROL SYSTEM
295
311
  # -----------------------------
296
312
  def control(self, table, conditions: dict, output_list=None):
313
+ if not isinstance(conditions, dict):
314
+ raise ValueError("control koşulları dict olmalı. Örnek: {'kod': değişken}")
315
+
297
316
  lines = self._read()
298
317
  tpos = self._find_table(lines, table)
299
318
  if tpos == -1:
@@ -306,11 +325,7 @@ class MultiDB:
306
325
  idx = tpos + 3
307
326
  while idx < len(lines) and not lines[idx].startswith("[TABLE"):
308
327
  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
328
+ match = all(row[col_indexes[k]] == v for k, v in conditions.items())
314
329
  if match:
315
330
  found = True
316
331
  break
@@ -324,9 +339,12 @@ class MultiDB:
324
339
  return found
325
340
 
326
341
  # -----------------------------
327
- # FIND (koşula göre ID döndürür)
342
+ # FIND
328
343
  # -----------------------------
329
344
  def find(self, table, conditions: dict, output_list=None):
345
+ if not isinstance(conditions, dict):
346
+ raise ValueError("find koşulları dict olmalı. Örnek: {'mail': değişken}")
347
+
330
348
  lines = self._read()
331
349
  tpos = self._find_table(lines, table)
332
350
  if tpos == -1:
@@ -336,20 +354,13 @@ class MultiDB:
336
354
  col_indexes = {k: col_names.index(k) for k in conditions}
337
355
 
338
356
  found_id = None
339
-
340
357
  idx = tpos + 3
358
+
341
359
  while idx < len(lines) and not lines[idx].startswith("[TABLE"):
342
360
  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:
361
+ if all(row[col_indexes[k]] == v for k, v in conditions.items()):
350
362
  found_id = row[0]
351
363
  break
352
-
353
364
  idx += 1
354
365
 
355
366
  if output_list is not None:
@@ -358,15 +369,17 @@ class MultiDB:
358
369
  return found_id
359
370
 
360
371
  # -----------------------------
361
- # PULL (ID’ye göre belirli sütun verisi getir)
372
+ # PULL
362
373
  # -----------------------------
363
374
  def pull(self, row_id, columns: dict, output_list=None):
375
+
376
+ if not isinstance(columns, dict):
377
+ columns = {columns: None}
378
+
364
379
  lines = self._read()
365
380
 
366
- # Çekilecek sütun adı
367
381
  col_name = list(columns.keys())[0]
368
382
 
369
- # Tabloları tek tek kontrol ederek bu sütun hangi tabloda öğren
370
383
  tpos = -1
371
384
  for i, line in enumerate(lines):
372
385
  if line.startswith("[TABLE"):
@@ -380,7 +393,6 @@ class MultiDB:
380
393
 
381
394
  col_index = col_names.index(col_name)
382
395
 
383
- # Satırı ID'ye göre bul
384
396
  idx = tpos + 3
385
397
  found_value = None
386
398
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 3.9.3
3
+ Version: 3.9.5
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
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name="Qwael",
8
- version="3.9.3",
8
+ version="3.9.5",
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  "google-api-python-client",
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