Skip to content

Commit

Permalink
[Docathon][CodeStyle Fix No.2] enable I001 rule (PaddlePaddle#6275)
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooo-create authored Oct 29, 2023
1 parent 9db06db commit 01fd849
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 56 deletions.
11 changes: 6 additions & 5 deletions ci_scripts/CAPItools/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# python main.py ../paddle .


import CppHeaderParser
import json
import os
import traceback
import sys
import re
import sys
import traceback

from utils_helper import func_helper, class_helper, generate_overview
import CppHeaderParser
from utils import get_PADDLE_API_class, get_PADDLE_API_func
from utils_helper import class_helper, func_helper, generate_overview


# 解析所有的函数, 类, 枚举, 返回一个字典
Expand Down Expand Up @@ -88,9 +88,10 @@ def cpp2py(data: dict):

if root_dir == '':
try:
import paddle
import inspect

import paddle

root_dir = os.path.dirname(inspect.getsourcefile(paddle))
except:
# for simple run
Expand Down
2 changes: 1 addition & 1 deletion ci_scripts/check_api_docs_en.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
import argparse
import json
import sys

source_to_doc_dict = {}
Expand Down
6 changes: 3 additions & 3 deletions ci_scripts/check_api_label_cn.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import sys
import argparse
import logging
import os
import re
import logging
import argparse
import sys
from pathlib import Path

logger = logging.getLogger()
Expand Down
6 changes: 3 additions & 3 deletions ci_scripts/check_api_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import argparse
import ast
import inspect
import json
import os.path as osp
import re
import sys
import inspect
import ast


def add_path(path):
Expand Down
2 changes: 1 addition & 1 deletion ci_scripts/check_pr_approval.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys
import json
import sys


def check_approval(count, required_reviewers):
Expand Down
13 changes: 6 additions & 7 deletions ci_scripts/doc-build-config/en/conf.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import sys
import os

# sys.path.insert(0, os.path.abspath('@PADDLE_BINARY_DIR@/python'))
from recommonmark import parser, transform
import inspect
import ast
import time
import configparser
import inspect
import os
import re
import sys
import time

from recommonmark import parser, transform

try:
import paddle # noqa: F401
Expand Down
12 changes: 4 additions & 8 deletions ci_scripts/doc-build-config/zh/conf.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import sys
import os
import inspect
import ast
import inspect
import os
import sys
import time

# sys.setdefaultencoding('utf-8')

# sys.path.insert(0, os.path.abspath('@PADDLE_BINARY_DIR@/python'))
from recommonmark import parser, transform

import time

try:
import paddle # noqa: F401
except:
Expand Down
5 changes: 3 additions & 2 deletions ci_scripts/hooks/post_filter_htmls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
'''
do sth. after the html generated.
'''
from bs4 import BeautifulSoup
import argparse
import os
import sys
import argparse

from bs4 import BeautifulSoup


def insert_header_and_anchor_for_method(htmlfile):
Expand Down
6 changes: 3 additions & 3 deletions docs/api/copy_codes_from_en_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
'''
copy code-blocks from en api doc-strings.
'''
import os
import sys
import argparse
import inspect
import re
import json
import logging
import os
import re
import sys

api_info_dict = {}
api_name_2_id_map = {}
Expand Down
7 changes: 4 additions & 3 deletions docs/api/extract_api_from_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
Extract used apis from markdown and reStructured documents.
"""

import re
import inspect
import os
import argparse
import inspect
import logging
import os
import re
from contextlib import contextmanager

import docutils
import docutils.core
import docutils.nodes
Expand Down
5 changes: 3 additions & 2 deletions docs/api/gen_alias_api.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import paddle
import inspect
import pkgutil
import sys
import subprocess
import sys

import paddle


class AliasAPIGen:
Expand Down
21 changes: 11 additions & 10 deletions docs/api/gen_doc.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import paddle
import os
import pkgutil
import types
import contextlib
import argparse
import json
import sys
import inspect
import ast
import logging
import contextlib
import importlib
import inspect
import json
import logging
import os
import pkgutil
import re
import extract_api_from_docs
import sys
import types
from queue import Queue

import extract_api_from_docs
import paddle

"""
generate api_info_dict.json to describe all info about the apis.
"""
Expand Down
9 changes: 1 addition & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,5 @@ ignore = [
"E741",
"F841",
"UP015",
"UP038",
# need to remove
"F541",
"I001",
"W291",
"PLR1722",
"E711",
"F811"
"UP038"
]

0 comments on commit 01fd849

Please sign in to comment.