push
github
1 of 1 new or added line in 1 file covered. (100.0%)
373 existing lines in 3 files now uncovered.105 of 493 relevant lines covered (21.3%)
0.42 hits per line
1 |
import os |
2✔ |
2 |
import pathlib |
2✔ |
3 |
import tempfile |
2✔ |
4 |
|
|
5 |
|
|
6 |
def get_data_path(): |
2✔ |
7 |
path = os.environ.get('MINIMINT_DATA_PATH')
|
2✔ |
8 |
if path is not None: |
2✔ |
9 |
return path
|
× |
10 |
path = str(pathlib.Path(__file__).parent.absolute()) + '/data/' |
2✔ |
11 |
os.makedirs(path, exist_ok=True)
|
2✔ |
12 |
return path
|
2✔ |
13 |
|
|
14 |
|
|
15 |
def tail_head(fin, nskip, nout): |
2✔ |
16 |
"""
|
|
17 |
Read nout lines from fin after skipping nskip lines |
|
18 |
and put output in the temporary file. Return filename |
|
19 |
""" |
|
UNCOV
20
|
fp = open(fin, 'r') |
× |
UNCOV
21
|
fpout = tempfile.NamedTemporaryFile(delete=False, mode='w') |
× |
UNCOV
22
|
i = -1
|
× |
UNCOV
23
|
for ll in fp: |
× |
UNCOV
24
|
i += 1
|
× |
UNCOV
25
|
if i < nskip:
|
× |
UNCOV
26
|
continue
|
× |
UNCOV
27
|
print(ll, file=fpout) |
× |
UNCOV
28
|
if i == (nskip + nout):
|
× |
UNCOV
29
|
break
|
× |
UNCOV
30
|
fp.close() |
× |
UNCOV
31
|
fpout.close() |
× |
UNCOV
32
|
return fpout.name
|
× |