Whitelist the WORKON_HOME strings we're willing to substitute in
    to strings that we provide for user's shell to evaluate.

    If it smells at all bad, return True.
1203
def scary_path(path):
    
    if not path:
        return True
    assert isinstance(path, bytes)
    return not NOT_SCARY.match(path)
1140949
String cleanOutputWhitespace(String str) {
		StringBuilder sb = new StringBuilder(str.length());

		int currentWhitespaceStart = -1;
		int startOfLine = 0;

		for (int i = 0; i < str.length(); i++) {
			char c = str.charAt(i);

			boolean isInlineWhitespace = c == ' ' || c == '\t';

			if (isInlineWhitespace && currentWhitespaceStart == -1)
				currentWhitespaceStart = i;

			if (!isInlineWhitespace) {
				if (c != '\n' && currentWhitespaceStart > 0 && currentWhitespaceStart != startOfLine) {
					sb.append(' ');
				}
				currentWhitespaceStart = -1;
			}

			if (c == '\n')
				startOfLine = i + 1;

			if (!isInlineWhitespace)
				sb.append(c);
		}

		return sb.toString();
	}
190879
def __set_whitelist(self, whitelist=None):
        
        # add tag's names as key and list of enabled attributes as value for defaults
        self.whitelist = {}
        # tags that removed with contents
        self.sanitizelist = ['script', 'style']
        if isinstance(whitelist, dict) and '*' in whitelist.keys():
            self.isNotPurify = True
            self.whitelist_keys = []
            return
        else:
            self.isNotPurify = False
        self.whitelist.update(whitelist or {})
        self.whitelist_keys = self.whitelist.keys()
807234
def set_as_environment_variables(self, override=False):
        
        for k, v in self.dict().items():
            if k in os.environ and not override:
                continue
            # With Python2 on Windows, force environment variables to str to avoid
            # "TypeError: environment can only contain strings" in Python's subprocess.py.
            if PY2 and WIN:
                if isinstance(k, text_type) or isinstance(v, text_type):
                    k = k.encode('ascii')
                    v = v.encode('ascii')
            os.environ[k] = v

        return True
1346042
def safe_evaluate(command, glob, local):
    
    while True:
        try:
            return eval(command, glob, local)
        except NameError as e:
            match = re.match("name '(.*)' is not defined", e.message)
            if not match:
                raise e
            try:
                exec ('import %s' % (match.group(1), )) in glob
            except ImportError:
                raise e
236450
function isWhitelisted(moduleId)
{
  var i;

  // check if its empty
  if (!this.whiteList.length)
  {
    return true;
  }

  // strip basePath
  moduleId = moduleId.replace(this.basePathRegexp, '');

  for (i = 0; i < this.whiteList.length; i++)
  {
    if (minimatch(moduleId, this.whiteList[i]))
    {
      return true;
    }
  }

  return false;
}
147298
def submit_string(string, **kwargs)
      Tempfile.open('qsub.') do |f|
        f.write string.to_s
        f.close
        submit_script(f.path, **kwargs)
      end
    end
15014
def check_whitelist(values):
    """"""
    import os
    import tldextract
    whitelisted = list()
    for name in ['alexa.txt', 'cisco.txt']:
        config_path = os.path.expanduser('~/.config/blockade')
        file_path = os.path.join(config_path, name)
        whitelisted += [x.strip() for x in open(file_path, 'r').readlines()]
    output = list()
    for item in values:
        ext = tldextract.extract(item)
        if ext.registered_domain in whitelisted:
            continue
        output.append(item)
    return output
982936
def evaluate_blueprint(blueprint_name, env)
      raise "'env' must be a String or an Environment." \
        unless env.is_a?(String) || env.is_a?(Environments::Environment)

      if env.is_a?(String)
        env = environment(env)
      end

      ev = Amigrind::Blueprints::Evaluator.new(File.join(blueprints_path,
                                                         "#{blueprint_name}.rb"),
                                               env)

      ev.blueprint
    end
625717
def AreHostsReachable(hostnames, ssh_key):
  
  # validate input
  for hostname in hostnames:
    assert(len(hostname))
  ssh_ok = [exit_code == 0 for (exit_code, _) in
            RunCommandOnHosts('echo test > /dev/null', hostnames, ssh_key)]
  return ssh_ok
118147
def check_environment(self, environment):
        

        non_strings = []
        for (k,v) in environment.items():
            if not isinstance(v, basestring):
                non_strings.append(k)
        if non_strings:
            raise ValueError("The following environment variables are not strings: {}".format(", ".join(non_strings)))
        else:
            return True
2852
function str(input) {
  if (!is('String', input)) return;
  return root[input] || (root.require || require)(input);
}
1325054
private static boolean shouldReplaceWithAlias(String str, StringInfo info) {
    // Optimize for code size.  Are aliases smaller than strings?
    //
    // This logic optimizes for the size of uncompressed code, but it tends to
    // get good results for the size of the gzipped code too.
    //
    // gzip actually prefers that strings are not aliased - it compresses N
    // string literals better than 1 string literal and N+1 short variable
    // names, provided each string is within 32k of the previous copy.  We
    // follow the uncompressed logic as insurance against there being multiple
    // strings more than 32k apart.

    int sizeOfLiteral = 2 + str.length();
    int sizeOfStrings = info.numOccurrences * sizeOfLiteral;
    int sizeOfVariable = 3;
    //  '6' comes from: 'var =;' in var XXX="...";
    int sizeOfAliases = 6 + sizeOfVariable + sizeOfLiteral    // declaration
        + info.numOccurrences * sizeOfVariable;               // + uses

    return sizeOfAliases < sizeOfStrings;
  }
935603
def clearAllowList(self):
        
        print '%s call clearAllowList' % self.port

        # remove all entries in whitelist
        try:
            print 'clearing whitelist entries:'
            for addr in self._addressfilterSet:
                print addr

            # disable whitelist
            if self.__setAddressfilterMode('disable'):
                self._addressfilterMode = 'disable'
                # clear ops
                cmd = WPANCTL_CMD + 'insert MAC:Whitelist:Entries'
                if self.__sendCommand(cmd)[0] != 'Fail':
                    self._addressfilterSet.clear()
                    return True
            return False
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger('clearAllowList() Error: ' + str(e))
1138319
def sanitize(value):
    '''
    

    '''
    if isinstance(value, basestring):
        value = bleach.clean(value, tags=ALLOWED_TAGS,
                             attributes=ALLOWED_ATTRIBUTES, 
                             styles=ALLOWED_STYLES, strip=False)
    return value
945919
def _fix_unsafe(shell_input):
    
    _unsafe = re.compile(r'[^\w@%+=:,./-]', 256)
    try:
        if len(_unsafe.findall(shell_input)) == 0:
            return shell_input.strip()
        else:
            clean = "'" + shell_input.replace("'", "'\"'\"'") + "'"
            return clean
    except TypeError:
        return None
394823
def substitute_placeholders(inputstring, placeholders):
    
    newst = inputstring.format(link=placeholders.link,
                               filename=placeholders.filename,
                               directory=placeholders.directory,
                               fullpath=placeholders.fullpath,
                               title=placeholders.title,
                               filename_title=placeholders.filename_title,
                               date=placeholders.date_string(),
                               podcasttitle=placeholders.podcasttitle,
                               filename_podcasttitle=
                               placeholders.filename_podcasttitle,
                               name=placeholders.name,
                               subtitle=placeholders.sanitizedsubtitle,
                               entrysummary=placeholders.entrysummary)
    return newst