nutsflow package¶
Submodules¶
nutsflow.base module¶
-
class
Nut
(*args, **kwargs)[source]¶ Bases:
object
Base class for all Nuts. Iterables or functions wrapped in Nuts can be chained using the ‘>>’ operator. The aim is code with an explicit data flow. See the following example using Python iterators versus Nuts:
>>> from six.moves import filter, range >>> from itertools import islice >>> list(islice(filter(lambda x: x > 5, range(10)), 3)) [6, 7, 8]
>>> from nutsflow import Range, Filter, Take, Collect, _ >>> Range(10) >> Filter(_ > 5) >> Take(3) >> Collect() [6, 7, 8]
-
__call__
(iterable)[source]¶ Nut (processor) can be called as a function and mapped on iterable elements within an iterable.
Parameters: iterable (iterable) – Iterable to process. Returns: Iterable Return type: iterable
-
__init__
(*args, **kwargs)[source]¶ Constructor. Nuts (and derived classes) can have arbitrary arguments.
Parameters: - args (args) – Positional arguments.
- kwargs (kwargs) – Keyword arguments.
-
__rrshift__
(iterable)[source]¶ Chaining operator for Nuts. Needs to be overridden!
Takes an input iterable and produces some output iterable. If the number of elements in the input and the output iterable does not change consider NutFunction instead.
Parameters: iterable (iterable) – Iterable to process. Returns: Iterable Return type: iterable Raise: NotImplementedError if not implemented.
-
-
class
NutFunction
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
Nut functions are are mapped onto each element of the input iterable.
Example: Square is a Nut function
>>> from nutsflow import Square, Collect, _ >>> [1,2,3] >> Square() >> Collect() [1, 4, 9]
-
class
NutSink
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
Sinks are nuts that do not guarantee to produce an iterable output.
Sinks are typically at the end of a flow and typically aggregate the flow to a single output, e.g. the sum of its elements. Need to override __rrshift__()!
-
class
NutSource
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
Sources are nuts that have no input iterable but produce an output iterable.
nutsflow.common module¶
-
class
Redirect
(channel='STDOUT')[source]¶ Bases:
object
Redirect stdout or stderr to string.
>>> with Redirect() as out: ... print('test') >>> print(out.getvalue()) test
>>> with Redirect('STDERR') as out: ... print('error', file=sys.stderr) >>> print(out.getvalue()) error
-
class
StableRandom
(seed=None)[source]¶ Bases:
random.Random
A pseudo random number generator that is stable across Python 2.x and 3.x. Use this only for unit tests or doctests. This class is derived from random.Random and supports all methods of the base class.
>>> rand = StableRandom(0) >>> rand.random() 0.5488135024320365
>>> rand.randint(1, 10) 6
>>> lst = [1, 2, 3, 4, 5] >>> rand.shuffle(lst) >>> lst [1, 3, 2, 5, 4]
-
__init__
(seed=None)[source]¶ Initialize random number generator.
Parameters: seed (None|int) – Seed. If None the system time is used.
-
gauss_next
()[source]¶ Return next gaussian random number.
Returns: Random number sampled from gaussian distribution. Return type: float
-
getstate
()[source]¶ Return state of generator.
Returns: Index and Mersenne Twister array. Return type: tuple
-
jumpahead
(n)[source]¶ Set state of generator far away from current state.
Parameters: n (int) – Distance to jump.
-
-
as_list
(x)[source]¶ Return x as list.
If x is a single item it gets wrapped into a list otherwise it is changed to a list, e.g. tuple => list
Parameters: or iterable x (item) – Any item or iterable Returns: list(x) Return type: list
-
as_set
(x)[source]¶ Return x as set.
If x is a single item it gets wrapped into a set otherwise it is changed to a set, e.g. list => set
Parameters: or iterable x (item) – Any item or iterable Returns: set(x) Return type: set
-
as_tuple
(x)[source]¶ Return x as tuple.
If x is a single item it gets wrapped into a tuple otherwise it is changed to a tuple, e.g. list => tuple
Parameters: or iterable x (item) – Any item or iterable Returns: tuple(x) Return type: tuple
-
colfunc
(key)[source]¶ Return function that extracts element from columns.
Used to create key functions when only column index or tuple of column indices is given. For instance:
>>> data = ['a3', 'c1', 'b2'] >>> sorted(data, key=colfunc(0)) # == sorted(data, key=lamda s:s[0]) ['a3', 'b2', 'c1']
>>> sorted(data, key=colfunc(1)) ['c1', 'b2', 'a3']
>>> list(map(colfunc((1,0)), data)) [['3', 'a'], ['1', 'c'], ['2', 'b']]
Parameters: key (function|None) – function or None. If None the identity function is returned Returns: Column extraction function. Return type: function
-
console
(*args, **kwargs)[source]¶ Print to stdout and flush.
Wrapper around Python’s print function that ensures flushing after each call.
>>> console('test') test
Parameters: - args – Arguments
- kwargs – Key-Word arguments.
-
is_iterable
(obj)[source]¶ Return true if object has iterator but is not a string
Parameters: obj (object) – Any object Returns: True if object is iterable but not a string. Return type: bool
-
sec_to_hms
(duration)[source]¶ Return hours, minutes and seconds for given duration.
>>> sec_to_hms('80') (0, 1, 20)
Parameters: duration (int|str) – Duration in seconds. Can be int or string. Returns: tuple (hours, minutes, seconds) Return type: (int, int, int)
-
timestr
(duration, fmt='{:d}:{:02d}:{:02d}')[source]¶ Return duration as formatted time string or empty string if no duration
>>> timestr('80') '0:01:20'
Parameters: - duration (int|str) – Duration in seconds. Can be int or string.
- str – Format for string, e.g. ‘{:d}:{:02d}:{:02d}’
Returns: duration as formatted time, e.g. ‘0:01:20’ or ‘’ if duration shorter than one second.
Return type: string
nutsflow.factory module¶
-
nut_filter
(func)[source]¶ Decorator for Nut filters.
Also see nut_filerfalse(). Example on how to define a custom filter nut:
@nut_filter def GreaterThan(x, threshold): return x > threshold [1, 2, 3, 4] >> GreaterThan(2) >> Collect() --> [3, 4]
Parameters: func (function) – Function to decorate. Must return boolean value. Returns: Nut filter for given function Return type: Nut
-
nut_filterfalse
(func)[source]¶ Decorator for Nut filters that are inverted.
Also see nut_filter(). Example on how to define a custom filter-false nut:
@nut_filterfalse def NotGreaterThan(x, threshold): return x > threshold [1, 2, 3, 4] >> NotGreaterThan(2) >> Collect() --> [1, 2]
Parameters: func (function) – Function to decorate Returns: Nut filter for given function. . Must return boolean value. Return type: Nut
-
nut_function
(func)[source]¶ Decorator for Nut functions.
Example on how to define a custom function nut:
@nut_function def TimesN(x, n): return x * n [1, 2, 3] >> TimesN(2) >> Collect() --> [2, 4, 6]
Parameters: func (function) – Function to decorate Returns: Nut function for given function Return type: NutFunction
-
nut_processor
(func, iterpos=0)[source]¶ Decorator for Nut processors.
Example on how to define a custom processor nut:
@nut_processor def Clone(iterable, n): for e in iterable: for _ in xrange(p): yield e [1, 2, 3] >> Clone(2) >> Collect() --> [1, 1, 2, 2, 3, 3]
Parameters: - func (function) – Function to decorate
- iterpos – Position of iterable in function arguments
Returns: Nut processor for given function
Return type:
-
nut_sink
(func, iterpos=0)[source]¶ Decorator for Nut sinks.
Example on how to define a custom sink nut:
@nut_sink def Collect(iterable, container): return container(iterable) xrange(5) >> Collect(tuple) --> (0, 1, 2, 3, 4)
Parameters: - func (function) – Function to decorate
- iterpos – Position of iterable in function arguments
Returns: Nut sink for given function
Return type:
-
nut_source
(func)[source]¶ Decorator for Nut sources.
Example on how to define a custom source nut:
@nut_source def Range(start, end): return xrange(start, end) Range(0, 5) >> Collect() --> [0, 1, 2, 3, 4]
Parameters: func (function) – Function to decorate Returns: Nut source for given function Return type: NutSource
nutsflow.function module¶
-
class
Counter
(name, filterfunc=<function Counter.<lambda>>, value=0)[source]¶ Bases:
nutsflow.base.NutFunction
Increment counter depending on elements in iterable. Intended mostly for debugging and monitoring. Avoid for standard processing of data. The function has side-effects but is thread-safe.
-
__call__
(x)[source]¶ Increment counter.
Parameters: x (object) – Element in iterable Returns: Unchanged element Return type: Any
-
__init__
(name, filterfunc=<function Counter.<lambda>>, value=0)[source]¶ counter = Counter(name, filterfunc, value) iterable >> counter
>>> from nutsflow import Consume >>> counter = Counter('smallerthan3', lambda x: x < 3, 1) >>> range(10) >> counter >> Consume() >>> counter smallerthan3 = 4
Parameters:
-
-
class
Format
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutFunction
iterable >> Format(fmt)
Return input as formatted string. For format definition see: https://docs.python.org/2/library/string.html
>>> from nutsflow import Collect >>> [1, 2, 3] >> Format('num:{}') >> Collect() ['num:1', 'num:2', 'num:3']
>>> [(1, 2), (3, 4)] >> Format('{0}:{1}') >> Collect() ['1:2', '3:4']
Parameters: - iterable (iterable) – Any iterable
- fmt (string) – Formatting string, e.g. ‘{:02d}’
Returns: Returns inputs as strings formatted as specified
Return type: -
__call__
(element)¶
-
class
Get
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutFunction
iterable >> Get(start, end, step)
Extract elements from x. Equivalent to Python slicing [start:end:step] but per element of the iterable.
>>> from nutsflow import Collect
>>> [(1, 2, 3), (4, 5, 6)] >> Get(1) >> Collect() [2, 5]
>>> [(1, 2, 3), (4, 5, 6)] >> Get(0, 2) >> Collect() [(1, 2), (4, 5)]
>>> [(1, 2, 3), (4, 5, 6)] >> Get(0, 3, 2) >> Collect() [(1, 3), (4, 6)]
>>> [(1, 2, 3), (4, 5, 6)] >> Get(None) >> Collect() [(1, 2, 3), (4, 5, 6)]
Parameters: Returns: Extracted elements
Return type: object|list
-
__call__
(element)¶
-
-
class
GetCols
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutFunction
iterable >> GetCols(*columns)
Extract elements in given order from x. Also useful to change the order of or clone elements in x.
>>> from nutsflow import Collect
>>> [(1, 2, 3), (4, 5, 6)] >> GetCols(1) >> Collect() [(2,), (5,)]
>>> [[1, 2, 3], [4, 5, 6]] >> GetCols(2, 0) >> Collect() [(3, 1), (6, 4)]
>>> [[1, 2, 3], [4, 5, 6]] >> GetCols((2, 0)) >> Collect() [(3, 1), (6, 4)]
>>> [(1, 2, 3), (4, 5, 6)] >> GetCols(2, 1, 0) >> Collect() [(3, 2, 1), (6, 5, 4)]
>>> [(1, 2, 3), (4, 5, 6)] >> GetCols(1, 1) >> Collect() [(2, 2), (5, 5)]
Parameters: - iterable (iterable) – Any iterable
- container x (indexable) – Any indexable input
- columns (int|tuple|args) – Indicies of elements/columns in x to extract or a tuple with these indices.
Returns: Extracted elements
Return type: -
__call__
(element)¶
-
class
Identity
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutFunction
iterable >> Identity()
Return same input as console.
>>> from nutsflow import Collect >>> [1, 2, 3] >> Identity() >> Collect() [1, 2, 3]
Parameters: - iterable (iterable) – Any iterable
- x (any) – Any input
Returns: Returns input unaltered
Return type: -
__call__
(element)¶
-
class
NOP
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutFunction
iterable >> Nop(*args)
No Operation. Useful to skip nuts. Same as commenting a nut out or removing it from a pipeline.
>>> from nutsflow import Collect >>> [1, 2, 3] >> NOP(Square()) >> Collect() [1, 2, 3]
Parameters: - iterable (iterable) – Any iterable
- x (object) – Any object
- args (args) – Additional args are ignored.
Returns: Squared number
Return type: number
-
__call__
(element)¶
-
class
Print
(fmtfunc=None, every_sec=0, every_n=0, filterfunc=<function Print.<lambda>>, end='n')[source]¶ Bases:
nutsflow.base.NutFunction
Print elements in iterable.
-
__init__
(fmtfunc=None, every_sec=0, every_n=0, filterfunc=<function Print.<lambda>>, end='\n')[source]¶ - iterable >> Print(fmtfunc=None, every_sec=0, every_n=0,
- filterfunc=lambda x: True)
Return same input as console but print for each element.
>>> from nutsflow import Consume >>> [1, 2] >> Print() >> Consume() 1 2
>>> range(10) >> Print(every_n=3) >> Consume() 2 5 8
>>> even = lambda x: x % 2 == 0 >>> [1, 2, 3, 4] >> Print(filterfunc=even) >> Consume() 2 4
>>> [{'val': 1}, {'val': 2}] >> Print('number={val}') >> Consume() number=1 number=2
>>> [[1, 2], [3, 4]] >> Print('number={1}:{0}') >> Consume() number=2:1 number=4:3
>>> myfmt = lambda x: 'char='+x.upper() >>> ['a', 'b'] >> Print(myfmt) >> Consume() char=A char=B
>>> range(5) >> Print('.', end=' ') >> Consume() . . . . .
Parameters: - x (object) – Any input
- fmtfunc (string|function) – Format string or function. fmtfunc is a standard Python str.format() string, see https://docs.python.org/2/library/string.html or a function that returns a string.
- every_sec (float) – Print every given second, e.g. to print every 2.5 sec every_sec = 2.5
- every_n (int) – Print every n-th call.
- end (str) – Ending of text printed.
- filterfunc (function) – Boolean function to filter print.
Returns: Returns input unaltered
Return type: Raise: ValueError if fmtfunc is not string or function
-
-
class
Sleep
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutFunction
iterable >> Sleep(duration)
Return same input as console but sleep for each element.
>>> from nutsflow import Collect >>> [1, 2, 3] >> Sleep(0.1) >> Collect() [1, 2, 3]
Parameters: Returns: Returns input unaltered
Return type: -
__call__
(element)¶
-
-
class
Square
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutFunction
iterable >> Square()
Return squared input.
>>> from nutsflow import Collect >>> [1, 2, 3] >> Square() >> Collect() [1, 4, 9]
Parameters: - iterable (iterable) – Any iterable over numbers
- x (number) – Any number
Returns: Squared number
Return type: number
-
__call__
(element)¶
nutsflow.iterfunction module¶
-
class
PrefetchIterator
(iterable, num_prefetch=1)[source]¶ Bases:
threading.Thread
,object
Wrap an iterable in an iterator that prefetches elements.
Typically used to fetch samples or batches while the the GPU processes the batch. Keeps the CPU busy pre-processing data and not waiting for the GPU to finish the batch.
>>> from __future__ import print_function >>> for i in PrefetchIterator(range(4)): ... print(i) 0 1 2 3
-
chunked
(iterable, n)[source]¶ Split iterable in chunks of size n, where each chunk is also an iterator.
- for chunk in chunked(range(10), 3):
- for element in chunk:
- print element
>>> it = chunked(range(7), 2) >>> list(map(tuple, it)) [(0, 1), (2, 3), (4, 5), (6,)]
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- n – Chunk size
Returns: Chunked iterable
Return type: Iterator over iterators
-
consume
(iterable, n=None)[source]¶ Consume n elements of the iterable.
>>> it = iter([1,2,3,4]) >>> consume(it, 2) >>> next(it) 3
See https://docs.python.org/2/library/itertools.html
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- n – Number of elements to consume. For n=None all are consumed.
-
flatmap
(func, iterable)[source]¶ Map function to iterable and flatten.
>>> f = lambda n: str(n) * n >>> list( flatmap(f, [1, 2, 3]) ) ['1', '2', '2', '3', '3', '3']
>>> list( map(f, [1, 2, 3]) ) # map instead of flatmap ['1', '22', '333']
Parameters: - func (function) – Function to map on iterable.
- iterable (iterable) – Any iterable, e.g. list, range, …
Returns: Iterator of iterable elements transformed via func and flattened.
Return type: Iterator
-
flatten
(iterable)[source]¶ Return flattened iterable.
>>> list(flatten([(1,2), (3,4,5)])) [1, 2, 3, 4, 5]
Parameters: iterable (iterable) – Returns: Iterator over flattened elements of iterable Return type: Iterator
-
interleave
(*iterables)[source]¶ Return generator that interleaves the elements of the iterables.
>>> list(interleave(range(5), 'abc')) [0, 'a', 1, 'b', 2, 'c', 3, 4]
>>> list(interleave('12', 'abc', '+-')) ['1', 'a', '+', '2', 'b', '-', 'c']
Parameters: iterables (iterable) – Collection of iterables, e.g. lists, range, … Returns: Interleaved iterables. Return type: iterator
-
length
(iterable)[source]¶ Return number of elements in iterable. Consumes iterable!
>>> length(range(10)) 10
Parameters: iterable (iterable) – Any iterable, e.g. list, range, … Returns: Length of iterable. Return type: int
-
nth
(iterable, n, default=None)[source]¶ Return n-th element of iterable. Consumes iterable!
>>> nth(range(10), 2) 2
>>> nth(range(10), 100, default=-1) -1
https://docs.python.org/2/library/itertools.html#itertools.islice
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- n – Index of element to retrieve.
- default – Value to return when iterator is depleted
Returns: nth element
Return type: Any or default value.
-
partition
(iterable, pred)[source]¶ Split iterable into two partitions based on predicate function
>>> pred = lambda x: x < 6 >>> smaller, larger = partition(range(10), pred) >>> list(smaller) [0, 1, 2, 3, 4, 5]
>>> list(larger) [6, 7, 8, 9]
Parameters: - iterable – Any iterable, e.g. list, range, …
- pred – Predicate function.
Returns: Partition iterators
Return type: Two iterators
-
take
(iterable, n)[source]¶ Return iterator over last n elements of given iterable.
>>> list(take(range(10), 3)) [0, 1, 2]
See: https://docs.python.org/2/library/itertools.html#itertools.islice
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- n (int) – Number of elements to take
Returns: Iterator over last n elements
Return type: iterator
-
unique
(iterable, key=None)[source]¶ Return only unique elements in iterable. Potentially high mem. consumption!
>>> list(unique([2,3,1,1,2,4])) [2, 3, 1, 4]
>>> ''.join(unique('this is a test')) 'this ae'
>>> data = [(1,'a'), (2,'a'), (3,'b')] >>> list(unique(data, key=lambda t: t[1])) [(1, 'a'), (3, 'b')]
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- key – Function used to compare for equality.
Returns: Iterator over unique elements.
Return type: Iterator
nutsflow.processor module¶
-
class
Append
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Append(items)
Append item(s) to lists/tuples in iterable.
>>> [(1, 2), (3, 4)] >> Append('X') >> Collect() [(1, 2, 'X'), (3, 4, 'X')]
>>> items = ['a', 'b'] >>> [(1, 2), (3, 4)] >> Append(items) >> Collect() [(1, 2, 'a'), (3, 4, 'b')]
>>> items = [('a', 'b'), ('c', 'd')] >>> [(1, 2), (3, 4)] >> Append(items) >> Collect() [(1, 2, 'a', 'b'), (3, 4, 'c', 'd')]
>>> from nutsflow import Enumerate >>> [(1, 2), (3, 4)] >> Append(Enumerate()) >> Collect() [(1, 2, 0), (3, 4, 1)]
Parameters: - iterable iterable (iterable) – Any iterable over tuples or lists
- items (iterable|object) – A single object or an iterable over objects.
Returns: iterator where items are appended to the iterable elements.
Return type: iterator over tuples
-
__rrshift__
(iterable)¶
-
class
Cache
(cachepath=None, clearcache=True)[source]¶ Bases:
nutsflow.base.Nut
A very naive implementation of a disk cache. Pickles elements of iterable to file system and loads them the next time instead of recomputing.
-
__init__
(cachepath=None, clearcache=True)[source]¶ iterable >> Cache()
Cache elements of iterable to disk. Only worth it if elements of iterable are time-consuming to produce and can be loaded faster from disk.
with Cache() as cache: data = range(100) for i in range(10): data >> expensive_op >> cache >> process(i) >> Consume()
cache = Cache() for _ in range(100) data >> expensive_op >> cache >> Collect() cache.clear()
with Cache('path/to/mycache') as cache: for _ in range(100) data >> expensive_op >> cache >> Collect()
Parameters: - iterable (iterable) – Any iterable
- cachepath (string) – Path to a folder that stores the cached objects. If the path does not exist it will be created. The path with all its contents will be deleted when the cache is deleted. For cachepath=None a temporary folder will be created. Path to this folder is available in cache.path.
- clearcache (bool) – Clear left-over cache if it exists.
Returns: Iterator over elements
Return type: iterator
-
-
class
Chunk
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Chunk(n, container=None)
Split iterable in chunks of size n, where each chunk is also an iterator if no container is provided. see also GroupBySorted(), ChunkWhen(), ChunkBy()
>>> from nutsflow import Range, Map, Print, Join, Consume, Collect >>> Range(5) >> Chunk(2) >> Map(list) >> Print() >> Consume() [0, 1] [2, 3] [4]
The code can be shortend by providing a container in Chunk():
>>> Range(5) >> Chunk(2, list) >> Print() >> Consume() [0, 1] [2, 3] [4]
>>> Range(6) >> Chunk(3, Join('_')) >> Print() >> Consume() 0_1_2 3_4_5
>>> Range(6) >> Chunk(3, sum) >> Collect() [3, 12]
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- n (int) – Chunk size
- container (container) – Some container, e.g. list, set, dict that can be filled from an iterable
Returns: Chunked iterable
Return type: Iterator over iterators or containers
-
__rrshift__
(iterable)¶
-
class
ChunkBy
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> ChunkBy(func, container=None)
Chunk iterable and create chunk every time func changes its return value. see also GroupBySorted(), Chunk(), ChunkWhen()
>>> [1,1, 2, 3,3,3] >> ChunkBy(lambda x: x, tuple) >> Collect() [(1, 1), (2,), (3, 3, 3)]
>>> [1,1, 2, 3,3,3] >> ChunkBy(lambda x: x < 3, tuple) >> Collect() [(1, 1, 2), (3, 3, 3)]
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- func (function) – Functions the iterable is chunked by
- container (container) – Some container, e.g. list, set, dict that can be filled from an iterable
Returns: Chunked iterable
Return type: Iterator over iterators or containers
-
__rrshift__
(iterable)¶
-
class
ChunkWhen
(func, container=None)[source]¶ Bases:
nutsflow.base.Nut
-
__init__
(func, container=None)[source]¶ iterable >> ChunkWhen(func, container=None)
Chunk iterable and create new chunk every time func returns True. see also GroupBySorted(), Chunk(), ChunkBy()
>>> from nutsflow import Map, Join, Collect >>> func = lambda x: x == 1 >>> [1,2,1,3,1,4,5] >> ChunkWhen(func, tuple) >> Collect() [(1, 2), (1, 3), (1, 4, 5)]
>>> func = lambda x: x == 1 >>> [1,2,1,3,1,4,5] >> ChunkWhen(func, sum) >> Collect() [3, 4, 10]
>>> func = lambda x: x == '|' >>> '0|12|345|6' >> ChunkWhen(func, Join()) >> Collect() ['0', '|12', '|345', '|6']
Parameters: - func (function) – Boolean function that indicates chunks. New chunk is created if return value is True.
- container (container) – Some container, e.g. list, set, dict that can be filled from an iterable
-
-
class
Clone
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Clone(n)
Clones elements in the iterable n times.
>>> from nutsflow import Range, Collect, Join >>> Range(4) >> Clone(2) >> Collect() [0, 0, 1, 1, 2, 2, 3, 3]
>>> 'abc' >> Clone(3) >> Join() 'aaabbbccc'
Parameters: - iterable (iterable) – Any iterable
- n – Number of clones
Returns: Generator over cloned elements in iterable
Return type: generator
-
__rrshift__
(iterable)¶
-
Combine
¶ alias of
itertools._create_nut_wrapper.<locals>.Wrapper
-
class
Concat
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Concat(*iterables)
Concatenate iterables.
>>> from nutsflow import Range, Collect
>>> Range(5) >> Concat('abc') >> Collect() [0, 1, 2, 3, 4, 'a', 'b', 'c']
>>> '12' >> Concat('abcd', '+-') >> Collect() ['1', '2', 'a', 'b', 'c', 'd', '+', '-']
Parameters: - iterable (iterable) – Any iterable
- iterables (iterable) – Iterables to concatenate
Returns: Concatenated iterators
Return type: iterator
-
__rrshift__
(iterable)¶
-
Cycle
¶ alias of
itertools._create_nut_wrapper.<locals>.Wrapper
-
Dedupe
¶ alias of
nutsflow.iterfunction._create_nut_wrapper.<locals>.Wrapper
-
class
Drop
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Drop(n)
Drop first n elements in iterable.
>>> [1, 2, 3, 4] >> Drop(2) >> Collect() [3, 4]
Parameters: - iterable (iterable) – Any iterable
- n (int) – Number of elements to drop
Returns: Iterator without dropped elements
Return type: iterator
-
__rrshift__
(iterable)¶
-
class
DropWhile
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> DropWhile(func)
Skip elements in iterable while predicate function is True.
>>> from nutsflow import _ >>> [0, 1, 2, 3, 0] >> DropWhile(_ < 2) >> Collect() [2, 3, 0]
Parameters: - iterable (iterable) – Any iterable
- func (function) – Predicate function.
Returns: Iterable
Return type: Iterator
-
__rrshift__
(iterable)¶
-
Filter
¶ alias of
builtins._create_nut_wrapper.<locals>.Wrapper
-
class
FilterCol
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> FilterCol(columns, func)
Filter elements from iterable based on predicate function and specified column(s).
>>> is_even = lambda n: n % 2 == 0 >>> [(0, 'e'), (1, 'o'), (2, 'e')] >> FilterCol(0, is_even) >> Collect() [(0, 'e'), (2, 'e')]
Parameters: - iterable (iterable) – Any iterable
- columns (int|tuple) – Column or columns to extract from each element before passing it on to the predicate function.
- func (function) – Predicate function. Element is removed if False.
Returns: Filtered iterable
Return type: Iterator
-
__rrshift__
(iterable)¶
-
FilterFalse
¶ alias of
itertools._create_nut_wrapper.<locals>.Wrapper
-
FlatMap
¶ alias of
nutsflow.iterfunction._create_nut_wrapper.<locals>.Wrapper
-
class
Flatten
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Flatten()
Flatten the iterables within the iterable and non-iterables are passed through. Only one level is flattened. Chain Flatten to flatten deeper structures.
>>> from nutsflow import Collect >>> [(1, 2), (3, 4, 5), 6] >> Flatten() >> Collect() [1, 2, 3, 4, 5, 6]
>>> [(1, (2)), (3, (4, 5)), 6] >> Flatten() >> Flatten() >> Collect() [1, 2, 3, 4, 5, 6]
Parameters: iterable (iterable) – Any iterable. Returns: Flattened iterable Return type: Iterator -
__rrshift__
(iterable)¶
-
-
class
FlattenCol
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> FlattenCol(cols)
Flattens the specified columns of the tuples/iterables within the iterable. Only one level is flattened.
(1 3) (5 7) (2 4) (6 8) >> FlattenCol((0,1) >> (1 3) (2 4) (5 7) (6 8)
If a column contains a single element (instead of an iterable) it is wrapped into a repeater. This allows to flatten columns that are iterable together with non-iterable columns, e.g.
(1 3) (6 7) (2 ) ( 8) >> FlattenCols((0,1) >> (1 3) (2 3) (6 7) (6 8)
>>> from nutsflow import Collect >>> data = [([1, 2], [3, 4]), ([5, 6], [7, 8])] >>> data >> FlattenCol(0) >> Collect() [(1,), (2,), (5,), (6,)]
>>> data >> FlattenCol((0, 1)) >> Collect() [(1, 3), (2, 4), (5, 7), (6, 8)]
>>> data >> FlattenCol((1, 0)) >> Collect() [(3, 1), (4, 2), (7, 5), (8, 6)]
>>> data >> FlattenCol((1, 1, 0)) >> Collect() [(3, 3, 1), (4, 4, 2), (7, 7, 5), (8, 8, 6)]
>>> data = [([1, 2], 3), (6, [7, 8])] >>> data >> FlattenCol((0, 1)) >> Collect() [(1, 3), (2, 3), (6, 7), (6, 8)]
Parameters: iterable (iterable) – Any iterable. Params int|tuple columns: Column index or indices Returns: Flattened columns of iterable Return type: generator -
__rrshift__
(iterable)¶
-
-
class
GroupBy
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> GroupBy(keycol=lambda x: x, nokey=False)
Group elements of iterable based on a column value of the element or the function value of keycol for the element. Note that elements of iterable do not need to be sorted. GroupBy will store all elements in memory! If the iterable is sorted use GroupBySorted() instead. see also Chunk(), ChunkWhen(), ChunkBy()
>>> from nutsflow import Sort
>>> [1, 2, 1, 1, 3] >> GroupBy() >> Sort() [(1, [1, 1, 1]), (2, [2]), (3, [3])]
>>> [1, 2, 1, 1, 3] >> GroupBy(nokey=True) >> Sort() [[1, 1, 1], [2], [3]]
>>> ['--', '+++', '**'] >> GroupBy(len) >> Sort() [(2, ['--', '**']), (3, ['+++'])]
>>> ['a3', 'b2', 'c1'] >> GroupBy(1) >> Sort() [('1', ['c1']), ('2', ['b2']), ('3', ['a3'])]
>>> [(1,3), (2,2), (3,1)] >> GroupBy(1, nokey=True) >> Sort() [[(1, 3)], [(2, 2)], [(3, 1)]]
Parameters: - iterable (iterable) – Any iterable
- keycol (int|function) – Column index or key function.
- nokey (bool) – True: results will not contain keys for groups, only the groups themselves.
Returns: Iterator over groups.
Return type: iterator
-
__rrshift__
(iterable)¶
-
class
GroupBySorted
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> GroupBySorted(prob, keycol=lambda x: x, nokey=False)
Group elements of iterable based on a column value of the element or the function value of key_or_col for the element. Iterable needs to be sorted according to keycol! See https://docs.python.org/2/library/itertools.html#itertools.groupby If iterable is not sorted use GroupBy but be aware that it stores all elements of the iterable in memory! see also Chunk(), ChunkWhen(), ChunkBy()
>>> from nutsflow import Collect, nut_sink
>>> @nut_sink ... def ViewResult(iterable): ... return iterable >> Map(lambda t: (t[0], list(t[1]))) >> Collect()
>>> [1, 1, 1, 2, 3] >> GroupBySorted() >> ViewResult() [(1, [1, 1, 1]), (2, [2]), (3, [3])]
>>> [1, 1, 1, 2, 3] >> GroupBySorted(nokey=True) >> Map(list) >> Collect() [[1, 1, 1], [2], [3]]
>>> ['--', '**', '+++'] >> GroupBySorted(len) >> ViewResult() [(2, ['--', '**']), (3, ['+++'])]
Parameters: - iterable (iterable) – Any iterable
- keycol (int|function) – Column index or key function.
- nokey (bool) – True: results will not contain keys for groups, only the groups themselves.
Returns: Iterator over groups where values are iterators.
Return type: iterator
-
__rrshift__
(iterable)¶
-
class
If
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> If(cond, if_nut, [,else_nut])
Depending on condition cond execute if_nut or else_nut. Useful for conditional flows.
>>> from nutsflow import Square, Collect
>>> [1, 2, 3] >> If(True, Square()) >> Collect() [1, 4, 9]
>>> [1, 2, 3] >> If(False, Square(), Take(1)) >> Collect() [1]
Parameters: Returns: Result of if_nut or else_nut
Return type: Any
-
__rrshift__
(iterable)¶
-
-
class
Insert
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Insert(index, items)
Insert item(s) into lists/tuples in iterable.
>>> [(1, 2), (3, 4)] >> Insert(1, 'X') >> Collect() [(1, 'X', 2), (3, 'X', 4)]
>>> items = ['a', 'b'] >>> [(1, 2), (3, 4)] >> Insert(2, items) >> Collect() [(1, 2, 'a'), (3, 4, 'b')]
>>> items = [('a', 'b'), ('c', 'd')] >>> [(1, 2), (3, 4)] >> Insert(1, items) >> Collect() [(1, 'a', 'b', 2), (3, 'c', 'd', 4)]
>>> from nutsflow import Enumerate >>> [(1, 2), (3, 4)] >> Insert(0, Enumerate()) >> Collect() [(0, 1, 2), (1, 3, 4)]
Parameters: - iterable iterable (iterable) – Any iterable over tuples or lists
- index (int) – Index at which position items are inserted.
- items (iterable|object) – A single object or an iterable over objects.
Returns: iterator where items are inserted into the iterable elements.
Return type: iterator over tuples
-
__rrshift__
(iterable)¶
-
class
Interleave
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Interleave(*iterables)
Interleave elements of iterable with elements of given iterables. Similar to iterable >> Zip(*iterables) >> Flatten() but longest iterable determines length of interleaved iterator.
>>> from nutsflow import Range, Collect >>> Range(5) >> Interleave('abc') >> Collect() [0, 'a', 1, 'b', 2, 'c', 3, 4]
>>> '12' >> Interleave('abcd', '+-') >> Collect() ['1', 'a', '+', '2', 'b', '-', 'c', 'd']
Parameters: - iterable (iterable) – Any iterable
- iterables (iterable) – Iterables to interleave
Returns: Iterator over interleaved elements.
Return type: iterator
-
__rrshift__
(iterable)¶
-
Map
¶ alias of
builtins._create_nut_wrapper.<locals>.Wrapper
-
class
MapCol
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> MapCol(columns, func)
Apply given function to given columns of elements in iterable.
>>> neg = lambda x: -x >>> [(1, 2), (3, 4)] >> MapCol(0, neg) >> Collect() [(-1, 2), (-3, 4)]
>>> [(1, 2), (3, 4)] >> MapCol(1, neg) >> Collect() [(1, -2), (3, -4)]
>>> [(1, 2), (3, 4)] >> MapCol((0, 1), neg) >> Collect() [(-1, -2), (-3, -4)]
Parameters: - of iterables iterable (iterable) – Any iterable that contains iterables
- of ints columns (int|tuple) – Column index or tuple of indexes
- func (function) – Function to apply to elements
Returns: Iterator over lists
Return type: iterator of list
-
__rrshift__
(iterable)¶
-
class
MapMulti
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> MapMulti(*funcs)
Map multiple functions on iterable. For each function a separate iterable is returned. Can consume large amounts of memory when iterables are processed sequentially!
>>> from nutsflow import Collect, _
>>> nums, twos, greater2 = [1, 2, 3] >> MapMulti(_, _ * 2, _ > 2) >>> nums >> Collect() [1, 2, 3]
>>> twos >> Collect() [2, 4, 6]
>>> greater2 >> Collect() [False, False, True]
Parameters: - iterable (iterable) – Any iterable
- funcs (functions) – Functions to map
Returns: Iterators for each function
Return type: (iterator, ..)
-
__rrshift__
(iterable)¶
-
class
MapPar
(func, chunksize=8)[source]¶ Bases:
nutsflow.base.Nut
-
__init__
(func, chunksize=8)[source]¶ iterable >> MapPar(func, chunksize=mp.cpu_count())
Map function in parallel. Order of iterable is preserved. Note that ParMap is of limited use since ‘func’ must be pickable and only top level functions (not class methods) are pickable. See https://docs.python.org/2/library/pickle.html
>>> from nutsflow import Collect >>> [-1, -2, -3] >> MapPar(abs) >> Collect() [1, 2, 3]
Parameters: - iterable (iterable) – Any iterable
- func (function) – Function to map
- chunksize (int) – Number of parallel processes to use for mapping.
Returns: Iterator over mapped elements
Return type: iterator
-
__rrshift__
(iterable)[source]¶ Chaining operator for Nuts. Needs to be overridden!
Takes an input iterable and produces some output iterable. If the number of elements in the input and the output iterable does not change consider NutFunction instead.
Parameters: iterable (iterable) – Iterable to process. Returns: Iterable Return type: iterable Raise: NotImplementedError if not implemented.
-
-
Partition
¶ alias of
nutsflow.iterfunction._create_nut_wrapper.<locals>.Wrapper
-
Permutate
¶ alias of
itertools._create_nut_wrapper.<locals>.Wrapper
-
class
Pick
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Pick(p_n)
Pick every p_n-th element from the iterable if p_n is an integer, otherwise pick randomly with probability p_n.
>>> from nutsflow import Range, Collect >>> from nutsflow.common import StableRandom
>>> [1, 2, 3, 4] >> Pick(0.0) >> Collect() []
>>> [1, 2, 3, 4] >> Pick(1.0) >> Collect() [1, 2, 3, 4]
>>> import random as rnd >>> Range(10) >> Pick(0.5, StableRandom(1)) >> Collect() [0, 4, 5, 6, 8, 9]
>>> [1, 2, 3, 4] >> Pick(2) >> Collect() [1, 3]
Parameters: - iterable (iterable) – Any iterable
- p_n (float|int) – Probability p in [0, 1] or integer n for every n-th element
- rand (Random|None) – Random number generator. If None, random.Random() is used.
Returns: Iterator over picked elements.
Return type: iterator
-
__rrshift__
(iterable)¶
-
class
Prefetch
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Prefetch(num_prefetch=1)
Prefetch elements from iterable. Typically used to keep the CPU busy while the GPU is crunching.
>>> from nutsflow import Take, Consume >>> it = iter([1, 2, 3, 4]) >>> it >> Prefetch(1) >> Take(1) >> Consume() >>> next(it) 3
Parameters: - iterable (iterable) – Any iterable
- num_prefetch (int) – Number of elements to prefetch.
Returns: Iterator over input elements
Return type: iterator
-
__rrshift__
(iterable)¶
-
class
PrintProgress
(data, every_sec=10.0)[source]¶ Bases:
nutsflow.base.Nut
-
__init__
(data, every_sec=10.0)[source]¶ iterable >> PrintProgress(data, every_sec=10.0)
Print progress on iterable. Requires that length of iterable is known beforehand. Data are just passed through. For long running computations and Estimated time of arrival (eta) is printed as well
range(10) >> PrintProgress(10, 0) >> Consume()
Parameters: Returns: Iterator over input elements
Return type: iterator
-
__rrshift__
(iterable)[source]¶ Chaining operator for Nuts. Needs to be overridden!
Takes an input iterable and produces some output iterable. If the number of elements in the input and the output iterable does not change consider NutFunction instead.
Parameters: iterable (iterable) – Iterable to process. Returns: Iterable Return type: iterable Raise: NotImplementedError if not implemented.
-
-
class
Shuffle
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Shuffle(buffersize)
Perform (partial) random shuffle of the elements in the iterable. Elements of the iterable are stored in a buffer of the given size and shuffled within. If buffersize is smaller than the length of the iterable the shuffle is therefore partial in the sense that the ‘window’ of the shuffle is limited to buffersize. Note that for buffersize = 1 no shuffling occurs.
In the following example rand = StableRandom(0) is used to create a fixed sequence that stable across Python version 2.x and 3.x. Usually, this is not what you want. Use the default rand=None which uses random.Random() instead.
>>> from nutsflow import Range, Collect >>> from nutsflow.common import StableRandom
>>> Range(10) >> Shuffle(5, StableRandom(0)) >> Collect() [4, 2, 3, 6, 7, 0, 1, 9, 5, 8]
>>> Range(10) >> Shuffle(1, StableRandom(0)) >> Collect() [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Parameters: - iterable (iterable) – Any iterable
- buffersize (int) – Number of elements stored in shuffle buffer.
- rand (Random|None) – Random number generator. If None, random.Random() is used.
Returns: Generator over shuffled elements
Return type: generator
-
__rrshift__
(iterable)¶
-
class
Slice
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Slice([start,] stop[, stride])
Return slice of elements from iterable. See https://docs.python.org/2/library/itertools.html#itertools.islice
>>> from nutsflow import Collect
>>> [1, 2, 3, 4] >> Slice(2) >> Collect() [1, 2]
>>> [1, 2, 3, 4] >> Slice(1, 3) >> Collect() [2, 3]
>>> [1, 2, 3, 4] >> Slice(0, 4, 2) >> Collect() [1, 3]
Parameters: Returns: Elements sliced from iterable
Return type: iterator
-
__rrshift__
(iterable)¶
-
-
class
Take
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Take(n)
Return first n elements of iterable
>>> from nutsflow import Collect
>>> [1, 2, 3, 4] >> Take(2) >> Collect() [1, 2]
Parameters: - iterable (iterable) – Any iterable
- n (int) – Number of elements to take
Returns: First n elements of iterable
Return type: iterator
-
__rrshift__
(iterable)¶
-
TakeWhile
¶ alias of
itertools._create_nut_wrapper.<locals>.Wrapper
-
Tee
¶ alias of
itertools._create_nut_wrapper.<locals>.Wrapper
-
class
Try
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Try(nut)
Exception handling for (nut) functions. If the wrapped nut or function raises an exception it is caught and handled with the provided handler. Per default the exception and the value causing it are printed. Furthermore a default value can be specified that is returned instead of the nut output if an exception occurs. Per default no output is returned but an error message printed (STDERR).
NOTE: In the following examples ‘STDOUT’ is used only to verify the error message within the doctest. In production code use the default value of ‘STDERR’.
>>> from nutsflow import Try, Collect, nut_function
>>> [10, 2, 1] >> Try(lambda x : 10//x) >> Collect() [1, 5, 10] >>> [10, 0, 1] >> Try(lambda x : 10//x, 'STDOUT') >> Collect() ERROR: 0 : integer division or modulo by zero [1, 10]
>>> Div = nut_function(lambda x : 10//x) >>> [10, 2, 1] >> Try(Div()) >> Collect() [1, 5, 10] >>> [10, 0, 1] >> Try(Div(), 'STDOUT') >> Collect() ERROR: 0 : integer division or modulo by zero [1, 10] >>> [10, 0, 1] >> Try(Div(), -1) >> Collect() [1, -1, 10]
>>> handlezero = lambda x, e: 'FAILED: '+str(x) >>> [10, 0, 1] >> Try(Div(), handlezero) >> Collect() [1, 'FAILED: 0', 10]
>>> handlezero = lambda x, e: str(e) >>> [10, 0, 1] >> Try(Div(), handlezero) >> Collect() [1, 'integer division or modulo by zero', 10]
Parameters: - iterable (iterable) – Iterable the nut operates on.
- func (function|NutFunction) – (Nut) function that is wrapped for exception handling. Can be a plain Python function/method as well.
- default (Object) –
Return value if exception occurs. If default = ‘IGNORE’, no value is returned and no error is printed. If default = ‘STDERR’, no value is returned, error is printed to stderr. If default = ‘STDOUT’, no value is returned, error is printed to stdout. If default is function that takes element x and exception e
as parameters its result is returned and no error is printed.Otherwise the default value is returned and no error is printed.
Returns: Iterator over input elements transformed by provided nut.
Return type: iterator
-
__rrshift__
(iterable)¶
-
class
Window
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Window(n)
Sliding window of size n over elements in iterable.
>>> [1, 2, 3, 4] >> Window() >> Collect() [(1, 2), (2, 3), (3, 4)]
>>> [1, 2, 3, 4] >> Window(3) >> Collect() [(1, 2, 3), (2, 3, 4)]
>>> 'test' >> Window(2) >> Map(''.join) >> Collect() ['te', 'es', 'st']
Parameters: - iterable (iterable) – Any iterable
- n (int) – Size of window
Returns: iterator with tuples of length n
Return type: iterator over tuples
-
__rrshift__
(iterable)¶
-
class
Zip
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> Zip(*iterables)
Zip elements of iterable with elements of given iterables. Zip finishes when shortest iterable is exhausted. See https://docs.python.org/2/library/itertools.html#itertools.izip And https://docs.python.org/2/library/itertools.html#itertools.izip_longest
>>> from nutsflow import Collect
>>> [0, 1, 2] >> Zip('abc') >> Collect() [(0, 'a'), (1, 'b'), (2, 'c')]
>>> '12' >> Zip('abcd', '+-') >> Collect() [('1', 'a', '+'), ('2', 'b', '-')]
Parameters: - iterable (iterable) – Any iterable
- iterables (iterable) – Iterables to zip
Returns: Zipped elements from iterables.
Return type: iterator over tuples
-
__rrshift__
(iterable)¶
-
class
ZipWith
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.Nut
iterable >> ZipWith(f, *iterables)
Zips the given iterables, unpacks them and applies the given function.
>>> add = lambda a, b: a + b >>> [1, 2, 3] >> ZipWith(add, [2, 3, 4]) >> Collect() [3, 5, 7]
Parameters: - iterable (iterable) – Any iterable
- iterables (iterable) – Any iterables
- f (function) – Function to apply to zipped input iterables
Returns: iterator of result of f() applied to zipped iterables
Return type: iterator
-
__rrshift__
(iterable)¶
nutsflow.sink module¶
-
class
ArgMax
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> ArgMax(key=None, default=None, retvalue=False)
Return index of first maximum element (and maximum) in input (transformed or extracted by key function).
>>> [1, 2, 0, 2] >> ArgMax() 1
>>> ['12', '1', '123'] >> ArgMax(key=len, retvalue=True) (2, '123')
>>> ['12', '1', '123'] >> ArgMax(key=len) 2
>>> [] >> ArgMax(default=0) 0
>>> [] >> ArgMax(default=(None, 0), retvalue=True) (None, 0)
>>> data = [(3, 10), (2, 20), (1, 30)] >>> data >> ArgMax(key=0) 0 >>> data >> ArgMax(1) 2
Parameters: Returns: index of largest element according to key function and the largest element itself if retvalue==True
Return type: object | tuple
-
__rrshift__
(iterable)¶
-
-
class
ArgMin
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> ArgMin(key=None, default=None, retvalue=True)
Return index of first minimum element (and minimum) in input (transformed or extracted by key function).
>>> [1, 2, 0, 2] >> ArgMin() 2
>>> ['12', '1', '123'] >> ArgMin(key=len, retvalue=True) (1, '1')
>>> ['12', '1', '123'] >> ArgMin(key=len) 1
>>> [] >> ArgMin(default=0) 0
>>> [] >> ArgMin(default=(None, 0), retvalue=True) (None, 0)
>>> data = [(3, 10), (2, 20), (1, 30)] >>> data >> ArgMin(key=0) 2 >>> data >> ArgMin(1) 0
Parameters: Returns: index of smallest element according to key function and the smallest element itself if retvalue==True.
Return type: object | tuple
-
__rrshift__
(iterable)¶
-
-
class
Collect
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Collect(container)
Collects all elements of the iterable input in the given container.
>>> range(5) >> Collect() [0, 1, 2, 3, 4]
>>> [1, 2, 3, 2] >> Collect(set) {1, 2, 3}
>>> [('one', 1), ('two', 2)] >> Collect(dict) {'one': 1, 'two': 2}
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- container (container) – Some container, e.g. list, set, dict that can be filled from an iterable
Returns: Container
Return type: container
-
__rrshift__
(iterable)¶
-
Consume
¶ alias of
nutsflow.iterfunction._create_nut_wrapper.<locals>.Wrapper
-
Count
¶ alias of
nutsflow.iterfunction._create_nut_wrapper.<locals>.Wrapper
-
class
CountValues
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> CountValues(relative=False)
Return dictionary with (relative) counts of the values in the input iterable.
>>> 'abaacc' >> CountValues() {'a': 3, 'b': 1, 'c': 2}
>>> 'aabaab' >> CountValues(relative=True) {'a': 1.0, 'b': 0.5}
>>> data = [('a', 'X'), ('b', 'Y'), ('a', 'Y')] >>> data >> CountValues(column=0) {'a': 2, 'b': 1} >>> data >> CountValues(column=1) {'Y': 2, 'X': 1}
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- column (int|None) – Column of values in iterable to extract values from. If colum=None the values in the iterable themselves will be counted.
- relative (bool) – True: return relative counts otherwise absolute counts
Returns: Dictionary with (relative) counts for elements in iterable.
Return type: -
__rrshift__
(iterable)¶
-
class
Head
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Head(n, container=list)
Collect first n elements of iterable in specified container.
>>> [1, 2, 3, 4] >> Head(2) [1, 2]
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- n (int) – Number of elements to take.
- container (container) – Container to collect elements in, e.g. list, set
Returns: Container with head elements
Return type: container
-
__rrshift__
(iterable)¶
-
class
Join
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Join(separator=’‘)
Same as Python’s sep.join(iterable). Concatenates the elements in the iterable to a string using the given separator. In addition to Python’s sep.join(iterable) it also automatically converts elements to strings.
Parameters: - iterable (iterable) – Any iterable
- separator (string) – Seperator string between elements.
Returns: String of with concatenated elements of iterable.
Return type: -
__rrshift__
(iterable)¶
-
class
Max
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Max(key=None, default=None)
Return maximum of inputs (transformed or extracted by key function).
>>> [1, 2, 3, 2] >> Max() 3
>>> ['1', '123', '12'] >> Max(key=len) '123'
>>> [] >> Max(default=0) 0
>>> data = [(3, 10), (2, 20), (1, 30)] >>> data >> Max(key=0) (3, 10)
>>> data >> Max(1) (1, 30)
Parameters: - iterable (iterable) – Iterable over numbers
- key (int|tuple|function|None) – Key function to extract or transform elements. None = identity function.
- default (object) – Value returned if iterable is empty.
Returns: largest element according to key function
Return type: -
__rrshift__
(iterable)¶
-
class
Mean
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Mean(key=None, default=None)
Return mean value of inputs (transformed or extracted by key function).
>>> [1, 2, 3] >> Mean() 2.0
>>> [] >> Mean(default=0) 0
>>> data = [(1, 10), (2, 20), (3, 30)] >>> data >> Mean(key=0) 2.0 >>> data >> Mean(key=1) 20.0
Parameters: - iterable (iterable) – Iterable over numbers
- default (object) – Value returned if iterable is empty.
- key (int|tuple|function|None) – Key function to extract elements.
Returns: Mean of numbers or default value
Return type: number
-
__rrshift__
(iterable)¶
-
class
MeanStd
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> MeanStd(key=None, default=None, ddof=1)
Return mean and standard deviation of inputs (transformed or extracted by key function). Standard deviation is with degrees of freedom = 1
>>> [1, 2, 3] >> MeanStd() (2.0, 1.0)
>>> data = [(1, 10), (2, 20), (3, 30)] >>> data >> MeanStd(key=0) (2.0, 1.0) >>> data >> MeanStd(1) (20.0, 10.0)
Parameters: Returns: Mean and standard deviation of numbers or default value
Return type: tuple (mean, std)
-
__rrshift__
(iterable)¶
-
-
class
Min
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Min(key=None, default=None)
Return minimum of inputs (transformed or extracted by key function).
>>> [1, 2, 3, 2] >> Min() 1
>>> ['1', '123', '12'] >> Min(key=len) '1'
>>> [] >> Min(default=0) 0
>>> data = [(3, 10), (2, 20), (1, 30)] >>> data >> Min(key=0) (1, 30)
>>> data >> Min(1) (3, 10)
Parameters: - iterable (iterable) – Iterable over numbers
- key (int|tuple|function|None) – Key function to extract or transform elements. None = identity function.
- default (object) – Value returned if iterable is empty.
Returns: smallest element according to key function
Return type: -
__rrshift__
(iterable)¶
-
Next
¶ alias of
builtins._create_nut_wrapper.<locals>.Wrapper
-
Nth
¶ alias of
nutsflow.iterfunction._create_nut_wrapper.<locals>.Wrapper
-
Reduce
¶ alias of
_functools._create_nut_wrapper.<locals>.Wrapper
-
class
Sort
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Sort(key=None, reverse=False)
Sorts iterable with respect to key function or column index(es).
>>> [3, 1, 2] >> Sort() [1, 2, 3]
>>> [3, 1, 2] >> Sort(reverse=True) [3, 2, 1]
>>> [(1,'c'), (2,'b'), (3,'a')] >> Sort(1) [(3, 'a'), (2, 'b'), (1, 'c')]
>>> ['a3', 'c1', 'b2'] >> Sort(key=lambda s: s[0]) ['a3', 'b2', 'c1']
>>> ['a3', 'c1', 'b2'] >> Sort(key=0) ['a3', 'b2', 'c1']
>>> ['a3', 'c1', 'b2'] >> Sort(1) ['c1', 'b2', 'a3']
>>> ['a3', 'c1', 'b2'] >> Sort((1,0)) ['c1', 'b2', 'a3']
Parameters: - iterable (iterable) – Iterable
- key (int|tuple|function|None) – function to sort based on or column index(es) tuples/vectors/strings are sorted by.
- reverse (boolean) – True: reverse order.
Returns: Sorted iterable
Return type: -
__rrshift__
(iterable)¶
-
class
Sum
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Sum(key=None)
Return sum over inputs (transformed or extracted by key function)
>>> [1, 2, 3] >> Sum() 6
>>> [1, 2, 3] >> Sum(lambda x: x*x) 14
>>> data = [(1, 10), (2, 20), (3, 30)] >>> data >> Sum(key=0) 6 >>> data >> Sum(key=1) 60
Parameters: - iterable (iterable) – Iterable over numbers
- key (int|tuple|function|None) – Key function to extract elements.
Returns: Sum of numbers
Return type: number
-
__rrshift__
(iterable)¶
-
class
Tail
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Tail(n, container=list)
Collect last n elements of iterable in specified container. This consumes the iterable completely!
>>> [1, 2, 3, 4] >> Tail(2) [3, 4]
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- n (int) – Number of elements to take.
- container (container) – Container to collect elements in, e.g. list, set
Returns: Container with tail elements
Return type: container
-
__rrshift__
(iterable)¶
-
class
Unzip
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
iterable >> Unzip(container=None)
Same as izip(*iterable) but returns iterators for container=None
>>> [(1, 2, 3), (4, 5, 6)] >> Unzip(tuple) >> Collect() [(1, 4), (2, 5), (3, 6)]
Parameters: - iterable (iterable) – Any iterable, e.g. list, range, …
- container (container) – If not none, unzipped results are collected in the provided container, eg. list, tuple, set
Returns: Unzip iterable.
Return type: iterator over iterators
-
__rrshift__
(iterable)¶
-
class
WriteCSV
(filepath, cols=None, skipheader=0, fmtfunc=<function WriteCSV.<lambda>>, **kwargs)[source]¶ Bases:
nutsflow.base.NutSink
Write data to a CSV file using Python’s CSV writer. See: https://docs.python.org/2/library/csv.html
-
__init__
(filepath, cols=None, skipheader=0, fmtfunc=<function WriteCSV.<lambda>>, **kwargs)[source]¶ WriteCSV(filepath, cols, skipheader, fmtfunc, **kwargs)
Write data in Comma Separated Values format (CSV) and other formats to file. Tab Separated Values (TSV) files can be written by specifying a different delimiter. Note that in the docstring below delimiter is ‘t’ but in code it should be ‘ ‘. See unit tests.
Also see https://docs.python.org/2/library/csv.html and ReadCSV.
>>> import os >>> filepath = 'tests/data/temp_out.csv' >>> with WriteCSV(filepath) as writer: ... range(10) >> writer >>> os.remove(filepath)
>>> with WriteCSV(filepath, cols=(1,0)) as writer: ... [(1,2), (3,4)] >> writer >>> os.remove(filepath)
>>> filepath = 'tests/data/temp_out.tsv' >>> with WriteCSV(filepath, delimiter='\t') as writer: ... [[1,2], [3,4]] >> writer >>> os.remove(filepath)
Parameters: - filepath (string) – Path to file in CSV format.
- cols (tuple) – Indices of the columns to write. If None all columns are written.
- skipheader (int) – Number of header rows to skip.
- fmtfunc (function) – Function to apply to the elements of each row.
- kwargs (kwargs) – Keyword arguments for Python’s CSV writer. See https://docs.python.org/2/library/csv.html
-
nutsflow.source module¶
-
class
Empty
[source]¶ Bases:
nutsflow.base.NutSource
Return empty iterable.
>>> from nutsflow import Collect >>> Empty() >> Collect() []
Returns: Empty iterator Return type: iterator
-
class
Enumerate
(start=0[, step])[source]¶ Bases:
nutsflow.base.NutSource
Return increasing integers. See itertools.count
>>> from nutsflow import Take, Collect
>>> Enumerate() >> Take(3) >> Collect() [0, 1, 2]
>>> Enumerate(1, 2) >> Take(3) >> Collect() [1, 3, 5]
Parameters: Returns: Increasing integers.
Return type: iterable over int
-
class
Product
(*iterables[, repeat])[source]¶ Bases:
nutsflow.base.NutSource
Return cartesian product of input iterables.
>>> from nutsflow import Collect
>>> Product([1, 2], [3, 4]) >> Collect() [(1, 3), (1, 4), (2, 3), (2, 4)]
>>> Product('ab', range(3)) >> Collect() [('a', 0), ('a', 1), ('a', 2), ('b', 0), ('b', 1), ('b', 2)]
>>> Product([1, 2, 3], repeat=2) >> Collect() [(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)]
Parameters: - iterables (iterables) – Collections of iterables to create cartesian product from.
- repeat (int) – Repeat a single iterable ‘repeat’ times, e.g. Procuct([1,2], [1,2]) is equal to Product([1,2], repeat=2)
Returns: cartesian product
Return type: iterator over tuples
-
class
Range
(*args, **kwargs)[source]¶ Bases:
nutsflow.base.NutSource
Range of numbers. Similar to range() but returns iterator that depletes.
-
class
ReadCSV
(filepath, columns=None, skipheader=0, fmtfunc=None, **kwargs)[source]¶ Bases:
nutsflow.base.NutSource
Read data from a CSV file using Python’s CSV reader. See: https://docs.python.org/2/library/csv.html
-
__init__
(filepath, columns=None, skipheader=0, fmtfunc=None, **kwargs)[source]¶ ReadCSV(filepath, columns, skipheader, fmtfunc, **kwargs)
Read data in Comma Separated Format (CSV) from file. See also CSVWriter. Can also read Tab Separated Format (TSV) be providing the corresponding delimiter. Note that in the docstring below delimiter is ‘t’ but in code it should be ‘ ‘. See unit tests.
>>> from nutsflow import Collect >>> filepath = 'tests/data/data.csv'
>>> with ReadCSV(filepath, skipheader=1) as reader: ... reader >> Collect() [('1', '2', '3'), ('4', '5', '6')]
>>> with ReadCSV(filepath, skipheader=1, fmtfunc=int) as reader: ... reader >> Collect() [(1, 2, 3), (4, 5, 6)]
>>> with ReadCSV(filepath, skipheader=1, fmtfunc=(int,str,float)) as reader: ... reader >> Collect() [(1, '2', 3.0), (4, '5', 6.0)]
>>> with ReadCSV(filepath, (2, 1), 1, int) as reader: ... reader >> Collect() [(3, 2), (6, 5)]
>>> with ReadCSV(filepath, (2, 1), 1, (str,int)) as reader: ... reader >> Collect() [('3', 2), ('6', 5)]
>>> with ReadCSV(filepath, 2, 1, int) as reader: ... reader >> Collect() [3, 6]
>>> filepath = 'tests/data/data.tsv' >>> with ReadCSV(filepath, skipheader=1, fmtfunc=int, ... delimiter='\t') as reader: ... reader >> Collect() [(1, 2, 3), (4, 5, 6)]
Parameters: - filepath (string) – Path to file in CSV format.
- columns (tuple) – Indices of the columns to read. If None all columns are read.
- skipheader (int) – Number of header lines to skip.
- fmtfunc (tuple|function) – Function or functions to apply to the column elements of each row.
- kwargs (kwargs) – Keyword arguments for Python’s CSV reader. See https://docs.python.org/2/library/csv.html
-
-
class
Repeat
(value[, n])[source]¶ Bases:
nutsflow.base.NutSource
Return given value repeatedly. See itertools.repeat
>>> from nutsflow import Take, Collect
>>> Repeat(1, 3) >> Collect() [1, 1, 1]
>>> Repeat(1) >> Take(4) >> Collect() [1, 1, 1, 1]
Parameters: Returns: Iterator of repeated objects
Return type: iterable over object


| Contents | Previous | Next |
This chapter outlines the concepts behind instrumenting resources for management using JMX technology, in the following sections:
Different types of resource can be managed using JMX technology, for example an application, an implementation of a service, a device or a user. For a given resource to be managed by JMX technology, it must be developed in the Java language, or at least offer a Java language wrapper. It must also be instrumented by one or more Java objects known as managed beans (MBeans), in compliance with the JMX specification.
Developers of applications and devices are free to choose the granularity of objects that are instrumented as MBeans. An MBean might represent the smallest object in an application, or it could represent the entire application. Application components designed with their management interface in mind can typically be written as MBeans. MBeans can also be used as wrappers for legacy code without a management interface or as proxies for code with a legacy management interface.
The Java objects that implement resources and their instrumentation are called managed beans, or MBeans. MBeans must follow the design patterns and interfaces defined in the JMX specification (JSR 3). This ensures that all MBeans provide the instrumentation of managed resources in a standardized way.
The instrumentation of a given resource is provided by one or more MBeans that are either standard or dynamic. Standard MBeans are Java objects that conform to certain design patterns derived from the JavaBeansTM component model. Dynamic MBeans conform to a specific interface that offers more flexibility at runtime. MXBeans reference only a pre-defined set of types.
The instrumentation of a resource allows it to be manageable through the agent level described in Chapter 4, "Using JMX Agents". MBeans do not require knowledge of the JMX agent with which they operate.
MBeans are designed to be flexible, simple, and easy to implement. Developers of applications, services, or devices can make their products manageable in a standard way without having to understand or invest in complex management systems. Existing objects can easily be evolved to produce standard MBeans or wrapped as dynamic MBeans, thus making existing resources manageable with minimum effort.
In addition, the instrumentation level also specifies a notification mechanism. This allows MBeans to generate and propagate notification events to components of the other levels.
The management interface of an MBean consists of:
The Java class of a standard MBean exposes the resource to be managed directly through its attributes and operations. Attributes are internal entities that are exposed through getter and setter methods. Operations are the other methods of the class that are available to managers. All these methods are defined statically in the MBean interface and are visible to a JMX agent through introspection. This is the most straightforward way of making a new resource manageable.
A dynamic MBean is an MBean that defines its management interface at runtime. For example, a configuration MBean could determine the names and types of the attributes it exposes by parsing an XML file.
An MXBean is a new type of MBean that provides a simple way to code an MBean that only references a pre-defined set of types. In this way, you can be sure that your MBean will be usable by any client, including remote clients, without any requirement that the client have access to model-specific classes representing the types of your MBeans.
The Java Virtual Machine (Java VM) is highly instrumented using JMX technology. You can easily start a JMX agent to access the built-in Java VM instrumentation, and thereby monitor and manage the Java VM remotely by means of JMX technology.
To find out more about using JMX technology to monitor and manage the Java VM, see the Java SE Monitoring and Management Guide.
| Contents | Previous | Next |


David leads you to his car, unlocks it with shaky fingers, and ushers you into the passenger seat. He jogs around the car and gets into the driver's seat. His hands are shaking and he misses the ignition. You grab his hands, and look into his eyes, and he takes a deep breath and calms down enough to get the car to start.
David drives you to Mr. Ward's house, who lets you in quietly. David gives you a tight hug.
"Good luck, we all love you." he whispers in your ears.
You hug him extra hard.
"Tell Ma, and everyone, that I love them always." you sob.
David nods, his eyes red with tears, before he slips out the door.
Mr. Ward grabs your hand and squeezes it.
"Are you alright, Rose?"

"Yes, thank you, Mr. Ward."
Mr. Ward makes a face.
"Rose, please. Call me Rob."
"Okay." you smile weakly, "Rob."
"Get some rest, we'll leave early tomorrow morning."
You look at him in confusion.
"Where are we going? I thought I was going to hide here?"
 I have a plane ticket for you to leave."

"I'm leaving? On my own?"
"If I go with you it will be suspicious. I will give you enough money to get a fresh start."
"I also wrote a letter of recommendation and attached your grades, if you want to apply to university somewhere."
Mr. Ward smiles at you, and you feel a glimmer of hope in your stomach. Will this actually work? Will you be free? Free to live your life the way you want to? You can't believe that this is really happening!
That night you can't fall asleep, you're too excited about everything that's happening. But at the same time, you're equally sad, you're never going to be able to see your family again. Ever.
Mr. Ward comes for you in the middle of the night, and he hands you a backpack. It contains some spare clothes, and money. He brings you to his truck, and he drives you to the airport. The ride over is silent. You don't know how to express your gratitude and Mr. Ward seems extremely nervous, he's constantly checking the rearview mirrors.
You reach the international airport, and Mr. Ward parks to drop you off. You hug him.
"Thank you!" you smile at him, "I couldn't have done this without your help."
Mr. Ward smiles at you.
"Good luck, kid. I hope you find your happiness."
 It's a one-way ticket to a new life.


Effective date: Febrary 1, 2021
Agon Labs Inc. ("us",
"we", or "our") operates the Agon mobile application
(hereinafter referred to as the "Service").This page informs
you of our policies regarding the collection, use and disclosure of
personal data when you use our Service and the choices you have
associated with that data.We use your data to provide and improve the
Service. By using the Service, you agree to the collection and use of
information in accordance with this policy. Unless otherwise defined in
this Privacy Policy, the terms used in this Privacy Policy have the same
meanings as in our Terms and Conditions.
Service is the Agon mobile application operated by Agon Labs Inc.
Personal Data means data about a living individual who can be identified from those data (or from those and other information either in our possession or likely to come into our possession).
Usage Data is data collected automatically either generated by the use of the Service or from the Service infrastructure itself (for example, the duration of a page visit).
Cookies are small files stored on your device (computer or mobile device).
Data Controller means the natural or legal person who (either alone or jointly or in common with other persons) determines the purposes for which and the manner in which any personal information are, or are to be, processed.
For the purpose of this Privacy Policy, we are a Data Controller of your Personal Data.
Data Processor (or Service Provider) means any natural or legal person
who processes the data on behalf of the Data Controller.
We may use the services of various Service Providers in order to process your data more effectively.
Data Subject is any living individual who is using our Service and is the subject of Personal Data.
We collect several different types of information for various purposes
to provide and improve our Service to you.
While using our Service, we may ask you to provide us with certain
personally identifiable information that can be used to contact or
identify you ("Personal Data"). Personally identifiable
information may include, but is not limited to:
When you access the Service with a mobile device, we may collect certain
information automatically, including, but not limited to, the type of
mobile device you use, your mobile device unique ID, the IP address of
your mobile device, your mobile operating system, the type of mobile
Internet browser you use, unique device identifiers and other diagnostic
data ("Usage Data").
We use cookies and similar tracking technologies to track the activity on our Service and we hold certain information.
Cookies are files with a small amount of data which may include an
anonymous unique identifier. Cookies are sent to your browser from a
website and stored on your device. Other tracking technologies are also
used such as beacons, tags and scripts to collect and track information
and to improve and analyse our Service.
You can instruct your browser to refuse all cookies or to indicate when
a cookie is being sent. However, if you do not accept cookies, you may
not be able to use some portions of our Service.
Examples of Cookies we use:
Session Cookies. We
use Session Cookies to operate our Service.
Preference Cookies. We use Preference Cookies to remember your preferences and various
settings.
Security Cookies. We use Security
Cookies for security purposes.
Agon Labs Inc. uses the collected data for various purposes:
If you are from the European Economic Area (EEA), Agon Labs Inc. legal basis for collecting and using the personal information described in this Privacy Policy depends on the Personal Data we collect and the specific context in which we collect it.
Agon Labs Inc. may process your Personal Data because:
Agon Labs Inc. will retain your Personal Data only for as long as is necessary for the purposes set out in this Privacy Policy. We will retain and use your Personal Data to the extent necessary to comply with our legal obligations (for example, if we are required to retain your data to comply with applicable laws), resolve disputes and enforce our legal agreements and policies.
Agon Labs Inc. will also retain Usage Data for internal analysis purposes. Usage Data is generally retained for a shorter period of time, except when this data is used to strengthen the security or to improve the functionality of our Service, or we are legally obligated to retain this data for longer periods.
Your information, including Personal Data, may be transferred to - and maintained on - computers located outside of your state, province, country or other governmental jurisdiction where the data protection laws may differ from those of your jurisdiction.
If you are located outside United States and choose to provide information to us, please note that we transfer the data, including Personal Data, to United States and process it there.Your consent to this Privacy Policy followed by your submission of such information represents your agreement to that transfer.
Agon Labs Inc. will take all the steps reasonably necessary to ensure that your data is treated securely and in accordance with this Privacy Policy and no transfer of your Personal Data will take place to an organisation or a country unless there are adequate controls in place including the security of your data and other personal information.
If Agon Labs Inc. is involved in a merger, acquisition or asset sale,
your Personal Data may be transferred. We will provide notice before
your Personal Data is transferred and becomes subject to a different
Privacy Policy.
Under certain circumstances, Agon Labs Inc. may be required to disclose
your Personal Data if required to do so by law or in response to valid
requests by public authorities (e.g. a court or a government agency).
Agon Labs Inc. may disclose your Personal Data in the good faith belief that such action is necessary to:
The security of your data is important to us but remember that no method
of transmission over the Internet or method of electronic storage is
100% secure. While we strive to use commercially acceptable means to
protect your Personal Data, we cannot guarantee its absolute
security.
We do not support Do Not Track ("DNT"). Do Not Track is a
preference you can set in your web browser to inform websites that you
do not want to be tracked.
You can enable or disable Do Not Track by visiting the Preferences or Settings page of your web browser.
If you are a resident of the European Economic Area (EEA), you have certain data protection rights. Agon Labs Inc. aims to take reasonable steps to allow you to correct, amend, delete or limit the use of your Personal Data.
If you wish to be informed about what Personal Data we hold about you and if you want it to be removed from our systems, please contact us.In certain circumstances, you have the following data protection rights:
Please note that we may ask you to verify your identity before responding to such requests.You have the right to complain to a Data Protection Authority about our collection and use of your Personal Data. For more information, please contact your local data protection authority in the European Economic Area (EEA).
We may employ third party companies and individuals to facilitate our Service ("Service Providers"), provide the Service on our behalf, perform Service-related services or assist us in analysing how our Service is used.
These third parties have access to your Personal Data only to perform
these tasks on our behalf and are obligated not to disclose or use it
for any other purpose.
We may use third-party Service Providers to monitor and analyse the use of our Service.
Firebase is an analytics service provided by Google Inc.
You may opt-out of certain Firebase features through your mobile device
settings, such as your device advertising settings or by following the
instructions provided by Google in their Privacy Policy:
Show
We also encourage you to review the Google's policy for
safeguarding your data:
Show
For more information on what type of information Firebase collects,
please visit the Google Privacy & Terms web page:
Show
We may provide paid products and/or services within the Service. In that case, we use third-party services for payment processing (e.g. payment processors).
We will not store or collect your payment card details. That information is provided directly to our third-party payment processors whose use of your personal information is governed by their Privacy Policy. These payment processors adhere to the standards set by PCI-DSS as managed by the PCI Security Standards Council, which is a joint effort of brands like Visa, MasterCard, AmericanExpress and Discover. PCI-DSS requirements help ensure the secure handling of payment information. The payment processors we work with are:
Their Privacy Policy can be viewed at
Show
Our Service may contain links to other sites that are not operated by us. If you click a third party link, you will be directed to that third party's site. We strongly advise you to review the Privacy Policy of every site you visit.
We have no control over and assume no responsibility for the content,
privacy policies or practices of any third party sites or services.
Our Service does not address anyone under the age of 18 ("Children").
We do not knowingly collect personally identifiable information from anyone under the age of 18. If you are a parent or guardian and you are aware that your Child has provided us with Personal Data, please contact us. If we become aware that we have collected Personal Data from children without verification of parental consent, we take steps to remove that information from our server
We may update our Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on this page.
We will let you know via email and/or a prominent notice on our Service, prior to the change becoming effective and update the "effective date" at the top of this Privacy Policy.
You are advised to review this Privacy Policy periodically for any changes. Changes to this Privacy Policy are effective when they are posted on this page.
If you have any questions about this Privacy Policy, please contact
us:
By email<EMAIL_ADDRESS>By visiting this page on our
website: https://agon.ai


Mustafa Ozan Şindi
I have worked as a lead software developer and game developer for previous experiences. I have 7-8 years professional work experience in back-end, front-end and full-stack development. And, I have work experience in game design and development. I have studied at Bogaziçi University, Computer Education and Educational Technologies. In addition, I have registered second University at Management Information System.
Work Experiences
Senior Software Engineer
Ethix-NG project is new and modern version of Ethical Core Banking System. The previous versions of Ethix-NG are BOA by Architecht and Ethix by ITS
- The member of Instructure teams. Main responsibilities
- Development Front-end component with React
- Development Back-end services with C#, .Net Core
- Following dev-ops process for front-end components
- The technologies are used in projects;
- .Net Core / .Net Framework / C#
- Node.js / React / Material UI / Babel / Webpack / Redux / Npm / Yarn
- EF Core / MsSql
- Redis
- Elastic Search
- Azure Technologies
- Git
- Azure DevOps
R&D Team Leader
Lead of R&D software development team. My role has responsibility of project management and software architect. My team develop new e-learning solutions with new techs.
- Lead of R&D Software Development
- Develop new products with .Net and .Net Core
- Develop and implement new features using the existing code base
- Develop LMS and online exam tool as new products
- Develop games with Unity3D
- Development with;
- .NET & .NET Core, Asp.Net MVC, Asp.Net Core MVC
- Entity Framework & Entity Framework Core, MSSQL
- Xamarin
- Unity3D
- Project Management with Agile/Scrum
- Using version control (Git / Azure Devops) in existing and new projects
- Using Microsoft Azure for Continues Delivery
- Implementing new providers’ API
- Finding and fixing bugs
- Maintain and optimize active projects
- Being a part of code review processes
- Primary Customers
Co-Founder and General Manager
Atelye Teknoloji was a startup that developed educational technologies, mobile applications, web-based and mobile-based games, and carried out R&D studies on educational technologies, mobile-assisted educational games, gamification, virtual reality and augmented reality.
Main responsibilities;- Startup Management
- Project Management
- Developing serious games with Unity3D and C#
- Developing TinCan based Measurement and Evaluation tool for Games with .net technologies
- Using version control (Git) in new projects
- The main project was a finalist in Bogazici University IsteBu - entrepreneurship competition
- This startup has been in operation with İdea E-Learning Solutions since 2016
Software Consultant
Providing consultancy support to the software development and business development teams at the projects in Fuskey. Consultancy is provided for the determination of new models to be developed.
Backend Developer
Two initiatives supported by TUBITAK, one of which is Kosgeb. Projects were on the development of educational games and experimental environments using Unity3D, C#. This project also developed environments for use with Kinect for Windows and LeapMotion devices. With the Mindset Thinkgear EEG device, an experimental application was developed to measure the brain activities of the students during the test.
Projects
AFAD Volunteer Information & Training System
This project is the e-learning project to train the volunteer of emergency and rescue and volunteer and volunteer management system. Afad Gonullusu This project is based on ideaL360 (ideaLEnvironment) by Idea E-Learning Solutions.
cet.boun.edu.tr/ondeposu
This project is a web-based object to display flash-based learning objects. The tank. This repository, which developers can contribute, is completely free
cet.boun.edu.tr/yool
This project is a course management system created by Roger Carl Schank's Knowledge Building Theory. In this project I worked as a Project Manager in a team of 5 people. I'm also interested in designing the Database, Code Design and Coding
Instructor
Scratch Training for Bachelor of Science, Mathematics, Teachers at Boğaziçi University as part of Google Computer Science for High School project Google Computer Science for High School project


--- title: Zelda Aldrich Simson permalink: zelda/ layout: page ---
Zelda is a small puppy dog we brought home in August 2015. Cute pictures ahead.
We were told that her mom was a Boston Terrier and her dad was a Chug. This is the first dog I've ever had, and so far, she's been pretty great.
The most current photos and more are posted on Instagram.
This page was created and published August 26, 2015 in honor of National Dog Day. Please carefully consider adopting a pet or donating to your local animal shelter.


settings
Pick Text
Enter New Text
Toggle Mobile Controls
Go
Cancel
Use the dropdown menu below to select the alphabet or the first line of a book.
Go
Cancel
Default key: spacebar
Results
Got It


Wednesday's weather: Fine and dry for most, but rain in the west
Wednesday will be a fine day in many areas, with early patches of fog and frost lifting to leave it dry with some bright or sunny spells.
However, some wet and windy weather will affect Northern Ireland, western Scotland and the far west of Wales.
A yellow rainfall warning is in force for parts of Cornwall until 11am, with 20 to 30 mm of rain possible in places here.
Meanwhile, a few showers will also affect North Sea coasts of both England and Scotland.
It will generally feel cold in the southeasterly wind, with gales possible locally in the west.
Top temperatures 10 Celsius (50F).


| Name | Use | Description |
|---|---|---|
| Server menu | say menu / click N | Opens the server menu. |
| Nominate menu | say nomenu | A menu with all maps in the server from which you can nominate maps. |
| Unstuck | say /unstuck | Unstuck yourself. |
| Mute players | say /mute | Mute annoying players. |
| Rock the vote | say rtv | Initiate map change with your vote. |
| Boost menu | say boost | Opens a menu with all information for boosting the server. |
| Rank | say /rank | Shows your rank. |
| RULES | say /rules | Player rules. |
| Online Admins | say /admins | Shows all online admins and vips. |
| Roundsound | say /roundsound | Turns off the music at end round. |
| RTD | say rtd | Roll the dice and win something cool. |
| GtLink | say /gtlink | Shows your gametracker.com link. |
| Napalm | say /napalm | Gets you a napalm grenade. |
| Private message | say !playername message | Send private message to someone. |
| Message Admins | say @message | Send a message to the admins. |
| bipbip | say bipbip | Bipbip sound effect. |
| Nextmap | say nextmap | Displays the nextmap. |
| Current Map | say currentmap | Displays the currently played map. |
| Thetime | say thetime | Displays the time. |
| Timeleft | say timeleft | Displays the time left in the map. |
| Top 15 | say /top15 | Displays the top 15 players. |
| Top Noobs | say /noobs | Displays the top noob players. |
| Stats | say /stats or /statsme | Displays other players stats or yours. |
| Show IP | amx_showip (in console) | Displays other players IP information. |
| Give Money | say /money | You can give or request money from players. |


Up Avatar Token
Settings
Template settings
Fixed header
Fixed Left Sidebar
Fixed Right Sidebar
Messages
8
Messages
(10) emails and (2) PM
Sammy Morerira
35 min ago
I have question about new function ...
George Michael
1 hour ago
I need to meet you urgent please call me ...
Ivanovich
1 day ago
I send you my suggestion, please look and ...
View all messages
3
Notifications
(3) items
1 User is registred
Jony add 1 comment
admin Julia added post with a long description
View all notifications
<EMAIL_ADDRESS>Edit profile
Comments
Add user
Logout
Nhập List Token
List Avatar
Kết Quả
Chạy
Token Live
0
Token Die
0
Back to Top


Cloud9 supports running on private clusters of commodity hardware, as well as on public cloud infrastructures. We provide in the infra/ directory a handy set of Python scripts that run and coordinate Cloud9 executions across a set of machines accessible via SSH through their IP addresses. Therefore, these scripts can be used both on private clusters, as well as public cloud instances (the nature of the machines is orthogonal to the scripts, as long as they are available through their IP addresses).
In this tutorial, we show how the infrastructure scripts can be used to schedule and run Cloud9 across the entire range of Coreutils.
The infrastructure scripts run the Cloud9 workers on the cluster machines, while the load balancer is run locally from where the scripts are being invoked. Therefore, you need to follow the Cloud9 installation procedure on all the machines that Cloud9 will run on. You may also want to consider setting up Cloud9 in a single place, and make the installation avaiable to the other machines via NFS. Finally, you should also make sure the testing targets (the .bc binaries) are available locally to each worker node, and that a dedicated directory for storing the experimental results is available on each of the machines.
The infrastructure scripts rely on multiple configuration files that describe various aspects of the testing setup. In this section, we show how to write such configuration files for testing the Coreutils UNIX utilities. All the configuration files reside in directories under infra/.
The infrastructure scripts assume that worker nodes will run on single or multi-core machines, and that the load balancer is invoked locally. Multi-core machines can co-locate multiple workers (which will still run independently).
You describe the cluster setup by creating a .hosts file in the hosts/ directory of the infrastructure scripts. You need to specify there the names of the machines you're using (including the local host), the number of cores available (0 for the local host), the directory where Cloud9 is deployed, the SSH user name used to connect to the machines, the directory where the logs should be stored (the directory must exist), and optionally a root directory of the testing targets. A sample configuration file is provided as a starting point.
Setup the command line arguments of the testing targets by creating a configuration file in the cmdlines/ directory. On each line, the configuration file should have an entry of the form <id>:<command line>, where the <id> is an unique name for the command line described after ":". You may use the provided coreutils.cmdlines for testing the Coreutils.
Since each Cloud9 worker node runs the sequential Klee symbolic execution engine, you can specify which Klee-specific parameters to pass to each worker by creating a corresponding configuration file in the kleecmd/ directory. You may use the provided coreutils.kcmd configuration for running the Coreutils.
Setup the file that describes the source files accounted for when computing code coverage in the coverable/ directory. You may use the provided coreutils.coverable file for running the Coreutils.
An experiment schedule describes which targets are executed on which machines, and in which order. The experiment runs in multiple iterations. During each iteration, multiple targets are being executed in parallel; at the end of an iteration, all jobs are terminated, then the next iteration follows.
You create an experiment schedule file in the exp/ directory. Each line in the file is one iteration of the experiment -- all the items on the line are executed in parallel. The items are space-separated, and have the form "<testing target id> <# workers> [<host> <# cores>]*", which describes the number of workers allocated for a testing target, and their allocation per phisical hosts. The provided coreutils-1.exp file shows how the entire Coreutils suite would be run with 1-worker Cloud9, on the sample infrastructure provided in the hosts/ directory. You can also use the provided ./gen-schedule.py script that can generate such schedule files given a host and testing targets configuration files.
Finally, you should run the ./run-experiment.py script, which takes as input the name of the configuration files that you created at the previous steps. You should not use the full names of the files, but only their base name. For instance, when specifying the coverage configuration in coverable/coreutils.coverable, you should just mention coreutils. For instance, the full command line to run Coreutils on 12-worker Cloud9, on an EPFL cluster described by epfl.hosts, for 10-minute iterations is:
./run-experiment.py -t 600 --strategy random-path,cov-opt epfl coreutils coreutils-12 coreutils coreutils
You can run ./run-experiment.py --help to see the exact format.
During or after the experiment, you can check the coverage progress by running the provided ./mine-coverage.py script. You need to specify the configuration file for the cluster, and one or more test IDs that identify the experiment. The test IDs are printed by the run-experiment.py script before the experiment starts (look for a log line saying "Using testing ID: test-xx-xx-xx-xx-xx-xx"). You can also use the "-t" parameter to get a nice tabular ASCII output.


Setting Skin Token Values
How to set the values of skin tokens using the Skin Designer module.
- Navigate to Admin > Advanced Settings > Skins.
- Go to the Skin Designer module.
- At Skin, select a skin package. This lists all skins within this package at the File field below.
- At File, select the name of the required skin.
- At Token, select a skin token. If the message "Object Selected Does Not Have Settings Defined" is displayed this means that there are no values associated with that token. In this case, reselect a new token. If the message "You Must Select A Token Setting is displayed on the Host Skins module, this indicates that one or more settings are incomplete.
- At Setting, select a setting from the options. This displays a description of this setting below.
- In the Value text box, enter the value for the setting.
-


>
Bobbie, 26
Graphic Designer! I can code your website only if we get coffee sometime lol.
Are you an angel because my world suddenly became brighter and lighter?
All I want for Channukah is you.
Even if there wasn't gravity on earth, I'd still fall for you.


 You can check for potential problems
Here is the status of your kibana instance and the plugins you have installed along with some statistics to asses potential problems.
| Plugin | Status |
| {{key}} | {{plugin.message}} |
Interval of 5 seconds, with a max history of 5 minutes.


deana's the name and coding's the game.
but seriously, i love making games. i'm strongest
in c++ and c#. however, i also have a couple of
javascript and webdev tricks up my sleeve.
but seriously, i love making games. i'm strongest
in c++ and c#. however, i also have a couple of
javascript and webdev tricks up my sleeve.
-
Coaster Challenge Mini Arcade
Worked with an interdisciplinary team to create an interactive eventhub and a 2D arcade-style game for Special Olympics Illinois’ annual Six Flags fundraiser. Team lead for game development. Heavy focus on physics-based game programming, as well as on interactive media design.
Construct II, Facebook API, HTML/CSS/JS/SVG -
FairMade Unity Webapp
A functional Unity prototype of an app allowing the user to find, mix, and match fair trade textiles from ethical distributors. Accompanying website. Created for a four-day team development challenge (ideation to launch).
Unity + C#, HTML/CSS/JS, Adobe CS6 -
Dungeon Escape
Third-person Unreal 3D Game created for a team final project in an advanced C++ course. Game allows the player to explore three levels and collect items.
Unreal Engine 4, C++, Blueprints Visual Scripting -
Relish
A 2D mini game created in pure C# code. The player takes on the role of a pickle trying to avoid certain death.
C#, Microsoft XNA, MonoGame, DirectX


This page generates simple (in terms of setup and assumptions) 4-way join optimization problems. Given the statistics and tables below, compute the join plan based on Selinger as discussed in class, the result cardinality, as well as the cost in terms of the number of pages that must be read.
Assumptions:| Join Name | Description |
|---|---|
| Hash-INL | Index nested loops using Hash Index |
| Primary-BTree-INL | Index nested loops using Primary BTree |
| Sec-BTree-INL | Index nested loops using Secondary BTree |
| NL | Nested loops |
| HashJoin | Hash Join |


Truss examples.
Basic Example
Usage of "initOn"
Usage of "listensTo" - PLAY_AFTER_RENDER
Usage of "listensTo" - KEEP_ON
Usage of "listensTo" - RE_PLAY
Usage of "resolveRenderOn", "destroy", "onStatusChange" and "onRenderComplete"
Using Truss with router
Extending Truss with truss-event-handler
Extending Truss with truss-redux-vdom (WIP)


Lending Club is a marketplacelending site. Marketplace lending crowd-funds loans by matching borrowers with willing investors. This LendingClub library makes it easy for you to see your investor account data such as the amount of free cash or the details on which loans you own. This package is a convenience wrapper for the Lending Club API so that you get get the data into R. You can learn more about the API by reading Lending Club’s documentation. Lending Club does not offer an API for borrower data.
To get started, you’ll need to supply the investor’s account number and API key. You can find the account number from the Account Summary page. The API key is located at the bottom of the Account Settings page. In the example below, the account number and API key are loaded from an .Renviron file but you can use whatever process you are comfortable to pass them to the lc_MakeCredential function. If you are going to share your code, then I recommend doing something similar to this method rather than put it directly in your code.
The lc_MakeCredential() function uses the investorID and APIkey inputs to create an S3 object. If you save this object as LC_CRED
, then the other functions in this package will find it in the global environment and you will not have to pass it as an argument to the other functions.
library(LendingClub)
investorID<- Sys.getenv("id")
APIkey <- Sys.getenv("key")
LC_CRED<- lc_MakeCredential(investorID, APIkey)
If you plan to share your code or publish to Github, you may want to save your investorID and APIkey separately so you don’t have to share them. In the example above, the variables were saved as environment variables. Alternatively, you can save them in a text file and read them in with readLines()
.
LC_CRED<- lc_MakeCredential(investorID = readLines("path_to_creds.txt")[1],
APIkey = readLines("path_to_creds.txt")[2])
Here are a few examples of other functions in the package. As mentioned above, all other functions in this package will look for the LC_CRED
object before processing the respective API calls. You can see a data.frame of the currently listed loans using the lc_ListedLoans()
function.
Another useful function to start with is lc_AccountSummary(). This returns key statistics such as the available cash, total number of notes owned, and all time total interest received. You don’t pass any inputs to the function but it will search the global environment for the LC_CRED
object.
This package is most useful for investors applying advanced filtering or algorithms to determine which loans to buy. The algorithms aren’t in scope for this package but it does enable the automation. The code below is an example of how you go about using the package. You should use care when deciding how to choose investments. A best practice is to establish a limit on how many loans you put in the order. The max is determined by the amount of available funds in your account but you could do less if you wanted.
Sudo code:
LC_CRED<- lc_MakeCredential(investorID, APIkey)
# Establish a limt on how many loans are in the order
# by determing the max amount of $25 notes you can purchase.
notequantity<- as.numeric(lc_AvailableCash()$content[2, 2]) %/% 25
loans<- lc_ListedLoans()$content$loans
# Filter, sort, or apply your model to determine where to invest.
order<- loans %>%
filter(grade %in% c("A", "B")) %>%
sort(desc(intRate)) %>%
select(id) %>%
head(notequantity)
lc_SubmitOrder(loanId= order,
amount= rep(25, notequantity),
LC_CRED= LC_CRED)


| DOSE: |
60 mg |
smoked |
DET |
(powder / crystals) |
Recently I happened to come across a rare drug - diethyltryptamine (DET). I had obtained a quantity of diethyltryptamine freebase. It was a light yellow powder determined to be quite pure by NMR analysis. The first time I tried it, I smoked 45 mg with some friends. I found this light but enjoyable. The smoke itself was a little harsh, and did not taste very good (it had the usual 'burning plastic' smell reminiscent of DMT and 5-MeO-DMT). But on the whole, smoking it was not bad. It was definitely a lot smoother than, say, snorting DPT (which I cannot do anymore, since it just ruins my sinus cavity for several days).
Next, I smoked 60 mg. This was stronger, but still not intense. It takes about a minute to come on. The come up is pretty smooth and gentle; it's not a rush. For this reason you can take your time smoking it (unlike DMT where you have to hurry to smoke it all at once because your mind gets shattered). The high was very interesting in that it was not visual at all. It was almost entirely body and mental effects, with good audio enhancement. The high was quite relaxing and mentally stimulating. I felt very frisky and talkative. I almost want to compare it to marijuana, only it was much more clean. The effects lasted about an hour, but I found that I could boost by smoking another 25 mg.
On another occasion I ate 90 mg of DET, which was nice, but again light. I think that smoking is definitely the way to go. I find DET particularly interesting in contrast to DMT and DPT.  Still, it is a nice, social drug that I recommend highly. It is quite manageable in that you could go for a walk in the park and be in total control. Do try it if you can find some.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Route Planner
Unable to connect, please refresh
Just Eat Weather Information
Current Weather Information for Dublin
Main
Humidity
Wind
☴
5 Day Forecast
5 Day Forecast (+ 12 hours)
Hide Traffic Updates
Show Traffic Updates
Tweets by aaroadwatch


Class Name
label shows name
of class.
Fully Qualified Name
check
box indicates whether displayed class name is fully qualified or not
Component Name
label shows
name of component or nothing if component's name is not set
Operator
text field shows
constructor of appropriate jemmy operator to locate component in given
container


OK this is it.  Although I told him how to tie in where there would never even be a chance to fall he didnt listen and fell 25 ft. landing on my head blowing out 3 discs in my neck and causing many bone spurs to develop since. So since then I,ve gone from vicoden to 5 vicoprophine 750s and 3 20 mgs. of oxycotin a day, along with as much herion I could get my hands on to smoke.
I,ve known of ibogaine since 1969 but never knew it cured addiction. so I decided to take a lil trip below the border to detox with ibogaine. The dr. that gave me this sacred medcine let made me wait tell all the drugs cleared my sytstem for the ibogaine to have clear brain recepters. I went into withdrawl waiting for my first dose.  You name it everything I ever heard of withdrawl I went through.
The people at the ibogaine center were full of pure love no tough love(thank god) I hurt enough already. They were absolute servents to my needs yet would not give me any of my pain killers back. The ibogaine eased the withdrawl remarkably although I was still in withdrawl. The dr. kept saying the worse is over your going to be thanking me they all do you will soon be reborn. He was right! it took a few days and a few doses but I recovered. the visions I had were beautiful.  I like Leary see no reason for any drug to be illegal (espacally in plant form) in the land of the so called free. Ibogaine has a defferent place in the world of sacred sacramental medicine............peace.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


'Two hurt' after bus crashes into car outside school in West Lothian
Emergency services rushed to the scene of the smash on Armadale's West Main Street just after 8am.
by Nicholas Keyden, https://www.dailyrecord.co.uk/authors/nicholas-keyden/Two people have reportedly been hurt after a bus crashed into a car outside a school in West Lothian .
Emergency services rushed to the scene of the smash on Armadale's West Main Street just after 8am on Friday November 22.
Scottish fire and rescue sent three appliances and a heavy rescue unit to collision, which took place just outside Armadale Academy.
Locals report two people have been injured. Their condition is not known at this time.
It is believed the bus was empty at the time and on the way to collect children at St Kentigern's Academy in Blackburn.
Police Scotland tweeted that the road has been closed while they deal with the crash.
They posted: "A89 closed at Armadale Police Station and along full stretch from Blackridge. This is due to a road traffic collision. Thank you for your patience."
A Scottish Fire and Rescue spokesperson said: "We were called to the scene of a collision between a bus and a car outside Armadale Academy at 8.01am.
"Thee appliances and a heavy rescue unit were mobilised."