---
tags: decompiler
---
# Source-code transformation
Skipped: 11, 12, 21, 24, 26, 27, 28, 30, 31, 32, 33, 34, 36, 37, 45, 59, 62, 107
Combo of transformation: 75
## 1
Name: TBA
Python versions: 3.7, 3.8
From:
```python=
return (x or z) and not y
```
To:
```python=
t1 = x or z
return t1 and not y
```
## 2
Name: TBA
Python versions: 3.6
From:
```python=
if a:
if b:
return z
```
To:
```python=
if a and b:
return z
```
## 3
Name: TBA
Python versions: 3.8
From:
```python=
with open(f) as okay:
return func()
```
To:
```python=
temp = None
with open(f) as okay:
temp = func()
if temp: return temp
```
## 4
Name: TBA
Python versions: 3.8
From:
```python=
try:
pass
except:
yield False
return
```
To:
```python=
try:
pass
except:
temp = False
return temp
```
## 5
Name: TBA
Python versions: 3.8
From:
```python=
try:
x = 1
except OSError as e:
if e.errno == errno.ENOENT:
return foo()
```
To:
```python=
temp = None
try:
x = 1
except OSError as e:
if e.errno == errno.ENOENT:
temp = foo()
finally:
pass
return temp
```
## 6
Name: TBA
Python versions: 3.8
From:
```python=
while True:
try:
pass
except Exception as info:
break
```
To:
```python=
while True:
try:
pass
except:
break
```
## 7
Name: TBA
Python versions: 2.7
From:
```python=
if a:
pass
elif b:
x= 1
else:
x= 2
```
To:
```python=
if a:
temp = temp
pass
elif b:
x= 1
else:
x= 2
```
## 8
Name: TBA
Python versions: 3.6, 3.7, 3.8
From:
```python=
async for obj in action:
if obj is None:
pass
```
To:
```python=
async for obj in action:
pass
```
## 9
Name: TBA
Python versions: 3.5
From:
```python=
async def inner(query: Union[int, str]):
val = await func(query)
return val
```
To:
```python=
async def inner(query):
val = await func(query)
return val
```
## 10
Name: TBA
Python versions: 3.6, 3.7, 3.8
From:
```python=
return x
for start in sections:
pass
```
To:
```python=
return x
```
## 11
Name: TBA
Python versions: 3.6, 3.7, 3.8
From:
```python=
if w or x or y or z:
return None
```
To:
```python=
temp = w or x or y or z
if temp:
return None
```
## 12
Name: TBA
Python versions: 3.7
From:
```python=
if '+' in value:
vsplited = value.split('+')
for v in vsplited :
to += v
elif '-' in value:
pass
return to
```
To:
```python=
if '+' in value:
vsplited = value.split('+')
for v in vsplited :
to += v
if '-' in value and not '+' in value:
pass
return to
```
## 13
Name: TBA
Python versions: 3.7
From:
```python=
for tcr in type_check_results:
if tcr.match == Match.Yes:
break
else:
# do something
```
To:
```python=
temp = False
for tcr in type_check_results:
if tcr.match == Match.Yes:
temp = True
break
if not x:
# do something
```
## 14
Name: TBA
Python versions: 2.7, 3.6, 3.7, 3.8
From:
```python=
if not datatype:
raise e or ValueError('Missing "datatype" in "animation" Section')
```
To:
```python=
if not datatype:
tmp = e or ValueError('Missing "datatype" in "animation" Section')
raise tmp
```
## 15
Name: TBA
Python versions: 3.7, 3.8
From:
```python=
def GetTargetDiseases():
for id_this in ids:
if conda and condb: continue
while True:
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
if cond1 and cond2: break
x()
```
To:
```python=
def GetTargetDiseases():
for id_this in ids:
if conda and condb: continue
while True:
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
a.b()
# a.b() # Remove this
if cond1 and cond2: break
x()
```
## 16
Name: TBA
Python versions: 3.7, 3.8
From:
```python=
if a:
x= 0
elif b:
x= 1
else:
pass
```
To:
```python=
if a:
x= 0
elif b:
x= 1
```
## 17
Name: TBA
Python versions: 3.6, 3.8
From:
```python=
async with get() as x:
return await x
```
To:
```python=
async with get() as x:
temp = await x
return temp
```
## 18
Name: TBA
Python versions: 3.7, 3.8
From:
```python=
prefix = 'Internal ' if (not a and b) else ''
```
To:
```python=
temp = not a and b
prefix = 'Internal ' if (temp) else ''
```
## 19
Name: TBA
Python versions: 3.8
From:
```python=
while b:
try:
if a:
return None
except:
pass
```
To:
```python=
while b:
temp = False
try:
if a:
temp = True
except:
pass
if temp: return None
```
## 20
Name: TBA
Python versions: 3.8
From:
```python=
for token in l:
for context in l:
if b:
z=z
break
```
To:
```python=
for token in l:
for context in l:
if b:
z=z
if b:
break
```
## 21
Name: TBA
Python versions: 3.8
From:
```python=
for key in l:
if a:
continue
else:
value = 1
value = 2
return
```
To:
```python=
for key in l:
if a:
continue
value = 1
value = 2
return
```
## 22
Name: TBA
Python versions: 3.8
From:
```python=
version_dict = {idx: versions[idx] for idx in l}
```
To:
```python=
version_dict = {}
for idx in l:
version_dict[idx] = versions[idx]
```
## 23
Name: TBA
Python versions: 2.7, 3.6, 3.7, 3.8
From:
```python=
return x or y if z else a
```
To:
```python=
tmp = x or y if z else a
return tmp
```
## 24
Name: TBA
Python versions: 3.7
From:
```python=
while (a or b or c) and d:
continue
```
To:
```python=
temp = (a or b or c) and d
while temp:
temp = (a or b or c) and d
continue
```
## 25
Name: TBA
Python versions: 3.8
From:
```python=
try:
x()
return True
except:
pass
```
To:
```python=
temp = False
try:
x()
temp = True
except:
pass
else:
z=z
if temp: return True
```
or
```python=
try:
x()
a = 1
if a:
return True
except:
pass
```
## 26
Name: TBA
Python versions: 3.8
From:
```python=
try:
pass
except Exception as err:
z()
return x
```
To:
```python=
temp = False
try:
pass
except Exception as err:
z()
temp = True
else:
z=z
if temp: return x
```
## 27
Name: TBA
Python versions: 3.6, 3.7, 3.8
From:
```python=
if chart_type2:
if 'bar' in chart_type:
pass
elif 'foo' == chart:
xd = bar_ind
```
To:
```python=
if chart_type2:
if 'bar' in chart_type:
pass
z=z
elif 'foo' == chart:
xd = bar_ind
```
## 28
Name: TBA
Python versions: 3.8
From:
```python=
while 1:
if match:
n = end
else:
break
return match
```
To:
```python=
while 1:
if match:
n = end
else:
z=z
break
return match
```
## 29
Name: TBA
Python versions: 3.7, 3.8
From:
```python=
_min = _data.min() if not any() and isinstance() else _min
```
To:
```python=
if not any() and isinstance():
_min = _data.min()
else:
_min = _min
```