scilens 0.3.0__py3-none-any.whl → 0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scilens/components/compare_floats.py +1 -1
- scilens/components/executor.py +30 -33
- scilens/config/models/report_html.py +1 -1
- scilens/report/html_report.py +13 -12
- scilens/report/templates/body_01_title.html +1 -1
- scilens/utils/web.py +11 -9
- {scilens-0.3.0.dist-info → scilens-0.3.1.dist-info}/METADATA +1 -1
- {scilens-0.3.0.dist-info → scilens-0.3.1.dist-info}/RECORD +10 -10
- {scilens-0.3.0.dist-info → scilens-0.3.1.dist-info}/WHEEL +0 -0
- {scilens-0.3.0.dist-info → scilens-0.3.1.dist-info}/entry_points.txt +0 -0
|
@@ -24,7 +24,7 @@ class CompareFloats:
|
|
|
24
24
|
def compare_vectors(self,test_vector,reference_vector,group_id,info_vector=_A):
|
|
25
25
|
B='ignore';A='RIAE_trapezoid';group=self.compare_errors.groups[group_id]
|
|
26
26
|
if len(test_vector)!=len(reference_vector):raise Exception('Vectors have different lengths')
|
|
27
|
-
diffs_count=0;err_limit_reached=_B;ponderation_method=self.thresholds.vectors.ponderation_method
|
|
27
|
+
diffs_count=0;err_limit_reached=_B;ponderation_method=self.thresholds.vectors.ponderation_method if self.thresholds.vectors else _A
|
|
28
28
|
if ponderation_method=='RIAE':ponderation_method=A
|
|
29
29
|
amplitude_compare=_A
|
|
30
30
|
if self.thresholds.vectors and ponderation_method=='amplitude_moderation':amplitude=vector_get_amplitude(test_vector)[_C];amplitude_compare=amplitude*self.thresholds.vectors.amplitude_moderation_multiplier;reduction_method=self.thresholds.vectors.reduction_method
|
scilens/components/executor.py
CHANGED
|
@@ -5,23 +5,30 @@ from scilens.utils.web import Web
|
|
|
5
5
|
def unzip_file(zip_file_path,extract_to_path):
|
|
6
6
|
with zipfile.ZipFile(zip_file_path,'r')as A:A.extractall(extract_to_path)
|
|
7
7
|
def find_command(command_path,working_dirs,guess_os_extension=False):
|
|
8
|
-
|
|
8
|
+
J='.bash';I='.sh';G=working_dirs;A=command_path;H=os.path.isabs(A);C=[]
|
|
9
9
|
if guess_os_extension:
|
|
10
|
-
|
|
11
|
-
if
|
|
12
|
-
elif
|
|
13
|
-
elif
|
|
14
|
-
else:logging.warning(f"Unknown system {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
D=platform.system().lower()
|
|
11
|
+
if D=='windows':C=['.exe','.bat','.cmd']
|
|
12
|
+
elif D=='linux':C=[I,J,'.bin']
|
|
13
|
+
elif D=='darwin':C=[I,J]
|
|
14
|
+
else:logging.warning(f"Unknown system {D}")
|
|
15
|
+
if H:
|
|
16
|
+
if os.path.exists(A):return A
|
|
17
|
+
else:
|
|
18
|
+
for E in G:
|
|
19
|
+
B=os.path.join(E,A)
|
|
20
|
+
if os.path.exists(B):return B
|
|
21
|
+
for K in C:
|
|
22
|
+
F=A+K
|
|
23
|
+
if H:
|
|
24
|
+
if os.path.exists(F):return F
|
|
18
25
|
else:
|
|
19
|
-
for
|
|
20
|
-
|
|
21
|
-
if os.path.exists(
|
|
26
|
+
for E in G:
|
|
27
|
+
B=os.path.join(E,F)
|
|
28
|
+
if os.path.exists(B):return B
|
|
22
29
|
class Executor:
|
|
23
30
|
def __init__(A,absolute_working_dir,config,alternative_working_dir=None):
|
|
24
|
-
B=config;A.
|
|
31
|
+
D=alternative_working_dir;C=absolute_working_dir;B=config;A.config=B;A.working_dir=C;A.dirs=[C]+([D]if D else[]);A.command_path=None;A.temp_dir=None
|
|
25
32
|
if B.exe_url and B.exe_path:raise ValueError('Executable URL and Path are defined. Only one can be defined.')
|
|
26
33
|
if not B.exe_url and not B.exe_path:raise ValueError('Executable URL and Path are not defined. One must be defined.')
|
|
27
34
|
if not os.path.exists(A.working_dir):logging.info(f"Creating working directory {A.working_dir}");dir_create(A.working_dir)
|
|
@@ -33,26 +40,16 @@ class Executor:
|
|
|
33
40
|
for dir in A.config.pre_folder_delete or[]:dir_remove(os.path.join(A.working_dir,dir))
|
|
34
41
|
logging.info(f"Folders creation")
|
|
35
42
|
for dir in A.config.pre_folder_creation or[]:dir_create(os.path.join(A.working_dir,dir))
|
|
36
|
-
if A.config.exe_url:
|
|
43
|
+
if A.config.exe_url:
|
|
44
|
+
logging.info(f"Download executable {A.config.exe_url}");A.temp_dir=tempfile.mkdtemp();E='executable';B=os.path.join(A.temp_dir,E)
|
|
45
|
+
try:Web().download_progress(A.config.exe_url,B,headers=A.config.exe_url_headers,callback100=lambda percentage:logging.info(f"Downloaded {percentage}%"))
|
|
46
|
+
except Exception as F:raise ValueError(f"Error downloading executable: {F}")
|
|
47
|
+
logging.info(f"Download completed")
|
|
37
48
|
else:B=A.config.exe_path
|
|
38
|
-
if A.config.exe_unzip_and_use:logging.info(f"Unzip archive");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
logging.info(f"Guess OS extension");D=[A.working_dir]
|
|
43
|
-
if A.alternative_working_dir:D.append(A.alternative_working_dir)
|
|
44
|
-
B=find_command(B,D,guess_os_extension=True)
|
|
45
|
-
if not B:raise FileNotFoundError(f"Command not found: {B}")
|
|
46
|
-
logging.info(f"Add executable permissions");F=os.stat(B).st_mode;os.chmod(B,F|stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH);A.command_path=B
|
|
49
|
+
if A.config.exe_unzip_and_use:logging.info(f"Unzip archive");D=os.path.dirname(B);unzip_file(B,D);B=os.path.join(D,A.config.exe_unzip_and_use);logging.info(f"Unzip completed")
|
|
50
|
+
C=find_command(B,A.dirs,guess_os_extension=A.config.exe_guess_os_extension)
|
|
51
|
+
if not C:raise FileNotFoundError(f"Command not found: {B}")
|
|
52
|
+
logging.info(f"Command path resolved: {C}");logging.info(f"Add executable permissions");G=os.stat(C).st_mode;os.chmod(C,G|stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH);A.command_path=C
|
|
47
53
|
def _post_operations(A):logging.info(f"Execute - Post Operations")
|
|
48
|
-
def _run_command(A):
|
|
49
|
-
logging.info(f"Execute - Run Command");C=A.command_path;B=C
|
|
50
|
-
if os.path.isabs(B):
|
|
51
|
-
if not os.path.exists(B):raise FileNotFoundError(f"Command not found: {B}")
|
|
52
|
-
else:
|
|
53
|
-
D=[A.working_dir]
|
|
54
|
-
if A.alternative_working_dir:D.append(A.alternative_working_dir)
|
|
55
|
-
B=find_command(C,D,guess_os_extension=A.config.exe_guess_os_extension)
|
|
56
|
-
if not B:raise FileNotFoundError(f"Command not found: {C}")
|
|
57
|
-
E=f"{B}{A.config.command_suffix or''}";logging.info(f"RUN COMMAND {E} in {A.working_dir}");subprocess.run(E,shell=True,check=True,cwd=A.working_dir)
|
|
54
|
+
def _run_command(A):logging.info(f"Execute - Run Command");C=A.command_path;B=f"{C}{A.config.command_suffix or''}";logging.info(f"RUN COMMAND {B} in {A.working_dir}");subprocess.run(B,shell=True,check=True,cwd=A.working_dir)
|
|
58
55
|
def process(A):logging.info(f"Execute");A._pre_operations();A._run_command();A._post_operations();A._cleanup()
|
|
@@ -3,4 +3,4 @@ from pydantic import BaseModel,Field
|
|
|
3
3
|
class ReportParameterPageModeConfig(BaseModel):is_user_preference:bool=Field(default=True,description=_A);default_value:str=Field(default='onepage',description='`tabs` ou `onepage`')
|
|
4
4
|
class ReportParameterOpenFileInConfig(BaseModel):is_user_preference:bool=Field(default=True,description=_A);default_value:str=Field(default='browser',description='`browser` ou `vscode`')
|
|
5
5
|
class ReportHtmlCurvesConfig(BaseModel):display_on_load:bool=Field(default=False,description="Si `true`, affiche tous les graphiques courbes à l'ouverture du rapport.");init_width:int=Field(default=600,description='Largeur initiale des graphiques courbes.');init_height:int=Field(default=400,description='Hauteur initiale des graphiques courbes.')
|
|
6
|
-
class ReportHtmlConfig(BaseModel):compare_color_test:str=Field(default='1982c4',description='Couleur pour les données de test.');compare_color_reference:str=Field(default='6a4c93',description='Couleur pour les données de référence.');collapse_if_successful:bool=Field(default=True,description="N'affiche par défaut les sections de comparaison sans erreur.");parameter_page_mode:ReportParameterPageModeConfig=ReportParameterPageModeConfig();parameter_open_file_in:ReportParameterOpenFileInConfig=ReportParameterOpenFileInConfig();curves:ReportHtmlCurvesConfig=ReportHtmlCurvesConfig()
|
|
6
|
+
class ReportHtmlConfig(BaseModel):logo_height:int=Field(default=40,description='Hauteur du logo dans le titre.');compare_color_test:str=Field(default='1982c4',description='Couleur pour les données de test.');compare_color_reference:str=Field(default='6a4c93',description='Couleur pour les données de référence.');collapse_if_successful:bool=Field(default=True,description="N'affiche par défaut les sections de comparaison sans erreur.");parameter_page_mode:ReportParameterPageModeConfig=ReportParameterPageModeConfig();parameter_open_file_in:ReportParameterOpenFileInConfig=ReportParameterOpenFileInConfig();curves:ReportHtmlCurvesConfig=ReportHtmlCurvesConfig()
|
scilens/report/html_report.py
CHANGED
|
@@ -8,19 +8,20 @@ from scilens.utils.time_tracker import TimeTracker
|
|
|
8
8
|
class HtmlReport:
|
|
9
9
|
def __init__(A,config,alt_config_dirs,working_dir=None):A.config=config;A.alt_config_dirs=alt_config_dirs;A.working_dir=working_dir
|
|
10
10
|
def process(A,processor,data,task_name):
|
|
11
|
-
|
|
11
|
+
I='meta';H='date';logging.info(f"Processing html report");J=TimeTracker();B=J.get_data()['start']
|
|
12
12
|
if A.config.logo and A.config.logo_file:raise ValueError('logo and logo_file are exclusive.')
|
|
13
|
-
|
|
13
|
+
K=A.config.logo;C=None
|
|
14
14
|
if A.config.logo_file:
|
|
15
15
|
D=A.config.logo_file
|
|
16
|
-
if os.path.isabs(D):
|
|
16
|
+
if os.path.isabs(D):
|
|
17
|
+
C=D
|
|
18
|
+
if not os.path.isfile(E):raise FileNotFoundError(f"Logo file '{A.config.logo_file}' not found.")
|
|
17
19
|
else:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return template_render_infolder('index.html',{G:L,'task':data.get(G),'data':{'files':data.get('processor_results')},'debug':E})
|
|
20
|
+
F=list(set([A.working_dir]+A.alt_config_dirs))
|
|
21
|
+
for L in F:
|
|
22
|
+
E=os.path.join(L,D)
|
|
23
|
+
if os.path.isfile(E):C=E;break
|
|
24
|
+
if not C:raise FileNotFoundError(f"Logo file '{A.config.logo_file}' not found in {F}.")
|
|
25
|
+
M=A.config.title if A.config.title else A.config.title_prefix+' '+task_name;N={'app_name':product_name,'app_version':pkg_version,'app_homepage':pkg_homepage,'app_copyright':f"© {B[H][:4]} {powered_by['name']}. All rights reserved",'app_powered_by':powered_by,'execution_utc_datetime':B['datetime'],'execution_utc_date':B[H],'execution_utc_time':B['time'],'execution_dir':A.working_dir,'title':M,'image':K or get_logo_image_src(C),'config':A.config.html,'config_json':A.config.html.model_dump_json()};G=None
|
|
26
|
+
if A.config.debug:G=A.config.model_dump_json(indent=4)
|
|
27
|
+
return template_render_infolder('index.html',{I:N,'task':data.get(I),'data':{'files':data.get('processor_results')},'debug':G})
|
scilens/utils/web.py
CHANGED
|
@@ -8,13 +8,15 @@ class Web:
|
|
|
8
8
|
C=requests.get(url,headers=B);C.raise_for_status()
|
|
9
9
|
with open(filename,'wb')as D:D.write(C.content)
|
|
10
10
|
def download_progress(L,url,filename,headers=None,callback100=None):
|
|
11
|
-
|
|
12
|
-
if
|
|
13
|
-
|
|
11
|
+
E=callback100;D=headers;F=BASE_HEADERS.copy()
|
|
12
|
+
if D:F.update(D)
|
|
13
|
+
A=requests.get(url,headers=F,stream=True)
|
|
14
|
+
if A.status_code>299:raise ValueError(f"Error downloading file: {A.status_code} - {A.text}")
|
|
15
|
+
I=int(A.headers.get('Content-Length',0));G=0;J=I//100;B=0
|
|
14
16
|
with open(filename,'wb')as K:
|
|
15
|
-
for
|
|
16
|
-
if
|
|
17
|
-
K.write(
|
|
18
|
-
if H>
|
|
19
|
-
|
|
20
|
-
if
|
|
17
|
+
for C in A.iter_content(chunk_size=1024):
|
|
18
|
+
if C:
|
|
19
|
+
K.write(C);G+=len(C);H=G//J
|
|
20
|
+
if H>B:
|
|
21
|
+
B=H
|
|
22
|
+
if E:E(B)
|
|
@@ -10,10 +10,10 @@ scilens/components/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
10
10
|
scilens/components/analyse_folder.py,sha256=yqc-dscKaHLZJCYeXGak2v0c3F2aeX0E11AFPfya6r0,208
|
|
11
11
|
scilens/components/compare_2_files.py,sha256=U4xumE28ijFbnrTPH8FgRyR_b5f04jOjaCmegJvCvSE,1483
|
|
12
12
|
scilens/components/compare_errors.py,sha256=Kw_zpVmA3Fb7yVDXog2poLaTsV_K81eLqv-z-b73Nlw,1495
|
|
13
|
-
scilens/components/compare_floats.py,sha256=
|
|
13
|
+
scilens/components/compare_floats.py,sha256=tmHwS4ivzdA9iJBePHDQrDlnA9zxqjLhIjxuvwPxIKc,5063
|
|
14
14
|
scilens/components/compare_folders.py,sha256=LZ1AuYxLVHMNbtXWXQrdms4vZgOQthvDy-8NFD_EFjc,2617
|
|
15
15
|
scilens/components/compare_models.py,sha256=SCPd747h_nd4ewZsqLB6CFr27v6q99NELJb-gpkdj0o,918
|
|
16
|
-
scilens/components/executor.py,sha256=
|
|
16
|
+
scilens/components/executor.py,sha256=LaT6QnWk8Xf2qdFqBSa58iDh-cUfu_uMIvllpLHmLCk,3314
|
|
17
17
|
scilens/components/file_reader.py,sha256=7SbKCqb4Co_pqAKX3wweYhqAcVkU7BDlT903sLd76Kc,1407
|
|
18
18
|
scilens/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
19
|
scilens/config/cli_run_options.py,sha256=Ls7yK5QDUPFbk73nbjGuPvuRbBRYw4Miag5ISpu3prg,281
|
|
@@ -33,7 +33,7 @@ scilens/config/models/reader_format_txt.py,sha256=eHg90gwEI_VpqwqEjMRhwlS8dHcl5G
|
|
|
33
33
|
scilens/config/models/reader_format_txt_fixed_cols.py,sha256=xHD1_JOoRZow8lSNaDSYFeNckojctkT4C61mbBcjeKg,1079
|
|
34
34
|
scilens/config/models/readers.py,sha256=Pq5kOGW3b6g1x5cp_BbwUF7LUB_P3m9bHDYLSTVXNBY,1769
|
|
35
35
|
scilens/config/models/report.py,sha256=nTmP2nIwL2Ku5IH9QMwYLPKmfsK2ttu9UK0GnzPUHeM,870
|
|
36
|
-
scilens/config/models/report_html.py,sha256=
|
|
36
|
+
scilens/config/models/report_html.py,sha256=WiUPD38NCmBYHQdYyMb1-713kVNq7dm5pe8chlhuoyM,1468
|
|
37
37
|
scilens/config/models/report_output.py,sha256=XoqUe-t-y8GRbUR3_bDwwaWf6hif-rZ-5pKDGdCMugw,875
|
|
38
38
|
scilens/helpers/assets.py,sha256=XphDA3-yE1PPKw4XFZhDrlLQjMZfGMlpOBXa8uy_xX0,1552
|
|
39
39
|
scilens/helpers/search_and_index.py,sha256=kXZ7124ra_SGAdKUZ7msy55UOWQ9dCSuPuNoU-NdUyM,1522
|
|
@@ -60,10 +60,10 @@ scilens/report/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
60
60
|
scilens/report/assets/logo.svg,sha256=W-1OVqcvdBjf-1AHHcV6WciIUqBoVFUh52Tc3o_jqtA,4519
|
|
61
61
|
scilens/report/assets/logo_cglb.svg,sha256=tEpkSr2h-jjQMecqiHef98Mxod4GD5j5nCQaFloTYso,2411
|
|
62
62
|
scilens/report/assets.py,sha256=CcfGc9NNGnPVinkHZkEyN2S_BGKNIyMFvVdA__-M6-0,532
|
|
63
|
-
scilens/report/html_report.py,sha256=
|
|
63
|
+
scilens/report/html_report.py,sha256=ajNDTfEu06fs2h1SF4nTP1MvZmYwMcLieeSngyuH-qE,1905
|
|
64
64
|
scilens/report/report.py,sha256=aS7ktJ2u0IAMMk-HwqqSsRkr77ZBQyYT4wXJ7djQvAk,1811
|
|
65
65
|
scilens/report/template.py,sha256=cPs5gd3uEwb-6JgitGQD_i4IiUxigBTlZLNRS9KVuos,581
|
|
66
|
-
scilens/report/templates/body_01_title.html,sha256=
|
|
66
|
+
scilens/report/templates/body_01_title.html,sha256=0mrMM62TSBdPOpPNCcam0bZsZtM0GjoMQ-jrSqI8HCw,2173
|
|
67
67
|
scilens/report/templates/body_99_footer.html,sha256=8cWebeWfZwZ-9bYAMZkZj8rbCWq3BLIMjKQThWQxoQM,362
|
|
68
68
|
scilens/report/templates/compare_11_summary.html,sha256=4rxBlOxTcn59ztYtqDbi6SRQXlaz30HkVl7dJpzCmZE,3776
|
|
69
69
|
scilens/report/templates/compare_12_sections.html,sha256=HWsfCmfdleyRK6IHJeMEheenOuyA0mLzOZ-0qLcuzJU,5952
|
|
@@ -96,8 +96,8 @@ scilens/utils/system.py,sha256=drXp_Vdv2dP9wFQoEQZIhxyCJhFliBLFPylGwv89FF4,182
|
|
|
96
96
|
scilens/utils/template.py,sha256=9dlXX3nmfzDRUwzPJOkoxk15UXivZ2SW-McdCwokFa4,443
|
|
97
97
|
scilens/utils/time_tracker.py,sha256=DdVBoMpVLXrX0qZZXyLm4g38EwDVLlRcBqcpNex1mYY,545
|
|
98
98
|
scilens/utils/vectors.py,sha256=4N2BZSC5n3HgZqPujDGF5NdjVmSL1rOHb_qw4OoABQY,103
|
|
99
|
-
scilens/utils/web.py,sha256=
|
|
100
|
-
scilens-0.3.
|
|
101
|
-
scilens-0.3.
|
|
102
|
-
scilens-0.3.
|
|
103
|
-
scilens-0.3.
|
|
99
|
+
scilens/utils/web.py,sha256=MAFWpIFOKz7QhqDoFh-Qwstvc76KpcxstSgHFT8FOL4,901
|
|
100
|
+
scilens-0.3.1.dist-info/METADATA,sha256=AmSUTNHDOlrHTmC0Qp60jHaju--5SiGbDR-EG-uNKm4,1367
|
|
101
|
+
scilens-0.3.1.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
102
|
+
scilens-0.3.1.dist-info/entry_points.txt,sha256=DaKGgxUEUv34GJAoXtta6ecL37ercejep9sCSSRQK2s,48
|
|
103
|
+
scilens-0.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|