clslgrnc / tbrop

Re-defined variable from outer scope PYL-W0621
Anti-pattern
Major
10 months ago4 years old
Redefining name 'context' from outer scope (line 107)
 73        return False
 74
 75
 76def limitNbrInsts(gdgtCol, gadget, context): 77    bound = gadget.gadgetMatrix.nbrInsts
 78    return limit(gdgtCol, gadget, bound, context)
 79
Redefining name 'context' from outer scope (line 107)
 78    return limit(gdgtCol, gadget, bound, context)
 79
 80
 81def limitNbrBytes(gdgtCol, gadget, context): 82    bound = len(gadget.bytes())
 83    return limit(gdgtCol, gadget, bound, context)
 84
Redefining name 'context' from outer scope (line 107)
 83    return limit(gdgtCol, gadget, bound, context)
 84
 85
 86def limitCost(gdgtCol, gadget, context): 87    bound = gadget.cost()
 88    return limit(gdgtCol, gadget, bound, context)
 89
Redefining name 'context' from outer scope (line 107)
 61]
 62
 63
 64def limit(gdgtCol, gadget, bound, context): 65    if bound < context:
 66        gdgtcpy = gadget.copy()
 67        gdgtCol.add_gadget(gdgtcpy)