diff options
author | Waylan Limberg <waylan@gmail.com> | 2013-03-23 13:01:02 -0700 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2013-03-23 13:01:02 -0700 |
commit | 2f3442b41ae99dd79cd90179054d3d4ad13bc5f7 (patch) | |
tree | d2b4e8c5c0042213bd916c66ab7f06f1b642e84f | |
parent | 06d0e70438881497402d4798fd6e64aa92d6b532 (diff) | |
parent | c10dfac9909282b54a48be6261f76ba11d9da6d0 (diff) | |
download | markdown-2f3442b41ae99dd79cd90179054d3d4ad13bc5f7.tar.gz markdown-2f3442b41ae99dd79cd90179054d3d4ad13bc5f7.tar.bz2 markdown-2f3442b41ae99dd79cd90179054d3d4ad13bc5f7.zip |
Merge pull request #207 from mitya57/cleanup
Some minor code cleanups
-rw-r--r-- | markdown/__init__.py | 1 | ||||
-rw-r--r-- | markdown/odict.py | 11 | ||||
-rwxr-xr-x | run-tests.py | 2 | ||||
-rw-r--r-- | tests/test_apis.py | 1 |
4 files changed, 4 insertions, 11 deletions
diff --git a/markdown/__init__.py b/markdown/__init__.py index 1dbaddd..3fd5efa 100644 --- a/markdown/__init__.py +++ b/markdown/__init__.py @@ -33,7 +33,6 @@ License: BSD (see LICENSE for details). from __future__ import absolute_import from __future__ import unicode_literals from .__version__ import version, version_info -import re import codecs import sys import logging diff --git a/markdown/odict.py b/markdown/odict.py index 8089ece..68c1259 100644 --- a/markdown/odict.py +++ b/markdown/odict.py @@ -4,11 +4,6 @@ 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. @@ -106,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: @@ -138,7 +133,7 @@ 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() diff --git a/run-tests.py b/run-tests.py index 7756e4d..4f13eb5 100755 --- a/run-tests.py +++ b/run-tests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import tests -import os, sys, getopt +import os, sys if len(sys.argv) > 1 and sys.argv[1] == "update": if len(sys.argv) > 2: diff --git a/tests/test_apis.py b/tests/test_apis.py index e0f7a03..dd232b3 100644 --- a/tests/test_apis.py +++ b/tests/test_apis.py @@ -9,7 +9,6 @@ Tests of the various APIs with the python markdown lib. from __future__ import unicode_literals import unittest -import os import sys import types import markdown |