class_docstr: This class represents an integer partition.
  
  Explanation
  ===========
  
  In number theory and combinatorics, a partition of a positive integer,
  ``n``, also called an integer partition, is a way of writing ``n`` as a
  list of positive integers that sum to n. Two partitions that differ only
  in the order of summands are considered to be the same partition; if order
  matters then the partitions are referred to as compositions. For example,
  4 has five partitions: [4], [3, 1], [2, 2], [2, 1, 1], and [1, 1, 1, 1];
  the compositions [1, 2, 1] and [1, 1, 2] are the same as partition
  [2, 1, 1].
  
  See Also
  ========
  
  sympy.utilities.iterables.partitions,
  sympy.utilities.iterables.multiset_partitions
  
  References
  ==========
  
  .. [1] https://en.wikipedia.org/wiki/Partition_%28number_theory%29
docstr: Generates a new IntegerPartition object from a list or dictionary.
  
  Explanation
  ===========
  
  The partition can be given as a list of positive integers or a
  dictionary of (integer, multiplicity) items. If the partition is
  preceded by an integer an error will be raised if the partition
  does not sum to that given integer.
  
  Examples
  ========
  
  >>> from sympy.combinatorics.partitions import IntegerPartition
  >>> a = IntegerPartition([5, 4, 3, 1, 1])
  >>> a
  IntegerPartition(14, (5, 4, 3, 1, 1))
  >>> print(a)
  [5, 4, 3, 1, 1]
  >>> IntegerPartition({1:3, 2:1})
  IntegerPartition(5, (2, 1, 1, 1))
  
  If the value that the partition should sum to is given first, a check
  will be made to see n error will be raised if there is a discrepancy:
  
  >>> IntegerPartition(10, [5, 4, 3, 1])
  Traceback (most recent call last):
  ...
  ValueError: The partition is not valid
code: def __new__(cls, partition, integer=None):
      """
      Generates a new IntegerPartition object from a list or dictionary.
  
      Explanation
      ===========
  
      The partition can be given as a list of positive integers or a
      dictionary of (integer, multiplicity) items. If the partition is
      preceded by an integer an error will be raised if the partition
      does not sum to that given integer.
  
      Examples
      ========
  
      >>> from sympy.combinatorics.partitions import IntegerPartition
      >>> a = IntegerPartition([5, 4, 3, 1, 1])
      >>> a
      IntegerPartition(14, (5, 4, 3, 1, 1))
      >>> print(a)
      [5, 4, 3, 1, 1]
      >>> IntegerPartition({1:3, 2:1})
      IntegerPartition(5, (2, 1, 1, 1))
  
      If the value that the partition should sum to is given first, a check
      will be made to see n error will be raised if there is a discrepancy:
  
      >>> IntegerPartition(10, [5, 4, 3, 1])
      Traceback (most recent call last):
      ...
      ValueError: The partition is not valid
  
      """
      if integer is not None:
          integer, partition = partition, integer
      if isinstance(partition, (dict, Dict)):
          _ = []
          for k, v in sorted(partition.items(), reverse=True):
              if not v:
                  continue
              k, v = as_int(k), as_int(v)
              _.extend([k] * v)
          partition = tuple(_)
      else:
          partition = tuple(
              sorted(map(as_int, partition), reverse=True)
          )
      sum_ok = False
      if integer is None:
          integer = sum(partition)
          sum_ok = True
      else:
          integer = as_int(integer)
  
      if not sum_ok and sum(partition) != integer:
          raise ValueError("Partition did not add to %s" % integer)
      if any(i < 1 for i in partition):
          raise ValueError(
              "All integer summands must be greater than one"
          )
  
      obj = Basic.__new__(cls, Integer(integer), Tuple(*partition))
      obj.partition = list(partition)
      obj.integer = integer
      return obj
  
imports: from sympy.core import Basic, Dict, sympify, Tuple
  from sympy.core.numbers import Integer
  from sympy.core.sorting import default_sort_key
  from sympy.core.sympify import _sympify
  from sympy.functions.combinatorial.numbers import bell
  from sympy.matrices import zeros
  from sympy.sets.sets import FiniteSet, Union
  from sympy.utilities.iterables import flatten, group
  from sympy.utilities.misc import as_int
  from collections import defaultdict
label_desc: Use image node_id 1 for calling the IntegerPartition obj's underlying member method code with example usage: obj.__new__(cls, partition, integer) and returns: obj