parameters: (partitions)
return_statement: return btrfs_subvolumes
docstring: Gets the job-configuration for btrfs subvolumes, or if there is
      none given, returns a default configuration that matches
      the setup (/ and /home) from before configurability was introduced.
  
      @param partitions
          The partitions (from the partitioning module) that will exist on disk.
          This is used to filter out subvolumes that don't need to be created
          because they get a dedicated partition instead.
docstring_summary: Gets the job-configuration for btrfs subvolumes, or if there is
      none given, returns a default configuration that matches
      the setup (/ and /home) from before configurability was introduced.
docstring_tokens: Gets the job - configuration for btrfs subvolumes or if there is none given returns a default configuration that matches the setup ( / and / home ) from before configurability was introduced .
function: def get_btrfs_subvolumes(partitions):
      """
      Gets the job-configuration for btrfs subvolumes, or if there is
      none given, returns a default configuration that matches
      the setup (/ and /home) from before configurability was introduced.
  
      @param partitions
          The partitions (from the partitioning module) that will exist on disk.
          This is used to filter out subvolumes that don't need to be created
          because they get a dedicated partition instead.
      """
      btrfs_subvolumes = libcalamares.job.configuration.get("btrfsSubvolumes", None)
      # Warn if there's no configuration at all, and empty configurations are
      # replaced by a simple root-only layout.
      if btrfs_subvolumes is None:
          libcalamares.utils.warning("No configuration for btrfsSubvolumes")
      if not btrfs_subvolumes:
          btrfs_subvolumes = [dict(mountPoint="/", subvolume="/@"), dict(mountPoint="/home", subvolume="/@home")]
  
      # Filter out the subvolumes which have a dedicated partition
      non_root_partition_mounts = [m for m in [p.get("mountPoint", None) for p in partitions] if
                                   m is not None and m != '/']
      btrfs_subvolumes = list(filter(lambda s: s["mountPoint"] not in non_root_partition_mounts, btrfs_subvolumes))
  
      # If we have a swap **file**, give it a separate subvolume.
      swap_choice = libcalamares.globalstorage.value("partitionChoices")
      if swap_choice and swap_choice.get("swap", None) == "file":
          btrfs_subvolumes.append({'mountPoint': '/swap', 'subvolume': '/@swap'})
  
      return btrfs_subvolumes
function_tokens: def get_btrfs_subvolumes ( partitions ) : btrfs_subvolumes = libcalamares . job . configuration . get ( "btrfsSubvolumes" , None ) # Warn if there's no configuration at all, and empty configurations are # replaced by a simple root-only layout. if btrfs_subvolumes is None : libcalamares . utils . warning ( "No configuration for btrfsSubvolumes" ) if not btrfs_subvolumes : btrfs_subvolumes = [ dict ( mountPoint = "/" , subvolume = "/@" ) , dict ( mountPoint = "/home" , subvolume = "/@home" ) ] # Filter out the subvolumes which have a dedicated partition non_root_partition_mounts = [ m for m in [ p . get ( "mountPoint" , None ) for p in partitions ] if m is not None and m != '/' ] btrfs_subvolumes = list ( filter ( lambda s : s [ "mountPoint" ] not in non_root_partition_mounts , btrfs_subvolumes ) ) # If we have a swap **file**, give it a separate subvolume. swap_choice = libcalamares . globalstorage . value ( "partitionChoices" ) if swap_choice and swap_choice . get ( "swap" , None ) == "file" : btrfs_subvolumes . append ( { 'mountPoint' : '/swap' , 'subvolume' : '/@swap' } ) return btrfs_subvolumes