Skip to content

Fix pyright 1.1.407 typing errors in azure-health-deidentification#46742

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/update-typing-for-pyright-1-1-407
Draft

Fix pyright 1.1.407 typing errors in azure-health-deidentification#46742
Copilot wants to merge 2 commits intomainfrom
copilot/update-typing-for-pyright-1-1-407

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

Pyright 1.1.407 tightened inference on dict.get(key, default) — when the default is data.__class__, it now infers type | None instead of type, causing issubclass(enum_type, Enum) to fail type checking.

Changes

  • _serialization.py / _utils/serialization.py: Wrap the dict.get default with cast(type, ...) so pyright resolves enum_type as type.
# Before
enum_type = self.dependencies.get(data_type, data.__class__)

# After
enum_type = self.dependencies.get(data_type, cast(type, data.__class__))

Consistent with the fix already applied in other SDK packages (e.g., azure-mgmt-containerservice).

Automated Fix: This PR was automatically generated by Copilot in response to a vnext compatibility issue.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • centralus-2.in.applicationinsights.azure.com
    • Triggering command: /home/REDACTED/bin/azsdk /home/REDACTED/bin/azsdk ingest-telemetry --client-type copilot-cli --event-type skill_invocation --session-id 34a2c7e8-1f46-455a-85c0-cbf28e9d08ae --skill-name find-package-skill (dns block)
  • pypi.org
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.10/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-i8idps88/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=42 wheel (dns block)
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.10/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-s1531cce/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=40.8.0 (dns block)
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/lib/python3.10/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-936g67jq/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED -- setuptools>=40.8.0 (dns block)
  • pypi.python.org
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/bin/python -m pip install pyright==1.1.407 (dns block)
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/lib/python3.10/site-packages/pip/__pip-REDACTED__.py install --ignore-installed --no-user --prefix /tmp/pip-build-env-fq9cwd68/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i REDACTED --extra-index-url REDACTED -- setuptools>=40.8.0 wheel (dns block)
    • Triggering command: /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/bin/python /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/bin/python -m pip install /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/.staging/azure_health_deidentification-1.1.0b1.tar.gz /home/REDACTED/work/azure-sdk-for-python/azure-sdk-for-python/.venv/azure-health-deidentification/.venv_next-pyright/.staging/dl/azure_core-1.40.0-py3-none-any.whl (dns block)
  • scanning-api.github.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update typing for azure-health-deidentification for pyright 1.1.407 Fix pyright 1.1.407 typing errors in azure-health-deidentification May 5, 2026
Copilot AI requested a review from azure-sdk May 5, 2026 22:57
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.

azure-health-deidentification needs typing updates for pyright version 1.1.407

2 participants