parameters: (self)
docstring: Read data from json infos
docstring_summary: Read data from json infos
docstring_tokens: Read data from json infos
function: def restore(self):
          """Read data from json infos"""
          if os.path.exists(self._name + '.json'):
  
              # Fricking mpl kills locale setting to system default .. this went
              # horrible wrong for german 'decimal_point': ','
              pg.checkAndFixLocaleDecimal_point(verbose=False)
  
              try:
                  with open(self._name + '.json') as file:
                      self.info = json.load(file)
  
                  # if len(self.info['type']) != 1:
                  #     pg.error('only single return caches supported for now.')
  
                  if self.info['type'] == 'DataContainerERT':
                      self._value = pg.DataContainerERT(self.info['file'],
                                                        removeInvalid=False)
                      # print(self._value)
                  elif self.info['type'] == 'RVector':
                      self._value = pg.Vector()
                      self._value.load(self.info['file'], format=pg.core.Binary)
                  elif self.info['type'] == 'Mesh':
                      pg.tic()
                      self._value = pg.Mesh()
                      self._value.loadBinaryV2(self.info['file'] + '.bms')
                      pg.debug("Restoring cache took:", pg.dur(), "s")
                  elif self.info['type'] == 'ndarray':
                      self._value = np.load(self.info['file'] + '.npy',
                                            allow_pickle=True)
                  else:
                      self._value = np.load(self.info['file'] + '.npy',
                                            allow_pickle=True)
  
                  if self.value is not None:
                      self.info['restored'] = self.info['restored'] + 1
                      self.updateCacheInfo()
                      pg.info('Cache {3} restored ({1}s x {0}): {2}'.\
                          format(self.info['restored'],
                                 round(self.info['dur'], 1),
                                 self._name, self.info['codeinfo']))
                  else:
                      # default try numpy
                      pg.warn('Could not restore cache of type {0}.'.format(self.info['type']))
  
                  pg.debug("Restoring cache took:", pg.dur(), "s")
              except Exception as e:
                  import traceback
                  traceback.print_exc(file=sys.stdout)
                  print(self.info)
                  pg.error('Cache restoring failed.')
function_tokens: def restore ( self ) : if os . path . exists ( self . _name + '.json' ) : # Fricking mpl kills locale setting to system default .. this went # horrible wrong for german 'decimal_point': ',' pg . checkAndFixLocaleDecimal_point ( verbose = False ) try : with open ( self . _name + '.json' ) as file : self . info = json . load ( file ) # if len(self.info['type']) != 1: #     pg.error('only single return caches supported for now.') if self . info [ 'type' ] == 'DataContainerERT' : self . _value = pg . DataContainerERT ( self . info [ 'file' ] , removeInvalid = False ) # print(self._value) elif self . info [ 'type' ] == 'RVector' : self . _value = pg . Vector ( ) self . _value . load ( self . info [ 'file' ] , format = pg . core . Binary ) elif self . info [ 'type' ] == 'Mesh' : pg . tic ( ) self . _value = pg . Mesh ( ) self . _value . loadBinaryV2 ( self . info [ 'file' ] + '.bms' ) pg . debug ( "Restoring cache took:" , pg . dur ( ) , "s" ) elif self . info [ 'type' ] == 'ndarray' : self . _value = np . load ( self . info [ 'file' ] + '.npy' , allow_pickle = True ) else : self . _value = np . load ( self . info [ 'file' ] + '.npy' , allow_pickle = True ) if self . value is not None : self . info [ 'restored' ] = self . info [ 'restored' ] + 1 self . updateCacheInfo ( ) pg . info ( 'Cache {3} restored ({1}s x {0}): {2}' . format ( self . info [ 'restored' ] , round ( self . info [ 'dur' ] , 1 ) , self . _name , self . info [ 'codeinfo' ] ) ) else : # default try numpy pg . warn ( 'Could not restore cache of type {0}.' . format ( self . info [ 'type' ] ) ) pg . debug ( "Restoring cache took:" , pg . dur ( ) , "s" ) except Exception as e : import traceback traceback . print_exc ( file = sys . stdout ) print ( self . info ) pg . error ( 'Cache restoring failed.' )