8000 [Ray Data]Pylint detection found some Python code defects in ray data · Issue #53881 · ray-project/ray · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[Ray Data]Pylint detection found some Python code defects in ray data #53881
Open
@daiping8

Description

@daiping8

Pylint scan found some Python code defects in ray data, such as:

ray/python/data/datasource/datasink.py:13:0: C0103: Type variable name "WriteReturnType" doesn't conform to predefined naming style (invalid-name)
ray/python/ray/data/datasource/file_based_datasource.py:276:20: R1730: Consider using 'num_threads = min(num_threads, len(read_paths))' instead of unnecessary if block (consider-using-min-builtin)
ray/python/ray/data/read_api.py:3214:4: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
/python/ray/data/dataset.py:845:20: R1701: Consider merging these isinstance calls to isinstance(column, (pd.DataFrame, pd.Index, pd.Series)) (consider-merging-isinstance)
ray/python/ray/data/dataset.py:867:16: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)

All these issues do not affect the logic of program execution, but we can fix these defects, improve code readability, reduce loop load, or remove useless code, and so on.
For example, the corresponding source code for ray/python/ray/data/dataset.py: 845:20 above is:
“if (
isinstance(column, pd.Series)
or isinstance(column, pd.DataFrame)
or isinstance(column, pd.Index)
):

We can completely merge the above three judgments into one isinstance (column, (pd. DataFrame, pd. Index, pd. Series)) without affecting the logic, and the code is more concise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dataRay Data-related issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0