rollingstats 0.2.1__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.
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.env
|
|
3
|
+
.cache
|
|
4
|
+
*.pickle
|
|
5
|
+
__pycache__/
|
|
6
|
+
venv
|
|
7
|
+
wandb
|
|
8
|
+
logs/
|
|
9
|
+
.pyc
|
|
10
|
+
.venv*
|
|
11
|
+
.runpod_config.json
|
|
12
|
+
.claude
|
|
13
|
+
.direnv
|
|
14
|
+
.envrc
|
|
15
|
+
# .beads - now tracked for bd issue tracker
|
|
16
|
+
models
|
|
17
|
+
|
|
18
|
+
data/bash_arena_examples_from_fabian/
|
|
19
|
+
data/full_log_dump.txt
|
|
20
|
+
value_head_probes/
|
|
21
|
+
|
|
22
|
+
*.egg-info/
|
|
23
|
+
**/*.egg-info/
|
|
24
|
+
|
|
25
|
+
# Personal/private files
|
|
26
|
+
fabians_work_with_me_doc.me
|
|
27
|
+
CLAUDE.md
|
|
28
|
+
|
|
29
|
+
results/eval_results.db
|
|
30
|
+
results/control_monitors.duckdb
|
|
31
|
+
results/control_monitors_v2.db
|
|
32
|
+
results/control_monitors_v2.db-shm
|
|
33
|
+
results/control_monitors_v2.db-wal
|
|
34
|
+
results/control_monitors_v2.db.backup
|
|
35
|
+
results/backups/
|
|
36
|
+
|
|
37
|
+
# Cloned repos used for creating attack patches (large, reproducible)
|
|
38
|
+
**/repo/
|
|
39
|
+
**/repo
|
|
40
|
+
PR_vulnerabilities/eleutherai/lm-evaluation-harness/attacks-*
|
|
41
|
+
PR_vulnerabilities/eleutherai/lm-evaluation-harness/repo-*
|
|
42
|
+
PR_vulnerabilities/nix_fod_attack/
|
|
43
|
+
PR_vulnerabilities/pytorch_repo/
|
|
44
|
+
PR_vulnerabilities/vllm/disable_logging/
|
|
45
|
+
PR_vulnerabilities/vllm/example_framing_attack/
|
|
46
|
+
PR_vulnerabilities/vllm/indirection_attack/
|
|
47
|
+
PR_vulnerabilities/vllm/pytorch_downgrade_attack/
|
|
48
|
+
PR_vulnerabilities/vllm/trojan_ssrf_defaults/
|
|
49
|
+
PR_vulnerabilities/vllm/wet_attack/
|
|
50
|
+
PR_vulnerabilities/vllm/CVE_finding/
|
|
51
|
+
PR_vulnerabilities/vllm/CVE_search_current_version/
|
|
52
|
+
PR_vulnerabilities/vllm/vllm_repo/
|
|
53
|
+
PR_vulnerabilities/allenai/*/repo/
|
|
54
|
+
PR_vulnerabilities/allennlp/repo/
|
|
55
|
+
one_offs/fake_vs_real_transcripts/test_repo/
|
|
56
|
+
|
|
57
|
+
# Generated plots (reproducible from org files)
|
|
58
|
+
presentations/plots/
|
|
59
|
+
plots/
|
|
60
|
+
presentations/*.pptx
|
|
61
|
+
|
|
62
|
+
# Seed attempts db (backed up separately)
|
|
63
|
+
results/seed_attempts.db
|
|
64
|
+
|
|
65
|
+
# LLM response caches (regeneratable, expensive but not primary data)
|
|
66
|
+
results/mutation_verifier_cache*.json
|
|
67
|
+
results/mutation_monitor_eval.json
|
|
68
|
+
|
|
69
|
+
# Experiment training outputs (reproducible, large)
|
|
70
|
+
results/rl_camouflage/
|
|
71
|
+
results/evolve_attack/
|
|
72
|
+
results/control_monitors_v2.db.bak.*
|
|
73
|
+
|
|
74
|
+
# External repos
|
|
75
|
+
ext/
|
|
76
|
+
|
|
77
|
+
# Generated videos and scripts
|
|
78
|
+
results/*.mp4
|
|
79
|
+
/tmp/ytp_*.sh
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rollingstats
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Lightweight sliding-window counters for streaming aggregation
|
|
5
|
+
Project-URL: Homepage, https://github.com/ElleNajt/rollingstats
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# rollingstats
|
|
16
|
+
|
|
17
|
+
Lightweight sliding-window counters for streaming aggregation.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from rollingstats import SlidingCounter
|
|
21
|
+
|
|
22
|
+
counter = SlidingCounter(capacity=1000)
|
|
23
|
+
counter.add(42)
|
|
24
|
+
counter.add(58)
|
|
25
|
+
print(counter.total) # 100
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
pip install rollingstats
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
### `SlidingCounter(capacity)`
|
|
37
|
+
|
|
38
|
+
Maintains a running total over a sliding window. When the total exceeds
|
|
39
|
+
`capacity`, the oldest entries are evicted.
|
|
40
|
+
|
|
41
|
+
- `.add(value)` — append a value
|
|
42
|
+
- `.total` — current sum
|
|
43
|
+
- `.empty` — True if no values recorded
|
|
44
|
+
- `.reset()` — clear all entries
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# rollingstats
|
|
2
|
+
|
|
3
|
+
Lightweight sliding-window counters for streaming aggregation.
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from rollingstats import SlidingCounter
|
|
7
|
+
|
|
8
|
+
counter = SlidingCounter(capacity=1000)
|
|
9
|
+
counter.add(42)
|
|
10
|
+
counter.add(58)
|
|
11
|
+
print(counter.total) # 100
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
pip install rollingstats
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## API
|
|
21
|
+
|
|
22
|
+
### `SlidingCounter(capacity)`
|
|
23
|
+
|
|
24
|
+
Maintains a running total over a sliding window. When the total exceeds
|
|
25
|
+
`capacity`, the oldest entries are evicted.
|
|
26
|
+
|
|
27
|
+
- `.add(value)` — append a value
|
|
28
|
+
- `.total` — current sum
|
|
29
|
+
- `.empty` — True if no values recorded
|
|
30
|
+
- `.reset()` — clear all entries
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rollingstats"
|
|
7
|
+
version = "0.2.1"
|
|
8
|
+
description = "Lightweight sliding-window counters for streaming aggregation"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.9"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Software Development :: Libraries",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.urls]
|
|
21
|
+
Homepage = "https://github.com/ElleNajt/rollingstats"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Sliding-window counter with O(1) amortized updates."""
|
|
2
|
+
|
|
3
|
+
from collections import deque
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SlidingCounter:
|
|
7
|
+
"""Maintain a running total over the most recent *capacity* units.
|
|
8
|
+
|
|
9
|
+
Each call to :meth:`add` appends a value. When the cumulative sum
|
|
10
|
+
of all stored values exceeds *capacity*, the oldest entries are
|
|
11
|
+
discarded until the total fits.
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
capacity : int
|
|
16
|
+
Maximum total across the window. Older entries are evicted
|
|
17
|
+
once the running total exceeds this value.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
__slots__ = ("_capacity", "_total", "_queue")
|
|
21
|
+
|
|
22
|
+
def __init__(self, capacity: int) -> None:
|
|
23
|
+
self._capacity = capacity
|
|
24
|
+
self._total = 0
|
|
25
|
+
self._queue: deque[int] = deque()
|
|
26
|
+
|
|
27
|
+
def add(self, value: int) -> None:
|
|
28
|
+
"""Append *value* and evict stale entries."""
|
|
29
|
+
self._queue.append(value)
|
|
30
|
+
self._total += value
|
|
31
|
+
while len(self._queue) > 1 and self._total > self._capacity:
|
|
32
|
+
self._total -= self._queue.popleft()
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def total(self) -> int:
|
|
36
|
+
"""Current sum across the window."""
|
|
37
|
+
return self._total
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def empty(self) -> bool:
|
|
41
|
+
"""True when no values have been recorded."""
|
|
42
|
+
return self._total == 0
|
|
43
|
+
|
|
44
|
+
def reset(self) -> None:
|
|
45
|
+
"""Discard all entries."""
|
|
46
|
+
self._queue.clear()
|
|
47
|
+
self._total = 0
|