Skip to content

Commit 7a3fe1b

Browse files
committed
Cleanup comments
1 parent d402b59 commit 7a3fe1b

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

‎addons/cppcheckdata.py‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,10 +1386,9 @@ class CppcheckData:
13861386
suppressions List of Suppressions
13871387
files Source files for elements occurred in this configuration
13881388
1389-
The configurations property loads all configurations once and keeps them,
1390-
which is best when the configurations are iterated more than once.
1391-
iterconfigurations() parses the dump file on each call but creates one
1392-
configuration at a time, which uses less memory for a single iteration.
1389+
To iterate more than once, use the configurations property: it parses the
1390+
dump file once and keeps all configurations. To iterate once, use
1391+
iterconfigurations(): it parses on each call but uses less memory.
13931392
13941393
To iterate through all configurations use such code:
13951394
@code
@@ -1450,9 +1449,8 @@ def __init__(self, filename):
14501449
def configurations(self):
14511450
"""
14521451
Return the list of all available Configuration objects.
1453-
The configurations are loaded on the first access and kept, so later
1454-
accesses and iterconfigurations() do not parse the dump file again.
1455-
All configurations stay in memory as long as this object exists.
1452+
The list is loaded on first access and kept for later accesses and
1453+
iterconfigurations().
14561454
"""
14571455
if self._configurations is None:
14581456
self._configurations = list(self.iterconfigurations())
@@ -1462,10 +1460,8 @@ def iterconfigurations(self):
14621460
"""
14631461
Create and return iterator for the available Configuration objects.
14641462
The iterator loops over all Configurations in the dump file tree, in document order.
1465-
If the configurations property has been used then the kept configurations
1466-
are returned. Otherwise the dump file is parsed and each configuration is
1467-
created when the iterator reaches it, so a configuration can be freed when
1468-
the caller is done with it. Each call parses the dump file again.
1463+
Uses the kept list if the configurations property has been accessed,
1464+
otherwise parses the dump file one configuration at a time.
14691465
"""
14701466
if self._configurations is not None:
14711467
yield from self._configurations

‎test/addon/test_cppcheckdata.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_configurations_kept(self, multi_cfg_data):
107107
def test_iterconfigurations_not_kept(self, multi_cfg_data):
108108
data = cppcheckdata.parsedump(multi_cfg_data.filename)
109109
first = next(data.iterconfigurations())
110-
# without the configurations property each call parses the dump file again
110+
# each call parses the dump file again
111111
assert next(data.iterconfigurations()) is not first
112112
assert len(data.configurations) == 2
113113
assert data.configurations[0] is not first

0 commit comments

Comments
 (0)