Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tuneit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
tuneit
Commits
ce83dad2
Commit
ce83dad2
authored
Jan 23, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sections can now be loaded from the 'sections' folder
parent
c1de09d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
yml_tools.py
src/settings/tools/yml_tools.py
+19
-0
No files found.
src/settings/tools/yml_tools.py
View file @
ce83dad2
...
...
@@ -31,6 +31,7 @@ def load_modules():
def
load_yaml_files_from_directory
(
directory
):
yaml_data
=
[]
for
file
in
os
.
listdir
(
directory
):
if
file
.
endswith
(
".yml"
)
or
file
.
endswith
(
".yaml"
):
file_path
=
os
.
path
.
join
(
directory
,
file
)
...
...
@@ -43,4 +44,22 @@ def load_yaml_files_from_directory(directory):
yaml_data
.
extend
(
data
)
except
yaml
.
YAMLError
as
e
:
print
(
f
"Ошибка при чтении файла {file_path}: {e}"
)
sections_data
=
[]
sections_directory
=
os
.
path
.
join
(
directory
,
'sections'
)
if
os
.
path
.
exists
(
sections_directory
)
and
os
.
path
.
isdir
(
sections_directory
):
for
file
in
os
.
listdir
(
sections_directory
):
if
file
.
endswith
(
".yml"
)
or
file
.
endswith
(
".yaml"
):
file_path
=
os
.
path
.
join
(
sections_directory
,
file
)
with
open
(
file_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
try
:
data
=
yaml
.
safe_load
(
f
)
if
data
:
sections_data
.
extend
(
data
)
except
yaml
.
YAMLError
as
e
:
print
(
f
"Ошибка при чтении файла {file_path}: {e}"
)
for
module
in
yaml_data
:
module
[
'sections'
]
=
sections_data
return
yaml_data
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment