wandb 0.18.2__py3-none-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (827) hide show
  1. package_readme.md +89 -0
  2. wandb/__init__.py +245 -0
  3. wandb/__init__.pyi +1139 -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 +266 -0
  10. wandb/apis/__init__.py +48 -0
  11. wandb/apis/attrs.py +40 -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 +99 -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 +89 -0
  21. wandb/apis/paginator.py +81 -0
  22. wandb/apis/public/__init__.py +34 -0
  23. wandb/apis/public/api.py +1305 -0
  24. wandb/apis/public/artifacts.py +1090 -0
  25. wandb/apis/public/const.py +4 -0
  26. wandb/apis/public/files.py +195 -0
  27. wandb/apis/public/history.py +149 -0
  28. wandb/apis/public/jobs.py +659 -0
  29. wandb/apis/public/projects.py +154 -0
  30. wandb/apis/public/query_generator.py +166 -0
  31. wandb/apis/public/reports.py +469 -0
  32. wandb/apis/public/runs.py +914 -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/reports/__init__.py +1 -0
  37. wandb/apis/reports/v1/__init__.py +8 -0
  38. wandb/apis/reports/v2/__init__.py +8 -0
  39. wandb/apis/workspaces/__init__.py +8 -0
  40. wandb/beta/workflows.py +288 -0
  41. wandb/bin/nvidia_gpu_stats +0 -0
  42. wandb/bin/wandb-core +0 -0
  43. wandb/cli/__init__.py +0 -0
  44. wandb/cli/cli.py +3004 -0
  45. wandb/data_types.py +63 -0
  46. wandb/docker/__init__.py +342 -0
  47. wandb/docker/auth.py +436 -0
  48. wandb/docker/wandb-entrypoint.sh +33 -0
  49. wandb/docker/www_authenticate.py +94 -0
  50. wandb/env.py +514 -0
  51. wandb/errors/__init__.py +17 -0
  52. wandb/errors/errors.py +37 -0
  53. wandb/errors/term.py +103 -0
  54. wandb/errors/util.py +57 -0
  55. wandb/errors/warnings.py +2 -0
  56. wandb/filesync/__init__.py +0 -0
  57. wandb/filesync/dir_watcher.py +403 -0
  58. wandb/filesync/stats.py +100 -0
  59. wandb/filesync/step_checksum.py +142 -0
  60. wandb/filesync/step_prepare.py +179 -0
  61. wandb/filesync/step_upload.py +290 -0
  62. wandb/filesync/upload_job.py +142 -0
  63. wandb/integration/__init__.py +0 -0
  64. wandb/integration/catboost/__init__.py +5 -0
  65. wandb/integration/catboost/catboost.py +178 -0
  66. wandb/integration/cohere/__init__.py +3 -0
  67. wandb/integration/cohere/cohere.py +21 -0
  68. wandb/integration/cohere/resolver.py +347 -0
  69. wandb/integration/diffusers/__init__.py +3 -0
  70. wandb/integration/diffusers/autologger.py +76 -0
  71. wandb/integration/diffusers/pipeline_resolver.py +50 -0
  72. wandb/integration/diffusers/resolvers/__init__.py +9 -0
  73. wandb/integration/diffusers/resolvers/multimodal.py +882 -0
  74. wandb/integration/diffusers/resolvers/utils.py +102 -0
  75. wandb/integration/fastai/__init__.py +249 -0
  76. wandb/integration/gym/__init__.py +105 -0
  77. wandb/integration/huggingface/__init__.py +3 -0
  78. wandb/integration/huggingface/huggingface.py +18 -0
  79. wandb/integration/huggingface/resolver.py +213 -0
  80. wandb/integration/keras/__init__.py +11 -0
  81. wandb/integration/keras/callbacks/__init__.py +5 -0
  82. wandb/integration/keras/callbacks/metrics_logger.py +136 -0
  83. wandb/integration/keras/callbacks/model_checkpoint.py +195 -0
  84. wandb/integration/keras/callbacks/tables_builder.py +226 -0
  85. wandb/integration/keras/keras.py +1091 -0
  86. wandb/integration/kfp/__init__.py +6 -0
  87. wandb/integration/kfp/helpers.py +28 -0
  88. wandb/integration/kfp/kfp_patch.py +324 -0
  89. wandb/integration/kfp/wandb_logging.py +182 -0
  90. wandb/integration/langchain/__init__.py +3 -0
  91. wandb/integration/langchain/wandb_tracer.py +48 -0
  92. wandb/integration/lightgbm/__init__.py +239 -0
  93. wandb/integration/lightning/__init__.py +0 -0
  94. wandb/integration/lightning/fabric/__init__.py +3 -0
  95. wandb/integration/lightning/fabric/logger.py +762 -0
  96. wandb/integration/magic.py +556 -0
  97. wandb/integration/metaflow/__init__.py +3 -0
  98. wandb/integration/metaflow/metaflow.py +383 -0
  99. wandb/integration/openai/__init__.py +3 -0
  100. wandb/integration/openai/fine_tuning.py +480 -0
  101. wandb/integration/openai/openai.py +22 -0
  102. wandb/integration/openai/resolver.py +240 -0
  103. wandb/integration/prodigy/__init__.py +3 -0
  104. wandb/integration/prodigy/prodigy.py +299 -0
  105. wandb/integration/sacred/__init__.py +117 -0
  106. wandb/integration/sagemaker/__init__.py +12 -0
  107. wandb/integration/sagemaker/auth.py +28 -0
  108. wandb/integration/sagemaker/config.py +49 -0
  109. wandb/integration/sagemaker/files.py +3 -0
  110. wandb/integration/sagemaker/resources.py +34 -0
  111. wandb/integration/sb3/__init__.py +3 -0
  112. wandb/integration/sb3/sb3.py +153 -0
  113. wandb/integration/sklearn/__init__.py +37 -0
  114. wandb/integration/sklearn/calculate/__init__.py +32 -0
  115. wandb/integration/sklearn/calculate/calibration_curves.py +125 -0
  116. wandb/integration/sklearn/calculate/class_proportions.py +68 -0
  117. wandb/integration/sklearn/calculate/confusion_matrix.py +93 -0
  118. wandb/integration/sklearn/calculate/decision_boundaries.py +40 -0
  119. wandb/integration/sklearn/calculate/elbow_curve.py +55 -0
  120. wandb/integration/sklearn/calculate/feature_importances.py +67 -0
  121. wandb/integration/sklearn/calculate/learning_curve.py +64 -0
  122. wandb/integration/sklearn/calculate/outlier_candidates.py +69 -0
  123. wandb/integration/sklearn/calculate/residuals.py +86 -0
  124. wandb/integration/sklearn/calculate/silhouette.py +118 -0
  125. wandb/integration/sklearn/calculate/summary_metrics.py +62 -0
  126. wandb/integration/sklearn/plot/__init__.py +35 -0
  127. wandb/integration/sklearn/plot/classifier.py +329 -0
  128. wandb/integration/sklearn/plot/clusterer.py +146 -0
  129. wandb/integration/sklearn/plot/regressor.py +121 -0
  130. wandb/integration/sklearn/plot/shared.py +91 -0
  131. wandb/integration/sklearn/utils.py +183 -0
  132. wandb/integration/tensorboard/__init__.py +10 -0
  133. wandb/integration/tensorboard/log.py +355 -0
  134. wandb/integration/tensorboard/monkeypatch.py +185 -0
  135. wandb/integration/tensorflow/__init__.py +5 -0
  136. wandb/integration/tensorflow/estimator_hook.py +54 -0
  137. wandb/integration/torch/__init__.py +0 -0
  138. wandb/integration/torch/wandb_torch.py +554 -0
  139. wandb/integration/ultralytics/__init__.py +11 -0
  140. wandb/integration/ultralytics/bbox_utils.py +208 -0
  141. wandb/integration/ultralytics/callback.py +524 -0
  142. wandb/integration/ultralytics/classification_utils.py +83 -0
  143. wandb/integration/ultralytics/mask_utils.py +202 -0
  144. wandb/integration/ultralytics/pose_utils.py +103 -0
  145. wandb/integration/xgboost/__init__.py +11 -0
  146. wandb/integration/xgboost/xgboost.py +189 -0
  147. wandb/integration/yolov8/__init__.py +0 -0
  148. wandb/integration/yolov8/yolov8.py +284 -0
  149. wandb/jupyter.py +515 -0
  150. wandb/magic.py +3 -0
  151. wandb/mpmain/__init__.py +0 -0
  152. wandb/mpmain/__main__.py +1 -0
  153. wandb/old/__init__.py +0 -0
  154. wandb/old/core.py +53 -0
  155. wandb/old/settings.py +173 -0
  156. wandb/old/summary.py +440 -0
  157. wandb/plot/__init__.py +19 -0
  158. wandb/plot/bar.py +45 -0
  159. wandb/plot/confusion_matrix.py +100 -0
  160. wandb/plot/histogram.py +39 -0
  161. wandb/plot/line.py +43 -0
  162. wandb/plot/line_series.py +88 -0
  163. wandb/plot/pr_curve.py +136 -0
  164. wandb/plot/roc_curve.py +118 -0
  165. wandb/plot/scatter.py +32 -0
  166. wandb/plot/utils.py +183 -0
  167. wandb/plot/viz.py +123 -0
  168. wandb/proto/__init__.py +0 -0
  169. wandb/proto/v3/__init__.py +0 -0
  170. wandb/proto/v3/wandb_base_pb2.py +55 -0
  171. wandb/proto/v3/wandb_internal_pb2.py +1608 -0
  172. wandb/proto/v3/wandb_server_pb2.py +208 -0
  173. wandb/proto/v3/wandb_settings_pb2.py +112 -0
  174. wandb/proto/v3/wandb_telemetry_pb2.py +106 -0
  175. wandb/proto/v4/__init__.py +0 -0
  176. wandb/proto/v4/wandb_base_pb2.py +30 -0
  177. wandb/proto/v4/wandb_internal_pb2.py +360 -0
  178. wandb/proto/v4/wandb_server_pb2.py +63 -0
  179. wandb/proto/v4/wandb_settings_pb2.py +45 -0
  180. wandb/proto/v4/wandb_telemetry_pb2.py +41 -0
  181. wandb/proto/v5/wandb_base_pb2.py +31 -0
  182. wandb/proto/v5/wandb_internal_pb2.py +361 -0
  183. wandb/proto/v5/wandb_server_pb2.py +64 -0
  184. wandb/proto/v5/wandb_settings_pb2.py +46 -0
  185. wandb/proto/v5/wandb_telemetry_pb2.py +42 -0
  186. wandb/proto/wandb_base_pb2.py +10 -0
  187. wandb/proto/wandb_deprecated.py +53 -0
  188. wandb/proto/wandb_generate_deprecated.py +34 -0
  189. wandb/proto/wandb_generate_proto.py +49 -0
  190. wandb/proto/wandb_internal_pb2.py +16 -0
  191. wandb/proto/wandb_server_pb2.py +10 -0
  192. wandb/proto/wandb_settings_pb2.py +10 -0
  193. wandb/proto/wandb_telemetry_pb2.py +10 -0
  194. wandb/py.typed +0 -0
  195. wandb/sdk/__init__.py +37 -0
  196. wandb/sdk/artifacts/__init__.py +0 -0
  197. wandb/sdk/artifacts/_validators.py +90 -0
  198. wandb/sdk/artifacts/artifact.py +2389 -0
  199. wandb/sdk/artifacts/artifact_download_logger.py +43 -0
  200. wandb/sdk/artifacts/artifact_file_cache.py +253 -0
  201. wandb/sdk/artifacts/artifact_instance_cache.py +17 -0
  202. wandb/sdk/artifacts/artifact_manifest.py +74 -0
  203. wandb/sdk/artifacts/artifact_manifest_entry.py +249 -0
  204. wandb/sdk/artifacts/artifact_manifests/__init__.py +0 -0
  205. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +92 -0
  206. wandb/sdk/artifacts/artifact_saver.py +269 -0
  207. wandb/sdk/artifacts/artifact_state.py +11 -0
  208. wandb/sdk/artifacts/artifact_ttl.py +7 -0
  209. wandb/sdk/artifacts/exceptions.py +57 -0
  210. wandb/sdk/artifacts/staging.py +25 -0
  211. wandb/sdk/artifacts/storage_handler.py +62 -0
  212. wandb/sdk/artifacts/storage_handlers/__init__.py +0 -0
  213. wandb/sdk/artifacts/storage_handlers/azure_handler.py +208 -0
  214. wandb/sdk/artifacts/storage_handlers/gcs_handler.py +228 -0
  215. wandb/sdk/artifacts/storage_handlers/http_handler.py +114 -0
  216. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +141 -0
  217. wandb/sdk/artifacts/storage_handlers/multi_handler.py +56 -0
  218. wandb/sdk/artifacts/storage_handlers/s3_handler.py +300 -0
  219. wandb/sdk/artifacts/storage_handlers/tracking_handler.py +72 -0
  220. wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +135 -0
  221. wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +74 -0
  222. wandb/sdk/artifacts/storage_layout.py +6 -0
  223. wandb/sdk/artifacts/storage_policies/__init__.py +4 -0
  224. wandb/sdk/artifacts/storage_policies/register.py +1 -0
  225. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +378 -0
  226. wandb/sdk/artifacts/storage_policy.py +72 -0
  227. wandb/sdk/backend/__init__.py +0 -0
  228. wandb/sdk/backend/backend.py +222 -0
  229. wandb/sdk/data_types/__init__.py +0 -0
  230. wandb/sdk/data_types/_dtypes.py +914 -0
  231. wandb/sdk/data_types/_private.py +10 -0
  232. wandb/sdk/data_types/audio.py +165 -0
  233. wandb/sdk/data_types/base_types/__init__.py +0 -0
  234. wandb/sdk/data_types/base_types/json_metadata.py +55 -0
  235. wandb/sdk/data_types/base_types/media.py +315 -0
  236. wandb/sdk/data_types/base_types/wb_value.py +272 -0
  237. wandb/sdk/data_types/bokeh.py +70 -0
  238. wandb/sdk/data_types/graph.py +405 -0
  239. wandb/sdk/data_types/helper_types/__init__.py +0 -0
  240. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +295 -0
  241. wandb/sdk/data_types/helper_types/classes.py +159 -0
  242. wandb/sdk/data_types/helper_types/image_mask.py +235 -0
  243. wandb/sdk/data_types/histogram.py +96 -0
  244. wandb/sdk/data_types/html.py +115 -0
  245. wandb/sdk/data_types/image.py +845 -0
  246. wandb/sdk/data_types/molecule.py +241 -0
  247. wandb/sdk/data_types/object_3d.py +474 -0
  248. wandb/sdk/data_types/plotly.py +82 -0
  249. wandb/sdk/data_types/saved_model.py +446 -0
  250. wandb/sdk/data_types/table.py +1204 -0
  251. wandb/sdk/data_types/trace_tree.py +438 -0
  252. wandb/sdk/data_types/utils.py +229 -0
  253. wandb/sdk/data_types/video.py +247 -0
  254. wandb/sdk/integration_utils/__init__.py +0 -0
  255. wandb/sdk/integration_utils/auto_logging.py +239 -0
  256. wandb/sdk/integration_utils/data_logging.py +475 -0
  257. wandb/sdk/interface/__init__.py +0 -0
  258. wandb/sdk/interface/constants.py +4 -0
  259. wandb/sdk/interface/interface.py +972 -0
  260. wandb/sdk/interface/interface_queue.py +59 -0
  261. wandb/sdk/interface/interface_relay.py +53 -0
  262. wandb/sdk/interface/interface_shared.py +537 -0
  263. wandb/sdk/interface/interface_sock.py +61 -0
  264. wandb/sdk/interface/message_future.py +27 -0
  265. wandb/sdk/interface/message_future_poll.py +50 -0
  266. wandb/sdk/interface/router.py +118 -0
  267. wandb/sdk/interface/router_queue.py +44 -0
  268. wandb/sdk/interface/router_relay.py +39 -0
  269. wandb/sdk/interface/router_sock.py +36 -0
  270. wandb/sdk/interface/summary_record.py +67 -0
  271. wandb/sdk/internal/__init__.py +0 -0
  272. wandb/sdk/internal/context.py +89 -0
  273. wandb/sdk/internal/datastore.py +297 -0
  274. wandb/sdk/internal/file_pusher.py +181 -0
  275. wandb/sdk/internal/file_stream.py +695 -0
  276. wandb/sdk/internal/flow_control.py +263 -0
  277. wandb/sdk/internal/handler.py +901 -0
  278. wandb/sdk/internal/internal.py +417 -0
  279. wandb/sdk/internal/internal_api.py +4358 -0
  280. wandb/sdk/internal/internal_util.py +100 -0
  281. wandb/sdk/internal/job_builder.py +629 -0
  282. wandb/sdk/internal/profiler.py +78 -0
  283. wandb/sdk/internal/progress.py +83 -0
  284. wandb/sdk/internal/run.py +25 -0
  285. wandb/sdk/internal/sample.py +70 -0
  286. wandb/sdk/internal/sender.py +1686 -0
  287. wandb/sdk/internal/sender_config.py +197 -0
  288. wandb/sdk/internal/settings_static.py +90 -0
  289. wandb/sdk/internal/system/__init__.py +0 -0
  290. wandb/sdk/internal/system/assets/__init__.py +27 -0
  291. wandb/sdk/internal/system/assets/aggregators.py +37 -0
  292. wandb/sdk/internal/system/assets/asset_registry.py +20 -0
  293. wandb/sdk/internal/system/assets/cpu.py +163 -0
  294. wandb/sdk/internal/system/assets/disk.py +210 -0
  295. wandb/sdk/internal/system/assets/gpu.py +416 -0
  296. wandb/sdk/internal/system/assets/gpu_amd.py +239 -0
  297. wandb/sdk/internal/system/assets/gpu_apple.py +177 -0
  298. wandb/sdk/internal/system/assets/interfaces.py +207 -0
  299. wandb/sdk/internal/system/assets/ipu.py +177 -0
  300. wandb/sdk/internal/system/assets/memory.py +166 -0
  301. wandb/sdk/internal/system/assets/network.py +125 -0
  302. wandb/sdk/internal/system/assets/open_metrics.py +299 -0
  303. wandb/sdk/internal/system/assets/tpu.py +154 -0
  304. wandb/sdk/internal/system/assets/trainium.py +399 -0
  305. wandb/sdk/internal/system/env_probe_helpers.py +13 -0
  306. wandb/sdk/internal/system/system_info.py +249 -0
  307. wandb/sdk/internal/system/system_monitor.py +229 -0
  308. wandb/sdk/internal/tb_watcher.py +518 -0
  309. wandb/sdk/internal/thread_local_settings.py +18 -0
  310. wandb/sdk/internal/writer.py +206 -0
  311. wandb/sdk/launch/__init__.py +14 -0
  312. wandb/sdk/launch/_launch.py +330 -0
  313. wandb/sdk/launch/_launch_add.py +255 -0
  314. wandb/sdk/launch/_project_spec.py +566 -0
  315. wandb/sdk/launch/agent/__init__.py +5 -0
  316. wandb/sdk/launch/agent/agent.py +924 -0
  317. wandb/sdk/launch/agent/config.py +296 -0
  318. wandb/sdk/launch/agent/job_status_tracker.py +53 -0
  319. wandb/sdk/launch/agent/run_queue_item_file_saver.py +45 -0
  320. wandb/sdk/launch/builder/__init__.py +0 -0
  321. wandb/sdk/launch/builder/abstract.py +156 -0
  322. wandb/sdk/launch/builder/build.py +297 -0
  323. wandb/sdk/launch/builder/context_manager.py +235 -0
  324. wandb/sdk/launch/builder/docker_builder.py +177 -0
  325. wandb/sdk/launch/builder/kaniko_builder.py +595 -0
  326. wandb/sdk/launch/builder/noop.py +58 -0
  327. wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +188 -0
  328. wandb/sdk/launch/builder/templates/dockerfile.py +92 -0
  329. wandb/sdk/launch/create_job.py +528 -0
  330. wandb/sdk/launch/environment/abstract.py +29 -0
  331. wandb/sdk/launch/environment/aws_environment.py +322 -0
  332. wandb/sdk/launch/environment/azure_environment.py +105 -0
  333. wandb/sdk/launch/environment/gcp_environment.py +335 -0
  334. wandb/sdk/launch/environment/local_environment.py +66 -0
  335. wandb/sdk/launch/errors.py +19 -0
  336. wandb/sdk/launch/git_reference.py +109 -0
  337. wandb/sdk/launch/inputs/files.py +148 -0
  338. wandb/sdk/launch/inputs/internal.py +315 -0
  339. wandb/sdk/launch/inputs/manage.py +113 -0
  340. wandb/sdk/launch/inputs/schema.py +39 -0
  341. wandb/sdk/launch/loader.py +249 -0
  342. wandb/sdk/launch/registry/abstract.py +48 -0
  343. wandb/sdk/launch/registry/anon.py +29 -0
  344. wandb/sdk/launch/registry/azure_container_registry.py +124 -0
  345. wandb/sdk/launch/registry/elastic_container_registry.py +192 -0
  346. wandb/sdk/launch/registry/google_artifact_registry.py +219 -0
  347. wandb/sdk/launch/registry/local_registry.py +67 -0
  348. wandb/sdk/launch/runner/__init__.py +0 -0
  349. wandb/sdk/launch/runner/abstract.py +195 -0
  350. wandb/sdk/launch/runner/kubernetes_monitor.py +474 -0
  351. wandb/sdk/launch/runner/kubernetes_runner.py +963 -0
  352. wandb/sdk/launch/runner/local_container.py +301 -0
  353. wandb/sdk/launch/runner/local_process.py +78 -0
  354. wandb/sdk/launch/runner/sagemaker_runner.py +426 -0
  355. wandb/sdk/launch/runner/vertex_runner.py +230 -0
  356. wandb/sdk/launch/sweeps/__init__.py +39 -0
  357. wandb/sdk/launch/sweeps/scheduler.py +742 -0
  358. wandb/sdk/launch/sweeps/scheduler_sweep.py +91 -0
  359. wandb/sdk/launch/sweeps/utils.py +316 -0
  360. wandb/sdk/launch/utils.py +746 -0
  361. wandb/sdk/launch/wandb_reference.py +138 -0
  362. wandb/sdk/lib/__init__.py +5 -0
  363. wandb/sdk/lib/_settings_toposort_generate.py +159 -0
  364. wandb/sdk/lib/_settings_toposort_generated.py +250 -0
  365. wandb/sdk/lib/_wburls_generate.py +25 -0
  366. wandb/sdk/lib/_wburls_generated.py +22 -0
  367. wandb/sdk/lib/apikey.py +273 -0
  368. wandb/sdk/lib/capped_dict.py +26 -0
  369. wandb/sdk/lib/config_util.py +101 -0
  370. wandb/sdk/lib/credentials.py +141 -0
  371. wandb/sdk/lib/deprecate.py +42 -0
  372. wandb/sdk/lib/disabled.py +29 -0
  373. wandb/sdk/lib/exit_hooks.py +54 -0
  374. wandb/sdk/lib/file_stream_utils.py +118 -0
  375. wandb/sdk/lib/filenames.py +64 -0
  376. wandb/sdk/lib/filesystem.py +372 -0
  377. wandb/sdk/lib/fsm.py +174 -0
  378. wandb/sdk/lib/gitlib.py +239 -0
  379. wandb/sdk/lib/gql_request.py +65 -0
  380. wandb/sdk/lib/handler_util.py +21 -0
  381. wandb/sdk/lib/hashutil.py +84 -0
  382. wandb/sdk/lib/import_hooks.py +275 -0
  383. wandb/sdk/lib/ipython.py +146 -0
  384. wandb/sdk/lib/json_util.py +80 -0
  385. wandb/sdk/lib/lazyloader.py +63 -0
  386. wandb/sdk/lib/mailbox.py +460 -0
  387. wandb/sdk/lib/module.py +69 -0
  388. wandb/sdk/lib/paths.py +106 -0
  389. wandb/sdk/lib/preinit.py +42 -0
  390. wandb/sdk/lib/printer.py +313 -0
  391. wandb/sdk/lib/proto_util.py +90 -0
  392. wandb/sdk/lib/redirect.py +845 -0
  393. wandb/sdk/lib/reporting.py +99 -0
  394. wandb/sdk/lib/retry.py +289 -0
  395. wandb/sdk/lib/run_moment.py +78 -0
  396. wandb/sdk/lib/runid.py +12 -0
  397. wandb/sdk/lib/server.py +52 -0
  398. wandb/sdk/lib/service_connection.py +216 -0
  399. wandb/sdk/lib/service_token.py +94 -0
  400. wandb/sdk/lib/sock_client.py +295 -0
  401. wandb/sdk/lib/sparkline.py +45 -0
  402. wandb/sdk/lib/telemetry.py +100 -0
  403. wandb/sdk/lib/timed_input.py +133 -0
  404. wandb/sdk/lib/timer.py +19 -0
  405. wandb/sdk/lib/tracelog.py +255 -0
  406. wandb/sdk/lib/wburls.py +46 -0
  407. wandb/sdk/service/__init__.py +0 -0
  408. wandb/sdk/service/_startup_debug.py +22 -0
  409. wandb/sdk/service/port_file.py +53 -0
  410. wandb/sdk/service/server.py +116 -0
  411. wandb/sdk/service/server_sock.py +276 -0
  412. wandb/sdk/service/service.py +242 -0
  413. wandb/sdk/service/streams.py +417 -0
  414. wandb/sdk/verify/__init__.py +0 -0
  415. wandb/sdk/verify/verify.py +501 -0
  416. wandb/sdk/wandb_alerts.py +12 -0
  417. wandb/sdk/wandb_config.py +322 -0
  418. wandb/sdk/wandb_helper.py +54 -0
  419. wandb/sdk/wandb_init.py +1266 -0
  420. wandb/sdk/wandb_login.py +349 -0
  421. wandb/sdk/wandb_metric.py +110 -0
  422. wandb/sdk/wandb_require.py +97 -0
  423. wandb/sdk/wandb_require_helpers.py +44 -0
  424. wandb/sdk/wandb_run.py +4236 -0
  425. wandb/sdk/wandb_settings.py +2001 -0
  426. wandb/sdk/wandb_setup.py +409 -0
  427. wandb/sdk/wandb_summary.py +150 -0
  428. wandb/sdk/wandb_sweep.py +119 -0
  429. wandb/sdk/wandb_sync.py +81 -0
  430. wandb/sdk/wandb_watch.py +144 -0
  431. wandb/sklearn.py +35 -0
  432. wandb/sync/__init__.py +3 -0
  433. wandb/sync/sync.py +443 -0
  434. wandb/trigger.py +29 -0
  435. wandb/util.py +1956 -0
  436. wandb/vendor/__init__.py +0 -0
  437. wandb/vendor/gql-0.2.0/setup.py +40 -0
  438. wandb/vendor/gql-0.2.0/tests/__init__.py +0 -0
  439. wandb/vendor/gql-0.2.0/tests/starwars/__init__.py +0 -0
  440. wandb/vendor/gql-0.2.0/tests/starwars/fixtures.py +96 -0
  441. wandb/vendor/gql-0.2.0/tests/starwars/schema.py +146 -0
  442. wandb/vendor/gql-0.2.0/tests/starwars/test_dsl.py +293 -0
  443. wandb/vendor/gql-0.2.0/tests/starwars/test_query.py +355 -0
  444. wandb/vendor/gql-0.2.0/tests/starwars/test_validation.py +171 -0
  445. wandb/vendor/gql-0.2.0/tests/test_client.py +31 -0
  446. wandb/vendor/gql-0.2.0/tests/test_transport.py +89 -0
  447. wandb/vendor/gql-0.2.0/wandb_gql/__init__.py +4 -0
  448. wandb/vendor/gql-0.2.0/wandb_gql/client.py +75 -0
  449. wandb/vendor/gql-0.2.0/wandb_gql/dsl.py +152 -0
  450. wandb/vendor/gql-0.2.0/wandb_gql/gql.py +10 -0
  451. wandb/vendor/gql-0.2.0/wandb_gql/transport/__init__.py +0 -0
  452. wandb/vendor/gql-0.2.0/wandb_gql/transport/http.py +6 -0
  453. wandb/vendor/gql-0.2.0/wandb_gql/transport/local_schema.py +15 -0
  454. wandb/vendor/gql-0.2.0/wandb_gql/transport/requests.py +46 -0
  455. wandb/vendor/gql-0.2.0/wandb_gql/utils.py +21 -0
  456. wandb/vendor/graphql-core-1.1/setup.py +86 -0
  457. wandb/vendor/graphql-core-1.1/wandb_graphql/__init__.py +287 -0
  458. wandb/vendor/graphql-core-1.1/wandb_graphql/error/__init__.py +6 -0
  459. wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py +42 -0
  460. wandb/vendor/graphql-core-1.1/wandb_graphql/error/format_error.py +11 -0
  461. wandb/vendor/graphql-core-1.1/wandb_graphql/error/located_error.py +29 -0
  462. wandb/vendor/graphql-core-1.1/wandb_graphql/error/syntax_error.py +36 -0
  463. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__init__.py +26 -0
  464. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py +311 -0
  465. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executor.py +398 -0
  466. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__init__.py +0 -0
  467. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/asyncio.py +53 -0
  468. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/gevent.py +22 -0
  469. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/process.py +32 -0
  470. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/sync.py +7 -0
  471. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/thread.py +35 -0
  472. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/utils.py +6 -0
  473. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__init__.py +0 -0
  474. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/executor.py +66 -0
  475. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/fragment.py +252 -0
  476. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/resolver.py +151 -0
  477. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/utils.py +7 -0
  478. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/middleware.py +57 -0
  479. wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py +145 -0
  480. wandb/vendor/graphql-core-1.1/wandb_graphql/graphql.py +60 -0
  481. wandb/vendor/graphql-core-1.1/wandb_graphql/language/__init__.py +0 -0
  482. wandb/vendor/graphql-core-1.1/wandb_graphql/language/ast.py +1349 -0
  483. wandb/vendor/graphql-core-1.1/wandb_graphql/language/base.py +19 -0
  484. wandb/vendor/graphql-core-1.1/wandb_graphql/language/lexer.py +435 -0
  485. wandb/vendor/graphql-core-1.1/wandb_graphql/language/location.py +30 -0
  486. wandb/vendor/graphql-core-1.1/wandb_graphql/language/parser.py +779 -0
  487. wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py +193 -0
  488. wandb/vendor/graphql-core-1.1/wandb_graphql/language/source.py +18 -0
  489. wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor.py +222 -0
  490. wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor_meta.py +82 -0
  491. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__init__.py +0 -0
  492. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/cached_property.py +17 -0
  493. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/contain_subset.py +28 -0
  494. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/default_ordered_dict.py +40 -0
  495. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/ordereddict.py +8 -0
  496. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/pair_set.py +43 -0
  497. wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/version.py +78 -0
  498. wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py +67 -0
  499. wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py +619 -0
  500. wandb/vendor/graphql-core-1.1/wandb_graphql/type/directives.py +132 -0
  501. wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py +440 -0
  502. wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py +131 -0
  503. wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py +100 -0
  504. wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py +145 -0
  505. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__init__.py +0 -0
  506. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/assert_valid_name.py +9 -0
  507. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_from_value.py +65 -0
  508. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_code.py +49 -0
  509. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_dict.py +24 -0
  510. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/base.py +75 -0
  511. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_ast_schema.py +291 -0
  512. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_client_schema.py +250 -0
  513. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/concat_ast.py +9 -0
  514. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/extend_schema.py +357 -0
  515. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_field_def.py +27 -0
  516. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_operation_ast.py +21 -0
  517. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/introspection_query.py +90 -0
  518. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_literal_value.py +67 -0
  519. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_value.py +66 -0
  520. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/quoted_or_list.py +21 -0
  521. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/schema_printer.py +168 -0
  522. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/suggestion_list.py +56 -0
  523. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_comparators.py +69 -0
  524. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_from_ast.py +21 -0
  525. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_info.py +149 -0
  526. wandb/vendor/graphql-core-1.1/wandb_graphql/utils/value_from_ast.py +69 -0
  527. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/__init__.py +4 -0
  528. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__init__.py +79 -0
  529. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/arguments_of_correct_type.py +24 -0
  530. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/base.py +8 -0
  531. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/default_values_of_correct_type.py +44 -0
  532. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fields_on_correct_type.py +113 -0
  533. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fragments_on_composite_types.py +33 -0
  534. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_argument_names.py +70 -0
  535. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_directives.py +97 -0
  536. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_fragment_names.py +19 -0
  537. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_type_names.py +43 -0
  538. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/lone_anonymous_operation.py +23 -0
  539. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_fragment_cycles.py +59 -0
  540. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_undefined_variables.py +36 -0
  541. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_fragments.py +38 -0
  542. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_variables.py +37 -0
  543. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/overlapping_fields_can_be_merged.py +529 -0
  544. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/possible_fragment_spreads.py +44 -0
  545. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/provided_non_null_arguments.py +46 -0
  546. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/scalar_leafs.py +33 -0
  547. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_argument_names.py +32 -0
  548. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_fragment_names.py +28 -0
  549. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_input_field_names.py +33 -0
  550. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_operation_names.py +31 -0
  551. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_variable_names.py +27 -0
  552. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_are_input_types.py +21 -0
  553. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_in_allowed_position.py +53 -0
  554. wandb/vendor/graphql-core-1.1/wandb_graphql/validation/validation.py +158 -0
  555. wandb/vendor/promise-2.3.0/conftest.py +30 -0
  556. wandb/vendor/promise-2.3.0/setup.py +64 -0
  557. wandb/vendor/promise-2.3.0/tests/__init__.py +0 -0
  558. wandb/vendor/promise-2.3.0/tests/conftest.py +8 -0
  559. wandb/vendor/promise-2.3.0/tests/test_awaitable.py +32 -0
  560. wandb/vendor/promise-2.3.0/tests/test_awaitable_35.py +47 -0
  561. wandb/vendor/promise-2.3.0/tests/test_benchmark.py +116 -0
  562. wandb/vendor/promise-2.3.0/tests/test_complex_threads.py +23 -0
  563. wandb/vendor/promise-2.3.0/tests/test_dataloader.py +452 -0
  564. wandb/vendor/promise-2.3.0/tests/test_dataloader_awaitable_35.py +99 -0
  565. wandb/vendor/promise-2.3.0/tests/test_dataloader_extra.py +65 -0
  566. wandb/vendor/promise-2.3.0/tests/test_extra.py +670 -0
  567. wandb/vendor/promise-2.3.0/tests/test_issues.py +132 -0
  568. wandb/vendor/promise-2.3.0/tests/test_promise_list.py +70 -0
  569. wandb/vendor/promise-2.3.0/tests/test_spec.py +584 -0
  570. wandb/vendor/promise-2.3.0/tests/test_thread_safety.py +115 -0
  571. wandb/vendor/promise-2.3.0/tests/utils.py +3 -0
  572. wandb/vendor/promise-2.3.0/wandb_promise/__init__.py +38 -0
  573. wandb/vendor/promise-2.3.0/wandb_promise/async_.py +135 -0
  574. wandb/vendor/promise-2.3.0/wandb_promise/compat.py +32 -0
  575. wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py +326 -0
  576. wandb/vendor/promise-2.3.0/wandb_promise/iterate_promise.py +12 -0
  577. wandb/vendor/promise-2.3.0/wandb_promise/promise.py +848 -0
  578. wandb/vendor/promise-2.3.0/wandb_promise/promise_list.py +151 -0
  579. wandb/vendor/promise-2.3.0/wandb_promise/pyutils/__init__.py +0 -0
  580. wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py +83 -0
  581. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__init__.py +0 -0
  582. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py +22 -0
  583. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/gevent.py +21 -0
  584. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/immediate.py +27 -0
  585. wandb/vendor/promise-2.3.0/wandb_promise/schedulers/thread.py +18 -0
  586. wandb/vendor/promise-2.3.0/wandb_promise/utils.py +56 -0
  587. wandb/vendor/pygments/__init__.py +90 -0
  588. wandb/vendor/pygments/cmdline.py +568 -0
  589. wandb/vendor/pygments/console.py +74 -0
  590. wandb/vendor/pygments/filter.py +74 -0
  591. wandb/vendor/pygments/filters/__init__.py +350 -0
  592. wandb/vendor/pygments/formatter.py +95 -0
  593. wandb/vendor/pygments/formatters/__init__.py +153 -0
  594. wandb/vendor/pygments/formatters/_mapping.py +85 -0
  595. wandb/vendor/pygments/formatters/bbcode.py +109 -0
  596. wandb/vendor/pygments/formatters/html.py +851 -0
  597. wandb/vendor/pygments/formatters/img.py +600 -0
  598. wandb/vendor/pygments/formatters/irc.py +182 -0
  599. wandb/vendor/pygments/formatters/latex.py +482 -0
  600. wandb/vendor/pygments/formatters/other.py +160 -0
  601. wandb/vendor/pygments/formatters/rtf.py +147 -0
  602. wandb/vendor/pygments/formatters/svg.py +153 -0
  603. wandb/vendor/pygments/formatters/terminal.py +136 -0
  604. wandb/vendor/pygments/formatters/terminal256.py +309 -0
  605. wandb/vendor/pygments/lexer.py +871 -0
  606. wandb/vendor/pygments/lexers/__init__.py +329 -0
  607. wandb/vendor/pygments/lexers/_asy_builtins.py +1645 -0
  608. wandb/vendor/pygments/lexers/_cl_builtins.py +232 -0
  609. wandb/vendor/pygments/lexers/_cocoa_builtins.py +72 -0
  610. wandb/vendor/pygments/lexers/_csound_builtins.py +1346 -0
  611. wandb/vendor/pygments/lexers/_lasso_builtins.py +5327 -0
  612. wandb/vendor/pygments/lexers/_lua_builtins.py +295 -0
  613. wandb/vendor/pygments/lexers/_mapping.py +500 -0
  614. wandb/vendor/pygments/lexers/_mql_builtins.py +1172 -0
  615. wandb/vendor/pygments/lexers/_openedge_builtins.py +2547 -0
  616. wandb/vendor/pygments/lexers/_php_builtins.py +4756 -0
  617. wandb/vendor/pygments/lexers/_postgres_builtins.py +621 -0
  618. wandb/vendor/pygments/lexers/_scilab_builtins.py +3094 -0
  619. wandb/vendor/pygments/lexers/_sourcemod_builtins.py +1163 -0
  620. wandb/vendor/pygments/lexers/_stan_builtins.py +532 -0
  621. wandb/vendor/pygments/lexers/_stata_builtins.py +419 -0
  622. wandb/vendor/pygments/lexers/_tsql_builtins.py +1004 -0
  623. wandb/vendor/pygments/lexers/_vim_builtins.py +1939 -0
  624. wandb/vendor/pygments/lexers/actionscript.py +240 -0
  625. wandb/vendor/pygments/lexers/agile.py +24 -0
  626. wandb/vendor/pygments/lexers/algebra.py +221 -0
  627. wandb/vendor/pygments/lexers/ambient.py +76 -0
  628. wandb/vendor/pygments/lexers/ampl.py +87 -0
  629. wandb/vendor/pygments/lexers/apl.py +101 -0
  630. wandb/vendor/pygments/lexers/archetype.py +318 -0
  631. wandb/vendor/pygments/lexers/asm.py +641 -0
  632. wandb/vendor/pygments/lexers/automation.py +374 -0
  633. wandb/vendor/pygments/lexers/basic.py +500 -0
  634. wandb/vendor/pygments/lexers/bibtex.py +160 -0
  635. wandb/vendor/pygments/lexers/business.py +612 -0
  636. wandb/vendor/pygments/lexers/c_cpp.py +252 -0
  637. wandb/vendor/pygments/lexers/c_like.py +541 -0
  638. wandb/vendor/pygments/lexers/capnproto.py +78 -0
  639. wandb/vendor/pygments/lexers/chapel.py +102 -0
  640. wandb/vendor/pygments/lexers/clean.py +288 -0
  641. wandb/vendor/pygments/lexers/compiled.py +34 -0
  642. wandb/vendor/pygments/lexers/configs.py +833 -0
  643. wandb/vendor/pygments/lexers/console.py +114 -0
  644. wandb/vendor/pygments/lexers/crystal.py +393 -0
  645. wandb/vendor/pygments/lexers/csound.py +366 -0
  646. wandb/vendor/pygments/lexers/css.py +689 -0
  647. wandb/vendor/pygments/lexers/d.py +251 -0
  648. wandb/vendor/pygments/lexers/dalvik.py +125 -0
  649. wandb/vendor/pygments/lexers/data.py +555 -0
  650. wandb/vendor/pygments/lexers/diff.py +165 -0
  651. wandb/vendor/pygments/lexers/dotnet.py +691 -0
  652. wandb/vendor/pygments/lexers/dsls.py +878 -0
  653. wandb/vendor/pygments/lexers/dylan.py +289 -0
  654. wandb/vendor/pygments/lexers/ecl.py +125 -0
  655. wandb/vendor/pygments/lexers/eiffel.py +65 -0
  656. wandb/vendor/pygments/lexers/elm.py +121 -0
  657. wandb/vendor/pygments/lexers/erlang.py +533 -0
  658. wandb/vendor/pygments/lexers/esoteric.py +277 -0
  659. wandb/vendor/pygments/lexers/ezhil.py +69 -0
  660. wandb/vendor/pygments/lexers/factor.py +344 -0
  661. wandb/vendor/pygments/lexers/fantom.py +250 -0
  662. wandb/vendor/pygments/lexers/felix.py +273 -0
  663. wandb/vendor/pygments/lexers/forth.py +177 -0
  664. wandb/vendor/pygments/lexers/fortran.py +205 -0
  665. wandb/vendor/pygments/lexers/foxpro.py +428 -0
  666. wandb/vendor/pygments/lexers/functional.py +21 -0
  667. wandb/vendor/pygments/lexers/go.py +101 -0
  668. wandb/vendor/pygments/lexers/grammar_notation.py +213 -0
  669. wandb/vendor/pygments/lexers/graph.py +80 -0
  670. wandb/vendor/pygments/lexers/graphics.py +553 -0
  671. wandb/vendor/pygments/lexers/haskell.py +843 -0
  672. wandb/vendor/pygments/lexers/haxe.py +936 -0
  673. wandb/vendor/pygments/lexers/hdl.py +382 -0
  674. wandb/vendor/pygments/lexers/hexdump.py +103 -0
  675. wandb/vendor/pygments/lexers/html.py +602 -0
  676. wandb/vendor/pygments/lexers/idl.py +270 -0
  677. wandb/vendor/pygments/lexers/igor.py +288 -0
  678. wandb/vendor/pygments/lexers/inferno.py +96 -0
  679. wandb/vendor/pygments/lexers/installers.py +322 -0
  680. wandb/vendor/pygments/lexers/int_fiction.py +1343 -0
  681. wandb/vendor/pygments/lexers/iolang.py +63 -0
  682. wandb/vendor/pygments/lexers/j.py +146 -0
  683. wandb/vendor/pygments/lexers/javascript.py +1525 -0
  684. wandb/vendor/pygments/lexers/julia.py +333 -0
  685. wandb/vendor/pygments/lexers/jvm.py +1573 -0
  686. wandb/vendor/pygments/lexers/lisp.py +2621 -0
  687. wandb/vendor/pygments/lexers/make.py +202 -0
  688. wandb/vendor/pygments/lexers/markup.py +595 -0
  689. wandb/vendor/pygments/lexers/math.py +21 -0
  690. wandb/vendor/pygments/lexers/matlab.py +663 -0
  691. wandb/vendor/pygments/lexers/ml.py +769 -0
  692. wandb/vendor/pygments/lexers/modeling.py +358 -0
  693. wandb/vendor/pygments/lexers/modula2.py +1561 -0
  694. wandb/vendor/pygments/lexers/monte.py +204 -0
  695. wandb/vendor/pygments/lexers/ncl.py +894 -0
  696. wandb/vendor/pygments/lexers/nimrod.py +159 -0
  697. wandb/vendor/pygments/lexers/nit.py +64 -0
  698. wandb/vendor/pygments/lexers/nix.py +136 -0
  699. wandb/vendor/pygments/lexers/oberon.py +105 -0
  700. wandb/vendor/pygments/lexers/objective.py +504 -0
  701. wandb/vendor/pygments/lexers/ooc.py +85 -0
  702. wandb/vendor/pygments/lexers/other.py +41 -0
  703. wandb/vendor/pygments/lexers/parasail.py +79 -0
  704. wandb/vendor/pygments/lexers/parsers.py +835 -0
  705. wandb/vendor/pygments/lexers/pascal.py +644 -0
  706. wandb/vendor/pygments/lexers/pawn.py +199 -0
  707. wandb/vendor/pygments/lexers/perl.py +620 -0
  708. wandb/vendor/pygments/lexers/php.py +267 -0
  709. wandb/vendor/pygments/lexers/praat.py +294 -0
  710. wandb/vendor/pygments/lexers/prolog.py +306 -0
  711. wandb/vendor/pygments/lexers/python.py +939 -0
  712. wandb/vendor/pygments/lexers/qvt.py +152 -0
  713. wandb/vendor/pygments/lexers/r.py +453 -0
  714. wandb/vendor/pygments/lexers/rdf.py +270 -0
  715. wandb/vendor/pygments/lexers/rebol.py +431 -0
  716. wandb/vendor/pygments/lexers/resource.py +85 -0
  717. wandb/vendor/pygments/lexers/rnc.py +67 -0
  718. wandb/vendor/pygments/lexers/roboconf.py +82 -0
  719. wandb/vendor/pygments/lexers/robotframework.py +560 -0
  720. wandb/vendor/pygments/lexers/ruby.py +519 -0
  721. wandb/vendor/pygments/lexers/rust.py +220 -0
  722. wandb/vendor/pygments/lexers/sas.py +228 -0
  723. wandb/vendor/pygments/lexers/scripting.py +1222 -0
  724. wandb/vendor/pygments/lexers/shell.py +794 -0
  725. wandb/vendor/pygments/lexers/smalltalk.py +195 -0
  726. wandb/vendor/pygments/lexers/smv.py +79 -0
  727. wandb/vendor/pygments/lexers/snobol.py +83 -0
  728. wandb/vendor/pygments/lexers/special.py +103 -0
  729. wandb/vendor/pygments/lexers/sql.py +681 -0
  730. wandb/vendor/pygments/lexers/stata.py +108 -0
  731. wandb/vendor/pygments/lexers/supercollider.py +90 -0
  732. wandb/vendor/pygments/lexers/tcl.py +145 -0
  733. wandb/vendor/pygments/lexers/templates.py +2283 -0
  734. wandb/vendor/pygments/lexers/testing.py +207 -0
  735. wandb/vendor/pygments/lexers/text.py +25 -0
  736. wandb/vendor/pygments/lexers/textedit.py +169 -0
  737. wandb/vendor/pygments/lexers/textfmts.py +297 -0
  738. wandb/vendor/pygments/lexers/theorem.py +458 -0
  739. wandb/vendor/pygments/lexers/trafficscript.py +54 -0
  740. wandb/vendor/pygments/lexers/typoscript.py +226 -0
  741. wandb/vendor/pygments/lexers/urbi.py +133 -0
  742. wandb/vendor/pygments/lexers/varnish.py +190 -0
  743. wandb/vendor/pygments/lexers/verification.py +111 -0
  744. wandb/vendor/pygments/lexers/web.py +24 -0
  745. wandb/vendor/pygments/lexers/webmisc.py +988 -0
  746. wandb/vendor/pygments/lexers/whiley.py +116 -0
  747. wandb/vendor/pygments/lexers/x10.py +69 -0
  748. wandb/vendor/pygments/modeline.py +44 -0
  749. wandb/vendor/pygments/plugin.py +68 -0
  750. wandb/vendor/pygments/regexopt.py +92 -0
  751. wandb/vendor/pygments/scanner.py +105 -0
  752. wandb/vendor/pygments/sphinxext.py +158 -0
  753. wandb/vendor/pygments/style.py +155 -0
  754. wandb/vendor/pygments/styles/__init__.py +80 -0
  755. wandb/vendor/pygments/styles/abap.py +29 -0
  756. wandb/vendor/pygments/styles/algol.py +63 -0
  757. wandb/vendor/pygments/styles/algol_nu.py +63 -0
  758. wandb/vendor/pygments/styles/arduino.py +98 -0
  759. wandb/vendor/pygments/styles/autumn.py +65 -0
  760. wandb/vendor/pygments/styles/borland.py +51 -0
  761. wandb/vendor/pygments/styles/bw.py +49 -0
  762. wandb/vendor/pygments/styles/colorful.py +81 -0
  763. wandb/vendor/pygments/styles/default.py +73 -0
  764. wandb/vendor/pygments/styles/emacs.py +72 -0
  765. wandb/vendor/pygments/styles/friendly.py +72 -0
  766. wandb/vendor/pygments/styles/fruity.py +42 -0
  767. wandb/vendor/pygments/styles/igor.py +29 -0
  768. wandb/vendor/pygments/styles/lovelace.py +97 -0
  769. wandb/vendor/pygments/styles/manni.py +75 -0
  770. wandb/vendor/pygments/styles/monokai.py +106 -0
  771. wandb/vendor/pygments/styles/murphy.py +80 -0
  772. wandb/vendor/pygments/styles/native.py +65 -0
  773. wandb/vendor/pygments/styles/paraiso_dark.py +125 -0
  774. wandb/vendor/pygments/styles/paraiso_light.py +125 -0
  775. wandb/vendor/pygments/styles/pastie.py +75 -0
  776. wandb/vendor/pygments/styles/perldoc.py +69 -0
  777. wandb/vendor/pygments/styles/rainbow_dash.py +89 -0
  778. wandb/vendor/pygments/styles/rrt.py +33 -0
  779. wandb/vendor/pygments/styles/sas.py +44 -0
  780. wandb/vendor/pygments/styles/stata.py +40 -0
  781. wandb/vendor/pygments/styles/tango.py +141 -0
  782. wandb/vendor/pygments/styles/trac.py +63 -0
  783. wandb/vendor/pygments/styles/vim.py +63 -0
  784. wandb/vendor/pygments/styles/vs.py +38 -0
  785. wandb/vendor/pygments/styles/xcode.py +51 -0
  786. wandb/vendor/pygments/token.py +213 -0
  787. wandb/vendor/pygments/unistring.py +217 -0
  788. wandb/vendor/pygments/util.py +388 -0
  789. wandb/vendor/pynvml/__init__.py +0 -0
  790. wandb/vendor/pynvml/pynvml.py +4779 -0
  791. wandb/vendor/watchdog_0_9_0/wandb_watchdog/__init__.py +17 -0
  792. wandb/vendor/watchdog_0_9_0/wandb_watchdog/events.py +615 -0
  793. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__init__.py +98 -0
  794. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py +369 -0
  795. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py +172 -0
  796. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents2.py +239 -0
  797. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py +218 -0
  798. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py +81 -0
  799. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_c.py +575 -0
  800. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/kqueue.py +730 -0
  801. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/polling.py +145 -0
  802. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py +133 -0
  803. wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py +348 -0
  804. wandb/vendor/watchdog_0_9_0/wandb_watchdog/patterns.py +265 -0
  805. wandb/vendor/watchdog_0_9_0/wandb_watchdog/tricks/__init__.py +174 -0
  806. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__init__.py +151 -0
  807. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/bricks.py +249 -0
  808. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/compat.py +29 -0
  809. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py +198 -0
  810. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/delayed_queue.py +88 -0
  811. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/dirsnapshot.py +293 -0
  812. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/echo.py +157 -0
  813. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py +41 -0
  814. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/importlib2.py +40 -0
  815. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/platform.py +57 -0
  816. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/unicode_paths.py +64 -0
  817. wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/win32stat.py +123 -0
  818. wandb/vendor/watchdog_0_9_0/wandb_watchdog/version.py +28 -0
  819. wandb/vendor/watchdog_0_9_0/wandb_watchdog/watchmedo.py +577 -0
  820. wandb/wandb_agent.py +588 -0
  821. wandb/wandb_controller.py +721 -0
  822. wandb/wandb_run.py +9 -0
  823. wandb-0.18.2.dist-info/METADATA +213 -0
  824. wandb-0.18.2.dist-info/RECORD +827 -0
  825. wandb-0.18.2.dist-info/WHEEL +5 -0
  826. wandb-0.18.2.dist-info/entry_points.txt +3 -0
  827. wandb-0.18.2.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1561 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pygments.lexers.modula2
4
+ ~~~~~~~~~~~~~~~~~~~~~~~
5
+
6
+ Multi-Dialect Lexer for Modula-2.
7
+
8
+ :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ import re
13
+
14
+ from pygments.lexer import RegexLexer, include
15
+ from pygments.util import get_bool_opt, get_list_opt
16
+ from pygments.token import Text, Comment, Operator, Keyword, Name, \
17
+ String, Number, Punctuation, Error
18
+
19
+ __all__ = ['Modula2Lexer']
20
+
21
+
22
+ # Multi-Dialect Modula-2 Lexer
23
+ class Modula2Lexer(RegexLexer):
24
+ """
25
+ For `Modula-2 <http://www.modula2.org/>`_ source code.
26
+
27
+ The Modula-2 lexer supports several dialects. By default, it operates in
28
+ fallback mode, recognising the *combined* literals, punctuation symbols
29
+ and operators of all supported dialects, and the *combined* reserved words
30
+ and builtins of PIM Modula-2, ISO Modula-2 and Modula-2 R10, while not
31
+ differentiating between library defined identifiers.
32
+
33
+ To select a specific dialect, a dialect option may be passed
34
+ or a dialect tag may be embedded into a source file.
35
+
36
+ Dialect Options:
37
+
38
+ `m2pim`
39
+ Select PIM Modula-2 dialect.
40
+ `m2iso`
41
+ Select ISO Modula-2 dialect.
42
+ `m2r10`
43
+ Select Modula-2 R10 dialect.
44
+ `objm2`
45
+ Select Objective Modula-2 dialect.
46
+
47
+ The PIM and ISO dialect options may be qualified with a language extension.
48
+
49
+ Language Extensions:
50
+
51
+ `+aglet`
52
+ Select Aglet Modula-2 extensions, available with m2iso.
53
+ `+gm2`
54
+ Select GNU Modula-2 extensions, available with m2pim.
55
+ `+p1`
56
+ Select p1 Modula-2 extensions, available with m2iso.
57
+ `+xds`
58
+ Select XDS Modula-2 extensions, available with m2iso.
59
+
60
+
61
+ Passing a Dialect Option via Unix Commandline Interface
62
+
63
+ Dialect options may be passed to the lexer using the `dialect` key.
64
+ Only one such option should be passed. If multiple dialect options are
65
+ passed, the first valid option is used, any subsequent options are ignored.
66
+
67
+ Examples:
68
+
69
+ `$ pygmentize -O full,dialect=m2iso -f html -o /path/to/output /path/to/input`
70
+ Use ISO dialect to render input to HTML output
71
+ `$ pygmentize -O full,dialect=m2iso+p1 -f rtf -o /path/to/output /path/to/input`
72
+ Use ISO dialect with p1 extensions to render input to RTF output
73
+
74
+
75
+ Embedding a Dialect Option within a source file
76
+
77
+ A dialect option may be embedded in a source file in form of a dialect
78
+ tag, a specially formatted comment that specifies a dialect option.
79
+
80
+ Dialect Tag EBNF::
81
+
82
+ dialectTag :
83
+ OpeningCommentDelim Prefix dialectOption ClosingCommentDelim ;
84
+
85
+ dialectOption :
86
+ 'm2pim' | 'm2iso' | 'm2r10' | 'objm2' |
87
+ 'm2iso+aglet' | 'm2pim+gm2' | 'm2iso+p1' | 'm2iso+xds' ;
88
+
89
+ Prefix : '!' ;
90
+
91
+ OpeningCommentDelim : '(*' ;
92
+
93
+ ClosingCommentDelim : '*)' ;
94
+
95
+ No whitespace is permitted between the tokens of a dialect tag.
96
+
97
+ In the event that a source file contains multiple dialect tags, the first
98
+ tag that contains a valid dialect option will be used and any subsequent
99
+ dialect tags will be ignored. Ideally, a dialect tag should be placed
100
+ at the beginning of a source file.
101
+
102
+ An embedded dialect tag overrides a dialect option set via command line.
103
+
104
+ Examples:
105
+
106
+ ``(*!m2r10*) DEFINITION MODULE Foobar; ...``
107
+ Use Modula2 R10 dialect to render this source file.
108
+ ``(*!m2pim+gm2*) DEFINITION MODULE Bazbam; ...``
109
+ Use PIM dialect with GNU extensions to render this source file.
110
+
111
+
112
+ Algol Publication Mode:
113
+
114
+ In Algol publication mode, source text is rendered for publication of
115
+ algorithms in scientific papers and academic texts, following the format
116
+ of the Revised Algol-60 Language Report. It is activated by passing
117
+ one of two corresponding styles as an option:
118
+
119
+ `algol`
120
+ render reserved words lowercase underline boldface
121
+ and builtins lowercase boldface italic
122
+ `algol_nu`
123
+ render reserved words lowercase boldface (no underlining)
124
+ and builtins lowercase boldface italic
125
+
126
+ The lexer automatically performs the required lowercase conversion when
127
+ this mode is activated.
128
+
129
+ Example:
130
+
131
+ ``$ pygmentize -O full,style=algol -f latex -o /path/to/output /path/to/input``
132
+ Render input file in Algol publication mode to LaTeX output.
133
+
134
+
135
+ Rendering Mode of First Class ADT Identifiers:
136
+
137
+ The rendering of standard library first class ADT identifiers is controlled
138
+ by option flag "treat_stdlib_adts_as_builtins".
139
+
140
+ When this option is turned on, standard library ADT identifiers are rendered
141
+ as builtins. When it is turned off, they are rendered as ordinary library
142
+ identifiers.
143
+
144
+ `treat_stdlib_adts_as_builtins` (default: On)
145
+
146
+ The option is useful for dialects that support ADTs as first class objects
147
+ and provide ADTs in the standard library that would otherwise be built-in.
148
+
149
+ At present, only Modula-2 R10 supports library ADTs as first class objects
150
+ and therefore, no ADT identifiers are defined for any other dialects.
151
+
152
+ Example:
153
+
154
+ ``$ pygmentize -O full,dialect=m2r10,treat_stdlib_adts_as_builtins=Off ...``
155
+ Render standard library ADTs as ordinary library types.
156
+
157
+ .. versionadded:: 1.3
158
+
159
+ .. versionchanged:: 2.1
160
+ Added multi-dialect support.
161
+ """
162
+ name = 'Modula-2'
163
+ aliases = ['modula2', 'm2']
164
+ filenames = ['*.def', '*.mod']
165
+ mimetypes = ['text/x-modula2']
166
+
167
+ flags = re.MULTILINE | re.DOTALL
168
+
169
+ tokens = {
170
+ 'whitespace': [
171
+ (r'\n+', Text), # blank lines
172
+ (r'\s+', Text), # whitespace
173
+ ],
174
+ 'dialecttags': [
175
+ # PIM Dialect Tag
176
+ (r'\(\*!m2pim\*\)', Comment.Special),
177
+ # ISO Dialect Tag
178
+ (r'\(\*!m2iso\*\)', Comment.Special),
179
+ # M2R10 Dialect Tag
180
+ (r'\(\*!m2r10\*\)', Comment.Special),
181
+ # ObjM2 Dialect Tag
182
+ (r'\(\*!objm2\*\)', Comment.Special),
183
+ # Aglet Extensions Dialect Tag
184
+ (r'\(\*!m2iso\+aglet\*\)', Comment.Special),
185
+ # GNU Extensions Dialect Tag
186
+ (r'\(\*!m2pim\+gm2\*\)', Comment.Special),
187
+ # p1 Extensions Dialect Tag
188
+ (r'\(\*!m2iso\+p1\*\)', Comment.Special),
189
+ # XDS Extensions Dialect Tag
190
+ (r'\(\*!m2iso\+xds\*\)', Comment.Special),
191
+ ],
192
+ 'identifiers': [
193
+ (r'([a-zA-Z_$][\w$]*)', Name),
194
+ ],
195
+ 'prefixed_number_literals': [
196
+ #
197
+ # Base-2, whole number
198
+ (r'0b[01]+(\'[01]+)*', Number.Bin),
199
+ #
200
+ # Base-16, whole number
201
+ (r'0[ux][0-9A-F]+(\'[0-9A-F]+)*', Number.Hex),
202
+ ],
203
+ 'plain_number_literals': [
204
+ #
205
+ # Base-10, real number with exponent
206
+ (r'[0-9]+(\'[0-9]+)*' # integral part
207
+ r'\.[0-9]+(\'[0-9]+)*' # fractional part
208
+ r'[eE][+-]?[0-9]+(\'[0-9]+)*', # exponent
209
+ Number.Float),
210
+ #
211
+ # Base-10, real number without exponent
212
+ (r'[0-9]+(\'[0-9]+)*' # integral part
213
+ r'\.[0-9]+(\'[0-9]+)*', # fractional part
214
+ Number.Float),
215
+ #
216
+ # Base-10, whole number
217
+ (r'[0-9]+(\'[0-9]+)*', Number.Integer),
218
+ ],
219
+ 'suffixed_number_literals': [
220
+ #
221
+ # Base-8, whole number
222
+ (r'[0-7]+B', Number.Oct),
223
+ #
224
+ # Base-8, character code
225
+ (r'[0-7]+C', Number.Oct),
226
+ #
227
+ # Base-16, number
228
+ (r'[0-9A-F]+H', Number.Hex),
229
+ ],
230
+ 'string_literals': [
231
+ (r"'(\\\\|\\'|[^'])*'", String), # single quoted string
232
+ (r'"(\\\\|\\"|[^"])*"', String), # double quoted string
233
+ ],
234
+ 'digraph_operators': [
235
+ # Dot Product Operator
236
+ (r'\*\.', Operator),
237
+ # Array Concatenation Operator
238
+ (r'\+>', Operator), # M2R10 + ObjM2
239
+ # Inequality Operator
240
+ (r'<>', Operator), # ISO + PIM
241
+ # Less-Or-Equal, Subset
242
+ (r'<=', Operator),
243
+ # Greater-Or-Equal, Superset
244
+ (r'>=', Operator),
245
+ # Identity Operator
246
+ (r'==', Operator), # M2R10 + ObjM2
247
+ # Type Conversion Operator
248
+ (r'::', Operator), # M2R10 + ObjM2
249
+ # Assignment Symbol
250
+ (r':=', Operator),
251
+ # Postfix Increment Mutator
252
+ (r'\+\+', Operator), # M2R10 + ObjM2
253
+ # Postfix Decrement Mutator
254
+ (r'--', Operator), # M2R10 + ObjM2
255
+ ],
256
+ 'unigraph_operators': [
257
+ # Arithmetic Operators
258
+ (r'[+-]', Operator),
259
+ (r'[*/]', Operator),
260
+ # ISO 80000-2 compliant Set Difference Operator
261
+ (r'\\', Operator), # M2R10 + ObjM2
262
+ # Relational Operators
263
+ (r'[=#<>]', Operator),
264
+ # Dereferencing Operator
265
+ (r'\^', Operator),
266
+ # Dereferencing Operator Synonym
267
+ (r'@', Operator), # ISO
268
+ # Logical AND Operator Synonym
269
+ (r'&', Operator), # PIM + ISO
270
+ # Logical NOT Operator Synonym
271
+ (r'~', Operator), # PIM + ISO
272
+ # Smalltalk Message Prefix
273
+ (r'`', Operator), # ObjM2
274
+ ],
275
+ 'digraph_punctuation': [
276
+ # Range Constructor
277
+ (r'\.\.', Punctuation),
278
+ # Opening Chevron Bracket
279
+ (r'<<', Punctuation), # M2R10 + ISO
280
+ # Closing Chevron Bracket
281
+ (r'>>', Punctuation), # M2R10 + ISO
282
+ # Blueprint Punctuation
283
+ (r'->', Punctuation), # M2R10 + ISO
284
+ # Distinguish |# and # in M2 R10
285
+ (r'\|#', Punctuation),
286
+ # Distinguish ## and # in M2 R10
287
+ (r'##', Punctuation),
288
+ # Distinguish |* and * in M2 R10
289
+ (r'\|\*', Punctuation),
290
+ ],
291
+ 'unigraph_punctuation': [
292
+ # Common Punctuation
293
+ (r'[()\[\]{},.:;|]', Punctuation),
294
+ # Case Label Separator Synonym
295
+ (r'!', Punctuation), # ISO
296
+ # Blueprint Punctuation
297
+ (r'\?', Punctuation), # M2R10 + ObjM2
298
+ ],
299
+ 'comments': [
300
+ # Single Line Comment
301
+ (r'^//.*?\n', Comment.Single), # M2R10 + ObjM2
302
+ # Block Comment
303
+ (r'\(\*([^$].*?)\*\)', Comment.Multiline),
304
+ # Template Block Comment
305
+ (r'/\*(.*?)\*/', Comment.Multiline), # M2R10 + ObjM2
306
+ ],
307
+ 'pragmas': [
308
+ # ISO Style Pragmas
309
+ (r'<\*.*?\*>', Comment.Preproc), # ISO, M2R10 + ObjM2
310
+ # Pascal Style Pragmas
311
+ (r'\(\*\$.*?\*\)', Comment.Preproc), # PIM
312
+ ],
313
+ 'root': [
314
+ include('whitespace'),
315
+ include('dialecttags'),
316
+ include('pragmas'),
317
+ include('comments'),
318
+ include('identifiers'),
319
+ include('suffixed_number_literals'), # PIM + ISO
320
+ include('prefixed_number_literals'), # M2R10 + ObjM2
321
+ include('plain_number_literals'),
322
+ include('string_literals'),
323
+ include('digraph_punctuation'),
324
+ include('digraph_operators'),
325
+ include('unigraph_punctuation'),
326
+ include('unigraph_operators'),
327
+ ]
328
+ }
329
+
330
+ # C o m m o n D a t a s e t s
331
+
332
+ # Common Reserved Words Dataset
333
+ common_reserved_words = (
334
+ # 37 common reserved words
335
+ 'AND', 'ARRAY', 'BEGIN', 'BY', 'CASE', 'CONST', 'DEFINITION', 'DIV',
336
+ 'DO', 'ELSE', 'ELSIF', 'END', 'EXIT', 'FOR', 'FROM', 'IF',
337
+ 'IMPLEMENTATION', 'IMPORT', 'IN', 'LOOP', 'MOD', 'MODULE', 'NOT',
338
+ 'OF', 'OR', 'POINTER', 'PROCEDURE', 'RECORD', 'REPEAT', 'RETURN',
339
+ 'SET', 'THEN', 'TO', 'TYPE', 'UNTIL', 'VAR', 'WHILE',
340
+ )
341
+
342
+ # Common Builtins Dataset
343
+ common_builtins = (
344
+ # 16 common builtins
345
+ 'ABS', 'BOOLEAN', 'CARDINAL', 'CHAR', 'CHR', 'FALSE', 'INTEGER',
346
+ 'LONGINT', 'LONGREAL', 'MAX', 'MIN', 'NIL', 'ODD', 'ORD', 'REAL',
347
+ 'TRUE',
348
+ )
349
+
350
+ # Common Pseudo-Module Builtins Dataset
351
+ common_pseudo_builtins = (
352
+ # 4 common pseudo builtins
353
+ 'ADDRESS', 'BYTE', 'WORD', 'ADR'
354
+ )
355
+
356
+ # P I M M o d u l a - 2 D a t a s e t s
357
+
358
+ # Lexemes to Mark as Error Tokens for PIM Modula-2
359
+ pim_lexemes_to_reject = (
360
+ '!', '`', '@', '$', '%', '?', '\\', '==', '++', '--', '::', '*.',
361
+ '+>', '->', '<<', '>>', '|#', '##',
362
+ )
363
+
364
+ # PIM Modula-2 Additional Reserved Words Dataset
365
+ pim_additional_reserved_words = (
366
+ # 3 additional reserved words
367
+ 'EXPORT', 'QUALIFIED', 'WITH',
368
+ )
369
+
370
+ # PIM Modula-2 Additional Builtins Dataset
371
+ pim_additional_builtins = (
372
+ # 16 additional builtins
373
+ 'BITSET', 'CAP', 'DEC', 'DISPOSE', 'EXCL', 'FLOAT', 'HALT', 'HIGH',
374
+ 'INC', 'INCL', 'NEW', 'NIL', 'PROC', 'SIZE', 'TRUNC', 'VAL',
375
+ )
376
+
377
+ # PIM Modula-2 Additional Pseudo-Module Builtins Dataset
378
+ pim_additional_pseudo_builtins = (
379
+ # 5 additional pseudo builtins
380
+ 'SYSTEM', 'PROCESS', 'TSIZE', 'NEWPROCESS', 'TRANSFER',
381
+ )
382
+
383
+ # I S O M o d u l a - 2 D a t a s e t s
384
+
385
+ # Lexemes to Mark as Error Tokens for ISO Modula-2
386
+ iso_lexemes_to_reject = (
387
+ '`', '$', '%', '?', '\\', '==', '++', '--', '::', '*.', '+>', '->',
388
+ '<<', '>>', '|#', '##',
389
+ )
390
+
391
+ # ISO Modula-2 Additional Reserved Words Dataset
392
+ iso_additional_reserved_words = (
393
+ # 9 additional reserved words (ISO 10514-1)
394
+ 'EXCEPT', 'EXPORT', 'FINALLY', 'FORWARD', 'PACKEDSET', 'QUALIFIED',
395
+ 'REM', 'RETRY', 'WITH',
396
+ # 10 additional reserved words (ISO 10514-2 & ISO 10514-3)
397
+ 'ABSTRACT', 'AS', 'CLASS', 'GUARD', 'INHERIT', 'OVERRIDE', 'READONLY',
398
+ 'REVEAL', 'TRACED', 'UNSAFEGUARDED',
399
+ )
400
+
401
+ # ISO Modula-2 Additional Builtins Dataset
402
+ iso_additional_builtins = (
403
+ # 26 additional builtins (ISO 10514-1)
404
+ 'BITSET', 'CAP', 'CMPLX', 'COMPLEX', 'DEC', 'DISPOSE', 'EXCL', 'FLOAT',
405
+ 'HALT', 'HIGH', 'IM', 'INC', 'INCL', 'INT', 'INTERRUPTIBLE', 'LENGTH',
406
+ 'LFLOAT', 'LONGCOMPLEX', 'NEW', 'PROC', 'PROTECTION', 'RE', 'SIZE',
407
+ 'TRUNC', 'UNINTERRUBTIBLE', 'VAL',
408
+ # 5 additional builtins (ISO 10514-2 & ISO 10514-3)
409
+ 'CREATE', 'DESTROY', 'EMPTY', 'ISMEMBER', 'SELF',
410
+ )
411
+
412
+ # ISO Modula-2 Additional Pseudo-Module Builtins Dataset
413
+ iso_additional_pseudo_builtins = (
414
+ # 14 additional builtins (SYSTEM)
415
+ 'SYSTEM', 'BITSPERLOC', 'LOCSPERBYTE', 'LOCSPERWORD', 'LOC',
416
+ 'ADDADR', 'SUBADR', 'DIFADR', 'MAKEADR', 'ADR',
417
+ 'ROTATE', 'SHIFT', 'CAST', 'TSIZE',
418
+ # 13 additional builtins (COROUTINES)
419
+ 'COROUTINES', 'ATTACH', 'COROUTINE', 'CURRENT', 'DETACH', 'HANDLER',
420
+ 'INTERRUPTSOURCE', 'IOTRANSFER', 'IsATTACHED', 'LISTEN',
421
+ 'NEWCOROUTINE', 'PROT', 'TRANSFER',
422
+ # 9 additional builtins (EXCEPTIONS)
423
+ 'EXCEPTIONS', 'AllocateSource', 'CurrentNumber', 'ExceptionNumber',
424
+ 'ExceptionSource', 'GetMessage', 'IsCurrentSource',
425
+ 'IsExceptionalExecution', 'RAISE',
426
+ # 3 additional builtins (TERMINATION)
427
+ 'TERMINATION', 'IsTerminating', 'HasHalted',
428
+ # 4 additional builtins (M2EXCEPTION)
429
+ 'M2EXCEPTION', 'M2Exceptions', 'M2Exception', 'IsM2Exception',
430
+ 'indexException', 'rangeException', 'caseSelectException',
431
+ 'invalidLocation', 'functionException', 'wholeValueException',
432
+ 'wholeDivException', 'realValueException', 'realDivException',
433
+ 'complexValueException', 'complexDivException', 'protException',
434
+ 'sysException', 'coException', 'exException',
435
+ )
436
+
437
+ # M o d u l a - 2 R 1 0 D a t a s e t s
438
+
439
+ # Lexemes to Mark as Error Tokens for Modula-2 R10
440
+ m2r10_lexemes_to_reject = (
441
+ '!', '`', '@', '$', '%', '&', '<>',
442
+ )
443
+
444
+ # Modula-2 R10 reserved words in addition to the common set
445
+ m2r10_additional_reserved_words = (
446
+ # 12 additional reserved words
447
+ 'ALIAS', 'ARGLIST', 'BLUEPRINT', 'COPY', 'GENLIB', 'INDETERMINATE',
448
+ 'NEW', 'NONE', 'OPAQUE', 'REFERENTIAL', 'RELEASE', 'RETAIN',
449
+ # 2 additional reserved words with symbolic assembly option
450
+ 'ASM', 'REG',
451
+ )
452
+
453
+ # Modula-2 R10 builtins in addition to the common set
454
+ m2r10_additional_builtins = (
455
+ # 26 additional builtins
456
+ 'CARDINAL', 'COUNT', 'EMPTY', 'EXISTS', 'INSERT', 'LENGTH', 'LONGCARD',
457
+ 'OCTET', 'PTR', 'PRED', 'READ', 'READNEW', 'REMOVE', 'RETRIEVE', 'SORT',
458
+ 'STORE', 'SUBSET', 'SUCC', 'TLIMIT', 'TMAX', 'TMIN', 'TRUE', 'TSIZE',
459
+ 'UNICHAR', 'WRITE', 'WRITEF',
460
+ )
461
+
462
+ # Modula-2 R10 Additional Pseudo-Module Builtins Dataset
463
+ m2r10_additional_pseudo_builtins = (
464
+ # 13 additional builtins (TPROPERTIES)
465
+ 'TPROPERTIES', 'PROPERTY', 'LITERAL', 'TPROPERTY', 'TLITERAL',
466
+ 'TBUILTIN', 'TDYN', 'TREFC', 'TNIL', 'TBASE', 'TPRECISION',
467
+ 'TMAXEXP', 'TMINEXP',
468
+ # 4 additional builtins (CONVERSION)
469
+ 'CONVERSION', 'TSXFSIZE', 'SXF', 'VAL',
470
+ # 35 additional builtins (UNSAFE)
471
+ 'UNSAFE', 'CAST', 'INTRINSIC', 'AVAIL', 'ADD', 'SUB', 'ADDC', 'SUBC',
472
+ 'FETCHADD', 'FETCHSUB', 'SHL', 'SHR', 'ASHR', 'ROTL', 'ROTR', 'ROTLC',
473
+ 'ROTRC', 'BWNOT', 'BWAND', 'BWOR', 'BWXOR', 'BWNAND', 'BWNOR',
474
+ 'SETBIT', 'TESTBIT', 'LSBIT', 'MSBIT', 'CSBITS', 'BAIL', 'HALT',
475
+ 'TODO', 'FFI', 'ADDR', 'VARGLIST', 'VARGC',
476
+ # 11 additional builtins (ATOMIC)
477
+ 'ATOMIC', 'INTRINSIC', 'AVAIL', 'SWAP', 'CAS', 'INC', 'DEC', 'BWAND',
478
+ 'BWNAND', 'BWOR', 'BWXOR',
479
+ # 7 additional builtins (COMPILER)
480
+ 'COMPILER', 'DEBUG', 'MODNAME', 'PROCNAME', 'LINENUM', 'DEFAULT',
481
+ 'HASH',
482
+ # 5 additional builtins (ASSEMBLER)
483
+ 'ASSEMBLER', 'REGISTER', 'SETREG', 'GETREG', 'CODE',
484
+ )
485
+
486
+ # O b j e c t i v e M o d u l a - 2 D a t a s e t s
487
+
488
+ # Lexemes to Mark as Error Tokens for Objective Modula-2
489
+ objm2_lexemes_to_reject = (
490
+ '!', '$', '%', '&', '<>',
491
+ )
492
+
493
+ # Objective Modula-2 Extensions
494
+ # reserved words in addition to Modula-2 R10
495
+ objm2_additional_reserved_words = (
496
+ # 16 additional reserved words
497
+ 'BYCOPY', 'BYREF', 'CLASS', 'CONTINUE', 'CRITICAL', 'INOUT', 'METHOD',
498
+ 'ON', 'OPTIONAL', 'OUT', 'PRIVATE', 'PROTECTED', 'PROTOCOL', 'PUBLIC',
499
+ 'SUPER', 'TRY',
500
+ )
501
+
502
+ # Objective Modula-2 Extensions
503
+ # builtins in addition to Modula-2 R10
504
+ objm2_additional_builtins = (
505
+ # 3 additional builtins
506
+ 'OBJECT', 'NO', 'YES',
507
+ )
508
+
509
+ # Objective Modula-2 Extensions
510
+ # pseudo-module builtins in addition to Modula-2 R10
511
+ objm2_additional_pseudo_builtins = (
512
+ # None
513
+ )
514
+
515
+ # A g l e t M o d u l a - 2 D a t a s e t s
516
+
517
+ # Aglet Extensions
518
+ # reserved words in addition to ISO Modula-2
519
+ aglet_additional_reserved_words = (
520
+ # None
521
+ )
522
+
523
+ # Aglet Extensions
524
+ # builtins in addition to ISO Modula-2
525
+ aglet_additional_builtins = (
526
+ # 9 additional builtins
527
+ 'BITSET8', 'BITSET16', 'BITSET32', 'CARDINAL8', 'CARDINAL16',
528
+ 'CARDINAL32', 'INTEGER8', 'INTEGER16', 'INTEGER32',
529
+ )
530
+
531
+ # Aglet Modula-2 Extensions
532
+ # pseudo-module builtins in addition to ISO Modula-2
533
+ aglet_additional_pseudo_builtins = (
534
+ # None
535
+ )
536
+
537
+ # G N U M o d u l a - 2 D a t a s e t s
538
+
539
+ # GNU Extensions
540
+ # reserved words in addition to PIM Modula-2
541
+ gm2_additional_reserved_words = (
542
+ # 10 additional reserved words
543
+ 'ASM', '__ATTRIBUTE__', '__BUILTIN__', '__COLUMN__', '__DATE__',
544
+ '__FILE__', '__FUNCTION__', '__LINE__', '__MODULE__', 'VOLATILE',
545
+ )
546
+
547
+ # GNU Extensions
548
+ # builtins in addition to PIM Modula-2
549
+ gm2_additional_builtins = (
550
+ # 21 additional builtins
551
+ 'BITSET8', 'BITSET16', 'BITSET32', 'CARDINAL8', 'CARDINAL16',
552
+ 'CARDINAL32', 'CARDINAL64', 'COMPLEX32', 'COMPLEX64', 'COMPLEX96',
553
+ 'COMPLEX128', 'INTEGER8', 'INTEGER16', 'INTEGER32', 'INTEGER64',
554
+ 'REAL8', 'REAL16', 'REAL32', 'REAL96', 'REAL128', 'THROW',
555
+ )
556
+
557
+ # GNU Extensions
558
+ # pseudo-module builtins in addition to PIM Modula-2
559
+ gm2_additional_pseudo_builtins = (
560
+ # None
561
+ )
562
+
563
+ # p 1 M o d u l a - 2 D a t a s e t s
564
+
565
+ # p1 Extensions
566
+ # reserved words in addition to ISO Modula-2
567
+ p1_additional_reserved_words = (
568
+ # None
569
+ )
570
+
571
+ # p1 Extensions
572
+ # builtins in addition to ISO Modula-2
573
+ p1_additional_builtins = (
574
+ # None
575
+ )
576
+
577
+ # p1 Modula-2 Extensions
578
+ # pseudo-module builtins in addition to ISO Modula-2
579
+ p1_additional_pseudo_builtins = (
580
+ # 1 additional builtin
581
+ 'BCD',
582
+ )
583
+
584
+ # X D S M o d u l a - 2 D a t a s e t s
585
+
586
+ # XDS Extensions
587
+ # reserved words in addition to ISO Modula-2
588
+ xds_additional_reserved_words = (
589
+ # 1 additional reserved word
590
+ 'SEQ',
591
+ )
592
+
593
+ # XDS Extensions
594
+ # builtins in addition to ISO Modula-2
595
+ xds_additional_builtins = (
596
+ # 9 additional builtins
597
+ 'ASH', 'ASSERT', 'DIFFADR_TYPE', 'ENTIER', 'INDEX', 'LEN',
598
+ 'LONGCARD', 'SHORTCARD', 'SHORTINT',
599
+ )
600
+
601
+ # XDS Modula-2 Extensions
602
+ # pseudo-module builtins in addition to ISO Modula-2
603
+ xds_additional_pseudo_builtins = (
604
+ # 22 additional builtins (SYSTEM)
605
+ 'PROCESS', 'NEWPROCESS', 'BOOL8', 'BOOL16', 'BOOL32', 'CARD8',
606
+ 'CARD16', 'CARD32', 'INT8', 'INT16', 'INT32', 'REF', 'MOVE',
607
+ 'FILL', 'GET', 'PUT', 'CC', 'int', 'unsigned', 'size_t', 'void'
608
+ # 3 additional builtins (COMPILER)
609
+ 'COMPILER', 'OPTION', 'EQUATION'
610
+ )
611
+
612
+ # P I M S t a n d a r d L i b r a r y D a t a s e t s
613
+
614
+ # PIM Modula-2 Standard Library Modules Dataset
615
+ pim_stdlib_module_identifiers = (
616
+ 'Terminal', 'FileSystem', 'InOut', 'RealInOut', 'MathLib0', 'Storage',
617
+ )
618
+
619
+ # PIM Modula-2 Standard Library Types Dataset
620
+ pim_stdlib_type_identifiers = (
621
+ 'Flag', 'FlagSet', 'Response', 'Command', 'Lock', 'Permission',
622
+ 'MediumType', 'File', 'FileProc', 'DirectoryProc', 'FileCommand',
623
+ 'DirectoryCommand',
624
+ )
625
+
626
+ # PIM Modula-2 Standard Library Procedures Dataset
627
+ pim_stdlib_proc_identifiers = (
628
+ 'Read', 'BusyRead', 'ReadAgain', 'Write', 'WriteString', 'WriteLn',
629
+ 'Create', 'Lookup', 'Close', 'Delete', 'Rename', 'SetRead', 'SetWrite',
630
+ 'SetModify', 'SetOpen', 'Doio', 'SetPos', 'GetPos', 'Length', 'Reset',
631
+ 'Again', 'ReadWord', 'WriteWord', 'ReadChar', 'WriteChar',
632
+ 'CreateMedium', 'DeleteMedium', 'AssignName', 'DeassignName',
633
+ 'ReadMedium', 'LookupMedium', 'OpenInput', 'OpenOutput', 'CloseInput',
634
+ 'CloseOutput', 'ReadString', 'ReadInt', 'ReadCard', 'ReadWrd',
635
+ 'WriteInt', 'WriteCard', 'WriteOct', 'WriteHex', 'WriteWrd',
636
+ 'ReadReal', 'WriteReal', 'WriteFixPt', 'WriteRealOct', 'sqrt', 'exp',
637
+ 'ln', 'sin', 'cos', 'arctan', 'entier', 'ALLOCATE', 'DEALLOCATE',
638
+ )
639
+
640
+ # PIM Modula-2 Standard Library Variables Dataset
641
+ pim_stdlib_var_identifiers = (
642
+ 'Done', 'termCH', 'in', 'out'
643
+ )
644
+
645
+ # PIM Modula-2 Standard Library Constants Dataset
646
+ pim_stdlib_const_identifiers = (
647
+ 'EOL',
648
+ )
649
+
650
+ # I S O S t a n d a r d L i b r a r y D a t a s e t s
651
+
652
+ # ISO Modula-2 Standard Library Modules Dataset
653
+ iso_stdlib_module_identifiers = (
654
+ # TO DO
655
+ )
656
+
657
+ # ISO Modula-2 Standard Library Types Dataset
658
+ iso_stdlib_type_identifiers = (
659
+ # TO DO
660
+ )
661
+
662
+ # ISO Modula-2 Standard Library Procedures Dataset
663
+ iso_stdlib_proc_identifiers = (
664
+ # TO DO
665
+ )
666
+
667
+ # ISO Modula-2 Standard Library Variables Dataset
668
+ iso_stdlib_var_identifiers = (
669
+ # TO DO
670
+ )
671
+
672
+ # ISO Modula-2 Standard Library Constants Dataset
673
+ iso_stdlib_const_identifiers = (
674
+ # TO DO
675
+ )
676
+
677
+ # M 2 R 1 0 S t a n d a r d L i b r a r y D a t a s e t s
678
+
679
+ # Modula-2 R10 Standard Library ADTs Dataset
680
+ m2r10_stdlib_adt_identifiers = (
681
+ 'BCD', 'LONGBCD', 'BITSET', 'SHORTBITSET', 'LONGBITSET',
682
+ 'LONGLONGBITSET', 'COMPLEX', 'LONGCOMPLEX', 'SHORTCARD', 'LONGLONGCARD',
683
+ 'SHORTINT', 'LONGLONGINT', 'POSINT', 'SHORTPOSINT', 'LONGPOSINT',
684
+ 'LONGLONGPOSINT', 'BITSET8', 'BITSET16', 'BITSET32', 'BITSET64',
685
+ 'BITSET128', 'BS8', 'BS16', 'BS32', 'BS64', 'BS128', 'CARDINAL8',
686
+ 'CARDINAL16', 'CARDINAL32', 'CARDINAL64', 'CARDINAL128', 'CARD8',
687
+ 'CARD16', 'CARD32', 'CARD64', 'CARD128', 'INTEGER8', 'INTEGER16',
688
+ 'INTEGER32', 'INTEGER64', 'INTEGER128', 'INT8', 'INT16', 'INT32',
689
+ 'INT64', 'INT128', 'STRING', 'UNISTRING',
690
+ )
691
+
692
+ # Modula-2 R10 Standard Library Blueprints Dataset
693
+ m2r10_stdlib_blueprint_identifiers = (
694
+ 'ProtoRoot', 'ProtoComputational', 'ProtoNumeric', 'ProtoScalar',
695
+ 'ProtoNonScalar', 'ProtoCardinal', 'ProtoInteger', 'ProtoReal',
696
+ 'ProtoComplex', 'ProtoVector', 'ProtoTuple', 'ProtoCompArray',
697
+ 'ProtoCollection', 'ProtoStaticArray', 'ProtoStaticSet',
698
+ 'ProtoStaticString', 'ProtoArray', 'ProtoString', 'ProtoSet',
699
+ 'ProtoMultiSet', 'ProtoDictionary', 'ProtoMultiDict', 'ProtoExtension',
700
+ 'ProtoIO', 'ProtoCardMath', 'ProtoIntMath', 'ProtoRealMath',
701
+ )
702
+
703
+ # Modula-2 R10 Standard Library Modules Dataset
704
+ m2r10_stdlib_module_identifiers = (
705
+ 'ASCII', 'BooleanIO', 'CharIO', 'UnicharIO', 'OctetIO',
706
+ 'CardinalIO', 'LongCardIO', 'IntegerIO', 'LongIntIO', 'RealIO',
707
+ 'LongRealIO', 'BCDIO', 'LongBCDIO', 'CardMath', 'LongCardMath',
708
+ 'IntMath', 'LongIntMath', 'RealMath', 'LongRealMath', 'BCDMath',
709
+ 'LongBCDMath', 'FileIO', 'FileSystem', 'Storage', 'IOSupport',
710
+ )
711
+
712
+ # Modula-2 R10 Standard Library Types Dataset
713
+ m2r10_stdlib_type_identifiers = (
714
+ 'File', 'Status',
715
+ # TO BE COMPLETED
716
+ )
717
+
718
+ # Modula-2 R10 Standard Library Procedures Dataset
719
+ m2r10_stdlib_proc_identifiers = (
720
+ 'ALLOCATE', 'DEALLOCATE', 'SIZE',
721
+ # TO BE COMPLETED
722
+ )
723
+
724
+ # Modula-2 R10 Standard Library Variables Dataset
725
+ m2r10_stdlib_var_identifiers = (
726
+ 'stdIn', 'stdOut', 'stdErr',
727
+ )
728
+
729
+ # Modula-2 R10 Standard Library Constants Dataset
730
+ m2r10_stdlib_const_identifiers = (
731
+ 'pi', 'tau',
732
+ )
733
+
734
+ # D i a l e c t s
735
+
736
+ # Dialect modes
737
+ dialects = (
738
+ 'unknown',
739
+ 'm2pim', 'm2iso', 'm2r10', 'objm2',
740
+ 'm2iso+aglet', 'm2pim+gm2', 'm2iso+p1', 'm2iso+xds',
741
+ )
742
+
743
+ # D a t a b a s e s
744
+
745
+ # Lexemes to Mark as Errors Database
746
+ lexemes_to_reject_db = {
747
+ # Lexemes to reject for unknown dialect
748
+ 'unknown': (
749
+ # LEAVE THIS EMPTY
750
+ ),
751
+ # Lexemes to reject for PIM Modula-2
752
+ 'm2pim': (
753
+ pim_lexemes_to_reject,
754
+ ),
755
+ # Lexemes to reject for ISO Modula-2
756
+ 'm2iso': (
757
+ iso_lexemes_to_reject,
758
+ ),
759
+ # Lexemes to reject for Modula-2 R10
760
+ 'm2r10': (
761
+ m2r10_lexemes_to_reject,
762
+ ),
763
+ # Lexemes to reject for Objective Modula-2
764
+ 'objm2': (
765
+ objm2_lexemes_to_reject,
766
+ ),
767
+ # Lexemes to reject for Aglet Modula-2
768
+ 'm2iso+aglet': (
769
+ iso_lexemes_to_reject,
770
+ ),
771
+ # Lexemes to reject for GNU Modula-2
772
+ 'm2pim+gm2': (
773
+ pim_lexemes_to_reject,
774
+ ),
775
+ # Lexemes to reject for p1 Modula-2
776
+ 'm2iso+p1': (
777
+ iso_lexemes_to_reject,
778
+ ),
779
+ # Lexemes to reject for XDS Modula-2
780
+ 'm2iso+xds': (
781
+ iso_lexemes_to_reject,
782
+ ),
783
+ }
784
+
785
+ # Reserved Words Database
786
+ reserved_words_db = {
787
+ # Reserved words for unknown dialect
788
+ 'unknown': (
789
+ common_reserved_words,
790
+ pim_additional_reserved_words,
791
+ iso_additional_reserved_words,
792
+ m2r10_additional_reserved_words,
793
+ ),
794
+
795
+ # Reserved words for PIM Modula-2
796
+ 'm2pim': (
797
+ common_reserved_words,
798
+ pim_additional_reserved_words,
799
+ ),
800
+
801
+ # Reserved words for Modula-2 R10
802
+ 'm2iso': (
803
+ common_reserved_words,
804
+ iso_additional_reserved_words,
805
+ ),
806
+
807
+ # Reserved words for ISO Modula-2
808
+ 'm2r10': (
809
+ common_reserved_words,
810
+ m2r10_additional_reserved_words,
811
+ ),
812
+
813
+ # Reserved words for Objective Modula-2
814
+ 'objm2': (
815
+ common_reserved_words,
816
+ m2r10_additional_reserved_words,
817
+ objm2_additional_reserved_words,
818
+ ),
819
+
820
+ # Reserved words for Aglet Modula-2 Extensions
821
+ 'm2iso+aglet': (
822
+ common_reserved_words,
823
+ iso_additional_reserved_words,
824
+ aglet_additional_reserved_words,
825
+ ),
826
+
827
+ # Reserved words for GNU Modula-2 Extensions
828
+ 'm2pim+gm2': (
829
+ common_reserved_words,
830
+ pim_additional_reserved_words,
831
+ gm2_additional_reserved_words,
832
+ ),
833
+
834
+ # Reserved words for p1 Modula-2 Extensions
835
+ 'm2iso+p1': (
836
+ common_reserved_words,
837
+ iso_additional_reserved_words,
838
+ p1_additional_reserved_words,
839
+ ),
840
+
841
+ # Reserved words for XDS Modula-2 Extensions
842
+ 'm2iso+xds': (
843
+ common_reserved_words,
844
+ iso_additional_reserved_words,
845
+ xds_additional_reserved_words,
846
+ ),
847
+ }
848
+
849
+ # Builtins Database
850
+ builtins_db = {
851
+ # Builtins for unknown dialect
852
+ 'unknown': (
853
+ common_builtins,
854
+ pim_additional_builtins,
855
+ iso_additional_builtins,
856
+ m2r10_additional_builtins,
857
+ ),
858
+
859
+ # Builtins for PIM Modula-2
860
+ 'm2pim': (
861
+ common_builtins,
862
+ pim_additional_builtins,
863
+ ),
864
+
865
+ # Builtins for ISO Modula-2
866
+ 'm2iso': (
867
+ common_builtins,
868
+ iso_additional_builtins,
869
+ ),
870
+
871
+ # Builtins for ISO Modula-2
872
+ 'm2r10': (
873
+ common_builtins,
874
+ m2r10_additional_builtins,
875
+ ),
876
+
877
+ # Builtins for Objective Modula-2
878
+ 'objm2': (
879
+ common_builtins,
880
+ m2r10_additional_builtins,
881
+ objm2_additional_builtins,
882
+ ),
883
+
884
+ # Builtins for Aglet Modula-2 Extensions
885
+ 'm2iso+aglet': (
886
+ common_builtins,
887
+ iso_additional_builtins,
888
+ aglet_additional_builtins,
889
+ ),
890
+
891
+ # Builtins for GNU Modula-2 Extensions
892
+ 'm2pim+gm2': (
893
+ common_builtins,
894
+ pim_additional_builtins,
895
+ gm2_additional_builtins,
896
+ ),
897
+
898
+ # Builtins for p1 Modula-2 Extensions
899
+ 'm2iso+p1': (
900
+ common_builtins,
901
+ iso_additional_builtins,
902
+ p1_additional_builtins,
903
+ ),
904
+
905
+ # Builtins for XDS Modula-2 Extensions
906
+ 'm2iso+xds': (
907
+ common_builtins,
908
+ iso_additional_builtins,
909
+ xds_additional_builtins,
910
+ ),
911
+ }
912
+
913
+ # Pseudo-Module Builtins Database
914
+ pseudo_builtins_db = {
915
+ # Builtins for unknown dialect
916
+ 'unknown': (
917
+ common_pseudo_builtins,
918
+ pim_additional_pseudo_builtins,
919
+ iso_additional_pseudo_builtins,
920
+ m2r10_additional_pseudo_builtins,
921
+ ),
922
+
923
+ # Builtins for PIM Modula-2
924
+ 'm2pim': (
925
+ common_pseudo_builtins,
926
+ pim_additional_pseudo_builtins,
927
+ ),
928
+
929
+ # Builtins for ISO Modula-2
930
+ 'm2iso': (
931
+ common_pseudo_builtins,
932
+ iso_additional_pseudo_builtins,
933
+ ),
934
+
935
+ # Builtins for ISO Modula-2
936
+ 'm2r10': (
937
+ common_pseudo_builtins,
938
+ m2r10_additional_pseudo_builtins,
939
+ ),
940
+
941
+ # Builtins for Objective Modula-2
942
+ 'objm2': (
943
+ common_pseudo_builtins,
944
+ m2r10_additional_pseudo_builtins,
945
+ objm2_additional_pseudo_builtins,
946
+ ),
947
+
948
+ # Builtins for Aglet Modula-2 Extensions
949
+ 'm2iso+aglet': (
950
+ common_pseudo_builtins,
951
+ iso_additional_pseudo_builtins,
952
+ aglet_additional_pseudo_builtins,
953
+ ),
954
+
955
+ # Builtins for GNU Modula-2 Extensions
956
+ 'm2pim+gm2': (
957
+ common_pseudo_builtins,
958
+ pim_additional_pseudo_builtins,
959
+ gm2_additional_pseudo_builtins,
960
+ ),
961
+
962
+ # Builtins for p1 Modula-2 Extensions
963
+ 'm2iso+p1': (
964
+ common_pseudo_builtins,
965
+ iso_additional_pseudo_builtins,
966
+ p1_additional_pseudo_builtins,
967
+ ),
968
+
969
+ # Builtins for XDS Modula-2 Extensions
970
+ 'm2iso+xds': (
971
+ common_pseudo_builtins,
972
+ iso_additional_pseudo_builtins,
973
+ xds_additional_pseudo_builtins,
974
+ ),
975
+ }
976
+
977
+ # Standard Library ADTs Database
978
+ stdlib_adts_db = {
979
+ # Empty entry for unknown dialect
980
+ 'unknown': (
981
+ # LEAVE THIS EMPTY
982
+ ),
983
+ # Standard Library ADTs for PIM Modula-2
984
+ 'm2pim': (
985
+ # No first class library types
986
+ ),
987
+
988
+ # Standard Library ADTs for ISO Modula-2
989
+ 'm2iso': (
990
+ # No first class library types
991
+ ),
992
+
993
+ # Standard Library ADTs for Modula-2 R10
994
+ 'm2r10': (
995
+ m2r10_stdlib_adt_identifiers,
996
+ ),
997
+
998
+ # Standard Library ADTs for Objective Modula-2
999
+ 'objm2': (
1000
+ m2r10_stdlib_adt_identifiers,
1001
+ ),
1002
+
1003
+ # Standard Library ADTs for Aglet Modula-2
1004
+ 'm2iso+aglet': (
1005
+ # No first class library types
1006
+ ),
1007
+
1008
+ # Standard Library ADTs for GNU Modula-2
1009
+ 'm2pim+gm2': (
1010
+ # No first class library types
1011
+ ),
1012
+
1013
+ # Standard Library ADTs for p1 Modula-2
1014
+ 'm2iso+p1': (
1015
+ # No first class library types
1016
+ ),
1017
+
1018
+ # Standard Library ADTs for XDS Modula-2
1019
+ 'm2iso+xds': (
1020
+ # No first class library types
1021
+ ),
1022
+ }
1023
+
1024
+ # Standard Library Modules Database
1025
+ stdlib_modules_db = {
1026
+ # Empty entry for unknown dialect
1027
+ 'unknown': (
1028
+ # LEAVE THIS EMPTY
1029
+ ),
1030
+ # Standard Library Modules for PIM Modula-2
1031
+ 'm2pim': (
1032
+ pim_stdlib_module_identifiers,
1033
+ ),
1034
+
1035
+ # Standard Library Modules for ISO Modula-2
1036
+ 'm2iso': (
1037
+ iso_stdlib_module_identifiers,
1038
+ ),
1039
+
1040
+ # Standard Library Modules for Modula-2 R10
1041
+ 'm2r10': (
1042
+ m2r10_stdlib_blueprint_identifiers,
1043
+ m2r10_stdlib_module_identifiers,
1044
+ m2r10_stdlib_adt_identifiers,
1045
+ ),
1046
+
1047
+ # Standard Library Modules for Objective Modula-2
1048
+ 'objm2': (
1049
+ m2r10_stdlib_blueprint_identifiers,
1050
+ m2r10_stdlib_module_identifiers,
1051
+ ),
1052
+
1053
+ # Standard Library Modules for Aglet Modula-2
1054
+ 'm2iso+aglet': (
1055
+ iso_stdlib_module_identifiers,
1056
+ ),
1057
+
1058
+ # Standard Library Modules for GNU Modula-2
1059
+ 'm2pim+gm2': (
1060
+ pim_stdlib_module_identifiers,
1061
+ ),
1062
+
1063
+ # Standard Library Modules for p1 Modula-2
1064
+ 'm2iso+p1': (
1065
+ iso_stdlib_module_identifiers,
1066
+ ),
1067
+
1068
+ # Standard Library Modules for XDS Modula-2
1069
+ 'm2iso+xds': (
1070
+ iso_stdlib_module_identifiers,
1071
+ ),
1072
+ }
1073
+
1074
+ # Standard Library Types Database
1075
+ stdlib_types_db = {
1076
+ # Empty entry for unknown dialect
1077
+ 'unknown': (
1078
+ # LEAVE THIS EMPTY
1079
+ ),
1080
+ # Standard Library Types for PIM Modula-2
1081
+ 'm2pim': (
1082
+ pim_stdlib_type_identifiers,
1083
+ ),
1084
+
1085
+ # Standard Library Types for ISO Modula-2
1086
+ 'm2iso': (
1087
+ iso_stdlib_type_identifiers,
1088
+ ),
1089
+
1090
+ # Standard Library Types for Modula-2 R10
1091
+ 'm2r10': (
1092
+ m2r10_stdlib_type_identifiers,
1093
+ ),
1094
+
1095
+ # Standard Library Types for Objective Modula-2
1096
+ 'objm2': (
1097
+ m2r10_stdlib_type_identifiers,
1098
+ ),
1099
+
1100
+ # Standard Library Types for Aglet Modula-2
1101
+ 'm2iso+aglet': (
1102
+ iso_stdlib_type_identifiers,
1103
+ ),
1104
+
1105
+ # Standard Library Types for GNU Modula-2
1106
+ 'm2pim+gm2': (
1107
+ pim_stdlib_type_identifiers,
1108
+ ),
1109
+
1110
+ # Standard Library Types for p1 Modula-2
1111
+ 'm2iso+p1': (
1112
+ iso_stdlib_type_identifiers,
1113
+ ),
1114
+
1115
+ # Standard Library Types for XDS Modula-2
1116
+ 'm2iso+xds': (
1117
+ iso_stdlib_type_identifiers,
1118
+ ),
1119
+ }
1120
+
1121
+ # Standard Library Procedures Database
1122
+ stdlib_procedures_db = {
1123
+ # Empty entry for unknown dialect
1124
+ 'unknown': (
1125
+ # LEAVE THIS EMPTY
1126
+ ),
1127
+ # Standard Library Procedures for PIM Modula-2
1128
+ 'm2pim': (
1129
+ pim_stdlib_proc_identifiers,
1130
+ ),
1131
+
1132
+ # Standard Library Procedures for ISO Modula-2
1133
+ 'm2iso': (
1134
+ iso_stdlib_proc_identifiers,
1135
+ ),
1136
+
1137
+ # Standard Library Procedures for Modula-2 R10
1138
+ 'm2r10': (
1139
+ m2r10_stdlib_proc_identifiers,
1140
+ ),
1141
+
1142
+ # Standard Library Procedures for Objective Modula-2
1143
+ 'objm2': (
1144
+ m2r10_stdlib_proc_identifiers,
1145
+ ),
1146
+
1147
+ # Standard Library Procedures for Aglet Modula-2
1148
+ 'm2iso+aglet': (
1149
+ iso_stdlib_proc_identifiers,
1150
+ ),
1151
+
1152
+ # Standard Library Procedures for GNU Modula-2
1153
+ 'm2pim+gm2': (
1154
+ pim_stdlib_proc_identifiers,
1155
+ ),
1156
+
1157
+ # Standard Library Procedures for p1 Modula-2
1158
+ 'm2iso+p1': (
1159
+ iso_stdlib_proc_identifiers,
1160
+ ),
1161
+
1162
+ # Standard Library Procedures for XDS Modula-2
1163
+ 'm2iso+xds': (
1164
+ iso_stdlib_proc_identifiers,
1165
+ ),
1166
+ }
1167
+
1168
+ # Standard Library Variables Database
1169
+ stdlib_variables_db = {
1170
+ # Empty entry for unknown dialect
1171
+ 'unknown': (
1172
+ # LEAVE THIS EMPTY
1173
+ ),
1174
+ # Standard Library Variables for PIM Modula-2
1175
+ 'm2pim': (
1176
+ pim_stdlib_var_identifiers,
1177
+ ),
1178
+
1179
+ # Standard Library Variables for ISO Modula-2
1180
+ 'm2iso': (
1181
+ iso_stdlib_var_identifiers,
1182
+ ),
1183
+
1184
+ # Standard Library Variables for Modula-2 R10
1185
+ 'm2r10': (
1186
+ m2r10_stdlib_var_identifiers,
1187
+ ),
1188
+
1189
+ # Standard Library Variables for Objective Modula-2
1190
+ 'objm2': (
1191
+ m2r10_stdlib_var_identifiers,
1192
+ ),
1193
+
1194
+ # Standard Library Variables for Aglet Modula-2
1195
+ 'm2iso+aglet': (
1196
+ iso_stdlib_var_identifiers,
1197
+ ),
1198
+
1199
+ # Standard Library Variables for GNU Modula-2
1200
+ 'm2pim+gm2': (
1201
+ pim_stdlib_var_identifiers,
1202
+ ),
1203
+
1204
+ # Standard Library Variables for p1 Modula-2
1205
+ 'm2iso+p1': (
1206
+ iso_stdlib_var_identifiers,
1207
+ ),
1208
+
1209
+ # Standard Library Variables for XDS Modula-2
1210
+ 'm2iso+xds': (
1211
+ iso_stdlib_var_identifiers,
1212
+ ),
1213
+ }
1214
+
1215
+ # Standard Library Constants Database
1216
+ stdlib_constants_db = {
1217
+ # Empty entry for unknown dialect
1218
+ 'unknown': (
1219
+ # LEAVE THIS EMPTY
1220
+ ),
1221
+ # Standard Library Constants for PIM Modula-2
1222
+ 'm2pim': (
1223
+ pim_stdlib_const_identifiers,
1224
+ ),
1225
+
1226
+ # Standard Library Constants for ISO Modula-2
1227
+ 'm2iso': (
1228
+ iso_stdlib_const_identifiers,
1229
+ ),
1230
+
1231
+ # Standard Library Constants for Modula-2 R10
1232
+ 'm2r10': (
1233
+ m2r10_stdlib_const_identifiers,
1234
+ ),
1235
+
1236
+ # Standard Library Constants for Objective Modula-2
1237
+ 'objm2': (
1238
+ m2r10_stdlib_const_identifiers,
1239
+ ),
1240
+
1241
+ # Standard Library Constants for Aglet Modula-2
1242
+ 'm2iso+aglet': (
1243
+ iso_stdlib_const_identifiers,
1244
+ ),
1245
+
1246
+ # Standard Library Constants for GNU Modula-2
1247
+ 'm2pim+gm2': (
1248
+ pim_stdlib_const_identifiers,
1249
+ ),
1250
+
1251
+ # Standard Library Constants for p1 Modula-2
1252
+ 'm2iso+p1': (
1253
+ iso_stdlib_const_identifiers,
1254
+ ),
1255
+
1256
+ # Standard Library Constants for XDS Modula-2
1257
+ 'm2iso+xds': (
1258
+ iso_stdlib_const_identifiers,
1259
+ ),
1260
+ }
1261
+
1262
+ # M e t h o d s
1263
+
1264
+ # initialise a lexer instance
1265
+ def __init__(self, **options):
1266
+ #
1267
+ # check dialect options
1268
+ #
1269
+ dialects = get_list_opt(options, 'dialect', [])
1270
+ #
1271
+ for dialect_option in dialects:
1272
+ if dialect_option in self.dialects[1:-1]:
1273
+ # valid dialect option found
1274
+ self.set_dialect(dialect_option)
1275
+ break
1276
+ #
1277
+ # Fallback Mode (DEFAULT)
1278
+ else:
1279
+ # no valid dialect option
1280
+ self.set_dialect('unknown')
1281
+ #
1282
+ self.dialect_set_by_tag = False
1283
+ #
1284
+ # check style options
1285
+ #
1286
+ styles = get_list_opt(options, 'style', [])
1287
+ #
1288
+ # use lowercase mode for Algol style
1289
+ if 'algol' in styles or 'algol_nu' in styles:
1290
+ self.algol_publication_mode = True
1291
+ else:
1292
+ self.algol_publication_mode = False
1293
+ #
1294
+ # Check option flags
1295
+ #
1296
+ self.treat_stdlib_adts_as_builtins = get_bool_opt(
1297
+ options, 'treat_stdlib_adts_as_builtins', True)
1298
+ #
1299
+ # call superclass initialiser
1300
+ RegexLexer.__init__(self, **options)
1301
+
1302
+ # Set lexer to a specified dialect
1303
+ def set_dialect(self, dialect_id):
1304
+ #
1305
+ # if __debug__:
1306
+ # print 'entered set_dialect with arg: ', dialect_id
1307
+ #
1308
+ # check dialect name against known dialects
1309
+ if dialect_id not in self.dialects:
1310
+ dialect = 'unknown' # default
1311
+ else:
1312
+ dialect = dialect_id
1313
+ #
1314
+ # compose lexemes to reject set
1315
+ lexemes_to_reject_set = set()
1316
+ # add each list of reject lexemes for this dialect
1317
+ for list in self.lexemes_to_reject_db[dialect]:
1318
+ lexemes_to_reject_set.update(set(list))
1319
+ #
1320
+ # compose reserved words set
1321
+ reswords_set = set()
1322
+ # add each list of reserved words for this dialect
1323
+ for list in self.reserved_words_db[dialect]:
1324
+ reswords_set.update(set(list))
1325
+ #
1326
+ # compose builtins set
1327
+ builtins_set = set()
1328
+ # add each list of builtins for this dialect excluding reserved words
1329
+ for list in self.builtins_db[dialect]:
1330
+ builtins_set.update(set(list).difference(reswords_set))
1331
+ #
1332
+ # compose pseudo-builtins set
1333
+ pseudo_builtins_set = set()
1334
+ # add each list of builtins for this dialect excluding reserved words
1335
+ for list in self.pseudo_builtins_db[dialect]:
1336
+ pseudo_builtins_set.update(set(list).difference(reswords_set))
1337
+ #
1338
+ # compose ADTs set
1339
+ adts_set = set()
1340
+ # add each list of ADTs for this dialect excluding reserved words
1341
+ for list in self.stdlib_adts_db[dialect]:
1342
+ adts_set.update(set(list).difference(reswords_set))
1343
+ #
1344
+ # compose modules set
1345
+ modules_set = set()
1346
+ # add each list of builtins for this dialect excluding builtins
1347
+ for list in self.stdlib_modules_db[dialect]:
1348
+ modules_set.update(set(list).difference(builtins_set))
1349
+ #
1350
+ # compose types set
1351
+ types_set = set()
1352
+ # add each list of types for this dialect excluding builtins
1353
+ for list in self.stdlib_types_db[dialect]:
1354
+ types_set.update(set(list).difference(builtins_set))
1355
+ #
1356
+ # compose procedures set
1357
+ procedures_set = set()
1358
+ # add each list of procedures for this dialect excluding builtins
1359
+ for list in self.stdlib_procedures_db[dialect]:
1360
+ procedures_set.update(set(list).difference(builtins_set))
1361
+ #
1362
+ # compose variables set
1363
+ variables_set = set()
1364
+ # add each list of variables for this dialect excluding builtins
1365
+ for list in self.stdlib_variables_db[dialect]:
1366
+ variables_set.update(set(list).difference(builtins_set))
1367
+ #
1368
+ # compose constants set
1369
+ constants_set = set()
1370
+ # add each list of constants for this dialect excluding builtins
1371
+ for list in self.stdlib_constants_db[dialect]:
1372
+ constants_set.update(set(list).difference(builtins_set))
1373
+ #
1374
+ # update lexer state
1375
+ self.dialect = dialect
1376
+ self.lexemes_to_reject = lexemes_to_reject_set
1377
+ self.reserved_words = reswords_set
1378
+ self.builtins = builtins_set
1379
+ self.pseudo_builtins = pseudo_builtins_set
1380
+ self.adts = adts_set
1381
+ self.modules = modules_set
1382
+ self.types = types_set
1383
+ self.procedures = procedures_set
1384
+ self.variables = variables_set
1385
+ self.constants = constants_set
1386
+ #
1387
+ # if __debug__:
1388
+ # print 'exiting set_dialect'
1389
+ # print ' self.dialect: ', self.dialect
1390
+ # print ' self.lexemes_to_reject: ', self.lexemes_to_reject
1391
+ # print ' self.reserved_words: ', self.reserved_words
1392
+ # print ' self.builtins: ', self.builtins
1393
+ # print ' self.pseudo_builtins: ', self.pseudo_builtins
1394
+ # print ' self.adts: ', self.adts
1395
+ # print ' self.modules: ', self.modules
1396
+ # print ' self.types: ', self.types
1397
+ # print ' self.procedures: ', self.procedures
1398
+ # print ' self.variables: ', self.variables
1399
+ # print ' self.types: ', self.types
1400
+ # print ' self.constants: ', self.constants
1401
+
1402
+ # Extracts a dialect name from a dialect tag comment string and checks
1403
+ # the extracted name against known dialects. If a match is found, the
1404
+ # matching name is returned, otherwise dialect id 'unknown' is returned
1405
+ def get_dialect_from_dialect_tag(self, dialect_tag):
1406
+ #
1407
+ # if __debug__:
1408
+ # print 'entered get_dialect_from_dialect_tag with arg: ', dialect_tag
1409
+ #
1410
+ # constants
1411
+ left_tag_delim = '(*!'
1412
+ right_tag_delim = '*)'
1413
+ left_tag_delim_len = len(left_tag_delim)
1414
+ right_tag_delim_len = len(right_tag_delim)
1415
+ indicator_start = left_tag_delim_len
1416
+ indicator_end = -(right_tag_delim_len)
1417
+ #
1418
+ # check comment string for dialect indicator
1419
+ if len(dialect_tag) > (left_tag_delim_len + right_tag_delim_len) \
1420
+ and dialect_tag.startswith(left_tag_delim) \
1421
+ and dialect_tag.endswith(right_tag_delim):
1422
+ #
1423
+ # if __debug__:
1424
+ # print 'dialect tag found'
1425
+ #
1426
+ # extract dialect indicator
1427
+ indicator = dialect_tag[indicator_start:indicator_end]
1428
+ #
1429
+ # if __debug__:
1430
+ # print 'extracted: ', indicator
1431
+ #
1432
+ # check against known dialects
1433
+ for index in range(1, len(self.dialects)):
1434
+ #
1435
+ # if __debug__:
1436
+ # print 'dialects[', index, ']: ', self.dialects[index]
1437
+ #
1438
+ if indicator == self.dialects[index]:
1439
+ #
1440
+ # if __debug__:
1441
+ # print 'matching dialect found'
1442
+ #
1443
+ # indicator matches known dialect
1444
+ return indicator
1445
+ else:
1446
+ # indicator does not match any dialect
1447
+ return 'unknown' # default
1448
+ else:
1449
+ # invalid indicator string
1450
+ return 'unknown' # default
1451
+
1452
+ # intercept the token stream, modify token attributes and return them
1453
+ def get_tokens_unprocessed(self, text):
1454
+ for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
1455
+ #
1456
+ # check for dialect tag if dialect has not been set by tag
1457
+ if not self.dialect_set_by_tag and token == Comment.Special:
1458
+ indicated_dialect = self.get_dialect_from_dialect_tag(value)
1459
+ if indicated_dialect != 'unknown':
1460
+ # token is a dialect indicator
1461
+ # reset reserved words and builtins
1462
+ self.set_dialect(indicated_dialect)
1463
+ self.dialect_set_by_tag = True
1464
+ #
1465
+ # check for reserved words, predefined and stdlib identifiers
1466
+ if token is Name:
1467
+ if value in self.reserved_words:
1468
+ token = Keyword.Reserved
1469
+ if self.algol_publication_mode:
1470
+ value = value.lower()
1471
+ #
1472
+ elif value in self.builtins:
1473
+ token = Name.Builtin
1474
+ if self.algol_publication_mode:
1475
+ value = value.lower()
1476
+ #
1477
+ elif value in self.pseudo_builtins:
1478
+ token = Name.Builtin.Pseudo
1479
+ if self.algol_publication_mode:
1480
+ value = value.lower()
1481
+ #
1482
+ elif value in self.adts:
1483
+ if not self.treat_stdlib_adts_as_builtins:
1484
+ token = Name.Namespace
1485
+ else:
1486
+ token = Name.Builtin.Pseudo
1487
+ if self.algol_publication_mode:
1488
+ value = value.lower()
1489
+ #
1490
+ elif value in self.modules:
1491
+ token = Name.Namespace
1492
+ #
1493
+ elif value in self.types:
1494
+ token = Name.Class
1495
+ #
1496
+ elif value in self.procedures:
1497
+ token = Name.Function
1498
+ #
1499
+ elif value in self.variables:
1500
+ token = Name.Variable
1501
+ #
1502
+ elif value in self.constants:
1503
+ token = Name.Constant
1504
+ #
1505
+ elif token in Number:
1506
+ #
1507
+ # mark prefix number literals as error for PIM and ISO dialects
1508
+ if self.dialect not in ('unknown', 'm2r10', 'objm2'):
1509
+ if "'" in value or value[0:2] in ('0b', '0x', '0u'):
1510
+ token = Error
1511
+ #
1512
+ elif self.dialect in ('m2r10', 'objm2'):
1513
+ # mark base-8 number literals as errors for M2 R10 and ObjM2
1514
+ if token is Number.Oct:
1515
+ token = Error
1516
+ # mark suffix base-16 literals as errors for M2 R10 and ObjM2
1517
+ elif token is Number.Hex and 'H' in value:
1518
+ token = Error
1519
+ # mark real numbers with E as errors for M2 R10 and ObjM2
1520
+ elif token is Number.Float and 'E' in value:
1521
+ token = Error
1522
+ #
1523
+ elif token in Comment:
1524
+ #
1525
+ # mark single line comment as error for PIM and ISO dialects
1526
+ if token is Comment.Single:
1527
+ if self.dialect not in ('unknown', 'm2r10', 'objm2'):
1528
+ token = Error
1529
+ #
1530
+ if token is Comment.Preproc:
1531
+ # mark ISO pragma as error for PIM dialects
1532
+ if value.startswith('<*') and \
1533
+ self.dialect.startswith('m2pim'):
1534
+ token = Error
1535
+ # mark PIM pragma as comment for other dialects
1536
+ elif value.startswith('(*$') and \
1537
+ self.dialect != 'unknown' and \
1538
+ not self.dialect.startswith('m2pim'):
1539
+ token = Comment.Multiline
1540
+ #
1541
+ else: # token is neither Name nor Comment
1542
+ #
1543
+ # mark lexemes matching the dialect's error token set as errors
1544
+ if value in self.lexemes_to_reject:
1545
+ token = Error
1546
+ #
1547
+ # substitute lexemes when in Algol mode
1548
+ if self.algol_publication_mode:
1549
+ if value == '#':
1550
+ value = u'≠'
1551
+ elif value == '<=':
1552
+ value = u'≤'
1553
+ elif value == '>=':
1554
+ value = u'≥'
1555
+ elif value == '==':
1556
+ value = u'≡'
1557
+ elif value == '*.':
1558
+ value = u'•'
1559
+
1560
+ # return result
1561
+ yield index, token, value