Skip to content
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

Update --select arg to accept specific rules #16

Merged
merged 6 commits into from
Feb 1, 2024
Merged

Conversation

soulitzer
Copy link
Contributor

No description provided.

@soulitzer soulitzer requested a review from kit1980 January 29, 2024 19:44
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 29, 2024
torchfix/torchfix.py Outdated Show resolved Hide resolved
torchfix/torchfix.py Outdated Show resolved Hide resolved
@kit1980
Copy link
Contributor

kit1980 commented Jan 29, 2024

@soulitzer could you resolve the conflict so CI can run?

@soulitzer
Copy link
Contributor Author

Updated!

@kit1980
Copy link
Contributor

kit1980 commented Jan 30, 2024

Now the tests are failing because https://github.com/pytorch-labs/torchfix/blob/main/tests/test_torchfix.py#L23 passes select="ALL", but now it's select: List[str].

Also select: List[str] = None will not pass a typechecker.

torchfix/torchfix.py Outdated Show resolved Hide resolved
torchfix/torchfix.py Outdated Show resolved Hide resolved
torchfix/torchfix.py Outdated Show resolved Hide resolved
@soulitzer soulitzer requested a review from kit1980 January 31, 2024 19:23
@soulitzer
Copy link
Contributor Author

All the "ALL", default exclude, expansion handling is done in the arg processing/validation stage, so we don't need to deal with those later.

@kit1980
Copy link
Contributor

kit1980 commented Jan 31, 2024

Looks good overall, but there are couple of bugs:

$ torchfix . --select=ALL
Traceback (most recent call last):
  File "/home/sdym/.conda/envs/py39/bin/torchfix", line 8, in <module>
    sys.exit(main())
  File "/home/sdym/.conda/envs/py39/lib/python3.9/site-packages/torchfix/__main__.py", line 128, in main
    config.select = process_error_code_str(args.select)
  File "/home/sdym/.conda/envs/py39/lib/python3.9/site-packages/torchfix/__main__.py", line 34, in process_error_code_str
    raise ValueError(f"Invalid error code: {c}, available error "
ValueError: Invalid error code: ALL, available error codes: ['TOR003', 'TOR102', 'TOR002', 'TOR201', 'TOR202', 'TOR001', 'TOR101', 'TOR401']
$ torchfix . --select=TOR001
Traceback (most recent call last):
  File "/home/sdym/.conda/envs/py39/bin/torchfix", line 8, in <module>
    sys.exit(main())
  File "/home/sdym/.conda/envs/py39/lib/python3.9/site-packages/torchfix/__main__.py", line 128, in main
    config.select = process_error_code_str(args.select)
  File "/home/sdym/.conda/envs/py39/lib/python3.9/site-packages/torchfix/__main__.py", line 40, in process_error_code_str
    return list(expand_error_codes(raw_codes))
TypeError: unhashable type: 'list'

@soulitzer
Copy link
Contributor Author

Damn maybe I should've ran the code wtf lol

@kit1980
Copy link
Contributor

kit1980 commented Feb 1, 2024

Thanks!

@kit1980 kit1980 merged commit f219838 into main Feb 1, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants