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 db11402..f2b0418 100644 Binary files a/htmlcov/keybd_closed.png and b/htmlcov/keybd_closed.png differ diff --git a/htmlcov/keybd_open.png b/htmlcov/keybd_open.png index db11402..a77961d 100644 Binary files a/htmlcov/keybd_open.png and b/htmlcov/keybd_open.png differ diff --git a/htmlcov/status.json b/htmlcov/status.json index c5bf4a3..c8f1ed1 100644 --- a/htmlcov/status.json +++ b/htmlcov/status.json @@ -1 +1 @@ -{"format":1,"version":"4.5.2","settings":"7992e539e75f4486c0f0bb431c4fa1f3","files":{"json2xml___init___py":{"hash":"f459402818513eb94cf894faa4d6f67a","index":{"nums":[1,5,0,0,0,0,0],"html_filename":"json2xml___init___py.html","relative_filename":"json2xml/__init__.py"}},"json2xml_json2xml_py":{"hash":"dae3c638bb105786c63fa36a5dc86350","index":{"nums":[1,9,0,0,0,0,0],"html_filename":"json2xml_json2xml_py.html","relative_filename":"json2xml/json2xml.py"}},"json2xml_utils_py":{"hash":"cccfb9c0e3a1bc0766058c4975942e9b","index":{"nums":[1,34,0,6,0,0,0],"html_filename":"json2xml_utils_py.html","relative_filename":"json2xml/utils.py"}}}} \ No newline at end of file +{"format": 1, "version": "4.0.3", "settings": "f0f19ce5fb37dd085ad4121938b2254d", "files": {"json2xml___init___py": {"hash": "f459402818513eb94cf894faa4d6f67a", "index": {"nums": [1, 5, 0, 0, 0, 0, 0], "html_filename": "json2xml___init___py.html", "relative_filename": "json2xml/__init__.py"}}, "json2xml_json2xml_py": {"hash": "dae3c638bb105786c63fa36a5dc86350", "index": {"nums": [1, 9, 0, 0, 0, 0, 0], "html_filename": "json2xml_json2xml_py.html", "relative_filename": "json2xml/json2xml.py"}}, "json2xml_utils_py": {"hash": "cccfb9c0e3a1bc0766058c4975942e9b", "index": {"nums": [1, 34, 0, 6, 0, 0, 0], "html_filename": "json2xml_utils_py.html", "relative_filename": "json2xml/utils.py"}}}} \ No newline at end of file diff --git a/htmlcov/style.css b/htmlcov/style.css index 86b8209..15b0890 100644 --- a/htmlcov/style.css +++ b/htmlcov/style.css @@ -2,7 +2,6 @@ /* For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt */ /* CSS styles for coverage.py. */ - /* Page-wide styles */ html, body, h1, h2, h3, p, table, td, th { margin: 0; @@ -65,7 +64,7 @@ a.nav:hover { #source { padding: 1em; - font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-family: "courier new", monospace; } .indexfile #footer { @@ -161,7 +160,7 @@ h2.stats { .help_panel { position: absolute; - background: #ffffcc; + background: #ffc; padding: .5em; border: 1px solid #883; display: none; @@ -227,8 +226,7 @@ td.text { margin: 0; padding: 0 0 0 .5em; border-left: 2px solid #ffffff; - white-space: pre; - position: relative; + white-space: nowrap; } .text p.mis { @@ -261,27 +259,6 @@ td.text { .text p.hide_par span.annotate { display: none; } -.text span.annotate.long { - display: none; - } -.text p:hover span.annotate.long { - display: block; - max-width: 50%; - white-space: normal; - float: right; - position: absolute; - top: 1.75em; - right: 1em; - width: 30em; - height: auto; - color: #333; - background: #ffffcc; - border: 1px solid #888; - padding: .25em .5em; - z-index: 999; - border-radius: .2em; - box-shadow: #cccccc .2em .2em .2em; - } /* Syntax coloring */ .text .com { @@ -322,15 +299,7 @@ td.text { } #index th.headerSortDown, #index th.headerSortUp { border-bottom: 1px solid #000; - white-space: nowrap; - background: #eee; } -#index th.headerSortDown:after { - content: " ↓"; -} -#index th.headerSortUp:after { - content: " ↑"; -} #index td.name, #index th.name { text-align: left; width: auto; @@ -339,6 +308,10 @@ td.text { text-decoration: none; color: #000; } +#index td.name a:hover { + text-decoration: underline; + color: #000; + } #index tr.total, #index tr.total_dynamic { } @@ -351,25 +324,3 @@ td.text { #index tr.file:hover { background: #eeeeee; } -#index tr.file:hover td.name { - text-decoration: underline; - color: #000; - } - -/* scroll marker styles */ -#scroll_marker { - position: fixed; - right: 0; - top: 0; - width: 16px; - height: 100%; - background: white; - border-left: 1px solid #eee; - } - -#scroll_marker .marker { - background: #eedddd; - position: absolute; - min-height: 3px; - width: 100%; - } diff --git a/requirements_dev.txt b/requirements_dev.txt index 3988396..1910300 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -10,7 +10,7 @@ dict2xml==1.5 six==1.11.0 lxml==4.1.1 requests>=2.20.0 -coverage==4.5.2 +coverage==4.0.3 xmltodict==0.11.0 python-coveralls==2.9.1