Docstrings and such

This commit is contained in:
enkore 2013-03-02 17:34:53 +01:00
parent 3ebcbec4e1
commit 3c284ad29c

View File

@ -25,9 +25,11 @@ class IOHandler:
return return
def read_line(self): def read_line(self):
"""Interrupted respecting reader for stdin. """
Interrupted respecting reader for stdin.
Raises EOFError if the end of stream has been reached""" Raises EOFError if the end of stream has been reached
"""
try: try:
line = self.inp.readline().strip() line = self.inp.readline().strip()
@ -48,12 +50,7 @@ class StandaloneIO(IOHandler):
""" """
n = -1 n = -1
proto = ( proto = ('{"version":1}', "[", "[]", ",[]", )
'{"version":1}',
"[",
"[]",
",[]",
)
def __init__(self, interval=1): def __init__(self, interval=1):
super().__init__() super().__init__()
@ -87,14 +84,9 @@ class JSONIO:
@contextmanager @contextmanager
def parse_line(self, line): def parse_line(self, line):
""" """Parse a single line of JSON and write modified JSON back."""
Parse a single line of JSON and write modified JSON back.
Usage is quite simple using the usual with-Syntax.
"""
prefix = "" prefix = ""
# ignore comma at start of lines # ignore comma at start of lines
if line.startswith(","): if line.startswith(","):
line, prefix = line[1:], "," line, prefix = line[1:], ","