Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def format_annotated(self, item, expand_args):
"""Wrapper for :meth:format preserving *AnnotatedString* flags
Calls :meth:format to format *item* into a new string and copies
flags from original item.
This is used by :meth:expand
"""
updated = self.format(item, **expand_args)
if isinstance(item, AnnotatedString):
updated = AnnotatedString(updated)
try:
updated.flags = deepcopy(item.flags)
except TypeError:
log.debug(
"Failed to deepcopy flags for item {} with flags{}"
"".format(item, item.flags)
)
updated.flags = copy(item.flags)
return updated
def format_annotated(self, item, expand_args):
"""Wrapper for :meth:format preserving *AnnotatedString* flags
Calls :meth:format to format *item* into a new string and copies
flags from original item.
This is used by :meth:expand
"""
updated = self.format(item, **expand_args)
if isinstance(item, AnnotatedString):
updated = AnnotatedString(updated)
try:
updated.flags = deepcopy(item.flags)
except TypeError:
log.debug(
"Failed to deepcopy flags for item {} with flags{}"
"".format(item, item.flags)
)
updated.flags = copy(item.flags)
return updated