Skip to content

Commit

Permalink
Addresses deviations from style guide and QA inpection issues. (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
djperrefort committed Aug 11, 2024
1 parent 9307b8e commit 45afdbc
Show file tree
Hide file tree
Showing 77 changed files with 437 additions and 430 deletions.
36 changes: 18 additions & 18 deletions docs/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ paths:
description: ''
post:
operationId: allocations_reviews_create
description: Create a new `AllocationRequestReview` object
description: Create a new `AllocationRequestReview` object.
tags:
- allocations
requestBody:
Expand Down Expand Up @@ -1551,7 +1551,7 @@ paths:
/logs/apps/:
get:
operationId: logs_apps_list
description: Returns application log data
description: Returns application log data.
parameters:
- in: query
name: func
Expand Down Expand Up @@ -1880,7 +1880,7 @@ paths:
/logs/apps/{id}/:
get:
operationId: logs_apps_retrieve
description: Returns application log data
description: Returns application log data.
parameters:
- in: path
name: id
Expand All @@ -1902,7 +1902,7 @@ paths:
/logs/requests/:
get:
operationId: logs_requests_list
description: Returns HTTP request log data
description: Returns HTTP request log data.
parameters:
- in: query
name: body_request
Expand Down Expand Up @@ -2219,7 +2219,7 @@ paths:
/logs/requests/{id}/:
get:
operationId: logs_requests_retrieve
description: Returns HTTP request log data
description: Returns HTTP request log data.
parameters:
- in: path
name: id
Expand All @@ -2241,7 +2241,7 @@ paths:
/logs/tasks/:
get:
operationId: logs_tasks_list
description: Returns results from scheduled background tasks
description: Returns results from scheduled background tasks.
parameters:
- in: query
name: content_encoding
Expand Down Expand Up @@ -2801,7 +2801,7 @@ paths:
/logs/tasks/{id}/:
get:
operationId: logs_tasks_retrieve
description: Returns results from scheduled background tasks
description: Returns results from scheduled background tasks.
parameters:
- in: path
name: id
Expand Down Expand Up @@ -4487,7 +4487,7 @@ components:
schemas:
Allocation:
type: object
description: Object serializer for the `Allocation` class
description: Object serializer for the `Allocation` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -4520,7 +4520,7 @@ components:
- requested
AllocationRequest:
type: object
description: Object serializer for the `AllocationRequest` class
description: Object serializer for the `AllocationRequest` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -4559,7 +4559,7 @@ components:
- title
AllocationRequestReview:
type: object
description: Object serializer for the `AllocationRequestReview` class
description: Object serializer for the `AllocationRequestReview` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -4611,7 +4611,7 @@ components:
* `CR` - Changes Requested
AppLog:
type: object
description: Object serializer for the `AppLog` class
description: Object serializer for the `AppLog` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -4653,7 +4653,7 @@ components:
- time
Cluster:
type: object
description: Object serializer for the `Cluster` class
description: Object serializer for the `Cluster` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -4727,7 +4727,7 @@ components:
default: true
PatchedAllocation:
type: object
description: Object serializer for the `Allocation` class
description: Object serializer for the `Allocation` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -4755,7 +4755,7 @@ components:
type: integer
PatchedAllocationRequest:
type: object
description: Object serializer for the `AllocationRequest` class
description: Object serializer for the `AllocationRequest` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -4788,7 +4788,7 @@ components:
type: integer
PatchedAllocationRequestReview:
type: object
description: Object serializer for the `AllocationRequestReview` class
description: Object serializer for the `AllocationRequestReview` class.
properties:
id:
type: integer
Expand All @@ -4813,7 +4813,7 @@ components:
type: integer
PatchedCluster:
type: object
description: Object serializer for the `Cluster` class
description: Object serializer for the `Cluster` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -5012,7 +5012,7 @@ components:
- title
RequestLog:
type: object
description: Object serializer for the `RequestLog` class
description: Object serializer for the `RequestLog` class.
properties:
id:
type: integer
Expand Down Expand Up @@ -5159,7 +5159,7 @@ components:
- username
TaskResult:
type: object
description: Object serializer for the `TaskResult` class
description: Object serializer for the `TaskResult` class.
properties:
id:
type: integer
Expand Down
6 changes: 3 additions & 3 deletions keystone_api/apps/admin_utils/management/commands/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class Command(BaseCommand):
help = __doc__

def add_arguments(self, parser: ArgumentParser) -> None:
"""Define command-line arguments
"""Define command-line arguments.
Args:
parser: The parser instance to add arguments under
parser: The parser instance to add arguments under.
"""

group = parser.add_argument_group('clean options')
Expand All @@ -37,7 +37,7 @@ def add_arguments(self, parser: ArgumentParser) -> None:
group.add_argument('--all', action='store_true', help='Shorthand for deleting all targets')

def handle(self, *args, **options) -> None:
"""Handle the command execution
"""Handle the command execution.
Args:
*args: Additional positional arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class Command(BaseCommand):
help = __doc__

def handle(self, *args, **options) -> None:
"""Handle the command execution
"""Handle the command execution.
Args:
*args: Additional positional arguments
**options: Additional keyword arguments
*args: Additional positional arguments.
**options: Additional keyword arguments.
"""

try:
Expand All @@ -27,7 +27,7 @@ def handle(self, *args, **options) -> None:
exit(1)

def _handle(self) -> None:
"""Execute the application logic"""
"""Execute the application logic."""

if not self.prompt_for_confirmation():
return
Expand All @@ -49,10 +49,10 @@ def _handle(self) -> None:

@staticmethod
def prompt_for_confirmation() -> bool:
"""Prompt the user to confirm executing of the parent command
"""Prompt the user to confirm executing of the parent command.
Args:
A boolean indicating whether the user confirmed execution
A boolean indicating whether the user confirmed execution.
"""

print(
Expand All @@ -73,12 +73,12 @@ def prompt_for_confirmation() -> bool:

@staticmethod
def get_profile_path() -> Path | None:
"""Search the user's home directory .bash_profile or .bashrc file
"""Search the user's home directory .bash_profile or .bashrc file.
The .bash_profile file is given preference over .bashrc.
Return:
The file path object if a file is found, otherwise None
Returns:
The file path object if a file is found, otherwise `None`.
"""

bash_profile_path = Path.home() / '.bash_profile'
Expand Down
20 changes: 10 additions & 10 deletions keystone_api/apps/admin_utils/management/commands/quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class Command(BaseCommand):
help = __doc__

def add_arguments(self, parser: ArgumentParser) -> None:
"""Add command-line arguments to the parser
"""Add command-line arguments to the parser.
Args:
parser: The argument parser instance
parser: The argument parser instance.
"""

group = parser.add_argument_group('quickstart options')
Expand All @@ -45,11 +45,11 @@ def add_arguments(self, parser: ArgumentParser) -> None:
group.add_argument('--all', action='store_true', help='Launch all available services.')

def handle(self, *args, **options) -> None:
"""Handle the command execution
"""Handle the command execution.
Args:
*args: Additional positional arguments
**options: Additional keyword arguments
*args: Additional positional arguments.
**options: Additional keyword arguments.
"""

# Note: `no_input=False` indicates the user should not be prompted for input
Expand All @@ -75,7 +75,7 @@ def handle(self, *args, **options) -> None:
self.run_gunicorn()

def create_admin(self) -> None:
"""Create an `admin` user account if no other accounts already exist"""
"""Create an `admin` user account if no other accounts already exist."""

user = get_user_model()
if user.objects.exists():
Expand All @@ -86,7 +86,7 @@ def create_admin(self) -> None:

@staticmethod
def run_celery() -> None:
"""Start a Celery worker"""
"""Start a Celery worker."""

subprocess.Popen(['redis-server'])
subprocess.Popen(['celery', '-A', 'keystone_api.apps.scheduler', 'worker'])
Expand All @@ -95,11 +95,11 @@ def run_celery() -> None:

@staticmethod
def run_gunicorn(host: str = '0.0.0.0', port: int = 8000) -> None:
"""Start a Gunicorn server
"""Start a Gunicorn server.
Args:
host: The host to bind to
port: The port to bind to
host: The host to bind to.
port: The port to bind to.
"""

command = ['gunicorn', '--bind', f'{host}:{port}', 'keystone_api.main.wsgi:application']
Expand Down
Loading

0 comments on commit 45afdbc

Please sign in to comment.