@@ -65,7 +65,6 @@ def __init__(self, tractogram, header=None):
6565 ----------
6666 tractogram : :class:`Tractogram` object
6767 Tractogram that will be contained in this :class:`TckFile`.
68-
6968 header : dict (optional)
7069 Metadata associated to this tractogram file.
7170
@@ -101,7 +100,8 @@ def is_correct_format(cls, fileobj):
101100 with Opener (fileobj ) as f :
102101 magic_number = f .fobj .readline ()
103102 f .seek (- len (magic_number ), os .SEEK_CUR )
104- return magic_number .strip () == cls .MAGIC_NUMBER
103+
104+ return magic_number .strip () == cls .MAGIC_NUMBER
105105
106106 @classmethod
107107 def load (cls , fileobj , lazy_load = False ):
@@ -229,8 +229,8 @@ def _write_header(fileobj, header):
229229 Parameters
230230 ----------
231231 fileobj : file-like object
232- An open file-like object pointing to TCK file (and ready to read
233- from the beginning of the TCK header).
232+ An open binary file object pointing to TCK file (and ready to
233+ write at the beginning of the TCK header).
234234 """
235235 # Fields to exclude
236236 exclude = [Field .MAGIC_NUMBER , # Handled separately.
@@ -244,7 +244,8 @@ def _write_header(fileobj, header):
244244 lines .append ("count: {0:010}" .format (header [Field .NB_STREAMLINES ]))
245245 lines .append ("datatype: Float32LE" ) # Always Float32LE.
246246 lines .extend (["{0}: {1}" .format (k , v )
247- for k , v in header .items () if k not in exclude and not k .startswith ("_" )])
247+ for k , v in header .items ()
248+ if k not in exclude and not k .startswith ("_" )])
248249 lines .append ("file: . " ) # Manually add this last field.
249250 out = "\n " .join ((asstr (line ).replace ('\n ' , '\t ' ) for line in lines ))
250251 fileobj .write (asbytes (out ))
0 commit comments