A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

69 rader
2.4 KiB

  1. # Copyright (C) 2009-2019 Ben Kurtovic <ben.kurtovic@gmail.com>
  2. #
  3. # Permission is hereby granted, free of charge, to any person obtaining a copy
  4. # of this software and associated documentation files (the "Software"), to deal
  5. # in the Software without restriction, including without limitation the rights
  6. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. # copies of the Software, and to permit persons to whom the Software is
  8. # furnished to do so, subject to the following conditions:
  9. #
  10. # The above copyright notice and this permission notice shall be included in
  11. # all copies or substantial portions of the Software.
  12. #
  13. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  19. # SOFTWARE.
  20. """
  21. `EarwigBot <https://github.com/earwig/earwigbot>`_ is a Python robot that edits
  22. Wikipedia and interacts with people over IRC.
  23. See :file:`README.rst` for an overview, or the :file:`docs/` directory for
  24. details. This documentation is also available `online
  25. <https://packages.python.org/earwigbot>`_.
  26. """
  27. __author__ = "Ben Kurtovic"
  28. __copyright__ = "Copyright (C) 2009-2019 Ben Kurtovic"
  29. __license__ = "MIT License"
  30. __version__ = "0.4.dev0"
  31. __email__ = "ben.kurtovic@gmail.com"
  32. __release__ = False
  33. if not __release__:
  34. def _get_git_commit_id():
  35. """Return the ID of the git HEAD commit."""
  36. from os.path import dirname, split
  37. from git import Repo
  38. path = split(dirname(__file__))[0]
  39. commit_id = Repo(path).head.object.hexsha
  40. return commit_id[:8]
  41. try:
  42. __version__ += "+" + _get_git_commit_id()
  43. except Exception:
  44. pass
  45. finally:
  46. del _get_git_commit_id
  47. from earwigbot import lazy
  48. importer = lazy.LazyImporter()
  49. bot = importer.new("earwigbot.bot")
  50. commands = importer.new("earwigbot.commands")
  51. config = importer.new("earwigbot.config")
  52. exceptions = importer.new("earwigbot.exceptions")
  53. irc = importer.new("earwigbot.irc")
  54. managers = importer.new("earwigbot.managers")
  55. tasks = importer.new("earwigbot.tasks")
  56. util = importer.new("earwigbot.util")
  57. wiki = importer.new("earwigbot.wiki")