headson 0.5.2__tar.gz → 0.5.3__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.
- {headson-0.5.2 → headson-0.5.3}/Cargo.lock +1 -1
- {headson-0.5.2 → headson-0.5.3}/Cargo.toml +1 -1
- {headson-0.5.2 → headson-0.5.3}/PKG-INFO +5 -4
- {headson-0.5.2 → headson-0.5.3}/README.md +4 -3
- {headson-0.5.2 → headson-0.5.3}/pyproject.toml +1 -1
- {headson-0.5.2 → headson-0.5.3}/python/Cargo.lock +2 -2
- {headson-0.5.2 → headson-0.5.3}/python/Cargo.toml +1 -1
- {headson-0.5.2 → headson-0.5.3}/src/main.rs +16 -9
- {headson-0.5.2 → headson-0.5.3}/JSONTestSuite/LICENSE +0 -0
- {headson-0.5.2 → headson-0.5.3}/JSONTestSuite/README.md +0 -0
- {headson-0.5.2 → headson-0.5.3}/LICENSE +0 -0
- {headson-0.5.2 → headson-0.5.3}/docs/assets/algorithm.svg +0 -0
- {headson-0.5.2 → headson-0.5.3}/python/README.md +0 -0
- {headson-0.5.2 → headson-0.5.3}/python/headson/__init__.py +0 -0
- {headson-0.5.2 → headson-0.5.3}/python/src/lib.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/json_ingest/builder.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/json_ingest/mod.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/json_ingest/samplers/default.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/json_ingest/samplers/head.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/json_ingest/samplers/mod.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/json_ingest/samplers/tail.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/lib.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/order/build.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/order/mod.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/order/scoring.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/order/snapshots/headson__order__build__tests__order_empty_array_order.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/order/snapshots/headson__order__build__tests__order_single_string_array_order.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/order/types.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/fileset.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/mod.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/snapshots/headson__serialization__tests__arena_render_empty.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/snapshots/headson__serialization__tests__arena_render_single.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/templates/core.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/templates/js.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/templates/json.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/templates/mod.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/templates/pseudo.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/serialization/types.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__order__tests__order_empty_array_order.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__order__tests__order_single_string_array_order.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__order__tests__pq_empty_array_queue.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__order__tests__pq_single_string_array_queue.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__queue__tests__pq_empty_array_queue.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__queue__tests__pq_single_string_array_queue.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__tree__tests__build_tree_empty.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__tree__tests__build_tree_single.snap +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/utils/graph.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/utils/json.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/utils/mod.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/utils/search.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/utils/text.rs +0 -0
- {headson-0.5.2 → headson-0.5.3}/src/utils/tree_arena.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: headson
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Classifier: Programming Language :: Python
|
|
5
5
|
Classifier: Programming Language :: Python :: 3
|
|
6
6
|
Classifier: Programming Language :: Rust
|
|
@@ -58,8 +58,9 @@ If you’re comfortable with tools like `head` and `tail`, use `headson` when yo
|
|
|
58
58
|
|
|
59
59
|
Common flags:
|
|
60
60
|
|
|
61
|
-
- `-n, --budget <BYTES>`: per‑file output budget. When multiple input files are provided, the total budget equals `<BYTES> * number_of_inputs`.
|
|
62
|
-
- `-N, --global-budget <BYTES>`: total output budget across all inputs. Useful when you want a fixed-size preview across many files (may omit entire files).
|
|
61
|
+
- `-n, --budget <BYTES>`: per‑file output budget. When multiple input files are provided, the default total budget equals `<BYTES> * number_of_inputs`.
|
|
62
|
+
- `-N, --global-budget <BYTES>`: total output budget across all inputs. Useful when you want a fixed-size preview across many files (may omit entire files).
|
|
63
|
+
- When used together with `--budget`, the final total budget is `min(global, per_file * number_of_inputs)`. Files are only truncated if they don't fit into this final global limit, and no single file expands beyond the per‑file budget.
|
|
63
64
|
- `-f, --template <json|pseudo|js>`: output style (default: `pseudo`)
|
|
64
65
|
- `-m, --compact`: no indentation, no spaces, no newlines
|
|
65
66
|
- `--no-newline`: single line output
|
|
@@ -167,7 +168,7 @@ print(
|
|
|
167
168
|
|
|
168
169
|
# Algorithm
|
|
169
170
|
|
|
170
|
-

|
|
171
|
+

|
|
171
172
|
|
|
172
173
|
## Footnotes
|
|
173
174
|
- <sup><b>[1]</b></sup> <b>Optimized tree representation</b>: An arena‑style tree stored in flat, contiguous buffers. Each node records its kind and value plus index ranges into shared child and key arrays. Arrays are ingested in a single pass and may be deterministically pre‑sampled: the first element is always kept; additional elements are selected via a fixed per‑index inclusion test; for kept elements, original indices are stored and full lengths are counted. This enables accurate omission info and internal gap markers later, while minimizing pointer chasing.
|
|
@@ -43,8 +43,9 @@ If you’re comfortable with tools like `head` and `tail`, use `headson` when yo
|
|
|
43
43
|
|
|
44
44
|
Common flags:
|
|
45
45
|
|
|
46
|
-
- `-n, --budget <BYTES>`: per‑file output budget. When multiple input files are provided, the total budget equals `<BYTES> * number_of_inputs`.
|
|
47
|
-
- `-N, --global-budget <BYTES>`: total output budget across all inputs. Useful when you want a fixed-size preview across many files (may omit entire files).
|
|
46
|
+
- `-n, --budget <BYTES>`: per‑file output budget. When multiple input files are provided, the default total budget equals `<BYTES> * number_of_inputs`.
|
|
47
|
+
- `-N, --global-budget <BYTES>`: total output budget across all inputs. Useful when you want a fixed-size preview across many files (may omit entire files).
|
|
48
|
+
- When used together with `--budget`, the final total budget is `min(global, per_file * number_of_inputs)`. Files are only truncated if they don't fit into this final global limit, and no single file expands beyond the per‑file budget.
|
|
48
49
|
- `-f, --template <json|pseudo|js>`: output style (default: `pseudo`)
|
|
49
50
|
- `-m, --compact`: no indentation, no spaces, no newlines
|
|
50
51
|
- `--no-newline`: single line output
|
|
@@ -152,7 +153,7 @@ print(
|
|
|
152
153
|
|
|
153
154
|
# Algorithm
|
|
154
155
|
|
|
155
|
-

|
|
156
|
+

|
|
156
157
|
|
|
157
158
|
## Footnotes
|
|
158
159
|
- <sup><b>[1]</b></sup> <b>Optimized tree representation</b>: An arena‑style tree stored in flat, contiguous buffers. Each node records its kind and value plus index ranges into shared child and key arrays. Arrays are ingested in a single pass and may be deterministically pre‑sampled: the first element is always kept; additional elements are selected via a fixed per‑index inclusion test; for kept elements, original indices are stored and full lengths are counted. This enables accurate omission info and internal gap markers later, while minimizing pointer chasing.
|
|
@@ -169,7 +169,7 @@ dependencies = [
|
|
|
169
169
|
|
|
170
170
|
[[package]]
|
|
171
171
|
name = "headson"
|
|
172
|
-
version = "0.5.
|
|
172
|
+
version = "0.5.3"
|
|
173
173
|
dependencies = [
|
|
174
174
|
"anyhow",
|
|
175
175
|
"clap",
|
|
@@ -182,7 +182,7 @@ dependencies = [
|
|
|
182
182
|
|
|
183
183
|
[[package]]
|
|
184
184
|
name = "headson-python"
|
|
185
|
-
version = "0.5.
|
|
185
|
+
version = "0.5.3"
|
|
186
186
|
dependencies = [
|
|
187
187
|
"anyhow",
|
|
188
188
|
"headson",
|
|
@@ -17,7 +17,7 @@ type IgnoreNotices = Vec<String>;
|
|
|
17
17
|
about = "Get a small but useful preview of a JSON file"
|
|
18
18
|
)]
|
|
19
19
|
struct Cli {
|
|
20
|
-
#[arg(short = 'n', long = "budget"
|
|
20
|
+
#[arg(short = 'n', long = "budget")]
|
|
21
21
|
budget: Option<usize>,
|
|
22
22
|
#[arg(short = 'f', long = "template", value_enum, default_value_t = Template::Pseudo)]
|
|
23
23
|
template: Template,
|
|
@@ -49,8 +49,7 @@ struct Cli {
|
|
|
49
49
|
short = 'N',
|
|
50
50
|
long = "global-budget",
|
|
51
51
|
value_name = "BYTES",
|
|
52
|
-
|
|
53
|
-
help = "Total output budget across all inputs; useful to keep multiple files within a fixed overall output size (may omit entire files)."
|
|
52
|
+
help = "Total output budget across all inputs. When combined with --budget, the effective global limit is the smaller of the two."
|
|
54
53
|
)]
|
|
55
54
|
global_budget: Option<usize>,
|
|
56
55
|
#[arg(
|
|
@@ -101,11 +100,11 @@ fn main() -> Result<()> {
|
|
|
101
100
|
}
|
|
102
101
|
|
|
103
102
|
fn compute_effective_budget(cli: &Cli, input_count: usize) -> usize {
|
|
104
|
-
|
|
105
|
-
g
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
match (cli.global_budget, cli.budget) {
|
|
104
|
+
(Some(g), Some(n)) => g.min(n.saturating_mul(input_count)),
|
|
105
|
+
(Some(g), None) => g,
|
|
106
|
+
(None, Some(n)) => n.saturating_mul(input_count),
|
|
107
|
+
(None, None) => 500usize.saturating_mul(input_count),
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
|
|
@@ -114,7 +113,15 @@ fn compute_priority(
|
|
|
114
113
|
effective_budget: usize,
|
|
115
114
|
input_count: usize,
|
|
116
115
|
) -> headson::PriorityConfig {
|
|
117
|
-
let per_file_for_priority =
|
|
116
|
+
let per_file_for_priority =
|
|
117
|
+
if cli.global_budget.is_some() && cli.budget.is_some() {
|
|
118
|
+
// When both limits are provided, base per-file heuristics on the per-file
|
|
119
|
+
// budget but also respect the effective per-file slice of the final global.
|
|
120
|
+
let eff_per_file = (effective_budget / input_count.max(1)).max(1);
|
|
121
|
+
cli.budget.unwrap().min(eff_per_file).max(1)
|
|
122
|
+
} else {
|
|
123
|
+
(effective_budget / input_count.max(1)).max(1)
|
|
124
|
+
};
|
|
118
125
|
get_priority_config(per_file_for_priority, cli)
|
|
119
126
|
}
|
|
120
127
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__order__tests__order_empty_array_order.snap
RENAMED
|
File without changes
|
|
File without changes
|
{headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__order__tests__pq_empty_array_queue.snap
RENAMED
|
File without changes
|
|
File without changes
|
{headson-0.5.2 → headson-0.5.3}/src/snapshots/headson__queue__tests__pq_empty_array_queue.snap
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|