Skip to content

Commit

Permalink
flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fosterseth committed Mar 10, 2020
1 parent 29d6de5 commit 1c39cd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions awx/main/management/commands/deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
)
from collections import Counter, OrderedDict
from django.db import transaction
from django.db.models import signals, sql
from django.db.models import sql


# This overrides the method in django.contrib.contenttypes.fields.py
def bulk_related_objects(field, objs, using):
# This overrides the method in django.contrib.contenttypes.fields.py
"""
Return all objects related to ``objs`` via this ``GenericRelation``.
"""
Expand All @@ -17,8 +18,9 @@ def bulk_related_objects(field, objs, using):
"%s__in" % field.object_id_field_name: list(objs.values_list('pk', flat=True))
})

# take from .delete method in django.db.models.query.py

def pre_delete(qs):
# take from .delete method in django.db.models.query.py
assert qs.query.can_filter(), \
"Cannot use 'limit' or 'offset' with delete."

Expand All @@ -38,6 +40,7 @@ def pre_delete(qs):
del_query.query.clear_ordering(force_empty=True)
return del_query


class AWXCollector(Collector):

def add(self, objs, source=None, nullable=False, reverse_dependency=False):
Expand Down
8 changes: 4 additions & 4 deletions awx/main/tests/functional/commands/test_cleanup_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def test_cleanup_jobs(self, inventory, project, machine_credential, host):
self.setup_environment(inventory, project, machine_credential, host)

# related_fields
related = [f for f in Job._meta.get_fields(include_hidden=True) \
if f.auto_created \
and not f.concrete \
and (f.one_to_one or f.one_to_many)]
related = [f for f in Job._meta.get_fields(include_hidden=True)
if f.auto_created and not
f.concrete and
(f.one_to_one or f.one_to_many)]

job = self.old_jobs[-1] # last job

Expand Down

0 comments on commit 1c39cd5

Please sign in to comment.