##// END OF EJS Templates
Python vs IPython: recommend %cd, %env over !cd, !export (#14629)...
Python vs IPython: recommend %cd, %env over !cd, !export (#14629) https://ipython.readthedocs.io/en/latest/interactive/python-ipython-diff.html#shell-assignment The quick overview mentioned `!cd DIR` among examples of shell commands one might use — but that doesn't work as user would hope (can only affect commands in same ! e.g. `!cd /; pwd`). That's not as bad now that `!cd` prints a warning, but IMHO better to provide the right mental model up front. => Replaced that with minimal motivation why `!cd` and `!export` can't work, recommending some %magic alternatives; moved it out of examples to not distract, and right before Magics section.

File last commit:

r25464:108fec78
r29044:cb55d942 merge main
Show More
autoformat_file
46 lines | 934 B | text/plain | TextLexer
#!/bin/bash
set -ueo pipefail
FILE=$1
echo "will update $FILE"
echo $LINENO $?
pyupgrade --py36-plus --exit-zero-even-if-changed $FILE
echo $LINENO $?
git commit -am"Apply pyupgrade to $FILE
pyupgrade --py36-plus $FILE
To ignore those changes when using git blame see the content of
.git-blame-ignore-revs"
HASH=$(git rev-parse HEAD)
echo "$HASH # apply pyupgrade to $FILE" >> .git-blame-ignore-revs
git commit -am'Update .git-blame-ignore-revs with previous commit'
#####
black --target-version py36 $FILE
git commit -am"Apply black to $FILE
black --target-version py36 $FILE
To ignore those changes when using git blame see the content of
.git-blame-ignore-revs"
HASH=$(git rev-parse HEAD)
echo "$HASH # apply black to $FILE" >> .git-blame-ignore-revs
git commit -am'Update .git-blame-ignore-revs with previous commit'
echo
echo "Updating, reformatting and adding to .git-blame-ignore-revs successful"