@@ -118,44 +118,46 @@ def get_type(vv):
118
118
exportedwidth = len (exportedLabel ) + colsep
119
119
scopewidth = len (scopeLabel ) + colsep
120
120
# table header
121
- print (varlabel .ljust (varwidth ) + typelabel .ljust (typewidth ) + scopeLabel .ljust (scopewidth ) + exportedLabel .ljust (exportedwidth ) + \
122
- ' ' + datalabel + '\n ' + '-' * (varwidth + typewidth + len (datalabel )+ 1 ))
121
+ print (varlabel .ljust (varwidth ) + typelabel .ljust (typewidth ) + scopeLabel .ljust (scopewidth ) + exportedLabel .ljust (exportedwidth )
122
+ # + ' '+datalabel+'\n'
123
+ # + '-'*(varwidth+typewidth+len(datalabel)+1)
124
+ )
123
125
# and the table itself
124
126
kb = 1024
125
127
Mb = 1048576 # kb**2
126
128
def printEntry (vname : str ,var : Any ,vtype :str , scope : str = "global" , exported :str = "" ):
127
- print (vformat .format (vname , vtype , scope , str (exported ), varwidth = varwidth , typewidth = typewidth , scopewidth = scopewidth , exportedwidth = exportedwidth ), end = ' ' )
128
- if vtype in seq_types :
129
- print ("n=" + str (len (var )))
130
- elif vtype == ndarray_type :
131
- vshape = str (var .shape ).replace (',' ,'' ).replace (' ' ,'x' )[1 :- 1 ]
132
- if vtype == ndarray_type :
133
- # numpy
134
- vsize = var .size
135
- vbytes = vsize * var .itemsize
136
- vdtype = var .dtype
129
+ print (vformat .format (vname , vtype , scope , str (exported ), varwidth = varwidth , typewidth = typewidth , scopewidth = scopewidth , exportedwidth = exportedwidth ), end = '\n ' )
130
+ # if vtype in seq_types:
131
+ # print("n="+str(len(var)))
132
+ # elif vtype == ndarray_type:
133
+ # vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]
134
+ # if vtype==ndarray_type:
135
+ # # numpy
136
+ # vsize = var.size
137
+ # vbytes = vsize*var.itemsize
138
+ # vdtype = var.dtype
137
139
138
- if vbytes < 100000 :
139
- print (aformat % (vshape , vsize , vdtype , vbytes ))
140
- else :
141
- print (aformat % (vshape , vsize , vdtype , vbytes ), end = ' ' )
142
- if vbytes < Mb :
143
- print ('(%s kb)' % (vbytes / kb ,))
144
- else :
145
- print ('(%s Mb)' % (vbytes / Mb ,))
146
- else :
147
- try :
148
- vstr = str (var )
149
- except UnicodeEncodeError :
150
- vstr = var .encode (DEFAULT_ENCODING ,
151
- 'backslashreplace' )
152
- except :
153
- vstr = "<object with id %d (str() failed)>" % id (var )
154
- vstr = vstr .replace ('\n ' , '\\ n' )
155
- if len (vstr ) < 50 :
156
- print (vstr )
157
- else :
158
- print (vstr [:25 ] + "<...>" + vstr [- 25 :])
140
+ # if vbytes < 100000:
141
+ # print(aformat % (vshape, vsize, vdtype, vbytes))
142
+ # else:
143
+ # print(aformat % (vshape, vsize, vdtype, vbytes), end=' ')
144
+ # if vbytes < Mb:
145
+ # print('(%s kb)' % (vbytes/kb,))
146
+ # else:
147
+ # print('(%s Mb)' % (vbytes/Mb,))
148
+ # else:
149
+ # try:
150
+ # vstr = str(var)
151
+ # except UnicodeEncodeError:
152
+ # vstr = var.encode(DEFAULT_ENCODING,
153
+ # 'backslashreplace')
154
+ # except:
155
+ # vstr = "<object with id %d (str() failed)>" % id(var)
156
+ # vstr = vstr.replace('\n', '\\n')
157
+ # if len(vstr) < 50:
158
+ # print(vstr)
159
+ # else:
160
+ # print(vstr[:25] + "<...>" + vstr[-25:])
159
161
160
162
for scopeNum in sorted (varsByScope ):
161
163
# print("Pagebreak : ", str(scopeNum))
0 commit comments