Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if project is None:
return None, None
# Get project metadata for UUID & username/title
if is_uuid(project):
project_title = None
metadata = api.get_gist(project)
elif '/' in project:
project_title = project.split('/')[1]
username = api.get_current_user()['username']
metadata = api.get_gist(project)
# Attach username to the title
else:
project_title = project
username = api.get_current_user()['username']
metadata = api.get_gist(username + '/' + project)
# Skip if metadata could not be found
if not metadata:
log('Creating a new project "' + username + '/' + project_title + '"')
return project_title, None
# Extract information from metadata
username = metadata['owner']['username']
project_title = metadata['title']
project_id = metadata['slug']
# Check if the current user can commit to this project
permissions = api.get_gist_access(project_id)
if not permissions['write']:
return project_title, None
if not new_project and project is None:
# From in-memory variable
if current_slug is not None:
project = current_slug
# From .jovianrc file
else:
project = get_notebook_slug(filename)
# Skip if project is not provided & can't be read
if project is None:
return None, None
# Get project metadata for UUID & username/title
if is_uuid(project):
project_title = None
metadata = api.get_gist(project)
elif '/' in project:
project_title = project.split('/')[1]
username = api.get_current_user()['username']
metadata = api.get_gist(project)
# Attach username to the title
else:
project_title = project
username = api.get_current_user()['username']
metadata = api.get_gist(username + '/' + project)
# Skip if metadata could not be found
if not metadata:
log('Creating a new project "' + username + '/' + project_title + '"')
return project_title, None
# Extract information from metadata
# From .jovianrc file
else:
project = get_notebook_slug(filename)
# Skip if project is not provided & can't be read
if project is None:
return None, None
# Get project metadata for UUID & username/title
if is_uuid(project):
project_title = None
metadata = api.get_gist(project)
elif '/' in project:
project_title = project.split('/')[1]
username = api.get_current_user()['username']
metadata = api.get_gist(project)
# Attach username to the title
else:
project_title = project
username = api.get_current_user()['username']
metadata = api.get_gist(username + '/' + project)
# Skip if metadata could not be found
if not metadata:
log('Creating a new project "' + username + '/' + project_title + '"')
return project_title, None
# Extract information from metadata
username = metadata['owner']['username']
project_title = metadata['title']
project_id = metadata['slug']