A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 

35 Zeilen
965 B

  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from earwigbot.wiki import NS_TEMPLATE
  4. __all__ = ["get_attribution_info"]
  5. ATTRIB_TEMPLATES = {
  6. "enwiki": {
  7. "CC-notice", "Cc-notice",
  8. "Citation-attribution",
  9. "Free-content attribution", "Open-source attribution",
  10. "Source-attribution",
  11. }
  12. }
  13. def get_attribution_info(site, page):
  14. """Check to see if the given page has some kind of attribution info.
  15. If yes, return a mwparserfromhell.nodes.Template object for the attribution
  16. template. If no, return None.
  17. """
  18. if site.name not in ATTRIB_TEMPLATES:
  19. return None
  20. templates = ATTRIB_TEMPLATES[site.name]
  21. prefix = site.namespace_id_to_name(NS_TEMPLATE)
  22. templates |= {prefix + ":" + tmpl for tmpl in templates if ":" not in tmpl}
  23. for template in page.parse().ifilter_templates():
  24. if template.name.matches(templates):
  25. return template
  26. return None