
import logging

from st2client.models import core


LOG = logging.getLogger(__name__)


class KeyValuePair(core.Resource):
    _alias = 'Key'
    _display_name = 'Key Value Pair'
    _plural = 'Keys'
    _plural_display_name = 'Key Value Pairs'
    _repr_attributes = ['name', 'value']

    @property
    def id(self):
        # Note: This is a temporary hack until we refactor client and make it support non id PKs
        return self.name


import logging

from st2client.models import core


LOG = logging.getLogger(__name__)


class KeyValuePair(core.Resource):
    _alias = 'Key'
    _display_name = 'Key Value Pair'
    _plural = 'Keys'
    _plural_display_name = 'Key Value Pairs'
    _repr_attributes = ['name', 'value']

    # Note: This is a temporary hack until we refactor client and make it support non id PKs

    def get_id(self):
        return self.name

    def set_id(self, value):
        self.name = value

    id = property(get_id, set_id)

Fix it so it still works with a setter.
Fix it so it still works with a setter.

  
  import logging
  
  from st2client.models import core
  
  
  LOG = logging.getLogger(__name__)
  
  
  class KeyValuePair(core.Resource):
      _alias = 'Key'
      _display_name = 'Key Value Pair'
      _plural = 'Keys'
      _plural_display_name = 'Key Value Pairs'
      _repr_attributes = ['name', 'value']
  
-     @property
-     def id(self):
-         # Note: This is a temporary hack until we refactor client and make it support non id PKs
+     # Note: This is a temporary hack until we refactor client and make it support non id PKs
+ 
+     def get_id(self):
          return self.name
  
+     def set_id(self, value):
+         self.name = value
+ 
+     id = property(get_id, set_id)
+ 
Fix it so it still works with a setter.
## Code Before:

import logging

from st2client.models import core


LOG = logging.getLogger(__name__)


class KeyValuePair(core.Resource):
    _alias = 'Key'
    _display_name = 'Key Value Pair'
    _plural = 'Keys'
    _plural_display_name = 'Key Value Pairs'
    _repr_attributes = ['name', 'value']

    @property
    def id(self):
        # Note: This is a temporary hack until we refactor client and make it support non id PKs
        return self.name

## Instruction:
Fix it so it still works with a setter.
## Code After:

import logging

from st2client.models import core


LOG = logging.getLogger(__name__)


class KeyValuePair(core.Resource):
    _alias = 'Key'
    _display_name = 'Key Value Pair'
    _plural = 'Keys'
    _plural_display_name = 'Key Value Pairs'
    _repr_attributes = ['name', 'value']

    # Note: This is a temporary hack until we refactor client and make it support non id PKs

    def get_id(self):
        return self.name

    def set_id(self, value):
        self.name = value

    id = property(get_id, set_id)
