• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(337)  |  Call(320)  |  Derive(0)  |  Import(17)
Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
a JSON document) to a Python object.

*encoding* determines the encoding used to interpret any
:class:`str` objects decoded by this instance (``'utf-8'`` by
default).  It has no effect when decoding :class:`unicode` objects.

Note that currently only encodings that are a superset of ASCII work,
strings of other encodings should be passed in as :class:`unicode`.

*object_hook*, if specified, will be called with the result of every
JSON object decoded and its return value will be used in place of the
given :class:`dict`.  This can be used to provide custom
deserializations (e.g. to support JSON-RPC class hinting).

*object_pairs_hook* is an optional function that will be called with
the result of any object literal decode with an ordered list of pairs.
The return value of *object_pairs_hook* will be used instead of the
:class:`dict`.  This feature can be used to implement custom decoders
that rely on the order that the key and value pairs are decoded (for
example, :func:`collections.OrderedDict` will remember the order of
insertion). If *object_hook* is also defined, the *object_pairs_hook*
takes priority.

*parse_float*, if specified, will be called with the string of every
JSON float to be decoded.  By default, this is equivalent to
``float(num_str)``. This can be used to use another datatype or parser
for JSON floats (e.g. :class:`decimal.Decimal`).

*parse_int*, if specified, will be called with the string of every
JSON int to be decoded.  By default, this is equivalent to
``int(num_str)``.  This can be used to use another datatype or parser
for JSON integers (e.g. :class:`float`).

*parse_constant*, if specified, will be called with one of the
following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``.  This
can be used to raise an exception if invalid JSON numbers are
encountered.

If *use_decimal* is true (default: ``False``) then it implies
parse_float=decimal.Decimal for parity with ``dump``.

To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
kwarg.

        def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
        parse_int=None, parse_constant=None, object_pairs_hook=None,
        use_decimal=False, **kw):
    """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
    a JSON document) to a Python object.

    *encoding* determines the encoding used to interpret any
    :class:`str` objects decoded by this instance (``'utf-8'`` by
    default).  It has no effect when decoding :class:`unicode` objects.

    Note that currently only encodings that are a superset of ASCII work,
    strings of other encodings should be passed in as :class:`unicode`.

    *object_hook*, if specified, will be called with the result of every
    JSON object decoded and its return value will be used in place of the
    given :class:`dict`.  This can be used to provide custom
    deserializations (e.g. to support JSON-RPC class hinting).

    *object_pairs_hook* is an optional function that will be called with
    the result of any object literal decode with an ordered list of pairs.
    The return value of *object_pairs_hook* will be used instead of the
    :class:`dict`.  This feature can be used to implement custom decoders
    that rely on the order that the key and value pairs are decoded (for
    example, :func:`collections.OrderedDict` will remember the order of
    insertion). If *object_hook* is also defined, the *object_pairs_hook*
    takes priority.

    *parse_float*, if specified, will be called with the string of every
    JSON float to be decoded.  By default, this is equivalent to
    ``float(num_str)``. This can be used to use another datatype or parser
    for JSON floats (e.g. :class:`decimal.Decimal`).

    *parse_int*, if specified, will be called with the string of every
    JSON int to be decoded.  By default, this is equivalent to
    ``int(num_str)``.  This can be used to use another datatype or parser
    for JSON integers (e.g. :class:`float`).

    *parse_constant*, if specified, will be called with one of the
    following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``.  This
    can be used to raise an exception if invalid JSON numbers are
    encountered.

    If *use_decimal* is true (default: ``False``) then it implies
    parse_float=decimal.Decimal for parity with ``dump``.

    To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
    kwarg.

    """
    return loads(fp.read(),
        encoding=encoding, cls=cls, object_hook=object_hook,
        parse_float=parse_float, parse_int=parse_int,
        parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,
        use_decimal=use_decimal, **kw)
        


src/p/y/pyphant-HEAD/trunk/src/pyphant/pyphant/core/KnowledgeNode.py   pyphant(Download)
try:
    from json import (dumps, load, loads)
except ImportError:
    from simplejson import (dumps, load, loads)
from tempfile import (mkdtemp, mkstemp)
import os
from pyphant import __path__ as pyphant_source_path
                    except TypeError:
                        stream = urlopen(url)
                    assert stream.headers.type == 'application/json'
                    answer = load(stream)
                    stream.close()
                    if answer['dc_url'] == None:
                        raise DCNotFoundError

src/p/y/pyphant-HEAD/src/pyphant/pyphant/core/KnowledgeNode.py   pyphant(Download)
try:
    from json import (dumps, load, loads)
except ImportError:
    from simplejson import (dumps, load, loads)
from tempfile import (mkdtemp, mkstemp)
import os
from pyphant import __path__ as pyphant_source_path
                    except TypeError:
                        stream = urlopen(url)
                    assert stream.headers.type == 'application/json'
                    answer = load(stream)
                    stream.close()
                    if answer['dc_url'] == None:
                        raise DCNotFoundError

src/f/e/feedprovider-0.2.1/gozerlib/persist.py   feedprovider(Download)
 
## simplejson imports
 
from simplejson import load, dump, loads, dumps
 
## basic imports
 
 
            # load the JSON data into attribute
            try:
                self.data = load(datafile)
                datafile.close()
 
                if type(self.data) == types.DictType:

src/g/o/gozerbot-0.9.2b1/gozerbot/persist/persist.py   gozerbot(Download)
from gozerbot.utils.lazydict import LazyDict
from gozerbot.datadir import datadir
from gozerbot.config import config
from simplejson import load, dump, loads, dumps
 
# basic imports
import pickle, thread, os, copy, sys, types
 
            # load the JSON data into attribute
            try:
                self.data = load(datafile)
                datafile.close()
                stats.up('persist', 'load') 
 

src/j/s/jsonbot-0.4/gozerlib/socklib/partyline.py   jsonbot(Download)
 
## simplejson import
 
from simplejson import load
 
## basic imports
 
    def resume(self, sessionfile):
        """ resume from session file. """
        session = load(open(sessionfile, 'r'))
        try:
            reto = session['channel']
            self._doresume(session, reto)
        except Exception, ex: handle_exception()

src/f/e/feedprovider-0.2.1/gozerlib/socket/partyline.py   feedprovider(Download)
 
## simplejson import
 
from simplejson import load
 
## basic imports
 
 
        """
 
        session = load(open(sessionfile, 'r'))
 
        try:
            reto = session['channel']

src/j/s/jsonbot-0.4/gozerlib/fleet.py   jsonbot(Download)
 
## simplejson imports
 
from simplejson import load
 
## basic imports
 
    def resume(self, sessionfile):
        """ resume bot from session file. """
        session = load(open(sessionfile))
        for name in session['bots'].keys():
            reto = None
            if session['name'] == name: reto = session['channel']
            start_new_thread(self.resumebot, (name, session['bots'][name], reto))

src/f/a/fa.jquery-0.8/fa/jquery/utils.py   fa.jquery(Download)
# -*- coding: utf-8 -*-
from formalchemy.templates import TemplateEngine as BaseTemplateEngine
from formalchemy import types as fatypes
from webhelpers.html import escape, literal
from mako.lookup import TemplateLookup
from simplejson import dumps
from simplejson import load
def load_datas(filename):
    dirname = os.path.join(os.path.dirname(__file__), 'datas')
    filename = os.path.join(dirname, filename)
    return load(open(filename))
 
def url(*args, **kwargs):
    """return a path to script. you can change the root_url. default to `/jquery`:

src/g/o/gozerbot-0.9.2b1/gozerbot/partyline.py   gozerbot(Download)
from utils.log import rlog
from utils.exception import handle_exception
from fleet import fleet
from simplejson import load
from threads.thr import start_new_thread
 
# basic imports
                 :pyobject PartyLine.resume
        """
 
        session = load(open(sessionfile, 'r'))
 
        try:
            reto = session['channel']

src/g/o/gozerbot-0.9.2b1/gozerbot/fleet.py   gozerbot(Download)
from config import Config, fleetbotconfigtxt, config
from users import users
from plugins import plugins
from simplejson import load
 
# basic imports
 
        """
 
        # read JSON session file
        session = load(open(sessionfile))
 
        #  resume bots in session file
        for name in session['bots'].keys():

  1 | 2  Next