예제 #1
0
파일: tracer.py 프로젝트: quantopian/qdb
    def inject_default_namespace(self, stackframe=None):
        """
        Adds the default namespace to the frame, or if no frame is provided,
        self.curframe is used.
        """
        stackframe = stackframe or self.curframe
        to_remove = set()
        for k, v in items(self.default_namespace):
            if k not in stackframe.f_globals:
                # Only add the default things if the name is unbound.
                stackframe.f_globals[k] = v
                to_remove.add(k)

        try:
            yield stackframe
        finally:
            for k in to_remove:
                try:
                    del stackframe.f_globals[k]
                except IndexError:
                    # The body of this manager might have del'd this.
                    pass

            # Prevent exceptions from generating ref cycles.
            del stackframe
예제 #2
0
파일: tracer.py 프로젝트: zw1226/qdb
    def inject_default_namespace(self, stackframe=None):
        """
        Adds the default namespace to the frame, or if no frame is provided,
        self.curframe is used.
        """
        stackframe = stackframe or self.curframe
        to_remove = set()
        for k, v in items(self.default_namespace):
            if k not in stackframe.f_globals:
                # Only add the default things if the name is unbound.
                stackframe.f_globals[k] = v
                to_remove.add(k)

        try:
            yield stackframe
        finally:
            for k in to_remove:
                try:
                    del stackframe.f_globals[k]
                except IndexError:
                    # The body of this manager might have del'd this.
                    pass

            # Prevent exceptions from generating ref cycles.
            del stackframe
예제 #3
0
파일: compat.py 프로젝트: OspreyX/qdb
 def __new__(mcls, name, bases, dict_):
     return super(Py2TestMeta, mcls).__new__(
         mcls,
         name,
         bases,
         {k: skip_py3(v) if k.startswith('test_') else v
          for k, v in items(dict_)}
     )
예제 #4
0
파일: comm.py 프로젝트: OspreyX/qdb
 def send_watchlist(self, tracer):
     """
     Sends the watchlist event.
     """
     self.send_event(
         'watchlist',
         [{'expr': k, 'exc': exc, 'value': val}
          for k, (exc, val) in items(tracer.watchlist)],
     )
예제 #5
0
파일: comm.py 프로젝트: wixb50/qdb
 def send_watchlist(self, tracer):
     """
     Sends the watchlist event.
     """
     self.send_event(
         'watchlist',
         [{'expr': k, 'exc': exc, 'value': val}
          for k, (exc, val) in items(tracer.watchlist)],
     )
예제 #6
0
파일: comm.py 프로젝트: OspreyX/qdb
    def do_locals(self, arg, tracer):
        """
        locals
        Report back the current stackframe's locals.
        """
        self.writeln('locals: [')
        for p in items(tracer.curframe_locals):
            self.writeln('  %s=%s' % p)
        self.writeln(']')

        return self.next_command.tailcall(tracer)
예제 #7
0
    def do_locals(self, arg, tracer):
        """
        locals
        Report back the current stackframe's locals.
        """
        self.writeln('locals: [')
        for p in items(tracer.curframe_locals):
            self.writeln('  %s=%s' % p)
        self.writeln(']')

        return self.next_command.tailcall(tracer)
예제 #8
0
 def __new__(mcls, name, bases, dict_):
     return super(Py2TestMeta, mcls).__new__(
         mcls, name, bases, {
             k: skip_py3(v) if k.startswith('test_') else v
             for k, v in items(dict_)
         })