Skip to content

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit intomasterfrom
sourcery/master

Conversation

@sourcery-ai
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot commented Apr 24, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai Bot requested a review from code4storm April 24, 2023 01:00
Comment thread test.py
def get_emails(self):
uids = self.mail.uid('SEARCH', 'ALL')[1][0].split()
return uids
return self.mail.uid('SEARCH', 'ALL')[1][0].split()
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EmailHelper.get_emails refactored with the following changes:

Comment thread test.py
Comment on lines -30 to +29
email_message = email.message_from_string(raw_email_string)
return email_message
return email.message_from_string(raw_email_string)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EmailHelper.get_email_message refactored with the following changes:

Comment thread test.py
Comment on lines -48 to +51
filename = uid.decode() + ".jpg"
filename = f"{uid.decode()}.jpg"
img_path = html_to_img_convertor.save_img(
html.encode(), output_dir, filename)
print(img_path)

filename = uid.decode() + ".pdf"
filename = f"{uid.decode()}.pdf"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 48-53 refactored with the following changes:

Comment thread lib/eml2html.py
Comment on lines -81 to +83
header_info = header_info + '<b>' + header + '</b>: '\
+ decoded_string + '<br/>'
header_info = f'{header_info}<b>{header}</b>: {decoded_string}<br/>'

return header_info + '<br/>'
return f'{header_info}<br/>'
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EmailtoHtml.__get_formatted_header_info refactored with the following changes:

Comment thread lib/eml2html.py
Comment on lines -92 to +96
hdr = ""
for element in decoded_header:
if isinstance(element[0], bytes):
hdr += str(element[0], element[1] or 'ASCII')
else:
hdr += element[0]
return hdr
return "".join(
str(element[0], element[1] or 'ASCII')
if isinstance(element[0], bytes)
else element[0]
for element in decoded_header
)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function EmailtoHtml.__get_utf8_header refactored with the following changes:

Comment thread lib/html2img.py
filename = "%s_%s%s" % (file_name_parts[0],
'_' + str(counter),
file_name_parts[1])
filename = f"{file_name_parts[0]}__{str(counter)}{file_name_parts[1]}"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function HtmltoImage.__get_unique_version refactored with the following changes:

Comment thread lib/html2img.py
Comment on lines -64 to +62
if ret_code > 0 and original_error == '':
if ret_code > 0 and not original_error:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function HtmltoImage.__process_errors refactored with the following changes:

Comment thread lib/html2pdf.py
filename = "%s_%s%s" % (file_name_parts[0],
'_' + str(counter),
file_name_parts[1])
filename = f"{file_name_parts[0]}__{str(counter)}{file_name_parts[1]}"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function HtmltoPdf.__get_unique_version refactored with the following changes:

Comment thread lib/html2pdf.py
Comment on lines -62 to +60
if ret_code > 0 and original_error == '':
if ret_code > 0 and not original_error:
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function HtmltoPdf.__process_errors refactored with the following changes:

Comment thread lib/utils.py
Comment on lines -9 to -15
except HTTPError:
except (HTTPError, URLError, ValueError):
return False
except URLError:
return False
except ValueError:
return False

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function can_url_fetch refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants