override fun accepts()

in src/main/kotlin/com/jetbrains/micropython/settings/MicroPythonFacetDetector.kt [40:61]


        override fun accepts(fileContent: FileContent, context: ProcessingContext?): Boolean {
          val fileIndex = ProjectRootManager.getInstance(fileContent.project).fileIndex
          if (!fileIndex.isInContent(fileContent.file) || fileIndex.isInLibraryClasses(fileContent.file)) {
            return false
          }
          val detected = MicroPythonDeviceProvider.providers
              .asSequence()
              .flatMap { it.detectedModuleNames.asSequence() }
              .toSet()
          return when (val psiFile = fileContent.psiFile) {
            is PyFile -> {
              return psiFile.importBlock.any { imp ->
                when (imp) {
                  is PyFromImportStatement -> imp.importSourceQName?.firstComponent in detected
                  is PyImportStatement -> imp.importElements.any { it.importedQName?.firstComponent in detected }
                  else -> false
                }
              }
            }
            else -> false
          }
        }