diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 760ac43f..9f9c37fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: trailing-whitespace - id: mixed-line-ending - repo: https://github.com/nbQA-dev/nbQA - rev: 1.2.2 + rev: 1.2.3 hooks: - id: nbqa-black args: [-l80] @@ -38,7 +38,7 @@ repos: - id: isort args: ["--profile", "black", "-l80"] - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.1.0 hooks: - id: black args: [-l 80] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d48efd2..d6e55c37 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -116,3 +116,11 @@ However if you must exclude a file, you can do it with the [`exclude`](https://p pre-commit.ci comes with an autoupdate feature that cannot be disabled, it runs at least once a quarter (see in the config file `autoupdate_schedule: quarterly`). You can either accept and merge this PR, or if you probably don't want the Google CLA check to be failing, then create your own branch, run `pre-commit autoupdate`, and commit and merge the results, and delete the original PR. + +#### _pre-commit.ci is failing because `nbqa-black` and `black-jupyter` disagree (and maybe it worked fine locally)_ + +`nbqa-black` uses your local version of `black` (meaning the latest version on the server side), and this can clash with the `black` version pinned in the `pre-commit-config.yaml`. + +The solution is to upgrade your local `black` (such as `pip install --upgrade black`), run `pre-commit autoupdate` and push the changes. + +(In theory there would be a solution, in the pre-commit-config.yaml file in the nbqa-black section one could add something like `additional_dependencies : ['black:21.12b0']` ([see also the same advice in the nbQA doc](https://github.com/nbQA-dev/nbQA#pre-commit)), but probably this would add an unnecessary layer of manual maintenance burden (e.g. having to manually bump this version and sync with `black`'s).) diff --git a/notebooks/building_production_ml_systems/labs/taxifare/trainer/model.py b/notebooks/building_production_ml_systems/labs/taxifare/trainer/model.py index f023c3bf..a2d1149e 100644 --- a/notebooks/building_production_ml_systems/labs/taxifare/trainer/model.py +++ b/notebooks/building_production_ml_systems/labs/taxifare/trainer/model.py @@ -148,7 +148,7 @@ def transform(inputs, numeric_cols, nbuckets): ) ploc = fc.crossed_column([b_plat, b_plon], nbuckets * nbuckets) dloc = fc.crossed_column([b_dlat, b_dlon], nbuckets * nbuckets) - pd_pair = fc.crossed_column([ploc, dloc], nbuckets ** 4) + pd_pair = fc.crossed_column([ploc, dloc], nbuckets**4) feature_columns["pickup_and_dropoff"] = fc.embedding_column(pd_pair, 100) return transformed, feature_columns diff --git a/notebooks/building_production_ml_systems/solutions/taxifare/trainer/model.py b/notebooks/building_production_ml_systems/solutions/taxifare/trainer/model.py index f023c3bf..a2d1149e 100644 --- a/notebooks/building_production_ml_systems/solutions/taxifare/trainer/model.py +++ b/notebooks/building_production_ml_systems/solutions/taxifare/trainer/model.py @@ -148,7 +148,7 @@ def transform(inputs, numeric_cols, nbuckets): ) ploc = fc.crossed_column([b_plat, b_plon], nbuckets * nbuckets) dloc = fc.crossed_column([b_dlat, b_dlon], nbuckets * nbuckets) - pd_pair = fc.crossed_column([ploc, dloc], nbuckets ** 4) + pd_pair = fc.crossed_column([ploc, dloc], nbuckets**4) feature_columns["pickup_and_dropoff"] = fc.embedding_column(pd_pair, 100) return transformed, feature_columns diff --git a/notebooks/feature_engineering/solutions/4_keras_adv_feat_eng.ipynb b/notebooks/feature_engineering/solutions/4_keras_adv_feat_eng.ipynb index d53d6cec..8c5445b6 100644 --- a/notebooks/feature_engineering/solutions/4_keras_adv_feat_eng.ipynb +++ b/notebooks/feature_engineering/solutions/4_keras_adv_feat_eng.ipynb @@ -508,7 +508,7 @@ " # create crossed columns\n", " ploc = fc.crossed_column([b_plat, b_plon], nbuckets * nbuckets)\n", " dloc = fc.crossed_column([b_dlat, b_dlon], nbuckets * nbuckets)\n", - " pd_pair = fc.crossed_column([ploc, dloc], nbuckets ** 4)\n", + " pd_pair = fc.crossed_column([ploc, dloc], nbuckets**4)\n", "\n", " # create embedding columns\n", " feature_columns[\"pickup_and_dropoff\"] = fc.embedding_column(pd_pair, 100)\n", diff --git a/notebooks/introduction_to_tensorflow/labs/1_core_tensorflow.ipynb b/notebooks/introduction_to_tensorflow/labs/1_core_tensorflow.ipynb index ae9ecaae..e5086f1e 100644 --- a/notebooks/introduction_to_tensorflow/labs/1_core_tensorflow.ipynb +++ b/notebooks/introduction_to_tensorflow/labs/1_core_tensorflow.ipynb @@ -629,7 +629,7 @@ "outputs": [], "source": [ "X = tf.constant(np.linspace(0, 2, 1000), dtype=tf.float32)\n", - "Y = X * tf.exp(-(X ** 2))" + "Y = X * tf.exp(-(X**2))" ] }, { diff --git a/notebooks/introduction_to_tensorflow/labs/write_low_level_code.ipynb b/notebooks/introduction_to_tensorflow/labs/write_low_level_code.ipynb index cb821264..68532fe3 100644 --- a/notebooks/introduction_to_tensorflow/labs/write_low_level_code.ipynb +++ b/notebooks/introduction_to_tensorflow/labs/write_low_level_code.ipynb @@ -625,7 +625,7 @@ "outputs": [], "source": [ "X = tf.constant(np.linspace(0, 2, 1000), dtype=tf.float32)\n", - "Y = X * tf.exp(-(X ** 2))" + "Y = X * tf.exp(-(X**2))" ] }, { diff --git a/notebooks/introduction_to_tensorflow/solutions/1_core_tensorflow.ipynb b/notebooks/introduction_to_tensorflow/solutions/1_core_tensorflow.ipynb index c60122e2..c007c902 100644 --- a/notebooks/introduction_to_tensorflow/solutions/1_core_tensorflow.ipynb +++ b/notebooks/introduction_to_tensorflow/solutions/1_core_tensorflow.ipynb @@ -577,7 +577,7 @@ "outputs": [], "source": [ "X = tf.constant(np.linspace(0, 2, 1000), dtype=tf.float32)\n", - "Y = X * tf.exp(-(X ** 2))" + "Y = X * tf.exp(-(X**2))" ] }, { diff --git a/notebooks/introduction_to_tensorflow/solutions/4_keras_functional_api.ipynb b/notebooks/introduction_to_tensorflow/solutions/4_keras_functional_api.ipynb index 1d2f6ec9..e88a72af 100644 --- a/notebooks/introduction_to_tensorflow/solutions/4_keras_functional_api.ipynb +++ b/notebooks/introduction_to_tensorflow/solutions/4_keras_functional_api.ipynb @@ -180,7 +180,7 @@ " hash_bucket_size=NBUCKETS * NBUCKETS,\n", ")\n", "fc_crossed_pd_pair = fc.crossed_column(\n", - " [fc_crossed_dloc, fc_crossed_ploc], hash_bucket_size=NBUCKETS ** 4\n", + " [fc_crossed_dloc, fc_crossed_ploc], hash_bucket_size=NBUCKETS**4\n", ")\n", "\n", "# 3. Create embedding columns for the crossed columns\n", diff --git a/notebooks/jax/exercises/JAX_Flax_for_AI_Residents_Practical_Session_(go_flax_air) (2).ipynb b/notebooks/jax/exercises/JAX_Flax_for_AI_Residents_Practical_Session_(go_flax_air) (2).ipynb index 91295c16..beb993be 100644 --- a/notebooks/jax/exercises/JAX_Flax_for_AI_Residents_Practical_Session_(go_flax_air) (2).ipynb +++ b/notebooks/jax/exercises/JAX_Flax_for_AI_Residents_Practical_Session_(go_flax_air) (2).ipynb @@ -286,7 +286,7 @@ }, "source": [ "def f(x, y):\n", - " return 2 * x * y ** 2\n", + " return 2 * x * y**2\n", "\n", "\n", "# YOUR ACTION REQUIRED:\n", @@ -423,11 +423,11 @@ "\n", "@jax.jit\n", "def f1_jit(x):\n", - " return x ** 0.5\n", + " return x**0.5\n", "\n", "\n", "def f2(x):\n", - " return x ** 0.5\n", + " return x**0.5\n", "\n", "\n", "# It's really the same.\n", @@ -788,7 +788,7 @@ " for value in value_flat:\n", " if isinstance(value, jnp.ndarray):\n", " value = value.sum()\n", - " tot += value ** 2\n", + " tot += value**2\n", " return tot\n", "\n", "\n", diff --git a/notebooks/jax/solutions/jax_fundamentals.ipynb b/notebooks/jax/solutions/jax_fundamentals.ipynb index 6fcd6337..2239f034 100644 --- a/notebooks/jax/solutions/jax_fundamentals.ipynb +++ b/notebooks/jax/solutions/jax_fundamentals.ipynb @@ -603,7 +603,7 @@ ], "source": [ "def f(x, y):\n", - " return 2 * x * y ** 2\n", + " return 2 * x * y**2\n", "\n", "\n", "# YOUR ACTION REQUIRED:\n", @@ -862,11 +862,11 @@ "\n", "@jax.jit\n", "def f1_jit(x):\n", - " return x ** 0.5\n", + " return x**0.5\n", "\n", "\n", "def f2(x):\n", - " return x ** 0.5\n", + " return x**0.5\n", "\n", "\n", "# It's really the same.\n", @@ -1612,7 +1612,7 @@ " for value in value_flat:\n", " if isinstance(value, jnp.ndarray):\n", " value = value.sum()\n", - " tot += value ** 2\n", + " tot += value**2\n", " return tot\n", "\n", "\n", diff --git a/notebooks/ml_fairness_explainability/explainable_ai/integrated_gradients.ipynb b/notebooks/ml_fairness_explainability/explainable_ai/integrated_gradients.ipynb index 94a74752..2ea2078f 100644 --- a/notebooks/ml_fairness_explainability/explainable_ai/integrated_gradients.ipynb +++ b/notebooks/ml_fairness_explainability/explainable_ai/integrated_gradients.ipynb @@ -1267,7 +1267,7 @@ " plots.\n", " \"\"\"\n", " # fn plot args\n", - " x = tf.linspace(start_val, end_val, m_steps ** 2 + 1)\n", + " x = tf.linspace(start_val, end_val, m_steps**2 + 1)\n", " y = fn(x)\n", "\n", " fig = plt.figure(figsize=(16, 4))\n", diff --git a/notebooks/supplemental/labs/autoencoder.ipynb b/notebooks/supplemental/labs/autoencoder.ipynb index 905c0911..4838bf55 100644 --- a/notebooks/supplemental/labs/autoencoder.ipynb +++ b/notebooks/supplemental/labs/autoencoder.ipynb @@ -609,7 +609,7 @@ " filenames = sorted(filenames)\n", " last = -1\n", " for i, filename in enumerate(filenames):\n", - " frame = 2 * (i ** 0.5)\n", + " frame = 2 * (i**0.5)\n", " if round(frame) > round(last):\n", " last = frame\n", " else:\n", diff --git a/notebooks/supplemental/labs/deepconv_gan.ipynb b/notebooks/supplemental/labs/deepconv_gan.ipynb index d5f8be3a..6049ccb4 100644 --- a/notebooks/supplemental/labs/deepconv_gan.ipynb +++ b/notebooks/supplemental/labs/deepconv_gan.ipynb @@ -828,7 +828,7 @@ " filenames = sorted(filenames)\n", " last = -1\n", " for i, filename in enumerate(filenames):\n", - " frame = 2 * (i ** 0.5)\n", + " frame = 2 * (i**0.5)\n", " if round(frame) > round(last):\n", " last = frame\n", " else:\n", diff --git a/notebooks/supplemental/solutions/autoencoder.ipynb b/notebooks/supplemental/solutions/autoencoder.ipynb index 2a497a88..ed108136 100644 --- a/notebooks/supplemental/solutions/autoencoder.ipynb +++ b/notebooks/supplemental/solutions/autoencoder.ipynb @@ -653,7 +653,7 @@ " filenames = sorted(filenames)\n", " last = -1\n", " for i, filename in enumerate(filenames):\n", - " frame = 2 * (i ** 0.5)\n", + " frame = 2 * (i**0.5)\n", " if round(frame) > round(last):\n", " last = frame\n", " else:\n", diff --git a/notebooks/supplemental/solutions/deepconv_gan.ipynb b/notebooks/supplemental/solutions/deepconv_gan.ipynb index 2d5447fe..709ee18a 100644 --- a/notebooks/supplemental/solutions/deepconv_gan.ipynb +++ b/notebooks/supplemental/solutions/deepconv_gan.ipynb @@ -888,7 +888,7 @@ " filenames = sorted(filenames)\n", " last = -1\n", " for i, filename in enumerate(filenames):\n", - " frame = 2 * (i ** 0.5)\n", + " frame = 2 * (i**0.5)\n", " if round(frame) > round(last):\n", " last = frame\n", " else:\n",