Skip to content

Instantly share code, notes, and snippets.

View timmwagener's full-sized avatar

Timm Wagener timmwagener

View GitHub Profile
# constants
PYTHON_VERSION="310"
PYTHON="Python$PYTHON_VERSION"
# symlinked directories
# make symlink: mklink /d "c:\symlinks\venvs" "e:\venvs"
# remove symlink: rmdir "c:\symlinks\venvs"
# SeeAlso: https://superuser.com/a/306618
SYMLINKS_DIR="/c/symlinks"
TOOLS_DIR="$SYMLINKS_DIR/tools"
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division, absolute_import
from logging import getLogger
from autobahn.asyncio.wamp import ApplicationSession
from autobahn.asyncio.component import Component
@timmwagener
timmwagener / gather_cancellation_test.py
Created May 23, 2020 12:56
Test gather cancellation and resulting state.
# -*- coding: utf-8 -*-
"""Test gather cancellation and resulting state.
SeeAlso:
https://stackoverflow.com/questions/61942306/asyncio-gather-task-cancelled-is-false-after-task-cancel
Here's my take on what's happening:
* future_gather.cancel() cancels task_child
* await future_gather will cause task_child to run and raise CancelledError
@timmwagener
timmwagener / pyside_ui_singleton_example.py
Last active June 28, 2016 10:02
Quick pattern of how to enforce UI singletons.
# -*- coding: utf-8 -*-
import logging
from PySide import QtGui
from PySide import QtCore
def delete_instances(widget_type):
"""Search for all instances of widget_type and delete them. We find them
by class name instead of type since this is safer with all the reload() action