Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
62e895c4
Commit
62e895c4
authored
Mar 25, 2004
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Defer compilation of regular expressions until first use.
parent
7fcc46c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
util.py
util.py
+7
-3
No files found.
util.py
View file @
62e895c4
...
...
@@ -209,9 +209,12 @@ def grok_environment_error (exc, prefix="error: "):
# Needed by 'split_quoted()'
_wordchars_re = re.compile(r'[^
\
\
\
'
\
"
%s ]*' % string.whitespace)
_squote_re = re.compile(r"'(?:[^'
\
\
]|
\
\
.)*'")
_dquote_re = re.compile(r'"(?:[^"
\
\
]|
\
\
.)*"')
_wordchars_re = _squote_re = _dquote_re = None
def _init_regex():
global _wordchars_re, _squote_re, _dquote_re
_wordchars_re = re.compile(r'[^
\
\
\
'
\
"
%s ]*' % string.whitespace)
_squote_re = re.compile(r"'(?:[^'
\
\
]|
\
\
.)*'")
_dquote_re = re.compile(r'"(?:[^"
\
\
]|
\
\
.)*"')
def split_quoted (s):
"""
Split
a
string
up
according
to
Unix
shell
-
like
rules
for
quotes
and
...
...
@@ -227,6 +230,7 @@ def split_quoted (s):
# This is a nice algorithm for splitting up a single string, since it
# doesn't require character-by-character examination. It was a little
# bit of a brain-bender to get it working right, though...
if _wordchars_re is None: _init_regex()
s = string.strip(s)
words = []
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment