Skip to content
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

Can't determine TML type if path name contains a period #17

Closed
boonhapus opened this issue Jan 29, 2024 · 1 comment
Closed

Can't determine TML type if path name contains a period #17

boonhapus opened this issue Jan 29, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@boonhapus
Copy link
Collaborator

The parser is naively implemented.

tml_type, _, _ = ".".join(_[1:] for _ in path.suffixes).partition(".")


Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from thoughtspot_tml import utils
>>> import pathlib
>>>
>>> p = pathlib.Path("/Users/first.last/Downloads/my liveboard in 9.0 + tabs.liveboard.tml")
>>> p.suffixes
['.0 + tabs', '.liveboard', '.tml']
>>>
>>> utils.determine_tml_type(path=p)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\work\thoughtspot\thoughtspot_tml\src\thoughtspot_tml\utils.py", line 117, in determine_tml_type
    raise TMLError("\n".join(lines))
thoughtspot_tml.exceptions.TMLError: could not parse TML type from 'info' or 'path', got '0 + tabs'
from path, '\Users\first.last\Downloads\my liveboard in 9.0 + tabs.liveboard.tml'
>>>
>>> name_and_type_suffix, _, _ = p.name.rpartition(".tml")
>>> name_and_type_suffix.rpartition(".")
('my liveboard in 9.0 + tabs', '.', 'liveboard')
>>>
>>> name, _, tml_type = name_and_type_suffix.rpartition(".")
>>> tml_type
'liveboard'
>>>
@boonhapus boonhapus added the bug Something isn't working label Jan 29, 2024
@boonhapus boonhapus self-assigned this Jan 29, 2024
@boonhapus
Copy link
Collaborator Author

Implemented as part of v2.0.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant