[issue12537] mailbox's _become_message is very fragile

2011-09-14 Thread David Lam

David Lam  added the comment:

Hi hi, noob here. I found this today after clicking 'Easy issues' link. 

Would something like this work?  test_mailbox.py seems to pass. However, I'm 
not too sure what more needs to be done in the _explain_to. It seems like 
everything to convert headers/flags between message formats are already there ?


diff -r 63bf3bae20ef Lib/mailbox.py
--- a/Lib/mailbox.pyWed Sep 14 11:46:17 2011 -0400
+++ b/Lib/mailbox.pyWed Sep 14 17:12:51 2011 -0700
@@ -1467,8 +1467,7 @@
 
 def _become_message(self, message):
 """Assume the non-format-specific state of message."""
-for name in ('_headers', '_unixfrom', '_payload', '_charset',
- 'preamble', 'epilogue', 'defects', '_default_type'):
+for name in message.__dict__:
 self.__dict__[name] = message.__dict__[name]

--
nosy: +dlam

___
Python tracker 
<http://bugs.python.org/issue12537>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12537] mailbox's _become_message is very fragile

2011-09-15 Thread David Lam

David Lam  added the comment:

Hm, it seems right now that the only time that happens is when creating a 
message based on an mbox message.  The 'status' and 'x-status' attributes are 
deleted.

Any hints on what I could to do figure out what special attributes should be 
deleted?  I was thinking I might try to find and go through the mailbox specs, 
and find out what headers are mandatory for each of them.

I think I see some hints on... 
http://docs.python.org/library/mailbox.html#mailbox.mboxMessage.

--

___
Python tracker 
<http://bugs.python.org/issue12537>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12537] mailbox's _become_message is very fragile

2011-09-19 Thread David Lam

David Lam  added the comment:

This patch deletes the leftover special attributes. 

Thanks for guiding me through my confusion and/or cluelessness!

--
keywords: +patch
Added file: http://bugs.python.org/file23191/12537.patch

___
Python tracker 
<http://bugs.python.org/issue12537>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12537] mailbox's _become_message is very fragile

2011-09-19 Thread David Lam

Changes by David Lam :


Added file: 
http://bugs.python.org/file23192/12537.find.attribute.differences.patch

___
Python tracker 
<http://bugs.python.org/issue12537>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12537] mailbox's _become_message is very fragile

2012-04-12 Thread David Lam

David Lam  added the comment:

Wow, cool!  Thanks for the update.

--

___
Python tracker 
<http://bugs.python.org/issue12537>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11176] give more meaningful argument names in argparse documentation

2012-07-08 Thread David Lam

David Lam  added the comment:

haha wow, I was working on this bug too!  maybe we can work on the final patch 
together

I got through about 2/3's of the docs, so I thought it might help to upload 
what I got so far.  I basically just made stuff up so I'm totally winning to 
change anything (or everything)

I made a little effort to make the examples mildly amusing, since novelty sorta 
helps in retention.  So one of the recurring examples I used involves that of a 
pizza-making-program... hopefully this helps in some way!

--
nosy: +dlam
Added file: 
http://bugs.python.org/file26325/issue11165-doc-fix-up-to-section-15.4.4.diff

___
Python tracker 
<http://bugs.python.org/issue11176>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11698] Improve repr for structseq objects to show named, but unindexed fields

2012-07-15 Thread David Lam

David Lam  added the comment:

hi hi,  found this bug after clicking the "Easy issues" link

i basically just took Ray's hint to look at the __reduce__ method, and applied 
it to the __repr__ method in this patch

also updated is the test_repr() unittest

--
keywords: +patch
nosy: +dlam
Added file: http://bugs.python.org/file26391/issue11698.patch

___
Python tracker 
<http://bugs.python.org/issue11698>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11176] give more meaningful argument names in argparse documentation

2012-07-17 Thread David Lam

David Lam  added the comment:

yup yup, go for it

--

___
Python tracker 
<http://bugs.python.org/issue11176>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11176] give more meaningful argument names in argparse documentation

2012-08-28 Thread David Lam

David Lam added the comment:

here's a patch that covers all but one of the foo/bar/baz examples

it also has fixes for the sample code near the beginning from the review Ezio 
did 

the one example I didn't do was the "Arguments containing -" part. I guess it 
felt like changing the names in that example would distract from what it was 
trying to illustrate there

Anyways, I tried to proofread it so hopefully it reads okay, enjoy enjoy ^^

--
Added file: http://bugs.python.org/file27030/issue11176.patch

___
Python tracker 
<http://bugs.python.org/issue11176>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8489] Support UTF8SMTP as part of RFC 5336 in smptlib

2013-01-08 Thread David Lam

Changes by David Lam :


--
nosy: +dlam

___
Python tracker 
<http://bugs.python.org/issue8489>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16954] Add docstrings for ElementTree module

2013-01-14 Thread David Lam

Changes by David Lam :


--
nosy: +dlam

___
Python tracker 
<http://bugs.python.org/issue16954>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16954] Add docstrings for ElementTree module

2013-01-24 Thread David Lam

David Lam added the comment:

I had an innocent question about the format to use when listing function 
arguments in docstrings.  In the PEP 257 doc, there's a single example:

def complex(real=0.0, imag=0.0):
"""Form a complex number.

Keyword arguments:
real -- the real part (default 0.0)
imag -- the imaginary part (default 0.0)

I went digging through Lib/ for a good example to follow, but felt a little 
unsure because the exact format seemed to differ ever so slightly sometimes.

Like in ipaddress.py, a colon is used instead of two hyphens, and it's indented:

def ip_address(address):
"""Take an IP string/int and return an object of the correct type.

Args:
address: A string or integer, the IP address.  Either IPv4 or
  IPv6 addresses may be supplied; integers less than 2**32 will
  be considered to be IPv4 by default.

Is there an "ideal" example in the source to try to copy?  
(or maybe this is just a use-your-common-sense thing)

--

___
Python tracker 
<http://bugs.python.org/issue16954>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16954] Add docstrings for ElementTree module

2013-02-16 Thread David Lam

David Lam added the comment:

Here's a patch which converts all the Doxygen comments in ElementTree.py to 
docstrings!

Something I noticed was that the 

  from _elementtree import *

...at the bottom of ElementTree.py sort of overwrites the docstrings of the 
Python module.  So if you did...  `from xml.etree import ElementTree;  
help(ElementTree)` from the interpreter, you'll see blank spots for a bunch of 
classes/methods like Element, ParseError, SubElement etc etc

maybe docstrings should be also added in Modules/_elementtree.c?  perhaps that 
would be too much copy and pastage, hmmm

--
keywords: +patch
Added file: http://bugs.python.org/file29095/issue16954.patch

___
Python tracker 
<http://bugs.python.org/issue16954>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8489] Support UTF8SMTP as part of RFC 5336 in smptlib

2013-02-23 Thread David Lam

David Lam added the comment:

looks like RFC 6531 obsoletes 5336  -->   
http://datatracker.ietf.org/doc/rfc6531/

(6531 says its the "Proposed Standard", whereas 5336 says its "Experimental" 
etc etc)

--

___
Python tracker 
<http://bugs.python.org/issue8489>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16954] Add docstrings for ElementTree module

2013-02-28 Thread David Lam

David Lam added the comment:

here's an updated patch incorporating the feedback from Ezio and Eric:

   - moved docstrings put in some __special__ method names
   - made the description of 'tag' consistent:  'tag' means the elements name 
(as opposed to 'tag' being a synonym for "element"!)
   - docstring args now *stared* as opposed to 'quoted'


I also gave a shot at copying the existing docstrings into their respective C 
counterparts.  But it *seems* like you can't do so
that easily for a C extension. Maybe I missed something though: 

>>> from _elementtree import Element as cElement
>>> cElement.__doc__ = 'foobarbaz'
Traceback (most recent call last):
  File "", line 1, in 
TypeError: can't set attributes of built-in/extension type 
'xml.etree.ElementTree.Element'

I see one example in Modules/_json.c where the docstrings were sorta copied and 
pasted over, so perhaps it's an ok thing to do.

--
Added file: http://bugs.python.org/file29278/issue16954-v2.patch

___
Python tracker 
<http://bugs.python.org/issue16954>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16954] Add docstrings for ElementTree module

2013-04-14 Thread David Lam

David Lam added the comment:

Hi Eli, I sure would!

(Though, if anyone finds this issue and can figure out a solution, I'd 
encourage them to post it!)

--

___
Python tracker 
<http://bugs.python.org/issue16954>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com