black formatting

This commit is contained in:
Jim Ladd 2021-03-24 12:00:46 -07:00
parent 6b4effc85a
commit db6f565dca
5 changed files with 20 additions and 29 deletions

View File

@ -3792,9 +3792,7 @@ class JobEventChildrenList(NoTruncateMixin, SubListAPIView):
def get_queryset(self):
parent_event = self.get_parent_object()
self.check_parent_access(parent_event)
return parent_event.job.get_event_queryset().filter(
parent_uuid=parent_event.uuid
)
return parent_event.job.get_event_queryset().filter(parent_uuid=parent_event.uuid)
class BaseJobEventsList(NoTruncateMixin, SubListAPIView):

View File

@ -501,10 +501,7 @@ class JobEvent(BasePlaybookEvent):
default='',
editable=False,
)
job_created = models.DateTimeField(
null=True,
editable=False
)
job_created = models.DateTimeField(null=True, editable=False)
def get_absolute_url(self, request=None):
return reverse('api:job_event_detail', kwargs={'pk': self.pk}, request=request)
@ -587,6 +584,8 @@ class JobEvent(BasePlaybookEvent):
class UnpartitionedJobEvent(JobEvent):
class Meta:
proxy = True
UnpartitionedJobEvent._meta.db_table = '_unpartitioned_' + JobEvent._meta.db_table # noqa
@ -613,10 +612,7 @@ class ProjectUpdateEvent(BasePlaybookEvent):
on_delete=models.CASCADE,
editable=False,
)
job_created = models.DateTimeField(
null=True,
editable=False
)
job_created = models.DateTimeField(null=True, editable=False)
@property
def host_name(self):
@ -626,6 +622,8 @@ class ProjectUpdateEvent(BasePlaybookEvent):
class UnpartitionedProjectUpdateEvent(ProjectUpdateEvent):
class Meta:
proxy = True
UnpartitionedProjectUpdateEvent._meta.db_table = '_unpartitioned_' + ProjectUpdateEvent._meta.db_table # noqa
@ -796,10 +794,7 @@ class AdHocCommandEvent(BaseCommandEvent):
default='',
editable=False,
)
job_created = models.DateTimeField(
null=True,
editable=False
)
job_created = models.DateTimeField(null=True, editable=False)
def get_absolute_url(self, request=None):
return reverse('api:ad_hoc_command_event_detail', kwargs={'pk': self.pk}, request=request)
@ -818,6 +813,8 @@ class AdHocCommandEvent(BaseCommandEvent):
class UnpartitionedAdHocCommandEvent(AdHocCommandEvent):
class Meta:
proxy = True
UnpartitionedAdHocCommandEvent._meta.db_table = '_unpartitioned_' + AdHocCommandEvent._meta.db_table # noqa
@ -843,10 +840,7 @@ class InventoryUpdateEvent(BaseCommandEvent):
on_delete=models.CASCADE,
editable=False,
)
job_created = models.DateTimeField(
null=True,
editable=False
)
job_created = models.DateTimeField(null=True, editable=False)
@property
def event(self):
@ -864,6 +858,8 @@ class InventoryUpdateEvent(BaseCommandEvent):
class UnpartitionedInventoryUpdateEvent(InventoryUpdateEvent):
class Meta:
proxy = True
UnpartitionedInventoryUpdateEvent._meta.db_table = '_unpartitioned_' + InventoryUpdateEvent._meta.db_table # noqa
@ -889,10 +885,7 @@ class SystemJobEvent(BaseCommandEvent):
on_delete=models.CASCADE,
editable=False,
)
job_created = models.DateTimeField(
null=True,
editable=False
)
job_created = models.DateTimeField(null=True, editable=False)
@property
def event(self):
@ -910,4 +903,6 @@ class SystemJobEvent(BaseCommandEvent):
class UnpartitionedSystemJobEvent(SystemJobEvent):
class Meta:
proxy = True
UnpartitionedSystemJobEvent._meta.db_table = '_unpartitioned_' + SystemJobEvent._meta.db_table # noqa

View File

@ -49,7 +49,7 @@ from awx.main.utils import (
getattr_dne,
polymorphic,
schedule_task_manager,
get_event_partition_epoch
get_event_partition_epoch,
)
from awx.main.constants import ACTIVE_STATES, CAN_CANCEL
from awx.main.redact import UriCleaner, REPLACE_STR

View File

@ -80,7 +80,7 @@ from awx.main.models import (
InventoryUpdateEvent,
AdHocCommandEvent,
SystemJobEvent,
build_safe_env
build_safe_env,
)
from awx.main.constants import ACTIVE_STATES
from awx.main.exceptions import AwxTaskError, PostRunError

View File

@ -10,8 +10,7 @@ from awx.main.models import Job
# created before job event tables were partitioned.
# This test can safely behave as if all job events were created
# after the migration, in which case Job.created_or_epoch == Job.created
@mock.patch('awx.main.models.Job.created_or_epoch',
Job.created)
@mock.patch('awx.main.models.Job.created_or_epoch', Job.created)
@pytest.mark.django_db
@pytest.mark.parametrize(
'truncate, expected',
@ -38,8 +37,7 @@ def test_job_events_sublist_truncation(get, organization_factory, job_template_f
# created before job event tables were partitioned.
# This test can safely behave as if all job events were created
# after the migration, in which case Job.created_or_epoch == Job.created
@mock.patch('awx.main.models.ad_hoc_commands.AdHocCommand.created_or_epoch',
Job.created)
@mock.patch('awx.main.models.ad_hoc_commands.AdHocCommand.created_or_epoch', Job.created)
@pytest.mark.django_db
@pytest.mark.parametrize(
'truncate, expected',