Exposing some type details in the introspection XML?

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Tue Jul 7 22:42:58 UTC 2020


On Fri, 15 May 2020 15:43:19 +0200, Lennart Poettering wrote:

> Ah, yeah. Philip is my hero. And I mean:
> a(sa(sa(sa(sgya{sv})a{sv})a(sa(sga{sv})a{sv})a(sgya{sv})a{sv})a{sv}) ←
> that's just so delicious! Just think about how much more awesome this
> signature string could be if there were structures.

    ldo at theon:dbussy> python3 -ic "import dbussy"
    >>> dbussy.parse_signature("a(sa(sa(sa(sgya{sv})a{sv})a(sa(sga{sv})a{sv})a(sgya{sv})a{sv})a{sv})")
    [ArrayType[StructType((BasicType(<TYPE.STRING: 115>), ArrayType[StructType((BasicType(<TYPE.STRING: 115>), ArrayType[StructType((BasicType(<TYPE.STRING: 115>), ArrayType[StructType((BasicType(<TYPE.STRING: 115>), BasicType(<TYPE.SIGNATURE: 103>), BasicType(<TYPE.BYTE: 121>), DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]))], DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]))], ArrayType[StructType((BasicType(<TYPE.STRING: 115>), ArrayType[StructType((BasicType(<TYPE.STRING: 115>), BasicType(<TYPE.SIGNATURE: 103>), DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]))], DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]))], ArrayType[StructType((BasicType(<TYPE.STRING: 115>), BasicType(<TYPE.SIGNATURE: 103>), BasicType(<TYPE.BYTE: 121>), DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]))], DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]))], DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]))]]

Or, with a bit of two-dimensional layout applied:

    [
        ArrayType
          [
            StructType
              ((
                BasicType(<TYPE.STRING: 115>),
                ArrayType
                  [
                    StructType
                      ((
                        BasicType(<TYPE.STRING: 115>),
                        ArrayType
                          [
                            StructType
                              ((
                                BasicType(<TYPE.STRING: 115>),
                                ArrayType
                                  [
                                    StructType
                                      ((
                                        BasicType(<TYPE.STRING: 115>),
                                        BasicType(<TYPE.SIGNATURE: 103>),
                                        BasicType(<TYPE.BYTE: 121>),
                                        DictType
                                          [
                                            BasicType(<TYPE.STRING: 115>) :
                                                VariantType()
                                          ]
                                      ))
                                  ],
                                DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]
                              ))
                          ],
                        ArrayType
                          [
                            StructType
                              ((
                                BasicType(<TYPE.STRING: 115>),
                                ArrayType
                                  [
                                    StructType
                                      ((
                                        BasicType(<TYPE.STRING: 115>),
                                        BasicType(<TYPE.SIGNATURE: 103>),
                                        DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]
                                      ))
                                  ],
                                DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]
                              ))
                          ],
                        ArrayType
                          [
                            StructType
                              ((
                                BasicType(<TYPE.STRING: 115>),
                                BasicType(<TYPE.SIGNATURE: 103>),
                                BasicType(<TYPE.BYTE: 121>),
                                DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]
                              ))
                          ],
                        DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]
                      ))
                  ],
                DictType[BasicType(<TYPE.STRING: 115>) : VariantType()]
              ))
          ]
    ]

Any better?


More information about the dbus mailing list