Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python_DSI_Parser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Benedikt
python_DSI_Parser
Commits
82f36bf4
Commit
82f36bf4
authored
1 year ago
by
Vanessa Stehr
Browse files
Options
Downloads
Patches
Plain Diff
Show warning in case the base unit is missing from a node
parent
1f88045d
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dsiParser.py
+10
-0
10 additions, 0 deletions
dsiParser.py
with
10 additions
and
0 deletions
dsiParser.py
+
10
−
0
View file @
82f36bf4
...
@@ -50,6 +50,9 @@ def _nodeToLatex(node: list):
...
@@ -50,6 +50,9 @@ def _nodeToLatex(node: list):
latexString
+=
r
'
{\color{red}\mathrm{
'
+
node
[
1
]
+
r
'
}}
'
latexString
+=
r
'
{\color{red}\mathrm{
'
+
node
[
1
]
+
r
'
}}
'
if
node
[
2
]:
if
node
[
2
]:
latexString
+=
r
'
^
'
+
node
[
2
]
latexString
+=
r
'
^
'
+
node
[
2
]
if
node
[
1
]
==
""
:
latexString
=
r
'
{\color{red}
'
+
latexString
+
r
'
}
'
return
latexString
return
latexString
def
_parseDsi
(
dsiString
:
str
):
def
_parseDsi
(
dsiString
:
str
):
...
@@ -139,6 +142,13 @@ def _parseFractionlessDsi(dsiString:str):
...
@@ -139,6 +142,13 @@ def _parseFractionlessDsi(dsiString:str):
except
IndexError
:
except
IndexError
:
item
=
''
item
=
''
warnings
.
warn
(
f
"
The identifier
\"
{
tuple
[
1
]
}
\"
does not match any D-SI units!
"
,
RuntimeWarning
)
warnings
.
warn
(
f
"
The identifier
\"
{
tuple
[
1
]
}
\"
does not match any D-SI units!
"
,
RuntimeWarning
)
elif
tuple
[
1
]
==
''
:
itemStr
=
""
if
tuple
[
0
]
!=
""
:
itemStr
=
itemStr
+
"
\\
"
+
tuple
[
0
]
if
tuple
[
2
]
!=
""
:
itemStr
=
itemStr
+
r
"
\tothe{
"
+
tuple
[
2
]
+
r
"
}
"
warnings
.
warn
(
f
"
This unit seems to be missing the base unit!
\"
{
itemStr
}
\"
"
,
RuntimeWarning
)
nodes
.
append
(
tuple
)
nodes
.
append
(
tuple
)
if
len
(
items
)
==
0
:
break
if
len
(
items
)
==
0
:
break
...
...
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