Skip to content

Commit

Permalink
apply isort and black + update setup.py + remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienGrv committed Sep 25, 2020
1 parent 8d4a0d0 commit 4e9a9a1
Show file tree
Hide file tree
Showing 52 changed files with 624 additions and 801 deletions.
4 changes: 1 addition & 3 deletions asammdf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
logger.addHandler(console)
logger.setLevel(logging.ERROR)


from .blocks.mdf_v2 import MDF2
from .blocks.mdf_v3 import MDF3
from .blocks.mdf_v4 import MDF4
from .mdf import MDF, SUPPORTED_VERSIONS
from .gui import plot
from .mdf import MDF, SUPPORTED_VERSIONS
from .signal import Signal
from .version import __version__

Expand All @@ -27,7 +26,6 @@
except ImportError:
__cextension__ = False


__all__ = [
"__cextension__",
"__version__",
Expand Down
4 changes: 2 additions & 2 deletions asammdf/blocks/bus_logging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def extract_signal(signal, payload, raw=False, ignore_value2text_conversion=True
conv[f"lower_{i}"] = val
conv[f"text_{i}"] = text

conv['default'] = from_dict({'a': a, 'b': b})
conv["default"] = from_dict({"a": a, "b": b})

conv = from_dict(conv)
vals = conv.convert(vals)
Expand Down Expand Up @@ -182,7 +182,7 @@ def extract_mux(
include_message_name=False,
ignore_value2text_conversion=True,
):
""" extract multiplexed CAN signals from the raw payload
"""extract multiplexed CAN signals from the raw payload
Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion asammdf/blocks/conversion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def conversion_transfer(conversion, version=3):
""" convert between mdf4 and mdf3 channel conversions
"""convert between mdf4 and mdf3 channel conversions
Parameters
----------
Expand Down
31 changes: 12 additions & 19 deletions asammdf/blocks/mdf_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from collections import defaultdict
from copy import deepcopy
from functools import reduce
from itertools import product
import logging
from math import ceil
Expand All @@ -21,19 +20,13 @@
column_stack,
concatenate,
dtype,
flip,
float32,
float64,
frombuffer,
linspace,
packbits,
roll,
searchsorted,
uint8,
uint16,
union1d,
unique,
unpackbits,
zeros,
)
from numpy.core.defchararray import decode, encode
Expand Down Expand Up @@ -384,7 +377,7 @@ def _load_data(self, group, record_offset=0, record_count=None, optimize_read=Tr
yield b"", 0, _count

def _prepare_record(self, group):
""" compute record dtype and parents dict for this group
"""compute record dtype and parents dict for this group
Parameters
----------
Expand Down Expand Up @@ -626,7 +619,7 @@ def _get_not_byte_aligned_data(self, data, group, ch_nr):

else:
vals = column_stack(
[vals, zeros(len(vals), dtype=f"<({extra_bytes},)u1"),]
[vals, zeros(len(vals), dtype=f"<({extra_bytes},)u1")]
)
try:
vals = vals.view(f"<u{std_size}").ravel()
Expand Down Expand Up @@ -885,7 +878,7 @@ def _read(self, mapped=False):
# check if it has channel dependencies
if new_ch.component_addr:
dep = ChannelDependency(
address=new_ch.component_addr, stream=stream,
address=new_ch.component_addr, stream=stream
)
grp.channel_dependencies.append(dep)
else:
Expand Down Expand Up @@ -975,7 +968,7 @@ def configure(
integer_interpolation=None,
copy_on_get=None,
):
""" configure MDF parameters
"""configure MDF parameters
Parameters
----------
Expand Down Expand Up @@ -1021,7 +1014,7 @@ def configure(
self.copy_on_get = copy_on_get

def add_trigger(self, group, timestamp, pre_time=0, post_time=0, comment=""):
""" add trigger to data group
"""add trigger to data group
Parameters
----------
Expand Down Expand Up @@ -2258,7 +2251,7 @@ def _append_dataframe(self, df, acquisition_info="", units=None):
gp.trigger = None

def close(self):
""" if the MDF was created with memory='minimum' and new
"""if the MDF was created with memory='minimum' and new
channels have been appended, then this must be called just before the
object is not used anymore to clean-up the temporary file
Expand Down Expand Up @@ -3063,7 +3056,7 @@ def get_master(
record_count=None,
one_piece=False,
):
""" returns master channel samples for given group
"""returns master channel samples for given group
Parameters
----------
Expand Down Expand Up @@ -3230,7 +3223,7 @@ def get_master(
return timestamps.copy()

def iter_get_triggers(self):
""" generator that yields triggers
"""generator that yields triggers
Returns
-------
Expand Down Expand Up @@ -3642,7 +3635,7 @@ def _sort(self):
group.sorted = True

def included_channels(
self, index=None, channels=None, skip_master=True, minimal=True,
self, index=None, channels=None, skip_master=True, minimal=True
):

if channels is None:
Expand Down Expand Up @@ -3742,7 +3735,7 @@ def _yield_selected_signals(

for idx, fragment in enumerate(
self._load_data(
group, record_offset=record_offset, record_count=record_count,
group, record_offset=record_offset, record_count=record_count
)
):

Expand Down Expand Up @@ -3806,11 +3799,11 @@ def _yield_selected_signals(
.view(sig.samples.dtype)
)
sig.samples = encode(
decode(sig.samples, "utf-16-be"), "latin-1",
decode(sig.samples, "utf-16-be"), "latin-1"
)
else:
sig.samples = encode(
decode(sig.samples, sig.encoding), "latin-1",
decode(sig.samples, sig.encoding), "latin-1"
)
else:
encodings.append(None)
Expand Down
Loading

0 comments on commit 4e9a9a1

Please sign in to comment.