@@ -138,7 +138,7 @@ class SAS7BDATReader(ReaderBase, abc.Iterator):
138
138
Return SAS7BDATReader object for iterations, returns chunks
139
139
with given number of lines.
140
140
encoding : str, 'infer', defaults to None
141
- String encoding acc. to python standard encodings,
141
+ String encoding acc. to Python standard encodings,
142
142
encoding='infer' tries to detect the encoding from the file header,
143
143
encoding=None will leave the data in binary format.
144
144
convert_text : bool, defaults to True
@@ -242,10 +242,8 @@ def _get_properties(self) -> None:
242
242
raise ValueError ("magic number mismatch (not a SAS file?)" )
243
243
244
244
# Get alignment information
245
- align1 , align2 = 0 , 0
246
245
buf = self ._read_bytes (const .align_1_offset , const .align_1_length )
247
246
if buf == const .u64_byte_checker_value :
248
- align2 = const .align_2_value
249
247
self .U64 = True
250
248
self ._int_length = 8
251
249
self ._page_bit_offset = const .page_bit_offset_x64
@@ -258,7 +256,8 @@ def _get_properties(self) -> None:
258
256
buf = self ._read_bytes (const .align_2_offset , const .align_2_length )
259
257
if buf == const .align_1_checker_value :
260
258
align1 = const .align_2_value
261
- total_align = align1 + align2
259
+ else :
260
+ align1 = 0
262
261
263
262
# Get endianness information
264
263
buf = self ._read_bytes (const .endianness_offset , const .endianness_length )
@@ -276,23 +275,6 @@ def _get_properties(self) -> None:
276
275
else :
277
276
self .inferred_encoding = f"unknown (code={ buf } )"
278
277
279
- # Get platform information
280
- buf = self ._read_bytes (const .platform_offset , const .platform_length )
281
- if buf == b"1" :
282
- self .platform = "unix"
283
- elif buf == b"2" :
284
- self .platform = "windows"
285
- else :
286
- self .platform = "unknown"
287
-
288
- self .name = self ._read_and_convert_header_text (
289
- const .dataset_offset , const .dataset_length
290
- )
291
-
292
- self .file_type = self ._read_and_convert_header_text (
293
- const .file_type_offset , const .file_type_length
294
- )
295
-
296
278
# Timestamp is epoch 01/01/1960
297
279
epoch = datetime (1960 , 1 , 1 )
298
280
x = self ._read_float (
@@ -319,29 +301,6 @@ def _get_properties(self) -> None:
319
301
self ._page_length = self ._read_int (
320
302
const .page_size_offset + align1 , const .page_size_length
321
303
)
322
- self ._page_count = self ._read_int (
323
- const .page_count_offset + align1 , const .page_count_length
324
- )
325
-
326
- self .sas_release_offset = self ._read_and_convert_header_text (
327
- const .sas_release_offset + total_align , const .sas_release_length
328
- )
329
-
330
- self .server_type = self ._read_and_convert_header_text (
331
- const .sas_server_type_offset + total_align , const .sas_server_type_length
332
- )
333
-
334
- self .os_version = self ._read_and_convert_header_text (
335
- const .os_version_number_offset + total_align , const .os_version_number_length
336
- )
337
-
338
- self .os_name = self ._read_and_convert_header_text (
339
- const .os_name_offset + total_align , const .os_name_length
340
- )
341
- if not self .os_name :
342
- self .os_name = self ._read_and_convert_header_text (
343
- const .os_maker_offset + total_align , const .os_maker_length
344
- )
345
304
346
305
def __next__ (self ) -> DataFrame :
347
306
da = self .read (nrows = self .chunksize or 1 )
0 commit comments