-
Notifications
You must be signed in to change notification settings - Fork 158
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
Conversation
@@ -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): |
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.
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?
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 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.
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.
Ah, that's fair. I might attempt a follow up to change them to not use regular expressions since that's a bit heavy.
There are still tests broken with this. :/ I just don't have the capacity to dig into these and figure out why. |
@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). |
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? |
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?
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 |
@mattrobenolt I believe I fixed the issue now, please have a look. |
@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... |
I have to follow up and remove the 2.6/3.3/pypy builds though since those are still failing because of tox. :( |
Released in 0.8.0 https://pypi.org/project/ua-parser/0.8.0/ |
@mattrobenolt thanks a lot! |
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.