Skip to content

Instantly share code, notes, and snippets.

View saichenko's full-sized avatar

Vladislav Saichenko saichenko

View GitHub Profile
from collections import namedtuple
Days = namedtuple("Days", ("buy", "sell"))
def find_profit_days(n: int, prices: list[int]) -> Days:
min_price = prices[0]
max_profit = 0
buy_day = 1
sell_day = 1
@saichenko
saichenko / conftest_alembic.py
Created October 14, 2021 19:38
Example of configuring a database with Alembic migrations using the 'pytest-async-sqlalchemy' lib
import asyncio
import pytest
from alembic.command import upgrade as alembic_upgrade
from alembic.config import Config as AlembicConfig
from pytest_async_sqlalchemy import create_database, drop_database
@pytest.fixture(scope="session")
def event_loop():