mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 13:11:15 -07:00
Add future 0.18.2
This commit is contained in:
parent
08c8ee0774
commit
fa97d3f88d
210 changed files with 43159 additions and 0 deletions
23
lib/libpasteurize/fixes/fix_throw.py
Normal file
23
lib/libpasteurize/fixes/fix_throw.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
u"""Fixer for 'g.throw(E(V).with_traceback(T))' -> 'g.throw(E, V, T)'"""
|
||||
|
||||
from lib2to3 import fixer_base
|
||||
from lib2to3.pytree import Node, Leaf
|
||||
from lib2to3.pgen2 import token
|
||||
from lib2to3.fixer_util import Comma
|
||||
|
||||
class FixThrow(fixer_base.BaseFix):
|
||||
|
||||
PATTERN = u"""
|
||||
power< any trailer< '.' 'throw' >
|
||||
trailer< '(' args=power< exc=any trailer< '(' val=any* ')' >
|
||||
trailer< '.' 'with_traceback' > trailer< '(' trc=any ')' > > ')' > >
|
||||
"""
|
||||
|
||||
def transform(self, node, results):
|
||||
syms = self.syms
|
||||
exc, val, trc = (results[u"exc"], results[u"val"], results[u"trc"])
|
||||
val = val[0] if val else Leaf(token.NAME, u"None")
|
||||
val.prefix = trc.prefix = u" "
|
||||
kids = [exc.clone(), Comma(), val.clone(), Comma(), trc.clone()]
|
||||
args = results[u"args"]
|
||||
args.children = kids
|
Loading…
Add table
Add a link
Reference in a new issue