File indexing completed on 2024-04-14 14:48:55

0001 def func(foo, bar, *args, **kwargs):
0002     pass
0003 
0004     
0005 mydict = dict()
0006 mylist = list(mydict)
0007 
0008 class c():
0009     attr = 5
0010 
0011 another_comprehended_list = [item.attr for item in [c(), c(), c()]]
0012     
0013 comprehended_list = [x for x in [1, 2, 3] if x in ('a')]
0014 print(x)
0015     
0016 def func(**kwargs):
0017     for item in kwargs.iterkeys():
0018         print(item)
0019     return kwargs
0020 
0021 def yieldTest():
0022     yield "foo"
0023     
0024 def my_func():
0025     my_var_04 = 5
0026     my_var_01 = 1
0027     my_var_07 = 12
0028     my_var_07 = 12
0029     my_var_07 = 12
0030     more_vars = 2
0031     my_var_02 = 2
0032     my_var_03 = 3
0033 
0034 class cls():
0035     def myfunc(self):
0036         some_var = my_func
0037     
0038     def another(self):
0039         print(self)
0040 
0041 new_threads = cls()
0042 
0043 try:
0044     known_threads = {line.strip() for line  in ["foo"] if line.strip()}
0045 except IOError:
0046     pass
0047     known_threads = set()
0048 
0049 # Remove threads already in the cache so we can write the new ones only.
0050 new_threads = new_threads - known_threads
0051         
0052 import os
0053 
0054 def ASDF(arg, arg2):
0055     arg = arg2
0056     print(arg2)
0057 print(ASDF())
0058 
0059 a = a and a
0060 a = a or b
0061 
0062 class some_class(foo, bar):
0063     def __init__(self):
0064         pass
0065     
0066     attr1 = 3
0067     attr2 = 5
0068     attr3 = 'str'
0069 
0070 argarg = 2
0071 
0072 some_instance = some_class()
0073 some_instance.attr1
0074 some_instance.attr2
0075 some_instance.some_method().foobar
0076 some_instance.some_method(some_arg, some_arg2).second_attribute
0077 some_instance \
0078         .   attr1 \
0079         .funcfunc(argarg, arg2arg) \
0080         .foo
0081 
0082 #comment
0083 """
0084 multiline comment
0085 foo
0086 bar
0087 """
0088  
0089 import sys
0090 import random
0091 
0092 import PyQt4.QtCore
0093 
0094 import bisect
0095 bisect.bisect_right()
0096 
0097 def returns_int(param):
0098     return 5
0099 
0100 def returns_str(param):
0101     return 'str'
0102 
0103 def returns_list(param): return [];
0104 
0105 foo = returns_list()
0106 
0107 bar = 'test'
0108 foo = returns_int()
0109 s = returns_str()
0110 l = returns_list()
0111 
0112 def simple_func(foo):
0113     """ usage comment, bla, param:foo"""
0114     pass
0115 
0116 copied = simple_func
0117 
0118 def function(foo):
0119     """ docstring
0120     more
0121     more more
0122     >>> test
0123     >>> test
0124     """
0125     return foo
0126 
0127 async def fonc(x, y, z):
0128     a = await z
0129 
0130 try:
0131     pass
0132 except Exception as e:
0133     print(e)
0134 
0135 def func(foo, bar, baz, bang, foobang, foobar, foobazbar, foobazbarbang):
0136     return foobang
0137     
0138     import asynchat
0139     obj = asynchat.async_chat()
0140     obj.collect_incoming_data()
0141     import _winreg
0142     _winreg.CreateKey()
0143     import binhex
0144     binhex.hexbin()
0145     
0146     if foobazbar < 5:
0147         pass
0148 
0149 func(sys)
0150 simple_func()
0151 
0152 def func_without_param():
0153     pass
0154     return [(lambda foo: foo) for fdlksh in [1, 2, 3]]
0155 
0156 func_without_param()
0157 
0158 def another_function(param):
0159     return [3 for x in param]
0160 
0161 a = 5
0162 
0163 bar = a == a
0164 a != a
0165 a < a
0166 a <= a
0167 a > a
0168 a < a < a
0169 a >= a
0170 a is a
0171 a is not a
0172 a not in a
0173 a in a
0174 
0175 a = a + 1
0176 a = a - 1
0177 a = a * 1
0178 a = a / 1
0179 a = a // 1
0180 a = a % 1
0181 a = a ^ 1
0182 a = a & 1
0183 a = a | 1
0184 a = a ** 1
0185 a = a >> 1
0186 a = a << 1
0187 a = a @ 1
0188 
0189 a = not a
0190 a = +a
0191 a = -a
0192 a = ~a
0193 
0194 a = b[1:2:3][2]
0195 extended = a[1:2, 2:3]
0196 
0197 i += 3
0198 i += j
0199 
0200 3 if 5 < 7 else 4
0201 
0202 from random import random
0203 
0204 random(foo=3)
0205 
0206 a = lambda x: x**2
0207 
0208 @staticmethod
0209 @classmethod
0210 def genfunc():
0211     yield foo
0212 
0213 for target1, target2 in some_dict.iteritems():
0214     print(target1, target2)
0215 
0216 pi = 3.1415
0217 
0218 foo = 1, 2
0219 bar = (1, 2)
0220 
0221 with open('f') as foo:
0222     pass
0223 
0224 global IMAGLOBALVARIABLE
0225 IMAGLOBALVARIABLE = 0
0226 try:
0227     a = 3 / 0
0228 except ZeroDivisionError as err:
0229     raise ValueError
0230 else:
0231     do_something()
0232 finally:
0233     BAM
0234 
0235 if 3 and 5:
0236     pass
0237 
0238 for i in xrange(20):
0239     pass
0240 
0241 while True:
0242     break
0243     continue
0244 
0245 del foo
0246 
0247 import random
0248 random.random(3, 5)
0249 
0250 somelist = [1, 2, 3, 4, 5]
0251 somedict = { 'key1' : 'value1', key2: value2 }
0252 
0253 somelist[...]
0254 somelist[1:]
0255 somelist[:20]
0256 somelist[1:20]
0257 somelist[1:20:2]
0258 
0259 class bar(parent):
0260     pass
0261 
0262 if foo in bar and 3 < 5:
0263     pass
0264 
0265 a = [x*2 for x in xrange(20)]
0266 
0267 variable.variable2.variable3 = 15
0268 def function(param1, param2, param3, *paramstar, **paramdstar):
0269     pass
0270     return param1 * param2
0271 
0272 assert False
0273 if not 3:
0274     pass
0275 
0276 if 3 * 5 == 7:
0277     pass