Qwael 4.0.0.1.5__py3-none-any.whl → 4.0.0.1.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/EasyWeb.py ADDED
@@ -0,0 +1,59 @@
1
+ from flask import Flask
2
+ import yaml
3
+
4
+ class Web:
5
+ def __init__(self, name):
6
+ self.app = Flask(name)
7
+
8
+ def route(self, path):
9
+ return self.app.route(path)
10
+
11
+ def run(self):
12
+ self.app.run(debug=True)
13
+
14
+
15
+ class UI:
16
+ @staticmethod
17
+ def load_ted(name):
18
+ with open(f"{name}.ted", "r", encoding="utf-8") as f:
19
+ data = yaml.safe_load(f.read())
20
+
21
+ root = data.get("</>")
22
+ html = ""
23
+
24
+ for widget_name, props in root.items():
25
+ if widget_name == "Label":
26
+ html += Label(props).render()
27
+
28
+ return f"""
29
+ <html>
30
+ <body style="position:relative;">
31
+ {html}
32
+ </body>
33
+ </html>
34
+ """
35
+
36
+
37
+ class Label:
38
+ def __init__(self, props):
39
+ self.text = props.get("text", "")
40
+ pos = props.get("pos", {})
41
+ size = props.get("size", {})
42
+
43
+ self.x = pos.get("x", 0)
44
+ self.y = pos.get("y", 0)
45
+ self.w = size.get("x", 100)
46
+ self.h = size.get("y", 30)
47
+
48
+ def render(self):
49
+ return f"""
50
+ <div style="
51
+ position:absolute;
52
+ left:{self.x}px;
53
+ top:{self.y}px;
54
+ width:{self.w}px;
55
+ height:{self.h}px;
56
+ ">
57
+ {self.text}
58
+ </div>
59
+ """
Qwael/__init__.py CHANGED
@@ -5,6 +5,4 @@ from .DRİVE import delete
5
5
  from .DRİVE import get
6
6
  from .DoIP import IP
7
7
  from .filesz import EasyDB
8
- from .MultiDB import MultiDB
9
- from .Multidata import Admin
10
- from .pgif import gif
8
+ from .vto01 import create_text
Qwael/filesz.py CHANGED
@@ -1,27 +1,46 @@
1
- import os, json
1
+ import os
2
+ import json
3
+ import base64
4
+ import hashlib
5
+ from kivy.app import App
6
+ from cryptography.fernet import Fernet
7
+
2
8
 
3
9
  class EasyDB:
4
- def __init__(self, name):
5
- os.makedirs("easydb_data", exist_ok=True)
6
- self.path = f"easydb_data/{name}.json"
10
+ def __init__(self, name, password):
11
+ app = App.get_running_app()
12
+ base_dir = os.path.join(app.user_data_dir, "easydb_data")
13
+ os.makedirs(base_dir, exist_ok=True)
14
+
15
+ self.path = os.path.join(base_dir, f"{name}.db")
16
+ self.key = self._make_key(password)
17
+ self.cipher = Fernet(self.key)
18
+
7
19
  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()
20
+ self.data = {}
21
+ self._save()
22
+ else:
23
+ self._safe_load()
24
+
25
+ def _make_key(self, password):
26
+ digest = hashlib.sha256(password.encode()).digest()
27
+ return base64.urlsafe_b64encode(digest)
11
28
 
12
29
  def _safe_load(self):
13
30
  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 {}
31
+ with open(self.path, "rb") as f:
32
+ encrypted = f.read()
33
+ decrypted = self.cipher.decrypt(encrypted)
34
+ self.data = json.loads(decrypted.decode())
17
35
  except Exception:
18
- print(f"[Uyarı] {self.path} bozuktu, sıfırdan oluşturuldu.")
19
36
  self.data = {}
20
37
  self._save()
21
38
 
22
39
  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)
40
+ raw = json.dumps(self.data, ensure_ascii=False).encode()
41
+ encrypted = self.cipher.encrypt(raw)
42
+ with open(self.path, "wb") as f:
43
+ f.write(encrypted)
25
44
 
26
45
  def create(self, table):
27
46
  if table not in self.data:
@@ -29,34 +48,10 @@ class EasyDB:
29
48
  self._save()
30
49
  return self
31
50
 
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
51
  def add(self, table, record: dict):
52
52
  if table not in self.data:
53
53
  self.create(table)
54
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
55
  record["id"] = len(self.data[table]) + 1
61
56
  self.data[table].append(record)
62
57
  self._save()
@@ -66,45 +61,29 @@ class EasyDB:
66
61
  return self.data.get(table, [])
67
62
 
68
63
  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):
64
+ return [
65
+ item for item in self.data.get(table, [])
66
+ if all(item.get(k) == v for k, v in filters.items())
67
+ ]
68
+
69
+ def delete(self, table, record_id):
77
70
  if table not in self.data:
78
- print(f"[Hata] '{table}' tablosu yok.")
79
71
  return 0
80
72
 
81
73
  for item in self.data[table]:
82
74
  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]
75
+ self.data[table].remove(item)
90
76
  self._save()
91
77
  return 1
92
-
93
- print(f"[Uyarı] ID {record_id} bulunamadı.")
94
78
  return 0
95
79
 
96
- # 🔹 Yeni: ID bazlı güncelleme
97
80
  def update(self, table, record_id, **updates):
98
81
  if table not in self.data:
99
- print(f"[Hata] '{table}' tablosu yok.")
100
82
  return 0
101
83
 
102
84
  for item in self.data[table]:
103
85
  if item.get("id") == record_id:
104
86
  item.update(updates)
105
87
  self._save()
106
- print(f"[Güncellendi] ID {record_id} başarıyla güncellendi.")
107
88
  return 1
108
-
109
- print(f"[Uyarı] ID {record_id} bulunamadı.")
110
- return 0
89
+ return 0
Qwael/vto01.py ADDED
@@ -0,0 +1,87 @@
1
+ import torch
2
+ import random
3
+ import os
4
+ from datetime import datetime
5
+ from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
6
+ from deep_translator import GoogleTranslator
7
+
8
+ device = "cuda" if torch.cuda.is_available() else "cpu"
9
+ dtype = torch.float16 if device == "cuda" else torch.float32
10
+
11
+ TR_STYLE_MAP = {
12
+ "gerçekçi": "realistic",
13
+ "sinematik": "cinematic lighting",
14
+ "anime": "anime style",
15
+ "çizgi film": "cartoon style",
16
+ "karanlık": "dark dramatic mood",
17
+ "neon": "neon cyberpunk lighting",
18
+ "portre": "portrait photography",
19
+ "detaylı": "highly detailed",
20
+ "fantastik": "fantasy art",
21
+ "bilim kurgu": "science fiction",
22
+ "minimal": "minimalist composition"
23
+ }
24
+
25
+ QUALITY_LOCK = (
26
+ "masterpiece, ultra high quality, professional photography, "
27
+ "sharp focus, perfect lighting, high detail, clean composition"
28
+ )
29
+
30
+ NEGATIVE_LOCK = (
31
+ "worst quality, low quality, lowres, blurry, jpeg artifacts, "
32
+ "bad anatomy, bad proportions, extra fingers, missing fingers, "
33
+ "extra limbs, fused fingers, malformed hands, "
34
+ "deformed face, asymmetrical face, cross eye, lazy eye, "
35
+ "distorted body, mutated, ugly"
36
+ )
37
+
38
+ translator = GoogleTranslator(source="tr", target="en")
39
+
40
+ def _build_prompt(prompt_tr: str) -> str:
41
+ translated = translator.translate(prompt_tr)
42
+ prompt_lower = prompt_tr.lower()
43
+ styles = []
44
+ for tr, en in TR_STYLE_MAP.items():
45
+ if tr in prompt_lower:
46
+ styles.append(en)
47
+ parts = [translated]
48
+ if styles:
49
+ parts.append(", ".join(styles))
50
+ parts.append(QUALITY_LOCK)
51
+ return ", ".join(parts)
52
+
53
+ _pipe = StableDiffusionPipeline.from_pretrained(
54
+ "runwayml/stable-diffusion-v1-5",
55
+ torch_dtype=dtype,
56
+ safety_checker=None
57
+ ).to(device)
58
+
59
+ _pipe.scheduler = DPMSolverMultistepScheduler.from_config(_pipe.scheduler.config)
60
+ _pipe.enable_attention_slicing()
61
+
62
+ def create_text(
63
+ prompt: str,
64
+ kalite: float = 7.5,
65
+ cfg: float = 7.5,
66
+ steps: int | None = None,
67
+ seed: int | None = None,
68
+ filename: str | None = None
69
+ ) -> str:
70
+ final_prompt = _build_prompt(prompt)
71
+ if steps is None:
72
+ steps = int(20 + (kalite * 2))
73
+ if seed is None:
74
+ seed = random.randint(0, 999999999)
75
+ generator = torch.Generator(device=device).manual_seed(seed)
76
+ image = _pipe(
77
+ prompt=final_prompt,
78
+ negative_prompt=NEGATIVE_LOCK,
79
+ num_inference_steps=steps,
80
+ guidance_scale=float(cfg),
81
+ generator=generator
82
+ ).images[0]
83
+ if filename is None:
84
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
85
+ filename = f"ai_image_{timestamp}.png"
86
+ image.save(filename)
87
+ return os.path.abspath(filename)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Qwael
3
- Version: 4.0.0.1.5
3
+ Version: 4.0.0.1.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
@@ -20,6 +20,8 @@ Requires-Dist: google-auth
20
20
  Requires-Dist: google-auth-oauthlib
21
21
  Requires-Dist: google-auth-httplib2
22
22
  Requires-Dist: Pillow
23
+ Requires-Dist: flask
24
+ Requires-Dist: pyyaml
23
25
  Requires-Dist: requests
24
26
  Dynamic: author
25
27
  Dynamic: author-email
@@ -0,0 +1,14 @@
1
+ Qwael/DRİVE.py,sha256=OTiyoXFb5iFP7hXr2QHnH3c0pHZijZr1sFsqguXtMfc,12976
2
+ Qwael/DoIP.py,sha256=5ujPzbZGepFZN0-tMI9Unodvo2gJG3PDL2ShqdBJjdE,418
3
+ Qwael/EasyWeb.py,sha256=78XBEIuHjUm0j-TOPsN0sy0iXl8UywKAi0dNn-evWSY,1283
4
+ Qwael/MultiDB.py,sha256=glptDsH22TyklZrA_ywStnsT6bGnq7JsSR5NN_U1NII,17286
5
+ Qwael/Multidata.py,sha256=YBofvzcuT-F8RIljw3Z1tr3Qn7VbhXjfrY6BuGNPYw0,9496
6
+ Qwael/__init__.py,sha256=eeFu4pKdESARPG5JxEZQG3bXnqI0k2DRuXLvA1d1tug,207
7
+ Qwael/filesz.py,sha256=6XZ1GKzXcVs7uKAirImbBuZYGrRL_-WOtiOOYOdp_nU,2501
8
+ Qwael/pgif.py,sha256=stiVsn1DAJyHNsAHUWaWXdGiouQ2ZeRehn_WC30SK1A,1242
9
+ Qwael/vto01.py,sha256=qAsPdylzdgTa21ox0kfnyCjYn06StCUVODa5N3WwNdw,2697
10
+ qwael-4.0.0.1.7.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
+ qwael-4.0.0.1.7.dist-info/METADATA,sha256=PlHVeVuRtPuiNDts_ehkAUnrZ6JIUqQLDHONtG4QW68,2323
12
+ qwael-4.0.0.1.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ qwael-4.0.0.1.7.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
14
+ qwael-4.0.0.1.7.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- Qwael/DRİVE.py,sha256=OTiyoXFb5iFP7hXr2QHnH3c0pHZijZr1sFsqguXtMfc,12976
2
- Qwael/DoIP.py,sha256=5ujPzbZGepFZN0-tMI9Unodvo2gJG3PDL2ShqdBJjdE,418
3
- Qwael/MultiDB.py,sha256=glptDsH22TyklZrA_ywStnsT6bGnq7JsSR5NN_U1NII,17286
4
- Qwael/Multidata.py,sha256=YBofvzcuT-F8RIljw3Z1tr3Qn7VbhXjfrY6BuGNPYw0,9496
5
- Qwael/__init__.py,sha256=9WhKfi_QrKmtybAZpcxiOlFBQVzhyp-lQtnzifLpAF0,256
6
- Qwael/filesz.py,sha256=M93tuP-BQxmySgjtYR5uQ3Otx2AfqbfAuKD6pyZDBC4,3859
7
- Qwael/pgif.py,sha256=stiVsn1DAJyHNsAHUWaWXdGiouQ2ZeRehn_WC30SK1A,1242
8
- qwael-4.0.0.1.5.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- qwael-4.0.0.1.5.dist-info/METADATA,sha256=TeAP0FRS3lBrbtxd9qcqebDH0mrhSv7Dx5X1jvDlhbE,2280
10
- qwael-4.0.0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- qwael-4.0.0.1.5.dist-info/top_level.txt,sha256=UtaXY8Mui4lwYNkGrplHcEVe8PjH553OT1Xu5V9bhg0,6
12
- qwael-4.0.0.1.5.dist-info/RECORD,,