# Buggy code
def deploy():
    print("Current head:  ", HEAD)
    print("Current master:", MASTER)

    if not tools.is_ancestor(HEAD, MASTER):
        print("Not deploying due to not being on master")
        sys.exit(0)

    if not tools.has_travis_secrets():
        print("Running without access to secure variables, so no deployment")
        sys.exit(0)

    print("Decrypting secrets")
    tools.decrypt_secrets()
    tools.configure_git()

    for project in tools.all_projects():
        do_release(project)

    sys.exit(0)


# Traceback (AttributeError)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "...\hypothesis\strategies\_internal\strategies.py", line 314, in example
example_generating_inner_function()
File "...\hypothesis\strategies\_internal\strategies.py", line 302, in example_generating_inner_function
@settings(
File "...\hypothesis\core.py", line 1023, in wrapped_test
processed_args = process_arguments_to_given(
File "...\hypothesis\core.py", line 441, in process_arguments_to_given
search_strategy.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\collections.py", line 39, in do_validate
s.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 638, in do_validate
self.mapped_strategy.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\lazy.py", line 118, in do_validate
w.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 638, in do_validate
self.mapped_strategy.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\collections.py", line 39, in do_validate
s.validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 377, in validate
self.do_validate()
File "...\hypothesis\strategies\_internal\strategies.py", line 595, in do_validate
for e in self.element_strategies:
File "...\hypothesis\strategies\_internal\strategies.py", line 570, in element_strategies
if not arg.is_empty:
File "...\hypothesis\strategies\_internal\strategies.py", line 125, in accept
recur(self)
File "...\hypothesis\strategies\_internal\strategies.py", line 121, in recur
mapping[strat] = getattr(strat, calculation)(recur)
File "...\hypothesis\strategies\_internal\lazy.py", line 86, in calc_is_empty
return recur(self.wrapped_strategy)
File "...\hypothesis\strategies\_internal\strategies.py", line 121, in recur
mapping[strat] = getattr(strat, calculation)(recur)
File "...\hypothesis\strategies\_internal\deferred.py", line 80, in calc_is_empty
return recur(self.wrapped_strategy)
File "...\hypothesis\strategies\_internal\deferred.py", line 55, in wrapped_strategy
del self.__definition
AttributeError: _DeferredStrategy__definition

# Fixed code
def deploy():
    print("Current head:  ", HEAD)
    print("Current master:", MASTER)

    if not tools.is_ancestor(HEAD, MASTER):
        print("Not deploying due to not being on master")
        sys.exit(0)

    if "PYPI_TOKEN" not in os.environ:
        print("Running without access to secure variables, so no deployment")
        sys.exit(0)

    tools.configure_git()

    for project in tools.all_projects():
        do_release(project)

    sys.exit(0)