diff options
-rw-r--r-- | oslo_utils/strutils.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/oslo_utils/strutils.py b/oslo_utils/strutils.py index 5d551f8..2bd89ee 100644 --- a/oslo_utils/strutils.py +++ b/oslo_utils/strutils.py @@ -23,8 +23,6 @@ import re import unicodedata import urllib -import pyparsing as pp - from oslo_utils._i18n import _ from oslo_utils import encodeutils @@ -575,8 +573,13 @@ def split_by_commas(value): .. versionadded:: 3.17 """ - word = (pp.QuotedString(quoteChar='"', escChar='\\') | - pp.Word(pp.printables, excludeChars='",')) + # pyparsing is a slow import; defer loading until we need it + import pyparsing as pp + + word = ( + pp.QuotedString(quoteChar='"', escChar='\\') | + pp.Word(pp.printables, excludeChars='",') + ) grammar = pp.stringStart + pp.delimitedList(word) + pp.stringEnd try: |