Skip to content

Commit 8da3733

Browse files
committed
📚 update documentation 🎨 minior code refactoring
1 parent 71fc59a commit 8da3733

File tree

4 files changed

+25
-16
lines changed

4 files changed

+25
-16
lines changed

pyexcel_text/jsonp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"""
2-
pyexcel_text.jsonr
2+
pyexcel_text.jsonp
33
~~~~~~~~~~~~~~~~~~~
44
5-
Render json input
5+
Parse json input
66
7-
:copyright: (c) 2014-2016 by C. W.
7+
:copyright: (c) 2014-2017 by C. W.
88
:license: New BSD
99
"""
10+
import json
1011
import pyexcel.constants as constants
1112
from pyexcel.parser import AbstractParser
1213
from pyexcel.plugins.sources.pydata.common import (
1314
ArrayReader, RecordsReader, DictReader)
1415
from pyexcel.plugins.sources.pydata.bookdict import BookDictSource
15-
import json
1616

1717

1818
class JsonParser(AbstractParser):

pyexcel_text/jsonr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
pyexcel_text.json
2+
pyexcel_text.jsonr
33
~~~~~~~~~~~~~~~~~~~
44
5-
Provide json output
5+
Render json output
66
7-
:copyright: (c) 2014-2016 by C. W.
7+
:copyright: (c) 2014-2017 by C. W.
88
:license: New BSD
99
"""
1010
import json

pyexcel_text/ndjsonp.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
"""
22
pyexcel_text.ndjsonr
3-
~~~~~~~~~~~~~~~~~~~
3+
~~~~~~~~~~~~~~~~~~~~~~
44
55
Render newline delimited json input
66
7-
:copyright: (c) 2014-2016 by C. W.
7+
:copyright: (c) 2014-2017 by C. W.
88
:license: New BSD
99
"""
10+
import json
11+
import itertools
12+
import pyexcel._compact as compact
1013
import pyexcel.constants as constants
1114
from pyexcel.parser import AbstractParser
12-
from pyexcel._compact import StringIO
1315
from pyexcel.plugins.sources.pydata.common import (
1416
ArrayReader, RecordsReader)
15-
import json
16-
import itertools
1717

1818

1919
AUTO_DETECT = 'AD'
@@ -43,6 +43,9 @@ def row_iterator(self):
4343

4444

4545
class NDJsonParser(AbstractParser):
46+
"""
47+
parse ndjson
48+
"""
4649
def parse_file(self, file_name, on_demand=False, **keywords):
4750
if on_demand:
4851
file_handle = open(file_name, 'r')
@@ -74,15 +77,21 @@ def parse_file_stream(self, file_stream, struct=AUTO_DETECT,
7477

7578
def parse_file_content(self, file_content, **keywords):
7679
return self.parse_file_stream(
77-
StringIO(file_content), **keywords)
80+
compact.StringIO(file_content), **keywords)
7881

7982

8083
def json_loads(file_stream):
84+
"""
85+
Simple load each line as json
86+
"""
8187
for raw_row in file_stream:
8288
yield json.loads(raw_row)
8389

8490

8591
def detect_format(content_generator):
92+
"""
93+
This function need to make sheet.ndjson to work
94+
"""
8695
struct = AUTO_DETECT
8796
first_line = next(content_generator)
8897
if isinstance(first_line, list):

pyexcel_text/textr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
pyexcel_text.html
2+
pyexcel_text.textr
33
~~~~~~~~~~~~~~~~~~~
44
5-
Provide tabulate output, see file_types for more details
5+
Render text output, see file_types for more details
66
7-
:copyright: (c) 2014-2016 by C. W.
7+
:copyright: (c) 2014-2017 by C. W.
88
:license: New BSD
99
"""
1010
import tabulate

0 commit comments

Comments
 (0)