Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
source
OBSW MOD GENERATOR CORE
Commits
46c8d66e
Commit
46c8d66e
authored
Feb 25, 2021
by
Robin Mueller
Browse files
started implementing moving window
parent
50b841ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
returnvalues/mib_returnvalues_parser.py
View file @
46c8d66e
...
...
@@ -65,6 +65,9 @@ class ReturnValueParser(FileParser):
self
.
interfaces
=
interfaces
self
.
return_value_dict
=
dict
()
self
.
count
=
0
self
.
moving_window_size
=
5
# Moving window of 5 lines will be used
self
.
moving_window
=
[
""
]
*
self
.
moving_window_size
# Stores last three lines
self
.
last_lines
=
[
""
,
""
,
""
]
self
.
current_interface_id_entries
=
{
...
...
@@ -90,8 +93,18 @@ class ReturnValueParser(FileParser):
print_truncated_entries
=
args
[
0
]
else
:
print_truncated_entries
=
False
for
line
in
all_lines
:
self
.
__handle_line_reading
(
line
,
file_name
,
print_truncated_entries
)
for
line_idx
,
line
in
enumerate
(
all_lines
):
print
(
line_idx
)
if
line_idx
<
self
.
moving_window_size
:
self
.
moving_window
[
line_idx
-
1
]
=
line
else
:
self
.
moving_window
[
4
]
=
line
for
idx
in
range
(
1
,
4
):
self
.
moving_window
[
idx
]
=
self
.
moving_window
[
idx
-
1
]
if
line_idx
>=
5
:
pass
# for line in all_lines:
# self.__handle_line_reading(line, file_name, print_truncated_entries)
def
__handle_line_reading
(
self
,
line
,
file_name
,
print_truncated_entries
:
bool
):
newline
=
line
...
...
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