List of helpful shortcuts for faster coding
If you have any other helpful shortcuts, feel free to add in the comments of this gist :)
# make sure to replace `<hash>` with your gist's hash
git clone https://gist.github.com/<hash>.git # with https
git clone [email protected]:<hash>.git # or with ssh| class FullPaths(argparse.Action): | |
| """Expand user- and relative-paths""" | |
| def __call__(self, parser, namespace, values, option_string=None): | |
| setattr(namespace, self.dest, os.path.abspath(os.path.expanduser(values))) | |
| def is_dir(dirname): | |
| """Checks if a path is an actual directory""" | |
| if not os.path.isdir(dirname): | |
| msg = "{0} is not a directory".format(dirname) | |
| raise argparse.ArgumentTypeError(msg) |