class Path: (source)
Known subclasses: zim.notebook.index.pages.PageIndexRecord
, zim.notebook.page.Page
Class Method | new_from_zim_config |
Returns a new object based on the string representation for that path. |
Static Method | assertValidPageName |
No summary |
Static Method | makeValidPageName |
No summary |
Method | __add__ |
path + name is an alias for path.child(name) |
Method | __eq__ |
Paths are equal when their names are the same |
Method | __hash__ |
Undocumented |
Method | __init__ |
Constructor. |
Method | __ne__ |
Paths are not equal when their names are not the same |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | child |
Get a child Path |
Method | commonparent |
Find a common parent for two Paths |
Method | ischild |
Check whether this path is a child of a given path @param parent: a Path object @returns: True when this path is a (grand-)child of parent |
Method | match_namespace |
Check whether this path is in a specific section of the notebook @param namespace: a Path object @returns: True when this path is equal to namespace or is a (grand-)child of namespace |
Method | parents |
Generator function for parent Paths including root |
Method | relname |
Get a part of this path relative to a parent path |
Method | serialize_zim_config |
Returns the name for serializing this path |
Class Variable | __slots__ |
Undocumented |
Instance Variable | name |
Undocumented |
Property | basename |
Get the basename of the path (last part of the name) |
Property | isroot |
True when this Path represents the top level namespace |
Property | namespace |
Gives the name for the parent page. Returns an empty string for the top level namespace. |
Property | parent |
Get the path for the parent page |
Property | parts |
Get all the parts of the name (split on ":") |
makeValidPageName()
.Parameters | |
name:str | Undocumented |
Raises | |
AssertionError | if the name is not valid |
Parameters | |
name:str | Undocumented |
Returns | |
str | Undocumented |
Raises | |
ValueError | when the result would be an empty string |
zim.notebook.index.pages.PageIndexRecord
, zim.notebook.page.Page
Parameters | |
name:Union[ | the absolute page name in the right case as a string or as a tuple strings The name ":" is used as a special case to construct a path for the toplevel namespace in a notebook. |
Note | |
This constructor does not do any checks for the sanity of the path name. Never construct a path directly from user input, but use either index.lookup_from_user_input() or first check the name with makeValidPageName() |
Parameters | |
path:Path | a parent Path |
Returns | |
str | the part of the path that is relative to path |
Raises | |
ValueError | if path is not a parent |