From 7f0928c52d9ea9da5014f8d54d4a8f1c1e876630 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Fri, 21 Oct 2016 15:17:56 +0200 Subject: [PATCH] Remove local imports of warn There is a module-level import of warn. If you actually trigger a warning with the current state you, get an UnboundLocalError because you reference warn before assignment... --- loopy/kernel/instruction.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/loopy/kernel/instruction.py b/loopy/kernel/instruction.py index de546bed3..a67b42566 100644 --- a/loopy/kernel/instruction.py +++ b/loopy/kernel/instruction.py @@ -166,7 +166,6 @@ class InstructionBase(Record): from pymbolic.primitives import LogicalNot from loopy.symbolic import parse if pred.startswith("!"): - from warnings import warn warn("predicates starting with '!' are deprecated. " "Simply use 'not' instead") pred = LogicalNot(parse(pred[1:])) @@ -405,14 +404,12 @@ class InstructionBase(Record): def copy(self, **kwargs): if "insn_deps" in kwargs: - from warnings import warn warn("insn_deps is deprecated, use depends_on", DeprecationWarning, stacklevel=2) kwargs["depends_on"] = kwargs.pop("insn_deps") if "insn_deps_is_final" in kwargs: - from warnings import warn warn("insn_deps_is_final is deprecated, use depends_on", DeprecationWarning, stacklevel=2) @@ -831,7 +828,6 @@ class Assignment(MultiAssignmentBase): class ExpressionInstruction(Assignment): def __init__(self, *args, **kwargs): - from warnings import warn warn("ExpressionInstruction is deprecated. Use Assignment instead", DeprecationWarning, stacklevel=2) -- GitLab