Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
fslpy
Commits
6bb3dd4d
Commit
6bb3dd4d
authored
5 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT: Fix invalid escape sequences
parent
7f11fabf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fsl/utils/filetree/parse.py
+2
-2
2 additions, 2 deletions
fsl/utils/filetree/parse.py
fsl/utils/filetree/utils.py
+6
-6
6 additions, 6 deletions
fsl/utils/filetree/utils.py
with
8 additions
and
8 deletions
fsl/utils/filetree/parse.py
+
2
−
2
View file @
6bb3dd4d
...
...
@@ -77,7 +77,7 @@ def read_line(line: str) -> Tuple[int, PurePath, str]:
"""
Parses line from the tree file
:param line: input line from a
\
*.tree file
:param line: input line from a
``
*.tree
``
file
:return: Tuple with:
- number of spaces in front of the name
...
...
@@ -105,7 +105,7 @@ def read_subtree_line(line: str, directory: str) -> Tuple[int, "filetree.FileTre
"""
Parses the line defining a sub_tree
:param line: input line from a
\
*.tree file
:param line: input line from a
``
*.tree
``
file
:param directory: containing directory
:return: Tuple with
...
...
This diff is collapsed.
Click to expand it.
fsl/utils/filetree/utils.py
+
6
−
6
View file @
6bb3dd4d
...
...
@@ -98,7 +98,7 @@ def resolve_optionals(text):
else
:
return
''
res
=
[
resolve_single_optional
(
text
)
for
text
in
re
.
split
(
'
(\[.*?\])
'
,
text
)]
res
=
[
resolve_single_optional
(
text
)
for
text
in
re
.
split
(
r
'
(\[.*?\])
'
,
text
)]
return
''
.
join
(
res
)
...
...
@@ -109,7 +109,7 @@ def find_variables(template):
:param template: full template
:return: sequence of variables
"""
return
tuple
(
var
.
split
(
'
:
'
)[
0
]
for
var
in
re
.
findall
(
"
\{(.*?)\}
"
,
template
))
return
tuple
(
var
.
split
(
'
:
'
)[
0
]
for
var
in
re
.
findall
(
r
"
\{(.*?)\}
"
,
template
))
def
optional_variables
(
template
):
...
...
@@ -121,7 +121,7 @@ def optional_variables(template):
"""
include
=
set
()
exclude
=
set
()
for
text
in
re
.
split
(
'
(\[.*?\])
'
,
template
):
for
text
in
re
.
split
(
r
'
(\[.*?\])
'
,
template
):
if
len
(
text
)
==
0
:
continue
variables
=
find_variables
(
text
)
...
...
@@ -152,13 +152,13 @@ def extract_variables(template, filename, known_vars=None):
sub_re
=
resolve_optionals
(
fill_known
(
template
,
dict
(
**
{
var
:
'
(\S+)
'
for
k
,
var
in
zip
(
keep
,
optional
)
if
k
},
**
{
var
:
'
(\S+)
'
for
var
in
remaining
.
difference
(
optional
)}
**
{
var
:
r
'
(\S+)
'
for
k
,
var
in
zip
(
keep
,
optional
)
if
k
},
**
{
var
:
r
'
(\S+)
'
for
var
in
remaining
.
difference
(
optional
)}
)
))
while
'
//
'
in
sub_re
:
sub_re
=
sub_re
.
replace
(
'
//
'
,
'
/
'
)
sub_re
=
sub_re
.
replace
(
'
.
'
,
'
\.
'
)
sub_re
=
sub_re
.
replace
(
'
.
'
,
r
'
\.
'
)
if
re
.
match
(
sub_re
,
filename
)
is
None
:
continue
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment