Add black formating.

pull/550/head
Andrey Dolgolev 2022-03-08 17:10:06 +02:00
rodzic 542f411449
commit 2077ea2c81
4 zmienionych plików z 34 dodań i 13 usunięć

Wyświetl plik

@ -247,7 +247,11 @@ def create_onboarding_resource(
token: uuid.UUID, token: uuid.UUID,
resource_data: Dict[str, Any] = { resource_data: Dict[str, Any] = {
"type": data.USER_ONBOARDING_STATE, "type": data.USER_ONBOARDING_STATE,
"steps": {"welcome": 0, "subscriptions": 0, "stream": 0,}, "steps": {
"welcome": 0,
"subscriptions": 0,
"stream": 0,
},
"is_complete": False, "is_complete": False,
}, },
) -> BugoutResource: ) -> BugoutResource:
@ -299,7 +303,9 @@ def json_type(evm_type: str) -> type:
def dashboards_abi_validation( def dashboards_abi_validation(
dashboard_subscription: data.DashboardMeta, abi: Any, s3_path: str, dashboard_subscription: data.DashboardMeta,
abi: Any,
s3_path: str,
): ):
""" """
@ -408,7 +414,9 @@ def validate_abi_json(abi: Any) -> None:
def upload_abi_to_s3( def upload_abi_to_s3(
resource: BugoutResource, abi: str, update: Dict[str, Any], resource: BugoutResource,
abi: str,
update: Dict[str, Any],
) -> Dict[str, Any]: ) -> Dict[str, Any]:
""" """
Uploading ABI to s3 bucket. Return object for updating resource. Uploading ABI to s3 bucket. Return object for updating resource.
@ -480,7 +488,11 @@ def get_all_entries_from_search(
return results return results
def apply_moonworm_tasks(subscription_type: str, abi: Any, address: str,) -> None: def apply_moonworm_tasks(
subscription_type: str,
abi: Any,
address: str,
) -> None:
""" """
Get list of subscriptions loads abi and apply them as moonworm tasks if it not exist Get list of subscriptions loads abi and apply them as moonworm tasks if it not exist
""" """

Wyświetl plik

@ -29,7 +29,9 @@ from ..settings import bugout_client as bc
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
router = APIRouter(prefix="/queries",) router = APIRouter(
prefix="/queries",
)
class ResourceQueryFetchException(Exception): class ResourceQueryFetchException(Exception):
@ -241,7 +243,8 @@ async def update_query_handler(
@router.post( @router.post(
"/{query_name}/update_data", tags=["queries"], "/{query_name}/update_data",
tags=["queries"],
) )
async def update_query_data_handler( async def update_query_data_handler(
request: Request, request: Request,
@ -303,7 +306,8 @@ async def update_query_data_handler(
if responce.status_code != 200: if responce.status_code != 200:
raise MoonstreamHTTPException( raise MoonstreamHTTPException(
status_code=responce.status_code, detail=responce.text, status_code=responce.status_code,
detail=responce.text,
) )
s3_response = data.QueryPresignUrl(**responce.json()) s3_response = data.QueryPresignUrl(**responce.json())
@ -315,7 +319,8 @@ async def update_query_data_handler(
@router.get("/{query_name}", tags=["queries"]) @router.get("/{query_name}", tags=["queries"])
async def get_access_link_handler( async def get_access_link_handler(
request: Request, query_name: str, request: Request,
query_name: str,
) -> Optional[data.QueryPresignUrl]: ) -> Optional[data.QueryPresignUrl]:
""" """
Request S3 presign url Request S3 presign url
@ -376,7 +381,8 @@ async def get_access_link_handler(
@router.delete("/{query_name}", tags=["queries"]) @router.delete("/{query_name}", tags=["queries"])
async def remove_query_handler( async def remove_query_handler(
request: Request, query_name: str, request: Request,
query_name: str,
) -> BugoutJournalEntry: ) -> BugoutJournalEntry:
""" """
Request delete query from journal Request delete query from journal

Wyświetl plik

@ -68,8 +68,8 @@ if MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX is None:
raise ValueError( raise ValueError(
"MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX environment variable must be set" "MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX environment variable must be set"
) )
MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX = MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX.rstrip( MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX = (
"/" MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX.rstrip("/")
) )
MOONSTREAM_CRAWLERS_SERVER_URL = os.environ.get("MOONSTREAM_CRAWLERS_SERVER_URL") MOONSTREAM_CRAWLERS_SERVER_URL = os.environ.get("MOONSTREAM_CRAWLERS_SERVER_URL")

Wyświetl plik

@ -84,14 +84,17 @@ async def now_handler() -> data.NowResponse:
@app.post("/jobs/stats_update", tags=["jobs"]) @app.post("/jobs/stats_update", tags=["jobs"])
async def status_handler( async def status_handler(
stats_update: data.StatsUpdateRequest, background_tasks: BackgroundTasks, stats_update: data.StatsUpdateRequest,
background_tasks: BackgroundTasks,
): ):
""" """
Update dashboard endpoint create are tasks for update. Update dashboard endpoint create are tasks for update.
""" """
dashboard_resource: BugoutResource = bc.get_resource( dashboard_resource: BugoutResource = bc.get_resource(
token=stats_update.token, resource_id=stats_update.dashboard_id, timeout=10, token=stats_update.token,
resource_id=stats_update.dashboard_id,
timeout=10,
) )
# get all user subscriptions # get all user subscriptions