Skip to content

Instantly share code, notes, and snippets.

View lensvol's full-sized avatar
🐈
Pokes things

Kirill Borisov lensvol

🐈
Pokes things
View GitHub Profile
@lensvol
lensvol / baronette.py
Created September 24, 2015 13:22
Код для модификации исходного кода с помощью redbaron, PyCon Russia 2015
# -*- coding: utf-8 -*-
from redbaron import RedBaron, AssignmentNode, TupleNode
def same_source(a, b):
"""
Фильтр узлов дерева.
"""
return a.value[0].value == b.value[0].value
@lensvol
lensvol / aster.py
Created September 24, 2015 13:21
Код для модификации AST с доклада на PyCon Russia 2015
# -*- coding: utf-8 -*-
import ast
from ast import (
Assign,
Subscript,
Name,
Index,
NodeTransformer,
Tuple,
@lensvol
lensvol / comment_it.py
Created August 2, 2013 11:40
Setting up verbose_name of model and its constituent fields as comment on a corresponding table in PostgreSQL. Also it tries to determine appropriate connection name for each model, in case multiple databases have been used. Used it to enhance SchemaSpy generated database schema description.
#coding: utf-8
from django.conf import settings
from django.db import connections, models as django_models
from django.utils.importlib import import_module
routers = []
models = django_models.get_models()
cursors = {}