Пример #1
0
 def __setitem__(self, key, value):
     'Assign the item to a key.'
     file_name = os.path.join(
         os.path.dirname(sys.argv[0]), ''.join(
             random.sample(
                 '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
                 8)))
     while os.path.exists(file_name):
         file_name = os.path.join(
             os.path.dirname(sys.argv[0]), ''.join(
                 random.sample(
                     '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
                     8)))
     try:
         value.save(file_name)
         _winreg.LoadKey(self.__self, key, file_name)
     finally:
         os.remove(file_name)
Пример #2
0
 def load(self, subkey, file_name):
     'Load subkey from file.'
     _winreg.LoadKey(self.__key, subkey, file_name)