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 python 2 #3566

Merged
merged 8 commits into from
Dec 2, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 0 additions & 3 deletions .ci/polish/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
# For further information please visit http://www.aiida.net #
###########################################################################
"""Command line interface to dynamically create and run a WorkChain that can evaluate a reversed polish expression."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import click

Expand Down
7 changes: 1 addition & 6 deletions .ci/polish/lib/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@
# For further information please visit http://www.aiida.net #
###########################################################################
"""Functions to dynamically generate reversed polish notation expressions."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import collections
import operator as operators
import random
from six.moves import range
import six

OPERATORS = {
'+': operators.add,
Expand Down Expand Up @@ -133,7 +128,7 @@ def evaluate(expression, modulo=None):
left_hand = int(stack.popleft())
right_hand = int(stack.popleft())
result = operator(left_hand, right_hand)
stack.appendleft(six.text_type(result))
stack.appendleft(str(result))

if modulo is not None:
return int(result % modulo)
Expand Down
2 changes: 1 addition & 1 deletion .ci/polish/lib/template/workchain.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ${class_name}(WorkChain):

@classmethod
def define(cls, spec):
super(${class_name}, cls).define(spec)
super().define(spec)
spec.input('code', valid_type=Code, required=False)
spec.input('operands', valid_type=Str)
spec.input('modulo', valid_type=Int)
Expand Down
3 changes: 0 additions & 3 deletions .ci/polish/lib/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
# For further information please visit http://www.aiida.net #
###########################################################################
"""Functions to dynamically generate a WorkChain from a reversed polish notation expression."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import collections
import errno
Expand Down
3 changes: 0 additions & 3 deletions .ci/pytest/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
For pytest, put this file in the root directory of the package to make
the fixtures available to all tests.
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import pytest # pylint: disable=unused-import
pytest_plugins = ['aiida.manage.tests.pytest_fixtures'] # pylint: disable=invalid-name
3 changes: 0 additions & 3 deletions .ci/pytest/test_pytest_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"""
Test pytest fixtures.
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import


def test_aiida_localhost(aiida_localhost):
Expand Down
3 changes: 0 additions & 3 deletions .ci/pytest/test_unittest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
# For further information please visit http://www.aiida.net #
###########################################################################
"""Test running unittest test cases through pytest."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import unittest
import pytest

Expand Down
4 changes: 0 additions & 4 deletions .ci/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function

import subprocess
import sys
import time

from six.moves import range

from aiida.common import exceptions
from aiida.engine import run_get_node, submit
Expand Down
9 changes: 3 additions & 6 deletions .ci/test_plugin_testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
This must be in a standalone script because it would clash with other tests,
Since the dbenv gets loaded on the temporary profile.
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

import sys
import unittest
Expand All @@ -37,7 +34,7 @@ def setUp(self):
self.computer = self.get_computer(temp_dir=self.temp_dir)

def tearDown(self):
super(PluginTestCase1, self).tearDown()
super().tearDown()
shutil.rmtree(self.temp_dir)

@staticmethod
Expand Down Expand Up @@ -91,7 +88,7 @@ def test_tear_down(self):
are not there anymore.
"""
from aiida.orm import load_node
super(PluginTestCase1, self).tearDown() # reset DB
super().tearDown() # reset DB
with self.assertRaises(Exception):
load_node(self.data_pk)

Expand All @@ -108,7 +105,7 @@ def test_dummy(self):
Just making sure that setup/teardown is safe for
multiple testcase classes (this was broken in #1425).
"""
super(PluginTestCase2, self).tearDown()
super().tearDown()


if __name__ == '__main__':
Expand Down
3 changes: 0 additions & 3 deletions .ci/test_profile_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
# For further information please visit http://www.aiida.net #
###########################################################################
"""Unittests for TestManager"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import unittest
import warnings
Expand Down
3 changes: 0 additions & 3 deletions .ci/test_test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
# For further information please visit http://www.aiida.net #
###########################################################################
"""Unittests for TestManager"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import unittest
import warnings
import sys
Expand Down
21 changes: 9 additions & 12 deletions .ci/workchains.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

from aiida.engine import calcfunction, workfunction, WorkChain, ToContext, append_
from aiida.engine.persistence import ObjectLoader
Expand All @@ -22,7 +19,7 @@ class NestedWorkChain(WorkChain):
"""
@classmethod
def define(cls, spec):
super(NestedWorkChain, cls).define(spec)
super().define(spec)
spec.input('inp', valid_type=Int)
spec.outline(
cls.do_submit,
Expand Down Expand Up @@ -56,7 +53,7 @@ def finalize(self):
class SerializeWorkChain(WorkChain):
@classmethod
def define(cls, spec):
super(SerializeWorkChain, cls).define(spec)
super().define(spec)

spec.input(
'test',
Expand All @@ -74,7 +71,7 @@ def echo(self):
class NestedInputNamespace(WorkChain):
@classmethod
def define(cls, spec):
super(NestedInputNamespace, cls).define(spec)
super().define(spec)

spec.input('foo.bar.baz', valid_type=Int)
spec.output('output', valid_type=Int)
Expand All @@ -87,7 +84,7 @@ def do_echo(self):
class ListEcho(WorkChain):
@classmethod
def define(cls, spec):
super(ListEcho, cls).define(spec)
super().define(spec)

spec.input('list', valid_type=List)
spec.output('output', valid_type=List)
Expand All @@ -101,7 +98,7 @@ def do_echo(self):
class DynamicNonDbInput(WorkChain):
@classmethod
def define(cls, spec):
super(DynamicNonDbInput, cls).define(spec)
super().define(spec)
spec.input_namespace('namespace', dynamic=True)
spec.output('output', valid_type=List)
spec.outline(cls.do_test)
Expand All @@ -116,7 +113,7 @@ def do_test(self):
class DynamicDbInput(WorkChain):
@classmethod
def define(cls, spec):
super(DynamicDbInput, cls).define(spec)
super().define(spec)
spec.input_namespace('namespace', dynamic=True)
spec.output('output', valid_type=Int)
spec.outline(cls.do_test)
Expand All @@ -130,7 +127,7 @@ def do_test(self):
class DynamicMixedInput(WorkChain):
@classmethod
def define(cls, spec):
super(DynamicMixedInput, cls).define(spec)
super().define(spec)
spec.input_namespace('namespace', dynamic=True)
spec.output('output', valid_type=Int)
spec.outline(cls.do_test)
Expand All @@ -150,7 +147,7 @@ class CalcFunctionRunnerWorkChain(WorkChain):
"""
@classmethod
def define(cls, spec):
super(CalcFunctionRunnerWorkChain, cls).define(spec)
super().define(spec)

spec.input('input', valid_type=Int)
spec.output('output', valid_type=Int)
Expand All @@ -167,7 +164,7 @@ class WorkFunctionRunnerWorkChain(WorkChain):
"""
@classmethod
def define(cls, spec):
super(WorkFunctionRunnerWorkChain, cls).define(spec)
super().define(spec)

spec.input('input', valid_type=Str)
spec.output('output', valid_type=Str)
Expand Down
72 changes: 0 additions & 72 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,75 +234,3 @@
aiida/__init__.py
)$
pass_filenames: false

# modernizer: make sure our code-base is Python 3 ready
- repo: https://github.com/python-modernize/python-modernize.git
rev: a234ce4e185cf77a55632888f1811d83b4ad9ef2
hooks:
- id: python-modernize
exclude: >
(?x)^(
docs/.*|
aiida/engine/utils.py # exclude because tornado WaitIterator.next() does not work with next(...)
)$
args:
- --write
- --nobackups
# Following are all the fixers in python-modernize.
# Those marked as 'done' were run at some point and their results checked
# and incorporated if necessary, but they can't be applied without breaking valid cases
- --fix=apply
- --fix=except
- --fix=exec
- --fix=execfile
- --fix=exitfunc
- --fix=funcattrs
#done: - --fix=has_key
#optional: - --fix=idioms
#done: - --fix=long
- --fix=methodattrs
- --fix=ne
- --fix=numliterals
- --fix=operator
- --fix=paren
- --fix=reduce
- --fix=renames
- --fix=repr
#optional: - --fix=set_literal
- --fix=standarderror
- --fix=sys_exc
- --fix=throw
- --fix=tuple_params
- --fix=types
#optional: - --fix=ws_comma
- --fix=xreadlines
- --fix=basestring
- --fix=classic_division
#done: - --fix=dict_six
- --fix=file
- --fix=filter
- --fix=import
- --fix=imports_six
- --fix=input_six
- --fix=int_long_tuple
- --fix=itertools_imports_six
- --fix=itertools_six
- --fix=map
- --fix=metaclass
- --fix=next
#optional: - --fix=open
- --fix=print
- --fix=raise
- --fix=raise_six
- --fix=unichr
- --fix=unicode
- --fix=unicode_future
- --fix=unicode_type
- --fix=urllib_six
- --fix=xrange_six
- --fix=zip

- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v1.1.1
hooks:
- id: check-yaml
4 changes: 2 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=bad-continuation,locally-disabled,useless-suppression,django-not-available,bad-option-value,logging-format-interpolation,no-else-raise,useless-object-inheritance
disable=bad-continuation,locally-disabled,useless-suppression,django-not-available,bad-option-value,logging-format-interpolation,no-else-raise

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -279,7 +279,7 @@ init-import=no

# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,future.builtins
redefining-builtins-modules=


[MISCELLANEOUS]
Expand Down
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ sudo: required
language: python

python:
- "2.7"
- "3.6"

cache: pip
Expand Down Expand Up @@ -49,11 +48,7 @@ before_install:
- .ci/before_install.sh

install:
# Upgrade pip setuptools and wheel to be able to run the next command
- pip install --upgrade pip wheel setuptools coveralls
- pip install "numpy==1.16.4" # see https://github.com/materialsproject/pymatgen/issues/1520
- pip install "monty==2.0.4" # see https://github.com/materialsvirtuallab/monty/issues/49
# Install AiiDA with some optional dependencies
- if [ "$TEST_TYPE" == "docs" ]; then pip install . && pip install -r docs/requirements_for_rtd.txt; else pip install .[all]; fi

env:
Expand Down
Loading