[issue14423] Getting the starting date of iso week from a week number and a year.
Esben Agerbæk Black esbe...@gmail.com added the comment: I somehow re-uploaded an old patch, this one contains buggy c-code, but fixes the python implementation. Any pointers to how to get started on the c bi would be greatly appreciated. -- Added file: http://bugs.python.org/file25306/isodates.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Esben Agerbæk Black esbe...@gmail.com added the comment: 2) I get errors for all my test when I build my python and run ./python.exe -m test.datetimetester -j3 I asume this is because I have yet to implement the c version in Modules/_datetimemodule.c is this the correct assumption? You should probably run ./python.exe -m test -v test_datetime instead. Not sure that will fix your test failures, though :) Ok so now i only get errors for _Fast tests am I correct in assuming that this is because i lack a C implementation? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Esben Agerbæk Black esbe...@gmail.com added the comment: I believe that it is a good solution to have, for lack of a better term; bi-directional features so in my opinion .isocalendar() merits having a constructor that takes an ISO format. Sadly no :-( I looked it over once more and it seems there is an error where the date is not offset correctly for years beginning on Tuesday, Wednesday or Thursday. I will updater my patch ASAP. +if self.isocalendar()[1] != 1: +if self.weekday() 3: # Jan 1 is not in week one + self += timedelta(7 - self.weekday()) +else: +self -= timedelta(self.weekday()) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Esben Agerbæk Black esbe...@gmail.com added the comment: 1) Yes I agree, your solution is somewhat more concise, I have corrected the code accordingly. 2) I get errors for all my test when I build my python and run ./python.exe -m test.datetimetester -j3 I asume this is because I have yet to implement the c version in Modules/_datetimemodule.c is this the correct assumption? Kind regards On Tue, Apr 10, 2012 at 3:32 PM, Alexander Belopolsky rep...@bugs.python.org wrote: Alexander Belopolsky alexander.belopol...@gmail.com added the comment: On Tue, Apr 10, 2012 at 6:44 AM, Antoine Pitrou rep...@bugs.python.org wrote: It's so easy that the patch isn't a one-liner and it seems to still have bugs wrt. intended behaviour. Unless I miss something, the inverse to isocalendar() is simply from datetime import * def fromiso(year, week, day): d = date(year, 1, 4) return d + timedelta((week - 1) * 7 + day - d.isoweekday()) At least it works in my testing: (2012, 15, 2) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Changes by Esben Agerbæk Black esbe...@gmail.com: Added file: http://bugs.python.org/file25157/isodates.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Changes by Esben Agerbæk Black esbe...@gmail.com: Added file: http://bugs.python.org/file25079/isodates.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Esben Agerbæk Black esbe...@gmail.com added the comment: Patch updated with sanity checks. -- Added file: http://bugs.python.org/file25056/isodates.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Esben Agerbæk Black esbe...@gmail.com added the comment: Patch updated with tests and documentation -- Added file: http://bugs.python.org/file25059/isodates.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
New submission from Esben Agerbæk Black esbe...@gmail.com: An enhancement request to make available the date of the first iso weekday of any week of any year. -- files: weekdate.py hgrepos: 117 messages: 156913 nosy: Esben.Agerbæk.Black priority: normal severity: normal status: open title: Getting the starting date of iso week from a week number and a year. type: enhancement versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file25040/weekdate.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Changes by Esben Agerbæk Black esbe...@gmail.com: -- hgrepos: -117 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Changes by Esben Agerbæk Black esbe...@gmail.com: Removed file: http://bugs.python.org/file25040/weekdate.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Esben Agerbæk Black esbe...@gmail.com added the comment: I have made a patch as per the Lifecycle of a patch quick guide. (http://docs.python.org/devguide/patch.html#lifecycle-of-a-patch) -- keywords: +patch Added file: http://bugs.python.org/file25048/isodates.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14423] Getting the starting date of iso week from a week number and a year.
Changes by Esben Agerbæk Black esbe...@gmail.com: -- components: +Library (Lib) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com