Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: third_party/Python-Markdown/markdown/odict.py

Issue 1356203004: Check in a simple pure-python based Markdown previewer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add
Patch Set: fix license file Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/Python-Markdown/markdown/odict.py
diff --git a/third_party/markdown/odict.py b/third_party/Python-Markdown/markdown/odict.py
similarity index 73%
copy from third_party/markdown/odict.py
copy to third_party/Python-Markdown/markdown/odict.py
index 1bfca51d3cb136960d65f037240e94b83e381500..584ad7c173f45cba6a41dc491d9a3f0a4bd0ae04 100644
--- a/third_party/markdown/odict.py
+++ b/third_party/Python-Markdown/markdown/odict.py
@@ -1,50 +1,13 @@
-# markdown is released under the BSD license
-# Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later)
-# Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
-# Copyright 2004 Manfred Stienstra (the original version)
-#
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# * Neither the name of the <organization> nor the
-# names of its contributors may be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE PYTHON MARKDOWN PROJECT ''AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL ANY CONTRIBUTORS TO THE PYTHON MARKDOWN PROJECT
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
from __future__ import unicode_literals
from __future__ import absolute_import
from . import util
-
from copy import deepcopy
-def iteritems_compat(d):
- """Return an iterator over the (key, value) pairs of a dictionary.
- Copied from `six` module."""
- return iter(getattr(d, _iteritems)())
class OrderedDict(dict):
"""
A dictionary that keeps its keys in the order in which they're inserted.
-
+
Copied from Django's SortedDict with some modifications.
"""
@@ -119,11 +82,11 @@ class OrderedDict(dict):
for key in self.keyOrder:
yield self[key]
- if util.PY3:
+ if util.PY3: # pragma: no cover
items = _iteritems
keys = _iterkeys
values = _itervalues
- else:
+ else: # pragma: no cover
iteritems = _iteritems
iterkeys = _iterkeys
itervalues = _itervalues
@@ -138,8 +101,8 @@ class OrderedDict(dict):
return [self[k] for k in self.keyOrder]
def update(self, dict_):
- for k, v in iteritems_compat(dict_):
- self[k] = v
+ for k in dict_:
+ self[k] = dict_[k]
def setdefault(self, key, default):
if key not in self:
@@ -170,7 +133,9 @@ class OrderedDict(dict):
Replaces the normal dict.__repr__ with a version that returns the keys
in their Ordered order.
"""
- return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in iteritems_compat(self)])
+ return '{%s}' % ', '.join(
+ ['%r: %r' % (k, v) for k, v in self._iteritems()]
+ )
def clear(self):
super(OrderedDict, self).clear()
« no previous file with comments | « third_party/Python-Markdown/markdown/inlinepatterns.py ('k') | third_party/Python-Markdown/markdown/postprocessors.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698