<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Having though a bit more about the example, I have to confess,
      that the checkers work as expected. The 'msg' near the end is not
      flagged as unused because the 'msg' defined in the case block
      survives the block, if there would not be the return statement.
      The checkers do not recognize that but see, that 'msg' is defined
      and used and that spills over to the other 'msg'.</p>
    <div class="moz-cite-prefix">Am 21.06.26 um 16:32 schrieb Detlev
      Offenbach:<br>
    </div>
    <blockquote type="cite"
      cite="mid:45248b67-cb53-4821-a452-1a3c909eaaaf@die-offenbachs.de">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p><font size="2">Hi,</font></p>
      <p><font size="2">I can confirm, that msg at line 46 is not
          flagged as unused. The check done by 'pyflakes' does not
          detect that. I cross checked with 'ruff' and that checker does
          not detect it either. That is cause by the use of 'msg' in the
          'unblock' case block. If you change 'msg' of that block to
          e.g. msg_1, the 'msg' on line 46 is flagged as expected.</font></p>
      <p><font size="2">There is nothing I can do about that because if
          it is an issue, it is outside eric-ide. If two totally
          different checker packages show the same behavior, than that
          must be the right one (or both have the identical faulty
          behavior).</font></p>
      <p><font size="2">Regards,<br>
          Detlev</font></p>
      <div class="moz-cite-prefix">Am 21.06.26 um 15:47 schrieb Dmitrey
        Kroshko:<br>
      </div>
      <blockquote type="cite"
cite="mid:CA+gkcSh91yAao5Uf3MoiDX7xB2ReZ7o=f9E3KmyVLXzAzPYy=A@mail.gmail.com">
        <meta http-equiv="content-type"
          content="text/html; charset=UTF-8">
        <div dir="ltr">
          <div>hello, check this code (put it into Eric new file and
            save)</div>
          <div>while it works well with 4-line function <span
              style="background-color:transparent">myFunction (both
              variables a and msg are marked as unused), it fails for
              more complex </span><span
              style="background-color:transparent">_operationByMAC (only
              a is marked as unused and msg is not)</span></div>
          <div><span style="background-color:transparent"><br>
            </span></div>
          def myFunction(operation = 'lock', macAddress =
          'A0:B0:C0:D0:E0:F0'):<br>
              a = 4<br>
              msg = f'operation {operation} with macAddress={macAddress}
          is finished'<br>
              #print(msg)<br>
              return r<br>
          <br>
          import paramiko<br>
          <br>
          class EmptyClass:<br>
              pass<br>
              <br>
          def _operationByMAC(macAddress=None, operation=None, routerIP
          = None, userName = None, password = None):<br>
              assert operation in ('unblock', 'block', 'get_state')<br>
              r = EmptyClass()<br>
              ssh = paramiko.SSHClient()<br>
              ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())<br>
              r.ssh = ssh<br>
              <br>
              ssh.connect(routerIP, username=userName,
          password=password)<br>
              command = f'ip firewall filter print where
          src-mac-address="{macAddress}"'<br>
              stdin, stdout, stderr = ssh.exec_command(command)<br>
              <br>
              result = stdout.read().decode()<br>
              lines = result.split('\n')<br>
              RuleLine  = None<br>
              for line in lines:<br>
                  if 'src-mac-address='+macAddress in line:<br>
                      RuleLine = line<br>
                      break<br>
              if RuleLine is None:<br>
                  match operation:<br>
                      case 'get_state':<br>
                          r.state = 'unblocked'<br>
                          print(f'{macAddress} is unblocked')<br>
                          return r<br>
                      case 'block':<br>
                          pass<br>
                      case 'unblock':<br>
                          msg = 'Error: this MAC was not found in
          firewall rules'<br>
                          print(msg)<br>
                          r.msg = msg<br>
                          r.state = 'unblocked'<br>
                          return r<br>
          <br>
              a = 3<br>
              msg = f'operation {operation} with macAddress={macAddress}
          is finished'<br>
              #print(msg)<br>
              return r
          <div>Regards, Dmitrey</div>
        </div>
        <br>
        <div class="gmail_quote gmail_quote_container">
          <div dir="ltr" class="gmail_attr">On Sun, 21 Jun 2026 at
            16:12, Detlev Offenbach <<a
              href="mailto:detlev@die-offenbachs.de"
              moz-do-not-send="true" class="moz-txt-link-freetext">detlev@die-offenbachs.de</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div>
              <p><font size="2">Hello Dmitrey,</font></p>
              <p><font size="2">I just tried your code over here and
                  have to admit, that everything works as expected. The
                  'msg' variable is flagged as unused and an associated
                  message is shown (see attached screenshot). Are you
                  sure, that the Syntax Checker Plugin is active? You
                  may check this via the Plugin Infos dialog. If it is
                  not, just open the context menu in there and selecte
                  'Activate'. If that does not work, check for an error
                  in the associated plugin details.</font></p>
              <p><font size="2">Regards,<br>
                  Detlev</font></p>
              <div>Am 21.06.26 um 10:16 schrieb Dmitrey Kroshko:<br>
              </div>
              <blockquote type="cite">
                <div>def myFunc(...):</div>
                <div>    ....</div>
                <div>    msg = f'operation {operation} with
                  macAddress={macAddress} is finished'<br>
                      #print(msg)<br>
                      return r</div>
              </blockquote>
              <pre cols="72">-- 
Detlev Offenbach
<a href="mailto:detlev@die-offenbachs.de" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">detlev@die-offenbachs.de</a></pre>
            </div>
          </blockquote>
        </div>
      </blockquote>
      <pre class="moz-signature" cols="72">-- 
Detlev Offenbach
<a class="moz-txt-link-abbreviated moz-txt-link-freetext"
      href="mailto:detlev@die-offenbachs.de" moz-do-not-send="true">detlev@die-offenbachs.de</a></pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Detlev Offenbach
<a class="moz-txt-link-abbreviated" href="mailto:detlev@die-offenbachs.de">detlev@die-offenbachs.de</a></pre>
  </body>
</html>