How to use the snoop.utils.ArgDefaultDict function in snoop

To help you get started, we’ve selected a few snoop examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexmojaki / executing / tests / samples / tracer2.py View on Github external
def __init__(
            self,
            watch=(),
            watch_explode=(),
            depth=1,
    ):
        self.watch = [
            v if isinstance(v, BaseVariable) else CommonVariable(v)
            for v in ensure_tuple(watch)
        ] + [
            v if isinstance(v, BaseVariable) else Exploding(v)
            for v in ensure_tuple(watch_explode)
        ]
        self.frame_infos = ArgDefaultDict(FrameInfo)
        self.depth = depth
        assert self.depth >= 1
        self.target_codes = set()
        self.target_frames = set()
github alexmojaki / snoop / snoop / tracer.py View on Github external
def __init__(
            self,
            watch=(),
            watch_explode=(),
            depth=1,
    ):
        self.watch = [
            v if isinstance(v, BaseVariable) else CommonVariable(v)
            for v in ensure_tuple(watch)
        ] + [
            v if isinstance(v, BaseVariable) else Exploding(v)
            for v in ensure_tuple(watch_explode)
        ]
        self.frame_infos = ArgDefaultDict(FrameInfo)
        self.depth = depth
        assert self.depth >= 1
        self.target_codes = set()
        self.target_frames = set()
        self.variable_whitelist = None
github alexmojaki / snoop / snoop / formatting.py View on Github external
def __init__(self, *args, **kwargs):
        super(Source, self).__init__(*args, **kwargs)
        if self.tree and self.text:
            self.highlighted = ArgDefaultDict(
                lambda style: raw_highlight(self.text, style).splitlines()
            )
        else:
            self.lines = defaultdict(lambda: u'SOURCE IS UNAVAILABLE')
            self.highlighted = defaultdict(lambda: self.lines)
        self.statements = StatementsDict(self)
        self.nodes = []
        if self.tree:
            self.tree._depth = 0
            for node in ast.walk(self.tree):
                node._tree_index = len(self.nodes)
                self.nodes.append(node)
                for child in ast.iter_child_nodes(node):
                    child._depth = node._depth + 1
github alexmojaki / snoop / snoop / formatting.py View on Github external
def __init__(self, *args, **kwargs):
        super(Source, self).__init__(*args, **kwargs)
        if self.tree:
            self.lines = self.text.splitlines()
            self.highlighted = ArgDefaultDict(
                lambda style: raw_highlight(self.text, style).splitlines()
            )
        else:
            self.lines = defaultdict(lambda: u'SOURCE IS UNAVAILABLE')
            self.highlighted = defaultdict(lambda: self.lines)
        self.statements = StatementsDict(self)
        self.nodes = []
        if self.tree:
            self.tree._depth = 0
            for node in ast.walk(self.tree):
                node._tree_index = len(self.nodes)
                self.nodes.append(node)
                for child in ast.iter_child_nodes(node):
                    child._depth = node._depth + 1
github alexmojaki / snoop / snoop / utils.py View on Github external
def __init__(self, factory):
        super(ArgDefaultDict, self).__init__()
        self.factory = factory