Change in pysim[master]: utils: Introduce DataObject representation

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Sun May 2 20:53:34 UTC 2021


fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/pysim/+/24035 )

Change subject: utils: Introduce DataObject representation
......................................................................


Patch Set 2:

(10 comments)

https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py 
File pySim/utils.py:

https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@869 
PS2, Line 869: DataObject
Is this an abstract class?


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@873 
PS2, Line 873: this
cosmetic: missing dot


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@884 
PS2, Line 884:         self.encoded = None
One of these should be 'decoded' I guess, and this is why pylint complains.


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@917 
PS2, Line 917:         raise TypeError("The derived classes must defined a from_value() method")
Let's please use @abc.abstractmethod for that.


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@921 
PS2, Line 921:         raise TypeError("The derived classes must defined a to_value() method")
Let's please use @abc.abstractmethod for that.


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@972 
PS2, Line 972: from_value
Sounds more like from_bytes() given that it accepts 'bytes'?


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@985 
PS2, Line 985: members=[]
Using objects, lists, and tuples as a default argument value is dangerous because all instances of this class will basically share the same object/list/tuple. This causes weird bugs sometimes, so I would definitely avoid it.


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@991 
PS2, Line 991:         for m in self.members:
This could be done using the comprehension:

  self.members_by_tag = { m for m in members }
  self.members_by_name = { m for m in members }


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@1097 
PS2, Line 1097: desc
Unused?


https://gerrit.osmocom.org/c/pysim/+/24035/2/pySim/utils.py@1097 
PS2, Line 1097: sequence=[])
Same here.



-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/24035
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iac18e7665481c9323cc7d22a3cd93e3da7869deb
Gerrit-Change-Number: 24035
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Comment-Date: Sun, 02 May 2021 20:53:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210502/0c79f192/attachment.htm>


More information about the gerrit-log mailing list