[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Ashley Anderson


Change by Ashley Anderson :


--
nosy: +aganders3

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-24 Thread Ashley Anderson

Changes by Ashley Anderson :


--
nosy: +Ashley.Anderson

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-24 Thread Ashley Anderson

Ashley Anderson  added the comment:

I've recently joined the python-mentors mailing list because I love Python and 
want to get involved. I found this bug in the list of "Easy issues" and thought 
I'd try my hand. Anyway, this is my first patch, so please forgive me if I am 
breaking protocol or stepping on anyone's toes here. I also hope my code isn't 
embarrassing.

This adds a constructor to the date class that allows construction based on an 
ISO-8601 WWD string. Does this address the issue in a logical way?

--
keywords: +patch
Added file: http://bugs.python.org/file22101/12006.patch

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-24 Thread Ashley Anderson

Ashley Anderson  added the comment:

Thanks, I think I understand the original post now. Upon reading the docs and 
code, however, it seems this is possible using the %W and %w directives. Is the 
issue just to support the different letters (%V and %u) specifically, or that 
they are not quite the same format as the corresponding ISO numbers?

--

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-25 Thread Ashley Anderson

Ashley Anderson  added the comment:

OK, here is my second attempt. I think it functions as desired, but a code 
review may reveal flaws in my implementation. I'm sure there are associated 
tests and documentation to write, but I have basically no experience with that 
yet. If this looks like the right direction, I can take it to the 
python-mentors list for help with the test/docs.

--
Added file: http://bugs.python.org/file22113/12006_2.patch

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-25 Thread Ashley Anderson

Changes by Ashley Anderson :


Removed file: http://bugs.python.org/file22101/12006.patch

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-25 Thread Ashley Anderson

Ashley Anderson  added the comment:

Thanks everyone, please take your time if there are more pressing issues; I'll 
get to work on tests and documentation in the mean time. I agree that 
'_calc_julian_from_V' is a bit strange. I was mimicking a similar helper 
function's name ('_calc_julian_from_U_or_W'), but perhaps that is no defense.

Also, I know the functionality is there with 'toisocalendar' and 
'toisoweekday', but maybe %V and %u should be implemented for 'strftime' for 
completeness. Any thoughts?

--

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-26 Thread Ashley Anderson

Ashley Anderson  added the comment:

When trying to add cases for %V and %u in the tests, I ran into an issue of 
year ambiguity. The problem comes when the ISO year does not match the 
Gregorian year for a given date. I think this should be fixed by implementing 
the %G directive (ISO year, which is present in strftime) as well.

--

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-26 Thread Ashley Anderson

Ashley Anderson  added the comment:

The example that triggered the issue in testing was January 1, 1905. The ISO 
date for this day is 1904 52 7. This is reported correctly if you use 
datetime.isocalendar() or datetime.strftime('%G'), but you get 1905 if you use 
datetime.strftime('%Y'). When it's read back in it causes the test to fail 
because ISO '1904 52 7' is different from ISO '1905 52 7'.

Likewise if you consider a year starting on a Tuesday, Wednesday, or Thursday, 
there will be several days at the end of the previous year that will have an 
ISO year ahead of their Gregorian representation.

--

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



[issue12006] strptime should implement %V or %u directive from libc

2011-05-26 Thread Ashley Anderson

Ashley Anderson  added the comment:

I disagree, I think %G is necessary in strptime(). Take Monday, December 31, 
2001 as an example. The ISO date is 2002 01 1.

Now, given only the Gregorian year (2001) for this date, and the ISO week and 
weekday (01 1), there is an ambiguity with Monday, January 1, 2001, which has 
an ISO date of 2001 01 1. The ISO week/weekday combination of (01 1) occurs 
twice in the year 2001, and can only be differentiated by the corresponding ISO 
year.

We can, of course, debate on what the behavior in this case should be. The way 
I see it, we can:
1) Assume the year taken in by %Y is equivalent to the ISO year, which it often 
is. Assuming %Y is the ISO year IFF %V is used accomplishes the same result.
2) Default the year to some value, currently 1900 is used when %Y is absent. 
This is how it is handled now.
3) Report an error/exception that insufficient data was provided, and maybe 
mention %G should be used instead of %Y for this case.

I'm attaching a patch now that includes some minor changes, includes %G and 
adds some tests. I am also working on the documentation but it's not quite 
ready.

--
Added file: http://bugs.python.org/file22137/12006_3.patch

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



[issue12006] strptime should implement %V or %u directive from libc

2011-06-03 Thread Ashley Anderson

Ashley Anderson  added the comment:

Attaching a patch for the documentation just in time for the weekend!

--
Added file: http://bugs.python.org/file22240/12006_doc.patch

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



[issue12006] strptime should implement %G, %V and %u directives

2015-07-28 Thread Ashley Anderson

Ashley Anderson added the comment:

Wow, I can't believe this issue is so old now! I'm motivated to finally come
back and address the remaining issues to get this merged. Sorry for seemingly
abandoning this; I'm embarrassed I didn't push to finish it earlier.

It sounds like the consensus is to raise a ValueError in cases where ambiguity
may arise, with specific suggestions for resolving the ambiguity in each case.
This is in contrast to certain other cases where strptime uses some default
value for missing data (e.g. month/day = 1, year = 1900).

Ambiguous or incomplete cases I have identified are:
1. ISO week (%V) is specified, but the year is specified with %Y instead of %G
2. ISO year (%G) and ISO week (%V) are specified, but a weekday is not
3. ISO year (%G) and weekday are specified, but ISO week (%V) is not
4. ISO year is specified alone (e.g. time.strptime('2015', '%G'))
5. Julian/ordinal day (%j) is specified with %G, but not %Y

Hopefully that covers it...let me know if I need to add any cases or change
behavior in any cases. I can have a patch (at least an initial attempt) ready
for this in the next few days.

--

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



[issue12006] strptime should implement %G, %V and %u directives

2015-07-31 Thread Ashley Anderson

Ashley Anderson added the comment:

Here is an updated patch with implementation as outlined in msg247525.

--
Added file: http://bugs.python.org/file40085/issue12006_7_complete.patch

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



[issue12006] strptime should implement %G, %V and %u directives

2015-08-02 Thread Ashley Anderson

Ashley Anderson added the comment:

Thanks for the review and the good suggestions. Hopefully this new patch is an 
improvement.

I didn't know about the context manager for assertRaises - I was just following 
the format for another ValueError test a few lines above.

The frozenset and re-wrapped comment were left from playing around with another 
way to do the checks, and I've corrected them.

I think the conditionals around calculating the julian and year are clearer now 
as well.

Please (obviously) let me know if there are further changes. Also please let me 
know if this is not the proper way to respond to the code review!

--
Added file: http://bugs.python.org/file40113/issue12006_8_complete.patch

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



[issue12006] strptime should implement %G, %V and %u directives

2015-09-02 Thread Ashley Anderson

Ashley Anderson added the comment:

Haha, thanks Erik. It seems you know my tastes enough to not offer a 
chocolate-based reward. =)

I was actually set to "ping" to request a patch review today, as it's been one 
month since my last submission. Please let me know if I need to update the 
patch against the current `tip`.

--

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



[issue12006] strptime should implement %G, %V and %u directives

2015-09-30 Thread Ashley Anderson

Ashley Anderson added the comment:

Another *ping* for a patch review since it's been almost a month since the last 
one.

--

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



[issue12006] strptime should implement %G, %V and %u directives

2015-09-30 Thread Ashley Anderson

Ashley Anderson added the comment:

Thanks Alexander, but I think the latest patch is still mine. It seems strange 
to review my own patch. I'll do it if that's common, but since this will 
(hopefully, eventually) be my first accepted patch I would appreciate the 
feedback from another reviewer.

--

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



[issue12006] strptime should implement %G, %V and %u directives

2015-10-02 Thread Ashley Anderson

Changes by Ashley Anderson :


Added file: http://bugs.python.org/file40660/issue12006_10_complete.patch

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



[issue26688] unittest2 referenced in unittest.mock documentation

2016-04-01 Thread Ashley Anderson

New submission from Ashley Anderson:

I noticed a few references to `unittest2` in the documentation in the 
`unittest.mock` "getting started" section:

https://docs.python.org/3.6/library/unittest.mock-examples.html#patch-decorators

I am attaching a patch that just changes these occurrences from `unittest2` to 
`unittest`.

--
assignee: docs@python
components: Documentation
files: unittest2.patch
keywords: patch
messages: 262767
nosy: aganders3, docs@python
priority: normal
severity: normal
status: open
title: unittest2 referenced in unittest.mock documentation
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42346/unittest2.patch

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