Skip to content

Add P200 support in verify_generated_files.py and read_files_utils.py - #1541

Open
kyliechen-cisco wants to merge 1 commit into
facebook:mainfrom
kyliechen-cisco:kylie-cisco/p200-mustang-generate-py
Open

Add P200 support in verify_generated_files.py and read_files_utils.py#1541
kyliechen-cisco wants to merge 1 commit into
facebook:mainfrom
kyliechen-cisco:kylie-cisco/p200-mustang-generate-py

Conversation

@kyliechen-cisco

Copy link
Copy Markdown

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Test Plan

@kyliechen-cisco
kyliechen-cisco requested a review from a team as a code owner August 20, 2026 20:39
@meta-cla meta-cla Bot added the CLA Signed label Aug 20, 2026
@kyliechen-cisco

Copy link
Copy Markdown
Author

I tried to run pre-commit but hit the errors below. These appear to be pre-existing legacy lint issues in the two files touched by this PR that do not comply with the current Ruff configuration, rather than issues introduced by the P200 changes. ruff-check reported 53 errors; it automatically fixed 5 but left 48 unresolved, including deprecated typing.Dict/typing.List annotations, naming-rule violations, function-complexity limits, and a missing ClassVar annotation. ruff-format also reformatted both files. Since these changes are unrelated to this PR, I reverted the automatic fixes and formatting changes and used --no-verify to keep the PR scoped to the intended P200 changes. It looks like these files need a one-time cleanup or appropriate Ruff baselining.

Pre-commit errors
ruff check...............................................................Failed
- hook id: ruff-check
- exit code: 1
- files were modified by this hook

fboss/lib/platform_mapping_v2/read_files_utils.py:7:1: UP035 `typing.Dict` is deprecated, use `dict` instead
fboss/lib/platform_mapping_v2/read_files_utils.py:7:1: UP035 `typing.List` is deprecated, use `list` instead
fboss/lib/platform_mapping_v2/read_files_utils.py:56:47: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:73:31: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:73:41: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:89:28: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:104:35: UP006 Use `list` instead of `List` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:108:35: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:126:36: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:127:5: N806 Variable `STATIC_MAPPING_SUFFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:128:5: N806 Variable `Column` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:222:5: PLR0912 Too many branches (14 > 12)
fboss/lib/platform_mapping_v2/read_files_utils.py:223:16: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:225:5: N806 Variable `PORT_PROFILE_MAPPING_SUFFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:226:5: N806 Variable `Column` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:304:41: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:304:73: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:305:5: N806 Variable `PLATFORM_DESCRIPTOR_SUFFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:306:5: N806 Variable `VARIANT_ATTRIBUTES_COLUMN` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:307:5: N806 Variable `Column` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:341:38: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:342:5: N806 Variable `PROFILE_SETTINGS_SUFFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:343:5: N806 Variable `Column` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:415:5: PLR0912 Too many branches (76 > 12)
fboss/lib/platform_mapping_v2/read_files_utils.py:415:5: PLR0915 Too many statements (181 > 50)
fboss/lib/platform_mapping_v2/read_files_utils.py:416:16: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:419:5: N806 Variable `SI_SETTINGS_SUFFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:420:5: N806 Variable `CUSTOM_TX_PREFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:421:5: N806 Variable `CUSTOM_RX_PREFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:424:5: N806 Variable `Column` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:434:13: N806 Variable `Column` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:519:20: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:637:20: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:861:40: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:862:5: N806 Variable `VENDOR_CONFIG_SUFFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:866:30: A002 Function argument `map` is shadowing a Python builtin
fboss/lib/platform_mapping_v2/read_files_utils.py:866:35: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:866:54: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:903:16: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/read_files_utils.py:905:5: N806 Variable `SUFFIX` in function should be lowercase
fboss/lib/platform_mapping_v2/read_files_utils.py:906:5: N806 Variable `Column` in function should be lowercase
fboss/lib/platform_mapping_v2/test/verify_generated_files.py:8:1: UP035 `typing.Dict` is deprecated, use `dict` instead
fboss/lib/platform_mapping_v2/test/verify_generated_files.py:8:1: UP035 `typing.List` is deprecated, use `list` instead
fboss/lib/platform_mapping_v2/test/verify_generated_files.py:12:5: N811 Constant `INPUT_DIR` imported as non-constant `input_dir`
fboss/lib/platform_mapping_v2/test/verify_generated_files.py:25:41: UP006 Use `dict` instead of `Dict` for type annotation
fboss/lib/platform_mapping_v2/test/verify_generated_files.py:25:52: UP006 Use `list` instead of `List` for type annotation
fboss/lib/platform_mapping_v2/test/verify_generated_files.py:25:65: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
fboss/lib/platform_mapping_v2/test/verify_generated_files.py:122:54: UP006 Use `list` instead of `List` for type annotation

Found 53 errors (5 fixed, 48 remaining).
No fixes available (21 hidden fixes can be enabled with the `--unsafe-fixes` option).

ruff format..............................................................Failed
- hook id: ruff-format
- files were modified by this hook

2 files reformatted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant