Skip to content

Commit

Permalink
Merge pull request #109 from timokau/flake8-f401
Browse files Browse the repository at this point in the history
Fix and enable flake8 error "imported but unused"
  • Loading branch information
timokau authored Apr 2, 2020
2 parents 0cfb3de + e619301 commit 88a3947
Show file tree
Hide file tree
Showing 18 changed files with 126 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
; flake8. The remaining errors are currently raised and will be fixed in the
; future. For now flake8 can at least make sure the quality doesn't
; deteriorate.
ignore = E501, F401, E741, F841, W291, W503, F405, E731, F403, W293, E231, E722, F901, E203, F821, F811, E712
ignore = E501, E741, F841, W291, W503, F405, E731, F403, W293, E231, E722, F901, E203, F821, F811, E712
exclude = build
17 changes: 10 additions & 7 deletions csrank/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
__version__ = "1.1.0"

from .choicefunction import *
from .core import *
from .dataset_reader import *
from .discretechoice import *
from .objectranking import *
from .tunable import Tunable
from .tuning import ParameterOptimizer
# We should re-evaluate if we really want to re-export everything here and then
# use __all__ properly.

from .choicefunction import * # noqa: F401
from .core import * # noqa: F401
from .dataset_reader import * # noqa: F401
from .discretechoice import * # noqa: F401
from .objectranking import * # noqa: F401
from .tunable import Tunable # noqa: F401
from .tuning import ParameterOptimizer # noqa: F401
12 changes: 12 additions & 0 deletions csrank/choicefunction/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@
from .generalized_linear_model import GeneralizedLinearModel
from .pairwise_choice import PairwiseSVMChoiceFunction
from .ranknet_choice import RankNetChoiceFunction

__all__ = [
"AllPositive",
"CmpNetChoiceFunction",
"FATEChoiceFunction",
"FATELinearChoiceFunction",
"FETAChoiceFunction",
"FETALinearChoiceFunction",
"GeneralizedLinearModel",
"PairwiseSVMChoiceFunction",
"RankNetChoiceFunction",
]
11 changes: 11 additions & 0 deletions csrank/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@
from .feta_network import FETANetwork
from .pairwise_svm import PairwiseSVM
from .ranknet_core import RankNetCore

__all__ = [
"CmpNetCore",
"FATELinearCore",
"FATENetwork",
"FATENetworkCore",
"FETALinearCore",
"FETANetwork",
"PairwiseSVM",
"RankNetCore",
]
1 change: 0 additions & 1 deletion csrank/core/feta_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from csrank.layers import NormalizedDense
from csrank.learner import Learner
from csrank.losses import hinged_rank_loss
from csrank.numpy_util import sigmoid
from csrank.util import print_dictionary


Expand Down
21 changes: 14 additions & 7 deletions csrank/dataset_reader/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
from .choicefunctions import *
from .discretechoice import *
from .dyadranking import *
from .expedia_dataset_reader import ExpediaDatasetReader
from .labelranking import *
from .objectranking import *
from .synthetic_dataset_generator import SyntheticIterator
# We should re-evaluate if we really want to re-export everything here and then
# use __all__ properly.

from csrank.dataset_reader.choicefunctions import * # noqa: F401
from csrank.dataset_reader.discretechoice import * # noqa: F401
from csrank.dataset_reader.dyadranking import * # noqa: F401
from csrank.dataset_reader.expedia_dataset_reader import ( # noqa: F401
ExpediaDatasetReader,
)
from csrank.dataset_reader.labelranking import * # noqa: F401
from csrank.dataset_reader.objectranking import * # noqa: F401
from csrank.dataset_reader.synthetic_dataset_generator import ( # noqa: F401
SyntheticIterator,
)
7 changes: 7 additions & 0 deletions csrank/dataset_reader/choicefunctions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@
from .expedia_choice_dataset_reader import ExpediaChoiceDatasetReader
from .letor_ranking_choice_dataset_reader import LetorRankingChoiceDatasetReader
from .mnist_choice_dataset_reader import MNISTChoiceDatasetReader

__all__ = [
"ChoiceDatasetGenerator",
"ExpediaChoiceDatasetReader",
"LetorRankingChoiceDatasetReader",
"MNISTChoiceDatasetReader",
]
10 changes: 10 additions & 0 deletions csrank/dataset_reader/discretechoice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@
from .tag_genome_discrete_choice_dataset_reader import (
TagGenomeDiscreteChoiceDatasetReader,
)

__all__ = [
"DiscreteChoiceDatasetGenerator",
"ExpediaDiscreteChoiceDatasetReader",
"LetorListwiseDiscreteChoiceDatasetReader",
"LetorRankingDiscreteChoiceDatasetReader",
"MNISTDiscreteChoiceDatasetReader",
"SushiDiscreteChoiceDatasetReader",
"TagGenomeDiscreteChoiceDatasetReader",
]
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import numpy as np

try:
import pygmo
except ImportError:
from csrank.util import MissingExtraError

raise MissingExtraError("pygmo", "data")

from scipy.spatial.distance import squareform, pdist
from sklearn.datasets import make_regression, make_blobs
from sklearn.gaussian_process.kernels import Matern
Expand Down
4 changes: 4 additions & 0 deletions csrank/dataset_reader/dyadranking/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from .sushi_dyad_ranking_dataset_reader import SushiDyadRankingDatasetReader

__all__ = [
"SushiDyadRankingDatasetReader",
]
5 changes: 5 additions & 0 deletions csrank/dataset_reader/labelranking/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .intelligent_system_group_dataset_reader import IntelligentSystemGroupDatasetReader
from .survey_dataset_reader import SurveyDatasetReader

__all__ = [
"IntelligentSystemGroupDatasetReader",
"SurveyDatasetReader",
]
11 changes: 11 additions & 0 deletions csrank/dataset_reader/objectranking/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@
from .tag_genome_object_ranking_dataset_reader import (
TagGenomeObjectRankingDatasetReader,
)

__all__ = [
"DepthDatasetReader",
"ImageDatasetReader",
"LetorListwiseObjectRankingDatasetReader",
"SentenceOrderingDatasetReader",
"ObjectRankingDatasetGenerator",
"RCVDatasetReader",
"SushiObjectRankingDatasetReader",
"TagGenomeObjectRankingDatasetReader",
]
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import numpy as np

try:
import pygmo
except ImportError:
from csrank.util import MissingExtraError

MissingExtraError("pygmo", "data")

from scipy.spatial.distance import pdist, squareform
from sklearn.datasets import make_regression
from sklearn.datasets.samples_generator import make_blobs
Expand Down
17 changes: 17 additions & 0 deletions csrank/discretechoice/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,20 @@
from .paired_combinatorial_logit import PairedCombinatorialLogit
from .pairwise_discrete_choice import PairwiseSVMDiscreteChoiceFunction
from .ranknet_discrete_choice import RankNetDiscreteChoiceFunction

__all__ = [
"RandomBaselineDC",
"CmpNetDiscreteChoiceFunction",
"FATEDiscreteChoiceFunction",
"FATELinearDiscreteChoiceFunction",
"FETADiscreteChoiceFunction",
"FETALinearDiscreteChoiceFunction",
"GeneralizedNestedLogitModel",
"MixedLogitModel",
"ModelSelector",
"MultinomialLogitModel",
"NestedLogitModel",
"PairedCombinatorialLogit",
"PairwiseSVMDiscreteChoiceFunction",
"RankNetDiscreteChoiceFunction",
]
33 changes: 23 additions & 10 deletions csrank/objectranking/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
from .cmp_net import CmpNet
from .expected_rank_regression import ExpectedRankRegression
from .fate_object_ranker import FATEObjectRanker
from .fatelinear_object_ranker import FATELinearObjectRanker
from .feta_object_ranker import FETAObjectRanker
from .fetalinear_object_ranker import FETALinearObjectRanker
from .list_net import ListNet
from .rank_net import RankNet
from .rank_svm import RankSVM
from .baseline import RandomBaselineRanker
from .cmp_net import CmpNet
from .expected_rank_regression import ExpectedRankRegression
from .fate_object_ranker import FATEObjectRanker
from .fatelinear_object_ranker import FATELinearObjectRanker
from .feta_object_ranker import FETAObjectRanker
from .fetalinear_object_ranker import FETALinearObjectRanker
from .list_net import ListNet
from .rank_net import RankNet
from .rank_svm import RankSVM
from .baseline import RandomBaselineRanker

__all__ = [
"CmpNet",
"ExpectedRankRegression",
"FATEObjectRanker",
"FATELinearObjectRanker",
"FETAObjectRanker",
"FETALinearObjectRanker",
"ListNet",
"RankNet",
"RankSVM",
"RandomBaselineRanker",
]
1 change: 0 additions & 1 deletion csrank/tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import itertools
from keras import backend as K
from numpy.testing import assert_almost_equal
from functools import partial
from pytest import approx

from csrank.metrics import (
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ scikit-learn>=0.18.2
scikit-optimize>=0.4
pandas>=0.22
h5py>=2.7
pygmo>=2.7
psycopg2-binary>=2.7
docopt>=0.6.0
joblib>=0.9.4
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from os.path import realpath, dirname, join
from os.path import realpath, dirname

from setuptools import setup, find_packages

Expand Down Expand Up @@ -43,7 +43,6 @@
"scikit-optimize>=0.4",
"pandas>=0.22",
"h5py>=2.7",
"pygmo>=2.7",
"docopt>=0.6.0",
"joblib>=0.9.4",
"tqdm>=4.11.2",
Expand All @@ -57,7 +56,6 @@
"psycopg2-binary>=2.7", # database access
"pandas>=0.22",
"h5py>=2.7",
"pygmo>=2.7",
],
"probabilistic": ["pymc3>=3.8", "theano>=1.0",],
},
Expand Down

0 comments on commit 88a3947

Please sign in to comment.