Attention is currently required from: dexter, laforge.
fixeria has posted comments on this change. (
https://gerrit.osmocom.org/c/pysim/+/35440?usp=email )
Change subject: Fix enumeration of GlobbalPlatformISDR during card_init()
......................................................................
Patch Set 1:
(1 comment)
File pySim/global_platform.py:
https://gerrit.osmocom.org/c/pysim/+/35440/comment/98c6e6a5_f0f8d0c1
PS1, Line 262: intermediate = False
Something that only exists in CardApplicationSD but
not any derived classes.
This can be done by making `intermediate` private by renaming it to `__intermediate`.
This prefix makes fields and methods somewhat special:
```
class Parent:
# this field can be accessed as self.__intermediate by methods of this class,
# but not by methods of child classes and not from the outside
__intermediate = True
class Child(Parent):
pass
>> Parent.__intermediate # yields
AttributeError
>> Child.__intermediate # yields AttributeError
>> Parent._Parent__intermediate # True
>> Child._Parent__intermediate # True
>> Child._Child__intermediate # yields AttributeError
```
As can be seen, `Child` class still does inherit field `__intermediate`, but Python
prepends the parent class name to it. So you can use this when iterating over the
sub-classes of `CardApplication`:
```
if hasattr(app_cls, '_' + app_cls.__name__ + '__intermediate'):
continue # skip intermediate classes
```
See also:
https://stackoverflow.com/questions/20261517/inheritance-of-private-and-pro….
--
To view, visit
https://gerrit.osmocom.org/c/pysim/+/35440?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I7fb1637f8f7a149b536c4d77dac92736c526aa6c
Gerrit-Change-Number: 35440
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Wed, 27 Dec 2023 16:01:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge <laforge(a)osmocom.org>
Gerrit-MessageType: comment