PyCharm类型提示警告



使用Python 2.7和PyCharm CE 2018.2.4,我有以下代码:

from datetime import datetime as dt
def updateGroupDynamicBenchmark(self, security, group, runTime):
"""
Update all the fields in a group from BPipe
:param security: Security to update
:type  security: Common.secMasterRecords.SecMasterRecord
:param group:    Group id to update
:type  group:    Common.secMasterFieldPolicyMgr.SecMasterFieldGroup
:param runTime:   Running time for the update
:type  runTime:   datetime.datetime
:return:  New expiry time
:rtype:   datetime.datetime
"""
return dt.now()

此代码生成一个警告,出现在声明中函数的名称上:

函数定义缺少类型提示

如何解决此问题?非常感谢

Typehint您的函数。

示例:

def square(number: int) -> int:
return number ** 2

最新更新