Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def notebook_thumbnail(filename, subpath):
basename = os.path.splitext(os.path.basename(filename))[0]
dir_path = os.path.abspath(os.path.join(subpath, 'thumbnails'))
absdirpath= os.path.abspath(os.path.join('.', dir_path))
if not os.path.exists(absdirpath):
os.makedirs(absdirpath)
preprocessors = [OptsMagicProcessor(),
OutputMagicProcessor(),
StripTimeMagicsProcessor(),
StripServableSemicolonsProcessor(),
StripMagicsProcessor(),
ThumbnailProcessor(os.path.abspath(os.path.join(dir_path, basename)))]
return export_to_python(filename, preprocessors)
def __init__(self, basename, **kwargs):
self.basename = basename
super(ThumbnailProcessor, self).__init__(**kwargs)