in notebooks/notebook_template_review.py [0:0]
def validate(self, notebook: Notebook) -> bool:
"""
Parse the set project cells
"""
ret = True
cell = notebook.get()
if not cell['source'][0].startswith('#### Set your project ID'):
ret = notebook.report_error(ErrorCode.ERROR_PROJECTID_NOTFOUND, "Set project ID section not found")
else:
cell = notebook.get()
if cell['cell_type'] != 'code':
ret = notebook.report_error(ErrorCode.ERROR_PROJECTID_CODE_NOTFOUND, "Set project ID code section not found")
elif not cell['source'][0].startswith('PROJECT_ID = "[your-project-id]"'):
ret = notebook.report_error(ErrorCode.ERROR_PROJECTID_TEMPLATE, "Set project ID not match template")
cell = notebook.get()
if cell['cell_type'] != 'code' or 'or PROJECT_ID == "[your-project-id]":' not in cell['source'][0]:
ret = notebook.report_error(ErrorCode.ERROR_PROJECTID_TEMPLATE, "Set project ID not match template")
cell = notebook.get()
if cell['cell_type'] != 'code' or '! gcloud config set project' not in cell['source'][0]:
ret = notebook.report_error(ErrorCode.ERROR_PROJECTID_TEMPLATE, "Set project ID not match template")
return ret