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

Use namedtuples instead of array access values #685

@miyunari

Description

@miyunari

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions