
import logging
import yaml
from collections import namedtuple

log = logging.getLogger(__name__)


def load(filename):
    with open(filename) as fp:
        config = yaml.safe_load(fp)

    return CfnCliConfig.load(config)


class CfnCliConfig(namedtuple('CfnCliConfig', 'version blueprints environments')):
    CFNFILE_V1 = 1
    CFNFILE_V2 = 2

    VERSION_SECTION = 'Version'
    BLUEPRINT_SECTION = 'Blueprints'
    ENVIRONMENT_SECTION = 'Environments'

    @classmethod
    def load(cls, config):
        # load version
        version = config.get(cls.VERSION_SECTION, cls.CFNFILE_V1)

        # load blueprint into dict
        blueprint_section = config.get(cls.BLUEPRINT_SECTION, {})
        blueprints = {}
        for key, val in blueprint_section:
            blueprints[key] = Blueprint.load(val)

        # load environment into dict
        environment_section = config.get(cls.ENVIRONMENT_SECTION, {})
        environments = {}
        for key, val in environment_section:
            environments[key] = Environment.load(val)

        return cls(version, blueprints, environments)


class Stack(namedtuple('Stack', '')):
    @classmethod
    def load(cls, config):
        return cls()


class Environment(namedtuple('Environment', '')):
    @classmethod
    def load(cls, config):
        return cls()


class Blueprint(namedtuple('Blueprint', '')):
    @classmethod
    def load(cls, config):
        return cls()



import logging
import yaml
from collections import namedtuple

log = logging.getLogger(__name__)


def load(filename):
    with open(filename) as fp:
        config = yaml.safe_load(fp)

    return CfnCliConfig.load(config)


class CfnCliConfig(namedtuple('CfnCliConfig', 'version blueprints environments')):
    CFNFILE_V1 = 1
    CFNFILE_V2 = 2

    VERSION_SECTION = 'Version'
    BLUEPRINT_SECTION = 'Blueprints'
    ENVIRONMENT_SECTION = 'Environments'

    @staticmethod
    def load(config):
        # load version
        version = config.get(CfnCliConfig.VERSION_SECTION, CfnCliConfig.CFNFILE_V1)

        # load blueprint into dict
        blueprint_section = config.get(CfnCliConfig.BLUEPRINT_SECTION, {})
        blueprints = {}
        for key, val in blueprint_section:
            blueprints[key] = Blueprint.load(val)

        # load environment into dict
        environment_section = config.get(CfnCliConfig.ENVIRONMENT_SECTION, {})
        environments = {}
        for key, val in environment_section:
            environments[key] = Environment.load(val)

        return CfnCliConfig(version, blueprints, environments)


class Stack(namedtuple('Stack', '')):
    @staticmethod
    def load(config):
        return Stack()


class Environment(namedtuple('Environment', '')):
    @staticmethod
    def load(config):
        return Environment()


class Blueprint(namedtuple('Blueprint', '')):
    @staticmethod
    def load(config):
        return Blueprint()

Use static method instead of classmethod
Use static method instead of classmethod

  
  import logging
  import yaml
  from collections import namedtuple
  
  log = logging.getLogger(__name__)
  
  
  def load(filename):
      with open(filename) as fp:
          config = yaml.safe_load(fp)
  
      return CfnCliConfig.load(config)
  
  
  class CfnCliConfig(namedtuple('CfnCliConfig', 'version blueprints environments')):
      CFNFILE_V1 = 1
      CFNFILE_V2 = 2
  
      VERSION_SECTION = 'Version'
      BLUEPRINT_SECTION = 'Blueprints'
      ENVIRONMENT_SECTION = 'Environments'
  
-     @classmethod
+     @staticmethod
-     def load(cls, config):
+     def load(config):
          # load version
-         version = config.get(cls.VERSION_SECTION, cls.CFNFILE_V1)
+         version = config.get(CfnCliConfig.VERSION_SECTION, CfnCliConfig.CFNFILE_V1)
  
          # load blueprint into dict
-         blueprint_section = config.get(cls.BLUEPRINT_SECTION, {})
+         blueprint_section = config.get(CfnCliConfig.BLUEPRINT_SECTION, {})
          blueprints = {}
          for key, val in blueprint_section:
              blueprints[key] = Blueprint.load(val)
  
          # load environment into dict
-         environment_section = config.get(cls.ENVIRONMENT_SECTION, {})
+         environment_section = config.get(CfnCliConfig.ENVIRONMENT_SECTION, {})
          environments = {}
          for key, val in environment_section:
              environments[key] = Environment.load(val)
  
-         return cls(version, blueprints, environments)
+         return CfnCliConfig(version, blueprints, environments)
  
  
  class Stack(namedtuple('Stack', '')):
-     @classmethod
+     @staticmethod
-     def load(cls, config):
+     def load(config):
-         return cls()
+         return Stack()
  
  
  class Environment(namedtuple('Environment', '')):
-     @classmethod
+     @staticmethod
-     def load(cls, config):
+     def load(config):
-         return cls()
+         return Environment()
  
  
  class Blueprint(namedtuple('Blueprint', '')):
-     @classmethod
+     @staticmethod
-     def load(cls, config):
+     def load(config):
-         return cls()
+         return Blueprint()
  
- 
Use static method instead of classmethod
## Code Before:

import logging
import yaml
from collections import namedtuple

log = logging.getLogger(__name__)


def load(filename):
    with open(filename) as fp:
        config = yaml.safe_load(fp)

    return CfnCliConfig.load(config)


class CfnCliConfig(namedtuple('CfnCliConfig', 'version blueprints environments')):
    CFNFILE_V1 = 1
    CFNFILE_V2 = 2

    VERSION_SECTION = 'Version'
    BLUEPRINT_SECTION = 'Blueprints'
    ENVIRONMENT_SECTION = 'Environments'

    @classmethod
    def load(cls, config):
        # load version
        version = config.get(cls.VERSION_SECTION, cls.CFNFILE_V1)

        # load blueprint into dict
        blueprint_section = config.get(cls.BLUEPRINT_SECTION, {})
        blueprints = {}
        for key, val in blueprint_section:
            blueprints[key] = Blueprint.load(val)

        # load environment into dict
        environment_section = config.get(cls.ENVIRONMENT_SECTION, {})
        environments = {}
        for key, val in environment_section:
            environments[key] = Environment.load(val)

        return cls(version, blueprints, environments)


class Stack(namedtuple('Stack', '')):
    @classmethod
    def load(cls, config):
        return cls()


class Environment(namedtuple('Environment', '')):
    @classmethod
    def load(cls, config):
        return cls()


class Blueprint(namedtuple('Blueprint', '')):
    @classmethod
    def load(cls, config):
        return cls()


## Instruction:
Use static method instead of classmethod
## Code After:

import logging
import yaml
from collections import namedtuple

log = logging.getLogger(__name__)


def load(filename):
    with open(filename) as fp:
        config = yaml.safe_load(fp)

    return CfnCliConfig.load(config)


class CfnCliConfig(namedtuple('CfnCliConfig', 'version blueprints environments')):
    CFNFILE_V1 = 1
    CFNFILE_V2 = 2

    VERSION_SECTION = 'Version'
    BLUEPRINT_SECTION = 'Blueprints'
    ENVIRONMENT_SECTION = 'Environments'

    @staticmethod
    def load(config):
        # load version
        version = config.get(CfnCliConfig.VERSION_SECTION, CfnCliConfig.CFNFILE_V1)

        # load blueprint into dict
        blueprint_section = config.get(CfnCliConfig.BLUEPRINT_SECTION, {})
        blueprints = {}
        for key, val in blueprint_section:
            blueprints[key] = Blueprint.load(val)

        # load environment into dict
        environment_section = config.get(CfnCliConfig.ENVIRONMENT_SECTION, {})
        environments = {}
        for key, val in environment_section:
            environments[key] = Environment.load(val)

        return CfnCliConfig(version, blueprints, environments)


class Stack(namedtuple('Stack', '')):
    @staticmethod
    def load(config):
        return Stack()


class Environment(namedtuple('Environment', '')):
    @staticmethod
    def load(config):
        return Environment()


class Blueprint(namedtuple('Blueprint', '')):
    @staticmethod
    def load(config):
        return Blueprint()
