Skip to content

Instantly share code, notes, and snippets.

View Elizaveta239's full-sized avatar

Elizaveta Shashkova Elizaveta239

View GitHub Profile
import os
import time
import threading
def child():
print "Child id: %d" % os.getpid()
while True:
print("Child alive")
import os
import time
import threading
def child():
print "Child id: %d" % os.getpid()
while True:
print("Child alive")
time.sleep(1)
def norm_case(filename):
filename = os_normcase(filename)
if IS_PY3K:
return filename
enc = sys.getfilesystemencoding()
return filename.decode(enc).lower().encode(enc)
from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
def norm_case(filename):
filename = os_normcase(filename)
enc = getfilesystemencoding()
if IS_PY3K or enc == 'UTF-8':
return filename
res = filename.decode(enc).lower().encode(enc)
print(filename, res, enc)
return res
from jinja2 import Environment
from jinja2.loaders import FileSystemLoader
if __name__ == '__main__':
context = {'seq': [2, 3, 4], 'name': 'Armin'}
env = Environment(loader=FileSystemLoader('templates'))
tmpl = env.get_template('test3.html')
answer = tmpl.render(context)
<html>
<title>Test 2</title>
<body>
Hello {{ name }}!
{% macro fun() %}
{% set res = 9 %}
{{ res }}
{% endmacro %}
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
# License: EPL
import os
import sys
import traceback
try:
xrange
except:
xrange = range
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)
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]