All Samples(151) | Call(133) | Derive(0) | Import(18)
Get information about a frame or traceback object. A tuple of five things is returned: the filename, the line number of the current line, the function name, a list of lines of context from the source code, and the index of the current line within that list. The optional second argument specifies the number of lines of context to return, which are centered around the current line.
def getframeinfo(frame, context=1):
"""Get information about a frame or traceback object.
A tuple of five things is returned: the filename, the line number of
the current line, the function name, a list of lines of context from
the source code, and the index of the current line within that list.
The optional second argument specifies the number of lines of context
to return, which are centered around the current line."""
if istraceback(frame):
lineno = frame.tb_lineno
frame = frame.tb_frame
else:
lineno = frame.f_lineno
if not isframe(frame):
raise TypeError('{!r} is not a frame or traceback object'.format(frame))
filename = getsourcefile(frame) or getfile(frame)
if context > 0:
start = lineno - 1 - context//2
try:
lines, lnum = findsource(frame)
except IOError:
lines = index = None
else:
start = max(start, 1)
start = max(0, min(start, len(lines) - context))
lines = lines[start:start+context]
index = lineno - 1 - start
else:
lines = index = None
return Traceback(filename, lineno, frame.f_code.co_name, lines, index)
from inspect import getframeinfo, getmodule
from sys import _getframe
import traceback
from ludibrio._testdouble import _ProxyToAlias
from helpers import frame_out_of_context
class TraceRoute(_ProxyToAlias):
def __init__(self):
self.__traceback__= []
def remember(self):
frame = self._frame_of_trace()
traceinfo = getframeinfo(frame)
src/l/u/ludibrio-3.0.3/ludibrio/traceroute.py ludibrio(Download)
from inspect import getframeinfo, getmodule
from sys import _getframe
import traceback
from ludibrio._testdouble import _ProxyToAlias
from helpers import frame_out_of_context
class TraceRoute(_ProxyToAlias):
def __init__(self):
self.__traceback__= []
def remember(self):
frame = self._frame_of_trace()
traceinfo = getframeinfo(frame)
src/l/u/ludibrio-HEAD/ludibrio/stub.py ludibrio(Download)
#-*- coding:utf-8 -*- from inspect import getframeinfo from sys import _getframe as getframe from _testdouble import _ProxyToAlias from dependencyinjection import DependencyInjection from traceroute import TraceRoute
def _property_called_name(self):
property_called_name = self.__last_property_called__ or getframeinfo(getframe(2))[2]
self.__last_property_called__ = None
return property_called_name
def _property_called(self, property, args=[], kargs={}, response=None):
if self.__recording__:
src/l/u/ludibrio-HEAD/ludibrio/mock.py ludibrio(Download)
#-*- coding:utf-8 -*- from inspect import getframeinfo from sys import _getframe as getframe from _testdouble import _ProxyToAlias from dependencyinjection import DependencyInjection from traceroute import TraceRoute
def __methodCalled__(self, *args, **kargs):
property = getframeinfo(getframe(1))[2]
return self._property_called(property, args, kargs)
def _property_called(self, property, args=[], kargs={}):
if self.__recording__:
self.__traceroute_expected__.remember()
src/b/i/biskit-HEAD/trunk/Biskit/tools.py biskit(Download)
import os, cPickle ## for Load and Dump import tempfile import traceback from inspect import getframeinfo from time import localtime import numpy.oldnumeric as Numeric import glob
why = sys.exc_info()[1].args
except:
pass
file = getframeinfo( trace.tb_frame )[0]
result = "%s in %s line %i:\n\t%s." % ( str(sys.exc_type),
file, trace.tb_lineno, str(why) )
src/b/i/biskit-HEAD/Biskit/tools.py biskit(Download)
import os, cPickle ## for Load and Dump import tempfile import traceback from inspect import getframeinfo from time import localtime import numpy.oldnumeric as Numeric import glob
why = sys.exc_info()[1].args
except:
pass
file = getframeinfo( trace.tb_frame )[0]
result = "%s in %s line %i:\n\t%s." % ( str(sys.exc_type),
file, trace.tb_lineno, str(why) )
src/l/u/ludibrio-3.0.3/ludibrio/stub.py ludibrio(Download)
#-*- coding:utf-8 -*- from inspect import getframeinfo from sys import _getframe as getframe from _testdouble import _ProxyToAlias from dependencyinjection import DependencyInjection from traceroute import TraceRoute
def _property_called_name(self):
property_called_name = self.__last_property_called__ or getframeinfo(getframe(2))[2]
self.__last_property_called__ = None
return property_called_name
def _property_called(self, property, args=[], kargs={}, response=None):
if self.__recording__:
src/l/u/ludibrio-3.0.3/ludibrio/mock.py ludibrio(Download)
#-*- coding:utf-8 -*- from inspect import getframeinfo from sys import _getframe as getframe from _testdouble import _ProxyToAlias from dependencyinjection import DependencyInjection from traceroute import TraceRoute
def __methodCalled__(self, *args, **kargs):
property = getframeinfo(getframe(1))[2]
return self._property_called(property, args, kargs)
def _property_called(self, property, args=[], kargs={}):
if self.__recording__:
self.__traceroute_expected__.remember()
src/l/u/ludibrio-HEAD/ludibrio/dependencyinjection.py ludibrio(Download)
from helpers import frame_out_of_context from inspect import getframeinfo, getmodule from sys import _getframe from types import ModuleType import gc _oldimport = __import__
src/l/u/ludibrio-3.0.3/ludibrio/dependencyinjection.py ludibrio(Download)
from helpers import frame_out_of_context from inspect import getframeinfo, getmodule from sys import _getframe from types import ModuleType import gc _oldimport = __import__
1 | 2 Next