Skip to content

MAINT Remove unused variables and fix imports indicated by lgtm.com #20303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions sklearn/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from os import environ
from functools import wraps
import platform
Expand Down Expand Up @@ -193,11 +192,12 @@ def pytest_runtest_setup(item):
item : pytest item
item to be processed
"""
try:
xdist_worker_count = int(os.environ["PYTEST_XDIST_WORKER_COUNT"])
except KeyError:
# raises when pytest-xdist is not installed
xdist_worker_count = environ.get("PYTEST_XDIST_WORKER_COUNT")
if xdist_worker_count is None:
# returns if pytest-xdist is not installed
return
else:
xdist_worker_count = int(xdist_worker_count)

openmp_threads = _openmp_effective_n_threads()
threads_per_worker = max(openmp_threads // xdist_worker_count, 1)
Expand Down
2 changes: 0 additions & 2 deletions sklearn/decomposition/_nmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1450,8 +1450,6 @@ def _fit_transform(self, X, y=None, W=None, H=None, update_H=True):
"to X, or use a positive beta_loss."
)

n_samples, n_features = X.shape

# check parameters
self._check_params(X)

Expand Down
7 changes: 3 additions & 4 deletions sklearn/externals/_arff.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,8 @@
__version__ = '2.4.0'

import re
import sys
import csv
import typing
from typing import TYPE_CHECKING
from typing import Optional, List, Dict, Any, Iterator, Union, Tuple

# CONSTANTS ===================================================================
Expand All @@ -173,7 +172,7 @@
ArffSparseDataType = Tuple[List, ...]


if typing.TYPE_CHECKING:
if TYPE_CHECKING:
# typing_extensions is available when mypy is installed
from typing_extensions import TypedDict

Expand Down Expand Up @@ -297,7 +296,7 @@ def _parse_values(s):
try:
return {int(k): _unquote(v)
for k, v in _RE_SPARSE_KEY_VALUES.findall(s)}
except ValueError as exc:
except ValueError:
# an ARFF syntax error in sparse data
for match in _RE_SPARSE_KEY_VALUES.finditer(s):
if not match.group(1):
Expand Down
2 changes: 1 addition & 1 deletion sklearn/utils/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ def set_params(self, **params):
return self

def fit(self, X, y=None):
X = check_array(X)
check_array(X)
self.is_fitted_ = True
return self

Expand Down