Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvements #9

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading