wandb 0.19.1__py3-none-musllinux_1_2_aarch64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (822) hide show
  1. package_readme.md +97 -0
  2. wandb/__init__.py +246 -0
  3. wandb/__init__.pyi +1197 -0
  4. wandb/__main__.py +3 -0
  5. wandb/_globals.py +19 -0
  6. wandb/agents/__init__.py +0 -0
  7. wandb/agents/pyagent.py +363 -0
  8. wandb/analytics/__init__.py +3 -0
  9. wandb/analytics/sentry.py +263 -0
  10. wandb/apis/__init__.py +48 -0
  11. wandb/apis/attrs.py +51 -0
  12. wandb/apis/importers/__init__.py +1 -0
  13. wandb/apis/importers/internals/internal.py +385 -0
  14. wandb/apis/importers/internals/protocols.py +103 -0
  15. wandb/apis/importers/internals/util.py +78 -0
  16. wandb/apis/importers/mlflow.py +254 -0
  17. wandb/apis/importers/validation.py +108 -0
  18. wandb/apis/importers/wandb.py +1603 -0
  19. wandb/apis/internal.py +232 -0
  20. wandb/apis/normalize.py +73 -0
  21. wandb/apis/paginator.py +81 -0
  22. wandb/apis/public/__init__.py +34 -0
  23. wandb/apis/public/api.py +1387 -0
  24. wandb/apis/public/artifacts.py +1095 -0
  25. wandb/apis/public/const.py +4 -0
  26. wandb/apis/public/files.py +263 -0
  27. wandb/apis/public/history.py +149 -0
  28. wandb/apis/public/jobs.py +653 -0
  29. wandb/apis/public/projects.py +154 -0
  30. wandb/apis/public/query_generator.py +166 -0
  31. wandb/apis/public/reports.py +458 -0
  32. wandb/apis/public/runs.py +1012 -0
  33. wandb/apis/public/sweeps.py +240 -0
  34. wandb/apis/public/teams.py +198 -0
  35. wandb/apis/public/users.py +136 -0
  36. wandb/apis/public/utils.py +68 -0
  37. wandb/apis/reports/__init__.py +1 -0
  38. wandb/apis/reports/v1/__init__.py +8 -0
  39. wandb/apis/reports/v2/__init__.py +8 -0
  40. wandb/apis/workspaces/__init__.py +8 -0
  41. wandb/beta/workflows.py +288 -0
  42. wandb/bin/gpu_stats +0 -0
  43. wandb/bin/wandb-core +0 -0
  44. wandb/cli/__init__.py +0 -0
  45. wandb/cli/beta.py +178 -0
  46. wandb/cli/cli.py +2812 -0
  47. wandb/data_types.py +66 -0
  48. wandb/docker/__init__.py +343 -0
  49. wandb/docker/auth.py +435 -0
  50. wandb/docker/wandb-entrypoint.sh +33 -0
  51. wandb/docker/www_authenticate.py +94 -0
  52. wandb/env.py +513 -0
  53. wandb/errors/__init__.py +17 -0
  54. wandb/errors/errors.py +37 -0
  55. wandb/errors/links.py +73 -0
  56. wandb/errors/term.py +415 -0
  57. wandb/errors/util.py +57 -0
  58. wandb/errors/warnings.py +2 -0
  59. wandb/filesync/__init__.py +0 -0
  60. wandb/filesync/dir_watcher.py +403 -0
  61. wandb/filesync/stats.py +100 -0
  62. wandb/filesync/step_checksum.py +142 -0
  63. wandb/filesync/step_prepare.py +179 -0
  64. wandb/filesync/step_upload.py +287 -0
  65. wandb/filesync/upload_job.py +142 -0
  66. wandb/integration/__init__.py +0 -0
  67. wandb/integration/catboost/__init__.py +5 -0
  68. wandb/integration/catboost/catboost.py +178 -0
  69. wandb/integration/cohere/__init__.py +3 -0
  70. wandb/integration/cohere/cohere.py +21 -0
  71. wandb/integration/cohere/resolver.py +347 -0
  72. wandb/integration/diffusers/__init__.py +3 -0
  73. wandb/integration/diffusers/autologger.py +76 -0
  74. wandb/integration/diffusers/pipeline_resolver.py +50 -0
  75. wandb/integration/diffusers/resolvers/__init__.py +9 -0
  76. wandb/integration/diffusers/resolvers/multimodal.py +882 -0
  77. wandb/integration/diffusers/resolvers/utils.py +102 -0
  78. wandb/integration/fastai/__init__.py +245 -0
  79. wandb/integration/gym/__init__.py +99 -0
  80. wandb/integration/huggingface/__init__.py +3 -0
  81. wandb/integration/huggingface/huggingface.py +18 -0
  82. wandb/integration/huggingface/resolver.py +213 -0
  83. wandb/integration/keras/__init__.py +11 -0
  84. wandb/integration/keras/callbacks/__init__.py +5 -0
  85. wandb/integration/keras/callbacks/metrics_logger.py +129 -0
  86. wandb/integration/keras/callbacks/model_checkpoint.py +188 -0
  87. wandb/integration/keras/callbacks/tables_builder.py +228 -0
  88. wandb/integration/keras/keras.py +1089 -0
  89. wandb/integration/kfp/__init__.py +6 -0
  90. wandb/integration/kfp/helpers.py +28 -0
  91. wandb/integration/kfp/kfp_patch.py +334 -0
  92. wandb/integration/kfp/wandb_logging.py +182 -0
  93. wandb/integration/langchain/__init__.py +3 -0
  94. wandb/integration/langchain/wandb_tracer.py +48 -0
  95. wandb/integration/lightgbm/__init__.py +239 -0
  96. wandb/integration/lightning/__init__.py +0 -0
  97. wandb/integration/lightning/fabric/__init__.py +3 -0
  98. wandb/integration/lightning/fabric/logger.py +764 -0
  99. wandb/integration/metaflow/__init__.py +3 -0
  100. wandb/integration/metaflow/metaflow.py +383 -0
  101. wandb/integration/openai/__init__.py +3 -0
  102. wandb/integration/openai/fine_tuning.py +480 -0
  103. wandb/integration/openai/openai.py +22 -0
  104. wandb/integration/openai/resolver.py +240 -0
  105. wandb/integration/prodigy/__init__.py +3 -0
  106. wandb/integration/prodigy/prodigy.py +299 -0
  107. wandb/integration/sacred/__init__.py +117 -0
  108. wandb/integration/sagemaker/__init__.py +12 -0
  109. wandb/integration/sagemaker/auth.py +28 -0
  110. wandb/integration/sagemaker/config.py +49 -0
  111. wandb/integration/sagemaker/files.py +3 -0
  112. wandb/integration/sagemaker/resources.py +34 -0
  113. wandb/integration/sb3/__init__.py +3 -0
  114. wandb/integration/sb3/sb3.py +147 -0
  115. wandb/integration/sklearn/__init__.py +37 -0
  116. wandb/integration/sklearn/calculate/__init__.py +32 -0
  117. wandb/integration/sklearn/calculate/calibration_curves.py +125 -0
  118. wandb/integration/sklearn/calculate/class_proportions.py +68 -0
  119. wandb/integration/sklearn/calculate/confusion_matrix.py +93 -0
  120. wandb/integration/sklearn/calculate/decision_boundaries.py +40 -0
  121. wandb/integration/sklearn/calculate/elbow_curve.py +55 -0
  122. wandb/integration/sklearn/calculate/feature_importances.py +67 -0
  123. wandb/integration/sklearn/calculate/learning_curve.py +64 -0
  124. wandb/integration/sklearn/calculate/outlier_candidates.py +69 -0
  125. wandb/integration/sklearn/calculate/residuals.py +86 -0
  126. wandb/integration/sklearn/calculate/silhouette.py +118 -0
  127. wandb/integration/sklearn/calculate/summary_metrics.py +62 -0
  128. wandb/integration/sklearn/plot/__init__.py +35 -0
  129. wandb/integration/sklearn/plot/classifier.py +329 -0
  130. wandb/integration/sklearn/plot/clusterer.py +146 -0
  131. wandb/integration/sklearn/plot/regressor.py +121 -0
  132. wandb/integration/sklearn/plot/shared.py +91 -0
  133. wandb/integration/sklearn/utils.py +183 -0
  134. wandb/integration/tensorboard/__init__.py +10 -0
  135. wandb/integration/tensorboard/log.py +354 -0
  136. wandb/integration/tensorboard/monkeypatch.py +186 -0
  137. wandb/integration/tensorflow/__init__.py +5 -0
  138. wandb/integration/tensorflow/estimator_hook.py +54 -0
  139. wandb/integration/torch/__init__.py +0 -0
  140. wandb/integration/torch/wandb_torch.py +554 -0
  141. wandb/integration/ultralytics/__init__.py +11 -0
  142. wandb/integration/ultralytics/bbox_utils.py +215 -0
  143. wandb/integration/ultralytics/callback.py +524 -0
  144. wandb/integration/ultralytics/classification_utils.py +83 -0
  145. wandb/integration/ultralytics/mask_utils.py +202 -0
  146. wandb/integration/ultralytics/pose_utils.py +103 -0
  147. wandb/integration/xgboost/__init__.py +11 -0
  148. wandb/integration/xgboost/xgboost.py +189 -0
  149. wandb/integration/yolov8/__init__.py +0 -0
  150. wandb/integration/yolov8/yolov8.py +284 -0
  151. wandb/jupyter.py +513 -0
  152. wandb/mpmain/__init__.py +0 -0
  153. wandb/mpmain/__main__.py +1 -0
  154. wandb/old/__init__.py +0 -0
  155. wandb/old/core.py +53 -0
  156. wandb/old/settings.py +173 -0
  157. wandb/old/summary.py +440 -0
  158. wandb/plot/__init__.py +28 -0
  159. wandb/plot/bar.py +70 -0
  160. wandb/plot/confusion_matrix.py +181 -0
  161. wandb/plot/custom_chart.py +124 -0
  162. wandb/plot/histogram.py +65 -0
  163. wandb/plot/line.py +74 -0
  164. wandb/plot/line_series.py +176 -0
  165. wandb/plot/pr_curve.py +185 -0
  166. wandb/plot/roc_curve.py +163 -0
  167. wandb/plot/scatter.py +66 -0
  168. wandb/plot/utils.py +183 -0
  169. wandb/plot/viz.py +41 -0
  170. wandb/proto/__init__.py +0 -0
  171. wandb/proto/v3/__init__.py +0 -0
  172. wandb/proto/v3/wandb_base_pb2.py +55 -0
  173. wandb/proto/v3/wandb_internal_pb2.py +1658 -0
  174. wandb/proto/v3/wandb_server_pb2.py +228 -0
  175. wandb/proto/v3/wandb_settings_pb2.py +122 -0
  176. wandb/proto/v3/wandb_telemetry_pb2.py +106 -0
  177. wandb/proto/v4/__init__.py +0 -0
  178. wandb/proto/v4/wandb_base_pb2.py +30 -0
  179. wandb/proto/v4/wandb_internal_pb2.py +370 -0
  180. wandb/proto/v4/wandb_server_pb2.py +67 -0
  181. wandb/proto/v4/wandb_settings_pb2.py +47 -0
  182. wandb/proto/v4/wandb_telemetry_pb2.py +41 -0
  183. wandb/proto/v5/wandb_base_pb2.py +31 -0
  184. wandb/proto/v5/wandb_internal_pb2.py +371 -0
  185. wandb/proto/v5/wandb_server_pb2.py +68 -0
  186. wandb/proto/v5/wandb_settings_pb2.py +48 -0
  187. wandb/proto/v5/wandb_telemetry_pb2.py +42 -0
  188. wandb/proto/wandb_base_pb2.py +10 -0
  189. wandb/proto/wandb_deprecated.py +45 -0
  190. wandb/proto/wandb_generate_deprecated.py +30 -0
  191. wandb/proto/wandb_generate_proto.py +49 -0
  192. wandb/proto/wandb_internal_pb2.py +16 -0
  193. wandb/proto/wandb_server_pb2.py +10 -0
  194. wandb/proto/wandb_settings_pb2.py +10 -0
  195. wandb/proto/wandb_telemetry_pb2.py +10 -0
  196. wandb/py.typed +0 -0
  197. wandb/sdk/__init__.py +37 -0
  198. wandb/sdk/artifacts/__init__.py +0 -0
  199. wandb/sdk/artifacts/_validators.py +121 -0
  200. wandb/sdk/artifacts/artifact.py +2364 -0
  201. wandb/sdk/artifacts/artifact_download_logger.py +43 -0
  202. wandb/sdk/artifacts/artifact_file_cache.py +249 -0
  203. wandb/sdk/artifacts/artifact_instance_cache.py +17 -0
  204. wandb/sdk/artifacts/artifact_manifest.py +75 -0
  205. wandb/sdk/artifacts/artifact_manifest_entry.py +249 -0
  206. wandb/sdk/artifacts/artifact_manifests/__init__.py +0 -0
  207. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +92 -0
  208. wandb/sdk/artifacts/artifact_saver.py +265 -0
  209. wandb/sdk/artifacts/artifact_state.py +11 -0
  210. wandb/sdk/artifacts/artifact_ttl.py +7 -0
  211. wandb/sdk/artifacts/exceptions.py +57 -0
  212. wandb/sdk/artifacts/staging.py +25 -0
  213. wandb/sdk/artifacts/storage_handler.py +62 -0
  214. wandb/sdk/artifacts/storage_handlers/__init__.py +0 -0
  215. wandb/sdk/artifacts/storage_handlers/azure_handler.py +213 -0
  216. wandb/sdk/artifacts/storage_handlers/gcs_handler.py +224 -0
  217. wandb/sdk/artifacts/storage_handlers/http_handler.py +114 -0
  218. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +139 -0
  219. wandb/sdk/artifacts/storage_handlers/multi_handler.py +56 -0
  220. wandb/sdk/artifacts/storage_handlers/s3_handler.py +298 -0
  221. wandb/sdk/artifacts/storage_handlers/tracking_handler.py +72 -0
  222. wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +135 -0
  223. wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +74 -0
  224. wandb/sdk/artifacts/storage_layout.py +6 -0
  225. wandb/sdk/artifacts/storage_policies/__init__.py +4 -0
  226. wandb/sdk/artifacts/storage_policies/register.py +1 -0
  227. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +378 -0
  228. wandb/sdk/artifacts/storage_policy.py +72 -0
  229. wandb/sdk/backend/__init__.py +0 -0
  230. wandb/sdk/backend/backend.py +221 -0
  231. wandb/sdk/data_types/__init__.py +0 -0
  232. wandb/sdk/data_types/_dtypes.py +918 -0
  233. wandb/sdk/data_types/_private.py +10 -0
  234. wandb/sdk/data_types/audio.py +165 -0
  235. wandb/sdk/data_types/base_types/__init__.py +0 -0
  236. wandb/sdk/data_types/base_types/json_metadata.py +55 -0
  237. wandb/sdk/data_types/base_types/media.py +376 -0
  238. wandb/sdk/data_types/base_types/wb_value.py +282 -0
  239. wandb/sdk/data_types/bokeh.py +70 -0
  240. wandb/sdk/data_types/graph.py +405 -0
  241. wandb/sdk/data_types/helper_types/__init__.py +0 -0
  242. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +305 -0
  243. wandb/sdk/data_types/helper_types/classes.py +159 -0
  244. wandb/sdk/data_types/helper_types/image_mask.py +241 -0
  245. wandb/sdk/data_types/histogram.py +94 -0
  246. wandb/sdk/data_types/html.py +115 -0
  247. wandb/sdk/data_types/image.py +847 -0
  248. wandb/sdk/data_types/molecule.py +241 -0
  249. wandb/sdk/data_types/object_3d.py +470 -0
  250. wandb/sdk/data_types/plotly.py +82 -0
  251. wandb/sdk/data_types/saved_model.py +445 -0
  252. wandb/sdk/data_types/table.py +1204 -0
  253. wandb/sdk/data_types/trace_tree.py +438 -0
  254. wandb/sdk/data_types/utils.py +228 -0
  255. wandb/sdk/data_types/video.py +268 -0
  256. wandb/sdk/integration_utils/__init__.py +0 -0
  257. wandb/sdk/integration_utils/auto_logging.py +232 -0
  258. wandb/sdk/integration_utils/data_logging.py +475 -0
  259. wandb/sdk/interface/__init__.py +0 -0
  260. wandb/sdk/interface/constants.py +4 -0
  261. wandb/sdk/interface/interface.py +1010 -0
  262. wandb/sdk/interface/interface_queue.py +53 -0
  263. wandb/sdk/interface/interface_relay.py +53 -0
  264. wandb/sdk/interface/interface_shared.py +546 -0
  265. wandb/sdk/interface/interface_sock.py +61 -0
  266. wandb/sdk/interface/message_future.py +27 -0
  267. wandb/sdk/interface/message_future_poll.py +50 -0
  268. wandb/sdk/interface/router.py +115 -0
  269. wandb/sdk/interface/router_queue.py +41 -0
  270. wandb/sdk/interface/router_relay.py +37 -0
  271. wandb/sdk/interface/router_sock.py +36 -0
  272. wandb/sdk/interface/summary_record.py +67 -0
  273. wandb/sdk/internal/__init__.py +0 -0
  274. wandb/sdk/internal/context.py +89 -0
  275. wandb/sdk/internal/datastore.py +297 -0
  276. wandb/sdk/internal/file_pusher.py +181 -0
  277. wandb/sdk/internal/file_stream.py +695 -0
  278. wandb/sdk/internal/flow_control.py +263 -0
  279. wandb/sdk/internal/handler.py +905 -0
  280. wandb/sdk/internal/internal.py +403 -0
  281. wandb/sdk/internal/internal_api.py +4587 -0
  282. wandb/sdk/internal/internal_util.py +97 -0
  283. wandb/sdk/internal/job_builder.py +638 -0
  284. wandb/sdk/internal/profiler.py +78 -0
  285. wandb/sdk/internal/progress.py +79 -0
  286. wandb/sdk/internal/run.py +25 -0
  287. wandb/sdk/internal/sample.py +70 -0
  288. wandb/sdk/internal/sender.py +1696 -0
  289. wandb/sdk/internal/sender_config.py +197 -0
  290. wandb/sdk/internal/settings_static.py +97 -0
  291. wandb/sdk/internal/system/__init__.py +0 -0
  292. wandb/sdk/internal/system/assets/__init__.py +25 -0
  293. wandb/sdk/internal/system/assets/aggregators.py +37 -0
  294. wandb/sdk/internal/system/assets/asset_registry.py +20 -0
  295. wandb/sdk/internal/system/assets/cpu.py +163 -0
  296. wandb/sdk/internal/system/assets/disk.py +210 -0
  297. wandb/sdk/internal/system/assets/gpu.py +416 -0
  298. wandb/sdk/internal/system/assets/gpu_amd.py +233 -0
  299. wandb/sdk/internal/system/assets/interfaces.py +205 -0
  300. wandb/sdk/internal/system/assets/ipu.py +177 -0
  301. wandb/sdk/internal/system/assets/memory.py +166 -0
  302. wandb/sdk/internal/system/assets/network.py +125 -0
  303. wandb/sdk/internal/system/assets/open_metrics.py +293 -0
  304. wandb/sdk/internal/system/assets/tpu.py +154 -0
  305. wandb/sdk/internal/system/assets/trainium.py +393 -0
  306. wandb/sdk/internal/system/env_probe_helpers.py +13 -0
  307. wandb/sdk/internal/system/system_info.py +250 -0
  308. wandb/sdk/internal/system/system_monitor.py +222 -0
  309. wandb/sdk/internal/tb_watcher.py +519 -0
  310. wandb/sdk/internal/thread_local_settings.py +18 -0
  311. wandb/sdk/internal/writer.py +204 -0
  312. wandb/sdk/launch/__init__.py +15 -0
  313. wandb/sdk/launch/_launch.py +331 -0
  314. wandb/sdk/launch/_launch_add.py +255 -0
  315. wandb/sdk/launch/_project_spec.py +566 -0
  316. wandb/sdk/launch/agent/__init__.py +5 -0
  317. wandb/sdk/launch/agent/agent.py +924 -0
  318. wandb/sdk/launch/agent/config.py +296 -0
  319. wandb/sdk/launch/agent/job_status_tracker.py +53 -0
  320. wandb/sdk/launch/agent/run_queue_item_file_saver.py +39 -0
  321. wandb/sdk/launch/builder/__init__.py +0 -0
  322. wandb/sdk/launch/builder/abstract.py +156 -0
  323. wandb/sdk/launch/builder/build.py +297 -0
  324. wandb/sdk/launch/builder/context_manager.py +235 -0
  325. wandb/sdk/launch/builder/docker_builder.py +177 -0
  326. wandb/sdk/launch/builder/kaniko_builder.py +594 -0
  327. wandb/sdk/launch/builder/noop.py +58 -0
  328. wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +188 -0
  329. wandb/sdk/launch/builder/templates/dockerfile.py +92 -0
  330. wandb/sdk/launch/create_job.py +528 -0
  331. wandb/sdk/launch/environment/abstract.py +29 -0
  332. wandb/sdk/launch/environment/aws_environment.py +322 -0
  333. wandb/sdk/launch/environment/azure_environment.py +105 -0
  334. wandb/sdk/launch/environment/gcp_environment.py +335 -0
  335. wandb/sdk/launch/environment/local_environment.py +65 -0
  336. wandb/sdk/launch/errors.py +13 -0
  337. wandb/sdk/launch/git_reference.py +109 -0
  338. wandb/sdk/launch/inputs/files.py +148 -0
  339. wandb/sdk/launch/inputs/internal.py +315 -0
  340. wandb/sdk/launch/inputs/manage.py +113 -0
  341. wandb/sdk/launch/inputs/schema.py +39 -0
  342. wandb/sdk/launch/loader.py +249 -0
  343. wandb/sdk/launch/registry/abstract.py +48 -0
  344. wandb/sdk/launch/registry/anon.py +29 -0
  345. wandb/sdk/launch/registry/azure_container_registry.py +124 -0
  346. wandb/sdk/launch/registry/elastic_container_registry.py +192 -0
  347. wandb/sdk/launch/registry/google_artifact_registry.py +219 -0
  348. wandb/sdk/launch/registry/local_registry.py +65 -0
  349. wandb/sdk/launch/runner/__init__.py +0 -0
  350. wandb/sdk/launch/runner/abstract.py +185 -0
  351. wandb/sdk/launch/runner/kubernetes_monitor.py +472 -0
  352. wandb/sdk/launch/runner/kubernetes_runner.py +963 -0
  353. wandb/sdk/launch/runner/local_container.py +301 -0
  354. wandb/sdk/launch/runner/local_process.py +78 -0
  355. wandb/sdk/launch/runner/sagemaker_runner.py +426 -0
  356. wandb/sdk/launch/runner/vertex_runner.py +230 -0
  357. wandb/sdk/launch/sweeps/__init__.py +37 -0
  358. wandb/sdk/launch/sweeps/scheduler.py +740 -0
  359. wandb/sdk/launch/sweeps/scheduler_sweep.py +90 -0
  360. wandb/sdk/launch/sweeps/utils.py +316 -0
  361. wandb/sdk/launch/utils.py +747 -0
  362. wandb/sdk/launch/wandb_reference.py +138 -0
  363. wandb/sdk/lib/__init__.py +5 -0
  364. wandb/sdk/lib/apikey.py +269 -0
  365. wandb/sdk/lib/capped_dict.py +26 -0
  366. wandb/sdk/lib/config_util.py +101 -0
  367. wandb/sdk/lib/credentials.py +141 -0
  368. wandb/sdk/lib/deprecate.py +42 -0
  369. wandb/sdk/lib/disabled.py +29 -0
  370. wandb/sdk/lib/exit_hooks.py +54 -0
  371. wandb/sdk/lib/file_stream_utils.py +118 -0
  372. wandb/sdk/lib/filenames.py +64 -0
  373. wandb/sdk/lib/filesystem.py +372 -0
  374. wandb/sdk/lib/fsm.py +180 -0
  375. wandb/sdk/lib/gitlib.py +239 -0
  376. wandb/sdk/lib/gql_request.py +65 -0
  377. wandb/sdk/lib/handler_util.py +21 -0
  378. wandb/sdk/lib/hashutil.py +84 -0
  379. wandb/sdk/lib/import_hooks.py +275 -0
  380. wandb/sdk/lib/ipython.py +126 -0
  381. wandb/sdk/lib/json_util.py +80 -0
  382. wandb/sdk/lib/lazyloader.py +63 -0
  383. wandb/sdk/lib/mailbox.py +456 -0
  384. wandb/sdk/lib/module.py +78 -0
  385. wandb/sdk/lib/paths.py +106 -0
  386. wandb/sdk/lib/preinit.py +42 -0
  387. wandb/sdk/lib/printer.py +548 -0
  388. wandb/sdk/lib/progress.py +279 -0
  389. wandb/sdk/lib/proto_util.py +90 -0
  390. wandb/sdk/lib/redirect.py +845 -0
  391. wandb/sdk/lib/retry.py +289 -0
  392. wandb/sdk/lib/run_moment.py +72 -0
  393. wandb/sdk/lib/runid.py +12 -0
  394. wandb/sdk/lib/server.py +38 -0
  395. wandb/sdk/lib/service_connection.py +216 -0
  396. wandb/sdk/lib/service_token.py +94 -0
  397. wandb/sdk/lib/sock_client.py +290 -0
  398. wandb/sdk/lib/sparkline.py +44 -0
  399. wandb/sdk/lib/telemetry.py +100 -0
  400. wandb/sdk/lib/timed_input.py +133 -0
  401. wandb/sdk/lib/timer.py +19 -0
  402. wandb/sdk/service/__init__.py +0 -0
  403. wandb/sdk/service/_startup_debug.py +22 -0
  404. wandb/sdk/service/port_file.py +53 -0
  405. wandb/sdk/service/server.py +107 -0
  406. wandb/sdk/service/server_sock.py +274 -0
  407. wandb/sdk/service/service.py +242 -0
  408. wandb/sdk/service/streams.py +425 -0
  409. wandb/sdk/verify/__init__.py +0 -0
  410. wandb/sdk/verify/verify.py +501 -0
  411. wandb/sdk/wandb_alerts.py +12 -0
  412. wandb/sdk/wandb_config.py +322 -0
  413. wandb/sdk/wandb_helper.py +54 -0
  414. wandb/sdk/wandb_init.py +1313 -0
  415. wandb/sdk/wandb_login.py +339 -0
  416. wandb/sdk/wandb_metric.py +110 -0
  417. wandb/sdk/wandb_require.py +94 -0
  418. wandb/sdk/wandb_require_helpers.py +44 -0
  419. wandb/sdk/wandb_run.py +4066 -0
  420. wandb/sdk/wandb_settings.py +1309 -0
  421. wandb/sdk/wandb_setup.py +402 -0
  422. wandb/sdk/wandb_summary.py +150 -0
  423. wandb/sdk/wandb_sweep.py +119 -0
  424. wandb/sdk/wandb_sync.py +82 -0
  425. wandb/sdk/wandb_watch.py +150 -0
  426. wandb/sklearn.py +35 -0
  427. wandb/sync/__init__.py +3 -0
  428. wandb/sync/sync.py +442 -0
  429. wandb/trigger.py +29 -0
  430. wandb/util.py +1955 -0
  431. wandb/vendor/__init__.py +0 -0
  432. wandb/vendor/gql-0.2.0/setup.py +40 -0
  433. wandb/vendor/gql-0.2.0/tests/__init__.py +0 -0
  434. wandb/vendor/gql-0.2.0/tests/starwars/__init__.py +0 -0
  435. wandb/vendor/gql-0.2.0/tests/starwars/fixtures.py +96 -0
  436. wandb/vendor/gql-0.2.0/tests/starwars/schema.py +146 -0
  437. wandb/vendor/gql-0.2.0/tests/starwars/test_dsl.py +293 -0
  438. wandb/vendor/gql-0.2.0/tests/starwars/test_query.py +355 -0
  439. wandb/vendor/gql-0.2.0/tests/starwars/test_validation.py +171 -0
  440. wandb/vendor/gql-0.2.0/tests/test_client.py +31 -0
  441. wandb/vendor/gql-0.2.0/tests/test_transport.py +89 -0
  442. wandb/vendor/gql-0.2.0/wandb_gql/__init__.py +4 -0
  443. wandb/vendor/gql-0.2.0/wandb_gql/client.py +75 -0
  444. wandb/vendor/gql-0.2.0/wandb_gql/dsl.py +152 -0
  445. wandb/vendor/gql-0.2.0/wandb_gql/gql.py +10 -0
  446. wandb/vendor/gql-0.2.0/wandb_gql/transport/__init__.py +0 -0
  447. wandb/vendor/gql-0.2.0/wandb_gql/transport/http.py +6 -0
  448. wandb/vendor/gql-0.2.0/wandb_gql/transport/local_schema.py +15 -0
  449. wandb/vendor/gql-0.2.0/wandb_gql/transport/requests.py +46 -0
  450. wandb/vendor/gql-0.2.0/wandb_gql/utils.py +21 -0
  451. wandb/vendor/graphql-core-1.1/setup.py +86 -0
  452. wandb/vendor/graphql-core-1.1/wandb_graphql/__init__.py +287 -0
  453. wandb/vendor/graphql-core-1.1/wandb_graphql/error/__init__.py +6 -0
  454. wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py +42 -0
  455. wandb/vendor/graphql-core-1.1/wandb_graphql/error/format_error.py +11 -0
  456. wandb/vendor/graphql-core-1.1/wandb_graphql/error/located_error.py +29 -0
  457. wandb/vendor/graphql-core-1.1/wandb_graphql/error/syntax_error.py +36 -0
  458. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__init__.py +26 -0
  459. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py +311 -0
  460. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executor.py +398 -0
  461. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__init__.py +0 -0
  462. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/asyncio.py +53 -0
  463. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/gevent.py +22 -0
  464. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/process.py +32 -0
  465. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/sync.py +7 -0
  466. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/thread.py +35 -0
  467. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/utils.py +6 -0
  468. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__init__.py +0 -0
  469. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/executor.py +66 -0
  470. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/fragment.py +252 -0
  471. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/resolver.py +151 -0
  472. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/utils.py +7 -0
  473. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/middleware.py +57 -0
  474. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py +145 -0
  475. wandb/vendor/graphql-core-1.1/wandb_graphql/graphql.py +60 -0
  476. wandb/vendor/graphql-core-1.1/wandb_graphql/language/__init__.py +0 -0
  477. wandb/vendor/graphql-core-1.1/wandb_graphql/language/ast.py +1349 -0
  478. wandb/vendor/graphql-core-1.1/wandb_graphql/language/base.py +19 -0
  479. wandb/vendor/graphql-core-1.1/wandb_graphql/language/lexer.py +435 -0
  480. wandb/vendor/graphql-core-1.1/wandb_graphql/language/location.py +30 -0
  481. wandb/vendor/graphql-core-1.1/wandb_graphql/language/parser.py +779 -0
  482. wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py +193 -0
  483. wandb/vendor/graphql-core-1.1/wandb_graphql/language/source.py +18 -0
  484. wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor.py +222 -0
  485. wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor_meta.py +82 -0
  486. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__init__.py +0 -0
  487. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/cached_property.py +17 -0
  488. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/contain_subset.py +28 -0
  489. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/default_ordered_dict.py +40 -0
  490. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/ordereddict.py +8 -0
  491. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/pair_set.py +43 -0
  492. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/version.py +78 -0
  493. wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py +67 -0
  494. wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py +619 -0
  495. wandb/vendor/graphql-core-1.1/wandb_graphql/type/directives.py +132 -0
  496. wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py +440 -0
  497. wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py +131 -0
  498. wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py +100 -0
  499. wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py +145 -0
  500. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__init__.py +0 -0
  501. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/assert_valid_name.py +9 -0
  502. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_from_value.py +65 -0
  503. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_code.py +49 -0
  504. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_dict.py +24 -0
  505. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/base.py +75 -0
  506. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_ast_schema.py +291 -0
  507. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_client_schema.py +250 -0
  508. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/concat_ast.py +9 -0
  509. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/extend_schema.py +357 -0
  510. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_field_def.py +27 -0
  511. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_operation_ast.py +21 -0
  512. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/introspection_query.py +90 -0
  513. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_literal_value.py +67 -0
  514. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_value.py +66 -0
  515. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/quoted_or_list.py +21 -0
  516. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/schema_printer.py +168 -0
  517. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/suggestion_list.py +56 -0
  518. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_comparators.py +69 -0
  519. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_from_ast.py +21 -0
  520. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_info.py +149 -0
  521. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/value_from_ast.py +69 -0
  522. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/__init__.py +4 -0
  523. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__init__.py +79 -0
  524. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/arguments_of_correct_type.py +24 -0
  525. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/base.py +8 -0
  526. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/default_values_of_correct_type.py +44 -0
  527. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fields_on_correct_type.py +113 -0
  528. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fragments_on_composite_types.py +33 -0
  529. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_argument_names.py +70 -0
  530. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_directives.py +97 -0
  531. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_fragment_names.py +19 -0
  532. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_type_names.py +43 -0
  533. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/lone_anonymous_operation.py +23 -0
  534. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_fragment_cycles.py +59 -0
  535. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_undefined_variables.py +36 -0
  536. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_fragments.py +38 -0
  537. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_variables.py +37 -0
  538. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/overlapping_fields_can_be_merged.py +529 -0
  539. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/possible_fragment_spreads.py +44 -0
  540. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/provided_non_null_arguments.py +46 -0
  541. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/scalar_leafs.py +33 -0
  542. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_argument_names.py +32 -0
  543. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_fragment_names.py +28 -0
  544. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_input_field_names.py +33 -0
  545. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_operation_names.py +31 -0
  546. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_variable_names.py +27 -0
  547. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_are_input_types.py +21 -0
  548. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_in_allowed_position.py +53 -0
  549. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/validation.py +158 -0
  550. wandb/vendor/promise-2.3.0/conftest.py +30 -0
  551. wandb/vendor/promise-2.3.0/setup.py +64 -0
  552. wandb/vendor/promise-2.3.0/tests/__init__.py +0 -0
  553. wandb/vendor/promise-2.3.0/tests/conftest.py +8 -0
  554. wandb/vendor/promise-2.3.0/tests/test_awaitable.py +32 -0
  555. wandb/vendor/promise-2.3.0/tests/test_awaitable_35.py +47 -0
  556. wandb/vendor/promise-2.3.0/tests/test_benchmark.py +116 -0
  557. wandb/vendor/promise-2.3.0/tests/test_complex_threads.py +23 -0
  558. wandb/vendor/promise-2.3.0/tests/test_dataloader.py +452 -0
  559. wandb/vendor/promise-2.3.0/tests/test_dataloader_awaitable_35.py +99 -0
  560. wandb/vendor/promise-2.3.0/tests/test_dataloader_extra.py +65 -0
  561. wandb/vendor/promise-2.3.0/tests/test_extra.py +670 -0
  562. wandb/vendor/promise-2.3.0/tests/test_issues.py +132 -0
  563. wandb/vendor/promise-2.3.0/tests/test_promise_list.py +70 -0
  564. wandb/vendor/promise-2.3.0/tests/test_spec.py +584 -0
  565. wandb/vendor/promise-2.3.0/tests/test_thread_safety.py +115 -0
  566. wandb/vendor/promise-2.3.0/tests/utils.py +3 -0
  567. wandb/vendor/promise-2.3.0/wandb_promise/__init__.py +38 -0
  568. wandb/vendor/promise-2.3.0/wandb_promise/async_.py +135 -0
  569. wandb/vendor/promise-2.3.0/wandb_promise/compat.py +32 -0
  570. wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py +326 -0
  571. wandb/vendor/promise-2.3.0/wandb_promise/iterate_promise.py +12 -0
  572. wandb/vendor/promise-2.3.0/wandb_promise/promise.py +848 -0
  573. wandb/vendor/promise-2.3.0/wandb_promise/promise_list.py +151 -0
  574. wandb/vendor/promise-2.3.0/wandb_promise/pyutils/__init__.py +0 -0
  575. wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py +83 -0
  576. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__init__.py +0 -0
  577. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py +22 -0
  578. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/gevent.py +21 -0
  579. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/immediate.py +27 -0
  580. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/thread.py +18 -0
  581. wandb/vendor/promise-2.3.0/wandb_promise/utils.py +56 -0
  582. wandb/vendor/pygments/__init__.py +90 -0
  583. wandb/vendor/pygments/cmdline.py +568 -0
  584. wandb/vendor/pygments/console.py +74 -0
  585. wandb/vendor/pygments/filter.py +74 -0
  586. wandb/vendor/pygments/filters/__init__.py +350 -0
  587. wandb/vendor/pygments/formatter.py +95 -0
  588. wandb/vendor/pygments/formatters/__init__.py +153 -0
  589. wandb/vendor/pygments/formatters/_mapping.py +85 -0
  590. wandb/vendor/pygments/formatters/bbcode.py +109 -0
  591. wandb/vendor/pygments/formatters/html.py +851 -0
  592. wandb/vendor/pygments/formatters/img.py +600 -0
  593. wandb/vendor/pygments/formatters/irc.py +182 -0
  594. wandb/vendor/pygments/formatters/latex.py +482 -0
  595. wandb/vendor/pygments/formatters/other.py +160 -0
  596. wandb/vendor/pygments/formatters/rtf.py +147 -0
  597. wandb/vendor/pygments/formatters/svg.py +153 -0
  598. wandb/vendor/pygments/formatters/terminal.py +136 -0
  599. wandb/vendor/pygments/formatters/terminal256.py +309 -0
  600. wandb/vendor/pygments/lexer.py +871 -0
  601. wandb/vendor/pygments/lexers/__init__.py +329 -0
  602. wandb/vendor/pygments/lexers/_asy_builtins.py +1645 -0
  603. wandb/vendor/pygments/lexers/_cl_builtins.py +232 -0
  604. wandb/vendor/pygments/lexers/_cocoa_builtins.py +72 -0
  605. wandb/vendor/pygments/lexers/_csound_builtins.py +1346 -0
  606. wandb/vendor/pygments/lexers/_lasso_builtins.py +5327 -0
  607. wandb/vendor/pygments/lexers/_lua_builtins.py +295 -0
  608. wandb/vendor/pygments/lexers/_mapping.py +500 -0
  609. wandb/vendor/pygments/lexers/_mql_builtins.py +1172 -0
  610. wandb/vendor/pygments/lexers/_openedge_builtins.py +2547 -0
  611. wandb/vendor/pygments/lexers/_php_builtins.py +4756 -0
  612. wandb/vendor/pygments/lexers/_postgres_builtins.py +621 -0
  613. wandb/vendor/pygments/lexers/_scilab_builtins.py +3094 -0
  614. wandb/vendor/pygments/lexers/_sourcemod_builtins.py +1163 -0
  615. wandb/vendor/pygments/lexers/_stan_builtins.py +532 -0
  616. wandb/vendor/pygments/lexers/_stata_builtins.py +419 -0
  617. wandb/vendor/pygments/lexers/_tsql_builtins.py +1004 -0
  618. wandb/vendor/pygments/lexers/_vim_builtins.py +1939 -0
  619. wandb/vendor/pygments/lexers/actionscript.py +240 -0
  620. wandb/vendor/pygments/lexers/agile.py +24 -0
  621. wandb/vendor/pygments/lexers/algebra.py +221 -0
  622. wandb/vendor/pygments/lexers/ambient.py +76 -0
  623. wandb/vendor/pygments/lexers/ampl.py +87 -0
  624. wandb/vendor/pygments/lexers/apl.py +101 -0
  625. wandb/vendor/pygments/lexers/archetype.py +318 -0
  626. wandb/vendor/pygments/lexers/asm.py +641 -0
  627. wandb/vendor/pygments/lexers/automation.py +374 -0
  628. wandb/vendor/pygments/lexers/basic.py +500 -0
  629. wandb/vendor/pygments/lexers/bibtex.py +160 -0
  630. wandb/vendor/pygments/lexers/business.py +612 -0
  631. wandb/vendor/pygments/lexers/c_cpp.py +252 -0
  632. wandb/vendor/pygments/lexers/c_like.py +541 -0
  633. wandb/vendor/pygments/lexers/capnproto.py +78 -0
  634. wandb/vendor/pygments/lexers/chapel.py +102 -0
  635. wandb/vendor/pygments/lexers/clean.py +288 -0
  636. wandb/vendor/pygments/lexers/compiled.py +34 -0
  637. wandb/vendor/pygments/lexers/configs.py +833 -0
  638. wandb/vendor/pygments/lexers/console.py +114 -0
  639. wandb/vendor/pygments/lexers/crystal.py +393 -0
  640. wandb/vendor/pygments/lexers/csound.py +366 -0
  641. wandb/vendor/pygments/lexers/css.py +689 -0
  642. wandb/vendor/pygments/lexers/d.py +251 -0
  643. wandb/vendor/pygments/lexers/dalvik.py +125 -0
  644. wandb/vendor/pygments/lexers/data.py +555 -0
  645. wandb/vendor/pygments/lexers/diff.py +165 -0
  646. wandb/vendor/pygments/lexers/dotnet.py +691 -0
  647. wandb/vendor/pygments/lexers/dsls.py +878 -0
  648. wandb/vendor/pygments/lexers/dylan.py +289 -0
  649. wandb/vendor/pygments/lexers/ecl.py +125 -0
  650. wandb/vendor/pygments/lexers/eiffel.py +65 -0
  651. wandb/vendor/pygments/lexers/elm.py +121 -0
  652. wandb/vendor/pygments/lexers/erlang.py +533 -0
  653. wandb/vendor/pygments/lexers/esoteric.py +277 -0
  654. wandb/vendor/pygments/lexers/ezhil.py +69 -0
  655. wandb/vendor/pygments/lexers/factor.py +344 -0
  656. wandb/vendor/pygments/lexers/fantom.py +250 -0
  657. wandb/vendor/pygments/lexers/felix.py +273 -0
  658. wandb/vendor/pygments/lexers/forth.py +177 -0
  659. wandb/vendor/pygments/lexers/fortran.py +205 -0
  660. wandb/vendor/pygments/lexers/foxpro.py +428 -0
  661. wandb/vendor/pygments/lexers/functional.py +21 -0
  662. wandb/vendor/pygments/lexers/go.py +101 -0
  663. wandb/vendor/pygments/lexers/grammar_notation.py +213 -0
  664. wandb/vendor/pygments/lexers/graph.py +80 -0
  665. wandb/vendor/pygments/lexers/graphics.py +553 -0
  666. wandb/vendor/pygments/lexers/haskell.py +843 -0
  667. wandb/vendor/pygments/lexers/haxe.py +936 -0
  668. wandb/vendor/pygments/lexers/hdl.py +382 -0
  669. wandb/vendor/pygments/lexers/hexdump.py +103 -0
  670. wandb/vendor/pygments/lexers/html.py +602 -0
  671. wandb/vendor/pygments/lexers/idl.py +270 -0
  672. wandb/vendor/pygments/lexers/igor.py +288 -0
  673. wandb/vendor/pygments/lexers/inferno.py +96 -0
  674. wandb/vendor/pygments/lexers/installers.py +322 -0
  675. wandb/vendor/pygments/lexers/int_fiction.py +1343 -0
  676. wandb/vendor/pygments/lexers/iolang.py +63 -0
  677. wandb/vendor/pygments/lexers/j.py +146 -0
  678. wandb/vendor/pygments/lexers/javascript.py +1525 -0
  679. wandb/vendor/pygments/lexers/julia.py +333 -0
  680. wandb/vendor/pygments/lexers/jvm.py +1573 -0
  681. wandb/vendor/pygments/lexers/lisp.py +2621 -0
  682. wandb/vendor/pygments/lexers/make.py +202 -0
  683. wandb/vendor/pygments/lexers/markup.py +595 -0
  684. wandb/vendor/pygments/lexers/math.py +21 -0
  685. wandb/vendor/pygments/lexers/matlab.py +663 -0
  686. wandb/vendor/pygments/lexers/ml.py +769 -0
  687. wandb/vendor/pygments/lexers/modeling.py +358 -0
  688. wandb/vendor/pygments/lexers/modula2.py +1561 -0
  689. wandb/vendor/pygments/lexers/monte.py +204 -0
  690. wandb/vendor/pygments/lexers/ncl.py +894 -0
  691. wandb/vendor/pygments/lexers/nimrod.py +159 -0
  692. wandb/vendor/pygments/lexers/nit.py +64 -0
  693. wandb/vendor/pygments/lexers/nix.py +136 -0
  694. wandb/vendor/pygments/lexers/oberon.py +105 -0
  695. wandb/vendor/pygments/lexers/objective.py +504 -0
  696. wandb/vendor/pygments/lexers/ooc.py +85 -0
  697. wandb/vendor/pygments/lexers/other.py +41 -0
  698. wandb/vendor/pygments/lexers/parasail.py +79 -0
  699. wandb/vendor/pygments/lexers/parsers.py +835 -0
  700. wandb/vendor/pygments/lexers/pascal.py +644 -0
  701. wandb/vendor/pygments/lexers/pawn.py +199 -0
  702. wandb/vendor/pygments/lexers/perl.py +620 -0
  703. wandb/vendor/pygments/lexers/php.py +267 -0
  704. wandb/vendor/pygments/lexers/praat.py +294 -0
  705. wandb/vendor/pygments/lexers/prolog.py +306 -0
  706. wandb/vendor/pygments/lexers/python.py +939 -0
  707. wandb/vendor/pygments/lexers/qvt.py +152 -0
  708. wandb/vendor/pygments/lexers/r.py +453 -0
  709. wandb/vendor/pygments/lexers/rdf.py +270 -0
  710. wandb/vendor/pygments/lexers/rebol.py +431 -0
  711. wandb/vendor/pygments/lexers/resource.py +85 -0
  712. wandb/vendor/pygments/lexers/rnc.py +67 -0
  713. wandb/vendor/pygments/lexers/roboconf.py +82 -0
  714. wandb/vendor/pygments/lexers/robotframework.py +560 -0
  715. wandb/vendor/pygments/lexers/ruby.py +519 -0
  716. wandb/vendor/pygments/lexers/rust.py +220 -0
  717. wandb/vendor/pygments/lexers/sas.py +228 -0
  718. wandb/vendor/pygments/lexers/scripting.py +1222 -0
  719. wandb/vendor/pygments/lexers/shell.py +794 -0
  720. wandb/vendor/pygments/lexers/smalltalk.py +195 -0
  721. wandb/vendor/pygments/lexers/smv.py +79 -0
  722. wandb/vendor/pygments/lexers/snobol.py +83 -0
  723. wandb/vendor/pygments/lexers/special.py +103 -0
  724. wandb/vendor/pygments/lexers/sql.py +681 -0
  725. wandb/vendor/pygments/lexers/stata.py +108 -0
  726. wandb/vendor/pygments/lexers/supercollider.py +90 -0
  727. wandb/vendor/pygments/lexers/tcl.py +145 -0
  728. wandb/vendor/pygments/lexers/templates.py +2283 -0
  729. wandb/vendor/pygments/lexers/testing.py +207 -0
  730. wandb/vendor/pygments/lexers/text.py +25 -0
  731. wandb/vendor/pygments/lexers/textedit.py +169 -0
  732. wandb/vendor/pygments/lexers/textfmts.py +297 -0
  733. wandb/vendor/pygments/lexers/theorem.py +458 -0
  734. wandb/vendor/pygments/lexers/trafficscript.py +54 -0
  735. wandb/vendor/pygments/lexers/typoscript.py +226 -0
  736. wandb/vendor/pygments/lexers/urbi.py +133 -0
  737. wandb/vendor/pygments/lexers/varnish.py +190 -0
  738. wandb/vendor/pygments/lexers/verification.py +111 -0
  739. wandb/vendor/pygments/lexers/web.py +24 -0
  740. wandb/vendor/pygments/lexers/webmisc.py +988 -0
  741. wandb/vendor/pygments/lexers/whiley.py +116 -0
  742. wandb/vendor/pygments/lexers/x10.py +69 -0
  743. wandb/vendor/pygments/modeline.py +44 -0
  744. wandb/vendor/pygments/plugin.py +68 -0
  745. wandb/vendor/pygments/regexopt.py +92 -0
  746. wandb/vendor/pygments/scanner.py +105 -0
  747. wandb/vendor/pygments/sphinxext.py +158 -0
  748. wandb/vendor/pygments/style.py +155 -0
  749. wandb/vendor/pygments/styles/__init__.py +80 -0
  750. wandb/vendor/pygments/styles/abap.py +29 -0
  751. wandb/vendor/pygments/styles/algol.py +63 -0
  752. wandb/vendor/pygments/styles/algol_nu.py +63 -0
  753. wandb/vendor/pygments/styles/arduino.py +98 -0
  754. wandb/vendor/pygments/styles/autumn.py +65 -0
  755. wandb/vendor/pygments/styles/borland.py +51 -0
  756. wandb/vendor/pygments/styles/bw.py +49 -0
  757. wandb/vendor/pygments/styles/colorful.py +81 -0
  758. wandb/vendor/pygments/styles/default.py +73 -0
  759. wandb/vendor/pygments/styles/emacs.py +72 -0
  760. wandb/vendor/pygments/styles/friendly.py +72 -0
  761. wandb/vendor/pygments/styles/fruity.py +42 -0
  762. wandb/vendor/pygments/styles/igor.py +29 -0
  763. wandb/vendor/pygments/styles/lovelace.py +97 -0
  764. wandb/vendor/pygments/styles/manni.py +75 -0
  765. wandb/vendor/pygments/styles/monokai.py +106 -0
  766. wandb/vendor/pygments/styles/murphy.py +80 -0
  767. wandb/vendor/pygments/styles/native.py +65 -0
  768. wandb/vendor/pygments/styles/paraiso_dark.py +125 -0
  769. wandb/vendor/pygments/styles/paraiso_light.py +125 -0
  770. wandb/vendor/pygments/styles/pastie.py +75 -0
  771. wandb/vendor/pygments/styles/perldoc.py +69 -0
  772. wandb/vendor/pygments/styles/rainbow_dash.py +89 -0
  773. wandb/vendor/pygments/styles/rrt.py +33 -0
  774. wandb/vendor/pygments/styles/sas.py +44 -0
  775. wandb/vendor/pygments/styles/stata.py +40 -0
  776. wandb/vendor/pygments/styles/tango.py +141 -0
  777. wandb/vendor/pygments/styles/trac.py +63 -0
  778. wandb/vendor/pygments/styles/vim.py +63 -0
  779. wandb/vendor/pygments/styles/vs.py +38 -0
  780. wandb/vendor/pygments/styles/xcode.py +51 -0
  781. wandb/vendor/pygments/token.py +213 -0
  782. wandb/vendor/pygments/unistring.py +217 -0
  783. wandb/vendor/pygments/util.py +388 -0
  784. wandb/vendor/pynvml/__init__.py +0 -0
  785. wandb/vendor/pynvml/pynvml.py +4779 -0
  786. wandb/vendor/watchdog_0_9_0/wandb_watchdog/__init__.py +17 -0
  787. wandb/vendor/watchdog_0_9_0/wandb_watchdog/events.py +615 -0
  788. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__init__.py +98 -0
  789. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py +369 -0
  790. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py +172 -0
  791. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents2.py +239 -0
  792. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py +218 -0
  793. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py +81 -0
  794. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_c.py +575 -0
  795. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/kqueue.py +730 -0
  796. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/polling.py +145 -0
  797. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py +133 -0
  798. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py +348 -0
  799. wandb/vendor/watchdog_0_9_0/wandb_watchdog/patterns.py +265 -0
  800. wandb/vendor/watchdog_0_9_0/wandb_watchdog/tricks/__init__.py +174 -0
  801. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__init__.py +151 -0
  802. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/bricks.py +249 -0
  803. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/compat.py +29 -0
  804. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py +198 -0
  805. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/delayed_queue.py +88 -0
  806. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/dirsnapshot.py +293 -0
  807. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/echo.py +157 -0
  808. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py +41 -0
  809. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/importlib2.py +40 -0
  810. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/platform.py +57 -0
  811. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/unicode_paths.py +64 -0
  812. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/win32stat.py +123 -0
  813. wandb/vendor/watchdog_0_9_0/wandb_watchdog/version.py +28 -0
  814. wandb/vendor/watchdog_0_9_0/wandb_watchdog/watchmedo.py +577 -0
  815. wandb/wandb_agent.py +588 -0
  816. wandb/wandb_controller.py +719 -0
  817. wandb/wandb_run.py +9 -0
  818. wandb-0.19.1.dist-info/METADATA +223 -0
  819. wandb-0.19.1.dist-info/RECORD +822 -0
  820. wandb-0.19.1.dist-info/WHEEL +5 -0
  821. wandb-0.19.1.dist-info/entry_points.txt +3 -0
  822. wandb-0.19.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1222 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pygments.lexers.scripting
4
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
5
+
6
+ Lexer for scripting and embedded languages.
7
+
8
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ import re
13
+
14
+ from pygments.lexer import RegexLexer, include, bygroups, default, combined, \
15
+ words
16
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
17
+ Number, Punctuation, Error, Whitespace, Other
18
+ from pygments.util import get_bool_opt, get_list_opt, iteritems
19
+
20
+ __all__ = ['LuaLexer', 'MoonScriptLexer', 'ChaiscriptLexer', 'LSLLexer',
21
+ 'AppleScriptLexer', 'RexxLexer', 'MOOCodeLexer', 'HybrisLexer',
22
+ 'EasytrieveLexer', 'JclLexer']
23
+
24
+
25
+ class LuaLexer(RegexLexer):
26
+ """
27
+ For `Lua <http://www.lua.org>`_ source code.
28
+
29
+ Additional options accepted:
30
+
31
+ `func_name_highlighting`
32
+ If given and ``True``, highlight builtin function names
33
+ (default: ``True``).
34
+ `disabled_modules`
35
+ If given, must be a list of module names whose function names
36
+ should not be highlighted. By default all modules are highlighted.
37
+
38
+ To get a list of allowed modules have a look into the
39
+ `_lua_builtins` module:
40
+
41
+ .. sourcecode:: pycon
42
+
43
+ >>> from pygments.lexers._lua_builtins import MODULES
44
+ >>> MODULES.keys()
45
+ ['string', 'coroutine', 'modules', 'io', 'basic', ...]
46
+ """
47
+
48
+ name = 'Lua'
49
+ aliases = ['lua']
50
+ filenames = ['*.lua', '*.wlua']
51
+ mimetypes = ['text/x-lua', 'application/x-lua']
52
+
53
+ _comment_multiline = r'(?:--\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])'
54
+ _comment_single = r'(?:--.*$)'
55
+ _space = r'(?:\s+)'
56
+ _s = r'(?:%s|%s|%s)' % (_comment_multiline, _comment_single, _space)
57
+ _name = r'(?:[^\W\d]\w*)'
58
+
59
+ tokens = {
60
+ 'root': [
61
+ # Lua allows a file to start with a shebang.
62
+ (r'#!.*', Comment.Preproc),
63
+ default('base'),
64
+ ],
65
+ 'ws': [
66
+ (_comment_multiline, Comment.Multiline),
67
+ (_comment_single, Comment.Single),
68
+ (_space, Text),
69
+ ],
70
+ 'base': [
71
+ include('ws'),
72
+
73
+ (r'(?i)0x[\da-f]*(\.[\da-f]*)?(p[+-]?\d+)?', Number.Hex),
74
+ (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
75
+ (r'(?i)\d+e[+-]?\d+', Number.Float),
76
+ (r'\d+', Number.Integer),
77
+
78
+ # multiline strings
79
+ (r'(?s)\[(=*)\[.*?\]\1\]', String),
80
+
81
+ (r'::', Punctuation, 'label'),
82
+ (r'\.{3}', Punctuation),
83
+ (r'[=<>|~&+\-*/%#^]+|\.\.', Operator),
84
+ (r'[\[\]{}().,:;]', Punctuation),
85
+ (r'(and|or|not)\b', Operator.Word),
86
+
87
+ ('(break|do|else|elseif|end|for|if|in|repeat|return|then|until|'
88
+ r'while)\b', Keyword.Reserved),
89
+ (r'goto\b', Keyword.Reserved, 'goto'),
90
+ (r'(local)\b', Keyword.Declaration),
91
+ (r'(true|false|nil)\b', Keyword.Constant),
92
+
93
+ (r'(function)\b', Keyword.Reserved, 'funcname'),
94
+
95
+ (r'[A-Za-z_]\w*(\.[A-Za-z_]\w*)?', Name),
96
+
97
+ ("'", String.Single, combined('stringescape', 'sqs')),
98
+ ('"', String.Double, combined('stringescape', 'dqs'))
99
+ ],
100
+
101
+ 'funcname': [
102
+ include('ws'),
103
+ (r'[.:]', Punctuation),
104
+ (r'%s(?=%s*[.:])' % (_name, _s), Name.Class),
105
+ (_name, Name.Function, '#pop'),
106
+ # inline function
107
+ ('\(', Punctuation, '#pop'),
108
+ ],
109
+
110
+ 'goto': [
111
+ include('ws'),
112
+ (_name, Name.Label, '#pop'),
113
+ ],
114
+
115
+ 'label': [
116
+ include('ws'),
117
+ (r'::', Punctuation, '#pop'),
118
+ (_name, Name.Label),
119
+ ],
120
+
121
+ 'stringescape': [
122
+ (r'\\([abfnrtv\\"\']|[\r\n]{1,2}|z\s*|x[0-9a-fA-F]{2}|\d{1,3}|'
123
+ r'u\{[0-9a-fA-F]+\})', String.Escape),
124
+ ],
125
+
126
+ 'sqs': [
127
+ (r"'", String.Single, '#pop'),
128
+ (r"[^\\']+", String.Single),
129
+ ],
130
+
131
+ 'dqs': [
132
+ (r'"', String.Double, '#pop'),
133
+ (r'[^\\"]+', String.Double),
134
+ ]
135
+ }
136
+
137
+ def __init__(self, **options):
138
+ self.func_name_highlighting = get_bool_opt(
139
+ options, 'func_name_highlighting', True)
140
+ self.disabled_modules = get_list_opt(options, 'disabled_modules', [])
141
+
142
+ self._functions = set()
143
+ if self.func_name_highlighting:
144
+ from pygments.lexers._lua_builtins import MODULES
145
+ for mod, func in iteritems(MODULES):
146
+ if mod not in self.disabled_modules:
147
+ self._functions.update(func)
148
+ RegexLexer.__init__(self, **options)
149
+
150
+ def get_tokens_unprocessed(self, text):
151
+ for index, token, value in \
152
+ RegexLexer.get_tokens_unprocessed(self, text):
153
+ if token is Name:
154
+ if value in self._functions:
155
+ yield index, Name.Builtin, value
156
+ continue
157
+ elif '.' in value:
158
+ a, b = value.split('.')
159
+ yield index, Name, a
160
+ yield index + len(a), Punctuation, u'.'
161
+ yield index + len(a) + 1, Name, b
162
+ continue
163
+ yield index, token, value
164
+
165
+
166
+ class MoonScriptLexer(LuaLexer):
167
+ """
168
+ For `MoonScript <http://moonscript.org>`_ source code.
169
+
170
+ .. versionadded:: 1.5
171
+ """
172
+
173
+ name = "MoonScript"
174
+ aliases = ["moon", "moonscript"]
175
+ filenames = ["*.moon"]
176
+ mimetypes = ['text/x-moonscript', 'application/x-moonscript']
177
+
178
+ tokens = {
179
+ 'root': [
180
+ (r'#!(.*?)$', Comment.Preproc),
181
+ default('base'),
182
+ ],
183
+ 'base': [
184
+ ('--.*$', Comment.Single),
185
+ (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
186
+ (r'(?i)\d+e[+-]?\d+', Number.Float),
187
+ (r'(?i)0x[0-9a-f]*', Number.Hex),
188
+ (r'\d+', Number.Integer),
189
+ (r'\n', Text),
190
+ (r'[^\S\n]+', Text),
191
+ (r'(?s)\[(=*)\[.*?\]\1\]', String),
192
+ (r'(->|=>)', Name.Function),
193
+ (r':[a-zA-Z_]\w*', Name.Variable),
194
+ (r'(==|!=|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#!.\\:])', Operator),
195
+ (r'[;,]', Punctuation),
196
+ (r'[\[\]{}()]', Keyword.Type),
197
+ (r'[a-zA-Z_]\w*:', Name.Variable),
198
+ (words((
199
+ 'class', 'extends', 'if', 'then', 'super', 'do', 'with',
200
+ 'import', 'export', 'while', 'elseif', 'return', 'for', 'in',
201
+ 'from', 'when', 'using', 'else', 'and', 'or', 'not', 'switch',
202
+ 'break'), suffix=r'\b'),
203
+ Keyword),
204
+ (r'(true|false|nil)\b', Keyword.Constant),
205
+ (r'(and|or|not)\b', Operator.Word),
206
+ (r'(self)\b', Name.Builtin.Pseudo),
207
+ (r'@@?([a-zA-Z_]\w*)?', Name.Variable.Class),
208
+ (r'[A-Z]\w*', Name.Class), # proper name
209
+ (r'[A-Za-z_]\w*(\.[A-Za-z_]\w*)?', Name),
210
+ ("'", String.Single, combined('stringescape', 'sqs')),
211
+ ('"', String.Double, combined('stringescape', 'dqs'))
212
+ ],
213
+ 'stringescape': [
214
+ (r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape)
215
+ ],
216
+ 'sqs': [
217
+ ("'", String.Single, '#pop'),
218
+ (".", String)
219
+ ],
220
+ 'dqs': [
221
+ ('"', String.Double, '#pop'),
222
+ (".", String)
223
+ ]
224
+ }
225
+
226
+ def get_tokens_unprocessed(self, text):
227
+ # set . as Operator instead of Punctuation
228
+ for index, token, value in LuaLexer.get_tokens_unprocessed(self, text):
229
+ if token == Punctuation and value == ".":
230
+ token = Operator
231
+ yield index, token, value
232
+
233
+
234
+ class ChaiscriptLexer(RegexLexer):
235
+ """
236
+ For `ChaiScript <http://chaiscript.com/>`_ source code.
237
+
238
+ .. versionadded:: 2.0
239
+ """
240
+
241
+ name = 'ChaiScript'
242
+ aliases = ['chai', 'chaiscript']
243
+ filenames = ['*.chai']
244
+ mimetypes = ['text/x-chaiscript', 'application/x-chaiscript']
245
+
246
+ flags = re.DOTALL | re.MULTILINE
247
+
248
+ tokens = {
249
+ 'commentsandwhitespace': [
250
+ (r'\s+', Text),
251
+ (r'//.*?\n', Comment.Single),
252
+ (r'/\*.*?\*/', Comment.Multiline),
253
+ (r'^\#.*?\n', Comment.Single)
254
+ ],
255
+ 'slashstartsregex': [
256
+ include('commentsandwhitespace'),
257
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
258
+ r'([gim]+\b|\B)', String.Regex, '#pop'),
259
+ (r'(?=/)', Text, ('#pop', 'badregex')),
260
+ default('#pop')
261
+ ],
262
+ 'badregex': [
263
+ (r'\n', Text, '#pop')
264
+ ],
265
+ 'root': [
266
+ include('commentsandwhitespace'),
267
+ (r'\n', Text),
268
+ (r'[^\S\n]+', Text),
269
+ (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|\.\.'
270
+ r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
271
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
272
+ (r'[})\].]', Punctuation),
273
+ (r'[=+\-*/]', Operator),
274
+ (r'(for|in|while|do|break|return|continue|if|else|'
275
+ r'throw|try|catch'
276
+ r')\b', Keyword, 'slashstartsregex'),
277
+ (r'(var)\b', Keyword.Declaration, 'slashstartsregex'),
278
+ (r'(attr|def|fun)\b', Keyword.Reserved),
279
+ (r'(true|false)\b', Keyword.Constant),
280
+ (r'(eval|throw)\b', Name.Builtin),
281
+ (r'`\S+`', Name.Builtin),
282
+ (r'[$a-zA-Z_]\w*', Name.Other),
283
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
284
+ (r'0x[0-9a-fA-F]+', Number.Hex),
285
+ (r'[0-9]+', Number.Integer),
286
+ (r'"', String.Double, 'dqstring'),
287
+ (r"'(\\\\|\\'|[^'])*'", String.Single),
288
+ ],
289
+ 'dqstring': [
290
+ (r'\$\{[^"}]+?\}', String.Interpol),
291
+ (r'\$', String.Double),
292
+ (r'\\\\', String.Double),
293
+ (r'\\"', String.Double),
294
+ (r'[^\\"$]+', String.Double),
295
+ (r'"', String.Double, '#pop'),
296
+ ],
297
+ }
298
+
299
+
300
+ class LSLLexer(RegexLexer):
301
+ """
302
+ For Second Life's Linden Scripting Language source code.
303
+
304
+ .. versionadded:: 2.0
305
+ """
306
+
307
+ name = 'LSL'
308
+ aliases = ['lsl']
309
+ filenames = ['*.lsl']
310
+ mimetypes = ['text/x-lsl']
311
+
312
+ flags = re.MULTILINE
313
+
314
+ lsl_keywords = r'\b(?:do|else|for|if|jump|return|while)\b'
315
+ lsl_types = r'\b(?:float|integer|key|list|quaternion|rotation|string|vector)\b'
316
+ lsl_states = r'\b(?:(?:state)\s+\w+|default)\b'
317
+ lsl_events = r'\b(?:state_(?:entry|exit)|touch(?:_(?:start|end))?|(?:land_)?collision(?:_(?:start|end))?|timer|listen|(?:no_)?sensor|control|(?:not_)?at_(?:rot_)?target|money|email|run_time_permissions|changed|attach|dataserver|moving_(?:start|end)|link_message|(?:on|object)_rez|remote_data|http_re(?:sponse|quest)|path_update|transaction_result)\b'
318
+ lsl_functions_builtin = r'\b(?:ll(?:ReturnObjectsBy(?:ID|Owner)|Json(?:2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(?:Mag|Norm|Dist)|Rot(?:Between|2(?:Euler|Fwd|Left|Up))|(?:Euler|Axes)2Rot|Whisper|(?:Region|Owner)?Say|Shout|Listen(?:Control|Remove)?|Sensor(?:Repeat|Remove)?|Detected(?:Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|(?:[GS]et)(?:AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(?:Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(?:Scale|Offset|Rotate)Texture|(?:Rot)?Target(?:Remove)?|(?:Stop)?MoveToTarget|Apply(?:Rotational)?Impulse|Set(?:KeyframedMotion|ContentType|RegionPos|(?:Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(?:Queueing|Radius)|Vehicle(?:Type|(?:Float|Vector|Rotation)Param)|(?:Touch|Sit)?Text|Camera(?:Eye|At)Offset|PrimitiveParams|ClickAction|Link(?:Alpha|Color|PrimitiveParams(?:Fast)?|Texture(?:Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get(?:(?:Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(?:PrimitiveParams|Number(?:OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(?:Details|PermMask|PrimCount)|Parcel(?:MaxPrims|Details|Prim(?:Count|Owners))|Attached|(?:SPMax|Free|Used)Memory|Region(?:Name|TimeDilation|FPS|Corner|AgentCount)|Root(?:Position|Rotation)|UnixTime|(?:Parcel|Region)Flags|(?:Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(?:Prims|NotecardLines|Sides)|Animation(?:List)?|(?:Camera|Local)(?:Pos|Rot)|Vel|Accel|Omega|Time(?:stamp|OfDay)|(?:Object|CenterOf)?Mass|MassMKS|Energy|Owner|(?:Owner)?Key|SunDirection|Texture(?:Offset|Scale|Rot)|Inventory(?:Number|Name|Key|Type|Creator|PermMask)|Permissions(?:Key)?|StartParameter|List(?:Length|EntryType)|Date|Agent(?:Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(?:Name|State))|(?:Get|Reset|GetAndReset)Time|PlaySound(?:Slave)?|LoopSound(?:Master|Slave)?|(?:Trigger|Stop|Preload)Sound|(?:(?:Get|Delete)Sub|Insert)String|To(?:Upper|Lower)|Give(?:InventoryList|Money)|RezObject|(?:Stop)?LookAt|Sleep|CollisionFilter|(?:Take|Release)Controls|DetachFromAvatar|AttachToAvatar(?:Temp)?|InstantMessage|(?:GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(?:Length|Trim)|(?:Start|Stop)Animation|TargetOmega|RequestPermissions|(?:Create|Break)Link|BreakAllLinks|(?:Give|Remove)Inventory|Water|PassTouches|Request(?:Agent|Inventory)Data|TeleportAgent(?:Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(?:Axis|Angle)|A(?:cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(?:CSV|Integer|Json|Float|String|Key|Vector|Rot|List(?:Strided)?)|DeleteSubList|List(?:Statistics|Sort|Randomize|(?:Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(?:CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(?:Slope|Normal|Contour)|GroundRepel|(?:Set|Remove)VehicleFlags|(?:AvatarOn)?(?:Link)?SitTarget|Script(?:Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(?:Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(?:Integer|String)ToBase64|XorBase64|Log(?:10)?|Base64To(?:String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(?:Load|Release|(?:E|Une)scape)URL|ParcelMedia(?:CommandList|Query)|ModPow|MapDestination|(?:RemoveFrom|AddTo|Reset)Land(?:Pass|Ban)List|(?:Set|Clear)CameraParams|HTTP(?:Request|Response)|TextBox|DetectedTouch(?:UV|Face|Pos|(?:N|Bin)ormal|ST)|(?:MD5|SHA1|DumpList2)String|Request(?:Secure)?URL|Clear(?:Prim|Link)Media|(?:Link)?ParticleSystem|(?:Get|Request)(?:Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(?:Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\b'
319
+ lsl_constants_float = r'\b(?:DEG_TO_RAD|PI(?:_BY_TWO)?|RAD_TO_DEG|SQRT2|TWO_PI)\b'
320
+ lsl_constants_integer = r'\b(?:JSON_APPEND|STATUS_(?:PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(?:_OBJECT)?|(?:DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(?:FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(?:_(?:BY_(?:LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(?:PARCEL(?:_OWNER)?|REGION)))?|CAMERA_(?:PITCH|DISTANCE|BEHINDNESS_(?:ANGLE|LAG)|(?:FOCUS|POSITION)(?:_(?:THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(?:ROOT|SET|ALL_(?:OTHERS|CHILDREN)|THIS)|ACTIVE|PASSIVE|SCRIPTED|CONTROL_(?:FWD|BACK|(?:ROT_)?(?:LEFT|RIGHT)|UP|DOWN|(?:ML_)?LBUTTON)|PERMISSION_(?:RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(?:CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(?:TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(?:INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(?:_START)?|TELEPORT|MEDIA)|OBJECT_(?:(?:PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_ON_REZ|NAME|DESC|POS|PRIM_EQUIVALENCE|RETURN_(?:PARCEL(?:_OWNER)?|REGION)|ROO?T|VELOCITY|OWNER|GROUP|CREATOR|ATTACHED_POINT|RENDER_WEIGHT|PATHFINDING_TYPE|(?:RUNNING|TOTAL)_SCRIPT_COUNT|SCRIPT_(?:MEMORY|TIME))|TYPE_(?:INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(?:DEBUG|PUBLIC)_CHANNEL|ATTACH_(?:AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](?:SHOULDER|HAND|FOOT|EAR|EYE|[UL](?:ARM|LEG)|HIP)|(?:LEFT|RIGHT)_PEC|HUD_(?:CENTER_[12]|TOP_(?:RIGHT|CENTER|LEFT)|BOTTOM(?:_(?:RIGHT|LEFT))?))|LAND_(?:LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(?:ONLINE|NAME|BORN|SIM_(?:POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(?:ON_FILE|USED)|REMOTE_DATA_(?:CHANNEL|REQUEST|REPLY)|PSYS_(?:PART_(?:BF_(?:ZERO|ONE(?:_MINUS_(?:DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(?:START|END)_(?:COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(?:RIBBON|WIND|INTERP_(?:COLOR|SCALE)|BOUNCE|FOLLOW_(?:SRC|VELOCITY)|TARGET_(?:POS|LINEAR)|EMISSIVE)_MASK)|SRC_(?:MAX_AGE|PATTERN|ANGLE_(?:BEGIN|END)|BURST_(?:RATE|PART_COUNT|RADIUS|SPEED_(?:MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(?:DROP|EXPLODE|ANGLE(?:_CONE(?:_EMPTY)?)?)))|VEHICLE_(?:REFERENCE_FRAME|TYPE_(?:NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(?:LINEAR|ANGULAR)_(?:FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(?:HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(?:LINEAR|ANGULAR)_(?:DEFLECTION_(?:EFFICIENCY|TIMESCALE)|MOTOR_(?:DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(?:EFFICIENCY|TIMESCALE)|BANKING_(?:EFFICIENCY|MIX|TIMESCALE)|FLAG_(?:NO_DEFLECTION_UP|LIMIT_(?:ROLL_ONLY|MOTOR_UP)|HOVER_(?:(?:WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(?:STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(?:TYPE(?:_(?:BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(?:DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(?:_(?:STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(?:NONE|LOW|MEDIUM|HIGH)|BUMP_(?:NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(?:DEFAULT|PLANAR)|SCULPT_(?:TYPE_(?:SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(?:MIRROR|INVERT))|PHYSICS(?:_(?:SHAPE_(?:CONVEX|NONE|PRIM|TYPE)))?|(?:POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(?:ALT_IMAGE_ENABLE|CONTROLS|(?:CURRENT|HOME)_URL|AUTO_(?:LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(?:WIDTH|HEIGHT)_PIXELS|WHITELIST(?:_ENABLE)?|PERMS_(?:INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(?:STANDARD|MINI)|PERM_(?:NONE|OWNER|GROUP|ANYONE)|MAX_(?:URL_LENGTH|WHITELIST_(?:SIZE|COUNT)|(?:WIDTH|HEIGHT)_PIXELS)))|MASK_(?:BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(?:TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(?:MEDIA_COMMAND_(?:STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(?:ALLOW_(?:FLY|(?:GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(?:GROUP_)?OBJECTS)|USE_(?:ACCESS_(?:GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(?:GROUP|ALL)_OBJECT_ENTRY)|COUNT_(?:TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(?:NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(?:MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(?:_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(?:HIDE|DEFAULT)|REGION_FLAG_(?:ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(?:COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(?:METHOD|MIMETYPE|BODY_(?:MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|STRING_(?:TRIM(?:_(?:HEAD|TAIL))?)|CLICK_ACTION_(?:NONE|TOUCH|SIT|BUY|PAY|OPEN(?:_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(?:NONE|SCRIPT_MEMORY)|RC_(?:DATA_FLAGS|DETECT_PHANTOM|GET_(?:LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(?:TYPES|AGENTS|(?:NON)?PHYSICAL|LAND))|RCERR_(?:CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(?:ALLOWED_(?:AGENT|GROUP)_(?:ADD|REMOVE)|BANNED_AGENT_(?:ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(?:COMMAND|CMD_(?:PLAY|STOP|PAUSE|SET_MODE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(?:GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(?:CMD_(?:(?:SMOOTH_)?STOP|JUMP)|DESIRED_(?:TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(?:_(?:[A-D]|NONE))?|MAX_(?:DECEL|TURN_RADIUS|(?:ACCEL|SPEED)))|PURSUIT_(?:OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(?:CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(?:EVADE_(?:HIDDEN|SPOTTED)|FAILURE_(?:DYNAMIC_PATHFINDING_DISABLED|INVALID_(?:GOAL|START)|NO_(?:NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(?:PARCEL_)?UNREACHABLE)|(?:GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(?:_(?:FAST|NONE|SLOW))?|CONTENT_TYPE_(?:ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(?:RADIUS|STATIC)|(?:PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(?:AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\b'
321
+ lsl_constants_integer_boolean = r'\b(?:FALSE|TRUE)\b'
322
+ lsl_constants_rotation = r'\b(?:ZERO_ROTATION)\b'
323
+ lsl_constants_string = r'\b(?:EOF|JSON_(?:ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(?:BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(?:GRANTED|DENIED))\b'
324
+ lsl_constants_vector = r'\b(?:TOUCH_INVALID_(?:TEXCOORD|VECTOR)|ZERO_VECTOR)\b'
325
+ lsl_invalid_broken = r'\b(?:LAND_(?:LARGE|MEDIUM|SMALL)_BRUSH)\b'
326
+ lsl_invalid_deprecated = r'\b(?:ATTACH_[LR]PEC|DATA_RATING|OBJECT_ATTACHMENT_(?:GEOMETRY_BYTES|SURFACE_AREA)|PRIM_(?:CAST_SHADOWS|MATERIAL_LIGHT|TYPE_LEGACY)|PSYS_SRC_(?:INNER|OUTER)ANGLE|VEHICLE_FLAG_NO_FLY_UP|ll(?:Cloud|Make(?:Explosion|Fountain|Smoke|Fire)|RemoteDataSetRegion|Sound(?:Preload)?|XorBase64Strings(?:Correct)?))\b'
327
+ lsl_invalid_illegal = r'\b(?:event)\b'
328
+ lsl_invalid_unimplemented = r'\b(?:CHARACTER_(?:MAX_ANGULAR_(?:ACCEL|SPEED)|TURN_SPEED_MULTIPLIER)|PERMISSION_(?:CHANGE_(?:JOINTS|PERMISSIONS)|RELEASE_OWNERSHIP|REMAP_CONTROLS)|PRIM_PHYSICS_MATERIAL|PSYS_SRC_OBJ_REL_MASK|ll(?:CollisionSprite|(?:Stop)?PointAt|(?:(?:Refresh|Set)Prim)URL|(?:Take|Release)Camera|RemoteLoadScript))\b'
329
+ lsl_reserved_godmode = r'\b(?:ll(?:GodLikeRezObject|Set(?:Inventory|Object)PermMask))\b'
330
+ lsl_reserved_log = r'\b(?:print)\b'
331
+ lsl_operators = r'\+\+|\-\-|<<|>>|&&?|\|\|?|\^|~|[!%<>=*+\-/]=?'
332
+
333
+ tokens = {
334
+ 'root':
335
+ [
336
+ (r'//.*?\n', Comment.Single),
337
+ (r'/\*', Comment.Multiline, 'comment'),
338
+ (r'"', String.Double, 'string'),
339
+ (lsl_keywords, Keyword),
340
+ (lsl_types, Keyword.Type),
341
+ (lsl_states, Name.Class),
342
+ (lsl_events, Name.Builtin),
343
+ (lsl_functions_builtin, Name.Function),
344
+ (lsl_constants_float, Keyword.Constant),
345
+ (lsl_constants_integer, Keyword.Constant),
346
+ (lsl_constants_integer_boolean, Keyword.Constant),
347
+ (lsl_constants_rotation, Keyword.Constant),
348
+ (lsl_constants_string, Keyword.Constant),
349
+ (lsl_constants_vector, Keyword.Constant),
350
+ (lsl_invalid_broken, Error),
351
+ (lsl_invalid_deprecated, Error),
352
+ (lsl_invalid_illegal, Error),
353
+ (lsl_invalid_unimplemented, Error),
354
+ (lsl_reserved_godmode, Keyword.Reserved),
355
+ (lsl_reserved_log, Keyword.Reserved),
356
+ (r'\b([a-zA-Z_]\w*)\b', Name.Variable),
357
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d*', Number.Float),
358
+ (r'(\d+\.\d*|\.\d+)', Number.Float),
359
+ (r'0[xX][0-9a-fA-F]+', Number.Hex),
360
+ (r'\d+', Number.Integer),
361
+ (lsl_operators, Operator),
362
+ (r':=?', Error),
363
+ (r'[,;{}()\[\]]', Punctuation),
364
+ (r'\n+', Whitespace),
365
+ (r'\s+', Whitespace)
366
+ ],
367
+ 'comment':
368
+ [
369
+ (r'[^*/]+', Comment.Multiline),
370
+ (r'/\*', Comment.Multiline, '#push'),
371
+ (r'\*/', Comment.Multiline, '#pop'),
372
+ (r'[*/]', Comment.Multiline)
373
+ ],
374
+ 'string':
375
+ [
376
+ (r'\\([nt"\\])', String.Escape),
377
+ (r'"', String.Double, '#pop'),
378
+ (r'\\.', Error),
379
+ (r'[^"\\]+', String.Double),
380
+ ]
381
+ }
382
+
383
+
384
+ class AppleScriptLexer(RegexLexer):
385
+ """
386
+ For `AppleScript source code
387
+ <http://developer.apple.com/documentation/AppleScript/
388
+ Conceptual/AppleScriptLangGuide>`_,
389
+ including `AppleScript Studio
390
+ <http://developer.apple.com/documentation/AppleScript/
391
+ Reference/StudioReference>`_.
392
+ Contributed by Andreas Amann <aamann@mac.com>.
393
+
394
+ .. versionadded:: 1.0
395
+ """
396
+
397
+ name = 'AppleScript'
398
+ aliases = ['applescript']
399
+ filenames = ['*.applescript']
400
+
401
+ flags = re.MULTILINE | re.DOTALL
402
+
403
+ Identifiers = r'[a-zA-Z]\w*'
404
+
405
+ # XXX: use words() for all of these
406
+ Literals = ('AppleScript', 'current application', 'false', 'linefeed',
407
+ 'missing value', 'pi', 'quote', 'result', 'return', 'space',
408
+ 'tab', 'text item delimiters', 'true', 'version')
409
+ Classes = ('alias ', 'application ', 'boolean ', 'class ', 'constant ',
410
+ 'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
411
+ 'real ', 'record ', 'reference ', 'RGB color ', 'script ',
412
+ 'text ', 'unit types', '(?:Unicode )?text', 'string')
413
+ BuiltIn = ('attachment', 'attribute run', 'character', 'day', 'month',
414
+ 'paragraph', 'word', 'year')
415
+ HandlerParams = ('about', 'above', 'against', 'apart from', 'around',
416
+ 'aside from', 'at', 'below', 'beneath', 'beside',
417
+ 'between', 'for', 'given', 'instead of', 'on', 'onto',
418
+ 'out of', 'over', 'since')
419
+ Commands = ('ASCII (character|number)', 'activate', 'beep', 'choose URL',
420
+ 'choose application', 'choose color', 'choose file( name)?',
421
+ 'choose folder', 'choose from list',
422
+ 'choose remote application', 'clipboard info',
423
+ 'close( access)?', 'copy', 'count', 'current date', 'delay',
424
+ 'delete', 'display (alert|dialog)', 'do shell script',
425
+ 'duplicate', 'exists', 'get eof', 'get volume settings',
426
+ 'info for', 'launch', 'list (disks|folder)', 'load script',
427
+ 'log', 'make', 'mount volume', 'new', 'offset',
428
+ 'open( (for access|location))?', 'path to', 'print', 'quit',
429
+ 'random number', 'read', 'round', 'run( script)?',
430
+ 'say', 'scripting components',
431
+ 'set (eof|the clipboard to|volume)', 'store script',
432
+ 'summarize', 'system attribute', 'system info',
433
+ 'the clipboard', 'time to GMT', 'write', 'quoted form')
434
+ References = ('(in )?back of', '(in )?front of', '[0-9]+(st|nd|rd|th)',
435
+ 'first', 'second', 'third', 'fourth', 'fifth', 'sixth',
436
+ 'seventh', 'eighth', 'ninth', 'tenth', 'after', 'back',
437
+ 'before', 'behind', 'every', 'front', 'index', 'last',
438
+ 'middle', 'some', 'that', 'through', 'thru', 'where', 'whose')
439
+ Operators = ("and", "or", "is equal", "equals", "(is )?equal to", "is not",
440
+ "isn't", "isn't equal( to)?", "is not equal( to)?",
441
+ "doesn't equal", "does not equal", "(is )?greater than",
442
+ "comes after", "is not less than or equal( to)?",
443
+ "isn't less than or equal( to)?", "(is )?less than",
444
+ "comes before", "is not greater than or equal( to)?",
445
+ "isn't greater than or equal( to)?",
446
+ "(is )?greater than or equal( to)?", "is not less than",
447
+ "isn't less than", "does not come before",
448
+ "doesn't come before", "(is )?less than or equal( to)?",
449
+ "is not greater than", "isn't greater than",
450
+ "does not come after", "doesn't come after", "starts? with",
451
+ "begins? with", "ends? with", "contains?", "does not contain",
452
+ "doesn't contain", "is in", "is contained by", "is not in",
453
+ "is not contained by", "isn't contained by", "div", "mod",
454
+ "not", "(a )?(ref( to)?|reference to)", "is", "does")
455
+ Control = ('considering', 'else', 'error', 'exit', 'from', 'if',
456
+ 'ignoring', 'in', 'repeat', 'tell', 'then', 'times', 'to',
457
+ 'try', 'until', 'using terms from', 'while', 'whith',
458
+ 'with timeout( of)?', 'with transaction', 'by', 'continue',
459
+ 'end', 'its?', 'me', 'my', 'return', 'of', 'as')
460
+ Declarations = ('global', 'local', 'prop(erty)?', 'set', 'get')
461
+ Reserved = ('but', 'put', 'returning', 'the')
462
+ StudioClasses = ('action cell', 'alert reply', 'application', 'box',
463
+ 'browser( cell)?', 'bundle', 'button( cell)?', 'cell',
464
+ 'clip view', 'color well', 'color-panel',
465
+ 'combo box( item)?', 'control',
466
+ 'data( (cell|column|item|row|source))?', 'default entry',
467
+ 'dialog reply', 'document', 'drag info', 'drawer',
468
+ 'event', 'font(-panel)?', 'formatter',
469
+ 'image( (cell|view))?', 'matrix', 'menu( item)?', 'item',
470
+ 'movie( view)?', 'open-panel', 'outline view', 'panel',
471
+ 'pasteboard', 'plugin', 'popup button',
472
+ 'progress indicator', 'responder', 'save-panel',
473
+ 'scroll view', 'secure text field( cell)?', 'slider',
474
+ 'sound', 'split view', 'stepper', 'tab view( item)?',
475
+ 'table( (column|header cell|header view|view))',
476
+ 'text( (field( cell)?|view))?', 'toolbar( item)?',
477
+ 'user-defaults', 'view', 'window')
478
+ StudioEvents = ('accept outline drop', 'accept table drop', 'action',
479
+ 'activated', 'alert ended', 'awake from nib', 'became key',
480
+ 'became main', 'begin editing', 'bounds changed',
481
+ 'cell value', 'cell value changed', 'change cell value',
482
+ 'change item value', 'changed', 'child of item',
483
+ 'choose menu item', 'clicked', 'clicked toolbar item',
484
+ 'closed', 'column clicked', 'column moved',
485
+ 'column resized', 'conclude drop', 'data representation',
486
+ 'deminiaturized', 'dialog ended', 'document nib name',
487
+ 'double clicked', 'drag( (entered|exited|updated))?',
488
+ 'drop', 'end editing', 'exposed', 'idle', 'item expandable',
489
+ 'item value', 'item value changed', 'items changed',
490
+ 'keyboard down', 'keyboard up', 'launched',
491
+ 'load data representation', 'miniaturized', 'mouse down',
492
+ 'mouse dragged', 'mouse entered', 'mouse exited',
493
+ 'mouse moved', 'mouse up', 'moved',
494
+ 'number of browser rows', 'number of items',
495
+ 'number of rows', 'open untitled', 'opened', 'panel ended',
496
+ 'parameters updated', 'plugin loaded', 'prepare drop',
497
+ 'prepare outline drag', 'prepare outline drop',
498
+ 'prepare table drag', 'prepare table drop',
499
+ 'read from file', 'resigned active', 'resigned key',
500
+ 'resigned main', 'resized( sub views)?',
501
+ 'right mouse down', 'right mouse dragged',
502
+ 'right mouse up', 'rows changed', 'scroll wheel',
503
+ 'selected tab view item', 'selection changed',
504
+ 'selection changing', 'should begin editing',
505
+ 'should close', 'should collapse item',
506
+ 'should end editing', 'should expand item',
507
+ 'should open( untitled)?',
508
+ 'should quit( after last window closed)?',
509
+ 'should select column', 'should select item',
510
+ 'should select row', 'should select tab view item',
511
+ 'should selection change', 'should zoom', 'shown',
512
+ 'update menu item', 'update parameters',
513
+ 'update toolbar item', 'was hidden', 'was miniaturized',
514
+ 'will become active', 'will close', 'will dismiss',
515
+ 'will display browser cell', 'will display cell',
516
+ 'will display item cell', 'will display outline cell',
517
+ 'will finish launching', 'will hide', 'will miniaturize',
518
+ 'will move', 'will open', 'will pop up', 'will quit',
519
+ 'will resign active', 'will resize( sub views)?',
520
+ 'will select tab view item', 'will show', 'will zoom',
521
+ 'write to file', 'zoomed')
522
+ StudioCommands = ('animate', 'append', 'call method', 'center',
523
+ 'close drawer', 'close panel', 'display',
524
+ 'display alert', 'display dialog', 'display panel', 'go',
525
+ 'hide', 'highlight', 'increment', 'item for',
526
+ 'load image', 'load movie', 'load nib', 'load panel',
527
+ 'load sound', 'localized string', 'lock focus', 'log',
528
+ 'open drawer', 'path for', 'pause', 'perform action',
529
+ 'play', 'register', 'resume', 'scroll', 'select( all)?',
530
+ 'show', 'size to fit', 'start', 'step back',
531
+ 'step forward', 'stop', 'synchronize', 'unlock focus',
532
+ 'update')
533
+ StudioProperties = ('accepts arrow key', 'action method', 'active',
534
+ 'alignment', 'allowed identifiers',
535
+ 'allows branch selection', 'allows column reordering',
536
+ 'allows column resizing', 'allows column selection',
537
+ 'allows customization',
538
+ 'allows editing text attributes',
539
+ 'allows empty selection', 'allows mixed state',
540
+ 'allows multiple selection', 'allows reordering',
541
+ 'allows undo', 'alpha( value)?', 'alternate image',
542
+ 'alternate increment value', 'alternate title',
543
+ 'animation delay', 'associated file name',
544
+ 'associated object', 'auto completes', 'auto display',
545
+ 'auto enables items', 'auto repeat',
546
+ 'auto resizes( outline column)?',
547
+ 'auto save expanded items', 'auto save name',
548
+ 'auto save table columns', 'auto saves configuration',
549
+ 'auto scroll', 'auto sizes all columns to fit',
550
+ 'auto sizes cells', 'background color', 'bezel state',
551
+ 'bezel style', 'bezeled', 'border rect', 'border type',
552
+ 'bordered', 'bounds( rotation)?', 'box type',
553
+ 'button returned', 'button type',
554
+ 'can choose directories', 'can choose files',
555
+ 'can draw', 'can hide',
556
+ 'cell( (background color|size|type))?', 'characters',
557
+ 'class', 'click count', 'clicked( data)? column',
558
+ 'clicked data item', 'clicked( data)? row',
559
+ 'closeable', 'collating', 'color( (mode|panel))',
560
+ 'command key down', 'configuration',
561
+ 'content(s| (size|view( margins)?))?', 'context',
562
+ 'continuous', 'control key down', 'control size',
563
+ 'control tint', 'control view',
564
+ 'controller visible', 'coordinate system',
565
+ 'copies( on scroll)?', 'corner view', 'current cell',
566
+ 'current column', 'current( field)? editor',
567
+ 'current( menu)? item', 'current row',
568
+ 'current tab view item', 'data source',
569
+ 'default identifiers', 'delta (x|y|z)',
570
+ 'destination window', 'directory', 'display mode',
571
+ 'displayed cell', 'document( (edited|rect|view))?',
572
+ 'double value', 'dragged column', 'dragged distance',
573
+ 'dragged items', 'draws( cell)? background',
574
+ 'draws grid', 'dynamically scrolls', 'echos bullets',
575
+ 'edge', 'editable', 'edited( data)? column',
576
+ 'edited data item', 'edited( data)? row', 'enabled',
577
+ 'enclosing scroll view', 'ending page',
578
+ 'error handling', 'event number', 'event type',
579
+ 'excluded from windows menu', 'executable path',
580
+ 'expanded', 'fax number', 'field editor', 'file kind',
581
+ 'file name', 'file type', 'first responder',
582
+ 'first visible column', 'flipped', 'floating',
583
+ 'font( panel)?', 'formatter', 'frameworks path',
584
+ 'frontmost', 'gave up', 'grid color', 'has data items',
585
+ 'has horizontal ruler', 'has horizontal scroller',
586
+ 'has parent data item', 'has resize indicator',
587
+ 'has shadow', 'has sub menu', 'has vertical ruler',
588
+ 'has vertical scroller', 'header cell', 'header view',
589
+ 'hidden', 'hides when deactivated', 'highlights by',
590
+ 'horizontal line scroll', 'horizontal page scroll',
591
+ 'horizontal ruler view', 'horizontally resizable',
592
+ 'icon image', 'id', 'identifier',
593
+ 'ignores multiple clicks',
594
+ 'image( (alignment|dims when disabled|frame style|scaling))?',
595
+ 'imports graphics', 'increment value',
596
+ 'indentation per level', 'indeterminate', 'index',
597
+ 'integer value', 'intercell spacing', 'item height',
598
+ 'key( (code|equivalent( modifier)?|window))?',
599
+ 'knob thickness', 'label', 'last( visible)? column',
600
+ 'leading offset', 'leaf', 'level', 'line scroll',
601
+ 'loaded', 'localized sort', 'location', 'loop mode',
602
+ 'main( (bunde|menu|window))?', 'marker follows cell',
603
+ 'matrix mode', 'maximum( content)? size',
604
+ 'maximum visible columns',
605
+ 'menu( form representation)?', 'miniaturizable',
606
+ 'miniaturized', 'minimized image', 'minimized title',
607
+ 'minimum column width', 'minimum( content)? size',
608
+ 'modal', 'modified', 'mouse down state',
609
+ 'movie( (controller|file|rect))?', 'muted', 'name',
610
+ 'needs display', 'next state', 'next text',
611
+ 'number of tick marks', 'only tick mark values',
612
+ 'opaque', 'open panel', 'option key down',
613
+ 'outline table column', 'page scroll', 'pages across',
614
+ 'pages down', 'palette label', 'pane splitter',
615
+ 'parent data item', 'parent window', 'pasteboard',
616
+ 'path( (names|separator))?', 'playing',
617
+ 'plays every frame', 'plays selection only', 'position',
618
+ 'preferred edge', 'preferred type', 'pressure',
619
+ 'previous text', 'prompt', 'properties',
620
+ 'prototype cell', 'pulls down', 'rate',
621
+ 'released when closed', 'repeated',
622
+ 'requested print time', 'required file type',
623
+ 'resizable', 'resized column', 'resource path',
624
+ 'returns records', 'reuses columns', 'rich text',
625
+ 'roll over', 'row height', 'rulers visible',
626
+ 'save panel', 'scripts path', 'scrollable',
627
+ 'selectable( identifiers)?', 'selected cell',
628
+ 'selected( data)? columns?', 'selected data items?',
629
+ 'selected( data)? rows?', 'selected item identifier',
630
+ 'selection by rect', 'send action on arrow key',
631
+ 'sends action when done editing', 'separates columns',
632
+ 'separator item', 'sequence number', 'services menu',
633
+ 'shared frameworks path', 'shared support path',
634
+ 'sheet', 'shift key down', 'shows alpha',
635
+ 'shows state by', 'size( mode)?',
636
+ 'smart insert delete enabled', 'sort case sensitivity',
637
+ 'sort column', 'sort order', 'sort type',
638
+ 'sorted( data rows)?', 'sound', 'source( mask)?',
639
+ 'spell checking enabled', 'starting page', 'state',
640
+ 'string value', 'sub menu', 'super menu', 'super view',
641
+ 'tab key traverses cells', 'tab state', 'tab type',
642
+ 'tab view', 'table view', 'tag', 'target( printer)?',
643
+ 'text color', 'text container insert',
644
+ 'text container origin', 'text returned',
645
+ 'tick mark position', 'time stamp',
646
+ 'title(d| (cell|font|height|position|rect))?',
647
+ 'tool tip', 'toolbar', 'trailing offset', 'transparent',
648
+ 'treat packages as directories', 'truncated labels',
649
+ 'types', 'unmodified characters', 'update views',
650
+ 'use sort indicator', 'user defaults',
651
+ 'uses data source', 'uses ruler',
652
+ 'uses threaded animation',
653
+ 'uses title from previous column', 'value wraps',
654
+ 'version',
655
+ 'vertical( (line scroll|page scroll|ruler view))?',
656
+ 'vertically resizable', 'view',
657
+ 'visible( document rect)?', 'volume', 'width', 'window',
658
+ 'windows menu', 'wraps', 'zoomable', 'zoomed')
659
+
660
+ tokens = {
661
+ 'root': [
662
+ (r'\s+', Text),
663
+ (u'¬\\n', String.Escape),
664
+ (r"'s\s+", Text), # This is a possessive, consider moving
665
+ (r'(--|#).*?$', Comment),
666
+ (r'\(\*', Comment.Multiline, 'comment'),
667
+ (r'[(){}!,.:]', Punctuation),
668
+ (u'(«)([^»]+)(»)',
669
+ bygroups(Text, Name.Builtin, Text)),
670
+ (r'\b((?:considering|ignoring)\s*)'
671
+ r'(application responses|case|diacriticals|hyphens|'
672
+ r'numeric strings|punctuation|white space)',
673
+ bygroups(Keyword, Name.Builtin)),
674
+ (u'(-|\\*|\\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\\^)', Operator),
675
+ (r"\b(%s)\b" % '|'.join(Operators), Operator.Word),
676
+ (r'^(\s*(?:on|end)\s+)'
677
+ r'(%s)' % '|'.join(StudioEvents[::-1]),
678
+ bygroups(Keyword, Name.Function)),
679
+ (r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)),
680
+ (r'\b(as )(%s)\b' % '|'.join(Classes),
681
+ bygroups(Keyword, Name.Class)),
682
+ (r'\b(%s)\b' % '|'.join(Literals), Name.Constant),
683
+ (r'\b(%s)\b' % '|'.join(Commands), Name.Builtin),
684
+ (r'\b(%s)\b' % '|'.join(Control), Keyword),
685
+ (r'\b(%s)\b' % '|'.join(Declarations), Keyword),
686
+ (r'\b(%s)\b' % '|'.join(Reserved), Name.Builtin),
687
+ (r'\b(%s)s?\b' % '|'.join(BuiltIn), Name.Builtin),
688
+ (r'\b(%s)\b' % '|'.join(HandlerParams), Name.Builtin),
689
+ (r'\b(%s)\b' % '|'.join(StudioProperties), Name.Attribute),
690
+ (r'\b(%s)s?\b' % '|'.join(StudioClasses), Name.Builtin),
691
+ (r'\b(%s)\b' % '|'.join(StudioCommands), Name.Builtin),
692
+ (r'\b(%s)\b' % '|'.join(References), Name.Builtin),
693
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
694
+ (r'\b(%s)\b' % Identifiers, Name.Variable),
695
+ (r'[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?', Number.Float),
696
+ (r'[-+]?\d+', Number.Integer),
697
+ ],
698
+ 'comment': [
699
+ ('\(\*', Comment.Multiline, '#push'),
700
+ ('\*\)', Comment.Multiline, '#pop'),
701
+ ('[^*(]+', Comment.Multiline),
702
+ ('[*(]', Comment.Multiline),
703
+ ],
704
+ }
705
+
706
+
707
+ class RexxLexer(RegexLexer):
708
+ """
709
+ `Rexx <http://www.rexxinfo.org/>`_ is a scripting language available for
710
+ a wide range of different platforms with its roots found on mainframe
711
+ systems. It is popular for I/O- and data based tasks and can act as glue
712
+ language to bind different applications together.
713
+
714
+ .. versionadded:: 2.0
715
+ """
716
+ name = 'Rexx'
717
+ aliases = ['rexx', 'arexx']
718
+ filenames = ['*.rexx', '*.rex', '*.rx', '*.arexx']
719
+ mimetypes = ['text/x-rexx']
720
+ flags = re.IGNORECASE
721
+
722
+ tokens = {
723
+ 'root': [
724
+ (r'\s', Whitespace),
725
+ (r'/\*', Comment.Multiline, 'comment'),
726
+ (r'"', String, 'string_double'),
727
+ (r"'", String, 'string_single'),
728
+ (r'[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?', Number),
729
+ (r'([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b',
730
+ bygroups(Name.Function, Whitespace, Operator, Whitespace,
731
+ Keyword.Declaration)),
732
+ (r'([a-z_]\w*)(\s*)(:)',
733
+ bygroups(Name.Label, Whitespace, Operator)),
734
+ include('function'),
735
+ include('keyword'),
736
+ include('operator'),
737
+ (r'[a-z_]\w*', Text),
738
+ ],
739
+ 'function': [
740
+ (words((
741
+ 'abbrev', 'abs', 'address', 'arg', 'b2x', 'bitand', 'bitor', 'bitxor',
742
+ 'c2d', 'c2x', 'center', 'charin', 'charout', 'chars', 'compare',
743
+ 'condition', 'copies', 'd2c', 'd2x', 'datatype', 'date', 'delstr',
744
+ 'delword', 'digits', 'errortext', 'form', 'format', 'fuzz', 'insert',
745
+ 'lastpos', 'left', 'length', 'linein', 'lineout', 'lines', 'max',
746
+ 'min', 'overlay', 'pos', 'queued', 'random', 'reverse', 'right', 'sign',
747
+ 'sourceline', 'space', 'stream', 'strip', 'substr', 'subword', 'symbol',
748
+ 'time', 'trace', 'translate', 'trunc', 'value', 'verify', 'word',
749
+ 'wordindex', 'wordlength', 'wordpos', 'words', 'x2b', 'x2c', 'x2d',
750
+ 'xrange'), suffix=r'(\s*)(\()'),
751
+ bygroups(Name.Builtin, Whitespace, Operator)),
752
+ ],
753
+ 'keyword': [
754
+ (r'(address|arg|by|call|do|drop|else|end|exit|for|forever|if|'
755
+ r'interpret|iterate|leave|nop|numeric|off|on|options|parse|'
756
+ r'pull|push|queue|return|say|select|signal|to|then|trace|until|'
757
+ r'while)\b', Keyword.Reserved),
758
+ ],
759
+ 'operator': [
760
+ (r'(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||'
761
+ r'&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|'
762
+ r'¬>>|¬>|¬|\.|,)', Operator),
763
+ ],
764
+ 'string_double': [
765
+ (r'[^"\n]+', String),
766
+ (r'""', String),
767
+ (r'"', String, '#pop'),
768
+ (r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
769
+ ],
770
+ 'string_single': [
771
+ (r'[^\'\n]', String),
772
+ (r'\'\'', String),
773
+ (r'\'', String, '#pop'),
774
+ (r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
775
+ ],
776
+ 'comment': [
777
+ (r'[^*]+', Comment.Multiline),
778
+ (r'\*/', Comment.Multiline, '#pop'),
779
+ (r'\*', Comment.Multiline),
780
+ ]
781
+ }
782
+
783
+ _c = lambda s: re.compile(s, re.MULTILINE)
784
+ _ADDRESS_COMMAND_PATTERN = _c(r'^\s*address\s+command\b')
785
+ _ADDRESS_PATTERN = _c(r'^\s*address\s+')
786
+ _DO_WHILE_PATTERN = _c(r'^\s*do\s+while\b')
787
+ _IF_THEN_DO_PATTERN = _c(r'^\s*if\b.+\bthen\s+do\s*$')
788
+ _PROCEDURE_PATTERN = _c(r'^\s*([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b')
789
+ _ELSE_DO_PATTERN = _c(r'\belse\s+do\s*$')
790
+ _PARSE_ARG_PATTERN = _c(r'^\s*parse\s+(upper\s+)?(arg|value)\b')
791
+ PATTERNS_AND_WEIGHTS = (
792
+ (_ADDRESS_COMMAND_PATTERN, 0.2),
793
+ (_ADDRESS_PATTERN, 0.05),
794
+ (_DO_WHILE_PATTERN, 0.1),
795
+ (_ELSE_DO_PATTERN, 0.1),
796
+ (_IF_THEN_DO_PATTERN, 0.1),
797
+ (_PROCEDURE_PATTERN, 0.5),
798
+ (_PARSE_ARG_PATTERN, 0.2),
799
+ )
800
+
801
+ def analyse_text(text):
802
+ """
803
+ Check for inital comment and patterns that distinguish Rexx from other
804
+ C-like languages.
805
+ """
806
+ if re.search(r'/\*\**\s*rexx', text, re.IGNORECASE):
807
+ # Header matches MVS Rexx requirements, this is certainly a Rexx
808
+ # script.
809
+ return 1.0
810
+ elif text.startswith('/*'):
811
+ # Header matches general Rexx requirements; the source code might
812
+ # still be any language using C comments such as C++, C# or Java.
813
+ lowerText = text.lower()
814
+ result = sum(weight
815
+ for (pattern, weight) in RexxLexer.PATTERNS_AND_WEIGHTS
816
+ if pattern.search(lowerText)) + 0.01
817
+ return min(result, 1.0)
818
+
819
+
820
+ class MOOCodeLexer(RegexLexer):
821
+ """
822
+ For `MOOCode <http://www.moo.mud.org/>`_ (the MOO scripting
823
+ language).
824
+
825
+ .. versionadded:: 0.9
826
+ """
827
+ name = 'MOOCode'
828
+ filenames = ['*.moo']
829
+ aliases = ['moocode', 'moo']
830
+ mimetypes = ['text/x-moocode']
831
+
832
+ tokens = {
833
+ 'root': [
834
+ # Numbers
835
+ (r'(0|[1-9][0-9_]*)', Number.Integer),
836
+ # Strings
837
+ (r'"(\\\\|\\"|[^"])*"', String),
838
+ # exceptions
839
+ (r'(E_PERM|E_DIV)', Name.Exception),
840
+ # db-refs
841
+ (r'((#[-0-9]+)|(\$\w+))', Name.Entity),
842
+ # Keywords
843
+ (r'\b(if|else|elseif|endif|for|endfor|fork|endfork|while'
844
+ r'|endwhile|break|continue|return|try'
845
+ r'|except|endtry|finally|in)\b', Keyword),
846
+ # builtins
847
+ (r'(random|length)', Name.Builtin),
848
+ # special variables
849
+ (r'(player|caller|this|args)', Name.Variable.Instance),
850
+ # skip whitespace
851
+ (r'\s+', Text),
852
+ (r'\n', Text),
853
+ # other operators
854
+ (r'([!;=,{}&|:.\[\]@()<>?]+)', Operator),
855
+ # function call
856
+ (r'(\w+)(\()', bygroups(Name.Function, Operator)),
857
+ # variables
858
+ (r'(\w+)', Text),
859
+ ]
860
+ }
861
+
862
+
863
+ class HybrisLexer(RegexLexer):
864
+ """
865
+ For `Hybris <http://www.hybris-lang.org>`_ source code.
866
+
867
+ .. versionadded:: 1.4
868
+ """
869
+
870
+ name = 'Hybris'
871
+ aliases = ['hybris', 'hy']
872
+ filenames = ['*.hy', '*.hyb']
873
+ mimetypes = ['text/x-hybris', 'application/x-hybris']
874
+
875
+ flags = re.MULTILINE | re.DOTALL
876
+
877
+ tokens = {
878
+ 'root': [
879
+ # method names
880
+ (r'^(\s*(?:function|method|operator\s+)+?)'
881
+ r'([a-zA-Z_]\w*)'
882
+ r'(\s*)(\()', bygroups(Keyword, Name.Function, Text, Operator)),
883
+ (r'[^\S\n]+', Text),
884
+ (r'//.*?\n', Comment.Single),
885
+ (r'/\*.*?\*/', Comment.Multiline),
886
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
887
+ (r'(break|case|catch|next|default|do|else|finally|for|foreach|of|'
888
+ r'unless|if|new|return|switch|me|throw|try|while)\b', Keyword),
889
+ (r'(extends|private|protected|public|static|throws|function|method|'
890
+ r'operator)\b', Keyword.Declaration),
891
+ (r'(true|false|null|__FILE__|__LINE__|__VERSION__|__LIB_PATH__|'
892
+ r'__INC_PATH__)\b', Keyword.Constant),
893
+ (r'(class|struct)(\s+)',
894
+ bygroups(Keyword.Declaration, Text), 'class'),
895
+ (r'(import|include)(\s+)',
896
+ bygroups(Keyword.Namespace, Text), 'import'),
897
+ (words((
898
+ 'gc_collect', 'gc_mm_items', 'gc_mm_usage', 'gc_collect_threshold',
899
+ 'urlencode', 'urldecode', 'base64encode', 'base64decode', 'sha1', 'crc32',
900
+ 'sha2', 'md5', 'md5_file', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos',
901
+ 'cosh', 'exp', 'fabs', 'floor', 'fmod', 'log', 'log10', 'pow', 'sin',
902
+ 'sinh', 'sqrt', 'tan', 'tanh', 'isint', 'isfloat', 'ischar', 'isstring',
903
+ 'isarray', 'ismap', 'isalias', 'typeof', 'sizeof', 'toint', 'tostring',
904
+ 'fromxml', 'toxml', 'binary', 'pack', 'load', 'eval', 'var_names',
905
+ 'var_values', 'user_functions', 'dyn_functions', 'methods', 'call',
906
+ 'call_method', 'mknod', 'mkfifo', 'mount', 'umount2', 'umount', 'ticks',
907
+ 'usleep', 'sleep', 'time', 'strtime', 'strdate', 'dllopen', 'dlllink',
908
+ 'dllcall', 'dllcall_argv', 'dllclose', 'env', 'exec', 'fork', 'getpid',
909
+ 'wait', 'popen', 'pclose', 'exit', 'kill', 'pthread_create',
910
+ 'pthread_create_argv', 'pthread_exit', 'pthread_join', 'pthread_kill',
911
+ 'smtp_send', 'http_get', 'http_post', 'http_download', 'socket', 'bind',
912
+ 'listen', 'accept', 'getsockname', 'getpeername', 'settimeout', 'connect',
913
+ 'server', 'recv', 'send', 'close', 'print', 'println', 'printf', 'input',
914
+ 'readline', 'serial_open', 'serial_fcntl', 'serial_get_attr',
915
+ 'serial_get_ispeed', 'serial_get_ospeed', 'serial_set_attr',
916
+ 'serial_set_ispeed', 'serial_set_ospeed', 'serial_write', 'serial_read',
917
+ 'serial_close', 'xml_load', 'xml_parse', 'fopen', 'fseek', 'ftell',
918
+ 'fsize', 'fread', 'fwrite', 'fgets', 'fclose', 'file', 'readdir',
919
+ 'pcre_replace', 'size', 'pop', 'unmap', 'has', 'keys', 'values',
920
+ 'length', 'find', 'substr', 'replace', 'split', 'trim', 'remove',
921
+ 'contains', 'join'), suffix=r'\b'),
922
+ Name.Builtin),
923
+ (words((
924
+ 'MethodReference', 'Runner', 'Dll', 'Thread', 'Pipe', 'Process',
925
+ 'Runnable', 'CGI', 'ClientSocket', 'Socket', 'ServerSocket',
926
+ 'File', 'Console', 'Directory', 'Exception'), suffix=r'\b'),
927
+ Keyword.Type),
928
+ (r'"(\\\\|\\"|[^"])*"', String),
929
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
930
+ (r'(\.)([a-zA-Z_]\w*)',
931
+ bygroups(Operator, Name.Attribute)),
932
+ (r'[a-zA-Z_]\w*:', Name.Label),
933
+ (r'[a-zA-Z_$]\w*', Name),
934
+ (r'[~^*!%&\[\](){}<>|+=:;,./?\-@]+', Operator),
935
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
936
+ (r'0x[0-9a-f]+', Number.Hex),
937
+ (r'[0-9]+L?', Number.Integer),
938
+ (r'\n', Text),
939
+ ],
940
+ 'class': [
941
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
942
+ ],
943
+ 'import': [
944
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
945
+ ],
946
+ }
947
+
948
+
949
+ class EasytrieveLexer(RegexLexer):
950
+ """
951
+ Easytrieve Plus is a programming language for extracting, filtering and
952
+ converting sequential data. Furthermore it can layout data for reports.
953
+ It is mainly used on mainframe platforms and can access several of the
954
+ mainframe's native file formats. It is somewhat comparable to awk.
955
+
956
+ .. versionadded:: 2.1
957
+ """
958
+ name = 'Easytrieve'
959
+ aliases = ['easytrieve']
960
+ filenames = ['*.ezt', '*.mac']
961
+ mimetypes = ['text/x-easytrieve']
962
+ flags = 0
963
+
964
+ # Note: We cannot use r'\b' at the start and end of keywords because
965
+ # Easytrieve Plus delimiter characters are:
966
+ #
967
+ # * space ( )
968
+ # * apostrophe (')
969
+ # * period (.)
970
+ # * comma (,)
971
+ # * paranthesis ( and )
972
+ # * colon (:)
973
+ #
974
+ # Additionally words end once a '*' appears, indicatins a comment.
975
+ _DELIMITERS = r' \'.,():\n'
976
+ _DELIMITERS_OR_COMENT = _DELIMITERS + '*'
977
+ _DELIMITER_PATTERN = '[' + _DELIMITERS + ']'
978
+ _DELIMITER_PATTERN_CAPTURE = '(' + _DELIMITER_PATTERN + ')'
979
+ _NON_DELIMITER_OR_COMMENT_PATTERN = '[^' + _DELIMITERS_OR_COMENT + ']'
980
+ _OPERATORS_PATTERN = u'[.+\\-/=\\[\\](){}<>;,&%¬]'
981
+ _KEYWORDS = [
982
+ 'AFTER-BREAK', 'AFTER-LINE', 'AFTER-SCREEN', 'AIM', 'AND', 'ATTR',
983
+ 'BEFORE', 'BEFORE-BREAK', 'BEFORE-LINE', 'BEFORE-SCREEN', 'BUSHU',
984
+ 'BY', 'CALL', 'CASE', 'CHECKPOINT', 'CHKP', 'CHKP-STATUS', 'CLEAR',
985
+ 'CLOSE', 'COL', 'COLOR', 'COMMIT', 'CONTROL', 'COPY', 'CURSOR', 'D',
986
+ 'DECLARE', 'DEFAULT', 'DEFINE', 'DELETE', 'DENWA', 'DISPLAY', 'DLI',
987
+ 'DO', 'DUPLICATE', 'E', 'ELSE', 'ELSE-IF', 'END', 'END-CASE',
988
+ 'END-DO', 'END-IF', 'END-PROC', 'ENDPAGE', 'ENDTABLE', 'ENTER', 'EOF',
989
+ 'EQ', 'ERROR', 'EXIT', 'EXTERNAL', 'EZLIB', 'F1', 'F10', 'F11', 'F12',
990
+ 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F2', 'F20', 'F21',
991
+ 'F22', 'F23', 'F24', 'F25', 'F26', 'F27', 'F28', 'F29', 'F3', 'F30',
992
+ 'F31', 'F32', 'F33', 'F34', 'F35', 'F36', 'F4', 'F5', 'F6', 'F7',
993
+ 'F8', 'F9', 'FETCH', 'FILE-STATUS', 'FILL', 'FINAL', 'FIRST',
994
+ 'FIRST-DUP', 'FOR', 'GE', 'GET', 'GO', 'GOTO', 'GQ', 'GR', 'GT',
995
+ 'HEADING', 'HEX', 'HIGH-VALUES', 'IDD', 'IDMS', 'IF', 'IN', 'INSERT',
996
+ 'JUSTIFY', 'KANJI-DATE', 'KANJI-DATE-LONG', 'KANJI-TIME', 'KEY',
997
+ 'KEY-PRESSED', 'KOKUGO', 'KUN', 'LAST-DUP', 'LE', 'LEVEL', 'LIKE',
998
+ 'LINE', 'LINE-COUNT', 'LINE-NUMBER', 'LINK', 'LIST', 'LOW-VALUES',
999
+ 'LQ', 'LS', 'LT', 'MACRO', 'MASK', 'MATCHED', 'MEND', 'MESSAGE',
1000
+ 'MOVE', 'MSTART', 'NE', 'NEWPAGE', 'NOMASK', 'NOPRINT', 'NOT',
1001
+ 'NOTE', 'NOVERIFY', 'NQ', 'NULL', 'OF', 'OR', 'OTHERWISE', 'PA1',
1002
+ 'PA2', 'PA3', 'PAGE-COUNT', 'PAGE-NUMBER', 'PARM-REGISTER',
1003
+ 'PATH-ID', 'PATTERN', 'PERFORM', 'POINT', 'POS', 'PRIMARY', 'PRINT',
1004
+ 'PROCEDURE', 'PROGRAM', 'PUT', 'READ', 'RECORD', 'RECORD-COUNT',
1005
+ 'RECORD-LENGTH', 'REFRESH', 'RELEASE', 'RENUM', 'REPEAT', 'REPORT',
1006
+ 'REPORT-INPUT', 'RESHOW', 'RESTART', 'RETRIEVE', 'RETURN-CODE',
1007
+ 'ROLLBACK', 'ROW', 'S', 'SCREEN', 'SEARCH', 'SECONDARY', 'SELECT',
1008
+ 'SEQUENCE', 'SIZE', 'SKIP', 'SOKAKU', 'SORT', 'SQL', 'STOP', 'SUM',
1009
+ 'SYSDATE', 'SYSDATE-LONG', 'SYSIN', 'SYSIPT', 'SYSLST', 'SYSPRINT',
1010
+ 'SYSSNAP', 'SYSTIME', 'TALLY', 'TERM-COLUMNS', 'TERM-NAME',
1011
+ 'TERM-ROWS', 'TERMINATION', 'TITLE', 'TO', 'TRANSFER', 'TRC',
1012
+ 'UNIQUE', 'UNTIL', 'UPDATE', 'UPPERCASE', 'USER', 'USERID', 'VALUE',
1013
+ 'VERIFY', 'W', 'WHEN', 'WHILE', 'WORK', 'WRITE', 'X', 'XDM', 'XRST'
1014
+ ]
1015
+
1016
+ tokens = {
1017
+ 'root': [
1018
+ (r'\*.*\n', Comment.Single),
1019
+ (r'\n+', Whitespace),
1020
+ # Macro argument
1021
+ (r'&' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+\.', Name.Variable,
1022
+ 'after_macro_argument'),
1023
+ # Macro call
1024
+ (r'%' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Variable),
1025
+ (r'(FILE|MACRO|REPORT)(\s+)',
1026
+ bygroups(Keyword.Declaration, Whitespace), 'after_declaration'),
1027
+ (r'(JOB|PARM)' + r'(' + _DELIMITER_PATTERN + r')',
1028
+ bygroups(Keyword.Declaration, Operator)),
1029
+ (words(_KEYWORDS, suffix=_DELIMITER_PATTERN_CAPTURE),
1030
+ bygroups(Keyword.Reserved, Operator)),
1031
+ (_OPERATORS_PATTERN, Operator),
1032
+ # Procedure declaration
1033
+ (r'(' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+)(\s*)(\.?)(\s*)(PROC)(\s*\n)',
1034
+ bygroups(Name.Function, Whitespace, Operator, Whitespace,
1035
+ Keyword.Declaration, Whitespace)),
1036
+ (r'[0-9]+\.[0-9]*', Number.Float),
1037
+ (r'[0-9]+', Number.Integer),
1038
+ (r"'(''|[^'])*'", String),
1039
+ (r'\s+', Whitespace),
1040
+ # Everything else just belongs to a name
1041
+ (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
1042
+ ],
1043
+ 'after_declaration': [
1044
+ (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Function),
1045
+ default('#pop'),
1046
+ ],
1047
+ 'after_macro_argument': [
1048
+ (r'\*.*\n', Comment.Single, '#pop'),
1049
+ (r'\s+', Whitespace, '#pop'),
1050
+ (_OPERATORS_PATTERN, Operator, '#pop'),
1051
+ (r"'(''|[^'])*'", String, '#pop'),
1052
+ # Everything else just belongs to a name
1053
+ (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
1054
+ ],
1055
+ }
1056
+ _COMMENT_LINE_REGEX = re.compile(r'^\s*\*')
1057
+ _MACRO_HEADER_REGEX = re.compile(r'^\s*MACRO')
1058
+
1059
+ def analyse_text(text):
1060
+ """
1061
+ Perform a structural analysis for basic Easytrieve constructs.
1062
+ """
1063
+ result = 0.0
1064
+ lines = text.split('\n')
1065
+ hasEndProc = False
1066
+ hasHeaderComment = False
1067
+ hasFile = False
1068
+ hasJob = False
1069
+ hasProc = False
1070
+ hasParm = False
1071
+ hasReport = False
1072
+
1073
+ def isCommentLine(line):
1074
+ return EasytrieveLexer._COMMENT_LINE_REGEX.match(lines[0]) is not None
1075
+
1076
+ def isEmptyLine(line):
1077
+ return not bool(line.strip())
1078
+
1079
+ # Remove possible empty lines and header comments.
1080
+ while lines and (isEmptyLine(lines[0]) or isCommentLine(lines[0])):
1081
+ if not isEmptyLine(lines[0]):
1082
+ hasHeaderComment = True
1083
+ del lines[0]
1084
+
1085
+ if EasytrieveLexer._MACRO_HEADER_REGEX.match(lines[0]):
1086
+ # Looks like an Easytrieve macro.
1087
+ result = 0.4
1088
+ if hasHeaderComment:
1089
+ result += 0.4
1090
+ else:
1091
+ # Scan the source for lines starting with indicators.
1092
+ for line in lines:
1093
+ words = line.split()
1094
+ if (len(words) >= 2):
1095
+ firstWord = words[0]
1096
+ if not hasReport:
1097
+ if not hasJob:
1098
+ if not hasFile:
1099
+ if not hasParm:
1100
+ if firstWord == 'PARM':
1101
+ hasParm = True
1102
+ if firstWord == 'FILE':
1103
+ hasFile = True
1104
+ if firstWord == 'JOB':
1105
+ hasJob = True
1106
+ elif firstWord == 'PROC':
1107
+ hasProc = True
1108
+ elif firstWord == 'END-PROC':
1109
+ hasEndProc = True
1110
+ elif firstWord == 'REPORT':
1111
+ hasReport = True
1112
+
1113
+ # Weight the findings.
1114
+ if hasJob and (hasProc == hasEndProc):
1115
+ if hasHeaderComment:
1116
+ result += 0.1
1117
+ if hasParm:
1118
+ if hasProc:
1119
+ # Found PARM, JOB and PROC/END-PROC:
1120
+ # pretty sure this is Easytrieve.
1121
+ result += 0.8
1122
+ else:
1123
+ # Found PARAM and JOB: probably this is Easytrieve
1124
+ result += 0.5
1125
+ else:
1126
+ # Found JOB and possibly other keywords: might be Easytrieve
1127
+ result += 0.11
1128
+ if hasParm:
1129
+ # Note: PARAM is not a proper English word, so this is
1130
+ # regarded a much better indicator for Easytrieve than
1131
+ # the other words.
1132
+ result += 0.2
1133
+ if hasFile:
1134
+ result += 0.01
1135
+ if hasReport:
1136
+ result += 0.01
1137
+ assert 0.0 <= result <= 1.0
1138
+ return result
1139
+
1140
+
1141
+ class JclLexer(RegexLexer):
1142
+ """
1143
+ `Job Control Language (JCL)
1144
+ <http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IEA2B570/CCONTENTS>`_
1145
+ is a scripting language used on mainframe platforms to instruct the system
1146
+ on how to run a batch job or start a subsystem. It is somewhat
1147
+ comparable to MS DOS batch and Unix shell scripts.
1148
+
1149
+ .. versionadded:: 2.1
1150
+ """
1151
+ name = 'JCL'
1152
+ aliases = ['jcl']
1153
+ filenames = ['*.jcl']
1154
+ mimetypes = ['text/x-jcl']
1155
+ flags = re.IGNORECASE
1156
+
1157
+ tokens = {
1158
+ 'root': [
1159
+ (r'//\*.*\n', Comment.Single),
1160
+ (r'//', Keyword.Pseudo, 'statement'),
1161
+ (r'/\*', Keyword.Pseudo, 'jes2_statement'),
1162
+ # TODO: JES3 statement
1163
+ (r'.*\n', Other) # Input text or inline code in any language.
1164
+ ],
1165
+ 'statement': [
1166
+ (r'\s*\n', Whitespace, '#pop'),
1167
+ (r'([a-z]\w*)(\s+)(exec|job)(\s*)',
1168
+ bygroups(Name.Label, Whitespace, Keyword.Reserved, Whitespace),
1169
+ 'option'),
1170
+ (r'[a-z]\w*', Name.Variable, 'statement_command'),
1171
+ (r'\s+', Whitespace, 'statement_command'),
1172
+ ],
1173
+ 'statement_command': [
1174
+ (r'\s+(command|cntl|dd|endctl|endif|else|include|jcllib|'
1175
+ r'output|pend|proc|set|then|xmit)\s+', Keyword.Reserved, 'option'),
1176
+ include('option')
1177
+ ],
1178
+ 'jes2_statement': [
1179
+ (r'\s*\n', Whitespace, '#pop'),
1180
+ (r'\$', Keyword, 'option'),
1181
+ (r'\b(jobparam|message|netacct|notify|output|priority|route|'
1182
+ r'setup|signoff|xeq|xmit)\b', Keyword, 'option'),
1183
+ ],
1184
+ 'option': [
1185
+ # (r'\n', Text, 'root'),
1186
+ (r'\*', Name.Builtin),
1187
+ (r'[\[\](){}<>;,]', Punctuation),
1188
+ (r'[-+*/=&%]', Operator),
1189
+ (r'[a-z_]\w*', Name),
1190
+ (r'\d+\.\d*', Number.Float),
1191
+ (r'\.\d+', Number.Float),
1192
+ (r'\d+', Number.Integer),
1193
+ (r"'", String, 'option_string'),
1194
+ (r'[ \t]+', Whitespace, 'option_comment'),
1195
+ (r'\.', Punctuation),
1196
+ ],
1197
+ 'option_string': [
1198
+ (r"(\n)(//)", bygroups(Text, Keyword.Pseudo)),
1199
+ (r"''", String),
1200
+ (r"[^']", String),
1201
+ (r"'", String, '#pop'),
1202
+ ],
1203
+ 'option_comment': [
1204
+ # (r'\n', Text, 'root'),
1205
+ (r'.+', Comment.Single),
1206
+ ]
1207
+ }
1208
+
1209
+ _JOB_HEADER_PATTERN = re.compile(r'^//[a-z#$@][a-z0-9#$@]{0,7}\s+job(\s+.*)?$',
1210
+ re.IGNORECASE)
1211
+
1212
+ def analyse_text(text):
1213
+ """
1214
+ Recognize JCL job by header.
1215
+ """
1216
+ result = 0.0
1217
+ lines = text.split('\n')
1218
+ if len(lines) > 0:
1219
+ if JclLexer._JOB_HEADER_PATTERN.match(lines[0]):
1220
+ result = 1.0
1221
+ assert 0.0 <= result <= 1.0
1222
+ return result