¡@

Home 

python Programming Glossary: fn

How can I profile a SQLAlchemy powered application?

http://stackoverflow.com/questions/1171166/how-can-i-profile-a-sqlalchemy-powered-application

cProfile as profiler import gc pstats time def profile fn def wrapper args kw elapsed stat_loader result _profile foo.txt.. args kw elapsed stat_loader result _profile foo.txt fn args kw stats stat_loader stats.sort_stats 'cumulative' stats.print_stats.. return result return wrapper def _profile filename fn args kw load_stats lambda pstats.Stats filename gc.collect began..

How do you get a directory listing sorted by creation date in python?

http://stackoverflow.com/questions/168409/how-do-you-get-a-directory-listing-sorted-by-creation-date-in-python

in the directory w stats entries os.path.join dirpath fn for fn in os.listdir dirpath entries os.stat path path for path.. the directory w stats entries os.path.join dirpath fn for fn in os.listdir dirpath entries os.stat path path for path in..

Evaluating a mathematical expression in a string

http://stackoverflow.com/questions/2371436/evaluating-a-mathematical-expression-in-a-string

' ' addop ' ' ' ' integer ' ' ' ' '0'..'9' atom PI E real fn ' ' expr ' ' ' ' expr ' ' factor atom expop factor term factor.. expr term addop term point Literal . e CaselessLiteral E fnumber Combine Word nums nums Optional point Optional Word nums.. CaselessLiteral PI expr Forward atom Optional oneOf pi e fnumber ident lpar expr rpar .setParseAction self.pushFirst Optional..

Python lazy property decorator

http://stackoverflow.com/questions/3012421/python-lazy-property-decorator

decorator which removes the boilerplace def lazyprop fn attr_name '_lazy_' fn.__name__ @property def _lazyprop self.. removes the boilerplace def lazyprop fn attr_name '_lazy_' fn.__name__ @property def _lazyprop self if not hasattr self attr_name.. self if not hasattr self attr_name setattr self attr_name fn self return getattr self attr_name return _lazyprop class Test..

TypeError: 'str' does not support the buffer interface

http://stackoverflow.com/questions/5471158/typeerror-str-does-not-support-the-buffer-interface

it . s input Please enter the text you want to compress fn input Please enter the desired filename with gzip.open fn .gz.. fn input Please enter the desired filename with gzip.open fn .gz wb as f_out f_out.write bytes s 'UTF 8' Also do not use.. Polish letters with UTF 8 encoding s 'Polish text ó źż ŹŻ' fn 'fn.gz' with gzip.open fn 'wb' as f_out f_out.write bytes s..

How can I make a chain of function decorators in Python?

http://stackoverflow.com/questions/739654/how-can-i-make-a-chain-of-function-decorators-in-python

decorators work. Here is what you asked for def makebold fn def wrapped return b fn b return wrapped def makeitalic fn def.. is what you asked for def makebold fn def wrapped return b fn b return wrapped def makeitalic fn def wrapped return i fn i.. fn def wrapped return b fn b return wrapped def makeitalic fn def wrapped return i fn i return wrapped @makebold @makeitalic..

Simple Digit Recognition OCR in OpenCV-Python

http://stackoverflow.com/questions/9413216/simple-digit-recognition-ocr-in-opencv-python

just for testing import numpy as np import cv2 fn 'letter recognition.data' a np.loadtxt fn np.float32 delimiter.. as np import cv2 fn 'letter recognition.data' a np.loadtxt fn np.float32 delimiter ' ' converters 0 lambda ch ord ch ord 'A'..

How do I create a CSV file from database in Python?

http://stackoverflow.com/questions/3710263/how-do-i-create-a-csv-file-from-database-in-python

directly from sql not written in python. w csv.writer open Fn 'wb' dialect 'excel' #w.writelines header_row #Fetch into sqld..

Using python to append CSV files

http://stackoverflow.com/questions/4249185/using-python-to-append-csv-files

data every other row. How do i fix import csv LL 1 2 3 4 Fn C Test.csv w csv.writer open Fn 'a' dialect 'excel' w.writerows.. fix import csv LL 1 2 3 4 Fn C Test.csv w csv.writer open Fn 'a' dialect 'excel' w.writerows LL C test.csv when opened looks..

Clean and type-safe state machine implementation in a statically typed language?

http://stackoverflow.com/questions/7699912/clean-and-type-safe-state-machine-implementation-in-a-statically-typed-language

same problem happens. I can't just do something like type Fn IO Fn a Fn a print a return b b Fn b print b return c c Fn c.. problem happens. I can't just do something like type Fn IO Fn a Fn a print a return b b Fn b print b return c c Fn c print.. happens. I can't just do something like type Fn IO Fn a Fn a print a return b b Fn b print b return c c Fn c print c return..