maps.schemas

Module Contents

Classes

Schema

Class for containing and maintaining global style settings.

Attributes

schema

class maps.schemas.Schema(**kwargs)

Bases: dict

Class for containing and maintaining global style settings.

parsers
apply(*keys)
clear()

D.clear() -> None. Remove all items from D.

copy()

D.copy() -> a shallow copy of D

get(key)

Get the value of a schema key.

Parameters:

key (str) – The name of the schema key to get.

Example

>>> schema.set(font="verdana")
>>> schema.get("font")
'verdana'
items()

D.items() -> a set-like object providing a view on D’s items

keys()

D.keys() -> a set-like object providing a view on D’s keys

pop()

D.pop(k[,d]) -> v, remove specified key and return the corresponding value.

If key is not found, default is returned if given, otherwise KeyError is raised

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

set(**kwargs)

Set the value of a schema key.

Parameters:

**kwargs – The schema keys and values to set.

Example

>>> schema.set(font="verdana")
>>> with schema.set(font="comic sans"):
...     print(schema.font)
...
comic sans
>>> print(schema.font)
verdana
setdefault()

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update()

D.update([E, ]**F) -> None. Update D from dict/iterable E and F. If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

use(name)

Use a named schema.

Parameters:

name (str) – The name of the schema to use, or path to a user-implemented schema.

Example

>>> schema.use("default")
>>> schema.use("~/custom.yaml")
values()

D.values() -> an object providing a view on D’s values

exception maps.schemas.SchemaNotFoundError

Bases: FileNotFoundError

File not found.

class args
class characters_written
class errno

POSIX exception code

class filename

exception filename

class filename2

second exception filename

class strerror

exception strerror

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

maps.schemas.schema