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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
my2to3
Commits
3044a1e0
Commit
3044a1e0
authored
Aug 18, 2020
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes.__init__: move dynamic-related code to the correct subclass
parent
4ed07470
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
my2to3/fixes/__init__.py
my2to3/fixes/__init__.py
+15
-15
No files found.
my2to3/fixes/__init__.py
View file @
3044a1e0
...
...
@@ -14,15 +14,27 @@ class BaseStaticTraceFix(BaseFix):
super
(
BaseStaticTraceFix
,
self
).
__init__
(
*
args
,
**
kwargs
)
# Note: id is used to differentiate the divisions of the same line.
shared_columns
=
"filename"
,
"lineno"
,
"id"
self
.
insert_trace
=
create_table
(
self
.
basename
+
"_trace"
,
*
(
shared_columns
+
self
.
traced_information
))
self
.
insert_modified
=
create_table
(
self
.
basename
+
"_modified"
,
*
shared_columns
)
self
.
insert_trace
=
create_table
(
self
.
basename
+
"_trace"
,
"filename"
,
"lineno"
,
"id"
,
*
self
.
traced_information
)
def
start_tree
(
self
,
*
args
,
**
kwargs
):
super
(
BaseStaticTraceFix
,
self
).
start_tree
(
*
args
,
**
kwargs
)
self
.
ids
=
defaultdict
(
int
)
class
BaseDynamicTraceFix
(
BaseStaticTraceFix
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
BaseDynamicTraceFix
,
self
).
__init__
(
*
args
,
**
kwargs
)
def
f
(
filename
,
lineno
,
id_
,
*
args
,
**
kwargs
):
result
,
values
=
self
.
_dynamic_trace
(
*
args
,
**
kwargs
)
self
.
insert_trace
(
filename
,
lineno
,
id_
,
*
values
)
return
result
f
.
__name__
=
self
.
basename
+
"_traced"
tracing_functions
.
append
(
f
)
self
.
insert_modified
=
create_table
(
self
.
basename
+
"_modified"
,
"filename"
,
"lineno"
,
"id"
)
def
traced_call
(
self
,
node
,
children
):
# Important: every node inside "children" should be cloned before this
# function is called.
...
...
@@ -54,18 +66,6 @@ class BaseStaticTraceFix(BaseFix):
return
new_node
class
BaseDynamicTraceFix
(
BaseStaticTraceFix
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
BaseDynamicTraceFix
,
self
).
__init__
(
*
args
,
**
kwargs
)
def
f
(
filename
,
lineno
,
id_
,
*
args
,
**
kwargs
):
result
,
values
=
self
.
_dynamic_trace
(
*
args
,
**
kwargs
)
self
.
insert_trace
(
filename
,
lineno
,
id_
,
*
values
)
return
result
f
.
__name__
=
self
.
basename
+
"_traced"
tracing_functions
.
append
(
f
)
class
BaseSupportFix
(
BaseFix
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
BaseSupportFix
,
self
).
__init__
(
*
args
,
**
kwargs
)
...
...
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