Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _pandoc_installed():
try:
pypandoc.get_pandoc_path()
except OSError:
return False
return True
def test_get_pandoc_path(self):
result = pypandoc.get_pandoc_path()
assert "pandoc" in result
def create_sample_lua(self):
args = [pypandoc.get_pandoc_path(), '--print-default-data-file', 'sample.lua']
p = subprocess.Popen(args, stdout=subprocess.PIPE)
out, err = p.communicate()
return out.decode('utf-8')
from setuptools import setup
import pypandoc
from pypandoc.pandoc_download import download_pandoc
# see the documentation how to customize the installation path
# but be aware that you then need to include it in the `PATH`
try:
pypandoc.get_pandoc_path()
except OSError:
download_pandoc()
try:
from pypandoc import convert
read_md = lambda f: convert(f, 'rst')
except ImportError:
print("warning: pypandoc module not found, could not convert Markdown to RST")
read_md = lambda f: open(f, 'r').read()
import versioneer
import unittest
def bot_test():
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests', pattern='test_*.py')
home_link + "Readme.md",
"01- Neural Networks and Deep Learning":
home_link + "1-%20Neural%20Networks%20and%20Deep%20Learning/Readme.md",
"02- Improving Deep Neural Networks Hyperparameter tuning, Regularization and Optimization":
home_link + "2-%20Improving%20Deep%20Neural%20Networks/Readme.md",
"03- Structuring Machine Learning Projects":
home_link + "3-%20Structuring%20Machine%20Learning%20Projects/Readme.md",
"04- Convolutional Neural Networks":
home_link + "4-%20Convolutional%20Neural%20Networks/Readme.md",
"05- Sequence Models":
home_link + "5-%20Sequence%20Models/Readme.md",
}
# Extracting pandoc version
print("pandoc_version:", pypandoc.get_pandoc_version())
print("pandoc_path:", pypandoc.get_pandoc_path())
print("\n")
# Starting downloading and converting
for key, value in marks_down_links.items():
print("Converting", key)
pypandoc.convert_file(
value,
'pdf',
extra_args=['--pdf-engine=xelatex', '-V', 'geometry:margin=1.5cm'],
outputfile=(key + ".pdf")
)
print("Converting", key, "completed")
burger.create_folder_if_needed(temp_dir)
# Get the input and output file names
source = os.path.join(os.path.dirname(working_directory), 'README.rst')
dest = os.path.join(temp_dir, 'README.html')
# Was the file already created and newer than the source?
if burger.is_source_newer(source, dest):
# Load pandoc if needed to do the conversion
if hasattr(pypandoc, 'ensure_pandoc_installed'):
# pylint: disable=E1101
pypandoc.ensure_pandoc_installed(quiet=True, delete_installer=True)
else:
try:
pypandoc.get_pandoc_path()
except OSError:
pypandoc.download_pandoc()
pypandoc.convert_file(source, to='html', outputfile=dest)
return 0