hci-lab / PyQuran

PyQuran: The Python package for Quranic Analysis https://hci-lab.github.io/PyQuran-Private
GNU General Public License v2.0
130 stars 23 forks source link

SyntaxWarning #5

Closed MKM12345 closed 1 year ago

MKM12345 commented 1 year ago

Assalamualaykum, I was testing this file when I got this error:

python
main.py:536: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if((sentance[index] in (alphabet or alefat or hamzat)or sentance[index] is ' ' )):

Evidence: image

I am running Windows as my operating system and Python version 3.11.3 (the latest version today).

To reproduce the bug, you can use the following code:


sentance = "This is a test."
alphabet = "abcdefghijklmnopqrstuvwxyz"
alefat = "ءآأؤإئابتثجحخدذرزسشصضطظعغفقكلمنهوي"
hamzat = "ءآأؤإئ"
for index in range(len(sentance)):
    if((sentance[index] in (alphabet or alefat or hamzat)or sentance[index] is ' ' )):
        pass

So am I missing something here?

TahaMagdy commented 1 year ago

WaalikomElsalam, You're not missing anything :) it should be == not is. Make a pull request with the fix please.

MKM12345 commented 1 year ago

Ok jazakallah. Will do.