original_docstring: creates a numbered dir with a cleanup lock and removes old ones
docstring: creates a numbered dir with a cleanup lock and removes old ones
docstring_tokens: creates a numbered dir with a cleanup lock and removes old ones
code: def make_numbered_dir_with_cleanup(root, prefix, keep, lock_timeout):
      """creates a numbered dir with a cleanup lock and removes old ones"""
      e = None
      for i in range(10):
          try:
              p = make_numbered_dir(root, prefix)
              lock_path = create_cleanup_lock(p)
              register_cleanup_lock_removal(lock_path)
          except Exception as exc:
              e = exc
          else:
              consider_lock_dead_if_created_before = p.stat().st_mtime - lock_timeout
              cleanup_numbered_dir(
                  root=root,
                  prefix=prefix,
                  keep=keep,
                  consider_lock_dead_if_created_before=consider_lock_dead_if_created_before,
              )
              return p
      assert e is not None
      raise e
code_tokens: def make_numbered_dir_with_cleanup ( root , prefix , keep , lock_timeout ) : e = None for i in range ( 10 ) : try : p = make_numbered_dir ( root , prefix ) lock_path = create_cleanup_lock ( p ) register_cleanup_lock_removal ( lock_path ) except Exception as exc : e = exc else : consider_lock_dead_if_created_before = p . stat ( ) . st_mtime - lock_timeout cleanup_numbered_dir ( root = root , prefix = prefix , keep = keep , consider_lock_dead_if_created_before = consider_lock_dead_if_created_before , ) return p assert e is not None raise e
short_docstring: creates a numbered dir with a cleanup lock and removes old ones
short_docstring_tokens: creates a numbered dir with a cleanup lock and removes old ones
comment: """creates a numbered dir with a cleanup lock and removes old ones"""