Qwael 4.0.4.4__py3-none-any.whl → 4.0.4.7__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/adbfull.py CHANGED
@@ -1,45 +1,160 @@
1
1
  from supabase import create_client
2
+ from threading import Thread
3
+ import time
2
4
 
3
5
 
4
6
  class ADB:
5
7
 
6
8
  def __init__(self, url, key):
7
9
  self.db = create_client(url, key)
10
+ self.current_uid = None
8
11
 
9
- # ========= AUTH =========
10
-
11
- def a_kayit_ol(self, email, sifre):
12
- return self.db.auth.sign_up({
13
- "email": email,
14
- "password": sifre
15
- })
16
-
17
- def a_giris_yap(self, email, sifre):
18
- sonuc = self.db.auth.sign_in_with_password({
19
- "email": email,
20
- "password": sifre
21
- })
22
- return sonuc.user.id # uid döner
23
-
24
- # ========= TABLO =========
25
-
26
- def add(self, tablo, uid, **veriler):
27
- """
28
- Örnek:
29
- add("users_data", uid, username="Ali Kaya", skor=34)
30
- """
31
- veriler["user_id"] = uid
32
- return self.db.table(tablo).insert(veriler).execute()
33
-
34
- def get(self, tablo, uid):
35
- return self.db.table(tablo) \
36
- .select("*") \
37
- .eq("user_id", uid) \
38
- .single() \
39
- .execute().data
40
-
41
- def update(self, tablo, uid, **veriler):
42
- return self.db.table(tablo) \
43
- .update(veriler) \
44
- .eq("user_id", uid) \
45
- .execute()
12
+ # ================= THREAD SİSTEM =================
13
+
14
+ def _async(self, func, callback=None):
15
+ def run():
16
+ try:
17
+ sonuc = func()
18
+ if callback:
19
+ callback(sonuc)
20
+ except Exception as e:
21
+ print("ADB HATA:", e)
22
+
23
+ Thread(target=run, daemon=True).start()
24
+
25
+ # ================= AUTH =================
26
+
27
+ def a_kayit_ol(self, email, sifre, callback=None):
28
+ self._async(
29
+ lambda: self.db.auth.sign_up({
30
+ "email": email,
31
+ "password": sifre
32
+ }),
33
+ callback
34
+ )
35
+
36
+ def a_giris_yap(self, email, sifre, callback=None):
37
+
38
+ def islem():
39
+ res = self.db.auth.sign_in_with_password({
40
+ "email": email,
41
+ "password": sifre
42
+ })
43
+ self.current_uid = res.user.id
44
+ return self.current_uid
45
+
46
+ self._async(islem, callback)
47
+
48
+ def cikis_yap(self):
49
+ try:
50
+ self.db.auth.sign_out()
51
+ self.current_uid = None
52
+ except:
53
+ pass
54
+
55
+ # ================= VERİ TABANI =================
56
+
57
+ def add(self, tablo, uid=None, callback=None, **veriler):
58
+
59
+ def islem():
60
+ if uid is None:
61
+ uid_kullan = self.current_uid
62
+ else:
63
+ uid_kullan = uid
64
+
65
+ if uid_kullan is None:
66
+ raise Exception("UID yok, önce giriş yap")
67
+
68
+ veriler["user_id"] = uid_kullan
69
+
70
+ return self.db.table(tablo).insert(veriler).execute()
71
+
72
+ self._async(islem, callback)
73
+
74
+ def get(self, tablo, uid=None, callback=None):
75
+
76
+ def islem():
77
+ if uid is None:
78
+ uid_kullan = self.current_uid
79
+ else:
80
+ uid_kullan = uid
81
+
82
+ if uid_kullan is None:
83
+ raise Exception("UID yok")
84
+
85
+ return self.db.table(tablo)\
86
+ .select("*")\
87
+ .eq("user_id", uid_kullan)\
88
+ .execute().data
89
+
90
+ self._async(islem, callback)
91
+
92
+ def update(self, tablo, uid=None, callback=None, **veriler):
93
+
94
+ def islem():
95
+ if uid is None:
96
+ uid_kullan = self.current_uid
97
+ else:
98
+ uid_kullan = uid
99
+
100
+ if uid_kullan is None:
101
+ raise Exception("UID yok")
102
+
103
+ return self.db.table(tablo)\
104
+ .update(veriler)\
105
+ .eq("user_id", uid_kullan)\
106
+ .execute()
107
+
108
+ self._async(islem, callback)
109
+
110
+ def delete(self, tablo, uid=None, callback=None):
111
+
112
+ def islem():
113
+ if uid is None:
114
+ uid_kullan = self.current_uid
115
+ else:
116
+ uid_kullan = uid
117
+
118
+ if uid_kullan is None:
119
+ raise Exception("UID yok")
120
+
121
+ return self.db.table(tablo)\
122
+ .delete()\
123
+ .eq("user_id", uid_kullan)\
124
+ .execute()
125
+
126
+ self._async(islem, callback)
127
+
128
+
129
+ # ================= KULLANIMI DAHA BASİT OLSUN DİYE =================
130
+
131
+ _db = None
132
+
133
+
134
+ def baslat(url, key):
135
+ global _db
136
+ _db = ADB(url, key)
137
+
138
+
139
+ def a_kayit_ol(email, sifre, callback=None):
140
+ _db.a_kayit_ol(email, sifre, callback)
141
+
142
+
143
+ def a_giris_yap(email, sifre, callback=None):
144
+ _db.a_giris_yap(email, sifre, callback)
145
+
146
+
147
+ def add(tablo, uid=None, callback=None, **veriler):
148
+ _db.add(tablo, uid, callback, **veriler)
149
+
150
+
151
+ def get(tablo, uid=None, callback=None):
152
+ _db.get(tablo, uid, callback)
153
+
154
+
155
+ def update(tablo, uid=None, callback=None, **veriler):
156
+ _db.update(tablo, uid, callback, **veriler)
157
+
158
+
159
+ def delete(tablo, uid=None, callback=None):
160
+ _db.delete(tablo, uid, callback)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 4.0.4.4
3
+ Version: 4.0.4.7
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
@@ -4,11 +4,11 @@ Qwael/EasyWeb.py,sha256=78XBEIuHjUm0j-TOPsN0sy0iXl8UywKAi0dNn-evWSY,1283
4
4
  Qwael/MultiDB.py,sha256=glptDsH22TyklZrA_ywStnsT6bGnq7JsSR5NN_U1NII,17286
5
5
  Qwael/Multidata.py,sha256=YBofvzcuT-F8RIljw3Z1tr3Qn7VbhXjfrY6BuGNPYw0,9496
6
6
  Qwael/__init__.py,sha256=80N86isqJ_EhDy0-wlUe6BFO1CpJvb61wYgt14b4bEM,230
7
- Qwael/adbfull.py,sha256=IzkeCbkazYUZWnlAI2-spJXySrfhm8C16CeXxmTK1DA,1139
7
+ Qwael/adbfull.py,sha256=wNn5mQI5CBDpkVu_XTvSmtJrZ2nouxx7D4RcWNG4-ls,3918
8
8
  Qwael/filesz.py,sha256=6XZ1GKzXcVs7uKAirImbBuZYGrRL_-WOtiOOYOdp_nU,2501
9
9
  Qwael/pgif.py,sha256=stiVsn1DAJyHNsAHUWaWXdGiouQ2ZeRehn_WC30SK1A,1242
10
- qwael-4.0.4.4.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- qwael-4.0.4.4.dist-info/METADATA,sha256=1z9G01sloQo1h2w-NxqNw5tXwB8TUJnB1AEMEH8SKbo,2399
12
- qwael-4.0.4.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
13
- qwael-4.0.4.4.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
14
- qwael-4.0.4.4.dist-info/RECORD,,
10
+ qwael-4.0.4.7.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ qwael-4.0.4.7.dist-info/METADATA,sha256=lBQtc7BfzKCrIyKqQo49x74v6DzOHlvC3SiGEP46_UM,2399
12
+ qwael-4.0.4.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
13
+ qwael-4.0.4.7.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
14
+ qwael-4.0.4.7.dist-info/RECORD,,