system7975%python.module
fault.project

Product and Project directory protocol support.

Provides three classes of interest: Project, Product, and Context. Context manages a project set formed from a sequence of Products that make up a factor search path; Projects are cached on Context instances and Products primarily provide access and updates to a product directory's index, the .product directory.

Even in the case of single product directories, a Context should be used to access the projects. The primary function of a Product instance is to merely provide access to the data stored in the index, not as a general purpose abstraction for interacting with the product directory as that function usually involves multiple directories, an abstraction provided by Context.

typing
import

collections0
import

operator0
import

itertools0
import

tools0
import

Selector
import

Segment0
import

types0
import

parse_project_index0
function

parse_project_index(lines)

Generate tuples from the given space separated fields, lines. Intended to be interpreted as a dictionary, the items' initial element should be the project's (universal) identifier. The second element is a tuple of the local name and project protocol identifier.

parse_protocol_declaration20%
function

parse_protocol_declaration(text)

Split the text and return the fields as a tuple.

structure_project_declaration285%
function

structure_project_declaration(text)

Parse the contents of a .project file.

structure_project_declarationReturns

A pair, the project protocol and a fault.project.types.Information instance.

sequence_project_declaration0
function

sequence_project_declaration()

Format the contents of a .project file from the given protocol and fault.project.types.Information structure.

scan_product_directory285%
function

scan_product_directory(read_protocol, route)

Identify the projects within the given route. Usually only used through Product.update.

protocols0
data

protocols = {
	'factors/polynomial-1': (__package__ + '.polynomial', 'V1'),
}

Product0
class

Project set root providing access to contexts and projects.

While often annotated as fault.route.types.Selector, usually filesystem operation must be supported by the selector.

Productproject_identity_segment0
data

project_identity_segment = Segment.from_sequence(['.project', 'f-identity'])

Productdefault_meta_directory0
data

default_meta_directory = Segment.from_sequence(['.product'])

Productdefault_images_directory0
data

default_images_directory = Segment.from_sequence(['.images'])
	@classmethod

Productimport_protocol0
classmethod
types.FactorIsolationProtocol

import_protocol(Class, identifier)

Retrieve the protocol class using the identifier.

Productproject_index_route0
property
Selector

Materialized project index file path.

Productconnections_index_route0
property
Selector

Connection list fulfilling requirements.

Productconnections266%
property

The requirements of the product as a sequence of product directory routes.

This sequence is not cached and constructed at access time by opening the file connections_index_route.

Productclear0
method

clear(self)

Remove the instance local cache.

Product__init__0
method

__init__(self, route)

Initialize a Product using route with an empty local instance cache.

cache parameter is available as an override for the .product directory location, but should normally not be used.

Product__hash__10%
method

__hash__(self)

Product__eq__10%
method

__eq__(self, operand)

Productimage0
method

image(self, variants, project, factor)

Identify the location of the factor's image for the given variants.

Productidentifier_by_factor0
method
typing.Tuple[str, types.FactorIsolationProtocol]

identifier_by_factor(self, factor)

Select the project identifier and protocol using a factor path (to the project). Uses the instance local cache populated by load or update.

Productfactor_by_identifier0
method
typing.Tuple[types.FactorPath, types.FactorIsolationProtocol]

factor_by_identifier(self, identifier)

Select the factor path (to the project) and protocol using the project identifier. Uses the instance local cache populated by load or update.

Productselect736%
method
typing.Iterable[types.FactorPath]

select(self, constraint)

Retrieve project (path) entries that have the given prefix, constraint.

If the argument identifies a context, generate the projects contained therein. If the argument is a nil fault.project.types.FactorPath, generate all project paths.

Productread_protocol0
method

read_protocol(self, route)

Retrieve the protocol data from the configured project_declaration_filesnames.

Product_spec0
property

Productload0
method

load(self)

Load the snapshot of the projects from the product's route.

Productstore0
method

store(self)

Store the snapshot of the projects to the product's route.

Productupdate0
method

update(self)

Update the snapshot of the projects by querying the filesystem. The effects of this should be recorded with a subsequent call to store.

Productiterprojects381%
method

iterprojects(self)

Query the route and retrieve all projects within the product.

Results may be inconsistent with the instance cache.

Productsplit0
method

split(self, fpath)

Separate the project portion from fpath. Returns a pair of fault.project.types.FactorPath; the project and the factor.

Project0
class

Project Interface joining relavant routes and protocol instances.

Projectmeta_directory_path0
data

meta_directory_path = Segment.from_sequence(['.project'])
	@tools.cachedproperty

Projectmeta0
method

meta(self)

The directory containing project metadata.

Project__init__0
method

__init__(self, pd, pi, pf, proto)

Project_iid_corpus_name_pair0
method

_iid_corpus_name_pair(self)

Projectcorpus0
property
str

The leading portion of the independent identifier.

Projectname0
property
str

The name of the project as defined by the independent identifier.

Projectrequirements214%
method

requirements(self, context)

Identify the unique set of projects required by this project.

Projectinformation250%
method
types.Information

information(self)

The identifying information of the project.

Projectextensions0
method
types.Extensions

extensions(self)

Additional identifying information of the project.

Projecticon260%
method
bytes

icon(self)

Read the icon reference contained in .project/icon.

ProjecticonReturns

b''

When the filesystem resource could not be loaded or when only whitespace is present.

Exceptions are suppressed.

bytes

The data content of the self.meta / 'icon' filesystem resource as read by files.Path.fs_load.

Projectsynopsis260%
method
bytes

synopsis(self)

Read the synopsis data contained in .project/synopsis.

ProjectsynopsisReturns

b''

When the filesystem resource could not be loaded or when only whitespace is present.

Exceptions are suppressed.

bytes

The data content of the self.meta / 'synopsis' filesystem resource as read by files.Path.fs_load.

Projectimage0
method

image(self, variants, fp)

Projectselect0
method

select(self, factor)

Retrieve factors within the given path.

Projectsplit80%
method

split(self, fp)

Separate the factor path from the element path. Returns a pair, fault.project.types.FactorPath and a str; the project and the factor.

Projectfullsplit40%
method

fullsplit(self, qpath)

Separate the project path, factor path, and fragment path from the given fully qualified factor path.

Projectrefer0
method
types.Reference

refer(self, factorpath)

Construct a fault.project.types.Reference instance using the given factorpath.

Context0
class

Product and Project instance cache and search path.

Contextimport_protocol0
classmethod
typing.Type[types.FactorIsolationProtocol]

import_protocol(Class, identifier)

Retrieve the protocol class using the identifier.

Contextfrom_product_connections0
classmethod

from_product_connections(Class, pd)

Create a Context initializing it with the immediate connections identified by pd.

Context__init__0
method

__init__(self)

Contextconnect0
method
Product

connect(self, route)

Add a new Product instance to the context.

Returns an existing Product instance if the route was in the cache, otherwise creates a new instance and places it in the cache.

Contextproject0
method
Project

project(self, id)

Retrieve a Project instance from the context's instance cache.

ContextprojectExceptions

LookupError

No project with the given identifier has been loadded in the context.

Contextiterprojects0
method
typing.Iterable[Project]

iterprojects(self)

Generate Project instances cached from a prior load call.

This includes any Context Projects.

Contextload0
method

load(self)

Fully populate the instance cache with all of the projects from all of the connected products.

Contextconfigure0
method

configure(self)

Traverse the cached projects and apply protocol inheritance.

Contextindex40%
method

index(self, product)

Find the index of the Product whose route is equal to product.

Contextsplit0
method

split(self, qpath)

Identify the product, project, and factor path of the given qpath. Returns a triple identifying the Product, Project, and remaining fault.project.types.FactorPath.

ContextsplitParameters

self

Undocumented.

qpath

The qualified factor path identifying an element, factor, or project.

Contextimage20%
method

image(self, variants, fp)

Contextrefer325%
method

refer(self, factorpath)

Construct a fault.project.types.Reference from the given factorpath string.

factorpath is first processed with fault.project.types.fpc before being analyzed by split.