[
https://issues.apache.org/jira/browse/MESOS-4054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16480726#comment-16480726
]
Armand Grillet commented on MESOS-4054:
---------------------------------------
For the Python bindings:
interface:
{code}
RefactoringTool: Refactored ./src/mesos/interface/__init__.py
--- ./src/mesos/interface/__init__.py (original)
+++ ./src/mesos/interface/__init__.py (refactored)
@@ -20,7 +20,7 @@
"""Python bindings for Mesos."""
-from __future__ import print_function
+
import sys
{code}
lib:
{code}
RefactoringTool: Refactored ./mesos/exceptions.py
--- ./mesos/exceptions.py (original)
+++ ./mesos/exceptions.py (refactored)
@@ -18,7 +18,7 @@
Exceptions Classes
"""
-from __future__ import absolute_import
+
class MesosException(Exception):
RefactoringTool: Refactored ./mesos/http.py
--- ./mesos/http.py (original)
+++ ./mesos/http.py (refactored)
@@ -20,9 +20,9 @@
Classes and functions for interacting with the Mesos HTTP RESTful API
"""
-from __future__ import absolute_import
-
-from urlparse import urlparse
+
+
+from urllib.parse import urlparse
from copy import deepcopy
import requests
@@ -84,7 +84,7 @@
default timeout for connections, default headers to be included in each
request, and auth.
"""
- SUCCESS_CODES = frozenset(xrange(200, 300))
+ SUCCESS_CODES = frozenset(range(200, 300))
ERROR_CODE_MAP = {c.STATUS_CODE: c for c in (
MesosBadRequestException,
MesosAuthenticationException,
RefactoringTool: No changes to ./tests/__init__.py
RefactoringTool: Refactored ./tests/conftest.py
--- ./tests/conftest.py (original)
+++ ./tests/conftest.py (refactored)
@@ -18,7 +18,7 @@
PyTest configuration
"""
-from __future__ import absolute_import
+
import mock
import pytest
RefactoringTool: No changes to ./tests/test_exceptions.py
RefactoringTool: Refactored ./tests/test_http.py
--- ./tests/test_http.py (original)
+++ ./tests/test_http.py (refactored)
@@ -16,7 +16,7 @@
# pylint:
disable=missing-docstring,protected-access,too-many-locals,too-many-arguments
-from __future__ import absolute_import
+
from collections import namedtuple
RefactoringTool: Refactored ./tests/test_mesos.py
--- ./tests/test_mesos.py (original)
+++ ./tests/test_mesos.py (refactored)
@@ -18,7 +18,7 @@
Tests for the mesos package
"""
-from __future__ import absolute_import
+
import mesos
{code}
That seems to be it.
> Evaluate python-compatibility of python bindings and utilities
> --------------------------------------------------------------
>
> Key: MESOS-4054
> URL: https://issues.apache.org/jira/browse/MESOS-4054
> Project: Mesos
> Issue Type: Task
> Reporter: Benjamin Bannier
> Assignee: Armand Grillet
> Priority: Minor
>
> In many places our python tools do not enforce a particular python version
> but call the first {{python}} from {{env}} (likely python2).
> We likely rely on some python2 constructs which can be easily migrated to a
> python3 equivalent (e.g., {{print}} vs. {{print_function}}). Let's evaluate
> what else we use and how much effort it would be to support both python2 and
> python3. If we can collect information on what minimal python version is
> required right we should also collect that to see what is available.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)