parameters: (self)
return_statement: return vs_versions
docstring: r"""
          Find Visual studio 2017+ versions from information in
          "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances".
  
          Return
          ------
          dict
              float version as key, path as value.
docstring_summary: r"""
          Find Visual studio 2017+ versions from information in
          "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances".
docstring_tokens: r Find Visual studio 2017 + versions from information in C : \ ProgramData \ Microsoft \ VisualStudio \ Packages \ _Instances .
function: def find_programdata_vs_vers(self):
          r"""
          Find Visual studio 2017+ versions from information in
          "C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances".
  
          Return
          ------
          dict
              float version as key, path as value.
          """
          vs_versions = {}
          instances_dir = \
              r'C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances'
  
          try:
              hashed_names = listdir(instances_dir)
  
          except (OSError, IOError):
              # Directory not exists with all Visual Studio versions
              return vs_versions
  
          for name in hashed_names:
              try:
                  # Get VS installation path from "state.json" file
                  state_path = join(instances_dir, name, 'state.json')
                  with open(state_path, 'rt', encoding='utf-8') as state_file:
                      state = json.load(state_file)
                  vs_path = state['installationPath']
  
                  # Raises OSError if this VS installation does not contain VC
                  listdir(join(vs_path, r'VC\Tools\MSVC'))
  
                  # Store version and path
                  vs_versions[self._as_float_version(
                      state['installationVersion'])] = vs_path
  
              except (OSError, IOError, KeyError):
                  # Skip if "state.json" file is missing or bad format
                  continue
  
          return vs_versions
function_tokens: def find_programdata_vs_vers ( self ) : vs_versions = { } instances_dir = r'C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances' try : hashed_names = listdir ( instances_dir ) except ( OSError , IOError ) : # Directory not exists with all Visual Studio versions return vs_versions for name in hashed_names : try : # Get VS installation path from "state.json" file state_path = join ( instances_dir , name , 'state.json' ) with open ( state_path , 'rt' , encoding = 'utf-8' ) as state_file : state = json . load ( state_file ) vs_path = state [ 'installationPath' ] # Raises OSError if this VS installation does not contain VC listdir ( join ( vs_path , r'VC\Tools\MSVC' ) ) # Store version and path vs_versions [ self . _as_float_version ( state [ 'installationVersion' ] ) ] = vs_path except ( OSError , IOError , KeyError ) : # Skip if "state.json" file is missing or bad format continue return vs_versions