Even though React provides Error Boundaries API, it is not a good candidate, nor is relevant for handling GraphQL query errors.
import { useState, useCallback } from 'react';
import logging | |
import os | |
from celery import Celery | |
from celery.schedules import crontab | |
from celery.signals import after_setup_logger, after_setup_task_logger | |
from django.conf import settings | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local") |
async *genLogs() { | |
while (true) { | |
yield await window.pywebview.api.gen_logs(); | |
} | |
} | |
const g = genLogs(); | |
(await g.next()).value // 1 | |
(await g.next()).value // 2 |
name: Release | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest |
from asyncio import coroutines, events, tasks | |
def run_with_wait(main, *, debug=None): | |
""" | |
Difference from asyncio.run(): | |
- asyncio.run() cancels all tasks when `main` is completed. | |
any tasks created using `asyncio.create_task()` will hence be cancelled. | |
- run_with_wait() waits for all tasks to be completed using | |
`run_until_complete()` and `asyncio.tasks.gather()` |
FROM python:3.10 AS base | |
WORKDIR /app | |
RUN curl -sSL https://install.python-poetry.org | python3 - | |
COPY ./poetry.lock /app/poetry.lock | |
COPY ./pyproject.toml /app/pyproject.toml |
import logging | |
from sqlalchemy import MetaData, Table | |
from sqlalchemy.ext.asyncio import AsyncSession as _AsyncSession | |
from sqlalchemy.ext.asyncio import create_async_engine | |
from sqlalchemy.orm import sessionmaker | |
logger = logging.getLogger(__name__) | |
meta = MetaData() |
OLDPWD=$(pwd) \ | |
&& cd "$(poetry env info --path)/lib/python3.9/site-packages" \ | |
&& zip -r9 ./app.zip . -x "*.pyc" \ | |
&& mv ./app.zip $OLDPWD \ | |
&& cd $OLDPWD \ | |
&& zip -rg ./app.zip ./app \ | |
&& aws lambda update-function-code --function-name my_function --zip-file fileb://app.zip | |
# A better alternative is to first upload to an S3 bucket, then update the function |
Even though React provides Error Boundaries API, it is not a good candidate, nor is relevant for handling GraphQL query errors.
import { useState, useCallback } from 'react';
import re | |
import unidecode | |
def to_snake_case(text): | |
""" | |
Convert unicode text to snake case | |
>>> to_snake_case("My favourite dish was raclette.") |
from starlette.testclient import TestClient | |
class CookieConfigurableTestClient(TestClient): | |
_access_token = None | |
def set_access_token(self, token): | |
self._access_token = token | |
def reset(self): |