New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug fix and possible fix for #11 #18
Conversation
----------------------------------------------------------------------
Ran 106 tests in 0.173s
OK and no linting errors. |
Hmmm, the thing is, for our internal project that used this code this was actually a feature, we wanted the timezone information out (it's a bit ugly, I know). But I agree this needs rethinking, and I'm willing to accept your proposal -- we just need to check our internal code first. Gimme a few days and I'll get back to this. Also, it will be great to have tests that make these expectations explicit. =) |
Ok, I'll add some tests. But I'll be lazy about it! Possibly. Or I'll have On Thu, Dec 4, 2014, 6:59 AM Elias Dorneles notifications@github.com
|
Hi, @JBKahn. Happy New Year! 😃 |
Yup, I wasn't on my computer a lot over the holidays. I'll pick this up over the next few days |
Great, thanks! 😃 |
It's been a long time since I've looked over this. Is that the test you were looking for here?
|
Hi @JBKahn , sorry for taking me so long to respond. Can you please merge |
sure |
…to date-format-arg-bug Conflicts: dateparser/date.py tests/test_date.py
I'll take another look when I have time, I'm just going to assume the tests won't pass and I'll need to fix something. |
well I'll be damned. I'm better at this merging business than I thought. |
@@ -175,7 +175,7 @@ def _try_given_formats(self): | |||
if not self.date_formats: | |||
return | |||
|
|||
return parse_with_formats(self._get_translated_date_with_formatting(), self.date_formats) | |||
return parse_with_formats(self._get_translated_date_with_formatting(), list(self.date_formats)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please remind me why do we need to construct list here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not garunteed to be an iterable and in the event that it isn't it used
to to something foolish in the end as well as iterate over the string.
On Mon, Feb 9, 2015, 1:15 PM Eugene Amirov notifications@github.com wrote:
In dateparser/date.py
#18 (comment):@@ -175,7 +175,7 @@ def _try_given_formats(self):
if not self.date_formats:
return
return parse_with_formats(self._get_translated_date_with_formatting(), self.date_formats)
return parse_with_formats(self._get_translated_date_with_formatting(), list(self.date_formats))
Could you please remind me why do we need to construct list here?
—
Reply to this email directly or view it on GitHub
https://github.com/scrapinghub/dateparser/pull/18/files#r24350439.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But how would this change help in such case?
>>> list("qwerty")
['q', 'w', 'e', 'r', 't', 'y']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I never got around to running a test, should have instead put it in
a list if it's a string. Haven't looked at this in a while
On Mon, Feb 9, 2015, 5:39 PM Eugene Amirov notifications@github.com wrote:
In dateparser/date.py
#18 (comment):@@ -175,7 +175,7 @@ def _try_given_formats(self):
if not self.date_formats:
return
return parse_with_formats(self._get_translated_date_with_formatting(), self.date_formats)
return parse_with_formats(self._get_translated_date_with_formatting(), list(self.date_formats))
But how would this change help in such case?
list("qwerty")
['q', 'w', 'e', 'r', 't', 'y']—
Reply to this email directly or view it on GitHub
https://github.com/scrapinghub/dateparser/pull/18/files#r24372801.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used this check for similar case. May be it is worth to add this group to dateparser.utils
as plain_iterable
or something. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could get behind that check, works for me. When I get back on my laptop
I'll make the change and run the tests
On Mon, Feb 9, 2015, 5:44 PM Eugene Amirov notifications@github.com wrote:
In dateparser/date.py
#18 (comment):@@ -175,7 +175,7 @@ def _try_given_formats(self):
if not self.date_formats:
return
return parse_with_formats(self._get_translated_date_with_formatting(), self.date_formats)
return parse_with_formats(self._get_translated_date_with_formatting(), list(self.date_formats))
We used this check
https://github.com/scrapinghub/dateparser/blob/master/dateparser/date.py#L222
for similar case. May be it is worth to add this group to dateparser.utils
as plain_iterable or something. What do you think?—
Reply to this email directly or view it on GitHub
https://github.com/scrapinghub/dateparser/pull/18/files#r24373150.
Hi @JBKahn, how are you? |
I'll do it tonight. On Wed, Feb 18, 2015, 11:56 AM Eugene Amirov notifications@github.com
|
…to date-format-arg-bug
Should be good? |
Good for me, but what do you think: wouldn't it be better to raise an error there? I mean so that someone wouldn't pass a dict or object. |
Sure, that works for me. So long as it's handled gracefully. On Thu, Feb 19, 2015, 3:22 AM Eugene Amirov notifications@github.com
|
Will you make proper change? Or if you want to, i can make it and merge the branch. |
If you could make the change, that would be great! On Thu, Feb 19, 2015, 7:24 AM Eugene Amirov notifications@github.com
|
Sure. |
bug fix and possible fix for #11
Here are the changes i made. |
The use of lists there seems to make sense (should be forced as a list, right?).
I'm not sure why you're specifically removing the timezone?
This resolves #11 if that was simply a bug. Couldn't tell the intent of the line.