fastled 1.2.54__py3-none-any.whl → 1.2.56__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.
- fastled/__init__.py +1 -1
- fastled/client_server.py +8 -7
- fastled/filewatcher.py +70 -0
- fastled/string_diff.py +23 -5
- {fastled-1.2.54.dist-info → fastled-1.2.56.dist-info}/METADATA +1 -1
- {fastled-1.2.54.dist-info → fastled-1.2.56.dist-info}/RECORD +10 -10
- {fastled-1.2.54.dist-info → fastled-1.2.56.dist-info}/WHEEL +0 -0
- {fastled-1.2.54.dist-info → fastled-1.2.56.dist-info}/entry_points.txt +0 -0
- {fastled-1.2.54.dist-info → fastled-1.2.56.dist-info}/licenses/LICENSE +0 -0
- {fastled-1.2.54.dist-info → fastled-1.2.56.dist-info}/top_level.txt +0 -0
fastled/__init__.py
CHANGED
@@ -13,7 +13,7 @@ from .types import BuildMode, CompileResult, CompileServerError
|
|
13
13
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
14
14
|
# that has any other change in the repo. Please bump the version as the
|
15
15
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
16
|
-
__version__ = "1.2.
|
16
|
+
__version__ = "1.2.56"
|
17
17
|
|
18
18
|
DOCKER_FILE = (
|
19
19
|
"https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
|
fastled/client_server.py
CHANGED
@@ -7,7 +7,7 @@ from pathlib import Path
|
|
7
7
|
|
8
8
|
from fastled.compile_server import CompileServer
|
9
9
|
from fastled.docker_manager import DockerManager
|
10
|
-
from fastled.filewatcher import FileWatcherProcess
|
10
|
+
from fastled.filewatcher import DebouncedFileWatcherProcess, FileWatcherProcess
|
11
11
|
from fastled.keyboard import SpaceBarWatcher
|
12
12
|
from fastled.open_browser import open_browser_process
|
13
13
|
from fastled.parse_args import Args
|
@@ -231,9 +231,8 @@ def run_client(
|
|
231
231
|
return 1
|
232
232
|
|
233
233
|
excluded_patterns = ["fastled_js"]
|
234
|
-
|
235
|
-
|
236
|
-
directory, excluded_patterns=excluded_patterns
|
234
|
+
debounced_sketch_watcher = DebouncedFileWatcherProcess(
|
235
|
+
FileWatcherProcess(directory, excluded_patterns=excluded_patterns),
|
237
236
|
)
|
238
237
|
|
239
238
|
source_code_watcher: FileWatcherProcess | None = None
|
@@ -246,7 +245,7 @@ def run_client(
|
|
246
245
|
def trigger_rebuild_if_sketch_changed(
|
247
246
|
last_compiled_result: CompileResult,
|
248
247
|
) -> tuple[bool, CompileResult]:
|
249
|
-
changed_files =
|
248
|
+
changed_files = debounced_sketch_watcher.get_all_changes()
|
250
249
|
if changed_files:
|
251
250
|
print(f"\nChanges detected in {changed_files}")
|
252
251
|
last_hash_value = last_compiled_result.hash_value
|
@@ -301,7 +300,9 @@ def run_client(
|
|
301
300
|
timeout=1.0
|
302
301
|
)
|
303
302
|
file_changes = source_code_watcher.get_all_changes()
|
304
|
-
sketch_files_changed =
|
303
|
+
sketch_files_changed = (
|
304
|
+
debounced_sketch_watcher.get_all_changes()
|
305
|
+
)
|
305
306
|
|
306
307
|
if file_changes:
|
307
308
|
print(
|
@@ -331,7 +332,7 @@ def run_client(
|
|
331
332
|
print(f"Error: {e}")
|
332
333
|
return 1
|
333
334
|
finally:
|
334
|
-
|
335
|
+
debounced_sketch_watcher.stop()
|
335
336
|
if compile_server:
|
336
337
|
compile_server.stop()
|
337
338
|
if browser_proc:
|
fastled/filewatcher.py
CHANGED
@@ -208,6 +208,7 @@ class FileWatcherProcess:
|
|
208
208
|
daemon=True,
|
209
209
|
)
|
210
210
|
self.process.start()
|
211
|
+
self.global_debounce = FILE_CHANGED_DEBOUNCE_SECONDS
|
211
212
|
|
212
213
|
def stop(self):
|
213
214
|
self.process.terminate()
|
@@ -226,3 +227,72 @@ class FileWatcherProcess:
|
|
226
227
|
except Empty:
|
227
228
|
break
|
228
229
|
return changed_files
|
230
|
+
|
231
|
+
|
232
|
+
# DEBOUNCE_SECONDS = 4
|
233
|
+
# LAST_TIME = 0.0
|
234
|
+
# WATCHED_FILES: list[str] = []
|
235
|
+
|
236
|
+
# def debounced_sketch_filewatcher_get_all_changes() -> list[str]:
|
237
|
+
# nonlocal DEBOUNCE_SECONDS
|
238
|
+
# nonlocal LAST_TIME
|
239
|
+
# nonlocal WATCHED_FILES
|
240
|
+
# current_time = time.time()
|
241
|
+
# new_files = sketch_filewatcher.get_all_changes()
|
242
|
+
# if new_files:
|
243
|
+
# WATCHED_FILES.extend(new_files)
|
244
|
+
# print(f"Changes detected in {new_files}")
|
245
|
+
# LAST_TIME = current_time
|
246
|
+
# return []
|
247
|
+
# diff = current_time - LAST_TIME
|
248
|
+
# if diff > DEBOUNCE_SECONDS and len(WATCHED_FILES) > 0:
|
249
|
+
# LAST_TIME = current_time
|
250
|
+
# WATCHED_FILES, changed_files = [], WATCHED_FILES
|
251
|
+
# changed_files = sorted(list(set(changed_files)))
|
252
|
+
# return changed_files
|
253
|
+
# return []
|
254
|
+
|
255
|
+
|
256
|
+
class DebouncedFileWatcherProcess:
|
257
|
+
"""
|
258
|
+
Wraps a FileWatcherProcess to batch rapid-fire change events
|
259
|
+
and only emit them once the debounce interval has passed.
|
260
|
+
"""
|
261
|
+
|
262
|
+
def __init__(
|
263
|
+
self,
|
264
|
+
watcher: FileWatcherProcess,
|
265
|
+
debounce_seconds: float = FILE_CHANGED_DEBOUNCE_SECONDS,
|
266
|
+
) -> None:
|
267
|
+
self.watcher = watcher
|
268
|
+
self.debounce_seconds = debounce_seconds
|
269
|
+
self._last_time = 0.0
|
270
|
+
self._watched_files: list[str] = []
|
271
|
+
|
272
|
+
def get_all_changes(self, timeout: float | None = None) -> list[str]:
|
273
|
+
"""
|
274
|
+
Polls the underlying watcher for raw events, accumulates them,
|
275
|
+
and once no new events arrive for `debounce_seconds`, flushes
|
276
|
+
a sorted, unique list of paths.
|
277
|
+
"""
|
278
|
+
now = time.time()
|
279
|
+
# pull in any new raw events
|
280
|
+
new = self.watcher.get_all_changes(timeout=timeout)
|
281
|
+
if new:
|
282
|
+
self._watched_files.extend(new)
|
283
|
+
# reset the window
|
284
|
+
self._last_time = now
|
285
|
+
return []
|
286
|
+
|
287
|
+
# if the window has elapsed, flush
|
288
|
+
if self._watched_files and (now - self._last_time) > self.debounce_seconds:
|
289
|
+
batch = sorted(set(self._watched_files))
|
290
|
+
self._watched_files.clear()
|
291
|
+
self._last_time = now
|
292
|
+
return batch
|
293
|
+
|
294
|
+
return []
|
295
|
+
|
296
|
+
def stop(self) -> None:
|
297
|
+
"""Tear down the underlying watcher process."""
|
298
|
+
self.watcher.stop()
|
fastled/string_diff.py
CHANGED
@@ -13,10 +13,26 @@ def string_diff(
|
|
13
13
|
def normalize(s: str) -> str:
|
14
14
|
return s.lower() if ignore_case else s
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
map_string: dict[str, str] = {}
|
17
|
+
|
18
|
+
if ignore_case:
|
19
|
+
map_string = {s.lower(): s for s in string_list}
|
20
|
+
else:
|
21
|
+
map_string = {s: s for s in string_list}
|
22
|
+
|
23
|
+
if ignore_case:
|
24
|
+
string_list = [s.lower() for s in string_list]
|
25
|
+
input_string = input_string.lower()
|
26
|
+
|
27
|
+
is_substring = False
|
28
|
+
for s in string_list:
|
29
|
+
if input_string in s:
|
30
|
+
is_substring = True
|
31
|
+
break
|
32
|
+
|
33
|
+
if is_substring:
|
34
|
+
string_list = [s for s in string_list if input_string in s]
|
35
|
+
|
20
36
|
distances: list[float] = []
|
21
37
|
for s in string_list:
|
22
38
|
dist = fuzz.token_sort_ratio(normalize(input_string), normalize(s))
|
@@ -25,7 +41,9 @@ def string_diff(
|
|
25
41
|
out: list[tuple[float, str]] = []
|
26
42
|
for i, d in enumerate(distances):
|
27
43
|
if d == min_distance:
|
28
|
-
|
44
|
+
s = string_list[i]
|
45
|
+
s_mapped = map_string.get(s, s)
|
46
|
+
out.append((i, s_mapped))
|
29
47
|
|
30
48
|
return out
|
31
49
|
|
@@ -1,12 +1,12 @@
|
|
1
|
-
fastled/__init__.py,sha256=
|
1
|
+
fastled/__init__.py,sha256=Yl-Cnqlk0DqPqeej0Sndfye5L_ASV1Pzup9FRmpOXy8,6734
|
2
2
|
fastled/app.py,sha256=Ozn7OJ0rz3CEHsJKMhFLxV7TisRKo4DuFpVhrf5FQNw,3944
|
3
3
|
fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
|
4
4
|
fastled/cli_test.py,sha256=qJB9yLRFR3OwOwdIWSQ0fQsWLnA37v5pDccufiP_hTs,512
|
5
|
-
fastled/client_server.py,sha256=
|
5
|
+
fastled/client_server.py,sha256=Pr_b_406XpB6QLrlRMV3mwM82x25s1bIGFU0O0XA3yk,14931
|
6
6
|
fastled/compile_server.py,sha256=ul3eiZNX2wwmInooo3PJC3_kNpdejYVDIo94G3sV9HQ,2941
|
7
7
|
fastled/compile_server_impl.py,sha256=xhC7WBlIfvghgpxAP8VwBeM13NuTA99cI47prODW-IU,9927
|
8
8
|
fastled/docker_manager.py,sha256=VVyfl4HNsSB95nlENuccZFR0qL3Y0ZJgPCFyHKa9A14,31459
|
9
|
-
fastled/filewatcher.py,sha256=
|
9
|
+
fastled/filewatcher.py,sha256=40XZ2euBg5ZMHsjv8obxHApVAUE5ztUEd7FTGqtgsMc,9826
|
10
10
|
fastled/interactive_srcs.py,sha256=F5nHdJc60xsnmOtnKhngE9JytqGn56PmYw_MVSIX1ac,138
|
11
11
|
fastled/keyboard.py,sha256=UTAsqCn1UMYnB8YDzENiLTj4GeL45tYfEcO7_5fLFEg,3556
|
12
12
|
fastled/live_client.py,sha256=MDauol0mxtXggV1Pv9ahC0Jjg_4wnnV6FjGEtdd9cxU,2763
|
@@ -19,7 +19,7 @@ fastled/select_sketch_directory.py,sha256=TZdCjl1D7YMKjodMTvDRurPcpAmN3x0TcJxffE
|
|
19
19
|
fastled/settings.py,sha256=Gr_KewMhBHTnlPYesHkbN_A3sEkjdVTh1pkNpkZwZrk,468
|
20
20
|
fastled/sketch.py,sha256=tHckjDj8P6BI_LWzUFM071a9qcqPs-r-qFWIe50P5Xw,3391
|
21
21
|
fastled/spinner.py,sha256=VHxmvB92P0Z_zYxRajb5HiNmkHHvZ5dG7hKtZltzpcs,867
|
22
|
-
fastled/string_diff.py,sha256=
|
22
|
+
fastled/string_diff.py,sha256=9Q_36W0j7HvTnvfemdq9Ldi5RznGj0duX0Y3sZmVwJI,1730
|
23
23
|
fastled/types.py,sha256=ZFqHxYIGSeQb9FiImA5KDXZLhmmVSjOrIQDduwxmCZw,4494
|
24
24
|
fastled/util.py,sha256=t4M3NFMhnCzfYbLvIyJi0RdFssZqbTN_vVIaej1WV-U,265
|
25
25
|
fastled/web_compile.py,sha256=H2Tm5kMBaRjqdHqxv7L3-xSeYNHi0k0P-XM0Cn9esOo,10360
|
@@ -28,9 +28,9 @@ fastled/site/build.py,sha256=pjsaeHQQh_Zdh1g5Q78lYlUT7UPDFuNgW5YZkpsPxWc,14436
|
|
28
28
|
fastled/site/examples.py,sha256=s6vj2zJc6BfKlnbwXr1QWY1mzuDBMt6j5MEBOWjO_U8,155
|
29
29
|
fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
|
30
30
|
fastled/test/examples.py,sha256=GfaHeY1E8izBl6ZqDVjz--RHLyVR4NRnQ5pBesCFJFY,1673
|
31
|
-
fastled-1.2.
|
32
|
-
fastled-1.2.
|
33
|
-
fastled-1.2.
|
34
|
-
fastled-1.2.
|
35
|
-
fastled-1.2.
|
36
|
-
fastled-1.2.
|
31
|
+
fastled-1.2.56.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
32
|
+
fastled-1.2.56.dist-info/METADATA,sha256=WQv0fTusPKE2fZUOU1p3_CugvsgXoZE0X5t8QPehyE0,21668
|
33
|
+
fastled-1.2.56.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
34
|
+
fastled-1.2.56.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
|
35
|
+
fastled-1.2.56.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
|
36
|
+
fastled-1.2.56.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|