X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FdaComposant%2FdaCore%2FInterfaces.py;h=34508cb233aeb851fdde8bf1b0f0558c4689b4ea;hb=61f19963a2e2ed620bdf577c5a01808586dd938d;hp=6d301aed426e3b1a121e040957ff3d3db1f50c25;hpb=4c5ac465c6f6f1f694c31a234306672ca519a441;p=modules%2Fadao.git diff --git a/src/daComposant/daCore/Interfaces.py b/src/daComposant/daCore/Interfaces.py index 6d301ae..34508cb 100644 --- a/src/daComposant/daCore/Interfaces.py +++ b/src/daComposant/daCore/Interfaces.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2008-2021 EDF R&D +# Copyright (C) 2008-2022 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -522,7 +522,7 @@ class _SCDViewer(GenericCaseViewer): self._addLine("Analysis_config = {}") self._addLine("Analysis_config['From'] = 'String'") self._addLine("Analysis_config['Data'] = \"\"\"import numpy") - self._addLine("xa=numpy.ravel(ADD.get('Analysis')[-1])") + self._addLine("xa=ADD.get('Analysis')[-1]") self._addLine("print('Analysis:',xa)\"\"\"") self._addLine("study_config['UserPostAnalysis'] = Analysis_config") def __loadVariablesByScript(self): @@ -652,7 +652,7 @@ class _ReportViewer(GenericCaseViewer): if k == "self": continue if isinstance(__v,Persistence.Persistence): __v = __v.values() numpy.set_printoptions(precision=15,threshold=1000000,linewidth=1000*15) - __ktext += "\n %s = %s, "%(k,repr(__v)) + __ktext += "\n %s = %s,"%(k,repr(__v)) numpy.set_printoptions(precision=8,threshold=1000,linewidth=75) if len(__ktext) > 0: __text += " with values:" + __ktext @@ -764,12 +764,9 @@ class ImportDetector(object): else: return False def is_not_local_file(self): - if not os.path.isfile(os.path.realpath(self.__url)): - return True - else: - return False + return not self.is_local_file() def raise_error_if_not_local_file(self): - if not os.path.isfile(os.path.realpath(self.__url)): + if self.is_not_local_file(): raise ValueError("The name or the url of the file object doesn't seem to exist. The given name is:\n \"%s\""%str(self.__url)) else: return False @@ -782,12 +779,9 @@ class ImportDetector(object): else: return False def is_not_local_dir(self): - if not os.path.isdir(self.__url): - return True - else: - return False + return not self.is_local_dir() def raise_error_if_not_local_dir(self): - if not os.path.isdir(self.__url): + if self.is_not_local_dir(): raise ValueError("The name or the url of the directory object doesn't seem to exist. The given name is:\n \"%s\""%str(self.__url)) else: return False @@ -902,7 +896,7 @@ class ImportFromFile(object): __header.append(__line) __skiprows += 1 __line = fid.readline().strip() - __varsline = __line + __varsline = __line # Ligne de labels par convention for i in range(max(0,__nblines)): __header.append(fid.readline()) return (__header, __varsline, __skiprows) @@ -950,7 +944,7 @@ class ImportFromFile(object): return self.__supportedformats def getvalue(self, ColNames=None, ColIndex=None ): - "Renvoie la ou les variables demandees par la liste de leurs noms" + "Renvoie la ou les variables demandées par la liste de leurs noms" # Uniquement si mise à jour if ColNames is not None: self._colnames = tuple(ColNames) if ColIndex is not None: self._colindex = str(ColIndex) @@ -1061,7 +1055,7 @@ class ImportScalarLinesFromFile(ImportFromFile): raise ValueError("Unkown file format \"%s\""%self._format) # def getvalue(self, VarNames = None, HeaderNames=()): - "Renvoie la ou les variables demandees par la liste de leurs noms" + "Renvoie la ou les variables demandées par la liste de leurs noms" if VarNames is not None: __varnames = tuple(VarNames) else: __varnames = None # @@ -1095,7 +1089,7 @@ class ImportScalarLinesFromFile(ImportFromFile): for i in range(1,len(HeaderNames)): __converters[i] = __replaceNone else: - raise ValueError("Can not find names of columns for initial values. Wrong first line is:\n \"%s\""%__firstline) + raise ValueError("Can not find names of columns for initial values. Wrong first line is:\n \"%s\""%self._varsline) # if self._format == "text/plain": __content = numpy.loadtxt(self._filename, dtype = __dtypes, usecols = __usecols, skiprows = self._skiprows, converters = __converters)