Server IP : 92.204.138.22 / Your IP : 3.142.245.243 Web Server : Apache System : Linux ns1009439.ip-92-204-138.us 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64 User : internationaljou ( 1019) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/python3.6/site-packages/cloudinit/ |
Upload File : |
# Copyright (C) 2015 Canonical Ltd. # # This file is part of cloud-init. See LICENSE file for license information. import copy class DictRegistry: """A simple registry for a mapping of objects.""" def __init__(self): self.reset() def reset(self): self._items = {} def register_item(self, key, item): """Add item to the registry.""" if key in self._items: raise ValueError( "Item already registered with key {0}".format(key) ) self._items[key] = item def unregister_item(self, key, force=True): """Remove item from the registry.""" if key in self._items: del self._items[key] elif not force: raise KeyError("%s: key not present to unregister" % key) @property def registered_items(self): """All the items that have been registered. This cannot be used to modify the contents of the registry. """ return copy.copy(self._items)