Home | Trees | Indices | Help |
|
---|
|
Various helpers that didn't fit into any other xTricks.
Classes | |
NotInstalledModuleStub A stub that raises some more or less descriptive error on attribute access. |
|
RSTExtensions a register for local RST extensions. |
|
Undefined a sentinel for all kinds of undefined values. |
|
QuotedName A string-like thing basically representing SQL delimited identifiers. |
|
StreamBuffer a buffer that takes data in arbitrary chunks and returns them in chops of chunkSize bytes. |
|
CaseSemisensitiveDict A dictionary allowing case-insensitive access to its content. |
Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Variables | |
BIBCODE_PATTERN = re.compile(r'
|
|
__package__ =
|
Function Details |
returns true if we think that the string s is a bibcode. This is based on matching against BIBCODE_PATTERN. |
yields items of seq in groups n elements. If len(seq)%n!=0, the last elements are discarded. >>> list(grouped(2, range(5))) [(0, 1), (2, 3)] >>> list(grouped(3, range(9))) [(0, 1, 2), (3, 4, 5), (6, 7, 8)] |
returns the first value of key in the web argument-like object args. args is a dictionary mapping keys to lists of values. If key is present, the first element of the list is returned; else, or if the list is empty, default if given. If not, a Validation error for the requested column is raised. Finally, if args[key] is neither list nor tuple (in an ininstance sense), it is returned unchanged. >>> getfirst({'x': [1,2,3]}, 'x') 1 >>> getfirst({'x': []}, 'x') Traceback (most recent call last): ValidationError: Field x: Missing mandatory parameter x >>> getfirst({'x': []}, 'y') Traceback (most recent call last): ValidationError: Field y: Missing mandatory parameter y >>> print(getfirst({'x': []}, 'y', None)) None >>> getfirst({'x': 'abc'}, 'x') 'abc' |
sends an eventName to the DC event dispatcher. If no event dispatcher is available, do nothing. The base.ui object that DaCHS uses for event dispatching is only available to sub-packages above base. Other code should not use or need it under normal circumstances, but if it does, it can use this. All other code should use base.ui.notify<eventName>(*args) directly. |
logs the mutation of the currently handled exception to exc. This just does a notifyExceptionMutation using sendUIEvent; it should only be used by code at or below base. |
reads a "fortran record" from f and returns the payload. A "fortran record" comes from an unformatted file and has a 4-byte payload length before and after the payload. Native endianess is assumed here. If the two length specs do not match, a ValueError is raised. |
iterates over the fortran records in f. For details, see getFortranRec. |
returns the content of url, from a cache if possible. Of course, you only want to use this if there's some external guarantee that the resource behing url doesn't change. No expiry mechanism is present here. |
returns HTML and a string with warnings for a piece of ReStructured text. source can be a unicode string or a byte string in utf-8. userOverrides will be added to the overrides argument of docutils' core.publish_parts. |
returns HTML for a piece of ReStructured text. source can be a unicode string or a byte string in utf-8. userOverrides will be added to the overrides argument of docutils' core.publish_parts. |
a context manager that serializes pyparsing grammar compilation and manages its whitespace chars. We need different whitespace definitions in some parts of DaCHS. (The default used to be " \t" for a while, so this is what things get reset to). Since whitespace apparently can only be set globally for pyparsing, we provide this c.m. Since it is possible that grammars will be compiled in threads (e.g., as a side effect of getRD), this is protected by a lock. This, in turn, means that this can potentially block for a fairly long time. Bottom line: When compiling pyparsing grammars, *always* set the whitespace chars explicitely, and do it through this c.m.
|
returns a dictionary for a "key-value line". key-value lines represent string-valued dictionaries following postgres libpq/dsn (see PQconnectdb docs; it's keyword=value, whitespace-separated, with whitespace allowed in values through single quoting, and backslash-escaping |
serialized a dictionary to a key-value line. See parseKVLine for details. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu May 2 07:29:09 2019 | http://epydoc.sourceforge.net |