<commit_before>import heapq as hq
import scipy as sp
import numpy as np
from numba import njit
from numba.typed import List
from openpnm.algorithms import GenericAlgorithm
from openpnm.utils import logging
logger = logging.getLogger(__name__)


class InvasionPercolation(GenericAlgorithm):
    r"""
    A classic/basic invasion percolation algorithm optimized for speed.

    Parameters
    ----------
    network : OpenPNM Network object
        The Network upon which the invasion will occur.

    Notes
    ----
    This algorithm uses a binary heap to store all a list of all accessible
    throats, sorted according to entry pressure.  This means that item [0] in
    the heap is the most easily invaded throat, so looking up which throat
    to invade next is computationally trivial.  In order to keep the list
    sorted new throats to the list takes more time, however, the heap data
    structure is very efficient at this.  Interested users can consult the
    wikipedia page on `binary heaps
    <https://en.wikipedia.org/wiki/Binary_heap>`_ for more information.


    Examples
    --------
    Start by importing the usual packages:

    >>> import openpnm as op
    >>> import scipy as sp<commit_msg>Ignore numba pending deprecation warnings<commit_after>import heapq as hq
import scipy as sp
import numpy as np
from numba import njit
from numba.errors import NumbaPendingDeprecationWarning
from openpnm.algorithms import GenericAlgorithm
from openpnm.utils import logging
import warnings
logger = logging.getLogger(__name__)
warnings.simplefilter('ignore', category=NumbaPendingDeprecationWarning)


class InvasionPercolation(GenericAlgorithm):
    r"""
    A classic/basic invasion percolation algorithm optimized for speed.

    Parameters
    ----------
    network : OpenPNM Network object
        The Network upon which the invasion will occur.

    Notes
    ----
    This algorithm uses a binary heap to store all a list of all accessible
    throats, sorted according to entry pressure.  This means that item [0] in
    the heap is the most easily invaded throat, so looking up which throat
    to invade next is computationally trivial.  In order to keep the list
    sorted new throats to the list takes more time, however, the heap data
    structure is very efficient at this.  Interested users can consult the
    wikipedia page on `binary heaps
    <https://en.wikipedia.org/wiki/Binary_heap>`_ for more information.


    Examples
    --------
    Start by importing the usual packages:

    >>> import openpnm as op
    >>> import scipy as sp
{'fraction_non_alphanumeric': 0.05710955710955711, 'fraction_numerical': 0.000777000777000777, 'mean_word_length': 3.263245033112583, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '5819097', 'n_tokens_mistral': 667, 'n_tokens_neox': 641, 'n_words': 315}