Completed
Push — bhard/topikvis ( a627dd...df5222 )
by
unknown
01:17
created

topik.visualizers.pages_timeseries()   A

Complexity

Conditions 3

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 3
dl 0
loc 13
rs 9.4285
1
from urlparse import urlparse
0 ignored issues
show
Coding Style introduced by
This module should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
Configuration introduced by
The import urlparse could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
Unused Code introduced by
Unused urlparse imported from urlparse
Loading history...
2
from collections import Counter
0 ignored issues
show
Unused Code introduced by
Unused Counter imported from collections
Loading history...
3
import datetime
4
from operator import itemgetter
0 ignored issues
show
Unused Code introduced by
Unused itemgetter imported from operator
Loading history...
5
6
import numpy as np
0 ignored issues
show
Unused Code introduced by
Unused numpy imported as np
Loading history...
7
import pandas as pd
0 ignored issues
show
Configuration introduced by
The import pandas could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
Unused Code introduced by
Unused pandas imported as pd
Loading history...
8
9
from bokeh.plotting import figure, curdoc, vplot
0 ignored issues
show
Configuration introduced by
The import bokeh.plotting could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
10
from bokeh.embed import autoload_server, components
0 ignored issues
show
Configuration introduced by
The import bokeh.embed could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
Unused Code introduced by
Unused components imported from bokeh.embed
Loading history...
11
from bokeh.client import push_session
0 ignored issues
show
Configuration introduced by
The import bokeh.client could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
12
from bokeh.models import Button, ColumnDataSource
0 ignored issues
show
Configuration introduced by
The import bokeh.models could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
Unused Code introduced by
Unused ColumnDataSource imported from bokeh.models
Loading history...
13
14
15
def pages_timeseries(response):
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
16
    parse_datetime = lambda x: datetime.datetime.strptime(x, "%Y-%m-%dT%H:%M:%S.%f")
17
    parsed_dates = [parse_datetime(x[1]) for x in response]
18
    dates = sorted(parsed_dates)
19
    plot = figure(plot_width=584, x_axis_type="datetime", x_axis_label="Dates",
20
            y_axis_label="Number Fetched")
21
    plot.line(x=dates, y=range(len(dates)))
22
23
    button = Button(label="Press Me")
24
25
    session = push_session(curdoc())
26
    script = autoload_server(vplot(plot, button), session_id=session.id)
27
    return script
28
29
30
def add_line():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
31
    print("Clicked!")
32
33
34
def line_scratch():
0 ignored issues
show
Coding Style introduced by
This function should have a docstring.

The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:

class SomeClass:
    def some_method(self):
        """Do x and return foo."""

If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.

Loading history...
35
36
    line_width = 4
37
38
    line1 = [(0, 1, 2, 3, 4, 5), (0, 1, 2, 3, 4, 5)]
39
    line2 = [(0, 1, 2, 3, 4, 5), (0, 5, 1, 4, 2, 3)]
40
    line3 = [(5, 4, 3, 2, 1), (5, 4, 3, 2, 1)]
0 ignored issues
show
Unused Code introduced by
The variable line3 seems to be unused.
Loading history...
41
42
    plot = figure()
43
    red = plot.line(x=line1[0], y=line1[1], line_width=line_width, color="crimson")
0 ignored issues
show
Unused Code introduced by
The variable red seems to be unused.
Loading history...
44
    blue = plot.line(x=line2[0], y=line2[1], line_width=line_width)
0 ignored issues
show
Unused Code introduced by
The variable blue seems to be unused.
Loading history...
45
    # purple = plot.line(x=line3[0], y=line3[1], line_width=line_width, color="purple")
46
47
    button = Button(label="Add Line")
48
    button.on_click(add_line)
49
50
    curdoc().add_root(vplot(plot, button))
51
    session = push_session(curdoc())
52
53
    script = autoload_server(model=None, session_id=session.id)
54
55
    # script, div = components(vplot(plot, button))
56
    return script
57
58
line_scratch()
59