package unittest_signals
import (
	πg "grumpy"
	π_grumpyΓlibΓfunctools "grumpy/lib/functools"
	π_grumpyΓlibΓweakref "grumpy/lib/weakref"
)
func initModule(πF *πg.Frame, _ []*πg.Object) (*πg.Object, *πg.BaseException) {
	ßNone := πg.InternStr("None")
	ßTrue := πg.InternStr("True")
	ßWeakKeyDictionary := πg.InternStr("WeakKeyDictionary")
	ß_InterruptHandler := πg.InternStr("_InterruptHandler")
	ß__metaclass__ := πg.InternStr("__metaclass__")
	ß__module__ := πg.InternStr("__module__")
	ß__name__ := πg.InternStr("__name__")
	ß__unittest := πg.InternStr("__unittest")
	ß_interrupt_handler := πg.InternStr("_interrupt_handler")
	ß_results := πg.InternStr("_results")
	ßbool := πg.InternStr("bool")
	ßfunctools := πg.InternStr("functools")
	ßinstallHandler := πg.InternStr("installHandler")
	ßobject := πg.InternStr("object")
	ßpop := πg.InternStr("pop")
	ßregisterResult := πg.InternStr("registerResult")
	ßremoveHandler := πg.InternStr("removeHandler")
	ßremoveResult := πg.InternStr("removeResult")
	ßweakref := πg.InternStr("weakref")
	ßwraps := πg.InternStr("wraps")
	var πTemp001 *πg.Object
	_ = πTemp001
	var πTemp002 []*πg.Object
	_ = πTemp002
	var πTemp003 *πg.Object
	_ = πTemp003
	var πTemp004 *πg.Dict
	_ = πTemp004
	var πTemp005 *πg.Object
	_ = πTemp005
	var πTemp006 []πg.FunctionArg
	_ = πTemp006
	var πTemp007 *πg.Object
	_ = πTemp007
	var πTemp008 *πg.Object
	_ = πTemp008
	var πE *πg.BaseException; _ = πE
	for ; πF.State() >= 0; πF.PopCheckpoint() {
		switch πF.State() {
		case 0:
		default: panic("unexpected function state")
		}
		// line 3: import weakref
		πF.SetLineno(3)
		if πTemp002, πE = πg.ImportModule(πF, "weakref", []*πg.Code{π_grumpyΓlibΓweakref.Code}); πE != nil {
			continue
		}
		πTemp001 = πTemp002[0]
		if πE = πF.Globals().SetItem(πF, ßweakref.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 6: import functools
		πF.SetLineno(6)
		if πTemp002, πE = πg.ImportModule(πF, "functools", []*πg.Code{π_grumpyΓlibΓfunctools.Code}); πE != nil {
			continue
		}
		πTemp001 = πTemp002[0]
		if πE = πF.Globals().SetItem(πF, ßfunctools.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 7: wraps = functools.wraps
		πF.SetLineno(7)
		if πTemp001, πE = πg.ResolveGlobal(πF, ßfunctools); πE != nil {
			continue
		}
		if πTemp003, πE = πg.GetAttr(πF, πTemp001, ßwraps, nil); πE != nil {
			continue
		}
		if πE = πF.Globals().SetItem(πF, ßwraps.ToObject(), πTemp003); πE != nil {
			continue
		}
		// line 9: __unittest = True
		πF.SetLineno(9)
		if πTemp001, πE = πg.ResolveGlobal(πF, ßTrue); πE != nil {
			continue
		}
		if πE = πF.Globals().SetItem(πF, ß__unittest.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 12: class _InterruptHandler(object):
		πF.SetLineno(12)
		πTemp002 = make([]*πg.Object, 1)
		if πTemp005, πE = πg.ResolveGlobal(πF, ßobject); πE != nil {
			continue
		}
		πTemp002[0] = πTemp005
		πTemp004 = πg.NewDict()
		if πTemp001, πE = πF.Globals().GetItem(πF, ß__name__.ToObject()); πE != nil {
			continue
		}
		if πE = πTemp004.SetItem(πF, ß__module__.ToObject(), πTemp001); πE != nil {
			continue
		}
		_, πE = πg.NewCode("_InterruptHandler", "third_party/stdlib/unittest_signals.py", nil, 0, func(πF *πg.Frame, _ []*πg.Object) (*πg.Object, *πg.BaseException) {
			πClass := πTemp004
			_ = πClass
			var πE *πg.BaseException; _ = πE
			for ; πF.State() >= 0; πF.PopCheckpoint() {
				switch πF.State() {
				case 0:
				default: panic("unexpected function state")
				}
				// line 13: pass
				πF.SetLineno(13)
				return nil, nil
			}
			return nil, πE
		}).Eval(πF, πF.Globals(), nil, nil)
		if πE != nil {
			return nil, πE
		}
		if πTemp003, πE = πTemp004.GetItem(πF, ß__metaclass__.ToObject()); πE != nil {
			return nil, πE
		}
		if πTemp003 == nil {
			πTemp003 = πg.TypeType.ToObject()
		}
		if πTemp005, πE = πTemp003.Call(πF, []*πg.Object{πg.NewStr("_InterruptHandler").ToObject(), πg.NewTuple(πTemp002...).ToObject(), πTemp004.ToObject()}, nil); πE != nil {
			continue
		}
		if πE = πF.Globals().SetItem(πF, ß_InterruptHandler.ToObject(), πTemp005); πE != nil {
			continue
		}
		// line 46: _results = weakref.WeakKeyDictionary()
		πF.SetLineno(46)
		if πTemp001, πE = πg.ResolveGlobal(πF, ßweakref); πE != nil {
			continue
		}
		if πTemp003, πE = πg.GetAttr(πF, πTemp001, ßWeakKeyDictionary, nil); πE != nil {
			continue
		}
		if πTemp001, πE = πTemp003.Call(πF, nil, nil); πE != nil {
			continue
		}
		if πE = πF.Globals().SetItem(πF, ß_results.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 47: def registerResult(result):
		πF.SetLineno(47)
		πTemp006 = make([]πg.FunctionArg, 1)
		πTemp006[0] = πg.FunctionArg{Name: "result", Def: nil}
		πTemp001 = πg.NewFunction(πg.NewCode("registerResult", "third_party/stdlib/unittest_signals.py", πTemp006, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
			var µresult *πg.Object = πArgs[0]; _ = µresult
			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 48: _results[result] = 1
				πF.SetLineno(48)
				if πE = πg.Tie(πF, πg.TieTarget{Target: &πTemp001}, πg.NewInt(1).ToObject()); πE != nil {
					continue
				}
				if πTemp002, πE = πg.ResolveGlobal(πF, ß_results); πE != nil {
					continue
				}
				if πE = πg.CheckLocal(πF, µresult, "result"); πE != nil {
					continue
				}
				πTemp003 = µresult
				if πE = πg.SetItem(πF, πTemp002, πTemp003, πTemp001); πE != nil {
					continue
				}
				return nil, nil
			}
			return nil, πE
		}), πF.Globals()).ToObject()
		if πE = πF.Globals().SetItem(πF, ßregisterResult.ToObject(), πTemp001); πE != nil {
			continue
		}
		// line 50: def removeResult(result):
		πF.SetLineno(50)
		πTemp006 = make([]πg.FunctionArg, 1)
		πTemp006[0] = πg.FunctionArg{Name: "result", Def: nil}
		πTemp003 = πg.NewFunction(πg.NewCode("removeResult", "third_party/stdlib/unittest_signals.py", πTemp006, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
			var µresult *πg.Object = πArgs[0]; _ = µresult
			var πTemp001 []*πg.Object
			_ = πTemp001
			var πTemp002 []*πg.Object
			_ = πTemp002
			var πTemp003 *πg.Object
			_ = πTemp003
			var πTemp004 *πg.Object
			_ = πTemp004
			var πE *πg.BaseException; _ = πE
			for ; πF.State() >= 0; πF.PopCheckpoint() {
				switch πF.State() {
				case 0:
				default: panic("unexpected function state")
				}
				// line 51: return bool(_results.pop(result, None))
				πF.SetLineno(51)
				πTemp001 = πF.MakeArgs(1)
				πTemp002 = πF.MakeArgs(2)
				if πE = πg.CheckLocal(πF, µresult, "result"); πE != nil {
					continue
				}
				πTemp002[0] = µresult
				if πTemp003, πE = πg.ResolveGlobal(πF, ßNone); πE != nil {
					continue
				}
				πTemp002[1] = πTemp003
				if πTemp003, πE = πg.ResolveGlobal(πF, ß_results); πE != nil {
					continue
				}
				if πTemp004, πE = πg.GetAttr(πF, πTemp003, ßpop, nil); πE != nil {
					continue
				}
				if πTemp003, πE = πTemp004.Call(πF, πTemp002, nil); πE != nil {
					continue
				}
				πF.FreeArgs(πTemp002)
				πTemp001[0] = πTemp003
				if πTemp003, πE = πg.ResolveGlobal(πF, ßbool); πE != nil {
					continue
				}
				if πTemp004, πE = πTemp003.Call(πF, πTemp001, nil); πE != nil {
					continue
				}
				πF.FreeArgs(πTemp001)
				return πTemp004, nil
				return nil, nil
			}
			return nil, πE
		}), πF.Globals()).ToObject()
		if πE = πF.Globals().SetItem(πF, ßremoveResult.ToObject(), πTemp003); πE != nil {
			continue
		}
		// line 53: _interrupt_handler = None
		πF.SetLineno(53)
		if πTemp005, πE = πg.ResolveGlobal(πF, ßNone); πE != nil {
			continue
		}
		if πE = πF.Globals().SetItem(πF, ß_interrupt_handler.ToObject(), πTemp005); πE != nil {
			continue
		}
		// line 54: def installHandler():
		πF.SetLineno(54)
		πTemp006 = make([]πg.FunctionArg, 0)
		πTemp005 = πg.NewFunction(πg.NewCode("installHandler", "third_party/stdlib/unittest_signals.py", πTemp006, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
			var πE *πg.BaseException; _ = πE
			for ; πF.State() >= 0; πF.PopCheckpoint() {
				switch πF.State() {
				case 0:
				default: panic("unexpected function state")
				}
				// line 55: global _interrupt_handler
				πF.SetLineno(55)
				// line 56: pass
				πF.SetLineno(56)
				return nil, nil
			}
			return nil, πE
		}), πF.Globals()).ToObject()
		if πE = πF.Globals().SetItem(πF, ßinstallHandler.ToObject(), πTemp005); πE != nil {
			continue
		}
		// line 63: def removeHandler(method=None):
		πF.SetLineno(63)
		πTemp006 = make([]πg.FunctionArg, 1)
		if πTemp008, πE = πg.ResolveGlobal(πF, ßNone); πE != nil {
			continue
		}
		πTemp006[0] = πg.FunctionArg{Name: "method", Def: πTemp008}
		πTemp007 = πg.NewFunction(πg.NewCode("removeHandler", "third_party/stdlib/unittest_signals.py", πTemp006, 0, func(πF *πg.Frame, πArgs []*πg.Object) (*πg.Object, *πg.BaseException) {
			var µmethod *πg.Object = πArgs[0]; _ = µmethod
			var πE *πg.BaseException; _ = πE
			for ; πF.State() >= 0; πF.PopCheckpoint() {
				switch πF.State() {
				case 0:
				default: panic("unexpected function state")
				}
				// line 64: pass
				πF.SetLineno(64)
				return nil, nil
			}
			return nil, πE
		}), πF.Globals()).ToObject()
		if πE = πF.Globals().SetItem(πF, ßremoveHandler.ToObject(), πTemp007); πE != nil {
			continue
		}
		return nil, nil
	}
	return nil, πE
}
var Code *πg.Code
func init() {
	Code = πg.NewCode("<module>", "third_party/stdlib/unittest_signals.py", nil, 0, initModule)
}
