pyline package

Submodules

pyline.pyline module

class pyline.pyline.NullHandler(level=0)[source]

Bases: logging.Handler

emit(record)[source]
class pyline.pyline.PylineResult[source]

Bases: pyline.pyline.Result

class pyline.pyline.Result

Bases: tuple

Result(n, result)

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__getstate__()

Exclude the OrderedDict from pickling

__repr__()

Return a nicely formatted representation string

n

Alias for field number 0

result

Alias for field number 1

class pyline.pyline.ResultWriter(_output, *args, **kwargs)[source]

Bases: object

OUTPUT_FILETYPES = {'csv': ',', 'checkbox': True, 'json': True, 'html': True, 'tsv': '\t', 'txt': True}
filetype = None
footer(*args, **kwargs)[source]
classmethod get_writer(_output, filetype='csv', **kwargs)[source]

get writer object for _output with the specified filetype

Parameters:
  • output_filetype – txt | csv | tsv | json | html | checkbox
  • _output – output file
header(*args, **kwargs)[source]
set_output(_output)[source]
setup(*args, **kwargs)[source]
write(obj)[source]
write_numbered(obj)[source]
class pyline.pyline.ResultWriter_checkbox(_output, *args, **kwargs)[source]

Bases: pyline.pyline.ResultWriter

filetype = 'checkbox'
write(obj)[source]
class pyline.pyline.ResultWriter_csv(_output, *args, **kwargs)[source]

Bases: pyline.pyline.ResultWriter

filetype = 'csv'
header(*args, **kwargs)[source]
setup(*args, **kwargs)[source]
write(obj)[source]
write_numbered(obj)[source]
class pyline.pyline.ResultWriter_html(_output, *args, **kwargs)[source]

Bases: pyline.pyline.ResultWriter

filetype = 'html'
footer()[source]
header(*args, **kwargs)[source]
write(obj)[source]
class pyline.pyline.ResultWriter_json(_output, *args, **kwargs)[source]

Bases: pyline.pyline.ResultWriter

filetype = 'json'
write(obj)[source]
write_numbered(obj)
class pyline.pyline.ResultWriter_txt(_output, *args, **kwargs)[source]

Bases: pyline.pyline.ResultWriter

filetype = 'txt'
write_numbered(obj)[source]
pyline.pyline.get_list_from_str(str_, cast_callable=<type 'int'>)[source]
pyline.pyline.get_option_parser()[source]
pyline.pyline.get_path_module()[source]
pyline.pyline.get_sort_function(opts)[source]
pyline.pyline.itemgetter_default(args, default=None)[source]

Return a callable object that fetches the given item(s) from its operand, or the specified default value.

Similar to operator.itemgetter except returns default when the index does not exist

pyline.pyline.main(*args)[source]
pyline.pyline.pyline(iterable, cmd=None, modules=, []regex=None, regex_options=None, path_tools=False, idelim=None, odelim='\t', **kwargs)[source]

Pyline: process an iterable

Parameters:
  • iterable (iterable) – iterable of strings (e.g. sys.stdin or a file)
  • cmd (str) – python command string
  • modules ([str]) – list of modules to import
  • regex (str) – regex pattern to match (with groups)
  • regex_options (TODO) – Regex options: I L M S X U (see pydoc re)
  • path_tools (bool) – try to cast each line to a file
  • idelim (str) – input delimiter
  • odelim (str) – output delimiter
Returns:

iterable of PylineResult namedtuples

pyline.pyline.sort_by(sortstr, nl, reverse=False)[source]

Module contents