Skip to content
Open

pyflake #2979

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
student_record = os.getenv("STUDENTS_RECORD_FILE")

import pickle
import logging

# Define logger with info
# import polar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# binary file to search a given record

import pickle
from dotenv import load_dotenv


def search():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
) as F:
while True:
ch = F.readlines()
for i in ch: # ch is the whole file,for i in ch gives lines, for j in i gives letters,for j in i.split gives words
for (
i
) in (
ch
): # ch is the whole file,for i in ch gives lines, for j in i gives letters,for j in i.split gives words
print(i, end="")
else:
sys.stderr.write("End of file reached")
Expand Down
7 changes: 4 additions & 3 deletions Armstrong_number
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ def is_armstrong_number(number):
temp = 0
while num != 0:
rem = num % 10
num //= 10
temp += rem ** length
num //= 10
temp += rem**length
return temp == number



is_armstrong_number(5)
2 changes: 1 addition & 1 deletion Automated Scheduled Call Reminders/caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def search():
for doc in list_of_docs:
if doc["from"][0:5] == five_minutes_prior:
phone_number = doc["phone"]
call = client.calls.create(
client.calls.create(
to=phone_number,
from_="add your twilio number",
url="http://demo.twilio.com/docs/voice.xml",
Expand Down
2 changes: 1 addition & 1 deletion Automated Scheduled Call Reminders/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ timedelta
credentials
firestore
initialize_app
Twilio
Twilio
2 changes: 1 addition & 1 deletion Binary_to_Decimal.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def binaryToDecimal(binary):
>>> binaryToDecimal(101011)
43
"""
decimal, i, n = 0, 0, 0
decimal, i, _n = 0, 0, 0
while binary != 0:
dec = binary % 10
decimal = decimal + dec * pow(2, i)
Expand Down
3 changes: 1 addition & 2 deletions BoardGame-CLI/snakeLadder.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def play():
print(f"you got {temp1}")
print("")

if isReady[i] == False and temp1 == 6:
if not isReady[i] and temp1 == 6:
isReady[i] = True

if isReady[i]:
Expand Down Expand Up @@ -90,7 +90,6 @@ def play():
elif n == 2:
players = {} # stores player ans their locations
isReady = {}
current_loc = 1 # reset starting location to 1
player_input()

elif n == 3:
Expand Down
1 change: 0 additions & 1 deletion CRC/crc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
def crc_check(data, div):
l = len(div)
ct = 0
data = [int(i) for i in data]
div = [int(i) for i in div]
zero = [0 for i in range(l)]
Expand Down
2 changes: 1 addition & 1 deletion Checker_game_by_dz/first.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_row_col_mouse(pos):
while run:
clock.tick(fps)

if board.winner() != None:
if board.winner() is not None:
print(board.winner())

# check if any events is running or not
Expand Down
2 changes: 1 addition & 1 deletion CliYoutubeDownloader/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pytube
pytube
6 changes: 3 additions & 3 deletions Colors/pixel_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,19 @@ def main():
) # setting the threshold value for every row in the frame

# For the specific row , if all the values are non-zero then it is sorted with color
if np.all(np.asarray(color)) == True:
if np.all(np.asarray(color)):
color.sort(key=lambda bgr: step(bgr, 8)) # step sorting
band, img = generateColors(color, img, row)
measure(len(color), row, col, height, width)

# For the specific row , if any of the values are zero it gets sorted with color_n
if np.all(np.asarray(color)) == False:
if not np.all(np.asarray(color)):
for ind, i in enumerate(color):
# Accessing every list within color
# Added to color_n if any of the element in the list is non-zero
# and their sum is less than threshold value

if np.any(np.asarray(i)) == True and sum(i) < thresh:
if np.any(np.asarray(i)) and sum(i) < thresh:
color_n.append(i)

color_n.sort(key=lambda bgr: step(bgr, 8)) # step sorting
Expand Down
6 changes: 3 additions & 3 deletions Day_of_week.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def process_date(user_input):


def find_day(date):
born = (
datetime.datetime.strptime(date, "%d %m %Y").weekday()
) # this statement returns an integer corresponding to the day of the week
born = datetime.datetime.strptime(
date, "%d %m %Y"
).weekday() # this statement returns an integer corresponding to the day of the week
return calendar.day_name[
born
] # this statement returns the corresponding day name to the integer generated in the previous statement
Expand Down
2 changes: 1 addition & 1 deletion Downloaded Files Organizer/obs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def watcher(path):
class Handler(FileSystemEventHandler):
def on_created(self, event):
if event.event_type == "created":
file_name = os.path.basename(event.src_path)
os.path.basename(event.src_path)
ext = os.path.splitext(event.src_path)[1]
time.sleep(2)
add_to_dir(ext[1:], event.src_path, path)
Expand Down
6 changes: 4 additions & 2 deletions Emoji Dictionary/QT_GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def clear_text():
button = QPushButton(emoji)
button.setFixedSize(40, 40)
button.setFont(QFont("Arial", 20))
button.setStyleSheet("""
button.setStyleSheet(
"""
QPushButton {
background-color: #ffffff;
border: 1px solid #e0e0e0;
Expand All @@ -140,7 +141,8 @@ def clear_text():
QPushButton:hover {
background-color: #f0f0f0;
}
""")
"""
)
button.clicked.connect(lambda checked, e=emoji: add_input_emoji(e))
self.emoji_layout.addWidget(button, row_idx, col_idx)
self.emoji_buttons.append(button)
Expand Down
4 changes: 1 addition & 3 deletions EncryptionTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ def decrypt(enc_text):
def readAndDecrypt(filename):
file = open(filename, "r")
data = file.read()
datalistint = []
actualdata = []
datalist = data.split(" ")
datalist.remove("")
datalistint = [float(data) for data in datalist]
[float(data) for data in datalist]
for data in datalist:
current1 = int(decryptChar(data))
current1 = chr(current1)
Expand All @@ -66,7 +65,6 @@ def readAndEncrypt(filename):
data = file.read()
datalist = list(data)
encrypted_list = list()
encrypted_list_str = list()
for data in datalist:
current = ord(data)
current = encryptChar(current)
Expand Down
30 changes: 15 additions & 15 deletions Extract-Table-from-pdf-txt-docx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

# %%

if os.path.isdir("Parent") == True:
if os.path.isdir("Parent"):
os.chdir("Parent")
# FOR CHILD1 DIRECTORY
if os.path.isdir("Child1") == True:
if os.path.isdir("Child1"):
os.chdir("Child1")
# PDF FILE READING
if os.path.isfile("Pdf1_Child1.pdf") == True:
if os.path.isfile("Pdf1_Child1.pdf"):
df_pdf_child1 = tabula.read_pdf("Pdf1_Child1.pdf", pages="all")
# DOCUMENT READING
if os.path.isfile("Document_Child1.docx") == True:
if os.path.isfile("Document_Child1.docx"):
document = Document("Document_Child1.docx")
table = document.tables[0]
data = []
Expand All @@ -30,7 +30,7 @@
data.append(row_data)
df_document_child1 = pd.DataFrame(data)
# TEXT READING
if os.path.isfile("Text_Child1.txt") == True:
if os.path.isfile("Text_Child1.txt"):
df_text_child1 = pd.read_csv("Text_Child1.txt")

# %%
Expand All @@ -39,16 +39,16 @@

# %%
os.chdir("../")
if os.path.isdir("Parent") == True:
if os.path.isdir("Parent"):
os.chdir("Parent")
# FOR CHILD2 DIRECTORY
if os.path.isdir("Child2") == True:
if os.path.isdir("Child2"):
os.chdir("Child2")
# PDF FILE READING
if os.path.isfile("Pdf1_Child2.pdf") == True:
if os.path.isfile("Pdf1_Child2.pdf"):
df_pdf_child2 = tabula.read_pdf("Pdf1_Child2.pdf", pages="all")
# DOCUMENT READING
if os.path.isfile("Document_Child2.docx") == True:
if os.path.isfile("Document_Child2.docx"):
document = Document("Document_Child2.docx")
table = document.tables[0]
data = []
Expand All @@ -63,24 +63,24 @@
data.append(row_data)
df_document_child2 = pd.DataFrame(data)
# TEXT READING
if os.path.isfile("Text_Child2.txt") == True:
if os.path.isfile("Text_Child2.txt"):
df_text_child2 = pd.read_csv("Text_Child2.txt")

# %%
df_pdf_child2[0].head(4)

# %%
os.chdir("../")
if os.path.isdir("Parent") == True:
if os.path.isdir("Parent"):
os.chdir("Parent")
# FOR CHILD3 DIRECTORY
if os.path.isdir("Child3") == True:
if os.path.isdir("Child3"):
os.chdir("Child3")
# PDF FILE READING
if os.path.isfile("Pdf1_Child3.pdf") == True:
if os.path.isfile("Pdf1_Child3.pdf"):
df_pdf_child3 = tabula.read_pdf("Pdf1_Child3.pdf", pages="all")
# DOCUMENT READING
if os.path.isfile("Document_Child3.docx") == True:
if os.path.isfile("Document_Child3.docx"):
document = Document("Document_Child3.docx")
table = document.tables[0]
data = []
Expand All @@ -95,7 +95,7 @@
data.append(row_data)
df_document_child3 = pd.DataFrame(data)
# TEXT READING
if os.path.isfile("Text_Child3.txt") == True:
if os.path.isfile("Text_Child3.txt"):
df_text_child3 = pd.read_csv("Text_Child3.txt")

# %%
Expand Down
2 changes: 1 addition & 1 deletion FibonacciNumbersWithGenerators.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def fibonacci_generator(n=None):
"""
f0, f1 = 0, 1
yield f1
while n == None or n > 1:
while n is None or n > 1:
fn = f0 + f1
yield fn
f0, f1 = f1, fn
Expand Down
2 changes: 1 addition & 1 deletion Google_Image_Downloader/image_grapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def search_for_image():

results = sew.findAll("div", {"class": "rg_meta"})
for re in results:
(link, Type) = (json.loads(re.text)["ou"], json.loads(re.text)["ity"])
(link, _Type) = (json.loads(re.text)["ou"], json.loads(re.text)["ity"])
images.append(link)
counter = 0
for re in images:
Expand Down
2 changes: 1 addition & 1 deletion Grocery calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Methods = addToList, Total, Subtotal, returnList
class GroceryList(dict):
def __init__(self):
self = {}
pass

def addToList(self, item, price):
self.update({item: price})
Expand Down
4 changes: 3 additions & 1 deletion Industrial_developed_hangman/src/hangman/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def user_lose(self) -> None:

def user_win(self) -> None:
"""Print text for end of game and exits."""
print_wrong(f"{self._word_string_to_show} YOU WON", self._print_function) # noqa:WPS305
print_wrong(
f"{self._word_string_to_show} YOU WON", self._print_function
) # noqa:WPS305

def game_process(self, user_character: str) -> bool:
# noqa: DAR201
Expand Down
1 change: 1 addition & 0 deletions Infix_to_Postfix.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Python program to convert infix expression to postfix


# Class to convert the expression
class Conversion:
# Constructor to initialize the class variables
Expand Down
8 changes: 4 additions & 4 deletions JARVIS/JARVIS_2.0.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def get_app(Q):
webbrowser.open("https://github.com/")
elif Q == "search for":
que = Q.lstrip("search for")
answer = ask_gpt3(que)
ask_gpt3(que)

elif (
Q == "email to other"
Expand All @@ -269,7 +269,7 @@ def get_app(Q):
with sr.Microphone() as source:
print("Listening...")
r.pause_threshold = 1
audio = r.listen(source)
r.listen(source)
to = "[email protected]"
content = input("Enter content")
sendEmail(to, content)
Expand Down Expand Up @@ -307,11 +307,11 @@ def get_app(Q):
elif Q == "take a break":
exit()
else:
answer = ask_gpt3(Q)
ask_gpt3(Q)

# master

apps = {
{
"time": datetime.datetime.now(),
"notepad": "Notepad.exe",
"calculator": "calc.exe",
Expand Down
2 changes: 1 addition & 1 deletion JARVIS/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ key
playsound
pyttsx3
SpeechRecognition
openai
openai
2 changes: 1 addition & 1 deletion Key_Binding/requirement.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
quo>=2022.4
quo >= 2022.4
2 changes: 1 addition & 1 deletion Letter_Counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def printt():
# Get the count and display results.
letter_count = message.count(letter)
a = "your message has " + str(letter_count) + " " + letter + "'s in it."
labl = tk.Label(root, text=a, font=("arial", 15), fg="black").place(x=10, y=220)
tk.Label(root, text=a, font=("arial", 15), fg="black").place(x=10, y=220)


lbl = tk.Label(root, text="Enter the Message--", font=("Ubuntu", 15), fg="black").place(
Expand Down
Loading