From e406516f1f0e6a96a761635e0f321a1f8cf420b1 Mon Sep 17 00:00:00 2001 From: Vinit Kumar Date: Tue, 26 Feb 2019 01:49:14 +0530 Subject: [PATCH] Fix/coveralls (#43) * update coverage report * fix: coveralls --- .coverage | 2 +- htmlcov/coverage_html.js | 94 ++++------------------------ htmlcov/index.html | 6 +- htmlcov/jquery.debounce.min.js | 9 +++ htmlcov/json2xml___init___py.html | 26 ++++---- htmlcov/json2xml_json2xml_py.html | 32 +++++----- htmlcov/json2xml_utils_py.html | 100 +++++++++++++++--------------- htmlcov/keybd_closed.png | Bin 112 -> 264 bytes htmlcov/keybd_open.png | Bin 112 -> 267 bytes htmlcov/status.json | 2 +- htmlcov/style.css | 63 +++---------------- requirements_dev.txt | 2 +- 12 files changed, 112 insertions(+), 224 deletions(-) create mode 100644 htmlcov/jquery.debounce.min.js diff --git a/.coverage b/.coverage index 8837401..788c7e9 100644 --- a/.coverage +++ b/.coverage @@ -1 +1 @@ -!coverage.py: This is a private format, don't read it directly!{"lines":{"/Users/vinitkumar/projects/python/json2xml/json2xml/__init__.py":[3,5,6,7,10],"/Users/vinitkumar/projects/python/json2xml/json2xml/utils.py":[1,2,3,6,24,36,40,42,43,50,10,11,16,19,20,21,44,45,46,12,13,14,15,28,29,30,31,33],"/Users/vinitkumar/projects/python/json2xml/json2xml/json2xml.py":[2,5,6,11,7,8,9,12,13]}} \ No newline at end of file +!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/vinitkumar/projects/python/json2xml/json2xml/__init__.py": [3, 5, 6, 7, 10], "/Users/vinitkumar/projects/python/json2xml/json2xml/utils.py": [1, 2, 3, 6, 24, 36, 40, 42, 43, 50, 10, 11, 16, 19, 20, 21, 44, 45, 46, 12, 13, 14, 15, 28, 29, 30, 31, 33], "/Users/vinitkumar/projects/python/json2xml/json2xml/json2xml.py": [2, 5, 6, 11, 7, 8, 9, 12, 13]}} \ No newline at end of file diff --git a/htmlcov/coverage_html.js b/htmlcov/coverage_html.js index f6f5de2..bd6a875 100644 --- a/htmlcov/coverage_html.js +++ b/htmlcov/coverage_html.js @@ -73,28 +73,30 @@ coverage.wire_up_filter = function () { } else { // Filter table items by value. - var hidden = 0; - var shown = 0; + var hide = $([]); + var show = $([]); - // Hide / show elements. + // Compile elements to hide / show. $.each(table_row_names, function () { var element = $(this).parents("tr"); if ($(this).text().indexOf(filter_value) === -1) { // hide - element.addClass("hidden"); - hidden++; + hide = hide.add(element); } else { // show - element.removeClass("hidden"); - shown++; + show = show.add(element); } }); + // Perform DOM manipulation. + hide.addClass("hidden"); + show.removeClass("hidden"); + // Show placeholder if no rows will be displayed. if (no_rows.length > 0) { - if (shown === 0) { + if (show.length === 0) { // Show placeholder, hide table. no_rows.show(); table.hide(); @@ -107,7 +109,7 @@ coverage.wire_up_filter = function () { } // Manage dynamic header: - if (hidden > 0) { + if (hide.length > 0) { // Calculate new dynamic sum values based on visible rows. for (var column = 2; column < 20; column++) { // Calculate summed value. @@ -262,11 +264,6 @@ coverage.pyfile_ready = function ($) { coverage.assign_shortkeys(); coverage.wire_up_help_panel(); - - coverage.init_scroll_markers(); - - // Rebuild scroll markers after window high changing - $(window).resize(coverage.resize_scroll_markers); }; coverage.toggle_lines = function (btn, cls) { @@ -513,72 +510,3 @@ coverage.scroll_window = function (to_pos) { coverage.finish_scrolling = function () { $("html,body").stop(true, true); }; - -coverage.init_scroll_markers = function () { - var c = coverage; - // Init some variables - c.lines_len = $('td.text p').length; - c.body_h = $('body').height(); - c.header_h = $('div#header').height(); - c.missed_lines = $('td.text p.mis, td.text p.par'); - - // Build html - c.resize_scroll_markers(); -}; - -coverage.resize_scroll_markers = function () { - var c = coverage, - min_line_height = 3, - max_line_height = 10, - visible_window_h = $(window).height(); - - $('#scroll_marker').remove(); - // Don't build markers if the window has no scroll bar. - if (c.body_h <= visible_window_h) { - return; - } - - $("body").append("
 
"); - var scroll_marker = $('#scroll_marker'), - marker_scale = scroll_marker.height() / c.body_h, - line_height = scroll_marker.height() / c.lines_len; - - // Line height must be between the extremes. - if (line_height > min_line_height) { - if (line_height > max_line_height) { - line_height = max_line_height; - } - } - else { - line_height = min_line_height; - } - - var previous_line = -99, - last_mark, - last_top; - - c.missed_lines.each(function () { - var line_top = Math.round($(this).offset().top * marker_scale), - id_name = $(this).attr('id'), - line_number = parseInt(id_name.substring(1, id_name.length)); - - if (line_number === previous_line + 1) { - // If this solid missed block just make previous mark higher. - last_mark.css({ - 'height': line_top + line_height - last_top - }); - } - else { - // Add colored line in scroll_marker block. - scroll_marker.append('
'); - last_mark = $('#m' + line_number); - last_mark.css({ - 'height': line_height, - 'top': line_top - }); - last_top = line_top; - } - - previous_line = line_number; - }); -}; diff --git a/htmlcov/index.html b/htmlcov/index.html index 8f6cf79..652c1e8 100644 --- a/htmlcov/index.html +++ b/htmlcov/index.html @@ -9,7 +9,7 @@ - + @@ -112,8 +112,8 @@

Coverage report: diff --git a/htmlcov/jquery.debounce.min.js b/htmlcov/jquery.debounce.min.js new file mode 100644 index 0000000..648fe5d --- /dev/null +++ b/htmlcov/jquery.debounce.min.js @@ -0,0 +1,9 @@ +/* + * jQuery throttle / debounce - v1.1 - 3/7/2010 + * http://benalman.com/projects/jquery-throttle-debounce-plugin/ + * + * Copyright (c) 2010 "Cowboy" Ben Alman + * Dual licensed under the MIT and GPL licenses. + * http://benalman.com/about/license/ + */ +(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); diff --git a/htmlcov/json2xml___init___py.html b/htmlcov/json2xml___init___py.html index 31df3fa..84f3c11 100644 --- a/htmlcov/json2xml___init___py.html +++ b/htmlcov/json2xml___init___py.html @@ -42,22 +42,22 @@

Hide keyboard shortcuts -

Hot-keys on this page

+

Hot-keys on this page

-

+

r m x p   toggle line displays

-

+

j k   next/prev highlighted chunk

-

+

0   (zero) top of page

-

+

1   (one) first highlighted chunk

@@ -77,20 +77,20 @@

8

9

10

- +

# -*- coding: utf-8 -*- 

 

-

"""Top-level package for json2xml.""" 

+

"""Top-level package for json2xml.""" 

 

-

__author__ = """Vinit Kumar""" 

-

__email__ = "mail@vinitkumar.me" 

-

__version__ = "3.0.0" 

+

__author__ = """Vinit Kumar""" 

+

__email__ = "mail@vinitkumar.me" 

+

__version__ = "3.0.0" 

 

 

from .utils import readfromurl, readfromstring, readfromjson 

- + @@ -99,8 +99,8 @@

diff --git a/htmlcov/json2xml_json2xml_py.html b/htmlcov/json2xml_json2xml_py.html index 6173a62..f15d1bf 100644 --- a/htmlcov/json2xml_json2xml_py.html +++ b/htmlcov/json2xml_json2xml_py.html @@ -42,22 +42,22 @@

Hide keyboard shortcuts -

Hot-keys on this page

+

Hot-keys on this page

-

+

r m x p   toggle line displays

-

+

j k   next/prev highlighted chunk

-

+

0   (zero) top of page

-

+

1   (one) first highlighted chunk

@@ -80,7 +80,7 @@

11

12

13

- +

# -*- coding: utf-8 -*- 

@@ -88,15 +88,15 @@

 

 

class Json2xml(object): 

-

def __init__(self, data: str, wrapper: str = "all", indent: int = 4) -> None: 

-

self.data = data 

-

self.indent = indent 

-

self.wrapper = wrapper 

+

    def __init__(self, data: str, wrapper: str = "all", indent: int = 4) -> None: 

+

        self.data = data 

+

        self.indent = indent 

+

        self.wrapper = wrapper 

 

-

def to_xml(self): 

-

if self.data: 

-

return dict2xml.dict2xml(self.data, self.wrapper, indent=self.indent * " ") 

- +

    def to_xml(self): 

+

        if self.data: 

+

            return dict2xml.dict2xml(self.data, self.wrapper, indent=self.indent * " ") 

+ @@ -105,8 +105,8 @@

diff --git a/htmlcov/json2xml_utils_py.html b/htmlcov/json2xml_utils_py.html index 091aa21..51c4377 100644 --- a/htmlcov/json2xml_utils_py.html +++ b/htmlcov/json2xml_utils_py.html @@ -42,22 +42,22 @@

Hide keyboard shortcuts -

Hot-keys on this page

+

Hot-keys on this page

-

+

r m x p   toggle line displays

-

+

j k   next/prev highlighted chunk

-

+

0   (zero) top of page

-

+

1   (one) first highlighted chunk

@@ -117,7 +117,7 @@

48

49

50

- +

import json 

@@ -125,52 +125,52 @@

import sys 

 

 

-

def readfromjson(filename: str) -> dict: 

-

""" 

-

Reads a json string and emits json string 

-

""" 

-

try: 

-

json_data = open(filename) 

-

data = json.load(json_data) 

-

json_data.close() 

-

print(type(data)) 

-

return data 

-

except ValueError as e: 

-

print(e) 

-

sys.exit(e) 

-

except IOError as e: 

-

print(e) 

-

sys.exit(e) 

+

def readfromjson(filename: str) -> dict: 

+

    """ 

+

    Reads a json string and emits json string 

+

    """ 

+

    try: 

+

        json_data = open(filename) 

+

        data = json.load(json_data) 

+

        json_data.close() 

+

        print(type(data)) 

+

        return data 

+

    except ValueError as e: 

+

        print(e) 

+

        sys.exit(e) 

+

    except IOError as e: 

+

        print(e) 

+

        sys.exit(e) 

 

 

-

def readfromurl(url: str, params: dict = None) -> dict: 

-

""" 

-

Loads json from an URL over the internets 

-

""" 

-

response = requests.get(url, params=params) 

-

if response.status_code == 200: 

-

data = response.json() 

-

return data 

-

else: 

-

sys.exit(response.text) 

+

def readfromurl(url: str, params: dict = None) -> dict: 

+

    """ 

+

    Loads json from an URL over the internets 

+

    """ 

+

    response = requests.get(url, params=params) 

+

    if response.status_code == 200: 

+

        data = response.json() 

+

        return data 

+

    else: 

+

        sys.exit(response.text) 

 

 

-

def readfromstring(jsondata: str) -> dict: 

-

""" 

-

Loads json from string 

-

""" 

-

if type(jsondata) is not str: 

-

sys.exit("the input doesn't seem to be valid string") 

-

try: 

-

data = json.loads(jsondata) 

-

except ValueError as e: 

-

print(e) 

-

sys.exit(e) 

-

except Exception as e: 

-

print(e) 

-

sys.exit(e) 

-

return data 

- +

def readfromstring(jsondata: str) -> dict: 

+

    """ 

+

    Loads json from string 

+

    """ 

+

    if type(jsondata) is not str: 

+

        sys.exit("the input doesn't seem to be valid string") 

+

    try: 

+

        data = json.loads(jsondata) 

+

    except ValueError as e: 

+

        print(e) 

+

        sys.exit(e) 

+

    except Exception as e: 

+

        print(e) 

+

        sys.exit(e) 

+

    return data 

+ @@ -179,8 +179,8 @@

diff --git a/htmlcov/keybd_closed.png b/htmlcov/keybd_closed.png index db114023f096297a23a7b1266b469d0ce4556b0a..f2b0418d2a33a1e8d0cd639f47ed60edf971f8bc 100644 GIT binary patch delta 246 zcmXTuV45IV&&I&O@Isko7m#8s4sv&5Sa(k5C6L3G|H(?D8gCb5n0T@ zz%2~Ij105pNB{-dOFVsD*>AJ4^6{|V`gAoMDAeKU;uvCa`s`G1z6J#zm*vNFujia+ zx&DNqG+kh6jmx7oUd|^|;)FRK2l-t4SCAG_I!|8d&@}UzJ6{V5Hg=d?H9Yo6mZ98O zxh?AHoXwXv_Ou9SO?j4NRNgi-yG_rq`u+K0@44qh4c9tc>s{HDrMpaOk;vuXKRb0w q)Ru`U&tIMFUb2iq|H(?D8gCb5n0T@ zz%2~Ij105pNB{-dOFVsD*>AJ4^6@YmPb^3R3UzzBIEGl9-aFZm@2~<7%W={0eVzAN z?muCCw=z)5lyBwQGbcSH!gg=_VDDz6T6`&I+H!Z73Rn5S(2&xV^NQ!)V|;X^nCQ_VS2z>)UxFGma}K{9mV@*%-s1+{^O$G vQEwj~_ji4~$;jC{{St%DmRmR7_AoA=2.20.0 -coverage==4.5.2 +coverage==4.0.3 xmltodict==0.11.0 python-coveralls==2.9.1