summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-05-31 14:54:43 +0000
committerGerrit Code Review <review@openstack.org>2022-05-31 14:54:43 +0000
commit6890f1ef2943a417aeb2320ba377a7de72eae442 (patch)
tree428029da992da085bbdb4f99f4d2b0bfcfb0e05e
parent9e23defea60f2add657501597ff1daf60341760a (diff)
parent0eaa7de6a7b4754638640e5caaec0de9832e4dbb (diff)
downloadoslo-utils-6890f1ef2943a417aeb2320ba377a7de72eae442.tar.gz
Merge "strutils: Defer import of pyparsing"5.0.0
-rw-r--r--oslo_utils/strutils.py11
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: