Skip to content

Commit

Permalink
Remove outdated deprecated resources (#3114)
Browse files Browse the repository at this point in the history
All resources that have been deprecated before the release of `v1.0.0b1`
have been removed. The remaining deprecations are updated to ensure they
use the custom `AiidaDeprecationWarning` to prevent them from being
filtered by default, as well as that the docstring reflects when the
deprecation resources will be removed.
  • Loading branch information
sphuber authored Jul 2, 2019
1 parent 4738116 commit 406dbb4
Show file tree
Hide file tree
Showing 23 changed files with 86 additions and 834 deletions.
6 changes: 3 additions & 3 deletions aiida/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def load_dbenv(profile=None):
:type profile: str
.. deprecated:: 1.0.0
Will be removed in `v1.1.0`, use :func:`aiida.manage.configuration.load_profile` instead.
Will be removed in `v2.0.0`, use :func:`aiida.manage.configuration.load_profile` instead.
"""
warnings.warn('function is deprecated, use `load_profile` instead', AiidaDeprecationWarning) # pylint: disable=no-member
current_profile = get_profile()
Expand All @@ -88,7 +88,7 @@ def try_load_dbenv(profile=None):
.. deprecated:: 1.0.0
Will be removed in `v1.1.0`, use :func:`aiida.manage.configuration.load_profile` instead.
Will be removed in `v2.0.0`, use :func:`aiida.manage.configuration.load_profile` instead.
"""
warnings.warn('function is deprecated, use `load_profile` instead', AiidaDeprecationWarning) # pylint: disable=no-member
if not is_dbenv_loaded():
Expand All @@ -103,7 +103,7 @@ def is_dbenv_loaded():
:rtype: bool
.. deprecated:: 1.0.0
Will be removed in `v1.1.0`, use :func:`aiida.manage.configuration.load_profile` instead.
Will be removed in `v2.0.0`, use :func:`aiida.manage.configuration.load_profile` instead.
"""
warnings.warn('function is deprecated, use `load_profile` instead', AiidaDeprecationWarning) # pylint: disable=no-member
return get_profile() is not None
Expand Down
3 changes: 1 addition & 2 deletions aiida/backends/general/abstractqueries.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def get_bands_and_parents_structure(self, args):
if args.group_pk is not None:
group_filters.update({"id": {"in": args.group_pk}})
if group_filters:
qb.append(orm.Group, tag="group", filters=group_filters,
group_of="bdata")
qb.append(orm.Group, tag="group", filters=group_filters, with_node="bdata")

qb.append(orm.StructureData, tag="sdata", with_descendants="bdata",
# We don't care about the creator of StructureData
Expand Down
6 changes: 4 additions & 2 deletions aiida/backends/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import warnings

warnings.warn('this module is deprecated', DeprecationWarning) # pylint: disable=no-member
from aiida.common.warnings import AiidaDeprecationWarning

warnings.warn('this module is deprecated', AiidaDeprecationWarning) # pylint: disable=no-member

# Possible choices for backend
BACKEND_DJANGO = 'django'
Expand All @@ -31,4 +33,4 @@
# the attributes here fixes the problem, even though we have absolutely no idea why. Given that the module is deprecated
# anyway and will soon be removed at which point the problem should no longer exist.
run = None
runctx = None
runctx = None
2 changes: 1 addition & 1 deletion aiida/backends/sqlalchemy/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,6 @@ def test_group_batch_size(self):
# correct addition.
batch_sizes = (1, 3, 10, 1000)
for batch_size in batch_sizes:
group = Group(name='test_batches_' + str(batch_size)).store()
group = Group(label='test_batches_' + str(batch_size)).store()
group.backend_entity.add_nodes(nodes, skip_orm=True, batch_size=batch_size)
self.assertEqual(set(_.pk for _ in nodes), set(_.pk for _ in group.nodes))
6 changes: 3 additions & 3 deletions aiida/backends/tests/cmdline/commands/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def test_arrayshow(self):

class TestVerdiDataBands(AiidaTestCase, TestVerdiDataListable):
"""
Testing verdi data bands
Testing verdi data bands
"""

@staticmethod
Expand Down Expand Up @@ -324,7 +324,7 @@ def connect_structure_bands(structure):

k = KpointsData()
k.set_cell(cell)
k.set_kpoints_path([('G', 'M', 2)])
k.set_kpoints([[0.,0.,0.],[0.1,0.1,0.1]])

b = BandsData()
b.set_kpointsdata(k)
Expand Down Expand Up @@ -412,7 +412,7 @@ def test_dictshow(self):

class TestVerdiDataRemote(AiidaTestCase):
"""
Testing verdi data remote
Testing verdi data remote
"""

@classmethod
Expand Down
139 changes: 2 additions & 137 deletions aiida/backends/tests/test_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -3111,52 +3111,6 @@ class TestKpointsData(AiidaTestCase):
Tests the KpointsData objects.
"""

def test_set_kpoints_path_legacy(self):
"""
Regression test for the deprecated KpointsData.set_kpoints_path method.
For certain formats of a direct kpoint list, it is not necessary to have defined a cell.
"""
import numpy
from aiida.orm.nodes.data.array.kpoints import KpointsData

# Create a node with two arrays
kpoints_01 = KpointsData()
kpoints_02 = KpointsData()
kpoints_03 = KpointsData()
kpoints_04 = KpointsData()

# The various allowed formats
format_01 = [('G', 'M')]
format_02 = [('G', 'M', 30)]
format_03 = [('G', (0, 0, 0), 'M', (1, 1, 1))]
format_04 = [('G', (0, 0, 0), 'M', (1, 1, 1), 30)]

# Without a cell defined, the first two should fail, the last two should work
with self.assertRaises(ValueError):
kpoints_01.set_kpoints_path(format_01)

with self.assertRaises(ValueError):
kpoints_02.set_kpoints_path(format_02)

kpoints_03.set_kpoints_path(format_03)
kpoints_04.set_kpoints_path(format_04)

# Define a cell and settings it enable the usage of formats 1 and 2
alat = 4.
cell = numpy.array([
[alat, 0., 0.],
[0., alat, 0.],
[0., 0., alat],
])

kpoints_01.set_cell(cell)
kpoints_02.set_cell(cell)

kpoints_01.set_kpoints_path(format_01)
kpoints_02.set_kpoints_path(format_02)
kpoints_03.set_kpoints_path(format_03)
kpoints_04.set_kpoints_path(format_04)

def test_mesh(self):
"""
Check the methods to set and retrieve a mesh.
Expand Down Expand Up @@ -3279,63 +3233,6 @@ def test_kpoints_to_cartesian(self):
klist = k.get_kpoints(cartesian=True)
self.assertTrue(numpy.allclose(klist, input_klist, atol=1e-16))

def test_path(self):
"""
Test the methods to generate automatically a list of kpoints
"""
import numpy

k = KpointsData()

# shouldn't get anything wiothout having set the cell
with self.assertRaises(ValueError):
k.set_kpoints_path()

# define a cell
alat = 4.
cell = numpy.array([
[alat, 0., 0.],
[0., alat, 0.],
[0., 0., alat],
])

k.set_cell(cell)
k.set_kpoints_path()
# something should be retrieved
klist = k.get_kpoints()

# test the various formats for specifying the path
k.set_kpoints_path([
('G', 'M'),
])
k.set_kpoints_path([
('G', 'M', 30),
])
k.set_kpoints_path([
('G', (0., 0., 0.), 'M', (1., 1., 1.)),
])
k.set_kpoints_path([
('G', (0., 0., 0.), 'M', (1., 1., 1.), 30),
])

# at least 2 points per segment
with self.assertRaises(ValueError):
k.set_kpoints_path([
('G', 'M', 1),
])
with self.assertRaises(ValueError):
k.set_kpoints_path([
('G', (0., 0., 0.), 'M', (1., 1., 1.), 1),
])

# try to set points with a spacing
k.set_kpoints_path(kpoint_distance=0.1)

# try to modify after storage
k.store()
with self.assertRaises(ModificationNotAllowed):
k.set_kpoints_path()

def test_path_wrapper_legacy(self):
"""
This is a clone of the test_path test but instead it goes through the new wrapper
Expand Down Expand Up @@ -3393,38 +3290,6 @@ def test_path_wrapper_legacy(self):
# try to set points with a spacing
get_explicit_kpoints_path(structure, method='legacy', kpoint_distance=0.1)

def test_tetra_x(self):
"""
testing tetragonal cells with axis along X
"""
import numpy
from aiida.plugins import DataFactory
alat = 1.5
cell_x = [[alat, 0, 0], [0, 1, 0], [0, 0, 1]]
K = DataFactory('array.kpoints')
k = K()
k.set_cell(cell_x)
points = k.get_special_points(cartesian=True)

self.assertAlmostEqual(points[0]['Z'][0], numpy.pi / alat)
self.assertAlmostEqual(points[0]['Z'][1], 0.)

def test_tetra_z(self):
"""
testing tetragonal cells with axis along X
"""
import numpy
from aiida.plugins import DataFactory
alat = 1.5
cell_x = [[1, 0, 0], [0, 1, 0], [0, 0, alat]]
K = DataFactory('array.kpoints')
k = K()
k.set_cell(cell_x)
points = k.get_special_points(cartesian=True)

self.assertAlmostEqual(points[0]['Z'][2], numpy.pi / alat)
self.assertAlmostEqual(points[0]['Z'][0], 0.)

def test_tetra_z_wrapper_legacy(self):
"""
This is a clone of the test_tetra_z test but instead it goes through the new wrapper
Expand Down Expand Up @@ -3757,7 +3622,7 @@ def test_band(self):

k = KpointsData()
k.set_cell(cell)
k.set_kpoints_path()
k.set_kpoints([[0.,0.,0.],[0.1,0.1,0.1]])

b = BandsData()
b.set_kpointsdata(k)
Expand Down Expand Up @@ -3800,7 +3665,7 @@ def test_export_to_file(self):

k = KpointsData()
k.set_cell(cell)
k.set_kpoints_path()
k.set_kpoints([[0.,0.,0.],[0.1,0.1,0.1]])

b = BandsData()
b.set_kpointsdata(k)
Expand Down
23 changes: 2 additions & 21 deletions aiida/cmdline/commands/cmd_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

from functools import partial
import click
import tabulate
Expand All @@ -19,7 +20,7 @@
from aiida.cmdline.params import options, arguments
from aiida.cmdline.params.options.commands import code as options_code
from aiida.cmdline.utils import echo
from aiida.cmdline.utils.decorators import with_dbenv, deprecated_command
from aiida.cmdline.utils.decorators import with_dbenv
from aiida.cmdline.utils.multi_line_input import ensure_scripts
from aiida.common.exceptions import InputValidationError

Expand Down Expand Up @@ -208,15 +209,6 @@ def reveal(codes):
echo.echo_success('Code<{}> {} revealed'.format(code.pk, code.full_label))


@verdi_code.command()
@arguments.CODE()
@with_dbenv()
@deprecated_command("Updating codes breaks data provenance. Use 'duplicate' instead.")
# pylint: disable=unused-argument
def update(code):
"""Update an existing code."""


@verdi_code.command()
@arguments.CODE()
@arguments.LABEL()
Expand All @@ -233,17 +225,6 @@ def relabel(code, label):
echo.echo_success('Code<{}> relabeled from {} to {}'.format(code.pk, old_label, code.full_label))


@verdi_code.command()
@arguments.CODE()
@arguments.LABEL()
@with_dbenv()
@click.pass_context
@deprecated_command("This command may be removed in a future release. Use 'relabel' instead.")
def rename(ctx, code, label):
"""Rename a code."""
ctx.invoke(relabel, code=code, label=label)


@verdi_code.command('list')
@options.COMPUTER(help='Filter codes by computer.')
@options.INPUT_PLUGIN(help='Filter codes by calculation input plugin.')
Expand Down
13 changes: 0 additions & 13 deletions aiida/cmdline/commands/cmd_data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,11 @@
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import click

from aiida.cmdline.commands.cmd_verdi import verdi
from aiida.cmdline.commands.cmd_plugin import verdi_plugin
from aiida.cmdline.utils import decorators
from aiida.cmdline.utils.pluginable import Pluginable


@verdi.group('data', entry_point_group='aiida.cmdline.data', cls=Pluginable)
def verdi_data():
"""Inspect, create and manage data nodes."""


@verdi_data.command('plugins')
@click.argument('entry_point', type=click.STRING, required=False)
@click.pass_context
@decorators.with_dbenv()
@decorators.deprecated_command("This command is deprecated. Use 'verdi plugin list' instead.")
def data_plugins(ctx, entry_point):
"""Print a list of registered data plugins or details of a specific data plugin."""
ctx.invoke(verdi_plugin.get_command(ctx, 'list'), entry_point_group='aiida.data', entry_point=entry_point)
6 changes: 0 additions & 6 deletions aiida/engine/daemon/execmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from aiida.common.datastructures import CalcJobState
from aiida.common.folders import SandboxFolder
from aiida.common.links import LinkType
from aiida.common.warnings import AiidaDeprecationWarning
from aiida.orm import FolderData
from aiida.orm.utils.log import get_dblogger_extra
from aiida.plugins import DataFactory
Expand Down Expand Up @@ -252,9 +251,6 @@ def retrieve_calculation(calculation, transport, retrieved_temporary_folder):
:param transport: an already opened transport to use for the retrieval.
:param retrieved_temporary_folder: the absolute path to a directory in which to store the files
listed, if any, in the `retrieved_temporary_folder` of the jobs CalcInfo
.. deprecated:: 1.0.0
`retrieve_singlefile_list` will be removed in `v2.0.0`, use `retrieve_temporary_list` instead.
"""
logger_extra = get_dblogger_extra(calculation)

Expand Down Expand Up @@ -284,8 +280,6 @@ def retrieve_calculation(calculation, transport, retrieved_temporary_folder):

# Second, retrieve the singlefiles, if any files were specified in the 'retrieve_temporary_list' key
if retrieve_singlefile_list:
warnings.warn('`retrieve_singlefile_list` has been deprecated, use `retrieve_temporary_list` instead',
AiidaDeprecationWarning) # pylint: disable=no-member
with SandboxFolder() as folder:
_retrieve_singlefiles(calculation, transport, folder, retrieve_singlefile_list, logger_extra)

Expand Down
Loading

0 comments on commit 406dbb4

Please sign in to comment.