Skip to content

Commit ea69f4a

Browse files
committed
line filtering
1 parent 47fb2dd commit ea69f4a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/nrfcredstore/credstore.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ def list(self, tag = None, type: CredType = CredType.ANY) -> List[Credential]:
6464
response_lines = response.splitlines()
6565
response_lines = [line.strip() for line in response_lines if line.strip()]
6666

67-
columns = map(lambda line: line.replace('%CMNG: ', '').replace('"', '').split(','), response_lines)
67+
# filter only lines beginning with the prefix
68+
clean_lines = filter(lambda l: l.startswith("%CMNG:"), response_lines)
69+
70+
columns = map(lambda line: line.replace('%CMNG: ', '').replace('"', '').split(','), clean_lines)
6871
cred_map = map(lambda columns:
6972
Credential(int(columns[0]), int(columns[1]), columns[2].strip()),
7073
columns

0 commit comments

Comments
 (0)