src/nitpick/core.py
def enforce_present_absent(self, *partial_names: str) -> Iterator[Fuss]:
        """Enforce files that should be present or absent.

        :param partial_names: Names of the files to enforce configs for.
        :return: Fuss generator.
        """
        if not self.project:
            return

        for present in (True, False):
            key = "present" if present else "absent"
            logger.debug(f"Enforce {key} files")
            absent = not present
            file_mapping = self.project.nitpick_files_section.get(key, {})
            for filename in filter_names(file_mapping, *partial_names):
                custom_message = file_mapping[filename]
                file_path: Path = self.project.root / filename
                exists = file_path.exists()
                if (present and exists) or (absent and not exists):
                    continue

                reporter = Reporter(FileInfo.create(self.project, filename))

                extra = f": {custom_message}" if custom_message else ""
                violation = ProjectViolations.MISSING_FILE if present else ProjectViolations.FILE_SHOULD_BE_DELETED
                yield reporter.make_fuss(violation, extra=extra)
Enforce files that should be present or absent.

        :param partial_names: Names of the files to enforce configs for.
        :return: Fuss generator.
        
Enforce files that should be present or absent.
Enforce files that should be present or absent .
def enforce_present_absent(self, *partial_names: str) -> Iterator[Fuss]:
        if not self.project:
            return
        for present in (True, False):
            key = "present" if present else "absent"
            logger.debug(f"Enforce {key} files")
            absent = not present
            file_mapping = self.project.nitpick_files_section.get(key, {})
            for filename in filter_names(file_mapping, *partial_names):
                custom_message = file_mapping[filename]
                file_path: Path = self.project.root / filename
                exists = file_path.exists()
                if (present and exists) or (absent and not exists):
                    continue
                reporter = Reporter(FileInfo.create(self.project, filename))
                extra = f": {custom_message}" if custom_message else ""
                violation = ProjectViolations.MISSING_FILE if present else ProjectViolations.FILE_SHOULD_BE_DELETED
                yield reporter.make_fuss(violation, extra=extra)
def enforce_present_absent ( self , * partial_names : str ) -> Iterator [ Fuss ] : if not self . project : return for present in ( True , False ) : key = "present" if present else "absent" logger . debug ( f"Enforce {key} files" ) absent = not present file_mapping = self . project . nitpick_files_section . get ( key , { } ) for filename in filter_names ( file_mapping , * partial_names ) : custom_message = file_mapping [ filename ] file_path : Path = self . project . root / filename exists = file_path . exists ( ) if ( present and exists ) or ( absent and not exists ) : continue reporter = Reporter ( FileInfo . create ( self . project , filename ) ) extra = f": {custom_message}" if custom_message else "" violation = ProjectViolations . MISSING_FILE if present else ProjectViolations . FILE_SHOULD_BE_DELETED yield reporter . make_fuss ( violation , extra = extra )
Enforce files that should be present or absent.
Enforce files that should be present or absent .
"""Enforce files that should be present or absent.

        :param partial_names: Names of the files to enforce configs for.
        :return: Fuss generator.
        """
None
self
partial_names
str
Names of the files to enforce configs for.
Names of the files to enforce configs for .