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

fix: Fix conditional statement #38

Merged
merged 1 commit into from
Mar 8, 2023
Merged

Conversation

ajschmidt8
Copy link
Member

@ajschmidt8 ajschmidt8 commented Mar 8, 2023

There is currently a conditional statement that is incorrectly attempting to index a string instead of retrieving a value from a dictionary.

Instead of accessing f["output"], it needs to be adjusted to files[f]["output"]

The code excerpt below shows a minimal reproducer of the problem and the solution.

files = {'checks': {'matrix': {'cuda': ['11.8'], 'arch': ['x86_64'], 'py': ['3.10']}, 'output': 'conda', 'includes': ['checks', 'py_version']}}

# this throws error: "TypeError: string indices must be integers"
for f in files:
  f["output"]

# this fixes it
for f in files:
   files[f]["output"]

@ajschmidt8 ajschmidt8 requested a review from bdice March 8, 2023 00:20
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

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

Can we add a test for this? Fine if it happens in a follow-up PR, to unblock CI.

@ajschmidt8
Copy link
Member Author

Can we add a test for this? Fine if it happens in a follow-up PR, to unblock CI.

Yup, opened #39.

I'll merge this for now.

@ajschmidt8 ajschmidt8 merged commit dd4ccc5 into rapidsai:main Mar 8, 2023
@ajschmidt8 ajschmidt8 deleted the dict-fix branch March 8, 2023 00:23
ajschmidt8 pushed a commit that referenced this pull request Mar 8, 2023
## [1.5.1](v1.5.0...v1.5.1) (2023-03-08)

### Bug Fixes

* Fix conditional statement ([#38](#38)) ([dd4ccc5](dd4ccc5))
@ajschmidt8
Copy link
Member Author

🎉 This PR is included in version 1.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

difyrrwrzd added a commit to difyrrwrzd/dependency-file-generator that referenced this pull request Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants