

def config():
    return {
        'is-oracle': True,
        'version': 'oracle-java8',
    }


from collections import namedtuple


JavaConfig = namedtuple('JavaConfig', ['is_oracle', 'version'])


def config():
    return JavaConfig(
        is_oracle=True,
        version='oracle-java8',
    )


Switch from dictionary to namedtuple
Switch from dictionary to namedtuple
+ from collections import namedtuple
+ 
+ 
+ JavaConfig = namedtuple('JavaConfig', ['is_oracle', 'version'])
  
  
  def config():
-     return {
+     return JavaConfig(
-         'is-oracle': True,
+         is_oracle=True,
-         'version': 'oracle-java8',
+         version='oracle-java8',
-     }
+     )
  
  
Switch from dictionary to namedtuple
## Code Before:


def config():
    return {
        'is-oracle': True,
        'version': 'oracle-java8',
    }


## Instruction:
Switch from dictionary to namedtuple
## Code After:
from collections import namedtuple


JavaConfig = namedtuple('JavaConfig', ['is_oracle', 'version'])


def config():
    return JavaConfig(
        is_oracle=True,
        version='oracle-java8',
    )

