Creates a new Meter and stores is in the hash
325666
def cache(name, value, created_on)
      meter = Meter.new(name: name, value: value, created_on: created_on, created_at: Time.now)
      store(name, meter)
    end
979972
def create_hash(self, initial, capacity, error):
        
        self.hash = 0
        self.hashbits, self.num_hashes = self._optimal_size(capacity, error)

        if len(initial):
            if type(initial) == str:
                self.add(initial)
            else:
                for t in initial:
                    self.add(t)
734007
def meter(self, key, **dims):
        """"""
        return super(MetricsRegistry, self).meter(
            self.metadata.register(key, **dims))
265962
function HashThrough (createHash) {
  const hashThrough = new Transform()

  const hash = createHash()

  hashThrough._transform = function (chunk, encoding, cb) {
    setImmediate(_ => {
      try {
        hash.update(chunk)
        cb(null, chunk)
      } catch (err) {
        cb(err)
      }
    })
  }

  // bind the digest function to hash object
  hashThrough.digest = format => hash.digest(format)

  return hashThrough
}
1373258
def store(self, measurement):
        
        os.makedirs(self._getPathToMeasurementMetaDir(measurement.idAsPath), exist_ok=True)
        output = marshal(measurement, measurementFields)
        with open(self._getPathToMeasurementMetaFile(measurement.idAsPath), 'w') as outfile:
            json.dump(output, outfile)
        return output
1323170
def create_from_hash(hash, ezo):
        '''
        
        '''

        cp, err = ezo.db.get("contracts", hash)
        if err:
            return None, err

        # create a new Contract
        c = Contract(cp["name"], ezo)
        c.abi = cp["abi"]
        c.bin = cp["bin"]
        c.hash = cp["hash"]
        c.source = cp["source"]
        c.timestamp = cp["timestamp"]
        c.te_map = cp['te-map']

        return c, None
170525
def each
      pos = hash_size
      hoff0 = @hashes[0]
      while pos < hoff0
        key, value = *read_entry(pos)
        yield(key,value)
        pos += key.length + value.length + hashref_size
      end
    end
283701
@Override
  public Meter meter(String name) {
    final com.codahale.metrics.Meter meter = registry.meter(name);
    return new Meter() {
      @Override
      public void mark() {
        meter.mark();
      }

      @Override
      public void mark(long size) {
        meter.mark(size);
      }
    };
  }
260340
def add_measurement(key, options = {})
      if options.is_a?(Hash)
        self.measurements << Measurement.lookup(key).new(options)
      else
        self.measurements << options
      end
    end
240124
def create(self, **kwargs):
        """"""
        if 'monitor' in kwargs:
            value = self._format_monitor_parameter(kwargs['monitor'])
            kwargs['monitor'] = value
        return super(Pool, self)._create(**kwargs)
1302018
def make_measurement(name,
                     channels,
                     lumi=1.0, lumi_rel_error=0.1,
                     output_prefix='./histfactory',
                     POI=None,
                     const_params=None,
                     verbose=False):
    
    if verbose:
        llog = log['make_measurement']
        llog.info("creating measurement {0}".format(name))

    if not isinstance(channels, (list, tuple)):
        channels = [channels]

    # Create the measurement
    meas = Measurement('measurement_{0}'.format(name), '')
    meas.SetOutputFilePrefix(output_prefix)
    if POI is not None:
        if isinstance(POI, string_types):
            if verbose:
                llog.info("setting POI {0}".format(POI))
            meas.SetPOI(POI)
        else:
            if verbose:
                llog.info("adding POIs {0}".format(', '.join(POI)))
            for p in POI:
                meas.AddPOI(p)

    if verbose:
        llog.info("setting lumi={0:f} +/- {1:f}".format(lumi, lumi_rel_error))
    meas.lumi = lumi
    meas.lumi_rel_error = lumi_rel_error

    for channel in channels:
        if verbose:
            llog.info("adding channel {0}".format(channel.GetName()))
        meas.AddChannel(channel)

    if const_params is not None:
        if verbose:
            llog.info("adding constant parameters {0}".format(
                ', '.join(const_params)))
        for param in const_params:
            meas.AddConstantParam(param)

    return meas
1205288
def password=(new_password)
      if algorithm.kind_of?(Array) then
        @algorithm = Algorithm.algorithm_from_name(Algorithm::CRYPT)
      end
      @digest = calc_digest(new_password)
    end
703798
private int insertNewKey(Object key, int hash) {
        if (check && occupiedCount != keyCount) Kit.codeBug();
        if (check && keyCount == 1 << power) Kit.codeBug();
        int fraction = hash * A;
        int index = fraction >>> (32 - power);
        int N = 1 << power;
        if (keys[index] != null) {
            int mask = N - 1;
            int step = tableLookupStep(fraction, mask, power);
            int firstIndex = index;
            do {
                if (check && keys[index] == DELETED) Kit.codeBug();
                index = (index + step) & mask;
                if (check && firstIndex == index) Kit.codeBug();
            } while (keys[index] != null);
        }
        keys[index] = key;
        values[N + index] = hash;
        ++occupiedCount;
        ++keyCount;

        return index;
    }
765076
def create(key, value, options = {})
      if key? key
        false
      else
        store(key, value, options)
        true
      end
    end
1218353
def _create_and_save_state(cls, mapreduce_spec, _app):
    
    state = model.MapreduceState.create_new(mapreduce_spec.mapreduce_id)
    state.mapreduce_spec = mapreduce_spec
    state.active = True
    state.active_shards = 0
    if _app:
      state.app_id = _app
    config = util.create_datastore_write_config(mapreduce_spec)
    state.put(config=config)
    return state
952480
def expanded
            h = Hash.new
            [:id, :email, :api_key, :name, :phone, :password,:states, :approval, :suspend,
            :registration_ip_address, :dates, :some_msg].each do |setting|
                if grouped = self.send("#{setting}").is_a?(Hash)
                    self.send("#{setting}").each {|k,v|   h[k.to_sym] = v}
                else
                    h[setting] = self.send("#{setting}")
                end
            end
            h
        end
1323698
function (password, algorithm, salt) {

            return {
                hash: this.createHash(password, algorithm, salt),
                loginAttempts: 0,
                loginBlocked: null
            }

        }