Skip to content
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
2 changes: 0 additions & 2 deletions paddle/scripts/conda_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def __init__(self):
- gast==0.3.3
- Pillow
- decorator
- astor
"""

self.requirement_run_windows = r"""
Expand All @@ -68,7 +67,6 @@ def __init__(self):
- gast==0.3.3
- Pillow
- decorator
- astor
"""
self.test = r"""
test:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ show_column_numbers = true

[[tool.mypy.overrides]]
module = [
"astor",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里加上 decorator 吧,mypy 检查挂了

"cv2",
"decorator",
"scipy",
"xlsxwriter"
]
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/jit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ def ignore_module(modules: list[ModuleType]) -> None:
.. code-block:: python

>>> import scipy
>>> import astor
>>> import decorator

>>> import paddle
>>> from paddle.jit import ignore_module
>>> modules = [
... scipy,
... astor,
... decorator,
... ]
>>> ignore_module(modules)

Expand Down
15 changes: 2 additions & 13 deletions python/paddle/jit/dy2static/ast_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@


import ast
import sys

import astor

from paddle.utils import gast

Expand All @@ -32,13 +29,5 @@ def ast_to_source_code(ast_node):
if isinstance(ast_node, gast.AST):
ast_node = gast.gast_to_ast(ast_node)

if sys.version_info >= (3, 9):
ast.fix_missing_locations(ast_node)
return ast.unparse(ast_node)

# Do not wrap lines even if they are too long
def pretty_source(source):
return ''.join(source)

source_code = astor.to_source(ast_node, pretty_source=pretty_source)
return source_code
ast.fix_missing_locations(ast_node)
return ast.unparse(ast_node)
1 change: 0 additions & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ numpy>=1.21
protobuf>=3.20.2
Pillow
decorator
astor
opt_einsum==3.3.0
networkx
typing_extensions
12 changes: 0 additions & 12 deletions test/dygraph_to_static/test_program_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import inspect
import textwrap
import unittest

import astor
import numpy as np
from dygraph_to_static_utils import (
Dy2StTestBase,
Expand All @@ -31,7 +28,6 @@
import paddle
import paddle.jit.dy2static as _jst
from paddle.jit.dy2static.utils import func_to_source_code
from paddle.utils import gast

np.random.seed(0)

Expand All @@ -56,14 +52,6 @@ def decorated_simple_func(x, weight_numpy):
return z


def get_source_code(func):
raw_code = inspect.getsource(func)
code = textwrap.dedent(raw_code)
root = gast.parse(code)
source_code = astor.to_source(gast.gast_to_ast(root))
return source_code


class StaticCode1:
def dyfunc_with_if_else(x_v, label=None):
loss = _jst.UndefinedVar('loss')
Expand Down
1 change: 0 additions & 1 deletion tools/cinn/docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ gast==0.3.3 ; platform_system == "Windows"
Pillow
six
decorator==4.4.2
astor
xgboost