Skip to content
Browse files

switch __init__.py to 4 spaces

  • Loading branch information...
1 parent 7471379 commit 1f9a35b699e6acc0832eb9a72867014e31f03ab1 @mutantmonkey committed May 30, 2012
Showing with 42 additions and 42 deletions.
  1. +42 −42 __init__.py
View
84 __init__.py
@@ -10,58 +10,58 @@
import sys, os, time, threading, signal
class Watcher(object):
- # Cf. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496735
- def __init__(self):
- self.child = os.fork()
- if self.child != 0:
- signal.signal(signal.SIGTERM, self.sig_term)
- self.watch()
+ # Cf. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496735
+ def __init__(self):
+ self.child = os.fork()
+ if self.child != 0:
+ signal.signal(signal.SIGTERM, self.sig_term)
+ self.watch()
- def watch(self):
- try: os.wait()
- except KeyboardInterrupt:
- self.kill()
- sys.exit()
+ def watch(self):
+ try: os.wait()
+ except KeyboardInterrupt:
+ self.kill()
+ sys.exit()
- def kill(self):
- try: os.kill(self.child, signal.SIGKILL)
- except OSError: pass
+ def kill(self):
+ try: os.kill(self.child, signal.SIGKILL)
+ except OSError: pass
- def sig_term(self, signum, frame):
- self.kill()
- sys.exit()
+ def sig_term(self, signum, frame):
+ self.kill()
+ sys.exit()
def run_phenny(config):
- if hasattr(config, 'delay'):
- delay = config.delay
- else: delay = 20
+ if hasattr(config, 'delay'):
+ delay = config.delay
+ else: delay = 20
- def connect(config):
- import bot
- p = bot.Phenny(config)
- p.run(config.host, config.port, config.ssl, config.ipv6)
+ def connect(config):
+ import bot
+ p = bot.Phenny(config)
+ p.run(config.host, config.port, config.ssl, config.ipv6)
- try: Watcher()
- except Exception as e:
- print('Warning:', e, '(in __init__.py)', file=sys.stderr)
+ try: Watcher()
+ except Exception as e:
+ print('Warning:', e, '(in __init__.py)', file=sys.stderr)
- while True:
- try: connect(config)
- except KeyboardInterrupt:
- sys.exit()
+ while True:
+ try: connect(config)
+ except KeyboardInterrupt:
+ sys.exit()
- if not isinstance(delay, int):
- break
+ if not isinstance(delay, int):
+ break
- warning = 'Warning: Disconnected. Reconnecting in %s seconds...' % delay
- print(warning, file=sys.stderr)
- time.sleep(delay)
+ warning = 'Warning: Disconnected. Reconnecting in %s seconds...' % delay
+ print(warning, file=sys.stderr)
+ time.sleep(delay)
def run(config):
- t = threading.Thread(target=run_phenny, args=(config,))
- if hasattr(t, 'run'):
- t.run()
- else: t.start()
+ t = threading.Thread(target=run_phenny, args=(config,))
+ if hasattr(t, 'run'):
+ t.run()
+ else: t.start()
-if __name__ == '__main__':
- print(__doc__)
+if __name__ == '__main__':
+ print(__doc__)

0 comments on commit 1f9a35b

Please sign in to comment.
Something went wrong with that request. Please try again.