errcheck.py 文件源码

python
阅读 42 收藏 0 点赞 0 评论 0

项目:SoCFoundationFlow 作者: mattaw 项目源码 文件源码
def check_invalid_constraints(self):
    feat = set([])
    for x in list(TaskGen.feats.values()):
        feat.union(set(x))
    for (x, y) in TaskGen.task_gen.prec.items():
        feat.add(x)
        feat.union(set(y))
    ext = set([])
    for x in TaskGen.task_gen.mappings.values():
        ext.add(x.__name__)
    invalid = ext & feat
    if invalid:
        Logs.error('The methods %r have invalid annotations:  @extension <-> @feature/@before_method/@after_method' % list(invalid))

    # the build scripts have been read, so we can check for invalid after/before attributes on task classes
    for cls in list(Task.classes.values()):
        if sys.hexversion > 0x3000000 and issubclass(cls, Task.Task) and isinstance(cls.hcode, str):
            raise Errors.WafError('Class %r has hcode value %r of type <str>, expecting <bytes> (use Utils.h_cmd() ?)' % (cls, cls.hcode))

        for x in ('before', 'after'):
            for y in Utils.to_list(getattr(cls, x, [])):
                if not Task.classes.get(y, None):
                    Logs.error('Erroneous order constraint %r=%r on task class %r' % (x, y, cls.__name__))
        if getattr(cls, 'rule', None):
            Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")' % cls.__name__)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号