rapidsai / dependency-file-generator

https://pypi.org/project/rapids-dependency-file-generator/
Apache License 2.0
15 stars 13 forks source link

fix: Fix conditional statement #38

Closed ajschmidt8 closed 1 year ago

ajschmidt8 commented 1 year ago

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 commented 1 year ago

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

Yup, opened https://github.com/rapidsai/dependency-file-generator/issues/39.

I'll merge this for now.

ajschmidt8 commented 1 year ago

:tada: This PR is included in version 1.5.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: