/usr/lib/python2.7/dist-packages/manuel/isolation.py is in python-manuel 1.8.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | import re
import manuel
import textwrap
RESET = re.compile(r'^\.\.\s*reset-globs\s*$', re.MULTILINE)
CAPTURE = re.compile(r'^\.\.\s*capture-globs\s*$', re.MULTILINE)
baseline = {}
class Reset(object):
pass
def find_reset(document):
for region in document.find_regions(RESET):
document.claim_region(region)
region.parsed = Reset()
def execute_reset(region, document, globs):
if not isinstance(region.parsed, Reset):
return
globs.clear()
globs.update(baseline)
class Capture(object):
pass
def find_baseline(document):
# clear the baseline globs at the begining of a run (a bit of a hack)
baseline.clear()
for region in document.find_regions(CAPTURE):
document.claim_region(region)
region.parsed = Capture()
def execute_baseline(region, document, globs):
if not isinstance(region.parsed, Capture):
return
baseline.clear()
baseline.update(globs)
class Manuel(manuel.Manuel):
def __init__(self):
manuel.Manuel.__init__(self, [find_reset, find_baseline],
[execute_reset, execute_baseline])
|