mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 02:24:12 +01:00
Finish switching from "foo in db" to "db.has_key(foo)"
This commit is contained in:
parent
c6bec174c4
commit
1fcc709ae8
@ -118,7 +118,7 @@ class DbmMarkovDB(object):
|
||||
else:
|
||||
db[combined] = follower
|
||||
if follower == '\n':
|
||||
if '\n' in db:
|
||||
if db.has_key('\n'):
|
||||
db['\n'] = ' '.join([db['\n'], second])
|
||||
else:
|
||||
db['\n'] = second
|
||||
@ -146,14 +146,14 @@ class DbmMarkovDB(object):
|
||||
|
||||
def firsts(self, channel):
|
||||
db = self._getDb(channel)
|
||||
if '\n \n' in db:
|
||||
if db.has_key('\n \n'):
|
||||
return len(sets.Set(db['\n \n'].split()))
|
||||
else:
|
||||
return 0
|
||||
|
||||
def lasts(self, channel):
|
||||
db = self._getDb(channel)
|
||||
if '\n' in db:
|
||||
if db.has_key('\n'):
|
||||
return len(sets.Set(db['\n'].split()))
|
||||
else:
|
||||
return 0
|
||||
|
Loading…
Reference in New Issue
Block a user