Skip to content

Genie.py ruff & pyright #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Genie.py ruff & pyright #45

wants to merge 11 commits into from

Conversation

jackbdoughty
Copy link
Contributor

@jackbdoughty jackbdoughty commented May 21, 2025

  • makes genie.py pass ruff & pyright (when running only pyright genie.py)
  • changes a few of other files though so some files that this PR makes changes to which are already passing ruff & pyright may need revisiting

@jackbdoughty
Copy link
Contributor Author

Failing checks are from files that are to be covered in other PRs afaik

@@ -31,7 +31,12 @@
)

if TYPE_CHECKING:
from genie_python.genie import PVValue
from genie_python.genie import (
PVValue,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_epics_api.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_epics_api.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_epics_api.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_epics_api.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_epics_api.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_epics_api.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_epics_api.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_epics_api.

Copilot Autofix

AI 1 day ago

To resolve the cyclic import issue, we can break the dependency between genie_python.genie_epics_api and genie_python.genie. Since the imports under TYPE_CHECKING are only used for type hints, we can use forward references (string literals) for type annotations instead of importing the actual symbols. This eliminates the need for the TYPE_CHECKING block and removes the cyclic dependency.

Specifically:

  1. Replace the TYPE_CHECKING block (lines 33-39) with forward references in the type annotations where PVValue, _CgetReturn, _GetbeamlineparsReturn, and _GetSampleParsReturn are used.
  2. Remove the import of TYPE_CHECKING from the typing module, as it will no longer be needed.

Suggested changeset 1
src/genie_python/genie_epics_api.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/genie_python/genie_epics_api.py b/src/genie_python/genie_epics_api.py
--- a/src/genie_python/genie_epics_api.py
+++ b/src/genie_python/genie_epics_api.py
@@ -12,3 +12,3 @@
 from io import open
-from typing import TYPE_CHECKING, Any, Callable
+from typing import Any, Callable
 
@@ -32,9 +32,7 @@
 
-if TYPE_CHECKING:
-    from genie_python.genie import (
-        PVValue,
-        _CgetReturn,
-        _GetbeamlineparsReturn,
-        _GetSampleParsReturn,
-    )
+# Use forward references for type annotations to avoid cyclic imports
+PVValue = "_PVValue"
+_CgetReturn = "_CgetReturn"
+_GetbeamlineparsReturn = "_GetbeamlineparsReturn"
+_GetSampleParsReturn = "_GetSampleParsReturn"
 
EOF
@@ -12,3 +12,3 @@
from io import open
from typing import TYPE_CHECKING, Any, Callable
from typing import Any, Callable

@@ -32,9 +32,7 @@

if TYPE_CHECKING:
from genie_python.genie import (
PVValue,
_CgetReturn,
_GetbeamlineparsReturn,
_GetSampleParsReturn,
)
# Use forward references for type annotations to avoid cyclic imports
PVValue = "_PVValue"
_CgetReturn = "_CgetReturn"
_GetbeamlineparsReturn = "_GetbeamlineparsReturn"
_GetSampleParsReturn = "_GetSampleParsReturn"

Copilot is powered by AI and may make mistakes. Always verify output.
from genie_python.genie import PVValue
from genie_python.genie import (
PVValue,
_CgetReturn,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_epics_api.

Copilot Autofix

AI 1 day ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

from genie_python.genie import (
PVValue,
_CgetReturn,
_GetbeamlineparsReturn,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.

Copilot Autofix

AI 1 day ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

PVValue,
_CgetReturn,
_GetbeamlineparsReturn,
_GetSampleParsReturn,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_epics_api
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_epics_api.

Copilot Autofix

AI 1 day ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

@@ -16,7 +17,13 @@
from genie_python.utilities import require_runstate

if TYPE_CHECKING:
from genie_python.genie import PVValue, _GetspectrumReturn
from genie_python.genie import (
PVValue,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_simulate_impl.

Copilot Autofix

AI 1 day ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

from genie_python.genie import PVValue, _GetspectrumReturn
from genie_python.genie import (
PVValue,
_CgetReturn,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_CgetReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _CgetReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.

Copilot Autofix

AI 1 day ago

To resolve the cyclic import issue, we can break the dependency loop by moving the type definitions (_CgetReturn, PVValue, etc.) into a separate module. This new module will serve as a shared location for type definitions, which can then be imported by both genie_python.genie and genie_python.genie_simulate_impl without creating a circular dependency. This approach adheres to the recommendation of moving interdependent parts into a third module.

Steps to fix:

  1. Create a new module, e.g., genie_python.genie_types, to house the type definitions.
  2. Move the type definitions (_CgetReturn, PVValue, etc.) from genie_python.genie to genie_python.genie_types.
  3. Update the TYPE_CHECKING block in genie_python.genie_simulate_impl to import these types from genie_python.genie_types instead of genie_python.genie.
  4. Update any other references to these types in the codebase to use the new module.

Suggested changeset 1
src/genie_python/genie_simulate_impl.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/genie_python/genie_simulate_impl.py b/src/genie_python/genie_simulate_impl.py
--- a/src/genie_python/genie_simulate_impl.py
+++ b/src/genie_python/genie_simulate_impl.py
@@ -19,3 +19,3 @@
 if TYPE_CHECKING:
-    from genie_python.genie import (
+    from genie_python.genie_types import (
         PVValue,
EOF
@@ -19,3 +19,3 @@
if TYPE_CHECKING:
from genie_python.genie import (
from genie_python.genie_types import (
PVValue,
Copilot is powered by AI and may make mistakes. Always verify output.
from genie_python.genie import (
PVValue,
_CgetReturn,
_GetbeamlineparsReturn,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetbeamlineparsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetbeamlineparsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.

Copilot Autofix

AI 1 day ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

PVValue,
_CgetReturn,
_GetbeamlineparsReturn,
_GetSampleParsReturn,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetSampleParsReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetSampleParsReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.

Copilot Autofix

AI 1 day ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

_CgetReturn,
_GetbeamlineparsReturn,
_GetSampleParsReturn,
_GetspectrumReturn,

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'_GetspectrumReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetspectrumReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetspectrumReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetspectrumReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetspectrumReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetspectrumReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetspectrumReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetspectrumReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetspectrumReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetspectrumReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetspectrumReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetspectrumReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.
'_GetspectrumReturn' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_simulate_impl
, as the
definition
of _GetspectrumReturn occurs after the cyclic
import
of genie_python.genie_simulate_impl.

Copilot Autofix

AI 1 day ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.


from genie_python.utilities import check_break, get_time_delta

if TYPE_CHECKING:
from genie_python.genie import PVValue

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_waitfor
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_waitfor.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_waitfor
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_waitfor.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_waitfor
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_waitfor.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_waitfor
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_waitfor.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_waitfor
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_waitfor.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_waitfor
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_waitfor.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_waitfor
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_waitfor.
'PVValue' may not be defined if module
genie_python.genie
is imported before module
genie_python.genie_waitfor
, as the
definition
of PVValue occurs after the cyclic
import
of genie_python.genie_waitfor.

Copilot Autofix

AI 1 day ago

To resolve the cyclic import issue, we can break the dependency by moving the PVValue type annotation to a string literal. This approach avoids importing PVValue entirely, as type annotations can be expressed as strings in Python. This eliminates the cyclic dependency while preserving the type information for static analysis tools.


Suggested changeset 1
src/genie_python/genie_waitfor.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/genie_python/genie_waitfor.py b/src/genie_python/genie_waitfor.py
--- a/src/genie_python/genie_waitfor.py
+++ b/src/genie_python/genie_waitfor.py
@@ -15,5 +15,5 @@
 if TYPE_CHECKING:
-    from genie_python.genie import PVValue
     from genie_python.genie_epics_api import API
 
+
 NUMERIC_TYPE = (float, int)
EOF
@@ -15,5 +15,5 @@
if TYPE_CHECKING:
from genie_python.genie import PVValue
from genie_python.genie_epics_api import API


NUMERIC_TYPE = (float, int)
Copilot is powered by AI and may make mistakes. Always verify output.
Tom-Willemsen
Tom-Willemsen previously approved these changes May 23, 2025
@Tom-Willemsen
Copy link
Contributor

Happy for this to be merged once pyright gives a green tick (which may just be merges/rebase against branches mentioned where these errors were fixed?)

Comment on lines +34 to +39
from genie_python.genie import (
PVValue,
_CgetReturn,
_GetbeamlineparsReturn,
_GetSampleParsReturn,
)

Check notice

Code scanning / CodeQL

Unused import Note

Import of '_CgetReturn' is not used.
Import of '_GetbeamlineparsReturn' is not used.
Import of '_GetSampleParsReturn' is not used.

Copilot Autofix

AI 1 day ago

To fix the problem, we should remove _CgetReturn from the import statement on line 34. This will eliminate the unused import while preserving the other imported items that might still be in use. This change will not affect the functionality of the code, as _CgetReturn is not referenced anywhere in the provided snippet.


Suggested changeset 1
src/genie_python/genie_epics_api.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/genie_python/genie_epics_api.py b/src/genie_python/genie_epics_api.py
--- a/src/genie_python/genie_epics_api.py
+++ b/src/genie_python/genie_epics_api.py
@@ -35,3 +35,2 @@
         PVValue,
-        _CgetReturn,
         _GetbeamlineparsReturn,
EOF
@@ -35,3 +35,2 @@
PVValue,
_CgetReturn,
_GetbeamlineparsReturn,
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants