Skip to content

Commit 0f5f757

Browse files
committed
Refactor _is_valid_file to be mroe pythonic and extensible if we add more filetypes in the future. No more C++ code in the python :)
1 parent 2c605e5 commit 0f5f757

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

Document API/tableaudocumentapi/workbook.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ def _prepare_datasources(self, xmlRoot):
115115

116116
@staticmethod
117117
def _is_valid_file(filename):
118-
valid = 0
119118
fileExtension = os.path.splitext(filename)[-1].lower()
120-
if fileExtension == ".twb":
121-
valid = 1
122-
elif fileExtension == ".tds":
123-
valid = 1
124-
return valid
119+
return fileExtension in ('.twb', '.tds')
120+

0 commit comments

Comments
 (0)