<commit_before>#
#

# Copyright (C) 2010 Google Inc.
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.


"""Module implementing the parameter types code."""

from ganeti import compat

# Modifiable default values; need to define these here before the
# actual LUs

def EmptyList():
  """Returns an empty list.

  """
  return []


def EmptyDict():
  """Returns an empty dict.

  """
  return {}


#: The without-default default value
NoDefault = object()


#: The no-type (value to complex to check it in the type system)
NoType = object()


# Some basic types
def TNotNone(val):
  """Checks if the given value is not None.

  """
  return val is not None


def TNone(val):
  """Checks if the given value is None.

  """
  return val is None


def TBool(val):
  """Checks if the given value is a boolean.

  """
  return isinstance(val, bool)


def TInt(val):
  """Checks if the given value is an integer.

  """
  return isinstance(val, int)


def TFloat(val):
  """Checks if the given value is a float.

  """
  return isinstance(val, float)


def TString(val):
  """Checks if the given value is a string.

  """
  return isinstance(val, basestring)

<commit_msg>ht.TInt: Exclude boolean values<commit_after>#
#

# Copyright (C) 2010 Google Inc.
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.


"""Module implementing the parameter types code."""

from ganeti import compat

# Modifiable default values; need to define these here before the
# actual LUs

def EmptyList():
  """Returns an empty list.

  """
  return []


def EmptyDict():
  """Returns an empty dict.

  """
  return {}


#: The without-default default value
NoDefault = object()


#: The no-type (value to complex to check it in the type system)
NoType = object()


# Some basic types
def TNotNone(val):
  """Checks if the given value is not None.

  """
  return val is not None


def TNone(val):
  """Checks if the given value is None.

  """
  return val is None


def TBool(val):
  """Checks if the given value is a boolean.

  """
  return isinstance(val, bool)


def TInt(val):
  """Checks if the given value is an integer.

  """
  # For backwards compatibility with older Python versions, boolean values are
  # also integers and should be excluded in this test.
  #
  # >>> (isinstance(False, int), isinstance(True, int))
  # (True, True)
  return isinstance(val, int) and not isinstance(val, bool)


def TFloat(val):
  """Checks if the given value is a float.

  """
  return isinstance(val, float)


def TString(val):
  """Checks if the given value is a string.

  """
  return isinstance(val, basestring)


{'fraction_non_alphanumeric': 0.09239825953416944, 'fraction_numerical': 0.008190427437931917, 'mean_word_length': 3.6690561529271206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7333534', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1093, 'n_words': 548}