imports

module fastcore.imports in fastcore

Functions

all_equal

all_equal(a, b)
    Compares whether `a` and `b` are the same length and have the same contents

any_is_instance

any_is_instance(t, *args)

array_equal

array_equal(a, b)

df_equal

df_equal(a, b)

equals

equals(a, b)
    Compares `a` and `b` for equality; supports sublists, tensors and arrays too

in_colab

in_colab()
    Check if the code is running in Google Colaboratory

in_ipython

in_ipython()
    Check if code is running in some kind of IPython environment

in_jupyter

in_jupyter()
    Check if the code is running in a jupyter notebook

in_notebook

in_notebook()
    Check if the code is running in a jupyter notebook

ipython_shell

ipython_shell()
    Same as `get_ipython` but returns `False` if not in IPython

is_coll

is_coll(o)
    Test whether `o` is a collection (i.e. has a usable `len`)

is_iter

is_iter(o)
    Test whether `o` can be used in a `for` loop

isinstance_str

isinstance_str(x, cls_name)
    Like `isinstance`, except takes a type name instead of a type

noop

noop(x=None, *args, **kwargs)
    Do nothing

noops

noops(self, x=None, *args, **kwargs)
    Do nothing (method)

reduce

reduce(...)
    reduce(function, sequence[, initial]) -> value
    
    Apply a function of two arguments cumulatively to the items of a sequence,
    from left to right, so as to reduce the sequence to a single value.
    For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates
    ((((1+2)+3)+4)+5).  If initial is present, it is placed before the items
    of the sequence in the calculation, and serves as a default when the
    sequence is empty.

remove_prefix

remove_prefix(text, prefix)
    Temporary until py39 is a prereq

remove_suffix

remove_suffix(text, suffix)
    Temporary until py39 is a prereq

warn

warn(message, category=None, stacklevel=1, source=None)
    Issue a warning, or maybe ignore it or raise an exception.