MCPcopy
hub / github.com/spaceandtimefdn/SxT-Python-SDK / replace_all

Method replace_all

src/spaceandtime/sxtuser.py:361–367  ·  view source on GitHub ↗
(self, mainstr:str, replace_map:dict = None)

Source from the content-addressed store, hash-verified

359
360
361 def replace_all(self, mainstr:str, replace_map:dict = None) -> str:
362 if not replace_map: replace_map = {'user_id':self.user_id, 'public_key':self.public_key, 'start_time':self.start_time.strftime('%Y-%m-%d %H:%M:%S')}
363 if 'date' not in replace_map.keys(): replace_map['date'] = int(self.start_time.strftime('%Y%m%d'))
364 if 'time' not in replace_map.keys(): replace_map['time'] = int(self.start_time.strftime('%H%M%S'))
365 for findname, replaceval in replace_map.items():
366 mainstr = str(mainstr).replace('{'+str(findname)+'}', str(replaceval))
367 return mainstr
368
369
370

Callers 1

saveMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected