<commit_before>from __future__ import absolute_import, division, print_function, unicode_literals
# -*- coding: utf-8 -*-
'''python library for accessing the openHAB REST API'''

#
# <NAME> (c) 2016 <<EMAIL>>
#
# python-openhab is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# python-openhab is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with python-openhab.  If not, see <http://www.gnu.org/licenses/>.
#

# pylint: disable=bad-indentation

import six
import datetime
import dateutil.parser

__author__ = '<NAME> <<EMAIL>>'
__license__ = 'AGPLv3+'


class CommandType(object):
  '''Base command type class'''

  @classmethod
  def validate(cls, value):
    raise NotImplemented()


class StringType(CommandType):
  @classmethod
  def validate(cls, value):
    if not isinstance(value, six.string_types):
      raise ValueError()


class OnOffType(StringType):
  @classmethod
  def validate(cls, value):
    super(OnOffType, cls).validate(value)

    if value not in ['ON', 'OFF']:
      raise ValueError()


class OpenCloseType(StringType):
  @classmethod
  def validate(cls, value):
    super(OpenCloseType, cls).validate(value)

    if value not in ['OPEN', 'CLOSED']:
      raise ValueError()


class DecimalType(CommandType):
  @classmethod
  def validate(cls, value):
    if not (isinstance(value, float) or isinstance(value, int)):
      raise ValueError()


class PercentType(DecimalType):
  @classmethod
  def validate(cls, value):
    super(OnOffType, cls).validate(value)

    if not (value >= 0 and value <= 100):
      raise ValueError()


class IncreaseDecreaseType(StringType):
  @classmethod
  def validate(cls, value):
    super(IncreaseDecreaseType, cls).validate(value)

    if value not in ['INCREASE', 'DECREASE']:
      raise ValueError()<commit_msg>type; wrong type<commit_after>from __future__ import absolute_import, division, print_function, unicode_literals
# -*- coding: utf-8 -*-
'''python library for accessing the openHAB REST API'''

#
# <NAME> (c) 2016 <<EMAIL>>
#
# python-openhab is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# python-openhab is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with python-openhab.  If not, see <http://www.gnu.org/licenses/>.
#

# pylint: disable=bad-indentation

import six
import datetime
import dateutil.parser

__author__ = '<NAME> <<EMAIL>>'
__license__ = 'AGPLv3+'


class CommandType(object):
  '''Base command type class'''

  @classmethod
  def validate(cls, value):
    raise NotImplemented()


class StringType(CommandType):
  @classmethod
  def validate(cls, value):
    if not isinstance(value, six.string_types):
      raise ValueError()


class OnOffType(StringType):
  @classmethod
  def validate(cls, value):
    super(OnOffType, cls).validate(value)

    if value not in ['ON', 'OFF']:
      raise ValueError()


class OpenCloseType(StringType):
  @classmethod
  def validate(cls, value):
    super(OpenCloseType, cls).validate(value)

    if value not in ['OPEN', 'CLOSED']:
      raise ValueError()


class DecimalType(CommandType):
  @classmethod
  def validate(cls, value):
    if not (isinstance(value, float) or isinstance(value, int)):
      raise ValueError()


class PercentType(DecimalType):
  @classmethod
  def validate(cls, value):
    super(PercentType, cls).validate(value)

    if not (value >= 0 and value <= 100):
      raise ValueError()


class IncreaseDecreaseType(StringType):
  @classmethod
  def validate(cls, value):
    super(IncreaseDecreaseType, cls).validate(value)

    if value not in ['INCREASE', 'DECREASE']:
      raise ValueError()
{'fraction_non_alphanumeric': 0.10555930677470178, 'fraction_numerical': 0.00495160927301373, 'mean_word_length': 4.284185493460167, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7510105', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1294, 'n_words': 469}