@@ -104,68 +104,6 @@ def normalize_hookimpl_opts(opts):
104
104
opts .setdefault ("optionalhook" , False )
105
105
106
106
107
- class _TagTracer (object ):
108
- def __init__ (self ):
109
- self ._tag2proc = {}
110
- self .writer = None
111
- self .indent = 0
112
-
113
- def get (self , name ):
114
- return _TagTracerSub (self , (name ,))
115
-
116
- def format_message (self , tags , args ):
117
- if isinstance (args [- 1 ], dict ):
118
- extra = args [- 1 ]
119
- args = args [:- 1 ]
120
- else :
121
- extra = {}
122
-
123
- content = " " .join (map (str , args ))
124
- indent = " " * self .indent
125
-
126
- lines = [
127
- "%s%s [%s]\n " % (indent , content , ":" .join (tags ))
128
- ]
129
-
130
- for name , value in extra .items ():
131
- lines .append ("%s %s: %s\n " % (indent , name , value ))
132
- return lines
133
-
134
- def processmessage (self , tags , args ):
135
- if self .writer is not None and args :
136
- lines = self .format_message (tags , args )
137
- self .writer ('' .join (lines ))
138
- try :
139
- self ._tag2proc [tags ](tags , args )
140
- except KeyError :
141
- pass
142
-
143
- def setwriter (self , writer ):
144
- self .writer = writer
145
-
146
- def setprocessor (self , tags , processor ):
147
- if isinstance (tags , str ):
148
- tags = tuple (tags .split (":" ))
149
- else :
150
- assert isinstance (tags , tuple )
151
- self ._tag2proc [tags ] = processor
152
-
153
-
154
- class _TagTracerSub (object ):
155
- def __init__ (self , root , tags ):
156
- self .root = root
157
- self .tags = tags
158
-
159
- def __call__ (self , * args ):
160
- self .root .processmessage (self .tags , args )
161
-
162
- def setmyprocessor (self , processor ):
163
- self .root .setprocessor (self .tags , processor )
164
-
165
- def get (self , name ):
166
- return self .__class__ (self .root , self .tags + (name ,))
167
-
168
-
169
107
class _TracedHookExecution (object ):
170
108
def __init__ (self , pluginmanager , before , after ):
171
109
self .pluginmanager = pluginmanager
@@ -206,7 +144,7 @@ def __init__(self, project_name, implprefix=None):
206
144
self ._name2plugin = {}
207
145
self ._plugin2hookcallers = {}
208
146
self ._plugin_distinfo = []
209
- self .trace = _TagTracer ().get ("pluginmanage" )
147
+ self .trace = _tracing . TagTracer ().get ("pluginmanage" )
210
148
self .hook = _HookRelay (self .trace .root .get ("hook" ))
211
149
self ._implprefix = implprefix
212
150
self ._inner_hookexec = lambda hook , methods , kwargs : \
0 commit comments