This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
This module provides utilities to get the absolute filenames so that we can be sure that: | |
- The case of a file will match the actual file in the filesystem (otherwise breakpoints won't be hit). | |
- Providing means for the user to make path conversions when doing a remote debugging session in | |
one machine and debugging in another. | |
To do that, the PATHS_FROM_ECLIPSE_TO_PYTHON constant must be filled with the appropriate paths. | |
@note: | |
in this context, the server is where your python process is running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bar(): | |
a = 1 | |
b1 = 1 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 | |
b2 = 1 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 23 if a > 1 else 2 if a > 0 else 3 if a > 4 else 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if not skip_file: | |
try: | |
threadingCurrentThread() | |
except: | |
skip_file = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cdef extern from *: | |
ctypedef void freefunc(void *) | |
ctypedef void PyObject | |
ctypedef struct PyCodeObject: | |
int co_argcount; # arguments, except *args */ | |
int co_kwonlyargcount; # keyword only arguments */ | |
int co_nlocals; # local variables */ | |
int co_stacksize; # entries needed for evaluation stack */ | |
int co_flags; # CO_..., see below */ | |
int co_firstlineno; # first source line number */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dis | |
import inspect | |
def trace(): | |
print("hello!") | |
def insert_code(code_to_modify, lines_to_insert, before_line): | |
lines = inspect.getsourcelines(code_to_modify)[0] | |
line_for_break = lines[before_line] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
class Debugger(object): | |
def __init__(self): | |
breakpoints = {} | |
def call_trace(self): | |
frame = sys._getframe(1) | |
print(frame.f_code.co_filename, frame.f_lineno, frame.f_locals) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# License: EPL | |
import os | |
import sys | |
import traceback | |
try: | |
xrange | |
except: | |
xrange = range |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Stack tracer for multi-threaded applications. | |
Usage: | |
import stacktracer | |
stacktracer.start_trace("trace.html",interval=5,auto=True) # Set auto flag to always update file! | |
.... | |
stacktracer.stop_trace() | |
taken from the http://code.activestate.com/recipes/577334-how-to-debug-deadlocked-multi-threaded-programs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def str_to_args_windows(args): | |
# see http:#msdn.microsoft.com/en-us/library/a1y7w461.aspx | |
result = [] | |
DEFAULT = 0 | |
ARG = 1 | |
IN_DOUBLE_QUOTE = 2 | |
state = DEFAULT | |
backslashes = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<title>Test 2</title> | |
<body> | |
Hello {{ name }}! | |
{% macro fun() %} | |
{% set res = 9 %} | |
{{ res }} | |
{% endmacro %} |
NewerOlder