Cope 2.5.0
My personal "standard library" of all the generally useful code I've written for various projects over the years
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
misc.py File Reference

Classes

class  Cope.misc.RedirectStd
 

Namespaces

namespace  Cope
 
namespace  Cope.misc
 

Functions

list Cope.misc.available (*args, null=None)
 
bool Cope.misc.only1 (*args, null=None)
 
float Cope.misc.interpret_percentage (Union[int, float] percentage)
 
def Cope.misc.percent (Union[int, float] percentage)
 
bool Cope.misc.randbool ()
 
def Cope.misc.close_enough (a, b, tolerance)
 
int Cope.misc.closest (SupportsInt target, Iterable[SupportsInt] compare, index=False)
 
int Cope.misc.furthest (SupportsInt target, Iterable[SupportsInt] compare, index=False)
 
bool Cope.misc.isPowerOf2 (int x)
 
bool Cope.misc.between (target, start, end, left_open=False, right_open=False)
 
str Cope.misc.insert_str (str string, int index, str inserted)
 
def Cope.misc.constrain (val, low, high)
 
SupportsAbs Cope.misc.translate (SupportsAbs value, SupportsAbs from_start, SupportsAbs from_end, SupportsAbs to_start, SupportsAbs to_end)
 
def Cope.misc.frange (float start, float stop, float skip=1.0, int accuracy=10000000000000000)
 
bool Cope.misc.confirm (str prompt='Continue?', bool quit=False, str quit_msg='Exiting...', bool return_if_invalid=False, bool include_YN=True)
 
str Cope.misc.cat_file (str f)
 
str Cope.misc.umpteenth (int i)
 
str Cope.misc.grade (Union[float, int] percentage)
 
bool Cope.misc.isiterable (obj, bool include_str=True)
 
def Cope.misc.ensure_iterable (Iterable iter, type cast=list, bool ensure_cast_type=True)
 
def Cope.misc.ensure_not_iterable (Iterable iter)
 
def Cope.misc.cp (thing=None, int rnd=3, show=False, not_iterable=True, evalf=True)
 
def Cope.misc.in_IPython (return_instance=True)
 
list Cope.misc.flatten (Iterable iter, bool recursive=True)
 
dict Cope.misc.invert_dict (dict d)
 
def Cope.misc.run_notecards (dict cards)
 

Variables

def Cope.misc.ensureIterable = ensure_iterable
 
def Cope.misc.ensureNotIterable = ensure_not_iterable