Mercurial > hg > silvermirror
diff silvermirror/interface.py @ 1:9b139702a8f9
use a real backend architecture with an inteface and vastly simplify unify.py
author | k0s <k0scist@gmail.com> |
---|---|
date | Sat, 26 Sep 2009 23:36:42 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/silvermirror/interface.py Sat Sep 26 23:36:42 2009 -0400 @@ -0,0 +1,55 @@ +#!/usr/bin/env python +""" +interface for Reflector backends +""" + +def notimplemented(func): + """ + mark a function as not implemented + TODO: calling should raise a NotImplementedError + """ + func.notimplemented = True + return func + +class Reflector(object): + + def __init__(self): + pass + + ### API + + @notimplemented + def sync(self): + """ + synchronize + """ + +### for testing notimplemented decorator + +class Foo(object): + + @notimplemented + def bar(self): + "stufff" + + @notimplemented + def fleem(self): + pass + + @notimplemented + def foox(self): + pass + +class Bar(Foo): + + def bar(self): + return 1 + + @notimplemented + def fleem(self): + pass + +if __name__ == '__main__': + foo = Foo() + bar = Bar() + import pdb; pdb.set_trace()