This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import os | |
from alembic.config import Config | |
from alembic.script import Script, ScriptDirectory | |
from slugify import slugify # pip install python-slugify==6.1.2 | |
from core import settings | |
MIGRATIONS_DIR = settings.PROJECT_ROOT_DIR / "alembic/versions/" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def simple_decorator(func): | |
def wrapper(*args, **kwargs): | |
condition = True | |
if condition: | |
return func(*args, **kwargs) | |
print('condition else') | |
return {'error_code': 1} | |
return wrapper | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A(object): | |
k = None | |
def __init__(self,k): | |
self.k = k | |
def __eq__(self, other): | |
return self.k == other.k | |
source_items = [A(i) for i in [1,2,3,4,3,2,3,6]] |