Skip to content

Commit 2ec6b6f

Browse files
authored
remove packages in __all__ (#32757)
* remove packages in __all__ * create new public api level paddle.callbacks;paddle.hub;paddle.utils.unique_name
1 parent 957cbe6 commit 2ec6b6f

File tree

8 files changed

+80
-19
lines changed

8 files changed

+80
-19
lines changed

python/paddle/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@
269269

270270
# high-level api
271271
from .hapi import Model # noqa: F401
272-
from .hapi import callbacks # noqa: F401
272+
from . import callbacks # noqa: F401
273273
from .hapi import summary # noqa: F401
274274
from .hapi import flops # noqa: F401
275-
from .hapi import hub # noqa: F401
275+
from . import hub # noqa: F401
276276

277277
import paddle.text # noqa: F401
278278
import paddle.vision # noqa: F401
@@ -335,10 +335,8 @@
335335
'unsqueeze_',
336336
'argmax',
337337
'Model',
338-
'callbacks',
339338
'summary',
340339
'flops',
341-
'hub',
342340
'sort',
343341
'split',
344342
'logical_and',

python/paddle/callbacks.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from .hapi.callbacks import Callback # noqa: F401
16+
from .hapi.callbacks import ProgBarLogger # noqa: F401
17+
from .hapi.callbacks import ModelCheckpoint # noqa: F401
18+
from .hapi.callbacks import VisualDL # noqa: F401
19+
from .hapi.callbacks import LRScheduler # noqa: F401
20+
from .hapi.callbacks import EarlyStopping # noqa: F401
21+
from .hapi.callbacks import ReduceLROnPlateau # noqa: F401
22+
23+
__all__ = [ #noqa
24+
'Callback',
25+
'ProgBarLogger',
26+
'ModelCheckpoint',
27+
'VisualDL',
28+
'LRScheduler',
29+
'EarlyStopping',
30+
'ReduceLROnPlateau'
31+
]

python/paddle/hapi/callbacks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525

2626
from .progressbar import ProgressBar
2727

28-
__all__ = [
29-
'Callback', 'ProgBarLogger', 'ModelCheckpoint', 'VisualDL', 'LRScheduler',
30-
'EarlyStopping', 'ReduceLROnPlateau'
31-
]
28+
__all__ = []
3229

3330

3431
def config_callbacks(callbacks=None,

python/paddle/hub.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from .hapi.hub import list # noqa: F401
16+
from .hapi.hub import help # noqa: F401
17+
from .hapi.hub import load # noqa: F401
18+
19+
__all__ = [ #noqa
20+
'list', 'help', 'load'
21+
]

python/paddle/nn/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,8 @@ def weight_norm(*args):
232232
'MaxPool3D',
233233
'AdaptiveMaxPool2D',
234234
'Hardshrink',
235-
'clip',
236235
'Softplus',
237236
'KLDivLoss',
238-
'clip_by_norm',
239237
'AvgPool2D',
240238
'L1Loss',
241239
'LeakyReLU',

python/paddle/utils/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@
1919
from .lazy_import import try_import # noqa: F401
2020
from .op_version import OpLastCheckpointChecker # noqa: F401
2121
from .install_check import run_check # noqa: F401
22-
from ..fluid.framework import unique_name # noqa: F401
22+
from . import unique_name # noqa: F401
2323
from ..fluid.framework import require_version # noqa: F401
2424

2525
from . import download # noqa: F401
2626
from . import image_util # noqa: F401
2727
from . import cpp_extension # noqa: F401
2828

29-
__all__ = [ #noqa
30-
'deprecated',
31-
'download',
32-
'run_check',
33-
'unique_name',
34-
'require_version',
35-
'try_import'
29+
__all__ = [ #noqa
30+
'deprecated', 'run_check', 'require_version', 'try_import'
3631
]

python/paddle/utils/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __exit__(self, exc_type, exc_val, exc_tb):
5555
import logging
5656
logger = logging.getLogger(__name__)
5757

58-
__all__ = []
58+
__all__ = ['get_weights_path_from_url']
5959

6060
WEIGHTS_HOME = osp.expanduser("~/.cache/paddle/hapi/weights")
6161

python/paddle/utils/unique_name.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from ..fluid.unique_name import generate # noqa: F401
16+
from ..fluid.unique_name import switch # noqa: F401
17+
from ..fluid.unique_name import guard # noqa: F401
18+
19+
__all__ = [ #noqa
20+
'generate', 'switch', 'guard'
21+
]

0 commit comments

Comments
 (0)