Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
avalentino committed Nov 16, 2024
1 parent 405e30e commit b83f63a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bpack/st.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _to_fmt(


def _enum_decode_converter_factory(type_, converters_map=None):
converters_map = converters_map if converters_map is not None else dict()
converters_map = converters_map if converters_map is not None else {}
enum_item_type = bpack.utils.enum_item_type(type_)
if enum_item_type in converters_map:
base_converter = converters_map[enum_item_type]
Expand All @@ -142,7 +142,7 @@ def to_enum(x):


def _enum_encode_converter_factory(type_, converters_map=None):
converters_map = converters_map if converters_map is not None else dict()
converters_map = converters_map if converters_map is not None else {}
enum_item_type = bpack.utils.enum_item_type(type_)
if enum_item_type in converters_map:
base_converter = converters_map[enum_item_type]
Expand Down
8 changes: 4 additions & 4 deletions bpack/tests/test_backends_codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,10 +1335,10 @@ class NestedRecord:
def test_nested_record_decoder_with_order(self, backend):
encoded_data = self.get_encoded_data(backend.Decoder.baseunits)
if backend.Decoder.baseunits is bpack.EBaseUnits.BITS:
kwargs = dict(bitorder=">", byteorder=">")
kwargs = {"bitorder": ">", "byteorder": ">"}
else:
# TODO: use the default byteorder (see get_encoded_data)
kwargs = dict(byteorder=bpack.EByteOrder.LE)
kwargs = {"byteorder": bpack.EByteOrder.LE}

@backend.decoder # NOTE: this is a decoder
@bpack.descriptor(baseunits=backend.Decoder.baseunits, **kwargs)
Expand All @@ -1359,10 +1359,10 @@ class NestedRecord:
def test_nested_record_encoder_with_order(self, backend):
encoded_data = self.get_encoded_data(backend.Decoder.baseunits)
if backend.Decoder.baseunits is bpack.EBaseUnits.BITS:
kwargs = dict(bitorder=">", byteorder=">")
kwargs = {"bitorder": ">", "byteorder": ">"}
else:
# TODO: use the default byteorder (see get_encoded_data)
kwargs = dict(byteorder=bpack.EByteOrder.LE)
kwargs = {"byteorder": bpack.EByteOrder.LE}

@backend.encoder # NOTE: this is a encoder
@bpack.descriptor(baseunits=backend.Decoder.baseunits, **kwargs)
Expand Down
7 changes: 4 additions & 3 deletions bpack/tests/test_desctiptor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,10 @@ class Record:
field_2: float = bpack.field(size=4, default=0.1)

record = Record()
assert bpack.asdict(record) == dict(
field_1=record.field_1, field_2=record.field_2
)
assert bpack.asdict(record) == {
"field_1": record.field_1,
"field_2": record.field_2,
}


def test_astuple():
Expand Down

0 comments on commit b83f63a

Please sign in to comment.