[issue37676] cmath.phase array support
New submission from Hendrik : It would be nice if cmath.phase supports arrays like this: ``` import cmath import numpy as np z=255*np.ones((3,3)) * np.exp(1j * np.pi*np.ones((3,3))) def get_k_amp_array(z): return abs(z) def get_k_ph_array(z): return np.array([[cmath.phase(z_row) for z_row in z_col] for z_col in z ]) amp_array= get_k_amp_array(z) ph_array= get_k_ph_array(z) print(amp_array) print(ph_array) ``` -- components: Library (Lib) messages: 348428 nosy: kolibril13 priority: normal severity: normal status: open title: cmath.phase array support type: enhancement versions: Python 3.7 ___ Python tracker <https://bugs.python.org/issue37676> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2008] cookielib lacks FileCookieJar class for Safari
Changes by Hendrik : Added file: http://bugs.python.org/file33922/cookiejar.diff ___ Python tracker <http://bugs.python.org/issue2008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2008] cookielib lacks FileCookieJar class for Safari
Changes by Hendrik : -- keywords: +patch Added file: http://bugs.python.org/file33921/cookie.diff ___ Python tracker <http://bugs.python.org/issue2008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2008] cookielib lacks FileCookieJar class for Safari
Changes by Hendrik : -- versions: +Python 3.4 -Python 3.2 ___ Python tracker <http://bugs.python.org/issue2008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2008] cookielib lacks FileCookieJar class for Safari
Hendrik added the comment: Ok, i've got it. --- a/Lib/http/cookiejar.py Wed Dec 18 15:37:03 2013 -0600 +++ b/Lib/http/cookiejar.py Sat Feb 01 15:12:01 2014 +0100 @@ -11,17 +11,17 @@ distributed with the Python standard library, but are available from http://wwwsearch.sf.net/): -CookieJar -/ \ \ -FileCookieJar \ \ - /| \ \ \ - MozillaCookieJar | LWPCookieJar \ \ - | | \ - | ---MSIEBase | \ - | / | |\ - | / MSIEDBCookieJar BSDDBCookieJar - |/ - MSIECookieJar + CookieJar +/ \ \ +FileCookieJar \ \ + / / | \ \ \ +SafariCookieJar / | LWPCookieJar \ \ + /| | \ + MozillaCookieJar | ---MSIEBase | \ + | / | |\ + | / MSIEDBCookieJar BSDDBCookieJar + |/ + MSIECookieJar """ @@ -31,8 +31,11 @@ import copy import datetime import re +import getpass import time import urllib.parse, urllib.request +import struct +import io try: import threading as _threading except ImportError: @@ -40,6 +43,9 @@ import http.client # only for the default HTTP port from calendar import timegm +import difflib +#from difflib_data import * + debug = False # set to True to enable debugging via the logging module logger = None @@ -1938,6 +1944,109 @@ raise LoadError("invalid Set-Cookie3 format file %r: %r" % (filename, line)) +class SafariCookieJar(FileCookieJar): +""" +Read Cookies from Safari + +""" +def load(self, filename=None): +if filename == None: +username = getpass.getuser() +path = '/Users/' + username + '/Library/Cookies/Cookies.binarycookies' +else: +path = filename + +bf=open(path,mode='rb') +scook = bf.read(4).decode("UTF-8") +if scook == 'cook': +NumberOfPages=struct.unpack('>i',bf.read(4))[0] +page_sizes=[] +for np in range(NumberOfPages): +page_sizes.append(struct.unpack('>i',bf.read(4))[0]) +pages=[] +for ps in page_sizes: +pages.append(bf.read(ps)) + +for page in pages: +page=io.BytesIO(page) +page.read(4) +num_cookies=struct.unpack('http://securitylearn.net/wp-content/uploads/tools/iOS/BinaryCookieReader.py -- ___ Python tracker <http://bugs.python.org/issue2008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2008] cookielib lacks FileCookieJar class for Safari
Hendrik added the comment: I found a solution for reading Safari cookies, but struggling around with hg diff. Because always when i typ hg diff Lib/http/cookiejar.py it returns me the complete file not only my changes.. -- nosy: +Hendrik ___ Python tracker <http://bugs.python.org/issue2008> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15869] IDLE: Include .desktop file and icon
Hendrik Knackstedt added the comment: For the correct icon to appear you have to copy the provided .xpm file to the given location: /usr/share/pixmaps/python.xpm This is still an issue for the current version of python 3.3. This is really easy to fix. Simply include the files already provided. I can confirm they work on Archlinux in XFCE. -- nosy: +hennekn ___ Python tracker <http://bugs.python.org/issue15869> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17257] re module shows unexpected non-greedy behavior when using groups
Hendrik Lemelson added the comment: Thank you for clarifying this. While it still not seems really intuitive to me I can handle the behavior. To summarize: It is not possible with re to have an optional ({0,1}) group that contains further subgroups, because re considers (0,0) to already fulfill the constraints for the outer group? -- resolution: -> invalid status: open -> closed ___ Python tracker <http://bugs.python.org/issue17257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17257] re module shows unexpected non-greedy behavior when using groups
New submission from Hendrik Lemelson: When using the Python 2.7.3 re module, it shows a strange behavior upon the use of quantifiers together with groups: >>> re.search('(a*)', 'ct').groups() ('',) >>> re.search('(a+)', 'ct').groups() ('',) >>> re.search('(a{0,5})', 'ct').groups() ('',) >>> re.search('(a{1,5})', 'ct').groups() ('',) Whenever a quantifier is used that allows also zero occurrences, the quantifier loses its greedy behavior. This in my eyes is a defect in the re module. In the following there is another example with nested groups where the quantifier for the outer group even prevents the inner groups to match: >>> re.search('(a(b*)a)', 'caabbaat').groups() ('aa', '') >>> re.search('(a(b+)a)', 'caabbaat').groups() ('abba', 'bb') >>> re.search('(a(b*)a){0,1}', 'caabbaat').groups() (None, None) >>> re.search('(a(b+)a){0,1}', 'caabbaat').groups() (None, None) It would be great if you could manage to fix this. Thank you in advance. Regards Hendrik Lemelson -- components: Regular Expressions messages: 182535 nosy: Hendrik.Lemelson, ezio.melotti, mrabarnett, pitrou priority: normal severity: normal status: open title: re module shows unexpected non-greedy behavior when using groups type: behavior versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue17257> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1556] Failure when calling __str__ for MIMEBase(message, rfc822) objects
New submission from Hendrik Spiegel: When creating a MIMEBase object with message/rfc822 mimetype invoking the objects __str__ method results in an exception. Even if this behaviour should be intended the error message "TypeError: Expected list, got " is not helpful. To reproduce the problem run the attached script after creating the file 'test.eml' in the script's directory. mimetype = mimetypes.guess_type(filename)[0] maintype, subtype = mimetype.split('/') attachment = MIMEBase(maintype, subtype) attachment.set_payload(file(filename).read( )) print attachment #python MimebaseError.py [1] message/rfc822 Traceback (most recent call last): File "MimebaseError.py", line 19, in main() File "MimebaseError.py", line 16, in main print attachment File "email/message.py", line 116, in __str__ File "email/message.py", line 131, in as_string File "email/generator.py", line 84, in flatten File "email/generator.py", line 109, in _write File "email/generator.py", line 135, in _dispatch File "email/generator.py", line 266, in _handle_message File "email/message.py", line 185, in get_payload TypeError: Expected list, got -- components: Library (Lib) files: MimebaseError.py messages: 58216 nosy: hsp severity: normal status: open title: Failure when calling __str__ for MIMEBase(message, rfc822) objects type: crash versions: Python 2.4, Python 2.5 Added file: http://bugs.python.org/file8879/MimebaseError.py __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1556> __from email.MIMEBase import MIMEBase from email.MIMEMultipart import MIMEMultipart import mimetypes #filename = 'MimebaseError.py' filename = 'test.eml' def main(): mimetype = mimetypes.guess_type(filename)[0] print mimetype maintype, subtype = mimetype.split('/') attachment = MIMEBase(maintype, subtype) attachment.set_payload(file(filename).read( )) #attachment.get_payload() #attachment.get_payload(0) print attachment main()___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com