Skip to content

Commit 7291a40

Browse files
authored
Fix many docs (#78)
1 parent 8bbe8a2 commit 7291a40

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
12+
- `macro_const` 0.1.0 dependency
1313

1414
### Changed
1515

@@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525

2626
### Fixed
2727

28-
28+
- docstring for `many` method is added to each Rust feature class
2929

3030
### Security
3131

light-curve/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

light-curve/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ conv = "~0.3.3"
3333
enumflags2 = "~0.7.5"
3434
itertools = "~0.10.1"
3535
light-curve-dmdt = "0.5.0"
36+
macro_const = "0.1.0"
3637
ndarray = { version = "~0.15.3", features = ["rayon"] }
3738
numpy = "~0.15.1"
3839
num_cpus = "~1.13.0"

light-curve/src/features.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::np_array::{Arr, GenericFloatArray1};
66

77
use const_format::formatcp;
88
use light_curve_feature::{self as lcf, prelude::*, DataSample};
9+
use macro_const::macro_const;
910
use ndarray::IntoNdProducer;
1011
use numpy::IntoPyArray;
1112
use pyo3::exceptions::PyValueError;
@@ -52,14 +53,24 @@ __call__(t, m, sigma=None, sorted=None, check=True, fill_value=None)
5253
ndarray of np.float32 or np.float64
5354
Extracted feature array"#;
5455

55-
const METHOD_MANY_DOC: &str = r#"
56+
macro_const! {
57+
const METHOD_MANY_DOC: &str = r#"
5658
many(lcs, sorted=None, check=True, fill_value=None, n_jobs=-1)
5759
Parallel light curve feature extraction
5860
5961
It is a parallel executed equivalent of
60-
>>> def many(lcs, sorted=None, fill_value=None):
61-
... return np.stack([feature(*lc, sorted=sorted, fill_value=fill_value)
62-
... for lc in lcs])
62+
>>> def many(self, lcs, sorted=None, check=True, fill_value=None):
63+
... return np.stack(
64+
... [
65+
... self(
66+
... *lc,
67+
... sorted=sorted,
68+
... check=check,
69+
... fill_value=fill_value
70+
... )
71+
... for lc in lcs
72+
... ]
73+
... )
6374
6475
Parameters
6576
----------
@@ -78,6 +89,7 @@ many(lcs, sorted=None, check=True, fill_value=None, n_jobs=-1)
7889
Number of tasks to run in paralell. Default is -1 which means run as
7990
many jobs as CPU count. See rayon rust crate documentation for
8091
details"#;
92+
}
8193

8294
const METHODS_DOC: &str = formatcp!(
8395
r#"Methods
@@ -407,6 +419,7 @@ impl PyFeatureEvaluator {
407419
}
408420
}
409421

422+
#[doc = METHOD_MANY_DOC!()]
410423
#[args(lcs, sorted = "None", check = "true", fill_value = "None", n_jobs = -1)]
411424
fn many(
412425
&self,

0 commit comments

Comments
 (0)