Skip to content

Commit ac1df03

Browse files
committed
Remove gzip classes
1 parent a2b840d commit ac1df03

File tree

3 files changed

+2
-69
lines changed

3 files changed

+2
-69
lines changed

can/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626

2727
from .io import Logger, SizedRotatingLogger, Printer, LogReader, MessageSync
28-
from .io import ASCWriter, ASCReader, GzipASCWriter, GzipASCReader
28+
from .io import ASCWriter, ASCReader
2929
from .io import BLFReader, BLFWriter
3030
from .io import CanutilsLogReader, CanutilsLogWriter
3131
from .io import CSVWriter, CSVReader

can/io/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .player import LogReader, MessageSync
99

1010
# Format specific
11-
from .asc import ASCWriter, ASCReader, GzipASCWriter, GzipASCReader
11+
from .asc import ASCWriter, ASCReader
1212
from .blf import BLFReader, BLFWriter
1313
from .canutils import CanutilsLogReader, CanutilsLogWriter
1414
from .csv import CSVWriter, CSVReader

can/io/asc.py

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
- https://bitbucket.org/tobylorenz/vector_asc/src/47556e1a6d32c859224ca62d075e1efcc67fa690/src/Vector/ASC/tests/unittests/data/CAN_Log_Trigger_3_2.asc?at=master&fileviewer=file-view-default
66
- under `test/data/logfile.asc`
77
"""
8-
import gzip
98
import re
109
from typing import Any, Generator, List, Optional, Dict, Union, TextIO
1110

@@ -405,69 +404,3 @@ def on_message_received(self, msg: Message) -> None:
405404
data=" ".join(data),
406405
)
407406
self.log_event(serialized, msg.timestamp)
408-
409-
410-
class GzipASCReader(ASCReader):
411-
"""Gzipped version of :class:`~can.ASCReader`"""
412-
413-
def __init__(
414-
self,
415-
file: Union[typechecking.FileLike, typechecking.StringPathLike],
416-
base: str = "hex",
417-
relative_timestamp: bool = True,
418-
):
419-
"""
420-
:param file: a path-like object or as file-like object to read from
421-
If this is a file-like object, is has to opened in text
422-
read mode, not binary read mode.
423-
:param base: Select the base(hex or dec) of id and data.
424-
If the header of the asc file contains base information,
425-
this value will be overwritten. Default "hex".
426-
:param relative_timestamp: Select whether the timestamps are
427-
`relative` (starting at 0.0) or `absolute` (starting at
428-
the system time). Default `True = relative`.
429-
"""
430-
self._fileobj = None
431-
if file is not None and (hasattr(file, "read") and hasattr(file, "write")):
432-
# file is None or some file-like object
433-
self._fileobj = file
434-
super(GzipASCReader, self).__init__(
435-
gzip.open(file, mode="rt"), base, relative_timestamp
436-
)
437-
438-
def stop(self) -> None:
439-
super(GzipASCReader, self).stop()
440-
if self._fileobj is not None:
441-
self._fileobj.close()
442-
443-
444-
class GzipASCWriter(ASCWriter):
445-
"""Gzipped version of :class:`~can.ASCWriter`"""
446-
447-
def __init__(
448-
self,
449-
file: Union[typechecking.FileLike, typechecking.StringPathLike],
450-
channel: int = 1,
451-
compresslevel: int = 6,
452-
):
453-
"""
454-
:param file: a path-like object or as file-like object to write to
455-
If this is a file-like object, is has to opened in text
456-
write mode, not binary write mode.
457-
:param channel: a default channel to use when the message does not
458-
have a channel set
459-
:param compresslevel: Gzip compresslevel, see
460-
:class:`~gzip.GzipFile` for details. The default is 6.
461-
"""
462-
self._fileobj = None
463-
if file is not None and (hasattr(file, "read") and hasattr(file, "write")):
464-
# file is None or some file-like object
465-
self._fileobj = file
466-
super(GzipASCWriter, self).__init__(
467-
gzip.open(file, mode="wt", compresslevel=compresslevel), channel
468-
)
469-
470-
def stop(self) -> None:
471-
super(GzipASCWriter, self).stop()
472-
if self._fileobj is not None:
473-
self._fileobj.close()

0 commit comments

Comments
 (0)