Skip to content

Instantly share code, notes, and snippets.

@devTechi
devTechi / nullable_decorator.py
Last active February 12, 2021 09:45
I found the very usefull nullable or non-nullable arguments script on stackoverflow - https://stackoverflow.com/a/53639511. This guy also created a repository with his script: https://github.com/unitedsoftwork/python-not-none. I wanted to use it, but it didn't work with **kwargs. As I am using keyword arguments nearly every time I edited his scr…
def not_none(nullable_parameters=None):
# values given by real_decorator (see below)
def the_actual_test(f, expected_args_with_given, allowed_nullable_args):
has_none = False
bad_parameters = []
for key, value in expected_args_with_given.items():
if (value is None and nullable_parameters is None) or \
(value is None and key not in nullable_parameters):
bad_parameters.append(key)
# problem: when presenting, I want to obscure
# my prompt to act like it's at root of file system
# and be very basic with no git info, etc.
# solution: this theme lets you set a ENV to the path
# of your presentation, which will help remove unneeded prompt
# features while in that path
# oh-my-zsh theme for presenting demos
# based off the default rubbyrussell theme