Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update to uap-core and fix os_v1_replacement #59

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

Merged
merged 3 commits into from
Apr 9, 2018

Conversation

ondras
Copy link
Contributor

@ondras ondras commented Mar 26, 2018

This PR updates to latest uap-core and fixes the unit test bug mentioned in #54 (comment) .

If you decide to merge this, please do a version bump and push the new version to pip.

@ondras ondras mentioned this pull request Mar 26, 2018
@@ -117,7 +117,10 @@ def Parse(self, user_agent_string):
os = match.group(1)

if self.os_v1_replacement:
os_v1 = self.os_v1_replacement
if re.search(r'\$1', self.os_v1_replacement):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind explaining what this is for? It seems we don't need a regular expression search here, and wouldn't just '\$1' in self.os_v1_replacement be sufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is basically a copy of https://github.com/ondras/uap-python/blob/990919b5f49ecb04c126b93123efabad2a95d757/ua_parser/user_agent_parser.py#L112 -- the very same logic that was already present for os_replacement. I aimed at code consistency here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's fair. I might attempt a follow up to change them to not use regular expressions since that's a bit heavy.

@mattrobenolt
Copy link
Member

There are still tests broken with this. :/ I just don't have the capacity to dig into these and figure out why.

@ondras
Copy link
Contributor Author

ondras commented Mar 26, 2018

@mattrobenolt that is very strange, as all tests passed for me. I have the capacity to dig into those, if you let me know what exactly fails and under what conditions (environment).

@mattrobenolt
Copy link
Member

Ignore the tox issues not being able to find python 2.6, etc. The python 2.7 case seems to be failing legitimately.

https://travis-ci.org/ua-parser/uap-python/jobs/358373849

We also probably need to get Travis running against 3.6 and remove these old interpreters that I guess tox doesn't support anymore?

@ondras
Copy link
Contributor Author

ondras commented Mar 26, 2018

https://travis-ci.org/ua-parser/uap-python/jobs/358373849

Interesting. Works for me with 2.7. Also, the issue reported does not really seem to be related to UAP regexes nor the test suite, but rather a (problematic) encoding of some related files. I will try to reproduce the behavior tomorrow.

What happens if you run those tests locally?

We also probably need to get Travis running against 3.6 and remove these old interpreters that I guess tox doesn't support anymore?

I have exactly zero experience with tox and/or Travis, unfortunately.

Also, this passing build seems to be based on 2.7: https://travis-ci.org/ua-parser/uap-python/jobs/358373862

@ondras
Copy link
Contributor Author

ondras commented Mar 28, 2018

@mattrobenolt I believe I fixed the issue now, please have a look.

@ondras
Copy link
Contributor Author

ondras commented Apr 3, 2018

@mattrobenolt sorry for pushing you, but we are kinda eager for this to be merged, as our workflow depends heavily on uap-python pip package...

@mattrobenolt
Copy link
Member

I have to follow up and remove the 2.6/3.3/pypy builds though since those are still failing because of tox. :(

@mattrobenolt mattrobenolt merged commit 14bf01b into ua-parser:master Apr 9, 2018
@mattrobenolt
Copy link
Member

Released in 0.8.0 https://pypi.org/project/ua-parser/0.8.0/

@ondras
Copy link
Contributor Author

ondras commented Apr 9, 2018

@mattrobenolt thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants