Change in pysim[master]: filesystem: fix flag model used with get_selectable_names()

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/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Mar 18 22:02:41 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/23402 )


Change subject: filesystem: fix flag model used with get_selectable_names()
......................................................................

filesystem: fix flag model used with get_selectable_names()

The flags NAMES, FIDS and APPS do not properly distinguish between
applications and normal files. With APPS it is only possible to exclude
or include the selectable applications in a list with NAMES or FIDS, but
it is not possible to get only the application names or identifiers.

- remove the APPS flag
- rename NAMES to FNAMES and make it only normal file related
- add ANAMES and relate it only to application (ADF) names
- add AIDS and relate it only to application identifiers

Change-Id: Id07e0dcbab10cd78c1b78d37319b7b0e5e83b64d
Related: OS#4963
---
M pySim/filesystem.py
1 file changed, 6 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/02/23402/1

diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 664c722..ad020af 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -93,7 +93,7 @@
             sels.update({alias: self})
         if self.fid and (flags == [] or 'FIDS' in flags):
             sels.update({self.fid: self})
-        if self.name and (flags == [] or 'NAMES' in flags):
+        if self.name and (flags == [] or 'FNAMES' in flags):
             sels.update({self.name: self})
         return sels
 
@@ -111,8 +111,7 @@
             mf = self.get_mf()
             if mf:
                 sels.update(mf._get_self_selectables(flags = flags))
-                if flags == [] or 'APPS' in flags:
-                    sels.update(mf.get_app_selectables(flags))
+                sels.update(mf.get_app_selectables(flags = flags))
         return sels
 
     def get_selectable_names(self, flags = []):
@@ -169,7 +168,7 @@
         sels = super().get_selectables(flags)
         if flags == [] or 'FIDS' in flags:
                 sels.update({x.fid: x for x in self.children.values() if x.fid})
-        if flags == [] or 'NAMES' in flags:
+        if flags == [] or 'FNAMES' in flags:
                 sels.update({x.name: x for x in self.children.values() if x.name})
         return sels
 
@@ -226,16 +225,15 @@
     def get_selectables(self, flags = []):
         """Get list of completions (DF/EF/ADF names) from current DF"""
         sels = super().get_selectables(flags)
-        if flags == [] or 'APPS' in flags:
-                sels.update(self.get_app_selectables(flags))
+        sels.update(self.get_app_selectables(flags))
         return sels
 
     def get_app_selectables(self, flags = []):
         """Get applications by AID + name"""
         sels = {}
-        if flags == [] or 'FIDS' in flags:
+        if flags == [] or 'AIDS' in flags:
                 sels.update({x.aid: x for x in self.applications.values()})
-        if flags == [] or 'NAMES' in flags:
+        if flags == [] or 'ANAMES' in flags:
                 sels.update({x.name: x for x in self.applications.values() if x.name})
         return sels
 

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Id07e0dcbab10cd78c1b78d37319b7b0e5e83b64d
Gerrit-Change-Number: 23402
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210318/6cfd79ec/attachment.htm>


More information about the gerrit-log mailing list