Skip to content

Commit

Permalink
Upgraded black and reblackened
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim O'Farrell authored and Tim O'Farrell committed Feb 25, 2024
1 parent e106071 commit ef77764
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 25 deletions.
1 change: 1 addition & 0 deletions servey/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Module for running a local python debugging server based on Uvicorn, along with a
local_schedule_mount for actions.
"""

import argparse
import json
import logging
Expand Down
16 changes: 10 additions & 6 deletions servey/cache_control/cache_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ def get_http_headers(self):
{
"ETag": self.etag,
"Cache-Control": self.get_cache_control_str(),
"Last-Modified": None
if self.updated_at is None
else formatdate(self.updated_at.timestamp(), usegmt=True),
"Expires": None
if self.expire_at is None
else formatdate(self.expire_at.timestamp(), usegmt=True),
"Last-Modified": (
None
if self.updated_at is None
else formatdate(self.updated_at.timestamp(), usegmt=True)
),
"Expires": (
None
if self.expire_at is None
else formatdate(self.expire_at.timestamp(), usegmt=True)
),
}
)

Expand Down
1 change: 1 addition & 0 deletions servey/servey_aws/lambda_invoker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Invoker for lambdas which assumes that action names are specified in environment variables, with one lambda per
action.
"""

import dataclasses
import importlib
import inspect
Expand Down
1 change: 1 addition & 0 deletions servey/servey_aws/lambda_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
different actions. Routers are used to try and link an event_channel to an action, which may be specific
to APIGateway, AppSync, or Direct Invocation
"""

import json
import logging
from marshy.types import ExternalItemType, ExternalType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def build_action_functions_yml(self) -> ExternalItemType:
lambda_definition = lambda_definitions[action.name] = filter_none(
{
"handler": "servey.servey_aws.lambda_invoker.invoke",
"description": action.description.strip()
if action.description
else None,
"description": (
action.description.strip() if action.description else None
),
"timeout": action.timeout,
"environment": {
"SERVEY_ACTION_MODULE": action.fn.__module__,
Expand Down
1 change: 1 addition & 0 deletions servey/servey_celery/celery_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
Log output for scheduled tasks should appear in the output for the worker.
"""

import logging
import os
from celery import Celery
Expand Down
1 change: 1 addition & 0 deletions servey/servey_direct/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
`python -m servey.servey_direct --action=say_hello "--event_channel={\"name\": \"Foobar\"}"`
"""

import argparse
import inspect
import json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ def create(
action.fn, skip_args, self.schema_context
),
result_marshaller=self.marshaller_context.get_marshaller(result_type),
result_schema=self.schema_context.schema_from_type(result_type)
if self.validate_output
else None,
result_schema=(
self.schema_context.schema_from_type(result_type)
if self.validate_output
else None
),
)
return endpoint
6 changes: 3 additions & 3 deletions servey/servey_strawberry/entity_factory/enum_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def create_type(
strawberry_enum = schema_factory.enums.get(annotation.__name__)
if not strawberry_enum:
# noinspection PyTypeChecker
strawberry_enum = schema_factory.enums[
annotation.__name__
] = strawberry.enum(annotation)
strawberry_enum = schema_factory.enums[annotation.__name__] = (
strawberry.enum(annotation)
)
return strawberry_enum

def create_input(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class AuthorizationHandlerFilter(HandlerFilterABC):
priority: int = 120
authorizer: AuthorizerABC = field(default_factory=get_default_authorizer)
# What to name the authorization parameter if none exists.
info_kwarg_name: str = "info" # NOTE: It seems that strawberry reserves the name: Info for this parameter
info_kwarg_name: str = (
"info" # NOTE: It seems that strawberry reserves the name: Info for this parameter
)

def filter(
self,
Expand Down
7 changes: 4 additions & 3 deletions servey/servey_test/test_servey_actions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Standard test mechanism for actions
"""

import inspect
from unittest import TestCase

Expand Down Expand Up @@ -29,8 +30,8 @@ def define_test_class():
for action in find_actions():
for example in action.examples or []:
if example.include_in_tests:
test_methods[
"test_" + action.name + "__" + example.name
] = _define_action_example_test(action, example)
test_methods["test_" + action.name + "__" + example.name] = (
_define_action_example_test(action, example)
)
test_class = type("TestServeyActions", (TestCase,), test_methods)
return test_class
1 change: 1 addition & 0 deletions servey/servey_thread/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
threads (As opposed to Celery).
Run this with `python -m servey.servey_thread`
"""

import logging
import os

Expand Down
16 changes: 10 additions & 6 deletions servey/servey_web_page/web_page_action_endpoint_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ def create(
params_schema=get_schema_for_params(
action.fn, skip_args, self.schema_context
),
result_marshaller=self.marshaller_context.get_marshaller(result_type)
if result_type
else None,
result_schema=self.schema_context.schema_from_type(result_type)
if self.validate_output and result_type
else None,
result_marshaller=(
self.marshaller_context.get_marshaller(result_type)
if result_type
else None
),
result_schema=(
self.schema_context.schema_from_type(result_type)
if self.validate_output and result_type
else None
),
template_name=trigger.template_name,
response_headers={"Content-Type": content_type},
)
Expand Down

0 comments on commit ef77764

Please sign in to comment.