Return a Ron Swanson quote.

    Returns None if unable to retrieve a quote.
965745
def get_joke():
    

    page = requests.get("http://ron-swanson-quotes.herokuapp.com/v2/quotes")
    
    if page.status_code == 200:
        jokes = []
        jokes = json.loads(page.content.decode(page.encoding))
        return '"' + jokes[0] + '" - Ron Swanson'

    return None
445885
def quote(s, unsafe='/'):
    """"""
    res = s.replace('%', '%25')
    for c in unsafe:
        res = res.replace(c, '%' + (hex(ord(c)).upper())[2:])
    return res
251514
def quote(query):
    ''''''
    if query.startswith('\'') is not True:
        query = '\'' + query

    if query.endswith('\'') is not True:
        query = query + '\''

    return query
703928
def quote(self, identifier, errors="strict"):
        
        if identifier is None:
            return None

        encodable = identifier.encode("utf-8", errors).decode("utf-8")

        nul_index = encodable.find("\x00")

        if nul_index >= 0:
            error = UnicodeEncodeError(
                "NUL-terminated utf-8",
                encodable,
                nul_index,
                nul_index + 1,
                "NUL not allowed"
            )
            error_handler = codecs.lookup_error(errors)
            replacement, _ = error_handler(error)
            encodable = encodable.replace("\x00", replacement)

        return "\"" + encodable.replace("\"", "\"\"") + "\""
224345
def quotation(self, origin, target):
        """"""
        if not self._backend:
            raise ExchangeBackendNotInstalled()
        return self._backend.quotation(origin, target)
476664
def unquote(text, exceptions=[]):
    
    if not text:
        if text is None:
            raise TypeError('None object cannot be unquoted')
        else:
            return text
    if '%' not in text:
        return text
    s = text.split('%')
    res = [s[0]]
    for h in s[1:]:
        c = _hextochr.get(h[:2])
        if c and c not in exceptions:
            if len(h) > 2:
                res.append(c + h[2:])
            else:
                res.append(c)
        else:
            res.append('%' + h)
    return ''.join(res)
1127687
function quote(inst, list, argv, event, fin) {
    // Remember to charge for the 'quote' function as a transaction
    if (!ok(inst, inst.options.quoteTransaction)) return exit(inst, list, fin);
    var entity = list[list.length - 1];
    if (_isValue(entity)) return fin(null, entity);
    var quotation = {};
    quotation[RUNIQ_QUOTED_ENTITY_PROP_NAME] = entity;
    return fin(null, quotation);
}
896516
def info(self):
        
        url = "{}/v7/finance/quote?symbols={}".format(
            self._base_url, self.ticker)
        r = _requests.get(url=url).json()["quoteResponse"]["result"]
        if len(r) > 0:
            return r[0]
        return {}
570906
private function findQuoteByStockIdInSession($stockId)
    {
        $result = false;
        $sessionReg = $this->sessCustomer->getData(self::SESS_QUOTE_REGISTRY);
        if (is_array($sessionReg)) {
            /** @var EWrhsQuote $one */
            foreach ($sessionReg as $one) {
                if ($one->getStockRef() == $stockId) {
                    $result = $one;
                    break;
                }
            }
        }
        return $result;
    }
52331
def encode_and_quote(data):
    """"""
    if data is None:
        return None

    if isinstance(data, unicode):
        data = data.encode("utf-8")
    return urllib.quote_plus(data)
859167
def quote_from_bytes(bs, safe='/'):
    
    if not isinstance(bs, (bytes, bytearray)):
        raise TypeError("quote_from_bytes() expected bytes")
    if not bs:
        return str('')
    ### For Python-Future:
    bs = bytes(bs)
    ###
    if isinstance(safe, str):
        # Normalize 'safe' by converting to bytes and removing non-ASCII chars
        safe = str(safe).encode('ascii', 'ignore')
    else:
        ### For Python-Future:
        safe = bytes(safe)
        ###
        safe = bytes([c for c in safe if c < 128])
    if not bs.rstrip(_ALWAYS_SAFE_BYTES + safe):
        return bs.decode()
    try:
        quoter = _safe_quoters[safe]
    except KeyError:
        _safe_quoters[safe] = quoter = Quoter(safe).__getitem__
    return str('').join([quoter(char) for char in bs])
1317023
def get_quotation_kline(self, symbol, period, limit=None, _async=False):
        
        params = {}
        path = '/quotation/market/history/kline'
        params['symbol'] = symbol
        params['period'] = period
        if limit:
            params['limit'] = limit

        return api_key_get(params, path, _async=_async)
1120681
def _maybe_quote(val):
    ''''''
    assert isinstance(val, str), 'We should never set non-string values.'
    needs_quoting = False
    try:
        int(val)
        needs_quoting = True
    except Exception:
        pass
    try:
        float(val)
        needs_quoting = True
    except Exception:
        pass
    if needs_quoting:
        return '"{}"'.format(val)
    else:
        return val
366679
def motto(self):
        
        if self.url is None:
            return ''
        else:
            if self.soup is not None:
                bar = self.soup.find(
                    'div', class_='title-section')
                if len(bar.contents) < 4:
                    return ''
                else:
                    return bar.contents[3].text
            else:
                assert self.card is not None
                motto = self.card.find('div', class_='tagline')
                return motto.text if motto is not None else ''
713038
def get_index_quote(self, code, as_json=False):
        
        url = self.index_url
        if self.is_valid_index(code):
            req = Request(url, None, self.headers)
            # raises HTTPError and URLError
            resp = self.opener.open(req)
            resp = byte_adaptor(resp)
            resp_list = json.load(resp)['data']
            # this is list of dictionaries
            resp_list = [self.clean_server_response(item)
                         for item in resp_list]
            # search the right list element to return
            search_flag = False
            for item in resp_list:
                if item['name'] == code.upper():
                    search_flag = True
                    break
            return self.render_response(item, as_json) if search_flag else None
459092
def quote(self, s):
        """"""

        if six.PY2:
            from pipes import quote
        else:
            from shlex import quote

        return quote(s)
10124
def getQuotes(self, symbol, start, end):
        
        try:
            start = str(start).replace('-', '')
            end = str(end).replace('-', '')

            url = 'http://ichart.yahoo.com/table.csv?s=%s&' % symbol + \
                'd=%s&' % str(int(end[4:6]) - 1) + \
                'e=%s&' % str(int(end[6:8])) + \
                'f=%s&' % str(int(end[0:4])) + \
                'g=d&' + \
                'a=%s&' % str(int(start[4:6]) - 1) + \
                'b=%s&' % str(int(start[6:8])) + \
                'c=%s&' % str(int(start[0:4])) + \
                'ignore=.csv'
            days = urllib.urlopen(url).readlines()
            values = [day[:-2].split(',') for day in days]
            # sample values:[['Date', 'Open', 'High', 'Low', 'Close', 'Volume', 'Adj Clos'], \
            #              ['2009-12-31', '112.77', '112.80', '111.39', '111.44', '90637900', '109.7']...]
            data = []
            for value in values[1:]:
                data.append(Quote(value[0], value[1], value[2], value[3], value[4], value[5], value[6]))

            dateValues = sorted(data, key = lambda q: q.time)
            return dateValues

        except IOError:
            raise UfException(Errors.NETWORK_ERROR, "Can't connect to Yahoo server")
        except BaseException:
            raise UfException(Errors.UNKNOWN_ERROR, "Unknown Error in YahooFinance.getHistoricalPrices %s" % traceback.format_exc())