Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
toolbox
WindEnergyToolbox
Commits
bb928382
Commit
bb928382
authored
7 years ago
by
David Verelst
Browse files
Options
Downloads
Patches
Plain Diff
prepost.misc: standalone version of finding tags in master file
parent
ce8887f0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/prepost/misc.py
+19
-1
19 additions, 1 deletion
wetb/prepost/misc.py
with
19 additions
and
1 deletion
wetb/prepost/misc.py
+
19
−
1
View file @
bb928382
...
@@ -24,6 +24,7 @@ import sys
...
@@ -24,6 +24,7 @@ import sys
import
shutil
import
shutil
import
unittest
import
unittest
import
pickle
import
pickle
import
re
import
numpy
as
np
import
numpy
as
np
import
scipy
as
sp
import
scipy
as
sp
...
@@ -786,7 +787,24 @@ def find_tags(fname):
...
@@ -786,7 +787,24 @@ def find_tags(fname):
"""
"""
Find all unqiue tags in a text file.
Find all unqiue tags in a text file.
"""
"""
pass
with
open
(
fname
,
'
r
'
)
as
f
:
lines
=
f
.
readlines
()
# regex for finding all tags in a line
regex
=
re
.
compile
(
'
(
\\
[.*?
\\
])
'
)
tags_in_master
=
{}
for
i
,
line
in
enumerate
(
lines
):
# are there any tags on this line? Ignore comment AND label section
tags
=
regex
.
findall
(
line
.
split
(
'
;
'
)[
0
].
split
(
'
#
'
)[
0
])
for
tag
in
tags
:
try
:
tags_in_master
[
tag
].
append
(
i
)
except
KeyError
:
tags_in_master
[
tag
]
=
[
i
]
return
tags_in_master
def
read_mathematica_3darray
(
fname
,
shape
=
None
,
data
=
None
,
dtype
=
None
):
def
read_mathematica_3darray
(
fname
,
shape
=
None
,
data
=
None
,
dtype
=
None
):
...
...
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