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

Drop support for Python 2 in bodhi.server. #2871

Merged
merged 1 commit into from
Jan 7, 2019
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
6 changes: 0 additions & 6 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@ pull_request_rules:
- status-success=f28-flake8
- status-success=f28-pydocstyle
- status-success=f28-python2-unit
Copy link
Member

Choose a reason for hiding this comment

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

You can drop the unit tests too, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't yet, because the client still supports Python 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Python 2 support is planned to be dropped from the client in #2856. I am waiting just a bit to see if my dependencies will stop using it before making that change.

- status-success=f28-python2-diff-cover
- status-success=f28-python3-unit
- status-success=f28-python3-diff-cover
- status-success=f29-docs
- status-success=f29-flake8
- status-success=f29-pydocstyle
- status-success=f29-python2-unit
- status-success=f29-python2-diff-cover
- status-success=f29-python3-unit
- status-success=f29-python3-diff-cover
- status-success=pip-docs
- status-success=pip-flake8
- status-success=pip-mypy
- status-success=pip-pydocstyle
- status-success=pip-python2-unit
- status-success=pip-python2-diff-cover
- status-success=pip-python3-unit
- status-success=pip-python3-diff-cover
- status-success=f29-python3-integration
Expand All @@ -46,22 +43,19 @@ pull_request_rules:
- status-success=f28-flake8
- status-success=f28-pydocstyle
- status-success=f28-python2-unit
- status-success=f28-python2-diff-cover
- status-success=f28-python3-unit
- status-success=f28-python3-diff-cover
- status-success=f29-docs
- status-success=f29-flake8
- status-success=f29-pydocstyle
- status-success=f29-python2-unit
- status-success=f29-python2-diff-cover
- status-success=f29-python3-unit
- status-success=f29-python3-diff-cover
- status-success=pip-docs
- status-success=pip-flake8
- status-success=pip-mypy
- status-success=pip-pydocstyle
- status-success=pip-python2-unit
- status-success=pip-python2-diff-cover
- status-success=pip-python3-unit
- status-success=pip-python3-diff-cover
name: default-from-bowlofeggs
Expand Down
4 changes: 1 addition & 3 deletions bodhi/server/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright © 2007-2018 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
Expand Down Expand Up @@ -29,7 +28,6 @@
from pyramid.renderers import JSONP
from sqlalchemy import engine_from_config, event
from sqlalchemy.orm import scoped_session, sessionmaker
import six

from bodhi.server import bugs, buildsys
from bodhi.server.config import config as bodhi_config
Expand Down Expand Up @@ -72,7 +70,7 @@ def get_user(request):
from bodhi.server.models import User
userid = request.unauthenticated_userid
if userid is not None:
user = request.db.query(User).filter_by(name=six.text_type(userid)).first()
user = request.db.query(User).filter_by(name=str(userid)).first()
# Why munch? https://github.com/fedora-infra/bodhi/issues/473
return munchify(user.__json__(request=request))

Expand Down
8 changes: 3 additions & 5 deletions bodhi/server/bugs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
# Copyright © 2013-2017 Red Hat, Inc. and others.
# Copyright © 2013-2018 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
#
Expand All @@ -18,13 +17,12 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""Defines utilities for accessing Bugzilla."""

from xmlrpc import client as xmlrpc_client
import logging

from collections import namedtuple
from kitchen.text.converters import to_unicode
import bugzilla
import six
from six.moves import xmlrpc_client

from bodhi.server.config import config

Expand Down Expand Up @@ -276,7 +274,7 @@ def update_details(self, bug, bug_entity):
if bug.product == 'Security Response':
bug_entity.parent = True
bug_entity.title = to_unicode(bug.short_desc)
if isinstance(bug.keywords, six.string_types):
if isinstance(bug.keywords, str):
keywords = bug.keywords.split()
else: # python-bugzilla 0.8.0+
keywords = bug.keywords
Expand Down
1 change: 0 additions & 1 deletion bodhi/server/buildsys.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2007-2018 Red Hat, Inc. and others.
#
# This file is part of Bodhi.
Expand Down
7 changes: 2 additions & 5 deletions bodhi/server/captcha.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright © 2014-2018 Red Hat, Inc.
#
# This file is part of Bodhi.
Expand All @@ -21,7 +20,6 @@
# Authors: Ralph Bean <[email protected]>
"""Define utilities and a view pertaining to captcha images for unauthenticated users."""

from __future__ import division
import base64
import math
import random
Expand All @@ -31,7 +29,6 @@
from pyramid.httpexceptions import HTTPGone, HTTPNotFound
from pyramid.view import view_config
import cryptography.fernet
import six


def math_generator(plainkey, settings):
Expand Down Expand Up @@ -62,7 +59,7 @@ def math_generator(plainkey, settings):

x, y = int(tokens[0]), int(tokens[2])

value = six.text_type(x + y)
value = str(x + y)
return plainkey, value


Expand Down Expand Up @@ -252,7 +249,7 @@ def decrypt(ciphertext, settings):
secret = settings['captcha.secret']
engine = cryptography.fernet.Fernet(secret)

if isinstance(ciphertext, six.text_type):
if isinstance(ciphertext, str):
ciphertext = ciphertext.encode('utf-8')

try:
Expand Down
Loading