1 | #! /usr/bin/env python |
||
0 ignored issues
–
show
|
|||
2 | # |
||
3 | # Copyright (C) 2016 Rich Lewis <[email protected]> |
||
4 | # License: 3-clause BSD |
||
5 | |||
6 | 1 | import matplotlib.pyplot as plt |
|
0 ignored issues
–
show
The import
matplotlib.pyplot could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
7 | |||
8 | 1 | from .. import features |
|
9 | 1 | from .. import core |
|
10 | 1 | from .. import vis |
|
11 | 1 | from ipywidgets import Dropdown, Text, VBox, HBox, Valid, HTML |
|
0 ignored issues
–
show
The import
ipywidgets could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
12 | 1 | from IPython import get_ipython |
|
0 ignored issues
–
show
The import
IPython could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
13 | 1 | from IPython.display import clear_output, display |
|
0 ignored issues
–
show
The import
IPython.display could not be resolved.
This can be caused by one of the following: 1. Missing DependenciesThis 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 filesThis error could also result from missing ![]() |
|||
14 | |||
15 | |||
16 | 1 | class Visualizer(object): |
|
0 ignored issues
–
show
This class 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. ![]() |
|||
17 | 1 | def __init__(self, fper='morgan', smiles='c1ccccc1O', dpi=200): |
|
18 | |||
19 | self.initialize_ipython() |
||
20 | |||
21 | if isinstance(fper, str): |
||
22 | self.fper = features.get(fper) |
||
23 | else: |
||
24 | self.fper = fper |
||
25 | |||
26 | self.smiles_input = Text(smiles, description='smiles') |
||
27 | self.smiles_input.on_submit(self.update_smiles) |
||
28 | self.smiles_input.observe(self.typing) |
||
29 | |||
30 | self.valid = Valid(True) |
||
31 | |||
32 | self.dropdown = Dropdown(options=[], description='bit') |
||
33 | self.dropdown.observe(self.plot) |
||
34 | |||
35 | self.dpi_input = Text(str(dpi), description='dpi') |
||
36 | self.dpi_input.on_submit(self.plot) |
||
37 | |||
38 | self.ui = VBox([ |
||
0 ignored issues
–
show
The name
ui does not conform to the attribute 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. ![]() |
|||
39 | HTML('<h2>Visualizer</h2>'), |
||
40 | HBox([self.smiles_input, self.valid]), |
||
41 | self.dropdown, |
||
42 | self.dpi_input]) |
||
43 | |||
44 | self.update_smiles(None) |
||
45 | self.display() |
||
46 | |||
47 | 1 | @staticmethod |
|
48 | def initialize_ipython(): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
49 | ipython = get_ipython() |
||
50 | try: |
||
51 | ipython.magic('matplotlib inline') |
||
52 | except: |
||
0 ignored issues
–
show
General except handlers without types should be used sparingly.
Typically, you would use general except handlers when you intend to specifically handle all types of errors, f.e. when logging. Otherwise, such general error handlers can mask errors in your application that you want to know of. ![]() |
|||
53 | pass |
||
54 | |||
55 | 1 | def typing(self, _): |
|
0 ignored issues
–
show
This method 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. ![]() |
|||
56 | self.valid.visible = False |
||
57 | |||
58 | 1 | @property |
|
59 | def dpi(self): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
60 | try: |
||
61 | return int(self.dpi_input.value) |
||
62 | except: |
||
0 ignored issues
–
show
General except handlers without types should be used sparingly.
Typically, you would use general except handlers when you intend to specifically handle all types of errors, f.e. when logging. Otherwise, such general error handlers can mask errors in your application that you want to know of. ![]() |
|||
63 | return 50 |
||
64 | |||
65 | 1 | @dpi.setter |
|
66 | def dpi(self, value): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
67 | self.dpi_input.value = str(value) |
||
68 | |||
69 | 1 | def display(self): |
|
0 ignored issues
–
show
This method 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. ![]() |
|||
70 | display(self.ui) |
||
71 | |||
72 | 1 | def update_smiles(self, _): |
|
0 ignored issues
–
show
This method 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. ![]() |
|||
73 | try: |
||
74 | self._mol = core.Mol.from_smiles(self.smiles_input.value) |
||
0 ignored issues
–
show
|
|||
75 | self.valid.value = True |
||
76 | except ValueError: |
||
77 | self.valid.value = False |
||
78 | return |
||
79 | finally: |
||
80 | self.valid.visible = True |
||
81 | return self.calculate() |
||
82 | |||
83 | 1 | def calculate(self): |
|
0 ignored issues
–
show
This method 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. ![]() |
|||
84 | fp = self.fper.transform(self.mol) |
||
0 ignored issues
–
show
The name
fp 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. ![]() |
|||
85 | self.fp = fp[fp == 1].index |
||
0 ignored issues
–
show
The name
fp does not conform to the attribute 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. ![]() |
|||
86 | self.fpg = self.fper.grad(self.mol).ix[self.fp] |
||
0 ignored issues
–
show
|
|||
87 | return self.update_dropdown() |
||
88 | |||
89 | 1 | def update_dropdown(self): |
|
0 ignored issues
–
show
This method 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. ![]() |
|||
90 | self.dropdown.options.append(self.fp[0]) |
||
91 | self.dropdown.value = self.fp[0] |
||
92 | self.dropdown.options = self.fp.tolist() |
||
93 | return self.plot(self.dropdown.value) |
||
94 | |||
95 | 1 | @property |
|
96 | def mol(self): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
97 | return self._mol |
||
98 | |||
99 | 1 | @mol.setter |
|
100 | def mol(self, mol): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
101 | self._mol = mol |
||
0 ignored issues
–
show
|
|||
102 | self.smiles_input.value = mol.to_smiles() |
||
103 | self.calculate() |
||
104 | |||
105 | 1 | @property |
|
106 | def current_smiles(self): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
107 | return self.smiles_input.value |
||
108 | |||
109 | 1 | @property |
|
110 | def current_bit(self): |
||
0 ignored issues
–
show
This method 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. ![]() |
|||
111 | return self.dropdown.value |
||
112 | |||
113 | 1 | def plot(self, _): |
|
0 ignored issues
–
show
This method 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. ![]() |
|||
114 | clear_output() |
||
115 | plt.clf() |
||
116 | plt.rcParams['savefig.dpi'] = self.dpi |
||
117 | vis.plot_weights(self.mol, self.fpg.ix[self.current_bit], |
||
118 | quality=4, ax=plt.gca()) |
||
119 |
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.