是否有任何工具可以转换注释样式类型的注释,例如:
def func(foo: str) -> None:
bar: List[str] = []
bar.append(foo)
进入句法风格:
def func(foo: str) -> None:
bar = [] # type: List[str]
bar.append(foo)
理想情况下,我希望能够指定要定位的Python版本,以便我可以选择保留一些注释注释样式,例如支持Python 3.5:
public boolean isConnectToInternet() {
ConnectivityManager connectivity = (ConnectivityManager)
getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivity != null) {
NetworkInfo[] info = connectivity.getAllNetworkInfo();
if (info != null)
for (int i = 0; i < info.length; i++)
if (info[i].getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
return false;
}