-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve typing: legacy includes / db2
Change-Id: I675130a4eab43a88c7db284163d212a59d581702
- Loading branch information
Showing
8 changed files
with
35 additions
and
41 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (C) 2019 Checkmk GmbH - License: GNU General Public License v2 | ||
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and | ||
# conditions defined in the file COPYING, which is part of this source code package. | ||
|
||
from collections.abc import Mapping | ||
|
||
from cmk.agent_based.v2 import StringTable | ||
|
||
# this is the truth, but Sequence/tuple would be more desirable than a list. | ||
Section = tuple[int | None, Mapping[str, list[list[str]]]] | ||
|
||
|
||
def parse_db2_dbs(string_table: StringTable) -> Section: | ||
current_instance = None | ||
dbs: dict[str, list[list[str]]] = {} | ||
global_timestamp = None | ||
for line in string_table: | ||
if line[0].startswith("TIMESTAMP") and not current_instance: | ||
global_timestamp = int(line[1]) | ||
continue | ||
|
||
if line[0].startswith("[[["): | ||
current_instance = line[0][3:-3] | ||
dbs[current_instance] = [] | ||
elif current_instance: | ||
dbs[current_instance].append(line) | ||
|
||
return global_timestamp, dbs |