mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +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:
|
else:
|
||||||
db[combined] = follower
|
db[combined] = follower
|
||||||
if follower == '\n':
|
if follower == '\n':
|
||||||
if '\n' in db:
|
if db.has_key('\n'):
|
||||||
db['\n'] = ' '.join([db['\n'], second])
|
db['\n'] = ' '.join([db['\n'], second])
|
||||||
else:
|
else:
|
||||||
db['\n'] = second
|
db['\n'] = second
|
||||||
@ -146,14 +146,14 @@ class DbmMarkovDB(object):
|
|||||||
|
|
||||||
def firsts(self, channel):
|
def firsts(self, channel):
|
||||||
db = self._getDb(channel)
|
db = self._getDb(channel)
|
||||||
if '\n \n' in db:
|
if db.has_key('\n \n'):
|
||||||
return len(sets.Set(db['\n \n'].split()))
|
return len(sets.Set(db['\n \n'].split()))
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def lasts(self, channel):
|
def lasts(self, channel):
|
||||||
db = self._getDb(channel)
|
db = self._getDb(channel)
|
||||||
if '\n' in db:
|
if db.has_key('\n'):
|
||||||
return len(sets.Set(db['\n'].split()))
|
return len(sets.Set(db['\n'].split()))
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user