Source

pyyaml / lib / yaml / __init__.py

Diff from to

File lib/yaml/__init__.py

     finally:
         loader.dispose()
 
-def load(stream, Loader=Loader, tz_aware_datetimes=False):
+def load(stream, Loader=Loader, **kwargs):
     """
     Parse the first YAML document in a stream
     and produce the corresponding Python object.
     """
-    try:
-        loader = Loader(stream, tz_aware_datetimes=tz_aware_datetimes)
-    except TypeError:
-        loader = Loader(stream)
+    loader = Loader(stream, **kwargs)
     try:
         return loader.get_single_data()
     finally:
         loader.dispose()
 
-def load_all(stream, Loader=Loader, tz_aware_datetimes=False):
+def load_all(stream, Loader=Loader, **kwargs):
     """
     Parse all YAML documents in a stream
     and produce corresponding Python objects.
     """
-    try:
-        loader = Loader(stream, tz_aware_datetimes=tz_aware_datetimes)
-    except TypeError:
-        loader = Loader(stream)
+    loader = Loader(stream, **kwargs)
     try:
         while loader.check_data():
             yield loader.get_data()
     finally:
         loader.dispose()
 
-def safe_load(stream, tz_aware_datetimes=False):
+def safe_load(stream, **kwargs):
     """
     Parse the first YAML document in a stream
     and produce the corresponding Python object.
     Resolve only basic YAML tags.
     """
-    return load(stream, SafeLoader, tz_aware_datetimes=tz_aware_datetimes)
+    return load(stream, SafeLoader, **kwargs)
 
-def safe_load_all(stream, tz_aware_datetimes=False):
+def safe_load_all(stream, **kwargs):
     """
     Parse all YAML documents in a stream
     and produce corresponding Python objects.
     Resolve only basic YAML tags.
     """
-    return load_all(stream, SafeLoader, tz_aware_datetimes=tz_aware_datetimes)
+    return load_all(stream, SafeLoader, **kwargs)
 
 def emit(events, stream=None, Dumper=Dumper,
         canonical=None, indent=None, width=None,