parameters: (logdir)
return_statement: return files
docstring: Parses `logdir` into a map from paths to run group names.
  
    The events files flag format is a comma-separated list of path specifications.
    A path specification either looks like 'group_name:/path/to/directory' or
    '/path/to/directory'; in the latter case, the group is unnamed. Group names
    cannot start with a forward slash: /foo:bar/baz will be interpreted as a
    spec with no name and path '/foo:bar/baz'.
  
    Globs are not supported.
  
    Args:
      logdir: A comma-separated list of run specifications.
    Returns:
      A dict mapping directory paths to names like {'/path/to/directory': 'name'}.
      Groups without an explicit name are named after their path. If logdir is
      None, returns an empty dict, which is helpful for testing things that don't
      require any valid runs.
docstring_summary: Parses `logdir` into a map from paths to run group names.
docstring_tokens: Parses logdir into a map from paths to run group names .
function: def ParseEventFilesSpec(logdir):
    """Parses `logdir` into a map from paths to run group names.
  
    The events files flag format is a comma-separated list of path specifications.
    A path specification either looks like 'group_name:/path/to/directory' or
    '/path/to/directory'; in the latter case, the group is unnamed. Group names
    cannot start with a forward slash: /foo:bar/baz will be interpreted as a
    spec with no name and path '/foo:bar/baz'.
  
    Globs are not supported.
  
    Args:
      logdir: A comma-separated list of run specifications.
    Returns:
      A dict mapping directory paths to names like {'/path/to/directory': 'name'}.
      Groups without an explicit name are named after their path. If logdir is
      None, returns an empty dict, which is helpful for testing things that don't
      require any valid runs.
    """
    files = {}
    if logdir is None:
      return files
    for specification in logdir.split(','):
      # If it's a gcs path, don't split on colon
      if gcs.IsGCSPath(specification):
        run_name = None
        path = specification
      # If the spec looks like /foo:bar/baz, then we assume it's a path with a
      # colon.
      elif ':' in specification and specification[0] != '/':
        # We split at most once so run_name:/path:with/a/colon will work.
        run_name, _, path = specification.partition(':')
      else:
        run_name = None
        path = specification
      if not gcs.IsGCSPath(path):
        path = os.path.realpath(path)
      files[path] = run_name
    return files
function_tokens: def ParseEventFilesSpec ( logdir ) : files = { } if logdir is None : return files for specification in logdir . split ( ',' ) : # If it's a gcs path, don't split on colon if gcs . IsGCSPath ( specification ) : run_name = None path = specification # If the spec looks like /foo:bar/baz, then we assume it's a path with a # colon. elif ':' in specification and specification [ 0 ] != '/' : # We split at most once so run_name:/path:with/a/colon will work. run_name , _ , path = specification . partition ( ':' ) else : run_name = None path = specification if not gcs . IsGCSPath ( path ) : path = os . path . realpath ( path ) files [ path ] = run_name return files