-
Notifications
You must be signed in to change notification settings - Fork 81
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
Moving to Py3 #550
Moving to Py3 #550
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- We can't replace
__
with_
. A solution for that has to be found. - Seemingly spurious insertions of
list()
wrappers. Some are necessary. Others are likely not.
@@ -24,7 +24,7 @@ class CampaignContentForm(forms.Form): | |||
validators=[forms.validators.Optional(), forms.validators.AllUrlsValid()]) | |||
banner_image = forms.URLField(__("Banner image URL"), validators=[forms.validators.Optional()], # TODO: Use ImgeeField | |||
description=__("An image to illustrate your campaign")) | |||
banner_location = forms.RadioField(__("Banner location"), choices=BANNER_LOCATION.items(), coerce=int, | |||
banner_location = forms.RadioField(__("Banner location"), choices=list(BANNER_LOCATION.items()), coerce=int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, list()
is necessary as we are replacing a frame object with a list.
@@ -18,7 +18,7 @@ def format_geonameids(geonameids): | |||
|
|||
def get_currency_choices(): | |||
choices = [('', __('None'))] | |||
choices.extend(CURRENCY.items()) | |||
choices.extend(list(CURRENCY.items())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will work without the list()
.
hasjob/models/__init__.py
Outdated
@@ -6,7 +6,7 @@ | |||
from coaster.db import db | |||
from coaster.sqlalchemy import (BaseMixin, BaseNameMixin, TimestampMixin, BaseScopedIdMixin, | |||
BaseScopedNameMixin, CoordinatesMixin, make_timestamp_columns) | |||
from baseframe import __ | |||
from baseframe import _ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should remain __
.
hasjob/models/campaign.py
Outdated
@@ -8,7 +8,7 @@ | |||
from flask import request, Markup | |||
from coaster.utils import LabeledEnum, utcnow | |||
from coaster.sqlalchemy import JsonDict, StateManager, cached | |||
from baseframe import __ | |||
from baseframe import _ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should remain __
.
hasjob/models/campaign.py
Outdated
@@ -301,7 +301,7 @@ def for_context(cls, position, board=None, user=None, anon_user=None, geonameids | |||
db.or_(CampaignView.dismissed == True, CampaignView.session_count > 2)))) # NOQA | |||
|
|||
# Filter by user flags | |||
for flag, value in user.flags.items(): | |||
for flag, value in list(user.flags.items()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should work without list()
@@ -253,7 +254,7 @@ def record_views_and_events(response): | |||
g.event_data['user_geonameids'] = g.user_geonameids | |||
|
|||
if g.impressions: | |||
g.event_data['impressions'] = g.impressions.values() | |||
g.event_data['impressions'] = list(g.impressions.values()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required.
@@ -294,7 +295,7 @@ def record_views_and_events(response): | |||
db.session.rollback() | |||
|
|||
if g.impressions: | |||
save_impressions.queue(g.esession.id, g.impressions.values(), now) | |||
save_impressions.queue(g.esession.id, list(g.impressions.values()), now) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required.
hasjob/views/helper.py
Outdated
@@ -317,7 +318,7 @@ def session_jobpost_ab(): | |||
in the current event session (impressions or views) as a dictionary of {id: bgroup} | |||
""" | |||
if not g.esession.persistent: | |||
return {key: value[2] for key, value in session.get('impressions', {}).items()} | |||
return {key: value[2] for key, value in list(session.get('impressions', {}).items())} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required.
@@ -434,7 +435,7 @@ def load_viewcounts(posts): | |||
values = redis_pipe.execute() | |||
viewcounts_values = values[:-1] | |||
maxcounts_values = values[-1] | |||
g.viewcounts = dict(zip(viewcounts_keys, viewcounts_values)) | |||
g.viewcounts = dict(list(zip(viewcounts_keys, viewcounts_values))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Questionable, but list()
is likely not required.
requirements.txt
Outdated
@@ -13,7 +13,6 @@ SQLAlchemy>=1.0.0 | |||
pytz==2019.3 | |||
markdown==3.1.1 | |||
tweepy==3.8.0 | |||
bitlyapi==0.1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this unsupported? Remove in a prior PR as it's also unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All enums that went from __
to _
have to be reverted.
Related to hasgeek/hgapp#39
Check the commits for easy review. One commit has only 2to3 changes, rest have changes needed specifically to run under py3.