inotify: Coding Style: name classes in lowercase.
--- a/hgext/inotify/__init__.py Fri May 08 16:28:52 2009 +0900
+++ b/hgext/inotify/__init__.py Mon May 11 08:19:28 2009 +0900
@@ -25,7 +25,7 @@
class service:
def init(self):
try:
- self.master = server.Master(ui, repo, timeout)
+ self.master = server.master(ui, repo, timeout)
except server.AlreadyStartedException, inst:
raise util.Abort(str(inst))
--- a/hgext/inotify/linux/watcher.py Fri May 08 16:28:52 2009 +0900
+++ b/hgext/inotify/linux/watcher.py Mon May 11 08:19:28 2009 +0900
@@ -11,12 +11,12 @@
The inotify subsystem provides an efficient mechanism for file status
monitoring and change notification.
-The Watcher class hides the low-level details of the inotify
+The watcher class hides the low-level details of the inotify
interface, and provides a Pythonic wrapper around it. It generates
events that provide somewhat more information than raw inotify makes
available.
-The AutoWatcher class is more useful, as it automatically watches
+The autowatcher class is more useful, as it automatically watches
newly-created directories on your behalf.'''
__author__ = "Bryan O'Sullivan <bos@serpentine.com>"
@@ -29,7 +29,7 @@
import termios
-class Event(object):
+class event(object):
'''Derived inotify event class.
The following fields are available:
@@ -72,7 +72,7 @@
def __repr__(self):
r = repr(self.raw)
- return 'Event(path=' + repr(self.path) + ', ' + r[r.find('(')+1:]
+ return 'event(path=' + repr(self.path) + ', ' + r[r.find('(')+1:]
_event_props = {
@@ -100,12 +100,12 @@
return self.mask & mask
getter.__name__ = k
getter.__doc__ = v
- setattr(Event, k, property(getter, doc=v))
+ setattr(event, k, property(getter, doc=v))
del _event_props
-class Watcher(object):
+class watcher(object):
'''Provide a Pythonic interface to the low-level inotify API.
Also adds derived information to each event that is not available
@@ -177,7 +177,7 @@
events = []
for evt in inotify.read(self.fd, bufsize):
- events.append(Event(evt, self._wds[evt.wd][0]))
+ events.append(event(evt, self._wds[evt.wd][0]))
if evt.mask & inotify.IN_IGNORED:
self._remove(evt.wd)
elif evt.mask & inotify.IN_UNMOUNT:
@@ -265,8 +265,8 @@
return [w for w in self.add_iter(path, mask, onerror)]
-class AutoWatcher(Watcher):
- '''Watcher class that automatically watches newly created directories.'''
+class autowatcher(watcher):
+ '''watcher class that automatically watches newly created directories.'''
__slots__ = (
'addfilter',
@@ -284,13 +284,13 @@
True, the directory will be watched if it still exists,
otherwise, it will beb skipped.'''
- super(AutoWatcher, self).__init__()
+ super(autowatcher, self).__init__()
self.addfilter = addfilter
_dir_create_mask = inotify.IN_ISDIR | inotify.IN_CREATE
def read(self, bufsize=None):
- events = super(AutoWatcher, self).read(bufsize)
+ events = super(autowatcher, self).read(bufsize)
for evt in events:
if evt.mask & self._dir_create_mask == self._dir_create_mask:
if self.addfilter is None or self.addfilter(evt):
@@ -305,7 +305,7 @@
return events
-class Threshold(object):
+class threshold(object):
'''Class that indicates whether a file descriptor has reached a
threshold of readable bytes available.
--- a/hgext/inotify/server.py Fri May 08 16:28:52 2009 +0900
+++ b/hgext/inotify/server.py Mon May 11 08:19:28 2009 +0900
@@ -113,7 +113,7 @@
raise util.Abort(_('cannot watch %s until inotify watch limit is raised')
% repo.root)
-class RepoWatcher(object):
+class repowatcher(object):
poll_events = select.POLLIN
statuskeys = 'almr!?'
mask = (
@@ -136,11 +136,11 @@
self.timeout = None
self.master = master
try:
- self.watcher = watcher.Watcher()
+ self.watcher = watcher.watcher()
except OSError, err:
raise util.Abort(_('inotify service not available: %s') %
err.strerror)
- self.threshold = watcher.Threshold(self.watcher)
+ self.threshold = watcher.threshold(self.watcher)
self.registered = True
self.fileno = self.watcher.fileno
@@ -542,7 +542,7 @@
def shutdown(self):
self.watcher.close()
-class Server(object):
+class server(object):
poll_events = select.POLLIN
def __init__(self, ui, repo, repowatcher, timeout):
@@ -658,13 +658,13 @@
if err.errno != errno.ENOENT:
raise
-class Master(object):
+class master(object):
def __init__(self, ui, repo, timeout=None):
self.ui = ui
self.repo = repo
self.poll = select.poll()
- self.repowatcher = RepoWatcher(ui, repo, self)
- self.server = Server(ui, repo, self.repowatcher, timeout)
+ self.repowatcher = repowatcher(ui, repo, self)
+ self.server = server(ui, repo, self.repowatcher, timeout)
self.table = {}
for obj in (self.repowatcher, self.server):
fd = obj.fileno()
@@ -727,7 +727,7 @@
except OSError:
pass
- m = Master(ui, repo)
+ m = master(ui, repo)
sys.stdout.flush()
sys.stderr.flush()