Skip to content

Commit 40fc01e

Browse files
committed
Fixed some ruff errors but not all
1 parent 97e8791 commit 40fc01e

File tree

89 files changed

+439
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+439
-286
lines changed

1 File handle/File handle binary/question 1 (elegible for remedial, top marks).py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
student_record = os.getenv("STUDENTS_RECORD_FILE")
2121

2222
import pickle
23-
import logging
2423

2524
# Define logger with info
2625
# import polar

1 File handle/File handle binary/search record in binary file.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# binary file to search a given record
22

33
import pickle
4-
from dotenv import load_dotenv
54

65

76
def search():

Automated Scheduled Call Reminders/caller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def search():
4040
for doc in list_of_docs:
4141
if doc["from"][0:5] == five_minutes_prior:
4242
phone_number = doc["phone"]
43-
call = client.calls.create(
43+
client.calls.create(
4444
to=phone_number,
4545
from_="add your twilio number",
4646
url="http://demo.twilio.com/docs/voice.xml",

Binary_to_Decimal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def binaryToDecimal(binary):
1010
>>> binaryToDecimal(101011)
1111
43
1212
"""
13-
decimal, i, n = 0, 0, 0
13+
decimal, i, _n = 0, 0, 0
1414
while binary != 0:
1515
dec = binary % 10
1616
decimal = decimal + dec * pow(2, i)

BoardGame-CLI/snakeLadder.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def play():
5959
print(f"you got {temp1}")
6060
print("")
6161

62-
if isReady[i] == False and temp1 == 6:
62+
if not isReady[i] and temp1 == 6:
6363
isReady[i] = True
6464

6565
if isReady[i]:
@@ -90,7 +90,6 @@ def play():
9090
elif n == 2:
9191
players = {} # stores player ans their locations
9292
isReady = {}
93-
current_loc = 1 # reset starting location to 1
9493
player_input()
9594

9695
elif n == 3:

CRC/crc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
def crc_check(data, div):
22
l = len(div)
3-
ct = 0
43
data = [int(i) for i in data]
54
div = [int(i) for i in div]
65
zero = [0 for i in range(l)]

Checker_game_by_dz/first.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_row_col_mouse(pos):
4141
while run:
4242
clock.tick(fps)
4343

44-
if board.winner() != None:
44+
if board.winner() is not None:
4545
print(board.winner())
4646

4747
# check if any events is running or not

Colors/pixel_sort.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,19 @@ def main():
135135
) # setting the threshold value for every row in the frame
136136

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

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

150-
if np.any(np.asarray(i)) == True and sum(i) < thresh:
150+
if np.any(np.asarray(i)) and sum(i) < thresh:
151151
color_n.append(i)
152152

153153
color_n.sort(key=lambda bgr: step(bgr, 8)) # step sorting

Downloaded Files Organizer/obs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def watcher(path):
99
class Handler(FileSystemEventHandler):
1010
def on_created(self, event):
1111
if event.event_type == "created":
12-
file_name = os.path.basename(event.src_path)
12+
os.path.basename(event.src_path)
1313
ext = os.path.splitext(event.src_path)[1]
1414
time.sleep(2)
1515
add_to_dir(ext[1:], event.src_path, path)

EncryptionTool.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ def decrypt(enc_text):
4848
def readAndDecrypt(filename):
4949
file = open(filename, "r")
5050
data = file.read()
51-
datalistint = []
5251
actualdata = []
5352
datalist = data.split(" ")
5453
datalist.remove("")
55-
datalistint = [float(data) for data in datalist]
54+
[float(data) for data in datalist]
5655
for data in datalist:
5756
current1 = int(decryptChar(data))
5857
current1 = chr(current1)
@@ -66,7 +65,6 @@ def readAndEncrypt(filename):
6665
data = file.read()
6766
datalist = list(data)
6867
encrypted_list = list()
69-
encrypted_list_str = list()
7068
for data in datalist:
7169
current = ord(data)
7270
current = encryptChar(current)

0 commit comments

Comments
 (0)