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

DM-15445: Remove python future #57

Merged
merged 3 commits into from
Aug 15, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ sudo: false
language: python
matrix:
include:
- python: '2.7'
install:
- pip install flake8
script: flake8
- python: '3.5'
install:
- pip install flake8
script: flake8
- python: '3.6'
install:
- pip install flake8
Expand Down
2 changes: 0 additions & 2 deletions examples/simulateCache.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python

from __future__ import absolute_import, division, print_function

from argparse import ArgumentParser
from collections import Counter, OrderedDict, defaultdict

Expand Down
4 changes: 1 addition & 3 deletions python/lsst/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#
# LSST Data Management System
#
# Copyright 2008-2017 AURA/LSST.
Expand All @@ -20,7 +20,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import

# Register Backtrace signal handlers first
from . import backtrace
Expand All @@ -34,4 +33,3 @@
from .wrappers import *
from .python import *
from .version import *

1 change: 0 additions & 1 deletion python/lsst/utils/get_caller_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
import inspect

__all__ = ["get_caller_name"]
Expand Down
4 changes: 0 additions & 4 deletions python/lsst/utils/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
# see <https://www.lsstcorp.org/LegalNotices/>.
#
"""Support code for running unit tests"""
from __future__ import print_function
from __future__ import division
from builtins import zip
from builtins import range

import contextlib
import gc
Expand Down
17 changes: 16 additions & 1 deletion python/lsst/utils/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# the GNU General Public License along with this program. If not,
# see <https://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function

import sys
import types
Expand Down Expand Up @@ -62,6 +61,8 @@ def continueClass(cls):

For example::

.. code-block:: python

class Foo:
pass

Expand All @@ -72,6 +73,8 @@ def run(self):

is equivalent to::

.. code-block:: python

class Foo:
def run(self):
return None
Expand All @@ -95,6 +98,8 @@ def inClass(cls, name=None):

For example::

.. code-block:: python

class Foo:
pass

Expand All @@ -104,6 +109,8 @@ def run(self):

is equivalent to::

.. code-block:: python

class Foo:
def run(self):
return None
Expand Down Expand Up @@ -156,6 +163,8 @@ class TemplateMeta(type):
after a subclass already been registered with a "primary" type key. For
example (using Python 3 metaclass syntax)::

.. code-block:: python

import numpy as np
from ._image import ImageF, ImageD

Expand All @@ -176,6 +185,8 @@ class Image(metaclass=TemplateMeta):
long as an extra ``dtype`` keyword argument is passed that matches one of
the type keys::

.. code-block:: python

img = Image(52, 64, dtype=np.float32)

This simply forwards additional positional and keyword arguments to the
Expand All @@ -197,6 +208,8 @@ class Image(metaclass=TemplateMeta):
attributes to the wrapped template classes. To add a ``sum`` method to
all registered types, for example, we can just do::

.. code-block:: python

class Image(metaclass=TemplateMeta):

def sum(self):
Expand All @@ -221,6 +234,8 @@ def sum(self):
like interface for accessing their registered subclasses, providing
something like the C++ syntax for templates::

.. code-block:: python

Image[np.float32] -> ImageF
Image["D"] -> ImageD

Expand Down
24 changes: 21 additions & 3 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
from __future__ import absolute_import, division, print_function

from builtins import int
#
# LSST Data Management System
# Copyright 2008-2016 LSST Corporation.
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#

import unittest

Expand Down
22 changes: 22 additions & 0 deletions tests/test_executables.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
#
# LSST Data Management System
# Copyright 2008-2016 LSST Corporation.
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#

import unittest
import os
import lsst.utils.tests
Expand Down
5 changes: 2 additions & 3 deletions tests/test_get_caller_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from __future__ import absolute_import, division, print_function
import sys
import unittest

Expand All @@ -43,7 +42,7 @@ def test_func():
self.assertEqual(result, "{}.test_func".format(__name__))

def test_instance_method(self):
class TestClass(object):
class TestClass:
def run(self):
return get_caller_name(1)

Expand All @@ -52,7 +51,7 @@ def run(self):
self.assertEqual(result, "{}.TestClass.run".format(__name__))

def test_class_method(self):
class TestClass(object):
class TestClass:
@classmethod
def run(cls):
return get_caller_name(1)
Expand Down
3 changes: 0 additions & 3 deletions tests/test_pybind11.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#
from builtins import str
from past.builtins import long

import sys
import unittest
Expand Down Expand Up @@ -82,7 +80,6 @@ def assertAccepts(self, function, value, msg):

def checkNumeric(self, function):
self.assertAccepts(function, int(1), msg="Failure passing int to %s" % function.__name__)
self.assertAccepts(function, long(1), msg="Failure passing long to %s" % function.__name__)
self.assertRaises((TypeError, NotImplementedError),
function, "5") # should fail to convert even numeric strings
# We should be able to coerce integers with different signedness and size to any numeric
Expand Down
30 changes: 24 additions & 6 deletions tests/test_wrappers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
from __future__ import absolute_import, division, print_function

from future.utils import with_metaclass
#
# LSST Data Management System
# Copyright 2008-2016 LSST Corporation.
#
# This product includes software developed by the
# LSST Project (http://www.lsst.org/).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the LSST License Statement and
# the GNU General Public License along with this program. If not,
# see <http://www.lsstcorp.org/LegalNotices/>.
#

import numpy as np
import unittest
Expand Down Expand Up @@ -95,7 +113,7 @@ class TemplateMetaSimpleTestCase(lsst.utils.tests.TestCase):

def setUp(self):

class Example(with_metaclass(lsst.utils.TemplateMeta, object)):
class Example(metaclass=lsst.utils.TemplateMeta):

def method1(self):
return self
Expand Down Expand Up @@ -253,7 +271,7 @@ class TemplateMetaHardTestCase(lsst.utils.tests.TestCase):

def setUp(self):

class Example(with_metaclass(lsst.utils.TemplateMeta, object)):
class Example(metaclass=lsst.utils.TemplateMeta):

TEMPLATE_PARAMS = ("d", "u")
TEMPLATE_DEFAULTS = (2, None)
Expand Down Expand Up @@ -393,7 +411,7 @@ class TestDefaultMethodCopying(lsst.utils.tests.TestCase):
registered as a default type in a type ABC are properly copied.
"""
def setUp(self):
class Example(with_metaclass(lsst.utils.TemplateMeta, object)):
class Example(metaclass=lsst.utils.TemplateMeta):

TEMPLATE_PARAMS = ("dtype",)
TEMPLATE_DEFAULTS = (np.float32,)
Expand Down
2 changes: 0 additions & 2 deletions ups/utils.table
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ setupRequired(numpy)
setupRequired(pybind11)
setupRequired(python)
setupRequired(python_psutil)
setupRequired(python_future)

envPrepend(LD_LIBRARY_PATH, ${PRODUCT_DIR}/lib)
envPrepend(DYLD_LIBRARY_PATH, ${PRODUCT_DIR}/lib)
envPrepend(LSST_LIBRARY_PATH, ${PRODUCT_DIR}/lib)

envPrepend(PYTHONPATH, ${PRODUCT_DIR}/python)