pak.util.interfaces

Utilities for checking object interfaces.

is_iterable(obj)

Checks if an object is iterable.

Parameters:

obj

The object to check. obj is iterable if it can be used in the following expression:

for x in obj:
    pass

Returns:

Whether obj is iterable.

Return type:

bool

file_object(obj)

Converts an object to a file object.

Parameters:

obj (file object or bytes or bytearray) – The object to convert.

Returns:

The corresponding file object.

Return type:

file object