Skip to content

Commit 1f95860

Browse files
authored
Merge pull request #114 from sappelhoff/perf/info-channel-info-dedup
perf(info): avoid duplicate desc().child() lookup in _get_channel_info
2 parents 37e6122 + 38d95a3 commit 1f95860

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/pylsl/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,10 @@ def get_channel_units(self) -> typing.Optional[list[typing.Optional[str]]]:
319319

320320
def _get_channel_info(self, name) -> typing.Optional[list[typing.Optional[str]]]:
321321
"""Get the 'channel/name' element in the XML tree."""
322-
if self.desc().child("channels").empty():
322+
channels = self.desc().child("channels")
323+
if channels.empty():
323324
return None
324325
ch_infos = list()
325-
channels = self.desc().child("channels")
326326
ch = channels.child("channel")
327327
while not ch.empty():
328328
ch_info = ch.child(name).first_child().value()

0 commit comments

Comments
 (0)