Skip to content

Commit

Permalink
Merge pull request #9 from Mng-dev-ai/improvments
Browse files Browse the repository at this point in the history
improvements
  • Loading branch information
Mng-dev-ai authored Nov 23, 2023
2 parents 1acf63d + 8b8f335 commit 84a9024
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ impl ToPyObject for Result {
fn to_object(&self, py: Python) -> PyObject {
let dict = PyDict::new(py);

dict.set_item("email", self.email.to_object(py)).unwrap();
dict.set_item("has_valid_syntax", self.has_valid_syntax.to_object(py))
dict.set_item("email", self.email.clone()).unwrap();
dict.set_item("has_valid_syntax", self.has_valid_syntax)
.unwrap();
if let Some(mx) = self.mx.as_ref() {
dict.set_item("mx", mx.to_object(py)).unwrap()
dict.set_item("mx", mx).unwrap()
}
if let Some(misc) = self.misc.as_ref() {
dict.set_item("misc", misc.to_object(py)).unwrap()
dict.set_item("misc", misc).unwrap()
}
if let Some(smtp) = self.smtp.as_ref() {
dict.set_item("smtp", smtp.to_object(py)).unwrap()
dict.set_item("smtp", smtp).unwrap()
}
dict.to_object(py)
dict.into()
}
}
#[pyfunction]
Expand Down
10 changes: 4 additions & 6 deletions src/misc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ impl Misc {
impl ToPyObject for Misc {
fn to_object(&self, py: Python) -> PyObject {
let dict = PyDict::new(py);
dict.set_item("is_disposable", self.is_disposable.to_object(py))
dict.set_item("is_disposable", self.is_disposable).unwrap();
dict.set_item("is_free", self.is_free).unwrap();
dict.set_item("is_role_account", self.is_role_account)
.unwrap();
dict.set_item("is_free", self.is_free.to_object(py))
.unwrap();
dict.set_item("is_role_account", self.is_role_account.to_object(py))
.unwrap();
dict.to_object(py)
dict.into()
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/mx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ impl Mx {
impl ToPyObject for Mx {
fn to_object(&self, py: Python) -> PyObject {
let dict = PyDict::new(py);
dict.set_item("has_mx_records", self.has_mx_records.to_object(py))
dict.set_item("has_mx_records", self.has_mx_records)
.unwrap();
dict.set_item("mx_records", self.mx_records.to_object(py))
dict.set_item("mx_records", self.mx_records.clone())
.unwrap();
dict.to_object(py)
dict.into()
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Settings {
let from_email = get_string_from_env("FROM_EMAIL", "[email protected]");
let hello_name = get_string_from_env("HELLO_NAME", "localhost");
let smtp_port = get_int_from_env("SMTP_PORT", 25);
let smtp_timeout = get_int_from_env("SMTP_TIMEOUT", 10);
let smtp_timeout = get_int_from_env("SMTP_TIMEOUT", 5);
let check_smtp = match std::env::var("CHECK_SMTP") {
Ok(val) => val == "true",
Err(_) => false,
Expand Down
4 changes: 2 additions & 2 deletions src/smtp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ impl Smtp {
impl ToPyObject for Smtp {
fn to_object(&self, py: Python) -> PyObject {
let dict = PyDict::new(py);
dict.set_item("is_deliverable", self.is_deliverable.to_object(py))
dict.set_item("is_deliverable", self.is_deliverable)
.unwrap();
dict.to_object(py)
dict.into()
}
}
impl Smtp {
Expand Down

0 comments on commit 84a9024

Please sign in to comment.