Show More
@@ -114,6 +114,11 b' except NameError:' | |||
|
114 | 114 | items.reverse() |
|
115 | 115 | return items |
|
116 | 116 | |
|
117 | try: # Python 2.4 compatibility | |
|
118 | GeneratorExit | |
|
119 | except NameError: | |
|
120 | GeneratorExit = SystemExit | |
|
121 | ||
|
117 | 122 | try: |
|
118 | 123 | import pwd |
|
119 | 124 | except ImportError: |
@@ -666,7 +671,7 b' def xrepr(item, mode="default"):' | |||
|
666 | 671 | try: |
|
667 | 672 | for x in func(mode): |
|
668 | 673 | yield x |
|
669 | except (KeyboardInterrupt, SystemExit): | |
|
674 | except (KeyboardInterrupt, SystemExit, GeneratorExit): | |
|
670 | 675 | raise |
|
671 | 676 | except Exception: |
|
672 | 677 | yield (astyle.style_default, repr(item)) |
@@ -840,20 +845,20 b' def upgradexattr(attr):' | |||
|
840 | 845 | """ |
|
841 | 846 | Convert an attribute descriptor string to a real descriptor object. |
|
842 | 847 | |
|
843 |
If attr already is a descriptor object return i |
|
|
848 | If attr already is a descriptor object return it unmodified. A | |
|
844 | 849 | ``SelfDescriptor`` will be returned if ``attr`` is ``None``. ``"foo"`` |
|
845 | 850 | returns an ``AttributeDescriptor`` for the attribute named ``"foo"``. |
|
846 | 851 | ``"foo()"`` returns a ``MethodDescriptor`` for the method named ``"foo"``. |
|
847 | 852 | ``"-foo"`` will return an ``IterAttributeDescriptor`` for the attribute |
|
848 | 853 | named ``"foo"`` and ``"-foo()"`` will return an ``IterMethodDescriptor`` |
|
849 | for the method named ``"foo"``. Furthermore integer will return the appropriate | |
|
854 | for the method named ``"foo"``. Furthermore integers will return the appropriate | |
|
850 | 855 | ``IndexDescriptor`` and callables will return a ``FunctionDescriptor``. |
|
851 | 856 | """ |
|
852 | 857 | if attr is None: |
|
853 | 858 | return selfdescriptor |
|
854 | 859 | elif isinstance(attr, Descriptor): |
|
855 | 860 | return attr |
|
856 | elif isinstance(attr, str): | |
|
861 | elif isinstance(attr, basestring): | |
|
857 | 862 | if attr.endswith("()"): |
|
858 | 863 | if attr.startswith("-"): |
|
859 | 864 | return IterMethodDescriptor(attr[1:-2]) |
General Comments 0
You need to be logged in to leave comments.
Login now