Convenience utility
423448
private static byte[] toByteArray(InputStream is) throws IOException {
    try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
      byte[] buffer = new byte[0x2000];
      for (int len; (len = is.read(buffer)) != -1; )
        os.write(buffer, 0, len);
      return os.toByteArray();
    }
  }
119691
def checkout(self, *args, **kwargs):
        """"""
        self._call_helper("Checking out", self.real.checkout, *args, **kwargs)
758600
function load( available, toLoad ) {
    let loadList = available;
    if ('string' === typeof toLoad ) {
      loadList = [toLoad];
    }
    if (Array.isArray(toLoad)) {
      loadList = toLoad;
    }
    loadList.forEach(function( name ) {
      if ( available.indexOf(name) < 0 ) {
        return;
      }
      require('./'+name);
    });
  }
1370586
@CheckResult
    @NonNull
    public final PowerAdapter showOnlyWhile(@NonNull Condition condition) {
        checkNotNull(condition, "condition");
        if (condition instanceof ConstantCondition) {
            if (condition.eval()) {
                return this;
            } else {
                return EMPTY;
            }
        }
        return new ConditionalAdapter(this, condition);
    }
31286
function use (hardware, callback) {
  if (!hardware) {
    // Set default configuration
    hardware = require('tessel').port['GPIO'].pin['A1'];
  }
  return new PulseSensor(hardware, callback);
}
820327
def ui_func(cls, id_, name, function_type, avail_fn=always):
    """"""
    return cls(id_, name, 0, 0, function_type, FUNCTION_TYPES[function_type],
               avail_fn)
140696
def filter(self, other=None):
        

        if not other:
            other = Fuse.fuseoptref()

        return SubOptsHive.filter(self, other)
1300620
def create_usage(self, sub_add_on, usage):
        """"""
        url = urljoin(self._url, '/add_ons/%s/usage' % (sub_add_on.add_on_code,))
        return usage.post(url)
506655
def choose_one(things):
    """"""
    choice = SystemRandom().randint(0, len(things) - 1)
    return things[choice].strip()
433209
def utils(opts, whitelist=None, context=None, proxy=proxy):
    '''
    
    '''
    return LazyLoader(
        _module_dirs(opts, 'utils', ext_type_dirs='utils_dirs'),
        opts,
        tag='utils',
        whitelist=whitelist,
        pack={'__context__': context, '__proxy__': proxy or {}},
    )
1316049
function random (utxos, outputs, feeRate) {
  utxos = shuffle(utxos)

  return accumulative(utxos, outputs, feeRate)
}
1361323
def _compact(*args):
    """"""
    ret = {}
    if len(args) == 1:
        args = args[0]
        if isinstance(args, ListValue):
            args = args.value
        if isinstance(args, dict):
            for i, item in args.items():
                if bool(item):
                    ret[i] = item
        elif bool(args):
            ret[0] = args
    else:
        for i, item in enumerate(args):
            if bool(item):
                ret[i] = item
    return ListValue(ret)
614925
def Indirect(self, off):
        """"""
        N.enforce_number(off, N.UOffsetTFlags)
        return off + encode.Get(N.UOffsetTFlags.packer_type, self.Bytes, off)
1365726
function switchAndClear(pkg) {
    switchState(false, pkg);

    //unload proxy routes
    proxy.deleteBy(app.config.get('public-port'), {user: pkg.user, appid: pkg.name});
  }
122230
async def power(source, exponent):
    """"""
    async with streamcontext(source) as streamer:
        async for item in streamer:
            yield item ** exponent
1044740
def update_energy(self, bypass_check=False):
        """"""
        for outlet in self.outlets:
            outlet.update_energy(bypass_check)
466400
def switch(self, idx, control):
        """"""
        old = None
        new = None
        if control == 'Q':
            if self.PQ[idx] == 1:
                old = 'PQ'
                new = 'PV'
            elif self.vQ[idx] == 1:
                old = 'vQ'
                new = 'vV'
        elif control == 'P':
            if self.PQ[idx] == 1:
                old = 'PQ'
                new = 'vQ'
            elif self.PV[idx] == 1:
                old = 'PV'
                new = 'vV'
        elif control == 'V':
            if self.PV[idx] == 1:
                old = 'PV'
                new = 'PQ'
            elif self.vV[idx] == 1:
                old = 'vV'
                new = 'vQ'
        elif control == 'v':
            if self.vQ[idx] == 1:
                old = 'vQ'
                new = 'PQ'
            elif self.vV[idx] == 1:
                old = 'vV'
                new = 'PV'
        if old and new:
            self.__dict__[old][idx] = 0
            self.__dict__[new][idx] = 1