| |
- any_in(items, thing)
- console_width()
- Get the width of the console screen (if any).
- echoif(switch)
- Decorator - calls echoized
eq.:
@echoif(DEBUG_CALLSTACK)
class OrderPricing(objec):
...
- echoized(func_or_cls)
- Decorator
Echos a function's signature prior to evaluating it, of does the
same for all methods of a class.
ISSUES:
If used on a single method of a class, it fails to identify the
arg names, and self is not distinguished from other args.
(or in conjunction with @cached)
eq.:
op = OrderPricing()
op = echoized(OrderPricing)()
e = Editions(nid=nid)
e = echoized(Editions)(nid=nid)
- format_date(d)
- Given a datetime object
Return a string in the form of "mm/dd/yyyy"
- format_datetime(d, with_seconds=False, format=None)
- Given a datetime object
Return formated String as follows:
Format: None : 11/22/2013 01:46[:00] am
ISO8601: 2013-11-21T01:46:00-05:00 (EST)
- formatdict(d, width=162, indent=0, keylen=0, color=False)
- Recursively format contents of dictionaries in sorted tabular order.
Optionally a certain width, indented, and/or a specific key length.
>>> utils.formatdict(batch_item)
active: 1
batch_id: 3250
on_press: None
order_id: 2007372
page_list: None
qty: 2
removed_date: None
- lazyproperty(fn)
- A decorator that computes a property variable and then caches.
http://stackoverflow.com/questions/3012421/python-lazy-property-decorator
- list2csv(data)
- Given a Table of data as a LIST of LISTs
Return in CSV format as a STR
- pretty(X)
- Return X formated nicely for the console
- rev_move(src, dst, max_revs=20, copy=False, debug=False)
- Rev destination file, if it exists, before moving src to dst.
Multiple calls to the same dst file might create this set of files:
tanner
tanner_1
tanner_2
tanner_3
- shift(alist)
- Shift the first element off of an array, and return it
- str2date(s)
- Convert str in the form of "2010-11-11" to a
datetime.date Object
- str2datetime(s, format='%Y-%m-%d %H:%M:%S')
- Convert str in the form of "2010-11-11 17:39:52" or
"2010-11-11" to a
datetime.datetime Object
- table2csv(data)
- Give a LIST or TUPLE
Return: A CSV table as STRING or the input data if not LIST or TUPLE
- uniqueId(with_millisec=False)
- Return system time to the millisec as set of numbers
- valid_email(email)
- Given an email address
Return whether it is in valid format as BOOLEAN
- validate_num_args(s, num_args, args)
- word_wrap(string, width, ind1=0, ind2=0)
- Wrap long lines of text.
Prefer spaces or non-alpha-numeric break points.
ind1 = initial indentation
ind2 = hanging indentation
|