The above copyright notice and this permission notice shall be included in all
   copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
   PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from app.NotebookConverter import NotebookConverter
from app.Formatter import ToNotebook

if __name__ == '__main__':
    import argparse

    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('-w', '--overwrite', action='store_true', help='Overwrite existing py files', default=False)
    parser.add_argument('-f', '--file', help='Specify an Ipython notebook if you only want to convert one. '
                                             '(This will overwrite default.)')
    parser.add_argument('--dry-run', action='store_true', help='Only prints what would happen', default=False)
    args = parser.parse_args()
    py2nb = NotebookConverter()
    fm = ToNotebook()

    if args.file is not None:
        py2nb.convert(args.file, ToNotebook(overwrite=args.overwrite, dry_run=args.dry_run))
    else:
        py2nb.convert_all('.', ToNotebook(overwrite=args.overwrite, dry_run=args.dry_run))
Ejemplo n.º 2
0
   PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from app.Formatter import ToPy
from app.NotebookConverter import NotebookConverter

if __name__ == '__main__':
    import argparse

    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('-w',
                        '--overwrite',
                        action='store_true',
                        help='Overwrite existing py files',
                        default=False)
    parser.add_argument(
        '-f',
        '--file',
        help='Specify an Ipython notebook if you only want to convert one. '
        '(This will overwrite default.)')
    args = parser.parse_args()
    nb2py = NotebookConverter()

    overwrite = not args.overwrite
    if args.file is not None:
        nb2py.convert(args.file, ToPy(args.file, overwrite))
    else:
        nb2py.convert_all('.', ToPy(overwrite))
   The above copyright notice and this permission notice shall be included in all
   copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
   PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
   WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from app.Formatter import ToPy
from app.NotebookConverter import NotebookConverter


if __name__ == '__main__':
    import argparse

    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('-w', '--overwrite', action='store_true', help='Overwrite existing py files', default=False)
    parser.add_argument('-f', '--file', help='Specify an Ipython notebook if you only want to convert one. '
                                             '(This will overwrite default.)')
    args = parser.parse_args()
    nb2py = NotebookConverter()

    overwrite=not args.overwrite
    if args.file is not None:
        nb2py.convert(args.file, ToPy(args.file, overwrite))
    else:
        nb2py.convert_all('.', ToPy(overwrite))
 def test_object_generation(self):
     nbconverter = NotebookConverter()
     self.assertIsInstance(nbconverter, NotebookConverter)