Mercurial > piecrust2
changeset 444:1359b2b0cc73
performance: Use the fast YAML loader if available.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 29 Jun 2015 18:12:31 -0700 |
parents | 6b9f59b19db7 |
children | d8d86debea81 |
files | piecrust/configuration.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/piecrust/configuration.py Sun Jun 28 15:00:23 2015 -0700 +++ b/piecrust/configuration.py Mon Jun 29 18:12:31 2015 -0700 @@ -3,6 +3,10 @@ import collections.abc import yaml from yaml.constructor import ConstructorError +try: + from yaml import CSafeLoader as SafeLoader +except ImportError: + from yaml import SafeLoader logger = logging.getLogger(__name__) @@ -166,7 +170,7 @@ return config, offset -class ConfigurationLoader(yaml.SafeLoader): +class ConfigurationLoader(SafeLoader): """ A YAML loader that loads mappings into ordered dictionaries. """ def __init__(self, *args, **kwargs):