mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Changed random.sample(seq, 1)[0] to random.choice. Completely forgot the name of the choice function.
This commit is contained in:
parent
b497acbc43
commit
644fd692fa
@ -125,9 +125,9 @@ class Babelfish(callbacks.Privmsg):
|
||||
is provided, will include English in the list of possible languages.
|
||||
"""
|
||||
allowEnglish = privmsgs.getArgs(args, needed=0, optional=1)
|
||||
language = random.sample(babelfish.available_languages, 1)[0]
|
||||
language = random.choice(babelfish.available_languages)
|
||||
while not allowEnglish and language == 'English':
|
||||
language = random.sample(babelfish.available_languages, 1)[0]
|
||||
language = random.choice(babelfish.available_languages, 1)
|
||||
irc.reply(msg, language)
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ class Dict(callbacks.Privmsg):
|
||||
|
||||
Returns a random valid dictionary.
|
||||
"""
|
||||
irc.reply(msg, random.sample(list(self.dictdbs), 1)[0])
|
||||
irc.reply(msg, random.choice(list(self.dictdbs)))
|
||||
|
||||
def dict(self, irc, msg, args):
|
||||
"""[<dictionary>] <word>
|
||||
|
@ -45,15 +45,11 @@ import new
|
||||
import md5
|
||||
import sha
|
||||
import time
|
||||
import math
|
||||
import cmath
|
||||
import getopt
|
||||
import socket
|
||||
import string
|
||||
import random
|
||||
import urllib
|
||||
import inspect
|
||||
import textwrap
|
||||
import telnetlib
|
||||
import threading
|
||||
import mimetypes
|
||||
@ -599,7 +595,7 @@ class FunCommands(callbacks.Privmsg):
|
||||
|
||||
Asks the magic eightball a question.
|
||||
"""
|
||||
irc.reply(msg, random.sample(self._eightballs, 1)[0])
|
||||
irc.reply(msg, random.choice(self._eightballs))
|
||||
|
||||
|
||||
_these = [str(s) for s in this.s.decode('rot13').splitlines() if s]
|
||||
@ -609,7 +605,7 @@ class FunCommands(callbacks.Privmsg):
|
||||
|
||||
Returns one of the zen of Python statements.
|
||||
"""
|
||||
irc.reply(msg, random.sample(self._these, 1)[0])
|
||||
irc.reply(msg, random.choice(self._these))
|
||||
|
||||
def dns(self, irc, msg, args):
|
||||
"""<host|ip>
|
||||
|
Loading…
Reference in New Issue
Block a user