lakesuperior package¶
-
lakesuperior.basedir= '/home/docs/checkouts/readthedocs.org/user_builds/lakesuperior/envs/development/lib/python3.6/site-packages/lakesuperior-1.0.0a22-py3.6-linux-x86_64.egg/lakesuperior'¶ Base directory for the module.
This can be used by modules looking for configuration and data files to be referenced or copied with a known path relative to the package root.
Return type: str
-
lakesuperior.env= <lakesuperior.Env object>¶ A pox on “globals are evil”.
All-purpose bucket for storing global variables. Different environments (e.g. webapp, test suite) put the appropriate value in it. The most important values to be stored are app_conf (either from lakesuperior.config_parser.config or lakesuperior.config_parser.test_config) and app_globals (obtained by an instance of lakesuperior.globals.AppGlobals).
e.g.:
>>> from lakesuperior.config_parser import config >>> from lakesuperior.globals import AppGlobals >>> from lakesuperior import env >>> env.app_globals = AppGlobals(config)
This is automated in non-test environments by importing lakesuperior.env_setup.
Return type: Object
-
lakesuperior.thread_env= <_thread._local object>¶ Thread-local environment.
This is used to store thread-specific variables such as start/end request timestamps.
Return type: threading.local
Subpackages¶
- lakesuperior.api package
- lakesuperior.cy_include package
- lakesuperior.dictionaries package
- lakesuperior.endpoints package
- lakesuperior.messaging package
- lakesuperior.model package
- lakesuperior.store package
- lakesuperior.util package
- lakesuperior.wsgi package
Submodules¶
lakesuperior.app module¶
lakesuperior.config_parser module¶
-
lakesuperior.config_parser.default_config_dir= '/home/docs/checkouts/readthedocs.org/user_builds/lakesuperior/envs/development/lib/python3.6/site-packages/lakesuperior-1.0.0a22-py3.6-linux-x86_64.egg/lakesuperior/etc.defaults'¶ Default configuration directory.
This value falls back to the provided
etc.defaultsdirectory if theFCREPO_CONFIG_DIRenvironment variable is not set.This value can still be overridden by custom applications by passing the
config_dirvalue toparse_config()explicitly.
-
lakesuperior.config_parser.parse_config(config_dir=None)[source]¶ Parse configuration from a directory.
This is normally called by the standard endpoints (
lsup_admin, web server, etc.) or by a Python client by importinglakesuperior.env_setupbut an application using a non-default configuration may specify an alternative configuration directory.The directory must have the same structure as the one provided in
etc.defaults.Parameters: config_dir – Location on the filesystem of the configuration directory. The default is set by the FCREPO_CONFIG_DIRenvironment variable or, if this is not set, theetc.defaultsstock directory.
lakesuperior.env_setup module¶
Default configuration.
Import this module to initialize the configuration for a production setup:
>>> import lakesuperior.env_setup
Will load the default configuration.
lakesuperior.exceptions module¶
Put all exceptions here.
-
exception
lakesuperior.exceptions.ChecksumValidationError(uid, prov_cksum, calc_cksum, msg=None)[source]¶ Bases:
lakesuperior.exceptions.ResourceErrorRaised in an attempt to create a resource a URI that already exists and is not supposed to.
This usually surfaces at the HTTP level as a 409.
-
exception
lakesuperior.exceptions.IncompatibleLdpTypeError(uid, mimetype, msg=None)[source]¶ Bases:
lakesuperior.exceptions.ResourceErrorRaised when a LDP-NR resource is PUT in place of a LDP-RS and vice versa.
This usually surfaces at the HTTP level as a 415.
-
exception
lakesuperior.exceptions.IndigestibleError(uid, msg=None)[source]¶ Bases:
lakesuperior.exceptions.ResourceErrorRaised when an unsupported digest algorithm is requested.
-
exception
lakesuperior.exceptions.InvalidResourceError(uid, msg=None)[source]¶ Bases:
lakesuperior.exceptions.ResourceErrorRaised when an invalid resource is found.
This usually surfaces at the HTTP level as a 409 or other error.
-
exception
lakesuperior.exceptions.InvalidTripleError(t)[source]¶ Bases:
RuntimeErrorRaised when a triple in a delta is not valid.
This does not necessarily that it is not valid RDF, but rather that it may not be valid for the context it is meant to be utilized.
-
exception
lakesuperior.exceptions.PathSegmentError(uid, msg=None)[source]¶ Bases:
lakesuperior.exceptions.ResourceErrorRaised when a LDP-NR resource is a path segment.
This may be an expected result and may be handled to return a 200.
-
exception
lakesuperior.exceptions.RefIntViolationError(o)[source]¶ Bases:
RuntimeErrorRaised when a provided data set has a link to a non-existing repository resource. With some setups this is handled silently, with a strict setting it raises this exception that should return a 412 HTTP code.
-
exception
lakesuperior.exceptions.ResourceError(uid, msg=None)[source]¶ Bases:
RuntimeErrorRaised in an attempt to create a resource a URI that already exists and is not supposed to.
This usually surfaces at the HTTP level as a 409.
-
exception
lakesuperior.exceptions.ResourceExistsError(uid, msg=None)[source]¶ Bases:
lakesuperior.exceptions.ResourceErrorRaised in an attempt to create a resource a URI that already exists and is not supposed to.
This usually surfaces at the HTTP level as a 409.
-
exception
lakesuperior.exceptions.ResourceNotExistsError(uid, msg=None)[source]¶ Bases:
lakesuperior.exceptions.ResourceErrorRaised in an attempt to create a resource a URN that does not exist and is supposed to.
This usually surfaces at the HTTP level as a 404.
-
exception
lakesuperior.exceptions.ServerManagedTermError(terms, term_type=None)[source]¶ Bases:
RuntimeErrorRaised in an attempt to change a triple containing a server-managed term.
This usually surfaces at the HTTP level as a 409 or other error.
-
exception
lakesuperior.exceptions.SingleSubjectError(uid, subject)[source]¶ Bases:
RuntimeErrorRaised when a SPARQL-Update query or a RDF payload for a PUT contain subjects that do not correspond to the resource being operated on.
-
exception
lakesuperior.exceptions.TombstoneError(uid, ts)[source]¶ Bases:
RuntimeErrorRaised when a tombstone resource is found.
It is up to the caller to handle this which may be a benign and expected result.
lakesuperior.globals module¶
-
class
lakesuperior.globals.AppGlobals(config)[source]¶ Bases:
objectApplication Globals.
This class is instantiated and used as a carrier for all connections and various global variables outside of the Flask app context.
The variables are set on initialization by passing a configuration dict. Usually this is done when starting an application. The instance with the loaded variables is then assigned to the
lakesuperior.envglobal variable.You can either load the default configuration:
>>>from lakesuperior import env_setupOr set up an environment with a custom configuration:
>>> from lakesuperior import env >>> from lakesuperior.app_globals import AppGlobals >>> my_config = {'name': 'value', '...': '...'} >>> env.app_globals = AppGlobals(my_config)
-
camelcase(word)[source]¶ Convert a string with underscores to a camel-cased one.
Ripped from https://stackoverflow.com/a/6425628
-
changelog¶
-
config¶ Global configuration.
This is a collection of all configuration options except for the WSGI configuration which is initialized at a different time and is stored under
lakesuperior.env.wsgi_options.TODO: Update class reference when interface will be separated from implementation.
-
nonrdfly¶ Current non-RDF (binary contents) layout.
This is an instance of
BaseNonRdfLayout.
-
rdfly¶ Current RDF layout.
This is an instance of
RsrcCentricLayout.TODO: Update class reference when interface will be separated from implementation.
-
-
lakesuperior.globals.RES_CREATED= '_create_'¶ A resource was created.
-
lakesuperior.globals.RES_DELETED= '_delete_'¶ A resource was deleted.
-
lakesuperior.globals.RES_UPDATED= '_update_'¶ A resource was updated.
-
lakesuperior.globals.ROOT_RSRC_URI= rdflib.term.URIRef('info:fcres/')¶ Internal URI of root resource.
-
lakesuperior.globals.ROOT_UID= '/'¶ Root node UID.
lakesuperior.lsup_admin module¶
Utility to perform core maintenance tasks via console command-line.
The command-line tool is self-documented. Type:
lsup-admin --help
for a list of tools and options.
lakesuperior.migrator module¶
-
class
lakesuperior.migrator.Migrator(src, dest, src_auth=(None, None), clear=False, zero_binaries=False, compact_uris=False, skip_errors=False)[source]¶ Bases:
objectClass to handle a database migration.
This class holds state of progress and shared variables as it crawls through linked resources in an LDP server.
Since a repository migration can be a very long operation but it is impossible to know the number of the resources to gather by LDP interaction alone, a progress ticker outputs the number of processed resources at regular intervals.
-
db_params= {'map_size': 1099511627776, 'meminit': False, 'metasync': False, 'readahead': False}¶ LMDB database parameters.
See
lmdb.Environment.__init__()
-
ignored_preds= (rdflib.term.URIRef('http://fedora.info/definitions/v4/repository#hasParent'), rdflib.term.URIRef('http://fedora.info/definitions/v4/repository#hasTransactionProvider'), rdflib.term.URIRef('http://fedora.info/definitions/v4/repository#hasFixityService'))¶ List of predicates to ignore when looking for links.
-
-
class
lakesuperior.migrator.StoreWrapper(store)[source]¶ Bases:
contextlib.ContextDecoratorOpen and close a store.