text
stringlengths
0
828
"""""".format(text = text)
else:
command = """"""
echo ""{text}"" | espeak -w {filepath}
"""""".format(text = text, filepath = filepath)
elif program == ""pico2wave"":
if not filepath:
command = """"""
pico2wave --wave=""{filepath}"" ""{text}""
aplay --quiet ""{filepath}""
"""""".format(text = text, filepath = shijian.tmp_filepath() + "".wav"")
else:
command = """"""
pico2wave --wave=""{filepath}"" ""{text}""
"""""".format(text = text, filepath = filepath)
elif program == ""deep_throat.py"":
if not filepath:
command = """"""
echo ""{text}"" | deep_throat.py
"""""".format(text = text)
else:
command = """"""
deep_throat.py --text=""{text}"" --savetowavefile --outfile=""{filepath}""
"""""".format(text = text, filepath = filepath)
if filepath:
background = False
if background:
command = command.rstrip().rstrip(""\n"") + "" &""
command = textwrap.dedent(command)
engage_command(command = command, background = background)"
1548,"def say_tmp_filepath(
text = None,
preference_program = ""festival""
):
""""""
Say specified text to a temporary file and return the filepath.
""""""
filepath = shijian.tmp_filepath() + "".wav""
say(
text = text,
preference_program = preference_program,
filepath = filepath
)
return filepath"
1549,"def clacks_overhead(fn):
""""""
A Django view decorator that will add the `X-Clacks-Overhead` header.
Usage:
@clacks_overhead
def my_view(request):
return my_response
""""""
@wraps(fn)
def _wrapped(*args, **kw):
response = fn(*args, **kw)
response['X-Clacks-Overhead'] = 'GNU Terry Pratchett'
return response
return _wrapped"
1550,"def render(self, request, template, context):
""""""
Returns a response. By default, this will contain the rendered PDF, but
if both ``allow_force_html`` is ``True`` and the querystring
``html=true`` was set it will return a plain HTML.
""""""
if self.allow_force_html and self.request.GET.get('html', False):
html = get_template(template).render(context)
return HttpResponse(html)
else:
response = HttpResponse(content_type='application/pdf')
if self.prompt_download:
response['Content-Disposition'] = 'attachment; filename=""{}""' \
.format(self.get_download_name())
helpers.render_pdf(
template=template,
file_=response,
url_fetcher=self.url_fetcher,
context=context,
)
return response"
1551,"def _bfs_path_states(self, graph, start):
""""""
Find state access strings (DFA shortest paths for every state)
using BFS
Args:
graph (DFA): The DFA states
start (int): The DFA initial state
Return:
list: A list of all the DFA shortest paths for every state
""""""
pathstates = {}
# maintain a queue of paths
queue = []
visited = []
# push the first path into the queue
queue.append([['', start]])
while queue: