Skip to content

Instantly share code, notes, and snippets.

View nkartashov's full-sized avatar

Nick Kartashov nkartashov

View GitHub Profile
@nkartashov
nkartashov / sqlalchemy_debug_logging.py
Last active September 25, 2023 12:23
Sqlalchemy debug logging
import logging
logging.basicConfig()
logging.getLogger('sqlalchemy.engine').setLevel(logging.DEBUG)
@nkartashov
nkartashov / nditer_bug.py
Created April 22, 2018 11:25
nditer doesn't preserve the class
import numpy as np
class CustomArray(np.ndarray):
def __new__(cls, matrix, custom_attribute):
obj = np.asarray(matrix).view(cls)
obj.custom_attribute = custom_attribute
return obj
def __array_finalize__(self, obj):
if obj is None:
return