66from __future__ import annotations
77
88from collections .abc import Sequence
9- from typing import Any , Optional , Callable
9+ from typing import Any , Callable , Optional
1010
11- from .clib import clibmseed , ffi , cdata_to_string
11+ from .clib import cdata_to_string , clibmseed , ffi
1212from .definitions import DataEncoding , SubSecond , TimeFormat
1313from .exceptions import MiniSEEDError
1414from .msrecord import MS3Record
15- from .util import nstime2timestr , encoding_sizetype
15+ from .util import encoding_sizetype , nstime2timestr
1616
1717
1818class MS3RecordPtr :
@@ -100,7 +100,8 @@ def indent_repr(thing):
100100 indent_repr (self [- 1 ]),
101101 ]
102102
103- return f"MS3RecordList(recordcnt: { len (self )} \n { '\n ' .join (formatted_lines )} \n )"
103+ newline = "\n "
104+ return f"MS3RecordList(recordcnt: { len (self )} \n { newline .join (formatted_lines )} \n )"
104105
105106 def __str__ (self ) -> str :
106107 def indent_str (thing ):
@@ -119,7 +120,8 @@ def indent_str(thing):
119120 indent_str (self [- 1 ]),
120121 ]
121122
122- return f"Record list with { len (self )} records\n { '\n ' .join (formatted_lines )} "
123+ newline = "\n "
124+ return f"Record list with { len (self )} records\n { newline .join (formatted_lines )} "
123125
124126 def __len__ (self ) -> int :
125127 """Return number of records"""
@@ -567,7 +569,7 @@ def unpack_recordlist(self, buffer: Any = None, verbose: int = 0) -> int:
567569 else len (buffer )
568570 )
569571 except (TypeError , AttributeError ):
570- raise ValueError ("Buffer must support the buffer protocol" )
572+ raise ValueError ("Buffer must support the buffer protocol" ) from None
571573
572574 status = clibmseed .mstl3_unpack_recordlist (
573575 self ._parent_id ,
@@ -582,7 +584,7 @@ def unpack_recordlist(self, buffer: Any = None, verbose: int = 0) -> int:
582584 else :
583585 return status
584586
585- def has_same_data (self , other : " MS3TraceSeg" ) -> bool :
587+ def has_same_data (self , other : MS3TraceSeg ) -> bool :
586588 """Compare trace segments for equivalent data
587589
588590 Args:
@@ -637,13 +639,14 @@ def indent_repr(thing):
637639 indent_repr (self [- 1 ]),
638640 ]
639641
642+ newline = "\n "
640643 return (
641644 f"MS3TraceID(sourceid: { self .sourceid } \n "
642645 f" pubversion: { self .pubversion } \n "
643646 f" earliest: { self .earliest_str (timeformat = TimeFormat .ISOMONTHDAY_DOY_Z )} \n "
644647 f" latest: { self .latest_str (timeformat = TimeFormat .ISOMONTHDAY_DOY_Z )} \n "
645648 f" numsegments: { len (self )} \n "
646- f"{ ' \n ' .join (formatted_lines )} "
649+ f"{ newline .join (formatted_lines )} "
647650 "\n )"
648651 )
649652
@@ -867,10 +870,8 @@ def indent_repr(thing):
867870 indent_repr (self [- 1 ]),
868871 ]
869872
870- return (f"MS3TraceList(numtraceids: { len (self )} \n "
871- f"{ '\n ' .join (formatted_lines )} \n "
872- ")"
873- )
873+ newline = "\n "
874+ return f"MS3TraceList(numtraceids: { len (self )} \n { newline .join (formatted_lines )} \n )"
874875
875876 def __str__ (self ) -> str :
876877 def indent_str (thing ):
@@ -889,7 +890,8 @@ def indent_str(thing):
889890 indent_str (self [- 1 ]),
890891 ]
891892
892- return f"Trace list with { len (self )} trace IDs\n { '\n ' .join (formatted_lines )} \n "
893+ newline = "\n "
894+ return f"Trace list with { len (self )} trace IDs\n { newline .join (formatted_lines )} \n "
893895
894896 def __len__ (self ) -> int :
895897 """Return number of trace IDs in the list"""
0 commit comments