Exemplo n.º 1
0
 def _read_data(self, field_name):
     self.requested.append(field_name)
     finfo = self.ds._get_field_info(*field_name)
     if finfo.particle_type:
         self.requested.append(field_name)
         return np.ones(self.NumberOfParticles)
     return YTArray(defaultdict.__missing__(self, field_name),
                    input_units=finfo.units,
                    registry=self.ds.unit_registry)
 def _read_data(self, field_name):
     self.requested.append(field_name)
     if hasattr(self.ds, "field_info"):
         finfo = self.ds._get_field_info(*field_name)
     else:
         finfo = FieldInfo[field_name]
     if finfo.particle_type:
         self.requested.append(field_name)
         return np.ones(self.NumberOfParticles)
     return YTArray(defaultdict.__missing__(self, field_name),
                    input_units=finfo.units,
                    registry=self.ds.unit_registry)
Exemplo n.º 3
0
 def __missing__(self, key):
     if self.verbose:
         if '|' in key:
             for k_ in key.split('|'):
                 k_ = k_.strip()
                 if k_[0]+k_[-1] in ['""', "''"]:
                     return k_[1:-1]
                 v = self[k_]
                 if v:
                     return v
         if key.endswith('-start-list') or key.endswith('-end-list'):
             return ''
         print('templating.verbosedefaultdict:{}: not implemented key: {}'
               .format(self.name, key))
         print('  existing keys: {}'.format(','.join(sorted(self))))
         return '/* {!r} not implemented */'.format(key)
     return defaultdict.__missing__(self, key)
Exemplo n.º 4
0
    def __missing__(self, key):
        attr = "__%s__" % key
        if not hasattr(Base, attr):
            return defaultdict.__missing__(self, key)

        return getattr(Base, attr)
Exemplo n.º 5
0
    def __missing__(self, key):
        attr = "__%s__" % key
        if not hasattr(Base, attr):
            return defaultdict.__missing__(self, key)

        return getattr(Base, attr)
Exemplo n.º 6
0
 def __missing__(self, key):
     if self.default_factory:
         dict.__setitem__(self, key, self.default_factory(key))
         return self[key]
     else:
         defaultdict.__missing__(self, key)
Exemplo n.º 7
0
 def __missing__(self, key):
     if self.default_factory:
         self[key] = self.default_factory(key)
         return self[key]
     else:
         defaultdict.__missing__(self, key)
Exemplo n.º 8
0
 def __missing__(self, *args, **kwargs):
     # Avoid all kind of private function calls
     if not args[0][0] == '_':
         return defaultdict.__missing__(self, *args, **kwargs)
Exemplo n.º 9
0
 def __missing__(self, *args, **kwargs):
     # Avoid all kind of private function calls
     if not args[0][0] == '_':
         return defaultdict.__missing__(self, *args, **kwargs)
Exemplo n.º 10
0
 def __missing__(self, key):
     if self.default_factory:
         dict.__setitem__(self, key, self.default_factory(key))
         return self[key]
     else:
         defaultdict.__missing__(self, key)
Exemplo n.º 11
0
    def __missing__(self, key):
        attr = "__{0}__".format(key)
        if not hasattr(Base, attr):
            return defaultdict.__missing__(self, key)

        return getattr(Base, attr)
Exemplo n.º 12
0
 def __missing__(self, key):
     self.active_notes.add(key)
     return defaultdict.__missing__(self, key)