Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if prompt in self.prompts:
return ''
else:
index = self.next_index
self.next_index = index + 1
self.prompts[prompt] = index
return """span.prompt{0:d}:before {{
content: "{1!s} ";
}}
""".format(index, prompt)
def get_prompt_class(self, prompt):
return 'prompt{0:d}'.format(self.prompts[prompt])
cache = PromptCache()
class PromptDirective(rst.Directive):
optional_arguments = 3
has_content = True
def run(self):
self.assert_has_content()
language = 'text'
prompt = None
modifiers = []
if self.arguments:
language = self.arguments[0]
def setup(app):
app.add_directive('prompt', PromptDirective)
app.connect('env-purge-doc', cache.clear)
return {
'parallel_read_safe': True,
'parallel_write_safe': True,
}