mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Some documenation updates
This commit is contained in:
parent
a4cf067117
commit
2b7e8c7a2f
@ -15,9 +15,8 @@ class hierarchy. irclib.IrcCallback does a lot of the basic stuff that call-
|
||||
backs have to do, and inheriting from it relieves the programmer from such
|
||||
pedantries. All you have to do to start writing callbacks inheriting from
|
||||
irclib.IrcCallback is write functions of the form "doCommand", where "Command"
|
||||
is a valid ircCommand. The "ChannelJoiner" function in the callbacks module
|
||||
is a good illustrative example of a callback being called on different
|
||||
commands.
|
||||
is a valid ircCommand. The "ChannelLogger" plugin is a good illustrative
|
||||
example of a callback being called on different commands.
|
||||
|
||||
The "irc" argument there is the irc object that is calling the callback. To
|
||||
see what kind of interface it provides, read the class definition in irclib.
|
||||
|
@ -30,9 +30,8 @@ privmsgs.py: The privmsg commands that are included by default in the bot.
|
||||
It's probably most useful from a programming standpoint simply so
|
||||
a new programmer can see what commands look like.
|
||||
|
||||
callbacks.py: A few basic callbacks used by default in the bot. You'll likely
|
||||
be inheriting from Privmsg quite a bit, and using the reply
|
||||
function a bit as well.
|
||||
callbacks.py: A few basic callbacks providing significant functionality.
|
||||
You'll likely be inheriting from Privmsg quite a bit.
|
||||
|
||||
ircdb.py: The users and channels databases are here, as well as the
|
||||
IrcUser and IrcChannel classes. Look here when you want to
|
||||
|
39
docs/STYLE
39
docs/STYLE
@ -1,13 +1,14 @@
|
||||
Maximum line length is 79 characters.
|
||||
Read PEP 8 (Guido's Style Guide) and know that we use almost all the same style
|
||||
guidelines.
|
||||
|
||||
Maximum line length is 79 characters. 78 is a safer bet, though.
|
||||
|
||||
Identation is 4 spaces per level. No tabs.
|
||||
|
||||
Single quotes are used for all string literals that aren't docstrings.
|
||||
They're just easier to type.
|
||||
|
||||
Triple double quotes (""") are always used for docstrings, except for the
|
||||
docstrings on callbacks deriving from callbacks.Privmsg, which use just
|
||||
double quotes (").
|
||||
Triple double quotes (""") are always used for docstrings.
|
||||
|
||||
Spaces go around all operators (except around '=' in default arguments to
|
||||
functions) and after all commas (unless doing so keeps a line within the 79
|
||||
@ -16,7 +17,8 @@ character limit).
|
||||
Class names are StudlyCaps. Method and function names are camelCaps
|
||||
(StudlyCaps with an initial lowercase letter). If variable and attribute
|
||||
names can maintain readability without being camelCaps, then they should be
|
||||
entirely in lowercase, otherwise they should also use camelCaps.
|
||||
entirely in lowercase, otherwise they should also use camelCaps. Plugin names
|
||||
are StudlyCaps.
|
||||
|
||||
Imports should always happen at the top of the module, one import per line
|
||||
(so if imports need to be added or removed later, it can be done easily).
|
||||
@ -26,7 +28,28 @@ class definition. Two blank lines should be between all consecutive class
|
||||
definitions in a file. Comments are even better than blank lines for
|
||||
separating classes.
|
||||
|
||||
Code should pass PyChecker with no warnings.
|
||||
Code should pass PyChecker with no warnings. The PyChecker config file is
|
||||
included in the tools/ subdirectory.
|
||||
|
||||
Read PEP 8 (Guido's Style Guide) and know that we use almost all the same style
|
||||
guidelines.
|
||||
Database filenames should generally begin with the name of the plugin and the
|
||||
extension should be 'db'. baseplugin.DBHandler does this already.
|
||||
|
||||
Whenever creating a file descriptor or socket, keep a reference around and be
|
||||
sure to close it. There should be no code like this:
|
||||
s = urllib2.urlopen('url').read()
|
||||
Instead, do this:
|
||||
fd = urllib2.urlopen('url')
|
||||
s = fd.read()
|
||||
fd.close()
|
||||
This is to be sure the bot doesn't leak file descriptors.
|
||||
|
||||
All plugins should include a docstring decsribing what the plugin does. After
|
||||
the decsription, the plugin should have a blank line followed by the line
|
||||
'Commands include:' followed by a list of commands, one per line, indented two
|
||||
spaces. The setup script will depend on this format.
|
||||
|
||||
Method docstrings in classes deriving from callbacks.Privmsg should include an
|
||||
argument list as their first line, and (if necessary) a blank line followed by
|
||||
a longer description of what the command does. The argument list is used by
|
||||
the 'help' command, and the longer description is used by the 'morehelp'
|
||||
command.
|
||||
|
Loading…
Reference in New Issue
Block a user