From 70a345347e124d3c456fcf801662aa37975ccd75 Mon Sep 17 00:00:00 2001 From: Martin Kloesch Date: Tue, 16 Apr 2019 15:23:31 +0200 Subject: [PATCH] adds Loader parameter to calls to yaml.load to avoid deprecation warning. see also: https://github.com/croach/Flask-Fixtures/issues/34 Signed-off-by: Martin Kloesch --- flask_fixtures/loaders.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flask_fixtures/loaders.py b/flask_fixtures/loaders.py index a8b970b..2d9f98d 100644 --- a/flask_fixtures/loaders.py +++ b/flask_fixtures/loaders.py @@ -35,10 +35,11 @@ def dtparse(dtstring): try: import yaml except ImportError: - def load(self, filename): + def load(self, filename, Loader=None): raise Exception("Could not load fixture '{0}'. Make sure you have PyYAML installed.".format(filename)) yaml = type('FakeYaml', (object,), { - 'load': load + 'load': load, + 'loader': type('FakeLoader', (object,), {'FullLoader': None})() })() @@ -74,7 +75,7 @@ class YAMLLoader(FixtureLoader): def load(self, filename): with open(filename) as fin: - return yaml.load(fin) + return yaml.load(fin, yaml.loader.FullLoader) def load(filename):