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
Bryton Lacquement
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
# id is used to differentiate the divisions of the same line.
trace
=
create_table
(
"division
"
,
"filename"
,
"lineno"
,
"id"
,
"dividend_type"
,
"divisor_type"
)
trace
_modified
=
create_table
(
"division_modified"
,
"filename"
,
"lineno"
,
"id"
)
insert_trace
=
create_table
(
"division_trace
"
,
"filename"
,
"lineno"
,
"id"
,
"dividend_type"
,
"divisor_type"
)
insert
_modified
=
create_table
(
"division_modified"
,
"filename"
,
"lineno"
,
"id"
)
@
register_tracing_function
def
division_traced
(
filename
,
lineno
,
id_
,
dividend
,
divisor
):
trace
(
insert_
trace
(
filename
,
lineno
,
id_
,
...
...
@@ -70,7 +70,7 @@ class FixDivisionTrace(BaseFix):
comma
.
prefix
=
children
[
1
].
prefix
id_
=
self
.
ids
[
lineno
]
trace
_modified
(
self
.
filename
,
lineno
,
id_
)
insert
_modified
(
self
.
filename
,
lineno
,
id_
)
new_node
=
lib2to3
.
fixer_util
.
Call
(
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
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
):
...
...
@@ -48,6 +48,6 @@ class FixNestedExceptTrace(BaseFix):
for
child
in
self
.
list_except_clause_children
(
body
):
try
:
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
:
pass
my2to3/tests/__init__.py
View file @
c671076a
...
...
@@ -12,16 +12,16 @@ class FixerTestCase(lib2to3FixerTestCase):
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
call
(
*
args
):
self
.
traces
.
append
(
args
)
return
func
(
*
args
)
return
call
fixer_module
.
trace
=
decorate
(
fixer_module
.
trace
)
fixer_module
.
insert_trace
=
decorate
(
fixer_module
.
insert_
trace
)
def
tearDown
(
self
,
*
args
,
**
kw
):
super
(
FixerTestCase
,
self
).
tearDown
(
*
args
,
**
kw
)
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):
conn
.
commit
()
conn
.
close
()
def
trac
e
(
*
values
):
def
insert_uniqu
e
(
*
values
):
conn
=
sqlite3
.
connect
(
database
)
c
=
conn
.
cursor
()
try
:
...
...
@@ -35,7 +35,7 @@ def create_table(table, *columns):
else
:
conn
.
commit
()
conn
.
close
()
return
trac
e
return
insert_uniqu
e
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