code: def calculate_sources(self, targets):
      
      sources = set()
      for target in targets:
        sources.update(
          source for source in target.sources_relative_to_buildroot()
          if source.endswith(self._PYTHON_SOURCE_EXTENSION)
        )
      return sources
docs: Generate a set of source files from the given targets.