Skip to content

Instantly share code, notes, and snippets.

@adhadse
Created April 15, 2022 15:06
Show Gist options
  • Select an option

  • Save adhadse/0068d5d2ee6c11f6c2c899d51c6de9dc to your computer and use it in GitHub Desktop.

Select an option

Save adhadse/0068d5d2ee6c11f6c2c899d51c6de9dc to your computer and use it in GitHub Desktop.

Revisions

  1. adhadse created this gist Apr 15, 2022.
    17 changes: 17 additions & 0 deletions format.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/bin/bash -e

    base_dir=$(dirname $(dirname $0))
    target_dir="${base_dir}/examples/ ${base_dir}/keras_nlp/"
    targets="${base_dir}/*.py ${base_dir}/examples/ ${base_dir}/keras_nlp/"

    isort --sp "${base_dir}/setup.cfg" --sl ${targets}
    black --line-length 80 ${targets}

    for i in $(find ${target_dir} -name '*.py'); do
    if ! grep -q Copyright $i; then
    echo $i
    cat shell/copyright.txt $i >$i.new && mv $i.new $i
    fi
    done

    flake8 --config "${base_dir}/setup.cfg" ${targets}