Skip to content

Instantly share code, notes, and snippets.

@guewen
guewen / behave_optional_argument
Last active May 21, 2020 13:16
Use an optional argument in a behave phrase.
from behave.matchers import register_type
def parse_optional(text):
return text.strip()
# https://pypi.python.org/pypi/parse#custom-type-conversions
parse_optional.pattern = r'\s?\w*\s?'
register_type(optional=parse_optional)
@silmang
silmang / sendkey.py
Last active November 1, 2020 09:23
[python] windows send key and mouse code
import ctypes, time
SendInput = ctypes.windll.user32.SendInput
# C struct redefinitions
PUL = ctypes.POINTER(ctypes.c_ulong)
class KeyBdInput(ctypes.Structure):
_fields_ = [("wVk", ctypes.c_ushort),
("wScan", ctypes.c_ushort),
("dwFlags", ctypes.c_ulong),