pile_js / AniDevTwitter__animeopenings.jsonl
Hamhams's picture
commit files to HF hub
c7f4bd0
raw
history blame
8.99 kB
{"nwo":"AniDevTwitter\/animeopenings","sha":"11b19a34158503a34db6995fb8b8ce3bc564a8e1","path":"encode\/fontConverter.py","language":"python","identifier":"OutputGrabber.start","parameters":"(self)","argument_list":"","return_statement":"","docstring":"Start capturing the stream data.","docstring_summary":"Start capturing the stream data.","docstring_tokens":["Start","capturing","the","stream","data","."],"function":"def start(self):\n\t\t'''Start capturing the stream data.'''\n\t\tself.capturedtext = ''\n\t\t# Save a copy of the stream:\n\t\tself.streamfd = os.dup(self.origstreamfd)\n\t\t# Replace the original stream with our write pipe.\n\t\tos.dup2(self.pipe_in, self.origstreamfd)","function_tokens":["def","start","(","self",")",":","self",".","capturedtext","=","''","# Save a copy of the stream:","self",".","streamfd","=","os",".","dup","(","self",".","origstreamfd",")","# Replace the original stream with our write pipe.","os",".","dup2","(","self",".","pipe_in",",","self",".","origstreamfd",")"],"url":"https:\/\/github.com\/AniDevTwitter\/animeopenings\/blob\/11b19a34158503a34db6995fb8b8ce3bc564a8e1\/encode\/fontConverter.py#L28-L34"}
{"nwo":"AniDevTwitter\/animeopenings","sha":"11b19a34158503a34db6995fb8b8ce3bc564a8e1","path":"encode\/fontConverter.py","language":"python","identifier":"OutputGrabber.stop","parameters":"(self)","argument_list":"","return_statement":"","docstring":"Stop capturing the stream data and save the text in `capturedtext`.","docstring_summary":"Stop capturing the stream data and save the text in `capturedtext`.","docstring_tokens":["Stop","capturing","the","stream","data","and","save","the","text","in","capturedtext","."],"function":"def stop(self):\n\t\t'''Stop capturing the stream data and save the text in `capturedtext`.'''\n\t\t# Print the escape character to make sure the loop in readOutput() stops.\n\t\tself.origstream.write(self.escape_char)\n\t\t# Flush the stream to make sure all our data goes in before the escape character.\n\t\tself.origstream.flush()\n\t\tself.readOutput()\n\t\t# Close the pipe.\n\t\tos.close(self.pipe_out)\n\t\t# Restore the original stream.\n\t\tos.dup2(self.streamfd, self.origstreamfd)","function_tokens":["def","stop","(","self",")",":","# Print the escape character to make sure the loop in readOutput() stops.","self",".","origstream",".","write","(","self",".","escape_char",")","# Flush the stream to make sure all our data goes in before the escape character.","self",".","origstream",".","flush","(",")","self",".","readOutput","(",")","# Close the pipe.","os",".","close","(","self",".","pipe_out",")","# Restore the original stream.","os",".","dup2","(","self",".","streamfd",",","self",".","origstreamfd",")"],"url":"https:\/\/github.com\/AniDevTwitter\/animeopenings\/blob\/11b19a34158503a34db6995fb8b8ce3bc564a8e1\/encode\/fontConverter.py#L36-L46"}
{"nwo":"AniDevTwitter\/animeopenings","sha":"11b19a34158503a34db6995fb8b8ce3bc564a8e1","path":"encode\/fontConverter.py","language":"python","identifier":"OutputGrabber.readOutput","parameters":"(self)","argument_list":"","return_statement":"","docstring":"Read the stream data and save the text in `capturedtext`.","docstring_summary":"Read the stream data and save the text in `capturedtext`.","docstring_tokens":["Read","the","stream","data","and","save","the","text","in","capturedtext","."],"function":"def readOutput(self):\n\t\t'''Read the stream data and save the text in `capturedtext`.'''\n\t\ttry:\n\t\t\twhile True:\n\t\t\t\tdata = os.read(self.pipe_out, 1)\n\t\t\t\tif not data or self.escape_char in data:\n\t\t\t\t\tself.capturedtext += data.split(self.escape_char)[0]\n\t\t\t\t\tbreak\n\t\t\t\tself.capturedtext += data\n\t\texcept OSError:\n\t\t\tpass","function_tokens":["def","readOutput","(","self",")",":","try",":","while","True",":","data","=","os",".","read","(","self",".","pipe_out",",","1",")","if","not","data","or","self",".","escape_char","in","data",":","self",".","capturedtext","+=","data",".","split","(","self",".","escape_char",")","[","0","]","break","self",".","capturedtext","+=","data","except","OSError",":","pass"],"url":"https:\/\/github.com\/AniDevTwitter\/animeopenings\/blob\/11b19a34158503a34db6995fb8b8ce3bc564a8e1\/encode\/fontConverter.py#L48-L58"}
{"nwo":"AniDevTwitter\/animeopenings","sha":"11b19a34158503a34db6995fb8b8ce3bc564a8e1","path":"encode\/fontConverter.alt.py","language":"python","identifier":"OutputGrabber.start","parameters":"(self)","argument_list":"","return_statement":"","docstring":"Start capturing the stream data.","docstring_summary":"Start capturing the stream data.","docstring_tokens":["Start","capturing","the","stream","data","."],"function":"def start(self):\n\t\t'''Start capturing the stream data.'''\n\t\tself.capturedtext = ''\n\t\t# Create a pipe so the stream can be captured.\n\t\tself.pipe_out, self.pipe_in = os.pipe()\n\t\t# Save a copy of the stream:\n\t\tself.streamfd = os.dup(self.origstreamfd)\n\t\t# Replace the original stream with our write pipe.\n\t\tos.dup2(self.pipe_in, self.origstreamfd)","function_tokens":["def","start","(","self",")",":","self",".","capturedtext","=","''","# Create a pipe so the stream can be captured.","self",".","pipe_out",",","self",".","pipe_in","=","os",".","pipe","(",")","# Save a copy of the stream:","self",".","streamfd","=","os",".","dup","(","self",".","origstreamfd",")","# Replace the original stream with our write pipe.","os",".","dup2","(","self",".","pipe_in",",","self",".","origstreamfd",")"],"url":"https:\/\/github.com\/AniDevTwitter\/animeopenings\/blob\/11b19a34158503a34db6995fb8b8ce3bc564a8e1\/encode\/fontConverter.alt.py#L28-L36"}
{"nwo":"AniDevTwitter\/animeopenings","sha":"11b19a34158503a34db6995fb8b8ce3bc564a8e1","path":"encode\/fontConverter.alt.py","language":"python","identifier":"OutputGrabber.stop","parameters":"(self)","argument_list":"","return_statement":"","docstring":"Stop capturing the stream data and save the text in `capturedtext`.","docstring_summary":"Stop capturing the stream data and save the text in `capturedtext`.","docstring_tokens":["Stop","capturing","the","stream","data","and","save","the","text","in","capturedtext","."],"function":"def stop(self):\n\t\t'''Stop capturing the stream data and save the text in `capturedtext`.'''\n\t\t# Print the escape character to make sure the loop in readOutput() stops.\n\t\tself.origstream.write(self.escape_char.decode())\n\t\t# Flush the stream to make sure all our data goes in before the escape character.\n\t\tself.origstream.flush()\n\t\tself.readOutput()\n\t\t# Close the pipes.\n\t\tos.close(self.pipe_out)\n\t\tos.close(self.pipe_in)\n\t\tself.pipe_out, self.pipe_in = None, None\n\t\t# Restore the original stream.\n\t\tos.dup2(self.streamfd,self.origstreamfd)","function_tokens":["def","stop","(","self",")",":","# Print the escape character to make sure the loop in readOutput() stops.","self",".","origstream",".","write","(","self",".","escape_char",".","decode","(",")",")","# Flush the stream to make sure all our data goes in before the escape character.","self",".","origstream",".","flush","(",")","self",".","readOutput","(",")","# Close the pipes.","os",".","close","(","self",".","pipe_out",")","os",".","close","(","self",".","pipe_in",")","self",".","pipe_out",",","self",".","pipe_in","=","None",",","None","# Restore the original stream.","os",".","dup2","(","self",".","streamfd",",","self",".","origstreamfd",")"],"url":"https:\/\/github.com\/AniDevTwitter\/animeopenings\/blob\/11b19a34158503a34db6995fb8b8ce3bc564a8e1\/encode\/fontConverter.alt.py#L38-L50"}
{"nwo":"AniDevTwitter\/animeopenings","sha":"11b19a34158503a34db6995fb8b8ce3bc564a8e1","path":"encode\/fontConverter.alt.py","language":"python","identifier":"OutputGrabber.readOutput","parameters":"(self)","argument_list":"","return_statement":"","docstring":"Read the stream data and save the text in `capturedtext`.","docstring_summary":"Read the stream data and save the text in `capturedtext`.","docstring_tokens":["Read","the","stream","data","and","save","the","text","in","capturedtext","."],"function":"def readOutput(self):\n\t\t'''Read the stream data and save the text in `capturedtext`.'''\n\t\tbyte = os.read(self.pipe_out,1)\n\t\tdata = b''\n\t\twhile byte not in (b'',self.escape_char):\n\t\t\tdata += byte\n\t\t\tbyte = os.read(self.pipe_out,1)\n\t\tself.capturedtext = data.decode(self.origstream.encoding, errors='replace')","function_tokens":["def","readOutput","(","self",")",":","byte","=","os",".","read","(","self",".","pipe_out",",","1",")","data","=","b''","while","byte","not","in","(","b''",",","self",".","escape_char",")",":","data","+=","byte","byte","=","os",".","read","(","self",".","pipe_out",",","1",")","self",".","capturedtext","=","data",".","decode","(","self",".","origstream",".","encoding",",","errors","=","'replace'",")"],"url":"https:\/\/github.com\/AniDevTwitter\/animeopenings\/blob\/11b19a34158503a34db6995fb8b8ce3bc564a8e1\/encode\/fontConverter.alt.py#L52-L59"}