Skip to content

Commit

Permalink
Refactoring: Code cleanup
Browse files Browse the repository at this point in the history
* Delete redundant future imports. Since Galaxy runs on Python >=3.6,
  all future imports are not effective.
* Delete redundant coding comments. Python 3.x uses UTF-8 as a default
  encoding for source files.
* Replace `set([...])` expressions with set literals.
* Replase empty `set([])` expressions with empty set constructor calls.

Signed-off-by: Alexander Saprykin <[email protected]>
  • Loading branch information
cutwater committed Mar 22, 2019
1 parent 26edc18 commit 46eaacd
Show file tree
Hide file tree
Showing 156 changed files with 8 additions and 406 deletions.
3 changes: 0 additions & 3 deletions galaxy/accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
import re
import django.contrib.auth.models
Expand Down
3 changes: 0 additions & 3 deletions galaxy/accounts/migrations/0002_auto_20150803_1328.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations


Expand Down
3 changes: 0 additions & 3 deletions galaxy/accounts/migrations/0003_auto_20151125_0840.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
3 changes: 0 additions & 3 deletions galaxy/accounts/migrations/0004_customuser_cache_refreshed.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
4 changes: 0 additions & 4 deletions galaxy/accounts/migrations/0005_github_attrs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-10 11:09
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-28 17:03
from __future__ import unicode_literals

from django.db import migrations


Expand Down
4 changes: 0 additions & 4 deletions galaxy/accounts/migrations/0007_auto_20180821_1259.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-08-21 16:59
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
4 changes: 0 additions & 4 deletions galaxy/accounts/migrations/0008_auto_20181011_1056.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-11 14:56
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
4 changes: 0 additions & 4 deletions galaxy/accounts/migrations/0009_auto_20181018_1248.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-18 16:48
from __future__ import unicode_literals

from django.db import migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.

from __future__ import unicode_literals

import re

from django.contrib.auth import models as auth_models
Expand Down
1 change: 0 additions & 1 deletion galaxy/accounts/tests/test_custom_user_model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# (c) 2012-2018, Ansible
# This file is part of Ansible Galaxy
#
Expand Down
2 changes: 0 additions & 2 deletions galaxy/api/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.

from __future__ import print_function

import logging
from collections import OrderedDict
from allauth.socialaccount.models import SocialToken
Expand Down
2 changes: 0 additions & 2 deletions galaxy/common/logutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.

from __future__ import absolute_import

import logging

from galaxy import constants
Expand Down
1 change: 0 additions & 1 deletion galaxy/common/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.
from __future__ import unicode_literals

import subprocess

Expand Down
2 changes: 0 additions & 2 deletions galaxy/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.

from __future__ import unicode_literals

import enum
import logging
import re
Expand Down
2 changes: 0 additions & 2 deletions galaxy/importer/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.

from __future__ import absolute_import

import os
import logging

Expand Down
2 changes: 0 additions & 2 deletions galaxy/importer/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.

from __future__ import absolute_import

import logging

from galaxy import constants
Expand Down
2 changes: 0 additions & 2 deletions galaxy/importer/utils/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.

from __future__ import absolute_import

import ast

import yaml
Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/management/commands/refresh_role_counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# You should have received a copy of the Apache License
# along with Galaxy. If not, see <http://www.apache.org/licenses/>.

from __future__ import print_function

import time
import logging

Expand Down
6 changes: 2 additions & 4 deletions galaxy/main/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations
import galaxy.main.mixins
from django.conf import settings
Expand Down Expand Up @@ -406,9 +404,9 @@ class Migration(migrations.Migration):
options={'verbose_name_plural': 'UserAliases'},
),
migrations.AlterUniqueTogether(
name='rolerating', unique_together=set([('owner', 'role')])
name='rolerating', unique_together={('owner', 'role')}
),
migrations.AlterUniqueTogether(
name='role', unique_together=set([('owner', 'name')])
name='role', unique_together={('owner', 'name')}
),
]
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0002_auto_20150824_1342.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0003_auto_20150824_1354.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0004_auto_20150824_1430.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import migrations

import math
Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0005_auto_20150824_1444.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import migrations

from galaxy.api.aggregators import AvgWithZeroForNull
Expand Down
4 changes: 1 addition & 3 deletions galaxy/main/migrations/0006_auto_20150825_1720.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import migrations


Expand All @@ -14,6 +12,6 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterIndexTogether(
name='platform',
index_together=set([('id', 'name')]),
index_together={('id', 'name')},
),
]
4 changes: 1 addition & 3 deletions galaxy/main/migrations/0007_auto_20150825_1723.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import migrations


Expand All @@ -14,6 +12,6 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterIndexTogether(
name='platform',
index_together=set([('name', 'id')]),
index_together={('name', 'id')},
),
]
4 changes: 1 addition & 3 deletions galaxy/main/migrations/0008_auto_20150825_1737.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import migrations


Expand All @@ -14,6 +12,6 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterIndexTogether(
name='platform',
index_together=set([]),
index_together=set(),
),
]
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0009_auto_20150826_0829.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0010_auto_20150826_1017.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0014_auto_20150917_1211.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations, IntegrityError

import galaxy.main.fields
Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0015_auto_20150917_1504.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0016_auto_20150922_1041.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0017_auto_20151104_1700.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0018_auto_20151104_1701.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0019_auto_20151113_0936.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations
import galaxy.main.mixins
from django.conf import settings
Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0020_auto_20151118_1350.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0021_auto_20151118_1425.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0022_auto_20151118_1642.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0023_auto_20151119_2020.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0024_importtask_finished.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0025_auto_20151120_1006.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0026_auto_20151122_0827.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings
import galaxy.main.fields
Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0027_auto_20151125_0009.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0028_auto_20151125_1231.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
2 changes: 0 additions & 2 deletions galaxy/main/migrations/0029_importtask_github_branch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# NOTE(cutwater): This migration is replaced by v2_4_0 and should be
# deleted once superseding migration is merged into master.
from __future__ import unicode_literals

from django.db import models, migrations


Expand Down
Loading

0 comments on commit 46eaacd

Please sign in to comment.