alhoo / jf
Showing 1 of 3 files from the diff.
Other files ignored by Codecov
requirements.txt has changed.
setup.py has changed.

@@ -1,4 +1,5 @@
Loading
1 1
"""JF io library"""
2 +
import os
2 3
import fileinput
3 4
import logging
4 5
@@ -102,6 +103,7 @@
Loading
102 103
    """
103 104
    # FIXME these only output from the first line
104 105
    inp = json.loads
106 +
    ext = os.path.splitext(fn)[-1][1:]
105 107
    if fn.startswith("s3://"):
106 108
        content = read_s3(fn)
107 109
        from tempfile import NamedTemporaryFile
@@ -109,14 +111,14 @@
Loading
109 111
        f = NamedTemporaryFile()
110 112
        f.write(content)
111 113
        fn = f.name
112 -
    if fn.endswith("xml"):
114 +
    if ext == "xml":
113 115
        tree = etree.parse(fn)
114 116
        root = tree.getroot()
115 117
        xmldict = format_xml(root)
116 118
        logger.info("Got dict from xml %s", xmldict)
117 119
        yield xmldict
118 120
        return
119 -
    elif fn.endswith("parq") or fn.endswith("parquet"):
121 +
    elif ext == "parq" or ext == "parquet":
120 122
        import warnings
121 123
        from numba import NumbaDeprecationWarning
122 124
@@ -127,14 +129,14 @@
Loading
127 129
            for val in ParquetFile(fn).to_pandas().to_dict("records", into=OrderedDict):
128 130
                yield val
129 131
            return
130 -
    elif fn.endswith("xlsx"):
132 +
    elif ext == "xlsx":
131 133
        import xlrd
132 134
        import pandas
133 135
134 136
        for val in pandas.read_excel(fn).to_dict("records", into=OrderedDict):
135 137
            yield val
136 138
        return
137 -
    elif fn.endswith("csv"):
139 +
    elif ext == "csv":
138 140
        import pandas
139 141
140 142
        if ordered_dict:
@@ -146,7 +148,7 @@
Loading
146 148
            for val in pandas.read_csv(fn, **kwargs).to_dict("records"):
147 149
                yield val
148 150
        return
149 -
    elif fn.endswith("yaml") or fn.endswith("yml"):
151 +
    elif ext == "yaml" or ext == "yml":
150 152
        yaml.add_multi_constructor("", generic_constructor)
151 153
        inp = yaml.safe_load
152 154
        try:
@@ -177,6 +179,8 @@
Loading
177 179
def read_input(args, openhook=fileinput.hook_compressed, ordered_dict=False, **kwargs):
178 180
    """Read json, jsonl and yaml data from file defined in args"""
179 181
    # FIXME these only output from the first line
182 +
    fn = args.files[0]
183 +
    ext = os.path.splitext(fn)[-1][1:]
180 184
    if args.files[0].startswith("s3://"):
181 185
        content = read_s3(args.files[0])
182 186
        from tempfile import NamedTemporaryFile
@@ -184,14 +188,16 @@
Loading
184 188
        f = NamedTemporaryFile()
185 189
        f.write(content)
186 190
        args.files[0] = f.name
187 -
    if args.files[0].endswith("xml"):
191 +
        fn = f.name
192 +
    print("ext", ext)
193 +
    if ext == "xml":
188 194
        tree = etree.parse(args.files[0])
189 195
        root = tree.getroot()
190 196
        xmldict = format_xml(root)
191 197
        logger.info("Got dict from xml %s", xmldict)
192 198
        yield xmldict
193 199
        return
194 -
    elif args.files[0].endswith("parq") or args.files[0].endswith("parquet"):
200 +
    elif ext == "parq" or ext == "parquet":
195 201
        import warnings
196 202
        from numba import NumbaDeprecationWarning
197 203
@@ -206,7 +212,7 @@
Loading
206 212
            ):
207 213
                yield val
208 214
            return
209 -
    elif args.files[0].endswith("xlsx"):
215 +
    elif ext == "xlsx":
210 216
        import xlrd
211 217
        import pandas
212 218
@@ -215,7 +221,7 @@
Loading
215 221
        ):
216 222
            yield val
217 223
        return
218 -
    elif args.files[0].endswith("csv"):
224 +
    elif ext == "csv":
219 225
        import pandas
220 226
221 227
        if ordered_dict:
@@ -243,7 +249,7 @@
Loading
243 249
        else:
244 250
            return loader.construct_scalar(node)
245 251
246 -
    if args.yamli or args.files[0].endswith("yaml") or args.files[0].endswith("yml"):
252 +
    if args.yamli or ext == "yaml" or ext == "yml":
247 253
        yaml.add_multi_constructor("", generic_constructor)
248 254
        inp = yaml.safe_load
249 255
        data = "\n".join([l for l in inf])
Files Coverage
jf 72.46%
Project Totals (10 files) 72.46%
293.2
TRAVIS_PYTHON_VERSION=3.7
TRAVIS_OS_NAME=linux
293.1
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
293.3
TRAVIS_PYTHON_VERSION=3.8
TRAVIS_OS_NAME=linux
294.1
TRAVIS_PYTHON_VERSION=3.6
TRAVIS_OS_NAME=linux
294.2
TRAVIS_PYTHON_VERSION=3.7
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading