Skip to content

Commit

Permalink
EN-5125: Improvements to sanitize.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sagar-salvi-unskript committed Oct 12, 2023
1 parent 20afca2 commit 3781b36
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sanitize.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ def check_sanity(ipynbFile: str = '') -> bool:

cells = nb.get("cells")
for cell in cells:

cell_name = cell.get('metadata').get('name')
if cell_name == None:

Check failure on line 102 in sanitize.py

View workflow job for this annotation

GitHub Actions / Pylint

sanitize.py#L102

Comparison 'cell_name == None' should be 'cell_name is None' (singleton-comparison, C0121)
cell_name = cell.get('metadata').get('title')
if cell.get('cell_type') == 'markdown':
continue

Expand Down Expand Up @@ -133,6 +135,9 @@ def check_sanity(ipynbFile: str = '') -> bool:
# "task.configure(credentialsJson='''{\"credential_type\": \"" + md.action_type + "\",}''')"

if cell.get('metadata').get('legotype') is None:
if cell.get('metadata').get('actionNeedsCredential') == True:

Check failure on line 138 in sanitize.py

View workflow job for this annotation

GitHub Actions / Pylint

sanitize.py#L138

Comparison 'cell.get('metadata').get('actionNeedsCredential') == True' should be 'cell.get('metadata').get('actionNeedsCredential') is True' if checking for the singleton value True, or 'cell.get('metadata').get('actionNeedsCredential')' if testing for truthiness (singleton-comparison, C0121)
print(f"Failed actionNeedsCredential check for cell '{cell_name}'")
rc = False
continue

action_type = cell.get('metadata').get('legotype').replace("LEGO", "CONNECTOR")
Expand Down Expand Up @@ -197,7 +202,10 @@ def sanitize(ipynbFile: str = '') -> bool:
continue

if cell.get('metadata').get('legotype') is None:
print(f"Skipping cell without legotype {cell.get('metadata').get('name')}")
if cell.get('metadata').get('actionNeedsCredential') == True:

Check failure on line 205 in sanitize.py

View workflow job for this annotation

GitHub Actions / Pylint

sanitize.py#L205

Comparison 'cell.get('metadata').get('actionNeedsCredential') == True' should be 'cell.get('metadata').get('actionNeedsCredential') is True' if checking for the singleton value True, or 'cell.get('metadata').get('actionNeedsCredential')' if testing for truthiness (singleton-comparison, C0121)
cell['metadata']['actionNeedsCredential'] = False
cell['metadata']['actionSupportsIteration'] = False
cell['metadata']['actionSupportsPoll'] = False
new_cells.append(cell)
continue

Expand Down

0 comments on commit 3781b36

Please sign in to comment.