Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
####### # # E-scripts on Python. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at <http://angg.twu.net/e/python.e> # or at <http://angg.twu.net/e/python.e.html>. # See also <http://angg.twu.net/emacs.html>, # <http://angg.twu.net/.emacs[.html]>, # <http://angg.twu.net/.zshrc[.html]>, # <http://angg.twu.net/escripts.html>, # and <http://angg.twu.net/>. # ####### # «.python-bullseye» (to "python-bullseye") # «.python-wheezy» (to "python-wheezy") # «.python3-wheezy» (to "python3-wheezy") # «.python-on-squeeze» (to "python-on-squeeze") # «.python-on-lenny» (to "python-on-lenny") # «.python-base» (to "python-base") # «.python-3.9.9» (to "python-3.9.9") # «.python-examples» (to "python-examples") # «.pyex» (to "pyex") # «.pydb» (to "pydb") # «.pdb» (to "pdb") # «.python-tk» (to "python-tk") # «.tk» (to "tk") # «.tkinter» (to "tkinter") # «.PYTHONSTARTUP» (to "PYTHONSTARTUP") # «.open» (to "open") # «.execfile» (to "execfile") # «.os.path.split» (to "os.path.split") # «.ee-for-python» (to "ee-for-python") # «.2to3» (to "2to3") # «.str.format» (to "str.format") # «.eechannel-python» (to "eechannel-python") # «.sigusr1» (to "sigusr1") # «.python-docutils» (to "python-docutils") # «.rst» (to "rst") # «.diveintopython» (to "diveintopython") # «.closures» (to "closures") # «.python-apt» (to "python-apt") # «.python-apt-deb-src» (to "python-apt-deb-src") # «.python-opengl» (to "python-opengl") # «.pymacs» (to "pymacs") # «.python-sphinx» (to "python-sphinx") # «.sphinx-build» (to "sphinx-build") # «.sphinx-git» (to "sphinx-git") # «.pygame» (to "pygame") # «.modules» (to "modules") # «.module.__file__» (to "module.__file__") # «.tostring» (to "tostring") # «.scipy» (to "scipy") # «.matplotlib» (to "matplotlib") # «.matplotlib-examples» (to "matplotlib-examples") # «.matplotlib-rougier» (to "matplotlib-rougier") # «.numpy» (to "numpy") # «.scipy-lectures» (to "scipy-lectures") # «.ipython» (to "ipython") # «.ameliabot» (to "ameliabot") # «.rends-tutorial» (to "rends-tutorial") # «.environment» (to "environment") # «.scikits» (to "scikits") # «.pyobjects» (to "pyobjects") # «.emacs-ipython-notebook» (to "emacs-ipython-notebook") # «.audio» (to "audio") # «.pprint» (to "pprint") # «.sympy» (to "sympy") # «.spyder» (to "spyder") # «.idle» (to "idle") # «.felipe-pinheiro» (to "felipe-pinheiro") # «.scipy-wav» (to "scipy-wav") # «.pip» (to "pip") # «.pip3-upgrade» (to "pip3-upgrade") # «.pip-as-root» (to "pip-as-root") # «.pip-from-git» (to "pip-from-git") # «.tox» (to "tox") # «.facebook-sdk» (to "facebook-sdk") # «.textwrap» (to "textwrap") # «.easyhtmlparser» (to "easyhtmlparser") # «.oilercode» (to "oilercode") # «.faceutils» (to "faceutils") # «.faceutils-wrap» (to "faceutils-wrap") # «.poetry» (to "poetry") # «.pypi» (to "pypi") # «.requests» (to "requests") # «.virtualenv» (to "virtualenv") # «.string.gsub.old» (to "string.gsub.old") # «.string.gsub» (to "string.gsub") # «.encoding» (to "encoding") # «.scope» (to "scope") # «.import» (to "import") # «.inspect» (to "inspect") # «.re» (to "re") # «.re.sub» (to "re.sub") # «.u8_to_l1» (to "u8_to_l1") # «.dict» (to "dict") # «.print» (to "print") # «.tuples» (to "tuples") # «.tut-tuples» (to "tut-tuples") # «.tut-def» (to "tut-def") # «.def» (to "def") # «.comprehension» (to "comprehension") # «.multiline-comments» (to "multiline-comments") # «.lambda» (to "lambda") # «.after» (to "after") # «.graphics.py» (to "graphics.py") # «.python-for-cs1» (to "python-for-cs1") # «.turtle» (to "turtle") # «.help» (to "help") # «.books» (to "books") # «.popen» (to "popen") # «.bytes» (to "bytes") # «.split» (to "split") # «.vararg-functions» (to "vararg-functions") # «.pandas» (to "pandas") # «.elpy» (to "elpy") # «.naufuto» (to "naufuto") # «.hy» (to "hy") # «.codespell» (to "codespell") # «.pygments» (to "pygments") # «.plot3D» (to "plot3D") # «.dictionaries» (to "dictionaries") # «.fsmunoz-k8s-diagrams» (to "fsmunoz-k8s-diagrams") # «.all-the-builtins» (to "all-the-builtins") # «.doctest» (to "doctest") # «.breakpoint» (to "breakpoint") # (defun u () (interactive) (find-escript-upload-links "python" "u8_to_l1")) # (to "u8_to_l1") # (find-zsh "installeddebs | sort | grep python") # (find-zsh "installeddebs | sort | grep python | awk -F _ '{print $1}'") ipython3 ipython libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libpython2.7 libpython3-stdlib libpython3.5-minimal libpython3.5-stdlib libpython3.5 python-central python-doc python-matplotlib-data python-matplotlib-doc python-matplotlib python-minimal python-sympy-doc python-sympy python-tk python2.7-doc python2.7-minimal python2.7 python3-apt python3-debian python3-doc python3-examples python3-matplotlib python3-minimal python3-tk python3.5-doc python3.5-examples python3.5-minimal python3.5 python3 python * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) apti python-matplotlib python-matplotlib-doc python3-matplotlib apti python-doc python3-doc apti python-examples python3-examples apti python-pip python3-pip pip install --upgrade pip pip3 install --upgrade pip ;; (find-fline "/usr/share/doc/python2.7/html/_sources/") (code-c-d "python27docsrc" "/usr/share/doc/python2.7/html/_sources/") ;; (find-python27docsrcfile "") ##### # # python-bullseye # 2021aug31 # ##### # «python-bullseye» (to ".python-bullseye") # (find-status "python3.9-doc") # (find-vldifile "python3.9-doc.list") # (find-udfile "python3.9-doc/") # (find-status "python3.9-examples") # (find-vldifile "python3.9-examples.list") # (find-udfile "python3.9-examples/") # (find-status "python3-tk") # (find-vldifile "python3-tk:amd64.list") # (find-udfile "python3-tk/") # file:///usr/share/doc/python3.9/html/index.html # file:///usr/share/doc/python3.9/html/library/index.html # file:///usr/share/doc/python3.9/html/library/inspect.html # file:///usr/share/doc/python3.9/html/tutorial/index.html # file:///usr/share/doc/python3.9/html/tutorial/modules.html # file:///usr/share/doc/python3.9/html/tutorial/classes.html * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rv /tmp/pyexamples/ mkdir /tmp/pyexamples/ cd /tmp/pyexamples/ cp -Rv /usr/share/doc/python3.9/examples/* /tmp/pyexamples/ # (find-fline "/tmp/pyexamples/") # (find-fline "/usr/share/doc/python3.9/examples/pynche/") # (find-sh "apt-file search python | grep tkinter") # (find-sh "apt-file search python | grep turtle") cd /usr/share/doc/python3.9/examples/pynche/ ./pynche # (find-fline "/usr/lib/python3.9/turtledemo/") # (find-fline "/usr/lib/python3.9/turtledemo/fractalcurves.py") cd /usr/lib/python3.9/turtledemo/ ./fractalcurves.py python3 -m tkinter ##### # # python on wheezy # 2014sep08 # ##### # «python-wheezy» (to ".python-wheezy") # (find-zsh "availabledebs | sort | grep python") # (find-zsh "availabledebs | sort | grep python | egrep 'dev|doc'") # (find-zsh "installeddebs | sort | grep python") # (find-status "python-dev") # (find-vldifile "python-dev.list") # (find-udfile "python-dev/") # (find-status "python-doc") # (find-vldifile "python-doc.list") # (find-udfile "python-doc/") # (find-status "python-examples") # (find-vldifile "python-examples.list") # (find-udfile "python-examples/") # (find-status "python2.7-dev") # (find-vldifile "python2.7-dev.list") # (find-udfile "python2.7-dev/") # (find-status "python2.7-doc") # (find-vldifile "python2.7-doc.list") # (find-vldifile "python2.7-doc.list" "/usr/share/info/") # (find-udfile "python2.7-doc/") # file:///usr/share/doc/python2.7/html/c-api/tuple.html # file:///usr/share/doc/python2.7/html/library/ # file:///usr/share/doc/python2.7/html/library/stdtypes.html#bltin-file-objects # file:///usr/share/doc/python2.7/html/library/functions.html#open # «python3-wheezy» (to ".python3-wheezy") # (find-status "python3") # (find-vldifile "python3.list") # (find-udfile "python3/") # (find-status "python3.5") # (find-vldifile "python3.5.list") # (find-udfile "python3.5/") # (find-status "python3.7-doc") # (find-vldifile "python3.7-doc.list") # (find-udfile "python3.7-doc/") # (find-status "python3.7-examples") # (find-vldifile "python3.7-examples.list") # (find-udfile "python3.7-examples/") # file:///usr/share/doc/python3.5/html/index.html # (find-status "python3-examples") # (find-vldifile "python3-examples.list") # (find-udfile "python3-examples/") # (find-status "python3.5-examples") # (find-vldifile "python3.5-examples.list") # (find-udfile "python3.5-examples/") ##### # # python on squeeze # 2012mar30 # ##### # «python-on-squeeze» (to ".python-on-squeeze") # (find-zsh "availabledebs | sort | grep python") # (find-zsh "availabledebs | sort | grep python | egrep 'dev|doc'") # (find-zsh "dmissing python | grep -e .info") ##### # # python on lenny # 2010mar09 # ##### # «python-on-lenny» (to ".python-on-lenny") # (find-angg ".emacs" "python") # (find-zsh "availabledebs | sort | grep python") # (find-zsh "availabledebs | sort | grep python | egrep 'dev|doc'") # (find-zsh "dmissing python | grep -e .info") apti python python-doc python-examples python-mode python-dev apti python python-doc python-examples python-dev apti python2.5-doc # (find-status "python-dev") # (find-vldifile "python-dev.list") # (find-udfile "python-dev/") # (find-status "python-doc") # (find-vldifile "python-doc.list") # (find-udfile "python-doc/") # (find-status "python-examples") # (find-vldifile "python-examples.list") # (find-udfile "python-examples/") # (find-status "python2.6-dev") # (find-vldifile "python2.6-dev.list") # (find-udfile "python2.6-dev/") # (find-status "python2.6-doc") # (find-vldifile "python2.6-doc.list") # (find-vldifile "python2.6-doc.list" "/usr/share/info/") # (find-udfile "python2.6-doc/") # (find-vldifile "python2.5-doc.list") # (find-vldifile "python2.5-doc.list" "/usr/share/info/") # (find-udfile "python2.5-doc/") # (find-udfile "python2.6/html/_sources/faq/") # (find-udfile "python2.6/html/_sources/faq/design.txt") # (find-udfile "python2.6/html/_sources/tutorial/") # (find-status "python2.6-examples") # (find-vldifile "python2.6-examples.list") # (find-udfile "python2.6-examples/") ##### # # Installing and finding the basic docs # 2000may09 # ##### Pgrepp m/python/i |& tee ~/o # (find-fline "~/o") apti python-base python-doc python-examples python-elisp python-dev \ pydb python-pygresql # (find-vldifile "python-base.list") # (find-vldifile "python-dev.list") # (find-vldifile "python-doc.list") # (find-vldifile "python-elisp.list") # (find-vldifile "python-examples.list") # (find-fline "/usr/doc/python-base/") # (find-fline "/usr/doc/python-dev/") # (find-fline "/usr/doc/python-doc/") # (find-fline "/usr/doc/python-elisp/") # (find-fline "/usr/doc/python-examples/") # (find-node "(python-tut)Top") # (find-node "(python-tut)Numbers") # (find-node "(python-lib)Top") # (find-node "(python-ref)Top") # (find-pytutnode "Top") # (find-pytutnode "Defining Clean-up Actions") # (find-pytutnode "A Word About Terminology" "if a function modifies") # (find-pytutnode "Python Scopes and Name Spaces" "three nested") # (find-pytutnode "Method Objects") # (find-pytutnode "Defining Functions") # (find-angg "EXPECT/eeg") * (eepitch-python) * (eepitch-kill) * (eepitch-python) class foo: x = 2 def f(_, x): return x*20 foo a = foo() a a.x a.f a.f(a.x) ##### # # python-base # 2000may25 # ##### # «python-base» (to ".python-base") # (find-status "python-base") # (find-vldifile "python-base.list") # (find-eeman "1 python") # (find-fline "/usr/doc/python-base/") # (find-fline "/usr/doc/python/") # (find-fline "/usr/doc/python/NEWS.gz") # (find-fline "/usr/doc/python/HISTORY.gz") # (find-fline "/usr/doc/python/BLURB") # (find-fline "/usr/doc/python/sample.postinst") # (find-fline "/usr/doc/python/sample.prerm") # (find-fline "/usr/doc/python/README.maintainers") # (find-fline "/usr/doc/python/README.dbm") # (find-fline "/usr/doc/python/TODO.Debian.gz") # (find-fline "/usr/doc/python/copyright") # (find-fline "/usr/doc/python/README.gz") # (find-fline "/usr/doc/python/ACKS.gz") # (find-fline "/usr/doc/python/README.Debian.gz") laf /usr/bin/python laf /usr/bin/python1.5 # (find-pylibfile "lib-dynload/") laf /usr/lib/libpython1.5.so.0.0 # (find-fline "/usr/lib/menu/python-base") # (find-fline "/usr/lib/python1.4/") ##### # # python and postgresql # 2000may12 # ##### # (find-status "python-pygresql") # (find-vldifile "python-pygresql.list") # (find-fline "/usr/doc/python-pygresql/") # (find-fline "/usr/doc/python-pygresql/README.gz" "connect -") # (find-fline "/usr/doc/python-pygresql/tutorial/") # (find-pylibfile "site-packages/pg.py") # (find-pylibfile "site-packages/pgsqldb.py") # (find-vldifile "postgresql.list") # (find-fline "/usr/doc/postgresql/") # (find-vldifile "postgresql-client.list") # (find-fline "/usr/doc/postgresql-client/") # (find-fline "/var/lib/postgres/") (w3-open-local "/snarf/http/www.idi.ntnu.no/~mlh/python/instant.html") (find-fline "$S/http/www.python.org/doc/essays/metaclasses/meta-vladimir.txt") (find-file "/snarf/http/www.idi.ntnu.no/~mlh/python/quicksort.py") (find-fline "$S/http/www.strout.net/python/pattern.py") (find-fline "$S/http/www.strout.net/python/tabfix.py") # (find-w3 "/usr/doc/python/examples/Demo/metaclasses/index.html") # (find-fline "/usr/lib/python1.5/cgi.py") # (find-node "(python-ref)import statement") # (find-pyrefnode "import statement") # (find-pyrefnode "Module Index") # (find-pyrefnode "standard type hierarchy") # (find-pyrefnode "Objects") # (find-pytutnode "A First Look at Classes") # (find-pytutnode "Python Scopes and Name Spaces") # (find-pyrefnode "Keywords") # (find-pyrefnode "standard type hierarchy" "`Classes'") #* cat > $EEG <<'---' * (eepitch-python) * (eepitch-kill) * (eepitch-python) class A: attr1 = "Hello" # an attribute of A def method1(self, *args): pass # method1 of A def method2(self, *args): pass # method2 of A A # What is A? a = A() # 'a' is the 1st instance of A a # What is 'a'? b = A() # 'b' is another instance of A b # What is 'b'? a == b # Is 'a' the same object as 'b'? a.__class__ # What is the class of 'a'? b.__class__ # What is the class of 'b'? a.__class__ == b.__class__ # Is it really the same class A? class B(A): # B inherits A's properties attr2 = "World" # additional attr2 def method2(self, arg1): pass # method2 is redefined def method3(self, *args): pass # additional method3 B # What is B? B == A # Is B the same class as A? A.__bases__ # Does A have any superclasses? B.__bases__ # Does B have any superclasses? B.__bases__[0] == A # Is it really the class A? * (eepitch-python) * (eepitch-kill) * (eepitch-python) import sys sys.__dict__ type(sys.__dict__) type(sys) type(type) `sys.__dict__` type(`sys.__dict__`) s = lambda n: n + 1 s(2) s type(s) `s` # (find-pyrefnode "Basic customization") # (find-pyrefnode "Code blocks") # (find-pyrefnode "Dictionary displays") # (find-pyrefnode "String conversions") # (find-pyrefnode "Boolean operations" "lambda x") # (find-pyrefnode "Summary") # (find-pyrefnode "Assignment statements" "target list") # (find-pyrefnode "exec statement") # (find-pyrefnode "Function definitions") # (find-pyrefnode "Class definitions") # (find-pylibnode "More String Operations") #* cat > $EEG <<'---' vars() import sys vars() "foo %d %d" % (2, 3) "foo %s %d" % (2, 3) "foo %s %d" % ("2", "3") "foo %(a)d %(b)d" % {"b":2, "a":3} --- eeg python #* ##### # # python-3.9.9 # 2022mar22 # ##### # «python-3.9.9» (to ".python-3.9.9") # https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-fline "~/bigsrc/Python-3.9.9/") rm -Rv ~/bigsrc/Python-3.9.9/ mkdir ~/bigsrc/Python-3.9.9/ tar -C ~/bigsrc/ -xvzf $S/https/www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz cd ~/bigsrc/Python-3.9.9/ # (code-c-d "python399" "~/bigsrc/Python-3.9.9/") # (find-python399file "") # (find-python399sh "find * | sort") # (find-python399file "Doc/library/inspect.rst") # (find-python399file "Doc/library/inspect.rst" "function:: isawaitable") # (find-python399file "Doc/library/inspect.rst" "def gen():") # file:///usr/share/doc/python3.9/html/library/inspect.html # file:///usr/share/doc/python3.9/html/library/inspect.html#inspect.isawaitable ##### # # python-examples # 2000may25 # ##### # «python-examples» (to ".python-examples") # «pyex» (to ".pyex") # (find-status "python-examples") # (find-vldifile "python-examples.list") # (find-pylibnode "regex") # (find-pylibnode "re") # (find-pylibnode "Matching vs. Searching") # (find-pyrefnode "Miscellaneous Index") #* cat > $EEG <<'---' import re d = re.__dict__ d.keys d.keys() d.__methods__ re.__name__ re.__file__ re.__builtins__.keys() [].__methods__ --- eeg python #* cat > $EEG <<'---' [].__methods__ import re,string string.join(["a", "b"]) string.join(["a", "b", "c"], "--") --- eeg python #* cat > $EEG <<'---' [].__methods__ import re, string string.join(["a", "b"]) string.join(["a", "b", "c"], "--") string.__dict__.keys() dir(string) join string.__dict__.keys().sort.__doc__ --- eeg python #* #* cat > $EEG <<'---' a = [2, 4, 1, 3] a.sort() a d = {1:2, 5:6, 3:4} d --- eeg python #* a.join # (find-pytutnode "for Statements") # (find-pytutnode "dir Function") # (find-pylibnode "Mutable Sequence Types") cd /usr/share/info/ zcat python-ref.info{,-?}.gz > /tmp/python-ref zcat python-lib.info{,-?,-??}.gz > /tmp/python-lib zcat python-tut.info{,-?}.gz > /tmp/python-tut # (find-status "htmlgen") # (find-vldifile "htmlgen.list") # (find-fline "/usr/doc/htmlgen/") # (find-status "idle") # (find-vldifile "idle.list") # (find-fline "/usr/doc/idle/") # (find-status "python-bobo") # (find-vldifile "python-bobo.list") # (find-fline "/usr/doc/python-bobo/") # (find-status "python-bobodtml") # (find-vldifile "python-bobodtml.list") # (find-fline "/usr/doc/python-bobodtml/") python-bobo apti python-bobodtml ##### # # dpkg-python # 2000aug02 # ##### pdsc $SDEBIAN/dists/woody/main/source/devel/dpkg-scriptlib_0.1-3.1.dsc cd /usr/src/dpkg-scriptlib-0.1/ # (find-status "dpkg-python") # (find-vldifile "dpkg-python.list") # (find-fline "/usr/doc/dpkg-python/") # (code-c-d "dsl" "/usr/src/dpkg-scriptlib-0.1/") # (find-dslfile "") # (find-dslfile "perl5/Dpkg/Archive/") # (find-dslfile "perl5/Dpkg/Package/") # (find-dslfile "python/dpkg/") # (find-fline "/usr/lib/site-python/dpkg/") #* cat > $EEG <<'---' import sys; sys.path.append("/usr/lib/site-python/dpkg") from dpkg_packages import * parse_package_name("kernel-image-2.2.15_angg.00jun13.deb") --- eeg python #* echo 'import foo' \ | strace-to ~/s python # (find-pytutnode "Invoking the Interpreter") python -c ' import sys; sys.path.append("/usr/lib/site-python/dpkg") from dpkg_packages import * print parse_package_name("kernel-image-2.2.15_angg.00jun13.deb") ' ##### # # classes # 2000aug02 # ##### # (find-pytutnode "Class Definition Syntax") # (find-pytutnode "Class Objects") # (find-pytutnode "Instance Objects") # (find-pyrefnode "del statement") # (find-pytutnode "Method Objects") # (find-pytutnode "Random Remarks") # (find-pytutnode "Inheritance") # (find-pytutnode "Multiple Inheritance") # (find-pytutnode "Dictionaries") # (find-pyrefnode "Special method names") # (find-pyrefnode "Emulating sequence and mapping types") # (find-pyrefnode "Code blocks" "\"namespace\"") # (find-shttpw3 "www.idi.ntnu.no/~mlh/python/instant.html" "__init__") #* cat > $EEG <<'---' import sys class DictFirst: # dict = {} # Wrong: makes every instance share the same dict! def __init__(self): # This is the corrected version. self.dict = {} def feed(self, k, v): # print self; print self.dict; print k; print v if self.dict.has_key(k): print "Repeated key %s, old val %s" % (k, self.dict[k]) else: self.dict[k] = v d = DictFirst() d.feed(2,3) d.dict d.feed(4,5) d.dict d.feed(2,10) d.dict d2 = DictFirst() d2.feed("a", "b") d2.dict d.dict # d and d2 are sharing the same dict! d.a = 20 # However new "fields" like a here are not shared: d.a # this is ok d2.a # but this gives an error. d d2 d.__dict__ d2.__dict__ d.__class__ d2.__class__ pr1 = lambda x: print "pr1 %s" % x # error: print is a statement (?) d.f = pr1 d.pr1(12) d2.pr1(12) --- eeg python #* ##### # # regexps in Python (module re) # 2000aug06 # ##### # (find-pylibnode "re") # (find-pylibnode "Contents of Module re") # (find-pylibnode "Regular Expression Objects") # (find-pylibnode "Match Objects") # (find-pylibnode "Regular Expression Syntax" "?P<id>") # (find-pyrefnode "String literals") # (find-angg ".zshrc" "debbasename") # (find-pyrefnode "Exceptions") # (find-pyrefnode "try statement") # (find-fline "~/PYTHON/debs.py") #* lynx http://www.python.org/doc/howto/ #* cd ~/PYTHON/ echo 'from debs import *' > $EEG eeg python #* ##### # # python source # 2000aug08 # ##### pdsc $SDEBIAN/dists/potato/main/source/interpreters/python_1.5.2-10.dsc cd /usr/src/python-1.5.2/ # find * | grep '\.[ch]$' find Include Modules Objects Parser Python | grep '\.[ch]$' > .files.ch etags $(<.files.ch) glimpseindex -H . -y $(<.files.ch) # (code-c-d "pysrc" "/usr/src/python-1.5.2/") # (find-pysrcfile "") # (find-pysrcfile "Python/") # (find-pysrcfile "Python/bltinmodule.c") # (find-pysrctag "execfile_doc") # (find-pysrctag "eval_doc") # (find-pysrctag "intern_doc") ##### # # compiling # 2000aug21 # ##### # «compiling» # (find-pylibfile "compileall.py") # (find-pylibfile "py_compile.py") # (find-vldifile "" " python") ##### # # running interactively # 2004aug07 # ##### #* # (find-pytutnode "Interactive Startup File") # (find-pyrefnode "global statement" "execfile()") # (find-man "1 python") # (find-man "1 python" " PYTHONSTARTUP") cd /usr/share/doc/python/examples/Demo/tkinter/guido/ cat > $EEG <<'---' import os execfile("hanoi.py") --- eeg python #* cat > /tmp/test.py <<'---' print "Hello from tmp!\n" --- python /tmp/test.py cd /tmp cat > $EEG <<'---' import test import test --- eeg python #* ##### # # pdb # 2004aug06 # ##### # «pdb» (to ".pdb") # http://page.sourceforge.net/tricks.html # (find-efile "progmodes/python.el" "M-x pdb") #* # (eev-bounded) # This block works - both "python /tmp/fib.py" and ".../pdb.py /tmp/fib.py". cat > /tmp/fib.py <<'%%%' def fib(n): # write Fibonacci series up to n "Print a Fibonacci series up to n" a, b = 0, 1 while b < n: print b, a, b = b, a+b # Now call the function we just defined: fib(2000) %%% python /tmp/fib.py /usr/lib/python2.1/pdb.py /tmp/fib.py #* # But the pdb invocation does NOT work: # (require 'gud) # (setq gud-pdb-command-name "/usr/lib/python2.1/pdb.py") # (pdb "/usr/lib/python2.1/pdb.py /tmp/fib.py") #* # «pydb» (to ".pydb") # # (find-status "pydb") # (find-vldifile "pydb.list") # (find-fline "/usr/doc/pydb/") /usr/bin/pydb /tmp/fib.py #* # Running pdb with pydb still doesn't show the source lines, but at # least it shows the prompt and accepts the "h" command". # (require 'gud) # (setq gud-pdb-command-name "/usr/bin/pydb") # (pdb "/usr/bin/pydb /tmp/fib.py") ##### # # python-tk # 2004aug07 # ##### # «python-tk» (to ".python-tk") # (find-es "tcl" "blt") # (find-status "python-tk") # (find-status "python-tk" "Also known as Tkinter") # (find-vldifile "python-tk.list") # (find-udfile "python-tk/") # The following additional packages will be installed: # blt tk8.6-blt2.5 # Suggested packages: # blt-demo tix python-tk-dbg #* # (find-pyexdfile "tkinter/guido/hanoi.py") cd /usr/share/doc/python2.1/examples/Demo/tkinter/guido/ python hanoi.py #* ##### # # tk # 2019jul17 # ##### # «tk» (to ".tk") # file:///usr/share/doc/python2.7/html/library/tk.html # file:///usr/share/doc/python3.5/html/library/tk.html # file:///usr/share/doc/python2.7/html/library/index.html # file:///usr/share/doc/python3.5/html/library/index.html ##### # # TkInter # 2013jan10 # ##### # «tkinter» (to ".tkinter") # file:///usr/share/doc/python2.7/html/library/tkinter.html # file:///usr/share/doc/python3.5/html/library/tkinter.html # https://www.manning.com/books/python-and-tkinter-programming # (find-zsh "apt-file search tkinter") # (find-fline "/usr/share/doc/python2.7/examples/Demo/tkinter/guido/") # (find-zsh "dmissing -i tkinter") # (find-fline "/usr/share/doc/python2.6/examples/Demo/tkinter/") # (code-c-d "tkinterex" "/usr/share/doc/python2.6/examples/Demo/tkinter/") # (code-c-d "tkinterexg" "/usr/share/doc/python2.6/examples/Demo/tkinter/guido/") # (find-tkinterexfile "") # (find-tkinterexgfile "") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd /usr/share/doc/python2.6/examples/Demo/tkinter/guido/ python hanoi.py python ShellWindow.py python brownian.py python brownian2.py python canvasevents.py python dialog.py python electrons.py python hanoi.py python hello.py python imagedraw.py python imageview.py python kill.py python listtree.py python mbox.py python newmenubardemo.py python optionmenu.py python paint.py python rmt.py python solitaire.py python sortvisu.py python ss1.py python svkill.py python switch.py python tkman.py python wish.py <Tau> edrx and pack this one with button2.pack(side='left') <Tau> edrx then after that <Tau> edrx call button1.destroy() <Tau> then button2.destroy() <Tau> edrx and see what happens when you pack button1 with side='top' <Tau> and button2 with side='top' too <Tau> edrx tell me when you have done * (eepitch-python) * (eepitch-kill) * (eepitch-python) import os os.environ["PAGER"] = "cat" from Tkinter import * root = Tk() button1 = Button(master=root) button1.pack() help(button1.pack) # http://effbot.org/tkinterbook/tkinter-hello-tkinter.htm * (eepitch-python) * (eepitch-kill) * (eepitch-python) import os os.environ["PAGER"] = "cat" from Tkinter import * root = Tk() w = Label(root, text="Hello, world!") w.pack() root.mainloop() # (find-status "python") # (find-vldifile "python.list") # (find-fline "/usr/doc/python/") # (find-status "python2.1") # (find-vldifile "python2.1.list") # (find-fline "/usr/doc/python2.1/") # (find-fline "/usr/lib/python2.1/") # (find-fline "/usr/lib/python2.1/pdb.py") # (find-fline "/usr/lib/python2.1/pdb.doc") apti python2.1-doc # (find-status "python2.1-doc") # (find-vldifile "python2.1-doc.list") # (find-fline "/usr/doc/python2.1-doc/") # (find-progoutput "dpkg --get-selections") # (find-status "python2.1") # (find-vldifile "python2.1.list") # (find-fline "/usr/doc/python2.1/") (find-pytutnode "") (find-pylibnode "") (find-pyrefnode "") (find-pyapinode "") (find-pydistnode "") (find-pyextnode "") (find-pytutnode "break and continue Statements") # (find-status "python2.1-examples") # (find-vldifile "python2.1-examples.list") # (find-fline "/usr/doc/python2.1-examples/") # (find-pyexdfile "") # (find-pyexdfile "scripts/") # (find-status "python2.1-elisp") # (find-vldifile "python2.1-elisp.list") # (find-fline "/usr/doc/python2.1-elisp/") #* python =(<<'%%%' print 2+3 %%%) #* #* # By kov function pyrename () { python =(<<'%%%' import os l = os.listdir ('.') for arquivo in l: os.rename (arquivo, arquivo.replace (' ', '_')) %%%) $* } rm -Rv /tmp/pyr mkdir /tmp/pyr cd /tmp/pyr echo 1 > 'um um um' echo 2 > 'dois dois dois' pyrename 'um um um' 'dois dois dois' #* ##### # # PYTHONSTARTUP # 2013jun26 # ##### # «PYTHONSTARTUP» (to ".PYTHONSTARTUP") # (find-angg ".zshrc" "python") # (find-man "1 python") # (find-man "1 python3") # (find-man "1 python3" " PYTHONSTARTUP") # (find-man "1 python" "~/.pythonrc.py") # (find-man "1 python" " PYTHONSTARTUP") # (find-man "1 python" " PYTHONPATH") # (find-eevrc ".pythonrc.py") # (find-angg ".pythonrc.py") # (find-sh "locate python | grep user") # (find-fline "/usr/lib/python2.7/user.py") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) PYTHONSTARTUP=$HOME/.pythonrc.py python # (find-angg ".pythonrc.py") ##### # # open # 2019aug03 # ##### # «open» (to ".open") # file:///usr/share/doc/python2.7/html/library/functions.html#open # file:///usr/share/doc/python3.5/html/library/functions.html#open # file:///usr/share/doc/python2.7/html/library/os.html#os.write # file:///usr/share/doc/python3.5/html/library/os.html#os.write # (find-downeytppage (+ 22 165) "14. Files.") # (find-downeytptext (+ 22 165) "Files") # (find-downeytppage (+ 22 166) "To write a file") # (find-downeytptext (+ 22 166) "To write a file") # (find-multiwindow-intro "5. Restarting eepitch targets") # (find-multiwindow-intro "5. Restarting eepitch targets" "open") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) date | tee /tmp/o * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) readfile("/tmp/o") writefile("/tmp/o", "HELLO\n") readfile("/tmp/o") ##### # # execfile and replacements for it (it was removed in Python3) # 2016jul31 # ##### # «execfile» (to ".execfile") # (find-prepared-intro "An `ee' for Python") # (find-prepared-intro "An `ee' for Python" "def ee():") # (find-prepared-intro "An `ee' for Python" "def ee():" "execfile") # (find-angg ".emacs" "pytest") # (find-angg ".pythonrc.py") # (find-angg ".pythonrc.py" "ee_dofile") # https://docs.python.org/2/tutorial/ # https://docs.python.org/2/library/functions.html#execfile # file:///usr/share/doc/python2.7/html/library/functions.html#execfile # file:///usr/share/doc/python3.5/html/library/functions.html#execfile # file:///usr/share/doc/python3.5/html/library/functions.html#exec # file:///usr/share/doc/python3.7/html/library/functions.html#exec # file:///usr/share/doc/python2.7/html/howto/doanddont.html#unadorned-exec-execfile-and-friends # (find-fline "/usr/lib/python3.5/lib2to3/fixes/fix_execfile.py") # (find-fline "/usr/lib/python2.7/lib2to3/fixes/fix_execfile.py") # (to "2to3") # -execfile("bar.py", globals()) # +exec(compile(open("bar.py").read(), "bar.py", 'exec'), globals()) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cat > /tmp/foo.py <<'%%%' print(2+3) %%% * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) c = compile(ee_readfile("/tmp/foo.py"), "foo.py", "exec") c exec(c, globals()) ee_dofile("/tmp/foo.py") https://stackoverflow.com/questions/6357361/alternative-to-execfile-in-python-3 https://stackoverflow.com/questions/436198/what-is-an-alternative-to-execfile-in-python-3 ##### # # os.path.split # 2019aug04 # ##### # «os.path.split» (to ".os.path.split") # file:///usr/share/doc/python2.7/html/library/os.path.html#os.path.split # file:///usr/share/doc/python3.5/html/library/os.path.html#os.path.split # (find-anggfile "LUA/lua50init.lua" "fnamenondirectory") * (eepitch-python) * (eepitch-kill) * (eepitch-python) os.path.split("/tmp/foo.py") os.path.split("/tmp/foo.py")[1] ##### # # an ee() function for python # 2004nov03 # ##### # «ee-for-python» (to ".ee-for-python") #* # The wrong way: # (find-pyrefnode "exec statement") python <(<<'%%%' def ee(): exec "print 999" exec "print 777\ndef foo():\n print 888\nfoo()" ee() print "We lost the definition of foo:" foo() %%%) #* # The right way: execfile("fname", globals()) # (find-pyrefnode "import statement") # (find-pylibnode "os") # (find-pylibnode "Process Parameters" "`getenv(varname[, value])'") # (find-pylibnode "Built-in Functions" "`execfile(filename") # (find-pyrefnode "exec statement" "`globals()'") cat > $EEVTMPDIR/ee.py <<'%%%' print 11 def foo(): print 22 print 33 %%% python =(<<'%%%' import os def ee(): execfile(os.getenv("EEVTMPDIR")+"/ee.py", globals()) print 0 ee() foo() %%%) #* ##### # # 2to3 # 2019aug03 # ##### # «2to3» (to ".2to3") # (find-man "1 2to3") # (find-man "1 2to3-2.7") # (find-man "1 2to3-3.5") # (find-zsh "apt-file search bin/2to3") # (find-fline "/usr/bin/" "2to3") # (find-fline "/usr/bin/2to3-2.7") # (find-fline "/usr/bin/2to3-3.5") # (find-sh "locate lib2to3") # (find-fline "/usr/lib/python2.7/lib2to3/") # (find-fline "/usr/lib/python3.5/lib2to3/") # (find-fline "/usr/lib/python3.5/lib2to3/fixes/fix_execfile.py") # (find-fline "/usr/lib/python2.7/lib2to3/fixes/fix_execfile.py") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd /tmp/ cat > foo.py <<'%%%' execfile("bar.py", globals()) %%% 2to3 -v foo.py 2to3 foo.py laf cat foo.py ##### # # dumping the arguments # 2004nov04 # ##### # (find-pylibnode "File Descriptor Operations") #* rm -v /tmp/o python =(<<'%%%' import os def foo(*args): fd = open("/tmp/o", "w") fd.write(str(args)+"\n") fd.close foo((1, 2), "3") %%%) cat /tmp/o #* ##### # # str.format # 2019aug04 # ##### # «str.format» (to ".str.format") # file:///usr/share/doc/python2.7/html/library/stdtypes.html#str.format # file:///usr/share/doc/python3.5/html/library/stdtypes.html#str.format # file:///usr/share/doc/python2.7/html/library/stdtypes.html#string-formatting # file:///usr/share/doc/python3.5/html/library/stdtypes.html#string-formatting (nao) # file:///usr/share/doc/python2.7/html/library/string.html#formatstrings # file:///usr/share/doc/python3.5/html/library/string.html#formatstrings # file:///usr/share/doc/python2.7/html/library/string.html#formatspec # file:///usr/share/doc/python3.5/html/library/string.html#formatspec # file:///usr/share/doc/python2.7/html/library/string.html#format-string-syntax # file:///usr/share/doc/python3.5/html/library/string.html#format-string-syntax # file:///usr/share/doc/python2.7/html/library/functions.html#str # file:///usr/share/doc/python3.5/html/library/functions.html#str * (eepitch-python) * (eepitch-kill) * (eepitch-python) "{0}\n".format("foo") "" + 1234 "" + str(1234) str(1234) + "\n" ##### # # talking to python through eechannel # 2005jan01 # ##### # «eechannel-python» (to ".eechannel-python") # http://people.debian.org/~kov/stuff/edrx.tar.gz # (find-pylibnode "signal") # (find-pyrefnode "Comments") # (find-pyrefnode "String literals") # (my-modes :scroll-bar :pager :erc-track :fringe :width80) # (my-modes :no-scroll-bar :no-pager :no-erc-track :no-fringe :width80) * (eebg-channel-xterm "pysh") * (eechannel "pysh") cd /tmp/ python import signal, time, os channel = 'python' pidfile = os.getenv('EEVTMPDIR') + '/eeg.' + channel + '.pid' strfile = os.getenv('EEVTMPDIR') + '/eeg.' + channel + '.str' fhandle = open (pidfile, 'w') fhandle.write (str(os.getpid()) + '\n') fhandle.close () def signal_handler (num, frame): execfile(strfile, globals()) signal.signal (signal.SIGUSR1, signal_handler) a = 0 while (1): print a time.sleep (1) a = a + 1 * (eechannel "python") print '(hi)' print '(hi again)' * (find-sh0 "~/bin/Xscreenshot") * ;; http://angg.twu.net/tmp/shot-pychannel0.png # (write-region "print '(oi)'\n" nil "/tmp/coisa.py") # (find-zsh0 "kill -SIGUSR1 $(cat /tmp/eeg.python.pid)") (find-pytutnode "") (find-pylibnode "") (find-pyrefnode "") (find-pyapinode "") (find-pydistnode "") (find-pyextnode "") import coisa del coisa ##### # # Listening to SIGUSR1s # 2019aug03 # ##### # «sigusr1» (to ".sigusr1") # (find-channels-intro "SIGUSR1") # (find-multiwindow-intro "5. Restarting eepitch targets") # (find-multiwindow-intro "5. Restarting eepitch targets" "* (find-3EE") # https://www.programcreek.com/python/example/5524/signal.SIGUSR2 # https://kite.com/python/docs/signal.SIGUSR2 # https://pymotw.com/2/signal/ # https://stackabuse.com/handling-unix-signals-in-python/ # https://docs.python.org/3.7/library/signal.html#module-signal # file:///usr/share/doc/python2.7/html/library/signal.html # file:///usr/share/doc/python3.5/html/library/signal.html # file:///usr/share/doc/python2.7/html/library/signal.html#signal.signal # file:///usr/share/doc/python3.5/html/library/signal.html#signal.signal # file:///usr/share/doc/python2.7/html/library/os.html#os.chdir # file:///usr/share/doc/python3.5/html/library/os.html#os.chdir # file:///usr/share/doc/python2.7/html/library/os.html#os.getpid # file:///usr/share/doc/python3.5/html/library/os.html#os.getpid # Standard syntax: # def signal_handler (num, frame): # ee_dofile(strfname) # # signal.signal (signal.SIGUSR1, signal_handler) # (setenv "EEVTMPDIR" (ee-expand "~/.eev")) # (find-fline "$EEVTMPDIR/") # (find-angg ".pythonrc.py") * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) import signal channel = "py" pidfname = os.getenv("EEVTMPDIR") + "/eeg." + channel + ".pid" strfname = os.getenv("EEVTMPDIR") + "/eeg." + channel + ".str" ee_writefile(pidfname, str(os.getpid()) + "\n") signal.signal (signal.SIGUSR1, lambda num,frame: ee_dofile(strfname)) os.getenv("EEVTMPDIR") pidfname strfname os.getpid() * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) * (find-3ee '(eepitch-shell) '(eepitch-python3)) * (eepitch-shell) cd $EEVTMPDIR laf echo 'print(2+3)' > $EEVTMPDIR/eeg.py.str kill -USR1 $(cat $EEVTMPDIR/eeg.py.pid) echo 'exit()' > $EEVTMPDIR/eeg.py.str kill -USR1 $(cat $EEVTMPDIR/eeg.py.pid) ##### # # python-docutils / ReStructuredText # 2007mar25 # ##### # «python-docutils» (to ".python-docutils") # «rst» (to ".rst") # (find-es "rst") # http://docutils.sourceforge.net/rst.html # http://docutils.sourceforge.net/docs/user/rst/quickstart.txt # http://docutils.sourceforge.net/docs/user/emacs.html # (find-efile "textmodes/rst.el") # (find-status "python-docutils") # (find-vldifile "python-docutils.list") # (find-udfile "python-docutils/") # (code-c-d "pydocudoc" "/usr/share/doc/python-docutils/") # (find-pydocudocfile "ref/rst/introduction.txt.gz") # (find-pydocudocfile "user/rst/quickstart.txt.gz") # (find-pydocudocfile "user/rst/") # (find-pydocudocfile "") # (find-fline "/tmp/rst/") #* rm -Rv /tmp/rst/ mkdir /tmp/rst/ cd /usr/share/doc/python-docutils/user/rst/ cp -v * /tmp/rst/ cd /tmp/rst/ gunzip -v *.gz for i in *.txt; do echo $i rst2html $i > $(basename $i .txt).html done |& tee o #* # Source: # (code-c-d "pydocusp" "/usr/lib/site-python/docutils/") # (find-pydocuspfile "") ##### # # dive into python # 2007mar25 # ##### # «diveintopython» (to ".diveintopython") # (find-status "diveintopython") # (find-vldifile "diveintopython.list") # (find-udfile "diveintopython/") # (code-c-d "pydip" "/usr/share/doc/diveintopython/") # (find-pydipfile "") # (find-pydipw3m "html/toc/index.html") # Very bad book, incredibly bad examples. # http://oppugn.us/posts/1272050135.html Criticism of Dive into Python ##### # # closures # 2008jun28 # ##### # «closures» (to ".closures") * (eepitch-python) * (eepitch-kill) * (eepitch-python) def adder(x): def foo(y): return y + x return foo plus2 = adder(2) plus2(3) plus3 = adder(3) plus3(5) ##### # # python-apt (from the debian sources) # 2009jul27 # ##### # «python-apt-deb-src» (to ".python-apt-deb-src") # http://ftp.de.debian.org/debian/pool/main/p/python-apt/ # http://ftp.de.debian.org/debian/pool/main/p/python-apt/python-apt_0.7.7.1+nmu1.dsc # http://ftp.de.debian.org/debian/pool/main/p/python-apt/python-apt_0.7.7.1+nmu1.tar.gz #* rm -Rv ~/usrc/python-apt/ mkdir ~/usrc/python-apt/ cd $S/http/ftp.de.debian.org/debian/pool/main/p/python-apt/ cp -v python-apt_0.7.7.1+nmu1* ~/usrc/python-apt/ cd ~/usrc/python-apt/ dpkg-source -sn -x python-apt_0.7.7.1+nmu1.dsc cd ~/usrc/python-apt/python-apt-0.7.7.1+nmu1/ dpkg-buildpackage -us -uc -b -rfakeroot |& tee odb #* # (find-fline "~/usrc/python-apt/") * (eepitch-shell) cd ~/usrc/python-apt/ sudo dpkg -i *.deb #* # (code-c-d "pythonapt" "~/usrc/python-apt/python-apt-0.7.7.1+nmu1/") # (find-pythonaptfile "") # (find-pythonaptfile "doc/examples/") ##### # # python-apt # 2009jul27 # ##### # «python-apt» (to ".python-apt") # (find-es "apt" "libapt") # (find-status "python-apt") # (find-vldifile "python-apt.list") # (find-udfile "python-apt/") # (find-status "python-apt-doc") # (find-vldifile "python-apt-doc.list") # (find-udfile "python-apt-doc/") # (find-udfile "python-apt/html/_sources/") # (find-udgrep "grep -nH -e VersionCompare python-apt-doc/examples/*") # (find-angg "LUA/apt-move.lua" "debversions") # (find-fline "/usr/share/doc/python-apt/examples/") # (find-fline "/usr/lib/python2.6/dist-packages/apt/") # (find-fline "/usr/share/pyshared/apt/") # (find-fline "/usr/share/doc/python-apt/") # (code-c-d "pythonapt" "/usr/lib/python2.6/dist-packages/apt/") # (code-c-d "pythonaptex" "/usr/share/doc/python-apt/examples/") # (find-pythonaptfile "") # (find-pythonaptexfile "") # (find-pythonaptexfile "build-deps.py") * (eepitch-python) * (eepitch-kill) * (eepitch-python) import apt_pkg import sys import sets def get_source_pkg(pkg, records, depcache): """ get the source package name of a given package """ version = depcache.GetCandidateVer(pkg) if not version: return None file, index = version.FileList.pop(0) records.Lookup((file, index)) if records.SourcePkg != "": srcpkg = records.SourcePkg else: srcpkg = pkg.Name return srcpkg # main apt_pkg.init() cache = apt_pkg.GetCache() depcache = apt_pkg.GetDepCache(cache) depcache.Init() records = apt_pkg.GetPkgRecords(cache) srcrecords = apt_pkg.GetPkgSrcRecords() base = cache["emacs22-el"] # For example all_build_depends = sets.Set() # get the build depdends for the package itself srcpkg_name = get_source_pkg(base, records, depcache) print "srcpkg_name: %s " % srcpkg_name if not srcpkg_name: print "Can't find source package for '%s'" % pkg.Name srcrec = srcrecords.Lookup(srcpkg_name) if srcrec: print "Files:" print srcrecords.Files bd = srcrecords.BuildDepends print "build-depends of the package: %s " % bd for b in bd: all_build_depends.add(b[0]) # calculate the build depends for all dependencies depends = depcache.GetCandidateVer(base).DependsList for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends? pkg = dep[0].TargetPkg srcpkg_name = get_source_pkg(pkg, records, depcache) if not srcpkg_name: print "Can't find source package for '%s'" % pkg.Name continue srcrec = srcrecords.Lookup(srcpkg_name) if srcrec: #print srcrecords.Package #print srcrecords.Binaries bd = srcrecords.BuildDepends #print "%s: %s " % (srcpkg_name, bd) for b in bd: all_build_depends.add(b[0]) print "\n".join(all_build_depends) ##### # # python-opengl # 2009jul27 # ##### # «python-opengl» (to ".python-opengl") apti python-opengl python-opengl-doc # (find-status "python-opengl") # (find-vldifile "python-opengl.list") # (find-udfile "python-opengl/") # (find-status "python-opengl-doc") # (find-vldifile "python-opengl-doc.list") # (find-udfile "python-opengl-doc/") # (find-fline "/usr/share/doc/python-opengl-doc/documentation/pydoc/") # http://code.activestate.com/recipes/325391/ * (eepitch-python) * (eepitch-kill) * (eepitch-python) from OpenGL.GLUT import * from OpenGL.GLU import * from OpenGL.GL import * import sys name = 'ball_glut' def main(): glutInit(sys.argv) glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH) glutInitWindowSize(400,400) glutCreateWindow(name) # glClearColor(0.,0.,0.,1.) glShadeModel(GL_SMOOTH) glEnable(GL_CULL_FACE) glEnable(GL_DEPTH_TEST) glEnable(GL_LIGHTING) lightZeroPosition = [10.,4.,10.,1.] lightZeroColor = [0.8,1.0,0.8,1.0] #green tinged glLightfv(GL_LIGHT0, GL_POSITION, lightZeroPosition) glLightfv(GL_LIGHT0, GL_DIFFUSE, lightZeroColor) glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1) glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05) glEnable(GL_LIGHT0) glutDisplayFunc(display) glMatrixMode(GL_PROJECTION) gluPerspective(40.,1.,1.,40.) glMatrixMode(GL_MODELVIEW) gluLookAt(0,0,10, 0,0,0, 0,1,0) glPushMatrix() glutMainLoop() return def display(): glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) glPushMatrix() color = [1.0,0.,0.,1.] glMaterialfv(GL_FRONT,GL_DIFFUSE,color) glutSolidSphere(2,20,20) glPopMatrix() glutSwapBuffers() return if __name__ == '__main__': main() ##### # # Pymacs # 2011oct25 # ##### # «pymacs» (to ".pymacs") # (find-status "pymacs") # (find-vldifile "pymacs.list") # (find-udfile "pymacs/") # http://pymacs.progiciels-bpi.ca/index.html ##### # # Python-sphinx # 2011nov14 # ##### # «python-sphinx» (to ".python-sphinx") # (find-es "lua5" "gsl-shell") # (find-status "python-sphinx") # (find-vldifile "python-sphinx.list") # (find-udfile "python-sphinx/") ##### # # sphinx-build (used by the Agda docs) # 2019may20 # ##### # «sphinx-build» (to ".sphinx-build") # (find-es "sphinx" "python3-sphinx") # (find-es "agda" "agda-git") # https://www.sphinx-doc.org/en/1.6/man/sphinx-build.html # (find-sh "apt-file search sphinx-build") # (find-sh "apt-file search sphinx.ext.imgmath") # python-sphinx: /usr/share/sphinx/scripts/python2/sphinx-build # python3-sphinx: /usr/share/sphinx/scripts/python3/sphinx-build # (find-status "python3-sphinx") # (find-vldifile "python3-sphinx.list") # (find-udfile "python3-sphinx/") # (find-status "sphinx-common") # (find-vldifile "sphinx-common.list") # (find-udfile "sphinx-common/") # (find-status "sphinx-doc") # (find-vldifile "sphinx-doc.list") # (find-udfile "sphinx-doc/") # (find-man "sphinx-build") # sphinx.ext.imgmath not found: # https://github.com/rtfd/readthedocs.org/issues/2418 sphinx.ext.imgmath not found # https://github.com/sphinx-doc/sphinx/issues/2436 Running Sphinx v1.3.6 /conf.py needs_sphinx = '1.4.3' /requirements.txt Sphinx>=1.4.3 aptrm python3-sphinx ##### # # sphinx-git # 2019may21 # ##### # «sphinx-git» (to ".sphinx-git") # https://github.com/sphinx-doc/sphinx * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv ~/usrc/sphinx/ cd ~/usrc/ git clone https://github.com/sphinx-doc/sphinx cd ~/usrc/sphinx/ make |& tee om # (code-c-d "sphinx" "~/usrc/sphinx/") # (find-sphinxfile "") # (find-gitk "~/usrc/sphinx/") # (find-sphinxfile "setup.py" "flake8>=3.5.0") ##### # # PyGame # 2011nov25 # ##### # «pygame» (to ".pygame") # (find-zsh "installeddebs | sort | grep pygame") # (find-zsh "availabledebs | sort | grep pygame") # (find-status "python-pygame") # (find-vldifile "python-pygame.list") # (find-udfile "python-pygame/") # (find-udfile "python-pygame/ref/") # (find-udfile "python-pygame/tut/") # (find-es "vnc" "vnc2swf-2011") # (find-fline "/usr/lib/python2.7/dist-packages/pygame/docs/") # http://programarcadegames.com/index.php?chapter=introduction_to_graphics http://www.pygame.org/docs/ 2021sep02 ##### # # Modules # 2012may02 # ##### # «modules» (to ".modules") # (find-pytutnode "Modules") # (find-pytutnode "Executing modules as scripts") # (find-fline "/tmp/fibo.py") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd /tmp/ rm -v fibo.py cat > fibo.py <<'%%%' print "Hello" def square (x): return x*x if __name__ == "__main__": import sys print(square(int(sys.argv[1]))) else: print("Loading as a module") print "Bye" %%% python fibo.py 6 python import fibo print(fibo.square(6)) ##### # # module.__file__ # 2019sep25 # ##### # «module.__file__» (to ".module.__file__") # file:///usr/share/doc/python3.5/html/search.html?q=__file__&check_keywords=yes&area=default # file:///usr/share/doc/python3.5/html/reference/import.html#import-related-module-attributes # file:///usr/share/doc/python3.5/html/library/os.path.html#os.path.abspath * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) import IPython IPython IPython.__file__ os.path.abspath(IPython.__file__) I tried to run these lines in the REPL: "import IPython", "IPython", "IPython.__file__", "os.abspath(IPython.__file__)"... the first three ones work, but the last one gives this error: "AttributeError: module 'os' has no attribute 'abspath'"... ##### # # __tostring for Python # 2012may08 # ##### # «tostring» (to ".tostring") # http://rgruet.free.fr/PQR2.3.html#SpecialMethods # (find-pyrefnode "Special method names") # (find-pyrefnode "Basic customization") # (find-pyrefnode "Basic customization" "`__repr__(self)'") # (find-pyrefnode "Basic customization" "`__str__(self)'") # (find-pyrefnode "Emulating container types") # (find-pyrefnode "Emulating numeric types") ##### # # SciPy # 2012nov24 # ##### # «scipy» (to ".scipy") # http://www.scipy.org/SciPy ##### # # matplotlib # 2012nov24 / 2019aug03 # ##### # «matplotlib» (to ".matplotlib") # https://matplotlib.org/gallery.html # (find-zsh "installeddebs | sort | grep matplotlib") # (find-zsh "availabledebs | sort | grep matplotlib") # (find-status "python-matplotlib") # (find-vldifile "python-matplotlib.list") # (find-udfile "python-matplotlib/") # (find-status "python-matplotlib-doc") # (find-vldifile "python-matplotlib-doc.list") # (find-udfile "python-matplotlib-doc/") # (find-status "python3-matplotlib") # (find-vldifile "python3-matplotlib.list") # (find-udfile "python3-matplotlib/") # (find-udfile "python-matplotlib-doc/examples/") # (find-udfile "python-matplotlib-doc/examples/README.txt") # file:///usr/share/doc/python-matplotlib-doc/html/index.html # file:///usr/share/doc/python-matplotlib-doc/html/gallery.html # file:///usr/share/doc/python-matplotlib-doc/html/ # file:///usr/share/doc/python-matplotlib-doc/html/tutorials/index.html * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) apti python-matplotlib python-matplotlib-doc python3-matplotlib # Old: # http://stackoverflow.com/questions/tagged/matplotlib # http://matplotlib.org/ # http://matplotlib.org/api/figure_api.html # http://www.scipy.org/Additional_Documentation?action=show&redirect=Documentation ##### # # matplotlib-examples # 2019aug29 # ##### # «matplotlib-examples» (to ".matplotlib-examples") # (find-angg ".emacs.templates" "find-matplotlib-links") # (find-angg ".emacs.templates" "find-matplotlib-links" "M-x brmpd") # (find-angg ".emacs" "matplotlib-examples") # (find-matplotlibexfile "") # (find-matplotlibexfile "pyplots/") # (find-matplotlibexfile "pyplots/align_ylabels.py") # (find-fline "~/MATPLOTLIB/") # (find-fline "~/MATPLOTLIB/rotate_axes3d_demo.py") ##### # # matplotlib-rougier # 2021sep07 # ##### # «matplotlib-rougier» (to ".matplotlib-rougier") # https://github.com/rougier # https://github.com/rougier/matplotlib-tutorial # https://github.com/rougier/scientific-visualization-book # https://github.com/rougier/figure-anatomy # https://github.com/matplotlib/cheatsheets https://news.ycombinator.com/item?id=29229103 An open access book on scientific visualization using Python and Matplotlib (github.com/rougier) ##### # # NumPy # 2013may13 # ##### # «numpy» (to ".numpy") # http://www.scipy.org/Tentative_NumPy_Tutorial # http://scipy-lectures.github.com/ # (find-angg ".emacs" "ipython") # «scipy-lectures» (to ".scipy-lectures") # (find-git-links "https://github.com/scipy-lectures/scipy-lecture-notes.git" "scipylectures") # (find-es "rst") # https://github.com/scipy-lectures/scipy-lecture-notes # https://github.com/scipy-lectures/scipy-lecture-notes.git (code-c-d "scipylectures" "~/usrc/scipy-lecture-notes/") (code-c-d "scipylectureshtml" "~/usrc/scipy-lecture-notes/build/html/") ;; (find-scipylecturesfile "") ;; (find-scipylecturesfile "intro/") ;; (find-scipylecturesfile "intro/intro.rst") ;; (find-scipylecturessh "find * | sort") ;; (find-scipylecturessh "find * | sort | grep rst") ;; (find-scipylectureshtmlfile "") ;; (find-scipylectureshtmlfile "_sources/packages/traits/index.txt") ;; (find-scipylectureshtmlfile "_sources/packages/scikit-learn/index.txt") ;; (find-scipylectureshtmlfile "_sources/packages/3d_plotting/") ;; file:///home/edrx/usrc/scipy-lecture-notes/build/html/index.html * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd ~/usrc/scipy-lecture-notes/ make html |& tee om ##### # # ipython # 2012sep27 # ##### # «ipython» (to ".ipython") # https://en.wikipedia.org/wiki/IPython # (find-angg ".emacs" "ipython") # (find-angg ".emacs" "pylab") # (find-status "ipython") # (find-vldifile "ipython.list") # (find-udfile "ipython/") # (find-status "python-matplotlib") # (find-vldifile "python-matplotlib.list") # (find-udfile "python-matplotlib/") # (find-sitelispfile "ipython.el") (code-c-d "ipython" "/usr/share/pyshared/IPython/") (code-c-d "ipythonex" "/usr/share/doc/ipython/examples/") ;; (find-ipythonfile "") ;; (find-ipythonexfile "") # http://www.thetechrepo.com/main-articles/465-how-to-create-a-graph-in-python # http://coreygoldberg.blogspot.com.br/2012/01/python-matplotlib-and-numpy-on.html # http://stackoverflow.com/questions/1596684/python-library-to-plot-graph # http://www.youtube.com/watch?v=26wgEsg9Mcc IPython: Python at your fingertips # http://www.youtube.com/watch?v=2G5YTlheCbw IPython in-depth: high-productivity interactive and parallel python # http://stackoverflow.com/questions/13575703/ipython-ide-for-windows # http://nbviewer.ipython.org/urls/raw.github.com/jrjohansson/scientific-python-lectures/master/Lecture-5-Sympy.ipynb # (find-youtubedl-links "/sda5/videos/" "IPython_-_Python_at_your_fingertips" "26wgEsg9Mcc" ".mp4" "ipythonayf") # (code-video "ipythonayfvideo" "/sda5/videos/IPython_-_Python_at_your_fingertips-26wgEsg9Mcc.mp4") # (code-video "ipythonayfvideo" "/sda5/videos/IPython_-_Python_at_your_fingertips-26wgEsg9Mcc.mp4.part") # (find-ipythonayfvideo) # (find-ipythonayfvideo "0:00") # (find-sh "ipython --help") # (find-sh "ipython --help" "pylab") # (find-sh "ipython --help-all") apti python-matplotlib # (find-man "1 ipcluster") # (find-man "1 ipcontroller") # (find-man "1 ipengine") # (find-man "1 ipython") # (find-man "1 ipython" "-pylab") # (find-man "1 ipython-wx") # (find-man "1 ipythonx") # (find-man "1 irunner") # (find-man "1 pycolor") * (eepitch-pylab) * (eepitch-kill) * (eepitch-pylab) ? x = randn(10000) hist(x, 100) ?hist print(x) ?randn ##### # # Ameliabot # 2012oct27 # ##### # «ameliabot» (to ".ameliabot") # (find-es "git" "git-shallow-clone") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-es "cvs" "git-shallow-clone") rm -Rfv /tmp/ameliabot/ mkdir /tmp/ameliabot/ cd /tmp/ameliabot/ git clone --depth 1 git://git.code.sf.net/p/ameliabot/code ameliabot-code git clone --depth 1 git://git.code.sf.net/p/untwisted/code untwisted-code git clone --depth 1 git://git.code.sf.net/p/uxirc/code uxirc-code # (find-fline "/tmp/ameliabot/") <Tau> daà voce instala o untwisted depois o uxric lib com python setup.py install, se voce quiser instalar em uma conta do linux comum voce usa python setup.py install --prefix=$HOME <Tau> aà pra rodar o ameliabot voce só edita o amelia.py configurando lá os canais/plugins etc <Tau> e roda com python amelia.py """ Author:Iury O. G. Figueiredo Name:codenv Description: This plugin uses codepage.org to run code. Usage: <Tau>.proc python .done <Tau>def snard(value): <Tau> for ind in range(value): <Tau> print 'snardbafulator is a molester' <Tau>snard(6) <Tau>.done <yu> snardbafulator is a molester snardbafulator is a molester snardbafulator is a molester snardbafulator is a molester snardbafulator is a molester snardbafulator is a molester """ from utils import codepad from uxirc.misc import * from untwisted.network import hold, xmap class Codenv(object): def __init__(self, server, max_width=512 * 3): self.max_width = max_width xmap(server, ('PRIVCHAN', '.$'), self.proc) def proc(self, server, (nick, user, host, target, msg), lang, tag): code = '' flag = hold(server, 'PRIVCHAN') while True: event, args = yield flag if args[4] == target and args[3] == host: if args[5] == tag: break code = code + args[5] + '\n' url, output = codepad.sandbox(code, lang) if len(output) <= self.max_width: send_msg(server, target, output) else: send_msg(server, target, url) ##### # # Rend's tutorial # 2013jan01 # ##### # «rends-tutorial» (to ".rends-tutorial") # (find-fline "~/LOGS/2013jan01.eev") (defun u () (interactive) (find-escript-upload-links "python" "rends-tutorial")) (defun eejump-666 () (find-wset "13_o_2o_o" ;; ' (find-angg "TODO") ' (find-es "python") ' (ee-here '(eepitch-python)) ' (find-ebuffer "#eev@irc.freenode.net") )) * (eepitch-python) * (eepitch-kill) * (eepitch-python) # class Car(): class Car(object): def __init__(self, name, model=None): self.name = name self.model = model def start(self): return 'running ...' def accelerate(self, number=10): print 'accelerating ... [%s]' % number self.speed = number def accelerate2(foo, number=10): print 'accelerating ... [%s]' % number foo.speed = number def speed(self): return 22 def stop(self): return 'stopped.' ferrari = Car("Ferrari", "M") ferrari ferrari.name ferrari.model ferrari.start ferrari.start() ferrari.accelerate(20) ferrari.speed ferrari.accelerate2(30) ferrari.speed # ferrari = {'start':start_func, # 'accelerate':accelerate_func, # 'stop':stop_func, # name:'Ferrari', # model:'whatever_model'} class miniCar(Car): def jump(foo, height): foo.height = height print foo.height minicar = miniCar('cooper') minicar.jump(100) minicar ferrari = Car('Ferrari') dir(ferrari) ferrari.__dict__ dir(minicar) minicar.__dict__ minicar.__sizeof__ ferrari.__sizeof__ ferrari.__sizeof__() * (eepitch-python) * (eepitch-kill) * (eepitch-python) # A port of: (find-dn5 "eoo.lua" "test-eoo") # See: (to "environment") # (to "tostring") # (find-pyrefnode "Basic customization" "`__repr__(self)'") # (find-pyrefnode "Basic customization" "`__str__(self)'") # import os os.environ["PAGER"] = "cat" import math dir(math) help(math.sqrt) class V2(object): def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return str((self.x,self.y)) # return "(%d, %d)" % (self.x, self.y) def __add__(self, other): return V2(self.x + other.x, self.y + other.y) def norm(self): return math.sqrt(self.x ** 2 + self.y ** 2) v = V2(3, 4) v.norm() v V2(3, 4) + V2(20, 30) ##### # # Environment variables # 2013jan02 # ##### # «environment» (to ".environment") # file:///usr/share/doc/python2.7/html/library/os.html # file:///usr/share/doc/python3.5/html/library/os.html # file:///usr/share/doc/python2.7/html/library/os.html#os.environ # file:///usr/share/doc/python3.5/html/library/os.html#os.environ * (eepitch-python) * (eepitch-kill) * (eepitch-python) import os os.getenv("PAGER") os.putenv("PAGER", "cat") os.getenv("PAGER") os.environ["PAGER"] os.environ["PAGER"] = "cat" os.getenv("PAGER") help(os) help(os.environ) help(os.getenv) help(os.putenv) ##### # # scikits and scikits.audiolab # 2012nov18 # ##### # «scikits» (to ".scikits") # (find-status "python-scikits-learn") # (find-vldifile "python-scikits-learn.list") # (find-udfile "python-scikits-learn/") # (find-status "python-scikits-learn-doc") # (find-vldifile "python-scikits-learn-doc.list") # (find-udfile "python-scikits-learn-doc/") apti python-scikits-learn python-scikits-learn-doc * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv /tmp/hybrid/ mkdir /tmp/hybrid/ cd /tmp/hybrid/ git clone git://labmacambira.git.sourceforge.net/gitroot/labmacambira/dissertacao cd dissertacao git pull origin msc git checkout msc cd scripts/ cd /tmp/hybrid/dissertacao/scripts/ # (code-c-d "hybridscripts" "/tmp/hybrid/dissertacao/scripts/") # (find-hybridscriptsfile "") # (find-hybridscriptsfile "pecas2.3/microTom.py") cd /tmp/hybrid/dissertacao/scripts/pecas2.3/ python microTom.py # (find-zsh "dmissing scikits") <automata> em scripts vc vai encontrar pecas2.1 pecas2.2 e pecas2.3 <automata> basta entrar em cada um desses diretórios e executar os códigos em python ##### # # PyObjects (by Sergey Sergeev) # 2013jan02 # ##### # «pyobjects» (to ".pyobjects") # https://github.com/sharedmemory/pyobjects # https://github.com/jfearn/HTML-Tree/blob/master/lib/HTML/Tree/AboutObjects.pod # (find-fline "/usr/share/perl5/HTML/Tree/AboutObjects.pod") # http://lua-users.org/lists/lua-l/2009-09/msg00565.html ##### # # emacs-ipython-notebook # 2012dec08 # ##### # «emacs-ipython-notebook» (to ".emacs-ipython-notebook") # (find-es "jupyter" "emacs-ipython-notebook") # https://github.com/tkf/emacs-ipython-notebook ##### # # audio # 2013mar06 # ##### # «audio» (to ".audio") # http://stackoverflow.com/questions/307305/play-a-sound-with-python # http://wiki.python.org/moin/Audio # http://wiki.python.org/moin/PythonInMusic ##### # # pprint # 2014sep06 # ##### # «pprint» (to ".pprint") # file:///usr/share/doc/python2.7/html/library/pprint.html # https://docs.python.org/2/library/pprint.html # http://pymotw.com/2/pprint/ # http://stackoverflow.com/questions/9135485/how-to-use-pprint-to-print-an-object-using-the-built-in-str-self-method ##### # # SymPy # 2013mar23 # ##### # «sympy» (to ".sympy") #******** #******** Tutorial: #******** (find-es "sympy" "tutorial") #******** # (find-status "python-sympy") # (find-vldifile "python-sympy.list") # (find-udfile "python-sympy/") from __future__ import division from sympy import * x, y, z, t = symbols('x y z t') k, m, n = symbols('k m n', integer=True) f, g, h = symbols('f g h', cls=Function) Stephanie, vou te passar as anotacoes por aqui pra mais gente (Hugo, por exemplo =) ) ter noção do que a gente está começando a fazer... Você instalou o Python(x,y) baixando isso aqui, né? http://www.mirrorservice.org/sites/pythonxy.com/Python(x,y)-2.7.5.0.exe E a gente tá tentando aprender a fazer computação simbólica nele... quando eu rodo "isympy" no Linux as mensagens são estas: IPython console for SymPy 0.7.1.rc1 (Python 2.7.3-32-bit) (ground types: python) These commands were executed: >>> from __future__ import division >>> from sympy import * >>> x, y, z, t = symbols('x y z t') >>> k, m, n = symbols('k m n', integer=True) >>> f, g, h = symbols('f g h', cls=Function) Documentation can be found at http://www.sympy.org In [1]: e aà a gente pode dar expressões como (1 - x) * 2 e o interpretador responde: -2*x + 2 porque ele trata isto como uma expressão (um polinômio)... Estamos dando uma olhada neste tutorial e nestas páginas de referência, http://docs.sympy.org/0.7.2/tutorial.html http://docs.sympy.org/0.7.2/modules/core.html http://docs.sympy.org/0.7.2/modules/polys/reference.html mas ainda não descobrimos um modo do Python pra Windows já começar rodando os comandos que carregam o sympy e definem x, y, z, t, etc como "expressões"... # http://docs.sympy.org/0.7.2/tutorial.html # http://docs.sympy.org/0.7.2/modules/core.html # http://docs.sympy.org/0.7.2/modules/polys/reference.html ##### # # Spyder # 2013jun25 # ##### # «spyder» (to ".spyder") # (find-status "spyder") # (find-vldifile "spyder.list") # (find-udfile "spyder/") # (find-status "python-spyderlib") # (find-vldifile "python-spyderlib.list") # (find-udfile "python-spyderlib/") # (find-man "1 spyder") * (eepitch-shell2) * (eepitch-kill) * (eepitch-shell2) spyder # (find-fline "~/.spyder2/") # (find-fline "~/.spyder2/.temp.py") # http://www.mirrorservice.org/sites/pythonxy.com/ # file:///usr/share/doc/python-spyderlib/html/index.html ##### # # Idle # 2013jun26 # ##### # «idle» (to ".idle") # file:///usr/share/doc/python2.7/html/library/idle.html # file:///usr/share/doc/python3.5/html/library/idle.html # (find-zsh "apt-file search idle") # (find-zsh "installeddebs | sort | grep idle") # (find-zsh "availabledebs | sort | grep idle") idle-python2.7 idle-python3.5 idle3-tools idle3-tools idle3 idle idlestat idlestat telepathy-idle telepathy-idle # (find-angg "PYTHON/a.py") # (find-sh "locate idle | grep -i python") # (find-fline "/usr/lib/python2.5/idlelib/") # (find-zsh "dmissing idlelib") # (find-zsh "installeddebs | sort | grep python") # (find-status "python2.7") # (find-vldifile "python2.7.list") # (find-udfile "python2.7/") # (find-status "idle") # (find-vldifile "idle.list") # (find-udfile "idle/") # (find-status "idle-python2.7") # (find-vldifile "idle-python2.7.list") # (find-udfile "idle-python2.7/") # (find-man "1 idle") * (eepitch-python) * (eepitch-kill) * (eepitch-python) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) PAGER=cat python help("import") # sys.meta_path ##### # # Links do Felipe Pinheiro # 2013jun14 # ##### # «felipe-pinheiro» (to ".felipe-pinheiro") Comece por aqui: http://ericstk.wordpress.com/2013/01/22/o-que-e-preciso-para-comecar-a-programar-em-python/ PDF, Python for Zombies(português): https://docs.google.com/file/d/0B2FCVdJY8NOqeUIwUV9SaU1jYlU/edit http://www.slideshare.net/renatopp/introduo-ao-python http://www.python.org.br/wiki/AprendaProgramar ---------------------------------------------- ExercÃcios: http://www.python.org.br/wiki/ListaDeExercicios ---------------------------------------------- VÃdeos Lógica de Programação Usando Python - Curso Completo(comece aqui) http://www.youtube.com/playlist?list=PL51430F6C54953B73 Exemplo Programa(médio) http://www.youtube.com/watch?v=eTKB6of96GQ Curso de desenvolvimento Web com Python e Django : http://migre.me/cWcDU Palestras e vÃdeos: http://aprenda-python.blogspot.com.br/2013/03/palestras-gratuitas-e-atualizadas-2013.html Python e QT4 http://www.youtube.com/playlist?list=PLF4575388795F2531 Python e GTK http://www.youtube.com/playlist?list=PL7604BFACE2442F9A Curso em Video Aulas Python http://www.baixebr.org/cursos-e-apostilas/cursos/curso-video-aulas-python/ http://www.youtube.com/course?list=EC36E7A2B75028A3D6 Computer Science - Khan Academy http://www.youtube.com/playlist?list=PLE549A038CF82905F Tutoriales de Programación ---------------------------------------------- Orientação a Objetos: http://www.fem.unicamp.br/~labaki/Python/ModuloB.pdf Aprendendo Django: http://www.aprendendodjango.com/ Banco de dados: http://www.python.org.br/wiki/BancosDeDadosSql Exemplos de programas prontos http://www.python.org.br/wiki/CookBook Learn Python in 10 minutes(inglês): http://www.korokithakis.net/tutorials/python/ Learn Python The Hard Way(inglês): http://learnpythonthehardway.org/book/ Alguns tutoriais: http://linuxresort.blogspot.com.br/p/e-uma-linguagem-de-alto-nivel-de-mexer.html Listas: http://www.lcg.ufrj.br/Cursos/algprog/Programando%20em%20Python%20-%20Listas.pdf Introdução ao QT4(inglês): http://www.rkblog.rk.edu.pl/w/p/introduction-pyqt4/ PyQT(inglês): http://www.commandprompt.com/community/pyqt/?page=pyqtbook http://www.async.com.br/projects/python/pnp/ http://aprenda-python.blogspot.com.br http://aprenda-python.blogspot.com.br/2010/09/curso-gratuito-de-python-em-portugues.html http://zetcode.com/ ---------------------------------------------- -Livros Python para desenvolvedores: http://ark4n.files.wordpress.com/2010/01/python_para_desenvolvedores_2ed.pdf Download de vários livros(inglês): http://it-ebooks.info/search/?q=Python&type=title 57 livros/apostilas sobre Python(torrent): http://kat.ph/python-book-collection-t6830161.html ##### # # Playing wavs with scipy # 2013aug12 # ##### # «scipy-wav» (to ".scipy-wav") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cp -v ~/TH/L/html5-audio.mp3 /tmp/in.mp3 avconv -y -i /tmp/in.mp3 /tmp/in.wav # (find-sh "file /tmp/in.wav") file /tmp/in.wav * (eepitch-python) * (eepitch-kill) * (eepitch-python) import scipy wavfile = "/tmp/in.wav" from scipy.io import wavfile as w amostras = w.read(wavfile)[1] .. usa o scipy.io para abrir o wav from scipy.io import wavfile as w amostras = w.read('foo.wav')[1] se quiser uma lib mais porreta, tem a pysndobj e pyo <edrx> can anyone recommend me an audio library for python in which I can play sounds and use the repl at the same time? for example, one in which I can read the value of nowplaying1.currentTime, and in which changing that value would make the player skip to another position... <edrx> alguem pode me recomendar alguma biblioteca pra python na qual eu consiga tocar arquivos de audio e rodar a repl ao mesmo tempo? <edrx> o que eu queria fazer era o seguinte: deem uma olhada em http://angg.twu.net/html5-audio.html - os links do final tocam um arquivo mp3 a partir de um certo ponto... e o player de audio roda em paralelo com o javascript console e com a parte do browser que interpreta cliques e outros eventos na pagina html renderizada... <edrx> isto talvez seja uma pergunta boba, mas la vai... <edrx> meu arquivo /tmp/in.wav parece ser um arquivo WAV todo certinho... acabei de cria-lo com ffmpeg a partir de um mp3, e "file /tmp/in.wav" diz isto: <edrx> /tmp/in.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz <edrx> mas ai' eu rodo isto... <edrx> import scipy <edrx> wavfile = "/tmp/in.wav" <edrx> from scipy.io import wavfile as w <edrx> amostras = w.read(wavfile)[1] <edrx> e ganho: <edrx> /usr/lib/python2.7/dist-packages/scipy/io/wavfile.py:31: WavFileWarning: Unfamiliar format bytes <edrx> warnings.warn("Unfamiliar format bytes", WavFileWarning) <edrx> e quando eu tento examinar o "amostras" ganho isto: <edrx> NameError: name 'amostras' is not defined <edrx> (obs: se eu desconectar do canal e' so' porque o meu cliente de irc ta' mal configurado, nao porque eu desisti...) http://freenet.mcnabhosting.com/python/pyPortAudio/ http://inventwithpython.com/blog/2010/09/01/the-top-10-pygame-tutorials/ http://pygametutorials.wikidot.com/ http://pymedia.org/tut/index.html http://pymedia.org/tut/src/play_wav.py.html http://rope.sourceforge.net/ropemacs.html http://www.youtube.com/watch?v=EHvQG7dbk_8 RT 2011 - Screencast 08 - Python part 2 - Running Python Code http://www.youtube.com/watch?v=JhAF6puNTxI Audio in Python - introduction (Software Carpentry) (LOW-RES) http://www.youtube.com/watch?v=OMi-uN-6O1Q Emacs as a Python IDE http://www.youtube.com/watch?v=nnuEqzAAkHw pygame - tutorial part 1 https://pypi.python.org/pypi/PyAudio/ pygame # (find-status "python-pyaudio") # (find-vldifile "python-pyaudio.list") # (find-udfile "python-pyaudio/") # (find-status "python-rope") # (find-vldifile "python-rope.list") # (find-udfile "python-rope/") # (find-status "python-ropemacs") # (find-vldifile "python-ropemacs.list") # (find-udfile "python-ropemacs/") # (find-status "pymacs") # (find-vldifile "pymacs.list") # (find-udfile "pymacs/") ##### # # pip # 2019aug03 # ##### # «pip» (to ".pip") # https://linuxize.com/post/how-to-install-pip-on-debian-9/ # https://pip.pypa.io/en/stable/user_guide/ # https://www.tecmint.com/install-pip-in-linux/ # (find-zsh "apt-file search bin/pip") # (find-zsh "installeddebs | sort | grep pip") # (find-zsh "availabledebs | sort | grep pip") # (find-zsh "availabledebs | sort | grep python | grep pip") # (find-angg ".zshrc" "pip-path") # (find-status "python3-pip") # (find-vldifile "python3-pip.list") # (find-udfile "python3-pip/") # (find-fline "/usr/lib/python3/dist-packages/pip/") python-pip: /usr/bin/pip python-pip: /usr/bin/pip2 python3-pip: /usr/bin/pip3 * (eepitch-shell2) apti python-pip apti python3-pip * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) pip3 pip3 install ipython pip3 install youtube-dl ##### # # pip3-upgrade # 2022may01 # ##### # «pip3-upgrade» (to ".pip3-upgrade") # (find-sh "pip3 --help") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) pip3 --upgrade pip3 list pip3 list | awk 'NR > 2 {print $1}' | tee /tmp/o pip3 install $(cat /tmp/o) pip3 install --upgrade $(cat /tmp/o) Requirement already satisfied: dblatex in /usr/lib/python3/dist-packages (0.3.12) Collecting dblatex Downloading dblatex-0.3.10.tar.bz2 (1.7 MB) |████████████████████████████████| 1.7 MB 12.5 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_0e48fa1858794329b03ea0964192e516/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_0e48fa1858794329b03ea0964192e516/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-_10_4xy3 cwd: /tmp/pip-install-xljt60ni/dblatex_0e48fa1858794329b03ea0964192e516/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_0e48fa1858794329b03ea0964192e516/setup.py", line 86 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/a8/1c/a07b54389399ac0c014c175936eb142f562468c607150a2df3e94d365611/dblatex-0.3.10.tar.bz2#sha256=56fee45ef3c242c4800bad20c5aeb934b31ba0894bdf86275b60b2e7b2f4cb8e (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.9.tar.bz2 (1.7 MB) |████████████████████████████████| 1.7 MB 9.7 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_05d15e3c8c7b486294be3e83d8466af9/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_05d15e3c8c7b486294be3e83d8466af9/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-85z5503m cwd: /tmp/pip-install-xljt60ni/dblatex_05d15e3c8c7b486294be3e83d8466af9/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_05d15e3c8c7b486294be3e83d8466af9/setup.py", line 86 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/51/1b/688fcc3766dda4b3c1b90ba5f77584bf716fd63b160653983635baf1d324/dblatex-0.3.9.tar.bz2#sha256=493f7f8f6234794379e47560ec24c9abcb4bd5bdc9c4bd659175046a33211223 (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.8.1.tar.bz2 (1.6 MB) |████████████████████████████████| 1.6 MB 9.8 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_63aa375a01c1405c982bb4989a50333c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_63aa375a01c1405c982bb4989a50333c/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-vlneou_m cwd: /tmp/pip-install-xljt60ni/dblatex_63aa375a01c1405c982bb4989a50333c/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_63aa375a01c1405c982bb4989a50333c/setup.py", line 86 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/d1/05/c9f5d1ead06d29d4dfa23fd4d406fd742ee7556670798edc97e28bedd23a/dblatex-0.3.8.1.tar.bz2#sha256=f2716eb47d50d8c8d5588592c50e414ecda4480e92cd82086cdc47e2d3df3947 (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.7.tar.bz2 (1.5 MB) |████████████████████████████████| 1.5 MB 11.1 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_9a202530b6b740e68154c2e8807b78d0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_9a202530b6b740e68154c2e8807b78d0/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-q1vjpfn9 cwd: /tmp/pip-install-xljt60ni/dblatex_9a202530b6b740e68154c2e8807b78d0/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_9a202530b6b740e68154c2e8807b78d0/setup.py", line 86 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/01/ae/cce6b462aa6b25e5e80dfb42cb7d2888f5b3a82efbf6f0dd54996e3d681e/dblatex-0.3.7.tar.bz2#sha256=4e868fe5c481467ab33e1e0e7f2db7477d9e979084aea4256f63eb4942b438fe (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.6.tar.bz2 (1.5 MB) |████████████████████████████████| 1.5 MB 11.2 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_879b203a2ad943b0bcdd47368d2f3061/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_879b203a2ad943b0bcdd47368d2f3061/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-o04bfzlk cwd: /tmp/pip-install-xljt60ni/dblatex_879b203a2ad943b0bcdd47368d2f3061/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_879b203a2ad943b0bcdd47368d2f3061/setup.py", line 86 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/22/dd/3574e172fead961907274bd6f3a7e59d603f8916488db4f9fc0a4ac1fa4f/dblatex-0.3.6.tar.bz2#sha256=31b3105180ed79fad0ac81c7d32dafd941d040b99ae359f0149171241f2447ce (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.5.tar.bz2 (1.4 MB) |████████████████████████████████| 1.4 MB 10.9 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_d8b1b62ceb974563bd5c4f91a7012116/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_d8b1b62ceb974563bd5c4f91a7012116/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-bxo1ci5c cwd: /tmp/pip-install-xljt60ni/dblatex_d8b1b62ceb974563bd5c4f91a7012116/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_d8b1b62ceb974563bd5c4f91a7012116/setup.py", line 86 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/c1/14/cc893aa9124725960934129f924eca3c46a6f868d80ea9ea2cdf5f083a0b/dblatex-0.3.5.tar.bz2#sha256=faf8373231f4cf94c20194c8282cb7b2bad9b507d3ef678d105906922682299d (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.4.tar.bz2 (1.5 MB) |████████████████████████████████| 1.5 MB 11.2 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_624499ccbd66436d982db296b52e9558/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_624499ccbd66436d982db296b52e9558/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-aozqepgp cwd: /tmp/pip-install-xljt60ni/dblatex_624499ccbd66436d982db296b52e9558/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_624499ccbd66436d982db296b52e9558/setup.py", line 86 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/84/b4/062816b3592a13e0955175d6880c6edd89f387f11d590c15232296ef1603/dblatex-0.3.4.tar.bz2#sha256=5ca67bf5e51bd6ad94426524c599f41b9f00c5589e7fba7ebfb6bcac6d8ba3cf (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.3.tar.bz2 (1.4 MB) |████████████████████████████████| 1.4 MB 9.3 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_6dcb9ae4601e49a3871a07b2fb101e27/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_6dcb9ae4601e49a3871a07b2fb101e27/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-kgf47wcx cwd: /tmp/pip-install-xljt60ni/dblatex_6dcb9ae4601e49a3871a07b2fb101e27/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_6dcb9ae4601e49a3871a07b2fb101e27/setup.py", line 85 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/80/0d/a5e5eada0a9443939a3b44366aa7c671525f7a22d5b2debc6f49e971f481/dblatex-0.3.3.tar.bz2#sha256=5903255da7ac15f0f090a16b577f129c0beabdc074b4b2a40bc43fc932ae7031 (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.2.tar.bz2 (1.2 MB) |████████████████████████████████| 1.2 MB 11.2 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_187e182fb3d945dbb2595180567d2dd7/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_187e182fb3d945dbb2595180567d2dd7/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-kyg9hnjz cwd: /tmp/pip-install-xljt60ni/dblatex_187e182fb3d945dbb2595180567d2dd7/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_187e182fb3d945dbb2595180567d2dd7/setup.py", line 85 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/bb/1b/92a287d4ca36c378d1fa7bc76c5922e525d1b0b4a495bd4d7b90e81f2114/dblatex-0.3.2.tar.bz2#sha256=7a25bc0bbb990100b365e9dbbd118d4986e0a1eec595b3c2086da534436cdd9b (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Downloading dblatex-0.3.1.1.tar.bz2 (1.2 MB) |████████████████████████████████| 1.2 MB 9.7 MB/s ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-xljt60ni/dblatex_be89b4d5fb214d2f892d643248cd699b/setup.py'"'"'; __file__='"'"'/tmp/pip-install-xljt60ni/dblatex_be89b4d5fb214d2f892d643248cd699b/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-jxgn5162 cwd: /tmp/pip-install-xljt60ni/dblatex_be89b4d5fb214d2f892d643248cd699b/ Complete output (6 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-xljt60ni/dblatex_be89b4d5fb214d2f892d643248cd699b/setup.py", line 82 print self._package_base ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(self._package_base)? ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/e6/bd/887d042a621631938432678e92c2314b89c682fd39acefbffe6ac27dc3d0/dblatex-0.3.1.1.tar.bz2#sha256=7b323f27c75e717536dd1f80605c40a2da187d0a50b814af2013a0f5a64c6d64 (from https://pypi.org/simple/dblatex/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ##### # # Pip as root (don't!) # 2019sep25 # ##### # «pip-as-root» (to ".pip-as-root") # (find-fline "~/LOGS/2019sep25.python" "when you run sudo pip") # (find-fline "/usr/local/lib/") # (find-fline "/usr/local/lib/python2.7/dist-packages/") # (find-fline "/usr/local/lib/python3.5/dist-packages/") # (find-asrootfile "/usr/local/lib/python3.5/dist-packages/") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-man "pip3") strace -o /tmp/s2 pip strace -o /tmp/s3 pip3 # (find-fline "/tmp/s2") # (find-sh "sort /tmp/s2") # (find-sh "sort /tmp/s2 | grep -v ENOENT") # (find-sh "sort /tmp/s2 | grep -v ENOENT | grep open") # (find-sh "sort /tmp/s3 | grep -v ENOENT | grep open") # (find-sh "cat /tmp/s3 | grep -v ENOENT | grep open") # (find-fline "~/.local/lib/python2.7/site-packages/") # (find-fline "~/.local/lib/python3.5/site-packages/") # (find-fline "~/.local/lib/") # (find-asrootfile "/usr/local/lib/python3.5/" "dist-packages/") # (find-asrootfile "/home/edrx/.local/lib/python3.5/") # (find-asrootfile "/home/edrx/.local/lib/python3.5/" "site-packages/") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) pip3 pip3 install ipython # (find-sh "pip3") # (find-sh "pip3 list") # (find-sh "pip3 show pycurl") ##### # # pip-from-git # 2019sep25 # ##### # «pip-from-git» (to ".pip-from-git") # https://packages.debian.org/sid/python-pip # https://packages.debian.org/sid/python3-pip # https://en.wikipedia.org/wiki/Pip_(package_manager) # https://pip.pypa.io/en/stable/ # https://pip.pypa.io/en/stable/user_guide/ # https://pip.pypa.io/en/stable/reference/ # https://pip.pypa.io/en/stable/quickstart/ # https://github.com/pypa/pip # (find-git-links "https://github.com/pypa/pip" "pipgit") # (find-fline "~/LOGS/2019sep25.pypa") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # rm -Rfv ~/usrc/pip/ cd ~/usrc/ git clone https://github.com/pypa/pip cd ~/usrc/pip/ git branch --list -a git for-each-ref PAGER=cat git log --oneline --graph --all -20 # (find-fline "~/usrc/") # (find-fline "~/usrc/pip/") # (find-gitk "~/usrc/pip/") # (code-c-d "pipgit" "~/usrc/pip/") # (find-pipgitfile "") # (find-pipgitfile "tox.ini") # (find-pipgitfile "tox.ini" "[testenv:docs]") <edrx> hi, I just downloaded the pip source from <https://github.com/pypa/pip> because I wanted to have a local copy of the docs, but I can't figure out how to compile it... I was expecting to be able to do something like "make docs", but it seems that it uses other tools... any hints? <altendky> edrx: https://github.com/pypa/pip/blob/master/tox.ini#L36-L41 # (find-man "sphinx-build") # (find-pipgitfile "docs/html/") # cd ~/usrc/pip/ sphinx-build -W -d _envtmpdir_/doctrees/html -b html docs/html docs/build/html sphinx-build -W -d _envtmpdir_/doctrees/man -b man docs/man docs/build/man -c docs/html # # Extension error: # Could not import extension pip_sphinxext (exception: No module named 'pip._internal') ##### # # tox # 2019sep25 # ##### # «tox» (to ".tox") # https://en.wikipedia.org/wiki/Tox_(Python_testing_wrapper) # (find-status "tox") # (find-vldifile "tox.list") # (find-udfile "tox/") # (find-fline "/usr/share/doc/tox/html/") # file:///usr/share/doc/tox/html/index.html # (find-man "1 tox") tox -h apt-cache show tox apt-cache search tox apt-cache depends tox apt-cache rdepends tox ##### # # virtualenv (2019) # 2019sep25 # ##### # «virtualenv» (to ".virtualenv") # (find-fline "~/LOGS/2019sep25.python2" "virtualenv -p") # (find-status "virtualenv") # (find-vldifile "virtualenv.list") # (find-udfile "virtualenv/") # (find-status "python3-virtualenv") # (find-vldifile "python3-virtualenv.list") # (find-udfile "python3-virtualenv/") # (find-man "1 virtualenv") # (find-man "1 virtualenv" "-p PYTHON_EXE") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) sudo apt install virtualenv * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rv /tmp/myenv/ cd /tmp/ virtualenv -p python3 myenv |& tee ov myenv/bin/pip install tox |& tee opi # # (find-fline "/tmp/myenv/") # (find-fline "/tmp/myenv/bin/") # myenv/bin/python myfile.py ##### # # poetry # 2019sep25 # ##### # «poetry» (to ".poetry") # https://poetry.eustace.io/ # https://poetry.eustace.io/docs/ # (find-fline "~/LOGS/2019sep25.python2" "poetry instead of setup.py") # (find-fline "~/LOGS/2019sep25.python2" "poetry new --src") # http://blog.habnab.it/blog/2013/07/21/python-packages-and-you/ * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv ~/.poetry/ # curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3 # (find-fline "~/.poetry/") # (find-fline "~/.poetry/env") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) source ~/.poetry/env cd /tmp/ poetry new --src myproject ##### # # pip, requests, virtualenv (for facebook-sdk) # 2014aug18 # ##### # «requests» (to ".requests") # (find-zsh "availabledebs | sort | grep requ") # (find-status "python-pip") # (find-vldifile "python-pip.list") # (find-udfile "python-pip/") # (find-udfile "python-pip/usage.txt.gz") # (find-udfile "python-pip/usage.rst") # (find-status "python-requests") # (find-vldifile "python-requests.list") # (find-udfile "python-requests/") # (find-status "python-virtualenv") # (find-vldifile "python-virtualenv.list") # (find-udfile "python-virtualenv/") * (eepitch-shell2) apti python-pip sudo apt-get install python-pip python-requests python-virtualenv sudo pip install facebook-sdk # sudo apt-get install python-dev-all # https://pypi.python.org/pypi/requests # http://www.pip-installer.org/ # http://www.virtualenv.org/ # https://virtualenv.pypa.io/en/latest/ # (find-fline "/usr/local/lib/python2.7/dist-packages/") # (find-fline "/usr/local/lib/python2.7/dist-packages/facebook.py") ##### # # PyPi # 2019may21 # ##### # «pypi» (to ".pypi") # https://pypi.org/ # https://packaging.python.org/tutorials/installing-packages/ # (find-zsh "installeddebs | sort | grep pip") # (find-zsh "availabledebs | sort | grep pip") # https://packaging.python.org/guides/installing-using-linux-tools/ aptrm python-pygments python3-pygments * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd /tmp/ wget https://bootstrap.pypa.io/get-pip.py sudo python3 get-pip.py --prefix=/usr/local/ sudo pip install -U sphinx sudo pip install -U pygments ##### # # facebook-sdk # 2014aug18 # ##### # «facebook-sdk» (to ".facebook-sdk") # (find-angg ".emacs" "pyfb") # https://developers.facebook.com/docs/other-sdks # https://github.com/pythonforfacebook/facebook-sdk # http://pythonforfacebook.com/ # (find-git-links "https://github.com/pythonforfacebook/facebook-sdk" "pyfb") # (find-pyfbfile "") # (find-pyfbfile "docs/") # (find-pyfbfile ".travis.yml" "FACEBOOK_APP_ID=") # (find-pyfbfile "examples/") # (find-pyfbfile "examples/get_posts.py") # (find-pyfbfile "docs/install.rst") # (find-pyfbfile "docs/install.rst" "requests") # (find-pyfbfile "docs/install.rst" "pip") # (find-pyfbfile "docs/install.rst" "virtualenv") # (find-fline "/usr/local/lib/python2.7/dist-packages/") # (find-fline "/usr/local/lib/python2.7/dist-packages/facebook.py") ##### # # textwrap # 2014aug30 # ##### # «textwrap» (to ".textwrap") # http://pymotw.com/2/textwrap/ # http://pymotw.com/2/articles/text_processing.html#article-text-processing # http://docs.python.org/lib/module-textwrap.html ##### # # easyhtmlparser # 2014aug28 # ##### # «easyhtmlparser» (to ".easyhtmlparser") # http://easyhtmlparser.sourceforge.net/ http://sourceforge.net/projects/easyhtmlparser/files/ * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-fline "~/usrc/ehp-1.3/") rm -Rv ~/usrc/ehp-1.3/ tar -C ~/usrc/ -xvzf ~/tmp/ehp-1.3.tar.gz cd ~/usrc/ehp-1.3/ ;; (code-c-d "ehp" "~/usrc/ehp-1.3/") ;; (find-ehpfile "") # python setup.py install python setup.py install --user # Writing /home/edrx/.local/lib/python2.7/site-packages/ehp-1.3.egg-info # (find-fline "~/.local/lib/python2.7/site-packages/") # (find-fline "~/.local/lib/python2.7/site-packages/ehp-1.3.egg-info") git clone ssh://olliveira@git.code.sf.net/p/easyhtmlparser/code easyhtmlparser-code ##### # # oilercode # 2014aug28 # ##### # «oilercode» (to ".oilercode") # (find-git-links "git://git.code.sf.net/p/oiler/code" "oilercode") # (code-c-d "oilercode" "~/usrc/code/") # (find-oilercodefile "") # (find-oilercodefile "python/edu/") # (code-c-d "oilercode" "~/usrc/code/") # (find-oilercodefile "") # (find-oilercodefile "python/edu/") # (find-oilercodefile "python/edu/run") # (find-oilercodefile "python/edu/fbtxt.py") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) cd ~/usrc/code/python/edu/ git pull --depth 1 cd ~/usrc/code/python/edu/ ls python fbtxt.py fb2 python fbtxt.py fb2ah >> fb3-txt vy fb3-txt url = "https://www.facebook.com/sergio.martins.984991/posts/10152616093738086" fname = "posts_sergio.martins.984991_10152616093738086" if not file_exists(fname..".raw") then end data = curl(url) ##### # # faceutils (by Tau) # 2014aug30 # ##### # «faceutils» (to ".faceutils") # (find-angg ".emacs" "faceutils") # (find-fline "~/usrc/faceutils-code/") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) # (find-fline "~/.local/lib/python2.7/site-packages/" "faceutils") rm -Rv ~/.local/lib/python2.7/site-packages/faceutils* rm -Rfv ~/usrc/faceutils-code/ cd ~/usrc/ git clone git://git.code.sf.net/p/faceutils/code faceutils-code cd ~/usrc/faceutils-code/ python setup.py install --user |& tee osi cd ~/usrc/faceutils-code/ git pull python setup.py install --user |& tee osi # (find-gitk "~/usrc/faceutils-code/") # (find-faceutilsfile "") # «faceutils-wrap» (to ".faceutils-wrap") * (eepitch-python) * (eepitch-kill) * (eepitch-python) from faceutils import * from textwrap import wrap MAX = 69 dir = "/home/edrx/usrc/faceutils-code/wget/" fname = dir + "posts_ortelladopablo_759874930744749.wget" data0 = open(fname, 'r').read() data = normalize(data0) dom = Html().feed(data) post = str(extract_text(dom)) post = '\n'.join(wrap(post, MAX)) post = post.decode('string-escape') print post xs, ns = extract_comment(data) ns = map(lambda it: '\n'.join(wrap(it, MAX)), ns) co = '%s\n%s\n%s\n%s' % ("People who commented.", xs, 'Commentaries.', ns) co = co.decode('string-escape') print co # (find-fline "~/usrc/faceutils-code/") cd ~/usrc/faceutils-code/ data = normalize(data0) dom = Html().feed(data) print extract_text(dom) print extract_comment(data) fname = dir + "photofs_10204370918135974_np.104536042.1523735650.wget" (code-c-d "faceutils" "~/usrc/faceutils-code/") ;; (find-faceutilsfile "") ;; (find-faceutilsfile "faceutils.py") ;; (find-faceutilsfile "fbtxt") ;; (find-faceutilsfile "wget/") # (find-fline "/tmp/faceutils-code/") Cloning into 'faceutils-code'... warning: You appear to have cloned an empty repository. ##### # # Translating string.gsub to Python # 2014sep06 # ##### # «string.gsub.old» (to ".string.gsub") # (find-angg "fbcache/p.py" "regexps") * (eepitch-python) * (eepitch-kill) * (eepitch-python) from re import sub from re import search REG = '[WR]' DATA ='/W/photos/W/WR' def replace(match): REP = { 'W':'([^/]+)', 'R':'(.*)'} return REP[match.group(0)] print sub(REG, replace, DATA) REG = "/([^/]+)/photos/([^/]+)/([^/]+)(.*)" DATA = "/398254483624546/photos/a.398287033621291.1073741830.398254483624546/480321305417863/?type=1" item = search(REG, DATA) print item.groups() "photos_%s_%s_%s" % item.groups()[:3] "photos_%s_%s_%s".count("%") # «string.gsub» (to ".string.gsub") * (eepitch-python) * (eepitch-kill) * (eepitch-python) # (find-faceutilsfile "url.py") # (find-angg "fbcache/p.py") import re def string_format (fmt, tuple): return fmt % (tuple[:fmt.count("%s")]) def string_match (str, r): return re.search(r, str).groups() r = "/([^/]+)/photos/([^/]+)/([^/]+)(.*)" r = "^/([^/]+)/photos/([^/]+)/([^/]+)(.*)$" str = "/398254483624546/photos/a.3.30.39824546/480863/?type=1" str = "/398254483624546/photos/a.3.30.39824546/480863/?type=1" m = re.search(r, str) print m print m.groups() print re.search(r, str).groups() re.escape(r) # Test: string_format("<%s_%s>", ("aa", "bb", "cc")) # string_format(fmt, string_match(str, r)) lambda (m): return tbl[m.group(0)] item = re.search(indi, str) try: xs = item.groups() except AttributeError: pass else: return indj % xs[:indz] import re search(re, str).groups() tbl = {"a":"AA", "b":"BB"} re.search def string_gsub_s (str, re, repl_str): return def string_gsub_f (str, re, repl_f): return def string_gsub_t (str, re, repl_str): return f = lambda def string_match (str, re): return # file:///usr/share/doc/python2.7/html/howto/regex.html # file:///usr/share/doc/python2.7/html/howto/regex.html#search-and-replace # file:///usr/share/doc/python2.7/html/library/re.html # file:///usr/share/doc/python2.7/html/library/re.html#re.MatchObject.groups # file:///usr/share/doc/python2.7/html/library/stdtypes.html#str.count # file:///usr/share/doc/python2.7/html/reference/executionmodel.html#naming # file:///usr/share/doc/python2.7/html/reference/expressions.html#lambda ##### # # encoding # 2014sep11 # ##### # «encoding» (to ".encoding") # SyntaxError: Non-ASCII character '\xc2' in file foo.py on line 3, # but no encoding declared; see # http://www.python.org/peps/pep-0263.html # for details # (find-anggfile "fbcache/p.py" "vim: set fileencoding=latin-1") ##### # # Scope (of variables) # 2014sep21 # ##### # «scope» (to ".scope") # file:///usr/share/doc/python2.7/html/reference/executionmodel.html#index-1 # file:///usr/share/doc/python2.7/html/tutorial/classes.html # file:///usr/share/doc/python2.7/html/tutorial/classes.html#python-scopes-and-namespaces ##### # # import # 2014oct01 # ##### # «import» (to ".import") # file:///usr/share/doc/python2.7/html/reference/simple_stmts.html#the-import-statement # file:///usr/share/doc/python3.5/html/reference/simple_stmts.html#the-import-statement ##### # # inspect # 2020oct15 # ##### # «inspect» (to ".inspect") # https://docs.python.org/3/library/inspect.html # https://docs.python.org/3/library/inspect.html#module-inspect # https://pymotw.com/2/inspect/ # https://www.tutorialspoint.com/inspect-live-objects-in-python # https://gist.github.com/amitsaha/3486802 # (find-sh "locate python | grep inspect") # file:///usr/share/doc/python3.7/html/library/inspect.html # file:///usr/share/doc/python3.7/html/library/inspect.html#module-inspect # file:///usr/share/doc/python3.7/html/library/inspect.html#classes-and-functions * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) import re import inspect # import pprint from pprint import pprint re type(re) pprint(inspect.getmembers(re)) ##### # # re # 2020oct15 # ##### # «re» (to ".re") # (find-books "__comp/__comp.el" "python-downey") * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) import re re type(re) ##### # # re.sub # 2019aug04 # ##### # «re.sub» (to ".re.sub") # file:///usr/share/doc/python2.7/html/library/re.html#re.sub # file:///usr/share/doc/python3.7/html/library/re.html#re.sub # (find-man "python3") # (find-angg ".pythonrc.py") * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) import re re type(re) ee_dofile("/tmp/foo.py") ##### # # u8_to_l1 # 2014oct13 # ##### # «u8_to_l1» (to ".u8_to_l1") # (find-angg "LUA/lua50init.lua" "u8_to_l1") # (find-fline "~/LOGS/2014oct12.eev") # (find-fline "~/LOGS/2014oct12.python") # http://nedbatchelder.com/text/unipain.html # https://www.youtube.com/watch?v=sgHbC6udIqc # (find-youtubedl-links "/sda5/videos/" "Pragmatic_Unicode_or_How_do_I_stop_the_pain" "sgHbC6udIqc" ".mp4" "pragmaticunicode") # (code-video "pragmaticunicodevideo" "/sda5/videos/Pragmatic_Unicode_or_How_do_I_stop_the_pain-sgHbC6udIqc.mp4") # (find-pragmaticunicodevideo) # (find-pragmaticunicodevideo "0:00") # (find-pragmaticunicodevideo "9:16" "Python 2") * (eepitch-python) * (eepitch-kill) * (eepitch-python) import re str1 = u'\xc3\x80' str2 = u'abc \xc3\x80 def' '\xc3\x80' u'\xc3\x80' chr(192) def u8_to_l1(str): f = lambda (m): chr(ord(m.group(0)[1]) + 64) return re.sub("\xc3[\x80-\xbf]", f, str) u8_to_l1('\xc3\x80') u8_to_l1(u'\xc3\x80') * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) str1 = '\xc3\x80' str2 = 'abc \xc3\x80 def' '\xc3\x80' '\xc3\x80' chr(192) # file:///usr/share/doc/python3.2/html/reference/expressions.html#lambda def u8_to_l1(str): f = lambda m: chr(ord(m.group(0)[1]) + 64) return re.sub("\xc3[\x80-\xbf]", f, str) u8_to_l1('\xc3\x80') u8_to_l1(u'\xc3\x80') ##### # # dict methods # 2014oct25 # ##### # «dict» (to ".dict") # file:///usr/share/doc/python2.7/html/tutorial/datastructures.html#dictionaries # file:///usr/share/doc/python2.7/html/library/stdtypes.html#index-31 # file:///usr/share/doc/python2.7/html/library/stdtypes.html#dict.items # https://docs.python.org/2.7/tutorial/datastructures.html#dictionaries file:///usr/share/doc/python2.7/html/c-api/dict.html?highlight=dict * (eepitch-python) * (eepitch-kill) * (eepitch-python) tel = {'jack': 4098, 'sape': 4139} tel['guido'] = 4127 tel tel['jack'] del tel['sape'] tel['irv'] = 4127 tel tel.keys() 'guido' in tel dict([('sape', 4139), ('guido', 4127), ('jack', 4098)]) {x: x**2 for x in (2, 4, 6)} dict(sape=4139, guido=4127, jack=4098) ##### # # print # 2016jul23 # ##### # «print» (to ".print") # https://docs.python.org/2.7/library/functions.html#print # https://docs.python.org/2.7/reference/simple_stmts.html # https://docs.python.org/2.7/reference/simple_stmts.html#the-print-statement # file:///usr/share/doc/python2.7/html/reference/simple_stmts.html#the-print-statement # file:///usr/share/doc/python3.5/html/whatsnew/3.0.html#print-is-a-function # Old: print "The answer is", 2*2 # New: print("The answer is", 2*2) ##### # # Tuples # 2016jul23 # ##### # «tuples» (to ".tuples") # «tut-tuples» (to ".tut-tuples") # https://docs.python.org/3/tutorial/datastructures.html # https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences # (to "print") * (eepitch-python) * (eepitch-kill) * (eepitch-python) t = 12345, 54321, 'hello!' t[0] t # Tuples may be nested: u = t, (1, 2, 3, 4, 5) u # Tuples are immutable: t[0] = 88888 # but they can contain mutable objects: v = ([1, 2, 3], [3, 2, 1]) v ##### # # Tutorial: def (and local variables) # 2016jul23 # ##### # «tut-def» (to ".tut-def") # https://docs.python.org/3/tutorial/controlflow.html#defining-functions # https://docs.python.org/2.7/tutorial/controlflow.html#defining-functions * (eepitch-python) * (eepitch-kill) * (eepitch-python) def fib(n): # write Fibonacci series up to n """Print a Fibonacci series up to n.""" a, b = 0, 1 while a < n: print a, # print(a, end=' ') a, b = b, a+b # print() # Now call the function we just defined: fib(2000) fib f = fib f(100) fib(0) print(fib(0)) def fib2(n): # return Fibonacci series up to n """Return a list containing the Fibonacci series up to n.""" result = [] a, b = 0, 1 while a < n: result.append(a) # see below a, b = b, a+b return result f100 = fib2(100) # call it f100 # write the result ##### # # def # 2019aug03 # ##### # «def» (to ".def") # file:///usr/share/doc/python3.7/html/reference/compound_stmts.html#def # file:///usr/share/doc/python3.7/html/reference/executionmodel.html#naming # (find-downeytppage (+ 22 61) "6. Fruitful Functions.") ##### # # Comprehension # 2016aug23 # ##### # «comprehension» (to ".comprehension") # https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions # https://docs.python.org/3/tutorial/datastructures.html#nested-list-comprehensions # http://treyhunner.com/2015/12/python-list-comprehensions-now-in-color/ # Also: dict comprehensions, set comprehensions ##### # # Multiline comments # 2019jun15 # ##### # «multiline-comments» (to ".multiline-comments") # https://stackoverflow.com/questions/7696924/way-to-create-multiline-comments-in-python ##### # # lambda # 2019jun15 # ##### # «lambda» (to ".lambda") # (find-py2docsrcgrep "grep --color -niH -e lambda whatsnew/*") # (find-py3docsrcgrep "grep --color -niH -e lambda whatsnew/*") # (find-py2docsrcgrep "grep --color -niH -e lambda reference/*") # (find-py3docsrcgrep "grep --color -niH -e lambda reference/*") # file:///usr/share/doc/python2.7/html/reference/expressions.html#lambda # file:///usr/share/doc/python3.5/html/reference/expressions.html#lambda # file:///usr/share/doc/python3.5/html/reference/expressions.html#expression-lists * (eepitch-python) * (eepitch-kill) * (eepitch-python) lambda: 2+3 * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) lambda: 2+3 # (find-angg ".pythonrc.py") ##### # # after # 2019jul02 # ##### # «after» (to ".after") # https://gitlab.com/juanmeleiro/after * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv ~/usrc/after/ cd ~/usrc/ git clone https://gitlab.com/juanmeleiro/after cd ~/usrc/after/ # (find-fline "~/usrc/") # (find-fline "~/usrc/after/") # (code-c-d "after" "~/usrc/after/") # (find-afterfile "") # (find-afterfile "after") # (find-gitk "~/usrc/after/") ##### # # graphics.py # 2019jul17 # ##### # «graphics.py» (to ".graphics.py") # https://www.youtube.com/watch?v=R39vTAj1u_8 # (find-anggfile "PYTHON/gra.py") # https://mcsp.wartburg.edu/zelle/python/ # https://mcsp.wartburg.edu/zelle/python/graphics.py # https://mcsp.wartburg.edu/zelle/python/graphics/graphics/index.html # https://mcsp.wartburg.edu/zelle/python/graphics/graphics.pdf # (find-sh "cp -v $S/https/mcsp.wartburg.edu/zelle/python/graphics.py ~/PYTHON/") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) ##### # # python-for-cs1 # 2019jul17 # ##### # «python-for-cs1» (to ".python-for-cs1") # https://mcsp.wartburg.edu/zelle/python/ # Picking a Language for Introductory CS - Why I don't like Python () # https://medium.com/@drmarkclewis/picking-a-languages-for-introductory-cs-the-argument-againstpython-4331cca26cfa # https://dynamicsofprogramming.blogspot.com/2019/02/problems-with-python-for-introductory-cs.html ##### # # turtle # 2019jul17 # ##### # «turtle» (to ".turtle") # file:///usr/share/doc/python2.7/html/library/turtle.html # file:///usr/share/doc/python3.5/html/library/turtle.html # https://docs.python.org/3/library/turtle.html * (eepitch-python) * (eepitch-kill) * (eepitch-python) from turtle import * color('red', 'yellow') begin_fill() while True: forward(200) left(170) if abs(pos()) < 1: break end_fill() done() ##### # # help # 2019jul17 # ##### # «help» (to ".help") # file:///usr/share/doc/python2.7/html/library/functions.html#help # file:///usr/share/doc/python3.5/html/library/functions.html#help * (eepitch-python) * (eepitch-kill) * (eepitch-python) import os os.environ["PAGER"] = "cat" help(os) help(help) ##### # # Books about Python # 2019aug03 # ##### # «books» (to ".books") # (find-books "__comp/__comp.el" "python") # https://realpython.com/best-python-books/ # https://realpython.com/best-python-books/#fluent-python-clear-concise-and-effective-programming # https://realpython.com/best-python-books/#think-python # https://realpython.com/best-python-books/#fluent-python # https://stackabuse.com/the-best-python-books-for-all-skill-levels/ # https://hackr.io/blog/best-python-books-for-beginners-and-advanced-programmers ##### # # popen (is obsolete; use subprocess) # 2019aug03 # ##### # «popen» (to ".popen") # (find-books "__comp/__comp.el" "python") # (find-downeytppage (+ 22 171) "Pipes") # file:///usr/share/doc/python2.7/html/library/os.html#os.popen # file:///usr/share/doc/python2.7/html/library/subprocess.html # file:///usr/share/doc/python3.5/html/library/subprocess.html # file:///usr/share/doc/python3.5/html/library/subprocess.html#subprocess.run * (eepitch-python3) * (eepitch-kill) * (eepitch-python3) import subprocess o = subprocess.run(["ls", "-l"]) o = subprocess.run(["ls", "-l", "/dev/null"], stdout=subprocess.PIPE) o = subprocess.run("ls -l /dev/null".split(), stdout=subprocess.PIPE) o o.stdout def getoutput(cmd): return subprocess.run(cmd.split(), stdout=subprocess.PIPE).stdout getoutput("ls -l /dev/null") ##### # # bytes # 2019aug03 # ##### # «bytes» (to ".bytes") # file:///usr/share/doc/python3.5/html/library/functions.html#bytes # file:///usr/share/doc/python3.5/html/library/functions.html#bytearray # file:///usr/share/doc/python3.5/html/reference/lexical_analysis.html#strings # file:///usr/share/doc/python3.5/html/library/stdtypes.html#binaryseq # (find-downeytppage (+ 22 170) "The result is a bytes object") # (find-downeytptext (+ 22 170) "The result is a bytes object") ##### # # split # 2019aug03 # ##### # «split» (to ".split") # file:///usr/share/doc/python3.5/html/library/stdtypes.html#str.split # file:///usr/share/doc/python2.7/html/glossary.html#term-universal-newlines # file:///usr/share/doc/python3.5/html/glossary.html#term-universal-newlines * (eepitch-python) * (eepitch-kill) * (eepitch-python) "Hello world ".split() ##### # # vararg-functions # 2019aug04 # ##### # «vararg-functions» (to ".vararg-functions") # https://www.python.org/dev/peps/pep-3102/ # file:///usr/share/doc/python3.5/html/reference/compound_stmts.html#function-definitions # If the form "*identifier" is present, it is initialized to a tuple # receiving any excess positional parameters, defaulting to the empty # tuple. ##### # # pandas # 2019sep18 # ##### # «pandas» (to ".pandas") # https://www.learndatasci.com/tutorials/python-pandas-tutorial-complete-introduction-for-beginners/ # https://www.pythonforengineers.com/introduction-to-pandas/ Introduction to Pandas with Practical Examples ##### # # Elpy, the Emacs Python IDE # 2019sep20 # ##### # «elpy» (to ".elpy") # <dale> VG234: I like https://github.com/jorgenschaefer/elpy. # (find-git-links "https://github.com/jorgenschaefer/elpy" "elpy") # https://github.com/jorgenschaefer/elpy * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv ~/usrc/elpy/ cd ~/usrc/ git clone https://github.com/jorgenschaefer/elpy cd ~/usrc/elpy/ git branch --list -a git for-each-ref PAGER=cat git log --oneline --graph --all -20 # (find-fline "~/usrc/") # (find-fline "~/usrc/elpy/") # (find-gitk "~/usrc/elpy/") # (code-c-d "elpy" "~/usrc/elpy/") # (find-elpyfile "") # (find-elpyfile "README.rst") # (find-elpyfile "README.rst" "Elpy, the Emacs Python IDE") ##### # # naufuto (a telegram bot by Lucas Cavalcante) # 2019sep25 # ##### # «naufuto» (to ".naufuto") # (find-git-links "https://github.com/LcavalcanteR/naufuto" "naufuto") # https://github.com/LcavalcanteR/naufuto * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv ~/usrc/naufuto/ cd ~/usrc/ git clone https://github.com/LcavalcanteR/naufuto cd ~/usrc/naufuto/ git branch --list -a git for-each-ref PAGER=cat git log --oneline --graph --all -20 # (find-fline "~/usrc/") # (find-fline "~/usrc/naufuto/") # (find-gitk "~/usrc/naufuto/") # (code-c-d "naufuto" "~/usrc/naufuto/") # (find-naufutofile "") # (find-naufutofile "naufuto.py") ##### # # Hy is a Lisp dialect that is embedded in Python # 2019nov14 # ##### # «hy» (to ".hy") # http://docs.hylang.org/en/stable/quickstart.html # https://docs.hylang.org/en/alpha/ ##### # # codespell # 2020feb07 # ##### # «codespell» (to ".codespell") # (find-fline "~/.local/lib/python3.7/site-packages/" "codespell") # (find-fline "~/.local/lib/python3.7/site-packages/codespell_lib/_codespell.py") # (setq last-kbd-macro (kbd "M-h M-2 (find-fline SPC \" 2*<delete> M-z : C-y <left> \" <delete> SPC\n M-z : C-y DEL SPC \" <delete> M-z = C-y 3*<left> C-k \") C-a <down> RET")) cd /tmp/eev/ codespell codespell --help # (find-sh "codespell --help") * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) pip3 install codespell pip3 show codespell pip3 help pip3 list ##### # # pygments # 2020dec24 # ##### # «pygments» (to ".pygments") # (find-es "tex" "minted") # (find-status "python-pygments-doc") # (find-vldifile "python-pygments-doc.list") # (find-udfile "python-pygments-doc/") # (find-udfile "python-pygments-doc/html/") # (find-status "python-pygments") # (find-vldifile "python-pygments.list") # (find-udfile "python-pygments/") # (find-status "python3-pygments") # (find-vldifile "python3-pygments.list") # (find-udfile "python3-pygments/") # file:///usr/share/doc/python-pygments-doc/html/index.html # http://pypi.python.org/pypi/Pygments # https://pygments.org/ # https://pygments.org/languages/ # (find-man "1 pygmentize") # (find-sh "pygmentize -h") # (find-sh "pygmentize -H agda formatter") The -H option prints detailed help for the object <name> of type <type>, where <type> is one of "lexer", "formatter" or "filter". pip3 install pygments ##### # # plot3D # 2021apr19 # ##### # «plot3D» (to ".plot3D") * (eepitch-python) * (eepitch-kill) * (eepitch-python) from mpl_toolkits.mplot3d import Axes3D from mpl_toolkits.mplot3d.art3d import Poly3DCollection import matplotlib.pyplot as plt fig = plt.figure() ax = plt.axes(projection="3d") x = [0, 0, 0, 0, 1, 1, 1, 1] y = [0, 0, 1, 1, 0, 0, 1, 1] z = [0, 1, 0, 1, 0, 1, 0, 1] verts = [list(zip(x, y, z))] print(verts) ax.plot3D(x, y, z, 'gray') plt.show() import numpy as np ar = np.array([[1,2,3], [3,4,6]]) print(np.moveaxis(ar, 0, 1)) ##### # # dictionaries # 2021jul09 # ##### # «dictionaries» (to ".dictionaries") # file:///usr/share/doc/python3.7/html/tutorial/datastructures.html#dictionaries # file:///usr/share/doc/python3.7/html/library/stdtypes.html#dict # file:///usr/share/doc/python3.7/html/glossary.html#term-iterable ##### # # fsmunoz-k8s-diagrams # 2021oct09 # ##### # «fsmunoz-k8s-diagrams» (to ".fsmunoz-k8s-diagrams") # https://github.com/fsmunoz/k8s-diagrams/blob/main/k8s-diagrams.ipynb # https://github.com/fsmunoz/k8s-diagrams # (find-git-links "https://github.com/fsmunoz/k8s-diagrams" "k8sdiagrams") # (code-c-d "k8sdiagrams" "~/usrc/k8s-diagrams/") # (find-k8sdiagramsfile "") # (find-k8sdiagramsfile "k8s-diagrams.ipynb") http://finisterra.motd.org/?p=302 Interactive embedded development with uLisp, Arduino and Emacs ##### # # Understanding Python through its builtins # 2021oct11 # ##### # «all-the-builtins» (to ".all-the-builtins") https://news.ycombinator.com/item?id=28819030 Understanding Python through its builtins (sadh.life) https://sadh.life/post/builtins/ ##### # # doctest # 2021nov28 # ##### # «doctest» (to ".doctest") # https://docs.python.org/3/library/doctest.html ##### # # breakpoint # 2022mar01 # ##### # «breakpoint» (to ".breakpoint") # file:///usr/share/doc/python3.9/html/library/functions.html#breakpoint # file:///usr/share/doc/python3.9/html/library/bdb.html#bdb.Breakpoint https://github.com/norvig/pytudes/blob/main/ipynb/SplitStates.ipynb file:///usr/share/doc/python3.5/html/library/frameworks.html file:///usr/share/doc/python3.5/html/library/cmd.html https://docs.python.org/3/library/turtle.html https://www.facebook.com/jornalanovademocracia/photos/a.288492381220437.66632.187051701364506/679809862088685/ https://www.facebook.com/permalink.php?story_fbid=921476867869306&id=347772661906399 https://www.facebook.com/photo.php?fbid=10201336092313990&set=a.1569106477271.73917.1523735650 Something that would output what it got from FB in a raw-ish form - JSON? - would be ideal. Any hints welcome, as I am trying to write a set of scripts for caching texts posted to FB that I may want to access quickly later... the code that converts URLs to local file names is ready - the URLs above are associated to files with these names, posts_sergio.martins.984991_10152616093738086 photos_jornalanovademocracia_a.288492381220437.66632.187051701364506_679809862088685 pesfi_921476867869306_347772661906399 photofs_10201336092313990_a.1569106477271.73917.1523735650 http://sourceforge.net/p/oiler/code/ci/master/tree/python/edu/fb4-txt http://sourceforge.net/p/oiler/code/ci/master/tree/python/edu/ cd ~/code/edu-code ls python fbtxt.py fb2 >> fb3-txt vy fb3-txt # (find-efunction 'find-gitclone-links) # (find-man "isympy") http://python.mirocommunity.org/ http://blip.tv/episode/5594214 About Python Namespaces (and Code Objects) # http://rgruet.free.fr/PQR2.3.html # http://rgruet.free.fr/bin/modern.css # http://rgruet.free.fr/bin/classic.css # http://rgruet.free.fr/bin/highcontrast.css # http://rgruet.free.fr/bin/printing.css # http://rgruet.free.fr/bin/styleswitcher.js # http://stackoverflow.com/questions/17988/how-to-learn-python # http://stackoverflow.com/questions/457757/what-is-the-best-python-book-for-experienced-programmers # http://stackoverflow.com/questions/623763/what-are-some-recommended-high-quality-non-basic-python-books # http://stackoverflow.com/questions/947942/advanced-python-programming-book-like-effective-c # http://stackoverflow.com/questions/tagged/python+books http://www.swaroopch.org/notes/Python http://docs.python.org/tutorial/classes.html http://rgruet.free.fr/ http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html http://www.effbot.org/zone/python-objects.htm http://www.dabeaz.com/writing.html http://www.dabeaz.com/ply/index.html http://en.wikipedia.org/wiki/PyPy # http://www.dabeaz.com/ply/ # (find-status "python-ply") # (find-vldifile "python-ply.list") # (find-udfile "python-ply/") Cairo: # http://arstechnica.com/articles/columns/linux/linux-20050822.ars # (find-zsh "availabledebs | sort | grep cairo") apti python-cairo-dev http://code.google.com/p/soc/wiki/PythonStyleGuide#Naming I would recommend that you chuck the obsolete os.popen() permanently and learn the subprocess module: you will be much happier. Setting bufsize=0 (which is the default) should give you unbuffered output from the process. -- Nick Dokos, org-mode-list, 2012feb08 http://codecondo.com/10-ways-to-learn-python/ https://www.facebook.com/sergio.martins.984991/posts/10152810706878086 https://blog.udemy.com/python-tutorial/ # file:///usr/share/doc/python2.7/html/library/re.html # file:///usr/share/doc/python2.7/html/howto/regex.html # file:///usr/share/doc/python2.7/html/howto/regex.html#search-and-replace # file:///usr/share/doc/python2.7/html/reference/expressions.html#lambda # file:///usr/share/doc/python2.7/html/reference/executionmodel.html#naming https://www.python.org/~guido/ https://www.stavros.io/tutorials/python/ http://www.leancrew.com/all-this/2012/04/where-modules-go-to-die/ ;; (find-fline "/usr/share/doc/python2.7/html/_sources/") ;; (find-fline "/usr/share/doc/python3.5/html/_sources/") # (find-py2docsrcfile "whatsnew/2.7.txt" "PEP 372: Adding an Ordered Dictionary to collections") # (find-py3docsrcfile "whatsnew/") file:///usr/share/doc/python2.7/html/library/os.html#os.getenv https://nostarch.com https://nostarch.com/automatestuff2 https://nostarch.com/pythoncrashcourse2e https://codeburst.io/building-beautiful-command-line-interfaces-with-python-26c7e1bb54df https://wiki.debian.org/Python NOTE: Debian testing (bullseye) has removed the "python" package and the '/usr/bin/python' symlink due to the deprecation of Python 2. No packaged scripts should depend on the existence of '/usr/bin/python': if they do, that is a bug that should be reported to Debian. You can use the 'python-is-python3' or 'python-is-python2' packages to restore an appropriate '/usr/bin/python' symlink for third-party or legacy scripts. https://www.cs.usfca.edu/~galles/visualization/Algorithms.html https://realpython.com/python-walrus-operator/ https://towardsdatascience.com/creating-fractals-with-python-d2b663786da6 https://news.ycombinator.com/item?id=30744698 Pointers and Memory Management in Python (github.com/zerointensity) https://news.ycombinator.com/item?id=30727189 No is a complete sentence (networkingnerd.net) https://www.youtube.com/watch?v=xWQUkRKqp2E https://morganya.org/charisma.html The Charisma Machine: the life, death, and legacy of One Laptop per Child - OLPC https://inventwithpython.com/blog/2021/07/10/book-review-the-charisma-machine-by-morgan-g-ames/ https://docs.python.org/3/whatsnew/index.html https://snarky.ca/a-reverse-chronology-of-some-python-features/ # Local Variables: # coding: utf-8-unix # End: