HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/share/doc/python3-gpg/examples/howto/advanced/cython/keycount.pyx
from __future__ import absolute_import

import cython
import gpg

c = gpg.Context()
seckeys = c.keylist(pattern=None, secret=True)
pubkeys = c.keylist(pattern=None, secret=False)

seclist = list(seckeys)
secnum = len(seclist)

publist = list(pubkeys)
pubnum = len(publist)

if cython.compiled is True:
    cc = "Powered by Cython compiled C code."
else:
    cc = "Powered by Python."

print("""
    Number of secret keys:  {0}
    Number of public keys:  {1}

  {2}
""".format(secnum, pubnum, cc))