Fix a few more optional type errors.
This commit is contained in:
parent
38f0483cb5
commit
b1b8b67fe3
@ -313,7 +313,10 @@ class MachineData(BaseData):
|
||||
for owner in owners:
|
||||
sql = "INSERT INTO arcade_owner (userid, arcadeid) VALUES(:userid, :arcadeid)"
|
||||
self.execute(sql, {'userid': owner, 'arcadeid': arcadeid})
|
||||
return self.get_arcade(arcadeid)
|
||||
new_arcade = self.get_arcade(arcadeid)
|
||||
if new_arcade is None:
|
||||
raise Exception("Failed to create an arcade!")
|
||||
return new_arcade
|
||||
|
||||
def get_arcade(self, arcadeid: ArcadeID) -> Optional[Arcade]:
|
||||
"""
|
||||
|
@ -447,12 +447,11 @@ class MusicData(BaseData):
|
||||
"SELECT music.songid AS songid, COUNT(score_history.timestamp) AS plays FROM score_history, music " +
|
||||
"WHERE score_history.musicid = music.id AND music.game = :game AND music.version = :version "
|
||||
)
|
||||
timestamp: Optional[int] = None
|
||||
if days is not None:
|
||||
# Only select the last X days of hit chart
|
||||
sql = sql + "AND score_history.timestamp > :timestamp "
|
||||
timestamp = Time.now() - (Time.SECONDS_IN_DAY * days)
|
||||
else:
|
||||
timestamp = None
|
||||
|
||||
sql = sql + "GROUP BY songid ORDER BY plays DESC LIMIT :count"
|
||||
cursor = self.execute(sql, {'game': game, 'version': version, 'count': count, 'timestamp': timestamp})
|
||||
|
@ -788,7 +788,7 @@ class BinaryEncoding:
|
||||
else:
|
||||
return None
|
||||
|
||||
def encode(self, tree: Node, encoding: str=None) -> bytes:
|
||||
def encode(self, tree: Node, encoding: Optional[str]=None) -> bytes:
|
||||
"""
|
||||
Given a tree of Node objects, encode the data with the current encoding.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user