parameters: (name)
return_statement: return os.access(path, os.F_OK)
docstring: Return True if the given name refers to a root device (e.g.
      "sda", "nvme0n1") as opposed to a logical partition (e.g.  "sda1",
      "nvme0n1p1"). If name is a virtual device (e.g. "loop1", "ram")
      return True.
docstring_summary: Return True if the given name refers to a root device (e.g.
      "sda", "nvme0n1") as opposed to a logical partition (e.g.  "sda1",
      "nvme0n1p1"). If name is a virtual device (e.g. "loop1", "ram")
      return True.
docstring_tokens: Return True if the given name refers to a root device ( e . g . sda nvme0n1 ) as opposed to a logical partition ( e . g . sda1 nvme0n1p1 ) . If name is a virtual device ( e . g . loop1 ram ) return True .
function: def is_storage_device(name):
      """Return True if the given name refers to a root device (e.g.
      "sda", "nvme0n1") as opposed to a logical partition (e.g.  "sda1",
      "nvme0n1p1"). If name is a virtual device (e.g. "loop1", "ram")
      return True.
      """
      # Readapted from iostat source code, see:
      # https://github.com/sysstat/sysstat/blob/
      #     97912938cd476645b267280069e83b1c8dc0e1c7/common.c#L208
      # Some devices may have a slash in their name (e.g. cciss/c0d0...).
      name = name.replace('/', '!')
      including_virtual = True
      if including_virtual:
          path = "/sys/block/%s" % name
      else:
          path = "/sys/block/%s/device" % name
      return os.access(path, os.F_OK)
function_tokens: def is_storage_device ( name ) : # Readapted from iostat source code, see: # https://github.com/sysstat/sysstat/blob/ #     97912938cd476645b267280069e83b1c8dc0e1c7/common.c#L208 # Some devices may have a slash in their name (e.g. cciss/c0d0...). name = name . replace ( '/' , '!' ) including_virtual = True if including_virtual : path = "/sys/block/%s" % name else : path = "/sys/block/%s/device" % name return os . access ( path , os . F_OK )