nano-wait 0.0.1__tar.gz → 2.0__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.
Potentially problematic release.
This version of nano-wait might be problematic. Click here for more details.
- {nano_wait-0.0.1 → nano_wait-2.0}/LICENSE +21 -21
- nano_wait-2.0/PKG-INFO +40 -0
- nano_wait-2.0/README.md +18 -0
- nano_wait-2.0/nano_wait/__init__.py +38 -0
- nano_wait-2.0/nano_wait/__main__.py +4 -0
- nano_wait-2.0/nano_wait/cli.py +58 -0
- nano_wait-2.0/nano_wait/core.py +68 -0
- nano_wait-2.0/nano_wait/nano_wait.py +32 -0
- nano_wait-2.0/nano_wait/utils.py +13 -0
- nano_wait-2.0/nano_wait.egg-info/PKG-INFO +40 -0
- {nano_wait-0.0.1 → nano_wait-2.0}/nano_wait.egg-info/SOURCES.txt +4 -0
- {nano_wait-0.0.1 → nano_wait-2.0}/nano_wait.egg-info/requires.txt +0 -1
- {nano_wait-0.0.1 → nano_wait-2.0}/setup.cfg +4 -4
- {nano_wait-0.0.1 → nano_wait-2.0}/setup.py +17 -16
- nano_wait-0.0.1/PKG-INFO +0 -28
- nano_wait-0.0.1/README.md +0 -14
- nano_wait-0.0.1/nano_wait/__init__.py +0 -1
- nano_wait-0.0.1/nano_wait/nano_wait.py +0 -76
- nano_wait-0.0.1/nano_wait.egg-info/PKG-INFO +0 -28
- {nano_wait-0.0.1 → nano_wait-2.0}/nano_wait.egg-info/dependency_links.txt +0 -0
- {nano_wait-0.0.1 → nano_wait-2.0}/nano_wait.egg-info/top_level.txt +0 -0
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Luiz Filipe Seabra de marco
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Luiz Filipe Seabra de marco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
nano_wait-2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nano_wait
|
|
3
|
+
Version: 2.0
|
|
4
|
+
Summary: Waiting Time Calculation for Automations Based on WiFi and PC Processing
|
|
5
|
+
Author: Luiz Filipe Seabra de Marco
|
|
6
|
+
Author-email: luizfilipeseabra@icloud.com
|
|
7
|
+
License: MIT License
|
|
8
|
+
Keywords: automation automação wifi wait
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: psutil
|
|
12
|
+
Requires-Dist: pywifi
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: keywords
|
|
18
|
+
Dynamic: license
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: summary
|
|
22
|
+
|
|
23
|
+
# ⚡ Nano-Wait v2.0
|
|
24
|
+
|
|
25
|
+
**Adaptive smart wait for Python — replaces `time.sleep()` with intelligence.**
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🚀 Features
|
|
30
|
+
- Adjusts wait time based on CPU, RAM, and Wi-Fi quality.
|
|
31
|
+
- Simple API: `wait(2.5, wifi="Office", speed="fast")`
|
|
32
|
+
- CLI support: `nano-wait 2.5 --wifi "Office" --speed fast`
|
|
33
|
+
- Built-in presets: `slow`, `normal`, `fast`, `ultra`
|
|
34
|
+
- Optional logs and verbose mode.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 📦 Installation
|
|
39
|
+
```bash
|
|
40
|
+
pip install nano-wait
|
nano_wait-2.0/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# ⚡ Nano-Wait v2.0
|
|
2
|
+
|
|
3
|
+
**Adaptive smart wait for Python — replaces `time.sleep()` with intelligence.**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 Features
|
|
8
|
+
- Adjusts wait time based on CPU, RAM, and Wi-Fi quality.
|
|
9
|
+
- Simple API: `wait(2.5, wifi="Office", speed="fast")`
|
|
10
|
+
- CLI support: `nano-wait 2.5 --wifi "Office" --speed fast`
|
|
11
|
+
- Built-in presets: `slow`, `normal`, `fast`, `ultra`
|
|
12
|
+
- Optional logs and verbose mode.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 📦 Installation
|
|
17
|
+
```bash
|
|
18
|
+
pip install nano-wait
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from .core import NanoWait
|
|
2
|
+
|
|
3
|
+
def wait(t: float, wifi: str = None, speed: float = 1.5, smart: bool = False, verbose: bool = False, log: bool = False):
|
|
4
|
+
"""
|
|
5
|
+
Main API function to wait adaptively.
|
|
6
|
+
|
|
7
|
+
Args:
|
|
8
|
+
t (float): Base wait time in seconds
|
|
9
|
+
wifi (str, optional): Wi-Fi SSID to consider
|
|
10
|
+
speed (float, optional): Speed factor (ignored if smart=True)
|
|
11
|
+
smart (bool, optional): Enable Smart Context Mode
|
|
12
|
+
verbose (bool): Print debug info
|
|
13
|
+
log (bool): Save log
|
|
14
|
+
"""
|
|
15
|
+
nw = NanoWait()
|
|
16
|
+
|
|
17
|
+
if smart:
|
|
18
|
+
pc_score = nw.get_pc_score()
|
|
19
|
+
wifi_score = nw.get_wifi_signal(wifi) if wifi else 5
|
|
20
|
+
risk_score = (pc_score + wifi_score) / 2
|
|
21
|
+
speed = max(0.5, min(5.0, risk_score))
|
|
22
|
+
if verbose:
|
|
23
|
+
print(f"[Smart Context] PC={pc_score:.2f}, Wi-Fi={wifi_score:.2f}, risk={risk_score:.2f}, speed={speed:.2f}")
|
|
24
|
+
|
|
25
|
+
if wifi:
|
|
26
|
+
wait_time = nw.wait_wifi(speed=speed, ssid=wifi)
|
|
27
|
+
else:
|
|
28
|
+
wait_time = nw.wait_n_wifi(speed=speed)
|
|
29
|
+
|
|
30
|
+
if verbose:
|
|
31
|
+
print(f"[NanoWait] PC+WiFi wait = {wait_time:.2f}s")
|
|
32
|
+
|
|
33
|
+
import time
|
|
34
|
+
time.sleep(wait_time)
|
|
35
|
+
|
|
36
|
+
if log:
|
|
37
|
+
with open("nano_wait.log", "a") as f:
|
|
38
|
+
f.write(f"{time.strftime('%Y-%m-%d %H:%M:%S')} - Waited {wait_time:.2f}s\n")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from . import wait as nano_wait_func
|
|
3
|
+
from .core import NanoWait
|
|
4
|
+
|
|
5
|
+
# Presets tradicionais
|
|
6
|
+
SPEED_PRESETS = {
|
|
7
|
+
"slow": 0.5,
|
|
8
|
+
"normal": 1.5,
|
|
9
|
+
"fast": 3.0,
|
|
10
|
+
"ultra": 5.0
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
def main():
|
|
14
|
+
parser = argparse.ArgumentParser(
|
|
15
|
+
description="Nano-Wait — Adaptive smart wait for Python."
|
|
16
|
+
)
|
|
17
|
+
parser.add_argument("time", type=float, help="Base time in seconds (e.g. 2.5)")
|
|
18
|
+
parser.add_argument("--wifi", type=str, help="Wi-Fi SSID to use (optional)")
|
|
19
|
+
parser.add_argument(
|
|
20
|
+
"--speed",
|
|
21
|
+
type=str,
|
|
22
|
+
default="auto",
|
|
23
|
+
help="Speed preset (slow, normal, fast, ultra) or 'auto'"
|
|
24
|
+
)
|
|
25
|
+
parser.add_argument("--smart", action="store_true", help="Enable Smart Context Mode")
|
|
26
|
+
parser.add_argument("--verbose", action="store_true", help="Show debug output")
|
|
27
|
+
parser.add_argument("--log", action="store_true", help="Write result to log file")
|
|
28
|
+
|
|
29
|
+
args = parser.parse_args()
|
|
30
|
+
|
|
31
|
+
nw = NanoWait()
|
|
32
|
+
|
|
33
|
+
# Determina o speed
|
|
34
|
+
if args.smart:
|
|
35
|
+
# Smart Context Mode
|
|
36
|
+
pc_score = nw.get_pc_score()
|
|
37
|
+
wifi_score = nw.get_wifi_signal(args.wifi) if args.wifi else 5
|
|
38
|
+
risk_score = (pc_score + wifi_score) / 2
|
|
39
|
+
# Quanto maior o risco (pior PC/Wi-Fi), menor o speed → espera maior
|
|
40
|
+
speed_value = max(0.5, min(5.0, risk_score))
|
|
41
|
+
if args.verbose:
|
|
42
|
+
print(f"[Smart Context] PC={pc_score:.2f}, Wi-Fi={wifi_score:.2f}, risk={risk_score:.2f}, speed={speed_value:.2f}")
|
|
43
|
+
elif args.speed.lower() == "auto":
|
|
44
|
+
# Auto-speed simples (sem Smart Context Mode)
|
|
45
|
+
speed_value = 1.5
|
|
46
|
+
else:
|
|
47
|
+
speed_value = SPEED_PRESETS.get(args.speed.lower(), 1.5)
|
|
48
|
+
|
|
49
|
+
nano_wait_func(
|
|
50
|
+
t=args.time,
|
|
51
|
+
wifi=args.wifi,
|
|
52
|
+
speed=speed_value,
|
|
53
|
+
verbose=args.verbose,
|
|
54
|
+
log=args.log
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
if __name__ == "__main__":
|
|
58
|
+
main()
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
class NanoWait:
|
|
2
|
+
def __init__(self):
|
|
3
|
+
import platform
|
|
4
|
+
self.system = platform.system().lower()
|
|
5
|
+
# Apenas Windows precisa de pywifi
|
|
6
|
+
if self.system == "windows":
|
|
7
|
+
import pywifi
|
|
8
|
+
self.wifi = pywifi.PyWiFi()
|
|
9
|
+
self.interface = self.wifi.interfaces()[0]
|
|
10
|
+
else:
|
|
11
|
+
self.wifi = None
|
|
12
|
+
self.interface = None
|
|
13
|
+
|
|
14
|
+
def get_pc_score(self):
|
|
15
|
+
import psutil
|
|
16
|
+
try:
|
|
17
|
+
cpu = psutil.cpu_percent(interval=1)
|
|
18
|
+
mem = psutil.virtual_memory().percent
|
|
19
|
+
return (max(0, min(10, 10 - cpu / 10)) + max(0, min(10, 10 - mem / 10))) / 2
|
|
20
|
+
except:
|
|
21
|
+
return 0
|
|
22
|
+
|
|
23
|
+
def get_wifi_signal(self, ssid=None):
|
|
24
|
+
# Retorna 0 se Wi-Fi não disponível
|
|
25
|
+
if self.system == "windows" and self.interface:
|
|
26
|
+
try:
|
|
27
|
+
self.interface.scan()
|
|
28
|
+
import time
|
|
29
|
+
time.sleep(2)
|
|
30
|
+
for net in self.interface.scan_results():
|
|
31
|
+
if ssid is None or net.ssid == ssid:
|
|
32
|
+
return max(0, min(10, (net.signal + 100) / 10))
|
|
33
|
+
except:
|
|
34
|
+
return 0
|
|
35
|
+
elif self.system == "darwin":
|
|
36
|
+
import subprocess
|
|
37
|
+
try:
|
|
38
|
+
out = subprocess.check_output([
|
|
39
|
+
"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport",
|
|
40
|
+
"-I"
|
|
41
|
+
], text=True)
|
|
42
|
+
line = [l for l in out.split("\n") if "agrCtlRSSI" in l][0]
|
|
43
|
+
rssi = int(line.split(":")[1].strip())
|
|
44
|
+
return max(0, min(10, (rssi + 100) / 10))
|
|
45
|
+
except:
|
|
46
|
+
return 0
|
|
47
|
+
elif self.system == "linux":
|
|
48
|
+
import subprocess
|
|
49
|
+
try:
|
|
50
|
+
out = subprocess.check_output(["nmcli", "-t", "-f", "ACTIVE,SSID,SIGNAL", "dev", "wifi"], text=True)
|
|
51
|
+
for l in out.splitlines():
|
|
52
|
+
active, name, sig = l.split(":")
|
|
53
|
+
if active == "yes" or (ssid and name == ssid):
|
|
54
|
+
return max(0, min(10, int(sig)/10))
|
|
55
|
+
except:
|
|
56
|
+
return 0
|
|
57
|
+
return 0
|
|
58
|
+
|
|
59
|
+
def wait_wifi(self, speed=1.5, ssid=None):
|
|
60
|
+
"""Sempre disponível, mesmo sem pywifi"""
|
|
61
|
+
pc = self.get_pc_score()
|
|
62
|
+
wifi = self.get_wifi_signal(ssid)
|
|
63
|
+
risk = (pc + wifi) / 2
|
|
64
|
+
return max(0.2, (10 - risk)/speed)
|
|
65
|
+
|
|
66
|
+
def wait_n_wifi(self, speed=1.5):
|
|
67
|
+
pc = self.get_pc_score()
|
|
68
|
+
return max(0.2, (10 - pc)/speed)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from .core import NanoWait
|
|
2
|
+
from .utils import log_message, get_speed_value
|
|
3
|
+
|
|
4
|
+
def wait(t: float, wifi: str = None, speed: str | float = "normal", verbose=False, log=False) -> float:
|
|
5
|
+
"""
|
|
6
|
+
Adaptive smart wait — replaces time.sleep() with intelligence.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
t (float): Base wait time in seconds.
|
|
10
|
+
wifi (str, optional): Wi-Fi SSID to evaluate. Defaults to None.
|
|
11
|
+
speed (str|float): 'slow', 'normal', 'fast', 'ultra', or custom float.
|
|
12
|
+
verbose (bool): Print details. Defaults to False.
|
|
13
|
+
log (bool): Write log to file. Defaults to False.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
float: Wait time executed (seconds).
|
|
17
|
+
"""
|
|
18
|
+
speed_value = get_speed_value(speed)
|
|
19
|
+
nw = NanoWait()
|
|
20
|
+
|
|
21
|
+
factor = nw.wait_wifi(speed_value, wifi) if wifi else nw.wait_n_wifi(speed_value)
|
|
22
|
+
wait_time = round(max(0.05, min(t / factor, t)), 3)
|
|
23
|
+
|
|
24
|
+
if verbose:
|
|
25
|
+
print(f"[NanoWait] 🧠 speed={speed_value}, wait={wait_time:.3f}s")
|
|
26
|
+
|
|
27
|
+
if log:
|
|
28
|
+
log_message(f"Wait={wait_time:.3f}s | speed={speed_value}")
|
|
29
|
+
|
|
30
|
+
import time
|
|
31
|
+
time.sleep(wait_time)
|
|
32
|
+
return wait_time
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
def get_speed_value(speed):
|
|
4
|
+
"""Converts speed preset or numeric input to float."""
|
|
5
|
+
speed_map = {"slow": 0.8, "normal": 1.5, "fast": 3.0, "ultra": 6.0}
|
|
6
|
+
if isinstance(speed, str):
|
|
7
|
+
return speed_map.get(speed.lower(), 1.5)
|
|
8
|
+
return float(speed)
|
|
9
|
+
|
|
10
|
+
def log_message(text: str):
|
|
11
|
+
"""Saves messages to nano_wait.log."""
|
|
12
|
+
with open("nano_wait.log", "a") as f:
|
|
13
|
+
f.write(f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] {text}\n")
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nano_wait
|
|
3
|
+
Version: 2.0
|
|
4
|
+
Summary: Waiting Time Calculation for Automations Based on WiFi and PC Processing
|
|
5
|
+
Author: Luiz Filipe Seabra de Marco
|
|
6
|
+
Author-email: luizfilipeseabra@icloud.com
|
|
7
|
+
License: MIT License
|
|
8
|
+
Keywords: automation automação wifi wait
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: psutil
|
|
12
|
+
Requires-Dist: pywifi
|
|
13
|
+
Dynamic: author
|
|
14
|
+
Dynamic: author-email
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: keywords
|
|
18
|
+
Dynamic: license
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
Dynamic: summary
|
|
22
|
+
|
|
23
|
+
# ⚡ Nano-Wait v2.0
|
|
24
|
+
|
|
25
|
+
**Adaptive smart wait for Python — replaces `time.sleep()` with intelligence.**
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🚀 Features
|
|
30
|
+
- Adjusts wait time based on CPU, RAM, and Wi-Fi quality.
|
|
31
|
+
- Simple API: `wait(2.5, wifi="Office", speed="fast")`
|
|
32
|
+
- CLI support: `nano-wait 2.5 --wifi "Office" --speed fast`
|
|
33
|
+
- Built-in presets: `slow`, `normal`, `fast`, `ultra`
|
|
34
|
+
- Optional logs and verbose mode.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 📦 Installation
|
|
39
|
+
```bash
|
|
40
|
+
pip install nano-wait
|
|
@@ -2,7 +2,11 @@ LICENSE
|
|
|
2
2
|
README.md
|
|
3
3
|
setup.py
|
|
4
4
|
nano_wait/__init__.py
|
|
5
|
+
nano_wait/__main__.py
|
|
6
|
+
nano_wait/cli.py
|
|
7
|
+
nano_wait/core.py
|
|
5
8
|
nano_wait/nano_wait.py
|
|
9
|
+
nano_wait/utils.py
|
|
6
10
|
nano_wait.egg-info/PKG-INFO
|
|
7
11
|
nano_wait.egg-info/SOURCES.txt
|
|
8
12
|
nano_wait.egg-info/dependency_links.txt
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
from setuptools import setup
|
|
2
|
-
|
|
3
|
-
with open("README.md", "r") as arq:
|
|
4
|
-
readme = arq.read()
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
from setuptools import setup
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r", encoding="utf-8") as arq:
|
|
4
|
+
readme = arq.read()
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
setup(name='nano_wait',
|
|
8
|
+
version='2.0',
|
|
9
|
+
license='MIT License',
|
|
10
|
+
author='Luiz Filipe Seabra de Marco',
|
|
11
|
+
long_description=readme,
|
|
12
|
+
long_description_content_type="text/markdown",
|
|
13
|
+
author_email='luizfilipeseabra@icloud.com',
|
|
14
|
+
keywords='automation automação wifi wait',
|
|
15
|
+
description=u'Waiting Time Calculation for Automations Based on WiFi and PC Processing',
|
|
16
|
+
packages=['nano_wait'],
|
|
17
|
+
install_requires=['psutil','pywifi'],)
|
nano_wait-0.0.1/PKG-INFO
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: nano_wait
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: Waiting Time Calculation for Automations Based on WiFi and PC Processing
|
|
5
|
-
Author: Luiz Filipe Seabra de Marco
|
|
6
|
-
Author-email: luizfilipeseabra@icloud.com
|
|
7
|
-
License: MIT License
|
|
8
|
-
Keywords: automation automação wifi wait
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Requires-Dist: psutil
|
|
12
|
-
Requires-Dist: pywifi
|
|
13
|
-
Requires-Dist: time
|
|
14
|
-
|
|
15
|
-
# NanoWait
|
|
16
|
-
|
|
17
|
-
**NanoWait** é uma biblioteca Python para automação de tarefas com ajuste dinâmico do tempo de espera com base na qualidade da conexão WiFi e no desempenho do computador. É ideal para situações onde o tempo de espera deve ser ajustado de acordo com a condição da rede e do sistema para garantir que as operações de automação sejam executadas suavemente.
|
|
18
|
-
|
|
19
|
-
**Requisitos**
|
|
20
|
-
Antes de usar o NanoWait, você deve instalar as seguintes bibliotecas:
|
|
21
|
-
|
|
22
|
-
pywifi: Para verificar a qualidade do sinal WiFi.
|
|
23
|
-
psutil: Para monitorar o desempenho do sistema.
|
|
24
|
-
pyautogui: Para realizar ações de automação no computador.
|
|
25
|
-
|
|
26
|
-
**Principais Funções**
|
|
27
|
-
wait_wifi: Ela deve ser passada junto com speed e ssid. Ela calcula o tempo de espera considerando o Wifi e o processamento do PC.
|
|
28
|
-
wait_n_wifi: Ela deve ser passada junto com speed. Ela calcula o tempo de espera considerando o processamento do PC no momento.
|
nano_wait-0.0.1/README.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# NanoWait
|
|
2
|
-
|
|
3
|
-
**NanoWait** é uma biblioteca Python para automação de tarefas com ajuste dinâmico do tempo de espera com base na qualidade da conexão WiFi e no desempenho do computador. É ideal para situações onde o tempo de espera deve ser ajustado de acordo com a condição da rede e do sistema para garantir que as operações de automação sejam executadas suavemente.
|
|
4
|
-
|
|
5
|
-
**Requisitos**
|
|
6
|
-
Antes de usar o NanoWait, você deve instalar as seguintes bibliotecas:
|
|
7
|
-
|
|
8
|
-
pywifi: Para verificar a qualidade do sinal WiFi.
|
|
9
|
-
psutil: Para monitorar o desempenho do sistema.
|
|
10
|
-
pyautogui: Para realizar ações de automação no computador.
|
|
11
|
-
|
|
12
|
-
**Principais Funções**
|
|
13
|
-
wait_wifi: Ela deve ser passada junto com speed e ssid. Ela calcula o tempo de espera considerando o Wifi e o processamento do PC.
|
|
14
|
-
wait_n_wifi: Ela deve ser passada junto com speed. Ela calcula o tempo de espera considerando o processamento do PC no momento.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .nano_wait import *
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import pywifi
|
|
2
|
-
import psutil
|
|
3
|
-
import time
|
|
4
|
-
|
|
5
|
-
class NanoWait:
|
|
6
|
-
def __init__(self):
|
|
7
|
-
self.wifi = pywifi.PyWiFi()
|
|
8
|
-
self.interface = self.wifi.interfaces()[0]
|
|
9
|
-
|
|
10
|
-
def get_wifi_signal(self, ssid):
|
|
11
|
-
try:
|
|
12
|
-
self.interface.scan()
|
|
13
|
-
time.sleep(2) # Wait for WiFi scan
|
|
14
|
-
scan_results = self.interface.scan_results()
|
|
15
|
-
|
|
16
|
-
signal_strength = -100 # Default value for poor signal
|
|
17
|
-
|
|
18
|
-
for network in scan_results:
|
|
19
|
-
if network.ssid == ssid:
|
|
20
|
-
signal_strength = network.signal
|
|
21
|
-
break
|
|
22
|
-
else:
|
|
23
|
-
raise ValueError(f"WiFi network '{ssid}' not found.")
|
|
24
|
-
|
|
25
|
-
# Convert signal strength to a scale of 0 to 10
|
|
26
|
-
wifi_score = max(0, min(10, (signal_strength + 100) / 10))
|
|
27
|
-
return wifi_score
|
|
28
|
-
|
|
29
|
-
except Exception as e:
|
|
30
|
-
print(f"Error getting WiFi signal: {e}")
|
|
31
|
-
return 0
|
|
32
|
-
|
|
33
|
-
def get_pc_score(self):
|
|
34
|
-
try:
|
|
35
|
-
cpu_usage = psutil.cpu_percent(interval=1)
|
|
36
|
-
memory_usage = psutil.virtual_memory().percent
|
|
37
|
-
|
|
38
|
-
# Convert CPU and memory usage to a scale of 0 to 10
|
|
39
|
-
cpu_score = max(0, min(10, 10 - cpu_usage / 10))
|
|
40
|
-
memory_score = max(0, min(10, 10 - memory_usage / 10))
|
|
41
|
-
|
|
42
|
-
# Average score of CPU and memory
|
|
43
|
-
pc_score = (cpu_score + memory_score) / 2
|
|
44
|
-
return pc_score
|
|
45
|
-
|
|
46
|
-
except Exception as e:
|
|
47
|
-
print(f"Error getting PC score: {e}")
|
|
48
|
-
return 0
|
|
49
|
-
|
|
50
|
-
def wait_wifi(self, speed, ssid):
|
|
51
|
-
try:
|
|
52
|
-
pc_score = self.get_pc_score()
|
|
53
|
-
wifi_score = self.get_wifi_signal(ssid)
|
|
54
|
-
|
|
55
|
-
# Combined risk score
|
|
56
|
-
risk_score = (pc_score + wifi_score) / 2
|
|
57
|
-
|
|
58
|
-
# Calculate wait time based on speed and risk score
|
|
59
|
-
wait_time = max(1, (10 - risk_score) / speed)
|
|
60
|
-
return wait_time
|
|
61
|
-
|
|
62
|
-
except Exception as e:
|
|
63
|
-
print(f"Error in wait_wifi: {e}")
|
|
64
|
-
return 1
|
|
65
|
-
|
|
66
|
-
def wait_n_wifi(self, speed):
|
|
67
|
-
try:
|
|
68
|
-
pc_score = self.get_pc_score()
|
|
69
|
-
|
|
70
|
-
# Calculate wait time based on speed and risk score
|
|
71
|
-
wait_time = max(1, (10 - pc_score) / speed)
|
|
72
|
-
return wait_time
|
|
73
|
-
|
|
74
|
-
except Exception as e:
|
|
75
|
-
print(f"Error in wait_n_wifi: {e}")
|
|
76
|
-
return 1
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: nano_wait
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: Waiting Time Calculation for Automations Based on WiFi and PC Processing
|
|
5
|
-
Author: Luiz Filipe Seabra de Marco
|
|
6
|
-
Author-email: luizfilipeseabra@icloud.com
|
|
7
|
-
License: MIT License
|
|
8
|
-
Keywords: automation automação wifi wait
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Requires-Dist: psutil
|
|
12
|
-
Requires-Dist: pywifi
|
|
13
|
-
Requires-Dist: time
|
|
14
|
-
|
|
15
|
-
# NanoWait
|
|
16
|
-
|
|
17
|
-
**NanoWait** é uma biblioteca Python para automação de tarefas com ajuste dinâmico do tempo de espera com base na qualidade da conexão WiFi e no desempenho do computador. É ideal para situações onde o tempo de espera deve ser ajustado de acordo com a condição da rede e do sistema para garantir que as operações de automação sejam executadas suavemente.
|
|
18
|
-
|
|
19
|
-
**Requisitos**
|
|
20
|
-
Antes de usar o NanoWait, você deve instalar as seguintes bibliotecas:
|
|
21
|
-
|
|
22
|
-
pywifi: Para verificar a qualidade do sinal WiFi.
|
|
23
|
-
psutil: Para monitorar o desempenho do sistema.
|
|
24
|
-
pyautogui: Para realizar ações de automação no computador.
|
|
25
|
-
|
|
26
|
-
**Principais Funções**
|
|
27
|
-
wait_wifi: Ela deve ser passada junto com speed e ssid. Ela calcula o tempo de espera considerando o Wifi e o processamento do PC.
|
|
28
|
-
wait_n_wifi: Ela deve ser passada junto com speed. Ela calcula o tempo de espera considerando o processamento do PC no momento.
|
|
File without changes
|
|
File without changes
|