Notebook type, acceptable values are 'jupyter' as well as any names
        defined by external notebook hooks that have been installed.
778426
def notebook_type(self, notebook_type):
        ''' 

        '''
        if notebook_type is None or not isinstance(notebook_type, string_types):
            raise ValueError("Notebook type must be a string")
        self._notebook_type = notebook_type.lower()
1276285
def load_notebook(self, name):
        """"""

        with open(self.get_path('%s.ipynb'%name)) as f:
            nb = nbformat.read(f, as_version=4)
        return nb,f
1369838
def guess_type(filename, **kwargs):
    

    extension = os.path.splitext(filename)[1]
    case = {'.xls': Xls,
            '.xlsx': Xlsx,
            '.csv': Csv}
    if extension and case.get(extension.lower()):
        low_extension = extension.lower()
        new_kwargs = dict()
        class_name = case.get(low_extension)
        class_kwargs = inspect.getargspec(class_name.__init__).args[1:]
        for kwarg in kwargs:
            if kwarg in class_kwargs:
                new_kwargs[kwarg] = kwargs[kwarg]
        return case.get(low_extension)(filename, **new_kwargs)
    else:
        raise Exception('No extension found')
166857
def get_notebook_item(name):
  
  env = notebook_environment()
  return google.datalab.utils.get_item(env, name)
1146384
def convert_notebook(self, name):
        """"""

        #subprocess.call(["jupyter","nbconvert","--to","python",
        #                self.get_path("%s.ipynb"%name)])
        exporter = nbconvert.exporters.python.PythonExporter()
        relative_path = self.convert_path(name)
        file_path = self.get_path("%s.ipynb"%relative_path)
        code = exporter.from_filename(file_path)[0]
        self.write_code(name, code)
        self.clean_code(name, [])
949040
def bind_type(python_value):
    """"""
    binding_table = {'bool': Bool, 'int': Int, 'float': Float}

    if python_value is None:
        return NoneType()

    python_type = type(python_value)

    gibica_type = binding_table.get(python_type.__name__)

    if gibica_type is None:
        raise TypeError('Impossible to recognize underlying type.')
    return gibica_type(python_value)
1102168
def convert_notebooks(self):
        """"""
        fnames = self.get_selected_filenames()
        if not isinstance(fnames, (tuple, list)):
            fnames = [fnames]
        for fname in fnames:
            self.convert_notebook(fname)
718845
def _check_import(module_names):
    """"""
    diagnostics = {}
    for module_name in module_names:
        try:
            __import__(module_name)
            res = 'ok'
        except ImportError as err:
            res = str(err)
        diagnostics[module_name] = res
    return diagnostics
1102637
def checkImportBindingsExtensions():
  
  import nupic.bindings.math
  import nupic.bindings.algorithms
  import nupic.bindings.engine_internal
323723
def load_notebook(fullname: str):
    """"""
    shell = InteractiveShell.instance()
    path = fullname

    # load the notebook object
    with open(path, 'r', encoding='utf-8') as f:
        notebook = read(f, 4)

    # create the module and add it to sys.modules
    mod = types.ModuleType(fullname)
    mod.__file__ = path
    # mod.__loader__ = self
    mod.__dict__['get_ipython'] = get_ipython
    sys.modules[fullname] = mod

    # extra work to ensure that magics that would affect the user_ns
    # actually affect the notebook module's ns
    save_user_ns = shell.user_ns
    shell.user_ns = mod.__dict__

    try:
        for cell in notebook.cells:
            if cell.cell_type == 'code':
                try:
                    # only run valid python code
                    ast.parse(cell.source)
                except SyntaxError:
                    continue
                try:
                    # pylint: disable=exec-used
                    exec(cell.source, mod.__dict__)
                except NameError:
                    print(cell.source)
                    raise
    finally:
        shell.user_ns = save_user_ns
    return mod
852218
def _recognize_basic_types(s):
    
    tps = [int, float]
    if not six.PY3:  # compat for older versions of six that don't have PY2
        tps.append(long)
    for tp in tps:
        try:
            return tp(s)
        except ValueError:
            pass
    if s.lower() == 'true':
        return True
    if s.lower() == 'false':
        return False
    if s.lower() in ['none', 'null']:
        return None

    return s
533828
def find_notebook(fullname, path=None):
    
    name = fullname.rsplit('.', 1)[-1]
    if not path:
        path = ['']
    for d in path:
        nb_path = os.path.join(d, name + ".ipynb")
        if os.path.isfile(nb_path):
            return nb_path
        # let import Notebook_Name find "Notebook Name.ipynb"
        nb_path = nb_path.replace("_", " ")
        if os.path.isfile(nb_path):
            return nb_path
1018152
def get_raw_import_values(self):  # pragma: no cover, deprecation
        
        properties = ['timeperiod_name', 'alias', 'use', 'register']
        res = {}
        for prop in properties:
            if hasattr(self, prop):
                val = getattr(self, prop)
                res[prop] = val
        # Now the unresolved one. The only way to get ride of same key things is to put
        # directly the full value as the key
        for other in self.unresolved:
            res[other] = ''
        return res
178517
def warn_import_error(type_of_obj_support: str, caught: ImportError):
    
    msg = StringIO()
    msg.writelines('Import Error while trying to add support for ' + type_of_obj_support + '. You may continue but '
                   'the associated parsers and converters wont be available : \n')
    traceback.print_tb(caught.__traceback__, file=msg)
    msg.writelines(str(caught.__class__.__name__) + ' : ' + str(caught) + '\n')
    warn(msg.getvalue())
164014
def jupyter_notebook(script_blocks, gallery_conf):
    
    first_cell = gallery_conf.get("first_notebook_cell", "%matplotlib inline")
    work_notebook = jupyter_notebook_skeleton()
    if first_cell is not None:
        add_code_cell(work_notebook, first_cell)
    fill_notebook(work_notebook, script_blocks)

    return work_notebook
87803
def isdefined(obj, force_import=False, namespace=None):
    """"""
    if namespace is None:
        namespace = locals()
    attr_list = obj.split('.')
    base = attr_list.pop(0)
    if len(base) == 0:
        return False
    if base not in builtins.__dict__ and base not in namespace:
        if force_import:
            try:
                module = __import__(base, globals(), namespace)
                if base not in globals():
                    globals()[base] = module
                namespace[base] = module
            except Exception:
                return False
        else:
            return False
    for attr in attr_list:
        try:
            attr_not_found = not hasattr(eval(base, namespace), attr)
        except (SyntaxError, AttributeError):
            return False
        if attr_not_found:
            if force_import:
                try:
                    __import__(base+'.'+attr, globals(), namespace)
                except (ImportError, SyntaxError):
                    return False
            else:
                return False
        base += '.'+attr
    return True
320453
def notebook_object_to_rst(ntbk, rpth, cr=None):
    

    # Parent directory of file rpth
    rdir = os.path.dirname(rpth)
    # File basename
    rb = os.path.basename(os.path.splitext(rpth)[0])

    # Pre-process notebook prior to conversion to rst
    if cr is not None:
        preprocess_notebook(ntbk, cr)
    # Convert notebook to rst
    rex = RSTExporter()
    rsttxt, rstres = rex.from_notebook_node(ntbk)
    # Replace `` with ` in sphinx cross-references
    rsttxt = re.sub(r':([^:]+):``(.*?)``', r':\1:`\2`', rsttxt)
    # Insert a cross-reference target at top of file
    reflbl = '.. _examples_' + os.path.basename(rdir) + '_' + \
             rb.replace('-', '_') + ':\n'
    rsttxt = reflbl + rsttxt
    # Write the converted rst to disk
    write_notebook_rst(rsttxt, rstres, rb, rdir)