Open
Conversation
deathbird
requested changes
Nov 8, 2022
| # This is needed in case the first tag is skipped to retain | ||
| # the file's formating | ||
| first_tag_position = parsed.text_position + len(parsed.text) | ||
| parsed_text_length = len(parsed.text) if parsed.text else 0 |
Contributor
There was a problem hiding this comment.
Actually both parsed.text and text_position are None. Look:
In [41]: parsed.__dict__
Out[41]:
{'source': '<resources/>\n',
'start': 0,
'_position': 0,
'_tag': 'resources',
'_attrib': {},
'_attrib_string': '',
'_attributes': [],
'_text_position': None,
'_text': None,
'_content_end': openformats.utils.xml.NewDumbXml.NOT_CACHED,
'_tail_position': 12,
'_tail': openformats.utils.xml.NewDumbXml.NOT_CACHED}
In [40]: first_tag_position = parsed.text_position + 0
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In [40], line 1
----> 1 first_tag_position = parsed.text_position + 0
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Contributor
There was a problem hiding this comment.
As you see from the above dumped parsed object the template is empty! The resource https://www.transifex.com/careem-1/ridehail-android/translate/#ur/features_ridehail_ui doesn't contain any strings. So I believe we are safe to put it like:
if parsed.text and parsed.text_position:
first_tag_position = parsed.text_position + len(parsed.text)
self.transcriber.copy_until(first_tag_position)The rest of the compile() method code will run without errors...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and/or solution
fixes this sentry error: https://sentry.io/organizations/transifex/issues/2918954663/?referrer=slack
How to test
Reviewer checklist
Code:
PR: