Skip to content

remove import new from cbook.py #1642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
removed the import new in favor of import types for all versions.
types is supported from 2.2 and new is deprecated as of 2.6.

This is the only place `import new` appears in the code.
  • Loading branch information
Thomas A Caswell committed Jan 4, 2013
commit c71084d1d6777cabc518d0e728563ce868cd957a
14 changes: 6 additions & 8 deletions lib/matplotlib/cbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
import numpy.ma as ma


if sys.version_info[0] >= 3:
import types
else:
import new

import types


# On some systems, locale.getpreferredencoding returns None,
# which can break unicode; and the sage project reports that
Expand Down Expand Up @@ -209,10 +208,9 @@ def __call__(self, *args, **kwargs):
elif self.inst is not None:
# build a new instance method with a strong reference to the
# instance
if sys.version_info[0] >= 3:
mtd = types.MethodType(self.func, self.inst())
else:
mtd = new.instancemethod(self.func, self.inst(), self.klass)

mtd = types.MethodType(self.func, self.inst())

else:
# not a bound method, just return the func
mtd = self.func
Expand Down