l.c.i.b.IBranchNamespaceSet(Interface) : interface documentation

Part of lp.code.interfaces.branchnamespace View In Hierarchy

Interface for getting branch namespaces.

This interface exists solely to avoid importing things from the 'database' package. Use get_branch_namespace to get branch namespaces instead.

Method get Return the appropriate IBranchNamespace for the given objects.
Method lookup Return the IBranchNamespace for 'namespace_name'.
Method interpret Like get, but takes names of objects.
Method parse Parse 'namespace_name' into its components.
Method traverse Look up the branch at the path given by 'segments'.
def get(person, product, distroseries, sourcepackagename):
Return the appropriate IBranchNamespace for the given objects.
def lookup(namespace_name):
Return the IBranchNamespace for 'namespace_name'.
ReturnsAn IBranchNamespace.
RaisesInvalidNamespaceif namespace_name cannot be parsed.
NoSuchPersonif the person referred to cannot be found.
NoSuchProductif the product referred to cannot be found.
NoSuchDistributionif the distribution referred to cannot be found.
NoSuchDistroSeriesif the distroseries referred to cannot be- found.
NoSuchSourcePackageNameif the sourcepackagename referred to cannot be found.
def interpret(person, product, distribution, distroseries, sourcepackagename):
Like get, but takes names of objects.
ReturnsAn IBranchNamespace.
RaisesNoSuchPersonif the person referred to cannot be found.
NoSuchProductif the product referred to cannot be found.
NoSuchDistributionif the distribution referred to cannot be found.
NoSuchDistroSeriesif the distroseries referred to cannot be- found.
NoSuchSourcePackageNameif the sourcepackagename referred to cannot be found.
def parse(namespace_name):
Parse 'namespace_name' into its components.

The name of a namespace is actually a path containing many elements,
each of which maps to a particular kind of object in Launchpad.
Elements that can appear in a namespace name are: 'person', 'product',
'distribution', 'distroseries' and 'sourcepackagename'.

'parse' returns a dict which maps the names of these elements (e.g.
'person', 'product') to the values of these elements (e.g. 'mark',
'firefox'). If the given path doesn't include a particular kind of
element, the dict maps that element name to None.

For example::
    parse('~foo/bar') => {
        'person': 'foo', 'product': 'bar', 'distribution': None,
        'distroseries': None, 'sourcepackagename': None}

If the given 'namespace_name' cannot be parsed, then we raise an
`InvalidNamespace` error.

:raise InvalidNamespace: if the name is too long, too short or is
    malformed.
:return: A dict with keys matching each component in 'namespace_name'.
def traverse(segments):
Look up the branch at the path given by 'segments'.

The iterable 'segments' will be consumed until a branch is found. As soon as a branch is found, the branch will be returned and the consumption of segments will stop. Thus, there will often be unconsumed segments that can be used for further traversal.

ParameterssegmentsAn iterable of names of Launchpad components. The first segment is the username, not preceded by a '~`.
ReturnsIBranch.
RaisesInvalidNamespaceif there are not enough segments to define a branch.
NoSuchPersonif the person referred to cannot be found.
NoSuchProductif the product or distro referred to cannot be found.
NoSuchDistributionif the distribution referred to cannot be found.
NoSuchDistroSeriesif the distroseries referred to cannot be- found.
NoSuchSourcePackageNameif the sourcepackagename referred to cannot be found.
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.