def read_json(path):
if path.startswith(("<STR_LIT>", "<STR_LIT>")):<EOL><INDENT>try:<EOL><INDENT>return json.loads(urlopen(path).read().decode())<EOL><DEDENT>except HTTPError:<EOL><INDENT>raise FileNotFoundError("<STR_LIT>", path)<EOL><DEDENT><DEDENT>elif path.startswith("<STR_LIT>"):<EOL><INDENT>bucket = get_boto3_bucket(path.split("<STR_LIT:/>")[<NUM_LIT:2>])<EOL>key = "<STR_LIT:/>".join(path.split("<STR_LIT:/>")[<NUM_LIT:3>:])<EOL>for obj in bucket.objects.filter(Prefix=key):<EOL><INDENT>if obj.key == key:<EOL><INDENT>return json.loads(obj.get()['<STR_LIT>'].read().decode())<EOL><DEDENT><DEDENT>raise FileNotFoundError("<STR_LIT>", path)<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>with open(path, "<STR_LIT:r>") as src:<EOL><INDENT>return json.loads(src.read())<EOL><DEDENT><DEDENT>except:<EOL><INDENT>raise FileNotFoundError("<STR_LIT>", path)<EOL><DEDENT><DEDENT>
Read local or remote.