Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
my2to3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Emmy Vouriot
my2to3
Commits
c671076a
Commit
c671076a
authored
Jul 13, 2020
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New naming convention for the database insert functions
parent
b07744cc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
my2to3/fixes/fix_division_trace.py
my2to3/fixes/fix_division_trace.py
+4
-4
my2to3/fixes/fix_nested_except_trace.py
my2to3/fixes/fix_nested_except_trace.py
+2
-2
my2to3/tests/__init__.py
my2to3/tests/__init__.py
+3
-3
my2to3/trace.py
my2to3/trace.py
+2
-2
No files found.
my2to3/fixes/fix_division_trace.py
View file @
c671076a
...
@@ -11,13 +11,13 @@ from my2to3.util import parse_type
...
@@ -11,13 +11,13 @@ from my2to3.util import parse_type
# id is used to differentiate the divisions of the same line.
# id is used to differentiate the divisions of the same line.
trace
=
create_table
(
"division
"
,
"filename"
,
"lineno"
,
"id"
,
"dividend_type"
,
"divisor_type"
)
insert_trace
=
create_table
(
"division_trace
"
,
"filename"
,
"lineno"
,
"id"
,
"dividend_type"
,
"divisor_type"
)
trace
_modified
=
create_table
(
"division_modified"
,
"filename"
,
"lineno"
,
"id"
)
insert
_modified
=
create_table
(
"division_modified"
,
"filename"
,
"lineno"
,
"id"
)
@
register_tracing_function
@
register_tracing_function
def
division_traced
(
filename
,
lineno
,
id_
,
dividend
,
divisor
):
def
division_traced
(
filename
,
lineno
,
id_
,
dividend
,
divisor
):
trace
(
insert_
trace
(
filename
,
filename
,
lineno
,
lineno
,
id_
,
id_
,
...
@@ -70,7 +70,7 @@ class FixDivisionTrace(BaseFix):
...
@@ -70,7 +70,7 @@ class FixDivisionTrace(BaseFix):
comma
.
prefix
=
children
[
1
].
prefix
comma
.
prefix
=
children
[
1
].
prefix
id_
=
self
.
ids
[
lineno
]
id_
=
self
.
ids
[
lineno
]
trace
_modified
(
self
.
filename
,
lineno
,
id_
)
insert
_modified
(
self
.
filename
,
lineno
,
id_
)
new_node
=
lib2to3
.
fixer_util
.
Call
(
new_node
=
lib2to3
.
fixer_util
.
Call
(
lib2to3
.
fixer_util
.
Name
(
"division_traced"
),
lib2to3
.
fixer_util
.
Name
(
"division_traced"
),
...
...
my2to3/fixes/fix_nested_except_trace.py
View file @
c671076a
...
@@ -4,7 +4,7 @@ from lib2to3.pygram import python_symbols as syms
...
@@ -4,7 +4,7 @@ from lib2to3.pygram import python_symbols as syms
from
my2to3.trace
import
create_table
from
my2to3.trace
import
create_table
trace
=
create_table
(
"nested_except
"
,
"filename"
,
"lineno_parent"
,
"lineno_child"
)
insert_trace
=
create_table
(
"nested_except_trace
"
,
"filename"
,
"lineno_parent"
,
"lineno_child"
)
class
FixNestedExceptTrace
(
BaseFix
):
class
FixNestedExceptTrace
(
BaseFix
):
...
@@ -48,6 +48,6 @@ class FixNestedExceptTrace(BaseFix):
...
@@ -48,6 +48,6 @@ class FixNestedExceptTrace(BaseFix):
for
child
in
self
.
list_except_clause_children
(
body
):
for
child
in
self
.
list_except_clause_children
(
body
):
try
:
try
:
if
except_clause
.
children
[
3
]
==
child
.
children
[
3
]:
if
except_clause
.
children
[
3
]
==
child
.
children
[
3
]:
trace
(
self
.
filename
,
except_clause
.
get_lineno
(),
child
.
get_lineno
())
insert_
trace
(
self
.
filename
,
except_clause
.
get_lineno
(),
child
.
get_lineno
())
except
Exception
:
except
Exception
:
pass
pass
my2to3/tests/__init__.py
View file @
c671076a
...
@@ -12,16 +12,16 @@ class FixerTestCase(lib2to3FixerTestCase):
...
@@ -12,16 +12,16 @@ class FixerTestCase(lib2to3FixerTestCase):
self
.
traces
=
[]
self
.
traces
=
[]
# Wrap fixer_module.trace, to populate self.traces
# Wrap fixer_module.trace, to populate self.traces
self
.
old_
trace
=
fixer_module
.
trace
self
.
old_
insert_trace
=
fixer_module
.
insert_
trace
def
decorate
(
func
):
def
decorate
(
func
):
def
call
(
*
args
):
def
call
(
*
args
):
self
.
traces
.
append
(
args
)
self
.
traces
.
append
(
args
)
return
func
(
*
args
)
return
func
(
*
args
)
return
call
return
call
fixer_module
.
trace
=
decorate
(
fixer_module
.
trace
)
fixer_module
.
insert_trace
=
decorate
(
fixer_module
.
insert_
trace
)
def
tearDown
(
self
,
*
args
,
**
kw
):
def
tearDown
(
self
,
*
args
,
**
kw
):
super
(
FixerTestCase
,
self
).
tearDown
(
*
args
,
**
kw
)
super
(
FixerTestCase
,
self
).
tearDown
(
*
args
,
**
kw
)
if
self
.
fixer
.
endswith
(
'_trace'
):
if
self
.
fixer
.
endswith
(
'_trace'
):
self
.
fixer_module
.
trace
=
self
.
old
_trace
self
.
fixer_module
.
insert_trace
=
self
.
old_insert
_trace
my2to3/trace.py
View file @
c671076a
...
@@ -23,7 +23,7 @@ def create_table(table, *columns):
...
@@ -23,7 +23,7 @@ def create_table(table, *columns):
conn
.
commit
()
conn
.
commit
()
conn
.
close
()
conn
.
close
()
def
trac
e
(
*
values
):
def
insert_uniqu
e
(
*
values
):
conn
=
sqlite3
.
connect
(
database
)
conn
=
sqlite3
.
connect
(
database
)
c
=
conn
.
cursor
()
c
=
conn
.
cursor
()
try
:
try
:
...
@@ -35,7 +35,7 @@ def create_table(table, *columns):
...
@@ -35,7 +35,7 @@ def create_table(table, *columns):
else
:
else
:
conn
.
commit
()
conn
.
commit
()
conn
.
close
()
conn
.
close
()
return
trac
e
return
insert_uniqu
e
def
get_fixers
():
def
get_fixers
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment