Table

class hep_rfm.Table(files=None, description='', last_update=None, version=None)[source]

Bases: dict

Create a table storing the information about files.

Parameters:
  • files (dict(str, FileInfo)) – files to store in the table.
  • description (str) – string to explain the contents of the table.
  • last_update (str) – date and time of the last update of the table.
  • version (str) – version of this package used to create the table.
Variables:
  • description – string with a description of the values contained in the table.
  • last_update – data and time of the last update done to the table. The value is only filled for tables read from a file. If the table is created from scratch, then it is set to None.
  • version – version of the package used to create the table. The value is only filled for tables read from a file. If the table is created from scratch, then it is set to None.

Note

For tables built from a file, the version corresponds to that of the hep_rfm package used to create them, although the structure corresponds to that of the current. The information of the last update is set to None for just created tables, and it is set only for tables read from files.

Warning

If a dictionary of files is provided in “files”, then it is necessary for each key to be equal to the name of its related file.

Methods Summary

from_fields(**fields) Build the class from a set of fields, which might or not coincide with those in the class constructor.
from_files(files[, description, …]) Build the class from a list of hep_rfm.FileInfo instances.
read(path) Build a table from the information in the file at the given local path.
updated([files, modifiers, parallelize]) Return an updated version of this table, checking again all the properties of the files within it.
write(path[, backup]) Write this table in the following location.

Methods Documentation

classmethod from_fields(**fields)[source]

Build the class from a set of fields, which might or not coincide with those in the class constructor.

Parameters:fields (dict) – dictionary of fields to process.
Returns:built table.
Return type:Table
classmethod from_files(files, description='', last_update=None, version=None)[source]

Build the class from a list of hep_rfm.FileInfo instances. The names of the files are used as keys for the table.

Parameters:
  • files (collection(FileInfo)) – files to store in the table.
  • description (str) – string to explain the contents of the table.
  • last_update (str) – date and time of the last update of the table.
  • version (str) – version of this package used to create the table.
classmethod read(path)[source]

Build a table from the information in the file at the given local path.

Parameters:path (str) – path to the text file storing the table.
Returns:built table.
Return type:Table
updated(files=None, modifiers=None, parallelize=False)[source]

Return an updated version of this table, checking again all the properties of the files within it.

Parameters:
  • files (collection(str)) – files to update within the table. The returned table will contain the same entries as the parent, but with the files specified in “files” updated.
  • modifiers (dict) – information to modify the path of this class.
  • parallelize (int) – number of processes allowed to parallelize the synchronization of all the proxies. By default it is set to 0, so no parallelization is done.
Returns:

updated version of the table.

Return type:

Table

write(path, backup=False)[source]

Write this table in the following location. Must be a local path. The current version of the package will be used.

Parameters:
  • path (str) – where to write this table to.
  • backup (bool or str) – if a table in “path” already exists and this argument is set to True, then the previous file is renamed to <filename>.backup before modifying it. If it is set to a string, then that is used as file name to write the backup.
Raises:

IOError – if the output path exists and it does not correspond to a file.