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,1573 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pygments.lexers.jvm
4
+ ~~~~~~~~~~~~~~~~~~~
5
+
6
+ Pygments lexers for JVM 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 Lexer, RegexLexer, include, bygroups, using, \
15
+ this, combined, default, words
16
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
17
+ Number, Punctuation
18
+ from pygments.util import shebang_matches
19
+ from pygments import unistring as uni
20
+
21
+ __all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
22
+ 'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'ClojureScriptLexer',
23
+ 'KotlinLexer', 'XtendLexer', 'AspectJLexer', 'CeylonLexer',
24
+ 'PigLexer', 'GoloLexer', 'JasminLexer']
25
+
26
+
27
+ class JavaLexer(RegexLexer):
28
+ """
29
+ For `Java <http://www.sun.com/java/>`_ source code.
30
+ """
31
+
32
+ name = 'Java'
33
+ aliases = ['java']
34
+ filenames = ['*.java']
35
+ mimetypes = ['text/x-java']
36
+
37
+ flags = re.MULTILINE | re.DOTALL | re.UNICODE
38
+
39
+ tokens = {
40
+ 'root': [
41
+ (r'[^\S\n]+', Text),
42
+ (r'//.*?\n', Comment.Single),
43
+ (r'/\*.*?\*/', Comment.Multiline),
44
+ # keywords: go before method names to avoid lexing "throw new XYZ"
45
+ # as a method signature
46
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
47
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while)\b',
48
+ Keyword),
49
+ # method names
50
+ (r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments
51
+ r'((?:[^\W\d]|\$)[\w$]*)' # method name
52
+ r'(\s*)(\()', # signature start
53
+ bygroups(using(this), Name.Function, Text, Operator)),
54
+ (r'@[^\W\d][\w.]*', Name.Decorator),
55
+ (r'(abstract|const|enum|extends|final|implements|native|private|'
56
+ r'protected|public|static|strictfp|super|synchronized|throws|'
57
+ r'transient|volatile)\b', Keyword.Declaration),
58
+ (r'(boolean|byte|char|double|float|int|long|short|void)\b',
59
+ Keyword.Type),
60
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
61
+ (r'(true|false|null)\b', Keyword.Constant),
62
+ (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
63
+ 'class'),
64
+ (r'(import(?:\s+static)?)(\s+)', bygroups(Keyword.Namespace, Text),
65
+ 'import'),
66
+ (r'"(\\\\|\\"|[^"])*"', String),
67
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
68
+ (r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Operator, Name.Attribute)),
69
+ (r'^\s*([^\W\d]|\$)[\w$]*:', Name.Label),
70
+ (r'([^\W\d]|\$)[\w$]*', Name),
71
+ (r'([0-9][0-9_]*\.([0-9][0-9_]*)?|'
72
+ r'\.[0-9][0-9_]*)'
73
+ r'([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|'
74
+ r'[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|'
75
+ r'[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|'
76
+ r'0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|'
77
+ r'([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)'
78
+ r'[pP][+\-]?[0-9][0-9_]*[fFdD]?', Number.Float),
79
+ (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?', Number.Hex),
80
+ (r'0[bB][01][01_]*[lL]?', Number.Bin),
81
+ (r'0[0-7_]+[lL]?', Number.Oct),
82
+ (r'0|[1-9][0-9_]*[lL]?', Number.Integer),
83
+ (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
84
+ (r'\n', Text)
85
+ ],
86
+ 'class': [
87
+ (r'([^\W\d]|\$)[\w$]*', Name.Class, '#pop')
88
+ ],
89
+ 'import': [
90
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
91
+ ],
92
+ }
93
+
94
+
95
+ class AspectJLexer(JavaLexer):
96
+ """
97
+ For `AspectJ <http://www.eclipse.org/aspectj/>`_ source code.
98
+
99
+ .. versionadded:: 1.6
100
+ """
101
+
102
+ name = 'AspectJ'
103
+ aliases = ['aspectj']
104
+ filenames = ['*.aj']
105
+ mimetypes = ['text/x-aspectj']
106
+
107
+ aj_keywords = set((
108
+ 'aspect', 'pointcut', 'privileged', 'call', 'execution',
109
+ 'initialization', 'preinitialization', 'handler', 'get', 'set',
110
+ 'staticinitialization', 'target', 'args', 'within', 'withincode',
111
+ 'cflow', 'cflowbelow', 'annotation', 'before', 'after', 'around',
112
+ 'proceed', 'throwing', 'returning', 'adviceexecution', 'declare',
113
+ 'parents', 'warning', 'error', 'soft', 'precedence', 'thisJoinPoint',
114
+ 'thisJoinPointStaticPart', 'thisEnclosingJoinPointStaticPart',
115
+ 'issingleton', 'perthis', 'pertarget', 'percflow', 'percflowbelow',
116
+ 'pertypewithin', 'lock', 'unlock', 'thisAspectInstance'
117
+ ))
118
+ aj_inter_type = set(('parents:', 'warning:', 'error:', 'soft:', 'precedence:'))
119
+ aj_inter_type_annotation = set(('@type', '@method', '@constructor', '@field'))
120
+
121
+ def get_tokens_unprocessed(self, text):
122
+ for index, token, value in JavaLexer.get_tokens_unprocessed(self, text):
123
+ if token is Name and value in self.aj_keywords:
124
+ yield index, Keyword, value
125
+ elif token is Name.Label and value in self.aj_inter_type:
126
+ yield index, Keyword, value[:-1]
127
+ yield index, Operator, value[-1]
128
+ elif token is Name.Decorator and value in self.aj_inter_type_annotation:
129
+ yield index, Keyword, value
130
+ else:
131
+ yield index, token, value
132
+
133
+
134
+ class ScalaLexer(RegexLexer):
135
+ """
136
+ For `Scala <http://www.scala-lang.org>`_ source code.
137
+ """
138
+
139
+ name = 'Scala'
140
+ aliases = ['scala']
141
+ filenames = ['*.scala']
142
+ mimetypes = ['text/x-scala']
143
+
144
+ flags = re.MULTILINE | re.DOTALL
145
+
146
+ # don't use raw unicode strings!
147
+ op = (u'[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1'
148
+ u'\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9'
149
+ u'\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2'
150
+ u'\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38'
151
+ u'\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940'
152
+ u'\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c'
153
+ u'\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118'
154
+ u'\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144'
155
+ u'\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767'
156
+ u'\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb'
157
+ u'\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020'
158
+ u'\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3'
159
+ u'\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff'
160
+ u'\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66'
161
+ u'\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+')
162
+
163
+ letter = (u'[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6'
164
+ u'\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386'
165
+ u'\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2'
166
+ u'\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5'
167
+ u'\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5'
168
+ u'\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961'
169
+ u'\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1'
170
+ u'\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd'
171
+ u'\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9'
172
+ u'\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1'
173
+ u'\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30'
174
+ u'\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4'
175
+ u'\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f'
176
+ u'\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070'
177
+ u'\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f'
178
+ u'\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711'
179
+ u'\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc'
180
+ u'\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7'
181
+ u'\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf'
182
+ u'\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77'
183
+ u'\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb'
184
+ u'\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113'
185
+ u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139'
186
+ u'\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c'
187
+ u'\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029'
188
+ u'\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e'
189
+ u'\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c'
190
+ u'\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f'
191
+ u'\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822'
192
+ u'\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28'
193
+ u'\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28'
194
+ u'\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a'
195
+ u'\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]')
196
+
197
+ upper = (u'[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108'
198
+ u'\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c'
199
+ u'\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130'
200
+ u'\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145'
201
+ u'\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a'
202
+ u'\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e'
203
+ u'\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182'
204
+ u'\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194'
205
+ u'\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7'
206
+ u'\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc'
207
+ u'\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9'
208
+ u'\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee'
209
+ u'\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204'
210
+ u'\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218'
211
+ u'\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c'
212
+ u'\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246'
213
+ u'\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f'
214
+ u'\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0'
215
+ u'\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7'
216
+ u'\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a'
217
+ u'\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e'
218
+ u'\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a'
219
+ u'\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae'
220
+ u'\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1'
221
+ u'\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6'
222
+ u'\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea'
223
+ u'\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe'
224
+ u'\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512'
225
+ u'\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556'
226
+ u'\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e'
227
+ u'\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22'
228
+ u'\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36'
229
+ u'\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a'
230
+ u'\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e'
231
+ u'\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72'
232
+ u'\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86'
233
+ u'\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2'
234
+ u'\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6'
235
+ u'\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca'
236
+ u'\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede'
237
+ u'\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2'
238
+ u'\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d'
239
+ u'\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f'
240
+ u'\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb'
241
+ u'\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112'
242
+ u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133'
243
+ u'\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67'
244
+ u'\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86'
245
+ u'\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a'
246
+ u'\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae'
247
+ u'\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2'
248
+ u'\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6'
249
+ u'\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646'
250
+ u'\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a'
251
+ u'\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682'
252
+ u'\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696'
253
+ u'\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736'
254
+ u'\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a'
255
+ u'\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e'
256
+ u'\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b'
257
+ u'\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]')
258
+
259
+ idrest = u'%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op)
260
+ letter_letter_digit = u'%s(?:%s|\d)*' % (letter, letter)
261
+
262
+ tokens = {
263
+ 'root': [
264
+ # method names
265
+ (r'(class|trait|object)(\s+)', bygroups(Keyword, Text), 'class'),
266
+ (r'[^\S\n]+', Text),
267
+ (r'//.*?\n', Comment.Single),
268
+ (r'/\*', Comment.Multiline, 'comment'),
269
+ (u'@%s' % idrest, Name.Decorator),
270
+ (u'(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|'
271
+ u'f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|'
272
+ u'lazy|match|new|override|pr(?:ivate|otected)'
273
+ u'|re(?:quires|turn)|s(?:ealed|uper)|'
274
+ u't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\\b|'
275
+ u'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\\b|(?=\\s)|$)', Keyword),
276
+ (u':(?!%s)' % op, Keyword, 'type'),
277
+ (u'%s%s\\b' % (upper, idrest), Name.Class),
278
+ (r'(true|false|null)\b', Keyword.Constant),
279
+ (r'(import|package)(\s+)', bygroups(Keyword, Text), 'import'),
280
+ (r'(type)(\s+)', bygroups(Keyword, Text), 'type'),
281
+ (r'""".*?"""(?!")', String),
282
+ (r'"(\\\\|\\"|[^"])*"', String),
283
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
284
+ (u"'%s" % idrest, Text.Symbol),
285
+ (r'[fs]"""', String, 'interptriplestring'), # interpolated strings
286
+ (r'[fs]"', String, 'interpstring'), # interpolated strings
287
+ (r'raw"(\\\\|\\"|[^"])*"', String), # raw strings
288
+ # (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator,
289
+ # Name.Attribute)),
290
+ (idrest, Name),
291
+ (r'`[^`]+`', Name),
292
+ (r'\[', Operator, 'typeparam'),
293
+ (r'[(){};,.#]', Operator),
294
+ (op, Operator),
295
+ (r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?',
296
+ Number.Float),
297
+ (r'0x[0-9a-fA-F]+', Number.Hex),
298
+ (r'[0-9]+L?', Number.Integer),
299
+ (r'\n', Text)
300
+ ],
301
+ 'class': [
302
+ (u'(%s|%s|`[^`]+`)(\\s*)(\\[)' % (idrest, op),
303
+ bygroups(Name.Class, Text, Operator), 'typeparam'),
304
+ (r'\s+', Text),
305
+ (r'\{', Operator, '#pop'),
306
+ (r'\(', Operator, '#pop'),
307
+ (r'//.*?\n', Comment.Single, '#pop'),
308
+ (u'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop'),
309
+ ],
310
+ 'type': [
311
+ (r'\s+', Text),
312
+ (r'<[%:]|>:|[#_]|forSome|type', Keyword),
313
+ (u'([,);}]|=>|=|\u21d2)(\\s*)', bygroups(Operator, Text), '#pop'),
314
+ (r'[({]', Operator, '#push'),
315
+ (u'((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)(\\[)' %
316
+ (idrest, op, idrest, op),
317
+ bygroups(Keyword.Type, Text, Operator), ('#pop', 'typeparam')),
318
+ (u'((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)$' %
319
+ (idrest, op, idrest, op),
320
+ bygroups(Keyword.Type, Text), '#pop'),
321
+ (r'//.*?\n', Comment.Single, '#pop'),
322
+ (u'\\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
323
+ ],
324
+ 'typeparam': [
325
+ (r'[\s,]+', Text),
326
+ (u'<[%:]|=>|>:|[#_\u21D2]|forSome|type', Keyword),
327
+ (r'([\])}])', Operator, '#pop'),
328
+ (r'[(\[{]', Operator, '#push'),
329
+ (u'\\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type)
330
+ ],
331
+ 'comment': [
332
+ (r'[^/*]+', Comment.Multiline),
333
+ (r'/\*', Comment.Multiline, '#push'),
334
+ (r'\*/', Comment.Multiline, '#pop'),
335
+ (r'[*/]', Comment.Multiline)
336
+ ],
337
+ 'import': [
338
+ (u'(%s|\\.)+' % idrest, Name.Namespace, '#pop')
339
+ ],
340
+ 'interpstringcommon': [
341
+ (r'[^"$\\]+', String),
342
+ (r'\$\$', String),
343
+ (r'\$' + letter_letter_digit, String.Interpol),
344
+ (r'\$\{', String.Interpol, 'interpbrace'),
345
+ (r'\\.', String),
346
+ ],
347
+ 'interptriplestring': [
348
+ (r'"""(?!")', String, '#pop'),
349
+ (r'"', String),
350
+ include('interpstringcommon'),
351
+ ],
352
+ 'interpstring': [
353
+ (r'"', String, '#pop'),
354
+ include('interpstringcommon'),
355
+ ],
356
+ 'interpbrace': [
357
+ (r'\}', String.Interpol, '#pop'),
358
+ (r'\{', String.Interpol, '#push'),
359
+ include('root'),
360
+ ],
361
+ }
362
+
363
+
364
+ class GosuLexer(RegexLexer):
365
+ """
366
+ For Gosu source code.
367
+
368
+ .. versionadded:: 1.5
369
+ """
370
+
371
+ name = 'Gosu'
372
+ aliases = ['gosu']
373
+ filenames = ['*.gs', '*.gsx', '*.gsp', '*.vark']
374
+ mimetypes = ['text/x-gosu']
375
+
376
+ flags = re.MULTILINE | re.DOTALL
377
+
378
+ tokens = {
379
+ 'root': [
380
+ # method names
381
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # modifiers etc.
382
+ r'([a-zA-Z_]\w*)' # method name
383
+ r'(\s*)(\()', # signature start
384
+ bygroups(using(this), Name.Function, Text, Operator)),
385
+ (r'[^\S\n]+', Text),
386
+ (r'//.*?\n', Comment.Single),
387
+ (r'/\*.*?\*/', Comment.Multiline),
388
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
389
+ (r'(in|as|typeof|statictypeof|typeis|typeas|if|else|foreach|for|'
390
+ r'index|while|do|continue|break|return|try|catch|finally|this|'
391
+ r'throw|new|switch|case|default|eval|super|outer|classpath|'
392
+ r'using)\b', Keyword),
393
+ (r'(var|delegate|construct|function|private|internal|protected|'
394
+ r'public|abstract|override|final|static|extends|transient|'
395
+ r'implements|represents|readonly)\b', Keyword.Declaration),
396
+ (r'(property\s+)(get|set)?', Keyword.Declaration),
397
+ (r'(boolean|byte|char|double|float|int|long|short|void|block)\b',
398
+ Keyword.Type),
399
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
400
+ (r'(true|false|null|NaN|Infinity)\b', Keyword.Constant),
401
+ (r'(class|interface|enhancement|enum)(\s+)([a-zA-Z_]\w*)',
402
+ bygroups(Keyword.Declaration, Text, Name.Class)),
403
+ (r'(uses)(\s+)([\w.]+\*?)',
404
+ bygroups(Keyword.Namespace, Text, Name.Namespace)),
405
+ (r'"', String, 'string'),
406
+ (r'(\??[.#])([a-zA-Z_]\w*)',
407
+ bygroups(Operator, Name.Attribute)),
408
+ (r'(:)([a-zA-Z_]\w*)',
409
+ bygroups(Operator, Name.Attribute)),
410
+ (r'[a-zA-Z_$]\w*', Name),
411
+ (r'and|or|not|[\\~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
412
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
413
+ (r'[0-9]+', Number.Integer),
414
+ (r'\n', Text)
415
+ ],
416
+ 'templateText': [
417
+ (r'(\\<)|(\\\$)', String),
418
+ (r'(<%@\s+)(extends|params)',
419
+ bygroups(Operator, Name.Decorator), 'stringTemplate'),
420
+ (r'<%!--.*?--%>', Comment.Multiline),
421
+ (r'(<%)|(<%=)', Operator, 'stringTemplate'),
422
+ (r'\$\{', Operator, 'stringTemplateShorthand'),
423
+ (r'.', String)
424
+ ],
425
+ 'string': [
426
+ (r'"', String, '#pop'),
427
+ include('templateText')
428
+ ],
429
+ 'stringTemplate': [
430
+ (r'"', String, 'string'),
431
+ (r'%>', Operator, '#pop'),
432
+ include('root')
433
+ ],
434
+ 'stringTemplateShorthand': [
435
+ (r'"', String, 'string'),
436
+ (r'\{', Operator, 'stringTemplateShorthand'),
437
+ (r'\}', Operator, '#pop'),
438
+ include('root')
439
+ ],
440
+ }
441
+
442
+
443
+ class GosuTemplateLexer(Lexer):
444
+ """
445
+ For Gosu templates.
446
+
447
+ .. versionadded:: 1.5
448
+ """
449
+
450
+ name = 'Gosu Template'
451
+ aliases = ['gst']
452
+ filenames = ['*.gst']
453
+ mimetypes = ['text/x-gosu-template']
454
+
455
+ def get_tokens_unprocessed(self, text):
456
+ lexer = GosuLexer()
457
+ stack = ['templateText']
458
+ for item in lexer.get_tokens_unprocessed(text, stack):
459
+ yield item
460
+
461
+
462
+ class GroovyLexer(RegexLexer):
463
+ """
464
+ For `Groovy <http://groovy.codehaus.org/>`_ source code.
465
+
466
+ .. versionadded:: 1.5
467
+ """
468
+
469
+ name = 'Groovy'
470
+ aliases = ['groovy']
471
+ filenames = ['*.groovy','*.gradle']
472
+ mimetypes = ['text/x-groovy']
473
+
474
+ flags = re.MULTILINE | re.DOTALL
475
+
476
+ tokens = {
477
+ 'root': [
478
+ # Groovy allows a file to start with a shebang
479
+ (r'#!(.*?)$', Comment.Preproc, 'base'),
480
+ default('base'),
481
+ ],
482
+ 'base': [
483
+ # method names
484
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
485
+ r'([a-zA-Z_]\w*)' # method name
486
+ r'(\s*)(\()', # signature start
487
+ bygroups(using(this), Name.Function, Text, Operator)),
488
+ (r'[^\S\n]+', Text),
489
+ (r'//.*?\n', Comment.Single),
490
+ (r'/\*.*?\*/', Comment.Multiline),
491
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
492
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
493
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b',
494
+ Keyword),
495
+ (r'(abstract|const|enum|extends|final|implements|native|private|'
496
+ r'protected|public|static|strictfp|super|synchronized|throws|'
497
+ r'transient|volatile)\b', Keyword.Declaration),
498
+ (r'(def|boolean|byte|char|double|float|int|long|short|void)\b',
499
+ Keyword.Type),
500
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
501
+ (r'(true|false|null)\b', Keyword.Constant),
502
+ (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
503
+ 'class'),
504
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
505
+ (r'""".*?"""', String.Double),
506
+ (r"'''.*?'''", String.Single),
507
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
508
+ (r"'(\\\\|\\'|[^'])*'", String.Single),
509
+ (r'\$/((?!/\$).)*/\$', String),
510
+ (r'/(\\\\|\\"|[^/])*/', String),
511
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
512
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
513
+ (r'[a-zA-Z_]\w*:', Name.Label),
514
+ (r'[a-zA-Z_$]\w*', Name),
515
+ (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
516
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
517
+ (r'0x[0-9a-fA-F]+', Number.Hex),
518
+ (r'[0-9]+L?', Number.Integer),
519
+ (r'\n', Text)
520
+ ],
521
+ 'class': [
522
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
523
+ ],
524
+ 'import': [
525
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
526
+ ],
527
+ }
528
+
529
+ def analyse_text(text):
530
+ return shebang_matches(text, r'groovy')
531
+
532
+
533
+ class IokeLexer(RegexLexer):
534
+ """
535
+ For `Ioke <http://ioke.org/>`_ (a strongly typed, dynamic,
536
+ prototype based programming language) source.
537
+
538
+ .. versionadded:: 1.4
539
+ """
540
+ name = 'Ioke'
541
+ filenames = ['*.ik']
542
+ aliases = ['ioke', 'ik']
543
+ mimetypes = ['text/x-iokesrc']
544
+ tokens = {
545
+ 'interpolatableText': [
546
+ (r'(\\b|\\e|\\t|\\n|\\f|\\r|\\"|\\\\|\\#|\\\Z|\\u[0-9a-fA-F]{1,4}'
547
+ r'|\\[0-3]?[0-7]?[0-7])', String.Escape),
548
+ (r'#\{', Punctuation, 'textInterpolationRoot')
549
+ ],
550
+
551
+ 'text': [
552
+ (r'(?<!\\)"', String, '#pop'),
553
+ include('interpolatableText'),
554
+ (r'[^"]', String)
555
+ ],
556
+
557
+ 'documentation': [
558
+ (r'(?<!\\)"', String.Doc, '#pop'),
559
+ include('interpolatableText'),
560
+ (r'[^"]', String.Doc)
561
+ ],
562
+
563
+ 'textInterpolationRoot': [
564
+ (r'\}', Punctuation, '#pop'),
565
+ include('root')
566
+ ],
567
+
568
+ 'slashRegexp': [
569
+ (r'(?<!\\)/[im-psux]*', String.Regex, '#pop'),
570
+ include('interpolatableText'),
571
+ (r'\\/', String.Regex),
572
+ (r'[^/]', String.Regex)
573
+ ],
574
+
575
+ 'squareRegexp': [
576
+ (r'(?<!\\)][im-psux]*', String.Regex, '#pop'),
577
+ include('interpolatableText'),
578
+ (r'\\]', String.Regex),
579
+ (r'[^\]]', String.Regex)
580
+ ],
581
+
582
+ 'squareText': [
583
+ (r'(?<!\\)]', String, '#pop'),
584
+ include('interpolatableText'),
585
+ (r'[^\]]', String)
586
+ ],
587
+
588
+ 'root': [
589
+ (r'\n', Text),
590
+ (r'\s+', Text),
591
+
592
+ # Comments
593
+ (r';(.*?)\n', Comment),
594
+ (r'\A#!(.*?)\n', Comment),
595
+
596
+ # Regexps
597
+ (r'#/', String.Regex, 'slashRegexp'),
598
+ (r'#r\[', String.Regex, 'squareRegexp'),
599
+
600
+ # Symbols
601
+ (r':[\w!:?]+', String.Symbol),
602
+ (r'[\w!:?]+:(?![\w!?])', String.Other),
603
+ (r':"(\\\\|\\"|[^"])*"', String.Symbol),
604
+
605
+ # Documentation
606
+ (r'((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()'
607
+ r'|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()'
608
+ r'|(?<=dsyntax\())\s*"', String.Doc, 'documentation'),
609
+
610
+ # Text
611
+ (r'"', String, 'text'),
612
+ (r'#\[', String, 'squareText'),
613
+
614
+ # Mimic
615
+ (r'\w[\w!:?]+(?=\s*=.*mimic\s)', Name.Entity),
616
+
617
+ # Assignment
618
+ (r'[a-zA-Z_][\w!:?]*(?=[\s]*[+*/-]?=[^=].*($|\.))',
619
+ Name.Variable),
620
+
621
+ # keywords
622
+ (r'(break|cond|continue|do|ensure|for|for:dict|for:set|if|let|'
623
+ r'loop|p:for|p:for:dict|p:for:set|return|unless|until|while|'
624
+ r'with)(?![\w!:?])', Keyword.Reserved),
625
+
626
+ # Origin
627
+ (r'(eval|mimic|print|println)(?![\w!:?])', Keyword),
628
+
629
+ # Base
630
+ (r'(cell\?|cellNames|cellOwner\?|cellOwner|cells|cell|'
631
+ r'documentation|hash|identity|mimic|removeCell\!|undefineCell\!)'
632
+ r'(?![\w!:?])', Keyword),
633
+
634
+ # Ground
635
+ (r'(stackTraceAsText)(?![\w!:?])', Keyword),
636
+
637
+ # DefaultBehaviour Literals
638
+ (r'(dict|list|message|set)(?![\w!:?])', Keyword.Reserved),
639
+
640
+ # DefaultBehaviour Case
641
+ (r'(case|case:and|case:else|case:nand|case:nor|case:not|case:or|'
642
+ r'case:otherwise|case:xor)(?![\w!:?])', Keyword.Reserved),
643
+
644
+ # DefaultBehaviour Reflection
645
+ (r'(asText|become\!|derive|freeze\!|frozen\?|in\?|is\?|kind\?|'
646
+ r'mimic\!|mimics|mimics\?|prependMimic\!|removeAllMimics\!|'
647
+ r'removeMimic\!|same\?|send|thaw\!|uniqueHexId)'
648
+ r'(?![\w!:?])', Keyword),
649
+
650
+ # DefaultBehaviour Aspects
651
+ (r'(after|around|before)(?![\w!:?])', Keyword.Reserved),
652
+
653
+ # DefaultBehaviour
654
+ (r'(kind|cellDescriptionDict|cellSummary|genSym|inspect|notice)'
655
+ r'(?![\w!:?])', Keyword),
656
+ (r'(use|destructuring)', Keyword.Reserved),
657
+
658
+ # DefaultBehavior BaseBehavior
659
+ (r'(cell\?|cellOwner\?|cellOwner|cellNames|cells|cell|'
660
+ r'documentation|identity|removeCell!|undefineCell)'
661
+ r'(?![\w!:?])', Keyword),
662
+
663
+ # DefaultBehavior Internal
664
+ (r'(internal:compositeRegexp|internal:concatenateText|'
665
+ r'internal:createDecimal|internal:createNumber|'
666
+ r'internal:createRegexp|internal:createText)'
667
+ r'(?![\w!:?])', Keyword.Reserved),
668
+
669
+ # DefaultBehaviour Conditions
670
+ (r'(availableRestarts|bind|error\!|findRestart|handle|'
671
+ r'invokeRestart|rescue|restart|signal\!|warn\!)'
672
+ r'(?![\w!:?])', Keyword.Reserved),
673
+
674
+ # constants
675
+ (r'(nil|false|true)(?![\w!:?])', Name.Constant),
676
+
677
+ # names
678
+ (r'(Arity|Base|Call|Condition|DateTime|Aspects|Pointcut|'
679
+ r'Assignment|BaseBehavior|Boolean|Case|AndCombiner|Else|'
680
+ r'NAndCombiner|NOrCombiner|NotCombiner|OrCombiner|XOrCombiner|'
681
+ r'Conditions|Definitions|FlowControl|Internal|Literals|'
682
+ r'Reflection|DefaultMacro|DefaultMethod|DefaultSyntax|Dict|'
683
+ r'FileSystem|Ground|Handler|Hook|IO|IokeGround|Struct|'
684
+ r'LexicalBlock|LexicalMacro|List|Message|Method|Mixins|'
685
+ r'NativeMethod|Number|Origin|Pair|Range|Reflector|Regexp Match|'
686
+ r'Regexp|Rescue|Restart|Runtime|Sequence|Set|Symbol|'
687
+ r'System|Text|Tuple)(?![\w!:?])', Name.Builtin),
688
+
689
+ # functions
690
+ (u'(generateMatchMethod|aliasMethod|\u03bb|\u028E|fnx|fn|method|'
691
+ u'dmacro|dlecro|syntax|macro|dlecrox|lecrox|lecro|syntax)'
692
+ u'(?![\w!:?])', Name.Function),
693
+
694
+ # Numbers
695
+ (r'-?0[xX][0-9a-fA-F]+', Number.Hex),
696
+ (r'-?(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
697
+ (r'-?\d+', Number.Integer),
698
+
699
+ (r'#\(', Punctuation),
700
+
701
+ # Operators
702
+ (r'(&&>>|\|\|>>|\*\*>>|:::|::|\.\.\.|===|\*\*>|\*\*=|&&>|&&=|'
703
+ r'\|\|>|\|\|=|\->>|\+>>|!>>|<>>>|<>>|&>>|%>>|#>>|@>>|/>>|\*>>|'
704
+ r'\?>>|\|>>|\^>>|~>>|\$>>|=>>|<<=|>>=|<=>|<\->|=~|!~|=>|\+\+|'
705
+ r'\-\-|<=|>=|==|!=|&&|\.\.|\+=|\-=|\*=|\/=|%=|&=|\^=|\|=|<\-|'
706
+ r'\+>|!>|<>|&>|%>|#>|\@>|\/>|\*>|\?>|\|>|\^>|~>|\$>|<\->|\->|'
707
+ r'<<|>>|\*\*|\?\||\?&|\|\||>|<|\*|\/|%|\+|\-|&|\^|\||=|\$|!|~|'
708
+ u'\\?|#|\u2260|\u2218|\u2208|\u2209)', Operator),
709
+ (r'(and|nand|or|xor|nor|return|import)(?![\w!?])',
710
+ Operator),
711
+
712
+ # Punctuation
713
+ (r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|\{|\})', Punctuation),
714
+
715
+ # kinds
716
+ (r'[A-Z][\w!:?]*', Name.Class),
717
+
718
+ # default cellnames
719
+ (r'[a-z_][\w!:?]*', Name)
720
+ ]
721
+ }
722
+
723
+
724
+ class ClojureLexer(RegexLexer):
725
+ """
726
+ Lexer for `Clojure <http://clojure.org/>`_ source code.
727
+
728
+ .. versionadded:: 0.11
729
+ """
730
+ name = 'Clojure'
731
+ aliases = ['clojure', 'clj']
732
+ filenames = ['*.clj']
733
+ mimetypes = ['text/x-clojure', 'application/x-clojure']
734
+
735
+ special_forms = (
736
+ '.', 'def', 'do', 'fn', 'if', 'let', 'new', 'quote', 'var', 'loop'
737
+ )
738
+
739
+ # It's safe to consider 'ns' a declaration thing because it defines a new
740
+ # namespace.
741
+ declarations = (
742
+ 'def-', 'defn', 'defn-', 'defmacro', 'defmulti', 'defmethod',
743
+ 'defstruct', 'defonce', 'declare', 'definline', 'definterface',
744
+ 'defprotocol', 'defrecord', 'deftype', 'defproject', 'ns'
745
+ )
746
+
747
+ builtins = (
748
+ '*', '+', '-', '->', '/', '<', '<=', '=', '==', '>', '>=', '..',
749
+ 'accessor', 'agent', 'agent-errors', 'aget', 'alength', 'all-ns',
750
+ 'alter', 'and', 'append-child', 'apply', 'array-map', 'aset',
751
+ 'aset-boolean', 'aset-byte', 'aset-char', 'aset-double', 'aset-float',
752
+ 'aset-int', 'aset-long', 'aset-short', 'assert', 'assoc', 'await',
753
+ 'await-for', 'bean', 'binding', 'bit-and', 'bit-not', 'bit-or',
754
+ 'bit-shift-left', 'bit-shift-right', 'bit-xor', 'boolean', 'branch?',
755
+ 'butlast', 'byte', 'cast', 'char', 'children', 'class',
756
+ 'clear-agent-errors', 'comment', 'commute', 'comp', 'comparator',
757
+ 'complement', 'concat', 'conj', 'cons', 'constantly', 'cond', 'if-not',
758
+ 'construct-proxy', 'contains?', 'count', 'create-ns', 'create-struct',
759
+ 'cycle', 'dec', 'deref', 'difference', 'disj', 'dissoc', 'distinct',
760
+ 'doall', 'doc', 'dorun', 'doseq', 'dosync', 'dotimes', 'doto',
761
+ 'double', 'down', 'drop', 'drop-while', 'edit', 'end?', 'ensure',
762
+ 'eval', 'every?', 'false?', 'ffirst', 'file-seq', 'filter', 'find',
763
+ 'find-doc', 'find-ns', 'find-var', 'first', 'float', 'flush', 'for',
764
+ 'fnseq', 'frest', 'gensym', 'get-proxy-class', 'get',
765
+ 'hash-map', 'hash-set', 'identical?', 'identity', 'if-let', 'import',
766
+ 'in-ns', 'inc', 'index', 'insert-child', 'insert-left', 'insert-right',
767
+ 'inspect-table', 'inspect-tree', 'instance?', 'int', 'interleave',
768
+ 'intersection', 'into', 'into-array', 'iterate', 'join', 'key', 'keys',
769
+ 'keyword', 'keyword?', 'last', 'lazy-cat', 'lazy-cons', 'left',
770
+ 'lefts', 'line-seq', 'list*', 'list', 'load', 'load-file',
771
+ 'locking', 'long', 'loop', 'macroexpand', 'macroexpand-1',
772
+ 'make-array', 'make-node', 'map', 'map-invert', 'map?', 'mapcat',
773
+ 'max', 'max-key', 'memfn', 'merge', 'merge-with', 'meta', 'min',
774
+ 'min-key', 'name', 'namespace', 'neg?', 'new', 'newline', 'next',
775
+ 'nil?', 'node', 'not', 'not-any?', 'not-every?', 'not=', 'ns-imports',
776
+ 'ns-interns', 'ns-map', 'ns-name', 'ns-publics', 'ns-refers',
777
+ 'ns-resolve', 'ns-unmap', 'nth', 'nthrest', 'or', 'parse', 'partial',
778
+ 'path', 'peek', 'pop', 'pos?', 'pr', 'pr-str', 'print', 'print-str',
779
+ 'println', 'println-str', 'prn', 'prn-str', 'project', 'proxy',
780
+ 'proxy-mappings', 'quot', 'rand', 'rand-int', 'range', 're-find',
781
+ 're-groups', 're-matcher', 're-matches', 're-pattern', 're-seq',
782
+ 'read', 'read-line', 'reduce', 'ref', 'ref-set', 'refer', 'rem',
783
+ 'remove', 'remove-method', 'remove-ns', 'rename', 'rename-keys',
784
+ 'repeat', 'replace', 'replicate', 'resolve', 'rest', 'resultset-seq',
785
+ 'reverse', 'rfirst', 'right', 'rights', 'root', 'rrest', 'rseq',
786
+ 'second', 'select', 'select-keys', 'send', 'send-off', 'seq',
787
+ 'seq-zip', 'seq?', 'set', 'short', 'slurp', 'some', 'sort',
788
+ 'sort-by', 'sorted-map', 'sorted-map-by', 'sorted-set',
789
+ 'special-symbol?', 'split-at', 'split-with', 'str', 'string?',
790
+ 'struct', 'struct-map', 'subs', 'subvec', 'symbol', 'symbol?',
791
+ 'sync', 'take', 'take-nth', 'take-while', 'test', 'time', 'to-array',
792
+ 'to-array-2d', 'tree-seq', 'true?', 'union', 'up', 'update-proxy',
793
+ 'val', 'vals', 'var-get', 'var-set', 'var?', 'vector', 'vector-zip',
794
+ 'vector?', 'when', 'when-first', 'when-let', 'when-not',
795
+ 'with-local-vars', 'with-meta', 'with-open', 'with-out-str',
796
+ 'xml-seq', 'xml-zip', 'zero?', 'zipmap', 'zipper')
797
+
798
+ # valid names for identifiers
799
+ # well, names can only not consist fully of numbers
800
+ # but this should be good enough for now
801
+
802
+ # TODO / should divide keywords/symbols into namespace/rest
803
+ # but that's hard, so just pretend / is part of the name
804
+ valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
805
+
806
+ tokens = {
807
+ 'root': [
808
+ # the comments - always starting with semicolon
809
+ # and going to the end of the line
810
+ (r';.*$', Comment.Single),
811
+
812
+ # whitespaces - usually not relevant
813
+ (r'[,\s]+', Text),
814
+
815
+ # numbers
816
+ (r'-?\d+\.\d+', Number.Float),
817
+ (r'-?\d+', Number.Integer),
818
+ (r'0x-?[abcdef\d]+', Number.Hex),
819
+
820
+ # strings, symbols and characters
821
+ (r'"(\\\\|\\"|[^"])*"', String),
822
+ (r"'" + valid_name, String.Symbol),
823
+ (r"\\(.|[a-z]+)", String.Char),
824
+
825
+ # keywords
826
+ (r'::?#?' + valid_name, String.Symbol),
827
+
828
+ # special operators
829
+ (r'~@|[`\'#^~&@]', Operator),
830
+
831
+ # highlight the special forms
832
+ (words(special_forms, suffix=' '), Keyword),
833
+
834
+ # Technically, only the special forms are 'keywords'. The problem
835
+ # is that only treating them as keywords means that things like
836
+ # 'defn' and 'ns' need to be highlighted as builtins. This is ugly
837
+ # and weird for most styles. So, as a compromise we're going to
838
+ # highlight them as Keyword.Declarations.
839
+ (words(declarations, suffix=' '), Keyword.Declaration),
840
+
841
+ # highlight the builtins
842
+ (words(builtins, suffix=' '), Name.Builtin),
843
+
844
+ # the remaining functions
845
+ (r'(?<=\()' + valid_name, Name.Function),
846
+
847
+ # find the remaining variables
848
+ (valid_name, Name.Variable),
849
+
850
+ # Clojure accepts vector notation
851
+ (r'(\[|\])', Punctuation),
852
+
853
+ # Clojure accepts map notation
854
+ (r'(\{|\})', Punctuation),
855
+
856
+ # the famous parentheses!
857
+ (r'(\(|\))', Punctuation),
858
+ ],
859
+ }
860
+
861
+
862
+ class ClojureScriptLexer(ClojureLexer):
863
+ """
864
+ Lexer for `ClojureScript <http://clojure.org/clojurescript>`_
865
+ source code.
866
+
867
+ .. versionadded:: 2.0
868
+ """
869
+ name = 'ClojureScript'
870
+ aliases = ['clojurescript', 'cljs']
871
+ filenames = ['*.cljs']
872
+ mimetypes = ['text/x-clojurescript', 'application/x-clojurescript']
873
+
874
+
875
+ class TeaLangLexer(RegexLexer):
876
+ """
877
+ For `Tea <http://teatrove.org/>`_ source code. Only used within a
878
+ TeaTemplateLexer.
879
+
880
+ .. versionadded:: 1.5
881
+ """
882
+
883
+ flags = re.MULTILINE | re.DOTALL
884
+
885
+ tokens = {
886
+ 'root': [
887
+ # method names
888
+ (r'^(\s*(?:[a-zA-Z_][\w\.\[\]]*\s+)+?)' # return arguments
889
+ r'([a-zA-Z_]\w*)' # method name
890
+ r'(\s*)(\()', # signature start
891
+ bygroups(using(this), Name.Function, Text, Operator)),
892
+ (r'[^\S\n]+', Text),
893
+ (r'//.*?\n', Comment.Single),
894
+ (r'/\*.*?\*/', Comment.Multiline),
895
+ (r'@[a-zA-Z_][\w\.]*', Name.Decorator),
896
+ (r'(and|break|else|foreach|if|in|not|or|reverse)\b',
897
+ Keyword),
898
+ (r'(as|call|define)\b', Keyword.Declaration),
899
+ (r'(true|false|null)\b', Keyword.Constant),
900
+ (r'(template)(\s+)', bygroups(Keyword.Declaration, Text), 'template'),
901
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
902
+ (r'"(\\\\|\\"|[^"])*"', String),
903
+ (r'\'(\\\\|\\\'|[^\'])*\'', String),
904
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
905
+ (r'[a-zA-Z_]\w*:', Name.Label),
906
+ (r'[a-zA-Z_\$]\w*', Name),
907
+ (r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
908
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
909
+ (r'0x[0-9a-fA-F]+', Number.Hex),
910
+ (r'[0-9]+L?', Number.Integer),
911
+ (r'\n', Text)
912
+ ],
913
+ 'template': [
914
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
915
+ ],
916
+ 'import': [
917
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
918
+ ],
919
+ }
920
+
921
+
922
+ class CeylonLexer(RegexLexer):
923
+ """
924
+ For `Ceylon <http://ceylon-lang.org/>`_ source code.
925
+
926
+ .. versionadded:: 1.6
927
+ """
928
+
929
+ name = 'Ceylon'
930
+ aliases = ['ceylon']
931
+ filenames = ['*.ceylon']
932
+ mimetypes = ['text/x-ceylon']
933
+
934
+ flags = re.MULTILINE | re.DOTALL
935
+
936
+ #: optional Comment or Whitespace
937
+ _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
938
+
939
+ tokens = {
940
+ 'root': [
941
+ # method names
942
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
943
+ r'([a-zA-Z_]\w*)' # method name
944
+ r'(\s*)(\()', # signature start
945
+ bygroups(using(this), Name.Function, Text, Operator)),
946
+ (r'[^\S\n]+', Text),
947
+ (r'//.*?\n', Comment.Single),
948
+ (r'/\*', Comment.Multiline, 'comment'),
949
+ (r'(shared|abstract|formal|default|actual|variable|deprecated|small|'
950
+ r'late|literal|doc|by|see|throws|optional|license|tagged|final|native|'
951
+ r'annotation|sealed)\b', Name.Decorator),
952
+ (r'(break|case|catch|continue|else|finally|for|in|'
953
+ r'if|return|switch|this|throw|try|while|is|exists|dynamic|'
954
+ r'nonempty|then|outer|assert|let)\b', Keyword),
955
+ (r'(abstracts|extends|satisfies|'
956
+ r'super|given|of|out|assign)\b', Keyword.Declaration),
957
+ (r'(function|value|void|new)\b',
958
+ Keyword.Type),
959
+ (r'(assembly|module|package)(\s+)', bygroups(Keyword.Namespace, Text)),
960
+ (r'(true|false|null)\b', Keyword.Constant),
961
+ (r'(class|interface|object|alias)(\s+)',
962
+ bygroups(Keyword.Declaration, Text), 'class'),
963
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
964
+ (r'"(\\\\|\\"|[^"])*"', String),
965
+ (r"'\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'", String.Char),
966
+ (r'".*``.*``.*"', String.Interpol),
967
+ (r'(\.)([a-z_]\w*)',
968
+ bygroups(Operator, Name.Attribute)),
969
+ (r'[a-zA-Z_]\w*:', Name.Label),
970
+ (r'[a-zA-Z_]\w*', Name),
971
+ (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
972
+ (r'\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
973
+ (r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
974
+ Number.Float),
975
+ (r'[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
976
+ (r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
977
+ Number.Float),
978
+ (r'#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+', Number.Hex),
979
+ (r'#[0-9a-fA-F]+', Number.Hex),
980
+ (r'\$([01]{4})(_[01]{4})+', Number.Bin),
981
+ (r'\$[01]+', Number.Bin),
982
+ (r'\d{1,3}(_\d{3})+[kMGTP]?', Number.Integer),
983
+ (r'[0-9]+[kMGTP]?', Number.Integer),
984
+ (r'\n', Text)
985
+ ],
986
+ 'class': [
987
+ (r'[A-Za-z_]\w*', Name.Class, '#pop')
988
+ ],
989
+ 'import': [
990
+ (r'[a-z][\w.]*',
991
+ Name.Namespace, '#pop')
992
+ ],
993
+ 'comment': [
994
+ (r'[^*/]', Comment.Multiline),
995
+ (r'/\*', Comment.Multiline, '#push'),
996
+ (r'\*/', Comment.Multiline, '#pop'),
997
+ (r'[*/]', Comment.Multiline)
998
+ ],
999
+ }
1000
+
1001
+
1002
+ class KotlinLexer(RegexLexer):
1003
+ """
1004
+ For `Kotlin <http://kotlinlang.org/>`_
1005
+ source code.
1006
+
1007
+ .. versionadded:: 1.5
1008
+ """
1009
+
1010
+ name = 'Kotlin'
1011
+ aliases = ['kotlin']
1012
+ filenames = ['*.kt']
1013
+ mimetypes = ['text/x-kotlin']
1014
+
1015
+ flags = re.MULTILINE | re.DOTALL | re.UNICODE
1016
+
1017
+ kt_name = ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
1018
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', 'Cf',
1019
+ 'Mn', 'Mc') + ']*')
1020
+ kt_id = '(' + kt_name + '|`' + kt_name + '`)'
1021
+
1022
+ tokens = {
1023
+ 'root': [
1024
+ (r'^\s*\[.*?\]', Name.Attribute),
1025
+ (r'[^\S\n]+', Text),
1026
+ (r'\\\n', Text), # line continuation
1027
+ (r'//.*?\n', Comment.Single),
1028
+ (r'/[*].*?[*]/', Comment.Multiline),
1029
+ (r'\n', Text),
1030
+ (r'::|!!|\?[:.]', Operator),
1031
+ (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
1032
+ (r'[{}]', Punctuation),
1033
+ (r'@"(""|[^"])*"', String),
1034
+ (r'"(\\\\|\\"|[^"\n])*["\n]', String),
1035
+ (r"'\\.'|'[^\\]'", String.Char),
1036
+ (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFL]?|"
1037
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
1038
+ (r'(class)(\s+)(object)', bygroups(Keyword, Text, Keyword)),
1039
+ (r'(class|interface|object)(\s+)', bygroups(Keyword, Text), 'class'),
1040
+ (r'(package|import)(\s+)', bygroups(Keyword, Text), 'package'),
1041
+ (r'(val|var)(\s+)', bygroups(Keyword, Text), 'property'),
1042
+ (r'(fun)(\s+)', bygroups(Keyword, Text), 'function'),
1043
+ (r'(abstract|annotation|as|break|by|catch|class|companion|const|'
1044
+ r'constructor|continue|crossinline|data|do|dynamic|else|enum|'
1045
+ r'external|false|final|finally|for|fun|get|if|import|in|infix|'
1046
+ r'inline|inner|interface|internal|is|lateinit|noinline|null|'
1047
+ r'object|open|operator|out|override|package|private|protected|'
1048
+ r'public|reified|return|sealed|set|super|tailrec|this|throw|'
1049
+ r'true|try|val|var|vararg|when|where|while)\b', Keyword),
1050
+ (kt_id, Name),
1051
+ ],
1052
+ 'package': [
1053
+ (r'\S+', Name.Namespace, '#pop')
1054
+ ],
1055
+ 'class': [
1056
+ (kt_id, Name.Class, '#pop')
1057
+ ],
1058
+ 'property': [
1059
+ (kt_id, Name.Property, '#pop')
1060
+ ],
1061
+ 'function': [
1062
+ (kt_id, Name.Function, '#pop')
1063
+ ],
1064
+ }
1065
+
1066
+
1067
+ class XtendLexer(RegexLexer):
1068
+ """
1069
+ For `Xtend <http://xtend-lang.org/>`_ source code.
1070
+
1071
+ .. versionadded:: 1.6
1072
+ """
1073
+
1074
+ name = 'Xtend'
1075
+ aliases = ['xtend']
1076
+ filenames = ['*.xtend']
1077
+ mimetypes = ['text/x-xtend']
1078
+
1079
+ flags = re.MULTILINE | re.DOTALL
1080
+
1081
+ tokens = {
1082
+ 'root': [
1083
+ # method names
1084
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
1085
+ r'([a-zA-Z_$][\w$]*)' # method name
1086
+ r'(\s*)(\()', # signature start
1087
+ bygroups(using(this), Name.Function, Text, Operator)),
1088
+ (r'[^\S\n]+', Text),
1089
+ (r'//.*?\n', Comment.Single),
1090
+ (r'/\*.*?\*/', Comment.Multiline),
1091
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
1092
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
1093
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while|IF|'
1094
+ r'ELSE|ELSEIF|ENDIF|FOR|ENDFOR|SEPARATOR|BEFORE|AFTER)\b',
1095
+ Keyword),
1096
+ (r'(def|abstract|const|enum|extends|final|implements|native|private|'
1097
+ r'protected|public|static|strictfp|super|synchronized|throws|'
1098
+ r'transient|volatile)\b', Keyword.Declaration),
1099
+ (r'(boolean|byte|char|double|float|int|long|short|void)\b',
1100
+ Keyword.Type),
1101
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)),
1102
+ (r'(true|false|null)\b', Keyword.Constant),
1103
+ (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text),
1104
+ 'class'),
1105
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'),
1106
+ (r"(''')", String, 'template'),
1107
+ (u'(\u00BB)', String, 'template'),
1108
+ (r'"(\\\\|\\"|[^"])*"', String),
1109
+ (r"'(\\\\|\\'|[^'])*'", String),
1110
+ (r'[a-zA-Z_]\w*:', Name.Label),
1111
+ (r'[a-zA-Z_$]\w*', Name),
1112
+ (r'[~^*!%&\[\](){}<>\|+=:;,./?-]', Operator),
1113
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
1114
+ (r'0x[0-9a-fA-F]+', Number.Hex),
1115
+ (r'[0-9]+L?', Number.Integer),
1116
+ (r'\n', Text)
1117
+ ],
1118
+ 'class': [
1119
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
1120
+ ],
1121
+ 'import': [
1122
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
1123
+ ],
1124
+ 'template': [
1125
+ (r"'''", String, '#pop'),
1126
+ (u'\u00AB', String, '#pop'),
1127
+ (r'.', String)
1128
+ ],
1129
+ }
1130
+
1131
+
1132
+ class PigLexer(RegexLexer):
1133
+ """
1134
+ For `Pig Latin <https://pig.apache.org/>`_ source code.
1135
+
1136
+ .. versionadded:: 2.0
1137
+ """
1138
+
1139
+ name = 'Pig'
1140
+ aliases = ['pig']
1141
+ filenames = ['*.pig']
1142
+ mimetypes = ['text/x-pig']
1143
+
1144
+ flags = re.MULTILINE | re.IGNORECASE
1145
+
1146
+ tokens = {
1147
+ 'root': [
1148
+ (r'\s+', Text),
1149
+ (r'--.*', Comment),
1150
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
1151
+ (r'\\\n', Text),
1152
+ (r'\\', Text),
1153
+ (r'\'(?:\\[ntbrf\\\']|\\u[0-9a-f]{4}|[^\'\\\n\r])*\'', String),
1154
+ include('keywords'),
1155
+ include('types'),
1156
+ include('builtins'),
1157
+ include('punct'),
1158
+ include('operators'),
1159
+ (r'[0-9]*\.[0-9]+(e[0-9]+)?[fd]?', Number.Float),
1160
+ (r'0x[0-9a-f]+', Number.Hex),
1161
+ (r'[0-9]+L?', Number.Integer),
1162
+ (r'\n', Text),
1163
+ (r'([a-z_]\w*)(\s*)(\()',
1164
+ bygroups(Name.Function, Text, Punctuation)),
1165
+ (r'[()#:]', Text),
1166
+ (r'[^(:#\'")\s]+', Text),
1167
+ (r'\S+\s+', Text) # TODO: make tests pass without \s+
1168
+ ],
1169
+ 'keywords': [
1170
+ (r'(assert|and|any|all|arrange|as|asc|bag|by|cache|CASE|cat|cd|cp|'
1171
+ r'%declare|%default|define|dense|desc|describe|distinct|du|dump|'
1172
+ r'eval|exex|explain|filter|flatten|foreach|full|generate|group|'
1173
+ r'help|if|illustrate|import|inner|input|into|is|join|kill|left|'
1174
+ r'limit|load|ls|map|matches|mkdir|mv|not|null|onschema|or|order|'
1175
+ r'outer|output|parallel|pig|pwd|quit|register|returns|right|rm|'
1176
+ r'rmf|rollup|run|sample|set|ship|split|stderr|stdin|stdout|store|'
1177
+ r'stream|through|union|using|void)\b', Keyword)
1178
+ ],
1179
+ 'builtins': [
1180
+ (r'(AVG|BinStorage|cogroup|CONCAT|copyFromLocal|copyToLocal|COUNT|'
1181
+ r'cross|DIFF|MAX|MIN|PigDump|PigStorage|SIZE|SUM|TextLoader|'
1182
+ r'TOKENIZE)\b', Name.Builtin)
1183
+ ],
1184
+ 'types': [
1185
+ (r'(bytearray|BIGINTEGER|BIGDECIMAL|chararray|datetime|double|float|'
1186
+ r'int|long|tuple)\b', Keyword.Type)
1187
+ ],
1188
+ 'punct': [
1189
+ (r'[;(){}\[\]]', Punctuation),
1190
+ ],
1191
+ 'operators': [
1192
+ (r'[#=,./%+\-?]', Operator),
1193
+ (r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator),
1194
+ (r'(==|<=|<|>=|>|!=)', Operator),
1195
+ ],
1196
+ }
1197
+
1198
+
1199
+ class GoloLexer(RegexLexer):
1200
+ """
1201
+ For `Golo <http://golo-lang.org/>`_ source code.
1202
+
1203
+ .. versionadded:: 2.0
1204
+ """
1205
+
1206
+ name = 'Golo'
1207
+ filenames = ['*.golo']
1208
+ aliases = ['golo']
1209
+
1210
+ tokens = {
1211
+ 'root': [
1212
+ (r'[^\S\n]+', Text),
1213
+
1214
+ (r'#.*$', Comment),
1215
+
1216
+ (r'(\^|\.\.\.|:|\?:|->|==|!=|=|\+|\*|%|/|<=|<|>=|>|=|\.)',
1217
+ Operator),
1218
+ (r'(?<=[^-])(-)(?=[^-])', Operator),
1219
+
1220
+ (r'(?<=[^`])(is|isnt|and|or|not|oftype|in|orIfNull)\b', Operator.Word),
1221
+ (r'[]{}|(),[]', Punctuation),
1222
+
1223
+ (r'(module|import)(\s+)',
1224
+ bygroups(Keyword.Namespace, Text),
1225
+ 'modname'),
1226
+ (r'\b([a-zA-Z_][\w$.]*)(::)', bygroups(Name.Namespace, Punctuation)),
1227
+ (r'\b([a-zA-Z_][\w$]*(?:\.[a-zA-Z_][\w$]*)+)\b', Name.Namespace),
1228
+
1229
+ (r'(let|var)(\s+)',
1230
+ bygroups(Keyword.Declaration, Text),
1231
+ 'varname'),
1232
+ (r'(struct)(\s+)',
1233
+ bygroups(Keyword.Declaration, Text),
1234
+ 'structname'),
1235
+ (r'(function)(\s+)',
1236
+ bygroups(Keyword.Declaration, Text),
1237
+ 'funcname'),
1238
+
1239
+ (r'(null|true|false)\b', Keyword.Constant),
1240
+ (r'(augment|pimp'
1241
+ r'|if|else|case|match|return'
1242
+ r'|case|when|then|otherwise'
1243
+ r'|while|for|foreach'
1244
+ r'|try|catch|finally|throw'
1245
+ r'|local'
1246
+ r'|continue|break)\b', Keyword),
1247
+
1248
+ (r'(map|array|list|set|vector|tuple)(\[)',
1249
+ bygroups(Name.Builtin, Punctuation)),
1250
+ (r'(print|println|readln|raise|fun'
1251
+ r'|asInterfaceInstance)\b', Name.Builtin),
1252
+ (r'(`?[a-zA-Z_][\w$]*)(\()',
1253
+ bygroups(Name.Function, Punctuation)),
1254
+
1255
+ (r'-?[\d_]*\.[\d_]*([eE][+-]?\d[\d_]*)?F?', Number.Float),
1256
+ (r'0[0-7]+j?', Number.Oct),
1257
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
1258
+ (r'-?\d[\d_]*L', Number.Integer.Long),
1259
+ (r'-?\d[\d_]*', Number.Integer),
1260
+
1261
+ ('`?[a-zA-Z_][\w$]*', Name),
1262
+ (r'@[a-zA-Z_][\w$.]*', Name.Decorator),
1263
+
1264
+ (r'"""', String, combined('stringescape', 'triplestring')),
1265
+ (r'"', String, combined('stringescape', 'doublestring')),
1266
+ (r"'", String, combined('stringescape', 'singlestring')),
1267
+ (r'----((.|\n)*?)----', String.Doc)
1268
+
1269
+ ],
1270
+
1271
+ 'funcname': [
1272
+ (r'`?[a-zA-Z_][\w$]*', Name.Function, '#pop'),
1273
+ ],
1274
+ 'modname': [
1275
+ (r'[a-zA-Z_][\w$.]*\*?', Name.Namespace, '#pop')
1276
+ ],
1277
+ 'structname': [
1278
+ (r'`?[\w.]+\*?', Name.Class, '#pop')
1279
+ ],
1280
+ 'varname': [
1281
+ (r'`?[a-zA-Z_][\w$]*', Name.Variable, '#pop'),
1282
+ ],
1283
+ 'string': [
1284
+ (r'[^\\\'"\n]+', String),
1285
+ (r'[\'"\\]', String)
1286
+ ],
1287
+ 'stringescape': [
1288
+ (r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
1289
+ r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
1290
+ ],
1291
+ 'triplestring': [
1292
+ (r'"""', String, '#pop'),
1293
+ include('string'),
1294
+ (r'\n', String),
1295
+ ],
1296
+ 'doublestring': [
1297
+ (r'"', String.Double, '#pop'),
1298
+ include('string'),
1299
+ ],
1300
+ 'singlestring': [
1301
+ (r"'", String, '#pop'),
1302
+ include('string'),
1303
+ ],
1304
+ 'operators': [
1305
+ (r'[#=,./%+\-?]', Operator),
1306
+ (r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator),
1307
+ (r'(==|<=|<|>=|>|!=)', Operator),
1308
+ ],
1309
+ }
1310
+
1311
+
1312
+ class JasminLexer(RegexLexer):
1313
+ """
1314
+ For `Jasmin <http://jasmin.sourceforge.net/>`_ assembly code.
1315
+
1316
+ .. versionadded:: 2.0
1317
+ """
1318
+
1319
+ name = 'Jasmin'
1320
+ aliases = ['jasmin', 'jasminxt']
1321
+ filenames = ['*.j']
1322
+
1323
+ _whitespace = r' \n\t\r'
1324
+ _ws = r'(?:[%s]+)' % _whitespace
1325
+ _separator = r'%s:=' % _whitespace
1326
+ _break = r'(?=[%s]|$)' % _separator
1327
+ _name = r'[^%s]+' % _separator
1328
+ _unqualified_name = r'(?:[^%s.;\[/]+)' % _separator
1329
+
1330
+ tokens = {
1331
+ 'default': [
1332
+ (r'\n', Text, '#pop'),
1333
+ (r"'", String.Single, ('#pop', 'quote')),
1334
+ (r'"', String.Double, 'string'),
1335
+ (r'=', Punctuation),
1336
+ (r':', Punctuation, 'label'),
1337
+ (_ws, Text),
1338
+ (r';.*', Comment.Single),
1339
+ (r'(\$[-+])?0x-?[\da-fA-F]+%s' % _break, Number.Hex),
1340
+ (r'(\$[-+]|\+)?-?\d+%s' % _break, Number.Integer),
1341
+ (r'-?(\d+\.\d*|\.\d+)([eE][-+]?\d+)?[fFdD]?'
1342
+ r'[\x00-\x08\x0b\x0c\x0e-\x1f]*%s' % _break, Number.Float),
1343
+ (r'\$%s' % _name, Name.Variable),
1344
+
1345
+ # Directives
1346
+ (r'\.annotation%s' % _break, Keyword.Reserved, 'annotation'),
1347
+ (r'(\.attribute|\.bytecode|\.debug|\.deprecated|\.enclosing|'
1348
+ r'\.interface|\.line|\.signature|\.source|\.stack|\.var|abstract|'
1349
+ r'annotation|bridge|class|default|enum|field|final|fpstrict|'
1350
+ r'interface|native|private|protected|public|signature|static|'
1351
+ r'synchronized|synthetic|transient|varargs|volatile)%s' % _break,
1352
+ Keyword.Reserved),
1353
+ (r'\.catch%s' % _break, Keyword.Reserved, 'caught-exception'),
1354
+ (r'(\.class|\.implements|\.inner|\.super|inner|invisible|'
1355
+ r'invisibleparam|outer|visible|visibleparam)%s' % _break,
1356
+ Keyword.Reserved, 'class/convert-dots'),
1357
+ (r'\.field%s' % _break, Keyword.Reserved,
1358
+ ('descriptor/convert-dots', 'field')),
1359
+ (r'(\.end|\.limit|use)%s' % _break, Keyword.Reserved,
1360
+ 'no-verification'),
1361
+ (r'\.method%s' % _break, Keyword.Reserved, 'method'),
1362
+ (r'\.set%s' % _break, Keyword.Reserved, 'var'),
1363
+ (r'\.throws%s' % _break, Keyword.Reserved, 'exception'),
1364
+ (r'(from|offset|to|using)%s' % _break, Keyword.Reserved, 'label'),
1365
+ (r'is%s' % _break, Keyword.Reserved,
1366
+ ('descriptor/convert-dots', 'var')),
1367
+ (r'(locals|stack)%s' % _break, Keyword.Reserved, 'verification'),
1368
+ (r'method%s' % _break, Keyword.Reserved, 'enclosing-method'),
1369
+
1370
+ # Instructions
1371
+ (words((
1372
+ 'aaload', 'aastore', 'aconst_null', 'aload', 'aload_0', 'aload_1', 'aload_2',
1373
+ 'aload_3', 'aload_w', 'areturn', 'arraylength', 'astore', 'astore_0', 'astore_1',
1374
+ 'astore_2', 'astore_3', 'astore_w', 'athrow', 'baload', 'bastore', 'bipush',
1375
+ 'breakpoint', 'caload', 'castore', 'd2f', 'd2i', 'd2l', 'dadd', 'daload', 'dastore',
1376
+ 'dcmpg', 'dcmpl', 'dconst_0', 'dconst_1', 'ddiv', 'dload', 'dload_0', 'dload_1',
1377
+ 'dload_2', 'dload_3', 'dload_w', 'dmul', 'dneg', 'drem', 'dreturn', 'dstore', 'dstore_0',
1378
+ 'dstore_1', 'dstore_2', 'dstore_3', 'dstore_w', 'dsub', 'dup', 'dup2', 'dup2_x1',
1379
+ 'dup2_x2', 'dup_x1', 'dup_x2', 'f2d', 'f2i', 'f2l', 'fadd', 'faload', 'fastore', 'fcmpg',
1380
+ 'fcmpl', 'fconst_0', 'fconst_1', 'fconst_2', 'fdiv', 'fload', 'fload_0', 'fload_1',
1381
+ 'fload_2', 'fload_3', 'fload_w', 'fmul', 'fneg', 'frem', 'freturn', 'fstore', 'fstore_0',
1382
+ 'fstore_1', 'fstore_2', 'fstore_3', 'fstore_w', 'fsub', 'i2b', 'i2c', 'i2d', 'i2f', 'i2l',
1383
+ 'i2s', 'iadd', 'iaload', 'iand', 'iastore', 'iconst_0', 'iconst_1', 'iconst_2',
1384
+ 'iconst_3', 'iconst_4', 'iconst_5', 'iconst_m1', 'idiv', 'iinc', 'iinc_w', 'iload',
1385
+ 'iload_0', 'iload_1', 'iload_2', 'iload_3', 'iload_w', 'imul', 'ineg', 'int2byte',
1386
+ 'int2char', 'int2short', 'ior', 'irem', 'ireturn', 'ishl', 'ishr', 'istore', 'istore_0',
1387
+ 'istore_1', 'istore_2', 'istore_3', 'istore_w', 'isub', 'iushr', 'ixor', 'l2d', 'l2f',
1388
+ 'l2i', 'ladd', 'laload', 'land', 'lastore', 'lcmp', 'lconst_0', 'lconst_1', 'ldc2_w',
1389
+ 'ldiv', 'lload', 'lload_0', 'lload_1', 'lload_2', 'lload_3', 'lload_w', 'lmul', 'lneg',
1390
+ 'lookupswitch', 'lor', 'lrem', 'lreturn', 'lshl', 'lshr', 'lstore', 'lstore_0',
1391
+ 'lstore_1', 'lstore_2', 'lstore_3', 'lstore_w', 'lsub', 'lushr', 'lxor',
1392
+ 'monitorenter', 'monitorexit', 'nop', 'pop', 'pop2', 'ret', 'ret_w', 'return', 'saload',
1393
+ 'sastore', 'sipush', 'swap'), suffix=_break), Keyword.Reserved),
1394
+ (r'(anewarray|checkcast|instanceof|ldc|ldc_w|new)%s' % _break,
1395
+ Keyword.Reserved, 'class/no-dots'),
1396
+ (r'invoke(dynamic|interface|nonvirtual|special|'
1397
+ r'static|virtual)%s' % _break, Keyword.Reserved,
1398
+ 'invocation'),
1399
+ (r'(getfield|putfield)%s' % _break, Keyword.Reserved,
1400
+ ('descriptor/no-dots', 'field')),
1401
+ (r'(getstatic|putstatic)%s' % _break, Keyword.Reserved,
1402
+ ('descriptor/no-dots', 'static')),
1403
+ (words((
1404
+ 'goto', 'goto_w', 'if_acmpeq', 'if_acmpne', 'if_icmpeq',
1405
+ 'if_icmpge', 'if_icmpgt', 'if_icmple', 'if_icmplt', 'if_icmpne',
1406
+ 'ifeq', 'ifge', 'ifgt', 'ifle', 'iflt', 'ifne', 'ifnonnull',
1407
+ 'ifnull', 'jsr', 'jsr_w'), suffix=_break),
1408
+ Keyword.Reserved, 'label'),
1409
+ (r'(multianewarray|newarray)%s' % _break, Keyword.Reserved,
1410
+ 'descriptor/convert-dots'),
1411
+ (r'tableswitch%s' % _break, Keyword.Reserved, 'table')
1412
+ ],
1413
+ 'quote': [
1414
+ (r"'", String.Single, '#pop'),
1415
+ (r'\\u[\da-fA-F]{4}', String.Escape),
1416
+ (r"[^'\\]+", String.Single)
1417
+ ],
1418
+ 'string': [
1419
+ (r'"', String.Double, '#pop'),
1420
+ (r'\\([nrtfb"\'\\]|u[\da-fA-F]{4}|[0-3]?[0-7]{1,2})',
1421
+ String.Escape),
1422
+ (r'[^"\\]+', String.Double)
1423
+ ],
1424
+ 'root': [
1425
+ (r'\n+', Text),
1426
+ (r"'", String.Single, 'quote'),
1427
+ include('default'),
1428
+ (r'(%s)([ \t\r]*)(:)' % _name,
1429
+ bygroups(Name.Label, Text, Punctuation)),
1430
+ (_name, String.Other)
1431
+ ],
1432
+ 'annotation': [
1433
+ (r'\n', Text, ('#pop', 'annotation-body')),
1434
+ (r'default%s' % _break, Keyword.Reserved,
1435
+ ('#pop', 'annotation-default')),
1436
+ include('default')
1437
+ ],
1438
+ 'annotation-body': [
1439
+ (r'\n+', Text),
1440
+ (r'\.end%s' % _break, Keyword.Reserved, '#pop'),
1441
+ include('default'),
1442
+ (_name, String.Other, ('annotation-items', 'descriptor/no-dots'))
1443
+ ],
1444
+ 'annotation-default': [
1445
+ (r'\n+', Text),
1446
+ (r'\.end%s' % _break, Keyword.Reserved, '#pop'),
1447
+ include('default'),
1448
+ default(('annotation-items', 'descriptor/no-dots'))
1449
+ ],
1450
+ 'annotation-items': [
1451
+ (r"'", String.Single, 'quote'),
1452
+ include('default'),
1453
+ (_name, String.Other)
1454
+ ],
1455
+ 'caught-exception': [
1456
+ (r'all%s' % _break, Keyword, '#pop'),
1457
+ include('exception')
1458
+ ],
1459
+ 'class/convert-dots': [
1460
+ include('default'),
1461
+ (r'(L)((?:%s[/.])*)(%s)(;)' % (_unqualified_name, _name),
1462
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1463
+ '#pop'),
1464
+ (r'((?:%s[/.])*)(%s)' % (_unqualified_name, _name),
1465
+ bygroups(Name.Namespace, Name.Class), '#pop')
1466
+ ],
1467
+ 'class/no-dots': [
1468
+ include('default'),
1469
+ (r'\[+', Punctuation, ('#pop', 'descriptor/no-dots')),
1470
+ (r'(L)((?:%s/)*)(%s)(;)' % (_unqualified_name, _name),
1471
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1472
+ '#pop'),
1473
+ (r'((?:%s/)*)(%s)' % (_unqualified_name, _name),
1474
+ bygroups(Name.Namespace, Name.Class), '#pop')
1475
+ ],
1476
+ 'descriptor/convert-dots': [
1477
+ include('default'),
1478
+ (r'\[+', Punctuation),
1479
+ (r'(L)((?:%s[/.])*)(%s?)(;)' % (_unqualified_name, _name),
1480
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1481
+ '#pop'),
1482
+ (r'[^%s\[)L]+' % _separator, Keyword.Type, '#pop'),
1483
+ default('#pop')
1484
+ ],
1485
+ 'descriptor/no-dots': [
1486
+ include('default'),
1487
+ (r'\[+', Punctuation),
1488
+ (r'(L)((?:%s/)*)(%s)(;)' % (_unqualified_name, _name),
1489
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1490
+ '#pop'),
1491
+ (r'[^%s\[)L]+' % _separator, Keyword.Type, '#pop'),
1492
+ default('#pop')
1493
+ ],
1494
+ 'descriptors/convert-dots': [
1495
+ (r'\)', Punctuation, '#pop'),
1496
+ default('descriptor/convert-dots')
1497
+ ],
1498
+ 'enclosing-method': [
1499
+ (_ws, Text),
1500
+ (r'(?=[^%s]*\()' % _separator, Text, ('#pop', 'invocation')),
1501
+ default(('#pop', 'class/convert-dots'))
1502
+ ],
1503
+ 'exception': [
1504
+ include('default'),
1505
+ (r'((?:%s[/.])*)(%s)' % (_unqualified_name, _name),
1506
+ bygroups(Name.Namespace, Name.Exception), '#pop')
1507
+ ],
1508
+ 'field': [
1509
+ (r'static%s' % _break, Keyword.Reserved, ('#pop', 'static')),
1510
+ include('default'),
1511
+ (r'((?:%s[/.](?=[^%s]*[/.]))*)(%s[/.])?(%s)' %
1512
+ (_unqualified_name, _separator, _unqualified_name, _name),
1513
+ bygroups(Name.Namespace, Name.Class, Name.Variable.Instance),
1514
+ '#pop')
1515
+ ],
1516
+ 'invocation': [
1517
+ include('default'),
1518
+ (r'((?:%s[/.](?=[^%s(]*[/.]))*)(%s[/.])?(%s)(\()' %
1519
+ (_unqualified_name, _separator, _unqualified_name, _name),
1520
+ bygroups(Name.Namespace, Name.Class, Name.Function, Punctuation),
1521
+ ('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots',
1522
+ 'descriptor/convert-dots'))
1523
+ ],
1524
+ 'label': [
1525
+ include('default'),
1526
+ (_name, Name.Label, '#pop')
1527
+ ],
1528
+ 'method': [
1529
+ include('default'),
1530
+ (r'(%s)(\()' % _name, bygroups(Name.Function, Punctuation),
1531
+ ('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots',
1532
+ 'descriptor/convert-dots'))
1533
+ ],
1534
+ 'no-verification': [
1535
+ (r'(locals|method|stack)%s' % _break, Keyword.Reserved, '#pop'),
1536
+ include('default')
1537
+ ],
1538
+ 'static': [
1539
+ include('default'),
1540
+ (r'((?:%s[/.](?=[^%s]*[/.]))*)(%s[/.])?(%s)' %
1541
+ (_unqualified_name, _separator, _unqualified_name, _name),
1542
+ bygroups(Name.Namespace, Name.Class, Name.Variable.Class), '#pop')
1543
+ ],
1544
+ 'table': [
1545
+ (r'\n+', Text),
1546
+ (r'default%s' % _break, Keyword.Reserved, '#pop'),
1547
+ include('default'),
1548
+ (_name, Name.Label)
1549
+ ],
1550
+ 'var': [
1551
+ include('default'),
1552
+ (_name, Name.Variable, '#pop')
1553
+ ],
1554
+ 'verification': [
1555
+ include('default'),
1556
+ (r'(Double|Float|Integer|Long|Null|Top|UninitializedThis)%s' %
1557
+ _break, Keyword, '#pop'),
1558
+ (r'Object%s' % _break, Keyword, ('#pop', 'class/no-dots')),
1559
+ (r'Uninitialized%s' % _break, Keyword, ('#pop', 'label'))
1560
+ ]
1561
+ }
1562
+
1563
+ def analyse_text(text):
1564
+ score = 0
1565
+ if re.search(r'^\s*\.class\s', text, re.MULTILINE):
1566
+ score += 0.5
1567
+ if re.search(r'^\s*[a-z]+_[a-z]+\b', text, re.MULTILINE):
1568
+ score += 0.3
1569
+ if re.search(r'^\s*\.(attribute|bytecode|debug|deprecated|enclosing|'
1570
+ r'inner|interface|limit|set|signature|stack)\b', text,
1571
+ re.MULTILINE):
1572
+ score += 0.6
1573
+ return score