简体   繁体   English

PyCharm类型提示警告

[英]PyCharm type-hinting warning

Using Python 2.7 and PyCharm CE 2018.2.4, I have the following code: 使用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()

This code generates a warning, appearing on the name of the function in the declaration: 此代码会生成一条警告,出现在声明中的函数名称上:

Type hinting is missing for a function definition 函数定义缺少类型提示

What could be done to fix this? 该如何解决? Thank you very much 非常感谢你

Typehint your function. 键入提示您的功能。

Example: 例:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM