def test_find_jupytext_configuration_file(tmpdir): nested = tmpdir.mkdir("nested") # Start with no configuration assert find_jupytext_configuration_file(str(nested)) is None # Configuration file in the parent directory root_config = tmpdir.join("jupytext.yml") root_config.write("\n") assert os.path.samefile( find_jupytext_configuration_file(str(tmpdir)), str(root_config) ) assert os.path.samefile( find_jupytext_configuration_file(str(nested)), str(root_config) ) # Local configuration file local_config = nested.join(".jupytext") local_config.write("\n") assert os.path.samefile( find_jupytext_configuration_file(str(tmpdir)), str(root_config) ) assert os.path.samefile( find_jupytext_configuration_file(str(nested)), str(local_config) )
def test_jupytext_py_is_not_a_configuration_file(tmpdir): jupytext_py = tmpdir.join("jupytext.py") jupytext_py.write("# Not a config file!") assert find_jupytext_configuration_file(str(tmpdir)) is None dot_jupytext_py = tmpdir.join(".jupytext.py") dot_jupytext_py.write("# This is a config file!") assert find_jupytext_configuration_file(str(tmpdir)) == str(dot_jupytext_py)
# extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.6.0 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # %% [markdown] # ### From https://www.kaggle.com/prmohanty/python-how-to-save-and-load-ml-models # %% from jupytext.config import find_jupytext_configuration_file find_jupytext_configuration_file('.') # %% [markdown] # # Entraînement du modèle # %% # Import Required packages #------------------------- # Import the Logistic Regression Module from Scikit Learn from sklearn.linear_model import LogisticRegression # Import the IRIS Dataset to be used in this Kernel from sklearn.datasets import load_iris # Load the Module to split the Dataset into Train & Test