A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

28 lignes
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