Skip to content

refactor(ia): use *Any as argument instead of *PyObject#34

Merged
cesarcoatl merged 2 commits into
8.1from
refactor/ia/PyObject-Any
Jun 1, 2026
Merged

refactor(ia): use *Any as argument instead of *PyObject#34
cesarcoatl merged 2 commits into
8.1from
refactor/ia/PyObject-Any

Conversation

@cesarcoatl

@cesarcoatl cesarcoatl commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary by Sourcery

Enhancements:

  • Generalize *args type annotations from PyObject to Any for various scripting builtin, HTTP client, adapter, and collection-like interfaces.

@sourcery-ai

sourcery-ai Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR updates type comments across several scripting-related modules to use the broader *Any variadic type instead of *PyObject for positional arguments, aligning the stub signatures with more general argument acceptance while leaving runtime behavior unchanged.

Flow diagram for widening variadic argument types from PyObject to Any

flowchart TD
  A[Stub_methods_with_variadic_args]
  B[Positional_args_typed_as_PyObject]
  C[Update_type_comments_to_use_Any]
  D[Stub_methods_accept_broader_argument_types]

  A --> B
  B --> C
  C --> D
Loading

File-Level Changes

Change Details Files
Broadened OPC and scripting builtin function argument type comments from *PyObject to *Any.
  • Updated getServers, writeValue, writeValues, toCSV, toExcel, and parseTranslateArguments type comments to accept *Any for positional arguments
  • Ensured return type comments remain unchanged to preserve existing API contracts
src/com/inductiveautomation/ignition/common/script/builtin/__init__.py
Updated HTTP client stub method signatures to use *Any for positional arguments.
  • Changed delete, deleteAsync, get, getAsync, and RequestPromise.get type comments to accept *Any for positional arguments
  • Kept Response, Promise, and Any return types intact
src/com/inductiveautomation/ignition/common/script/builtin/http/__init__.py
Adjusted abstract collection and adapter APIs to accept *Any in variadic update/sort calls.
  • Replaced *PyObject with *Any in update and sort type comments for abstract and concrete collection-like classes
  • Aligned adapter Map update method with the new *Any convention
src/com/inductiveautomation/ignition/common/script/abc/__init__.py
src/com/inductiveautomation/ignition/common/script/adapters/__init__.py
Relaxed UI scripting builtin and core Jython list sort argument type comments to *Any.
  • Updated openDesktop and transform UI helper method type comments to use *Any for positional arguments
  • Changed org.python.core list sort method type comment from *PyObject to *Any
src/com/inductiveautomation/factorypmi/application/script/builtin/__init__.py
src/org/python/core/__init__.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • For each file where you changed *PyObject to *Any in type comments, ensure Any is imported (e.g., from typing) or otherwise defined in that module so that type checkers and tooling don’t encounter an undefined name.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- For each file where you changed `*PyObject` to `*Any` in type comments, ensure `Any` is imported (e.g., from `typing`) or otherwise defined in that module so that type checkers and tooling don’t encounter an undefined name.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@cesarcoatl cesarcoatl merged commit c46e9bc into 8.1 Jun 1, 2026
5 checks passed
@cesarcoatl cesarcoatl deleted the refactor/ia/PyObject-Any branch June 1, 2026 19:16
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.

1 participant