skip to navigation
skip to content

reusables 0.2.0

Commonly Consumed Code Commodities

Latest Version: 0.3.0

Commonly Consumed Code Commodities


The reusables library is a reference of python functions and classes that programmers may find themselves often recreating.


import reusables

# {'Section 1': {'key 1': 'value 1', 'key2': 'Value2'}, 'Section 2': {}}

reusables.safe_path('/home/user/eViL User\0\\/newdir$^&*/new^%file.txt')
# '/home/user/eViL User__/newdir____/new__file.txt'

# ['/home/user/background.jpg', '/home/user/private.png']


Also included is a Namespace class, similar to Bunch but designed so that dictionaries are recursively made into namespaces, and can be treated as either a dict or a namespace when accessed.

from reusables import Namespace

my_breakfast = {"spam" : {"eggs": {"sausage": {"bacon": "yummy"}}}}
namespace_breakfast = Namespace(**my_breakfast)

# yummy

# yummy

# "{'sausage': {'bacon': 'yummy'}}"

# {'bacon': 'yummy'}

# "<Namespace: {'spam': {'eggs': {'sausage': {'...>"

Additional Info

This does not claim to provide the most accurate, fastest or most ‘pythonic’ way to implement these useful snippets, this is simply designed for easy reference. Any contributions that would help add functionality or improve existing code is warmly welcomed!

Copyright (c) 2014 - Chris Griffith - MIT License

File Type Py Version Uploaded on Size
reusables-0.2.0-py2-none-any.whl (md5) Python Wheel 2.7 2014-05-15 15KB
reusables-0.2.0-py2.6.egg (md5) Python Egg 2.6 2014-05-15 31KB
reusables-0.2.0-py2.7.egg (md5) Python Egg 2.7 2014-05-15 31KB
reusables-0.2.0-py3-none-any.whl (md5) Python Wheel 3.4 2014-05-15 15KB
reusables-0.2.0-py3.2.egg (md5) Python Egg 3.2 2014-05-15 31KB
reusables-0.2.0-py3.3.egg (md5) Python Egg 3.3 2014-05-15 32KB
reusables-0.2.0-py3.4.egg (md5) Python Egg 3.4 2014-05-15 32KB
reusables-0.2.0.tar.gz (md5) Source 2014-05-15 13KB
  • Downloads (All Versions):
  • 0 downloads in the last day
  • 8 downloads in the last week
  • 415 downloads in the last month