django.utils.dateparse

2019-02-03 Thread Giuseppe De Marco
Hi All, it's the first time for me in this ml, I'd like to purpose a refactor of django.utils.dateparse functions. Currently a function in it, like parse_date for example, extract date time string with a static regexp... https://docs.djangoproject.com/pl/2.1/_modules/django/utils/dateparse/ The

Re: django.utils.dateparse

2019-02-03 Thread Giuseppe De Marco
utils.dateparse import parse_datetime" > "parse_datetime('2019-02-03T17:27:58.645194')" > 5 loops, best of 5: 5.48 usec per loop > > I implemented parse_datetime with a regex because that's almost twice as > fast as a single call to datetime.datetime.strptime: &g

Re: django.utils.dateparse

2019-02-03 Thread Giuseppe De Marco
Regarding the previous example, better to read it here (my fault: I mistaken the format '%Y-%m-%dT%H:%M:%S.%f'): https://github.com/peppelinux/Django-snippets/blob/master/datetime_heuristic_parser.py and also, it should came also with tzinfo regexp and other functions as well, like parse_date

Re: django.utils.dateparse

2019-02-04 Thread Giuseppe De Marco
> 6.97 µs ± 408 ns per loop (mean ± std. dev. of 7 runs, 10 loops each) > > I assume there is something wrong with the way you benchmarked the code. > Python is not *that* slow, but 0.0241 per loop is way, way too fast. > > > > On 4 February 2019 at 09:22:03, Giuseppe De Ma

Re: django.utils.dateparse

2019-02-04 Thread Giuseppe De Marco
quot;print(datetime_heuristic_parser('04/12/2018 09:7:4'))" 1 loops, best of 3: 25.4 usec per loop Il giorno lun 4 feb 2019 alle ore 15:18 Andreas Pelme ha scritto: > On 4 Feb 2019, at 15:04, Giuseppe De Marco > wrote: > > > python3 -m timeit -s "impor

Re: Google Summer of Code 2019

2019-02-04 Thread Giuseppe De Marco
Hi Tim, It returns 404 to me https://github.com/django/django-team-wiki/wiki/Google-Summer-of-Code-Application-Info Il giorno lun 4 feb 2019 alle ore 13:05 Tim Graham ha scritto: > All answers are at > https://github.com/django/django-team-wiki/wiki/Google-Summer-of-Code-Application-Info > --

Re: django.utils.dateparse

2019-02-04 Thread Giuseppe De Marco
019-02-04 and 04/02/19. (Or is it 02/04/19?) > It Will depend by settings.py, that's the goal > > Anyway, if you think this is generally useful, you can easily package it > into a third-party module. > Consider It done, I thougth on a wider featureset in Django.utils.dateparse >&g

Re: django.utils.dateparse

2019-02-04 Thread Giuseppe De Marco
ngo-developers/CAFNZOJPciEjaiXO0oO-UTDCTnbgcSP3Us3D-gOdP4jvMZPGu_A%40mail.gmail.com?utm_medium=email_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Dott. Giuseppe De Marco CENTRO ICT DI ATENEO University of Calabria 87036 Rende