class Listener(dynamic_proxy(DialogInterface.OnClickListener)): def __init__(self, color_res): super(Listener, self).__init__() self.color = activity.getResources().getColor(color_res) def onClick(self, dialog, which): activity.title_drawable.setColor(self.color)
class AddCounter(dynamic_proxy(TP.Adder)): count = 0 def add(self, x): result = x + AddCounter.count AddCounter.count += 1 return result
class AddN(dynamic_proxy(TP.Adder)): def __init__(self, n): super(AddN, self).__init__() self.n = n def add(self, x): return self.n + x
class Add(dynamic_proxy(TP.Adder)): @classmethod def non_data(cls): return "classmethod" @property def data(self): return 42
class C(dynamic_proxy(Runnable)): def __init__(self, i): super().__init__() self.i = i def run(self): nonlocal result result += str(self.i)
class UpdateRunnable(dynamic_proxy(Runnable)): def __init__(self, progress): super(UpdateRunnable, self).__init__() self.progress = progress def run(self): global dialog dialog.setText(str(self.progress) + " / " + str(iterations)) dialog.updateProgress(self.progress)
class Implemented(dynamic_proxy(TP.Adder)): def toString(self): return "Override " + Object.toString(self) def hashCode(self): return Object.hashCode(self) + 1 def equals(self, other): return True
class C(dynamic_proxy(Runnable, TP.Adder, TP.GetString)): def run(self): return self.result # returns void def add(self, x): return self.result # returns int def getString(self): return self.result # returns String
class A(dynamic_proxy(TP.Adder)): def __init__(self, n): self.before_init_n = n test.assertEqual(n, self.before_init_n) super(A, self).__init__() self.after_init_n = -n self.dt = DT() def add(self, x): return self.before_init_n + x
class StartRunnable(dynamic_proxy(Runnable)): def run(self): global dialog dialog = DreamDialog(context) dialog.setCanceledOnTouchOutside(False) dialog.create() dialog.show() window = dialog.getWindow() window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT) dialog.setContentSize(iterations) dialog.setText("0 / " + str(iterations)) dialog.updateProgress(0)
class C(dynamic_proxy(TP.Args)): def tooMany(self): pass def tooFew(self, a): pass def addDuck(self, a, b): return a + b def star(self, *args): return ",".join(args) def varargs(self, delim, args): test.assertIsInstance(args, jarray(String)) return delim.join(args)
class R(dynamic_proxy(Runnable)): def __init__(self): super(R, self).__init__() self.progress = 0 self.velocity = 0 def setProgress(self, progress): self.progress = progress def setVelocity(self, velocity): self.velocity = velocity def run(self): progressW.setProgress(int(round(float(self.progress)))) percentageW.setText(str(self.progress) + "%") velocityW.setText(str(self.velocity))
class E(dynamic_proxy(TP.Exceptions)): def parse(self, s): return self.indirect_parse(s) def indirect_parse(self, s): return Integer.parseInt(s)
class P4(dynamic_proxy(P3)): pass
class E(dynamic_proxy(TP.Exceptions)): def fnf(self): raise E.exc_cls("fnf")
class P3(dynamic_proxy(Runnable)): pass
class A(dynamic_proxy(TP.Adder)): def __init__(self): pass
class P6(dynamic_proxy(Runnable), dynamic_proxy(Runnable)): pass
class C(dynamic_proxy(TP.Adder), B): def add(self, x): return x + self.forty_two()
class C(dynamic_proxy(TP.Adder)): def wait(self): return "Python override"
class R(dynamic_proxy(Runnable)): def run(self): six.reraise(type, value, traceback)
class Unimplemented(dynamic_proxy(TP.Adder)): pass
class A(dynamic_proxy(TP.Adder)): pass
class Add2(dynamic_proxy(TP.Adder)): def add(self, x): return x + 2
class C(dynamic_proxy(Runnable)): def run(self): from . import exception_in_init # noqa: F401
class EndRunnable(dynamic_proxy(Runnable)): def run(self): global dialog dialog.dismiss()
class P5(B, dynamic_proxy(Runnable)): pass
class P2(dynamic_proxy(Object)): pass
class P1(dynamic_proxy("hello")): pass
class AddConstant(dynamic_proxy(TP.Adder)): def add(self, x): return x + self.constant