Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(5)  |  Derive(0)  |  Import(3)
Load json and make classes from certain dicts (see classify() docs) 

        def from_json(str_or_fp, object_hook=None):
    """ Load json and make classes from certain dicts (see classify() docs) """
    if isinstance(str_or_fp, basestring):
        obj = json.loads(str_or_fp, object_hook=object_hook)
    else:
        obj = json.load(str_or_fp, object_hook=object_hook)
    return classify(obj)
        


src/s/b/sbgsdk-0.5.4/sbdk/executor.py   sbgsdk(Download)
from sbgsdk.job import Job
from sbgsdk.exceptions import JobException
from sbgsdk.protocol import from_json, to_json
from sbgsdk.executor import Executor
 
        with open('__out__.json') as fp:
            logging.debug('Reading job output from %s', os.path.abspath('__out__.json'))
            result = from_json(fp)
        os.chdir('..')
        return result
        with open(out_file) as fp:
            logging.debug('Reading job output from %s', out_file)
            result = from_json(fp)
        from subprocess import Popen
        Popen(['sudo chmod -R 777 ' + job_dir], shell=True)  # TODO: remove

src/s/b/sbgsdk-0.5.4/sbgsdk/cli.py   sbgsdk(Download)
from sbgsdk.errors import INTERNAL_ERROR
from sbgsdk.exceptions import exit_code_for_exception, NotAJobError, ValidationException, JobException, ProtocolException
from sbgsdk.protocol import from_json, to_json
from sbgsdk.job import Job
from sbgsdk.util import import_name
        raise Exception('No such file: %s' % input)
    with open(input) as fp:
        job = from_json(fp)
    if not isinstance(job, Job):
        raise NotAJobError('Input JSON must describe a job.')
def run_script():
    args = vars(create_parser().parse_args())
    if args['logging_config']:
        with open(args['logging_config']) as fp:
            logging.config.dictConfig(from_json(fp))

src/s/b/sbgsdk-0.5.4/sbgsdk/tests/test_wrappers/red_adder_test.py   sbgsdk(Download)
import filecmp
from sbgsdk.job import Job
from sbgsdk.protocol import from_json, to_json
from sbgsdk.executor import Tassadar
from sbgsdk.tests.test_tools.generator import generator
 
    job_multi = Job(RedAdder, inputs=inputs, params={'n': 5})
    Tassadar().execute(from_json(to_json(job_multi)))
 
    assert filecmp.cmp('output_parallel.txt', 'output_single.txt')