Skip to content

Commit 28d969c

Browse files
authored
Merge pull request #106 from sappelhoff/repr
ENH: add __str__ and __repr__ for StreamInfo
2 parents 5e88eac + cf15fa4 commit 28d969c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/pylsl/info.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@ def __del__(self):
102102
except Exception as e:
103103
print(f"StreamInfo deletion triggered error: {e}")
104104

105+
def __str__(self):
106+
return (
107+
f"<StreamInfo name='{self.name()}', type='{self.type()}', "
108+
f"channels={self.channel_count()}, srate={self.nominal_srate()}, "
109+
f"format={self.channel_format()}, source_id='{self.source_id()}'>"
110+
)
111+
112+
def __repr__(self):
113+
return self.__str__()
114+
105115
# === Core Information (assigned at construction) ===
106116

107117
def name(self) -> str:

0 commit comments

Comments
 (0)