KwArgs.hx 411 B

1234567891011121314151617181920212223
  1. package python;
  2. import python.lib.Dict;
  3. abstract KwArgs (Dict<String, Dynamic>)
  4. {
  5. inline function new (d:Dict<String, Dynamic>) this = d;
  6. @:to public inline function toDict ():Dict<String, Dynamic>
  7. {
  8. return this;
  9. }
  10. @:from static inline function fromDict (d:Dict<String, Dynamic>):KwArgs
  11. {
  12. return new KwArgs(d);
  13. }
  14. public function get <V>(key:String, def:V):V
  15. {
  16. return this.get(key, def);
  17. }
  18. }