Skip to content

Instantly share code, notes, and snippets.

@zhukovgreen
zhukovgreen / test_rasing_deprecatoins.py
Created August 11, 2020 10:25
Example how to raise DeprecationWarnings in childs classes with proper class name
import warnings
import pytest
def deprecated(since, message):
def do_warn(cls):
warnings.warn(
f"{cls.__name__}: {message}, {since}", DeprecationWarning,
)
@zhukovgreen
zhukovgreen / pyproject.toml
Created July 21, 2020 13:07
Demo from lighting talks Jul 21, 2020
[tool.black]
line-length=79
target-version=["py38"]
[tool.isort]
line_length = 79
use_parentheses = true
balanced_wrapping = true
include_trailing_comma = true
multi_line_output = 3
@zhukovgreen
zhukovgreen / conftest.py
Created February 13, 2019 05:46
Using pytest fixtures factories with teardown
import pytest
@pytest.fixture(scope="function")
def fixture_arg():
def _opening_file_with_freecad(file):
# opening a file in freecad
print(f"starting with file is {file}")
file = "opened"
print(f"file is {file}")
import pandas as pd
import numpy as np
import visuals as vs
import matplotlib.pyplot as plt
from sklearn.metrics import r2_score
from sklearn import cross_validation
from sklearn.metrics import r2_score
data = pd.read_csv('housing.csv')
prices = data.MEDV
import os
from ctypes import *
from msl.loadlib import Server32
#from comtypes import BSTR
class Heatex32(Server32):
"""
class created by the 32bit process to wrap 32bit DLL which is called from 64bit Python
"""