def frobenius_monomial_base(poly: object) ->list:
    """
    Generates a list of monomials of x**(i*p) % g for range(poly.degrees()). Used with Frobenius map.

    Parameters:
        poly (Polynomial): Polynomial to generate bases for.

    Returns:
        list: List of monomial bases mod g.
    
    References:
        https://github.com/sympy/sympy/blob/d1301c58be7ee4cd12fd28f1c5cd0b26322ed277/sympy/polys/galoistools.py
    """
    from samson.math.symbols import oo
    n = poly.degree()
    if n == 0:
        return []
    P = poly.ring
    q = (poly.coeff_ring.order if poly.coeff_ring.order != oo else poly.
        coeff_ring.characteristic)
    bases = [None] * n
    bases[0] = P.one()
    if q < n:
        for i in range(1, n):
            bases[i] = (bases[i - 1] << q) % poly
    elif n > 1:
        R = P / poly
        x = P.symbol
        bases[1] = R(x) ** q
        for i in range(2, n):
            bases[i] = bases[i - 1] * bases[1]
        for i in range(1, n):
            bases[i] = bases[i].val
    return bases
