"git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "30d2911662127156941ed075adc5c9c12cc82838"
Commit b7729f0a authored by Zejun Lin's avatar Zejun Lin Committed by QuanluZhang
Browse files

Make it feasible for annotation whether to add an extra line...

Make it feasible for annotation whether to add an extra line "nni.get_next_parameter()" or not (#526)

* fix bug

* add docs

* add ut

* add ut

* add to ci

* update doc

* update doc

* update ut

* add ut to ci

* add ut to ci

* add ut to ci

* add ut to ci

* add ut to ci

* add ut to ci

* add ut to ci

* add ut to ci

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* revert

* refactor

* refactor

* s

* merge

* fix annotation for extra line

* add deprecation warning
parent 1159c855
...@@ -128,4 +128,6 @@ else: ...@@ -128,4 +128,6 @@ else:
if name is None: if name is None:
name = '__line{:d}'.format(lineno) name = '__line{:d}'.format(lineno)
key = '{}/{}/{}'.format(module, name, func) key = '{}/{}/{}'.format(module, name, func)
if trial._params is None:
trial.get_next_parameter()
return trial.get_current_parameter(key) return trial.get_current_parameter(key)
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
import ast import ast
import astor import astor
from nni_cmd.common_utils import print_warning
# pylint: disable=unidiomatic-typecheck # pylint: disable=unidiomatic-typecheck
...@@ -218,6 +218,10 @@ class Transformer(ast.NodeTransformer): ...@@ -218,6 +218,10 @@ class Transformer(ast.NodeTransformer):
else: else:
return node # not an annotation, ignore it return node # not an annotation, ignore it
if string.startswith('@nni.get_next_parameter('):
deprecated_message = "'@nni.get_next_parameter' is deprecated in annotation due to inconvenience. Please remove this line in the trial code."
print_warning(deprecated_message)
if string.startswith('@nni.report_intermediate_result(') \ if string.startswith('@nni.report_intermediate_result(') \
or string.startswith('@nni.report_final_result(') \ or string.startswith('@nni.report_final_result(') \
or string.startswith('@nni.get_next_parameter('): or string.startswith('@nni.get_next_parameter('):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment