Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qim3d
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QIM
Tools
qim3d
Commits
eb6e6bea
Commit
eb6e6bea
authored
Jan 24, 2024
by
Christian Kento Rasmussen
Browse files
Options
Downloads
Patches
Plain Diff
Add indentation logic for object and section start
parent
ed318a75
No related branches found
No related tags found
2 merge requests
!45
Save files function
,
!44
Load vol files
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
qim3d/io/load.py
+4
-1
4 additions, 1 deletion
qim3d/io/load.py
with
4 additions
and
1 deletion
qim3d/io/load.py
+
4
−
1
View file @
eb6e6bea
...
@@ -306,6 +306,7 @@ class DataLoader:
...
@@ -306,6 +306,7 @@ class DataLoader:
with
open
(
path
,
'
r
'
)
as
f
:
with
open
(
path
,
'
r
'
)
as
f
:
for
line
in
f
:
for
line
in
f
:
line
=
line
.
strip
()
line
=
line
.
strip
()
# {NAME} is start of a new object, so should indent
if
line
.
startswith
(
'
{
'
)
and
line
.
endswith
(
'
}
'
):
if
line
.
startswith
(
'
{
'
)
and
line
.
endswith
(
'
}
'
):
section_name
=
line
[
1
:
-
1
]
section_name
=
line
[
1
:
-
1
]
current_section
[
section_name
]
=
{}
current_section
[
section_name
]
=
{}
...
@@ -313,6 +314,7 @@ class DataLoader:
...
@@ -313,6 +314,7 @@ class DataLoader:
current_section
=
current_section
[
section_name
]
current_section
=
current_section
[
section_name
]
should_indent
=
True
should_indent
=
True
# [NAME] is start of a section, so should not indent
elif
line
.
startswith
(
'
[
'
)
and
line
.
endswith
(
'
]
'
):
elif
line
.
startswith
(
'
[
'
)
and
line
.
endswith
(
'
]
'
):
section_name
=
line
[
1
:
-
1
]
section_name
=
line
[
1
:
-
1
]
...
@@ -325,6 +327,7 @@ class DataLoader:
...
@@ -325,6 +327,7 @@ class DataLoader:
current_section
=
current_section
[
section_name
]
current_section
=
current_section
[
section_name
]
should_indent
=
False
should_indent
=
False
# = is a key value pair
elif
'
=
'
in
line
:
elif
'
=
'
in
line
:
key
,
value
=
line
.
split
(
'
=
'
,
1
)
key
,
value
=
line
.
split
(
'
=
'
,
1
)
current_section
[
key
.
strip
()]
=
value
.
strip
()
current_section
[
key
.
strip
()]
=
value
.
strip
()
...
...
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