<commit_before>""" Built-in potentials implemented in Cython """

# HACK: This hack brought to you by a bug in cython, and a solution from here:
# https://stackoverflow.com/questions/57138496/class-level-classmethod-can-only-be-called-on-a-method-descriptor-or-instance
try:
    myclassmethod = __builtins__.classmethod
except AttributeError:
    myclassmethod = __builtins__['classmethod']

# Third-party
from astropy.constants import G
import astropy.units as u
import numpy as np

# Project
from ..core import _potential_docstring, PotentialBase
from ..util import format_doc, sympy_wrap
from ..cpotential import CPotentialBase
from gala.potential.common import PotentialParameter
from gala.potential.potential.builtin.cybuiltin import (
    HenonHeilesWrapper,
    KeplerWrapper,
    HernquistWrapper,
    IsochroneWrapper,
    PlummerWrapper,
    JaffeWrapper,
    StoneWrapper,
    PowerLawCutoffWrapper,
    SatohWrapper,
    KuzminWrapper,
    MiyamotoNagaiWrapper,
    MN3ExponentialDiskWrapper,
    SphericalNFWWrapper,
    FlattenedNFWWrapper,
    TriaxialNFWWrapper,
    LeeSutoTriaxialNFWWrapper,
    LogarithmicWrapper,
    LongMuraliBarWrapper,
    NullWrapper,
    MultipoleWrapper,
    CylSplineWrapper
)

__all__ = [
    "NullPotential",
    "HenonHeilesPotential",
    "KeplerPotential",
    "HernquistPotential",
    "IsochronePotential",
    "PlummerPotential",
    "JaffePotential",
    "StonePotential",
    "PowerLawCutoffPotential",
    "SatohPotential",
    "KuzminPotential",
    "MiyamotoNagaiPotential",
    "MN3ExponentialDiskPotential",
    "NFWPotential",
    "LeeSutoTriaxialNFWPotential",
    "LogarithmicPotential",
    "LongMuraliBarPotential",
    "MultipolePotential"
]


def __getattr__(name):
    if name in __all__ and name in globals():
        return globals()[name]

    if not (name.startswith('MultipolePotentialLmax')):
        raise AttributeError(f"Module {__name__!r} has no attribute {name!r}.")

    if name in mp_cache:
        return mp_cache[name]

    else:
        try:
            lmax = int(name.split('Lmax')[1])
        except Exception:
            raise ImportError("Invalid")  # shouldn't ever get here!
<commit_msg>add cylspline to all<commit_after>""" Built-in potentials implemented in Cython """

# HACK: This hack brought to you by a bug in cython, and a solution from here:
# https://stackoverflow.com/questions/57138496/class-level-classmethod-can-only-be-called-on-a-method-descriptor-or-instance
try:
    myclassmethod = __builtins__.classmethod
except AttributeError:
    myclassmethod = __builtins__['classmethod']

# Third-party
from astropy.constants import G
import astropy.units as u
import numpy as np

# Project
from ..core import _potential_docstring, PotentialBase
from ..util import format_doc, sympy_wrap
from ..cpotential import CPotentialBase
from gala.potential.common import PotentialParameter
from gala.potential.potential.builtin.cybuiltin import (
    HenonHeilesWrapper,
    KeplerWrapper,
    HernquistWrapper,
    IsochroneWrapper,
    PlummerWrapper,
    JaffeWrapper,
    StoneWrapper,
    PowerLawCutoffWrapper,
    SatohWrapper,
    KuzminWrapper,
    MiyamotoNagaiWrapper,
    MN3ExponentialDiskWrapper,
    SphericalNFWWrapper,
    FlattenedNFWWrapper,
    TriaxialNFWWrapper,
    LeeSutoTriaxialNFWWrapper,
    LogarithmicWrapper,
    LongMuraliBarWrapper,
    NullWrapper,
    MultipoleWrapper,
    CylSplineWrapper
)

__all__ = [
    "NullPotential",
    "HenonHeilesPotential",
    "KeplerPotential",
    "HernquistPotential",
    "IsochronePotential",
    "PlummerPotential",
    "JaffePotential",
    "StonePotential",
    "PowerLawCutoffPotential",
    "SatohPotential",
    "KuzminPotential",
    "MiyamotoNagaiPotential",
    "MN3ExponentialDiskPotential",
    "NFWPotential",
    "LeeSutoTriaxialNFWPotential",
    "LogarithmicPotential",
    "LongMuraliBarPotential",
    "MultipolePotential",
    "CylSplinePotential"
]


def __getattr__(name):
    if name in __all__ and name in globals():
        return globals()[name]

    if not (name.startswith('MultipolePotentialLmax')):
        raise AttributeError(f"Module {__name__!r} has no attribute {name!r}.")

    if name in mp_cache:
        return mp_cache[name]

    else:
        try:
            lmax = int(name.split('Lmax')[1])
        except Exception:
            raise ImportError("Invalid")  # shouldn't ever get here!

{'fraction_non_alphanumeric': 0.08809469610744367, 'fraction_numerical': 0.005007967220578192, 'mean_word_length': 3.823271130625686, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2875982', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1399, 'n_words': 294}