          Monkey patching :func:`builtins.open` to dummy in json file
  
      """
      assert hasattr(configs_instance, "_parse_json")
      file = ('{"test": "param"}')
      monkeypatch.setattr("builtins.open", lambda *args, **kwargs: StringIO(file))
  
      converted = configs_instance._parse_json(".file")
      assert isinstance(converted, str)
      assert converted == ("test:                     param\n")
 
</s> remove     monkeypatch.setattr("builtins.open", lambda *args, **kwargs: StringIO('{"backend": "amd"}'))
 </s> add     monkeypatch.setattr("builtins.open", lambda *args, **kwargs: StringIO('{"backend": "cpu"}')) </s> remove     assert backend.backend == "amd"
 </s> add     assert backend.backend == "cpu" </s> remove     def test__add_amd_loss_labels(self,
                                  event_parser_instance: _EventParser,
                                  mocker: pytest_mock.MockerFixture) -> None:
        """ Test _add_amd_loss_labels works correctly

        Parameters
        ----------
        event_parser_instance: :class:`lib.gui.analysis.event_reader._EventParser`
            The class instance to test
        mocker: :class:`pytest_mock.MockerFixture`
            Mocker for checking Session data
        """
        event_parse = event_parser_instance

        # Already collected
        assert not event_parse._cache._loss_labels
        event_parse._cache._loss_labels.extend(["label_a", "label_b"])
        event_parse._add_amd_loss_labels(1)
        assert not event_parse._loss_labels

        # New labels
        event_parse._cache._loss_labels = []
        mock_session = mocker.patch("lib.gui.analysis.Session")
        mock_session.get_loss_keys.return_value = ["label_c", "label_d"]
        assert not event_parse._cache._loss_labels
        event_parse._add_amd_loss_labels(1)
        assert event_parse._loss_labels == ["label_c", "label_d"]

 </s> add  </s> remove         if get_backend() == "amd":
            # We can't log the graph in Tensorboard logs for AMD so need to obtain from state file
            loss_keys = {int(sess_id): [name for name in session["loss_names"] if name != "total"]
                         for sess_id, session in self._state["sessions"].items()}
        else:
            assert self._tb_logs is not None
            loss_keys = {sess_id: list(logs.keys())
                         for sess_id, logs
                         in self._tb_logs.get_loss(session_id=session_id).items()}
 </s> add         assert self._tb_logs is not None
        loss_keys = {sess_id: list(logs.keys())
                     for sess_id, logs
                     in self._tb_logs.get_loss(session_id=session_id).items()} </s> remove         model_kwargs = dict(custom_objects=dict(L2Norm=L2Norm, SliceO2K=SliceO2K))
 </s> add         model_kwargs = {"custom_objects": {"L2Norm": L2Norm, "SliceO2K": SliceO2K}}
    file = '{"test": "param"}'
          Monkey patching :func:`builtins.open` to dummy in json file
  
      """
      assert hasattr(configs_instance, "_parse_json")
    file = '{"test": "param"}'
      monkeypatch.setattr("builtins.open", lambda *args, **kwargs: StringIO(file))
  
      converted = configs_instance._parse_json(".file")
      assert isinstance(converted, str)
      assert converted == ("test:                     param\n")
keep keep keep keep replace keep keep keep keep keep
 Remove plaidML support (#1325)

* Remove PlaidML reference from readme files

* Remove AMD option from installers

* remove amd requirements and update setup.py

* remove plaidml test from CI workflow

* gpustats: remove plaidml backend

* plaid removals:
  - faceswap.py - python version check
  - setup.cfg - plaidml typing ignore
  - lib.keras_utils - All plaid code
  - lib.launcher.py - All plaidml checks and configuration

* remove tf2.2 specific code from GUI event reader

* lib.model - remove all plaidml implementations

* plugins.extract - remove plaidml code

* plugins.train remove plaidml code

* lib.convert - remove plaidml code

* tools.model: remove plaidml code

* Remove plaidML tests from unit tests

* remove plaidml_utils and docsting cleanups

* Remove plaidML refs from configs

* fix keras imports 
tests/lib/sysinfo_test.py