Metadata-Version: 1.1
Name: collections-extended
Version: 1.0.2
Summary: Extra Python Collections - bags (multisets) and setlists (ordered sets)
Home-page: http://collections-extended.lenzm.net/
Author: Michael Lenzen
Author-email: m.lenzen@gmail.com
License: Apache License, Version 2.0
Description: README
        ######
        
        .. image:: https://travis-ci.org/mlenzen/collections-extended.svg?branch=master
        	:target: https://travis-ci.org/mlenzen/collections-extended
        	:alt: Build Status
        
        
        .. image:: https://coveralls.io/repos/mlenzen/collections-extended/badge.svg?branch=master
        	:target: https://coveralls.io/r/mlenzen/collections-extended?branch=master
        	:alt: Coverage
        
        Documentation: http://collections-extended.lenzm.net/
        
        GitHub: https://github.com/mlenzen/collections-extended
        
        PyPI: https://pypi.python.org/pypi/collections-extended
        
        Overview
        ========
        
        ``collections_extended`` is a Python module providing
        a ``bag`` class, AKA **multiset**,
        a ``setlist`` class, which is a **unique list** or **ordered set**,
        a ``bijection`` class and ``RangeMap`` which is a mapping from ranges to values.
        There are also frozen (hashable) varieties of bags and setlists.
        
        Tested against Python 2.6, 2.7, 3.3, 3.4, 3.5, 3.6, 3.7, PyPy & PyPy3.
        
        Getting Started
        ===============
        
        .. code-block:: python
        
        	>>> from collections_extended import bag, setlist, bijection, RangeMap
        	>>> from datetime import date
        	>>> b = bag('abracadabra')
        	>>> b.count('a')
        	5
        	>>> b.remove('a')
        	>>> b.count('a')
        	4
        	>>> 'a' in b
        	True
        	>>> b.count('d')
        	1
        	>>> b.remove('d')
        	>>> b.count('d')
        	0
        	>>> 'd' in b
        	False
        
        	>>> sl = setlist('abracadabra')
        	>>> sl
        	setlist(('a', 'b', 'r', 'c', 'd'))
        	>>> sl[3]
        	'c'
        	>>> sl[-1]
        	'd'
        	>>> 'r' in sl  # testing for inclusion is fast
        	True
        	>>> sl.index('d')  # so is finding the index of an element
        	4
        	>>> sl.insert(1, 'd')  # inserting an element already in raises a ValueError
        	Traceback (most recent call last):
        	...
        		raise ValueError
        	ValueError
        	>>> sl.index('d')
        	4
        
        	>>> bij = bijection({'a': 1, 'b': 2, 'c': 3})
        	>>> bij.inverse[2]
        	'b'
        	>>> bij['a'] = 2
        	>>> bij == bijection({'a': 2, 'c': 3})
        	True
        	>>> bij.inverse[1] = 'a'
        	>>> bij == bijection({'a': 1, 'c': 3})
        	True
        
        	>>> us_presidents = RangeMap()
        	>>> us_presidents[date(1993, 1, 20):date(2001, 1, 20)] = 'Bill Clinton'
        	>>> us_presidents[date(2001, 1, 20):date(2009, 1, 20)] = 'George W. Bush'
        	>>> us_presidents[date(2009, 1, 20):] = 'Barack Obama'
        	>>> us_presidents[date(1995, 5, 10)]
        	'Bill Clinton'
        	>>> us_presidents[date(2001, 1, 20)]
        	'George W. Bush'
        	>>> us_presidents[date(2021, 3, 1)]
        	'Barack Obama'
        	>>> us_presidents[date(2017, 1, 20):] = 'Someone New'
        	>>> us_presidents[date(2021, 3, 1)]
        	'Someone New'
        
        Installation
        ============
        
        ``pip install collections-extended``
        
        Usage
        =====
        	``from collections_extended import bag, frozenbag, setlist, frozensetlist, bijection``
        
        Classes
        =======
        There are six new classes provided:
        
        Bags
        ----
        bag
        	This is a bag AKA multiset.
        frozenbag
        	This is a frozen (hashable) version of a bag.
        
        Setlists
        --------
        setlist
        	An ordered set or a list of unique elements depending on how you look at it.
        frozensetlist
        	This is a frozen (hashable) version of a setlist.
        
        Mappings
        --------
        bijection
        	A one-to-one mapping.
        RangeMap
        	A mapping from ranges (of numbers/dates/etc)
        
        :Author: Michael Lenzen
        :Copyright: 2018 Michael Lenzen
        :License: Apache License, Version 2.0
        :Project Homepage: https://github.com/mlenzen/collections-extended
        
Keywords: collections,bag,multiset,setlist,ordered set,unique list
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
