mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:37:07 +00:00
Add function to convert regex flags string to Python
This commit is contained in:
@@ -64,3 +64,15 @@ def files (globspec = None, include_archived = False):
|
||||
|
||||
def surveys (globspec = None, include_archived = False):
|
||||
return [i[1] for i in files(globspec, include_archived)]
|
||||
|
||||
def rxflags (flagstr):
|
||||
"""
|
||||
Convert flags string into a Python flags argument.
|
||||
"""
|
||||
flags = 0
|
||||
cases = {
|
||||
"i": re.I
|
||||
}
|
||||
for flag in flagstr:
|
||||
flags |= cases.get(flag, 0)
|
||||
return flags
|
||||
|
||||
Reference in New Issue
Block a user