def loads(s, *args, **kwargs): try: return _json.loads(s, cls=WAJSONDecoder, object_pairs_hook=OrderedDict, *args, **kwargs) except ValueError as e: raise SerializerSyntaxError(e.args[0])
def load(fh, *args, **kwargs): try: return _yaml.load(fh, *args, Loader=_WaYamlLoader, **kwargs) except _yaml.YAMLError as e: lineno = None if hasattr(e, 'problem_mark'): lineno = e.problem_mark.line # pylint: disable=no-member message = e.args[0] if (e.args and e.args[0]) else str(e) raise SerializerSyntaxError(message, lineno)
def load(fh, *args, **kwargs): try: return _yaml.load(fh, *args, **kwargs) except _yaml.YAMLError as e: lineno = None if hasattr(e, 'problem_mark'): lineno = e.problem_mark.line # pylint: disable=no-member raise SerializerSyntaxError(e.args[0] if e.args else str(e), lineno)
def loads(s, *args, **kwargs): pod = {} try: exec(s, pod) # pylint: disable=exec-used except SyntaxError as e: raise SerializerSyntaxError(e.message, e.lineno) for k in list(pod.keys()): # pylint: disable=consider-iterating-dictionary if k.startswith('__'): del pod[k] return pod