class_docstr: A base class for qubits that work with binary representations.
class_docstr_tok: ["A","base","class","for","qubits","that","work","with","binary","representations","."]
code: def _eval_args(cls, args, nqubits=None):
      # The case of a QubitState instance
      if len(args) == 1 and isinstance(args[0], QubitState):
          return QubitState._eval_args(args)
      # otherwise, args should be integer
      elif not all(isinstance(a, (int, Integer)) for a in args):
          raise ValueError(
              "values must be integers, got (%s)"
              % (tuple(type(a) for a in args),)
          )
      # use nqubits if specified
      if nqubits is not None:
          if not isinstance(nqubits, (int, Integer)):
              raise ValueError(
                  "nqubits must be an integer, got (%s)" % type(nqubits)
              )
          if len(args) != 1:
              raise ValueError(
                  "too many positional arguments (%s). should be (number, nqubits=n)"
                  % (args,)
              )
          return cls._eval_args_with_nqubits(args[0], nqubits)
      # For a single argument, we construct the binary representation of
      # that integer with the minimal number of bits.
      if len(args) == 1 and args[0] > 1:
          # rvalues is the minimum number of bits needed to express the number
          rvalues = reversed(range(bitcount(abs(args[0]))))
          qubit_values = [(args[0] >> i) & 1 for i in rvalues]
          return QubitState._eval_args(qubit_values)
      # For two numbers, the second number is the number of bits
      # on which it is expressed, so IntQubit(0,5) == |00000>.
      elif len(args) == 2 and args[1] > 1:
          return cls._eval_args_with_nqubits(args[0], args[1])
      else:
          return QubitState._eval_args(args)
  
imports: import math
  from sympy.core.add import Add
  from sympy.core.mul import Mul
  from sympy.core.numbers import Integer
  from sympy.core.power import Pow
  from sympy.core.singleton import S
  from sympy.functions.elementary.complexes import conjugate
  from sympy.functions.elementary.exponential import log
  from sympy.core.basic import _sympify
  from sympy.external.gmpy import SYMPY_INTS
  from sympy.matrices import Matrix, zeros
  from sympy.printing.pretty.stringpict import prettyForm
  from sympy.physics.quantum.hilbert import ComplexSpace
  from sympy.physics.quantum.state import Ket, Bra, State
  from sympy.physics.quantum.qexpr import QuantumError
  from sympy.physics.quantum.represent import represent
  from sympy.physics.quantum.matrixutils import numpy_ndarray, scipy_sparse_matrix
  from mpmath.libmp.libintmath import bitcount
label_desc: Use image node_id 1 for calling the IntQubitState obj's underlying member method code with example usage: obj._eval_args(cls, args, nqubits) and returns: QubitState, cls, QubitState, cls, QubitState