Skip to content

Commit

Permalink
optimized imports
Browse files Browse the repository at this point in the history
  • Loading branch information
enitram committed Oct 31, 2018
1 parent f241674 commit b40ced1
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 27 deletions.
3 changes: 1 addition & 2 deletions charge/chargers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def __init__(self,
Args:
repository: The repository to obtain charges from
rounding_digits: Number of significant digits to round
charges to.
rounding_digits: Number of significant digits to round charges to.
nauty: An external Nauty instance to use for canonization
"""
# These are all protected, not private
Expand Down
5 changes: 3 additions & 2 deletions charge/molecule.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import networkx as nx
from typing import Generator, Tuple

from charge.nauty import Nauty
import networkx as nx

from charge.charge_types import Atom
from charge.nauty import Nauty


def atoms_neighborhoods_charges(
Expand Down
2 changes: 1 addition & 1 deletion charge/multiprocessor.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import multiprocessing as mp
import os
import sys
import traceback
from typing import Any, Generator, List, Tuple, Type

from charge.util import print_progress


class _Stop:
pass

Expand Down
1 change: 0 additions & 1 deletion charge/nauty.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from charge.settings import NAUTY_EXC
from charge.util import bfs_nodes


Color = Tuple[bool, str]
"""Nodes are colored by whether they are the core node, and then by atom type."""

Expand Down
6 changes: 3 additions & 3 deletions charge/test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from collections import defaultdict
import networkx as nx
import os
from pathlib import Path

import networkx as nx
import pytest

from charge.bond_type import BondType
from charge.nauty import Nauty


# Fixtures for testing loading and saving to and from various
# formats.

Expand Down Expand Up @@ -185,7 +186,6 @@ def ref_graph_rdkit(ref_graph_nodes, ref_graph_edges):

@pytest.fixture
def ref_graph_nodes_shifted(ref_graph_nodes):
from rdkit import Chem
return [(v-1, data) for v, data in ref_graph_nodes]


Expand Down
5 changes: 2 additions & 3 deletions charge/test/test_babel.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import pytest

import networkx as nx
import networkx.algorithms.isomorphism as nxiso
import pytest

from charge.babel import convert_from, IOType, convert_to


def equal_attributes(att1, att2):
return att1 == att2

Expand Down
6 changes: 3 additions & 3 deletions charge/test/test_chargers.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from charge.chargers import CDPCharger, DPCharger, ILPCharger, MeanCharger, MedianCharger, ModeCharger

from math import log
import networkx as nx

import pytest

from charge.chargers import CDPCharger, DPCharger, ILPCharger, MeanCharger, MedianCharger, ModeCharger


def test_mean_charger(mock_repository, ref_graph):
charger = MeanCharger(mock_repository, 2)
Expand Down
6 changes: 3 additions & 3 deletions charge/test/test_collectors.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from charge.collectors import AssignmentError, HistogramCollector, MeanCollector

from math import log
import networkx as nx

import pytest

from charge.collectors import AssignmentError, HistogramCollector, MeanCollector


def test_mean_collector(ref_graph, mock_repository):
collector = MeanCollector(mock_repository, 2)
Expand Down
4 changes: 2 additions & 2 deletions charge/test/test_nauty.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from pathlib import Path
import pytest
import stat
from pathlib import Path

from charge.nauty import Nauty


def test_create():
nauty = Nauty()
assert nauty.exe != ''
Expand Down
2 changes: 0 additions & 2 deletions charge/test/test_repository.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import pytest

from charge.repository import Repository

def test_create_empty():
Expand Down
5 changes: 2 additions & 3 deletions charge/test/test_solvers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from charge.solvers import CDPSolver, DPSolver, ILPSolver, SimpleSolver

import networkx as nx
import pytest

from charge.solvers import CDPSolver, DPSolver, ILPSolver, SimpleSolver


def test_simple_solver(ref_graph):
solver = SimpleSolver(2)
Expand Down
2 changes: 0 additions & 2 deletions scripts/build_repo.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import os
import warnings

from charge.repository import Repository


if __name__ == '__main__':

test_data_dir = os.path.realpath(
Expand Down

0 comments on commit b40ced1

Please sign in to comment.