emlib¶
Optional support classes for EmPy.
- class emlib.AbstractHook(interp=None)¶
An abstract base class for implementing hooks. All hook invocations are not present. (Use this if you plan to systematically handle all calls with something like __getattr__.)
- class emlib.BufferedFilter¶
A buffered filter is one that doesn’t modify the source data sent to the sink, but instead holds it for a time. The standard variety only sends the data along when it receives a flush command.
- flush()¶
The flush method can be overridden.
- write(data)¶
The write method must be implemented.
- class emlib.Callback(interp=None)¶
A root class for any callback utilities.
- class emlib.ConcreteFilter¶
A concrete filter has a single sink.
- attach(filter)¶
Attach a filter to this one.
- close()¶
Close the filter. Do an explicit flush first, then close the sink.
- detach()¶
Detach a filter from its sink.
- flush()¶
The flush method can be overridden.
- follow()¶
Return the next filter/file-like object in the sequence, or None.
- isAttached()¶
Is a filter/file already attached to this one?
- last()¶
Find the last filter in this chain.
- class emlib.Container(interp=None)¶
A container contains a reference to an interpreter. This is the base class of several support classes.
- class emlib.DelimitedFilter(delimiter)¶
A delimited filter only lets data through when it sees whole lines.
- write(data)¶
The write method must be implemented.
- class emlib.Details(useSanitization=False)¶
Gather details on a running Python system for debugging purposes.
- accumulate(prefix, suffixes, object, name, args=None, attr=None, func=None, kwargs=None, delim='/')¶
Accumulate the results of a method or attribute in a dictionary. If the argument is None, just return the attribute; if not, treat it as a function and call it with the args and kwargs. If attr is not None, access that named attribute on the result before returning. If func is not None, pass the result through the function before storing.
- checkPythonImplementation(choices)¶
Check the Python implementation against the sequence of choices.
- checkPythonVersion(minimum, maximum=None, closed=True)¶
Check whether or not this Python version is greater than or equal to the minimum, and if present, less than or equal to the maximum.
- classify(version)¶
Classify a release by version string.
- collect(level)¶
Collect details.
- get(prefix, suffix, default=None)¶
Get the value for this key.
- getBasicDetails()¶
Collect basic details.
- getContext()¶
Get the context that this interpreter is running in as a string. Note: This is not always possible. Cached.
- getFramework()¶
Get the framework and version this interpreter is running under as a 2-tuple, or None. Cached.
- getMachineType()¶
Get the machine name. Cached.
- getOSName()¶
Get a nice name for the OS this interpreter is running on. Cached.
- getPlatformDetails()¶
Collect details about this platform. Use the platform module if available when the flag is set to true.
- getPythonDetails()¶
Collect details about this interpreter. Use the platform module if available when the flag is set to true.
- getPythonImplementation()¶
Get the name of this implementation. Cached.
- getPythonVersion()¶
Get the version of Python. Cached.
- getReleaseDetails(system=None)¶
Collect details about the given system release, or the running one if None.
- getReleaseDetails_Darwin()¶
Collect details about the Darwin release.
- getReleaseDetails_Linux()¶
Collect details about the Linux release.
- getReleaseDetails_Windows()¶
Collect details about the Windows release.
- getSystemDetails()¶
Collect details about the system settings on this interpreter.
- getSystemName()¶
Get a nice name for the system this interpreter is running on. Cached.
- has(prefix, suffix)¶
Is this key present?
- key(prefix, suffix)¶
Make a key out of this prefix and suffix.
- sanitize(suffix)¶
Normalize this key suffix if necessary.
- set(prefix, suffix, value)¶
Set a key/value pair.
- show(level=2, prelim='', postlim='', file=None)¶
Show details.
- transformName(value, pairs, defaultFormat='[%s]', blank='?')¶
Find the prefix of the value in the pairs and return the resulting name.
- wrap(prefix, suffixes, func)¶
Replace an existing entry by passing it through a function.
- class emlib.Document(ident, filename)¶
A representation of an individual EmPy document, as used by a processor.
- class emlib.DroppingFilter(droppings)¶
A filter which drops any chunks that match the provided list of chunks to ignore.
- write(data)¶
The write method must be implemented.
- class emlib.Filter¶
An abstract filter.
- attach(filter)¶
Attach a filter to this one.
- close()¶
The close method must be implemented.
- detach()¶
Detach a filter from its sink.
- flush()¶
The flush method can be overridden.
- follow()¶
Return the next filter/file-like object in the sequence, or None.
- isAttached()¶
Is a filter/file already attached to this one?
- last()¶
Find the last filter in this chain.
- write(data)¶
The write method must be implemented.
- writelines(lines)¶
Write lines. This should not need to be overriden for most filters.
- class emlib.Finalizer(interp=None)¶
A root class for a finalizer.
- class emlib.FullyBufferedFilter¶
A maximally-buffered filter only lets its data through on the final close. It ignores flushes.
- close()¶
Close the filter. Do an explicit flush first, then close the sink.
- flush()¶
The flush method can be overridden.
- class emlib.FunctionFilter(function)¶
A filter that works simply by pumping its input through a function which maps strings into strings.
- write(data)¶
The write method must be implemented.
- class emlib.Handler(interp=None)¶
A root class for any error handler.
- class emlib.Hook(interp=None)¶
The base class for implementing hooks. All hook invocations are present and no-ops.
- class emlib.IdentityFilter¶
A filter which just sends any output straight through to its sink.
- write(data)¶
The write method must be implemented.
- class emlib.IndentFilter(indent)¶
Automatically indent a fixed number of spaces after every newline.
- write(data)¶
The write method must be implemented.
- class emlib.LineDelimitedFilter(delimiter='\n')¶
A line-delimited filter only lets data through when it sees whole lines.
- write(data)¶
The write method must be implemented.
- class emlib.NullFilter¶
A filter that never sends any output to its sink.
- attach(filter)¶
Attach a filter to this one.
- close()¶
The close method must be implemented.
- detach()¶
Detach a filter from its sink.
- follow()¶
Return the next filter/file-like object in the sequence, or None.
- isAttached()¶
Is a filter/file already attached to this one?
- write(data)¶
The write method must be implemented.
- class emlib.Processor(config, factory=<class 'emlib.Document'>)¶
An entity which is capable of processing a hierarchy of EmPy files and building a dictionary of document objects associated with them describing their significator contents.
- class emlib.SizeBufferedFilter(bufferSize=16384)¶
A size-buffered filter only in fixed size chunks (excepting the final chunk).
- write(data)¶
The write method must be implemented.