pyspc.model.plathynes.config.Config

class pyspc.model.plathynes.config.Config(filename=None, datatype=None)[source]

Bases : OrderedDict

Classe destinée à traiter la configuration de PLATHYNES.

filename

Nom du fichier de configuration

Type:

str

datatype

Type de fichier de configuration

Type:

str

__init__(filename=None, datatype=None)[source]

Initialisation de l’instance Config de PLATHYNES.

Paramètres:
  • filename (str) – Nom du fichier de configuration

  • datatype (str) – Type de fichier de configuration

Methods

__init__([filename, datatype])

Initialisation de l'instance Config de PLATHYNES.

clear()

copy()

fromkeys(iterable[, value])

Create a new ordered dictionary with keys from iterable and values set to value.

get(key[, default])

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

get_ext([datatype])

Liste des extensions des fichiers de configuration PLATHYNES.

get_types()

Liste des types de configuration PLATHYNES.

items()

Return a set-like object providing a view on the dict's items.

keys()

Return a set-like object providing a view on the dict's keys.

list_sections_options()

Lister les sections et options de la configuration

move_to_end(key[, last])

Move an existing element to the end (or beginning if last is false).

pop(key[,default])

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem([last])

Remove and return a (key, value) pair from the dictionary.

read()

Lecture du fichier de configuration.

setdefault(key[, default])

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

update([E, ]**F)

If E is present and has a .keys() method, then does: for k in E.keys(): 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]

update_config([config, overwrite, strict])

Mettre à jour la configuration à partir d'un dictionnaire

values()

Return an object providing a view on the dict's values.

write()

Écriture du fichier de configuration.

clear() None.  Remove all items from od.
copy() a shallow copy of od
classmethod fromkeys(iterable, value=None)

Create a new ordered dictionary with keys from iterable and values set to value.

get(key, default=None, /)

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

static get_ext(datatype=None)[source]

Liste des extensions des fichiers de configuration PLATHYNES.

Paramètres:

datatype (str) – Type de configuration PLATHYNES

Renvoie:

  • list – Extensions des fichiers de configuration PLATHYNES

  • .. seealso:: pyspc.model.plathynes.convention.CONFIG_DTYPES

static get_types()[source]

Liste des types de configuration PLATHYNES.

Renvoie:

  • list – Types de configuration PLATHYNES

  • .. seealso:: pyspc.model.plathynes.convention.CONFIG_DTYPES

items()

Return a set-like object providing a view on the dict’s items.

keys()

Return a set-like object providing a view on the dict’s keys.

list_sections_options()[source]

Lister les sections et options de la configuration

move_to_end(key, last=True)

Move an existing element to the end (or beginning if last is false).

Raise KeyError if the element does not exist.

pop(key[, default]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem(last=True)

Remove and return a (key, value) pair from the dictionary.

Pairs are returned in LIFO order if last is true or FIFO order if false.

read()[source]

Lecture du fichier de configuration.

setdefault(key, default=None)

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([E, ]**F) None.  Update D from mapping/iterable E and F.

If E is present and has a .keys() method, then does: for k in E.keys(): 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]

update_config(config=None, overwrite=None, strict=None)[source]

Mettre à jour la configuration à partir d’un dictionnaire

Paramètres:
  • config (dict, Config) – Eléments à mettre à jour. {(section, option) : valeur}

  • overwrite (bool) – Forcer l’écriture si existant, par défaut: True

  • strict (bool) – Ne considérer que les clés existantes, par défaut: True

values()

Return an object providing a view on the dict’s values.

write()[source]

Écriture du fichier de configuration.