Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Use namedtuples instead of array access values #685

Open
miyunari opened this issue Jul 25, 2023 · 0 comments
Open

Use namedtuples instead of array access values #685

miyunari opened this issue Jul 25, 2023 · 0 comments

Comments

@miyunari
Copy link
Member

We should change our array access values like entry.content["provider"] = filename[4] to nametuples to make our code easier to maintain and understand in the future.

@FKolwa example:

  from collections import namedtuple
  
  APIPath = namedtuple('APIPath', ['api_version', 'distro', 'provider', 'version','region','image_id'])
  
  split_path = "v2/rhel/google/9.0.0/us-east-1/asdasdasdadaf".split('/')
  api_path = APIPath(*split_path)
  
  print(api_path.api_version)
  print(api_path.image_id)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant