# HG changeset patch # User Jeff Hammel # Date 1380053458 25200 # Node ID 4063bbeaa7d4277c3948b48caf3179375014f79f # Parent 37f8bc525888f9fec898037ca9c7d1676f8319ed initial commit diff -r 37f8bc525888 -r 4063bbeaa7d4 python/bind.py --- a/python/bind.py Tue Sep 24 12:32:50 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#!/usr/bin/env python - -""" -illlustrate e.g. method bind for python -""" - -class Foo(object): - - @classmethod - def create(cls): - """create an instance and bind a method onto foo""" - class decorator(object): - def __init__(self, function): - self.function = function - def __call__(self): - print "Bar!" - return self.function() - - instance = cls() - instance.foo = decorator(instance.foo) - return instance - - def foo(self): - print "Foo!" - -if __name__ == '__main__': - foo = Foo.create() - foo.foo() diff -r 37f8bc525888 -r 4063bbeaa7d4 python/example/bind.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/example/bind.py Tue Sep 24 13:10:58 2013 -0700 @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +""" +illlustrate e.g. method bind for python +""" + +class Foo(object): + + @classmethod + def create(cls): + """create an instance and bind a method onto foo""" + class decorator(object): + def __init__(self, function): + self.function = function + def __call__(self): + print "Bar!" + return self.function() + + instance = cls() + instance.foo = decorator(instance.foo) + return instance + + def foo(self): + print "Foo!" + +if __name__ == '__main__': + foo = Foo.create() + foo.foo() diff -r 37f8bc525888 -r 4063bbeaa7d4 python/setup_repo.py --- a/python/setup_repo.py Tue Sep 24 12:32:50 2013 -0700 +++ b/python/setup_repo.py Tue Sep 24 13:10:58 2013 -0700 @@ -38,11 +38,11 @@ return return subprocess.check_output(*args, **kwargs) -def init_repo(directory): +def init_repo(directory, message): """setup repository""" call(['hg', 'init', directory]) call(['hg', 'add', '-R', directory]) - call(['hg', 'commit', '-m', options.message, '-R', directory]) + call(['hg', 'commit', '-m', message, '-R', directory]) def write_hgrc(directory, host, repo, name): """write hgrc file""" @@ -130,7 +130,7 @@ if options.remote_only: assert options.remote_url else: - init_repo(directory) + init_repo(directory, options.message) # setup remote, if specified name = os.path.basename(directory)