View namespace.py
import maya.cmds as cmds
from functools import wraps
from collections import Iterable
class NamespaceError(RuntimeError):
"""raised when a namespace object does not reflect the reality of the scene"""
pass
class NamespaceNameError(ValueError):
View ping.py
from pyb import Pin, ExtInt, LED
import time
import utime
import micropython
micropython.alloc_emergency_exception_buf(100)
global last_ping, delta, LAG
View transit.py
import sys, os, time
from collections import defaultdict
import re
import subprocess
SERVE_HTTP = False
if SERVE_HTTP:
import http.server
import socketserver
View KMeans.py
from collections import defaultdict, namedtuple
import operator
import random
from functools import reduce
import math
class Vector(namedtuple('vector', 'x y z')):
"""A generic Vector object"""
View Canvas.py
from array import array
from itertools import islice, izip, imap, izip_longest, tee, chain, product, ifilter
from maya.api.OpenMaya import MImage
import ctypes
def image_to_bytearray(img):
"""
View cython_compile.py
import os
import sys
import subprocess
PYHOME = os.environ.get("PY27", "C:\\ul\\tools\\python\\python27\\")
PYLIB = PYHOME + "libs"
PYINC = PYHOME + "include"
subprocess.call(("cython", sys.argv[-1], "--embed" ))
scriptfile = sys.argv[-1].replace(".pyx", ".py").replace(".py", ".c")
View UPath.py
import os
class UPathError(ValueError):
pass
class PathIsNotRelative(UPathError):
pass
View EnvSetting.py
__author__ = 'Steve'
import os
class EnvSetting(object):
"""
Set and unset an environemnt variable. If the variable did not exist at set time, it will be deleted at unset time
setter = EnvSetting('var', value)
View github-like.css
/*
* GitHub style for Pygments syntax codehiliteer, for use with Pygments. Note the ".codehilite" tag names
* Courtesy of GitHub.com
*/
.codehilite pre, pre, .codehilite .hll { background-color: #f8f8f8; border: 1px solid #ccc; padding: 6px 10px; border-radius: 3px; }
.codehilite .c { color: #999988; font-style: italic; }
.codehilite .err { color: #a61717; background-color: #e3d2d2; }
.codehilite .k { font-weight: bold; }
.codehilite .o { font-weight: bold; }
View vectorFunctions.py
def add(vect, other):
return tuple(a + b for a, b in zip(vect, other))
def sub(vect, other):
return tuple(a - b for a, b in zip(vect, other))
def mul(vect, other):
if hasattr(other, '__iter__'):
return tuple(a * b for a, b in zip(vect, other))
return tuple(a * b for a, b in zip(vect, [other] * len(vect)))