Fix some typos/wordings.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
Štěpán Němec 2009-08-16 23:17:05 +02:00 committed by James Vega
parent 2242b26025
commit a66034f852
16 changed files with 61 additions and 58 deletions

View File

@ -48,12 +48,12 @@ config.py code imports the four most useful functions from that module:
- acceptEmpty (optional): Defaults to False. Specifies whether or not - acceptEmpty (optional): Defaults to False. Specifies whether or not
to accept no input as an answer. to accept no input as an answer.
* "anything" is basically a special case of except which takes anything * "anything" is basically a special case of expect which takes anything
(including no input) and has no default value specified. It takes only (including no input) and has no default value specified. It takes only
one argument: one argument:
- prompt: The text to be displayed - prompt: The text to be displayed
* "something" is also a special case of except, requiring some input and * "something" is also a special case of expect, requiring some input and
allowing an optional default. It takes the following arguments: allowing an optional default. It takes the following arguments:
- prompt: The text to be displayed - prompt: The text to be displayed
- default (optional): Defaults to None. The default value to use if - default (optional): Defaults to None. The default value to use if
@ -63,7 +63,7 @@ config.py code imports the four most useful functions from that module:
a "y" for yes, or "n" for no. It takes the following arguments: a "y" for yes, or "n" for no. It takes the following arguments:
- prompt: The text to be displayed - prompt: The text to be displayed
- default (optional): Defaults to None. Default value to use if the - default (optional): Defaults to None. Default value to use if the
user doesn't put anything. user doesn't input anything.
All of these functions, with the exception of "yn", return whatever string All of these functions, with the exception of "yn", return whatever string
results as the answer whether it be input from the user or specified as the results as the answer whether it be input from the user or specified as the

View File

@ -146,16 +146,16 @@ would self.nick be set.
As for the rest of the method, you'll notice a few things that are available As for the rest of the method, you'll notice a few things that are available
to the plugin test author. self.prefix refers to the hostmask of the to the plugin test author. self.prefix refers to the hostmask of the
hypothetical test user which will be "talking" to the bot, issuing commands. hypothetical test user which will be "talking" to the bot, issuing commands.
We set it to some generically fake hostmask, and then we use feedMsg to feed We set it to some generically fake hostmask, and then we use feedMsg to send
it a private message (using the bot's nick, accessible via self.nick) to a private message (using the bot's nick, accessible via self.nick) to the bot
register the username "tester" with the password "moo". We have to do it this registering the username "tester" with the password "moo". We have to do it
way (rather than what you'll find out is the standard way of issuing commands this way (rather than what you'll find out is the standard way of issuing
to the bot in test cases a little later) because registration must be done in commands to the bot in test cases a little later) because registration must be
private. And lastly, since feedMsg doesn't dequeue any messages from the bot done in private. And lastly, since feedMsg doesn't dequeue any messages from
after getting fed a message, we perform a getMsg to get the response. You're the bot after being fed a message, we perform a getMsg to get the response.
not expected to know all this yet, but do take note of it since using these You're not expected to know all this yet, but do take note of it since using
methods in test-writing is not uncommon. These utility methods as well as all these methods in test-writing is not uncommon. These utility methods as well as
of the available assertions are covered in the next section. all of the available assertions are covered in the next section.
So, now in any of the test methods we write, we'll be able to count on the So, now in any of the test methods we write, we'll be able to count on the
fact that there will be a registered user "tester" with a password of "moo", fact that there will be a registered user "tester" with a password of "moo",

View File

@ -124,11 +124,11 @@ Customizing Wrap
Converters alone are a pretty powerful tool, but for even more advanced (yet Converters alone are a pretty powerful tool, but for even more advanced (yet
simpler!) argument handling you may want to use contexts. Contexts describe how simpler!) argument handling you may want to use contexts. Contexts describe how
the converters are applied to the arguments, while the converters themselves the converters are applied to the arguments, while the converters themselves
actually do the actual parsing and validation. do the actual parsing and validation.
For example, one of the contexts is "optional". By using this context, you're For example, one of the contexts is "optional". By using this context, you're
saying that a given argument is not required, and if the supplied converter saying that a given argument is not required, and if the supplied converter
doesn't find something it likes, we should use some default. Yet another doesn't find anything it likes, we should use some default. Yet another
example is the "reverse" context. This context tells the supplied converter to example is the "reverse" context. This context tells the supplied converter to
look at the last argument and work backwards instead of the normal look at the last argument and work backwards instead of the normal
first-to-last way of looking at arguments. first-to-last way of looking at arguments.
@ -139,14 +139,16 @@ will work as-is. However, contexts let you do some very powerful things in very
easy ways, and are a good thing to know how to use. easy ways, and are a good thing to know how to use.
Now, how do you use them? Well, they are in the global namespace of Now, how do you use them? Well, they are in the global namespace of
src/commands.py, so your previous import line will import them all, so you can src/commands.py, so your previous import line will import them all; you can
call them just as you call wrap. In fact, the way you use them is you simply call them just as you call wrap. In fact, the way you use them is you simply
call the context function you want to use, passing in the converter and its call the context function you want to use, with the converter (and its
arguments in as arguments. It's quite simple. Here's an example: arguments) as arguments. It's quite simple. Here's an example:
commandname = wrap(commandname, [optional('int'), many('something')]) commandname = wrap(commandname, [optional('int'), many('something')])
In this example, our command is looking for an optional integer argument first. Then, after that, any number of arguments which can be anything (as long as they are something, of course). In this example, our command is looking for an optional integer argument first.
Then, after that, any number of arguments which can be anything (as long as
they are something, of course).
Do note, however, that the type of the arguments that are returned can be Do note, however, that the type of the arguments that are returned can be
changed if you apply a context to it. So, optional("int") may very well return changed if you apply a context to it. So, optional("int") may very well return
@ -176,9 +178,9 @@ optional, the default value is shown.
"int", type="integer", p=None "int", type="integer", p=None
Gets an integer. The "type" text can be used to customize the error message Gets an integer. The "type" text can be used to customize the error message
received when the argument is not an integer. p is an optional predicate to received when the argument is not an integer. "p" is an optional predicate
test the integer with. If p(i) fails (where i is the integer arg parsed out to test the integer with. If p(i) fails (where i is the integer arg parsed
of the argument string), the arg will not be accepted. out of the argument string), the arg will not be accepted.
"index" "index"
Basically ("int", "index"), but with a twist. This will take a 1-based Basically ("int", "index"), but with a twist. This will take a 1-based
@ -222,7 +224,7 @@ optional, the default value is shown.
"letter" "letter"
Looks for a single letter. (Technically, it looks for any one-element Looks for a single letter. (Technically, it looks for any one-element
sequence) sequence).
"haveOp", action="do that" "haveOp", action="do that"
Simply requires that the bot have ops in the channel that the command is Simply requires that the bot have ops in the channel that the command is
@ -251,7 +253,7 @@ optional, the default value is shown.
"seenNick" "seenNick"
Checks that the arg is a nick that the bot has seen (NOTE: this is limited Checks that the arg is a nick that the bot has seen (NOTE: this is limited
by the size of the history buffer that the bot has) by the size of the history buffer that the bot has).
"channel" "channel"
Gets a channel to use the command in. If the channel isn't supplied, uses Gets a channel to use the command in. If the channel isn't supplied, uses

View File

@ -67,8 +67,9 @@ def getCapability(name):
while parts: while parts:
part = parts.pop() part = parts.pop()
if ircutils.isChannel(part): if ircutils.isChannel(part):
# If a registry value has a channel in it, it requires a channel.op # If a registry value has a channel in it, it requires a
# capability, or so we assume. We'll see if we're proven wrong. # 'channel,op' capability, or so we assume. We'll see if we're
# proven wrong.
capability = ircdb.makeChannelCapability(part, 'op') capability = ircdb.makeChannelCapability(part, 'op')
### Do more later, for specific capabilities/sections. ### Do more later, for specific capabilities/sections.
return capability return capability

View File

@ -38,9 +38,9 @@ import supybot.callbacks as callbacks
class Plugin(callbacks.Plugin): class Plugin(callbacks.Plugin):
"""This plugin exists to help users manage their plugins. Use 'plugin """This plugin exists to help users manage their plugins. Use 'plugin
list' to list the loaded plugins; use 'plugin help' to get this sort of list' to list the loaded plugins; use 'plugin help' to get the description
help from other plugins; use the 'plugin' command itself to determine what of a plugin; use the 'plugin' command itself to determine what plugin a
plugin a command exists in.""" command exists in."""
def help(self, irc, msg, args, cb): def help(self, irc, msg, args, cb):
"""<plugin> """<plugin>

View File

@ -126,7 +126,7 @@ class String(callbacks.Plugin):
If <regexp> is of the form m/regexp/flags, returns the portion of If <regexp> is of the form m/regexp/flags, returns the portion of
<text> that matches the regexp. If <regexp> is of the form <text> that matches the regexp. If <regexp> is of the form
s/regexp/replacement/flags, returns the result of applying such a s/regexp/replacement/flags, returns the result of applying such a
regexp to <text> regexp to <text>.
""" """
if isinstance(ff, (types.FunctionType, types.MethodType)): if isinstance(ff, (types.FunctionType, types.MethodType)):
f = ff f = ff

View File

@ -40,10 +40,10 @@ def configure(advanced):
URL = conf.registerPlugin('URL') URL = conf.registerPlugin('URL')
conf.registerChannelValue(URL, 'nonSnarfingRegexp', conf.registerChannelValue(URL, 'nonSnarfingRegexp',
registry.Regexp(None, """Determines what URLs are to be snarfed and stored registry.Regexp(None, """Determines what URLs are not to be snarfed and
in the database in the channel; URLs matching the regexp given will not be stored in the database for the channel; URLs matching the given regexp will
snarfed. Give the empty string if you have no URLs that you'd like to not be snarfed. Give the empty string if you have no URLs that you'd like
exclude from being snarfed.""")) to exclude from being snarfed."""))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -129,7 +129,7 @@ version = '0.83.4.1+git'
if __name__ == '__main__': if __name__ == '__main__':
### ###
# Options: # Options:
# -p (profiling) # -P (profiling)
# -n, --nick (nick) # -n, --nick (nick)
# --startup (commands to run onStart) # --startup (commands to run onStart)
# --connect (commands to run afterConnect) # --connect (commands to run afterConnect)
@ -177,12 +177,12 @@ if __name__ == '__main__':
sys.exit(-1) sys.exit(-1)
if len(args) > 1: if len(args) > 1:
parser.error("""Only one configuration option should be specified.""") parser.error("""Only one configuration file should be specified.""")
elif not args: elif not args:
parser.error(utils.str.normalizeWhitespace("""It seems you've given me parser.error(utils.str.normalizeWhitespace("""It seems you've given me
no configuration file. If you have a configuration file, be sure to no configuration file. If you do have a configuration file, be sure to
tell its filename. If you don't have a configuration file, read specify the filename. If you don't have a configuration file, read
docs/GETTING_STARTED and follow its directions.""")) docs/GETTING_STARTED and follow the instructions."""))
else: else:
registryFilename = args.pop() registryFilename = args.pop()
try: try:

View File

@ -251,7 +251,7 @@ class ArgumentError(Error):
class Tokenizer(object): class Tokenizer(object):
# This will be used as a global environment to evaluate strings in. # This will be used as a global environment to evaluate strings in.
# Evaluation is, of course, necessary in order to allowed escaped # Evaluation is, of course, necessary in order to allow escaped
# characters to be properly handled. # characters to be properly handled.
# #
# These are the characters valid in a token. Everything printable except # These are the characters valid in a token. Everything printable except
@ -332,7 +332,7 @@ class Tokenizer(object):
if not args: if not args:
raise SyntaxError, '"|" with nothing following. I ' \ raise SyntaxError, '"|" with nothing following. I ' \
'obviously can\'t do a pipe with ' \ 'obviously can\'t do a pipe with ' \
'nothing before the |.' 'nothing after the |.'
args.append(ends.pop()) args.append(ends.pop())
while ends: while ends:
args[-1].append(ends.pop()) args[-1].append(ends.pop())

View File

@ -47,10 +47,10 @@ from utils.structures import queue, smallqueue, RingBuffer
### ###
# The base class for a callback to be registered with an Irc object. Shows # The base class for a callback to be registered with an Irc object. Shows
# the required interface for callbacks -- name(), # the required interface for callbacks -- name(),
# inFilter(irc, msg), outFilter(irc, msg), and __call__(irc, msg) [used so # inFilter(irc, msg), outFilter(irc, msg), and __call__(irc, msg) [used so as
# functions can be used as callbacks conceivable, and so if refactoring ever # to make functions used as callbacks conceivable, and so if refactoring ever
# changes the nature of the callbacks from classes to functions, syntactical # changes the nature of the callbacks from classes to functions, syntactical
# changes elsewhere won't be required. # changes elsewhere won't be required.]
### ###
class IrcCommandDispatcher(object): class IrcCommandDispatcher(object):
@ -153,7 +153,7 @@ class IrcMsgQueue(object):
maintain a priority queue of the messages would be the ideal way to do maintain a priority queue of the messages would be the ideal way to do
intelligent queuing. intelligent queuing.
As it stands, however, we simple keep track of 'high priority' messages, As it stands, however, we simply keep track of 'high priority' messages,
'low priority' messages, and normal messages, and just make sure to return 'low priority' messages, and normal messages, and just make sure to return
the 'high priority' ones before the normal ones before the 'low priority' the 'high priority' ones before the normal ones before the 'low priority'
ones. ones.

View File

@ -61,7 +61,7 @@ class IrcMsg(object):
any of three major (sets of) arguments. any of three major (sets of) arguments.
Called with no keyword arguments, it takes a single string that is a raw Called with no keyword arguments, it takes a single string that is a raw
IRC message (such as one taken straight from the network. IRC message (such as one taken straight from the network).
Called with keyword arguments, it *requires* a command parameter. Args is Called with keyword arguments, it *requires* a command parameter. Args is
optional, but with most commands will be necessary. Prefix is obviously optional, but with most commands will be necessary. Prefix is obviously

View File

@ -28,10 +28,10 @@
### ###
""" """
Provides a great number of useful utility functions IRC. Things to muck around Provides a great number of useful utility functions for IRC. Things to muck
with hostmasks, set bold or color on strings, IRC-case-insensitive dicts, a around with hostmasks, set bold or color on strings, IRC-case-insensitive
nick class to handle nicks (so comparisons and hashing and whatnot work in an dicts, a nick class to handle nicks (so comparisons and hashing and whatnot
IRC-case-insensitive fashion), and numerous other things. work in an IRC-case-insensitive fashion), and numerous other things.
""" """
import re import re
@ -461,9 +461,9 @@ def replyTo(msg):
return msg.nick return msg.nick
def dccIP(ip): def dccIP(ip):
"""Returns in IP in the proper for DCC.""" """Converts an IP string to the DCC integer form."""
assert utils.net.isIP(ip), \ assert utils.net.isIP(ip), \
'argument must be a string ip in xxx.yyy.zzz.www format.' 'argument must be a string ip in xxx.xxx.xxx.xxx format.'
i = 0 i = 0
x = 256**3 x = 256**3
for quad in ip.split('.'): for quad in ip.split('.'):

View File

@ -47,7 +47,7 @@ import supybot.ircutils as ircutils
deadlyExceptions = [KeyboardInterrupt, SystemExit] deadlyExceptions = [KeyboardInterrupt, SystemExit]
### ###
# This is for testing, of course. Mostly is just disables the firewall code # This is for testing, of course. Mostly it just disables the firewall code
# so exceptions can propagate. # so exceptions can propagate.
### ###
testing = False testing = False

View File

@ -72,9 +72,9 @@ def abbrev(strings, d=None):
def timeElapsed(elapsed, short=False, leadingZeroes=False, years=True, def timeElapsed(elapsed, short=False, leadingZeroes=False, years=True,
weeks=True, days=True, hours=True, minutes=True, seconds=True): weeks=True, days=True, hours=True, minutes=True, seconds=True):
"""Given <elapsed> seconds, returns a string with an English description of """Given <elapsed> seconds, returns a string with an English description of
how much time as passed. leadingZeroes determines whether 0 days, 0 hours, the amount of time passed. leadingZeroes determines whether 0 days, 0
etc. will be printed; the others determine what larger time periods should hours, etc. will be printed; the others determine what larger time periods
be used. should be used.
""" """
ret = [] ret = []
before = False before = False