-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-25238][PYTHON] lint-python: Fix W605 warnings for pycodestyle 2.4 #22400
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
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 |
|---|---|---|
|
|
@@ -274,7 +274,7 @@ def resolve_jira_issue(merge_branches, comment, default_jira_id=""): | |
| versions = sorted(versions, key=lambda x: x.name, reverse=True) | ||
| versions = filter(lambda x: x.raw['released'] is False, versions) | ||
| # Consider only x.y.z versions | ||
| versions = filter(lambda x: re.match('\d+\.\d+\.\d+', x.name), versions) | ||
| versions = filter(lambda x: re.match(r'\d+\.\d+\.\d+', x.name), versions) | ||
|
|
||
| default_fix_versions = map(lambda x: fix_version_from_branch(x, versions).name, merge_branches) | ||
| for v in default_fix_versions: | ||
|
|
@@ -403,7 +403,7 @@ def standardize_jira_ref(text): | |
|
|
||
| # Extract spark component(s): | ||
| # Look for alphanumeric chars, spaces, dashes, periods, and/or commas | ||
| pattern = re.compile(r'(\[[\w\s,-\.]+\])', re.IGNORECASE) | ||
| pattern = re.compile(r'(\[[\w\s,.-]+\])', re.IGNORECASE) | ||
|
Member
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. Two issues: |
||
| for component in pattern.findall(text): | ||
| components.append(component.upper()) | ||
| text = text.replace(component, '') | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,8 +207,8 @@ class BucketedRandomProjectionLSH(JavaEstimator, LSHParams, HasInputCol, HasOutp | |
| distance space. The output will be vectors of configurable dimension. Hash values in the same | ||
| dimension are calculated by the same hash function. | ||
|
|
||
| .. seealso:: `Stable Distributions \ | ||
| <https://en.wikipedia.org/wiki/Locality-sensitive_hashing#Stable_distributions>`_ | ||
| .. seealso:: `Stable Distributions | ||
| <https://en.wikipedia.org/wiki/Locality-sensitive_hashing#Stable_distributions>`_ | ||
| .. seealso:: `Hashing for Similarity Search: A Survey <https://arxiv.org/abs/1408.2927>`_ | ||
|
|
||
| >>> from pyspark.ml.linalg import Vectors | ||
|
|
@@ -303,7 +303,7 @@ def _create_model(self, java_model): | |
|
|
||
|
|
||
| class BucketedRandomProjectionLSHModel(LSHModel, JavaMLReadable, JavaMLWritable): | ||
| """ | ||
| r""" | ||
|
Member
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. A few docstrings have backslash or backticks in them. This should make sure they don't have surprising effects some day. |
||
| .. note:: Experimental | ||
|
|
||
| Model fitted by :py:class:`BucketedRandomProjectionLSH`, where multiple random vectors are | ||
|
|
@@ -653,8 +653,8 @@ class DCT(JavaTransformer, HasInputCol, HasOutputCol, JavaMLReadable, JavaMLWrit | |
| The return vector is scaled such that the transform matrix is | ||
| unitary (aka scaled DCT-II). | ||
|
|
||
| .. seealso:: `More information on Wikipedia \ | ||
| <https://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-II Wikipedia>`_. | ||
| .. seealso:: `More information on Wikipedia | ||
| <https://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-II Wikipedia>`_. | ||
|
|
||
| >>> from pyspark.ml.linalg import Vectors | ||
| >>> df1 = spark.createDataFrame([(Vectors.dense([5.0, 8.0, 6.0]),)], ["vec"]) | ||
|
|
@@ -1353,7 +1353,7 @@ def _create_model(self, java_model): | |
|
|
||
|
|
||
| class MinHashLSHModel(LSHModel, JavaMLReadable, JavaMLWritable): | ||
| """ | ||
| r""" | ||
| .. note:: Experimental | ||
|
|
||
| Model produced by :py:class:`MinHashLSH`, where where multiple hash functions are stored. Each | ||
|
|
@@ -1362,8 +1362,8 @@ class MinHashLSHModel(LSHModel, JavaMLReadable, JavaMLWritable): | |
| :math:`h_i(x) = ((x \cdot a_i + b_i) \mod prime)` This hash family is approximately min-wise | ||
| independent according to the reference. | ||
|
|
||
| .. seealso:: Tom Bohman, Colin Cooper, and Alan Frieze. "Min-wise independent linear \ | ||
| permutations." Electronic Journal of Combinatorics 7 (2000): R26. | ||
| .. seealso:: Tom Bohman, Colin Cooper, and Alan Frieze. "Min-wise independent linear | ||
| permutations." Electronic Journal of Combinatorics 7 (2000): R26. | ||
|
|
||
| .. versionadded:: 2.2.0 | ||
| """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,7 +283,8 @@ def approxCountDistinct(col, rsd=None): | |
|
|
||
| @since(2.1) | ||
| def approx_count_distinct(col, rsd=None): | ||
| """Aggregate function: returns a new :class:`Column` for approximate distinct count of column `col`. | ||
| """Aggregate function: returns a new :class:`Column` for approximate distinct count of | ||
|
Member
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. Line too long |
||
| column `col`. | ||
|
|
||
| :param rsd: maximum estimation error allowed (default = 0.05). For rsd < 0.01, it is more | ||
| efficient to use :func:`countDistinct` | ||
|
|
@@ -346,7 +347,8 @@ def coalesce(*cols): | |
|
|
||
| @since(1.6) | ||
| def corr(col1, col2): | ||
| """Returns a new :class:`Column` for the Pearson Correlation Coefficient for ``col1`` and ``col2``. | ||
| """Returns a new :class:`Column` for the Pearson Correlation Coefficient for ``col1`` | ||
| and ``col2``. | ||
|
|
||
| >>> a = range(20) | ||
| >>> b = [2 * x for x in range(20)] | ||
|
|
@@ -1688,14 +1690,14 @@ def split(str, pattern): | |
| @ignore_unicode_prefix | ||
| @since(1.5) | ||
| def regexp_extract(str, pattern, idx): | ||
| """Extract a specific group matched by a Java regex, from the specified string column. | ||
| r"""Extract a specific group matched by a Java regex, from the specified string column. | ||
| If the regex did not match, or the specified group did not match, an empty string is returned. | ||
|
|
||
| >>> df = spark.createDataFrame([('100-200',)], ['str']) | ||
| >>> df.select(regexp_extract('str', '(\d+)-(\d+)', 1).alias('d')).collect() | ||
| >>> df.select(regexp_extract('str', r'(\d+)-(\d+)', 1).alias('d')).collect() | ||
| [Row(d=u'100')] | ||
| >>> df = spark.createDataFrame([('foo',)], ['str']) | ||
| >>> df.select(regexp_extract('str', '(\d+)', 1).alias('d')).collect() | ||
| >>> df.select(regexp_extract('str', r'(\d+)', 1).alias('d')).collect() | ||
| [Row(d=u'')] | ||
| >>> df = spark.createDataFrame([('aaaac',)], ['str']) | ||
| >>> df.select(regexp_extract('str', '(a+)(b)?(c)', 2).alias('d')).collect() | ||
|
|
@@ -1712,7 +1714,7 @@ def regexp_replace(str, pattern, replacement): | |
| """Replace all substrings of the specified string value that match regexp with rep. | ||
|
|
||
| >>> df = spark.createDataFrame([('100-200',)], ['str']) | ||
| >>> df.select(regexp_replace('str', '(\\d+)', '--').alias('d')).collect() | ||
| >>> df.select(regexp_replace('str', r'(\d+)', '--').alias('d')).collect() | ||
| [Row(d=u'-----')] | ||
| """ | ||
| sc = SparkContext._active_spark_context | ||
|
|
||
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.
Works in Python 2 and 3