src/nitpick/formats.py
def load(self) -> bool:
        """Load a YAML file by its path, a string or a dict."""
        if self._loaded:
            return False

        yaml = YAML()
        yaml.map_indent = 2
        yaml.sequence_indent = 4
        yaml.sequence_dash_offset = 2

        if self.path is not None:
            self._string = Path(self.path).read_text()
        if self._string is not None:
            self._data = yaml.load(io.StringIO(self._string))
        if self._data is not None:
            if isinstance(self._data, BaseFormat):
                self._reformatted = self._data.reformatted
            else:
                output = io.StringIO()
                yaml.dump(self._data, output)
                self._reformatted = output.getvalue()

        self._loaded = True
        return True
Load a YAML file by its path, a string or a dict.
Load a YAML file by its path, a string or a dict.
Load a YAML file by its path a string or a dict .
def load(self) -> bool:
        if self._loaded:
            return False
        yaml = YAML()
        yaml.map_indent = 2
        yaml.sequence_indent = 4
        yaml.sequence_dash_offset = 2
        if self.path is not None:
            self._string = Path(self.path).read_text()
        if self._string is not None:
            self._data = yaml.load(io.StringIO(self._string))
        if self._data is not None:
            if isinstance(self._data, BaseFormat):
                self._reformatted = self._data.reformatted
            else:
                output = io.StringIO()
                yaml.dump(self._data, output)
                self._reformatted = output.getvalue()
        self._loaded = True
        return True
def load ( self ) -> bool : if self . _loaded : return False yaml = YAML ( ) yaml . map_indent = 2 yaml . sequence_indent = 4 yaml . sequence_dash_offset = 2 if self . path is not None : self . _string = Path ( self . path ) . read_text ( ) if self . _string is not None : self . _data = yaml . load ( io . StringIO ( self . _string ) ) if self . _data is not None : if isinstance ( self . _data , BaseFormat ) : self . _reformatted = self . _data . reformatted else : output = io . StringIO ( ) yaml . dump ( self . _data , output ) self . _reformatted = output . getvalue ( ) self . _loaded = True return True
Load a YAML file by its path, a string or a dict.
Load a YAML file by its path a string or a dict .
"""Load a YAML file by its path, a string or a dict."""
self