Helper function to The Foundry Nuke support
174221
def _install_nuke(use_threaded_wrapper):
    """"""
    import nuke

    not_nuke_launch = (
        "--hiero" in nuke.rawArgs or
        "--studio" in nuke.rawArgs or
        "--nukeassist" in nuke.rawArgs
    )
    if not_nuke_launch:
        raise ImportError

    def threaded_wrapper(func, *args, **kwargs):
        return nuke.executeInMainThreadWithResult(
            func, args, kwargs)

    _common_setup("Nuke", threaded_wrapper, use_threaded_wrapper)
1328656
def get(cls, reactor, source='graphite', **options):
        """"""
        acls = cls.alerts[source]
        return acls(reactor, **options)
670168
def projectEmitter(target, source, env):
    """"""

    # todo: Not sure what sets source to what user has passed as target,
    # but this is what happens. When that is fixed, we also won't have
    # to make the user always append env['MSVSPROJECTSUFFIX'] to target.
    if source[0] == target[0]:
        source = []

    # make sure the suffix is correct for the version of MSVS we're running.
    (base, suff) = SCons.Util.splitext(str(target[0]))
    suff = env.subst('$MSVSPROJECTSUFFIX')
    target[0] = base + suff

    if not source:
        source = 'prj_inputs:'
        source = source + env.subst('$MSVSSCONSCOM', 1)
        source = source + env.subst('$MSVSENCODING', 1)

        # Project file depends on CPPDEFINES and CPPPATH
        preprocdefs = xmlify(';'.join(processDefines(env.get('CPPDEFINES', []))))
        includepath_Dirs = processIncludes(env.get('CPPPATH', []), env, None, None)
        includepath = xmlify(';'.join([str(x) for x in includepath_Dirs]))
        source = source + "; ppdefs:%s incpath:%s"%(preprocdefs, includepath)

        if 'buildtarget' in env and env['buildtarget'] != None:
            if SCons.Util.is_String(env['buildtarget']):
                source = source + ' "%s"' % env['buildtarget']
            elif SCons.Util.is_List(env['buildtarget']):
                for bt in env['buildtarget']:
                    if SCons.Util.is_String(bt):
                        source = source + ' "%s"' % bt
                    else:
                        try: source = source + ' "%s"' % bt.get_abspath()
                        except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
            else:
                try: source = source + ' "%s"' % env['buildtarget'].get_abspath()
                except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")

        if 'outdir' in env and env['outdir'] != None:
            if SCons.Util.is_String(env['outdir']):
                source = source + ' "%s"' % env['outdir']
            elif SCons.Util.is_List(env['outdir']):
                for s in env['outdir']:
                    if SCons.Util.is_String(s):
                        source = source + ' "%s"' % s
                    else:
                        try: source = source + ' "%s"' % s.get_abspath()
                        except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
            else:
                try: source = source + ' "%s"' % env['outdir'].get_abspath()
                except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")

        if 'name' in env:
            if SCons.Util.is_String(env['name']):
                source = source + ' "%s"' % env['name']
            else:
                raise SCons.Errors.InternalError("name must be a string")

        if 'variant' in env:
            if SCons.Util.is_String(env['variant']):
                source = source + ' "%s"' % env['variant']
            elif SCons.Util.is_List(env['variant']):
                for variant in env['variant']:
                    if SCons.Util.is_String(variant):
                        source = source + ' "%s"' % variant
                    else:
                        raise SCons.Errors.InternalError("name must be a string or a list of strings")
            else:
                raise SCons.Errors.InternalError("variant must be a string or a list of strings")
        else:
            raise SCons.Errors.InternalError("variant must be specified")

        for s in _DSPGenerator.srcargs:
            if s in env:
                if SCons.Util.is_String(env[s]):
                    source = source + ' "%s' % env[s]
                elif SCons.Util.is_List(env[s]):
                    for t in env[s]:
                        if SCons.Util.is_String(t):
                            source = source + ' "%s"' % t
                        else:
                            raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
                else:
                    raise SCons.Errors.InternalError(s + " must be a string or a list of strings")

        source = source + ' "%s"' % str(target[0])
        source = [SCons.Node.Python.Value(source)]

    targetlist = [target[0]]
    sourcelist = source

    if env.get('auto_build_solution', 1):
        env['projects'] = [env.File(t).srcnode() for t in targetlist]
        t, s = solutionEmitter(target, target, env)
        targetlist = targetlist + t

    # Beginning with Visual Studio 2010 for each project file (.vcxproj) we have additional file (.vcxproj.filters)
    version_num = 6.0
    if 'MSVS_VERSION' in env:
        version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
    if version_num >= 10.0:
        targetlist.append(targetlist[0] + '.filters')

    return (targetlist, sourcelist)
1109643
def select_forge(default = :gforge, _options = {})
      forge = FalkorLib::Config::Bootstrap::DEFAULTS[:forge]
      #ap forge
      default_idx = forge.keys.index(default)
      default_idx = 0 if default_idx.nil?
      v = select_from(forge.map { |_k, u| u[:name] },
                      "Select the Forge hosting the project sources",
                      default_idx + 1,
                      forge.keys)
      v
    end
706854
function(buildOutputDirectory) {
    createPercyBuildInvoked = true;

    var token = process.env.PERCY_TOKEN;
    var apiUrl = process.env.PERCY_API; // Optional.

    // Disable if Percy is explicitly disabled or if this is not an 'ember test' run.
    if (process.env.PERCY_ENABLE == '0' || process.env.EMBER_ENV !== 'test') {
      isPercyEnabled = false;
    }

    if (token && isPercyEnabled) {
      console.warn('[percy] Percy is running.');
      percyClient = new PercyClient({
        token: token,
        apiUrl: apiUrl,
        clientInfo: this._clientInfo(),
        environmentInfo: this._environmentInfo(),
      });
    } else {
      isPercyEnabled = false;
      if (!token) {
        console.warn(
          '[percy][WARNING] Percy is disabled, no PERCY_TOKEN environment variable found.')
      }
    }

    if (!isPercyEnabled) { return; }

    var resources = percyClient.gatherBuildResources(buildOutputDirectory, {
      baseUrlPath: percyConfig.baseUrlPath,
      skippedPathRegexes: SKIPPED_ASSETS,
    });

    // Initialize the percy client and a new build.
    percyBuildPromise = percyClient.createBuild({resources: resources});

    // Return a promise and only resolve when all build resources are uploaded, which
    // ensures that the output build dir is still available to be read from before deleted.
    return new Promise(function(resolve) {
      percyBuildPromise.then(
        function(buildResponse) {
          var percyBuildData = buildResponse.body.data;
          console.log('\n[percy] Build created:', percyBuildData.attributes['web-url']);

          // Upload all missing build resources.
          var missingResources = parseMissingResources(buildResponse);
          if (missingResources && missingResources.length > 0) {

            // Note that duplicate resources with the same SHA will get clobbered here into this
            // hash, but that is ok since we only use this to access the content below for upload.
            var hashToResource = {};
            resources.forEach(function(resource) {
              hashToResource[resource.sha] = resource;
            });

            var missingResourcesIndex = 0;
            var promiseGenerator = function() {
              var missingResource = missingResources[missingResourcesIndex];
              missingResourcesIndex++;

              if (missingResource) {
                var resource = hashToResource[missingResource.id];
                var content = fs.readFileSync(resource.localPath);

                // Start the build resource upload and add it to a collection we can block on later
                // because build resources must be fully uploaded before snapshots are finalized.
                var promise = percyClient.uploadResource(percyBuildData.id, content);
                promise.then(function() {
                  console.log('\n[percy] Uploaded new build resource: ' + resource.resourceUrl);
                }, handlePercyFailure);
                buildResourceUploadPromises.push(promise);

                return promise;
              } else {
                // Trigger the pool to end.
                return null;
              }
            }

            // We do this in a promise pool for two reasons: 1) to limit the number of files that
            // are held in memory concurrently, and 2) without a pool, all upload promises are
            // created at the same time and request-promise timeout settings begin immediately,
            // which timeboxes ALL uploads to finish within one timeout period. With a pool, we
            // defer creation of the upload promises, which makes timeouts apply more individually.
            var concurrency = 2;
            var pool = new PromisePool(promiseGenerator, concurrency);

            // Wait for all build resource uploads before we allow the addon build step to complete.
            // If an upload failed, resolve anyway to unblock the building process.
            pool.start().then(resolve, resolve);
          } else {
            // No missing resources.
            resolve();
          }
        },

        function(error) {
          handlePercyFailure(error);

          // If Percy build creation fails, resolve anyway to unblock the building process.
          resolve();
        }
      );
    });
  }
7278
def _pot_update_emitter(target, source, env):
    
    from SCons.Tool.GettextCommon import _POTargetFactory
    import SCons.Util
    import SCons.Node.FS

    if 'XGETTEXTFROM' in env:
        xfrom = env['XGETTEXTFROM']
    else:
        return target, source
    if not SCons.Util.is_List(xfrom):
        xfrom = [xfrom]

    xfrom = SCons.Util.flatten(xfrom)

    # Prepare list of 'POTFILE.in' files.
    files = []
    for xf in xfrom:
        if not isinstance(xf, SCons.Node.FS.Base):
            if SCons.Util.is_String(xf):
                # Interpolate variables in strings
                xf = env.subst(xf, source=source, target=target)
            xf = env.arg2nodes(xf)
        files.extend(xf)
    if files:
        env.Depends(target, files)
        _scan_xgettext_from_files(target, source, env, files)
    return target, source
629053
@EnsuresNonNull("fn")
  private Function getCompiledScript()
  {
    // JavaScript configuration should be checked when it's actually used because someone might still want Druid
    // nodes to be able to deserialize JavaScript-based objects even though JavaScript is disabled.
    Preconditions.checkState(config.isEnabled(), "JavaScript is disabled");

    Function syncedFn = fn;
    if (syncedFn == null) {
      synchronized (config) {
        syncedFn = fn;
        if (syncedFn == null) {
          syncedFn = compile(function);
          fn = syncedFn;
        }
      }
    }
    return syncedFn;
  }
1101478
function() {
      var csr = new tr.ClockSyncRecord('ftrace_importer', 0, {});
      this.model_.clockSyncRecords.push(csr);
      if (this.stackFrameEvents_) {
        this.importStackFrames_(
            this.stackFrameEvents_, 'g', false /* addRootFrame */);
      }

      if (this.traceAnnotations_)
        this.importAnnotations_();

      var events = this.events_;
      for (var eI = 0; eI < events.length; eI++) {
        var event = events[eI];
        if (event.args === '__stripped__') {
          event.argsStripped = true;
          event.args = undefined;
        }

        if (event.ph === 'B' || event.ph === 'E') {
          this.processDurationEvent(event);

        } else if (event.ph === 'X') {
          var slice = this.processCompleteEvent(event);
          // TODO(yuhaoz): If Chrome supports creating other events with flow,
          // we will need to call processFlowEvent for them also.
          // https://github.com/catapult-project/catapult/issues/1259
          if (slice !== undefined && event.bind_id !== undefined)
            this.processFlowEvent(event, slice);

        } else if (event.ph === 'b' || event.ph === 'e' || event.ph === 'n' ||
                   event.ph === 'S' || event.ph === 'F' || event.ph === 'T' ||
                   event.ph === 'p') {
          this.processAsyncEvent(event);

        // Note, I is historic. The instant event marker got changed, but we
        // want to support loading old trace files so we have both I and i.
        } else if (event.ph === 'I' || event.ph === 'i' || event.ph === 'R') {
          this.processInstantEvent(event);

        } else if (event.ph === 'P') {
          this.processTraceSampleEvent(event);

        } else if (event.ph === 'C') {
          this.processCounterEvent(event);

        } else if (event.ph === 'M') {
          this.processMetadataEvent(event);

        } else if (event.ph === 'N' || event.ph === 'D' || event.ph === 'O') {
          this.processObjectEvent(event);

        } else if (event.ph === 's' || event.ph === 't' || event.ph === 'f') {
          this.processFlowEvent(event);

        } else if (event.ph === 'v') {
          this.processMemoryDumpEvent(event);

        } else {
          this.model_.importWarning({
            type: 'parse_error',
            message: 'Unrecognized event phase: ' +
                event.ph + ' (' + event.name + ')'
          });
        }
      }

      // Remove all the root stack frame children as they should
      // already be added.
      tr.b.iterItems(this.v8ProcessRootStackFrame_, function(name, frame) {
        frame.removeAllChildren();
      });
    }
966000
public void command_factory()
	{
		command_list.addElement(new DevRestartCmd(
					"DevRestart",
					Tango_DEV_STRING,
					Tango_DEV_VOID,
					"Device name"));
		command_list.addElement(new RestartServerCmd(
					"RestartServer",
					Tango_DEV_VOID,
					Tango_DEV_VOID));
		command_list.addElement(new QueryClassCmd(
					"QueryClass",
					Tango_DEV_VOID,
					Tango_DEVVAR_STRINGARRAY,
					"Device server class(es) list"));
		command_list.addElement(new QueryDeviceCmd(
					"QueryDevice",
					Tango_DEV_VOID,
					Tango_DEVVAR_STRINGARRAY,
					"Device server device(s) list"));
		command_list.addElement(new KillCmd(
					"Kill",
					Tango_DEV_VOID,
					Tango_DEV_VOID));
		command_list.addElement(new AddLoggingTargetCmd(
					"AddLoggingTarget",
					Tango_DEVVAR_STRINGARRAY,
					Tango_DEV_VOID,
					"Str[i]=Device-name - Str[i+1]=target_type::target_name"));
		command_list.addElement(new RemoveLoggingTargetCmd(
					"RemoveLoggingTarget",
					Tango_DEVVAR_STRINGARRAY,
					Tango_DEV_VOID,
					"Str[i]=Device-name - Str[i+1]=target_type::target_name"));
		command_list.addElement(new GetLoggingTargetCmd("GetLoggingTarget",
					Tango_DEV_STRING,
					Tango_DEVVAR_STRINGARRAY,
					"Device name",
					"Logging target list"));
		command_list.addElement(new SetLoggingLevelCmd(
					"SetLoggingLevel",
					Tango_DEVVAR_LONGSTRINGARRAY,
                    Tango_DEV_VOID,
                    "Lg[i]=Logging level. Str[i]=Device name."));
		command_list.addElement(new GetLoggingLevelCmd(
					"GetLoggingLevel",
					Tango_DEVVAR_STRINGARRAY,
                    Tango_DEVVAR_LONGSTRINGARRAY,
                    "Device list",
                    "Lg[i]=Logging level. Str[i]=Device name."));
		command_list.addElement(new StopLoggingCmd(
					"StopLogging",
					Tango_DEV_VOID,
					Tango_DEV_VOID));
		command_list.addElement(new StartLoggingCmd(
					"StartLogging",
					Tango_DEV_VOID,
					Tango_DEV_VOID));

		// Now, commands related to polling
		command_list.addElement(new PolledDeviceCmd(
					"PolledDevice",
					Tango_DEV_VOID,
					Tango_DEVVAR_STRINGARRAY,
					"Polled device name list"));
		command_list.addElement(new DevPollStatusCmd(
					"DevPollStatus",
					Tango_DEV_STRING,
					Tango_DEVVAR_STRINGARRAY,
					"Device name",
					"Device polling status"));

		String	msg = "Lg[0]=Upd period. Str[0]=Device name. Str[1]=Object type. Str[2]=Object name";
		command_list.addElement(new AddObjPollingCmd(
					"AddObjPolling",
					Tango_DEVVAR_LONGSTRINGARRAY,
					Tango_DEV_VOID,
					msg));
						    
		command_list.addElement(new UpdObjPollingPeriodCmd(
					"UpdObjPollingPeriod",
					Tango_DEVVAR_LONGSTRINGARRAY,
					Tango_DEV_VOID,
					msg));

		msg = "Lg[0]=Upd period. Str[0]=Device name. Str[1]=Object type. Str[2]=Object name";
		command_list.addElement(new RemObjPollingCmd(
					"RemObjPolling",
					Tango_DEVVAR_STRINGARRAY,
					Tango_DEV_VOID,
					msg));
						    
		command_list.addElement(new StopPollingCmd(
					"StopPolling",
					Tango_DEV_VOID,
					Tango_DEV_VOID));
						  
		command_list.addElement(new StartPollingCmd(
					"StartPolling",
					Tango_DEV_VOID,
					Tango_DEV_VOID));
}
978779
def dbfpack(fn, usecols=None):
    """"""

    loadfunc = pulldbf.dbf_asdict
    cp = ChannelPack(loadfunc)
    cp.load(fn, usecols)
    names = pulldbf.channel_names(fn, usecols)
    cp.set_channel_names(names)
    # cp.set_basefilemtime()
    return cp
572604
function initModule(forge) {

// forge.prime already defined
if(forge.prime) {
  return;
}

/* PRIME API */
var prime = forge.prime = forge.prime || {};

var BigInteger = forge.jsbn.BigInteger;

// primes are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29
var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2];
var THIRTY = new BigInteger(null);
THIRTY.fromInt(30);
var op_or = function(x, y) {return x|y;};

/**
 * Generates a random probable prime with the given number of bits.
 *
 * Alternative algorithms can be specified by name as a string or as an
 * object with custom options like so:
 *
 * {
 *   name: 'PRIMEINC',
 *   options: {
 *     maxBlockTime: <the maximum amount of time to block the main
 *       thread before allowing I/O other JS to run>,
 *     millerRabinTests: <the number of miller-rabin tests to run>,
 *     workerScript: <the worker script URL>,
 *     workers: <the number of web workers (if supported) to use,
 *       -1 to use estimated cores minus one>.
 *     workLoad: the size of the work load, ie: number of possible prime
 *       numbers for each web worker to check per work assignment,
 *       (default: 100).
 *   }
 * }
 *
 * @param bits the number of bits for the prime number.
 * @param options the options to use.
 *          [algorithm] the algorithm to use (default: 'PRIMEINC').
 *          [prng] a custom crypto-secure pseudo-random number generator to use,
 *            that must define "getBytesSync".
 *
 * @return callback(err, num) called once the operation completes.
 */
prime.generateProbablePrime = function(bits, options, callback) {
  if(typeof options === 'function') {
    callback = options;
    options = {};
  }
  options = options || {};

  // default to PRIMEINC algorithm
  var algorithm = options.algorithm || 'PRIMEINC';
  if(typeof algorithm === 'string') {
    algorithm = {name: algorithm};
  }
  algorithm.options = algorithm.options || {};

  // create prng with api that matches BigInteger secure random
  var prng = options.prng || forge.random;
  var rng = {
    // x is an array to fill with bytes
    nextBytes: function(x) {
      var b = prng.getBytesSync(x.length);
      for(var i = 0; i < x.length; ++i) {
        x[i] = b.charCodeAt(i);
      }
    }
  };

  if(algorithm.name === 'PRIMEINC') {
    return primeincFindPrime(bits, rng, algorithm.options, callback);
  }

  throw new Error('Invalid prime generation algorithm: ' + algorithm.name);
};

function primeincFindPrime(bits, rng, options, callback) {
  if('workers' in options) {
    return primeincFindPrimeWithWorkers(bits, rng, options, callback);
  }
  return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);
}

function primeincFindPrimeWithoutWorkers(bits, rng, options, callback) {
  // initialize random number
  var num = generateRandom(bits, rng);

  /* Note: All primes are of the form 30k+i for i < 30 and gcd(30, i)=1. The
  number we are given is always aligned at 30k + 1. Each time the number is
  determined not to be prime we add to get to the next 'i', eg: if the number
  was at 30k + 1 we add 6. */
  var deltaIdx = 0;

  // get required number of MR tests
  var mrTests = getMillerRabinTests(num.bitLength());
  if('millerRabinTests' in options) {
    mrTests = options.millerRabinTests;
  }

  // find prime nearest to 'num' for maxBlockTime ms
  // 10 ms gives 5ms of leeway for other calculations before dropping
  // below 60fps (1000/60 == 16.67), but in reality, the number will
  // likely be higher due to an 'atomic' big int modPow
  var maxBlockTime = 10;
  if('maxBlockTime' in options) {
    maxBlockTime = options.maxBlockTime;
  }
  var start = +new Date();
  do {
    // overflow, regenerate random number
    if(num.bitLength() > bits) {
      num = generateRandom(bits, rng);
    }
    // do primality test
    if(num.isProbablePrime(mrTests)) {
      return callback(null, num);
    }
    // get next potential prime
    num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0);
  } while(maxBlockTime < 0 || (+new Date() - start < maxBlockTime));

  // keep trying (setImmediate would be better here)
  forge.util.setImmediate(function() {
    primeincFindPrimeWithoutWorkers(bits, rng, options, callback);
  });
}

function primeincFindPrimeWithWorkers(bits, rng, options, callback) {
  // web workers unavailable
  if(typeof Worker === 'undefined') {
    return primeincFindPrimeWithoutWorkers(bits, rng, options, callback);
  }

  // initialize random number
  var num = generateRandom(bits, rng);

  // use web workers to generate keys
  var numWorkers = options.workers;
  var workLoad = options.workLoad || 100;
  var range = workLoad * 30 / 8;
  var workerScript = options.workerScript || 'forge/prime.worker.js';
  if(numWorkers === -1) {
    return forge.util.estimateCores(function(err, cores) {
      if(err) {
        // default to 2
        cores = 2;
      }
      numWorkers = cores - 1;
      generate();
    });
  }
  generate();

  function generate() {
    // require at least 1 worker
    numWorkers = Math.max(1, numWorkers);

    // TODO: consider optimizing by starting workers outside getPrime() ...
    // note that in order to clean up they will have to be made internally
    // asynchronous which may actually be slower

    // start workers immediately
    var workers = [];
    for(var i = 0; i < numWorkers; ++i) {
      // FIXME: fix path or use blob URLs
      workers[i] = new Worker(workerScript);
    }
    var running = numWorkers;

    // listen for requests from workers and assign ranges to find prime
    for(var i = 0; i < numWorkers; ++i) {
      workers[i].addEventListener('message', workerMessage);
    }

    /* Note: The distribution of random numbers is unknown. Therefore, each
    web worker is continuously allocated a range of numbers to check for a
    random number until one is found.

    Every 30 numbers will be checked just 8 times, because prime numbers
    have the form:

    30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this)

    Therefore, if we want a web worker to run N checks before asking for
    a new range of numbers, each range must contain N*30/8 numbers.

    For 100 checks (workLoad), this is a range of 375. */

    var found = false;
    function workerMessage(e) {
      // ignore message, prime already found
      if(found) {
        return;
      }

      --running;
      var data = e.data;
      if(data.found) {
        // terminate all workers
        for(var i = 0; i < workers.length; ++i) {
          workers[i].terminate();
        }
        found = true;
        return callback(null, new BigInteger(data.prime, 16));
      }

      // overflow, regenerate random number
      if(num.bitLength() > bits) {
        num = generateRandom(bits, rng);
      }

      // assign new range to check
      var hex = num.toString(16);

      // start prime search
      e.target.postMessage({
        hex: hex,
        workLoad: workLoad
      });

      num.dAddOffset(range, 0);
    }
  }
}

/**
 * Generates a random number using the given number of bits and RNG.
 *
 * @param bits the number of bits for the number.
 * @param rng the random number generator to use.
 *
 * @return the random number.
 */
function generateRandom(bits, rng) {
  var num = new BigInteger(bits, rng);
  // force MSB set
  var bits1 = bits - 1;
  if(!num.testBit(bits1)) {
    num.bitwiseTo(BigInteger.ONE.shiftLeft(bits1), op_or, num);
  }
  // align number on 30k+1 boundary
  num.dAddOffset(31 - num.mod(THIRTY).byteValue(), 0);
  return num;
}

/**
 * Returns the required number of Miller-Rabin tests to generate a
 * prime with an error probability of (1/2)^80.
 *
 * See Handbook of Applied Cryptography Chapter 4, Table 4.4.
 *
 * @param bits the bit size.
 *
 * @return the required number of iterations.
 */
function getMillerRabinTests(bits) {
  if(bits <= 100) return 27;
  if(bits <= 150) return 18;
  if(bits <= 200) return 15;
  if(bits <= 250) return 12;
  if(bits <= 300) return 9;
  if(bits <= 350) return 8;
  if(bits <= 400) return 7;
  if(bits <= 500) return 6;
  if(bits <= 600) return 5;
  if(bits <= 800) return 4;
  if(bits <= 1250) return 3;
  return 2;
}

}
1087442
def cfmakeraw(tflags):
    """"""
    # BSD: https://github.com/freebsd/freebsd/blob/master/lib/libc/gen/termios.c#L162
    # Linux: https://github.com/lattera/glibc/blob/master/termios/cfmakeraw.c#L20
    iflag, oflag, cflag, lflag, ispeed, ospeed, cc = tflags
    iflag &= ~flags('IMAXBEL IXOFF INPCK BRKINT PARMRK ISTRIP INLCR ICRNL IXON IGNPAR')
    iflag &= ~flags('IGNBRK BRKINT PARMRK')
    oflag &= ~flags('OPOST')
    lflag &= ~flags('ECHO ECHOE ECHOK ECHONL ICANON ISIG IEXTEN NOFLSH TOSTOP PENDIN')
    cflag &= ~flags('CSIZE PARENB')
    cflag |= flags('CS8 CREAD')
    return [iflag, oflag, cflag, lflag, ispeed, ospeed, cc]
54696
def _api_wrapper(fn):
    """"""

    def _convert(value):
        if isinstance(value, _datetime.date):
            return value.strftime('%s')
        return value

    @_six.wraps(fn)
    def _fn(self, command, **params):
        # sanitize the params by removing the None values
        with self.startup_lock:
            if self.timer.ident is None:
                self.timer.setDaemon(True)
                self.timer.start()
        params = dict((key, _convert(value))
                      for key, value in _six.iteritems(params)
                      if value is not None)

        self.semaphore.acquire()
        resp = fn(self, command, **params)
        try:
            respdata = resp.json(object_hook=_AutoCastDict)
        except:
            # use more specific error if available or fallback to ValueError
            resp.raise_for_status()
            raise Exception('No JSON object could be decoded')

        # check for 'error' then check for status due to Poloniex inconsistency
        if 'error' in respdata:
            raise PoloniexCommandException(respdata['error'])

        resp.raise_for_status()
        return respdata

    return _fn
497079
function (aNode, sourceBuffer, owner) {

        // output main if
        var ifDirective = aNode.directives['if']; // eslint-disable-line dot-notation
        sourceBuffer.addRaw('if (' + compileExprSource.expr(ifDirective.value) + ') {');
        sourceBuffer.addRaw(
            aNodeCompiler.compile(
                aNode.ifRinsed,
                sourceBuffer,
                owner
            )
        );
        sourceBuffer.addRaw('}');

        // output elif and else
        each(aNode.elses, function (elseANode) {
            var elifDirective = elseANode.directives.elif;
            if (elifDirective) {
                sourceBuffer.addRaw('else if (' + compileExprSource.expr(elifDirective.value) + ') {');
            }
            else {
                sourceBuffer.addRaw('else {');
            }

            sourceBuffer.addRaw(
                aNodeCompiler.compile(
                    elseANode,
                    sourceBuffer,
                    owner
                )
            );
            sourceBuffer.addRaw('}');
        });
    }
320266
def _add_nec_args(self, payload):
        """"""
        if self._limited(payload):
            # Do nothing I guess? Not sure how paging works on this endpoint...
            return
        if 'limit' not in payload:
            payload['limit'] = self.max_results_per_request
        if 'sort' not in payload:
            # Getting weird results if this is not made explicit. Unclear why.
            payload['sort'] = 'desc'
        if 'filter' in payload: #and payload.get('created_utc', None) is None:
            if not isinstance(payload['filter'], list):
                if isinstance(payload['filter'], str):
                    payload['filter'] = [payload['filter']]
                else:
                    payload['filter'] = list(payload['filter'])
            if 'created_utc' not in payload['filter']:
                payload['filter'].append('created_utc')
303807
function( startFunc, forced ) {
		var self = this, i, mod;

		// Can only close an active module
		self.requireState( munit.ASSERT_STATE_ACTIVE, self.close );

		// Add fail marker if no tests were ran
		if ( self.count < 1 ) {
			self.fail( "[munit] No tests ran in this module" );
		}

		// Auto close out any spies
		self._spies.reverse().forEach(function( spy ) {
			spy.restore();
		});

		// Proxy teardown to pass start function and forced state
		self._teardown(function( e, teardownCallback ) {
			if ( e ) {
				self._fail( "[munit] failed to teardown '" + self.nsPath + "' module properly", teardownCallback );
			}

			self._close( startFunc || self.close, forced );
		});

		return self;
	}
1099333
function buildCommonCompiler(name, deps, opts) {
    return deps.map(function (res) {
        var compiler = opts.browserify(R.mixin(cleanOpts(opts), {
            deps: depsStream(Rx.Observable.fromArray([].concat(res.externals, res.requires)).distinct(R.prop("id")))
        }));

        R.each(compiler.external.bind(compiler), R.uniq(R.pluck("id", res.externals)));
        R.each(compiler.require.bind(compiler), R.uniq(R.pluck("id", res.requires)));

        return { name: name, compiler: compiler };
    }).single();
}