Trees | Indices | Help |
|
---|
|
General-purpose types and utilities.
Copyright 2007-2014 Research Foundation State University of New York This file is part of QUB Express.
QUB Express is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QUB Express is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License, named LICENSE.txt, in the QUB Express program directory. If not, see <http://www.gnu.org/licenses/>.
|
|||
Event Usage: |
|||
WeakEvent Usage: |
|||
WeakCall Like WeakEvent, except there's at most one listener, and it can return a value. |
|||
Reffer Holds references to keep objects alive. |
|||
DeathRattle Prints to stdout when it is finally freed, presumably at the same time as its owner. |
|||
Anon An object whose fields are the constructor keyword arguments. |
|||
JsonAnon | |||
Product | |||
OverridingDict "Overrides" the base dict so keys are looked up first here, then if not found, in base dict. |
|||
ToolRegistry A collection of tools or actions, grouped by category. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
ShowDropped = False
|
|||
UNSET_VALUE = 86738.82583
|
|||
true = True
|
|||
false = False
|
|||
COLOR = defaultdict(<function <lambda> at 0x7fd137b1e1b8>, {0:
|
|||
MAX_SAFENAME_LEN = 32
|
|||
valid_identifier = re.compile(r'^
|
|||
__package__ =
|
|||
e = 2.71828182846
|
|||
pi = 3.14159265359
|
|||
rdbk =
|
|||
rdbreak =
|
|||
rdname =
|
|
Prints and returns its argument(s). Handy for testing callbacks. |
like builtin reduce(), but recursing by splitting in half. Doesn't seem to make a difference. |
Returns wrapped func that caches return values for specific args. All args must be immutable (e.g. tuples not lists). Example: >>> def factorial(n): >>> if n > 1: >>> return n * fast_fac(n-1) >>> else: >>> return 1 >>> fast_fac = memoize(factorial) |
Returns wrapped func that caches most recent n return values for specific args. All args must be immutable (e.g. tuples not lists). |
Returns wrapped func that caches return values for specific args. All args must be immutable (e.g. tuples not lists). Keeps most recent k results such that sum(weigh(result) for result in results[:k]) <= max_weight. Example: >>> def factorial(n): >>> if n > 1: >>> return n * fast_fac(n-1) >>> else: >>> return 1 >>> fast_fac = memoize(factorial) |
Returns a function f which, when called, discards its own args and returns callback(*args, **kw). Lambda can be useful to share one message handler among many sources, but there's a limitation: >>> for i in xrange(N): chk[i].OnToggle += self__ref(lambda chk: self.__onToggle(i)) Here, the lambda binds not the value of i, but the stack location whose contents are repeatedly changed by the for loop. So all the lambdas are effectively doing self.__onToggle(N-1). Instead: >>> for i in xrange(N): chk[i].OnToggle += self.__ref(bind(self.__onToggle, i)) This creates a unique stack frame for your unique i, so it does what you expect. |
Returns (r,g,b) color coordinates corresponding to the hue, saturation and value. All coordinates are between 0 and 1. |
Returns the (hue, saturation, value) color coordinates corresponding to the RGB color. All coordinates are between 0 and 1. |
Returns r,g,b corresponding to x in [-1..1]. The scale moves smoothly around the color wheel from pink (-) to red (+), with brightness proportional to abs(x). |
Returns val, increased or decreased proportional to offset.
|
Returns val scrolled according to offset direction and modifiers.
|
Returns val scrolled according to offset direction and modifiers; by default moves in increments of 10**(k-1), where 10**k <= val < 10**(k+1) -- the second most significant digit.
|
from Mark Dickinson (via stackoverflow.com): a more legible, flexible way to break out of nested loops, e.g. with nested_break() as mylabel: while True: print "current state" while True: ok = raw_input("Is this ok? (y/n)") if ok == "y" or ok == "Y": raise mylabel if ok == "n" or ok == "N": break print "more processing"
|
|
COLOR
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Dec 15 19:07:38 2017 | http://epydoc.sourceforge.net |