def _none_subst(self, *args):
        """ Helper function to insert full ranges for |None| for X_iter methods.

        Custom method, specifically tailored, taking in the arguments from
        an X_iter method and performing the replacement of |None| after
        error-checking the arguments for a max of one |None| value, and ensuring
        that if a |None| is present, no other non-|str| iterables are present.

        Parameters
        ----------
        args : 3-5 arguments of |int| or iterable |int|, or |None|
            First argument is always the indices for the geometries; all
            following are for the atoms in sequence as required for the
            particular :samp:`{x}_iter` method

        Returns
        -------
        arglist     : 3-5 arguments, matching input params
            Argument list, with |None| substituted if validly present

        Raises
        ------
        ~exceptions.ValueError  : If more than one |None| argument is present

        ~exceptions.ValueError  : If an arg is non-|str| iterable when one
        |None| is present
        """

        # Imports
        import numpy as np

        # Initialize argument list return value, and as None not found
        arglist = [a for a in args]
        none_found = False

        # Check for None values
        none_vals = list(map(lambda e: isinstance(e, type(None)), arglist))

        # Error if more than one None; handle if exactly one; pass through if
        #  none.
        if np.count_nonzero(none_vals) > 1:
            raise ValueError(
                    "Multiple 'None' values [indices {0}] not supported"
                    .format(tuple(np.nonzero(none_vals)[0])))
        elif np.count_nonzero(none_vals) == 1:
            # Must be no iterables that are not strings. Thus, an element-wise
            #  test for iterability and an element-wise test for stringiness
            #  must give matching arrays
            if not all(np.equal(list(map(np.iterable, arglist)),
                        list(map(lambda e: isinstance(e, str), arglist)))):
                raise ValueError(
                        "'None' as parameter invalid with non-str iterables")
            ## end if

            # Parameters okay; replace the None with the appropriate range()
            none_found = True
            none_loc = np.nonzero(none_vals)[0][0]
            arglist[none_loc] = \
                    range(self.num_geoms if none_loc == 0 else self.num_atoms)
        ## end if

        # Return the arguments list and the none-found value
        return arglist
def _none_subst ( self , * args ) : import numpy as np arglist = [ a for a in args ] none_found = False none_vals = list ( map ( lambda e : isinstance ( e , type ( None ) ) , arglist ) ) if np . count_nonzero ( none_vals ) > 1 : raise ValueError ( "Multiple 'None' values [indices {0}] not supported" . format ( tuple ( np . nonzero ( none_vals ) [ 0 ] ) ) ) elif np . count_nonzero ( none_vals ) == 1 : if not all ( np . equal ( list ( map ( np . iterable , arglist ) ) , list ( map ( lambda e : isinstance ( e , str ) , arglist ) ) ) ) : raise ValueError ( "'None' as parameter invalid with non-str iterables" ) none_found = True none_loc = np . nonzero ( none_vals ) [ 0 ] [ 0 ] arglist [ none_loc ] = range ( self . num_geoms if none_loc == 0 else self . num_atoms ) return arglist
Helper function to insert full ranges for |None| for X_iter methods.

        Custom method, specifically tailored, taking in the arguments from
        an X_iter method and performing the replacement of |None| after
        error-checking the arguments for a max of one |None| value, and ensuring
        that if a |None| is present, no other non-|str| iterables are present.

        Parameters
        ----------
        args : 3-5 arguments of |int| or iterable |int|, or |None|
            First argument is always the indices for the geometries; all
            following are for the atoms in sequence as required for the
            particular :samp:`{x}_iter` method

        Returns
        -------
        arglist     : 3-5 arguments, matching input params
            Argument list, with |None| substituted if validly present

        Raises
        ------
        ~exceptions.ValueError  : If more than one |None| argument is present

        ~exceptions.ValueError  : If an arg is non-|str| iterable when one
        |None| is present