Completed
Push — master ( 2bc047...202252 )
by Rich
01:16
created

skchem.core.Point3D   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %
Metric Value
dl 0
loc 23
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A Point3D.__str__() 0 2 1
A Point3D.__repr__() 0 7 1
A Point3D.to_dict() 0 8 2
1
#! /usr/bin/env python
2
#
3
# Copyright (C) 2007-2009 Rich Lewis <[email protected]>
4
# License: 3-clause BSD
5
6
"""
7
skchem.core.point
8
9
Defining points in scikit-chem.
10
"""
11
12
# the functionality here perhaps should be replaced by numpy arrays to get closer
13
# integration with the scientific python stack.
14
15
import rdkit.Geometry.rdGeometry
0 ignored issues
show
Configuration introduced by
The import rdkit.Geometry.rdGeometry 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...
16
from skchem.core import ChemicalObject
17
18
class Point3D(rdkit.Geometry.rdGeometry.Point3D, ChemicalObject):
19
20
    """ Class representing a point in scikit-chem """
21
22
    def to_dict(self, two_d=True):
23
24
        """ Return a dictionary representation of the point """
25
26
        if two_d:
27
            return {"x": round(self.x), "y": round(self.y)}
0 ignored issues
show
Bug introduced by
The Instance of Point3D does not seem to have a member named x.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of Point3D does not seem to have a member named y.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
28
        else:
29
            return {"x": round(self.x), "y": round(self.y), "z": round(self.z)}
0 ignored issues
show
Bug introduced by
The Instance of Point3D does not seem to have a member named x.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of Point3D does not seem to have a member named y.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of Point3D does not seem to have a member named z.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
30
31
    def __repr__(self):
32
        return '<{klass} coords="({x:.2f}, {y:.2f}, {z:.2f})" at {address}>'.format(
33
            klass=self.__class__.__name__, \
34
            x=self.x, \
0 ignored issues
show
Bug introduced by
The Instance of Point3D does not seem to have a member named x.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
35
            y=self.y, \
0 ignored issues
show
Bug introduced by
The Instance of Point3D does not seem to have a member named y.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
36
            z=self.z, \
0 ignored issues
show
Bug introduced by
The Instance of Point3D does not seem to have a member named z.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
37
            address=hex(id(self)))
38
39
    def __str__(self):
40
        return '({x:.2f}, {y:.2f}, {z:.2f})'.format(x=self.x, y=self.y, z=self.z)
0 ignored issues
show
Bug introduced by
The Instance of Point3D does not seem to have a member named x.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of Point3D does not seem to have a member named y.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
Bug introduced by
The Instance of Point3D does not seem to have a member named z.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
41