smpl_io.io

Simplified input and output.

Functions

alias_open(file[, mode, buffering, ...])

Open file and return a stream.

append(destination, content[, mode])

Appends to file by string or writable destiantion.

files(ending[, folder])

Get all the files in folder ending with ending.

find_file(fname[, up])

Searches for fname in all down folders or up folder to given order respectively.

gf([i])

Scientific number format.

glob_re(pattern, path)

Returns all strings that match the regex pattern.

grep(pattern, *inps[, regex, open, A, B])

Searches for pattern in inp.

grepf(pattern, *inps[, regex, open, A, B])

Searches for pattern in inp.

head(*inps[, open, n])

Returns the first n lines of fname.

headf(*inps[, open, n])

Returns the first n lines of fname.

import_path([path])

Adds path to the sys.path.

mkdirs(fn)

Creates the neccessary directories above fn.

open(to_be_read[, mode])

Return opened buffer of either file or URI.

pn(a[, nnl])

Find variable with the same value as a in globals.

pr(a[, nnl])

Prints the passed a.

pushd(new_dir[, tmp, cd])

Move to a new directory and return to the previous one after context.

pwd()

Returns the path to the path of current file (in linux format).

read(to_be_read)

Open either a file or URI and return the content.

remove(file)

Removes file.

sed(pattern, replace, *inps[, open])

Replace pattern in inp.

tail(*inps[, open, n])

Returns the last n lines of fname.

tailf(*inps[, open, n])

Returns the last n lines of fname.

write(destination, content[, mode, create_dir])

Write to file by string or writable destiantion.

Classes

Path(*args, **kwargs)

PurePath subclass that can make system calls.

ReadBuffer(input[, open])

Buffer for reading from a file if open is True.

StringIO([initial_value, newline])

Text I/O implementation using an in-memory buffer.