Skip to content

Commit

Permalink
Add dtype to DT constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoledoux committed Jun 3, 2024
1 parent 99d4fd6 commit 4a1828c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,22 @@ pub struct DT {
#[pymethods]
impl DT {
/// Constructor for a DT (returns an empty DT).
///
/// :param attributes_schema: Optional schema for attributes.
/// :type attributes_schema: Optional[PyAny]
#[new]
fn new() -> Self {
#[args(attributes_schema = "None")]
fn new(attributes_schema: Option<&PyAny>) -> Self {
let tmp = startin::Triangulation::new();
let tmp2 = Vec::new();
DT {
let mut dt = DT {
t: tmp,
dtype: tmp2,
};
if attributes_schema.is_some() {
let _ = dt.set_attributes_schema(&attributes_schema.unwrap());
}
dt
}

/// Get the points [x, y, z] of all vertices in the DT.
Expand Down

0 comments on commit 4a1828c

Please sign in to comment.