A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

28 linhas
875 B

  1. # -*- coding: utf-8 -*-
  2. class BaseTask(object):
  3. """A base class for bot tasks that edit Wikipedia."""
  4. name = None
  5. def __init__(self):
  6. """Constructor for new tasks.
  7. This is called once immediately after the task class is loaded by
  8. the task manager (in tasks._load_task()).
  9. """
  10. pass
  11. def run(self, **kwargs):
  12. """Main entry point to run a given task.
  13. This is called directly by tasks.start() and is the main way to make a
  14. task do stuff. kwargs will be any keyword arguments passed to start()
  15. which are entirely optional.
  16. The same task instance is preserved between runs, so you can
  17. theoretically store data in self (e.g.
  18. start('mytask', action='store', data='foo')) and then use it later
  19. (e.g. start('mytask', action='save')).
  20. """
  21. pass