strutils: Defer import of pyparsing
This is a slow import and the single user of it, the 'split_by_commas' helper, does not appear to have any users outside of python-glareclient (which is a dead project). We might want to remove the user at some point, but for now simply defer loading of the library. Change-Id: I91d0c6eec5333a660f995a9d1436e4b068693900 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
383789ce70
commit
0eaa7de6a7
@ -23,8 +23,6 @@ import re
|
|||||||
import unicodedata
|
import unicodedata
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import pyparsing as pp
|
|
||||||
|
|
||||||
from oslo_utils._i18n import _
|
from oslo_utils._i18n import _
|
||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
|
|
||||||
@ -577,8 +575,13 @@ def split_by_commas(value):
|
|||||||
|
|
||||||
.. versionadded:: 3.17
|
.. versionadded:: 3.17
|
||||||
"""
|
"""
|
||||||
word = (pp.QuotedString(quoteChar='"', escChar='\\') |
|
# pyparsing is a slow import; defer loading until we need it
|
||||||
pp.Word(pp.printables, excludeChars='",'))
|
import pyparsing as pp
|
||||||
|
|
||||||
|
word = (
|
||||||
|
pp.QuotedString(quoteChar='"', escChar='\\') |
|
||||||
|
pp.Word(pp.printables, excludeChars='",')
|
||||||
|
)
|
||||||
grammar = pp.stringStart + pp.delimitedList(word) + pp.stringEnd
|
grammar = pp.stringStart + pp.delimitedList(word) + pp.stringEnd
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user