196 self.cursor.execute("SHOW TABLES LIKE %s", (table_name,))
197 return bool(self.cursor.fetchone())
198
199 def _get_existing_columns(self, table_name):200 """
201 Gets the existing columns of a table in the connected database.
202
196 self.cursor.execute("SHOW TABLES LIKE %s", (table_name,))
197 return bool(self.cursor.fetchone())
198
199 def _get_existing_columns(self, table_name):200 """
201 Gets the existing columns of a table in the connected database.
202
65 draw.text((x + x_pad, y + y_pad - 4), text_str, font=font, fill=color)
66 return rect_w
67
68 def format_number(num: float) -> str: 69 """
70 Format a number with a suffix for thousands, millions, billions, etc.
71 Args:
289 def deserialize(cls, data):
290 return cls(None, data["color"], data["difficulty"])
291
292 def choose_move(self):293 """
294 Choose a move based on the difficulty level.
295
121 )
122 return overlay
123
124 def format_number(num: float) -> str:125 if num < 1000:
126 return str(num)
127 for unit in ["", "k", "M", "B", "T"]:
According to PEP8, if any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None
, and an explicit return statement should be present at the end of the function (if reachable).
Good:
def foo(x):
if x >= 0:
return math.sqrt(x)
else:
return None
def bar(x):
if x < 0:
return None
return math.sqrt(x)
Bad:
def foo(x):
if x >= 0:
return math.sqrt(x)
def bar(x):
if x < 0:
return
return math.sqrt(x)