Skip to content

Commit

Permalink
refactor(sdk/py): improve default parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
wfxr committed Feb 18, 2022
1 parent 1ae419d commit 2e8032c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion sdk/python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "oomclient-py"
version = "0.1.0"
version = "0.1.1-rc.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/examples/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ async def main():
10,Idaho,693,212,true
""".lstrip()
f.write(rows)
await client.import_(group, None, None, path, None)
await client.import_(group, input_file=path)

asyncio.run(main())
17 changes: 10 additions & 7 deletions sdk/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,14 @@ impl Client {
///
/// Returns:
/// None
#[pyo3(text_signature = "(group, revision_id, purge_delay)")]
#[pyo3(text_signature = "(group, purge_delay, revision_id=None)")]
#[args(revision_id = "None")]
pub fn sync<'p>(
&mut self,
py: Python<'p>,
group: String,
revision_id: Option<u32>,
purge_delay: u32,
revision_id: Option<u32>,
) -> PyResult<&'p PyAny> {
let mut inner = OomClient::clone(&self.inner);
future_into_py(py, async move {
Expand All @@ -184,22 +185,23 @@ impl Client {
/// For batch features, if revision is null, will use the
/// timestamp when it starts serving in online store; otherwise,
/// use the designated revision.
/// description: Description of this import.
/// input_file: The path of data source.
/// delimiter: Delimiter of data source.
/// description: Description of this import.
///
/// Returns:
/// revision_id: The revision ID of this import, it only applies to batch feature.
#[pyo3(name = "import_")]
#[pyo3(text_signature = "(group, revision, description, input_file, delimiter)")]
#[pyo3(text_signature = "(group, input_file, delimiter=None, revision=None, description=None)")]
#[args(delimiter = "None", revision = "None", description = "None")]
pub fn import<'p>(
&mut self,
py: Python<'p>,
group: String,
revision: Option<i64>,
description: Option<String>,
input_file: String,
delimiter: Option<String>,
revision: Option<i64>,
description: Option<String>,
) -> PyResult<&'p PyAny> {
let delimiter = delimiter
.map(|s| {
Expand Down Expand Up @@ -281,7 +283,8 @@ impl Client {
///
/// Returns:
/// None
#[pyo3(text_signature = "(features, unix_milli, output_file, limit)")]
#[pyo3(text_signature = "(features, unix_milli, output_file, limit=None)")]
#[args(limit = "None")]
pub fn export<'p>(
&mut self,
py: Python<'p>,
Expand Down

0 comments on commit 2e8032c

Please sign in to comment.