Attention is currently required from: laforge.
dexter has posted comments on this change by dexter. (
https://gerrit.osmocom.org/c/pysim/+/38195?usp=email )
Change subject: filesystem: pass total_len to construct of when encoding file contents
......................................................................
Patch Set 3:
(1 comment)
File pySim/filesystem.py:
https://gerrit.osmocom.org/c/pysim/+/38195/comment/63d2106f_d68471e6?usp=em… :
PS2, Line 1338: def _decode_bin(self, raw_bin_data: bytearray):
: chunks = [raw_bin_data[i:i+self.rec_len]
: for i in range(0, len(raw_bin_data), self.rec_len)]
: return [self.decode_record_bin(x) for x in chunks]
:
: def _encode_bin(self, abstract_data) -> bytes:
: chunks = [self.encode_record_bin(x) for x in abstract_data]
: # FIXME: pad to file size
: return b''.join(chunks)
you are not passing the total_len as argument to the
self.{encode,decode}_record_bin here. […]
Thanks for the explaination, I think I got
my head around this now.
I have now revisited the code and have added a total_len parameter to the _encode_bin and
_encode_hex methods. I also thing that we should also have total_len parameters on the
_encode_record_hex and _encode_record_bin methods, in case someone needs the total_len
parameter in one of those custom methods.
All derived classes with custom encoder methods should now accept a total_len parameters.
I have put a kwargs on each method that does not use the total_len parameter. I have seen
that _encode_record_bin/hex have kwargs as well, so I think that makes sense.
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/38195?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I1b7a51594fbc5d9fe01132c39354a2fa88d53f9b
Gerrit-Change-Number: 38195
Gerrit-PatchSet: 3
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Comment-Date: Mon, 23 Sep 2024 16:16:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>