Skip to content

Commit

Permalink
Drop Python 2: remove explicit declaration of strings being unicode
Browse files Browse the repository at this point in the history
In python 3 strings are stored as unicode by default so now that we
dropped pyhon 2 support there is no need to keep prefixing them with the
string encoding declaration `u`.
  • Loading branch information
sphuber committed Dec 2, 2019
1 parent d06b9a0 commit 7531bd7
Show file tree
Hide file tree
Showing 52 changed files with 322 additions and 328 deletions.
12 changes: 6 additions & 6 deletions aiida/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
from aiida.manage.configuration import get_config_option, get_profile, load_profile

__copyright__ = (
u'Copyright (c), This file is part of the AiiDA platform. '
u'For further information please visit http://www.aiida.net/. All rights reserved.'
'Copyright (c), This file is part of the AiiDA platform. '
'For further information please visit http://www.aiida.net/. All rights reserved.'
)
__license__ = 'MIT license, see LICENSE.txt file.'
__version__ = '1.0.1'
__authors__ = 'The AiiDA team.'
__paper__ = (
u'G. Pizzi, A. Cepellotti, R. Sabatini, N. Marzari, and B. Kozinsky,'
u'"AiiDA: automated interactive infrastructure and database for computational science", '
u'Comp. Mat. Sci 111, 218-230 (2016); https://doi.org/10.1016/j.commatsci.2015.09.013 '
u'- http://www.aiida.net.'
'G. Pizzi, A. Cepellotti, R. Sabatini, N. Marzari, and B. Kozinsky,'
'"AiiDA: automated interactive infrastructure and database for computational science", '
'Comp. Mat. Sci 111, 218-230 (2016); https://doi.org/10.1016/j.commatsci.2015.09.013 '
'- http://www.aiida.net.'
)
__paper_short__ = 'G. Pizzi et al., Comp. Mat. Sci 111, 218 (2016).'

Expand Down
82 changes: 41 additions & 41 deletions aiida/backends/djsite/db/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class Migration(migrations.Migration):
('last_name', models.CharField(max_length=254, blank=True)),
('institution', models.CharField(max_length=254, blank=True)),
('is_staff', models.BooleanField(default=False,
help_text=u'Designates whether the user can log into this admin site.')),
help_text='Designates whether the user can log into this admin site.')),
('is_active', models.BooleanField(default=True,
help_text=u'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.')),
help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now)),
('groups',
models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Group', blank=True,
Expand All @@ -63,11 +63,11 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('key', models.CharField(max_length=1024, db_index=True)),
('datatype', models.CharField(default=u'none', max_length=10, db_index=True,
choices=[(u'float', u'float'), (u'int', u'int'), (u'txt', u'txt'),
(u'bool', u'bool'), (u'date', u'date'), (u'json', u'json'),
(u'dict', u'dict'), (u'list', u'list'), (u'none', u'none')])),
('tval', models.TextField(default=u'', blank=True)),
('datatype', models.CharField(default='none', max_length=10, db_index=True,
choices=[('float', 'float'), ('int', 'int'), ('txt', 'txt'),
('bool', 'bool'), ('date', 'date'), ('json', 'json'),
('dict', 'dict'), ('list', 'list'), ('none', 'none')])),
('tval', models.TextField(default='', blank=True)),
('fval', models.FloatField(default=None, null=True)),
('ival', models.IntegerField(default=None, null=True)),
('bval', models.NullBooleanField(default=None)),
Expand All @@ -82,8 +82,8 @@ class Migration(migrations.Migration):
name='DbAuthInfo',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('auth_params', models.TextField(default=u'{}')),
('metadata', models.TextField(default=u'{}')),
('auth_params', models.TextField(default='{}')),
('metadata', models.TextField(default='{}')),
('enabled', models.BooleanField(default=True)),
('aiidauser', models.ForeignKey(to='db.DbUser', on_delete=models.CASCADE)),
],
Expand All @@ -96,15 +96,15 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('state', models.CharField(db_index=True, max_length=25,
choices=[(u'UNDETERMINED', u'UNDETERMINED'), (u'NOTFOUND', u'NOTFOUND'),
(u'RETRIEVALFAILED', u'RETRIEVALFAILED'),
(u'COMPUTED', u'COMPUTED'), (u'RETRIEVING', u'RETRIEVING'),
(u'WITHSCHEDULER', u'WITHSCHEDULER'),
(u'SUBMISSIONFAILED', u'SUBMISSIONFAILED'),
(u'PARSING', u'PARSING'), (u'FAILED', u'FAILED'),
(u'FINISHED', u'FINISHED'), (u'TOSUBMIT', u'TOSUBMIT'),
(u'SUBMITTING', u'SUBMITTING'), (u'IMPORTED', u'IMPORTED'),
(u'NEW', u'NEW'), (u'PARSINGFAILED', u'PARSINGFAILED')])),
choices=[('UNDETERMINED', 'UNDETERMINED'), ('NOTFOUND', 'NOTFOUND'),
('RETRIEVALFAILED', 'RETRIEVALFAILED'),
('COMPUTED', 'COMPUTED'), ('RETRIEVING', 'RETRIEVING'),
('WITHSCHEDULER', 'WITHSCHEDULER'),
('SUBMISSIONFAILED', 'SUBMISSIONFAILED'),
('PARSING', 'PARSING'), ('FAILED', 'FAILED'),
('FINISHED', 'FINISHED'), ('TOSUBMIT', 'TOSUBMIT'),
('SUBMITTING', 'SUBMITTING'), ('IMPORTED', 'IMPORTED'),
('NEW', 'NEW'), ('PARSINGFAILED', 'PARSINGFAILED')])),
('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
],
options={
Expand Down Expand Up @@ -135,8 +135,8 @@ class Migration(migrations.Migration):
('enabled', models.BooleanField(default=True)),
('transport_type', models.CharField(max_length=255)),
('scheduler_type', models.CharField(max_length=255)),
('transport_params', models.TextField(default=u'{}')),
('metadata', models.TextField(default=u'{}')),
('transport_params', models.TextField(default='{}')),
('metadata', models.TextField(default='{}')),
],
options={
},
Expand All @@ -147,11 +147,11 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('key', models.CharField(max_length=1024, db_index=True)),
('datatype', models.CharField(default=u'none', max_length=10, db_index=True,
choices=[(u'float', u'float'), (u'int', u'int'), (u'txt', u'txt'),
(u'bool', u'bool'), (u'date', u'date'), (u'json', u'json'),
(u'dict', u'dict'), (u'list', u'list'), (u'none', u'none')])),
('tval', models.TextField(default=u'', blank=True)),
('datatype', models.CharField(default='none', max_length=10, db_index=True,
choices=[('float', 'float'), ('int', 'int'), ('txt', 'txt'),
('bool', 'bool'), ('date', 'date'), ('json', 'json'),
('dict', 'dict'), ('list', 'list'), ('none', 'none')])),
('tval', models.TextField(default='', blank=True)),
('fval', models.FloatField(default=None, null=True)),
('ival', models.IntegerField(default=None, null=True)),
('bval', models.NullBooleanField(default=None)),
Expand All @@ -168,7 +168,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('uuid', models.CharField(max_length=36,editable=False, blank=True)),
('name', models.CharField(max_length=255, db_index=True)),
('type', models.CharField(default=u'', max_length=255, db_index=True)),
('type', models.CharField(default='', max_length=255, db_index=True)),
('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
('description', models.TextField(blank=True)),
],
Expand Down Expand Up @@ -208,7 +208,7 @@ class Migration(migrations.Migration):
('objname', models.CharField(db_index=True, max_length=255, blank=True)),
('objpk', models.IntegerField(null=True, db_index=True)),
('message', models.TextField(blank=True)),
('metadata', models.TextField(default=u'{}')),
('metadata', models.TextField(default='{}')),
],
options={
},
Expand Down Expand Up @@ -251,11 +251,11 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('key', models.CharField(max_length=1024, db_index=True)),
('datatype', models.CharField(default=u'none', max_length=10, db_index=True,
choices=[(u'float', u'float'), (u'int', u'int'), (u'txt', u'txt'),
(u'bool', u'bool'), (u'date', u'date'), (u'json', u'json'),
(u'dict', u'dict'), (u'list', u'list'), (u'none', u'none')])),
('tval', models.TextField(default=u'', blank=True)),
('datatype', models.CharField(default='none', max_length=10, db_index=True,
choices=[('float', 'float'), ('int', 'int'), ('txt', 'txt'),
('bool', 'bool'), ('date', 'date'), ('json', 'json'),
('dict', 'dict'), ('list', 'list'), ('none', 'none')])),
('tval', models.TextField(default='', blank=True)),
('fval', models.FloatField(default=None, null=True)),
('ival', models.IntegerField(default=None, null=True)),
('bval', models.NullBooleanField(default=None)),
Expand All @@ -279,9 +279,9 @@ class Migration(migrations.Migration):
('description', models.TextField(blank=True)),
('nodeversion', models.IntegerField(default=1, editable=False)),
('lastsyncedversion', models.IntegerField(default=0, editable=False)),
('state', models.CharField(choices=[(u'CREATED', u'CREATED'), (u'ERROR', u'ERROR'), (u'FINISHED', u'FINISHED'),
(u'INITIALIZED', u'INITIALIZED'), (u'RUNNING', u'RUNNING'), (u'SLEEP', u'SLEEP')],
default=u'INITIALIZED', max_length=255) ),
('state', models.CharField(choices=[('CREATED', 'CREATED'), ('ERROR', 'ERROR'), ('FINISHED', 'FINISHED'),
('INITIALIZED', 'INITIALIZED'), ('RUNNING', 'RUNNING'), ('SLEEP', 'SLEEP')],
default='INITIALIZED', max_length=255) ),
('report', models.TextField(blank=True)),
('module', models.TextField()),
('module_class', models.TextField()),
Expand All @@ -299,8 +299,8 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=255)),
('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
('data_type', models.CharField(default=u'PARAMETER', max_length=255)),
('value_type', models.CharField(default=u'NONE', max_length=255)),
('data_type', models.CharField(default='PARAMETER', max_length=255)),
('value_type', models.CharField(default='NONE', max_length=255)),
('json_value', models.TextField(blank=True)),
('aiida_obj', models.ForeignKey(blank=True, to='db.DbNode', null=True, on_delete=models.CASCADE)),
('parent', models.ForeignKey(related_name='data', to='db.DbWorkflow', on_delete=models.CASCADE)),
Expand All @@ -315,10 +315,10 @@ class Migration(migrations.Migration):
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('name', models.CharField(max_length=255)),
('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
('nextcall', models.CharField(default=u'none', max_length=255)),
('state', models.CharField(choices=[(u'CREATED', u'CREATED'), (u'ERROR', u'ERROR'), (u'FINISHED', u'FINISHED'),
(u'INITIALIZED', u'INITIALIZED'), (u'RUNNING', u'RUNNING'), (u'SLEEP', u'SLEEP')],
default=u'CREATED', max_length=255) ),
('nextcall', models.CharField(default='none', max_length=255)),
('state', models.CharField(choices=[('CREATED', 'CREATED'), ('ERROR', 'ERROR'), ('FINISHED', 'FINISHED'),
('INITIALIZED', 'INITIALIZED'), ('RUNNING', 'RUNNING'), ('SLEEP', 'SLEEP')],
default='CREATED', max_length=255) ),
('calculations', models.ManyToManyField(related_name='workflow_step', to='db.DbNode')),
('parent', models.ForeignKey(related_name='steps', to='db.DbWorkflow', on_delete=models.CASCADE)),
('sub_workflows', models.ManyToManyField(related_name='parent_workflow_step', to='db.DbWorkflow')),
Expand Down
18 changes: 9 additions & 9 deletions aiida/backends/djsite/db/migrations/0002_db_state_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def fix_calc_states(apps, schema_editor):
# and deal with them if they do
DbCalcState = apps.get_model('db', 'DbCalcState')
for calc_state in DbCalcState.objects.filter(
state__in=[u'UNDETERMINED', u'NOTFOUND']):
state__in=['UNDETERMINED', 'NOTFOUND']):
old_state = calc_state.state
calc_state.state = u'FAILED'
calc_state.state = 'FAILED'
calc_state.save()
# Now add a note in the log to say what we've done
calc = load_node(pk=calc_state.dbnode.pk)
Expand All @@ -48,13 +48,13 @@ class Migration(migrations.Migration):
# The UNDETERMINED and NOTFOUND 'states' were removed as these
# don't make sense
field=models.CharField(db_index=True, max_length=25,
choices=[(u'RETRIEVALFAILED', u'RETRIEVALFAILED'), (u'COMPUTED', u'COMPUTED'),
(u'RETRIEVING', u'RETRIEVING'), (u'WITHSCHEDULER', u'WITHSCHEDULER'),
(u'SUBMISSIONFAILED', u'SUBMISSIONFAILED'), (u'PARSING', u'PARSING'),
(u'FAILED', u'FAILED'), (u'FINISHED', u'FINISHED'),
(u'TOSUBMIT', u'TOSUBMIT'), (u'SUBMITTING', u'SUBMITTING'),
(u'IMPORTED', u'IMPORTED'), (u'NEW', u'NEW'),
(u'PARSINGFAILED', u'PARSINGFAILED')]),
choices=[('RETRIEVALFAILED', 'RETRIEVALFAILED'), ('COMPUTED', 'COMPUTED'),
('RETRIEVING', 'RETRIEVING'), ('WITHSCHEDULER', 'WITHSCHEDULER'),
('SUBMISSIONFAILED', 'SUBMISSIONFAILED'), ('PARSING', 'PARSING'),
('FAILED', 'FAILED'), ('FINISHED', 'FINISHED'),
('TOSUBMIT', 'TOSUBMIT'), ('SUBMITTING', 'SUBMITTING'),
('IMPORTED', 'IMPORTED'), ('NEW', 'NEW'),
('PARSINGFAILED', 'PARSINGFAILED')]),
preserve_default=True,
),
# Fix up any calculation states that had one of the removed states
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class TestDuplicateNodeUuidMigration(TestMigrations):
def setUpBeforeMigration(self):
from aiida.common.utils import get_new_uuid
self.file_name = 'test.temp'
self.file_content = u'#!/bin/bash\n\necho test run\n'
self.file_content = '#!/bin/bash\n\necho test run\n'

self.nodes_boolean = []
self.nodes_integer = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,7 @@ def upgrade():
connection.execute(text("""UPDATE db_dblog SET dbnode_id=objpk"""))

op.create_foreign_key(
None,
'db_dblog',
'db_dbnode', ['dbnode_id'], ['id'],
ondelete=u'CASCADE',
initially=u'DEFERRED',
deferrable=True
None, 'db_dblog', 'db_dbnode', ['dbnode_id'], ['id'], ondelete='CASCADE', initially='DEFERRED', deferrable=True
)

# Update the dbnode_id column to not nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def downgrade():
sa.Column('state', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
sa.Column('time', postgresql.TIMESTAMP(timezone=True), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(
['dbnode_id'], [u'db_dbnode.id'],
name=u'db_dbcalcstate_dbnode_id_fkey',
ondelete=u'CASCADE',
initially=u'DEFERRED',
deferrable=True), sa.PrimaryKeyConstraint('id', name=u'db_dbcalcstate_pkey'),
sa.UniqueConstraint('dbnode_id', 'state', name=u'db_dbcalcstate_dbnode_id_state_key'))
['dbnode_id'], ['db_dbnode.id'],
name='db_dbcalcstate_dbnode_id_fkey',
ondelete='CASCADE',
initially='DEFERRED',
deferrable=True), sa.PrimaryKeyConstraint('id', name='db_dbcalcstate_pkey'),
sa.UniqueConstraint('dbnode_id', 'state', name='db_dbcalcstate_dbnode_id_state_key'))
Loading

0 comments on commit 7531bd7

Please sign in to comment.