-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-32719][PYTHON] Add Flake8 check missing imports #29563
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
Changes from all commits
a241db9
bcdf4ea
f039f68
d886ad7
06480a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,19 +16,24 @@ | |
| # | ||
|
|
||
| import operator | ||
| import sys | ||
| import uuid | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Fokko, do you mind opening a minor PR to add this I checked other occurrences fixed here, and other ones look fine to not fix in other branches.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I've created two PR's:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh @Fokko sorry I misread. It was fine because we're using wildcard imports at |
||
| import warnings | ||
| from abc import ABCMeta, abstractmethod, abstractproperty | ||
| from multiprocessing.pool import ThreadPool | ||
|
|
||
| from pyspark import keyword_only | ||
| from pyspark import keyword_only, since, SparkContext | ||
| from pyspark.ml import Estimator, Predictor, PredictionModel, Model | ||
| from pyspark.ml.param.shared import * | ||
| from pyspark.ml.param.shared import HasRawPredictionCol, HasProbabilityCol, HasThresholds, \ | ||
| HasRegParam, HasMaxIter, HasFitIntercept, HasTol, HasStandardization, HasWeightCol, \ | ||
| HasAggregationDepth, HasThreshold, HasBlockSize, Param, Params, TypeConverters, \ | ||
| HasElasticNetParam, HasSeed, HasStepSize, HasSolver, HasParallelism | ||
| from pyspark.ml.tree import _DecisionTreeModel, _DecisionTreeParams, \ | ||
| _TreeEnsembleModel, _RandomForestParams, _GBTParams, \ | ||
| _HasVarianceImpurity, _TreeClassifierParams | ||
| from pyspark.ml.regression import _FactorizationMachinesParams, DecisionTreeRegressionModel | ||
| from pyspark.ml.util import * | ||
| from pyspark.ml.base import _PredictorParams | ||
| from pyspark.ml.util import JavaMLWritable, JavaMLReadable, HasTrainingSummary | ||
| from pyspark.ml.wrapper import JavaParams, \ | ||
| JavaPredictor, JavaPredictionModel, JavaWrapper | ||
| from pyspark.ml.common import inherit_doc, _java2py, _py2java | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,11 +15,13 @@ | |
| # limitations under the License. | ||
| # | ||
|
|
||
| from pyspark import keyword_only | ||
| import sys | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This import was missing as well |
||
|
|
||
| from pyspark import keyword_only, since | ||
| from pyspark.sql import DataFrame | ||
| from pyspark.ml.util import * | ||
| from pyspark.ml.util import JavaMLWritable, JavaMLReadable | ||
| from pyspark.ml.wrapper import JavaEstimator, JavaModel, JavaParams | ||
| from pyspark.ml.param.shared import * | ||
| from pyspark.ml.param.shared import HasPredictionCol, Param, TypeConverters, Params | ||
|
|
||
| __all__ = ["FPGrowth", "FPGrowthModel", "PrefixSpan"] | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,11 +14,13 @@ | |
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| import os | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing import |
||
|
|
||
| from pyspark import keyword_only | ||
| from pyspark import keyword_only, since, SparkContext | ||
| from pyspark.ml.base import Estimator, Model, Transformer | ||
| from pyspark.ml.param import Param, Params | ||
| from pyspark.ml.util import * | ||
| from pyspark.ml.util import MLReadable, MLWritable, JavaMLWriter, JavaMLReader, \ | ||
| DefaultParamsReader, DefaultParamsWriter, MLWriter, MLReader, JavaMLWritable | ||
| from pyspark.ml.wrapper import JavaParams, JavaWrapper | ||
| from pyspark.ml.common import inherit_doc, _java2py, _py2java | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,7 @@ | |
| from pyspark import since, keyword_only | ||
| from pyspark.sql.column import _to_seq | ||
| from pyspark.sql.readwriter import OptionUtils, to_str | ||
| from pyspark.sql.types import * | ||
| from pyspark.sql.types import StructType, StructField, StringType | ||
| from pyspark.sql.utils import ForeachBatchFunction, StreamingQueryException | ||
|
|
||
| __all__ = ["StreamingQuery", "StreamingQueryManager", "DataStreamReader", "DataStreamWriter"] | ||
|
|
@@ -1239,8 +1239,8 @@ def _test(): | |
| globs = pyspark.sql.streaming.__dict__.copy() | ||
| try: | ||
| spark = SparkSession.builder.getOrCreate() | ||
| except py4j.protocol.Py4JError: | ||
| spark = SparkSession(sc) | ||
| except py4j.protocol.Py4JError: # noqa: F821 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was failing?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to run at, and it seems to run: I was under the impression that the |
||
| spark = SparkSession(sc) # noqa: F821 | ||
|
|
||
| globs['tempfile'] = tempfile | ||
| globs['os'] = os | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both
sysanduuidare used in the class, but aren't being imported.uuid: https://github.com/apache/spark/blob/master/python/pyspark/ml/classification.py#L3027
sys: https://github.com/apache/spark/blob/master/python/pyspark/ml/classification.py#L3421