sphobjinv.data¶
sphobjinv data classes for individual objects.
sphobjinv is a toolkit for manipulation and inspection of
Sphinx objects.inv files.
- Author
- Brian Skinn (bskinn@alum.mit.edu)
- File Created
- 7 Nov 2017
- Copyright
- (c) Brian Skinn 2016-2018
- Source Repository
- http://www.github.com/bskinn/sphobjinv
- Documentation
- http://sphobjinv.readthedocs.io
- License
- The MIT License; see LICENSE.txt for full license terms
Members
-
class
DataFields¶ Enumfor the fields of objects.inv data objects.-
DispName= 'dispname'¶ Default display name for the object in rendered documentation when referenced as :domain:role:`name`
-
Domain= 'domain'¶ Sphinx domain housing the object
-
Name= 'name'¶ Object name, as recognized internally by Sphinx
-
Priority= 'priority'¶ Object search priority
-
Role= 'role'¶ Full name of Sphinx role to be used when referencing the object
-
URI= 'uri'¶ URI to the location of the object’s documentation, relative to the documentation root
-
-
class
DataObjBytes(name, domain, role, priority, uri, dispname, as_str=NOTHING, as_bytes=NOTHING)¶ SuperDataObjsubclass generatingbytesobject data.-
as_bytes¶ DataObjBytesversion of instance.
-
as_str¶ DataObjStrversion of instance.
-
dispname¶ Object default name in rendered documentation\(^\dagger\).
Possibly abbreviated; see here.
-
domain¶ Sphinx domain containing the object\(^\dagger\).
-
name¶ Object name, as recognized internally by Sphinx\(^\dagger\).
-
priority¶ Object search priority\(^\dagger\).
-
role¶ Sphinx role to be used when referencing the object\(^\dagger\).
-
-
class
DataObjStr(name, domain, role, priority, uri, dispname, as_bytes=NOTHING, as_str=NOTHING)¶ SuperDataObjsubclass generatingstrobject data.-
as_bytes¶ DataObjBytesversion of instance.
-
as_str¶ DataObjStrversion of instance.
-
dispname¶ Object default name in rendered documentation\(^\dagger\).
Possibly abbreviated; see here.
-
domain¶ Sphinx domain containing the object\(^\dagger\).
-
name¶ Object name, as recognized internally by Sphinx\(^\dagger\).
-
priority¶ Object search priority\(^\dagger\).
-
role¶ Sphinx role to be used when referencing the object\(^\dagger\).
-
-
class
SuperDataObj¶ Abstract base superclass defining common methods &c. for data objects.
Intended only to be subclassed by
DataObjBytesandDataObjStr, to allow definition of common methods, properties, etc. all in one place.Where marked with \(^\dagger\),
DataObjBytesinstances will returnbytesvalues, whereasDataObjStrinstances will returnstrvalues.-
as_bytes¶ DataObjBytesversion of instance.
-
as_rst¶ strreST reference-like object representation.Typically will NOT function as a proper reST reference in Sphinx source (e.g., a role of function must be referenced using :func: for the py domain).
-
as_str¶ DataObjStrversion of instance.
-
data_line(*, expand=False, contract=False)¶ Compose plaintext objects.inv data line from instance contents.
The format of the resulting data line is given by
data_line_fmt.DataObjBytesandDataObjStrinstances generate data lines asbytesandstr, respectively.Calling with both expand and contract as
Trueis invalid.Parameters: Returns: dl –
bytes(forDataObjBytes) orstr(forDataObjStr) – Object data lineRaises: ValueError– If both expand and contract areTrue
-
data_line_fmt= '{name} {domain}:{role} {priority} {uri} {dispname}'¶ Helper
strfor generating plaintext objects.inv data lines. The field names MUST match thestrvalues of theDataFieldsmembers.
-
dispname¶ Object default name in rendered documentation\(^\dagger\).
Possibly abbreviated; see here.
-
dispname_abbrev¶ Abbreviation character(s) for display name\(^\dagger\).
'-'orb'-'for version 2 objects.inv files.
-
dispname_contracted¶ Object display name, contracted with dispname_abbrev.
-
dispname_expanded¶ Object display name, with dispname_abbrev expanded.
-
domain¶ Sphinx domain containing the object\(^\dagger\).
-
evolve(**kwargs)¶ Create a new instance with changes applied.
This helper method provides a concise means for creating new instances with only a subset of changed data fields.
The names of any kwargs MUST be keys of the
dicts generated byjson_dict().Parameters: **kwargs – strorbytes– Revised value(s) to use in the new instance for the passed keyword argument(s).Returns: dobj – DataObjBytesorDataObjStr– New instance with updated data
-
json_dict(*, expand=False, contract=False)¶ Return the object data formatted as a flat
dict.The returned
dictis constructed such that it matches the relevant subschema ofsphobjinv.schema.json_schema, to facilitate implementation ofInventory.json_dict().The
dicts returned byDataObjBytesandDataObjStrboth havestrkeys, but they havebytesandstrvalues, respectively. Thedictkeys are identical to thestrvalues of theDataFieldsEnummembers.Calling with both expand and contract as
Trueis invalid.Parameters: Returns: d –
dict– Object dataRaises: ValueError– If both expand and contract areTrue
-
name¶ Object name, as recognized internally by Sphinx\(^\dagger\).
-
priority¶ Object search priority\(^\dagger\).
-
role¶ Sphinx role to be used when referencing the object\(^\dagger\).
-
rst_fmt= ':{domain}:{role}:`{name}`'¶ str.format()template for generating reST-like representations of object data foras_rst(used withInventory.suggest()).
-
uri_abbrev¶ Abbreviation character(s) for URI tail\(^\dagger\).
'$'orb'$'for version 2 objects.inv files.
-
uri_contracted¶ Object relative URI, contracted with uri_abbrev.
-
uri_expanded¶ Object relative URI, with uri_abbrev expanded.
-