erecord_cmn.utils package¶
Subpackages¶
- erecord_cmn.utils.using package
- Submodules
- erecord_cmn.utils.using.content_rep_pkg_vpz_tree module
- erecord_cmn.utils.using.content_simulation_inputs_tree module
- erecord_cmn.utils.using.content_simulation_results_compact module
- erecord_cmn.utils.using.content_simulation_results_tree module
- erecord_cmn.utils.using.obtain_jwt module
- erecord_cmn.utils.using.send_get_and_receive module
- erecord_cmn.utils.using.send_post_and_receive module
- Module contents
Submodules¶
erecord_cmn.utils.coding module¶
erecord_cmn.utils.coding
Coding methods
erecord_cmn.utils.dir_and_file module¶
erecord_cmn.utils.dir_and_file
Methods on directories and files
-
class
erecord_cmn.utils.dir_and_file.
ReadableWorksheet
[source]¶ Bases:
object
further for a xlrd.Worksheet
-
class
erecord_cmn.utils.dir_and_file.
WritableWorksheet
[source]¶ Bases:
object
further for a xlwt.Worksheet
-
COLUMN_LIMIT
= 256¶
-
ROW_LIMIT
= 65536¶
-
default_style
= <xlwt.Style.XFStyle object>¶
-
head_font
= <xlwt.Formatting.Font object>¶
-
head_style
= <xlwt.Style.XFStyle object>¶
-
help_font
= <xlwt.Formatting.Font object>¶
-
help_style
= <xlwt.Style.XFStyle object>¶
-
classmethod
write
(ws, row, col, v, style=None)[source]¶ Writes v into the (row, col) cell of the ws xlwt.Worksheet
Truncation : writes v if limits OK and else does nothing.
-
classmethod
write_group_bycol
(ws, info_list, nb_head=0, row_main=[], row_ini=0, title=None)[source]¶ Writes title and info_list into a xlwt.Worksheet (a col by data)
-
classmethod
write_group_byrow
(ws, info_list, nb_head=0, col_main=[], row_ini=0, title=None)[source]¶ Writes title and info_list into a xlwt.Worksheet (a row by data)
-
classmethod
write_lines_bycol
(ws, row_ini, lines, nb_head=0, row_main=[])[source]¶ Writes lines into a xlwt.Worksheet (a col by line)
-
-
erecord_cmn.utils.dir_and_file.
clean_dir
(dirpath)[source]¶ Create the directory dirpath after having deleting dirpath if still existing.
-
erecord_cmn.utils.dir_and_file.
create_dir_if_absent
(dirpath)[source]¶ Create the directory dirpath if dirpath does not yet exist.
Returns True if the creation has been done.
-
erecord_cmn.utils.dir_and_file.
delete_path_if_present
(path)[source]¶ Delete the path if it exists.
Returns True if the deletion has been done.
-
erecord_cmn.utils.dir_and_file.
get_available_pathname
(rootpath, rootname)[source]¶ Defines and returns a path name that doesn’t yet exist.
The path name is based on rootname, is the one of a rootpath subdirectory.
The pathname directory should be immediately created !
-
erecord_cmn.utils.dir_and_file.
is_a_directory
(path)[source]¶ Return True if path exists as a directory and else return False
-
erecord_cmn.utils.dir_and_file.
make_csv_file
(row_list, filename, dirpath, delimiter=';')[source]¶ Builds a csv file from row_list and saves it as filename under dirpath
-
erecord_cmn.utils.dir_and_file.
make_zip_folder
(folderpath)[source]¶ Builds the zip file of the folderpath.
Returns the zip file path name.
-
erecord_cmn.utils.dir_and_file.
recursive_overwrite
(src, dest)[source]¶ recursive overwrite taking into account directories and files
Links are not taken into account
erecord_cmn.utils.erecord_package module¶
erecord_cmn.utils.erecord_package
Methods about erecord package
-
erecord_cmn.utils.erecord_package.
control_in
(vlehome_path, vle_version, pkgname, vpzname)[source]¶ Makes controls and returns a message about errors met
Controls : - path about pkgname is a directory - path about vpzname is a file
Note : the returned message is “” if no error met.
-
erecord_cmn.utils.erecord_package.
control_out
(runvle_path)[source]¶ Makes controls and returns reports
Controls : - stderr_filename under runvle_path - stdout_filename under runvle_path - ok_filename under runvle_path
-
erecord_cmn.utils.erecord_package.
copy_erecord_data_file
(vlehome_path, vle_version, src_folder, file_name)[source]¶ Copies file_name file from src_folder to data folder of erecord pkg
-
erecord_cmn.utils.erecord_package.
create_and_fill_jsonfile
(content, folder_path, file_name)[source]¶
-
erecord_cmn.utils.erecord_package.
get_value_type
(json_value_type)[source]¶ Conversion of a value type coming from erecord pkg (json format)
Note : json_value_type values are : - vle::value::Value::type values - “” for unknown vle::value::Value::type value
or for vle::value::Value::USER that is treated as unknown
-
erecord_cmn.utils.erecord_package.
run_simulation
(runvle_path, vlehome_path, vle_usr_path, pkgname, vpzname)[source]¶
-
erecord_cmn.utils.erecord_package.
vle_modify_vpz
(runvle_path, vlehome_path, vle_version, vle_usr_path, pkgname, vpzname, storaged_list, conditions, begin, duration)[source]¶ Prepares and runs modify_vpz.vpz simulation of erecord pkg
As a result : the vpzname file simulator of the pkgname package (under vlehome_path) has been modified and is ready to be simulated or read.
Attention : give a pkgname, vpzname that is not a link but a copy
-
erecord_cmn.utils.erecord_package.
vle_read_vpz
(runvle_path, vlehome_path, vle_version, vle_usr_path, pkgname, vpzname)[source]¶ Prepares and runs read_vpz.vpz simulation of erecord pkg
This simulation produces (under runvle_path) the read_output.json json file that contains the input information of vpzname simulator.
Returns the input information of vpzname as json data
-
erecord_cmn.utils.erecord_package.
vle_run_vpz
(runvle_path, vlehome_path, vle_version, vle_usr_path, pkgname, vpzname, plan, restype)[source]¶ Prepares and runs run_vpz.vpz simulation of erecord pkg
This simulation produces (under runvle_path) the run_output.json json file that contains the results of vpzname simulation.
Returns results of vpzname simulation as json data
erecord_cmn.utils.errors module¶
erecord_cmn.utils.errors
Utils to manage errors
erecord_cmn.utils.logger module¶
erecord_cmn.utils.logger
erecord_cmn.utils.vle module¶
erecord_cmn.utils.vle
Vle interface methods
Uses python os, os.path libraries.
Does not use pyvle anymore.
-
erecord_cmn.utils.vle.
get_pkg_output_path
(pkg_path)[source]¶ returns the ‘output’ directory path of a vle package.
The vle package is located at pkg_path.
-
erecord_cmn.utils.vle.
get_pkgs_suffix
(version_name)[source]¶ returns suffix of pkgs name according to version_name
-
erecord_cmn.utils.vle.
get_rep_pkg_data_path
(rep_path, vle_version, pkgname)[source]¶ returns the ‘data’ directory path of a models repository vle package.
The models repository is located at rep_path, structured as a VLE_HOME directory. The vle package name is pkgname.
-
erecord_cmn.utils.vle.
get_rep_pkg_exp_path
(rep_path, vle_version, pkgname)[source]¶ returns the ‘exp’ directory path of a models repository vle package.
The models repository is located at rep_path, structured as a VLE_HOME directory. The vle package name is pkgname. The vpz files taken into account are those found (as vpz files of the pkgname vle package) under rep_path.
-
erecord_cmn.utils.vle.
get_rep_pkg_output_path
(rep_path, vle_version, pkgname)[source]¶ returns the ‘output’ directory path of a models repository vle package.
The models repository is located at rep_path, structured as a VLE_HOME directory. The vle package name is pkgname.
-
erecord_cmn.utils.vle.
get_rep_pkg_path
(rep_path, vle_version, pkgname)[source]¶ returns the path of a models repository vle package.
The models repository is located at rep_path, structured as a VLE_HOME directory. The vle package name is pkgname.
-
erecord_cmn.utils.vle.
get_rep_pkgname_list
(rep_path, vle_version)[source]¶ returns the list of the vle packages names of a models repository.
The models repository is located at rep_path, structured as a VLE_HOME directory.
The vle packages taken into account are those found (as vle packages) under rep_path.
-
erecord_cmn.utils.vle.
get_rep_pkgs_path
(rep_path, vle_version)[source]¶ returns the ‘pkgs’ directory path of a models repository
The models repository is located at rep_path, structured as a VLE_HOME directory.
-
erecord_cmn.utils.vle.
get_vlepath_pkg_name
(vpzpath, limit)[source]¶ returns (vlepath, pkg, name) of a vpz file absolute path.
vpzpath is the vpz file absolute path.
vlepath is the vle path (models repository path), structured as a VLE_HOME directory. pkg is the vle package name. name is the vpz file name (path relative to ‘exp’ directory, with .vpz extension) (same as in vle) limit is the path not to reach (when searching ‘exp’ into vpzpath).
-
erecord_cmn.utils.vle.
is_pkg_of_rep
(rep_path, vle_version, pkgname)[source]¶ determines if a vle package exists (as a vle package) under a models repository path.
The vle package name is pkgname. The models repository path is rep_path.
Suppose that rep_path is a models repository path. Suppose that pkgname is a vle package.
-
erecord_cmn.utils.vle.
is_structured_as_vle_home
(path, vle_version=None)[source]¶ determines if the path directory is structured as a VLE_HOME directory.
Returns True if the path directory contains a pkgs subdirectory.
-
erecord_cmn.utils.vle.
is_structured_as_vle_install
(usr_path)[source]¶ determines if the usr_path is structured as a vle install directory.
Returns True if the usr_path directory contains directories : bin, lib and lib/pkgconfig.
-
erecord_cmn.utils.vle.
is_structured_as_vle_version_name
(version_name)[source]¶ returns True if version_name is structured as vle-V.rev and else False
(for example vle-1.1.3, vle-2.0.0)
-
erecord_cmn.utils.vle.
is_vpz_of_pkg_of_rep
(rep_path, vle_version, pkgname, vpzname)[source]¶ determines if a vpz file exists as a vpz file of vle package under a models repository path.
The vpz file name is vpzname. The vle package name is pkgname. The models repository path is rep_path.
Suppose that rep_path is a models repository path. Suppose that pkgname is a vle package of the models repository.
-
erecord_cmn.utils.vle.
vle_bash_cmd
(usr_path)[source]¶ builds and returns text bash commands to be run before calling vle
vle installed under usr_path
-
erecord_cmn.utils.vle.
vle_identify
(vlepath)[source]¶ returns (vle_version, vle_usr_path) of a models repository path.
vlepath is a models repository path.
vle_version is the vle version. vle_usr_path is the path of a vle install directory.
- The method relies on the following rule :
- vlepath contains a subdirectory named “erecord_conf” that contains : - a file named “VLE_VERSION” : containing the vle version name. - a file named “VLE_USR_PATH” : containing the vle install path name.
Note : not controlled : - vlepath is structured as a VLE_HOME (see is_structured_as_vle_home). - vle_version is structured as vle-V.rev
(see is_structured_as_vle_version_name).- vle_usr_path contains directories : bin, lib, lib/pkgconfig (see is_structured_as_vle_install).
Module contents¶
erecord_cmn.utils
This package is part of erecord - Record platform web development
copyright: | Copyright (C) 2014-2015 INRA http://www.inra.fr. |
---|---|
license: | GPLv3, see License for more details. |
authors: | see Authors. |
Python code of the erecord package
Python code, some of it is independant of django applications code
See erecord