soroco / pyce

Encrypted Python Execution
Apache License 2.0
198 stars 26 forks source link

Standardise encrypt_path result and PYCEPathFinder.KEYS input. #13

Open adamshamsudeen opened 6 years ago

adamshamsudeen commented 6 years ago

encrypt_path returns a tuple of file location and key whereas the PYCEPathFinder.KEYS accepts a dictionary.

>>> encrypt_path('.')
[('./hello.pyce', '69b9f28ba960bb3a83abef44950c99baf427f671bc33cd112cf87e22259ab835'), ('./mod.pyce', 'b6bea595bea6b95098d9b9a4f98e17cb399c99d3cdd99daeab5078757ec65f3c')]
PYCEPathFinder.KEYS = {'hello.pyce':'69b9f28ba960bb3a83abef44950c99baf427f671bc33cd112cf87e22259ab835','mod.pyce':'b6bea595bea6b95098d9b9a4f98e17cb399c99d3cdd99daeab5078757ec65f3c'}
adamshamsudeen commented 6 years ago

Right now I'm doing this to standardise the output form encrypt_path()

keys_as_tup = encrypt_path('.')
keys = {}
for tup in keys_as_tup:
    keys[os.path.basename(tup[0])] = tup[1]

Can I have a PR to return keys as dict?

VeNoMouS commented 5 years ago

Why not...

dict(encrypt_path('.'))