Skip to content

Instantly share code, notes, and snippets.

"""
Tail call 'optimization'
------------------------
A simple tail call 'optimization' implemented by a trampoline.
Usage
-----
Use the `tailrec` decorator on the function, and change the tail recursive
"""
FreeViz
-------
Compute a lower dimensional linear projection to optimize separation
between classes.
"""
import numpy
"""
Utilities for inspecting/modifying widget geometry state as returned/set by
`QWidget.saveGeometry` and `QWidget.restoreGeometry`
"""
import struct
from collections import namedtuple
#: Parsed geometry state (version 1; Qt < 5.4)
"""
Thread safer backcompatibility layer for `subprocess`
"""
from __future__ import absolute_import, print_function
import os
import sys
import threading
import atexit
@ales-erjavec
ales-erjavec / pyqt-convert.sh
Last active June 15, 2016 15:52
Convert a PyQt4/PyQt5 official windows installer into a pip installable wheel file
#! /bin/bash
set -e
function print_usage {
echo 'pyqt-convert.sh INSTALLER
Convert a PyQt4/PyQt5 windows installer into a wheel package.
note: 7z executable must be on PATH.
"""
A QSignalSpy like object, which is sadly missing from PyQt4 (but is exposed in PyQt5)
No guaranties it behaves as the real thing under all circumstances.
"""
from PyQt4.QtCore import QObject, QEventLoop, QTimer
class QSignalSpy(QObject):
"""
import weakref
from types import SimpleNamespace as namespace
from PyQt4.QtCore import QObject
class qobjref(object):
"""
A 'guarded reference' to a QObject.
An instance of a `qobjref` holds a reference to a `QObject` for as long
@ales-erjavec
ales-erjavec / qcheckcombobox.py
Last active June 20, 2023 09:45
A QComboBox supporting multiple item selection
"""
Check Combo Box
---------------
A QComboBox subclass designed for multiple item selection.
The combo box popup allows the user to check/uncheck multiple items at
once.
"""
@ales-erjavec
ales-erjavec / python-framework-reloc.sh
Last active June 23, 2023 08:56
Fetch, extract and layout a macOS relocatable Python framework
#!/usr/bin/env bash
usage() {
echo "$0 [ --version VERSION ] FRAMEWORKPATH
Fetch, extract and layout a macOS relocatable Python framework at FRAMEWORKPATH
Options:
--version VERSION Python version (default ${VERSION})
--macos MACOSVER Minimum supported macOS version (as of 3.6.5 and
"""
Utilities for building concurrent PyQt5 applications.
"""
from __future__ import absolute_import
import threading
import weakref
import logging
import warnings