mirror of
https://github.com/hexedtech/codemp.git
synced 2024-11-22 15:24:48 +01:00
chore(python): minor changes
This commit is contained in:
parent
d6594928d9
commit
76e5320e6a
3 changed files with 6 additions and 5 deletions
|
@ -10,7 +10,7 @@ use pyo3::prelude::*;
|
|||
#[pymethods]
|
||||
impl Client {
|
||||
#[new]
|
||||
fn pyconnect(host: String, username: String, password: String) -> crate::Result<Self> {
|
||||
fn __new__(host: String, username: String, password: String) -> crate::Result<Self> {
|
||||
super::tokio().block_on(async move { Client::new(host, username, password).await })
|
||||
}
|
||||
|
||||
|
|
|
@ -96,10 +96,10 @@ impl Cursor {
|
|||
}
|
||||
|
||||
#[getter(user)]
|
||||
fn pyuser(&self) -> String {
|
||||
fn pyuser(&self) -> Option<String> {
|
||||
match self.user {
|
||||
Some(user) => user.to_string(),
|
||||
None => "".to_string(),
|
||||
Some(user) => Some(user.to_string()),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ fn tokio() -> &'static tokio::runtime::Runtime {
|
|||
RT.get_or_init(|| tokio::runtime::Runtime::new().unwrap())
|
||||
}
|
||||
|
||||
// workaround to allow the GIL to be released across awaits
|
||||
// workaround to allow the GIL to be released across awaits, waiting on
|
||||
// https://github.com/PyO3/pyo3/pull/3610
|
||||
struct AllowThreads<F>(F);
|
||||
|
||||
impl<F> Future for AllowThreads<F>
|
||||
|
|
Loading…
Reference in a new issue