python-827e2f16.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. import{g as c}from"./index-b2e76ed2.js";function $(p,i){for(var n=0;n<i.length;n++){const t=i[n];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in p)){const o=Object.getOwnPropertyDescriptor(t,e);o&&Object.defineProperty(p,e,o.get?o:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}))}var r={exports:{}};(function(p,i){ace.define("ace/snippets/python.snippets",["require","exports","module"],function(n,t,e){e.exports=`snippet #!
  2. #!/usr/bin/env python
  3. snippet imp
  4. import \${1:module}
  5. snippet from
  6. from \${1:package} import \${2:module}
  7. # Module Docstring
  8. snippet docs
  9. '''
  10. File: \${1:FILENAME:file_name}
  11. Author: \${2:author}
  12. Description: \${3}
  13. '''
  14. snippet wh
  15. while \${1:condition}:
  16. \${2:# TODO: write code...}
  17. # dowh - does the same as do...while in other languages
  18. snippet dowh
  19. while True:
  20. \${1:# TODO: write code...}
  21. if \${2:condition}:
  22. break
  23. snippet with
  24. with \${1:expr} as \${2:var}:
  25. \${3:# TODO: write code...}
  26. # New Class
  27. snippet cl
  28. class \${1:ClassName}(\${2:object}):
  29. """\${3:docstring for $1}"""
  30. def __init__(self, \${4:arg}):
  31. \${5:super($1, self).__init__()}
  32. self.$4 = $4
  33. \${6}
  34. # New Function
  35. snippet def
  36. def \${1:fname}(\${2:\`indent('.') ? 'self' : ''\`}):
  37. """\${3:docstring for $1}"""
  38. \${4:# TODO: write code...}
  39. snippet deff
  40. def \${1:fname}(\${2:\`indent('.') ? 'self' : ''\`}):
  41. \${3:# TODO: write code...}
  42. # New Method
  43. snippet defs
  44. def \${1:mname}(self, \${2:arg}):
  45. \${3:# TODO: write code...}
  46. # New Property
  47. snippet property
  48. def \${1:foo}():
  49. doc = "\${2:The $1 property.}"
  50. def fget(self):
  51. \${3:return self._$1}
  52. def fset(self, value):
  53. \${4:self._$1 = value}
  54. # Ifs
  55. snippet if
  56. if \${1:condition}:
  57. \${2:# TODO: write code...}
  58. snippet el
  59. else:
  60. \${1:# TODO: write code...}
  61. snippet ei
  62. elif \${1:condition}:
  63. \${2:# TODO: write code...}
  64. # For
  65. snippet for
  66. for \${1:item} in \${2:items}:
  67. \${3:# TODO: write code...}
  68. # Encodes
  69. snippet cutf8
  70. # -*- coding: utf-8 -*-
  71. snippet clatin1
  72. # -*- coding: latin-1 -*-
  73. snippet cascii
  74. # -*- coding: ascii -*-
  75. # Lambda
  76. snippet ld
  77. \${1:var} = lambda \${2:vars} : \${3:action}
  78. snippet .
  79. self.
  80. snippet try Try/Except
  81. try:
  82. \${1:# TODO: write code...}
  83. except \${2:Exception}, \${3:e}:
  84. \${4:raise $3}
  85. snippet try Try/Except/Else
  86. try:
  87. \${1:# TODO: write code...}
  88. except \${2:Exception}, \${3:e}:
  89. \${4:raise $3}
  90. else:
  91. \${5:# TODO: write code...}
  92. snippet try Try/Except/Finally
  93. try:
  94. \${1:# TODO: write code...}
  95. except \${2:Exception}, \${3:e}:
  96. \${4:raise $3}
  97. finally:
  98. \${5:# TODO: write code...}
  99. snippet try Try/Except/Else/Finally
  100. try:
  101. \${1:# TODO: write code...}
  102. except \${2:Exception}, \${3:e}:
  103. \${4:raise $3}
  104. else:
  105. \${5:# TODO: write code...}
  106. finally:
  107. \${6:# TODO: write code...}
  108. # if __name__ == '__main__':
  109. snippet ifmain
  110. if __name__ == '__main__':
  111. \${1:main()}
  112. # __magic__
  113. snippet _
  114. __\${1:init}__\${2}
  115. # python debugger (pdb)
  116. snippet pdb
  117. import pdb; pdb.set_trace()
  118. # ipython debugger (ipdb)
  119. snippet ipdb
  120. import ipdb; ipdb.set_trace()
  121. # ipython debugger (pdbbb)
  122. snippet pdbbb
  123. import pdbpp; pdbpp.set_trace()
  124. snippet pprint
  125. import pprint; pprint.pprint(\${1})\${2}
  126. snippet "
  127. """
  128. \${1:doc}
  129. """
  130. # test function/method
  131. snippet test
  132. def test_\${1:description}(\${2:self}):
  133. \${3:# TODO: write code...}
  134. # test case
  135. snippet testcase
  136. class \${1:ExampleCase}(unittest.TestCase):
  137. def test_\${2:description}(self):
  138. \${3:# TODO: write code...}
  139. snippet fut
  140. from __future__ import \${1}
  141. #getopt
  142. snippet getopt
  143. try:
  144. # Short option syntax: "hv:"
  145. # Long option syntax: "help" or "verbose="
  146. opts, args = getopt.getopt(sys.argv[1:], "\${1:short_options}", [\${2:long_options}])
  147. except getopt.GetoptError, err:
  148. # Print debug info
  149. print str(err)
  150. \${3:error_action}
  151. for option, argument in opts:
  152. if option in ("-h", "--help"):
  153. \${4}
  154. elif option in ("-v", "--verbose"):
  155. verbose = argument
  156. `}),ace.define("ace/snippets/python",["require","exports","module","ace/snippets/python.snippets"],function(n,t,e){t.snippetText=n("./python.snippets"),t.scope="python"}),function(){ace.require(["ace/snippets/python"],function(n){p&&(p.exports=n)})}()})(r);var s=r.exports;const d=c(s),f=$({__proto__:null,default:d},[s]);export{f as p};