Perform necessary SOQL quoting on the arg.
331045
def arg_to_soql(arg):
    
    conversion = sql_conversions.get(type(arg))
    if conversion:
        return conversion(arg)
    for type_ in subclass_conversions:
        if isinstance(arg, type_):
            return sql_conversions[type_](arg)
    return sql_conversions[str](arg)
90615
def server_args(self, parsed_args):
        """"""
        args = {
            arg: value
            for arg, value in vars(parsed_args).items()
            if not arg.startswith('_') and value is not None
        }
        args.update(vars(self))
        return args
447699
def __build_query(self, routine, parameters):
        """"""

        parameter_names = []
        replacements = {}
        for i, value in enumerate(parameters):
            name = 'arg' + str(i)

            parameter_names.append(name)
            replacements[name] = value

        parameter_pieces = []
        for i, name in enumerate(parameter_names):
            if i > 0:
                parameter_pieces.append(', ')

            # Embed encoded blobs directly.
            if issubclass(replacements[name].__class__, _BlobArgumentWrapper) is True:
                parameter_pieces.append(replacements[name].encoded)
                del replacements[name]
            else:
                parameter_pieces.append(':' + name)

        query = "CALL " + routine + "(" + ''.join(parameter_pieces) + ")"

        return (query, replacements)
26115
def _attach_arguments(self):
        """"""
        for arg in self.arguments:
            self.parser.add_argument(*arg[0], **arg[1])
1028115
def arguments():
    """"""

    DESCRIPTION = """\
    """

    parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=Raw)

    parser.add_argument("--email", dest="email", action='store', required=False, default=False,
                        help="An email address is required for querying Entrez databases.")

    parser.add_argument("--api", dest="api_key", action='store', required=False, default=False,
                        help="A users ENTREZ API Key. Will speed up download.")

    parser.add_argument("--query", dest="query", action='store', required=True,
                        help="Query to submit to Entrez.")

    parser.add_argument("--host", dest="host", action='store', required=False, default='localhost',
                        help="Location of an already running database.")

    parser.add_argument("--port", dest="port", action='store', type=int, required=False, default=27017,
                        help="Mongo database port.")

    parser.add_argument("--db", dest="db", action='store', required=False, default='sramongo',
                        help="Name of the database.")

    parser.add_argument("--debug", dest="debug", action='store_true', required=False,
                        help="Turn on debug output.")

    parser.add_argument("--force", dest="force", action='store_true', required=False,
                        help="Forces clearing the cache.")

    args = parser.parse_args()

    if not (args.email or args.api_key):
        logger.error('You must provide either an `--email` or `--api`.')
        sys.exit()

    return args
1169013
def required_args(self):
        """"""
        r_args = []
        for arg in self.arguments:
            if not arg.default_value:
                r_args.append(arg)
            else:
                break
        return r_args
1100668
def required_arguments(func):
    """"""
    defaults = default_values_of(func)
    args = arguments_of(func)

    if defaults:
        args = args[:-len(defaults)]
    return args
649874
def quote_string_if_needed(arg: str) -> str:
    
    if is_quoted(arg) or ' ' not in arg:
        return arg

    if '"' in arg:
        quote = "'"
    else:
        quote = '"'

    return quote + arg + quote
824459
def kwargs(self):
        """"""
        kwargs = dict(self.query_kwargs)
        kwargs.update(self.body_kwargs)

        return kwargs
1003244
def ok_kwarg(val):
        """"""

        import keyword

        try:
            return str.isidentifier(val) and not keyword.iskeyword(val)
        except TypeError:
            # Non-string values are never a valid keyword arg
            return False
107936
def coerce_quotes(quotes):
        """"""
        orig, quotes = quotes, str(quotes) if quotes else None
        if quotes not in [None, '"', "'"]:
            raise ValueError("{!r} is not a valid quote type".format(orig))
        return quotes
1012180
function getArguments(req) {
    const result = req.body || {};
    for (let i in req.query) {
        result[i] = req.query[i];
    }
    return result;
}
534817
def excute_query(query, db=None, flags=None, use_sudo=False, **kwargs):
    """"""

    flags = flags or u''
    if db:
        flags = u"%s -d %s" % (flags, db)
    command = u'psql %s -c "%s"' % (flags, query)
    if use_sudo:
        sudo(command, user='postgres', **kwargs)
    else:
        run(command, **kwargs)
840029
function doQuotes(route, args, count) {
    var bot = this,
        username = args.shift(),
        user;

    count = count || 1;

    function getQuote (err, quotes) {
        if (quotes.length) {
            var quote, output = [];
            for (var i = 0; i < quotes.length; i++) {
                quote = quotes[i];
                output.push(quote.nick + ': ' + quote.text);
            }
            route.indirect().send(output.join('\n'));
        } else {
            var name = 'anyone';
            if (user) {
                name = user.nick;
            }
            route.send('?quotes_nobody_said_that', name);
        }
    }

    if (username !== 'anyone') {
        user = bot.users.getUserMatch(username);

        if (!user) {
            user = bot.db.schemas.quote.getQuoteNick(username, function (err, user) {
                if (!user) {
                    args.unshift(username);
                    bot.db.schemas.quote.random(args.join(' '), null, count, getQuote);
                } else {
                    bot.db.schemas.quote.random(args.join(' '), username, count, getQuote);
                }
            });
        } else {
            bot.db.schemas.quote.random(args.join(' '), user.nick, count, getQuote);
        }
    } else {
        bot.db.schemas.quote.random(args.join(' '), null, count, getQuote);
    }
}
629114
def reqs(ctx, dataset, kwargs):
    ""

    kwargs = parse_kwargs(kwargs)
    (print)(data(dataset, **ctx.obj).reqs(**kwargs))
335489
def with_known_args(self, **kwargs):
    """"""
    argspec = inspect.getargspec(self.func)
    stored = {}
    for key, arg in six.iteritems(kwargs):
      if key in argspec.args or argspec.keywords:
        stored[key] = arg
    if stored:
      return self.with_args(**stored)
    return self
257686
function _unquoteArgs(args) {
    for (var i = 0; i < args.length; i++) {
        if (_isQuoted(args[i])) args[i] = _unquote(args[i]);
    }
}