def recover(self, s, storage_keys=None): """Attempt to replace any placeholder substring with its original string. If `storage_keys` is specified, it will only look into the specified keys. Args: s: String to recover storage_keys: Specific storage keys to look into (default: {None}) Returns: Recovered string str """ if storage_keys is None: storage_keys = self.__data.keys() for n in storage_keys: key = Util.f(n) if key not in s: continue s = s.replace(key, self.recover(self.__data.pop(n))) return s
def _format_key(cls, n): return Util.f(n)
def _format_key(self, n): self._storage_keys.add(n) return Util.f(n)