Python compat.read_json() Examples
The following are 21
code examples of compat.read_json().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
compat
, or try the search function
.
Example #1
Source File: _in_process.py From Hands-On-Application-Development-with-PyCharm with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #2
Source File: _in_process.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #3
Source File: _in_process.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #4
Source File: _in_process.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #5
Source File: _in_process.py From fxxkpython with GNU General Public License v3.0 | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #6
Source File: _in_process.py From android_universal with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #7
Source File: _in_process.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #8
Source File: _in_process.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #9
Source File: _in_process.py From coffeegrindsize with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #10
Source File: _in_process.py From Weapon-Detection-And-Classification with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #11
Source File: _in_process.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #12
Source File: _in_process.py From learn_python3_spider with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #13
Source File: _in_process.py From scylla with Apache License 2.0 | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #14
Source File: _in_process.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #15
Source File: _in_process.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #16
Source File: _in_process.py From pySINDy with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #17
Source File: _in_process.py From deepWordBug with Apache License 2.0 | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #18
Source File: _in_process.py From Mastering-Elasticsearch-7.0 with MIT License | 6 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable: json_out['no_backend'] = True except GotUnsupportedOperation: json_out['unsupported'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #19
Source File: _in_process.py From CogAlg with MIT License | 5 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable as e: json_out['no_backend'] = True json_out['traceback'] = e.traceback except BackendInvalid as e: json_out['backend_invalid'] = True json_out['backend_error'] = e.message except GotUnsupportedOperation as e: json_out['unsupported'] = True json_out['traceback'] = e.traceback except HookMissing: json_out['hook_missing'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #20
Source File: _in_process.py From pipenv with MIT License | 5 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable as e: json_out['no_backend'] = True json_out['traceback'] = e.traceback except BackendInvalid as e: json_out['backend_invalid'] = True json_out['backend_error'] = e.message except GotUnsupportedOperation as e: json_out['unsupported'] = True json_out['traceback'] = e.traceback except HookMissing: json_out['hook_missing'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)
Example #21
Source File: _in_process.py From pex with Apache License 2.0 | 5 votes |
def main(): if len(sys.argv) < 3: sys.exit("Needs args: hook_name, control_dir") hook_name = sys.argv[1] control_dir = sys.argv[2] if hook_name not in HOOK_NAMES: sys.exit("Unknown hook: %s" % hook_name) hook = globals()[hook_name] hook_input = compat.read_json(pjoin(control_dir, 'input.json')) json_out = {'unsupported': False, 'return_val': None} try: json_out['return_val'] = hook(**hook_input['kwargs']) except BackendUnavailable as e: json_out['no_backend'] = True json_out['traceback'] = e.traceback except BackendInvalid as e: json_out['backend_invalid'] = True json_out['backend_error'] = e.message except GotUnsupportedOperation as e: json_out['unsupported'] = True json_out['traceback'] = e.traceback except HookMissing: json_out['hook_missing'] = True compat.write_json(json_out, pjoin(control_dir, 'output.json'), indent=2)