Skip to content

Instantly share code, notes, and snippets.

Avatar

Ignacy Sokołowski ignacysokolowski

View GitHub Profile
@ignacysokolowski
ignacysokolowski / datastructure.py
Created Mar 15, 2017
Python 3.6 data structure
View datastructure.py
import pytest
class _DataStructureMeta(type):
def __new__(cls, class_name, bases, members):
try:
annotations = members['__annotations__']
except KeyError:
pass
@ignacysokolowski
ignacysokolowski / gist:5584572
Created May 15, 2013
Shell function for running PyTest with coverage and linting on specified application part
View gist:5584572
# Run PyTest with coverage and linting on specified application part.
#
# Useful shortcut when you're working at one class/function/module and you
# don't want to run all your tests and need to measure coverage only for what
# you're currently testing.
#
# Example::
#
# $ test_part tests/test_views.py app/views.py -vsk LoginView
#
@ignacysokolowski
ignacysokolowski / pulse_simple_play.py
Created Oct 29, 2012
Python: Play a WAV file with PulseAudio simple API
View pulse_simple_play.py
#!/usr/bin/env python
import ctypes
import wave
import sys
pa = ctypes.cdll.LoadLibrary('libpulse-simple.so.0')
PA_STREAM_PLAYBACK = 1
PA_SAMPLE_S16LE = 3