asking for option in Pyflakes --> handling Python built-in regex operations

Hi there, First, thanks for all your time and effort. Guys like me, which aren't professional programmers, would produce spaghetti code for ever without YOU! I just started using Pyflakes and got a lot of warnings in respect to "main.py:168:20 're' may be undefined, or defined from star imports: modules.testbus" the specific line contains "re.search("Byte Array", self.getFormat(), re.I)" In this case Pyflakes warns about the built-in regex operation re.search. And in my case this are many code lines. Therefore I'd like to have a switch to ignore this warning or maybe Pyflakes can recognize the built-in regex operations? Kind regards, Beat Weiss Adv Senior Engineer Cloud FPGAs & Tape Phone: +41 44 724 82 66 Fax: +41 44 724 89 59 E-mail: wei@zurich.ibm.com www.zurich.ibm.com IBM Reserach Europe Saeumerstrasse 4 Rueschlikon, 8803 Switzerland This email may contain confidential information, intended for the recipient specified above only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.

Is there a reason you don't want to `import re` in main.py? Relying on it being part of modules.testbus is fragile and the real problem here. If you want ways to ignore specific PyFlakes errors, the only way to do that is to use Flake8. On Thu, May 20, 2021 at 6:17 AM Beat Weiss <wei@zurich.ibm.com> wrote:
Hi there,
First, thanks for all your time and effort. Guys like me, which aren't professional programmers, would produce spaghetti code for ever without YOU!
I just started using Pyflakes and got a lot of warnings in respect to "main.py:168:20 're' may be undefined, or defined from star imports: modules.testbus" the specific line contains "re.search("Byte Array", self.getFormat(), re.I)"
In this case Pyflakes warns about the built-in regex operation re.search. And in my case this are many code lines.
Therefore I'd like to have a switch to ignore this warning or maybe Pyflakes can recognize the built-in regex operations?
Kind regards,
Beat Weiss Adv Senior Engineer Cloud FPGAs & Tape
Phone: +41 44 724 82 66 Fax: +41 44 724 89 59 E-mail: wei@zurich.ibm.com www.zurich.ibm.com
IBM Reserach Europe
Saeumerstrasse 4 Rueschlikon, 8803 Switzerland
This email may contain confidential information, intended for the recipient specified above only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future. _______________________________________________ code-quality mailing list -- code-quality@python.org To unsubscribe send an email to code-quality-leave@python.org https://mail.python.org/mailman3/lists/code-quality.python.org/ Member address: graffatcolmingov@gmail.com

Hi Ian, Thanks, that's very helpful. I wasn't aware of my "mistake" as it just worked. Regards, Beat From: "Ian Stapleton Cordasco" <graffatcolmingov@gmail.com> To: "Beat Weiss" <wei@zurich.ibm.com> Cc: "code-quality" <code-quality@python.org> Date: 20/05/2021 13:38 Subject: [EXTERNAL] Re: [code-quality] asking for option in Pyflakes --> handling Python built-in regex operations Is there a reason you don't want to `import re` in main.py? Relying on it being part of modules.testbus is fragile and the real problem here. If you want ways to ignore specific PyFlakes errors, the only way to do that is to use Flake8. On Thu, May 20, 2021 at 6:17 AM Beat Weiss <wei@zurich.ibm.com> wrote:
Hi there,
First, thanks for all your time and effort. Guys like me, which aren't professional programmers, would produce
spaghetti code for ever without YOU!
I just started using Pyflakes and got a lot of warnings in respect to "main.py:168:20 're' may be undefined, or defined from star imports:
modules.testbus"
the specific line contains "re.search("Byte Array", self.getFormat(), re.I)"
In this case Pyflakes warns about the built-in regex operation re.search. And in my case this are many code lines.
Therefore I'd like to have a switch to ignore this warning or maybe Pyflakes can recognize the built-in regex operations?
Kind regards,
Beat Weiss Adv Senior Engineer Cloud FPGAs & Tape
Phone: +41 44 724 82 66 Fax: +41 44 724 89 59 E-mail: wei@zurich.ibm.com www.zurich.ibm.com
IBM Reserach Europe
Saeumerstrasse 4 Rueschlikon, 8803 Switzerland
This email may contain confidential information, intended for the recipient specified above only. It is strictly forbidden to share any part of this message with any third party, without a written consent of the sender. If you received this message by mistake, please reply to this message and follow with its deletion, so that we can ensure such a mistake does not occur in the future.
code-quality mailing list -- code-quality@python.org To unsubscribe send an email to code-quality-leave@python.org
https://mail.python.org/mailman3/lists/code-quality.python.org/
Member address: graffatcolmingov@gmail.com
participants (2)
-
Beat Weiss
-
Ian Stapleton Cordasco