vcorelib.namespace package#

Submodules#

vcorelib.namespace.base module#

A module implementing a base namespace interface.

class vcorelib.namespace.base.Namespace(*names: str, delim: str = '.', parent: Namespace = None)[source]#

Bases: object

A class for implementing a basic namespace interface.

child(*names: str) Namespace[source]#

Create a child namespace from this one.

length_sorted_suggestions(data: str, delta: bool = True) List[str][source]#

Get suggestions (based on data) sorted by length.

namespace(name: str = None, delim: str = None, track: bool = True) str[source]#

Get the current namespace string with or without an additional name applied.

property parents: Iterator[Namespace]#

Iterate over parents.

pop(name: str = None) str[source]#

Pop the latest name off the stack.

push(name: str) None[source]#

Push a name onto the stack.

pushed(*names: str) Iterator[None][source]#

Provide this namespace with some names pushed onto the stack as a context.

search(*names: str, pattern: str = '.*', recursive: bool = True, exact: bool = False) Iterator[str][source]#

Iterate over names in this namespace that match a given pattern.

suggest(data: str, delta: bool = True) str | None[source]#

Find the shortest name suggestion.

suggestions(data: str, delta: bool = True) Iterator[str][source]#

Iterate over un-ordered suggestions for a data string that is a sub-string of one or more names in this namespace.

vcorelib.namespace.mixin module#

A module implementing a simple namespace mixin class.

class vcorelib.namespace.mixin.NamespaceMixin(namespace: Namespace = None, namespace_delim: str = '.')[source]#

Bases: object

A class for giving arbitrary objects namespace capabilities.

child_namespace(*names: str, namespace: Namespace = None) Namespace[source]#

Obtain a child namespace.

names_pushed(*names: str, namespace: Namespace = None) Iterator[None][source]#

Apply some names to this object’s namespace as a managed context.

namespace(name: str = None, delim: str = None, namespace: Namespace = None) str[source]#

Get a namespace string for this object.

Perform a search on the namespace.

namespace_suggest(data: str, delta: bool = True, namespace: Namespace = None) str | None[source]#

Find the shortest name suggestion.

property ns: Namespace#

Get this instance’s namespace.

pop_name(name: str = None, namespace: Namespace = None) str[source]#

Pop the latest name off the stack.

push_name(name: str, namespace: Namespace = None) None[source]#

Push a name onto the stack.

Module contents#

A module for implementing namespaces.

class vcorelib.namespace.Namespace(*names: str, delim: str = '.', parent: Namespace = None)[source]#

Bases: object

A class for implementing a basic namespace interface.

child(*names: str) Namespace[source]#

Create a child namespace from this one.

length_sorted_suggestions(data: str, delta: bool = True) List[str][source]#

Get suggestions (based on data) sorted by length.

namespace(name: str = None, delim: str = None, track: bool = True) str[source]#

Get the current namespace string with or without an additional name applied.

property parents: Iterator[Namespace]#

Iterate over parents.

pop(name: str = None) str[source]#

Pop the latest name off the stack.

push(name: str) None[source]#

Push a name onto the stack.

pushed(*names: str) Iterator[None][source]#

Provide this namespace with some names pushed onto the stack as a context.

search(*names: str, pattern: str = '.*', recursive: bool = True, exact: bool = False) Iterator[str][source]#

Iterate over names in this namespace that match a given pattern.

suggest(data: str, delta: bool = True) str | None[source]#

Find the shortest name suggestion.

suggestions(data: str, delta: bool = True) Iterator[str][source]#

Iterate over un-ordered suggestions for a data string that is a sub-string of one or more names in this namespace.

class vcorelib.namespace.NamespaceMixin(namespace: Namespace = None, namespace_delim: str = '.')[source]#

Bases: object

A class for giving arbitrary objects namespace capabilities.

child_namespace(*names: str, namespace: Namespace = None) Namespace[source]#

Obtain a child namespace.

names_pushed(*names: str, namespace: Namespace = None) Iterator[None][source]#

Apply some names to this object’s namespace as a managed context.

namespace(name: str = None, delim: str = None, namespace: Namespace = None) str[source]#

Get a namespace string for this object.

Perform a search on the namespace.

namespace_suggest(data: str, delta: bool = True, namespace: Namespace = None) str | None[source]#

Find the shortest name suggestion.

property ns: Namespace#

Get this instance’s namespace.

pop_name(name: str = None, namespace: Namespace = None) str[source]#

Pop the latest name off the stack.

push_name(name: str, namespace: Namespace = None) None[source]#

Push a name onto the stack.