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

chore: Upgrade python syntax through pyupgrade #7326

Merged
merged 7 commits into from
Oct 6, 2020

Conversation

iamareebjamal
Copy link
Member

@iamareebjamal iamareebjamal commented Oct 6, 2020

  • Syntax Upgrades
  • Unused Imports removed
  • Redundant Alias removed

@@ -8,11 +8,11 @@ class TestFields(TestCase):
def test_extracts_fields(self):
self.assertTrue(
set(extract_from_marshmallow(SettingSchemaPublic)).issuperset(
set(['id', 'app_name', 'is_paytm_activated'])
{'id', 'app_name', 'is_paytm_activated'}

Choose a reason for hiding this comment

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

Black would make changes.

'title': u'Invitation to Submit Papers for {event_name}',
'message': u"You have been invited to submit papers for <strong>{event_name}</strong>.",
'title': 'Invitation to Submit Papers for {event_name}',
'message': "You have been invited to submit papers for <strong>{event_name}</strong>.",

Choose a reason for hiding this comment

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

line too long (95 > 90 characters)

'message': (
u"Your email has been changed from {email} to {new_email}.<br>Please verify your new email."
"Your email has been changed from {email} to {new_email}.<br>Please verify your new email."

Choose a reason for hiding this comment

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

line too long (103 > 90 characters)

+ u"<br/>Please contact the organizer for more info "
+ u"<br/>Message from the organizer: {cancel_note}."
"Your order for <a href='{event_url}'>{event_name}</a> has been cancelled by the organizer "
+ "<br/>You can visit your cancelled ticket here : <a href='{order_url}'>{invoice_id}</a> "

Choose a reason for hiding this comment

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

line too long (103 > 90 characters)

+ u"<br/>You can visit your cancelled ticket here : <a href='{order_url}'>{invoice_id}</a> "
+ u"<br/>Please contact the organizer for more info "
+ u"<br/>Message from the organizer: {cancel_note}."
"Your order for <a href='{event_url}'>{event_name}</a> has been cancelled by the organizer "

Choose a reason for hiding this comment

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

line too long (104 > 90 characters)

"Please pay within 2 days.<br><br>"
"Pay Now: <a href='{payment_url}'>{payment_url}</a><br><br>"
"Late payments can be subject to a 5% finance fee.<br><br>"
"A detailed invoice is available in <a href='https://eventyay.com/account/billing/invoices/'>the billing area</a> of your account. If you have any questions about invoices, please find more information on our FAQ at https://support.eventyay.com.<br><br>"

Choose a reason for hiding this comment

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

line too long (266 > 90 characters)

u"<em>Thank you for using {app_name}!</em><br><br>"
u"{app_name} Team"
"Hello {name},<br><br>"
"This is a reminder that we haven't received your payment for your invoice for {event_name} for {date}. Payment is fast and simple using your credit card or PayPal account.<br><br>"

Choose a reason for hiding this comment

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

line too long (193 > 90 characters)

),
'sent_at': '15th day of the month',
},
MONTHLY_PAYMENT_PRE_DUE_EMAIL: {
'recipient': 'Owner',
'subject': u'Reminder: Your invoice for {event_name} for {date} is available on {app_name}',
'subject': 'Reminder: Your invoice for {event_name} for {date} is available on {app_name}',

Choose a reason for hiding this comment

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

line too long (99 > 90 characters)

"Amount Due: {amount}<br><br>"
"Please pay within 15 days.<br><br>"
"Pay Now at: <a href='{payment_url}'>{payment_url}</a><br><br>"
"A detailed invoice is available in <a href='https://eventyay.com/account/billing/invoices/'>the billing area</a> of your account. If you have any questions about invoices, please find more information on our FAQ at https://support.eventyay.com.<br><br>"

Choose a reason for hiding this comment

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

line too long (266 > 90 characters)

u"<em>Thank you for using {app_name}!</em><br><br>"
u"{app_name} Team"
"Hello {name},<br><br>"
"Just a friendly reminder that we haven't received your payment for your invoice for {event_name} for {date}. Payment is fast and simple using your credit card or PayPal account.<br><br>"

Choose a reason for hiding this comment

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

line too long (199 > 90 characters)

@auto-label auto-label bot added the chore label Oct 6, 2020
),
'sent_at': '1st day of the month',
},
MONTHLY_PAYMENT_FOLLOWUP_EMAIL: {
'recipient': 'Owner',
'subject': u'Reminder: Your invoice for {event_name} for {date} is available on {app_name}',
'subject': 'Reminder: Your invoice for {event_name} for {date} is available on {app_name}',

Choose a reason for hiding this comment

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

line too long (99 > 90 characters)

"Amount Due: {amount}<br><br>"
"Please pay within 30 days.<br><br>"
"Pay Now at: <a href='{payment_url}'>{payment_url}</a><br><br>"
"A detailed invoice is available in <a href='https://eventyay.com/account/billing/invoices/'>the billing area</a> of your account. If you have any questions about invoices, please find more information on our FAQ at https://support.eventyay.com.<br><br>"

Choose a reason for hiding this comment

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

line too long (266 > 90 characters)

u"<em>Thank you for using {app_name}!</em><br><br>"
u"{app_name} Team"
"Hello {name},<br><br>"
"The invoice for your event {event_name} on eventyay.com for {date} is now available. Your invoice payment is due within 30 days.<br><br>"

Choose a reason for hiding this comment

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

line too long (150 > 90 characters)

u"purchase your ticket for this event."
u"<br><br><em>Looking forward to seeing you at the event.</em>"
"This is just a gentle reminder that the payment for your order {invoice_id} is still left."
+ "<br/> The tickets for this event are still available. <a href='{order_url}'>Click here</a> to "

Choose a reason for hiding this comment

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

line too long (110 > 90 characters)

+ u"<br/> The tickets for this event are still available. <a href='{order_url}'>Click here</a> to "
u"purchase your ticket for this event."
u"<br><br><em>Looking forward to seeing you at the event.</em>"
"This is just a gentle reminder that the payment for your order {invoice_id} is still left."

Choose a reason for hiding this comment

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

line too long (104 > 90 characters)

+ u"To accept the role please sign up using the following link: <a href='{link}' target='_blank'>Link</a>."
"Hello {email},<br><br>"
+ "You've been invited to be a <strong>{role}</strong> at <strong>{event}</strong>.<br>"
+ "To accept the role please sign up using the following link: <a href='{link}' target='_blank'>Link</a>."

Choose a reason for hiding this comment

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

line too long (118 > 90 characters)

+ u"You've been invited to be a <strong>{role}</strong> at <strong>{event}</strong>.<br>"
+ u"To accept the role please sign up using the following link: <a href='{link}' target='_blank'>Link</a>."
"Hello {email},<br><br>"
+ "You've been invited to be a <strong>{role}</strong> at <strong>{event}</strong>.<br>"

Choose a reason for hiding this comment

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

line too long (100 > 90 characters)

'message': (
u"Your password has been successfully changed. Please login with your new password."
"Your password has been successfully changed. Please login with your new password."

Choose a reason for hiding this comment

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

line too long (95 > 90 characters)

'message': (
u"Please use the following link to reset your password and verify your account."
"Please use the following link to reset your password and verify your account."

Choose a reason for hiding this comment

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

line too long (91 > 90 characters)

'message': (
u"Please use the following link to reset your password.<br> <a href='{link}' target='_blank'>{link}</a>"
"Please use the following link to reset your password.<br> <a href='{link}' target='_blank'>{link}</a>"

Choose a reason for hiding this comment

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

line too long (115 > 90 characters)

@codecov
Copy link

codecov bot commented Oct 6, 2020

Codecov Report

Merging #7326 into development will not change coverage.
The diff coverage is 20.68%.

Impacted file tree graph

@@             Coverage Diff              @@
##           development    #7326   +/-   ##
============================================
  Coverage        64.08%   64.08%           
============================================
  Files              259      259           
  Lines            13104    13104           
============================================
  Hits              8398     8398           
  Misses            4706     4706           
Impacted Files Coverage Δ
app/api/access_codes.py 51.21% <ø> (ø)
app/api/admin_sales/invoices.py 93.10% <0.00%> (ø)
app/api/admin_translations.py 55.00% <0.00%> (ø)
app/api/auth.py 23.82% <0.00%> (ø)
app/api/custom/orders.py 36.99% <0.00%> (ø)
app/api/event_topics.py 40.62% <0.00%> (ø)
app/api/helpers/checksum.py 24.67% <0.00%> (ø)
app/api/helpers/mail.py 37.39% <0.00%> (ø)
app/api/helpers/notification.py 78.57% <ø> (ø)
app/api/helpers/payment.py 24.05% <0.00%> (ø)
... and 39 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d64e389...961d91e. Read the comment docs.

u"Hi {email},<br/>"
+ u"Your email has been already changed from {email} to {new_email}. You should verify your new email"
"Hi {email},<br/>"
+ "Your email has been already changed from {email} to {new_email}. You should verify your new email"

Choose a reason for hiding this comment

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

line too long (113 > 90 characters)

u"Hi {email},<br/>"
+ u"Please visit this link to confirm your email: <a href='{link}' target='_blank'>{link}</a>"
"Hi {email},<br/>"
+ "Please visit this link to confirm your email: <a href='{link}' target='_blank'>{link}</a>"

Choose a reason for hiding this comment

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

line too long (106 > 90 characters)

+ u"<br/> Visit this link to view the session: <a href='{link}' target='_blank'>{link}</a>"
"Hi {email},<br/>"
+ "The event <strong>{event_name}</strong> has received a new session proposal. "
+ "<br/> Visit this link to view the session: <a href='{link}' target='_blank'>{link}</a>"

Choose a reason for hiding this comment

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

line too long (102 > 90 characters)

+ u"The event <strong>{event_name}</strong> has received a new session proposal. "
+ u"<br/> Visit this link to view the session: <a href='{link}' target='_blank'>{link}</a>"
"Hi {email},<br/>"
+ "The event <strong>{event_name}</strong> has received a new session proposal. "

Choose a reason for hiding this comment

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

line too long (93 > 90 characters)

+ u"The schedule for session <strong>{session_name}</strong> has been changed. "
+ u"<br/> Visit this link to view the session: {link}"
"Hi {email},<br/>"
+ "The schedule for session <strong>{session_name}</strong> has been changed. "

Choose a reason for hiding this comment

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

line too long (91 > 90 characters)

'https://creativecommons.org/licenses/by-nc/4.0',
'https://licensebuttons.net/l/by-nc/3.0/88x31.png',
'https://licensebuttons.net/l/by-nc/3.0/80x15.png',
),
'Attribution-NonCommercial-NoDerivs': (
'Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International License',
u'This license only allows others to download the work and share them with others as long as they credit the '
u'copyright holder, but they can’t change them in any way or use them commercially.',
'This license only allows others to download the work and share them with others as long as they credit the '

Choose a reason for hiding this comment

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

line too long (117 > 90 characters)

u'works must also acknowledge the copyright holder and be non-commercial, they don’t have to license their '
u'derivative works on the same terms.',
'This license lets others remix, tweak, and build upon the work non-commercially, and although their new '
'works must also acknowledge the copyright holder and be non-commercial, they don’t have to license their '

Choose a reason for hiding this comment

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

line too long (115 > 90 characters)

u'This license lets others remix, tweak, and build upon the work non-commercially, and although their new '
u'works must also acknowledge the copyright holder and be non-commercial, they don’t have to license their '
u'derivative works on the same terms.',
'This license lets others remix, tweak, and build upon the work non-commercially, and although their new '

Choose a reason for hiding this comment

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

line too long (114 > 90 characters)

'https://creativecommons.org/licenses/by-sa/4.0',
'https://licensebuttons.net/l/by-sa/3.0/88x31.png',
'https://licensebuttons.net/l/by-sa/3.0/80x15.png',
),
'Attribution-NoDerivs': (
'Creative Commons Attribution-NoDerivs 4.0 International License',
u'This license allows for redistribution, commercial and non-commercial, as long as it is passed along '
u'unchanged and in whole, with credit to the copyright holder.',
'This license allows for redistribution, commercial and non-commercial, as long as it is passed along '

Choose a reason for hiding this comment

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

line too long (111 > 90 characters)

u'This license lets others remix, tweak, and build upon the work even for commercial purposes, as long as '
u'they credit the copyright holder and license their new creations under the identical terms.',
'This license lets others remix, tweak, and build upon the work even for commercial purposes, as long as '
'they credit the copyright holder and license their new creations under the identical terms.',

Choose a reason for hiding this comment

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

line too long (102 > 90 characters)

'https://creativecommons.org/licenses/by/4.0',
'https://licensebuttons.net/l/by/3.0/88x31.png',
'https://licensebuttons.net/l/by/3.0/80x15.png',
),
'Attribution-ShareAlike': (
'Creative Commons Attribution-ShareAlike 4.0 International License',
u'This license lets others remix, tweak, and build upon the work even for commercial purposes, as long as '
u'they credit the copyright holder and license their new creations under the identical terms.',
'This license lets others remix, tweak, and build upon the work even for commercial purposes, as long as '

Choose a reason for hiding this comment

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

line too long (114 > 90 characters)

'https://en.wikipedia.org/wiki/All_rights_reserved',
'',
'',
),
'Attribution': (
'Creative Commons Attribution 4.0 International License',
u'This license lets others distribute, remix, tweak, and build upon the work, even commercially, as long as '
u'they credit the copyright holder for the original creation.',
'This license lets others distribute, remix, tweak, and build upon the work, even commercially, as long as '

Choose a reason for hiding this comment

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

line too long (116 > 90 characters)

@@ -10,74 +8,74 @@
# Licence Name : ( Long Name, Description, Licence URL, Licence Logo, Licence Compact Logo )
'All rights reserved': (
'All rights reserved',
u'The copyright holder reserves, or holds for their own use, all the rights provided by copyright law under '
u'one specific copyright treaty.',
'The copyright holder reserves, or holds for their own use, all the rights provided by copyright law under '

Choose a reason for hiding this comment

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

line too long (116 > 90 characters)

@@ -14,7 +14,7 @@
def generate_checksum(param_dict, merchant_key, salt=None):
params_string = __get_param_string__(param_dict)
salt = salt if salt else __id_generator__(4)
final_string = '%s|%s' % (params_string, salt)
final_string = f'{params_string}|{salt}'

Choose a reason for hiding this comment

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

Black would make changes.

@iamareebjamal iamareebjamal merged commit 1e050e8 into fossasia:development Oct 6, 2020
@iamareebjamal iamareebjamal deleted the pyupgrade branch October 6, 2020 23:40
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Oct 7, 2020

This pull request introduces 1 alert and fixes 5 when merging 89b7afb into d64e389 - view on LGTM.com

new alerts:

  • 1 for Unused local variable

fixed alerts:

  • 4 for Unused import
  • 1 for Wrong number of arguments for format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants