original_docstring: Return the next job id.
docstring: Return the next job id.
docstring_tokens: Return the next job id .
code: def next_job_id(output_dir: Path) -> str:
      """Return the next job id."""
      # The ids are of form "0001", "0002", ...
      # Such ids are used for naming log files "0001.log" etc.
      # We look for the first id that haven't been used in the output directory.
  
      def make_job_id(n: int) -> str:
          return f"{n:0>4}"
  
      n = 1
  
      if output_dir.is_dir():
          existing_job_ids = {
              f.name.split(".", maxsplit=1)[0] for f in output_dir.glob("*.*")
          }
          while make_job_id(n) in existing_job_ids:
              n += 1
  
      return make_job_id(n)
code_tokens: def next_job_id ( output_dir : Path ) -> str : def make_job_id ( n : int ) -> str : return f"{n:0>4}" n = 1 if output_dir . is_dir ( ) : existing_job_ids = { f . name . split ( "." , maxsplit = 1 ) [ 0 ] for f in output_dir . glob ( "*.*" ) } while make_job_id ( n ) in existing_job_ids : n += 1 return make_job_id ( n )
short_docstring: Return the next job id.
short_docstring_tokens: Return the next job id .
comment: """Return the next job id."""$SEP$# The ids are of form "0001", "0002", ...$SEP$# Such ids are used for naming log files "0001.log" etc.$SEP$# We look for the first id that haven't been used in the output directory.