Qwael 3.5.0__py3-none-any.whl → 3.7.0__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/__init__.py CHANGED
@@ -3,4 +3,5 @@ from .DRİVE import give
3
3
  from .DRİVE import info
4
4
  from .DRİVE import delete
5
5
  from .DRİVE import get
6
- from .DoIP import IP
6
+ from .DoIP import IP
7
+ from .flesz import EasyDB
Qwael/filesz.py ADDED
@@ -0,0 +1,110 @@
1
+ import os, json
2
+
3
+ class EasyDB:
4
+ def __init__(self, name):
5
+ os.makedirs("easydb_data", exist_ok=True)
6
+ self.path = f"easydb_data/{name}.json"
7
+ if not os.path.exists(self.path):
8
+ with open(self.path, "w", encoding="utf-8") as f:
9
+ json.dump({}, f)
10
+ self._safe_load()
11
+
12
+ def _safe_load(self):
13
+ try:
14
+ with open(self.path, "r", encoding="utf-8") as f:
15
+ text = f.read().strip()
16
+ self.data = json.loads(text) if text else {}
17
+ except Exception:
18
+ print(f"[Uyarı] {self.path} bozuktu, sıfırdan oluşturuldu.")
19
+ self.data = {}
20
+ self._save()
21
+
22
+ def _save(self):
23
+ with open(self.path, "w", encoding="utf-8") as f:
24
+ json.dump(self.data, f, indent=2, ensure_ascii=False)
25
+
26
+ def create(self, table):
27
+ if table not in self.data:
28
+ self.data[table] = []
29
+ self._save()
30
+ return self
31
+
32
+ def _value_conflict(self, table, value):
33
+ is_special = isinstance(value, str) and value.startswith("'") and value.endswith("'")
34
+ val_clean = value.strip("'") if is_special else value
35
+
36
+ for item in self.data.get(table, []):
37
+ for v in item.values():
38
+ if not isinstance(v, str):
39
+ continue
40
+ v_special = v.startswith("'") and v.endswith("'")
41
+ v_clean = v.strip("'") if v_special else v
42
+
43
+ # Aynı özel tekrar edemez
44
+ if is_special and v_special and v_clean == val_clean:
45
+ return True
46
+ # Normal ↔ özel çakışması
47
+ if (is_special and not v_special or not is_special and v_special) and v_clean == val_clean:
48
+ return True
49
+ return False
50
+
51
+ def add(self, table, record: dict):
52
+ if table not in self.data:
53
+ self.create(table)
54
+
55
+ for key, value in record.items():
56
+ if isinstance(value, str) and self._value_conflict(table, value):
57
+ print(f"[Uyarı] {value} çakışma nedeniyle eklenmedi.")
58
+ return None
59
+
60
+ record["id"] = len(self.data[table]) + 1
61
+ self.data[table].append(record)
62
+ self._save()
63
+ return record["id"]
64
+
65
+ def all(self, table):
66
+ return self.data.get(table, [])
67
+
68
+ def find(self, table, **filters):
69
+ result = []
70
+ for item in self.data.get(table, []):
71
+ if all(item.get(k) == v for k, v in filters.items()):
72
+ result.append(item)
73
+ return result
74
+
75
+ # 🔹 Yeni: ID bazlı silme
76
+ def delete(self, table, record_id, field=None):
77
+ if table not in self.data:
78
+ print(f"[Hata] '{table}' tablosu yok.")
79
+ return 0
80
+
81
+ for item in self.data[table]:
82
+ if item.get("id") == record_id:
83
+ if field is None:
84
+ self.data[table].remove(item)
85
+ print(f"[Silindi] ID {record_id} tamamen silindi.")
86
+ else:
87
+ if field in item:
88
+ print(f"[Silindi] ID {record_id} kaydındaki '{field}' alanı silindi.")
89
+ del item[field]
90
+ self._save()
91
+ return 1
92
+
93
+ print(f"[Uyarı] ID {record_id} bulunamadı.")
94
+ return 0
95
+
96
+ # 🔹 Yeni: ID bazlı güncelleme
97
+ def update(self, table, record_id, **updates):
98
+ if table not in self.data:
99
+ print(f"[Hata] '{table}' tablosu yok.")
100
+ return 0
101
+
102
+ for item in self.data[table]:
103
+ if item.get("id") == record_id:
104
+ item.update(updates)
105
+ self._save()
106
+ print(f"[Güncellendi] ID {record_id} başarıyla güncellendi.")
107
+ return 1
108
+
109
+ print(f"[Uyarı] ID {record_id} bulunamadı.")
110
+ return 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 3.5.0
3
+ Version: 3.7.0
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
@@ -21,6 +21,7 @@ Requires-Dist: google-auth-oauthlib
21
21
  Requires-Dist: google-auth-httplib2
22
22
  Requires-Dist: Pillow
23
23
  Requires-Dist: requests
24
+ Requires-Dist: json
24
25
  Dynamic: author
25
26
  Dynamic: author-email
26
27
  Dynamic: classifier
@@ -0,0 +1,9 @@
1
+ Qwael/DRİVE.py,sha256=OTiyoXFb5iFP7hXr2QHnH3c0pHZijZr1sFsqguXtMfc,12976
2
+ Qwael/DoIP.py,sha256=5ujPzbZGepFZN0-tMI9Unodvo2gJG3PDL2ShqdBJjdE,418
3
+ Qwael/__init__.py,sha256=umFnbTUboMpXKGQ8mDOAf7sBPVFfzdC8Se8S0FU-kbk,175
4
+ Qwael/filesz.py,sha256=M93tuP-BQxmySgjtYR5uQ3Otx2AfqbfAuKD6pyZDBC4,3859
5
+ qwael-3.7.0.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ qwael-3.7.0.dist-info/METADATA,sha256=nFRAo4ldcgiW7xmDzT5297mGPPIhGGx7rhz5eQhQkvU,2296
7
+ qwael-3.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ qwael-3.7.0.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
9
+ qwael-3.7.0.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- Qwael/DRİVE.py,sha256=OTiyoXFb5iFP7hXr2QHnH3c0pHZijZr1sFsqguXtMfc,12976
2
- Qwael/DoIP.py,sha256=5ujPzbZGepFZN0-tMI9Unodvo2gJG3PDL2ShqdBJjdE,418
3
- Qwael/__init__.py,sha256=hd8gMsZi15EHv9q1UCiqHdyVoNDg2x6PamWeowzxrMs,149
4
- qwael-3.5.0.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- qwael-3.5.0.dist-info/METADATA,sha256=Cu3lQUu-FHm4Pc_dLeOzifjKPq44lL4U6xJChK8-i5U,2276
6
- qwael-3.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- qwael-3.5.0.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
8
- qwael-3.5.0.dist-info/RECORD,,
File without changes