Skip to content

[MRG+1] Remove unused imports#9235

Merged
GaelVaroquaux merged 1 commit intoscikit-learn:masterfrom
SebastinSanty:flake
Jul 1, 2017
Merged

[MRG+1] Remove unused imports#9235
GaelVaroquaux merged 1 commit intoscikit-learn:masterfrom
SebastinSanty:flake

Conversation

@SebastinSanty
Copy link
Copy Markdown
Contributor

@SebastinSanty SebastinSanty commented Jun 27, 2017

Reference Issue

Fixes #9191

What does this implement/fix? Explain your changes.

This PR removes unused imports. For other issues still detected by pyflakes for notfix are commented with # noqa

@jnothman
Copy link
Copy Markdown
Member

You need a space between # and noqa to pass flake8

@jnothman jnothman changed the title [MRG] Remove unused imports [MRG+1] Remove unused imports Jun 28, 2017
Copy link
Copy Markdown
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SebastinSanty
Copy link
Copy Markdown
Contributor Author

Removed the space. All checks passing now.

Copy link
Copy Markdown
Member

@lesteve lesteve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imports in __init__.py meant to expose names in the top-level package should be added to __all__ rather than using # noqa

MultiTaskLassoCV)
from .huber import HuberRegressor
from .sgd_fast import Hinge, Log, ModifiedHuber, SquaredLoss, Huber
from .sgd_fast import Hinge, Log, ModifiedHuber, SquaredLoss, Huber # noqa
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

from .classification import accuracy_score
from .classification import classification_report
from .classification import cohen_kappa_score
from .classification import cohen_kappa_score # noqa
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

from .cluster import mutual_info_score
from .cluster import normalized_mutual_info_score
from .cluster import fowlkes_mallows_score
from .cluster import fowlkes_mallows_score # noqa
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

from .cluster import silhouette_samples
from .cluster import silhouette_score
from .cluster import calinski_harabaz_score
from .cluster import calinski_harabaz_score # noqa
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

@SebastinSanty
Copy link
Copy Markdown
Contributor Author

@lesteve Thanks for pointing that out. I initially thought that these packages were still WIP.

import numpy as np
from scipy import sparse

from .validation import check_array
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is not used either

@jnothman
Copy link
Copy Markdown
Member

jnothman commented Jun 28, 2017 via email

@jnothman
Copy link
Copy Markdown
Member

jnothman commented Jun 28, 2017 via email

@SebastinSanty
Copy link
Copy Markdown
Contributor Author

The PR has been fixed. @jnothman @lesteve Can you have a look at it? TIA :)

@jnothman
Copy link
Copy Markdown
Member

jnothman commented Jul 1, 2017

LGTM

@@ -1,2 +1,2 @@
from .pls_ import *
from .cca_ import *
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The right fix would have been to get rid of this "import *" (which is horrible), and only import the estimators, then exposed in all.

Hopefully in another PR?

@GaelVaroquaux
Copy link
Copy Markdown
Member

LGTM. Merging

@GaelVaroquaux GaelVaroquaux merged commit dc43486 into scikit-learn:master Jul 1, 2017
@SebastinSanty SebastinSanty deleted the flake branch July 2, 2017 06:23
massich pushed a commit to massich/scikit-learn that referenced this pull request Jul 13, 2017
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
AishwaryaRK pushed a commit to AishwaryaRK/scikit-learn that referenced this pull request Aug 29, 2017
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this pull request Dec 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unused imports

4 participants