Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Sphinx v7 #559

Open
wants to merge 5 commits into
base: release/0.4.x
Choose a base branch
from
Open

Upgrade to Sphinx v7 #559

wants to merge 5 commits into from

Conversation

mhostetter
Copy link
Owner

No description provided.

@mhostetter mhostetter added the documentation Improvements or additions to documentation label Jul 5, 2024
@mhostetter
Copy link
Owner Author

The issues are caused by this block, which was a hack to get Sphinx to support class properties.

# conf.py
ArrayMeta_properties = [
    member for member in dir(galois.Array) if inspect.isdatadescriptor(getattr(type(galois.Array), member, None))
]
for p in ArrayMeta_properties:
    # Fetch the class properties from the private metaclasses
    ArrayMeta_property = getattr(galois._domains._meta.ArrayMeta, p)

    # Temporarily delete the class properties from the private metaclasses
    delattr(galois._domains._meta.ArrayMeta, p)

    # Add a Python 3.9 style class property to the public class
    setattr(galois.Array, p, classproperty(ArrayMeta_property))

    # Add back the class properties to the private metaclasses
    setattr(galois._domains._meta.ArrayMeta, p, ArrayMeta_property)


FieldArrayMeta_properties = [
    member
    for member in dir(galois.FieldArray)
    if inspect.isdatadescriptor(getattr(type(galois.FieldArray), member, None))
]
for p in FieldArrayMeta_properties:
    # Fetch the class properties from the private metaclasses
    if p in ArrayMeta_properties:
        ArrayMeta_property = getattr(galois._domains._meta.ArrayMeta, p)
    FieldArrayMeta_property = getattr(galois._fields._meta.FieldArrayMeta, p)

    # Temporarily delete the class properties from the private metaclasses
    if p in ArrayMeta_properties:
        delattr(galois._domains._meta.ArrayMeta, p)
    delattr(galois._fields._meta.FieldArrayMeta, p)

    # Add a Python 3.9 style class property to the public class
    setattr(galois.FieldArray, p, classproperty(FieldArrayMeta_property))

    # Add back the class properties to the private metaclasses
    if p in ArrayMeta_properties:
        setattr(galois._domains._meta.ArrayMeta, p, ArrayMeta_property)
    setattr(galois._fields._meta.FieldArrayMeta, p, FieldArrayMeta_property)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants