kopia lustrzana https://github.com/bugout-dev/moonstream
Add black formating.
rodzic
542f411449
commit
2077ea2c81
|
@ -247,7 +247,11 @@ def create_onboarding_resource(
|
|||
token: uuid.UUID,
|
||||
resource_data: Dict[str, Any] = {
|
||||
"type": data.USER_ONBOARDING_STATE,
|
||||
"steps": {"welcome": 0, "subscriptions": 0, "stream": 0,},
|
||||
"steps": {
|
||||
"welcome": 0,
|
||||
"subscriptions": 0,
|
||||
"stream": 0,
|
||||
},
|
||||
"is_complete": False,
|
||||
},
|
||||
) -> BugoutResource:
|
||||
|
@ -299,7 +303,9 @@ def json_type(evm_type: str) -> type:
|
|||
|
||||
|
||||
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(
|
||||
resource: BugoutResource, abi: str, update: Dict[str, Any],
|
||||
resource: BugoutResource,
|
||||
abi: str,
|
||||
update: Dict[str, Any],
|
||||
) -> Dict[str, Any]:
|
||||
"""
|
||||
Uploading ABI to s3 bucket. Return object for updating resource.
|
||||
|
@ -480,7 +488,11 @@ def get_all_entries_from_search(
|
|||
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
|
||||
"""
|
||||
|
|
|
@ -29,7 +29,9 @@ from ..settings import bugout_client as bc
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter(prefix="/queries",)
|
||||
router = APIRouter(
|
||||
prefix="/queries",
|
||||
)
|
||||
|
||||
|
||||
class ResourceQueryFetchException(Exception):
|
||||
|
@ -241,7 +243,8 @@ async def update_query_handler(
|
|||
|
||||
|
||||
@router.post(
|
||||
"/{query_name}/update_data", tags=["queries"],
|
||||
"/{query_name}/update_data",
|
||||
tags=["queries"],
|
||||
)
|
||||
async def update_query_data_handler(
|
||||
request: Request,
|
||||
|
@ -303,7 +306,8 @@ async def update_query_data_handler(
|
|||
|
||||
if responce.status_code != 200:
|
||||
raise MoonstreamHTTPException(
|
||||
status_code=responce.status_code, detail=responce.text,
|
||||
status_code=responce.status_code,
|
||||
detail=responce.text,
|
||||
)
|
||||
|
||||
s3_response = data.QueryPresignUrl(**responce.json())
|
||||
|
@ -315,7 +319,8 @@ async def update_query_data_handler(
|
|||
|
||||
@router.get("/{query_name}", tags=["queries"])
|
||||
async def get_access_link_handler(
|
||||
request: Request, query_name: str,
|
||||
request: Request,
|
||||
query_name: str,
|
||||
) -> Optional[data.QueryPresignUrl]:
|
||||
"""
|
||||
Request S3 presign url
|
||||
|
@ -376,7 +381,8 @@ async def get_access_link_handler(
|
|||
|
||||
@router.delete("/{query_name}", tags=["queries"])
|
||||
async def remove_query_handler(
|
||||
request: Request, query_name: str,
|
||||
request: Request,
|
||||
query_name: str,
|
||||
) -> BugoutJournalEntry:
|
||||
"""
|
||||
Request delete query from journal
|
||||
|
|
|
@ -68,8 +68,8 @@ if MOONSTREAM_S3_SMARTCONTRACTS_ABI_PREFIX is None:
|
|||
raise ValueError(
|
||||
"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")
|
||||
|
|
|
@ -84,14 +84,17 @@ async def now_handler() -> data.NowResponse:
|
|||
|
||||
@app.post("/jobs/stats_update", tags=["jobs"])
|
||||
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.
|
||||
"""
|
||||
|
||||
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
|
||||
|
|
Ładowanie…
Reference in New Issue