renamed cython_types.pyx python_types.py to types.py[x], switching between them is setup.py's job

moved help texts to over.docs
wip over.app implementation
This commit is contained in:
Martinez 2016-05-13 16:11:04 +02:00
parent a4665ae277
commit 031f7627b8
5 changed files with 137 additions and 625 deletions

32
over/types.py Normal file
View file

@ -0,0 +1,32 @@
#! /usr/bin/env python3
# encoding: utf-8
from collections import OrderedDict
# --------------------------------------------------
class ndict(OrderedDict):
"""
An OrderedDict subclass whose keys are exposed as attributes.
>>> d = ndict()
>>> d.alpha = 1
>>> d["alpha"]
1
>>> d["beta"] = 42
>>> d.beta
42
>>> d
{"alpha": 1, "beta": 42}
"""
def __getattr__(self, name):
if name in self:
return self[name]
elif name.replace("_", "-") in self:
return self[name.replace("_", "-")]
else:
raise AttributeError('"ndict" object has no attribute "%s"' %(name))
def __setattr__(self, name, value):
self[name] = value