| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b0d9ae4 commit e3e9061
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,31 +25,20 @@ | |||
| 25 | 25 | # | |
| 26 | 26 | ||
| 27 | 27 | from __future__ import with_statement | |
| 28 | - import collections | ||
| 29 | 28 | import inspect | |
| 30 | 29 | import io | |
| 31 | 30 | import keyword | |
| 32 | 31 | import pydoc | |
| 33 | - import types | ||
| 34 | 32 | from six.moves import range | |
| 35 | 33 | ||
| 36 | 34 | from pygments.token import Token | |
| 37 | 35 | ||
| 38 | 36 | from bpython._py3compat import PythonLexer, py3 | |
| 39 | 37 | from bpython.lazyre import LazyReCompile | |
| 40 | 38 | ||
| 41 | - try: | ||
| 42 | - collections.Callable | ||
| 43 | - has_collections_callable = True | ||
| 44 | - except AttributeError: | ||
| 45 | - has_collections_callable = False | ||
| 46 | - try: | ||
| 47 | - types.InstanceType | ||
| 48 | - has_instance_type = True | ||
| 49 | - except AttributeError: | ||
| 50 | - has_instance_type = False | ||
| 51 | - | ||
| 52 | 39 | if not py3: | |
| 40 | + import types | ||
| 41 | + | ||
| 53 | 42 | _name = LazyReCompile(r'[a-zA-Z_]\w*$') | |
| 54 | 43 | ||
| 55 | 44 | ||
@@ -272,13 +261,7 @@ def is_eval_safe_name(string): | |||
| 272 | 261 | ||
| 273 | 262 | ||
| 274 | 263 | def is_callable(obj): | |
| 275 | - if has_instance_type and isinstance(obj, types.InstanceType): | ||
| 276 | - # Work around a CPython bug, see CPython issue #7624 | ||
| 277 | - return callable(obj) | ||
| 278 | - elif has_collections_callable: | ||
| 279 | - return isinstance(obj, collections.Callable) | ||
| 280 | - else: | ||
| 281 | - return callable(obj) | ||
| 264 | + return callable(obj) | ||
| 282 | 265 | ||
| 283 | 266 | ||
| 284 | 267 | get_encoding_re = LazyReCompile(r'coding[:=]\s*([-\w.]+)') | |
| Back | FazBrowse Home | New Git URL |
0 commit comments