A Python parser for MediaWiki wikicode https://mwparserfromhell.readthedocs.io/
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

37 строки
950 B

  1. # -*- coding: utf-8 -*-
  2. """
  3. Implements support for both Python 2 and Python 3 by defining common types in
  4. terms of their Python 2/3 variants. For example, :py:class:`str` is set to
  5. :py:class:`unicode` on Python 2 but :py:class:`str` on Python 3; likewise,
  6. :py:class:`bytes` is :py:class:`str` on 2 but :py:class:`bytes` on 3. These
  7. types are meant to be imported directly from within the parser's modules.
  8. """
  9. import sys
  10. py3k = sys.version_info[0] == 3
  11. if py3k:
  12. bytes = bytes
  13. str = str
  14. basestring = str
  15. range = range
  16. maxsize = sys.maxsize
  17. import html.entities as htmlentities
  18. from io import StringIO
  19. from urllib.parse import urlencode
  20. from urllib.request import urlopen
  21. else:
  22. bytes = str
  23. str = unicode
  24. basestring = basestring
  25. range = xrange
  26. maxsize = sys.maxint
  27. import htmlentitydefs as htmlentities
  28. from StringIO import StringIO
  29. from urllib import urlencode, urlopen
  30. del sys