;ELC ;;; Compiled ;;; in Emacs version 27.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\303\304\305\"\207" [require ob org-macs add-to-list org-babel-tangle-lang-exts ("python" . "py")] 3) (defvar org-babel-default-header-args:python nil) (byte-code "\300\301\302\303\304DD\305\306\307\310\311\312\313\314\315& \210\300\316\302\303\317DD\320\312\313\306\307\310\321\314\322& \210\300\323\302\303\324DD\325\312\313\306\307\310\326\314\315& \210\300\327\302\303\330DD\331\312\313\306\307\310\332\314\322& \207" [custom-declare-variable org-babel-python-command funcall function #[0 "\300\207" [#1="python"] 1 #1#] "Name of the command for executing Python code." :version "24.4" :package-version (Org . "8.0") :group org-babel :type string org-babel-python-mode #[0 "\300\301!\203\301\207\302\207" [featurep python-mode python] 2] "Preferred python mode for use in running python interactively.\nThis will typically be either `python' or `python-mode'." (Org . "8.0") symbol org-babel-python-hline-to #[0 "\300\207" [#2="None"] 1 #2#] "Replace hlines in incoming tables with this when translating to python." (Org . "8.0") org-babel-python-None-to #[0 "\300\207" [hline] 1] "Replace `None' in python tables with this before returning." (Org . "8.0")] 12) #@120 Execute a block of Python code with Babel. This function is called by `org-babel-execute-src-block'. (fn BODY PARAMS) (defalias 'org-babel-execute:python #[514 "\301\236A\206\302\303\236A!\304\236A\305\236A\211\306=\205&?\205&\307\236A\310\236A\311\2038\312\313\"\2029\314P\315 !#\316%\317\320\321 \236A\322\f\236A\"\320\323\f\236A\324 \236A\"#)\207" [org-babel-python-command :python org-babel-python-initiate-session :session :result-params :result-type value :return :preamble org-babel-expand-body:generic format "\nreturn %s" "" org-babel-variable-assignments:python org-babel-python-evaluate org-babel-reassemble-table org-babel-pick-name :colname-names :colnames :rowname-names :rownames] 16 (#$ . 1615)]) #@127 Prepare SESSION according to the header arguments in PARAMS. VARS contains resolved variable references. (fn SESSION PARAMS) (defalias 'org-babel-prep-session:python #[514 "\301!\302!\303!\204\304\305\"\210\306 \307\310\311\312\313!\314\"\315$\216rq\210\212\316\317\307\320\321\312\313!\322\"\315\323%\"\210,\210\207" [comint-input-filter org-babel-python-initiate-session org-babel-variable-assignments:python org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data make-byte-code 0 "\301\300\302\"\207" vconcat vector [set-match-data evaporate] 3 #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] mapc 257 "\301\210\211c\210\302 \210\303\300!\207" [1 comint-send-input org-babel-comint-wait-for-output] "\n\n(fn VAR)"] 12 (#$ . 2372)]) #@51 Load BODY into SESSION. (fn SESSION BODY PARAMS) (defalias 'org-babel-load-session:python #[771 "\300 \301\302\303\304\305!\306\"\307$\216\310\"r\211q\210\311\312p!!b\210\313!c\210)\211\262)\207" [current-window-configuration make-byte-code 0 "\301\300!\207" vconcat vector [set-window-configuration] 2 org-babel-prep-session:python process-mark get-buffer-process org-babel-chomp] 10 (#$ . 3160)]) #@82 Return a list of Python statements assigning the block's variables. (fn PARAMS) (defalias 'org-babel-variable-assignments:python #[257 "\300\301\302!\"\207" [mapcar #[257 "\300\301@\302A!#\207" [format "%s=%s" org-babel-python-var-to-python] 6 "\n\n(fn PAIR)"] org-babel--get-vars] 5 (#$ . 3571)]) #@162 Convert an elisp value to a python variable. Convert an elisp value, VAR, into a string of python source code specifying a variable of the same value. (fn VAR) (defalias 'org-babel-python-var-to-python #[257 "\211<\203\301\302\303\304#\305Q\207\211\306=\203\207\307;\203'\310\311\"\203'\312\202(\313;\2033\314!\2024\"\207" [org-babel-python-hline-to "[" mapconcat org-babel-python-var-to-python ", " "]" hline format string-match "[\n ]" "\"\"%S\"\"" "%S" substring-no-properties] 6 (#$ . 3880)]) #@192 Convert RESULTS into an appropriate elisp value. If the results look like a list or tuple, then convert them into an Emacs-lisp table, otherwise return the results as a string. (fn RESULTS) (defalias 'org-babel-python-table-or-string #[257 "\300!\211<\203\301\302\"\202\211\207" [org-babel-script-escape mapcar #[257 "\211\301=\203\207\207" [org-babel-python-None-to None] 3 "\n\n(fn EL)"]] 5 (#$ . 4401)]) (defvar org-babel-python-buffers '((:default . "*Python*"))) #@58 Return the buffer associated with SESSION. (fn SESSION) (defalias 'org-babel-python-session-buffer #[257 "\301\"A\207" [org-babel-python-buffers assoc] 4 (#$ . 4885)]) #@16 (fn SESSION) (defalias 'org-babel-python-with-earmuffs #[257 "\211;\203 \211\202 \300\301\"\302\303\304#\305\230\203&\302\211GS\"\305\230\203&\211\202*\300\306\"\207" [format "%s" substring 0 1 "*" "*%s*"] 6 (#$ . 5062)]) #@16 (fn SESSION) (defalias 'org-babel-python-without-earmuffs #[257 "\211;\203 \211\202 \300\301\"\302\303\304#\305\230\203,\302\211GS\"\305\230\203,\302\304GS#\202-\211\207" [format "%s" substring 0 1 "*"] 6 (#$ . 5301)]) #@159 Initiate a python session. If there is not a current inferior-process-buffer in SESSION then create. Return the initialized session. (fn &optional SESSION) (defalias 'org-babel-python-initiate-session-by-key #[256 "\306!\210\307 \310\311\312\313\314!\315\"\316$\216\203\317!\202\320\321! \322>\203,\n\323P\202-\n\324=\203\\\325\326!\203\\\327\330 \"\204G\326!\210\202\227\204P\331!\262\332!\326!\210)\202\227\333=\203\223\325\334!\203\223\335 !\210\203~\336!\203~\337\340\341#\202\203\342\343!P\211'\334 \210\331!\262)\210\202\227\344\345!\210B\346(\"B(\266\203)\207" [org-babel-python-mode system-type org-babel-python-command emacs-version python-shell-buffer-name py-default-interpreter require current-window-configuration make-byte-code 0 "\301\300!\207" vconcat vector [set-window-configuration] 2 intern :default org-babel-python-session-buffer (cygwin windows-nt ms-dos) " -i" python fboundp run-python version< "24.1" org-babel-python-with-earmuffs org-babel-python-without-earmuffs python-mode py-shell py-toggle-shells buffer-live-p replace-regexp-in-string "^\\*\\([^*]+\\)\\*$" "\\1" "Python-" symbol-name error "No function available for running an inferior Python" assq-delete-all py-which-bufname org-babel-python-buffers] 9 (#$ . 5539)]) #@84 Create a session named SESSION according to PARAMS. (fn &optional SESSION PARAMS) (defalias 'org-babel-python-initiate-session #[512 "\300\230?\205\f\301\302!!\207" ["none" org-babel-python-session-buffer org-babel-python-initiate-session-by-key] 5 (#$ . 6847)]) #@53 A string to indicate that evaluation has completed. (defvar org-babel-python-eoe-indicator "'org_babel_python_eoe'" (#$ . 7120)) (defconst org-babel-python-wrapper-method "\ndef main():\n%s\n\nopen('%s', 'w').write( str(main()) )") (defconst org-babel-python-pp-wrapper-method "\nimport pprint\ndef main():\n%s\n\nopen('%s', 'w').write( pprint.pformat(main()) )") (defconst org-babel-python--exec-tmpfile "__org_babel_python_fname = '%s'; __org_babel_python_fh = open(__org_babel_python_fname); exec(compile(__org_babel_python_fh.read(), __org_babel_python_fname, 'exec')); __org_babel_python_fh.close()") #@95 Evaluate BODY as Python code. (fn SESSION BODY &optional RESULT-TYPE RESULT-PARAMS PREAMBLE) (defalias 'org-babel-python-evaluate #[1282 "\203 \300$\207\301$\207" [org-babel-python-evaluate-session org-babel-python-evaluate-external-process] 10 (#$ . 7732)]) #@265 Evaluate BODY in external python process. If RESULT-TYPE equals `output' then return standard output as a string. If RESULT-TYPE equals `value' then return the value of the last statement in BODY, as elisp. (fn BODY &optional RESULT-TYPE RESULT-PARAMS PREAMBLE) (defalias 'org-babel-python-evaluate-external-process #[1025 "\303\267\202^\304\211\205\305Q\"\202_\306\307!\304\211\205 \305\310\311\235\203, \202-\n\312\313\314\315\316\317\203=\320\202>\321\322\317\323\322##\266\202!\324\"\305#\325\326\"#Q\"\210\327!\262\202_\316\330\235?\205\305\331\235\204\251\332\235\204\251\333\235\204\251\334\235\204\251\311\235\204\251\335\235\204\251\336\235\204\243\337\235\204\243\340\235\204\243\341\235\203\255\342\235\204\255\202\305\343\316\317\203\271\320\202\272\321\322\317\323\322##\266\202!\262\207" [org-babel-python-command org-babel-python-pp-wrapper-method org-babel-python-wrapper-method #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (output 6 value 21)) org-babel-eval "\n" org-babel-temp-file "python-" format "pp" mapconcat #[257 "\300\301\"\207" [format " %s"] 4 "\n\n(fn LINE)"] split-string org-remove-indentation nil replace-regexp-in-string "\\`\\([ ]*\n\\)+" "\\`[ \n ]+" "" "[ \n ]+\\'" "[ \n]" org-babel-process-file-name noquote org-babel-eval-read-file "none" "scalar" "verbatim" "html" "code" "file" "output" "raw" "org" "drawer" "table" org-babel-python-table-or-string] 24 (#$ . 8009)]) #@266 Pass BODY to the Python process in SESSION. If RESULT-TYPE equals `output' then return standard output as a string. If RESULT-TYPE equals `value' then return the value of the last statement in BODY, as elisp. (fn SESSION BODY &optional RESULT-TYPE RESULT-PARAMS) (defalias 'org-babel-python-evaluate-session #[1026 "\306\307\310C\311\312\267\202\310\313\314\315\316#)\266\203\203P\317\320!\211\321\322!\323\310\324\325\326!\327\"\330$\216r\211q\210 c\210)r\211q\210\331\314\211\314\310%\210*\266\332 \"\262\202R\333\334\335\336\f!\204b\337\340 \"\210\341 \323\310\342\325\326!\343\"\344$\216r\fq\210\212\345\346C\323\347\350\325\326!\351\"\352\353% B\314\354\355p!!b\210`d{\262|\266 \n #\210\n \210\n \210\fc\210\n \210 b\210\212\356\357\f!\314\315#\205\312\356@\314\315#)\204\327\360\355p!!\210\202\266\354\355p!!b\210\211c\210\203\316\361\362\363\357 \206\361\346!#\242\"\203\364\242\310\225\"\240\210\365\242@\")\266\202,\262\330\"\362#\262\202\311\317\320!\336 !\204'\337\340\n\"\210\341 \323\310\342\325\326!\366\"\344$\216r q\210\212\367\346C\323\347\350\325\326!\351\"\352\353% B\314\354\355p!!b\210`d{\262|\266\314A #\210\370\f\235#\210 \210 \210\fc\210 \210) b\210\212\356\357\f!\314\315#\205\235\356@\314\315#)\204\252\360\355p!!\210\202\211\354\355p!!b\210\211c\210\365\242@\"\210)\266,\210\371!\262\202\311\314\364\f\372\373#\230?\2057\374\235?\2055\375\235\204,\376\235\204,\377\235\204,\201B\235\204,\370\235\204,\201C\235\204,\201D\235\204$\201E\235\204$\201F\235\204$\201G\235\2030\201H\235\2040\2025\201I!\262\207" [inhibit-changing-match-data org-babel-python--exec-tmpfile comint-input-filter comint-output-filter-functions org-babel-python-eoe-indicator comint-last-input-end #[0 "\300\301\302\"\210\303\304\305\"\207" [comint-send-input nil t sleep-for 0 5] 3] #[771 "\300\301\302\303\304\305!\306\"\307\310%\203\311\312\313\314\315\"\"D\202(\312\316\314\315\"\"C\"\207" [mapc make-byte-code 257 "\211c\210\300 \207" vconcat vector #2=[] 2 "\n\n(fn STATEMENT)" "import pprint" format "open('%s', 'w').write(pprint.pformat(_))" org-babel-process-file-name noquote "open('%s', 'w').write(str(_))"] 11 "\n\n(fn SEND-WAIT TMP-FILE PP)"] 0 #[771 "\300\301\"\211\2038\211@\302\303\"\211\203&\211\242W\203\304c\210 \210\240\210\202*\305\240\210\210\211c\210 \210A\266\202\202\210 \207" [split-string "[ \n]" string-match "\\S-" #1="" 0] 8 "\n\n(fn SEND-WAIT LAST-INDENT BODY)"] #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (output 11 value 279)) ".\n+." nil t string-match org-babel-temp-file "python-" generate-new-buffer " *temp file*" make-byte-code "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 write-region format mapconcat org-trim butlast org-babel-comint-buffer-livep error "Buffer %s does not exist or has no process" match-data "\301\300\302\"\207" [set-match-data evaporate] 3 #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] #1# 257 "\300\211\242P\240\207" #2# 4 "\n\n(fn TEXT)" process-mark get-buffer-process re-search-forward regexp-quote accept-process-output replace-regexp-in-string "\n" "[ \n]+" substring split-string [set-match-data evaporate] #[257 "\300\207" [nil] 2 "\n\n(fn INPUT)"] "pp" org-babel-eval-read-file 1 -1 "none" "scalar" "verbatim" "html" comint-prompt-regexp comint-process-echoes "code" "file" "output" "raw" "org" "drawer" "table" org-babel-python-table-or-string] 21 (#$ . 9533)]) #@52 Strip \='s from around Python string. (fn STRING) (defalias 'org-babel-python-read-string #[257 "\300\301\"\203\302\301\"\203\303\304\305#\207\207" [string-prefix-p "'" string-suffix-p substring 1 -1] 5 (#$ . 13110)]) (provide 'ob-python)