Completed
Push — bhard/topikvis ( 378b41...4fdc8c )
by
unknown
01:16
created

topik.visualizers.topic_cluster()   A

Complexity

Conditions 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 15
rs 9.4285
1
import numpy as np
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...
Unused Code introduced by
Unused numpy imported as np
Loading history...
2
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...
3
4
from bokeh.plotting import figure, curdoc, vplot, output_file, show
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...
Unused Code introduced by
Unused curdoc imported from bokeh.plotting
Loading history...
Unused Code introduced by
Unused vplot imported from bokeh.plotting
Loading history...
5
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...
Unused Code introduced by
Unused autoload_server imported from bokeh.embed
Loading history...
6
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...
Unused Code introduced by
Unused push_session imported from bokeh.client
Loading history...
7
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 Button imported from bokeh.models
Loading history...
Unused Code introduced by
Unused ColumnDataSource imported from bokeh.models
Loading history...
8
9
10
def topic_cluster(data):
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...
11
    output_file("topic_cluster.html")
12
13
    plot = figure()
14
    xcoords = data["x"]
15
    ycoords = data["y"]
16
    frequency = data["Freq"]
17
    for x, y, size in zip(xcoords, ycoords, frequency):
0 ignored issues
show
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
Coding Style Naming introduced by
The name y does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
18
        plot.circle(x, y, size=(size*7), alpha=0.5)
19
20
    # curdoc().add_root(plot)
21
    # session = push_session(curdoc())
22
    # script = autoload_server(model=None, session_id=session.id)
23
    # return script
24
    show(plot)
25
26
27
def word_frequency(data):
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...
Unused Code introduced by
The argument data seems to be unused.
Loading history...
28
    factors = ["a", "b", "c", "d", "e", "f", "g", "h"]
29
    x =  [50, 40, 65, 10, 25, 37, 80, 60]
0 ignored issues
show
Coding Style introduced by
Exactly one space required after assignment
x = [50, 40, 65, 10, 25, 37, 80, 60]
^
Loading history...
Coding Style Naming introduced by
The name x does not conform to the variable naming conventions ([a-z_][a-z0-9_]{2,30}$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
30
    output_file("word_frequency.html")
31
    plot = figure(y_range=factors, x_range=[0,100])
0 ignored issues
show
Coding Style introduced by
Exactly one space required after comma
plot = figure(y_range=factors, x_range=[0,100])
^
Loading history...
32
    plot.segment(0, factors, x, factors, line_width=10, line_color="green")
33
    show(plot)
34