home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- '''Fixer for generator.throw(E, V, T).
-
- g.throw(E) -> g.throw(E)
- g.throw(E, V) -> g.throw(E(V))
- g.throw(E, V, T) -> g.throw(E(V).with_traceback(T))
-
- g.throw("foo"[, V[, T]]) will warn about string exceptions.'''
- from import pytree
- from pgen2 import token
- from import fixer_base
- from fixer_util import Name, Call, ArgList, Attr, is_tuple
-
- class FixThrow(fixer_base.BaseFix):
- PATTERN = "\n power< any trailer< '.' 'throw' >\n trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' >\n >\n |\n power< any trailer< '.' 'throw' > trailer< '(' exc=any ')' > >\n "
-
- def transform(self, node, results):
- syms = self.syms
- exc = results['exc'].clone()
- if exc.type is token.STRING:
- self.cannot_convert(node, 'Python 3 does not support string exceptions')
- return None
- val = results.get('val')
- if val is None:
- return None
- val = val.clone()
- throw_args = results['args']
-
-
-