package threading_test
import (
	πg "grumpy"
	π_grumpyΓlibΓthreading "grumpy/lib/threading"
	π_grumpyΓlibΓtime "grumpy/lib/time"
	π_grumpyΓlibΓweetest "grumpy/lib/weetest"
)
func initModule(πF *πg.Frame, _ []*πg.Object) (*πg.Object, *πg.BaseException) {
	ßEvent := πg.InternStr("Event")
	ßRunTests := πg.InternStr("RunTests")
	ßTestEvent := πg.InternStr("TestEvent")
	ßTestThread := πg.InternStr("TestThread")
	ßTestThreadArgs := πg.InternStr("TestThreadArgs")
	ßThread := πg.InternStr("Thread")
	ßTrue := πg.InternStr("True")
	ß__main__ := πg.InternStr("__main__")
	ß__name__ := πg.InternStr("__name__")
	ßappend := πg.InternStr("append")
	ßfoo := πg.InternStr("foo")
	ßjoin := πg.InternStr("join")
	ßready := πg.InternStr("ready")
	ßset := πg.InternStr("set")
	ßsleep := πg.InternStr("sleep")
	ßstart := πg.InternStr("start")
	ßthreading := πg.InternStr("threading")
	ßtime := πg.InternStr("time")
	ßwait := πg.InternStr("wait")
	ßweetest := πg.InternStr("weetest")
	var πTemp001 *πg.Object
	_ = πTemp001
	var πTemp002 []*πg.Object
	_ = πTemp002
	var πTemp003 []πg.FunctionArg
	_ = πTemp003
	var πTemp004 *πg.Object
	_ = πTemp004
	var πTemp005 *πg.Object
	_ = πTemp005
	var πTemp006 *πg.Object
	_ = πTemp006
	var πTemp007 *πg.Object
	_ = πTemp007
	var πTemp008 bool
	_ = πTemp008
	var πE *πg.BaseException; _ = πE
	for ; πF.State() >= 0; πF.PopCheckpoint() {
		switch πF.State() {
		case 0:
		default: panic("unexpected function state")
		}
		// line 15: import threading
		πF.SetLineno(15)
		if πTemp002, πE = πg.ImportModule(πF, "threading", []*πg.Code{π_grumpyΓlibΓthreading.Code}); πE != nil {
			continue
		}
		πTemp001 = πTemp002[0]
		if πE = πF.Globals().SetItem(πF, ßthreading.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 16: import time
		πF.SetLineno(16)
		if πTemp002, πE = πg.ImportModule(πF, "time", []*πg.Code{π_grumpyΓlibΓtime.Code}); πE != nil {
			continue
		}
		πTemp001 = πTemp002[0]
		if πE = πF.Globals().SetItem(πF, ßtime.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 18: import weetest
		πF.SetLineno(18)
		if πTemp002, πE = πg.ImportModule(πF, "weetest", []*πg.Code{π_grumpyΓlibΓweetest.Code}); πE != nil {
			continue
		}
		πTemp001 = πTemp002[0]
		if πE = πF.Globals().SetItem(πF, ßweetest.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 21: def TestEvent():
		πF.SetLineno(21)
		πTemp003 = make([]πg.FunctionArg, 0)
		πTemp001 = πg.NewFunction(πg.NewCode("TestEvent", "lib/threading_test.py", πTemp003, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
			var µe *πg.Object = πg.UnboundLocal; _ = µe
			var µtarget_result *πg.Object = πg.UnboundLocal; _ = µtarget_result
			var µx *πg.Object = πg.UnboundLocal; _ = µx
			var µTarget *πg.Object = πg.UnboundLocal; _ = µTarget
			var µt *πg.Object = πg.UnboundLocal; _ = µt
			var πTemp001 *πg.Object
			_ = πTemp001
			var πTemp002 *πg.Object
			_ = πTemp002
			var πTemp003 []*πg.Object
			_ = πTemp003
			var πTemp004 []πg.FunctionArg
			_ = πTemp004
			var πTemp005 πg.KWArgs
			_ = πTemp005
			var πTemp006 *πg.Object
			_ = πTemp006
			var πE *πg.BaseException; _ = πE
			for ; πF.State() >= 0; πF.PopCheckpoint() {
				switch πF.State() {
				case 0:
				default: panic("unexpected function state")
				}
				// line 22: e = threading.Event()
				πF.SetLineno(22)
				if πTemp001, πE = πg.ResolveGlobal(πF, ßthreading); πE != nil {
					continue
				}
				if πTemp002, πE = πg.GetAttr(πF, πTemp001, ßEvent, nil); πE != nil {
					continue
				}
				if πTemp001, πE = πTemp002.Call(πF, nil, nil); πE != nil {
					continue
				}
				µe = πTemp001
				// line 23: target_result = []
				πF.SetLineno(23)
				πTemp003 = make([]*πg.Object, 0)
				πTemp001 = πg.NewList(πTemp003...).ToObject()
				µtarget_result = πTemp001
				// line 24: x = 'not ready'
				πF.SetLineno(24)
				µx = πg.NewStr("not ready").ToObject()
				// line 25: def Target():
				πF.SetLineno(25)
				πTemp004 = make([]πg.FunctionArg, 0)
				πTemp001 = πg.NewFunction(πg.NewCode("Target", "lib/threading_test.py", πTemp004, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
					var πTemp001 *πg.Object
					_ = πTemp001
					var πTemp002 *πg.Object
					_ = πTemp002
					var πTemp003 []*πg.Object
					_ = πTemp003
					var πE *πg.BaseException; _ = πE
					for ; πF.State() >= 0; πF.PopCheckpoint() {
						switch πF.State() {
						case 0:
						default: panic("unexpected function state")
						}
						// line 26: e.wait()
						πF.SetLineno(26)
						if πE = πg.CheckLocal(πF, µe, "e"); πE != nil {
							continue
						}
						if πTemp001, πE = πg.GetAttr(πF, µe, ßwait, nil); πE != nil {
							continue
						}
						if πTemp002, πE = πTemp001.Call(πF, nil, nil); πE != nil {
							continue
						}
						// line 27: target_result.append(x)
						πF.SetLineno(27)
						πTemp003 = πF.MakeArgs(1)
						if πE = πg.CheckLocal(πF, µx, "x"); πE != nil {
							continue
						}
						πTemp003[0] = µx
						if πE = πg.CheckLocal(πF, µtarget_result, "target_result"); πE != nil {
							continue
						}
						if πTemp001, πE = πg.GetAttr(πF, µtarget_result, ßappend, nil); πE != nil {
							continue
						}
						if πTemp002, πE = πTemp001.Call(πF, πTemp003, nil); πE != nil {
							continue
						}
						πF.FreeArgs(πTemp003)
						return nil, nil
					}
					return nil, πE
				}), πF.Globals()).ToObject()
				µTarget = πTemp001
				// line 28: t = threading.Thread(target=Target)
				πF.SetLineno(28)
				if πE = πg.CheckLocal(πF, µTarget, "Target"); πE != nil {
					continue
				}
				πTemp005 = πg.KWArgs{
					{"target", µTarget},
				}
				if πTemp002, πE = πg.ResolveGlobal(πF, ßthreading); πE != nil {
					continue
				}
				if πTemp006, πE = πg.GetAttr(πF, πTemp002, ßThread, nil); πE != nil {
					continue
				}
				if πTemp002, πE = πTemp006.Call(πF, nil, πTemp005); πE != nil {
					continue
				}
				µt = πTemp002
				// line 29: t.start()
				πF.SetLineno(29)
				if πE = πg.CheckLocal(πF, µt, "t"); πE != nil {
					continue
				}
				if πTemp002, πE = πg.GetAttr(πF, µt, ßstart, nil); πE != nil {
					continue
				}
				if πTemp006, πE = πTemp002.Call(πF, nil, nil); πE != nil {
					continue
				}
				// line 33: time.sleep(0.1)
				πF.SetLineno(33)
				πTemp003 = πF.MakeArgs(1)
				πTemp003[0] = πg.NewFloat(0.1).ToObject()
				if πTemp002, πE = πg.ResolveGlobal(πF, ßtime); πE != nil {
					continue
				}
				if πTemp006, πE = πg.GetAttr(πF, πTemp002, ßsleep, nil); πE != nil {
					continue
				}
				if πTemp002, πE = πTemp006.Call(πF, πTemp003, nil); πE != nil {
					continue
				}
				πF.FreeArgs(πTemp003)
				// line 34: x = 'ready'
				πF.SetLineno(34)
				µx = ßready.ToObject()
				// line 35: e.set()
				πF.SetLineno(35)
				if πE = πg.CheckLocal(πF, µe, "e"); πE != nil {
					continue
				}
				if πTemp002, πE = πg.GetAttr(πF, µe, ßset, nil); πE != nil {
					continue
				}
				if πTemp006, πE = πTemp002.Call(πF, nil, nil); πE != nil {
					continue
				}
				// line 36: t.join()
				πF.SetLineno(36)
				if πE = πg.CheckLocal(πF, µt, "t"); πE != nil {
					continue
				}
				if πTemp002, πE = πg.GetAttr(πF, µt, ßjoin, nil); πE != nil {
					continue
				}
				if πTemp006, πE = πTemp002.Call(πF, nil, nil); πE != nil {
					continue
				}
				// line 37: assert target_result == ['ready']
				πF.SetLineno(37)
				if πE = πg.CheckLocal(πF, µtarget_result, "target_result"); πE != nil {
					continue
				}
				πTemp003 = make([]*πg.Object, 1)
				πTemp003[0] = ßready.ToObject()
				πTemp006 = πg.NewList(πTemp003...).ToObject()
				if πTemp002, πE = πg.Eq(πF, µtarget_result, πTemp006); πE != nil {
					continue
				}
				if πE = πg.Assert(πF, πTemp002, nil); πE != nil {
					continue
				}
				return nil, nil
			}
			return nil, πE
		}), πF.Globals()).ToObject()
		if πE = πF.Globals().SetItem(πF, ßTestEvent.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 40: def TestThread():
		πF.SetLineno(40)
		πTemp003 = make([]πg.FunctionArg, 0)
		πTemp004 = πg.NewFunction(πg.NewCode("TestThread", "lib/threading_test.py", πTemp003, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
			var µran *πg.Object = πg.UnboundLocal; _ = µran
			var µTarget *πg.Object = πg.UnboundLocal; _ = µTarget
			var µt *πg.Object = πg.UnboundLocal; _ = µt
			var πTemp001 []*πg.Object
			_ = πTemp001
			var πTemp002 *πg.Object
			_ = πTemp002
			var πTemp003 []πg.FunctionArg
			_ = πTemp003
			var πTemp004 πg.KWArgs
			_ = πTemp004
			var πTemp005 *πg.Object
			_ = πTemp005
			var πTemp006 *πg.Object
			_ = πTemp006
			var πE *πg.BaseException; _ = πE
			for ; πF.State() >= 0; πF.PopCheckpoint() {
				switch πF.State() {
				case 0:
				default: panic("unexpected function state")
				}
				// line 41: ran = []
				πF.SetLineno(41)
				πTemp001 = make([]*πg.Object, 0)
				πTemp002 = πg.NewList(πTemp001...).ToObject()
				µran = πTemp002
				// line 42: def Target():
				πF.SetLineno(42)
				πTemp003 = make([]πg.FunctionArg, 0)
				πTemp002 = πg.NewFunction(πg.NewCode("Target", "lib/threading_test.py", πTemp003, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
					var πTemp001 []*πg.Object
					_ = πTemp001
					var πTemp002 *πg.Object
					_ = πTemp002
					var πTemp003 *πg.Object
					_ = πTemp003
					var πE *πg.BaseException; _ = πE
					for ; πF.State() >= 0; πF.PopCheckpoint() {
						switch πF.State() {
						case 0:
						default: panic("unexpected function state")
						}
						// line 43: ran.append(True)
						πF.SetLineno(43)
						πTemp001 = πF.MakeArgs(1)
						if πTemp002, πE = πg.ResolveGlobal(πF, ßTrue); πE != nil {
							continue
						}
						πTemp001[0] = πTemp002
						if πE = πg.CheckLocal(πF, µran, "ran"); πE != nil {
							continue
						}
						if πTemp002, πE = πg.GetAttr(πF, µran, ßappend, nil); πE != nil {
							continue
						}
						if πTemp003, πE = πTemp002.Call(πF, πTemp001, nil); πE != nil {
							continue
						}
						πF.FreeArgs(πTemp001)
						return nil, nil
					}
					return nil, πE
				}), πF.Globals()).ToObject()
				µTarget = πTemp002
				// line 44: t = threading.Thread(target=Target)
				πF.SetLineno(44)
				if πE = πg.CheckLocal(πF, µTarget, "Target"); πE != nil {
					continue
				}
				πTemp004 = πg.KWArgs{
					{"target", µTarget},
				}
				if πTemp005, πE = πg.ResolveGlobal(πF, ßthreading); πE != nil {
					continue
				}
				if πTemp006, πE = πg.GetAttr(πF, πTemp005, ßThread, nil); πE != nil {
					continue
				}
				if πTemp005, πE = πTemp006.Call(πF, nil, πTemp004); πE != nil {
					continue
				}
				µt = πTemp005
				// line 45: t.start()
				πF.SetLineno(45)
				if πE = πg.CheckLocal(πF, µt, "t"); πE != nil {
					continue
				}
				if πTemp005, πE = πg.GetAttr(πF, µt, ßstart, nil); πE != nil {
					continue
				}
				if πTemp006, πE = πTemp005.Call(πF, nil, nil); πE != nil {
					continue
				}
				// line 46: t.join()
				πF.SetLineno(46)
				if πE = πg.CheckLocal(πF, µt, "t"); πE != nil {
					continue
				}
				if πTemp005, πE = πg.GetAttr(πF, µt, ßjoin, nil); πE != nil {
					continue
				}
				if πTemp006, πE = πTemp005.Call(πF, nil, nil); πE != nil {
					continue
				}
				// line 47: assert ran
				πF.SetLineno(47)
				if πE = πg.CheckLocal(πF, µran, "ran"); πE != nil {
					continue
				}
				if πE = πg.Assert(πF, µran, nil); πE != nil {
					continue
				}
				return nil, nil
			}
			return nil, πE
		}), πF.Globals()).ToObject()
		if πE = πF.Globals().SetItem(πF, ßTestThread.ToObject(), πTemp004); πE != nil {
			continue
		}
		// line 50: def TestThreadArgs():
		πF.SetLineno(50)
		πTemp003 = make([]πg.FunctionArg, 0)
		πTemp005 = πg.NewFunction(πg.NewCode("TestThreadArgs", "lib/threading_test.py", πTemp003, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
			var µtarget_args *πg.Object = πg.UnboundLocal; _ = µtarget_args
			var µTarget *πg.Object = πg.UnboundLocal; _ = µTarget
			var µt *πg.Object = πg.UnboundLocal; _ = µt
			var πTemp001 []*πg.Object
			_ = πTemp001
			var πTemp002 *πg.Object
			_ = πTemp002
			var πTemp003 []πg.FunctionArg
			_ = πTemp003
			var πTemp004 *πg.Object
			_ = πTemp004
			var πTemp005 πg.KWArgs
			_ = πTemp005
			var πTemp006 *πg.Object
			_ = πTemp006
			var πTemp007 []*πg.Object
			_ = πTemp007
			var πE *πg.BaseException; _ = πE
			for ; πF.State() >= 0; πF.PopCheckpoint() {
				switch πF.State() {
				case 0:
				default: panic("unexpected function state")
				}
				// line 51: target_args = []
				πF.SetLineno(51)
				πTemp001 = make([]*πg.Object, 0)
				πTemp002 = πg.NewList(πTemp001...).ToObject()
				µtarget_args = πTemp002
				// line 52: def Target(*args):
				πF.SetLineno(52)
				πTemp003 = make([]πg.FunctionArg, 0)
				πTemp002 = πg.NewFunction(πg.NewCode("Target", "lib/threading_test.py", πTemp003, πg.CodeFlagVarArg, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
					var µargs *πg.Object = πArgs[0]; _ = µargs
					var πTemp001 []*πg.Object
					_ = πTemp001
					var πTemp002 *πg.Object
					_ = πTemp002
					var πTemp003 *πg.Object
					_ = πTemp003
					var πE *πg.BaseException; _ = πE
					for ; πF.State() >= 0; πF.PopCheckpoint() {
						switch πF.State() {
						case 0:
						default: panic("unexpected function state")
						}
						// line 53: target_args.append(args)
						πF.SetLineno(53)
						πTemp001 = πF.MakeArgs(1)
						if πE = πg.CheckLocal(πF, µargs, "args"); πE != nil {
							continue
						}
						πTemp001[0] = µargs
						if πE = πg.CheckLocal(πF, µtarget_args, "target_args"); πE != nil {
							continue
						}
						if πTemp002, πE = πg.GetAttr(πF, µtarget_args, ßappend, nil); πE != nil {
							continue
						}
						if πTemp003, πE = πTemp002.Call(πF, πTemp001, nil); πE != nil {
							continue
						}
						πF.FreeArgs(πTemp001)
						return nil, nil
					}
					return nil, πE
				}), πF.Globals()).ToObject()
				µTarget = πTemp002
				// line 54: t = threading.Thread(target=Target, args=('foo', 42))
				πF.SetLineno(54)
				if πE = πg.CheckLocal(πF, µTarget, "Target"); πE != nil {
					continue
				}
				πTemp001 = make([]*πg.Object, 2)
				πTemp001[0] = ßfoo.ToObject()
				πTemp001[1] = πg.NewInt(42).ToObject()
				πTemp004 = πg.NewTuple(πTemp001...).ToObject()
				πTemp005 = πg.KWArgs{
					{"target", µTarget},
					{"args", πTemp004},
				}
				if πTemp004, πE = πg.ResolveGlobal(πF, ßthreading); πE != nil {
					continue
				}
				if πTemp006, πE = πg.GetAttr(πF, πTemp004, ßThread, nil); πE != nil {
					continue
				}
				if πTemp004, πE = πTemp006.Call(πF, nil, πTemp005); πE != nil {
					continue
				}
				µt = πTemp004
				// line 55: t.start()
				πF.SetLineno(55)
				if πE = πg.CheckLocal(πF, µt, "t"); πE != nil {
					continue
				}
				if πTemp004, πE = πg.GetAttr(πF, µt, ßstart, nil); πE != nil {
					continue
				}
				if πTemp006, πE = πTemp004.Call(πF, nil, nil); πE != nil {
					continue
				}
				// line 56: t.join()
				πF.SetLineno(56)
				if πE = πg.CheckLocal(πF, µt, "t"); πE != nil {
					continue
				}
				if πTemp004, πE = πg.GetAttr(πF, µt, ßjoin, nil); πE != nil {
					continue
				}
				if πTemp006, πE = πTemp004.Call(πF, nil, nil); πE != nil {
					continue
				}
				// line 57: assert target_args == [('foo', 42)]
				πF.SetLineno(57)
				if πE = πg.CheckLocal(πF, µtarget_args, "target_args"); πE != nil {
					continue
				}
				πTemp001 = make([]*πg.Object, 1)
				πTemp007 = make([]*πg.Object, 2)
				πTemp007[0] = ßfoo.ToObject()
				πTemp007[1] = πg.NewInt(42).ToObject()
				πTemp006 = πg.NewTuple(πTemp007...).ToObject()
				πTemp001[0] = πTemp006
				πTemp006 = πg.NewList(πTemp001...).ToObject()
				if πTemp004, πE = πg.Eq(πF, µtarget_args, πTemp006); πE != nil {
					continue
				}
				if πE = πg.Assert(πF, πTemp004, nil); πE != nil {
					continue
				}
				return nil, nil
			}
			return nil, πE
		}), πF.Globals()).ToObject()
		if πE = πF.Globals().SetItem(πF, ßTestThreadArgs.ToObject(), πTemp005); πE != nil {
			continue
		}
		if πTemp007, πE = πg.ResolveGlobal(πF, ß__name__); πE != nil {
			continue
		}
		if πTemp006, πE = πg.Eq(πF, πTemp007, ß__main__.ToObject()); πE != nil {
			continue
		}
		if πTemp008, πE = πg.IsTrue(πF, πTemp006); πE != nil {
			return nil, πE
		}
		if πTemp008 {
			goto Label1
		}
		goto Label2
		// line 60: if __name__ == '__main__':
		πF.SetLineno(60)
	Label1:
		// line 61: weetest.RunTests()
		πF.SetLineno(61)
		if πTemp006, πE = πg.ResolveGlobal(πF, ßweetest); πE != nil {
			continue
		}
		if πTemp007, πE = πg.GetAttr(πF, πTemp006, ßRunTests, nil); πE != nil {
			continue
		}
		if πTemp006, πE = πTemp007.Call(πF, nil, nil); πE != nil {
			continue
		}
		goto Label2
	Label2:
		return nil, nil
	}
	return nil, πE
}
var Code *πg.Code
func init() {
	Code = πg.NewCode("<module>", "lib/threading_test.py", nil, 0, initModule)
}
