diff - Python watchdog: what is the 'empty' directory snapshot? -
watchdog pretty awesome @ letting take recursive snapshots of particular directory. lets compare snapshots function called directorysnapshotdiff.
my program watches directory evolves in real-time, , has been made consume output of function. reasonable.
let's take snapshots s1, s2...
of file system @ arbitrary times. compare last snapshot latest 1 create difference objects.
d1 d2 # detected differences (my app eats these up) s1 -> s2 -> s3 # evolving states (snapshots taken) of file system. t=0 -------------------> time
omnomnomnom. that's great.
but, first time run app, need know current state. want pretend there null state s0
, transitions s1
; can diff format. i.e.
d0 # want create 'bootstrapping' difference set (s0) -> s1 # assume s0 empty snapshot: reports addition
how do that?
the motivation behind is: love functional programming. instead of writing code consume snapshots , snapshot diffs (both considerable work) keep reuse high , code minimal.
for versions of python >= 2.6 watchdog uses it's orderedset.
modify fatuhoku's paths function follows;
@property def paths(self): if sys.version_info >= (2, 6, 0): return watchdog.utils.bricks.orderedset() return set()
Comments
Post a Comment