diff --git a/pyjapc/_japc.py b/pyjapc/_japc.py index ef0d95307ba1c812bc3c24d012322b8369833f92..10ae8427d4d8a0e400603011ff27a120f4e6972a 100644 --- a/pyjapc/_japc.py +++ b/pyjapc/_japc.py @@ -226,7 +226,7 @@ class PyJapc: def _setup_jvm(self, log_level: typing.Optional[pyjapc_types.LogLevel]) -> None: """Startup the JVM and the connection to Python (JPype).""" - cmmnbuild_dep_manager.Manager(lvl=log_level).jvm_required() + cmmnbuild_dep_manager.Manager(lvl=log_level).jvm_required() # type: ignore[arg-type] log4j = jp.JPackage('org').apache.log4j if log4j.BasicConfigurator is not None and callable(log4j.BasicConfigurator.configure): @@ -384,7 +384,7 @@ class PyJapc: try: users = Timing.getUsers(machine) except cern.timing.client.TimingException: - users = ['ALL'] + users = ['ALL'] # type: ignore[assignment] except java.lang.IllegalArgumentException as err: # Machine not found. raise ValueError(f"Problem identifying the users for machine {machine!r}") from err @@ -894,6 +894,7 @@ class PyJapc: # TODO: It would be possible to implement this, if we really wanted the behaviour. raise ValueError(f"Cannot setParam on a parameter group ({p.getNames()})") + parValNew: typing.Any if isinstance(parameterValue, cern.japc.value.ParameterValue): # User provided a Java ParameterValueObject which can be handed to JAPC for SETTING right away parValNew = parameterValue diff --git a/pyjapc/_jpype_utils.py b/pyjapc/_jpype_utils.py index f7d81ba939c7446f8ed8ab7426c8d8c4d8f70f96..897014ad8b35d1b5c203572448ac912c5f728f40 100644 --- a/pyjapc/_jpype_utils.py +++ b/pyjapc/_jpype_utils.py @@ -50,8 +50,8 @@ class JavaGCCollector: _ = phase, info # Trigger the Java garbage collection. - if jp.isJVMStarted(): - jp.java.lang.System.gc() + if jp.isJVMStarted(): # type: ignore[attr-defined] + jp.java.lang.System.gc() # type: ignore[attr-defined] gc.callbacks.remove(self._gc_callback) self._added = False diff --git a/pyjapc/tests/test_pyjapc.py b/pyjapc/tests/test_pyjapc.py index 98c7cee373efa3f6b977be09b38ffb787d3385bb..52912022ad3354c0d386c8e826b7c75f634db30e 100644 --- a/pyjapc/tests/test_pyjapc.py +++ b/pyjapc/tests/test_pyjapc.py @@ -641,14 +641,14 @@ def test_set_group(japc: PyJapc, japc_mock): param = 'TEST/TestProperty' match = re.escape(f"Cannot setParam on a parameter group (['{param}', '{param}'])") with pytest.raises(ValueError, match=match): - japc.setParam([param, param], 1.0) + japc.setParam([param, param], 1.0) # type: ignore[arg-type] # setParam also supports a list. def test_set_group_mpv(japc: PyJapc, japc_mock): param = 'TEST/TestProperty' match = re.escape(f"Cannot setParam on a parameter group (['{param}', '{param}'])") with pytest.raises(ValueError, match=match): - japc.setParam([param, param], [japc_mock.mpv(['a'], [1]), japc_mock.mpv(['a'], [1])]) + japc.setParam([param, param], [japc_mock.mpv(['a'], [1]), japc_mock.mpv(['a'], [1])]) # type: ignore[arg-type] # setParam also supports a list. @pytest.mark.xfail