diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/cycler/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/cycler/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..97949547ad37c7105beb76cfc9e72a683465fc07
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/cycler/__init__.py
@@ -0,0 +1,573 @@
+"""
+Cycler
+======
+
+Cycling through combinations of values, producing dictionaries.
+
+You can add cyclers::
+
+ from cycler import cycler
+ cc = (cycler(color=list('rgb')) +
+ cycler(linestyle=['-', '--', '-.']))
+ for d in cc:
+ print(d)
+
+Results in::
+
+ {'color': 'r', 'linestyle': '-'}
+ {'color': 'g', 'linestyle': '--'}
+ {'color': 'b', 'linestyle': '-.'}
+
+
+You can multiply cyclers::
+
+ from cycler import cycler
+ cc = (cycler(color=list('rgb')) *
+ cycler(linestyle=['-', '--', '-.']))
+ for d in cc:
+ print(d)
+
+Results in::
+
+ {'color': 'r', 'linestyle': '-'}
+ {'color': 'r', 'linestyle': '--'}
+ {'color': 'r', 'linestyle': '-.'}
+ {'color': 'g', 'linestyle': '-'}
+ {'color': 'g', 'linestyle': '--'}
+ {'color': 'g', 'linestyle': '-.'}
+ {'color': 'b', 'linestyle': '-'}
+ {'color': 'b', 'linestyle': '--'}
+ {'color': 'b', 'linestyle': '-.'}
+"""
+
+
+from __future__ import annotations
+
+from collections.abc import Hashable, Iterable, Generator
+import copy
+from functools import reduce
+from itertools import product, cycle
+from operator import mul, add
+# Dict, List, Union required for runtime cast calls
+from typing import TypeVar, Generic, Callable, Union, Dict, List, Any, overload, cast
+
+__version__ = "0.12.1"
+
+K = TypeVar("K", bound=Hashable)
+L = TypeVar("L", bound=Hashable)
+V = TypeVar("V")
+U = TypeVar("U")
+
+
+def _process_keys(
+ left: Cycler[K, V] | Iterable[dict[K, V]],
+ right: Cycler[K, V] | Iterable[dict[K, V]] | None,
+) -> set[K]:
+ """
+ Helper function to compose cycler keys.
+
+ Parameters
+ ----------
+ left, right : iterable of dictionaries or None
+ The cyclers to be composed.
+
+ Returns
+ -------
+ keys : set
+ The keys in the composition of the two cyclers.
+ """
+ l_peek: dict[K, V] = next(iter(left)) if left != [] else {}
+ r_peek: dict[K, V] = next(iter(right)) if right is not None else {}
+ l_key: set[K] = set(l_peek.keys())
+ r_key: set[K] = set(r_peek.keys())
+ if l_key & r_key:
+ raise ValueError("Can not compose overlapping cycles")
+ return l_key | r_key
+
+
+def concat(left: Cycler[K, V], right: Cycler[K, U]) -> Cycler[K, V | U]:
+ r"""
+ Concatenate `Cycler`\s, as if chained using `itertools.chain`.
+
+ The keys must match exactly.
+
+ Examples
+ --------
+ >>> num = cycler('a', range(3))
+ >>> let = cycler('a', 'abc')
+ >>> num.concat(let)
+ cycler('a', [0, 1, 2, 'a', 'b', 'c'])
+
+ Returns
+ -------
+ `Cycler`
+ The concatenated cycler.
+ """
+ if left.keys != right.keys:
+ raise ValueError(
+ "Keys do not match:\n"
+ "\tIntersection: {both!r}\n"
+ "\tDisjoint: {just_one!r}".format(
+ both=left.keys & right.keys, just_one=left.keys ^ right.keys
+ )
+ )
+ _l = cast(Dict[K, List[Union[V, U]]], left.by_key())
+ _r = cast(Dict[K, List[Union[V, U]]], right.by_key())
+ return reduce(add, (_cycler(k, _l[k] + _r[k]) for k in left.keys))
+
+
+class Cycler(Generic[K, V]):
+ """
+ Composable cycles.
+
+ This class has compositions methods:
+
+ ``+``
+ for 'inner' products (zip)
+
+ ``+=``
+ in-place ``+``
+
+ ``*``
+ for outer products (`itertools.product`) and integer multiplication
+
+ ``*=``
+ in-place ``*``
+
+ and supports basic slicing via ``[]``.
+
+ Parameters
+ ----------
+ left, right : Cycler or None
+ The 'left' and 'right' cyclers.
+ op : func or None
+ Function which composes the 'left' and 'right' cyclers.
+ """
+
+ def __call__(self):
+ return cycle(self)
+
+ def __init__(
+ self,
+ left: Cycler[K, V] | Iterable[dict[K, V]] | None,
+ right: Cycler[K, V] | None = None,
+ op: Any = None,
+ ):
+ """
+ Semi-private init.
+
+ Do not use this directly, use `cycler` function instead.
+ """
+ if isinstance(left, Cycler):
+ self._left: Cycler[K, V] | list[dict[K, V]] = Cycler(
+ left._left, left._right, left._op
+ )
+ elif left is not None:
+ # Need to copy the dictionary or else that will be a residual
+ # mutable that could lead to strange errors
+ self._left = [copy.copy(v) for v in left]
+ else:
+ self._left = []
+
+ if isinstance(right, Cycler):
+ self._right: Cycler[K, V] | None = Cycler(
+ right._left, right._right, right._op
+ )
+ else:
+ self._right = None
+
+ self._keys: set[K] = _process_keys(self._left, self._right)
+ self._op: Any = op
+
+ def __contains__(self, k):
+ return k in self._keys
+
+ @property
+ def keys(self) -> set[K]:
+ """The keys this Cycler knows about."""
+ return set(self._keys)
+
+ def change_key(self, old: K, new: K) -> None:
+ """
+ Change a key in this cycler to a new name.
+ Modification is performed in-place.
+
+ Does nothing if the old key is the same as the new key.
+ Raises a ValueError if the new key is already a key.
+ Raises a KeyError if the old key isn't a key.
+ """
+ if old == new:
+ return
+ if new in self._keys:
+ raise ValueError(
+ f"Can't replace {old} with {new}, {new} is already a key"
+ )
+ if old not in self._keys:
+ raise KeyError(
+ f"Can't replace {old} with {new}, {old} is not a key"
+ )
+
+ self._keys.remove(old)
+ self._keys.add(new)
+
+ if self._right is not None and old in self._right.keys:
+ self._right.change_key(old, new)
+
+ # self._left should always be non-None
+ # if self._keys is non-empty.
+ elif isinstance(self._left, Cycler):
+ self._left.change_key(old, new)
+ else:
+ # It should be completely safe at this point to
+ # assume that the old key can be found in each
+ # iteration.
+ self._left = [{new: entry[old]} for entry in self._left]
+
+ @classmethod
+ def _from_iter(cls, label: K, itr: Iterable[V]) -> Cycler[K, V]:
+ """
+ Class method to create 'base' Cycler objects
+ that do not have a 'right' or 'op' and for which
+ the 'left' object is not another Cycler.
+
+ Parameters
+ ----------
+ label : hashable
+ The property key.
+
+ itr : iterable
+ Finite length iterable of the property values.
+
+ Returns
+ -------
+ `Cycler`
+ New 'base' cycler.
+ """
+ ret: Cycler[K, V] = cls(None)
+ ret._left = list({label: v} for v in itr)
+ ret._keys = {label}
+ return ret
+
+ def __getitem__(self, key: slice) -> Cycler[K, V]:
+ # TODO : maybe add numpy style fancy slicing
+ if isinstance(key, slice):
+ trans = self.by_key()
+ return reduce(add, (_cycler(k, v[key]) for k, v in trans.items()))
+ else:
+ raise ValueError("Can only use slices with Cycler.__getitem__")
+
+ def __iter__(self) -> Generator[dict[K, V], None, None]:
+ if self._right is None:
+ for left in self._left:
+ yield dict(left)
+ else:
+ if self._op is None:
+ raise TypeError(
+ "Operation cannot be None when both left and right are defined"
+ )
+ for a, b in self._op(self._left, self._right):
+ out = {}
+ out.update(a)
+ out.update(b)
+ yield out
+
+ def __add__(self, other: Cycler[L, U]) -> Cycler[K | L, V | U]:
+ """
+ Pair-wise combine two equal length cyclers (zip).
+
+ Parameters
+ ----------
+ other : Cycler
+ """
+ if len(self) != len(other):
+ raise ValueError(
+ f"Can only add equal length cycles, not {len(self)} and {len(other)}"
+ )
+ return Cycler(
+ cast(Cycler[Union[K, L], Union[V, U]], self),
+ cast(Cycler[Union[K, L], Union[V, U]], other),
+ zip
+ )
+
+ @overload
+ def __mul__(self, other: Cycler[L, U]) -> Cycler[K | L, V | U]:
+ ...
+
+ @overload
+ def __mul__(self, other: int) -> Cycler[K, V]:
+ ...
+
+ def __mul__(self, other):
+ """
+ Outer product of two cyclers (`itertools.product`) or integer
+ multiplication.
+
+ Parameters
+ ----------
+ other : Cycler or int
+ """
+ if isinstance(other, Cycler):
+ return Cycler(
+ cast(Cycler[Union[K, L], Union[V, U]], self),
+ cast(Cycler[Union[K, L], Union[V, U]], other),
+ product
+ )
+ elif isinstance(other, int):
+ trans = self.by_key()
+ return reduce(
+ add, (_cycler(k, v * other) for k, v in trans.items())
+ )
+ else:
+ return NotImplemented
+
+ @overload
+ def __rmul__(self, other: Cycler[L, U]) -> Cycler[K | L, V | U]:
+ ...
+
+ @overload
+ def __rmul__(self, other: int) -> Cycler[K, V]:
+ ...
+
+ def __rmul__(self, other):
+ return self * other
+
+ def __len__(self) -> int:
+ op_dict: dict[Callable, Callable[[int, int], int]] = {zip: min, product: mul}
+ if self._right is None:
+ return len(self._left)
+ l_len = len(self._left)
+ r_len = len(self._right)
+ return op_dict[self._op](l_len, r_len)
+
+ # iadd and imul do not exapand the the type as the returns must be consistent with
+ # self, thus they flag as inconsistent with add/mul
+ def __iadd__(self, other: Cycler[K, V]) -> Cycler[K, V]: # type: ignore[misc]
+ """
+ In-place pair-wise combine two equal length cyclers (zip).
+
+ Parameters
+ ----------
+ other : Cycler
+ """
+ if not isinstance(other, Cycler):
+ raise TypeError("Cannot += with a non-Cycler object")
+ # True shallow copy of self is fine since this is in-place
+ old_self = copy.copy(self)
+ self._keys = _process_keys(old_self, other)
+ self._left = old_self
+ self._op = zip
+ self._right = Cycler(other._left, other._right, other._op)
+ return self
+
+ def __imul__(self, other: Cycler[K, V] | int) -> Cycler[K, V]: # type: ignore[misc]
+ """
+ In-place outer product of two cyclers (`itertools.product`).
+
+ Parameters
+ ----------
+ other : Cycler
+ """
+ if not isinstance(other, Cycler):
+ raise TypeError("Cannot *= with a non-Cycler object")
+ # True shallow copy of self is fine since this is in-place
+ old_self = copy.copy(self)
+ self._keys = _process_keys(old_self, other)
+ self._left = old_self
+ self._op = product
+ self._right = Cycler(other._left, other._right, other._op)
+ return self
+
+ def __eq__(self, other: object) -> bool:
+ if not isinstance(other, Cycler):
+ return False
+ if len(self) != len(other):
+ return False
+ if self.keys ^ other.keys:
+ return False
+ return all(a == b for a, b in zip(self, other))
+
+ __hash__ = None # type: ignore
+
+ def __repr__(self) -> str:
+ op_map = {zip: "+", product: "*"}
+ if self._right is None:
+ lab = self.keys.pop()
+ itr = list(v[lab] for v in self)
+ return f"cycler({lab!r}, {itr!r})"
+ else:
+ op = op_map.get(self._op, "?")
+ msg = "({left!r} {op} {right!r})"
+ return msg.format(left=self._left, op=op, right=self._right)
+
+ def _repr_html_(self) -> str:
+ # an table showing the value of each key through a full cycle
+ output = "
"
+ sorted_keys = sorted(self.keys, key=repr)
+ for key in sorted_keys:
+ output += f"| {key!r} | "
+ for d in iter(self):
+ output += ""
+ for k in sorted_keys:
+ output += f"| {d[k]!r} | "
+ output += "
"
+ output += "
"
+ return output
+
+ def by_key(self) -> dict[K, list[V]]:
+ """
+ Values by key.
+
+ This returns the transposed values of the cycler. Iterating
+ over a `Cycler` yields dicts with a single value for each key,
+ this method returns a `dict` of `list` which are the values
+ for the given key.
+
+ The returned value can be used to create an equivalent `Cycler`
+ using only `+`.
+
+ Returns
+ -------
+ transpose : dict
+ dict of lists of the values for each key.
+ """
+
+ # TODO : sort out if this is a bottle neck, if there is a better way
+ # and if we care.
+
+ keys = self.keys
+ out: dict[K, list[V]] = {k: list() for k in keys}
+
+ for d in self:
+ for k in keys:
+ out[k].append(d[k])
+ return out
+
+ # for back compatibility
+ _transpose = by_key
+
+ def simplify(self) -> Cycler[K, V]:
+ """
+ Simplify the cycler into a sum (but no products) of cyclers.
+
+ Returns
+ -------
+ simple : Cycler
+ """
+ # TODO: sort out if it is worth the effort to make sure this is
+ # balanced. Currently it is is
+ # (((a + b) + c) + d) vs
+ # ((a + b) + (c + d))
+ # I would believe that there is some performance implications
+ trans = self.by_key()
+ return reduce(add, (_cycler(k, v) for k, v in trans.items()))
+
+ concat = concat
+
+
+@overload
+def cycler(arg: Cycler[K, V]) -> Cycler[K, V]:
+ ...
+
+
+@overload
+def cycler(**kwargs: Iterable[V]) -> Cycler[str, V]:
+ ...
+
+
+@overload
+def cycler(label: K, itr: Iterable[V]) -> Cycler[K, V]:
+ ...
+
+
+def cycler(*args, **kwargs):
+ """
+ Create a new `Cycler` object from a single positional argument,
+ a pair of positional arguments, or the combination of keyword arguments.
+
+ cycler(arg)
+ cycler(label1=itr1[, label2=iter2[, ...]])
+ cycler(label, itr)
+
+ Form 1 simply copies a given `Cycler` object.
+
+ Form 2 composes a `Cycler` as an inner product of the
+ pairs of keyword arguments. In other words, all of the
+ iterables are cycled simultaneously, as if through zip().
+
+ Form 3 creates a `Cycler` from a label and an iterable.
+ This is useful for when the label cannot be a keyword argument
+ (e.g., an integer or a name that has a space in it).
+
+ Parameters
+ ----------
+ arg : Cycler
+ Copy constructor for Cycler (does a shallow copy of iterables).
+ label : name
+ The property key. In the 2-arg form of the function,
+ the label can be any hashable object. In the keyword argument
+ form of the function, it must be a valid python identifier.
+ itr : iterable
+ Finite length iterable of the property values.
+ Can be a single-property `Cycler` that would
+ be like a key change, but as a shallow copy.
+
+ Returns
+ -------
+ cycler : Cycler
+ New `Cycler` for the given property
+
+ """
+ if args and kwargs:
+ raise TypeError(
+ "cycler() can only accept positional OR keyword arguments -- not both."
+ )
+
+ if len(args) == 1:
+ if not isinstance(args[0], Cycler):
+ raise TypeError(
+ "If only one positional argument given, it must "
+ "be a Cycler instance."
+ )
+ return Cycler(args[0])
+ elif len(args) == 2:
+ return _cycler(*args)
+ elif len(args) > 2:
+ raise TypeError(
+ "Only a single Cycler can be accepted as the lone "
+ "positional argument. Use keyword arguments instead."
+ )
+
+ if kwargs:
+ return reduce(add, (_cycler(k, v) for k, v in kwargs.items()))
+
+ raise TypeError("Must have at least a positional OR keyword arguments")
+
+
+def _cycler(label: K, itr: Iterable[V]) -> Cycler[K, V]:
+ """
+ Create a new `Cycler` object from a property name and iterable of values.
+
+ Parameters
+ ----------
+ label : hashable
+ The property key.
+ itr : iterable
+ Finite length iterable of the property values.
+
+ Returns
+ -------
+ cycler : Cycler
+ New `Cycler` for the given property
+ """
+ if isinstance(itr, Cycler):
+ keys = itr.keys
+ if len(keys) != 1:
+ msg = "Can not create Cycler from a multi-property Cycler"
+ raise ValueError(msg)
+
+ lab = keys.pop()
+ # Doesn't need to be a new list because
+ # _from_iter() will be creating that new list anyway.
+ itr = (v[lab] for v in itr)
+
+ return Cycler._from_iter(label, itr)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/cycler/__pycache__/__init__.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/cycler/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..25d164aa8bef11e664c7e115b4d61b1ea4de75b0
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/cycler/__pycache__/__init__.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/cycler/py.typed b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/cycler/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/INSTALLER
@@ -0,0 +1 @@
+uv
\ No newline at end of file
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..ffef2ff3bfa0c42b6e6e3eefda700391d181c9a0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/METADATA
@@ -0,0 +1,84 @@
+Metadata-Version: 2.4
+Name: Jinja2
+Version: 3.1.6
+Summary: A very fast and expressive template engine.
+Maintainer-email: Pallets
+Requires-Python: >=3.7
+Description-Content-Type: text/markdown
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Web Environment
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
+Classifier: Topic :: Text Processing :: Markup :: HTML
+Classifier: Typing :: Typed
+License-File: LICENSE.txt
+Requires-Dist: MarkupSafe>=2.0
+Requires-Dist: Babel>=2.7 ; extra == "i18n"
+Project-URL: Changes, https://jinja.palletsprojects.com/changes/
+Project-URL: Chat, https://discord.gg/pallets
+Project-URL: Documentation, https://jinja.palletsprojects.com/
+Project-URL: Donate, https://palletsprojects.com/donate
+Project-URL: Source, https://github.com/pallets/jinja/
+Provides-Extra: i18n
+
+# Jinja
+
+Jinja is a fast, expressive, extensible templating engine. Special
+placeholders in the template allow writing code similar to Python
+syntax. Then the template is passed data to render the final document.
+
+It includes:
+
+- Template inheritance and inclusion.
+- Define and import macros within templates.
+- HTML templates can use autoescaping to prevent XSS from untrusted
+ user input.
+- A sandboxed environment can safely render untrusted templates.
+- AsyncIO support for generating templates and calling async
+ functions.
+- I18N support with Babel.
+- Templates are compiled to optimized Python code just-in-time and
+ cached, or can be compiled ahead-of-time.
+- Exceptions point to the correct line in templates to make debugging
+ easier.
+- Extensible filters, tests, functions, and even syntax.
+
+Jinja's philosophy is that while application logic belongs in Python if
+possible, it shouldn't make the template designer's job difficult by
+restricting functionality too much.
+
+
+## In A Nutshell
+
+```jinja
+{% extends "base.html" %}
+{% block title %}Members{% endblock %}
+{% block content %}
+
+{% endblock %}
+```
+
+## Donate
+
+The Pallets organization develops and supports Jinja and other popular
+packages. In order to grow the community of contributors and users, and
+allow the maintainers to devote more time to the projects, [please
+donate today][].
+
+[please donate today]: https://palletsprojects.com/donate
+
+## Contributing
+
+See our [detailed contributing documentation][contrib] for many ways to
+contribute, including reporting issues, requesting features, asking or answering
+questions, and making PRs.
+
+[contrib]: https://palletsprojects.com/contributing/
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..fb6122febd37ff51cfac21c02a2e25535875028b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/RECORD
@@ -0,0 +1,33 @@
+jinja2-3.1.6.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
+jinja2-3.1.6.dist-info/METADATA,sha256=aMVUj7Z8QTKhOJjZsx7FDGvqKr3ZFdkh8hQ1XDpkmcg,2871
+jinja2-3.1.6.dist-info/RECORD,,
+jinja2-3.1.6.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+jinja2-3.1.6.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
+jinja2-3.1.6.dist-info/entry_points.txt,sha256=OL85gYU1eD8cuPlikifFngXpeBjaxl6rIJ8KkC_3r-I,58
+jinja2-3.1.6.dist-info/licenses/LICENSE.txt,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475
+jinja2/__init__.py,sha256=xxepO9i7DHsqkQrgBEduLtfoz2QCuT6_gbL4XSN1hbU,1928
+jinja2/_identifier.py,sha256=_zYctNKzRqlk_murTNlzrju1FFJL7Va_Ijqqd7ii2lU,1958
+jinja2/async_utils.py,sha256=vK-PdsuorOMnWSnEkT3iUJRIkTnYgO2T6MnGxDgHI5o,2834
+jinja2/bccache.py,sha256=gh0qs9rulnXo0PhX5jTJy2UHzI8wFnQ63o_vw7nhzRg,14061
+jinja2/compiler.py,sha256=9RpCQl5X88BHllJiPsHPh295Hh0uApvwFJNQuutULeM,74131
+jinja2/constants.py,sha256=GMoFydBF_kdpaRKPoM5cl5MviquVRLVyZtfp5-16jg0,1433
+jinja2/debug.py,sha256=CnHqCDHd-BVGvti_8ZsTolnXNhA3ECsY-6n_2pwU8Hw,6297
+jinja2/defaults.py,sha256=boBcSw78h-lp20YbaXSJsqkAI2uN_mD_TtCydpeq5wU,1267
+jinja2/environment.py,sha256=9nhrP7Ch-NbGX00wvyr4yy-uhNHq2OCc60ggGrni_fk,61513
+jinja2/exceptions.py,sha256=ioHeHrWwCWNaXX1inHmHVblvc4haO7AXsjCp3GfWvx0,5071
+jinja2/ext.py,sha256=5PF5eHfh8mXAIxXHHRB2xXbXohi8pE3nHSOxa66uS7E,31875
+jinja2/filters.py,sha256=PQ_Egd9n9jSgtnGQYyF4K5j2nYwhUIulhPnyimkdr-k,55212
+jinja2/idtracking.py,sha256=-ll5lIp73pML3ErUYiIJj7tdmWxcH_IlDv3yA_hiZYo,10555
+jinja2/lexer.py,sha256=LYiYio6br-Tep9nPcupWXsPEtjluw3p1mU-lNBVRUfk,29786
+jinja2/loaders.py,sha256=wIrnxjvcbqh5VwW28NSkfotiDq8qNCxIOSFbGUiSLB4,24055
+jinja2/meta.py,sha256=OTDPkaFvU2Hgvx-6akz7154F8BIWaRmvJcBFvwopHww,4397
+jinja2/nativetypes.py,sha256=7GIGALVJgdyL80oZJdQUaUfwSt5q2lSSZbXt0dNf_M4,4210
+jinja2/nodes.py,sha256=m1Duzcr6qhZI8JQ6VyJgUNinjAf5bQzijSmDnMsvUx8,34579
+jinja2/optimizer.py,sha256=rJnCRlQ7pZsEEmMhsQDgC_pKyDHxP5TPS6zVPGsgcu8,1651
+jinja2/parser.py,sha256=lLOFy3sEmHc5IaEHRiH1sQVnId2moUQzhyeJZTtdY30,40383
+jinja2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+jinja2/runtime.py,sha256=gDk-GvdriJXqgsGbHgrcKTP0Yp6zPXzhzrIpCFH3jAU,34249
+jinja2/sandbox.py,sha256=Mw2aitlY2I8la7FYhcX2YG9BtUYcLnD0Gh3d29cDWrY,15009
+jinja2/tests.py,sha256=VLsBhVFnWg-PxSBz1MhRnNWgP1ovXk3neO1FLQMeC9Q,5926
+jinja2/utils.py,sha256=rRp3o9e7ZKS4fyrWRbELyLcpuGVTFcnooaOa1qx_FIk,24129
+jinja2/visitor.py,sha256=EcnL1PIwf_4RVCOMxsRNuR8AXHbS1qfAdMOE2ngKJz4,3557
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/REQUESTED b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..23d2d7e9a5d381ef8a375db09f82052144d1fd96
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/WHEEL
@@ -0,0 +1,4 @@
+Wheel-Version: 1.0
+Generator: flit 3.11.0
+Root-Is-Purelib: true
+Tag: py3-none-any
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..abc3eae3b3bc573957cf7401711948799b3465c0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/entry_points.txt
@@ -0,0 +1,3 @@
+[babel.extractors]
+jinja2=jinja2.ext:babel_extract[i18n]
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/licenses/LICENSE.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/licenses/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..c37cae49ec77ad6ebb25568c1605f1fee5313cfb
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/jinja2-3.1.6.dist-info/licenses/LICENSE.txt
@@ -0,0 +1,28 @@
+Copyright 2007 Pallets
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/INSTALLER
@@ -0,0 +1 @@
+uv
\ No newline at end of file
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..067e8fa64f7f45553a3fddf950eaaa58b6b333ec
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/METADATA
@@ -0,0 +1,88 @@
+Metadata-Version: 2.4
+Name: Mako
+Version: 1.3.10
+Summary: A super-fast templating language that borrows the best ideas from the existing templating languages.
+Home-page: https://www.makotemplates.org/
+Author: Mike Bayer
+Author-email: mike@zzzcomputing.com
+License: MIT
+Project-URL: Documentation, https://docs.makotemplates.org
+Project-URL: Issue Tracker, https://github.com/sqlalchemy/mako
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Environment :: Web Environment
+Classifier: Intended Audience :: Developers
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: MarkupSafe>=0.9.2
+Provides-Extra: testing
+Requires-Dist: pytest; extra == "testing"
+Provides-Extra: babel
+Requires-Dist: Babel; extra == "babel"
+Provides-Extra: lingua
+Requires-Dist: lingua; extra == "lingua"
+Dynamic: license-file
+
+=========================
+Mako Templates for Python
+=========================
+
+Mako is a template library written in Python. It provides a familiar, non-XML
+syntax which compiles into Python modules for maximum performance. Mako's
+syntax and API borrows from the best ideas of many others, including Django
+templates, Cheetah, Myghty, and Genshi. Conceptually, Mako is an embedded
+Python (i.e. Python Server Page) language, which refines the familiar ideas
+of componentized layout and inheritance to produce one of the most
+straightforward and flexible models available, while also maintaining close
+ties to Python calling and scoping semantics.
+
+Nutshell
+========
+
+::
+
+ <%inherit file="base.html"/>
+ <%
+ rows = [[v for v in range(0,10)] for row in range(0,10)]
+ %>
+
+ % for row in rows:
+ ${makerow(row)}
+ % endfor
+
+
+ <%def name="makerow(row)">
+
+ % for name in row:
+ | ${name} | \
+ % endfor
+
+ %def>
+
+Philosophy
+===========
+
+Python is a great scripting language. Don't reinvent the wheel...your templates can handle it !
+
+Documentation
+==============
+
+See documentation for Mako at https://docs.makotemplates.org/en/latest/
+
+License
+========
+
+Mako is licensed under an MIT-style license (see LICENSE).
+Other incorporated projects may be licensed under different licenses.
+All licenses allow for non-commercial and commercial use.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..6bbeab71e80def910f94df06d56913ad76a47aea
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/RECORD
@@ -0,0 +1,42 @@
+../../../bin/mako-render,sha256=G-zvRm0Al2su8FiBLnN50blSdaviiE_SumORecZeJUA,367
+mako-1.3.10.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
+mako-1.3.10.dist-info/METADATA,sha256=VAbwPOfALVKbDJYv5l848ZceyGwynnE9s_TXP6_dr5o,2919
+mako-1.3.10.dist-info/RECORD,,
+mako-1.3.10.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+mako-1.3.10.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
+mako-1.3.10.dist-info/entry_points.txt,sha256=LsKkUsOsJQYbJ2M72hZCm968wi5K8Ywb5uFxCuN8Obk,512
+mako-1.3.10.dist-info/licenses/LICENSE,sha256=aNcGTlPj_6jp9CCp5gS9LiBZ2cMwSS-m69TrPUgRFok,1098
+mako-1.3.10.dist-info/top_level.txt,sha256=LItdH8cDPetpUu8rUyBG3DObS6h9Gcpr9j_WLj2S-R0,5
+mako/__init__.py,sha256=n-XoSW8ChrO6NkJ2xUHElzvSnU6XUu5ruMZe86QldTI,243
+mako/_ast_util.py,sha256=hCbfnnizWEa3xRCA-uVyShC2HohSpmVvexz5as_lHc8,20247
+mako/ast.py,sha256=xYrdSiJFbf1CxJ9tU9pcPEWK0BYfwF2aDNDNLQG9PqQ,6642
+mako/cache.py,sha256=kA6FKGl5NeTBnSTcnhoPkSaeJ0JeYpF6GM8qzEZGSts,7680
+mako/cmd.py,sha256=Y2Y6VxNCYwO2Y8EXOdLTf5tpYgfdoondV6Ehlbh8a84,2813
+mako/codegen.py,sha256=N49EH57CcTUfKGzI8V7GFBrAEoFhRo9lkdXBzpFYzBY,47736
+mako/compat.py,sha256=owGbObdoF0C-6rCCs6Vnk3YGHv0bf0PpTja55Woxqb4,1820
+mako/exceptions.py,sha256=87Djuoi1IS5zyVFml1Z5zpCP1IoI7UMOH3h4ejt3x3g,12530
+mako/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+mako/ext/autohandler.py,sha256=QuhNiPSF1LZ53awQ1Qfpwu1Zi9RGOmrtCDnwCLgQzeE,1885
+mako/ext/babelplugin.py,sha256=mmt5fG3pcYII1QsrLEV3wH1ltj-C7uKl8vBIpAjxsKY,2091
+mako/ext/beaker_cache.py,sha256=4quuJQuXRKKUyF6kM43LQhJT1J2z1KSglRZVDW-7c1I,2578
+mako/ext/extract.py,sha256=ZUeaRL2jWcUlrpnhXFXJB0CUJfvQVGBF9tJr5nKJAWI,4659
+mako/ext/linguaplugin.py,sha256=sUZalJSI_XeON9aRBb2hds-ilVQaxHKlfCg_nAl7EuU,1935
+mako/ext/preprocessors.py,sha256=HYG45idRJUwJkDpswEELL8lPFLisQzgDhW5EHpTDGkI,576
+mako/ext/pygmentplugin.py,sha256=TnpJDyQeWTTGHZraMDpw8FB3PNzbmXhaZcjyIBudyi0,4753
+mako/ext/turbogears.py,sha256=egv8hradAnnSJwxtmW8uXAsqPUzX8cZZCXclmO_8hMA,2141
+mako/filters.py,sha256=IBXyGOby4eFE3UGvNLhJlzbe1FfwJ2dcEr1-gKO_Ljc,4658
+mako/lexer.py,sha256=GMq8yf0dEn04-xw2EVDEzaOLXMSVVQz9HyUbfwKnZKg,16321
+mako/lookup.py,sha256=4ALORJiL0wIdDvK1okW8rbjq2jL5F_TNASekDFQSULY,12428
+mako/parsetree.py,sha256=-wmyX_mklAoKhc-7Psx0U15EKpNSd8oGRXFmvk2JQWo,19021
+mako/pygen.py,sha256=689_jR0GG_8Am62Dmlm5h59VY6eyZAU3GroodqEDnZ0,10416
+mako/pyparser.py,sha256=8ZqUbCDIlgEup4si2zP7-xJns14JvVzX_QMO9sCCGJ0,7558
+mako/runtime.py,sha256=ZsUEN22nX3d3dECQujF69mBKDQS6yVv2nvz_0eTvFGg,27804
+mako/template.py,sha256=Vn5nLoBY-YzSQJKvRPFGb4fiPyZryA5Q-8mWutv0b9A,23563
+mako/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+mako/testing/_config.py,sha256=k-qpnsnbXUoN-ykMN5BRpg84i1x0p6UsAddKQnrIytU,3566
+mako/testing/assertions.py,sha256=pfbGl84QlW7QWGg3_lo3wP8XnBAVo9AjzNp2ajmn7FA,5161
+mako/testing/config.py,sha256=wmYVZfzGvOK3mJUZpzmgO8-iIgvaCH41Woi4yDpxq6E,323
+mako/testing/exclusions.py,sha256=_t6ADKdatk3f18tOfHV_ZY6u_ZwQsKphZ2MXJVSAOcI,1553
+mako/testing/fixtures.py,sha256=nEp7wTusf7E0n3Q-BHJW2s_t1vx0KB9poadQ1BmIJzE,3044
+mako/testing/helpers.py,sha256=z4HAactwlht4ut1cbvxKt1QLb3yLPk1U7cnh5BwVUlc,1623
+mako/util.py,sha256=SNYeX2_PmajQJIR3-S1Yqxxylz8lwS65rC8YbCdTkUU,10638
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/REQUESTED b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..1eb3c49d99559863120cfb8433fc8738fba43ba9
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: setuptools (78.1.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/entry_points.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..30f31b2bf217432c8a80e4a097268c7ffd79a986
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/entry_points.txt
@@ -0,0 +1,18 @@
+[babel.extractors]
+mako = mako.ext.babelplugin:extract [babel]
+
+[console_scripts]
+mako-render = mako.cmd:cmdline
+
+[lingua.extractors]
+mako = mako.ext.linguaplugin:LinguaMakoExtractor [lingua]
+
+[pygments.lexers]
+css+mako = mako.ext.pygmentplugin:MakoCssLexer
+html+mako = mako.ext.pygmentplugin:MakoHtmlLexer
+js+mako = mako.ext.pygmentplugin:MakoJavascriptLexer
+mako = mako.ext.pygmentplugin:MakoLexer
+xml+mako = mako.ext.pygmentplugin:MakoXmlLexer
+
+[python.templating.engines]
+mako = mako.ext.turbogears:TGPlugin
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/licenses/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/licenses/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..4c18adee3da2a51fb5b2b77567cb408ea4395b50
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/licenses/LICENSE
@@ -0,0 +1,19 @@
+Copyright 2006-2025 the Mako authors and contributors .
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2951cdd49d33f08a4f5af6213f315e571274c854
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/mako-1.3.10.dist-info/top_level.txt
@@ -0,0 +1 @@
+mako
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..5710827b61d5f5fa25dde778489c2d56677b9b37
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/__init__.py
@@ -0,0 +1,53 @@
+"""
+NetworkX
+========
+
+NetworkX is a Python package for the creation, manipulation, and study of the
+structure, dynamics, and functions of complex networks.
+
+See https://networkx.org for complete documentation.
+"""
+
+__version__ = "3.4.2"
+
+
+# These are imported in order as listed
+from networkx.lazy_imports import _lazy_import
+
+from networkx.exception import *
+
+from networkx import utils
+from networkx.utils import _clear_cache, _dispatchable
+
+# load_and_call entry_points, set configs
+config = utils.backends._set_configs_from_environment()
+utils.config = utils.configs.config = config # type: ignore[attr-defined]
+
+from networkx import classes
+from networkx.classes import filters
+from networkx.classes import *
+
+from networkx import convert
+from networkx.convert import *
+
+from networkx import convert_matrix
+from networkx.convert_matrix import *
+
+from networkx import relabel
+from networkx.relabel import *
+
+from networkx import generators
+from networkx.generators import *
+
+from networkx import readwrite
+from networkx.readwrite import *
+
+# Need to test with SciPy, when available
+from networkx import algorithms
+from networkx.algorithms import *
+
+from networkx import linalg
+from networkx.linalg import *
+
+from networkx import drawing
+from networkx.drawing import *
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/algorithms/walks.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/algorithms/walks.py
new file mode 100644
index 0000000000000000000000000000000000000000..0ef9dac121805ef2c4e4538a97f275a05dff92cb
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/algorithms/walks.py
@@ -0,0 +1,79 @@
+"""Function for computing walks in a graph."""
+
+import networkx as nx
+
+__all__ = ["number_of_walks"]
+
+
+@nx._dispatchable
+def number_of_walks(G, walk_length):
+ """Returns the number of walks connecting each pair of nodes in `G`
+
+ A *walk* is a sequence of nodes in which each adjacent pair of nodes
+ in the sequence is adjacent in the graph. A walk can repeat the same
+ edge and go in the opposite direction just as people can walk on a
+ set of paths, but standing still is not counted as part of the walk.
+
+ This function only counts the walks with `walk_length` edges. Note that
+ the number of nodes in the walk sequence is one more than `walk_length`.
+ The number of walks can grow very quickly on a larger graph
+ and with a larger walk length.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+
+ walk_length : int
+ A nonnegative integer representing the length of a walk.
+
+ Returns
+ -------
+ dict
+ A dictionary of dictionaries in which outer keys are source
+ nodes, inner keys are target nodes, and inner values are the
+ number of walks of length `walk_length` connecting those nodes.
+
+ Raises
+ ------
+ ValueError
+ If `walk_length` is negative
+
+ Examples
+ --------
+
+ >>> G = nx.Graph([(0, 1), (1, 2)])
+ >>> walks = nx.number_of_walks(G, 2)
+ >>> walks
+ {0: {0: 1, 1: 0, 2: 1}, 1: {0: 0, 1: 2, 2: 0}, 2: {0: 1, 1: 0, 2: 1}}
+ >>> total_walks = sum(sum(tgts.values()) for _, tgts in walks.items())
+
+ You can also get the number of walks from a specific source node using the
+ returned dictionary. For example, number of walks of length 1 from node 0
+ can be found as follows:
+
+ >>> walks = nx.number_of_walks(G, 1)
+ >>> walks[0]
+ {0: 0, 1: 1, 2: 0}
+ >>> sum(walks[0].values()) # walks from 0 of length 1
+ 1
+
+ Similarly, a target node can also be specified:
+
+ >>> walks[0][1]
+ 1
+
+ """
+ import numpy as np
+
+ if walk_length < 0:
+ raise ValueError(f"`walk_length` cannot be negative: {walk_length}")
+
+ A = nx.adjacency_matrix(G, weight=None)
+ # TODO: Use matrix_power from scipy.sparse when available
+ # power = sp.sparse.linalg.matrix_power(A, walk_length)
+ power = np.linalg.matrix_power(A.toarray(), walk_length)
+ result = {
+ u: {v: power.item(u_idx, v_idx) for v_idx, v in enumerate(G)}
+ for u_idx, u in enumerate(G)
+ }
+ return result
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/conftest.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/conftest.py
new file mode 100644
index 0000000000000000000000000000000000000000..4a261c6d0d6f1a31c55349c2cee6776f9b2ba6c4
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/conftest.py
@@ -0,0 +1,284 @@
+"""
+Testing
+=======
+
+General guidelines for writing good tests:
+
+- doctests always assume ``import networkx as nx`` so don't add that
+- prefer pytest fixtures over classes with setup methods.
+- use the ``@pytest.mark.parametrize`` decorator
+- use ``pytest.importorskip`` for numpy, scipy, pandas, and matplotlib b/c of PyPy.
+ and add the module to the relevant entries below.
+
+"""
+
+import os
+import sys
+import warnings
+from importlib.metadata import entry_points
+
+import pytest
+
+import networkx
+
+
+def pytest_addoption(parser):
+ parser.addoption(
+ "--runslow", action="store_true", default=False, help="run slow tests"
+ )
+ parser.addoption(
+ "--backend",
+ action="store",
+ default=None,
+ help="Run tests with a backend by auto-converting nx graphs to backend graphs",
+ )
+ parser.addoption(
+ "--fallback-to-nx",
+ action="store_true",
+ default=False,
+ help="Run nx function if a backend doesn't implement a dispatchable function"
+ " (use with --backend)",
+ )
+
+
+def pytest_configure(config):
+ config.addinivalue_line("markers", "slow: mark test as slow to run")
+ backend = config.getoption("--backend")
+ if backend is None:
+ backend = os.environ.get("NETWORKX_TEST_BACKEND")
+ # nx_loopback backend is only available when testing with a backend
+ loopback_ep = entry_points(name="nx_loopback", group="networkx.backends")
+ if not loopback_ep:
+ warnings.warn(
+ "\n\n WARNING: Mixed NetworkX configuration! \n\n"
+ " This environment has mixed configuration for networkx.\n"
+ " The test object nx_loopback is not configured correctly.\n"
+ " You should not be seeing this message.\n"
+ " Try `pip install -e .`, or change your PYTHONPATH\n"
+ " Make sure python finds the networkx repo you are testing\n\n"
+ )
+ config.backend = backend
+ if backend:
+ # We will update `networkx.config.backend_priority` below in `*_modify_items`
+ # to allow tests to get set up with normal networkx graphs.
+ networkx.utils.backends.backends["nx_loopback"] = loopback_ep["nx_loopback"]
+ networkx.utils.backends.backend_info["nx_loopback"] = {}
+ networkx.config.backends = networkx.utils.Config(
+ nx_loopback=networkx.utils.Config(),
+ **networkx.config.backends,
+ )
+ fallback_to_nx = config.getoption("--fallback-to-nx")
+ if not fallback_to_nx:
+ fallback_to_nx = os.environ.get("NETWORKX_FALLBACK_TO_NX")
+ networkx.config.fallback_to_nx = bool(fallback_to_nx)
+
+
+def pytest_collection_modifyitems(config, items):
+ # Setting this to True here allows tests to be set up before dispatching
+ # any function call to a backend.
+ if config.backend:
+ # Allow pluggable backends to add markers to tests (such as skip or xfail)
+ # when running in auto-conversion test mode
+ backend_name = config.backend
+ if backend_name != "networkx":
+ networkx.utils.backends._dispatchable._is_testing = True
+ networkx.config.backend_priority.algos = [backend_name]
+ networkx.config.backend_priority.generators = [backend_name]
+ backend = networkx.utils.backends.backends[backend_name].load()
+ if hasattr(backend, "on_start_tests"):
+ getattr(backend, "on_start_tests")(items)
+
+ if config.getoption("--runslow"):
+ # --runslow given in cli: do not skip slow tests
+ return
+ skip_slow = pytest.mark.skip(reason="need --runslow option to run")
+ for item in items:
+ if "slow" in item.keywords:
+ item.add_marker(skip_slow)
+
+
+# TODO: The warnings below need to be dealt with, but for now we silence them.
+@pytest.fixture(autouse=True)
+def set_warnings():
+ warnings.filterwarnings(
+ "ignore",
+ category=FutureWarning,
+ message="\n\nsingle_target_shortest_path_length",
+ )
+ warnings.filterwarnings(
+ "ignore",
+ category=FutureWarning,
+ message="\n\nshortest_path",
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="\n\nThe `normalized`"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="\n\nall_triplets"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="\n\nrandom_triad"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="minimal_d_separator"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="d_separated"
+ )
+ warnings.filterwarnings("ignore", category=DeprecationWarning, message="\n\nk_core")
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="\n\nk_shell"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="\n\nk_crust"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="\n\nk_corona"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="\n\ntotal_spanning_tree_weight"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message=r"\n\nThe 'create=matrix'"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="\n\n`compute_v_structures"
+ )
+ warnings.filterwarnings(
+ "ignore", category=DeprecationWarning, message="Keyword argument 'link'"
+ )
+
+
+@pytest.fixture(autouse=True)
+def add_nx(doctest_namespace):
+ doctest_namespace["nx"] = networkx
+
+
+# What dependencies are installed?
+
+try:
+ import numpy
+
+ has_numpy = True
+except ImportError:
+ has_numpy = False
+
+try:
+ import scipy
+
+ has_scipy = True
+except ImportError:
+ has_scipy = False
+
+try:
+ import matplotlib
+
+ has_matplotlib = True
+except ImportError:
+ has_matplotlib = False
+
+try:
+ import pandas
+
+ has_pandas = True
+except ImportError:
+ has_pandas = False
+
+try:
+ import pygraphviz
+
+ has_pygraphviz = True
+except ImportError:
+ has_pygraphviz = False
+
+try:
+ import pydot
+
+ has_pydot = True
+except ImportError:
+ has_pydot = False
+
+try:
+ import sympy
+
+ has_sympy = True
+except ImportError:
+ has_sympy = False
+
+
+# List of files that pytest should ignore
+
+collect_ignore = []
+
+needs_numpy = [
+ "algorithms/approximation/traveling_salesman.py",
+ "algorithms/centrality/current_flow_closeness.py",
+ "algorithms/centrality/laplacian.py",
+ "algorithms/node_classification.py",
+ "algorithms/non_randomness.py",
+ "algorithms/polynomials.py",
+ "algorithms/shortest_paths/dense.py",
+ "algorithms/tree/mst.py",
+ "drawing/nx_latex.py",
+ "generators/expanders.py",
+ "linalg/bethehessianmatrix.py",
+ "linalg/laplacianmatrix.py",
+ "utils/misc.py",
+]
+needs_scipy = [
+ "algorithms/approximation/traveling_salesman.py",
+ "algorithms/assortativity/correlation.py",
+ "algorithms/assortativity/mixing.py",
+ "algorithms/assortativity/pairs.py",
+ "algorithms/bipartite/matrix.py",
+ "algorithms/bipartite/spectral.py",
+ "algorithms/centrality/current_flow_betweenness.py",
+ "algorithms/centrality/current_flow_betweenness_subset.py",
+ "algorithms/centrality/eigenvector.py",
+ "algorithms/centrality/katz.py",
+ "algorithms/centrality/laplacian.py",
+ "algorithms/centrality/second_order.py",
+ "algorithms/centrality/subgraph_alg.py",
+ "algorithms/communicability_alg.py",
+ "algorithms/community/divisive.py",
+ "algorithms/distance_measures.py",
+ "algorithms/link_analysis/hits_alg.py",
+ "algorithms/link_analysis/pagerank_alg.py",
+ "algorithms/node_classification.py",
+ "algorithms/similarity.py",
+ "algorithms/tree/mst.py",
+ "algorithms/walks.py",
+ "convert_matrix.py",
+ "drawing/layout.py",
+ "drawing/nx_pylab.py",
+ "generators/spectral_graph_forge.py",
+ "generators/expanders.py",
+ "linalg/algebraicconnectivity.py",
+ "linalg/attrmatrix.py",
+ "linalg/bethehessianmatrix.py",
+ "linalg/graphmatrix.py",
+ "linalg/laplacianmatrix.py",
+ "linalg/modularitymatrix.py",
+ "linalg/spectrum.py",
+ "utils/rcm.py",
+]
+needs_matplotlib = ["drawing/nx_pylab.py", "generators/classic.py"]
+needs_pandas = ["convert_matrix.py"]
+needs_pygraphviz = ["drawing/nx_agraph.py"]
+needs_pydot = ["drawing/nx_pydot.py"]
+needs_sympy = ["algorithms/polynomials.py"]
+
+if not has_numpy:
+ collect_ignore += needs_numpy
+if not has_scipy:
+ collect_ignore += needs_scipy
+if not has_matplotlib:
+ collect_ignore += needs_matplotlib
+if not has_pandas:
+ collect_ignore += needs_pandas
+if not has_pygraphviz:
+ collect_ignore += needs_pygraphviz
+if not has_pydot:
+ collect_ignore += needs_pydot
+if not has_sympy:
+ collect_ignore += needs_sympy
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/convert.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/convert.py
new file mode 100644
index 0000000000000000000000000000000000000000..3f89c35d8067bf06768109f73caa3436d3719662
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/convert.py
@@ -0,0 +1,502 @@
+"""Functions to convert NetworkX graphs to and from other formats.
+
+The preferred way of converting data to a NetworkX graph is through the
+graph constructor. The constructor calls the to_networkx_graph() function
+which attempts to guess the input type and convert it automatically.
+
+Examples
+--------
+Create a graph with a single edge from a dictionary of dictionaries
+
+>>> d = {0: {1: 1}} # dict-of-dicts single edge (0,1)
+>>> G = nx.Graph(d)
+
+See Also
+--------
+nx_agraph, nx_pydot
+"""
+
+import warnings
+from collections.abc import Collection, Generator, Iterator
+
+import networkx as nx
+
+__all__ = [
+ "to_networkx_graph",
+ "from_dict_of_dicts",
+ "to_dict_of_dicts",
+ "from_dict_of_lists",
+ "to_dict_of_lists",
+ "from_edgelist",
+ "to_edgelist",
+]
+
+
+def to_networkx_graph(data, create_using=None, multigraph_input=False):
+ """Make a NetworkX graph from a known data structure.
+
+ The preferred way to call this is automatically
+ from the class constructor
+
+ >>> d = {0: {1: {"weight": 1}}} # dict-of-dicts single edge (0,1)
+ >>> G = nx.Graph(d)
+
+ instead of the equivalent
+
+ >>> G = nx.from_dict_of_dicts(d)
+
+ Parameters
+ ----------
+ data : object to be converted
+
+ Current known types are:
+ any NetworkX graph
+ dict-of-dicts
+ dict-of-lists
+ container (e.g. set, list, tuple) of edges
+ iterator (e.g. itertools.chain) that produces edges
+ generator of edges
+ Pandas DataFrame (row per edge)
+ 2D numpy array
+ scipy sparse array
+ pygraphviz agraph
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ multigraph_input : bool (default False)
+ If True and data is a dict_of_dicts,
+ try to create a multigraph assuming dict_of_dict_of_lists.
+ If data and create_using are both multigraphs then create
+ a multigraph from a multigraph.
+
+ """
+ # NX graph
+ if hasattr(data, "adj"):
+ try:
+ result = from_dict_of_dicts(
+ data.adj,
+ create_using=create_using,
+ multigraph_input=data.is_multigraph(),
+ )
+ # data.graph should be dict-like
+ result.graph.update(data.graph)
+ # data.nodes should be dict-like
+ # result.add_node_from(data.nodes.items()) possible but
+ # for custom node_attr_dict_factory which may be hashable
+ # will be unexpected behavior
+ for n, dd in data.nodes.items():
+ result._node[n].update(dd)
+ return result
+ except Exception as err:
+ raise nx.NetworkXError("Input is not a correct NetworkX graph.") from err
+
+ # dict of dicts/lists
+ if isinstance(data, dict):
+ try:
+ return from_dict_of_dicts(
+ data, create_using=create_using, multigraph_input=multigraph_input
+ )
+ except Exception as err1:
+ if multigraph_input is True:
+ raise nx.NetworkXError(
+ f"converting multigraph_input raised:\n{type(err1)}: {err1}"
+ )
+ try:
+ return from_dict_of_lists(data, create_using=create_using)
+ except Exception as err2:
+ raise TypeError("Input is not known type.") from err2
+
+ # edgelists
+ if isinstance(data, list | tuple | nx.reportviews.EdgeViewABC | Iterator):
+ try:
+ return from_edgelist(data, create_using=create_using)
+ except:
+ pass
+
+ # pygraphviz agraph
+ if hasattr(data, "is_strict"):
+ try:
+ return nx.nx_agraph.from_agraph(data, create_using=create_using)
+ except Exception as err:
+ raise nx.NetworkXError("Input is not a correct pygraphviz graph.") from err
+
+ # Pandas DataFrame
+ try:
+ import pandas as pd
+
+ if isinstance(data, pd.DataFrame):
+ if data.shape[0] == data.shape[1]:
+ try:
+ return nx.from_pandas_adjacency(data, create_using=create_using)
+ except Exception as err:
+ msg = "Input is not a correct Pandas DataFrame adjacency matrix."
+ raise nx.NetworkXError(msg) from err
+ else:
+ try:
+ return nx.from_pandas_edgelist(
+ data, edge_attr=True, create_using=create_using
+ )
+ except Exception as err:
+ msg = "Input is not a correct Pandas DataFrame edge-list."
+ raise nx.NetworkXError(msg) from err
+ except ImportError:
+ pass
+
+ # numpy array
+ try:
+ import numpy as np
+
+ if isinstance(data, np.ndarray):
+ try:
+ return nx.from_numpy_array(data, create_using=create_using)
+ except Exception as err:
+ raise nx.NetworkXError(
+ f"Failed to interpret array as an adjacency matrix."
+ ) from err
+ except ImportError:
+ pass
+
+ # scipy sparse array - any format
+ try:
+ import scipy
+
+ if hasattr(data, "format"):
+ try:
+ return nx.from_scipy_sparse_array(data, create_using=create_using)
+ except Exception as err:
+ raise nx.NetworkXError(
+ "Input is not a correct scipy sparse array type."
+ ) from err
+ except ImportError:
+ pass
+
+ # Note: most general check - should remain last in order of execution
+ # Includes containers (e.g. list, set, dict, etc.), generators, and
+ # iterators (e.g. itertools.chain) of edges
+
+ if isinstance(data, Collection | Generator | Iterator):
+ try:
+ return from_edgelist(data, create_using=create_using)
+ except Exception as err:
+ raise nx.NetworkXError("Input is not a valid edge list") from err
+
+ raise nx.NetworkXError("Input is not a known data type for conversion.")
+
+
+@nx._dispatchable
+def to_dict_of_lists(G, nodelist=None):
+ """Returns adjacency representation of graph as a dictionary of lists.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ nodelist : list
+ Use only nodes specified in nodelist
+
+ Notes
+ -----
+ Completely ignores edge data for MultiGraph and MultiDiGraph.
+
+ """
+ if nodelist is None:
+ nodelist = G
+
+ d = {}
+ for n in nodelist:
+ d[n] = [nbr for nbr in G.neighbors(n) if nbr in nodelist]
+ return d
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_dict_of_lists(d, create_using=None):
+ """Returns a graph from a dictionary of lists.
+
+ Parameters
+ ----------
+ d : dictionary of lists
+ A dictionary of lists adjacency representation.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Examples
+ --------
+ >>> dol = {0: [1]} # single edge (0,1)
+ >>> G = nx.from_dict_of_lists(dol)
+
+ or
+
+ >>> G = nx.Graph(dol) # use Graph constructor
+
+ """
+ G = nx.empty_graph(0, create_using)
+ G.add_nodes_from(d)
+ if G.is_multigraph() and not G.is_directed():
+ # a dict_of_lists can't show multiedges. BUT for undirected graphs,
+ # each edge shows up twice in the dict_of_lists.
+ # So we need to treat this case separately.
+ seen = {}
+ for node, nbrlist in d.items():
+ for nbr in nbrlist:
+ if nbr not in seen:
+ G.add_edge(node, nbr)
+ seen[node] = 1 # don't allow reverse edge to show up
+ else:
+ G.add_edges_from(
+ ((node, nbr) for node, nbrlist in d.items() for nbr in nbrlist)
+ )
+ return G
+
+
+def to_dict_of_dicts(G, nodelist=None, edge_data=None):
+ """Returns adjacency representation of graph as a dictionary of dictionaries.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ nodelist : list
+ Use only nodes specified in nodelist
+
+ edge_data : scalar, optional
+ If provided, the value of the dictionary will be set to `edge_data` for
+ all edges. Usual values could be `1` or `True`. If `edge_data` is
+ `None` (the default), the edgedata in `G` is used, resulting in a
+ dict-of-dict-of-dicts. If `G` is a MultiGraph, the result will be a
+ dict-of-dict-of-dict-of-dicts. See Notes for an approach to customize
+ handling edge data. `edge_data` should *not* be a container.
+
+ Returns
+ -------
+ dod : dict
+ A nested dictionary representation of `G`. Note that the level of
+ nesting depends on the type of `G` and the value of `edge_data`
+ (see Examples).
+
+ See Also
+ --------
+ from_dict_of_dicts, to_dict_of_lists
+
+ Notes
+ -----
+ For a more custom approach to handling edge data, try::
+
+ dod = {
+ n: {nbr: custom(n, nbr, dd) for nbr, dd in nbrdict.items()}
+ for n, nbrdict in G.adj.items()
+ }
+
+ where `custom` returns the desired edge data for each edge between `n` and
+ `nbr`, given existing edge data `dd`.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(3)
+ >>> nx.to_dict_of_dicts(G)
+ {0: {1: {}}, 1: {0: {}, 2: {}}, 2: {1: {}}}
+
+ Edge data is preserved by default (``edge_data=None``), resulting
+ in dict-of-dict-of-dicts where the innermost dictionary contains the
+ edge data:
+
+ >>> G = nx.Graph()
+ >>> G.add_edges_from(
+ ... [
+ ... (0, 1, {"weight": 1.0}),
+ ... (1, 2, {"weight": 2.0}),
+ ... (2, 0, {"weight": 1.0}),
+ ... ]
+ ... )
+ >>> d = nx.to_dict_of_dicts(G)
+ >>> d # doctest: +SKIP
+ {0: {1: {'weight': 1.0}, 2: {'weight': 1.0}},
+ 1: {0: {'weight': 1.0}, 2: {'weight': 2.0}},
+ 2: {1: {'weight': 2.0}, 0: {'weight': 1.0}}}
+ >>> d[1][2]["weight"]
+ 2.0
+
+ If `edge_data` is not `None`, edge data in the original graph (if any) is
+ replaced:
+
+ >>> d = nx.to_dict_of_dicts(G, edge_data=1)
+ >>> d
+ {0: {1: 1, 2: 1}, 1: {0: 1, 2: 1}, 2: {1: 1, 0: 1}}
+ >>> d[1][2]
+ 1
+
+ This also applies to MultiGraphs: edge data is preserved by default:
+
+ >>> G = nx.MultiGraph()
+ >>> G.add_edge(0, 1, key="a", weight=1.0)
+ 'a'
+ >>> G.add_edge(0, 1, key="b", weight=5.0)
+ 'b'
+ >>> d = nx.to_dict_of_dicts(G)
+ >>> d # doctest: +SKIP
+ {0: {1: {'a': {'weight': 1.0}, 'b': {'weight': 5.0}}},
+ 1: {0: {'a': {'weight': 1.0}, 'b': {'weight': 5.0}}}}
+ >>> d[0][1]["b"]["weight"]
+ 5.0
+
+ But multi edge data is lost if `edge_data` is not `None`:
+
+ >>> d = nx.to_dict_of_dicts(G, edge_data=10)
+ >>> d
+ {0: {1: 10}, 1: {0: 10}}
+ """
+ dod = {}
+ if nodelist is None:
+ if edge_data is None:
+ for u, nbrdict in G.adjacency():
+ dod[u] = nbrdict.copy()
+ else: # edge_data is not None
+ for u, nbrdict in G.adjacency():
+ dod[u] = dod.fromkeys(nbrdict, edge_data)
+ else: # nodelist is not None
+ if edge_data is None:
+ for u in nodelist:
+ dod[u] = {}
+ for v, data in ((v, data) for v, data in G[u].items() if v in nodelist):
+ dod[u][v] = data
+ else: # nodelist and edge_data are not None
+ for u in nodelist:
+ dod[u] = {}
+ for v in (v for v in G[u] if v in nodelist):
+ dod[u][v] = edge_data
+ return dod
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_dict_of_dicts(d, create_using=None, multigraph_input=False):
+ """Returns a graph from a dictionary of dictionaries.
+
+ Parameters
+ ----------
+ d : dictionary of dictionaries
+ A dictionary of dictionaries adjacency representation.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ multigraph_input : bool (default False)
+ When True, the dict `d` is assumed
+ to be a dict-of-dict-of-dict-of-dict structure keyed by
+ node to neighbor to edge keys to edge data for multi-edges.
+ Otherwise this routine assumes dict-of-dict-of-dict keyed by
+ node to neighbor to edge data.
+
+ Examples
+ --------
+ >>> dod = {0: {1: {"weight": 1}}} # single edge (0,1)
+ >>> G = nx.from_dict_of_dicts(dod)
+
+ or
+
+ >>> G = nx.Graph(dod) # use Graph constructor
+
+ """
+ G = nx.empty_graph(0, create_using)
+ G.add_nodes_from(d)
+ # does dict d represent a MultiGraph or MultiDiGraph?
+ if multigraph_input:
+ if G.is_directed():
+ if G.is_multigraph():
+ G.add_edges_from(
+ (u, v, key, data)
+ for u, nbrs in d.items()
+ for v, datadict in nbrs.items()
+ for key, data in datadict.items()
+ )
+ else:
+ G.add_edges_from(
+ (u, v, data)
+ for u, nbrs in d.items()
+ for v, datadict in nbrs.items()
+ for key, data in datadict.items()
+ )
+ else: # Undirected
+ if G.is_multigraph():
+ seen = set() # don't add both directions of undirected graph
+ for u, nbrs in d.items():
+ for v, datadict in nbrs.items():
+ if (u, v) not in seen:
+ G.add_edges_from(
+ (u, v, key, data) for key, data in datadict.items()
+ )
+ seen.add((v, u))
+ else:
+ seen = set() # don't add both directions of undirected graph
+ for u, nbrs in d.items():
+ for v, datadict in nbrs.items():
+ if (u, v) not in seen:
+ G.add_edges_from(
+ (u, v, data) for key, data in datadict.items()
+ )
+ seen.add((v, u))
+
+ else: # not a multigraph to multigraph transfer
+ if G.is_multigraph() and not G.is_directed():
+ # d can have both representations u-v, v-u in dict. Only add one.
+ # We don't need this check for digraphs since we add both directions,
+ # or for Graph() since it is done implicitly (parallel edges not allowed)
+ seen = set()
+ for u, nbrs in d.items():
+ for v, data in nbrs.items():
+ if (u, v) not in seen:
+ G.add_edge(u, v, key=0)
+ G[u][v][0].update(data)
+ seen.add((v, u))
+ else:
+ G.add_edges_from(
+ ((u, v, data) for u, nbrs in d.items() for v, data in nbrs.items())
+ )
+ return G
+
+
+@nx._dispatchable(preserve_edge_attrs=True)
+def to_edgelist(G, nodelist=None):
+ """Returns a list of edges in the graph.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ nodelist : list
+ Use only nodes specified in nodelist
+
+ """
+ if nodelist is None:
+ return G.edges(data=True)
+ return G.edges(nodelist, data=True)
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_edgelist(edgelist, create_using=None):
+ """Returns a graph from a list of edges.
+
+ Parameters
+ ----------
+ edgelist : list or iterator
+ Edge tuples
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Examples
+ --------
+ >>> edgelist = [(0, 1)] # single edge (0,1)
+ >>> G = nx.from_edgelist(edgelist)
+
+ or
+
+ >>> G = nx.Graph(edgelist) # use Graph constructor
+
+ """
+ G = nx.empty_graph(0, create_using)
+ G.add_edges_from(edgelist)
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/convert_matrix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/convert_matrix.py
new file mode 100644
index 0000000000000000000000000000000000000000..8992627cbac970e46ca7dce0557611a51cea2c26
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/convert_matrix.py
@@ -0,0 +1,1317 @@
+"""Functions to convert NetworkX graphs to and from common data containers
+like numpy arrays, scipy sparse arrays, and pandas DataFrames.
+
+The preferred way of converting data to a NetworkX graph is through the
+graph constructor. The constructor calls the `~networkx.convert.to_networkx_graph`
+function which attempts to guess the input type and convert it automatically.
+
+Examples
+--------
+Create a 10 node random graph from a numpy array
+
+>>> import numpy as np
+>>> rng = np.random.default_rng()
+>>> a = rng.integers(low=0, high=2, size=(10, 10))
+>>> DG = nx.from_numpy_array(a, create_using=nx.DiGraph)
+
+or equivalently:
+
+>>> DG = nx.DiGraph(a)
+
+which calls `from_numpy_array` internally based on the type of ``a``.
+
+See Also
+--------
+nx_agraph, nx_pydot
+"""
+
+import itertools
+from collections import defaultdict
+
+import networkx as nx
+from networkx.utils import not_implemented_for
+
+__all__ = [
+ "from_pandas_adjacency",
+ "to_pandas_adjacency",
+ "from_pandas_edgelist",
+ "to_pandas_edgelist",
+ "from_scipy_sparse_array",
+ "to_scipy_sparse_array",
+ "from_numpy_array",
+ "to_numpy_array",
+]
+
+
+@nx._dispatchable(edge_attrs="weight")
+def to_pandas_adjacency(
+ G,
+ nodelist=None,
+ dtype=None,
+ order=None,
+ multigraph_weight=sum,
+ weight="weight",
+ nonedge=0.0,
+):
+ """Returns the graph adjacency matrix as a Pandas DataFrame.
+
+ Parameters
+ ----------
+ G : graph
+ The NetworkX graph used to construct the Pandas DataFrame.
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in `nodelist`.
+ If `nodelist` is None, then the ordering is produced by G.nodes().
+
+ multigraph_weight : {sum, min, max}, optional
+ An operator that determines how weights in multigraphs are handled.
+ The default is to sum the weights of the multiple edges.
+
+ weight : string or None, optional
+ The edge attribute that holds the numerical value used for
+ the edge weight. If an edge does not have that attribute, then the
+ value 1 is used instead.
+
+ nonedge : float, optional
+ The matrix values corresponding to nonedges are typically set to zero.
+ However, this could be undesirable if there are matrix values
+ corresponding to actual edges that also have the value zero. If so,
+ one might prefer nonedges to have some other value, such as nan.
+
+ Returns
+ -------
+ df : Pandas DataFrame
+ Graph adjacency matrix
+
+ Notes
+ -----
+ For directed graphs, entry i,j corresponds to an edge from i to j.
+
+ The DataFrame entries are assigned to the weight edge attribute. When
+ an edge does not have a weight attribute, the value of the entry is set to
+ the number 1. For multiple (parallel) edges, the values of the entries
+ are determined by the 'multigraph_weight' parameter. The default is to
+ sum the weight attributes for each of the parallel edges.
+
+ When `nodelist` does not contain every node in `G`, the matrix is built
+ from the subgraph of `G` that is induced by the nodes in `nodelist`.
+
+ The convention used for self-loop edges in graphs is to assign the
+ diagonal matrix entry value to the weight attribute of the edge
+ (or the number 1 if the edge has no weight attribute). If the
+ alternate convention of doubling the edge weight is desired the
+ resulting Pandas DataFrame can be modified as follows::
+
+ >>> import pandas as pd
+ >>> G = nx.Graph([(1, 1), (2, 2)])
+ >>> df = nx.to_pandas_adjacency(G)
+ >>> df
+ 1 2
+ 1 1.0 0.0
+ 2 0.0 1.0
+ >>> diag_idx = list(range(len(df)))
+ >>> df.iloc[diag_idx, diag_idx] *= 2
+ >>> df
+ 1 2
+ 1 2.0 0.0
+ 2 0.0 2.0
+
+ Examples
+ --------
+ >>> G = nx.MultiDiGraph()
+ >>> G.add_edge(0, 1, weight=2)
+ 0
+ >>> G.add_edge(1, 0)
+ 0
+ >>> G.add_edge(2, 2, weight=3)
+ 0
+ >>> G.add_edge(2, 2)
+ 1
+ >>> nx.to_pandas_adjacency(G, nodelist=[0, 1, 2], dtype=int)
+ 0 1 2
+ 0 0 2 0
+ 1 1 0 0
+ 2 0 0 4
+
+ """
+ import pandas as pd
+
+ M = to_numpy_array(
+ G,
+ nodelist=nodelist,
+ dtype=dtype,
+ order=order,
+ multigraph_weight=multigraph_weight,
+ weight=weight,
+ nonedge=nonedge,
+ )
+ if nodelist is None:
+ nodelist = list(G)
+ return pd.DataFrame(data=M, index=nodelist, columns=nodelist)
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_pandas_adjacency(df, create_using=None):
+ r"""Returns a graph from Pandas DataFrame.
+
+ The Pandas DataFrame is interpreted as an adjacency matrix for the graph.
+
+ Parameters
+ ----------
+ df : Pandas DataFrame
+ An adjacency matrix representation of a graph
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Notes
+ -----
+ For directed graphs, explicitly mention create_using=nx.DiGraph,
+ and entry i,j of df corresponds to an edge from i to j.
+
+ If `df` has a single data type for each entry it will be converted to an
+ appropriate Python data type.
+
+ If you have node attributes stored in a separate dataframe `df_nodes`,
+ you can load those attributes to the graph `G` using the following code:
+
+ ```
+ df_nodes = pd.DataFrame({"node_id": [1, 2, 3], "attribute1": ["A", "B", "C"]})
+ G.add_nodes_from((n, dict(d)) for n, d in df_nodes.iterrows())
+ ```
+
+ If `df` has a user-specified compound data type the names
+ of the data fields will be used as attribute keys in the resulting
+ NetworkX graph.
+
+ See Also
+ --------
+ to_pandas_adjacency
+
+ Examples
+ --------
+ Simple integer weights on edges:
+
+ >>> import pandas as pd
+ >>> pd.options.display.max_columns = 20
+ >>> df = pd.DataFrame([[1, 1], [2, 1]])
+ >>> df
+ 0 1
+ 0 1 1
+ 1 2 1
+ >>> G = nx.from_pandas_adjacency(df)
+ >>> G.name = "Graph from pandas adjacency matrix"
+ >>> print(G)
+ Graph named 'Graph from pandas adjacency matrix' with 2 nodes and 3 edges
+ """
+
+ try:
+ df = df[df.index]
+ except Exception as err:
+ missing = list(set(df.index).difference(set(df.columns)))
+ msg = f"{missing} not in columns"
+ raise nx.NetworkXError("Columns must match Indices.", msg) from err
+
+ A = df.values
+ G = from_numpy_array(A, create_using=create_using, nodelist=df.columns)
+
+ return G
+
+
+@nx._dispatchable(preserve_edge_attrs=True)
+def to_pandas_edgelist(
+ G,
+ source="source",
+ target="target",
+ nodelist=None,
+ dtype=None,
+ edge_key=None,
+):
+ """Returns the graph edge list as a Pandas DataFrame.
+
+ Parameters
+ ----------
+ G : graph
+ The NetworkX graph used to construct the Pandas DataFrame.
+
+ source : str or int, optional
+ A valid column name (string or integer) for the source nodes (for the
+ directed case).
+
+ target : str or int, optional
+ A valid column name (string or integer) for the target nodes (for the
+ directed case).
+
+ nodelist : list, optional
+ Use only nodes specified in nodelist
+
+ dtype : dtype, default None
+ Use to create the DataFrame. Data type to force.
+ Only a single dtype is allowed. If None, infer.
+
+ edge_key : str or int or None, optional (default=None)
+ A valid column name (string or integer) for the edge keys (for the
+ multigraph case). If None, edge keys are not stored in the DataFrame.
+
+ Returns
+ -------
+ df : Pandas DataFrame
+ Graph edge list
+
+ Examples
+ --------
+ >>> G = nx.Graph(
+ ... [
+ ... ("A", "B", {"cost": 1, "weight": 7}),
+ ... ("C", "E", {"cost": 9, "weight": 10}),
+ ... ]
+ ... )
+ >>> df = nx.to_pandas_edgelist(G, nodelist=["A", "C"])
+ >>> df[["source", "target", "cost", "weight"]]
+ source target cost weight
+ 0 A B 1 7
+ 1 C E 9 10
+
+ >>> G = nx.MultiGraph([("A", "B", {"cost": 1}), ("A", "B", {"cost": 9})])
+ >>> df = nx.to_pandas_edgelist(G, nodelist=["A", "C"], edge_key="ekey")
+ >>> df[["source", "target", "cost", "ekey"]]
+ source target cost ekey
+ 0 A B 1 0
+ 1 A B 9 1
+
+ """
+ import pandas as pd
+
+ if nodelist is None:
+ edgelist = G.edges(data=True)
+ else:
+ edgelist = G.edges(nodelist, data=True)
+ source_nodes = [s for s, _, _ in edgelist]
+ target_nodes = [t for _, t, _ in edgelist]
+
+ all_attrs = set().union(*(d.keys() for _, _, d in edgelist))
+ if source in all_attrs:
+ raise nx.NetworkXError(f"Source name {source!r} is an edge attr name")
+ if target in all_attrs:
+ raise nx.NetworkXError(f"Target name {target!r} is an edge attr name")
+
+ nan = float("nan")
+ edge_attr = {k: [d.get(k, nan) for _, _, d in edgelist] for k in all_attrs}
+
+ if G.is_multigraph() and edge_key is not None:
+ if edge_key in all_attrs:
+ raise nx.NetworkXError(f"Edge key name {edge_key!r} is an edge attr name")
+ edge_keys = [k for _, _, k in G.edges(keys=True)]
+ edgelistdict = {source: source_nodes, target: target_nodes, edge_key: edge_keys}
+ else:
+ edgelistdict = {source: source_nodes, target: target_nodes}
+
+ edgelistdict.update(edge_attr)
+ return pd.DataFrame(edgelistdict, dtype=dtype)
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_pandas_edgelist(
+ df,
+ source="source",
+ target="target",
+ edge_attr=None,
+ create_using=None,
+ edge_key=None,
+):
+ """Returns a graph from Pandas DataFrame containing an edge list.
+
+ The Pandas DataFrame should contain at least two columns of node names and
+ zero or more columns of edge attributes. Each row will be processed as one
+ edge instance.
+
+ Note: This function iterates over DataFrame.values, which is not
+ guaranteed to retain the data type across columns in the row. This is only
+ a problem if your row is entirely numeric and a mix of ints and floats. In
+ that case, all values will be returned as floats. See the
+ DataFrame.iterrows documentation for an example.
+
+ Parameters
+ ----------
+ df : Pandas DataFrame
+ An edge list representation of a graph
+
+ source : str or int
+ A valid column name (string or integer) for the source nodes (for the
+ directed case).
+
+ target : str or int
+ A valid column name (string or integer) for the target nodes (for the
+ directed case).
+
+ edge_attr : str or int, iterable, True, or None
+ A valid column name (str or int) or iterable of column names that are
+ used to retrieve items and add them to the graph as edge attributes.
+ If `True`, all columns will be added except `source`, `target` and `edge_key`.
+ If `None`, no edge attributes are added to the graph.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ edge_key : str or None, optional (default=None)
+ A valid column name for the edge keys (for a MultiGraph). The values in
+ this column are used for the edge keys when adding edges if create_using
+ is a multigraph.
+
+ If you have node attributes stored in a separate dataframe `df_nodes`,
+ you can load those attributes to the graph `G` using the following code:
+
+ ```
+ df_nodes = pd.DataFrame({"node_id": [1, 2, 3], "attribute1": ["A", "B", "C"]})
+ G.add_nodes_from((n, dict(d)) for n, d in df_nodes.iterrows())
+ ```
+
+ See Also
+ --------
+ to_pandas_edgelist
+
+ Examples
+ --------
+ Simple integer weights on edges:
+
+ >>> import pandas as pd
+ >>> pd.options.display.max_columns = 20
+ >>> import numpy as np
+ >>> rng = np.random.RandomState(seed=5)
+ >>> ints = rng.randint(1, 11, size=(3, 2))
+ >>> a = ["A", "B", "C"]
+ >>> b = ["D", "A", "E"]
+ >>> df = pd.DataFrame(ints, columns=["weight", "cost"])
+ >>> df[0] = a
+ >>> df["b"] = b
+ >>> df[["weight", "cost", 0, "b"]]
+ weight cost 0 b
+ 0 4 7 A D
+ 1 7 1 B A
+ 2 10 9 C E
+ >>> G = nx.from_pandas_edgelist(df, 0, "b", ["weight", "cost"])
+ >>> G["E"]["C"]["weight"]
+ 10
+ >>> G["E"]["C"]["cost"]
+ 9
+ >>> edges = pd.DataFrame(
+ ... {
+ ... "source": [0, 1, 2],
+ ... "target": [2, 2, 3],
+ ... "weight": [3, 4, 5],
+ ... "color": ["red", "blue", "blue"],
+ ... }
+ ... )
+ >>> G = nx.from_pandas_edgelist(edges, edge_attr=True)
+ >>> G[0][2]["color"]
+ 'red'
+
+ Build multigraph with custom keys:
+
+ >>> edges = pd.DataFrame(
+ ... {
+ ... "source": [0, 1, 2, 0],
+ ... "target": [2, 2, 3, 2],
+ ... "my_edge_key": ["A", "B", "C", "D"],
+ ... "weight": [3, 4, 5, 6],
+ ... "color": ["red", "blue", "blue", "blue"],
+ ... }
+ ... )
+ >>> G = nx.from_pandas_edgelist(
+ ... edges,
+ ... edge_key="my_edge_key",
+ ... edge_attr=["weight", "color"],
+ ... create_using=nx.MultiGraph(),
+ ... )
+ >>> G[0][2]
+ AtlasView({'A': {'weight': 3, 'color': 'red'}, 'D': {'weight': 6, 'color': 'blue'}})
+
+
+ """
+ g = nx.empty_graph(0, create_using)
+
+ if edge_attr is None:
+ if g.is_multigraph() and edge_key is not None:
+ for u, v, k in zip(df[source], df[target], df[edge_key]):
+ g.add_edge(u, v, k)
+ else:
+ g.add_edges_from(zip(df[source], df[target]))
+ return g
+
+ reserved_columns = [source, target]
+ if g.is_multigraph() and edge_key is not None:
+ reserved_columns.append(edge_key)
+
+ # Additional columns requested
+ attr_col_headings = []
+ attribute_data = []
+ if edge_attr is True:
+ attr_col_headings = [c for c in df.columns if c not in reserved_columns]
+ elif isinstance(edge_attr, list | tuple):
+ attr_col_headings = edge_attr
+ else:
+ attr_col_headings = [edge_attr]
+ if len(attr_col_headings) == 0:
+ raise nx.NetworkXError(
+ f"Invalid edge_attr argument: No columns found with name: {attr_col_headings}"
+ )
+
+ try:
+ attribute_data = zip(*[df[col] for col in attr_col_headings])
+ except (KeyError, TypeError) as err:
+ msg = f"Invalid edge_attr argument: {edge_attr}"
+ raise nx.NetworkXError(msg) from err
+
+ if g.is_multigraph():
+ # => append the edge keys from the df to the bundled data
+ if edge_key is not None:
+ try:
+ multigraph_edge_keys = df[edge_key]
+ attribute_data = zip(attribute_data, multigraph_edge_keys)
+ except (KeyError, TypeError) as err:
+ msg = f"Invalid edge_key argument: {edge_key}"
+ raise nx.NetworkXError(msg) from err
+
+ for s, t, attrs in zip(df[source], df[target], attribute_data):
+ if edge_key is not None:
+ attrs, multigraph_edge_key = attrs
+ key = g.add_edge(s, t, key=multigraph_edge_key)
+ else:
+ key = g.add_edge(s, t)
+
+ g[s][t][key].update(zip(attr_col_headings, attrs))
+ else:
+ for s, t, attrs in zip(df[source], df[target], attribute_data):
+ g.add_edge(s, t)
+ g[s][t].update(zip(attr_col_headings, attrs))
+
+ return g
+
+
+@nx._dispatchable(edge_attrs="weight")
+def to_scipy_sparse_array(G, nodelist=None, dtype=None, weight="weight", format="csr"):
+ """Returns the graph adjacency matrix as a SciPy sparse array.
+
+ Parameters
+ ----------
+ G : graph
+ The NetworkX graph used to construct the sparse array.
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in `nodelist`.
+ If `nodelist` is None, then the ordering is produced by ``G.nodes()``.
+
+ dtype : NumPy data-type, optional
+ A valid NumPy dtype used to initialize the array. If None, then the
+ NumPy default is used.
+
+ weight : string or None, optional (default='weight')
+ The edge attribute that holds the numerical value used for
+ the edge weight. If None then all edge weights are 1.
+
+ format : str in {'bsr', 'csr', 'csc', 'coo', 'lil', 'dia', 'dok'}
+ The format of the sparse array to be returned (default 'csr'). For
+ some algorithms different implementations of sparse arrays
+ can perform better. See [1]_ for details.
+
+ Returns
+ -------
+ A : SciPy sparse array
+ Graph adjacency matrix.
+
+ Notes
+ -----
+ For directed graphs, matrix entry ``i, j`` corresponds to an edge from
+ ``i`` to ``j``.
+
+ The values of the adjacency matrix are populated using the edge attribute held in
+ parameter `weight`. When an edge does not have that attribute, the
+ value of the entry is 1.
+
+ For multiple edges the matrix values are the sums of the edge weights.
+
+ When `nodelist` does not contain every node in `G`, the adjacency matrix
+ is built from the subgraph of `G` that is induced by the nodes in
+ `nodelist`.
+
+ The convention used for self-loop edges in graphs is to assign the
+ diagonal matrix entry value to the weight attribute of the edge
+ (or the number 1 if the edge has no weight attribute). If the
+ alternate convention of doubling the edge weight is desired the
+ resulting array can be modified as follows::
+
+ >>> G = nx.Graph([(1, 1)])
+ >>> A = nx.to_scipy_sparse_array(G)
+ >>> A.toarray()
+ array([[1]])
+ >>> A.setdiag(A.diagonal() * 2)
+ >>> A.toarray()
+ array([[2]])
+
+ Examples
+ --------
+
+ Basic usage:
+
+ >>> G = nx.path_graph(4)
+ >>> A = nx.to_scipy_sparse_array(G)
+ >>> A # doctest: +SKIP
+
+
+ >>> A.toarray()
+ array([[0, 1, 0, 0],
+ [1, 0, 1, 0],
+ [0, 1, 0, 1],
+ [0, 0, 1, 0]])
+
+ .. note:: The `toarray` method is used in these examples to better visualize
+ the adjacancy matrix. For a dense representation of the adjaceny matrix,
+ use `to_numpy_array` instead.
+
+ Directed graphs:
+
+ >>> G = nx.DiGraph([(0, 1), (1, 2), (2, 3)])
+ >>> nx.to_scipy_sparse_array(G).toarray()
+ array([[0, 1, 0, 0],
+ [0, 0, 1, 0],
+ [0, 0, 0, 1],
+ [0, 0, 0, 0]])
+
+ >>> H = G.reverse()
+ >>> H.edges
+ OutEdgeView([(1, 0), (2, 1), (3, 2)])
+ >>> nx.to_scipy_sparse_array(H).toarray()
+ array([[0, 0, 0, 0],
+ [1, 0, 0, 0],
+ [0, 1, 0, 0],
+ [0, 0, 1, 0]])
+
+ By default, the order of the rows/columns of the adjacency matrix is determined
+ by the ordering of the nodes in `G`:
+
+ >>> G = nx.Graph()
+ >>> G.add_nodes_from([3, 5, 0, 1])
+ >>> G.add_edges_from([(1, 3), (1, 5)])
+ >>> nx.to_scipy_sparse_array(G).toarray()
+ array([[0, 0, 0, 1],
+ [0, 0, 0, 1],
+ [0, 0, 0, 0],
+ [1, 1, 0, 0]])
+
+ The ordering of the rows can be changed with `nodelist`:
+
+ >>> ordered = [0, 1, 3, 5]
+ >>> nx.to_scipy_sparse_array(G, nodelist=ordered).toarray()
+ array([[0, 0, 0, 0],
+ [0, 0, 1, 1],
+ [0, 1, 0, 0],
+ [0, 1, 0, 0]])
+
+ If `nodelist` contains a subset of the nodes in `G`, the adjacency matrix
+ for the node-induced subgraph is produced:
+
+ >>> nx.to_scipy_sparse_array(G, nodelist=[1, 3, 5]).toarray()
+ array([[0, 1, 1],
+ [1, 0, 0],
+ [1, 0, 0]])
+
+ The values of the adjacency matrix are drawn from the edge attribute
+ specified by the `weight` parameter:
+
+ >>> G = nx.path_graph(4)
+ >>> nx.set_edge_attributes(
+ ... G, values={(0, 1): 1, (1, 2): 10, (2, 3): 2}, name="weight"
+ ... )
+ >>> nx.set_edge_attributes(
+ ... G, values={(0, 1): 50, (1, 2): 35, (2, 3): 10}, name="capacity"
+ ... )
+ >>> nx.to_scipy_sparse_array(G).toarray() # Default weight="weight"
+ array([[ 0, 1, 0, 0],
+ [ 1, 0, 10, 0],
+ [ 0, 10, 0, 2],
+ [ 0, 0, 2, 0]])
+ >>> nx.to_scipy_sparse_array(G, weight="capacity").toarray()
+ array([[ 0, 50, 0, 0],
+ [50, 0, 35, 0],
+ [ 0, 35, 0, 10],
+ [ 0, 0, 10, 0]])
+
+ Any edges that don't have a `weight` attribute default to 1:
+
+ >>> G[1][2].pop("capacity")
+ 35
+ >>> nx.to_scipy_sparse_array(G, weight="capacity").toarray()
+ array([[ 0, 50, 0, 0],
+ [50, 0, 1, 0],
+ [ 0, 1, 0, 10],
+ [ 0, 0, 10, 0]])
+
+ When `G` is a multigraph, the values in the adjacency matrix are given by
+ the sum of the `weight` edge attribute over each edge key:
+
+ >>> G = nx.MultiDiGraph([(0, 1), (0, 1), (0, 1), (2, 0)])
+ >>> nx.to_scipy_sparse_array(G).toarray()
+ array([[0, 3, 0],
+ [0, 0, 0],
+ [1, 0, 0]])
+
+ References
+ ----------
+ .. [1] Scipy Dev. References, "Sparse Arrays",
+ https://docs.scipy.org/doc/scipy/reference/sparse.html
+ """
+ import scipy as sp
+
+ if len(G) == 0:
+ raise nx.NetworkXError("Graph has no nodes or edges")
+
+ if nodelist is None:
+ nodelist = list(G)
+ nlen = len(G)
+ else:
+ nlen = len(nodelist)
+ if nlen == 0:
+ raise nx.NetworkXError("nodelist has no nodes")
+ nodeset = set(G.nbunch_iter(nodelist))
+ if nlen != len(nodeset):
+ for n in nodelist:
+ if n not in G:
+ raise nx.NetworkXError(f"Node {n} in nodelist is not in G")
+ raise nx.NetworkXError("nodelist contains duplicates.")
+ if nlen < len(G):
+ G = G.subgraph(nodelist)
+
+ index = dict(zip(nodelist, range(nlen)))
+ coefficients = zip(
+ *((index[u], index[v], wt) for u, v, wt in G.edges(data=weight, default=1))
+ )
+ try:
+ row, col, data = coefficients
+ except ValueError:
+ # there is no edge in the subgraph
+ row, col, data = [], [], []
+
+ if G.is_directed():
+ A = sp.sparse.coo_array((data, (row, col)), shape=(nlen, nlen), dtype=dtype)
+ else:
+ # symmetrize matrix
+ d = data + data
+ r = row + col
+ c = col + row
+ # selfloop entries get double counted when symmetrizing
+ # so we subtract the data on the diagonal
+ selfloops = list(nx.selfloop_edges(G, data=weight, default=1))
+ if selfloops:
+ diag_index, diag_data = zip(*((index[u], -wt) for u, v, wt in selfloops))
+ d += diag_data
+ r += diag_index
+ c += diag_index
+ A = sp.sparse.coo_array((d, (r, c)), shape=(nlen, nlen), dtype=dtype)
+ try:
+ return A.asformat(format)
+ except ValueError as err:
+ raise nx.NetworkXError(f"Unknown sparse matrix format: {format}") from err
+
+
+def _csr_gen_triples(A):
+ """Converts a SciPy sparse array in **Compressed Sparse Row** format to
+ an iterable of weighted edge triples.
+
+ """
+ nrows = A.shape[0]
+ indptr, dst_indices, data = A.indptr, A.indices, A.data
+ import numpy as np
+
+ src_indices = np.repeat(np.arange(nrows), np.diff(indptr))
+ return zip(src_indices.tolist(), dst_indices.tolist(), A.data.tolist())
+
+
+def _csc_gen_triples(A):
+ """Converts a SciPy sparse array in **Compressed Sparse Column** format to
+ an iterable of weighted edge triples.
+
+ """
+ ncols = A.shape[1]
+ indptr, src_indices, data = A.indptr, A.indices, A.data
+ import numpy as np
+
+ dst_indices = np.repeat(np.arange(ncols), np.diff(indptr))
+ return zip(src_indices.tolist(), dst_indices.tolist(), A.data.tolist())
+
+
+def _coo_gen_triples(A):
+ """Converts a SciPy sparse array in **Coordinate** format to an iterable
+ of weighted edge triples.
+
+ """
+ return zip(A.row.tolist(), A.col.tolist(), A.data.tolist())
+
+
+def _dok_gen_triples(A):
+ """Converts a SciPy sparse array in **Dictionary of Keys** format to an
+ iterable of weighted edge triples.
+
+ """
+ for (r, c), v in A.items():
+ # Use `v.item()` to convert a NumPy scalar to the appropriate Python scalar
+ yield int(r), int(c), v.item()
+
+
+def _generate_weighted_edges(A):
+ """Returns an iterable over (u, v, w) triples, where u and v are adjacent
+ vertices and w is the weight of the edge joining u and v.
+
+ `A` is a SciPy sparse array (in any format).
+
+ """
+ if A.format == "csr":
+ return _csr_gen_triples(A)
+ if A.format == "csc":
+ return _csc_gen_triples(A)
+ if A.format == "dok":
+ return _dok_gen_triples(A)
+ # If A is in any other format (including COO), convert it to COO format.
+ return _coo_gen_triples(A.tocoo())
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_scipy_sparse_array(
+ A, parallel_edges=False, create_using=None, edge_attribute="weight"
+):
+ """Creates a new graph from an adjacency matrix given as a SciPy sparse
+ array.
+
+ Parameters
+ ----------
+ A: scipy.sparse array
+ An adjacency matrix representation of a graph
+
+ parallel_edges : Boolean
+ If this is True, `create_using` is a multigraph, and `A` is an
+ integer matrix, then entry *(i, j)* in the matrix is interpreted as the
+ number of parallel edges joining vertices *i* and *j* in the graph.
+ If it is False, then the entries in the matrix are interpreted as
+ the weight of a single edge joining the vertices.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ edge_attribute: string
+ Name of edge attribute to store matrix numeric value. The data will
+ have the same type as the matrix entry (int, float, (real,imag)).
+
+ Notes
+ -----
+ For directed graphs, explicitly mention create_using=nx.DiGraph,
+ and entry i,j of A corresponds to an edge from i to j.
+
+ If `create_using` is :class:`networkx.MultiGraph` or
+ :class:`networkx.MultiDiGraph`, `parallel_edges` is True, and the
+ entries of `A` are of type :class:`int`, then this function returns a
+ multigraph (constructed from `create_using`) with parallel edges.
+ In this case, `edge_attribute` will be ignored.
+
+ If `create_using` indicates an undirected multigraph, then only the edges
+ indicated by the upper triangle of the matrix `A` will be added to the
+ graph.
+
+ Examples
+ --------
+ >>> import scipy as sp
+ >>> A = sp.sparse.eye(2, 2, 1)
+ >>> G = nx.from_scipy_sparse_array(A)
+
+ If `create_using` indicates a multigraph and the matrix has only integer
+ entries and `parallel_edges` is False, then the entries will be treated
+ as weights for edges joining the nodes (without creating parallel edges):
+
+ >>> A = sp.sparse.csr_array([[1, 1], [1, 2]])
+ >>> G = nx.from_scipy_sparse_array(A, create_using=nx.MultiGraph)
+ >>> G[1][1]
+ AtlasView({0: {'weight': 2}})
+
+ If `create_using` indicates a multigraph and the matrix has only integer
+ entries and `parallel_edges` is True, then the entries will be treated
+ as the number of parallel edges joining those two vertices:
+
+ >>> A = sp.sparse.csr_array([[1, 1], [1, 2]])
+ >>> G = nx.from_scipy_sparse_array(
+ ... A, parallel_edges=True, create_using=nx.MultiGraph
+ ... )
+ >>> G[1][1]
+ AtlasView({0: {'weight': 1}, 1: {'weight': 1}})
+
+ """
+ G = nx.empty_graph(0, create_using)
+ n, m = A.shape
+ if n != m:
+ raise nx.NetworkXError(f"Adjacency matrix not square: nx,ny={A.shape}")
+ # Make sure we get even the isolated nodes of the graph.
+ G.add_nodes_from(range(n))
+ # Create an iterable over (u, v, w) triples and for each triple, add an
+ # edge from u to v with weight w.
+ triples = _generate_weighted_edges(A)
+ # If the entries in the adjacency matrix are integers, the graph is a
+ # multigraph, and parallel_edges is True, then create parallel edges, each
+ # with weight 1, for each entry in the adjacency matrix. Otherwise, create
+ # one edge for each positive entry in the adjacency matrix and set the
+ # weight of that edge to be the entry in the matrix.
+ if A.dtype.kind in ("i", "u") and G.is_multigraph() and parallel_edges:
+ chain = itertools.chain.from_iterable
+ # The following line is equivalent to:
+ #
+ # for (u, v) in edges:
+ # for d in range(A[u, v]):
+ # G.add_edge(u, v, weight=1)
+ #
+ triples = chain(((u, v, 1) for d in range(w)) for (u, v, w) in triples)
+ # If we are creating an undirected multigraph, only add the edges from the
+ # upper triangle of the matrix. Otherwise, add all the edges. This relies
+ # on the fact that the vertices created in the
+ # `_generated_weighted_edges()` function are actually the row/column
+ # indices for the matrix `A`.
+ #
+ # Without this check, we run into a problem where each edge is added twice
+ # when `G.add_weighted_edges_from()` is invoked below.
+ if G.is_multigraph() and not G.is_directed():
+ triples = ((u, v, d) for u, v, d in triples if u <= v)
+ G.add_weighted_edges_from(triples, weight=edge_attribute)
+ return G
+
+
+@nx._dispatchable(edge_attrs="weight") # edge attrs may also be obtained from `dtype`
+def to_numpy_array(
+ G,
+ nodelist=None,
+ dtype=None,
+ order=None,
+ multigraph_weight=sum,
+ weight="weight",
+ nonedge=0.0,
+):
+ """Returns the graph adjacency matrix as a NumPy array.
+
+ Parameters
+ ----------
+ G : graph
+ The NetworkX graph used to construct the NumPy array.
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in `nodelist`.
+ If `nodelist` is ``None``, then the ordering is produced by ``G.nodes()``.
+
+ dtype : NumPy data type, optional
+ A NumPy data type used to initialize the array. If None, then the NumPy
+ default is used. The dtype can be structured if `weight=None`, in which
+ case the dtype field names are used to look up edge attributes. The
+ result is a structured array where each named field in the dtype
+ corresponds to the adjacency for that edge attribute. See examples for
+ details.
+
+ order : {'C', 'F'}, optional
+ Whether to store multidimensional data in C- or Fortran-contiguous
+ (row- or column-wise) order in memory. If None, then the NumPy default
+ is used.
+
+ multigraph_weight : callable, optional
+ An function that determines how weights in multigraphs are handled.
+ The function should accept a sequence of weights and return a single
+ value. The default is to sum the weights of the multiple edges.
+
+ weight : string or None optional (default = 'weight')
+ The edge attribute that holds the numerical value used for
+ the edge weight. If an edge does not have that attribute, then the
+ value 1 is used instead. `weight` must be ``None`` if a structured
+ dtype is used.
+
+ nonedge : array_like (default = 0.0)
+ The value used to represent non-edges in the adjacency matrix.
+ The array values corresponding to nonedges are typically set to zero.
+ However, this could be undesirable if there are array values
+ corresponding to actual edges that also have the value zero. If so,
+ one might prefer nonedges to have some other value, such as ``nan``.
+
+ Returns
+ -------
+ A : NumPy ndarray
+ Graph adjacency matrix
+
+ Raises
+ ------
+ NetworkXError
+ If `dtype` is a structured dtype and `G` is a multigraph
+ ValueError
+ If `dtype` is a structured dtype and `weight` is not `None`
+
+ See Also
+ --------
+ from_numpy_array
+
+ Notes
+ -----
+ For directed graphs, entry ``i, j`` corresponds to an edge from ``i`` to ``j``.
+
+ Entries in the adjacency matrix are given by the `weight` edge attribute.
+ When an edge does not have a weight attribute, the value of the entry is
+ set to the number 1. For multiple (parallel) edges, the values of the
+ entries are determined by the `multigraph_weight` parameter. The default is
+ to sum the weight attributes for each of the parallel edges.
+
+ When `nodelist` does not contain every node in `G`, the adjacency matrix is
+ built from the subgraph of `G` that is induced by the nodes in `nodelist`.
+
+ The convention used for self-loop edges in graphs is to assign the
+ diagonal array entry value to the weight attribute of the edge
+ (or the number 1 if the edge has no weight attribute). If the
+ alternate convention of doubling the edge weight is desired the
+ resulting NumPy array can be modified as follows:
+
+ >>> import numpy as np
+ >>> G = nx.Graph([(1, 1)])
+ >>> A = nx.to_numpy_array(G)
+ >>> A
+ array([[1.]])
+ >>> A[np.diag_indices_from(A)] *= 2
+ >>> A
+ array([[2.]])
+
+ Examples
+ --------
+ >>> G = nx.MultiDiGraph()
+ >>> G.add_edge(0, 1, weight=2)
+ 0
+ >>> G.add_edge(1, 0)
+ 0
+ >>> G.add_edge(2, 2, weight=3)
+ 0
+ >>> G.add_edge(2, 2)
+ 1
+ >>> nx.to_numpy_array(G, nodelist=[0, 1, 2])
+ array([[0., 2., 0.],
+ [1., 0., 0.],
+ [0., 0., 4.]])
+
+ When `nodelist` argument is used, nodes of `G` which do not appear in the `nodelist`
+ and their edges are not included in the adjacency matrix. Here is an example:
+
+ >>> G = nx.Graph()
+ >>> G.add_edge(3, 1)
+ >>> G.add_edge(2, 0)
+ >>> G.add_edge(2, 1)
+ >>> G.add_edge(3, 0)
+ >>> nx.to_numpy_array(G, nodelist=[1, 2, 3])
+ array([[0., 1., 1.],
+ [1., 0., 0.],
+ [1., 0., 0.]])
+
+ This function can also be used to create adjacency matrices for multiple
+ edge attributes with structured dtypes:
+
+ >>> G = nx.Graph()
+ >>> G.add_edge(0, 1, weight=10)
+ >>> G.add_edge(1, 2, cost=5)
+ >>> G.add_edge(2, 3, weight=3, cost=-4.0)
+ >>> dtype = np.dtype([("weight", int), ("cost", float)])
+ >>> A = nx.to_numpy_array(G, dtype=dtype, weight=None)
+ >>> A["weight"]
+ array([[ 0, 10, 0, 0],
+ [10, 0, 1, 0],
+ [ 0, 1, 0, 3],
+ [ 0, 0, 3, 0]])
+ >>> A["cost"]
+ array([[ 0., 1., 0., 0.],
+ [ 1., 0., 5., 0.],
+ [ 0., 5., 0., -4.],
+ [ 0., 0., -4., 0.]])
+
+ As stated above, the argument "nonedge" is useful especially when there are
+ actually edges with weight 0 in the graph. Setting a nonedge value different than 0,
+ makes it much clearer to differentiate such 0-weighted edges and actual nonedge values.
+
+ >>> G = nx.Graph()
+ >>> G.add_edge(3, 1, weight=2)
+ >>> G.add_edge(2, 0, weight=0)
+ >>> G.add_edge(2, 1, weight=0)
+ >>> G.add_edge(3, 0, weight=1)
+ >>> nx.to_numpy_array(G, nonedge=-1.0)
+ array([[-1., 2., -1., 1.],
+ [ 2., -1., 0., -1.],
+ [-1., 0., -1., 0.],
+ [ 1., -1., 0., -1.]])
+ """
+ import numpy as np
+
+ if nodelist is None:
+ nodelist = list(G)
+ nlen = len(nodelist)
+
+ # Input validation
+ nodeset = set(nodelist)
+ if nodeset - set(G):
+ raise nx.NetworkXError(f"Nodes {nodeset - set(G)} in nodelist is not in G")
+ if len(nodeset) < nlen:
+ raise nx.NetworkXError("nodelist contains duplicates.")
+
+ A = np.full((nlen, nlen), fill_value=nonedge, dtype=dtype, order=order)
+
+ # Corner cases: empty nodelist or graph without any edges
+ if nlen == 0 or G.number_of_edges() == 0:
+ return A
+
+ # If dtype is structured and weight is None, use dtype field names as
+ # edge attributes
+ edge_attrs = None # Only single edge attribute by default
+ if A.dtype.names:
+ if weight is None:
+ edge_attrs = dtype.names
+ else:
+ raise ValueError(
+ "Specifying `weight` not supported for structured dtypes\n."
+ "To create adjacency matrices from structured dtypes, use `weight=None`."
+ )
+
+ # Map nodes to row/col in matrix
+ idx = dict(zip(nodelist, range(nlen)))
+ if len(nodelist) < len(G):
+ G = G.subgraph(nodelist).copy()
+
+ # Collect all edge weights and reduce with `multigraph_weights`
+ if G.is_multigraph():
+ if edge_attrs:
+ raise nx.NetworkXError(
+ "Structured arrays are not supported for MultiGraphs"
+ )
+ d = defaultdict(list)
+ for u, v, wt in G.edges(data=weight, default=1.0):
+ d[(idx[u], idx[v])].append(wt)
+ i, j = np.array(list(d.keys())).T # indices
+ wts = [multigraph_weight(ws) for ws in d.values()] # reduced weights
+ else:
+ i, j, wts = [], [], []
+
+ # Special branch: multi-attr adjacency from structured dtypes
+ if edge_attrs:
+ # Extract edges with all data
+ for u, v, data in G.edges(data=True):
+ i.append(idx[u])
+ j.append(idx[v])
+ wts.append(data)
+ # Map each attribute to the appropriate named field in the
+ # structured dtype
+ for attr in edge_attrs:
+ attr_data = [wt.get(attr, 1.0) for wt in wts]
+ A[attr][i, j] = attr_data
+ if not G.is_directed():
+ A[attr][j, i] = attr_data
+ return A
+
+ for u, v, wt in G.edges(data=weight, default=1.0):
+ i.append(idx[u])
+ j.append(idx[v])
+ wts.append(wt)
+
+ # Set array values with advanced indexing
+ A[i, j] = wts
+ if not G.is_directed():
+ A[j, i] = wts
+
+ return A
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_numpy_array(
+ A, parallel_edges=False, create_using=None, edge_attr="weight", *, nodelist=None
+):
+ """Returns a graph from a 2D NumPy array.
+
+ The 2D NumPy array is interpreted as an adjacency matrix for the graph.
+
+ Parameters
+ ----------
+ A : a 2D numpy.ndarray
+ An adjacency matrix representation of a graph
+
+ parallel_edges : Boolean
+ If this is True, `create_using` is a multigraph, and `A` is an
+ integer array, then entry *(i, j)* in the array is interpreted as the
+ number of parallel edges joining vertices *i* and *j* in the graph.
+ If it is False, then the entries in the array are interpreted as
+ the weight of a single edge joining the vertices.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ edge_attr : String, optional (default="weight")
+ The attribute to which the array values are assigned on each edge. If
+ it is None, edge attributes will not be assigned.
+
+ nodelist : sequence of nodes, optional
+ A sequence of objects to use as the nodes in the graph. If provided, the
+ list of nodes must be the same length as the dimensions of `A`. The
+ default is `None`, in which case the nodes are drawn from ``range(n)``.
+
+ Notes
+ -----
+ For directed graphs, explicitly mention create_using=nx.DiGraph,
+ and entry i,j of A corresponds to an edge from i to j.
+
+ If `create_using` is :class:`networkx.MultiGraph` or
+ :class:`networkx.MultiDiGraph`, `parallel_edges` is True, and the
+ entries of `A` are of type :class:`int`, then this function returns a
+ multigraph (of the same type as `create_using`) with parallel edges.
+
+ If `create_using` indicates an undirected multigraph, then only the edges
+ indicated by the upper triangle of the array `A` will be added to the
+ graph.
+
+ If `edge_attr` is Falsy (False or None), edge attributes will not be
+ assigned, and the array data will be treated like a binary mask of
+ edge presence or absence. Otherwise, the attributes will be assigned
+ as follows:
+
+ If the NumPy array has a single data type for each array entry it
+ will be converted to an appropriate Python data type.
+
+ If the NumPy array has a user-specified compound data type the names
+ of the data fields will be used as attribute keys in the resulting
+ NetworkX graph.
+
+ See Also
+ --------
+ to_numpy_array
+
+ Examples
+ --------
+ Simple integer weights on edges:
+
+ >>> import numpy as np
+ >>> A = np.array([[1, 1], [2, 1]])
+ >>> G = nx.from_numpy_array(A)
+ >>> G.edges(data=True)
+ EdgeDataView([(0, 0, {'weight': 1}), (0, 1, {'weight': 2}), (1, 1, {'weight': 1})])
+
+ If `create_using` indicates a multigraph and the array has only integer
+ entries and `parallel_edges` is False, then the entries will be treated
+ as weights for edges joining the nodes (without creating parallel edges):
+
+ >>> A = np.array([[1, 1], [1, 2]])
+ >>> G = nx.from_numpy_array(A, create_using=nx.MultiGraph)
+ >>> G[1][1]
+ AtlasView({0: {'weight': 2}})
+
+ If `create_using` indicates a multigraph and the array has only integer
+ entries and `parallel_edges` is True, then the entries will be treated
+ as the number of parallel edges joining those two vertices:
+
+ >>> A = np.array([[1, 1], [1, 2]])
+ >>> temp = nx.MultiGraph()
+ >>> G = nx.from_numpy_array(A, parallel_edges=True, create_using=temp)
+ >>> G[1][1]
+ AtlasView({0: {'weight': 1}, 1: {'weight': 1}})
+
+ User defined compound data type on edges:
+
+ >>> dt = [("weight", float), ("cost", int)]
+ >>> A = np.array([[(1.0, 2)]], dtype=dt)
+ >>> G = nx.from_numpy_array(A)
+ >>> G.edges()
+ EdgeView([(0, 0)])
+ >>> G[0][0]["cost"]
+ 2
+ >>> G[0][0]["weight"]
+ 1.0
+
+ """
+ kind_to_python_type = {
+ "f": float,
+ "i": int,
+ "u": int,
+ "b": bool,
+ "c": complex,
+ "S": str,
+ "U": str,
+ "V": "void",
+ }
+ G = nx.empty_graph(0, create_using)
+ if A.ndim != 2:
+ raise nx.NetworkXError(f"Input array must be 2D, not {A.ndim}")
+ n, m = A.shape
+ if n != m:
+ raise nx.NetworkXError(f"Adjacency matrix not square: nx,ny={A.shape}")
+ dt = A.dtype
+ try:
+ python_type = kind_to_python_type[dt.kind]
+ except Exception as err:
+ raise TypeError(f"Unknown numpy data type: {dt}") from err
+ if _default_nodes := (nodelist is None):
+ nodelist = range(n)
+ else:
+ if len(nodelist) != n:
+ raise ValueError("nodelist must have the same length as A.shape[0]")
+
+ # Make sure we get even the isolated nodes of the graph.
+ G.add_nodes_from(nodelist)
+ # Get a list of all the entries in the array with nonzero entries. These
+ # coordinates become edges in the graph. (convert to int from np.int64)
+ edges = ((int(e[0]), int(e[1])) for e in zip(*A.nonzero()))
+ # handle numpy constructed data type
+ if python_type == "void":
+ # Sort the fields by their offset, then by dtype, then by name.
+ fields = sorted(
+ (offset, dtype, name) for name, (dtype, offset) in A.dtype.fields.items()
+ )
+ triples = (
+ (
+ u,
+ v,
+ {}
+ if edge_attr in [False, None]
+ else {
+ name: kind_to_python_type[dtype.kind](val)
+ for (_, dtype, name), val in zip(fields, A[u, v])
+ },
+ )
+ for u, v in edges
+ )
+ # If the entries in the adjacency matrix are integers, the graph is a
+ # multigraph, and parallel_edges is True, then create parallel edges, each
+ # with weight 1, for each entry in the adjacency matrix. Otherwise, create
+ # one edge for each positive entry in the adjacency matrix and set the
+ # weight of that edge to be the entry in the matrix.
+ elif python_type is int and G.is_multigraph() and parallel_edges:
+ chain = itertools.chain.from_iterable
+ # The following line is equivalent to:
+ #
+ # for (u, v) in edges:
+ # for d in range(A[u, v]):
+ # G.add_edge(u, v, weight=1)
+ #
+ if edge_attr in [False, None]:
+ triples = chain(((u, v, {}) for d in range(A[u, v])) for (u, v) in edges)
+ else:
+ triples = chain(
+ ((u, v, {edge_attr: 1}) for d in range(A[u, v])) for (u, v) in edges
+ )
+ else: # basic data type
+ if edge_attr in [False, None]:
+ triples = ((u, v, {}) for u, v in edges)
+ else:
+ triples = ((u, v, {edge_attr: python_type(A[u, v])}) for u, v in edges)
+ # If we are creating an undirected multigraph, only add the edges from the
+ # upper triangle of the matrix. Otherwise, add all the edges. This relies
+ # on the fact that the vertices created in the
+ # `_generated_weighted_edges()` function are actually the row/column
+ # indices for the matrix `A`.
+ #
+ # Without this check, we run into a problem where each edge is added twice
+ # when `G.add_edges_from()` is invoked below.
+ if G.is_multigraph() and not G.is_directed():
+ triples = ((u, v, d) for u, v, d in triples if u <= v)
+ # Remap nodes if user provided custom `nodelist`
+ if not _default_nodes:
+ idx_to_node = dict(enumerate(nodelist))
+ triples = ((idx_to_node[u], idx_to_node[v], d) for u, v, d in triples)
+ G.add_edges_from(triples)
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/exception.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/exception.py
new file mode 100644
index 0000000000000000000000000000000000000000..c960cf13fd5a8e4da0ca68c66350b8baa1728c34
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/exception.py
@@ -0,0 +1,131 @@
+"""
+**********
+Exceptions
+**********
+
+Base exceptions and errors for NetworkX.
+"""
+
+__all__ = [
+ "HasACycle",
+ "NodeNotFound",
+ "PowerIterationFailedConvergence",
+ "ExceededMaxIterations",
+ "AmbiguousSolution",
+ "NetworkXAlgorithmError",
+ "NetworkXException",
+ "NetworkXError",
+ "NetworkXNoCycle",
+ "NetworkXNoPath",
+ "NetworkXNotImplemented",
+ "NetworkXPointlessConcept",
+ "NetworkXUnbounded",
+ "NetworkXUnfeasible",
+]
+
+
+class NetworkXException(Exception):
+ """Base class for exceptions in NetworkX."""
+
+
+class NetworkXError(NetworkXException):
+ """Exception for a serious error in NetworkX"""
+
+
+class NetworkXPointlessConcept(NetworkXException):
+ """Raised when a null graph is provided as input to an algorithm
+ that cannot use it.
+
+ The null graph is sometimes considered a pointless concept [1]_,
+ thus the name of the exception.
+
+ Notes
+ -----
+ Null graphs and empty graphs are often used interchangeably but they
+ are well defined in NetworkX. An ``empty_graph`` is a graph with ``n`` nodes
+ and 0 edges, and a ``null_graph`` is a graph with 0 nodes and 0 edges.
+
+ References
+ ----------
+ .. [1] Harary, F. and Read, R. "Is the Null Graph a Pointless
+ Concept?" In Graphs and Combinatorics Conference, George
+ Washington University. New York: Springer-Verlag, 1973.
+
+ """
+
+
+class NetworkXAlgorithmError(NetworkXException):
+ """Exception for unexpected termination of algorithms."""
+
+
+class NetworkXUnfeasible(NetworkXAlgorithmError):
+ """Exception raised by algorithms trying to solve a problem
+ instance that has no feasible solution."""
+
+
+class NetworkXNoPath(NetworkXUnfeasible):
+ """Exception for algorithms that should return a path when running
+ on graphs where such a path does not exist."""
+
+
+class NetworkXNoCycle(NetworkXUnfeasible):
+ """Exception for algorithms that should return a cycle when running
+ on graphs where such a cycle does not exist."""
+
+
+class HasACycle(NetworkXException):
+ """Raised if a graph has a cycle when an algorithm expects that it
+ will have no cycles.
+
+ """
+
+
+class NetworkXUnbounded(NetworkXAlgorithmError):
+ """Exception raised by algorithms trying to solve a maximization
+ or a minimization problem instance that is unbounded."""
+
+
+class NetworkXNotImplemented(NetworkXException):
+ """Exception raised by algorithms not implemented for a type of graph."""
+
+
+class NodeNotFound(NetworkXException):
+ """Exception raised if requested node is not present in the graph"""
+
+
+class AmbiguousSolution(NetworkXException):
+ """Raised if more than one valid solution exists for an intermediary step
+ of an algorithm.
+
+ In the face of ambiguity, refuse the temptation to guess.
+ This may occur, for example, when trying to determine the
+ bipartite node sets in a disconnected bipartite graph when
+ computing bipartite matchings.
+
+ """
+
+
+class ExceededMaxIterations(NetworkXException):
+ """Raised if a loop iterates too many times without breaking.
+
+ This may occur, for example, in an algorithm that computes
+ progressively better approximations to a value but exceeds an
+ iteration bound specified by the user.
+
+ """
+
+
+class PowerIterationFailedConvergence(ExceededMaxIterations):
+ """Raised when the power iteration method fails to converge within a
+ specified iteration limit.
+
+ `num_iterations` is the number of iterations that have been
+ completed when this exception was raised.
+
+ """
+
+ def __init__(self, num_iterations, *args, **kw):
+ msg = f"power iteration failed to converge within {num_iterations} iterations"
+ exception_message = msg
+ superinit = super().__init__
+ superinit(self, exception_message, *args, **kw)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..6ec027c2405b6f9de2e7b6a0f7c18d782ac8761c
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__init__.py
@@ -0,0 +1,34 @@
+"""
+A package for generating various graphs in networkx.
+
+"""
+
+from networkx.generators.atlas import *
+from networkx.generators.classic import *
+from networkx.generators.cographs import *
+from networkx.generators.community import *
+from networkx.generators.degree_seq import *
+from networkx.generators.directed import *
+from networkx.generators.duplication import *
+from networkx.generators.ego import *
+from networkx.generators.expanders import *
+from networkx.generators.geometric import *
+from networkx.generators.harary_graph import *
+from networkx.generators.internet_as_graphs import *
+from networkx.generators.intersection import *
+from networkx.generators.interval_graph import *
+from networkx.generators.joint_degree_seq import *
+from networkx.generators.lattice import *
+from networkx.generators.line import *
+from networkx.generators.mycielski import *
+from networkx.generators.nonisomorphic_trees import *
+from networkx.generators.random_clustered import *
+from networkx.generators.random_graphs import *
+from networkx.generators.small import *
+from networkx.generators.social import *
+from networkx.generators.spectral_graph_forge import *
+from networkx.generators.stochastic import *
+from networkx.generators.sudoku import *
+from networkx.generators.time_series import *
+from networkx.generators.trees import *
+from networkx.generators.triads import *
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/__init__.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..93f6f6db947399042b1545e841bf771ab82e193d
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/__init__.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/atlas.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/atlas.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d133e7ae59ab95d7c040d79566591591da6d463a
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/atlas.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/classic.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/classic.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9e4aba529139c83f42dd62865a8791d5a0a05eb1
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/classic.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/cographs.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/cographs.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3b56a0e611fb17b78a02dd099279ff72c3bcd545
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/cographs.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/community.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/community.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4facedb1188757df15943c27daa9c34e3a361451
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/community.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/degree_seq.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/degree_seq.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..18b7ea74bc321f8b5bc4f8af64dfdaade88df068
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/degree_seq.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/directed.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/directed.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b66449ffb8508db8676126d9844898289e5139b0
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/directed.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/duplication.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/duplication.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9ab820d935b2d873eb8b758af65ac75f6c55cbac
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/duplication.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/ego.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/ego.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3feee8ac4befa94a6bc794bbba375a3e33db068b
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/ego.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/expanders.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/expanders.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c511eff198cc14d1e3dee7be437eeb8aa2708fc7
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/expanders.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/geometric.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/geometric.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e5ddd477e090dd54eaa745ceebdecd519c960473
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/geometric.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/harary_graph.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/harary_graph.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ad32b66cdb9aa246f3f63f4897c009f4b01ce265
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/harary_graph.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/internet_as_graphs.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/internet_as_graphs.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b39be690b5fafbce05b295822a73feabdce480bc
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/internet_as_graphs.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/intersection.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/intersection.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..baaa223a575b3df857693f083c076245fbca7266
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/intersection.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/interval_graph.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/interval_graph.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a90713d5ecdcc0f1190a09aa405ef220c1ede005
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/interval_graph.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/joint_degree_seq.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/joint_degree_seq.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8be89b50ea871ea6dfe083c4dd111a619855c295
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/joint_degree_seq.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/lattice.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/lattice.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..332d4d700e02ba8fa5277b421a859521370444d9
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/lattice.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/line.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/line.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..49b51c09f1138206955cee9d6993d393f6f65395
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/line.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/mycielski.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/mycielski.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6cfbe9ee82ac621a04b7042447b48c206d4991c3
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/mycielski.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/nonisomorphic_trees.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/nonisomorphic_trees.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..757686c15a58268dcc7504da854f7ac919851c92
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/nonisomorphic_trees.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/random_clustered.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/random_clustered.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f5de4ec4cf43d0bb3e14c9cda1834faa00e8bfd3
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/random_clustered.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/random_graphs.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/random_graphs.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4efbb4e9defe79279ea6aaf408595e26a620d0cf
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/random_graphs.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/small.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/small.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7b5cc3489c1dbd1abdaa59d90287cc4d7727ae92
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/small.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/social.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/social.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..985bfa15919e636ef10f6d6c5f03f19851379272
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/social.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/spectral_graph_forge.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/spectral_graph_forge.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8f4f71e6f3c4a0fcd62029c5b0c96252bef9c6ba
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/spectral_graph_forge.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/stochastic.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/stochastic.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b000dc13d7f08323ac70820c5f0a5210df4644f7
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/stochastic.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/sudoku.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/sudoku.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a9fd0cdf5be3976114ae19c47a761f69b73e0a56
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/sudoku.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/time_series.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/time_series.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..169b51eb9548dcd95c9da7ee90cc4110410ddf0b
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/time_series.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/trees.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/trees.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3b36c3f2cbe2a50232634fb52d2ebc1117f8063e
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/trees.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/triads.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/triads.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5c49be3eba8174db8ae7b020d075eabc5312d174
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/__pycache__/triads.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/atlas.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/atlas.py
new file mode 100644
index 0000000000000000000000000000000000000000..c5dd8d2d8fee8cf7b49525fb05bbda14ab75305e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/atlas.py
@@ -0,0 +1,180 @@
+"""
+Generators for the small graph atlas.
+"""
+
+import gzip
+import importlib.resources
+import os
+import os.path
+from itertools import islice
+
+import networkx as nx
+
+__all__ = ["graph_atlas", "graph_atlas_g"]
+
+#: The total number of graphs in the atlas.
+#:
+#: The graphs are labeled starting from 0 and extending to (but not
+#: including) this number.
+NUM_GRAPHS = 1253
+
+#: The path to the data file containing the graph edge lists.
+#:
+#: This is the absolute path of the gzipped text file containing the
+#: edge list for each graph in the atlas. The file contains one entry
+#: per graph in the atlas, in sequential order, starting from graph
+#: number 0 and extending through graph number 1252 (see
+#: :data:`NUM_GRAPHS`). Each entry looks like
+#:
+#: .. sourcecode:: text
+#:
+#: GRAPH 6
+#: NODES 3
+#: 0 1
+#: 0 2
+#:
+#: where the first two lines are the graph's index in the atlas and the
+#: number of nodes in the graph, and the remaining lines are the edge
+#: list.
+#:
+#: This file was generated from a Python list of graphs via code like
+#: the following::
+#:
+#: import gzip
+#: from networkx.generators.atlas import graph_atlas_g
+#: from networkx.readwrite.edgelist import write_edgelist
+#:
+#: with gzip.open('atlas.dat.gz', 'wb') as f:
+#: for i, G in enumerate(graph_atlas_g()):
+#: f.write(bytes(f'GRAPH {i}\n', encoding='utf-8'))
+#: f.write(bytes(f'NODES {len(G)}\n', encoding='utf-8'))
+#: write_edgelist(G, f, data=False)
+#:
+
+# Path to the atlas file
+ATLAS_FILE = importlib.resources.files("networkx.generators") / "atlas.dat.gz"
+
+
+def _generate_graphs():
+ """Sequentially read the file containing the edge list data for the
+ graphs in the atlas and generate the graphs one at a time.
+
+ This function reads the file given in :data:`.ATLAS_FILE`.
+
+ """
+ with gzip.open(ATLAS_FILE, "rb") as f:
+ line = f.readline()
+ while line and line.startswith(b"GRAPH"):
+ # The first two lines of each entry tell us the index of the
+ # graph in the list and the number of nodes in the graph.
+ # They look like this:
+ #
+ # GRAPH 3
+ # NODES 2
+ #
+ graph_index = int(line[6:].rstrip())
+ line = f.readline()
+ num_nodes = int(line[6:].rstrip())
+ # The remaining lines contain the edge list, until the next
+ # GRAPH line (or until the end of the file).
+ edgelist = []
+ line = f.readline()
+ while line and not line.startswith(b"GRAPH"):
+ edgelist.append(line.rstrip())
+ line = f.readline()
+ G = nx.Graph()
+ G.name = f"G{graph_index}"
+ G.add_nodes_from(range(num_nodes))
+ G.add_edges_from(tuple(map(int, e.split())) for e in edgelist)
+ yield G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def graph_atlas(i):
+ """Returns graph number `i` from the Graph Atlas.
+
+ For more information, see :func:`.graph_atlas_g`.
+
+ Parameters
+ ----------
+ i : int
+ The index of the graph from the atlas to get. The graph at index
+ 0 is assumed to be the null graph.
+
+ Returns
+ -------
+ list
+ A list of :class:`~networkx.Graph` objects, the one at index *i*
+ corresponding to the graph *i* in the Graph Atlas.
+
+ See also
+ --------
+ graph_atlas_g
+
+ Notes
+ -----
+ The time required by this function increases linearly with the
+ argument `i`, since it reads a large file sequentially in order to
+ generate the graph [1]_.
+
+ References
+ ----------
+ .. [1] Ronald C. Read and Robin J. Wilson, *An Atlas of Graphs*.
+ Oxford University Press, 1998.
+
+ """
+ if not (0 <= i < NUM_GRAPHS):
+ raise ValueError(f"index must be between 0 and {NUM_GRAPHS}")
+ return next(islice(_generate_graphs(), i, None))
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def graph_atlas_g():
+ """Returns the list of all graphs with up to seven nodes named in the
+ Graph Atlas.
+
+ The graphs are listed in increasing order by
+
+ 1. number of nodes,
+ 2. number of edges,
+ 3. degree sequence (for example 111223 < 112222),
+ 4. number of automorphisms,
+
+ in that order, with three exceptions as described in the *Notes*
+ section below. This causes the list to correspond with the index of
+ the graphs in the Graph Atlas [atlas]_, with the first graph,
+ ``G[0]``, being the null graph.
+
+ Returns
+ -------
+ list
+ A list of :class:`~networkx.Graph` objects, the one at index *i*
+ corresponding to the graph *i* in the Graph Atlas.
+
+ See also
+ --------
+ graph_atlas
+
+ Notes
+ -----
+ This function may be expensive in both time and space, since it
+ reads a large file sequentially in order to populate the list.
+
+ Although the NetworkX atlas functions match the order of graphs
+ given in the "Atlas of Graphs" book, there are (at least) three
+ errors in the ordering described in the book. The following three
+ pairs of nodes violate the lexicographically nondecreasing sorted
+ degree sequence rule:
+
+ - graphs 55 and 56 with degree sequences 001111 and 000112,
+ - graphs 1007 and 1008 with degree sequences 3333444 and 3333336,
+ - graphs 1012 and 1213 with degree sequences 1244555 and 1244456.
+
+ References
+ ----------
+ .. [atlas] Ronald C. Read and Robin J. Wilson,
+ *An Atlas of Graphs*.
+ Oxford University Press, 1998.
+
+ """
+ return list(_generate_graphs())
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/classic.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/classic.py
new file mode 100644
index 0000000000000000000000000000000000000000..a461e7bd23cd79000b834d3362ea3ca8cde93fb2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/classic.py
@@ -0,0 +1,1068 @@
+"""Generators for some classic graphs.
+
+The typical graph builder function is called as follows:
+
+>>> G = nx.complete_graph(100)
+
+returning the complete graph on n nodes labeled 0, .., 99
+as a simple graph. Except for `empty_graph`, all the functions
+in this module return a Graph class (i.e. a simple, undirected graph).
+
+"""
+
+import itertools
+import numbers
+
+import networkx as nx
+from networkx.classes import Graph
+from networkx.exception import NetworkXError
+from networkx.utils import nodes_or_number, pairwise
+
+__all__ = [
+ "balanced_tree",
+ "barbell_graph",
+ "binomial_tree",
+ "complete_graph",
+ "complete_multipartite_graph",
+ "circular_ladder_graph",
+ "circulant_graph",
+ "cycle_graph",
+ "dorogovtsev_goltsev_mendes_graph",
+ "empty_graph",
+ "full_rary_tree",
+ "kneser_graph",
+ "ladder_graph",
+ "lollipop_graph",
+ "null_graph",
+ "path_graph",
+ "star_graph",
+ "tadpole_graph",
+ "trivial_graph",
+ "turan_graph",
+ "wheel_graph",
+]
+
+
+# -------------------------------------------------------------------
+# Some Classic Graphs
+# -------------------------------------------------------------------
+
+
+def _tree_edges(n, r):
+ if n == 0:
+ return
+ # helper function for trees
+ # yields edges in rooted tree at 0 with n nodes and branching ratio r
+ nodes = iter(range(n))
+ parents = [next(nodes)] # stack of max length r
+ while parents:
+ source = parents.pop(0)
+ for i in range(r):
+ try:
+ target = next(nodes)
+ parents.append(target)
+ yield source, target
+ except StopIteration:
+ break
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def full_rary_tree(r, n, create_using=None):
+ """Creates a full r-ary tree of `n` nodes.
+
+ Sometimes called a k-ary, n-ary, or m-ary tree.
+ "... all non-leaf nodes have exactly r children and all levels
+ are full except for some rightmost position of the bottom level
+ (if a leaf at the bottom level is missing, then so are all of the
+ leaves to its right." [1]_
+
+ .. plot::
+
+ >>> nx.draw(nx.full_rary_tree(2, 10))
+
+ Parameters
+ ----------
+ r : int
+ branching factor of the tree
+ n : int
+ Number of nodes in the tree
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ An r-ary tree with n nodes
+
+ References
+ ----------
+ .. [1] An introduction to data structures and algorithms,
+ James Andrew Storer, Birkhauser Boston 2001, (page 225).
+ """
+ G = empty_graph(n, create_using)
+ G.add_edges_from(_tree_edges(n, r))
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def kneser_graph(n, k):
+ """Returns the Kneser Graph with parameters `n` and `k`.
+
+ The Kneser Graph has nodes that are k-tuples (subsets) of the integers
+ between 0 and ``n-1``. Nodes are adjacent if their corresponding sets are disjoint.
+
+ Parameters
+ ----------
+ n: int
+ Number of integers from which to make node subsets.
+ Subsets are drawn from ``set(range(n))``.
+ k: int
+ Size of the subsets.
+
+ Returns
+ -------
+ G : NetworkX Graph
+
+ Examples
+ --------
+ >>> G = nx.kneser_graph(5, 2)
+ >>> G.number_of_nodes()
+ 10
+ >>> G.number_of_edges()
+ 15
+ >>> nx.is_isomorphic(G, nx.petersen_graph())
+ True
+ """
+ if n <= 0:
+ raise NetworkXError("n should be greater than zero")
+ if k <= 0 or k > n:
+ raise NetworkXError("k should be greater than zero and smaller than n")
+
+ G = nx.Graph()
+ # Create all k-subsets of [0, 1, ..., n-1]
+ subsets = list(itertools.combinations(range(n), k))
+
+ if 2 * k > n:
+ G.add_nodes_from(subsets)
+
+ universe = set(range(n))
+ comb = itertools.combinations # only to make it all fit on one line
+ G.add_edges_from((s, t) for s in subsets for t in comb(universe - set(s), k))
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def balanced_tree(r, h, create_using=None):
+ """Returns the perfectly balanced `r`-ary tree of height `h`.
+
+ .. plot::
+
+ >>> nx.draw(nx.balanced_tree(2, 3))
+
+ Parameters
+ ----------
+ r : int
+ Branching factor of the tree; each node will have `r`
+ children.
+
+ h : int
+ Height of the tree.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : NetworkX graph
+ A balanced `r`-ary tree of height `h`.
+
+ Notes
+ -----
+ This is the rooted tree where all leaves are at distance `h` from
+ the root. The root has degree `r` and all other internal nodes
+ have degree `r + 1`.
+
+ Node labels are integers, starting from zero.
+
+ A balanced tree is also known as a *complete r-ary tree*.
+
+ """
+ # The number of nodes in the balanced tree is `1 + r + ... + r^h`,
+ # which is computed by using the closed-form formula for a geometric
+ # sum with ratio `r`. In the special case that `r` is 1, the number
+ # of nodes is simply `h + 1` (since the tree is actually a path
+ # graph).
+ if r == 1:
+ n = h + 1
+ else:
+ # This must be an integer if both `r` and `h` are integers. If
+ # they are not, we force integer division anyway.
+ n = (1 - r ** (h + 1)) // (1 - r)
+ return full_rary_tree(r, n, create_using=create_using)
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def barbell_graph(m1, m2, create_using=None):
+ """Returns the Barbell Graph: two complete graphs connected by a path.
+
+ .. plot::
+
+ >>> nx.draw(nx.barbell_graph(4, 2))
+
+ Parameters
+ ----------
+ m1 : int
+ Size of the left and right barbells, must be greater than 2.
+
+ m2 : int
+ Length of the path connecting the barbells.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Only undirected Graphs are supported.
+
+ Returns
+ -------
+ G : NetworkX graph
+ A barbell graph.
+
+ Notes
+ -----
+
+
+ Two identical complete graphs $K_{m1}$ form the left and right bells,
+ and are connected by a path $P_{m2}$.
+
+ The `2*m1+m2` nodes are numbered
+ `0, ..., m1-1` for the left barbell,
+ `m1, ..., m1+m2-1` for the path,
+ and `m1+m2, ..., 2*m1+m2-1` for the right barbell.
+
+ The 3 subgraphs are joined via the edges `(m1-1, m1)` and
+ `(m1+m2-1, m1+m2)`. If `m2=0`, this is merely two complete
+ graphs joined together.
+
+ This graph is an extremal example in David Aldous
+ and Jim Fill's e-text on Random Walks on Graphs.
+
+ """
+ if m1 < 2:
+ raise NetworkXError("Invalid graph description, m1 should be >=2")
+ if m2 < 0:
+ raise NetworkXError("Invalid graph description, m2 should be >=0")
+
+ # left barbell
+ G = complete_graph(m1, create_using)
+ if G.is_directed():
+ raise NetworkXError("Directed Graph not supported")
+
+ # connecting path
+ G.add_nodes_from(range(m1, m1 + m2 - 1))
+ if m2 > 1:
+ G.add_edges_from(pairwise(range(m1, m1 + m2)))
+
+ # right barbell
+ G.add_edges_from(
+ (u, v) for u in range(m1 + m2, 2 * m1 + m2) for v in range(u + 1, 2 * m1 + m2)
+ )
+
+ # connect it up
+ G.add_edge(m1 - 1, m1)
+ if m2 > 0:
+ G.add_edge(m1 + m2 - 1, m1 + m2)
+
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def binomial_tree(n, create_using=None):
+ """Returns the Binomial Tree of order n.
+
+ The binomial tree of order 0 consists of a single node. A binomial tree of order k
+ is defined recursively by linking two binomial trees of order k-1: the root of one is
+ the leftmost child of the root of the other.
+
+ .. plot::
+
+ >>> nx.draw(nx.binomial_tree(3))
+
+ Parameters
+ ----------
+ n : int
+ Order of the binomial tree.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : NetworkX graph
+ A binomial tree of $2^n$ nodes and $2^n - 1$ edges.
+
+ """
+ G = nx.empty_graph(1, create_using)
+
+ N = 1
+ for i in range(n):
+ # Use G.edges() to ensure 2-tuples. G.edges is 3-tuple for MultiGraph
+ edges = [(u + N, v + N) for (u, v) in G.edges()]
+ G.add_edges_from(edges)
+ G.add_edge(0, N)
+ N *= 2
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number(0)
+def complete_graph(n, create_using=None):
+ """Return the complete graph `K_n` with n nodes.
+
+ A complete graph on `n` nodes means that all pairs
+ of distinct nodes have an edge connecting them.
+
+ .. plot::
+
+ >>> nx.draw(nx.complete_graph(5))
+
+ Parameters
+ ----------
+ n : int or iterable container of nodes
+ If n is an integer, nodes are from range(n).
+ If n is a container of nodes, those nodes appear in the graph.
+ Warning: n is not checked for duplicates and if present the
+ resulting graph may not be as desired. Make sure you have no duplicates.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Examples
+ --------
+ >>> G = nx.complete_graph(9)
+ >>> len(G)
+ 9
+ >>> G.size()
+ 36
+ >>> G = nx.complete_graph(range(11, 14))
+ >>> list(G.nodes())
+ [11, 12, 13]
+ >>> G = nx.complete_graph(4, nx.DiGraph())
+ >>> G.is_directed()
+ True
+
+ """
+ _, nodes = n
+ G = empty_graph(nodes, create_using)
+ if len(nodes) > 1:
+ if G.is_directed():
+ edges = itertools.permutations(nodes, 2)
+ else:
+ edges = itertools.combinations(nodes, 2)
+ G.add_edges_from(edges)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def circular_ladder_graph(n, create_using=None):
+ """Returns the circular ladder graph $CL_n$ of length n.
+
+ $CL_n$ consists of two concentric n-cycles in which
+ each of the n pairs of concentric nodes are joined by an edge.
+
+ Node labels are the integers 0 to n-1
+
+ .. plot::
+
+ >>> nx.draw(nx.circular_ladder_graph(5))
+
+ """
+ G = ladder_graph(n, create_using)
+ G.add_edge(0, n - 1)
+ G.add_edge(n, 2 * n - 1)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def circulant_graph(n, offsets, create_using=None):
+ r"""Returns the circulant graph $Ci_n(x_1, x_2, ..., x_m)$ with $n$ nodes.
+
+ The circulant graph $Ci_n(x_1, ..., x_m)$ consists of $n$ nodes $0, ..., n-1$
+ such that node $i$ is connected to nodes $(i + x) \mod n$ and $(i - x) \mod n$
+ for all $x$ in $x_1, ..., x_m$. Thus $Ci_n(1)$ is a cycle graph.
+
+ .. plot::
+
+ >>> nx.draw(nx.circulant_graph(10, [1]))
+
+ Parameters
+ ----------
+ n : integer
+ The number of nodes in the graph.
+ offsets : list of integers
+ A list of node offsets, $x_1$ up to $x_m$, as described above.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ NetworkX Graph of type create_using
+
+ Examples
+ --------
+ Many well-known graph families are subfamilies of the circulant graphs;
+ for example, to create the cycle graph on n points, we connect every
+ node to nodes on either side (with offset plus or minus one). For n = 10,
+
+ >>> G = nx.circulant_graph(10, [1])
+ >>> edges = [
+ ... (0, 9),
+ ... (0, 1),
+ ... (1, 2),
+ ... (2, 3),
+ ... (3, 4),
+ ... (4, 5),
+ ... (5, 6),
+ ... (6, 7),
+ ... (7, 8),
+ ... (8, 9),
+ ... ]
+ >>> sorted(edges) == sorted(G.edges())
+ True
+
+ Similarly, we can create the complete graph
+ on 5 points with the set of offsets [1, 2]:
+
+ >>> G = nx.circulant_graph(5, [1, 2])
+ >>> edges = [
+ ... (0, 1),
+ ... (0, 2),
+ ... (0, 3),
+ ... (0, 4),
+ ... (1, 2),
+ ... (1, 3),
+ ... (1, 4),
+ ... (2, 3),
+ ... (2, 4),
+ ... (3, 4),
+ ... ]
+ >>> sorted(edges) == sorted(G.edges())
+ True
+
+ """
+ G = empty_graph(n, create_using)
+ for i in range(n):
+ for j in offsets:
+ G.add_edge(i, (i - j) % n)
+ G.add_edge(i, (i + j) % n)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number(0)
+def cycle_graph(n, create_using=None):
+ """Returns the cycle graph $C_n$ of cyclically connected nodes.
+
+ $C_n$ is a path with its two end-nodes connected.
+
+ .. plot::
+
+ >>> nx.draw(nx.cycle_graph(5))
+
+ Parameters
+ ----------
+ n : int or iterable container of nodes
+ If n is an integer, nodes are from `range(n)`.
+ If n is a container of nodes, those nodes appear in the graph.
+ Warning: n is not checked for duplicates and if present the
+ resulting graph may not be as desired. Make sure you have no duplicates.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Notes
+ -----
+ If create_using is directed, the direction is in increasing order.
+
+ """
+ _, nodes = n
+ G = empty_graph(nodes, create_using)
+ G.add_edges_from(pairwise(nodes, cyclic=True))
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def dorogovtsev_goltsev_mendes_graph(n, create_using=None):
+ """Returns the hierarchically constructed Dorogovtsev--Goltsev--Mendes graph.
+
+ The Dorogovtsev--Goltsev--Mendes [1]_ procedure deterministically produces a
+ scale-free graph with ``3/2 * (3**(n-1) + 1)`` nodes
+ and ``3**n`` edges for a given `n`.
+
+ Note that `n` denotes the number of times the state transition is applied,
+ starting from the base graph with ``n = 0`` (no transitions), as in [2]_.
+ This is different from the parameter ``t = n - 1`` in [1]_.
+
+ .. plot::
+
+ >>> nx.draw(nx.dorogovtsev_goltsev_mendes_graph(3))
+
+ Parameters
+ ----------
+ n : integer
+ The generation number.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. Directed graphs and multigraphs are not supported.
+
+ Returns
+ -------
+ G : NetworkX `Graph`
+
+ Raises
+ ------
+ NetworkXError
+ If `n` is less than zero.
+
+ If `create_using` is a directed graph or multigraph.
+
+ Examples
+ --------
+ >>> G = nx.dorogovtsev_goltsev_mendes_graph(3)
+ >>> G.number_of_nodes()
+ 15
+ >>> G.number_of_edges()
+ 27
+ >>> nx.is_planar(G)
+ True
+
+ References
+ ----------
+ .. [1] S. N. Dorogovtsev, A. V. Goltsev and J. F. F. Mendes,
+ "Pseudofractal scale-free web", Physical Review E 65, 066122, 2002.
+ https://arxiv.org/pdf/cond-mat/0112143.pdf
+ .. [2] Weisstein, Eric W. "Dorogovtsev--Goltsev--Mendes Graph".
+ From MathWorld--A Wolfram Web Resource.
+ https://mathworld.wolfram.com/Dorogovtsev-Goltsev-MendesGraph.html
+ """
+ if n < 0:
+ raise NetworkXError("n must be greater than or equal to 0")
+
+ G = empty_graph(0, create_using)
+ if G.is_directed():
+ raise NetworkXError("directed graph not supported")
+ if G.is_multigraph():
+ raise NetworkXError("multigraph not supported")
+
+ G.add_edge(0, 1)
+ new_node = 2 # next node to be added
+ for _ in range(n): # iterate over number of generations.
+ new_edges = []
+ for u, v in G.edges():
+ new_edges.append((u, new_node))
+ new_edges.append((v, new_node))
+ new_node += 1
+
+ G.add_edges_from(new_edges)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number(0)
+def empty_graph(n=0, create_using=None, default=Graph):
+ """Returns the empty graph with n nodes and zero edges.
+
+ .. plot::
+
+ >>> nx.draw(nx.empty_graph(5))
+
+ Parameters
+ ----------
+ n : int or iterable container of nodes (default = 0)
+ If n is an integer, nodes are from `range(n)`.
+ If n is a container of nodes, those nodes appear in the graph.
+ create_using : Graph Instance, Constructor or None
+ Indicator of type of graph to return.
+ If a Graph-type instance, then clear and use it.
+ If None, use the `default` constructor.
+ If a constructor, call it to create an empty graph.
+ default : Graph constructor (optional, default = nx.Graph)
+ The constructor to use if create_using is None.
+ If None, then nx.Graph is used.
+ This is used when passing an unknown `create_using` value
+ through your home-grown function to `empty_graph` and
+ you want a default constructor other than nx.Graph.
+
+ Examples
+ --------
+ >>> G = nx.empty_graph(10)
+ >>> G.number_of_nodes()
+ 10
+ >>> G.number_of_edges()
+ 0
+ >>> G = nx.empty_graph("ABC")
+ >>> G.number_of_nodes()
+ 3
+ >>> sorted(G)
+ ['A', 'B', 'C']
+
+ Notes
+ -----
+ The variable create_using should be a Graph Constructor or a
+ "graph"-like object. Constructors, e.g. `nx.Graph` or `nx.MultiGraph`
+ will be used to create the returned graph. "graph"-like objects
+ will be cleared (nodes and edges will be removed) and refitted as
+ an empty "graph" with nodes specified in n. This capability
+ is useful for specifying the class-nature of the resulting empty
+ "graph" (i.e. Graph, DiGraph, MyWeirdGraphClass, etc.).
+
+ The variable create_using has three main uses:
+ Firstly, the variable create_using can be used to create an
+ empty digraph, multigraph, etc. For example,
+
+ >>> n = 10
+ >>> G = nx.empty_graph(n, create_using=nx.DiGraph)
+
+ will create an empty digraph on n nodes.
+
+ Secondly, one can pass an existing graph (digraph, multigraph,
+ etc.) via create_using. For example, if G is an existing graph
+ (resp. digraph, multigraph, etc.), then empty_graph(n, create_using=G)
+ will empty G (i.e. delete all nodes and edges using G.clear())
+ and then add n nodes and zero edges, and return the modified graph.
+
+ Thirdly, when constructing your home-grown graph creation function
+ you can use empty_graph to construct the graph by passing a user
+ defined create_using to empty_graph. In this case, if you want the
+ default constructor to be other than nx.Graph, specify `default`.
+
+ >>> def mygraph(n, create_using=None):
+ ... G = nx.empty_graph(n, create_using, nx.MultiGraph)
+ ... G.add_edges_from([(0, 1), (0, 1)])
+ ... return G
+ >>> G = mygraph(3)
+ >>> G.is_multigraph()
+ True
+ >>> G = mygraph(3, nx.Graph)
+ >>> G.is_multigraph()
+ False
+
+ See also create_empty_copy(G).
+
+ """
+ if create_using is None:
+ G = default()
+ elif isinstance(create_using, type):
+ G = create_using()
+ elif not hasattr(create_using, "adj"):
+ raise TypeError("create_using is not a valid NetworkX graph type or instance")
+ else:
+ # create_using is a NetworkX style Graph
+ create_using.clear()
+ G = create_using
+
+ _, nodes = n
+ G.add_nodes_from(nodes)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def ladder_graph(n, create_using=None):
+ """Returns the Ladder graph of length n.
+
+ This is two paths of n nodes, with
+ each pair connected by a single edge.
+
+ Node labels are the integers 0 to 2*n - 1.
+
+ .. plot::
+
+ >>> nx.draw(nx.ladder_graph(5))
+
+ """
+ G = empty_graph(2 * n, create_using)
+ if G.is_directed():
+ raise NetworkXError("Directed Graph not supported")
+ G.add_edges_from(pairwise(range(n)))
+ G.add_edges_from(pairwise(range(n, 2 * n)))
+ G.add_edges_from((v, v + n) for v in range(n))
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number([0, 1])
+def lollipop_graph(m, n, create_using=None):
+ """Returns the Lollipop Graph; ``K_m`` connected to ``P_n``.
+
+ This is the Barbell Graph without the right barbell.
+
+ .. plot::
+
+ >>> nx.draw(nx.lollipop_graph(3, 4))
+
+ Parameters
+ ----------
+ m, n : int or iterable container of nodes
+ If an integer, nodes are from ``range(m)`` and ``range(m, m+n)``.
+ If a container of nodes, those nodes appear in the graph.
+ Warning: `m` and `n` are not checked for duplicates and if present the
+ resulting graph may not be as desired. Make sure you have no duplicates.
+
+ The nodes for `m` appear in the complete graph $K_m$ and the nodes
+ for `n` appear in the path $P_n$
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ Networkx graph
+ A complete graph with `m` nodes connected to a path of length `n`.
+
+ Notes
+ -----
+ The 2 subgraphs are joined via an edge ``(m-1, m)``.
+ If ``n=0``, this is merely a complete graph.
+
+ (This graph is an extremal example in David Aldous and Jim
+ Fill's etext on Random Walks on Graphs.)
+
+ """
+ m, m_nodes = m
+ M = len(m_nodes)
+ if M < 2:
+ raise NetworkXError("Invalid description: m should indicate at least 2 nodes")
+
+ n, n_nodes = n
+ if isinstance(m, numbers.Integral) and isinstance(n, numbers.Integral):
+ n_nodes = list(range(M, M + n))
+ N = len(n_nodes)
+
+ # the ball
+ G = complete_graph(m_nodes, create_using)
+ if G.is_directed():
+ raise NetworkXError("Directed Graph not supported")
+
+ # the stick
+ G.add_nodes_from(n_nodes)
+ if N > 1:
+ G.add_edges_from(pairwise(n_nodes))
+
+ if len(G) != M + N:
+ raise NetworkXError("Nodes must be distinct in containers m and n")
+
+ # connect ball to stick
+ if M > 0 and N > 0:
+ G.add_edge(m_nodes[-1], n_nodes[0])
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def null_graph(create_using=None):
+ """Returns the Null graph with no nodes or edges.
+
+ See empty_graph for the use of create_using.
+
+ """
+ G = empty_graph(0, create_using)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number(0)
+def path_graph(n, create_using=None):
+ """Returns the Path graph `P_n` of linearly connected nodes.
+
+ .. plot::
+
+ >>> nx.draw(nx.path_graph(5))
+
+ Parameters
+ ----------
+ n : int or iterable
+ If an integer, nodes are 0 to n - 1.
+ If an iterable of nodes, in the order they appear in the path.
+ Warning: n is not checked for duplicates and if present the
+ resulting graph may not be as desired. Make sure you have no duplicates.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ """
+ _, nodes = n
+ G = empty_graph(nodes, create_using)
+ G.add_edges_from(pairwise(nodes))
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number(0)
+def star_graph(n, create_using=None):
+ """Return the star graph
+
+ The star graph consists of one center node connected to n outer nodes.
+
+ .. plot::
+
+ >>> nx.draw(nx.star_graph(6))
+
+ Parameters
+ ----------
+ n : int or iterable
+ If an integer, node labels are 0 to n with center 0.
+ If an iterable of nodes, the center is the first.
+ Warning: n is not checked for duplicates and if present the
+ resulting graph may not be as desired. Make sure you have no duplicates.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Notes
+ -----
+ The graph has n+1 nodes for integer n.
+ So star_graph(3) is the same as star_graph(range(4)).
+ """
+ n, nodes = n
+ if isinstance(n, numbers.Integral):
+ nodes.append(int(n)) # there should be n+1 nodes
+ G = empty_graph(nodes, create_using)
+ if G.is_directed():
+ raise NetworkXError("Directed Graph not supported")
+
+ if len(nodes) > 1:
+ hub, *spokes = nodes
+ G.add_edges_from((hub, node) for node in spokes)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number([0, 1])
+def tadpole_graph(m, n, create_using=None):
+ """Returns the (m,n)-tadpole graph; ``C_m`` connected to ``P_n``.
+
+ This graph on m+n nodes connects a cycle of size `m` to a path of length `n`.
+ It looks like a tadpole. It is also called a kite graph or a dragon graph.
+
+ .. plot::
+
+ >>> nx.draw(nx.tadpole_graph(3, 5))
+
+ Parameters
+ ----------
+ m, n : int or iterable container of nodes
+ If an integer, nodes are from ``range(m)`` and ``range(m,m+n)``.
+ If a container of nodes, those nodes appear in the graph.
+ Warning: `m` and `n` are not checked for duplicates and if present the
+ resulting graph may not be as desired.
+
+ The nodes for `m` appear in the cycle graph $C_m$ and the nodes
+ for `n` appear in the path $P_n$.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ Networkx graph
+ A cycle of size `m` connected to a path of length `n`.
+
+ Raises
+ ------
+ NetworkXError
+ If ``m < 2``. The tadpole graph is undefined for ``m<2``.
+
+ Notes
+ -----
+ The 2 subgraphs are joined via an edge ``(m-1, m)``.
+ If ``n=0``, this is a cycle graph.
+ `m` and/or `n` can be a container of nodes instead of an integer.
+
+ """
+ m, m_nodes = m
+ M = len(m_nodes)
+ if M < 2:
+ raise NetworkXError("Invalid description: m should indicate at least 2 nodes")
+
+ n, n_nodes = n
+ if isinstance(m, numbers.Integral) and isinstance(n, numbers.Integral):
+ n_nodes = list(range(M, M + n))
+
+ # the circle
+ G = cycle_graph(m_nodes, create_using)
+ if G.is_directed():
+ raise NetworkXError("Directed Graph not supported")
+
+ # the stick
+ nx.add_path(G, [m_nodes[-1]] + list(n_nodes))
+
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def trivial_graph(create_using=None):
+ """Return the Trivial graph with one node (with label 0) and no edges.
+
+ .. plot::
+
+ >>> nx.draw(nx.trivial_graph(), with_labels=True)
+
+ """
+ G = empty_graph(1, create_using)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def turan_graph(n, r):
+ r"""Return the Turan Graph
+
+ The Turan Graph is a complete multipartite graph on $n$ nodes
+ with $r$ disjoint subsets. That is, edges connect each node to
+ every node not in its subset.
+
+ Given $n$ and $r$, we create a complete multipartite graph with
+ $r-(n \mod r)$ partitions of size $n/r$, rounded down, and
+ $n \mod r$ partitions of size $n/r+1$, rounded down.
+
+ .. plot::
+
+ >>> nx.draw(nx.turan_graph(6, 2))
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ r : int
+ The number of partitions.
+ Must be less than or equal to n.
+
+ Notes
+ -----
+ Must satisfy $1 <= r <= n$.
+ The graph has $(r-1)(n^2)/(2r)$ edges, rounded down.
+ """
+
+ if not 1 <= r <= n:
+ raise NetworkXError("Must satisfy 1 <= r <= n")
+
+ partitions = [n // r] * (r - (n % r)) + [n // r + 1] * (n % r)
+ G = complete_multipartite_graph(*partitions)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number(0)
+def wheel_graph(n, create_using=None):
+ """Return the wheel graph
+
+ The wheel graph consists of a hub node connected to a cycle of (n-1) nodes.
+
+ .. plot::
+
+ >>> nx.draw(nx.wheel_graph(5))
+
+ Parameters
+ ----------
+ n : int or iterable
+ If an integer, node labels are 0 to n with center 0.
+ If an iterable of nodes, the center is the first.
+ Warning: n is not checked for duplicates and if present the
+ resulting graph may not be as desired. Make sure you have no duplicates.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Node labels are the integers 0 to n - 1.
+ """
+ _, nodes = n
+ G = empty_graph(nodes, create_using)
+ if G.is_directed():
+ raise NetworkXError("Directed Graph not supported")
+
+ if len(nodes) > 1:
+ hub, *rim = nodes
+ G.add_edges_from((hub, node) for node in rim)
+ if len(rim) > 1:
+ G.add_edges_from(pairwise(rim, cyclic=True))
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def complete_multipartite_graph(*subset_sizes):
+ """Returns the complete multipartite graph with the specified subset sizes.
+
+ .. plot::
+
+ >>> nx.draw(nx.complete_multipartite_graph(1, 2, 3))
+
+ Parameters
+ ----------
+ subset_sizes : tuple of integers or tuple of node iterables
+ The arguments can either all be integer number of nodes or they
+ can all be iterables of nodes. If integers, they represent the
+ number of nodes in each subset of the multipartite graph.
+ If iterables, each is used to create the nodes for that subset.
+ The length of subset_sizes is the number of subsets.
+
+ Returns
+ -------
+ G : NetworkX Graph
+ Returns the complete multipartite graph with the specified subsets.
+
+ For each node, the node attribute 'subset' is an integer
+ indicating which subset contains the node.
+
+ Examples
+ --------
+ Creating a complete tripartite graph, with subsets of one, two, and three
+ nodes, respectively.
+
+ >>> G = nx.complete_multipartite_graph(1, 2, 3)
+ >>> [G.nodes[u]["subset"] for u in G]
+ [0, 1, 1, 2, 2, 2]
+ >>> list(G.edges(0))
+ [(0, 1), (0, 2), (0, 3), (0, 4), (0, 5)]
+ >>> list(G.edges(2))
+ [(2, 0), (2, 3), (2, 4), (2, 5)]
+ >>> list(G.edges(4))
+ [(4, 0), (4, 1), (4, 2)]
+
+ >>> G = nx.complete_multipartite_graph("a", "bc", "def")
+ >>> [G.nodes[u]["subset"] for u in sorted(G)]
+ [0, 1, 1, 2, 2, 2]
+
+ Notes
+ -----
+ This function generalizes several other graph builder functions.
+
+ - If no subset sizes are given, this returns the null graph.
+ - If a single subset size `n` is given, this returns the empty graph on
+ `n` nodes.
+ - If two subset sizes `m` and `n` are given, this returns the complete
+ bipartite graph on `m + n` nodes.
+ - If subset sizes `1` and `n` are given, this returns the star graph on
+ `n + 1` nodes.
+
+ See also
+ --------
+ complete_bipartite_graph
+ """
+ # The complete multipartite graph is an undirected simple graph.
+ G = Graph()
+
+ if len(subset_sizes) == 0:
+ return G
+
+ # set up subsets of nodes
+ try:
+ extents = pairwise(itertools.accumulate((0,) + subset_sizes))
+ subsets = [range(start, end) for start, end in extents]
+ except TypeError:
+ subsets = subset_sizes
+ else:
+ if any(size < 0 for size in subset_sizes):
+ raise NetworkXError(f"Negative number of nodes not valid: {subset_sizes}")
+
+ # add nodes with subset attribute
+ # while checking that ints are not mixed with iterables
+ try:
+ for i, subset in enumerate(subsets):
+ G.add_nodes_from(subset, subset=i)
+ except TypeError as err:
+ raise NetworkXError("Arguments must be all ints or all iterables") from err
+
+ # Across subsets, all nodes should be adjacent.
+ # We can use itertools.combinations() because undirected.
+ for subset1, subset2 in itertools.combinations(subsets, 2):
+ G.add_edges_from(itertools.product(subset1, subset2))
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/cographs.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/cographs.py
new file mode 100644
index 0000000000000000000000000000000000000000..6635b32f691696c1b6f309ad0da81c3cbc43bed9
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/cographs.py
@@ -0,0 +1,68 @@
+r"""Generators for cographs
+
+A cograph is a graph containing no path on four vertices.
+Cographs or $P_4$-free graphs can be obtained from a single vertex
+by disjoint union and complementation operations.
+
+References
+----------
+.. [0] D.G. Corneil, H. Lerchs, L.Stewart Burlingham,
+ "Complement reducible graphs",
+ Discrete Applied Mathematics, Volume 3, Issue 3, 1981, Pages 163-174,
+ ISSN 0166-218X.
+"""
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+__all__ = ["random_cograph"]
+
+
+@py_random_state(1)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_cograph(n, seed=None):
+ r"""Returns a random cograph with $2 ^ n$ nodes.
+
+ A cograph is a graph containing no path on four vertices.
+ Cographs or $P_4$-free graphs can be obtained from a single vertex
+ by disjoint union and complementation operations.
+
+ This generator starts off from a single vertex and performs disjoint
+ union and full join operations on itself.
+ The decision on which operation will take place is random.
+
+ Parameters
+ ----------
+ n : int
+ The order of the cograph.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : A random graph containing no path on four vertices.
+
+ See Also
+ --------
+ full_join
+ union
+
+ References
+ ----------
+ .. [1] D.G. Corneil, H. Lerchs, L.Stewart Burlingham,
+ "Complement reducible graphs",
+ Discrete Applied Mathematics, Volume 3, Issue 3, 1981, Pages 163-174,
+ ISSN 0166-218X.
+ """
+ R = nx.empty_graph(1)
+
+ for i in range(n):
+ RR = nx.relabel_nodes(R.copy(), lambda x: x + len(R))
+
+ if seed.randint(0, 1) == 0:
+ R = nx.full_join(R, RR)
+ else:
+ R = nx.disjoint_union(R, RR)
+
+ return R
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/community.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/community.py
new file mode 100644
index 0000000000000000000000000000000000000000..a7f2294c5cf9137dc1fab2a50d7ffcd6c59b6dec
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/community.py
@@ -0,0 +1,1070 @@
+"""Generators for classes of graphs used in studying social networks."""
+
+import itertools
+import math
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+__all__ = [
+ "caveman_graph",
+ "connected_caveman_graph",
+ "relaxed_caveman_graph",
+ "random_partition_graph",
+ "planted_partition_graph",
+ "gaussian_random_partition_graph",
+ "ring_of_cliques",
+ "windmill_graph",
+ "stochastic_block_model",
+ "LFR_benchmark_graph",
+]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def caveman_graph(l, k):
+ """Returns a caveman graph of `l` cliques of size `k`.
+
+ Parameters
+ ----------
+ l : int
+ Number of cliques
+ k : int
+ Size of cliques
+
+ Returns
+ -------
+ G : NetworkX Graph
+ caveman graph
+
+ Notes
+ -----
+ This returns an undirected graph, it can be converted to a directed
+ graph using :func:`nx.to_directed`, or a multigraph using
+ ``nx.MultiGraph(nx.caveman_graph(l, k))``. Only the undirected version is
+ described in [1]_ and it is unclear which of the directed
+ generalizations is most useful.
+
+ Examples
+ --------
+ >>> G = nx.caveman_graph(3, 3)
+
+ See also
+ --------
+
+ connected_caveman_graph
+
+ References
+ ----------
+ .. [1] Watts, D. J. 'Networks, Dynamics, and the Small-World Phenomenon.'
+ Amer. J. Soc. 105, 493-527, 1999.
+ """
+ # l disjoint cliques of size k
+ G = nx.empty_graph(l * k)
+ if k > 1:
+ for start in range(0, l * k, k):
+ edges = itertools.combinations(range(start, start + k), 2)
+ G.add_edges_from(edges)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def connected_caveman_graph(l, k):
+ """Returns a connected caveman graph of `l` cliques of size `k`.
+
+ The connected caveman graph is formed by creating `n` cliques of size
+ `k`, then a single edge in each clique is rewired to a node in an
+ adjacent clique.
+
+ Parameters
+ ----------
+ l : int
+ number of cliques
+ k : int
+ size of cliques (k at least 2 or NetworkXError is raised)
+
+ Returns
+ -------
+ G : NetworkX Graph
+ connected caveman graph
+
+ Raises
+ ------
+ NetworkXError
+ If the size of cliques `k` is smaller than 2.
+
+ Notes
+ -----
+ This returns an undirected graph, it can be converted to a directed
+ graph using :func:`nx.to_directed`, or a multigraph using
+ ``nx.MultiGraph(nx.caveman_graph(l, k))``. Only the undirected version is
+ described in [1]_ and it is unclear which of the directed
+ generalizations is most useful.
+
+ Examples
+ --------
+ >>> G = nx.connected_caveman_graph(3, 3)
+
+ References
+ ----------
+ .. [1] Watts, D. J. 'Networks, Dynamics, and the Small-World Phenomenon.'
+ Amer. J. Soc. 105, 493-527, 1999.
+ """
+ if k < 2:
+ raise nx.NetworkXError(
+ "The size of cliques in a connected caveman graph must be at least 2."
+ )
+
+ G = nx.caveman_graph(l, k)
+ for start in range(0, l * k, k):
+ G.remove_edge(start, start + 1)
+ G.add_edge(start, (start - 1) % (l * k))
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def relaxed_caveman_graph(l, k, p, seed=None):
+ """Returns a relaxed caveman graph.
+
+ A relaxed caveman graph starts with `l` cliques of size `k`. Edges are
+ then randomly rewired with probability `p` to link different cliques.
+
+ Parameters
+ ----------
+ l : int
+ Number of groups
+ k : int
+ Size of cliques
+ p : float
+ Probability of rewiring each edge.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : NetworkX Graph
+ Relaxed Caveman Graph
+
+ Raises
+ ------
+ NetworkXError
+ If p is not in [0,1]
+
+ Examples
+ --------
+ >>> G = nx.relaxed_caveman_graph(2, 3, 0.1, seed=42)
+
+ References
+ ----------
+ .. [1] Santo Fortunato, Community Detection in Graphs,
+ Physics Reports Volume 486, Issues 3-5, February 2010, Pages 75-174.
+ https://arxiv.org/abs/0906.0612
+ """
+ G = nx.caveman_graph(l, k)
+ nodes = list(G)
+ for u, v in G.edges():
+ if seed.random() < p: # rewire the edge
+ x = seed.choice(nodes)
+ if G.has_edge(u, x):
+ continue
+ G.remove_edge(u, v)
+ G.add_edge(u, x)
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_partition_graph(sizes, p_in, p_out, seed=None, directed=False):
+ """Returns the random partition graph with a partition of sizes.
+
+ A partition graph is a graph of communities with sizes defined by
+ s in sizes. Nodes in the same group are connected with probability
+ p_in and nodes of different groups are connected with probability
+ p_out.
+
+ Parameters
+ ----------
+ sizes : list of ints
+ Sizes of groups
+ p_in : float
+ probability of edges with in groups
+ p_out : float
+ probability of edges between groups
+ directed : boolean optional, default=False
+ Whether to create a directed graph
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : NetworkX Graph or DiGraph
+ random partition graph of size sum(gs)
+
+ Raises
+ ------
+ NetworkXError
+ If p_in or p_out is not in [0,1]
+
+ Examples
+ --------
+ >>> G = nx.random_partition_graph([10, 10, 10], 0.25, 0.01)
+ >>> len(G)
+ 30
+ >>> partition = G.graph["partition"]
+ >>> len(partition)
+ 3
+
+ Notes
+ -----
+ This is a generalization of the planted-l-partition described in
+ [1]_. It allows for the creation of groups of any size.
+
+ The partition is store as a graph attribute 'partition'.
+
+ References
+ ----------
+ .. [1] Santo Fortunato 'Community Detection in Graphs' Physical Reports
+ Volume 486, Issue 3-5 p. 75-174. https://arxiv.org/abs/0906.0612
+ """
+ # Use geometric method for O(n+m) complexity algorithm
+ # partition = nx.community_sets(nx.get_node_attributes(G, 'affiliation'))
+ if not 0.0 <= p_in <= 1.0:
+ raise nx.NetworkXError("p_in must be in [0,1]")
+ if not 0.0 <= p_out <= 1.0:
+ raise nx.NetworkXError("p_out must be in [0,1]")
+
+ # create connection matrix
+ num_blocks = len(sizes)
+ p = [[p_out for s in range(num_blocks)] for r in range(num_blocks)]
+ for r in range(num_blocks):
+ p[r][r] = p_in
+
+ return stochastic_block_model(
+ sizes,
+ p,
+ nodelist=None,
+ seed=seed,
+ directed=directed,
+ selfloops=False,
+ sparse=True,
+ )
+
+
+@py_random_state(4)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def planted_partition_graph(l, k, p_in, p_out, seed=None, directed=False):
+ """Returns the planted l-partition graph.
+
+ This model partitions a graph with n=l*k vertices in
+ l groups with k vertices each. Vertices of the same
+ group are linked with a probability p_in, and vertices
+ of different groups are linked with probability p_out.
+
+ Parameters
+ ----------
+ l : int
+ Number of groups
+ k : int
+ Number of vertices in each group
+ p_in : float
+ probability of connecting vertices within a group
+ p_out : float
+ probability of connected vertices between groups
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ directed : bool,optional (default=False)
+ If True return a directed graph
+
+ Returns
+ -------
+ G : NetworkX Graph or DiGraph
+ planted l-partition graph
+
+ Raises
+ ------
+ NetworkXError
+ If `p_in`, `p_out` are not in `[0, 1]`
+
+ Examples
+ --------
+ >>> G = nx.planted_partition_graph(4, 3, 0.5, 0.1, seed=42)
+
+ See Also
+ --------
+ random_partition_model
+
+ References
+ ----------
+ .. [1] A. Condon, R.M. Karp, Algorithms for graph partitioning
+ on the planted partition model,
+ Random Struct. Algor. 18 (2001) 116-140.
+
+ .. [2] Santo Fortunato 'Community Detection in Graphs' Physical Reports
+ Volume 486, Issue 3-5 p. 75-174. https://arxiv.org/abs/0906.0612
+ """
+ return random_partition_graph([k] * l, p_in, p_out, seed=seed, directed=directed)
+
+
+@py_random_state(6)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def gaussian_random_partition_graph(n, s, v, p_in, p_out, directed=False, seed=None):
+ """Generate a Gaussian random partition graph.
+
+ A Gaussian random partition graph is created by creating k partitions
+ each with a size drawn from a normal distribution with mean s and variance
+ s/v. Nodes are connected within clusters with probability p_in and
+ between clusters with probability p_out[1]
+
+ Parameters
+ ----------
+ n : int
+ Number of nodes in the graph
+ s : float
+ Mean cluster size
+ v : float
+ Shape parameter. The variance of cluster size distribution is s/v.
+ p_in : float
+ Probability of intra cluster connection.
+ p_out : float
+ Probability of inter cluster connection.
+ directed : boolean, optional default=False
+ Whether to create a directed graph or not
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : NetworkX Graph or DiGraph
+ gaussian random partition graph
+
+ Raises
+ ------
+ NetworkXError
+ If s is > n
+ If p_in or p_out is not in [0,1]
+
+ Notes
+ -----
+ Note the number of partitions is dependent on s,v and n, and that the
+ last partition may be considerably smaller, as it is sized to simply
+ fill out the nodes [1]
+
+ See Also
+ --------
+ random_partition_graph
+
+ Examples
+ --------
+ >>> G = nx.gaussian_random_partition_graph(100, 10, 10, 0.25, 0.1)
+ >>> len(G)
+ 100
+
+ References
+ ----------
+ .. [1] Ulrik Brandes, Marco Gaertler, Dorothea Wagner,
+ Experiments on Graph Clustering Algorithms,
+ In the proceedings of the 11th Europ. Symp. Algorithms, 2003.
+ """
+ if s > n:
+ raise nx.NetworkXError("s must be <= n")
+ assigned = 0
+ sizes = []
+ while True:
+ size = int(seed.gauss(s, s / v + 0.5))
+ if size < 1: # how to handle 0 or negative sizes?
+ continue
+ if assigned + size >= n:
+ sizes.append(n - assigned)
+ break
+ assigned += size
+ sizes.append(size)
+ return random_partition_graph(sizes, p_in, p_out, seed=seed, directed=directed)
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def ring_of_cliques(num_cliques, clique_size):
+ """Defines a "ring of cliques" graph.
+
+ A ring of cliques graph is consisting of cliques, connected through single
+ links. Each clique is a complete graph.
+
+ Parameters
+ ----------
+ num_cliques : int
+ Number of cliques
+ clique_size : int
+ Size of cliques
+
+ Returns
+ -------
+ G : NetworkX Graph
+ ring of cliques graph
+
+ Raises
+ ------
+ NetworkXError
+ If the number of cliques is lower than 2 or
+ if the size of cliques is smaller than 2.
+
+ Examples
+ --------
+ >>> G = nx.ring_of_cliques(8, 4)
+
+ See Also
+ --------
+ connected_caveman_graph
+
+ Notes
+ -----
+ The `connected_caveman_graph` graph removes a link from each clique to
+ connect it with the next clique. Instead, the `ring_of_cliques` graph
+ simply adds the link without removing any link from the cliques.
+ """
+ if num_cliques < 2:
+ raise nx.NetworkXError("A ring of cliques must have at least two cliques")
+ if clique_size < 2:
+ raise nx.NetworkXError("The cliques must have at least two nodes")
+
+ G = nx.Graph()
+ for i in range(num_cliques):
+ edges = itertools.combinations(
+ range(i * clique_size, i * clique_size + clique_size), 2
+ )
+ G.add_edges_from(edges)
+ G.add_edge(
+ i * clique_size + 1, (i + 1) * clique_size % (num_cliques * clique_size)
+ )
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def windmill_graph(n, k):
+ """Generate a windmill graph.
+ A windmill graph is a graph of `n` cliques each of size `k` that are all
+ joined at one node.
+ It can be thought of as taking a disjoint union of `n` cliques of size `k`,
+ selecting one point from each, and contracting all of the selected points.
+ Alternatively, one could generate `n` cliques of size `k-1` and one node
+ that is connected to all other nodes in the graph.
+
+ Parameters
+ ----------
+ n : int
+ Number of cliques
+ k : int
+ Size of cliques
+
+ Returns
+ -------
+ G : NetworkX Graph
+ windmill graph with n cliques of size k
+
+ Raises
+ ------
+ NetworkXError
+ If the number of cliques is less than two
+ If the size of the cliques are less than two
+
+ Examples
+ --------
+ >>> G = nx.windmill_graph(4, 5)
+
+ Notes
+ -----
+ The node labeled `0` will be the node connected to all other nodes.
+ Note that windmill graphs are usually denoted `Wd(k,n)`, so the parameters
+ are in the opposite order as the parameters of this method.
+ """
+ if n < 2:
+ msg = "A windmill graph must have at least two cliques"
+ raise nx.NetworkXError(msg)
+ if k < 2:
+ raise nx.NetworkXError("The cliques must have at least two nodes")
+
+ G = nx.disjoint_union_all(
+ itertools.chain(
+ [nx.complete_graph(k)], (nx.complete_graph(k - 1) for _ in range(n - 1))
+ )
+ )
+ G.add_edges_from((0, i) for i in range(k, G.number_of_nodes()))
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def stochastic_block_model(
+ sizes, p, nodelist=None, seed=None, directed=False, selfloops=False, sparse=True
+):
+ """Returns a stochastic block model graph.
+
+ This model partitions the nodes in blocks of arbitrary sizes, and places
+ edges between pairs of nodes independently, with a probability that depends
+ on the blocks.
+
+ Parameters
+ ----------
+ sizes : list of ints
+ Sizes of blocks
+ p : list of list of floats
+ Element (r,s) gives the density of edges going from the nodes
+ of group r to nodes of group s.
+ p must match the number of groups (len(sizes) == len(p)),
+ and it must be symmetric if the graph is undirected.
+ nodelist : list, optional
+ The block tags are assigned according to the node identifiers
+ in nodelist. If nodelist is None, then the ordering is the
+ range [0,sum(sizes)-1].
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ directed : boolean optional, default=False
+ Whether to create a directed graph or not.
+ selfloops : boolean optional, default=False
+ Whether to include self-loops or not.
+ sparse: boolean optional, default=True
+ Use the sparse heuristic to speed up the generator.
+
+ Returns
+ -------
+ g : NetworkX Graph or DiGraph
+ Stochastic block model graph of size sum(sizes)
+
+ Raises
+ ------
+ NetworkXError
+ If probabilities are not in [0,1].
+ If the probability matrix is not square (directed case).
+ If the probability matrix is not symmetric (undirected case).
+ If the sizes list does not match nodelist or the probability matrix.
+ If nodelist contains duplicate.
+
+ Examples
+ --------
+ >>> sizes = [75, 75, 300]
+ >>> probs = [[0.25, 0.05, 0.02], [0.05, 0.35, 0.07], [0.02, 0.07, 0.40]]
+ >>> g = nx.stochastic_block_model(sizes, probs, seed=0)
+ >>> len(g)
+ 450
+ >>> H = nx.quotient_graph(g, g.graph["partition"], relabel=True)
+ >>> for v in H.nodes(data=True):
+ ... print(round(v[1]["density"], 3))
+ 0.245
+ 0.348
+ 0.405
+ >>> for v in H.edges(data=True):
+ ... print(round(1.0 * v[2]["weight"] / (sizes[v[0]] * sizes[v[1]]), 3))
+ 0.051
+ 0.022
+ 0.07
+
+ See Also
+ --------
+ random_partition_graph
+ planted_partition_graph
+ gaussian_random_partition_graph
+ gnp_random_graph
+
+ References
+ ----------
+ .. [1] Holland, P. W., Laskey, K. B., & Leinhardt, S.,
+ "Stochastic blockmodels: First steps",
+ Social networks, 5(2), 109-137, 1983.
+ """
+ # Check if dimensions match
+ if len(sizes) != len(p):
+ raise nx.NetworkXException("'sizes' and 'p' do not match.")
+ # Check for probability symmetry (undirected) and shape (directed)
+ for row in p:
+ if len(p) != len(row):
+ raise nx.NetworkXException("'p' must be a square matrix.")
+ if not directed:
+ p_transpose = [list(i) for i in zip(*p)]
+ for i in zip(p, p_transpose):
+ for j in zip(i[0], i[1]):
+ if abs(j[0] - j[1]) > 1e-08:
+ raise nx.NetworkXException("'p' must be symmetric.")
+ # Check for probability range
+ for row in p:
+ for prob in row:
+ if prob < 0 or prob > 1:
+ raise nx.NetworkXException("Entries of 'p' not in [0,1].")
+ # Check for nodelist consistency
+ if nodelist is not None:
+ if len(nodelist) != sum(sizes):
+ raise nx.NetworkXException("'nodelist' and 'sizes' do not match.")
+ if len(nodelist) != len(set(nodelist)):
+ raise nx.NetworkXException("nodelist contains duplicate.")
+ else:
+ nodelist = range(sum(sizes))
+
+ # Setup the graph conditionally to the directed switch.
+ block_range = range(len(sizes))
+ if directed:
+ g = nx.DiGraph()
+ block_iter = itertools.product(block_range, block_range)
+ else:
+ g = nx.Graph()
+ block_iter = itertools.combinations_with_replacement(block_range, 2)
+ # Split nodelist in a partition (list of sets).
+ size_cumsum = [sum(sizes[0:x]) for x in range(len(sizes) + 1)]
+ g.graph["partition"] = [
+ set(nodelist[size_cumsum[x] : size_cumsum[x + 1]])
+ for x in range(len(size_cumsum) - 1)
+ ]
+ # Setup nodes and graph name
+ for block_id, nodes in enumerate(g.graph["partition"]):
+ for node in nodes:
+ g.add_node(node, block=block_id)
+
+ g.name = "stochastic_block_model"
+
+ # Test for edge existence
+ parts = g.graph["partition"]
+ for i, j in block_iter:
+ if i == j:
+ if directed:
+ if selfloops:
+ edges = itertools.product(parts[i], parts[i])
+ else:
+ edges = itertools.permutations(parts[i], 2)
+ else:
+ edges = itertools.combinations(parts[i], 2)
+ if selfloops:
+ edges = itertools.chain(edges, zip(parts[i], parts[i]))
+ for e in edges:
+ if seed.random() < p[i][j]:
+ g.add_edge(*e)
+ else:
+ edges = itertools.product(parts[i], parts[j])
+ if sparse:
+ if p[i][j] == 1: # Test edges cases p_ij = 0 or 1
+ for e in edges:
+ g.add_edge(*e)
+ elif p[i][j] > 0:
+ while True:
+ try:
+ logrand = math.log(seed.random())
+ skip = math.floor(logrand / math.log(1 - p[i][j]))
+ # consume "skip" edges
+ next(itertools.islice(edges, skip, skip), None)
+ e = next(edges)
+ g.add_edge(*e) # __safe
+ except StopIteration:
+ break
+ else:
+ for e in edges:
+ if seed.random() < p[i][j]:
+ g.add_edge(*e) # __safe
+ return g
+
+
+def _zipf_rv_below(gamma, xmin, threshold, seed):
+ """Returns a random value chosen from the bounded Zipf distribution.
+
+ Repeatedly draws values from the Zipf distribution until the
+ threshold is met, then returns that value.
+ """
+ result = nx.utils.zipf_rv(gamma, xmin, seed)
+ while result > threshold:
+ result = nx.utils.zipf_rv(gamma, xmin, seed)
+ return result
+
+
+def _powerlaw_sequence(gamma, low, high, condition, length, max_iters, seed):
+ """Returns a list of numbers obeying a constrained power law distribution.
+
+ ``gamma`` and ``low`` are the parameters for the Zipf distribution.
+
+ ``high`` is the maximum allowed value for values draw from the Zipf
+ distribution. For more information, see :func:`_zipf_rv_below`.
+
+ ``condition`` and ``length`` are Boolean-valued functions on
+ lists. While generating the list, random values are drawn and
+ appended to the list until ``length`` is satisfied by the created
+ list. Once ``condition`` is satisfied, the sequence generated in
+ this way is returned.
+
+ ``max_iters`` indicates the number of times to generate a list
+ satisfying ``length``. If the number of iterations exceeds this
+ value, :exc:`~networkx.exception.ExceededMaxIterations` is raised.
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ """
+ for i in range(max_iters):
+ seq = []
+ while not length(seq):
+ seq.append(_zipf_rv_below(gamma, low, high, seed))
+ if condition(seq):
+ return seq
+ raise nx.ExceededMaxIterations("Could not create power law sequence")
+
+
+def _hurwitz_zeta(x, q, tolerance):
+ """The Hurwitz zeta function, or the Riemann zeta function of two arguments.
+
+ ``x`` must be greater than one and ``q`` must be positive.
+
+ This function repeatedly computes subsequent partial sums until
+ convergence, as decided by ``tolerance``.
+ """
+ z = 0
+ z_prev = -float("inf")
+ k = 0
+ while abs(z - z_prev) > tolerance:
+ z_prev = z
+ z += 1 / ((k + q) ** x)
+ k += 1
+ return z
+
+
+def _generate_min_degree(gamma, average_degree, max_degree, tolerance, max_iters):
+ """Returns a minimum degree from the given average degree."""
+ # Defines zeta function whether or not Scipy is available
+ try:
+ from scipy.special import zeta
+ except ImportError:
+
+ def zeta(x, q):
+ return _hurwitz_zeta(x, q, tolerance)
+
+ min_deg_top = max_degree
+ min_deg_bot = 1
+ min_deg_mid = (min_deg_top - min_deg_bot) / 2 + min_deg_bot
+ itrs = 0
+ mid_avg_deg = 0
+ while abs(mid_avg_deg - average_degree) > tolerance:
+ if itrs > max_iters:
+ raise nx.ExceededMaxIterations("Could not match average_degree")
+ mid_avg_deg = 0
+ for x in range(int(min_deg_mid), max_degree + 1):
+ mid_avg_deg += (x ** (-gamma + 1)) / zeta(gamma, min_deg_mid)
+ if mid_avg_deg > average_degree:
+ min_deg_top = min_deg_mid
+ min_deg_mid = (min_deg_top - min_deg_bot) / 2 + min_deg_bot
+ else:
+ min_deg_bot = min_deg_mid
+ min_deg_mid = (min_deg_top - min_deg_bot) / 2 + min_deg_bot
+ itrs += 1
+ # return int(min_deg_mid + 0.5)
+ return round(min_deg_mid)
+
+
+def _generate_communities(degree_seq, community_sizes, mu, max_iters, seed):
+ """Returns a list of sets, each of which represents a community.
+
+ ``degree_seq`` is the degree sequence that must be met by the
+ graph.
+
+ ``community_sizes`` is the community size distribution that must be
+ met by the generated list of sets.
+
+ ``mu`` is a float in the interval [0, 1] indicating the fraction of
+ intra-community edges incident to each node.
+
+ ``max_iters`` is the number of times to try to add a node to a
+ community. This must be greater than the length of
+ ``degree_seq``, otherwise this function will always fail. If
+ the number of iterations exceeds this value,
+ :exc:`~networkx.exception.ExceededMaxIterations` is raised.
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ The communities returned by this are sets of integers in the set {0,
+ ..., *n* - 1}, where *n* is the length of ``degree_seq``.
+
+ """
+ # This assumes the nodes in the graph will be natural numbers.
+ result = [set() for _ in community_sizes]
+ n = len(degree_seq)
+ free = list(range(n))
+ for i in range(max_iters):
+ v = free.pop()
+ c = seed.choice(range(len(community_sizes)))
+ # s = int(degree_seq[v] * (1 - mu) + 0.5)
+ s = round(degree_seq[v] * (1 - mu))
+ # If the community is large enough, add the node to the chosen
+ # community. Otherwise, return it to the list of unaffiliated
+ # nodes.
+ if s < community_sizes[c]:
+ result[c].add(v)
+ else:
+ free.append(v)
+ # If the community is too big, remove a node from it.
+ if len(result[c]) > community_sizes[c]:
+ free.append(result[c].pop())
+ if not free:
+ return result
+ msg = "Could not assign communities; try increasing min_community"
+ raise nx.ExceededMaxIterations(msg)
+
+
+@py_random_state(11)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def LFR_benchmark_graph(
+ n,
+ tau1,
+ tau2,
+ mu,
+ average_degree=None,
+ min_degree=None,
+ max_degree=None,
+ min_community=None,
+ max_community=None,
+ tol=1.0e-7,
+ max_iters=500,
+ seed=None,
+):
+ r"""Returns the LFR benchmark graph.
+
+ This algorithm proceeds as follows:
+
+ 1) Find a degree sequence with a power law distribution, and minimum
+ value ``min_degree``, which has approximate average degree
+ ``average_degree``. This is accomplished by either
+
+ a) specifying ``min_degree`` and not ``average_degree``,
+ b) specifying ``average_degree`` and not ``min_degree``, in which
+ case a suitable minimum degree will be found.
+
+ ``max_degree`` can also be specified, otherwise it will be set to
+ ``n``. Each node *u* will have $\mu \mathrm{deg}(u)$ edges
+ joining it to nodes in communities other than its own and $(1 -
+ \mu) \mathrm{deg}(u)$ edges joining it to nodes in its own
+ community.
+ 2) Generate community sizes according to a power law distribution
+ with exponent ``tau2``. If ``min_community`` and
+ ``max_community`` are not specified they will be selected to be
+ ``min_degree`` and ``max_degree``, respectively. Community sizes
+ are generated until the sum of their sizes equals ``n``.
+ 3) Each node will be randomly assigned a community with the
+ condition that the community is large enough for the node's
+ intra-community degree, $(1 - \mu) \mathrm{deg}(u)$ as
+ described in step 2. If a community grows too large, a random node
+ will be selected for reassignment to a new community, until all
+ nodes have been assigned a community.
+ 4) Each node *u* then adds $(1 - \mu) \mathrm{deg}(u)$
+ intra-community edges and $\mu \mathrm{deg}(u)$ inter-community
+ edges.
+
+ Parameters
+ ----------
+ n : int
+ Number of nodes in the created graph.
+
+ tau1 : float
+ Power law exponent for the degree distribution of the created
+ graph. This value must be strictly greater than one.
+
+ tau2 : float
+ Power law exponent for the community size distribution in the
+ created graph. This value must be strictly greater than one.
+
+ mu : float
+ Fraction of inter-community edges incident to each node. This
+ value must be in the interval [0, 1].
+
+ average_degree : float
+ Desired average degree of nodes in the created graph. This value
+ must be in the interval [0, *n*]. Exactly one of this and
+ ``min_degree`` must be specified, otherwise a
+ :exc:`NetworkXError` is raised.
+
+ min_degree : int
+ Minimum degree of nodes in the created graph. This value must be
+ in the interval [0, *n*]. Exactly one of this and
+ ``average_degree`` must be specified, otherwise a
+ :exc:`NetworkXError` is raised.
+
+ max_degree : int
+ Maximum degree of nodes in the created graph. If not specified,
+ this is set to ``n``, the total number of nodes in the graph.
+
+ min_community : int
+ Minimum size of communities in the graph. If not specified, this
+ is set to ``min_degree``.
+
+ max_community : int
+ Maximum size of communities in the graph. If not specified, this
+ is set to ``n``, the total number of nodes in the graph.
+
+ tol : float
+ Tolerance when comparing floats, specifically when comparing
+ average degree values.
+
+ max_iters : int
+ Maximum number of iterations to try to create the community sizes,
+ degree distribution, and community affiliations.
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : NetworkX graph
+ The LFR benchmark graph generated according to the specified
+ parameters.
+
+ Each node in the graph has a node attribute ``'community'`` that
+ stores the community (that is, the set of nodes) that includes
+ it.
+
+ Raises
+ ------
+ NetworkXError
+ If any of the parameters do not meet their upper and lower bounds:
+
+ - ``tau1`` and ``tau2`` must be strictly greater than 1.
+ - ``mu`` must be in [0, 1].
+ - ``max_degree`` must be in {1, ..., *n*}.
+ - ``min_community`` and ``max_community`` must be in {0, ...,
+ *n*}.
+
+ If not exactly one of ``average_degree`` and ``min_degree`` is
+ specified.
+
+ If ``min_degree`` is not specified and a suitable ``min_degree``
+ cannot be found.
+
+ ExceededMaxIterations
+ If a valid degree sequence cannot be created within
+ ``max_iters`` number of iterations.
+
+ If a valid set of community sizes cannot be created within
+ ``max_iters`` number of iterations.
+
+ If a valid community assignment cannot be created within ``10 *
+ n * max_iters`` number of iterations.
+
+ Examples
+ --------
+ Basic usage::
+
+ >>> from networkx.generators.community import LFR_benchmark_graph
+ >>> n = 250
+ >>> tau1 = 3
+ >>> tau2 = 1.5
+ >>> mu = 0.1
+ >>> G = LFR_benchmark_graph(
+ ... n, tau1, tau2, mu, average_degree=5, min_community=20, seed=10
+ ... )
+
+ Continuing the example above, you can get the communities from the
+ node attributes of the graph::
+
+ >>> communities = {frozenset(G.nodes[v]["community"]) for v in G}
+
+ Notes
+ -----
+ This algorithm differs slightly from the original way it was
+ presented in [1].
+
+ 1) Rather than connecting the graph via a configuration model then
+ rewiring to match the intra-community and inter-community
+ degrees, we do this wiring explicitly at the end, which should be
+ equivalent.
+ 2) The code posted on the author's website [2] calculates the random
+ power law distributed variables and their average using
+ continuous approximations, whereas we use the discrete
+ distributions here as both degree and community size are
+ discrete.
+
+ Though the authors describe the algorithm as quite robust, testing
+ during development indicates that a somewhat narrower parameter set
+ is likely to successfully produce a graph. Some suggestions have
+ been provided in the event of exceptions.
+
+ References
+ ----------
+ .. [1] "Benchmark graphs for testing community detection algorithms",
+ Andrea Lancichinetti, Santo Fortunato, and Filippo Radicchi,
+ Phys. Rev. E 78, 046110 2008
+ .. [2] https://www.santofortunato.net/resources
+
+ """
+ # Perform some basic parameter validation.
+ if not tau1 > 1:
+ raise nx.NetworkXError("tau1 must be greater than one")
+ if not tau2 > 1:
+ raise nx.NetworkXError("tau2 must be greater than one")
+ if not 0 <= mu <= 1:
+ raise nx.NetworkXError("mu must be in the interval [0, 1]")
+
+ # Validate parameters for generating the degree sequence.
+ if max_degree is None:
+ max_degree = n
+ elif not 0 < max_degree <= n:
+ raise nx.NetworkXError("max_degree must be in the interval (0, n]")
+ if not ((min_degree is None) ^ (average_degree is None)):
+ raise nx.NetworkXError(
+ "Must assign exactly one of min_degree and average_degree"
+ )
+ if min_degree is None:
+ min_degree = _generate_min_degree(
+ tau1, average_degree, max_degree, tol, max_iters
+ )
+
+ # Generate a degree sequence with a power law distribution.
+ low, high = min_degree, max_degree
+
+ def condition(seq):
+ return sum(seq) % 2 == 0
+
+ def length(seq):
+ return len(seq) >= n
+
+ deg_seq = _powerlaw_sequence(tau1, low, high, condition, length, max_iters, seed)
+
+ # Validate parameters for generating the community size sequence.
+ if min_community is None:
+ min_community = min(deg_seq)
+ if max_community is None:
+ max_community = max(deg_seq)
+
+ # Generate a community size sequence with a power law distribution.
+ #
+ # TODO The original code incremented the number of iterations each
+ # time a new Zipf random value was drawn from the distribution. This
+ # differed from the way the number of iterations was incremented in
+ # `_powerlaw_degree_sequence`, so this code was changed to match
+ # that one. As a result, this code is allowed many more chances to
+ # generate a valid community size sequence.
+ low, high = min_community, max_community
+
+ def condition(seq):
+ return sum(seq) == n
+
+ def length(seq):
+ return sum(seq) >= n
+
+ comms = _powerlaw_sequence(tau2, low, high, condition, length, max_iters, seed)
+
+ # Generate the communities based on the given degree sequence and
+ # community sizes.
+ max_iters *= 10 * n
+ communities = _generate_communities(deg_seq, comms, mu, max_iters, seed)
+
+ # Finally, generate the benchmark graph based on the given
+ # communities, joining nodes according to the intra- and
+ # inter-community degrees.
+ G = nx.Graph()
+ G.add_nodes_from(range(n))
+ for c in communities:
+ for u in c:
+ while G.degree(u) < round(deg_seq[u] * (1 - mu)):
+ v = seed.choice(list(c))
+ G.add_edge(u, v)
+ while G.degree(u) < deg_seq[u]:
+ v = seed.choice(range(n))
+ if v not in c:
+ G.add_edge(u, v)
+ G.nodes[u]["community"] = c
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/degree_seq.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/degree_seq.py
new file mode 100644
index 0000000000000000000000000000000000000000..a27dd22e80fedc56b07d4ed96e076e5e37b63b3d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/degree_seq.py
@@ -0,0 +1,867 @@
+"""Generate graphs with a given degree sequence or expected degree sequence."""
+
+import heapq
+import math
+from itertools import chain, combinations, zip_longest
+from operator import itemgetter
+
+import networkx as nx
+from networkx.utils import py_random_state, random_weighted_sample
+
+__all__ = [
+ "configuration_model",
+ "directed_configuration_model",
+ "expected_degree_graph",
+ "havel_hakimi_graph",
+ "directed_havel_hakimi_graph",
+ "degree_sequence_tree",
+ "random_degree_sequence_graph",
+]
+
+chaini = chain.from_iterable
+
+
+def _to_stublist(degree_sequence):
+ """Returns a list of degree-repeated node numbers.
+
+ ``degree_sequence`` is a list of nonnegative integers representing
+ the degrees of nodes in a graph.
+
+ This function returns a list of node numbers with multiplicities
+ according to the given degree sequence. For example, if the first
+ element of ``degree_sequence`` is ``3``, then the first node number,
+ ``0``, will appear at the head of the returned list three times. The
+ node numbers are assumed to be the numbers zero through
+ ``len(degree_sequence) - 1``.
+
+ Examples
+ --------
+
+ >>> degree_sequence = [1, 2, 3]
+ >>> _to_stublist(degree_sequence)
+ [0, 1, 1, 2, 2, 2]
+
+ If a zero appears in the sequence, that means the node exists but
+ has degree zero, so that number will be skipped in the returned
+ list::
+
+ >>> degree_sequence = [2, 0, 1]
+ >>> _to_stublist(degree_sequence)
+ [0, 0, 2]
+
+ """
+ return list(chaini([n] * d for n, d in enumerate(degree_sequence)))
+
+
+def _configuration_model(
+ deg_sequence, create_using, directed=False, in_deg_sequence=None, seed=None
+):
+ """Helper function for generating either undirected or directed
+ configuration model graphs.
+
+ ``deg_sequence`` is a list of nonnegative integers representing the
+ degree of the node whose label is the index of the list element.
+
+ ``create_using`` see :func:`~networkx.empty_graph`.
+
+ ``directed`` and ``in_deg_sequence`` are required if you want the
+ returned graph to be generated using the directed configuration
+ model algorithm. If ``directed`` is ``False``, then ``deg_sequence``
+ is interpreted as the degree sequence of an undirected graph and
+ ``in_deg_sequence`` is ignored. Otherwise, if ``directed`` is
+ ``True``, then ``deg_sequence`` is interpreted as the out-degree
+ sequence and ``in_deg_sequence`` as the in-degree sequence of a
+ directed graph.
+
+ .. note::
+
+ ``deg_sequence`` and ``in_deg_sequence`` need not be the same
+ length.
+
+ ``seed`` is a random.Random or numpy.random.RandomState instance
+
+ This function returns a graph, directed if and only if ``directed``
+ is ``True``, generated according to the configuration model
+ algorithm. For more information on the algorithm, see the
+ :func:`configuration_model` or :func:`directed_configuration_model`
+ functions.
+
+ """
+ n = len(deg_sequence)
+ G = nx.empty_graph(n, create_using)
+ # If empty, return the null graph immediately.
+ if n == 0:
+ return G
+ # Build a list of available degree-repeated nodes. For example,
+ # for degree sequence [3, 2, 1, 1, 1], the "stub list" is
+ # initially [0, 0, 0, 1, 1, 2, 3, 4], that is, node 0 has degree
+ # 3 and thus is repeated 3 times, etc.
+ #
+ # Also, shuffle the stub list in order to get a random sequence of
+ # node pairs.
+ if directed:
+ pairs = zip_longest(deg_sequence, in_deg_sequence, fillvalue=0)
+ # Unzip the list of pairs into a pair of lists.
+ out_deg, in_deg = zip(*pairs)
+
+ out_stublist = _to_stublist(out_deg)
+ in_stublist = _to_stublist(in_deg)
+
+ seed.shuffle(out_stublist)
+ seed.shuffle(in_stublist)
+ else:
+ stublist = _to_stublist(deg_sequence)
+ # Choose a random balanced bipartition of the stublist, which
+ # gives a random pairing of nodes. In this implementation, we
+ # shuffle the list and then split it in half.
+ n = len(stublist)
+ half = n // 2
+ seed.shuffle(stublist)
+ out_stublist, in_stublist = stublist[:half], stublist[half:]
+ G.add_edges_from(zip(out_stublist, in_stublist))
+ return G
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def configuration_model(deg_sequence, create_using=None, seed=None):
+ """Returns a random graph with the given degree sequence.
+
+ The configuration model generates a random pseudograph (graph with
+ parallel edges and self loops) by randomly assigning edges to
+ match the given degree sequence.
+
+ Parameters
+ ----------
+ deg_sequence : list of nonnegative integers
+ Each list entry corresponds to the degree of a node.
+ create_using : NetworkX graph constructor, optional (default MultiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : MultiGraph
+ A graph with the specified degree sequence.
+ Nodes are labeled starting at 0 with an index
+ corresponding to the position in deg_sequence.
+
+ Raises
+ ------
+ NetworkXError
+ If the degree sequence does not have an even sum.
+
+ See Also
+ --------
+ is_graphical
+
+ Notes
+ -----
+ As described by Newman [1]_.
+
+ A non-graphical degree sequence (not realizable by some simple
+ graph) is allowed since this function returns graphs with self
+ loops and parallel edges. An exception is raised if the degree
+ sequence does not have an even sum.
+
+ This configuration model construction process can lead to
+ duplicate edges and loops. You can remove the self-loops and
+ parallel edges (see below) which will likely result in a graph
+ that doesn't have the exact degree sequence specified.
+
+ The density of self-loops and parallel edges tends to decrease as
+ the number of nodes increases. However, typically the number of
+ self-loops will approach a Poisson distribution with a nonzero mean,
+ and similarly for the number of parallel edges. Consider a node
+ with *k* stubs. The probability of being joined to another stub of
+ the same node is basically (*k* - *1*) / *N*, where *k* is the
+ degree and *N* is the number of nodes. So the probability of a
+ self-loop scales like *c* / *N* for some constant *c*. As *N* grows,
+ this means we expect *c* self-loops. Similarly for parallel edges.
+
+ References
+ ----------
+ .. [1] M.E.J. Newman, "The structure and function of complex networks",
+ SIAM REVIEW 45-2, pp 167-256, 2003.
+
+ Examples
+ --------
+ You can create a degree sequence following a particular distribution
+ by using the one of the distribution functions in
+ :mod:`~networkx.utils.random_sequence` (or one of your own). For
+ example, to create an undirected multigraph on one hundred nodes
+ with degree sequence chosen from the power law distribution:
+
+ >>> sequence = nx.random_powerlaw_tree_sequence(100, tries=5000)
+ >>> G = nx.configuration_model(sequence)
+ >>> len(G)
+ 100
+ >>> actual_degrees = [d for v, d in G.degree()]
+ >>> actual_degrees == sequence
+ True
+
+ The returned graph is a multigraph, which may have parallel
+ edges. To remove any parallel edges from the returned graph:
+
+ >>> G = nx.Graph(G)
+
+ Similarly, to remove self-loops:
+
+ >>> G.remove_edges_from(nx.selfloop_edges(G))
+
+ """
+ if sum(deg_sequence) % 2 != 0:
+ msg = "Invalid degree sequence: sum of degrees must be even, not odd"
+ raise nx.NetworkXError(msg)
+
+ G = nx.empty_graph(0, create_using, default=nx.MultiGraph)
+ if G.is_directed():
+ raise nx.NetworkXNotImplemented("not implemented for directed graphs")
+
+ G = _configuration_model(deg_sequence, G, seed=seed)
+
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def directed_configuration_model(
+ in_degree_sequence, out_degree_sequence, create_using=None, seed=None
+):
+ """Returns a directed_random graph with the given degree sequences.
+
+ The configuration model generates a random directed pseudograph
+ (graph with parallel edges and self loops) by randomly assigning
+ edges to match the given degree sequences.
+
+ Parameters
+ ----------
+ in_degree_sequence : list of nonnegative integers
+ Each list entry corresponds to the in-degree of a node.
+ out_degree_sequence : list of nonnegative integers
+ Each list entry corresponds to the out-degree of a node.
+ create_using : NetworkX graph constructor, optional (default MultiDiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : MultiDiGraph
+ A graph with the specified degree sequences.
+ Nodes are labeled starting at 0 with an index
+ corresponding to the position in deg_sequence.
+
+ Raises
+ ------
+ NetworkXError
+ If the degree sequences do not have the same sum.
+
+ See Also
+ --------
+ configuration_model
+
+ Notes
+ -----
+ Algorithm as described by Newman [1]_.
+
+ A non-graphical degree sequence (not realizable by some simple
+ graph) is allowed since this function returns graphs with self
+ loops and parallel edges. An exception is raised if the degree
+ sequences does not have the same sum.
+
+ This configuration model construction process can lead to
+ duplicate edges and loops. You can remove the self-loops and
+ parallel edges (see below) which will likely result in a graph
+ that doesn't have the exact degree sequence specified. This
+ "finite-size effect" decreases as the size of the graph increases.
+
+ References
+ ----------
+ .. [1] Newman, M. E. J. and Strogatz, S. H. and Watts, D. J.
+ Random graphs with arbitrary degree distributions and their applications
+ Phys. Rev. E, 64, 026118 (2001)
+
+ Examples
+ --------
+ One can modify the in- and out-degree sequences from an existing
+ directed graph in order to create a new directed graph. For example,
+ here we modify the directed path graph:
+
+ >>> D = nx.DiGraph([(0, 1), (1, 2), (2, 3)])
+ >>> din = list(d for n, d in D.in_degree())
+ >>> dout = list(d for n, d in D.out_degree())
+ >>> din.append(1)
+ >>> dout[0] = 2
+ >>> # We now expect an edge from node 0 to a new node, node 3.
+ ... D = nx.directed_configuration_model(din, dout)
+
+ The returned graph is a directed multigraph, which may have parallel
+ edges. To remove any parallel edges from the returned graph:
+
+ >>> D = nx.DiGraph(D)
+
+ Similarly, to remove self-loops:
+
+ >>> D.remove_edges_from(nx.selfloop_edges(D))
+
+ """
+ if sum(in_degree_sequence) != sum(out_degree_sequence):
+ msg = "Invalid degree sequences: sequences must have equal sums"
+ raise nx.NetworkXError(msg)
+
+ if create_using is None:
+ create_using = nx.MultiDiGraph
+
+ G = _configuration_model(
+ out_degree_sequence,
+ create_using,
+ directed=True,
+ in_deg_sequence=in_degree_sequence,
+ seed=seed,
+ )
+
+ name = "directed configuration_model {} nodes {} edges"
+ return G
+
+
+@py_random_state(1)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def expected_degree_graph(w, seed=None, selfloops=True):
+ r"""Returns a random graph with given expected degrees.
+
+ Given a sequence of expected degrees $W=(w_0,w_1,\ldots,w_{n-1})$
+ of length $n$ this algorithm assigns an edge between node $u$ and
+ node $v$ with probability
+
+ .. math::
+
+ p_{uv} = \frac{w_u w_v}{\sum_k w_k} .
+
+ Parameters
+ ----------
+ w : list
+ The list of expected degrees.
+ selfloops: bool (default=True)
+ Set to False to remove the possibility of self-loop edges.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ Graph
+
+ Examples
+ --------
+ >>> z = [10 for i in range(100)]
+ >>> G = nx.expected_degree_graph(z)
+
+ Notes
+ -----
+ The nodes have integer labels corresponding to index of expected degrees
+ input sequence.
+
+ The complexity of this algorithm is $\mathcal{O}(n+m)$ where $n$ is the
+ number of nodes and $m$ is the expected number of edges.
+
+ The model in [1]_ includes the possibility of self-loop edges.
+ Set selfloops=False to produce a graph without self loops.
+
+ For finite graphs this model doesn't produce exactly the given
+ expected degree sequence. Instead the expected degrees are as
+ follows.
+
+ For the case without self loops (selfloops=False),
+
+ .. math::
+
+ E[deg(u)] = \sum_{v \ne u} p_{uv}
+ = w_u \left( 1 - \frac{w_u}{\sum_k w_k} \right) .
+
+
+ NetworkX uses the standard convention that a self-loop edge counts 2
+ in the degree of a node, so with self loops (selfloops=True),
+
+ .. math::
+
+ E[deg(u)] = \sum_{v \ne u} p_{uv} + 2 p_{uu}
+ = w_u \left( 1 + \frac{w_u}{\sum_k w_k} \right) .
+
+ References
+ ----------
+ .. [1] Fan Chung and L. Lu, Connected components in random graphs with
+ given expected degree sequences, Ann. Combinatorics, 6,
+ pp. 125-145, 2002.
+ .. [2] Joel Miller and Aric Hagberg,
+ Efficient generation of networks with given expected degrees,
+ in Algorithms and Models for the Web-Graph (WAW 2011),
+ Alan Frieze, Paul Horn, and Paweł Prałat (Eds), LNCS 6732,
+ pp. 115-126, 2011.
+ """
+ n = len(w)
+ G = nx.empty_graph(n)
+
+ # If there are no nodes are no edges in the graph, return the empty graph.
+ if n == 0 or max(w) == 0:
+ return G
+
+ rho = 1 / sum(w)
+ # Sort the weights in decreasing order. The original order of the
+ # weights dictates the order of the (integer) node labels, so we
+ # need to remember the permutation applied in the sorting.
+ order = sorted(enumerate(w), key=itemgetter(1), reverse=True)
+ mapping = {c: u for c, (u, v) in enumerate(order)}
+ seq = [v for u, v in order]
+ last = n
+ if not selfloops:
+ last -= 1
+ for u in range(last):
+ v = u
+ if not selfloops:
+ v += 1
+ factor = seq[u] * rho
+ p = min(seq[v] * factor, 1)
+ while v < n and p > 0:
+ if p != 1:
+ r = seed.random()
+ v += math.floor(math.log(r, 1 - p))
+ if v < n:
+ q = min(seq[v] * factor, 1)
+ if seed.random() < q / p:
+ G.add_edge(mapping[u], mapping[v])
+ v += 1
+ p = q
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def havel_hakimi_graph(deg_sequence, create_using=None):
+ """Returns a simple graph with given degree sequence constructed
+ using the Havel-Hakimi algorithm.
+
+ Parameters
+ ----------
+ deg_sequence: list of integers
+ Each integer corresponds to the degree of a node (need not be sorted).
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Directed graphs are not allowed.
+
+ Raises
+ ------
+ NetworkXException
+ For a non-graphical degree sequence (i.e. one
+ not realizable by some simple graph).
+
+ Notes
+ -----
+ The Havel-Hakimi algorithm constructs a simple graph by
+ successively connecting the node of highest degree to other nodes
+ of highest degree, resorting remaining nodes by degree, and
+ repeating the process. The resulting graph has a high
+ degree-associativity. Nodes are labeled 1,.., len(deg_sequence),
+ corresponding to their position in deg_sequence.
+
+ The basic algorithm is from Hakimi [1]_ and was generalized by
+ Kleitman and Wang [2]_.
+
+ References
+ ----------
+ .. [1] Hakimi S., On Realizability of a Set of Integers as
+ Degrees of the Vertices of a Linear Graph. I,
+ Journal of SIAM, 10(3), pp. 496-506 (1962)
+ .. [2] Kleitman D.J. and Wang D.L.
+ Algorithms for Constructing Graphs and Digraphs with Given Valences
+ and Factors Discrete Mathematics, 6(1), pp. 79-88 (1973)
+ """
+ if not nx.is_graphical(deg_sequence):
+ raise nx.NetworkXError("Invalid degree sequence")
+
+ p = len(deg_sequence)
+ G = nx.empty_graph(p, create_using)
+ if G.is_directed():
+ raise nx.NetworkXError("Directed graphs are not supported")
+ num_degs = [[] for i in range(p)]
+ dmax, dsum, n = 0, 0, 0
+ for d in deg_sequence:
+ # Process only the non-zero integers
+ if d > 0:
+ num_degs[d].append(n)
+ dmax, dsum, n = max(dmax, d), dsum + d, n + 1
+ # Return graph if no edges
+ if n == 0:
+ return G
+
+ modstubs = [(0, 0)] * (dmax + 1)
+ # Successively reduce degree sequence by removing the maximum degree
+ while n > 0:
+ # Retrieve the maximum degree in the sequence
+ while len(num_degs[dmax]) == 0:
+ dmax -= 1
+ # If there are not enough stubs to connect to, then the sequence is
+ # not graphical
+ if dmax > n - 1:
+ raise nx.NetworkXError("Non-graphical integer sequence")
+
+ # Remove largest stub in list
+ source = num_degs[dmax].pop()
+ n -= 1
+ # Reduce the next dmax largest stubs
+ mslen = 0
+ k = dmax
+ for i in range(dmax):
+ while len(num_degs[k]) == 0:
+ k -= 1
+ target = num_degs[k].pop()
+ G.add_edge(source, target)
+ n -= 1
+ if k > 1:
+ modstubs[mslen] = (k - 1, target)
+ mslen += 1
+ # Add back to the list any nonzero stubs that were removed
+ for i in range(mslen):
+ (stubval, stubtarget) = modstubs[i]
+ num_degs[stubval].append(stubtarget)
+ n += 1
+
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def directed_havel_hakimi_graph(in_deg_sequence, out_deg_sequence, create_using=None):
+ """Returns a directed graph with the given degree sequences.
+
+ Parameters
+ ----------
+ in_deg_sequence : list of integers
+ Each list entry corresponds to the in-degree of a node.
+ out_deg_sequence : list of integers
+ Each list entry corresponds to the out-degree of a node.
+ create_using : NetworkX graph constructor, optional (default DiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : DiGraph
+ A graph with the specified degree sequences.
+ Nodes are labeled starting at 0 with an index
+ corresponding to the position in deg_sequence
+
+ Raises
+ ------
+ NetworkXError
+ If the degree sequences are not digraphical.
+
+ See Also
+ --------
+ configuration_model
+
+ Notes
+ -----
+ Algorithm as described by Kleitman and Wang [1]_.
+
+ References
+ ----------
+ .. [1] D.J. Kleitman and D.L. Wang
+ Algorithms for Constructing Graphs and Digraphs with Given Valences
+ and Factors Discrete Mathematics, 6(1), pp. 79-88 (1973)
+ """
+ in_deg_sequence = nx.utils.make_list_of_ints(in_deg_sequence)
+ out_deg_sequence = nx.utils.make_list_of_ints(out_deg_sequence)
+
+ # Process the sequences and form two heaps to store degree pairs with
+ # either zero or nonzero out degrees
+ sumin, sumout = 0, 0
+ nin, nout = len(in_deg_sequence), len(out_deg_sequence)
+ maxn = max(nin, nout)
+ G = nx.empty_graph(maxn, create_using, default=nx.DiGraph)
+ if maxn == 0:
+ return G
+ maxin = 0
+ stubheap, zeroheap = [], []
+ for n in range(maxn):
+ in_deg, out_deg = 0, 0
+ if n < nout:
+ out_deg = out_deg_sequence[n]
+ if n < nin:
+ in_deg = in_deg_sequence[n]
+ if in_deg < 0 or out_deg < 0:
+ raise nx.NetworkXError(
+ "Invalid degree sequences. Sequence values must be positive."
+ )
+ sumin, sumout, maxin = sumin + in_deg, sumout + out_deg, max(maxin, in_deg)
+ if in_deg > 0:
+ stubheap.append((-1 * out_deg, -1 * in_deg, n))
+ elif out_deg > 0:
+ zeroheap.append((-1 * out_deg, n))
+ if sumin != sumout:
+ raise nx.NetworkXError(
+ "Invalid degree sequences. Sequences must have equal sums."
+ )
+ heapq.heapify(stubheap)
+ heapq.heapify(zeroheap)
+
+ modstubs = [(0, 0, 0)] * (maxin + 1)
+ # Successively reduce degree sequence by removing the maximum
+ while stubheap:
+ # Remove first value in the sequence with a non-zero in degree
+ (freeout, freein, target) = heapq.heappop(stubheap)
+ freein *= -1
+ if freein > len(stubheap) + len(zeroheap):
+ raise nx.NetworkXError("Non-digraphical integer sequence")
+
+ # Attach arcs from the nodes with the most stubs
+ mslen = 0
+ for i in range(freein):
+ if zeroheap and (not stubheap or stubheap[0][0] > zeroheap[0][0]):
+ (stubout, stubsource) = heapq.heappop(zeroheap)
+ stubin = 0
+ else:
+ (stubout, stubin, stubsource) = heapq.heappop(stubheap)
+ if stubout == 0:
+ raise nx.NetworkXError("Non-digraphical integer sequence")
+ G.add_edge(stubsource, target)
+ # Check if source is now totally connected
+ if stubout + 1 < 0 or stubin < 0:
+ modstubs[mslen] = (stubout + 1, stubin, stubsource)
+ mslen += 1
+
+ # Add the nodes back to the heaps that still have available stubs
+ for i in range(mslen):
+ stub = modstubs[i]
+ if stub[1] < 0:
+ heapq.heappush(stubheap, stub)
+ else:
+ heapq.heappush(zeroheap, (stub[0], stub[2]))
+ if freeout < 0:
+ heapq.heappush(zeroheap, (freeout, target))
+
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def degree_sequence_tree(deg_sequence, create_using=None):
+ """Make a tree for the given degree sequence.
+
+ A tree has #nodes-#edges=1 so
+ the degree sequence must have
+ len(deg_sequence)-sum(deg_sequence)/2=1
+ """
+ # The sum of the degree sequence must be even (for any undirected graph).
+ degree_sum = sum(deg_sequence)
+ if degree_sum % 2 != 0:
+ msg = "Invalid degree sequence: sum of degrees must be even, not odd"
+ raise nx.NetworkXError(msg)
+ if len(deg_sequence) - degree_sum // 2 != 1:
+ msg = (
+ "Invalid degree sequence: tree must have number of nodes equal"
+ " to one less than the number of edges"
+ )
+ raise nx.NetworkXError(msg)
+ G = nx.empty_graph(0, create_using)
+ if G.is_directed():
+ raise nx.NetworkXError("Directed Graph not supported")
+
+ # Sort all degrees greater than 1 in decreasing order.
+ #
+ # TODO Does this need to be sorted in reverse order?
+ deg = sorted((s for s in deg_sequence if s > 1), reverse=True)
+
+ # make path graph as backbone
+ n = len(deg) + 2
+ nx.add_path(G, range(n))
+ last = n
+
+ # add the leaves
+ for source in range(1, n - 1):
+ nedges = deg.pop() - 2
+ for target in range(last, last + nedges):
+ G.add_edge(source, target)
+ last += nedges
+
+ # in case we added one too many
+ if len(G) > len(deg_sequence):
+ G.remove_node(0)
+ return G
+
+
+@py_random_state(1)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_degree_sequence_graph(sequence, seed=None, tries=10):
+ r"""Returns a simple random graph with the given degree sequence.
+
+ If the maximum degree $d_m$ in the sequence is $O(m^{1/4})$ then the
+ algorithm produces almost uniform random graphs in $O(m d_m)$ time
+ where $m$ is the number of edges.
+
+ Parameters
+ ----------
+ sequence : list of integers
+ Sequence of degrees
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ tries : int, optional
+ Maximum number of tries to create a graph
+
+ Returns
+ -------
+ G : Graph
+ A graph with the specified degree sequence.
+ Nodes are labeled starting at 0 with an index
+ corresponding to the position in the sequence.
+
+ Raises
+ ------
+ NetworkXUnfeasible
+ If the degree sequence is not graphical.
+ NetworkXError
+ If a graph is not produced in specified number of tries
+
+ See Also
+ --------
+ is_graphical, configuration_model
+
+ Notes
+ -----
+ The generator algorithm [1]_ is not guaranteed to produce a graph.
+
+ References
+ ----------
+ .. [1] Moshen Bayati, Jeong Han Kim, and Amin Saberi,
+ A sequential algorithm for generating random graphs.
+ Algorithmica, Volume 58, Number 4, 860-910,
+ DOI: 10.1007/s00453-009-9340-1
+
+ Examples
+ --------
+ >>> sequence = [1, 2, 2, 3]
+ >>> G = nx.random_degree_sequence_graph(sequence, seed=42)
+ >>> sorted(d for n, d in G.degree())
+ [1, 2, 2, 3]
+ """
+ DSRG = DegreeSequenceRandomGraph(sequence, seed)
+ for try_n in range(tries):
+ try:
+ return DSRG.generate()
+ except nx.NetworkXUnfeasible:
+ pass
+ raise nx.NetworkXError(f"failed to generate graph in {tries} tries")
+
+
+class DegreeSequenceRandomGraph:
+ # class to generate random graphs with a given degree sequence
+ # use random_degree_sequence_graph()
+ def __init__(self, degree, rng):
+ if not nx.is_graphical(degree):
+ raise nx.NetworkXUnfeasible("degree sequence is not graphical")
+ self.rng = rng
+ self.degree = list(degree)
+ # node labels are integers 0,...,n-1
+ self.m = sum(self.degree) / 2.0 # number of edges
+ try:
+ self.dmax = max(self.degree) # maximum degree
+ except ValueError:
+ self.dmax = 0
+
+ def generate(self):
+ # remaining_degree is mapping from int->remaining degree
+ self.remaining_degree = dict(enumerate(self.degree))
+ # add all nodes to make sure we get isolated nodes
+ self.graph = nx.Graph()
+ self.graph.add_nodes_from(self.remaining_degree)
+ # remove zero degree nodes
+ for n, d in list(self.remaining_degree.items()):
+ if d == 0:
+ del self.remaining_degree[n]
+ if len(self.remaining_degree) > 0:
+ # build graph in three phases according to how many unmatched edges
+ self.phase1()
+ self.phase2()
+ self.phase3()
+ return self.graph
+
+ def update_remaining(self, u, v, aux_graph=None):
+ # decrement remaining nodes, modify auxiliary graph if in phase3
+ if aux_graph is not None:
+ # remove edges from auxiliary graph
+ aux_graph.remove_edge(u, v)
+ if self.remaining_degree[u] == 1:
+ del self.remaining_degree[u]
+ if aux_graph is not None:
+ aux_graph.remove_node(u)
+ else:
+ self.remaining_degree[u] -= 1
+ if self.remaining_degree[v] == 1:
+ del self.remaining_degree[v]
+ if aux_graph is not None:
+ aux_graph.remove_node(v)
+ else:
+ self.remaining_degree[v] -= 1
+
+ def p(self, u, v):
+ # degree probability
+ return 1 - self.degree[u] * self.degree[v] / (4.0 * self.m)
+
+ def q(self, u, v):
+ # remaining degree probability
+ norm = max(self.remaining_degree.values()) ** 2
+ return self.remaining_degree[u] * self.remaining_degree[v] / norm
+
+ def suitable_edge(self):
+ """Returns True if and only if an arbitrary remaining node can
+ potentially be joined with some other remaining node.
+
+ """
+ nodes = iter(self.remaining_degree)
+ u = next(nodes)
+ return any(v not in self.graph[u] for v in nodes)
+
+ def phase1(self):
+ # choose node pairs from (degree) weighted distribution
+ rem_deg = self.remaining_degree
+ while sum(rem_deg.values()) >= 2 * self.dmax**2:
+ u, v = sorted(random_weighted_sample(rem_deg, 2, self.rng))
+ if self.graph.has_edge(u, v):
+ continue
+ if self.rng.random() < self.p(u, v): # accept edge
+ self.graph.add_edge(u, v)
+ self.update_remaining(u, v)
+
+ def phase2(self):
+ # choose remaining nodes uniformly at random and use rejection sampling
+ remaining_deg = self.remaining_degree
+ rng = self.rng
+ while len(remaining_deg) >= 2 * self.dmax:
+ while True:
+ u, v = sorted(rng.sample(list(remaining_deg.keys()), 2))
+ if self.graph.has_edge(u, v):
+ continue
+ if rng.random() < self.q(u, v):
+ break
+ if rng.random() < self.p(u, v): # accept edge
+ self.graph.add_edge(u, v)
+ self.update_remaining(u, v)
+
+ def phase3(self):
+ # build potential remaining edges and choose with rejection sampling
+ potential_edges = combinations(self.remaining_degree, 2)
+ # build auxiliary graph of potential edges not already in graph
+ H = nx.Graph(
+ [(u, v) for (u, v) in potential_edges if not self.graph.has_edge(u, v)]
+ )
+ rng = self.rng
+ while self.remaining_degree:
+ if not self.suitable_edge():
+ raise nx.NetworkXUnfeasible("no suitable edges left")
+ while True:
+ u, v = sorted(rng.choice(list(H.edges())))
+ if rng.random() < self.q(u, v):
+ break
+ if rng.random() < self.p(u, v): # accept edge
+ self.graph.add_edge(u, v)
+ self.update_remaining(u, v, aux_graph=H)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/directed.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/directed.py
new file mode 100644
index 0000000000000000000000000000000000000000..4548726b9fe2cbcb1210750db36a0a5e460f96c1
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/directed.py
@@ -0,0 +1,501 @@
+"""
+Generators for some directed graphs, including growing network (GN) graphs and
+scale-free graphs.
+
+"""
+
+import numbers
+from collections import Counter
+
+import networkx as nx
+from networkx.generators.classic import empty_graph
+from networkx.utils import discrete_sequence, py_random_state, weighted_choice
+
+__all__ = [
+ "gn_graph",
+ "gnc_graph",
+ "gnr_graph",
+ "random_k_out_graph",
+ "scale_free_graph",
+]
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def gn_graph(n, kernel=None, create_using=None, seed=None):
+ """Returns the growing network (GN) digraph with `n` nodes.
+
+ The GN graph is built by adding nodes one at a time with a link to one
+ previously added node. The target node for the link is chosen with
+ probability based on degree. The default attachment kernel is a linear
+ function of the degree of a node.
+
+ The graph is always a (directed) tree.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes for the generated graph.
+ kernel : function
+ The attachment kernel.
+ create_using : NetworkX graph constructor, optional (default DiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Examples
+ --------
+ To create the undirected GN graph, use the :meth:`~DiGraph.to_directed`
+ method::
+
+ >>> D = nx.gn_graph(10) # the GN graph
+ >>> G = D.to_undirected() # the undirected version
+
+ To specify an attachment kernel, use the `kernel` keyword argument::
+
+ >>> D = nx.gn_graph(10, kernel=lambda x: x**1.5) # A_k = k^1.5
+
+ References
+ ----------
+ .. [1] P. L. Krapivsky and S. Redner,
+ Organization of Growing Random Networks,
+ Phys. Rev. E, 63, 066123, 2001.
+ """
+ G = empty_graph(1, create_using, default=nx.DiGraph)
+ if not G.is_directed():
+ raise nx.NetworkXError("create_using must indicate a Directed Graph")
+
+ if kernel is None:
+
+ def kernel(x):
+ return x
+
+ if n == 1:
+ return G
+
+ G.add_edge(1, 0) # get started
+ ds = [1, 1] # degree sequence
+
+ for source in range(2, n):
+ # compute distribution from kernel and degree
+ dist = [kernel(d) for d in ds]
+ # choose target from discrete distribution
+ target = discrete_sequence(1, distribution=dist, seed=seed)[0]
+ G.add_edge(source, target)
+ ds.append(1) # the source has only one link (degree one)
+ ds[target] += 1 # add one to the target link degree
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def gnr_graph(n, p, create_using=None, seed=None):
+ """Returns the growing network with redirection (GNR) digraph with `n`
+ nodes and redirection probability `p`.
+
+ The GNR graph is built by adding nodes one at a time with a link to one
+ previously added node. The previous target node is chosen uniformly at
+ random. With probability `p` the link is instead "redirected" to the
+ successor node of the target.
+
+ The graph is always a (directed) tree.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes for the generated graph.
+ p : float
+ The redirection probability.
+ create_using : NetworkX graph constructor, optional (default DiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Examples
+ --------
+ To create the undirected GNR graph, use the :meth:`~DiGraph.to_directed`
+ method::
+
+ >>> D = nx.gnr_graph(10, 0.5) # the GNR graph
+ >>> G = D.to_undirected() # the undirected version
+
+ References
+ ----------
+ .. [1] P. L. Krapivsky and S. Redner,
+ Organization of Growing Random Networks,
+ Phys. Rev. E, 63, 066123, 2001.
+ """
+ G = empty_graph(1, create_using, default=nx.DiGraph)
+ if not G.is_directed():
+ raise nx.NetworkXError("create_using must indicate a Directed Graph")
+
+ if n == 1:
+ return G
+
+ for source in range(1, n):
+ target = seed.randrange(0, source)
+ if seed.random() < p and target != 0:
+ target = next(G.successors(target))
+ G.add_edge(source, target)
+ return G
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def gnc_graph(n, create_using=None, seed=None):
+ """Returns the growing network with copying (GNC) digraph with `n` nodes.
+
+ The GNC graph is built by adding nodes one at a time with a link to one
+ previously added node (chosen uniformly at random) and to all of that
+ node's successors.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes for the generated graph.
+ create_using : NetworkX graph constructor, optional (default DiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ References
+ ----------
+ .. [1] P. L. Krapivsky and S. Redner,
+ Network Growth by Copying,
+ Phys. Rev. E, 71, 036118, 2005k.},
+ """
+ G = empty_graph(1, create_using, default=nx.DiGraph)
+ if not G.is_directed():
+ raise nx.NetworkXError("create_using must indicate a Directed Graph")
+
+ if n == 1:
+ return G
+
+ for source in range(1, n):
+ target = seed.randrange(0, source)
+ for succ in G.successors(target):
+ G.add_edge(source, succ)
+ G.add_edge(source, target)
+ return G
+
+
+@py_random_state(6)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def scale_free_graph(
+ n,
+ alpha=0.41,
+ beta=0.54,
+ gamma=0.05,
+ delta_in=0.2,
+ delta_out=0,
+ seed=None,
+ initial_graph=None,
+):
+ """Returns a scale-free directed graph.
+
+ Parameters
+ ----------
+ n : integer
+ Number of nodes in graph
+ alpha : float
+ Probability for adding a new node connected to an existing node
+ chosen randomly according to the in-degree distribution.
+ beta : float
+ Probability for adding an edge between two existing nodes.
+ One existing node is chosen randomly according the in-degree
+ distribution and the other chosen randomly according to the out-degree
+ distribution.
+ gamma : float
+ Probability for adding a new node connected to an existing node
+ chosen randomly according to the out-degree distribution.
+ delta_in : float
+ Bias for choosing nodes from in-degree distribution.
+ delta_out : float
+ Bias for choosing nodes from out-degree distribution.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ initial_graph : MultiDiGraph instance, optional
+ Build the scale-free graph starting from this initial MultiDiGraph,
+ if provided.
+
+ Returns
+ -------
+ MultiDiGraph
+
+ Examples
+ --------
+ Create a scale-free graph on one hundred nodes::
+
+ >>> G = nx.scale_free_graph(100)
+
+ Notes
+ -----
+ The sum of `alpha`, `beta`, and `gamma` must be 1.
+
+ References
+ ----------
+ .. [1] B. Bollobás, C. Borgs, J. Chayes, and O. Riordan,
+ Directed scale-free graphs,
+ Proceedings of the fourteenth annual ACM-SIAM Symposium on
+ Discrete Algorithms, 132--139, 2003.
+ """
+
+ def _choose_node(candidates, node_list, delta):
+ if delta > 0:
+ bias_sum = len(node_list) * delta
+ p_delta = bias_sum / (bias_sum + len(candidates))
+ if seed.random() < p_delta:
+ return seed.choice(node_list)
+ return seed.choice(candidates)
+
+ if initial_graph is not None and hasattr(initial_graph, "_adj"):
+ if not isinstance(initial_graph, nx.MultiDiGraph):
+ raise nx.NetworkXError("initial_graph must be a MultiDiGraph.")
+ G = initial_graph
+ else:
+ # Start with 3-cycle
+ G = nx.MultiDiGraph([(0, 1), (1, 2), (2, 0)])
+
+ if alpha <= 0:
+ raise ValueError("alpha must be > 0.")
+ if beta <= 0:
+ raise ValueError("beta must be > 0.")
+ if gamma <= 0:
+ raise ValueError("gamma must be > 0.")
+
+ if abs(alpha + beta + gamma - 1.0) >= 1e-9:
+ raise ValueError("alpha+beta+gamma must equal 1.")
+
+ if delta_in < 0:
+ raise ValueError("delta_in must be >= 0.")
+
+ if delta_out < 0:
+ raise ValueError("delta_out must be >= 0.")
+
+ # pre-populate degree states
+ vs = sum((count * [idx] for idx, count in G.out_degree()), [])
+ ws = sum((count * [idx] for idx, count in G.in_degree()), [])
+
+ # pre-populate node state
+ node_list = list(G.nodes())
+
+ # see if there already are number-based nodes
+ numeric_nodes = [n for n in node_list if isinstance(n, numbers.Number)]
+ if len(numeric_nodes) > 0:
+ # set cursor for new nodes appropriately
+ cursor = max(int(n.real) for n in numeric_nodes) + 1
+ else:
+ # or start at zero
+ cursor = 0
+
+ while len(G) < n:
+ r = seed.random()
+
+ # random choice in alpha,beta,gamma ranges
+ if r < alpha:
+ # alpha
+ # add new node v
+ v = cursor
+ cursor += 1
+ # also add to node state
+ node_list.append(v)
+ # choose w according to in-degree and delta_in
+ w = _choose_node(ws, node_list, delta_in)
+
+ elif r < alpha + beta:
+ # beta
+ # choose v according to out-degree and delta_out
+ v = _choose_node(vs, node_list, delta_out)
+ # choose w according to in-degree and delta_in
+ w = _choose_node(ws, node_list, delta_in)
+
+ else:
+ # gamma
+ # choose v according to out-degree and delta_out
+ v = _choose_node(vs, node_list, delta_out)
+ # add new node w
+ w = cursor
+ cursor += 1
+ # also add to node state
+ node_list.append(w)
+
+ # add edge to graph
+ G.add_edge(v, w)
+
+ # update degree states
+ vs.append(v)
+ ws.append(w)
+
+ return G
+
+
+@py_random_state(4)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_uniform_k_out_graph(n, k, self_loops=True, with_replacement=True, seed=None):
+ """Returns a random `k`-out graph with uniform attachment.
+
+ A random `k`-out graph with uniform attachment is a multidigraph
+ generated by the following algorithm. For each node *u*, choose
+ `k` nodes *v* uniformly at random (with replacement). Add a
+ directed edge joining *u* to *v*.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes in the returned graph.
+
+ k : int
+ The out-degree of each node in the returned graph.
+
+ self_loops : bool
+ If True, self-loops are allowed when generating the graph.
+
+ with_replacement : bool
+ If True, neighbors are chosen with replacement and the
+ returned graph will be a directed multigraph. Otherwise,
+ neighbors are chosen without replacement and the returned graph
+ will be a directed graph.
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ NetworkX graph
+ A `k`-out-regular directed graph generated according to the
+ above algorithm. It will be a multigraph if and only if
+ `with_replacement` is True.
+
+ Raises
+ ------
+ ValueError
+ If `with_replacement` is False and `k` is greater than
+ `n`.
+
+ See also
+ --------
+ random_k_out_graph
+
+ Notes
+ -----
+ The return digraph or multidigraph may not be strongly connected, or
+ even weakly connected.
+
+ If `with_replacement` is True, this function is similar to
+ :func:`random_k_out_graph`, if that function had parameter `alpha`
+ set to positive infinity.
+
+ """
+ if with_replacement:
+ create_using = nx.MultiDiGraph()
+
+ def sample(v, nodes):
+ if not self_loops:
+ nodes = nodes - {v}
+ return (seed.choice(list(nodes)) for i in range(k))
+
+ else:
+ create_using = nx.DiGraph()
+
+ def sample(v, nodes):
+ if not self_loops:
+ nodes = nodes - {v}
+ return seed.sample(list(nodes), k)
+
+ G = nx.empty_graph(n, create_using)
+ nodes = set(G)
+ for u in G:
+ G.add_edges_from((u, v) for v in sample(u, nodes))
+ return G
+
+
+@py_random_state(4)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_k_out_graph(n, k, alpha, self_loops=True, seed=None):
+ """Returns a random `k`-out graph with preferential attachment.
+
+ A random `k`-out graph with preferential attachment is a
+ multidigraph generated by the following algorithm.
+
+ 1. Begin with an empty digraph, and initially set each node to have
+ weight `alpha`.
+ 2. Choose a node `u` with out-degree less than `k` uniformly at
+ random.
+ 3. Choose a node `v` from with probability proportional to its
+ weight.
+ 4. Add a directed edge from `u` to `v`, and increase the weight
+ of `v` by one.
+ 5. If each node has out-degree `k`, halt, otherwise repeat from
+ step 2.
+
+ For more information on this model of random graph, see [1].
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes in the returned graph.
+
+ k : int
+ The out-degree of each node in the returned graph.
+
+ alpha : float
+ A positive :class:`float` representing the initial weight of
+ each vertex. A higher number means that in step 3 above, nodes
+ will be chosen more like a true uniformly random sample, and a
+ lower number means that nodes are more likely to be chosen as
+ their in-degree increases. If this parameter is not positive, a
+ :exc:`ValueError` is raised.
+
+ self_loops : bool
+ If True, self-loops are allowed when generating the graph.
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ :class:`~networkx.classes.MultiDiGraph`
+ A `k`-out-regular multidigraph generated according to the above
+ algorithm.
+
+ Raises
+ ------
+ ValueError
+ If `alpha` is not positive.
+
+ Notes
+ -----
+ The returned multidigraph may not be strongly connected, or even
+ weakly connected.
+
+ References
+ ----------
+ [1]: Peterson, Nicholas R., and Boris Pittel.
+ "Distance between two random `k`-out digraphs, with and without
+ preferential attachment."
+ arXiv preprint arXiv:1311.5961 (2013).
+
+
+ """
+ if alpha < 0:
+ raise ValueError("alpha must be positive")
+ G = nx.empty_graph(n, create_using=nx.MultiDiGraph)
+ weights = Counter({v: alpha for v in G})
+ for i in range(k * n):
+ u = seed.choice([v for v, d in G.out_degree() if d < k])
+ # If self-loops are not allowed, make the source node `u` have
+ # weight zero.
+ if not self_loops:
+ adjustment = Counter({u: weights[u]})
+ else:
+ adjustment = Counter()
+ v = weighted_choice(weights - adjustment, seed=seed)
+ G.add_edge(u, v)
+ weights[v] += 1
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/duplication.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/duplication.py
new file mode 100644
index 0000000000000000000000000000000000000000..3c3ade63f58237eeb927ff631b25f025d7d83fc1
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/duplication.py
@@ -0,0 +1,174 @@
+"""Functions for generating graphs based on the "duplication" method.
+
+These graph generators start with a small initial graph then duplicate
+nodes and (partially) duplicate their edges. These functions are
+generally inspired by biological networks.
+
+"""
+
+import networkx as nx
+from networkx.exception import NetworkXError
+from networkx.utils import py_random_state
+from networkx.utils.misc import check_create_using
+
+__all__ = ["partial_duplication_graph", "duplication_divergence_graph"]
+
+
+@py_random_state(4)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def partial_duplication_graph(N, n, p, q, seed=None, *, create_using=None):
+ """Returns a random graph using the partial duplication model.
+
+ Parameters
+ ----------
+ N : int
+ The total number of nodes in the final graph.
+
+ n : int
+ The number of nodes in the initial clique.
+
+ p : float
+ The probability of joining each neighbor of a node to the
+ duplicate node. Must be a number in the between zero and one,
+ inclusive.
+
+ q : float
+ The probability of joining the source node to the duplicate
+ node. Must be a number in the between zero and one, inclusive.
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Notes
+ -----
+ A graph of nodes is grown by creating a fully connected graph
+ of size `n`. The following procedure is then repeated until
+ a total of `N` nodes have been reached.
+
+ 1. A random node, *u*, is picked and a new node, *v*, is created.
+ 2. For each neighbor of *u* an edge from the neighbor to *v* is created
+ with probability `p`.
+ 3. An edge from *u* to *v* is created with probability `q`.
+
+ This algorithm appears in [1].
+
+ This implementation allows the possibility of generating
+ disconnected graphs.
+
+ References
+ ----------
+ .. [1] Knudsen Michael, and Carsten Wiuf. "A Markov chain approach to
+ randomly grown graphs." Journal of Applied Mathematics 2008.
+
+
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if p < 0 or p > 1 or q < 0 or q > 1:
+ msg = "partial duplication graph must have 0 <= p, q <= 1."
+ raise NetworkXError(msg)
+ if n > N:
+ raise NetworkXError("partial duplication graph must have n <= N.")
+
+ G = nx.complete_graph(n, create_using)
+ for new_node in range(n, N):
+ # Pick a random vertex, u, already in the graph.
+ src_node = seed.randint(0, new_node - 1)
+
+ # Add a new vertex, v, to the graph.
+ G.add_node(new_node)
+
+ # For each neighbor of u...
+ for nbr_node in list(nx.all_neighbors(G, src_node)):
+ # Add the neighbor to v with probability p.
+ if seed.random() < p:
+ G.add_edge(new_node, nbr_node)
+
+ # Join v and u with probability q.
+ if seed.random() < q:
+ G.add_edge(new_node, src_node)
+ return G
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def duplication_divergence_graph(n, p, seed=None, *, create_using=None):
+ """Returns an undirected graph using the duplication-divergence model.
+
+ A graph of `n` nodes is created by duplicating the initial nodes
+ and retaining edges incident to the original nodes with a retention
+ probability `p`.
+
+ Parameters
+ ----------
+ n : int
+ The desired number of nodes in the graph.
+ p : float
+ The probability for retaining the edge of the replicated node.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Returns
+ -------
+ G : Graph
+
+ Raises
+ ------
+ NetworkXError
+ If `p` is not a valid probability.
+ If `n` is less than 2.
+
+ Notes
+ -----
+ This algorithm appears in [1].
+
+ This implementation disallows the possibility of generating
+ disconnected graphs.
+
+ References
+ ----------
+ .. [1] I. Ispolatov, P. L. Krapivsky, A. Yuryev,
+ "Duplication-divergence model of protein interaction network",
+ Phys. Rev. E, 71, 061911, 2005.
+
+ """
+ if p > 1 or p < 0:
+ msg = f"NetworkXError p={p} is not in [0,1]."
+ raise nx.NetworkXError(msg)
+ if n < 2:
+ msg = "n must be greater than or equal to 2"
+ raise nx.NetworkXError(msg)
+
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ G = nx.empty_graph(create_using=create_using)
+
+ # Initialize the graph with two connected nodes.
+ G.add_edge(0, 1)
+ i = 2
+ while i < n:
+ # Choose a random node from current graph to duplicate.
+ random_node = seed.choice(list(G))
+ # Make the replica.
+ G.add_node(i)
+ # flag indicates whether at least one edge is connected on the replica.
+ flag = False
+ for nbr in G.neighbors(random_node):
+ if seed.random() < p:
+ # Link retention step.
+ G.add_edge(i, nbr)
+ flag = True
+ if not flag:
+ # Delete replica if no edges retained.
+ G.remove_node(i)
+ else:
+ # Successful duplication.
+ i += 1
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/ego.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/ego.py
new file mode 100644
index 0000000000000000000000000000000000000000..1c705430d8b52cf47d1e1b681397c929221e58a0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/ego.py
@@ -0,0 +1,66 @@
+"""
+Ego graph.
+"""
+
+__all__ = ["ego_graph"]
+
+import networkx as nx
+
+
+@nx._dispatchable(preserve_all_attrs=True, returns_graph=True)
+def ego_graph(G, n, radius=1, center=True, undirected=False, distance=None):
+ """Returns induced subgraph of neighbors centered at node n within
+ a given radius.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX Graph or DiGraph
+
+ n : node
+ A single node
+
+ radius : number, optional
+ Include all neighbors of distance<=radius from n.
+
+ center : bool, optional
+ If False, do not include center node in graph
+
+ undirected : bool, optional
+ If True use both in- and out-neighbors of directed graphs.
+
+ distance : key, optional
+ Use specified edge data key as distance. For example, setting
+ distance='weight' will use the edge weight to measure the
+ distance from the node n.
+
+ Notes
+ -----
+ For directed graphs D this produces the "out" neighborhood
+ or successors. If you want the neighborhood of predecessors
+ first reverse the graph with D.reverse(). If you want both
+ directions use the keyword argument undirected=True.
+
+ Node, edge, and graph attributes are copied to the returned subgraph.
+ """
+ if undirected:
+ if distance is not None:
+ sp, _ = nx.single_source_dijkstra(
+ G.to_undirected(), n, cutoff=radius, weight=distance
+ )
+ else:
+ sp = dict(
+ nx.single_source_shortest_path_length(
+ G.to_undirected(), n, cutoff=radius
+ )
+ )
+ else:
+ if distance is not None:
+ sp, _ = nx.single_source_dijkstra(G, n, cutoff=radius, weight=distance)
+ else:
+ sp = dict(nx.single_source_shortest_path_length(G, n, cutoff=radius))
+
+ H = G.subgraph(sp).copy()
+ if not center:
+ H.remove_node(n)
+ return H
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/expanders.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/expanders.py
new file mode 100644
index 0000000000000000000000000000000000000000..befdb0e4b0f3579a272491d8ea6b970716c57f6e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/expanders.py
@@ -0,0 +1,474 @@
+"""Provides explicit constructions of expander graphs."""
+
+import itertools
+
+import networkx as nx
+
+__all__ = [
+ "margulis_gabber_galil_graph",
+ "chordal_cycle_graph",
+ "paley_graph",
+ "maybe_regular_expander",
+ "is_regular_expander",
+ "random_regular_expander_graph",
+]
+
+
+# Other discrete torus expanders can be constructed by using the following edge
+# sets. For more information, see Chapter 4, "Expander Graphs", in
+# "Pseudorandomness", by Salil Vadhan.
+#
+# For a directed expander, add edges from (x, y) to:
+#
+# (x, y),
+# ((x + 1) % n, y),
+# (x, (y + 1) % n),
+# (x, (x + y) % n),
+# (-y % n, x)
+#
+# For an undirected expander, add the reverse edges.
+#
+# Also appearing in the paper of Gabber and Galil:
+#
+# (x, y),
+# (x, (x + y) % n),
+# (x, (x + y + 1) % n),
+# ((x + y) % n, y),
+# ((x + y + 1) % n, y)
+#
+# and:
+#
+# (x, y),
+# ((x + 2*y) % n, y),
+# ((x + (2*y + 1)) % n, y),
+# ((x + (2*y + 2)) % n, y),
+# (x, (y + 2*x) % n),
+# (x, (y + (2*x + 1)) % n),
+# (x, (y + (2*x + 2)) % n),
+#
+@nx._dispatchable(graphs=None, returns_graph=True)
+def margulis_gabber_galil_graph(n, create_using=None):
+ r"""Returns the Margulis-Gabber-Galil undirected MultiGraph on `n^2` nodes.
+
+ The undirected MultiGraph is regular with degree `8`. Nodes are integer
+ pairs. The second-largest eigenvalue of the adjacency matrix of the graph
+ is at most `5 \sqrt{2}`, regardless of `n`.
+
+ Parameters
+ ----------
+ n : int
+ Determines the number of nodes in the graph: `n^2`.
+ create_using : NetworkX graph constructor, optional (default MultiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : graph
+ The constructed undirected multigraph.
+
+ Raises
+ ------
+ NetworkXError
+ If the graph is directed or not a multigraph.
+
+ """
+ G = nx.empty_graph(0, create_using, default=nx.MultiGraph)
+ if G.is_directed() or not G.is_multigraph():
+ msg = "`create_using` must be an undirected multigraph."
+ raise nx.NetworkXError(msg)
+
+ for x, y in itertools.product(range(n), repeat=2):
+ for u, v in (
+ ((x + 2 * y) % n, y),
+ ((x + (2 * y + 1)) % n, y),
+ (x, (y + 2 * x) % n),
+ (x, (y + (2 * x + 1)) % n),
+ ):
+ G.add_edge((x, y), (u, v))
+ G.graph["name"] = f"margulis_gabber_galil_graph({n})"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def chordal_cycle_graph(p, create_using=None):
+ """Returns the chordal cycle graph on `p` nodes.
+
+ The returned graph is a cycle graph on `p` nodes with chords joining each
+ vertex `x` to its inverse modulo `p`. This graph is a (mildly explicit)
+ 3-regular expander [1]_.
+
+ `p` *must* be a prime number.
+
+ Parameters
+ ----------
+ p : a prime number
+
+ The number of vertices in the graph. This also indicates where the
+ chordal edges in the cycle will be created.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : graph
+ The constructed undirected multigraph.
+
+ Raises
+ ------
+ NetworkXError
+
+ If `create_using` indicates directed or not a multigraph.
+
+ References
+ ----------
+
+ .. [1] Theorem 4.4.2 in A. Lubotzky. "Discrete groups, expanding graphs and
+ invariant measures", volume 125 of Progress in Mathematics.
+ Birkhäuser Verlag, Basel, 1994.
+
+ """
+ G = nx.empty_graph(0, create_using, default=nx.MultiGraph)
+ if G.is_directed() or not G.is_multigraph():
+ msg = "`create_using` must be an undirected multigraph."
+ raise nx.NetworkXError(msg)
+
+ for x in range(p):
+ left = (x - 1) % p
+ right = (x + 1) % p
+ # Here we apply Fermat's Little Theorem to compute the multiplicative
+ # inverse of x in Z/pZ. By Fermat's Little Theorem,
+ #
+ # x^p = x (mod p)
+ #
+ # Therefore,
+ #
+ # x * x^(p - 2) = 1 (mod p)
+ #
+ # The number 0 is a special case: we just let its inverse be itself.
+ chord = pow(x, p - 2, p) if x > 0 else 0
+ for y in (left, right, chord):
+ G.add_edge(x, y)
+ G.graph["name"] = f"chordal_cycle_graph({p})"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def paley_graph(p, create_using=None):
+ r"""Returns the Paley $\frac{(p-1)}{2}$ -regular graph on $p$ nodes.
+
+ The returned graph is a graph on $\mathbb{Z}/p\mathbb{Z}$ with edges between $x$ and $y$
+ if and only if $x-y$ is a nonzero square in $\mathbb{Z}/p\mathbb{Z}$.
+
+ If $p \equiv 1 \pmod 4$, $-1$ is a square in $\mathbb{Z}/p\mathbb{Z}$ and therefore $x-y$ is a square if and
+ only if $y-x$ is also a square, i.e the edges in the Paley graph are symmetric.
+
+ If $p \equiv 3 \pmod 4$, $-1$ is not a square in $\mathbb{Z}/p\mathbb{Z}$ and therefore either $x-y$ or $y-x$
+ is a square in $\mathbb{Z}/p\mathbb{Z}$ but not both.
+
+ Note that a more general definition of Paley graphs extends this construction
+ to graphs over $q=p^n$ vertices, by using the finite field $F_q$ instead of $\mathbb{Z}/p\mathbb{Z}$.
+ This construction requires to compute squares in general finite fields and is
+ not what is implemented here (i.e `paley_graph(25)` does not return the true
+ Paley graph associated with $5^2$).
+
+ Parameters
+ ----------
+ p : int, an odd prime number.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : graph
+ The constructed directed graph.
+
+ Raises
+ ------
+ NetworkXError
+ If the graph is a multigraph.
+
+ References
+ ----------
+ Chapter 13 in B. Bollobas, Random Graphs. Second edition.
+ Cambridge Studies in Advanced Mathematics, 73.
+ Cambridge University Press, Cambridge (2001).
+ """
+ G = nx.empty_graph(0, create_using, default=nx.DiGraph)
+ if G.is_multigraph():
+ msg = "`create_using` cannot be a multigraph."
+ raise nx.NetworkXError(msg)
+
+ # Compute the squares in Z/pZ.
+ # Make it a set to uniquify (there are exactly (p-1)/2 squares in Z/pZ
+ # when is prime).
+ square_set = {(x**2) % p for x in range(1, p) if (x**2) % p != 0}
+
+ for x in range(p):
+ for x2 in square_set:
+ G.add_edge(x, (x + x2) % p)
+ G.graph["name"] = f"paley({p})"
+ return G
+
+
+@nx.utils.decorators.np_random_state("seed")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def maybe_regular_expander(n, d, *, create_using=None, max_tries=100, seed=None):
+ r"""Utility for creating a random regular expander.
+
+ Returns a random $d$-regular graph on $n$ nodes which is an expander
+ graph with very good probability.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ d : int
+ The degree of each node.
+ create_using : Graph Instance or Constructor
+ Indicator of type of graph to return.
+ If a Graph-type instance, then clear and use it.
+ If a constructor, call it to create an empty graph.
+ Use the Graph constructor by default.
+ max_tries : int. (default: 100)
+ The number of allowed loops when generating each independent cycle
+ seed : (default: None)
+ Seed used to set random number generation state. See :ref`Randomness`.
+
+ Notes
+ -----
+ The nodes are numbered from $0$ to $n - 1$.
+
+ The graph is generated by taking $d / 2$ random independent cycles.
+
+ Joel Friedman proved that in this model the resulting
+ graph is an expander with probability
+ $1 - O(n^{-\tau})$ where $\tau = \lceil (\sqrt{d - 1}) / 2 \rceil - 1$. [1]_
+
+ Examples
+ --------
+ >>> G = nx.maybe_regular_expander(n=200, d=6, seed=8020)
+
+ Returns
+ -------
+ G : graph
+ The constructed undirected graph.
+
+ Raises
+ ------
+ NetworkXError
+ If $d % 2 != 0$ as the degree must be even.
+ If $n - 1$ is less than $ 2d $ as the graph is complete at most.
+ If max_tries is reached
+
+ See Also
+ --------
+ is_regular_expander
+ random_regular_expander_graph
+
+ References
+ ----------
+ .. [1] Joel Friedman,
+ A Proof of Alon’s Second Eigenvalue Conjecture and Related Problems, 2004
+ https://arxiv.org/abs/cs/0405020
+
+ """
+
+ import numpy as np
+
+ if n < 1:
+ raise nx.NetworkXError("n must be a positive integer")
+
+ if not (d >= 2):
+ raise nx.NetworkXError("d must be greater than or equal to 2")
+
+ if not (d % 2 == 0):
+ raise nx.NetworkXError("d must be even")
+
+ if not (n - 1 >= d):
+ raise nx.NetworkXError(
+ f"Need n-1>= d to have room for {d//2} independent cycles with {n} nodes"
+ )
+
+ G = nx.empty_graph(n, create_using)
+
+ if n < 2:
+ return G
+
+ cycles = []
+ edges = set()
+
+ # Create d / 2 cycles
+ for i in range(d // 2):
+ iterations = max_tries
+ # Make sure the cycles are independent to have a regular graph
+ while len(edges) != (i + 1) * n:
+ iterations -= 1
+ # Faster than random.permutation(n) since there are only
+ # (n-1)! distinct cycles against n! permutations of size n
+ cycle = seed.permutation(n - 1).tolist()
+ cycle.append(n - 1)
+
+ new_edges = {
+ (u, v)
+ for u, v in nx.utils.pairwise(cycle, cyclic=True)
+ if (u, v) not in edges and (v, u) not in edges
+ }
+ # If the new cycle has no edges in common with previous cycles
+ # then add it to the list otherwise try again
+ if len(new_edges) == n:
+ cycles.append(cycle)
+ edges.update(new_edges)
+
+ if iterations == 0:
+ raise nx.NetworkXError("Too many iterations in maybe_regular_expander")
+
+ G.add_edges_from(edges)
+
+ return G
+
+
+@nx.utils.not_implemented_for("directed")
+@nx.utils.not_implemented_for("multigraph")
+@nx._dispatchable(preserve_edge_attrs={"G": {"weight": 1}})
+def is_regular_expander(G, *, epsilon=0):
+ r"""Determines whether the graph G is a regular expander. [1]_
+
+ An expander graph is a sparse graph with strong connectivity properties.
+
+ More precisely, this helper checks whether the graph is a
+ regular $(n, d, \lambda)$-expander with $\lambda$ close to
+ the Alon-Boppana bound and given by
+ $\lambda = 2 \sqrt{d - 1} + \epsilon$. [2]_
+
+ In the case where $\epsilon = 0$ then if the graph successfully passes the test
+ it is a Ramanujan graph. [3]_
+
+ A Ramanujan graph has spectral gap almost as large as possible, which makes them
+ excellent expanders.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+ epsilon : int, float, default=0
+
+ Returns
+ -------
+ bool
+ Whether the given graph is a regular $(n, d, \lambda)$-expander
+ where $\lambda = 2 \sqrt{d - 1} + \epsilon$.
+
+ Examples
+ --------
+ >>> G = nx.random_regular_expander_graph(20, 4)
+ >>> nx.is_regular_expander(G)
+ True
+
+ See Also
+ --------
+ maybe_regular_expander
+ random_regular_expander_graph
+
+ References
+ ----------
+ .. [1] Expander graph, https://en.wikipedia.org/wiki/Expander_graph
+ .. [2] Alon-Boppana bound, https://en.wikipedia.org/wiki/Alon%E2%80%93Boppana_bound
+ .. [3] Ramanujan graphs, https://en.wikipedia.org/wiki/Ramanujan_graph
+
+ """
+
+ import numpy as np
+ from scipy.sparse.linalg import eigsh
+
+ if epsilon < 0:
+ raise nx.NetworkXError("epsilon must be non negative")
+
+ if not nx.is_regular(G):
+ return False
+
+ _, d = nx.utils.arbitrary_element(G.degree)
+
+ A = nx.adjacency_matrix(G, dtype=float)
+ lams = eigsh(A, which="LM", k=2, return_eigenvectors=False)
+
+ # lambda2 is the second biggest eigenvalue
+ lambda2 = min(lams)
+
+ # Use bool() to convert numpy scalar to Python Boolean
+ return bool(abs(lambda2) < 2 ** np.sqrt(d - 1) + epsilon)
+
+
+@nx.utils.decorators.np_random_state("seed")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_regular_expander_graph(
+ n, d, *, epsilon=0, create_using=None, max_tries=100, seed=None
+):
+ r"""Returns a random regular expander graph on $n$ nodes with degree $d$.
+
+ An expander graph is a sparse graph with strong connectivity properties. [1]_
+
+ More precisely the returned graph is a $(n, d, \lambda)$-expander with
+ $\lambda = 2 \sqrt{d - 1} + \epsilon$, close to the Alon-Boppana bound. [2]_
+
+ In the case where $\epsilon = 0$ it returns a Ramanujan graph.
+ A Ramanujan graph has spectral gap almost as large as possible,
+ which makes them excellent expanders. [3]_
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ d : int
+ The degree of each node.
+ epsilon : int, float, default=0
+ max_tries : int, (default: 100)
+ The number of allowed loops, also used in the maybe_regular_expander utility
+ seed : (default: None)
+ Seed used to set random number generation state. See :ref`Randomness`.
+
+ Raises
+ ------
+ NetworkXError
+ If max_tries is reached
+
+ Examples
+ --------
+ >>> G = nx.random_regular_expander_graph(20, 4)
+ >>> nx.is_regular_expander(G)
+ True
+
+ Notes
+ -----
+ This loops over `maybe_regular_expander` and can be slow when
+ $n$ is too big or $\epsilon$ too small.
+
+ See Also
+ --------
+ maybe_regular_expander
+ is_regular_expander
+
+ References
+ ----------
+ .. [1] Expander graph, https://en.wikipedia.org/wiki/Expander_graph
+ .. [2] Alon-Boppana bound, https://en.wikipedia.org/wiki/Alon%E2%80%93Boppana_bound
+ .. [3] Ramanujan graphs, https://en.wikipedia.org/wiki/Ramanujan_graph
+
+ """
+ G = maybe_regular_expander(
+ n, d, create_using=create_using, max_tries=max_tries, seed=seed
+ )
+ iterations = max_tries
+
+ while not is_regular_expander(G, epsilon=epsilon):
+ iterations -= 1
+ G = maybe_regular_expander(
+ n=n, d=d, create_using=create_using, max_tries=max_tries, seed=seed
+ )
+
+ if iterations == 0:
+ raise nx.NetworkXError(
+ "Too many iterations in random_regular_expander_graph"
+ )
+
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/geometric.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/geometric.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f19281b81fd9d109565c005174b27513ce6ae02
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/geometric.py
@@ -0,0 +1,1048 @@
+"""Generators for geometric graphs."""
+
+import math
+from bisect import bisect_left
+from itertools import accumulate, combinations, product
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+__all__ = [
+ "geometric_edges",
+ "geographical_threshold_graph",
+ "navigable_small_world_graph",
+ "random_geometric_graph",
+ "soft_random_geometric_graph",
+ "thresholded_random_geometric_graph",
+ "waxman_graph",
+ "geometric_soft_configuration_graph",
+]
+
+
+@nx._dispatchable(node_attrs="pos_name")
+def geometric_edges(G, radius, p=2, *, pos_name="pos"):
+ """Returns edge list of node pairs within `radius` of each other.
+
+ Parameters
+ ----------
+ G : networkx graph
+ The graph from which to generate the edge list. The nodes in `G` should
+ have an attribute ``pos`` corresponding to the node position, which is
+ used to compute the distance to other nodes.
+ radius : scalar
+ The distance threshold. Edges are included in the edge list if the
+ distance between the two nodes is less than `radius`.
+ pos_name : string, default="pos"
+ The name of the node attribute which represents the position of each
+ node in 2D coordinates. Every node in the Graph must have this attribute.
+ p : scalar, default=2
+ The `Minkowski distance metric
+ `_ used to compute
+ distances. The default value is 2, i.e. Euclidean distance.
+
+ Returns
+ -------
+ edges : list
+ List of edges whose distances are less than `radius`
+
+ Notes
+ -----
+ Radius uses Minkowski distance metric `p`.
+ If scipy is available, `scipy.spatial.cKDTree` is used to speed computation.
+
+ Examples
+ --------
+ Create a graph with nodes that have a "pos" attribute representing 2D
+ coordinates.
+
+ >>> G = nx.Graph()
+ >>> G.add_nodes_from(
+ ... [
+ ... (0, {"pos": (0, 0)}),
+ ... (1, {"pos": (3, 0)}),
+ ... (2, {"pos": (8, 0)}),
+ ... ]
+ ... )
+ >>> nx.geometric_edges(G, radius=1)
+ []
+ >>> nx.geometric_edges(G, radius=4)
+ [(0, 1)]
+ >>> nx.geometric_edges(G, radius=6)
+ [(0, 1), (1, 2)]
+ >>> nx.geometric_edges(G, radius=9)
+ [(0, 1), (0, 2), (1, 2)]
+ """
+ # Input validation - every node must have a "pos" attribute
+ for n, pos in G.nodes(data=pos_name):
+ if pos is None:
+ raise nx.NetworkXError(
+ f"Node {n} (and all nodes) must have a '{pos_name}' attribute."
+ )
+
+ # NOTE: See _geometric_edges for the actual implementation. The reason this
+ # is split into two functions is to avoid the overhead of input validation
+ # every time the function is called internally in one of the other
+ # geometric generators
+ return _geometric_edges(G, radius, p, pos_name)
+
+
+def _geometric_edges(G, radius, p, pos_name):
+ """
+ Implements `geometric_edges` without input validation. See `geometric_edges`
+ for complete docstring.
+ """
+ nodes_pos = G.nodes(data=pos_name)
+ try:
+ import scipy as sp
+ except ImportError:
+ # no scipy KDTree so compute by for-loop
+ radius_p = radius**p
+ edges = [
+ (u, v)
+ for (u, pu), (v, pv) in combinations(nodes_pos, 2)
+ if sum(abs(a - b) ** p for a, b in zip(pu, pv)) <= radius_p
+ ]
+ return edges
+ # scipy KDTree is available
+ nodes, coords = list(zip(*nodes_pos))
+ kdtree = sp.spatial.cKDTree(coords) # Cannot provide generator.
+ edge_indexes = kdtree.query_pairs(radius, p)
+ edges = [(nodes[u], nodes[v]) for u, v in sorted(edge_indexes)]
+ return edges
+
+
+@py_random_state(5)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_geometric_graph(
+ n, radius, dim=2, pos=None, p=2, seed=None, *, pos_name="pos"
+):
+ """Returns a random geometric graph in the unit cube of dimensions `dim`.
+
+ The random geometric graph model places `n` nodes uniformly at
+ random in the unit cube. Two nodes are joined by an edge if the
+ distance between the nodes is at most `radius`.
+
+ Edges are determined using a KDTree when SciPy is available.
+ This reduces the time complexity from $O(n^2)$ to $O(n)$.
+
+ Parameters
+ ----------
+ n : int or iterable
+ Number of nodes or iterable of nodes
+ radius: float
+ Distance threshold value
+ dim : int, optional
+ Dimension of graph
+ pos : dict, optional
+ A dictionary keyed by node with node positions as values.
+ p : float, optional
+ Which Minkowski distance metric to use. `p` has to meet the condition
+ ``1 <= p <= infinity``.
+
+ If this argument is not specified, the :math:`L^2` metric
+ (the Euclidean distance metric), p = 2 is used.
+ This should not be confused with the `p` of an Erdős-Rényi random
+ graph, which represents probability.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ pos_name : string, default="pos"
+ The name of the node attribute which represents the position
+ in 2D coordinates of the node in the returned graph.
+
+ Returns
+ -------
+ Graph
+ A random geometric graph, undirected and without self-loops.
+ Each node has a node attribute ``'pos'`` that stores the
+ position of that node in Euclidean space as provided by the
+ ``pos`` keyword argument or, if ``pos`` was not provided, as
+ generated by this function.
+
+ Examples
+ --------
+ Create a random geometric graph on twenty nodes where nodes are joined by
+ an edge if their distance is at most 0.1::
+
+ >>> G = nx.random_geometric_graph(20, 0.1)
+
+ Notes
+ -----
+ This uses a *k*-d tree to build the graph.
+
+ The `pos` keyword argument can be used to specify node positions so you
+ can create an arbitrary distribution and domain for positions.
+
+ For example, to use a 2D Gaussian distribution of node positions with mean
+ (0, 0) and standard deviation 2::
+
+ >>> import random
+ >>> n = 20
+ >>> pos = {i: (random.gauss(0, 2), random.gauss(0, 2)) for i in range(n)}
+ >>> G = nx.random_geometric_graph(n, 0.2, pos=pos)
+
+ References
+ ----------
+ .. [1] Penrose, Mathew, *Random Geometric Graphs*,
+ Oxford Studies in Probability, 5, 2003.
+
+ """
+ # TODO Is this function just a special case of the geographical
+ # threshold graph?
+ #
+ # half_radius = {v: radius / 2 for v in n}
+ # return geographical_threshold_graph(nodes, theta=1, alpha=1,
+ # weight=half_radius)
+ #
+ G = nx.empty_graph(n)
+ # If no positions are provided, choose uniformly random vectors in
+ # Euclidean space of the specified dimension.
+ if pos is None:
+ pos = {v: [seed.random() for i in range(dim)] for v in G}
+ nx.set_node_attributes(G, pos, pos_name)
+
+ G.add_edges_from(_geometric_edges(G, radius, p, pos_name))
+ return G
+
+
+@py_random_state(6)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def soft_random_geometric_graph(
+ n, radius, dim=2, pos=None, p=2, p_dist=None, seed=None, *, pos_name="pos"
+):
+ r"""Returns a soft random geometric graph in the unit cube.
+
+ The soft random geometric graph [1] model places `n` nodes uniformly at
+ random in the unit cube in dimension `dim`. Two nodes of distance, `dist`,
+ computed by the `p`-Minkowski distance metric are joined by an edge with
+ probability `p_dist` if the computed distance metric value of the nodes
+ is at most `radius`, otherwise they are not joined.
+
+ Edges within `radius` of each other are determined using a KDTree when
+ SciPy is available. This reduces the time complexity from :math:`O(n^2)`
+ to :math:`O(n)`.
+
+ Parameters
+ ----------
+ n : int or iterable
+ Number of nodes or iterable of nodes
+ radius: float
+ Distance threshold value
+ dim : int, optional
+ Dimension of graph
+ pos : dict, optional
+ A dictionary keyed by node with node positions as values.
+ p : float, optional
+ Which Minkowski distance metric to use.
+ `p` has to meet the condition ``1 <= p <= infinity``.
+
+ If this argument is not specified, the :math:`L^2` metric
+ (the Euclidean distance metric), p = 2 is used.
+
+ This should not be confused with the `p` of an Erdős-Rényi random
+ graph, which represents probability.
+ p_dist : function, optional
+ A probability density function computing the probability of
+ connecting two nodes that are of distance, dist, computed by the
+ Minkowski distance metric. The probability density function, `p_dist`,
+ must be any function that takes the metric value as input
+ and outputs a single probability value between 0-1. The scipy.stats
+ package has many probability distribution functions implemented and
+ tools for custom probability distribution definitions [2], and passing
+ the .pdf method of scipy.stats distributions can be used here. If the
+ probability function, `p_dist`, is not supplied, the default function
+ is an exponential distribution with rate parameter :math:`\lambda=1`.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ pos_name : string, default="pos"
+ The name of the node attribute which represents the position
+ in 2D coordinates of the node in the returned graph.
+
+ Returns
+ -------
+ Graph
+ A soft random geometric graph, undirected and without self-loops.
+ Each node has a node attribute ``'pos'`` that stores the
+ position of that node in Euclidean space as provided by the
+ ``pos`` keyword argument or, if ``pos`` was not provided, as
+ generated by this function.
+
+ Examples
+ --------
+ Default Graph:
+
+ G = nx.soft_random_geometric_graph(50, 0.2)
+
+ Custom Graph:
+
+ Create a soft random geometric graph on 100 uniformly distributed nodes
+ where nodes are joined by an edge with probability computed from an
+ exponential distribution with rate parameter :math:`\lambda=1` if their
+ Euclidean distance is at most 0.2.
+
+ Notes
+ -----
+ This uses a *k*-d tree to build the graph.
+
+ The `pos` keyword argument can be used to specify node positions so you
+ can create an arbitrary distribution and domain for positions.
+
+ For example, to use a 2D Gaussian distribution of node positions with mean
+ (0, 0) and standard deviation 2
+
+ The scipy.stats package can be used to define the probability distribution
+ with the .pdf method used as `p_dist`.
+
+ ::
+
+ >>> import random
+ >>> import math
+ >>> n = 100
+ >>> pos = {i: (random.gauss(0, 2), random.gauss(0, 2)) for i in range(n)}
+ >>> p_dist = lambda dist: math.exp(-dist)
+ >>> G = nx.soft_random_geometric_graph(n, 0.2, pos=pos, p_dist=p_dist)
+
+ References
+ ----------
+ .. [1] Penrose, Mathew D. "Connectivity of soft random geometric graphs."
+ The Annals of Applied Probability 26.2 (2016): 986-1028.
+ .. [2] scipy.stats -
+ https://docs.scipy.org/doc/scipy/reference/tutorial/stats.html
+
+ """
+ G = nx.empty_graph(n)
+ G.name = f"soft_random_geometric_graph({n}, {radius}, {dim})"
+ # If no positions are provided, choose uniformly random vectors in
+ # Euclidean space of the specified dimension.
+ if pos is None:
+ pos = {v: [seed.random() for i in range(dim)] for v in G}
+ nx.set_node_attributes(G, pos, pos_name)
+
+ # if p_dist function not supplied the default function is an exponential
+ # distribution with rate parameter :math:`\lambda=1`.
+ if p_dist is None:
+
+ def p_dist(dist):
+ return math.exp(-dist)
+
+ def should_join(edge):
+ u, v = edge
+ dist = (sum(abs(a - b) ** p for a, b in zip(pos[u], pos[v]))) ** (1 / p)
+ return seed.random() < p_dist(dist)
+
+ G.add_edges_from(filter(should_join, _geometric_edges(G, radius, p, pos_name)))
+ return G
+
+
+@py_random_state(7)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def geographical_threshold_graph(
+ n,
+ theta,
+ dim=2,
+ pos=None,
+ weight=None,
+ metric=None,
+ p_dist=None,
+ seed=None,
+ *,
+ pos_name="pos",
+ weight_name="weight",
+):
+ r"""Returns a geographical threshold graph.
+
+ The geographical threshold graph model places $n$ nodes uniformly at
+ random in a rectangular domain. Each node $u$ is assigned a weight
+ $w_u$. Two nodes $u$ and $v$ are joined by an edge if
+
+ .. math::
+
+ (w_u + w_v)p_{dist}(r) \ge \theta
+
+ where `r` is the distance between `u` and `v`, `p_dist` is any function of
+ `r`, and :math:`\theta` as the threshold parameter. `p_dist` is used to
+ give weight to the distance between nodes when deciding whether or not
+ they should be connected. The larger `p_dist` is, the more prone nodes
+ separated by `r` are to be connected, and vice versa.
+
+ Parameters
+ ----------
+ n : int or iterable
+ Number of nodes or iterable of nodes
+ theta: float
+ Threshold value
+ dim : int, optional
+ Dimension of graph
+ pos : dict
+ Node positions as a dictionary of tuples keyed by node.
+ weight : dict
+ Node weights as a dictionary of numbers keyed by node.
+ metric : function
+ A metric on vectors of numbers (represented as lists or
+ tuples). This must be a function that accepts two lists (or
+ tuples) as input and yields a number as output. The function
+ must also satisfy the four requirements of a `metric`_.
+ Specifically, if $d$ is the function and $x$, $y$,
+ and $z$ are vectors in the graph, then $d$ must satisfy
+
+ 1. $d(x, y) \ge 0$,
+ 2. $d(x, y) = 0$ if and only if $x = y$,
+ 3. $d(x, y) = d(y, x)$,
+ 4. $d(x, z) \le d(x, y) + d(y, z)$.
+
+ If this argument is not specified, the Euclidean distance metric is
+ used.
+
+ .. _metric: https://en.wikipedia.org/wiki/Metric_%28mathematics%29
+ p_dist : function, optional
+ Any function used to give weight to the distance between nodes when
+ deciding whether or not they should be connected. `p_dist` was
+ originally conceived as a probability density function giving the
+ probability of connecting two nodes that are of metric distance `r`
+ apart. The implementation here allows for more arbitrary definitions
+ of `p_dist` that do not need to correspond to valid probability
+ density functions. The :mod:`scipy.stats` package has many
+ probability density functions implemented and tools for custom
+ probability density definitions, and passing the ``.pdf`` method of
+ scipy.stats distributions can be used here. If ``p_dist=None``
+ (the default), the exponential function :math:`r^{-2}` is used.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ pos_name : string, default="pos"
+ The name of the node attribute which represents the position
+ in 2D coordinates of the node in the returned graph.
+ weight_name : string, default="weight"
+ The name of the node attribute which represents the weight
+ of the node in the returned graph.
+
+ Returns
+ -------
+ Graph
+ A random geographic threshold graph, undirected and without
+ self-loops.
+
+ Each node has a node attribute ``pos`` that stores the
+ position of that node in Euclidean space as provided by the
+ ``pos`` keyword argument or, if ``pos`` was not provided, as
+ generated by this function. Similarly, each node has a node
+ attribute ``weight`` that stores the weight of that node as
+ provided or as generated.
+
+ Examples
+ --------
+ Specify an alternate distance metric using the ``metric`` keyword
+ argument. For example, to use the `taxicab metric`_ instead of the
+ default `Euclidean metric`_::
+
+ >>> dist = lambda x, y: sum(abs(a - b) for a, b in zip(x, y))
+ >>> G = nx.geographical_threshold_graph(10, 0.1, metric=dist)
+
+ .. _taxicab metric: https://en.wikipedia.org/wiki/Taxicab_geometry
+ .. _Euclidean metric: https://en.wikipedia.org/wiki/Euclidean_distance
+
+ Notes
+ -----
+ If weights are not specified they are assigned to nodes by drawing randomly
+ from the exponential distribution with rate parameter $\lambda=1$.
+ To specify weights from a different distribution, use the `weight` keyword
+ argument::
+
+ >>> import random
+ >>> n = 20
+ >>> w = {i: random.expovariate(5.0) for i in range(n)}
+ >>> G = nx.geographical_threshold_graph(20, 50, weight=w)
+
+ If node positions are not specified they are randomly assigned from the
+ uniform distribution.
+
+ References
+ ----------
+ .. [1] Masuda, N., Miwa, H., Konno, N.:
+ Geographical threshold graphs with small-world and scale-free
+ properties.
+ Physical Review E 71, 036108 (2005)
+ .. [2] Milan Bradonjić, Aric Hagberg and Allon G. Percus,
+ Giant component and connectivity in geographical threshold graphs,
+ in Algorithms and Models for the Web-Graph (WAW 2007),
+ Antony Bonato and Fan Chung (Eds), pp. 209--216, 2007
+ """
+ G = nx.empty_graph(n)
+ # If no weights are provided, choose them from an exponential
+ # distribution.
+ if weight is None:
+ weight = {v: seed.expovariate(1) for v in G}
+ # If no positions are provided, choose uniformly random vectors in
+ # Euclidean space of the specified dimension.
+ if pos is None:
+ pos = {v: [seed.random() for i in range(dim)] for v in G}
+ # If no distance metric is provided, use Euclidean distance.
+ if metric is None:
+ metric = math.dist
+ nx.set_node_attributes(G, weight, weight_name)
+ nx.set_node_attributes(G, pos, pos_name)
+
+ # if p_dist is not supplied, use default r^-2
+ if p_dist is None:
+
+ def p_dist(r):
+ return r**-2
+
+ # Returns ``True`` if and only if the nodes whose attributes are
+ # ``du`` and ``dv`` should be joined, according to the threshold
+ # condition.
+ def should_join(pair):
+ u, v = pair
+ u_pos, v_pos = pos[u], pos[v]
+ u_weight, v_weight = weight[u], weight[v]
+ return (u_weight + v_weight) * p_dist(metric(u_pos, v_pos)) >= theta
+
+ G.add_edges_from(filter(should_join, combinations(G, 2)))
+ return G
+
+
+@py_random_state(6)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def waxman_graph(
+ n,
+ beta=0.4,
+ alpha=0.1,
+ L=None,
+ domain=(0, 0, 1, 1),
+ metric=None,
+ seed=None,
+ *,
+ pos_name="pos",
+):
+ r"""Returns a Waxman random graph.
+
+ The Waxman random graph model places `n` nodes uniformly at random
+ in a rectangular domain. Each pair of nodes at distance `d` is
+ joined by an edge with probability
+
+ .. math::
+ p = \beta \exp(-d / \alpha L).
+
+ This function implements both Waxman models, using the `L` keyword
+ argument.
+
+ * Waxman-1: if `L` is not specified, it is set to be the maximum distance
+ between any pair of nodes.
+ * Waxman-2: if `L` is specified, the distance between a pair of nodes is
+ chosen uniformly at random from the interval `[0, L]`.
+
+ Parameters
+ ----------
+ n : int or iterable
+ Number of nodes or iterable of nodes
+ beta: float
+ Model parameter
+ alpha: float
+ Model parameter
+ L : float, optional
+ Maximum distance between nodes. If not specified, the actual distance
+ is calculated.
+ domain : four-tuple of numbers, optional
+ Domain size, given as a tuple of the form `(x_min, y_min, x_max,
+ y_max)`.
+ metric : function
+ A metric on vectors of numbers (represented as lists or
+ tuples). This must be a function that accepts two lists (or
+ tuples) as input and yields a number as output. The function
+ must also satisfy the four requirements of a `metric`_.
+ Specifically, if $d$ is the function and $x$, $y$,
+ and $z$ are vectors in the graph, then $d$ must satisfy
+
+ 1. $d(x, y) \ge 0$,
+ 2. $d(x, y) = 0$ if and only if $x = y$,
+ 3. $d(x, y) = d(y, x)$,
+ 4. $d(x, z) \le d(x, y) + d(y, z)$.
+
+ If this argument is not specified, the Euclidean distance metric is
+ used.
+
+ .. _metric: https://en.wikipedia.org/wiki/Metric_%28mathematics%29
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ pos_name : string, default="pos"
+ The name of the node attribute which represents the position
+ in 2D coordinates of the node in the returned graph.
+
+ Returns
+ -------
+ Graph
+ A random Waxman graph, undirected and without self-loops. Each
+ node has a node attribute ``'pos'`` that stores the position of
+ that node in Euclidean space as generated by this function.
+
+ Examples
+ --------
+ Specify an alternate distance metric using the ``metric`` keyword
+ argument. For example, to use the "`taxicab metric`_" instead of the
+ default `Euclidean metric`_::
+
+ >>> dist = lambda x, y: sum(abs(a - b) for a, b in zip(x, y))
+ >>> G = nx.waxman_graph(10, 0.5, 0.1, metric=dist)
+
+ .. _taxicab metric: https://en.wikipedia.org/wiki/Taxicab_geometry
+ .. _Euclidean metric: https://en.wikipedia.org/wiki/Euclidean_distance
+
+ Notes
+ -----
+ Starting in NetworkX 2.0 the parameters alpha and beta align with their
+ usual roles in the probability distribution. In earlier versions their
+ positions in the expression were reversed. Their position in the calling
+ sequence reversed as well to minimize backward incompatibility.
+
+ References
+ ----------
+ .. [1] B. M. Waxman, *Routing of multipoint connections*.
+ IEEE J. Select. Areas Commun. 6(9),(1988) 1617--1622.
+ """
+ G = nx.empty_graph(n)
+ (xmin, ymin, xmax, ymax) = domain
+ # Each node gets a uniformly random position in the given rectangle.
+ pos = {v: (seed.uniform(xmin, xmax), seed.uniform(ymin, ymax)) for v in G}
+ nx.set_node_attributes(G, pos, pos_name)
+ # If no distance metric is provided, use Euclidean distance.
+ if metric is None:
+ metric = math.dist
+ # If the maximum distance L is not specified (that is, we are in the
+ # Waxman-1 model), then find the maximum distance between any pair
+ # of nodes.
+ #
+ # In the Waxman-1 model, join nodes randomly based on distance. In
+ # the Waxman-2 model, join randomly based on random l.
+ if L is None:
+ L = max(metric(x, y) for x, y in combinations(pos.values(), 2))
+
+ def dist(u, v):
+ return metric(pos[u], pos[v])
+
+ else:
+
+ def dist(u, v):
+ return seed.random() * L
+
+ # `pair` is the pair of nodes to decide whether to join.
+ def should_join(pair):
+ return seed.random() < beta * math.exp(-dist(*pair) / (alpha * L))
+
+ G.add_edges_from(filter(should_join, combinations(G, 2)))
+ return G
+
+
+@py_random_state(5)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def navigable_small_world_graph(n, p=1, q=1, r=2, dim=2, seed=None):
+ r"""Returns a navigable small-world graph.
+
+ A navigable small-world graph is a directed grid with additional long-range
+ connections that are chosen randomly.
+
+ [...] we begin with a set of nodes [...] that are identified with the set
+ of lattice points in an $n \times n$ square,
+ $\{(i, j): i \in \{1, 2, \ldots, n\}, j \in \{1, 2, \ldots, n\}\}$,
+ and we define the *lattice distance* between two nodes $(i, j)$ and
+ $(k, l)$ to be the number of "lattice steps" separating them:
+ $d((i, j), (k, l)) = |k - i| + |l - j|$.
+
+ For a universal constant $p >= 1$, the node $u$ has a directed edge to
+ every other node within lattice distance $p$---these are its *local
+ contacts*. For universal constants $q >= 0$ and $r >= 0$ we also
+ construct directed edges from $u$ to $q$ other nodes (the *long-range
+ contacts*) using independent random trials; the $i$th directed edge from
+ $u$ has endpoint $v$ with probability proportional to $[d(u,v)]^{-r}$.
+
+ -- [1]_
+
+ Parameters
+ ----------
+ n : int
+ The length of one side of the lattice; the number of nodes in
+ the graph is therefore $n^2$.
+ p : int
+ The diameter of short range connections. Each node is joined with every
+ other node within this lattice distance.
+ q : int
+ The number of long-range connections for each node.
+ r : float
+ Exponent for decaying probability of connections. The probability of
+ connecting to a node at lattice distance $d$ is $1/d^r$.
+ dim : int
+ Dimension of grid
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ References
+ ----------
+ .. [1] J. Kleinberg. The small-world phenomenon: An algorithmic
+ perspective. Proc. 32nd ACM Symposium on Theory of Computing, 2000.
+ """
+ if p < 1:
+ raise nx.NetworkXException("p must be >= 1")
+ if q < 0:
+ raise nx.NetworkXException("q must be >= 0")
+ if r < 0:
+ raise nx.NetworkXException("r must be >= 0")
+
+ G = nx.DiGraph()
+ nodes = list(product(range(n), repeat=dim))
+ for p1 in nodes:
+ probs = [0]
+ for p2 in nodes:
+ if p1 == p2:
+ continue
+ d = sum((abs(b - a) for a, b in zip(p1, p2)))
+ if d <= p:
+ G.add_edge(p1, p2)
+ probs.append(d**-r)
+ cdf = list(accumulate(probs))
+ for _ in range(q):
+ target = nodes[bisect_left(cdf, seed.uniform(0, cdf[-1]))]
+ G.add_edge(p1, target)
+ return G
+
+
+@py_random_state(7)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def thresholded_random_geometric_graph(
+ n,
+ radius,
+ theta,
+ dim=2,
+ pos=None,
+ weight=None,
+ p=2,
+ seed=None,
+ *,
+ pos_name="pos",
+ weight_name="weight",
+):
+ r"""Returns a thresholded random geometric graph in the unit cube.
+
+ The thresholded random geometric graph [1] model places `n` nodes
+ uniformly at random in the unit cube of dimensions `dim`. Each node
+ `u` is assigned a weight :math:`w_u`. Two nodes `u` and `v` are
+ joined by an edge if they are within the maximum connection distance,
+ `radius` computed by the `p`-Minkowski distance and the summation of
+ weights :math:`w_u` + :math:`w_v` is greater than or equal
+ to the threshold parameter `theta`.
+
+ Edges within `radius` of each other are determined using a KDTree when
+ SciPy is available. This reduces the time complexity from :math:`O(n^2)`
+ to :math:`O(n)`.
+
+ Parameters
+ ----------
+ n : int or iterable
+ Number of nodes or iterable of nodes
+ radius: float
+ Distance threshold value
+ theta: float
+ Threshold value
+ dim : int, optional
+ Dimension of graph
+ pos : dict, optional
+ A dictionary keyed by node with node positions as values.
+ weight : dict, optional
+ Node weights as a dictionary of numbers keyed by node.
+ p : float, optional (default 2)
+ Which Minkowski distance metric to use. `p` has to meet the condition
+ ``1 <= p <= infinity``.
+
+ If this argument is not specified, the :math:`L^2` metric
+ (the Euclidean distance metric), p = 2 is used.
+
+ This should not be confused with the `p` of an Erdős-Rényi random
+ graph, which represents probability.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ pos_name : string, default="pos"
+ The name of the node attribute which represents the position
+ in 2D coordinates of the node in the returned graph.
+ weight_name : string, default="weight"
+ The name of the node attribute which represents the weight
+ of the node in the returned graph.
+
+ Returns
+ -------
+ Graph
+ A thresholded random geographic graph, undirected and without
+ self-loops.
+
+ Each node has a node attribute ``'pos'`` that stores the
+ position of that node in Euclidean space as provided by the
+ ``pos`` keyword argument or, if ``pos`` was not provided, as
+ generated by this function. Similarly, each node has a nodethre
+ attribute ``'weight'`` that stores the weight of that node as
+ provided or as generated.
+
+ Examples
+ --------
+ Default Graph:
+
+ G = nx.thresholded_random_geometric_graph(50, 0.2, 0.1)
+
+ Custom Graph:
+
+ Create a thresholded random geometric graph on 50 uniformly distributed
+ nodes where nodes are joined by an edge if their sum weights drawn from
+ a exponential distribution with rate = 5 are >= theta = 0.1 and their
+ Euclidean distance is at most 0.2.
+
+ Notes
+ -----
+ This uses a *k*-d tree to build the graph.
+
+ The `pos` keyword argument can be used to specify node positions so you
+ can create an arbitrary distribution and domain for positions.
+
+ For example, to use a 2D Gaussian distribution of node positions with mean
+ (0, 0) and standard deviation 2
+
+ If weights are not specified they are assigned to nodes by drawing randomly
+ from the exponential distribution with rate parameter :math:`\lambda=1`.
+ To specify weights from a different distribution, use the `weight` keyword
+ argument::
+
+ ::
+
+ >>> import random
+ >>> import math
+ >>> n = 50
+ >>> pos = {i: (random.gauss(0, 2), random.gauss(0, 2)) for i in range(n)}
+ >>> w = {i: random.expovariate(5.0) for i in range(n)}
+ >>> G = nx.thresholded_random_geometric_graph(n, 0.2, 0.1, 2, pos, w)
+
+ References
+ ----------
+ .. [1] http://cole-maclean.github.io/blog/files/thesis.pdf
+
+ """
+ G = nx.empty_graph(n)
+ G.name = f"thresholded_random_geometric_graph({n}, {radius}, {theta}, {dim})"
+ # If no weights are provided, choose them from an exponential
+ # distribution.
+ if weight is None:
+ weight = {v: seed.expovariate(1) for v in G}
+ # If no positions are provided, choose uniformly random vectors in
+ # Euclidean space of the specified dimension.
+ if pos is None:
+ pos = {v: [seed.random() for i in range(dim)] for v in G}
+ # If no distance metric is provided, use Euclidean distance.
+ nx.set_node_attributes(G, weight, weight_name)
+ nx.set_node_attributes(G, pos, pos_name)
+
+ edges = (
+ (u, v)
+ for u, v in _geometric_edges(G, radius, p, pos_name)
+ if weight[u] + weight[v] >= theta
+ )
+ G.add_edges_from(edges)
+ return G
+
+
+@py_random_state(5)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def geometric_soft_configuration_graph(
+ *, beta, n=None, gamma=None, mean_degree=None, kappas=None, seed=None
+):
+ r"""Returns a random graph from the geometric soft configuration model.
+
+ The $\mathbb{S}^1$ model [1]_ is the geometric soft configuration model
+ which is able to explain many fundamental features of real networks such as
+ small-world property, heteregenous degree distributions, high level of
+ clustering, and self-similarity.
+
+ In the geometric soft configuration model, a node $i$ is assigned two hidden
+ variables: a hidden degree $\kappa_i$, quantifying its popularity, influence,
+ or importance, and an angular position $\theta_i$ in a circle abstracting the
+ similarity space, where angular distances between nodes are a proxy for their
+ similarity. Focusing on the angular position, this model is often called
+ the $\mathbb{S}^1$ model (a one-dimensional sphere). The circle's radius is
+ adjusted to $R = N/2\pi$, where $N$ is the number of nodes, so that the density
+ is set to 1 without loss of generality.
+
+ The connection probability between any pair of nodes increases with
+ the product of their hidden degrees (i.e., their combined popularities),
+ and decreases with the angular distance between the two nodes.
+ Specifically, nodes $i$ and $j$ are connected with the probability
+
+ $p_{ij} = \frac{1}{1 + \frac{d_{ij}^\beta}{\left(\mu \kappa_i \kappa_j\right)^{\max(1, \beta)}}}$
+
+ where $d_{ij} = R\Delta\theta_{ij}$ is the arc length of the circle between
+ nodes $i$ and $j$ separated by an angular distance $\Delta\theta_{ij}$.
+ Parameters $\mu$ and $\beta$ (also called inverse temperature) control the
+ average degree and the clustering coefficient, respectively.
+
+ It can be shown [2]_ that the model undergoes a structural phase transition
+ at $\beta=1$ so that for $\beta<1$ networks are unclustered in the thermodynamic
+ limit (when $N\to \infty$) whereas for $\beta>1$ the ensemble generates
+ networks with finite clustering coefficient.
+
+ The $\mathbb{S}^1$ model can be expressed as a purely geometric model
+ $\mathbb{H}^2$ in the hyperbolic plane [3]_ by mapping the hidden degree of
+ each node into a radial coordinate as
+
+ $r_i = \hat{R} - \frac{2 \max(1, \beta)}{\beta \zeta} \ln \left(\frac{\kappa_i}{\kappa_0}\right)$
+
+ where $\hat{R}$ is the radius of the hyperbolic disk and $\zeta$ is the curvature,
+
+ $\hat{R} = \frac{2}{\zeta} \ln \left(\frac{N}{\pi}\right)
+ - \frac{2\max(1, \beta)}{\beta \zeta} \ln (\mu \kappa_0^2)$
+
+ The connection probability then reads
+
+ $p_{ij} = \frac{1}{1 + \exp\left({\frac{\beta\zeta}{2} (x_{ij} - \hat{R})}\right)}$
+
+ where
+
+ $x_{ij} = r_i + r_j + \frac{2}{\zeta} \ln \frac{\Delta\theta_{ij}}{2}$
+
+ is a good approximation of the hyperbolic distance between two nodes separated
+ by an angular distance $\Delta\theta_{ij}$ with radial coordinates $r_i$ and $r_j$.
+ For $\beta > 1$, the curvature $\zeta = 1$, for $\beta < 1$, $\zeta = \beta^{-1}$.
+
+
+ Parameters
+ ----------
+ Either `n`, `gamma`, `mean_degree` are provided or `kappas`. The values of
+ `n`, `gamma`, `mean_degree` (if provided) are used to construct a random
+ kappa-dict keyed by node with values sampled from a power-law distribution.
+
+ beta : positive number
+ Inverse temperature, controlling the clustering coefficient.
+ n : int (default: None)
+ Size of the network (number of nodes).
+ If not provided, `kappas` must be provided and holds the nodes.
+ gamma : float (default: None)
+ Exponent of the power-law distribution for hidden degrees `kappas`.
+ If not provided, `kappas` must be provided directly.
+ mean_degree : float (default: None)
+ The mean degree in the network.
+ If not provided, `kappas` must be provided directly.
+ kappas : dict (default: None)
+ A dict keyed by node to its hidden degree value.
+ If not provided, random values are computed based on a power-law
+ distribution using `n`, `gamma` and `mean_degree`.
+ seed : int, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ Graph
+ A random geometric soft configuration graph (undirected with no self-loops).
+ Each node has three node-attributes:
+
+ - ``kappa`` that represents the hidden degree.
+
+ - ``theta`` the position in the similarity space ($\mathbb{S}^1$) which is
+ also the angular position in the hyperbolic plane.
+
+ - ``radius`` the radial position in the hyperbolic plane
+ (based on the hidden degree).
+
+
+ Examples
+ --------
+ Generate a network with specified parameters:
+
+ >>> G = nx.geometric_soft_configuration_graph(
+ ... beta=1.5, n=100, gamma=2.7, mean_degree=5
+ ... )
+
+ Create a geometric soft configuration graph with 100 nodes. The $\beta$ parameter
+ is set to 1.5 and the exponent of the powerlaw distribution of the hidden
+ degrees is 2.7 with mean value of 5.
+
+ Generate a network with predefined hidden degrees:
+
+ >>> kappas = {i: 10 for i in range(100)}
+ >>> G = nx.geometric_soft_configuration_graph(beta=2.5, kappas=kappas)
+
+ Create a geometric soft configuration graph with 100 nodes. The $\beta$ parameter
+ is set to 2.5 and all nodes with hidden degree $\kappa=10$.
+
+
+ References
+ ----------
+ .. [1] Serrano, M. Á., Krioukov, D., & Boguñá, M. (2008). Self-similarity
+ of complex networks and hidden metric spaces. Physical review letters, 100(7), 078701.
+
+ .. [2] van der Kolk, J., Serrano, M. Á., & Boguñá, M. (2022). An anomalous
+ topological phase transition in spatial random graphs. Communications Physics, 5(1), 245.
+
+ .. [3] Krioukov, D., Papadopoulos, F., Kitsak, M., Vahdat, A., & Boguná, M. (2010).
+ Hyperbolic geometry of complex networks. Physical Review E, 82(3), 036106.
+
+ """
+ if beta <= 0:
+ raise nx.NetworkXError("The parameter beta cannot be smaller or equal to 0.")
+
+ if kappas is not None:
+ if not all((n is None, gamma is None, mean_degree is None)):
+ raise nx.NetworkXError(
+ "When kappas is input, n, gamma and mean_degree must not be."
+ )
+
+ n = len(kappas)
+ mean_degree = sum(kappas) / len(kappas)
+ else:
+ if any((n is None, gamma is None, mean_degree is None)):
+ raise nx.NetworkXError(
+ "Please provide either kappas, or all 3 of: n, gamma and mean_degree."
+ )
+
+ # Generate `n` hidden degrees from a powerlaw distribution
+ # with given exponent `gamma` and mean value `mean_degree`
+ gam_ratio = (gamma - 2) / (gamma - 1)
+ kappa_0 = mean_degree * gam_ratio * (1 - 1 / n) / (1 - 1 / n**gam_ratio)
+ base = 1 - 1 / n
+ power = 1 / (1 - gamma)
+ kappas = {i: kappa_0 * (1 - seed.random() * base) ** power for i in range(n)}
+
+ G = nx.Graph()
+ R = n / (2 * math.pi)
+
+ # Approximate values for mu in the thermodynamic limit (when n -> infinity)
+ if beta > 1:
+ mu = beta * math.sin(math.pi / beta) / (2 * math.pi * mean_degree)
+ elif beta == 1:
+ mu = 1 / (2 * mean_degree * math.log(n))
+ else:
+ mu = (1 - beta) / (2**beta * mean_degree * n ** (1 - beta))
+
+ # Generate random positions on a circle
+ thetas = {k: seed.uniform(0, 2 * math.pi) for k in kappas}
+
+ for u in kappas:
+ for v in list(G):
+ angle = math.pi - math.fabs(math.pi - math.fabs(thetas[u] - thetas[v]))
+ dij = math.pow(R * angle, beta)
+ mu_kappas = math.pow(mu * kappas[u] * kappas[v], max(1, beta))
+ p_ij = 1 / (1 + dij / mu_kappas)
+
+ # Create an edge with a certain connection probability
+ if seed.random() < p_ij:
+ G.add_edge(u, v)
+ G.add_node(u)
+
+ nx.set_node_attributes(G, thetas, "theta")
+ nx.set_node_attributes(G, kappas, "kappa")
+
+ # Map hidden degrees into the radial coordinates
+ zeta = 1 if beta > 1 else 1 / beta
+ kappa_min = min(kappas.values())
+ R_c = 2 * max(1, beta) / (beta * zeta)
+ R_hat = (2 / zeta) * math.log(n / math.pi) - R_c * math.log(mu * kappa_min)
+ radii = {node: R_hat - R_c * math.log(kappa) for node, kappa in kappas.items()}
+ nx.set_node_attributes(G, radii, "radius")
+
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/harary_graph.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/harary_graph.py
new file mode 100644
index 0000000000000000000000000000000000000000..591587d3aca68176a1d781eb1900b0feb04567e4
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/harary_graph.py
@@ -0,0 +1,199 @@
+"""Generators for Harary graphs
+
+This module gives two generators for the Harary graph, which was
+introduced by the famous mathematician Frank Harary in his 1962 work [H]_.
+The first generator gives the Harary graph that maximizes the node
+connectivity with given number of nodes and given number of edges.
+The second generator gives the Harary graph that minimizes
+the number of edges in the graph with given node connectivity and
+number of nodes.
+
+References
+----------
+.. [H] Harary, F. "The Maximum Connectivity of a Graph."
+ Proc. Nat. Acad. Sci. USA 48, 1142-1146, 1962.
+
+"""
+
+import networkx as nx
+from networkx.exception import NetworkXError
+
+__all__ = ["hnm_harary_graph", "hkn_harary_graph"]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def hnm_harary_graph(n, m, create_using=None):
+ """Returns the Harary graph with given numbers of nodes and edges.
+
+ The Harary graph $H_{n,m}$ is the graph that maximizes node connectivity
+ with $n$ nodes and $m$ edges.
+
+ This maximum node connectivity is known to be floor($2m/n$). [1]_
+
+ Parameters
+ ----------
+ n: integer
+ The number of nodes the generated graph is to contain
+
+ m: integer
+ The number of edges the generated graph is to contain
+
+ create_using : NetworkX graph constructor, optional Graph type
+ to create (default=nx.Graph). If graph instance, then cleared
+ before populated.
+
+ Returns
+ -------
+ NetworkX graph
+ The Harary graph $H_{n,m}$.
+
+ See Also
+ --------
+ hkn_harary_graph
+
+ Notes
+ -----
+ This algorithm runs in $O(m)$ time.
+ It is implemented by following the Reference [2]_.
+
+ References
+ ----------
+ .. [1] F. T. Boesch, A. Satyanarayana, and C. L. Suffel,
+ "A Survey of Some Network Reliability Analysis and Synthesis Results,"
+ Networks, pp. 99-107, 2009.
+
+ .. [2] Harary, F. "The Maximum Connectivity of a Graph."
+ Proc. Nat. Acad. Sci. USA 48, 1142-1146, 1962.
+ """
+
+ if n < 1:
+ raise NetworkXError("The number of nodes must be >= 1!")
+ if m < n - 1:
+ raise NetworkXError("The number of edges must be >= n - 1 !")
+ if m > n * (n - 1) // 2:
+ raise NetworkXError("The number of edges must be <= n(n-1)/2")
+
+ # Construct an empty graph with n nodes first
+ H = nx.empty_graph(n, create_using)
+ # Get the floor of average node degree
+ d = 2 * m // n
+
+ # Test the parity of n and d
+ if (n % 2 == 0) or (d % 2 == 0):
+ # Start with a regular graph of d degrees
+ offset = d // 2
+ for i in range(n):
+ for j in range(1, offset + 1):
+ H.add_edge(i, (i - j) % n)
+ H.add_edge(i, (i + j) % n)
+ if d & 1:
+ # in case d is odd; n must be even in this case
+ half = n // 2
+ for i in range(half):
+ # add edges diagonally
+ H.add_edge(i, i + half)
+ # Get the remainder of 2*m modulo n
+ r = 2 * m % n
+ if r > 0:
+ # add remaining edges at offset+1
+ for i in range(r // 2):
+ H.add_edge(i, i + offset + 1)
+ else:
+ # Start with a regular graph of (d - 1) degrees
+ offset = (d - 1) // 2
+ for i in range(n):
+ for j in range(1, offset + 1):
+ H.add_edge(i, (i - j) % n)
+ H.add_edge(i, (i + j) % n)
+ half = n // 2
+ for i in range(m - n * offset):
+ # add the remaining m - n*offset edges between i and i+half
+ H.add_edge(i, (i + half) % n)
+
+ return H
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def hkn_harary_graph(k, n, create_using=None):
+ """Returns the Harary graph with given node connectivity and node number.
+
+ The Harary graph $H_{k,n}$ is the graph that minimizes the number of
+ edges needed with given node connectivity $k$ and node number $n$.
+
+ This smallest number of edges is known to be ceil($kn/2$) [1]_.
+
+ Parameters
+ ----------
+ k: integer
+ The node connectivity of the generated graph
+
+ n: integer
+ The number of nodes the generated graph is to contain
+
+ create_using : NetworkX graph constructor, optional Graph type
+ to create (default=nx.Graph). If graph instance, then cleared
+ before populated.
+
+ Returns
+ -------
+ NetworkX graph
+ The Harary graph $H_{k,n}$.
+
+ See Also
+ --------
+ hnm_harary_graph
+
+ Notes
+ -----
+ This algorithm runs in $O(kn)$ time.
+ It is implemented by following the Reference [2]_.
+
+ References
+ ----------
+ .. [1] Weisstein, Eric W. "Harary Graph." From MathWorld--A Wolfram Web
+ Resource. http://mathworld.wolfram.com/HararyGraph.html.
+
+ .. [2] Harary, F. "The Maximum Connectivity of a Graph."
+ Proc. Nat. Acad. Sci. USA 48, 1142-1146, 1962.
+ """
+
+ if k < 1:
+ raise NetworkXError("The node connectivity must be >= 1!")
+ if n < k + 1:
+ raise NetworkXError("The number of nodes must be >= k+1 !")
+
+ # in case of connectivity 1, simply return the path graph
+ if k == 1:
+ H = nx.path_graph(n, create_using)
+ return H
+
+ # Construct an empty graph with n nodes first
+ H = nx.empty_graph(n, create_using)
+
+ # Test the parity of k and n
+ if (k % 2 == 0) or (n % 2 == 0):
+ # Construct a regular graph with k degrees
+ offset = k // 2
+ for i in range(n):
+ for j in range(1, offset + 1):
+ H.add_edge(i, (i - j) % n)
+ H.add_edge(i, (i + j) % n)
+ if k & 1:
+ # odd degree; n must be even in this case
+ half = n // 2
+ for i in range(half):
+ # add edges diagonally
+ H.add_edge(i, i + half)
+ else:
+ # Construct a regular graph with (k - 1) degrees
+ offset = (k - 1) // 2
+ for i in range(n):
+ for j in range(1, offset + 1):
+ H.add_edge(i, (i - j) % n)
+ H.add_edge(i, (i + j) % n)
+ half = n // 2
+ for i in range(half + 1):
+ # add half+1 edges between i and i+half
+ H.add_edge(i, (i + half) % n)
+
+ return H
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/internet_as_graphs.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/internet_as_graphs.py
new file mode 100644
index 0000000000000000000000000000000000000000..449d54376af4981a94ba6324f6d373962a9daaaa
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/internet_as_graphs.py
@@ -0,0 +1,441 @@
+"""Generates graphs resembling the Internet Autonomous System network"""
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+__all__ = ["random_internet_as_graph"]
+
+
+def uniform_int_from_avg(a, m, seed):
+ """Pick a random integer with uniform probability.
+
+ Returns a random integer uniformly taken from a distribution with
+ minimum value 'a' and average value 'm', X~U(a,b), E[X]=m, X in N where
+ b = 2*m - a.
+
+ Notes
+ -----
+ p = (b-floor(b))/2
+ X = X1 + X2; X1~U(a,floor(b)), X2~B(p)
+ E[X] = E[X1] + E[X2] = (floor(b)+a)/2 + (b-floor(b))/2 = (b+a)/2 = m
+ """
+
+ from math import floor
+
+ assert m >= a
+ b = 2 * m - a
+ p = (b - floor(b)) / 2
+ X1 = round(seed.random() * (floor(b) - a) + a)
+ if seed.random() < p:
+ X2 = 1
+ else:
+ X2 = 0
+ return X1 + X2
+
+
+def choose_pref_attach(degs, seed):
+ """Pick a random value, with a probability given by its weight.
+
+ Returns a random choice among degs keys, each of which has a
+ probability proportional to the corresponding dictionary value.
+
+ Parameters
+ ----------
+ degs: dictionary
+ It contains the possible values (keys) and the corresponding
+ probabilities (values)
+ seed: random state
+
+ Returns
+ -------
+ v: object
+ A key of degs or None if degs is empty
+ """
+
+ if len(degs) == 0:
+ return None
+ s = sum(degs.values())
+ if s == 0:
+ return seed.choice(list(degs.keys()))
+ v = seed.random() * s
+
+ nodes = list(degs.keys())
+ i = 0
+ acc = degs[nodes[i]]
+ while v > acc:
+ i += 1
+ acc += degs[nodes[i]]
+ return nodes[i]
+
+
+class AS_graph_generator:
+ """Generates random internet AS graphs."""
+
+ def __init__(self, n, seed):
+ """Initializes variables. Immediate numbers are taken from [1].
+
+ Parameters
+ ----------
+ n: integer
+ Number of graph nodes
+ seed: random state
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ GG: AS_graph_generator object
+
+ References
+ ----------
+ [1] A. Elmokashfi, A. Kvalbein and C. Dovrolis, "On the Scalability of
+ BGP: The Role of Topology Growth," in IEEE Journal on Selected Areas
+ in Communications, vol. 28, no. 8, pp. 1250-1261, October 2010.
+ """
+
+ self.seed = seed
+ self.n_t = min(n, round(self.seed.random() * 2 + 4)) # num of T nodes
+ self.n_m = round(0.15 * n) # number of M nodes
+ self.n_cp = round(0.05 * n) # number of CP nodes
+ self.n_c = max(0, n - self.n_t - self.n_m - self.n_cp) # number of C nodes
+
+ self.d_m = 2 + (2.5 * n) / 10000 # average multihoming degree for M nodes
+ self.d_cp = 2 + (1.5 * n) / 10000 # avg multihoming degree for CP nodes
+ self.d_c = 1 + (5 * n) / 100000 # average multihoming degree for C nodes
+
+ self.p_m_m = 1 + (2 * n) / 10000 # avg num of peer edges between M and M
+ self.p_cp_m = 0.2 + (2 * n) / 10000 # avg num of peer edges between CP, M
+ self.p_cp_cp = 0.05 + (2 * n) / 100000 # avg num of peer edges btwn CP, CP
+
+ self.t_m = 0.375 # probability M's provider is T
+ self.t_cp = 0.375 # probability CP's provider is T
+ self.t_c = 0.125 # probability C's provider is T
+
+ def t_graph(self):
+ """Generates the core mesh network of tier one nodes of a AS graph.
+
+ Returns
+ -------
+ G: Networkx Graph
+ Core network
+ """
+
+ self.G = nx.Graph()
+ for i in range(self.n_t):
+ self.G.add_node(i, type="T")
+ for r in self.regions:
+ self.regions[r].add(i)
+ for j in self.G.nodes():
+ if i != j:
+ self.add_edge(i, j, "peer")
+ self.customers[i] = set()
+ self.providers[i] = set()
+ return self.G
+
+ def add_edge(self, i, j, kind):
+ if kind == "transit":
+ customer = str(i)
+ else:
+ customer = "none"
+ self.G.add_edge(i, j, type=kind, customer=customer)
+
+ def choose_peer_pref_attach(self, node_list):
+ """Pick a node with a probability weighted by its peer degree.
+
+ Pick a node from node_list with preferential attachment
+ computed only on their peer degree
+ """
+
+ d = {}
+ for n in node_list:
+ d[n] = self.G.nodes[n]["peers"]
+ return choose_pref_attach(d, self.seed)
+
+ def choose_node_pref_attach(self, node_list):
+ """Pick a node with a probability weighted by its degree.
+
+ Pick a node from node_list with preferential attachment
+ computed on their degree
+ """
+
+ degs = dict(self.G.degree(node_list))
+ return choose_pref_attach(degs, self.seed)
+
+ def add_customer(self, i, j):
+ """Keep the dictionaries 'customers' and 'providers' consistent."""
+
+ self.customers[j].add(i)
+ self.providers[i].add(j)
+ for z in self.providers[j]:
+ self.customers[z].add(i)
+ self.providers[i].add(z)
+
+ def add_node(self, i, kind, reg2prob, avg_deg, t_edge_prob):
+ """Add a node and its customer transit edges to the graph.
+
+ Parameters
+ ----------
+ i: object
+ Identifier of the new node
+ kind: string
+ Type of the new node. Options are: 'M' for middle node, 'CP' for
+ content provider and 'C' for customer.
+ reg2prob: float
+ Probability the new node can be in two different regions.
+ avg_deg: float
+ Average number of transit nodes of which node i is customer.
+ t_edge_prob: float
+ Probability node i establish a customer transit edge with a tier
+ one (T) node
+
+ Returns
+ -------
+ i: object
+ Identifier of the new node
+ """
+
+ regs = 1 # regions in which node resides
+ if self.seed.random() < reg2prob: # node is in two regions
+ regs = 2
+ node_options = set()
+
+ self.G.add_node(i, type=kind, peers=0)
+ self.customers[i] = set()
+ self.providers[i] = set()
+ self.nodes[kind].add(i)
+ for r in self.seed.sample(list(self.regions), regs):
+ node_options = node_options.union(self.regions[r])
+ self.regions[r].add(i)
+
+ edge_num = uniform_int_from_avg(1, avg_deg, self.seed)
+
+ t_options = node_options.intersection(self.nodes["T"])
+ m_options = node_options.intersection(self.nodes["M"])
+ if i in m_options:
+ m_options.remove(i)
+ d = 0
+ while d < edge_num and (len(t_options) > 0 or len(m_options) > 0):
+ if len(m_options) == 0 or (
+ len(t_options) > 0 and self.seed.random() < t_edge_prob
+ ): # add edge to a T node
+ j = self.choose_node_pref_attach(t_options)
+ t_options.remove(j)
+ else:
+ j = self.choose_node_pref_attach(m_options)
+ m_options.remove(j)
+ self.add_edge(i, j, "transit")
+ self.add_customer(i, j)
+ d += 1
+
+ return i
+
+ def add_m_peering_link(self, m, to_kind):
+ """Add a peering link between two middle tier (M) nodes.
+
+ Target node j is drawn considering a preferential attachment based on
+ other M node peering degree.
+
+ Parameters
+ ----------
+ m: object
+ Node identifier
+ to_kind: string
+ type for target node j (must be always M)
+
+ Returns
+ -------
+ success: boolean
+ """
+
+ # candidates are of type 'M' and are not customers of m
+ node_options = self.nodes["M"].difference(self.customers[m])
+ # candidates are not providers of m
+ node_options = node_options.difference(self.providers[m])
+ # remove self
+ if m in node_options:
+ node_options.remove(m)
+
+ # remove candidates we are already connected to
+ for j in self.G.neighbors(m):
+ if j in node_options:
+ node_options.remove(j)
+
+ if len(node_options) > 0:
+ j = self.choose_peer_pref_attach(node_options)
+ self.add_edge(m, j, "peer")
+ self.G.nodes[m]["peers"] += 1
+ self.G.nodes[j]["peers"] += 1
+ return True
+ else:
+ return False
+
+ def add_cp_peering_link(self, cp, to_kind):
+ """Add a peering link to a content provider (CP) node.
+
+ Target node j can be CP or M and it is drawn uniformly among the nodes
+ belonging to the same region as cp.
+
+ Parameters
+ ----------
+ cp: object
+ Node identifier
+ to_kind: string
+ type for target node j (must be M or CP)
+
+ Returns
+ -------
+ success: boolean
+ """
+
+ node_options = set()
+ for r in self.regions: # options include nodes in the same region(s)
+ if cp in self.regions[r]:
+ node_options = node_options.union(self.regions[r])
+
+ # options are restricted to the indicated kind ('M' or 'CP')
+ node_options = self.nodes[to_kind].intersection(node_options)
+
+ # remove self
+ if cp in node_options:
+ node_options.remove(cp)
+
+ # remove nodes that are cp's providers
+ node_options = node_options.difference(self.providers[cp])
+
+ # remove nodes we are already connected to
+ for j in self.G.neighbors(cp):
+ if j in node_options:
+ node_options.remove(j)
+
+ if len(node_options) > 0:
+ j = self.seed.sample(list(node_options), 1)[0]
+ self.add_edge(cp, j, "peer")
+ self.G.nodes[cp]["peers"] += 1
+ self.G.nodes[j]["peers"] += 1
+ return True
+ else:
+ return False
+
+ def graph_regions(self, rn):
+ """Initializes AS network regions.
+
+ Parameters
+ ----------
+ rn: integer
+ Number of regions
+ """
+
+ self.regions = {}
+ for i in range(rn):
+ self.regions["REG" + str(i)] = set()
+
+ def add_peering_links(self, from_kind, to_kind):
+ """Utility function to add peering links among node groups."""
+ peer_link_method = None
+ if from_kind == "M":
+ peer_link_method = self.add_m_peering_link
+ m = self.p_m_m
+ if from_kind == "CP":
+ peer_link_method = self.add_cp_peering_link
+ if to_kind == "M":
+ m = self.p_cp_m
+ else:
+ m = self.p_cp_cp
+
+ for i in self.nodes[from_kind]:
+ num = uniform_int_from_avg(0, m, self.seed)
+ for _ in range(num):
+ peer_link_method(i, to_kind)
+
+ def generate(self):
+ """Generates a random AS network graph as described in [1].
+
+ Returns
+ -------
+ G: Graph object
+
+ Notes
+ -----
+ The process steps are the following: first we create the core network
+ of tier one nodes, then we add the middle tier (M), the content
+ provider (CP) and the customer (C) nodes along with their transit edges
+ (link i,j means i is customer of j). Finally we add peering links
+ between M nodes, between M and CP nodes and between CP node couples.
+ For a detailed description of the algorithm, please refer to [1].
+
+ References
+ ----------
+ [1] A. Elmokashfi, A. Kvalbein and C. Dovrolis, "On the Scalability of
+ BGP: The Role of Topology Growth," in IEEE Journal on Selected Areas
+ in Communications, vol. 28, no. 8, pp. 1250-1261, October 2010.
+ """
+
+ self.graph_regions(5)
+ self.customers = {}
+ self.providers = {}
+ self.nodes = {"T": set(), "M": set(), "CP": set(), "C": set()}
+
+ self.t_graph()
+ self.nodes["T"] = set(self.G.nodes())
+
+ i = len(self.nodes["T"])
+ for _ in range(self.n_m):
+ self.nodes["M"].add(self.add_node(i, "M", 0.2, self.d_m, self.t_m))
+ i += 1
+ for _ in range(self.n_cp):
+ self.nodes["CP"].add(self.add_node(i, "CP", 0.05, self.d_cp, self.t_cp))
+ i += 1
+ for _ in range(self.n_c):
+ self.nodes["C"].add(self.add_node(i, "C", 0, self.d_c, self.t_c))
+ i += 1
+
+ self.add_peering_links("M", "M")
+ self.add_peering_links("CP", "M")
+ self.add_peering_links("CP", "CP")
+
+ return self.G
+
+
+@py_random_state(1)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_internet_as_graph(n, seed=None):
+ """Generates a random undirected graph resembling the Internet AS network
+
+ Parameters
+ ----------
+ n: integer in [1000, 10000]
+ Number of graph nodes
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G: Networkx Graph object
+ A randomly generated undirected graph
+
+ Notes
+ -----
+ This algorithm returns an undirected graph resembling the Internet
+ Autonomous System (AS) network, it uses the approach by Elmokashfi et al.
+ [1]_ and it grants the properties described in the related paper [1]_.
+
+ Each node models an autonomous system, with an attribute 'type' specifying
+ its kind; tier-1 (T), mid-level (M), customer (C) or content-provider (CP).
+ Each edge models an ADV communication link (hence, bidirectional) with
+ attributes:
+
+ - type: transit|peer, the kind of commercial agreement between nodes;
+ - customer: , the identifier of the node acting as customer
+ ('none' if type is peer).
+
+ References
+ ----------
+ .. [1] A. Elmokashfi, A. Kvalbein and C. Dovrolis, "On the Scalability of
+ BGP: The Role of Topology Growth," in IEEE Journal on Selected Areas
+ in Communications, vol. 28, no. 8, pp. 1250-1261, October 2010.
+ """
+
+ GG = AS_graph_generator(n, seed)
+ G = GG.generate()
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/intersection.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/intersection.py
new file mode 100644
index 0000000000000000000000000000000000000000..e63af5be8eed2e65b9cced2cc50827ffe6a802ba
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/intersection.py
@@ -0,0 +1,125 @@
+"""
+Generators for random intersection graphs.
+"""
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+__all__ = [
+ "uniform_random_intersection_graph",
+ "k_random_intersection_graph",
+ "general_random_intersection_graph",
+]
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def uniform_random_intersection_graph(n, m, p, seed=None):
+ """Returns a uniform random intersection graph.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes in the first bipartite set (nodes)
+ m : int
+ The number of nodes in the second bipartite set (attributes)
+ p : float
+ Probability of connecting nodes between bipartite sets
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ See Also
+ --------
+ gnp_random_graph
+
+ References
+ ----------
+ .. [1] K.B. Singer-Cohen, Random Intersection Graphs, 1995,
+ PhD thesis, Johns Hopkins University
+ .. [2] Fill, J. A., Scheinerman, E. R., and Singer-Cohen, K. B.,
+ Random intersection graphs when m = !(n):
+ An equivalence theorem relating the evolution of the g(n, m, p)
+ and g(n, p) models. Random Struct. Algorithms 16, 2 (2000), 156–176.
+ """
+ from networkx.algorithms import bipartite
+
+ G = bipartite.random_graph(n, m, p, seed)
+ return nx.projected_graph(G, range(n))
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def k_random_intersection_graph(n, m, k, seed=None):
+ """Returns a intersection graph with randomly chosen attribute sets for
+ each node that are of equal size (k).
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes in the first bipartite set (nodes)
+ m : int
+ The number of nodes in the second bipartite set (attributes)
+ k : float
+ Size of attribute set to assign to each node.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ See Also
+ --------
+ gnp_random_graph, uniform_random_intersection_graph
+
+ References
+ ----------
+ .. [1] Godehardt, E., and Jaworski, J.
+ Two models of random intersection graphs and their applications.
+ Electronic Notes in Discrete Mathematics 10 (2001), 129--132.
+ """
+ G = nx.empty_graph(n + m)
+ mset = range(n, n + m)
+ for v in range(n):
+ targets = seed.sample(mset, k)
+ G.add_edges_from(zip([v] * len(targets), targets))
+ return nx.projected_graph(G, range(n))
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def general_random_intersection_graph(n, m, p, seed=None):
+ """Returns a random intersection graph with independent probabilities
+ for connections between node and attribute sets.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes in the first bipartite set (nodes)
+ m : int
+ The number of nodes in the second bipartite set (attributes)
+ p : list of floats of length m
+ Probabilities for connecting nodes to each attribute
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ See Also
+ --------
+ gnp_random_graph, uniform_random_intersection_graph
+
+ References
+ ----------
+ .. [1] Nikoletseas, S. E., Raptopoulos, C., and Spirakis, P. G.
+ The existence and efficient construction of large independent sets
+ in general random intersection graphs. In ICALP (2004), J. D´ıaz,
+ J. Karhum¨aki, A. Lepist¨o, and D. Sannella, Eds., vol. 3142
+ of Lecture Notes in Computer Science, Springer, pp. 1029–1040.
+ """
+ if len(p) != m:
+ raise ValueError("Probability list p must have m elements.")
+ G = nx.empty_graph(n + m)
+ mset = range(n, n + m)
+ for u in range(n):
+ for v, q in zip(mset, p):
+ if seed.random() < q:
+ G.add_edge(u, v)
+ return nx.projected_graph(G, range(n))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/interval_graph.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/interval_graph.py
new file mode 100644
index 0000000000000000000000000000000000000000..6a3fda45acec52af6a5f060b96d9af1067fc002b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/interval_graph.py
@@ -0,0 +1,70 @@
+"""
+Generators for interval graph.
+"""
+
+from collections.abc import Sequence
+
+import networkx as nx
+
+__all__ = ["interval_graph"]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def interval_graph(intervals):
+ """Generates an interval graph for a list of intervals given.
+
+ In graph theory, an interval graph is an undirected graph formed from a set
+ of closed intervals on the real line, with a vertex for each interval
+ and an edge between vertices whose intervals intersect.
+ It is the intersection graph of the intervals.
+
+ More information can be found at:
+ https://en.wikipedia.org/wiki/Interval_graph
+
+ Parameters
+ ----------
+ intervals : a sequence of intervals, say (l, r) where l is the left end,
+ and r is the right end of the closed interval.
+
+ Returns
+ -------
+ G : networkx graph
+
+ Examples
+ --------
+ >>> intervals = [(-2, 3), [1, 4], (2, 3), (4, 6)]
+ >>> G = nx.interval_graph(intervals)
+ >>> sorted(G.edges)
+ [((-2, 3), (1, 4)), ((-2, 3), (2, 3)), ((1, 4), (2, 3)), ((1, 4), (4, 6))]
+
+ Raises
+ ------
+ :exc:`TypeError`
+ if `intervals` contains None or an element which is not
+ collections.abc.Sequence or not a length of 2.
+ :exc:`ValueError`
+ if `intervals` contains an interval such that min1 > max1
+ where min1,max1 = interval
+ """
+ intervals = list(intervals)
+ for interval in intervals:
+ if not (isinstance(interval, Sequence) and len(interval) == 2):
+ raise TypeError(
+ "Each interval must have length 2, and be a "
+ "collections.abc.Sequence such as tuple or list."
+ )
+ if interval[0] > interval[1]:
+ raise ValueError(f"Interval must have lower value first. Got {interval}")
+
+ graph = nx.Graph()
+
+ tupled_intervals = [tuple(interval) for interval in intervals]
+ graph.add_nodes_from(tupled_intervals)
+
+ while tupled_intervals:
+ min1, max1 = interval1 = tupled_intervals.pop()
+ for interval2 in tupled_intervals:
+ min2, max2 = interval2
+ if max1 >= min2 and max2 >= min1:
+ graph.add_edge(interval1, interval2)
+ return graph
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/joint_degree_seq.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/joint_degree_seq.py
new file mode 100644
index 0000000000000000000000000000000000000000..c426df944ad27aef4584371838a6ddb280b90dca
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/joint_degree_seq.py
@@ -0,0 +1,664 @@
+"""Generate graphs with a given joint degree and directed joint degree"""
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+__all__ = [
+ "is_valid_joint_degree",
+ "is_valid_directed_joint_degree",
+ "joint_degree_graph",
+ "directed_joint_degree_graph",
+]
+
+
+@nx._dispatchable(graphs=None)
+def is_valid_joint_degree(joint_degrees):
+ """Checks whether the given joint degree dictionary is realizable.
+
+ A *joint degree dictionary* is a dictionary of dictionaries, in
+ which entry ``joint_degrees[k][l]`` is an integer representing the
+ number of edges joining nodes of degree *k* with nodes of degree
+ *l*. Such a dictionary is realizable as a simple graph if and only
+ if the following conditions are satisfied.
+
+ - each entry must be an integer,
+ - the total number of nodes of degree *k*, computed by
+ ``sum(joint_degrees[k].values()) / k``, must be an integer,
+ - the total number of edges joining nodes of degree *k* with
+ nodes of degree *l* cannot exceed the total number of possible edges,
+ - each diagonal entry ``joint_degrees[k][k]`` must be even (this is
+ a convention assumed by the :func:`joint_degree_graph` function).
+
+
+ Parameters
+ ----------
+ joint_degrees : dictionary of dictionary of integers
+ A joint degree dictionary in which entry ``joint_degrees[k][l]``
+ is the number of edges joining nodes of degree *k* with nodes of
+ degree *l*.
+
+ Returns
+ -------
+ bool
+ Whether the given joint degree dictionary is realizable as a
+ simple graph.
+
+ References
+ ----------
+ .. [1] M. Gjoka, M. Kurant, A. Markopoulou, "2.5K Graphs: from Sampling
+ to Generation", IEEE Infocom, 2013.
+ .. [2] I. Stanton, A. Pinar, "Constructing and sampling graphs with a
+ prescribed joint degree distribution", Journal of Experimental
+ Algorithmics, 2012.
+ """
+
+ degree_count = {}
+ for k in joint_degrees:
+ if k > 0:
+ k_size = sum(joint_degrees[k].values()) / k
+ if not k_size.is_integer():
+ return False
+ degree_count[k] = k_size
+
+ for k in joint_degrees:
+ for l in joint_degrees[k]:
+ if not float(joint_degrees[k][l]).is_integer():
+ return False
+
+ if (k != l) and (joint_degrees[k][l] > degree_count[k] * degree_count[l]):
+ return False
+ elif k == l:
+ if joint_degrees[k][k] > degree_count[k] * (degree_count[k] - 1):
+ return False
+ if joint_degrees[k][k] % 2 != 0:
+ return False
+
+ # if all above conditions have been satisfied then the input
+ # joint degree is realizable as a simple graph.
+ return True
+
+
+def _neighbor_switch(G, w, unsat, h_node_residual, avoid_node_id=None):
+ """Releases one free stub for ``w``, while preserving joint degree in G.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+ Graph in which the neighbor switch will take place.
+ w : integer
+ Node id for which we will execute this neighbor switch.
+ unsat : set of integers
+ Set of unsaturated node ids that have the same degree as w.
+ h_node_residual: dictionary of integers
+ Keeps track of the remaining stubs for a given node.
+ avoid_node_id: integer
+ Node id to avoid when selecting w_prime.
+
+ Notes
+ -----
+ First, it selects *w_prime*, an unsaturated node that has the same degree
+ as ``w``. Second, it selects *switch_node*, a neighbor node of ``w`` that
+ is not connected to *w_prime*. Then it executes an edge swap i.e. removes
+ (``w``,*switch_node*) and adds (*w_prime*,*switch_node*). Gjoka et. al. [1]
+ prove that such an edge swap is always possible.
+
+ References
+ ----------
+ .. [1] M. Gjoka, B. Tillman, A. Markopoulou, "Construction of Simple
+ Graphs with a Target Joint Degree Matrix and Beyond", IEEE Infocom, '15
+ """
+
+ if (avoid_node_id is None) or (h_node_residual[avoid_node_id] > 1):
+ # select unsaturated node w_prime that has the same degree as w
+ w_prime = next(iter(unsat))
+ else:
+ # assume that the node pair (v,w) has been selected for connection. if
+ # - neighbor_switch is called for node w,
+ # - nodes v and w have the same degree,
+ # - node v=avoid_node_id has only one stub left,
+ # then prevent v=avoid_node_id from being selected as w_prime.
+
+ iter_var = iter(unsat)
+ while True:
+ w_prime = next(iter_var)
+ if w_prime != avoid_node_id:
+ break
+
+ # select switch_node, a neighbor of w, that is not connected to w_prime
+ w_prime_neighbs = G[w_prime] # slightly faster declaring this variable
+ for v in G[w]:
+ if (v not in w_prime_neighbs) and (v != w_prime):
+ switch_node = v
+ break
+
+ # remove edge (w,switch_node), add edge (w_prime,switch_node) and update
+ # data structures
+ G.remove_edge(w, switch_node)
+ G.add_edge(w_prime, switch_node)
+ h_node_residual[w] += 1
+ h_node_residual[w_prime] -= 1
+ if h_node_residual[w_prime] == 0:
+ unsat.remove(w_prime)
+
+
+@py_random_state(1)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def joint_degree_graph(joint_degrees, seed=None):
+ """Generates a random simple graph with the given joint degree dictionary.
+
+ Parameters
+ ----------
+ joint_degrees : dictionary of dictionary of integers
+ A joint degree dictionary in which entry ``joint_degrees[k][l]`` is the
+ number of edges joining nodes of degree *k* with nodes of degree *l*.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : Graph
+ A graph with the specified joint degree dictionary.
+
+ Raises
+ ------
+ NetworkXError
+ If *joint_degrees* dictionary is not realizable.
+
+ Notes
+ -----
+ In each iteration of the "while loop" the algorithm picks two disconnected
+ nodes *v* and *w*, of degree *k* and *l* correspondingly, for which
+ ``joint_degrees[k][l]`` has not reached its target yet. It then adds
+ edge (*v*, *w*) and increases the number of edges in graph G by one.
+
+ The intelligence of the algorithm lies in the fact that it is always
+ possible to add an edge between such disconnected nodes *v* and *w*,
+ even if one or both nodes do not have free stubs. That is made possible by
+ executing a "neighbor switch", an edge rewiring move that releases
+ a free stub while keeping the joint degree of G the same.
+
+ The algorithm continues for E (number of edges) iterations of
+ the "while loop", at the which point all entries of the given
+ ``joint_degrees[k][l]`` have reached their target values and the
+ construction is complete.
+
+ References
+ ----------
+ .. [1] M. Gjoka, B. Tillman, A. Markopoulou, "Construction of Simple
+ Graphs with a Target Joint Degree Matrix and Beyond", IEEE Infocom, '15
+
+ Examples
+ --------
+ >>> joint_degrees = {
+ ... 1: {4: 1},
+ ... 2: {2: 2, 3: 2, 4: 2},
+ ... 3: {2: 2, 4: 1},
+ ... 4: {1: 1, 2: 2, 3: 1},
+ ... }
+ >>> G = nx.joint_degree_graph(joint_degrees)
+ >>>
+ """
+
+ if not is_valid_joint_degree(joint_degrees):
+ msg = "Input joint degree dict not realizable as a simple graph"
+ raise nx.NetworkXError(msg)
+
+ # compute degree count from joint_degrees
+ degree_count = {k: sum(l.values()) // k for k, l in joint_degrees.items() if k > 0}
+
+ # start with empty N-node graph
+ N = sum(degree_count.values())
+ G = nx.empty_graph(N)
+
+ # for a given degree group, keep the list of all node ids
+ h_degree_nodelist = {}
+
+ # for a given node, keep track of the remaining stubs
+ h_node_residual = {}
+
+ # populate h_degree_nodelist and h_node_residual
+ nodeid = 0
+ for degree, num_nodes in degree_count.items():
+ h_degree_nodelist[degree] = range(nodeid, nodeid + num_nodes)
+ for v in h_degree_nodelist[degree]:
+ h_node_residual[v] = degree
+ nodeid += int(num_nodes)
+
+ # iterate over every degree pair (k,l) and add the number of edges given
+ # for each pair
+ for k in joint_degrees:
+ for l in joint_degrees[k]:
+ # n_edges_add is the number of edges to add for the
+ # degree pair (k,l)
+ n_edges_add = joint_degrees[k][l]
+
+ if (n_edges_add > 0) and (k >= l):
+ # number of nodes with degree k and l
+ k_size = degree_count[k]
+ l_size = degree_count[l]
+
+ # k_nodes and l_nodes consist of all nodes of degree k and l
+ k_nodes = h_degree_nodelist[k]
+ l_nodes = h_degree_nodelist[l]
+
+ # k_unsat and l_unsat consist of nodes of degree k and l that
+ # are unsaturated (nodes that have at least 1 available stub)
+ k_unsat = {v for v in k_nodes if h_node_residual[v] > 0}
+
+ if k != l:
+ l_unsat = {w for w in l_nodes if h_node_residual[w] > 0}
+ else:
+ l_unsat = k_unsat
+ n_edges_add = joint_degrees[k][l] // 2
+
+ while n_edges_add > 0:
+ # randomly pick nodes v and w that have degrees k and l
+ v = k_nodes[seed.randrange(k_size)]
+ w = l_nodes[seed.randrange(l_size)]
+
+ # if nodes v and w are disconnected then attempt to connect
+ if not G.has_edge(v, w) and (v != w):
+ # if node v has no free stubs then do neighbor switch
+ if h_node_residual[v] == 0:
+ _neighbor_switch(G, v, k_unsat, h_node_residual)
+
+ # if node w has no free stubs then do neighbor switch
+ if h_node_residual[w] == 0:
+ if k != l:
+ _neighbor_switch(G, w, l_unsat, h_node_residual)
+ else:
+ _neighbor_switch(
+ G, w, l_unsat, h_node_residual, avoid_node_id=v
+ )
+
+ # add edge (v, w) and update data structures
+ G.add_edge(v, w)
+ h_node_residual[v] -= 1
+ h_node_residual[w] -= 1
+ n_edges_add -= 1
+
+ if h_node_residual[v] == 0:
+ k_unsat.discard(v)
+ if h_node_residual[w] == 0:
+ l_unsat.discard(w)
+ return G
+
+
+@nx._dispatchable(graphs=None)
+def is_valid_directed_joint_degree(in_degrees, out_degrees, nkk):
+ """Checks whether the given directed joint degree input is realizable
+
+ Parameters
+ ----------
+ in_degrees : list of integers
+ in degree sequence contains the in degrees of nodes.
+ out_degrees : list of integers
+ out degree sequence contains the out degrees of nodes.
+ nkk : dictionary of dictionary of integers
+ directed joint degree dictionary. for nodes of out degree k (first
+ level of dict) and nodes of in degree l (second level of dict)
+ describes the number of edges.
+
+ Returns
+ -------
+ boolean
+ returns true if given input is realizable, else returns false.
+
+ Notes
+ -----
+ Here is the list of conditions that the inputs (in/out degree sequences,
+ nkk) need to satisfy for simple directed graph realizability:
+
+ - Condition 0: in_degrees and out_degrees have the same length
+ - Condition 1: nkk[k][l] is integer for all k,l
+ - Condition 2: sum(nkk[k])/k = number of nodes with partition id k, is an
+ integer and matching degree sequence
+ - Condition 3: number of edges and non-chords between k and l cannot exceed
+ maximum possible number of edges
+
+
+ References
+ ----------
+ [1] B. Tillman, A. Markopoulou, C. T. Butts & M. Gjoka,
+ "Construction of Directed 2K Graphs". In Proc. of KDD 2017.
+ """
+ V = {} # number of nodes with in/out degree.
+ forbidden = {}
+ if len(in_degrees) != len(out_degrees):
+ return False
+
+ for idx in range(len(in_degrees)):
+ i = in_degrees[idx]
+ o = out_degrees[idx]
+ V[(i, 0)] = V.get((i, 0), 0) + 1
+ V[(o, 1)] = V.get((o, 1), 0) + 1
+
+ forbidden[(o, i)] = forbidden.get((o, i), 0) + 1
+
+ S = {} # number of edges going from in/out degree nodes.
+ for k in nkk:
+ for l in nkk[k]:
+ val = nkk[k][l]
+ if not float(val).is_integer(): # condition 1
+ return False
+
+ if val > 0:
+ S[(k, 1)] = S.get((k, 1), 0) + val
+ S[(l, 0)] = S.get((l, 0), 0) + val
+ # condition 3
+ if val + forbidden.get((k, l), 0) > V[(k, 1)] * V[(l, 0)]:
+ return False
+
+ return all(S[s] / s[0] == V[s] for s in S)
+
+
+def _directed_neighbor_switch(
+ G, w, unsat, h_node_residual_out, chords, h_partition_in, partition
+):
+ """Releases one free stub for node w, while preserving joint degree in G.
+
+ Parameters
+ ----------
+ G : networkx directed graph
+ graph within which the edge swap will take place.
+ w : integer
+ node id for which we need to perform a neighbor switch.
+ unsat: set of integers
+ set of node ids that have the same degree as w and are unsaturated.
+ h_node_residual_out: dict of integers
+ for a given node, keeps track of the remaining stubs to be added.
+ chords: set of tuples
+ keeps track of available positions to add edges.
+ h_partition_in: dict of integers
+ for a given node, keeps track of its partition id (in degree).
+ partition: integer
+ partition id to check if chords have to be updated.
+
+ Notes
+ -----
+ First, it selects node w_prime that (1) has the same degree as w and
+ (2) is unsaturated. Then, it selects node v, a neighbor of w, that is
+ not connected to w_prime and does an edge swap i.e. removes (w,v) and
+ adds (w_prime,v). If neighbor switch is not possible for w using
+ w_prime and v, then return w_prime; in [1] it's proven that
+ such unsaturated nodes can be used.
+
+ References
+ ----------
+ [1] B. Tillman, A. Markopoulou, C. T. Butts & M. Gjoka,
+ "Construction of Directed 2K Graphs". In Proc. of KDD 2017.
+ """
+ w_prime = unsat.pop()
+ unsat.add(w_prime)
+ # select node t, a neighbor of w, that is not connected to w_prime
+ w_neighbs = list(G.successors(w))
+ # slightly faster declaring this variable
+ w_prime_neighbs = list(G.successors(w_prime))
+
+ for v in w_neighbs:
+ if (v not in w_prime_neighbs) and w_prime != v:
+ # removes (w,v), add (w_prime,v) and update data structures
+ G.remove_edge(w, v)
+ G.add_edge(w_prime, v)
+
+ if h_partition_in[v] == partition:
+ chords.add((w, v))
+ chords.discard((w_prime, v))
+
+ h_node_residual_out[w] += 1
+ h_node_residual_out[w_prime] -= 1
+ if h_node_residual_out[w_prime] == 0:
+ unsat.remove(w_prime)
+ return None
+
+ # If neighbor switch didn't work, use unsaturated node
+ return w_prime
+
+
+def _directed_neighbor_switch_rev(
+ G, w, unsat, h_node_residual_in, chords, h_partition_out, partition
+):
+ """The reverse of directed_neighbor_switch.
+
+ Parameters
+ ----------
+ G : networkx directed graph
+ graph within which the edge swap will take place.
+ w : integer
+ node id for which we need to perform a neighbor switch.
+ unsat: set of integers
+ set of node ids that have the same degree as w and are unsaturated.
+ h_node_residual_in: dict of integers
+ for a given node, keeps track of the remaining stubs to be added.
+ chords: set of tuples
+ keeps track of available positions to add edges.
+ h_partition_out: dict of integers
+ for a given node, keeps track of its partition id (out degree).
+ partition: integer
+ partition id to check if chords have to be updated.
+
+ Notes
+ -----
+ Same operation as directed_neighbor_switch except it handles this operation
+ for incoming edges instead of outgoing.
+ """
+ w_prime = unsat.pop()
+ unsat.add(w_prime)
+ # slightly faster declaring these as variables.
+ w_neighbs = list(G.predecessors(w))
+ w_prime_neighbs = list(G.predecessors(w_prime))
+ # select node v, a neighbor of w, that is not connected to w_prime.
+ for v in w_neighbs:
+ if (v not in w_prime_neighbs) and w_prime != v:
+ # removes (v,w), add (v,w_prime) and update data structures.
+ G.remove_edge(v, w)
+ G.add_edge(v, w_prime)
+ if h_partition_out[v] == partition:
+ chords.add((v, w))
+ chords.discard((v, w_prime))
+
+ h_node_residual_in[w] += 1
+ h_node_residual_in[w_prime] -= 1
+ if h_node_residual_in[w_prime] == 0:
+ unsat.remove(w_prime)
+ return None
+
+ # If neighbor switch didn't work, use the unsaturated node.
+ return w_prime
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def directed_joint_degree_graph(in_degrees, out_degrees, nkk, seed=None):
+ """Generates a random simple directed graph with the joint degree.
+
+ Parameters
+ ----------
+ degree_seq : list of tuples (of size 3)
+ degree sequence contains tuples of nodes with node id, in degree and
+ out degree.
+ nkk : dictionary of dictionary of integers
+ directed joint degree dictionary, for nodes of out degree k (first
+ level of dict) and nodes of in degree l (second level of dict)
+ describes the number of edges.
+ seed : hashable object, optional
+ Seed for random number generator.
+
+ Returns
+ -------
+ G : Graph
+ A directed graph with the specified inputs.
+
+ Raises
+ ------
+ NetworkXError
+ If degree_seq and nkk are not realizable as a simple directed graph.
+
+
+ Notes
+ -----
+ Similarly to the undirected version:
+ In each iteration of the "while loop" the algorithm picks two disconnected
+ nodes v and w, of degree k and l correspondingly, for which nkk[k][l] has
+ not reached its target yet i.e. (for given k,l): n_edges_add < nkk[k][l].
+ It then adds edge (v,w) and always increases the number of edges in graph G
+ by one.
+
+ The intelligence of the algorithm lies in the fact that it is always
+ possible to add an edge between disconnected nodes v and w, for which
+ nkk[degree(v)][degree(w)] has not reached its target, even if one or both
+ nodes do not have free stubs. If either node v or w does not have a free
+ stub, we perform a "neighbor switch", an edge rewiring move that releases a
+ free stub while keeping nkk the same.
+
+ The difference for the directed version lies in the fact that neighbor
+ switches might not be able to rewire, but in these cases unsaturated nodes
+ can be reassigned to use instead, see [1] for detailed description and
+ proofs.
+
+ The algorithm continues for E (number of edges in the graph) iterations of
+ the "while loop", at which point all entries of the given nkk[k][l] have
+ reached their target values and the construction is complete.
+
+ References
+ ----------
+ [1] B. Tillman, A. Markopoulou, C. T. Butts & M. Gjoka,
+ "Construction of Directed 2K Graphs". In Proc. of KDD 2017.
+
+ Examples
+ --------
+ >>> in_degrees = [0, 1, 1, 2]
+ >>> out_degrees = [1, 1, 1, 1]
+ >>> nkk = {1: {1: 2, 2: 2}}
+ >>> G = nx.directed_joint_degree_graph(in_degrees, out_degrees, nkk)
+ >>>
+ """
+ if not is_valid_directed_joint_degree(in_degrees, out_degrees, nkk):
+ msg = "Input is not realizable as a simple graph"
+ raise nx.NetworkXError(msg)
+
+ # start with an empty directed graph.
+ G = nx.DiGraph()
+
+ # for a given group, keep the list of all node ids.
+ h_degree_nodelist_in = {}
+ h_degree_nodelist_out = {}
+ # for a given group, keep the list of all unsaturated node ids.
+ h_degree_nodelist_in_unsat = {}
+ h_degree_nodelist_out_unsat = {}
+ # for a given node, keep track of the remaining stubs to be added.
+ h_node_residual_out = {}
+ h_node_residual_in = {}
+ # for a given node, keep track of the partition id.
+ h_partition_out = {}
+ h_partition_in = {}
+ # keep track of non-chords between pairs of partition ids.
+ non_chords = {}
+
+ # populate data structures
+ for idx, i in enumerate(in_degrees):
+ idx = int(idx)
+ if i > 0:
+ h_degree_nodelist_in.setdefault(i, [])
+ h_degree_nodelist_in_unsat.setdefault(i, set())
+ h_degree_nodelist_in[i].append(idx)
+ h_degree_nodelist_in_unsat[i].add(idx)
+ h_node_residual_in[idx] = i
+ h_partition_in[idx] = i
+
+ for idx, o in enumerate(out_degrees):
+ o = out_degrees[idx]
+ non_chords[(o, in_degrees[idx])] = non_chords.get((o, in_degrees[idx]), 0) + 1
+ idx = int(idx)
+ if o > 0:
+ h_degree_nodelist_out.setdefault(o, [])
+ h_degree_nodelist_out_unsat.setdefault(o, set())
+ h_degree_nodelist_out[o].append(idx)
+ h_degree_nodelist_out_unsat[o].add(idx)
+ h_node_residual_out[idx] = o
+ h_partition_out[idx] = o
+
+ G.add_node(idx)
+
+ nk_in = {}
+ nk_out = {}
+ for p in h_degree_nodelist_in:
+ nk_in[p] = len(h_degree_nodelist_in[p])
+ for p in h_degree_nodelist_out:
+ nk_out[p] = len(h_degree_nodelist_out[p])
+
+ # iterate over every degree pair (k,l) and add the number of edges given
+ # for each pair.
+ for k in nkk:
+ for l in nkk[k]:
+ n_edges_add = nkk[k][l]
+
+ if n_edges_add > 0:
+ # chords contains a random set of potential edges.
+ chords = set()
+
+ k_len = nk_out[k]
+ l_len = nk_in[l]
+ chords_sample = seed.sample(
+ range(k_len * l_len), n_edges_add + non_chords.get((k, l), 0)
+ )
+
+ num = 0
+ while len(chords) < n_edges_add:
+ i = h_degree_nodelist_out[k][chords_sample[num] % k_len]
+ j = h_degree_nodelist_in[l][chords_sample[num] // k_len]
+ num += 1
+ if i != j:
+ chords.add((i, j))
+
+ # k_unsat and l_unsat consist of nodes of in/out degree k and l
+ # that are unsaturated i.e. those nodes that have at least one
+ # available stub
+ k_unsat = h_degree_nodelist_out_unsat[k]
+ l_unsat = h_degree_nodelist_in_unsat[l]
+
+ while n_edges_add > 0:
+ v, w = chords.pop()
+ chords.add((v, w))
+
+ # if node v has no free stubs then do neighbor switch.
+ if h_node_residual_out[v] == 0:
+ _v = _directed_neighbor_switch(
+ G,
+ v,
+ k_unsat,
+ h_node_residual_out,
+ chords,
+ h_partition_in,
+ l,
+ )
+ if _v is not None:
+ v = _v
+
+ # if node w has no free stubs then do neighbor switch.
+ if h_node_residual_in[w] == 0:
+ _w = _directed_neighbor_switch_rev(
+ G,
+ w,
+ l_unsat,
+ h_node_residual_in,
+ chords,
+ h_partition_out,
+ k,
+ )
+ if _w is not None:
+ w = _w
+
+ # add edge (v,w) and update data structures.
+ G.add_edge(v, w)
+ h_node_residual_out[v] -= 1
+ h_node_residual_in[w] -= 1
+ n_edges_add -= 1
+ chords.discard((v, w))
+
+ if h_node_residual_out[v] == 0:
+ k_unsat.discard(v)
+ if h_node_residual_in[w] == 0:
+ l_unsat.discard(w)
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/lattice.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/lattice.py
new file mode 100644
index 0000000000000000000000000000000000000000..95e520d2ce1fbbd16c10f42348807062f855e50b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/lattice.py
@@ -0,0 +1,367 @@
+"""Functions for generating grid graphs and lattices
+
+The :func:`grid_2d_graph`, :func:`triangular_lattice_graph`, and
+:func:`hexagonal_lattice_graph` functions correspond to the three
+`regular tilings of the plane`_, the square, triangular, and hexagonal
+tilings, respectively. :func:`grid_graph` and :func:`hypercube_graph`
+are similar for arbitrary dimensions. Useful relevant discussion can
+be found about `Triangular Tiling`_, and `Square, Hex and Triangle Grids`_
+
+.. _regular tilings of the plane: https://en.wikipedia.org/wiki/List_of_regular_polytopes_and_compounds#Euclidean_tilings
+.. _Square, Hex and Triangle Grids: http://www-cs-students.stanford.edu/~amitp/game-programming/grids/
+.. _Triangular Tiling: https://en.wikipedia.org/wiki/Triangular_tiling
+
+"""
+
+from itertools import repeat
+from math import sqrt
+
+import networkx as nx
+from networkx.classes import set_node_attributes
+from networkx.exception import NetworkXError
+from networkx.generators.classic import cycle_graph, empty_graph, path_graph
+from networkx.relabel import relabel_nodes
+from networkx.utils import flatten, nodes_or_number, pairwise
+
+__all__ = [
+ "grid_2d_graph",
+ "grid_graph",
+ "hypercube_graph",
+ "triangular_lattice_graph",
+ "hexagonal_lattice_graph",
+]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+@nodes_or_number([0, 1])
+def grid_2d_graph(m, n, periodic=False, create_using=None):
+ """Returns the two-dimensional grid graph.
+
+ The grid graph has each node connected to its four nearest neighbors.
+
+ Parameters
+ ----------
+ m, n : int or iterable container of nodes
+ If an integer, nodes are from `range(n)`.
+ If a container, elements become the coordinate of the nodes.
+
+ periodic : bool or iterable
+ If `periodic` is True, both dimensions are periodic. If False, none
+ are periodic. If `periodic` is iterable, it should yield 2 bool
+ values indicating whether the 1st and 2nd axes, respectively, are
+ periodic.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ NetworkX graph
+ The (possibly periodic) grid graph of the specified dimensions.
+
+ """
+ G = empty_graph(0, create_using)
+ row_name, rows = m
+ col_name, cols = n
+ G.add_nodes_from((i, j) for i in rows for j in cols)
+ G.add_edges_from(((i, j), (pi, j)) for pi, i in pairwise(rows) for j in cols)
+ G.add_edges_from(((i, j), (i, pj)) for i in rows for pj, j in pairwise(cols))
+
+ try:
+ periodic_r, periodic_c = periodic
+ except TypeError:
+ periodic_r = periodic_c = periodic
+
+ if periodic_r and len(rows) > 2:
+ first = rows[0]
+ last = rows[-1]
+ G.add_edges_from(((first, j), (last, j)) for j in cols)
+ if periodic_c and len(cols) > 2:
+ first = cols[0]
+ last = cols[-1]
+ G.add_edges_from(((i, first), (i, last)) for i in rows)
+ # both directions for directed
+ if G.is_directed():
+ G.add_edges_from((v, u) for u, v in G.edges())
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def grid_graph(dim, periodic=False):
+ """Returns the *n*-dimensional grid graph.
+
+ The dimension *n* is the length of the list `dim` and the size in
+ each dimension is the value of the corresponding list element.
+
+ Parameters
+ ----------
+ dim : list or tuple of numbers or iterables of nodes
+ 'dim' is a tuple or list with, for each dimension, either a number
+ that is the size of that dimension or an iterable of nodes for
+ that dimension. The dimension of the grid_graph is the length
+ of `dim`.
+
+ periodic : bool or iterable
+ If `periodic` is True, all dimensions are periodic. If False all
+ dimensions are not periodic. If `periodic` is iterable, it should
+ yield `dim` bool values each of which indicates whether the
+ corresponding axis is periodic.
+
+ Returns
+ -------
+ NetworkX graph
+ The (possibly periodic) grid graph of the specified dimensions.
+
+ Examples
+ --------
+ To produce a 2 by 3 by 4 grid graph, a graph on 24 nodes:
+
+ >>> from networkx import grid_graph
+ >>> G = grid_graph(dim=(2, 3, 4))
+ >>> len(G)
+ 24
+ >>> G = grid_graph(dim=(range(7, 9), range(3, 6)))
+ >>> len(G)
+ 6
+ """
+ from networkx.algorithms.operators.product import cartesian_product
+
+ if not dim:
+ return empty_graph(0)
+
+ try:
+ func = (cycle_graph if p else path_graph for p in periodic)
+ except TypeError:
+ func = repeat(cycle_graph if periodic else path_graph)
+
+ G = next(func)(dim[0])
+ for current_dim in dim[1:]:
+ Gnew = next(func)(current_dim)
+ G = cartesian_product(Gnew, G)
+ # graph G is done but has labels of the form (1, (2, (3, 1))) so relabel
+ H = relabel_nodes(G, flatten)
+ return H
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def hypercube_graph(n):
+ """Returns the *n*-dimensional hypercube graph.
+
+ The nodes are the integers between 0 and ``2 ** n - 1``, inclusive.
+
+ For more information on the hypercube graph, see the Wikipedia
+ article `Hypercube graph`_.
+
+ .. _Hypercube graph: https://en.wikipedia.org/wiki/Hypercube_graph
+
+ Parameters
+ ----------
+ n : int
+ The dimension of the hypercube.
+ The number of nodes in the graph will be ``2 ** n``.
+
+ Returns
+ -------
+ NetworkX graph
+ The hypercube graph of dimension *n*.
+ """
+ dim = n * [2]
+ G = grid_graph(dim)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def triangular_lattice_graph(
+ m, n, periodic=False, with_positions=True, create_using=None
+):
+ r"""Returns the $m$ by $n$ triangular lattice graph.
+
+ The `triangular lattice graph`_ is a two-dimensional `grid graph`_ in
+ which each square unit has a diagonal edge (each grid unit has a chord).
+
+ The returned graph has $m$ rows and $n$ columns of triangles. Rows and
+ columns include both triangles pointing up and down. Rows form a strip
+ of constant height. Columns form a series of diamond shapes, staggered
+ with the columns on either side. Another way to state the size is that
+ the nodes form a grid of `m+1` rows and `(n + 1) // 2` columns.
+ The odd row nodes are shifted horizontally relative to the even rows.
+
+ Directed graph types have edges pointed up or right.
+
+ Positions of nodes are computed by default or `with_positions is True`.
+ The position of each node (embedded in a euclidean plane) is stored in
+ the graph using equilateral triangles with sidelength 1.
+ The height between rows of nodes is thus $\sqrt(3)/2$.
+ Nodes lie in the first quadrant with the node $(0, 0)$ at the origin.
+
+ .. _triangular lattice graph: http://mathworld.wolfram.com/TriangularGrid.html
+ .. _grid graph: http://www-cs-students.stanford.edu/~amitp/game-programming/grids/
+ .. _Triangular Tiling: https://en.wikipedia.org/wiki/Triangular_tiling
+
+ Parameters
+ ----------
+ m : int
+ The number of rows in the lattice.
+
+ n : int
+ The number of columns in the lattice.
+
+ periodic : bool (default: False)
+ If True, join the boundary vertices of the grid using periodic
+ boundary conditions. The join between boundaries is the final row
+ and column of triangles. This means there is one row and one column
+ fewer nodes for the periodic lattice. Periodic lattices require
+ `m >= 3`, `n >= 5` and are allowed but misaligned if `m` or `n` are odd
+
+ with_positions : bool (default: True)
+ Store the coordinates of each node in the graph node attribute 'pos'.
+ The coordinates provide a lattice with equilateral triangles.
+ Periodic positions shift the nodes vertically in a nonlinear way so
+ the edges don't overlap so much.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ NetworkX graph
+ The *m* by *n* triangular lattice graph.
+ """
+ H = empty_graph(0, create_using)
+ if n == 0 or m == 0:
+ return H
+ if periodic:
+ if n < 5 or m < 3:
+ msg = f"m > 2 and n > 4 required for periodic. m={m}, n={n}"
+ raise NetworkXError(msg)
+
+ N = (n + 1) // 2 # number of nodes in row
+ rows = range(m + 1)
+ cols = range(N + 1)
+ # Make grid
+ H.add_edges_from(((i, j), (i + 1, j)) for j in rows for i in cols[:N])
+ H.add_edges_from(((i, j), (i, j + 1)) for j in rows[:m] for i in cols)
+ # add diagonals
+ H.add_edges_from(((i, j), (i + 1, j + 1)) for j in rows[1:m:2] for i in cols[:N])
+ H.add_edges_from(((i + 1, j), (i, j + 1)) for j in rows[:m:2] for i in cols[:N])
+ # identify boundary nodes if periodic
+ from networkx.algorithms.minors import contracted_nodes
+
+ if periodic is True:
+ for i in cols:
+ H = contracted_nodes(H, (i, 0), (i, m))
+ for j in rows[:m]:
+ H = contracted_nodes(H, (0, j), (N, j))
+ elif n % 2:
+ # remove extra nodes
+ H.remove_nodes_from((N, j) for j in rows[1::2])
+
+ # Add position node attributes
+ if with_positions:
+ ii = (i for i in cols for j in rows)
+ jj = (j for i in cols for j in rows)
+ xx = (0.5 * (j % 2) + i for i in cols for j in rows)
+ h = sqrt(3) / 2
+ if periodic:
+ yy = (h * j + 0.01 * i * i for i in cols for j in rows)
+ else:
+ yy = (h * j for i in cols for j in rows)
+ pos = {(i, j): (x, y) for i, j, x, y in zip(ii, jj, xx, yy) if (i, j) in H}
+ set_node_attributes(H, pos, "pos")
+ return H
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def hexagonal_lattice_graph(
+ m, n, periodic=False, with_positions=True, create_using=None
+):
+ """Returns an `m` by `n` hexagonal lattice graph.
+
+ The *hexagonal lattice graph* is a graph whose nodes and edges are
+ the `hexagonal tiling`_ of the plane.
+
+ The returned graph will have `m` rows and `n` columns of hexagons.
+ `Odd numbered columns`_ are shifted up relative to even numbered columns.
+
+ Positions of nodes are computed by default or `with_positions is True`.
+ Node positions creating the standard embedding in the plane
+ with sidelength 1 and are stored in the node attribute 'pos'.
+ `pos = nx.get_node_attributes(G, 'pos')` creates a dict ready for drawing.
+
+ .. _hexagonal tiling: https://en.wikipedia.org/wiki/Hexagonal_tiling
+ .. _Odd numbered columns: http://www-cs-students.stanford.edu/~amitp/game-programming/grids/
+
+ Parameters
+ ----------
+ m : int
+ The number of rows of hexagons in the lattice.
+
+ n : int
+ The number of columns of hexagons in the lattice.
+
+ periodic : bool
+ Whether to make a periodic grid by joining the boundary vertices.
+ For this to work `n` must be even and both `n > 1` and `m > 1`.
+ The periodic connections create another row and column of hexagons
+ so these graphs have fewer nodes as boundary nodes are identified.
+
+ with_positions : bool (default: True)
+ Store the coordinates of each node in the graph node attribute 'pos'.
+ The coordinates provide a lattice with vertical columns of hexagons
+ offset to interleave and cover the plane.
+ Periodic positions shift the nodes vertically in a nonlinear way so
+ the edges don't overlap so much.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ If graph is directed, edges will point up or right.
+
+ Returns
+ -------
+ NetworkX graph
+ The *m* by *n* hexagonal lattice graph.
+ """
+ G = empty_graph(0, create_using)
+ if m == 0 or n == 0:
+ return G
+ if periodic and (n % 2 == 1 or m < 2 or n < 2):
+ msg = "periodic hexagonal lattice needs m > 1, n > 1 and even n"
+ raise NetworkXError(msg)
+
+ M = 2 * m # twice as many nodes as hexagons vertically
+ rows = range(M + 2)
+ cols = range(n + 1)
+ # make lattice
+ col_edges = (((i, j), (i, j + 1)) for i in cols for j in rows[: M + 1])
+ row_edges = (((i, j), (i + 1, j)) for i in cols[:n] for j in rows if i % 2 == j % 2)
+ G.add_edges_from(col_edges)
+ G.add_edges_from(row_edges)
+ # Remove corner nodes with one edge
+ G.remove_node((0, M + 1))
+ G.remove_node((n, (M + 1) * (n % 2)))
+
+ # identify boundary nodes if periodic
+ from networkx.algorithms.minors import contracted_nodes
+
+ if periodic:
+ for i in cols[:n]:
+ G = contracted_nodes(G, (i, 0), (i, M))
+ for i in cols[1:]:
+ G = contracted_nodes(G, (i, 1), (i, M + 1))
+ for j in rows[1:M]:
+ G = contracted_nodes(G, (0, j), (n, j))
+ G.remove_node((n, M))
+
+ # calc position in embedded space
+ ii = (i for i in cols for j in rows)
+ jj = (j for i in cols for j in rows)
+ xx = (0.5 + i + i // 2 + (j % 2) * ((i % 2) - 0.5) for i in cols for j in rows)
+ h = sqrt(3) / 2
+ if periodic:
+ yy = (h * j + 0.01 * i * i for i in cols for j in rows)
+ else:
+ yy = (h * j for i in cols for j in rows)
+ # exclude nodes not in G
+ pos = {(i, j): (x, y) for i, j, x, y in zip(ii, jj, xx, yy) if (i, j) in G}
+ set_node_attributes(G, pos, "pos")
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/line.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/line.py
new file mode 100644
index 0000000000000000000000000000000000000000..87d251827f5118cd97d7e575a8553f44b7e041c3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/line.py
@@ -0,0 +1,500 @@
+"""Functions for generating line graphs."""
+
+from collections import defaultdict
+from functools import partial
+from itertools import combinations
+
+import networkx as nx
+from networkx.utils import arbitrary_element
+from networkx.utils.decorators import not_implemented_for
+
+__all__ = ["line_graph", "inverse_line_graph"]
+
+
+@nx._dispatchable(returns_graph=True)
+def line_graph(G, create_using=None):
+ r"""Returns the line graph of the graph or digraph `G`.
+
+ The line graph of a graph `G` has a node for each edge in `G` and an
+ edge joining those nodes if the two edges in `G` share a common node. For
+ directed graphs, nodes are adjacent exactly when the edges they represent
+ form a directed path of length two.
+
+ The nodes of the line graph are 2-tuples of nodes in the original graph (or
+ 3-tuples for multigraphs, with the key of the edge as the third element).
+
+ For information about self-loops and more discussion, see the **Notes**
+ section below.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX Graph, DiGraph, MultiGraph, or MultiDigraph.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ L : graph
+ The line graph of G.
+
+ Examples
+ --------
+ >>> G = nx.star_graph(3)
+ >>> L = nx.line_graph(G)
+ >>> print(sorted(map(sorted, L.edges()))) # makes a 3-clique, K3
+ [[(0, 1), (0, 2)], [(0, 1), (0, 3)], [(0, 2), (0, 3)]]
+
+ Edge attributes from `G` are not copied over as node attributes in `L`, but
+ attributes can be copied manually:
+
+ >>> G = nx.path_graph(4)
+ >>> G.add_edges_from((u, v, {"tot": u + v}) for u, v in G.edges)
+ >>> G.edges(data=True)
+ EdgeDataView([(0, 1, {'tot': 1}), (1, 2, {'tot': 3}), (2, 3, {'tot': 5})])
+ >>> H = nx.line_graph(G)
+ >>> H.add_nodes_from((node, G.edges[node]) for node in H)
+ >>> H.nodes(data=True)
+ NodeDataView({(0, 1): {'tot': 1}, (2, 3): {'tot': 5}, (1, 2): {'tot': 3}})
+
+ Notes
+ -----
+ Graph, node, and edge data are not propagated to the new graph. For
+ undirected graphs, the nodes in G must be sortable, otherwise the
+ constructed line graph may not be correct.
+
+ *Self-loops in undirected graphs*
+
+ For an undirected graph `G` without multiple edges, each edge can be
+ written as a set `\{u, v\}`. Its line graph `L` has the edges of `G` as
+ its nodes. If `x` and `y` are two nodes in `L`, then `\{x, y\}` is an edge
+ in `L` if and only if the intersection of `x` and `y` is nonempty. Thus,
+ the set of all edges is determined by the set of all pairwise intersections
+ of edges in `G`.
+
+ Trivially, every edge in G would have a nonzero intersection with itself,
+ and so every node in `L` should have a self-loop. This is not so
+ interesting, and the original context of line graphs was with simple
+ graphs, which had no self-loops or multiple edges. The line graph was also
+ meant to be a simple graph and thus, self-loops in `L` are not part of the
+ standard definition of a line graph. In a pairwise intersection matrix,
+ this is analogous to excluding the diagonal entries from the line graph
+ definition.
+
+ Self-loops and multiple edges in `G` add nodes to `L` in a natural way, and
+ do not require any fundamental changes to the definition. It might be
+ argued that the self-loops we excluded before should now be included.
+ However, the self-loops are still "trivial" in some sense and thus, are
+ usually excluded.
+
+ *Self-loops in directed graphs*
+
+ For a directed graph `G` without multiple edges, each edge can be written
+ as a tuple `(u, v)`. Its line graph `L` has the edges of `G` as its
+ nodes. If `x` and `y` are two nodes in `L`, then `(x, y)` is an edge in `L`
+ if and only if the tail of `x` matches the head of `y`, for example, if `x
+ = (a, b)` and `y = (b, c)` for some vertices `a`, `b`, and `c` in `G`.
+
+ Due to the directed nature of the edges, it is no longer the case that
+ every edge in `G` should have a self-loop in `L`. Now, the only time
+ self-loops arise is if a node in `G` itself has a self-loop. So such
+ self-loops are no longer "trivial" but instead, represent essential
+ features of the topology of `G`. For this reason, the historical
+ development of line digraphs is such that self-loops are included. When the
+ graph `G` has multiple edges, once again only superficial changes are
+ required to the definition.
+
+ References
+ ----------
+ * Harary, Frank, and Norman, Robert Z., "Some properties of line digraphs",
+ Rend. Circ. Mat. Palermo, II. Ser. 9 (1960), 161--168.
+ * Hemminger, R. L.; Beineke, L. W. (1978), "Line graphs and line digraphs",
+ in Beineke, L. W.; Wilson, R. J., Selected Topics in Graph Theory,
+ Academic Press Inc., pp. 271--305.
+
+ """
+ if G.is_directed():
+ L = _lg_directed(G, create_using=create_using)
+ else:
+ L = _lg_undirected(G, selfloops=False, create_using=create_using)
+ return L
+
+
+def _lg_directed(G, create_using=None):
+ """Returns the line graph L of the (multi)digraph G.
+
+ Edges in G appear as nodes in L, represented as tuples of the form (u,v)
+ or (u,v,key) if G is a multidigraph. A node in L corresponding to the edge
+ (u,v) is connected to every node corresponding to an edge (v,w).
+
+ Parameters
+ ----------
+ G : digraph
+ A directed graph or directed multigraph.
+ create_using : NetworkX graph constructor, optional
+ Graph type to create. If graph instance, then cleared before populated.
+ Default is to use the same graph class as `G`.
+
+ """
+ L = nx.empty_graph(0, create_using, default=G.__class__)
+
+ # Create a graph specific edge function.
+ get_edges = partial(G.edges, keys=True) if G.is_multigraph() else G.edges
+
+ for from_node in get_edges():
+ # from_node is: (u,v) or (u,v,key)
+ L.add_node(from_node)
+ for to_node in get_edges(from_node[1]):
+ L.add_edge(from_node, to_node)
+
+ return L
+
+
+def _lg_undirected(G, selfloops=False, create_using=None):
+ """Returns the line graph L of the (multi)graph G.
+
+ Edges in G appear as nodes in L, represented as sorted tuples of the form
+ (u,v), or (u,v,key) if G is a multigraph. A node in L corresponding to
+ the edge {u,v} is connected to every node corresponding to an edge that
+ involves u or v.
+
+ Parameters
+ ----------
+ G : graph
+ An undirected graph or multigraph.
+ selfloops : bool
+ If `True`, then self-loops are included in the line graph. If `False`,
+ they are excluded.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Notes
+ -----
+ The standard algorithm for line graphs of undirected graphs does not
+ produce self-loops.
+
+ """
+ L = nx.empty_graph(0, create_using, default=G.__class__)
+
+ # Graph specific functions for edges.
+ get_edges = partial(G.edges, keys=True) if G.is_multigraph() else G.edges
+
+ # Determine if we include self-loops or not.
+ shift = 0 if selfloops else 1
+
+ # Introduce numbering of nodes
+ node_index = {n: i for i, n in enumerate(G)}
+
+ # Lift canonical representation of nodes to edges in line graph
+ edge_key_function = lambda edge: (node_index[edge[0]], node_index[edge[1]])
+
+ edges = set()
+ for u in G:
+ # Label nodes as a sorted tuple of nodes in original graph.
+ # Decide on representation of {u, v} as (u, v) or (v, u) depending on node_index.
+ # -> This ensures a canonical representation and avoids comparing values of different types.
+ nodes = [tuple(sorted(x[:2], key=node_index.get)) + x[2:] for x in get_edges(u)]
+
+ if len(nodes) == 1:
+ # Then the edge will be an isolated node in L.
+ L.add_node(nodes[0])
+
+ # Add a clique of `nodes` to graph. To prevent double adding edges,
+ # especially important for multigraphs, we store the edges in
+ # canonical form in a set.
+ for i, a in enumerate(nodes):
+ edges.update(
+ [
+ tuple(sorted((a, b), key=edge_key_function))
+ for b in nodes[i + shift :]
+ ]
+ )
+
+ L.add_edges_from(edges)
+ return L
+
+
+@not_implemented_for("directed")
+@not_implemented_for("multigraph")
+@nx._dispatchable(returns_graph=True)
+def inverse_line_graph(G):
+ """Returns the inverse line graph of graph G.
+
+ If H is a graph, and G is the line graph of H, such that G = L(H).
+ Then H is the inverse line graph of G.
+
+ Not all graphs are line graphs and these do not have an inverse line graph.
+ In these cases this function raises a NetworkXError.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX Graph
+
+ Returns
+ -------
+ H : graph
+ The inverse line graph of G.
+
+ Raises
+ ------
+ NetworkXNotImplemented
+ If G is directed or a multigraph
+
+ NetworkXError
+ If G is not a line graph
+
+ Notes
+ -----
+ This is an implementation of the Roussopoulos algorithm[1]_.
+
+ If G consists of multiple components, then the algorithm doesn't work.
+ You should invert every component separately:
+
+ >>> K5 = nx.complete_graph(5)
+ >>> P4 = nx.Graph([("a", "b"), ("b", "c"), ("c", "d")])
+ >>> G = nx.union(K5, P4)
+ >>> root_graphs = []
+ >>> for comp in nx.connected_components(G):
+ ... root_graphs.append(nx.inverse_line_graph(G.subgraph(comp)))
+ >>> len(root_graphs)
+ 2
+
+ References
+ ----------
+ .. [1] Roussopoulos, N.D. , "A max {m, n} algorithm for determining the graph H from
+ its line graph G", Information Processing Letters 2, (1973), 108--112, ISSN 0020-0190,
+ `DOI link `_
+
+ """
+ if G.number_of_nodes() == 0:
+ return nx.empty_graph(1)
+ elif G.number_of_nodes() == 1:
+ v = arbitrary_element(G)
+ a = (v, 0)
+ b = (v, 1)
+ H = nx.Graph([(a, b)])
+ return H
+ elif G.number_of_nodes() > 1 and G.number_of_edges() == 0:
+ msg = (
+ "inverse_line_graph() doesn't work on an edgeless graph. "
+ "Please use this function on each component separately."
+ )
+ raise nx.NetworkXError(msg)
+
+ if nx.number_of_selfloops(G) != 0:
+ msg = (
+ "A line graph as generated by NetworkX has no selfloops, so G has no "
+ "inverse line graph. Please remove the selfloops from G and try again."
+ )
+ raise nx.NetworkXError(msg)
+
+ starting_cell = _select_starting_cell(G)
+ P = _find_partition(G, starting_cell)
+ # count how many times each vertex appears in the partition set
+ P_count = {u: 0 for u in G.nodes}
+ for p in P:
+ for u in p:
+ P_count[u] += 1
+
+ if max(P_count.values()) > 2:
+ msg = "G is not a line graph (vertex found in more than two partition cells)"
+ raise nx.NetworkXError(msg)
+ W = tuple((u,) for u in P_count if P_count[u] == 1)
+ H = nx.Graph()
+ H.add_nodes_from(P)
+ H.add_nodes_from(W)
+ for a, b in combinations(H.nodes, 2):
+ if any(a_bit in b for a_bit in a):
+ H.add_edge(a, b)
+ return H
+
+
+def _triangles(G, e):
+ """Return list of all triangles containing edge e"""
+ u, v = e
+ if u not in G:
+ raise nx.NetworkXError(f"Vertex {u} not in graph")
+ if v not in G[u]:
+ raise nx.NetworkXError(f"Edge ({u}, {v}) not in graph")
+ triangle_list = []
+ for x in G[u]:
+ if x in G[v]:
+ triangle_list.append((u, v, x))
+ return triangle_list
+
+
+def _odd_triangle(G, T):
+ """Test whether T is an odd triangle in G
+
+ Parameters
+ ----------
+ G : NetworkX Graph
+ T : 3-tuple of vertices forming triangle in G
+
+ Returns
+ -------
+ True is T is an odd triangle
+ False otherwise
+
+ Raises
+ ------
+ NetworkXError
+ T is not a triangle in G
+
+ Notes
+ -----
+ An odd triangle is one in which there exists another vertex in G which is
+ adjacent to either exactly one or exactly all three of the vertices in the
+ triangle.
+
+ """
+ for u in T:
+ if u not in G.nodes():
+ raise nx.NetworkXError(f"Vertex {u} not in graph")
+ for e in list(combinations(T, 2)):
+ if e[0] not in G[e[1]]:
+ raise nx.NetworkXError(f"Edge ({e[0]}, {e[1]}) not in graph")
+
+ T_nbrs = defaultdict(int)
+ for t in T:
+ for v in G[t]:
+ if v not in T:
+ T_nbrs[v] += 1
+ return any(T_nbrs[v] in [1, 3] for v in T_nbrs)
+
+
+def _find_partition(G, starting_cell):
+ """Find a partition of the vertices of G into cells of complete graphs
+
+ Parameters
+ ----------
+ G : NetworkX Graph
+ starting_cell : tuple of vertices in G which form a cell
+
+ Returns
+ -------
+ List of tuples of vertices of G
+
+ Raises
+ ------
+ NetworkXError
+ If a cell is not a complete subgraph then G is not a line graph
+ """
+ G_partition = G.copy()
+ P = [starting_cell] # partition set
+ G_partition.remove_edges_from(list(combinations(starting_cell, 2)))
+ # keep list of partitioned nodes which might have an edge in G_partition
+ partitioned_vertices = list(starting_cell)
+ while G_partition.number_of_edges() > 0:
+ # there are still edges left and so more cells to be made
+ u = partitioned_vertices.pop()
+ deg_u = len(G_partition[u])
+ if deg_u != 0:
+ # if u still has edges then we need to find its other cell
+ # this other cell must be a complete subgraph or else G is
+ # not a line graph
+ new_cell = [u] + list(G_partition[u])
+ for u in new_cell:
+ for v in new_cell:
+ if (u != v) and (v not in G_partition[u]):
+ msg = (
+ "G is not a line graph "
+ "(partition cell not a complete subgraph)"
+ )
+ raise nx.NetworkXError(msg)
+ P.append(tuple(new_cell))
+ G_partition.remove_edges_from(list(combinations(new_cell, 2)))
+ partitioned_vertices += new_cell
+ return P
+
+
+def _select_starting_cell(G, starting_edge=None):
+ """Select a cell to initiate _find_partition
+
+ Parameters
+ ----------
+ G : NetworkX Graph
+ starting_edge: an edge to build the starting cell from
+
+ Returns
+ -------
+ Tuple of vertices in G
+
+ Raises
+ ------
+ NetworkXError
+ If it is determined that G is not a line graph
+
+ Notes
+ -----
+ If starting edge not specified then pick an arbitrary edge - doesn't
+ matter which. However, this function may call itself requiring a
+ specific starting edge. Note that the r, s notation for counting
+ triangles is the same as in the Roussopoulos paper cited above.
+ """
+ if starting_edge is None:
+ e = arbitrary_element(G.edges())
+ else:
+ e = starting_edge
+ if e[0] not in G.nodes():
+ raise nx.NetworkXError(f"Vertex {e[0]} not in graph")
+ if e[1] not in G[e[0]]:
+ msg = f"starting_edge ({e[0]}, {e[1]}) is not in the Graph"
+ raise nx.NetworkXError(msg)
+ e_triangles = _triangles(G, e)
+ r = len(e_triangles)
+ if r == 0:
+ # there are no triangles containing e, so the starting cell is just e
+ starting_cell = e
+ elif r == 1:
+ # there is exactly one triangle, T, containing e. If other 2 edges
+ # of T belong only to this triangle then T is starting cell
+ T = e_triangles[0]
+ a, b, c = T
+ # ab was original edge so check the other 2 edges
+ ac_edges = len(_triangles(G, (a, c)))
+ bc_edges = len(_triangles(G, (b, c)))
+ if ac_edges == 1:
+ if bc_edges == 1:
+ starting_cell = T
+ else:
+ return _select_starting_cell(G, starting_edge=(b, c))
+ else:
+ return _select_starting_cell(G, starting_edge=(a, c))
+ else:
+ # r >= 2 so we need to count the number of odd triangles, s
+ s = 0
+ odd_triangles = []
+ for T in e_triangles:
+ if _odd_triangle(G, T):
+ s += 1
+ odd_triangles.append(T)
+ if r == 2 and s == 0:
+ # in this case either triangle works, so just use T
+ starting_cell = T
+ elif r - 1 <= s <= r:
+ # check if odd triangles containing e form complete subgraph
+ triangle_nodes = set()
+ for T in odd_triangles:
+ for x in T:
+ triangle_nodes.add(x)
+
+ for u in triangle_nodes:
+ for v in triangle_nodes:
+ if u != v and (v not in G[u]):
+ msg = (
+ "G is not a line graph (odd triangles "
+ "do not form complete subgraph)"
+ )
+ raise nx.NetworkXError(msg)
+ # otherwise then we can use this as the starting cell
+ starting_cell = tuple(triangle_nodes)
+
+ else:
+ msg = (
+ "G is not a line graph (incorrect number of "
+ "odd triangles around starting edge)"
+ )
+ raise nx.NetworkXError(msg)
+ return starting_cell
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/mycielski.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/mycielski.py
new file mode 100644
index 0000000000000000000000000000000000000000..804b903692853d3c45b3b1b20898efeee9b71a5e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/mycielski.py
@@ -0,0 +1,110 @@
+"""Functions related to the Mycielski Operation and the Mycielskian family
+of graphs.
+
+"""
+
+import networkx as nx
+from networkx.utils import not_implemented_for
+
+__all__ = ["mycielskian", "mycielski_graph"]
+
+
+@not_implemented_for("directed")
+@not_implemented_for("multigraph")
+@nx._dispatchable(returns_graph=True)
+def mycielskian(G, iterations=1):
+ r"""Returns the Mycielskian of a simple, undirected graph G
+
+ The Mycielskian of graph preserves a graph's triangle free
+ property while increasing the chromatic number by 1.
+
+ The Mycielski Operation on a graph, :math:`G=(V, E)`, constructs a new
+ graph with :math:`2|V| + 1` nodes and :math:`3|E| + |V|` edges.
+
+ The construction is as follows:
+
+ Let :math:`V = {0, ..., n-1}`. Construct another vertex set
+ :math:`U = {n, ..., 2n}` and a vertex, `w`.
+ Construct a new graph, `M`, with vertices :math:`U \bigcup V \bigcup w`.
+ For edges, :math:`(u, v) \in E` add edges :math:`(u, v), (u, v + n)`, and
+ :math:`(u + n, v)` to M. Finally, for all vertices :math:`u \in U`, add
+ edge :math:`(u, w)` to M.
+
+ The Mycielski Operation can be done multiple times by repeating the above
+ process iteratively.
+
+ More information can be found at https://en.wikipedia.org/wiki/Mycielskian
+
+ Parameters
+ ----------
+ G : graph
+ A simple, undirected NetworkX graph
+ iterations : int
+ The number of iterations of the Mycielski operation to
+ perform on G. Defaults to 1. Must be a non-negative integer.
+
+ Returns
+ -------
+ M : graph
+ The Mycielskian of G after the specified number of iterations.
+
+ Notes
+ -----
+ Graph, node, and edge data are not necessarily propagated to the new graph.
+
+ """
+
+ M = nx.convert_node_labels_to_integers(G)
+
+ for i in range(iterations):
+ n = M.number_of_nodes()
+ M.add_nodes_from(range(n, 2 * n))
+ old_edges = list(M.edges())
+ M.add_edges_from((u, v + n) for u, v in old_edges)
+ M.add_edges_from((u + n, v) for u, v in old_edges)
+ M.add_node(2 * n)
+ M.add_edges_from((u + n, 2 * n) for u in range(n))
+
+ return M
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def mycielski_graph(n):
+ """Generator for the n_th Mycielski Graph.
+
+ The Mycielski family of graphs is an infinite set of graphs.
+ :math:`M_1` is the singleton graph, :math:`M_2` is two vertices with an
+ edge, and, for :math:`i > 2`, :math:`M_i` is the Mycielskian of
+ :math:`M_{i-1}`.
+
+ More information can be found at
+ http://mathworld.wolfram.com/MycielskiGraph.html
+
+ Parameters
+ ----------
+ n : int
+ The desired Mycielski Graph.
+
+ Returns
+ -------
+ M : graph
+ The n_th Mycielski Graph
+
+ Notes
+ -----
+ The first graph in the Mycielski sequence is the singleton graph.
+ The Mycielskian of this graph is not the :math:`P_2` graph, but rather the
+ :math:`P_2` graph with an extra, isolated vertex. The second Mycielski
+ graph is the :math:`P_2` graph, so the first two are hard coded.
+ The remaining graphs are generated using the Mycielski operation.
+
+ """
+
+ if n < 1:
+ raise nx.NetworkXError("must satisfy n >= 1")
+
+ if n == 1:
+ return nx.empty_graph(1)
+
+ else:
+ return mycielskian(nx.path_graph(2), n - 2)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/nonisomorphic_trees.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/nonisomorphic_trees.py
new file mode 100644
index 0000000000000000000000000000000000000000..9716cf33834ac5d083c4dd402224dd3df1011af3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/nonisomorphic_trees.py
@@ -0,0 +1,212 @@
+"""
+Implementation of the Wright, Richmond, Odlyzko and McKay (WROM)
+algorithm for the enumeration of all non-isomorphic free trees of a
+given order. Rooted trees are represented by level sequences, i.e.,
+lists in which the i-th element specifies the distance of vertex i to
+the root.
+
+"""
+
+__all__ = ["nonisomorphic_trees", "number_of_nonisomorphic_trees"]
+
+import networkx as nx
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def nonisomorphic_trees(order, create="graph"):
+ """Generates lists of nonisomorphic trees
+
+ Parameters
+ ----------
+ order : int
+ order of the desired tree(s)
+
+ create : one of {"graph", "matrix"} (default="graph")
+ If ``"graph"`` is selected a list of ``Graph`` instances will be returned,
+ if matrix is selected a list of adjacency matrices will be returned.
+
+ .. deprecated:: 3.3
+
+ The `create` argument is deprecated and will be removed in NetworkX
+ version 3.5. In the future, `nonisomorphic_trees` will yield graph
+ instances by default. To generate adjacency matrices, call
+ ``nx.to_numpy_array`` on the output, e.g.::
+
+ [nx.to_numpy_array(G) for G in nx.nonisomorphic_trees(N)]
+
+ Yields
+ ------
+ list
+ A list of nonisomorphic trees, in one of two formats depending on the
+ value of the `create` parameter:
+ - ``create="graph"``: yields a list of `networkx.Graph` instances
+ - ``create="matrix"``: yields a list of list-of-lists representing adjacency matrices
+ """
+
+ if order < 2:
+ raise ValueError
+ # start at the path graph rooted at its center
+ layout = list(range(order // 2 + 1)) + list(range(1, (order + 1) // 2))
+
+ while layout is not None:
+ layout = _next_tree(layout)
+ if layout is not None:
+ if create == "graph":
+ yield _layout_to_graph(layout)
+ elif create == "matrix":
+ import warnings
+
+ warnings.warn(
+ (
+ "\n\nThe 'create=matrix' argument of nonisomorphic_trees\n"
+ "is deprecated and will be removed in version 3.5.\n"
+ "Use ``nx.to_numpy_array`` to convert graphs to adjacency "
+ "matrices, e.g.::\n\n"
+ " [nx.to_numpy_array(G) for G in nx.nonisomorphic_trees(N)]"
+ ),
+ category=DeprecationWarning,
+ stacklevel=2,
+ )
+
+ yield _layout_to_matrix(layout)
+ layout = _next_rooted_tree(layout)
+
+
+@nx._dispatchable(graphs=None)
+def number_of_nonisomorphic_trees(order):
+ """Returns the number of nonisomorphic trees
+
+ Parameters
+ ----------
+ order : int
+ order of the desired tree(s)
+
+ Returns
+ -------
+ length : Number of nonisomorphic graphs for the given order
+
+ References
+ ----------
+
+ """
+ return sum(1 for _ in nonisomorphic_trees(order))
+
+
+def _next_rooted_tree(predecessor, p=None):
+ """One iteration of the Beyer-Hedetniemi algorithm."""
+
+ if p is None:
+ p = len(predecessor) - 1
+ while predecessor[p] == 1:
+ p -= 1
+ if p == 0:
+ return None
+
+ q = p - 1
+ while predecessor[q] != predecessor[p] - 1:
+ q -= 1
+ result = list(predecessor)
+ for i in range(p, len(result)):
+ result[i] = result[i - p + q]
+ return result
+
+
+def _next_tree(candidate):
+ """One iteration of the Wright, Richmond, Odlyzko and McKay
+ algorithm."""
+
+ # valid representation of a free tree if:
+ # there are at least two vertices at layer 1
+ # (this is always the case because we start at the path graph)
+ left, rest = _split_tree(candidate)
+
+ # and the left subtree of the root
+ # is less high than the tree with the left subtree removed
+ left_height = max(left)
+ rest_height = max(rest)
+ valid = rest_height >= left_height
+
+ if valid and rest_height == left_height:
+ # and, if left and rest are of the same height,
+ # if left does not encompass more vertices
+ if len(left) > len(rest):
+ valid = False
+ # and, if they have the same number or vertices,
+ # if left does not come after rest lexicographically
+ elif len(left) == len(rest) and left > rest:
+ valid = False
+
+ if valid:
+ return candidate
+ else:
+ # jump to the next valid free tree
+ p = len(left)
+ new_candidate = _next_rooted_tree(candidate, p)
+ if candidate[p] > 2:
+ new_left, new_rest = _split_tree(new_candidate)
+ new_left_height = max(new_left)
+ suffix = range(1, new_left_height + 2)
+ new_candidate[-len(suffix) :] = suffix
+ return new_candidate
+
+
+def _split_tree(layout):
+ """Returns a tuple of two layouts, one containing the left
+ subtree of the root vertex, and one containing the original tree
+ with the left subtree removed."""
+
+ one_found = False
+ m = None
+ for i in range(len(layout)):
+ if layout[i] == 1:
+ if one_found:
+ m = i
+ break
+ else:
+ one_found = True
+
+ if m is None:
+ m = len(layout)
+
+ left = [layout[i] - 1 for i in range(1, m)]
+ rest = [0] + [layout[i] for i in range(m, len(layout))]
+ return (left, rest)
+
+
+def _layout_to_matrix(layout):
+ """Create the adjacency matrix for the tree specified by the
+ given layout (level sequence)."""
+
+ result = [[0] * len(layout) for i in range(len(layout))]
+ stack = []
+ for i in range(len(layout)):
+ i_level = layout[i]
+ if stack:
+ j = stack[-1]
+ j_level = layout[j]
+ while j_level >= i_level:
+ stack.pop()
+ j = stack[-1]
+ j_level = layout[j]
+ result[i][j] = result[j][i] = 1
+ stack.append(i)
+ return result
+
+
+def _layout_to_graph(layout):
+ """Create a NetworkX Graph for the tree specified by the
+ given layout(level sequence)"""
+ G = nx.Graph()
+ stack = []
+ for i in range(len(layout)):
+ i_level = layout[i]
+ if stack:
+ j = stack[-1]
+ j_level = layout[j]
+ while j_level >= i_level:
+ stack.pop()
+ j = stack[-1]
+ j_level = layout[j]
+ G.add_edge(i, j)
+ stack.append(i)
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/random_clustered.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/random_clustered.py
new file mode 100644
index 0000000000000000000000000000000000000000..8fbf855e672d3c50f1e74952cc2272143fbac57a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/random_clustered.py
@@ -0,0 +1,117 @@
+"""Generate graphs with given degree and triangle sequence."""
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+__all__ = ["random_clustered_graph"]
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_clustered_graph(joint_degree_sequence, create_using=None, seed=None):
+ r"""Generate a random graph with the given joint independent edge degree and
+ triangle degree sequence.
+
+ This uses a configuration model-like approach to generate a random graph
+ (with parallel edges and self-loops) by randomly assigning edges to match
+ the given joint degree sequence.
+
+ The joint degree sequence is a list of pairs of integers of the form
+ $[(d_{1,i}, d_{1,t}), \dotsc, (d_{n,i}, d_{n,t})]$. According to this list,
+ vertex $u$ is a member of $d_{u,t}$ triangles and has $d_{u, i}$ other
+ edges. The number $d_{u,t}$ is the *triangle degree* of $u$ and the number
+ $d_{u,i}$ is the *independent edge degree*.
+
+ Parameters
+ ----------
+ joint_degree_sequence : list of integer pairs
+ Each list entry corresponds to the independent edge degree and
+ triangle degree of a node.
+ create_using : NetworkX graph constructor, optional (default MultiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ G : MultiGraph
+ A graph with the specified degree sequence. Nodes are labeled
+ starting at 0 with an index corresponding to the position in
+ deg_sequence.
+
+ Raises
+ ------
+ NetworkXError
+ If the independent edge degree sequence sum is not even
+ or the triangle degree sequence sum is not divisible by 3.
+
+ Notes
+ -----
+ As described by Miller [1]_ (see also Newman [2]_ for an equivalent
+ description).
+
+ A non-graphical degree sequence (not realizable by some simple
+ graph) is allowed since this function returns graphs with self
+ loops and parallel edges. An exception is raised if the
+ independent degree sequence does not have an even sum or the
+ triangle degree sequence sum is not divisible by 3.
+
+ This configuration model-like construction process can lead to
+ duplicate edges and loops. You can remove the self-loops and
+ parallel edges (see below) which will likely result in a graph
+ that doesn't have the exact degree sequence specified. This
+ "finite-size effect" decreases as the size of the graph increases.
+
+ References
+ ----------
+ .. [1] Joel C. Miller. "Percolation and epidemics in random clustered
+ networks". In: Physical review. E, Statistical, nonlinear, and soft
+ matter physics 80 (2 Part 1 August 2009).
+ .. [2] M. E. J. Newman. "Random Graphs with Clustering".
+ In: Physical Review Letters 103 (5 July 2009)
+
+ Examples
+ --------
+ >>> deg = [(1, 0), (1, 0), (1, 0), (2, 0), (1, 0), (2, 1), (0, 1), (0, 1)]
+ >>> G = nx.random_clustered_graph(deg)
+
+ To remove parallel edges:
+
+ >>> G = nx.Graph(G)
+
+ To remove self loops:
+
+ >>> G.remove_edges_from(nx.selfloop_edges(G))
+
+ """
+ # In Python 3, zip() returns an iterator. Make this into a list.
+ joint_degree_sequence = list(joint_degree_sequence)
+
+ N = len(joint_degree_sequence)
+ G = nx.empty_graph(N, create_using, default=nx.MultiGraph)
+ if G.is_directed():
+ raise nx.NetworkXError("Directed Graph not supported")
+
+ ilist = []
+ tlist = []
+ for n in G:
+ degrees = joint_degree_sequence[n]
+ for icount in range(degrees[0]):
+ ilist.append(n)
+ for tcount in range(degrees[1]):
+ tlist.append(n)
+
+ if len(ilist) % 2 != 0 or len(tlist) % 3 != 0:
+ raise nx.NetworkXError("Invalid degree sequence")
+
+ seed.shuffle(ilist)
+ seed.shuffle(tlist)
+ while ilist:
+ G.add_edge(ilist.pop(), ilist.pop())
+ while tlist:
+ n1 = tlist.pop()
+ n2 = tlist.pop()
+ n3 = tlist.pop()
+ G.add_edges_from([(n1, n2), (n1, n3), (n2, n3)])
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/random_graphs.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/random_graphs.py
new file mode 100644
index 0000000000000000000000000000000000000000..90ae0d973ac42550280bf74db0d2fef3117d58da
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/random_graphs.py
@@ -0,0 +1,1400 @@
+"""
+Generators for random graphs.
+
+"""
+
+import itertools
+import math
+from collections import defaultdict
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+from ..utils.misc import check_create_using
+from .classic import complete_graph, empty_graph, path_graph, star_graph
+from .degree_seq import degree_sequence_tree
+
+__all__ = [
+ "fast_gnp_random_graph",
+ "gnp_random_graph",
+ "dense_gnm_random_graph",
+ "gnm_random_graph",
+ "erdos_renyi_graph",
+ "binomial_graph",
+ "newman_watts_strogatz_graph",
+ "watts_strogatz_graph",
+ "connected_watts_strogatz_graph",
+ "random_regular_graph",
+ "barabasi_albert_graph",
+ "dual_barabasi_albert_graph",
+ "extended_barabasi_albert_graph",
+ "powerlaw_cluster_graph",
+ "random_lobster",
+ "random_shell_graph",
+ "random_powerlaw_tree",
+ "random_powerlaw_tree_sequence",
+ "random_kernel_graph",
+]
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def fast_gnp_random_graph(n, p, seed=None, directed=False, *, create_using=None):
+ """Returns a $G_{n,p}$ random graph, also known as an Erdős-Rényi graph or
+ a binomial graph.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ p : float
+ Probability for edge creation.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ directed : bool, optional (default=False)
+ If True, this function returns a directed graph.
+ create_using : Graph constructor, optional (default=nx.Graph or nx.DiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph types are not supported and raise a ``NetworkXError``.
+ By default NetworkX Graph or DiGraph are used depending on `directed`.
+
+ Notes
+ -----
+ The $G_{n,p}$ graph algorithm chooses each of the $[n (n - 1)] / 2$
+ (undirected) or $n (n - 1)$ (directed) possible edges with probability $p$.
+
+ This algorithm [1]_ runs in $O(n + m)$ time, where `m` is the expected number of
+ edges, which equals $p n (n - 1) / 2$. This should be faster than
+ :func:`gnp_random_graph` when $p$ is small and the expected number of edges
+ is small (that is, the graph is sparse).
+
+ See Also
+ --------
+ gnp_random_graph
+
+ References
+ ----------
+ .. [1] Vladimir Batagelj and Ulrik Brandes,
+ "Efficient generation of large random networks",
+ Phys. Rev. E, 71, 036113, 2005.
+ """
+ default = nx.DiGraph if directed else nx.Graph
+ create_using = check_create_using(
+ create_using, directed=directed, multigraph=False, default=default
+ )
+ if p <= 0 or p >= 1:
+ return nx.gnp_random_graph(
+ n, p, seed=seed, directed=directed, create_using=create_using
+ )
+
+ G = empty_graph(n, create_using=create_using)
+
+ lp = math.log(1.0 - p)
+
+ if directed:
+ v = 1
+ w = -1
+ while v < n:
+ lr = math.log(1.0 - seed.random())
+ w = w + 1 + int(lr / lp)
+ while w >= v and v < n:
+ w = w - v
+ v = v + 1
+ if v < n:
+ G.add_edge(w, v)
+
+ # Nodes in graph are from 0,n-1 (start with v as the second node index).
+ v = 1
+ w = -1
+ while v < n:
+ lr = math.log(1.0 - seed.random())
+ w = w + 1 + int(lr / lp)
+ while w >= v and v < n:
+ w = w - v
+ v = v + 1
+ if v < n:
+ G.add_edge(v, w)
+ return G
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def gnp_random_graph(n, p, seed=None, directed=False, *, create_using=None):
+ """Returns a $G_{n,p}$ random graph, also known as an Erdős-Rényi graph
+ or a binomial graph.
+
+ The $G_{n,p}$ model chooses each of the possible edges with probability $p$.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ p : float
+ Probability for edge creation.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ directed : bool, optional (default=False)
+ If True, this function returns a directed graph.
+ create_using : Graph constructor, optional (default=nx.Graph or nx.DiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph types are not supported and raise a ``NetworkXError``.
+ By default NetworkX Graph or DiGraph are used depending on `directed`.
+
+ See Also
+ --------
+ fast_gnp_random_graph
+
+ Notes
+ -----
+ This algorithm [2]_ runs in $O(n^2)$ time. For sparse graphs (that is, for
+ small values of $p$), :func:`fast_gnp_random_graph` is a faster algorithm.
+
+ :func:`binomial_graph` and :func:`erdos_renyi_graph` are
+ aliases for :func:`gnp_random_graph`.
+
+ >>> nx.binomial_graph is nx.gnp_random_graph
+ True
+ >>> nx.erdos_renyi_graph is nx.gnp_random_graph
+ True
+
+ References
+ ----------
+ .. [1] P. Erdős and A. Rényi, On Random Graphs, Publ. Math. 6, 290 (1959).
+ .. [2] E. N. Gilbert, Random Graphs, Ann. Math. Stat., 30, 1141 (1959).
+ """
+ default = nx.DiGraph if directed else nx.Graph
+ create_using = check_create_using(
+ create_using, directed=directed, multigraph=False, default=default
+ )
+ if p >= 1:
+ return complete_graph(n, create_using=create_using)
+
+ G = nx.empty_graph(n, create_using=create_using)
+ if p <= 0:
+ return G
+
+ edgetool = itertools.permutations if directed else itertools.combinations
+ for e in edgetool(range(n), 2):
+ if seed.random() < p:
+ G.add_edge(*e)
+ return G
+
+
+# add some aliases to common names
+binomial_graph = gnp_random_graph
+erdos_renyi_graph = gnp_random_graph
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def dense_gnm_random_graph(n, m, seed=None, *, create_using=None):
+ """Returns a $G_{n,m}$ random graph.
+
+ In the $G_{n,m}$ model, a graph is chosen uniformly at random from the set
+ of all graphs with $n$ nodes and $m$ edges.
+
+ This algorithm should be faster than :func:`gnm_random_graph` for dense
+ graphs.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ m : int
+ The number of edges.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ See Also
+ --------
+ gnm_random_graph
+
+ Notes
+ -----
+ Algorithm by Keith M. Briggs Mar 31, 2006.
+ Inspired by Knuth's Algorithm S (Selection sampling technique),
+ in section 3.4.2 of [1]_.
+
+ References
+ ----------
+ .. [1] Donald E. Knuth, The Art of Computer Programming,
+ Volume 2/Seminumerical algorithms, Third Edition, Addison-Wesley, 1997.
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ mmax = n * (n - 1) // 2
+ if m >= mmax:
+ return complete_graph(n, create_using)
+ G = empty_graph(n, create_using)
+
+ if n == 1:
+ return G
+
+ u = 0
+ v = 1
+ t = 0
+ k = 0
+ while True:
+ if seed.randrange(mmax - t) < m - k:
+ G.add_edge(u, v)
+ k += 1
+ if k == m:
+ return G
+ t += 1
+ v += 1
+ if v == n: # go to next row of adjacency matrix
+ u += 1
+ v = u + 1
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def gnm_random_graph(n, m, seed=None, directed=False, *, create_using=None):
+ """Returns a $G_{n,m}$ random graph.
+
+ In the $G_{n,m}$ model, a graph is chosen uniformly at random from the set
+ of all graphs with $n$ nodes and $m$ edges.
+
+ This algorithm should be faster than :func:`dense_gnm_random_graph` for
+ sparse graphs.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ m : int
+ The number of edges.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ directed : bool, optional (default=False)
+ If True return a directed graph
+ create_using : Graph constructor, optional (default=nx.Graph or nx.DiGraph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph types are not supported and raise a ``NetworkXError``.
+ By default NetworkX Graph or DiGraph are used depending on `directed`.
+
+ See also
+ --------
+ dense_gnm_random_graph
+
+ """
+ default = nx.DiGraph if directed else nx.Graph
+ create_using = check_create_using(
+ create_using, directed=directed, multigraph=False, default=default
+ )
+ if n == 1:
+ return nx.empty_graph(n, create_using=create_using)
+ max_edges = n * (n - 1) if directed else n * (n - 1) / 2.0
+ if m >= max_edges:
+ return complete_graph(n, create_using=create_using)
+
+ G = nx.empty_graph(n, create_using=create_using)
+ nlist = list(G)
+ edge_count = 0
+ while edge_count < m:
+ # generate random edge,u,v
+ u = seed.choice(nlist)
+ v = seed.choice(nlist)
+ if u == v or G.has_edge(u, v):
+ continue
+ else:
+ G.add_edge(u, v)
+ edge_count = edge_count + 1
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def newman_watts_strogatz_graph(n, k, p, seed=None, *, create_using=None):
+ """Returns a Newman–Watts–Strogatz small-world graph.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ k : int
+ Each node is joined with its `k` nearest neighbors in a ring
+ topology.
+ p : float
+ The probability of adding a new edge for each edge.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Notes
+ -----
+ First create a ring over $n$ nodes [1]_. Then each node in the ring is
+ connected with its $k$ nearest neighbors (or $k - 1$ neighbors if $k$
+ is odd). Then shortcuts are created by adding new edges as follows: for
+ each edge $(u, v)$ in the underlying "$n$-ring with $k$ nearest
+ neighbors" with probability $p$ add a new edge $(u, w)$ with
+ randomly-chosen existing node $w$. In contrast with
+ :func:`watts_strogatz_graph`, no edges are removed.
+
+ See Also
+ --------
+ watts_strogatz_graph
+
+ References
+ ----------
+ .. [1] M. E. J. Newman and D. J. Watts,
+ Renormalization group analysis of the small-world network model,
+ Physics Letters A, 263, 341, 1999.
+ https://doi.org/10.1016/S0375-9601(99)00757-4
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if k > n:
+ raise nx.NetworkXError("k>=n, choose smaller k or larger n")
+
+ # If k == n the graph return is a complete graph
+ if k == n:
+ return nx.complete_graph(n, create_using)
+
+ G = empty_graph(n, create_using)
+ nlist = list(G.nodes())
+ fromv = nlist
+ # connect the k/2 neighbors
+ for j in range(1, k // 2 + 1):
+ tov = fromv[j:] + fromv[0:j] # the first j are now last
+ for i in range(len(fromv)):
+ G.add_edge(fromv[i], tov[i])
+ # for each edge u-v, with probability p, randomly select existing
+ # node w and add new edge u-w
+ e = list(G.edges())
+ for u, v in e:
+ if seed.random() < p:
+ w = seed.choice(nlist)
+ # no self-loops and reject if edge u-w exists
+ # is that the correct NWS model?
+ while w == u or G.has_edge(u, w):
+ w = seed.choice(nlist)
+ if G.degree(u) >= n - 1:
+ break # skip this rewiring
+ else:
+ G.add_edge(u, w)
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def watts_strogatz_graph(n, k, p, seed=None, *, create_using=None):
+ """Returns a Watts–Strogatz small-world graph.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ k : int
+ Each node is joined with its `k` nearest neighbors in a ring
+ topology.
+ p : float
+ The probability of rewiring each edge
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ See Also
+ --------
+ newman_watts_strogatz_graph
+ connected_watts_strogatz_graph
+
+ Notes
+ -----
+ First create a ring over $n$ nodes [1]_. Then each node in the ring is joined
+ to its $k$ nearest neighbors (or $k - 1$ neighbors if $k$ is odd).
+ Then shortcuts are created by replacing some edges as follows: for each
+ edge $(u, v)$ in the underlying "$n$-ring with $k$ nearest neighbors"
+ with probability $p$ replace it with a new edge $(u, w)$ with uniformly
+ random choice of existing node $w$.
+
+ In contrast with :func:`newman_watts_strogatz_graph`, the random rewiring
+ does not increase the number of edges. The rewired graph is not guaranteed
+ to be connected as in :func:`connected_watts_strogatz_graph`.
+
+ References
+ ----------
+ .. [1] Duncan J. Watts and Steven H. Strogatz,
+ Collective dynamics of small-world networks,
+ Nature, 393, pp. 440--442, 1998.
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if k > n:
+ raise nx.NetworkXError("k>n, choose smaller k or larger n")
+
+ # If k == n, the graph is complete not Watts-Strogatz
+ if k == n:
+ G = nx.complete_graph(n, create_using)
+ return G
+
+ G = nx.empty_graph(n, create_using=create_using)
+ nodes = list(range(n)) # nodes are labeled 0 to n-1
+ # connect each node to k/2 neighbors
+ for j in range(1, k // 2 + 1):
+ targets = nodes[j:] + nodes[0:j] # first j nodes are now last in list
+ G.add_edges_from(zip(nodes, targets))
+ # rewire edges from each node
+ # loop over all nodes in order (label) and neighbors in order (distance)
+ # no self loops or multiple edges allowed
+ for j in range(1, k // 2 + 1): # outer loop is neighbors
+ targets = nodes[j:] + nodes[0:j] # first j nodes are now last in list
+ # inner loop in node order
+ for u, v in zip(nodes, targets):
+ if seed.random() < p:
+ w = seed.choice(nodes)
+ # Enforce no self-loops or multiple edges
+ while w == u or G.has_edge(u, w):
+ w = seed.choice(nodes)
+ if G.degree(u) >= n - 1:
+ break # skip this rewiring
+ else:
+ G.remove_edge(u, v)
+ G.add_edge(u, w)
+ return G
+
+
+@py_random_state(4)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def connected_watts_strogatz_graph(n, k, p, tries=100, seed=None, *, create_using=None):
+ """Returns a connected Watts–Strogatz small-world graph.
+
+ Attempts to generate a connected graph by repeated generation of
+ Watts–Strogatz small-world graphs. An exception is raised if the maximum
+ number of tries is exceeded.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ k : int
+ Each node is joined with its `k` nearest neighbors in a ring
+ topology.
+ p : float
+ The probability of rewiring each edge
+ tries : int
+ Number of attempts to generate a connected graph.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Notes
+ -----
+ First create a ring over $n$ nodes [1]_. Then each node in the ring is joined
+ to its $k$ nearest neighbors (or $k - 1$ neighbors if $k$ is odd).
+ Then shortcuts are created by replacing some edges as follows: for each
+ edge $(u, v)$ in the underlying "$n$-ring with $k$ nearest neighbors"
+ with probability $p$ replace it with a new edge $(u, w)$ with uniformly
+ random choice of existing node $w$.
+ The entire process is repeated until a connected graph results.
+
+ See Also
+ --------
+ newman_watts_strogatz_graph
+ watts_strogatz_graph
+
+ References
+ ----------
+ .. [1] Duncan J. Watts and Steven H. Strogatz,
+ Collective dynamics of small-world networks,
+ Nature, 393, pp. 440--442, 1998.
+ """
+ for i in range(tries):
+ # seed is an RNG so should change sequence each call
+ G = watts_strogatz_graph(n, k, p, seed, create_using=create_using)
+ if nx.is_connected(G):
+ return G
+ raise nx.NetworkXError("Maximum number of tries exceeded")
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_regular_graph(d, n, seed=None, *, create_using=None):
+ r"""Returns a random $d$-regular graph on $n$ nodes.
+
+ A regular graph is a graph where each node has the same number of neighbors.
+
+ The resulting graph has no self-loops or parallel edges.
+
+ Parameters
+ ----------
+ d : int
+ The degree of each node.
+ n : integer
+ The number of nodes. The value of $n \times d$ must be even.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Notes
+ -----
+ The nodes are numbered from $0$ to $n - 1$.
+
+ Kim and Vu's paper [2]_ shows that this algorithm samples in an
+ asymptotically uniform way from the space of random graphs when
+ $d = O(n^{1 / 3 - \epsilon})$.
+
+ Raises
+ ------
+
+ NetworkXError
+ If $n \times d$ is odd or $d$ is greater than or equal to $n$.
+
+ References
+ ----------
+ .. [1] A. Steger and N. Wormald,
+ Generating random regular graphs quickly,
+ Probability and Computing 8 (1999), 377-396, 1999.
+ https://doi.org/10.1017/S0963548399003867
+
+ .. [2] Jeong Han Kim and Van H. Vu,
+ Generating random regular graphs,
+ Proceedings of the thirty-fifth ACM symposium on Theory of computing,
+ San Diego, CA, USA, pp 213--222, 2003.
+ http://portal.acm.org/citation.cfm?id=780542.780576
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if (n * d) % 2 != 0:
+ raise nx.NetworkXError("n * d must be even")
+
+ if not 0 <= d < n:
+ raise nx.NetworkXError("the 0 <= d < n inequality must be satisfied")
+
+ G = nx.empty_graph(n, create_using=create_using)
+
+ if d == 0:
+ return G
+
+ def _suitable(edges, potential_edges):
+ # Helper subroutine to check if there are suitable edges remaining
+ # If False, the generation of the graph has failed
+ if not potential_edges:
+ return True
+ for s1 in potential_edges:
+ for s2 in potential_edges:
+ # Two iterators on the same dictionary are guaranteed
+ # to visit it in the same order if there are no
+ # intervening modifications.
+ if s1 == s2:
+ # Only need to consider s1-s2 pair one time
+ break
+ if s1 > s2:
+ s1, s2 = s2, s1
+ if (s1, s2) not in edges:
+ return True
+ return False
+
+ def _try_creation():
+ # Attempt to create an edge set
+
+ edges = set()
+ stubs = list(range(n)) * d
+
+ while stubs:
+ potential_edges = defaultdict(lambda: 0)
+ seed.shuffle(stubs)
+ stubiter = iter(stubs)
+ for s1, s2 in zip(stubiter, stubiter):
+ if s1 > s2:
+ s1, s2 = s2, s1
+ if s1 != s2 and ((s1, s2) not in edges):
+ edges.add((s1, s2))
+ else:
+ potential_edges[s1] += 1
+ potential_edges[s2] += 1
+
+ if not _suitable(edges, potential_edges):
+ return None # failed to find suitable edge set
+
+ stubs = [
+ node
+ for node, potential in potential_edges.items()
+ for _ in range(potential)
+ ]
+ return edges
+
+ # Even though a suitable edge set exists,
+ # the generation of such a set is not guaranteed.
+ # Try repeatedly to find one.
+ edges = _try_creation()
+ while edges is None:
+ edges = _try_creation()
+ G.add_edges_from(edges)
+
+ return G
+
+
+def _random_subset(seq, m, rng):
+ """Return m unique elements from seq.
+
+ This differs from random.sample which can return repeated
+ elements if seq holds repeated elements.
+
+ Note: rng is a random.Random or numpy.random.RandomState instance.
+ """
+ targets = set()
+ while len(targets) < m:
+ x = rng.choice(seq)
+ targets.add(x)
+ return targets
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def barabasi_albert_graph(n, m, seed=None, initial_graph=None, *, create_using=None):
+ """Returns a random graph using Barabási–Albert preferential attachment
+
+ A graph of $n$ nodes is grown by attaching new nodes each with $m$
+ edges that are preferentially attached to existing nodes with high degree.
+
+ Parameters
+ ----------
+ n : int
+ Number of nodes
+ m : int
+ Number of edges to attach from a new node to existing nodes
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ initial_graph : Graph or None (default)
+ Initial network for Barabási–Albert algorithm.
+ It should be a connected graph for most use cases.
+ A copy of `initial_graph` is used.
+ If None, starts from a star graph on (m+1) nodes.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Returns
+ -------
+ G : Graph
+
+ Raises
+ ------
+ NetworkXError
+ If `m` does not satisfy ``1 <= m < n``, or
+ the initial graph number of nodes m0 does not satisfy ``m <= m0 <= n``.
+
+ References
+ ----------
+ .. [1] A. L. Barabási and R. Albert "Emergence of scaling in
+ random networks", Science 286, pp 509-512, 1999.
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if m < 1 or m >= n:
+ raise nx.NetworkXError(
+ f"Barabási–Albert network must have m >= 1 and m < n, m = {m}, n = {n}"
+ )
+
+ if initial_graph is None:
+ # Default initial graph : star graph on (m + 1) nodes
+ G = star_graph(m, create_using)
+ else:
+ if len(initial_graph) < m or len(initial_graph) > n:
+ raise nx.NetworkXError(
+ f"Barabási–Albert initial graph needs between m={m} and n={n} nodes"
+ )
+ G = initial_graph.copy()
+
+ # List of existing nodes, with nodes repeated once for each adjacent edge
+ repeated_nodes = [n for n, d in G.degree() for _ in range(d)]
+ # Start adding the other n - m0 nodes.
+ source = len(G)
+ while source < n:
+ # Now choose m unique nodes from the existing nodes
+ # Pick uniformly from repeated_nodes (preferential attachment)
+ targets = _random_subset(repeated_nodes, m, seed)
+ # Add edges to m nodes from the source.
+ G.add_edges_from(zip([source] * m, targets))
+ # Add one node to the list for each new edge just created.
+ repeated_nodes.extend(targets)
+ # And the new node "source" has m edges to add to the list.
+ repeated_nodes.extend([source] * m)
+
+ source += 1
+ return G
+
+
+@py_random_state(4)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def dual_barabasi_albert_graph(
+ n, m1, m2, p, seed=None, initial_graph=None, *, create_using=None
+):
+ """Returns a random graph using dual Barabási–Albert preferential attachment
+
+ A graph of $n$ nodes is grown by attaching new nodes each with either $m_1$
+ edges (with probability $p$) or $m_2$ edges (with probability $1-p$) that
+ are preferentially attached to existing nodes with high degree.
+
+ Parameters
+ ----------
+ n : int
+ Number of nodes
+ m1 : int
+ Number of edges to link each new node to existing nodes with probability $p$
+ m2 : int
+ Number of edges to link each new node to existing nodes with probability $1-p$
+ p : float
+ The probability of attaching $m_1$ edges (as opposed to $m_2$ edges)
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ initial_graph : Graph or None (default)
+ Initial network for Barabási–Albert algorithm.
+ A copy of `initial_graph` is used.
+ It should be connected for most use cases.
+ If None, starts from an star graph on max(m1, m2) + 1 nodes.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Returns
+ -------
+ G : Graph
+
+ Raises
+ ------
+ NetworkXError
+ If `m1` and `m2` do not satisfy ``1 <= m1,m2 < n``, or
+ `p` does not satisfy ``0 <= p <= 1``, or
+ the initial graph number of nodes m0 does not satisfy m1, m2 <= m0 <= n.
+
+ References
+ ----------
+ .. [1] N. Moshiri "The dual-Barabasi-Albert model", arXiv:1810.10538.
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if m1 < 1 or m1 >= n:
+ raise nx.NetworkXError(
+ f"Dual Barabási–Albert must have m1 >= 1 and m1 < n, m1 = {m1}, n = {n}"
+ )
+ if m2 < 1 or m2 >= n:
+ raise nx.NetworkXError(
+ f"Dual Barabási–Albert must have m2 >= 1 and m2 < n, m2 = {m2}, n = {n}"
+ )
+ if p < 0 or p > 1:
+ raise nx.NetworkXError(
+ f"Dual Barabási–Albert network must have 0 <= p <= 1, p = {p}"
+ )
+
+ # For simplicity, if p == 0 or 1, just return BA
+ if p == 1:
+ return barabasi_albert_graph(n, m1, seed, create_using=create_using)
+ elif p == 0:
+ return barabasi_albert_graph(n, m2, seed, create_using=create_using)
+
+ if initial_graph is None:
+ # Default initial graph : star graph on max(m1, m2) nodes
+ G = star_graph(max(m1, m2), create_using)
+ else:
+ if len(initial_graph) < max(m1, m2) or len(initial_graph) > n:
+ raise nx.NetworkXError(
+ f"Barabási–Albert initial graph must have between "
+ f"max(m1, m2) = {max(m1, m2)} and n = {n} nodes"
+ )
+ G = initial_graph.copy()
+
+ # Target nodes for new edges
+ targets = list(G)
+ # List of existing nodes, with nodes repeated once for each adjacent edge
+ repeated_nodes = [n for n, d in G.degree() for _ in range(d)]
+ # Start adding the remaining nodes.
+ source = len(G)
+ while source < n:
+ # Pick which m to use (m1 or m2)
+ if seed.random() < p:
+ m = m1
+ else:
+ m = m2
+ # Now choose m unique nodes from the existing nodes
+ # Pick uniformly from repeated_nodes (preferential attachment)
+ targets = _random_subset(repeated_nodes, m, seed)
+ # Add edges to m nodes from the source.
+ G.add_edges_from(zip([source] * m, targets))
+ # Add one node to the list for each new edge just created.
+ repeated_nodes.extend(targets)
+ # And the new node "source" has m edges to add to the list.
+ repeated_nodes.extend([source] * m)
+
+ source += 1
+ return G
+
+
+@py_random_state(4)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def extended_barabasi_albert_graph(n, m, p, q, seed=None, *, create_using=None):
+ """Returns an extended Barabási–Albert model graph.
+
+ An extended Barabási–Albert model graph is a random graph constructed
+ using preferential attachment. The extended model allows new edges,
+ rewired edges or new nodes. Based on the probabilities $p$ and $q$
+ with $p + q < 1$, the growing behavior of the graph is determined as:
+
+ 1) With $p$ probability, $m$ new edges are added to the graph,
+ starting from randomly chosen existing nodes and attached preferentially at the
+ other end.
+
+ 2) With $q$ probability, $m$ existing edges are rewired
+ by randomly choosing an edge and rewiring one end to a preferentially chosen node.
+
+ 3) With $(1 - p - q)$ probability, $m$ new nodes are added to the graph
+ with edges attached preferentially.
+
+ When $p = q = 0$, the model behaves just like the Barabási–Alber model.
+
+ Parameters
+ ----------
+ n : int
+ Number of nodes
+ m : int
+ Number of edges with which a new node attaches to existing nodes
+ p : float
+ Probability value for adding an edge between existing nodes. p + q < 1
+ q : float
+ Probability value of rewiring of existing edges. p + q < 1
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Returns
+ -------
+ G : Graph
+
+ Raises
+ ------
+ NetworkXError
+ If `m` does not satisfy ``1 <= m < n`` or ``1 >= p + q``
+
+ References
+ ----------
+ .. [1] Albert, R., & Barabási, A. L. (2000)
+ Topology of evolving networks: local events and universality
+ Physical review letters, 85(24), 5234.
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if m < 1 or m >= n:
+ msg = f"Extended Barabasi-Albert network needs m>=1 and m= 1:
+ msg = f"Extended Barabasi-Albert network needs p + q <= 1, p={p}, q={q}"
+ raise nx.NetworkXError(msg)
+
+ # Add m initial nodes (m0 in barabasi-speak)
+ G = empty_graph(m, create_using)
+
+ # List of nodes to represent the preferential attachment random selection.
+ # At the creation of the graph, all nodes are added to the list
+ # so that even nodes that are not connected have a chance to get selected,
+ # for rewiring and adding of edges.
+ # With each new edge, nodes at the ends of the edge are added to the list.
+ attachment_preference = []
+ attachment_preference.extend(range(m))
+
+ # Start adding the other n-m nodes. The first node is m.
+ new_node = m
+ while new_node < n:
+ a_probability = seed.random()
+
+ # Total number of edges of a Clique of all the nodes
+ clique_degree = len(G) - 1
+ clique_size = (len(G) * clique_degree) / 2
+
+ # Adding m new edges, if there is room to add them
+ if a_probability < p and G.size() <= clique_size - m:
+ # Select the nodes where an edge can be added
+ eligible_nodes = [nd for nd, deg in G.degree() if deg < clique_degree]
+ for i in range(m):
+ # Choosing a random source node from eligible_nodes
+ src_node = seed.choice(eligible_nodes)
+
+ # Picking a possible node that is not 'src_node' or
+ # neighbor with 'src_node', with preferential attachment
+ prohibited_nodes = list(G[src_node])
+ prohibited_nodes.append(src_node)
+ # This will raise an exception if the sequence is empty
+ dest_node = seed.choice(
+ [nd for nd in attachment_preference if nd not in prohibited_nodes]
+ )
+ # Adding the new edge
+ G.add_edge(src_node, dest_node)
+
+ # Appending both nodes to add to their preferential attachment
+ attachment_preference.append(src_node)
+ attachment_preference.append(dest_node)
+
+ # Adjusting the eligible nodes. Degree may be saturated.
+ if G.degree(src_node) == clique_degree:
+ eligible_nodes.remove(src_node)
+ if G.degree(dest_node) == clique_degree and dest_node in eligible_nodes:
+ eligible_nodes.remove(dest_node)
+
+ # Rewiring m edges, if there are enough edges
+ elif p <= a_probability < (p + q) and m <= G.size() < clique_size:
+ # Selecting nodes that have at least 1 edge but that are not
+ # fully connected to ALL other nodes (center of star).
+ # These nodes are the pivot nodes of the edges to rewire
+ eligible_nodes = [nd for nd, deg in G.degree() if 0 < deg < clique_degree]
+ for i in range(m):
+ # Choosing a random source node
+ node = seed.choice(eligible_nodes)
+
+ # The available nodes do have a neighbor at least.
+ nbr_nodes = list(G[node])
+
+ # Choosing the other end that will get detached
+ src_node = seed.choice(nbr_nodes)
+
+ # Picking a target node that is not 'node' or
+ # neighbor with 'node', with preferential attachment
+ nbr_nodes.append(node)
+ dest_node = seed.choice(
+ [nd for nd in attachment_preference if nd not in nbr_nodes]
+ )
+ # Rewire
+ G.remove_edge(node, src_node)
+ G.add_edge(node, dest_node)
+
+ # Adjusting the preferential attachment list
+ attachment_preference.remove(src_node)
+ attachment_preference.append(dest_node)
+
+ # Adjusting the eligible nodes.
+ # nodes may be saturated or isolated.
+ if G.degree(src_node) == 0 and src_node in eligible_nodes:
+ eligible_nodes.remove(src_node)
+ if dest_node in eligible_nodes:
+ if G.degree(dest_node) == clique_degree:
+ eligible_nodes.remove(dest_node)
+ else:
+ if G.degree(dest_node) == 1:
+ eligible_nodes.append(dest_node)
+
+ # Adding new node with m edges
+ else:
+ # Select the edges' nodes by preferential attachment
+ targets = _random_subset(attachment_preference, m, seed)
+ G.add_edges_from(zip([new_node] * m, targets))
+
+ # Add one node to the list for each new edge just created.
+ attachment_preference.extend(targets)
+ # The new node has m edges to it, plus itself: m + 1
+ attachment_preference.extend([new_node] * (m + 1))
+ new_node += 1
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def powerlaw_cluster_graph(n, m, p, seed=None, *, create_using=None):
+ """Holme and Kim algorithm for growing graphs with powerlaw
+ degree distribution and approximate average clustering.
+
+ Parameters
+ ----------
+ n : int
+ the number of nodes
+ m : int
+ the number of random edges to add for each new node
+ p : float,
+ Probability of adding a triangle after adding a random edge
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Notes
+ -----
+ The average clustering has a hard time getting above a certain
+ cutoff that depends on `m`. This cutoff is often quite low. The
+ transitivity (fraction of triangles to possible triangles) seems to
+ decrease with network size.
+
+ It is essentially the Barabási–Albert (BA) growth model with an
+ extra step that each random edge is followed by a chance of
+ making an edge to one of its neighbors too (and thus a triangle).
+
+ This algorithm improves on BA in the sense that it enables a
+ higher average clustering to be attained if desired.
+
+ It seems possible to have a disconnected graph with this algorithm
+ since the initial `m` nodes may not be all linked to a new node
+ on the first iteration like the BA model.
+
+ Raises
+ ------
+ NetworkXError
+ If `m` does not satisfy ``1 <= m <= n`` or `p` does not
+ satisfy ``0 <= p <= 1``.
+
+ References
+ ----------
+ .. [1] P. Holme and B. J. Kim,
+ "Growing scale-free networks with tunable clustering",
+ Phys. Rev. E, 65, 026107, 2002.
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if m < 1 or n < m:
+ raise nx.NetworkXError(f"NetworkXError must have m>1 and m 1 or p < 0:
+ raise nx.NetworkXError(f"NetworkXError p must be in [0,1], p={p}")
+
+ G = empty_graph(m, create_using) # add m initial nodes (m0 in barabasi-speak)
+ repeated_nodes = list(G) # list of existing nodes to sample from
+ # with nodes repeated once for each adjacent edge
+ source = m # next node is m
+ while source < n: # Now add the other n-1 nodes
+ possible_targets = _random_subset(repeated_nodes, m, seed)
+ # do one preferential attachment for new node
+ target = possible_targets.pop()
+ G.add_edge(source, target)
+ repeated_nodes.append(target) # add one node to list for each new link
+ count = 1
+ while count < m: # add m-1 more new links
+ if seed.random() < p: # clustering step: add triangle
+ neighborhood = [
+ nbr
+ for nbr in G.neighbors(target)
+ if not G.has_edge(source, nbr) and nbr != source
+ ]
+ if neighborhood: # if there is a neighbor without a link
+ nbr = seed.choice(neighborhood)
+ G.add_edge(source, nbr) # add triangle
+ repeated_nodes.append(nbr)
+ count = count + 1
+ continue # go to top of while loop
+ # else do preferential attachment step if above fails
+ target = possible_targets.pop()
+ G.add_edge(source, target)
+ repeated_nodes.append(target)
+ count = count + 1
+
+ repeated_nodes.extend([source] * m) # add source node to list m times
+ source += 1
+ return G
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_lobster(n, p1, p2, seed=None, *, create_using=None):
+ """Returns a random lobster graph.
+
+ A lobster is a tree that reduces to a caterpillar when pruning all
+ leaf nodes. A caterpillar is a tree that reduces to a path graph
+ when pruning all leaf nodes; setting `p2` to zero produces a caterpillar.
+
+ This implementation iterates on the probabilities `p1` and `p2` to add
+ edges at levels 1 and 2, respectively. Graphs are therefore constructed
+ iteratively with uniform randomness at each level rather than being selected
+ uniformly at random from the set of all possible lobsters.
+
+ Parameters
+ ----------
+ n : int
+ The expected number of nodes in the backbone
+ p1 : float
+ Probability of adding an edge to the backbone
+ p2 : float
+ Probability of adding an edge one level beyond backbone
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Grap)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Raises
+ ------
+ NetworkXError
+ If `p1` or `p2` parameters are >= 1 because the while loops would never finish.
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ p1, p2 = abs(p1), abs(p2)
+ if any(p >= 1 for p in [p1, p2]):
+ raise nx.NetworkXError("Probability values for `p1` and `p2` must both be < 1.")
+
+ # a necessary ingredient in any self-respecting graph library
+ llen = int(2 * seed.random() * n + 0.5)
+ L = path_graph(llen, create_using)
+ # build caterpillar: add edges to path graph with probability p1
+ current_node = llen - 1
+ for n in range(llen):
+ while seed.random() < p1: # add fuzzy caterpillar parts
+ current_node += 1
+ L.add_edge(n, current_node)
+ cat_node = current_node
+ while seed.random() < p2: # add crunchy lobster bits
+ current_node += 1
+ L.add_edge(cat_node, current_node)
+ return L # voila, un lobster!
+
+
+@py_random_state(1)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_shell_graph(constructor, seed=None, *, create_using=None):
+ """Returns a random shell graph for the constructor given.
+
+ Parameters
+ ----------
+ constructor : list of three-tuples
+ Represents the parameters for a shell, starting at the center
+ shell. Each element of the list must be of the form `(n, m,
+ d)`, where `n` is the number of nodes in the shell, `m` is
+ the number of edges in the shell, and `d` is the ratio of
+ inter-shell (next) edges to intra-shell edges. If `d` is zero,
+ there will be no intra-shell edges, and if `d` is one there
+ will be all possible intra-shell edges.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. Graph instances are not supported.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Examples
+ --------
+ >>> constructor = [(10, 20, 0.8), (20, 40, 0.8)]
+ >>> G = nx.random_shell_graph(constructor)
+
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ G = empty_graph(0, create_using)
+
+ glist = []
+ intra_edges = []
+ nnodes = 0
+ # create gnm graphs for each shell
+ for n, m, d in constructor:
+ inter_edges = int(m * d)
+ intra_edges.append(m - inter_edges)
+ g = nx.convert_node_labels_to_integers(
+ gnm_random_graph(n, inter_edges, seed=seed, create_using=G.__class__),
+ first_label=nnodes,
+ )
+ glist.append(g)
+ nnodes += n
+ G = nx.operators.union(G, g)
+
+ # connect the shells randomly
+ for gi in range(len(glist) - 1):
+ nlist1 = list(glist[gi])
+ nlist2 = list(glist[gi + 1])
+ total_edges = intra_edges[gi]
+ edge_count = 0
+ while edge_count < total_edges:
+ u = seed.choice(nlist1)
+ v = seed.choice(nlist2)
+ if u == v or G.has_edge(u, v):
+ continue
+ else:
+ G.add_edge(u, v)
+ edge_count = edge_count + 1
+ return G
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_powerlaw_tree(n, gamma=3, seed=None, tries=100, *, create_using=None):
+ """Returns a tree with a power law degree distribution.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ gamma : float
+ Exponent of the power law.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ tries : int
+ Number of attempts to adjust the sequence to make it a tree.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Raises
+ ------
+ NetworkXError
+ If no valid sequence is found within the maximum number of
+ attempts.
+
+ Notes
+ -----
+ A trial power law degree sequence is chosen and then elements are
+ swapped with new elements from a powerlaw distribution until the
+ sequence makes a tree (by checking, for example, that the number of
+ edges is one smaller than the number of nodes).
+
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ # This call may raise a NetworkXError if the number of tries is succeeded.
+ seq = random_powerlaw_tree_sequence(n, gamma=gamma, seed=seed, tries=tries)
+ G = degree_sequence_tree(seq, create_using)
+ return G
+
+
+@py_random_state(2)
+@nx._dispatchable(graphs=None)
+def random_powerlaw_tree_sequence(n, gamma=3, seed=None, tries=100):
+ """Returns a degree sequence for a tree with a power law distribution.
+
+ Parameters
+ ----------
+ n : int,
+ The number of nodes.
+ gamma : float
+ Exponent of the power law.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ tries : int
+ Number of attempts to adjust the sequence to make it a tree.
+
+ Raises
+ ------
+ NetworkXError
+ If no valid sequence is found within the maximum number of
+ attempts.
+
+ Notes
+ -----
+ A trial power law degree sequence is chosen and then elements are
+ swapped with new elements from a power law distribution until
+ the sequence makes a tree (by checking, for example, that the number of
+ edges is one smaller than the number of nodes).
+
+ """
+ # get trial sequence
+ z = nx.utils.powerlaw_sequence(n, exponent=gamma, seed=seed)
+ # round to integer values in the range [0,n]
+ zseq = [min(n, max(round(s), 0)) for s in z]
+
+ # another sequence to swap values from
+ z = nx.utils.powerlaw_sequence(tries, exponent=gamma, seed=seed)
+ # round to integer values in the range [0,n]
+ swap = [min(n, max(round(s), 0)) for s in z]
+
+ for deg in swap:
+ # If this degree sequence can be the degree sequence of a tree, return
+ # it. It can be a tree if the number of edges is one fewer than the
+ # number of nodes, or in other words, `n - sum(zseq) / 2 == 1`. We
+ # use an equivalent condition below that avoids floating point
+ # operations.
+ if 2 * n - sum(zseq) == 2:
+ return zseq
+ index = seed.randint(0, n - 1)
+ zseq[index] = swap.pop()
+
+ raise nx.NetworkXError(
+ f"Exceeded max ({tries}) attempts for a valid tree sequence."
+ )
+
+
+@py_random_state(3)
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_kernel_graph(
+ n, kernel_integral, kernel_root=None, seed=None, *, create_using=None
+):
+ r"""Returns an random graph based on the specified kernel.
+
+ The algorithm chooses each of the $[n(n-1)]/2$ possible edges with
+ probability specified by a kernel $\kappa(x,y)$ [1]_. The kernel
+ $\kappa(x,y)$ must be a symmetric (in $x,y$), non-negative,
+ bounded function.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ kernel_integral : function
+ Function that returns the definite integral of the kernel $\kappa(x,y)$,
+ $F(y,a,b) := \int_a^b \kappa(x,y)dx$
+ kernel_root: function (optional)
+ Function that returns the root $b$ of the equation $F(y,a,b) = r$.
+ If None, the root is found using :func:`scipy.optimize.brentq`
+ (this requires SciPy).
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+ create_using : Graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ Multigraph and directed types are not supported and raise a ``NetworkXError``.
+
+ Notes
+ -----
+ The kernel is specified through its definite integral which must be
+ provided as one of the arguments. If the integral and root of the
+ kernel integral can be found in $O(1)$ time then this algorithm runs in
+ time $O(n+m)$ where m is the expected number of edges [2]_.
+
+ The nodes are set to integers from $0$ to $n-1$.
+
+ Examples
+ --------
+ Generate an Erdős–Rényi random graph $G(n,c/n)$, with kernel
+ $\kappa(x,y)=c$ where $c$ is the mean expected degree.
+
+ >>> def integral(u, w, z):
+ ... return c * (z - w)
+ >>> def root(u, w, r):
+ ... return r / c + w
+ >>> c = 1
+ >>> graph = nx.random_kernel_graph(1000, integral, root)
+
+ See Also
+ --------
+ gnp_random_graph
+ expected_degree_graph
+
+ References
+ ----------
+ .. [1] Bollobás, Béla, Janson, S. and Riordan, O.
+ "The phase transition in inhomogeneous random graphs",
+ *Random Structures Algorithms*, 31, 3--122, 2007.
+
+ .. [2] Hagberg A, Lemons N (2015),
+ "Fast Generation of Sparse Random Kernel Graphs".
+ PLoS ONE 10(9): e0135177, 2015. doi:10.1371/journal.pone.0135177
+ """
+ create_using = check_create_using(create_using, directed=False, multigraph=False)
+ if kernel_root is None:
+ import scipy as sp
+
+ def kernel_root(y, a, r):
+ def my_function(b):
+ return kernel_integral(y, a, b) - r
+
+ return sp.optimize.brentq(my_function, a, 1)
+
+ graph = nx.empty_graph(create_using=create_using)
+ graph.add_nodes_from(range(n))
+ (i, j) = (1, 1)
+ while i < n:
+ r = -math.log(1 - seed.random()) # (1-seed.random()) in (0, 1]
+ if kernel_integral(i / n, j / n, 1) <= r:
+ i, j = i + 1, i + 1
+ else:
+ j = math.ceil(n * kernel_root(i / n, j / n, r))
+ graph.add_edge(i - 1, j - 1)
+ return graph
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/small.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/small.py
new file mode 100644
index 0000000000000000000000000000000000000000..acd2fbc7a34e16023253e15ffb6a156416e4ce83
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/small.py
@@ -0,0 +1,993 @@
+"""
+Various small and named graphs, together with some compact generators.
+
+"""
+
+__all__ = [
+ "LCF_graph",
+ "bull_graph",
+ "chvatal_graph",
+ "cubical_graph",
+ "desargues_graph",
+ "diamond_graph",
+ "dodecahedral_graph",
+ "frucht_graph",
+ "heawood_graph",
+ "hoffman_singleton_graph",
+ "house_graph",
+ "house_x_graph",
+ "icosahedral_graph",
+ "krackhardt_kite_graph",
+ "moebius_kantor_graph",
+ "octahedral_graph",
+ "pappus_graph",
+ "petersen_graph",
+ "sedgewick_maze_graph",
+ "tetrahedral_graph",
+ "truncated_cube_graph",
+ "truncated_tetrahedron_graph",
+ "tutte_graph",
+]
+
+from functools import wraps
+
+import networkx as nx
+from networkx.exception import NetworkXError
+from networkx.generators.classic import (
+ complete_graph,
+ cycle_graph,
+ empty_graph,
+ path_graph,
+)
+
+
+def _raise_on_directed(func):
+ """
+ A decorator which inspects the `create_using` argument and raises a
+ NetworkX exception when `create_using` is a DiGraph (class or instance) for
+ graph generators that do not support directed outputs.
+ """
+
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ if kwargs.get("create_using") is not None:
+ G = nx.empty_graph(create_using=kwargs["create_using"])
+ if G.is_directed():
+ raise NetworkXError("Directed Graph not supported")
+ return func(*args, **kwargs)
+
+ return wrapper
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def LCF_graph(n, shift_list, repeats, create_using=None):
+ """
+ Return the cubic graph specified in LCF notation.
+
+ LCF (Lederberg-Coxeter-Fruchte) notation[1]_ is a compressed
+ notation used in the generation of various cubic Hamiltonian
+ graphs of high symmetry. See, for example, `dodecahedral_graph`,
+ `desargues_graph`, `heawood_graph` and `pappus_graph`.
+
+ Nodes are drawn from ``range(n)``. Each node ``n_i`` is connected with
+ node ``n_i + shift % n`` where ``shift`` is given by cycling through
+ the input `shift_list` `repeat` s times.
+
+ Parameters
+ ----------
+ n : int
+ The starting graph is the `n`-cycle with nodes ``0, ..., n-1``.
+ The null graph is returned if `n` < 1.
+
+ shift_list : list
+ A list of integer shifts mod `n`, ``[s1, s2, .., sk]``
+
+ repeats : int
+ Integer specifying the number of times that shifts in `shift_list`
+ are successively applied to each current node in the n-cycle
+ to generate an edge between ``n_current`` and ``n_current + shift mod n``.
+
+ Returns
+ -------
+ G : Graph
+ A graph instance created from the specified LCF notation.
+
+ Examples
+ --------
+ The utility graph $K_{3,3}$
+
+ >>> G = nx.LCF_graph(6, [3, -3], 3)
+ >>> G.edges()
+ EdgeView([(0, 1), (0, 5), (0, 3), (1, 2), (1, 4), (2, 3), (2, 5), (3, 4), (4, 5)])
+
+ The Heawood graph:
+
+ >>> G = nx.LCF_graph(14, [5, -5], 7)
+ >>> nx.is_isomorphic(G, nx.heawood_graph())
+ True
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/LCF_notation
+
+ """
+ if n <= 0:
+ return empty_graph(0, create_using)
+
+ # start with the n-cycle
+ G = cycle_graph(n, create_using)
+ if G.is_directed():
+ raise NetworkXError("Directed Graph not supported")
+ G.name = "LCF_graph"
+ nodes = sorted(G)
+
+ n_extra_edges = repeats * len(shift_list)
+ # edges are added n_extra_edges times
+ # (not all of these need be new)
+ if n_extra_edges < 1:
+ return G
+
+ for i in range(n_extra_edges):
+ shift = shift_list[i % len(shift_list)] # cycle through shift_list
+ v1 = nodes[i % n] # cycle repeatedly through nodes
+ v2 = nodes[(i + shift) % n]
+ G.add_edge(v1, v2)
+ return G
+
+
+# -------------------------------------------------------------------------------
+# Various small and named graphs
+# -------------------------------------------------------------------------------
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def bull_graph(create_using=None):
+ """
+ Returns the Bull Graph
+
+ The Bull Graph has 5 nodes and 5 edges. It is a planar undirected
+ graph in the form of a triangle with two disjoint pendant edges [1]_
+ The name comes from the triangle and pendant edges representing
+ respectively the body and legs of a bull.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ A bull graph with 5 nodes
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Bull_graph.
+
+ """
+ G = nx.from_dict_of_lists(
+ {0: [1, 2], 1: [0, 2, 3], 2: [0, 1, 4], 3: [1], 4: [2]},
+ create_using=create_using,
+ )
+ G.name = "Bull Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def chvatal_graph(create_using=None):
+ """
+ Returns the Chvátal Graph
+
+ The Chvátal Graph is an undirected graph with 12 nodes and 24 edges [1]_.
+ It has 370 distinct (directed) Hamiltonian cycles, giving a unique generalized
+ LCF notation of order 4, two of order 6 , and 43 of order 1 [2]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ The Chvátal graph with 12 nodes and 24 edges
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Chv%C3%A1tal_graph
+ .. [2] https://mathworld.wolfram.com/ChvatalGraph.html
+
+ """
+ G = nx.from_dict_of_lists(
+ {
+ 0: [1, 4, 6, 9],
+ 1: [2, 5, 7],
+ 2: [3, 6, 8],
+ 3: [4, 7, 9],
+ 4: [5, 8],
+ 5: [10, 11],
+ 6: [10, 11],
+ 7: [8, 11],
+ 8: [10],
+ 9: [10, 11],
+ },
+ create_using=create_using,
+ )
+ G.name = "Chvatal Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def cubical_graph(create_using=None):
+ """
+ Returns the 3-regular Platonic Cubical Graph
+
+ The skeleton of the cube (the nodes and edges) form a graph, with 8
+ nodes, and 12 edges. It is a special case of the hypercube graph.
+ It is one of 5 Platonic graphs, each a skeleton of its
+ Platonic solid [1]_.
+ Such graphs arise in parallel processing in computers.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ A cubical graph with 8 nodes and 12 edges
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Cube#Cubical_graph
+
+ """
+ G = nx.from_dict_of_lists(
+ {
+ 0: [1, 3, 4],
+ 1: [0, 2, 7],
+ 2: [1, 3, 6],
+ 3: [0, 2, 5],
+ 4: [0, 5, 7],
+ 5: [3, 4, 6],
+ 6: [2, 5, 7],
+ 7: [1, 4, 6],
+ },
+ create_using=create_using,
+ )
+ G.name = "Platonic Cubical Graph"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def desargues_graph(create_using=None):
+ """
+ Returns the Desargues Graph
+
+ The Desargues Graph is a non-planar, distance-transitive cubic graph
+ with 20 nodes and 30 edges [1]_.
+ It is a symmetric graph. It can be represented in LCF notation
+ as [5,-5,9,-9]^5 [2]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Desargues Graph with 20 nodes and 30 edges
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Desargues_graph
+ .. [2] https://mathworld.wolfram.com/DesarguesGraph.html
+ """
+ G = LCF_graph(20, [5, -5, 9, -9], 5, create_using)
+ G.name = "Desargues Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def diamond_graph(create_using=None):
+ """
+ Returns the Diamond graph
+
+ The Diamond Graph is planar undirected graph with 4 nodes and 5 edges.
+ It is also sometimes known as the double triangle graph or kite graph [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Diamond Graph with 4 nodes and 5 edges
+
+ References
+ ----------
+ .. [1] https://mathworld.wolfram.com/DiamondGraph.html
+ """
+ G = nx.from_dict_of_lists(
+ {0: [1, 2], 1: [0, 2, 3], 2: [0, 1, 3], 3: [1, 2]}, create_using=create_using
+ )
+ G.name = "Diamond Graph"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def dodecahedral_graph(create_using=None):
+ """
+ Returns the Platonic Dodecahedral graph.
+
+ The dodecahedral graph has 20 nodes and 30 edges. The skeleton of the
+ dodecahedron forms a graph. It is one of 5 Platonic graphs [1]_.
+ It can be described in LCF notation as:
+ ``[10, 7, 4, -4, -7, 10, -4, 7, -7, 4]^2`` [2]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Dodecahedral Graph with 20 nodes and 30 edges
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Regular_dodecahedron#Dodecahedral_graph
+ .. [2] https://mathworld.wolfram.com/DodecahedralGraph.html
+
+ """
+ G = LCF_graph(20, [10, 7, 4, -4, -7, 10, -4, 7, -7, 4], 2, create_using)
+ G.name = "Dodecahedral Graph"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def frucht_graph(create_using=None):
+ """
+ Returns the Frucht Graph.
+
+ The Frucht Graph is the smallest cubical graph whose
+ automorphism group consists only of the identity element [1]_.
+ It has 12 nodes and 18 edges and no nontrivial symmetries.
+ It is planar and Hamiltonian [2]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Frucht Graph with 12 nodes and 18 edges
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Frucht_graph
+ .. [2] https://mathworld.wolfram.com/FruchtGraph.html
+
+ """
+ G = cycle_graph(7, create_using)
+ G.add_edges_from(
+ [
+ [0, 7],
+ [1, 7],
+ [2, 8],
+ [3, 9],
+ [4, 9],
+ [5, 10],
+ [6, 10],
+ [7, 11],
+ [8, 11],
+ [8, 9],
+ [10, 11],
+ ]
+ )
+
+ G.name = "Frucht Graph"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def heawood_graph(create_using=None):
+ """
+ Returns the Heawood Graph, a (3,6) cage.
+
+ The Heawood Graph is an undirected graph with 14 nodes and 21 edges,
+ named after Percy John Heawood [1]_.
+ It is cubic symmetric, nonplanar, Hamiltonian, and can be represented
+ in LCF notation as ``[5,-5]^7`` [2]_.
+ It is the unique (3,6)-cage: the regular cubic graph of girth 6 with
+ minimal number of vertices [3]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Heawood Graph with 14 nodes and 21 edges
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Heawood_graph
+ .. [2] https://mathworld.wolfram.com/HeawoodGraph.html
+ .. [3] https://www.win.tue.nl/~aeb/graphs/Heawood.html
+
+ """
+ G = LCF_graph(14, [5, -5], 7, create_using)
+ G.name = "Heawood Graph"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def hoffman_singleton_graph():
+ """
+ Returns the Hoffman-Singleton Graph.
+
+ The Hoffman–Singleton graph is a symmetrical undirected graph
+ with 50 nodes and 175 edges.
+ All indices lie in ``Z % 5``: that is, the integers mod 5 [1]_.
+ It is the only regular graph of vertex degree 7, diameter 2, and girth 5.
+ It is the unique (7,5)-cage graph and Moore graph, and contains many
+ copies of the Petersen graph [2]_.
+
+ Returns
+ -------
+ G : networkx Graph
+ Hoffman–Singleton Graph with 50 nodes and 175 edges
+
+ Notes
+ -----
+ Constructed from pentagon and pentagram as follows: Take five pentagons $P_h$
+ and five pentagrams $Q_i$ . Join vertex $j$ of $P_h$ to vertex $h·i+j$ of $Q_i$ [3]_.
+
+ References
+ ----------
+ .. [1] https://blogs.ams.org/visualinsight/2016/02/01/hoffman-singleton-graph/
+ .. [2] https://mathworld.wolfram.com/Hoffman-SingletonGraph.html
+ .. [3] https://en.wikipedia.org/wiki/Hoffman%E2%80%93Singleton_graph
+
+ """
+ G = nx.Graph()
+ for i in range(5):
+ for j in range(5):
+ G.add_edge(("pentagon", i, j), ("pentagon", i, (j - 1) % 5))
+ G.add_edge(("pentagon", i, j), ("pentagon", i, (j + 1) % 5))
+ G.add_edge(("pentagram", i, j), ("pentagram", i, (j - 2) % 5))
+ G.add_edge(("pentagram", i, j), ("pentagram", i, (j + 2) % 5))
+ for k in range(5):
+ G.add_edge(("pentagon", i, j), ("pentagram", k, (i * k + j) % 5))
+ G = nx.convert_node_labels_to_integers(G)
+ G.name = "Hoffman-Singleton Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def house_graph(create_using=None):
+ """
+ Returns the House graph (square with triangle on top)
+
+ The house graph is a simple undirected graph with
+ 5 nodes and 6 edges [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ House graph in the form of a square with a triangle on top
+
+ References
+ ----------
+ .. [1] https://mathworld.wolfram.com/HouseGraph.html
+ """
+ G = nx.from_dict_of_lists(
+ {0: [1, 2], 1: [0, 3], 2: [0, 3, 4], 3: [1, 2, 4], 4: [2, 3]},
+ create_using=create_using,
+ )
+ G.name = "House Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def house_x_graph(create_using=None):
+ """
+ Returns the House graph with a cross inside the house square.
+
+ The House X-graph is the House graph plus the two edges connecting diagonally
+ opposite vertices of the square base. It is also one of the two graphs
+ obtained by removing two edges from the pentatope graph [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ House graph with diagonal vertices connected
+
+ References
+ ----------
+ .. [1] https://mathworld.wolfram.com/HouseGraph.html
+ """
+ G = house_graph(create_using)
+ G.add_edges_from([(0, 3), (1, 2)])
+ G.name = "House-with-X-inside Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def icosahedral_graph(create_using=None):
+ """
+ Returns the Platonic Icosahedral graph.
+
+ The icosahedral graph has 12 nodes and 30 edges. It is a Platonic graph
+ whose nodes have the connectivity of the icosahedron. It is undirected,
+ regular and Hamiltonian [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Icosahedral graph with 12 nodes and 30 edges.
+
+ References
+ ----------
+ .. [1] https://mathworld.wolfram.com/IcosahedralGraph.html
+ """
+ G = nx.from_dict_of_lists(
+ {
+ 0: [1, 5, 7, 8, 11],
+ 1: [2, 5, 6, 8],
+ 2: [3, 6, 8, 9],
+ 3: [4, 6, 9, 10],
+ 4: [5, 6, 10, 11],
+ 5: [6, 11],
+ 7: [8, 9, 10, 11],
+ 8: [9],
+ 9: [10],
+ 10: [11],
+ },
+ create_using=create_using,
+ )
+ G.name = "Platonic Icosahedral Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def krackhardt_kite_graph(create_using=None):
+ """
+ Returns the Krackhardt Kite Social Network.
+
+ A 10 actor social network introduced by David Krackhardt
+ to illustrate different centrality measures [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Krackhardt Kite graph with 10 nodes and 18 edges
+
+ Notes
+ -----
+ The traditional labeling is:
+ Andre=1, Beverley=2, Carol=3, Diane=4,
+ Ed=5, Fernando=6, Garth=7, Heather=8, Ike=9, Jane=10.
+
+ References
+ ----------
+ .. [1] Krackhardt, David. "Assessing the Political Landscape: Structure,
+ Cognition, and Power in Organizations". Administrative Science Quarterly.
+ 35 (2): 342–369. doi:10.2307/2393394. JSTOR 2393394. June 1990.
+
+ """
+ G = nx.from_dict_of_lists(
+ {
+ 0: [1, 2, 3, 5],
+ 1: [0, 3, 4, 6],
+ 2: [0, 3, 5],
+ 3: [0, 1, 2, 4, 5, 6],
+ 4: [1, 3, 6],
+ 5: [0, 2, 3, 6, 7],
+ 6: [1, 3, 4, 5, 7],
+ 7: [5, 6, 8],
+ 8: [7, 9],
+ 9: [8],
+ },
+ create_using=create_using,
+ )
+ G.name = "Krackhardt Kite Social Network"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def moebius_kantor_graph(create_using=None):
+ """
+ Returns the Moebius-Kantor graph.
+
+ The Möbius-Kantor graph is the cubic symmetric graph on 16 nodes.
+ Its LCF notation is [5,-5]^8, and it is isomorphic to the generalized
+ Petersen graph [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Moebius-Kantor graph
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/M%C3%B6bius%E2%80%93Kantor_graph
+
+ """
+ G = LCF_graph(16, [5, -5], 8, create_using)
+ G.name = "Moebius-Kantor Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def octahedral_graph(create_using=None):
+ """
+ Returns the Platonic Octahedral graph.
+
+ The octahedral graph is the 6-node 12-edge Platonic graph having the
+ connectivity of the octahedron [1]_. If 6 couples go to a party,
+ and each person shakes hands with every person except his or her partner,
+ then this graph describes the set of handshakes that take place;
+ for this reason it is also called the cocktail party graph [2]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Octahedral graph
+
+ References
+ ----------
+ .. [1] https://mathworld.wolfram.com/OctahedralGraph.html
+ .. [2] https://en.wikipedia.org/wiki/Tur%C3%A1n_graph#Special_cases
+
+ """
+ G = nx.from_dict_of_lists(
+ {0: [1, 2, 3, 4], 1: [2, 3, 5], 2: [4, 5], 3: [4, 5], 4: [5]},
+ create_using=create_using,
+ )
+ G.name = "Platonic Octahedral Graph"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def pappus_graph():
+ """
+ Returns the Pappus graph.
+
+ The Pappus graph is a cubic symmetric distance-regular graph with 18 nodes
+ and 27 edges. It is Hamiltonian and can be represented in LCF notation as
+ [5,7,-7,7,-7,-5]^3 [1]_.
+
+ Returns
+ -------
+ G : networkx Graph
+ Pappus graph
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Pappus_graph
+ """
+ G = LCF_graph(18, [5, 7, -7, 7, -7, -5], 3)
+ G.name = "Pappus Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def petersen_graph(create_using=None):
+ """
+ Returns the Petersen graph.
+
+ The Peterson graph is a cubic, undirected graph with 10 nodes and 15 edges [1]_.
+ Julius Petersen constructed the graph as the smallest counterexample
+ against the claim that a connected bridgeless cubic graph
+ has an edge colouring with three colours [2]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Petersen graph
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Petersen_graph
+ .. [2] https://www.win.tue.nl/~aeb/drg/graphs/Petersen.html
+ """
+ G = nx.from_dict_of_lists(
+ {
+ 0: [1, 4, 5],
+ 1: [0, 2, 6],
+ 2: [1, 3, 7],
+ 3: [2, 4, 8],
+ 4: [3, 0, 9],
+ 5: [0, 7, 8],
+ 6: [1, 8, 9],
+ 7: [2, 5, 9],
+ 8: [3, 5, 6],
+ 9: [4, 6, 7],
+ },
+ create_using=create_using,
+ )
+ G.name = "Petersen Graph"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def sedgewick_maze_graph(create_using=None):
+ """
+ Return a small maze with a cycle.
+
+ This is the maze used in Sedgewick, 3rd Edition, Part 5, Graph
+ Algorithms, Chapter 18, e.g. Figure 18.2 and following [1]_.
+ Nodes are numbered 0,..,7
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Small maze with a cycle
+
+ References
+ ----------
+ .. [1] Figure 18.2, Chapter 18, Graph Algorithms (3rd Ed), Sedgewick
+ """
+ G = empty_graph(0, create_using)
+ G.add_nodes_from(range(8))
+ G.add_edges_from([[0, 2], [0, 7], [0, 5]])
+ G.add_edges_from([[1, 7], [2, 6]])
+ G.add_edges_from([[3, 4], [3, 5]])
+ G.add_edges_from([[4, 5], [4, 7], [4, 6]])
+ G.name = "Sedgewick Maze"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def tetrahedral_graph(create_using=None):
+ """
+ Returns the 3-regular Platonic Tetrahedral graph.
+
+ Tetrahedral graph has 4 nodes and 6 edges. It is a
+ special case of the complete graph, K4, and wheel graph, W4.
+ It is one of the 5 platonic graphs [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Tetrahedral Graph
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Tetrahedron#Tetrahedral_graph
+
+ """
+ G = complete_graph(4, create_using)
+ G.name = "Platonic Tetrahedral Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def truncated_cube_graph(create_using=None):
+ """
+ Returns the skeleton of the truncated cube.
+
+ The truncated cube is an Archimedean solid with 14 regular
+ faces (6 octagonal and 8 triangular), 36 edges and 24 nodes [1]_.
+ The truncated cube is created by truncating (cutting off) the tips
+ of the cube one third of the way into each edge [2]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Skeleton of the truncated cube
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Truncated_cube
+ .. [2] https://www.coolmath.com/reference/polyhedra-truncated-cube
+
+ """
+ G = nx.from_dict_of_lists(
+ {
+ 0: [1, 2, 4],
+ 1: [11, 14],
+ 2: [3, 4],
+ 3: [6, 8],
+ 4: [5],
+ 5: [16, 18],
+ 6: [7, 8],
+ 7: [10, 12],
+ 8: [9],
+ 9: [17, 20],
+ 10: [11, 12],
+ 11: [14],
+ 12: [13],
+ 13: [21, 22],
+ 14: [15],
+ 15: [19, 23],
+ 16: [17, 18],
+ 17: [20],
+ 18: [19],
+ 19: [23],
+ 20: [21],
+ 21: [22],
+ 22: [23],
+ },
+ create_using=create_using,
+ )
+ G.name = "Truncated Cube Graph"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def truncated_tetrahedron_graph(create_using=None):
+ """
+ Returns the skeleton of the truncated Platonic tetrahedron.
+
+ The truncated tetrahedron is an Archimedean solid with 4 regular hexagonal faces,
+ 4 equilateral triangle faces, 12 nodes and 18 edges. It can be constructed by truncating
+ all 4 vertices of a regular tetrahedron at one third of the original edge length [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Skeleton of the truncated tetrahedron
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Truncated_tetrahedron
+
+ """
+ G = path_graph(12, create_using)
+ G.add_edges_from([(0, 2), (0, 9), (1, 6), (3, 11), (4, 11), (5, 7), (8, 10)])
+ G.name = "Truncated Tetrahedron Graph"
+ return G
+
+
+@_raise_on_directed
+@nx._dispatchable(graphs=None, returns_graph=True)
+def tutte_graph(create_using=None):
+ """
+ Returns the Tutte graph.
+
+ The Tutte graph is a cubic polyhedral, non-Hamiltonian graph. It has
+ 46 nodes and 69 edges.
+ It is a counterexample to Tait's conjecture that every 3-regular polyhedron
+ has a Hamiltonian cycle.
+ It can be realized geometrically from a tetrahedron by multiply truncating
+ three of its vertices [1]_.
+
+ Parameters
+ ----------
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ Returns
+ -------
+ G : networkx Graph
+ Tutte graph
+
+ References
+ ----------
+ .. [1] https://en.wikipedia.org/wiki/Tutte_graph
+ """
+ G = nx.from_dict_of_lists(
+ {
+ 0: [1, 2, 3],
+ 1: [4, 26],
+ 2: [10, 11],
+ 3: [18, 19],
+ 4: [5, 33],
+ 5: [6, 29],
+ 6: [7, 27],
+ 7: [8, 14],
+ 8: [9, 38],
+ 9: [10, 37],
+ 10: [39],
+ 11: [12, 39],
+ 12: [13, 35],
+ 13: [14, 15],
+ 14: [34],
+ 15: [16, 22],
+ 16: [17, 44],
+ 17: [18, 43],
+ 18: [45],
+ 19: [20, 45],
+ 20: [21, 41],
+ 21: [22, 23],
+ 22: [40],
+ 23: [24, 27],
+ 24: [25, 32],
+ 25: [26, 31],
+ 26: [33],
+ 27: [28],
+ 28: [29, 32],
+ 29: [30],
+ 30: [31, 33],
+ 31: [32],
+ 34: [35, 38],
+ 35: [36],
+ 36: [37, 39],
+ 37: [38],
+ 40: [41, 44],
+ 41: [42],
+ 42: [43, 45],
+ 43: [44],
+ },
+ create_using=create_using,
+ )
+ G.name = "Tutte's Graph"
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/social.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/social.py
new file mode 100644
index 0000000000000000000000000000000000000000..f41b2d88b4bc09f4e45967731f1dc8acfb48420b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/social.py
@@ -0,0 +1,554 @@
+"""
+Famous social networks.
+"""
+
+import networkx as nx
+
+__all__ = [
+ "karate_club_graph",
+ "davis_southern_women_graph",
+ "florentine_families_graph",
+ "les_miserables_graph",
+]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def karate_club_graph():
+ """Returns Zachary's Karate Club graph.
+
+ Each node in the returned graph has a node attribute 'club' that
+ indicates the name of the club to which the member represented by that node
+ belongs, either 'Mr. Hi' or 'Officer'. Each edge has a weight based on the
+ number of contexts in which that edge's incident node members interacted.
+
+ The dataset is derived from the 'Club After Split From Data' column of Table 3 in [1]_.
+ This was in turn derived from the 'Club After Fission' column of Table 1 in the
+ same paper. Note that the nodes are 0-indexed in NetworkX, but 1-indexed in the
+ paper (the 'Individual Number in Matrix C' column of Table 3 starts at 1). This
+ means, for example, that ``G.nodes[9]["club"]`` returns 'Officer', which
+ corresponds to row 10 of Table 3 in the paper.
+
+ Examples
+ --------
+ To get the name of the club to which a node belongs::
+
+ >>> G = nx.karate_club_graph()
+ >>> G.nodes[5]["club"]
+ 'Mr. Hi'
+ >>> G.nodes[9]["club"]
+ 'Officer'
+
+ References
+ ----------
+ .. [1] Zachary, Wayne W.
+ "An Information Flow Model for Conflict and Fission in Small Groups."
+ *Journal of Anthropological Research*, 33, 452--473, (1977).
+ """
+ # Create the set of all members, and the members of each club.
+ all_members = set(range(34))
+ club1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 16, 17, 19, 21}
+ # club2 = all_members - club1
+
+ G = nx.Graph()
+ G.add_nodes_from(all_members)
+ G.name = "Zachary's Karate Club"
+
+ zacharydat = """\
+0 4 5 3 3 3 3 2 2 0 2 3 2 3 0 0 0 2 0 2 0 2 0 0 0 0 0 0 0 0 0 2 0 0
+4 0 6 3 0 0 0 4 0 0 0 0 0 5 0 0 0 1 0 2 0 2 0 0 0 0 0 0 0 0 2 0 0 0
+5 6 0 3 0 0 0 4 5 1 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 3 0
+3 3 3 0 0 0 0 3 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+3 0 0 0 0 0 2 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+3 0 0 0 0 0 5 0 0 0 3 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+3 0 0 0 2 5 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+2 4 4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+2 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 4 3
+0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2
+2 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+1 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+3 5 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 2
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4
+0 0 0 0 0 3 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 2
+2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 1
+2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 4 0 2 0 0 5 4
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 3 0 0 0 2 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 2 0 0 0 0 0 0 7 0 0
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 2
+0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 3 0 0 0 0 0 0 0 0 4
+0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 2
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 4 0 0 0 0 0 3 2
+0 2 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3
+2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 7 0 0 2 0 0 0 4 4
+0 0 2 0 0 0 0 0 3 0 0 0 0 0 3 3 0 0 1 0 3 0 2 5 0 0 0 0 0 4 3 4 0 5
+0 0 0 0 0 0 0 0 4 2 0 0 0 3 2 4 0 0 2 1 1 0 3 4 0 0 2 4 2 2 3 4 5 0"""
+
+ for row, line in enumerate(zacharydat.split("\n")):
+ thisrow = [int(b) for b in line.split()]
+ for col, entry in enumerate(thisrow):
+ if entry >= 1:
+ G.add_edge(row, col, weight=entry)
+
+ # Add the name of each member's club as a node attribute.
+ for v in G:
+ G.nodes[v]["club"] = "Mr. Hi" if v in club1 else "Officer"
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def davis_southern_women_graph():
+ """Returns Davis Southern women social network.
+
+ This is a bipartite graph.
+
+ References
+ ----------
+ .. [1] A. Davis, Gardner, B. B., Gardner, M. R., 1941. Deep South.
+ University of Chicago Press, Chicago, IL.
+ """
+ G = nx.Graph()
+ # Top nodes
+ women = [
+ "Evelyn Jefferson",
+ "Laura Mandeville",
+ "Theresa Anderson",
+ "Brenda Rogers",
+ "Charlotte McDowd",
+ "Frances Anderson",
+ "Eleanor Nye",
+ "Pearl Oglethorpe",
+ "Ruth DeSand",
+ "Verne Sanderson",
+ "Myra Liddel",
+ "Katherina Rogers",
+ "Sylvia Avondale",
+ "Nora Fayette",
+ "Helen Lloyd",
+ "Dorothy Murchison",
+ "Olivia Carleton",
+ "Flora Price",
+ ]
+ G.add_nodes_from(women, bipartite=0)
+ # Bottom nodes
+ events = [
+ "E1",
+ "E2",
+ "E3",
+ "E4",
+ "E5",
+ "E6",
+ "E7",
+ "E8",
+ "E9",
+ "E10",
+ "E11",
+ "E12",
+ "E13",
+ "E14",
+ ]
+ G.add_nodes_from(events, bipartite=1)
+
+ G.add_edges_from(
+ [
+ ("Evelyn Jefferson", "E1"),
+ ("Evelyn Jefferson", "E2"),
+ ("Evelyn Jefferson", "E3"),
+ ("Evelyn Jefferson", "E4"),
+ ("Evelyn Jefferson", "E5"),
+ ("Evelyn Jefferson", "E6"),
+ ("Evelyn Jefferson", "E8"),
+ ("Evelyn Jefferson", "E9"),
+ ("Laura Mandeville", "E1"),
+ ("Laura Mandeville", "E2"),
+ ("Laura Mandeville", "E3"),
+ ("Laura Mandeville", "E5"),
+ ("Laura Mandeville", "E6"),
+ ("Laura Mandeville", "E7"),
+ ("Laura Mandeville", "E8"),
+ ("Theresa Anderson", "E2"),
+ ("Theresa Anderson", "E3"),
+ ("Theresa Anderson", "E4"),
+ ("Theresa Anderson", "E5"),
+ ("Theresa Anderson", "E6"),
+ ("Theresa Anderson", "E7"),
+ ("Theresa Anderson", "E8"),
+ ("Theresa Anderson", "E9"),
+ ("Brenda Rogers", "E1"),
+ ("Brenda Rogers", "E3"),
+ ("Brenda Rogers", "E4"),
+ ("Brenda Rogers", "E5"),
+ ("Brenda Rogers", "E6"),
+ ("Brenda Rogers", "E7"),
+ ("Brenda Rogers", "E8"),
+ ("Charlotte McDowd", "E3"),
+ ("Charlotte McDowd", "E4"),
+ ("Charlotte McDowd", "E5"),
+ ("Charlotte McDowd", "E7"),
+ ("Frances Anderson", "E3"),
+ ("Frances Anderson", "E5"),
+ ("Frances Anderson", "E6"),
+ ("Frances Anderson", "E8"),
+ ("Eleanor Nye", "E5"),
+ ("Eleanor Nye", "E6"),
+ ("Eleanor Nye", "E7"),
+ ("Eleanor Nye", "E8"),
+ ("Pearl Oglethorpe", "E6"),
+ ("Pearl Oglethorpe", "E8"),
+ ("Pearl Oglethorpe", "E9"),
+ ("Ruth DeSand", "E5"),
+ ("Ruth DeSand", "E7"),
+ ("Ruth DeSand", "E8"),
+ ("Ruth DeSand", "E9"),
+ ("Verne Sanderson", "E7"),
+ ("Verne Sanderson", "E8"),
+ ("Verne Sanderson", "E9"),
+ ("Verne Sanderson", "E12"),
+ ("Myra Liddel", "E8"),
+ ("Myra Liddel", "E9"),
+ ("Myra Liddel", "E10"),
+ ("Myra Liddel", "E12"),
+ ("Katherina Rogers", "E8"),
+ ("Katherina Rogers", "E9"),
+ ("Katherina Rogers", "E10"),
+ ("Katherina Rogers", "E12"),
+ ("Katherina Rogers", "E13"),
+ ("Katherina Rogers", "E14"),
+ ("Sylvia Avondale", "E7"),
+ ("Sylvia Avondale", "E8"),
+ ("Sylvia Avondale", "E9"),
+ ("Sylvia Avondale", "E10"),
+ ("Sylvia Avondale", "E12"),
+ ("Sylvia Avondale", "E13"),
+ ("Sylvia Avondale", "E14"),
+ ("Nora Fayette", "E6"),
+ ("Nora Fayette", "E7"),
+ ("Nora Fayette", "E9"),
+ ("Nora Fayette", "E10"),
+ ("Nora Fayette", "E11"),
+ ("Nora Fayette", "E12"),
+ ("Nora Fayette", "E13"),
+ ("Nora Fayette", "E14"),
+ ("Helen Lloyd", "E7"),
+ ("Helen Lloyd", "E8"),
+ ("Helen Lloyd", "E10"),
+ ("Helen Lloyd", "E11"),
+ ("Helen Lloyd", "E12"),
+ ("Dorothy Murchison", "E8"),
+ ("Dorothy Murchison", "E9"),
+ ("Olivia Carleton", "E9"),
+ ("Olivia Carleton", "E11"),
+ ("Flora Price", "E9"),
+ ("Flora Price", "E11"),
+ ]
+ )
+ G.graph["top"] = women
+ G.graph["bottom"] = events
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def florentine_families_graph():
+ """Returns Florentine families graph.
+
+ References
+ ----------
+ .. [1] Ronald L. Breiger and Philippa E. Pattison
+ Cumulated social roles: The duality of persons and their algebras,1
+ Social Networks, Volume 8, Issue 3, September 1986, Pages 215-256
+ """
+ G = nx.Graph()
+ G.add_edge("Acciaiuoli", "Medici")
+ G.add_edge("Castellani", "Peruzzi")
+ G.add_edge("Castellani", "Strozzi")
+ G.add_edge("Castellani", "Barbadori")
+ G.add_edge("Medici", "Barbadori")
+ G.add_edge("Medici", "Ridolfi")
+ G.add_edge("Medici", "Tornabuoni")
+ G.add_edge("Medici", "Albizzi")
+ G.add_edge("Medici", "Salviati")
+ G.add_edge("Salviati", "Pazzi")
+ G.add_edge("Peruzzi", "Strozzi")
+ G.add_edge("Peruzzi", "Bischeri")
+ G.add_edge("Strozzi", "Ridolfi")
+ G.add_edge("Strozzi", "Bischeri")
+ G.add_edge("Ridolfi", "Tornabuoni")
+ G.add_edge("Tornabuoni", "Guadagni")
+ G.add_edge("Albizzi", "Ginori")
+ G.add_edge("Albizzi", "Guadagni")
+ G.add_edge("Bischeri", "Guadagni")
+ G.add_edge("Guadagni", "Lamberteschi")
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def les_miserables_graph():
+ """Returns coappearance network of characters in the novel Les Miserables.
+
+ References
+ ----------
+ .. [1] D. E. Knuth, 1993.
+ The Stanford GraphBase: a platform for combinatorial computing,
+ pp. 74-87. New York: AcM Press.
+ """
+ G = nx.Graph()
+ G.add_edge("Napoleon", "Myriel", weight=1)
+ G.add_edge("MlleBaptistine", "Myriel", weight=8)
+ G.add_edge("MmeMagloire", "Myriel", weight=10)
+ G.add_edge("MmeMagloire", "MlleBaptistine", weight=6)
+ G.add_edge("CountessDeLo", "Myriel", weight=1)
+ G.add_edge("Geborand", "Myriel", weight=1)
+ G.add_edge("Champtercier", "Myriel", weight=1)
+ G.add_edge("Cravatte", "Myriel", weight=1)
+ G.add_edge("Count", "Myriel", weight=2)
+ G.add_edge("OldMan", "Myriel", weight=1)
+ G.add_edge("Valjean", "Labarre", weight=1)
+ G.add_edge("Valjean", "MmeMagloire", weight=3)
+ G.add_edge("Valjean", "MlleBaptistine", weight=3)
+ G.add_edge("Valjean", "Myriel", weight=5)
+ G.add_edge("Marguerite", "Valjean", weight=1)
+ G.add_edge("MmeDeR", "Valjean", weight=1)
+ G.add_edge("Isabeau", "Valjean", weight=1)
+ G.add_edge("Gervais", "Valjean", weight=1)
+ G.add_edge("Listolier", "Tholomyes", weight=4)
+ G.add_edge("Fameuil", "Tholomyes", weight=4)
+ G.add_edge("Fameuil", "Listolier", weight=4)
+ G.add_edge("Blacheville", "Tholomyes", weight=4)
+ G.add_edge("Blacheville", "Listolier", weight=4)
+ G.add_edge("Blacheville", "Fameuil", weight=4)
+ G.add_edge("Favourite", "Tholomyes", weight=3)
+ G.add_edge("Favourite", "Listolier", weight=3)
+ G.add_edge("Favourite", "Fameuil", weight=3)
+ G.add_edge("Favourite", "Blacheville", weight=4)
+ G.add_edge("Dahlia", "Tholomyes", weight=3)
+ G.add_edge("Dahlia", "Listolier", weight=3)
+ G.add_edge("Dahlia", "Fameuil", weight=3)
+ G.add_edge("Dahlia", "Blacheville", weight=3)
+ G.add_edge("Dahlia", "Favourite", weight=5)
+ G.add_edge("Zephine", "Tholomyes", weight=3)
+ G.add_edge("Zephine", "Listolier", weight=3)
+ G.add_edge("Zephine", "Fameuil", weight=3)
+ G.add_edge("Zephine", "Blacheville", weight=3)
+ G.add_edge("Zephine", "Favourite", weight=4)
+ G.add_edge("Zephine", "Dahlia", weight=4)
+ G.add_edge("Fantine", "Tholomyes", weight=3)
+ G.add_edge("Fantine", "Listolier", weight=3)
+ G.add_edge("Fantine", "Fameuil", weight=3)
+ G.add_edge("Fantine", "Blacheville", weight=3)
+ G.add_edge("Fantine", "Favourite", weight=4)
+ G.add_edge("Fantine", "Dahlia", weight=4)
+ G.add_edge("Fantine", "Zephine", weight=4)
+ G.add_edge("Fantine", "Marguerite", weight=2)
+ G.add_edge("Fantine", "Valjean", weight=9)
+ G.add_edge("MmeThenardier", "Fantine", weight=2)
+ G.add_edge("MmeThenardier", "Valjean", weight=7)
+ G.add_edge("Thenardier", "MmeThenardier", weight=13)
+ G.add_edge("Thenardier", "Fantine", weight=1)
+ G.add_edge("Thenardier", "Valjean", weight=12)
+ G.add_edge("Cosette", "MmeThenardier", weight=4)
+ G.add_edge("Cosette", "Valjean", weight=31)
+ G.add_edge("Cosette", "Tholomyes", weight=1)
+ G.add_edge("Cosette", "Thenardier", weight=1)
+ G.add_edge("Javert", "Valjean", weight=17)
+ G.add_edge("Javert", "Fantine", weight=5)
+ G.add_edge("Javert", "Thenardier", weight=5)
+ G.add_edge("Javert", "MmeThenardier", weight=1)
+ G.add_edge("Javert", "Cosette", weight=1)
+ G.add_edge("Fauchelevent", "Valjean", weight=8)
+ G.add_edge("Fauchelevent", "Javert", weight=1)
+ G.add_edge("Bamatabois", "Fantine", weight=1)
+ G.add_edge("Bamatabois", "Javert", weight=1)
+ G.add_edge("Bamatabois", "Valjean", weight=2)
+ G.add_edge("Perpetue", "Fantine", weight=1)
+ G.add_edge("Simplice", "Perpetue", weight=2)
+ G.add_edge("Simplice", "Valjean", weight=3)
+ G.add_edge("Simplice", "Fantine", weight=2)
+ G.add_edge("Simplice", "Javert", weight=1)
+ G.add_edge("Scaufflaire", "Valjean", weight=1)
+ G.add_edge("Woman1", "Valjean", weight=2)
+ G.add_edge("Woman1", "Javert", weight=1)
+ G.add_edge("Judge", "Valjean", weight=3)
+ G.add_edge("Judge", "Bamatabois", weight=2)
+ G.add_edge("Champmathieu", "Valjean", weight=3)
+ G.add_edge("Champmathieu", "Judge", weight=3)
+ G.add_edge("Champmathieu", "Bamatabois", weight=2)
+ G.add_edge("Brevet", "Judge", weight=2)
+ G.add_edge("Brevet", "Champmathieu", weight=2)
+ G.add_edge("Brevet", "Valjean", weight=2)
+ G.add_edge("Brevet", "Bamatabois", weight=1)
+ G.add_edge("Chenildieu", "Judge", weight=2)
+ G.add_edge("Chenildieu", "Champmathieu", weight=2)
+ G.add_edge("Chenildieu", "Brevet", weight=2)
+ G.add_edge("Chenildieu", "Valjean", weight=2)
+ G.add_edge("Chenildieu", "Bamatabois", weight=1)
+ G.add_edge("Cochepaille", "Judge", weight=2)
+ G.add_edge("Cochepaille", "Champmathieu", weight=2)
+ G.add_edge("Cochepaille", "Brevet", weight=2)
+ G.add_edge("Cochepaille", "Chenildieu", weight=2)
+ G.add_edge("Cochepaille", "Valjean", weight=2)
+ G.add_edge("Cochepaille", "Bamatabois", weight=1)
+ G.add_edge("Pontmercy", "Thenardier", weight=1)
+ G.add_edge("Boulatruelle", "Thenardier", weight=1)
+ G.add_edge("Eponine", "MmeThenardier", weight=2)
+ G.add_edge("Eponine", "Thenardier", weight=3)
+ G.add_edge("Anzelma", "Eponine", weight=2)
+ G.add_edge("Anzelma", "Thenardier", weight=2)
+ G.add_edge("Anzelma", "MmeThenardier", weight=1)
+ G.add_edge("Woman2", "Valjean", weight=3)
+ G.add_edge("Woman2", "Cosette", weight=1)
+ G.add_edge("Woman2", "Javert", weight=1)
+ G.add_edge("MotherInnocent", "Fauchelevent", weight=3)
+ G.add_edge("MotherInnocent", "Valjean", weight=1)
+ G.add_edge("Gribier", "Fauchelevent", weight=2)
+ G.add_edge("MmeBurgon", "Jondrette", weight=1)
+ G.add_edge("Gavroche", "MmeBurgon", weight=2)
+ G.add_edge("Gavroche", "Thenardier", weight=1)
+ G.add_edge("Gavroche", "Javert", weight=1)
+ G.add_edge("Gavroche", "Valjean", weight=1)
+ G.add_edge("Gillenormand", "Cosette", weight=3)
+ G.add_edge("Gillenormand", "Valjean", weight=2)
+ G.add_edge("Magnon", "Gillenormand", weight=1)
+ G.add_edge("Magnon", "MmeThenardier", weight=1)
+ G.add_edge("MlleGillenormand", "Gillenormand", weight=9)
+ G.add_edge("MlleGillenormand", "Cosette", weight=2)
+ G.add_edge("MlleGillenormand", "Valjean", weight=2)
+ G.add_edge("MmePontmercy", "MlleGillenormand", weight=1)
+ G.add_edge("MmePontmercy", "Pontmercy", weight=1)
+ G.add_edge("MlleVaubois", "MlleGillenormand", weight=1)
+ G.add_edge("LtGillenormand", "MlleGillenormand", weight=2)
+ G.add_edge("LtGillenormand", "Gillenormand", weight=1)
+ G.add_edge("LtGillenormand", "Cosette", weight=1)
+ G.add_edge("Marius", "MlleGillenormand", weight=6)
+ G.add_edge("Marius", "Gillenormand", weight=12)
+ G.add_edge("Marius", "Pontmercy", weight=1)
+ G.add_edge("Marius", "LtGillenormand", weight=1)
+ G.add_edge("Marius", "Cosette", weight=21)
+ G.add_edge("Marius", "Valjean", weight=19)
+ G.add_edge("Marius", "Tholomyes", weight=1)
+ G.add_edge("Marius", "Thenardier", weight=2)
+ G.add_edge("Marius", "Eponine", weight=5)
+ G.add_edge("Marius", "Gavroche", weight=4)
+ G.add_edge("BaronessT", "Gillenormand", weight=1)
+ G.add_edge("BaronessT", "Marius", weight=1)
+ G.add_edge("Mabeuf", "Marius", weight=1)
+ G.add_edge("Mabeuf", "Eponine", weight=1)
+ G.add_edge("Mabeuf", "Gavroche", weight=1)
+ G.add_edge("Enjolras", "Marius", weight=7)
+ G.add_edge("Enjolras", "Gavroche", weight=7)
+ G.add_edge("Enjolras", "Javert", weight=6)
+ G.add_edge("Enjolras", "Mabeuf", weight=1)
+ G.add_edge("Enjolras", "Valjean", weight=4)
+ G.add_edge("Combeferre", "Enjolras", weight=15)
+ G.add_edge("Combeferre", "Marius", weight=5)
+ G.add_edge("Combeferre", "Gavroche", weight=6)
+ G.add_edge("Combeferre", "Mabeuf", weight=2)
+ G.add_edge("Prouvaire", "Gavroche", weight=1)
+ G.add_edge("Prouvaire", "Enjolras", weight=4)
+ G.add_edge("Prouvaire", "Combeferre", weight=2)
+ G.add_edge("Feuilly", "Gavroche", weight=2)
+ G.add_edge("Feuilly", "Enjolras", weight=6)
+ G.add_edge("Feuilly", "Prouvaire", weight=2)
+ G.add_edge("Feuilly", "Combeferre", weight=5)
+ G.add_edge("Feuilly", "Mabeuf", weight=1)
+ G.add_edge("Feuilly", "Marius", weight=1)
+ G.add_edge("Courfeyrac", "Marius", weight=9)
+ G.add_edge("Courfeyrac", "Enjolras", weight=17)
+ G.add_edge("Courfeyrac", "Combeferre", weight=13)
+ G.add_edge("Courfeyrac", "Gavroche", weight=7)
+ G.add_edge("Courfeyrac", "Mabeuf", weight=2)
+ G.add_edge("Courfeyrac", "Eponine", weight=1)
+ G.add_edge("Courfeyrac", "Feuilly", weight=6)
+ G.add_edge("Courfeyrac", "Prouvaire", weight=3)
+ G.add_edge("Bahorel", "Combeferre", weight=5)
+ G.add_edge("Bahorel", "Gavroche", weight=5)
+ G.add_edge("Bahorel", "Courfeyrac", weight=6)
+ G.add_edge("Bahorel", "Mabeuf", weight=2)
+ G.add_edge("Bahorel", "Enjolras", weight=4)
+ G.add_edge("Bahorel", "Feuilly", weight=3)
+ G.add_edge("Bahorel", "Prouvaire", weight=2)
+ G.add_edge("Bahorel", "Marius", weight=1)
+ G.add_edge("Bossuet", "Marius", weight=5)
+ G.add_edge("Bossuet", "Courfeyrac", weight=12)
+ G.add_edge("Bossuet", "Gavroche", weight=5)
+ G.add_edge("Bossuet", "Bahorel", weight=4)
+ G.add_edge("Bossuet", "Enjolras", weight=10)
+ G.add_edge("Bossuet", "Feuilly", weight=6)
+ G.add_edge("Bossuet", "Prouvaire", weight=2)
+ G.add_edge("Bossuet", "Combeferre", weight=9)
+ G.add_edge("Bossuet", "Mabeuf", weight=1)
+ G.add_edge("Bossuet", "Valjean", weight=1)
+ G.add_edge("Joly", "Bahorel", weight=5)
+ G.add_edge("Joly", "Bossuet", weight=7)
+ G.add_edge("Joly", "Gavroche", weight=3)
+ G.add_edge("Joly", "Courfeyrac", weight=5)
+ G.add_edge("Joly", "Enjolras", weight=5)
+ G.add_edge("Joly", "Feuilly", weight=5)
+ G.add_edge("Joly", "Prouvaire", weight=2)
+ G.add_edge("Joly", "Combeferre", weight=5)
+ G.add_edge("Joly", "Mabeuf", weight=1)
+ G.add_edge("Joly", "Marius", weight=2)
+ G.add_edge("Grantaire", "Bossuet", weight=3)
+ G.add_edge("Grantaire", "Enjolras", weight=3)
+ G.add_edge("Grantaire", "Combeferre", weight=1)
+ G.add_edge("Grantaire", "Courfeyrac", weight=2)
+ G.add_edge("Grantaire", "Joly", weight=2)
+ G.add_edge("Grantaire", "Gavroche", weight=1)
+ G.add_edge("Grantaire", "Bahorel", weight=1)
+ G.add_edge("Grantaire", "Feuilly", weight=1)
+ G.add_edge("Grantaire", "Prouvaire", weight=1)
+ G.add_edge("MotherPlutarch", "Mabeuf", weight=3)
+ G.add_edge("Gueulemer", "Thenardier", weight=5)
+ G.add_edge("Gueulemer", "Valjean", weight=1)
+ G.add_edge("Gueulemer", "MmeThenardier", weight=1)
+ G.add_edge("Gueulemer", "Javert", weight=1)
+ G.add_edge("Gueulemer", "Gavroche", weight=1)
+ G.add_edge("Gueulemer", "Eponine", weight=1)
+ G.add_edge("Babet", "Thenardier", weight=6)
+ G.add_edge("Babet", "Gueulemer", weight=6)
+ G.add_edge("Babet", "Valjean", weight=1)
+ G.add_edge("Babet", "MmeThenardier", weight=1)
+ G.add_edge("Babet", "Javert", weight=2)
+ G.add_edge("Babet", "Gavroche", weight=1)
+ G.add_edge("Babet", "Eponine", weight=1)
+ G.add_edge("Claquesous", "Thenardier", weight=4)
+ G.add_edge("Claquesous", "Babet", weight=4)
+ G.add_edge("Claquesous", "Gueulemer", weight=4)
+ G.add_edge("Claquesous", "Valjean", weight=1)
+ G.add_edge("Claquesous", "MmeThenardier", weight=1)
+ G.add_edge("Claquesous", "Javert", weight=1)
+ G.add_edge("Claquesous", "Eponine", weight=1)
+ G.add_edge("Claquesous", "Enjolras", weight=1)
+ G.add_edge("Montparnasse", "Javert", weight=1)
+ G.add_edge("Montparnasse", "Babet", weight=2)
+ G.add_edge("Montparnasse", "Gueulemer", weight=2)
+ G.add_edge("Montparnasse", "Claquesous", weight=2)
+ G.add_edge("Montparnasse", "Valjean", weight=1)
+ G.add_edge("Montparnasse", "Gavroche", weight=1)
+ G.add_edge("Montparnasse", "Eponine", weight=1)
+ G.add_edge("Montparnasse", "Thenardier", weight=1)
+ G.add_edge("Toussaint", "Cosette", weight=2)
+ G.add_edge("Toussaint", "Javert", weight=1)
+ G.add_edge("Toussaint", "Valjean", weight=1)
+ G.add_edge("Child1", "Gavroche", weight=2)
+ G.add_edge("Child2", "Gavroche", weight=2)
+ G.add_edge("Child2", "Child1", weight=3)
+ G.add_edge("Brujon", "Babet", weight=3)
+ G.add_edge("Brujon", "Gueulemer", weight=3)
+ G.add_edge("Brujon", "Thenardier", weight=3)
+ G.add_edge("Brujon", "Gavroche", weight=1)
+ G.add_edge("Brujon", "Eponine", weight=1)
+ G.add_edge("Brujon", "Claquesous", weight=1)
+ G.add_edge("Brujon", "Montparnasse", weight=1)
+ G.add_edge("MmeHucheloup", "Bossuet", weight=1)
+ G.add_edge("MmeHucheloup", "Joly", weight=1)
+ G.add_edge("MmeHucheloup", "Grantaire", weight=1)
+ G.add_edge("MmeHucheloup", "Bahorel", weight=1)
+ G.add_edge("MmeHucheloup", "Courfeyrac", weight=1)
+ G.add_edge("MmeHucheloup", "Gavroche", weight=1)
+ G.add_edge("MmeHucheloup", "Enjolras", weight=1)
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/spectral_graph_forge.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/spectral_graph_forge.py
new file mode 100644
index 0000000000000000000000000000000000000000..39a87f748307ac7884419a58dce84d0fdf498a88
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/spectral_graph_forge.py
@@ -0,0 +1,120 @@
+"""Generates graphs with a given eigenvector structure"""
+
+import networkx as nx
+from networkx.utils import np_random_state
+
+__all__ = ["spectral_graph_forge"]
+
+
+@np_random_state(3)
+@nx._dispatchable(returns_graph=True)
+def spectral_graph_forge(G, alpha, transformation="identity", seed=None):
+ """Returns a random simple graph with spectrum resembling that of `G`
+
+ This algorithm, called Spectral Graph Forge (SGF), computes the
+ eigenvectors of a given graph adjacency matrix, filters them and
+ builds a random graph with a similar eigenstructure.
+ SGF has been proved to be particularly useful for synthesizing
+ realistic social networks and it can also be used to anonymize
+ graph sensitive data.
+
+ Parameters
+ ----------
+ G : Graph
+ alpha : float
+ Ratio representing the percentage of eigenvectors of G to consider,
+ values in [0,1].
+ transformation : string, optional
+ Represents the intended matrix linear transformation, possible values
+ are 'identity' and 'modularity'
+ seed : integer, random_state, or None (default)
+ Indicator of numpy random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ H : Graph
+ A graph with a similar eigenvector structure of the input one.
+
+ Raises
+ ------
+ NetworkXError
+ If transformation has a value different from 'identity' or 'modularity'
+
+ Notes
+ -----
+ Spectral Graph Forge (SGF) generates a random simple graph resembling the
+ global properties of the given one.
+ It leverages the low-rank approximation of the associated adjacency matrix
+ driven by the *alpha* precision parameter.
+ SGF preserves the number of nodes of the input graph and their ordering.
+ This way, nodes of output graphs resemble the properties of the input one
+ and attributes can be directly mapped.
+
+ It considers the graph adjacency matrices which can optionally be
+ transformed to other symmetric real matrices (currently transformation
+ options include *identity* and *modularity*).
+ The *modularity* transformation, in the sense of Newman's modularity matrix
+ allows the focusing on community structure related properties of the graph.
+
+ SGF applies a low-rank approximation whose fixed rank is computed from the
+ ratio *alpha* of the input graph adjacency matrix dimension.
+ This step performs a filtering on the input eigenvectors similar to the low
+ pass filtering common in telecommunications.
+
+ The filtered values (after truncation) are used as input to a Bernoulli
+ sampling for constructing a random adjacency matrix.
+
+ References
+ ----------
+ .. [1] L. Baldesi, C. T. Butts, A. Markopoulou, "Spectral Graph Forge:
+ Graph Generation Targeting Modularity", IEEE Infocom, '18.
+ https://arxiv.org/abs/1801.01715
+ .. [2] M. Newman, "Networks: an introduction", Oxford university press,
+ 2010
+
+ Examples
+ --------
+ >>> G = nx.karate_club_graph()
+ >>> H = nx.spectral_graph_forge(G, 0.3)
+ >>>
+ """
+ import numpy as np
+ import scipy as sp
+
+ available_transformations = ["identity", "modularity"]
+ alpha = np.clip(alpha, 0, 1)
+ A = nx.to_numpy_array(G)
+ n = A.shape[1]
+ level = round(n * alpha)
+
+ if transformation not in available_transformations:
+ msg = f"{transformation!r} is not a valid transformation. "
+ msg += f"Transformations: {available_transformations}"
+ raise nx.NetworkXError(msg)
+
+ K = np.ones((1, n)) @ A
+
+ B = A
+ if transformation == "modularity":
+ B -= K.T @ K / K.sum()
+
+ # Compute low-rank approximation of B
+ evals, evecs = np.linalg.eigh(B)
+ k = np.argsort(np.abs(evals))[::-1] # indices of evals in descending order
+ evecs[:, k[np.arange(level, n)]] = 0 # set smallest eigenvectors to 0
+ B = evecs @ np.diag(evals) @ evecs.T
+
+ if transformation == "modularity":
+ B += K.T @ K / K.sum()
+
+ B = np.clip(B, 0, 1)
+ np.fill_diagonal(B, 0)
+
+ for i in range(n - 1):
+ B[i, i + 1 :] = sp.stats.bernoulli.rvs(B[i, i + 1 :], random_state=seed)
+ B[i + 1 :, i] = np.transpose(B[i, i + 1 :])
+
+ H = nx.from_numpy_array(B)
+
+ return H
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/stochastic.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/stochastic.py
new file mode 100644
index 0000000000000000000000000000000000000000..f53e2315470f8ffcdea0380026a933e06ddf6ea7
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/stochastic.py
@@ -0,0 +1,54 @@
+"""Functions for generating stochastic graphs from a given weighted directed
+graph.
+
+"""
+
+import networkx as nx
+from networkx.classes import DiGraph, MultiDiGraph
+from networkx.utils import not_implemented_for
+
+__all__ = ["stochastic_graph"]
+
+
+@not_implemented_for("undirected")
+@nx._dispatchable(
+ edge_attrs="weight", mutates_input={"not copy": 1}, returns_graph=True
+)
+def stochastic_graph(G, copy=True, weight="weight"):
+ """Returns a right-stochastic representation of directed graph `G`.
+
+ A right-stochastic graph is a weighted digraph in which for each
+ node, the sum of the weights of all the out-edges of that node is
+ 1. If the graph is already weighted (for example, via a 'weight'
+ edge attribute), the reweighting takes that into account.
+
+ Parameters
+ ----------
+ G : directed graph
+ A :class:`~networkx.DiGraph` or :class:`~networkx.MultiDiGraph`.
+
+ copy : boolean, optional
+ If this is True, then this function returns a new graph with
+ the stochastic reweighting. Otherwise, the original graph is
+ modified in-place (and also returned, for convenience).
+
+ weight : edge attribute key (optional, default='weight')
+ Edge attribute key used for reading the existing weight and
+ setting the new weight. If no attribute with this key is found
+ for an edge, then the edge weight is assumed to be 1. If an edge
+ has a weight, it must be a positive number.
+
+ """
+ if copy:
+ G = MultiDiGraph(G) if G.is_multigraph() else DiGraph(G)
+ # There is a tradeoff here: the dictionary of node degrees may
+ # require a lot of memory, whereas making a call to `G.out_degree`
+ # inside the loop may be costly in computation time.
+ degree = dict(G.out_degree(weight=weight))
+ for u, v, d in G.edges(data=True):
+ if degree[u] == 0:
+ d[weight] = 0
+ else:
+ d[weight] = d.get(weight, 1) / degree[u]
+ nx._clear_cache(G)
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/sudoku.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/sudoku.py
new file mode 100644
index 0000000000000000000000000000000000000000..f288ed24d1f189588de7e1e0bba61f50bbad0003
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/sudoku.py
@@ -0,0 +1,131 @@
+"""Generator for Sudoku graphs
+
+This module gives a generator for n-Sudoku graphs. It can be used to develop
+algorithms for solving or generating Sudoku puzzles.
+
+A completed Sudoku grid is a 9x9 array of integers between 1 and 9, with no
+number appearing twice in the same row, column, or 3x3 box.
+
++---------+---------+---------+
+| | 8 6 4 | | 3 7 1 | | 2 5 9 |
+| | 3 2 5 | | 8 4 9 | | 7 6 1 |
+| | 9 7 1 | | 2 6 5 | | 8 4 3 |
++---------+---------+---------+
+| | 4 3 6 | | 1 9 2 | | 5 8 7 |
+| | 1 9 8 | | 6 5 7 | | 4 3 2 |
+| | 2 5 7 | | 4 8 3 | | 9 1 6 |
++---------+---------+---------+
+| | 6 8 9 | | 7 3 4 | | 1 2 5 |
+| | 7 1 3 | | 5 2 8 | | 6 9 4 |
+| | 5 4 2 | | 9 1 6 | | 3 7 8 |
++---------+---------+---------+
+
+
+The Sudoku graph is an undirected graph with 81 vertices, corresponding to
+the cells of a Sudoku grid. It is a regular graph of degree 20. Two distinct
+vertices are adjacent if and only if the corresponding cells belong to the
+same row, column, or box. A completed Sudoku grid corresponds to a vertex
+coloring of the Sudoku graph with nine colors.
+
+More generally, the n-Sudoku graph is a graph with n^4 vertices, corresponding
+to the cells of an n^2 by n^2 grid. Two distinct vertices are adjacent if and
+only if they belong to the same row, column, or n by n box.
+
+References
+----------
+.. [1] Herzberg, A. M., & Murty, M. R. (2007). Sudoku squares and chromatic
+ polynomials. Notices of the AMS, 54(6), 708-717.
+.. [2] Sander, Torsten (2009), "Sudoku graphs are integral",
+ Electronic Journal of Combinatorics, 16 (1): Note 25, 7pp, MR 2529816
+.. [3] Wikipedia contributors. "Glossary of Sudoku." Wikipedia, The Free
+ Encyclopedia, 3 Dec. 2019. Web. 22 Dec. 2019.
+"""
+
+import networkx as nx
+from networkx.exception import NetworkXError
+
+__all__ = ["sudoku_graph"]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def sudoku_graph(n=3):
+ """Returns the n-Sudoku graph. The default value of n is 3.
+
+ The n-Sudoku graph is a graph with n^4 vertices, corresponding to the
+ cells of an n^2 by n^2 grid. Two distinct vertices are adjacent if and
+ only if they belong to the same row, column, or n-by-n box.
+
+ Parameters
+ ----------
+ n: integer
+ The order of the Sudoku graph, equal to the square root of the
+ number of rows. The default is 3.
+
+ Returns
+ -------
+ NetworkX graph
+ The n-Sudoku graph Sud(n).
+
+ Examples
+ --------
+ >>> G = nx.sudoku_graph()
+ >>> G.number_of_nodes()
+ 81
+ >>> G.number_of_edges()
+ 810
+ >>> sorted(G.neighbors(42))
+ [6, 15, 24, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 51, 52, 53, 60, 69, 78]
+ >>> G = nx.sudoku_graph(2)
+ >>> G.number_of_nodes()
+ 16
+ >>> G.number_of_edges()
+ 56
+
+ References
+ ----------
+ .. [1] Herzberg, A. M., & Murty, M. R. (2007). Sudoku squares and chromatic
+ polynomials. Notices of the AMS, 54(6), 708-717.
+ .. [2] Sander, Torsten (2009), "Sudoku graphs are integral",
+ Electronic Journal of Combinatorics, 16 (1): Note 25, 7pp, MR 2529816
+ .. [3] Wikipedia contributors. "Glossary of Sudoku." Wikipedia, The Free
+ Encyclopedia, 3 Dec. 2019. Web. 22 Dec. 2019.
+ """
+
+ if n < 0:
+ raise NetworkXError("The order must be greater than or equal to zero.")
+
+ n2 = n * n
+ n3 = n2 * n
+ n4 = n3 * n
+
+ # Construct an empty graph with n^4 nodes
+ G = nx.empty_graph(n4)
+
+ # A Sudoku graph of order 0 or 1 has no edges
+ if n < 2:
+ return G
+
+ # Add edges for cells in the same row
+ for row_no in range(n2):
+ row_start = row_no * n2
+ for j in range(1, n2):
+ for i in range(j):
+ G.add_edge(row_start + i, row_start + j)
+
+ # Add edges for cells in the same column
+ for col_no in range(n2):
+ for j in range(col_no, n4, n2):
+ for i in range(col_no, j, n2):
+ G.add_edge(i, j)
+
+ # Add edges for cells in the same box
+ for band_no in range(n):
+ for stack_no in range(n):
+ box_start = n3 * band_no + n * stack_no
+ for j in range(1, n2):
+ for i in range(j):
+ u = box_start + (i % n) + n2 * (i // n)
+ v = box_start + (j % n) + n2 * (j // n)
+ G.add_edge(u, v)
+
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_atlas.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_atlas.py
new file mode 100644
index 0000000000000000000000000000000000000000..add4741c00e8d8aefe4fcf3a2a86815a15aab29c
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_atlas.py
@@ -0,0 +1,75 @@
+from itertools import groupby
+
+import pytest
+
+import networkx as nx
+from networkx import graph_atlas, graph_atlas_g
+from networkx.generators.atlas import NUM_GRAPHS
+from networkx.utils import edges_equal, nodes_equal, pairwise
+
+
+class TestAtlasGraph:
+ """Unit tests for the :func:`~networkx.graph_atlas` function."""
+
+ def test_index_too_small(self):
+ with pytest.raises(ValueError):
+ graph_atlas(-1)
+
+ def test_index_too_large(self):
+ with pytest.raises(ValueError):
+ graph_atlas(NUM_GRAPHS)
+
+ def test_graph(self):
+ G = graph_atlas(6)
+ assert nodes_equal(G.nodes(), range(3))
+ assert edges_equal(G.edges(), [(0, 1), (0, 2)])
+
+
+class TestAtlasGraphG:
+ """Unit tests for the :func:`~networkx.graph_atlas_g` function."""
+
+ @classmethod
+ def setup_class(cls):
+ cls.GAG = graph_atlas_g()
+
+ def test_sizes(self):
+ G = self.GAG[0]
+ assert G.number_of_nodes() == 0
+ assert G.number_of_edges() == 0
+
+ G = self.GAG[7]
+ assert G.number_of_nodes() == 3
+ assert G.number_of_edges() == 3
+
+ def test_names(self):
+ for i, G in enumerate(self.GAG):
+ assert int(G.name[1:]) == i
+
+ def test_nondecreasing_nodes(self):
+ # check for nondecreasing number of nodes
+ for n1, n2 in pairwise(map(len, self.GAG)):
+ assert n2 <= n1 + 1
+
+ def test_nondecreasing_edges(self):
+ # check for nondecreasing number of edges (for fixed number of
+ # nodes)
+ for n, group in groupby(self.GAG, key=nx.number_of_nodes):
+ for m1, m2 in pairwise(map(nx.number_of_edges, group)):
+ assert m2 <= m1 + 1
+
+ def test_nondecreasing_degree_sequence(self):
+ # Check for lexicographically nondecreasing degree sequences
+ # (for fixed number of nodes and edges).
+ #
+ # There are three exceptions to this rule in the order given in
+ # the "Atlas of Graphs" book, so we need to manually exclude
+ # those.
+ exceptions = [("G55", "G56"), ("G1007", "G1008"), ("G1012", "G1013")]
+ for n, group in groupby(self.GAG, key=nx.number_of_nodes):
+ for m, group in groupby(group, key=nx.number_of_edges):
+ for G1, G2 in pairwise(group):
+ if (G1.name, G2.name) in exceptions:
+ continue
+ d1 = sorted(d for v, d in G1.degree())
+ d2 = sorted(d for v, d in G2.degree())
+ assert d1 <= d2
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_classic.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_classic.py
new file mode 100644
index 0000000000000000000000000000000000000000..9353c7f505cb2ab515614bc2920b60cbde0f0992
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_classic.py
@@ -0,0 +1,640 @@
+"""
+====================
+Generators - Classic
+====================
+
+Unit tests for various classic graph generators in generators/classic.py
+"""
+
+import itertools
+import typing
+
+import pytest
+
+import networkx as nx
+from networkx.algorithms.isomorphism.isomorph import graph_could_be_isomorphic
+from networkx.utils import edges_equal, nodes_equal
+
+is_isomorphic = graph_could_be_isomorphic
+
+
+class TestGeneratorClassic:
+ def test_balanced_tree(self):
+ # balanced_tree(r,h) is a tree with (r**(h+1)-1)/(r-1) edges
+ for r, h in [(2, 2), (3, 3), (6, 2)]:
+ t = nx.balanced_tree(r, h)
+ order = t.order()
+ assert order == (r ** (h + 1) - 1) / (r - 1)
+ assert nx.is_connected(t)
+ assert t.size() == order - 1
+ dh = nx.degree_histogram(t)
+ assert dh[0] == 0 # no nodes of 0
+ assert dh[1] == r**h # nodes of degree 1 are leaves
+ assert dh[r] == 1 # root is degree r
+ assert dh[r + 1] == order - r**h - 1 # everyone else is degree r+1
+ assert len(dh) == r + 2
+
+ def test_balanced_tree_star(self):
+ # balanced_tree(r,1) is the r-star
+ t = nx.balanced_tree(r=2, h=1)
+ assert is_isomorphic(t, nx.star_graph(2))
+ t = nx.balanced_tree(r=5, h=1)
+ assert is_isomorphic(t, nx.star_graph(5))
+ t = nx.balanced_tree(r=10, h=1)
+ assert is_isomorphic(t, nx.star_graph(10))
+
+ def test_balanced_tree_path(self):
+ """Tests that the balanced tree with branching factor one is the
+ path graph.
+
+ """
+ # A tree of height four has five levels.
+ T = nx.balanced_tree(1, 4)
+ P = nx.path_graph(5)
+ assert is_isomorphic(T, P)
+
+ def test_full_rary_tree(self):
+ r = 2
+ n = 9
+ t = nx.full_rary_tree(r, n)
+ assert t.order() == n
+ assert nx.is_connected(t)
+ dh = nx.degree_histogram(t)
+ assert dh[0] == 0 # no nodes of 0
+ assert dh[1] == 5 # nodes of degree 1 are leaves
+ assert dh[r] == 1 # root is degree r
+ assert dh[r + 1] == 9 - 5 - 1 # everyone else is degree r+1
+ assert len(dh) == r + 2
+
+ def test_full_rary_tree_balanced(self):
+ t = nx.full_rary_tree(2, 15)
+ th = nx.balanced_tree(2, 3)
+ assert is_isomorphic(t, th)
+
+ def test_full_rary_tree_path(self):
+ t = nx.full_rary_tree(1, 10)
+ assert is_isomorphic(t, nx.path_graph(10))
+
+ def test_full_rary_tree_empty(self):
+ t = nx.full_rary_tree(0, 10)
+ assert is_isomorphic(t, nx.empty_graph(10))
+ t = nx.full_rary_tree(3, 0)
+ assert is_isomorphic(t, nx.empty_graph(0))
+
+ def test_full_rary_tree_3_20(self):
+ t = nx.full_rary_tree(3, 20)
+ assert t.order() == 20
+
+ def test_barbell_graph(self):
+ # number of nodes = 2*m1 + m2 (2 m1-complete graphs + m2-path + 2 edges)
+ # number of edges = 2*(nx.number_of_edges(m1-complete graph) + m2 + 1
+ m1 = 3
+ m2 = 5
+ b = nx.barbell_graph(m1, m2)
+ assert nx.number_of_nodes(b) == 2 * m1 + m2
+ assert nx.number_of_edges(b) == m1 * (m1 - 1) + m2 + 1
+
+ m1 = 4
+ m2 = 10
+ b = nx.barbell_graph(m1, m2)
+ assert nx.number_of_nodes(b) == 2 * m1 + m2
+ assert nx.number_of_edges(b) == m1 * (m1 - 1) + m2 + 1
+
+ m1 = 3
+ m2 = 20
+ b = nx.barbell_graph(m1, m2)
+ assert nx.number_of_nodes(b) == 2 * m1 + m2
+ assert nx.number_of_edges(b) == m1 * (m1 - 1) + m2 + 1
+
+ # Raise NetworkXError if m1<2
+ m1 = 1
+ m2 = 20
+ pytest.raises(nx.NetworkXError, nx.barbell_graph, m1, m2)
+
+ # Raise NetworkXError if m2<0
+ m1 = 5
+ m2 = -2
+ pytest.raises(nx.NetworkXError, nx.barbell_graph, m1, m2)
+
+ # nx.barbell_graph(2,m) = nx.path_graph(m+4)
+ m1 = 2
+ m2 = 5
+ b = nx.barbell_graph(m1, m2)
+ assert is_isomorphic(b, nx.path_graph(m2 + 4))
+
+ m1 = 2
+ m2 = 10
+ b = nx.barbell_graph(m1, m2)
+ assert is_isomorphic(b, nx.path_graph(m2 + 4))
+
+ m1 = 2
+ m2 = 20
+ b = nx.barbell_graph(m1, m2)
+ assert is_isomorphic(b, nx.path_graph(m2 + 4))
+
+ pytest.raises(
+ nx.NetworkXError, nx.barbell_graph, m1, m2, create_using=nx.DiGraph()
+ )
+
+ mb = nx.barbell_graph(m1, m2, create_using=nx.MultiGraph())
+ assert edges_equal(mb.edges(), b.edges())
+
+ def test_binomial_tree(self):
+ graphs = (None, nx.Graph, nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph)
+ for create_using in graphs:
+ for n in range(4):
+ b = nx.binomial_tree(n, create_using)
+ assert nx.number_of_nodes(b) == 2**n
+ assert nx.number_of_edges(b) == (2**n - 1)
+
+ def test_complete_graph(self):
+ # complete_graph(m) is a connected graph with
+ # m nodes and m*(m+1)/2 edges
+ for m in [0, 1, 3, 5]:
+ g = nx.complete_graph(m)
+ assert nx.number_of_nodes(g) == m
+ assert nx.number_of_edges(g) == m * (m - 1) // 2
+
+ mg = nx.complete_graph(m, create_using=nx.MultiGraph)
+ assert edges_equal(mg.edges(), g.edges())
+
+ g = nx.complete_graph("abc")
+ assert nodes_equal(g.nodes(), ["a", "b", "c"])
+ assert g.size() == 3
+
+ # creates a self-loop... should it?
+ g = nx.complete_graph("abcb")
+ assert nodes_equal(g.nodes(), ["a", "b", "c"])
+ assert g.size() == 4
+
+ g = nx.complete_graph("abcb", create_using=nx.MultiGraph)
+ assert nodes_equal(g.nodes(), ["a", "b", "c"])
+ assert g.size() == 6
+
+ def test_complete_digraph(self):
+ # complete_graph(m) is a connected graph with
+ # m nodes and m*(m+1)/2 edges
+ for m in [0, 1, 3, 5]:
+ g = nx.complete_graph(m, create_using=nx.DiGraph)
+ assert nx.number_of_nodes(g) == m
+ assert nx.number_of_edges(g) == m * (m - 1)
+
+ g = nx.complete_graph("abc", create_using=nx.DiGraph)
+ assert len(g) == 3
+ assert g.size() == 6
+ assert g.is_directed()
+
+ def test_circular_ladder_graph(self):
+ G = nx.circular_ladder_graph(5)
+ pytest.raises(
+ nx.NetworkXError, nx.circular_ladder_graph, 5, create_using=nx.DiGraph
+ )
+ mG = nx.circular_ladder_graph(5, create_using=nx.MultiGraph)
+ assert edges_equal(mG.edges(), G.edges())
+
+ def test_circulant_graph(self):
+ # Ci_n(1) is the cycle graph for all n
+ Ci6_1 = nx.circulant_graph(6, [1])
+ C6 = nx.cycle_graph(6)
+ assert edges_equal(Ci6_1.edges(), C6.edges())
+
+ # Ci_n(1, 2, ..., n div 2) is the complete graph for all n
+ Ci7 = nx.circulant_graph(7, [1, 2, 3])
+ K7 = nx.complete_graph(7)
+ assert edges_equal(Ci7.edges(), K7.edges())
+
+ # Ci_6(1, 3) is K_3,3 i.e. the utility graph
+ Ci6_1_3 = nx.circulant_graph(6, [1, 3])
+ K3_3 = nx.complete_bipartite_graph(3, 3)
+ assert is_isomorphic(Ci6_1_3, K3_3)
+
+ def test_cycle_graph(self):
+ G = nx.cycle_graph(4)
+ assert edges_equal(G.edges(), [(0, 1), (0, 3), (1, 2), (2, 3)])
+ mG = nx.cycle_graph(4, create_using=nx.MultiGraph)
+ assert edges_equal(mG.edges(), [(0, 1), (0, 3), (1, 2), (2, 3)])
+ G = nx.cycle_graph(4, create_using=nx.DiGraph)
+ assert not G.has_edge(2, 1)
+ assert G.has_edge(1, 2)
+ assert G.is_directed()
+
+ G = nx.cycle_graph("abc")
+ assert len(G) == 3
+ assert G.size() == 3
+ G = nx.cycle_graph("abcb")
+ assert len(G) == 3
+ assert G.size() == 2
+ g = nx.cycle_graph("abc", nx.DiGraph)
+ assert len(g) == 3
+ assert g.size() == 3
+ assert g.is_directed()
+ g = nx.cycle_graph("abcb", nx.DiGraph)
+ assert len(g) == 3
+ assert g.size() == 4
+
+ def test_dorogovtsev_goltsev_mendes_graph(self):
+ G = nx.dorogovtsev_goltsev_mendes_graph(0)
+ assert edges_equal(G.edges(), [(0, 1)])
+ assert nodes_equal(list(G), [0, 1])
+ G = nx.dorogovtsev_goltsev_mendes_graph(1)
+ assert edges_equal(G.edges(), [(0, 1), (0, 2), (1, 2)])
+ assert nx.average_clustering(G) == 1.0
+ assert nx.average_shortest_path_length(G) == 1.0
+ assert sorted(nx.triangles(G).values()) == [1, 1, 1]
+ assert nx.is_planar(G)
+ G = nx.dorogovtsev_goltsev_mendes_graph(2)
+ assert nx.number_of_nodes(G) == 6
+ assert nx.number_of_edges(G) == 9
+ assert nx.average_clustering(G) == 0.75
+ assert nx.average_shortest_path_length(G) == 1.4
+ assert nx.is_planar(G)
+ G = nx.dorogovtsev_goltsev_mendes_graph(10)
+ assert nx.number_of_nodes(G) == 29526
+ assert nx.number_of_edges(G) == 59049
+ assert G.degree(0) == 1024
+ assert G.degree(1) == 1024
+ assert G.degree(2) == 1024
+
+ with pytest.raises(nx.NetworkXError, match=r"n must be greater than"):
+ nx.dorogovtsev_goltsev_mendes_graph(-1)
+ with pytest.raises(nx.NetworkXError, match=r"directed graph not supported"):
+ nx.dorogovtsev_goltsev_mendes_graph(7, create_using=nx.DiGraph)
+ with pytest.raises(nx.NetworkXError, match=r"multigraph not supported"):
+ nx.dorogovtsev_goltsev_mendes_graph(7, create_using=nx.MultiGraph)
+ with pytest.raises(nx.NetworkXError):
+ nx.dorogovtsev_goltsev_mendes_graph(7, create_using=nx.MultiDiGraph)
+
+ def test_create_using(self):
+ G = nx.empty_graph()
+ assert isinstance(G, nx.Graph)
+ pytest.raises(TypeError, nx.empty_graph, create_using=0.0)
+ pytest.raises(TypeError, nx.empty_graph, create_using="Graph")
+
+ G = nx.empty_graph(create_using=nx.MultiGraph)
+ assert isinstance(G, nx.MultiGraph)
+ G = nx.empty_graph(create_using=nx.DiGraph)
+ assert isinstance(G, nx.DiGraph)
+
+ G = nx.empty_graph(create_using=nx.DiGraph, default=nx.MultiGraph)
+ assert isinstance(G, nx.DiGraph)
+ G = nx.empty_graph(create_using=None, default=nx.MultiGraph)
+ assert isinstance(G, nx.MultiGraph)
+ G = nx.empty_graph(default=nx.MultiGraph)
+ assert isinstance(G, nx.MultiGraph)
+
+ G = nx.path_graph(5)
+ H = nx.empty_graph(create_using=G)
+ assert not H.is_multigraph()
+ assert not H.is_directed()
+ assert len(H) == 0
+ assert G is H
+
+ H = nx.empty_graph(create_using=nx.MultiGraph())
+ assert H.is_multigraph()
+ assert not H.is_directed()
+ assert G is not H
+
+ # test for subclasses that also use typing.Protocol. See gh-6243
+ class Mixin(typing.Protocol):
+ pass
+
+ class MyGraph(Mixin, nx.DiGraph):
+ pass
+
+ G = nx.empty_graph(create_using=MyGraph)
+
+ def test_empty_graph(self):
+ G = nx.empty_graph()
+ assert nx.number_of_nodes(G) == 0
+ G = nx.empty_graph(42)
+ assert nx.number_of_nodes(G) == 42
+ assert nx.number_of_edges(G) == 0
+
+ G = nx.empty_graph("abc")
+ assert len(G) == 3
+ assert G.size() == 0
+
+ # create empty digraph
+ G = nx.empty_graph(42, create_using=nx.DiGraph(name="duh"))
+ assert nx.number_of_nodes(G) == 42
+ assert nx.number_of_edges(G) == 0
+ assert isinstance(G, nx.DiGraph)
+
+ # create empty multigraph
+ G = nx.empty_graph(42, create_using=nx.MultiGraph(name="duh"))
+ assert nx.number_of_nodes(G) == 42
+ assert nx.number_of_edges(G) == 0
+ assert isinstance(G, nx.MultiGraph)
+
+ # create empty graph from another
+ pete = nx.petersen_graph()
+ G = nx.empty_graph(42, create_using=pete)
+ assert nx.number_of_nodes(G) == 42
+ assert nx.number_of_edges(G) == 0
+ assert isinstance(G, nx.Graph)
+
+ def test_ladder_graph(self):
+ for i, G in [
+ (0, nx.empty_graph(0)),
+ (1, nx.path_graph(2)),
+ (2, nx.hypercube_graph(2)),
+ (10, nx.grid_graph([2, 10])),
+ ]:
+ assert is_isomorphic(nx.ladder_graph(i), G)
+
+ pytest.raises(nx.NetworkXError, nx.ladder_graph, 2, create_using=nx.DiGraph)
+
+ g = nx.ladder_graph(2)
+ mg = nx.ladder_graph(2, create_using=nx.MultiGraph)
+ assert edges_equal(mg.edges(), g.edges())
+
+ @pytest.mark.parametrize(("m", "n"), [(3, 5), (4, 10), (3, 20)])
+ def test_lollipop_graph_right_sizes(self, m, n):
+ G = nx.lollipop_graph(m, n)
+ assert nx.number_of_nodes(G) == m + n
+ assert nx.number_of_edges(G) == m * (m - 1) / 2 + n
+
+ @pytest.mark.parametrize(("m", "n"), [("ab", ""), ("abc", "defg")])
+ def test_lollipop_graph_size_node_sequence(self, m, n):
+ G = nx.lollipop_graph(m, n)
+ assert nx.number_of_nodes(G) == len(m) + len(n)
+ assert nx.number_of_edges(G) == len(m) * (len(m) - 1) / 2 + len(n)
+
+ def test_lollipop_graph_exceptions(self):
+ # Raise NetworkXError if m<2
+ pytest.raises(nx.NetworkXError, nx.lollipop_graph, -1, 2)
+ pytest.raises(nx.NetworkXError, nx.lollipop_graph, 1, 20)
+ pytest.raises(nx.NetworkXError, nx.lollipop_graph, "", 20)
+ pytest.raises(nx.NetworkXError, nx.lollipop_graph, "a", 20)
+
+ # Raise NetworkXError if n<0
+ pytest.raises(nx.NetworkXError, nx.lollipop_graph, 5, -2)
+
+ # raise NetworkXError if create_using is directed
+ with pytest.raises(nx.NetworkXError):
+ nx.lollipop_graph(2, 20, create_using=nx.DiGraph)
+ with pytest.raises(nx.NetworkXError):
+ nx.lollipop_graph(2, 20, create_using=nx.MultiDiGraph)
+
+ @pytest.mark.parametrize(("m", "n"), [(2, 0), (2, 5), (2, 10), ("ab", 20)])
+ def test_lollipop_graph_same_as_path_when_m1_is_2(self, m, n):
+ G = nx.lollipop_graph(m, n)
+ assert is_isomorphic(G, nx.path_graph(n + 2))
+
+ def test_lollipop_graph_for_multigraph(self):
+ G = nx.lollipop_graph(5, 20)
+ MG = nx.lollipop_graph(5, 20, create_using=nx.MultiGraph)
+ assert edges_equal(MG.edges(), G.edges())
+
+ @pytest.mark.parametrize(
+ ("m", "n"),
+ [(4, "abc"), ("abcd", 3), ([1, 2, 3, 4], "abc"), ("abcd", [1, 2, 3])],
+ )
+ def test_lollipop_graph_mixing_input_types(self, m, n):
+ expected = nx.compose(nx.complete_graph(4), nx.path_graph(range(100, 103)))
+ expected.add_edge(0, 100) # Connect complete graph and path graph
+ assert is_isomorphic(nx.lollipop_graph(m, n), expected)
+
+ def test_lollipop_graph_non_builtin_ints(self):
+ np = pytest.importorskip("numpy")
+ G = nx.lollipop_graph(np.int32(4), np.int64(3))
+ expected = nx.compose(nx.complete_graph(4), nx.path_graph(range(100, 103)))
+ expected.add_edge(0, 100) # Connect complete graph and path graph
+ assert is_isomorphic(G, expected)
+
+ def test_null_graph(self):
+ assert nx.number_of_nodes(nx.null_graph()) == 0
+
+ def test_path_graph(self):
+ p = nx.path_graph(0)
+ assert is_isomorphic(p, nx.null_graph())
+
+ p = nx.path_graph(1)
+ assert is_isomorphic(p, nx.empty_graph(1))
+
+ p = nx.path_graph(10)
+ assert nx.is_connected(p)
+ assert sorted(d for n, d in p.degree()) == [1, 1, 2, 2, 2, 2, 2, 2, 2, 2]
+ assert p.order() - 1 == p.size()
+
+ dp = nx.path_graph(3, create_using=nx.DiGraph)
+ assert dp.has_edge(0, 1)
+ assert not dp.has_edge(1, 0)
+
+ mp = nx.path_graph(10, create_using=nx.MultiGraph)
+ assert edges_equal(mp.edges(), p.edges())
+
+ G = nx.path_graph("abc")
+ assert len(G) == 3
+ assert G.size() == 2
+ G = nx.path_graph("abcb")
+ assert len(G) == 3
+ assert G.size() == 2
+ g = nx.path_graph("abc", nx.DiGraph)
+ assert len(g) == 3
+ assert g.size() == 2
+ assert g.is_directed()
+ g = nx.path_graph("abcb", nx.DiGraph)
+ assert len(g) == 3
+ assert g.size() == 3
+
+ G = nx.path_graph((1, 2, 3, 2, 4))
+ assert G.has_edge(2, 4)
+
+ def test_star_graph(self):
+ assert is_isomorphic(nx.star_graph(""), nx.empty_graph(0))
+ assert is_isomorphic(nx.star_graph([]), nx.empty_graph(0))
+ assert is_isomorphic(nx.star_graph(0), nx.empty_graph(1))
+ assert is_isomorphic(nx.star_graph(1), nx.path_graph(2))
+ assert is_isomorphic(nx.star_graph(2), nx.path_graph(3))
+ assert is_isomorphic(nx.star_graph(5), nx.complete_bipartite_graph(1, 5))
+
+ s = nx.star_graph(10)
+ assert sorted(d for n, d in s.degree()) == [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10]
+
+ pytest.raises(nx.NetworkXError, nx.star_graph, 10, create_using=nx.DiGraph)
+
+ ms = nx.star_graph(10, create_using=nx.MultiGraph)
+ assert edges_equal(ms.edges(), s.edges())
+
+ G = nx.star_graph("abc")
+ assert len(G) == 3
+ assert G.size() == 2
+
+ G = nx.star_graph("abcb")
+ assert len(G) == 3
+ assert G.size() == 2
+ G = nx.star_graph("abcb", create_using=nx.MultiGraph)
+ assert len(G) == 3
+ assert G.size() == 3
+
+ G = nx.star_graph("abcdefg")
+ assert len(G) == 7
+ assert G.size() == 6
+
+ def test_non_int_integers_for_star_graph(self):
+ np = pytest.importorskip("numpy")
+ G = nx.star_graph(np.int32(3))
+ assert len(G) == 4
+ assert G.size() == 3
+
+ @pytest.mark.parametrize(("m", "n"), [(3, 0), (3, 5), (4, 10), (3, 20)])
+ def test_tadpole_graph_right_sizes(self, m, n):
+ G = nx.tadpole_graph(m, n)
+ assert nx.number_of_nodes(G) == m + n
+ assert nx.number_of_edges(G) == m + n - (m == 2)
+
+ @pytest.mark.parametrize(("m", "n"), [("ab", ""), ("ab", "c"), ("abc", "defg")])
+ def test_tadpole_graph_size_node_sequences(self, m, n):
+ G = nx.tadpole_graph(m, n)
+ assert nx.number_of_nodes(G) == len(m) + len(n)
+ assert nx.number_of_edges(G) == len(m) + len(n) - (len(m) == 2)
+
+ def test_tadpole_graph_exceptions(self):
+ # Raise NetworkXError if m<2
+ pytest.raises(nx.NetworkXError, nx.tadpole_graph, -1, 3)
+ pytest.raises(nx.NetworkXError, nx.tadpole_graph, 0, 3)
+ pytest.raises(nx.NetworkXError, nx.tadpole_graph, 1, 3)
+
+ # Raise NetworkXError if n<0
+ pytest.raises(nx.NetworkXError, nx.tadpole_graph, 5, -2)
+
+ # Raise NetworkXError for digraphs
+ with pytest.raises(nx.NetworkXError):
+ nx.tadpole_graph(2, 20, create_using=nx.DiGraph)
+ with pytest.raises(nx.NetworkXError):
+ nx.tadpole_graph(2, 20, create_using=nx.MultiDiGraph)
+
+ @pytest.mark.parametrize(("m", "n"), [(2, 0), (2, 5), (2, 10), ("ab", 20)])
+ def test_tadpole_graph_same_as_path_when_m_is_2(self, m, n):
+ G = nx.tadpole_graph(m, n)
+ assert is_isomorphic(G, nx.path_graph(n + 2))
+
+ @pytest.mark.parametrize("m", [4, 7])
+ def test_tadpole_graph_same_as_cycle_when_m2_is_0(self, m):
+ G = nx.tadpole_graph(m, 0)
+ assert is_isomorphic(G, nx.cycle_graph(m))
+
+ def test_tadpole_graph_for_multigraph(self):
+ G = nx.tadpole_graph(5, 20)
+ MG = nx.tadpole_graph(5, 20, create_using=nx.MultiGraph)
+ assert edges_equal(MG.edges(), G.edges())
+
+ @pytest.mark.parametrize(
+ ("m", "n"),
+ [(4, "abc"), ("abcd", 3), ([1, 2, 3, 4], "abc"), ("abcd", [1, 2, 3])],
+ )
+ def test_tadpole_graph_mixing_input_types(self, m, n):
+ expected = nx.compose(nx.cycle_graph(4), nx.path_graph(range(100, 103)))
+ expected.add_edge(0, 100) # Connect cycle and path
+ assert is_isomorphic(nx.tadpole_graph(m, n), expected)
+
+ def test_tadpole_graph_non_builtin_integers(self):
+ np = pytest.importorskip("numpy")
+ G = nx.tadpole_graph(np.int32(4), np.int64(3))
+ expected = nx.compose(nx.cycle_graph(4), nx.path_graph(range(100, 103)))
+ expected.add_edge(0, 100) # Connect cycle and path
+ assert is_isomorphic(G, expected)
+
+ def test_trivial_graph(self):
+ assert nx.number_of_nodes(nx.trivial_graph()) == 1
+
+ def test_turan_graph(self):
+ assert nx.number_of_edges(nx.turan_graph(13, 4)) == 63
+ assert is_isomorphic(
+ nx.turan_graph(13, 4), nx.complete_multipartite_graph(3, 4, 3, 3)
+ )
+
+ def test_wheel_graph(self):
+ for n, G in [
+ ("", nx.null_graph()),
+ (0, nx.null_graph()),
+ (1, nx.empty_graph(1)),
+ (2, nx.path_graph(2)),
+ (3, nx.complete_graph(3)),
+ (4, nx.complete_graph(4)),
+ ]:
+ g = nx.wheel_graph(n)
+ assert is_isomorphic(g, G)
+
+ g = nx.wheel_graph(10)
+ assert sorted(d for n, d in g.degree()) == [3, 3, 3, 3, 3, 3, 3, 3, 3, 9]
+
+ pytest.raises(nx.NetworkXError, nx.wheel_graph, 10, create_using=nx.DiGraph)
+
+ mg = nx.wheel_graph(10, create_using=nx.MultiGraph())
+ assert edges_equal(mg.edges(), g.edges())
+
+ G = nx.wheel_graph("abc")
+ assert len(G) == 3
+ assert G.size() == 3
+
+ G = nx.wheel_graph("abcb")
+ assert len(G) == 3
+ assert G.size() == 4
+ G = nx.wheel_graph("abcb", nx.MultiGraph)
+ assert len(G) == 3
+ assert G.size() == 6
+
+ def test_non_int_integers_for_wheel_graph(self):
+ np = pytest.importorskip("numpy")
+ G = nx.wheel_graph(np.int32(3))
+ assert len(G) == 3
+ assert G.size() == 3
+
+ def test_complete_0_partite_graph(self):
+ """Tests that the complete 0-partite graph is the null graph."""
+ G = nx.complete_multipartite_graph()
+ H = nx.null_graph()
+ assert nodes_equal(G, H)
+ assert edges_equal(G.edges(), H.edges())
+
+ def test_complete_1_partite_graph(self):
+ """Tests that the complete 1-partite graph is the empty graph."""
+ G = nx.complete_multipartite_graph(3)
+ H = nx.empty_graph(3)
+ assert nodes_equal(G, H)
+ assert edges_equal(G.edges(), H.edges())
+
+ def test_complete_2_partite_graph(self):
+ """Tests that the complete 2-partite graph is the complete bipartite
+ graph.
+
+ """
+ G = nx.complete_multipartite_graph(2, 3)
+ H = nx.complete_bipartite_graph(2, 3)
+ assert nodes_equal(G, H)
+ assert edges_equal(G.edges(), H.edges())
+
+ def test_complete_multipartite_graph(self):
+ """Tests for generating the complete multipartite graph."""
+ G = nx.complete_multipartite_graph(2, 3, 4)
+ blocks = [(0, 1), (2, 3, 4), (5, 6, 7, 8)]
+ # Within each block, no two vertices should be adjacent.
+ for block in blocks:
+ for u, v in itertools.combinations_with_replacement(block, 2):
+ assert v not in G[u]
+ assert G.nodes[u] == G.nodes[v]
+ # Across blocks, all vertices should be adjacent.
+ for block1, block2 in itertools.combinations(blocks, 2):
+ for u, v in itertools.product(block1, block2):
+ assert v in G[u]
+ assert G.nodes[u] != G.nodes[v]
+ with pytest.raises(nx.NetworkXError, match="Negative number of nodes"):
+ nx.complete_multipartite_graph(2, -3, 4)
+
+ def test_kneser_graph(self):
+ # the petersen graph is a special case of the kneser graph when n=5 and k=2
+ assert is_isomorphic(nx.kneser_graph(5, 2), nx.petersen_graph())
+
+ # when k is 1, the kneser graph returns a complete graph with n vertices
+ for i in range(1, 7):
+ assert is_isomorphic(nx.kneser_graph(i, 1), nx.complete_graph(i))
+
+ # the kneser graph of n and n-1 is the empty graph with n vertices
+ for j in range(3, 7):
+ assert is_isomorphic(nx.kneser_graph(j, j - 1), nx.empty_graph(j))
+
+ # in general the number of edges of the kneser graph is equal to
+ # (n choose k) times (n-k choose k) divided by 2
+ assert nx.number_of_edges(nx.kneser_graph(8, 3)) == 280
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_cographs.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_cographs.py
new file mode 100644
index 0000000000000000000000000000000000000000..a71849b019e7fc3f198a240fc137de0cfddaed0d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_cographs.py
@@ -0,0 +1,18 @@
+"""Unit tests for the :mod:`networkx.generators.cographs` module."""
+
+import networkx as nx
+
+
+def test_random_cograph():
+ n = 3
+ G = nx.random_cograph(n)
+
+ assert len(G) == 2**n
+
+ # Every connected subgraph of G has diameter <= 2
+ if nx.is_connected(G):
+ assert nx.diameter(G) <= 2
+ else:
+ components = nx.connected_components(G)
+ for component in components:
+ assert nx.diameter(G.subgraph(component)) <= 2
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_community.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_community.py
new file mode 100644
index 0000000000000000000000000000000000000000..2fa107f6dde9f280123796f81b919c99f92ee20c
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_community.py
@@ -0,0 +1,362 @@
+import pytest
+
+import networkx as nx
+
+
+def test_random_partition_graph():
+ G = nx.random_partition_graph([3, 3, 3], 1, 0, seed=42)
+ C = G.graph["partition"]
+ assert C == [{0, 1, 2}, {3, 4, 5}, {6, 7, 8}]
+ assert len(G) == 9
+ assert len(list(G.edges())) == 9
+
+ G = nx.random_partition_graph([3, 3, 3], 0, 1)
+ C = G.graph["partition"]
+ assert C == [{0, 1, 2}, {3, 4, 5}, {6, 7, 8}]
+ assert len(G) == 9
+ assert len(list(G.edges())) == 27
+
+ G = nx.random_partition_graph([3, 3, 3], 1, 0, directed=True)
+ C = G.graph["partition"]
+ assert C == [{0, 1, 2}, {3, 4, 5}, {6, 7, 8}]
+ assert len(G) == 9
+ assert len(list(G.edges())) == 18
+
+ G = nx.random_partition_graph([3, 3, 3], 0, 1, directed=True)
+ C = G.graph["partition"]
+ assert C == [{0, 1, 2}, {3, 4, 5}, {6, 7, 8}]
+ assert len(G) == 9
+ assert len(list(G.edges())) == 54
+
+ G = nx.random_partition_graph([1, 2, 3, 4, 5], 0.5, 0.1)
+ C = G.graph["partition"]
+ assert C == [{0}, {1, 2}, {3, 4, 5}, {6, 7, 8, 9}, {10, 11, 12, 13, 14}]
+ assert len(G) == 15
+
+ rpg = nx.random_partition_graph
+ pytest.raises(nx.NetworkXError, rpg, [1, 2, 3], 1.1, 0.1)
+ pytest.raises(nx.NetworkXError, rpg, [1, 2, 3], -0.1, 0.1)
+ pytest.raises(nx.NetworkXError, rpg, [1, 2, 3], 0.1, 1.1)
+ pytest.raises(nx.NetworkXError, rpg, [1, 2, 3], 0.1, -0.1)
+
+
+def test_planted_partition_graph():
+ G = nx.planted_partition_graph(4, 3, 1, 0, seed=42)
+ C = G.graph["partition"]
+ assert len(C) == 4
+ assert len(G) == 12
+ assert len(list(G.edges())) == 12
+
+ G = nx.planted_partition_graph(4, 3, 0, 1)
+ C = G.graph["partition"]
+ assert len(C) == 4
+ assert len(G) == 12
+ assert len(list(G.edges())) == 54
+
+ G = nx.planted_partition_graph(10, 4, 0.5, 0.1, seed=42)
+ C = G.graph["partition"]
+ assert len(C) == 10
+ assert len(G) == 40
+
+ G = nx.planted_partition_graph(4, 3, 1, 0, directed=True)
+ C = G.graph["partition"]
+ assert len(C) == 4
+ assert len(G) == 12
+ assert len(list(G.edges())) == 24
+
+ G = nx.planted_partition_graph(4, 3, 0, 1, directed=True)
+ C = G.graph["partition"]
+ assert len(C) == 4
+ assert len(G) == 12
+ assert len(list(G.edges())) == 108
+
+ G = nx.planted_partition_graph(10, 4, 0.5, 0.1, seed=42, directed=True)
+ C = G.graph["partition"]
+ assert len(C) == 10
+ assert len(G) == 40
+
+ ppg = nx.planted_partition_graph
+ pytest.raises(nx.NetworkXError, ppg, 3, 3, 1.1, 0.1)
+ pytest.raises(nx.NetworkXError, ppg, 3, 3, -0.1, 0.1)
+ pytest.raises(nx.NetworkXError, ppg, 3, 3, 0.1, 1.1)
+ pytest.raises(nx.NetworkXError, ppg, 3, 3, 0.1, -0.1)
+
+
+def test_relaxed_caveman_graph():
+ G = nx.relaxed_caveman_graph(4, 3, 0)
+ assert len(G) == 12
+ G = nx.relaxed_caveman_graph(4, 3, 1)
+ assert len(G) == 12
+ G = nx.relaxed_caveman_graph(4, 3, 0.5)
+ assert len(G) == 12
+ G = nx.relaxed_caveman_graph(4, 3, 0.5, seed=42)
+ assert len(G) == 12
+
+
+def test_connected_caveman_graph():
+ G = nx.connected_caveman_graph(4, 3)
+ assert len(G) == 12
+
+ G = nx.connected_caveman_graph(1, 5)
+ K5 = nx.complete_graph(5)
+ K5.remove_edge(3, 4)
+ assert nx.is_isomorphic(G, K5)
+
+ # need at least 2 nodes in each clique
+ pytest.raises(nx.NetworkXError, nx.connected_caveman_graph, 4, 1)
+
+
+def test_caveman_graph():
+ G = nx.caveman_graph(4, 3)
+ assert len(G) == 12
+
+ G = nx.caveman_graph(5, 1)
+ E5 = nx.empty_graph(5)
+ assert nx.is_isomorphic(G, E5)
+
+ G = nx.caveman_graph(1, 5)
+ K5 = nx.complete_graph(5)
+ assert nx.is_isomorphic(G, K5)
+
+
+def test_gaussian_random_partition_graph():
+ G = nx.gaussian_random_partition_graph(100, 10, 10, 0.3, 0.01)
+ assert len(G) == 100
+ G = nx.gaussian_random_partition_graph(100, 10, 10, 0.3, 0.01, directed=True)
+ assert len(G) == 100
+ G = nx.gaussian_random_partition_graph(
+ 100, 10, 10, 0.3, 0.01, directed=False, seed=42
+ )
+ assert len(G) == 100
+ assert not isinstance(G, nx.DiGraph)
+ G = nx.gaussian_random_partition_graph(
+ 100, 10, 10, 0.3, 0.01, directed=True, seed=42
+ )
+ assert len(G) == 100
+ assert isinstance(G, nx.DiGraph)
+ pytest.raises(
+ nx.NetworkXError, nx.gaussian_random_partition_graph, 100, 101, 10, 1, 0
+ )
+ # Test when clusters are likely less than 1
+ G = nx.gaussian_random_partition_graph(10, 0.5, 0.5, 0.5, 0.5, seed=1)
+ assert len(G) == 10
+
+
+def test_ring_of_cliques():
+ for i in range(2, 20, 3):
+ for j in range(2, 20, 3):
+ G = nx.ring_of_cliques(i, j)
+ assert G.number_of_nodes() == i * j
+ if i != 2 or j != 1:
+ expected_num_edges = i * (((j * (j - 1)) // 2) + 1)
+ else:
+ # the edge that already exists cannot be duplicated
+ expected_num_edges = i * (((j * (j - 1)) // 2) + 1) - 1
+ assert G.number_of_edges() == expected_num_edges
+ with pytest.raises(
+ nx.NetworkXError, match="A ring of cliques must have at least two cliques"
+ ):
+ nx.ring_of_cliques(1, 5)
+ with pytest.raises(
+ nx.NetworkXError, match="The cliques must have at least two nodes"
+ ):
+ nx.ring_of_cliques(3, 0)
+
+
+def test_windmill_graph():
+ for n in range(2, 20, 3):
+ for k in range(2, 20, 3):
+ G = nx.windmill_graph(n, k)
+ assert G.number_of_nodes() == (k - 1) * n + 1
+ assert G.number_of_edges() == n * k * (k - 1) / 2
+ assert G.degree(0) == G.number_of_nodes() - 1
+ for i in range(1, G.number_of_nodes()):
+ assert G.degree(i) == k - 1
+ with pytest.raises(
+ nx.NetworkXError, match="A windmill graph must have at least two cliques"
+ ):
+ nx.windmill_graph(1, 3)
+ with pytest.raises(
+ nx.NetworkXError, match="The cliques must have at least two nodes"
+ ):
+ nx.windmill_graph(3, 0)
+
+
+def test_stochastic_block_model():
+ sizes = [75, 75, 300]
+ probs = [[0.25, 0.05, 0.02], [0.05, 0.35, 0.07], [0.02, 0.07, 0.40]]
+ G = nx.stochastic_block_model(sizes, probs, seed=0)
+ C = G.graph["partition"]
+ assert len(C) == 3
+ assert len(G) == 450
+ assert G.size() == 22160
+
+ GG = nx.stochastic_block_model(sizes, probs, range(450), seed=0)
+ assert G.nodes == GG.nodes
+
+ # Test Exceptions
+ sbm = nx.stochastic_block_model
+ badnodelist = list(range(400)) # not enough nodes to match sizes
+ badprobs1 = [[0.25, 0.05, 1.02], [0.05, 0.35, 0.07], [0.02, 0.07, 0.40]]
+ badprobs2 = [[0.25, 0.05, 0.02], [0.05, -0.35, 0.07], [0.02, 0.07, 0.40]]
+ probs_rect1 = [[0.25, 0.05, 0.02], [0.05, -0.35, 0.07]]
+ probs_rect2 = [[0.25, 0.05], [0.05, -0.35], [0.02, 0.07]]
+ asymprobs = [[0.25, 0.05, 0.01], [0.05, -0.35, 0.07], [0.02, 0.07, 0.40]]
+ pytest.raises(nx.NetworkXException, sbm, sizes, badprobs1)
+ pytest.raises(nx.NetworkXException, sbm, sizes, badprobs2)
+ pytest.raises(nx.NetworkXException, sbm, sizes, probs_rect1, directed=True)
+ pytest.raises(nx.NetworkXException, sbm, sizes, probs_rect2, directed=True)
+ pytest.raises(nx.NetworkXException, sbm, sizes, asymprobs, directed=False)
+ pytest.raises(nx.NetworkXException, sbm, sizes, probs, badnodelist)
+ nodelist = [0] + list(range(449)) # repeated node name in nodelist
+ pytest.raises(nx.NetworkXException, sbm, sizes, probs, nodelist)
+
+ # Extra keyword arguments test
+ GG = nx.stochastic_block_model(sizes, probs, seed=0, selfloops=True)
+ assert G.nodes == GG.nodes
+ GG = nx.stochastic_block_model(sizes, probs, selfloops=True, directed=True)
+ assert G.nodes == GG.nodes
+ GG = nx.stochastic_block_model(sizes, probs, seed=0, sparse=False)
+ assert G.nodes == GG.nodes
+
+
+def test_generator():
+ n = 250
+ tau1 = 3
+ tau2 = 1.5
+ mu = 0.1
+ G = nx.LFR_benchmark_graph(
+ n, tau1, tau2, mu, average_degree=5, min_community=20, seed=10
+ )
+ assert len(G) == 250
+ C = {frozenset(G.nodes[v]["community"]) for v in G}
+ assert nx.community.is_partition(G.nodes(), C)
+
+
+def test_invalid_tau1():
+ with pytest.raises(nx.NetworkXError, match="tau2 must be greater than one"):
+ n = 100
+ tau1 = 2
+ tau2 = 1
+ mu = 0.1
+ nx.LFR_benchmark_graph(n, tau1, tau2, mu, min_degree=2)
+
+
+def test_invalid_tau2():
+ with pytest.raises(nx.NetworkXError, match="tau1 must be greater than one"):
+ n = 100
+ tau1 = 1
+ tau2 = 2
+ mu = 0.1
+ nx.LFR_benchmark_graph(n, tau1, tau2, mu, min_degree=2)
+
+
+def test_mu_too_large():
+ with pytest.raises(nx.NetworkXError, match="mu must be in the interval \\[0, 1\\]"):
+ n = 100
+ tau1 = 2
+ tau2 = 2
+ mu = 1.1
+ nx.LFR_benchmark_graph(n, tau1, tau2, mu, min_degree=2)
+
+
+def test_mu_too_small():
+ with pytest.raises(nx.NetworkXError, match="mu must be in the interval \\[0, 1\\]"):
+ n = 100
+ tau1 = 2
+ tau2 = 2
+ mu = -1
+ nx.LFR_benchmark_graph(n, tau1, tau2, mu, min_degree=2)
+
+
+def test_both_degrees_none():
+ with pytest.raises(
+ nx.NetworkXError,
+ match="Must assign exactly one of min_degree and average_degree",
+ ):
+ n = 100
+ tau1 = 2
+ tau2 = 2
+ mu = 1
+ nx.LFR_benchmark_graph(n, tau1, tau2, mu)
+
+
+def test_neither_degrees_none():
+ with pytest.raises(
+ nx.NetworkXError,
+ match="Must assign exactly one of min_degree and average_degree",
+ ):
+ n = 100
+ tau1 = 2
+ tau2 = 2
+ mu = 1
+ nx.LFR_benchmark_graph(n, tau1, tau2, mu, min_degree=2, average_degree=5)
+
+
+def test_max_iters_exceeded():
+ with pytest.raises(
+ nx.ExceededMaxIterations,
+ match="Could not assign communities; try increasing min_community",
+ ):
+ n = 10
+ tau1 = 2
+ tau2 = 2
+ mu = 0.1
+ nx.LFR_benchmark_graph(n, tau1, tau2, mu, min_degree=2, max_iters=10, seed=1)
+
+
+def test_max_deg_out_of_range():
+ with pytest.raises(
+ nx.NetworkXError, match="max_degree must be in the interval \\(0, n\\]"
+ ):
+ n = 10
+ tau1 = 2
+ tau2 = 2
+ mu = 0.1
+ nx.LFR_benchmark_graph(
+ n, tau1, tau2, mu, max_degree=n + 1, max_iters=10, seed=1
+ )
+
+
+def test_max_community():
+ n = 250
+ tau1 = 3
+ tau2 = 1.5
+ mu = 0.1
+ G = nx.LFR_benchmark_graph(
+ n,
+ tau1,
+ tau2,
+ mu,
+ average_degree=5,
+ max_degree=100,
+ min_community=50,
+ max_community=200,
+ seed=10,
+ )
+ assert len(G) == 250
+ C = {frozenset(G.nodes[v]["community"]) for v in G}
+ assert nx.community.is_partition(G.nodes(), C)
+
+
+def test_powerlaw_iterations_exceeded():
+ with pytest.raises(
+ nx.ExceededMaxIterations, match="Could not create power law sequence"
+ ):
+ n = 100
+ tau1 = 2
+ tau2 = 2
+ mu = 1
+ nx.LFR_benchmark_graph(n, tau1, tau2, mu, min_degree=2, max_iters=0)
+
+
+def test_no_scipy_zeta():
+ zeta2 = 1.6449340668482264
+ assert abs(zeta2 - nx.generators.community._hurwitz_zeta(2, 1, 0.0001)) < 0.01
+
+
+def test_generate_min_degree_itr():
+ with pytest.raises(
+ nx.ExceededMaxIterations, match="Could not match average_degree"
+ ):
+ nx.generators.community._generate_min_degree(2, 2, 1, 0.01, 0)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_degree_seq.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_degree_seq.py
new file mode 100644
index 0000000000000000000000000000000000000000..39ed59a5f32270242b8d069c57229d3e10ba7f43
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_degree_seq.py
@@ -0,0 +1,230 @@
+import pytest
+
+import networkx as nx
+
+
+class TestConfigurationModel:
+ """Unit tests for the :func:`~networkx.configuration_model`
+ function.
+
+ """
+
+ def test_empty_degree_sequence(self):
+ """Tests that an empty degree sequence yields the null graph."""
+ G = nx.configuration_model([])
+ assert len(G) == 0
+
+ def test_degree_zero(self):
+ """Tests that a degree sequence of all zeros yields the empty
+ graph.
+
+ """
+ G = nx.configuration_model([0, 0, 0])
+ assert len(G) == 3
+ assert G.number_of_edges() == 0
+
+ def test_degree_sequence(self):
+ """Tests that the degree sequence of the generated graph matches
+ the input degree sequence.
+
+ """
+ deg_seq = [5, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1]
+ G = nx.configuration_model(deg_seq, seed=12345678)
+ assert sorted((d for n, d in G.degree()), reverse=True) == [
+ 5,
+ 3,
+ 3,
+ 3,
+ 3,
+ 2,
+ 2,
+ 2,
+ 1,
+ 1,
+ 1,
+ ]
+ assert sorted((d for n, d in G.degree(range(len(deg_seq)))), reverse=True) == [
+ 5,
+ 3,
+ 3,
+ 3,
+ 3,
+ 2,
+ 2,
+ 2,
+ 1,
+ 1,
+ 1,
+ ]
+
+ def test_random_seed(self):
+ """Tests that each call with the same random seed generates the
+ same graph.
+
+ """
+ deg_seq = [3] * 12
+ G1 = nx.configuration_model(deg_seq, seed=1000)
+ G2 = nx.configuration_model(deg_seq, seed=1000)
+ assert nx.is_isomorphic(G1, G2)
+ G1 = nx.configuration_model(deg_seq, seed=10)
+ G2 = nx.configuration_model(deg_seq, seed=10)
+ assert nx.is_isomorphic(G1, G2)
+
+ def test_directed_disallowed(self):
+ """Tests that attempting to create a configuration model graph
+ using a directed graph yields an exception.
+
+ """
+ with pytest.raises(nx.NetworkXNotImplemented):
+ nx.configuration_model([], create_using=nx.DiGraph())
+
+ def test_odd_degree_sum(self):
+ """Tests that a degree sequence whose sum is odd yields an
+ exception.
+
+ """
+ with pytest.raises(nx.NetworkXError):
+ nx.configuration_model([1, 2])
+
+
+def test_directed_configuration_raise_unequal():
+ with pytest.raises(nx.NetworkXError):
+ zin = [5, 3, 3, 3, 3, 2, 2, 2, 1, 1]
+ zout = [5, 3, 3, 3, 3, 2, 2, 2, 1, 2]
+ nx.directed_configuration_model(zin, zout)
+
+
+def test_directed_configuration_model():
+ G = nx.directed_configuration_model([], [], seed=0)
+ assert len(G) == 0
+
+
+def test_simple_directed_configuration_model():
+ G = nx.directed_configuration_model([1, 1], [1, 1], seed=0)
+ assert len(G) == 2
+
+
+def test_expected_degree_graph_empty():
+ # empty graph has empty degree sequence
+ deg_seq = []
+ G = nx.expected_degree_graph(deg_seq)
+ assert dict(G.degree()) == {}
+
+
+def test_expected_degree_graph():
+ # test that fixed seed delivers the same graph
+ deg_seq = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
+ G1 = nx.expected_degree_graph(deg_seq, seed=1000)
+ assert len(G1) == 12
+
+ G2 = nx.expected_degree_graph(deg_seq, seed=1000)
+ assert nx.is_isomorphic(G1, G2)
+
+ G1 = nx.expected_degree_graph(deg_seq, seed=10)
+ G2 = nx.expected_degree_graph(deg_seq, seed=10)
+ assert nx.is_isomorphic(G1, G2)
+
+
+def test_expected_degree_graph_selfloops():
+ deg_seq = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
+ G1 = nx.expected_degree_graph(deg_seq, seed=1000, selfloops=False)
+ G2 = nx.expected_degree_graph(deg_seq, seed=1000, selfloops=False)
+ assert nx.is_isomorphic(G1, G2)
+ assert len(G1) == 12
+
+
+def test_expected_degree_graph_skew():
+ deg_seq = [10, 2, 2, 2, 2]
+ G1 = nx.expected_degree_graph(deg_seq, seed=1000)
+ G2 = nx.expected_degree_graph(deg_seq, seed=1000)
+ assert nx.is_isomorphic(G1, G2)
+ assert len(G1) == 5
+
+
+def test_havel_hakimi_construction():
+ G = nx.havel_hakimi_graph([])
+ assert len(G) == 0
+
+ z = [1000, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1]
+ pytest.raises(nx.NetworkXError, nx.havel_hakimi_graph, z)
+ z = ["A", 3, 3, 3, 3, 2, 2, 2, 1, 1, 1]
+ pytest.raises(nx.NetworkXError, nx.havel_hakimi_graph, z)
+
+ z = [5, 4, 3, 3, 3, 2, 2, 2]
+ G = nx.havel_hakimi_graph(z)
+ G = nx.configuration_model(z)
+ z = [6, 5, 4, 4, 2, 1, 1, 1]
+ pytest.raises(nx.NetworkXError, nx.havel_hakimi_graph, z)
+
+ z = [10, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2]
+
+ G = nx.havel_hakimi_graph(z)
+
+ pytest.raises(nx.NetworkXError, nx.havel_hakimi_graph, z, create_using=nx.DiGraph())
+
+
+def test_directed_havel_hakimi():
+ # Test range of valid directed degree sequences
+ n, r = 100, 10
+ p = 1.0 / r
+ for i in range(r):
+ G1 = nx.erdos_renyi_graph(n, p * (i + 1), None, True)
+ din1 = [d for n, d in G1.in_degree()]
+ dout1 = [d for n, d in G1.out_degree()]
+ G2 = nx.directed_havel_hakimi_graph(din1, dout1)
+ din2 = [d for n, d in G2.in_degree()]
+ dout2 = [d for n, d in G2.out_degree()]
+ assert sorted(din1) == sorted(din2)
+ assert sorted(dout1) == sorted(dout2)
+
+ # Test non-graphical sequence
+ dout = [1000, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1]
+ din = [103, 102, 102, 102, 102, 102, 102, 102, 102, 102]
+ pytest.raises(nx.exception.NetworkXError, nx.directed_havel_hakimi_graph, din, dout)
+ # Test valid sequences
+ dout = [1, 1, 1, 1, 1, 2, 2, 2, 3, 4]
+ din = [2, 2, 2, 2, 2, 2, 2, 2, 0, 2]
+ G2 = nx.directed_havel_hakimi_graph(din, dout)
+ dout2 = (d for n, d in G2.out_degree())
+ din2 = (d for n, d in G2.in_degree())
+ assert sorted(dout) == sorted(dout2)
+ assert sorted(din) == sorted(din2)
+ # Test unequal sums
+ din = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
+ pytest.raises(nx.exception.NetworkXError, nx.directed_havel_hakimi_graph, din, dout)
+ # Test for negative values
+ din = [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2]
+ pytest.raises(nx.exception.NetworkXError, nx.directed_havel_hakimi_graph, din, dout)
+
+
+def test_degree_sequence_tree():
+ z = [1, 1, 1, 1, 1, 2, 2, 2, 3, 4]
+ G = nx.degree_sequence_tree(z)
+ assert len(G) == len(z)
+ assert len(list(G.edges())) == sum(z) / 2
+
+ pytest.raises(
+ nx.NetworkXError, nx.degree_sequence_tree, z, create_using=nx.DiGraph()
+ )
+
+ z = [1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4]
+ pytest.raises(nx.NetworkXError, nx.degree_sequence_tree, z)
+
+
+def test_random_degree_sequence_graph():
+ d = [1, 2, 2, 3]
+ G = nx.random_degree_sequence_graph(d, seed=42)
+ assert d == sorted(d for n, d in G.degree())
+
+
+def test_random_degree_sequence_graph_raise():
+ z = [1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 4]
+ pytest.raises(nx.NetworkXUnfeasible, nx.random_degree_sequence_graph, z)
+
+
+def test_random_degree_sequence_large():
+ G1 = nx.fast_gnp_random_graph(100, 0.1, seed=42)
+ d1 = (d for n, d in G1.degree())
+ G2 = nx.random_degree_sequence_graph(d1, seed=42)
+ d2 = (d for n, d in G2.degree())
+ assert sorted(d1) == sorted(d2)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_directed.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_directed.py
new file mode 100644
index 0000000000000000000000000000000000000000..8078d9f7a8b04465bfc556d8f101e343657a078a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_directed.py
@@ -0,0 +1,163 @@
+"""Generators - Directed Graphs
+----------------------------
+"""
+
+import pytest
+
+import networkx as nx
+from networkx.classes import Graph, MultiDiGraph
+from networkx.generators.directed import (
+ gn_graph,
+ gnc_graph,
+ gnr_graph,
+ random_k_out_graph,
+ random_uniform_k_out_graph,
+ scale_free_graph,
+)
+
+
+class TestGeneratorsDirected:
+ def test_smoke_test_random_graphs(self):
+ gn_graph(100)
+ gnr_graph(100, 0.5)
+ gnc_graph(100)
+ scale_free_graph(100)
+
+ gn_graph(100, seed=42)
+ gnr_graph(100, 0.5, seed=42)
+ gnc_graph(100, seed=42)
+ scale_free_graph(100, seed=42)
+
+ def test_create_using_keyword_arguments(self):
+ pytest.raises(nx.NetworkXError, gn_graph, 100, create_using=Graph())
+ pytest.raises(nx.NetworkXError, gnr_graph, 100, 0.5, create_using=Graph())
+ pytest.raises(nx.NetworkXError, gnc_graph, 100, create_using=Graph())
+ G = gn_graph(100, seed=1)
+ MG = gn_graph(100, create_using=MultiDiGraph(), seed=1)
+ assert sorted(G.edges()) == sorted(MG.edges())
+ G = gnr_graph(100, 0.5, seed=1)
+ MG = gnr_graph(100, 0.5, create_using=MultiDiGraph(), seed=1)
+ assert sorted(G.edges()) == sorted(MG.edges())
+ G = gnc_graph(100, seed=1)
+ MG = gnc_graph(100, create_using=MultiDiGraph(), seed=1)
+ assert sorted(G.edges()) == sorted(MG.edges())
+
+ G = scale_free_graph(
+ 100,
+ alpha=0.3,
+ beta=0.4,
+ gamma=0.3,
+ delta_in=0.3,
+ delta_out=0.1,
+ initial_graph=nx.cycle_graph(4, create_using=MultiDiGraph),
+ seed=1,
+ )
+ pytest.raises(ValueError, scale_free_graph, 100, 0.5, 0.4, 0.3)
+ pytest.raises(ValueError, scale_free_graph, 100, alpha=-0.3)
+ pytest.raises(ValueError, scale_free_graph, 100, beta=-0.3)
+ pytest.raises(ValueError, scale_free_graph, 100, gamma=-0.3)
+
+ def test_parameters(self):
+ G = nx.DiGraph()
+ G.add_node(0)
+
+ def kernel(x):
+ return x
+
+ assert nx.is_isomorphic(gn_graph(1), G)
+ assert nx.is_isomorphic(gn_graph(1, kernel=kernel), G)
+ assert nx.is_isomorphic(gnc_graph(1), G)
+ assert nx.is_isomorphic(gnr_graph(1, 0.5), G)
+
+
+def test_scale_free_graph_negative_delta():
+ with pytest.raises(ValueError, match="delta_in must be >= 0."):
+ scale_free_graph(10, delta_in=-1)
+ with pytest.raises(ValueError, match="delta_out must be >= 0."):
+ scale_free_graph(10, delta_out=-1)
+
+
+def test_non_numeric_ordering():
+ G = MultiDiGraph([("a", "b"), ("b", "c"), ("c", "a")])
+ s = scale_free_graph(3, initial_graph=G)
+ assert len(s) == 3
+ assert len(s.edges) == 3
+
+
+@pytest.mark.parametrize("ig", (nx.Graph(), nx.DiGraph([(0, 1)])))
+def test_scale_free_graph_initial_graph_kwarg(ig):
+ with pytest.raises(nx.NetworkXError):
+ scale_free_graph(100, initial_graph=ig)
+
+
+class TestRandomKOutGraph:
+ """Unit tests for the
+ :func:`~networkx.generators.directed.random_k_out_graph` function.
+
+ """
+
+ def test_regularity(self):
+ """Tests that the generated graph is `k`-out-regular."""
+ n = 10
+ k = 3
+ alpha = 1
+ G = random_k_out_graph(n, k, alpha)
+ assert all(d == k for v, d in G.out_degree())
+ G = random_k_out_graph(n, k, alpha, seed=42)
+ assert all(d == k for v, d in G.out_degree())
+
+ def test_no_self_loops(self):
+ """Tests for forbidding self-loops."""
+ n = 10
+ k = 3
+ alpha = 1
+ G = random_k_out_graph(n, k, alpha, self_loops=False)
+ assert nx.number_of_selfloops(G) == 0
+
+ def test_negative_alpha(self):
+ with pytest.raises(ValueError, match="alpha must be positive"):
+ random_k_out_graph(10, 3, -1)
+
+
+class TestUniformRandomKOutGraph:
+ """Unit tests for the
+ :func:`~networkx.generators.directed.random_uniform_k_out_graph`
+ function.
+
+ """
+
+ def test_regularity(self):
+ """Tests that the generated graph is `k`-out-regular."""
+ n = 10
+ k = 3
+ G = random_uniform_k_out_graph(n, k)
+ assert all(d == k for v, d in G.out_degree())
+ G = random_uniform_k_out_graph(n, k, seed=42)
+ assert all(d == k for v, d in G.out_degree())
+
+ def test_no_self_loops(self):
+ """Tests for forbidding self-loops."""
+ n = 10
+ k = 3
+ G = random_uniform_k_out_graph(n, k, self_loops=False)
+ assert nx.number_of_selfloops(G) == 0
+ assert all(d == k for v, d in G.out_degree())
+
+ def test_with_replacement(self):
+ n = 10
+ k = 3
+ G = random_uniform_k_out_graph(n, k, with_replacement=True)
+ assert G.is_multigraph()
+ assert all(d == k for v, d in G.out_degree())
+ n = 10
+ k = 9
+ G = random_uniform_k_out_graph(n, k, with_replacement=False, self_loops=False)
+ assert nx.number_of_selfloops(G) == 0
+ assert all(d == k for v, d in G.out_degree())
+
+ def test_without_replacement(self):
+ n = 10
+ k = 3
+ G = random_uniform_k_out_graph(n, k, with_replacement=False)
+ assert not G.is_multigraph()
+ assert all(d == k for v, d in G.out_degree())
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_duplication.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_duplication.py
new file mode 100644
index 0000000000000000000000000000000000000000..9b6100b78e59067b607e310f14d80e5a00c2b691
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_duplication.py
@@ -0,0 +1,103 @@
+"""Unit tests for the :mod:`networkx.generators.duplication` module."""
+
+import pytest
+
+import networkx as nx
+
+
+class TestDuplicationDivergenceGraph:
+ """Unit tests for the
+ :func:`networkx.generators.duplication.duplication_divergence_graph`
+ function.
+
+ """
+
+ def test_final_size(self):
+ G = nx.duplication_divergence_graph(3, p=1)
+ assert len(G) == 3
+ G = nx.duplication_divergence_graph(3, p=1, seed=42)
+ assert len(G) == 3
+
+ def test_probability_too_large(self):
+ with pytest.raises(nx.NetworkXError):
+ nx.duplication_divergence_graph(3, p=2)
+
+ def test_probability_too_small(self):
+ with pytest.raises(nx.NetworkXError):
+ nx.duplication_divergence_graph(3, p=-1)
+
+ def test_non_extreme_probability_value(self):
+ G = nx.duplication_divergence_graph(6, p=0.3, seed=42)
+ assert len(G) == 6
+ assert list(G.degree()) == [(0, 2), (1, 3), (2, 2), (3, 3), (4, 1), (5, 1)]
+
+ def test_minimum_desired_nodes(self):
+ with pytest.raises(
+ nx.NetworkXError, match=".*n must be greater than or equal to 2"
+ ):
+ nx.duplication_divergence_graph(1, p=1)
+
+ def test_create_using(self):
+ class DummyGraph(nx.Graph):
+ pass
+
+ class DummyDiGraph(nx.DiGraph):
+ pass
+
+ G = nx.duplication_divergence_graph(6, 0.3, seed=42, create_using=DummyGraph)
+ assert isinstance(G, DummyGraph)
+ with pytest.raises(nx.NetworkXError, match="create_using must not be directed"):
+ nx.duplication_divergence_graph(6, 0.3, seed=42, create_using=DummyDiGraph)
+
+
+class TestPartialDuplicationGraph:
+ """Unit tests for the
+ :func:`networkx.generators.duplication.partial_duplication_graph`
+ function.
+
+ """
+
+ def test_final_size(self):
+ N = 10
+ n = 5
+ p = 0.5
+ q = 0.5
+ G = nx.partial_duplication_graph(N, n, p, q)
+ assert len(G) == N
+ G = nx.partial_duplication_graph(N, n, p, q, seed=42)
+ assert len(G) == N
+
+ def test_initial_clique_size(self):
+ N = 10
+ n = 10
+ p = 0.5
+ q = 0.5
+ G = nx.partial_duplication_graph(N, n, p, q)
+ assert len(G) == n
+
+ def test_invalid_initial_size(self):
+ with pytest.raises(nx.NetworkXError):
+ N = 5
+ n = 10
+ p = 0.5
+ q = 0.5
+ G = nx.partial_duplication_graph(N, n, p, q)
+
+ def test_invalid_probabilities(self):
+ N = 1
+ n = 1
+ for p, q in [(0.5, 2), (0.5, -1), (2, 0.5), (-1, 0.5)]:
+ args = (N, n, p, q)
+ pytest.raises(nx.NetworkXError, nx.partial_duplication_graph, *args)
+
+ def test_create_using(self):
+ class DummyGraph(nx.Graph):
+ pass
+
+ class DummyDiGraph(nx.DiGraph):
+ pass
+
+ G = nx.partial_duplication_graph(10, 5, 0.5, 0.5, create_using=DummyGraph)
+ assert isinstance(G, DummyGraph)
+ with pytest.raises(nx.NetworkXError, match="create_using must not be directed"):
+ nx.partial_duplication_graph(10, 5, 0.5, 0.5, create_using=DummyDiGraph)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_ego.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_ego.py
new file mode 100644
index 0000000000000000000000000000000000000000..f6fc779548a3fd2e049679987f941b2bc211c2d0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_ego.py
@@ -0,0 +1,39 @@
+"""
+ego graph
+---------
+"""
+
+import networkx as nx
+from networkx.utils import edges_equal, nodes_equal
+
+
+class TestGeneratorEgo:
+ def test_ego(self):
+ G = nx.star_graph(3)
+ H = nx.ego_graph(G, 0)
+ assert nx.is_isomorphic(G, H)
+ G.add_edge(1, 11)
+ G.add_edge(2, 22)
+ G.add_edge(3, 33)
+ H = nx.ego_graph(G, 0)
+ assert nx.is_isomorphic(nx.star_graph(3), H)
+ G = nx.path_graph(3)
+ H = nx.ego_graph(G, 0)
+ assert edges_equal(H.edges(), [(0, 1)])
+ H = nx.ego_graph(G, 0, undirected=True)
+ assert edges_equal(H.edges(), [(0, 1)])
+ H = nx.ego_graph(G, 0, center=False)
+ assert edges_equal(H.edges(), [])
+
+ def test_ego_distance(self):
+ G = nx.Graph()
+ G.add_edge(0, 1, weight=2, distance=1)
+ G.add_edge(1, 2, weight=2, distance=2)
+ G.add_edge(2, 3, weight=2, distance=1)
+ assert nodes_equal(nx.ego_graph(G, 0, radius=3).nodes(), [0, 1, 2, 3])
+ eg = nx.ego_graph(G, 0, radius=3, distance="weight")
+ assert nodes_equal(eg.nodes(), [0, 1])
+ eg = nx.ego_graph(G, 0, radius=3, distance="weight", undirected=True)
+ assert nodes_equal(eg.nodes(), [0, 1])
+ eg = nx.ego_graph(G, 0, radius=3, distance="distance")
+ assert nodes_equal(eg.nodes(), [0, 1, 2])
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_expanders.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_expanders.py
new file mode 100644
index 0000000000000000000000000000000000000000..7cebc588197fec0d12a958457ef5a0e5b80bf9d4
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_expanders.py
@@ -0,0 +1,162 @@
+"""Unit tests for the :mod:`networkx.generators.expanders` module."""
+
+import pytest
+
+import networkx as nx
+
+
+@pytest.mark.parametrize("n", (2, 3, 5, 6, 10))
+def test_margulis_gabber_galil_graph_properties(n):
+ g = nx.margulis_gabber_galil_graph(n)
+ assert g.number_of_nodes() == n * n
+ for node in g:
+ assert g.degree(node) == 8
+ assert len(node) == 2
+ for i in node:
+ assert int(i) == i
+ assert 0 <= i < n
+
+
+@pytest.mark.parametrize("n", (2, 3, 5, 6, 10))
+def test_margulis_gabber_galil_graph_eigvals(n):
+ np = pytest.importorskip("numpy")
+ sp = pytest.importorskip("scipy")
+
+ g = nx.margulis_gabber_galil_graph(n)
+ # Eigenvalues are already sorted using the scipy eigvalsh,
+ # but the implementation in numpy does not guarantee order.
+ w = sorted(sp.linalg.eigvalsh(nx.adjacency_matrix(g).toarray()))
+ assert w[-2] < 5 * np.sqrt(2)
+
+
+@pytest.mark.parametrize("p", (3, 5, 7, 11)) # Primes
+def test_chordal_cycle_graph(p):
+ """Test for the :func:`networkx.chordal_cycle_graph` function."""
+ G = nx.chordal_cycle_graph(p)
+ assert len(G) == p
+ # TODO The second largest eigenvalue should be smaller than a constant,
+ # independent of the number of nodes in the graph:
+ #
+ # eigs = sorted(sp.linalg.eigvalsh(nx.adjacency_matrix(G).toarray()))
+ # assert_less(eigs[-2], ...)
+ #
+
+
+@pytest.mark.parametrize("p", (3, 5, 7, 11, 13)) # Primes
+def test_paley_graph(p):
+ """Test for the :func:`networkx.paley_graph` function."""
+ G = nx.paley_graph(p)
+ # G has p nodes
+ assert len(G) == p
+ # G is (p-1)/2-regular
+ in_degrees = {G.in_degree(node) for node in G.nodes}
+ out_degrees = {G.out_degree(node) for node in G.nodes}
+ assert len(in_degrees) == 1 and in_degrees.pop() == (p - 1) // 2
+ assert len(out_degrees) == 1 and out_degrees.pop() == (p - 1) // 2
+
+ # If p = 1 mod 4, -1 is a square mod 4 and therefore the
+ # edge in the Paley graph are symmetric.
+ if p % 4 == 1:
+ for u, v in G.edges:
+ assert (v, u) in G.edges
+
+
+@pytest.mark.parametrize("d, n", [(2, 7), (4, 10), (4, 16)])
+def test_maybe_regular_expander(d, n):
+ pytest.importorskip("numpy")
+ G = nx.maybe_regular_expander(n, d)
+
+ assert len(G) == n, "Should have n nodes"
+ assert len(G.edges) == n * d / 2, "Should have n*d/2 edges"
+ assert nx.is_k_regular(G, d), "Should be d-regular"
+
+
+@pytest.mark.parametrize("n", (3, 5, 6, 10))
+def test_is_regular_expander(n):
+ pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
+ G = nx.complete_graph(n)
+
+ assert nx.is_regular_expander(G) == True, "Should be a regular expander"
+
+
+@pytest.mark.parametrize("d, n", [(2, 7), (4, 10), (4, 16)])
+def test_random_regular_expander(d, n):
+ pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
+ G = nx.random_regular_expander_graph(n, d)
+
+ assert len(G) == n, "Should have n nodes"
+ assert len(G.edges) == n * d / 2, "Should have n*d/2 edges"
+ assert nx.is_k_regular(G, d), "Should be d-regular"
+ assert nx.is_regular_expander(G) == True, "Should be a regular expander"
+
+
+def test_random_regular_expander_explicit_construction():
+ pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
+ G = nx.random_regular_expander_graph(d=4, n=5)
+
+ assert len(G) == 5 and len(G.edges) == 10, "Should be a complete graph"
+
+
+@pytest.mark.parametrize("graph_type", (nx.Graph, nx.DiGraph, nx.MultiDiGraph))
+def test_margulis_gabber_galil_graph_badinput(graph_type):
+ with pytest.raises(
+ nx.NetworkXError, match="`create_using` must be an undirected multigraph"
+ ):
+ nx.margulis_gabber_galil_graph(3, create_using=graph_type)
+
+
+@pytest.mark.parametrize("graph_type", (nx.Graph, nx.DiGraph, nx.MultiDiGraph))
+def test_chordal_cycle_graph_badinput(graph_type):
+ with pytest.raises(
+ nx.NetworkXError, match="`create_using` must be an undirected multigraph"
+ ):
+ nx.chordal_cycle_graph(3, create_using=graph_type)
+
+
+def test_paley_graph_badinput():
+ with pytest.raises(
+ nx.NetworkXError, match="`create_using` cannot be a multigraph."
+ ):
+ nx.paley_graph(3, create_using=nx.MultiGraph)
+
+
+def test_maybe_regular_expander_badinput():
+ pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
+
+ with pytest.raises(nx.NetworkXError, match="n must be a positive integer"):
+ nx.maybe_regular_expander(n=-1, d=2)
+
+ with pytest.raises(nx.NetworkXError, match="d must be greater than or equal to 2"):
+ nx.maybe_regular_expander(n=10, d=0)
+
+ with pytest.raises(nx.NetworkXError, match="Need n-1>= d to have room"):
+ nx.maybe_regular_expander(n=5, d=6)
+
+
+def test_is_regular_expander_badinput():
+ pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
+
+ with pytest.raises(nx.NetworkXError, match="epsilon must be non negative"):
+ nx.is_regular_expander(nx.Graph(), epsilon=-1)
+
+
+def test_random_regular_expander_badinput():
+ pytest.importorskip("numpy")
+ pytest.importorskip("scipy")
+
+ with pytest.raises(nx.NetworkXError, match="n must be a positive integer"):
+ nx.random_regular_expander_graph(n=-1, d=2)
+
+ with pytest.raises(nx.NetworkXError, match="d must be greater than or equal to 2"):
+ nx.random_regular_expander_graph(n=10, d=0)
+
+ with pytest.raises(nx.NetworkXError, match="Need n-1>= d to have room"):
+ nx.random_regular_expander_graph(n=5, d=6)
+
+ with pytest.raises(nx.NetworkXError, match="epsilon must be non negative"):
+ nx.random_regular_expander_graph(n=4, d=2, epsilon=-1)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_geometric.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_geometric.py
new file mode 100644
index 0000000000000000000000000000000000000000..f1c68bead51b75e7a39484164cc484cbd4e5def8
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_geometric.py
@@ -0,0 +1,488 @@
+import math
+import random
+from itertools import combinations
+
+import pytest
+
+import networkx as nx
+
+
+def l1dist(x, y):
+ return sum(abs(a - b) for a, b in zip(x, y))
+
+
+class TestRandomGeometricGraph:
+ """Unit tests for :func:`~networkx.random_geometric_graph`"""
+
+ def test_number_of_nodes(self):
+ G = nx.random_geometric_graph(50, 0.25, seed=42)
+ assert len(G) == 50
+ G = nx.random_geometric_graph(range(50), 0.25, seed=42)
+ assert len(G) == 50
+
+ def test_distances(self):
+ """Tests that pairs of vertices adjacent if and only if they are
+ within the prescribed radius.
+ """
+ # Use the Euclidean metric, the default according to the
+ # documentation.
+ G = nx.random_geometric_graph(50, 0.25)
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert math.dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+ # Nonadjacent vertices must be at greater distance.
+ else:
+ assert not math.dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_p(self):
+ """Tests for providing an alternate distance metric to the generator."""
+ # Use the L1 metric.
+ G = nx.random_geometric_graph(50, 0.25, p=1)
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert l1dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+ # Nonadjacent vertices must be at greater distance.
+ else:
+ assert not l1dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_node_names(self):
+ """Tests using values other than sequential numbers as node IDs."""
+ import string
+
+ nodes = list(string.ascii_lowercase)
+ G = nx.random_geometric_graph(nodes, 0.25)
+ assert len(G) == len(nodes)
+
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert math.dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+ # Nonadjacent vertices must be at greater distance.
+ else:
+ assert not math.dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_pos_name(self):
+ G = nx.random_geometric_graph(50, 0.25, seed=42, pos_name="coords")
+ assert all(len(d["coords"]) == 2 for n, d in G.nodes.items())
+
+
+class TestSoftRandomGeometricGraph:
+ """Unit tests for :func:`~networkx.soft_random_geometric_graph`"""
+
+ def test_number_of_nodes(self):
+ G = nx.soft_random_geometric_graph(50, 0.25, seed=42)
+ assert len(G) == 50
+ G = nx.soft_random_geometric_graph(range(50), 0.25, seed=42)
+ assert len(G) == 50
+
+ def test_distances(self):
+ """Tests that pairs of vertices adjacent if and only if they are
+ within the prescribed radius.
+ """
+ # Use the Euclidean metric, the default according to the
+ # documentation.
+ G = nx.soft_random_geometric_graph(50, 0.25)
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert math.dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_p(self):
+ """Tests for providing an alternate distance metric to the generator."""
+
+ # Use the L1 metric.
+ def dist(x, y):
+ return sum(abs(a - b) for a, b in zip(x, y))
+
+ G = nx.soft_random_geometric_graph(50, 0.25, p=1)
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_node_names(self):
+ """Tests using values other than sequential numbers as node IDs."""
+ import string
+
+ nodes = list(string.ascii_lowercase)
+ G = nx.soft_random_geometric_graph(nodes, 0.25)
+ assert len(G) == len(nodes)
+
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert math.dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_p_dist_default(self):
+ """Tests default p_dict = 0.5 returns graph with edge count <= RGG with
+ same n, radius, dim and positions
+ """
+ nodes = 50
+ dim = 2
+ pos = {v: [random.random() for i in range(dim)] for v in range(nodes)}
+ RGG = nx.random_geometric_graph(50, 0.25, pos=pos)
+ SRGG = nx.soft_random_geometric_graph(50, 0.25, pos=pos)
+ assert len(SRGG.edges()) <= len(RGG.edges())
+
+ def test_p_dist_zero(self):
+ """Tests if p_dict = 0 returns disconnected graph with 0 edges"""
+
+ def p_dist(dist):
+ return 0
+
+ G = nx.soft_random_geometric_graph(50, 0.25, p_dist=p_dist)
+ assert len(G.edges) == 0
+
+ def test_pos_name(self):
+ G = nx.soft_random_geometric_graph(50, 0.25, seed=42, pos_name="coords")
+ assert all(len(d["coords"]) == 2 for n, d in G.nodes.items())
+
+
+def join(G, u, v, theta, alpha, metric):
+ """Returns ``True`` if and only if the nodes whose attributes are
+ ``du`` and ``dv`` should be joined, according to the threshold
+ condition for geographical threshold graphs.
+
+ ``G`` is an undirected NetworkX graph, and ``u`` and ``v`` are nodes
+ in that graph. The nodes must have node attributes ``'pos'`` and
+ ``'weight'``.
+
+ ``metric`` is a distance metric.
+ """
+ du, dv = G.nodes[u], G.nodes[v]
+ u_pos, v_pos = du["pos"], dv["pos"]
+ u_weight, v_weight = du["weight"], dv["weight"]
+ return (u_weight + v_weight) * metric(u_pos, v_pos) ** alpha >= theta
+
+
+class TestGeographicalThresholdGraph:
+ """Unit tests for :func:`~networkx.geographical_threshold_graph`"""
+
+ def test_number_of_nodes(self):
+ G = nx.geographical_threshold_graph(50, 100, seed=42)
+ assert len(G) == 50
+ G = nx.geographical_threshold_graph(range(50), 100, seed=42)
+ assert len(G) == 50
+
+ def test_distances(self):
+ """Tests that pairs of vertices adjacent if and only if their
+ distances meet the given threshold.
+ """
+ # Use the Euclidean metric and alpha = -2
+ # the default according to the documentation.
+ G = nx.geographical_threshold_graph(50, 10)
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must exceed the threshold.
+ if v in G[u]:
+ assert join(G, u, v, 10, -2, math.dist)
+ # Nonadjacent vertices must not exceed the threshold.
+ else:
+ assert not join(G, u, v, 10, -2, math.dist)
+
+ def test_metric(self):
+ """Tests for providing an alternate distance metric to the generator."""
+ # Use the L1 metric.
+ G = nx.geographical_threshold_graph(50, 10, metric=l1dist)
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must exceed the threshold.
+ if v in G[u]:
+ assert join(G, u, v, 10, -2, l1dist)
+ # Nonadjacent vertices must not exceed the threshold.
+ else:
+ assert not join(G, u, v, 10, -2, l1dist)
+
+ def test_p_dist_zero(self):
+ """Tests if p_dict = 0 returns disconnected graph with 0 edges"""
+
+ def p_dist(dist):
+ return 0
+
+ G = nx.geographical_threshold_graph(50, 1, p_dist=p_dist)
+ assert len(G.edges) == 0
+
+ def test_pos_weight_name(self):
+ gtg = nx.geographical_threshold_graph
+ G = gtg(50, 100, seed=42, pos_name="coords", weight_name="wt")
+ assert all(len(d["coords"]) == 2 for n, d in G.nodes.items())
+ assert all(d["wt"] > 0 for n, d in G.nodes.items())
+
+
+class TestWaxmanGraph:
+ """Unit tests for the :func:`~networkx.waxman_graph` function."""
+
+ def test_number_of_nodes_1(self):
+ G = nx.waxman_graph(50, 0.5, 0.1, seed=42)
+ assert len(G) == 50
+ G = nx.waxman_graph(range(50), 0.5, 0.1, seed=42)
+ assert len(G) == 50
+
+ def test_number_of_nodes_2(self):
+ G = nx.waxman_graph(50, 0.5, 0.1, L=1)
+ assert len(G) == 50
+ G = nx.waxman_graph(range(50), 0.5, 0.1, L=1)
+ assert len(G) == 50
+
+ def test_metric(self):
+ """Tests for providing an alternate distance metric to the generator."""
+ # Use the L1 metric.
+ G = nx.waxman_graph(50, 0.5, 0.1, metric=l1dist)
+ assert len(G) == 50
+
+ def test_pos_name(self):
+ G = nx.waxman_graph(50, 0.5, 0.1, seed=42, pos_name="coords")
+ assert all(len(d["coords"]) == 2 for n, d in G.nodes.items())
+
+
+class TestNavigableSmallWorldGraph:
+ def test_navigable_small_world(self):
+ G = nx.navigable_small_world_graph(5, p=1, q=0, seed=42)
+ gg = nx.grid_2d_graph(5, 5).to_directed()
+ assert nx.is_isomorphic(G, gg)
+
+ G = nx.navigable_small_world_graph(5, p=1, q=0, dim=3)
+ gg = nx.grid_graph([5, 5, 5]).to_directed()
+ assert nx.is_isomorphic(G, gg)
+
+ G = nx.navigable_small_world_graph(5, p=1, q=0, dim=1)
+ gg = nx.grid_graph([5]).to_directed()
+ assert nx.is_isomorphic(G, gg)
+
+ def test_invalid_diameter_value(self):
+ with pytest.raises(nx.NetworkXException, match=".*p must be >= 1"):
+ nx.navigable_small_world_graph(5, p=0, q=0, dim=1)
+
+ def test_invalid_long_range_connections_value(self):
+ with pytest.raises(nx.NetworkXException, match=".*q must be >= 0"):
+ nx.navigable_small_world_graph(5, p=1, q=-1, dim=1)
+
+ def test_invalid_exponent_for_decaying_probability_value(self):
+ with pytest.raises(nx.NetworkXException, match=".*r must be >= 0"):
+ nx.navigable_small_world_graph(5, p=1, q=0, r=-1, dim=1)
+
+ def test_r_between_0_and_1(self):
+ """Smoke test for radius in range [0, 1]"""
+ # q=0 means no long-range connections
+ G = nx.navigable_small_world_graph(3, p=1, q=0, r=0.5, dim=2, seed=42)
+ expected = nx.grid_2d_graph(3, 3, create_using=nx.DiGraph)
+ assert nx.utils.graphs_equal(G, expected)
+
+ @pytest.mark.parametrize("seed", range(2478, 2578, 10))
+ def test_r_general_scaling(self, seed):
+ """The probability of adding a long-range edge scales with `1 / dist**r`,
+ so a navigable_small_world graph created with r < 1 should generally
+ result in more edges than a navigable_small_world graph with r >= 1
+ (for 0 < q << n).
+
+ N.B. this is probabilistic, so this test may not hold for all seeds."""
+ G1 = nx.navigable_small_world_graph(7, q=3, r=0.5, seed=seed)
+ G2 = nx.navigable_small_world_graph(7, q=3, r=1, seed=seed)
+ G3 = nx.navigable_small_world_graph(7, q=3, r=2, seed=seed)
+ assert G1.number_of_edges() > G2.number_of_edges()
+ assert G2.number_of_edges() > G3.number_of_edges()
+
+
+class TestThresholdedRandomGeometricGraph:
+ """Unit tests for :func:`~networkx.thresholded_random_geometric_graph`"""
+
+ def test_number_of_nodes(self):
+ G = nx.thresholded_random_geometric_graph(50, 0.2, 0.1, seed=42)
+ assert len(G) == 50
+ G = nx.thresholded_random_geometric_graph(range(50), 0.2, 0.1, seed=42)
+ assert len(G) == 50
+
+ def test_distances(self):
+ """Tests that pairs of vertices adjacent if and only if they are
+ within the prescribed radius.
+ """
+ # Use the Euclidean metric, the default according to the
+ # documentation.
+ G = nx.thresholded_random_geometric_graph(50, 0.25, 0.1, seed=42)
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert math.dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_p(self):
+ """Tests for providing an alternate distance metric to the generator."""
+
+ # Use the L1 metric.
+ def dist(x, y):
+ return sum(abs(a - b) for a, b in zip(x, y))
+
+ G = nx.thresholded_random_geometric_graph(50, 0.25, 0.1, p=1, seed=42)
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_node_names(self):
+ """Tests using values other than sequential numbers as node IDs."""
+ import string
+
+ nodes = list(string.ascii_lowercase)
+ G = nx.thresholded_random_geometric_graph(nodes, 0.25, 0.1, seed=42)
+ assert len(G) == len(nodes)
+
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert math.dist(G.nodes[u]["pos"], G.nodes[v]["pos"]) <= 0.25
+
+ def test_theta(self):
+ """Tests that pairs of vertices adjacent if and only if their sum
+ weights exceeds the threshold parameter theta.
+ """
+ G = nx.thresholded_random_geometric_graph(50, 0.25, 0.1, seed=42)
+
+ for u, v in combinations(G, 2):
+ # Adjacent vertices must be within the given distance.
+ if v in G[u]:
+ assert (G.nodes[u]["weight"] + G.nodes[v]["weight"]) >= 0.1
+
+ def test_pos_name(self):
+ trgg = nx.thresholded_random_geometric_graph
+ G = trgg(50, 0.25, 0.1, seed=42, pos_name="p", weight_name="wt")
+ assert all(len(d["p"]) == 2 for n, d in G.nodes.items())
+ assert all(d["wt"] > 0 for n, d in G.nodes.items())
+
+
+def test_geometric_edges_pos_attribute():
+ G = nx.Graph()
+ G.add_nodes_from(
+ [
+ (0, {"position": (0, 0)}),
+ (1, {"position": (0, 1)}),
+ (2, {"position": (1, 0)}),
+ ]
+ )
+ expected_edges = [(0, 1), (0, 2)]
+ assert expected_edges == nx.geometric_edges(G, radius=1, pos_name="position")
+
+
+def test_geometric_edges_raises_no_pos():
+ G = nx.path_graph(3)
+ msg = "all nodes. must have a '"
+ with pytest.raises(nx.NetworkXError, match=msg):
+ nx.geometric_edges(G, radius=1)
+
+
+def test_number_of_nodes_S1():
+ G = nx.geometric_soft_configuration_graph(
+ beta=1.5, n=100, gamma=2.7, mean_degree=10, seed=42
+ )
+ assert len(G) == 100
+
+
+def test_set_attributes_S1():
+ G = nx.geometric_soft_configuration_graph(
+ beta=1.5, n=100, gamma=2.7, mean_degree=10, seed=42
+ )
+ kappas = nx.get_node_attributes(G, "kappa")
+ assert len(kappas) == 100
+ thetas = nx.get_node_attributes(G, "theta")
+ assert len(thetas) == 100
+ radii = nx.get_node_attributes(G, "radius")
+ assert len(radii) == 100
+
+
+def test_mean_kappas_mean_degree_S1():
+ G = nx.geometric_soft_configuration_graph(
+ beta=2.5, n=50, gamma=2.7, mean_degree=10, seed=8023
+ )
+
+ kappas = nx.get_node_attributes(G, "kappa")
+ mean_kappas = sum(kappas.values()) / len(kappas)
+ assert math.fabs(mean_kappas - 10) < 0.5
+
+ degrees = dict(G.degree())
+ mean_degree = sum(degrees.values()) / len(degrees)
+ assert math.fabs(mean_degree - 10) < 1
+
+
+def test_dict_kappas_S1():
+ kappas = {i: 10 for i in range(1000)}
+ G = nx.geometric_soft_configuration_graph(beta=1, kappas=kappas)
+ assert len(G) == 1000
+ kappas = nx.get_node_attributes(G, "kappa")
+ assert all(kappa == 10 for kappa in kappas.values())
+
+
+def test_beta_clustering_S1():
+ G1 = nx.geometric_soft_configuration_graph(
+ beta=1.5, n=100, gamma=3.5, mean_degree=10, seed=42
+ )
+ G2 = nx.geometric_soft_configuration_graph(
+ beta=3.0, n=100, gamma=3.5, mean_degree=10, seed=42
+ )
+ assert nx.average_clustering(G1) < nx.average_clustering(G2)
+
+
+def test_wrong_parameters_S1():
+ with pytest.raises(
+ nx.NetworkXError,
+ match="Please provide either kappas, or all 3 of: n, gamma and mean_degree.",
+ ):
+ G = nx.geometric_soft_configuration_graph(
+ beta=1.5, gamma=3.5, mean_degree=10, seed=42
+ )
+
+ with pytest.raises(
+ nx.NetworkXError,
+ match="When kappas is input, n, gamma and mean_degree must not be.",
+ ):
+ kappas = {i: 10 for i in range(1000)}
+ G = nx.geometric_soft_configuration_graph(
+ beta=1.5, kappas=kappas, gamma=2.3, seed=42
+ )
+
+ with pytest.raises(
+ nx.NetworkXError,
+ match="Please provide either kappas, or all 3 of: n, gamma and mean_degree.",
+ ):
+ G = nx.geometric_soft_configuration_graph(beta=1.5, seed=42)
+
+
+def test_negative_beta_S1():
+ with pytest.raises(
+ nx.NetworkXError, match="The parameter beta cannot be smaller or equal to 0."
+ ):
+ G = nx.geometric_soft_configuration_graph(
+ beta=-1, n=100, gamma=2.3, mean_degree=10, seed=42
+ )
+
+
+def test_non_zero_clustering_beta_lower_one_S1():
+ G = nx.geometric_soft_configuration_graph(
+ beta=0.5, n=100, gamma=3.5, mean_degree=10, seed=42
+ )
+ assert nx.average_clustering(G) > 0
+
+
+def test_mean_degree_influence_on_connectivity_S1():
+ low_mean_degree = 2
+ high_mean_degree = 20
+ G_low = nx.geometric_soft_configuration_graph(
+ beta=1.2, n=100, gamma=2.7, mean_degree=low_mean_degree, seed=42
+ )
+ G_high = nx.geometric_soft_configuration_graph(
+ beta=1.2, n=100, gamma=2.7, mean_degree=high_mean_degree, seed=42
+ )
+ assert nx.number_connected_components(G_low) > nx.number_connected_components(
+ G_high
+ )
+
+
+def test_compare_mean_kappas_different_gammas_S1():
+ G1 = nx.geometric_soft_configuration_graph(
+ beta=1.5, n=20, gamma=2.7, mean_degree=5, seed=42
+ )
+ G2 = nx.geometric_soft_configuration_graph(
+ beta=1.5, n=20, gamma=3.5, mean_degree=5, seed=42
+ )
+ kappas1 = nx.get_node_attributes(G1, "kappa")
+ mean_kappas1 = sum(kappas1.values()) / len(kappas1)
+ kappas2 = nx.get_node_attributes(G2, "kappa")
+ mean_kappas2 = sum(kappas2.values()) / len(kappas2)
+ assert math.fabs(mean_kappas1 - mean_kappas2) < 1
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_harary_graph.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_harary_graph.py
new file mode 100644
index 0000000000000000000000000000000000000000..8a0142df2a4340bc81d7dc25f05ea5d57e8f2d16
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_harary_graph.py
@@ -0,0 +1,133 @@
+"""Unit tests for the :mod:`networkx.generators.harary_graph` module."""
+
+import pytest
+
+import networkx as nx
+from networkx.algorithms.isomorphism.isomorph import is_isomorphic
+from networkx.generators.harary_graph import hkn_harary_graph, hnm_harary_graph
+
+
+class TestHararyGraph:
+ """
+ Suppose n nodes, m >= n-1 edges, d = 2m // n, r = 2m % n
+ """
+
+ def test_hnm_harary_graph(self):
+ # When d is even and r = 0, the hnm_harary_graph(n,m) is
+ # the circulant_graph(n, list(range(1,d/2+1)))
+ for n, m in [(5, 5), (6, 12), (7, 14)]:
+ G1 = hnm_harary_graph(n, m)
+ d = 2 * m // n
+ G2 = nx.circulant_graph(n, list(range(1, d // 2 + 1)))
+ assert is_isomorphic(G1, G2)
+
+ # When d is even and r > 0, the hnm_harary_graph(n,m) is
+ # the circulant_graph(n, list(range(1,d/2+1)))
+ # with r edges added arbitrarily
+ for n, m in [(5, 7), (6, 13), (7, 16)]:
+ G1 = hnm_harary_graph(n, m)
+ d = 2 * m // n
+ G2 = nx.circulant_graph(n, list(range(1, d // 2 + 1)))
+ assert set(G2.edges) < set(G1.edges)
+ assert G1.number_of_edges() == m
+
+ # When d is odd and n is even and r = 0, the hnm_harary_graph(n,m)
+ # is the circulant_graph(n, list(range(1,(d+1)/2) plus [n//2])
+ for n, m in [(6, 9), (8, 12), (10, 15)]:
+ G1 = hnm_harary_graph(n, m)
+ d = 2 * m // n
+ L = list(range(1, (d + 1) // 2))
+ L.append(n // 2)
+ G2 = nx.circulant_graph(n, L)
+ assert is_isomorphic(G1, G2)
+
+ # When d is odd and n is even and r > 0, the hnm_harary_graph(n,m)
+ # is the circulant_graph(n, list(range(1,(d+1)/2) plus [n//2])
+ # with r edges added arbitrarily
+ for n, m in [(6, 10), (8, 13), (10, 17)]:
+ G1 = hnm_harary_graph(n, m)
+ d = 2 * m // n
+ L = list(range(1, (d + 1) // 2))
+ L.append(n // 2)
+ G2 = nx.circulant_graph(n, L)
+ assert set(G2.edges) < set(G1.edges)
+ assert G1.number_of_edges() == m
+
+ # When d is odd and n is odd, the hnm_harary_graph(n,m) is
+ # the circulant_graph(n, list(range(1,(d+1)/2))
+ # with m - n*(d-1)/2 edges added arbitrarily
+ for n, m in [(5, 4), (7, 12), (9, 14)]:
+ G1 = hnm_harary_graph(n, m)
+ d = 2 * m // n
+ L = list(range(1, (d + 1) // 2))
+ G2 = nx.circulant_graph(n, L)
+ assert set(G2.edges) < set(G1.edges)
+ assert G1.number_of_edges() == m
+
+ # Raise NetworkXError if n<1
+ n = 0
+ m = 0
+ pytest.raises(nx.NetworkXError, hnm_harary_graph, n, m)
+
+ # Raise NetworkXError if m < n-1
+ n = 6
+ m = 4
+ pytest.raises(nx.NetworkXError, hnm_harary_graph, n, m)
+
+ # Raise NetworkXError if m > n(n-1)/2
+ n = 6
+ m = 16
+ pytest.raises(nx.NetworkXError, hnm_harary_graph, n, m)
+
+ """
+ Suppose connectivity k, number of nodes n
+ """
+
+ def test_hkn_harary_graph(self):
+ # When k == 1, the hkn_harary_graph(k,n) is
+ # the path_graph(n)
+ for k, n in [(1, 6), (1, 7)]:
+ G1 = hkn_harary_graph(k, n)
+ G2 = nx.path_graph(n)
+ assert is_isomorphic(G1, G2)
+
+ # When k is even, the hkn_harary_graph(k,n) is
+ # the circulant_graph(n, list(range(1,k/2+1)))
+ for k, n in [(2, 6), (2, 7), (4, 6), (4, 7)]:
+ G1 = hkn_harary_graph(k, n)
+ G2 = nx.circulant_graph(n, list(range(1, k // 2 + 1)))
+ assert is_isomorphic(G1, G2)
+
+ # When k is odd and n is even, the hkn_harary_graph(k,n) is
+ # the circulant_graph(n, list(range(1,(k+1)/2)) plus [n/2])
+ for k, n in [(3, 6), (5, 8), (7, 10)]:
+ G1 = hkn_harary_graph(k, n)
+ L = list(range(1, (k + 1) // 2))
+ L.append(n // 2)
+ G2 = nx.circulant_graph(n, L)
+ assert is_isomorphic(G1, G2)
+
+ # When k is odd and n is odd, the hkn_harary_graph(k,n) is
+ # the circulant_graph(n, list(range(1,(k+1)/2))) with
+ # n//2+1 edges added between node i and node i+n//2+1
+ for k, n in [(3, 5), (5, 9), (7, 11)]:
+ G1 = hkn_harary_graph(k, n)
+ G2 = nx.circulant_graph(n, list(range(1, (k + 1) // 2)))
+ eSet1 = set(G1.edges)
+ eSet2 = set(G2.edges)
+ eSet3 = set()
+ half = n // 2
+ for i in range(half + 1):
+ # add half+1 edges between i and i+half
+ eSet3.add((i, (i + half) % n))
+ assert eSet1 == eSet2 | eSet3
+
+ # Raise NetworkXError if k<1
+ k = 0
+ n = 0
+ pytest.raises(nx.NetworkXError, hkn_harary_graph, k, n)
+
+ # Raise NetworkXError if ndegree_count[1]*degree_count[4]
+ joint_degrees_3 = {
+ 1: {4: 2},
+ 2: {2: 2, 3: 2, 4: 2},
+ 3: {2: 2, 4: 1},
+ 4: {1: 2, 2: 2, 3: 1},
+ }
+ assert not is_valid_joint_degree(joint_degrees_3)
+
+ # test condition 5
+ # joint_degrees_5[1][1] not even
+ joint_degrees_5 = {1: {1: 9}}
+ assert not is_valid_joint_degree(joint_degrees_5)
+
+
+def test_joint_degree_graph(ntimes=10):
+ for _ in range(ntimes):
+ seed = int(time.time())
+
+ n, m, p = 20, 10, 1
+ # generate random graph with model powerlaw_cluster and calculate
+ # its joint degree
+ g = powerlaw_cluster_graph(n, m, p, seed=seed)
+ joint_degrees_g = degree_mixing_dict(g, normalized=False)
+
+ # generate simple undirected graph with given joint degree
+ # joint_degrees_g
+ G = joint_degree_graph(joint_degrees_g)
+ joint_degrees_G = degree_mixing_dict(G, normalized=False)
+
+ # assert that the given joint degree is equal to the generated
+ # graph's joint degree
+ assert joint_degrees_g == joint_degrees_G
+
+
+def test_is_valid_directed_joint_degree():
+ in_degrees = [0, 1, 1, 2]
+ out_degrees = [1, 1, 1, 1]
+ nkk = {1: {1: 2, 2: 2}}
+ assert is_valid_directed_joint_degree(in_degrees, out_degrees, nkk)
+
+ # not realizable, values are not integers.
+ nkk = {1: {1: 1.5, 2: 2.5}}
+ assert not is_valid_directed_joint_degree(in_degrees, out_degrees, nkk)
+
+ # not realizable, number of edges between 1-2 are insufficient.
+ nkk = {1: {1: 2, 2: 1}}
+ assert not is_valid_directed_joint_degree(in_degrees, out_degrees, nkk)
+
+ # not realizable, in/out degree sequences have different number of nodes.
+ out_degrees = [1, 1, 1]
+ nkk = {1: {1: 2, 2: 2}}
+ assert not is_valid_directed_joint_degree(in_degrees, out_degrees, nkk)
+
+ # not realizable, degree sequences have fewer than required nodes.
+ in_degrees = [0, 1, 2]
+ assert not is_valid_directed_joint_degree(in_degrees, out_degrees, nkk)
+
+
+def test_directed_joint_degree_graph(n=15, m=100, ntimes=1000):
+ for _ in range(ntimes):
+ # generate gnm random graph and calculate its joint degree.
+ g = gnm_random_graph(n, m, None, directed=True)
+
+ # in-degree sequence of g as a list of integers.
+ in_degrees = list(dict(g.in_degree()).values())
+ # out-degree sequence of g as a list of integers.
+ out_degrees = list(dict(g.out_degree()).values())
+ nkk = degree_mixing_dict(g)
+
+ # generate simple directed graph with given degree sequence and joint
+ # degree matrix.
+ G = directed_joint_degree_graph(in_degrees, out_degrees, nkk)
+
+ # assert degree sequence correctness.
+ assert in_degrees == list(dict(G.in_degree()).values())
+ assert out_degrees == list(dict(G.out_degree()).values())
+ # assert joint degree matrix correctness.
+ assert nkk == degree_mixing_dict(G)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_lattice.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_lattice.py
new file mode 100644
index 0000000000000000000000000000000000000000..5012324a535297bb1a6997dc1f60b332c2aa0752
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_lattice.py
@@ -0,0 +1,246 @@
+"""Unit tests for the :mod:`networkx.generators.lattice` module."""
+
+from itertools import product
+
+import pytest
+
+import networkx as nx
+from networkx.utils import edges_equal
+
+
+class TestGrid2DGraph:
+ """Unit tests for :func:`networkx.generators.lattice.grid_2d_graph`"""
+
+ def test_number_of_vertices(self):
+ m, n = 5, 6
+ G = nx.grid_2d_graph(m, n)
+ assert len(G) == m * n
+
+ def test_degree_distribution(self):
+ m, n = 5, 6
+ G = nx.grid_2d_graph(m, n)
+ expected_histogram = [0, 0, 4, 2 * (m + n) - 8, (m - 2) * (n - 2)]
+ assert nx.degree_histogram(G) == expected_histogram
+
+ def test_directed(self):
+ m, n = 5, 6
+ G = nx.grid_2d_graph(m, n)
+ H = nx.grid_2d_graph(m, n, create_using=nx.DiGraph())
+ assert H.succ == G.adj
+ assert H.pred == G.adj
+
+ def test_multigraph(self):
+ m, n = 5, 6
+ G = nx.grid_2d_graph(m, n)
+ H = nx.grid_2d_graph(m, n, create_using=nx.MultiGraph())
+ assert list(H.edges()) == list(G.edges())
+
+ def test_periodic(self):
+ G = nx.grid_2d_graph(0, 0, periodic=True)
+ assert dict(G.degree()) == {}
+
+ for m, n, H in [
+ (2, 2, nx.cycle_graph(4)),
+ (1, 7, nx.cycle_graph(7)),
+ (7, 1, nx.cycle_graph(7)),
+ (2, 5, nx.circular_ladder_graph(5)),
+ (5, 2, nx.circular_ladder_graph(5)),
+ (2, 4, nx.cubical_graph()),
+ (4, 2, nx.cubical_graph()),
+ ]:
+ G = nx.grid_2d_graph(m, n, periodic=True)
+ assert nx.could_be_isomorphic(G, H)
+
+ def test_periodic_iterable(self):
+ m, n = 3, 7
+ for a, b in product([0, 1], [0, 1]):
+ G = nx.grid_2d_graph(m, n, periodic=(a, b))
+ assert G.number_of_nodes() == m * n
+ assert G.number_of_edges() == (m + a - 1) * n + (n + b - 1) * m
+
+ def test_periodic_directed(self):
+ G = nx.grid_2d_graph(4, 2, periodic=True)
+ H = nx.grid_2d_graph(4, 2, periodic=True, create_using=nx.DiGraph())
+ assert H.succ == G.adj
+ assert H.pred == G.adj
+
+ def test_periodic_multigraph(self):
+ G = nx.grid_2d_graph(4, 2, periodic=True)
+ H = nx.grid_2d_graph(4, 2, periodic=True, create_using=nx.MultiGraph())
+ assert list(G.edges()) == list(H.edges())
+
+ def test_exceptions(self):
+ pytest.raises(nx.NetworkXError, nx.grid_2d_graph, -3, 2)
+ pytest.raises(nx.NetworkXError, nx.grid_2d_graph, 3, -2)
+ pytest.raises(TypeError, nx.grid_2d_graph, 3.3, 2)
+ pytest.raises(TypeError, nx.grid_2d_graph, 3, 2.2)
+
+ def test_node_input(self):
+ G = nx.grid_2d_graph(4, 2, periodic=True)
+ H = nx.grid_2d_graph(range(4), range(2), periodic=True)
+ assert nx.is_isomorphic(H, G)
+ H = nx.grid_2d_graph("abcd", "ef", periodic=True)
+ assert nx.is_isomorphic(H, G)
+ G = nx.grid_2d_graph(5, 6)
+ H = nx.grid_2d_graph(range(5), range(6))
+ assert edges_equal(H, G)
+
+
+class TestGridGraph:
+ """Unit tests for :func:`networkx.generators.lattice.grid_graph`"""
+
+ def test_grid_graph(self):
+ """grid_graph([n,m]) is a connected simple graph with the
+ following properties:
+ number_of_nodes = n*m
+ degree_histogram = [0,0,4,2*(n+m)-8,(n-2)*(m-2)]
+ """
+ for n, m in [(3, 5), (5, 3), (4, 5), (5, 4)]:
+ dim = [n, m]
+ g = nx.grid_graph(dim)
+ assert len(g) == n * m
+ assert nx.degree_histogram(g) == [
+ 0,
+ 0,
+ 4,
+ 2 * (n + m) - 8,
+ (n - 2) * (m - 2),
+ ]
+
+ for n, m in [(1, 5), (5, 1)]:
+ dim = [n, m]
+ g = nx.grid_graph(dim)
+ assert len(g) == n * m
+ assert nx.is_isomorphic(g, nx.path_graph(5))
+
+ # mg = nx.grid_graph([n,m], create_using=MultiGraph())
+ # assert_equal(mg.edges(), g.edges())
+
+ def test_node_input(self):
+ G = nx.grid_graph([range(7, 9), range(3, 6)])
+ assert len(G) == 2 * 3
+ assert nx.is_isomorphic(G, nx.grid_graph([2, 3]))
+
+ def test_periodic_iterable(self):
+ m, n, k = 3, 7, 5
+ for a, b, c in product([0, 1], [0, 1], [0, 1]):
+ G = nx.grid_graph([m, n, k], periodic=(a, b, c))
+ num_e = (m + a - 1) * n * k + (n + b - 1) * m * k + (k + c - 1) * m * n
+ assert G.number_of_nodes() == m * n * k
+ assert G.number_of_edges() == num_e
+
+
+class TestHypercubeGraph:
+ """Unit tests for :func:`networkx.generators.lattice.hypercube_graph`"""
+
+ def test_special_cases(self):
+ for n, H in [
+ (0, nx.null_graph()),
+ (1, nx.path_graph(2)),
+ (2, nx.cycle_graph(4)),
+ (3, nx.cubical_graph()),
+ ]:
+ G = nx.hypercube_graph(n)
+ assert nx.could_be_isomorphic(G, H)
+
+ def test_degree_distribution(self):
+ for n in range(1, 10):
+ G = nx.hypercube_graph(n)
+ expected_histogram = [0] * n + [2**n]
+ assert nx.degree_histogram(G) == expected_histogram
+
+
+class TestTriangularLatticeGraph:
+ "Tests for :func:`networkx.generators.lattice.triangular_lattice_graph`"
+
+ def test_lattice_points(self):
+ """Tests that the graph is really a triangular lattice."""
+ for m, n in [(2, 3), (2, 2), (2, 1), (3, 3), (3, 2), (3, 4)]:
+ G = nx.triangular_lattice_graph(m, n)
+ N = (n + 1) // 2
+ assert len(G) == (m + 1) * (1 + N) - (n % 2) * ((m + 1) // 2)
+ for i, j in G.nodes():
+ nbrs = G[(i, j)]
+ if i < N:
+ assert (i + 1, j) in nbrs
+ if j < m:
+ assert (i, j + 1) in nbrs
+ if j < m and (i > 0 or j % 2) and (i < N or (j + 1) % 2):
+ assert (i + 1, j + 1) in nbrs or (i - 1, j + 1) in nbrs
+
+ def test_directed(self):
+ """Tests for creating a directed triangular lattice."""
+ G = nx.triangular_lattice_graph(3, 4, create_using=nx.Graph())
+ H = nx.triangular_lattice_graph(3, 4, create_using=nx.DiGraph())
+ assert H.is_directed()
+ for u, v in H.edges():
+ assert v[1] >= u[1]
+ if v[1] == u[1]:
+ assert v[0] > u[0]
+
+ def test_multigraph(self):
+ """Tests for creating a triangular lattice multigraph."""
+ G = nx.triangular_lattice_graph(3, 4, create_using=nx.Graph())
+ H = nx.triangular_lattice_graph(3, 4, create_using=nx.MultiGraph())
+ assert list(H.edges()) == list(G.edges())
+
+ def test_periodic(self):
+ G = nx.triangular_lattice_graph(4, 6, periodic=True)
+ assert len(G) == 12
+ assert G.size() == 36
+ # all degrees are 6
+ assert len([n for n, d in G.degree() if d != 6]) == 0
+ G = nx.triangular_lattice_graph(5, 7, periodic=True)
+ TLG = nx.triangular_lattice_graph
+ pytest.raises(nx.NetworkXError, TLG, 2, 4, periodic=True)
+ pytest.raises(nx.NetworkXError, TLG, 4, 4, periodic=True)
+ pytest.raises(nx.NetworkXError, TLG, 2, 6, periodic=True)
+
+
+class TestHexagonalLatticeGraph:
+ "Tests for :func:`networkx.generators.lattice.hexagonal_lattice_graph`"
+
+ def test_lattice_points(self):
+ """Tests that the graph is really a hexagonal lattice."""
+ for m, n in [(4, 5), (4, 4), (4, 3), (3, 2), (3, 3), (3, 5)]:
+ G = nx.hexagonal_lattice_graph(m, n)
+ assert len(G) == 2 * (m + 1) * (n + 1) - 2
+ C_6 = nx.cycle_graph(6)
+ hexagons = [
+ [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)],
+ [(0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4)],
+ [(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3)],
+ [(2, 0), (2, 1), (2, 2), (3, 0), (3, 1), (3, 2)],
+ [(2, 2), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4)],
+ ]
+ for hexagon in hexagons:
+ assert nx.is_isomorphic(G.subgraph(hexagon), C_6)
+
+ def test_directed(self):
+ """Tests for creating a directed hexagonal lattice."""
+ G = nx.hexagonal_lattice_graph(3, 5, create_using=nx.Graph())
+ H = nx.hexagonal_lattice_graph(3, 5, create_using=nx.DiGraph())
+ assert H.is_directed()
+ pos = nx.get_node_attributes(H, "pos")
+ for u, v in H.edges():
+ assert pos[v][1] >= pos[u][1]
+ if pos[v][1] == pos[u][1]:
+ assert pos[v][0] > pos[u][0]
+
+ def test_multigraph(self):
+ """Tests for creating a hexagonal lattice multigraph."""
+ G = nx.hexagonal_lattice_graph(3, 5, create_using=nx.Graph())
+ H = nx.hexagonal_lattice_graph(3, 5, create_using=nx.MultiGraph())
+ assert list(H.edges()) == list(G.edges())
+
+ def test_periodic(self):
+ G = nx.hexagonal_lattice_graph(4, 6, periodic=True)
+ assert len(G) == 48
+ assert G.size() == 72
+ # all degrees are 3
+ assert len([n for n, d in G.degree() if d != 3]) == 0
+ G = nx.hexagonal_lattice_graph(5, 8, periodic=True)
+ HLG = nx.hexagonal_lattice_graph
+ pytest.raises(nx.NetworkXError, HLG, 2, 7, periodic=True)
+ pytest.raises(nx.NetworkXError, HLG, 1, 4, periodic=True)
+ pytest.raises(nx.NetworkXError, HLG, 2, 1, periodic=True)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_line.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_line.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f5454ebee019fb27b61f72f1fdd81b6c927ba17
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_line.py
@@ -0,0 +1,309 @@
+import pytest
+
+import networkx as nx
+from networkx.generators import line
+from networkx.utils import edges_equal
+
+
+class TestGeneratorLine:
+ def test_star(self):
+ G = nx.star_graph(5)
+ L = nx.line_graph(G)
+ assert nx.is_isomorphic(L, nx.complete_graph(5))
+
+ def test_path(self):
+ G = nx.path_graph(5)
+ L = nx.line_graph(G)
+ assert nx.is_isomorphic(L, nx.path_graph(4))
+
+ def test_cycle(self):
+ G = nx.cycle_graph(5)
+ L = nx.line_graph(G)
+ assert nx.is_isomorphic(L, G)
+
+ def test_digraph1(self):
+ G = nx.DiGraph([(0, 1), (0, 2), (0, 3)])
+ L = nx.line_graph(G)
+ # no edge graph, but with nodes
+ assert L.adj == {(0, 1): {}, (0, 2): {}, (0, 3): {}}
+
+ def test_multigraph1(self):
+ G = nx.MultiGraph([(0, 1), (0, 1), (1, 0), (0, 2), (2, 0), (0, 3)])
+ L = nx.line_graph(G)
+ # no edge graph, but with nodes
+ assert edges_equal(
+ L.edges(),
+ [
+ ((0, 3, 0), (0, 1, 0)),
+ ((0, 3, 0), (0, 2, 0)),
+ ((0, 3, 0), (0, 2, 1)),
+ ((0, 3, 0), (0, 1, 1)),
+ ((0, 3, 0), (0, 1, 2)),
+ ((0, 1, 0), (0, 1, 1)),
+ ((0, 1, 0), (0, 2, 0)),
+ ((0, 1, 0), (0, 1, 2)),
+ ((0, 1, 0), (0, 2, 1)),
+ ((0, 1, 1), (0, 1, 2)),
+ ((0, 1, 1), (0, 2, 0)),
+ ((0, 1, 1), (0, 2, 1)),
+ ((0, 1, 2), (0, 2, 0)),
+ ((0, 1, 2), (0, 2, 1)),
+ ((0, 2, 0), (0, 2, 1)),
+ ],
+ )
+
+ def test_multigraph2(self):
+ G = nx.MultiGraph([(1, 2), (2, 1)])
+ L = nx.line_graph(G)
+ assert edges_equal(L.edges(), [((1, 2, 0), (1, 2, 1))])
+
+ def test_multidigraph1(self):
+ G = nx.MultiDiGraph([(1, 2), (2, 1)])
+ L = nx.line_graph(G)
+ assert edges_equal(L.edges(), [((1, 2, 0), (2, 1, 0)), ((2, 1, 0), (1, 2, 0))])
+
+ def test_multidigraph2(self):
+ G = nx.MultiDiGraph([(0, 1), (0, 1), (0, 1), (1, 2)])
+ L = nx.line_graph(G)
+ assert edges_equal(
+ L.edges(),
+ [((0, 1, 0), (1, 2, 0)), ((0, 1, 1), (1, 2, 0)), ((0, 1, 2), (1, 2, 0))],
+ )
+
+ def test_digraph2(self):
+ G = nx.DiGraph([(0, 1), (1, 2), (2, 3)])
+ L = nx.line_graph(G)
+ assert edges_equal(L.edges(), [((0, 1), (1, 2)), ((1, 2), (2, 3))])
+
+ def test_create1(self):
+ G = nx.DiGraph([(0, 1), (1, 2), (2, 3)])
+ L = nx.line_graph(G, create_using=nx.Graph())
+ assert edges_equal(L.edges(), [((0, 1), (1, 2)), ((1, 2), (2, 3))])
+
+ def test_create2(self):
+ G = nx.Graph([(0, 1), (1, 2), (2, 3)])
+ L = nx.line_graph(G, create_using=nx.DiGraph())
+ assert edges_equal(L.edges(), [((0, 1), (1, 2)), ((1, 2), (2, 3))])
+
+
+class TestGeneratorInverseLine:
+ def test_example(self):
+ G = nx.Graph()
+ G_edges = [
+ [1, 2],
+ [1, 3],
+ [1, 4],
+ [1, 5],
+ [2, 3],
+ [2, 5],
+ [2, 6],
+ [2, 7],
+ [3, 4],
+ [3, 5],
+ [6, 7],
+ [6, 8],
+ [7, 8],
+ ]
+ G.add_edges_from(G_edges)
+ H = nx.inverse_line_graph(G)
+ solution = nx.Graph()
+ solution_edges = [
+ ("a", "b"),
+ ("a", "c"),
+ ("a", "d"),
+ ("a", "e"),
+ ("c", "d"),
+ ("e", "f"),
+ ("e", "g"),
+ ("f", "g"),
+ ]
+ solution.add_edges_from(solution_edges)
+ assert nx.is_isomorphic(H, solution)
+
+ def test_example_2(self):
+ G = nx.Graph()
+ G_edges = [[1, 2], [1, 3], [2, 3], [3, 4], [3, 5], [4, 5]]
+ G.add_edges_from(G_edges)
+ H = nx.inverse_line_graph(G)
+ solution = nx.Graph()
+ solution_edges = [("a", "c"), ("b", "c"), ("c", "d"), ("d", "e"), ("d", "f")]
+ solution.add_edges_from(solution_edges)
+ assert nx.is_isomorphic(H, solution)
+
+ def test_pair(self):
+ G = nx.path_graph(2)
+ H = nx.inverse_line_graph(G)
+ solution = nx.path_graph(3)
+ assert nx.is_isomorphic(H, solution)
+
+ def test_line(self):
+ G = nx.path_graph(5)
+ solution = nx.path_graph(6)
+ H = nx.inverse_line_graph(G)
+ assert nx.is_isomorphic(H, solution)
+
+ def test_triangle_graph(self):
+ G = nx.complete_graph(3)
+ H = nx.inverse_line_graph(G)
+ alternative_solution = nx.Graph()
+ alternative_solution.add_edges_from([[0, 1], [0, 2], [0, 3]])
+ # there are two alternative inverse line graphs for this case
+ # so long as we get one of them the test should pass
+ assert nx.is_isomorphic(H, G) or nx.is_isomorphic(H, alternative_solution)
+
+ def test_cycle(self):
+ G = nx.cycle_graph(5)
+ H = nx.inverse_line_graph(G)
+ assert nx.is_isomorphic(H, G)
+
+ def test_empty(self):
+ G = nx.Graph()
+ H = nx.inverse_line_graph(G)
+ assert nx.is_isomorphic(H, nx.complete_graph(1))
+
+ def test_K1(self):
+ G = nx.complete_graph(1)
+ H = nx.inverse_line_graph(G)
+ solution = nx.path_graph(2)
+ assert nx.is_isomorphic(H, solution)
+
+ def test_edgeless_graph(self):
+ G = nx.empty_graph(5)
+ with pytest.raises(nx.NetworkXError, match="edgeless graph"):
+ nx.inverse_line_graph(G)
+
+ def test_selfloops_error(self):
+ G = nx.cycle_graph(4)
+ G.add_edge(0, 0)
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, G)
+
+ def test_non_line_graphs(self):
+ # Tests several known non-line graphs for impossibility
+ # Adapted from L.W.Beineke, "Characterizations of derived graphs"
+
+ # claw graph
+ claw = nx.star_graph(3)
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, claw)
+
+ # wheel graph with 6 nodes
+ wheel = nx.wheel_graph(6)
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, wheel)
+
+ # K5 with one edge remove
+ K5m = nx.complete_graph(5)
+ K5m.remove_edge(0, 1)
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, K5m)
+
+ # graph without any odd triangles (contains claw as induced subgraph)
+ G = nx.compose(nx.path_graph(2), nx.complete_bipartite_graph(2, 3))
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, G)
+
+ ## Variations on a diamond graph
+
+ # Diamond + 2 edges (+ "roof")
+ G = nx.diamond_graph()
+ G.add_edges_from([(4, 0), (5, 3)])
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, G)
+ G.add_edge(4, 5)
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, G)
+
+ # Diamond + 2 connected edges
+ G = nx.diamond_graph()
+ G.add_edges_from([(4, 0), (4, 3)])
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, G)
+
+ # Diamond + K3 + one edge (+ 2*K3)
+ G = nx.diamond_graph()
+ G.add_edges_from([(4, 0), (4, 1), (4, 2), (5, 3)])
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, G)
+ G.add_edges_from([(5, 1), (5, 2)])
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, G)
+
+ # 4 triangles
+ G = nx.diamond_graph()
+ G.add_edges_from([(4, 0), (4, 1), (5, 2), (5, 3)])
+ pytest.raises(nx.NetworkXError, nx.inverse_line_graph, G)
+
+ def test_wrong_graph_type(self):
+ G = nx.DiGraph()
+ G_edges = [[0, 1], [0, 2], [0, 3]]
+ G.add_edges_from(G_edges)
+ pytest.raises(nx.NetworkXNotImplemented, nx.inverse_line_graph, G)
+
+ G = nx.MultiGraph()
+ G_edges = [[0, 1], [0, 2], [0, 3]]
+ G.add_edges_from(G_edges)
+ pytest.raises(nx.NetworkXNotImplemented, nx.inverse_line_graph, G)
+
+ def test_line_inverse_line_complete(self):
+ G = nx.complete_graph(10)
+ H = nx.line_graph(G)
+ J = nx.inverse_line_graph(H)
+ assert nx.is_isomorphic(G, J)
+
+ def test_line_inverse_line_path(self):
+ G = nx.path_graph(10)
+ H = nx.line_graph(G)
+ J = nx.inverse_line_graph(H)
+ assert nx.is_isomorphic(G, J)
+
+ def test_line_inverse_line_hypercube(self):
+ G = nx.hypercube_graph(5)
+ H = nx.line_graph(G)
+ J = nx.inverse_line_graph(H)
+ assert nx.is_isomorphic(G, J)
+
+ def test_line_inverse_line_cycle(self):
+ G = nx.cycle_graph(10)
+ H = nx.line_graph(G)
+ J = nx.inverse_line_graph(H)
+ assert nx.is_isomorphic(G, J)
+
+ def test_line_inverse_line_star(self):
+ G = nx.star_graph(20)
+ H = nx.line_graph(G)
+ J = nx.inverse_line_graph(H)
+ assert nx.is_isomorphic(G, J)
+
+ def test_line_inverse_line_multipartite(self):
+ G = nx.complete_multipartite_graph(3, 4, 5)
+ H = nx.line_graph(G)
+ J = nx.inverse_line_graph(H)
+ assert nx.is_isomorphic(G, J)
+
+ def test_line_inverse_line_dgm(self):
+ G = nx.dorogovtsev_goltsev_mendes_graph(4)
+ H = nx.line_graph(G)
+ J = nx.inverse_line_graph(H)
+ assert nx.is_isomorphic(G, J)
+
+ def test_line_different_node_types(self):
+ G = nx.path_graph([1, 2, 3, "a", "b", "c"])
+ H = nx.line_graph(G)
+ J = nx.inverse_line_graph(H)
+ assert nx.is_isomorphic(G, J)
+
+
+class TestGeneratorPrivateFunctions:
+ def test_triangles_error(self):
+ G = nx.diamond_graph()
+ pytest.raises(nx.NetworkXError, line._triangles, G, (4, 0))
+ pytest.raises(nx.NetworkXError, line._triangles, G, (0, 3))
+
+ def test_odd_triangles_error(self):
+ G = nx.diamond_graph()
+ pytest.raises(nx.NetworkXError, line._odd_triangle, G, (0, 1, 4))
+ pytest.raises(nx.NetworkXError, line._odd_triangle, G, (0, 1, 3))
+
+ def test_select_starting_cell_error(self):
+ G = nx.diamond_graph()
+ pytest.raises(nx.NetworkXError, line._select_starting_cell, G, (4, 0))
+ pytest.raises(nx.NetworkXError, line._select_starting_cell, G, (0, 3))
+
+ def test_diamond_graph(self):
+ G = nx.diamond_graph()
+ for edge in G.edges:
+ cell = line._select_starting_cell(G, starting_edge=edge)
+ # Starting cell should always be one of the two triangles
+ assert len(cell) == 3
+ assert all(v in G[u] for u in cell for v in cell if u != v)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_mycielski.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_mycielski.py
new file mode 100644
index 0000000000000000000000000000000000000000..eb12b1412ad4559bb500a7125c8d65e6239c5fed
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_mycielski.py
@@ -0,0 +1,30 @@
+"""Unit tests for the :mod:`networkx.generators.mycielski` module."""
+
+import pytest
+
+import networkx as nx
+
+
+class TestMycielski:
+ def test_construction(self):
+ G = nx.path_graph(2)
+ M = nx.mycielskian(G)
+ assert nx.is_isomorphic(M, nx.cycle_graph(5))
+
+ def test_size(self):
+ G = nx.path_graph(2)
+ M = nx.mycielskian(G, 2)
+ assert len(M) == 11
+ assert M.size() == 20
+
+ def test_mycielski_graph_generator(self):
+ G = nx.mycielski_graph(1)
+ assert nx.is_isomorphic(G, nx.empty_graph(1))
+ G = nx.mycielski_graph(2)
+ assert nx.is_isomorphic(G, nx.path_graph(2))
+ G = nx.mycielski_graph(3)
+ assert nx.is_isomorphic(G, nx.cycle_graph(5))
+ G = nx.mycielski_graph(4)
+ assert nx.is_isomorphic(G, nx.mycielskian(nx.cycle_graph(5)))
+ with pytest.raises(nx.NetworkXError, match="must satisfy n >= 1"):
+ nx.mycielski_graph(0)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_nonisomorphic_trees.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_nonisomorphic_trees.py
new file mode 100644
index 0000000000000000000000000000000000000000..c73d44aeb2e8c0eb2f2173ae56adeccb97c10595
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_nonisomorphic_trees.py
@@ -0,0 +1,68 @@
+"""
+Unit tests for WROM algorithm generator in generators/nonisomorphic_trees.py
+"""
+
+import pytest
+
+import networkx as nx
+from networkx.utils import edges_equal
+
+
+class TestGeneratorNonIsomorphicTrees:
+ def test_tree_structure(self):
+ # test for tree structure for nx.nonisomorphic_trees()
+ def f(x):
+ return list(nx.nonisomorphic_trees(x))
+
+ for i in f(6):
+ assert nx.is_tree(i)
+ for i in f(8):
+ assert nx.is_tree(i)
+
+ def test_nonisomorphism(self):
+ # test for nonisomorphism of trees for nx.nonisomorphic_trees()
+ def f(x):
+ return list(nx.nonisomorphic_trees(x))
+
+ trees = f(6)
+ for i in range(len(trees)):
+ for j in range(i + 1, len(trees)):
+ assert not nx.is_isomorphic(trees[i], trees[j])
+ trees = f(8)
+ for i in range(len(trees)):
+ for j in range(i + 1, len(trees)):
+ assert not nx.is_isomorphic(trees[i], trees[j])
+
+ def test_number_of_nonisomorphic_trees(self):
+ # http://oeis.org/A000055
+ assert nx.number_of_nonisomorphic_trees(2) == 1
+ assert nx.number_of_nonisomorphic_trees(3) == 1
+ assert nx.number_of_nonisomorphic_trees(4) == 2
+ assert nx.number_of_nonisomorphic_trees(5) == 3
+ assert nx.number_of_nonisomorphic_trees(6) == 6
+ assert nx.number_of_nonisomorphic_trees(7) == 11
+ assert nx.number_of_nonisomorphic_trees(8) == 23
+
+ def test_nonisomorphic_trees(self):
+ def f(x):
+ return list(nx.nonisomorphic_trees(x))
+
+ assert edges_equal(f(3)[0].edges(), [(0, 1), (0, 2)])
+ assert edges_equal(f(4)[0].edges(), [(0, 1), (0, 3), (1, 2)])
+ assert edges_equal(f(4)[1].edges(), [(0, 1), (0, 2), (0, 3)])
+
+ def test_nonisomorphic_trees_matrix(self):
+ trees_2 = [[[0, 1], [1, 0]]]
+ with pytest.deprecated_call():
+ assert list(nx.nonisomorphic_trees(2, create="matrix")) == trees_2
+
+ trees_3 = [[[0, 1, 1], [1, 0, 0], [1, 0, 0]]]
+ with pytest.deprecated_call():
+ assert list(nx.nonisomorphic_trees(3, create="matrix")) == trees_3
+
+ trees_4 = [
+ [[0, 1, 0, 1], [1, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0]],
+ [[0, 1, 1, 1], [1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 0, 0]],
+ ]
+ with pytest.deprecated_call():
+ assert list(nx.nonisomorphic_trees(4, create="matrix")) == trees_4
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_random_clustered.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_random_clustered.py
new file mode 100644
index 0000000000000000000000000000000000000000..85066520ae59f1e9bec03327630276918d573fb2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_random_clustered.py
@@ -0,0 +1,33 @@
+import pytest
+
+import networkx as nx
+
+
+class TestRandomClusteredGraph:
+ def test_custom_joint_degree_sequence(self):
+ node = [1, 1, 1, 2, 1, 2, 0, 0]
+ tri = [0, 0, 0, 0, 0, 1, 1, 1]
+ joint_degree_sequence = zip(node, tri)
+ G = nx.random_clustered_graph(joint_degree_sequence)
+ assert G.number_of_nodes() == 8
+ assert G.number_of_edges() == 7
+
+ def test_tuple_joint_degree_sequence(self):
+ G = nx.random_clustered_graph([(1, 2), (2, 1), (1, 1), (1, 1), (1, 1), (2, 0)])
+ assert G.number_of_nodes() == 6
+ assert G.number_of_edges() == 10
+
+ def test_invalid_joint_degree_sequence_type(self):
+ with pytest.raises(nx.NetworkXError, match="Invalid degree sequence"):
+ nx.random_clustered_graph([[1, 1], [2, 1], [0, 1]])
+
+ def test_invalid_joint_degree_sequence_value(self):
+ with pytest.raises(nx.NetworkXError, match="Invalid degree sequence"):
+ nx.random_clustered_graph([[1, 1], [1, 2], [0, 1]])
+
+ def test_directed_graph_raises_error(self):
+ with pytest.raises(nx.NetworkXError, match="Directed Graph not supported"):
+ nx.random_clustered_graph(
+ [(1, 2), (2, 1), (1, 1), (1, 1), (1, 1), (2, 0)],
+ create_using=nx.DiGraph,
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_random_graphs.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_random_graphs.py
new file mode 100644
index 0000000000000000000000000000000000000000..3262e542bf3f082fc769e1d66b9d6e902ad5b9d0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_random_graphs.py
@@ -0,0 +1,478 @@
+"""Unit tests for the :mod:`networkx.generators.random_graphs` module."""
+
+import pytest
+
+import networkx as nx
+
+_gnp_generators = [
+ nx.gnp_random_graph,
+ nx.fast_gnp_random_graph,
+ nx.binomial_graph,
+ nx.erdos_renyi_graph,
+]
+
+
+@pytest.mark.parametrize("generator", _gnp_generators)
+@pytest.mark.parametrize("directed", (True, False))
+def test_gnp_generators_negative_edge_probability(generator, directed):
+ """If the edge probability `p` is <=0, the resulting graph should have no edges."""
+ G = generator(10, -1.1, directed=directed)
+ assert len(G) == 10
+ assert G.number_of_edges() == 0
+ assert G.is_directed() == directed
+
+
+@pytest.mark.parametrize("generator", _gnp_generators)
+@pytest.mark.parametrize(
+ ("directed", "expected_num_edges"),
+ [(False, 45), (True, 90)],
+)
+def test_gnp_generators_greater_than_1_edge_probability(
+ generator, directed, expected_num_edges
+):
+ """If the edge probability `p` is >=1, the resulting graph should be complete."""
+ G = generator(10, 1.1, directed=directed)
+ assert len(G) == 10
+ assert G.number_of_edges() == expected_num_edges
+ assert G.is_directed() == directed
+
+
+@pytest.mark.parametrize("generator", _gnp_generators)
+@pytest.mark.parametrize("directed", (True, False))
+def test_gnp_generators_basic(generator, directed):
+ """If the edge probability `p` is >0 and <1, test only the basic properties."""
+ G = generator(10, 0.1, directed=directed)
+ assert len(G) == 10
+ assert G.is_directed() == directed
+
+
+@pytest.mark.parametrize("generator", _gnp_generators)
+def test_gnp_generators_for_p_close_to_1(generator):
+ """If the edge probability `p` is close to 1, the resulting graph should have all edges."""
+ runs = 100
+ edges = sum(
+ generator(10, 0.99999, directed=True).number_of_edges() for _ in range(runs)
+ )
+ assert abs(edges / float(runs) - 90) <= runs * 2.0 / 100
+
+
+@pytest.mark.parametrize("generator", _gnp_generators)
+@pytest.mark.parametrize("p", (0.2, 0.8))
+@pytest.mark.parametrize("directed", (True, False))
+def test_gnp_generators_edge_probability(generator, p, directed):
+ """Test that gnp generators generate edges according to the their probability `p`."""
+ runs = 5000
+ n = 5
+ edge_counts = [[0] * n for _ in range(n)]
+ for i in range(runs):
+ G = generator(n, p, directed=directed)
+ for v, w in G.edges:
+ edge_counts[v][w] += 1
+ if not directed:
+ edge_counts[w][v] += 1
+ for v in range(n):
+ for w in range(n):
+ if v == w:
+ # There should be no loops
+ assert edge_counts[v][w] == 0
+ else:
+ # Each edge should have been generated with probability close to p
+ assert abs(edge_counts[v][w] / float(runs) - p) <= 0.03
+
+
+@pytest.mark.parametrize(
+ "generator", [nx.gnp_random_graph, nx.binomial_graph, nx.erdos_renyi_graph]
+)
+@pytest.mark.parametrize(
+ ("seed", "directed", "expected_num_edges"),
+ [(42, False, 1219), (42, True, 2454), (314, False, 1247), (314, True, 2476)],
+)
+def test_gnp_random_graph_aliases(generator, seed, directed, expected_num_edges):
+ """Test that aliases give the same result with the same seed."""
+ G = generator(100, 0.25, seed=seed, directed=directed)
+ assert len(G) == 100
+ assert G.number_of_edges() == expected_num_edges
+ assert G.is_directed() == directed
+
+
+class TestGeneratorsRandom:
+ def test_random_graph(self):
+ seed = 42
+ G = nx.gnm_random_graph(100, 20, seed)
+ G = nx.gnm_random_graph(100, 20, seed, directed=True)
+ G = nx.dense_gnm_random_graph(100, 20, seed)
+
+ G = nx.barabasi_albert_graph(100, 1, seed)
+ G = nx.barabasi_albert_graph(100, 3, seed)
+ assert G.number_of_edges() == (97 * 3)
+
+ G = nx.barabasi_albert_graph(100, 3, seed, nx.complete_graph(5))
+ assert G.number_of_edges() == (10 + 95 * 3)
+
+ G = nx.extended_barabasi_albert_graph(100, 1, 0, 0, seed)
+ assert G.number_of_edges() == 99
+ G = nx.extended_barabasi_albert_graph(100, 3, 0, 0, seed)
+ assert G.number_of_edges() == 97 * 3
+ G = nx.extended_barabasi_albert_graph(100, 1, 0, 0.5, seed)
+ assert G.number_of_edges() == 99
+ G = nx.extended_barabasi_albert_graph(100, 2, 0.5, 0, seed)
+ assert G.number_of_edges() > 100 * 3
+ assert G.number_of_edges() < 100 * 4
+
+ G = nx.extended_barabasi_albert_graph(100, 2, 0.3, 0.3, seed)
+ assert G.number_of_edges() > 100 * 2
+ assert G.number_of_edges() < 100 * 4
+
+ G = nx.powerlaw_cluster_graph(100, 1, 1.0, seed)
+ G = nx.powerlaw_cluster_graph(100, 3, 0.0, seed)
+ assert G.number_of_edges() == (97 * 3)
+
+ G = nx.random_regular_graph(10, 20, seed)
+
+ pytest.raises(nx.NetworkXError, nx.random_regular_graph, 3, 21)
+ pytest.raises(nx.NetworkXError, nx.random_regular_graph, 33, 21)
+
+ constructor = [(10, 20, 0.8), (20, 40, 0.8)]
+ G = nx.random_shell_graph(constructor, seed)
+
+ def is_caterpillar(g):
+ """
+ A tree is a caterpillar iff all nodes of degree >=3 are surrounded
+ by at most two nodes of degree two or greater.
+ ref: http://mathworld.wolfram.com/CaterpillarGraph.html
+ """
+ deg_over_3 = [n for n in g if g.degree(n) >= 3]
+ for n in deg_over_3:
+ nbh_deg_over_2 = [nbh for nbh in g.neighbors(n) if g.degree(nbh) >= 2]
+ if not len(nbh_deg_over_2) <= 2:
+ return False
+ return True
+
+ def is_lobster(g):
+ """
+ A tree is a lobster if it has the property that the removal of leaf
+ nodes leaves a caterpillar graph (Gallian 2007)
+ ref: http://mathworld.wolfram.com/LobsterGraph.html
+ """
+ non_leafs = [n for n in g if g.degree(n) > 1]
+ return is_caterpillar(g.subgraph(non_leafs))
+
+ G = nx.random_lobster(10, 0.1, 0.5, seed)
+ assert max(G.degree(n) for n in G.nodes()) > 3
+ assert is_lobster(G)
+ pytest.raises(nx.NetworkXError, nx.random_lobster, 10, 0.1, 1, seed)
+ pytest.raises(nx.NetworkXError, nx.random_lobster, 10, 1, 1, seed)
+ pytest.raises(nx.NetworkXError, nx.random_lobster, 10, 1, 0.5, seed)
+
+ # docstring says this should be a caterpillar
+ G = nx.random_lobster(10, 0.1, 0.0, seed)
+ assert is_caterpillar(G)
+
+ # difficult to find seed that requires few tries
+ seq = nx.random_powerlaw_tree_sequence(10, 3, seed=14, tries=1)
+ G = nx.random_powerlaw_tree(10, 3, seed=14, tries=1)
+
+ def test_dual_barabasi_albert(self, m1=1, m2=4, p=0.5):
+ """
+ Tests that the dual BA random graph generated behaves consistently.
+
+ Tests the exceptions are raised as expected.
+
+ The graphs generation are repeated several times to prevent lucky shots
+
+ """
+ seeds = [42, 314, 2718]
+ initial_graph = nx.complete_graph(10)
+
+ for seed in seeds:
+ # This should be BA with m = m1
+ BA1 = nx.barabasi_albert_graph(100, m1, seed)
+ DBA1 = nx.dual_barabasi_albert_graph(100, m1, m2, 1, seed)
+ assert BA1.edges() == DBA1.edges()
+
+ # This should be BA with m = m2
+ BA2 = nx.barabasi_albert_graph(100, m2, seed)
+ DBA2 = nx.dual_barabasi_albert_graph(100, m1, m2, 0, seed)
+ assert BA2.edges() == DBA2.edges()
+
+ BA3 = nx.barabasi_albert_graph(100, m1, seed)
+ DBA3 = nx.dual_barabasi_albert_graph(100, m1, m1, p, seed)
+ # We can't compare edges here since randomness is "consumed" when drawing
+ # between m1 and m2
+ assert BA3.size() == DBA3.size()
+
+ DBA = nx.dual_barabasi_albert_graph(100, m1, m2, p, seed, initial_graph)
+ BA1 = nx.barabasi_albert_graph(100, m1, seed, initial_graph)
+ BA2 = nx.barabasi_albert_graph(100, m2, seed, initial_graph)
+ assert (
+ min(BA1.size(), BA2.size()) <= DBA.size() <= max(BA1.size(), BA2.size())
+ )
+
+ # Testing exceptions
+ dbag = nx.dual_barabasi_albert_graph
+ pytest.raises(nx.NetworkXError, dbag, m1, m1, m2, 0)
+ pytest.raises(nx.NetworkXError, dbag, m2, m1, m2, 0)
+ pytest.raises(nx.NetworkXError, dbag, 100, m1, m2, -0.5)
+ pytest.raises(nx.NetworkXError, dbag, 100, m1, m2, 1.5)
+ initial = nx.complete_graph(max(m1, m2) - 1)
+ pytest.raises(nx.NetworkXError, dbag, 100, m1, m2, p, initial_graph=initial)
+
+ def test_extended_barabasi_albert(self, m=2):
+ """
+ Tests that the extended BA random graph generated behaves consistently.
+
+ Tests the exceptions are raised as expected.
+
+ The graphs generation are repeated several times to prevent lucky-shots
+
+ """
+ seeds = [42, 314, 2718]
+
+ for seed in seeds:
+ BA_model = nx.barabasi_albert_graph(100, m, seed)
+ BA_model_edges = BA_model.number_of_edges()
+
+ # This behaves just like BA, the number of edges must be the same
+ G1 = nx.extended_barabasi_albert_graph(100, m, 0, 0, seed)
+ assert G1.size() == BA_model_edges
+
+ # More than twice more edges should have been added
+ G1 = nx.extended_barabasi_albert_graph(100, m, 0.8, 0, seed)
+ assert G1.size() > BA_model_edges * 2
+
+ # Only edge rewiring, so the number of edges less than original
+ G2 = nx.extended_barabasi_albert_graph(100, m, 0, 0.8, seed)
+ assert G2.size() == BA_model_edges
+
+ # Mixed scenario: less edges than G1 and more edges than G2
+ G3 = nx.extended_barabasi_albert_graph(100, m, 0.3, 0.3, seed)
+ assert G3.size() > G2.size()
+ assert G3.size() < G1.size()
+
+ # Testing exceptions
+ ebag = nx.extended_barabasi_albert_graph
+ pytest.raises(nx.NetworkXError, ebag, m, m, 0, 0)
+ pytest.raises(nx.NetworkXError, ebag, 1, 0.5, 0, 0)
+ pytest.raises(nx.NetworkXError, ebag, 100, 2, 0.5, 0.5)
+
+ def test_random_zero_regular_graph(self):
+ """Tests that a 0-regular graph has the correct number of nodes and
+ edges.
+
+ """
+ seed = 42
+ G = nx.random_regular_graph(0, 10, seed)
+ assert len(G) == 10
+ assert G.number_of_edges() == 0
+
+ def test_gnm(self):
+ G = nx.gnm_random_graph(10, 3)
+ assert len(G) == 10
+ assert G.number_of_edges() == 3
+
+ G = nx.gnm_random_graph(10, 3, seed=42)
+ assert len(G) == 10
+ assert G.number_of_edges() == 3
+
+ G = nx.gnm_random_graph(10, 100)
+ assert len(G) == 10
+ assert G.number_of_edges() == 45
+
+ G = nx.gnm_random_graph(10, 100, directed=True)
+ assert len(G) == 10
+ assert G.number_of_edges() == 90
+
+ G = nx.gnm_random_graph(10, -1.1)
+ assert len(G) == 10
+ assert G.number_of_edges() == 0
+
+ def test_watts_strogatz_big_k(self):
+ # Test to make sure than n <= k
+ pytest.raises(nx.NetworkXError, nx.watts_strogatz_graph, 10, 11, 0.25)
+ pytest.raises(nx.NetworkXError, nx.newman_watts_strogatz_graph, 10, 11, 0.25)
+
+ # could create an infinite loop, now doesn't
+ # infinite loop used to occur when a node has degree n-1 and needs to rewire
+ nx.watts_strogatz_graph(10, 9, 0.25, seed=0)
+ nx.newman_watts_strogatz_graph(10, 9, 0.5, seed=0)
+
+ # Test k==n scenario
+ nx.watts_strogatz_graph(10, 10, 0.25, seed=0)
+ nx.newman_watts_strogatz_graph(10, 10, 0.25, seed=0)
+
+ def test_random_kernel_graph(self):
+ def integral(u, w, z):
+ return c * (z - w)
+
+ def root(u, w, r):
+ return r / c + w
+
+ c = 1
+ graph = nx.random_kernel_graph(1000, integral, root)
+ graph = nx.random_kernel_graph(1000, integral, root, seed=42)
+ assert len(graph) == 1000
+
+
+@pytest.mark.parametrize(
+ ("k", "expected_num_nodes", "expected_num_edges"),
+ [
+ (2, 10, 10),
+ (4, 10, 20),
+ ],
+)
+def test_watts_strogatz(k, expected_num_nodes, expected_num_edges):
+ G = nx.watts_strogatz_graph(10, k, 0.25, seed=42)
+ assert len(G) == expected_num_nodes
+ assert G.number_of_edges() == expected_num_edges
+
+
+def test_newman_watts_strogatz_zero_probability():
+ G = nx.newman_watts_strogatz_graph(10, 2, 0.0, seed=42)
+ assert len(G) == 10
+ assert G.number_of_edges() == 10
+
+
+def test_newman_watts_strogatz_nonzero_probability():
+ G = nx.newman_watts_strogatz_graph(10, 4, 0.25, seed=42)
+ assert len(G) == 10
+ assert G.number_of_edges() >= 20
+
+
+def test_connected_watts_strogatz():
+ G = nx.connected_watts_strogatz_graph(10, 2, 0.1, tries=10, seed=42)
+ assert len(G) == 10
+ assert G.number_of_edges() == 10
+
+
+def test_connected_watts_strogatz_zero_tries():
+ with pytest.raises(nx.NetworkXError, match="Maximum number of tries exceeded"):
+ nx.connected_watts_strogatz_graph(10, 2, 0.1, tries=0)
+
+
+@pytest.mark.parametrize(
+ "generator, kwargs",
+ [
+ (nx.fast_gnp_random_graph, {"n": 20, "p": 0.2, "directed": False}),
+ (nx.fast_gnp_random_graph, {"n": 20, "p": 0.2, "directed": True}),
+ (nx.gnp_random_graph, {"n": 20, "p": 0.2, "directed": False}),
+ (nx.gnp_random_graph, {"n": 20, "p": 0.2, "directed": True}),
+ (nx.dense_gnm_random_graph, {"n": 30, "m": 4}),
+ (nx.gnm_random_graph, {"n": 30, "m": 4, "directed": False}),
+ (nx.gnm_random_graph, {"n": 30, "m": 4, "directed": True}),
+ (nx.newman_watts_strogatz_graph, {"n": 50, "k": 5, "p": 0.1}),
+ (nx.watts_strogatz_graph, {"n": 50, "k": 5, "p": 0.1}),
+ (nx.connected_watts_strogatz_graph, {"n": 50, "k": 5, "p": 0.1}),
+ (nx.random_regular_graph, {"d": 5, "n": 20}),
+ (nx.barabasi_albert_graph, {"n": 40, "m": 3}),
+ (nx.dual_barabasi_albert_graph, {"n": 40, "m1": 3, "m2": 2, "p": 0.1}),
+ (nx.extended_barabasi_albert_graph, {"n": 40, "m": 3, "p": 0.1, "q": 0.2}),
+ (nx.powerlaw_cluster_graph, {"n": 40, "m": 3, "p": 0.1}),
+ (nx.random_lobster, {"n": 40, "p1": 0.1, "p2": 0.2}),
+ (nx.random_shell_graph, {"constructor": [(10, 20, 0.8), (20, 40, 0.8)]}),
+ (nx.random_powerlaw_tree, {"n": 10, "seed": 14, "tries": 1}),
+ (
+ nx.random_kernel_graph,
+ {
+ "n": 10,
+ "kernel_integral": lambda u, w, z: z - w,
+ "kernel_root": lambda u, w, r: r + w,
+ },
+ ),
+ ],
+)
+@pytest.mark.parametrize("create_using_instance", [False, True])
+def test_create_using(generator, kwargs, create_using_instance):
+ class DummyGraph(nx.Graph):
+ pass
+
+ class DummyDiGraph(nx.DiGraph):
+ pass
+
+ create_using_type = DummyDiGraph if kwargs.get("directed") else DummyGraph
+ create_using = create_using_type() if create_using_instance else create_using_type
+ graph = generator(**kwargs, create_using=create_using)
+ assert isinstance(graph, create_using_type)
+
+
+@pytest.mark.parametrize("directed", [True, False])
+@pytest.mark.parametrize("fn", (nx.fast_gnp_random_graph, nx.gnp_random_graph))
+def test_gnp_fns_disallow_multigraph(fn, directed):
+ with pytest.raises(nx.NetworkXError, match="must not be a multi-graph"):
+ fn(20, 0.2, create_using=nx.MultiGraph)
+
+
+@pytest.mark.parametrize("fn", (nx.gnm_random_graph, nx.dense_gnm_random_graph))
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_gnm_fns_disallow_directed_and_multigraph(fn, graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ fn(10, 20, create_using=graphtype)
+
+
+@pytest.mark.parametrize(
+ "fn",
+ (
+ nx.newman_watts_strogatz_graph,
+ nx.watts_strogatz_graph,
+ nx.connected_watts_strogatz_graph,
+ ),
+)
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_watts_strogatz_disallow_directed_and_multigraph(fn, graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ fn(10, 2, 0.2, create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_random_regular_graph_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.random_regular_graph(2, 10, create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_barabasi_albert_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.barabasi_albert_graph(10, 3, create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_dual_barabasi_albert_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.dual_barabasi_albert_graph(10, 2, 1, 0.4, create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_extended_barabasi_albert_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.extended_barabasi_albert_graph(10, 2, 0.2, 0.3, create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_powerlaw_cluster_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.powerlaw_cluster_graph(10, 5, 0.2, create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_random_lobster_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.random_lobster(10, 0.1, 0.1, create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_random_shell_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.random_shell_graph([(10, 20, 2), (10, 20, 5)], create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_random_powerlaw_tree_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.random_powerlaw_tree(10, create_using=graphtype)
+
+
+@pytest.mark.parametrize("graphtype", (nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph))
+def test_random_kernel_disallow_directed_and_multigraph(graphtype):
+ with pytest.raises(nx.NetworkXError, match="must not be"):
+ nx.random_kernel_graph(
+ 10, lambda y, a, b: a + b, lambda u, w, r: r + w, create_using=graphtype
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_small.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_small.py
new file mode 100644
index 0000000000000000000000000000000000000000..355d6d36af52d5525a560fb77eea5c51d89ab82b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_small.py
@@ -0,0 +1,208 @@
+import pytest
+
+import networkx as nx
+from networkx.algorithms.isomorphism.isomorph import graph_could_be_isomorphic
+
+is_isomorphic = graph_could_be_isomorphic
+
+"""Generators - Small
+=====================
+
+Some small graphs
+"""
+
+null = nx.null_graph()
+
+
+class TestGeneratorsSmall:
+ def test__LCF_graph(self):
+ # If n<=0, then return the null_graph
+ G = nx.LCF_graph(-10, [1, 2], 100)
+ assert is_isomorphic(G, null)
+ G = nx.LCF_graph(0, [1, 2], 3)
+ assert is_isomorphic(G, null)
+ G = nx.LCF_graph(0, [1, 2], 10)
+ assert is_isomorphic(G, null)
+
+ # Test that LCF(n,[],0) == cycle_graph(n)
+ for a, b, c in [(5, [], 0), (10, [], 0), (5, [], 1), (10, [], 10)]:
+ G = nx.LCF_graph(a, b, c)
+ assert is_isomorphic(G, nx.cycle_graph(a))
+
+ # Generate the utility graph K_{3,3}
+ G = nx.LCF_graph(6, [3, -3], 3)
+ utility_graph = nx.complete_bipartite_graph(3, 3)
+ assert is_isomorphic(G, utility_graph)
+
+ with pytest.raises(nx.NetworkXError, match="Directed Graph not supported"):
+ G = nx.LCF_graph(6, [3, -3], 3, create_using=nx.DiGraph)
+
+ def test_properties_named_small_graphs(self):
+ G = nx.bull_graph()
+ assert sorted(G) == list(range(5))
+ assert G.number_of_edges() == 5
+ assert sorted(d for n, d in G.degree()) == [1, 1, 2, 3, 3]
+ assert nx.diameter(G) == 3
+ assert nx.radius(G) == 2
+
+ G = nx.chvatal_graph()
+ assert sorted(G) == list(range(12))
+ assert G.number_of_edges() == 24
+ assert [d for n, d in G.degree()] == 12 * [4]
+ assert nx.diameter(G) == 2
+ assert nx.radius(G) == 2
+
+ G = nx.cubical_graph()
+ assert sorted(G) == list(range(8))
+ assert G.number_of_edges() == 12
+ assert [d for n, d in G.degree()] == 8 * [3]
+ assert nx.diameter(G) == 3
+ assert nx.radius(G) == 3
+
+ G = nx.desargues_graph()
+ assert sorted(G) == list(range(20))
+ assert G.number_of_edges() == 30
+ assert [d for n, d in G.degree()] == 20 * [3]
+
+ G = nx.diamond_graph()
+ assert sorted(G) == list(range(4))
+ assert sorted(d for n, d in G.degree()) == [2, 2, 3, 3]
+ assert nx.diameter(G) == 2
+ assert nx.radius(G) == 1
+
+ G = nx.dodecahedral_graph()
+ assert sorted(G) == list(range(20))
+ assert G.number_of_edges() == 30
+ assert [d for n, d in G.degree()] == 20 * [3]
+ assert nx.diameter(G) == 5
+ assert nx.radius(G) == 5
+
+ G = nx.frucht_graph()
+ assert sorted(G) == list(range(12))
+ assert G.number_of_edges() == 18
+ assert [d for n, d in G.degree()] == 12 * [3]
+ assert nx.diameter(G) == 4
+ assert nx.radius(G) == 3
+
+ G = nx.heawood_graph()
+ assert sorted(G) == list(range(14))
+ assert G.number_of_edges() == 21
+ assert [d for n, d in G.degree()] == 14 * [3]
+ assert nx.diameter(G) == 3
+ assert nx.radius(G) == 3
+
+ G = nx.hoffman_singleton_graph()
+ assert sorted(G) == list(range(50))
+ assert G.number_of_edges() == 175
+ assert [d for n, d in G.degree()] == 50 * [7]
+ assert nx.diameter(G) == 2
+ assert nx.radius(G) == 2
+
+ G = nx.house_graph()
+ assert sorted(G) == list(range(5))
+ assert G.number_of_edges() == 6
+ assert sorted(d for n, d in G.degree()) == [2, 2, 2, 3, 3]
+ assert nx.diameter(G) == 2
+ assert nx.radius(G) == 2
+
+ G = nx.house_x_graph()
+ assert sorted(G) == list(range(5))
+ assert G.number_of_edges() == 8
+ assert sorted(d for n, d in G.degree()) == [2, 3, 3, 4, 4]
+ assert nx.diameter(G) == 2
+ assert nx.radius(G) == 1
+
+ G = nx.icosahedral_graph()
+ assert sorted(G) == list(range(12))
+ assert G.number_of_edges() == 30
+ assert [d for n, d in G.degree()] == [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
+ assert nx.diameter(G) == 3
+ assert nx.radius(G) == 3
+
+ G = nx.krackhardt_kite_graph()
+ assert sorted(G) == list(range(10))
+ assert G.number_of_edges() == 18
+ assert sorted(d for n, d in G.degree()) == [1, 2, 3, 3, 3, 4, 4, 5, 5, 6]
+
+ G = nx.moebius_kantor_graph()
+ assert sorted(G) == list(range(16))
+ assert G.number_of_edges() == 24
+ assert [d for n, d in G.degree()] == 16 * [3]
+ assert nx.diameter(G) == 4
+
+ G = nx.octahedral_graph()
+ assert sorted(G) == list(range(6))
+ assert G.number_of_edges() == 12
+ assert [d for n, d in G.degree()] == 6 * [4]
+ assert nx.diameter(G) == 2
+ assert nx.radius(G) == 2
+
+ G = nx.pappus_graph()
+ assert sorted(G) == list(range(18))
+ assert G.number_of_edges() == 27
+ assert [d for n, d in G.degree()] == 18 * [3]
+ assert nx.diameter(G) == 4
+
+ G = nx.petersen_graph()
+ assert sorted(G) == list(range(10))
+ assert G.number_of_edges() == 15
+ assert [d for n, d in G.degree()] == 10 * [3]
+ assert nx.diameter(G) == 2
+ assert nx.radius(G) == 2
+
+ G = nx.sedgewick_maze_graph()
+ assert sorted(G) == list(range(8))
+ assert G.number_of_edges() == 10
+ assert sorted(d for n, d in G.degree()) == [1, 2, 2, 2, 3, 3, 3, 4]
+
+ G = nx.tetrahedral_graph()
+ assert sorted(G) == list(range(4))
+ assert G.number_of_edges() == 6
+ assert [d for n, d in G.degree()] == [3, 3, 3, 3]
+ assert nx.diameter(G) == 1
+ assert nx.radius(G) == 1
+
+ G = nx.truncated_cube_graph()
+ assert sorted(G) == list(range(24))
+ assert G.number_of_edges() == 36
+ assert [d for n, d in G.degree()] == 24 * [3]
+
+ G = nx.truncated_tetrahedron_graph()
+ assert sorted(G) == list(range(12))
+ assert G.number_of_edges() == 18
+ assert [d for n, d in G.degree()] == 12 * [3]
+
+ G = nx.tutte_graph()
+ assert sorted(G) == list(range(46))
+ assert G.number_of_edges() == 69
+ assert [d for n, d in G.degree()] == 46 * [3]
+
+ # Test create_using with directed or multigraphs on small graphs
+ pytest.raises(nx.NetworkXError, nx.tutte_graph, create_using=nx.DiGraph)
+ MG = nx.tutte_graph(create_using=nx.MultiGraph)
+ assert sorted(MG.edges()) == sorted(G.edges())
+
+
+@pytest.mark.parametrize(
+ "fn",
+ (
+ nx.bull_graph,
+ nx.chvatal_graph,
+ nx.cubical_graph,
+ nx.diamond_graph,
+ nx.house_graph,
+ nx.house_x_graph,
+ nx.icosahedral_graph,
+ nx.krackhardt_kite_graph,
+ nx.octahedral_graph,
+ nx.petersen_graph,
+ nx.truncated_cube_graph,
+ nx.tutte_graph,
+ ),
+)
+@pytest.mark.parametrize(
+ "create_using", (nx.DiGraph, nx.MultiDiGraph, nx.DiGraph([(0, 1)]))
+)
+def tests_raises_with_directed_create_using(fn, create_using):
+ with pytest.raises(nx.NetworkXError, match="Directed Graph not supported"):
+ fn(create_using=create_using)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_spectral_graph_forge.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_spectral_graph_forge.py
new file mode 100644
index 0000000000000000000000000000000000000000..b554bfd7017658c9e3ac801c4504c9702d1e03d9
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_spectral_graph_forge.py
@@ -0,0 +1,49 @@
+import pytest
+
+pytest.importorskip("numpy")
+pytest.importorskip("scipy")
+
+
+from networkx import is_isomorphic
+from networkx.exception import NetworkXError
+from networkx.generators import karate_club_graph
+from networkx.generators.spectral_graph_forge import spectral_graph_forge
+from networkx.utils import nodes_equal
+
+
+def test_spectral_graph_forge():
+ G = karate_club_graph()
+
+ seed = 54321
+
+ # common cases, just checking node number preserving and difference
+ # between identity and modularity cases
+ H = spectral_graph_forge(G, 0.1, transformation="identity", seed=seed)
+ assert nodes_equal(G, H)
+
+ I = spectral_graph_forge(G, 0.1, transformation="identity", seed=seed)
+ assert nodes_equal(G, H)
+ assert is_isomorphic(I, H)
+
+ I = spectral_graph_forge(G, 0.1, transformation="modularity", seed=seed)
+ assert nodes_equal(G, I)
+
+ assert not is_isomorphic(I, H)
+
+ # with all the eigenvectors, output graph is identical to the input one
+ H = spectral_graph_forge(G, 1, transformation="modularity", seed=seed)
+ assert nodes_equal(G, H)
+ assert is_isomorphic(G, H)
+
+ # invalid alpha input value, it is silently truncated in [0,1]
+ H = spectral_graph_forge(G, -1, transformation="identity", seed=seed)
+ assert nodes_equal(G, H)
+
+ H = spectral_graph_forge(G, 10, transformation="identity", seed=seed)
+ assert nodes_equal(G, H)
+ assert is_isomorphic(G, H)
+
+ # invalid transformation mode, checking the error raising
+ pytest.raises(
+ NetworkXError, spectral_graph_forge, G, 0.1, transformation="unknown", seed=seed
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_stochastic.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_stochastic.py
new file mode 100644
index 0000000000000000000000000000000000000000..0404d9d8454b36b546152c1428790441c6952fa2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_stochastic.py
@@ -0,0 +1,72 @@
+"""Unit tests for the :mod:`networkx.generators.stochastic` module."""
+
+import pytest
+
+import networkx as nx
+
+
+class TestStochasticGraph:
+ """Unit tests for the :func:`~networkx.stochastic_graph` function."""
+
+ def test_default_weights(self):
+ G = nx.DiGraph()
+ G.add_edge(0, 1)
+ G.add_edge(0, 2)
+ S = nx.stochastic_graph(G)
+ assert nx.is_isomorphic(G, S)
+ assert sorted(S.edges(data=True)) == [
+ (0, 1, {"weight": 0.5}),
+ (0, 2, {"weight": 0.5}),
+ ]
+
+ def test_in_place(self):
+ """Tests for an in-place reweighting of the edges of the graph."""
+ G = nx.DiGraph()
+ G.add_edge(0, 1, weight=1)
+ G.add_edge(0, 2, weight=1)
+ nx.stochastic_graph(G, copy=False)
+ assert sorted(G.edges(data=True)) == [
+ (0, 1, {"weight": 0.5}),
+ (0, 2, {"weight": 0.5}),
+ ]
+
+ def test_arbitrary_weights(self):
+ G = nx.DiGraph()
+ G.add_edge(0, 1, weight=1)
+ G.add_edge(0, 2, weight=1)
+ S = nx.stochastic_graph(G)
+ assert sorted(S.edges(data=True)) == [
+ (0, 1, {"weight": 0.5}),
+ (0, 2, {"weight": 0.5}),
+ ]
+
+ def test_multidigraph(self):
+ G = nx.MultiDiGraph()
+ G.add_edges_from([(0, 1), (0, 1), (0, 2), (0, 2)])
+ S = nx.stochastic_graph(G)
+ d = {"weight": 0.25}
+ assert sorted(S.edges(data=True)) == [
+ (0, 1, d),
+ (0, 1, d),
+ (0, 2, d),
+ (0, 2, d),
+ ]
+
+ def test_zero_weights(self):
+ """Smoke test: ensure ZeroDivisionError is not raised."""
+ G = nx.DiGraph()
+ G.add_edge(0, 1, weight=0)
+ G.add_edge(0, 2, weight=0)
+ S = nx.stochastic_graph(G)
+ assert sorted(S.edges(data=True)) == [
+ (0, 1, {"weight": 0}),
+ (0, 2, {"weight": 0}),
+ ]
+
+ def test_graph_disallowed(self):
+ with pytest.raises(nx.NetworkXNotImplemented):
+ nx.stochastic_graph(nx.Graph())
+
+ def test_multigraph_disallowed(self):
+ with pytest.raises(nx.NetworkXNotImplemented):
+ nx.stochastic_graph(nx.MultiGraph())
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_sudoku.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_sudoku.py
new file mode 100644
index 0000000000000000000000000000000000000000..7c3560aa81890d0dc308219d7f0983d3950f9fd5
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_sudoku.py
@@ -0,0 +1,92 @@
+"""Unit tests for the :mod:`networkx.generators.sudoku_graph` module."""
+
+import pytest
+
+import networkx as nx
+
+
+def test_sudoku_negative():
+ """Raise an error when generating a Sudoku graph of order -1."""
+ pytest.raises(nx.NetworkXError, nx.sudoku_graph, n=-1)
+
+
+@pytest.mark.parametrize("n", [0, 1, 2, 3, 4])
+def test_sudoku_generator(n):
+ """Generate Sudoku graphs of various sizes and verify their properties."""
+ G = nx.sudoku_graph(n)
+ expected_nodes = n**4
+ expected_degree = (n - 1) * (3 * n + 1)
+ expected_edges = expected_nodes * expected_degree // 2
+ assert not G.is_directed()
+ assert not G.is_multigraph()
+ assert G.number_of_nodes() == expected_nodes
+ assert G.number_of_edges() == expected_edges
+ assert all(d == expected_degree for _, d in G.degree)
+
+ if n == 2:
+ assert sorted(G.neighbors(6)) == [2, 3, 4, 5, 7, 10, 14]
+ elif n == 3:
+ assert sorted(G.neighbors(42)) == [
+ 6,
+ 15,
+ 24,
+ 33,
+ 34,
+ 35,
+ 36,
+ 37,
+ 38,
+ 39,
+ 40,
+ 41,
+ 43,
+ 44,
+ 51,
+ 52,
+ 53,
+ 60,
+ 69,
+ 78,
+ ]
+ elif n == 4:
+ assert sorted(G.neighbors(0)) == [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 9,
+ 10,
+ 11,
+ 12,
+ 13,
+ 14,
+ 15,
+ 16,
+ 17,
+ 18,
+ 19,
+ 32,
+ 33,
+ 34,
+ 35,
+ 48,
+ 49,
+ 50,
+ 51,
+ 64,
+ 80,
+ 96,
+ 112,
+ 128,
+ 144,
+ 160,
+ 176,
+ 192,
+ 208,
+ 224,
+ 240,
+ ]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_time_series.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_time_series.py
new file mode 100644
index 0000000000000000000000000000000000000000..5d0cc90a53589a46d0444be6df7c31a1f5beec06
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_time_series.py
@@ -0,0 +1,64 @@
+"""Unit tests for the :mod:`networkx.generators.time_series` module."""
+
+import itertools
+
+import networkx as nx
+
+
+def test_visibility_graph__empty_series__empty_graph():
+ null_graph = nx.visibility_graph([]) # move along nothing to see here
+ assert nx.is_empty(null_graph)
+
+
+def test_visibility_graph__single_value_ts__single_node_graph():
+ node_graph = nx.visibility_graph([10]) # So Lonely
+ assert node_graph.number_of_nodes() == 1
+ assert node_graph.number_of_edges() == 0
+
+
+def test_visibility_graph__two_values_ts__single_edge_graph():
+ edge_graph = nx.visibility_graph([10, 20]) # Two of Us
+ assert list(edge_graph.edges) == [(0, 1)]
+
+
+def test_visibility_graph__convex_series__complete_graph():
+ series = [i**2 for i in range(10)] # no obstructions
+ expected_series_length = len(series)
+
+ actual_graph = nx.visibility_graph(series)
+
+ assert actual_graph.number_of_nodes() == expected_series_length
+ assert actual_graph.number_of_edges() == 45
+ assert nx.is_isomorphic(actual_graph, nx.complete_graph(expected_series_length))
+
+
+def test_visibility_graph__concave_series__path_graph():
+ series = [-(i**2) for i in range(10)] # Slip Slidin' Away
+ expected_node_count = len(series)
+
+ actual_graph = nx.visibility_graph(series)
+
+ assert actual_graph.number_of_nodes() == expected_node_count
+ assert actual_graph.number_of_edges() == expected_node_count - 1
+ assert nx.is_isomorphic(actual_graph, nx.path_graph(expected_node_count))
+
+
+def test_visibility_graph__flat_series__path_graph():
+ series = [0] * 10 # living in 1D flatland
+ expected_node_count = len(series)
+
+ actual_graph = nx.visibility_graph(series)
+
+ assert actual_graph.number_of_nodes() == expected_node_count
+ assert actual_graph.number_of_edges() == expected_node_count - 1
+ assert nx.is_isomorphic(actual_graph, nx.path_graph(expected_node_count))
+
+
+def test_visibility_graph_cyclic_series():
+ series = list(itertools.islice(itertools.cycle((2, 1, 3)), 17)) # It's so bumpy!
+ expected_node_count = len(series)
+
+ actual_graph = nx.visibility_graph(series)
+
+ assert actual_graph.number_of_nodes() == expected_node_count
+ assert actual_graph.number_of_edges() == 25
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_trees.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_trees.py
new file mode 100644
index 0000000000000000000000000000000000000000..7932436bf7ad6bb5ab5124f6ff59b7523358354d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_trees.py
@@ -0,0 +1,195 @@
+import random
+
+import pytest
+
+import networkx as nx
+from networkx.utils import arbitrary_element, graphs_equal
+
+
+@pytest.mark.parametrize("prefix_tree_fn", (nx.prefix_tree, nx.prefix_tree_recursive))
+def test_basic_prefix_tree(prefix_tree_fn):
+ # This example is from the Wikipedia article "Trie"
+ # .
+ strings = ["a", "to", "tea", "ted", "ten", "i", "in", "inn"]
+ T = prefix_tree_fn(strings)
+ root, NIL = 0, -1
+
+ def source_label(v):
+ return T.nodes[v]["source"]
+
+ # First, we check that the tree has the expected
+ # structure. Recall that each node that corresponds to one of
+ # the input strings has an edge to the NIL node.
+ #
+ # Consider the three children at level 1 in the trie.
+ a, i, t = sorted(T[root], key=source_label)
+ # Check the 'a' branch.
+ assert len(T[a]) == 1
+ nil = arbitrary_element(T[a])
+ assert len(T[nil]) == 0
+ # Check the 'i' branch.
+ assert len(T[i]) == 2
+ nil, in_ = sorted(T[i], key=source_label)
+ assert len(T[nil]) == 0
+ assert len(T[in_]) == 2
+ nil, inn = sorted(T[in_], key=source_label)
+ assert len(T[nil]) == 0
+ assert len(T[inn]) == 1
+ nil = arbitrary_element(T[inn])
+ assert len(T[nil]) == 0
+ # Check the 't' branch.
+ te, to = sorted(T[t], key=source_label)
+ assert len(T[to]) == 1
+ nil = arbitrary_element(T[to])
+ assert len(T[nil]) == 0
+ tea, ted, ten = sorted(T[te], key=source_label)
+ assert len(T[tea]) == 1
+ assert len(T[ted]) == 1
+ assert len(T[ten]) == 1
+ nil = arbitrary_element(T[tea])
+ assert len(T[nil]) == 0
+ nil = arbitrary_element(T[ted])
+ assert len(T[nil]) == 0
+ nil = arbitrary_element(T[ten])
+ assert len(T[nil]) == 0
+
+ # Next, we check that the "sources" of each of the nodes is the
+ # rightmost letter in the string corresponding to the path to
+ # that node.
+ assert source_label(root) is None
+ assert source_label(a) == "a"
+ assert source_label(i) == "i"
+ assert source_label(t) == "t"
+ assert source_label(in_) == "n"
+ assert source_label(inn) == "n"
+ assert source_label(to) == "o"
+ assert source_label(te) == "e"
+ assert source_label(tea) == "a"
+ assert source_label(ted) == "d"
+ assert source_label(ten) == "n"
+ assert source_label(NIL) == "NIL"
+
+
+@pytest.mark.parametrize(
+ "strings",
+ (
+ ["a", "to", "tea", "ted", "ten", "i", "in", "inn"],
+ ["ab", "abs", "ad"],
+ ["ab", "abs", "ad", ""],
+ ["distant", "disparaging", "distant", "diamond", "ruby"],
+ ),
+)
+def test_implementations_consistent(strings):
+ """Ensure results are consistent between prefix_tree implementations."""
+ assert graphs_equal(nx.prefix_tree(strings), nx.prefix_tree_recursive(strings))
+
+
+def test_random_labeled_rooted_tree():
+ for i in range(1, 10):
+ t1 = nx.random_labeled_rooted_tree(i, seed=42)
+ t2 = nx.random_labeled_rooted_tree(i, seed=42)
+ assert nx.utils.misc.graphs_equal(t1, t2)
+ assert nx.is_tree(t1)
+ assert "root" in t1.graph
+ assert "roots" not in t1.graph
+
+
+def test_random_labeled_tree_n_zero():
+ """Tests if n = 0 then the NetworkXPointlessConcept exception is raised."""
+ with pytest.raises(nx.NetworkXPointlessConcept):
+ T = nx.random_labeled_tree(0, seed=1234)
+ with pytest.raises(nx.NetworkXPointlessConcept):
+ T = nx.random_labeled_rooted_tree(0, seed=1234)
+
+
+def test_random_labeled_rooted_forest():
+ for i in range(1, 10):
+ t1 = nx.random_labeled_rooted_forest(i, seed=42)
+ t2 = nx.random_labeled_rooted_forest(i, seed=42)
+ assert nx.utils.misc.graphs_equal(t1, t2)
+ for c in nx.connected_components(t1):
+ assert nx.is_tree(t1.subgraph(c))
+ assert "root" not in t1.graph
+ assert "roots" in t1.graph
+
+
+def test_random_labeled_rooted_forest_n_zero():
+ """Tests generation of empty labeled forests."""
+ F = nx.random_labeled_rooted_forest(0, seed=1234)
+ assert len(F) == 0
+ assert len(F.graph["roots"]) == 0
+
+
+def test_random_unlabeled_rooted_tree():
+ for i in range(1, 10):
+ t1 = nx.random_unlabeled_rooted_tree(i, seed=42)
+ t2 = nx.random_unlabeled_rooted_tree(i, seed=42)
+ assert nx.utils.misc.graphs_equal(t1, t2)
+ assert nx.is_tree(t1)
+ assert "root" in t1.graph
+ assert "roots" not in t1.graph
+ t = nx.random_unlabeled_rooted_tree(15, number_of_trees=10, seed=43)
+ random.seed(43)
+ s = nx.random_unlabeled_rooted_tree(15, number_of_trees=10, seed=random)
+ for i in range(10):
+ assert nx.utils.misc.graphs_equal(t[i], s[i])
+ assert nx.is_tree(t[i])
+ assert "root" in t[i].graph
+ assert "roots" not in t[i].graph
+
+
+def test_random_unlabeled_tree_n_zero():
+ """Tests if n = 0 then the NetworkXPointlessConcept exception is raised."""
+ with pytest.raises(nx.NetworkXPointlessConcept):
+ T = nx.random_unlabeled_tree(0, seed=1234)
+ with pytest.raises(nx.NetworkXPointlessConcept):
+ T = nx.random_unlabeled_rooted_tree(0, seed=1234)
+
+
+def test_random_unlabeled_rooted_forest():
+ with pytest.raises(ValueError):
+ nx.random_unlabeled_rooted_forest(10, q=0, seed=42)
+ for i in range(1, 10):
+ for q in range(1, i + 1):
+ t1 = nx.random_unlabeled_rooted_forest(i, q=q, seed=42)
+ t2 = nx.random_unlabeled_rooted_forest(i, q=q, seed=42)
+ assert nx.utils.misc.graphs_equal(t1, t2)
+ for c in nx.connected_components(t1):
+ assert nx.is_tree(t1.subgraph(c))
+ assert len(c) <= q
+ assert "root" not in t1.graph
+ assert "roots" in t1.graph
+ t = nx.random_unlabeled_rooted_forest(15, number_of_forests=10, seed=43)
+ random.seed(43)
+ s = nx.random_unlabeled_rooted_forest(15, number_of_forests=10, seed=random)
+ for i in range(10):
+ assert nx.utils.misc.graphs_equal(t[i], s[i])
+ for c in nx.connected_components(t[i]):
+ assert nx.is_tree(t[i].subgraph(c))
+ assert "root" not in t[i].graph
+ assert "roots" in t[i].graph
+
+
+def test_random_unlabeled_forest_n_zero():
+ """Tests generation of empty unlabeled forests."""
+ F = nx.random_unlabeled_rooted_forest(0, seed=1234)
+ assert len(F) == 0
+ assert len(F.graph["roots"]) == 0
+
+
+def test_random_unlabeled_tree():
+ for i in range(1, 10):
+ t1 = nx.random_unlabeled_tree(i, seed=42)
+ t2 = nx.random_unlabeled_tree(i, seed=42)
+ assert nx.utils.misc.graphs_equal(t1, t2)
+ assert nx.is_tree(t1)
+ assert "root" not in t1.graph
+ assert "roots" not in t1.graph
+ t = nx.random_unlabeled_tree(10, number_of_trees=10, seed=43)
+ random.seed(43)
+ s = nx.random_unlabeled_tree(10, number_of_trees=10, seed=random)
+ for i in range(10):
+ assert nx.utils.misc.graphs_equal(t[i], s[i])
+ assert nx.is_tree(t[i])
+ assert "root" not in t[i].graph
+ assert "roots" not in t[i].graph
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_triads.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_triads.py
new file mode 100644
index 0000000000000000000000000000000000000000..463844be23a07f71375873bbc71e09c402d51118
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/tests/test_triads.py
@@ -0,0 +1,15 @@
+"""Unit tests for the :mod:`networkx.generators.triads` module."""
+
+import pytest
+
+from networkx import triad_graph
+
+
+def test_triad_graph():
+ G = triad_graph("030T")
+ assert [tuple(e) for e in ("ab", "ac", "cb")] == sorted(G.edges())
+
+
+def test_invalid_name():
+ with pytest.raises(ValueError):
+ triad_graph("bogus")
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/time_series.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/time_series.py
new file mode 100644
index 0000000000000000000000000000000000000000..592d7734a408bf33e58aad20cb117be674558ad2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/time_series.py
@@ -0,0 +1,74 @@
+"""
+Time Series Graphs
+"""
+
+import itertools
+
+import networkx as nx
+
+__all__ = ["visibility_graph"]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def visibility_graph(series):
+ """
+ Return a Visibility Graph of an input Time Series.
+
+ A visibility graph converts a time series into a graph. The constructed graph
+ uses integer nodes to indicate which event in the series the node represents.
+ Edges are formed as follows: consider a bar plot of the series and view that
+ as a side view of a landscape with a node at the top of each bar. An edge
+ means that the nodes can be connected by a straight "line-of-sight" without
+ being obscured by any bars between the nodes.
+
+ The resulting graph inherits several properties of the series in its structure.
+ Thereby, periodic series convert into regular graphs, random series convert
+ into random graphs, and fractal series convert into scale-free networks [1]_.
+
+ Parameters
+ ----------
+ series : Sequence[Number]
+ A Time Series sequence (iterable and sliceable) of numeric values
+ representing times.
+
+ Returns
+ -------
+ NetworkX Graph
+ The Visibility Graph of the input series
+
+ Examples
+ --------
+ >>> series_list = [range(10), [2, 1, 3, 2, 1, 3, 2, 1, 3, 2, 1, 3]]
+ >>> for s in series_list:
+ ... g = nx.visibility_graph(s)
+ ... print(g)
+ Graph with 10 nodes and 9 edges
+ Graph with 12 nodes and 18 edges
+
+ References
+ ----------
+ .. [1] Lacasa, Lucas, Bartolo Luque, Fernando Ballesteros, Jordi Luque, and Juan Carlos Nuno.
+ "From time series to complex networks: The visibility graph." Proceedings of the
+ National Academy of Sciences 105, no. 13 (2008): 4972-4975.
+ https://www.pnas.org/doi/10.1073/pnas.0709247105
+ """
+
+ # Sequential values are always connected
+ G = nx.path_graph(len(series))
+ nx.set_node_attributes(G, dict(enumerate(series)), "value")
+
+ # Check all combinations of nodes n series
+ for (n1, t1), (n2, t2) in itertools.combinations(enumerate(series), 2):
+ # check if any value between obstructs line of sight
+ slope = (t2 - t1) / (n2 - n1)
+ offset = t2 - slope * n2
+
+ obstructed = any(
+ t >= slope * n + offset
+ for n, t in enumerate(series[n1 + 1 : n2], start=n1 + 1)
+ )
+
+ if not obstructed:
+ G.add_edge(n1, n2)
+
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/trees.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/trees.py
new file mode 100644
index 0000000000000000000000000000000000000000..30849a8d4884603b766fc7954cc310afe7338fa2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/trees.py
@@ -0,0 +1,1071 @@
+"""Functions for generating trees.
+
+The functions sampling trees at random in this module come
+in two variants: labeled and unlabeled. The labeled variants
+sample from every possible tree with the given number of nodes
+uniformly at random. The unlabeled variants sample from every
+possible *isomorphism class* of trees with the given number
+of nodes uniformly at random.
+
+To understand the difference, consider the following example.
+There are two isomorphism classes of trees with four nodes.
+One is that of the path graph, the other is that of the
+star graph. The unlabeled variant will return a line graph or
+a star graph with probability 1/2.
+
+The labeled variant will return the line graph
+with probability 3/4 and the star graph with probability 1/4,
+because there are more labeled variants of the line graph
+than of the star graph. More precisely, the line graph has
+an automorphism group of order 2, whereas the star graph has
+an automorphism group of order 6, so the line graph has three
+times as many labeled variants as the star graph, and thus
+three more chances to be drawn.
+
+Additionally, some functions in this module can sample rooted
+trees and forests uniformly at random. A rooted tree is a tree
+with a designated root node. A rooted forest is a disjoint union
+of rooted trees.
+"""
+
+import warnings
+from collections import Counter, defaultdict
+from math import comb, factorial
+
+import networkx as nx
+from networkx.utils import py_random_state
+
+__all__ = [
+ "prefix_tree",
+ "prefix_tree_recursive",
+ "random_labeled_tree",
+ "random_labeled_rooted_tree",
+ "random_labeled_rooted_forest",
+ "random_unlabeled_tree",
+ "random_unlabeled_rooted_tree",
+ "random_unlabeled_rooted_forest",
+]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def prefix_tree(paths):
+ """Creates a directed prefix tree from a list of paths.
+
+ Usually the paths are described as strings or lists of integers.
+
+ A "prefix tree" represents the prefix structure of the strings.
+ Each node represents a prefix of some string. The root represents
+ the empty prefix with children for the single letter prefixes which
+ in turn have children for each double letter prefix starting with
+ the single letter corresponding to the parent node, and so on.
+
+ More generally the prefixes do not need to be strings. A prefix refers
+ to the start of a sequence. The root has children for each one element
+ prefix and they have children for each two element prefix that starts
+ with the one element sequence of the parent, and so on.
+
+ Note that this implementation uses integer nodes with an attribute.
+ Each node has an attribute "source" whose value is the original element
+ of the path to which this node corresponds. For example, suppose `paths`
+ consists of one path: "can". Then the nodes `[1, 2, 3]` which represent
+ this path have "source" values "c", "a" and "n".
+
+ All the descendants of a node have a common prefix in the sequence/path
+ associated with that node. From the returned tree, the prefix for each
+ node can be constructed by traversing the tree up to the root and
+ accumulating the "source" values along the way.
+
+ The root node is always `0` and has "source" attribute `None`.
+ The root is the only node with in-degree zero.
+ The nil node is always `-1` and has "source" attribute `"NIL"`.
+ The nil node is the only node with out-degree zero.
+
+
+ Parameters
+ ----------
+ paths: iterable of paths
+ An iterable of paths which are themselves sequences.
+ Matching prefixes among these sequences are identified with
+ nodes of the prefix tree. One leaf of the tree is associated
+ with each path. (Identical paths are associated with the same
+ leaf of the tree.)
+
+
+ Returns
+ -------
+ tree: DiGraph
+ A directed graph representing an arborescence consisting of the
+ prefix tree generated by `paths`. Nodes are directed "downward",
+ from parent to child. A special "synthetic" root node is added
+ to be the parent of the first node in each path. A special
+ "synthetic" leaf node, the "nil" node `-1`, is added to be the child
+ of all nodes representing the last element in a path. (The
+ addition of this nil node technically makes this not an
+ arborescence but a directed acyclic graph; removing the nil node
+ makes it an arborescence.)
+
+
+ Notes
+ -----
+ The prefix tree is also known as a *trie*.
+
+
+ Examples
+ --------
+ Create a prefix tree from a list of strings with common prefixes::
+
+ >>> paths = ["ab", "abs", "ad"]
+ >>> T = nx.prefix_tree(paths)
+ >>> list(T.edges)
+ [(0, 1), (1, 2), (1, 4), (2, -1), (2, 3), (3, -1), (4, -1)]
+
+ The leaf nodes can be obtained as predecessors of the nil node::
+
+ >>> root, NIL = 0, -1
+ >>> list(T.predecessors(NIL))
+ [2, 3, 4]
+
+ To recover the original paths that generated the prefix tree,
+ traverse up the tree from the node `-1` to the node `0`::
+
+ >>> recovered = []
+ >>> for v in T.predecessors(NIL):
+ ... prefix = ""
+ ... while v != root:
+ ... prefix = str(T.nodes[v]["source"]) + prefix
+ ... v = next(T.predecessors(v)) # only one predecessor
+ ... recovered.append(prefix)
+ >>> sorted(recovered)
+ ['ab', 'abs', 'ad']
+ """
+
+ def get_children(parent, paths):
+ children = defaultdict(list)
+ # Populate dictionary with key(s) as the child/children of the root and
+ # value(s) as the remaining paths of the corresponding child/children
+ for path in paths:
+ # If path is empty, we add an edge to the NIL node.
+ if not path:
+ tree.add_edge(parent, NIL)
+ continue
+ child, *rest = path
+ # `child` may exist as the head of more than one path in `paths`.
+ children[child].append(rest)
+ return children
+
+ # Initialize the prefix tree with a root node and a nil node.
+ tree = nx.DiGraph()
+ root = 0
+ tree.add_node(root, source=None)
+ NIL = -1
+ tree.add_node(NIL, source="NIL")
+ children = get_children(root, paths)
+ stack = [(root, iter(children.items()))]
+ while stack:
+ parent, remaining_children = stack[-1]
+ try:
+ child, remaining_paths = next(remaining_children)
+ # Pop item off stack if there are no remaining children
+ except StopIteration:
+ stack.pop()
+ continue
+ # We relabel each child with an unused name.
+ new_name = len(tree) - 1
+ # The "source" node attribute stores the original node name.
+ tree.add_node(new_name, source=child)
+ tree.add_edge(parent, new_name)
+ children = get_children(new_name, remaining_paths)
+ stack.append((new_name, iter(children.items())))
+
+ return tree
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def prefix_tree_recursive(paths):
+ """Recursively creates a directed prefix tree from a list of paths.
+
+ The original recursive version of prefix_tree for comparison. It is
+ the same algorithm but the recursion is unrolled onto a stack.
+
+ Usually the paths are described as strings or lists of integers.
+
+ A "prefix tree" represents the prefix structure of the strings.
+ Each node represents a prefix of some string. The root represents
+ the empty prefix with children for the single letter prefixes which
+ in turn have children for each double letter prefix starting with
+ the single letter corresponding to the parent node, and so on.
+
+ More generally the prefixes do not need to be strings. A prefix refers
+ to the start of a sequence. The root has children for each one element
+ prefix and they have children for each two element prefix that starts
+ with the one element sequence of the parent, and so on.
+
+ Note that this implementation uses integer nodes with an attribute.
+ Each node has an attribute "source" whose value is the original element
+ of the path to which this node corresponds. For example, suppose `paths`
+ consists of one path: "can". Then the nodes `[1, 2, 3]` which represent
+ this path have "source" values "c", "a" and "n".
+
+ All the descendants of a node have a common prefix in the sequence/path
+ associated with that node. From the returned tree, ehe prefix for each
+ node can be constructed by traversing the tree up to the root and
+ accumulating the "source" values along the way.
+
+ The root node is always `0` and has "source" attribute `None`.
+ The root is the only node with in-degree zero.
+ The nil node is always `-1` and has "source" attribute `"NIL"`.
+ The nil node is the only node with out-degree zero.
+
+
+ Parameters
+ ----------
+ paths: iterable of paths
+ An iterable of paths which are themselves sequences.
+ Matching prefixes among these sequences are identified with
+ nodes of the prefix tree. One leaf of the tree is associated
+ with each path. (Identical paths are associated with the same
+ leaf of the tree.)
+
+
+ Returns
+ -------
+ tree: DiGraph
+ A directed graph representing an arborescence consisting of the
+ prefix tree generated by `paths`. Nodes are directed "downward",
+ from parent to child. A special "synthetic" root node is added
+ to be the parent of the first node in each path. A special
+ "synthetic" leaf node, the "nil" node `-1`, is added to be the child
+ of all nodes representing the last element in a path. (The
+ addition of this nil node technically makes this not an
+ arborescence but a directed acyclic graph; removing the nil node
+ makes it an arborescence.)
+
+
+ Notes
+ -----
+ The prefix tree is also known as a *trie*.
+
+
+ Examples
+ --------
+ Create a prefix tree from a list of strings with common prefixes::
+
+ >>> paths = ["ab", "abs", "ad"]
+ >>> T = nx.prefix_tree(paths)
+ >>> list(T.edges)
+ [(0, 1), (1, 2), (1, 4), (2, -1), (2, 3), (3, -1), (4, -1)]
+
+ The leaf nodes can be obtained as predecessors of the nil node.
+
+ >>> root, NIL = 0, -1
+ >>> list(T.predecessors(NIL))
+ [2, 3, 4]
+
+ To recover the original paths that generated the prefix tree,
+ traverse up the tree from the node `-1` to the node `0`::
+
+ >>> recovered = []
+ >>> for v in T.predecessors(NIL):
+ ... prefix = ""
+ ... while v != root:
+ ... prefix = str(T.nodes[v]["source"]) + prefix
+ ... v = next(T.predecessors(v)) # only one predecessor
+ ... recovered.append(prefix)
+ >>> sorted(recovered)
+ ['ab', 'abs', 'ad']
+ """
+
+ def _helper(paths, root, tree):
+ """Recursively create a trie from the given list of paths.
+
+ `paths` is a list of paths, each of which is itself a list of
+ nodes, relative to the given `root` (but not including it). This
+ list of paths will be interpreted as a tree-like structure, in
+ which two paths that share a prefix represent two branches of
+ the tree with the same initial segment.
+
+ `root` is the parent of the node at index 0 in each path.
+
+ `tree` is the "accumulator", the :class:`networkx.DiGraph`
+ representing the branching to which the new nodes and edges will
+ be added.
+
+ """
+ # For each path, remove the first node and make it a child of root.
+ # Any remaining paths then get processed recursively.
+ children = defaultdict(list)
+ for path in paths:
+ # If path is empty, we add an edge to the NIL node.
+ if not path:
+ tree.add_edge(root, NIL)
+ continue
+ child, *rest = path
+ # `child` may exist as the head of more than one path in `paths`.
+ children[child].append(rest)
+ # Add a node for each child, connect root, recurse to remaining paths
+ for child, remaining_paths in children.items():
+ # We relabel each child with an unused name.
+ new_name = len(tree) - 1
+ # The "source" node attribute stores the original node name.
+ tree.add_node(new_name, source=child)
+ tree.add_edge(root, new_name)
+ _helper(remaining_paths, new_name, tree)
+
+ # Initialize the prefix tree with a root node and a nil node.
+ tree = nx.DiGraph()
+ root = 0
+ tree.add_node(root, source=None)
+ NIL = -1
+ tree.add_node(NIL, source="NIL")
+ # Populate the tree.
+ _helper(paths, root, tree)
+ return tree
+
+
+@py_random_state("seed")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_labeled_tree(n, *, seed=None):
+ """Returns a labeled tree on `n` nodes chosen uniformly at random.
+
+ Generating uniformly distributed random Prüfer sequences and
+ converting them into the corresponding trees is a straightforward
+ method of generating uniformly distributed random labeled trees.
+ This function implements this method.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes, greater than zero.
+ seed : random_state
+ Indicator of random number generation state.
+ See :ref:`Randomness`
+
+ Returns
+ -------
+ :class:`networkx.Graph`
+ A `networkx.Graph` with nodes in the set {0, …, *n* - 1}.
+
+ Raises
+ ------
+ NetworkXPointlessConcept
+ If `n` is zero (because the null graph is not a tree).
+
+ Examples
+ --------
+ >>> G = nx.random_labeled_tree(5, seed=42)
+ >>> nx.is_tree(G)
+ True
+ >>> G.edges
+ EdgeView([(0, 1), (0, 3), (0, 2), (2, 4)])
+
+ A tree with *arbitrarily directed* edges can be created by assigning
+ generated edges to a ``DiGraph``:
+
+ >>> DG = nx.DiGraph()
+ >>> DG.add_edges_from(G.edges)
+ >>> nx.is_tree(DG)
+ True
+ >>> DG.edges
+ OutEdgeView([(0, 1), (0, 3), (0, 2), (2, 4)])
+ """
+ # Cannot create a Prüfer sequence unless `n` is at least two.
+ if n == 0:
+ raise nx.NetworkXPointlessConcept("the null graph is not a tree")
+ if n == 1:
+ return nx.empty_graph(1)
+ return nx.from_prufer_sequence([seed.choice(range(n)) for i in range(n - 2)])
+
+
+@py_random_state("seed")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_labeled_rooted_tree(n, *, seed=None):
+ """Returns a labeled rooted tree with `n` nodes.
+
+ The returned tree is chosen uniformly at random from all labeled rooted trees.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ :class:`networkx.Graph`
+ A `networkx.Graph` with integer nodes 0 <= node <= `n` - 1.
+ The root of the tree is selected uniformly from the nodes.
+ The "root" graph attribute identifies the root of the tree.
+
+ Notes
+ -----
+ This function returns the result of :func:`random_labeled_tree`
+ with a randomly selected root.
+
+ Raises
+ ------
+ NetworkXPointlessConcept
+ If `n` is zero (because the null graph is not a tree).
+ """
+ t = random_labeled_tree(n, seed=seed)
+ t.graph["root"] = seed.randint(0, n - 1)
+ return t
+
+
+@py_random_state("seed")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_labeled_rooted_forest(n, *, seed=None):
+ """Returns a labeled rooted forest with `n` nodes.
+
+ The returned forest is chosen uniformly at random using a
+ generalization of Prüfer sequences [1]_ in the form described in [2]_.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ seed : random_state
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ :class:`networkx.Graph`
+ A `networkx.Graph` with integer nodes 0 <= node <= `n` - 1.
+ The "roots" graph attribute is a set of integers containing the roots.
+
+ References
+ ----------
+ .. [1] Knuth, Donald E. "Another Enumeration of Trees."
+ Canadian Journal of Mathematics, 20 (1968): 1077-1086.
+ https://doi.org/10.4153/CJM-1968-104-8
+ .. [2] Rubey, Martin. "Counting Spanning Trees". Diplomarbeit
+ zur Erlangung des akademischen Grades Magister der
+ Naturwissenschaften an der Formal- und Naturwissenschaftlichen
+ Fakultät der Universität Wien. Wien, May 2000.
+ """
+
+ # Select the number of roots by iterating over the cumulative count of trees
+ # with at most k roots
+ def _select_k(n, seed):
+ r = seed.randint(0, (n + 1) ** (n - 1) - 1)
+ cum_sum = 0
+ for k in range(1, n):
+ cum_sum += (factorial(n - 1) * n ** (n - k)) // (
+ factorial(k - 1) * factorial(n - k)
+ )
+ if r < cum_sum:
+ return k
+
+ return n
+
+ F = nx.empty_graph(n)
+ if n == 0:
+ F.graph["roots"] = {}
+ return F
+ # Select the number of roots k
+ k = _select_k(n, seed)
+ if k == n:
+ F.graph["roots"] = set(range(n))
+ return F # Nothing to do
+ # Select the roots
+ roots = seed.sample(range(n), k)
+ # Nonroots
+ p = set(range(n)).difference(roots)
+ # Coding sequence
+ N = [seed.randint(0, n - 1) for i in range(n - k - 1)]
+ # Multiset of elements in N also in p
+ degree = Counter([x for x in N if x in p])
+ # Iterator over the elements of p with degree zero
+ iterator = iter(x for x in p if degree[x] == 0)
+ u = last = next(iterator)
+ # This loop is identical to that for Prüfer sequences,
+ # except that we can draw nodes only from p
+ for v in N:
+ F.add_edge(u, v)
+ degree[v] -= 1
+ if v < last and degree[v] == 0:
+ u = v
+ else:
+ last = u = next(iterator)
+
+ F.add_edge(u, roots[0])
+ F.graph["roots"] = set(roots)
+ return F
+
+
+# The following functions support generation of unlabeled trees and forests.
+
+
+def _to_nx(edges, n_nodes, root=None, roots=None):
+ """
+ Converts the (edges, n_nodes) input to a :class:`networkx.Graph`.
+ The (edges, n_nodes) input is a list of even length, where each pair
+ of consecutive integers represents an edge, and an integer `n_nodes`.
+ Integers in the list are elements of `range(n_nodes)`.
+
+ Parameters
+ ----------
+ edges : list of ints
+ The flattened list of edges of the graph.
+ n_nodes : int
+ The number of nodes of the graph.
+ root: int (default=None)
+ If not None, the "root" attribute of the graph will be set to this value.
+ roots: collection of ints (default=None)
+ If not None, he "roots" attribute of the graph will be set to this value.
+
+ Returns
+ -------
+ :class:`networkx.Graph`
+ The graph with `n_nodes` nodes and edges given by `edges`.
+ """
+ G = nx.empty_graph(n_nodes)
+ G.add_edges_from(edges)
+ if root is not None:
+ G.graph["root"] = root
+ if roots is not None:
+ G.graph["roots"] = roots
+ return G
+
+
+def _num_rooted_trees(n, cache_trees):
+ """Returns the number of unlabeled rooted trees with `n` nodes.
+
+ See also https://oeis.org/A000081.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ cache_trees : list of ints
+ The $i$-th element is the number of unlabeled rooted trees with $i$ nodes,
+ which is used as a cache (and is extended to length $n+1$ if needed)
+
+ Returns
+ -------
+ int
+ The number of unlabeled rooted trees with `n` nodes.
+ """
+ for n_i in range(len(cache_trees), n + 1):
+ cache_trees.append(
+ sum(
+ [
+ d * cache_trees[n_i - j * d] * cache_trees[d]
+ for d in range(1, n_i)
+ for j in range(1, (n_i - 1) // d + 1)
+ ]
+ )
+ // (n_i - 1)
+ )
+ return cache_trees[n]
+
+
+def _select_jd_trees(n, cache_trees, seed):
+ """Returns a pair $(j,d)$ with a specific probability
+
+ Given $n$, returns a pair of positive integers $(j,d)$ with the probability
+ specified in formula (5) of Chapter 29 of [1]_.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ cache_trees : list of ints
+ Cache for :func:`_num_rooted_trees`.
+ seed : random_state
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ (int, int)
+ A pair of positive integers $(j,d)$ satisfying formula (5) of
+ Chapter 29 of [1]_.
+
+ References
+ ----------
+ .. [1] Nijenhuis, Albert, and Wilf, Herbert S.
+ "Combinatorial algorithms: for computers and calculators."
+ Academic Press, 1978.
+ https://doi.org/10.1016/C2013-0-11243-3
+ """
+ p = seed.randint(0, _num_rooted_trees(n, cache_trees) * (n - 1) - 1)
+ cumsum = 0
+ for d in range(n - 1, 0, -1):
+ for j in range(1, (n - 1) // d + 1):
+ cumsum += (
+ d
+ * _num_rooted_trees(n - j * d, cache_trees)
+ * _num_rooted_trees(d, cache_trees)
+ )
+ if p < cumsum:
+ return (j, d)
+
+
+def _random_unlabeled_rooted_tree(n, cache_trees, seed):
+ """Returns an unlabeled rooted tree with `n` nodes.
+
+ Returns an unlabeled rooted tree with `n` nodes chosen uniformly
+ at random using the "RANRUT" algorithm from [1]_.
+ The tree is returned in the form: (list_of_edges, number_of_nodes)
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes, greater than zero.
+ cache_trees : list ints
+ Cache for :func:`_num_rooted_trees`.
+ seed : random_state
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ (list_of_edges, number_of_nodes) : list, int
+ A random unlabeled rooted tree with `n` nodes as a 2-tuple
+ ``(list_of_edges, number_of_nodes)``.
+ The root is node 0.
+
+ References
+ ----------
+ .. [1] Nijenhuis, Albert, and Wilf, Herbert S.
+ "Combinatorial algorithms: for computers and calculators."
+ Academic Press, 1978.
+ https://doi.org/10.1016/C2013-0-11243-3
+ """
+ if n == 1:
+ edges, n_nodes = [], 1
+ return edges, n_nodes
+ if n == 2:
+ edges, n_nodes = [(0, 1)], 2
+ return edges, n_nodes
+
+ j, d = _select_jd_trees(n, cache_trees, seed)
+ t1, t1_nodes = _random_unlabeled_rooted_tree(n - j * d, cache_trees, seed)
+ t2, t2_nodes = _random_unlabeled_rooted_tree(d, cache_trees, seed)
+ t12 = [(0, t2_nodes * i + t1_nodes) for i in range(j)]
+ t1.extend(t12)
+ for _ in range(j):
+ t1.extend((n1 + t1_nodes, n2 + t1_nodes) for n1, n2 in t2)
+ t1_nodes += t2_nodes
+
+ return t1, t1_nodes
+
+
+@py_random_state("seed")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_unlabeled_rooted_tree(n, *, number_of_trees=None, seed=None):
+ """Returns a number of unlabeled rooted trees uniformly at random
+
+ Returns one or more (depending on `number_of_trees`)
+ unlabeled rooted trees with `n` nodes drawn uniformly
+ at random.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ number_of_trees : int or None (default)
+ If not None, this number of trees is generated and returned.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ :class:`networkx.Graph` or list of :class:`networkx.Graph`
+ A single `networkx.Graph` (or a list thereof, if `number_of_trees`
+ is specified) with nodes in the set {0, …, *n* - 1}.
+ The "root" graph attribute identifies the root of the tree.
+
+ Notes
+ -----
+ The trees are generated using the "RANRUT" algorithm from [1]_.
+ The algorithm needs to compute some counting functions
+ that are relatively expensive: in case several trees are needed,
+ it is advisable to use the `number_of_trees` optional argument
+ to reuse the counting functions.
+
+ Raises
+ ------
+ NetworkXPointlessConcept
+ If `n` is zero (because the null graph is not a tree).
+
+ References
+ ----------
+ .. [1] Nijenhuis, Albert, and Wilf, Herbert S.
+ "Combinatorial algorithms: for computers and calculators."
+ Academic Press, 1978.
+ https://doi.org/10.1016/C2013-0-11243-3
+ """
+ if n == 0:
+ raise nx.NetworkXPointlessConcept("the null graph is not a tree")
+ cache_trees = [0, 1] # initial cache of number of rooted trees
+ if number_of_trees is None:
+ return _to_nx(*_random_unlabeled_rooted_tree(n, cache_trees, seed), root=0)
+ return [
+ _to_nx(*_random_unlabeled_rooted_tree(n, cache_trees, seed), root=0)
+ for i in range(number_of_trees)
+ ]
+
+
+def _num_rooted_forests(n, q, cache_forests):
+ """Returns the number of unlabeled rooted forests with `n` nodes, and with
+ no more than `q` nodes per tree. A recursive formula for this is (2) in
+ [1]_. This function is implemented using dynamic programming instead of
+ recursion.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ q : int
+ The maximum number of nodes for each tree of the forest.
+ cache_forests : list of ints
+ The $i$-th element is the number of unlabeled rooted forests with
+ $i$ nodes, and with no more than `q` nodes per tree; this is used
+ as a cache (and is extended to length `n` + 1 if needed).
+
+ Returns
+ -------
+ int
+ The number of unlabeled rooted forests with `n` nodes with no more than
+ `q` nodes per tree.
+
+ References
+ ----------
+ .. [1] Wilf, Herbert S. "The uniform selection of free trees."
+ Journal of Algorithms 2.2 (1981): 204-207.
+ https://doi.org/10.1016/0196-6774(81)90021-3
+ """
+ for n_i in range(len(cache_forests), n + 1):
+ q_i = min(n_i, q)
+ cache_forests.append(
+ sum(
+ [
+ d * cache_forests[n_i - j * d] * cache_forests[d - 1]
+ for d in range(1, q_i + 1)
+ for j in range(1, n_i // d + 1)
+ ]
+ )
+ // n_i
+ )
+
+ return cache_forests[n]
+
+
+def _select_jd_forests(n, q, cache_forests, seed):
+ """Given `n` and `q`, returns a pair of positive integers $(j,d)$
+ such that $j\\leq d$, with probability satisfying (F1) of [1]_.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ q : int
+ The maximum number of nodes for each tree of the forest.
+ cache_forests : list of ints
+ Cache for :func:`_num_rooted_forests`.
+ seed : random_state
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ (int, int)
+ A pair of positive integers $(j,d)$
+
+ References
+ ----------
+ .. [1] Wilf, Herbert S. "The uniform selection of free trees."
+ Journal of Algorithms 2.2 (1981): 204-207.
+ https://doi.org/10.1016/0196-6774(81)90021-3
+ """
+ p = seed.randint(0, _num_rooted_forests(n, q, cache_forests) * n - 1)
+ cumsum = 0
+ for d in range(q, 0, -1):
+ for j in range(1, n // d + 1):
+ cumsum += (
+ d
+ * _num_rooted_forests(n - j * d, q, cache_forests)
+ * _num_rooted_forests(d - 1, q, cache_forests)
+ )
+ if p < cumsum:
+ return (j, d)
+
+
+def _random_unlabeled_rooted_forest(n, q, cache_trees, cache_forests, seed):
+ """Returns an unlabeled rooted forest with `n` nodes, and with no more
+ than `q` nodes per tree, drawn uniformly at random. It is an implementation
+ of the algorithm "Forest" of [1]_.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ q : int
+ The maximum number of nodes per tree.
+ cache_trees :
+ Cache for :func:`_num_rooted_trees`.
+ cache_forests :
+ Cache for :func:`_num_rooted_forests`.
+ seed : random_state
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ (edges, n, r) : (list, int, list)
+ The forest (edges, n) and a list r of root nodes.
+
+ References
+ ----------
+ .. [1] Wilf, Herbert S. "The uniform selection of free trees."
+ Journal of Algorithms 2.2 (1981): 204-207.
+ https://doi.org/10.1016/0196-6774(81)90021-3
+ """
+ if n == 0:
+ return ([], 0, [])
+
+ j, d = _select_jd_forests(n, q, cache_forests, seed)
+ t1, t1_nodes, r1 = _random_unlabeled_rooted_forest(
+ n - j * d, q, cache_trees, cache_forests, seed
+ )
+ t2, t2_nodes = _random_unlabeled_rooted_tree(d, cache_trees, seed)
+ for _ in range(j):
+ r1.append(t1_nodes)
+ t1.extend((n1 + t1_nodes, n2 + t1_nodes) for n1, n2 in t2)
+ t1_nodes += t2_nodes
+ return t1, t1_nodes, r1
+
+
+@py_random_state("seed")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_unlabeled_rooted_forest(n, *, q=None, number_of_forests=None, seed=None):
+ """Returns a forest or list of forests selected at random.
+
+ Returns one or more (depending on `number_of_forests`)
+ unlabeled rooted forests with `n` nodes, and with no more than
+ `q` nodes per tree, drawn uniformly at random.
+ The "roots" graph attribute identifies the roots of the forest.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ q : int or None (default)
+ The maximum number of nodes per tree.
+ number_of_forests : int or None (default)
+ If not None, this number of forests is generated and returned.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ :class:`networkx.Graph` or list of :class:`networkx.Graph`
+ A single `networkx.Graph` (or a list thereof, if `number_of_forests`
+ is specified) with nodes in the set {0, …, *n* - 1}.
+ The "roots" graph attribute is a set containing the roots
+ of the trees in the forest.
+
+ Notes
+ -----
+ This function implements the algorithm "Forest" of [1]_.
+ The algorithm needs to compute some counting functions
+ that are relatively expensive: in case several trees are needed,
+ it is advisable to use the `number_of_forests` optional argument
+ to reuse the counting functions.
+
+ Raises
+ ------
+ ValueError
+ If `n` is non-zero but `q` is zero.
+
+ References
+ ----------
+ .. [1] Wilf, Herbert S. "The uniform selection of free trees."
+ Journal of Algorithms 2.2 (1981): 204-207.
+ https://doi.org/10.1016/0196-6774(81)90021-3
+ """
+ if q is None:
+ q = n
+ if q == 0 and n != 0:
+ raise ValueError("q must be a positive integer if n is positive.")
+
+ cache_trees = [0, 1] # initial cache of number of rooted trees
+ cache_forests = [1] # initial cache of number of rooted forests
+
+ if number_of_forests is None:
+ g, nodes, rs = _random_unlabeled_rooted_forest(
+ n, q, cache_trees, cache_forests, seed
+ )
+ return _to_nx(g, nodes, roots=set(rs))
+
+ res = []
+ for i in range(number_of_forests):
+ g, nodes, rs = _random_unlabeled_rooted_forest(
+ n, q, cache_trees, cache_forests, seed
+ )
+ res.append(_to_nx(g, nodes, roots=set(rs)))
+ return res
+
+
+def _num_trees(n, cache_trees):
+ """Returns the number of unlabeled trees with `n` nodes.
+
+ See also https://oeis.org/A000055.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes.
+ cache_trees : list of ints
+ Cache for :func:`_num_rooted_trees`.
+
+ Returns
+ -------
+ int
+ The number of unlabeled trees with `n` nodes.
+ """
+ r = _num_rooted_trees(n, cache_trees) - sum(
+ [
+ _num_rooted_trees(j, cache_trees) * _num_rooted_trees(n - j, cache_trees)
+ for j in range(1, n // 2 + 1)
+ ]
+ )
+ if n % 2 == 0:
+ r += comb(_num_rooted_trees(n // 2, cache_trees) + 1, 2)
+ return r
+
+
+def _bicenter(n, cache, seed):
+ """Returns a bi-centroidal tree on `n` nodes drawn uniformly at random.
+
+ This function implements the algorithm Bicenter of [1]_.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes (must be even).
+ cache : list of ints.
+ Cache for :func:`_num_rooted_trees`.
+ seed : random_state
+ See :ref:`Randomness`
+
+ Returns
+ -------
+ (edges, n)
+ The tree as a list of edges and number of nodes.
+
+ References
+ ----------
+ .. [1] Wilf, Herbert S. "The uniform selection of free trees."
+ Journal of Algorithms 2.2 (1981): 204-207.
+ https://doi.org/10.1016/0196-6774(81)90021-3
+ """
+ t, t_nodes = _random_unlabeled_rooted_tree(n // 2, cache, seed)
+ if seed.randint(0, _num_rooted_trees(n // 2, cache)) == 0:
+ t2, t2_nodes = t, t_nodes
+ else:
+ t2, t2_nodes = _random_unlabeled_rooted_tree(n // 2, cache, seed)
+ t.extend([(n1 + (n // 2), n2 + (n // 2)) for n1, n2 in t2])
+ t.append((0, n // 2))
+ return t, t_nodes + t2_nodes
+
+
+def _random_unlabeled_tree(n, cache_trees, cache_forests, seed):
+ """Returns a tree on `n` nodes drawn uniformly at random.
+ It implements the Wilf's algorithm "Free" of [1]_.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes, greater than zero.
+ cache_trees : list of ints
+ Cache for :func:`_num_rooted_trees`.
+ cache_forests : list of ints
+ Cache for :func:`_num_rooted_forests`.
+ seed : random_state
+ Indicator of random number generation state.
+ See :ref:`Randomness`
+
+ Returns
+ -------
+ (edges, n)
+ The tree as a list of edges and number of nodes.
+
+ References
+ ----------
+ .. [1] Wilf, Herbert S. "The uniform selection of free trees."
+ Journal of Algorithms 2.2 (1981): 204-207.
+ https://doi.org/10.1016/0196-6774(81)90021-3
+ """
+ if n % 2 == 1:
+ p = 0
+ else:
+ p = comb(_num_rooted_trees(n // 2, cache_trees) + 1, 2)
+ if seed.randint(0, _num_trees(n, cache_trees) - 1) < p:
+ return _bicenter(n, cache_trees, seed)
+ else:
+ f, n_f, r = _random_unlabeled_rooted_forest(
+ n - 1, (n - 1) // 2, cache_trees, cache_forests, seed
+ )
+ for i in r:
+ f.append((i, n_f))
+ return f, n_f + 1
+
+
+@py_random_state("seed")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def random_unlabeled_tree(n, *, number_of_trees=None, seed=None):
+ """Returns a tree or list of trees chosen randomly.
+
+ Returns one or more (depending on `number_of_trees`)
+ unlabeled trees with `n` nodes drawn uniformly at random.
+
+ Parameters
+ ----------
+ n : int
+ The number of nodes
+ number_of_trees : int or None (default)
+ If not None, this number of trees is generated and returned.
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ :class:`networkx.Graph` or list of :class:`networkx.Graph`
+ A single `networkx.Graph` (or a list thereof, if
+ `number_of_trees` is specified) with nodes in the set {0, …, *n* - 1}.
+
+ Raises
+ ------
+ NetworkXPointlessConcept
+ If `n` is zero (because the null graph is not a tree).
+
+ Notes
+ -----
+ This function generates an unlabeled tree uniformly at random using
+ Wilf's algorithm "Free" of [1]_. The algorithm needs to
+ compute some counting functions that are relatively expensive:
+ in case several trees are needed, it is advisable to use the
+ `number_of_trees` optional argument to reuse the counting
+ functions.
+
+ References
+ ----------
+ .. [1] Wilf, Herbert S. "The uniform selection of free trees."
+ Journal of Algorithms 2.2 (1981): 204-207.
+ https://doi.org/10.1016/0196-6774(81)90021-3
+ """
+ if n == 0:
+ raise nx.NetworkXPointlessConcept("the null graph is not a tree")
+
+ cache_trees = [0, 1] # initial cache of number of rooted trees
+ cache_forests = [1] # initial cache of number of rooted forests
+ if number_of_trees is None:
+ return _to_nx(*_random_unlabeled_tree(n, cache_trees, cache_forests, seed))
+ else:
+ return [
+ _to_nx(*_random_unlabeled_tree(n, cache_trees, cache_forests, seed))
+ for i in range(number_of_trees)
+ ]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/triads.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/triads.py
new file mode 100644
index 0000000000000000000000000000000000000000..09b722dd1bd49dddae16086115d170ec989f8b06
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/generators/triads.py
@@ -0,0 +1,94 @@
+# See https://github.com/networkx/networkx/pull/1474
+# Copyright 2011 Reya Group
+# Copyright 2011 Alex Levenson
+# Copyright 2011 Diederik van Liere
+"""Functions that generate the triad graphs, that is, the possible
+digraphs on three nodes.
+
+"""
+
+import networkx as nx
+from networkx.classes import DiGraph
+
+__all__ = ["triad_graph"]
+
+#: Dictionary mapping triad name to list of directed edges in the
+#: digraph representation of that triad (with nodes 'a', 'b', and 'c').
+TRIAD_EDGES = {
+ "003": [],
+ "012": ["ab"],
+ "102": ["ab", "ba"],
+ "021D": ["ba", "bc"],
+ "021U": ["ab", "cb"],
+ "021C": ["ab", "bc"],
+ "111D": ["ac", "ca", "bc"],
+ "111U": ["ac", "ca", "cb"],
+ "030T": ["ab", "cb", "ac"],
+ "030C": ["ba", "cb", "ac"],
+ "201": ["ab", "ba", "ac", "ca"],
+ "120D": ["bc", "ba", "ac", "ca"],
+ "120U": ["ab", "cb", "ac", "ca"],
+ "120C": ["ab", "bc", "ac", "ca"],
+ "210": ["ab", "bc", "cb", "ac", "ca"],
+ "300": ["ab", "ba", "bc", "cb", "ac", "ca"],
+}
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def triad_graph(triad_name):
+ """Returns the triad graph with the given name.
+
+ Each string in the following tuple is a valid triad name::
+
+ (
+ "003",
+ "012",
+ "102",
+ "021D",
+ "021U",
+ "021C",
+ "111D",
+ "111U",
+ "030T",
+ "030C",
+ "201",
+ "120D",
+ "120U",
+ "120C",
+ "210",
+ "300",
+ )
+
+ Each triad name corresponds to one of the possible valid digraph on
+ three nodes.
+
+ Parameters
+ ----------
+ triad_name : string
+ The name of a triad, as described above.
+
+ Returns
+ -------
+ :class:`~networkx.DiGraph`
+ The digraph on three nodes with the given name. The nodes of the
+ graph are the single-character strings 'a', 'b', and 'c'.
+
+ Raises
+ ------
+ ValueError
+ If `triad_name` is not the name of a triad.
+
+ See also
+ --------
+ triadic_census
+
+ """
+ if triad_name not in TRIAD_EDGES:
+ raise ValueError(
+ f'unknown triad name "{triad_name}"; use one of the triad names'
+ " in the TRIAD_NAMES constant"
+ )
+ G = DiGraph()
+ G.add_nodes_from("abc")
+ G.add_edges_from(TRIAD_EDGES[triad_name])
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/lazy_imports.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/lazy_imports.py
new file mode 100644
index 0000000000000000000000000000000000000000..396404ba38f5885bfcc65af36d7b4655e94ccc27
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/lazy_imports.py
@@ -0,0 +1,188 @@
+import importlib
+import importlib.util
+import inspect
+import os
+import sys
+import types
+
+__all__ = ["attach", "_lazy_import"]
+
+
+def attach(module_name, submodules=None, submod_attrs=None):
+ """Attach lazily loaded submodules, and functions or other attributes.
+
+ Typically, modules import submodules and attributes as follows::
+
+ import mysubmodule
+ import anothersubmodule
+
+ from .foo import someattr
+
+ The idea of this function is to replace the `__init__.py`
+ module's `__getattr__`, `__dir__`, and `__all__` attributes such that
+ all imports work exactly the way they normally would, except that the
+ actual import is delayed until the resulting module object is first used.
+
+ The typical way to call this function, replacing the above imports, is::
+
+ __getattr__, __lazy_dir__, __all__ = lazy.attach(
+ __name__, ["mysubmodule", "anothersubmodule"], {"foo": "someattr"}
+ )
+
+ This functionality requires Python 3.7 or higher.
+
+ Parameters
+ ----------
+ module_name : str
+ Typically use __name__.
+ submodules : set
+ List of submodules to lazily import.
+ submod_attrs : dict
+ Dictionary of submodule -> list of attributes / functions.
+ These attributes are imported as they are used.
+
+ Returns
+ -------
+ __getattr__, __dir__, __all__
+
+ """
+ if submod_attrs is None:
+ submod_attrs = {}
+
+ if submodules is None:
+ submodules = set()
+ else:
+ submodules = set(submodules)
+
+ attr_to_modules = {
+ attr: mod for mod, attrs in submod_attrs.items() for attr in attrs
+ }
+
+ __all__ = list(submodules | attr_to_modules.keys())
+
+ def __getattr__(name):
+ if name in submodules:
+ return importlib.import_module(f"{module_name}.{name}")
+ elif name in attr_to_modules:
+ submod = importlib.import_module(f"{module_name}.{attr_to_modules[name]}")
+ return getattr(submod, name)
+ else:
+ raise AttributeError(f"No {module_name} attribute {name}")
+
+ def __dir__():
+ return __all__
+
+ if os.environ.get("EAGER_IMPORT", ""):
+ for attr in set(attr_to_modules.keys()) | submodules:
+ __getattr__(attr)
+
+ return __getattr__, __dir__, list(__all__)
+
+
+class DelayedImportErrorModule(types.ModuleType):
+ def __init__(self, frame_data, *args, **kwargs):
+ self.__frame_data = frame_data
+ super().__init__(*args, **kwargs)
+
+ def __getattr__(self, x):
+ if x in ("__class__", "__file__", "__frame_data"):
+ super().__getattr__(x)
+ else:
+ fd = self.__frame_data
+ raise ModuleNotFoundError(
+ f"No module named '{fd['spec']}'\n\n"
+ "This error is lazily reported, having originally occurred in\n"
+ f' File {fd["filename"]}, line {fd["lineno"]}, in {fd["function"]}\n\n'
+ f'----> {"".join(fd["code_context"] or "").strip()}'
+ )
+
+
+def _lazy_import(fullname):
+ """Return a lazily imported proxy for a module or library.
+
+ Warning
+ -------
+ Importing using this function can currently cause trouble
+ when the user tries to import from a subpackage of a module before
+ the package is fully imported. In particular, this idiom may not work:
+
+ np = lazy_import("numpy")
+ from numpy.lib import recfunctions
+
+ This is due to a difference in the way Python's LazyLoader handles
+ subpackage imports compared to the normal import process. Hopefully
+ we will get Python's LazyLoader to fix this, or find a workaround.
+ In the meantime, this is a potential problem.
+
+ The workaround is to import numpy before importing from the subpackage.
+
+ Notes
+ -----
+ We often see the following pattern::
+
+ def myfunc():
+ import scipy as sp
+ sp.argmin(...)
+ ....
+
+ This is to prevent a library, in this case `scipy`, from being
+ imported at function definition time, since that can be slow.
+
+ This function provides a proxy module that, upon access, imports
+ the actual module. So the idiom equivalent to the above example is::
+
+ sp = lazy.load("scipy")
+
+ def myfunc():
+ sp.argmin(...)
+ ....
+
+ The initial import time is fast because the actual import is delayed
+ until the first attribute is requested. The overall import time may
+ decrease as well for users that don't make use of large portions
+ of the library.
+
+ Parameters
+ ----------
+ fullname : str
+ The full name of the package or subpackage to import. For example::
+
+ sp = lazy.load("scipy") # import scipy as sp
+ spla = lazy.load("scipy.linalg") # import scipy.linalg as spla
+
+ Returns
+ -------
+ pm : importlib.util._LazyModule
+ Proxy module. Can be used like any regularly imported module.
+ Actual loading of the module occurs upon first attribute request.
+
+ """
+ try:
+ return sys.modules[fullname]
+ except:
+ pass
+
+ # Not previously loaded -- look it up
+ spec = importlib.util.find_spec(fullname)
+
+ if spec is None:
+ try:
+ parent = inspect.stack()[1]
+ frame_data = {
+ "spec": fullname,
+ "filename": parent.filename,
+ "lineno": parent.lineno,
+ "function": parent.function,
+ "code_context": parent.code_context,
+ }
+ return DelayedImportErrorModule(frame_data, "DelayedImportErrorModule")
+ finally:
+ del parent
+
+ module = importlib.util.module_from_spec(spec)
+ sys.modules[fullname] = module
+
+ loader = importlib.util.LazyLoader(spec.loader)
+ loader.exec_module(module)
+
+ return module
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..119db185a1ae440fd2cdb6c7f531331642313c34
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__init__.py
@@ -0,0 +1,13 @@
+from networkx.linalg.attrmatrix import *
+from networkx.linalg import attrmatrix
+from networkx.linalg.spectrum import *
+from networkx.linalg import spectrum
+from networkx.linalg.graphmatrix import *
+from networkx.linalg import graphmatrix
+from networkx.linalg.laplacianmatrix import *
+from networkx.linalg import laplacianmatrix
+from networkx.linalg.algebraicconnectivity import *
+from networkx.linalg.modularitymatrix import *
+from networkx.linalg import modularitymatrix
+from networkx.linalg.bethehessianmatrix import *
+from networkx.linalg import bethehessianmatrix
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/__init__.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..29844cfd915fc5f8017dfcef133b7b340d685ad1
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/__init__.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/algebraicconnectivity.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/algebraicconnectivity.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..56ecda54f89c24f553b3887396ca399e41879495
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/algebraicconnectivity.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/attrmatrix.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/attrmatrix.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cefdd6fc6c5ef655e25bc01af92418ccd97ed913
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/attrmatrix.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/bethehessianmatrix.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/bethehessianmatrix.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d5e4045675b2d2e05c8da8b564690727b6d3a4f5
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/bethehessianmatrix.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/graphmatrix.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/graphmatrix.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4160f94989c0df3ee4b41a86e75df331d91db4c9
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/graphmatrix.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/laplacianmatrix.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/laplacianmatrix.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ce9701ce9fcff89001c440fdbf6a3e36264c40dc
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/laplacianmatrix.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/modularitymatrix.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/modularitymatrix.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b78cbdcf9122d7a348604bc568a7b124d1445363
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/modularitymatrix.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/spectrum.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/spectrum.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a581262f17027a8a23e32300abaf213255b070f3
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/__pycache__/spectrum.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/algebraicconnectivity.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/algebraicconnectivity.py
new file mode 100644
index 0000000000000000000000000000000000000000..c94972a5c335569992f1cf19be5f55097cbdffd9
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/algebraicconnectivity.py
@@ -0,0 +1,657 @@
+"""
+Algebraic connectivity and Fiedler vectors of undirected graphs.
+"""
+
+from functools import partial
+
+import networkx as nx
+from networkx.utils import (
+ not_implemented_for,
+ np_random_state,
+ reverse_cuthill_mckee_ordering,
+)
+
+__all__ = [
+ "algebraic_connectivity",
+ "fiedler_vector",
+ "spectral_ordering",
+ "spectral_bisection",
+]
+
+
+class _PCGSolver:
+ """Preconditioned conjugate gradient method.
+
+ To solve Ax = b:
+ M = A.diagonal() # or some other preconditioner
+ solver = _PCGSolver(lambda x: A * x, lambda x: M * x)
+ x = solver.solve(b)
+
+ The inputs A and M are functions which compute
+ matrix multiplication on the argument.
+ A - multiply by the matrix A in Ax=b
+ M - multiply by M, the preconditioner surrogate for A
+
+ Warning: There is no limit on number of iterations.
+ """
+
+ def __init__(self, A, M):
+ self._A = A
+ self._M = M
+
+ def solve(self, B, tol):
+ import numpy as np
+
+ # Densifying step - can this be kept sparse?
+ B = np.asarray(B)
+ X = np.ndarray(B.shape, order="F")
+ for j in range(B.shape[1]):
+ X[:, j] = self._solve(B[:, j], tol)
+ return X
+
+ def _solve(self, b, tol):
+ import numpy as np
+ import scipy as sp
+
+ A = self._A
+ M = self._M
+ tol *= sp.linalg.blas.dasum(b)
+ # Initialize.
+ x = np.zeros(b.shape)
+ r = b.copy()
+ z = M(r)
+ rz = sp.linalg.blas.ddot(r, z)
+ p = z.copy()
+ # Iterate.
+ while True:
+ Ap = A(p)
+ alpha = rz / sp.linalg.blas.ddot(p, Ap)
+ x = sp.linalg.blas.daxpy(p, x, a=alpha)
+ r = sp.linalg.blas.daxpy(Ap, r, a=-alpha)
+ if sp.linalg.blas.dasum(r) < tol:
+ return x
+ z = M(r)
+ beta = sp.linalg.blas.ddot(r, z)
+ beta, rz = beta / rz, beta
+ p = sp.linalg.blas.daxpy(p, z, a=beta)
+
+
+class _LUSolver:
+ """LU factorization.
+
+ To solve Ax = b:
+ solver = _LUSolver(A)
+ x = solver.solve(b)
+
+ optional argument `tol` on solve method is ignored but included
+ to match _PCGsolver API.
+ """
+
+ def __init__(self, A):
+ import scipy as sp
+
+ self._LU = sp.sparse.linalg.splu(
+ A,
+ permc_spec="MMD_AT_PLUS_A",
+ diag_pivot_thresh=0.0,
+ options={"Equil": True, "SymmetricMode": True},
+ )
+
+ def solve(self, B, tol=None):
+ import numpy as np
+
+ B = np.asarray(B)
+ X = np.ndarray(B.shape, order="F")
+ for j in range(B.shape[1]):
+ X[:, j] = self._LU.solve(B[:, j])
+ return X
+
+
+def _preprocess_graph(G, weight):
+ """Compute edge weights and eliminate zero-weight edges."""
+ if G.is_directed():
+ H = nx.MultiGraph()
+ H.add_nodes_from(G)
+ H.add_weighted_edges_from(
+ ((u, v, e.get(weight, 1.0)) for u, v, e in G.edges(data=True) if u != v),
+ weight=weight,
+ )
+ G = H
+ if not G.is_multigraph():
+ edges = (
+ (u, v, abs(e.get(weight, 1.0))) for u, v, e in G.edges(data=True) if u != v
+ )
+ else:
+ edges = (
+ (u, v, sum(abs(e.get(weight, 1.0)) for e in G[u][v].values()))
+ for u, v in G.edges()
+ if u != v
+ )
+ H = nx.Graph()
+ H.add_nodes_from(G)
+ H.add_weighted_edges_from((u, v, e) for u, v, e in edges if e != 0)
+ return H
+
+
+def _rcm_estimate(G, nodelist):
+ """Estimate the Fiedler vector using the reverse Cuthill-McKee ordering."""
+ import numpy as np
+
+ G = G.subgraph(nodelist)
+ order = reverse_cuthill_mckee_ordering(G)
+ n = len(nodelist)
+ index = dict(zip(nodelist, range(n)))
+ x = np.ndarray(n, dtype=float)
+ for i, u in enumerate(order):
+ x[index[u]] = i
+ x -= (n - 1) / 2.0
+ return x
+
+
+def _tracemin_fiedler(L, X, normalized, tol, method):
+ """Compute the Fiedler vector of L using the TraceMIN-Fiedler algorithm.
+
+ The Fiedler vector of a connected undirected graph is the eigenvector
+ corresponding to the second smallest eigenvalue of the Laplacian matrix
+ of the graph. This function starts with the Laplacian L, not the Graph.
+
+ Parameters
+ ----------
+ L : Laplacian of a possibly weighted or normalized, but undirected graph
+
+ X : Initial guess for a solution. Usually a matrix of random numbers.
+ This function allows more than one column in X to identify more than
+ one eigenvector if desired.
+
+ normalized : bool
+ Whether the normalized Laplacian matrix is used.
+
+ tol : float
+ Tolerance of relative residual in eigenvalue computation.
+ Warning: There is no limit on number of iterations.
+
+ method : string
+ Should be 'tracemin_pcg' or 'tracemin_lu'.
+ Otherwise exception is raised.
+
+ Returns
+ -------
+ sigma, X : Two NumPy arrays of floats.
+ The lowest eigenvalues and corresponding eigenvectors of L.
+ The size of input X determines the size of these outputs.
+ As this is for Fiedler vectors, the zero eigenvalue (and
+ constant eigenvector) are avoided.
+ """
+ import numpy as np
+ import scipy as sp
+
+ n = X.shape[0]
+
+ if normalized:
+ # Form the normalized Laplacian matrix and determine the eigenvector of
+ # its nullspace.
+ e = np.sqrt(L.diagonal())
+ # TODO: rm csr_array wrapper when spdiags array creation becomes available
+ D = sp.sparse.csr_array(sp.sparse.spdiags(1 / e, 0, n, n, format="csr"))
+ L = D @ L @ D
+ e *= 1.0 / np.linalg.norm(e, 2)
+
+ if normalized:
+
+ def project(X):
+ """Make X orthogonal to the nullspace of L."""
+ X = np.asarray(X)
+ for j in range(X.shape[1]):
+ X[:, j] -= (X[:, j] @ e) * e
+
+ else:
+
+ def project(X):
+ """Make X orthogonal to the nullspace of L."""
+ X = np.asarray(X)
+ for j in range(X.shape[1]):
+ X[:, j] -= X[:, j].sum() / n
+
+ if method == "tracemin_pcg":
+ D = L.diagonal().astype(float)
+ solver = _PCGSolver(lambda x: L @ x, lambda x: D * x)
+ elif method == "tracemin_lu":
+ # Convert A to CSC to suppress SparseEfficiencyWarning.
+ A = sp.sparse.csc_array(L, dtype=float, copy=True)
+ # Force A to be nonsingular. Since A is the Laplacian matrix of a
+ # connected graph, its rank deficiency is one, and thus one diagonal
+ # element needs to modified. Changing to infinity forces a zero in the
+ # corresponding element in the solution.
+ i = (A.indptr[1:] - A.indptr[:-1]).argmax()
+ A[i, i] = np.inf
+ solver = _LUSolver(A)
+ else:
+ raise nx.NetworkXError(f"Unknown linear system solver: {method}")
+
+ # Initialize.
+ Lnorm = abs(L).sum(axis=1).flatten().max()
+ project(X)
+ W = np.ndarray(X.shape, order="F")
+
+ while True:
+ # Orthonormalize X.
+ X = np.linalg.qr(X)[0]
+ # Compute iteration matrix H.
+ W[:, :] = L @ X
+ H = X.T @ W
+ sigma, Y = sp.linalg.eigh(H, overwrite_a=True)
+ # Compute the Ritz vectors.
+ X = X @ Y
+ # Test for convergence exploiting the fact that L * X == W * Y.
+ res = sp.linalg.blas.dasum(W @ Y[:, 0] - sigma[0] * X[:, 0]) / Lnorm
+ if res < tol:
+ break
+ # Compute X = L \ X / (X' * (L \ X)).
+ # L \ X can have an arbitrary projection on the nullspace of L,
+ # which will be eliminated.
+ W[:, :] = solver.solve(X, tol)
+ X = (sp.linalg.inv(W.T @ X) @ W.T).T # Preserves Fortran storage order.
+ project(X)
+
+ return sigma, np.asarray(X)
+
+
+def _get_fiedler_func(method):
+ """Returns a function that solves the Fiedler eigenvalue problem."""
+ import numpy as np
+
+ if method == "tracemin": # old style keyword `.
+
+ Returns
+ -------
+ algebraic_connectivity : float
+ Algebraic connectivity.
+
+ Raises
+ ------
+ NetworkXNotImplemented
+ If G is directed.
+
+ NetworkXError
+ If G has less than two nodes.
+
+ Notes
+ -----
+ Edge weights are interpreted by their absolute values. For MultiGraph's,
+ weights of parallel edges are summed. Zero-weighted edges are ignored.
+
+ See Also
+ --------
+ laplacian_matrix
+
+ Examples
+ --------
+ For undirected graphs algebraic connectivity can tell us if a graph is connected or not
+ `G` is connected iff ``algebraic_connectivity(G) > 0``:
+
+ >>> G = nx.complete_graph(5)
+ >>> nx.algebraic_connectivity(G) > 0
+ True
+ >>> G.add_node(10) # G is no longer connected
+ >>> nx.algebraic_connectivity(G) > 0
+ False
+
+ """
+ if len(G) < 2:
+ raise nx.NetworkXError("graph has less than two nodes.")
+ G = _preprocess_graph(G, weight)
+ if not nx.is_connected(G):
+ return 0.0
+
+ L = nx.laplacian_matrix(G)
+ if L.shape[0] == 2:
+ return 2.0 * float(L[0, 0]) if not normalized else 2.0
+
+ find_fiedler = _get_fiedler_func(method)
+ x = None if method != "lobpcg" else _rcm_estimate(G, G)
+ sigma, fiedler = find_fiedler(L, x, normalized, tol, seed)
+ return float(sigma)
+
+
+@not_implemented_for("directed")
+@np_random_state(5)
+@nx._dispatchable(edge_attrs="weight")
+def fiedler_vector(
+ G, weight="weight", normalized=False, tol=1e-8, method="tracemin_pcg", seed=None
+):
+ """Returns the Fiedler vector of a connected undirected graph.
+
+ The Fiedler vector of a connected undirected graph is the eigenvector
+ corresponding to the second smallest eigenvalue of the Laplacian matrix
+ of the graph.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+ An undirected graph.
+
+ weight : object, optional (default: None)
+ The data key used to determine the weight of each edge. If None, then
+ each edge has unit weight.
+
+ normalized : bool, optional (default: False)
+ Whether the normalized Laplacian matrix is used.
+
+ tol : float, optional (default: 1e-8)
+ Tolerance of relative residual in eigenvalue computation.
+
+ method : string, optional (default: 'tracemin_pcg')
+ Method of eigenvalue computation. It must be one of the tracemin
+ options shown below (TraceMIN), 'lanczos' (Lanczos iteration)
+ or 'lobpcg' (LOBPCG).
+
+ The TraceMIN algorithm uses a linear system solver. The following
+ values allow specifying the solver to be used.
+
+ =============== ========================================
+ Value Solver
+ =============== ========================================
+ 'tracemin_pcg' Preconditioned conjugate gradient method
+ 'tracemin_lu' LU factorization
+ =============== ========================================
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ fiedler_vector : NumPy array of floats.
+ Fiedler vector.
+
+ Raises
+ ------
+ NetworkXNotImplemented
+ If G is directed.
+
+ NetworkXError
+ If G has less than two nodes or is not connected.
+
+ Notes
+ -----
+ Edge weights are interpreted by their absolute values. For MultiGraph's,
+ weights of parallel edges are summed. Zero-weighted edges are ignored.
+
+ See Also
+ --------
+ laplacian_matrix
+
+ Examples
+ --------
+ Given a connected graph the signs of the values in the Fiedler vector can be
+ used to partition the graph into two components.
+
+ >>> G = nx.barbell_graph(5, 0)
+ >>> nx.fiedler_vector(G, normalized=True, seed=1)
+ array([-0.32864129, -0.32864129, -0.32864129, -0.32864129, -0.26072899,
+ 0.26072899, 0.32864129, 0.32864129, 0.32864129, 0.32864129])
+
+ The connected components are the two 5-node cliques of the barbell graph.
+ """
+ import numpy as np
+
+ if len(G) < 2:
+ raise nx.NetworkXError("graph has less than two nodes.")
+ G = _preprocess_graph(G, weight)
+ if not nx.is_connected(G):
+ raise nx.NetworkXError("graph is not connected.")
+
+ if len(G) == 2:
+ return np.array([1.0, -1.0])
+
+ find_fiedler = _get_fiedler_func(method)
+ L = nx.laplacian_matrix(G)
+ x = None if method != "lobpcg" else _rcm_estimate(G, G)
+ sigma, fiedler = find_fiedler(L, x, normalized, tol, seed)
+ return fiedler
+
+
+@np_random_state(5)
+@nx._dispatchable(edge_attrs="weight")
+def spectral_ordering(
+ G, weight="weight", normalized=False, tol=1e-8, method="tracemin_pcg", seed=None
+):
+ """Compute the spectral_ordering of a graph.
+
+ The spectral ordering of a graph is an ordering of its nodes where nodes
+ in the same weakly connected components appear contiguous and ordered by
+ their corresponding elements in the Fiedler vector of the component.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+ A graph.
+
+ weight : object, optional (default: None)
+ The data key used to determine the weight of each edge. If None, then
+ each edge has unit weight.
+
+ normalized : bool, optional (default: False)
+ Whether the normalized Laplacian matrix is used.
+
+ tol : float, optional (default: 1e-8)
+ Tolerance of relative residual in eigenvalue computation.
+
+ method : string, optional (default: 'tracemin_pcg')
+ Method of eigenvalue computation. It must be one of the tracemin
+ options shown below (TraceMIN), 'lanczos' (Lanczos iteration)
+ or 'lobpcg' (LOBPCG).
+
+ The TraceMIN algorithm uses a linear system solver. The following
+ values allow specifying the solver to be used.
+
+ =============== ========================================
+ Value Solver
+ =============== ========================================
+ 'tracemin_pcg' Preconditioned conjugate gradient method
+ 'tracemin_lu' LU factorization
+ =============== ========================================
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ spectral_ordering : NumPy array of floats.
+ Spectral ordering of nodes.
+
+ Raises
+ ------
+ NetworkXError
+ If G is empty.
+
+ Notes
+ -----
+ Edge weights are interpreted by their absolute values. For MultiGraph's,
+ weights of parallel edges are summed. Zero-weighted edges are ignored.
+
+ See Also
+ --------
+ laplacian_matrix
+ """
+ if len(G) == 0:
+ raise nx.NetworkXError("graph is empty.")
+ G = _preprocess_graph(G, weight)
+
+ find_fiedler = _get_fiedler_func(method)
+ order = []
+ for component in nx.connected_components(G):
+ size = len(component)
+ if size > 2:
+ L = nx.laplacian_matrix(G, component)
+ x = None if method != "lobpcg" else _rcm_estimate(G, component)
+ sigma, fiedler = find_fiedler(L, x, normalized, tol, seed)
+ sort_info = zip(fiedler, range(size), component)
+ order.extend(u for x, c, u in sorted(sort_info))
+ else:
+ order.extend(component)
+
+ return order
+
+
+@nx._dispatchable(edge_attrs="weight")
+def spectral_bisection(
+ G, weight="weight", normalized=False, tol=1e-8, method="tracemin_pcg", seed=None
+):
+ """Bisect the graph using the Fiedler vector.
+
+ This method uses the Fiedler vector to bisect a graph.
+ The partition is defined by the nodes which are associated with
+ either positive or negative values in the vector.
+
+ Parameters
+ ----------
+ G : NetworkX Graph
+
+ weight : str, optional (default: weight)
+ The data key used to determine the weight of each edge. If None, then
+ each edge has unit weight.
+
+ normalized : bool, optional (default: False)
+ Whether the normalized Laplacian matrix is used.
+
+ tol : float, optional (default: 1e-8)
+ Tolerance of relative residual in eigenvalue computation.
+
+ method : string, optional (default: 'tracemin_pcg')
+ Method of eigenvalue computation. It must be one of the tracemin
+ options shown below (TraceMIN), 'lanczos' (Lanczos iteration)
+ or 'lobpcg' (LOBPCG).
+
+ The TraceMIN algorithm uses a linear system solver. The following
+ values allow specifying the solver to be used.
+
+ =============== ========================================
+ Value Solver
+ =============== ========================================
+ 'tracemin_pcg' Preconditioned conjugate gradient method
+ 'tracemin_lu' LU factorization
+ =============== ========================================
+
+ seed : integer, random_state, or None (default)
+ Indicator of random number generation state.
+ See :ref:`Randomness`.
+
+ Returns
+ -------
+ bisection : tuple of sets
+ Sets with the bisection of nodes
+
+ Examples
+ --------
+ >>> G = nx.barbell_graph(3, 0)
+ >>> nx.spectral_bisection(G)
+ ({0, 1, 2}, {3, 4, 5})
+
+ References
+ ----------
+ .. [1] M. E. J Newman 'Networks: An Introduction', pages 364-370
+ Oxford University Press 2011.
+ """
+ import numpy as np
+
+ v = nx.fiedler_vector(G, weight, normalized, tol, method, seed)
+ nodes = np.array(list(G))
+ pos_vals = v >= 0
+
+ return set(nodes[~pos_vals].tolist()), set(nodes[pos_vals].tolist())
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/attrmatrix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/attrmatrix.py
new file mode 100644
index 0000000000000000000000000000000000000000..b5a70492807bd5e5ea8571c66b3a12af41ca4edd
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/attrmatrix.py
@@ -0,0 +1,465 @@
+"""
+Functions for constructing matrix-like objects from graph attributes.
+"""
+
+import networkx as nx
+
+__all__ = ["attr_matrix", "attr_sparse_matrix"]
+
+
+def _node_value(G, node_attr):
+ """Returns a function that returns a value from G.nodes[u].
+
+ We return a function expecting a node as its sole argument. Then, in the
+ simplest scenario, the returned function will return G.nodes[u][node_attr].
+ However, we also handle the case when `node_attr` is None or when it is a
+ function itself.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ node_attr : {None, str, callable}
+ Specification of how the value of the node attribute should be obtained
+ from the node attribute dictionary.
+
+ Returns
+ -------
+ value : function
+ A function expecting a node as its sole argument. The function will
+ returns a value from G.nodes[u] that depends on `edge_attr`.
+
+ """
+ if node_attr is None:
+
+ def value(u):
+ return u
+
+ elif not callable(node_attr):
+ # assume it is a key for the node attribute dictionary
+ def value(u):
+ return G.nodes[u][node_attr]
+
+ else:
+ # Advanced: Allow users to specify something else.
+ #
+ # For example,
+ # node_attr = lambda u: G.nodes[u].get('size', .5) * 3
+ #
+ value = node_attr
+
+ return value
+
+
+def _edge_value(G, edge_attr):
+ """Returns a function that returns a value from G[u][v].
+
+ Suppose there exists an edge between u and v. Then we return a function
+ expecting u and v as arguments. For Graph and DiGraph, G[u][v] is
+ the edge attribute dictionary, and the function (essentially) returns
+ G[u][v][edge_attr]. However, we also handle cases when `edge_attr` is None
+ and when it is a function itself. For MultiGraph and MultiDiGraph, G[u][v]
+ is a dictionary of all edges between u and v. In this case, the returned
+ function sums the value of `edge_attr` for every edge between u and v.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ edge_attr : {None, str, callable}
+ Specification of how the value of the edge attribute should be obtained
+ from the edge attribute dictionary, G[u][v]. For multigraphs, G[u][v]
+ is a dictionary of all the edges between u and v. This allows for
+ special treatment of multiedges.
+
+ Returns
+ -------
+ value : function
+ A function expecting two nodes as parameters. The nodes should
+ represent the from- and to- node of an edge. The function will
+ return a value from G[u][v] that depends on `edge_attr`.
+
+ """
+
+ if edge_attr is None:
+ # topological count of edges
+
+ if G.is_multigraph():
+
+ def value(u, v):
+ return len(G[u][v])
+
+ else:
+
+ def value(u, v):
+ return 1
+
+ elif not callable(edge_attr):
+ # assume it is a key for the edge attribute dictionary
+
+ if edge_attr == "weight":
+ # provide a default value
+ if G.is_multigraph():
+
+ def value(u, v):
+ return sum(d.get(edge_attr, 1) for d in G[u][v].values())
+
+ else:
+
+ def value(u, v):
+ return G[u][v].get(edge_attr, 1)
+
+ else:
+ # otherwise, the edge attribute MUST exist for each edge
+ if G.is_multigraph():
+
+ def value(u, v):
+ return sum(d[edge_attr] for d in G[u][v].values())
+
+ else:
+
+ def value(u, v):
+ return G[u][v][edge_attr]
+
+ else:
+ # Advanced: Allow users to specify something else.
+ #
+ # Alternative default value:
+ # edge_attr = lambda u,v: G[u][v].get('thickness', .5)
+ #
+ # Function on an attribute:
+ # edge_attr = lambda u,v: abs(G[u][v]['weight'])
+ #
+ # Handle Multi(Di)Graphs differently:
+ # edge_attr = lambda u,v: numpy.prod([d['size'] for d in G[u][v].values()])
+ #
+ # Ignore multiple edges
+ # edge_attr = lambda u,v: 1 if len(G[u][v]) else 0
+ #
+ value = edge_attr
+
+ return value
+
+
+@nx._dispatchable(edge_attrs={"edge_attr": None}, node_attrs="node_attr")
+def attr_matrix(
+ G,
+ edge_attr=None,
+ node_attr=None,
+ normalized=False,
+ rc_order=None,
+ dtype=None,
+ order=None,
+):
+ """Returns the attribute matrix using attributes from `G` as a numpy array.
+
+ If only `G` is passed in, then the adjacency matrix is constructed.
+
+ Let A be a discrete set of values for the node attribute `node_attr`. Then
+ the elements of A represent the rows and columns of the constructed matrix.
+ Now, iterate through every edge e=(u,v) in `G` and consider the value
+ of the edge attribute `edge_attr`. If ua and va are the values of the
+ node attribute `node_attr` for u and v, respectively, then the value of
+ the edge attribute is added to the matrix element at (ua, va).
+
+ Parameters
+ ----------
+ G : graph
+ The NetworkX graph used to construct the attribute matrix.
+
+ edge_attr : str, optional
+ Each element of the matrix represents a running total of the
+ specified edge attribute for edges whose node attributes correspond
+ to the rows/cols of the matrix. The attribute must be present for
+ all edges in the graph. If no attribute is specified, then we
+ just count the number of edges whose node attributes correspond
+ to the matrix element.
+
+ node_attr : str, optional
+ Each row and column in the matrix represents a particular value
+ of the node attribute. The attribute must be present for all nodes
+ in the graph. Note, the values of this attribute should be reliably
+ hashable. So, float values are not recommended. If no attribute is
+ specified, then the rows and columns will be the nodes of the graph.
+
+ normalized : bool, optional
+ If True, then each row is normalized by the summation of its values.
+
+ rc_order : list, optional
+ A list of the node attribute values. This list specifies the ordering
+ of rows and columns of the array. If no ordering is provided, then
+ the ordering will be random (and also, a return value).
+
+ Other Parameters
+ ----------------
+ dtype : NumPy data-type, optional
+ A valid NumPy dtype used to initialize the array. Keep in mind certain
+ dtypes can yield unexpected results if the array is to be normalized.
+ The parameter is passed to numpy.zeros(). If unspecified, the NumPy
+ default is used.
+
+ order : {'C', 'F'}, optional
+ Whether to store multidimensional data in C- or Fortran-contiguous
+ (row- or column-wise) order in memory. This parameter is passed to
+ numpy.zeros(). If unspecified, the NumPy default is used.
+
+ Returns
+ -------
+ M : 2D NumPy ndarray
+ The attribute matrix.
+
+ ordering : list
+ If `rc_order` was specified, then only the attribute matrix is returned.
+ However, if `rc_order` was None, then the ordering used to construct
+ the matrix is returned as well.
+
+ Examples
+ --------
+ Construct an adjacency matrix:
+
+ >>> G = nx.Graph()
+ >>> G.add_edge(0, 1, thickness=1, weight=3)
+ >>> G.add_edge(0, 2, thickness=2)
+ >>> G.add_edge(1, 2, thickness=3)
+ >>> nx.attr_matrix(G, rc_order=[0, 1, 2])
+ array([[0., 1., 1.],
+ [1., 0., 1.],
+ [1., 1., 0.]])
+
+ Alternatively, we can obtain the matrix describing edge thickness.
+
+ >>> nx.attr_matrix(G, edge_attr="thickness", rc_order=[0, 1, 2])
+ array([[0., 1., 2.],
+ [1., 0., 3.],
+ [2., 3., 0.]])
+
+ We can also color the nodes and ask for the probability distribution over
+ all edges (u,v) describing:
+
+ Pr(v has color Y | u has color X)
+
+ >>> G.nodes[0]["color"] = "red"
+ >>> G.nodes[1]["color"] = "red"
+ >>> G.nodes[2]["color"] = "blue"
+ >>> rc = ["red", "blue"]
+ >>> nx.attr_matrix(G, node_attr="color", normalized=True, rc_order=rc)
+ array([[0.33333333, 0.66666667],
+ [1. , 0. ]])
+
+ For example, the above tells us that for all edges (u,v):
+
+ Pr( v is red | u is red) = 1/3
+ Pr( v is blue | u is red) = 2/3
+
+ Pr( v is red | u is blue) = 1
+ Pr( v is blue | u is blue) = 0
+
+ Finally, we can obtain the total weights listed by the node colors.
+
+ >>> nx.attr_matrix(G, edge_attr="weight", node_attr="color", rc_order=rc)
+ array([[3., 2.],
+ [2., 0.]])
+
+ Thus, the total weight over all edges (u,v) with u and v having colors:
+
+ (red, red) is 3 # the sole contribution is from edge (0,1)
+ (red, blue) is 2 # contributions from edges (0,2) and (1,2)
+ (blue, red) is 2 # same as (red, blue) since graph is undirected
+ (blue, blue) is 0 # there are no edges with blue endpoints
+
+ """
+ import numpy as np
+
+ edge_value = _edge_value(G, edge_attr)
+ node_value = _node_value(G, node_attr)
+
+ if rc_order is None:
+ ordering = list({node_value(n) for n in G})
+ else:
+ ordering = rc_order
+
+ N = len(ordering)
+ undirected = not G.is_directed()
+ index = dict(zip(ordering, range(N)))
+ M = np.zeros((N, N), dtype=dtype, order=order)
+
+ seen = set()
+ for u, nbrdict in G.adjacency():
+ for v in nbrdict:
+ # Obtain the node attribute values.
+ i, j = index[node_value(u)], index[node_value(v)]
+ if v not in seen:
+ M[i, j] += edge_value(u, v)
+ if undirected:
+ M[j, i] = M[i, j]
+
+ if undirected:
+ seen.add(u)
+
+ if normalized:
+ M /= M.sum(axis=1).reshape((N, 1))
+
+ if rc_order is None:
+ return M, ordering
+ else:
+ return M
+
+
+@nx._dispatchable(edge_attrs={"edge_attr": None}, node_attrs="node_attr")
+def attr_sparse_matrix(
+ G, edge_attr=None, node_attr=None, normalized=False, rc_order=None, dtype=None
+):
+ """Returns a SciPy sparse array using attributes from G.
+
+ If only `G` is passed in, then the adjacency matrix is constructed.
+
+ Let A be a discrete set of values for the node attribute `node_attr`. Then
+ the elements of A represent the rows and columns of the constructed matrix.
+ Now, iterate through every edge e=(u,v) in `G` and consider the value
+ of the edge attribute `edge_attr`. If ua and va are the values of the
+ node attribute `node_attr` for u and v, respectively, then the value of
+ the edge attribute is added to the matrix element at (ua, va).
+
+ Parameters
+ ----------
+ G : graph
+ The NetworkX graph used to construct the NumPy matrix.
+
+ edge_attr : str, optional
+ Each element of the matrix represents a running total of the
+ specified edge attribute for edges whose node attributes correspond
+ to the rows/cols of the matrix. The attribute must be present for
+ all edges in the graph. If no attribute is specified, then we
+ just count the number of edges whose node attributes correspond
+ to the matrix element.
+
+ node_attr : str, optional
+ Each row and column in the matrix represents a particular value
+ of the node attribute. The attribute must be present for all nodes
+ in the graph. Note, the values of this attribute should be reliably
+ hashable. So, float values are not recommended. If no attribute is
+ specified, then the rows and columns will be the nodes of the graph.
+
+ normalized : bool, optional
+ If True, then each row is normalized by the summation of its values.
+
+ rc_order : list, optional
+ A list of the node attribute values. This list specifies the ordering
+ of rows and columns of the array. If no ordering is provided, then
+ the ordering will be random (and also, a return value).
+
+ Other Parameters
+ ----------------
+ dtype : NumPy data-type, optional
+ A valid NumPy dtype used to initialize the array. Keep in mind certain
+ dtypes can yield unexpected results if the array is to be normalized.
+ The parameter is passed to numpy.zeros(). If unspecified, the NumPy
+ default is used.
+
+ Returns
+ -------
+ M : SciPy sparse array
+ The attribute matrix.
+
+ ordering : list
+ If `rc_order` was specified, then only the matrix is returned.
+ However, if `rc_order` was None, then the ordering used to construct
+ the matrix is returned as well.
+
+ Examples
+ --------
+ Construct an adjacency matrix:
+
+ >>> G = nx.Graph()
+ >>> G.add_edge(0, 1, thickness=1, weight=3)
+ >>> G.add_edge(0, 2, thickness=2)
+ >>> G.add_edge(1, 2, thickness=3)
+ >>> M = nx.attr_sparse_matrix(G, rc_order=[0, 1, 2])
+ >>> M.toarray()
+ array([[0., 1., 1.],
+ [1., 0., 1.],
+ [1., 1., 0.]])
+
+ Alternatively, we can obtain the matrix describing edge thickness.
+
+ >>> M = nx.attr_sparse_matrix(G, edge_attr="thickness", rc_order=[0, 1, 2])
+ >>> M.toarray()
+ array([[0., 1., 2.],
+ [1., 0., 3.],
+ [2., 3., 0.]])
+
+ We can also color the nodes and ask for the probability distribution over
+ all edges (u,v) describing:
+
+ Pr(v has color Y | u has color X)
+
+ >>> G.nodes[0]["color"] = "red"
+ >>> G.nodes[1]["color"] = "red"
+ >>> G.nodes[2]["color"] = "blue"
+ >>> rc = ["red", "blue"]
+ >>> M = nx.attr_sparse_matrix(G, node_attr="color", normalized=True, rc_order=rc)
+ >>> M.toarray()
+ array([[0.33333333, 0.66666667],
+ [1. , 0. ]])
+
+ For example, the above tells us that for all edges (u,v):
+
+ Pr( v is red | u is red) = 1/3
+ Pr( v is blue | u is red) = 2/3
+
+ Pr( v is red | u is blue) = 1
+ Pr( v is blue | u is blue) = 0
+
+ Finally, we can obtain the total weights listed by the node colors.
+
+ >>> M = nx.attr_sparse_matrix(G, edge_attr="weight", node_attr="color", rc_order=rc)
+ >>> M.toarray()
+ array([[3., 2.],
+ [2., 0.]])
+
+ Thus, the total weight over all edges (u,v) with u and v having colors:
+
+ (red, red) is 3 # the sole contribution is from edge (0,1)
+ (red, blue) is 2 # contributions from edges (0,2) and (1,2)
+ (blue, red) is 2 # same as (red, blue) since graph is undirected
+ (blue, blue) is 0 # there are no edges with blue endpoints
+
+ """
+ import numpy as np
+ import scipy as sp
+
+ edge_value = _edge_value(G, edge_attr)
+ node_value = _node_value(G, node_attr)
+
+ if rc_order is None:
+ ordering = list({node_value(n) for n in G})
+ else:
+ ordering = rc_order
+
+ N = len(ordering)
+ undirected = not G.is_directed()
+ index = dict(zip(ordering, range(N)))
+ M = sp.sparse.lil_array((N, N), dtype=dtype)
+
+ seen = set()
+ for u, nbrdict in G.adjacency():
+ for v in nbrdict:
+ # Obtain the node attribute values.
+ i, j = index[node_value(u)], index[node_value(v)]
+ if v not in seen:
+ M[i, j] += edge_value(u, v)
+ if undirected:
+ M[j, i] = M[i, j]
+
+ if undirected:
+ seen.add(u)
+
+ if normalized:
+ M *= 1 / M.sum(axis=1)[:, np.newaxis] # in-place mult preserves sparse
+
+ if rc_order is None:
+ return M, ordering
+ else:
+ return M
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/bethehessianmatrix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/bethehessianmatrix.py
new file mode 100644
index 0000000000000000000000000000000000000000..3d42fc6d37f033f058338d9a7a8eb718bd6dc14e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/bethehessianmatrix.py
@@ -0,0 +1,79 @@
+"""Bethe Hessian or deformed Laplacian matrix of graphs."""
+
+import networkx as nx
+from networkx.utils import not_implemented_for
+
+__all__ = ["bethe_hessian_matrix"]
+
+
+@not_implemented_for("directed")
+@not_implemented_for("multigraph")
+@nx._dispatchable
+def bethe_hessian_matrix(G, r=None, nodelist=None):
+ r"""Returns the Bethe Hessian matrix of G.
+
+ The Bethe Hessian is a family of matrices parametrized by r, defined as
+ H(r) = (r^2 - 1) I - r A + D where A is the adjacency matrix, D is the
+ diagonal matrix of node degrees, and I is the identify matrix. It is equal
+ to the graph laplacian when the regularizer r = 1.
+
+ The default choice of regularizer should be the ratio [2]_
+
+ .. math::
+ r_m = \left(\sum k_i \right)^{-1}\left(\sum k_i^2 \right) - 1
+
+ Parameters
+ ----------
+ G : Graph
+ A NetworkX graph
+ r : float
+ Regularizer parameter
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by ``G.nodes()``.
+
+ Returns
+ -------
+ H : scipy.sparse.csr_array
+ The Bethe Hessian matrix of `G`, with parameter `r`.
+
+ Examples
+ --------
+ >>> k = [3, 2, 2, 1, 0]
+ >>> G = nx.havel_hakimi_graph(k)
+ >>> H = nx.bethe_hessian_matrix(G)
+ >>> H.toarray()
+ array([[ 3.5625, -1.25 , -1.25 , -1.25 , 0. ],
+ [-1.25 , 2.5625, -1.25 , 0. , 0. ],
+ [-1.25 , -1.25 , 2.5625, 0. , 0. ],
+ [-1.25 , 0. , 0. , 1.5625, 0. ],
+ [ 0. , 0. , 0. , 0. , 0.5625]])
+
+ See Also
+ --------
+ bethe_hessian_spectrum
+ adjacency_matrix
+ laplacian_matrix
+
+ References
+ ----------
+ .. [1] A. Saade, F. Krzakala and L. Zdeborová
+ "Spectral Clustering of Graphs with the Bethe Hessian",
+ Advances in Neural Information Processing Systems, 2014.
+ .. [2] C. M. Le, E. Levina
+ "Estimating the number of communities in networks by spectral methods"
+ arXiv:1507.00827, 2015.
+ """
+ import scipy as sp
+
+ if nodelist is None:
+ nodelist = list(G)
+ if r is None:
+ r = sum(d**2 for v, d in nx.degree(G)) / sum(d for v, d in nx.degree(G)) - 1
+ A = nx.to_scipy_sparse_array(G, nodelist=nodelist, format="csr")
+ n, m = A.shape
+ # TODO: Rm csr_array wrapper when spdiags array creation becomes available
+ D = sp.sparse.csr_array(sp.sparse.spdiags(A.sum(axis=1), 0, m, n, format="csr"))
+ # TODO: Rm csr_array wrapper when eye array creation becomes available
+ I = sp.sparse.csr_array(sp.sparse.eye(m, n, format="csr"))
+ return (r**2 - 1) * I - r * A + D
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/graphmatrix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/graphmatrix.py
new file mode 100644
index 0000000000000000000000000000000000000000..9f477bcccc5b6a077b8c7f1807299d71664ebede
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/graphmatrix.py
@@ -0,0 +1,168 @@
+"""
+Adjacency matrix and incidence matrix of graphs.
+"""
+
+import networkx as nx
+
+__all__ = ["incidence_matrix", "adjacency_matrix"]
+
+
+@nx._dispatchable(edge_attrs="weight")
+def incidence_matrix(
+ G, nodelist=None, edgelist=None, oriented=False, weight=None, *, dtype=None
+):
+ """Returns incidence matrix of G.
+
+ The incidence matrix assigns each row to a node and each column to an edge.
+ For a standard incidence matrix a 1 appears wherever a row's node is
+ incident on the column's edge. For an oriented incidence matrix each
+ edge is assigned an orientation (arbitrarily for undirected and aligning to
+ direction for directed). A -1 appears for the source (tail) of an edge and
+ 1 for the destination (head) of the edge. The elements are zero otherwise.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ nodelist : list, optional (default= all nodes in G)
+ The rows are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by G.nodes().
+
+ edgelist : list, optional (default= all edges in G)
+ The columns are ordered according to the edges in edgelist.
+ If edgelist is None, then the ordering is produced by G.edges().
+
+ oriented: bool, optional (default=False)
+ If True, matrix elements are +1 or -1 for the head or tail node
+ respectively of each edge. If False, +1 occurs at both nodes.
+
+ weight : string or None, optional (default=None)
+ The edge data key used to provide each value in the matrix.
+ If None, then each edge has weight 1. Edge weights, if used,
+ should be positive so that the orientation can provide the sign.
+
+ dtype : a NumPy dtype or None (default=None)
+ The dtype of the output sparse array. This type should be a compatible
+ type of the weight argument, eg. if weight would return a float this
+ argument should also be a float.
+ If None, then the default for SciPy is used.
+
+ Returns
+ -------
+ A : SciPy sparse array
+ The incidence matrix of G.
+
+ Notes
+ -----
+ For MultiGraph/MultiDiGraph, the edges in edgelist should be
+ (u,v,key) 3-tuples.
+
+ "Networks are the best discrete model for so many problems in
+ applied mathematics" [1]_.
+
+ References
+ ----------
+ .. [1] Gil Strang, Network applications: A = incidence matrix,
+ http://videolectures.net/mit18085f07_strang_lec03/
+ """
+ import scipy as sp
+
+ if nodelist is None:
+ nodelist = list(G)
+ if edgelist is None:
+ if G.is_multigraph():
+ edgelist = list(G.edges(keys=True))
+ else:
+ edgelist = list(G.edges())
+ A = sp.sparse.lil_array((len(nodelist), len(edgelist)), dtype=dtype)
+ node_index = {node: i for i, node in enumerate(nodelist)}
+ for ei, e in enumerate(edgelist):
+ (u, v) = e[:2]
+ if u == v:
+ continue # self loops give zero column
+ try:
+ ui = node_index[u]
+ vi = node_index[v]
+ except KeyError as err:
+ raise nx.NetworkXError(
+ f"node {u} or {v} in edgelist but not in nodelist"
+ ) from err
+ if weight is None:
+ wt = 1
+ else:
+ if G.is_multigraph():
+ ekey = e[2]
+ wt = G[u][v][ekey].get(weight, 1)
+ else:
+ wt = G[u][v].get(weight, 1)
+ if oriented:
+ A[ui, ei] = -wt
+ A[vi, ei] = wt
+ else:
+ A[ui, ei] = wt
+ A[vi, ei] = wt
+ return A.asformat("csc")
+
+
+@nx._dispatchable(edge_attrs="weight")
+def adjacency_matrix(G, nodelist=None, dtype=None, weight="weight"):
+ """Returns adjacency matrix of `G`.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in `nodelist`.
+ If ``nodelist=None`` (the default), then the ordering is produced by
+ ``G.nodes()``.
+
+ dtype : NumPy data-type, optional
+ The desired data-type for the array.
+ If `None`, then the NumPy default is used.
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to provide each value in the matrix.
+ If None, then each edge has weight 1.
+
+ Returns
+ -------
+ A : SciPy sparse array
+ Adjacency matrix representation of G.
+
+ Notes
+ -----
+ For directed graphs, entry ``i, j`` corresponds to an edge from ``i`` to ``j``.
+
+ If you want a pure Python adjacency matrix representation try
+ :func:`~networkx.convert.to_dict_of_dicts` which will return a
+ dictionary-of-dictionaries format that can be addressed as a
+ sparse matrix.
+
+ For multigraphs with parallel edges the weights are summed.
+ See :func:`networkx.convert_matrix.to_numpy_array` for other options.
+
+ The convention used for self-loop edges in graphs is to assign the
+ diagonal matrix entry value to the edge weight attribute
+ (or the number 1 if the edge has no weight attribute). If the
+ alternate convention of doubling the edge weight is desired the
+ resulting SciPy sparse array can be modified as follows::
+
+ >>> G = nx.Graph([(1, 1)])
+ >>> A = nx.adjacency_matrix(G)
+ >>> A.toarray()
+ array([[1]])
+ >>> A.setdiag(A.diagonal() * 2)
+ >>> A.toarray()
+ array([[2]])
+
+ See Also
+ --------
+ to_numpy_array
+ to_scipy_sparse_array
+ to_dict_of_dicts
+ adjacency_spectrum
+ """
+ return nx.to_scipy_sparse_array(G, nodelist=nodelist, dtype=dtype, weight=weight)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/laplacianmatrix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/laplacianmatrix.py
new file mode 100644
index 0000000000000000000000000000000000000000..d49ae4910e7047a8ee0a585745209cfea92c2c12
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/laplacianmatrix.py
@@ -0,0 +1,617 @@
+"""Laplacian matrix of graphs.
+
+All calculations here are done using the out-degree. For Laplacians using
+in-degree, use `G.reverse(copy=False)` instead of `G` and take the transpose.
+
+The `laplacian_matrix` function provides an unnormalized matrix,
+while `normalized_laplacian_matrix`, `directed_laplacian_matrix`,
+and `directed_combinatorial_laplacian_matrix` are all normalized.
+"""
+
+import networkx as nx
+from networkx.utils import not_implemented_for
+
+__all__ = [
+ "laplacian_matrix",
+ "normalized_laplacian_matrix",
+ "total_spanning_tree_weight",
+ "directed_laplacian_matrix",
+ "directed_combinatorial_laplacian_matrix",
+]
+
+
+@nx._dispatchable(edge_attrs="weight")
+def laplacian_matrix(G, nodelist=None, weight="weight"):
+ """Returns the Laplacian matrix of G.
+
+ The graph Laplacian is the matrix L = D - A, where
+ A is the adjacency matrix and D is the diagonal matrix of node degrees.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by G.nodes().
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to compute each value in the matrix.
+ If None, then each edge has weight 1.
+
+ Returns
+ -------
+ L : SciPy sparse array
+ The Laplacian matrix of G.
+
+ Notes
+ -----
+ For MultiGraph, the edges weights are summed.
+
+ This returns an unnormalized matrix. For a normalized output,
+ use `normalized_laplacian_matrix`, `directed_laplacian_matrix`,
+ or `directed_combinatorial_laplacian_matrix`.
+
+ This calculation uses the out-degree of the graph `G`. To use the
+ in-degree for calculations instead, use `G.reverse(copy=False)` and
+ take the transpose.
+
+ See Also
+ --------
+ :func:`~networkx.convert_matrix.to_numpy_array`
+ normalized_laplacian_matrix
+ directed_laplacian_matrix
+ directed_combinatorial_laplacian_matrix
+ :func:`~networkx.linalg.spectrum.laplacian_spectrum`
+
+ Examples
+ --------
+ For graphs with multiple connected components, L is permutation-similar
+ to a block diagonal matrix where each block is the respective Laplacian
+ matrix for each component.
+
+ >>> G = nx.Graph([(1, 2), (2, 3), (4, 5)])
+ >>> print(nx.laplacian_matrix(G).toarray())
+ [[ 1 -1 0 0 0]
+ [-1 2 -1 0 0]
+ [ 0 -1 1 0 0]
+ [ 0 0 0 1 -1]
+ [ 0 0 0 -1 1]]
+
+ >>> edges = [
+ ... (1, 2),
+ ... (2, 1),
+ ... (2, 4),
+ ... (4, 3),
+ ... (3, 4),
+ ... ]
+ >>> DiG = nx.DiGraph(edges)
+ >>> print(nx.laplacian_matrix(DiG).toarray())
+ [[ 1 -1 0 0]
+ [-1 2 -1 0]
+ [ 0 0 1 -1]
+ [ 0 0 -1 1]]
+
+ Notice that node 4 is represented by the third column and row. This is because
+ by default the row/column order is the order of `G.nodes` (i.e. the node added
+ order -- in the edgelist, 4 first appears in (2, 4), before node 3 in edge (4, 3).)
+ To control the node order of the matrix, use the `nodelist` argument.
+
+ >>> print(nx.laplacian_matrix(DiG, nodelist=[1, 2, 3, 4]).toarray())
+ [[ 1 -1 0 0]
+ [-1 2 0 -1]
+ [ 0 0 1 -1]
+ [ 0 0 -1 1]]
+
+ This calculation uses the out-degree of the graph `G`. To use the
+ in-degree for calculations instead, use `G.reverse(copy=False)` and
+ take the transpose.
+
+ >>> print(nx.laplacian_matrix(DiG.reverse(copy=False)).toarray().T)
+ [[ 1 -1 0 0]
+ [-1 1 -1 0]
+ [ 0 0 2 -1]
+ [ 0 0 -1 1]]
+
+ References
+ ----------
+ .. [1] Langville, Amy N., and Carl D. Meyer. Google’s PageRank and Beyond:
+ The Science of Search Engine Rankings. Princeton University Press, 2006.
+
+ """
+ import scipy as sp
+
+ if nodelist is None:
+ nodelist = list(G)
+ A = nx.to_scipy_sparse_array(G, nodelist=nodelist, weight=weight, format="csr")
+ n, m = A.shape
+ # TODO: rm csr_array wrapper when spdiags can produce arrays
+ D = sp.sparse.csr_array(sp.sparse.spdiags(A.sum(axis=1), 0, m, n, format="csr"))
+ return D - A
+
+
+@nx._dispatchable(edge_attrs="weight")
+def normalized_laplacian_matrix(G, nodelist=None, weight="weight"):
+ r"""Returns the normalized Laplacian matrix of G.
+
+ The normalized graph Laplacian is the matrix
+
+ .. math::
+
+ N = D^{-1/2} L D^{-1/2}
+
+ where `L` is the graph Laplacian and `D` is the diagonal matrix of
+ node degrees [1]_.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by G.nodes().
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to compute each value in the matrix.
+ If None, then each edge has weight 1.
+
+ Returns
+ -------
+ N : SciPy sparse array
+ The normalized Laplacian matrix of G.
+
+ Notes
+ -----
+ For MultiGraph, the edges weights are summed.
+ See :func:`to_numpy_array` for other options.
+
+ If the Graph contains selfloops, D is defined as ``diag(sum(A, 1))``, where A is
+ the adjacency matrix [2]_.
+
+ This calculation uses the out-degree of the graph `G`. To use the
+ in-degree for calculations instead, use `G.reverse(copy=False)` and
+ take the transpose.
+
+ For an unnormalized output, use `laplacian_matrix`.
+
+ Examples
+ --------
+
+ >>> import numpy as np
+ >>> edges = [
+ ... (1, 2),
+ ... (2, 1),
+ ... (2, 4),
+ ... (4, 3),
+ ... (3, 4),
+ ... ]
+ >>> DiG = nx.DiGraph(edges)
+ >>> print(nx.normalized_laplacian_matrix(DiG).toarray())
+ [[ 1. -0.70710678 0. 0. ]
+ [-0.70710678 1. -0.70710678 0. ]
+ [ 0. 0. 1. -1. ]
+ [ 0. 0. -1. 1. ]]
+
+ Notice that node 4 is represented by the third column and row. This is because
+ by default the row/column order is the order of `G.nodes` (i.e. the node added
+ order -- in the edgelist, 4 first appears in (2, 4), before node 3 in edge (4, 3).)
+ To control the node order of the matrix, use the `nodelist` argument.
+
+ >>> print(nx.normalized_laplacian_matrix(DiG, nodelist=[1, 2, 3, 4]).toarray())
+ [[ 1. -0.70710678 0. 0. ]
+ [-0.70710678 1. 0. -0.70710678]
+ [ 0. 0. 1. -1. ]
+ [ 0. 0. -1. 1. ]]
+ >>> G = nx.Graph(edges)
+ >>> print(nx.normalized_laplacian_matrix(G).toarray())
+ [[ 1. -0.70710678 0. 0. ]
+ [-0.70710678 1. -0.5 0. ]
+ [ 0. -0.5 1. -0.70710678]
+ [ 0. 0. -0.70710678 1. ]]
+
+ See Also
+ --------
+ laplacian_matrix
+ normalized_laplacian_spectrum
+ directed_laplacian_matrix
+ directed_combinatorial_laplacian_matrix
+
+ References
+ ----------
+ .. [1] Fan Chung-Graham, Spectral Graph Theory,
+ CBMS Regional Conference Series in Mathematics, Number 92, 1997.
+ .. [2] Steve Butler, Interlacing For Weighted Graphs Using The Normalized
+ Laplacian, Electronic Journal of Linear Algebra, Volume 16, pp. 90-98,
+ March 2007.
+ .. [3] Langville, Amy N., and Carl D. Meyer. Google’s PageRank and Beyond:
+ The Science of Search Engine Rankings. Princeton University Press, 2006.
+ """
+ import numpy as np
+ import scipy as sp
+
+ if nodelist is None:
+ nodelist = list(G)
+ A = nx.to_scipy_sparse_array(G, nodelist=nodelist, weight=weight, format="csr")
+ n, _ = A.shape
+ diags = A.sum(axis=1)
+ # TODO: rm csr_array wrapper when spdiags can produce arrays
+ D = sp.sparse.csr_array(sp.sparse.spdiags(diags, 0, n, n, format="csr"))
+ L = D - A
+ with np.errstate(divide="ignore"):
+ diags_sqrt = 1.0 / np.sqrt(diags)
+ diags_sqrt[np.isinf(diags_sqrt)] = 0
+ # TODO: rm csr_array wrapper when spdiags can produce arrays
+ DH = sp.sparse.csr_array(sp.sparse.spdiags(diags_sqrt, 0, n, n, format="csr"))
+ return DH @ (L @ DH)
+
+
+@nx._dispatchable(edge_attrs="weight")
+def total_spanning_tree_weight(G, weight=None, root=None):
+ """
+ Returns the total weight of all spanning trees of `G`.
+
+ Kirchoff's Tree Matrix Theorem [1]_, [2]_ states that the determinant of any
+ cofactor of the Laplacian matrix of a graph is the number of spanning trees
+ in the graph. For a weighted Laplacian matrix, it is the sum across all
+ spanning trees of the multiplicative weight of each tree. That is, the
+ weight of each tree is the product of its edge weights.
+
+ For unweighted graphs, the total weight equals the number of spanning trees in `G`.
+
+ For directed graphs, the total weight follows by summing over all directed
+ spanning trees in `G` that start in the `root` node [3]_.
+
+ .. deprecated:: 3.3
+
+ ``total_spanning_tree_weight`` is deprecated and will be removed in v3.5.
+ Use ``nx.number_of_spanning_trees(G)`` instead.
+
+ Parameters
+ ----------
+ G : NetworkX Graph
+
+ weight : string or None, optional (default=None)
+ The key for the edge attribute holding the edge weight.
+ If None, then each edge has weight 1.
+
+ root : node (only required for directed graphs)
+ A node in the directed graph `G`.
+
+ Returns
+ -------
+ total_weight : float
+ Undirected graphs:
+ The sum of the total multiplicative weights for all spanning trees in `G`.
+ Directed graphs:
+ The sum of the total multiplicative weights for all spanning trees of `G`,
+ rooted at node `root`.
+
+ Raises
+ ------
+ NetworkXPointlessConcept
+ If `G` does not contain any nodes.
+
+ NetworkXError
+ If the graph `G` is not (weakly) connected,
+ or if `G` is directed and the root node is not specified or not in G.
+
+ Examples
+ --------
+ >>> G = nx.complete_graph(5)
+ >>> round(nx.total_spanning_tree_weight(G))
+ 125
+
+ >>> G = nx.Graph()
+ >>> G.add_edge(1, 2, weight=2)
+ >>> G.add_edge(1, 3, weight=1)
+ >>> G.add_edge(2, 3, weight=1)
+ >>> round(nx.total_spanning_tree_weight(G, "weight"))
+ 5
+
+ Notes
+ -----
+ Self-loops are excluded. Multi-edges are contracted in one edge
+ equal to the sum of the weights.
+
+ References
+ ----------
+ .. [1] Wikipedia
+ "Kirchhoff's theorem."
+ https://en.wikipedia.org/wiki/Kirchhoff%27s_theorem
+ .. [2] Kirchhoff, G. R.
+ Über die Auflösung der Gleichungen, auf welche man
+ bei der Untersuchung der linearen Vertheilung
+ Galvanischer Ströme geführt wird
+ Annalen der Physik und Chemie, vol. 72, pp. 497-508, 1847.
+ .. [3] Margoliash, J.
+ "Matrix-Tree Theorem for Directed Graphs"
+ https://www.math.uchicago.edu/~may/VIGRE/VIGRE2010/REUPapers/Margoliash.pdf
+ """
+ import warnings
+
+ warnings.warn(
+ (
+ "\n\ntotal_spanning_tree_weight is deprecated and will be removed in v3.5.\n"
+ "Use `nx.number_of_spanning_trees(G)` instead."
+ ),
+ category=DeprecationWarning,
+ stacklevel=3,
+ )
+
+ return nx.number_of_spanning_trees(G, weight=weight, root=root)
+
+
+###############################################################################
+# Code based on work from https://github.com/bjedwards
+
+
+@not_implemented_for("undirected")
+@not_implemented_for("multigraph")
+@nx._dispatchable(edge_attrs="weight")
+def directed_laplacian_matrix(
+ G, nodelist=None, weight="weight", walk_type=None, alpha=0.95
+):
+ r"""Returns the directed Laplacian matrix of G.
+
+ The graph directed Laplacian is the matrix
+
+ .. math::
+
+ L = I - \frac{1}{2} \left (\Phi^{1/2} P \Phi^{-1/2} + \Phi^{-1/2} P^T \Phi^{1/2} \right )
+
+ where `I` is the identity matrix, `P` is the transition matrix of the
+ graph, and `\Phi` a matrix with the Perron vector of `P` in the diagonal and
+ zeros elsewhere [1]_.
+
+ Depending on the value of walk_type, `P` can be the transition matrix
+ induced by a random walk, a lazy random walk, or a random walk with
+ teleportation (PageRank).
+
+ Parameters
+ ----------
+ G : DiGraph
+ A NetworkX graph
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by G.nodes().
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to compute each value in the matrix.
+ If None, then each edge has weight 1.
+
+ walk_type : string or None, optional (default=None)
+ One of ``"random"``, ``"lazy"``, or ``"pagerank"``. If ``walk_type=None``
+ (the default), then a value is selected according to the properties of `G`:
+ - ``walk_type="random"`` if `G` is strongly connected and aperiodic
+ - ``walk_type="lazy"`` if `G` is strongly connected but not aperiodic
+ - ``walk_type="pagerank"`` for all other cases.
+
+ alpha : real
+ (1 - alpha) is the teleportation probability used with pagerank
+
+ Returns
+ -------
+ L : NumPy matrix
+ Normalized Laplacian of G.
+
+ Notes
+ -----
+ Only implemented for DiGraphs
+
+ The result is always a symmetric matrix.
+
+ This calculation uses the out-degree of the graph `G`. To use the
+ in-degree for calculations instead, use `G.reverse(copy=False)` and
+ take the transpose.
+
+ See Also
+ --------
+ laplacian_matrix
+ normalized_laplacian_matrix
+ directed_combinatorial_laplacian_matrix
+
+ References
+ ----------
+ .. [1] Fan Chung (2005).
+ Laplacians and the Cheeger inequality for directed graphs.
+ Annals of Combinatorics, 9(1), 2005
+ """
+ import numpy as np
+ import scipy as sp
+
+ # NOTE: P has type ndarray if walk_type=="pagerank", else csr_array
+ P = _transition_matrix(
+ G, nodelist=nodelist, weight=weight, walk_type=walk_type, alpha=alpha
+ )
+
+ n, m = P.shape
+
+ evals, evecs = sp.sparse.linalg.eigs(P.T, k=1)
+ v = evecs.flatten().real
+ p = v / v.sum()
+ # p>=0 by Perron-Frobenius Thm. Use abs() to fix roundoff across zero gh-6865
+ sqrtp = np.sqrt(np.abs(p))
+ Q = (
+ # TODO: rm csr_array wrapper when spdiags creates arrays
+ sp.sparse.csr_array(sp.sparse.spdiags(sqrtp, 0, n, n))
+ @ P
+ # TODO: rm csr_array wrapper when spdiags creates arrays
+ @ sp.sparse.csr_array(sp.sparse.spdiags(1.0 / sqrtp, 0, n, n))
+ )
+ # NOTE: This could be sparsified for the non-pagerank cases
+ I = np.identity(len(G))
+
+ return I - (Q + Q.T) / 2.0
+
+
+@not_implemented_for("undirected")
+@not_implemented_for("multigraph")
+@nx._dispatchable(edge_attrs="weight")
+def directed_combinatorial_laplacian_matrix(
+ G, nodelist=None, weight="weight", walk_type=None, alpha=0.95
+):
+ r"""Return the directed combinatorial Laplacian matrix of G.
+
+ The graph directed combinatorial Laplacian is the matrix
+
+ .. math::
+
+ L = \Phi - \frac{1}{2} \left (\Phi P + P^T \Phi \right)
+
+ where `P` is the transition matrix of the graph and `\Phi` a matrix
+ with the Perron vector of `P` in the diagonal and zeros elsewhere [1]_.
+
+ Depending on the value of walk_type, `P` can be the transition matrix
+ induced by a random walk, a lazy random walk, or a random walk with
+ teleportation (PageRank).
+
+ Parameters
+ ----------
+ G : DiGraph
+ A NetworkX graph
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by G.nodes().
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to compute each value in the matrix.
+ If None, then each edge has weight 1.
+
+ walk_type : string or None, optional (default=None)
+ One of ``"random"``, ``"lazy"``, or ``"pagerank"``. If ``walk_type=None``
+ (the default), then a value is selected according to the properties of `G`:
+ - ``walk_type="random"`` if `G` is strongly connected and aperiodic
+ - ``walk_type="lazy"`` if `G` is strongly connected but not aperiodic
+ - ``walk_type="pagerank"`` for all other cases.
+
+ alpha : real
+ (1 - alpha) is the teleportation probability used with pagerank
+
+ Returns
+ -------
+ L : NumPy matrix
+ Combinatorial Laplacian of G.
+
+ Notes
+ -----
+ Only implemented for DiGraphs
+
+ The result is always a symmetric matrix.
+
+ This calculation uses the out-degree of the graph `G`. To use the
+ in-degree for calculations instead, use `G.reverse(copy=False)` and
+ take the transpose.
+
+ See Also
+ --------
+ laplacian_matrix
+ normalized_laplacian_matrix
+ directed_laplacian_matrix
+
+ References
+ ----------
+ .. [1] Fan Chung (2005).
+ Laplacians and the Cheeger inequality for directed graphs.
+ Annals of Combinatorics, 9(1), 2005
+ """
+ import scipy as sp
+
+ P = _transition_matrix(
+ G, nodelist=nodelist, weight=weight, walk_type=walk_type, alpha=alpha
+ )
+
+ n, m = P.shape
+
+ evals, evecs = sp.sparse.linalg.eigs(P.T, k=1)
+ v = evecs.flatten().real
+ p = v / v.sum()
+ # NOTE: could be improved by not densifying
+ # TODO: Rm csr_array wrapper when spdiags array creation becomes available
+ Phi = sp.sparse.csr_array(sp.sparse.spdiags(p, 0, n, n)).toarray()
+
+ return Phi - (Phi @ P + P.T @ Phi) / 2.0
+
+
+def _transition_matrix(G, nodelist=None, weight="weight", walk_type=None, alpha=0.95):
+ """Returns the transition matrix of G.
+
+ This is a row stochastic giving the transition probabilities while
+ performing a random walk on the graph. Depending on the value of walk_type,
+ P can be the transition matrix induced by a random walk, a lazy random walk,
+ or a random walk with teleportation (PageRank).
+
+ Parameters
+ ----------
+ G : DiGraph
+ A NetworkX graph
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by G.nodes().
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to compute each value in the matrix.
+ If None, then each edge has weight 1.
+
+ walk_type : string or None, optional (default=None)
+ One of ``"random"``, ``"lazy"``, or ``"pagerank"``. If ``walk_type=None``
+ (the default), then a value is selected according to the properties of `G`:
+ - ``walk_type="random"`` if `G` is strongly connected and aperiodic
+ - ``walk_type="lazy"`` if `G` is strongly connected but not aperiodic
+ - ``walk_type="pagerank"`` for all other cases.
+
+ alpha : real
+ (1 - alpha) is the teleportation probability used with pagerank
+
+ Returns
+ -------
+ P : numpy.ndarray
+ transition matrix of G.
+
+ Raises
+ ------
+ NetworkXError
+ If walk_type not specified or alpha not in valid range
+ """
+ import numpy as np
+ import scipy as sp
+
+ if walk_type is None:
+ if nx.is_strongly_connected(G):
+ if nx.is_aperiodic(G):
+ walk_type = "random"
+ else:
+ walk_type = "lazy"
+ else:
+ walk_type = "pagerank"
+
+ A = nx.to_scipy_sparse_array(G, nodelist=nodelist, weight=weight, dtype=float)
+ n, m = A.shape
+ if walk_type in ["random", "lazy"]:
+ # TODO: Rm csr_array wrapper when spdiags array creation becomes available
+ DI = sp.sparse.csr_array(sp.sparse.spdiags(1.0 / A.sum(axis=1), 0, n, n))
+ if walk_type == "random":
+ P = DI @ A
+ else:
+ # TODO: Rm csr_array wrapper when identity array creation becomes available
+ I = sp.sparse.csr_array(sp.sparse.identity(n))
+ P = (I + DI @ A) / 2.0
+
+ elif walk_type == "pagerank":
+ if not (0 < alpha < 1):
+ raise nx.NetworkXError("alpha must be between 0 and 1")
+ # this is using a dense representation. NOTE: This should be sparsified!
+ A = A.toarray()
+ # add constant to dangling nodes' row
+ A[A.sum(axis=1) == 0, :] = 1 / n
+ # normalize
+ A = A / A.sum(axis=1)[np.newaxis, :].T
+ P = alpha * A + (1 - alpha) / n
+ else:
+ raise nx.NetworkXError("walk_type must be random, lazy, or pagerank")
+
+ return P
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/modularitymatrix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/modularitymatrix.py
new file mode 100644
index 0000000000000000000000000000000000000000..0287910bdccc61263afa4d6adfa2b0d78afc4daa
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/modularitymatrix.py
@@ -0,0 +1,166 @@
+"""Modularity matrix of graphs."""
+
+import networkx as nx
+from networkx.utils import not_implemented_for
+
+__all__ = ["modularity_matrix", "directed_modularity_matrix"]
+
+
+@not_implemented_for("directed")
+@not_implemented_for("multigraph")
+@nx._dispatchable(edge_attrs="weight")
+def modularity_matrix(G, nodelist=None, weight=None):
+ r"""Returns the modularity matrix of G.
+
+ The modularity matrix is the matrix B = A - , where A is the adjacency
+ matrix and is the average adjacency matrix, assuming that the graph
+ is described by the configuration model.
+
+ More specifically, the element B_ij of B is defined as
+
+ .. math::
+ A_{ij} - {k_i k_j \over 2 m}
+
+ where k_i is the degree of node i, and where m is the number of edges
+ in the graph. When weight is set to a name of an attribute edge, Aij, k_i,
+ k_j and m are computed using its value.
+
+ Parameters
+ ----------
+ G : Graph
+ A NetworkX graph
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by G.nodes().
+
+ weight : string or None, optional (default=None)
+ The edge attribute that holds the numerical value used for
+ the edge weight. If None then all edge weights are 1.
+
+ Returns
+ -------
+ B : Numpy array
+ The modularity matrix of G.
+
+ Examples
+ --------
+ >>> k = [3, 2, 2, 1, 0]
+ >>> G = nx.havel_hakimi_graph(k)
+ >>> B = nx.modularity_matrix(G)
+
+
+ See Also
+ --------
+ to_numpy_array
+ modularity_spectrum
+ adjacency_matrix
+ directed_modularity_matrix
+
+ References
+ ----------
+ .. [1] M. E. J. Newman, "Modularity and community structure in networks",
+ Proc. Natl. Acad. Sci. USA, vol. 103, pp. 8577-8582, 2006.
+ """
+ import numpy as np
+
+ if nodelist is None:
+ nodelist = list(G)
+ A = nx.to_scipy_sparse_array(G, nodelist=nodelist, weight=weight, format="csr")
+ k = A.sum(axis=1)
+ m = k.sum() * 0.5
+ # Expected adjacency matrix
+ X = np.outer(k, k) / (2 * m)
+
+ return A - X
+
+
+@not_implemented_for("undirected")
+@not_implemented_for("multigraph")
+@nx._dispatchable(edge_attrs="weight")
+def directed_modularity_matrix(G, nodelist=None, weight=None):
+ """Returns the directed modularity matrix of G.
+
+ The modularity matrix is the matrix B = A - , where A is the adjacency
+ matrix and is the expected adjacency matrix, assuming that the graph
+ is described by the configuration model.
+
+ More specifically, the element B_ij of B is defined as
+
+ .. math::
+ B_{ij} = A_{ij} - k_i^{out} k_j^{in} / m
+
+ where :math:`k_i^{in}` is the in degree of node i, and :math:`k_j^{out}` is the out degree
+ of node j, with m the number of edges in the graph. When weight is set
+ to a name of an attribute edge, Aij, k_i, k_j and m are computed using
+ its value.
+
+ Parameters
+ ----------
+ G : DiGraph
+ A NetworkX DiGraph
+
+ nodelist : list, optional
+ The rows and columns are ordered according to the nodes in nodelist.
+ If nodelist is None, then the ordering is produced by G.nodes().
+
+ weight : string or None, optional (default=None)
+ The edge attribute that holds the numerical value used for
+ the edge weight. If None then all edge weights are 1.
+
+ Returns
+ -------
+ B : Numpy array
+ The modularity matrix of G.
+
+ Examples
+ --------
+ >>> G = nx.DiGraph()
+ >>> G.add_edges_from(
+ ... (
+ ... (1, 2),
+ ... (1, 3),
+ ... (3, 1),
+ ... (3, 2),
+ ... (3, 5),
+ ... (4, 5),
+ ... (4, 6),
+ ... (5, 4),
+ ... (5, 6),
+ ... (6, 4),
+ ... )
+ ... )
+ >>> B = nx.directed_modularity_matrix(G)
+
+
+ Notes
+ -----
+ NetworkX defines the element A_ij of the adjacency matrix as 1 if there
+ is a link going from node i to node j. Leicht and Newman use the opposite
+ definition. This explains the different expression for B_ij.
+
+ See Also
+ --------
+ to_numpy_array
+ modularity_spectrum
+ adjacency_matrix
+ modularity_matrix
+
+ References
+ ----------
+ .. [1] E. A. Leicht, M. E. J. Newman,
+ "Community structure in directed networks",
+ Phys. Rev Lett., vol. 100, no. 11, p. 118703, 2008.
+ """
+ import numpy as np
+
+ if nodelist is None:
+ nodelist = list(G)
+ A = nx.to_scipy_sparse_array(G, nodelist=nodelist, weight=weight, format="csr")
+ k_in = A.sum(axis=0)
+ k_out = A.sum(axis=1)
+ m = k_in.sum()
+ # Expected adjacency matrix
+ X = np.outer(k_out, k_in) / m
+
+ return A - X
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/spectrum.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/spectrum.py
new file mode 100644
index 0000000000000000000000000000000000000000..079b18550ca5b1478ec3f4b12ee40e5451627355
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/spectrum.py
@@ -0,0 +1,186 @@
+"""
+Eigenvalue spectrum of graphs.
+"""
+
+import networkx as nx
+
+__all__ = [
+ "laplacian_spectrum",
+ "adjacency_spectrum",
+ "modularity_spectrum",
+ "normalized_laplacian_spectrum",
+ "bethe_hessian_spectrum",
+]
+
+
+@nx._dispatchable(edge_attrs="weight")
+def laplacian_spectrum(G, weight="weight"):
+ """Returns eigenvalues of the Laplacian of G
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to compute each value in the matrix.
+ If None, then each edge has weight 1.
+
+ Returns
+ -------
+ evals : NumPy array
+ Eigenvalues
+
+ Notes
+ -----
+ For MultiGraph/MultiDiGraph, the edges weights are summed.
+ See :func:`~networkx.convert_matrix.to_numpy_array` for other options.
+
+ See Also
+ --------
+ laplacian_matrix
+
+ Examples
+ --------
+ The multiplicity of 0 as an eigenvalue of the laplacian matrix is equal
+ to the number of connected components of G.
+
+ >>> G = nx.Graph() # Create a graph with 5 nodes and 3 connected components
+ >>> G.add_nodes_from(range(5))
+ >>> G.add_edges_from([(0, 2), (3, 4)])
+ >>> nx.laplacian_spectrum(G)
+ array([0., 0., 0., 2., 2.])
+
+ """
+ import scipy as sp
+
+ return sp.linalg.eigvalsh(nx.laplacian_matrix(G, weight=weight).todense())
+
+
+@nx._dispatchable(edge_attrs="weight")
+def normalized_laplacian_spectrum(G, weight="weight"):
+ """Return eigenvalues of the normalized Laplacian of G
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to compute each value in the matrix.
+ If None, then each edge has weight 1.
+
+ Returns
+ -------
+ evals : NumPy array
+ Eigenvalues
+
+ Notes
+ -----
+ For MultiGraph/MultiDiGraph, the edges weights are summed.
+ See to_numpy_array for other options.
+
+ See Also
+ --------
+ normalized_laplacian_matrix
+ """
+ import scipy as sp
+
+ return sp.linalg.eigvalsh(
+ nx.normalized_laplacian_matrix(G, weight=weight).todense()
+ )
+
+
+@nx._dispatchable(edge_attrs="weight")
+def adjacency_spectrum(G, weight="weight"):
+ """Returns eigenvalues of the adjacency matrix of G.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ weight : string or None, optional (default='weight')
+ The edge data key used to compute each value in the matrix.
+ If None, then each edge has weight 1.
+
+ Returns
+ -------
+ evals : NumPy array
+ Eigenvalues
+
+ Notes
+ -----
+ For MultiGraph/MultiDiGraph, the edges weights are summed.
+ See to_numpy_array for other options.
+
+ See Also
+ --------
+ adjacency_matrix
+ """
+ import scipy as sp
+
+ return sp.linalg.eigvals(nx.adjacency_matrix(G, weight=weight).todense())
+
+
+@nx._dispatchable
+def modularity_spectrum(G):
+ """Returns eigenvalues of the modularity matrix of G.
+
+ Parameters
+ ----------
+ G : Graph
+ A NetworkX Graph or DiGraph
+
+ Returns
+ -------
+ evals : NumPy array
+ Eigenvalues
+
+ See Also
+ --------
+ modularity_matrix
+
+ References
+ ----------
+ .. [1] M. E. J. Newman, "Modularity and community structure in networks",
+ Proc. Natl. Acad. Sci. USA, vol. 103, pp. 8577-8582, 2006.
+ """
+ import scipy as sp
+
+ if G.is_directed():
+ return sp.linalg.eigvals(nx.directed_modularity_matrix(G))
+ else:
+ return sp.linalg.eigvals(nx.modularity_matrix(G))
+
+
+@nx._dispatchable
+def bethe_hessian_spectrum(G, r=None):
+ """Returns eigenvalues of the Bethe Hessian matrix of G.
+
+ Parameters
+ ----------
+ G : Graph
+ A NetworkX Graph or DiGraph
+
+ r : float
+ Regularizer parameter
+
+ Returns
+ -------
+ evals : NumPy array
+ Eigenvalues
+
+ See Also
+ --------
+ bethe_hessian_matrix
+
+ References
+ ----------
+ .. [1] A. Saade, F. Krzakala and L. Zdeborová
+ "Spectral clustering of graphs with the bethe hessian",
+ Advances in Neural Information Processing Systems. 2014.
+ """
+ import scipy as sp
+
+ return sp.linalg.eigvalsh(nx.bethe_hessian_matrix(G, r).todense())
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_algebraic_connectivity.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_algebraic_connectivity.py
new file mode 100644
index 0000000000000000000000000000000000000000..089d917a6832e1ab211eb3ced08344b84ddb285a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_algebraic_connectivity.py
@@ -0,0 +1,402 @@
+from math import sqrt
+
+import pytest
+
+np = pytest.importorskip("numpy")
+
+
+import networkx as nx
+
+methods = ("tracemin_pcg", "tracemin_lu", "lanczos", "lobpcg")
+
+
+def test_algebraic_connectivity_tracemin_chol():
+ """Test that "tracemin_chol" raises an exception."""
+ pytest.importorskip("scipy")
+ G = nx.barbell_graph(5, 4)
+ with pytest.raises(nx.NetworkXError):
+ nx.algebraic_connectivity(G, method="tracemin_chol")
+
+
+def test_fiedler_vector_tracemin_chol():
+ """Test that "tracemin_chol" raises an exception."""
+ pytest.importorskip("scipy")
+ G = nx.barbell_graph(5, 4)
+ with pytest.raises(nx.NetworkXError):
+ nx.fiedler_vector(G, method="tracemin_chol")
+
+
+def test_spectral_ordering_tracemin_chol():
+ """Test that "tracemin_chol" raises an exception."""
+ pytest.importorskip("scipy")
+ G = nx.barbell_graph(5, 4)
+ with pytest.raises(nx.NetworkXError):
+ nx.spectral_ordering(G, method="tracemin_chol")
+
+
+def test_fiedler_vector_tracemin_unknown():
+ """Test that "tracemin_unknown" raises an exception."""
+ pytest.importorskip("scipy")
+ G = nx.barbell_graph(5, 4)
+ L = nx.laplacian_matrix(G)
+ X = np.asarray(np.random.normal(size=(1, L.shape[0]))).T
+ with pytest.raises(nx.NetworkXError, match="Unknown linear system solver"):
+ nx.linalg.algebraicconnectivity._tracemin_fiedler(
+ L, X, normalized=False, tol=1e-8, method="tracemin_unknown"
+ )
+
+
+def test_spectral_bisection():
+ pytest.importorskip("scipy")
+ G = nx.barbell_graph(3, 0)
+ C = nx.spectral_bisection(G)
+ assert C == ({0, 1, 2}, {3, 4, 5})
+
+ mapping = dict(enumerate("badfec"))
+ G = nx.relabel_nodes(G, mapping)
+ C = nx.spectral_bisection(G)
+ assert C == (
+ {mapping[0], mapping[1], mapping[2]},
+ {mapping[3], mapping[4], mapping[5]},
+ )
+
+
+def check_eigenvector(A, l, x):
+ nx = np.linalg.norm(x)
+ # Check zeroness.
+ assert nx != pytest.approx(0, abs=1e-07)
+ y = A @ x
+ ny = np.linalg.norm(y)
+ # Check collinearity.
+ assert x @ y == pytest.approx(nx * ny, abs=1e-7)
+ # Check eigenvalue.
+ assert ny == pytest.approx(l * nx, abs=1e-7)
+
+
+class TestAlgebraicConnectivity:
+ @pytest.mark.parametrize("method", methods)
+ def test_directed(self, method):
+ G = nx.DiGraph()
+ pytest.raises(
+ nx.NetworkXNotImplemented, nx.algebraic_connectivity, G, method=method
+ )
+ pytest.raises(nx.NetworkXNotImplemented, nx.fiedler_vector, G, method=method)
+
+ @pytest.mark.parametrize("method", methods)
+ def test_null_and_singleton(self, method):
+ G = nx.Graph()
+ pytest.raises(nx.NetworkXError, nx.algebraic_connectivity, G, method=method)
+ pytest.raises(nx.NetworkXError, nx.fiedler_vector, G, method=method)
+ G.add_edge(0, 0)
+ pytest.raises(nx.NetworkXError, nx.algebraic_connectivity, G, method=method)
+ pytest.raises(nx.NetworkXError, nx.fiedler_vector, G, method=method)
+
+ @pytest.mark.parametrize("method", methods)
+ def test_disconnected(self, method):
+ G = nx.Graph()
+ G.add_nodes_from(range(2))
+ assert nx.algebraic_connectivity(G) == 0
+ pytest.raises(nx.NetworkXError, nx.fiedler_vector, G, method=method)
+ G.add_edge(0, 1, weight=0)
+ assert nx.algebraic_connectivity(G) == 0
+ pytest.raises(nx.NetworkXError, nx.fiedler_vector, G, method=method)
+
+ def test_unrecognized_method(self):
+ pytest.importorskip("scipy")
+ G = nx.path_graph(4)
+ pytest.raises(nx.NetworkXError, nx.algebraic_connectivity, G, method="unknown")
+ pytest.raises(nx.NetworkXError, nx.fiedler_vector, G, method="unknown")
+
+ @pytest.mark.parametrize("method", methods)
+ def test_two_nodes(self, method):
+ pytest.importorskip("scipy")
+ G = nx.Graph()
+ G.add_edge(0, 1, weight=1)
+ A = nx.laplacian_matrix(G)
+ assert nx.algebraic_connectivity(G, tol=1e-12, method=method) == pytest.approx(
+ 2, abs=1e-7
+ )
+ x = nx.fiedler_vector(G, tol=1e-12, method=method)
+ check_eigenvector(A, 2, x)
+
+ @pytest.mark.parametrize("method", methods)
+ def test_two_nodes_multigraph(self, method):
+ pytest.importorskip("scipy")
+ G = nx.MultiGraph()
+ G.add_edge(0, 0, spam=1e8)
+ G.add_edge(0, 1, spam=1)
+ G.add_edge(0, 1, spam=-2)
+ A = -3 * nx.laplacian_matrix(G, weight="spam")
+ assert nx.algebraic_connectivity(
+ G, weight="spam", tol=1e-12, method=method
+ ) == pytest.approx(6, abs=1e-7)
+ x = nx.fiedler_vector(G, weight="spam", tol=1e-12, method=method)
+ check_eigenvector(A, 6, x)
+
+ def test_abbreviation_of_method(self):
+ pytest.importorskip("scipy")
+ G = nx.path_graph(8)
+ A = nx.laplacian_matrix(G)
+ sigma = 2 - sqrt(2 + sqrt(2))
+ ac = nx.algebraic_connectivity(G, tol=1e-12, method="tracemin")
+ assert ac == pytest.approx(sigma, abs=1e-7)
+ x = nx.fiedler_vector(G, tol=1e-12, method="tracemin")
+ check_eigenvector(A, sigma, x)
+
+ @pytest.mark.parametrize("method", methods)
+ def test_path(self, method):
+ pytest.importorskip("scipy")
+ G = nx.path_graph(8)
+ A = nx.laplacian_matrix(G)
+ sigma = 2 - sqrt(2 + sqrt(2))
+ ac = nx.algebraic_connectivity(G, tol=1e-12, method=method)
+ assert ac == pytest.approx(sigma, abs=1e-7)
+ x = nx.fiedler_vector(G, tol=1e-12, method=method)
+ check_eigenvector(A, sigma, x)
+
+ @pytest.mark.parametrize("method", methods)
+ def test_problematic_graph_issue_2381(self, method):
+ pytest.importorskip("scipy")
+ G = nx.path_graph(4)
+ G.add_edges_from([(4, 2), (5, 1)])
+ A = nx.laplacian_matrix(G)
+ sigma = 0.438447187191
+ ac = nx.algebraic_connectivity(G, tol=1e-12, method=method)
+ assert ac == pytest.approx(sigma, abs=1e-7)
+ x = nx.fiedler_vector(G, tol=1e-12, method=method)
+ check_eigenvector(A, sigma, x)
+
+ @pytest.mark.parametrize("method", methods)
+ def test_cycle(self, method):
+ pytest.importorskip("scipy")
+ G = nx.cycle_graph(8)
+ A = nx.laplacian_matrix(G)
+ sigma = 2 - sqrt(2)
+ ac = nx.algebraic_connectivity(G, tol=1e-12, method=method)
+ assert ac == pytest.approx(sigma, abs=1e-7)
+ x = nx.fiedler_vector(G, tol=1e-12, method=method)
+ check_eigenvector(A, sigma, x)
+
+ @pytest.mark.parametrize("method", methods)
+ def test_seed_argument(self, method):
+ pytest.importorskip("scipy")
+ G = nx.cycle_graph(8)
+ A = nx.laplacian_matrix(G)
+ sigma = 2 - sqrt(2)
+ ac = nx.algebraic_connectivity(G, tol=1e-12, method=method, seed=1)
+ assert ac == pytest.approx(sigma, abs=1e-7)
+ x = nx.fiedler_vector(G, tol=1e-12, method=method, seed=1)
+ check_eigenvector(A, sigma, x)
+
+ @pytest.mark.parametrize(
+ ("normalized", "sigma", "laplacian_fn"),
+ (
+ (False, 0.2434017461399311, nx.laplacian_matrix),
+ (True, 0.08113391537997749, nx.normalized_laplacian_matrix),
+ ),
+ )
+ @pytest.mark.parametrize("method", methods)
+ def test_buckminsterfullerene(self, normalized, sigma, laplacian_fn, method):
+ pytest.importorskip("scipy")
+ G = nx.Graph(
+ [
+ (1, 10),
+ (1, 41),
+ (1, 59),
+ (2, 12),
+ (2, 42),
+ (2, 60),
+ (3, 6),
+ (3, 43),
+ (3, 57),
+ (4, 8),
+ (4, 44),
+ (4, 58),
+ (5, 13),
+ (5, 56),
+ (5, 57),
+ (6, 10),
+ (6, 31),
+ (7, 14),
+ (7, 56),
+ (7, 58),
+ (8, 12),
+ (8, 32),
+ (9, 23),
+ (9, 53),
+ (9, 59),
+ (10, 15),
+ (11, 24),
+ (11, 53),
+ (11, 60),
+ (12, 16),
+ (13, 14),
+ (13, 25),
+ (14, 26),
+ (15, 27),
+ (15, 49),
+ (16, 28),
+ (16, 50),
+ (17, 18),
+ (17, 19),
+ (17, 54),
+ (18, 20),
+ (18, 55),
+ (19, 23),
+ (19, 41),
+ (20, 24),
+ (20, 42),
+ (21, 31),
+ (21, 33),
+ (21, 57),
+ (22, 32),
+ (22, 34),
+ (22, 58),
+ (23, 24),
+ (25, 35),
+ (25, 43),
+ (26, 36),
+ (26, 44),
+ (27, 51),
+ (27, 59),
+ (28, 52),
+ (28, 60),
+ (29, 33),
+ (29, 34),
+ (29, 56),
+ (30, 51),
+ (30, 52),
+ (30, 53),
+ (31, 47),
+ (32, 48),
+ (33, 45),
+ (34, 46),
+ (35, 36),
+ (35, 37),
+ (36, 38),
+ (37, 39),
+ (37, 49),
+ (38, 40),
+ (38, 50),
+ (39, 40),
+ (39, 51),
+ (40, 52),
+ (41, 47),
+ (42, 48),
+ (43, 49),
+ (44, 50),
+ (45, 46),
+ (45, 54),
+ (46, 55),
+ (47, 54),
+ (48, 55),
+ ]
+ )
+ A = laplacian_fn(G)
+ try:
+ assert nx.algebraic_connectivity(
+ G, normalized=normalized, tol=1e-12, method=method
+ ) == pytest.approx(sigma, abs=1e-7)
+ x = nx.fiedler_vector(G, normalized=normalized, tol=1e-12, method=method)
+ check_eigenvector(A, sigma, x)
+ except nx.NetworkXError as err:
+ if err.args not in (
+ ("Cholesky solver unavailable.",),
+ ("LU solver unavailable.",),
+ ):
+ raise
+
+
+class TestSpectralOrdering:
+ _graphs = (nx.Graph, nx.DiGraph, nx.MultiGraph, nx.MultiDiGraph)
+
+ @pytest.mark.parametrize("graph", _graphs)
+ def test_nullgraph(self, graph):
+ G = graph()
+ pytest.raises(nx.NetworkXError, nx.spectral_ordering, G)
+
+ @pytest.mark.parametrize("graph", _graphs)
+ def test_singleton(self, graph):
+ G = graph()
+ G.add_node("x")
+ assert nx.spectral_ordering(G) == ["x"]
+ G.add_edge("x", "x", weight=33)
+ G.add_edge("x", "x", weight=33)
+ assert nx.spectral_ordering(G) == ["x"]
+
+ def test_unrecognized_method(self):
+ G = nx.path_graph(4)
+ pytest.raises(nx.NetworkXError, nx.spectral_ordering, G, method="unknown")
+
+ @pytest.mark.parametrize("method", methods)
+ def test_three_nodes(self, method):
+ pytest.importorskip("scipy")
+ G = nx.Graph()
+ G.add_weighted_edges_from([(1, 2, 1), (1, 3, 2), (2, 3, 1)], weight="spam")
+ order = nx.spectral_ordering(G, weight="spam", method=method)
+ assert set(order) == set(G)
+ assert {1, 3} in (set(order[:-1]), set(order[1:]))
+
+ @pytest.mark.parametrize("method", methods)
+ def test_three_nodes_multigraph(self, method):
+ pytest.importorskip("scipy")
+ G = nx.MultiDiGraph()
+ G.add_weighted_edges_from([(1, 2, 1), (1, 3, 2), (2, 3, 1), (2, 3, 2)])
+ order = nx.spectral_ordering(G, method=method)
+ assert set(order) == set(G)
+ assert {2, 3} in (set(order[:-1]), set(order[1:]))
+
+ @pytest.mark.parametrize("method", methods)
+ def test_path(self, method):
+ pytest.importorskip("scipy")
+ path = list(range(10))
+ np.random.shuffle(path)
+ G = nx.Graph()
+ nx.add_path(G, path)
+ order = nx.spectral_ordering(G, method=method)
+ assert order in [path, list(reversed(path))]
+
+ @pytest.mark.parametrize("method", methods)
+ def test_seed_argument(self, method):
+ pytest.importorskip("scipy")
+ path = list(range(10))
+ np.random.shuffle(path)
+ G = nx.Graph()
+ nx.add_path(G, path)
+ order = nx.spectral_ordering(G, method=method, seed=1)
+ assert order in [path, list(reversed(path))]
+
+ @pytest.mark.parametrize("method", methods)
+ def test_disconnected(self, method):
+ pytest.importorskip("scipy")
+ G = nx.Graph()
+ nx.add_path(G, range(0, 10, 2))
+ nx.add_path(G, range(1, 10, 2))
+ order = nx.spectral_ordering(G, method=method)
+ assert set(order) == set(G)
+ seqs = [
+ list(range(0, 10, 2)),
+ list(range(8, -1, -2)),
+ list(range(1, 10, 2)),
+ list(range(9, -1, -2)),
+ ]
+ assert order[:5] in seqs
+ assert order[5:] in seqs
+
+ @pytest.mark.parametrize(
+ ("normalized", "expected_order"),
+ (
+ (False, [[1, 2, 0, 3, 4, 5, 6, 9, 7, 8], [8, 7, 9, 6, 5, 4, 3, 0, 2, 1]]),
+ (True, [[1, 2, 3, 0, 4, 5, 9, 6, 7, 8], [8, 7, 6, 9, 5, 4, 0, 3, 2, 1]]),
+ ),
+ )
+ @pytest.mark.parametrize("method", methods)
+ def test_cycle(self, normalized, expected_order, method):
+ pytest.importorskip("scipy")
+ path = list(range(10))
+ G = nx.Graph()
+ nx.add_path(G, path, weight=5)
+ G.add_edge(path[-1], path[0], weight=1)
+ A = nx.laplacian_matrix(G).todense()
+ order = nx.spectral_ordering(G, normalized=normalized, method=method)
+ assert order in expected_order
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_attrmatrix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_attrmatrix.py
new file mode 100644
index 0000000000000000000000000000000000000000..01574bb3b8f284edef6c7f92fe1c7e7a239e0610
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_attrmatrix.py
@@ -0,0 +1,108 @@
+import pytest
+
+np = pytest.importorskip("numpy")
+
+import networkx as nx
+
+
+def test_attr_matrix():
+ G = nx.Graph()
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 2, thickness=2)
+ G.add_edge(1, 2, thickness=3)
+
+ def node_attr(u):
+ return G.nodes[u].get("size", 0.5) * 3
+
+ def edge_attr(u, v):
+ return G[u][v].get("thickness", 0.5)
+
+ M = nx.attr_matrix(G, edge_attr=edge_attr, node_attr=node_attr)
+ np.testing.assert_equal(M[0], np.array([[6.0]]))
+ assert M[1] == [1.5]
+
+
+def test_attr_matrix_directed():
+ G = nx.DiGraph()
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 2, thickness=2)
+ G.add_edge(1, 2, thickness=3)
+ M = nx.attr_matrix(G, rc_order=[0, 1, 2])
+ # fmt: off
+ data = np.array(
+ [[0., 1., 1.],
+ [0., 0., 1.],
+ [0., 0., 0.]]
+ )
+ # fmt: on
+ np.testing.assert_equal(M, np.array(data))
+
+
+def test_attr_matrix_multigraph():
+ G = nx.MultiGraph()
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 2, thickness=2)
+ G.add_edge(1, 2, thickness=3)
+ M = nx.attr_matrix(G, rc_order=[0, 1, 2])
+ # fmt: off
+ data = np.array(
+ [[0., 3., 1.],
+ [3., 0., 1.],
+ [1., 1., 0.]]
+ )
+ # fmt: on
+ np.testing.assert_equal(M, np.array(data))
+ M = nx.attr_matrix(G, edge_attr="weight", rc_order=[0, 1, 2])
+ # fmt: off
+ data = np.array(
+ [[0., 9., 1.],
+ [9., 0., 1.],
+ [1., 1., 0.]]
+ )
+ # fmt: on
+ np.testing.assert_equal(M, np.array(data))
+ M = nx.attr_matrix(G, edge_attr="thickness", rc_order=[0, 1, 2])
+ # fmt: off
+ data = np.array(
+ [[0., 3., 2.],
+ [3., 0., 3.],
+ [2., 3., 0.]]
+ )
+ # fmt: on
+ np.testing.assert_equal(M, np.array(data))
+
+
+def test_attr_sparse_matrix():
+ pytest.importorskip("scipy")
+ G = nx.Graph()
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 2, thickness=2)
+ G.add_edge(1, 2, thickness=3)
+ M = nx.attr_sparse_matrix(G)
+ mtx = M[0]
+ data = np.ones((3, 3), float)
+ np.fill_diagonal(data, 0)
+ np.testing.assert_equal(mtx.todense(), np.array(data))
+ assert M[1] == [0, 1, 2]
+
+
+def test_attr_sparse_matrix_directed():
+ pytest.importorskip("scipy")
+ G = nx.DiGraph()
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 1, thickness=1, weight=3)
+ G.add_edge(0, 2, thickness=2)
+ G.add_edge(1, 2, thickness=3)
+ M = nx.attr_sparse_matrix(G, rc_order=[0, 1, 2])
+ # fmt: off
+ data = np.array(
+ [[0., 1., 1.],
+ [0., 0., 1.],
+ [0., 0., 0.]]
+ )
+ # fmt: on
+ np.testing.assert_equal(M.todense(), np.array(data))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_bethehessian.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_bethehessian.py
new file mode 100644
index 0000000000000000000000000000000000000000..339fe1be390b40083efdd61f1cae4ff62838fc93
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_bethehessian.py
@@ -0,0 +1,41 @@
+import pytest
+
+np = pytest.importorskip("numpy")
+pytest.importorskip("scipy")
+
+import networkx as nx
+from networkx.generators.degree_seq import havel_hakimi_graph
+
+
+class TestBetheHessian:
+ @classmethod
+ def setup_class(cls):
+ deg = [3, 2, 2, 1, 0]
+ cls.G = havel_hakimi_graph(deg)
+ cls.P = nx.path_graph(3)
+
+ def test_bethe_hessian(self):
+ "Bethe Hessian matrix"
+ # fmt: off
+ H = np.array([[4, -2, 0],
+ [-2, 5, -2],
+ [0, -2, 4]])
+ # fmt: on
+ permutation = [2, 0, 1]
+ # Bethe Hessian gives expected form
+ np.testing.assert_equal(nx.bethe_hessian_matrix(self.P, r=2).todense(), H)
+ # nodelist is correctly implemented
+ np.testing.assert_equal(
+ nx.bethe_hessian_matrix(self.P, r=2, nodelist=permutation).todense(),
+ H[np.ix_(permutation, permutation)],
+ )
+ # Equal to Laplacian matrix when r=1
+ np.testing.assert_equal(
+ nx.bethe_hessian_matrix(self.G, r=1).todense(),
+ nx.laplacian_matrix(self.G).todense(),
+ )
+ # Correct default for the regularizer r
+ np.testing.assert_equal(
+ nx.bethe_hessian_matrix(self.G).todense(),
+ nx.bethe_hessian_matrix(self.G, r=1.25).todense(),
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_graphmatrix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_graphmatrix.py
new file mode 100644
index 0000000000000000000000000000000000000000..519198bc07b32f16c1c0ae0cd9b8bbe6b81bce62
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_graphmatrix.py
@@ -0,0 +1,276 @@
+import pytest
+
+np = pytest.importorskip("numpy")
+pytest.importorskip("scipy")
+
+import networkx as nx
+from networkx.exception import NetworkXError
+from networkx.generators.degree_seq import havel_hakimi_graph
+
+
+def test_incidence_matrix_simple():
+ deg = [3, 2, 2, 1, 0]
+ G = havel_hakimi_graph(deg)
+ deg = [(1, 0), (1, 0), (1, 0), (2, 0), (1, 0), (2, 1), (0, 1), (0, 1)]
+ MG = nx.random_clustered_graph(deg, seed=42)
+
+ I = nx.incidence_matrix(G, dtype=int).todense()
+ # fmt: off
+ expected = np.array(
+ [[1, 1, 1, 0],
+ [0, 1, 0, 1],
+ [1, 0, 0, 1],
+ [0, 0, 1, 0],
+ [0, 0, 0, 0]]
+ )
+ # fmt: on
+ np.testing.assert_equal(I, expected)
+
+ I = nx.incidence_matrix(MG, dtype=int).todense()
+ # fmt: off
+ expected = np.array(
+ [[1, 0, 0, 0, 0, 0, 0],
+ [1, 0, 0, 0, 0, 0, 0],
+ [0, 1, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0],
+ [0, 1, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 1, 1, 0],
+ [0, 0, 0, 0, 0, 1, 1],
+ [0, 0, 0, 0, 1, 0, 1]]
+ )
+ # fmt: on
+ np.testing.assert_equal(I, expected)
+
+ with pytest.raises(NetworkXError):
+ nx.incidence_matrix(G, nodelist=[0, 1])
+
+
+class TestGraphMatrix:
+ @classmethod
+ def setup_class(cls):
+ deg = [3, 2, 2, 1, 0]
+ cls.G = havel_hakimi_graph(deg)
+ # fmt: off
+ cls.OI = np.array(
+ [[-1, -1, -1, 0],
+ [1, 0, 0, -1],
+ [0, 1, 0, 1],
+ [0, 0, 1, 0],
+ [0, 0, 0, 0]]
+ )
+ cls.A = np.array(
+ [[0, 1, 1, 1, 0],
+ [1, 0, 1, 0, 0],
+ [1, 1, 0, 0, 0],
+ [1, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0]]
+ )
+ # fmt: on
+ cls.WG = havel_hakimi_graph(deg)
+ cls.WG.add_edges_from(
+ (u, v, {"weight": 0.5, "other": 0.3}) for (u, v) in cls.G.edges()
+ )
+ # fmt: off
+ cls.WA = np.array(
+ [[0, 0.5, 0.5, 0.5, 0],
+ [0.5, 0, 0.5, 0, 0],
+ [0.5, 0.5, 0, 0, 0],
+ [0.5, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0]]
+ )
+ # fmt: on
+ cls.MG = nx.MultiGraph(cls.G)
+ cls.MG2 = cls.MG.copy()
+ cls.MG2.add_edge(0, 1)
+ # fmt: off
+ cls.MG2A = np.array(
+ [[0, 2, 1, 1, 0],
+ [2, 0, 1, 0, 0],
+ [1, 1, 0, 0, 0],
+ [1, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0]]
+ )
+ cls.MGOI = np.array(
+ [[-1, -1, -1, -1, 0],
+ [1, 1, 0, 0, -1],
+ [0, 0, 1, 0, 1],
+ [0, 0, 0, 1, 0],
+ [0, 0, 0, 0, 0]]
+ )
+ # fmt: on
+ cls.no_edges_G = nx.Graph([(1, 2), (3, 2, {"weight": 8})])
+ cls.no_edges_A = np.array([[0, 0], [0, 0]])
+
+ def test_incidence_matrix(self):
+ "Conversion to incidence matrix"
+ I = nx.incidence_matrix(
+ self.G,
+ nodelist=sorted(self.G),
+ edgelist=sorted(self.G.edges()),
+ oriented=True,
+ dtype=int,
+ ).todense()
+ np.testing.assert_equal(I, self.OI)
+
+ I = nx.incidence_matrix(
+ self.G,
+ nodelist=sorted(self.G),
+ edgelist=sorted(self.G.edges()),
+ oriented=False,
+ dtype=int,
+ ).todense()
+ np.testing.assert_equal(I, np.abs(self.OI))
+
+ I = nx.incidence_matrix(
+ self.MG,
+ nodelist=sorted(self.MG),
+ edgelist=sorted(self.MG.edges()),
+ oriented=True,
+ dtype=int,
+ ).todense()
+ np.testing.assert_equal(I, self.OI)
+
+ I = nx.incidence_matrix(
+ self.MG,
+ nodelist=sorted(self.MG),
+ edgelist=sorted(self.MG.edges()),
+ oriented=False,
+ dtype=int,
+ ).todense()
+ np.testing.assert_equal(I, np.abs(self.OI))
+
+ I = nx.incidence_matrix(
+ self.MG2,
+ nodelist=sorted(self.MG2),
+ edgelist=sorted(self.MG2.edges()),
+ oriented=True,
+ dtype=int,
+ ).todense()
+ np.testing.assert_equal(I, self.MGOI)
+
+ I = nx.incidence_matrix(
+ self.MG2,
+ nodelist=sorted(self.MG),
+ edgelist=sorted(self.MG2.edges()),
+ oriented=False,
+ dtype=int,
+ ).todense()
+ np.testing.assert_equal(I, np.abs(self.MGOI))
+
+ I = nx.incidence_matrix(self.G, dtype=np.uint8)
+ assert I.dtype == np.uint8
+
+ def test_weighted_incidence_matrix(self):
+ I = nx.incidence_matrix(
+ self.WG,
+ nodelist=sorted(self.WG),
+ edgelist=sorted(self.WG.edges()),
+ oriented=True,
+ dtype=int,
+ ).todense()
+ np.testing.assert_equal(I, self.OI)
+
+ I = nx.incidence_matrix(
+ self.WG,
+ nodelist=sorted(self.WG),
+ edgelist=sorted(self.WG.edges()),
+ oriented=False,
+ dtype=int,
+ ).todense()
+ np.testing.assert_equal(I, np.abs(self.OI))
+
+ # np.testing.assert_equal(nx.incidence_matrix(self.WG,oriented=True,
+ # weight='weight').todense(),0.5*self.OI)
+ # np.testing.assert_equal(nx.incidence_matrix(self.WG,weight='weight').todense(),
+ # np.abs(0.5*self.OI))
+ # np.testing.assert_equal(nx.incidence_matrix(self.WG,oriented=True,weight='other').todense(),
+ # 0.3*self.OI)
+
+ I = nx.incidence_matrix(
+ self.WG,
+ nodelist=sorted(self.WG),
+ edgelist=sorted(self.WG.edges()),
+ oriented=True,
+ weight="weight",
+ ).todense()
+ np.testing.assert_equal(I, 0.5 * self.OI)
+
+ I = nx.incidence_matrix(
+ self.WG,
+ nodelist=sorted(self.WG),
+ edgelist=sorted(self.WG.edges()),
+ oriented=False,
+ weight="weight",
+ ).todense()
+ np.testing.assert_equal(I, np.abs(0.5 * self.OI))
+
+ I = nx.incidence_matrix(
+ self.WG,
+ nodelist=sorted(self.WG),
+ edgelist=sorted(self.WG.edges()),
+ oriented=True,
+ weight="other",
+ ).todense()
+ np.testing.assert_equal(I, 0.3 * self.OI)
+
+ # WMG=nx.MultiGraph(self.WG)
+ # WMG.add_edge(0,1,weight=0.5,other=0.3)
+ # np.testing.assert_equal(nx.incidence_matrix(WMG,weight='weight').todense(),
+ # np.abs(0.5*self.MGOI))
+ # np.testing.assert_equal(nx.incidence_matrix(WMG,weight='weight',oriented=True).todense(),
+ # 0.5*self.MGOI)
+ # np.testing.assert_equal(nx.incidence_matrix(WMG,weight='other',oriented=True).todense(),
+ # 0.3*self.MGOI)
+
+ WMG = nx.MultiGraph(self.WG)
+ WMG.add_edge(0, 1, weight=0.5, other=0.3)
+
+ I = nx.incidence_matrix(
+ WMG,
+ nodelist=sorted(WMG),
+ edgelist=sorted(WMG.edges(keys=True)),
+ oriented=True,
+ weight="weight",
+ ).todense()
+ np.testing.assert_equal(I, 0.5 * self.MGOI)
+
+ I = nx.incidence_matrix(
+ WMG,
+ nodelist=sorted(WMG),
+ edgelist=sorted(WMG.edges(keys=True)),
+ oriented=False,
+ weight="weight",
+ ).todense()
+ np.testing.assert_equal(I, np.abs(0.5 * self.MGOI))
+
+ I = nx.incidence_matrix(
+ WMG,
+ nodelist=sorted(WMG),
+ edgelist=sorted(WMG.edges(keys=True)),
+ oriented=True,
+ weight="other",
+ ).todense()
+ np.testing.assert_equal(I, 0.3 * self.MGOI)
+
+ def test_adjacency_matrix(self):
+ "Conversion to adjacency matrix"
+ np.testing.assert_equal(nx.adjacency_matrix(self.G).todense(), self.A)
+ np.testing.assert_equal(nx.adjacency_matrix(self.MG).todense(), self.A)
+ np.testing.assert_equal(nx.adjacency_matrix(self.MG2).todense(), self.MG2A)
+ np.testing.assert_equal(
+ nx.adjacency_matrix(self.G, nodelist=[0, 1]).todense(), self.A[:2, :2]
+ )
+ np.testing.assert_equal(nx.adjacency_matrix(self.WG).todense(), self.WA)
+ np.testing.assert_equal(
+ nx.adjacency_matrix(self.WG, weight=None).todense(), self.A
+ )
+ np.testing.assert_equal(
+ nx.adjacency_matrix(self.MG2, weight=None).todense(), self.MG2A
+ )
+ np.testing.assert_equal(
+ nx.adjacency_matrix(self.WG, weight="other").todense(), 0.6 * self.WA
+ )
+ np.testing.assert_equal(
+ nx.adjacency_matrix(self.no_edges_G, nodelist=[1, 3]).todense(),
+ self.no_edges_A,
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_laplacian.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_laplacian.py
new file mode 100644
index 0000000000000000000000000000000000000000..23f1b28e19f1af4097ae3e99501a45439a6f1598
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_laplacian.py
@@ -0,0 +1,336 @@
+import pytest
+
+np = pytest.importorskip("numpy")
+pytest.importorskip("scipy")
+
+import networkx as nx
+from networkx.generators.degree_seq import havel_hakimi_graph
+from networkx.generators.expanders import margulis_gabber_galil_graph
+
+
+class TestLaplacian:
+ @classmethod
+ def setup_class(cls):
+ deg = [3, 2, 2, 1, 0]
+ cls.G = havel_hakimi_graph(deg)
+ cls.WG = nx.Graph(
+ (u, v, {"weight": 0.5, "other": 0.3}) for (u, v) in cls.G.edges()
+ )
+ cls.WG.add_node(4)
+ cls.MG = nx.MultiGraph(cls.G)
+
+ # Graph with clsloops
+ cls.Gsl = cls.G.copy()
+ for node in cls.Gsl.nodes():
+ cls.Gsl.add_edge(node, node)
+
+ # Graph used as an example in Sec. 4.1 of Langville and Meyer,
+ # "Google's PageRank and Beyond".
+ cls.DiG = nx.DiGraph()
+ cls.DiG.add_edges_from(
+ (
+ (1, 2),
+ (1, 3),
+ (3, 1),
+ (3, 2),
+ (3, 5),
+ (4, 5),
+ (4, 6),
+ (5, 4),
+ (5, 6),
+ (6, 4),
+ )
+ )
+ cls.DiMG = nx.MultiDiGraph(cls.DiG)
+ cls.DiWG = nx.DiGraph(
+ (u, v, {"weight": 0.5, "other": 0.3}) for (u, v) in cls.DiG.edges()
+ )
+ cls.DiGsl = cls.DiG.copy()
+ for node in cls.DiGsl.nodes():
+ cls.DiGsl.add_edge(node, node)
+
+ def test_laplacian(self):
+ "Graph Laplacian"
+ # fmt: off
+ NL = np.array([[ 3, -1, -1, -1, 0],
+ [-1, 2, -1, 0, 0],
+ [-1, -1, 2, 0, 0],
+ [-1, 0, 0, 1, 0],
+ [ 0, 0, 0, 0, 0]])
+ # fmt: on
+ WL = 0.5 * NL
+ OL = 0.3 * NL
+ # fmt: off
+ DiNL = np.array([[ 2, -1, -1, 0, 0, 0],
+ [ 0, 0, 0, 0, 0, 0],
+ [-1, -1, 3, -1, 0, 0],
+ [ 0, 0, 0, 2, -1, -1],
+ [ 0, 0, 0, -1, 2, -1],
+ [ 0, 0, 0, 0, -1, 1]])
+ # fmt: on
+ DiWL = 0.5 * DiNL
+ DiOL = 0.3 * DiNL
+ np.testing.assert_equal(nx.laplacian_matrix(self.G).todense(), NL)
+ np.testing.assert_equal(nx.laplacian_matrix(self.MG).todense(), NL)
+ np.testing.assert_equal(
+ nx.laplacian_matrix(self.G, nodelist=[0, 1]).todense(),
+ np.array([[1, -1], [-1, 1]]),
+ )
+ np.testing.assert_equal(nx.laplacian_matrix(self.WG).todense(), WL)
+ np.testing.assert_equal(nx.laplacian_matrix(self.WG, weight=None).todense(), NL)
+ np.testing.assert_equal(
+ nx.laplacian_matrix(self.WG, weight="other").todense(), OL
+ )
+
+ np.testing.assert_equal(nx.laplacian_matrix(self.DiG).todense(), DiNL)
+ np.testing.assert_equal(nx.laplacian_matrix(self.DiMG).todense(), DiNL)
+ np.testing.assert_equal(
+ nx.laplacian_matrix(self.DiG, nodelist=[1, 2]).todense(),
+ np.array([[1, -1], [0, 0]]),
+ )
+ np.testing.assert_equal(nx.laplacian_matrix(self.DiWG).todense(), DiWL)
+ np.testing.assert_equal(
+ nx.laplacian_matrix(self.DiWG, weight=None).todense(), DiNL
+ )
+ np.testing.assert_equal(
+ nx.laplacian_matrix(self.DiWG, weight="other").todense(), DiOL
+ )
+
+ def test_normalized_laplacian(self):
+ "Generalized Graph Laplacian"
+ # fmt: off
+ G = np.array([[ 1. , -0.408, -0.408, -0.577, 0.],
+ [-0.408, 1. , -0.5 , 0. , 0.],
+ [-0.408, -0.5 , 1. , 0. , 0.],
+ [-0.577, 0. , 0. , 1. , 0.],
+ [ 0. , 0. , 0. , 0. , 0.]])
+ GL = np.array([[ 1. , -0.408, -0.408, -0.577, 0. ],
+ [-0.408, 1. , -0.5 , 0. , 0. ],
+ [-0.408, -0.5 , 1. , 0. , 0. ],
+ [-0.577, 0. , 0. , 1. , 0. ],
+ [ 0. , 0. , 0. , 0. , 0. ]])
+ Lsl = np.array([[ 0.75 , -0.2887, -0.2887, -0.3536, 0. ],
+ [-0.2887, 0.6667, -0.3333, 0. , 0. ],
+ [-0.2887, -0.3333, 0.6667, 0. , 0. ],
+ [-0.3536, 0. , 0. , 0.5 , 0. ],
+ [ 0. , 0. , 0. , 0. , 0. ]])
+
+ DiG = np.array([[ 1. , 0. , -0.4082, 0. , 0. , 0. ],
+ [ 0. , 0. , 0. , 0. , 0. , 0. ],
+ [-0.4082, 0. , 1. , 0. , -0.4082, 0. ],
+ [ 0. , 0. , 0. , 1. , -0.5 , -0.7071],
+ [ 0. , 0. , 0. , -0.5 , 1. , -0.7071],
+ [ 0. , 0. , 0. , -0.7071, 0. , 1. ]])
+ DiGL = np.array([[ 1. , 0. , -0.4082, 0. , 0. , 0. ],
+ [ 0. , 0. , 0. , 0. , 0. , 0. ],
+ [-0.4082, 0. , 1. , -0.4082, 0. , 0. ],
+ [ 0. , 0. , 0. , 1. , -0.5 , -0.7071],
+ [ 0. , 0. , 0. , -0.5 , 1. , -0.7071],
+ [ 0. , 0. , 0. , 0. , -0.7071, 1. ]])
+ DiLsl = np.array([[ 0.6667, -0.5774, -0.2887, 0. , 0. , 0. ],
+ [ 0. , 0. , 0. , 0. , 0. , 0. ],
+ [-0.2887, -0.5 , 0.75 , -0.2887, 0. , 0. ],
+ [ 0. , 0. , 0. , 0.6667, -0.3333, -0.4082],
+ [ 0. , 0. , 0. , -0.3333, 0.6667, -0.4082],
+ [ 0. , 0. , 0. , 0. , -0.4082, 0.5 ]])
+ # fmt: on
+
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.G, nodelist=range(5)).todense(),
+ G,
+ decimal=3,
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.G).todense(), GL, decimal=3
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.MG).todense(), GL, decimal=3
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.WG).todense(), GL, decimal=3
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.WG, weight="other").todense(),
+ GL,
+ decimal=3,
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.Gsl).todense(), Lsl, decimal=3
+ )
+
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(
+ self.DiG,
+ nodelist=range(1, 1 + 6),
+ ).todense(),
+ DiG,
+ decimal=3,
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.DiG).todense(), DiGL, decimal=3
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.DiMG).todense(), DiGL, decimal=3
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.DiWG).todense(), DiGL, decimal=3
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.DiWG, weight="other").todense(),
+ DiGL,
+ decimal=3,
+ )
+ np.testing.assert_almost_equal(
+ nx.normalized_laplacian_matrix(self.DiGsl).todense(), DiLsl, decimal=3
+ )
+
+
+def test_directed_laplacian():
+ "Directed Laplacian"
+ # Graph used as an example in Sec. 4.1 of Langville and Meyer,
+ # "Google's PageRank and Beyond". The graph contains dangling nodes, so
+ # the pagerank random walk is selected by directed_laplacian
+ G = nx.DiGraph()
+ G.add_edges_from(
+ (
+ (1, 2),
+ (1, 3),
+ (3, 1),
+ (3, 2),
+ (3, 5),
+ (4, 5),
+ (4, 6),
+ (5, 4),
+ (5, 6),
+ (6, 4),
+ )
+ )
+ # fmt: off
+ GL = np.array([[ 0.9833, -0.2941, -0.3882, -0.0291, -0.0231, -0.0261],
+ [-0.2941, 0.8333, -0.2339, -0.0536, -0.0589, -0.0554],
+ [-0.3882, -0.2339, 0.9833, -0.0278, -0.0896, -0.0251],
+ [-0.0291, -0.0536, -0.0278, 0.9833, -0.4878, -0.6675],
+ [-0.0231, -0.0589, -0.0896, -0.4878, 0.9833, -0.2078],
+ [-0.0261, -0.0554, -0.0251, -0.6675, -0.2078, 0.9833]])
+ # fmt: on
+ L = nx.directed_laplacian_matrix(G, alpha=0.9, nodelist=sorted(G))
+ np.testing.assert_almost_equal(L, GL, decimal=3)
+
+ # Make the graph strongly connected, so we can use a random and lazy walk
+ G.add_edges_from(((2, 5), (6, 1)))
+ # fmt: off
+ GL = np.array([[ 1. , -0.3062, -0.4714, 0. , 0. , -0.3227],
+ [-0.3062, 1. , -0.1443, 0. , -0.3162, 0. ],
+ [-0.4714, -0.1443, 1. , 0. , -0.0913, 0. ],
+ [ 0. , 0. , 0. , 1. , -0.5 , -0.5 ],
+ [ 0. , -0.3162, -0.0913, -0.5 , 1. , -0.25 ],
+ [-0.3227, 0. , 0. , -0.5 , -0.25 , 1. ]])
+ # fmt: on
+ L = nx.directed_laplacian_matrix(
+ G, alpha=0.9, nodelist=sorted(G), walk_type="random"
+ )
+ np.testing.assert_almost_equal(L, GL, decimal=3)
+
+ # fmt: off
+ GL = np.array([[ 0.5 , -0.1531, -0.2357, 0. , 0. , -0.1614],
+ [-0.1531, 0.5 , -0.0722, 0. , -0.1581, 0. ],
+ [-0.2357, -0.0722, 0.5 , 0. , -0.0456, 0. ],
+ [ 0. , 0. , 0. , 0.5 , -0.25 , -0.25 ],
+ [ 0. , -0.1581, -0.0456, -0.25 , 0.5 , -0.125 ],
+ [-0.1614, 0. , 0. , -0.25 , -0.125 , 0.5 ]])
+ # fmt: on
+ L = nx.directed_laplacian_matrix(G, alpha=0.9, nodelist=sorted(G), walk_type="lazy")
+ np.testing.assert_almost_equal(L, GL, decimal=3)
+
+ # Make a strongly connected periodic graph
+ G = nx.DiGraph()
+ G.add_edges_from(((1, 2), (2, 4), (4, 1), (1, 3), (3, 4)))
+ # fmt: off
+ GL = np.array([[ 0.5 , -0.176, -0.176, -0.25 ],
+ [-0.176, 0.5 , 0. , -0.176],
+ [-0.176, 0. , 0.5 , -0.176],
+ [-0.25 , -0.176, -0.176, 0.5 ]])
+ # fmt: on
+ L = nx.directed_laplacian_matrix(G, alpha=0.9, nodelist=sorted(G))
+ np.testing.assert_almost_equal(L, GL, decimal=3)
+
+
+def test_directed_combinatorial_laplacian():
+ "Directed combinatorial Laplacian"
+ # Graph used as an example in Sec. 4.1 of Langville and Meyer,
+ # "Google's PageRank and Beyond". The graph contains dangling nodes, so
+ # the pagerank random walk is selected by directed_laplacian
+ G = nx.DiGraph()
+ G.add_edges_from(
+ (
+ (1, 2),
+ (1, 3),
+ (3, 1),
+ (3, 2),
+ (3, 5),
+ (4, 5),
+ (4, 6),
+ (5, 4),
+ (5, 6),
+ (6, 4),
+ )
+ )
+ # fmt: off
+ GL = np.array([[ 0.0366, -0.0132, -0.0153, -0.0034, -0.0020, -0.0027],
+ [-0.0132, 0.0450, -0.0111, -0.0076, -0.0062, -0.0069],
+ [-0.0153, -0.0111, 0.0408, -0.0035, -0.0083, -0.0027],
+ [-0.0034, -0.0076, -0.0035, 0.3688, -0.1356, -0.2187],
+ [-0.0020, -0.0062, -0.0083, -0.1356, 0.2026, -0.0505],
+ [-0.0027, -0.0069, -0.0027, -0.2187, -0.0505, 0.2815]])
+ # fmt: on
+
+ L = nx.directed_combinatorial_laplacian_matrix(G, alpha=0.9, nodelist=sorted(G))
+ np.testing.assert_almost_equal(L, GL, decimal=3)
+
+ # Make the graph strongly connected, so we can use a random and lazy walk
+ G.add_edges_from(((2, 5), (6, 1)))
+
+ # fmt: off
+ GL = np.array([[ 0.1395, -0.0349, -0.0465, 0. , 0. , -0.0581],
+ [-0.0349, 0.093 , -0.0116, 0. , -0.0465, 0. ],
+ [-0.0465, -0.0116, 0.0698, 0. , -0.0116, 0. ],
+ [ 0. , 0. , 0. , 0.2326, -0.1163, -0.1163],
+ [ 0. , -0.0465, -0.0116, -0.1163, 0.2326, -0.0581],
+ [-0.0581, 0. , 0. , -0.1163, -0.0581, 0.2326]])
+ # fmt: on
+
+ L = nx.directed_combinatorial_laplacian_matrix(
+ G, alpha=0.9, nodelist=sorted(G), walk_type="random"
+ )
+ np.testing.assert_almost_equal(L, GL, decimal=3)
+
+ # fmt: off
+ GL = np.array([[ 0.0698, -0.0174, -0.0233, 0. , 0. , -0.0291],
+ [-0.0174, 0.0465, -0.0058, 0. , -0.0233, 0. ],
+ [-0.0233, -0.0058, 0.0349, 0. , -0.0058, 0. ],
+ [ 0. , 0. , 0. , 0.1163, -0.0581, -0.0581],
+ [ 0. , -0.0233, -0.0058, -0.0581, 0.1163, -0.0291],
+ [-0.0291, 0. , 0. , -0.0581, -0.0291, 0.1163]])
+ # fmt: on
+
+ L = nx.directed_combinatorial_laplacian_matrix(
+ G, alpha=0.9, nodelist=sorted(G), walk_type="lazy"
+ )
+ np.testing.assert_almost_equal(L, GL, decimal=3)
+
+ E = nx.DiGraph(margulis_gabber_galil_graph(2))
+ L = nx.directed_combinatorial_laplacian_matrix(E)
+ # fmt: off
+ expected = np.array(
+ [[ 0.16666667, -0.08333333, -0.08333333, 0. ],
+ [-0.08333333, 0.16666667, 0. , -0.08333333],
+ [-0.08333333, 0. , 0.16666667, -0.08333333],
+ [ 0. , -0.08333333, -0.08333333, 0.16666667]]
+ )
+ # fmt: on
+ np.testing.assert_almost_equal(L, expected, decimal=6)
+
+ with pytest.raises(nx.NetworkXError):
+ nx.directed_combinatorial_laplacian_matrix(G, walk_type="pagerank", alpha=100)
+ with pytest.raises(nx.NetworkXError):
+ nx.directed_combinatorial_laplacian_matrix(G, walk_type="silly")
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_modularity.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_modularity.py
new file mode 100644
index 0000000000000000000000000000000000000000..9f94ff4db33a427fa2f0ef51470bc1c57c8b8682
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_modularity.py
@@ -0,0 +1,87 @@
+import pytest
+
+np = pytest.importorskip("numpy")
+pytest.importorskip("scipy")
+
+import networkx as nx
+from networkx.generators.degree_seq import havel_hakimi_graph
+
+
+class TestModularity:
+ @classmethod
+ def setup_class(cls):
+ deg = [3, 2, 2, 1, 0]
+ cls.G = havel_hakimi_graph(deg)
+ # Graph used as an example in Sec. 4.1 of Langville and Meyer,
+ # "Google's PageRank and Beyond". (Used for test_directed_laplacian)
+ cls.DG = nx.DiGraph()
+ cls.DG.add_edges_from(
+ (
+ (1, 2),
+ (1, 3),
+ (3, 1),
+ (3, 2),
+ (3, 5),
+ (4, 5),
+ (4, 6),
+ (5, 4),
+ (5, 6),
+ (6, 4),
+ )
+ )
+
+ def test_modularity(self):
+ "Modularity matrix"
+ # fmt: off
+ B = np.array([[-1.125, 0.25, 0.25, 0.625, 0.],
+ [0.25, -0.5, 0.5, -0.25, 0.],
+ [0.25, 0.5, -0.5, -0.25, 0.],
+ [0.625, -0.25, -0.25, -0.125, 0.],
+ [0., 0., 0., 0., 0.]])
+ # fmt: on
+
+ permutation = [4, 0, 1, 2, 3]
+ np.testing.assert_equal(nx.modularity_matrix(self.G), B)
+ np.testing.assert_equal(
+ nx.modularity_matrix(self.G, nodelist=permutation),
+ B[np.ix_(permutation, permutation)],
+ )
+
+ def test_modularity_weight(self):
+ "Modularity matrix with weights"
+ # fmt: off
+ B = np.array([[-1.125, 0.25, 0.25, 0.625, 0.],
+ [0.25, -0.5, 0.5, -0.25, 0.],
+ [0.25, 0.5, -0.5, -0.25, 0.],
+ [0.625, -0.25, -0.25, -0.125, 0.],
+ [0., 0., 0., 0., 0.]])
+ # fmt: on
+
+ G_weighted = self.G.copy()
+ for n1, n2 in G_weighted.edges():
+ G_weighted.edges[n1, n2]["weight"] = 0.5
+ # The following test would fail in networkx 1.1
+ np.testing.assert_equal(nx.modularity_matrix(G_weighted), B)
+ # The following test that the modularity matrix get rescaled accordingly
+ np.testing.assert_equal(
+ nx.modularity_matrix(G_weighted, weight="weight"), 0.5 * B
+ )
+
+ def test_directed_modularity(self):
+ "Directed Modularity matrix"
+ # fmt: off
+ B = np.array([[-0.2, 0.6, 0.8, -0.4, -0.4, -0.4],
+ [0., 0., 0., 0., 0., 0.],
+ [0.7, 0.4, -0.3, -0.6, 0.4, -0.6],
+ [-0.2, -0.4, -0.2, -0.4, 0.6, 0.6],
+ [-0.2, -0.4, -0.2, 0.6, -0.4, 0.6],
+ [-0.1, -0.2, -0.1, 0.8, -0.2, -0.2]])
+ # fmt: on
+ node_permutation = [5, 1, 2, 3, 4, 6]
+ idx_permutation = [4, 0, 1, 2, 3, 5]
+ mm = nx.directed_modularity_matrix(self.DG, nodelist=sorted(self.DG))
+ np.testing.assert_equal(mm, B)
+ np.testing.assert_equal(
+ nx.directed_modularity_matrix(self.DG, nodelist=node_permutation),
+ B[np.ix_(idx_permutation, idx_permutation)],
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_spectrum.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_spectrum.py
new file mode 100644
index 0000000000000000000000000000000000000000..e9101303cba60c56825101fa5762b56a3083e7af
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/linalg/tests/test_spectrum.py
@@ -0,0 +1,71 @@
+import pytest
+
+np = pytest.importorskip("numpy")
+pytest.importorskip("scipy")
+
+import networkx as nx
+from networkx.generators.degree_seq import havel_hakimi_graph
+
+
+class TestSpectrum:
+ @classmethod
+ def setup_class(cls):
+ deg = [3, 2, 2, 1, 0]
+ cls.G = havel_hakimi_graph(deg)
+ cls.P = nx.path_graph(3)
+ cls.WG = nx.Graph(
+ (u, v, {"weight": 0.5, "other": 0.3}) for (u, v) in cls.G.edges()
+ )
+ cls.WG.add_node(4)
+ cls.DG = nx.DiGraph()
+ nx.add_path(cls.DG, [0, 1, 2])
+
+ def test_laplacian_spectrum(self):
+ "Laplacian eigenvalues"
+ evals = np.array([0, 0, 1, 3, 4])
+ e = sorted(nx.laplacian_spectrum(self.G))
+ np.testing.assert_almost_equal(e, evals)
+ e = sorted(nx.laplacian_spectrum(self.WG, weight=None))
+ np.testing.assert_almost_equal(e, evals)
+ e = sorted(nx.laplacian_spectrum(self.WG))
+ np.testing.assert_almost_equal(e, 0.5 * evals)
+ e = sorted(nx.laplacian_spectrum(self.WG, weight="other"))
+ np.testing.assert_almost_equal(e, 0.3 * evals)
+
+ def test_normalized_laplacian_spectrum(self):
+ "Normalized Laplacian eigenvalues"
+ evals = np.array([0, 0, 0.7712864461218, 1.5, 1.7287135538781])
+ e = sorted(nx.normalized_laplacian_spectrum(self.G))
+ np.testing.assert_almost_equal(e, evals)
+ e = sorted(nx.normalized_laplacian_spectrum(self.WG, weight=None))
+ np.testing.assert_almost_equal(e, evals)
+ e = sorted(nx.normalized_laplacian_spectrum(self.WG))
+ np.testing.assert_almost_equal(e, evals)
+ e = sorted(nx.normalized_laplacian_spectrum(self.WG, weight="other"))
+ np.testing.assert_almost_equal(e, evals)
+
+ def test_adjacency_spectrum(self):
+ "Adjacency eigenvalues"
+ evals = np.array([-np.sqrt(2), 0, np.sqrt(2)])
+ e = sorted(nx.adjacency_spectrum(self.P))
+ np.testing.assert_almost_equal(e, evals)
+
+ def test_modularity_spectrum(self):
+ "Modularity eigenvalues"
+ evals = np.array([-1.5, 0.0, 0.0])
+ e = sorted(nx.modularity_spectrum(self.P))
+ np.testing.assert_almost_equal(e, evals)
+ # Directed modularity eigenvalues
+ evals = np.array([-0.5, 0.0, 0.0])
+ e = sorted(nx.modularity_spectrum(self.DG))
+ np.testing.assert_almost_equal(e, evals)
+
+ def test_bethe_hessian_spectrum(self):
+ "Bethe Hessian eigenvalues"
+ evals = np.array([0.5 * (9 - np.sqrt(33)), 4, 0.5 * (9 + np.sqrt(33))])
+ e = sorted(nx.bethe_hessian_spectrum(self.P, r=2))
+ np.testing.assert_almost_equal(e, evals)
+ # Collapses back to Laplacian:
+ e1 = sorted(nx.bethe_hessian_spectrum(self.P, r=1))
+ e2 = sorted(nx.laplacian_spectrum(self.P))
+ np.testing.assert_almost_equal(e1, e2)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..a805c50a7b18bc818f7bb0a8978ee1e7e90277b5
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__init__.py
@@ -0,0 +1,17 @@
+"""
+A package for reading and writing graphs in various formats.
+
+"""
+
+from networkx.readwrite.adjlist import *
+from networkx.readwrite.multiline_adjlist import *
+from networkx.readwrite.edgelist import *
+from networkx.readwrite.pajek import *
+from networkx.readwrite.leda import *
+from networkx.readwrite.sparse6 import *
+from networkx.readwrite.graph6 import *
+from networkx.readwrite.gml import *
+from networkx.readwrite.graphml import *
+from networkx.readwrite.gexf import *
+from networkx.readwrite.json_graph import *
+from networkx.readwrite.text import *
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/__init__.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..20c1ebc0ba4c40c51f9c2119192a72f211ab8756
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/__init__.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/adjlist.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/adjlist.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..decff60d924bc765d97f556a03debb21e3cb7448
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/adjlist.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/leda.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/leda.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3b5d42cdb87154a84c33d05b2973a9e941205e95
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/leda.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/pajek.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/pajek.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..424a082cc7b538b6c8099d8237b3127404f98541
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/__pycache__/pajek.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/adjlist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/adjlist.py
new file mode 100644
index 0000000000000000000000000000000000000000..768af5ad73c148dc6300e66ecc4c440af6e231e8
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/adjlist.py
@@ -0,0 +1,310 @@
+"""
+**************
+Adjacency List
+**************
+Read and write NetworkX graphs as adjacency lists.
+
+Adjacency list format is useful for graphs without data associated
+with nodes or edges and for nodes that can be meaningfully represented
+as strings.
+
+Format
+------
+The adjacency list format consists of lines with node labels. The
+first label in a line is the source node. Further labels in the line
+are considered target nodes and are added to the graph along with an edge
+between the source node and target node.
+
+The graph with edges a-b, a-c, d-e can be represented as the following
+adjacency list (anything following the # in a line is a comment)::
+
+ a b c # source target target
+ d e
+"""
+
+__all__ = ["generate_adjlist", "write_adjlist", "parse_adjlist", "read_adjlist"]
+
+import networkx as nx
+from networkx.utils import open_file
+
+
+def generate_adjlist(G, delimiter=" "):
+ """Generate a single line of the graph G in adjacency list format.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+
+ delimiter : string, optional
+ Separator for node labels
+
+ Returns
+ -------
+ lines : string
+ Lines of data in adjlist format.
+
+ Examples
+ --------
+ >>> G = nx.lollipop_graph(4, 3)
+ >>> for line in nx.generate_adjlist(G):
+ ... print(line)
+ 0 1 2 3
+ 1 2 3
+ 2 3
+ 3 4
+ 4 5
+ 5 6
+ 6
+
+ See Also
+ --------
+ write_adjlist, read_adjlist
+
+ Notes
+ -----
+ The default `delimiter=" "` will result in unexpected results if node names contain
+ whitespace characters. To avoid this problem, specify an alternate delimiter when spaces are
+ valid in node names.
+
+ NB: This option is not available for data that isn't user-generated.
+
+ """
+ directed = G.is_directed()
+ seen = set()
+ for s, nbrs in G.adjacency():
+ line = str(s) + delimiter
+ for t, data in nbrs.items():
+ if not directed and t in seen:
+ continue
+ if G.is_multigraph():
+ for d in data.values():
+ line += str(t) + delimiter
+ else:
+ line += str(t) + delimiter
+ if not directed:
+ seen.add(s)
+ yield line[: -len(delimiter)]
+
+
+@open_file(1, mode="wb")
+def write_adjlist(G, path, comments="#", delimiter=" ", encoding="utf-8"):
+ """Write graph G in single-line adjacency-list format to path.
+
+
+ Parameters
+ ----------
+ G : NetworkX graph
+
+ path : string or file
+ Filename or file handle for data output.
+ Filenames ending in .gz or .bz2 will be compressed.
+
+ comments : string, optional
+ Marker for comment lines
+
+ delimiter : string, optional
+ Separator for node labels
+
+ encoding : string, optional
+ Text encoding.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_adjlist(G, "test.adjlist")
+
+ The path can be a filehandle or a string with the name of the file. If a
+ filehandle is provided, it has to be opened in 'wb' mode.
+
+ >>> fh = open("test.adjlist", "wb")
+ >>> nx.write_adjlist(G, fh)
+
+ Notes
+ -----
+ The default `delimiter=" "` will result in unexpected results if node names contain
+ whitespace characters. To avoid this problem, specify an alternate delimiter when spaces are
+ valid in node names.
+ NB: This option is not available for data that isn't user-generated.
+
+ This format does not store graph, node, or edge data.
+
+ See Also
+ --------
+ read_adjlist, generate_adjlist
+ """
+ import sys
+ import time
+
+ pargs = comments + " ".join(sys.argv) + "\n"
+ header = (
+ pargs
+ + comments
+ + f" GMT {time.asctime(time.gmtime())}\n"
+ + comments
+ + f" {G.name}\n"
+ )
+ path.write(header.encode(encoding))
+
+ for line in generate_adjlist(G, delimiter):
+ line += "\n"
+ path.write(line.encode(encoding))
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def parse_adjlist(
+ lines, comments="#", delimiter=None, create_using=None, nodetype=None
+):
+ """Parse lines of a graph adjacency list representation.
+
+ Parameters
+ ----------
+ lines : list or iterator of strings
+ Input data in adjlist format
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ nodetype : Python type, optional
+ Convert nodes to this type.
+
+ comments : string, optional
+ Marker for comment lines
+
+ delimiter : string, optional
+ Separator for node labels. The default is whitespace.
+
+ Returns
+ -------
+ G: NetworkX graph
+ The graph corresponding to the lines in adjacency list format.
+
+ Examples
+ --------
+ >>> lines = ["1 2 5", "2 3 4", "3 5", "4", "5"]
+ >>> G = nx.parse_adjlist(lines, nodetype=int)
+ >>> nodes = [1, 2, 3, 4, 5]
+ >>> all(node in G for node in nodes)
+ True
+ >>> edges = [(1, 2), (1, 5), (2, 3), (2, 4), (3, 5)]
+ >>> all((u, v) in G.edges() or (v, u) in G.edges() for (u, v) in edges)
+ True
+
+ See Also
+ --------
+ read_adjlist
+
+ """
+ G = nx.empty_graph(0, create_using)
+ for line in lines:
+ p = line.find(comments)
+ if p >= 0:
+ line = line[:p]
+ if not len(line):
+ continue
+ vlist = line.rstrip("\n").split(delimiter)
+ u = vlist.pop(0)
+ # convert types
+ if nodetype is not None:
+ try:
+ u = nodetype(u)
+ except BaseException as err:
+ raise TypeError(
+ f"Failed to convert node ({u}) to type {nodetype}"
+ ) from err
+ G.add_node(u)
+ if nodetype is not None:
+ try:
+ vlist = list(map(nodetype, vlist))
+ except BaseException as err:
+ raise TypeError(
+ f"Failed to convert nodes ({','.join(vlist)}) to type {nodetype}"
+ ) from err
+ G.add_edges_from([(u, v) for v in vlist])
+ return G
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_adjlist(
+ path,
+ comments="#",
+ delimiter=None,
+ create_using=None,
+ nodetype=None,
+ encoding="utf-8",
+):
+ """Read graph in adjacency list format from path.
+
+ Parameters
+ ----------
+ path : string or file
+ Filename or file handle to read.
+ Filenames ending in .gz or .bz2 will be uncompressed.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ nodetype : Python type, optional
+ Convert nodes to this type.
+
+ comments : string, optional
+ Marker for comment lines
+
+ delimiter : string, optional
+ Separator for node labels. The default is whitespace.
+
+ Returns
+ -------
+ G: NetworkX graph
+ The graph corresponding to the lines in adjacency list format.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_adjlist(G, "test.adjlist")
+ >>> G = nx.read_adjlist("test.adjlist")
+
+ The path can be a filehandle or a string with the name of the file. If a
+ filehandle is provided, it has to be opened in 'rb' mode.
+
+ >>> fh = open("test.adjlist", "rb")
+ >>> G = nx.read_adjlist(fh)
+
+ Filenames ending in .gz or .bz2 will be compressed.
+
+ >>> nx.write_adjlist(G, "test.adjlist.gz")
+ >>> G = nx.read_adjlist("test.adjlist.gz")
+
+ The optional nodetype is a function to convert node strings to nodetype.
+
+ For example
+
+ >>> G = nx.read_adjlist("test.adjlist", nodetype=int)
+
+ will attempt to convert all nodes to integer type.
+
+ Since nodes must be hashable, the function nodetype must return hashable
+ types (e.g. int, float, str, frozenset - or tuples of those, etc.)
+
+ The optional create_using parameter indicates the type of NetworkX graph
+ created. The default is `nx.Graph`, an undirected graph.
+ To read the data as a directed graph use
+
+ >>> G = nx.read_adjlist("test.adjlist", create_using=nx.DiGraph)
+
+ Notes
+ -----
+ This format does not store graph or node data.
+
+ See Also
+ --------
+ write_adjlist
+ """
+ lines = (line.decode(encoding) for line in path)
+ return parse_adjlist(
+ lines,
+ comments=comments,
+ delimiter=delimiter,
+ create_using=create_using,
+ nodetype=nodetype,
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/edgelist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/edgelist.py
new file mode 100644
index 0000000000000000000000000000000000000000..393b64ed7fec4a632fcaded6cb25fd7a6393a0bf
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/edgelist.py
@@ -0,0 +1,489 @@
+"""
+**********
+Edge Lists
+**********
+Read and write NetworkX graphs as edge lists.
+
+The multi-line adjacency list format is useful for graphs with nodes
+that can be meaningfully represented as strings. With the edgelist
+format simple edge data can be stored but node or graph data is not.
+There is no way of representing isolated nodes unless the node has a
+self-loop edge.
+
+Format
+------
+You can read or write three formats of edge lists with these functions.
+
+Node pairs with no data::
+
+ 1 2
+
+Python dictionary as data::
+
+ 1 2 {'weight':7, 'color':'green'}
+
+Arbitrary data::
+
+ 1 2 7 green
+"""
+
+__all__ = [
+ "generate_edgelist",
+ "write_edgelist",
+ "parse_edgelist",
+ "read_edgelist",
+ "read_weighted_edgelist",
+ "write_weighted_edgelist",
+]
+
+import networkx as nx
+from networkx.utils import open_file
+
+
+def generate_edgelist(G, delimiter=" ", data=True):
+ """Generate a single line of the graph G in edge list format.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+
+ delimiter : string, optional
+ Separator for node labels
+
+ data : bool or list of keys
+ If False generate no edge data. If True use a dictionary
+ representation of edge data. If a list of keys use a list of data
+ values corresponding to the keys.
+
+ Returns
+ -------
+ lines : string
+ Lines of data in adjlist format.
+
+ Examples
+ --------
+ >>> G = nx.lollipop_graph(4, 3)
+ >>> G[1][2]["weight"] = 3
+ >>> G[3][4]["capacity"] = 12
+ >>> for line in nx.generate_edgelist(G, data=False):
+ ... print(line)
+ 0 1
+ 0 2
+ 0 3
+ 1 2
+ 1 3
+ 2 3
+ 3 4
+ 4 5
+ 5 6
+
+ >>> for line in nx.generate_edgelist(G):
+ ... print(line)
+ 0 1 {}
+ 0 2 {}
+ 0 3 {}
+ 1 2 {'weight': 3}
+ 1 3 {}
+ 2 3 {}
+ 3 4 {'capacity': 12}
+ 4 5 {}
+ 5 6 {}
+
+ >>> for line in nx.generate_edgelist(G, data=["weight"]):
+ ... print(line)
+ 0 1
+ 0 2
+ 0 3
+ 1 2 3
+ 1 3
+ 2 3
+ 3 4
+ 4 5
+ 5 6
+
+ See Also
+ --------
+ write_adjlist, read_adjlist
+ """
+ if data is True:
+ for u, v, d in G.edges(data=True):
+ e = u, v, dict(d)
+ yield delimiter.join(map(str, e))
+ elif data is False:
+ for u, v in G.edges(data=False):
+ e = u, v
+ yield delimiter.join(map(str, e))
+ else:
+ for u, v, d in G.edges(data=True):
+ e = [u, v]
+ try:
+ e.extend(d[k] for k in data)
+ except KeyError:
+ pass # missing data for this edge, should warn?
+ yield delimiter.join(map(str, e))
+
+
+@open_file(1, mode="wb")
+def write_edgelist(G, path, comments="#", delimiter=" ", data=True, encoding="utf-8"):
+ """Write graph as a list of edges.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+ path : file or string
+ File or filename to write. If a file is provided, it must be
+ opened in 'wb' mode. Filenames ending in .gz or .bz2 will be compressed.
+ comments : string, optional
+ The character used to indicate the start of a comment
+ delimiter : string, optional
+ The string used to separate values. The default is whitespace.
+ data : bool or list, optional
+ If False write no edge data.
+ If True write a string representation of the edge data dictionary..
+ If a list (or other iterable) is provided, write the keys specified
+ in the list.
+ encoding: string, optional
+ Specify which encoding to use when writing file.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_edgelist(G, "test.edgelist")
+ >>> G = nx.path_graph(4)
+ >>> fh = open("test.edgelist", "wb")
+ >>> nx.write_edgelist(G, fh)
+ >>> nx.write_edgelist(G, "test.edgelist.gz")
+ >>> nx.write_edgelist(G, "test.edgelist.gz", data=False)
+
+ >>> G = nx.Graph()
+ >>> G.add_edge(1, 2, weight=7, color="red")
+ >>> nx.write_edgelist(G, "test.edgelist", data=False)
+ >>> nx.write_edgelist(G, "test.edgelist", data=["color"])
+ >>> nx.write_edgelist(G, "test.edgelist", data=["color", "weight"])
+
+ See Also
+ --------
+ read_edgelist
+ write_weighted_edgelist
+ """
+
+ for line in generate_edgelist(G, delimiter, data):
+ line += "\n"
+ path.write(line.encode(encoding))
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def parse_edgelist(
+ lines, comments="#", delimiter=None, create_using=None, nodetype=None, data=True
+):
+ """Parse lines of an edge list representation of a graph.
+
+ Parameters
+ ----------
+ lines : list or iterator of strings
+ Input data in edgelist format
+ comments : string, optional
+ Marker for comment lines. Default is `'#'`. To specify that no character
+ should be treated as a comment, use ``comments=None``.
+ delimiter : string, optional
+ Separator for node labels. Default is `None`, meaning any whitespace.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ nodetype : Python type, optional
+ Convert nodes to this type. Default is `None`, meaning no conversion is
+ performed.
+ data : bool or list of (label,type) tuples
+ If `False` generate no edge data or if `True` use a dictionary
+ representation of edge data or a list tuples specifying dictionary
+ key names and types for edge data.
+
+ Returns
+ -------
+ G: NetworkX Graph
+ The graph corresponding to lines
+
+ Examples
+ --------
+ Edgelist with no data:
+
+ >>> lines = ["1 2", "2 3", "3 4"]
+ >>> G = nx.parse_edgelist(lines, nodetype=int)
+ >>> list(G)
+ [1, 2, 3, 4]
+ >>> list(G.edges())
+ [(1, 2), (2, 3), (3, 4)]
+
+ Edgelist with data in Python dictionary representation:
+
+ >>> lines = ["1 2 {'weight': 3}", "2 3 {'weight': 27}", "3 4 {'weight': 3.0}"]
+ >>> G = nx.parse_edgelist(lines, nodetype=int)
+ >>> list(G)
+ [1, 2, 3, 4]
+ >>> list(G.edges(data=True))
+ [(1, 2, {'weight': 3}), (2, 3, {'weight': 27}), (3, 4, {'weight': 3.0})]
+
+ Edgelist with data in a list:
+
+ >>> lines = ["1 2 3", "2 3 27", "3 4 3.0"]
+ >>> G = nx.parse_edgelist(lines, nodetype=int, data=(("weight", float),))
+ >>> list(G)
+ [1, 2, 3, 4]
+ >>> list(G.edges(data=True))
+ [(1, 2, {'weight': 3.0}), (2, 3, {'weight': 27.0}), (3, 4, {'weight': 3.0})]
+
+ See Also
+ --------
+ read_weighted_edgelist
+ """
+ from ast import literal_eval
+
+ G = nx.empty_graph(0, create_using)
+ for line in lines:
+ if comments is not None:
+ p = line.find(comments)
+ if p >= 0:
+ line = line[:p]
+ if not line:
+ continue
+ # split line, should have 2 or more
+ s = line.rstrip("\n").split(delimiter)
+ if len(s) < 2:
+ continue
+ u = s.pop(0)
+ v = s.pop(0)
+ d = s
+ if nodetype is not None:
+ try:
+ u = nodetype(u)
+ v = nodetype(v)
+ except Exception as err:
+ raise TypeError(
+ f"Failed to convert nodes {u},{v} to type {nodetype}."
+ ) from err
+
+ if len(d) == 0 or data is False:
+ # no data or data type specified
+ edgedata = {}
+ elif data is True:
+ # no edge types specified
+ try: # try to evaluate as dictionary
+ if delimiter == ",":
+ edgedata_str = ",".join(d)
+ else:
+ edgedata_str = " ".join(d)
+ edgedata = dict(literal_eval(edgedata_str.strip()))
+ except Exception as err:
+ raise TypeError(
+ f"Failed to convert edge data ({d}) to dictionary."
+ ) from err
+ else:
+ # convert edge data to dictionary with specified keys and type
+ if len(d) != len(data):
+ raise IndexError(
+ f"Edge data {d} and data_keys {data} are not the same length"
+ )
+ edgedata = {}
+ for (edge_key, edge_type), edge_value in zip(data, d):
+ try:
+ edge_value = edge_type(edge_value)
+ except Exception as err:
+ raise TypeError(
+ f"Failed to convert {edge_key} data {edge_value} "
+ f"to type {edge_type}."
+ ) from err
+ edgedata.update({edge_key: edge_value})
+ G.add_edge(u, v, **edgedata)
+ return G
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_edgelist(
+ path,
+ comments="#",
+ delimiter=None,
+ create_using=None,
+ nodetype=None,
+ data=True,
+ edgetype=None,
+ encoding="utf-8",
+):
+ """Read a graph from a list of edges.
+
+ Parameters
+ ----------
+ path : file or string
+ File or filename to read. If a file is provided, it must be
+ opened in 'rb' mode.
+ Filenames ending in .gz or .bz2 will be uncompressed.
+ comments : string, optional
+ The character used to indicate the start of a comment. To specify that
+ no character should be treated as a comment, use ``comments=None``.
+ delimiter : string, optional
+ The string used to separate values. The default is whitespace.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ nodetype : int, float, str, Python type, optional
+ Convert node data from strings to specified type
+ data : bool or list of (label,type) tuples
+ Tuples specifying dictionary key names and types for edge data
+ edgetype : int, float, str, Python type, optional OBSOLETE
+ Convert edge data from strings to specified type and use as 'weight'
+ encoding: string, optional
+ Specify which encoding to use when reading file.
+
+ Returns
+ -------
+ G : graph
+ A networkx Graph or other type specified with create_using
+
+ Examples
+ --------
+ >>> nx.write_edgelist(nx.path_graph(4), "test.edgelist")
+ >>> G = nx.read_edgelist("test.edgelist")
+
+ >>> fh = open("test.edgelist", "rb")
+ >>> G = nx.read_edgelist(fh)
+ >>> fh.close()
+
+ >>> G = nx.read_edgelist("test.edgelist", nodetype=int)
+ >>> G = nx.read_edgelist("test.edgelist", create_using=nx.DiGraph)
+
+ Edgelist with data in a list:
+
+ >>> textline = "1 2 3"
+ >>> fh = open("test.edgelist", "w")
+ >>> d = fh.write(textline)
+ >>> fh.close()
+ >>> G = nx.read_edgelist("test.edgelist", nodetype=int, data=(("weight", float),))
+ >>> list(G)
+ [1, 2]
+ >>> list(G.edges(data=True))
+ [(1, 2, {'weight': 3.0})]
+
+ See parse_edgelist() for more examples of formatting.
+
+ See Also
+ --------
+ parse_edgelist
+ write_edgelist
+
+ Notes
+ -----
+ Since nodes must be hashable, the function nodetype must return hashable
+ types (e.g. int, float, str, frozenset - or tuples of those, etc.)
+ """
+ lines = (line if isinstance(line, str) else line.decode(encoding) for line in path)
+ return parse_edgelist(
+ lines,
+ comments=comments,
+ delimiter=delimiter,
+ create_using=create_using,
+ nodetype=nodetype,
+ data=data,
+ )
+
+
+def write_weighted_edgelist(G, path, comments="#", delimiter=" ", encoding="utf-8"):
+ """Write graph G as a list of edges with numeric weights.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+ path : file or string
+ File or filename to write. If a file is provided, it must be
+ opened in 'wb' mode.
+ Filenames ending in .gz or .bz2 will be compressed.
+ comments : string, optional
+ The character used to indicate the start of a comment
+ delimiter : string, optional
+ The string used to separate values. The default is whitespace.
+ encoding: string, optional
+ Specify which encoding to use when writing file.
+
+ Examples
+ --------
+ >>> G = nx.Graph()
+ >>> G.add_edge(1, 2, weight=7)
+ >>> nx.write_weighted_edgelist(G, "test.weighted.edgelist")
+
+ See Also
+ --------
+ read_edgelist
+ write_edgelist
+ read_weighted_edgelist
+ """
+ write_edgelist(
+ G,
+ path,
+ comments=comments,
+ delimiter=delimiter,
+ data=("weight",),
+ encoding=encoding,
+ )
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_weighted_edgelist(
+ path,
+ comments="#",
+ delimiter=None,
+ create_using=None,
+ nodetype=None,
+ encoding="utf-8",
+):
+ """Read a graph as list of edges with numeric weights.
+
+ Parameters
+ ----------
+ path : file or string
+ File or filename to read. If a file is provided, it must be
+ opened in 'rb' mode.
+ Filenames ending in .gz or .bz2 will be uncompressed.
+ comments : string, optional
+ The character used to indicate the start of a comment.
+ delimiter : string, optional
+ The string used to separate values. The default is whitespace.
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+ nodetype : int, float, str, Python type, optional
+ Convert node data from strings to specified type
+ encoding: string, optional
+ Specify which encoding to use when reading file.
+
+ Returns
+ -------
+ G : graph
+ A networkx Graph or other type specified with create_using
+
+ Notes
+ -----
+ Since nodes must be hashable, the function nodetype must return hashable
+ types (e.g. int, float, str, frozenset - or tuples of those, etc.)
+
+ Example edgelist file format.
+
+ With numeric edge data::
+
+ # read with
+ # >>> G=nx.read_weighted_edgelist(fh)
+ # source target data
+ a b 1
+ a c 3.14159
+ d e 42
+
+ See Also
+ --------
+ write_weighted_edgelist
+ """
+ return read_edgelist(
+ path,
+ comments=comments,
+ delimiter=delimiter,
+ create_using=create_using,
+ nodetype=nodetype,
+ data=(("weight", float),),
+ encoding=encoding,
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/gexf.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/gexf.py
new file mode 100644
index 0000000000000000000000000000000000000000..f830dd12df609762a4c26bca9c8640474afe426e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/gexf.py
@@ -0,0 +1,1066 @@
+"""Read and write graphs in GEXF format.
+
+.. warning::
+ This parser uses the standard xml library present in Python, which is
+ insecure - see :external+python:mod:`xml` for additional information.
+ Only parse GEFX files you trust.
+
+GEXF (Graph Exchange XML Format) is a language for describing complex
+network structures, their associated data and dynamics.
+
+This implementation does not support mixed graphs (directed and
+undirected edges together).
+
+Format
+------
+GEXF is an XML format. See http://gexf.net/schema.html for the
+specification and http://gexf.net/basic.html for examples.
+"""
+
+import itertools
+import time
+from xml.etree.ElementTree import (
+ Element,
+ ElementTree,
+ SubElement,
+ register_namespace,
+ tostring,
+)
+
+import networkx as nx
+from networkx.utils import open_file
+
+__all__ = ["write_gexf", "read_gexf", "relabel_gexf_graph", "generate_gexf"]
+
+
+@open_file(1, mode="wb")
+def write_gexf(G, path, encoding="utf-8", prettyprint=True, version="1.2draft"):
+ """Write G in GEXF format to path.
+
+ "GEXF (Graph Exchange XML Format) is a language for describing
+ complex networks structures, their associated data and dynamics" [1]_.
+
+ Node attributes are checked according to the version of the GEXF
+ schemas used for parameters which are not user defined,
+ e.g. visualization 'viz' [2]_. See example for usage.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+ path : file or string
+ File or file name to write.
+ File names ending in .gz or .bz2 will be compressed.
+ encoding : string (optional, default: 'utf-8')
+ Encoding for text data.
+ prettyprint : bool (optional, default: True)
+ If True use line breaks and indenting in output XML.
+ version: string (optional, default: '1.2draft')
+ The version of GEXF to be used for nodes attributes checking
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_gexf(G, "test.gexf")
+
+ # visualization data
+ >>> G.nodes[0]["viz"] = {"size": 54}
+ >>> G.nodes[0]["viz"]["position"] = {"x": 0, "y": 1}
+ >>> G.nodes[0]["viz"]["color"] = {"r": 0, "g": 0, "b": 256}
+
+
+ Notes
+ -----
+ This implementation does not support mixed graphs (directed and undirected
+ edges together).
+
+ The node id attribute is set to be the string of the node label.
+ If you want to specify an id use set it as node data, e.g.
+ node['a']['id']=1 to set the id of node 'a' to 1.
+
+ References
+ ----------
+ .. [1] GEXF File Format, http://gexf.net/
+ .. [2] GEXF schema, http://gexf.net/schema.html
+ """
+ writer = GEXFWriter(encoding=encoding, prettyprint=prettyprint, version=version)
+ writer.add_graph(G)
+ writer.write(path)
+
+
+def generate_gexf(G, encoding="utf-8", prettyprint=True, version="1.2draft"):
+ """Generate lines of GEXF format representation of G.
+
+ "GEXF (Graph Exchange XML Format) is a language for describing
+ complex networks structures, their associated data and dynamics" [1]_.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+ encoding : string (optional, default: 'utf-8')
+ Encoding for text data.
+ prettyprint : bool (optional, default: True)
+ If True use line breaks and indenting in output XML.
+ version : string (default: 1.2draft)
+ Version of GEFX File Format (see http://gexf.net/schema.html)
+ Supported values: "1.1draft", "1.2draft"
+
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> linefeed = chr(10) # linefeed=\n
+ >>> s = linefeed.join(nx.generate_gexf(G))
+ >>> for line in nx.generate_gexf(G): # doctest: +SKIP
+ ... print(line)
+
+ Notes
+ -----
+ This implementation does not support mixed graphs (directed and undirected
+ edges together).
+
+ The node id attribute is set to be the string of the node label.
+ If you want to specify an id use set it as node data, e.g.
+ node['a']['id']=1 to set the id of node 'a' to 1.
+
+ References
+ ----------
+ .. [1] GEXF File Format, https://gephi.org/gexf/format/
+ """
+ writer = GEXFWriter(encoding=encoding, prettyprint=prettyprint, version=version)
+ writer.add_graph(G)
+ yield from str(writer).splitlines()
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_gexf(path, node_type=None, relabel=False, version="1.2draft"):
+ """Read graph in GEXF format from path.
+
+ "GEXF (Graph Exchange XML Format) is a language for describing
+ complex networks structures, their associated data and dynamics" [1]_.
+
+ Parameters
+ ----------
+ path : file or string
+ File or file name to read.
+ File names ending in .gz or .bz2 will be decompressed.
+ node_type: Python type (default: None)
+ Convert node ids to this type if not None.
+ relabel : bool (default: False)
+ If True relabel the nodes to use the GEXF node "label" attribute
+ instead of the node "id" attribute as the NetworkX node label.
+ version : string (default: 1.2draft)
+ Version of GEFX File Format (see http://gexf.net/schema.html)
+ Supported values: "1.1draft", "1.2draft"
+
+ Returns
+ -------
+ graph: NetworkX graph
+ If no parallel edges are found a Graph or DiGraph is returned.
+ Otherwise a MultiGraph or MultiDiGraph is returned.
+
+ Notes
+ -----
+ This implementation does not support mixed graphs (directed and undirected
+ edges together).
+
+ References
+ ----------
+ .. [1] GEXF File Format, http://gexf.net/
+ """
+ reader = GEXFReader(node_type=node_type, version=version)
+ if relabel:
+ G = relabel_gexf_graph(reader(path))
+ else:
+ G = reader(path)
+ return G
+
+
+class GEXF:
+ versions = {
+ "1.1draft": {
+ "NS_GEXF": "http://www.gexf.net/1.1draft",
+ "NS_VIZ": "http://www.gexf.net/1.1draft/viz",
+ "NS_XSI": "http://www.w3.org/2001/XMLSchema-instance",
+ "SCHEMALOCATION": " ".join(
+ [
+ "http://www.gexf.net/1.1draft",
+ "http://www.gexf.net/1.1draft/gexf.xsd",
+ ]
+ ),
+ "VERSION": "1.1",
+ },
+ "1.2draft": {
+ "NS_GEXF": "http://www.gexf.net/1.2draft",
+ "NS_VIZ": "http://www.gexf.net/1.2draft/viz",
+ "NS_XSI": "http://www.w3.org/2001/XMLSchema-instance",
+ "SCHEMALOCATION": " ".join(
+ [
+ "http://www.gexf.net/1.2draft",
+ "http://www.gexf.net/1.2draft/gexf.xsd",
+ ]
+ ),
+ "VERSION": "1.2",
+ },
+ }
+
+ def construct_types(self):
+ types = [
+ (int, "integer"),
+ (float, "float"),
+ (float, "double"),
+ (bool, "boolean"),
+ (list, "string"),
+ (dict, "string"),
+ (int, "long"),
+ (str, "liststring"),
+ (str, "anyURI"),
+ (str, "string"),
+ ]
+
+ # These additions to types allow writing numpy types
+ try:
+ import numpy as np
+ except ImportError:
+ pass
+ else:
+ # prepend so that python types are created upon read (last entry wins)
+ types = [
+ (np.float64, "float"),
+ (np.float32, "float"),
+ (np.float16, "float"),
+ (np.int_, "int"),
+ (np.int8, "int"),
+ (np.int16, "int"),
+ (np.int32, "int"),
+ (np.int64, "int"),
+ (np.uint8, "int"),
+ (np.uint16, "int"),
+ (np.uint32, "int"),
+ (np.uint64, "int"),
+ (np.int_, "int"),
+ (np.intc, "int"),
+ (np.intp, "int"),
+ ] + types
+
+ self.xml_type = dict(types)
+ self.python_type = dict(reversed(a) for a in types)
+
+ # http://www.w3.org/TR/xmlschema-2/#boolean
+ convert_bool = {
+ "true": True,
+ "false": False,
+ "True": True,
+ "False": False,
+ "0": False,
+ 0: False,
+ "1": True,
+ 1: True,
+ }
+
+ def set_version(self, version):
+ d = self.versions.get(version)
+ if d is None:
+ raise nx.NetworkXError(f"Unknown GEXF version {version}.")
+ self.NS_GEXF = d["NS_GEXF"]
+ self.NS_VIZ = d["NS_VIZ"]
+ self.NS_XSI = d["NS_XSI"]
+ self.SCHEMALOCATION = d["SCHEMALOCATION"]
+ self.VERSION = d["VERSION"]
+ self.version = version
+
+
+class GEXFWriter(GEXF):
+ # class for writing GEXF format files
+ # use write_gexf() function
+ def __init__(
+ self, graph=None, encoding="utf-8", prettyprint=True, version="1.2draft"
+ ):
+ self.construct_types()
+ self.prettyprint = prettyprint
+ self.encoding = encoding
+ self.set_version(version)
+ self.xml = Element(
+ "gexf",
+ {
+ "xmlns": self.NS_GEXF,
+ "xmlns:xsi": self.NS_XSI,
+ "xsi:schemaLocation": self.SCHEMALOCATION,
+ "version": self.VERSION,
+ },
+ )
+
+ # Make meta element a non-graph element
+ # Also add lastmodifieddate as attribute, not tag
+ meta_element = Element("meta")
+ subelement_text = f"NetworkX {nx.__version__}"
+ SubElement(meta_element, "creator").text = subelement_text
+ meta_element.set("lastmodifieddate", time.strftime("%Y-%m-%d"))
+ self.xml.append(meta_element)
+
+ register_namespace("viz", self.NS_VIZ)
+
+ # counters for edge and attribute identifiers
+ self.edge_id = itertools.count()
+ self.attr_id = itertools.count()
+ self.all_edge_ids = set()
+ # default attributes are stored in dictionaries
+ self.attr = {}
+ self.attr["node"] = {}
+ self.attr["edge"] = {}
+ self.attr["node"]["dynamic"] = {}
+ self.attr["node"]["static"] = {}
+ self.attr["edge"]["dynamic"] = {}
+ self.attr["edge"]["static"] = {}
+
+ if graph is not None:
+ self.add_graph(graph)
+
+ def __str__(self):
+ if self.prettyprint:
+ self.indent(self.xml)
+ s = tostring(self.xml).decode(self.encoding)
+ return s
+
+ def add_graph(self, G):
+ # first pass through G collecting edge ids
+ for u, v, dd in G.edges(data=True):
+ eid = dd.get("id")
+ if eid is not None:
+ self.all_edge_ids.add(str(eid))
+ # set graph attributes
+ if G.graph.get("mode") == "dynamic":
+ mode = "dynamic"
+ else:
+ mode = "static"
+ # Add a graph element to the XML
+ if G.is_directed():
+ default = "directed"
+ else:
+ default = "undirected"
+ name = G.graph.get("name", "")
+ graph_element = Element("graph", defaultedgetype=default, mode=mode, name=name)
+ self.graph_element = graph_element
+ self.add_nodes(G, graph_element)
+ self.add_edges(G, graph_element)
+ self.xml.append(graph_element)
+
+ def add_nodes(self, G, graph_element):
+ nodes_element = Element("nodes")
+ for node, data in G.nodes(data=True):
+ node_data = data.copy()
+ node_id = str(node_data.pop("id", node))
+ kw = {"id": node_id}
+ label = str(node_data.pop("label", node))
+ kw["label"] = label
+ try:
+ pid = node_data.pop("pid")
+ kw["pid"] = str(pid)
+ except KeyError:
+ pass
+ try:
+ start = node_data.pop("start")
+ kw["start"] = str(start)
+ self.alter_graph_mode_timeformat(start)
+ except KeyError:
+ pass
+ try:
+ end = node_data.pop("end")
+ kw["end"] = str(end)
+ self.alter_graph_mode_timeformat(end)
+ except KeyError:
+ pass
+ # add node element with attributes
+ node_element = Element("node", **kw)
+ # add node element and attr subelements
+ default = G.graph.get("node_default", {})
+ node_data = self.add_parents(node_element, node_data)
+ if self.VERSION == "1.1":
+ node_data = self.add_slices(node_element, node_data)
+ else:
+ node_data = self.add_spells(node_element, node_data)
+ node_data = self.add_viz(node_element, node_data)
+ node_data = self.add_attributes("node", node_element, node_data, default)
+ nodes_element.append(node_element)
+ graph_element.append(nodes_element)
+
+ def add_edges(self, G, graph_element):
+ def edge_key_data(G):
+ # helper function to unify multigraph and graph edge iterator
+ if G.is_multigraph():
+ for u, v, key, data in G.edges(data=True, keys=True):
+ edge_data = data.copy()
+ edge_data.update(key=key)
+ edge_id = edge_data.pop("id", None)
+ if edge_id is None:
+ edge_id = next(self.edge_id)
+ while str(edge_id) in self.all_edge_ids:
+ edge_id = next(self.edge_id)
+ self.all_edge_ids.add(str(edge_id))
+ yield u, v, edge_id, edge_data
+ else:
+ for u, v, data in G.edges(data=True):
+ edge_data = data.copy()
+ edge_id = edge_data.pop("id", None)
+ if edge_id is None:
+ edge_id = next(self.edge_id)
+ while str(edge_id) in self.all_edge_ids:
+ edge_id = next(self.edge_id)
+ self.all_edge_ids.add(str(edge_id))
+ yield u, v, edge_id, edge_data
+
+ edges_element = Element("edges")
+ for u, v, key, edge_data in edge_key_data(G):
+ kw = {"id": str(key)}
+ try:
+ edge_label = edge_data.pop("label")
+ kw["label"] = str(edge_label)
+ except KeyError:
+ pass
+ try:
+ edge_weight = edge_data.pop("weight")
+ kw["weight"] = str(edge_weight)
+ except KeyError:
+ pass
+ try:
+ edge_type = edge_data.pop("type")
+ kw["type"] = str(edge_type)
+ except KeyError:
+ pass
+ try:
+ start = edge_data.pop("start")
+ kw["start"] = str(start)
+ self.alter_graph_mode_timeformat(start)
+ except KeyError:
+ pass
+ try:
+ end = edge_data.pop("end")
+ kw["end"] = str(end)
+ self.alter_graph_mode_timeformat(end)
+ except KeyError:
+ pass
+ source_id = str(G.nodes[u].get("id", u))
+ target_id = str(G.nodes[v].get("id", v))
+ edge_element = Element("edge", source=source_id, target=target_id, **kw)
+ default = G.graph.get("edge_default", {})
+ if self.VERSION == "1.1":
+ edge_data = self.add_slices(edge_element, edge_data)
+ else:
+ edge_data = self.add_spells(edge_element, edge_data)
+ edge_data = self.add_viz(edge_element, edge_data)
+ edge_data = self.add_attributes("edge", edge_element, edge_data, default)
+ edges_element.append(edge_element)
+ graph_element.append(edges_element)
+
+ def add_attributes(self, node_or_edge, xml_obj, data, default):
+ # Add attrvalues to node or edge
+ attvalues = Element("attvalues")
+ if len(data) == 0:
+ return data
+ mode = "static"
+ for k, v in data.items():
+ # rename generic multigraph key to avoid any name conflict
+ if k == "key":
+ k = "networkx_key"
+ val_type = type(v)
+ if val_type not in self.xml_type:
+ raise TypeError(f"attribute value type is not allowed: {val_type}")
+ if isinstance(v, list):
+ # dynamic data
+ for val, start, end in v:
+ val_type = type(val)
+ if start is not None or end is not None:
+ mode = "dynamic"
+ self.alter_graph_mode_timeformat(start)
+ self.alter_graph_mode_timeformat(end)
+ break
+ attr_id = self.get_attr_id(
+ str(k), self.xml_type[val_type], node_or_edge, default, mode
+ )
+ for val, start, end in v:
+ e = Element("attvalue")
+ e.attrib["for"] = attr_id
+ e.attrib["value"] = str(val)
+ # Handle nan, inf, -inf differently
+ if val_type == float:
+ if e.attrib["value"] == "inf":
+ e.attrib["value"] = "INF"
+ elif e.attrib["value"] == "nan":
+ e.attrib["value"] = "NaN"
+ elif e.attrib["value"] == "-inf":
+ e.attrib["value"] = "-INF"
+ if start is not None:
+ e.attrib["start"] = str(start)
+ if end is not None:
+ e.attrib["end"] = str(end)
+ attvalues.append(e)
+ else:
+ # static data
+ mode = "static"
+ attr_id = self.get_attr_id(
+ str(k), self.xml_type[val_type], node_or_edge, default, mode
+ )
+ e = Element("attvalue")
+ e.attrib["for"] = attr_id
+ if isinstance(v, bool):
+ e.attrib["value"] = str(v).lower()
+ else:
+ e.attrib["value"] = str(v)
+ # Handle float nan, inf, -inf differently
+ if val_type == float:
+ if e.attrib["value"] == "inf":
+ e.attrib["value"] = "INF"
+ elif e.attrib["value"] == "nan":
+ e.attrib["value"] = "NaN"
+ elif e.attrib["value"] == "-inf":
+ e.attrib["value"] = "-INF"
+ attvalues.append(e)
+ xml_obj.append(attvalues)
+ return data
+
+ def get_attr_id(self, title, attr_type, edge_or_node, default, mode):
+ # find the id of the attribute or generate a new id
+ try:
+ return self.attr[edge_or_node][mode][title]
+ except KeyError:
+ # generate new id
+ new_id = str(next(self.attr_id))
+ self.attr[edge_or_node][mode][title] = new_id
+ attr_kwargs = {"id": new_id, "title": title, "type": attr_type}
+ attribute = Element("attribute", **attr_kwargs)
+ # add subelement for data default value if present
+ default_title = default.get(title)
+ if default_title is not None:
+ default_element = Element("default")
+ default_element.text = str(default_title)
+ attribute.append(default_element)
+ # new insert it into the XML
+ attributes_element = None
+ for a in self.graph_element.findall("attributes"):
+ # find existing attributes element by class and mode
+ a_class = a.get("class")
+ a_mode = a.get("mode", "static")
+ if a_class == edge_or_node and a_mode == mode:
+ attributes_element = a
+ if attributes_element is None:
+ # create new attributes element
+ attr_kwargs = {"mode": mode, "class": edge_or_node}
+ attributes_element = Element("attributes", **attr_kwargs)
+ self.graph_element.insert(0, attributes_element)
+ attributes_element.append(attribute)
+ return new_id
+
+ def add_viz(self, element, node_data):
+ viz = node_data.pop("viz", False)
+ if viz:
+ color = viz.get("color")
+ if color is not None:
+ if self.VERSION == "1.1":
+ e = Element(
+ f"{{{self.NS_VIZ}}}color",
+ r=str(color.get("r")),
+ g=str(color.get("g")),
+ b=str(color.get("b")),
+ )
+ else:
+ e = Element(
+ f"{{{self.NS_VIZ}}}color",
+ r=str(color.get("r")),
+ g=str(color.get("g")),
+ b=str(color.get("b")),
+ a=str(color.get("a", 1.0)),
+ )
+ element.append(e)
+
+ size = viz.get("size")
+ if size is not None:
+ e = Element(f"{{{self.NS_VIZ}}}size", value=str(size))
+ element.append(e)
+
+ thickness = viz.get("thickness")
+ if thickness is not None:
+ e = Element(f"{{{self.NS_VIZ}}}thickness", value=str(thickness))
+ element.append(e)
+
+ shape = viz.get("shape")
+ if shape is not None:
+ if shape.startswith("http"):
+ e = Element(
+ f"{{{self.NS_VIZ}}}shape", value="image", uri=str(shape)
+ )
+ else:
+ e = Element(f"{{{self.NS_VIZ}}}shape", value=str(shape))
+ element.append(e)
+
+ position = viz.get("position")
+ if position is not None:
+ e = Element(
+ f"{{{self.NS_VIZ}}}position",
+ x=str(position.get("x")),
+ y=str(position.get("y")),
+ z=str(position.get("z")),
+ )
+ element.append(e)
+ return node_data
+
+ def add_parents(self, node_element, node_data):
+ parents = node_data.pop("parents", False)
+ if parents:
+ parents_element = Element("parents")
+ for p in parents:
+ e = Element("parent")
+ e.attrib["for"] = str(p)
+ parents_element.append(e)
+ node_element.append(parents_element)
+ return node_data
+
+ def add_slices(self, node_or_edge_element, node_or_edge_data):
+ slices = node_or_edge_data.pop("slices", False)
+ if slices:
+ slices_element = Element("slices")
+ for start, end in slices:
+ e = Element("slice", start=str(start), end=str(end))
+ slices_element.append(e)
+ node_or_edge_element.append(slices_element)
+ return node_or_edge_data
+
+ def add_spells(self, node_or_edge_element, node_or_edge_data):
+ spells = node_or_edge_data.pop("spells", False)
+ if spells:
+ spells_element = Element("spells")
+ for start, end in spells:
+ e = Element("spell")
+ if start is not None:
+ e.attrib["start"] = str(start)
+ self.alter_graph_mode_timeformat(start)
+ if end is not None:
+ e.attrib["end"] = str(end)
+ self.alter_graph_mode_timeformat(end)
+ spells_element.append(e)
+ node_or_edge_element.append(spells_element)
+ return node_or_edge_data
+
+ def alter_graph_mode_timeformat(self, start_or_end):
+ # If 'start' or 'end' appears, alter Graph mode to dynamic and
+ # set timeformat
+ if self.graph_element.get("mode") == "static":
+ if start_or_end is not None:
+ if isinstance(start_or_end, str):
+ timeformat = "date"
+ elif isinstance(start_or_end, float):
+ timeformat = "double"
+ elif isinstance(start_or_end, int):
+ timeformat = "long"
+ else:
+ raise nx.NetworkXError(
+ "timeformat should be of the type int, float or str"
+ )
+ self.graph_element.set("timeformat", timeformat)
+ self.graph_element.set("mode", "dynamic")
+
+ def write(self, fh):
+ # Serialize graph G in GEXF to the open fh
+ if self.prettyprint:
+ self.indent(self.xml)
+ document = ElementTree(self.xml)
+ document.write(fh, encoding=self.encoding, xml_declaration=True)
+
+ def indent(self, elem, level=0):
+ # in-place prettyprint formatter
+ i = "\n" + " " * level
+ if len(elem):
+ if not elem.text or not elem.text.strip():
+ elem.text = i + " "
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ for elem in elem:
+ self.indent(elem, level + 1)
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ else:
+ if level and (not elem.tail or not elem.tail.strip()):
+ elem.tail = i
+
+
+class GEXFReader(GEXF):
+ # Class to read GEXF format files
+ # use read_gexf() function
+ def __init__(self, node_type=None, version="1.2draft"):
+ self.construct_types()
+ self.node_type = node_type
+ # assume simple graph and test for multigraph on read
+ self.simple_graph = True
+ self.set_version(version)
+
+ def __call__(self, stream):
+ self.xml = ElementTree(file=stream)
+ g = self.xml.find(f"{{{self.NS_GEXF}}}graph")
+ if g is not None:
+ return self.make_graph(g)
+ # try all the versions
+ for version in self.versions:
+ self.set_version(version)
+ g = self.xml.find(f"{{{self.NS_GEXF}}}graph")
+ if g is not None:
+ return self.make_graph(g)
+ raise nx.NetworkXError("No element in GEXF file.")
+
+ def make_graph(self, graph_xml):
+ # start with empty DiGraph or MultiDiGraph
+ edgedefault = graph_xml.get("defaultedgetype", None)
+ if edgedefault == "directed":
+ G = nx.MultiDiGraph()
+ else:
+ G = nx.MultiGraph()
+
+ # graph attributes
+ graph_name = graph_xml.get("name", "")
+ if graph_name != "":
+ G.graph["name"] = graph_name
+ graph_start = graph_xml.get("start")
+ if graph_start is not None:
+ G.graph["start"] = graph_start
+ graph_end = graph_xml.get("end")
+ if graph_end is not None:
+ G.graph["end"] = graph_end
+ graph_mode = graph_xml.get("mode", "")
+ if graph_mode == "dynamic":
+ G.graph["mode"] = "dynamic"
+ else:
+ G.graph["mode"] = "static"
+
+ # timeformat
+ self.timeformat = graph_xml.get("timeformat")
+ if self.timeformat == "date":
+ self.timeformat = "string"
+
+ # node and edge attributes
+ attributes_elements = graph_xml.findall(f"{{{self.NS_GEXF}}}attributes")
+ # dictionaries to hold attributes and attribute defaults
+ node_attr = {}
+ node_default = {}
+ edge_attr = {}
+ edge_default = {}
+ for a in attributes_elements:
+ attr_class = a.get("class")
+ if attr_class == "node":
+ na, nd = self.find_gexf_attributes(a)
+ node_attr.update(na)
+ node_default.update(nd)
+ G.graph["node_default"] = node_default
+ elif attr_class == "edge":
+ ea, ed = self.find_gexf_attributes(a)
+ edge_attr.update(ea)
+ edge_default.update(ed)
+ G.graph["edge_default"] = edge_default
+ else:
+ raise # unknown attribute class
+
+ # Hack to handle Gephi0.7beta bug
+ # add weight attribute
+ ea = {"weight": {"type": "double", "mode": "static", "title": "weight"}}
+ ed = {}
+ edge_attr.update(ea)
+ edge_default.update(ed)
+ G.graph["edge_default"] = edge_default
+
+ # add nodes
+ nodes_element = graph_xml.find(f"{{{self.NS_GEXF}}}nodes")
+ if nodes_element is not None:
+ for node_xml in nodes_element.findall(f"{{{self.NS_GEXF}}}node"):
+ self.add_node(G, node_xml, node_attr)
+
+ # add edges
+ edges_element = graph_xml.find(f"{{{self.NS_GEXF}}}edges")
+ if edges_element is not None:
+ for edge_xml in edges_element.findall(f"{{{self.NS_GEXF}}}edge"):
+ self.add_edge(G, edge_xml, edge_attr)
+
+ # switch to Graph or DiGraph if no parallel edges were found.
+ if self.simple_graph:
+ if G.is_directed():
+ G = nx.DiGraph(G)
+ else:
+ G = nx.Graph(G)
+ return G
+
+ def add_node(self, G, node_xml, node_attr, node_pid=None):
+ # add a single node with attributes to the graph
+
+ # get attributes and subattributues for node
+ data = self.decode_attr_elements(node_attr, node_xml)
+ data = self.add_parents(data, node_xml) # add any parents
+ if self.VERSION == "1.1":
+ data = self.add_slices(data, node_xml) # add slices
+ else:
+ data = self.add_spells(data, node_xml) # add spells
+ data = self.add_viz(data, node_xml) # add viz
+ data = self.add_start_end(data, node_xml) # add start/end
+
+ # find the node id and cast it to the appropriate type
+ node_id = node_xml.get("id")
+ if self.node_type is not None:
+ node_id = self.node_type(node_id)
+
+ # every node should have a label
+ node_label = node_xml.get("label")
+ data["label"] = node_label
+
+ # parent node id
+ node_pid = node_xml.get("pid", node_pid)
+ if node_pid is not None:
+ data["pid"] = node_pid
+
+ # check for subnodes, recursive
+ subnodes = node_xml.find(f"{{{self.NS_GEXF}}}nodes")
+ if subnodes is not None:
+ for node_xml in subnodes.findall(f"{{{self.NS_GEXF}}}node"):
+ self.add_node(G, node_xml, node_attr, node_pid=node_id)
+
+ G.add_node(node_id, **data)
+
+ def add_start_end(self, data, xml):
+ # start and end times
+ ttype = self.timeformat
+ node_start = xml.get("start")
+ if node_start is not None:
+ data["start"] = self.python_type[ttype](node_start)
+ node_end = xml.get("end")
+ if node_end is not None:
+ data["end"] = self.python_type[ttype](node_end)
+ return data
+
+ def add_viz(self, data, node_xml):
+ # add viz element for node
+ viz = {}
+ color = node_xml.find(f"{{{self.NS_VIZ}}}color")
+ if color is not None:
+ if self.VERSION == "1.1":
+ viz["color"] = {
+ "r": int(color.get("r")),
+ "g": int(color.get("g")),
+ "b": int(color.get("b")),
+ }
+ else:
+ viz["color"] = {
+ "r": int(color.get("r")),
+ "g": int(color.get("g")),
+ "b": int(color.get("b")),
+ "a": float(color.get("a", 1)),
+ }
+
+ size = node_xml.find(f"{{{self.NS_VIZ}}}size")
+ if size is not None:
+ viz["size"] = float(size.get("value"))
+
+ thickness = node_xml.find(f"{{{self.NS_VIZ}}}thickness")
+ if thickness is not None:
+ viz["thickness"] = float(thickness.get("value"))
+
+ shape = node_xml.find(f"{{{self.NS_VIZ}}}shape")
+ if shape is not None:
+ viz["shape"] = shape.get("shape")
+ if viz["shape"] == "image":
+ viz["shape"] = shape.get("uri")
+
+ position = node_xml.find(f"{{{self.NS_VIZ}}}position")
+ if position is not None:
+ viz["position"] = {
+ "x": float(position.get("x", 0)),
+ "y": float(position.get("y", 0)),
+ "z": float(position.get("z", 0)),
+ }
+
+ if len(viz) > 0:
+ data["viz"] = viz
+ return data
+
+ def add_parents(self, data, node_xml):
+ parents_element = node_xml.find(f"{{{self.NS_GEXF}}}parents")
+ if parents_element is not None:
+ data["parents"] = []
+ for p in parents_element.findall(f"{{{self.NS_GEXF}}}parent"):
+ parent = p.get("for")
+ data["parents"].append(parent)
+ return data
+
+ def add_slices(self, data, node_or_edge_xml):
+ slices_element = node_or_edge_xml.find(f"{{{self.NS_GEXF}}}slices")
+ if slices_element is not None:
+ data["slices"] = []
+ for s in slices_element.findall(f"{{{self.NS_GEXF}}}slice"):
+ start = s.get("start")
+ end = s.get("end")
+ data["slices"].append((start, end))
+ return data
+
+ def add_spells(self, data, node_or_edge_xml):
+ spells_element = node_or_edge_xml.find(f"{{{self.NS_GEXF}}}spells")
+ if spells_element is not None:
+ data["spells"] = []
+ ttype = self.timeformat
+ for s in spells_element.findall(f"{{{self.NS_GEXF}}}spell"):
+ start = self.python_type[ttype](s.get("start"))
+ end = self.python_type[ttype](s.get("end"))
+ data["spells"].append((start, end))
+ return data
+
+ def add_edge(self, G, edge_element, edge_attr):
+ # add an edge to the graph
+
+ # raise error if we find mixed directed and undirected edges
+ edge_direction = edge_element.get("type")
+ if G.is_directed() and edge_direction == "undirected":
+ raise nx.NetworkXError("Undirected edge found in directed graph.")
+ if (not G.is_directed()) and edge_direction == "directed":
+ raise nx.NetworkXError("Directed edge found in undirected graph.")
+
+ # Get source and target and recast type if required
+ source = edge_element.get("source")
+ target = edge_element.get("target")
+ if self.node_type is not None:
+ source = self.node_type(source)
+ target = self.node_type(target)
+
+ data = self.decode_attr_elements(edge_attr, edge_element)
+ data = self.add_start_end(data, edge_element)
+
+ if self.VERSION == "1.1":
+ data = self.add_slices(data, edge_element) # add slices
+ else:
+ data = self.add_spells(data, edge_element) # add spells
+
+ # GEXF stores edge ids as an attribute
+ # NetworkX uses them as keys in multigraphs
+ # if networkx_key is not specified as an attribute
+ edge_id = edge_element.get("id")
+ if edge_id is not None:
+ data["id"] = edge_id
+
+ # check if there is a 'multigraph_key' and use that as edge_id
+ multigraph_key = data.pop("networkx_key", None)
+ if multigraph_key is not None:
+ edge_id = multigraph_key
+
+ weight = edge_element.get("weight")
+ if weight is not None:
+ data["weight"] = float(weight)
+
+ edge_label = edge_element.get("label")
+ if edge_label is not None:
+ data["label"] = edge_label
+
+ if G.has_edge(source, target):
+ # seen this edge before - this is a multigraph
+ self.simple_graph = False
+ G.add_edge(source, target, key=edge_id, **data)
+ if edge_direction == "mutual":
+ G.add_edge(target, source, key=edge_id, **data)
+
+ def decode_attr_elements(self, gexf_keys, obj_xml):
+ # Use the key information to decode the attr XML
+ attr = {}
+ # look for outer '' element
+ attr_element = obj_xml.find(f"{{{self.NS_GEXF}}}attvalues")
+ if attr_element is not None:
+ # loop over elements
+ for a in attr_element.findall(f"{{{self.NS_GEXF}}}attvalue"):
+ key = a.get("for") # for is required
+ try: # should be in our gexf_keys dictionary
+ title = gexf_keys[key]["title"]
+ except KeyError as err:
+ raise nx.NetworkXError(f"No attribute defined for={key}.") from err
+ atype = gexf_keys[key]["type"]
+ value = a.get("value")
+ if atype == "boolean":
+ value = self.convert_bool[value]
+ else:
+ value = self.python_type[atype](value)
+ if gexf_keys[key]["mode"] == "dynamic":
+ # for dynamic graphs use list of three-tuples
+ # [(value1,start1,end1), (value2,start2,end2), etc]
+ ttype = self.timeformat
+ start = self.python_type[ttype](a.get("start"))
+ end = self.python_type[ttype](a.get("end"))
+ if title in attr:
+ attr[title].append((value, start, end))
+ else:
+ attr[title] = [(value, start, end)]
+ else:
+ # for static graphs just assign the value
+ attr[title] = value
+ return attr
+
+ def find_gexf_attributes(self, attributes_element):
+ # Extract all the attributes and defaults
+ attrs = {}
+ defaults = {}
+ mode = attributes_element.get("mode")
+ for k in attributes_element.findall(f"{{{self.NS_GEXF}}}attribute"):
+ attr_id = k.get("id")
+ title = k.get("title")
+ atype = k.get("type")
+ attrs[attr_id] = {"title": title, "type": atype, "mode": mode}
+ # check for the 'default' subelement of key element and add
+ default = k.find(f"{{{self.NS_GEXF}}}default")
+ if default is not None:
+ if atype == "boolean":
+ value = self.convert_bool[default.text]
+ else:
+ value = self.python_type[atype](default.text)
+ defaults[title] = value
+ return attrs, defaults
+
+
+def relabel_gexf_graph(G):
+ """Relabel graph using "label" node keyword for node label.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph read from GEXF data
+
+ Returns
+ -------
+ H : graph
+ A NetworkX graph with relabeled nodes
+
+ Raises
+ ------
+ NetworkXError
+ If node labels are missing or not unique while relabel=True.
+
+ Notes
+ -----
+ This function relabels the nodes in a NetworkX graph with the
+ "label" attribute. It also handles relabeling the specific GEXF
+ node attributes "parents", and "pid".
+ """
+ # build mapping of node labels, do some error checking
+ try:
+ mapping = [(u, G.nodes[u]["label"]) for u in G]
+ except KeyError as err:
+ raise nx.NetworkXError(
+ "Failed to relabel nodes: missing node labels found. Use relabel=False."
+ ) from err
+ x, y = zip(*mapping)
+ if len(set(y)) != len(G):
+ raise nx.NetworkXError(
+ "Failed to relabel nodes: "
+ "duplicate node labels found. "
+ "Use relabel=False."
+ )
+ mapping = dict(mapping)
+ H = nx.relabel_nodes(G, mapping)
+ # relabel attributes
+ for n in G:
+ m = mapping[n]
+ H.nodes[m]["id"] = n
+ H.nodes[m].pop("label")
+ if "pid" in H.nodes[m]:
+ H.nodes[m]["pid"] = mapping[G.nodes[n]["pid"]]
+ if "parents" in H.nodes[m]:
+ H.nodes[m]["parents"] = [mapping[p] for p in G.nodes[n]["parents"]]
+ return H
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/gml.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/gml.py
new file mode 100644
index 0000000000000000000000000000000000000000..891d709685e8b119abb1db0d5489fc14e657a579
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/gml.py
@@ -0,0 +1,879 @@
+"""
+Read graphs in GML format.
+
+"GML, the Graph Modelling Language, is our proposal for a portable
+file format for graphs. GML's key features are portability, simple
+syntax, extensibility and flexibility. A GML file consists of a
+hierarchical key-value lists. Graphs can be annotated with arbitrary
+data structures. The idea for a common file format was born at the
+GD'95; this proposal is the outcome of many discussions. GML is the
+standard file format in the Graphlet graph editor system. It has been
+overtaken and adapted by several other systems for drawing graphs."
+
+GML files are stored using a 7-bit ASCII encoding with any extended
+ASCII characters (iso8859-1) appearing as HTML character entities.
+You will need to give some thought into how the exported data should
+interact with different languages and even different Python versions.
+Re-importing from gml is also a concern.
+
+Without specifying a `stringizer`/`destringizer`, the code is capable of
+writing `int`/`float`/`str`/`dict`/`list` data as required by the GML
+specification. For writing other data types, and for reading data other
+than `str` you need to explicitly supply a `stringizer`/`destringizer`.
+
+For additional documentation on the GML file format, please see the
+`GML website `_.
+
+Several example graphs in GML format may be found on Mark Newman's
+`Network data page `_.
+"""
+
+import html.entities as htmlentitydefs
+import re
+import warnings
+from ast import literal_eval
+from collections import defaultdict
+from enum import Enum
+from io import StringIO
+from typing import Any, NamedTuple
+
+import networkx as nx
+from networkx.exception import NetworkXError
+from networkx.utils import open_file
+
+__all__ = ["read_gml", "parse_gml", "generate_gml", "write_gml"]
+
+
+def escape(text):
+ """Use XML character references to escape characters.
+
+ Use XML character references for unprintable or non-ASCII
+ characters, double quotes and ampersands in a string
+ """
+
+ def fixup(m):
+ ch = m.group(0)
+ return "" + str(ord(ch)) + ";"
+
+ text = re.sub('[^ -~]|[&"]', fixup, text)
+ return text if isinstance(text, str) else str(text)
+
+
+def unescape(text):
+ """Replace XML character references with the referenced characters"""
+
+ def fixup(m):
+ text = m.group(0)
+ if text[1] == "#":
+ # Character reference
+ if text[2] == "x":
+ code = int(text[3:-1], 16)
+ else:
+ code = int(text[2:-1])
+ else:
+ # Named entity
+ try:
+ code = htmlentitydefs.name2codepoint[text[1:-1]]
+ except KeyError:
+ return text # leave unchanged
+ try:
+ return chr(code)
+ except (ValueError, OverflowError):
+ return text # leave unchanged
+
+ return re.sub("&(?:[0-9A-Za-z]+|#(?:[0-9]+|x[0-9A-Fa-f]+));", fixup, text)
+
+
+def literal_destringizer(rep):
+ """Convert a Python literal to the value it represents.
+
+ Parameters
+ ----------
+ rep : string
+ A Python literal.
+
+ Returns
+ -------
+ value : object
+ The value of the Python literal.
+
+ Raises
+ ------
+ ValueError
+ If `rep` is not a Python literal.
+ """
+ if isinstance(rep, str):
+ orig_rep = rep
+ try:
+ return literal_eval(rep)
+ except SyntaxError as err:
+ raise ValueError(f"{orig_rep!r} is not a valid Python literal") from err
+ else:
+ raise ValueError(f"{rep!r} is not a string")
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_gml(path, label="label", destringizer=None):
+ """Read graph in GML format from `path`.
+
+ Parameters
+ ----------
+ path : filename or filehandle
+ The filename or filehandle to read from.
+
+ label : string, optional
+ If not None, the parsed nodes will be renamed according to node
+ attributes indicated by `label`. Default value: 'label'.
+
+ destringizer : callable, optional
+ A `destringizer` that recovers values stored as strings in GML. If it
+ cannot convert a string to a value, a `ValueError` is raised. Default
+ value : None.
+
+ Returns
+ -------
+ G : NetworkX graph
+ The parsed graph.
+
+ Raises
+ ------
+ NetworkXError
+ If the input cannot be parsed.
+
+ See Also
+ --------
+ write_gml, parse_gml
+ literal_destringizer
+
+ Notes
+ -----
+ GML files are stored using a 7-bit ASCII encoding with any extended
+ ASCII characters (iso8859-1) appearing as HTML character entities.
+ Without specifying a `stringizer`/`destringizer`, the code is capable of
+ writing `int`/`float`/`str`/`dict`/`list` data as required by the GML
+ specification. For writing other data types, and for reading data other
+ than `str` you need to explicitly supply a `stringizer`/`destringizer`.
+
+ For additional documentation on the GML file format, please see the
+ `GML url `_.
+
+ See the module docstring :mod:`networkx.readwrite.gml` for more details.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_gml(G, "test.gml")
+
+ GML values are interpreted as strings by default:
+
+ >>> H = nx.read_gml("test.gml")
+ >>> H.nodes
+ NodeView(('0', '1', '2', '3'))
+
+ When a `destringizer` is provided, GML values are converted to the provided type.
+ For example, integer nodes can be recovered as shown below:
+
+ >>> J = nx.read_gml("test.gml", destringizer=int)
+ >>> J.nodes
+ NodeView((0, 1, 2, 3))
+
+ """
+
+ def filter_lines(lines):
+ for line in lines:
+ try:
+ line = line.decode("ascii")
+ except UnicodeDecodeError as err:
+ raise NetworkXError("input is not ASCII-encoded") from err
+ if not isinstance(line, str):
+ lines = str(lines)
+ if line and line[-1] == "\n":
+ line = line[:-1]
+ yield line
+
+ G = parse_gml_lines(filter_lines(path), label, destringizer)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def parse_gml(lines, label="label", destringizer=None):
+ """Parse GML graph from a string or iterable.
+
+ Parameters
+ ----------
+ lines : string or iterable of strings
+ Data in GML format.
+
+ label : string, optional
+ If not None, the parsed nodes will be renamed according to node
+ attributes indicated by `label`. Default value: 'label'.
+
+ destringizer : callable, optional
+ A `destringizer` that recovers values stored as strings in GML. If it
+ cannot convert a string to a value, a `ValueError` is raised. Default
+ value : None.
+
+ Returns
+ -------
+ G : NetworkX graph
+ The parsed graph.
+
+ Raises
+ ------
+ NetworkXError
+ If the input cannot be parsed.
+
+ See Also
+ --------
+ write_gml, read_gml
+
+ Notes
+ -----
+ This stores nested GML attributes as dictionaries in the NetworkX graph,
+ node, and edge attribute structures.
+
+ GML files are stored using a 7-bit ASCII encoding with any extended
+ ASCII characters (iso8859-1) appearing as HTML character entities.
+ Without specifying a `stringizer`/`destringizer`, the code is capable of
+ writing `int`/`float`/`str`/`dict`/`list` data as required by the GML
+ specification. For writing other data types, and for reading data other
+ than `str` you need to explicitly supply a `stringizer`/`destringizer`.
+
+ For additional documentation on the GML file format, please see the
+ `GML url `_.
+
+ See the module docstring :mod:`networkx.readwrite.gml` for more details.
+ """
+
+ def decode_line(line):
+ if isinstance(line, bytes):
+ try:
+ line.decode("ascii")
+ except UnicodeDecodeError as err:
+ raise NetworkXError("input is not ASCII-encoded") from err
+ if not isinstance(line, str):
+ line = str(line)
+ return line
+
+ def filter_lines(lines):
+ if isinstance(lines, str):
+ lines = decode_line(lines)
+ lines = lines.splitlines()
+ yield from lines
+ else:
+ for line in lines:
+ line = decode_line(line)
+ if line and line[-1] == "\n":
+ line = line[:-1]
+ if line.find("\n") != -1:
+ raise NetworkXError("input line contains newline")
+ yield line
+
+ G = parse_gml_lines(filter_lines(lines), label, destringizer)
+ return G
+
+
+class Pattern(Enum):
+ """encodes the index of each token-matching pattern in `tokenize`."""
+
+ KEYS = 0
+ REALS = 1
+ INTS = 2
+ STRINGS = 3
+ DICT_START = 4
+ DICT_END = 5
+ COMMENT_WHITESPACE = 6
+
+
+class Token(NamedTuple):
+ category: Pattern
+ value: Any
+ line: int
+ position: int
+
+
+LIST_START_VALUE = "_networkx_list_start"
+
+
+def parse_gml_lines(lines, label, destringizer):
+ """Parse GML `lines` into a graph."""
+
+ def tokenize():
+ patterns = [
+ r"[A-Za-z][0-9A-Za-z_]*\b", # keys
+ # reals
+ r"[+-]?(?:[0-9]*\.[0-9]+|[0-9]+\.[0-9]*|INF)(?:[Ee][+-]?[0-9]+)?",
+ r"[+-]?[0-9]+", # ints
+ r'".*?"', # strings
+ r"\[", # dict start
+ r"\]", # dict end
+ r"#.*$|\s+", # comments and whitespaces
+ ]
+ tokens = re.compile("|".join(f"({pattern})" for pattern in patterns))
+ lineno = 0
+ multilines = [] # entries spread across multiple lines
+ for line in lines:
+ pos = 0
+
+ # deal with entries spread across multiple lines
+ #
+ # should we actually have to deal with escaped "s then do it here
+ if multilines:
+ multilines.append(line.strip())
+ if line[-1] == '"': # closing multiline entry
+ # multiline entries will be joined by space. cannot
+ # reintroduce newlines as this will break the tokenizer
+ line = " ".join(multilines)
+ multilines = []
+ else: # continued multiline entry
+ lineno += 1
+ continue
+ else:
+ if line.count('"') == 1: # opening multiline entry
+ if line.strip()[0] != '"' and line.strip()[-1] != '"':
+ # since we expect something like key "value", the " should not be found at ends
+ # otherwise tokenizer will pick up the formatting mistake.
+ multilines = [line.rstrip()]
+ lineno += 1
+ continue
+
+ length = len(line)
+
+ while pos < length:
+ match = tokens.match(line, pos)
+ if match is None:
+ m = f"cannot tokenize {line[pos:]} at ({lineno + 1}, {pos + 1})"
+ raise NetworkXError(m)
+ for i in range(len(patterns)):
+ group = match.group(i + 1)
+ if group is not None:
+ if i == 0: # keys
+ value = group.rstrip()
+ elif i == 1: # reals
+ value = float(group)
+ elif i == 2: # ints
+ value = int(group)
+ else:
+ value = group
+ if i != 6: # comments and whitespaces
+ yield Token(Pattern(i), value, lineno + 1, pos + 1)
+ pos += len(group)
+ break
+ lineno += 1
+ yield Token(None, None, lineno + 1, 1) # EOF
+
+ def unexpected(curr_token, expected):
+ category, value, lineno, pos = curr_token
+ value = repr(value) if value is not None else "EOF"
+ raise NetworkXError(f"expected {expected}, found {value} at ({lineno}, {pos})")
+
+ def consume(curr_token, category, expected):
+ if curr_token.category == category:
+ return next(tokens)
+ unexpected(curr_token, expected)
+
+ def parse_kv(curr_token):
+ dct = defaultdict(list)
+ while curr_token.category == Pattern.KEYS:
+ key = curr_token.value
+ curr_token = next(tokens)
+ category = curr_token.category
+ if category == Pattern.REALS or category == Pattern.INTS:
+ value = curr_token.value
+ curr_token = next(tokens)
+ elif category == Pattern.STRINGS:
+ value = unescape(curr_token.value[1:-1])
+ if destringizer:
+ try:
+ value = destringizer(value)
+ except ValueError:
+ pass
+ # Special handling for empty lists and tuples
+ if value == "()":
+ value = ()
+ if value == "[]":
+ value = []
+ curr_token = next(tokens)
+ elif category == Pattern.DICT_START:
+ curr_token, value = parse_dict(curr_token)
+ else:
+ # Allow for string convertible id and label values
+ if key in ("id", "label", "source", "target"):
+ try:
+ # String convert the token value
+ value = unescape(str(curr_token.value))
+ if destringizer:
+ try:
+ value = destringizer(value)
+ except ValueError:
+ pass
+ curr_token = next(tokens)
+ except Exception:
+ msg = (
+ "an int, float, string, '[' or string"
+ + " convertible ASCII value for node id or label"
+ )
+ unexpected(curr_token, msg)
+ # Special handling for nan and infinity. Since the gml language
+ # defines unquoted strings as keys, the numeric and string branches
+ # are skipped and we end up in this special branch, so we need to
+ # convert the current token value to a float for NAN and plain INF.
+ # +/-INF are handled in the pattern for 'reals' in tokenize(). This
+ # allows labels and values to be nan or infinity, but not keys.
+ elif curr_token.value in {"NAN", "INF"}:
+ value = float(curr_token.value)
+ curr_token = next(tokens)
+ else: # Otherwise error out
+ unexpected(curr_token, "an int, float, string or '['")
+ dct[key].append(value)
+
+ def clean_dict_value(value):
+ if not isinstance(value, list):
+ return value
+ if len(value) == 1:
+ return value[0]
+ if value[0] == LIST_START_VALUE:
+ return value[1:]
+ return value
+
+ dct = {key: clean_dict_value(value) for key, value in dct.items()}
+ return curr_token, dct
+
+ def parse_dict(curr_token):
+ # dict start
+ curr_token = consume(curr_token, Pattern.DICT_START, "'['")
+ # dict contents
+ curr_token, dct = parse_kv(curr_token)
+ # dict end
+ curr_token = consume(curr_token, Pattern.DICT_END, "']'")
+ return curr_token, dct
+
+ def parse_graph():
+ curr_token, dct = parse_kv(next(tokens))
+ if curr_token.category is not None: # EOF
+ unexpected(curr_token, "EOF")
+ if "graph" not in dct:
+ raise NetworkXError("input contains no graph")
+ graph = dct["graph"]
+ if isinstance(graph, list):
+ raise NetworkXError("input contains more than one graph")
+ return graph
+
+ tokens = tokenize()
+ graph = parse_graph()
+
+ directed = graph.pop("directed", False)
+ multigraph = graph.pop("multigraph", False)
+ if not multigraph:
+ G = nx.DiGraph() if directed else nx.Graph()
+ else:
+ G = nx.MultiDiGraph() if directed else nx.MultiGraph()
+ graph_attr = {k: v for k, v in graph.items() if k not in ("node", "edge")}
+ G.graph.update(graph_attr)
+
+ def pop_attr(dct, category, attr, i):
+ try:
+ return dct.pop(attr)
+ except KeyError as err:
+ raise NetworkXError(f"{category} #{i} has no {attr!r} attribute") from err
+
+ nodes = graph.get("node", [])
+ mapping = {}
+ node_labels = set()
+ for i, node in enumerate(nodes if isinstance(nodes, list) else [nodes]):
+ id = pop_attr(node, "node", "id", i)
+ if id in G:
+ raise NetworkXError(f"node id {id!r} is duplicated")
+ if label is not None and label != "id":
+ node_label = pop_attr(node, "node", label, i)
+ if node_label in node_labels:
+ raise NetworkXError(f"node label {node_label!r} is duplicated")
+ node_labels.add(node_label)
+ mapping[id] = node_label
+ G.add_node(id, **node)
+
+ edges = graph.get("edge", [])
+ for i, edge in enumerate(edges if isinstance(edges, list) else [edges]):
+ source = pop_attr(edge, "edge", "source", i)
+ target = pop_attr(edge, "edge", "target", i)
+ if source not in G:
+ raise NetworkXError(f"edge #{i} has undefined source {source!r}")
+ if target not in G:
+ raise NetworkXError(f"edge #{i} has undefined target {target!r}")
+ if not multigraph:
+ if not G.has_edge(source, target):
+ G.add_edge(source, target, **edge)
+ else:
+ arrow = "->" if directed else "--"
+ msg = f"edge #{i} ({source!r}{arrow}{target!r}) is duplicated"
+ raise nx.NetworkXError(msg)
+ else:
+ key = edge.pop("key", None)
+ if key is not None and G.has_edge(source, target, key):
+ arrow = "->" if directed else "--"
+ msg = f"edge #{i} ({source!r}{arrow}{target!r}, {key!r})"
+ msg2 = 'Hint: If multigraph add "multigraph 1" to file header.'
+ raise nx.NetworkXError(msg + " is duplicated\n" + msg2)
+ G.add_edge(source, target, key, **edge)
+
+ if label is not None and label != "id":
+ G = nx.relabel_nodes(G, mapping)
+ return G
+
+
+def literal_stringizer(value):
+ """Convert a `value` to a Python literal in GML representation.
+
+ Parameters
+ ----------
+ value : object
+ The `value` to be converted to GML representation.
+
+ Returns
+ -------
+ rep : string
+ A double-quoted Python literal representing value. Unprintable
+ characters are replaced by XML character references.
+
+ Raises
+ ------
+ ValueError
+ If `value` cannot be converted to GML.
+
+ Notes
+ -----
+ The original value can be recovered using the
+ :func:`networkx.readwrite.gml.literal_destringizer` function.
+ """
+
+ def stringize(value):
+ if isinstance(value, int | bool) or value is None:
+ if value is True: # GML uses 1/0 for boolean values.
+ buf.write(str(1))
+ elif value is False:
+ buf.write(str(0))
+ else:
+ buf.write(str(value))
+ elif isinstance(value, str):
+ text = repr(value)
+ if text[0] != "u":
+ try:
+ value.encode("latin1")
+ except UnicodeEncodeError:
+ text = "u" + text
+ buf.write(text)
+ elif isinstance(value, float | complex | str | bytes):
+ buf.write(repr(value))
+ elif isinstance(value, list):
+ buf.write("[")
+ first = True
+ for item in value:
+ if not first:
+ buf.write(",")
+ else:
+ first = False
+ stringize(item)
+ buf.write("]")
+ elif isinstance(value, tuple):
+ if len(value) > 1:
+ buf.write("(")
+ first = True
+ for item in value:
+ if not first:
+ buf.write(",")
+ else:
+ first = False
+ stringize(item)
+ buf.write(")")
+ elif value:
+ buf.write("(")
+ stringize(value[0])
+ buf.write(",)")
+ else:
+ buf.write("()")
+ elif isinstance(value, dict):
+ buf.write("{")
+ first = True
+ for key, value in value.items():
+ if not first:
+ buf.write(",")
+ else:
+ first = False
+ stringize(key)
+ buf.write(":")
+ stringize(value)
+ buf.write("}")
+ elif isinstance(value, set):
+ buf.write("{")
+ first = True
+ for item in value:
+ if not first:
+ buf.write(",")
+ else:
+ first = False
+ stringize(item)
+ buf.write("}")
+ else:
+ msg = f"{value!r} cannot be converted into a Python literal"
+ raise ValueError(msg)
+
+ buf = StringIO()
+ stringize(value)
+ return buf.getvalue()
+
+
+def generate_gml(G, stringizer=None):
+ r"""Generate a single entry of the graph `G` in GML format.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+ The graph to be converted to GML.
+
+ stringizer : callable, optional
+ A `stringizer` which converts non-int/non-float/non-dict values into
+ strings. If it cannot convert a value into a string, it should raise a
+ `ValueError` to indicate that. Default value: None.
+
+ Returns
+ -------
+ lines: generator of strings
+ Lines of GML data. Newlines are not appended.
+
+ Raises
+ ------
+ NetworkXError
+ If `stringizer` cannot convert a value into a string, or the value to
+ convert is not a string while `stringizer` is None.
+
+ See Also
+ --------
+ literal_stringizer
+
+ Notes
+ -----
+ Graph attributes named 'directed', 'multigraph', 'node' or
+ 'edge', node attributes named 'id' or 'label', edge attributes
+ named 'source' or 'target' (or 'key' if `G` is a multigraph)
+ are ignored because these attribute names are used to encode the graph
+ structure.
+
+ GML files are stored using a 7-bit ASCII encoding with any extended
+ ASCII characters (iso8859-1) appearing as HTML character entities.
+ Without specifying a `stringizer`/`destringizer`, the code is capable of
+ writing `int`/`float`/`str`/`dict`/`list` data as required by the GML
+ specification. For writing other data types, and for reading data other
+ than `str` you need to explicitly supply a `stringizer`/`destringizer`.
+
+ For additional documentation on the GML file format, please see the
+ `GML url `_.
+
+ See the module docstring :mod:`networkx.readwrite.gml` for more details.
+
+ Examples
+ --------
+ >>> G = nx.Graph()
+ >>> G.add_node("1")
+ >>> print("\n".join(nx.generate_gml(G)))
+ graph [
+ node [
+ id 0
+ label "1"
+ ]
+ ]
+ >>> G = nx.MultiGraph([("a", "b"), ("a", "b")])
+ >>> print("\n".join(nx.generate_gml(G)))
+ graph [
+ multigraph 1
+ node [
+ id 0
+ label "a"
+ ]
+ node [
+ id 1
+ label "b"
+ ]
+ edge [
+ source 0
+ target 1
+ key 0
+ ]
+ edge [
+ source 0
+ target 1
+ key 1
+ ]
+ ]
+ """
+ valid_keys = re.compile("^[A-Za-z][0-9A-Za-z_]*$")
+
+ def stringize(key, value, ignored_keys, indent, in_list=False):
+ if not isinstance(key, str):
+ raise NetworkXError(f"{key!r} is not a string")
+ if not valid_keys.match(key):
+ raise NetworkXError(f"{key!r} is not a valid key")
+ if not isinstance(key, str):
+ key = str(key)
+ if key not in ignored_keys:
+ if isinstance(value, int | bool):
+ if key == "label":
+ yield indent + key + ' "' + str(value) + '"'
+ elif value is True:
+ # python bool is an instance of int
+ yield indent + key + " 1"
+ elif value is False:
+ yield indent + key + " 0"
+ # GML only supports signed 32-bit integers
+ elif value < -(2**31) or value >= 2**31:
+ yield indent + key + ' "' + str(value) + '"'
+ else:
+ yield indent + key + " " + str(value)
+ elif isinstance(value, float):
+ text = repr(value).upper()
+ # GML matches INF to keys, so prepend + to INF. Use repr(float(*))
+ # instead of string literal to future proof against changes to repr.
+ if text == repr(float("inf")).upper():
+ text = "+" + text
+ else:
+ # GML requires that a real literal contain a decimal point, but
+ # repr may not output a decimal point when the mantissa is
+ # integral and hence needs fixing.
+ epos = text.rfind("E")
+ if epos != -1 and text.find(".", 0, epos) == -1:
+ text = text[:epos] + "." + text[epos:]
+ if key == "label":
+ yield indent + key + ' "' + text + '"'
+ else:
+ yield indent + key + " " + text
+ elif isinstance(value, dict):
+ yield indent + key + " ["
+ next_indent = indent + " "
+ for key, value in value.items():
+ yield from stringize(key, value, (), next_indent)
+ yield indent + "]"
+ elif isinstance(value, tuple) and key == "label":
+ yield indent + key + f" \"({','.join(repr(v) for v in value)})\""
+ elif isinstance(value, list | tuple) and key != "label" and not in_list:
+ if len(value) == 0:
+ yield indent + key + " " + f'"{value!r}"'
+ if len(value) == 1:
+ yield indent + key + " " + f'"{LIST_START_VALUE}"'
+ for val in value:
+ yield from stringize(key, val, (), indent, True)
+ else:
+ if stringizer:
+ try:
+ value = stringizer(value)
+ except ValueError as err:
+ raise NetworkXError(
+ f"{value!r} cannot be converted into a string"
+ ) from err
+ if not isinstance(value, str):
+ raise NetworkXError(f"{value!r} is not a string")
+ yield indent + key + ' "' + escape(value) + '"'
+
+ multigraph = G.is_multigraph()
+ yield "graph ["
+
+ # Output graph attributes
+ if G.is_directed():
+ yield " directed 1"
+ if multigraph:
+ yield " multigraph 1"
+ ignored_keys = {"directed", "multigraph", "node", "edge"}
+ for attr, value in G.graph.items():
+ yield from stringize(attr, value, ignored_keys, " ")
+
+ # Output node data
+ node_id = dict(zip(G, range(len(G))))
+ ignored_keys = {"id", "label"}
+ for node, attrs in G.nodes.items():
+ yield " node ["
+ yield " id " + str(node_id[node])
+ yield from stringize("label", node, (), " ")
+ for attr, value in attrs.items():
+ yield from stringize(attr, value, ignored_keys, " ")
+ yield " ]"
+
+ # Output edge data
+ ignored_keys = {"source", "target"}
+ kwargs = {"data": True}
+ if multigraph:
+ ignored_keys.add("key")
+ kwargs["keys"] = True
+ for e in G.edges(**kwargs):
+ yield " edge ["
+ yield " source " + str(node_id[e[0]])
+ yield " target " + str(node_id[e[1]])
+ if multigraph:
+ yield from stringize("key", e[2], (), " ")
+ for attr, value in e[-1].items():
+ yield from stringize(attr, value, ignored_keys, " ")
+ yield " ]"
+ yield "]"
+
+
+@open_file(1, mode="wb")
+def write_gml(G, path, stringizer=None):
+ """Write a graph `G` in GML format to the file or file handle `path`.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+ The graph to be converted to GML.
+
+ path : filename or filehandle
+ The filename or filehandle to write. Files whose names end with .gz or
+ .bz2 will be compressed.
+
+ stringizer : callable, optional
+ A `stringizer` which converts non-int/non-float/non-dict values into
+ strings. If it cannot convert a value into a string, it should raise a
+ `ValueError` to indicate that. Default value: None.
+
+ Raises
+ ------
+ NetworkXError
+ If `stringizer` cannot convert a value into a string, or the value to
+ convert is not a string while `stringizer` is None.
+
+ See Also
+ --------
+ read_gml, generate_gml
+ literal_stringizer
+
+ Notes
+ -----
+ Graph attributes named 'directed', 'multigraph', 'node' or
+ 'edge', node attributes named 'id' or 'label', edge attributes
+ named 'source' or 'target' (or 'key' if `G` is a multigraph)
+ are ignored because these attribute names are used to encode the graph
+ structure.
+
+ GML files are stored using a 7-bit ASCII encoding with any extended
+ ASCII characters (iso8859-1) appearing as HTML character entities.
+ Without specifying a `stringizer`/`destringizer`, the code is capable of
+ writing `int`/`float`/`str`/`dict`/`list` data as required by the GML
+ specification. For writing other data types, and for reading data other
+ than `str` you need to explicitly supply a `stringizer`/`destringizer`.
+
+ Note that while we allow non-standard GML to be read from a file, we make
+ sure to write GML format. In particular, underscores are not allowed in
+ attribute names.
+ For additional documentation on the GML file format, please see the
+ `GML url `_.
+
+ See the module docstring :mod:`networkx.readwrite.gml` for more details.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_gml(G, "test.gml")
+
+ Filenames ending in .gz or .bz2 will be compressed.
+
+ >>> nx.write_gml(G, "test.gml.gz")
+ """
+ for line in generate_gml(G, stringizer):
+ path.write((line + "\n").encode("ascii"))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/graph6.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/graph6.py
new file mode 100644
index 0000000000000000000000000000000000000000..4ff2f93c43c1cacb3bd1a9d85b500a410269c5a2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/graph6.py
@@ -0,0 +1,417 @@
+# Original author: D. Eppstein, UC Irvine, August 12, 2003.
+# The original code at http://www.ics.uci.edu/~eppstein/PADS/ is public domain.
+"""Functions for reading and writing graphs in the *graph6* format.
+
+The *graph6* file format is suitable for small graphs or large dense
+graphs. For large sparse graphs, use the *sparse6* format.
+
+For more information, see the `graph6`_ homepage.
+
+.. _graph6: http://users.cecs.anu.edu.au/~bdm/data/formats.html
+
+"""
+
+from itertools import islice
+
+import networkx as nx
+from networkx.exception import NetworkXError
+from networkx.utils import not_implemented_for, open_file
+
+__all__ = ["from_graph6_bytes", "read_graph6", "to_graph6_bytes", "write_graph6"]
+
+
+def _generate_graph6_bytes(G, nodes, header):
+ """Yield bytes in the graph6 encoding of a graph.
+
+ `G` is an undirected simple graph. `nodes` is the list of nodes for
+ which the node-induced subgraph will be encoded; if `nodes` is the
+ list of all nodes in the graph, the entire graph will be
+ encoded. `header` is a Boolean that specifies whether to generate
+ the header ``b'>>graph6<<'`` before the remaining data.
+
+ This function generates `bytes` objects in the following order:
+
+ 1. the header (if requested),
+ 2. the encoding of the number of nodes,
+ 3. each character, one-at-a-time, in the encoding of the requested
+ node-induced subgraph,
+ 4. a newline character.
+
+ This function raises :exc:`ValueError` if the graph is too large for
+ the graph6 format (that is, greater than ``2 ** 36`` nodes).
+
+ """
+ n = len(G)
+ if n >= 2**36:
+ raise ValueError(
+ "graph6 is only defined if number of nodes is less than 2 ** 36"
+ )
+ if header:
+ yield b">>graph6<<"
+ for d in n_to_data(n):
+ yield str.encode(chr(d + 63))
+ # This generates the same as `(v in G[u] for u, v in combinations(G, 2))`,
+ # but in "column-major" order instead of "row-major" order.
+ bits = (nodes[j] in G[nodes[i]] for j in range(1, n) for i in range(j))
+ chunk = list(islice(bits, 6))
+ while chunk:
+ d = sum(b << 5 - i for i, b in enumerate(chunk))
+ yield str.encode(chr(d + 63))
+ chunk = list(islice(bits, 6))
+ yield b"\n"
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_graph6_bytes(bytes_in):
+ """Read a simple undirected graph in graph6 format from bytes.
+
+ Parameters
+ ----------
+ bytes_in : bytes
+ Data in graph6 format, without a trailing newline.
+
+ Returns
+ -------
+ G : Graph
+
+ Raises
+ ------
+ NetworkXError
+ If bytes_in is unable to be parsed in graph6 format
+
+ ValueError
+ If any character ``c`` in bytes_in does not satisfy
+ ``63 <= ord(c) < 127``.
+
+ Examples
+ --------
+ >>> G = nx.from_graph6_bytes(b"A_")
+ >>> sorted(G.edges())
+ [(0, 1)]
+
+ See Also
+ --------
+ read_graph6, write_graph6
+
+ References
+ ----------
+ .. [1] Graph6 specification
+
+
+ """
+
+ def bits():
+ """Returns sequence of individual bits from 6-bit-per-value
+ list of data values."""
+ for d in data:
+ for i in [5, 4, 3, 2, 1, 0]:
+ yield (d >> i) & 1
+
+ if bytes_in.startswith(b">>graph6<<"):
+ bytes_in = bytes_in[10:]
+
+ data = [c - 63 for c in bytes_in]
+ if any(c > 63 for c in data):
+ raise ValueError("each input character must be in range(63, 127)")
+
+ n, data = data_to_n(data)
+ nd = (n * (n - 1) // 2 + 5) // 6
+ if len(data) != nd:
+ raise NetworkXError(
+ f"Expected {n * (n - 1) // 2} bits but got {len(data) * 6} in graph6"
+ )
+
+ G = nx.Graph()
+ G.add_nodes_from(range(n))
+ for (i, j), b in zip(((i, j) for j in range(1, n) for i in range(j)), bits()):
+ if b:
+ G.add_edge(i, j)
+
+ return G
+
+
+@not_implemented_for("directed")
+@not_implemented_for("multigraph")
+def to_graph6_bytes(G, nodes=None, header=True):
+ """Convert a simple undirected graph to bytes in graph6 format.
+
+ Parameters
+ ----------
+ G : Graph (undirected)
+
+ nodes: list or iterable
+ Nodes are labeled 0...n-1 in the order provided. If None the ordering
+ given by ``G.nodes()`` is used.
+
+ header: bool
+ If True add '>>graph6<<' bytes to head of data.
+
+ Raises
+ ------
+ NetworkXNotImplemented
+ If the graph is directed or is a multigraph.
+
+ ValueError
+ If the graph has at least ``2 ** 36`` nodes; the graph6 format
+ is only defined for graphs of order less than ``2 ** 36``.
+
+ Examples
+ --------
+ >>> nx.to_graph6_bytes(nx.path_graph(2))
+ b'>>graph6<
+
+ """
+ if nodes is not None:
+ G = G.subgraph(nodes)
+ H = nx.convert_node_labels_to_integers(G)
+ nodes = sorted(H.nodes())
+ return b"".join(_generate_graph6_bytes(H, nodes, header))
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_graph6(path):
+ """Read simple undirected graphs in graph6 format from path.
+
+ Parameters
+ ----------
+ path : file or string
+ File or filename to write.
+
+ Returns
+ -------
+ G : Graph or list of Graphs
+ If the file contains multiple lines then a list of graphs is returned
+
+ Raises
+ ------
+ NetworkXError
+ If the string is unable to be parsed in graph6 format
+
+ Examples
+ --------
+ You can read a graph6 file by giving the path to the file::
+
+ >>> import tempfile
+ >>> with tempfile.NamedTemporaryFile(delete=False) as f:
+ ... _ = f.write(b">>graph6<>> list(G.edges())
+ [(0, 1)]
+
+ You can also read a graph6 file by giving an open file-like object::
+
+ >>> import tempfile
+ >>> with tempfile.NamedTemporaryFile() as f:
+ ... _ = f.write(b">>graph6<>> list(G.edges())
+ [(0, 1)]
+
+ See Also
+ --------
+ from_graph6_bytes, write_graph6
+
+ References
+ ----------
+ .. [1] Graph6 specification
+
+
+ """
+ glist = []
+ for line in path:
+ line = line.strip()
+ if not len(line):
+ continue
+ glist.append(from_graph6_bytes(line))
+ if len(glist) == 1:
+ return glist[0]
+ else:
+ return glist
+
+
+@not_implemented_for("directed")
+@not_implemented_for("multigraph")
+@open_file(1, mode="wb")
+def write_graph6(G, path, nodes=None, header=True):
+ """Write a simple undirected graph to a path in graph6 format.
+
+ Parameters
+ ----------
+ G : Graph (undirected)
+
+ path : str
+ The path naming the file to which to write the graph.
+
+ nodes: list or iterable
+ Nodes are labeled 0...n-1 in the order provided. If None the ordering
+ given by ``G.nodes()`` is used.
+
+ header: bool
+ If True add '>>graph6<<' string to head of data
+
+ Raises
+ ------
+ NetworkXNotImplemented
+ If the graph is directed or is a multigraph.
+
+ ValueError
+ If the graph has at least ``2 ** 36`` nodes; the graph6 format
+ is only defined for graphs of order less than ``2 ** 36``.
+
+ Examples
+ --------
+ You can write a graph6 file by giving the path to a file::
+
+ >>> import tempfile
+ >>> with tempfile.NamedTemporaryFile(delete=False) as f:
+ ... nx.write_graph6(nx.path_graph(2), f.name)
+ ... _ = f.seek(0)
+ ... print(f.read())
+ b'>>graph6<
+
+ """
+ return write_graph6_file(G, path, nodes=nodes, header=header)
+
+
+@not_implemented_for("directed")
+@not_implemented_for("multigraph")
+def write_graph6_file(G, f, nodes=None, header=True):
+ """Write a simple undirected graph to a file-like object in graph6 format.
+
+ Parameters
+ ----------
+ G : Graph (undirected)
+
+ f : file-like object
+ The file to write.
+
+ nodes: list or iterable
+ Nodes are labeled 0...n-1 in the order provided. If None the ordering
+ given by ``G.nodes()`` is used.
+
+ header: bool
+ If True add '>>graph6<<' string to head of data
+
+ Raises
+ ------
+ NetworkXNotImplemented
+ If the graph is directed or is a multigraph.
+
+ ValueError
+ If the graph has at least ``2 ** 36`` nodes; the graph6 format
+ is only defined for graphs of order less than ``2 ** 36``.
+
+ Examples
+ --------
+ You can write a graph6 file by giving an open file-like object::
+
+ >>> import tempfile
+ >>> with tempfile.NamedTemporaryFile() as f:
+ ... nx.write_graph6(nx.path_graph(2), f)
+ ... _ = f.seek(0)
+ ... print(f.read())
+ b'>>graph6<
+
+ """
+ if nodes is not None:
+ G = G.subgraph(nodes)
+ H = nx.convert_node_labels_to_integers(G)
+ nodes = sorted(H.nodes())
+ for b in _generate_graph6_bytes(H, nodes, header):
+ f.write(b)
+
+
+def data_to_n(data):
+ """Read initial one-, four- or eight-unit value from graph6
+ integer sequence.
+
+ Return (value, rest of seq.)"""
+ if data[0] <= 62:
+ return data[0], data[1:]
+ if data[1] <= 62:
+ return (data[1] << 12) + (data[2] << 6) + data[3], data[4:]
+ return (
+ (data[2] << 30)
+ + (data[3] << 24)
+ + (data[4] << 18)
+ + (data[5] << 12)
+ + (data[6] << 6)
+ + data[7],
+ data[8:],
+ )
+
+
+def n_to_data(n):
+ """Convert an integer to one-, four- or eight-unit graph6 sequence.
+
+ This function is undefined if `n` is not in ``range(2 ** 36)``.
+
+ """
+ if n <= 62:
+ return [n]
+ elif n <= 258047:
+ return [63, (n >> 12) & 0x3F, (n >> 6) & 0x3F, n & 0x3F]
+ else: # if n <= 68719476735:
+ return [
+ 63,
+ 63,
+ (n >> 30) & 0x3F,
+ (n >> 24) & 0x3F,
+ (n >> 18) & 0x3F,
+ (n >> 12) & 0x3F,
+ (n >> 6) & 0x3F,
+ n & 0x3F,
+ ]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/graphml.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/graphml.py
new file mode 100644
index 0000000000000000000000000000000000000000..7d0a1da0dcf488cda2c0e018dfb48f2ff947ac80
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/graphml.py
@@ -0,0 +1,1053 @@
+"""
+*******
+GraphML
+*******
+Read and write graphs in GraphML format.
+
+.. warning::
+
+ This parser uses the standard xml library present in Python, which is
+ insecure - see :external+python:mod:`xml` for additional information.
+ Only parse GraphML files you trust.
+
+This implementation does not support mixed graphs (directed and unidirected
+edges together), hyperedges, nested graphs, or ports.
+
+"GraphML is a comprehensive and easy-to-use file format for graphs. It
+consists of a language core to describe the structural properties of a
+graph and a flexible extension mechanism to add application-specific
+data. Its main features include support of
+
+ * directed, undirected, and mixed graphs,
+ * hypergraphs,
+ * hierarchical graphs,
+ * graphical representations,
+ * references to external data,
+ * application-specific attribute data, and
+ * light-weight parsers.
+
+Unlike many other file formats for graphs, GraphML does not use a
+custom syntax. Instead, it is based on XML and hence ideally suited as
+a common denominator for all kinds of services generating, archiving,
+or processing graphs."
+
+http://graphml.graphdrawing.org/
+
+Format
+------
+GraphML is an XML format. See
+http://graphml.graphdrawing.org/specification.html for the specification and
+http://graphml.graphdrawing.org/primer/graphml-primer.html
+for examples.
+"""
+
+import warnings
+from collections import defaultdict
+
+import networkx as nx
+from networkx.utils import open_file
+
+__all__ = [
+ "write_graphml",
+ "read_graphml",
+ "generate_graphml",
+ "write_graphml_xml",
+ "write_graphml_lxml",
+ "parse_graphml",
+ "GraphMLWriter",
+ "GraphMLReader",
+]
+
+
+@open_file(1, mode="wb")
+def write_graphml_xml(
+ G,
+ path,
+ encoding="utf-8",
+ prettyprint=True,
+ infer_numeric_types=False,
+ named_key_ids=False,
+ edge_id_from_attribute=None,
+):
+ """Write G in GraphML XML format to path
+
+ Parameters
+ ----------
+ G : graph
+ A networkx graph
+ path : file or string
+ File or filename to write.
+ Filenames ending in .gz or .bz2 will be compressed.
+ encoding : string (optional)
+ Encoding for text data.
+ prettyprint : bool (optional)
+ If True use line breaks and indenting in output XML.
+ infer_numeric_types : boolean
+ Determine if numeric types should be generalized.
+ For example, if edges have both int and float 'weight' attributes,
+ we infer in GraphML that both are floats.
+ named_key_ids : bool (optional)
+ If True use attr.name as value for key elements' id attribute.
+ edge_id_from_attribute : dict key (optional)
+ If provided, the graphml edge id is set by looking up the corresponding
+ edge data attribute keyed by this parameter. If `None` or the key does not exist in edge data,
+ the edge id is set by the edge key if `G` is a MultiGraph, else the edge id is left unset.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_graphml(G, "test.graphml")
+
+ Notes
+ -----
+ This implementation does not support mixed graphs (directed
+ and unidirected edges together) hyperedges, nested graphs, or ports.
+ """
+ writer = GraphMLWriter(
+ encoding=encoding,
+ prettyprint=prettyprint,
+ infer_numeric_types=infer_numeric_types,
+ named_key_ids=named_key_ids,
+ edge_id_from_attribute=edge_id_from_attribute,
+ )
+ writer.add_graph_element(G)
+ writer.dump(path)
+
+
+@open_file(1, mode="wb")
+def write_graphml_lxml(
+ G,
+ path,
+ encoding="utf-8",
+ prettyprint=True,
+ infer_numeric_types=False,
+ named_key_ids=False,
+ edge_id_from_attribute=None,
+):
+ """Write G in GraphML XML format to path
+
+ This function uses the LXML framework and should be faster than
+ the version using the xml library.
+
+ Parameters
+ ----------
+ G : graph
+ A networkx graph
+ path : file or string
+ File or filename to write.
+ Filenames ending in .gz or .bz2 will be compressed.
+ encoding : string (optional)
+ Encoding for text data.
+ prettyprint : bool (optional)
+ If True use line breaks and indenting in output XML.
+ infer_numeric_types : boolean
+ Determine if numeric types should be generalized.
+ For example, if edges have both int and float 'weight' attributes,
+ we infer in GraphML that both are floats.
+ named_key_ids : bool (optional)
+ If True use attr.name as value for key elements' id attribute.
+ edge_id_from_attribute : dict key (optional)
+ If provided, the graphml edge id is set by looking up the corresponding
+ edge data attribute keyed by this parameter. If `None` or the key does not exist in edge data,
+ the edge id is set by the edge key if `G` is a MultiGraph, else the edge id is left unset.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_graphml_lxml(G, "fourpath.graphml")
+
+ Notes
+ -----
+ This implementation does not support mixed graphs (directed
+ and unidirected edges together) hyperedges, nested graphs, or ports.
+ """
+ try:
+ import lxml.etree as lxmletree
+ except ImportError:
+ return write_graphml_xml(
+ G,
+ path,
+ encoding,
+ prettyprint,
+ infer_numeric_types,
+ named_key_ids,
+ edge_id_from_attribute,
+ )
+
+ writer = GraphMLWriterLxml(
+ path,
+ graph=G,
+ encoding=encoding,
+ prettyprint=prettyprint,
+ infer_numeric_types=infer_numeric_types,
+ named_key_ids=named_key_ids,
+ edge_id_from_attribute=edge_id_from_attribute,
+ )
+ writer.dump()
+
+
+def generate_graphml(
+ G,
+ encoding="utf-8",
+ prettyprint=True,
+ named_key_ids=False,
+ edge_id_from_attribute=None,
+):
+ """Generate GraphML lines for G
+
+ Parameters
+ ----------
+ G : graph
+ A networkx graph
+ encoding : string (optional)
+ Encoding for text data.
+ prettyprint : bool (optional)
+ If True use line breaks and indenting in output XML.
+ named_key_ids : bool (optional)
+ If True use attr.name as value for key elements' id attribute.
+ edge_id_from_attribute : dict key (optional)
+ If provided, the graphml edge id is set by looking up the corresponding
+ edge data attribute keyed by this parameter. If `None` or the key does not exist in edge data,
+ the edge id is set by the edge key if `G` is a MultiGraph, else the edge id is left unset.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> linefeed = chr(10) # linefeed = \n
+ >>> s = linefeed.join(nx.generate_graphml(G))
+ >>> for line in nx.generate_graphml(G): # doctest: +SKIP
+ ... print(line)
+
+ Notes
+ -----
+ This implementation does not support mixed graphs (directed and unidirected
+ edges together) hyperedges, nested graphs, or ports.
+ """
+ writer = GraphMLWriter(
+ encoding=encoding,
+ prettyprint=prettyprint,
+ named_key_ids=named_key_ids,
+ edge_id_from_attribute=edge_id_from_attribute,
+ )
+ writer.add_graph_element(G)
+ yield from str(writer).splitlines()
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_graphml(path, node_type=str, edge_key_type=int, force_multigraph=False):
+ """Read graph in GraphML format from path.
+
+ Parameters
+ ----------
+ path : file or string
+ File or filename to write.
+ Filenames ending in .gz or .bz2 will be compressed.
+
+ node_type: Python type (default: str)
+ Convert node ids to this type
+
+ edge_key_type: Python type (default: int)
+ Convert graphml edge ids to this type. Multigraphs use id as edge key.
+ Non-multigraphs add to edge attribute dict with name "id".
+
+ force_multigraph : bool (default: False)
+ If True, return a multigraph with edge keys. If False (the default)
+ return a multigraph when multiedges are in the graph.
+
+ Returns
+ -------
+ graph: NetworkX graph
+ If parallel edges are present or `force_multigraph=True` then
+ a MultiGraph or MultiDiGraph is returned. Otherwise a Graph/DiGraph.
+ The returned graph is directed if the file indicates it should be.
+
+ Notes
+ -----
+ Default node and edge attributes are not propagated to each node and edge.
+ They can be obtained from `G.graph` and applied to node and edge attributes
+ if desired using something like this:
+
+ >>> default_color = G.graph["node_default"]["color"] # doctest: +SKIP
+ >>> for node, data in G.nodes(data=True): # doctest: +SKIP
+ ... if "color" not in data:
+ ... data["color"] = default_color
+ >>> default_color = G.graph["edge_default"]["color"] # doctest: +SKIP
+ >>> for u, v, data in G.edges(data=True): # doctest: +SKIP
+ ... if "color" not in data:
+ ... data["color"] = default_color
+
+ This implementation does not support mixed graphs (directed and unidirected
+ edges together), hypergraphs, nested graphs, or ports.
+
+ For multigraphs the GraphML edge "id" will be used as the edge
+ key. If not specified then they "key" attribute will be used. If
+ there is no "key" attribute a default NetworkX multigraph edge key
+ will be provided.
+
+ Files with the yEd "yfiles" extension can be read. The type of the node's
+ shape is preserved in the `shape_type` node attribute.
+
+ yEd compressed files ("file.graphmlz" extension) can be read by renaming
+ the file to "file.graphml.gz".
+
+ """
+ reader = GraphMLReader(node_type, edge_key_type, force_multigraph)
+ # need to check for multiple graphs
+ glist = list(reader(path=path))
+ if len(glist) == 0:
+ # If no graph comes back, try looking for an incomplete header
+ header = b''
+ path.seek(0)
+ old_bytes = path.read()
+ new_bytes = old_bytes.replace(b"", header)
+ glist = list(reader(string=new_bytes))
+ if len(glist) == 0:
+ raise nx.NetworkXError("file not successfully read as graphml")
+ return glist[0]
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def parse_graphml(
+ graphml_string, node_type=str, edge_key_type=int, force_multigraph=False
+):
+ """Read graph in GraphML format from string.
+
+ Parameters
+ ----------
+ graphml_string : string
+ String containing graphml information
+ (e.g., contents of a graphml file).
+
+ node_type: Python type (default: str)
+ Convert node ids to this type
+
+ edge_key_type: Python type (default: int)
+ Convert graphml edge ids to this type. Multigraphs use id as edge key.
+ Non-multigraphs add to edge attribute dict with name "id".
+
+ force_multigraph : bool (default: False)
+ If True, return a multigraph with edge keys. If False (the default)
+ return a multigraph when multiedges are in the graph.
+
+
+ Returns
+ -------
+ graph: NetworkX graph
+ If no parallel edges are found a Graph or DiGraph is returned.
+ Otherwise a MultiGraph or MultiDiGraph is returned.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> linefeed = chr(10) # linefeed = \n
+ >>> s = linefeed.join(nx.generate_graphml(G))
+ >>> H = nx.parse_graphml(s)
+
+ Notes
+ -----
+ Default node and edge attributes are not propagated to each node and edge.
+ They can be obtained from `G.graph` and applied to node and edge attributes
+ if desired using something like this:
+
+ >>> default_color = G.graph["node_default"]["color"] # doctest: +SKIP
+ >>> for node, data in G.nodes(data=True): # doctest: +SKIP
+ ... if "color" not in data:
+ ... data["color"] = default_color
+ >>> default_color = G.graph["edge_default"]["color"] # doctest: +SKIP
+ >>> for u, v, data in G.edges(data=True): # doctest: +SKIP
+ ... if "color" not in data:
+ ... data["color"] = default_color
+
+ This implementation does not support mixed graphs (directed and unidirected
+ edges together), hypergraphs, nested graphs, or ports.
+
+ For multigraphs the GraphML edge "id" will be used as the edge
+ key. If not specified then they "key" attribute will be used. If
+ there is no "key" attribute a default NetworkX multigraph edge key
+ will be provided.
+
+ """
+ reader = GraphMLReader(node_type, edge_key_type, force_multigraph)
+ # need to check for multiple graphs
+ glist = list(reader(string=graphml_string))
+ if len(glist) == 0:
+ # If no graph comes back, try looking for an incomplete header
+ header = ''
+ new_string = graphml_string.replace("", header)
+ glist = list(reader(string=new_string))
+ if len(glist) == 0:
+ raise nx.NetworkXError("file not successfully read as graphml")
+ return glist[0]
+
+
+class GraphML:
+ NS_GRAPHML = "http://graphml.graphdrawing.org/xmlns"
+ NS_XSI = "http://www.w3.org/2001/XMLSchema-instance"
+ # xmlns:y="http://www.yworks.com/xml/graphml"
+ NS_Y = "http://www.yworks.com/xml/graphml"
+ SCHEMALOCATION = " ".join(
+ [
+ "http://graphml.graphdrawing.org/xmlns",
+ "http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd",
+ ]
+ )
+
+ def construct_types(self):
+ types = [
+ (int, "integer"), # for Gephi GraphML bug
+ (str, "yfiles"),
+ (str, "string"),
+ (int, "int"),
+ (int, "long"),
+ (float, "float"),
+ (float, "double"),
+ (bool, "boolean"),
+ ]
+
+ # These additions to types allow writing numpy types
+ try:
+ import numpy as np
+ except:
+ pass
+ else:
+ # prepend so that python types are created upon read (last entry wins)
+ types = [
+ (np.float64, "float"),
+ (np.float32, "float"),
+ (np.float16, "float"),
+ (np.int_, "int"),
+ (np.int8, "int"),
+ (np.int16, "int"),
+ (np.int32, "int"),
+ (np.int64, "int"),
+ (np.uint8, "int"),
+ (np.uint16, "int"),
+ (np.uint32, "int"),
+ (np.uint64, "int"),
+ (np.int_, "int"),
+ (np.intc, "int"),
+ (np.intp, "int"),
+ ] + types
+
+ self.xml_type = dict(types)
+ self.python_type = dict(reversed(a) for a in types)
+
+ # This page says that data types in GraphML follow Java(TM).
+ # http://graphml.graphdrawing.org/primer/graphml-primer.html#AttributesDefinition
+ # true and false are the only boolean literals:
+ # http://en.wikibooks.org/wiki/Java_Programming/Literals#Boolean_Literals
+ convert_bool = {
+ # We use data.lower() in actual use.
+ "true": True,
+ "false": False,
+ # Include integer strings for convenience.
+ "0": False,
+ 0: False,
+ "1": True,
+ 1: True,
+ }
+
+ def get_xml_type(self, key):
+ """Wrapper around the xml_type dict that raises a more informative
+ exception message when a user attempts to use data of a type not
+ supported by GraphML."""
+ try:
+ return self.xml_type[key]
+ except KeyError as err:
+ raise TypeError(
+ f"GraphML does not support type {key} as data values."
+ ) from err
+
+
+class GraphMLWriter(GraphML):
+ def __init__(
+ self,
+ graph=None,
+ encoding="utf-8",
+ prettyprint=True,
+ infer_numeric_types=False,
+ named_key_ids=False,
+ edge_id_from_attribute=None,
+ ):
+ self.construct_types()
+ from xml.etree.ElementTree import Element
+
+ self.myElement = Element
+
+ self.infer_numeric_types = infer_numeric_types
+ self.prettyprint = prettyprint
+ self.named_key_ids = named_key_ids
+ self.edge_id_from_attribute = edge_id_from_attribute
+ self.encoding = encoding
+ self.xml = self.myElement(
+ "graphml",
+ {
+ "xmlns": self.NS_GRAPHML,
+ "xmlns:xsi": self.NS_XSI,
+ "xsi:schemaLocation": self.SCHEMALOCATION,
+ },
+ )
+ self.keys = {}
+ self.attributes = defaultdict(list)
+ self.attribute_types = defaultdict(set)
+
+ if graph is not None:
+ self.add_graph_element(graph)
+
+ def __str__(self):
+ from xml.etree.ElementTree import tostring
+
+ if self.prettyprint:
+ self.indent(self.xml)
+ s = tostring(self.xml).decode(self.encoding)
+ return s
+
+ def attr_type(self, name, scope, value):
+ """Infer the attribute type of data named name. Currently this only
+ supports inference of numeric types.
+
+ If self.infer_numeric_types is false, type is used. Otherwise, pick the
+ most general of types found across all values with name and scope. This
+ means edges with data named 'weight' are treated separately from nodes
+ with data named 'weight'.
+ """
+ if self.infer_numeric_types:
+ types = self.attribute_types[(name, scope)]
+
+ if len(types) > 1:
+ types = {self.get_xml_type(t) for t in types}
+ if "string" in types:
+ return str
+ elif "float" in types or "double" in types:
+ return float
+ else:
+ return int
+ else:
+ return list(types)[0]
+ else:
+ return type(value)
+
+ def get_key(self, name, attr_type, scope, default):
+ keys_key = (name, attr_type, scope)
+ try:
+ return self.keys[keys_key]
+ except KeyError:
+ if self.named_key_ids:
+ new_id = name
+ else:
+ new_id = f"d{len(list(self.keys))}"
+
+ self.keys[keys_key] = new_id
+ key_kwargs = {
+ "id": new_id,
+ "for": scope,
+ "attr.name": name,
+ "attr.type": attr_type,
+ }
+ key_element = self.myElement("key", **key_kwargs)
+ # add subelement for data default value if present
+ if default is not None:
+ default_element = self.myElement("default")
+ default_element.text = str(default)
+ key_element.append(default_element)
+ self.xml.insert(0, key_element)
+ return new_id
+
+ def add_data(self, name, element_type, value, scope="all", default=None):
+ """
+ Make a data element for an edge or a node. Keep a log of the
+ type in the keys table.
+ """
+ if element_type not in self.xml_type:
+ raise nx.NetworkXError(
+ f"GraphML writer does not support {element_type} as data values."
+ )
+ keyid = self.get_key(name, self.get_xml_type(element_type), scope, default)
+ data_element = self.myElement("data", key=keyid)
+ data_element.text = str(value)
+ return data_element
+
+ def add_attributes(self, scope, xml_obj, data, default):
+ """Appends attribute data to edges or nodes, and stores type information
+ to be added later. See add_graph_element.
+ """
+ for k, v in data.items():
+ self.attribute_types[(str(k), scope)].add(type(v))
+ self.attributes[xml_obj].append([k, v, scope, default.get(k)])
+
+ def add_nodes(self, G, graph_element):
+ default = G.graph.get("node_default", {})
+ for node, data in G.nodes(data=True):
+ node_element = self.myElement("node", id=str(node))
+ self.add_attributes("node", node_element, data, default)
+ graph_element.append(node_element)
+
+ def add_edges(self, G, graph_element):
+ if G.is_multigraph():
+ for u, v, key, data in G.edges(data=True, keys=True):
+ edge_element = self.myElement(
+ "edge",
+ source=str(u),
+ target=str(v),
+ id=str(data.get(self.edge_id_from_attribute))
+ if self.edge_id_from_attribute
+ and self.edge_id_from_attribute in data
+ else str(key),
+ )
+ default = G.graph.get("edge_default", {})
+ self.add_attributes("edge", edge_element, data, default)
+ graph_element.append(edge_element)
+ else:
+ for u, v, data in G.edges(data=True):
+ if self.edge_id_from_attribute and self.edge_id_from_attribute in data:
+ # select attribute to be edge id
+ edge_element = self.myElement(
+ "edge",
+ source=str(u),
+ target=str(v),
+ id=str(data.get(self.edge_id_from_attribute)),
+ )
+ else:
+ # default: no edge id
+ edge_element = self.myElement("edge", source=str(u), target=str(v))
+ default = G.graph.get("edge_default", {})
+ self.add_attributes("edge", edge_element, data, default)
+ graph_element.append(edge_element)
+
+ def add_graph_element(self, G):
+ """
+ Serialize graph G in GraphML to the stream.
+ """
+ if G.is_directed():
+ default_edge_type = "directed"
+ else:
+ default_edge_type = "undirected"
+
+ graphid = G.graph.pop("id", None)
+ if graphid is None:
+ graph_element = self.myElement("graph", edgedefault=default_edge_type)
+ else:
+ graph_element = self.myElement(
+ "graph", edgedefault=default_edge_type, id=graphid
+ )
+ default = {}
+ data = {
+ k: v
+ for (k, v) in G.graph.items()
+ if k not in ["node_default", "edge_default"]
+ }
+ self.add_attributes("graph", graph_element, data, default)
+ self.add_nodes(G, graph_element)
+ self.add_edges(G, graph_element)
+
+ # self.attributes contains a mapping from XML Objects to a list of
+ # data that needs to be added to them.
+ # We postpone processing in order to do type inference/generalization.
+ # See self.attr_type
+ for xml_obj, data in self.attributes.items():
+ for k, v, scope, default in data:
+ xml_obj.append(
+ self.add_data(
+ str(k), self.attr_type(k, scope, v), str(v), scope, default
+ )
+ )
+ self.xml.append(graph_element)
+
+ def add_graphs(self, graph_list):
+ """Add many graphs to this GraphML document."""
+ for G in graph_list:
+ self.add_graph_element(G)
+
+ def dump(self, stream):
+ from xml.etree.ElementTree import ElementTree
+
+ if self.prettyprint:
+ self.indent(self.xml)
+ document = ElementTree(self.xml)
+ document.write(stream, encoding=self.encoding, xml_declaration=True)
+
+ def indent(self, elem, level=0):
+ # in-place prettyprint formatter
+ i = "\n" + level * " "
+ if len(elem):
+ if not elem.text or not elem.text.strip():
+ elem.text = i + " "
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ for elem in elem:
+ self.indent(elem, level + 1)
+ if not elem.tail or not elem.tail.strip():
+ elem.tail = i
+ else:
+ if level and (not elem.tail or not elem.tail.strip()):
+ elem.tail = i
+
+
+class IncrementalElement:
+ """Wrapper for _IncrementalWriter providing an Element like interface.
+
+ This wrapper does not intend to be a complete implementation but rather to
+ deal with those calls used in GraphMLWriter.
+ """
+
+ def __init__(self, xml, prettyprint):
+ self.xml = xml
+ self.prettyprint = prettyprint
+
+ def append(self, element):
+ self.xml.write(element, pretty_print=self.prettyprint)
+
+
+class GraphMLWriterLxml(GraphMLWriter):
+ def __init__(
+ self,
+ path,
+ graph=None,
+ encoding="utf-8",
+ prettyprint=True,
+ infer_numeric_types=False,
+ named_key_ids=False,
+ edge_id_from_attribute=None,
+ ):
+ self.construct_types()
+ import lxml.etree as lxmletree
+
+ self.myElement = lxmletree.Element
+
+ self._encoding = encoding
+ self._prettyprint = prettyprint
+ self.named_key_ids = named_key_ids
+ self.edge_id_from_attribute = edge_id_from_attribute
+ self.infer_numeric_types = infer_numeric_types
+
+ self._xml_base = lxmletree.xmlfile(path, encoding=encoding)
+ self._xml = self._xml_base.__enter__()
+ self._xml.write_declaration()
+
+ # We need to have a xml variable that support insertion. This call is
+ # used for adding the keys to the document.
+ # We will store those keys in a plain list, and then after the graph
+ # element is closed we will add them to the main graphml element.
+ self.xml = []
+ self._keys = self.xml
+ self._graphml = self._xml.element(
+ "graphml",
+ {
+ "xmlns": self.NS_GRAPHML,
+ "xmlns:xsi": self.NS_XSI,
+ "xsi:schemaLocation": self.SCHEMALOCATION,
+ },
+ )
+ self._graphml.__enter__()
+ self.keys = {}
+ self.attribute_types = defaultdict(set)
+
+ if graph is not None:
+ self.add_graph_element(graph)
+
+ def add_graph_element(self, G):
+ """
+ Serialize graph G in GraphML to the stream.
+ """
+ if G.is_directed():
+ default_edge_type = "directed"
+ else:
+ default_edge_type = "undirected"
+
+ graphid = G.graph.pop("id", None)
+ if graphid is None:
+ graph_element = self._xml.element("graph", edgedefault=default_edge_type)
+ else:
+ graph_element = self._xml.element(
+ "graph", edgedefault=default_edge_type, id=graphid
+ )
+
+ # gather attributes types for the whole graph
+ # to find the most general numeric format needed.
+ # Then pass through attributes to create key_id for each.
+ graphdata = {
+ k: v
+ for k, v in G.graph.items()
+ if k not in ("node_default", "edge_default")
+ }
+ node_default = G.graph.get("node_default", {})
+ edge_default = G.graph.get("edge_default", {})
+ # Graph attributes
+ for k, v in graphdata.items():
+ self.attribute_types[(str(k), "graph")].add(type(v))
+ for k, v in graphdata.items():
+ element_type = self.get_xml_type(self.attr_type(k, "graph", v))
+ self.get_key(str(k), element_type, "graph", None)
+ # Nodes and data
+ for node, d in G.nodes(data=True):
+ for k, v in d.items():
+ self.attribute_types[(str(k), "node")].add(type(v))
+ for node, d in G.nodes(data=True):
+ for k, v in d.items():
+ T = self.get_xml_type(self.attr_type(k, "node", v))
+ self.get_key(str(k), T, "node", node_default.get(k))
+ # Edges and data
+ if G.is_multigraph():
+ for u, v, ekey, d in G.edges(keys=True, data=True):
+ for k, v in d.items():
+ self.attribute_types[(str(k), "edge")].add(type(v))
+ for u, v, ekey, d in G.edges(keys=True, data=True):
+ for k, v in d.items():
+ T = self.get_xml_type(self.attr_type(k, "edge", v))
+ self.get_key(str(k), T, "edge", edge_default.get(k))
+ else:
+ for u, v, d in G.edges(data=True):
+ for k, v in d.items():
+ self.attribute_types[(str(k), "edge")].add(type(v))
+ for u, v, d in G.edges(data=True):
+ for k, v in d.items():
+ T = self.get_xml_type(self.attr_type(k, "edge", v))
+ self.get_key(str(k), T, "edge", edge_default.get(k))
+
+ # Now add attribute keys to the xml file
+ for key in self.xml:
+ self._xml.write(key, pretty_print=self._prettyprint)
+
+ # The incremental_writer writes each node/edge as it is created
+ incremental_writer = IncrementalElement(self._xml, self._prettyprint)
+ with graph_element:
+ self.add_attributes("graph", incremental_writer, graphdata, {})
+ self.add_nodes(G, incremental_writer) # adds attributes too
+ self.add_edges(G, incremental_writer) # adds attributes too
+
+ def add_attributes(self, scope, xml_obj, data, default):
+ """Appends attribute data."""
+ for k, v in data.items():
+ data_element = self.add_data(
+ str(k), self.attr_type(str(k), scope, v), str(v), scope, default.get(k)
+ )
+ xml_obj.append(data_element)
+
+ def __str__(self):
+ return object.__str__(self)
+
+ def dump(self, stream=None):
+ self._graphml.__exit__(None, None, None)
+ self._xml_base.__exit__(None, None, None)
+
+
+# default is lxml is present.
+write_graphml = write_graphml_lxml
+
+
+class GraphMLReader(GraphML):
+ """Read a GraphML document. Produces NetworkX graph objects."""
+
+ def __init__(self, node_type=str, edge_key_type=int, force_multigraph=False):
+ self.construct_types()
+ self.node_type = node_type
+ self.edge_key_type = edge_key_type
+ self.multigraph = force_multigraph # If False, test for multiedges
+ self.edge_ids = {} # dict mapping (u,v) tuples to edge id attributes
+
+ def __call__(self, path=None, string=None):
+ from xml.etree.ElementTree import ElementTree, fromstring
+
+ if path is not None:
+ self.xml = ElementTree(file=path)
+ elif string is not None:
+ self.xml = fromstring(string)
+ else:
+ raise ValueError("Must specify either 'path' or 'string' as kwarg")
+ (keys, defaults) = self.find_graphml_keys(self.xml)
+ for g in self.xml.findall(f"{{{self.NS_GRAPHML}}}graph"):
+ yield self.make_graph(g, keys, defaults)
+
+ def make_graph(self, graph_xml, graphml_keys, defaults, G=None):
+ # set default graph type
+ edgedefault = graph_xml.get("edgedefault", None)
+ if G is None:
+ if edgedefault == "directed":
+ G = nx.MultiDiGraph()
+ else:
+ G = nx.MultiGraph()
+ # set defaults for graph attributes
+ G.graph["node_default"] = {}
+ G.graph["edge_default"] = {}
+ for key_id, value in defaults.items():
+ key_for = graphml_keys[key_id]["for"]
+ name = graphml_keys[key_id]["name"]
+ python_type = graphml_keys[key_id]["type"]
+ if key_for == "node":
+ G.graph["node_default"].update({name: python_type(value)})
+ if key_for == "edge":
+ G.graph["edge_default"].update({name: python_type(value)})
+ # hyperedges are not supported
+ hyperedge = graph_xml.find(f"{{{self.NS_GRAPHML}}}hyperedge")
+ if hyperedge is not None:
+ raise nx.NetworkXError("GraphML reader doesn't support hyperedges")
+ # add nodes
+ for node_xml in graph_xml.findall(f"{{{self.NS_GRAPHML}}}node"):
+ self.add_node(G, node_xml, graphml_keys, defaults)
+ # add edges
+ for edge_xml in graph_xml.findall(f"{{{self.NS_GRAPHML}}}edge"):
+ self.add_edge(G, edge_xml, graphml_keys)
+ # add graph data
+ data = self.decode_data_elements(graphml_keys, graph_xml)
+ G.graph.update(data)
+
+ # switch to Graph or DiGraph if no parallel edges were found
+ if self.multigraph:
+ return G
+
+ G = nx.DiGraph(G) if G.is_directed() else nx.Graph(G)
+ # add explicit edge "id" from file as attribute in NX graph.
+ nx.set_edge_attributes(G, values=self.edge_ids, name="id")
+ return G
+
+ def add_node(self, G, node_xml, graphml_keys, defaults):
+ """Add a node to the graph."""
+ # warn on finding unsupported ports tag
+ ports = node_xml.find(f"{{{self.NS_GRAPHML}}}port")
+ if ports is not None:
+ warnings.warn("GraphML port tag not supported.")
+ # find the node by id and cast it to the appropriate type
+ node_id = self.node_type(node_xml.get("id"))
+ # get data/attributes for node
+ data = self.decode_data_elements(graphml_keys, node_xml)
+ G.add_node(node_id, **data)
+ # get child nodes
+ if node_xml.attrib.get("yfiles.foldertype") == "group":
+ graph_xml = node_xml.find(f"{{{self.NS_GRAPHML}}}graph")
+ self.make_graph(graph_xml, graphml_keys, defaults, G)
+
+ def add_edge(self, G, edge_element, graphml_keys):
+ """Add an edge to the graph."""
+ # warn on finding unsupported ports tag
+ ports = edge_element.find(f"{{{self.NS_GRAPHML}}}port")
+ if ports is not None:
+ warnings.warn("GraphML port tag not supported.")
+
+ # raise error if we find mixed directed and undirected edges
+ directed = edge_element.get("directed")
+ if G.is_directed() and directed == "false":
+ msg = "directed=false edge found in directed graph."
+ raise nx.NetworkXError(msg)
+ if (not G.is_directed()) and directed == "true":
+ msg = "directed=true edge found in undirected graph."
+ raise nx.NetworkXError(msg)
+
+ source = self.node_type(edge_element.get("source"))
+ target = self.node_type(edge_element.get("target"))
+ data = self.decode_data_elements(graphml_keys, edge_element)
+ # GraphML stores edge ids as an attribute
+ # NetworkX uses them as keys in multigraphs too if no key
+ # attribute is specified
+ edge_id = edge_element.get("id")
+ if edge_id:
+ # self.edge_ids is used by `make_graph` method for non-multigraphs
+ self.edge_ids[source, target] = edge_id
+ try:
+ edge_id = self.edge_key_type(edge_id)
+ except ValueError: # Could not convert.
+ pass
+ else:
+ edge_id = data.get("key")
+
+ if G.has_edge(source, target):
+ # mark this as a multigraph
+ self.multigraph = True
+
+ # Use add_edges_from to avoid error with add_edge when `'key' in data`
+ # Note there is only one edge here...
+ G.add_edges_from([(source, target, edge_id, data)])
+
+ def decode_data_elements(self, graphml_keys, obj_xml):
+ """Use the key information to decode the data XML if present."""
+ data = {}
+ for data_element in obj_xml.findall(f"{{{self.NS_GRAPHML}}}data"):
+ key = data_element.get("key")
+ try:
+ data_name = graphml_keys[key]["name"]
+ data_type = graphml_keys[key]["type"]
+ except KeyError as err:
+ raise nx.NetworkXError(f"Bad GraphML data: no key {key}") from err
+ text = data_element.text
+ # assume anything with subelements is a yfiles extension
+ if text is not None and len(list(data_element)) == 0:
+ if data_type == bool:
+ # Ignore cases.
+ # http://docs.oracle.com/javase/6/docs/api/java/lang/
+ # Boolean.html#parseBoolean%28java.lang.String%29
+ data[data_name] = self.convert_bool[text.lower()]
+ else:
+ data[data_name] = data_type(text)
+ elif len(list(data_element)) > 0:
+ # Assume yfiles as subelements, try to extract node_label
+ node_label = None
+ # set GenericNode's configuration as shape type
+ gn = data_element.find(f"{{{self.NS_Y}}}GenericNode")
+ if gn is not None:
+ data["shape_type"] = gn.get("configuration")
+ for node_type in ["GenericNode", "ShapeNode", "SVGNode", "ImageNode"]:
+ pref = f"{{{self.NS_Y}}}{node_type}/{{{self.NS_Y}}}"
+ geometry = data_element.find(f"{pref}Geometry")
+ if geometry is not None:
+ data["x"] = geometry.get("x")
+ data["y"] = geometry.get("y")
+ if node_label is None:
+ node_label = data_element.find(f"{pref}NodeLabel")
+ shape = data_element.find(f"{pref}Shape")
+ if shape is not None:
+ data["shape_type"] = shape.get("type")
+ if node_label is not None:
+ data["label"] = node_label.text
+
+ # check all the different types of edges available in yEd.
+ for edge_type in [
+ "PolyLineEdge",
+ "SplineEdge",
+ "QuadCurveEdge",
+ "BezierEdge",
+ "ArcEdge",
+ ]:
+ pref = f"{{{self.NS_Y}}}{edge_type}/{{{self.NS_Y}}}"
+ edge_label = data_element.find(f"{pref}EdgeLabel")
+ if edge_label is not None:
+ break
+ if edge_label is not None:
+ data["label"] = edge_label.text
+ elif text is None:
+ data[data_name] = ""
+ return data
+
+ def find_graphml_keys(self, graph_element):
+ """Extracts all the keys and key defaults from the xml."""
+ graphml_keys = {}
+ graphml_key_defaults = {}
+ for k in graph_element.findall(f"{{{self.NS_GRAPHML}}}key"):
+ attr_id = k.get("id")
+ attr_type = k.get("attr.type")
+ attr_name = k.get("attr.name")
+ yfiles_type = k.get("yfiles.type")
+ if yfiles_type is not None:
+ attr_name = yfiles_type
+ attr_type = "yfiles"
+ if attr_type is None:
+ attr_type = "string"
+ warnings.warn(f"No key type for id {attr_id}. Using string")
+ if attr_name is None:
+ raise nx.NetworkXError(f"Unknown key for id {attr_id}.")
+ graphml_keys[attr_id] = {
+ "name": attr_name,
+ "type": self.python_type[attr_type],
+ "for": k.get("for"),
+ }
+ # check for "default" sub-element of key element
+ default = k.find(f"{{{self.NS_GRAPHML}}}default")
+ if default is not None:
+ # Handle default values identically to data element values
+ python_type = graphml_keys[attr_id]["type"]
+ if python_type == bool:
+ graphml_key_defaults[attr_id] = self.convert_bool[
+ default.text.lower()
+ ]
+ else:
+ graphml_key_defaults[attr_id] = python_type(default.text)
+ return graphml_keys, graphml_key_defaults
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..532c71d79b7b8936481be8db0defaedf9a96b3e3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__init__.py
@@ -0,0 +1,19 @@
+"""
+*********
+JSON data
+*********
+Generate and parse JSON serializable data for NetworkX graphs.
+
+These formats are suitable for use with the d3.js examples https://d3js.org/
+
+The three formats that you can generate with NetworkX are:
+
+ - node-link like in the d3.js example https://bl.ocks.org/mbostock/4062045
+ - tree like in the d3.js example https://bl.ocks.org/mbostock/4063550
+ - adjacency like in the d3.js example https://bost.ocks.org/mike/miserables/
+"""
+
+from networkx.readwrite.json_graph.node_link import *
+from networkx.readwrite.json_graph.adjacency import *
+from networkx.readwrite.json_graph.tree import *
+from networkx.readwrite.json_graph.cytoscape import *
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/__init__.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/__init__.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d773d6115759f00789f262d00781811362b30dbd
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/__init__.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/adjacency.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/adjacency.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2c0cefa534812b1b869cddc6addb845118151ca9
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/adjacency.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/cytoscape.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/cytoscape.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e785c9cb2555fd60807e2f333b313ff2a73a81c2
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/cytoscape.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/node_link.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/node_link.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b9d4758876593048d62469fda10d7c02093d78a1
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/node_link.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/tree.cpython-310.pyc b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/tree.cpython-310.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..18bc0f605a69f1dc6cd41d0ca796fb032fd6c6e3
Binary files /dev/null and b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/__pycache__/tree.cpython-310.pyc differ
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/adjacency.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/adjacency.py
new file mode 100644
index 0000000000000000000000000000000000000000..3b05747565e73388b0871fbb7daf0f85ad2ce98b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/adjacency.py
@@ -0,0 +1,156 @@
+import networkx as nx
+
+__all__ = ["adjacency_data", "adjacency_graph"]
+
+_attrs = {"id": "id", "key": "key"}
+
+
+def adjacency_data(G, attrs=_attrs):
+ """Returns data in adjacency format that is suitable for JSON serialization
+ and use in JavaScript documents.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+
+ attrs : dict
+ A dictionary that contains two keys 'id' and 'key'. The corresponding
+ values provide the attribute names for storing NetworkX-internal graph
+ data. The values should be unique. Default value:
+ :samp:`dict(id='id', key='key')`.
+
+ If some user-defined graph data use these attribute names as data keys,
+ they may be silently dropped.
+
+ Returns
+ -------
+ data : dict
+ A dictionary with adjacency formatted data.
+
+ Raises
+ ------
+ NetworkXError
+ If values in attrs are not unique.
+
+ Examples
+ --------
+ >>> from networkx.readwrite import json_graph
+ >>> G = nx.Graph([(1, 2)])
+ >>> data = json_graph.adjacency_data(G)
+
+ To serialize with json
+
+ >>> import json
+ >>> s = json.dumps(data)
+
+ Notes
+ -----
+ Graph, node, and link attributes will be written when using this format
+ but attribute keys must be strings if you want to serialize the resulting
+ data with JSON.
+
+ The default value of attrs will be changed in a future release of NetworkX.
+
+ See Also
+ --------
+ adjacency_graph, node_link_data, tree_data
+ """
+ multigraph = G.is_multigraph()
+ id_ = attrs["id"]
+ # Allow 'key' to be omitted from attrs if the graph is not a multigraph.
+ key = None if not multigraph else attrs["key"]
+ if id_ == key:
+ raise nx.NetworkXError("Attribute names are not unique.")
+ data = {}
+ data["directed"] = G.is_directed()
+ data["multigraph"] = multigraph
+ data["graph"] = list(G.graph.items())
+ data["nodes"] = []
+ data["adjacency"] = []
+ for n, nbrdict in G.adjacency():
+ data["nodes"].append({**G.nodes[n], id_: n})
+ adj = []
+ if multigraph:
+ for nbr, keys in nbrdict.items():
+ for k, d in keys.items():
+ adj.append({**d, id_: nbr, key: k})
+ else:
+ for nbr, d in nbrdict.items():
+ adj.append({**d, id_: nbr})
+ data["adjacency"].append(adj)
+ return data
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def adjacency_graph(data, directed=False, multigraph=True, attrs=_attrs):
+ """Returns graph from adjacency data format.
+
+ Parameters
+ ----------
+ data : dict
+ Adjacency list formatted graph data
+
+ directed : bool
+ If True, and direction not specified in data, return a directed graph.
+
+ multigraph : bool
+ If True, and multigraph not specified in data, return a multigraph.
+
+ attrs : dict
+ A dictionary that contains two keys 'id' and 'key'. The corresponding
+ values provide the attribute names for storing NetworkX-internal graph
+ data. The values should be unique. Default value:
+ :samp:`dict(id='id', key='key')`.
+
+ Returns
+ -------
+ G : NetworkX graph
+ A NetworkX graph object
+
+ Examples
+ --------
+ >>> from networkx.readwrite import json_graph
+ >>> G = nx.Graph([(1, 2)])
+ >>> data = json_graph.adjacency_data(G)
+ >>> H = json_graph.adjacency_graph(data)
+
+ Notes
+ -----
+ The default value of attrs will be changed in a future release of NetworkX.
+
+ See Also
+ --------
+ adjacency_graph, node_link_data, tree_data
+ """
+ multigraph = data.get("multigraph", multigraph)
+ directed = data.get("directed", directed)
+ if multigraph:
+ graph = nx.MultiGraph()
+ else:
+ graph = nx.Graph()
+ if directed:
+ graph = graph.to_directed()
+ id_ = attrs["id"]
+ # Allow 'key' to be omitted from attrs if the graph is not a multigraph.
+ key = None if not multigraph else attrs["key"]
+ graph.graph = dict(data.get("graph", []))
+ mapping = []
+ for d in data["nodes"]:
+ node_data = d.copy()
+ node = node_data.pop(id_)
+ mapping.append(node)
+ graph.add_node(node)
+ graph.nodes[node].update(node_data)
+ for i, d in enumerate(data["adjacency"]):
+ source = mapping[i]
+ for tdata in d:
+ target_data = tdata.copy()
+ target = target_data.pop(id_)
+ if not multigraph:
+ graph.add_edge(source, target)
+ graph[source][target].update(target_data)
+ else:
+ ky = target_data.pop(key, None)
+ graph.add_edge(source, target, key=ky)
+ graph[source][target][ky].update(target_data)
+ return graph
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/cytoscape.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/cytoscape.py
new file mode 100644
index 0000000000000000000000000000000000000000..2f3b2176ab403fa9b85acdded5b97a6ebc728855
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/cytoscape.py
@@ -0,0 +1,178 @@
+import networkx as nx
+
+__all__ = ["cytoscape_data", "cytoscape_graph"]
+
+
+def cytoscape_data(G, name="name", ident="id"):
+ """Returns data in Cytoscape JSON format (cyjs).
+
+ Parameters
+ ----------
+ G : NetworkX Graph
+ The graph to convert to cytoscape format
+ name : string
+ A string which is mapped to the 'name' node element in cyjs format.
+ Must not have the same value as `ident`.
+ ident : string
+ A string which is mapped to the 'id' node element in cyjs format.
+ Must not have the same value as `name`.
+
+ Returns
+ -------
+ data: dict
+ A dictionary with cyjs formatted data.
+
+ Raises
+ ------
+ NetworkXError
+ If the values for `name` and `ident` are identical.
+
+ See Also
+ --------
+ cytoscape_graph: convert a dictionary in cyjs format to a graph
+
+ References
+ ----------
+ .. [1] Cytoscape user's manual:
+ http://manual.cytoscape.org/en/stable/index.html
+
+ Examples
+ --------
+ >>> G = nx.path_graph(2)
+ >>> nx.cytoscape_data(G) # doctest: +SKIP
+ {'data': [],
+ 'directed': False,
+ 'multigraph': False,
+ 'elements': {'nodes': [{'data': {'id': '0', 'value': 0, 'name': '0'}},
+ {'data': {'id': '1', 'value': 1, 'name': '1'}}],
+ 'edges': [{'data': {'source': 0, 'target': 1}}]}}
+ """
+ if name == ident:
+ raise nx.NetworkXError("name and ident must be different.")
+
+ jsondata = {"data": list(G.graph.items())}
+ jsondata["directed"] = G.is_directed()
+ jsondata["multigraph"] = G.is_multigraph()
+ jsondata["elements"] = {"nodes": [], "edges": []}
+ nodes = jsondata["elements"]["nodes"]
+ edges = jsondata["elements"]["edges"]
+
+ for i, j in G.nodes.items():
+ n = {"data": j.copy()}
+ n["data"]["id"] = j.get(ident) or str(i)
+ n["data"]["value"] = i
+ n["data"]["name"] = j.get(name) or str(i)
+ nodes.append(n)
+
+ if G.is_multigraph():
+ for e in G.edges(keys=True):
+ n = {"data": G.adj[e[0]][e[1]][e[2]].copy()}
+ n["data"]["source"] = e[0]
+ n["data"]["target"] = e[1]
+ n["data"]["key"] = e[2]
+ edges.append(n)
+ else:
+ for e in G.edges():
+ n = {"data": G.adj[e[0]][e[1]].copy()}
+ n["data"]["source"] = e[0]
+ n["data"]["target"] = e[1]
+ edges.append(n)
+ return jsondata
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def cytoscape_graph(data, name="name", ident="id"):
+ """
+ Create a NetworkX graph from a dictionary in cytoscape JSON format.
+
+ Parameters
+ ----------
+ data : dict
+ A dictionary of data conforming to cytoscape JSON format.
+ name : string
+ A string which is mapped to the 'name' node element in cyjs format.
+ Must not have the same value as `ident`.
+ ident : string
+ A string which is mapped to the 'id' node element in cyjs format.
+ Must not have the same value as `name`.
+
+ Returns
+ -------
+ graph : a NetworkX graph instance
+ The `graph` can be an instance of `Graph`, `DiGraph`, `MultiGraph`, or
+ `MultiDiGraph` depending on the input data.
+
+ Raises
+ ------
+ NetworkXError
+ If the `name` and `ident` attributes are identical.
+
+ See Also
+ --------
+ cytoscape_data: convert a NetworkX graph to a dict in cyjs format
+
+ References
+ ----------
+ .. [1] Cytoscape user's manual:
+ http://manual.cytoscape.org/en/stable/index.html
+
+ Examples
+ --------
+ >>> data_dict = {
+ ... "data": [],
+ ... "directed": False,
+ ... "multigraph": False,
+ ... "elements": {
+ ... "nodes": [
+ ... {"data": {"id": "0", "value": 0, "name": "0"}},
+ ... {"data": {"id": "1", "value": 1, "name": "1"}},
+ ... ],
+ ... "edges": [{"data": {"source": 0, "target": 1}}],
+ ... },
+ ... }
+ >>> G = nx.cytoscape_graph(data_dict)
+ >>> G.name
+ ''
+ >>> G.nodes()
+ NodeView((0, 1))
+ >>> G.nodes(data=True)[0]
+ {'id': '0', 'value': 0, 'name': '0'}
+ >>> G.edges(data=True)
+ EdgeDataView([(0, 1, {'source': 0, 'target': 1})])
+ """
+ if name == ident:
+ raise nx.NetworkXError("name and ident must be different.")
+
+ multigraph = data.get("multigraph")
+ directed = data.get("directed")
+ if multigraph:
+ graph = nx.MultiGraph()
+ else:
+ graph = nx.Graph()
+ if directed:
+ graph = graph.to_directed()
+ graph.graph = dict(data.get("data"))
+ for d in data["elements"]["nodes"]:
+ node_data = d["data"].copy()
+ node = d["data"]["value"]
+
+ if d["data"].get(name):
+ node_data[name] = d["data"].get(name)
+ if d["data"].get(ident):
+ node_data[ident] = d["data"].get(ident)
+
+ graph.add_node(node)
+ graph.nodes[node].update(node_data)
+
+ for d in data["elements"]["edges"]:
+ edge_data = d["data"].copy()
+ sour = d["data"]["source"]
+ targ = d["data"]["target"]
+ if multigraph:
+ key = d["data"].get("key", 0)
+ graph.add_edge(sour, targ, key=key)
+ graph.edges[sour, targ, key].update(edge_data)
+ else:
+ graph.add_edge(sour, targ)
+ graph.edges[sour, targ].update(edge_data)
+ return graph
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/node_link.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/node_link.py
new file mode 100644
index 0000000000000000000000000000000000000000..63ca9789f1f3e0b1d88d276cd188e06d23100ccf
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/node_link.py
@@ -0,0 +1,330 @@
+import warnings
+from itertools import count
+
+import networkx as nx
+
+__all__ = ["node_link_data", "node_link_graph"]
+
+
+def _to_tuple(x):
+ """Converts lists to tuples, including nested lists.
+
+ All other non-list inputs are passed through unmodified. This function is
+ intended to be used to convert potentially nested lists from json files
+ into valid nodes.
+
+ Examples
+ --------
+ >>> _to_tuple([1, 2, [3, 4]])
+ (1, 2, (3, 4))
+ """
+ if not isinstance(x, tuple | list):
+ return x
+ return tuple(map(_to_tuple, x))
+
+
+def node_link_data(
+ G,
+ *,
+ source="source",
+ target="target",
+ name="id",
+ key="key",
+ edges=None,
+ nodes="nodes",
+ link=None,
+):
+ """Returns data in node-link format that is suitable for JSON serialization
+ and use in JavaScript documents.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+ source : string
+ A string that provides the 'source' attribute name for storing NetworkX-internal graph data.
+ target : string
+ A string that provides the 'target' attribute name for storing NetworkX-internal graph data.
+ name : string
+ A string that provides the 'name' attribute name for storing NetworkX-internal graph data.
+ key : string
+ A string that provides the 'key' attribute name for storing NetworkX-internal graph data.
+ edges : string
+ A string that provides the 'edges' attribute name for storing NetworkX-internal graph data.
+ nodes : string
+ A string that provides the 'nodes' attribute name for storing NetworkX-internal graph data.
+ link : string
+ .. deprecated:: 3.4
+
+ The `link` argument is deprecated and will be removed in version `3.6`.
+ Use the `edges` keyword instead.
+
+ A string that provides the 'edges' attribute name for storing NetworkX-internal graph data.
+
+ Returns
+ -------
+ data : dict
+ A dictionary with node-link formatted data.
+
+ Raises
+ ------
+ NetworkXError
+ If the values of 'source', 'target' and 'key' are not unique.
+
+ Examples
+ --------
+ >>> from pprint import pprint
+ >>> G = nx.Graph([("A", "B")])
+ >>> data1 = nx.node_link_data(G, edges="edges")
+ >>> pprint(data1)
+ {'directed': False,
+ 'edges': [{'source': 'A', 'target': 'B'}],
+ 'graph': {},
+ 'multigraph': False,
+ 'nodes': [{'id': 'A'}, {'id': 'B'}]}
+
+ To serialize with JSON
+
+ >>> import json
+ >>> s1 = json.dumps(data1)
+ >>> s1
+ '{"directed": false, "multigraph": false, "graph": {}, "nodes": [{"id": "A"}, {"id": "B"}], "edges": [{"source": "A", "target": "B"}]}'
+
+ A graph can also be serialized by passing `node_link_data` as an encoder function.
+
+ >>> s1 = json.dumps(G, default=nx.node_link_data)
+ >>> s1
+ '{"directed": false, "multigraph": false, "graph": {}, "nodes": [{"id": "A"}, {"id": "B"}], "links": [{"source": "A", "target": "B"}]}'
+
+ The attribute names for storing NetworkX-internal graph data can
+ be specified as keyword options.
+
+ >>> H = nx.gn_graph(2)
+ >>> data2 = nx.node_link_data(
+ ... H, edges="links", source="from", target="to", nodes="vertices"
+ ... )
+ >>> pprint(data2)
+ {'directed': True,
+ 'graph': {},
+ 'links': [{'from': 1, 'to': 0}],
+ 'multigraph': False,
+ 'vertices': [{'id': 0}, {'id': 1}]}
+
+ Notes
+ -----
+ Graph, node, and link attributes are stored in this format. Note that
+ attribute keys will be converted to strings in order to comply with JSON.
+
+ Attribute 'key' is only used for multigraphs.
+
+ To use `node_link_data` in conjunction with `node_link_graph`,
+ the keyword names for the attributes must match.
+
+ See Also
+ --------
+ node_link_graph, adjacency_data, tree_data
+ """
+ # TODO: Remove between the lines when `link` deprecation expires
+ # -------------------------------------------------------------
+ if link is not None:
+ warnings.warn(
+ "Keyword argument 'link' is deprecated; use 'edges' instead",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ if edges is not None:
+ raise ValueError(
+ "Both 'edges' and 'link' are specified. Use 'edges', 'link' will be remove in a future release"
+ )
+ else:
+ edges = link
+ else:
+ if edges is None:
+ warnings.warn(
+ (
+ '\nThe default value will be `edges="edges" in NetworkX 3.6.\n\n'
+ "To make this warning go away, explicitly set the edges kwarg, e.g.:\n\n"
+ ' nx.node_link_data(G, edges="links") to preserve current behavior, or\n'
+ ' nx.node_link_data(G, edges="edges") for forward compatibility.'
+ ),
+ FutureWarning,
+ )
+ edges = "links"
+ # ------------------------------------------------------------
+
+ multigraph = G.is_multigraph()
+
+ # Allow 'key' to be omitted from attrs if the graph is not a multigraph.
+ key = None if not multigraph else key
+ if len({source, target, key}) < 3:
+ raise nx.NetworkXError("Attribute names are not unique.")
+ data = {
+ "directed": G.is_directed(),
+ "multigraph": multigraph,
+ "graph": G.graph,
+ nodes: [{**G.nodes[n], name: n} for n in G],
+ }
+ if multigraph:
+ data[edges] = [
+ {**d, source: u, target: v, key: k}
+ for u, v, k, d in G.edges(keys=True, data=True)
+ ]
+ else:
+ data[edges] = [{**d, source: u, target: v} for u, v, d in G.edges(data=True)]
+ return data
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def node_link_graph(
+ data,
+ directed=False,
+ multigraph=True,
+ *,
+ source="source",
+ target="target",
+ name="id",
+ key="key",
+ edges=None,
+ nodes="nodes",
+ link=None,
+):
+ """Returns graph from node-link data format.
+
+ Useful for de-serialization from JSON.
+
+ Parameters
+ ----------
+ data : dict
+ node-link formatted graph data
+
+ directed : bool
+ If True, and direction not specified in data, return a directed graph.
+
+ multigraph : bool
+ If True, and multigraph not specified in data, return a multigraph.
+
+ source : string
+ A string that provides the 'source' attribute name for storing NetworkX-internal graph data.
+ target : string
+ A string that provides the 'target' attribute name for storing NetworkX-internal graph data.
+ name : string
+ A string that provides the 'name' attribute name for storing NetworkX-internal graph data.
+ key : string
+ A string that provides the 'key' attribute name for storing NetworkX-internal graph data.
+ edges : string
+ A string that provides the 'edges' attribute name for storing NetworkX-internal graph data.
+ nodes : string
+ A string that provides the 'nodes' attribute name for storing NetworkX-internal graph data.
+ link : string
+ .. deprecated:: 3.4
+
+ The `link` argument is deprecated and will be removed in version `3.6`.
+ Use the `edges` keyword instead.
+
+ A string that provides the 'edges' attribute name for storing NetworkX-internal graph data.
+
+ Returns
+ -------
+ G : NetworkX graph
+ A NetworkX graph object
+
+ Examples
+ --------
+
+ Create data in node-link format by converting a graph.
+
+ >>> from pprint import pprint
+ >>> G = nx.Graph([("A", "B")])
+ >>> data = nx.node_link_data(G, edges="edges")
+ >>> pprint(data)
+ {'directed': False,
+ 'edges': [{'source': 'A', 'target': 'B'}],
+ 'graph': {},
+ 'multigraph': False,
+ 'nodes': [{'id': 'A'}, {'id': 'B'}]}
+
+ Revert data in node-link format to a graph.
+
+ >>> H = nx.node_link_graph(data, edges="edges")
+ >>> print(H.edges)
+ [('A', 'B')]
+
+ To serialize and deserialize a graph with JSON,
+
+ >>> import json
+ >>> d = json.dumps(nx.node_link_data(G, edges="edges"))
+ >>> H = nx.node_link_graph(json.loads(d), edges="edges")
+ >>> print(G.edges, H.edges)
+ [('A', 'B')] [('A', 'B')]
+
+
+ Notes
+ -----
+ Attribute 'key' is only used for multigraphs.
+
+ To use `node_link_data` in conjunction with `node_link_graph`,
+ the keyword names for the attributes must match.
+
+ See Also
+ --------
+ node_link_data, adjacency_data, tree_data
+ """
+ # TODO: Remove between the lines when `link` deprecation expires
+ # -------------------------------------------------------------
+ if link is not None:
+ warnings.warn(
+ "Keyword argument 'link' is deprecated; use 'edges' instead",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ if edges is not None:
+ raise ValueError(
+ "Both 'edges' and 'link' are specified. Use 'edges', 'link' will be remove in a future release"
+ )
+ else:
+ edges = link
+ else:
+ if edges is None:
+ warnings.warn(
+ (
+ '\nThe default value will be changed to `edges="edges" in NetworkX 3.6.\n\n'
+ "To make this warning go away, explicitly set the edges kwarg, e.g.:\n\n"
+ ' nx.node_link_graph(data, edges="links") to preserve current behavior, or\n'
+ ' nx.node_link_graph(data, edges="edges") for forward compatibility.'
+ ),
+ FutureWarning,
+ )
+ edges = "links"
+ # -------------------------------------------------------------
+
+ multigraph = data.get("multigraph", multigraph)
+ directed = data.get("directed", directed)
+ if multigraph:
+ graph = nx.MultiGraph()
+ else:
+ graph = nx.Graph()
+ if directed:
+ graph = graph.to_directed()
+
+ # Allow 'key' to be omitted from attrs if the graph is not a multigraph.
+ key = None if not multigraph else key
+ graph.graph = data.get("graph", {})
+ c = count()
+ for d in data[nodes]:
+ node = _to_tuple(d.get(name, next(c)))
+ nodedata = {str(k): v for k, v in d.items() if k != name}
+ graph.add_node(node, **nodedata)
+ for d in data[edges]:
+ src = tuple(d[source]) if isinstance(d[source], list) else d[source]
+ tgt = tuple(d[target]) if isinstance(d[target], list) else d[target]
+ if not multigraph:
+ edgedata = {str(k): v for k, v in d.items() if k != source and k != target}
+ graph.add_edge(src, tgt, **edgedata)
+ else:
+ ky = d.get(key, None)
+ edgedata = {
+ str(k): v
+ for k, v in d.items()
+ if k != source and k != target and k != key
+ }
+ graph.add_edge(src, tgt, ky, **edgedata)
+ return graph
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_adjacency.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_adjacency.py
new file mode 100644
index 0000000000000000000000000000000000000000..37506382c55a110b26fdba32a268545d23f4474b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_adjacency.py
@@ -0,0 +1,78 @@
+import copy
+import json
+
+import pytest
+
+import networkx as nx
+from networkx.readwrite.json_graph import adjacency_data, adjacency_graph
+from networkx.utils import graphs_equal
+
+
+class TestAdjacency:
+ def test_graph(self):
+ G = nx.path_graph(4)
+ H = adjacency_graph(adjacency_data(G))
+ assert graphs_equal(G, H)
+
+ def test_graph_attributes(self):
+ G = nx.path_graph(4)
+ G.add_node(1, color="red")
+ G.add_edge(1, 2, width=7)
+ G.graph["foo"] = "bar"
+ G.graph[1] = "one"
+
+ H = adjacency_graph(adjacency_data(G))
+ assert graphs_equal(G, H)
+ assert H.graph["foo"] == "bar"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
+
+ d = json.dumps(adjacency_data(G))
+ H = adjacency_graph(json.loads(d))
+ assert graphs_equal(G, H)
+ assert H.graph["foo"] == "bar"
+ assert H.graph[1] == "one"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
+
+ def test_digraph(self):
+ G = nx.DiGraph()
+ nx.add_path(G, [1, 2, 3])
+ H = adjacency_graph(adjacency_data(G))
+ assert H.is_directed()
+ assert graphs_equal(G, H)
+
+ def test_multidigraph(self):
+ G = nx.MultiDiGraph()
+ nx.add_path(G, [1, 2, 3])
+ H = adjacency_graph(adjacency_data(G))
+ assert H.is_directed()
+ assert H.is_multigraph()
+ assert graphs_equal(G, H)
+
+ def test_multigraph(self):
+ G = nx.MultiGraph()
+ G.add_edge(1, 2, key="first")
+ G.add_edge(1, 2, key="second", color="blue")
+ H = adjacency_graph(adjacency_data(G))
+ assert graphs_equal(G, H)
+ assert H[1][2]["second"]["color"] == "blue"
+
+ def test_input_data_is_not_modified_when_building_graph(self):
+ G = nx.path_graph(4)
+ input_data = adjacency_data(G)
+ orig_data = copy.deepcopy(input_data)
+ # Ensure input is unmodified by deserialisation
+ assert graphs_equal(G, adjacency_graph(input_data))
+ assert input_data == orig_data
+
+ def test_adjacency_form_json_serialisable(self):
+ G = nx.path_graph(4)
+ H = adjacency_graph(json.loads(json.dumps(adjacency_data(G))))
+ assert graphs_equal(G, H)
+
+ def test_exception(self):
+ with pytest.raises(nx.NetworkXError):
+ G = nx.MultiDiGraph()
+ attrs = {"id": "node", "key": "node"}
+ adjacency_data(G, attrs)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_cytoscape.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_cytoscape.py
new file mode 100644
index 0000000000000000000000000000000000000000..5d47f21f4217d1997165c4f19feb67d283d2dab2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_cytoscape.py
@@ -0,0 +1,78 @@
+import copy
+import json
+
+import pytest
+
+import networkx as nx
+from networkx.readwrite.json_graph import cytoscape_data, cytoscape_graph
+
+
+def test_graph():
+ G = nx.path_graph(4)
+ H = cytoscape_graph(cytoscape_data(G))
+ assert nx.is_isomorphic(G, H)
+
+
+def test_input_data_is_not_modified_when_building_graph():
+ G = nx.path_graph(4)
+ input_data = cytoscape_data(G)
+ orig_data = copy.deepcopy(input_data)
+ # Ensure input is unmodified by cytoscape_graph (gh-4173)
+ cytoscape_graph(input_data)
+ assert input_data == orig_data
+
+
+def test_graph_attributes():
+ G = nx.path_graph(4)
+ G.add_node(1, color="red")
+ G.add_edge(1, 2, width=7)
+ G.graph["foo"] = "bar"
+ G.graph[1] = "one"
+ G.add_node(3, name="node", id="123")
+
+ H = cytoscape_graph(cytoscape_data(G))
+ assert H.graph["foo"] == "bar"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
+ assert H.nodes[3]["name"] == "node"
+ assert H.nodes[3]["id"] == "123"
+
+ d = json.dumps(cytoscape_data(G))
+ H = cytoscape_graph(json.loads(d))
+ assert H.graph["foo"] == "bar"
+ assert H.graph[1] == "one"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
+ assert H.nodes[3]["name"] == "node"
+ assert H.nodes[3]["id"] == "123"
+
+
+def test_digraph():
+ G = nx.DiGraph()
+ nx.add_path(G, [1, 2, 3])
+ H = cytoscape_graph(cytoscape_data(G))
+ assert H.is_directed()
+ assert nx.is_isomorphic(G, H)
+
+
+def test_multidigraph():
+ G = nx.MultiDiGraph()
+ nx.add_path(G, [1, 2, 3])
+ H = cytoscape_graph(cytoscape_data(G))
+ assert H.is_directed()
+ assert H.is_multigraph()
+
+
+def test_multigraph():
+ G = nx.MultiGraph()
+ G.add_edge(1, 2, key="first")
+ G.add_edge(1, 2, key="second", color="blue")
+ H = cytoscape_graph(cytoscape_data(G))
+ assert nx.is_isomorphic(G, H)
+ assert H[1][2]["second"]["color"] == "blue"
+
+
+def test_exception():
+ with pytest.raises(nx.NetworkXError):
+ G = nx.MultiDiGraph()
+ cytoscape_data(G, name="foo", ident="foo")
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_node_link.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_node_link.py
new file mode 100644
index 0000000000000000000000000000000000000000..f903f6066a6e7be922136275ba8fa6df0da41caa
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_node_link.py
@@ -0,0 +1,175 @@
+import json
+
+import pytest
+
+import networkx as nx
+from networkx.readwrite.json_graph import node_link_data, node_link_graph
+
+
+def test_node_link_edges_default_future_warning():
+ "Test FutureWarning is raised when `edges=None` in node_link_data and node_link_graph"
+ G = nx.Graph([(1, 2)])
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ data = nx.node_link_data(G) # edges=None, the default
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = nx.node_link_graph(data) # edges=None, the default
+
+
+def test_node_link_deprecated_link_param():
+ G = nx.Graph([(1, 2)])
+ with pytest.warns(DeprecationWarning, match="Keyword argument 'link'"):
+ data = nx.node_link_data(G, link="links")
+ with pytest.warns(DeprecationWarning, match="Keyword argument 'link'"):
+ H = nx.node_link_graph(data, link="links")
+
+
+class TestNodeLink:
+ # TODO: To be removed when signature change complete
+ def test_custom_attrs_dep(self):
+ G = nx.path_graph(4)
+ G.add_node(1, color="red")
+ G.add_edge(1, 2, width=7)
+ G.graph[1] = "one"
+ G.graph["foo"] = "bar"
+
+ attrs = {
+ "source": "c_source",
+ "target": "c_target",
+ "name": "c_id",
+ "key": "c_key",
+ "link": "c_links",
+ }
+
+ H = node_link_graph(node_link_data(G, **attrs), multigraph=False, **attrs)
+ assert nx.is_isomorphic(G, H)
+ assert H.graph["foo"] == "bar"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
+
+ # provide only a partial dictionary of keywords.
+ # This is similar to an example in the doc string
+ attrs = {
+ "link": "c_links",
+ "source": "c_source",
+ "target": "c_target",
+ }
+ H = node_link_graph(node_link_data(G, **attrs), multigraph=False, **attrs)
+ assert nx.is_isomorphic(G, H)
+ assert H.graph["foo"] == "bar"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
+
+ def test_exception_dep(self):
+ G = nx.MultiDiGraph()
+ with pytest.raises(nx.NetworkXError):
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ node_link_data(G, name="node", source="node", target="node", key="node")
+
+ def test_graph(self):
+ G = nx.path_graph(4)
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = node_link_graph(node_link_data(G))
+ assert nx.is_isomorphic(G, H)
+
+ def test_graph_attributes(self):
+ G = nx.path_graph(4)
+ G.add_node(1, color="red")
+ G.add_edge(1, 2, width=7)
+ G.graph[1] = "one"
+ G.graph["foo"] = "bar"
+
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = node_link_graph(node_link_data(G))
+ assert H.graph["foo"] == "bar"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
+
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ d = json.dumps(node_link_data(G))
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = node_link_graph(json.loads(d))
+ assert H.graph["foo"] == "bar"
+ assert H.graph["1"] == "one"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
+
+ def test_digraph(self):
+ G = nx.DiGraph()
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = node_link_graph(node_link_data(G))
+ assert H.is_directed()
+
+ def test_multigraph(self):
+ G = nx.MultiGraph()
+ G.add_edge(1, 2, key="first")
+ G.add_edge(1, 2, key="second", color="blue")
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = node_link_graph(node_link_data(G))
+ assert nx.is_isomorphic(G, H)
+ assert H[1][2]["second"]["color"] == "blue"
+
+ def test_graph_with_tuple_nodes(self):
+ G = nx.Graph()
+ G.add_edge((0, 0), (1, 0), color=[255, 255, 0])
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ d = node_link_data(G)
+ dumped_d = json.dumps(d)
+ dd = json.loads(dumped_d)
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = node_link_graph(dd)
+ assert H.nodes[(0, 0)] == G.nodes[(0, 0)]
+ assert H[(0, 0)][(1, 0)]["color"] == [255, 255, 0]
+
+ def test_unicode_keys(self):
+ q = "qualité"
+ G = nx.Graph()
+ G.add_node(1, **{q: q})
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ s = node_link_data(G)
+ output = json.dumps(s, ensure_ascii=False)
+ data = json.loads(output)
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = node_link_graph(data)
+ assert H.nodes[1][q] == q
+
+ def test_exception(self):
+ G = nx.MultiDiGraph()
+ attrs = {"name": "node", "source": "node", "target": "node", "key": "node"}
+ with pytest.raises(nx.NetworkXError):
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ node_link_data(G, **attrs)
+
+ def test_string_ids(self):
+ q = "qualité"
+ G = nx.DiGraph()
+ G.add_node("A")
+ G.add_node(q)
+ G.add_edge("A", q)
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ data = node_link_data(G)
+ assert data["links"][0]["source"] == "A"
+ assert data["links"][0]["target"] == q
+ with pytest.warns(FutureWarning, match="\nThe default value will be"):
+ H = node_link_graph(data)
+ assert nx.is_isomorphic(G, H)
+
+ def test_custom_attrs(self):
+ G = nx.path_graph(4)
+ G.add_node(1, color="red")
+ G.add_edge(1, 2, width=7)
+ G.graph[1] = "one"
+ G.graph["foo"] = "bar"
+
+ attrs = {
+ "source": "c_source",
+ "target": "c_target",
+ "name": "c_id",
+ "key": "c_key",
+ "link": "c_links",
+ }
+
+ H = node_link_graph(node_link_data(G, **attrs), multigraph=False, **attrs)
+ assert nx.is_isomorphic(G, H)
+ assert H.graph["foo"] == "bar"
+ assert H.nodes[1]["color"] == "red"
+ assert H[1][2]["width"] == 7
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_tree.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_tree.py
new file mode 100644
index 0000000000000000000000000000000000000000..643a14d89b5211f2d97b98f2e227e68361781b97
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tests/test_tree.py
@@ -0,0 +1,48 @@
+import json
+
+import pytest
+
+import networkx as nx
+from networkx.readwrite.json_graph import tree_data, tree_graph
+
+
+def test_graph():
+ G = nx.DiGraph()
+ G.add_nodes_from([1, 2, 3], color="red")
+ G.add_edge(1, 2, foo=7)
+ G.add_edge(1, 3, foo=10)
+ G.add_edge(3, 4, foo=10)
+ H = tree_graph(tree_data(G, 1))
+ assert nx.is_isomorphic(G, H)
+
+
+def test_graph_attributes():
+ G = nx.DiGraph()
+ G.add_nodes_from([1, 2, 3], color="red")
+ G.add_edge(1, 2, foo=7)
+ G.add_edge(1, 3, foo=10)
+ G.add_edge(3, 4, foo=10)
+ H = tree_graph(tree_data(G, 1))
+ assert H.nodes[1]["color"] == "red"
+
+ d = json.dumps(tree_data(G, 1))
+ H = tree_graph(json.loads(d))
+ assert H.nodes[1]["color"] == "red"
+
+
+def test_exceptions():
+ with pytest.raises(TypeError, match="is not a tree."):
+ G = nx.complete_graph(3)
+ tree_data(G, 0)
+ with pytest.raises(TypeError, match="is not directed."):
+ G = nx.path_graph(3)
+ tree_data(G, 0)
+ with pytest.raises(TypeError, match="is not weakly connected."):
+ G = nx.path_graph(3, create_using=nx.DiGraph)
+ G.add_edge(2, 0)
+ G.add_node(3)
+ tree_data(G, 0)
+ with pytest.raises(nx.NetworkXError, match="must be different."):
+ G = nx.MultiDiGraph()
+ G.add_node(0)
+ tree_data(G, 0, ident="node", children="node")
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tree.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tree.py
new file mode 100644
index 0000000000000000000000000000000000000000..22b07b09d277815e824b1dd8c5b82a149ed14e1b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/json_graph/tree.py
@@ -0,0 +1,137 @@
+from itertools import chain
+
+import networkx as nx
+
+__all__ = ["tree_data", "tree_graph"]
+
+
+def tree_data(G, root, ident="id", children="children"):
+ """Returns data in tree format that is suitable for JSON serialization
+ and use in JavaScript documents.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+ G must be an oriented tree
+
+ root : node
+ The root of the tree
+
+ ident : string
+ Attribute name for storing NetworkX-internal graph data. `ident` must
+ have a different value than `children`. The default is 'id'.
+
+ children : string
+ Attribute name for storing NetworkX-internal graph data. `children`
+ must have a different value than `ident`. The default is 'children'.
+
+ Returns
+ -------
+ data : dict
+ A dictionary with node-link formatted data.
+
+ Raises
+ ------
+ NetworkXError
+ If `children` and `ident` attributes are identical.
+
+ Examples
+ --------
+ >>> from networkx.readwrite import json_graph
+ >>> G = nx.DiGraph([(1, 2)])
+ >>> data = json_graph.tree_data(G, root=1)
+
+ To serialize with json
+
+ >>> import json
+ >>> s = json.dumps(data)
+
+ Notes
+ -----
+ Node attributes are stored in this format but keys
+ for attributes must be strings if you want to serialize with JSON.
+
+ Graph and edge attributes are not stored.
+
+ See Also
+ --------
+ tree_graph, node_link_data, adjacency_data
+ """
+ if G.number_of_nodes() != G.number_of_edges() + 1:
+ raise TypeError("G is not a tree.")
+ if not G.is_directed():
+ raise TypeError("G is not directed.")
+ if not nx.is_weakly_connected(G):
+ raise TypeError("G is not weakly connected.")
+
+ if ident == children:
+ raise nx.NetworkXError("The values for `id` and `children` must be different.")
+
+ def add_children(n, G):
+ nbrs = G[n]
+ if len(nbrs) == 0:
+ return []
+ children_ = []
+ for child in nbrs:
+ d = {**G.nodes[child], ident: child}
+ c = add_children(child, G)
+ if c:
+ d[children] = c
+ children_.append(d)
+ return children_
+
+ return {**G.nodes[root], ident: root, children: add_children(root, G)}
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def tree_graph(data, ident="id", children="children"):
+ """Returns graph from tree data format.
+
+ Parameters
+ ----------
+ data : dict
+ Tree formatted graph data
+
+ ident : string
+ Attribute name for storing NetworkX-internal graph data. `ident` must
+ have a different value than `children`. The default is 'id'.
+
+ children : string
+ Attribute name for storing NetworkX-internal graph data. `children`
+ must have a different value than `ident`. The default is 'children'.
+
+ Returns
+ -------
+ G : NetworkX DiGraph
+
+ Examples
+ --------
+ >>> from networkx.readwrite import json_graph
+ >>> G = nx.DiGraph([(1, 2)])
+ >>> data = json_graph.tree_data(G, root=1)
+ >>> H = json_graph.tree_graph(data)
+
+ See Also
+ --------
+ tree_data, node_link_data, adjacency_data
+ """
+ graph = nx.DiGraph()
+
+ def add_children(parent, children_):
+ for data in children_:
+ child = data[ident]
+ graph.add_edge(parent, child)
+ grandchildren = data.get(children, [])
+ if grandchildren:
+ add_children(child, grandchildren)
+ nodedata = {
+ str(k): v for k, v in data.items() if k != ident and k != children
+ }
+ graph.add_node(child, **nodedata)
+
+ root = data[ident]
+ children_ = data.get(children, [])
+ nodedata = {str(k): v for k, v in data.items() if k != ident and k != children}
+ graph.add_node(root, **nodedata)
+ add_children(root, children_)
+ return graph
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/leda.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/leda.py
new file mode 100644
index 0000000000000000000000000000000000000000..9fb57db140081aa65f1d9f91dbcc3fe29faf7cd5
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/leda.py
@@ -0,0 +1,108 @@
+"""
+Read graphs in LEDA format.
+
+LEDA is a C++ class library for efficient data types and algorithms.
+
+Format
+------
+See http://www.algorithmic-solutions.info/leda_guide/graphs/leda_native_graph_fileformat.html
+
+"""
+# Original author: D. Eppstein, UC Irvine, August 12, 2003.
+# The original code at http://www.ics.uci.edu/~eppstein/PADS/ is public domain.
+
+__all__ = ["read_leda", "parse_leda"]
+
+import networkx as nx
+from networkx.exception import NetworkXError
+from networkx.utils import open_file
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_leda(path, encoding="UTF-8"):
+ """Read graph in LEDA format from path.
+
+ Parameters
+ ----------
+ path : file or string
+ File or filename to read. Filenames ending in .gz or .bz2 will be
+ uncompressed.
+
+ Returns
+ -------
+ G : NetworkX graph
+
+ Examples
+ --------
+ G=nx.read_leda('file.leda')
+
+ References
+ ----------
+ .. [1] http://www.algorithmic-solutions.info/leda_guide/graphs/leda_native_graph_fileformat.html
+ """
+ lines = (line.decode(encoding) for line in path)
+ G = parse_leda(lines)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def parse_leda(lines):
+ """Read graph in LEDA format from string or iterable.
+
+ Parameters
+ ----------
+ lines : string or iterable
+ Data in LEDA format.
+
+ Returns
+ -------
+ G : NetworkX graph
+
+ Examples
+ --------
+ G=nx.parse_leda(string)
+
+ References
+ ----------
+ .. [1] http://www.algorithmic-solutions.info/leda_guide/graphs/leda_native_graph_fileformat.html
+ """
+ if isinstance(lines, str):
+ lines = iter(lines.split("\n"))
+ lines = iter(
+ [
+ line.rstrip("\n")
+ for line in lines
+ if not (line.startswith(("#", "\n")) or line == "")
+ ]
+ )
+ for i in range(3):
+ next(lines)
+ # Graph
+ du = int(next(lines)) # -1=directed, -2=undirected
+ if du == -1:
+ G = nx.DiGraph()
+ else:
+ G = nx.Graph()
+
+ # Nodes
+ n = int(next(lines)) # number of nodes
+ node = {}
+ for i in range(1, n + 1): # LEDA counts from 1 to n
+ symbol = next(lines).rstrip().strip("|{}| ")
+ if symbol == "":
+ symbol = str(i) # use int if no label - could be trouble
+ node[i] = symbol
+
+ G.add_nodes_from([s for i, s in node.items()])
+
+ # Edges
+ m = int(next(lines)) # number of edges
+ for i in range(m):
+ try:
+ s, t, reversal, label = next(lines).split()
+ except BaseException as err:
+ raise NetworkXError(f"Too few fields in LEDA.GRAPH edge {i+1}") from err
+ # BEWARE: no handling of reversal edges
+ G.add_edge(node[int(s)], node[int(t)], label=label[2:-2])
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/multiline_adjlist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/multiline_adjlist.py
new file mode 100644
index 0000000000000000000000000000000000000000..808445dbfececca748bb62b28f23417c109df335
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/multiline_adjlist.py
@@ -0,0 +1,393 @@
+"""
+*************************
+Multi-line Adjacency List
+*************************
+Read and write NetworkX graphs as multi-line adjacency lists.
+
+The multi-line adjacency list format is useful for graphs with
+nodes that can be meaningfully represented as strings. With this format
+simple edge data can be stored but node or graph data is not.
+
+Format
+------
+The first label in a line is the source node label followed by the node degree
+d. The next d lines are target node labels and optional edge data.
+That pattern repeats for all nodes in the graph.
+
+The graph with edges a-b, a-c, d-e can be represented as the following
+adjacency list (anything following the # in a line is a comment)::
+
+ # example.multiline-adjlist
+ a 2
+ b
+ c
+ d 1
+ e
+"""
+
+__all__ = [
+ "generate_multiline_adjlist",
+ "write_multiline_adjlist",
+ "parse_multiline_adjlist",
+ "read_multiline_adjlist",
+]
+
+import networkx as nx
+from networkx.utils import open_file
+
+
+def generate_multiline_adjlist(G, delimiter=" "):
+ """Generate a single line of the graph G in multiline adjacency list format.
+
+ Parameters
+ ----------
+ G : NetworkX graph
+
+ delimiter : string, optional
+ Separator for node labels
+
+ Returns
+ -------
+ lines : string
+ Lines of data in multiline adjlist format.
+
+ Examples
+ --------
+ >>> G = nx.lollipop_graph(4, 3)
+ >>> for line in nx.generate_multiline_adjlist(G):
+ ... print(line)
+ 0 3
+ 1 {}
+ 2 {}
+ 3 {}
+ 1 2
+ 2 {}
+ 3 {}
+ 2 1
+ 3 {}
+ 3 1
+ 4 {}
+ 4 1
+ 5 {}
+ 5 1
+ 6 {}
+ 6 0
+
+ See Also
+ --------
+ write_multiline_adjlist, read_multiline_adjlist
+ """
+ if G.is_directed():
+ if G.is_multigraph():
+ for s, nbrs in G.adjacency():
+ nbr_edges = [
+ (u, data)
+ for u, datadict in nbrs.items()
+ for key, data in datadict.items()
+ ]
+ deg = len(nbr_edges)
+ yield str(s) + delimiter + str(deg)
+ for u, d in nbr_edges:
+ if d is None:
+ yield str(u)
+ else:
+ yield str(u) + delimiter + str(d)
+ else: # directed single edges
+ for s, nbrs in G.adjacency():
+ deg = len(nbrs)
+ yield str(s) + delimiter + str(deg)
+ for u, d in nbrs.items():
+ if d is None:
+ yield str(u)
+ else:
+ yield str(u) + delimiter + str(d)
+ else: # undirected
+ if G.is_multigraph():
+ seen = set() # helper dict used to avoid duplicate edges
+ for s, nbrs in G.adjacency():
+ nbr_edges = [
+ (u, data)
+ for u, datadict in nbrs.items()
+ if u not in seen
+ for key, data in datadict.items()
+ ]
+ deg = len(nbr_edges)
+ yield str(s) + delimiter + str(deg)
+ for u, d in nbr_edges:
+ if d is None:
+ yield str(u)
+ else:
+ yield str(u) + delimiter + str(d)
+ seen.add(s)
+ else: # undirected single edges
+ seen = set() # helper dict used to avoid duplicate edges
+ for s, nbrs in G.adjacency():
+ nbr_edges = [(u, d) for u, d in nbrs.items() if u not in seen]
+ deg = len(nbr_edges)
+ yield str(s) + delimiter + str(deg)
+ for u, d in nbr_edges:
+ if d is None:
+ yield str(u)
+ else:
+ yield str(u) + delimiter + str(d)
+ seen.add(s)
+
+
+@open_file(1, mode="wb")
+def write_multiline_adjlist(G, path, delimiter=" ", comments="#", encoding="utf-8"):
+ """Write the graph G in multiline adjacency list format to path
+
+ Parameters
+ ----------
+ G : NetworkX graph
+
+ path : string or file
+ Filename or file handle to write to.
+ Filenames ending in .gz or .bz2 will be compressed.
+
+ comments : string, optional
+ Marker for comment lines
+
+ delimiter : string, optional
+ Separator for node labels
+
+ encoding : string, optional
+ Text encoding.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_multiline_adjlist(G, "test.adjlist")
+
+ The path can be a file handle or a string with the name of the file. If a
+ file handle is provided, it has to be opened in 'wb' mode.
+
+ >>> fh = open("test.adjlist", "wb")
+ >>> nx.write_multiline_adjlist(G, fh)
+
+ Filenames ending in .gz or .bz2 will be compressed.
+
+ >>> nx.write_multiline_adjlist(G, "test.adjlist.gz")
+
+ See Also
+ --------
+ read_multiline_adjlist
+ """
+ import sys
+ import time
+
+ pargs = comments + " ".join(sys.argv)
+ header = (
+ f"{pargs}\n"
+ + comments
+ + f" GMT {time.asctime(time.gmtime())}\n"
+ + comments
+ + f" {G.name}\n"
+ )
+ path.write(header.encode(encoding))
+
+ for multiline in generate_multiline_adjlist(G, delimiter):
+ multiline += "\n"
+ path.write(multiline.encode(encoding))
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def parse_multiline_adjlist(
+ lines, comments="#", delimiter=None, create_using=None, nodetype=None, edgetype=None
+):
+ """Parse lines of a multiline adjacency list representation of a graph.
+
+ Parameters
+ ----------
+ lines : list or iterator of strings
+ Input data in multiline adjlist format
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ nodetype : Python type, optional
+ Convert nodes to this type.
+
+ edgetype : Python type, optional
+ Convert edges to this type.
+
+ comments : string, optional
+ Marker for comment lines
+
+ delimiter : string, optional
+ Separator for node labels. The default is whitespace.
+
+ Returns
+ -------
+ G: NetworkX graph
+ The graph corresponding to the lines in multiline adjacency list format.
+
+ Examples
+ --------
+ >>> lines = [
+ ... "1 2",
+ ... "2 {'weight':3, 'name': 'Frodo'}",
+ ... "3 {}",
+ ... "2 1",
+ ... "5 {'weight':6, 'name': 'Saruman'}",
+ ... ]
+ >>> G = nx.parse_multiline_adjlist(iter(lines), nodetype=int)
+ >>> list(G)
+ [1, 2, 3, 5]
+
+ """
+ from ast import literal_eval
+
+ G = nx.empty_graph(0, create_using)
+ for line in lines:
+ p = line.find(comments)
+ if p >= 0:
+ line = line[:p]
+ if not line:
+ continue
+ try:
+ (u, deg) = line.rstrip("\n").split(delimiter)
+ deg = int(deg)
+ except BaseException as err:
+ raise TypeError(f"Failed to read node and degree on line ({line})") from err
+ if nodetype is not None:
+ try:
+ u = nodetype(u)
+ except BaseException as err:
+ raise TypeError(
+ f"Failed to convert node ({u}) to type {nodetype}"
+ ) from err
+ G.add_node(u)
+ for i in range(deg):
+ while True:
+ try:
+ line = next(lines)
+ except StopIteration as err:
+ msg = f"Failed to find neighbor for node ({u})"
+ raise TypeError(msg) from err
+ p = line.find(comments)
+ if p >= 0:
+ line = line[:p]
+ if line:
+ break
+ vlist = line.rstrip("\n").split(delimiter)
+ numb = len(vlist)
+ if numb < 1:
+ continue # isolated node
+ v = vlist.pop(0)
+ data = "".join(vlist)
+ if nodetype is not None:
+ try:
+ v = nodetype(v)
+ except BaseException as err:
+ raise TypeError(
+ f"Failed to convert node ({v}) to type {nodetype}"
+ ) from err
+ if edgetype is not None:
+ try:
+ edgedata = {"weight": edgetype(data)}
+ except BaseException as err:
+ raise TypeError(
+ f"Failed to convert edge data ({data}) to type {edgetype}"
+ ) from err
+ else:
+ try: # try to evaluate
+ edgedata = literal_eval(data)
+ except:
+ edgedata = {}
+ G.add_edge(u, v, **edgedata)
+
+ return G
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_multiline_adjlist(
+ path,
+ comments="#",
+ delimiter=None,
+ create_using=None,
+ nodetype=None,
+ edgetype=None,
+ encoding="utf-8",
+):
+ """Read graph in multi-line adjacency list format from path.
+
+ Parameters
+ ----------
+ path : string or file
+ Filename or file handle to read.
+ Filenames ending in .gz or .bz2 will be uncompressed.
+
+ create_using : NetworkX graph constructor, optional (default=nx.Graph)
+ Graph type to create. If graph instance, then cleared before populated.
+
+ nodetype : Python type, optional
+ Convert nodes to this type.
+
+ edgetype : Python type, optional
+ Convert edge data to this type.
+
+ comments : string, optional
+ Marker for comment lines
+
+ delimiter : string, optional
+ Separator for node labels. The default is whitespace.
+
+ Returns
+ -------
+ G: NetworkX graph
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_multiline_adjlist(G, "test.adjlist")
+ >>> G = nx.read_multiline_adjlist("test.adjlist")
+
+ The path can be a file or a string with the name of the file. If a
+ file s provided, it has to be opened in 'rb' mode.
+
+ >>> fh = open("test.adjlist", "rb")
+ >>> G = nx.read_multiline_adjlist(fh)
+
+ Filenames ending in .gz or .bz2 will be compressed.
+
+ >>> nx.write_multiline_adjlist(G, "test.adjlist.gz")
+ >>> G = nx.read_multiline_adjlist("test.adjlist.gz")
+
+ The optional nodetype is a function to convert node strings to nodetype.
+
+ For example
+
+ >>> G = nx.read_multiline_adjlist("test.adjlist", nodetype=int)
+
+ will attempt to convert all nodes to integer type.
+
+ The optional edgetype is a function to convert edge data strings to
+ edgetype.
+
+ >>> G = nx.read_multiline_adjlist("test.adjlist")
+
+ The optional create_using parameter is a NetworkX graph container.
+ The default is Graph(), an undirected graph. To read the data as
+ a directed graph use
+
+ >>> G = nx.read_multiline_adjlist("test.adjlist", create_using=nx.DiGraph)
+
+ Notes
+ -----
+ This format does not store graph, node, or edge data.
+
+ See Also
+ --------
+ write_multiline_adjlist
+ """
+ lines = (line.decode(encoding) for line in path)
+ return parse_multiline_adjlist(
+ lines,
+ comments=comments,
+ delimiter=delimiter,
+ create_using=create_using,
+ nodetype=nodetype,
+ edgetype=edgetype,
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/p2g.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/p2g.py
new file mode 100644
index 0000000000000000000000000000000000000000..804adb23e5296032020e7f90626ca74c9f9398f0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/p2g.py
@@ -0,0 +1,105 @@
+"""
+This module provides the following: read and write of p2g format
+used in metabolic pathway studies.
+
+See https://web.archive.org/web/20080626113807/http://www.cs.purdue.edu/homes/koyuturk/pathway/ for a description.
+
+The summary is included here:
+
+A file that describes a uniquely labeled graph (with extension ".gr")
+format looks like the following:
+
+
+name
+3 4
+a
+1 2
+b
+
+c
+0 2
+
+"name" is simply a description of what the graph corresponds to. The
+second line displays the number of nodes and number of edges,
+respectively. This sample graph contains three nodes labeled "a", "b",
+and "c". The rest of the graph contains two lines for each node. The
+first line for a node contains the node label. After the declaration
+of the node label, the out-edges of that node in the graph are
+provided. For instance, "a" is linked to nodes 1 and 2, which are
+labeled "b" and "c", while the node labeled "b" has no outgoing
+edges. Observe that node labeled "c" has an outgoing edge to
+itself. Indeed, self-loops are allowed. Node index starts from 0.
+
+"""
+
+import networkx as nx
+from networkx.utils import open_file
+
+
+@open_file(1, mode="w")
+def write_p2g(G, path, encoding="utf-8"):
+ """Write NetworkX graph in p2g format.
+
+ Notes
+ -----
+ This format is meant to be used with directed graphs with
+ possible self loops.
+ """
+ path.write((f"{G.name}\n").encode(encoding))
+ path.write((f"{G.order()} {G.size()}\n").encode(encoding))
+ nodes = list(G)
+ # make dictionary mapping nodes to integers
+ nodenumber = dict(zip(nodes, range(len(nodes))))
+ for n in nodes:
+ path.write((f"{n}\n").encode(encoding))
+ for nbr in G.neighbors(n):
+ path.write((f"{nodenumber[nbr]} ").encode(encoding))
+ path.write("\n".encode(encoding))
+
+
+@open_file(0, mode="r")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_p2g(path, encoding="utf-8"):
+ """Read graph in p2g format from path.
+
+ Returns
+ -------
+ MultiDiGraph
+
+ Notes
+ -----
+ If you want a DiGraph (with no self loops allowed and no edge data)
+ use D=nx.DiGraph(read_p2g(path))
+ """
+ lines = (line.decode(encoding) for line in path)
+ G = parse_p2g(lines)
+ return G
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def parse_p2g(lines):
+ """Parse p2g format graph from string or iterable.
+
+ Returns
+ -------
+ MultiDiGraph
+ """
+ description = next(lines).strip()
+ # are multiedges (parallel edges) allowed?
+ G = nx.MultiDiGraph(name=description, selfloops=True)
+ nnodes, nedges = map(int, next(lines).split())
+ nodelabel = {}
+ nbrs = {}
+ # loop over the nodes keeping track of node labels and out neighbors
+ # defer adding edges until all node labels are known
+ for i in range(nnodes):
+ n = next(lines).strip()
+ nodelabel[i] = n
+ G.add_node(n)
+ nbrs[n] = map(int, next(lines).split())
+ # now we know all of the node labels so we can add the edges
+ # with the correct labels
+ for n in G:
+ for nbr in nbrs[n]:
+ G.add_edge(n, nodelabel[nbr])
+ return G
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/pajek.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/pajek.py
new file mode 100644
index 0000000000000000000000000000000000000000..f148f16208de0d42fbcd52d24affeac98152e1f3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/pajek.py
@@ -0,0 +1,286 @@
+"""
+*****
+Pajek
+*****
+Read graphs in Pajek format.
+
+This implementation handles directed and undirected graphs including
+those with self loops and parallel edges.
+
+Format
+------
+See http://vlado.fmf.uni-lj.si/pub/networks/pajek/doc/draweps.htm
+for format information.
+
+"""
+
+import warnings
+
+import networkx as nx
+from networkx.utils import open_file
+
+__all__ = ["read_pajek", "parse_pajek", "generate_pajek", "write_pajek"]
+
+
+def generate_pajek(G):
+ """Generate lines in Pajek graph format.
+
+ Parameters
+ ----------
+ G : graph
+ A Networkx graph
+
+ References
+ ----------
+ See http://vlado.fmf.uni-lj.si/pub/networks/pajek/doc/draweps.htm
+ for format information.
+ """
+ if G.name == "":
+ name = "NetworkX"
+ else:
+ name = G.name
+ # Apparently many Pajek format readers can't process this line
+ # So we'll leave it out for now.
+ # yield '*network %s'%name
+
+ # write nodes with attributes
+ yield f"*vertices {G.order()}"
+ nodes = list(G)
+ # make dictionary mapping nodes to integers
+ nodenumber = dict(zip(nodes, range(1, len(nodes) + 1)))
+ for n in nodes:
+ # copy node attributes and pop mandatory attributes
+ # to avoid duplication.
+ na = G.nodes.get(n, {}).copy()
+ x = na.pop("x", 0.0)
+ y = na.pop("y", 0.0)
+ try:
+ id = int(na.pop("id", nodenumber[n]))
+ except ValueError as err:
+ err.args += (
+ (
+ "Pajek format requires 'id' to be an int()."
+ " Refer to the 'Relabeling nodes' section."
+ ),
+ )
+ raise
+ nodenumber[n] = id
+ shape = na.pop("shape", "ellipse")
+ s = " ".join(map(make_qstr, (id, n, x, y, shape)))
+ # only optional attributes are left in na.
+ for k, v in na.items():
+ if isinstance(v, str) and v.strip() != "":
+ s += f" {make_qstr(k)} {make_qstr(v)}"
+ else:
+ warnings.warn(
+ f"Node attribute {k} is not processed. {('Empty attribute' if isinstance(v, str) else 'Non-string attribute')}."
+ )
+ yield s
+
+ # write edges with attributes
+ if G.is_directed():
+ yield "*arcs"
+ else:
+ yield "*edges"
+ for u, v, edgedata in G.edges(data=True):
+ d = edgedata.copy()
+ value = d.pop("weight", 1.0) # use 1 as default edge value
+ s = " ".join(map(make_qstr, (nodenumber[u], nodenumber[v], value)))
+ for k, v in d.items():
+ if isinstance(v, str) and v.strip() != "":
+ s += f" {make_qstr(k)} {make_qstr(v)}"
+ else:
+ warnings.warn(
+ f"Edge attribute {k} is not processed. {('Empty attribute' if isinstance(v, str) else 'Non-string attribute')}."
+ )
+ yield s
+
+
+@open_file(1, mode="wb")
+def write_pajek(G, path, encoding="UTF-8"):
+ """Write graph in Pajek format to path.
+
+ Parameters
+ ----------
+ G : graph
+ A Networkx graph
+ path : file or string
+ File or filename to write.
+ Filenames ending in .gz or .bz2 will be compressed.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_pajek(G, "test.net")
+
+ Warnings
+ --------
+ Optional node attributes and edge attributes must be non-empty strings.
+ Otherwise it will not be written into the file. You will need to
+ convert those attributes to strings if you want to keep them.
+
+ References
+ ----------
+ See http://vlado.fmf.uni-lj.si/pub/networks/pajek/doc/draweps.htm
+ for format information.
+ """
+ for line in generate_pajek(G):
+ line += "\n"
+ path.write(line.encode(encoding))
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_pajek(path, encoding="UTF-8"):
+ """Read graph in Pajek format from path.
+
+ Parameters
+ ----------
+ path : file or string
+ File or filename to write.
+ Filenames ending in .gz or .bz2 will be uncompressed.
+
+ Returns
+ -------
+ G : NetworkX MultiGraph or MultiDiGraph.
+
+ Examples
+ --------
+ >>> G = nx.path_graph(4)
+ >>> nx.write_pajek(G, "test.net")
+ >>> G = nx.read_pajek("test.net")
+
+ To create a Graph instead of a MultiGraph use
+
+ >>> G1 = nx.Graph(G)
+
+ References
+ ----------
+ See http://vlado.fmf.uni-lj.si/pub/networks/pajek/doc/draweps.htm
+ for format information.
+ """
+ lines = (line.decode(encoding) for line in path)
+ return parse_pajek(lines)
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def parse_pajek(lines):
+ """Parse Pajek format graph from string or iterable.
+
+ Parameters
+ ----------
+ lines : string or iterable
+ Data in Pajek format.
+
+ Returns
+ -------
+ G : NetworkX graph
+
+ See Also
+ --------
+ read_pajek
+
+ """
+ import shlex
+
+ # multigraph=False
+ if isinstance(lines, str):
+ lines = iter(lines.split("\n"))
+ lines = iter([line.rstrip("\n") for line in lines])
+ G = nx.MultiDiGraph() # are multiedges allowed in Pajek? assume yes
+ labels = [] # in the order of the file, needed for matrix
+ while lines:
+ try:
+ l = next(lines)
+ except: # EOF
+ break
+ if l.lower().startswith("*network"):
+ try:
+ label, name = l.split(None, 1)
+ except ValueError:
+ # Line was not of the form: *network NAME
+ pass
+ else:
+ G.graph["name"] = name
+ elif l.lower().startswith("*vertices"):
+ nodelabels = {}
+ l, nnodes = l.split()
+ for i in range(int(nnodes)):
+ l = next(lines)
+ try:
+ splitline = [
+ x.decode("utf-8") for x in shlex.split(str(l).encode("utf-8"))
+ ]
+ except AttributeError:
+ splitline = shlex.split(str(l))
+ id, label = splitline[0:2]
+ labels.append(label)
+ G.add_node(label)
+ nodelabels[id] = label
+ G.nodes[label]["id"] = id
+ try:
+ x, y, shape = splitline[2:5]
+ G.nodes[label].update(
+ {"x": float(x), "y": float(y), "shape": shape}
+ )
+ except:
+ pass
+ extra_attr = zip(splitline[5::2], splitline[6::2])
+ G.nodes[label].update(extra_attr)
+ elif l.lower().startswith("*edges") or l.lower().startswith("*arcs"):
+ if l.lower().startswith("*edge"):
+ # switch from multidigraph to multigraph
+ G = nx.MultiGraph(G)
+ if l.lower().startswith("*arcs"):
+ # switch to directed with multiple arcs for each existing edge
+ G = G.to_directed()
+ for l in lines:
+ try:
+ splitline = [
+ x.decode("utf-8") for x in shlex.split(str(l).encode("utf-8"))
+ ]
+ except AttributeError:
+ splitline = shlex.split(str(l))
+
+ if len(splitline) < 2:
+ continue
+ ui, vi = splitline[0:2]
+ u = nodelabels.get(ui, ui)
+ v = nodelabels.get(vi, vi)
+ # parse the data attached to this edge and put in a dictionary
+ edge_data = {}
+ try:
+ # there should always be a single value on the edge?
+ w = splitline[2:3]
+ edge_data.update({"weight": float(w[0])})
+ except:
+ pass
+ # if there isn't, just assign a 1
+ # edge_data.update({'value':1})
+ extra_attr = zip(splitline[3::2], splitline[4::2])
+ edge_data.update(extra_attr)
+ # if G.has_edge(u,v):
+ # multigraph=True
+ G.add_edge(u, v, **edge_data)
+ elif l.lower().startswith("*matrix"):
+ G = nx.DiGraph(G)
+ adj_list = (
+ (labels[row], labels[col], {"weight": int(data)})
+ for (row, line) in enumerate(lines)
+ for (col, data) in enumerate(line.split())
+ if int(data) != 0
+ )
+ G.add_edges_from(adj_list)
+
+ return G
+
+
+def make_qstr(t):
+ """Returns the string representation of t.
+ Add outer double-quotes if the string has a space.
+ """
+ if not isinstance(t, str):
+ t = str(t)
+ if " " in t:
+ t = f'"{t}"'
+ return t
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/sparse6.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/sparse6.py
new file mode 100644
index 0000000000000000000000000000000000000000..74d16dbc27f168c52a58d357d7a5215499774767
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/sparse6.py
@@ -0,0 +1,377 @@
+# Original author: D. Eppstein, UC Irvine, August 12, 2003.
+# The original code at https://www.ics.uci.edu/~eppstein/PADS/ is public domain.
+"""Functions for reading and writing graphs in the *sparse6* format.
+
+The *sparse6* file format is a space-efficient format for large sparse
+graphs. For small graphs or large dense graphs, use the *graph6* file
+format.
+
+For more information, see the `sparse6`_ homepage.
+
+.. _sparse6: https://users.cecs.anu.edu.au/~bdm/data/formats.html
+
+"""
+
+import networkx as nx
+from networkx.exception import NetworkXError
+from networkx.readwrite.graph6 import data_to_n, n_to_data
+from networkx.utils import not_implemented_for, open_file
+
+__all__ = ["from_sparse6_bytes", "read_sparse6", "to_sparse6_bytes", "write_sparse6"]
+
+
+def _generate_sparse6_bytes(G, nodes, header):
+ """Yield bytes in the sparse6 encoding of a graph.
+
+ `G` is an undirected simple graph. `nodes` is the list of nodes for
+ which the node-induced subgraph will be encoded; if `nodes` is the
+ list of all nodes in the graph, the entire graph will be
+ encoded. `header` is a Boolean that specifies whether to generate
+ the header ``b'>>sparse6<<'`` before the remaining data.
+
+ This function generates `bytes` objects in the following order:
+
+ 1. the header (if requested),
+ 2. the encoding of the number of nodes,
+ 3. each character, one-at-a-time, in the encoding of the requested
+ node-induced subgraph,
+ 4. a newline character.
+
+ This function raises :exc:`ValueError` if the graph is too large for
+ the graph6 format (that is, greater than ``2 ** 36`` nodes).
+
+ """
+ n = len(G)
+ if n >= 2**36:
+ raise ValueError(
+ "sparse6 is only defined if number of nodes is less than 2 ** 36"
+ )
+ if header:
+ yield b">>sparse6<<"
+ yield b":"
+ for d in n_to_data(n):
+ yield str.encode(chr(d + 63))
+
+ k = 1
+ while 1 << k < n:
+ k += 1
+
+ def enc(x):
+ """Big endian k-bit encoding of x"""
+ return [1 if (x & 1 << (k - 1 - i)) else 0 for i in range(k)]
+
+ edges = sorted((max(u, v), min(u, v)) for u, v in G.edges())
+ bits = []
+ curv = 0
+ for v, u in edges:
+ if v == curv: # current vertex edge
+ bits.append(0)
+ bits.extend(enc(u))
+ elif v == curv + 1: # next vertex edge
+ curv += 1
+ bits.append(1)
+ bits.extend(enc(u))
+ else: # skip to vertex v and then add edge to u
+ curv = v
+ bits.append(1)
+ bits.extend(enc(v))
+ bits.append(0)
+ bits.extend(enc(u))
+ if k < 6 and n == (1 << k) and ((-len(bits)) % 6) >= k and curv < (n - 1):
+ # Padding special case: small k, n=2^k,
+ # more than k bits of padding needed,
+ # current vertex is not (n-1) --
+ # appending 1111... would add a loop on (n-1)
+ bits.append(0)
+ bits.extend([1] * ((-len(bits)) % 6))
+ else:
+ bits.extend([1] * ((-len(bits)) % 6))
+
+ data = [
+ (bits[i + 0] << 5)
+ + (bits[i + 1] << 4)
+ + (bits[i + 2] << 3)
+ + (bits[i + 3] << 2)
+ + (bits[i + 4] << 1)
+ + (bits[i + 5] << 0)
+ for i in range(0, len(bits), 6)
+ ]
+
+ for d in data:
+ yield str.encode(chr(d + 63))
+ yield b"\n"
+
+
+@nx._dispatchable(graphs=None, returns_graph=True)
+def from_sparse6_bytes(string):
+ """Read an undirected graph in sparse6 format from string.
+
+ Parameters
+ ----------
+ string : string
+ Data in sparse6 format
+
+ Returns
+ -------
+ G : Graph
+
+ Raises
+ ------
+ NetworkXError
+ If the string is unable to be parsed in sparse6 format
+
+ Examples
+ --------
+ >>> G = nx.from_sparse6_bytes(b":A_")
+ >>> sorted(G.edges())
+ [(0, 1), (0, 1), (0, 1)]
+
+ See Also
+ --------
+ read_sparse6, write_sparse6
+
+ References
+ ----------
+ .. [1] Sparse6 specification
+
+
+ """
+ if string.startswith(b">>sparse6<<"):
+ string = string[11:]
+ if not string.startswith(b":"):
+ raise NetworkXError("Expected leading colon in sparse6")
+
+ chars = [c - 63 for c in string[1:]]
+ n, data = data_to_n(chars)
+ k = 1
+ while 1 << k < n:
+ k += 1
+
+ def parseData():
+ """Returns stream of pairs b[i], x[i] for sparse6 format."""
+ chunks = iter(data)
+ d = None # partial data word
+ dLen = 0 # how many unparsed bits are left in d
+
+ while 1:
+ if dLen < 1:
+ try:
+ d = next(chunks)
+ except StopIteration:
+ return
+ dLen = 6
+ dLen -= 1
+ b = (d >> dLen) & 1 # grab top remaining bit
+
+ x = d & ((1 << dLen) - 1) # partially built up value of x
+ xLen = dLen # how many bits included so far in x
+ while xLen < k: # now grab full chunks until we have enough
+ try:
+ d = next(chunks)
+ except StopIteration:
+ return
+ dLen = 6
+ x = (x << 6) + d
+ xLen += 6
+ x = x >> (xLen - k) # shift back the extra bits
+ dLen = xLen - k
+ yield b, x
+
+ v = 0
+
+ G = nx.MultiGraph()
+ G.add_nodes_from(range(n))
+
+ multigraph = False
+ for b, x in parseData():
+ if b == 1:
+ v += 1
+ # padding with ones can cause overlarge number here
+ if x >= n or v >= n:
+ break
+ elif x > v:
+ v = x
+ else:
+ if G.has_edge(x, v):
+ multigraph = True
+ G.add_edge(x, v)
+ if not multigraph:
+ G = nx.Graph(G)
+ return G
+
+
+def to_sparse6_bytes(G, nodes=None, header=True):
+ """Convert an undirected graph to bytes in sparse6 format.
+
+ Parameters
+ ----------
+ G : Graph (undirected)
+
+ nodes: list or iterable
+ Nodes are labeled 0...n-1 in the order provided. If None the ordering
+ given by ``G.nodes()`` is used.
+
+ header: bool
+ If True add '>>sparse6<<' bytes to head of data.
+
+ Raises
+ ------
+ NetworkXNotImplemented
+ If the graph is directed.
+
+ ValueError
+ If the graph has at least ``2 ** 36`` nodes; the sparse6 format
+ is only defined for graphs of order less than ``2 ** 36``.
+
+ Examples
+ --------
+ >>> nx.to_sparse6_bytes(nx.path_graph(2))
+ b'>>sparse6<<:An\\n'
+
+ See Also
+ --------
+ to_sparse6_bytes, read_sparse6, write_sparse6_bytes
+
+ Notes
+ -----
+ The returned bytes end with a newline character.
+
+ The format does not support edge or node labels.
+
+ References
+ ----------
+ .. [1] Graph6 specification
+
+
+ """
+ if nodes is not None:
+ G = G.subgraph(nodes)
+ G = nx.convert_node_labels_to_integers(G, ordering="sorted")
+ return b"".join(_generate_sparse6_bytes(G, nodes, header))
+
+
+@open_file(0, mode="rb")
+@nx._dispatchable(graphs=None, returns_graph=True)
+def read_sparse6(path):
+ """Read an undirected graph in sparse6 format from path.
+
+ Parameters
+ ----------
+ path : file or string
+ File or filename to write.
+
+ Returns
+ -------
+ G : Graph/Multigraph or list of Graphs/MultiGraphs
+ If the file contains multiple lines then a list of graphs is returned
+
+ Raises
+ ------
+ NetworkXError
+ If the string is unable to be parsed in sparse6 format
+
+ Examples
+ --------
+ You can read a sparse6 file by giving the path to the file::
+
+ >>> import tempfile
+ >>> with tempfile.NamedTemporaryFile(delete=False) as f:
+ ... _ = f.write(b">>sparse6<<:An\\n")
+ ... _ = f.seek(0)
+ ... G = nx.read_sparse6(f.name)
+ >>> list(G.edges())
+ [(0, 1)]
+
+ You can also read a sparse6 file by giving an open file-like object::
+
+ >>> import tempfile
+ >>> with tempfile.NamedTemporaryFile() as f:
+ ... _ = f.write(b">>sparse6<<:An\\n")
+ ... _ = f.seek(0)
+ ... G = nx.read_sparse6(f)
+ >>> list(G.edges())
+ [(0, 1)]
+
+ See Also
+ --------
+ read_sparse6, from_sparse6_bytes
+
+ References
+ ----------
+ .. [1] Sparse6 specification
+
+
+ """
+ glist = []
+ for line in path:
+ line = line.strip()
+ if not len(line):
+ continue
+ glist.append(from_sparse6_bytes(line))
+ if len(glist) == 1:
+ return glist[0]
+ else:
+ return glist
+
+
+@not_implemented_for("directed")
+@open_file(1, mode="wb")
+def write_sparse6(G, path, nodes=None, header=True):
+ """Write graph G to given path in sparse6 format.
+
+ Parameters
+ ----------
+ G : Graph (undirected)
+
+ path : file or string
+ File or filename to write
+
+ nodes: list or iterable
+ Nodes are labeled 0...n-1 in the order provided. If None the ordering
+ given by G.nodes() is used.
+
+ header: bool
+ If True add '>>sparse6<<' string to head of data
+
+ Raises
+ ------
+ NetworkXError
+ If the graph is directed
+
+ Examples
+ --------
+ You can write a sparse6 file by giving the path to the file::
+
+ >>> import tempfile
+ >>> with tempfile.NamedTemporaryFile(delete=False) as f:
+ ... nx.write_sparse6(nx.path_graph(2), f.name)
+ ... print(f.read())
+ b'>>sparse6<<:An\\n'
+
+ You can also write a sparse6 file by giving an open file-like object::
+
+ >>> with tempfile.NamedTemporaryFile() as f:
+ ... nx.write_sparse6(nx.path_graph(2), f)
+ ... _ = f.seek(0)
+ ... print(f.read())
+ b'>>sparse6<<:An\\n'
+
+ See Also
+ --------
+ read_sparse6, from_sparse6_bytes
+
+ Notes
+ -----
+ The format does not support edge or node labels.
+
+ References
+ ----------
+ .. [1] Sparse6 specification
+
+
+ """
+ if nodes is not None:
+ G = G.subgraph(nodes)
+ G = nx.convert_node_labels_to_integers(G, ordering="sorted")
+ for b in _generate_sparse6_bytes(G, nodes, header):
+ path.write(b)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_adjlist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_adjlist.py
new file mode 100644
index 0000000000000000000000000000000000000000..f2218eba1246ae6234d6ca3ca0fdc52fa2f7a319
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_adjlist.py
@@ -0,0 +1,262 @@
+"""
+Unit tests for adjlist.
+"""
+
+import io
+
+import pytest
+
+import networkx as nx
+from networkx.utils import edges_equal, graphs_equal, nodes_equal
+
+
+class TestAdjlist:
+ @classmethod
+ def setup_class(cls):
+ cls.G = nx.Graph(name="test")
+ e = [("a", "b"), ("b", "c"), ("c", "d"), ("d", "e"), ("e", "f"), ("a", "f")]
+ cls.G.add_edges_from(e)
+ cls.G.add_node("g")
+ cls.DG = nx.DiGraph(cls.G)
+ cls.XG = nx.MultiGraph()
+ cls.XG.add_weighted_edges_from([(1, 2, 5), (1, 2, 5), (1, 2, 1), (3, 3, 42)])
+ cls.XDG = nx.MultiDiGraph(cls.XG)
+
+ def test_read_multiline_adjlist_1(self):
+ # Unit test for https://networkx.lanl.gov/trac/ticket/252
+ s = b"""# comment line
+1 2
+# comment line
+2
+3
+"""
+ bytesIO = io.BytesIO(s)
+ G = nx.read_multiline_adjlist(bytesIO)
+ adj = {"1": {"3": {}, "2": {}}, "3": {"1": {}}, "2": {"1": {}}}
+ assert graphs_equal(G, nx.Graph(adj))
+
+ def test_unicode(self, tmp_path):
+ G = nx.Graph()
+ name1 = chr(2344) + chr(123) + chr(6543)
+ name2 = chr(5543) + chr(1543) + chr(324)
+ G.add_edge(name1, "Radiohead", **{name2: 3})
+
+ fname = tmp_path / "adjlist.txt"
+ nx.write_multiline_adjlist(G, fname)
+ H = nx.read_multiline_adjlist(fname)
+ assert graphs_equal(G, H)
+
+ def test_latin1_err(self, tmp_path):
+ G = nx.Graph()
+ name1 = chr(2344) + chr(123) + chr(6543)
+ name2 = chr(5543) + chr(1543) + chr(324)
+ G.add_edge(name1, "Radiohead", **{name2: 3})
+ fname = tmp_path / "adjlist.txt"
+ with pytest.raises(UnicodeEncodeError):
+ nx.write_multiline_adjlist(G, fname, encoding="latin-1")
+
+ def test_latin1(self, tmp_path):
+ G = nx.Graph()
+ name1 = "Bj" + chr(246) + "rk"
+ name2 = chr(220) + "ber"
+ G.add_edge(name1, "Radiohead", **{name2: 3})
+ fname = tmp_path / "adjlist.txt"
+ nx.write_multiline_adjlist(G, fname, encoding="latin-1")
+ H = nx.read_multiline_adjlist(fname, encoding="latin-1")
+ assert graphs_equal(G, H)
+
+ def test_parse_adjlist(self):
+ lines = ["1 2 5", "2 3 4", "3 5", "4", "5"]
+ nx.parse_adjlist(lines, nodetype=int) # smoke test
+ with pytest.raises(TypeError):
+ nx.parse_adjlist(lines, nodetype="int")
+ lines = ["1 2 5", "2 b", "c"]
+ with pytest.raises(TypeError):
+ nx.parse_adjlist(lines, nodetype=int)
+
+ def test_adjlist_graph(self, tmp_path):
+ G = self.G
+ fname = tmp_path / "adjlist.txt"
+ nx.write_adjlist(G, fname)
+ H = nx.read_adjlist(fname)
+ H2 = nx.read_adjlist(fname)
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_adjlist_digraph(self, tmp_path):
+ G = self.DG
+ fname = tmp_path / "adjlist.txt"
+ nx.write_adjlist(G, fname)
+ H = nx.read_adjlist(fname, create_using=nx.DiGraph())
+ H2 = nx.read_adjlist(fname, create_using=nx.DiGraph())
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_adjlist_integers(self, tmp_path):
+ fname = tmp_path / "adjlist.txt"
+ G = nx.convert_node_labels_to_integers(self.G)
+ nx.write_adjlist(G, fname)
+ H = nx.read_adjlist(fname, nodetype=int)
+ H2 = nx.read_adjlist(fname, nodetype=int)
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_adjlist_multigraph(self, tmp_path):
+ G = self.XG
+ fname = tmp_path / "adjlist.txt"
+ nx.write_adjlist(G, fname)
+ H = nx.read_adjlist(fname, nodetype=int, create_using=nx.MultiGraph())
+ H2 = nx.read_adjlist(fname, nodetype=int, create_using=nx.MultiGraph())
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_adjlist_multidigraph(self, tmp_path):
+ G = self.XDG
+ fname = tmp_path / "adjlist.txt"
+ nx.write_adjlist(G, fname)
+ H = nx.read_adjlist(fname, nodetype=int, create_using=nx.MultiDiGraph())
+ H2 = nx.read_adjlist(fname, nodetype=int, create_using=nx.MultiDiGraph())
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_adjlist_delimiter(self):
+ fh = io.BytesIO()
+ G = nx.path_graph(3)
+ nx.write_adjlist(G, fh, delimiter=":")
+ fh.seek(0)
+ H = nx.read_adjlist(fh, nodetype=int, delimiter=":")
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+
+class TestMultilineAdjlist:
+ @classmethod
+ def setup_class(cls):
+ cls.G = nx.Graph(name="test")
+ e = [("a", "b"), ("b", "c"), ("c", "d"), ("d", "e"), ("e", "f"), ("a", "f")]
+ cls.G.add_edges_from(e)
+ cls.G.add_node("g")
+ cls.DG = nx.DiGraph(cls.G)
+ cls.DG.remove_edge("b", "a")
+ cls.DG.remove_edge("b", "c")
+ cls.XG = nx.MultiGraph()
+ cls.XG.add_weighted_edges_from([(1, 2, 5), (1, 2, 5), (1, 2, 1), (3, 3, 42)])
+ cls.XDG = nx.MultiDiGraph(cls.XG)
+
+ def test_parse_multiline_adjlist(self):
+ lines = [
+ "1 2",
+ "b {'weight':3, 'name': 'Frodo'}",
+ "c {}",
+ "d 1",
+ "e {'weight':6, 'name': 'Saruman'}",
+ ]
+ nx.parse_multiline_adjlist(iter(lines)) # smoke test
+ with pytest.raises(TypeError):
+ nx.parse_multiline_adjlist(iter(lines), nodetype=int)
+ nx.parse_multiline_adjlist(iter(lines), edgetype=str) # smoke test
+ with pytest.raises(TypeError):
+ nx.parse_multiline_adjlist(iter(lines), nodetype=int)
+ lines = ["1 a"]
+ with pytest.raises(TypeError):
+ nx.parse_multiline_adjlist(iter(lines))
+ lines = ["a 2"]
+ with pytest.raises(TypeError):
+ nx.parse_multiline_adjlist(iter(lines), nodetype=int)
+ lines = ["1 2"]
+ with pytest.raises(TypeError):
+ nx.parse_multiline_adjlist(iter(lines))
+ lines = ["1 2", "2 {}"]
+ with pytest.raises(TypeError):
+ nx.parse_multiline_adjlist(iter(lines))
+
+ def test_multiline_adjlist_graph(self, tmp_path):
+ G = self.G
+ fname = tmp_path / "adjlist.txt"
+ nx.write_multiline_adjlist(G, fname)
+ H = nx.read_multiline_adjlist(fname)
+ H2 = nx.read_multiline_adjlist(fname)
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_multiline_adjlist_digraph(self, tmp_path):
+ G = self.DG
+ fname = tmp_path / "adjlist.txt"
+ nx.write_multiline_adjlist(G, fname)
+ H = nx.read_multiline_adjlist(fname, create_using=nx.DiGraph())
+ H2 = nx.read_multiline_adjlist(fname, create_using=nx.DiGraph())
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_multiline_adjlist_integers(self, tmp_path):
+ fname = tmp_path / "adjlist.txt"
+ G = nx.convert_node_labels_to_integers(self.G)
+ nx.write_multiline_adjlist(G, fname)
+ H = nx.read_multiline_adjlist(fname, nodetype=int)
+ H2 = nx.read_multiline_adjlist(fname, nodetype=int)
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_multiline_adjlist_multigraph(self, tmp_path):
+ G = self.XG
+ fname = tmp_path / "adjlist.txt"
+ nx.write_multiline_adjlist(G, fname)
+ H = nx.read_multiline_adjlist(fname, nodetype=int, create_using=nx.MultiGraph())
+ H2 = nx.read_multiline_adjlist(
+ fname, nodetype=int, create_using=nx.MultiGraph()
+ )
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_multiline_adjlist_multidigraph(self, tmp_path):
+ G = self.XDG
+ fname = tmp_path / "adjlist.txt"
+ nx.write_multiline_adjlist(G, fname)
+ H = nx.read_multiline_adjlist(
+ fname, nodetype=int, create_using=nx.MultiDiGraph()
+ )
+ H2 = nx.read_multiline_adjlist(
+ fname, nodetype=int, create_using=nx.MultiDiGraph()
+ )
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_multiline_adjlist_delimiter(self):
+ fh = io.BytesIO()
+ G = nx.path_graph(3)
+ nx.write_multiline_adjlist(G, fh, delimiter=":")
+ fh.seek(0)
+ H = nx.read_multiline_adjlist(fh, nodetype=int, delimiter=":")
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+
+@pytest.mark.parametrize(
+ ("lines", "delim"),
+ (
+ (["1 2 5", "2 3 4", "3 5", "4", "5"], None), # No extra whitespace
+ (["1\t2\t5", "2\t3\t4", "3\t5", "4", "5"], "\t"), # tab-delimited
+ (
+ ["1\t2\t5", "2\t3\t4", "3\t5\t", "4\t", "5"],
+ "\t",
+ ), # tab-delimited, extra delims
+ (
+ ["1\t2\t5", "2\t3\t4", "3\t5\t\t\n", "4\t", "5"],
+ "\t",
+ ), # extra delim+newlines
+ ),
+)
+def test_adjlist_rstrip_parsing(lines, delim):
+ """Regression test related to gh-7465"""
+ expected = nx.Graph([(1, 2), (1, 5), (2, 3), (2, 4), (3, 5)])
+ nx.utils.graphs_equal(nx.parse_adjlist(lines, delimiter=delim), expected)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_edgelist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_edgelist.py
new file mode 100644
index 0000000000000000000000000000000000000000..fe58b3b7dd193d87be04304f46ea21be34e40bfb
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_edgelist.py
@@ -0,0 +1,314 @@
+"""
+Unit tests for edgelists.
+"""
+
+import io
+import textwrap
+
+import pytest
+
+import networkx as nx
+from networkx.utils import edges_equal, graphs_equal, nodes_equal
+
+edges_no_data = textwrap.dedent(
+ """
+ # comment line
+ 1 2
+ # comment line
+ 2 3
+ """
+)
+
+
+edges_with_values = textwrap.dedent(
+ """
+ # comment line
+ 1 2 2.0
+ # comment line
+ 2 3 3.0
+ """
+)
+
+
+edges_with_weight = textwrap.dedent(
+ """
+ # comment line
+ 1 2 {'weight':2.0}
+ # comment line
+ 2 3 {'weight':3.0}
+ """
+)
+
+
+edges_with_multiple_attrs = textwrap.dedent(
+ """
+ # comment line
+ 1 2 {'weight':2.0, 'color':'green'}
+ # comment line
+ 2 3 {'weight':3.0, 'color':'red'}
+ """
+)
+
+
+edges_with_multiple_attrs_csv = textwrap.dedent(
+ """
+ # comment line
+ 1, 2, {'weight':2.0, 'color':'green'}
+ # comment line
+ 2, 3, {'weight':3.0, 'color':'red'}
+ """
+)
+
+
+_expected_edges_weights = [(1, 2, {"weight": 2.0}), (2, 3, {"weight": 3.0})]
+_expected_edges_multiattr = [
+ (1, 2, {"weight": 2.0, "color": "green"}),
+ (2, 3, {"weight": 3.0, "color": "red"}),
+]
+
+
+@pytest.mark.parametrize(
+ ("data", "extra_kwargs"),
+ (
+ (edges_no_data, {}),
+ (edges_with_values, {}),
+ (edges_with_weight, {}),
+ (edges_with_multiple_attrs, {}),
+ (edges_with_multiple_attrs_csv, {"delimiter": ","}),
+ ),
+)
+def test_read_edgelist_no_data(data, extra_kwargs):
+ bytesIO = io.BytesIO(data.encode("utf-8"))
+ G = nx.read_edgelist(bytesIO, nodetype=int, data=False, **extra_kwargs)
+ assert edges_equal(G.edges(), [(1, 2), (2, 3)])
+
+
+def test_read_weighted_edgelist():
+ bytesIO = io.BytesIO(edges_with_values.encode("utf-8"))
+ G = nx.read_weighted_edgelist(bytesIO, nodetype=int)
+ assert edges_equal(G.edges(data=True), _expected_edges_weights)
+
+
+@pytest.mark.parametrize(
+ ("data", "extra_kwargs", "expected"),
+ (
+ (edges_with_weight, {}, _expected_edges_weights),
+ (edges_with_multiple_attrs, {}, _expected_edges_multiattr),
+ (edges_with_multiple_attrs_csv, {"delimiter": ","}, _expected_edges_multiattr),
+ ),
+)
+def test_read_edgelist_with_data(data, extra_kwargs, expected):
+ bytesIO = io.BytesIO(data.encode("utf-8"))
+ G = nx.read_edgelist(bytesIO, nodetype=int, **extra_kwargs)
+ assert edges_equal(G.edges(data=True), expected)
+
+
+@pytest.fixture
+def example_graph():
+ G = nx.Graph()
+ G.add_weighted_edges_from([(1, 2, 3.0), (2, 3, 27.0), (3, 4, 3.0)])
+ return G
+
+
+def test_parse_edgelist_no_data(example_graph):
+ G = example_graph
+ H = nx.parse_edgelist(["1 2", "2 3", "3 4"], nodetype=int)
+ assert nodes_equal(G.nodes, H.nodes)
+ assert edges_equal(G.edges, H.edges)
+
+
+def test_parse_edgelist_with_data_dict(example_graph):
+ G = example_graph
+ H = nx.parse_edgelist(
+ ["1 2 {'weight': 3}", "2 3 {'weight': 27}", "3 4 {'weight': 3.0}"], nodetype=int
+ )
+ assert nodes_equal(G.nodes, H.nodes)
+ assert edges_equal(G.edges(data=True), H.edges(data=True))
+
+
+def test_parse_edgelist_with_data_list(example_graph):
+ G = example_graph
+ H = nx.parse_edgelist(
+ ["1 2 3", "2 3 27", "3 4 3.0"], nodetype=int, data=(("weight", float),)
+ )
+ assert nodes_equal(G.nodes, H.nodes)
+ assert edges_equal(G.edges(data=True), H.edges(data=True))
+
+
+def test_parse_edgelist():
+ # ignore lines with less than 2 nodes
+ lines = ["1;2", "2 3", "3 4"]
+ G = nx.parse_edgelist(lines, nodetype=int)
+ assert list(G.edges()) == [(2, 3), (3, 4)]
+ # unknown nodetype
+ with pytest.raises(TypeError, match="Failed to convert nodes"):
+ lines = ["1 2", "2 3", "3 4"]
+ nx.parse_edgelist(lines, nodetype="nope")
+ # lines have invalid edge format
+ with pytest.raises(TypeError, match="Failed to convert edge data"):
+ lines = ["1 2 3", "2 3", "3 4"]
+ nx.parse_edgelist(lines, nodetype=int)
+ # edge data and data_keys not the same length
+ with pytest.raises(IndexError, match="not the same length"):
+ lines = ["1 2 3", "2 3 27", "3 4 3.0"]
+ nx.parse_edgelist(
+ lines, nodetype=int, data=(("weight", float), ("capacity", int))
+ )
+ # edge data can't be converted to edge type
+ with pytest.raises(TypeError, match="Failed to convert"):
+ lines = ["1 2 't1'", "2 3 't3'", "3 4 't3'"]
+ nx.parse_edgelist(lines, nodetype=int, data=(("weight", float),))
+
+
+def test_comments_None():
+ edgelist = ["node#1 node#2", "node#2 node#3"]
+ # comments=None supported to ignore all comment characters
+ G = nx.parse_edgelist(edgelist, comments=None)
+ H = nx.Graph([e.split(" ") for e in edgelist])
+ assert edges_equal(G.edges, H.edges)
+
+
+class TestEdgelist:
+ @classmethod
+ def setup_class(cls):
+ cls.G = nx.Graph(name="test")
+ e = [("a", "b"), ("b", "c"), ("c", "d"), ("d", "e"), ("e", "f"), ("a", "f")]
+ cls.G.add_edges_from(e)
+ cls.G.add_node("g")
+ cls.DG = nx.DiGraph(cls.G)
+ cls.XG = nx.MultiGraph()
+ cls.XG.add_weighted_edges_from([(1, 2, 5), (1, 2, 5), (1, 2, 1), (3, 3, 42)])
+ cls.XDG = nx.MultiDiGraph(cls.XG)
+
+ def test_write_edgelist_1(self):
+ fh = io.BytesIO()
+ G = nx.Graph()
+ G.add_edges_from([(1, 2), (2, 3)])
+ nx.write_edgelist(G, fh, data=False)
+ fh.seek(0)
+ assert fh.read() == b"1 2\n2 3\n"
+
+ def test_write_edgelist_2(self):
+ fh = io.BytesIO()
+ G = nx.Graph()
+ G.add_edges_from([(1, 2), (2, 3)])
+ nx.write_edgelist(G, fh, data=True)
+ fh.seek(0)
+ assert fh.read() == b"1 2 {}\n2 3 {}\n"
+
+ def test_write_edgelist_3(self):
+ fh = io.BytesIO()
+ G = nx.Graph()
+ G.add_edge(1, 2, weight=2.0)
+ G.add_edge(2, 3, weight=3.0)
+ nx.write_edgelist(G, fh, data=True)
+ fh.seek(0)
+ assert fh.read() == b"1 2 {'weight': 2.0}\n2 3 {'weight': 3.0}\n"
+
+ def test_write_edgelist_4(self):
+ fh = io.BytesIO()
+ G = nx.Graph()
+ G.add_edge(1, 2, weight=2.0)
+ G.add_edge(2, 3, weight=3.0)
+ nx.write_edgelist(G, fh, data=[("weight")])
+ fh.seek(0)
+ assert fh.read() == b"1 2 2.0\n2 3 3.0\n"
+
+ def test_unicode(self, tmp_path):
+ G = nx.Graph()
+ name1 = chr(2344) + chr(123) + chr(6543)
+ name2 = chr(5543) + chr(1543) + chr(324)
+ G.add_edge(name1, "Radiohead", **{name2: 3})
+ fname = tmp_path / "el.txt"
+ nx.write_edgelist(G, fname)
+ H = nx.read_edgelist(fname)
+ assert graphs_equal(G, H)
+
+ def test_latin1_issue(self, tmp_path):
+ G = nx.Graph()
+ name1 = chr(2344) + chr(123) + chr(6543)
+ name2 = chr(5543) + chr(1543) + chr(324)
+ G.add_edge(name1, "Radiohead", **{name2: 3})
+ fname = tmp_path / "el.txt"
+ with pytest.raises(UnicodeEncodeError):
+ nx.write_edgelist(G, fname, encoding="latin-1")
+
+ def test_latin1(self, tmp_path):
+ G = nx.Graph()
+ name1 = "Bj" + chr(246) + "rk"
+ name2 = chr(220) + "ber"
+ G.add_edge(name1, "Radiohead", **{name2: 3})
+ fname = tmp_path / "el.txt"
+
+ nx.write_edgelist(G, fname, encoding="latin-1")
+ H = nx.read_edgelist(fname, encoding="latin-1")
+ assert graphs_equal(G, H)
+
+ def test_edgelist_graph(self, tmp_path):
+ G = self.G
+ fname = tmp_path / "el.txt"
+ nx.write_edgelist(G, fname)
+ H = nx.read_edgelist(fname)
+ H2 = nx.read_edgelist(fname)
+ assert H is not H2 # they should be different graphs
+ G.remove_node("g") # isolated nodes are not written in edgelist
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_edgelist_digraph(self, tmp_path):
+ G = self.DG
+ fname = tmp_path / "el.txt"
+ nx.write_edgelist(G, fname)
+ H = nx.read_edgelist(fname, create_using=nx.DiGraph())
+ H2 = nx.read_edgelist(fname, create_using=nx.DiGraph())
+ assert H is not H2 # they should be different graphs
+ G.remove_node("g") # isolated nodes are not written in edgelist
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_edgelist_integers(self, tmp_path):
+ G = nx.convert_node_labels_to_integers(self.G)
+ fname = tmp_path / "el.txt"
+ nx.write_edgelist(G, fname)
+ H = nx.read_edgelist(fname, nodetype=int)
+ # isolated nodes are not written in edgelist
+ G.remove_nodes_from(list(nx.isolates(G)))
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_edgelist_multigraph(self, tmp_path):
+ G = self.XG
+ fname = tmp_path / "el.txt"
+ nx.write_edgelist(G, fname)
+ H = nx.read_edgelist(fname, nodetype=int, create_using=nx.MultiGraph())
+ H2 = nx.read_edgelist(fname, nodetype=int, create_using=nx.MultiGraph())
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+ def test_edgelist_multidigraph(self, tmp_path):
+ G = self.XDG
+ fname = tmp_path / "el.txt"
+ nx.write_edgelist(G, fname)
+ H = nx.read_edgelist(fname, nodetype=int, create_using=nx.MultiDiGraph())
+ H2 = nx.read_edgelist(fname, nodetype=int, create_using=nx.MultiDiGraph())
+ assert H is not H2 # they should be different graphs
+ assert nodes_equal(list(H), list(G))
+ assert edges_equal(list(H.edges()), list(G.edges()))
+
+
+def test_edgelist_consistent_strip_handling():
+ """See gh-7462
+
+ Input when printed looks like::
+
+ 1 2 3
+ 2 3
+ 3 4 3.0
+
+ Note the trailing \\t after the `3` in the second row, indicating an empty
+ data value.
+ """
+ s = io.StringIO("1\t2\t3\n2\t3\t\n3\t4\t3.0")
+ G = nx.parse_edgelist(s, delimiter="\t", nodetype=int, data=[("value", str)])
+ assert sorted(G.edges(data="value")) == [(1, 2, "3"), (2, 3, ""), (3, 4, "3.0")]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_gexf.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_gexf.py
new file mode 100644
index 0000000000000000000000000000000000000000..6ff14c99b1d5df41003b705b840a0968e0439239
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_gexf.py
@@ -0,0 +1,557 @@
+import io
+import time
+
+import pytest
+
+import networkx as nx
+
+
+class TestGEXF:
+ @classmethod
+ def setup_class(cls):
+ cls.simple_directed_data = """
+
+
+
+
+
+
+
+
+
+
+
+"""
+ cls.simple_directed_graph = nx.DiGraph()
+ cls.simple_directed_graph.add_node("0", label="Hello")
+ cls.simple_directed_graph.add_node("1", label="World")
+ cls.simple_directed_graph.add_edge("0", "1", id="0")
+
+ cls.simple_directed_fh = io.BytesIO(cls.simple_directed_data.encode("UTF-8"))
+
+ cls.attribute_data = """\
+
+
+ Gephi.org
+ A Web network
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+ cls.attribute_graph = nx.DiGraph()
+ cls.attribute_graph.graph["node_default"] = {"frog": True}
+ cls.attribute_graph.add_node(
+ "0", label="Gephi", url="https://gephi.org", indegree=1, frog=False
+ )
+ cls.attribute_graph.add_node(
+ "1", label="Webatlas", url="http://webatlas.fr", indegree=2, frog=False
+ )
+ cls.attribute_graph.add_node(
+ "2", label="RTGI", url="http://rtgi.fr", indegree=1, frog=True
+ )
+ cls.attribute_graph.add_node(
+ "3",
+ label="BarabasiLab",
+ url="http://barabasilab.com",
+ indegree=1,
+ frog=True,
+ )
+ cls.attribute_graph.add_edge("0", "1", id="0", label="foo")
+ cls.attribute_graph.add_edge("0", "2", id="1")
+ cls.attribute_graph.add_edge("1", "0", id="2")
+ cls.attribute_graph.add_edge("2", "1", id="3")
+ cls.attribute_graph.add_edge("0", "3", id="4")
+ cls.attribute_fh = io.BytesIO(cls.attribute_data.encode("UTF-8"))
+
+ cls.simple_undirected_data = """
+
+
+
+
+
+
+
+
+
+
+
+"""
+ cls.simple_undirected_graph = nx.Graph()
+ cls.simple_undirected_graph.add_node("0", label="Hello")
+ cls.simple_undirected_graph.add_node("1", label="World")
+ cls.simple_undirected_graph.add_edge("0", "1", id="0")
+
+ cls.simple_undirected_fh = io.BytesIO(
+ cls.simple_undirected_data.encode("UTF-8")
+ )
+
+ def test_read_simple_directed_graphml(self):
+ G = self.simple_directed_graph
+ H = nx.read_gexf(self.simple_directed_fh)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(G.edges()) == sorted(H.edges())
+ assert sorted(G.edges(data=True)) == sorted(H.edges(data=True))
+ self.simple_directed_fh.seek(0)
+
+ def test_write_read_simple_directed_graphml(self):
+ G = self.simple_directed_graph
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(G.edges()) == sorted(H.edges())
+ assert sorted(G.edges(data=True)) == sorted(H.edges(data=True))
+ self.simple_directed_fh.seek(0)
+
+ def test_read_simple_undirected_graphml(self):
+ G = self.simple_undirected_graph
+ H = nx.read_gexf(self.simple_undirected_fh)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
+ self.simple_undirected_fh.seek(0)
+
+ def test_read_attribute_graphml(self):
+ G = self.attribute_graph
+ H = nx.read_gexf(self.attribute_fh)
+ assert sorted(G.nodes(True)) == sorted(H.nodes(data=True))
+ ge = sorted(G.edges(data=True))
+ he = sorted(H.edges(data=True))
+ for a, b in zip(ge, he):
+ assert a == b
+ self.attribute_fh.seek(0)
+
+ def test_directed_edge_in_undirected(self):
+ s = """
+
+
+
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ pytest.raises(nx.NetworkXError, nx.read_gexf, fh)
+
+ def test_undirected_edge_in_directed(self):
+ s = """
+
+
+
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ pytest.raises(nx.NetworkXError, nx.read_gexf, fh)
+
+ def test_key_raises(self):
+ s = """
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ pytest.raises(nx.NetworkXError, nx.read_gexf, fh)
+
+ def test_relabel(self):
+ s = """
+
+
+
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ G = nx.read_gexf(fh, relabel=True)
+ assert sorted(G.nodes()) == ["Hello", "Word"]
+
+ def test_default_attribute(self):
+ G = nx.Graph()
+ G.add_node(1, label="1", color="green")
+ nx.add_path(G, [0, 1, 2, 3])
+ G.add_edge(1, 2, foo=3)
+ G.graph["node_default"] = {"color": "yellow"}
+ G.graph["edge_default"] = {"foo": 7}
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
+ # Reading a gexf graph always sets mode attribute to either
+ # 'static' or 'dynamic'. Remove the mode attribute from the
+ # read graph for the sake of comparing remaining attributes.
+ del H.graph["mode"]
+ assert G.graph == H.graph
+
+ def test_serialize_ints_to_strings(self):
+ G = nx.Graph()
+ G.add_node(1, id=7, label=77)
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert list(H) == [7]
+ assert H.nodes[7]["label"] == "77"
+
+ def test_write_with_node_attributes(self):
+ # Addresses #673.
+ G = nx.Graph()
+ G.add_edges_from([(0, 1), (1, 2), (2, 3)])
+ for i in range(4):
+ G.nodes[i]["id"] = i
+ G.nodes[i]["label"] = i
+ G.nodes[i]["pid"] = i
+ G.nodes[i]["start"] = i
+ G.nodes[i]["end"] = i + 1
+
+ expected = f"""
+
+ NetworkX {nx.__version__}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+ obtained = "\n".join(nx.generate_gexf(G))
+ assert expected == obtained
+
+ def test_edge_id_construct(self):
+ G = nx.Graph()
+ G.add_edges_from([(0, 1, {"id": 0}), (1, 2, {"id": 2}), (2, 3)])
+
+ expected = f"""
+
+ NetworkX {nx.__version__}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+
+ obtained = "\n".join(nx.generate_gexf(G))
+ assert expected == obtained
+
+ def test_numpy_type(self):
+ np = pytest.importorskip("numpy")
+ G = nx.path_graph(4)
+ nx.set_node_attributes(G, {n: n for n in np.arange(4)}, "number")
+ G[0][1]["edge-number"] = np.float64(1.1)
+
+ expected = f"""
+
+ NetworkX {nx.__version__}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+ obtained = "\n".join(nx.generate_gexf(G))
+ assert expected == obtained
+
+ def test_bool(self):
+ G = nx.Graph()
+ G.add_node(1, testattr=True)
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert H.nodes[1]["testattr"]
+
+ # Test for NaN, INF and -INF
+ def test_specials(self):
+ from math import isnan
+
+ inf, nan = float("inf"), float("nan")
+ G = nx.Graph()
+ G.add_node(1, testattr=inf, strdata="inf", key="a")
+ G.add_node(2, testattr=nan, strdata="nan", key="b")
+ G.add_node(3, testattr=-inf, strdata="-inf", key="c")
+
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ filetext = fh.read()
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+
+ assert b"INF" in filetext
+ assert b"NaN" in filetext
+ assert b"-INF" in filetext
+
+ assert H.nodes[1]["testattr"] == inf
+ assert isnan(H.nodes[2]["testattr"])
+ assert H.nodes[3]["testattr"] == -inf
+
+ assert H.nodes[1]["strdata"] == "inf"
+ assert H.nodes[2]["strdata"] == "nan"
+ assert H.nodes[3]["strdata"] == "-inf"
+
+ assert H.nodes[1]["networkx_key"] == "a"
+ assert H.nodes[2]["networkx_key"] == "b"
+ assert H.nodes[3]["networkx_key"] == "c"
+
+ def test_simple_list(self):
+ G = nx.Graph()
+ list_value = [(1, 2, 3), (9, 1, 2)]
+ G.add_node(1, key=list_value)
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert H.nodes[1]["networkx_key"] == list_value
+
+ def test_dynamic_mode(self):
+ G = nx.Graph()
+ G.add_node(1, label="1", color="green")
+ G.graph["mode"] = "dynamic"
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
+
+ def test_multigraph_with_missing_attributes(self):
+ G = nx.MultiGraph()
+ G.add_node(0, label="1", color="green")
+ G.add_node(1, label="2", color="green")
+ G.add_edge(0, 1, id="0", weight=3, type="undirected", start=0, end=1)
+ G.add_edge(0, 1, id="1", label="foo", start=0, end=1)
+ G.add_edge(0, 1)
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
+
+ def test_missing_viz_attributes(self):
+ G = nx.Graph()
+ G.add_node(0, label="1", color="green")
+ G.nodes[0]["viz"] = {"size": 54}
+ G.nodes[0]["viz"]["position"] = {"x": 0, "y": 1, "z": 0}
+ G.nodes[0]["viz"]["color"] = {"r": 0, "g": 0, "b": 256}
+ G.nodes[0]["viz"]["shape"] = "http://random.url"
+ G.nodes[0]["viz"]["thickness"] = 2
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh, version="1.1draft")
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
+
+ # Test missing alpha value for version >draft1.1 - set default alpha value
+ # to 1.0 instead of `None` when writing for better general compatibility
+ fh = io.BytesIO()
+ # G.nodes[0]["viz"]["color"] does not have an alpha value explicitly defined
+ # so the default is used instead
+ nx.write_gexf(G, fh, version="1.2draft")
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert H.nodes[0]["viz"]["color"]["a"] == 1.0
+
+ # Second graph for the other branch
+ G = nx.Graph()
+ G.add_node(0, label="1", color="green")
+ G.nodes[0]["viz"] = {"size": 54}
+ G.nodes[0]["viz"]["position"] = {"x": 0, "y": 1, "z": 0}
+ G.nodes[0]["viz"]["color"] = {"r": 0, "g": 0, "b": 256, "a": 0.5}
+ G.nodes[0]["viz"]["shape"] = "ftp://random.url"
+ G.nodes[0]["viz"]["thickness"] = 2
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
+
+ def test_slice_and_spell(self):
+ # Test spell first, so version = 1.2
+ G = nx.Graph()
+ G.add_node(0, label="1", color="green")
+ G.nodes[0]["spells"] = [(1, 2)]
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
+
+ G = nx.Graph()
+ G.add_node(0, label="1", color="green")
+ G.nodes[0]["slices"] = [(1, 2)]
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh, version="1.1draft")
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
+
+ def test_add_parent(self):
+ G = nx.Graph()
+ G.add_node(0, label="1", color="green", parents=[1, 2])
+ fh = io.BytesIO()
+ nx.write_gexf(G, fh)
+ fh.seek(0)
+ H = nx.read_gexf(fh, node_type=int)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(sorted(e) for e in G.edges()) == sorted(
+ sorted(e) for e in H.edges()
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_gml.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_gml.py
new file mode 100644
index 0000000000000000000000000000000000000000..f575ad269cf33c940a204aed398460a420550cc7
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_gml.py
@@ -0,0 +1,744 @@
+import codecs
+import io
+import math
+from ast import literal_eval
+from contextlib import contextmanager
+from textwrap import dedent
+
+import pytest
+
+import networkx as nx
+from networkx.readwrite.gml import literal_destringizer, literal_stringizer
+
+
+class TestGraph:
+ @classmethod
+ def setup_class(cls):
+ cls.simple_data = """Creator "me"
+Version "xx"
+graph [
+ comment "This is a sample graph"
+ directed 1
+ IsPlanar 1
+ pos [ x 0 y 1 ]
+ node [
+ id 1
+ label "Node 1"
+ pos [ x 1 y 1 ]
+ ]
+ node [
+ id 2
+ pos [ x 1 y 2 ]
+ label "Node 2"
+ ]
+ node [
+ id 3
+ label "Node 3"
+ pos [ x 1 y 3 ]
+ ]
+ edge [
+ source 1
+ target 2
+ label "Edge from node 1 to node 2"
+ color [line "blue" thickness 3]
+
+ ]
+ edge [
+ source 2
+ target 3
+ label "Edge from node 2 to node 3"
+ ]
+ edge [
+ source 3
+ target 1
+ label "Edge from node 3 to node 1"
+ ]
+]
+"""
+
+ def test_parse_gml_cytoscape_bug(self):
+ # example from issue #321, originally #324 in trac
+ cytoscape_example = """
+Creator "Cytoscape"
+Version 1.0
+graph [
+ node [
+ root_index -3
+ id -3
+ graphics [
+ x -96.0
+ y -67.0
+ w 40.0
+ h 40.0
+ fill "#ff9999"
+ type "ellipse"
+ outline "#666666"
+ outline_width 1.5
+ ]
+ label "node2"
+ ]
+ node [
+ root_index -2
+ id -2
+ graphics [
+ x 63.0
+ y 37.0
+ w 40.0
+ h 40.0
+ fill "#ff9999"
+ type "ellipse"
+ outline "#666666"
+ outline_width 1.5
+ ]
+ label "node1"
+ ]
+ node [
+ root_index -1
+ id -1
+ graphics [
+ x -31.0
+ y -17.0
+ w 40.0
+ h 40.0
+ fill "#ff9999"
+ type "ellipse"
+ outline "#666666"
+ outline_width 1.5
+ ]
+ label "node0"
+ ]
+ edge [
+ root_index -2
+ target -2
+ source -1
+ graphics [
+ width 1.5
+ fill "#0000ff"
+ type "line"
+ Line [
+ ]
+ source_arrow 0
+ target_arrow 3
+ ]
+ label "DirectedEdge"
+ ]
+ edge [
+ root_index -1
+ target -1
+ source -3
+ graphics [
+ width 1.5
+ fill "#0000ff"
+ type "line"
+ Line [
+ ]
+ source_arrow 0
+ target_arrow 3
+ ]
+ label "DirectedEdge"
+ ]
+]
+"""
+ nx.parse_gml(cytoscape_example)
+
+ def test_parse_gml(self):
+ G = nx.parse_gml(self.simple_data, label="label")
+ assert sorted(G.nodes()) == ["Node 1", "Node 2", "Node 3"]
+ assert sorted(G.edges()) == [
+ ("Node 1", "Node 2"),
+ ("Node 2", "Node 3"),
+ ("Node 3", "Node 1"),
+ ]
+
+ assert sorted(G.edges(data=True)) == [
+ (
+ "Node 1",
+ "Node 2",
+ {
+ "color": {"line": "blue", "thickness": 3},
+ "label": "Edge from node 1 to node 2",
+ },
+ ),
+ ("Node 2", "Node 3", {"label": "Edge from node 2 to node 3"}),
+ ("Node 3", "Node 1", {"label": "Edge from node 3 to node 1"}),
+ ]
+
+ def test_read_gml(self, tmp_path):
+ fname = tmp_path / "test.gml"
+ with open(fname, "w") as fh:
+ fh.write(self.simple_data)
+ Gin = nx.read_gml(fname, label="label")
+ G = nx.parse_gml(self.simple_data, label="label")
+ assert sorted(G.nodes(data=True)) == sorted(Gin.nodes(data=True))
+ assert sorted(G.edges(data=True)) == sorted(Gin.edges(data=True))
+
+ def test_labels_are_strings(self):
+ # GML requires labels to be strings (i.e., in quotes)
+ answer = """graph [
+ node [
+ id 0
+ label "1203"
+ ]
+]"""
+ G = nx.Graph()
+ G.add_node(1203)
+ data = "\n".join(nx.generate_gml(G, stringizer=literal_stringizer))
+ assert data == answer
+
+ def test_relabel_duplicate(self):
+ data = """
+graph
+[
+ label ""
+ directed 1
+ node
+ [
+ id 0
+ label "same"
+ ]
+ node
+ [
+ id 1
+ label "same"
+ ]
+]
+"""
+ fh = io.BytesIO(data.encode("UTF-8"))
+ fh.seek(0)
+ pytest.raises(nx.NetworkXError, nx.read_gml, fh, label="label")
+
+ @pytest.mark.parametrize("stringizer", (None, literal_stringizer))
+ def test_tuplelabels(self, stringizer):
+ # https://github.com/networkx/networkx/pull/1048
+ # Writing tuple labels to GML failed.
+ G = nx.Graph()
+ G.add_edge((0, 1), (1, 0))
+ data = "\n".join(nx.generate_gml(G, stringizer=stringizer))
+ answer = """graph [
+ node [
+ id 0
+ label "(0,1)"
+ ]
+ node [
+ id 1
+ label "(1,0)"
+ ]
+ edge [
+ source 0
+ target 1
+ ]
+]"""
+ assert data == answer
+
+ def test_quotes(self, tmp_path):
+ # https://github.com/networkx/networkx/issues/1061
+ # Encoding quotes as HTML entities.
+ G = nx.path_graph(1)
+ G.name = "path_graph(1)"
+ attr = 'This is "quoted" and this is a copyright: ' + chr(169)
+ G.nodes[0]["demo"] = attr
+ with open(tmp_path / "test.gml", "w+b") as fobj:
+ nx.write_gml(G, fobj)
+ fobj.seek(0)
+ # Should be bytes in 2.x and 3.x
+ data = fobj.read().strip().decode("ascii")
+ answer = """graph [
+ name "path_graph(1)"
+ node [
+ id 0
+ label "0"
+ demo "This is "quoted" and this is a copyright: ©"
+ ]
+]"""
+ assert data == answer
+
+ def test_unicode_node(self, tmp_path):
+ node = "node" + chr(169)
+ G = nx.Graph()
+ G.add_node(node)
+ with open(tmp_path / "test.gml", "w+b") as fobj:
+ nx.write_gml(G, fobj)
+ fobj.seek(0)
+ # Should be bytes in 2.x and 3.x
+ data = fobj.read().strip().decode("ascii")
+ answer = """graph [
+ node [
+ id 0
+ label "node©"
+ ]
+]"""
+ assert data == answer
+
+ def test_float_label(self, tmp_path):
+ node = 1.0
+ G = nx.Graph()
+ G.add_node(node)
+ with open(tmp_path / "test.gml", "w+b") as fobj:
+ nx.write_gml(G, fobj)
+ fobj.seek(0)
+ # Should be bytes in 2.x and 3.x
+ data = fobj.read().strip().decode("ascii")
+ answer = """graph [
+ node [
+ id 0
+ label "1.0"
+ ]
+]"""
+ assert data == answer
+
+ def test_special_float_label(self, tmp_path):
+ special_floats = [float("nan"), float("+inf"), float("-inf")]
+ try:
+ import numpy as np
+
+ special_floats += [np.nan, np.inf, np.inf * -1]
+ except ImportError:
+ special_floats += special_floats
+
+ G = nx.cycle_graph(len(special_floats))
+ attrs = dict(enumerate(special_floats))
+ nx.set_node_attributes(G, attrs, "nodefloat")
+ edges = list(G.edges)
+ attrs = {edges[i]: value for i, value in enumerate(special_floats)}
+ nx.set_edge_attributes(G, attrs, "edgefloat")
+
+ with open(tmp_path / "test.gml", "w+b") as fobj:
+ nx.write_gml(G, fobj)
+ fobj.seek(0)
+ # Should be bytes in 2.x and 3.x
+ data = fobj.read().strip().decode("ascii")
+ answer = """graph [
+ node [
+ id 0
+ label "0"
+ nodefloat NAN
+ ]
+ node [
+ id 1
+ label "1"
+ nodefloat +INF
+ ]
+ node [
+ id 2
+ label "2"
+ nodefloat -INF
+ ]
+ node [
+ id 3
+ label "3"
+ nodefloat NAN
+ ]
+ node [
+ id 4
+ label "4"
+ nodefloat +INF
+ ]
+ node [
+ id 5
+ label "5"
+ nodefloat -INF
+ ]
+ edge [
+ source 0
+ target 1
+ edgefloat NAN
+ ]
+ edge [
+ source 0
+ target 5
+ edgefloat +INF
+ ]
+ edge [
+ source 1
+ target 2
+ edgefloat -INF
+ ]
+ edge [
+ source 2
+ target 3
+ edgefloat NAN
+ ]
+ edge [
+ source 3
+ target 4
+ edgefloat +INF
+ ]
+ edge [
+ source 4
+ target 5
+ edgefloat -INF
+ ]
+]"""
+ assert data == answer
+
+ fobj.seek(0)
+ graph = nx.read_gml(fobj)
+ for indx, value in enumerate(special_floats):
+ node_value = graph.nodes[str(indx)]["nodefloat"]
+ if math.isnan(value):
+ assert math.isnan(node_value)
+ else:
+ assert node_value == value
+
+ edge = edges[indx]
+ string_edge = (str(edge[0]), str(edge[1]))
+ edge_value = graph.edges[string_edge]["edgefloat"]
+ if math.isnan(value):
+ assert math.isnan(edge_value)
+ else:
+ assert edge_value == value
+
+ def test_name(self):
+ G = nx.parse_gml('graph [ name "x" node [ id 0 label "x" ] ]')
+ assert "x" == G.graph["name"]
+ G = nx.parse_gml('graph [ node [ id 0 label "x" ] ]')
+ assert "" == G.name
+ assert "name" not in G.graph
+
+ def test_graph_types(self):
+ for directed in [None, False, True]:
+ for multigraph in [None, False, True]:
+ gml = "graph ["
+ if directed is not None:
+ gml += " directed " + str(int(directed))
+ if multigraph is not None:
+ gml += " multigraph " + str(int(multigraph))
+ gml += ' node [ id 0 label "0" ]'
+ gml += " edge [ source 0 target 0 ]"
+ gml += " ]"
+ G = nx.parse_gml(gml)
+ assert bool(directed) == G.is_directed()
+ assert bool(multigraph) == G.is_multigraph()
+ gml = "graph [\n"
+ if directed is True:
+ gml += " directed 1\n"
+ if multigraph is True:
+ gml += " multigraph 1\n"
+ gml += """ node [
+ id 0
+ label "0"
+ ]
+ edge [
+ source 0
+ target 0
+"""
+ if multigraph:
+ gml += " key 0\n"
+ gml += " ]\n]"
+ assert gml == "\n".join(nx.generate_gml(G))
+
+ def test_data_types(self):
+ data = [
+ True,
+ False,
+ 10**20,
+ -2e33,
+ "'",
+ '"&&&""',
+ [{(b"\xfd",): "\x7f", chr(0x4444): (1, 2)}, (2, "3")],
+ ]
+ data.append(chr(0x14444))
+ data.append(literal_eval("{2.3j, 1 - 2.3j, ()}"))
+ G = nx.Graph()
+ G.name = data
+ G.graph["data"] = data
+ G.add_node(0, int=-1, data={"data": data})
+ G.add_edge(0, 0, float=-2.5, data=data)
+ gml = "\n".join(nx.generate_gml(G, stringizer=literal_stringizer))
+ G = nx.parse_gml(gml, destringizer=literal_destringizer)
+ assert data == G.name
+ assert {"name": data, "data": data} == G.graph
+ assert list(G.nodes(data=True)) == [(0, {"int": -1, "data": {"data": data}})]
+ assert list(G.edges(data=True)) == [(0, 0, {"float": -2.5, "data": data})]
+ G = nx.Graph()
+ G.graph["data"] = "frozenset([1, 2, 3])"
+ G = nx.parse_gml(nx.generate_gml(G), destringizer=literal_eval)
+ assert G.graph["data"] == "frozenset([1, 2, 3])"
+
+ def test_escape_unescape(self):
+ gml = """graph [
+ name "&"䑄&unknown;"
+]"""
+ G = nx.parse_gml(gml)
+ assert (
+ '&"\x0f' + chr(0x4444) + "&unknown;"
+ == G.name
+ )
+ gml = "\n".join(nx.generate_gml(G))
+ alnu = "#1234567890;�"
+ answer = (
+ """graph [
+ name "&"䑄&"""
+ + alnu
+ + """;&unknown;"
+]"""
+ )
+ assert answer == gml
+
+ def test_exceptions(self, tmp_path):
+ pytest.raises(ValueError, literal_destringizer, "(")
+ pytest.raises(ValueError, literal_destringizer, "frozenset([1, 2, 3])")
+ pytest.raises(ValueError, literal_destringizer, literal_destringizer)
+ pytest.raises(ValueError, literal_stringizer, frozenset([1, 2, 3]))
+ pytest.raises(ValueError, literal_stringizer, literal_stringizer)
+ with open(tmp_path / "test.gml", "w+b") as f:
+ f.write(codecs.BOM_UTF8 + b"graph[]")
+ f.seek(0)
+ pytest.raises(nx.NetworkXError, nx.read_gml, f)
+
+ def assert_parse_error(gml):
+ pytest.raises(nx.NetworkXError, nx.parse_gml, gml)
+
+ assert_parse_error(["graph [\n\n", "]"])
+ assert_parse_error("")
+ assert_parse_error('Creator ""')
+ assert_parse_error("0")
+ assert_parse_error("graph ]")
+ assert_parse_error("graph [ 1 ]")
+ assert_parse_error("graph [ 1.E+2 ]")
+ assert_parse_error('graph [ "A" ]')
+ assert_parse_error("graph [ ] graph ]")
+ assert_parse_error("graph [ ] graph [ ]")
+ assert_parse_error("graph [ data [1, 2, 3] ]")
+ assert_parse_error("graph [ node [ ] ]")
+ assert_parse_error("graph [ node [ id 0 ] ]")
+ nx.parse_gml('graph [ node [ id "a" ] ]', label="id")
+ assert_parse_error("graph [ node [ id 0 label 0 ] node [ id 0 label 1 ] ]")
+ assert_parse_error("graph [ node [ id 0 label 0 ] node [ id 1 label 0 ] ]")
+ assert_parse_error("graph [ node [ id 0 label 0 ] edge [ ] ]")
+ assert_parse_error("graph [ node [ id 0 label 0 ] edge [ source 0 ] ]")
+ nx.parse_gml("graph [edge [ source 0 target 0 ] node [ id 0 label 0 ] ]")
+ assert_parse_error("graph [ node [ id 0 label 0 ] edge [ source 1 target 0 ] ]")
+ assert_parse_error("graph [ node [ id 0 label 0 ] edge [ source 0 target 1 ] ]")
+ assert_parse_error(
+ "graph [ node [ id 0 label 0 ] node [ id 1 label 1 ] "
+ "edge [ source 0 target 1 ] edge [ source 1 target 0 ] ]"
+ )
+ nx.parse_gml(
+ "graph [ node [ id 0 label 0 ] node [ id 1 label 1 ] "
+ "edge [ source 0 target 1 ] edge [ source 1 target 0 ] "
+ "directed 1 ]"
+ )
+ nx.parse_gml(
+ "graph [ node [ id 0 label 0 ] node [ id 1 label 1 ] "
+ "edge [ source 0 target 1 ] edge [ source 0 target 1 ]"
+ "multigraph 1 ]"
+ )
+ nx.parse_gml(
+ "graph [ node [ id 0 label 0 ] node [ id 1 label 1 ] "
+ "edge [ source 0 target 1 key 0 ] edge [ source 0 target 1 ]"
+ "multigraph 1 ]"
+ )
+ assert_parse_error(
+ "graph [ node [ id 0 label 0 ] node [ id 1 label 1 ] "
+ "edge [ source 0 target 1 key 0 ] edge [ source 0 target 1 key 0 ]"
+ "multigraph 1 ]"
+ )
+ nx.parse_gml(
+ "graph [ node [ id 0 label 0 ] node [ id 1 label 1 ] "
+ "edge [ source 0 target 1 key 0 ] edge [ source 1 target 0 key 0 ]"
+ "directed 1 multigraph 1 ]"
+ )
+
+ # Tests for string convertible alphanumeric id and label values
+ nx.parse_gml("graph [edge [ source a target a ] node [ id a label b ] ]")
+ nx.parse_gml(
+ "graph [ node [ id n42 label 0 ] node [ id x43 label 1 ]"
+ "edge [ source n42 target x43 key 0 ]"
+ "edge [ source x43 target n42 key 0 ]"
+ "directed 1 multigraph 1 ]"
+ )
+ assert_parse_error(
+ "graph [edge [ source '\u4200' target '\u4200' ] "
+ + "node [ id '\u4200' label b ] ]"
+ )
+
+ def assert_generate_error(*args, **kwargs):
+ pytest.raises(
+ nx.NetworkXError, lambda: list(nx.generate_gml(*args, **kwargs))
+ )
+
+ G = nx.Graph()
+ G.graph[3] = 3
+ assert_generate_error(G)
+ G = nx.Graph()
+ G.graph["3"] = 3
+ assert_generate_error(G)
+ G = nx.Graph()
+ G.graph["data"] = frozenset([1, 2, 3])
+ assert_generate_error(G, stringizer=literal_stringizer)
+
+ def test_label_kwarg(self):
+ G = nx.parse_gml(self.simple_data, label="id")
+ assert sorted(G.nodes) == [1, 2, 3]
+ labels = [G.nodes[n]["label"] for n in sorted(G.nodes)]
+ assert labels == ["Node 1", "Node 2", "Node 3"]
+
+ G = nx.parse_gml(self.simple_data, label=None)
+ assert sorted(G.nodes) == [1, 2, 3]
+ labels = [G.nodes[n]["label"] for n in sorted(G.nodes)]
+ assert labels == ["Node 1", "Node 2", "Node 3"]
+
+ def test_outofrange_integers(self, tmp_path):
+ # GML restricts integers to 32 signed bits.
+ # Check that we honor this restriction on export
+ G = nx.Graph()
+ # Test export for numbers that barely fit or don't fit into 32 bits,
+ # and 3 numbers in the middle
+ numbers = {
+ "toosmall": (-(2**31)) - 1,
+ "small": -(2**31),
+ "med1": -4,
+ "med2": 0,
+ "med3": 17,
+ "big": (2**31) - 1,
+ "toobig": 2**31,
+ }
+ G.add_node("Node", **numbers)
+
+ fname = tmp_path / "test.gml"
+ nx.write_gml(G, fname)
+ # Check that the export wrote the nonfitting numbers as strings
+ G2 = nx.read_gml(fname)
+ for attr, value in G2.nodes["Node"].items():
+ if attr == "toosmall" or attr == "toobig":
+ assert type(value) == str
+ else:
+ assert type(value) == int
+
+ def test_multiline(self):
+ # example from issue #6836
+ multiline_example = """
+graph
+[
+ node
+ [
+ id 0
+ label "multiline node"
+ label2 "multiline1
+ multiline2
+ multiline3"
+ alt_name "id 0"
+ ]
+]
+"""
+ G = nx.parse_gml(multiline_example)
+ assert G.nodes["multiline node"] == {
+ "label2": "multiline1 multiline2 multiline3",
+ "alt_name": "id 0",
+ }
+
+
+@contextmanager
+def byte_file():
+ _file_handle = io.BytesIO()
+ yield _file_handle
+ _file_handle.seek(0)
+
+
+class TestPropertyLists:
+ def test_writing_graph_with_multi_element_property_list(self):
+ g = nx.Graph()
+ g.add_node("n1", properties=["element", 0, 1, 2.5, True, False])
+ with byte_file() as f:
+ nx.write_gml(g, f)
+ result = f.read().decode()
+
+ assert result == dedent(
+ """\
+ graph [
+ node [
+ id 0
+ label "n1"
+ properties "element"
+ properties 0
+ properties 1
+ properties 2.5
+ properties 1
+ properties 0
+ ]
+ ]
+ """
+ )
+
+ def test_writing_graph_with_one_element_property_list(self):
+ g = nx.Graph()
+ g.add_node("n1", properties=["element"])
+ with byte_file() as f:
+ nx.write_gml(g, f)
+ result = f.read().decode()
+
+ assert result == dedent(
+ """\
+ graph [
+ node [
+ id 0
+ label "n1"
+ properties "_networkx_list_start"
+ properties "element"
+ ]
+ ]
+ """
+ )
+
+ def test_reading_graph_with_list_property(self):
+ with byte_file() as f:
+ f.write(
+ dedent(
+ """
+ graph [
+ node [
+ id 0
+ label "n1"
+ properties "element"
+ properties 0
+ properties 1
+ properties 2.5
+ ]
+ ]
+ """
+ ).encode("ascii")
+ )
+ f.seek(0)
+ graph = nx.read_gml(f)
+ assert graph.nodes(data=True)["n1"] == {"properties": ["element", 0, 1, 2.5]}
+
+ def test_reading_graph_with_single_element_list_property(self):
+ with byte_file() as f:
+ f.write(
+ dedent(
+ """
+ graph [
+ node [
+ id 0
+ label "n1"
+ properties "_networkx_list_start"
+ properties "element"
+ ]
+ ]
+ """
+ ).encode("ascii")
+ )
+ f.seek(0)
+ graph = nx.read_gml(f)
+ assert graph.nodes(data=True)["n1"] == {"properties": ["element"]}
+
+
+@pytest.mark.parametrize("coll", ([], ()))
+def test_stringize_empty_list_tuple(coll):
+ G = nx.path_graph(2)
+ G.nodes[0]["test"] = coll # test serializing an empty collection
+ f = io.BytesIO()
+ nx.write_gml(G, f) # Smoke test - should not raise
+ f.seek(0)
+ H = nx.read_gml(f)
+ assert H.nodes["0"]["test"] == coll # Check empty list round-trips properly
+ # Check full round-tripping. Note that nodes are loaded as strings by
+ # default, so there needs to be some remapping prior to comparison
+ H = nx.relabel_nodes(H, {"0": 0, "1": 1})
+ assert nx.utils.graphs_equal(G, H)
+ # Same as above, but use destringizer for node remapping. Should have no
+ # effect on node attr
+ f.seek(0)
+ H = nx.read_gml(f, destringizer=int)
+ assert nx.utils.graphs_equal(G, H)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_graph6.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_graph6.py
new file mode 100644
index 0000000000000000000000000000000000000000..a80326946c611751c1d27a3a10e74b64f2d379d4
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_graph6.py
@@ -0,0 +1,168 @@
+from io import BytesIO
+
+import pytest
+
+import networkx as nx
+import networkx.readwrite.graph6 as g6
+from networkx.utils import edges_equal, nodes_equal
+
+
+class TestGraph6Utils:
+ def test_n_data_n_conversion(self):
+ for i in [0, 1, 42, 62, 63, 64, 258047, 258048, 7744773, 68719476735]:
+ assert g6.data_to_n(g6.n_to_data(i))[0] == i
+ assert g6.data_to_n(g6.n_to_data(i))[1] == []
+ assert g6.data_to_n(g6.n_to_data(i) + [42, 43])[1] == [42, 43]
+
+
+class TestFromGraph6Bytes:
+ def test_from_graph6_bytes(self):
+ data = b"DF{"
+ G = nx.from_graph6_bytes(data)
+ assert nodes_equal(G.nodes(), [0, 1, 2, 3, 4])
+ assert edges_equal(
+ G.edges(), [(0, 3), (0, 4), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]
+ )
+
+ def test_read_equals_from_bytes(self):
+ data = b"DF{"
+ G = nx.from_graph6_bytes(data)
+ fh = BytesIO(data)
+ Gin = nx.read_graph6(fh)
+ assert nodes_equal(G.nodes(), Gin.nodes())
+ assert edges_equal(G.edges(), Gin.edges())
+
+
+class TestReadGraph6:
+ def test_read_many_graph6(self):
+ """Test for reading many graphs from a file into a list."""
+ data = b"DF{\nD`{\nDqK\nD~{\n"
+ fh = BytesIO(data)
+ glist = nx.read_graph6(fh)
+ assert len(glist) == 4
+ for G in glist:
+ assert sorted(G) == list(range(5))
+
+
+class TestWriteGraph6:
+ """Unit tests for writing a graph to a file in graph6 format."""
+
+ def test_null_graph(self):
+ result = BytesIO()
+ nx.write_graph6(nx.null_graph(), result)
+ assert result.getvalue() == b">>graph6<\n"
+
+ def test_trivial_graph(self):
+ result = BytesIO()
+ nx.write_graph6(nx.trivial_graph(), result)
+ assert result.getvalue() == b">>graph6<<@\n"
+
+ def test_complete_graph(self):
+ result = BytesIO()
+ nx.write_graph6(nx.complete_graph(4), result)
+ assert result.getvalue() == b">>graph6<>graph6<\n"
+
+ @pytest.mark.parametrize("edge", ((0, 1), (1, 2), (1, 42)))
+ def test_relabeling(self, edge):
+ G = nx.Graph([edge])
+ f = BytesIO()
+ nx.write_graph6(G, f)
+ f.seek(0)
+ assert f.read() == b">>graph6<>graph6<\n"
+
+ def test_trivial_graph(self):
+ G = nx.trivial_graph()
+ assert g6.to_graph6_bytes(G) == b">>graph6<<@\n"
+
+ def test_complete_graph(self):
+ assert g6.to_graph6_bytes(nx.complete_graph(4)) == b">>graph6<>graph6<
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+ cls.simple_directed_graph = nx.DiGraph()
+ cls.simple_directed_graph.add_node("n10")
+ cls.simple_directed_graph.add_edge("n0", "n2", id="foo")
+ cls.simple_directed_graph.add_edge("n0", "n2")
+ cls.simple_directed_graph.add_edges_from(
+ [
+ ("n1", "n2"),
+ ("n2", "n3"),
+ ("n3", "n5"),
+ ("n3", "n4"),
+ ("n4", "n6"),
+ ("n6", "n5"),
+ ("n5", "n7"),
+ ("n6", "n8"),
+ ("n8", "n7"),
+ ("n8", "n9"),
+ ]
+ )
+ cls.simple_directed_fh = io.BytesIO(cls.simple_directed_data.encode("UTF-8"))
+
+ cls.attribute_data = """
+
+
+ yellow
+
+
+
+
+ green
+
+
+
+ blue
+
+
+ red
+
+
+
+ turquoise
+
+
+ 1.0
+
+
+ 1.0
+
+
+ 2.0
+
+
+
+
+
+ 1.1
+
+
+
+"""
+ cls.attribute_graph = nx.DiGraph(id="G")
+ cls.attribute_graph.graph["node_default"] = {"color": "yellow"}
+ cls.attribute_graph.add_node("n0", color="green")
+ cls.attribute_graph.add_node("n2", color="blue")
+ cls.attribute_graph.add_node("n3", color="red")
+ cls.attribute_graph.add_node("n4")
+ cls.attribute_graph.add_node("n5", color="turquoise")
+ cls.attribute_graph.add_edge("n0", "n2", id="e0", weight=1.0)
+ cls.attribute_graph.add_edge("n0", "n1", id="e1", weight=1.0)
+ cls.attribute_graph.add_edge("n1", "n3", id="e2", weight=2.0)
+ cls.attribute_graph.add_edge("n3", "n2", id="e3")
+ cls.attribute_graph.add_edge("n2", "n4", id="e4")
+ cls.attribute_graph.add_edge("n3", "n5", id="e5")
+ cls.attribute_graph.add_edge("n5", "n4", id="e6", weight=1.1)
+ cls.attribute_fh = io.BytesIO(cls.attribute_data.encode("UTF-8"))
+
+ cls.node_attribute_default_data = """
+
+ false
+ 0
+ 0
+ 0.0
+ 0.0
+ Foo
+
+
+
+
+
+
+ """
+ cls.node_attribute_default_graph = nx.DiGraph(id="G")
+ cls.node_attribute_default_graph.graph["node_default"] = {
+ "boolean_attribute": False,
+ "int_attribute": 0,
+ "long_attribute": 0,
+ "float_attribute": 0.0,
+ "double_attribute": 0.0,
+ "string_attribute": "Foo",
+ }
+ cls.node_attribute_default_graph.add_node("n0")
+ cls.node_attribute_default_graph.add_node("n1")
+ cls.node_attribute_default_graph.add_edge("n0", "n1", id="e0")
+ cls.node_attribute_default_fh = io.BytesIO(
+ cls.node_attribute_default_data.encode("UTF-8")
+ )
+
+ cls.attribute_named_key_ids_data = """
+
+
+
+
+
+
+ val1
+ val2
+
+
+ val_one
+ val2
+
+
+ edge_value
+
+
+
+"""
+ cls.attribute_named_key_ids_graph = nx.DiGraph()
+ cls.attribute_named_key_ids_graph.add_node("0", prop1="val1", prop2="val2")
+ cls.attribute_named_key_ids_graph.add_node("1", prop1="val_one", prop2="val2")
+ cls.attribute_named_key_ids_graph.add_edge("0", "1", edge_prop="edge_value")
+ fh = io.BytesIO(cls.attribute_named_key_ids_data.encode("UTF-8"))
+ cls.attribute_named_key_ids_fh = fh
+
+ cls.attribute_numeric_type_data = """
+
+
+
+
+
+ 1
+
+
+ 2.0
+
+
+ 1
+
+
+ k
+
+
+ 1.0
+
+
+
+"""
+ cls.attribute_numeric_type_graph = nx.DiGraph()
+ cls.attribute_numeric_type_graph.add_node("n0", weight=1)
+ cls.attribute_numeric_type_graph.add_node("n1", weight=2.0)
+ cls.attribute_numeric_type_graph.add_edge("n0", "n1", weight=1)
+ cls.attribute_numeric_type_graph.add_edge("n1", "n1", weight=1.0)
+ fh = io.BytesIO(cls.attribute_numeric_type_data.encode("UTF-8"))
+ cls.attribute_numeric_type_fh = fh
+
+ cls.simple_undirected_data = """
+
+
+
+
+
+
+
+
+
+
+"""
+ #
+ cls.simple_undirected_graph = nx.Graph()
+ cls.simple_undirected_graph.add_node("n10")
+ cls.simple_undirected_graph.add_edge("n0", "n2", id="foo")
+ cls.simple_undirected_graph.add_edges_from([("n1", "n2"), ("n2", "n3")])
+ fh = io.BytesIO(cls.simple_undirected_data.encode("UTF-8"))
+ cls.simple_undirected_fh = fh
+
+ cls.undirected_multigraph_data = """
+
+
+
+
+
+
+
+
+
+
+"""
+ cls.undirected_multigraph = nx.MultiGraph()
+ cls.undirected_multigraph.add_node("n10")
+ cls.undirected_multigraph.add_edge("n0", "n2", id="e0")
+ cls.undirected_multigraph.add_edge("n1", "n2", id="e1")
+ cls.undirected_multigraph.add_edge("n2", "n1", id="e2")
+ fh = io.BytesIO(cls.undirected_multigraph_data.encode("UTF-8"))
+ cls.undirected_multigraph_fh = fh
+
+ cls.undirected_multigraph_no_multiedge_data = """
+
+
+
+
+
+
+
+
+
+
+"""
+ cls.undirected_multigraph_no_multiedge = nx.MultiGraph()
+ cls.undirected_multigraph_no_multiedge.add_node("n10")
+ cls.undirected_multigraph_no_multiedge.add_edge("n0", "n2", id="e0")
+ cls.undirected_multigraph_no_multiedge.add_edge("n1", "n2", id="e1")
+ cls.undirected_multigraph_no_multiedge.add_edge("n2", "n3", id="e2")
+ fh = io.BytesIO(cls.undirected_multigraph_no_multiedge_data.encode("UTF-8"))
+ cls.undirected_multigraph_no_multiedge_fh = fh
+
+ cls.multigraph_only_ids_for_multiedges_data = """
+
+
+
+
+
+
+
+
+
+
+"""
+ cls.multigraph_only_ids_for_multiedges = nx.MultiGraph()
+ cls.multigraph_only_ids_for_multiedges.add_node("n10")
+ cls.multigraph_only_ids_for_multiedges.add_edge("n0", "n2")
+ cls.multigraph_only_ids_for_multiedges.add_edge("n1", "n2", id="e1")
+ cls.multigraph_only_ids_for_multiedges.add_edge("n2", "n1", id="e2")
+ fh = io.BytesIO(cls.multigraph_only_ids_for_multiedges_data.encode("UTF-8"))
+ cls.multigraph_only_ids_for_multiedges_fh = fh
+
+
+class TestReadGraphML(BaseGraphML):
+ def test_read_simple_directed_graphml(self):
+ G = self.simple_directed_graph
+ H = nx.read_graphml(self.simple_directed_fh)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(G.edges()) == sorted(H.edges())
+ assert sorted(G.edges(data=True)) == sorted(H.edges(data=True))
+ self.simple_directed_fh.seek(0)
+
+ PG = nx.parse_graphml(self.simple_directed_data)
+ assert sorted(G.nodes()) == sorted(PG.nodes())
+ assert sorted(G.edges()) == sorted(PG.edges())
+ assert sorted(G.edges(data=True)) == sorted(PG.edges(data=True))
+
+ def test_read_simple_undirected_graphml(self):
+ G = self.simple_undirected_graph
+ H = nx.read_graphml(self.simple_undirected_fh)
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ self.simple_undirected_fh.seek(0)
+
+ PG = nx.parse_graphml(self.simple_undirected_data)
+ assert nodes_equal(G.nodes(), PG.nodes())
+ assert edges_equal(G.edges(), PG.edges())
+
+ def test_read_undirected_multigraph_graphml(self):
+ G = self.undirected_multigraph
+ H = nx.read_graphml(self.undirected_multigraph_fh)
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ self.undirected_multigraph_fh.seek(0)
+
+ PG = nx.parse_graphml(self.undirected_multigraph_data)
+ assert nodes_equal(G.nodes(), PG.nodes())
+ assert edges_equal(G.edges(), PG.edges())
+
+ def test_read_undirected_multigraph_no_multiedge_graphml(self):
+ G = self.undirected_multigraph_no_multiedge
+ H = nx.read_graphml(self.undirected_multigraph_no_multiedge_fh)
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ self.undirected_multigraph_no_multiedge_fh.seek(0)
+
+ PG = nx.parse_graphml(self.undirected_multigraph_no_multiedge_data)
+ assert nodes_equal(G.nodes(), PG.nodes())
+ assert edges_equal(G.edges(), PG.edges())
+
+ def test_read_undirected_multigraph_only_ids_for_multiedges_graphml(self):
+ G = self.multigraph_only_ids_for_multiedges
+ H = nx.read_graphml(self.multigraph_only_ids_for_multiedges_fh)
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ self.multigraph_only_ids_for_multiedges_fh.seek(0)
+
+ PG = nx.parse_graphml(self.multigraph_only_ids_for_multiedges_data)
+ assert nodes_equal(G.nodes(), PG.nodes())
+ assert edges_equal(G.edges(), PG.edges())
+
+ def test_read_attribute_graphml(self):
+ G = self.attribute_graph
+ H = nx.read_graphml(self.attribute_fh)
+ assert nodes_equal(G.nodes(True), sorted(H.nodes(data=True)))
+ ge = sorted(G.edges(data=True))
+ he = sorted(H.edges(data=True))
+ for a, b in zip(ge, he):
+ assert a == b
+ self.attribute_fh.seek(0)
+
+ PG = nx.parse_graphml(self.attribute_data)
+ assert sorted(G.nodes(True)) == sorted(PG.nodes(data=True))
+ ge = sorted(G.edges(data=True))
+ he = sorted(PG.edges(data=True))
+ for a, b in zip(ge, he):
+ assert a == b
+
+ def test_node_default_attribute_graphml(self):
+ G = self.node_attribute_default_graph
+ H = nx.read_graphml(self.node_attribute_default_fh)
+ assert G.graph["node_default"] == H.graph["node_default"]
+
+ def test_directed_edge_in_undirected(self):
+ s = """
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ pytest.raises(nx.NetworkXError, nx.read_graphml, fh)
+ pytest.raises(nx.NetworkXError, nx.parse_graphml, s)
+
+ def test_undirected_edge_in_directed(self):
+ s = """
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ pytest.raises(nx.NetworkXError, nx.read_graphml, fh)
+ pytest.raises(nx.NetworkXError, nx.parse_graphml, s)
+
+ def test_key_raise(self):
+ s = """
+
+
+ yellow
+
+
+
+
+ green
+
+
+
+ blue
+
+
+ 1.0
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ pytest.raises(nx.NetworkXError, nx.read_graphml, fh)
+ pytest.raises(nx.NetworkXError, nx.parse_graphml, s)
+
+ def test_hyperedge_raise(self):
+ s = """
+
+
+ yellow
+
+
+
+
+ green
+
+
+
+ blue
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ pytest.raises(nx.NetworkXError, nx.read_graphml, fh)
+ pytest.raises(nx.NetworkXError, nx.parse_graphml, s)
+
+ def test_multigraph_keys(self):
+ # Test that reading multigraphs uses edge id attributes as keys
+ s = """
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ G = nx.read_graphml(fh)
+ expected = [("n0", "n1", "e0"), ("n0", "n1", "e1")]
+ assert sorted(G.edges(keys=True)) == expected
+ fh.seek(0)
+ H = nx.parse_graphml(s)
+ assert sorted(H.edges(keys=True)) == expected
+
+ def test_preserve_multi_edge_data(self):
+ """
+ Test that data and keys of edges are preserved on consequent
+ write and reads
+ """
+ G = nx.MultiGraph()
+ G.add_node(1)
+ G.add_node(2)
+ G.add_edges_from(
+ [
+ # edges with no data, no keys:
+ (1, 2),
+ # edges with only data:
+ (1, 2, {"key": "data_key1"}),
+ (1, 2, {"id": "data_id2"}),
+ (1, 2, {"key": "data_key3", "id": "data_id3"}),
+ # edges with both data and keys:
+ (1, 2, 103, {"key": "data_key4"}),
+ (1, 2, 104, {"id": "data_id5"}),
+ (1, 2, 105, {"key": "data_key6", "id": "data_id7"}),
+ ]
+ )
+ fh = io.BytesIO()
+ nx.write_graphml(G, fh)
+ fh.seek(0)
+ H = nx.read_graphml(fh, node_type=int)
+ assert edges_equal(G.edges(data=True, keys=True), H.edges(data=True, keys=True))
+ assert G._adj == H._adj
+
+ Gadj = {
+ str(node): {
+ str(nbr): {str(ekey): dd for ekey, dd in key_dict.items()}
+ for nbr, key_dict in nbr_dict.items()
+ }
+ for node, nbr_dict in G._adj.items()
+ }
+ fh.seek(0)
+ HH = nx.read_graphml(fh, node_type=str, edge_key_type=str)
+ assert Gadj == HH._adj
+
+ fh.seek(0)
+ string_fh = fh.read()
+ HH = nx.parse_graphml(string_fh, node_type=str, edge_key_type=str)
+ assert Gadj == HH._adj
+
+ def test_yfiles_extension(self):
+ data = """
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+ 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+ fh = io.BytesIO(data.encode("UTF-8"))
+ G = nx.read_graphml(fh, force_multigraph=True)
+ assert list(G.edges()) == [("n0", "n1")]
+ assert G.has_edge("n0", "n1", key="e0")
+ assert G.nodes["n0"]["label"] == "1"
+ assert G.nodes["n1"]["label"] == "2"
+ assert G.nodes["n2"]["label"] == "3"
+ assert G.nodes["n0"]["shape_type"] == "rectangle"
+ assert G.nodes["n1"]["shape_type"] == "rectangle"
+ assert G.nodes["n2"]["shape_type"] == "com.yworks.flowchart.terminator"
+ assert G.nodes["n2"]["description"] == "description\nline1\nline2"
+ fh.seek(0)
+ G = nx.read_graphml(fh)
+ assert list(G.edges()) == [("n0", "n1")]
+ assert G["n0"]["n1"]["id"] == "e0"
+ assert G.nodes["n0"]["label"] == "1"
+ assert G.nodes["n1"]["label"] == "2"
+ assert G.nodes["n2"]["label"] == "3"
+ assert G.nodes["n0"]["shape_type"] == "rectangle"
+ assert G.nodes["n1"]["shape_type"] == "rectangle"
+ assert G.nodes["n2"]["shape_type"] == "com.yworks.flowchart.terminator"
+ assert G.nodes["n2"]["description"] == "description\nline1\nline2"
+
+ H = nx.parse_graphml(data, force_multigraph=True)
+ assert list(H.edges()) == [("n0", "n1")]
+ assert H.has_edge("n0", "n1", key="e0")
+ assert H.nodes["n0"]["label"] == "1"
+ assert H.nodes["n1"]["label"] == "2"
+ assert H.nodes["n2"]["label"] == "3"
+
+ H = nx.parse_graphml(data)
+ assert list(H.edges()) == [("n0", "n1")]
+ assert H["n0"]["n1"]["id"] == "e0"
+ assert H.nodes["n0"]["label"] == "1"
+ assert H.nodes["n1"]["label"] == "2"
+ assert H.nodes["n2"]["label"] == "3"
+
+ def test_bool(self):
+ s = """
+
+
+ false
+
+
+
+ true
+
+
+
+ false
+
+
+ FaLsE
+
+
+ True
+
+
+ 0
+
+
+ 1
+
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ G = nx.read_graphml(fh)
+ H = nx.parse_graphml(s)
+ for graph in [G, H]:
+ assert graph.nodes["n0"]["test"]
+ assert not graph.nodes["n2"]["test"]
+ assert not graph.nodes["n3"]["test"]
+ assert graph.nodes["n4"]["test"]
+ assert not graph.nodes["n5"]["test"]
+ assert graph.nodes["n6"]["test"]
+
+ def test_graphml_header_line(self):
+ good = """
+
+
+ false
+
+
+
+ true
+
+
+
+"""
+ bad = """
+
+
+ false
+
+
+
+ true
+
+
+
+"""
+ ugly = """
+
+
+ false
+
+
+
+ true
+
+
+
+"""
+ for s in (good, bad):
+ fh = io.BytesIO(s.encode("UTF-8"))
+ G = nx.read_graphml(fh)
+ H = nx.parse_graphml(s)
+ for graph in [G, H]:
+ assert graph.nodes["n0"]["test"]
+
+ fh = io.BytesIO(ugly.encode("UTF-8"))
+ pytest.raises(nx.NetworkXError, nx.read_graphml, fh)
+ pytest.raises(nx.NetworkXError, nx.parse_graphml, ugly)
+
+ def test_read_attributes_with_groups(self):
+ data = """\
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Group 3
+
+
+
+
+
+
+
+
+
+ Folder 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Group 1
+
+
+
+
+
+
+
+
+
+ Folder 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Group 2
+
+
+
+
+
+
+
+
+
+ Folder 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 9
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+"""
+ # verify that nodes / attributes are correctly read when part of a group
+ fh = io.BytesIO(data.encode("UTF-8"))
+ G = nx.read_graphml(fh)
+ data = [x for _, x in G.nodes(data=True)]
+ assert len(data) == 9
+ for node_data in data:
+ assert node_data["CustomProperty"] != ""
+
+ def test_long_attribute_type(self):
+ # test that graphs with attr.type="long" (as produced by botch and
+ # dose3) can be parsed
+ s = """
+
+
+
+
+ 4284
+
+
+"""
+ fh = io.BytesIO(s.encode("UTF-8"))
+ G = nx.read_graphml(fh)
+ expected = [("n1", {"cudfversion": 4284})]
+ assert sorted(G.nodes(data=True)) == expected
+ fh.seek(0)
+ H = nx.parse_graphml(s)
+ assert sorted(H.nodes(data=True)) == expected
+
+
+class TestWriteGraphML(BaseGraphML):
+ writer = staticmethod(nx.write_graphml_lxml)
+
+ @classmethod
+ def setup_class(cls):
+ BaseGraphML.setup_class()
+ _ = pytest.importorskip("lxml.etree")
+
+ def test_write_interface(self):
+ try:
+ import lxml.etree
+
+ assert nx.write_graphml == nx.write_graphml_lxml
+ except ImportError:
+ assert nx.write_graphml == nx.write_graphml_xml
+
+ def test_write_read_simple_directed_graphml(self):
+ G = self.simple_directed_graph
+ G.graph["hi"] = "there"
+ fh = io.BytesIO()
+ self.writer(G, fh)
+ fh.seek(0)
+ H = nx.read_graphml(fh)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(G.edges()) == sorted(H.edges())
+ assert sorted(G.edges(data=True)) == sorted(H.edges(data=True))
+ self.simple_directed_fh.seek(0)
+
+ def test_GraphMLWriter_add_graphs(self):
+ gmlw = GraphMLWriter()
+ G = self.simple_directed_graph
+ H = G.copy()
+ gmlw.add_graphs([G, H])
+
+ def test_write_read_simple_no_prettyprint(self):
+ G = self.simple_directed_graph
+ G.graph["hi"] = "there"
+ G.graph["id"] = "1"
+ fh = io.BytesIO()
+ self.writer(G, fh, prettyprint=False)
+ fh.seek(0)
+ H = nx.read_graphml(fh)
+ assert sorted(G.nodes()) == sorted(H.nodes())
+ assert sorted(G.edges()) == sorted(H.edges())
+ assert sorted(G.edges(data=True)) == sorted(H.edges(data=True))
+ self.simple_directed_fh.seek(0)
+
+ def test_write_read_attribute_named_key_ids_graphml(self):
+ from xml.etree.ElementTree import parse
+
+ G = self.attribute_named_key_ids_graph
+ fh = io.BytesIO()
+ self.writer(G, fh, named_key_ids=True)
+ fh.seek(0)
+ H = nx.read_graphml(fh)
+ fh.seek(0)
+
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ assert edges_equal(G.edges(data=True), H.edges(data=True))
+ self.attribute_named_key_ids_fh.seek(0)
+
+ xml = parse(fh)
+ # Children are the key elements, and the graph element
+ children = list(xml.getroot())
+ assert len(children) == 4
+
+ keys = [child.items() for child in children[:3]]
+
+ assert len(keys) == 3
+ assert ("id", "edge_prop") in keys[0]
+ assert ("attr.name", "edge_prop") in keys[0]
+ assert ("id", "prop2") in keys[1]
+ assert ("attr.name", "prop2") in keys[1]
+ assert ("id", "prop1") in keys[2]
+ assert ("attr.name", "prop1") in keys[2]
+
+ # Confirm the read graph nodes/edge are identical when compared to
+ # default writing behavior.
+ default_behavior_fh = io.BytesIO()
+ nx.write_graphml(G, default_behavior_fh)
+ default_behavior_fh.seek(0)
+ H = nx.read_graphml(default_behavior_fh)
+
+ named_key_ids_behavior_fh = io.BytesIO()
+ nx.write_graphml(G, named_key_ids_behavior_fh, named_key_ids=True)
+ named_key_ids_behavior_fh.seek(0)
+ J = nx.read_graphml(named_key_ids_behavior_fh)
+
+ assert all(n1 == n2 for (n1, n2) in zip(H.nodes, J.nodes))
+ assert all(e1 == e2 for (e1, e2) in zip(H.edges, J.edges))
+
+ def test_write_read_attribute_numeric_type_graphml(self):
+ from xml.etree.ElementTree import parse
+
+ G = self.attribute_numeric_type_graph
+ fh = io.BytesIO()
+ self.writer(G, fh, infer_numeric_types=True)
+ fh.seek(0)
+ H = nx.read_graphml(fh)
+ fh.seek(0)
+
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ assert edges_equal(G.edges(data=True), H.edges(data=True))
+ self.attribute_numeric_type_fh.seek(0)
+
+ xml = parse(fh)
+ # Children are the key elements, and the graph element
+ children = list(xml.getroot())
+ assert len(children) == 3
+
+ keys = [child.items() for child in children[:2]]
+
+ assert len(keys) == 2
+ assert ("attr.type", "double") in keys[0]
+ assert ("attr.type", "double") in keys[1]
+
+ def test_more_multigraph_keys(self, tmp_path):
+ """Writing keys as edge id attributes means keys become strings.
+ The original keys are stored as data, so read them back in
+ if `str(key) == edge_id`
+ This allows the adjacency to remain the same.
+ """
+ G = nx.MultiGraph()
+ G.add_edges_from([("a", "b", 2), ("a", "b", 3)])
+ fname = tmp_path / "test.graphml"
+ self.writer(G, fname)
+ H = nx.read_graphml(fname)
+ assert H.is_multigraph()
+ assert edges_equal(G.edges(keys=True), H.edges(keys=True))
+ assert G._adj == H._adj
+
+ def test_default_attribute(self):
+ G = nx.Graph(name="Fred")
+ G.add_node(1, label=1, color="green")
+ nx.add_path(G, [0, 1, 2, 3])
+ G.add_edge(1, 2, weight=3)
+ G.graph["node_default"] = {"color": "yellow"}
+ G.graph["edge_default"] = {"weight": 7}
+ fh = io.BytesIO()
+ self.writer(G, fh)
+ fh.seek(0)
+ H = nx.read_graphml(fh, node_type=int)
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ assert G.graph == H.graph
+
+ def test_mixed_type_attributes(self):
+ G = nx.MultiGraph()
+ G.add_node("n0", special=False)
+ G.add_node("n1", special=0)
+ G.add_edge("n0", "n1", special=False)
+ G.add_edge("n0", "n1", special=0)
+ fh = io.BytesIO()
+ self.writer(G, fh)
+ fh.seek(0)
+ H = nx.read_graphml(fh)
+ assert not H.nodes["n0"]["special"]
+ assert H.nodes["n1"]["special"] == 0
+ assert not H.edges["n0", "n1", 0]["special"]
+ assert H.edges["n0", "n1", 1]["special"] == 0
+
+ def test_str_number_mixed_type_attributes(self):
+ G = nx.MultiGraph()
+ G.add_node("n0", special="hello")
+ G.add_node("n1", special=0)
+ G.add_edge("n0", "n1", special="hello")
+ G.add_edge("n0", "n1", special=0)
+ fh = io.BytesIO()
+ self.writer(G, fh)
+ fh.seek(0)
+ H = nx.read_graphml(fh)
+ assert H.nodes["n0"]["special"] == "hello"
+ assert H.nodes["n1"]["special"] == 0
+ assert H.edges["n0", "n1", 0]["special"] == "hello"
+ assert H.edges["n0", "n1", 1]["special"] == 0
+
+ def test_mixed_int_type_number_attributes(self):
+ np = pytest.importorskip("numpy")
+ G = nx.MultiGraph()
+ G.add_node("n0", special=np.int64(0))
+ G.add_node("n1", special=1)
+ G.add_edge("n0", "n1", special=np.int64(2))
+ G.add_edge("n0", "n1", special=3)
+ fh = io.BytesIO()
+ self.writer(G, fh)
+ fh.seek(0)
+ H = nx.read_graphml(fh)
+ assert H.nodes["n0"]["special"] == 0
+ assert H.nodes["n1"]["special"] == 1
+ assert H.edges["n0", "n1", 0]["special"] == 2
+ assert H.edges["n0", "n1", 1]["special"] == 3
+
+ def test_multigraph_to_graph(self, tmp_path):
+ # test converting multigraph to graph if no parallel edges found
+ G = nx.MultiGraph()
+ G.add_edges_from([("a", "b", 2), ("b", "c", 3)]) # no multiedges
+ fname = tmp_path / "test.graphml"
+ self.writer(G, fname)
+ H = nx.read_graphml(fname)
+ assert not H.is_multigraph()
+ H = nx.read_graphml(fname, force_multigraph=True)
+ assert H.is_multigraph()
+
+ # add a multiedge
+ G.add_edge("a", "b", "e-id")
+ fname = tmp_path / "test.graphml"
+ self.writer(G, fname)
+ H = nx.read_graphml(fname)
+ assert H.is_multigraph()
+ H = nx.read_graphml(fname, force_multigraph=True)
+ assert H.is_multigraph()
+
+ def test_write_generate_edge_id_from_attribute(self, tmp_path):
+ from xml.etree.ElementTree import parse
+
+ G = nx.Graph()
+ G.add_edges_from([("a", "b"), ("b", "c"), ("a", "c")])
+ edge_attributes = {e: str(e) for e in G.edges}
+ nx.set_edge_attributes(G, edge_attributes, "eid")
+ fname = tmp_path / "test.graphml"
+ # set edge_id_from_attribute e.g. "eid" for write_graphml()
+ self.writer(G, fname, edge_id_from_attribute="eid")
+ # set edge_id_from_attribute e.g. "eid" for generate_graphml()
+ generator = nx.generate_graphml(G, edge_id_from_attribute="eid")
+
+ H = nx.read_graphml(fname)
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ # NetworkX adds explicit edge "id" from file as attribute
+ nx.set_edge_attributes(G, edge_attributes, "id")
+ assert edges_equal(G.edges(data=True), H.edges(data=True))
+
+ tree = parse(fname)
+ children = list(tree.getroot())
+ assert len(children) == 2
+ edge_ids = [
+ edge.attrib["id"]
+ for edge in tree.getroot().findall(
+ ".//{http://graphml.graphdrawing.org/xmlns}edge"
+ )
+ ]
+ # verify edge id value is equal to specified attribute value
+ assert sorted(edge_ids) == sorted(edge_attributes.values())
+
+ # check graphml generated from generate_graphml()
+ data = "".join(generator)
+ J = nx.parse_graphml(data)
+ assert sorted(G.nodes()) == sorted(J.nodes())
+ assert sorted(G.edges()) == sorted(J.edges())
+ # NetworkX adds explicit edge "id" from file as attribute
+ nx.set_edge_attributes(G, edge_attributes, "id")
+ assert edges_equal(G.edges(data=True), J.edges(data=True))
+
+ def test_multigraph_write_generate_edge_id_from_attribute(self, tmp_path):
+ from xml.etree.ElementTree import parse
+
+ G = nx.MultiGraph()
+ G.add_edges_from([("a", "b"), ("b", "c"), ("a", "c"), ("a", "b")])
+ edge_attributes = {e: str(e) for e in G.edges}
+ nx.set_edge_attributes(G, edge_attributes, "eid")
+ fname = tmp_path / "test.graphml"
+ # set edge_id_from_attribute e.g. "eid" for write_graphml()
+ self.writer(G, fname, edge_id_from_attribute="eid")
+ # set edge_id_from_attribute e.g. "eid" for generate_graphml()
+ generator = nx.generate_graphml(G, edge_id_from_attribute="eid")
+
+ H = nx.read_graphml(fname)
+ assert H.is_multigraph()
+ H = nx.read_graphml(fname, force_multigraph=True)
+ assert H.is_multigraph()
+
+ assert nodes_equal(G.nodes(), H.nodes())
+ assert edges_equal(G.edges(), H.edges())
+ assert sorted(data.get("eid") for u, v, data in H.edges(data=True)) == sorted(
+ edge_attributes.values()
+ )
+ # NetworkX uses edge_ids as keys in multigraphs if no key
+ assert sorted(key for u, v, key in H.edges(keys=True)) == sorted(
+ edge_attributes.values()
+ )
+
+ tree = parse(fname)
+ children = list(tree.getroot())
+ assert len(children) == 2
+ edge_ids = [
+ edge.attrib["id"]
+ for edge in tree.getroot().findall(
+ ".//{http://graphml.graphdrawing.org/xmlns}edge"
+ )
+ ]
+ # verify edge id value is equal to specified attribute value
+ assert sorted(edge_ids) == sorted(edge_attributes.values())
+
+ # check graphml generated from generate_graphml()
+ graphml_data = "".join(generator)
+ J = nx.parse_graphml(graphml_data)
+ assert J.is_multigraph()
+
+ assert nodes_equal(G.nodes(), J.nodes())
+ assert edges_equal(G.edges(), J.edges())
+ assert sorted(data.get("eid") for u, v, data in J.edges(data=True)) == sorted(
+ edge_attributes.values()
+ )
+ # NetworkX uses edge_ids as keys in multigraphs if no key
+ assert sorted(key for u, v, key in J.edges(keys=True)) == sorted(
+ edge_attributes.values()
+ )
+
+ def test_numpy_float64(self, tmp_path):
+ np = pytest.importorskip("numpy")
+ wt = np.float64(3.4)
+ G = nx.Graph([(1, 2, {"weight": wt})])
+ fname = tmp_path / "test.graphml"
+ self.writer(G, fname)
+ H = nx.read_graphml(fname, node_type=int)
+ assert G.edges == H.edges
+ wtG = G[1][2]["weight"]
+ wtH = H[1][2]["weight"]
+ assert wtG == pytest.approx(wtH, abs=1e-6)
+ assert type(wtG) == np.float64
+ assert type(wtH) == float
+
+ def test_numpy_float32(self, tmp_path):
+ np = pytest.importorskip("numpy")
+ wt = np.float32(3.4)
+ G = nx.Graph([(1, 2, {"weight": wt})])
+ fname = tmp_path / "test.graphml"
+ self.writer(G, fname)
+ H = nx.read_graphml(fname, node_type=int)
+ assert G.edges == H.edges
+ wtG = G[1][2]["weight"]
+ wtH = H[1][2]["weight"]
+ assert wtG == pytest.approx(wtH, abs=1e-6)
+ assert type(wtG) == np.float32
+ assert type(wtH) == float
+
+ def test_numpy_float64_inference(self, tmp_path):
+ np = pytest.importorskip("numpy")
+ G = self.attribute_numeric_type_graph
+ G.edges[("n1", "n1")]["weight"] = np.float64(1.1)
+ fname = tmp_path / "test.graphml"
+ self.writer(G, fname, infer_numeric_types=True)
+ H = nx.read_graphml(fname)
+ assert G._adj == H._adj
+
+ def test_unicode_attributes(self, tmp_path):
+ G = nx.Graph()
+ name1 = chr(2344) + chr(123) + chr(6543)
+ name2 = chr(5543) + chr(1543) + chr(324)
+ node_type = str
+ G.add_edge(name1, "Radiohead", foo=name2)
+ fname = tmp_path / "test.graphml"
+ self.writer(G, fname)
+ H = nx.read_graphml(fname, node_type=node_type)
+ assert G._adj == H._adj
+
+ def test_unicode_escape(self):
+ # test for handling json escaped strings in python 2 Issue #1880
+ import json
+
+ a = {"a": '{"a": "123"}'} # an object with many chars to escape
+ sa = json.dumps(a)
+ G = nx.Graph()
+ G.graph["test"] = sa
+ fh = io.BytesIO()
+ self.writer(G, fh)
+ fh.seek(0)
+ H = nx.read_graphml(fh)
+ assert G.graph["test"] == H.graph["test"]
+
+
+class TestXMLGraphML(TestWriteGraphML):
+ writer = staticmethod(nx.write_graphml_xml)
+
+ @classmethod
+ def setup_class(cls):
+ TestWriteGraphML.setup_class()
+
+
+def test_exception_for_unsupported_datatype_node_attr():
+ """Test that a detailed exception is raised when an attribute is of a type
+ not supported by GraphML, e.g. a list"""
+ pytest.importorskip("lxml.etree")
+ # node attribute
+ G = nx.Graph()
+ G.add_node(0, my_list_attribute=[0, 1, 2])
+ fh = io.BytesIO()
+ with pytest.raises(TypeError, match="GraphML does not support"):
+ nx.write_graphml(G, fh)
+
+
+def test_exception_for_unsupported_datatype_edge_attr():
+ """Test that a detailed exception is raised when an attribute is of a type
+ not supported by GraphML, e.g. a list"""
+ pytest.importorskip("lxml.etree")
+ # edge attribute
+ G = nx.Graph()
+ G.add_edge(0, 1, my_list_attribute=[0, 1, 2])
+ fh = io.BytesIO()
+ with pytest.raises(TypeError, match="GraphML does not support"):
+ nx.write_graphml(G, fh)
+
+
+def test_exception_for_unsupported_datatype_graph_attr():
+ """Test that a detailed exception is raised when an attribute is of a type
+ not supported by GraphML, e.g. a list"""
+ pytest.importorskip("lxml.etree")
+ # graph attribute
+ G = nx.Graph()
+ G.graph["my_list_attribute"] = [0, 1, 2]
+ fh = io.BytesIO()
+ with pytest.raises(TypeError, match="GraphML does not support"):
+ nx.write_graphml(G, fh)
+
+
+def test_empty_attribute():
+ """Tests that a GraphML string with an empty attribute can be parsed
+ correctly."""
+ s = """
+
+
+
+
+
+ aaa
+ bbb
+
+
+ ccc
+
+
+
+ """
+ fh = io.BytesIO(s.encode("UTF-8"))
+ G = nx.read_graphml(fh)
+ assert G.nodes["0"] == {"foo": "aaa", "bar": "bbb"}
+ assert G.nodes["1"] == {"foo": "ccc", "bar": ""}
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_leda.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_leda.py
new file mode 100644
index 0000000000000000000000000000000000000000..8ac5ecc34bf9b42bd49e316bdc72e0e56c76a616
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_leda.py
@@ -0,0 +1,30 @@
+import io
+
+import networkx as nx
+
+
+class TestLEDA:
+ def test_parse_leda(self):
+ data = """#header section \nLEDA.GRAPH \nstring\nint\n-1\n#nodes section\n5 \n|{v1}| \n|{v2}| \n|{v3}| \n|{v4}| \n|{v5}| \n\n#edges section\n7 \n1 2 0 |{4}| \n1 3 0 |{3}| \n2 3 0 |{2}| \n3 4 0 |{3}| \n3 5 0 |{7}| \n4 5 0 |{6}| \n5 1 0 |{foo}|"""
+ G = nx.parse_leda(data)
+ G = nx.parse_leda(data.split("\n"))
+ assert sorted(G.nodes()) == ["v1", "v2", "v3", "v4", "v5"]
+ assert sorted(G.edges(data=True)) == [
+ ("v1", "v2", {"label": "4"}),
+ ("v1", "v3", {"label": "3"}),
+ ("v2", "v3", {"label": "2"}),
+ ("v3", "v4", {"label": "3"}),
+ ("v3", "v5", {"label": "7"}),
+ ("v4", "v5", {"label": "6"}),
+ ("v5", "v1", {"label": "foo"}),
+ ]
+
+ def test_read_LEDA(self):
+ fh = io.BytesIO()
+ data = """#header section \nLEDA.GRAPH \nstring\nint\n-1\n#nodes section\n5 \n|{v1}| \n|{v2}| \n|{v3}| \n|{v4}| \n|{v5}| \n\n#edges section\n7 \n1 2 0 |{4}| \n1 3 0 |{3}| \n2 3 0 |{2}| \n3 4 0 |{3}| \n3 5 0 |{7}| \n4 5 0 |{6}| \n5 1 0 |{foo}|"""
+ G = nx.parse_leda(data)
+ fh.write(data.encode("UTF-8"))
+ fh.seek(0)
+ Gin = nx.read_leda(fh)
+ assert sorted(G.nodes()) == sorted(Gin.nodes())
+ assert sorted(G.edges()) == sorted(Gin.edges())
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_p2g.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_p2g.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4c50de7f382f62d4ae6e0cc0443e480487c65e2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_p2g.py
@@ -0,0 +1,62 @@
+import io
+
+import networkx as nx
+from networkx.readwrite.p2g import read_p2g, write_p2g
+from networkx.utils import edges_equal
+
+
+class TestP2G:
+ @classmethod
+ def setup_class(cls):
+ cls.G = nx.Graph(name="test")
+ e = [("a", "b"), ("b", "c"), ("c", "d"), ("d", "e"), ("e", "f"), ("a", "f")]
+ cls.G.add_edges_from(e)
+ cls.G.add_node("g")
+ cls.DG = nx.DiGraph(cls.G)
+
+ def test_read_p2g(self):
+ s = b"""\
+name
+3 4
+a
+1 2
+b
+
+c
+0 2
+"""
+ bytesIO = io.BytesIO(s)
+ G = read_p2g(bytesIO)
+ assert G.name == "name"
+ assert sorted(G) == ["a", "b", "c"]
+ edges = [(str(u), str(v)) for u, v in G.edges()]
+ assert edges_equal(G.edges(), [("a", "c"), ("a", "b"), ("c", "a"), ("c", "c")])
+
+ def test_write_p2g(self):
+ s = b"""foo
+3 2
+1
+1
+2
+2
+3
+
+"""
+ fh = io.BytesIO()
+ G = nx.DiGraph()
+ G.name = "foo"
+ G.add_edges_from([(1, 2), (2, 3)])
+ write_p2g(G, fh)
+ fh.seek(0)
+ r = fh.read()
+ assert r == s
+
+ def test_write_read_p2g(self):
+ fh = io.BytesIO()
+ G = nx.DiGraph()
+ G.name = "foo"
+ G.add_edges_from([("a", "b"), ("b", "c")])
+ write_p2g(G, fh)
+ fh.seek(0)
+ H = read_p2g(fh)
+ assert edges_equal(G.edges(), H.edges())
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_pajek.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_pajek.py
new file mode 100644
index 0000000000000000000000000000000000000000..317ebe8e57888837594db43ddae56bedf85173a6
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/tests/test_pajek.py
@@ -0,0 +1,126 @@
+"""
+Pajek tests
+"""
+
+import networkx as nx
+from networkx.utils import edges_equal, nodes_equal
+
+
+class TestPajek:
+ @classmethod
+ def setup_class(cls):
+ cls.data = """*network Tralala\n*vertices 4\n 1 "A1" 0.0938 0.0896 ellipse x_fact 1 y_fact 1\n 2 "Bb" 0.8188 0.2458 ellipse x_fact 1 y_fact 1\n 3 "C" 0.3688 0.7792 ellipse x_fact 1\n 4 "D2" 0.9583 0.8563 ellipse x_fact 1\n*arcs\n1 1 1 h2 0 w 3 c Blue s 3 a1 -130 k1 0.6 a2 -130 k2 0.6 ap 0.5 l "Bezier loop" lc BlueViolet fos 20 lr 58 lp 0.3 la 360\n2 1 1 h2 0 a1 120 k1 1.3 a2 -120 k2 0.3 ap 25 l "Bezier arc" lphi 270 la 180 lr 19 lp 0.5\n1 2 1 h2 0 a1 40 k1 2.8 a2 30 k2 0.8 ap 25 l "Bezier arc" lphi 90 la 0 lp 0.65\n4 2 -1 h2 0 w 1 k1 -2 k2 250 ap 25 l "Circular arc" c Red lc OrangeRed\n3 4 1 p Dashed h2 0 w 2 c OliveGreen ap 25 l "Straight arc" lc PineGreen\n1 3 1 p Dashed h2 0 w 5 k1 -1 k2 -20 ap 25 l "Oval arc" c Brown lc Black\n3 3 -1 h1 6 w 1 h2 12 k1 -2 k2 -15 ap 0.5 l "Circular loop" c Red lc OrangeRed lphi 270 la 180"""
+ cls.G = nx.MultiDiGraph()
+ cls.G.add_nodes_from(["A1", "Bb", "C", "D2"])
+ cls.G.add_edges_from(
+ [
+ ("A1", "A1"),
+ ("A1", "Bb"),
+ ("A1", "C"),
+ ("Bb", "A1"),
+ ("C", "C"),
+ ("C", "D2"),
+ ("D2", "Bb"),
+ ]
+ )
+
+ cls.G.graph["name"] = "Tralala"
+
+ def test_parse_pajek_simple(self):
+ # Example without node positions or shape
+ data = """*Vertices 2\n1 "1"\n2 "2"\n*Edges\n1 2\n2 1"""
+ G = nx.parse_pajek(data)
+ assert sorted(G.nodes()) == ["1", "2"]
+ assert edges_equal(G.edges(), [("1", "2"), ("1", "2")])
+
+ def test_parse_pajek(self):
+ G = nx.parse_pajek(self.data)
+ assert sorted(G.nodes()) == ["A1", "Bb", "C", "D2"]
+ assert edges_equal(
+ G.edges(),
+ [
+ ("A1", "A1"),
+ ("A1", "Bb"),
+ ("A1", "C"),
+ ("Bb", "A1"),
+ ("C", "C"),
+ ("C", "D2"),
+ ("D2", "Bb"),
+ ],
+ )
+
+ def test_parse_pajet_mat(self):
+ data = """*Vertices 3\n1 "one"\n2 "two"\n3 "three"\n*Matrix\n1 1 0\n0 1 0\n0 1 0\n"""
+ G = nx.parse_pajek(data)
+ assert set(G.nodes()) == {"one", "two", "three"}
+ assert G.nodes["two"] == {"id": "2"}
+ assert edges_equal(
+ set(G.edges()),
+ {("one", "one"), ("two", "one"), ("two", "two"), ("two", "three")},
+ )
+
+ def test_read_pajek(self, tmp_path):
+ G = nx.parse_pajek(self.data)
+ # Read data from file
+ fname = tmp_path / "test.pjk"
+ with open(fname, "wb") as fh:
+ fh.write(self.data.encode("UTF-8"))
+
+ Gin = nx.read_pajek(fname)
+ assert sorted(G.nodes()) == sorted(Gin.nodes())
+ assert edges_equal(G.edges(), Gin.edges())
+ assert self.G.graph == Gin.graph
+ for n in G:
+ assert G.nodes[n] == Gin.nodes[n]
+
+ def test_write_pajek(self):
+ import io
+
+ G = nx.parse_pajek(self.data)
+ fh = io.BytesIO()
+ nx.write_pajek(G, fh)
+ fh.seek(0)
+ H = nx.read_pajek(fh)
+ assert nodes_equal(list(G), list(H))
+ assert edges_equal(list(G.edges()), list(H.edges()))
+ # Graph name is left out for now, therefore it is not tested.
+ # assert_equal(G.graph, H.graph)
+
+ def test_ignored_attribute(self):
+ import io
+
+ G = nx.Graph()
+ fh = io.BytesIO()
+ G.add_node(1, int_attr=1)
+ G.add_node(2, empty_attr=" ")
+ G.add_edge(1, 2, int_attr=2)
+ G.add_edge(2, 3, empty_attr=" ")
+
+ import warnings
+
+ with warnings.catch_warnings(record=True) as w:
+ nx.write_pajek(G, fh)
+ assert len(w) == 4
+
+ def test_noname(self):
+ # Make sure we can parse a line such as: *network
+ # Issue #952
+ line = "*network\n"
+ other_lines = self.data.split("\n")[1:]
+ data = line + "\n".join(other_lines)
+ G = nx.parse_pajek(data)
+
+ def test_unicode(self):
+ import io
+
+ G = nx.Graph()
+ name1 = chr(2344) + chr(123) + chr(6543)
+ name2 = chr(5543) + chr(1543) + chr(324)
+ G.add_edge(name1, "Radiohead", foo=name2)
+ fh = io.BytesIO()
+ nx.write_pajek(G, fh)
+ fh.seek(0)
+ H = nx.read_pajek(fh)
+ assert nodes_equal(list(G), list(H))
+ assert edges_equal(list(G.edges()), list(H.edges()))
+ assert G.graph == H.graph
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/text.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/text.py
new file mode 100644
index 0000000000000000000000000000000000000000..c54901d14c6ed2c16c3bcb8c70a428a7d0821a1f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/readwrite/text.py
@@ -0,0 +1,852 @@
+"""
+Text-based visual representations of graphs
+"""
+
+import sys
+import warnings
+from collections import defaultdict
+
+import networkx as nx
+from networkx.utils import open_file
+
+__all__ = ["generate_network_text", "write_network_text"]
+
+
+class BaseGlyphs:
+ @classmethod
+ def as_dict(cls):
+ return {
+ a: getattr(cls, a)
+ for a in dir(cls)
+ if not a.startswith("_") and a != "as_dict"
+ }
+
+
+class AsciiBaseGlyphs(BaseGlyphs):
+ empty: str = "+"
+ newtree_last: str = "+-- "
+ newtree_mid: str = "+-- "
+ endof_forest: str = " "
+ within_forest: str = ": "
+ within_tree: str = "| "
+
+
+class AsciiDirectedGlyphs(AsciiBaseGlyphs):
+ last: str = "L-> "
+ mid: str = "|-> "
+ backedge: str = "<-"
+ vertical_edge: str = "!"
+
+
+class AsciiUndirectedGlyphs(AsciiBaseGlyphs):
+ last: str = "L-- "
+ mid: str = "|-- "
+ backedge: str = "-"
+ vertical_edge: str = "|"
+
+
+class UtfBaseGlyphs(BaseGlyphs):
+ # Notes on available box and arrow characters
+ # https://en.wikipedia.org/wiki/Box-drawing_character
+ # https://stackoverflow.com/questions/2701192/triangle-arrow
+ empty: str = "╙"
+ newtree_last: str = "╙── "
+ newtree_mid: str = "╟── "
+ endof_forest: str = " "
+ within_forest: str = "╎ "
+ within_tree: str = "│ "
+
+
+class UtfDirectedGlyphs(UtfBaseGlyphs):
+ last: str = "└─╼ "
+ mid: str = "├─╼ "
+ backedge: str = "╾"
+ vertical_edge: str = "╽"
+
+
+class UtfUndirectedGlyphs(UtfBaseGlyphs):
+ last: str = "└── "
+ mid: str = "├── "
+ backedge: str = "─"
+ vertical_edge: str = "│"
+
+
+def generate_network_text(
+ graph,
+ with_labels=True,
+ sources=None,
+ max_depth=None,
+ ascii_only=False,
+ vertical_chains=False,
+):
+ """Generate lines in the "network text" format
+
+ This works via a depth-first traversal of the graph and writing a line for
+ each unique node encountered. Non-tree edges are written to the right of
+ each node, and connection to a non-tree edge is indicated with an ellipsis.
+ This representation works best when the input graph is a forest, but any
+ graph can be represented.
+
+ This notation is original to networkx, although it is simple enough that it
+ may be known in existing literature. See #5602 for details. The procedure
+ is summarized as follows:
+
+ 1. Given a set of source nodes (which can be specified, or automatically
+ discovered via finding the (strongly) connected components and choosing one
+ node with minimum degree from each), we traverse the graph in depth first
+ order.
+
+ 2. Each reachable node will be printed exactly once on it's own line.
+
+ 3. Edges are indicated in one of four ways:
+
+ a. a parent "L-style" connection on the upper left. This corresponds to
+ a traversal in the directed DFS tree.
+
+ b. a backref "<-style" connection shown directly on the right. For
+ directed graphs, these are drawn for any incoming edges to a node that
+ is not a parent edge. For undirected graphs, these are drawn for only
+ the non-parent edges that have already been represented (The edges that
+ have not been represented will be handled in the recursive case).
+
+ c. a child "L-style" connection on the lower right. Drawing of the
+ children are handled recursively.
+
+ d. if ``vertical_chains`` is true, and a parent node only has one child
+ a "vertical-style" edge is drawn between them.
+
+ 4. The children of each node (wrt the directed DFS tree) are drawn
+ underneath and to the right of it. In the case that a child node has already
+ been drawn the connection is replaced with an ellipsis ("...") to indicate
+ that there is one or more connections represented elsewhere.
+
+ 5. If a maximum depth is specified, an edge to nodes past this maximum
+ depth will be represented by an ellipsis.
+
+ 6. If a node has a truthy "collapse" value, then we do not traverse past
+ that node.
+
+ Parameters
+ ----------
+ graph : nx.DiGraph | nx.Graph
+ Graph to represent
+
+ with_labels : bool | str
+ If True will use the "label" attribute of a node to display if it
+ exists otherwise it will use the node value itself. If given as a
+ string, then that attribute name will be used instead of "label".
+ Defaults to True.
+
+ sources : List
+ Specifies which nodes to start traversal from. Note: nodes that are not
+ reachable from one of these sources may not be shown. If unspecified,
+ the minimal set of nodes needed to reach all others will be used.
+
+ max_depth : int | None
+ The maximum depth to traverse before stopping. Defaults to None.
+
+ ascii_only : Boolean
+ If True only ASCII characters are used to construct the visualization
+
+ vertical_chains : Boolean
+ If True, chains of nodes will be drawn vertically when possible.
+
+ Yields
+ ------
+ str : a line of generated text
+
+ Examples
+ --------
+ >>> graph = nx.path_graph(10)
+ >>> graph.add_node("A")
+ >>> graph.add_node("B")
+ >>> graph.add_node("C")
+ >>> graph.add_node("D")
+ >>> graph.add_edge(9, "A")
+ >>> graph.add_edge(9, "B")
+ >>> graph.add_edge(9, "C")
+ >>> graph.add_edge("C", "D")
+ >>> graph.add_edge("C", "E")
+ >>> graph.add_edge("C", "F")
+ >>> nx.write_network_text(graph)
+ ╙── 0
+ └── 1
+ └── 2
+ └── 3
+ └── 4
+ └── 5
+ └── 6
+ └── 7
+ └── 8
+ └── 9
+ ├── A
+ ├── B
+ └── C
+ ├── D
+ ├── E
+ └── F
+ >>> nx.write_network_text(graph, vertical_chains=True)
+ ╙── 0
+ │
+ 1
+ │
+ 2
+ │
+ 3
+ │
+ 4
+ │
+ 5
+ │
+ 6
+ │
+ 7
+ │
+ 8
+ │
+ 9
+ ├── A
+ ├── B
+ └── C
+ ├── D
+ ├── E
+ └── F
+ """
+ from typing import Any, NamedTuple
+
+ class StackFrame(NamedTuple):
+ parent: Any
+ node: Any
+ indents: list
+ this_islast: bool
+ this_vertical: bool
+
+ collapse_attr = "collapse"
+
+ is_directed = graph.is_directed()
+
+ if is_directed:
+ glyphs = AsciiDirectedGlyphs if ascii_only else UtfDirectedGlyphs
+ succ = graph.succ
+ pred = graph.pred
+ else:
+ glyphs = AsciiUndirectedGlyphs if ascii_only else UtfUndirectedGlyphs
+ succ = graph.adj
+ pred = graph.adj
+
+ if isinstance(with_labels, str):
+ label_attr = with_labels
+ elif with_labels:
+ label_attr = "label"
+ else:
+ label_attr = None
+
+ if max_depth == 0:
+ yield glyphs.empty + " ..."
+ elif len(graph.nodes) == 0:
+ yield glyphs.empty
+ else:
+ # If the nodes to traverse are unspecified, find the minimal set of
+ # nodes that will reach the entire graph
+ if sources is None:
+ sources = _find_sources(graph)
+
+ # Populate the stack with each:
+ # 1. parent node in the DFS tree (or None for root nodes),
+ # 2. the current node in the DFS tree
+ # 2. a list of indentations indicating depth
+ # 3. a flag indicating if the node is the final one to be written.
+ # Reverse the stack so sources are popped in the correct order.
+ last_idx = len(sources) - 1
+ stack = [
+ StackFrame(None, node, [], (idx == last_idx), False)
+ for idx, node in enumerate(sources)
+ ][::-1]
+
+ num_skipped_children = defaultdict(lambda: 0)
+ seen_nodes = set()
+ while stack:
+ parent, node, indents, this_islast, this_vertical = stack.pop()
+
+ if node is not Ellipsis:
+ skip = node in seen_nodes
+ if skip:
+ # Mark that we skipped a parent's child
+ num_skipped_children[parent] += 1
+
+ if this_islast:
+ # If we reached the last child of a parent, and we skipped
+ # any of that parents children, then we should emit an
+ # ellipsis at the end after this.
+ if num_skipped_children[parent] and parent is not None:
+ # Append the ellipsis to be emitted last
+ next_islast = True
+ try_frame = StackFrame(
+ node, Ellipsis, indents, next_islast, False
+ )
+ stack.append(try_frame)
+
+ # Redo this frame, but not as a last object
+ next_islast = False
+ try_frame = StackFrame(
+ parent, node, indents, next_islast, this_vertical
+ )
+ stack.append(try_frame)
+ continue
+
+ if skip:
+ continue
+ seen_nodes.add(node)
+
+ if not indents:
+ # Top level items (i.e. trees in the forest) get different
+ # glyphs to indicate they are not actually connected
+ if this_islast:
+ this_vertical = False
+ this_prefix = indents + [glyphs.newtree_last]
+ next_prefix = indents + [glyphs.endof_forest]
+ else:
+ this_prefix = indents + [glyphs.newtree_mid]
+ next_prefix = indents + [glyphs.within_forest]
+
+ else:
+ # Non-top-level items
+ if this_vertical:
+ this_prefix = indents
+ next_prefix = indents
+ else:
+ if this_islast:
+ this_prefix = indents + [glyphs.last]
+ next_prefix = indents + [glyphs.endof_forest]
+ else:
+ this_prefix = indents + [glyphs.mid]
+ next_prefix = indents + [glyphs.within_tree]
+
+ if node is Ellipsis:
+ label = " ..."
+ suffix = ""
+ children = []
+ else:
+ if label_attr is not None:
+ label = str(graph.nodes[node].get(label_attr, node))
+ else:
+ label = str(node)
+
+ # Determine if we want to show the children of this node.
+ if collapse_attr is not None:
+ collapse = graph.nodes[node].get(collapse_attr, False)
+ else:
+ collapse = False
+
+ # Determine:
+ # (1) children to traverse into after showing this node.
+ # (2) parents to immediately show to the right of this node.
+ if is_directed:
+ # In the directed case we must show every successor node
+ # note: it may be skipped later, but we don't have that
+ # information here.
+ children = list(succ[node])
+ # In the directed case we must show every predecessor
+ # except for parent we directly traversed from.
+ handled_parents = {parent}
+ else:
+ # Showing only the unseen children results in a more
+ # concise representation for the undirected case.
+ children = [
+ child for child in succ[node] if child not in seen_nodes
+ ]
+
+ # In the undirected case, parents are also children, so we
+ # only need to immediately show the ones we can no longer
+ # traverse
+ handled_parents = {*children, parent}
+
+ if max_depth is not None and len(indents) == max_depth - 1:
+ # Use ellipsis to indicate we have reached maximum depth
+ if children:
+ children = [Ellipsis]
+ handled_parents = {parent}
+
+ if collapse:
+ # Collapsing a node is the same as reaching maximum depth
+ if children:
+ children = [Ellipsis]
+ handled_parents = {parent}
+
+ # The other parents are other predecessors of this node that
+ # are not handled elsewhere.
+ other_parents = [p for p in pred[node] if p not in handled_parents]
+ if other_parents:
+ if label_attr is not None:
+ other_parents_labels = ", ".join(
+ [
+ str(graph.nodes[p].get(label_attr, p))
+ for p in other_parents
+ ]
+ )
+ else:
+ other_parents_labels = ", ".join(
+ [str(p) for p in other_parents]
+ )
+ suffix = " ".join(["", glyphs.backedge, other_parents_labels])
+ else:
+ suffix = ""
+
+ # Emit the line for this node, this will be called for each node
+ # exactly once.
+ if this_vertical:
+ yield "".join(this_prefix + [glyphs.vertical_edge])
+
+ yield "".join(this_prefix + [label, suffix])
+
+ if vertical_chains:
+ if is_directed:
+ num_children = len(set(children))
+ else:
+ num_children = len(set(children) - {parent})
+ # The next node can be drawn vertically if it is the only
+ # remaining child of this node.
+ next_is_vertical = num_children == 1
+ else:
+ next_is_vertical = False
+
+ # Push children on the stack in reverse order so they are popped in
+ # the original order.
+ for idx, child in enumerate(children[::-1]):
+ next_islast = idx == 0
+ try_frame = StackFrame(
+ node, child, next_prefix, next_islast, next_is_vertical
+ )
+ stack.append(try_frame)
+
+
+@open_file(1, "w")
+def write_network_text(
+ graph,
+ path=None,
+ with_labels=True,
+ sources=None,
+ max_depth=None,
+ ascii_only=False,
+ end="\n",
+ vertical_chains=False,
+):
+ """Creates a nice text representation of a graph
+
+ This works via a depth-first traversal of the graph and writing a line for
+ each unique node encountered. Non-tree edges are written to the right of
+ each node, and connection to a non-tree edge is indicated with an ellipsis.
+ This representation works best when the input graph is a forest, but any
+ graph can be represented.
+
+ Parameters
+ ----------
+ graph : nx.DiGraph | nx.Graph
+ Graph to represent
+
+ path : string or file or callable or None
+ Filename or file handle for data output.
+ if a function, then it will be called for each generated line.
+ if None, this will default to "sys.stdout.write"
+
+ with_labels : bool | str
+ If True will use the "label" attribute of a node to display if it
+ exists otherwise it will use the node value itself. If given as a
+ string, then that attribute name will be used instead of "label".
+ Defaults to True.
+
+ sources : List
+ Specifies which nodes to start traversal from. Note: nodes that are not
+ reachable from one of these sources may not be shown. If unspecified,
+ the minimal set of nodes needed to reach all others will be used.
+
+ max_depth : int | None
+ The maximum depth to traverse before stopping. Defaults to None.
+
+ ascii_only : Boolean
+ If True only ASCII characters are used to construct the visualization
+
+ end : string
+ The line ending character
+
+ vertical_chains : Boolean
+ If True, chains of nodes will be drawn vertically when possible.
+
+ Examples
+ --------
+ >>> graph = nx.balanced_tree(r=2, h=2, create_using=nx.DiGraph)
+ >>> nx.write_network_text(graph)
+ ╙── 0
+ ├─╼ 1
+ │ ├─╼ 3
+ │ └─╼ 4
+ └─╼ 2
+ ├─╼ 5
+ └─╼ 6
+
+ >>> # A near tree with one non-tree edge
+ >>> graph.add_edge(5, 1)
+ >>> nx.write_network_text(graph)
+ ╙── 0
+ ├─╼ 1 ╾ 5
+ │ ├─╼ 3
+ │ └─╼ 4
+ └─╼ 2
+ ├─╼ 5
+ │ └─╼ ...
+ └─╼ 6
+
+ >>> graph = nx.cycle_graph(5)
+ >>> nx.write_network_text(graph)
+ ╙── 0
+ ├── 1
+ │ └── 2
+ │ └── 3
+ │ └── 4 ─ 0
+ └── ...
+
+ >>> graph = nx.cycle_graph(5, nx.DiGraph)
+ >>> nx.write_network_text(graph, vertical_chains=True)
+ ╙── 0 ╾ 4
+ ╽
+ 1
+ ╽
+ 2
+ ╽
+ 3
+ ╽
+ 4
+ └─╼ ...
+
+ >>> nx.write_network_text(graph, vertical_chains=True, ascii_only=True)
+ +-- 0 <- 4
+ !
+ 1
+ !
+ 2
+ !
+ 3
+ !
+ 4
+ L-> ...
+
+ >>> graph = nx.generators.barbell_graph(4, 2)
+ >>> nx.write_network_text(graph, vertical_chains=False)
+ ╙── 4
+ ├── 5
+ │ └── 6
+ │ ├── 7
+ │ │ ├── 8 ─ 6
+ │ │ │ └── 9 ─ 6, 7
+ │ │ └── ...
+ │ └── ...
+ └── 3
+ ├── 0
+ │ ├── 1 ─ 3
+ │ │ └── 2 ─ 0, 3
+ │ └── ...
+ └── ...
+ >>> nx.write_network_text(graph, vertical_chains=True)
+ ╙── 4
+ ├── 5
+ │ │
+ │ 6
+ │ ├── 7
+ │ │ ├── 8 ─ 6
+ │ │ │ │
+ │ │ │ 9 ─ 6, 7
+ │ │ └── ...
+ │ └── ...
+ └── 3
+ ├── 0
+ │ ├── 1 ─ 3
+ │ │ │
+ │ │ 2 ─ 0, 3
+ │ └── ...
+ └── ...
+
+ >>> graph = nx.complete_graph(5, create_using=nx.Graph)
+ >>> nx.write_network_text(graph)
+ ╙── 0
+ ├── 1
+ │ ├── 2 ─ 0
+ │ │ ├── 3 ─ 0, 1
+ │ │ │ └── 4 ─ 0, 1, 2
+ │ │ └── ...
+ │ └── ...
+ └── ...
+
+ >>> graph = nx.complete_graph(3, create_using=nx.DiGraph)
+ >>> nx.write_network_text(graph)
+ ╙── 0 ╾ 1, 2
+ ├─╼ 1 ╾ 2
+ │ ├─╼ 2 ╾ 0
+ │ │ └─╼ ...
+ │ └─╼ ...
+ └─╼ ...
+ """
+ if path is None:
+ # The path is unspecified, write to stdout
+ _write = sys.stdout.write
+ elif hasattr(path, "write"):
+ # The path is already an open file
+ _write = path.write
+ elif callable(path):
+ # The path is a custom callable
+ _write = path
+ else:
+ raise TypeError(type(path))
+
+ for line in generate_network_text(
+ graph,
+ with_labels=with_labels,
+ sources=sources,
+ max_depth=max_depth,
+ ascii_only=ascii_only,
+ vertical_chains=vertical_chains,
+ ):
+ _write(line + end)
+
+
+def _find_sources(graph):
+ """
+ Determine a minimal set of nodes such that the entire graph is reachable
+ """
+ # For each connected part of the graph, choose at least
+ # one node as a starting point, preferably without a parent
+ if graph.is_directed():
+ # Choose one node from each SCC with minimum in_degree
+ sccs = list(nx.strongly_connected_components(graph))
+ # condensing the SCCs forms a dag, the nodes in this graph with
+ # 0 in-degree correspond to the SCCs from which the minimum set
+ # of nodes from which all other nodes can be reached.
+ scc_graph = nx.condensation(graph, sccs)
+ supernode_to_nodes = {sn: [] for sn in scc_graph.nodes()}
+ # Note: the order of mapping differs between pypy and cpython
+ # so we have to loop over graph nodes for consistency
+ mapping = scc_graph.graph["mapping"]
+ for n in graph.nodes:
+ sn = mapping[n]
+ supernode_to_nodes[sn].append(n)
+ sources = []
+ for sn in scc_graph.nodes():
+ if scc_graph.in_degree[sn] == 0:
+ scc = supernode_to_nodes[sn]
+ node = min(scc, key=lambda n: graph.in_degree[n])
+ sources.append(node)
+ else:
+ # For undirected graph, the entire graph will be reachable as
+ # long as we consider one node from every connected component
+ sources = [
+ min(cc, key=lambda n: graph.degree[n])
+ for cc in nx.connected_components(graph)
+ ]
+ sources = sorted(sources, key=lambda n: graph.degree[n])
+ return sources
+
+
+def _parse_network_text(lines):
+ """Reconstructs a graph from a network text representation.
+
+ This is mainly used for testing. Network text is for display, not
+ serialization, as such this cannot parse all network text representations
+ because node labels can be ambiguous with the glyphs and indentation used
+ to represent edge structure. Additionally, there is no way to determine if
+ disconnected graphs were originally directed or undirected.
+
+ Parameters
+ ----------
+ lines : list or iterator of strings
+ Input data in network text format
+
+ Returns
+ -------
+ G: NetworkX graph
+ The graph corresponding to the lines in network text format.
+ """
+ from itertools import chain
+ from typing import Any, NamedTuple, Union
+
+ class ParseStackFrame(NamedTuple):
+ node: Any
+ indent: int
+ has_vertical_child: int | None
+
+ initial_line_iter = iter(lines)
+
+ is_ascii = None
+ is_directed = None
+
+ ##############
+ # Initial Pass
+ ##############
+
+ # Do an initial pass over the lines to determine what type of graph it is.
+ # Remember what these lines were, so we can reiterate over them in the
+ # parsing pass.
+ initial_lines = []
+ try:
+ first_line = next(initial_line_iter)
+ except StopIteration:
+ ...
+ else:
+ initial_lines.append(first_line)
+ # The first character indicates if it is an ASCII or UTF graph
+ first_char = first_line[0]
+ if first_char in {
+ UtfBaseGlyphs.empty,
+ UtfBaseGlyphs.newtree_mid[0],
+ UtfBaseGlyphs.newtree_last[0],
+ }:
+ is_ascii = False
+ elif first_char in {
+ AsciiBaseGlyphs.empty,
+ AsciiBaseGlyphs.newtree_mid[0],
+ AsciiBaseGlyphs.newtree_last[0],
+ }:
+ is_ascii = True
+ else:
+ raise AssertionError(f"Unexpected first character: {first_char}")
+
+ if is_ascii:
+ directed_glyphs = AsciiDirectedGlyphs.as_dict()
+ undirected_glyphs = AsciiUndirectedGlyphs.as_dict()
+ else:
+ directed_glyphs = UtfDirectedGlyphs.as_dict()
+ undirected_glyphs = UtfUndirectedGlyphs.as_dict()
+
+ # For both directed / undirected glyphs, determine which glyphs never
+ # appear as substrings in the other undirected / directed glyphs. Glyphs
+ # with this property unambiguously indicates if a graph is directed /
+ # undirected.
+ directed_items = set(directed_glyphs.values())
+ undirected_items = set(undirected_glyphs.values())
+ unambiguous_directed_items = []
+ for item in directed_items:
+ other_items = undirected_items
+ other_supersets = [other for other in other_items if item in other]
+ if not other_supersets:
+ unambiguous_directed_items.append(item)
+ unambiguous_undirected_items = []
+ for item in undirected_items:
+ other_items = directed_items
+ other_supersets = [other for other in other_items if item in other]
+ if not other_supersets:
+ unambiguous_undirected_items.append(item)
+
+ for line in initial_line_iter:
+ initial_lines.append(line)
+ if any(item in line for item in unambiguous_undirected_items):
+ is_directed = False
+ break
+ elif any(item in line for item in unambiguous_directed_items):
+ is_directed = True
+ break
+
+ if is_directed is None:
+ # Not enough information to determine, choose undirected by default
+ is_directed = False
+
+ glyphs = directed_glyphs if is_directed else undirected_glyphs
+
+ # the backedge symbol by itself can be ambiguous, but with spaces around it
+ # becomes unambiguous.
+ backedge_symbol = " " + glyphs["backedge"] + " "
+
+ # Reconstruct an iterator over all of the lines.
+ parsing_line_iter = chain(initial_lines, initial_line_iter)
+
+ ##############
+ # Parsing Pass
+ ##############
+
+ edges = []
+ nodes = []
+ is_empty = None
+
+ noparent = object() # sentinel value
+
+ # keep a stack of previous nodes that could be parents of subsequent nodes
+ stack = [ParseStackFrame(noparent, -1, None)]
+
+ for line in parsing_line_iter:
+ if line == glyphs["empty"]:
+ # If the line is the empty glyph, we are done.
+ # There shouldn't be anything else after this.
+ is_empty = True
+ continue
+
+ if backedge_symbol in line:
+ # This line has one or more backedges, separate those out
+ node_part, backedge_part = line.split(backedge_symbol)
+ backedge_nodes = [u.strip() for u in backedge_part.split(", ")]
+ # Now the node can be parsed
+ node_part = node_part.rstrip()
+ prefix, node = node_part.rsplit(" ", 1)
+ node = node.strip()
+ # Add the backedges to the edge list
+ edges.extend([(u, node) for u in backedge_nodes])
+ else:
+ # No backedge, the tail of this line is the node
+ prefix, node = line.rsplit(" ", 1)
+ node = node.strip()
+
+ prev = stack.pop()
+
+ if node in glyphs["vertical_edge"]:
+ # Previous node is still the previous node, but we know it will
+ # have exactly one child, which will need to have its nesting level
+ # adjusted.
+ modified_prev = ParseStackFrame(
+ prev.node,
+ prev.indent,
+ True,
+ )
+ stack.append(modified_prev)
+ continue
+
+ # The length of the string before the node characters give us a hint
+ # about our nesting level. The only case where this doesn't work is
+ # when there are vertical chains, which is handled explicitly.
+ indent = len(prefix)
+ curr = ParseStackFrame(node, indent, None)
+
+ if prev.has_vertical_child:
+ # In this case we know prev must be the parent of our current line,
+ # so we don't have to search the stack. (which is good because the
+ # indentation check wouldn't work in this case).
+ ...
+ else:
+ # If the previous node nesting-level is greater than the current
+ # nodes nesting-level than the previous node was the end of a path,
+ # and is not our parent. We can safely pop nodes off the stack
+ # until we find one with a comparable nesting-level, which is our
+ # parent.
+ while curr.indent <= prev.indent:
+ prev = stack.pop()
+
+ if node == "...":
+ # The current previous node is no longer a valid parent,
+ # keep it popped from the stack.
+ stack.append(prev)
+ else:
+ # The previous and current nodes may still be parents, so add them
+ # back onto the stack.
+ stack.append(prev)
+ stack.append(curr)
+
+ # Add the node and the edge to its parent to the node / edge lists.
+ nodes.append(curr.node)
+ if prev.node is not noparent:
+ edges.append((prev.node, curr.node))
+
+ if is_empty:
+ # Sanity check
+ assert len(nodes) == 0
+
+ # Reconstruct the graph
+ cls = nx.DiGraph if is_directed else nx.Graph
+ new = cls()
+ new.add_nodes_from(nodes)
+ new.add_edges_from(edges)
+ return new
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/relabel.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/relabel.py
new file mode 100644
index 0000000000000000000000000000000000000000..4b870f726ef42e0bcaa7bf724e2ae6ab4145f288
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/networkx/relabel.py
@@ -0,0 +1,285 @@
+import networkx as nx
+
+__all__ = ["convert_node_labels_to_integers", "relabel_nodes"]
+
+
+@nx._dispatchable(
+ preserve_all_attrs=True, mutates_input={"not copy": 2}, returns_graph=True
+)
+def relabel_nodes(G, mapping, copy=True):
+ """Relabel the nodes of the graph G according to a given mapping.
+
+ The original node ordering may not be preserved if `copy` is `False` and the
+ mapping includes overlap between old and new labels.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ mapping : dictionary
+ A dictionary with the old labels as keys and new labels as values.
+ A partial mapping is allowed. Mapping 2 nodes to a single node is allowed.
+ Any non-node keys in the mapping are ignored.
+
+ copy : bool (optional, default=True)
+ If True return a copy, or if False relabel the nodes in place.
+
+ Examples
+ --------
+ To create a new graph with nodes relabeled according to a given
+ dictionary:
+
+ >>> G = nx.path_graph(3)
+ >>> sorted(G)
+ [0, 1, 2]
+ >>> mapping = {0: "a", 1: "b", 2: "c"}
+ >>> H = nx.relabel_nodes(G, mapping)
+ >>> sorted(H)
+ ['a', 'b', 'c']
+
+ Nodes can be relabeled with any hashable object, including numbers
+ and strings:
+
+ >>> import string
+ >>> G = nx.path_graph(26) # nodes are integers 0 through 25
+ >>> sorted(G)[:3]
+ [0, 1, 2]
+ >>> mapping = dict(zip(G, string.ascii_lowercase))
+ >>> G = nx.relabel_nodes(G, mapping) # nodes are characters a through z
+ >>> sorted(G)[:3]
+ ['a', 'b', 'c']
+ >>> mapping = dict(zip(G, range(1, 27)))
+ >>> G = nx.relabel_nodes(G, mapping) # nodes are integers 1 through 26
+ >>> sorted(G)[:3]
+ [1, 2, 3]
+
+ To perform a partial in-place relabeling, provide a dictionary
+ mapping only a subset of the nodes, and set the `copy` keyword
+ argument to False:
+
+ >>> G = nx.path_graph(3) # nodes 0-1-2
+ >>> mapping = {0: "a", 1: "b"} # 0->'a' and 1->'b'
+ >>> G = nx.relabel_nodes(G, mapping, copy=False)
+ >>> sorted(G, key=str)
+ [2, 'a', 'b']
+
+ A mapping can also be given as a function:
+
+ >>> G = nx.path_graph(3)
+ >>> H = nx.relabel_nodes(G, lambda x: x**2)
+ >>> list(H)
+ [0, 1, 4]
+
+ In a multigraph, relabeling two or more nodes to the same new node
+ will retain all edges, but may change the edge keys in the process:
+
+ >>> G = nx.MultiGraph()
+ >>> G.add_edge(0, 1, value="a") # returns the key for this edge
+ 0
+ >>> G.add_edge(0, 2, value="b")
+ 0
+ >>> G.add_edge(0, 3, value="c")
+ 0
+ >>> mapping = {1: 4, 2: 4, 3: 4}
+ >>> H = nx.relabel_nodes(G, mapping, copy=True)
+ >>> print(H[0])
+ {4: {0: {'value': 'a'}, 1: {'value': 'b'}, 2: {'value': 'c'}}}
+
+ This works for in-place relabeling too:
+
+ >>> G = nx.relabel_nodes(G, mapping, copy=False)
+ >>> print(G[0])
+ {4: {0: {'value': 'a'}, 1: {'value': 'b'}, 2: {'value': 'c'}}}
+
+ Notes
+ -----
+ Only the nodes specified in the mapping will be relabeled.
+ Any non-node keys in the mapping are ignored.
+
+ The keyword setting copy=False modifies the graph in place.
+ Relabel_nodes avoids naming collisions by building a
+ directed graph from ``mapping`` which specifies the order of
+ relabelings. Naming collisions, such as a->b, b->c, are ordered
+ such that "b" gets renamed to "c" before "a" gets renamed "b".
+ In cases of circular mappings (e.g. a->b, b->a), modifying the
+ graph is not possible in-place and an exception is raised.
+ In that case, use copy=True.
+
+ If a relabel operation on a multigraph would cause two or more
+ edges to have the same source, target and key, the second edge must
+ be assigned a new key to retain all edges. The new key is set
+ to the lowest non-negative integer not already used as a key
+ for edges between these two nodes. Note that this means non-numeric
+ keys may be replaced by numeric keys.
+
+ See Also
+ --------
+ convert_node_labels_to_integers
+ """
+ # you can pass any callable e.g. f(old_label) -> new_label or
+ # e.g. str(old_label) -> new_label, but we'll just make a dictionary here regardless
+ m = {n: mapping(n) for n in G} if callable(mapping) else mapping
+
+ if copy:
+ return _relabel_copy(G, m)
+ else:
+ return _relabel_inplace(G, m)
+
+
+def _relabel_inplace(G, mapping):
+ if len(mapping.keys() & mapping.values()) > 0:
+ # labels sets overlap
+ # can we topological sort and still do the relabeling?
+ D = nx.DiGraph(list(mapping.items()))
+ D.remove_edges_from(nx.selfloop_edges(D))
+ try:
+ nodes = reversed(list(nx.topological_sort(D)))
+ except nx.NetworkXUnfeasible as err:
+ raise nx.NetworkXUnfeasible(
+ "The node label sets are overlapping and no ordering can "
+ "resolve the mapping. Use copy=True."
+ ) from err
+ else:
+ # non-overlapping label sets, sort them in the order of G nodes
+ nodes = [n for n in G if n in mapping]
+
+ multigraph = G.is_multigraph()
+ directed = G.is_directed()
+
+ for old in nodes:
+ # Test that old is in both mapping and G, otherwise ignore.
+ try:
+ new = mapping[old]
+ G.add_node(new, **G.nodes[old])
+ except KeyError:
+ continue
+ if new == old:
+ continue
+ if multigraph:
+ new_edges = [
+ (new, new if old == target else target, key, data)
+ for (_, target, key, data) in G.edges(old, data=True, keys=True)
+ ]
+ if directed:
+ new_edges += [
+ (new if old == source else source, new, key, data)
+ for (source, _, key, data) in G.in_edges(old, data=True, keys=True)
+ ]
+ # Ensure new edges won't overwrite existing ones
+ seen = set()
+ for i, (source, target, key, data) in enumerate(new_edges):
+ if target in G[source] and key in G[source][target]:
+ new_key = 0 if not isinstance(key, int | float) else key
+ while new_key in G[source][target] or (target, new_key) in seen:
+ new_key += 1
+ new_edges[i] = (source, target, new_key, data)
+ seen.add((target, new_key))
+ else:
+ new_edges = [
+ (new, new if old == target else target, data)
+ for (_, target, data) in G.edges(old, data=True)
+ ]
+ if directed:
+ new_edges += [
+ (new if old == source else source, new, data)
+ for (source, _, data) in G.in_edges(old, data=True)
+ ]
+ G.remove_node(old)
+ G.add_edges_from(new_edges)
+ return G
+
+
+def _relabel_copy(G, mapping):
+ H = G.__class__()
+ H.add_nodes_from(mapping.get(n, n) for n in G)
+ H._node.update((mapping.get(n, n), d.copy()) for n, d in G.nodes.items())
+ if G.is_multigraph():
+ new_edges = [
+ (mapping.get(n1, n1), mapping.get(n2, n2), k, d.copy())
+ for (n1, n2, k, d) in G.edges(keys=True, data=True)
+ ]
+
+ # check for conflicting edge-keys
+ undirected = not G.is_directed()
+ seen_edges = set()
+ for i, (source, target, key, data) in enumerate(new_edges):
+ while (source, target, key) in seen_edges:
+ if not isinstance(key, int | float):
+ key = 0
+ key += 1
+ seen_edges.add((source, target, key))
+ if undirected:
+ seen_edges.add((target, source, key))
+ new_edges[i] = (source, target, key, data)
+
+ H.add_edges_from(new_edges)
+ else:
+ H.add_edges_from(
+ (mapping.get(n1, n1), mapping.get(n2, n2), d.copy())
+ for (n1, n2, d) in G.edges(data=True)
+ )
+ H.graph.update(G.graph)
+ return H
+
+
+@nx._dispatchable(preserve_all_attrs=True, returns_graph=True)
+def convert_node_labels_to_integers(
+ G, first_label=0, ordering="default", label_attribute=None
+):
+ """Returns a copy of the graph G with the nodes relabeled using
+ consecutive integers.
+
+ Parameters
+ ----------
+ G : graph
+ A NetworkX graph
+
+ first_label : int, optional (default=0)
+ An integer specifying the starting offset in numbering nodes.
+ The new integer labels are numbered first_label, ..., n-1+first_label.
+
+ ordering : string
+ "default" : inherit node ordering from G.nodes()
+ "sorted" : inherit node ordering from sorted(G.nodes())
+ "increasing degree" : nodes are sorted by increasing degree
+ "decreasing degree" : nodes are sorted by decreasing degree
+
+ label_attribute : string, optional (default=None)
+ Name of node attribute to store old label. If None no attribute
+ is created.
+
+ Notes
+ -----
+ Node and edge attribute data are copied to the new (relabeled) graph.
+
+ There is no guarantee that the relabeling of nodes to integers will
+ give the same two integers for two (even identical graphs).
+ Use the `ordering` argument to try to preserve the order.
+
+ See Also
+ --------
+ relabel_nodes
+ """
+ N = G.number_of_nodes() + first_label
+ if ordering == "default":
+ mapping = dict(zip(G.nodes(), range(first_label, N)))
+ elif ordering == "sorted":
+ nlist = sorted(G.nodes())
+ mapping = dict(zip(nlist, range(first_label, N)))
+ elif ordering == "increasing degree":
+ dv_pairs = [(d, n) for (n, d) in G.degree()]
+ dv_pairs.sort() # in-place sort from lowest to highest degree
+ mapping = dict(zip([n for d, n in dv_pairs], range(first_label, N)))
+ elif ordering == "decreasing degree":
+ dv_pairs = [(d, n) for (n, d) in G.degree()]
+ dv_pairs.sort() # in-place sort from lowest to highest degree
+ dv_pairs.reverse()
+ mapping = dict(zip([n for d, n in dv_pairs], range(first_label, N)))
+ else:
+ raise nx.NetworkXError(f"Unknown node ordering: {ordering}")
+ H = relabel_nodes(G, mapping)
+ # create node attribute with the old label
+ if label_attribute is not None:
+ nx.set_node_attributes(H, {v: k for k, v in mapping.items()}, label_attribute)
+ return H
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+uv
\ No newline at end of file
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/License.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/License.txt
new file mode 100644
index 0000000000000000000000000000000000000000..bcd1867a02a6a8c1e592b92e2e50f34e531f2d87
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/License.txt
@@ -0,0 +1,39 @@
+
+ Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of NVIDIA CORPORATION, Lawrence Berkeley National
+ Laboratory, the U.S. Department of Energy, nor the names of their
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ The U.S. Department of Energy funded the development of this software
+ under subcontract 7078610 with Lawrence Berkeley National Laboratory.
+
+
+This code also includes files from the NVIDIA Tools Extension SDK project.
+
+See:
+
+ https://github.com/NVIDIA/NVTX
+
+for more information and license details.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..b2aa42b97c83c523ebd80e7f0b3a8f9212fd7926
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/METADATA
@@ -0,0 +1,44 @@
+Metadata-Version: 2.2
+Name: nvidia-nccl-cu12
+Version: 2.26.2
+Summary: NVIDIA Collective Communication Library (NCCL) Runtime
+Home-page: https://developer.nvidia.com/cuda-zone
+Author: Nvidia CUDA Installer Team
+Author-email: compute_installer@nvidia.com
+License: BSD-3-Clause
+Keywords: cuda,nvidia,runtime,machine learning,deep learning
+Classifier: Development Status :: 4 - Beta
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: Education
+Classifier: Intended Audience :: Science/Research
+Classifier: License :: Other/Proprietary License
+Classifier: Natural Language :: English
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Topic :: Scientific/Engineering
+Classifier: Topic :: Scientific/Engineering :: Mathematics
+Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
+Classifier: Topic :: Software Development
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Operating System :: POSIX :: Linux
+Requires-Python: >=3
+License-File: License.txt
+Dynamic: author
+Dynamic: author-email
+Dynamic: classifier
+Dynamic: description
+Dynamic: home-page
+Dynamic: keywords
+Dynamic: license
+Dynamic: requires-python
+Dynamic: summary
+
+NCCL (pronounced "Nickel") is a stand-alone library of standard collective communication routines for GPUs, implementing all-reduce, all-gather, reduce, broadcast, and reduce-scatter. It has been optimized to achieve high bandwidth on any platform using PCIe, NVLink, NVswitch, as well as networking using InfiniBand Verbs or TCP/IP sockets.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..45973776a2e2d6ee585c68a896de6b00b2488371
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/RECORD
@@ -0,0 +1,13 @@
+nvidia/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+nvidia/nccl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+nvidia/nccl/include/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+nvidia/nccl/include/nccl.h,sha256=8Lpo1KHHmSRU9O9dvC9v6EAdoLaofpKx4A8ynXCqHaY,20478
+nvidia/nccl/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+nvidia/nccl/lib/libnccl.so.2,sha256=5Keu6cPuz1P6x4BEHS8DtXirjbiHS3H445G87HrbKJk,273386472
+nvidia_nccl_cu12-2.26.2.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
+nvidia_nccl_cu12-2.26.2.dist-info/License.txt,sha256=DwF0prTgszrCY3W_cpUzB1sy9MUaW2gCo9dC19zcmnY,1895
+nvidia_nccl_cu12-2.26.2.dist-info/METADATA,sha256=tw9hlV2itzq0Tb3xD12CK69I7WZlry-ADidTfK8nhIs,1997
+nvidia_nccl_cu12-2.26.2.dist-info/RECORD,,
+nvidia_nccl_cu12-2.26.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+nvidia_nccl_cu12-2.26.2.dist-info/WHEEL,sha256=C-9JuWX7zPIcETbq0g2dQ83ne4_xEDQIPmC-cSMWixI,144
+nvidia_nccl_cu12-2.26.2.dist-info/top_level.txt,sha256=fTkAtiFuL16nUrB9ytDDtpytz2t0B4NvYTnRzwAhO14,7
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/REQUESTED b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..04b8de3f7d6f51022dab208980b75eabd347388a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/WHEEL
@@ -0,0 +1,6 @@
+Wheel-Version: 1.0
+Generator: setuptools (75.8.2)
+Root-Is-Purelib: true
+Tag: py3-none-manylinux2014_x86_64
+Tag: py3-none-manylinux_2_17_x86_64
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..862f7abf232cdfbb928609856247292e81c9decb
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/nvidia_nccl_cu12-2.26.2.dist-info/top_level.txt
@@ -0,0 +1 @@
+nvidia
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..5c69047b2eb8235994febeeae1da4a82365a240a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+uv
\ No newline at end of file
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..733963a744c3d6710058de9f0ea316893c5492ca
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/LICENSE
@@ -0,0 +1,1250 @@
+BSD 3-Clause License
+
+Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
+All rights reserved.
+
+Copyright (c) 2011-2023, Open source contributors.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Copyright (c) 2010-2019 Keith Goodman
+Copyright (c) 2019 Bottleneck Developers
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.Copyright 2017- Paul Ganssle
+Copyright 2017- dateutil contributors (see AUTHORS file)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+The above license applies to all contributions after 2017-12-01, as well as
+all contributions that have been re-licensed (see AUTHORS file for the list of
+contributors who have re-licensed their code).
+--------------------------------------------------------------------------------
+dateutil - Extensions to the standard Python datetime module.
+
+Copyright (c) 2003-2011 - Gustavo Niemeyer
+Copyright (c) 2012-2014 - Tomi Pieviläinen
+Copyright (c) 2014-2016 - Yaron de Leeuw
+Copyright (c) 2015- - Paul Ganssle
+Copyright (c) 2015- - dateutil contributors (see AUTHORS file)
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The above BSD License Applies to all code, even that also covered by Apache 2.0.# MIT License
+
+Copyright (c) 2019 Hadley Wickham; RStudio; and Evan Miller
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+Based on http://opensource.org/licenses/MIT
+
+This is a template. Complete and ship as file LICENSE the following 2
+lines (only)
+
+YEAR:
+COPYRIGHT HOLDER:
+
+and specify as
+
+License: MIT + file LICENSE
+
+Copyright (c) ,
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+The MIT License
+
+Copyright (c) 2008- Attractive Chaos
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.musl as a whole is licensed under the following standard MIT license:
+
+----------------------------------------------------------------------
+Copyright © 2005-2020 Rich Felker, et al.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+----------------------------------------------------------------------
+
+Authors/contributors include:
+
+A. Wilcox
+Ada Worcester
+Alex Dowad
+Alex Suykov
+Alexander Monakov
+Andre McCurdy
+Andrew Kelley
+Anthony G. Basile
+Aric Belsito
+Arvid Picciani
+Bartosz Brachaczek
+Benjamin Peterson
+Bobby Bingham
+Boris Brezillon
+Brent Cook
+Chris Spiegel
+Clément Vasseur
+Daniel Micay
+Daniel Sabogal
+Daurnimator
+David Carlier
+David Edelsohn
+Denys Vlasenko
+Dmitry Ivanov
+Dmitry V. Levin
+Drew DeVault
+Emil Renner Berthing
+Fangrui Song
+Felix Fietkau
+Felix Janda
+Gianluca Anzolin
+Hauke Mehrtens
+He X
+Hiltjo Posthuma
+Isaac Dunham
+Jaydeep Patil
+Jens Gustedt
+Jeremy Huntwork
+Jo-Philipp Wich
+Joakim Sindholt
+John Spencer
+Julien Ramseier
+Justin Cormack
+Kaarle Ritvanen
+Khem Raj
+Kylie McClain
+Leah Neukirchen
+Luca Barbato
+Luka Perkov
+M Farkas-Dyck (Strake)
+Mahesh Bodapati
+Markus Wichmann
+Masanori Ogino
+Michael Clark
+Michael Forney
+Mikhail Kremnyov
+Natanael Copa
+Nicholas J. Kain
+orc
+Pascal Cuoq
+Patrick Oppenlander
+Petr Hosek
+Petr Skocik
+Pierre Carrier
+Reini Urban
+Rich Felker
+Richard Pennington
+Ryan Fairfax
+Samuel Holland
+Segev Finer
+Shiz
+sin
+Solar Designer
+Stefan Kristiansson
+Stefan O'Rear
+Szabolcs Nagy
+Timo Teräs
+Trutz Behn
+Valentin Ochs
+Will Dietz
+William Haddon
+William Pitcock
+
+Portions of this software are derived from third-party works licensed
+under terms compatible with the above MIT license:
+
+The TRE regular expression implementation (src/regex/reg* and
+src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
+under a 2-clause BSD license (license text in the source files). The
+included version has been heavily modified by Rich Felker in 2012, in
+the interests of size, simplicity, and namespace cleanliness.
+
+Much of the math library code (src/math/* and src/complex/*) is
+Copyright © 1993,2004 Sun Microsystems or
+Copyright © 2003-2011 David Schultz or
+Copyright © 2003-2009 Steven G. Kargl or
+Copyright © 2003-2009 Bruce D. Evans or
+Copyright © 2008 Stephen L. Moshier or
+Copyright © 2017-2018 Arm Limited
+and labelled as such in comments in the individual source files. All
+have been licensed under extremely permissive terms.
+
+The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
+The Android Open Source Project and is licensed under a two-clause BSD
+license. It was taken from Bionic libc, used on Android.
+
+The AArch64 memcpy and memset code (src/string/aarch64/*) are
+Copyright © 1999-2019, Arm Limited.
+
+The implementation of DES for crypt (src/crypt/crypt_des.c) is
+Copyright © 1994 David Burren. It is licensed under a BSD license.
+
+The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
+originally written by Solar Designer and placed into the public
+domain. The code also comes with a fallback permissive license for use
+in jurisdictions that may not recognize the public domain.
+
+The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
+Valentin Ochs and is licensed under an MIT-style license.
+
+The x86_64 port was written by Nicholas J. Kain and is licensed under
+the standard MIT terms.
+
+The mips and microblaze ports were originally written by Richard
+Pennington for use in the ellcc project. The original code was adapted
+by Rich Felker for build system and code conventions during upstream
+integration. It is licensed under the standard MIT terms.
+
+The mips64 port was contributed by Imagination Technologies and is
+licensed under the standard MIT terms.
+
+The powerpc port was also originally written by Richard Pennington,
+and later supplemented and integrated by John Spencer. It is licensed
+under the standard MIT terms.
+
+All other files which have no copyright comments are original works
+produced specifically for use as part of this library, written either
+by Rich Felker, the main author of the library, or by one or more
+contibutors listed above. Details on authorship of individual files
+can be found in the git version control history of the project. The
+omission of copyright and license comments in each file is in the
+interest of source tree size.
+
+In addition, permission is hereby granted for all public header files
+(include/* and arch/*/bits/*) and crt files intended to be linked into
+applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
+the copyright notice and permission notice otherwise required by the
+license, and to use these files without any requirement of
+attribution. These files include substantial contributions from:
+
+Bobby Bingham
+John Spencer
+Nicholas J. Kain
+Rich Felker
+Richard Pennington
+Stefan Kristiansson
+Szabolcs Nagy
+
+all of whom have explicitly granted such permission.
+
+This file previously contained text expressing a belief that most of
+the files covered by the above exception were sufficiently trivial not
+to be subject to copyright, resulting in confusion over whether it
+negated the permissions granted in the license. In the spirit of
+permissive licensing, and of not having licensing issues being an
+obstacle to adoption, that text has been removed.Copyright (c) 2005-2023, NumPy Developers.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the NumPy Developers nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+
+Copyright (c) Donald Stufft and individual contributors.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.A. HISTORY OF THE SOFTWARE
+==========================
+
+Python was created in the early 1990s by Guido van Rossum at Stichting
+Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
+as a successor of a language called ABC. Guido remains Python's
+principal author, although it includes many contributions from others.
+
+In 1995, Guido continued his work on Python at the Corporation for
+National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
+in Reston, Virginia where he released several versions of the
+software.
+
+In May 2000, Guido and the Python core development team moved to
+BeOpen.com to form the BeOpen PythonLabs team. In October of the same
+year, the PythonLabs team moved to Digital Creations, which became
+Zope Corporation. In 2001, the Python Software Foundation (PSF, see
+https://www.python.org/psf/) was formed, a non-profit organization
+created specifically to own Python-related Intellectual Property.
+Zope Corporation was a sponsoring member of the PSF.
+
+All Python releases are Open Source (see https://opensource.org for
+the Open Source Definition). Historically, most, but not all, Python
+releases have also been GPL-compatible; the table below summarizes
+the various releases.
+
+ Release Derived Year Owner GPL-
+ from compatible? (1)
+
+ 0.9.0 thru 1.2 1991-1995 CWI yes
+ 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
+ 1.6 1.5.2 2000 CNRI no
+ 2.0 1.6 2000 BeOpen.com no
+ 1.6.1 1.6 2001 CNRI yes (2)
+ 2.1 2.0+1.6.1 2001 PSF no
+ 2.0.1 2.0+1.6.1 2001 PSF yes
+ 2.1.1 2.1+2.0.1 2001 PSF yes
+ 2.1.2 2.1.1 2002 PSF yes
+ 2.1.3 2.1.2 2002 PSF yes
+ 2.2 and above 2.1.1 2001-now PSF yes
+
+Footnotes:
+
+(1) GPL-compatible doesn't mean that we're distributing Python under
+ the GPL. All Python licenses, unlike the GPL, let you distribute
+ a modified version without making your changes open source. The
+ GPL-compatible licenses make it possible to combine Python with
+ other software that is released under the GPL; the others don't.
+
+(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
+ because its license has a choice of law clause. According to
+ CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
+ is "not incompatible" with the GPL.
+
+Thanks to the many outside volunteers who have worked under Guido's
+direction to make these releases possible.
+
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
+===============================================================
+
+Python software and documentation are licensed under the
+Python Software Foundation License Version 2.
+
+Starting with Python 3.8.6, examples, recipes, and other code in
+the documentation are dual licensed under the PSF License Version 2
+and the Zero-Clause BSD license.
+
+Some software incorporated into Python is under different licenses.
+The licenses are listed with code falling under that license.
+
+
+PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+--------------------------------------------
+
+1. This LICENSE AGREEMENT is between the Python Software Foundation
+("PSF"), and the Individual or Organization ("Licensee") accessing and
+otherwise using this software ("Python") in source or binary form and
+its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, PSF hereby
+grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
+analyze, test, perform and/or display publicly, prepare derivative works,
+distribute, and otherwise use Python alone or in any derivative version,
+provided, however, that PSF's License Agreement and PSF's notice of copyright,
+i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
+All Rights Reserved" are retained in Python alone or in any derivative version
+prepared by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python.
+
+4. PSF is making Python available to Licensee on an "AS IS"
+basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between PSF and
+Licensee. This License Agreement does not grant permission to use PSF
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using Python, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
+-------------------------------------------
+
+BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
+
+1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
+office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
+Individual or Organization ("Licensee") accessing and otherwise using
+this software in source or binary form and its associated
+documentation ("the Software").
+
+2. Subject to the terms and conditions of this BeOpen Python License
+Agreement, BeOpen hereby grants Licensee a non-exclusive,
+royalty-free, world-wide license to reproduce, analyze, test, perform
+and/or display publicly, prepare derivative works, distribute, and
+otherwise use the Software alone or in any derivative version,
+provided, however, that the BeOpen Python License is retained in the
+Software, alone or in any derivative version prepared by Licensee.
+
+3. BeOpen is making the Software available to Licensee on an "AS IS"
+basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
+SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
+AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
+DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+5. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+6. This License Agreement shall be governed by and interpreted in all
+respects by the law of the State of California, excluding conflict of
+law provisions. Nothing in this License Agreement shall be deemed to
+create any relationship of agency, partnership, or joint venture
+between BeOpen and Licensee. This License Agreement does not grant
+permission to use BeOpen trademarks or trade names in a trademark
+sense to endorse or promote products or services of Licensee, or any
+third party. As an exception, the "BeOpen Python" logos available at
+http://www.pythonlabs.com/logos.html may be used according to the
+permissions granted on that web page.
+
+7. By copying, installing or otherwise using the software, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
+---------------------------------------
+
+1. This LICENSE AGREEMENT is between the Corporation for National
+Research Initiatives, having an office at 1895 Preston White Drive,
+Reston, VA 20191 ("CNRI"), and the Individual or Organization
+("Licensee") accessing and otherwise using Python 1.6.1 software in
+source or binary form and its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, CNRI
+hereby grants Licensee a nonexclusive, royalty-free, world-wide
+license to reproduce, analyze, test, perform and/or display publicly,
+prepare derivative works, distribute, and otherwise use Python 1.6.1
+alone or in any derivative version, provided, however, that CNRI's
+License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
+1995-2001 Corporation for National Research Initiatives; All Rights
+Reserved" are retained in Python 1.6.1 alone or in any derivative
+version prepared by Licensee. Alternately, in lieu of CNRI's License
+Agreement, Licensee may substitute the following text (omitting the
+quotes): "Python 1.6.1 is made available subject to the terms and
+conditions in CNRI's License Agreement. This Agreement together with
+Python 1.6.1 may be located on the internet using the following
+unique, persistent identifier (known as a handle): 1895.22/1013. This
+Agreement may also be obtained from a proxy server on the internet
+using the following URL: http://hdl.handle.net/1895.22/1013".
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python 1.6.1 or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python 1.6.1.
+
+4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
+basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. This License Agreement shall be governed by the federal
+intellectual property law of the United States, including without
+limitation the federal copyright law, and, to the extent such
+U.S. federal law does not apply, by the law of the Commonwealth of
+Virginia, excluding Virginia's conflict of law provisions.
+Notwithstanding the foregoing, with regard to derivative works based
+on Python 1.6.1 that incorporate non-separable material that was
+previously distributed under the GNU General Public License (GPL), the
+law of the Commonwealth of Virginia shall govern this License
+Agreement only as to issues arising under or with respect to
+Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
+License Agreement shall be deemed to create any relationship of
+agency, partnership, or joint venture between CNRI and Licensee. This
+License Agreement does not grant permission to use CNRI trademarks or
+trade name in a trademark sense to endorse or promote products or
+services of Licensee, or any third party.
+
+8. By clicking on the "ACCEPT" button where indicated, or by copying,
+installing or otherwise using Python 1.6.1, Licensee agrees to be
+bound by the terms and conditions of this License Agreement.
+
+ ACCEPT
+
+
+CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
+--------------------------------------------------
+
+Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
+The Netherlands. All rights reserved.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
+----------------------------------------------------------------------
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+Copyright (c) 2014, Al Sweigart
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of the {organization} nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Copyright (c) 2017 Anthony Sottile
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.Copyright (c) 2015-2019 Jared Hobbs
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.Developed by ESN, an Electronic Arts Inc. studio.
+Copyright (c) 2014, Electronic Arts Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+* Neither the name of ESN, Electronic Arts Inc. nor the
+names of its contributors may be used to endorse or promote products
+derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS INC. BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+Portions of code from MODP_ASCII - Ascii transformations (upper/lower, etc)
+https://github.com/client9/stringencoders
+
+ Copyright 2005, 2006, 2007
+ Nick Galbreath -- nickg [at] modp [dot] com
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ Neither the name of the modp.com nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This is the standard "new" BSD license:
+ http://www.opensource.org/licenses/bsd-license.php
+
+https://github.com/client9/stringencoders/blob/cfd5c1507325ae497ea9bacdacba12c0ffd79d30/COPYING
+
+----
+
+Numeric decoder derived from from TCL library
+https://opensource.apple.com/source/tcl/tcl-14/tcl/license.terms
+ * Copyright (c) 1988-1993 The Regents of the University of California.
+ * Copyright (c) 1994 Sun Microsystems, Inc.
+
+ This software is copyrighted by the Regents of the University of
+ California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
+ Corporation and other parties. The following terms apply to all files
+ associated with the software unless explicitly disclaimed in
+ individual files.
+
+ The authors hereby grant permission to use, copy, modify, distribute,
+ and license this software and its documentation for any purpose, provided
+ that existing copyright notices are retained in all copies and that this
+ notice is included verbatim in any distributions. No written agreement,
+ license, or royalty fee is required for any of the authorized uses.
+ Modifications to this software may be copyrighted by their authors
+ and need not follow the licensing terms described here, provided that
+ the new terms are clearly indicated on the first page of each file where
+ they apply.
+
+ IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+ FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+ DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
+ IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+ NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+ MODIFICATIONS.
+
+ GOVERNMENT USE: If you are acquiring this software on behalf of the
+ U.S. government, the Government shall have only "Restricted Rights"
+ in the software and related documentation as defined in the Federal
+ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
+ are acquiring the software on behalf of the Department of Defense, the
+ software shall be classified as "Commercial Computer Software" and the
+ Government shall have only "Restricted Rights" as defined in Clause
+ 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
+ authors grant the U.S. Government and others acting in its behalf
+ permission to use and distribute the software in accordance with the
+ terms specified in this license.Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright
+owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities
+that control, are controlled by, or are under common control with that entity.
+For the purposes of this definition, "control" means (i) the power, direct or
+indirect, to cause the direction or management of such entity, whether by
+contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including
+but not limited to software source code, documentation source, and configuration
+files.
+
+"Object" form shall mean any form resulting from mechanical transformation or
+translation of a Source form, including but not limited to compiled object code,
+generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made
+available under the License, as indicated by a copyright notice that is included
+in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that
+is based on (or derived from) the Work and for which the editorial revisions,
+annotations, elaborations, or other modifications represent, as a whole, an
+original work of authorship. For the purposes of this License, Derivative Works
+shall not include works that remain separable from, or merely link (or bind by
+name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version
+of the Work and any modifications or additions to that Work or Derivative Works
+thereof, that is intentionally submitted to Licensor for inclusion in the Work
+by the copyright owner or by an individual or Legal Entity authorized to submit
+on behalf of the copyright owner. For the purposes of this definition,
+"submitted" means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems, and
+issue tracking systems that are managed by, or on behalf of, the Licensor for
+the purpose of discussing and improving the Work, but excluding communication
+that is conspicuously marked or otherwise designated in writing by the copyright
+owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
+of whom a Contribution has been received by Licensor and subsequently
+incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, and otherwise transfer the Work, where
+such license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by combination
+of their Contribution(s) with the Work to which such Contribution(s) was
+submitted. If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or contributory
+patent infringement, then any patent licenses granted to You under this License
+for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof
+in any medium, with or without modifications, and in Source or Object form,
+provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of
+this License; and
+You must cause any modified files to carry prominent notices stating that You
+changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute,
+all copyright, patent, trademark, and attribution notices from the Source form
+of the Work, excluding those notices that do not pertain to any part of the
+Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any
+Derivative Works that You distribute must include a readable copy of the
+attribution notices contained within such NOTICE file, excluding those notices
+that do not pertain to any part of the Derivative Works, in at least one of the
+following places: within a NOTICE text file distributed as part of the
+Derivative Works; within the Source form or documentation, if provided along
+with the Derivative Works; or, within a display generated by the Derivative
+Works, if and wherever such third-party notices normally appear. The contents of
+the NOTICE file are for informational purposes only and do not modify the
+License. You may add Your own attribution notices within Derivative Works that
+You distribute, alongside or as an addendum to the NOTICE text from the Work,
+provided that such additional attribution notices cannot be construed as
+modifying the License.
+You may add Your own copyright statement to Your modifications and may provide
+additional or different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works as a whole,
+provided Your use, reproduction, and distribution of the Work otherwise complies
+with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted
+for inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the terms of
+any separate license agreement you may have executed with Licensor regarding
+such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks,
+service marks, or product names of the Licensor, except as required for
+reasonable and customary use in describing the origin of the Work and
+reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the
+Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+including, without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
+solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise of
+permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence),
+contract, or otherwise, unless required by applicable law (such as deliberate
+and grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License or
+out of the use or inability to use the Work (including but not limited to
+damages for loss of goodwill, work stoppage, computer failure or malfunction, or
+any and all other commercial damages or losses), even if such Contributor has
+been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to
+offer, and charge a fee for, acceptance of support, warranty, indemnity, or
+other liability obligations and/or rights consistent with this License. However,
+in accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if You
+agree to indemnify, defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason of your
+accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work
+
+To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets "[]" replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included on
+the same "printed page" as the copyright notice for easier identification within
+third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
\ No newline at end of file
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..e033e853fde73ed0b7021e47680c661374870cc5
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/METADATA
@@ -0,0 +1,1573 @@
+Metadata-Version: 2.1
+Name: pandas
+Version: 2.3.1
+Summary: Powerful data structures for data analysis, time series, and statistics
+Author-Email: The Pandas Development Team
+License: BSD 3-Clause License
+
+ Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
+ All rights reserved.
+
+ Copyright (c) 2011-2023, Open source contributors.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Copyright (c) 2010-2019 Keith Goodman
+ Copyright (c) 2019 Bottleneck Developers
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.Copyright 2017- Paul Ganssle
+ Copyright 2017- dateutil contributors (see AUTHORS file)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ The above license applies to all contributions after 2017-12-01, as well as
+ all contributions that have been re-licensed (see AUTHORS file for the list of
+ contributors who have re-licensed their code).
+ --------------------------------------------------------------------------------
+ dateutil - Extensions to the standard Python datetime module.
+
+ Copyright (c) 2003-2011 - Gustavo Niemeyer
+ Copyright (c) 2012-2014 - Tomi Pieviläinen
+ Copyright (c) 2014-2016 - Yaron de Leeuw
+ Copyright (c) 2015- - Paul Ganssle
+ Copyright (c) 2015- - dateutil contributors (see AUTHORS file)
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ The above BSD License Applies to all code, even that also covered by Apache 2.0.# MIT License
+
+ Copyright (c) 2019 Hadley Wickham; RStudio; and Evan Miller
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.
+ Based on http://opensource.org/licenses/MIT
+
+ This is a template. Complete and ship as file LICENSE the following 2
+ lines (only)
+
+ YEAR:
+ COPYRIGHT HOLDER:
+
+ and specify as
+
+ License: MIT + file LICENSE
+
+ Copyright (c) ,
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ The MIT License
+
+ Copyright (c) 2008- Attractive Chaos
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.musl as a whole is licensed under the following standard MIT license:
+
+ ----------------------------------------------------------------------
+ Copyright © 2005-2020 Rich Felker, et al.
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ ----------------------------------------------------------------------
+
+ Authors/contributors include:
+
+ A. Wilcox
+ Ada Worcester
+ Alex Dowad
+ Alex Suykov
+ Alexander Monakov
+ Andre McCurdy
+ Andrew Kelley
+ Anthony G. Basile
+ Aric Belsito
+ Arvid Picciani
+ Bartosz Brachaczek
+ Benjamin Peterson
+ Bobby Bingham
+ Boris Brezillon
+ Brent Cook
+ Chris Spiegel
+ Clément Vasseur
+ Daniel Micay
+ Daniel Sabogal
+ Daurnimator
+ David Carlier
+ David Edelsohn
+ Denys Vlasenko
+ Dmitry Ivanov
+ Dmitry V. Levin
+ Drew DeVault
+ Emil Renner Berthing
+ Fangrui Song
+ Felix Fietkau
+ Felix Janda
+ Gianluca Anzolin
+ Hauke Mehrtens
+ He X
+ Hiltjo Posthuma
+ Isaac Dunham
+ Jaydeep Patil
+ Jens Gustedt
+ Jeremy Huntwork
+ Jo-Philipp Wich
+ Joakim Sindholt
+ John Spencer
+ Julien Ramseier
+ Justin Cormack
+ Kaarle Ritvanen
+ Khem Raj
+ Kylie McClain
+ Leah Neukirchen
+ Luca Barbato
+ Luka Perkov
+ M Farkas-Dyck (Strake)
+ Mahesh Bodapati
+ Markus Wichmann
+ Masanori Ogino
+ Michael Clark
+ Michael Forney
+ Mikhail Kremnyov
+ Natanael Copa
+ Nicholas J. Kain
+ orc
+ Pascal Cuoq
+ Patrick Oppenlander
+ Petr Hosek
+ Petr Skocik
+ Pierre Carrier
+ Reini Urban
+ Rich Felker
+ Richard Pennington
+ Ryan Fairfax
+ Samuel Holland
+ Segev Finer
+ Shiz
+ sin
+ Solar Designer
+ Stefan Kristiansson
+ Stefan O'Rear
+ Szabolcs Nagy
+ Timo Teräs
+ Trutz Behn
+ Valentin Ochs
+ Will Dietz
+ William Haddon
+ William Pitcock
+
+ Portions of this software are derived from third-party works licensed
+ under terms compatible with the above MIT license:
+
+ The TRE regular expression implementation (src/regex/reg* and
+ src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
+ under a 2-clause BSD license (license text in the source files). The
+ included version has been heavily modified by Rich Felker in 2012, in
+ the interests of size, simplicity, and namespace cleanliness.
+
+ Much of the math library code (src/math/* and src/complex/*) is
+ Copyright © 1993,2004 Sun Microsystems or
+ Copyright © 2003-2011 David Schultz or
+ Copyright © 2003-2009 Steven G. Kargl or
+ Copyright © 2003-2009 Bruce D. Evans or
+ Copyright © 2008 Stephen L. Moshier or
+ Copyright © 2017-2018 Arm Limited
+ and labelled as such in comments in the individual source files. All
+ have been licensed under extremely permissive terms.
+
+ The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
+ The Android Open Source Project and is licensed under a two-clause BSD
+ license. It was taken from Bionic libc, used on Android.
+
+ The AArch64 memcpy and memset code (src/string/aarch64/*) are
+ Copyright © 1999-2019, Arm Limited.
+
+ The implementation of DES for crypt (src/crypt/crypt_des.c) is
+ Copyright © 1994 David Burren. It is licensed under a BSD license.
+
+ The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
+ originally written by Solar Designer and placed into the public
+ domain. The code also comes with a fallback permissive license for use
+ in jurisdictions that may not recognize the public domain.
+
+ The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
+ Valentin Ochs and is licensed under an MIT-style license.
+
+ The x86_64 port was written by Nicholas J. Kain and is licensed under
+ the standard MIT terms.
+
+ The mips and microblaze ports were originally written by Richard
+ Pennington for use in the ellcc project. The original code was adapted
+ by Rich Felker for build system and code conventions during upstream
+ integration. It is licensed under the standard MIT terms.
+
+ The mips64 port was contributed by Imagination Technologies and is
+ licensed under the standard MIT terms.
+
+ The powerpc port was also originally written by Richard Pennington,
+ and later supplemented and integrated by John Spencer. It is licensed
+ under the standard MIT terms.
+
+ All other files which have no copyright comments are original works
+ produced specifically for use as part of this library, written either
+ by Rich Felker, the main author of the library, or by one or more
+ contibutors listed above. Details on authorship of individual files
+ can be found in the git version control history of the project. The
+ omission of copyright and license comments in each file is in the
+ interest of source tree size.
+
+ In addition, permission is hereby granted for all public header files
+ (include/* and arch/*/bits/*) and crt files intended to be linked into
+ applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
+ the copyright notice and permission notice otherwise required by the
+ license, and to use these files without any requirement of
+ attribution. These files include substantial contributions from:
+
+ Bobby Bingham
+ John Spencer
+ Nicholas J. Kain
+ Rich Felker
+ Richard Pennington
+ Stefan Kristiansson
+ Szabolcs Nagy
+
+ all of whom have explicitly granted such permission.
+
+ This file previously contained text expressing a belief that most of
+ the files covered by the above exception were sufficiently trivial not
+ to be subject to copyright, resulting in confusion over whether it
+ negated the permissions granted in the license. In the spirit of
+ permissive licensing, and of not having licensing issues being an
+ obstacle to adoption, that text has been removed.Copyright (c) 2005-2023, NumPy Developers.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * Neither the name of the NumPy Developers nor the names of any
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+
+ Copyright (c) Donald Stufft and individual contributors.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.A. HISTORY OF THE SOFTWARE
+ ==========================
+
+ Python was created in the early 1990s by Guido van Rossum at Stichting
+ Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
+ as a successor of a language called ABC. Guido remains Python's
+ principal author, although it includes many contributions from others.
+
+ In 1995, Guido continued his work on Python at the Corporation for
+ National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
+ in Reston, Virginia where he released several versions of the
+ software.
+
+ In May 2000, Guido and the Python core development team moved to
+ BeOpen.com to form the BeOpen PythonLabs team. In October of the same
+ year, the PythonLabs team moved to Digital Creations, which became
+ Zope Corporation. In 2001, the Python Software Foundation (PSF, see
+ https://www.python.org/psf/) was formed, a non-profit organization
+ created specifically to own Python-related Intellectual Property.
+ Zope Corporation was a sponsoring member of the PSF.
+
+ All Python releases are Open Source (see https://opensource.org for
+ the Open Source Definition). Historically, most, but not all, Python
+ releases have also been GPL-compatible; the table below summarizes
+ the various releases.
+
+ Release Derived Year Owner GPL-
+ from compatible? (1)
+
+ 0.9.0 thru 1.2 1991-1995 CWI yes
+ 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
+ 1.6 1.5.2 2000 CNRI no
+ 2.0 1.6 2000 BeOpen.com no
+ 1.6.1 1.6 2001 CNRI yes (2)
+ 2.1 2.0+1.6.1 2001 PSF no
+ 2.0.1 2.0+1.6.1 2001 PSF yes
+ 2.1.1 2.1+2.0.1 2001 PSF yes
+ 2.1.2 2.1.1 2002 PSF yes
+ 2.1.3 2.1.2 2002 PSF yes
+ 2.2 and above 2.1.1 2001-now PSF yes
+
+ Footnotes:
+
+ (1) GPL-compatible doesn't mean that we're distributing Python under
+ the GPL. All Python licenses, unlike the GPL, let you distribute
+ a modified version without making your changes open source. The
+ GPL-compatible licenses make it possible to combine Python with
+ other software that is released under the GPL; the others don't.
+
+ (2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
+ because its license has a choice of law clause. According to
+ CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
+ is "not incompatible" with the GPL.
+
+ Thanks to the many outside volunteers who have worked under Guido's
+ direction to make these releases possible.
+
+
+ B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
+ ===============================================================
+
+ Python software and documentation are licensed under the
+ Python Software Foundation License Version 2.
+
+ Starting with Python 3.8.6, examples, recipes, and other code in
+ the documentation are dual licensed under the PSF License Version 2
+ and the Zero-Clause BSD license.
+
+ Some software incorporated into Python is under different licenses.
+ The licenses are listed with code falling under that license.
+
+
+ PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+ --------------------------------------------
+
+ 1. This LICENSE AGREEMENT is between the Python Software Foundation
+ ("PSF"), and the Individual or Organization ("Licensee") accessing and
+ otherwise using this software ("Python") in source or binary form and
+ its associated documentation.
+
+ 2. Subject to the terms and conditions of this License Agreement, PSF hereby
+ grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
+ analyze, test, perform and/or display publicly, prepare derivative works,
+ distribute, and otherwise use Python alone or in any derivative version,
+ provided, however, that PSF's License Agreement and PSF's notice of copyright,
+ i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+ 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
+ All Rights Reserved" are retained in Python alone or in any derivative version
+ prepared by Licensee.
+
+ 3. In the event Licensee prepares a derivative work that is based on
+ or incorporates Python or any part thereof, and wants to make
+ the derivative work available to others as provided herein, then
+ Licensee hereby agrees to include in any such work a brief summary of
+ the changes made to Python.
+
+ 4. PSF is making Python available to Licensee on an "AS IS"
+ basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
+ INFRINGE ANY THIRD PARTY RIGHTS.
+
+ 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+ FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+ 6. This License Agreement will automatically terminate upon a material
+ breach of its terms and conditions.
+
+ 7. Nothing in this License Agreement shall be deemed to create any
+ relationship of agency, partnership, or joint venture between PSF and
+ Licensee. This License Agreement does not grant permission to use PSF
+ trademarks or trade name in a trademark sense to endorse or promote
+ products or services of Licensee, or any third party.
+
+ 8. By copying, installing or otherwise using Python, Licensee
+ agrees to be bound by the terms and conditions of this License
+ Agreement.
+
+
+ BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
+ -------------------------------------------
+
+ BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
+
+ 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
+ office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
+ Individual or Organization ("Licensee") accessing and otherwise using
+ this software in source or binary form and its associated
+ documentation ("the Software").
+
+ 2. Subject to the terms and conditions of this BeOpen Python License
+ Agreement, BeOpen hereby grants Licensee a non-exclusive,
+ royalty-free, world-wide license to reproduce, analyze, test, perform
+ and/or display publicly, prepare derivative works, distribute, and
+ otherwise use the Software alone or in any derivative version,
+ provided, however, that the BeOpen Python License is retained in the
+ Software, alone or in any derivative version prepared by Licensee.
+
+ 3. BeOpen is making the Software available to Licensee on an "AS IS"
+ basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
+ INFRINGE ANY THIRD PARTY RIGHTS.
+
+ 4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
+ SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
+ AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
+ DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+ 5. This License Agreement will automatically terminate upon a material
+ breach of its terms and conditions.
+
+ 6. This License Agreement shall be governed by and interpreted in all
+ respects by the law of the State of California, excluding conflict of
+ law provisions. Nothing in this License Agreement shall be deemed to
+ create any relationship of agency, partnership, or joint venture
+ between BeOpen and Licensee. This License Agreement does not grant
+ permission to use BeOpen trademarks or trade names in a trademark
+ sense to endorse or promote products or services of Licensee, or any
+ third party. As an exception, the "BeOpen Python" logos available at
+ http://www.pythonlabs.com/logos.html may be used according to the
+ permissions granted on that web page.
+
+ 7. By copying, installing or otherwise using the software, Licensee
+ agrees to be bound by the terms and conditions of this License
+ Agreement.
+
+
+ CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
+ ---------------------------------------
+
+ 1. This LICENSE AGREEMENT is between the Corporation for National
+ Research Initiatives, having an office at 1895 Preston White Drive,
+ Reston, VA 20191 ("CNRI"), and the Individual or Organization
+ ("Licensee") accessing and otherwise using Python 1.6.1 software in
+ source or binary form and its associated documentation.
+
+ 2. Subject to the terms and conditions of this License Agreement, CNRI
+ hereby grants Licensee a nonexclusive, royalty-free, world-wide
+ license to reproduce, analyze, test, perform and/or display publicly,
+ prepare derivative works, distribute, and otherwise use Python 1.6.1
+ alone or in any derivative version, provided, however, that CNRI's
+ License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
+ 1995-2001 Corporation for National Research Initiatives; All Rights
+ Reserved" are retained in Python 1.6.1 alone or in any derivative
+ version prepared by Licensee. Alternately, in lieu of CNRI's License
+ Agreement, Licensee may substitute the following text (omitting the
+ quotes): "Python 1.6.1 is made available subject to the terms and
+ conditions in CNRI's License Agreement. This Agreement together with
+ Python 1.6.1 may be located on the internet using the following
+ unique, persistent identifier (known as a handle): 1895.22/1013. This
+ Agreement may also be obtained from a proxy server on the internet
+ using the following URL: http://hdl.handle.net/1895.22/1013".
+
+ 3. In the event Licensee prepares a derivative work that is based on
+ or incorporates Python 1.6.1 or any part thereof, and wants to make
+ the derivative work available to others as provided herein, then
+ Licensee hereby agrees to include in any such work a brief summary of
+ the changes made to Python 1.6.1.
+
+ 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
+ basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+ IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
+ DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+ FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
+ INFRINGE ANY THIRD PARTY RIGHTS.
+
+ 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+ 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+ A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
+ OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+ 6. This License Agreement will automatically terminate upon a material
+ breach of its terms and conditions.
+
+ 7. This License Agreement shall be governed by the federal
+ intellectual property law of the United States, including without
+ limitation the federal copyright law, and, to the extent such
+ U.S. federal law does not apply, by the law of the Commonwealth of
+ Virginia, excluding Virginia's conflict of law provisions.
+ Notwithstanding the foregoing, with regard to derivative works based
+ on Python 1.6.1 that incorporate non-separable material that was
+ previously distributed under the GNU General Public License (GPL), the
+ law of the Commonwealth of Virginia shall govern this License
+ Agreement only as to issues arising under or with respect to
+ Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
+ License Agreement shall be deemed to create any relationship of
+ agency, partnership, or joint venture between CNRI and Licensee. This
+ License Agreement does not grant permission to use CNRI trademarks or
+ trade name in a trademark sense to endorse or promote products or
+ services of Licensee, or any third party.
+
+ 8. By clicking on the "ACCEPT" button where indicated, or by copying,
+ installing or otherwise using Python 1.6.1, Licensee agrees to be
+ bound by the terms and conditions of this License Agreement.
+
+ ACCEPT
+
+
+ CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
+ --------------------------------------------------
+
+ Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
+ The Netherlands. All rights reserved.
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose and without fee is hereby granted,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation, and that the name of Stichting Mathematisch
+ Centrum or CWI not be used in advertising or publicity pertaining to
+ distribution of the software without specific, written prior
+ permission.
+
+ STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+ FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
+ ----------------------------------------------------------------------
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ PERFORMANCE OF THIS SOFTWARE.
+ Copyright (c) 2014, Al Sweigart
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of the {organization} nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Copyright (c) 2017 Anthony Sottile
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.Copyright (c) 2015-2019 Jared Hobbs
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
+ this software and associated documentation files (the "Software"), to deal in
+ the Software without restriction, including without limitation the rights to
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ of the Software, and to permit persons to whom the Software is furnished to do
+ so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE.Developed by ESN, an Electronic Arts Inc. studio.
+ Copyright (c) 2014, Electronic Arts Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of ESN, Electronic Arts Inc. nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS INC. BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ ----
+
+ Portions of code from MODP_ASCII - Ascii transformations (upper/lower, etc)
+ https://github.com/client9/stringencoders
+
+ Copyright 2005, 2006, 2007
+ Nick Galbreath -- nickg [at] modp [dot] com
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ Neither the name of the modp.com nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This is the standard "new" BSD license:
+ http://www.opensource.org/licenses/bsd-license.php
+
+ https://github.com/client9/stringencoders/blob/cfd5c1507325ae497ea9bacdacba12c0ffd79d30/COPYING
+
+ ----
+
+ Numeric decoder derived from from TCL library
+ https://opensource.apple.com/source/tcl/tcl-14/tcl/license.terms
+ * Copyright (c) 1988-1993 The Regents of the University of California.
+ * Copyright (c) 1994 Sun Microsystems, Inc.
+
+ This software is copyrighted by the Regents of the University of
+ California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
+ Corporation and other parties. The following terms apply to all files
+ associated with the software unless explicitly disclaimed in
+ individual files.
+
+ The authors hereby grant permission to use, copy, modify, distribute,
+ and license this software and its documentation for any purpose, provided
+ that existing copyright notices are retained in all copies and that this
+ notice is included verbatim in any distributions. No written agreement,
+ license, or royalty fee is required for any of the authorized uses.
+ Modifications to this software may be copyrighted by their authors
+ and need not follow the licensing terms described here, provided that
+ the new terms are clearly indicated on the first page of each file where
+ they apply.
+
+ IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+ FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+ DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
+ IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+ NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+ MODIFICATIONS.
+
+ GOVERNMENT USE: If you are acquiring this software on behalf of the
+ U.S. government, the Government shall have only "Restricted Rights"
+ in the software and related documentation as defined in the Federal
+ Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
+ are acquiring the software on behalf of the Department of Defense, the
+ software shall be classified as "Commercial Computer Software" and the
+ Government shall have only "Restricted Rights" as defined in Clause
+ 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
+ authors grant the U.S. Government and others acting in its behalf
+ permission to use and distribute the software in accordance with the
+ terms specified in this license.Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction, and
+ distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
+ owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all other entities
+ that control, are controlled by, or are under common control with that entity.
+ For the purposes of this definition, "control" means (i) the power, direct or
+ indirect, to cause the direction or management of such entity, whether by
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
+ permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications, including
+ but not limited to software source code, documentation source, and configuration
+ files.
+
+ "Object" form shall mean any form resulting from mechanical transformation or
+ translation of a Source form, including but not limited to compiled object code,
+ generated documentation, and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or Object form, made
+ available under the License, as indicated by a copyright notice that is included
+ in or attached to the work (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
+ is based on (or derived from) the Work and for which the editorial revisions,
+ annotations, elaborations, or other modifications represent, as a whole, an
+ original work of authorship. For the purposes of this License, Derivative Works
+ shall not include works that remain separable from, or merely link (or bind by
+ name) to the interfaces of, the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including the original version
+ of the Work and any modifications or additions to that Work or Derivative Works
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
+ by the copyright owner or by an individual or Legal Entity authorized to submit
+ on behalf of the copyright owner. For the purposes of this definition,
+ "submitted" means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems, and
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
+ the purpose of discussing and improving the Work, but excluding communication
+ that is conspicuously marked or otherwise designated in writing by the copyright
+ owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
+ of whom a Contribution has been received by Licensor and subsequently
+ incorporated within the Work.
+
+ 2. Grant of Copyright License.
+
+ Subject to the terms and conditions of this License, each Contributor hereby
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the Work and such
+ Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License.
+
+ Subject to the terms and conditions of this License, each Contributor hereby
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+ irrevocable (except as stated in this section) patent license to make, have
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
+ such license applies only to those patent claims licensable by such Contributor
+ that are necessarily infringed by their Contribution(s) alone or by combination
+ of their Contribution(s) with the Work to which such Contribution(s) was
+ submitted. If You institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+ Contribution incorporated within the Work constitutes direct or contributory
+ patent infringement, then any patent licenses granted to You under this License
+ for that Work shall terminate as of the date such litigation is filed.
+
+ 4. Redistribution.
+
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
+ in any medium, with or without modifications, and in Source or Object form,
+ provided that You meet the following conditions:
+
+ You must give any other recipients of the Work or Derivative Works a copy of
+ this License; and
+ You must cause any modified files to carry prominent notices stating that You
+ changed the files; and
+ You must retain, in the Source form of any Derivative Works that You distribute,
+ all copyright, patent, trademark, and attribution notices from the Source form
+ of the Work, excluding those notices that do not pertain to any part of the
+ Derivative Works; and
+ If the Work includes a "NOTICE" text file as part of its distribution, then any
+ Derivative Works that You distribute must include a readable copy of the
+ attribution notices contained within such NOTICE file, excluding those notices
+ that do not pertain to any part of the Derivative Works, in at least one of the
+ following places: within a NOTICE text file distributed as part of the
+ Derivative Works; within the Source form or documentation, if provided along
+ with the Derivative Works; or, within a display generated by the Derivative
+ Works, if and wherever such third-party notices normally appear. The contents of
+ the NOTICE file are for informational purposes only and do not modify the
+ License. You may add Your own attribution notices within Derivative Works that
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
+ provided that such additional attribution notices cannot be construed as
+ modifying the License.
+ You may add Your own copyright statement to Your modifications and may provide
+ additional or different license terms and conditions for use, reproduction, or
+ distribution of Your modifications, or for any such Derivative Works as a whole,
+ provided Your use, reproduction, and distribution of the Work otherwise complies
+ with the conditions stated in this License.
+
+ 5. Submission of Contributions.
+
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
+ for inclusion in the Work by You to the Licensor shall be under the terms and
+ conditions of this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
+ any separate license agreement you may have executed with Licensor regarding
+ such Contributions.
+
+ 6. Trademarks.
+
+ This License does not grant permission to use the trade names, trademarks,
+ service marks, or product names of the Licensor, except as required for
+ reasonable and customary use in describing the origin of the Work and
+ reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty.
+
+ Unless required by applicable law or agreed to in writing, Licensor provides the
+ Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+ including, without limitation, any warranties or conditions of TITLE,
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
+ solely responsible for determining the appropriateness of using or
+ redistributing the Work and assume any risks associated with Your exercise of
+ permissions under this License.
+
+ 8. Limitation of Liability.
+
+ In no event and under no legal theory, whether in tort (including negligence),
+ contract, or otherwise, unless required by applicable law (such as deliberate
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special, incidental,
+ or consequential damages of any character arising as a result of this License or
+ out of the use or inability to use the Work (including but not limited to
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
+ any and all other commercial damages or losses), even if such Contributor has
+ been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability.
+
+ While redistributing the Work or Derivative Works thereof, You may choose to
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
+ other liability obligations and/or rights consistent with this License. However,
+ in accepting such obligations, You may act only on Your own behalf and on Your
+ sole responsibility, not on behalf of any other Contributor, and only if You
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason of your
+ accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work
+
+ To apply the Apache License to your work, attach the following boilerplate
+ notice, with the fields enclosed by brackets "[]" replaced with your own
+ identifying information. (Don't include the brackets!) The text should be
+ enclosed in the appropriate comment syntax for the file format. We also
+ recommend that a file or class name and description of purpose be included on
+ the same "printed page" as the copyright notice for easier identification within
+ third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Intended Audience :: Science/Research
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Cython
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3.13
+Classifier: Topic :: Scientific/Engineering
+Project-URL: homepage, https://pandas.pydata.org
+Project-URL: documentation, https://pandas.pydata.org/docs/
+Project-URL: repository, https://github.com/pandas-dev/pandas
+Requires-Python: >=3.9
+Requires-Dist: numpy>=1.22.4; python_version < "3.11"
+Requires-Dist: numpy>=1.23.2; python_version == "3.11"
+Requires-Dist: numpy>=1.26.0; python_version >= "3.12"
+Requires-Dist: python-dateutil>=2.8.2
+Requires-Dist: pytz>=2020.1
+Requires-Dist: tzdata>=2022.7
+Provides-Extra: test
+Requires-Dist: hypothesis>=6.46.1; extra == "test"
+Requires-Dist: pytest>=7.3.2; extra == "test"
+Requires-Dist: pytest-xdist>=2.2.0; extra == "test"
+Provides-Extra: pyarrow
+Requires-Dist: pyarrow>=10.0.1; extra == "pyarrow"
+Provides-Extra: performance
+Requires-Dist: bottleneck>=1.3.6; extra == "performance"
+Requires-Dist: numba>=0.56.4; extra == "performance"
+Requires-Dist: numexpr>=2.8.4; extra == "performance"
+Provides-Extra: computation
+Requires-Dist: scipy>=1.10.0; extra == "computation"
+Requires-Dist: xarray>=2022.12.0; extra == "computation"
+Provides-Extra: fss
+Requires-Dist: fsspec>=2022.11.0; extra == "fss"
+Provides-Extra: aws
+Requires-Dist: s3fs>=2022.11.0; extra == "aws"
+Provides-Extra: gcp
+Requires-Dist: gcsfs>=2022.11.0; extra == "gcp"
+Requires-Dist: pandas-gbq>=0.19.0; extra == "gcp"
+Provides-Extra: excel
+Requires-Dist: odfpy>=1.4.1; extra == "excel"
+Requires-Dist: openpyxl>=3.1.0; extra == "excel"
+Requires-Dist: python-calamine>=0.1.7; extra == "excel"
+Requires-Dist: pyxlsb>=1.0.10; extra == "excel"
+Requires-Dist: xlrd>=2.0.1; extra == "excel"
+Requires-Dist: xlsxwriter>=3.0.5; extra == "excel"
+Provides-Extra: parquet
+Requires-Dist: pyarrow>=10.0.1; extra == "parquet"
+Provides-Extra: feather
+Requires-Dist: pyarrow>=10.0.1; extra == "feather"
+Provides-Extra: hdf5
+Requires-Dist: tables>=3.8.0; extra == "hdf5"
+Provides-Extra: spss
+Requires-Dist: pyreadstat>=1.2.0; extra == "spss"
+Provides-Extra: postgresql
+Requires-Dist: SQLAlchemy>=2.0.0; extra == "postgresql"
+Requires-Dist: psycopg2>=2.9.6; extra == "postgresql"
+Requires-Dist: adbc-driver-postgresql>=0.8.0; extra == "postgresql"
+Provides-Extra: mysql
+Requires-Dist: SQLAlchemy>=2.0.0; extra == "mysql"
+Requires-Dist: pymysql>=1.0.2; extra == "mysql"
+Provides-Extra: sql-other
+Requires-Dist: SQLAlchemy>=2.0.0; extra == "sql-other"
+Requires-Dist: adbc-driver-postgresql>=0.8.0; extra == "sql-other"
+Requires-Dist: adbc-driver-sqlite>=0.8.0; extra == "sql-other"
+Provides-Extra: html
+Requires-Dist: beautifulsoup4>=4.11.2; extra == "html"
+Requires-Dist: html5lib>=1.1; extra == "html"
+Requires-Dist: lxml>=4.9.2; extra == "html"
+Provides-Extra: xml
+Requires-Dist: lxml>=4.9.2; extra == "xml"
+Provides-Extra: plot
+Requires-Dist: matplotlib>=3.6.3; extra == "plot"
+Provides-Extra: output-formatting
+Requires-Dist: jinja2>=3.1.2; extra == "output-formatting"
+Requires-Dist: tabulate>=0.9.0; extra == "output-formatting"
+Provides-Extra: clipboard
+Requires-Dist: PyQt5>=5.15.9; extra == "clipboard"
+Requires-Dist: qtpy>=2.3.0; extra == "clipboard"
+Provides-Extra: compression
+Requires-Dist: zstandard>=0.19.0; extra == "compression"
+Provides-Extra: consortium-standard
+Requires-Dist: dataframe-api-compat>=0.1.7; extra == "consortium-standard"
+Provides-Extra: all
+Requires-Dist: adbc-driver-postgresql>=0.8.0; extra == "all"
+Requires-Dist: adbc-driver-sqlite>=0.8.0; extra == "all"
+Requires-Dist: beautifulsoup4>=4.11.2; extra == "all"
+Requires-Dist: bottleneck>=1.3.6; extra == "all"
+Requires-Dist: dataframe-api-compat>=0.1.7; extra == "all"
+Requires-Dist: fastparquet>=2022.12.0; extra == "all"
+Requires-Dist: fsspec>=2022.11.0; extra == "all"
+Requires-Dist: gcsfs>=2022.11.0; extra == "all"
+Requires-Dist: html5lib>=1.1; extra == "all"
+Requires-Dist: hypothesis>=6.46.1; extra == "all"
+Requires-Dist: jinja2>=3.1.2; extra == "all"
+Requires-Dist: lxml>=4.9.2; extra == "all"
+Requires-Dist: matplotlib>=3.6.3; extra == "all"
+Requires-Dist: numba>=0.56.4; extra == "all"
+Requires-Dist: numexpr>=2.8.4; extra == "all"
+Requires-Dist: odfpy>=1.4.1; extra == "all"
+Requires-Dist: openpyxl>=3.1.0; extra == "all"
+Requires-Dist: pandas-gbq>=0.19.0; extra == "all"
+Requires-Dist: psycopg2>=2.9.6; extra == "all"
+Requires-Dist: pyarrow>=10.0.1; extra == "all"
+Requires-Dist: pymysql>=1.0.2; extra == "all"
+Requires-Dist: PyQt5>=5.15.9; extra == "all"
+Requires-Dist: pyreadstat>=1.2.0; extra == "all"
+Requires-Dist: pytest>=7.3.2; extra == "all"
+Requires-Dist: pytest-xdist>=2.2.0; extra == "all"
+Requires-Dist: python-calamine>=0.1.7; extra == "all"
+Requires-Dist: pyxlsb>=1.0.10; extra == "all"
+Requires-Dist: qtpy>=2.3.0; extra == "all"
+Requires-Dist: scipy>=1.10.0; extra == "all"
+Requires-Dist: s3fs>=2022.11.0; extra == "all"
+Requires-Dist: SQLAlchemy>=2.0.0; extra == "all"
+Requires-Dist: tables>=3.8.0; extra == "all"
+Requires-Dist: tabulate>=0.9.0; extra == "all"
+Requires-Dist: xarray>=2022.12.0; extra == "all"
+Requires-Dist: xlrd>=2.0.1; extra == "all"
+Requires-Dist: xlsxwriter>=3.0.5; extra == "all"
+Requires-Dist: zstandard>=0.19.0; extra == "all"
+Description-Content-Type: text/markdown
+
+
+

+
+
+-----------------
+
+# pandas: powerful Python data analysis toolkit
+
+| | |
+| --- | --- |
+| Testing | [](https://github.com/pandas-dev/pandas/actions/workflows/unit-tests.yml) [](https://codecov.io/gh/pandas-dev/pandas) |
+| Package | [](https://pypi.org/project/pandas/) [](https://pypi.org/project/pandas/) [](https://anaconda.org/conda-forge/pandas) [](https://anaconda.org/conda-forge/pandas) |
+| Meta | [](https://numfocus.org) [](https://doi.org/10.5281/zenodo.3509134) [](https://github.com/pandas-dev/pandas/blob/main/LICENSE) [](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack) |
+
+
+## What is it?
+
+**pandas** is a Python package that provides fast, flexible, and expressive data
+structures designed to make working with "relational" or "labeled" data both
+easy and intuitive. It aims to be the fundamental high-level building block for
+doing practical, **real world** data analysis in Python. Additionally, it has
+the broader goal of becoming **the most powerful and flexible open source data
+analysis / manipulation tool available in any language**. It is already well on
+its way towards this goal.
+
+## Table of Contents
+
+- [Main Features](#main-features)
+- [Where to get it](#where-to-get-it)
+- [Dependencies](#dependencies)
+- [Installation from sources](#installation-from-sources)
+- [License](#license)
+- [Documentation](#documentation)
+- [Background](#background)
+- [Getting Help](#getting-help)
+- [Discussion and Development](#discussion-and-development)
+- [Contributing to pandas](#contributing-to-pandas)
+
+## Main Features
+Here are just a few of the things that pandas does well:
+
+ - Easy handling of [**missing data**][missing-data] (represented as
+ `NaN`, `NA`, or `NaT`) in floating point as well as non-floating point data
+ - Size mutability: columns can be [**inserted and
+ deleted**][insertion-deletion] from DataFrame and higher dimensional
+ objects
+ - Automatic and explicit [**data alignment**][alignment]: objects can
+ be explicitly aligned to a set of labels, or the user can simply
+ ignore the labels and let `Series`, `DataFrame`, etc. automatically
+ align the data for you in computations
+ - Powerful, flexible [**group by**][groupby] functionality to perform
+ split-apply-combine operations on data sets, for both aggregating
+ and transforming data
+ - Make it [**easy to convert**][conversion] ragged,
+ differently-indexed data in other Python and NumPy data structures
+ into DataFrame objects
+ - Intelligent label-based [**slicing**][slicing], [**fancy
+ indexing**][fancy-indexing], and [**subsetting**][subsetting] of
+ large data sets
+ - Intuitive [**merging**][merging] and [**joining**][joining] data
+ sets
+ - Flexible [**reshaping**][reshape] and [**pivoting**][pivot-table] of
+ data sets
+ - [**Hierarchical**][mi] labeling of axes (possible to have multiple
+ labels per tick)
+ - Robust IO tools for loading data from [**flat files**][flat-files]
+ (CSV and delimited), [**Excel files**][excel], [**databases**][db],
+ and saving/loading data from the ultrafast [**HDF5 format**][hdfstore]
+ - [**Time series**][timeseries]-specific functionality: date range
+ generation and frequency conversion, moving window statistics,
+ date shifting and lagging
+
+
+ [missing-data]: https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html
+ [insertion-deletion]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html#column-selection-addition-deletion
+ [alignment]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html?highlight=alignment#intro-to-data-structures
+ [groupby]: https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#group-by-split-apply-combine
+ [conversion]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html#dataframe
+ [slicing]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#slicing-ranges
+ [fancy-indexing]: https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html#advanced
+ [subsetting]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#boolean-indexing
+ [merging]: https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html#database-style-dataframe-or-named-series-joining-merging
+ [joining]: https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html#joining-on-index
+ [reshape]: https://pandas.pydata.org/pandas-docs/stable/user_guide/reshaping.html
+ [pivot-table]: https://pandas.pydata.org/pandas-docs/stable/user_guide/reshaping.html
+ [mi]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#hierarchical-indexing-multiindex
+ [flat-files]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#csv-text-files
+ [excel]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#excel-files
+ [db]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#sql-queries
+ [hdfstore]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#hdf5-pytables
+ [timeseries]: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#time-series-date-functionality
+
+## Where to get it
+The source code is currently hosted on GitHub at:
+https://github.com/pandas-dev/pandas
+
+Binary installers for the latest released version are available at the [Python
+Package Index (PyPI)](https://pypi.org/project/pandas) and on [Conda](https://docs.conda.io/en/latest/).
+
+```sh
+# conda
+conda install -c conda-forge pandas
+```
+
+```sh
+# or PyPI
+pip install pandas
+```
+
+The list of changes to pandas between each release can be found
+[here](https://pandas.pydata.org/pandas-docs/stable/whatsnew/index.html). For full
+details, see the commit logs at https://github.com/pandas-dev/pandas.
+
+## Dependencies
+- [NumPy - Adds support for large, multi-dimensional arrays, matrices and high-level mathematical functions to operate on these arrays](https://www.numpy.org)
+- [python-dateutil - Provides powerful extensions to the standard datetime module](https://dateutil.readthedocs.io/en/stable/index.html)
+- [pytz - Brings the Olson tz database into Python which allows accurate and cross platform timezone calculations](https://github.com/stub42/pytz)
+
+See the [full installation instructions](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies) for minimum supported versions of required, recommended and optional dependencies.
+
+## Installation from sources
+To install pandas from source you need [Cython](https://cython.org/) in addition to the normal
+dependencies above. Cython can be installed from PyPI:
+
+```sh
+pip install cython
+```
+
+In the `pandas` directory (same one where you found this file after
+cloning the git repo), execute:
+
+```sh
+pip install .
+```
+
+or for installing in [development mode](https://pip.pypa.io/en/latest/cli/pip_install/#install-editable):
+
+
+```sh
+python -m pip install -ve . --no-build-isolation --config-settings=editable-verbose=true
+```
+
+See the full instructions for [installing from source](https://pandas.pydata.org/docs/dev/development/contributing_environment.html).
+
+## License
+[BSD 3](LICENSE)
+
+## Documentation
+The official documentation is hosted on [PyData.org](https://pandas.pydata.org/pandas-docs/stable/).
+
+## Background
+Work on ``pandas`` started at [AQR](https://www.aqr.com/) (a quantitative hedge fund) in 2008 and
+has been under active development since then.
+
+## Getting Help
+
+For usage questions, the best place to go to is [StackOverflow](https://stackoverflow.com/questions/tagged/pandas).
+Further, general questions and discussions can also take place on the [pydata mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata).
+
+## Discussion and Development
+Most development discussions take place on GitHub in this repo, via the [GitHub issue tracker](https://github.com/pandas-dev/pandas/issues).
+
+Further, the [pandas-dev mailing list](https://mail.python.org/mailman/listinfo/pandas-dev) can also be used for specialized discussions or design issues, and a [Slack channel](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack) is available for quick development related questions.
+
+There are also frequent [community meetings](https://pandas.pydata.org/docs/dev/development/community.html#community-meeting) for project maintainers open to the community as well as monthly [new contributor meetings](https://pandas.pydata.org/docs/dev/development/community.html#new-contributor-meeting) to help support new contributors.
+
+Additional information on the communication channels can be found on the [contributor community](https://pandas.pydata.org/docs/development/community.html) page.
+
+## Contributing to pandas
+
+[](https://www.codetriage.com/pandas-dev/pandas)
+
+All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome.
+
+A detailed overview on how to contribute can be found in the **[contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)**.
+
+If you are simply looking to start working with the pandas codebase, navigate to the [GitHub "issues" tab](https://github.com/pandas-dev/pandas/issues) and start looking through interesting issues. There are a number of issues listed under [Docs](https://github.com/pandas-dev/pandas/issues?labels=Docs&sort=updated&state=open) and [good first issue](https://github.com/pandas-dev/pandas/issues?labels=good+first+issue&sort=updated&state=open) where you could start out.
+
+You can also triage issues which may include reproducing bug reports, or asking for vital information such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to pandas on CodeTriage](https://www.codetriage.com/pandas-dev/pandas).
+
+Or maybe through using pandas you have an idea of your own or are looking for something in the documentation and thinking ‘this can be improved’...you can do something about it!
+
+Feel free to ask questions on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata) or on [Slack](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack).
+
+As contributors and maintainers to this project, you are expected to abide by pandas' code of conduct. More information can be found at: [Contributor Code of Conduct](https://github.com/pandas-dev/.github/blob/master/CODE_OF_CONDUCT.md)
+
+
+
+[Go to Top](#table-of-contents)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..76e3b5e5e5b7d30c5e818837bf2ca2115885eae9
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/RECORD
@@ -0,0 +1,1515 @@
+pandas-2.3.1.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
+pandas-2.3.1.dist-info/LICENSE,sha256=HeougO0cvQIz-EzuRIaylonxM7q6zPTSleUcQwUfMhY,62399
+pandas-2.3.1.dist-info/METADATA,sha256=8NALVTyD4oFroaHTjg2Db4BkKIel0sdkaPLuDGDHZ-M,91164
+pandas-2.3.1.dist-info/RECORD,,
+pandas-2.3.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas-2.3.1.dist-info/WHEEL,sha256=sZM_NeUMz2G4fDenMf11eikcCxcLaQWiYRmjwQBavQs,137
+pandas-2.3.1.dist-info/entry_points.txt,sha256=OVLKNEPs-Q7IWypWBL6fxv56_zt4sRnEI7zawo6y_0w,69
+pandas/__init__.py,sha256=EIvoyjrhoqXHZe5vh-iGfYfC-1qJEH5sLTpqzJZhK3s,8658
+pandas/_config/__init__.py,sha256=PIOJaU3IvUe9iL66ZztlkJ-R70v2YSVuFIeM5viVSx0,1429
+pandas/_config/config.py,sha256=YwadTnEN93OFAxyzW289d_v4dhWLzxpMHGZrl3xt_XY,25454
+pandas/_config/dates.py,sha256=HgZFPT02hugJO7uhSTjwebcKOd34JkcYY2gSPtOydmg,668
+pandas/_config/display.py,sha256=xv_TetWUhFlVpog23QzyhMYsScops_OOsWIAGnmKdJ8,1804
+pandas/_config/localization.py,sha256=79Q2KU1aHxX6Q8Wn8EGOEUAyv3XIjQ4YaTaEzeFbtwM,5190
+pandas/_libs/__init__.py,sha256=6i-pdZncVhiCRL_ChKyrTLNhn14aDbsYw243-PfAnJQ,673
+pandas/_libs/algos.cpython-310-x86_64-linux-gnu.so,sha256=lxs_8pl80rm-NjBCg7xDogH7kjorchipQlpAGRRjsLc,2061120
+pandas/_libs/algos.pyi,sha256=KEF48zZLn3TSUCmd8thdo4DzYvJ5zaCK60hYX6nzyZI,15182
+pandas/_libs/arrays.cpython-310-x86_64-linux-gnu.so,sha256=w11m8ahDysG3S1Q3Mxfq1FR0SCpFCbGZuKdmhDc8yGE,125056
+pandas/_libs/arrays.pyi,sha256=PfpeOMplxyN2vbfFCdkkSKGCg21SFRydvqBdeJhBVqQ,1105
+pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so,sha256=qMtQDjb4WxRZUItSDkMtu80KN_eilIWQ7sdOiMsA7FA,49440
+pandas/_libs/byteswap.pyi,sha256=SxL2I1rKqe73WZgkO511PWJx20P160V4hrws1TG0JTk,423
+pandas/_libs/groupby.cpython-310-x86_64-linux-gnu.so,sha256=BFzorUIe7Yiy-45JaVFtddLUu85U2LTqXvSHhVJwDfQ,2396144
+pandas/_libs/groupby.pyi,sha256=Q-jrhgZskMvXOhpHP6EhPhutdW4zAoNI2TQ7iE_68qc,7251
+pandas/_libs/hashing.cpython-310-x86_64-linux-gnu.so,sha256=CVrY6_K1u7uGSsFaFFv0pV1Zh-deAzjhoHidmOgSxTo,204640
+pandas/_libs/hashing.pyi,sha256=cdNwppEilaMnVN77ABt3TBadjUawMtMFgSQb1PCqwQk,181
+pandas/_libs/hashtable.cpython-310-x86_64-linux-gnu.so,sha256=jlU901rv5ODMXV6NRpSihg5PPSL-4226pqbpa38tS8Y,2076960
+pandas/_libs/hashtable.pyi,sha256=jBv8QuQii-ikWklP76_DPCYfms88fpj6pPOaCOK6s0M,7424
+pandas/_libs/index.cpython-310-x86_64-linux-gnu.so,sha256=2ldp2Oj0xjsJQ1dCL7hA25XmMs1vTbEIR5dxSni2qf0,877712
+pandas/_libs/index.pyi,sha256=8xJKzarI9fTYhM7kvSfw-G6V12YGnoJ7ToianNQvZ0M,3798
+pandas/_libs/indexing.cpython-310-x86_64-linux-gnu.so,sha256=5SpGjoSbpVME2yaFtIbEPp6hV_NcYouGcj1zeMy1vhk,66624
+pandas/_libs/indexing.pyi,sha256=hlJwakbofPRdt1Lm31bfQ3CvHW-nMxm0nrInSWAey58,427
+pandas/_libs/internals.cpython-310-x86_64-linux-gnu.so,sha256=HQNZQA_-8OMbDCgZ_ydsGEPssp5IKVyT1jvP-jVMVjw,394864
+pandas/_libs/internals.pyi,sha256=1zfOoULlHvpbbRHvPlcrV_kbY7WI3qEXYExbENEDdtE,2761
+pandas/_libs/interval.cpython-310-x86_64-linux-gnu.so,sha256=SdOrL67jijhab83InT0HIQ1w3i_rYaPKrNGKwqQE2c8,1417760
+pandas/_libs/interval.pyi,sha256=cotxOfoqp7DX7XgIeKrGd31mfAeNerW1WD-yBrLfTlE,5378
+pandas/_libs/join.cpython-310-x86_64-linux-gnu.so,sha256=BswXDSgiD9Y5Zi5_JHBIoi_JWLfqXLi9ht5HIGJhkr0,1379776
+pandas/_libs/join.pyi,sha256=O61ZOIYi-I3gZJjDpLYIWWEe3iG0pogEQIB0ZxJ_E3Y,2780
+pandas/_libs/json.cpython-310-x86_64-linux-gnu.so,sha256=UhO3hHMuqrvKwaD99KM_tbm6jpFubA5Re3vqe5yxdFc,64272
+pandas/_libs/json.pyi,sha256=kbqlmh7HTk4cc2hIDWdXZSFqOfh0cqGpBwcys3m32XM,496
+pandas/_libs/lib.cpython-310-x86_64-linux-gnu.so,sha256=TR7Ecd0uUEX8pwjj-kCBSyK6v_wMOoRi60kIAPQnNfk,842176
+pandas/_libs/lib.pyi,sha256=fU6YG6MGFBajevj1_KYnzlyzMlhRYCa-bICpoGnFcDI,7209
+pandas/_libs/missing.cpython-310-x86_64-linux-gnu.so,sha256=KhHmHiXiOf6PvJ1CrYpETl0LSLAD8fHknHeVtpzaGuo,190912
+pandas/_libs/missing.pyi,sha256=iIftmSeHBcfgz7d9JWW_FQcyyAkuBzRiSnZw690OhDw,524
+pandas/_libs/ops.cpython-310-x86_64-linux-gnu.so,sha256=EwpnrRXaXfZafolqRQtwvD_kmt869IVq1lFoLGUXZlY,249856
+pandas/_libs/ops.pyi,sha256=99NSmMUkneVNWOojl8Dsb8GmbUa5y_uhKUtfIgwgwek,1318
+pandas/_libs/ops_dispatch.cpython-310-x86_64-linux-gnu.so,sha256=u66R3rF4Z4PJ80DeFfsG_thAsiGHfgBkCPMVMXDk79g,57632
+pandas/_libs/ops_dispatch.pyi,sha256=Yxq3SUJ-qoMZ8ErL7wfHfCsTTcETOuu0FuoCOyhmGl0,124
+pandas/_libs/pandas_datetime.cpython-310-x86_64-linux-gnu.so,sha256=ZSzI-EVHN_S1ZHJ2b4O2lb8yo5_7Ct-bDWnCCo4FBa4,39264
+pandas/_libs/pandas_parser.cpython-310-x86_64-linux-gnu.so,sha256=8eCpdz4eZnDYGgcedPM9no_H7bp1dOQHk3Z-rqbw4Nc,43424
+pandas/_libs/parsers.cpython-310-x86_64-linux-gnu.so,sha256=AxX_mxFL7w7dQl6vaHPHsUOQAdBRisWm1bjvwQJJ0zU,557776
+pandas/_libs/parsers.pyi,sha256=raoGhPLoRKLQAthm9JQT5rTjLR1PGFDS179aqtQdgnY,2378
+pandas/_libs/properties.cpython-310-x86_64-linux-gnu.so,sha256=pNkRMm84xxIUdfdOIPAPihiPHifmohFk2ByFkkSzjW4,83776
+pandas/_libs/properties.pyi,sha256=HF93vy5OSNtQKz5NL_zwTnOj6tzBtW9Cog-5Zk2bnAA,717
+pandas/_libs/reshape.cpython-310-x86_64-linux-gnu.so,sha256=MUqx8HeyopqIYFp_54_tp4hrJZup3yC8AuQzh3joJRU,287904
+pandas/_libs/reshape.pyi,sha256=xaU-NNnRhXVT9AVrksVXrbKfAC7Ny9p-Vwp6srRoGns,419
+pandas/_libs/sas.cpython-310-x86_64-linux-gnu.so,sha256=CVVkS_zuK5AEr0PzBo_4kUTFZShhnnFjZ0koV2L9M58,254432
+pandas/_libs/sas.pyi,sha256=qkrJiuBd7GQbw3DQyhH9M6cMfNSkovArOXRdhJ8PFDA,224
+pandas/_libs/sparse.cpython-310-x86_64-linux-gnu.so,sha256=DA65GYdB3XpgaVC2kLr_Go5FxQu7-kCedE2rqCZATCY,836704
+pandas/_libs/sparse.pyi,sha256=Yyi7QHpAt7K6l2iEhxgufRqbvSRfYpBHeC_hJaSK8Ho,1485
+pandas/_libs/testing.cpython-310-x86_64-linux-gnu.so,sha256=2TFTXdeW0tZXzGr44KznjNOzPxyLMdnlXJFgH0bQzec,115232
+pandas/_libs/testing.pyi,sha256=_fpEWiBmlWGR_3QUj1RU42WCTtW2Ug-EXHpM-kP6vB0,243
+pandas/_libs/tslib.cpython-310-x86_64-linux-gnu.so,sha256=cy7hajQnyel-lwj_gM1GxsgZJWsv2BHiCC0rCqyapB0,324096
+pandas/_libs/tslib.pyi,sha256=aWJDfzlbmlF6sAst1BTMKMcWt3me50-sqCS5YwWt0HI,969
+pandas/_libs/tslibs/__init__.py,sha256=dowITNV3Gxq8wB3XdqiyRCtEDn83_GkLcGJiQnzM1mA,2125
+pandas/_libs/tslibs/base.cpython-310-x86_64-linux-gnu.so,sha256=RUAFCz5LSk94q6r_sc1fJrdPm-aiG1MPwrun22rK4o0,58208
+pandas/_libs/tslibs/ccalendar.cpython-310-x86_64-linux-gnu.so,sha256=DA3jf_inh9rla0p0uVYJbTSIvxqQO7PXDKKYGewLU20,94592
+pandas/_libs/tslibs/ccalendar.pyi,sha256=dizWWmYtxWa5Lc4Hv69iRaJoazRhegJaDGWYgWtJu-U,502
+pandas/_libs/tslibs/conversion.cpython-310-x86_64-linux-gnu.so,sha256=XUkvuUjsOmGcApAfy20Y2Pim469O5O7EzbXuNGLizDM,295744
+pandas/_libs/tslibs/conversion.pyi,sha256=sHO9CBRrDh0wovkr736kI5G6gaW1WY9tSOOAkBi63MA,300
+pandas/_libs/tslibs/dtypes.cpython-310-x86_64-linux-gnu.so,sha256=Cd6sV2bJj5kej0VRvoUVP1s4YS8djwnwUynOQxA1LIA,190400
+pandas/_libs/tslibs/dtypes.pyi,sha256=ZNUPcAyhkkh7kIGLDIDTfUmwefbtdxxvn668YN-AAeE,1988
+pandas/_libs/tslibs/fields.cpython-310-x86_64-linux-gnu.so,sha256=Ei4MMAcA5l-M8F6MG1d6b2xJclRUdRZ33r4DIfCBudc,324352
+pandas/_libs/tslibs/fields.pyi,sha256=LOke0XZ9XJnzX2MC9nL3u-JpbmddBfpy0UQ_d-_NvN8,1860
+pandas/_libs/tslibs/nattype.cpython-310-x86_64-linux-gnu.so,sha256=aSpgQ4CRbb88vCUhdV-UFmC4dh_RD3dmLEJWFvu_03k,225088
+pandas/_libs/tslibs/nattype.pyi,sha256=R3qw7RgZFLG7IgKTssmJdjm-lP3V18GEz810nzVHsTs,4116
+pandas/_libs/tslibs/np_datetime.cpython-310-x86_64-linux-gnu.so,sha256=mobCe1qxIumxPBNTfETNeP-eTLhYJCIq9KCqSaKhw2E,135840
+pandas/_libs/tslibs/np_datetime.pyi,sha256=Y6l1KVdyKTMiYfzOjXNwV946GjoFAHaCEEhLDsHRCxI,831
+pandas/_libs/tslibs/offsets.cpython-310-x86_64-linux-gnu.so,sha256=IaX5B1Pmytd-xBZQV2NLTceEQlYRsmHMgg7WaSJEOGI,1012144
+pandas/_libs/tslibs/offsets.pyi,sha256=QkYq2CgQ4aZ-92e_8wSpuxaACBIKjk2eI4-M-6wSeZU,8345
+pandas/_libs/tslibs/parsing.cpython-310-x86_64-linux-gnu.so,sha256=hQFMuBP-eWkISLAeu0wJnosSjWlz82dIdMnOSxZmBBg,420016
+pandas/_libs/tslibs/parsing.pyi,sha256=cbS8tHb95ygwDU-9gNaFs83FpbVj8aoQfw7gwJGEE6o,914
+pandas/_libs/tslibs/period.cpython-310-x86_64-linux-gnu.so,sha256=uDBY9UyPXMtpqjkjDcw-WNMVmszTYkZSJOviJs7tO2k,499200
+pandas/_libs/tslibs/period.pyi,sha256=Bf0lYd6dh9O61Gq_TReVI4NcRf-5aINkdYJNDaq5az8,3908
+pandas/_libs/tslibs/strptime.cpython-310-x86_64-linux-gnu.so,sha256=K9UkTqTnqx2pOtJ0zT4-GUl4E58e-DZvS10mgWq4FnU,373856
+pandas/_libs/tslibs/strptime.pyi,sha256=dizASoJenvjCydaWDo72_FQmiNOjLmnCZbUZgCm8EnI,349
+pandas/_libs/tslibs/timedeltas.cpython-310-x86_64-linux-gnu.so,sha256=mDobi_DWhoEug9YmVJMeC2IsLqMWljQK--pHIybwYj8,586656
+pandas/_libs/tslibs/timedeltas.pyi,sha256=6MW61MbVDqOH4JUQoR32z8qYUWRfPECV3fcQSrOkI_M,5009
+pandas/_libs/tslibs/timestamps.cpython-310-x86_64-linux-gnu.so,sha256=ePt_Z1NwDd2Rma94MFXUviGKhIYJK6zQI8rB2EAARTA,615984
+pandas/_libs/tslibs/timestamps.pyi,sha256=zCu9cAbFf_IVDb1sf5j_Ww5LYSFzGVwMhpZZUP370kw,7831
+pandas/_libs/tslibs/timezones.cpython-310-x86_64-linux-gnu.so,sha256=1Pl6yiu-YIbThakAVgOHa0VmPWK6vwK4FgGZg1HgdWw,274464
+pandas/_libs/tslibs/timezones.pyi,sha256=MZ9kC5E1J3XlVqyBwFuVd7NsqL8STztzT8W8NK-_2r0,600
+pandas/_libs/tslibs/tzconversion.cpython-310-x86_64-linux-gnu.so,sha256=DsZuvTYoSxX3nRFUCsVKCwocTnzmz2uSvGXmO48uO2I,312192
+pandas/_libs/tslibs/tzconversion.pyi,sha256=MW4HtIKZpf7ZcOUQ4U6FL24BiJpASXI-mN0DOADtl10,560
+pandas/_libs/tslibs/vectorized.cpython-310-x86_64-linux-gnu.so,sha256=9MqNGO5V9BZ3-EE49CYHudaoAyOakrdwWJTZ6qpa5AE,237888
+pandas/_libs/tslibs/vectorized.pyi,sha256=Dv5ryF4HiPZcHWMyxyfP4D_tONdqLm2Mn4MpVi5RKCc,1239
+pandas/_libs/window/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/_libs/window/aggregations.cpython-310-x86_64-linux-gnu.so,sha256=tV4jGowCrEhW_AmPANbUhpsnK1pZyR-QOCivPtxTlss,390192
+pandas/_libs/window/aggregations.pyi,sha256=vVjfgqY4cBPmjFadcrDc6heCiFbJ5Lz65bCadbHJbwU,4063
+pandas/_libs/window/indexers.cpython-310-x86_64-linux-gnu.so,sha256=8IPvKPHelj1He9PL_VdIWKZQU4DPkinPvoDZFFk16RQ,200512
+pandas/_libs/window/indexers.pyi,sha256=53aBxew7jBcAc9sbSoOlvpQHhiLDSWPXFcVbCeJDbQA,319
+pandas/_libs/writers.cpython-310-x86_64-linux-gnu.so,sha256=6WWFhMU2eA8IZG9eQcj-Ymc0GC6WhzeHxI3Mo-be5I8,238528
+pandas/_libs/writers.pyi,sha256=RvwFCzrsU4RkKm7Mc3wo12RqdGdo-PuANkMo3Z9hLiU,516
+pandas/_testing/__init__.py,sha256=GbvKDUymC5sD9x0oVVcv0EAtS8rBbkmoREWXfHLPpkU,17525
+pandas/_testing/_hypothesis.py,sha256=WS4ysEJwmMor02cwMw15kBtAR0SLvUUpTfYEpc0c6iI,2426
+pandas/_testing/_io.py,sha256=OwfQ9L0XZgD_Yfi5mF8_BLgPx8pgGZbTzq46uTa7jDo,4448
+pandas/_testing/_warnings.py,sha256=x7YMaPkmSaimJquGT3vAt9pKn0r_Hj5lE1uV0eCoDiU,8357
+pandas/_testing/asserters.py,sha256=R8oCv64OxoOG34eBfe3fefNREJMvd5HmK7LnSmyOM3s,48276
+pandas/_testing/compat.py,sha256=0o_biVI-wLh7kcw9FHvbwYyzNvM0PI06QRD2ZhiD2Fs,658
+pandas/_testing/contexts.py,sha256=k7285N1WPGUyx9CehZwdht7EiedX_9qFllTMwlUUoWg,6618
+pandas/_typing.py,sha256=gVSimiU46Dduc2Ez8ZaOczv8c-UHTH4FZeg6LL6mnGk,14037
+pandas/_version.py,sha256=ZxZGMudV0z7nwoI4ob0XkOVPs_ZIcLQ0LefZuMvWJmw,23677
+pandas/_version_meson.py,sha256=uVLZR-_w4KnoAJCTvTKzGIUWY866wBH1wfJ3JOU7Q8o,79
+pandas/api/__init__.py,sha256=QnoYVW828TM17uq-3ELeethZm8XN2Y0DkEaTc3sLr3Q,219
+pandas/api/extensions/__init__.py,sha256=O7tmzpvIT0uv9H5K-yMTKcwZpml9cEaB5CLVMiUkRCk,685
+pandas/api/indexers/__init__.py,sha256=kNbZv9nja9iLVmGZU2D6w2dqB2ndsbqTfcsZsGz_Yo0,357
+pandas/api/interchange/__init__.py,sha256=J2hQIYAvL7gyh8hG9r3XYPX69lK7nJS3IIHZl4FESjw,230
+pandas/api/types/__init__.py,sha256=bOU3TUuskT12Dpp-SsCYtCWdHvBDp3MWf3Etq4ZMdT8,447
+pandas/api/typing/__init__.py,sha256=IC4_ZmjsX4804Nnu-lQDccQr0zt5mzIZEaB3Bzdva8Y,1244
+pandas/arrays/__init__.py,sha256=gMhtojH1KdRwxMmM_Ulblxk4L09o7WLUsXLp6qdUS-I,1227
+pandas/compat/__init__.py,sha256=kS53YWHU26L7fHA_dS6UCr7TGHCxYgynOQ70YuX7tOs,4532
+pandas/compat/_constants.py,sha256=3_ryOkmiJTO-iTQAla_ApEJfp3V_lClbnepSM3Gi9S4,536
+pandas/compat/_optional.py,sha256=96Zlc2gqUYneSzSlraVRGfh2BsTWp4cOUcG2gHjw2E0,5089
+pandas/compat/compressors.py,sha256=GdDWdKzWqkImjdwzuVBwW2JvI7aMzpPV8QyhxWgJo0g,1975
+pandas/compat/numpy/__init__.py,sha256=UO-06Rj2g2Mk9rptXZG_fLtA3BhSPMVF4JhTLdSt5AM,1366
+pandas/compat/numpy/function.py,sha256=Qvflr9h4rYCw9o8I3RggkhdRqxvav1yioq_JeEUh2T4,13291
+pandas/compat/pickle_compat.py,sha256=MTp_LYeueJWVJBWKzWUyiwcwu9MvjEtBzEC0SozvWs8,7723
+pandas/compat/pyarrow.py,sha256=HsIOSx5eWLOeQDrhpTtHzP4gKGkBLwPw60n2GWgUWXM,1393
+pandas/conftest.py,sha256=mH_w2h4R2mLF_GP_dUr5ghBvM65U8tVk-gC5pMYSVQY,51045
+pandas/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/_numba/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/_numba/executor.py,sha256=vsH8jIzWRHho1Au4euWT2opfg5YLG4SBD7xlpvvXGUs,7530
+pandas/core/_numba/extensions.py,sha256=awk7FcE_idoVGG0fc90R3qNFD-BFnghXuF3KrytB7hI,18430
+pandas/core/_numba/kernels/__init__.py,sha256=Z1t4IUC2MO0a5KbA0LurWfRZL4wNksHVBDLprGtPLlo,520
+pandas/core/_numba/kernels/mean_.py,sha256=BesqY1gwFXPIeuXAQtDvvDBZuegsszFVTnl4lxguXEA,5646
+pandas/core/_numba/kernels/min_max_.py,sha256=tJ7OSKhne7jXpy4XSBpQS0tkP_0LggkH6iqWlxQ-FeE,3284
+pandas/core/_numba/kernels/shared.py,sha256=JUBa96LX4NmXhgXNyo859IwMXEl29EyhmRdMoQo1n78,611
+pandas/core/_numba/kernels/sum_.py,sha256=FeKOQl22qO6kN4hAmwmA3wXihrph5S03ucSt65GBquU,6488
+pandas/core/_numba/kernels/var_.py,sha256=5BaLdr7HKzdUvKvyifvL9qM36W16SAqk3Ny11OtpW9o,6973
+pandas/core/accessor.py,sha256=u57BIkm61_SNRzSdQjL210Jtil7BWFUB0HPNl9wCKdo,10044
+pandas/core/algorithms.py,sha256=gcP6Crbhyuf05Q52Lav84bkHtwCsYyzQFT8RFfpLWD4,55180
+pandas/core/api.py,sha256=9tm275sTpOKtdUvsFCXYQHmBdeJczGNBV1QGv3TQOOc,2911
+pandas/core/apply.py,sha256=ChLu7u0YETP8dboHansS0ZcjGqthfBwlFKLfONl9EXs,67184
+pandas/core/array_algos/__init__.py,sha256=8YLlO6TysEPxltfbNKdG9MlVXeDLfTIGNo2nUR-Zwl0,408
+pandas/core/array_algos/datetimelike_accumulations.py,sha256=BCy87HXqI2WO0_cCGK-redvi2STJzCxswYYs06YdxB4,1686
+pandas/core/array_algos/masked_accumulations.py,sha256=PL-ZAMai7H1PIXLKE2f9LSL2Ow6WZqkusSQkFfIE8d4,2618
+pandas/core/array_algos/masked_reductions.py,sha256=3hgYzhgIQT5qY2Jj59-hwui8qGKhqtr6KKK51jxfqPY,5067
+pandas/core/array_algos/putmask.py,sha256=g02wtMt5MTIuT4IS6ukE1Eh8KWb3Hi932hc47dszqJ4,4593
+pandas/core/array_algos/quantile.py,sha256=zdzcwgoVRP3eBSM4NJHwocBJC3PINYN1jB02mJubFow,6548
+pandas/core/array_algos/replace.py,sha256=wfDHbLfXfZvSGkEgFvcmew5kWn8L_yef-XMsTmIlzZM,4010
+pandas/core/array_algos/take.py,sha256=n_pjn9mU7QQJ77SFXogEc5ofoMqRgNbkimwXFunz79M,20815
+pandas/core/array_algos/transforms.py,sha256=TPpSPX5CiePVGTFUwnimpcC5YeBOtjAPK20wQvG92QI,1104
+pandas/core/arraylike.py,sha256=BD2ZQP4zGPd4rJas9lS5C-_qp3XXDL2udU8tzD9bQIQ,17655
+pandas/core/arrays/__init__.py,sha256=dE6WRTblcq40JKhXJQDsOwvhFPJstj_8cegiLthH0ks,1314
+pandas/core/arrays/_arrow_string_mixins.py,sha256=4R2uYOP7x13__GfmE21jOSwZ-rAcDTXWZ8XzlWiqdyE,12560
+pandas/core/arrays/_mixins.py,sha256=1LuY5ZmBfMlW1uY0l9QxK7E5Wet05NfbvQ5BrRlsgGg,17406
+pandas/core/arrays/_ranges.py,sha256=Ig3E_ROJ5mbOtK639SJ0UqcI229BrtsAfa_avbqrO8g,6996
+pandas/core/arrays/_utils.py,sha256=RmwOy6xNhgZ61qmk_PFnQ5sW-RVrkOhsl4AvQyqOuAY,1901
+pandas/core/arrays/arrow/__init__.py,sha256=-EKwaHww-yrbm7Z5d3AN_KETWmXYgZ2dW6KHaE2iiLI,221
+pandas/core/arrays/arrow/_arrow_utils.py,sha256=RulRjyWzUn9gVFVeypndUwDLezpR2SWACD6_BYmxKDg,1586
+pandas/core/arrays/arrow/accessors.py,sha256=tnhqgzdt-AwoekYClqDIiRN9hIIK1VHkQv3_cOYP9F4,13887
+pandas/core/arrays/arrow/array.py,sha256=Q1k1WUV9W8hn7aYXpxeTTmeYFSy647KwaesD_Yyv8xM,103022
+pandas/core/arrays/arrow/extension_types.py,sha256=NJLTuf_8U8u-Fjt_qfWm7zhUtPQdvjH1JV8fY3oRv-Y,5459
+pandas/core/arrays/base.py,sha256=WLymOfb1IfGv0PNYoHoCLQTNUrLC-CZ--RED7kvDRTc,85698
+pandas/core/arrays/boolean.py,sha256=ln7GjlHHTtByAhQKX9XuymhifZTCNSpk1j7I-fQKObo,12440
+pandas/core/arrays/categorical.py,sha256=HA4dx9eixNeqbigMrmRk5gsXYRZ9BgPaL7WUBkZQDK0,100418
+pandas/core/arrays/datetimelike.py,sha256=fSbpUqiBljmsmvlf5iRsCESEtp6ge0hQVoL6GIvYOME,90548
+pandas/core/arrays/datetimes.py,sha256=N9uK8ieFv80NTcoN1BWWhy12sqBh7yN7Kb-icOWse1k,92963
+pandas/core/arrays/floating.py,sha256=pvZ72VDstzgslAM5-36KEyJ0z5PBVwTNogcJAxhhMP8,4286
+pandas/core/arrays/integer.py,sha256=FWsrgzs_DB3eG8VX1kfzUTMcKOHfa-ACFQh_xVpZPJU,6470
+pandas/core/arrays/interval.py,sha256=NsaDlzxiRTj6awmxgr7UYE8HQoSexy-Rozck5ce-J0Y,63830
+pandas/core/arrays/masked.py,sha256=qa7fJCCSRu_qnGYM2ci73MzXv56wf9Q3ITGi_xNp8vU,56578
+pandas/core/arrays/numeric.py,sha256=lVpSpsG_66z2QMHghCRoYef6dVJJ_QZAf9vkpLMJokI,9165
+pandas/core/arrays/numpy_.py,sha256=-WhRo2Hy9aYams3eZmjuuLpkGuyM1Wl_vTZ92hmKx_g,17885
+pandas/core/arrays/period.py,sha256=VmfDHc7OC20gytcJ-qDRaipX7kJWN0LPoW6owMyk3Eg,41620
+pandas/core/arrays/sparse/__init__.py,sha256=iwvVqa2GG9TjYrd1rxCBjdLeGQBoRqUO2fZnILElbZg,356
+pandas/core/arrays/sparse/accessor.py,sha256=lZa3hwvXJKLMkXhqiWU8eev8qthvYQ1HgtW875qQe7g,12503
+pandas/core/arrays/sparse/array.py,sha256=tIAxGKX3yHW6YDBzLvfjIbQXBJP-MQup8f_U5yunmag,64585
+pandas/core/arrays/sparse/scipy_sparse.py,sha256=rVaj3PtVRrMPlzkoVFSkIopWV0xg0GJnpt1YljWT_zg,6462
+pandas/core/arrays/string_.py,sha256=lI2TBgwVWtievJrVXTmPJRaZyRoDRLJW8QBrJIwVzqI,38070
+pandas/core/arrays/string_arrow.py,sha256=KCj5cu8UQ4IajxG-waZTQ-p8Kt47XJbSpG66khw_LJk,17416
+pandas/core/arrays/timedeltas.py,sha256=eTi8b16Jumac8WIx8LLf_9ZeFzA4u1nipHMUoc5-lyM,37830
+pandas/core/base.py,sha256=em41dG9syrQXWeGG5f8v_ubiYfgP9GDZfvwwLNM1sJs,41384
+pandas/core/common.py,sha256=WwkpCOI8b9j5rxkhL_Dh5l-7EdkHFfSjIIx-QBsefa0,17449
+pandas/core/computation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/computation/align.py,sha256=IBp-G1qbFMICrgm8DYOF-Kt18iCcY_P3peeIGsDkNv4,6161
+pandas/core/computation/api.py,sha256=CQ2AF0hwydcgTHycMCFiyZIAU57RcZT-TVid17SIsV4,65
+pandas/core/computation/check.py,sha256=Vb1YqLq381-nUp8Vjkg6ycJOxP3dV2aO9XjyM1uhe2Q,226
+pandas/core/computation/common.py,sha256=-2EHScxo2jfEQ1oqnnlQ_2eOvtAIn8O2krBaveSwmjs,1442
+pandas/core/computation/engines.py,sha256=g9eiyVCUtNmJGbexh7KvTreAKKhs5mQaWx4Z5UeOZ5s,3314
+pandas/core/computation/eval.py,sha256=LLnOIBxP2AA9D21NdogPmc7cHL_Rm0729fqVR6HObq8,14212
+pandas/core/computation/expr.py,sha256=C9w_peWLaszjqJi6KjEW8dmnJJKBlW--kpa2i4PCZds,25269
+pandas/core/computation/expressions.py,sha256=K0vu_v8JBVjJn6eQqNocC4ciNKsIYnEZrq8xwvhik2M,7503
+pandas/core/computation/ops.py,sha256=x5Qe3PfjHF5v-FHBerUr39iNXk_T0hLvw0Wchm0RiAQ,14829
+pandas/core/computation/parsing.py,sha256=VhYh3en2onhyJkzTelz32-U4Vc3XadyjTwOVctsqlEI,6399
+pandas/core/computation/pytables.py,sha256=7-L2GZ43aWNKG6hz-j8RhL8BIEGAEvpYi6rX6Zsvm_4,20745
+pandas/core/computation/scope.py,sha256=eyMdfx-gcgJaVIRY2NBgQDt2nW5KSdUZ3M9VRPYUJtU,10203
+pandas/core/config_init.py,sha256=8-VUEhbIJ2_qnBNQjDT_Qjz7Au9E1Grg8c8YZdc3rfs,27004
+pandas/core/construction.py,sha256=LL1wNdLYbHcRfQNbTrSh5VPIyEHYPISUlCl1cHpOhjE,26384
+pandas/core/dtypes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/dtypes/api.py,sha256=5mtML1OspdDbsWShw1fsDq93pg2pmuUGSBrvQWQcCgg,1819
+pandas/core/dtypes/astype.py,sha256=awzOpnfZ0dCYhzw_J4fekT7u0F0VwgsIapuiAbBkxxg,9207
+pandas/core/dtypes/base.py,sha256=EeL8zNbMtrvObdEJtqjkG_vIsoQE8zDZiIR2dHzHKPI,17042
+pandas/core/dtypes/cast.py,sha256=AQE8TKIbTfTAvEn06D0h_6hjKy9a-m5W7W0kcge9jV8,62726
+pandas/core/dtypes/common.py,sha256=QtwlJgSKUvcwdxAwOOKxKW6Isnx_DuB6uBorYbz4cSk,48001
+pandas/core/dtypes/concat.py,sha256=Q_QujfB0C-CIWbcTlktmB02RgxCf7xQsOgEkOV67VPo,12579
+pandas/core/dtypes/dtypes.py,sha256=Iom_4KXCBa1T9w363LmO6miVd8WHE5fWyOLUpQGR47Y,76055
+pandas/core/dtypes/generic.py,sha256=avKoJBzIQ0pJiFg9mmQ1D5ltkZsYxu8uPa46Hat70Ro,4122
+pandas/core/dtypes/inference.py,sha256=OqA9itS2osQBP-mp8jJK9RJZJps4VPsTIvQFCX4EbGM,9012
+pandas/core/dtypes/missing.py,sha256=BPzbmr7O7ihmjLKE9A31ck54ANjAtrp8-dVT20MR5fQ,23632
+pandas/core/flags.py,sha256=NxbTcYlNEaO8MKCpbEc22PEpInFn7f7za7EAO6-mxEE,3763
+pandas/core/frame.py,sha256=fo5VV79qL9trbaG6-LbjGFo8A_ZrKTFuSyeH8U4J9k0,447493
+pandas/core/generic.py,sha256=eqe9eu5sdeWu2_7t7WDQuSZwaT9LD0yJHzAwY2lp1yg,475380
+pandas/core/groupby/__init__.py,sha256=KamY9WI5B4cMap_3wZ5ycMdXM_rOxGSL7RtoKKPfjAo,301
+pandas/core/groupby/base.py,sha256=OrqG2_h_Bp8Z_MeLrAGWGROG-MtSloGqeaJ79qYbJm0,2740
+pandas/core/groupby/categorical.py,sha256=iCsl3d_unK4zAh_lR3eDIBVOhwsv9Bj9X1wbnaR90pw,3047
+pandas/core/groupby/generic.py,sha256=LCsrCIjuhcEz-yw3gyk5nYKNiMF1h8en6nQO1hhTywE,96885
+pandas/core/groupby/groupby.py,sha256=hOi--l4xW6Ya9ELP6iw_76ayBIniDXAD8zKlSCwsh_A,196078
+pandas/core/groupby/grouper.py,sha256=Dl-0aoi3WEM9XXkEGNdv1aD8chxr6jteajAHhz3MU3c,38703
+pandas/core/groupby/indexing.py,sha256=QY4GZ4wDd-1K-we0EfdiFvmdAZ_VxVgPrYB0kBZf6wU,9510
+pandas/core/groupby/numba_.py,sha256=XjfPfYGbYJgkIKYFiq7Gjnr5wwZ8mKrkeHKTW42HZMg,4894
+pandas/core/groupby/ops.py,sha256=qZPzps8n5_67_FcGpByM9G4PFqr7f4PWcwf52Os16uI,38234
+pandas/core/indexers/__init__.py,sha256=M4CyNLiQoQ5ohoAMH5HES9Rh2lpryAM1toL-b1TJXj0,736
+pandas/core/indexers/objects.py,sha256=PR063DVlu8_-ti7GsLRb0e7o4oAz2xpMil0nMee18z0,14737
+pandas/core/indexers/utils.py,sha256=TgVCAX9r4MZw3QPH6aE-d55gRZcKN9H9X-MTZ4u-LiY,16069
+pandas/core/indexes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/indexes/accessors.py,sha256=MdP8zNlSQeeU7psOXwGUdQ1-8XKzYCl5mKMIcpMCiN8,19152
+pandas/core/indexes/api.py,sha256=tDBBn84I19nvPFQKj0GAZhb0zioLJqTUJjSVqyc4Fn4,10426
+pandas/core/indexes/base.py,sha256=dp-is3i5GQfl6lYro-cM2stcyXPvRM0fkH3TPbHogy0,267385
+pandas/core/indexes/category.py,sha256=_6LpQtBGFsgB4KSZhxEQT4QX57W3172MbvLIAzxboPA,16128
+pandas/core/indexes/datetimelike.py,sha256=JH8_o2NJNQj1A0N0YFcC3m5nQGStacI5bv1G-dzYKVA,28377
+pandas/core/indexes/datetimes.py,sha256=9WlccEKDghA6i_CTgcvDfsqa0qEzG9mHoJq1k7WgG0k,38330
+pandas/core/indexes/extension.py,sha256=-g-4POQ_dox1g3zG-HSZDCYu_UAwdQTMTZ-w7Rz63LE,5228
+pandas/core/indexes/frozen.py,sha256=QuFW2zV8wqY7PD5PHbUMJQc3a-c5Eyfkjblp4umOylM,3482
+pandas/core/indexes/interval.py,sha256=ISEFn2oinehs_WXcVDMMP1MOWeDd0FHeJkOxLM08GFI,38246
+pandas/core/indexes/multi.py,sha256=fp_JSAmx8zBjVUNT-lMDGwEkJAQG8e-wUfo6hccny7c,144147
+pandas/core/indexes/period.py,sha256=ohh7J43CgV1ijxn9ozNhO5Vwu0k1-3yURIWTWeNPRgg,18978
+pandas/core/indexes/range.py,sha256=qt5IS2batjnOHe90UK5jES7pZhglppW_-1wieLlZysA,39511
+pandas/core/indexes/timedeltas.py,sha256=9a5m2wLQUA2v2O6JibpDSssNvNzV8Af6dAJETEpD4qM,10960
+pandas/core/indexing.py,sha256=TRrbtBeUrELiuFiCpAVuP0yIsfrxVLvBbT9bPvlCAmY,97236
+pandas/core/interchange/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/interchange/buffer.py,sha256=KujVQ1qeXMjgRdvwea37FqO9f2ULmLa6Rtr_mTQ11XU,3453
+pandas/core/interchange/column.py,sha256=tlHYyU6RP9ESD693d4WpDUNP0hq7MaTZnm6tLJXSq98,17547
+pandas/core/interchange/dataframe.py,sha256=M1mWjS70pYLFJau534NtgslcpY_8NiY4dRmRgT73TVo,3879
+pandas/core/interchange/dataframe_protocol.py,sha256=L9Wy8vB5oTsuYJQ9NBY4RIEAWXBclnTOH3I_txkIbZk,16177
+pandas/core/interchange/from_dataframe.py,sha256=m2Xu6_bXCNqZZhNvN9PT7vklzc51h_ItpFfu7h-LqD4,18077
+pandas/core/interchange/utils.py,sha256=TNyR-uXm7J_-wU0CLpIf9ih_bq8p5aBuUv6O_41wKK8,5051
+pandas/core/internals/__init__.py,sha256=LE8M58WRu_cvQZns2dxUMeBVjqNfwRWw6vtWKiBrr2I,2615
+pandas/core/internals/api.py,sha256=s78Hb4dHuBAufRH9vTd1KO6o0bs-9CoBOsRF6GP03lE,4695
+pandas/core/internals/array_manager.py,sha256=q_QKlETGKdb1r8aFKVfV4ZrMoVO1wFNAC2JNHCZ6rGE,43927
+pandas/core/internals/base.py,sha256=pO6sju5EIq7u23J7CGPZNTEotbL4KYKzRgyIEmBhqpg,11161
+pandas/core/internals/blocks.py,sha256=JmqtO3vd5hCa6UnT-yrCCQelO__EliVte59HODSXrOU,101163
+pandas/core/internals/concat.py,sha256=Q_MnHIKSMBvIvA6DpMNkcsQSv8aU9DivUn1mlA_9zEs,19151
+pandas/core/internals/construction.py,sha256=KTXO-vrWKfm8-HwTLrsw0r0qVPadXc5pJ_lmkb8U25s,34207
+pandas/core/internals/managers.py,sha256=toDgoWhpnOJiwytqyR_X5AmJkmqetYvBq6KbMR9T6-U,81576
+pandas/core/internals/ops.py,sha256=Rh2-gWjeSwXnjkiacohSNM5iNvqQqBiAqgblwP6rD9o,5145
+pandas/core/methods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/methods/describe.py,sha256=IeCkAFDUdVNxoPPqP1R1HzDlKFQHvlg46AgIxntD5Cs,11961
+pandas/core/methods/selectn.py,sha256=oomBEebumUfbJ5OLi9vw7saH31vbiy3lK-i63VKWBOw,7696
+pandas/core/methods/to_dict.py,sha256=sep0EfimrQ5UNJu-KwC1uYzx1BvbrackOe2-qxl2F5Y,8649
+pandas/core/missing.py,sha256=x_XOmge6_k9uIij2tyJZBEFKpAju1xUS9knQhe5kleU,35270
+pandas/core/nanops.py,sha256=kJpYqWg4E-D89HOXcufquZH0_rPFRbgbmZAULygpDnU,50984
+pandas/core/ops/__init__.py,sha256=CQ7tQB-QPUxD6ZnbS2SzFVjjvCD7-ciglexkdbbn7y8,1620
+pandas/core/ops/array_ops.py,sha256=wNV7RL-HZoB_I61YlF5nskpH-4RxA2n3P_gj31i18FM,19079
+pandas/core/ops/common.py,sha256=jVf_L_oN6bKcUOuH6FgaKOx18se9C3Hl2JPd0Uoj4t4,3500
+pandas/core/ops/dispatch.py,sha256=5XFIr7HV1Dicohgm0ZJu-6argn2Qd0OwES2bBxQwCj0,635
+pandas/core/ops/docstrings.py,sha256=WlGWcWjNsldPW73krxbgRwQvkacmKqRqJsN4VVz-FXU,18448
+pandas/core/ops/invalid.py,sha256=5-gRzdBfk2F8qIZ_vzUlnI-vo1HsAh2F5BYJUEN--m0,1433
+pandas/core/ops/mask_ops.py,sha256=0sm9L1LB_USp8DxNBuCdoB8cJ_MzzvSAb_u3QQmQrKI,5409
+pandas/core/ops/missing.py,sha256=0WlqN_us0LU5RAdoitM-Ko_4xghJ_HBRkteLQ53fU14,5140
+pandas/core/resample.py,sha256=QeYYkKg1ILpdJYfA_9NGYCqDL061AUmQbjN5a6zSV1g,95573
+pandas/core/reshape/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/reshape/api.py,sha256=Qk5y-D5-OdRYKkCgc-ktcxKGNGSCPteISEsByXFWI9M,680
+pandas/core/reshape/concat.py,sha256=qwXsAlI9pnLld1pj9uqHf2zinXd-fj8GE3kZ-XNVacU,28253
+pandas/core/reshape/encoding.py,sha256=jcRfM1NdE6FSjrvrYD8a--PsqXTq6FTFWfC2mwIzS54,19016
+pandas/core/reshape/melt.py,sha256=Zj6PSyI3Dbi_aQPhYyFTz_cWi9m8kIubwItq57JNCFQ,17400
+pandas/core/reshape/merge.py,sha256=WiJNUTxQywQPl0FUPyuy-sThsCK4QEADDOqwDmOSfCo,99673
+pandas/core/reshape/pivot.py,sha256=ylkSVYQcoMmuxqvEoyEP6YHzeVtGL9y6ueAEfN6_RzY,28917
+pandas/core/reshape/reshape.py,sha256=_slnrYBb1ZFgqP1501D5JNF5LmWzD2PQGDtrzwk-eP0,34661
+pandas/core/reshape/tile.py,sha256=bDzSjjPydhiCce0DOJab1327a613mhs98PimwfIddjQ,21947
+pandas/core/reshape/util.py,sha256=zrShSZARSsWULoXI5tdWqwgZSLQ-u_3xNPS5cpB4QbY,2014
+pandas/core/roperator.py,sha256=ljko3iHhBm5ZvEVqrGEbwGV4z0cXd4TE1uSzf-LZlQ8,1114
+pandas/core/sample.py,sha256=QEPzbFmeMRMxAIqfkRrJLnIjUZgSupbP8YUEezW-Pcw,4626
+pandas/core/series.py,sha256=tUcOwoe3F4G5IxaOGB3HPE_xkUTjJj51meGB60MiABs,213461
+pandas/core/shared_docs.py,sha256=Fdd7Xi1TQ_esZXq32Gu-ZPiShIHE2VROSSRtzet509s,30103
+pandas/core/sorting.py,sha256=kxr4Phz8HHAsEbyx9J5SCYZ4xENhoZnFmMEAUI-NpIU,22976
+pandas/core/sparse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/sparse/api.py,sha256=y0onCpBKCj_5Iaybw5e-gxk8zAa9d1p5Zu58RLzPT1k,143
+pandas/core/strings/__init__.py,sha256=KYCMtwb7XWzZXsIZGijtjw9ofs2DIqE9psfKoxRsHuw,1087
+pandas/core/strings/accessor.py,sha256=2Wqahgplq6YMP7ROTwH0q0QcN9o84muICrdcOGjMd-U,113796
+pandas/core/strings/base.py,sha256=ir-yia8EsnqfBp9MvpGC3WP2wQaQAQzlPG48iR6l4-E,5619
+pandas/core/strings/object_array.py,sha256=ymqCZqarsN28n0CGSBC8Qw1QC8HB9KMUMPjQAWVtbk8,16842
+pandas/core/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/tools/datetimes.py,sha256=BIHvjFnfH3XxuHtpb4Wxxdk46LxAcmYyD8OGDb_qXwA,43606
+pandas/core/tools/numeric.py,sha256=JnlwsvJlZTiNUxR_MZLHx9Gqz-vwNlNkaXgHP16ijcM,11051
+pandas/core/tools/timedeltas.py,sha256=kyDgKp9yRpw-gzucChvvekVQKy1sHu8J5qQwbwWaukg,8858
+pandas/core/tools/times.py,sha256=_-z5faRW4NA04LKN-eUgvklqOjRIncQyndFdSzwzDXI,5373
+pandas/core/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/core/util/hashing.py,sha256=LlYoJfn80z0zj0xNt5P3PYRVFJafXI3bRnSYV361Avs,9657
+pandas/core/util/numba_.py,sha256=U-2_obqjB_DwLc7Bu6swTCdPdNU62Z9l0QpxYM5Edng,2582
+pandas/core/window/__init__.py,sha256=DewB8XXkLGEDgtQqICYPmnkZZ3Y4tN6zPoTYvpNuJGE,450
+pandas/core/window/common.py,sha256=LZBddjEy7C_nb-9gmsk2wQr-FsF1WBMsGKd8ptmMdug,6714
+pandas/core/window/doc.py,sha256=iCAs_hJ_pwstet2FHwSilVSXoTaKRuuMHwyZ9l2dz_c,4158
+pandas/core/window/ewm.py,sha256=nniOOhhrrx88wUd1iG2C2vyhT6mfd1N4UbDt4pY1F78,35190
+pandas/core/window/expanding.py,sha256=MnepmpreeY11OX9nQHj5TxgYdnOPJIRC-Cr3MyDnC38,27845
+pandas/core/window/numba_.py,sha256=7x9RvcIvPab0C5uXT4U9cP1VNaI7Yym0CevTsMIu27U,10606
+pandas/core/window/online.py,sha256=NKHkFpehR5QDT5VrCESEqjZ9a_Fq0JkchzmXFtzLRds,3735
+pandas/core/window/rolling.py,sha256=jj5NmCV28NgsWXMaBVqV-j8-JPwZOCu3heLi9AAbTMU,95504
+pandas/errors/__init__.py,sha256=DotJJfd-bS7FSQbnLC6SKWCfz_GqGYS6Gy6Fc9AJZg0,27164
+pandas/io/__init__.py,sha256=4YJcSmLT6iTWceVgxGNSyRJq91wxhrgsNr47uc4Rw-I,293
+pandas/io/_util.py,sha256=7AXuIcOdzDaLxkapNC00BUbTBAFwiQ21rorXLGlJd4A,2676
+pandas/io/api.py,sha256=w7Ux3U8PI-SeP13hD3PMjWMf3YbOGog6zCDqj0nfnpI,1264
+pandas/io/clipboard/__init__.py,sha256=3aFzdoqbabE8XM-FYjdYIctTps_sTAJDJMrhEbDv_UU,24235
+pandas/io/clipboards.py,sha256=t88NnxP8TOpmM1V438o6jgvlEMzlRLaqWBxUQiH_EQ8,6320
+pandas/io/common.py,sha256=hsjBpZc8i9O_aKMpCms0tuQ2jAqbkVzLXnUKI01TVcU,40615
+pandas/io/excel/__init__.py,sha256=w62gHQ9nF3XgBOmjhM8eHmV-YXF7gflz1lFqxFq7io8,486
+pandas/io/excel/_base.py,sha256=tEBB5m3LcL8ZHv62Kv7G4Ul9MElr2X8JrkXvadypzC4,59073
+pandas/io/excel/_calamine.py,sha256=7O8I8yg-dpaK6OqdZflV14ggDbNDJrinhgAPxXgh9ro,3474
+pandas/io/excel/_odfreader.py,sha256=vMVZ-lNJpMB0vQ8cewanVpjj3-sFzUAS-I-w28nOmoY,8262
+pandas/io/excel/_odswriter.py,sha256=o7dP9MQYRyDO88kFeJMiyW5SmCxusykb8vew4QHMjsg,11210
+pandas/io/excel/_openpyxl.py,sha256=CshETVibZ0_rwbNq0y7sPkzSgnXpwI7FUtvAj8efU6Q,19861
+pandas/io/excel/_pyxlsb.py,sha256=74huu-7ISIsfvguwDID84B3KIooHtU53XOP3PFkX6ts,4358
+pandas/io/excel/_util.py,sha256=1fwMlNjLSd_qlCGLGBcXDPLnZ_SOpAZTIaUgYUVr0_0,8105
+pandas/io/excel/_xlrd.py,sha256=tddoGt7ugmyTTryMeqSvU6FE9vgajsMYfrSLQytMEV0,4556
+pandas/io/excel/_xlsxwriter.py,sha256=b0o_2MRgeTNG0loBRybT-xDoa65CjUeVC2wmuTUoR0M,9191
+pandas/io/feather_format.py,sha256=rIbQD6J6nOzYvfs6be1vXLptR3ObL7fP36eOa8b4GRg,4007
+pandas/io/formats/__init__.py,sha256=MGhPbyRcirFXg_uAGxyQ_q8Bky6ZUpBZ0nHXQa5LYd8,238
+pandas/io/formats/_color_data.py,sha256=fZ_QluvMFUNKUE4-T32x7Pn0nulQgxmsEMHB9URcBOY,4332
+pandas/io/formats/console.py,sha256=dcoFM-rirR8qdc1bvgJySPhZvk23S6Nkz3-2Lc30pMk,2748
+pandas/io/formats/css.py,sha256=gCSjRV6QatAMY-La26wnrQmyF78G4BruMfpWrDIKIkk,12793
+pandas/io/formats/csvs.py,sha256=JAI3kO6xKSMjsLxlYk4EijBuktOHRwU9U91a92OvYnQ,10526
+pandas/io/formats/excel.py,sha256=vW5_Pii4i_wv_VNVR0wn-7IFwdgf2tzROor4eThVO68,32994
+pandas/io/formats/format.py,sha256=FPeKW4UASjOLB-N73HfVZWVviqUbDPoBoVLCQxhJJjE,66127
+pandas/io/formats/html.py,sha256=AiROfWxTRrMT75LZsrBMJTIs3ky9n1x3nUnXzKpZILM,24165
+pandas/io/formats/info.py,sha256=heCm4flQPvNMNW6zecz_XUrfV5O-_zWdpam_dk3V2Tc,32621
+pandas/io/formats/printing.py,sha256=Hrs0vaaacrfswH7FuPCM9FnVg5kKL5vGYl8-ZxAQC4Q,17950
+pandas/io/formats/string.py,sha256=f6UNLnvUV-iO-7k7zXqWBOs7hOoU7_fWQzogyeY8c7I,6707
+pandas/io/formats/style.py,sha256=BRv6I9qQLXOUP-qtBtAg9ms8mZRD7kd60J2w6k7wVpo,155868
+pandas/io/formats/style_render.py,sha256=TgyXK40A4dp8geKIeGWMwNm_v597jWQmJZH-H-TSSdQ,90899
+pandas/io/formats/templates/html.tpl,sha256=KA-w_npfnHM_1c5trtJtkd3OD9j8hqtoQAY4GCC5UgI,412
+pandas/io/formats/templates/html_style.tpl,sha256=_gCqktLyUGAo5TzL3I-UCp1Njj8KyeLCWunHz4nYHsE,694
+pandas/io/formats/templates/html_table.tpl,sha256=MJxwJFwOa4KNli-ix7vYAGjRzw59FLAmYKHMy9nC32k,1811
+pandas/io/formats/templates/latex.tpl,sha256=m-YMxqKVJ52kLd61CA9V2MiC_Dtwwa-apvU8YtH8TYU,127
+pandas/io/formats/templates/latex_longtable.tpl,sha256=opn-JNfuMX81g1UOWYFJLKdQSUwoSP_UAKbK4kYRph4,2877
+pandas/io/formats/templates/latex_table.tpl,sha256=YNvnvjtwYXrWFVXndQZdJqKFIXYTUj8f1YOUdMmxXmQ,2221
+pandas/io/formats/templates/string.tpl,sha256=Opr87f1tY8yp_G7GOY8ouFllR_7vffN_ok7Ndf98joE,344
+pandas/io/formats/xml.py,sha256=dLBpVLGltVRiOxYCIVLb4okLXwhPneRp7whi2VbV1gk,16029
+pandas/io/gbq.py,sha256=nkdYZ0w5ZetYdWpIIKALLh5_3nNhFE1hvVV9rJ5yyhk,9372
+pandas/io/html.py,sha256=E4rdZT6DVcMRSeDaceBsMpWrc-A9aAEvF5sbW4DstIg,39546
+pandas/io/json/__init__.py,sha256=ArWTQnIKhxDVaMI1j0Whgpk0ci6dP0mpUiGwMRqEdtY,270
+pandas/io/json/_json.py,sha256=nyznN821ajpCfe-z-geEWqQDNaWnHsnn_3tfDT81Dj8,48231
+pandas/io/json/_normalize.py,sha256=rbyrEKwuxotrABiv6Jmb9JN6k6rCXd99ONrEZv2IbXI,17212
+pandas/io/json/_table_schema.py,sha256=Ld6OMQsdCutRvmGHPayKOTf08BNTnhuFwcQGRnlCq_w,11594
+pandas/io/orc.py,sha256=xz3dk0AvHEC92LiCn7cH-x7fA6DXZQaR8xA2zQUVi2c,7817
+pandas/io/parquet.py,sha256=CotFKy_O8b6Ccygh7H35KwIhjxNSWH94A5GL1iHC_WM,23641
+pandas/io/parsers/__init__.py,sha256=7BLx4kn9y5ipgfZUWZ4y_MLEUNgX6MQ5DyDwshhJxVM,204
+pandas/io/parsers/arrow_parser_wrapper.py,sha256=I-OXG06TKyv6lx__lSpTgIchpWct9VU6F-88cH6fbyQ,11080
+pandas/io/parsers/base_parser.py,sha256=s-bYfeFE7R3gfTuOQQPAP600fgu950Z81UnvCHPDvKA,49980
+pandas/io/parsers/c_parser_wrapper.py,sha256=yXK-ZrUOxZcXdZ9rtINgRl7l426tdoch8GyZIS_nCMI,14199
+pandas/io/parsers/python_parser.py,sha256=9fnAQ5iFQwBETy-6ptu66-3Ppu8tn81CGSRyYxhgE2I,48456
+pandas/io/parsers/readers.py,sha256=yP4xBAdreacpmmKamh7w6O4CTl0NQ5z0UVSuA7LSs0c,87157
+pandas/io/pickle.py,sha256=t4OulGy7CQL60LXTC8kebegWM7QaJOmudlynAgWxo4w,6582
+pandas/io/pytables.py,sha256=85igkNwq029a70jiU7obu3DYAnTP5VVjgoWGhtjFVBI,181685
+pandas/io/sas/__init__.py,sha256=AIAudC9f784kcEzuho8GiXU63vj2ThRitKznl7Imkq4,69
+pandas/io/sas/sas7bdat.py,sha256=kHkufkBH7jqj9cPACxImJnybYDRQ5pOguJ1QjZ4KJ5A,27730
+pandas/io/sas/sas_constants.py,sha256=CM1wSNzXn6nkjLMSTeBhBJlL6d0hU-1YdNwEO8HE-9U,8719
+pandas/io/sas/sas_xport.py,sha256=_N7sGHw4Z80u-emCxS4lv6UFs6N01eKj5CZkTzq7XiM,15134
+pandas/io/sas/sasreader.py,sha256=S7bRlsXahhpoTkKdsHoWY9TLo_jgzNJJdsb6gxpcfuY,4885
+pandas/io/spss.py,sha256=p4vW9rJEFLPBqEIHMR5fCmo2U-JBTvgnDNd74Y7DFuI,2182
+pandas/io/sql.py,sha256=7zxdQNoaw4AR_mWjmR37pCPc9Rs0ZSyTXnHgMpXb8go,101544
+pandas/io/stata.py,sha256=3JnSRxbd_NxE6grWAOa1OZO_bGtqGgjKIls6wZpUn_A,136105
+pandas/io/xml.py,sha256=ZKHsFACIJhlNJqU8nNBpG-OjHZ2uE_wzh94OOBuj8iI,38656
+pandas/plotting/__init__.py,sha256=W_2wP9v02mNCK4lV5ekG1iJHYSF8dD1NbByJiNq3g8I,2826
+pandas/plotting/_core.py,sha256=BLIzDrRcaDDYBpXj8nfw3aIXabos6YlwPjondYmh6II,66558
+pandas/plotting/_matplotlib/__init__.py,sha256=jGq_ouunQTV3zzX_crl9kCVX2ztk1p62McqD2WVRnAk,2044
+pandas/plotting/_matplotlib/boxplot.py,sha256=AaLBxRNm6ke8J0JnDZtSr9g93LPMVmkgyLLqQ6ovYfU,18385
+pandas/plotting/_matplotlib/converter.py,sha256=EcdgaqQPOqYIO2noB-6J2xkODsBwATamuwA315SCVog,37033
+pandas/plotting/_matplotlib/core.py,sha256=20oTgXZwzTQDfqBY6g_HT9CsGd1RkuNtnu0YE-rtO5U,71826
+pandas/plotting/_matplotlib/groupby.py,sha256=vg8RYC3SxN2Khc-34GDV3UpCVSPnawt4zwYqIuzb5HE,4343
+pandas/plotting/_matplotlib/hist.py,sha256=uljuycUD16A6u3GdktvZwXdU3qMKPfFLFMgYmBX4zQU,16816
+pandas/plotting/_matplotlib/misc.py,sha256=tzbAVRDGc1Ep6BR3QbYAEKEHgkX2vwMBX9k9uwN-j8c,13358
+pandas/plotting/_matplotlib/style.py,sha256=mKDcq4cBmYF9zDrBv3st3fNFvSn-91rYEH5cLXaYiw0,8368
+pandas/plotting/_matplotlib/timeseries.py,sha256=Mw3zTUVL8NR1bUCxWrait8kPCB9DHBkm8skT_RdEQ3k,11531
+pandas/plotting/_matplotlib/tools.py,sha256=yH7FSA6FMW0Idrxkg12Ki0SHjbVR7tpYu-R6SHX5gzo,15415
+pandas/plotting/_misc.py,sha256=sbOaqkE9lA5HbikzcFBcXe9tdqHMVAxxMH3V9QfYr-c,20929
+pandas/pyproject.toml,sha256=uW6LweAMBumt3zYITrX6GBqjjTUmVHZO4Su2ktm7Hs4,24638
+pandas/testing.py,sha256=3XTHuY440lezW7rxw4LW9gfxzDEa7s0l16cdnkRYwwM,313
+pandas/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/api/test_api.py,sha256=ZQI3_TgIuolTfuKy-a4eds0io74Q4kvy8fG6NZDoj-M,9394
+pandas/tests/api/test_types.py,sha256=ZR8n_efaY7HWGY6XnRZKNIiRWmaszpNU8p22kvAbyEQ,1711
+pandas/tests/apply/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/apply/common.py,sha256=A8TqjvKR4h4WaLtovGR9hDULpWs4rV-1Jx_Q4Zz5Dew,298
+pandas/tests/apply/test_frame_apply.py,sha256=eJc1NjbUTgYbhVO-CvdfYVRKD7jheGwPQKuigm_bFfM,54550
+pandas/tests/apply/test_frame_apply_relabeling.py,sha256=jHfewakLcFvc1nartXtElv7HM5eGUIelIcm-McXX2KQ,3772
+pandas/tests/apply/test_frame_transform.py,sha256=bbAcYmXxlfEo8-zPQdxlp26s9LPlRbpVKpQu9yEVkCI,8020
+pandas/tests/apply/test_invalid_arg.py,sha256=g3aYkzdTCoqne8AQ03rCF_SPZtQlTVwwYQQySbfDezs,11176
+pandas/tests/apply/test_numba.py,sha256=dD1s13A3ZmU61dlwI9BjwLuiEut0jvDVS3avi4Y6_CA,4190
+pandas/tests/apply/test_series_apply.py,sha256=JlDktd3rqfzbHl5YTEgQOx7t8ptDKPQdw3XSJ3-ToaM,22467
+pandas/tests/apply/test_series_apply_relabeling.py,sha256=_HkoIybNJQFEpIaafHvD1Q0nx_U9J2aL8ualcwhp5Fs,1510
+pandas/tests/apply/test_series_transform.py,sha256=rrJO-C5HagNKJo542h32eB5TOWVDxirJv1u5PXJkh_I,2404
+pandas/tests/apply/test_str.py,sha256=k34l2s3s5p2NUzwUFOtW6sePl9ureo6Q8EaY5PEqy1w,11043
+pandas/tests/arithmetic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arithmetic/common.py,sha256=C_s1Zc2_0U_oBciQNt5xJp-8FaLmkscEdmnX2Nq16UY,4362
+pandas/tests/arithmetic/conftest.py,sha256=uUtu5-T5FBdFQAo21vRLQSHPiNEjWkc69UwH6llpnsM,3473
+pandas/tests/arithmetic/test_array_ops.py,sha256=4lmZRZAlbJEnphzzwfcvsO4kEv1LG9l3uCmaF_8kcAA,1064
+pandas/tests/arithmetic/test_categorical.py,sha256=lK5fXv4cRIu69ocvOHfKL5bjeK0jDdW3psvrrssjDoA,742
+pandas/tests/arithmetic/test_datetime64.py,sha256=f97V90PrRZrFZ_IrBxfEtgDXvYI_JGqMsIl__9b0y9E,90255
+pandas/tests/arithmetic/test_interval.py,sha256=2TG1Lh4VZXaxwjs5y5RjXzIukOfoVetyLfPlOo5h4vQ,10951
+pandas/tests/arithmetic/test_numeric.py,sha256=569JY7Pjl453iXP_txrlktVyUyH1CR_3677due2sfwU,55511
+pandas/tests/arithmetic/test_object.py,sha256=gxf8Wb0jTBUdNN5hYF6tOHKbFZIY03EunT97IaKcedg,13416
+pandas/tests/arithmetic/test_period.py,sha256=uxdkrPIpMM7BWUKmwloViCEE1JtOsxkXKCdfxLQ6E1A,59617
+pandas/tests/arithmetic/test_timedelta64.py,sha256=OH0dD4KNrVEf8FlC75MezthgEDohA8dyk3uxwouF8LM,78911
+pandas/tests/arrays/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/boolean/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/boolean/test_arithmetic.py,sha256=TS1j3roIOe4g_t-fDVUs920UteSfpI7r2LnV04UVAWo,4177
+pandas/tests/arrays/boolean/test_astype.py,sha256=CWuoHBqqPdF9AqIYQ7_dtA87a1QOYlQbaRNKi_WMFIA,1849
+pandas/tests/arrays/boolean/test_comparison.py,sha256=QIX85ffCwMvtzXtLkWePFQkso_mVtIffWpbgy4ykEz0,1976
+pandas/tests/arrays/boolean/test_construction.py,sha256=1KGaMjJ3FTmoisMbEnKUuxAkylVyzTsfuRXZV5UXlIk,12332
+pandas/tests/arrays/boolean/test_function.py,sha256=eAVsu1XUeokLh7Ko0-bDNUQqmVrGAyOvv9vJdWCQj0M,4061
+pandas/tests/arrays/boolean/test_indexing.py,sha256=BorrK8_ZJbN5HWcIX9fCP-BbTCaJsgAGUiza5IwhYr4,361
+pandas/tests/arrays/boolean/test_logical.py,sha256=7kJTl0KbLA7n8dOV0PZtiZ7gPm65Ggc3p0tHOF5i0d0,9335
+pandas/tests/arrays/boolean/test_ops.py,sha256=iM_FRYMtvvdEpMtLUSuBd_Ww5nHr284v2fRxHaydvIM,975
+pandas/tests/arrays/boolean/test_reduction.py,sha256=eBdonU5n9zsbC86AscHCLxF68XqiqhWWyBJV-7YCOdA,2183
+pandas/tests/arrays/boolean/test_repr.py,sha256=RRljPIDi6jDNhUdbjKMc75Mst-wm92l-H6b5Y-lCCJA,437
+pandas/tests/arrays/categorical/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/categorical/test_algos.py,sha256=SLguZHlE5eyi14kRoMUGpIohPJM7jQqboKlnTvidpg0,2710
+pandas/tests/arrays/categorical/test_analytics.py,sha256=kjyTe4P84YYRH4FjpxHtDRCc6uJgxDMS4PnwgCo_BE8,13486
+pandas/tests/arrays/categorical/test_api.py,sha256=Ivy3G6MW43fLMYwWn9QdE9wXRxLrpF8IFoUpB-TplCc,19879
+pandas/tests/arrays/categorical/test_astype.py,sha256=vJJohcKkMQpZAfFUEstGn8qymbaFSuqwSqxoAZRfjM8,5543
+pandas/tests/arrays/categorical/test_constructors.py,sha256=cJpXJSP9X1aPu8yA8ss8o8Nx-9pCqLCW4hm12ACIsII,30758
+pandas/tests/arrays/categorical/test_dtypes.py,sha256=h1ZhuPvbHp9aFA4doAkmQ96zQW4A5UX6y6Yv2G5QTb8,5523
+pandas/tests/arrays/categorical/test_indexing.py,sha256=u43KuLMFtxe5ZAs0dphmGqpHsygyxtmTHxdGEfoDVQg,12972
+pandas/tests/arrays/categorical/test_map.py,sha256=TO6GY6B2n2dhkcNRQinbvID9eBfwtVnWsT1yexQg00U,5152
+pandas/tests/arrays/categorical/test_missing.py,sha256=5KdSj982_KUkfB8Cg-l7Jcir5I8n7Gz6SbnHnIqmu8A,7814
+pandas/tests/arrays/categorical/test_operators.py,sha256=NDc6FKDGOrGIdvSDpJ9Mq9O-aE0xw-LoI6L-rcrW0cI,15968
+pandas/tests/arrays/categorical/test_replace.py,sha256=I3jiQGmNSQ2i1WTLgVjIKcH-D919sf9EWTOm-hh_emE,4102
+pandas/tests/arrays/categorical/test_repr.py,sha256=HhlobarpojLAUxmcMaxoIfwIetNdJmuHPiKtJ3ZBWao,27088
+pandas/tests/arrays/categorical/test_sorting.py,sha256=gEhLklhDxhqf8UDOB17TMKhrabxS5n0evPg9DWSMd5s,5052
+pandas/tests/arrays/categorical/test_subclass.py,sha256=Y4nURd4hFM0Q3aVET1OO-z11pZzzZ0HFfl2s-9OWemw,903
+pandas/tests/arrays/categorical/test_take.py,sha256=O4g_LYDeK0NzHDId5cBBEp1ns_a762NsYHn088ocYzg,3501
+pandas/tests/arrays/categorical/test_warnings.py,sha256=XqvGeAb9lrXP1VdwKSOvbDuytqDuJ5VSDsLKQAa5gIk,682
+pandas/tests/arrays/datetimes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/datetimes/test_constructors.py,sha256=xZsxdsUxxbk7UCawlCS3_aAkhsuexX0-uf3XQMlvSA8,11050
+pandas/tests/arrays/datetimes/test_cumulative.py,sha256=X_SHtt9n_WzA_C2wPlRJHRS8LUmjNNmr2-XL6AszJd0,1307
+pandas/tests/arrays/datetimes/test_reductions.py,sha256=Cg1qwq8wASnMeOdZ5_wowrILL6e1ZT_j8m-rIOkwrkg,5787
+pandas/tests/arrays/floating/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/floating/conftest.py,sha256=PkAOd0oDvePBtXL-N0MnmEGCmDMP3_Dw-YwpxgNfl-k,1161
+pandas/tests/arrays/floating/test_arithmetic.py,sha256=olBSoRA2mASEezqxvk_pPiGA_BC3W2FHO6iTFTJSw_c,8311
+pandas/tests/arrays/floating/test_astype.py,sha256=EOcBIsfc44V7lUkNFQwqPnHSBtyEj38nhvNOStBbIcc,4337
+pandas/tests/arrays/floating/test_comparison.py,sha256=C-rwNTv5FtUvo3oWB8XNquCOa_XQHf6R9JRYX6JVAG0,2071
+pandas/tests/arrays/floating/test_concat.py,sha256=-RO-pwRRY93FQnOjBLs1fMVf7uBCoEGRkGWPAdX8ltU,573
+pandas/tests/arrays/floating/test_construction.py,sha256=weDvGh2hSfHmVnQ-6Kc5QmAUaGTF9mvEI3qtZSEHHAk,6455
+pandas/tests/arrays/floating/test_contains.py,sha256=oTsN_kyhRi7hHdKRzi9PzwSu2gHiE3EP4FkuR31BZFM,204
+pandas/tests/arrays/floating/test_function.py,sha256=YiXRdFHEU2iAGXwd68kDyfsjBZ8ztoC8fikZU6AnbRE,6403
+pandas/tests/arrays/floating/test_repr.py,sha256=N_BX7NbU8Pljiz2bouWMzrP22xh_6w_8pHePEB2ycVw,1157
+pandas/tests/arrays/floating/test_to_numpy.py,sha256=d0k_2WXrkIu4JOGkIQlzijmgsm7X-XW2XmobaN_3Q_s,4954
+pandas/tests/arrays/integer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/integer/conftest.py,sha256=TejO1KxvoPETsN-ZdefGePhwJ-szaoYanP9AQXHgY18,1555
+pandas/tests/arrays/integer/test_arithmetic.py,sha256=wKrD5HAwhw_2FOx8JvvwJ-a3yM_oDFSS1fveUbvwy5U,10851
+pandas/tests/arrays/integer/test_comparison.py,sha256=jUr8dmk_6FQsTNjDkYsazWnioHis4cLi94noy4txG54,1212
+pandas/tests/arrays/integer/test_concat.py,sha256=TmHNsCxxvp-KDLD5SaTmeEuWJDzUS51Eg04uSWet9Pg,2351
+pandas/tests/arrays/integer/test_construction.py,sha256=jnzOs0w8i4X55JOrtXc0ylMaiBo8mhRl6uwrnEWr_0o,7768
+pandas/tests/arrays/integer/test_dtypes.py,sha256=r8PuGIbhMUwFtnVzZzmkF6An3MVyBqMzBn3j1DsaZRA,9042
+pandas/tests/arrays/integer/test_function.py,sha256=hCqZIrrISPtn_7mlX92wpQNItAF1o-q-g56W93wnyhI,6627
+pandas/tests/arrays/integer/test_indexing.py,sha256=rgwcafGbwJztl_N4CalvAnW6FKfKVNzJcE-RjcXMpR8,498
+pandas/tests/arrays/integer/test_reduction.py,sha256=XOgHPBOTRNaE7sx-py3K6t_52QZ9iMPlYAoesbFp9ZI,4100
+pandas/tests/arrays/integer/test_repr.py,sha256=fLTZusgFHPXO4orpygmHIOG6JQLzYcdbTJHRvvsN0sM,1652
+pandas/tests/arrays/interval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/interval/test_astype.py,sha256=8rb7rssqvIoSztzCfFb5pY4oIH_GjDStKrXkC6bnUZk,776
+pandas/tests/arrays/interval/test_formats.py,sha256=AARSRfiyQa0Fu6jCBdhx83yJOXdCWtfs0q0Yd8mMxwg,317
+pandas/tests/arrays/interval/test_interval.py,sha256=cfZXy6J5AtUqwd5HY4m9lxTyu0m0xsZbD9FlcBebuio,8082
+pandas/tests/arrays/interval/test_interval_pyarrow.py,sha256=PkPTrpsrTLL_3Vd17ENP0I3NFE71XpSQi38HG09hXxo,5202
+pandas/tests/arrays/interval/test_overlaps.py,sha256=4QNJBVY5Fb150Rf3lS5a6p_ScHy8U-sAuWTWetbCmVc,3279
+pandas/tests/arrays/masked/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/masked/test_arithmetic.py,sha256=wchNK8BesRBPSclagK_egl_EG9J4KPCquzL9iRZOK20,8175
+pandas/tests/arrays/masked/test_arrow_compat.py,sha256=ys0egVa9W8J4sadc5unZlFLB1wFZaUn8hkmieG2p77w,7194
+pandas/tests/arrays/masked/test_function.py,sha256=qkFCkI5KNijaX2SurVoilnhtBFbismLBS4SyEybNXZ8,1954
+pandas/tests/arrays/masked/test_indexing.py,sha256=S1NGbMi6k3YAWfsR4gB83tnXQCCHMgqXmy74bnEHWNo,1915
+pandas/tests/arrays/masked_shared.py,sha256=ANp_CU9Hcly9-NBxknm7g-uWxljstTmriq3S8f5kPsM,5194
+pandas/tests/arrays/numpy_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/numpy_/test_indexing.py,sha256=-0lB-Mw-gzM4Mpe-SRCj-w4C6QxLfp3BH65U_DVULNY,1452
+pandas/tests/arrays/numpy_/test_numpy.py,sha256=zFHviwBMXyEi2e6b0SLZ0j39goKpUHbYJ_2wQjwygoU,9726
+pandas/tests/arrays/period/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/period/test_arrow_compat.py,sha256=YuEM6oIOfRhdFaTFs5X0um9nLqygEkuxIZGl9V-qQcg,3709
+pandas/tests/arrays/period/test_astype.py,sha256=lKLDDqZSdU7s6PyHbrywkaCJnMJ4TKSphRqmno7BcbU,2344
+pandas/tests/arrays/period/test_constructors.py,sha256=C6J0nmKRSK5nyEja7-gZgf5tCZpPA0aZ9lux-z6gHxA,5089
+pandas/tests/arrays/period/test_reductions.py,sha256=gYiheQK3Z0Bwdo-0UaHIyfXGpmL1_UvoMP9FVIpztlM,1050
+pandas/tests/arrays/sparse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/sparse/test_accessor.py,sha256=EReITkC1ib-_36L6gS5UfjWai_Brp8Iaf4w7WObJZjM,9025
+pandas/tests/arrays/sparse/test_arithmetics.py,sha256=TC2Af6gA4OkRIxDTWy_5jmHNIrgsqWGmOVF707wOn8M,20152
+pandas/tests/arrays/sparse/test_array.py,sha256=XdG2ZIuaerlu2QBe-YLIHPNWSKVNsZDAvqYHr_6Wk6Y,17929
+pandas/tests/arrays/sparse/test_astype.py,sha256=MGW-bxHbKeY7FxpAj-FOFO1kd_wNKmqyEld6t_OuomM,4771
+pandas/tests/arrays/sparse/test_combine_concat.py,sha256=3NMQXaRQc7Bxn5HhSHffcUE24GZi_VYflnFLnixOgbs,2651
+pandas/tests/arrays/sparse/test_constructors.py,sha256=N5GJ8SrwVZ4hNGaM_QlALl283EM13nSVbtO8uBRSAwY,10835
+pandas/tests/arrays/sparse/test_dtype.py,sha256=jic-QgdOK0YEZLoiAEh7zOPupJirfpNAKIeIQohuv70,6126
+pandas/tests/arrays/sparse/test_indexing.py,sha256=8INC1paA06XrCp8L63FSllr0OK48pgiKda5sOgrUhf8,10425
+pandas/tests/arrays/sparse/test_libsparse.py,sha256=_hfr36t-jm-QOhI9Gwbd6sQZI5aVWMMixHY-OYOqKuM,19293
+pandas/tests/arrays/sparse/test_reductions.py,sha256=D7R_jhlFtmH8l-tERmhtP1K3KbcAyPuyIy_Y_gVcN6Q,9721
+pandas/tests/arrays/sparse/test_unary.py,sha256=GtqeMdylKdtu-0HPxmTDVjo32riOcEtqPhjI_XK5LkM,2864
+pandas/tests/arrays/string_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/string_/test_concat.py,sha256=6mqREqJWdNEPLIR0jfkiLnOFd6KrcBX7fJ7IOJzfQyI,2744
+pandas/tests/arrays/string_/test_string.py,sha256=yrGVvLramPWBrzFZwWGomPqryf_YVTtkyV-rOG3McqI,29225
+pandas/tests/arrays/string_/test_string_arrow.py,sha256=wporKwrDWw0Ur3KovspMUXk4ZFz5nqrzUoFOxx1kwCI,9712
+pandas/tests/arrays/test_array.py,sha256=wq6yX5hk8C0ldqIMyDlXSatUcrseFqTTV-oPhfq8_Fw,17111
+pandas/tests/arrays/test_datetimelike.py,sha256=iFh52iyFbxtY_gntJgf25kQtBkarf1k131-ultxahSY,46254
+pandas/tests/arrays/test_datetimes.py,sha256=FoODE0J_-8KIBbNS5ROkEWVgNnF3PwaToqJ38YtiAYU,29112
+pandas/tests/arrays/test_ndarray_backed.py,sha256=6unFuF9S6hG5FDJDjiqbKg3rL8ItzJQHwY9vMdju4-0,2331
+pandas/tests/arrays/test_period.py,sha256=S_7TMRLEmVamhGKlVO50qJIj3OFDWRzY_oxEcXzp3zs,5572
+pandas/tests/arrays/test_timedeltas.py,sha256=VdMdnCrOL5_oUa4RxL-gaVre6Qp3iu__qNMaUb7kqfE,10673
+pandas/tests/arrays/timedeltas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/arrays/timedeltas/test_constructors.py,sha256=gwBy_iuOc-EEMusjK2bITGQhCyeeI9OzI9uI8xOact0,4248
+pandas/tests/arrays/timedeltas/test_cumulative.py,sha256=cRR6I-lIsefG95vEZb8TuXdvmw7pdPFedpBneLVKBG8,692
+pandas/tests/arrays/timedeltas/test_reductions.py,sha256=cw6I3Bxi0R2_DD2y1WD-AHTYR_ufAtN9ztCtDGypQnM,6520
+pandas/tests/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/base/common.py,sha256=-cLXvhzuQi0XMfU-NdqTQAiruN0MU9A9HE2goo7ZzJQ,266
+pandas/tests/base/test_constructors.py,sha256=Xnvv9P9oREkISvOa3jMX015T_TbRZ6ZIYaG98_Wefeg,5763
+pandas/tests/base/test_conversion.py,sha256=I9aqpcshiLrpfnzfEbtz-UWiP7iNZX21ibCYXUH6zUA,19046
+pandas/tests/base/test_fillna.py,sha256=q9LZhUp2HXaVQw4wSxK0VU4Z9z62WI12r9ivsZu0gOg,1522
+pandas/tests/base/test_misc.py,sha256=_HMhb6XwCJCUqTFspIPwzJOa0sE2JOWXE0lxHqH-Dzo,6053
+pandas/tests/base/test_transpose.py,sha256=138_O_JwwdCmfmyjp47PSVa-4Sr7SOuLprr0PzRm6BQ,1694
+pandas/tests/base/test_unique.py,sha256=6pMua_FmjQ3Ue897IaqR4_xFBv50zakcPhiAWrPfFaY,4255
+pandas/tests/base/test_value_counts.py,sha256=Xu2WOPBcQ81SFcvOyNDBpPnJ6gm2epFctyyT3vCUtJc,11804
+pandas/tests/computation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/computation/test_compat.py,sha256=dHstyvdaXybrwm1WQndV9aQBwOsOvCIVZb5pxLXsYfM,872
+pandas/tests/computation/test_eval.py,sha256=TJOrR4GW2hpwEDYW7FalJvjKCR-onKkR9BE5zP4YyQ0,71699
+pandas/tests/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/config/test_config.py,sha256=T3PKV_lWTp_4ZU566fpWt_N9_tr3BfsxHlJ_vqnQiiQ,15858
+pandas/tests/config/test_localization.py,sha256=xC7SJfih_Kus5WGpSWZdwyAQR3ttgpsxxlNesbwrYfM,4479
+pandas/tests/construction/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/construction/test_extract_array.py,sha256=L3fEjATPsAy3a6zrdQJaXXaQ7FvR2LOeiPJMjGNkwKQ,637
+pandas/tests/copy_view/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/copy_view/index/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/copy_view/index/test_datetimeindex.py,sha256=Sl224XCNK_lx-N6k9heXS_g2_bwmqCJJyKDv7pE_HQw,1980
+pandas/tests/copy_view/index/test_index.py,sha256=B849E4vf72tsWv11NfixJU6vjX0gpMlyvHRKSBk0V1Q,5363
+pandas/tests/copy_view/index/test_periodindex.py,sha256=qSR4PUuAHEPq1o8NUeif_MSrN43rvSeWQtsmTK6I1a4,653
+pandas/tests/copy_view/index/test_timedeltaindex.py,sha256=L1fGDsy2dmZqf_y3bXVo9mUMr1Jsli9BdScChOEQkns,661
+pandas/tests/copy_view/test_array.py,sha256=hj2nbMOBHCsTswQP6sM0jjKawcC0euW99RrSi03Ycz8,6696
+pandas/tests/copy_view/test_astype.py,sha256=7hVPzcq4eGYBwOBiBUhTvGVQNt7lus-bu1wpnrdp0vs,10185
+pandas/tests/copy_view/test_chained_assignment_deprecation.py,sha256=BJqJ30DdsTUeoUZZm2kZKFOwUoz9Rkmg5AH3R6nk0F4,5750
+pandas/tests/copy_view/test_clip.py,sha256=ahKf7EUwJeYahLnPVhUuNanG4Va53Ez5kULzCdzeX60,3077
+pandas/tests/copy_view/test_constructors.py,sha256=M_VB1CUUpnuM2iRwnXmLJ1bq8e_ohLEe2sHZ1fDc3Ow,13952
+pandas/tests/copy_view/test_core_functionalities.py,sha256=M-ExonPcx6W-8z_TLTaP16DJtelSVeQHZKO1aWObSuA,3506
+pandas/tests/copy_view/test_functions.py,sha256=0KVw1BKyrP4EAjPt4x270QYQn95vrVAtka1vLqqHHWs,15734
+pandas/tests/copy_view/test_indexing.py,sha256=4OUGrcgMHlai3p7tQt0sXopNYTrGdEFSUaVf6S7ZzyI,42980
+pandas/tests/copy_view/test_internals.py,sha256=3NbWdjQv6CalasyFPwNqKZXJlkCTCop98T9DeYVg5ik,5063
+pandas/tests/copy_view/test_interp_fillna.py,sha256=6nLfwLUgg7YAG2IjobsPZW1LoAtf_8njyqpeiAxJBOo,15299
+pandas/tests/copy_view/test_methods.py,sha256=O3okEmdVexNdgJ5CWqyLvCplezoiw_xy7glfX_yxTlI,71834
+pandas/tests/copy_view/test_replace.py,sha256=QbwgZ7JBPlePb4onl_KNv02gtB-kh4QDgoh-1DiKu0o,17540
+pandas/tests/copy_view/test_setitem.py,sha256=ewuJiYuD9VI2wuFZiDjGYVP7gnlP4H9uVFnjjelW55U,4822
+pandas/tests/copy_view/test_util.py,sha256=ClWLprMJhf6okUNu9AX6Ar9IXZgKkY0nNuDzHRO70Hk,385
+pandas/tests/copy_view/util.py,sha256=oNtCgxmTmkiM1DiUxjnzTeAxCj_7jjeewtby-3gdoo0,899
+pandas/tests/dtypes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/dtypes/cast/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/dtypes/cast/test_can_hold_element.py,sha256=2zASUgxB7l8ttG2fKjCpIjtt_TQ7j4NJ2L9xFzcyUPU,2408
+pandas/tests/dtypes/cast/test_construct_from_scalar.py,sha256=INdOiQ7MowXLr6ZReCiq0JykUeFvRWocxk3f-ilk9v0,1780
+pandas/tests/dtypes/cast/test_construct_ndarray.py,sha256=D52osZAHEuY2w3GdzH05y9WD_ghLIySgfKaIJpnLZAw,1316
+pandas/tests/dtypes/cast/test_construct_object_arr.py,sha256=eOmUu4q0ihGTbYpCleoCnYtvwh1TBCEZQQjLeJaUMNA,717
+pandas/tests/dtypes/cast/test_dict_compat.py,sha256=qyn7kP5b14MywtqOUL5C-NOvjf2qK4PsXGpCvqmo-4E,476
+pandas/tests/dtypes/cast/test_downcast.py,sha256=CzuywDTWQ3xTi__4Nd36qgcx6mDs2tpYUsVztduVC9s,2778
+pandas/tests/dtypes/cast/test_find_common_type.py,sha256=c__GbgnRawwgqWut8g5Q928en8-_O3oTZEQVbqQ8MrE,5226
+pandas/tests/dtypes/cast/test_infer_datetimelike.py,sha256=6vor_eqEbMKcBLEkfayXzVzwwf5BZcCvQhFZuqhvyKU,603
+pandas/tests/dtypes/cast/test_infer_dtype.py,sha256=WCLts2TG3Zs4V69O2f_HYmuXEkSHPUXVTIuGpVvICuY,6001
+pandas/tests/dtypes/cast/test_maybe_box_native.py,sha256=uEkoLnSVi4kR8-c5FMhpEba7luZum3PeRIrxIdeGeM4,996
+pandas/tests/dtypes/cast/test_promote.py,sha256=B4dgs3EWIm8qKuoQMn6FNaGGf_qAm_EAm4l2X3cHDMM,20755
+pandas/tests/dtypes/test_common.py,sha256=gqjMq5F57R2eGBnN5TmbgDIKTUCQKWOC_26wpnhZnIY,28706
+pandas/tests/dtypes/test_concat.py,sha256=vlsumyKcJ7b8EdJKONU5txCA34zMaoKDvA0KmcuP8XU,1799
+pandas/tests/dtypes/test_dtypes.py,sha256=5rbj-vzUI9XqwUR-qp0SVjmqb9koN6fUas4c63EmDQs,43844
+pandas/tests/dtypes/test_generic.py,sha256=TzUIinbvMdsyxH_y2VYQ2XCYLQXh005qij9LWWF9bDc,4842
+pandas/tests/dtypes/test_inference.py,sha256=xZSBiUB7W5kUvhvWCTuJmNVLrxDLZjBHq-k_8O89Sq0,71478
+pandas/tests/dtypes/test_missing.py,sha256=1hDyVeUbkBtNCj2d_CVrD5qe1WPKPq_vIY-uLFwvH9s,30736
+pandas/tests/extension/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/extension/array_with_attr/__init__.py,sha256=bXkwWSW6GRX8Xw221iMyaQOQVaWmyuRP3tGhvjXtiV8,149
+pandas/tests/extension/array_with_attr/array.py,sha256=Vo6gYBpAJHAztlq8m3gH-9GqKUkxSOHg2fk6cApHgFE,2496
+pandas/tests/extension/array_with_attr/test_array_with_attr.py,sha256=TuuBA1lCxjVOgWsWM9jhgc-PyGuXzajO3UWWKZEquZA,1373
+pandas/tests/extension/base/__init__.py,sha256=5OjQDaQnbihqkwRdCBAV-eF-QRE8p3V4frJ764P5-jQ,4353
+pandas/tests/extension/base/accumulate.py,sha256=JHnjvzM2WPD93_WXeay6efj1Pr1vso0llfr5RvQFdAI,1501
+pandas/tests/extension/base/base.py,sha256=aSfTPvuvzzQUxEIrGUASWuwcVv6Uw5bvkFXvqjhRV1M,35
+pandas/tests/extension/base/casting.py,sha256=Xn24h5YqBIi9kmucEUQanmk_IzuABNBJVHaXKePKlBE,3077
+pandas/tests/extension/base/constructors.py,sha256=Y2Pny2SrEj7jsCEUN6KRKi_9G2HA7RIfVs5GVf9Nz5w,5609
+pandas/tests/extension/base/dim2.py,sha256=8Ni4nnBW5wxH3e6f0kX1yTDjecmd12sAZdkBt-1tTss,11992
+pandas/tests/extension/base/dtype.py,sha256=4v3RO3H-2xDIPujcTYdjb0AzWpctqALOXUHLHyHBLDg,4006
+pandas/tests/extension/base/getitem.py,sha256=leq9dxp_KexAv7mhexLCWXcIMKNBPOVfhFv6Nuc5PkQ,15673
+pandas/tests/extension/base/groupby.py,sha256=RzyqdEoOsZzSlf_ucjfMnccSq5nGLiYkQgAFlCHdiOk,6455
+pandas/tests/extension/base/index.py,sha256=fD5Jugbt_39nZ1eVjPNdAgoDRuNXTcnZB9lA4w687vM,517
+pandas/tests/extension/base/interface.py,sha256=nOc3RAOPsmAtDCV3C_tPJvXo2pPPlEcmRuuPgW4mQZs,5999
+pandas/tests/extension/base/io.py,sha256=SNvCa6LXo-4V92Bm6A1RZPXwfDdu3hTWLje8_D3Xwo8,1475
+pandas/tests/extension/base/methods.py,sha256=tpIuCnWD3B_wN1zdQivNPmMx00PTH4CM73xuykpH0RU,26742
+pandas/tests/extension/base/missing.py,sha256=D4by9EHLsc32icNeDutH7JdoGyHE8pD0XPM2o7FiGQU,6606
+pandas/tests/extension/base/ops.py,sha256=qEbUnEkLaXxAE6doTqNhMdFQm2pPyys8xefs3gDv6_c,10760
+pandas/tests/extension/base/printing.py,sha256=pVwGn1id_vO_b9nrz3M9Q_Qh9vqDqC0eZHom0_oGr-A,1109
+pandas/tests/extension/base/reduce.py,sha256=IaF6nI-fMTYzG4fNVUoPei_lf9vCHHIf0NnKCssnYlk,5968
+pandas/tests/extension/base/reshaping.py,sha256=Hf8czQWubrTjZrkYTL3FdOh6h97pCQaN5fK49GbRyRA,13931
+pandas/tests/extension/base/setitem.py,sha256=VcSUUuSqnLftzeeaIlBJIeoo841vVenX_FL5JceS91g,15075
+pandas/tests/extension/conftest.py,sha256=nvR8zq82gsIqh5rbOWj7_sOYLgL8J3M0loXw_L-OGag,5061
+pandas/tests/extension/date/__init__.py,sha256=-pIaBe_vmgnM_ok6T_-t-wVHetXtNw30SOMWVWNDqLI,118
+pandas/tests/extension/date/array.py,sha256=da7NoKcUFxS78IIEAsY6kXzL-mOCrV0yyhFWQUN6p8k,5971
+pandas/tests/extension/decimal/__init__.py,sha256=wgvjyfS3v3AHfh3sEfb5C8rSuOyo2satof8ESijM7bw,191
+pandas/tests/extension/decimal/array.py,sha256=8YbmByqfIzEXW9i3-Ct6VM6M0QkmEEB9CQp79udfmYw,9694
+pandas/tests/extension/decimal/test_decimal.py,sha256=lUadF6G3hW23w9wTCQRX9dOmInb9VxsmIqQlpbMl6Ss,20248
+pandas/tests/extension/json/__init__.py,sha256=JvjCnVMfzIUSoHKL-umrkT9H5T8J3Alt8-QoKXMSB4I,146
+pandas/tests/extension/json/array.py,sha256=fUQ6NaWW8JRQo9zAyNRJXoF1sNlI34qO3vLlj1JXDh4,9091
+pandas/tests/extension/json/test_json.py,sha256=usY52SN9Yd8lUugiCxI1B7DB06l2Lc8mr9tbxu9iOgI,17951
+pandas/tests/extension/list/__init__.py,sha256=FlpTrgdAMl_5puN2zDjvdmosw8aTvaCD-Hi2GtIK-k0,146
+pandas/tests/extension/list/array.py,sha256=ngSHFQPRfmOkDOo54sX-l5JjQvr7ZTE9OzS9aPicc3o,4001
+pandas/tests/extension/list/test_list.py,sha256=VFPo5wGu-UvtAOFx3hoxILmRdI9kTOxCIIJM4fqgRBk,671
+pandas/tests/extension/test_arrow.py,sha256=jSHhLoU1oYecuz9vC1qFSYWSv5K_GUOHIWppDHievpc,117490
+pandas/tests/extension/test_categorical.py,sha256=fI9ImT4bywW5oD6Vi9ZLuruQRB35s-u_eYQNxaVtpMU,6812
+pandas/tests/extension/test_common.py,sha256=4LO2slr0E0zODDK_Es4g9bPBH1U77nI8x9O1Mdddn1U,2975
+pandas/tests/extension/test_datetime.py,sha256=eBTSFWcQp2M1TgYzr01F-KQrdCJLHPrcPMGvuCsIj1s,4614
+pandas/tests/extension/test_extension.py,sha256=eyLZa4imT1Qdd7PCbDX9l0EtDu39T80eCrSre2wmTuE,559
+pandas/tests/extension/test_interval.py,sha256=lZveoqOqya76Cv77vWgCa0GZGAnJDKDgMYd7TqSjHuU,3585
+pandas/tests/extension/test_masked.py,sha256=jrBlSzzwlXMAYj3fYXzDhiOKwUW7WBzyHLp-ce4VDf8,14338
+pandas/tests/extension/test_numpy.py,sha256=eFM6D2CiLgrsmwN5KQm_kYrzIdG7lmFXUuUiNoFrelE,15586
+pandas/tests/extension/test_period.py,sha256=e3RIO2xBPhF-PxPZtPM8VkVhkjYdUNtch9vcoRpHuEE,3528
+pandas/tests/extension/test_sparse.py,sha256=HIUEftSLmtr-LV7xrkP99vKwNj2zyXv4z1Ij_LWJd7Q,18011
+pandas/tests/extension/test_string.py,sha256=GxDgVdW5Y8_UYA7x52WEIpXcwKEluC_gtEqom0Uquy0,9585
+pandas/tests/frame/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/frame/common.py,sha256=BmnEMlREF7G0B5zdaJRsdzqIRdh8diiTisBbCVI6Fp0,1873
+pandas/tests/frame/conftest.py,sha256=rQK_RlKuX3bRr3vv1b05oFili-zJwp0nkBpDXEwl8tE,2616
+pandas/tests/frame/constructors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/frame/constructors/test_from_dict.py,sha256=VwZZNOdlTbHQTO4vSUV-s58Bfx2XbsutVd0irNEmhfg,7988
+pandas/tests/frame/constructors/test_from_records.py,sha256=znxVRge8A7XXfbCpQNxiJ5zg4u7HmEKbqcZ8TSAARE8,18570
+pandas/tests/frame/indexing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/frame/indexing/test_coercion.py,sha256=Xnkwt00jaSc-IxtWgnOl5VcDNRskp80l_WZ_T70QVsw,6099
+pandas/tests/frame/indexing/test_delitem.py,sha256=-YERBfZbhTZ3eKzjmWln8AjoQEO7Yvae6elau4njhM0,1832
+pandas/tests/frame/indexing/test_get.py,sha256=N00_igU25_HjYuvAqDQKqBpqbz6HjB97o9Exvbo9BzM,662
+pandas/tests/frame/indexing/test_get_value.py,sha256=A-GbCHlbDfVPGB10dNGnGg4DtrKrlRbRspYfuDTUmPM,679
+pandas/tests/frame/indexing/test_getitem.py,sha256=9xogr1RzStjgP4HvWm_tm9VWUol660FgSmBwN-wC5Tw,15002
+pandas/tests/frame/indexing/test_indexing.py,sha256=Lwa-oQFxVPzr8sXj8QkcUcgvbZOfcKBLFEGtjz7m_Qk,70421
+pandas/tests/frame/indexing/test_insert.py,sha256=0XsNprKi0XQ9od6dOImwzQwh8YMdgdE0BZFGFHGPEYg,4074
+pandas/tests/frame/indexing/test_mask.py,sha256=1Bql-TBfyBDmlXkECYXk-ZH_y4SPSOZYjCR2Ex7Km1k,4862
+pandas/tests/frame/indexing/test_set_value.py,sha256=2KXYrfi3Pv5zY9j6-Pi9U3q5D0V-_bmGjY-YdeUKmzU,2619
+pandas/tests/frame/indexing/test_setitem.py,sha256=ufqLOqE60ASnftykCNF2DMa6p8pQidKr19lNphGcd1k,52208
+pandas/tests/frame/indexing/test_take.py,sha256=SMBM5BO7ybxTq8gTAX1Qg1UW8vcNiRrHTQwrt1f-Rig,3230
+pandas/tests/frame/indexing/test_where.py,sha256=ZOagnNPqIb2LBr1aNtvzMrx5l7FpJgt-kCZmO9StkWE,38119
+pandas/tests/frame/indexing/test_xs.py,sha256=JGsbJ3zBQYauZyDpSCfrXmRUO4pnH-BIfwODX3qAToM,16012
+pandas/tests/frame/methods/__init__.py,sha256=M6dCS5d750Fzf9GX7xyNka-SZ2wJFCL66y5j-moHhwo,229
+pandas/tests/frame/methods/test_add_prefix_suffix.py,sha256=iPfzSPx0CArx79na7xcI9ZcPTAwq73IdOCcREVO7k4E,1910
+pandas/tests/frame/methods/test_align.py,sha256=FwQrqdCesXbgkQ8bfYPlf3LfK-Sdvud9pHEC2tCnwQ0,17941
+pandas/tests/frame/methods/test_asfreq.py,sha256=MCJkjukZtOVCauc4FZDbor1h99AvG4eMNfQZW8L1h5c,9341
+pandas/tests/frame/methods/test_asof.py,sha256=bkK2i5xcGvz2oy1MVbf_C1oVixMy_1qYqYcuOg-K2Bk,6732
+pandas/tests/frame/methods/test_assign.py,sha256=xFGREzLhP1wj3MowBimeYbMWBNiII0280DiOXI6WDB0,2982
+pandas/tests/frame/methods/test_astype.py,sha256=GD440ClICMt6ruk5u5TZpkXa2g0-0Cm_QpaHDtUvnyQ,32711
+pandas/tests/frame/methods/test_at_time.py,sha256=JrQYFlNIIyW1xDvgmGE7zRfjXnmKMELh9Stiw0btGbM,4708
+pandas/tests/frame/methods/test_between_time.py,sha256=rD-k1a4LVOa-nMlLXOaZO7iTa3hL_C9tghqt8DWW0Qs,8083
+pandas/tests/frame/methods/test_clip.py,sha256=6h1zwE0SKP-uknyuE5Pi5X9vTS4L5ZBts_iSbs6cSL8,7554
+pandas/tests/frame/methods/test_combine.py,sha256=wNaQqokqHsJmrZ9NQIao58ZT0hSkkTH14I7_Oq8tADs,1359
+pandas/tests/frame/methods/test_combine_first.py,sha256=K0YQAGhGyaK_j5tmP9IbQx8zO56ID9GhbTaT9v-3T1M,19726
+pandas/tests/frame/methods/test_compare.py,sha256=j7Z_-yBVts4-xl1fVsJtOBAXYbLao2hwzI2x3aniFz0,9615
+pandas/tests/frame/methods/test_convert_dtypes.py,sha256=7ccB9iWgl-85QwiG6I405oIKV4wzgfu-AgfnY6ovCfM,7848
+pandas/tests/frame/methods/test_copy.py,sha256=QeDoh44tS__y9LK7LwUBAc-SD5RS-phPA4eYWPl5yIg,1873
+pandas/tests/frame/methods/test_count.py,sha256=avzIu1dZ3pls4SM6g173M7Q4i8zMUzeAVI2EeIzWC0c,1083
+pandas/tests/frame/methods/test_cov_corr.py,sha256=5LkNXu8gJKOvAiMRelx4pZ_awWPh4Ovk_uN9_p6IBMw,17875
+pandas/tests/frame/methods/test_describe.py,sha256=DAY04ar1XixwEscl6taSddki4Y_rYnQnV8zF61-z1ZY,14500
+pandas/tests/frame/methods/test_diff.py,sha256=Dyz4lYFWrLVm5fN_B0Z1xZ_l8gyGFQhzwhmRKMuA6io,10099
+pandas/tests/frame/methods/test_dot.py,sha256=tfZD1HWlbO78DEgdjpBctgjWHtzjC3K9essVl_5XBMA,4623
+pandas/tests/frame/methods/test_drop.py,sha256=41RTmD-suQbCnZjpFcG56VlIx1ZP-ReC-j5YIhpJ3WA,20362
+pandas/tests/frame/methods/test_drop_duplicates.py,sha256=GSJ7VundpGtt6KBhl2mld6CwNc9La_pGRwXuNNiRE9Y,14503
+pandas/tests/frame/methods/test_droplevel.py,sha256=L1gAMjYYPB6eYmSppXfbwPVKa3HCNofqPVUZ3gxLldA,1253
+pandas/tests/frame/methods/test_dropna.py,sha256=9l8GBOLpvmEowzFaq0kRxN3815gJCuNamX4S5dn5Mmw,10315
+pandas/tests/frame/methods/test_dtypes.py,sha256=gDIoveWMjhLegq7RQ2ATkQIDOXDfv3WdDDxBBxF4pLo,5001
+pandas/tests/frame/methods/test_duplicated.py,sha256=1DQFuK4KjfSpsl8W0jXne8PPUsL1nFe3lI_9VYBd33I,3305
+pandas/tests/frame/methods/test_equals.py,sha256=AFmbc9SmfgpQV0PD9hCXuktRCRkNvDF5S1Z7z31E2xE,2996
+pandas/tests/frame/methods/test_explode.py,sha256=oR9-X7VyRM0vZr7PxrKK1iRHwgQUpgoEfBt9fZ8JvSY,9058
+pandas/tests/frame/methods/test_fillna.py,sha256=e0Kyaf4Uw8i9bPZfit03ar31mh3WyRXsbMI4coFn-P0,33281
+pandas/tests/frame/methods/test_filter.py,sha256=oT63-WLaQv3isFsWJFtqZwxiw2J-7xZwyOOxpn-kTNo,5422
+pandas/tests/frame/methods/test_first_and_last.py,sha256=hKvLBnx3YtQLilE_9PlL9804dAI6E7Hk2gHDgXqbcsU,5349
+pandas/tests/frame/methods/test_first_valid_index.py,sha256=DRoZKic0mpCom31NeygnBftZlxc6wsCT4-DN2KV5wWI,2574
+pandas/tests/frame/methods/test_get_numeric_data.py,sha256=0bvZ2Bpa8zaWcrzNd6WRKD1e9IesDhaBASP-vR_Zauw,3368
+pandas/tests/frame/methods/test_head_tail.py,sha256=quuFkpS5IgonJDSb9_Po4eO3Wi5wlcNKq723EMYL6Ns,1935
+pandas/tests/frame/methods/test_infer_objects.py,sha256=LNOf2VJsV17FDT9ogEDba6la414yUmm5z_7B97nLN24,1241
+pandas/tests/frame/methods/test_info.py,sha256=XA4WDItjVnOjnGfQsHloK5YDaGygi45fzhkgMLsFFZA,17923
+pandas/tests/frame/methods/test_interpolate.py,sha256=cUvjn8lUJ5pirsSkyvOKevjAYi1I6Z0uDgxRXgTm0zM,20273
+pandas/tests/frame/methods/test_is_homogeneous_dtype.py,sha256=8Ndf_2Z07SAqrN0ookvH0PDAmECGVJkUieeqSaz2aRQ,1455
+pandas/tests/frame/methods/test_isetitem.py,sha256=VoxA-yXow_CRikJ1tlni1PsAAOT1D2X8PtTZyJOGQXU,1428
+pandas/tests/frame/methods/test_isin.py,sha256=P2TVUsL_p366aSxwWcq27VlT9zFstOXlsJSTFlw2n20,7599
+pandas/tests/frame/methods/test_iterrows.py,sha256=hfFRA20tRYmXJAoJZLGI04J131Z7QaaEbINm3FwfVbQ,338
+pandas/tests/frame/methods/test_join.py,sha256=oGHrJh9Gb6k8Cgg1iHNVoJuamkIHqnzs5EoU_XdY9hM,17523
+pandas/tests/frame/methods/test_map.py,sha256=UIY-wd0ozerUNyILMavuJ47qdWwp8dREjeKeeR8zvc8,5994
+pandas/tests/frame/methods/test_matmul.py,sha256=i1BG41S9da2R0nATvc3kZXsiwl5t6MHDFIb0IJ4lAbQ,3137
+pandas/tests/frame/methods/test_nlargest.py,sha256=xqBTJTJHni34Qkgn2YlBUvOngOQNRw4MCGtGXFp4G3M,8192
+pandas/tests/frame/methods/test_pct_change.py,sha256=s0Ho617mHdRHBEV-9cRAz3_Z_Q5BzTd_cd6MuobTlbo,6530
+pandas/tests/frame/methods/test_pipe.py,sha256=ts5ghk8g6PYXKpdsBdovBXxPGO2qq75FEVzBgjAVfRw,1023
+pandas/tests/frame/methods/test_pop.py,sha256=e0CBRelgiASCGdB1NFRMSr04BbaggjyHAZYvmUUh1sM,2223
+pandas/tests/frame/methods/test_quantile.py,sha256=Xod3zoRCKr4D6CYEd6I4HC6q3ERz3vYlwf1D3OvlnGM,36591
+pandas/tests/frame/methods/test_rank.py,sha256=fivZJ_OZxlHb-9VD5PANTxkJbeq1ajZbA9li5sKbGmk,17548
+pandas/tests/frame/methods/test_reindex.py,sha256=tmNvHk4dcGnrZ81EA5UGtPq6LdSa0Y64yQ5MzIZoKP8,48343
+pandas/tests/frame/methods/test_reindex_like.py,sha256=2qgqaHDSEKYO1hwE9MaPTFJhl4m7rejHyuOcrmvqaBg,1187
+pandas/tests/frame/methods/test_rename.py,sha256=P-SIwbh-n6QdPqFns4ebPtGFwdXd7vmeWt5_dwo0Kq4,15354
+pandas/tests/frame/methods/test_rename_axis.py,sha256=90QFtDi0p-8bxEdFfLs75EtJQtJEOTmCdXoiS7h9F-Y,4091
+pandas/tests/frame/methods/test_reorder_levels.py,sha256=VJVEdltyRoz89mQR1Xp0A9yKlTeEFIpsPaKWQujT-C8,2729
+pandas/tests/frame/methods/test_replace.py,sha256=VbZowu325vh80eg6T-1c_m5ns_p8aZRbUdy1qrjZMwA,62755
+pandas/tests/frame/methods/test_reset_index.py,sha256=WRm-L0WeMvJ9zLh000m-4mz4lhp1SbrLgN6rQf__t1k,29156
+pandas/tests/frame/methods/test_round.py,sha256=dcPlBxHqpKJ6JTBJskvw2CE3IYfa-Xt020jfSslwLjs,7978
+pandas/tests/frame/methods/test_sample.py,sha256=vPDSUU6oBD5X2C5rKUhIHk6o2xftm0zzMTwvuipelRM,13431
+pandas/tests/frame/methods/test_select_dtypes.py,sha256=x0hQ0ChW-xMxJwTX2l5u3cGPC6CNPQZt77b4gSM0FIs,17273
+pandas/tests/frame/methods/test_set_axis.py,sha256=xiyZyjgDIO0B5HWGLeV_fVDyXj3YMDBfLyEDh5rQvcw,4608
+pandas/tests/frame/methods/test_set_index.py,sha256=DNZMKbX0xDqAbf9wzQKwHlR7mdBO7a1ECSAuXUo5CEQ,26570
+pandas/tests/frame/methods/test_shift.py,sha256=unBlSwoV0OwFfysSr8ZKrqrrfoH7FRbPlGp18XW84OQ,27731
+pandas/tests/frame/methods/test_size.py,sha256=zFzVSvOpjHkA9_tEB2mPnfq9PJIBuBa4lCi6BvXbBDE,571
+pandas/tests/frame/methods/test_sort_index.py,sha256=BbCjfh_Zke1R7M9fPoRASORNfXS2KZ0IgWOF6jNnor0,34826
+pandas/tests/frame/methods/test_sort_values.py,sha256=NTmGhvm_flc6gzdtOeAOXsO3ai6K3peyH476Sj-qfLA,32982
+pandas/tests/frame/methods/test_swapaxes.py,sha256=-IuPIvjEz7X8-qxnWy1no5hG2WklPn6qERkmQQ-gAv0,1466
+pandas/tests/frame/methods/test_swaplevel.py,sha256=Y8npUpIQM0lSdIwY7auGcLJaF21JOb-KlVU3cvSLsOg,1277
+pandas/tests/frame/methods/test_to_csv.py,sha256=ph8z03KVeulvnYXX0vEHVZ2i4dY38oU6aMlw6xeUT8M,51560
+pandas/tests/frame/methods/test_to_dict.py,sha256=BEKNs7rUFnd_cZZ7wQz0AmKJ7U-7KsEI6V3eApb1chw,18640
+pandas/tests/frame/methods/test_to_dict_of_blocks.py,sha256=gbiXpvTckh8rspweNjNng1oDalTnbfV487tQ_0BdJU0,2641
+pandas/tests/frame/methods/test_to_numpy.py,sha256=axcJ87gIlMRd2HER_tBgm-Y3mwM4n4pRIHNCQ8jwk-c,1914
+pandas/tests/frame/methods/test_to_period.py,sha256=Xiebi3IA_vUKrFNftLBkhF4N0gMbpI76ZCQpqhgO4iU,2863
+pandas/tests/frame/methods/test_to_records.py,sha256=35K3btxiApCcRVPG429FZAqqXIKRHKx4bVc8Sg3DCmE,18553
+pandas/tests/frame/methods/test_to_timestamp.py,sha256=1j6yjp4_WlxcDXSBKOk-IfrEbWtC4HvbIIHeM2x25ys,5866
+pandas/tests/frame/methods/test_transpose.py,sha256=JNhwvci37DlDMYHBaJz4Km998vw8NGfl7f4UYwwnsmM,6830
+pandas/tests/frame/methods/test_truncate.py,sha256=ZTnK8yZYqEhG3pe8KVwmJf4K890RMu8a60A4nC_qznM,5216
+pandas/tests/frame/methods/test_tz_convert.py,sha256=vsJm9M19ciCPqG0t5d_BlxuCmDphDkgb75SuYPtOhmE,4707
+pandas/tests/frame/methods/test_tz_localize.py,sha256=rMvd0K3W7N24qn7Q_tTkvbz7dOemIv3w89hthc6c5Y0,2084
+pandas/tests/frame/methods/test_update.py,sha256=piYdB_B4VhkigQqLFiWJzNV4Geyiml1gJokdMNF36sM,6888
+pandas/tests/frame/methods/test_value_counts.py,sha256=YpYs0AZ8YgJE75W84O1KMfhd5oqpiuIJvLjz_YIz2KE,5556
+pandas/tests/frame/methods/test_values.py,sha256=ASljAwM9CEBMX6bA3FqWoSv4sOcRjuz8ZTfLSjo_F6Y,9406
+pandas/tests/frame/test_alter_axes.py,sha256=yHyCho1zs84UETsGGtw-gf3eTIyPj9zYUUA7wHTdRVk,873
+pandas/tests/frame/test_api.py,sha256=e6ABLjgP8f-1XVZlDVDn3cDU1nOelOTIx4fSublI6ac,12454
+pandas/tests/frame/test_arithmetic.py,sha256=9ZF2pr9Df5N3JNGKlgQ_HABoUD2Q1SajydyhzhFmD3U,73489
+pandas/tests/frame/test_arrow_interface.py,sha256=Ze1AfIL3VcJ6bnoyyUvNff-mkaZq3RFysoi7M1I1hTU,1505
+pandas/tests/frame/test_block_internals.py,sha256=HtTE3sPDnoMTzOygFIjOT31JG2E5Y62eodrEKvPR7mI,16104
+pandas/tests/frame/test_constructors.py,sha256=m6Pb0rFZw1sLrZXGuMVL8rqNqDr6AH-TDymJiOoi2RU,124866
+pandas/tests/frame/test_cumulative.py,sha256=Ku20LYWW1hrycH8gslF8oNwXMv88RmaJC7x0a5GPbYw,2389
+pandas/tests/frame/test_iteration.py,sha256=BuyW6QePxoNZl-Cgxp5WLah_e-kSK2hsN8Gud_g0aoc,5077
+pandas/tests/frame/test_logical_ops.py,sha256=zqJcMKCJhzWC2ZCa7RLc_bS7Plw5uS3foyoEXjHLgAg,7305
+pandas/tests/frame/test_nonunique_indexes.py,sha256=wtBZpClv_46EwBSk59H1iXay2SR6Wv7m4ajh0tjisJg,11937
+pandas/tests/frame/test_npfuncs.py,sha256=DRLl7MSP7e5vRrVs3FgOooI4pZNmECurbVqkAAqvlUI,2751
+pandas/tests/frame/test_query_eval.py,sha256=Tkrwx7qKLqJIJq_uPxG2YDRfH3wQFZ6kobStZS0knPI,55314
+pandas/tests/frame/test_reductions.py,sha256=Una20S8mvVGHlNtxsG2Vu-E0YspgrDgsi4g1x2BKGnw,76542
+pandas/tests/frame/test_repr.py,sha256=TZgR3zpUAumCTltt-pbI1Ha2Zdaox38a4g3T9yuMfwA,16818
+pandas/tests/frame/test_stack_unstack.py,sha256=Mgn_NzEdU7qMzqWcfmx_4FeaPrEMGF_2sRWxXoWaoUk,97558
+pandas/tests/frame/test_subclass.py,sha256=XqNKwBK-Zj06S4ATYGd59nKPzrzu8jmk_VbpStvB7ts,27880
+pandas/tests/frame/test_ufunc.py,sha256=YcUXnFE2n7lO5XN9aUvOJfeJyGqIDui0VhH-H1gUf1I,10554
+pandas/tests/frame/test_unary.py,sha256=4MEWi-fkt8iv8WEDvSP05Lamo1HiyzE8IIPfWpFb1nA,6287
+pandas/tests/frame/test_validate.py,sha256=hSQAfdZOKBe2MnbTBgWULmtA459zctixj7Qjy6bRg20,1094
+pandas/tests/generic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/generic/test_duplicate_labels.py,sha256=-t-hhIiI3E1Byv1-jjvXDRAS8_tJzZaOIf-EsK6hrXg,14506
+pandas/tests/generic/test_finalize.py,sha256=HWv668IFuaSNElG3g1J5DL-wMHpU5T_iQYTOkaJA80U,28852
+pandas/tests/generic/test_frame.py,sha256=h6r5f3L-_V4JV5pP0AoFyvjtJP1ng7DJplN6Rrx4gzI,7332
+pandas/tests/generic/test_generic.py,sha256=MUhx9EVhCuo-fTOYRH2nzhQH8ip9-5QaNMjEPWx-NI4,17447
+pandas/tests/generic/test_label_or_level_utils.py,sha256=PhsVWjYjOHPZRqX4mwUc7jlOH3tnd7p9pkMFh87CtKU,10244
+pandas/tests/generic/test_series.py,sha256=oyFxVdh9G2GCBiTQktXNuafAw0wrbXs6Af8UnwUUiow,5677
+pandas/tests/generic/test_to_xarray.py,sha256=jSkLcl5jcZRZm3M2c6Iyv8hoT_YzcrEbgu2LuZ7SRqc,4782
+pandas/tests/groupby/__init__.py,sha256=O41hwVGLyFtIhv-zbe2JBZiqD3heGA7LOk10RuxfcKc,659
+pandas/tests/groupby/aggregate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/groupby/aggregate/test_aggregate.py,sha256=cRJLOfa-LPIyg33d19mfF3o9N1skMym9Tt6TZQanttM,55550
+pandas/tests/groupby/aggregate/test_cython.py,sha256=CaKQJHZvqIlhxyQzvrDpE2QUX_NMnWB86MIM57jy8aI,12866
+pandas/tests/groupby/aggregate/test_numba.py,sha256=vAaSk-oXue7xqZgmnYJxsg2nmFeyo9d-12m0oi-j1A0,13366
+pandas/tests/groupby/aggregate/test_other.py,sha256=oiP7HVIV27eBNIshYC8JTENGUWg2kCBd5dnki4u32YE,20708
+pandas/tests/groupby/conftest.py,sha256=uxnebcMXbaC_tH4Pg2wRZvXlWMZ_WnNIUeX8ftK7gWo,4785
+pandas/tests/groupby/methods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/groupby/methods/test_corrwith.py,sha256=nseP6eDkLjiNIOSxm2EDFTkemTqNFUNqvvNJpMiNZVY,615
+pandas/tests/groupby/methods/test_describe.py,sha256=QTB1arYxilSCU75763T4aIwz91X6zmq1rARtQJZc8k0,9884
+pandas/tests/groupby/methods/test_groupby_shift_diff.py,sha256=4XMAhqV0JrGeXQn1_07ec9Nu25Dy1LOcDfojo4qEhNI,7925
+pandas/tests/groupby/methods/test_is_monotonic.py,sha256=OpnlOamR5gX1S7MVtZFGxnbt1Fem_wWH1Irc5aqkdq4,2566
+pandas/tests/groupby/methods/test_nlargest_nsmallest.py,sha256=MFS6cWChs3aBw3vb-n234pOV8_YYet2jOdDNN0lrMkg,3401
+pandas/tests/groupby/methods/test_nth.py,sha256=uk9H3hZiNlusb668TxiIXCoB0v9J2-w0tv-pyytRWEc,28225
+pandas/tests/groupby/methods/test_quantile.py,sha256=Sb6khJ8w4BM7s91CETO5jDI56d8YShzJyi8xsNfZ_Ng,16372
+pandas/tests/groupby/methods/test_rank.py,sha256=NE_ciV_TwLbTGoq1OFUFX5yadyiYoP3m5ppVOoD5264,24263
+pandas/tests/groupby/methods/test_sample.py,sha256=n_dLYblQo9MWnpngMRIIGLZFGEGOeAfEqsL9c9gLCKg,5155
+pandas/tests/groupby/methods/test_size.py,sha256=0ngo1qbGS47ItFlAnLXhU6778J7bVwV1uIjUiDjYN0A,4138
+pandas/tests/groupby/methods/test_skew.py,sha256=_FTlnXtE_fic6ZZ322S583IXUY5hEQggi-3Xbuboahw,841
+pandas/tests/groupby/methods/test_value_counts.py,sha256=D7AlJkbUdXv7i21-7wBxPY6ZaBJFMx1yzWVTs9_ipSg,40439
+pandas/tests/groupby/test_all_methods.py,sha256=eQsLKoyDyGZNPecbxC1HRzdIwW_DBEp0x_r3gD620pw,3077
+pandas/tests/groupby/test_api.py,sha256=IpMVl4g9F2317jWVTSiHoAsZKaOQWFx0Oi_jLWfv_DQ,8481
+pandas/tests/groupby/test_apply.py,sha256=BdpB3VlgEAPr7ri_kFsZfSaZGZIGuXTRjsR5js4uNa0,54516
+pandas/tests/groupby/test_apply_mutate.py,sha256=l8KQ2vAP7VmZ4NZ8Orp1Ro_KC0pzb9VRlgwYLl3K-fI,5012
+pandas/tests/groupby/test_bin_groupby.py,sha256=nZGe01NsuZmS88cMqq8fGFbKl-umvmWjXd8BGmR3jTo,1769
+pandas/tests/groupby/test_categorical.py,sha256=eHD9D11-8w55YwWIMbdFWe3iU-QtRphigXwjOKnaBlA,74727
+pandas/tests/groupby/test_counting.py,sha256=iQGu2WgK3xv66rkaKXGHZz01KgzCSQ48Hgt84jzUges,13618
+pandas/tests/groupby/test_cumulative.py,sha256=c6C7ZNo0O5DH9SowsAXp4j_SF-wskjrUlNtfDJomjxQ,10588
+pandas/tests/groupby/test_filters.py,sha256=uFvXjXF2fpQJSwZUhGOUfguyJk7xoXYyL0ShN2KfXx8,21870
+pandas/tests/groupby/test_groupby.py,sha256=fqAmXemWVwmSF-2eVrovj9rFyy88NBAkrC_BT7QGruo,108961
+pandas/tests/groupby/test_groupby_dropna.py,sha256=SUb7WSeAvOrpm3Lx-UcfqsHfjavVqb_fK-fBoOXYSa0,23509
+pandas/tests/groupby/test_groupby_subclass.py,sha256=f9_-wjEExdKD0QAbBnAwl2Vapts-3uiJGTLpKXC4oI4,4580
+pandas/tests/groupby/test_grouping.py,sha256=NWYkL7jIwViNMYwk6jx1nD6_cSlqwPeK1DdlELYvIX8,45896
+pandas/tests/groupby/test_index_as_string.py,sha256=bwAMXa4aSzVDUY1t3HmzK4y-jO5jIwbbRu85Jmb8-U0,2274
+pandas/tests/groupby/test_indexing.py,sha256=Ln_43WnuxtAVrWoaUHWh1IqUSY0i42nY9VnEnw86oXg,9521
+pandas/tests/groupby/test_libgroupby.py,sha256=xiFJcUw_cwTUpQh6E9L47EZm8HopmDrKuYSTI0gHnDs,10457
+pandas/tests/groupby/test_missing.py,sha256=u6mv6_D1ydhkK3jLXqfvidDlOXYdUsN44ySzFksaIlU,5358
+pandas/tests/groupby/test_numba.py,sha256=5jmlxFYdHb9uUw0VWEPNor0KI_2IFTx_WFWXYliNg34,3558
+pandas/tests/groupby/test_numeric_only.py,sha256=dL95cqPjfbA7bTdJioGjdRFF1I2MsO5qYAHZ-TG4HFk,19188
+pandas/tests/groupby/test_pipe.py,sha256=P_n3xXvve-lpjxr1K80dt3co8WTqovjfsetlG2iqrOw,2082
+pandas/tests/groupby/test_raises.py,sha256=0E0Cn1ovzq1FdPE7VHXic2EzE5P0hbYchZ_Io9z5-s4,23764
+pandas/tests/groupby/test_reductions.py,sha256=eEwz3aTCJtS5H1pEOz0yC9FfbnGS-I9M2C3U8QssBTA,40292
+pandas/tests/groupby/test_timegrouper.py,sha256=oRwaXLKWVRtuhYFeJS9pHCI8csK78E-rw1udHg0Igow,34984
+pandas/tests/groupby/transform/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/groupby/transform/test_numba.py,sha256=xANgwGOItK0qFyoIQKbaBIV2YjkUNcawYY8SXlsj5v0,10011
+pandas/tests/groupby/transform/test_transform.py,sha256=zGPQ5b3ZXxW1laE1lveRyvg19E7nJ7WK7dRviCE-ypk,57512
+pandas/tests/indexes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/base_class/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/base_class/test_constructors.py,sha256=yMGZGvGyBUH42aJu2DsJp7-ZcIBCjFOjYdDuU9GnZU0,2710
+pandas/tests/indexes/base_class/test_formats.py,sha256=mxZ2qfK-2k0GMQMovUZOcWzh_TNARa80JbggsXLFHIM,6305
+pandas/tests/indexes/base_class/test_indexing.py,sha256=1zbBHv-nJCIfXRicDPXPtyLBL3Iy-LvH5bkamnoFGrI,3687
+pandas/tests/indexes/base_class/test_pickle.py,sha256=ANKn2SirZRA2AHaZoCDHCB1AjLEuUTgXU2mXI6n3Tvw,309
+pandas/tests/indexes/base_class/test_reshape.py,sha256=PerLCLY_vi5wySNUAfD3P4Y6esET-WBqx4vSAEeifYk,3304
+pandas/tests/indexes/base_class/test_setops.py,sha256=X84dGTmkrEJ2oSQfr-WfozQA3moGUpnmbhkTYzJWH7k,9076
+pandas/tests/indexes/base_class/test_where.py,sha256=uq7oB-lk7rsgYQer8qeUsqD5aSECtRPSEUfKzn91BiE,341
+pandas/tests/indexes/categorical/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/categorical/test_append.py,sha256=LjLMq8GkNrsIVNfTrujLv_TlKo79oA_XbpNUFs-pqVQ,2191
+pandas/tests/indexes/categorical/test_astype.py,sha256=mQjQ9hbRf940DjzvC9OD6t8BzwphBXJdrROyEul1tzU,2860
+pandas/tests/indexes/categorical/test_category.py,sha256=V6Ol48cp9YqpzJmv0DatjgHfXKQmliBlXEnfhkmq3v8,14667
+pandas/tests/indexes/categorical/test_constructors.py,sha256=g3hEVtOS576z11miVwakwud3cLXkFI2ErImUaFW9N6U,5536
+pandas/tests/indexes/categorical/test_equals.py,sha256=AIrr-W5WeqDj5KbELqjHm3-hqqx3q8YxBrv1z2oco94,3569
+pandas/tests/indexes/categorical/test_fillna.py,sha256=sH68aWCabI2qy5dbgxQCXeTfvn1NQgDfM1OT4ojFmaU,1850
+pandas/tests/indexes/categorical/test_formats.py,sha256=AA5dyUaCUlbSKTsskrQ5MXfe375SZJXSKq3ZXnNMLik,6281
+pandas/tests/indexes/categorical/test_indexing.py,sha256=zBvryPgX3VF5P4HqUQ1h1FD2warHLfSvb0nBq6rxjrc,14978
+pandas/tests/indexes/categorical/test_map.py,sha256=VHsSFGWEBmgQLvvquC6-y3QDq3lwzSpqPWZHTLiGdzw,4664
+pandas/tests/indexes/categorical/test_reindex.py,sha256=vPCV9O582vxJpubqCm33UHcaOKMZNg8OMzDF3lQQDiM,2938
+pandas/tests/indexes/categorical/test_setops.py,sha256=YiBoQN3Dor2p32HCUColWIZBH620H1aPa4easA5FMgc,462
+pandas/tests/indexes/conftest.py,sha256=aP9iTl0n1HpZWIP_02i__XxFnSMJF8iCM5Ein2MRK80,987
+pandas/tests/indexes/datetimelike_/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/datetimelike_/test_drop_duplicates.py,sha256=UEmTzsZerSOIE6mPfaw4kQd7UFEo02H-EW5GOPpDTKU,2600
+pandas/tests/indexes/datetimelike_/test_equals.py,sha256=7Jnk1MjPYvI-I_YMRNRF29-g5CLaFmU3ZqQ6aO9KqIE,6348
+pandas/tests/indexes/datetimelike_/test_indexing.py,sha256=QoTXbCiqjK4tBDHUbq1TKPp0NroYkeheFjRq-VxlsP0,1310
+pandas/tests/indexes/datetimelike_/test_is_monotonic.py,sha256=_5PXF7mVilu1S4EJv7F-XMYIoz40kBkdSs4RJ8jTVdI,1522
+pandas/tests/indexes/datetimelike_/test_nat.py,sha256=6-Yr-n4JskfsjbaEPFgaRPKX4S7R-LhQOEQSC7cBybw,1335
+pandas/tests/indexes/datetimelike_/test_sort_values.py,sha256=iIhZOW7CEwVD3KuJUFEOM2z18KORCx04W09bwsdKSNs,11463
+pandas/tests/indexes/datetimelike_/test_value_counts.py,sha256=o090A9QuhmahJjH0WgKBIxXdBVxPkAc8vikXqZLuoD4,3150
+pandas/tests/indexes/datetimes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/datetimes/methods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/datetimes/methods/test_asof.py,sha256=gd-nBXLe-Dc5Voc_Ksgmq9mOU6S_I5ZZqlXcapgKzfE,738
+pandas/tests/indexes/datetimes/methods/test_astype.py,sha256=23E4v71mBkSd_WTYy9L1u9ljV-BjBkBtGW5m1uJaTW4,12342
+pandas/tests/indexes/datetimes/methods/test_delete.py,sha256=JaaHDwYuTarkta3Qd2fbteZd9k0oOzJsWCPEHUHHG4k,4441
+pandas/tests/indexes/datetimes/methods/test_factorize.py,sha256=Mif09gcfRfIO2uhCqNN9OC_NXggKizbuwaz6ScGzMUE,4468
+pandas/tests/indexes/datetimes/methods/test_fillna.py,sha256=eESnVTQ8J3iBL24bWKt7TmHxC5FJiLZMpKjw1V376qY,2004
+pandas/tests/indexes/datetimes/methods/test_insert.py,sha256=StmxdK3meNNEDO_CGzVIqltbXxwfX0pQxsngnPQfdtA,9343
+pandas/tests/indexes/datetimes/methods/test_isocalendar.py,sha256=JEABIm6LNySCbSUq6HLS-_qTGK3HgVcScSXLpDsrJ8o,908
+pandas/tests/indexes/datetimes/methods/test_map.py,sha256=1JR2lb_zk_8aIgRqnuWHfeXRPZBsFtdT4tRXeTDNqsQ,1358
+pandas/tests/indexes/datetimes/methods/test_normalize.py,sha256=rztamd3kwUZMcVQjeR1JcaIKr7pT0ACFcU4-FFynZkA,3041
+pandas/tests/indexes/datetimes/methods/test_repeat.py,sha256=GN-wTWws2sjodNibctZOi_NDX85y36Lr2BBmAs3LLMM,2740
+pandas/tests/indexes/datetimes/methods/test_resolution.py,sha256=RzkIL8IX63X1fgwr8o4_xuKvdOtPHdodPbsS75u9BRM,785
+pandas/tests/indexes/datetimes/methods/test_round.py,sha256=Ic1FFoRHdPv4TF1dSnOWVzVX90GowbXumbuNgTFPYlM,7822
+pandas/tests/indexes/datetimes/methods/test_shift.py,sha256=NhyUs0PMDuzSM573tqUamx3THf03WUNKz0nSOzDta5M,5933
+pandas/tests/indexes/datetimes/methods/test_snap.py,sha256=smwfWvN33B6UgLagKaBQkllTuGAm7Wiaq87M9nxu8g8,1305
+pandas/tests/indexes/datetimes/methods/test_to_frame.py,sha256=C6glyGdxSs-hMDQSt9jkftmRlTGPMCGdIQlfChR9iGk,998
+pandas/tests/indexes/datetimes/methods/test_to_julian_date.py,sha256=u6JLYazILIdltbe1uZE3iBAqE_ixXwx0oqwS6T-Mpng,1608
+pandas/tests/indexes/datetimes/methods/test_to_period.py,sha256=IIzHPLsk8BR43Ib5-8-EVxLQc_rkTcGBSk1M4-9OhYw,7986
+pandas/tests/indexes/datetimes/methods/test_to_pydatetime.py,sha256=sM22b33Cxwrpc5nShAp5QH2KQPOlEpi5d8G6fM3vVI8,1345
+pandas/tests/indexes/datetimes/methods/test_to_series.py,sha256=8ZW3AxMkHj3IV1wVgM797SH_rRLKQ9zld1UVkhk1C8Q,493
+pandas/tests/indexes/datetimes/methods/test_tz_convert.py,sha256=-Tuxq1egpSCBnBB7E_rAj1FudFgTm2DDYQ_wPMKgzwQ,11295
+pandas/tests/indexes/datetimes/methods/test_tz_localize.py,sha256=Q7A54lsovDxBDEqU7XNBJql3PoNLF7NVeXwvMFgrVI0,14830
+pandas/tests/indexes/datetimes/methods/test_unique.py,sha256=qZorAPI_oWcz5WdBEr0nQuT_mrApTgShqg3JVlzpVKU,2096
+pandas/tests/indexes/datetimes/test_arithmetic.py,sha256=l2q_n3zBT98OvI4gV7XZOZMCvo54xgM9frByNKCsbyU,1796
+pandas/tests/indexes/datetimes/test_constructors.py,sha256=zzICypvVbu8_PCfL3jiDGjSJWSflWjJbpqS5iNkd1kA,43922
+pandas/tests/indexes/datetimes/test_date_range.py,sha256=2CECH8fOYUP7LxyqlehEHVme2oSN4ZvEl3hjH8t-TDY,61363
+pandas/tests/indexes/datetimes/test_datetime.py,sha256=Q_dwJTXtSuVYTlMmnGhiNGCRrqHONu9wu2N5wgZw4pY,7305
+pandas/tests/indexes/datetimes/test_formats.py,sha256=rN90ZOq3e83t7X6uyd-cR1czM4A01nr3z_GIJJ0sy0k,12738
+pandas/tests/indexes/datetimes/test_freq_attr.py,sha256=oX_cweTcpKd27ywN976KCYpg0oFe77MeDWqnRJQwVRo,1732
+pandas/tests/indexes/datetimes/test_indexing.py,sha256=MncSVI_l914qEW2CUg_livQrJ6AcOxvzmaiNOdzlOoA,25241
+pandas/tests/indexes/datetimes/test_iter.py,sha256=7r3wuHLeCBHfX8kaHNK-4Ecr6ZqR89Dhzkisx2C7jOI,2590
+pandas/tests/indexes/datetimes/test_join.py,sha256=mFxTvHONYg4ELXArFDBo_qPO2_7JO5NoIWgYcCSDtRw,4915
+pandas/tests/indexes/datetimes/test_npfuncs.py,sha256=YJihZytss-MVNprp4p5pAL_emeC5pb3hBwtaS3yMCcU,384
+pandas/tests/indexes/datetimes/test_ops.py,sha256=h9MI1sM5I_T4a7kEPdZs2QuXTdlcnvKQJdI5jh6j4h4,1340
+pandas/tests/indexes/datetimes/test_partial_slicing.py,sha256=OlC1IDbJ2y_qjp-HCFERReBOHb07DnlPZ3lMlhwMSLA,16495
+pandas/tests/indexes/datetimes/test_pickle.py,sha256=cpuQl8fsaqJhP4qroLU0LUQjqFQ0uaX3sHql2UYOSg4,1358
+pandas/tests/indexes/datetimes/test_reindex.py,sha256=s1pt3OlK_JdWcaHsxlsvSh34mqFsR4wrONAwFBo5yVw,2145
+pandas/tests/indexes/datetimes/test_scalar_compat.py,sha256=pJz6r8-pnr5nl_KkUaCkTu2A3SGzJbH_0dpTFRjUUz8,11156
+pandas/tests/indexes/datetimes/test_setops.py,sha256=HThtofPALvrCNqwnFk-tqdvCIe_ij2f-VOObJfZQ93w,23574
+pandas/tests/indexes/datetimes/test_timezones.py,sha256=LfELNHXgQN5-7zwBW5OweUZm6y8Ogtm-ir7l-RQAJpQ,8046
+pandas/tests/indexes/interval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/interval/test_astype.py,sha256=G1mQrK3eS_zG7LMYuwyCvkph9ZoNkbQMLpI0nhI5tjI,9002
+pandas/tests/indexes/interval/test_constructors.py,sha256=THCXDlRG7AncX5wzRlp9w1RNrYA0bTpWmzErMVfT0-w,19853
+pandas/tests/indexes/interval/test_equals.py,sha256=a7GA_whLbOiS4WxUdtDrqKOUhsfqq3TL0nkhqPccuss,1226
+pandas/tests/indexes/interval/test_formats.py,sha256=1QwWNVu3bZWSULSfNza2_vhfCfzdXjLdyJEXW5ERAE8,3880
+pandas/tests/indexes/interval/test_indexing.py,sha256=OEO2u5o44t3xKNvDshIviQG8HMZH3fMUrF-QYiul4-s,25425
+pandas/tests/indexes/interval/test_interval.py,sha256=L4Zo4GWIMVzHpOQ3Q09-GH_0Ixtge5ATR6kIgMYYjoc,34741
+pandas/tests/indexes/interval/test_interval_range.py,sha256=z_ZiNlL_7esHwH4Kd77k2gPm5Ev0Zy_NgACSkKoy4vA,13758
+pandas/tests/indexes/interval/test_interval_tree.py,sha256=yHyolu5v8YRazksfOBRgWd3O3eFVtzPc6NePpcV0ceU,7560
+pandas/tests/indexes/interval/test_join.py,sha256=HQJQLS9-RT7de6nBHsw50lBo4arBmXEVZhVMt4iuHyg,1148
+pandas/tests/indexes/interval/test_pickle.py,sha256=Jsmm_p3_qQpfJ9OqCpD3uLMzBkpsxufj1w6iUorYqmk,435
+pandas/tests/indexes/interval/test_setops.py,sha256=nwBz1MHuHiM7JQc74w2doEpgTSwg3NYfGwGbQFXWKw8,8346
+pandas/tests/indexes/multi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/multi/conftest.py,sha256=42mdJqtqvX3PlBSdch1Y6jRBvhe0IzZxOoLt-BGX03Q,698
+pandas/tests/indexes/multi/test_analytics.py,sha256=FeKERG9vHP-fAeGhlrzKO3IfAFpOOQnxQD7fRu2ycLY,6710
+pandas/tests/indexes/multi/test_astype.py,sha256=YmTnPF6qXwvYY82wZfQ8XFwVwOYYsIls3LSrdADDW-4,924
+pandas/tests/indexes/multi/test_compat.py,sha256=q53DVV5fYOKRVEQBl_2ws6WXrNsrGr5w4FXvXLUBeuQ,3918
+pandas/tests/indexes/multi/test_constructors.py,sha256=xheN8wi7feG8ycx3IsPfx-cCwsrPf2WNG15MWHmrTww,26798
+pandas/tests/indexes/multi/test_conversion.py,sha256=XbgxHZRkjGYjj2M-EKCGRAY7Yghuly9Umd4isj8Q6MI,6172
+pandas/tests/indexes/multi/test_copy.py,sha256=9Xperk7a4yBTQKo8fgk3gCa2SwJr30mH2JYYMYWguWY,2405
+pandas/tests/indexes/multi/test_drop.py,sha256=Mv5FB-riRSuwwvVFJ60GwxRGbuFkU_LU5DPW8KY8NTk,6089
+pandas/tests/indexes/multi/test_duplicates.py,sha256=7_FP6fYuzDdffF2Wvgl8VKW4Auzq0xJ5ZVfp5Evnm3A,11559
+pandas/tests/indexes/multi/test_equivalence.py,sha256=LKBMAg82PbzkuMMy18u6Iktjzuavo1PIY-IxtPGBpZE,8530
+pandas/tests/indexes/multi/test_formats.py,sha256=Ra7L6T0N4zh6rZUg3gFP6bGC902uhBKV4kyLku7HCuI,9538
+pandas/tests/indexes/multi/test_get_level_values.py,sha256=WFSDmHIAXZ1RvDl-mK2HtXmWRO6IwSX5F0J7j5z0cm8,3971
+pandas/tests/indexes/multi/test_get_set.py,sha256=RAqTkYhqTOAgWEqcboZqNUwBWu8Epxk1I2w5dfCuPX0,12870
+pandas/tests/indexes/multi/test_indexing.py,sha256=lbx9kPQFf5EFfdCZ-yg1nGSqmJOYcpuHCBMC6vs_ZvA,36399
+pandas/tests/indexes/multi/test_integrity.py,sha256=VzyV3RrhWkQxwWzzLeLT6Lmc-njl4FnpoAIshI1BFW8,9031
+pandas/tests/indexes/multi/test_isin.py,sha256=OtlwJ9zZDvwgZOgbeY_oidWPOUmii_JBCCBpHnLw8us,3426
+pandas/tests/indexes/multi/test_join.py,sha256=aRp18UCIgoSXazdYdirOwGV0k8Gj4o5eNRJL56p56Bc,8440
+pandas/tests/indexes/multi/test_lexsort.py,sha256=KbwMnYF6GTIdefQ7eACQusNNuehbtiuqzBMqsOSfDU0,1358
+pandas/tests/indexes/multi/test_missing.py,sha256=hHjKWxl5vkG5k9B9fxglrYB4eQldKamkMbACAu6OvUY,3348
+pandas/tests/indexes/multi/test_monotonic.py,sha256=5xlESrQOEcFWdr0iB3OipJtA6-RzriU3Yq2OQGgP0M4,7007
+pandas/tests/indexes/multi/test_names.py,sha256=zx_8kapVXzDS_SsylRzTFia2OrNJeEq3kmNHUA4RVPM,6601
+pandas/tests/indexes/multi/test_partial_indexing.py,sha256=sVNIk9_NxMDsHuRQzPCernPmchTF5INAUFkzQV7t8T0,4765
+pandas/tests/indexes/multi/test_pickle.py,sha256=ZJVZo0DcXDtV6BAUuPAKbwMV8aGfazJLU7Lw6lRmBcw,259
+pandas/tests/indexes/multi/test_reindex.py,sha256=ww8fSIx426wfqBTogkJrKS533CjKorf-B4bhyKdEnD4,5856
+pandas/tests/indexes/multi/test_reshape.py,sha256=yRcnTGS0M5749jUZGEZA8_UxSZ-CeOeCsWYBbTS0nTY,6711
+pandas/tests/indexes/multi/test_setops.py,sha256=aPlm3AXfjUxPJKojiFLA8_kIAZGCqewAxGwxcDMqYT4,25460
+pandas/tests/indexes/multi/test_sorting.py,sha256=69C8BENuzyUvnQXEbjVvADmBAr5G6wzM-ELHOMLV2Do,10745
+pandas/tests/indexes/multi/test_take.py,sha256=4MaxPM4ZJQPXJKiqgwEwhZ71TyH4KQfIs5LgS40vvLM,2487
+pandas/tests/indexes/numeric/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/numeric/test_astype.py,sha256=P19W9zZl8tN0EK-PaEi2gIFHLwCbruTMEUm7_ALGH9Q,3618
+pandas/tests/indexes/numeric/test_indexing.py,sha256=nDzkrokWvcmHkeHWjE8umPfxX4lR6AnQorAV7ppElCI,22761
+pandas/tests/indexes/numeric/test_join.py,sha256=OuSnYPH-jIM4UZRUKQ9NFxxd8Ot1HEP7KA3_ZpPX3Ks,15039
+pandas/tests/indexes/numeric/test_numeric.py,sha256=mEAFY8sSQdkVA0rJCTZb8cqjVAsTvL6mXzQSEXyxEgc,18586
+pandas/tests/indexes/numeric/test_setops.py,sha256=nO-3m7tb_ytjXx0Z8SqBkPSAnPVDz_PL3r2fzWtE7fg,5874
+pandas/tests/indexes/object/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/object/test_astype.py,sha256=p1EwqKDlOHAlSOpzxLaUDnAEm6yAQ0VIGnN-hhieCks,368
+pandas/tests/indexes/object/test_indexing.py,sha256=_kv5xtayKpuAj6DBz7V3ZNg2LE3zHv0Ua5LJzQHilEE,6442
+pandas/tests/indexes/period/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/period/methods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/period/methods/test_asfreq.py,sha256=PAqk5Zktd2OvLYwNoUGeXOh39HIIz9-5FqXnzrH6rtA,7080
+pandas/tests/indexes/period/methods/test_astype.py,sha256=vz7aRsoeDLXvQ_bhob7hNq1B_3gs4n_rCkD-sW5atAc,5671
+pandas/tests/indexes/period/methods/test_factorize.py,sha256=FXQh6VmGkuGkB2IAT4Y-2V5UaD2LCUNjQZ6amfBao80,1425
+pandas/tests/indexes/period/methods/test_fillna.py,sha256=jAYnaWGMuUaG993yxLwr1eT6J1ut43CcBaKds4Ce3-0,1125
+pandas/tests/indexes/period/methods/test_insert.py,sha256=JT9lBhbF90m2zRgIwarhPqPtVbrvkLiihZxO-4WHvTU,482
+pandas/tests/indexes/period/methods/test_is_full.py,sha256=RqIErBofIn5Ewh-MomVePHOn0hViZbe4laMC2vh8nPs,570
+pandas/tests/indexes/period/methods/test_repeat.py,sha256=1Nwn-ePYBEXWY4N9pFdHaqcZoKhWuinKdFJ-EjZtFlY,772
+pandas/tests/indexes/period/methods/test_shift.py,sha256=P7XDpMkLEYarH06RLBglFJKoGPkax4oLdiuI676KLek,4405
+pandas/tests/indexes/period/methods/test_to_timestamp.py,sha256=DCFf_Dt5cNsuSWJnYQAGfJrx1y2Z0GQiSTh0ajQJhjA,4888
+pandas/tests/indexes/period/test_constructors.py,sha256=LkRK-O65VdhX3EDQJHDdeGVQHfA6BQHT_PCi97M4xIs,27175
+pandas/tests/indexes/period/test_formats.py,sha256=DFLAMAPFzX2DI1iAAEjVY_nM9TuoYmCje3m7Q17A0EU,13259
+pandas/tests/indexes/period/test_freq_attr.py,sha256=KL1xaip5r7nY-3oLW16bmogfkYljsGJEJGKxn6w72Fo,646
+pandas/tests/indexes/period/test_indexing.py,sha256=jms77VvgkIgm0bSCHX-IMOtYuR0w2jd5uW3UoC2fm_4,27893
+pandas/tests/indexes/period/test_join.py,sha256=mwVL-OKx7tKTvMeSLNTh8jv6ViU6-NXcWr5O4hCmkOc,1835
+pandas/tests/indexes/period/test_monotonic.py,sha256=9Sb4WOykj99hn3MQOfm_MqYRxO5kADZt6OuakhSukp4,1258
+pandas/tests/indexes/period/test_partial_slicing.py,sha256=gXvS-qB0jPHYLKvjaP2rBW4p2UAm-ahM6KCCpT-u7ns,7433
+pandas/tests/indexes/period/test_period.py,sha256=91AawBQiPn_J3b6aG4sEzU24VaNJBTMn8shm_qkcE2g,7861
+pandas/tests/indexes/period/test_period_range.py,sha256=PB_VIuobx3NgnGOSmYZ0fyk79Zpoop22oYDP-TW-36Y,8979
+pandas/tests/indexes/period/test_pickle.py,sha256=l9A79u5PTcoa70g26wFPLTGnbvYpe76hPk1Iv334gb0,692
+pandas/tests/indexes/period/test_resolution.py,sha256=0TmnJeZCOaTWneeWA66DlxKgaUZJTfP0jKgLAY1jiyg,571
+pandas/tests/indexes/period/test_scalar_compat.py,sha256=CJuW0w6SdwDPtlk2Dl14g0ewuCcsIKPwtnmIMBSYEuc,1350
+pandas/tests/indexes/period/test_searchsorted.py,sha256=_u7DlvBnFx0_c8u3FIKYVOUcjlvN7p0gojLl9fZDkMQ,2604
+pandas/tests/indexes/period/test_setops.py,sha256=BcwDXv1-fnqOJLtzNqY2rEOye97Smyk2iXMnZx_IQE8,12547
+pandas/tests/indexes/period/test_tools.py,sha256=DFoxBsCYRWqodmNaDNPnQrZTTXiaSvwNZkwrybe7cl0,1361
+pandas/tests/indexes/ranges/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/ranges/test_constructors.py,sha256=ceX79fbjGyc5VNkmz29Q1N7WGXLj40BvTuz5PfNAw4I,5328
+pandas/tests/indexes/ranges/test_indexing.py,sha256=WCJFjnEzFIqQUv_i2cy-wHRQ4Txfi8uq4UBp20s4LRw,5171
+pandas/tests/indexes/ranges/test_join.py,sha256=lniHRyuEJWY7UGc0TpJ20xzUftn6BpYJbZQPo2I0dxE,6268
+pandas/tests/indexes/ranges/test_range.py,sha256=AaoOQ_PufgrgnOmS7ARYRydbdU1jsb6-DKu2oX52LuI,20937
+pandas/tests/indexes/ranges/test_setops.py,sha256=yuiXAKlZJ5c3LkjPzFltAKFQmhVqaBleiJ7nzXs4_eA,17534
+pandas/tests/indexes/string/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/string/test_astype.py,sha256=r2hLBYI1NQu3KD6daxOC-m6hYp3FhvMcPPPHZrvfXMs,722
+pandas/tests/indexes/string/test_indexing.py,sha256=vrbnnCMOQaIVkIUUlpbcW2Fgy6XGMr2BrefVBDp95F0,7850
+pandas/tests/indexes/test_any_index.py,sha256=KVBtWYaXj_qyCfSDgCeO7wc4uj0lkJrm-yiBJEu_nxU,5143
+pandas/tests/indexes/test_base.py,sha256=FTlZOGsF-ryZUz-FnDPSAtq33jTCDq5xK-jLZToe0FY,60527
+pandas/tests/indexes/test_common.py,sha256=UMs10zvX5OpUe3OicDGBO2wGz2b84zZA9TVWb36Xp6A,17972
+pandas/tests/indexes/test_datetimelike.py,sha256=6ue74lBTp8Es6PZoE1e_5Fo6k3j7Hq_HkpLnBjAYspE,5598
+pandas/tests/indexes/test_engines.py,sha256=rq3JzDXNc2mZS5ZC2mQLpTeydheOX9OLoq1FLR53wbI,6699
+pandas/tests/indexes/test_frozen.py,sha256=ocwmaa3rzwC7UrU2Ng6o9xxQgxc8lDnrlAhlGNvQE0E,3125
+pandas/tests/indexes/test_index_new.py,sha256=6tO12VIGCoGKN3uk1SlPdPXn5vQaOJ9tECa3oVyWC8c,14923
+pandas/tests/indexes/test_indexing.py,sha256=jwcq_dujP7z8tfnLqQ-G2NoJ0CxrDIa33jWwRLKk-8w,11309
+pandas/tests/indexes/test_numpy_compat.py,sha256=fnrc8fNrV7v3BRTY7Huu9cyrBw2aNUrv5i4UUEublFE,5776
+pandas/tests/indexes/test_old_base.py,sha256=Ama73MdyBWXYZiw6vVpOxN_mnNMwcSIQg5PqzWPSFLY,40117
+pandas/tests/indexes/test_setops.py,sha256=OKZqVmEihDGdzqJVrdc1PxVdBQoaJFrrxjdpyZRJDg4,33496
+pandas/tests/indexes/test_subclass.py,sha256=lmZHuQ8OSlwP3xcR8Xy2Mfvjxp2ry2zUL4DO2P4hbnk,1058
+pandas/tests/indexes/timedeltas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/timedeltas/methods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexes/timedeltas/methods/test_astype.py,sha256=xbvKmv20EHrDvBcjJnUpJfiPkfOCPiFrOn7TMS2H_s8,6331
+pandas/tests/indexes/timedeltas/methods/test_factorize.py,sha256=aqhhwRKZvfGxa3v09X5vZ7uBup8n5OjaUadfJpV6FoI,1292
+pandas/tests/indexes/timedeltas/methods/test_fillna.py,sha256=F7fBoEG-mnu16ypWYmK5wbIovQJKL0h86C1MzGkhPoE,597
+pandas/tests/indexes/timedeltas/methods/test_insert.py,sha256=fDYCuOIefgjNBJ7zhAUYniNVl5SltSs275XaNoL0S-s,4713
+pandas/tests/indexes/timedeltas/methods/test_repeat.py,sha256=vPcNBkY4H2RxsykW1bjTg-FSlTlQ2H1yLb-ZsYffsEg,926
+pandas/tests/indexes/timedeltas/methods/test_shift.py,sha256=MzVVupnLHEvuwlVCn6mR7LQ9pLeNiWM2lWwNlIwoo98,2756
+pandas/tests/indexes/timedeltas/test_arithmetic.py,sha256=YocDQIovXnrpXEzz3Ac-3l2PdGaDf2_sF8UPcLVF1Z8,1561
+pandas/tests/indexes/timedeltas/test_constructors.py,sha256=atU_oy_1oyUtMWRg47A94j3S4nPJbDRRgUhDCW6TO6M,10600
+pandas/tests/indexes/timedeltas/test_delete.py,sha256=-5uYhDUCD55zv5I3Z8aVFEBzdChSWtbPNSP05nqUEiA,2398
+pandas/tests/indexes/timedeltas/test_formats.py,sha256=4yUVmL5NEabGi9AXPA5isM3c4F3Rgslk4zqcfS-ua3s,3807
+pandas/tests/indexes/timedeltas/test_freq_attr.py,sha256=gYGl9w9UdtcfN26KUx1QyY4mjh6A0m4Csk3gsCIcdos,2176
+pandas/tests/indexes/timedeltas/test_indexing.py,sha256=9C-U4bwBd7D1GnaKgi51Jlgod7KhONIlgrA9t7jSQ80,12160
+pandas/tests/indexes/timedeltas/test_join.py,sha256=7JUirtgNGJMRL1-k2gekrvondwYuIVvuI2548v4nfIo,1396
+pandas/tests/indexes/timedeltas/test_ops.py,sha256=nfGyNJvNy7_jmWebKjevLKhyAMNvI5jytkZTNlpEC-g,393
+pandas/tests/indexes/timedeltas/test_pickle.py,sha256=QesBThE22Ba17eUdG21lWNqPRvBhyupLnPsXueLazHw,302
+pandas/tests/indexes/timedeltas/test_scalar_compat.py,sha256=hldSSTxREuBBuLAhvLTjX7FUmJ9DzcJxmMqzaClnErg,4573
+pandas/tests/indexes/timedeltas/test_searchsorted.py,sha256=kCE0PkuPk1CxkZHODe3aZ54V-Hc1AiHkyNNVjN5REIM,967
+pandas/tests/indexes/timedeltas/test_setops.py,sha256=Y6OwY82XC1hDgME55I_9q_UzGZdKhAhI1sxXS8bzr1w,9503
+pandas/tests/indexes/timedeltas/test_timedelta.py,sha256=UxobS6Dhfoqy4bnoAuMlLO8acpNrCDGsYWl4vGbDO8Q,1934
+pandas/tests/indexes/timedeltas/test_timedelta_range.py,sha256=tZqv_j045dPD3K2sbqdhdvEb-qE7szf9S7DJNX5Ri3o,6220
+pandas/tests/indexing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexing/common.py,sha256=LtCDO4TeMhLWAiTGiJET3YP8RO6T3OQqmdpJ8JH391g,1021
+pandas/tests/indexing/conftest.py,sha256=9C84qvdnHzbM5C0KIVw3ueQhHzuUMoAlw07dVJqCAmQ,2677
+pandas/tests/indexing/interval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexing/interval/test_interval.py,sha256=pB8gTluRFlmZZVCcRDtjXUygjSJegI3YRYI3XIPgsy0,7482
+pandas/tests/indexing/interval/test_interval_new.py,sha256=IkPyCHTHvwyHf25ljz4o6Q0CnHVpnLD2jVUF3TbtLS4,7976
+pandas/tests/indexing/multiindex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/indexing/multiindex/test_chaining_and_caching.py,sha256=hPcMvvPamIHI8AeSL7xvqs3eOT-5ONMjLy2XK2Mgt4Q,2922
+pandas/tests/indexing/multiindex/test_datetime.py,sha256=tl1yr3h50R0t7uvwTcfsRW-jt1n9vsqf4BWp4dNTdd8,1234
+pandas/tests/indexing/multiindex/test_getitem.py,sha256=wNftnfXLfiyjduEYeq8MSfE8K1OKaZG0WpmKWBqWk6o,13230
+pandas/tests/indexing/multiindex/test_iloc.py,sha256=G2CUPRhd5pRImZpH0uOVIPid7fzB4OuJZjH8arQMrE0,4918
+pandas/tests/indexing/multiindex/test_indexing_slow.py,sha256=nMfW1LQn7YlJauNceeR-uo_yPxRG2E8hcbgqTBMxaH4,3335
+pandas/tests/indexing/multiindex/test_loc.py,sha256=_8ggKLn3VoO-qx9o38uYeJ7MmzA_VgjOvoLfjLpaHpY,32777
+pandas/tests/indexing/multiindex/test_multiindex.py,sha256=bIihrEIUXO1s8wAnKof9ATiwqAvwuLIWzE_oZlMxlOs,8065
+pandas/tests/indexing/multiindex/test_partial.py,sha256=05MXMJmAevJ31bqHIVikEL14x6s7IUASxLaw62w44mQ,8858
+pandas/tests/indexing/multiindex/test_setitem.py,sha256=cn0FPeh4oKRpI0o01tFx24VOoNQr90GCiKIMo8cBaE0,19840
+pandas/tests/indexing/multiindex/test_slice.py,sha256=7JcyCAq91OpruPy1awmdQmblxPzQF4UrnUN2XHrahbY,27104
+pandas/tests/indexing/multiindex/test_sorted.py,sha256=xCdmS_0DBN2yoTVcSB-x6Ecwcw93p6erw3bTiU6_J3s,5192
+pandas/tests/indexing/test_at.py,sha256=eQhts-_Z5PWS7BpwfC3-e3YUEBm2pHsxcUY781OVQfg,8092
+pandas/tests/indexing/test_categorical.py,sha256=JPn8mSo7FSTuFaHzpiELgVBwTsqmjISLnGoxloy6SjU,19699
+pandas/tests/indexing/test_chaining_and_caching.py,sha256=-T0e9bh8ktgrHrB8CXd-MjcvLnckuiSSyBC8Cr6q-uE,23479
+pandas/tests/indexing/test_check_indexer.py,sha256=tfr2a1h6uokN2MJDE7TKiZ0iRaHvfSWPPC-86RqaaDU,3159
+pandas/tests/indexing/test_coercion.py,sha256=pJcNUByiuyinv0bKk9jRTLSitvNcpjt4wgyuHMAjkDE,32668
+pandas/tests/indexing/test_datetime.py,sha256=Gj5Fo4ywd4md3H-zbk11bSbNEmktbnlHORVRzBfN0oE,5703
+pandas/tests/indexing/test_floats.py,sha256=KG_T_POIEc5nnVL7Zi8zSwamhahbfjUxBYrC3ilRlEI,20603
+pandas/tests/indexing/test_iat.py,sha256=cQrMr1MYQv5LZS5E34NumdqqeK8hvcN6duLRTaeZ6Go,1492
+pandas/tests/indexing/test_iloc.py,sha256=NgXVbtjFOoTKYlHkVsVhIKmKanW0hIvwoWklYR0lztk,51663
+pandas/tests/indexing/test_indexers.py,sha256=agN_MCo403fOvqapKi_WYQli9AkDFAk4TDB5XpbJ8js,1661
+pandas/tests/indexing/test_indexing.py,sha256=WmiWSmvp5BTP8fJvYz8pYJ4TUZVUS9rkd4hj6hzZLFk,40123
+pandas/tests/indexing/test_loc.py,sha256=nHRGLSfCCurOlvKA83XkkpQKZSz7ItrctjpUR3lTOh8,120438
+pandas/tests/indexing/test_na_indexing.py,sha256=Ek_7A7ctm_WB-32NePbODbQ5LDMZBAmCvDgPKbIUOcg,2322
+pandas/tests/indexing/test_partial.py,sha256=asE_jBG-hieXfCmExu3scGpJgtJuSb07FHkPNFqojp8,25088
+pandas/tests/indexing/test_scalar.py,sha256=BuLsr0F1OA4IeA816BzuLFiSNGppPoALpieV2_8Nfg8,9643
+pandas/tests/interchange/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/interchange/test_impl.py,sha256=bZd6UAQeRFlo067t7w0P0w7vNyMNv-p98sFNChcjar0,20214
+pandas/tests/interchange/test_spec_conformance.py,sha256=JnE2kQOLr4EjUCH6Nzc1fCEXhbZ52WzKbioW6f6EVxo,5593
+pandas/tests/interchange/test_utils.py,sha256=15liIDJirQDoP7TxxQkmZJ9gCAVNCd2BwShW_GlwL2A,2965
+pandas/tests/internals/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/internals/test_api.py,sha256=7s-n3jyp-e0ikVxkIqxf3xRtxk3aBV4h5FsnMIcStMY,2166
+pandas/tests/internals/test_internals.py,sha256=2Lo6SX0HQSCiFuSRm-5-pqJWC3rJovjFsn5NuiAO_qE,49639
+pandas/tests/internals/test_managers.py,sha256=uIuBmkOCjbFuGGNOodZ7ITijw4CfsG4aOUqRLCEfg-s,3556
+pandas/tests/io/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/conftest.py,sha256=hGdKIxz9wKnphU200sfKZKe2FBKwcd3x3BSvlFrDOHU,6041
+pandas/tests/io/excel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/excel/test_odf.py,sha256=DoE6DfjKkIKGJtRUG8uvBNNGBOvoqVZnL8Jr_I1vOLQ,1999
+pandas/tests/io/excel/test_odswriter.py,sha256=2SmPARRnXiOAstiUaEFaVfGu2kVQ5vVHGODlozrlUFI,3268
+pandas/tests/io/excel/test_openpyxl.py,sha256=wnADQLARvjB4BMYgd2fMs5jsvYm8DQvqFngJVnhSH1Q,15227
+pandas/tests/io/excel/test_readers.py,sha256=UEWss38RW7dRAkAqAiHNdQMQCXr5XYOiR5p2pG8feeg,62778
+pandas/tests/io/excel/test_style.py,sha256=mQ7roFc4ZfBfrjc4Das0lNnYXIcV1cO1AOuXVRw1Dqw,11284
+pandas/tests/io/excel/test_writers.py,sha256=FTFRB9-fV6m9INqiysVkZtUTHvxphDJ4bvxk4rkFZw0,54972
+pandas/tests/io/excel/test_xlrd.py,sha256=e5QrByVFVm6rEZbdSifYBBCY-czTzWZZ5y7OyfrPksw,1977
+pandas/tests/io/excel/test_xlsxwriter.py,sha256=DUmibvRcUD6O2OcD_YcMymQPvMgkckIH92NjYsamyOE,2773
+pandas/tests/io/formats/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/formats/style/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/formats/style/test_bar.py,sha256=E07H6L-Sa3sgEGzy2oGnuZCs24P-HtsjSUDAk-G5jAM,12049
+pandas/tests/io/formats/style/test_exceptions.py,sha256=qm62Nu_E61TOrGXzxMSYm5Ciqm7qKhCFaTDP0QJmjJo,1002
+pandas/tests/io/formats/style/test_format.py,sha256=9siaXSHvCrA-YEuRI0-zun0gwQf2fVZwSPMIrb7CLTE,21154
+pandas/tests/io/formats/style/test_highlight.py,sha256=p2vRhU8aefAfmqLptxNO4XYbrVsccERvFQRd1OowC10,7003
+pandas/tests/io/formats/style/test_html.py,sha256=FvW0Zh6U8CkOKo0Plvz8W-udOgsczg9qawyVq-xzKqc,32702
+pandas/tests/io/formats/style/test_matplotlib.py,sha256=KPTvs_DbJlT5u7xQiQW3Ct-0jmpFHuah_lfQgZkiuQw,11649
+pandas/tests/io/formats/style/test_non_unique.py,sha256=JG_rE5A5Zk5exlfivZHnOI3Upzm8dJjmKKHkwEje4LQ,4366
+pandas/tests/io/formats/style/test_style.py,sha256=x7r8-nhnYdifw_PjopT0a4t99MTGzlOBv-g38HOHxik,58095
+pandas/tests/io/formats/style/test_to_latex.py,sha256=EbsBCluJ-2eVLSxXHgLo6Uus6VsnrbzqO9sYaRuewgs,33008
+pandas/tests/io/formats/style/test_to_string.py,sha256=w1GvLm3FtKQd9t2nwN3vF55X5f0GQKGCGXpYFZxITpA,1910
+pandas/tests/io/formats/style/test_tooltip.py,sha256=GMqwXrXi9Ppp0khfZHEwgeRqahwju5U2iIhZan3ndZE,2899
+pandas/tests/io/formats/test_console.py,sha256=jAk1wudhPiLBhhtydTNRlZ43961LqFu3uYt6cVA_jV0,2435
+pandas/tests/io/formats/test_css.py,sha256=YFHK3UFe2jcnz6AhmOFb7ZU1jd5Y_LYxIx5PBrJXNLQ,8669
+pandas/tests/io/formats/test_eng_formatting.py,sha256=QqFZJMUBVnU5SpZB63tCOHX3CqZbjgesOZc6nxbhp4c,8454
+pandas/tests/io/formats/test_format.py,sha256=ln-Q4RriF9nAh6xe8oyJMUXxFS0ZBRjItyukl5vbGLs,83129
+pandas/tests/io/formats/test_ipython_compat.py,sha256=pRAOUIZ3Vsb2LVYywzk30d834GzqLH9N8kjTGlf2MXc,3055
+pandas/tests/io/formats/test_printing.py,sha256=hLBoT3FE7J2VjxCJIAS_N24g6pMoQcyQphGTnwt0Ehc,4499
+pandas/tests/io/formats/test_to_csv.py,sha256=mThYTrnKefL4fWiqsLmJP9nsJcKx9ejdPNXndW6ADzo,27541
+pandas/tests/io/formats/test_to_excel.py,sha256=ecNeSrVd2mSPsdIqm3lM911b4mPwLIVkoz3MnJFZE3g,15320
+pandas/tests/io/formats/test_to_html.py,sha256=elbKQSMvV8p3qWEFVFA_nneSjdXl432QYDlha1cGVGw,38699
+pandas/tests/io/formats/test_to_latex.py,sha256=ka8kOxa7dLP3wQf7b4dGHLNP9lc6TI1MCepsLSfYoTQ,41660
+pandas/tests/io/formats/test_to_markdown.py,sha256=2DUY7KrRVUu_OU6q4biW8rNFEINN6fPSkqs8VzY8rlE,2757
+pandas/tests/io/formats/test_to_string.py,sha256=IJR-u9WLmPTMltFqZSFnIZX3FAmmNj0I3wPij6UlbdM,39355
+pandas/tests/io/generate_legacy_storage_files.py,sha256=arKCOsudw84kCaRY8gxmtsgS1B0hYZrtrG_1wfl9YOc,10247
+pandas/tests/io/json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/json/conftest.py,sha256=Zp83o90PvZ56MbhNRr1NZEPTpho7jRHcLYiEA9R_BZw,205
+pandas/tests/io/json/test_compression.py,sha256=PNaQlGwVdCL8K6ujRinmALn9O28tNZbxgelGcK-6MSo,4506
+pandas/tests/io/json/test_deprecated_kwargs.py,sha256=DKuEh2V2IkJOu-BnurWvax8Mq5EcQHtG-K-zncGZRpo,690
+pandas/tests/io/json/test_json_table_schema.py,sha256=tMsV0DT8OgHTsjQOrAGr-oMiJBXjtZ846-vb-KazYc8,30664
+pandas/tests/io/json/test_json_table_schema_ext_dtype.py,sha256=mTwJ_IpOBewvrLU98eLo-_yibYtOqD64LKLI_WIr5n0,9500
+pandas/tests/io/json/test_normalize.py,sha256=eOQoJQBGjAqFcswdNBipHoGMGBgLiwLFNIzTuZ5XSkI,30816
+pandas/tests/io/json/test_pandas.py,sha256=Pj7sFTAbRRwams8VLREUU7_Ui3GSgze6hI-K52YEbU8,77668
+pandas/tests/io/json/test_readlines.py,sha256=NaIeCB9w7iM_Ptamx4IoLMRwIG9eUQxsTJpU2cBB5y0,18819
+pandas/tests/io/json/test_ujson.py,sha256=UYh87hxO7ySZ60Q8ycDjbEqzcbBD51mV9qIlMCDA_Fc,36424
+pandas/tests/io/parser/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/parser/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/parser/common/test_chunksize.py,sha256=X2yrC5STddTg8ITNYdjFb2ZvGZNsQ2kGaQvFysmrmz0,11287
+pandas/tests/io/parser/common/test_common_basic.py,sha256=EgyGjcaLEPflKhC54NGwZB89bpRaOwqd9asreeojAdk,31043
+pandas/tests/io/parser/common/test_data_list.py,sha256=XTWzTbtaLRGFdrjfRTJH3TTedD8Y0uCWRzji1qnrdk4,2228
+pandas/tests/io/parser/common/test_decimal.py,sha256=6WZy1C7G2vNpSo165GZAoRFGiy9OMgKygAIEYNalQ-Y,1932
+pandas/tests/io/parser/common/test_file_buffer_url.py,sha256=4PbVEGwOYJh5z7ht6kgn2tdHv0F9eSEjT8Wi6dMeoaQ,13951
+pandas/tests/io/parser/common/test_float.py,sha256=5XM0Cndv31L4_7ER2MOB-Bnk9_GELTpakFp1-dNRjyM,2582
+pandas/tests/io/parser/common/test_index.py,sha256=on6ur2EUBnLPqhb8w-8KgASkETTSarsQf8zOUuRU7mQ,8269
+pandas/tests/io/parser/common/test_inf.py,sha256=yXUF6DrDhiPKEfEXJLnb71bZnycbo4CKXkl14Vyv3QY,2114
+pandas/tests/io/parser/common/test_ints.py,sha256=K49T03jXs77ktsxIFFQqBisPI3z042A8GATZcn1Tq44,7243
+pandas/tests/io/parser/common/test_iterator.py,sha256=FljWxY67UNOCedqg_as_nY4GtkU4HDwqwgpLkxU00Aw,3702
+pandas/tests/io/parser/common/test_read_errors.py,sha256=Aas1e5CM0ohMBXNQ2tSZao7jZbWTk9LA85FglJ8CRLE,9592
+pandas/tests/io/parser/common/test_verbose.py,sha256=kil5N51khhQifV9az-x2ijMr3wGtddKrU5oAbr0b1hs,2339
+pandas/tests/io/parser/conftest.py,sha256=JVRpaE0BXy7SZIN3Af0x7vvoqsZhAR-aVRU5QC0tAho,9144
+pandas/tests/io/parser/dtypes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/parser/dtypes/test_categorical.py,sha256=H8HO6IYwkJryJV87hKep0rtyx4XmXAHh1ICuprkmYjM,9836
+pandas/tests/io/parser/dtypes/test_dtypes_basic.py,sha256=Q1WorhNT3B9pC5I6iqL62bUOkFEw3B1crPBJsHUsZjY,18821
+pandas/tests/io/parser/dtypes/test_empty.py,sha256=bFuG8P_48stM0rEB8J0pF-sRl3kezS-9wB3fycgCjFo,5258
+pandas/tests/io/parser/test_c_parser_only.py,sha256=CmyzHEkAccoHIvd1rShqZwaxqcUE-cC5eq6nm0GyPlY,20721
+pandas/tests/io/parser/test_comment.py,sha256=QO0E262p5tnOpm9oxqTO1rwl0KU-mKMP_jydlahyFMM,7560
+pandas/tests/io/parser/test_compression.py,sha256=hW1GxllxvM8sUQhmTVibkkqdj0JcAAR9b7nKCxuXblk,6403
+pandas/tests/io/parser/test_concatenate_chunks.py,sha256=RD1MUklgLBtBNvJu5J92cVZbrO3n38UzdQvh4BAvAqI,1128
+pandas/tests/io/parser/test_converters.py,sha256=orNhBxEjmQ8N6J-ERcprjtW24INL1yQwD9FyQWoD8W8,7437
+pandas/tests/io/parser/test_dialect.py,sha256=tgsdnhEkYBtjIKd-9BKAyQ8ATTSivnzIkiWiuLi513M,5844
+pandas/tests/io/parser/test_encoding.py,sha256=Og-q60V-nd-8xl5VBWDPtYqxGeemrs8rYCoCCWKdjmc,10782
+pandas/tests/io/parser/test_header.py,sha256=zvSu-S51vJaIGPOdZgdC2IeHd2Y_1FTId-QGJc_7BWU,21029
+pandas/tests/io/parser/test_index_col.py,sha256=5iKYLUProGUcrw-dUZgrt_6VagzsOp_K9TroSX7FLEk,11514
+pandas/tests/io/parser/test_mangle_dupes.py,sha256=sK5nKy43zOyORKabRypzh0iTz7JLpd2rCFWCEmApM70,5440
+pandas/tests/io/parser/test_multi_thread.py,sha256=x40FWVAiCprn9T83Tu7cVaiUcGIcSSOgp7lauIUsdjo,4315
+pandas/tests/io/parser/test_na_values.py,sha256=IWNdqBlWB0nkgXoQF8lPs2Mcn7uoOBCCgfkTh5u68ns,22460
+pandas/tests/io/parser/test_network.py,sha256=8bNvzZHJ6r_m1WEJ7qt6fZtUbxLkxWP_aGqGnrtk_Po,12319
+pandas/tests/io/parser/test_parse_dates.py,sha256=o0-4VDf5XD2KK_MP-OcLhNgQ2GZ3DYh67l3_kohVoGs,69728
+pandas/tests/io/parser/test_python_parser_only.py,sha256=kMe1FjsvSkdP6j-Yg8_MUsqXoE9QPAzZczH_xoA67PY,15979
+pandas/tests/io/parser/test_quoting.py,sha256=7g4XLvgjtkRf9qgl7eksjwJ-N42e4dq-nCEPWP9hS9g,6244
+pandas/tests/io/parser/test_read_fwf.py,sha256=uYXrP1lpAQS-y7auRDgEYxEXTUk3mUUfJPccmdL4ZPg,29873
+pandas/tests/io/parser/test_skiprows.py,sha256=D0dm01x-53YqSXXvj1jczRV5SWEDNkNP87tquehyn9w,9457
+pandas/tests/io/parser/test_textreader.py,sha256=R_yeB-k6g45i6ZTQ-PdF8DIJYdodhH059OGrRdM8IOM,10672
+pandas/tests/io/parser/test_unsupported.py,sha256=149HYApTOEJP9xEXuXuncyS2zq_lpF_AyBfu_SIjjes,7986
+pandas/tests/io/parser/test_upcast.py,sha256=XEjHUvgExlKwxTCSjSfWMxjwge0HeW9q2BMIQGuxfTk,3141
+pandas/tests/io/parser/usecols/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/parser/usecols/test_parse_dates.py,sha256=7PYxerT3Eok6kVV6dfU2e-qlBpde-gfCGMg1NEht8cM,5469
+pandas/tests/io/parser/usecols/test_strings.py,sha256=-ZUBWSpxMgoxqRfGAa0mgb5motUoKveF06V9LUH-nQg,2588
+pandas/tests/io/parser/usecols/test_usecols_basic.py,sha256=BKr0EIu8g1aLiF6a_g61zF2NHPVY8Cl6CRcNnHLQ_4o,17646
+pandas/tests/io/pytables/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/pytables/common.py,sha256=m3IH26TCzLDpS8ctvzJKLA8x414ur5jlX3sdT4sB4m8,1264
+pandas/tests/io/pytables/conftest.py,sha256=vQgspEHypJUvbAU3P0I5BDBW2vRK4CgmcNqY5ZXksns,136
+pandas/tests/io/pytables/test_append.py,sha256=lT_tan65e42PSG7M7LVZvjx85iShUYCfYrBo0bIFEmQ,37420
+pandas/tests/io/pytables/test_categorical.py,sha256=TYTP10caIxfERCGETR5mYHxCim-BSLda6BbpJxL8b-4,6996
+pandas/tests/io/pytables/test_compat.py,sha256=qsaDgIDMQOOMA_ZYv7r9r9sBUUbA9Fe2jb2j8XAeY_s,2547
+pandas/tests/io/pytables/test_complex.py,sha256=CUEEEU3zJh6pmj-gws7ahyhsHJTxO0W9MKraXeFg89A,5948
+pandas/tests/io/pytables/test_errors.py,sha256=9d7ko8t8HCOBUfVD0vKO-xxOuzClCMSRjzDncrO8EU0,8549
+pandas/tests/io/pytables/test_file_handling.py,sha256=PKkJkwDY1FKumbziLxxNN_TeqjldQHxic54d1_h-V5k,15572
+pandas/tests/io/pytables/test_keys.py,sha256=m7SyZ2O_KPSCIl1yofM6QTOwQHneHymz8RgrDDa0IOQ,2673
+pandas/tests/io/pytables/test_put.py,sha256=SIDAxDDn1B1hPE9-TW92BzlB1SPhLSCu3e0G9l5CCmE,14053
+pandas/tests/io/pytables/test_pytables_missing.py,sha256=mK_l-tuF_TeoK4gZqRncm-FCe2PUgk2AS3q6q0M1YIU,345
+pandas/tests/io/pytables/test_read.py,sha256=RS9j9Dy_KOPZcp3Su6tqGxCSOfHLUKIGeyhYeDk5KiU,13520
+pandas/tests/io/pytables/test_retain_attributes.py,sha256=WY5rbnlT_NqERl4OSJ9C2iWLtFpZZCW57iNiF-UbZDM,2970
+pandas/tests/io/pytables/test_round_trip.py,sha256=IlqLWUdnD4c29oPEELeoKH7chMsl28XQtUh38k9qZzM,18936
+pandas/tests/io/pytables/test_select.py,sha256=gYDOGDi9srGKY7-d-8RvjVYV0A-5jpEkd9GtVNcSrhY,36832
+pandas/tests/io/pytables/test_store.py,sha256=Gbnlaee0d720CtnIxUm5togcE_qkYgru6ThLkPYF2lA,37523
+pandas/tests/io/pytables/test_subclass.py,sha256=fgiunpfa4hECpAXsZrq4nB1a1z5txJxEj9MqyOBI3fQ,1369
+pandas/tests/io/pytables/test_time_series.py,sha256=hduw-GMBvahyZHh6JVrLKrxvU3NR0vl0cWTWamlgZw4,2481
+pandas/tests/io/pytables/test_timezones.py,sha256=3wUurqaoR-UdgndFKyPxmluEzl4euTPBFDcL6nV2IqM,11804
+pandas/tests/io/sas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/sas/test_byteswap.py,sha256=fIqzF9LZs3TLm7JI4tEk4JxkynmWqZ5TydCmc12sGQs,1987
+pandas/tests/io/sas/test_sas.py,sha256=M9OeR39l3-DGJSBr84IVmnYMpMs_3xVfCgSSR8u7m-k,1057
+pandas/tests/io/sas/test_sas7bdat.py,sha256=Rrn8lpz3mzmrF-l5p4LhXKpMnUgX8d1X5OsTYHnh2vw,14942
+pandas/tests/io/sas/test_xport.py,sha256=-gNRR9_2QZS2dQ7Zu756Omg5Bpaz-2I5nCovqEqJVwU,5728
+pandas/tests/io/test_clipboard.py,sha256=0VmCX6RFBDGCuXanRJ5rWHf6T781edTLpgnKMTD_DtU,13092
+pandas/tests/io/test_common.py,sha256=9dOcCYYKca_znTLxp_s0fMYwJDavKdbRMD2-6Zvay38,23939
+pandas/tests/io/test_compression.py,sha256=P4xMmSJ5vv4A1xj6VnShtftj0-eDXv9_Lq67RveZQ2s,12259
+pandas/tests/io/test_feather.py,sha256=czpkrEup3qADg7PgKAC_9wegBlv55a-76gJMm0L4Z_A,10210
+pandas/tests/io/test_fsspec.py,sha256=6WW0sO9flDQSnSAiqQyAb-PgyccS2l1emacL9QnyGl8,10547
+pandas/tests/io/test_gbq.py,sha256=9tA62qL0uGbSKMZdxMwNjANpxaNB4buEdKfqAQej0HQ,401
+pandas/tests/io/test_gcs.py,sha256=xvRhJDVYU7jMrbpYGmzkLW4VoIugwgjLqOgBKnEFcSk,7334
+pandas/tests/io/test_html.py,sha256=2ldWTDWQO1w-QofitXU8PDNjghiCn9cSJSSDuDEM9WU,56525
+pandas/tests/io/test_http_headers.py,sha256=PvNDukQ37JbZj8jKispzfmJRkfnGdFxzprj0ckuaT-o,4885
+pandas/tests/io/test_orc.py,sha256=dBeiHQhMqEDphbtxEDVlrW2-CNJiRh-Bpk2KZk4-t0Q,14261
+pandas/tests/io/test_parquet.py,sha256=WCqkmQHpru8iz9_6SJ4Wgw3nMrxdCeqb7VbztS9Cj-8,53124
+pandas/tests/io/test_pickle.py,sha256=2I56KjtjujGOA3w7woPDNNcTDc7HuQZr0TMBApDbj6Q,20949
+pandas/tests/io/test_s3.py,sha256=vLi6EkvAGMKudRcbxcosxHV7z_q6GbknZuYdEisHjy4,1181
+pandas/tests/io/test_spss.py,sha256=9ITQlg0e6JZ7Kkg5S7HN-cvdt2o2_KYG7qZ9lrHckhk,6432
+pandas/tests/io/test_sql.py,sha256=5xLp3y79QHuG2d339XAd0qZvz6fd0rph2C6yBhgpD2Y,144483
+pandas/tests/io/test_stata.py,sha256=-_rvlVopGVooActyZuoQzl9cqVQko_XVoD92TGYX3zk,92899
+pandas/tests/io/xml/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/io/xml/conftest.py,sha256=ex3IgyE-7MBC_y5T2gJphlfUex7nqRG5VfX62mTbe5E,850
+pandas/tests/io/xml/test_to_xml.py,sha256=IxG7rT8KV0BghiUMvVMyd5GkbDR9xqWSmSDqT3CUAKM,35612
+pandas/tests/io/xml/test_xml.py,sha256=PjUkQVamI9Q4Cl7wRfBnyThppHURy01jJU1fINzPEKE,60641
+pandas/tests/io/xml/test_xml_dtypes.py,sha256=z8unMuhwvcrDUQ-7j4PBKBzr55QXNprA7qALGW7vYw0,13266
+pandas/tests/libs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/libs/test_hashtable.py,sha256=4rXFphd6C9bf5AVIqOohTwsJ7mA14SZmq3hcWtC7m-w,26091
+pandas/tests/libs/test_join.py,sha256=z5JeLRMmF_vu4wwOpi3cG6k-p6lkhjAKPad6ShMqS30,10811
+pandas/tests/libs/test_lib.py,sha256=ToabC3h3DJGZ1xoTjwHy9P752nrdSovxlJsGMyEqjVg,11066
+pandas/tests/libs/test_libalgos.py,sha256=saDyCbchGU690HmrfZUJ6q1iCLNeW4x50Y-A2o1fgrg,5322
+pandas/tests/plotting/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/plotting/common.py,sha256=6oADaI21vWLSPgHVqckoLiPFWsrGXw71fel7HHxJyZc,16871
+pandas/tests/plotting/conftest.py,sha256=WGxjahxQkw-Gk4DlnLW0rDsei0dmuoCuZusNMepwty0,1531
+pandas/tests/plotting/frame/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/plotting/frame/test_frame.py,sha256=BcGzSi6p1RSFhJeudyFanYfKYjvvuS7eKSolRO3afCg,99390
+pandas/tests/plotting/frame/test_frame_color.py,sha256=gBkX_6DMH-joE-4GjwZpIYgWHJkrWPPDJ8R9gKuHqH8,28488
+pandas/tests/plotting/frame/test_frame_groupby.py,sha256=JNd4J9E4BEtcU5ed47_SZK5p77P6vthENn_shRPbAJQ,2547
+pandas/tests/plotting/frame/test_frame_legend.py,sha256=10NvOjyNdV703r-9mLhYXIxeyZJFq_-24N9XNkNReJw,10443
+pandas/tests/plotting/frame/test_frame_subplots.py,sha256=kRVFvweJSAwzh9gNIzoifuy6_U2d9mZ-K7zXR_K5otw,28986
+pandas/tests/plotting/frame/test_hist_box_by.py,sha256=8jqVQfLrE5AKvn7iKMX7L5Gbe7e4rv6Ic8MnNp7NALI,10969
+pandas/tests/plotting/test_backend.py,sha256=rE7SNyeJiSUOWwkvxndq3qtpUEOYkUetCwdO_ey-eWM,3382
+pandas/tests/plotting/test_boxplot_method.py,sha256=fxvMv2V5JHPQg1uJZFNXCsMJwnUOufLEkOZK8XboR58,30159
+pandas/tests/plotting/test_common.py,sha256=if9WnxryRdUhub-3yjdTEKO2PME-Yhf5YIG8e2nvAXU,1869
+pandas/tests/plotting/test_converter.py,sha256=pC3IZ6pfKITbmzTZBwoPwG1abGtPT6Sp1YLMuKLDKG8,13251
+pandas/tests/plotting/test_datetimelike.py,sha256=Jvsqdvr_SKrdzgRYwoTlNJeS_NWMSTD183sQF-lQMAs,66544
+pandas/tests/plotting/test_groupby.py,sha256=mcM2bOmfvJteLz9H0qMawxN3Yef-Nj2zCa_MUUBWF_c,5735
+pandas/tests/plotting/test_hist_method.py,sha256=2Rkk6DlGz9I4rXDjs6qBrZiRvUNWiBDCIKk44m0mrxw,34972
+pandas/tests/plotting/test_misc.py,sha256=_IoHRNT_OSGTyFfIu5giv5BnaUFWENQH36VKN8q32tI,25201
+pandas/tests/plotting/test_series.py,sha256=73VoBpLMLjKHwIaZKM50rGpOSx1kBsCxlxxNSsPwh8k,35318
+pandas/tests/plotting/test_style.py,sha256=3YMcq45IgmIomuihBowBT-lyJfpJR_Q8fbMOEQXUkao,5172
+pandas/tests/reductions/__init__.py,sha256=vflo8yMcocx2X1Rdw9vt8NpiZ4ZFq9xZRC3PW6Gp-Cs,125
+pandas/tests/reductions/test_reductions.py,sha256=ALTUdj4Dw0eyrU2tTHr8qaeHqNfLeqEB7lsef-HjKBE,59096
+pandas/tests/reductions/test_stat_reductions.py,sha256=Q-sfitViCm3-oQQVHWDwjKKia1ZuUX6079cGmv3i3oU,9722
+pandas/tests/resample/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/resample/conftest.py,sha256=XXj72zj-3AH2jPBUacVV6GSpY9Y4in_38g8cSf8UfYg,3355
+pandas/tests/resample/test_base.py,sha256=mwXajXoSmMP-YWxg5NxunxrPb19Wi71EdzRXDki66YI,16218
+pandas/tests/resample/test_datetime_index.py,sha256=uUeT4pIrphyz6xvQWULicaE5-to7AMsKecWnWzQR0tY,74471
+pandas/tests/resample/test_period_index.py,sha256=zlaCtN0II7xAg9-sHDo6HdMNJhrmhCLVbSWe4QPZkR8,43093
+pandas/tests/resample/test_resample_api.py,sha256=dQxrmryu6D4qHKyqflxYjofEooz6xXB9rjntuQgIe4Q,34616
+pandas/tests/resample/test_resampler_grouper.py,sha256=iZunzxnP3qB8t7jcCcmOYBB20ciH_fVp7rY5t4ADUaE,23938
+pandas/tests/resample/test_time_grouper.py,sha256=T8O-K63k5XzECD-6tBDsqkzCnVb-cR_X0d_HKZPDOus,11832
+pandas/tests/resample/test_timedelta.py,sha256=H_ZjEJhXN6fhWbpwEwuPsxFDWQermDwUvsM7oaE2pG0,7469
+pandas/tests/reshape/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/reshape/concat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/reshape/concat/conftest.py,sha256=s94n_rOGHsQKdP2KbCAQEfZeQpesYmhH_d-RNNTkvYc,162
+pandas/tests/reshape/concat/test_append.py,sha256=mCBndbLvwmM8qTbwH7HoyZjFGLQWOsOMGjn1I1Mz8PA,14299
+pandas/tests/reshape/concat/test_append_common.py,sha256=Z2hBl4TyKpIJ-staPnWVmAbRMv9Wg0tQK_W8YpcIMXQ,27866
+pandas/tests/reshape/concat/test_categorical.py,sha256=TGmBQ_2bzyuDrijDJcCqOgCcIVKujynMAKNG9MYXPhQ,9491
+pandas/tests/reshape/concat/test_concat.py,sha256=wRvTAqUMfzv4fLatEDNk7W8oqvxt5MnDpwbipg5HHM4,32672
+pandas/tests/reshape/concat/test_dataframe.py,sha256=-vObBDtkJ7N_eeIFgjpOVVrMJf_bB9KKknHZg1DbG7k,8864
+pandas/tests/reshape/concat/test_datetimes.py,sha256=dZc65JXlR1l5ulBaQrVzkLv0z8LgwXBlrBFxOxRSBZk,21584
+pandas/tests/reshape/concat/test_empty.py,sha256=UVrgKBTL16wdXjJI5znbOdd2yVEJ5hdxGVOxoH3oMgA,10385
+pandas/tests/reshape/concat/test_index.py,sha256=B3cn9vzq8oumFE_M91KcyLnTb7ok4jiflzZHUJABthE,17395
+pandas/tests/reshape/concat/test_invalid.py,sha256=E7InfrzodepcICRP_zFyg11CMs-2SmNrxFY3f8bhqjA,1608
+pandas/tests/reshape/concat/test_series.py,sha256=af0lLNaUEvGml86Ziy-VLJt-wQ-rwQZuQoFROulm9Z8,6061
+pandas/tests/reshape/concat/test_sort.py,sha256=RuXIJduLa56IJDmUQaCwyYOz_U0KXMDWf04WEzi8y7E,4350
+pandas/tests/reshape/merge/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/reshape/merge/test_join.py,sha256=Fm_AUg0C7RPddejw-ZpOpKHE3ggutyXvJg-CdbjmcXs,37848
+pandas/tests/reshape/merge/test_merge.py,sha256=NSGEt75NmyckInB0WeTyGFeMNdsfMIctosaquPGJtYM,106187
+pandas/tests/reshape/merge/test_merge_asof.py,sha256=_4S4geWz_OqvhrR_2zcL7cGtkLpPDuanFR6vMJAIL-A,121465
+pandas/tests/reshape/merge/test_merge_cross.py,sha256=9BVH6HWJRh-dHKDTBy8Q2it97gjVW79FgPC99HNLIc4,3146
+pandas/tests/reshape/merge/test_merge_index_as_string.py,sha256=w_9BccpqfB7yPhy_TBlMGx2BPOBwPhfg-pYRKA4HEC8,5357
+pandas/tests/reshape/merge/test_merge_ordered.py,sha256=Y4GLA6hxUoUdo6XhJ5inFBf867JJ8XqiaMi7GY4tsNY,7731
+pandas/tests/reshape/merge/test_multi.py,sha256=kV5tUCNAljJ78IPNrhaeDX9AyKtN2KdF8ZpNMTeDyzY,31130
+pandas/tests/reshape/test_crosstab.py,sha256=fJTqrjVg45YUp8aPCcpgRzrNEoXibZIAz8Tmz2cTM7k,32578
+pandas/tests/reshape/test_cut.py,sha256=Gy0V1j0oxa_6fdlc5VxTzrqPDQMmlKIR6UbSrTYJXlg,24641
+pandas/tests/reshape/test_from_dummies.py,sha256=FDxrh7plJqD4XQO0-qX5Y9K_359Ld7EiwjLTYrOa5lo,13343
+pandas/tests/reshape/test_get_dummies.py,sha256=p52Tdo8-IokYJrogSz-ArG0phyBPQaf-ELS3dnpzPTs,27605
+pandas/tests/reshape/test_melt.py,sha256=oF90mvWtuli9SIZ4d1IVQu7kA4h2F4UHLPUykrvOISk,42675
+pandas/tests/reshape/test_pivot.py,sha256=3BkrRLVGpiBUXvbBRWxEpYCWWAvRcn54Ft70RAWKcRM,93813
+pandas/tests/reshape/test_pivot_multilevel.py,sha256=DYp3BZ0h80UEgqFs0sNVqnUWBWgYU4622wp62SdCDdI,7549
+pandas/tests/reshape/test_qcut.py,sha256=0XO-B9XmAGiWLhEFW8wujFo-VR1r62SZP7MT-DBz1VE,8477
+pandas/tests/reshape/test_union_categoricals.py,sha256=UvadOpYUCmkJ-cGmATHVBmVu8LajVsWjMlyS4rAI9hk,15301
+pandas/tests/reshape/test_util.py,sha256=mk60VTWL9YPWNPAmVBHwkOAOtrHIDU6L3EAnlasx6IQ,2897
+pandas/tests/scalar/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/scalar/interval/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/scalar/interval/test_arithmetic.py,sha256=qrUOEDp9dOkOoEfuuUHhmzKTZuPbj727p2PxO1kgxxM,5937
+pandas/tests/scalar/interval/test_constructors.py,sha256=DI5iRKoIg51lI_-FysKQyyaJnwrd8CqLjk7b7iqFIp0,1599
+pandas/tests/scalar/interval/test_contains.py,sha256=MSjo5U7KLuqugnEtURC8znpldI3-cLIfXQlIhNvQLI4,2354
+pandas/tests/scalar/interval/test_formats.py,sha256=Ep7692gGQMdrYiCxxudqXX-CA6S1sO3L2P2I4NHIreo,344
+pandas/tests/scalar/interval/test_interval.py,sha256=W54SKFbFSlsvFwoXkNhb6JK52klz8is2ww2ZQ7AIjUs,2656
+pandas/tests/scalar/interval/test_overlaps.py,sha256=2FHG23scoclsfZZAngK9sesna_3xgbjgSKoUzlMxHro,2274
+pandas/tests/scalar/period/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/scalar/period/test_arithmetic.py,sha256=YYt1270I1WxtnQqGck_49ECYtrpw__lX8qx8t-GuIZM,16775
+pandas/tests/scalar/period/test_asfreq.py,sha256=dbmg35zwFwPSiYR-5OuSA790slBEct8N6C1jkEXchBs,38445
+pandas/tests/scalar/period/test_period.py,sha256=zjHRVTyPeR7y2SgMn1UsUM1M37EfT1kypoPuqjxsFGI,40121
+pandas/tests/scalar/test_na_scalar.py,sha256=0t4r9nDTQtXUSeXRBxDfgWegznLM6TvMk2pK0gLScJc,7227
+pandas/tests/scalar/test_nat.py,sha256=pUhNNUxLBv4_D-l2tsHICFiT5ruDjvlj24oEkNZycxk,19972
+pandas/tests/scalar/timedelta/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/scalar/timedelta/methods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/scalar/timedelta/methods/test_as_unit.py,sha256=Ut-_d5xcdAq9eD5_dknpSsnhjndzRyilGuT7PxOYl5s,2518
+pandas/tests/scalar/timedelta/methods/test_round.py,sha256=kAqNhW8GJMKvaACF1b6eKhO9DOvYUJuRrMyoxG2-nHM,6338
+pandas/tests/scalar/timedelta/test_arithmetic.py,sha256=mYTdK4okwMitWPPh335LY3wzy5hXncEXPnxLd1XrDXA,38156
+pandas/tests/scalar/timedelta/test_constructors.py,sha256=49f8ARiuEAbImuDasW9-NowtijVRPyoY6ARtX6iuNnM,22433
+pandas/tests/scalar/timedelta/test_formats.py,sha256=_5svunXjM1H4X5tMqgT7aO9CoDR96XgybUYHXNdcyDo,4161
+pandas/tests/scalar/timedelta/test_timedelta.py,sha256=VAEnw5O0egqtlazzAy6oJkgFGHCKDXp3NwRyBEQ19as,23413
+pandas/tests/scalar/timestamp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/scalar/timestamp/methods/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/scalar/timestamp/methods/test_as_unit.py,sha256=Od0YhrglrVPaad4kzpjPKoVf-pBz0_lTbdaj7cpD7eU,2706
+pandas/tests/scalar/timestamp/methods/test_normalize.py,sha256=NMQXgPRwSB8Z8YtQLrU4qNbxhaq1InqKqwS8veJ_Cts,831
+pandas/tests/scalar/timestamp/methods/test_replace.py,sha256=JT-qoGosdZa0tgjg2AtKrniJnT6-o1YIXQrq-pFDL5E,7055
+pandas/tests/scalar/timestamp/methods/test_round.py,sha256=mA1FyUI8-J14yZ1Vf5Se0OeW2u4nv9-1s0r9eOmOxnE,13027
+pandas/tests/scalar/timestamp/methods/test_timestamp_method.py,sha256=JlFBfEixuZiw96lRZc88wXR9-5uOt74gBCUql321H6w,1017
+pandas/tests/scalar/timestamp/methods/test_to_julian_date.py,sha256=izPqS1f7lJ3Tqkiz65t3NjZqtgxu1_jbSg-LmZheiD4,810
+pandas/tests/scalar/timestamp/methods/test_to_pydatetime.py,sha256=duSR43OjYJiMOHjt7lLVrSdBZa74GQRqwJz5RPdbQ5M,2871
+pandas/tests/scalar/timestamp/methods/test_tz_convert.py,sha256=yw1GiCOn7F8ZDof9d7IvG6T28e6nsB-_XswfO0HN-Dc,1710
+pandas/tests/scalar/timestamp/methods/test_tz_localize.py,sha256=drtq_N4h6E-25vsQuJJO4Sc5dUXyCwIWTHM0ozIc8gI,12774
+pandas/tests/scalar/timestamp/test_arithmetic.py,sha256=4exZrHW0m6i4mCzKVFhehECC232IJYyc3IW1f-YzPbM,10852
+pandas/tests/scalar/timestamp/test_comparisons.py,sha256=zxzSqDtYxP7Fc4vXcIqxYq0Yg7KeKEdAn3iwbgAv-ns,10059
+pandas/tests/scalar/timestamp/test_constructors.py,sha256=qC0ZLNT77BDnBQ1atxBN20AG06mi10ur8-4BP9zEKDg,39486
+pandas/tests/scalar/timestamp/test_formats.py,sha256=TKn4H02mIrLpoWm4YuDsA3gUy87bYVqNLu8SgnckZA0,6864
+pandas/tests/scalar/timestamp/test_timestamp.py,sha256=c0ZhIgkRq9JfpohnixtM-n2frtyF2fR2pnUFjFER8fY,31042
+pandas/tests/scalar/timestamp/test_timezones.py,sha256=dXCPtLiGfQ9B2pg_s_YK7fvWwUW-CbVOPYUn9paFosk,666
+pandas/tests/series/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/series/accessors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/series/accessors/test_cat_accessor.py,sha256=1-ZRI4h_lsBclkXljCrYFwGIYXbhrpE1iET-MjNKngk,9611
+pandas/tests/series/accessors/test_dt_accessor.py,sha256=FONy17Hl7ZWxgYSB-fTrL6bLfY3Fp3mZmwezLuJd89w,29877
+pandas/tests/series/accessors/test_list_accessor.py,sha256=7OsgwSCkXFDSRh81g5WKniPsv_zcTosuGicGPSemBqo,3425
+pandas/tests/series/accessors/test_sparse_accessor.py,sha256=yPxK1Re7RDPLi5v2r9etrgsUfSL9NN45CAvuR3tYVwA,296
+pandas/tests/series/accessors/test_str_accessor.py,sha256=M29X62c2ekvH1FTv56yye2TLcXyYUCM5AegAQVWLFc8,853
+pandas/tests/series/accessors/test_struct_accessor.py,sha256=Yg_Z1GjJf92XaXOnT0aUaeEtp7AOcQqWPT4guJKGfEg,5443
+pandas/tests/series/indexing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/series/indexing/test_datetime.py,sha256=1_yUGMkSFYGh7TJOeDN_-5FvqsVyV-rGdgBzOnyqqNk,14752
+pandas/tests/series/indexing/test_delitem.py,sha256=IVd1S6LV2DIELVikf8uw30lNFuFNRIfe1Mg3MbCIyYc,1969
+pandas/tests/series/indexing/test_get.py,sha256=-FooS4ocg7uqbXYDNEZwMvRpTCar5LJCgCqi_CpDoo0,5758
+pandas/tests/series/indexing/test_getitem.py,sha256=2ABFEn1IsIFvV3tBqdlDu8D0cpXY4Ilbyo1QgDzr3pk,24390
+pandas/tests/series/indexing/test_indexing.py,sha256=YacR0p1IxGVwu70s-MEAAEoHMo_rVAj2Dy294wx4zL8,16816
+pandas/tests/series/indexing/test_mask.py,sha256=ecPdJ-CM8HbaaZoGUfwcoOuo0eIz7aEq-x8wL0PZWbE,1711
+pandas/tests/series/indexing/test_set_value.py,sha256=UwVNpW3Fh3PKhNiFzZiVK07W871CmFM2fGtC6CTW5z0,991
+pandas/tests/series/indexing/test_setitem.py,sha256=MME-RirkwcjxHa-pnJXSmEh6q5PCN2agqQEcHgSCysM,59864
+pandas/tests/series/indexing/test_take.py,sha256=574cgL0w0fj-YnZma9b188Y0mTWs-Go6ZzB9zQSdpAk,1353
+pandas/tests/series/indexing/test_where.py,sha256=30D5XOV1OpmSUgdUpps4L91YdlWxXoN_9lzZtbDy4ac,13398
+pandas/tests/series/indexing/test_xs.py,sha256=8EKGIgnK86_hsBjPIY5lednYnzatv14O6rq3LjR_KxI,2760
+pandas/tests/series/methods/__init__.py,sha256=zVXqGxDIQ-ebxxcetI9KcJ9ZEHeIC4086CoDvyc8CNM,225
+pandas/tests/series/methods/test_add_prefix_suffix.py,sha256=PeUIeDHa9rGggraEbVJRtLi2GcnNcXkrXb0otlthOC4,1556
+pandas/tests/series/methods/test_align.py,sha256=5No9fM2t4kaftnqVPm030TNWTwDhqnOVcAdGmPPGaio,8290
+pandas/tests/series/methods/test_argsort.py,sha256=GSvtMvfeUktQkrOsl-bF4di5w8QPCo9GPza1OmeofeM,2871
+pandas/tests/series/methods/test_asof.py,sha256=CqRdyeXFhE7zVdkJB-TxVqK3XPyBNvtOAfb6_a0VGgM,6324
+pandas/tests/series/methods/test_astype.py,sha256=-s-DqP7zgYlEKs2aandCmXUfftowGadYkP3wPp_XxG4,25745
+pandas/tests/series/methods/test_autocorr.py,sha256=SnxELB9bcE8H68tYUDN3UKMMPu-sEfbwTlLUn8WirV8,1015
+pandas/tests/series/methods/test_between.py,sha256=9w_8uWI5kcJOTfMwbEwmjGpU2j2cyuMtCYw4MrvgSM0,2584
+pandas/tests/series/methods/test_case_when.py,sha256=0YC-SaigIaoSO2l7h9sO4ebzCrxq0ma5FtiZKiwDMRs,4223
+pandas/tests/series/methods/test_clip.py,sha256=PuUarzkVXrwdYBF6pKqKbRw_GUuXdYsSPoNomgSDyzc,5220
+pandas/tests/series/methods/test_combine.py,sha256=ye8pwpjolpG_kUKSFTC8ZoRdj3ze8qtJXvDUZ5gpap4,627
+pandas/tests/series/methods/test_combine_first.py,sha256=n4Qc7xPR-qWXudzPpWnTX5S2Ov2kPaf0jnF9fngoXOA,5479
+pandas/tests/series/methods/test_compare.py,sha256=uRA4CKyOTPSzW3sihILLvxpxdSD1hb7mHrSydGFV2J4,4658
+pandas/tests/series/methods/test_convert_dtypes.py,sha256=fbzEQstPFv3J2lmJWssbJINuNXXXZzIVtccbHbAexcc,9915
+pandas/tests/series/methods/test_copy.py,sha256=im14SuY4pXfqYHvd4UamQSSTiXsK8GOP7Ga-5w-XRFs,3164
+pandas/tests/series/methods/test_count.py,sha256=mju3vjyHXg8qRH85cRLWvRL8lFnF7HGdETjt2e_pK7M,938
+pandas/tests/series/methods/test_cov_corr.py,sha256=NfmwlBV_Umm50xTwfuhJhKtNPmrUVEaJOt9GWTsb3DQ,5709
+pandas/tests/series/methods/test_describe.py,sha256=brDSZ2qicnLANI2ReYiYQiXzu6m9VxFr4DVULEyGgSA,6646
+pandas/tests/series/methods/test_diff.py,sha256=vEBvVglFS1cSDpllOLEZ9Dkdv1E02IYP9y6s6nsL6es,2538
+pandas/tests/series/methods/test_drop.py,sha256=nqTXYfvY76BZ2cl46kUb8mkkll5StdCzBaTn_YkGfIk,3394
+pandas/tests/series/methods/test_drop_duplicates.py,sha256=P6jHz77EAtuiI2IE25pNjBx3pXteUc0JUMoj2mWo8T4,9235
+pandas/tests/series/methods/test_dropna.py,sha256=fezc4siTNn-uOEQtOhaqNAOLYBoWN3Rh6STHAtOdk8U,3577
+pandas/tests/series/methods/test_dtypes.py,sha256=IkYkFl0o2LQ5qurobwoPgp4jqi2uKU7phoAk3oZtiYo,209
+pandas/tests/series/methods/test_duplicated.py,sha256=ACzVs9IJY4lC2SQb6frHVe4dGd6YLFID5UAw4BuZa7c,2059
+pandas/tests/series/methods/test_equals.py,sha256=qo8h305o5ktv9ooQ7pMbMUnQFjzOGLWc5TwxL9wD5zg,4182
+pandas/tests/series/methods/test_explode.py,sha256=FFXACDZNqbwR4qkee2osU7N_WeJOeHm5GWX6tXZIQZs,5329
+pandas/tests/series/methods/test_fillna.py,sha256=tjuKAfrmByzwY1H_xez3xSwKkZUDac1aSt47ZHP7llI,39985
+pandas/tests/series/methods/test_get_numeric_data.py,sha256=UPWNlzpl2a9Zez1JSfFP2EwsYfs4U4_Re4yOkqGpsl8,1178
+pandas/tests/series/methods/test_head_tail.py,sha256=1EWojjTzcLvYH34VvyvEHxczDy7zL3dMTyayFHsVSzY,343
+pandas/tests/series/methods/test_infer_objects.py,sha256=w0UyAVk4bHlCBX8Ot8BiV6Y0flw-70XiENsh0jsgyhg,1903
+pandas/tests/series/methods/test_info.py,sha256=zHHlqQFUJinvEJDVAElYdo6Q49XC5MQTggiuuLQyrkw,5205
+pandas/tests/series/methods/test_interpolate.py,sha256=Y0pZXAceQWfdEylQi0Q78g3LLSvwv9qTr0ur9z-SED8,34267
+pandas/tests/series/methods/test_is_monotonic.py,sha256=vvyWZFxiSybq88peF0zN5dM16rH2SgCEEA-gT2rRSSY,838
+pandas/tests/series/methods/test_is_unique.py,sha256=d3aLS5q491IVZkfKx8HTc4jkgTtuN0SOaUVfkyBTImE,953
+pandas/tests/series/methods/test_isin.py,sha256=iOwKDqYVh8mFnkwcdc9oRiJVlxfDF87AwL2i7kBugqQ,8343
+pandas/tests/series/methods/test_isna.py,sha256=TzNID2_dMG6ChWSwOMIqlF9AWcc1UjtjCHLNmT0vlBE,940
+pandas/tests/series/methods/test_item.py,sha256=z9gMBXHmc-Xhpyad9O0fT2RySMhlTa6MSrz2jPSUHxc,1627
+pandas/tests/series/methods/test_map.py,sha256=TQfCY97aXxLLrrw5IogRHmtWFGk4vadDa-ZnqGuurZo,18550
+pandas/tests/series/methods/test_matmul.py,sha256=cIj2nJctMnOvEDgTefpB3jypWJ6-RHasqtxywrxXw0g,2767
+pandas/tests/series/methods/test_nlargest.py,sha256=oIkyZ6Z2NiUL09sSTvAFK7IlcfQDiVgwssFe6NtsyIE,8442
+pandas/tests/series/methods/test_nunique.py,sha256=6B7fs9niuN2QYyxjVNX33WLBJvF2SJZRCn6SInTIz0g,481
+pandas/tests/series/methods/test_pct_change.py,sha256=C_WTtvjTsvfT94CUt22jYodJCHd18nUrkCLorQPf_d8,4523
+pandas/tests/series/methods/test_pop.py,sha256=xr9ZuFCI7O2gTW8a3WBr-ooQcOhBzoUK4N1x0K5G380,295
+pandas/tests/series/methods/test_quantile.py,sha256=DrjNLdKWpR-Sy8htHn2roHNI4roGKtR-ziZ77mPBVo8,8284
+pandas/tests/series/methods/test_rank.py,sha256=7t3MDhD_weTZ8542gybDB_zH3nPED5gVSnwl_Rko-pc,19937
+pandas/tests/series/methods/test_reindex.py,sha256=3Qi_Lk4WyHpWYMnOjGpky7bEyrfytigtQKm64uZ07CE,14417
+pandas/tests/series/methods/test_reindex_like.py,sha256=e_nuGo4QLgsdpnZrC49xDVfcz_prTGAOXGyjEEbkKM4,1245
+pandas/tests/series/methods/test_rename.py,sha256=tpljCho07Y03tq8lgy_cxGVPoF6G14vJvBv34cH1e0g,6303
+pandas/tests/series/methods/test_rename_axis.py,sha256=TqGeZdhB3Ektvj48JfbX2Jr_qsCovtoWimpfX_ViJyg,1520
+pandas/tests/series/methods/test_repeat.py,sha256=WvER_QkoVNYU4bg5hQbLdCXIWxqVnSmJ6K3_3OLLLAI,1274
+pandas/tests/series/methods/test_replace.py,sha256=u-tlzMWZA78iVcTYkZWy84TXSNWcAiOnAQc7x9Nbd4M,32057
+pandas/tests/series/methods/test_reset_index.py,sha256=4VUB-OdAnMtEAyfOze1Pj71R030J5H7A8vc9rI2vhsk,7845
+pandas/tests/series/methods/test_round.py,sha256=1-6IboBKwz7QCZHgo-nbgrYAB0orCMA2dNraHDiAlPs,2888
+pandas/tests/series/methods/test_searchsorted.py,sha256=2nk-hXPbFjgZfKm4bO_TiKm2xjd4hj0L9hiqR4nZ2Ss,2493
+pandas/tests/series/methods/test_set_name.py,sha256=rt1BK8BnWMd8D8vrO7yQNN4o-Fnapq5bRmlHyrYpxk4,595
+pandas/tests/series/methods/test_size.py,sha256=3-LfpWtTLM_dPAHFG_mmCxAk3dJY9WIe13czw1d9Fn4,566
+pandas/tests/series/methods/test_sort_index.py,sha256=XIiu2aL5NayZoQDsBRdBbx6po5_pW4pq4us2utrSY2c,12634
+pandas/tests/series/methods/test_sort_values.py,sha256=jIvHYYMz-RySUtJnB9aFLR88s-M20-B5E5PwK9VQhns,9372
+pandas/tests/series/methods/test_to_csv.py,sha256=1kQxhBUR6jb4_KqAQHaf29ztVqOGaSgHGT28gwH-Ksg,6346
+pandas/tests/series/methods/test_to_dict.py,sha256=XGdcF1jD4R0a_vWAQXwal3IVJoNwEANa1tU7qHtpIGA,1178
+pandas/tests/series/methods/test_to_frame.py,sha256=nUkHQTpMTffkpDR7w3EcQvQAevEfflD6tHm3pTBxpTI,1992
+pandas/tests/series/methods/test_to_numpy.py,sha256=pEB2B08IdIPRYp5n7USYFX9HQbClJl4xOegjVd7mYLc,1321
+pandas/tests/series/methods/test_tolist.py,sha256=5F0VAYJTPDUTlqb5zDNEec-BeBY25ZjnjqYHFQq5GPU,1115
+pandas/tests/series/methods/test_truncate.py,sha256=suMKI1jMEVVSd_b5rlLM2iqsQ08c8a9CbN8mbNKdNEU,2307
+pandas/tests/series/methods/test_tz_localize.py,sha256=chP4Dnhzfg5zphKiHwZpN-43o_p6jf0wqgid3a-ZB-Y,4336
+pandas/tests/series/methods/test_unique.py,sha256=MQB5s4KVopor1V1CgvF6lZNUSX6ZcOS2_H5JRYf7emU,2219
+pandas/tests/series/methods/test_unstack.py,sha256=ATn0kTNCEa2eAhGTFkMXPfDLl29Ee5cQvAPd3EcdQWY,5102
+pandas/tests/series/methods/test_update.py,sha256=deGclG13lOOd_xEkKYEfFUDge0Iiudp9MJwuv7Yis-M,5339
+pandas/tests/series/methods/test_value_counts.py,sha256=LNmYx4OpzjjbLsjYHOrd4vxJZjKm9pEntq63I3mWttc,10109
+pandas/tests/series/methods/test_values.py,sha256=Q2jACWauws0GxIc_QzxbAOgMrJR6Qs7oyx_6LK7zVt8,747
+pandas/tests/series/methods/test_view.py,sha256=JipUTX6cC-NU4nVaDsyklmpRvfvf_HvUQE_fgYFqxPU,1851
+pandas/tests/series/test_api.py,sha256=1MYheb8We7ah2C-rDcSZJjS4rKqZdi_IEdM8GeyQnF4,10301
+pandas/tests/series/test_arithmetic.py,sha256=5JIztNGFA9nfAXccmhJGkpqpoZEGOpBQRKquOtcNH5A,33281
+pandas/tests/series/test_constructors.py,sha256=7DVF042GP9dET-JjJZoY64BgM0tAvym_DdaLrwP51j8,85825
+pandas/tests/series/test_cumulative.py,sha256=BdSWkvuS_fG-XA6gT7nfrRWRp0Ucq722Bs693_s4e0k,7949
+pandas/tests/series/test_formats.py,sha256=Zov7Mko_C7VGtKbcMVDWusE2MrFKQ8wCx8QaDBmSMzw,17078
+pandas/tests/series/test_iteration.py,sha256=LKCUh0-OueVvxOr7uEG8U9cQxrAk7X-WDwfgEIKUekI,1408
+pandas/tests/series/test_logical_ops.py,sha256=oCxV6DbXARdLc8N-6W66YK-prtDCmzo-SYJg5EJdyBc,20938
+pandas/tests/series/test_missing.py,sha256=6TtIBFZgw-vrOYqRzSxhYCIBngoVX8r8-sT5jFgkWKM,3277
+pandas/tests/series/test_npfuncs.py,sha256=BxhxkI2uWC-ygB3DJK_-FX2TOxcuqDUHX4tRQqD9CfU,1093
+pandas/tests/series/test_reductions.py,sha256=HdmQ4H-gycB2Nz6HjyemDLwZjsI8PLIoauje3snur9g,6518
+pandas/tests/series/test_subclass.py,sha256=aL5tgGGXZPPIXWIgpCPBrc7Q5KS8h1ipZNKCwciw-jY,2667
+pandas/tests/series/test_ufunc.py,sha256=uo0FJLsk2WFgOIMfKBlsuySEKzwkGYtcTPCRPmJt2qY,14758
+pandas/tests/series/test_unary.py,sha256=Xktw6w940LXm38OKLW-LRqpMZSA9EB5feCt9FMLh-E4,1620
+pandas/tests/series/test_validate.py,sha256=ziCmKi_jYuGyxcnsVaJpVgwSCjBgpHDJ0dbzWLa1-kA,668
+pandas/tests/strings/__init__.py,sha256=bXy3OI--skxWsx5XSeisvRlIrXiyNmNvUZPzTSa-82s,587
+pandas/tests/strings/conftest.py,sha256=M-9nIdAAynMJ7FvFFTHXJEUZFT8uOTbizf5ZOnOJ-Tk,3960
+pandas/tests/strings/test_api.py,sha256=_zxkxArja09rqqFoxITZ8Dy7NFOGxhlBDh0oba8UnR0,6609
+pandas/tests/strings/test_case_justify.py,sha256=X_Wap9pwqH-XUXi3xSOVfAIk033c1KcHFx9ksYWJrxg,13361
+pandas/tests/strings/test_cat.py,sha256=zCJBBRtmaOxMGwXeS4evfDtAVccO3EmloEUn-dMi0ho,13575
+pandas/tests/strings/test_extract.py,sha256=LuGkboI2Q6d60kQgwMDudy-5eEbixaaCGP78CwHli6c,26463
+pandas/tests/strings/test_find_replace.py,sha256=_BFV7Ol7AHk5zW5cAApkOKSZzTsoXWY84cW8xy6JabE,37896
+pandas/tests/strings/test_get_dummies.py,sha256=LyWHwMrb5pgX69t4b9ouHflXKp4gBXadTCkaZSk_HB4,1608
+pandas/tests/strings/test_split_partition.py,sha256=r3i4HITEpxEM0ZLMBkz6DeJpy5tZM5o0yaYpeyD9K2A,23250
+pandas/tests/strings/test_string_array.py,sha256=yGTtAjj0U8ovvhhiuJ6HS9yLE_fBZIw-7rA9qtDeWLo,3514
+pandas/tests/strings/test_strings.py,sha256=sb32NUWKwY9dwUhuGn0lLLwgnfa83g4FpzUZnY5v5K4,27324
+pandas/tests/test_aggregation.py,sha256=-9GlIUg7qPr3Ppj_TNbBF85oKjSIMAv056hfcYZvhWw,2779
+pandas/tests/test_algos.py,sha256=63SRKWH30MEGmSh22zsdLQ_ROE-NknsdmKXP7dgUGPg,78613
+pandas/tests/test_common.py,sha256=SHkM8XyjSNxUJquSiEDa3lqE0GJ7tLsfwdro0x2leAg,7695
+pandas/tests/test_downstream.py,sha256=U-x1_RsBX0sSHNU_M3fyGcM6nLIq0BwJL1py2cU_M7Y,10856
+pandas/tests/test_errors.py,sha256=4WVxQSyv6okTRVQC9LC9thX5ZjXVMrX-3l93bEd9KZ8,2789
+pandas/tests/test_expressions.py,sha256=fyTafylKNf7Wb3qzwlvIGbM4MdlJB7V4yGJrgiMRE5w,14256
+pandas/tests/test_flags.py,sha256=Dsu6pvQ5A6Manyt1VlQLK8pRpZtr-S2T3ubJvRQaRlA,1550
+pandas/tests/test_multilevel.py,sha256=3-Gmz-7nEzWFDYT5k_nzRL17xLCj2ZF3q69dzHO5sL8,12206
+pandas/tests/test_nanops.py,sha256=NWzcF6_g_IT0HQRG9ETV3kimAAKVmoFohuGymqsDLPI,42042
+pandas/tests/test_optional_dependency.py,sha256=wnDdNm9tlr2MFSOwB9EWAPUf1_H3L0GUTbGeZyGUqL8,3159
+pandas/tests/test_register_accessor.py,sha256=L2cU-H7UU1M36_7DU7p69SvGEFWZXpMpUJ8NZS2yOTI,2671
+pandas/tests/test_sorting.py,sha256=0rqJWWFq1kVX8m-W0X7dXdl9XoaYxZKuGHtBiJIn3nQ,16595
+pandas/tests/test_take.py,sha256=YSMLvpggEaY_MOT3PkVtQYUw0MfwN4bVvI3EgmOgxfA,11539
+pandas/tests/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/tools/test_to_datetime.py,sha256=yNASkriTd28us7W7Sw8UCsLaXbFMdVYgQttnS0L4kbI,147154
+pandas/tests/tools/test_to_numeric.py,sha256=R9fTxZIebRQp-yNh2oDsHYF8xgszrVLNqlVDYGwnajM,29480
+pandas/tests/tools/test_to_time.py,sha256=e-QmGu5nAe9clT8n9bda5aEwHBH4ZaXqBzs5-mKWMYQ,2417
+pandas/tests/tools/test_to_timedelta.py,sha256=sA-q01yavNfamRKB0JZ08ou3PN-G38PZ1Tuk5KOL8iI,12454
+pandas/tests/tseries/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/tseries/frequencies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/tseries/frequencies/test_freq_code.py,sha256=hvQl37z3W6CwcLOAqrgc2acqtjOJIbqVbnXkEUBY4cM,1727
+pandas/tests/tseries/frequencies/test_frequencies.py,sha256=tyI9e6ve7sEXdALy9GYjMV3mAQHmQF2IqW-xFzPdgjY,821
+pandas/tests/tseries/frequencies/test_inference.py,sha256=o8bZEapedbcC1zoj_slbggdZkzxX9Z1oh6VuCly8PU4,15111
+pandas/tests/tseries/holiday/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/tseries/holiday/test_calendar.py,sha256=SdMzzgTizQ88wJBRVTmVIgxE8E20_sgLFunP3WHlkZU,3622
+pandas/tests/tseries/holiday/test_federal.py,sha256=ukOOSRoUdcfUOlAT10AWVj8uxiD-88_H8xd--WpOsG0,1948
+pandas/tests/tseries/holiday/test_holiday.py,sha256=0NsEkl5wr2ckwvGiXnrYhluZZRpCc_Ede6SqdrFGc7I,11173
+pandas/tests/tseries/holiday/test_observance.py,sha256=GJBqIF4W6QG4k3Yzz6_13WMOR4nHSVzPbixHxO8Tukw,2723
+pandas/tests/tseries/offsets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/tseries/offsets/common.py,sha256=D3D8mcwwzW2kSEB8uX8gO6ARX4dB4PEu3_953APlRmk,900
+pandas/tests/tseries/offsets/test_business_day.py,sha256=dqOwIoAq3Mcxrc0EEeqJnnDvJYCFz5lA0JewVuODhBc,6808
+pandas/tests/tseries/offsets/test_business_hour.py,sha256=PV5Ddc4vEsQXrXhCKyDIcKptcNhXgIe-KiY14zsbVE0,58452
+pandas/tests/tseries/offsets/test_business_month.py,sha256=ZQlcBF15WTMq5w8uC7QeQ6QYVWN8hmfu1PtJvW-ebYU,6717
+pandas/tests/tseries/offsets/test_business_quarter.py,sha256=Tvp5J5r5uDBh8Y9yW65JItTp-B5fdJ4T9G0fxelHYaw,12591
+pandas/tests/tseries/offsets/test_business_year.py,sha256=OBs55t5gGKSPhTsnGafi5Uqsrjmq1cKpfuwWLUBR8Uo,6436
+pandas/tests/tseries/offsets/test_common.py,sha256=HpiuRR_ktnWLWSoFtMe87AVUCedpRcqxoTeVrfCg7is,7406
+pandas/tests/tseries/offsets/test_custom_business_day.py,sha256=YNN53-HvTW4JrbLYwyUiM10rQqIof1iA_W1uYkiHw7w,3180
+pandas/tests/tseries/offsets/test_custom_business_hour.py,sha256=UXa57Q-ZYPDMv307t7UKQGOIE32CH_FmCNY3hX8dcN4,12312
+pandas/tests/tseries/offsets/test_custom_business_month.py,sha256=WBgCVPO6PUa4oX0bDSDk_UE5hOeYbIo2sduIM9X3ASI,13362
+pandas/tests/tseries/offsets/test_dst.py,sha256=0s6bpzEFkVfUKN6lAkeFTiyzMwYRQwrZs49WAu-LK4o,9139
+pandas/tests/tseries/offsets/test_easter.py,sha256=oZlJ3lESuLTEv6A_chVDsD3Pa_cqgbVc4_zxrEE7cvc,1150
+pandas/tests/tseries/offsets/test_fiscal.py,sha256=p_rXA9wPnKZwDp40kaB8uGjq2fpHPCRU5PFF-1rClbA,26732
+pandas/tests/tseries/offsets/test_index.py,sha256=aeW6vyuME-22oikOhiE6q6nrLkIc22TjV3wPxpWXjIk,1147
+pandas/tests/tseries/offsets/test_month.py,sha256=EHsmRpEhG_CLSNEUOtA48auiJxFnr8sPsHQTyZeuu2g,23243
+pandas/tests/tseries/offsets/test_offsets.py,sha256=0yEFO27kh9uvdu4-MYW9bp5OX9Wb3lIKdiC4Jcna-2o,40623
+pandas/tests/tseries/offsets/test_offsets_properties.py,sha256=P_16zBX7ocaGN-br0pEQBGTlewfiDpJsnf5R1ei83JQ,1971
+pandas/tests/tseries/offsets/test_quarter.py,sha256=VBRsOqNS6xzYV63UVrPU3Z3_eAZQw4WefK2gPNfKork,11839
+pandas/tests/tseries/offsets/test_ticks.py,sha256=1n9PC1iEDQwnUKJivCaC6Wms3r8Je8ZKcGua_ySLLqE,11548
+pandas/tests/tseries/offsets/test_week.py,sha256=EUTDq6l4YT8xbBhQb0iHyNfJEme2jVZdjzaeg-Qj75g,12330
+pandas/tests/tseries/offsets/test_year.py,sha256=EM9DThnH2c6CMw518YpxkrpJixPmH3OVQ_Qp8iMIHPQ,10455
+pandas/tests/tslibs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/tslibs/test_api.py,sha256=ooEY2RyO9oL8Wcbsc958sGrBjveqTQZPauLeBN3n9xc,1525
+pandas/tests/tslibs/test_array_to_datetime.py,sha256=uQOT4gOHQr35s3R6d8GxDdCH21db6rJZzXKQYrh89y0,11871
+pandas/tests/tslibs/test_ccalendar.py,sha256=Rl2OjoB8pHaOyXW5MmshsHmm8nNMuHQvS_Du1L6ODqw,1903
+pandas/tests/tslibs/test_conversion.py,sha256=rgtB7pIs6VvpkNakcew9PFQ8oVHtwCwwBtu2gCFqbh4,4555
+pandas/tests/tslibs/test_fields.py,sha256=BQKlBXOC4LsXe7eT2CK5mRGR_25g9qYykQZ6ojoGjbE,1352
+pandas/tests/tslibs/test_libfrequencies.py,sha256=Ai6deDiGlwUHR9mVvlkIbXYzWZADHuPLlaBjDK0R2wU,717
+pandas/tests/tslibs/test_liboffsets.py,sha256=958cVv4vva5nawrYcmSinfu62NIL7lYOXOHN7yU-gAE,5108
+pandas/tests/tslibs/test_np_datetime.py,sha256=n7MNYHw7i03w4ZcVTM6GkoRN7Y7UIGxnshjHph2eDPs,7889
+pandas/tests/tslibs/test_npy_units.py,sha256=d9NFsygcKGtp-pw-ZpOvIxMhpsRqd1uPBVlqejHkNmU,922
+pandas/tests/tslibs/test_parse_iso8601.py,sha256=XGQ_GBOCosTiOFFjK4rYoDDZcIBitnyIb_0SXxKF9yo,4535
+pandas/tests/tslibs/test_parsing.py,sha256=S8PHWvLckoNCHrdJTi2Hq-stY2mt1mX8ygnp8PSokjI,13931
+pandas/tests/tslibs/test_period.py,sha256=l1xiNGDhMIJFG21BcAcE8Gkd6GODs-dPVOXcNuw6XTA,3424
+pandas/tests/tslibs/test_resolution.py,sha256=YC6IpOJsIHrsn7DUGi_LKdQrAuZgAqofNeW0DU2gays,1544
+pandas/tests/tslibs/test_strptime.py,sha256=DqjYyJ9t-cpSFDRyF3RepxMSZ4qvPllEjvarqvQKw1E,3896
+pandas/tests/tslibs/test_timedeltas.py,sha256=DaaxCrPg5Usv1UtpaVWpiYWixUtNT1FqjtS26MJq9PI,4662
+pandas/tests/tslibs/test_timezones.py,sha256=Hb56aLljCgRtBmXp7N_TaXM55ODLs6Mvl851dncnpsQ,4724
+pandas/tests/tslibs/test_to_offset.py,sha256=GaUG1VE0HhjMFjIj3aAP1LtzqFBCVx5_e0GUX1alIIU,5873
+pandas/tests/tslibs/test_tzconversion.py,sha256=6Ouplo1p8ArDrxCzPNyH9xpYkxERNPvbd4C_-WmTNd4,953
+pandas/tests/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/util/conftest.py,sha256=loEbQsEtHtv-T4Umeq_UeV6R7s8SO01GHbW6gn8lvlo,476
+pandas/tests/util/test_assert_almost_equal.py,sha256=K1-2c3XrbAb3jU23Dl9T79ueRfE32_Va7CNPfvopOYo,16803
+pandas/tests/util/test_assert_attr_equal.py,sha256=ZXTojP4V5Kle96QOFhxCZjq-dQf6gHvNOorYyOuFP1I,1045
+pandas/tests/util/test_assert_categorical_equal.py,sha256=yDmVzU22k5k5txSHixGfRJ4nKeP46FdNoh3CY1xEwEM,2728
+pandas/tests/util/test_assert_extension_array_equal.py,sha256=quw84fCgsrwtUMu-TcvHmrq5-08J7l1ZzS_3h1Eh3qw,3887
+pandas/tests/util/test_assert_frame_equal.py,sha256=TC5P8XdkYO1cPEWNdzaWr_JyVrfVpvcoKGWyt92ymJs,13376
+pandas/tests/util/test_assert_index_equal.py,sha256=LcRAOgz4q-S5ME4hM8dSezgb8DmlzmKRLj9OfV6oSgU,10154
+pandas/tests/util/test_assert_interval_array_equal.py,sha256=ITqL0Z8AAy5D1knACPOHodI64AHxmNzxiG-i9FeU0b8,2158
+pandas/tests/util/test_assert_numpy_array_equal.py,sha256=fgb8GdUwX4EYiR3PWbjJULNfAJz4DfJ8RJXchssygO4,6624
+pandas/tests/util/test_assert_produces_warning.py,sha256=A-pN3V12hnIqlbFYArYbdU-992RgJ-fqsaKbM0yvYPw,8412
+pandas/tests/util/test_assert_series_equal.py,sha256=sBeABqh7iyBIJ30iybAFzd56IN94TZRI69JtXyc3u7k,15072
+pandas/tests/util/test_deprecate.py,sha256=1hGoeUQTew5o0DnCjLV5-hOfEuSoIGOXGByq5KpAP7A,1617
+pandas/tests/util/test_deprecate_kwarg.py,sha256=7T2QkCxXUoJHhCxUjAH_5_hM-BHC6nPWG635LFY35lo,2043
+pandas/tests/util/test_deprecate_nonkeyword_arguments.py,sha256=0UkqIi4ehxD3aoA3z7y8-3dpOs6o30_Gp8rZvFX1W9Q,3623
+pandas/tests/util/test_doc.py,sha256=u0fxCg4zZWhB4SkJYc2huQ0xv7sKKAt0OlpWldmhh_M,1492
+pandas/tests/util/test_hashing.py,sha256=ZjoFCs6MoAhGV1j2WyjjEJkqyO9WQgRqwS6xx-3n0oE,13857
+pandas/tests/util/test_numba.py,sha256=6eOVcokESth7h6yyeehVizx61FtwDdVbF8wV8j3t-Ic,308
+pandas/tests/util/test_rewrite_warning.py,sha256=AUHz_OT0HS6kXs-9e59GflBCP3Tb5jy8jl9FxBg5rDs,1151
+pandas/tests/util/test_shares_memory.py,sha256=KN5X8yuw6M8pHgL0ES6YeH6_sZDUEx_wEib6B5Gvkew,852
+pandas/tests/util/test_show_versions.py,sha256=FjYUrUMAF7hOzphaXED__8yjeF0HTccZS6q05__rH44,2096
+pandas/tests/util/test_util.py,sha256=4UacWPLyjRQZU697jBxBWO6V1gUgkE4E-KKF6H6aXuE,1463
+pandas/tests/util/test_validate_args.py,sha256=9Z4zTqnKAWn1q9KZNvuO3DF6oszHjQrQgtOOimurWcs,1907
+pandas/tests/util/test_validate_args_and_kwargs.py,sha256=d_XcMRAQ9r--yIAAWSdJML6KeWgksy5qRNFXaY1BMQA,2456
+pandas/tests/util/test_validate_inclusive.py,sha256=w2twetJgIedm6KGQ4WmdmGC_6-RShFjXBMBVxR0gcME,896
+pandas/tests/util/test_validate_kwargs.py,sha256=NAZi-4Z0DrlQKZkkcKrWxoHxzWuKFxY8iphCBweA9jk,1808
+pandas/tests/window/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/window/conftest.py,sha256=rlS3eILzfTByRmmm7HLjk-FHEIbdTVVE9c0Dq-nfxa4,3137
+pandas/tests/window/moments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pandas/tests/window/moments/conftest.py,sha256=xSkyyVltsAkJETLDHJSksjRkjcVHsnhfyCiNvhsQ3no,1595
+pandas/tests/window/moments/test_moments_consistency_ewm.py,sha256=4FPmIGVQuOUg13aT5c9l_DN7j7K3J9QEU0KXeO2Qrt0,8107
+pandas/tests/window/moments/test_moments_consistency_expanding.py,sha256=e4Vn3nE02q-UeRH2aWLOSMv0QN4nN04iePKst5N-Vbo,5537
+pandas/tests/window/moments/test_moments_consistency_rolling.py,sha256=UBQL1mWD1qIB3fNb4tizqv-q4xlAz4tGT1nC1G-9RWM,7821
+pandas/tests/window/test_api.py,sha256=tgTULbAkhYVhgsIASr0q8rv2Gxh36Zn55hha1aNoKuM,13189
+pandas/tests/window/test_apply.py,sha256=v9YC4aORGX7yA50RFMjZqMx93SWp9o4Vpjo32xTROx0,9865
+pandas/tests/window/test_base_indexer.py,sha256=Fz81kU5x1g6OnNmRra6PRarPpq5HEYuA8XX0sR_y6LI,15954
+pandas/tests/window/test_cython_aggregations.py,sha256=wPAk76yfrG9D1-IzI0kDklpiTVqgp4xsEGjONe9lCY4,3967
+pandas/tests/window/test_dtypes.py,sha256=a3Xnqcq_jO0kczZmhmuBKkmCsKHOOufy9h6yNCPHlMk,5785
+pandas/tests/window/test_ewm.py,sha256=F1BB5E3_n5i5IzDNTMZeZzmG3aZqxC1jp_Pj-bWcozU,23020
+pandas/tests/window/test_expanding.py,sha256=Kz-2wSWxj4E31kd6y4jo7T7gE7aSe7yGHMYE7b4Bq18,24239
+pandas/tests/window/test_groupby.py,sha256=Uuunbe0ijjZaGcYV0of38imLoELseK0GYlHCRg6CEBU,46639
+pandas/tests/window/test_numba.py,sha256=ziiRaYE2FHbJvqA-moUJg-PdBGj1CFAnz3YB_wyEacU,16373
+pandas/tests/window/test_online.py,sha256=jhtEqYVPRoc9o7h4INf7-w2k5gKiVQJFnArH3AMFsEA,3644
+pandas/tests/window/test_pairwise.py,sha256=BXJLxRbolFs00FxTMp3uIFDNpZkciv8VGyAXFMw3zHI,16141
+pandas/tests/window/test_rolling.py,sha256=PzPkVsNDBUh6wgzFZvq_YNba2bdmwSO_H8BUK9ZxAys,61158
+pandas/tests/window/test_rolling_functions.py,sha256=xmaaXFaMq22o1s0Ba4NieIkTZtKWi9WOYae6z8i_rBo,17877
+pandas/tests/window/test_rolling_quantile.py,sha256=AvsqMR5YrVAlAFfhL0lHHAZIazXnzI1VkoVuPuiDEro,5516
+pandas/tests/window/test_rolling_skew_kurt.py,sha256=Emw9AJhTZyuVnxPg-nfYxpRNGJToWJ-he7obTSOy8iU,7807
+pandas/tests/window/test_timeseries_window.py,sha256=I0hk72tAFP4RJUaGesfUrjR5HC_bxBWwcXW7mxgslfg,24250
+pandas/tests/window/test_win_type.py,sha256=GRu_7tF1tQAEH8hcb6kZPSG2FJihUTE1_85tH1iYaN8,17522
+pandas/tseries/__init__.py,sha256=CM1Forog6FJC_5YY4IueiWfQ9cATlSDJ4hF23RTniBQ,293
+pandas/tseries/api.py,sha256=0Tms-OsqaHcpWH7a2F4mqKqEV-G5btiZKte3cUnEWQM,234
+pandas/tseries/frequencies.py,sha256=HNmBHzxRPhtlnpZF6iBSvq6e2du9J1JZ9gQ2c48Bvv0,17686
+pandas/tseries/holiday.py,sha256=G9kQvaBMzdNUoCs4WApAcxzSkOozFEyfDYFFjL8ZlZc,18596
+pandas/tseries/offsets.py,sha256=wLWH1_fg7dYGDsHDRyBxc62788G9CDhLcpDeZHt5ixI,1531
+pandas/util/__init__.py,sha256=tXNVCMKcgkFf4GETkpUx_UYvN56-54tYCCM0-04OIn4,827
+pandas/util/_decorators.py,sha256=n1OyKRRG-dcCRUSmyejpKTyfP_iu2kVF0TJ_9yIJkeo,17106
+pandas/util/_doctools.py,sha256=Es1FLqrmsOLpJ_7Y24q_vqdXGw5Vy6vcajcfbIi_FCo,6819
+pandas/util/_exceptions.py,sha256=H6Tz6X1PqPVp6wG_7OsjHEqTvTM9I3SebF5-WcTdZOc,2876
+pandas/util/_print_versions.py,sha256=eHw3wpaF-l66uzupWfl_x2jjXz8WTedHZdH4FFKtWo0,4636
+pandas/util/_test_decorators.py,sha256=KEhS1cMaBbf4U0R0KMRXZl-CcCkPfNqxpVz8BTtb0zY,5079
+pandas/util/_tester.py,sha256=Mluqpd_YwVdcdgZfSu-_oVdadk_JjX9FuPGFjn_S6ZA,1462
+pandas/util/_validators.py,sha256=VGKuOFzz0rY5g2dmbKpWV8vZb5Jb1RV5w-HTVi1GMY0,14300
+pandas/util/version/__init__.py,sha256=57SNOildSF8ehHn99uGwCZeAkTEuA6YMw6cYxjEyQ2I,16394
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/REQUESTED b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..4e4c38ae320920b8f083b87f408214cdecd350d2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/WHEEL
@@ -0,0 +1,6 @@
+Wheel-Version: 1.0
+Generator: meson
+Root-Is-Purelib: false
+Tag: cp310-cp310-manylinux_2_17_x86_64
+Tag: cp310-cp310-manylinux2014_x86_64
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/entry_points.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..3c1b523d70758fbd0080e21ca4c7ce6d9c9d9bd5
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/pandas-2.3.1.dist-info/entry_points.txt
@@ -0,0 +1,3 @@
+[pandas_plotting_backends]
+matplotlib = pandas:plotting._matplotlib
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e374d5c5604d0eeed555e68b7523bfac72fd9101
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/__init__.py
@@ -0,0 +1,14 @@
+import importlib
+import sys
+
+__version__, _, _ = sys.version.partition(' ')
+
+
+try:
+ # Allow Debian and pkgsrc (only) to customize system
+ # behavior. Ref pypa/distutils#2 and pypa/distutils#16.
+ # This hook is deprecated and no other environments
+ # should use it.
+ importlib.import_module('_distutils_system_mod')
+except ImportError:
+ pass
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_log.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_log.py
new file mode 100644
index 0000000000000000000000000000000000000000..0148f157ff3bf8bd728c82f49cd3d1cd9cb5a43e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_log.py
@@ -0,0 +1,3 @@
+import logging
+
+log = logging.getLogger()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_macos_compat.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_macos_compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..76ecb96abe478313ce7d09342b2643bf4a765331
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_macos_compat.py
@@ -0,0 +1,12 @@
+import importlib
+import sys
+
+
+def bypass_compiler_fixup(cmd, args):
+ return cmd
+
+
+if sys.platform == 'darwin':
+ compiler_fixup = importlib.import_module('_osx_support').compiler_fixup
+else:
+ compiler_fixup = bypass_compiler_fixup
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_modified.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_modified.py
new file mode 100644
index 0000000000000000000000000000000000000000..f64cab7d61ae20dd0c425b8843b068f39faa6961
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_modified.py
@@ -0,0 +1,95 @@
+"""Timestamp comparison of files and groups of files."""
+
+from __future__ import annotations
+
+import functools
+import os.path
+from collections.abc import Callable, Iterable
+from typing import Literal, TypeVar
+
+from jaraco.functools import splat
+
+from .compat.py39 import zip_strict
+from .errors import DistutilsFileError
+
+_SourcesT = TypeVar(
+ "_SourcesT", bound="str | bytes | os.PathLike[str] | os.PathLike[bytes]"
+)
+_TargetsT = TypeVar(
+ "_TargetsT", bound="str | bytes | os.PathLike[str] | os.PathLike[bytes]"
+)
+
+
+def _newer(source, target):
+ return not os.path.exists(target) or (
+ os.path.getmtime(source) > os.path.getmtime(target)
+ )
+
+
+def newer(
+ source: str | bytes | os.PathLike[str] | os.PathLike[bytes],
+ target: str | bytes | os.PathLike[str] | os.PathLike[bytes],
+) -> bool:
+ """
+ Is source modified more recently than target.
+
+ Returns True if 'source' is modified more recently than
+ 'target' or if 'target' does not exist.
+
+ Raises DistutilsFileError if 'source' does not exist.
+ """
+ if not os.path.exists(source):
+ raise DistutilsFileError(f"file {os.path.abspath(source)!r} does not exist")
+
+ return _newer(source, target)
+
+
+def newer_pairwise(
+ sources: Iterable[_SourcesT],
+ targets: Iterable[_TargetsT],
+ newer: Callable[[_SourcesT, _TargetsT], bool] = newer,
+) -> tuple[list[_SourcesT], list[_TargetsT]]:
+ """
+ Filter filenames where sources are newer than targets.
+
+ Walk two filename iterables in parallel, testing if each source is newer
+ than its corresponding target. Returns a pair of lists (sources,
+ targets) where source is newer than target, according to the semantics
+ of 'newer()'.
+ """
+ newer_pairs = filter(splat(newer), zip_strict(sources, targets))
+ return tuple(map(list, zip(*newer_pairs))) or ([], [])
+
+
+def newer_group(
+ sources: Iterable[str | bytes | os.PathLike[str] | os.PathLike[bytes]],
+ target: str | bytes | os.PathLike[str] | os.PathLike[bytes],
+ missing: Literal["error", "ignore", "newer"] = "error",
+) -> bool:
+ """
+ Is target out-of-date with respect to any file in sources.
+
+ Return True if 'target' is out-of-date with respect to any file
+ listed in 'sources'. In other words, if 'target' exists and is newer
+ than every file in 'sources', return False; otherwise return True.
+ ``missing`` controls how to handle a missing source file:
+
+ - error (default): allow the ``stat()`` call to fail.
+ - ignore: silently disregard any missing source files.
+ - newer: treat missing source files as "target out of date". This
+ mode is handy in "dry-run" mode: it will pretend to carry out
+ commands that wouldn't work because inputs are missing, but
+ that doesn't matter because dry-run won't run the commands.
+ """
+
+ def missing_as_newer(source):
+ return missing == 'newer' and not os.path.exists(source)
+
+ ignored = os.path.exists if missing == 'ignore' else None
+ return not os.path.exists(target) or any(
+ missing_as_newer(source) or _newer(source, target)
+ for source in filter(ignored, sources)
+ )
+
+
+newer_pairwise_group = functools.partial(newer_pairwise, newer=newer_group)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_msvccompiler.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_msvccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..d07c86ef8e41fc31357c989133d51e9618c3e43d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/_msvccompiler.py
@@ -0,0 +1,16 @@
+import warnings
+
+from .compilers.C import msvc
+
+__all__ = ["MSVCCompiler"]
+
+MSVCCompiler = msvc.Compiler
+
+
+def __getattr__(name):
+ if name == '_get_vc_env':
+ warnings.warn(
+ "_get_vc_env is private; find an alternative (pypa/distutils#340)"
+ )
+ return msvc._get_vc_env
+ raise AttributeError(name)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/archive_util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/archive_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..d860f5527234567a0b726ea07116ae2c8e6bc3d2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/archive_util.py
@@ -0,0 +1,294 @@
+"""distutils.archive_util
+
+Utility functions for creating archive files (tarballs, zip files,
+that sort of thing)."""
+
+from __future__ import annotations
+
+import os
+from typing import Literal, overload
+
+try:
+ import zipfile
+except ImportError:
+ zipfile = None
+
+
+from ._log import log
+from .dir_util import mkpath
+from .errors import DistutilsExecError
+from .spawn import spawn
+
+try:
+ from pwd import getpwnam
+except ImportError:
+ getpwnam = None
+
+try:
+ from grp import getgrnam
+except ImportError:
+ getgrnam = None
+
+
+def _get_gid(name):
+ """Returns a gid, given a group name."""
+ if getgrnam is None or name is None:
+ return None
+ try:
+ result = getgrnam(name)
+ except KeyError:
+ result = None
+ if result is not None:
+ return result[2]
+ return None
+
+
+def _get_uid(name):
+ """Returns an uid, given a user name."""
+ if getpwnam is None or name is None:
+ return None
+ try:
+ result = getpwnam(name)
+ except KeyError:
+ result = None
+ if result is not None:
+ return result[2]
+ return None
+
+
+def make_tarball(
+ base_name: str,
+ base_dir: str | os.PathLike[str],
+ compress: Literal["gzip", "bzip2", "xz"] | None = "gzip",
+ verbose: bool = False,
+ dry_run: bool = False,
+ owner: str | None = None,
+ group: str | None = None,
+) -> str:
+ """Create a (possibly compressed) tar file from all the files under
+ 'base_dir'.
+
+ 'compress' must be "gzip" (the default), "bzip2", "xz", or None.
+
+ 'owner' and 'group' can be used to define an owner and a group for the
+ archive that is being built. If not provided, the current owner and group
+ will be used.
+
+ The output tar file will be named 'base_dir' + ".tar", possibly plus
+ the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z").
+
+ Returns the output filename.
+ """
+ tar_compression = {
+ 'gzip': 'gz',
+ 'bzip2': 'bz2',
+ 'xz': 'xz',
+ None: '',
+ }
+ compress_ext = {'gzip': '.gz', 'bzip2': '.bz2', 'xz': '.xz'}
+
+ # flags for compression program, each element of list will be an argument
+ if compress is not None and compress not in compress_ext.keys():
+ raise ValueError(
+ "bad value for 'compress': must be None, 'gzip', 'bzip2', 'xz'"
+ )
+
+ archive_name = base_name + '.tar'
+ archive_name += compress_ext.get(compress, '')
+
+ mkpath(os.path.dirname(archive_name), dry_run=dry_run)
+
+ # creating the tarball
+ import tarfile # late import so Python build itself doesn't break
+
+ log.info('Creating tar archive')
+
+ uid = _get_uid(owner)
+ gid = _get_gid(group)
+
+ def _set_uid_gid(tarinfo):
+ if gid is not None:
+ tarinfo.gid = gid
+ tarinfo.gname = group
+ if uid is not None:
+ tarinfo.uid = uid
+ tarinfo.uname = owner
+ return tarinfo
+
+ if not dry_run:
+ tar = tarfile.open(archive_name, f'w|{tar_compression[compress]}')
+ try:
+ tar.add(base_dir, filter=_set_uid_gid)
+ finally:
+ tar.close()
+
+ return archive_name
+
+
+def make_zipfile( # noqa: C901
+ base_name: str,
+ base_dir: str | os.PathLike[str],
+ verbose: bool = False,
+ dry_run: bool = False,
+) -> str:
+ """Create a zip file from all the files under 'base_dir'.
+
+ The output zip file will be named 'base_name' + ".zip". Uses either the
+ "zipfile" Python module (if available) or the InfoZIP "zip" utility
+ (if installed and found on the default search path). If neither tool is
+ available, raises DistutilsExecError. Returns the name of the output zip
+ file.
+ """
+ zip_filename = base_name + ".zip"
+ mkpath(os.path.dirname(zip_filename), dry_run=dry_run)
+
+ # If zipfile module is not available, try spawning an external
+ # 'zip' command.
+ if zipfile is None:
+ if verbose:
+ zipoptions = "-r"
+ else:
+ zipoptions = "-rq"
+
+ try:
+ spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run)
+ except DistutilsExecError:
+ # XXX really should distinguish between "couldn't find
+ # external 'zip' command" and "zip failed".
+ raise DistutilsExecError(
+ f"unable to create zip file '{zip_filename}': "
+ "could neither import the 'zipfile' module nor "
+ "find a standalone zip utility"
+ )
+
+ else:
+ log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir)
+
+ if not dry_run:
+ try:
+ zip = zipfile.ZipFile(
+ zip_filename, "w", compression=zipfile.ZIP_DEFLATED
+ )
+ except RuntimeError:
+ zip = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_STORED)
+
+ with zip:
+ if base_dir != os.curdir:
+ path = os.path.normpath(os.path.join(base_dir, ''))
+ zip.write(path, path)
+ log.info("adding '%s'", path)
+ for dirpath, dirnames, filenames in os.walk(base_dir):
+ for name in dirnames:
+ path = os.path.normpath(os.path.join(dirpath, name, ''))
+ zip.write(path, path)
+ log.info("adding '%s'", path)
+ for name in filenames:
+ path = os.path.normpath(os.path.join(dirpath, name))
+ if os.path.isfile(path):
+ zip.write(path, path)
+ log.info("adding '%s'", path)
+
+ return zip_filename
+
+
+ARCHIVE_FORMATS = {
+ 'gztar': (make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
+ 'bztar': (make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
+ 'xztar': (make_tarball, [('compress', 'xz')], "xz'ed tar-file"),
+ 'ztar': (make_tarball, [('compress', 'compress')], "compressed tar file"),
+ 'tar': (make_tarball, [('compress', None)], "uncompressed tar file"),
+ 'zip': (make_zipfile, [], "ZIP file"),
+}
+
+
+def check_archive_formats(formats):
+ """Returns the first format from the 'format' list that is unknown.
+
+ If all formats are known, returns None
+ """
+ for format in formats:
+ if format not in ARCHIVE_FORMATS:
+ return format
+ return None
+
+
+@overload
+def make_archive(
+ base_name: str,
+ format: str,
+ root_dir: str | os.PathLike[str] | bytes | os.PathLike[bytes] | None = None,
+ base_dir: str | None = None,
+ verbose: bool = False,
+ dry_run: bool = False,
+ owner: str | None = None,
+ group: str | None = None,
+) -> str: ...
+@overload
+def make_archive(
+ base_name: str | os.PathLike[str],
+ format: str,
+ root_dir: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ base_dir: str | None = None,
+ verbose: bool = False,
+ dry_run: bool = False,
+ owner: str | None = None,
+ group: str | None = None,
+) -> str: ...
+def make_archive(
+ base_name: str | os.PathLike[str],
+ format: str,
+ root_dir: str | os.PathLike[str] | bytes | os.PathLike[bytes] | None = None,
+ base_dir: str | None = None,
+ verbose: bool = False,
+ dry_run: bool = False,
+ owner: str | None = None,
+ group: str | None = None,
+) -> str:
+ """Create an archive file (eg. zip or tar).
+
+ 'base_name' is the name of the file to create, minus any format-specific
+ extension; 'format' is the archive format: one of "zip", "tar", "gztar",
+ "bztar", "xztar", or "ztar".
+
+ 'root_dir' is a directory that will be the root directory of the
+ archive; ie. we typically chdir into 'root_dir' before creating the
+ archive. 'base_dir' is the directory where we start archiving from;
+ ie. 'base_dir' will be the common prefix of all files and
+ directories in the archive. 'root_dir' and 'base_dir' both default
+ to the current directory. Returns the name of the archive file.
+
+ 'owner' and 'group' are used when creating a tar archive. By default,
+ uses the current owner and group.
+ """
+ save_cwd = os.getcwd()
+ if root_dir is not None:
+ log.debug("changing into '%s'", root_dir)
+ base_name = os.path.abspath(base_name)
+ if not dry_run:
+ os.chdir(root_dir)
+
+ if base_dir is None:
+ base_dir = os.curdir
+
+ kwargs = {'dry_run': dry_run}
+
+ try:
+ format_info = ARCHIVE_FORMATS[format]
+ except KeyError:
+ raise ValueError(f"unknown archive format '{format}'")
+
+ func = format_info[0]
+ kwargs.update(format_info[1])
+
+ if format != 'zip':
+ kwargs['owner'] = owner
+ kwargs['group'] = group
+
+ try:
+ filename = func(base_name, base_dir, **kwargs)
+ finally:
+ if root_dir is not None:
+ log.debug("changing back to '%s'", save_cwd)
+ os.chdir(save_cwd)
+
+ return filename
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..58bc6a55e24fd2b0b170e4499c6095e934313827
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py
@@ -0,0 +1,26 @@
+from .compat.numpy import ( # noqa: F401
+ _default_compilers,
+ compiler_class,
+)
+from .compilers.C import base
+from .compilers.C.base import (
+ gen_lib_options,
+ gen_preprocess_options,
+ get_default_compiler,
+ new_compiler,
+ show_compilers,
+)
+from .compilers.C.errors import CompileError, LinkError
+
+__all__ = [
+ 'CompileError',
+ 'LinkError',
+ 'gen_lib_options',
+ 'gen_preprocess_options',
+ 'get_default_compiler',
+ 'new_compiler',
+ 'show_compilers',
+]
+
+
+CCompiler = base.Compiler
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py
new file mode 100644
index 0000000000000000000000000000000000000000..241621bd51340819c5216883a0e73929c9fd20b0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/cmd.py
@@ -0,0 +1,554 @@
+"""distutils.cmd
+
+Provides the Command class, the base class for the command classes
+in the distutils.command package.
+"""
+
+from __future__ import annotations
+
+import logging
+import os
+import re
+import sys
+from abc import abstractmethod
+from collections.abc import Callable, MutableSequence
+from typing import TYPE_CHECKING, Any, ClassVar, TypeVar, overload
+
+from . import _modified, archive_util, dir_util, file_util, util
+from ._log import log
+from .errors import DistutilsOptionError
+
+if TYPE_CHECKING:
+ # type-only import because of mutual dependence between these classes
+ from distutils.dist import Distribution
+
+ from typing_extensions import TypeVarTuple, Unpack
+
+ _Ts = TypeVarTuple("_Ts")
+
+_StrPathT = TypeVar("_StrPathT", bound="str | os.PathLike[str]")
+_BytesPathT = TypeVar("_BytesPathT", bound="bytes | os.PathLike[bytes]")
+_CommandT = TypeVar("_CommandT", bound="Command")
+
+
+class Command:
+ """Abstract base class for defining command classes, the "worker bees"
+ of the Distutils. A useful analogy for command classes is to think of
+ them as subroutines with local variables called "options". The options
+ are "declared" in 'initialize_options()' and "defined" (given their
+ final values, aka "finalized") in 'finalize_options()', both of which
+ must be defined by every command class. The distinction between the
+ two is necessary because option values might come from the outside
+ world (command line, config file, ...), and any options dependent on
+ other options must be computed *after* these outside influences have
+ been processed -- hence 'finalize_options()'. The "body" of the
+ subroutine, where it does all its work based on the values of its
+ options, is the 'run()' method, which must also be implemented by every
+ command class.
+ """
+
+ # 'sub_commands' formalizes the notion of a "family" of commands,
+ # eg. "install" as the parent with sub-commands "install_lib",
+ # "install_headers", etc. The parent of a family of commands
+ # defines 'sub_commands' as a class attribute; it's a list of
+ # (command_name : string, predicate : unbound_method | string | None)
+ # tuples, where 'predicate' is a method of the parent command that
+ # determines whether the corresponding command is applicable in the
+ # current situation. (Eg. we "install_headers" is only applicable if
+ # we have any C header files to install.) If 'predicate' is None,
+ # that command is always applicable.
+ #
+ # 'sub_commands' is usually defined at the *end* of a class, because
+ # predicates can be unbound methods, so they must already have been
+ # defined. The canonical example is the "install" command.
+ sub_commands: ClassVar[ # Any to work around variance issues
+ list[tuple[str, Callable[[Any], bool] | None]]
+ ] = []
+
+ user_options: ClassVar[
+ # Specifying both because list is invariant. Avoids mypy override assignment issues
+ list[tuple[str, str, str]] | list[tuple[str, str | None, str]]
+ ] = []
+
+ # -- Creation/initialization methods -------------------------------
+
+ def __init__(self, dist: Distribution) -> None:
+ """Create and initialize a new Command object. Most importantly,
+ invokes the 'initialize_options()' method, which is the real
+ initializer and depends on the actual command being
+ instantiated.
+ """
+ # late import because of mutual dependence between these classes
+ from distutils.dist import Distribution
+
+ if not isinstance(dist, Distribution):
+ raise TypeError("dist must be a Distribution instance")
+ if self.__class__ is Command:
+ raise RuntimeError("Command is an abstract class")
+
+ self.distribution = dist
+ self.initialize_options()
+
+ # Per-command versions of the global flags, so that the user can
+ # customize Distutils' behaviour command-by-command and let some
+ # commands fall back on the Distribution's behaviour. None means
+ # "not defined, check self.distribution's copy", while 0 or 1 mean
+ # false and true (duh). Note that this means figuring out the real
+ # value of each flag is a touch complicated -- hence "self._dry_run"
+ # will be handled by __getattr__, below.
+ # XXX This needs to be fixed.
+ self._dry_run = None
+
+ # verbose is largely ignored, but needs to be set for
+ # backwards compatibility (I think)?
+ self.verbose = dist.verbose
+
+ # Some commands define a 'self.force' option to ignore file
+ # timestamps, but methods defined *here* assume that
+ # 'self.force' exists for all commands. So define it here
+ # just to be safe.
+ self.force = None
+
+ # The 'help' flag is just used for command-line parsing, so
+ # none of that complicated bureaucracy is needed.
+ self.help = False
+
+ # 'finalized' records whether or not 'finalize_options()' has been
+ # called. 'finalize_options()' itself should not pay attention to
+ # this flag: it is the business of 'ensure_finalized()', which
+ # always calls 'finalize_options()', to respect/update it.
+ self.finalized = False
+
+ # XXX A more explicit way to customize dry_run would be better.
+ def __getattr__(self, attr):
+ if attr == 'dry_run':
+ myval = getattr(self, "_" + attr)
+ if myval is None:
+ return getattr(self.distribution, attr)
+ else:
+ return myval
+ else:
+ raise AttributeError(attr)
+
+ def ensure_finalized(self) -> None:
+ if not self.finalized:
+ self.finalize_options()
+ self.finalized = True
+
+ # Subclasses must define:
+ # initialize_options()
+ # provide default values for all options; may be customized by
+ # setup script, by options from config file(s), or by command-line
+ # options
+ # finalize_options()
+ # decide on the final values for all options; this is called
+ # after all possible intervention from the outside world
+ # (command-line, option file, etc.) has been processed
+ # run()
+ # run the command: do whatever it is we're here to do,
+ # controlled by the command's various option values
+
+ @abstractmethod
+ def initialize_options(self) -> None:
+ """Set default values for all the options that this command
+ supports. Note that these defaults may be overridden by other
+ commands, by the setup script, by config files, or by the
+ command-line. Thus, this is not the place to code dependencies
+ between options; generally, 'initialize_options()' implementations
+ are just a bunch of "self.foo = None" assignments.
+
+ This method must be implemented by all command classes.
+ """
+ raise RuntimeError(
+ f"abstract method -- subclass {self.__class__} must override"
+ )
+
+ @abstractmethod
+ def finalize_options(self) -> None:
+ """Set final values for all the options that this command supports.
+ This is always called as late as possible, ie. after any option
+ assignments from the command-line or from other commands have been
+ done. Thus, this is the place to code option dependencies: if
+ 'foo' depends on 'bar', then it is safe to set 'foo' from 'bar' as
+ long as 'foo' still has the same value it was assigned in
+ 'initialize_options()'.
+
+ This method must be implemented by all command classes.
+ """
+ raise RuntimeError(
+ f"abstract method -- subclass {self.__class__} must override"
+ )
+
+ def dump_options(self, header=None, indent=""):
+ from distutils.fancy_getopt import longopt_xlate
+
+ if header is None:
+ header = f"command options for '{self.get_command_name()}':"
+ self.announce(indent + header, level=logging.INFO)
+ indent = indent + " "
+ for option, _, _ in self.user_options:
+ option = option.translate(longopt_xlate)
+ if option[-1] == "=":
+ option = option[:-1]
+ value = getattr(self, option)
+ self.announce(indent + f"{option} = {value}", level=logging.INFO)
+
+ @abstractmethod
+ def run(self) -> None:
+ """A command's raison d'etre: carry out the action it exists to
+ perform, controlled by the options initialized in
+ 'initialize_options()', customized by other commands, the setup
+ script, the command-line, and config files, and finalized in
+ 'finalize_options()'. All terminal output and filesystem
+ interaction should be done by 'run()'.
+
+ This method must be implemented by all command classes.
+ """
+ raise RuntimeError(
+ f"abstract method -- subclass {self.__class__} must override"
+ )
+
+ def announce(self, msg: object, level: int = logging.DEBUG) -> None:
+ log.log(level, msg)
+
+ def debug_print(self, msg: object) -> None:
+ """Print 'msg' to stdout if the global DEBUG (taken from the
+ DISTUTILS_DEBUG environment variable) flag is true.
+ """
+ from distutils.debug import DEBUG
+
+ if DEBUG:
+ print(msg)
+ sys.stdout.flush()
+
+ # -- Option validation methods -------------------------------------
+ # (these are very handy in writing the 'finalize_options()' method)
+ #
+ # NB. the general philosophy here is to ensure that a particular option
+ # value meets certain type and value constraints. If not, we try to
+ # force it into conformance (eg. if we expect a list but have a string,
+ # split the string on comma and/or whitespace). If we can't force the
+ # option into conformance, raise DistutilsOptionError. Thus, command
+ # classes need do nothing more than (eg.)
+ # self.ensure_string_list('foo')
+ # and they can be guaranteed that thereafter, self.foo will be
+ # a list of strings.
+
+ def _ensure_stringlike(self, option, what, default=None):
+ val = getattr(self, option)
+ if val is None:
+ setattr(self, option, default)
+ return default
+ elif not isinstance(val, str):
+ raise DistutilsOptionError(f"'{option}' must be a {what} (got `{val}`)")
+ return val
+
+ def ensure_string(self, option: str, default: str | None = None) -> None:
+ """Ensure that 'option' is a string; if not defined, set it to
+ 'default'.
+ """
+ self._ensure_stringlike(option, "string", default)
+
+ def ensure_string_list(self, option: str) -> None:
+ r"""Ensure that 'option' is a list of strings. If 'option' is
+ currently a string, we split it either on /,\s*/ or /\s+/, so
+ "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become
+ ["foo", "bar", "baz"].
+ """
+ val = getattr(self, option)
+ if val is None:
+ return
+ elif isinstance(val, str):
+ setattr(self, option, re.split(r',\s*|\s+', val))
+ else:
+ if isinstance(val, list):
+ ok = all(isinstance(v, str) for v in val)
+ else:
+ ok = False
+ if not ok:
+ raise DistutilsOptionError(
+ f"'{option}' must be a list of strings (got {val!r})"
+ )
+
+ def _ensure_tested_string(self, option, tester, what, error_fmt, default=None):
+ val = self._ensure_stringlike(option, what, default)
+ if val is not None and not tester(val):
+ raise DistutilsOptionError(
+ ("error in '%s' option: " + error_fmt) % (option, val)
+ )
+
+ def ensure_filename(self, option: str) -> None:
+ """Ensure that 'option' is the name of an existing file."""
+ self._ensure_tested_string(
+ option, os.path.isfile, "filename", "'%s' does not exist or is not a file"
+ )
+
+ def ensure_dirname(self, option: str) -> None:
+ self._ensure_tested_string(
+ option,
+ os.path.isdir,
+ "directory name",
+ "'%s' does not exist or is not a directory",
+ )
+
+ # -- Convenience methods for commands ------------------------------
+
+ def get_command_name(self) -> str:
+ if hasattr(self, 'command_name'):
+ return self.command_name
+ else:
+ return self.__class__.__name__
+
+ def set_undefined_options(
+ self, src_cmd: str, *option_pairs: tuple[str, str]
+ ) -> None:
+ """Set the values of any "undefined" options from corresponding
+ option values in some other command object. "Undefined" here means
+ "is None", which is the convention used to indicate that an option
+ has not been changed between 'initialize_options()' and
+ 'finalize_options()'. Usually called from 'finalize_options()' for
+ options that depend on some other command rather than another
+ option of the same command. 'src_cmd' is the other command from
+ which option values will be taken (a command object will be created
+ for it if necessary); the remaining arguments are
+ '(src_option,dst_option)' tuples which mean "take the value of
+ 'src_option' in the 'src_cmd' command object, and copy it to
+ 'dst_option' in the current command object".
+ """
+ # Option_pairs: list of (src_option, dst_option) tuples
+ src_cmd_obj = self.distribution.get_command_obj(src_cmd)
+ src_cmd_obj.ensure_finalized()
+ for src_option, dst_option in option_pairs:
+ if getattr(self, dst_option) is None:
+ setattr(self, dst_option, getattr(src_cmd_obj, src_option))
+
+ # NOTE: Because distutils is private to Setuptools and not all commands are exposed here,
+ # not every possible command is enumerated in the signature.
+ def get_finalized_command(self, command: str, create: bool = True) -> Command:
+ """Wrapper around Distribution's 'get_command_obj()' method: find
+ (create if necessary and 'create' is true) the command object for
+ 'command', call its 'ensure_finalized()' method, and return the
+ finalized command object.
+ """
+ cmd_obj = self.distribution.get_command_obj(command, create)
+ cmd_obj.ensure_finalized()
+ return cmd_obj
+
+ # XXX rename to 'get_reinitialized_command()'? (should do the
+ # same in dist.py, if so)
+ @overload
+ def reinitialize_command(
+ self, command: str, reinit_subcommands: bool = False
+ ) -> Command: ...
+ @overload
+ def reinitialize_command(
+ self, command: _CommandT, reinit_subcommands: bool = False
+ ) -> _CommandT: ...
+ def reinitialize_command(
+ self, command: str | Command, reinit_subcommands=False
+ ) -> Command:
+ return self.distribution.reinitialize_command(command, reinit_subcommands)
+
+ def run_command(self, command: str) -> None:
+ """Run some other command: uses the 'run_command()' method of
+ Distribution, which creates and finalizes the command object if
+ necessary and then invokes its 'run()' method.
+ """
+ self.distribution.run_command(command)
+
+ def get_sub_commands(self) -> list[str]:
+ """Determine the sub-commands that are relevant in the current
+ distribution (ie., that need to be run). This is based on the
+ 'sub_commands' class attribute: each tuple in that list may include
+ a method that we call to determine if the subcommand needs to be
+ run for the current distribution. Return a list of command names.
+ """
+ commands = []
+ for cmd_name, method in self.sub_commands:
+ if method is None or method(self):
+ commands.append(cmd_name)
+ return commands
+
+ # -- External world manipulation -----------------------------------
+
+ def warn(self, msg: object) -> None:
+ log.warning("warning: %s: %s\n", self.get_command_name(), msg)
+
+ def execute(
+ self,
+ func: Callable[[Unpack[_Ts]], object],
+ args: tuple[Unpack[_Ts]],
+ msg: object = None,
+ level: int = 1,
+ ) -> None:
+ util.execute(func, args, msg, dry_run=self.dry_run)
+
+ def mkpath(self, name: str, mode: int = 0o777) -> None:
+ dir_util.mkpath(name, mode, dry_run=self.dry_run)
+
+ @overload
+ def copy_file(
+ self,
+ infile: str | os.PathLike[str],
+ outfile: _StrPathT,
+ preserve_mode: bool = True,
+ preserve_times: bool = True,
+ link: str | None = None,
+ level: int = 1,
+ ) -> tuple[_StrPathT | str, bool]: ...
+ @overload
+ def copy_file(
+ self,
+ infile: bytes | os.PathLike[bytes],
+ outfile: _BytesPathT,
+ preserve_mode: bool = True,
+ preserve_times: bool = True,
+ link: str | None = None,
+ level: int = 1,
+ ) -> tuple[_BytesPathT | bytes, bool]: ...
+ def copy_file(
+ self,
+ infile: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ outfile: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ preserve_mode: bool = True,
+ preserve_times: bool = True,
+ link: str | None = None,
+ level: int = 1,
+ ) -> tuple[str | os.PathLike[str] | bytes | os.PathLike[bytes], bool]:
+ """Copy a file respecting verbose, dry-run and force flags. (The
+ former two default to whatever is in the Distribution object, and
+ the latter defaults to false for commands that don't define it.)"""
+ return file_util.copy_file(
+ infile,
+ outfile,
+ preserve_mode,
+ preserve_times,
+ not self.force,
+ link,
+ dry_run=self.dry_run,
+ )
+
+ def copy_tree(
+ self,
+ infile: str | os.PathLike[str],
+ outfile: str,
+ preserve_mode: bool = True,
+ preserve_times: bool = True,
+ preserve_symlinks: bool = False,
+ level: int = 1,
+ ) -> list[str]:
+ """Copy an entire directory tree respecting verbose, dry-run,
+ and force flags.
+ """
+ return dir_util.copy_tree(
+ infile,
+ outfile,
+ preserve_mode,
+ preserve_times,
+ preserve_symlinks,
+ not self.force,
+ dry_run=self.dry_run,
+ )
+
+ @overload
+ def move_file(
+ self, src: str | os.PathLike[str], dst: _StrPathT, level: int = 1
+ ) -> _StrPathT | str: ...
+ @overload
+ def move_file(
+ self, src: bytes | os.PathLike[bytes], dst: _BytesPathT, level: int = 1
+ ) -> _BytesPathT | bytes: ...
+ def move_file(
+ self,
+ src: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ dst: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ level: int = 1,
+ ) -> str | os.PathLike[str] | bytes | os.PathLike[bytes]:
+ """Move a file respecting dry-run flag."""
+ return file_util.move_file(src, dst, dry_run=self.dry_run)
+
+ def spawn(
+ self, cmd: MutableSequence[str], search_path: bool = True, level: int = 1
+ ) -> None:
+ """Spawn an external command respecting dry-run flag."""
+ from distutils.spawn import spawn
+
+ spawn(cmd, search_path, dry_run=self.dry_run)
+
+ @overload
+ def make_archive(
+ self,
+ base_name: str,
+ format: str,
+ root_dir: str | os.PathLike[str] | bytes | os.PathLike[bytes] | None = None,
+ base_dir: str | None = None,
+ owner: str | None = None,
+ group: str | None = None,
+ ) -> str: ...
+ @overload
+ def make_archive(
+ self,
+ base_name: str | os.PathLike[str],
+ format: str,
+ root_dir: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ base_dir: str | None = None,
+ owner: str | None = None,
+ group: str | None = None,
+ ) -> str: ...
+ def make_archive(
+ self,
+ base_name: str | os.PathLike[str],
+ format: str,
+ root_dir: str | os.PathLike[str] | bytes | os.PathLike[bytes] | None = None,
+ base_dir: str | None = None,
+ owner: str | None = None,
+ group: str | None = None,
+ ) -> str:
+ return archive_util.make_archive(
+ base_name,
+ format,
+ root_dir,
+ base_dir,
+ dry_run=self.dry_run,
+ owner=owner,
+ group=group,
+ )
+
+ def make_file(
+ self,
+ infiles: str | list[str] | tuple[str, ...],
+ outfile: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ func: Callable[[Unpack[_Ts]], object],
+ args: tuple[Unpack[_Ts]],
+ exec_msg: object = None,
+ skip_msg: object = None,
+ level: int = 1,
+ ) -> None:
+ """Special case of 'execute()' for operations that process one or
+ more input files and generate one output file. Works just like
+ 'execute()', except the operation is skipped and a different
+ message printed if 'outfile' already exists and is newer than all
+ files listed in 'infiles'. If the command defined 'self.force',
+ and it is true, then the command is unconditionally run -- does no
+ timestamp checks.
+ """
+ if skip_msg is None:
+ skip_msg = f"skipping {outfile} (inputs unchanged)"
+
+ # Allow 'infiles' to be a single string
+ if isinstance(infiles, str):
+ infiles = (infiles,)
+ elif not isinstance(infiles, (list, tuple)):
+ raise TypeError("'infiles' must be a string, or a list or tuple of strings")
+
+ if exec_msg is None:
+ exec_msg = "generating {} from {}".format(outfile, ', '.join(infiles))
+
+ # If 'outfile' must be regenerated (either because it doesn't
+ # exist, is out-of-date, or the 'force' flag is true) then
+ # perform the action that presumably regenerates it
+ if self.force or _modified.newer_group(infiles, outfile):
+ self.execute(func, args, exec_msg, level)
+ # Otherwise, print the "skip" message
+ else:
+ log.debug(skip_msg)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..0f8a1692ba96f5e03167e7307c1c2ff5776b74d6
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/__init__.py
@@ -0,0 +1,23 @@
+"""distutils.command
+
+Package containing implementation of all the standard Distutils
+commands."""
+
+__all__ = [
+ 'build',
+ 'build_py',
+ 'build_ext',
+ 'build_clib',
+ 'build_scripts',
+ 'clean',
+ 'install',
+ 'install_lib',
+ 'install_headers',
+ 'install_scripts',
+ 'install_data',
+ 'sdist',
+ 'bdist',
+ 'bdist_dumb',
+ 'bdist_rpm',
+ 'check',
+]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/_framework_compat.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/_framework_compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..00d34bc7d8c85126dbae716ebfa48e35b0833222
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/_framework_compat.py
@@ -0,0 +1,54 @@
+"""
+Backward compatibility for homebrew builds on macOS.
+"""
+
+import functools
+import os
+import subprocess
+import sys
+import sysconfig
+
+
+@functools.lru_cache
+def enabled():
+ """
+ Only enabled for Python 3.9 framework homebrew builds
+ except ensurepip and venv.
+ """
+ PY39 = (3, 9) < sys.version_info < (3, 10)
+ framework = sys.platform == 'darwin' and sys._framework
+ homebrew = "Cellar" in sysconfig.get_config_var('projectbase')
+ venv = sys.prefix != sys.base_prefix
+ ensurepip = os.environ.get("ENSUREPIP_OPTIONS")
+ return PY39 and framework and homebrew and not venv and not ensurepip
+
+
+schemes = dict(
+ osx_framework_library=dict(
+ stdlib='{installed_base}/{platlibdir}/python{py_version_short}',
+ platstdlib='{platbase}/{platlibdir}/python{py_version_short}',
+ purelib='{homebrew_prefix}/lib/python{py_version_short}/site-packages',
+ platlib='{homebrew_prefix}/{platlibdir}/python{py_version_short}/site-packages',
+ include='{installed_base}/include/python{py_version_short}{abiflags}',
+ platinclude='{installed_platbase}/include/python{py_version_short}{abiflags}',
+ scripts='{homebrew_prefix}/bin',
+ data='{homebrew_prefix}',
+ )
+)
+
+
+@functools.lru_cache
+def vars():
+ if not enabled():
+ return {}
+ homebrew_prefix = subprocess.check_output(['brew', '--prefix'], text=True).strip()
+ return locals()
+
+
+def scheme(name):
+ """
+ Override the selected scheme for posix_prefix.
+ """
+ if not enabled() or not name.endswith('_prefix'):
+ return name
+ return 'osx_framework_library'
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist.py
new file mode 100644
index 0000000000000000000000000000000000000000..07811aab27ad7fcd2303883024243e2f52c2bbcb
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist.py
@@ -0,0 +1,167 @@
+"""distutils.command.bdist
+
+Implements the Distutils 'bdist' command (create a built [binary]
+distribution)."""
+
+from __future__ import annotations
+
+import os
+import warnings
+from collections.abc import Callable
+from typing import TYPE_CHECKING, ClassVar
+
+from ..core import Command
+from ..errors import DistutilsOptionError, DistutilsPlatformError
+from ..util import get_platform
+
+if TYPE_CHECKING:
+ from typing_extensions import deprecated
+else:
+
+ def deprecated(message):
+ return lambda fn: fn
+
+
+def show_formats():
+ """Print list of available formats (arguments to "--format" option)."""
+ from ..fancy_getopt import FancyGetopt
+
+ formats = [
+ ("formats=" + format, None, bdist.format_commands[format][1])
+ for format in bdist.format_commands
+ ]
+ pretty_printer = FancyGetopt(formats)
+ pretty_printer.print_help("List of available distribution formats:")
+
+
+class ListCompat(dict[str, tuple[str, str]]):
+ # adapter to allow for Setuptools compatibility in format_commands
+ @deprecated("format_commands is now a dict. append is deprecated.")
+ def append(self, item: object) -> None:
+ warnings.warn(
+ "format_commands is now a dict. append is deprecated.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+
+
+class bdist(Command):
+ description = "create a built (binary) distribution"
+
+ user_options = [
+ ('bdist-base=', 'b', "temporary directory for creating built distributions"),
+ (
+ 'plat-name=',
+ 'p',
+ "platform name to embed in generated filenames "
+ f"[default: {get_platform()}]",
+ ),
+ ('formats=', None, "formats for distribution (comma-separated list)"),
+ (
+ 'dist-dir=',
+ 'd',
+ "directory to put final built distributions in [default: dist]",
+ ),
+ ('skip-build', None, "skip rebuilding everything (for testing/debugging)"),
+ (
+ 'owner=',
+ 'u',
+ "Owner name used when creating a tar file [default: current user]",
+ ),
+ (
+ 'group=',
+ 'g',
+ "Group name used when creating a tar file [default: current group]",
+ ),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['skip-build']
+
+ help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], object]]]] = [
+ ('help-formats', None, "lists available distribution formats", show_formats),
+ ]
+
+ # The following commands do not take a format option from bdist
+ no_format_option: ClassVar[tuple[str, ...]] = ('bdist_rpm',)
+
+ # This won't do in reality: will need to distinguish RPM-ish Linux,
+ # Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS.
+ default_format: ClassVar[dict[str, str]] = {'posix': 'gztar', 'nt': 'zip'}
+
+ # Define commands in preferred order for the --help-formats option
+ format_commands = ListCompat({
+ 'rpm': ('bdist_rpm', "RPM distribution"),
+ 'gztar': ('bdist_dumb', "gzip'ed tar file"),
+ 'bztar': ('bdist_dumb', "bzip2'ed tar file"),
+ 'xztar': ('bdist_dumb', "xz'ed tar file"),
+ 'ztar': ('bdist_dumb', "compressed tar file"),
+ 'tar': ('bdist_dumb', "tar file"),
+ 'zip': ('bdist_dumb', "ZIP file"),
+ })
+
+ # for compatibility until consumers only reference format_commands
+ format_command = format_commands
+
+ def initialize_options(self):
+ self.bdist_base = None
+ self.plat_name = None
+ self.formats = None
+ self.dist_dir = None
+ self.skip_build = False
+ self.group = None
+ self.owner = None
+
+ def finalize_options(self) -> None:
+ # have to finalize 'plat_name' before 'bdist_base'
+ if self.plat_name is None:
+ if self.skip_build:
+ self.plat_name = get_platform()
+ else:
+ self.plat_name = self.get_finalized_command('build').plat_name
+
+ # 'bdist_base' -- parent of per-built-distribution-format
+ # temporary directories (eg. we'll probably have
+ # "build/bdist./dumb", "build/bdist./rpm", etc.)
+ if self.bdist_base is None:
+ build_base = self.get_finalized_command('build').build_base
+ self.bdist_base = os.path.join(build_base, 'bdist.' + self.plat_name)
+
+ self.ensure_string_list('formats')
+ if self.formats is None:
+ try:
+ self.formats = [self.default_format[os.name]]
+ except KeyError:
+ raise DistutilsPlatformError(
+ "don't know how to create built distributions "
+ f"on platform {os.name}"
+ )
+
+ if self.dist_dir is None:
+ self.dist_dir = "dist"
+
+ def run(self) -> None:
+ # Figure out which sub-commands we need to run.
+ commands = []
+ for format in self.formats:
+ try:
+ commands.append(self.format_commands[format][0])
+ except KeyError:
+ raise DistutilsOptionError(f"invalid format '{format}'")
+
+ # Reinitialize and run each command.
+ for i in range(len(self.formats)):
+ cmd_name = commands[i]
+ sub_cmd = self.reinitialize_command(cmd_name)
+ if cmd_name not in self.no_format_option:
+ sub_cmd.format = self.formats[i]
+
+ # passing the owner and group names for tar archiving
+ if cmd_name == 'bdist_dumb':
+ sub_cmd.owner = self.owner
+ sub_cmd.group = self.group
+
+ # If we're going to need to run this command again, tell it to
+ # keep its temporary files around so subsequent runs go faster.
+ if cmd_name in commands[i + 1 :]:
+ sub_cmd.keep_temp = True
+ self.run_command(cmd_name)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist_dumb.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist_dumb.py
new file mode 100644
index 0000000000000000000000000000000000000000..ccad66f43127cb18b8e592810995a7092f843041
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist_dumb.py
@@ -0,0 +1,141 @@
+"""distutils.command.bdist_dumb
+
+Implements the Distutils 'bdist_dumb' command (create a "dumb" built
+distribution -- i.e., just an archive to be unpacked under $prefix or
+$exec_prefix)."""
+
+import os
+from distutils._log import log
+from typing import ClassVar
+
+from ..core import Command
+from ..dir_util import ensure_relative, remove_tree
+from ..errors import DistutilsPlatformError
+from ..sysconfig import get_python_version
+from ..util import get_platform
+
+
+class bdist_dumb(Command):
+ description = "create a \"dumb\" built distribution"
+
+ user_options = [
+ ('bdist-dir=', 'd', "temporary directory for creating the distribution"),
+ (
+ 'plat-name=',
+ 'p',
+ "platform name to embed in generated filenames "
+ f"[default: {get_platform()}]",
+ ),
+ (
+ 'format=',
+ 'f',
+ "archive format to create (tar, gztar, bztar, xztar, ztar, zip)",
+ ),
+ (
+ 'keep-temp',
+ 'k',
+ "keep the pseudo-installation tree around after creating the distribution archive",
+ ),
+ ('dist-dir=', 'd', "directory to put final built distributions in"),
+ ('skip-build', None, "skip rebuilding everything (for testing/debugging)"),
+ (
+ 'relative',
+ None,
+ "build the archive using relative paths [default: false]",
+ ),
+ (
+ 'owner=',
+ 'u',
+ "Owner name used when creating a tar file [default: current user]",
+ ),
+ (
+ 'group=',
+ 'g',
+ "Group name used when creating a tar file [default: current group]",
+ ),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['keep-temp', 'skip-build', 'relative']
+
+ default_format = {'posix': 'gztar', 'nt': 'zip'}
+
+ def initialize_options(self):
+ self.bdist_dir = None
+ self.plat_name = None
+ self.format = None
+ self.keep_temp = False
+ self.dist_dir = None
+ self.skip_build = None
+ self.relative = False
+ self.owner = None
+ self.group = None
+
+ def finalize_options(self):
+ if self.bdist_dir is None:
+ bdist_base = self.get_finalized_command('bdist').bdist_base
+ self.bdist_dir = os.path.join(bdist_base, 'dumb')
+
+ if self.format is None:
+ try:
+ self.format = self.default_format[os.name]
+ except KeyError:
+ raise DistutilsPlatformError(
+ "don't know how to create dumb built distributions "
+ f"on platform {os.name}"
+ )
+
+ self.set_undefined_options(
+ 'bdist',
+ ('dist_dir', 'dist_dir'),
+ ('plat_name', 'plat_name'),
+ ('skip_build', 'skip_build'),
+ )
+
+ def run(self):
+ if not self.skip_build:
+ self.run_command('build')
+
+ install = self.reinitialize_command('install', reinit_subcommands=True)
+ install.root = self.bdist_dir
+ install.skip_build = self.skip_build
+ install.warn_dir = False
+
+ log.info("installing to %s", self.bdist_dir)
+ self.run_command('install')
+
+ # And make an archive relative to the root of the
+ # pseudo-installation tree.
+ archive_basename = f"{self.distribution.get_fullname()}.{self.plat_name}"
+
+ pseudoinstall_root = os.path.join(self.dist_dir, archive_basename)
+ if not self.relative:
+ archive_root = self.bdist_dir
+ else:
+ if self.distribution.has_ext_modules() and (
+ install.install_base != install.install_platbase
+ ):
+ raise DistutilsPlatformError(
+ "can't make a dumb built distribution where "
+ f"base and platbase are different ({install.install_base!r}, {install.install_platbase!r})"
+ )
+ else:
+ archive_root = os.path.join(
+ self.bdist_dir, ensure_relative(install.install_base)
+ )
+
+ # Make the archive
+ filename = self.make_archive(
+ pseudoinstall_root,
+ self.format,
+ root_dir=archive_root,
+ owner=self.owner,
+ group=self.group,
+ )
+ if self.distribution.has_ext_modules():
+ pyversion = get_python_version()
+ else:
+ pyversion = 'any'
+ self.distribution.dist_files.append(('bdist_dumb', pyversion, filename))
+
+ if not self.keep_temp:
+ remove_tree(self.bdist_dir, dry_run=self.dry_run)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist_rpm.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist_rpm.py
new file mode 100644
index 0000000000000000000000000000000000000000..357b4e861e2e0ec44a0bf1dda6c2dd35db8b9ca8
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/bdist_rpm.py
@@ -0,0 +1,598 @@
+"""distutils.command.bdist_rpm
+
+Implements the Distutils 'bdist_rpm' command (create RPM source and binary
+distributions)."""
+
+import os
+import subprocess
+import sys
+from distutils._log import log
+from typing import ClassVar
+
+from ..core import Command
+from ..debug import DEBUG
+from ..errors import (
+ DistutilsExecError,
+ DistutilsFileError,
+ DistutilsOptionError,
+ DistutilsPlatformError,
+)
+from ..file_util import write_file
+from ..sysconfig import get_python_version
+
+
+class bdist_rpm(Command):
+ description = "create an RPM distribution"
+
+ user_options = [
+ ('bdist-base=', None, "base directory for creating built distributions"),
+ (
+ 'rpm-base=',
+ None,
+ "base directory for creating RPMs (defaults to \"rpm\" under "
+ "--bdist-base; must be specified for RPM 2)",
+ ),
+ (
+ 'dist-dir=',
+ 'd',
+ "directory to put final RPM files in (and .spec files if --spec-only)",
+ ),
+ (
+ 'python=',
+ None,
+ "path to Python interpreter to hard-code in the .spec file "
+ "[default: \"python\"]",
+ ),
+ (
+ 'fix-python',
+ None,
+ "hard-code the exact path to the current Python interpreter in "
+ "the .spec file",
+ ),
+ ('spec-only', None, "only regenerate spec file"),
+ ('source-only', None, "only generate source RPM"),
+ ('binary-only', None, "only generate binary RPM"),
+ ('use-bzip2', None, "use bzip2 instead of gzip to create source distribution"),
+ # More meta-data: too RPM-specific to put in the setup script,
+ # but needs to go in the .spec file -- so we make these options
+ # to "bdist_rpm". The idea is that packagers would put this
+ # info in setup.cfg, although they are of course free to
+ # supply it on the command line.
+ (
+ 'distribution-name=',
+ None,
+ "name of the (Linux) distribution to which this "
+ "RPM applies (*not* the name of the module distribution!)",
+ ),
+ ('group=', None, "package classification [default: \"Development/Libraries\"]"),
+ ('release=', None, "RPM release number"),
+ ('serial=', None, "RPM serial number"),
+ (
+ 'vendor=',
+ None,
+ "RPM \"vendor\" (eg. \"Joe Blow \") "
+ "[default: maintainer or author from setup script]",
+ ),
+ (
+ 'packager=',
+ None,
+ "RPM packager (eg. \"Jane Doe \") [default: vendor]",
+ ),
+ ('doc-files=', None, "list of documentation files (space or comma-separated)"),
+ ('changelog=', None, "RPM changelog"),
+ ('icon=', None, "name of icon file"),
+ ('provides=', None, "capabilities provided by this package"),
+ ('requires=', None, "capabilities required by this package"),
+ ('conflicts=', None, "capabilities which conflict with this package"),
+ ('build-requires=', None, "capabilities required to build this package"),
+ ('obsoletes=', None, "capabilities made obsolete by this package"),
+ ('no-autoreq', None, "do not automatically calculate dependencies"),
+ # Actions to take when building RPM
+ ('keep-temp', 'k', "don't clean up RPM build directory"),
+ ('no-keep-temp', None, "clean up RPM build directory [default]"),
+ (
+ 'use-rpm-opt-flags',
+ None,
+ "compile with RPM_OPT_FLAGS when building from source RPM",
+ ),
+ ('no-rpm-opt-flags', None, "do not pass any RPM CFLAGS to compiler"),
+ ('rpm3-mode', None, "RPM 3 compatibility mode (default)"),
+ ('rpm2-mode', None, "RPM 2 compatibility mode"),
+ # Add the hooks necessary for specifying custom scripts
+ ('prep-script=', None, "Specify a script for the PREP phase of RPM building"),
+ ('build-script=', None, "Specify a script for the BUILD phase of RPM building"),
+ (
+ 'pre-install=',
+ None,
+ "Specify a script for the pre-INSTALL phase of RPM building",
+ ),
+ (
+ 'install-script=',
+ None,
+ "Specify a script for the INSTALL phase of RPM building",
+ ),
+ (
+ 'post-install=',
+ None,
+ "Specify a script for the post-INSTALL phase of RPM building",
+ ),
+ (
+ 'pre-uninstall=',
+ None,
+ "Specify a script for the pre-UNINSTALL phase of RPM building",
+ ),
+ (
+ 'post-uninstall=',
+ None,
+ "Specify a script for the post-UNINSTALL phase of RPM building",
+ ),
+ ('clean-script=', None, "Specify a script for the CLEAN phase of RPM building"),
+ (
+ 'verify-script=',
+ None,
+ "Specify a script for the VERIFY phase of the RPM build",
+ ),
+ # Allow a packager to explicitly force an architecture
+ ('force-arch=', None, "Force an architecture onto the RPM build process"),
+ ('quiet', 'q', "Run the INSTALL phase of RPM building in quiet mode"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = [
+ 'keep-temp',
+ 'use-rpm-opt-flags',
+ 'rpm3-mode',
+ 'no-autoreq',
+ 'quiet',
+ ]
+
+ negative_opt: ClassVar[dict[str, str]] = {
+ 'no-keep-temp': 'keep-temp',
+ 'no-rpm-opt-flags': 'use-rpm-opt-flags',
+ 'rpm2-mode': 'rpm3-mode',
+ }
+
+ def initialize_options(self):
+ self.bdist_base = None
+ self.rpm_base = None
+ self.dist_dir = None
+ self.python = None
+ self.fix_python = None
+ self.spec_only = None
+ self.binary_only = None
+ self.source_only = None
+ self.use_bzip2 = None
+
+ self.distribution_name = None
+ self.group = None
+ self.release = None
+ self.serial = None
+ self.vendor = None
+ self.packager = None
+ self.doc_files = None
+ self.changelog = None
+ self.icon = None
+
+ self.prep_script = None
+ self.build_script = None
+ self.install_script = None
+ self.clean_script = None
+ self.verify_script = None
+ self.pre_install = None
+ self.post_install = None
+ self.pre_uninstall = None
+ self.post_uninstall = None
+ self.prep = None
+ self.provides = None
+ self.requires = None
+ self.conflicts = None
+ self.build_requires = None
+ self.obsoletes = None
+
+ self.keep_temp = False
+ self.use_rpm_opt_flags = True
+ self.rpm3_mode = True
+ self.no_autoreq = False
+
+ self.force_arch = None
+ self.quiet = False
+
+ def finalize_options(self) -> None:
+ self.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
+ if self.rpm_base is None:
+ if not self.rpm3_mode:
+ raise DistutilsOptionError("you must specify --rpm-base in RPM 2 mode")
+ self.rpm_base = os.path.join(self.bdist_base, "rpm")
+
+ if self.python is None:
+ if self.fix_python:
+ self.python = sys.executable
+ else:
+ self.python = "python3"
+ elif self.fix_python:
+ raise DistutilsOptionError(
+ "--python and --fix-python are mutually exclusive options"
+ )
+
+ if os.name != 'posix':
+ raise DistutilsPlatformError(
+ f"don't know how to create RPM distributions on platform {os.name}"
+ )
+ if self.binary_only and self.source_only:
+ raise DistutilsOptionError(
+ "cannot supply both '--source-only' and '--binary-only'"
+ )
+
+ # don't pass CFLAGS to pure python distributions
+ if not self.distribution.has_ext_modules():
+ self.use_rpm_opt_flags = False
+
+ self.set_undefined_options('bdist', ('dist_dir', 'dist_dir'))
+ self.finalize_package_data()
+
+ def finalize_package_data(self) -> None:
+ self.ensure_string('group', "Development/Libraries")
+ self.ensure_string(
+ 'vendor',
+ f"{self.distribution.get_contact()} <{self.distribution.get_contact_email()}>",
+ )
+ self.ensure_string('packager')
+ self.ensure_string_list('doc_files')
+ if isinstance(self.doc_files, list):
+ for readme in ('README', 'README.txt'):
+ if os.path.exists(readme) and readme not in self.doc_files:
+ self.doc_files.append(readme)
+
+ self.ensure_string('release', "1")
+ self.ensure_string('serial') # should it be an int?
+
+ self.ensure_string('distribution_name')
+
+ self.ensure_string('changelog')
+ # Format changelog correctly
+ self.changelog = self._format_changelog(self.changelog)
+
+ self.ensure_filename('icon')
+
+ self.ensure_filename('prep_script')
+ self.ensure_filename('build_script')
+ self.ensure_filename('install_script')
+ self.ensure_filename('clean_script')
+ self.ensure_filename('verify_script')
+ self.ensure_filename('pre_install')
+ self.ensure_filename('post_install')
+ self.ensure_filename('pre_uninstall')
+ self.ensure_filename('post_uninstall')
+
+ # XXX don't forget we punted on summaries and descriptions -- they
+ # should be handled here eventually!
+
+ # Now *this* is some meta-data that belongs in the setup script...
+ self.ensure_string_list('provides')
+ self.ensure_string_list('requires')
+ self.ensure_string_list('conflicts')
+ self.ensure_string_list('build_requires')
+ self.ensure_string_list('obsoletes')
+
+ self.ensure_string('force_arch')
+
+ def run(self) -> None: # noqa: C901
+ if DEBUG:
+ print("before _get_package_data():")
+ print("vendor =", self.vendor)
+ print("packager =", self.packager)
+ print("doc_files =", self.doc_files)
+ print("changelog =", self.changelog)
+
+ # make directories
+ if self.spec_only:
+ spec_dir = self.dist_dir
+ self.mkpath(spec_dir)
+ else:
+ rpm_dir = {}
+ for d in ('SOURCES', 'SPECS', 'BUILD', 'RPMS', 'SRPMS'):
+ rpm_dir[d] = os.path.join(self.rpm_base, d)
+ self.mkpath(rpm_dir[d])
+ spec_dir = rpm_dir['SPECS']
+
+ # Spec file goes into 'dist_dir' if '--spec-only specified',
+ # build/rpm. otherwise.
+ spec_path = os.path.join(spec_dir, f"{self.distribution.get_name()}.spec")
+ self.execute(
+ write_file, (spec_path, self._make_spec_file()), f"writing '{spec_path}'"
+ )
+
+ if self.spec_only: # stop if requested
+ return
+
+ # Make a source distribution and copy to SOURCES directory with
+ # optional icon.
+ saved_dist_files = self.distribution.dist_files[:]
+ sdist = self.reinitialize_command('sdist')
+ if self.use_bzip2:
+ sdist.formats = ['bztar']
+ else:
+ sdist.formats = ['gztar']
+ self.run_command('sdist')
+ self.distribution.dist_files = saved_dist_files
+
+ source = sdist.get_archive_files()[0]
+ source_dir = rpm_dir['SOURCES']
+ self.copy_file(source, source_dir)
+
+ if self.icon:
+ if os.path.exists(self.icon):
+ self.copy_file(self.icon, source_dir)
+ else:
+ raise DistutilsFileError(f"icon file '{self.icon}' does not exist")
+
+ # build package
+ log.info("building RPMs")
+ rpm_cmd = ['rpmbuild']
+
+ if self.source_only: # what kind of RPMs?
+ rpm_cmd.append('-bs')
+ elif self.binary_only:
+ rpm_cmd.append('-bb')
+ else:
+ rpm_cmd.append('-ba')
+ rpm_cmd.extend(['--define', f'__python {self.python}'])
+ if self.rpm3_mode:
+ rpm_cmd.extend(['--define', f'_topdir {os.path.abspath(self.rpm_base)}'])
+ if not self.keep_temp:
+ rpm_cmd.append('--clean')
+
+ if self.quiet:
+ rpm_cmd.append('--quiet')
+
+ rpm_cmd.append(spec_path)
+ # Determine the binary rpm names that should be built out of this spec
+ # file
+ # Note that some of these may not be really built (if the file
+ # list is empty)
+ nvr_string = "%{name}-%{version}-%{release}"
+ src_rpm = nvr_string + ".src.rpm"
+ non_src_rpm = "%{arch}/" + nvr_string + ".%{arch}.rpm"
+ q_cmd = rf"rpm -q --qf '{src_rpm} {non_src_rpm}\n' --specfile '{spec_path}'"
+
+ out = os.popen(q_cmd)
+ try:
+ binary_rpms = []
+ source_rpm = None
+ while True:
+ line = out.readline()
+ if not line:
+ break
+ ell = line.strip().split()
+ assert len(ell) == 2
+ binary_rpms.append(ell[1])
+ # The source rpm is named after the first entry in the spec file
+ if source_rpm is None:
+ source_rpm = ell[0]
+
+ status = out.close()
+ if status:
+ raise DistutilsExecError(f"Failed to execute: {q_cmd!r}")
+
+ finally:
+ out.close()
+
+ self.spawn(rpm_cmd)
+
+ if not self.dry_run:
+ if self.distribution.has_ext_modules():
+ pyversion = get_python_version()
+ else:
+ pyversion = 'any'
+
+ if not self.binary_only:
+ srpm = os.path.join(rpm_dir['SRPMS'], source_rpm)
+ assert os.path.exists(srpm)
+ self.move_file(srpm, self.dist_dir)
+ filename = os.path.join(self.dist_dir, source_rpm)
+ self.distribution.dist_files.append(('bdist_rpm', pyversion, filename))
+
+ if not self.source_only:
+ for rpm in binary_rpms:
+ rpm = os.path.join(rpm_dir['RPMS'], rpm)
+ if os.path.exists(rpm):
+ self.move_file(rpm, self.dist_dir)
+ filename = os.path.join(self.dist_dir, os.path.basename(rpm))
+ self.distribution.dist_files.append((
+ 'bdist_rpm',
+ pyversion,
+ filename,
+ ))
+
+ def _dist_path(self, path):
+ return os.path.join(self.dist_dir, os.path.basename(path))
+
+ def _make_spec_file(self): # noqa: C901
+ """Generate the text of an RPM spec file and return it as a
+ list of strings (one per line).
+ """
+ # definitions and headers
+ spec_file = [
+ '%define name ' + self.distribution.get_name(),
+ '%define version ' + self.distribution.get_version().replace('-', '_'),
+ '%define unmangled_version ' + self.distribution.get_version(),
+ '%define release ' + self.release.replace('-', '_'),
+ '',
+ 'Summary: ' + (self.distribution.get_description() or "UNKNOWN"),
+ ]
+
+ # Workaround for #14443 which affects some RPM based systems such as
+ # RHEL6 (and probably derivatives)
+ vendor_hook = subprocess.getoutput('rpm --eval %{__os_install_post}')
+ # Generate a potential replacement value for __os_install_post (whilst
+ # normalizing the whitespace to simplify the test for whether the
+ # invocation of brp-python-bytecompile passes in __python):
+ vendor_hook = '\n'.join([
+ f' {line.strip()} \\' for line in vendor_hook.splitlines()
+ ])
+ problem = "brp-python-bytecompile \\\n"
+ fixed = "brp-python-bytecompile %{__python} \\\n"
+ fixed_hook = vendor_hook.replace(problem, fixed)
+ if fixed_hook != vendor_hook:
+ spec_file.append('# Workaround for https://bugs.python.org/issue14443')
+ spec_file.append('%define __os_install_post ' + fixed_hook + '\n')
+
+ # put locale summaries into spec file
+ # XXX not supported for now (hard to put a dictionary
+ # in a config file -- arg!)
+ # for locale in self.summaries.keys():
+ # spec_file.append('Summary(%s): %s' % (locale,
+ # self.summaries[locale]))
+
+ spec_file.extend([
+ 'Name: %{name}',
+ 'Version: %{version}',
+ 'Release: %{release}',
+ ])
+
+ # XXX yuck! this filename is available from the "sdist" command,
+ # but only after it has run: and we create the spec file before
+ # running "sdist", in case of --spec-only.
+ if self.use_bzip2:
+ spec_file.append('Source0: %{name}-%{unmangled_version}.tar.bz2')
+ else:
+ spec_file.append('Source0: %{name}-%{unmangled_version}.tar.gz')
+
+ spec_file.extend([
+ 'License: ' + (self.distribution.get_license() or "UNKNOWN"),
+ 'Group: ' + self.group,
+ 'BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot',
+ 'Prefix: %{_prefix}',
+ ])
+
+ if not self.force_arch:
+ # noarch if no extension modules
+ if not self.distribution.has_ext_modules():
+ spec_file.append('BuildArch: noarch')
+ else:
+ spec_file.append(f'BuildArch: {self.force_arch}')
+
+ for field in (
+ 'Vendor',
+ 'Packager',
+ 'Provides',
+ 'Requires',
+ 'Conflicts',
+ 'Obsoletes',
+ ):
+ val = getattr(self, field.lower())
+ if isinstance(val, list):
+ spec_file.append('{}: {}'.format(field, ' '.join(val)))
+ elif val is not None:
+ spec_file.append(f'{field}: {val}')
+
+ if self.distribution.get_url():
+ spec_file.append('Url: ' + self.distribution.get_url())
+
+ if self.distribution_name:
+ spec_file.append('Distribution: ' + self.distribution_name)
+
+ if self.build_requires:
+ spec_file.append('BuildRequires: ' + ' '.join(self.build_requires))
+
+ if self.icon:
+ spec_file.append('Icon: ' + os.path.basename(self.icon))
+
+ if self.no_autoreq:
+ spec_file.append('AutoReq: 0')
+
+ spec_file.extend([
+ '',
+ '%description',
+ self.distribution.get_long_description() or "",
+ ])
+
+ # put locale descriptions into spec file
+ # XXX again, suppressed because config file syntax doesn't
+ # easily support this ;-(
+ # for locale in self.descriptions.keys():
+ # spec_file.extend([
+ # '',
+ # '%description -l ' + locale,
+ # self.descriptions[locale],
+ # ])
+
+ # rpm scripts
+ # figure out default build script
+ def_setup_call = f"{self.python} {os.path.basename(sys.argv[0])}"
+ def_build = f"{def_setup_call} build"
+ if self.use_rpm_opt_flags:
+ def_build = 'env CFLAGS="$RPM_OPT_FLAGS" ' + def_build
+
+ # insert contents of files
+
+ # XXX this is kind of misleading: user-supplied options are files
+ # that we open and interpolate into the spec file, but the defaults
+ # are just text that we drop in as-is. Hmmm.
+
+ install_cmd = f'{def_setup_call} install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES'
+
+ script_options = [
+ ('prep', 'prep_script', "%setup -n %{name}-%{unmangled_version}"),
+ ('build', 'build_script', def_build),
+ ('install', 'install_script', install_cmd),
+ ('clean', 'clean_script', "rm -rf $RPM_BUILD_ROOT"),
+ ('verifyscript', 'verify_script', None),
+ ('pre', 'pre_install', None),
+ ('post', 'post_install', None),
+ ('preun', 'pre_uninstall', None),
+ ('postun', 'post_uninstall', None),
+ ]
+
+ for rpm_opt, attr, default in script_options:
+ # Insert contents of file referred to, if no file is referred to
+ # use 'default' as contents of script
+ val = getattr(self, attr)
+ if val or default:
+ spec_file.extend([
+ '',
+ '%' + rpm_opt,
+ ])
+ if val:
+ with open(val) as f:
+ spec_file.extend(f.read().split('\n'))
+ else:
+ spec_file.append(default)
+
+ # files section
+ spec_file.extend([
+ '',
+ '%files -f INSTALLED_FILES',
+ '%defattr(-,root,root)',
+ ])
+
+ if self.doc_files:
+ spec_file.append('%doc ' + ' '.join(self.doc_files))
+
+ if self.changelog:
+ spec_file.extend([
+ '',
+ '%changelog',
+ ])
+ spec_file.extend(self.changelog)
+
+ return spec_file
+
+ def _format_changelog(self, changelog):
+ """Format the changelog correctly and convert it to a list of strings"""
+ if not changelog:
+ return changelog
+ new_changelog = []
+ for line in changelog.strip().split('\n'):
+ line = line.strip()
+ if line[0] == '*':
+ new_changelog.extend(['', line])
+ elif line[0] == '-':
+ new_changelog.append(line)
+ else:
+ new_changelog.append(' ' + line)
+
+ # strip trailing newline inserted by first changelog entry
+ if not new_changelog[0]:
+ del new_changelog[0]
+
+ return new_changelog
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build.py
new file mode 100644
index 0000000000000000000000000000000000000000..6a8303a954ea705c547e2014dc6b51d9d987a532
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build.py
@@ -0,0 +1,156 @@
+"""distutils.command.build
+
+Implements the Distutils 'build' command."""
+
+from __future__ import annotations
+
+import os
+import sys
+import sysconfig
+from collections.abc import Callable
+from typing import ClassVar
+
+from ..ccompiler import show_compilers
+from ..core import Command
+from ..errors import DistutilsOptionError
+from ..util import get_platform
+
+
+class build(Command):
+ description = "build everything needed to install"
+
+ user_options = [
+ ('build-base=', 'b', "base directory for build library"),
+ ('build-purelib=', None, "build directory for platform-neutral distributions"),
+ ('build-platlib=', None, "build directory for platform-specific distributions"),
+ (
+ 'build-lib=',
+ None,
+ "build directory for all distribution (defaults to either build-purelib or build-platlib",
+ ),
+ ('build-scripts=', None, "build directory for scripts"),
+ ('build-temp=', 't', "temporary build directory"),
+ (
+ 'plat-name=',
+ 'p',
+ f"platform name to build for, if supported [default: {get_platform()}]",
+ ),
+ ('compiler=', 'c', "specify the compiler type"),
+ ('parallel=', 'j', "number of parallel build jobs"),
+ ('debug', 'g', "compile extensions and libraries with debugging information"),
+ ('force', 'f', "forcibly build everything (ignore file timestamps)"),
+ ('executable=', 'e', "specify final destination interpreter path (build.py)"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['debug', 'force']
+
+ help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], object]]]] = [
+ ('help-compiler', None, "list available compilers", show_compilers),
+ ]
+
+ def initialize_options(self):
+ self.build_base = 'build'
+ # these are decided only after 'build_base' has its final value
+ # (unless overridden by the user or client)
+ self.build_purelib = None
+ self.build_platlib = None
+ self.build_lib = None
+ self.build_temp = None
+ self.build_scripts = None
+ self.compiler = None
+ self.plat_name = None
+ self.debug = None
+ self.force = False
+ self.executable = None
+ self.parallel = None
+
+ def finalize_options(self) -> None: # noqa: C901
+ if self.plat_name is None:
+ self.plat_name = get_platform()
+ else:
+ # plat-name only supported for windows (other platforms are
+ # supported via ./configure flags, if at all). Avoid misleading
+ # other platforms.
+ if os.name != 'nt':
+ raise DistutilsOptionError(
+ "--plat-name only supported on Windows (try "
+ "using './configure --help' on your platform)"
+ )
+
+ plat_specifier = f".{self.plat_name}-{sys.implementation.cache_tag}"
+
+ # Python 3.13+ with --disable-gil shouldn't share build directories
+ if sysconfig.get_config_var('Py_GIL_DISABLED'):
+ plat_specifier += 't'
+
+ # Make it so Python 2.x and Python 2.x with --with-pydebug don't
+ # share the same build directories. Doing so confuses the build
+ # process for C modules
+ if hasattr(sys, 'gettotalrefcount'):
+ plat_specifier += '-pydebug'
+
+ # 'build_purelib' and 'build_platlib' just default to 'lib' and
+ # 'lib.' under the base build directory. We only use one of
+ # them for a given distribution, though --
+ if self.build_purelib is None:
+ self.build_purelib = os.path.join(self.build_base, 'lib')
+ if self.build_platlib is None:
+ self.build_platlib = os.path.join(self.build_base, 'lib' + plat_specifier)
+
+ # 'build_lib' is the actual directory that we will use for this
+ # particular module distribution -- if user didn't supply it, pick
+ # one of 'build_purelib' or 'build_platlib'.
+ if self.build_lib is None:
+ if self.distribution.has_ext_modules():
+ self.build_lib = self.build_platlib
+ else:
+ self.build_lib = self.build_purelib
+
+ # 'build_temp' -- temporary directory for compiler turds,
+ # "build/temp."
+ if self.build_temp is None:
+ self.build_temp = os.path.join(self.build_base, 'temp' + plat_specifier)
+ if self.build_scripts is None:
+ self.build_scripts = os.path.join(
+ self.build_base,
+ f'scripts-{sys.version_info.major}.{sys.version_info.minor}',
+ )
+
+ if self.executable is None and sys.executable:
+ self.executable = os.path.normpath(sys.executable)
+
+ if isinstance(self.parallel, str):
+ try:
+ self.parallel = int(self.parallel)
+ except ValueError:
+ raise DistutilsOptionError("parallel should be an integer")
+
+ def run(self) -> None:
+ # Run all relevant sub-commands. This will be some subset of:
+ # - build_py - pure Python modules
+ # - build_clib - standalone C libraries
+ # - build_ext - Python extensions
+ # - build_scripts - (Python) scripts
+ for cmd_name in self.get_sub_commands():
+ self.run_command(cmd_name)
+
+ # -- Predicates for the sub-command list ---------------------------
+
+ def has_pure_modules(self):
+ return self.distribution.has_pure_modules()
+
+ def has_c_libraries(self):
+ return self.distribution.has_c_libraries()
+
+ def has_ext_modules(self):
+ return self.distribution.has_ext_modules()
+
+ def has_scripts(self):
+ return self.distribution.has_scripts()
+
+ sub_commands = [
+ ('build_py', has_pure_modules),
+ ('build_clib', has_c_libraries),
+ ('build_ext', has_ext_modules),
+ ('build_scripts', has_scripts),
+ ]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_clib.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_clib.py
new file mode 100644
index 0000000000000000000000000000000000000000..8b65b3d8ece0253e0c80cfea33160c7741a2435f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_clib.py
@@ -0,0 +1,201 @@
+"""distutils.command.build_clib
+
+Implements the Distutils 'build_clib' command, to build a C/C++ library
+that is included in the module distribution and needed by an extension
+module."""
+
+# XXX this module has *lots* of code ripped-off quite transparently from
+# build_ext.py -- not surprisingly really, as the work required to build
+# a static library from a collection of C source files is not really all
+# that different from what's required to build a shared object file from
+# a collection of C source files. Nevertheless, I haven't done the
+# necessary refactoring to account for the overlap in code between the
+# two modules, mainly because a number of subtle details changed in the
+# cut 'n paste. Sigh.
+from __future__ import annotations
+
+import os
+from collections.abc import Callable
+from distutils._log import log
+from typing import ClassVar
+
+from ..ccompiler import new_compiler, show_compilers
+from ..core import Command
+from ..errors import DistutilsSetupError
+from ..sysconfig import customize_compiler
+
+
+class build_clib(Command):
+ description = "build C/C++ libraries used by Python extensions"
+
+ user_options: ClassVar[list[tuple[str, str, str]]] = [
+ ('build-clib=', 'b', "directory to build C/C++ libraries to"),
+ ('build-temp=', 't', "directory to put temporary build by-products"),
+ ('debug', 'g', "compile with debugging information"),
+ ('force', 'f', "forcibly build everything (ignore file timestamps)"),
+ ('compiler=', 'c', "specify the compiler type"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['debug', 'force']
+
+ help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], object]]]] = [
+ ('help-compiler', None, "list available compilers", show_compilers),
+ ]
+
+ def initialize_options(self):
+ self.build_clib = None
+ self.build_temp = None
+
+ # List of libraries to build
+ self.libraries = None
+
+ # Compilation options for all libraries
+ self.include_dirs = None
+ self.define = None
+ self.undef = None
+ self.debug = None
+ self.force = False
+ self.compiler = None
+
+ def finalize_options(self) -> None:
+ # This might be confusing: both build-clib and build-temp default
+ # to build-temp as defined by the "build" command. This is because
+ # I think that C libraries are really just temporary build
+ # by-products, at least from the point of view of building Python
+ # extensions -- but I want to keep my options open.
+ self.set_undefined_options(
+ 'build',
+ ('build_temp', 'build_clib'),
+ ('build_temp', 'build_temp'),
+ ('compiler', 'compiler'),
+ ('debug', 'debug'),
+ ('force', 'force'),
+ )
+
+ self.libraries = self.distribution.libraries
+ if self.libraries:
+ self.check_library_list(self.libraries)
+
+ if self.include_dirs is None:
+ self.include_dirs = self.distribution.include_dirs or []
+ if isinstance(self.include_dirs, str):
+ self.include_dirs = self.include_dirs.split(os.pathsep)
+
+ # XXX same as for build_ext -- what about 'self.define' and
+ # 'self.undef' ?
+
+ def run(self) -> None:
+ if not self.libraries:
+ return
+
+ self.compiler = new_compiler(
+ compiler=self.compiler, dry_run=self.dry_run, force=self.force
+ )
+ customize_compiler(self.compiler)
+
+ if self.include_dirs is not None:
+ self.compiler.set_include_dirs(self.include_dirs)
+ if self.define is not None:
+ # 'define' option is a list of (name,value) tuples
+ for name, value in self.define:
+ self.compiler.define_macro(name, value)
+ if self.undef is not None:
+ for macro in self.undef:
+ self.compiler.undefine_macro(macro)
+
+ self.build_libraries(self.libraries)
+
+ def check_library_list(self, libraries) -> None:
+ """Ensure that the list of libraries is valid.
+
+ `library` is presumably provided as a command option 'libraries'.
+ This method checks that it is a list of 2-tuples, where the tuples
+ are (library_name, build_info_dict).
+
+ Raise DistutilsSetupError if the structure is invalid anywhere;
+ just returns otherwise.
+ """
+ if not isinstance(libraries, list):
+ raise DistutilsSetupError("'libraries' option must be a list of tuples")
+
+ for lib in libraries:
+ if not isinstance(lib, tuple) and len(lib) != 2:
+ raise DistutilsSetupError("each element of 'libraries' must a 2-tuple")
+
+ name, build_info = lib
+
+ if not isinstance(name, str):
+ raise DistutilsSetupError(
+ "first element of each tuple in 'libraries' "
+ "must be a string (the library name)"
+ )
+
+ if '/' in name or (os.sep != '/' and os.sep in name):
+ raise DistutilsSetupError(
+ f"bad library name '{lib[0]}': may not contain directory separators"
+ )
+
+ if not isinstance(build_info, dict):
+ raise DistutilsSetupError(
+ "second element of each tuple in 'libraries' "
+ "must be a dictionary (build info)"
+ )
+
+ def get_library_names(self):
+ # Assume the library list is valid -- 'check_library_list()' is
+ # called from 'finalize_options()', so it should be!
+ if not self.libraries:
+ return None
+
+ lib_names = []
+ for lib_name, _build_info in self.libraries:
+ lib_names.append(lib_name)
+ return lib_names
+
+ def get_source_files(self):
+ self.check_library_list(self.libraries)
+ filenames = []
+ for lib_name, build_info in self.libraries:
+ sources = build_info.get('sources')
+ if sources is None or not isinstance(sources, (list, tuple)):
+ raise DistutilsSetupError(
+ f"in 'libraries' option (library '{lib_name}'), "
+ "'sources' must be present and must be "
+ "a list of source filenames"
+ )
+
+ filenames.extend(sources)
+ return filenames
+
+ def build_libraries(self, libraries) -> None:
+ for lib_name, build_info in libraries:
+ sources = build_info.get('sources')
+ if sources is None or not isinstance(sources, (list, tuple)):
+ raise DistutilsSetupError(
+ f"in 'libraries' option (library '{lib_name}'), "
+ "'sources' must be present and must be "
+ "a list of source filenames"
+ )
+ sources = list(sources)
+
+ log.info("building '%s' library", lib_name)
+
+ # First, compile the source code to object files in the library
+ # directory. (This should probably change to putting object
+ # files in a temporary build directory.)
+ macros = build_info.get('macros')
+ include_dirs = build_info.get('include_dirs')
+ objects = self.compiler.compile(
+ sources,
+ output_dir=self.build_temp,
+ macros=macros,
+ include_dirs=include_dirs,
+ debug=self.debug,
+ )
+
+ # Now "link" the object files together into a static library.
+ # (On Unix at least, this isn't really linking -- it just
+ # builds an archive. Whatever.)
+ self.compiler.create_static_lib(
+ objects, lib_name, output_dir=self.build_clib, debug=self.debug
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py
new file mode 100644
index 0000000000000000000000000000000000000000..ec45b4403e54d3f58459a412746bc86e4135a756
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py
@@ -0,0 +1,812 @@
+"""distutils.command.build_ext
+
+Implements the Distutils 'build_ext' command, for building extension
+modules (currently limited to C extensions, should accommodate C++
+extensions ASAP)."""
+
+from __future__ import annotations
+
+import contextlib
+import os
+import re
+import sys
+from collections.abc import Callable
+from distutils._log import log
+from site import USER_BASE
+from typing import ClassVar
+
+from .._modified import newer_group
+from ..ccompiler import new_compiler, show_compilers
+from ..core import Command
+from ..errors import (
+ CCompilerError,
+ CompileError,
+ DistutilsError,
+ DistutilsOptionError,
+ DistutilsPlatformError,
+ DistutilsSetupError,
+)
+from ..extension import Extension
+from ..sysconfig import customize_compiler, get_config_h_filename, get_python_version
+from ..util import get_platform, is_freethreaded, is_mingw
+
+# An extension name is just a dot-separated list of Python NAMEs (ie.
+# the same as a fully-qualified module name).
+extension_name_re = re.compile(r'^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$')
+
+
+class build_ext(Command):
+ description = "build C/C++ extensions (compile/link to build directory)"
+
+ # XXX thoughts on how to deal with complex command-line options like
+ # these, i.e. how to make it so fancy_getopt can suck them off the
+ # command line and make it look like setup.py defined the appropriate
+ # lists of tuples of what-have-you.
+ # - each command needs a callback to process its command-line options
+ # - Command.__init__() needs access to its share of the whole
+ # command line (must ultimately come from
+ # Distribution.parse_command_line())
+ # - it then calls the current command class' option-parsing
+ # callback to deal with weird options like -D, which have to
+ # parse the option text and churn out some custom data
+ # structure
+ # - that data structure (in this case, a list of 2-tuples)
+ # will then be present in the command object by the time
+ # we get to finalize_options() (i.e. the constructor
+ # takes care of both command-line and client options
+ # in between initialize_options() and finalize_options())
+
+ sep_by = f" (separated by '{os.pathsep}')"
+ user_options = [
+ ('build-lib=', 'b', "directory for compiled extension modules"),
+ ('build-temp=', 't', "directory for temporary files (build by-products)"),
+ (
+ 'plat-name=',
+ 'p',
+ "platform name to cross-compile for, if supported "
+ f"[default: {get_platform()}]",
+ ),
+ (
+ 'inplace',
+ 'i',
+ "ignore build-lib and put compiled extensions into the source "
+ "directory alongside your pure Python modules",
+ ),
+ (
+ 'include-dirs=',
+ 'I',
+ "list of directories to search for header files" + sep_by,
+ ),
+ ('define=', 'D', "C preprocessor macros to define"),
+ ('undef=', 'U', "C preprocessor macros to undefine"),
+ ('libraries=', 'l', "external C libraries to link with"),
+ (
+ 'library-dirs=',
+ 'L',
+ "directories to search for external C libraries" + sep_by,
+ ),
+ ('rpath=', 'R', "directories to search for shared C libraries at runtime"),
+ ('link-objects=', 'O', "extra explicit link objects to include in the link"),
+ ('debug', 'g', "compile/link with debugging information"),
+ ('force', 'f', "forcibly build everything (ignore file timestamps)"),
+ ('compiler=', 'c', "specify the compiler type"),
+ ('parallel=', 'j', "number of parallel build jobs"),
+ ('swig-cpp', None, "make SWIG create C++ files (default is C)"),
+ ('swig-opts=', None, "list of SWIG command line options"),
+ ('swig=', None, "path to the SWIG executable"),
+ ('user', None, "add user include, library and rpath"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = [
+ 'inplace',
+ 'debug',
+ 'force',
+ 'swig-cpp',
+ 'user',
+ ]
+
+ help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], object]]]] = [
+ ('help-compiler', None, "list available compilers", show_compilers),
+ ]
+
+ def initialize_options(self):
+ self.extensions = None
+ self.build_lib = None
+ self.plat_name = None
+ self.build_temp = None
+ self.inplace = False
+ self.package = None
+
+ self.include_dirs = None
+ self.define = None
+ self.undef = None
+ self.libraries = None
+ self.library_dirs = None
+ self.rpath = None
+ self.link_objects = None
+ self.debug = None
+ self.force = None
+ self.compiler = None
+ self.swig = None
+ self.swig_cpp = None
+ self.swig_opts = None
+ self.user = None
+ self.parallel = None
+
+ @staticmethod
+ def _python_lib_dir(sysconfig):
+ """
+ Resolve Python's library directory for building extensions
+ that rely on a shared Python library.
+
+ See python/cpython#44264 and python/cpython#48686
+ """
+ if not sysconfig.get_config_var('Py_ENABLE_SHARED'):
+ return
+
+ if sysconfig.python_build:
+ yield '.'
+ return
+
+ if sys.platform == 'zos':
+ # On z/OS, a user is not required to install Python to
+ # a predetermined path, but can use Python portably
+ installed_dir = sysconfig.get_config_var('base')
+ lib_dir = sysconfig.get_config_var('platlibdir')
+ yield os.path.join(installed_dir, lib_dir)
+ else:
+ # building third party extensions
+ yield sysconfig.get_config_var('LIBDIR')
+
+ def finalize_options(self) -> None: # noqa: C901
+ from distutils import sysconfig
+
+ self.set_undefined_options(
+ 'build',
+ ('build_lib', 'build_lib'),
+ ('build_temp', 'build_temp'),
+ ('compiler', 'compiler'),
+ ('debug', 'debug'),
+ ('force', 'force'),
+ ('parallel', 'parallel'),
+ ('plat_name', 'plat_name'),
+ )
+
+ if self.package is None:
+ self.package = self.distribution.ext_package
+
+ self.extensions = self.distribution.ext_modules
+
+ # Make sure Python's include directories (for Python.h, pyconfig.h,
+ # etc.) are in the include search path.
+ py_include = sysconfig.get_python_inc()
+ plat_py_include = sysconfig.get_python_inc(plat_specific=True)
+ if self.include_dirs is None:
+ self.include_dirs = self.distribution.include_dirs or []
+ if isinstance(self.include_dirs, str):
+ self.include_dirs = self.include_dirs.split(os.pathsep)
+
+ # If in a virtualenv, add its include directory
+ # Issue 16116
+ if sys.exec_prefix != sys.base_exec_prefix:
+ self.include_dirs.append(os.path.join(sys.exec_prefix, 'include'))
+
+ # Put the Python "system" include dir at the end, so that
+ # any local include dirs take precedence.
+ self.include_dirs.extend(py_include.split(os.path.pathsep))
+ if plat_py_include != py_include:
+ self.include_dirs.extend(plat_py_include.split(os.path.pathsep))
+
+ self.ensure_string_list('libraries')
+ self.ensure_string_list('link_objects')
+
+ # Life is easier if we're not forever checking for None, so
+ # simplify these options to empty lists if unset
+ if self.libraries is None:
+ self.libraries = []
+ if self.library_dirs is None:
+ self.library_dirs = []
+ elif isinstance(self.library_dirs, str):
+ self.library_dirs = self.library_dirs.split(os.pathsep)
+
+ if self.rpath is None:
+ self.rpath = []
+ elif isinstance(self.rpath, str):
+ self.rpath = self.rpath.split(os.pathsep)
+
+ # for extensions under windows use different directories
+ # for Release and Debug builds.
+ # also Python's library directory must be appended to library_dirs
+ if os.name == 'nt' and not is_mingw():
+ # the 'libs' directory is for binary installs - we assume that
+ # must be the *native* platform. But we don't really support
+ # cross-compiling via a binary install anyway, so we let it go.
+ self.library_dirs.append(os.path.join(sys.exec_prefix, 'libs'))
+ if sys.base_exec_prefix != sys.prefix: # Issue 16116
+ self.library_dirs.append(os.path.join(sys.base_exec_prefix, 'libs'))
+ if self.debug:
+ self.build_temp = os.path.join(self.build_temp, "Debug")
+ else:
+ self.build_temp = os.path.join(self.build_temp, "Release")
+
+ # Append the source distribution include and library directories,
+ # this allows distutils on windows to work in the source tree
+ self.include_dirs.append(os.path.dirname(get_config_h_filename()))
+ self.library_dirs.append(sys.base_exec_prefix)
+
+ # Use the .lib files for the correct architecture
+ if self.plat_name == 'win32':
+ suffix = 'win32'
+ else:
+ # win-amd64
+ suffix = self.plat_name[4:]
+ new_lib = os.path.join(sys.exec_prefix, 'PCbuild')
+ if suffix:
+ new_lib = os.path.join(new_lib, suffix)
+ self.library_dirs.append(new_lib)
+
+ # For extensions under Cygwin, Python's library directory must be
+ # appended to library_dirs
+ if sys.platform[:6] == 'cygwin':
+ if not sysconfig.python_build:
+ # building third party extensions
+ self.library_dirs.append(
+ os.path.join(
+ sys.prefix, "lib", "python" + get_python_version(), "config"
+ )
+ )
+ else:
+ # building python standard extensions
+ self.library_dirs.append('.')
+
+ self.library_dirs.extend(self._python_lib_dir(sysconfig))
+
+ # The argument parsing will result in self.define being a string, but
+ # it has to be a list of 2-tuples. All the preprocessor symbols
+ # specified by the 'define' option will be set to '1'. Multiple
+ # symbols can be separated with commas.
+
+ if self.define:
+ defines = self.define.split(',')
+ self.define = [(symbol, '1') for symbol in defines]
+
+ # The option for macros to undefine is also a string from the
+ # option parsing, but has to be a list. Multiple symbols can also
+ # be separated with commas here.
+ if self.undef:
+ self.undef = self.undef.split(',')
+
+ if self.swig_opts is None:
+ self.swig_opts = []
+ else:
+ self.swig_opts = self.swig_opts.split(' ')
+
+ # Finally add the user include and library directories if requested
+ if self.user:
+ user_include = os.path.join(USER_BASE, "include")
+ user_lib = os.path.join(USER_BASE, "lib")
+ if os.path.isdir(user_include):
+ self.include_dirs.append(user_include)
+ if os.path.isdir(user_lib):
+ self.library_dirs.append(user_lib)
+ self.rpath.append(user_lib)
+
+ if isinstance(self.parallel, str):
+ try:
+ self.parallel = int(self.parallel)
+ except ValueError:
+ raise DistutilsOptionError("parallel should be an integer")
+
+ def run(self) -> None: # noqa: C901
+ # 'self.extensions', as supplied by setup.py, is a list of
+ # Extension instances. See the documentation for Extension (in
+ # distutils.extension) for details.
+ #
+ # For backwards compatibility with Distutils 0.8.2 and earlier, we
+ # also allow the 'extensions' list to be a list of tuples:
+ # (ext_name, build_info)
+ # where build_info is a dictionary containing everything that
+ # Extension instances do except the name, with a few things being
+ # differently named. We convert these 2-tuples to Extension
+ # instances as needed.
+
+ if not self.extensions:
+ return
+
+ # If we were asked to build any C/C++ libraries, make sure that the
+ # directory where we put them is in the library search path for
+ # linking extensions.
+ if self.distribution.has_c_libraries():
+ build_clib = self.get_finalized_command('build_clib')
+ self.libraries.extend(build_clib.get_library_names() or [])
+ self.library_dirs.append(build_clib.build_clib)
+
+ # Setup the CCompiler object that we'll use to do all the
+ # compiling and linking
+ self.compiler = new_compiler(
+ compiler=self.compiler,
+ verbose=self.verbose,
+ dry_run=self.dry_run,
+ force=self.force,
+ )
+ customize_compiler(self.compiler)
+ # If we are cross-compiling, init the compiler now (if we are not
+ # cross-compiling, init would not hurt, but people may rely on
+ # late initialization of compiler even if they shouldn't...)
+ if os.name == 'nt' and self.plat_name != get_platform():
+ self.compiler.initialize(self.plat_name)
+
+ # The official Windows free threaded Python installer doesn't set
+ # Py_GIL_DISABLED because its pyconfig.h is shared with the
+ # default build, so define it here (pypa/setuptools#4662).
+ if os.name == 'nt' and is_freethreaded():
+ self.compiler.define_macro('Py_GIL_DISABLED', '1')
+
+ # And make sure that any compile/link-related options (which might
+ # come from the command-line or from the setup script) are set in
+ # that CCompiler object -- that way, they automatically apply to
+ # all compiling and linking done here.
+ if self.include_dirs is not None:
+ self.compiler.set_include_dirs(self.include_dirs)
+ if self.define is not None:
+ # 'define' option is a list of (name,value) tuples
+ for name, value in self.define:
+ self.compiler.define_macro(name, value)
+ if self.undef is not None:
+ for macro in self.undef:
+ self.compiler.undefine_macro(macro)
+ if self.libraries is not None:
+ self.compiler.set_libraries(self.libraries)
+ if self.library_dirs is not None:
+ self.compiler.set_library_dirs(self.library_dirs)
+ if self.rpath is not None:
+ self.compiler.set_runtime_library_dirs(self.rpath)
+ if self.link_objects is not None:
+ self.compiler.set_link_objects(self.link_objects)
+
+ # Now actually compile and link everything.
+ self.build_extensions()
+
+ def check_extensions_list(self, extensions) -> None: # noqa: C901
+ """Ensure that the list of extensions (presumably provided as a
+ command option 'extensions') is valid, i.e. it is a list of
+ Extension objects. We also support the old-style list of 2-tuples,
+ where the tuples are (ext_name, build_info), which are converted to
+ Extension instances here.
+
+ Raise DistutilsSetupError if the structure is invalid anywhere;
+ just returns otherwise.
+ """
+ if not isinstance(extensions, list):
+ raise DistutilsSetupError(
+ "'ext_modules' option must be a list of Extension instances"
+ )
+
+ for i, ext in enumerate(extensions):
+ if isinstance(ext, Extension):
+ continue # OK! (assume type-checking done
+ # by Extension constructor)
+
+ if not isinstance(ext, tuple) or len(ext) != 2:
+ raise DistutilsSetupError(
+ "each element of 'ext_modules' option must be an "
+ "Extension instance or 2-tuple"
+ )
+
+ ext_name, build_info = ext
+
+ log.warning(
+ "old-style (ext_name, build_info) tuple found in "
+ "ext_modules for extension '%s' "
+ "-- please convert to Extension instance",
+ ext_name,
+ )
+
+ if not (isinstance(ext_name, str) and extension_name_re.match(ext_name)):
+ raise DistutilsSetupError(
+ "first element of each tuple in 'ext_modules' "
+ "must be the extension name (a string)"
+ )
+
+ if not isinstance(build_info, dict):
+ raise DistutilsSetupError(
+ "second element of each tuple in 'ext_modules' "
+ "must be a dictionary (build info)"
+ )
+
+ # OK, the (ext_name, build_info) dict is type-safe: convert it
+ # to an Extension instance.
+ ext = Extension(ext_name, build_info['sources'])
+
+ # Easy stuff: one-to-one mapping from dict elements to
+ # instance attributes.
+ for key in (
+ 'include_dirs',
+ 'library_dirs',
+ 'libraries',
+ 'extra_objects',
+ 'extra_compile_args',
+ 'extra_link_args',
+ ):
+ val = build_info.get(key)
+ if val is not None:
+ setattr(ext, key, val)
+
+ # Medium-easy stuff: same syntax/semantics, different names.
+ ext.runtime_library_dirs = build_info.get('rpath')
+ if 'def_file' in build_info:
+ log.warning("'def_file' element of build info dict no longer supported")
+
+ # Non-trivial stuff: 'macros' split into 'define_macros'
+ # and 'undef_macros'.
+ macros = build_info.get('macros')
+ if macros:
+ ext.define_macros = []
+ ext.undef_macros = []
+ for macro in macros:
+ if not (isinstance(macro, tuple) and len(macro) in (1, 2)):
+ raise DistutilsSetupError(
+ "'macros' element of build info dict must be 1- or 2-tuple"
+ )
+ if len(macro) == 1:
+ ext.undef_macros.append(macro[0])
+ elif len(macro) == 2:
+ ext.define_macros.append(macro)
+
+ extensions[i] = ext
+
+ def get_source_files(self):
+ self.check_extensions_list(self.extensions)
+ filenames = []
+
+ # Wouldn't it be neat if we knew the names of header files too...
+ for ext in self.extensions:
+ filenames.extend(ext.sources)
+ return filenames
+
+ def get_outputs(self):
+ # Sanity check the 'extensions' list -- can't assume this is being
+ # done in the same run as a 'build_extensions()' call (in fact, we
+ # can probably assume that it *isn't*!).
+ self.check_extensions_list(self.extensions)
+
+ # And build the list of output (built) filenames. Note that this
+ # ignores the 'inplace' flag, and assumes everything goes in the
+ # "build" tree.
+ return [self.get_ext_fullpath(ext.name) for ext in self.extensions]
+
+ def build_extensions(self) -> None:
+ # First, sanity-check the 'extensions' list
+ self.check_extensions_list(self.extensions)
+ if self.parallel:
+ self._build_extensions_parallel()
+ else:
+ self._build_extensions_serial()
+
+ def _build_extensions_parallel(self):
+ workers = self.parallel
+ if self.parallel is True:
+ workers = os.cpu_count() # may return None
+ try:
+ from concurrent.futures import ThreadPoolExecutor
+ except ImportError:
+ workers = None
+
+ if workers is None:
+ self._build_extensions_serial()
+ return
+
+ with ThreadPoolExecutor(max_workers=workers) as executor:
+ futures = [
+ executor.submit(self.build_extension, ext) for ext in self.extensions
+ ]
+ for ext, fut in zip(self.extensions, futures):
+ with self._filter_build_errors(ext):
+ fut.result()
+
+ def _build_extensions_serial(self):
+ for ext in self.extensions:
+ with self._filter_build_errors(ext):
+ self.build_extension(ext)
+
+ @contextlib.contextmanager
+ def _filter_build_errors(self, ext):
+ try:
+ yield
+ except (CCompilerError, DistutilsError, CompileError) as e:
+ if not ext.optional:
+ raise
+ self.warn(f'building extension "{ext.name}" failed: {e}')
+
+ def build_extension(self, ext) -> None:
+ sources = ext.sources
+ if sources is None or not isinstance(sources, (list, tuple)):
+ raise DistutilsSetupError(
+ f"in 'ext_modules' option (extension '{ext.name}'), "
+ "'sources' must be present and must be "
+ "a list of source filenames"
+ )
+ # sort to make the resulting .so file build reproducible
+ sources = sorted(sources)
+
+ ext_path = self.get_ext_fullpath(ext.name)
+ depends = sources + ext.depends
+ if not (self.force or newer_group(depends, ext_path, 'newer')):
+ log.debug("skipping '%s' extension (up-to-date)", ext.name)
+ return
+ else:
+ log.info("building '%s' extension", ext.name)
+
+ # First, scan the sources for SWIG definition files (.i), run
+ # SWIG on 'em to create .c files, and modify the sources list
+ # accordingly.
+ sources = self.swig_sources(sources, ext)
+
+ # Next, compile the source code to object files.
+
+ # XXX not honouring 'define_macros' or 'undef_macros' -- the
+ # CCompiler API needs to change to accommodate this, and I
+ # want to do one thing at a time!
+
+ # Two possible sources for extra compiler arguments:
+ # - 'extra_compile_args' in Extension object
+ # - CFLAGS environment variable (not particularly
+ # elegant, but people seem to expect it and I
+ # guess it's useful)
+ # The environment variable should take precedence, and
+ # any sensible compiler will give precedence to later
+ # command line args. Hence we combine them in order:
+ extra_args = ext.extra_compile_args or []
+
+ macros = ext.define_macros[:]
+ for undef in ext.undef_macros:
+ macros.append((undef,))
+
+ objects = self.compiler.compile(
+ sources,
+ output_dir=self.build_temp,
+ macros=macros,
+ include_dirs=ext.include_dirs,
+ debug=self.debug,
+ extra_postargs=extra_args,
+ depends=ext.depends,
+ )
+
+ # XXX outdated variable, kept here in case third-part code
+ # needs it.
+ self._built_objects = objects[:]
+
+ # Now link the object files together into a "shared object" --
+ # of course, first we have to figure out all the other things
+ # that go into the mix.
+ if ext.extra_objects:
+ objects.extend(ext.extra_objects)
+ extra_args = ext.extra_link_args or []
+
+ # Detect target language, if not provided
+ language = ext.language or self.compiler.detect_language(sources)
+
+ self.compiler.link_shared_object(
+ objects,
+ ext_path,
+ libraries=self.get_libraries(ext),
+ library_dirs=ext.library_dirs,
+ runtime_library_dirs=ext.runtime_library_dirs,
+ extra_postargs=extra_args,
+ export_symbols=self.get_export_symbols(ext),
+ debug=self.debug,
+ build_temp=self.build_temp,
+ target_lang=language,
+ )
+
+ def swig_sources(self, sources, extension):
+ """Walk the list of source files in 'sources', looking for SWIG
+ interface (.i) files. Run SWIG on all that are found, and
+ return a modified 'sources' list with SWIG source files replaced
+ by the generated C (or C++) files.
+ """
+ new_sources = []
+ swig_sources = []
+ swig_targets = {}
+
+ # XXX this drops generated C/C++ files into the source tree, which
+ # is fine for developers who want to distribute the generated
+ # source -- but there should be an option to put SWIG output in
+ # the temp dir.
+
+ if self.swig_cpp:
+ log.warning("--swig-cpp is deprecated - use --swig-opts=-c++")
+
+ if (
+ self.swig_cpp
+ or ('-c++' in self.swig_opts)
+ or ('-c++' in extension.swig_opts)
+ ):
+ target_ext = '.cpp'
+ else:
+ target_ext = '.c'
+
+ for source in sources:
+ (base, ext) = os.path.splitext(source)
+ if ext == ".i": # SWIG interface file
+ new_sources.append(base + '_wrap' + target_ext)
+ swig_sources.append(source)
+ swig_targets[source] = new_sources[-1]
+ else:
+ new_sources.append(source)
+
+ if not swig_sources:
+ return new_sources
+
+ swig = self.swig or self.find_swig()
+ swig_cmd = [swig, "-python"]
+ swig_cmd.extend(self.swig_opts)
+ if self.swig_cpp:
+ swig_cmd.append("-c++")
+
+ # Do not override commandline arguments
+ if not self.swig_opts:
+ swig_cmd.extend(extension.swig_opts)
+
+ for source in swig_sources:
+ target = swig_targets[source]
+ log.info("swigging %s to %s", source, target)
+ self.spawn(swig_cmd + ["-o", target, source])
+
+ return new_sources
+
+ def find_swig(self):
+ """Return the name of the SWIG executable. On Unix, this is
+ just "swig" -- it should be in the PATH. Tries a bit harder on
+ Windows.
+ """
+ if os.name == "posix":
+ return "swig"
+ elif os.name == "nt":
+ # Look for SWIG in its standard installation directory on
+ # Windows (or so I presume!). If we find it there, great;
+ # if not, act like Unix and assume it's in the PATH.
+ for vers in ("1.3", "1.2", "1.1"):
+ fn = os.path.join(f"c:\\swig{vers}", "swig.exe")
+ if os.path.isfile(fn):
+ return fn
+ else:
+ return "swig.exe"
+ else:
+ raise DistutilsPlatformError(
+ f"I don't know how to find (much less run) SWIG on platform '{os.name}'"
+ )
+
+ # -- Name generators -----------------------------------------------
+ # (extension names, filenames, whatever)
+ def get_ext_fullpath(self, ext_name: str) -> str:
+ """Returns the path of the filename for a given extension.
+
+ The file is located in `build_lib` or directly in the package
+ (inplace option).
+ """
+ fullname = self.get_ext_fullname(ext_name)
+ modpath = fullname.split('.')
+ filename = self.get_ext_filename(modpath[-1])
+
+ if not self.inplace:
+ # no further work needed
+ # returning :
+ # build_dir/package/path/filename
+ filename = os.path.join(*modpath[:-1] + [filename])
+ return os.path.join(self.build_lib, filename)
+
+ # the inplace option requires to find the package directory
+ # using the build_py command for that
+ package = '.'.join(modpath[0:-1])
+ build_py = self.get_finalized_command('build_py')
+ package_dir = os.path.abspath(build_py.get_package_dir(package))
+
+ # returning
+ # package_dir/filename
+ return os.path.join(package_dir, filename)
+
+ def get_ext_fullname(self, ext_name: str) -> str:
+ """Returns the fullname of a given extension name.
+
+ Adds the `package.` prefix"""
+ if self.package is None:
+ return ext_name
+ else:
+ return self.package + '.' + ext_name
+
+ def get_ext_filename(self, ext_name: str) -> str:
+ r"""Convert the name of an extension (eg. "foo.bar") into the name
+ of the file from which it will be loaded (eg. "foo/bar.so", or
+ "foo\bar.pyd").
+ """
+ from ..sysconfig import get_config_var
+
+ ext_path = ext_name.split('.')
+ ext_suffix = get_config_var('EXT_SUFFIX')
+ return os.path.join(*ext_path) + ext_suffix
+
+ def get_export_symbols(self, ext: Extension) -> list[str]:
+ """Return the list of symbols that a shared extension has to
+ export. This either uses 'ext.export_symbols' or, if it's not
+ provided, "PyInit_" + module_name. Only relevant on Windows, where
+ the .pyd file (DLL) must export the module "PyInit_" function.
+ """
+ name = self._get_module_name_for_symbol(ext)
+ try:
+ # Unicode module name support as defined in PEP-489
+ # https://peps.python.org/pep-0489/#export-hook-name
+ name.encode('ascii')
+ except UnicodeEncodeError:
+ suffix = 'U_' + name.encode('punycode').replace(b'-', b'_').decode('ascii')
+ else:
+ suffix = "_" + name
+
+ initfunc_name = "PyInit" + suffix
+ if initfunc_name not in ext.export_symbols:
+ ext.export_symbols.append(initfunc_name)
+ return ext.export_symbols
+
+ def _get_module_name_for_symbol(self, ext):
+ # Package name should be used for `__init__` modules
+ # https://github.com/python/cpython/issues/80074
+ # https://github.com/pypa/setuptools/issues/4826
+ parts = ext.name.split(".")
+ if parts[-1] == "__init__" and len(parts) >= 2:
+ return parts[-2]
+ return parts[-1]
+
+ def get_libraries(self, ext: Extension) -> list[str]: # noqa: C901
+ """Return the list of libraries to link against when building a
+ shared extension. On most platforms, this is just 'ext.libraries';
+ on Windows, we add the Python library (eg. python20.dll).
+ """
+ # The python library is always needed on Windows. For MSVC, this
+ # is redundant, since the library is mentioned in a pragma in
+ # pyconfig.h that MSVC groks. The other Windows compilers all seem
+ # to need it mentioned explicitly, though, so that's what we do.
+ # Append '_d' to the python import library on debug builds.
+ if sys.platform == "win32" and not is_mingw():
+ from .._msvccompiler import MSVCCompiler
+
+ if not isinstance(self.compiler, MSVCCompiler):
+ template = "python%d%d"
+ if self.debug:
+ template = template + '_d'
+ pythonlib = template % (
+ sys.hexversion >> 24,
+ (sys.hexversion >> 16) & 0xFF,
+ )
+ # don't extend ext.libraries, it may be shared with other
+ # extensions, it is a reference to the original list
+ return ext.libraries + [pythonlib]
+ else:
+ # On Android only the main executable and LD_PRELOADs are considered
+ # to be RTLD_GLOBAL, all the dependencies of the main executable
+ # remain RTLD_LOCAL and so the shared libraries must be linked with
+ # libpython when python is built with a shared python library (issue
+ # bpo-21536).
+ # On Cygwin (and if required, other POSIX-like platforms based on
+ # Windows like MinGW) it is simply necessary that all symbols in
+ # shared libraries are resolved at link time.
+ from ..sysconfig import get_config_var
+
+ link_libpython = False
+ if get_config_var('Py_ENABLE_SHARED'):
+ # A native build on an Android device or on Cygwin
+ if hasattr(sys, 'getandroidapilevel'):
+ link_libpython = True
+ elif sys.platform == 'cygwin' or is_mingw():
+ link_libpython = True
+ elif '_PYTHON_HOST_PLATFORM' in os.environ:
+ # We are cross-compiling for one of the relevant platforms
+ if get_config_var('ANDROID_API_LEVEL') != 0:
+ link_libpython = True
+ elif get_config_var('MACHDEP') == 'cygwin':
+ link_libpython = True
+
+ if link_libpython:
+ ldversion = get_config_var('LDVERSION')
+ return ext.libraries + ['python' + ldversion]
+
+ return ext.libraries
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_py.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_py.py
new file mode 100644
index 0000000000000000000000000000000000000000..a20b076fe7cca9140e05b1cf171b62155995f36e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_py.py
@@ -0,0 +1,407 @@
+"""distutils.command.build_py
+
+Implements the Distutils 'build_py' command."""
+
+import glob
+import importlib.util
+import os
+import sys
+from distutils._log import log
+from typing import ClassVar
+
+from ..core import Command
+from ..errors import DistutilsFileError, DistutilsOptionError
+from ..util import convert_path
+
+
+class build_py(Command):
+ description = "\"build\" pure Python modules (copy to build directory)"
+
+ user_options = [
+ ('build-lib=', 'd', "directory to \"build\" (copy) to"),
+ ('compile', 'c', "compile .py to .pyc"),
+ ('no-compile', None, "don't compile .py files [default]"),
+ (
+ 'optimize=',
+ 'O',
+ "also compile with optimization: -O1 for \"python -O\", "
+ "-O2 for \"python -OO\", and -O0 to disable [default: -O0]",
+ ),
+ ('force', 'f', "forcibly build everything (ignore file timestamps)"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['compile', 'force']
+ negative_opt: ClassVar[dict[str, str]] = {'no-compile': 'compile'}
+
+ def initialize_options(self):
+ self.build_lib = None
+ self.py_modules = None
+ self.package = None
+ self.package_data = None
+ self.package_dir = None
+ self.compile = False
+ self.optimize = 0
+ self.force = None
+
+ def finalize_options(self) -> None:
+ self.set_undefined_options(
+ 'build', ('build_lib', 'build_lib'), ('force', 'force')
+ )
+
+ # Get the distribution options that are aliases for build_py
+ # options -- list of packages and list of modules.
+ self.packages = self.distribution.packages
+ self.py_modules = self.distribution.py_modules
+ self.package_data = self.distribution.package_data
+ self.package_dir = {}
+ if self.distribution.package_dir:
+ for name, path in self.distribution.package_dir.items():
+ self.package_dir[name] = convert_path(path)
+ self.data_files = self.get_data_files()
+
+ # Ick, copied straight from install_lib.py (fancy_getopt needs a
+ # type system! Hell, *everything* needs a type system!!!)
+ if not isinstance(self.optimize, int):
+ try:
+ self.optimize = int(self.optimize)
+ assert 0 <= self.optimize <= 2
+ except (ValueError, AssertionError):
+ raise DistutilsOptionError("optimize must be 0, 1, or 2")
+
+ def run(self) -> None:
+ # XXX copy_file by default preserves atime and mtime. IMHO this is
+ # the right thing to do, but perhaps it should be an option -- in
+ # particular, a site administrator might want installed files to
+ # reflect the time of installation rather than the last
+ # modification time before the installed release.
+
+ # XXX copy_file by default preserves mode, which appears to be the
+ # wrong thing to do: if a file is read-only in the working
+ # directory, we want it to be installed read/write so that the next
+ # installation of the same module distribution can overwrite it
+ # without problems. (This might be a Unix-specific issue.) Thus
+ # we turn off 'preserve_mode' when copying to the build directory,
+ # since the build directory is supposed to be exactly what the
+ # installation will look like (ie. we preserve mode when
+ # installing).
+
+ # Two options control which modules will be installed: 'packages'
+ # and 'py_modules'. The former lets us work with whole packages, not
+ # specifying individual modules at all; the latter is for
+ # specifying modules one-at-a-time.
+
+ if self.py_modules:
+ self.build_modules()
+ if self.packages:
+ self.build_packages()
+ self.build_package_data()
+
+ self.byte_compile(self.get_outputs(include_bytecode=False))
+
+ def get_data_files(self):
+ """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
+ data = []
+ if not self.packages:
+ return data
+ for package in self.packages:
+ # Locate package source directory
+ src_dir = self.get_package_dir(package)
+
+ # Compute package build directory
+ build_dir = os.path.join(*([self.build_lib] + package.split('.')))
+
+ # Length of path to strip from found files
+ plen = 0
+ if src_dir:
+ plen = len(src_dir) + 1
+
+ # Strip directory from globbed filenames
+ filenames = [file[plen:] for file in self.find_data_files(package, src_dir)]
+ data.append((package, src_dir, build_dir, filenames))
+ return data
+
+ def find_data_files(self, package, src_dir):
+ """Return filenames for package's data files in 'src_dir'"""
+ globs = self.package_data.get('', []) + self.package_data.get(package, [])
+ files = []
+ for pattern in globs:
+ # Each pattern has to be converted to a platform-specific path
+ filelist = glob.glob(
+ os.path.join(glob.escape(src_dir), convert_path(pattern))
+ )
+ # Files that match more than one pattern are only added once
+ files.extend([
+ fn for fn in filelist if fn not in files and os.path.isfile(fn)
+ ])
+ return files
+
+ def build_package_data(self) -> None:
+ """Copy data files into build directory"""
+ for _package, src_dir, build_dir, filenames in self.data_files:
+ for filename in filenames:
+ target = os.path.join(build_dir, filename)
+ self.mkpath(os.path.dirname(target))
+ self.copy_file(
+ os.path.join(src_dir, filename), target, preserve_mode=False
+ )
+
+ def get_package_dir(self, package):
+ """Return the directory, relative to the top of the source
+ distribution, where package 'package' should be found
+ (at least according to the 'package_dir' option, if any)."""
+ path = package.split('.')
+
+ if not self.package_dir:
+ if path:
+ return os.path.join(*path)
+ else:
+ return ''
+ else:
+ tail = []
+ while path:
+ try:
+ pdir = self.package_dir['.'.join(path)]
+ except KeyError:
+ tail.insert(0, path[-1])
+ del path[-1]
+ else:
+ tail.insert(0, pdir)
+ return os.path.join(*tail)
+ else:
+ # Oops, got all the way through 'path' without finding a
+ # match in package_dir. If package_dir defines a directory
+ # for the root (nameless) package, then fallback on it;
+ # otherwise, we might as well have not consulted
+ # package_dir at all, as we just use the directory implied
+ # by 'tail' (which should be the same as the original value
+ # of 'path' at this point).
+ pdir = self.package_dir.get('')
+ if pdir is not None:
+ tail.insert(0, pdir)
+
+ if tail:
+ return os.path.join(*tail)
+ else:
+ return ''
+
+ def check_package(self, package, package_dir):
+ # Empty dir name means current directory, which we can probably
+ # assume exists. Also, os.path.exists and isdir don't know about
+ # my "empty string means current dir" convention, so we have to
+ # circumvent them.
+ if package_dir != "":
+ if not os.path.exists(package_dir):
+ raise DistutilsFileError(
+ f"package directory '{package_dir}' does not exist"
+ )
+ if not os.path.isdir(package_dir):
+ raise DistutilsFileError(
+ f"supposed package directory '{package_dir}' exists, "
+ "but is not a directory"
+ )
+
+ # Directories without __init__.py are namespace packages (PEP 420).
+ if package:
+ init_py = os.path.join(package_dir, "__init__.py")
+ if os.path.isfile(init_py):
+ return init_py
+
+ # Either not in a package at all (__init__.py not expected), or
+ # __init__.py doesn't exist -- so don't return the filename.
+ return None
+
+ def check_module(self, module, module_file):
+ if not os.path.isfile(module_file):
+ log.warning("file %s (for module %s) not found", module_file, module)
+ return False
+ else:
+ return True
+
+ def find_package_modules(self, package, package_dir):
+ self.check_package(package, package_dir)
+ module_files = glob.glob(os.path.join(glob.escape(package_dir), "*.py"))
+ modules = []
+ setup_script = os.path.abspath(self.distribution.script_name)
+
+ for f in module_files:
+ abs_f = os.path.abspath(f)
+ if abs_f != setup_script:
+ module = os.path.splitext(os.path.basename(f))[0]
+ modules.append((package, module, f))
+ else:
+ self.debug_print(f"excluding {setup_script}")
+ return modules
+
+ def find_modules(self):
+ """Finds individually-specified Python modules, ie. those listed by
+ module name in 'self.py_modules'. Returns a list of tuples (package,
+ module_base, filename): 'package' is a tuple of the path through
+ package-space to the module; 'module_base' is the bare (no
+ packages, no dots) module name, and 'filename' is the path to the
+ ".py" file (relative to the distribution root) that implements the
+ module.
+ """
+ # Map package names to tuples of useful info about the package:
+ # (package_dir, checked)
+ # package_dir - the directory where we'll find source files for
+ # this package
+ # checked - true if we have checked that the package directory
+ # is valid (exists, contains __init__.py, ... ?)
+ packages = {}
+
+ # List of (package, module, filename) tuples to return
+ modules = []
+
+ # We treat modules-in-packages almost the same as toplevel modules,
+ # just the "package" for a toplevel is empty (either an empty
+ # string or empty list, depending on context). Differences:
+ # - don't check for __init__.py in directory for empty package
+ for module in self.py_modules:
+ path = module.split('.')
+ package = '.'.join(path[0:-1])
+ module_base = path[-1]
+
+ try:
+ (package_dir, checked) = packages[package]
+ except KeyError:
+ package_dir = self.get_package_dir(package)
+ checked = False
+
+ if not checked:
+ init_py = self.check_package(package, package_dir)
+ packages[package] = (package_dir, 1)
+ if init_py:
+ modules.append((package, "__init__", init_py))
+
+ # XXX perhaps we should also check for just .pyc files
+ # (so greedy closed-source bastards can distribute Python
+ # modules too)
+ module_file = os.path.join(package_dir, module_base + ".py")
+ if not self.check_module(module, module_file):
+ continue
+
+ modules.append((package, module_base, module_file))
+
+ return modules
+
+ def find_all_modules(self):
+ """Compute the list of all modules that will be built, whether
+ they are specified one-module-at-a-time ('self.py_modules') or
+ by whole packages ('self.packages'). Return a list of tuples
+ (package, module, module_file), just like 'find_modules()' and
+ 'find_package_modules()' do."""
+ modules = []
+ if self.py_modules:
+ modules.extend(self.find_modules())
+ if self.packages:
+ for package in self.packages:
+ package_dir = self.get_package_dir(package)
+ m = self.find_package_modules(package, package_dir)
+ modules.extend(m)
+ return modules
+
+ def get_source_files(self):
+ return [module[-1] for module in self.find_all_modules()]
+
+ def get_module_outfile(self, build_dir, package, module):
+ outfile_path = [build_dir] + list(package) + [module + ".py"]
+ return os.path.join(*outfile_path)
+
+ def get_outputs(self, include_bytecode: bool = True) -> list[str]:
+ modules = self.find_all_modules()
+ outputs = []
+ for package, module, _module_file in modules:
+ package = package.split('.')
+ filename = self.get_module_outfile(self.build_lib, package, module)
+ outputs.append(filename)
+ if include_bytecode:
+ if self.compile:
+ outputs.append(
+ importlib.util.cache_from_source(filename, optimization='')
+ )
+ if self.optimize > 0:
+ outputs.append(
+ importlib.util.cache_from_source(
+ filename, optimization=self.optimize
+ )
+ )
+
+ outputs += [
+ os.path.join(build_dir, filename)
+ for package, src_dir, build_dir, filenames in self.data_files
+ for filename in filenames
+ ]
+
+ return outputs
+
+ def build_module(self, module, module_file, package):
+ if isinstance(package, str):
+ package = package.split('.')
+ elif not isinstance(package, (list, tuple)):
+ raise TypeError(
+ "'package' must be a string (dot-separated), list, or tuple"
+ )
+
+ # Now put the module source file into the "build" area -- this is
+ # easy, we just copy it somewhere under self.build_lib (the build
+ # directory for Python source).
+ outfile = self.get_module_outfile(self.build_lib, package, module)
+ dir = os.path.dirname(outfile)
+ self.mkpath(dir)
+ return self.copy_file(module_file, outfile, preserve_mode=False)
+
+ def build_modules(self) -> None:
+ modules = self.find_modules()
+ for package, module, module_file in modules:
+ # Now "build" the module -- ie. copy the source file to
+ # self.build_lib (the build directory for Python source).
+ # (Actually, it gets copied to the directory for this package
+ # under self.build_lib.)
+ self.build_module(module, module_file, package)
+
+ def build_packages(self) -> None:
+ for package in self.packages:
+ # Get list of (package, module, module_file) tuples based on
+ # scanning the package directory. 'package' is only included
+ # in the tuple so that 'find_modules()' and
+ # 'find_package_tuples()' have a consistent interface; it's
+ # ignored here (apart from a sanity check). Also, 'module' is
+ # the *unqualified* module name (ie. no dots, no package -- we
+ # already know its package!), and 'module_file' is the path to
+ # the .py file, relative to the current directory
+ # (ie. including 'package_dir').
+ package_dir = self.get_package_dir(package)
+ modules = self.find_package_modules(package, package_dir)
+
+ # Now loop over the modules we found, "building" each one (just
+ # copy it to self.build_lib).
+ for package_, module, module_file in modules:
+ assert package == package_
+ self.build_module(module, module_file, package)
+
+ def byte_compile(self, files) -> None:
+ if sys.dont_write_bytecode:
+ self.warn('byte-compiling is disabled, skipping.')
+ return
+
+ from ..util import byte_compile
+
+ prefix = self.build_lib
+ if prefix[-1] != os.sep:
+ prefix = prefix + os.sep
+
+ # XXX this code is essentially the same as the 'byte_compile()
+ # method of the "install_lib" command, except for the determination
+ # of the 'prefix' string. Hmmm.
+ if self.compile:
+ byte_compile(
+ files, optimize=0, force=self.force, prefix=prefix, dry_run=self.dry_run
+ )
+ if self.optimize > 0:
+ byte_compile(
+ files,
+ optimize=self.optimize,
+ force=self.force,
+ prefix=prefix,
+ dry_run=self.dry_run,
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_scripts.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_scripts.py
new file mode 100644
index 0000000000000000000000000000000000000000..b86ee6e6ba6a4613f552f6d2f19b8c5157391d8d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/build_scripts.py
@@ -0,0 +1,160 @@
+"""distutils.command.build_scripts
+
+Implements the Distutils 'build_scripts' command."""
+
+import os
+import re
+import tokenize
+from distutils._log import log
+from stat import ST_MODE
+from typing import ClassVar
+
+from .._modified import newer
+from ..core import Command
+from ..util import convert_path
+
+shebang_pattern = re.compile('^#!.*python[0-9.]*([ \t].*)?$')
+"""
+Pattern matching a Python interpreter indicated in first line of a script.
+"""
+
+# for Setuptools compatibility
+first_line_re = shebang_pattern
+
+
+class build_scripts(Command):
+ description = "\"build\" scripts (copy and fixup #! line)"
+
+ user_options: ClassVar[list[tuple[str, str, str]]] = [
+ ('build-dir=', 'd', "directory to \"build\" (copy) to"),
+ ('force', 'f', "forcibly build everything (ignore file timestamps"),
+ ('executable=', 'e', "specify final destination interpreter path"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['force']
+
+ def initialize_options(self):
+ self.build_dir = None
+ self.scripts = None
+ self.force = None
+ self.executable = None
+
+ def finalize_options(self):
+ self.set_undefined_options(
+ 'build',
+ ('build_scripts', 'build_dir'),
+ ('force', 'force'),
+ ('executable', 'executable'),
+ )
+ self.scripts = self.distribution.scripts
+
+ def get_source_files(self):
+ return self.scripts
+
+ def run(self):
+ if not self.scripts:
+ return
+ self.copy_scripts()
+
+ def copy_scripts(self):
+ """
+ Copy each script listed in ``self.scripts``.
+
+ If a script is marked as a Python script (first line matches
+ 'shebang_pattern', i.e. starts with ``#!`` and contains
+ "python"), then adjust in the copy the first line to refer to
+ the current Python interpreter.
+ """
+ self.mkpath(self.build_dir)
+ outfiles = []
+ updated_files = []
+ for script in self.scripts:
+ self._copy_script(script, outfiles, updated_files)
+
+ self._change_modes(outfiles)
+
+ return outfiles, updated_files
+
+ def _copy_script(self, script, outfiles, updated_files):
+ shebang_match = None
+ script = convert_path(script)
+ outfile = os.path.join(self.build_dir, os.path.basename(script))
+ outfiles.append(outfile)
+
+ if not self.force and not newer(script, outfile):
+ log.debug("not copying %s (up-to-date)", script)
+ return
+
+ # Always open the file, but ignore failures in dry-run mode
+ # in order to attempt to copy directly.
+ try:
+ f = tokenize.open(script)
+ except OSError:
+ if not self.dry_run:
+ raise
+ f = None
+ else:
+ first_line = f.readline()
+ if not first_line:
+ self.warn(f"{script} is an empty file (skipping)")
+ return
+
+ shebang_match = shebang_pattern.match(first_line)
+
+ updated_files.append(outfile)
+ if shebang_match:
+ log.info("copying and adjusting %s -> %s", script, self.build_dir)
+ if not self.dry_run:
+ post_interp = shebang_match.group(1) or ''
+ shebang = "#!" + self.executable + post_interp + "\n"
+ self._validate_shebang(shebang, f.encoding)
+ with open(outfile, "w", encoding=f.encoding) as outf:
+ outf.write(shebang)
+ outf.writelines(f.readlines())
+ if f:
+ f.close()
+ else:
+ if f:
+ f.close()
+ self.copy_file(script, outfile)
+
+ def _change_modes(self, outfiles):
+ if os.name != 'posix':
+ return
+
+ for file in outfiles:
+ self._change_mode(file)
+
+ def _change_mode(self, file):
+ if self.dry_run:
+ log.info("changing mode of %s", file)
+ return
+
+ oldmode = os.stat(file)[ST_MODE] & 0o7777
+ newmode = (oldmode | 0o555) & 0o7777
+ if newmode != oldmode:
+ log.info("changing mode of %s from %o to %o", file, oldmode, newmode)
+ os.chmod(file, newmode)
+
+ @staticmethod
+ def _validate_shebang(shebang, encoding):
+ # Python parser starts to read a script using UTF-8 until
+ # it gets a #coding:xxx cookie. The shebang has to be the
+ # first line of a file, the #coding:xxx cookie cannot be
+ # written before. So the shebang has to be encodable to
+ # UTF-8.
+ try:
+ shebang.encode('utf-8')
+ except UnicodeEncodeError:
+ raise ValueError(f"The shebang ({shebang!r}) is not encodable to utf-8")
+
+ # If the script is encoded to a custom encoding (use a
+ # #coding:xxx cookie), the shebang has to be encodable to
+ # the script encoding too.
+ try:
+ shebang.encode(encoding)
+ except UnicodeEncodeError:
+ raise ValueError(
+ f"The shebang ({shebang!r}) is not encodable "
+ f"to the script encoding ({encoding})"
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/check.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/check.py
new file mode 100644
index 0000000000000000000000000000000000000000..58a823dd3904cf105ed432e458a45d94948fbb4c
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/check.py
@@ -0,0 +1,152 @@
+"""distutils.command.check
+
+Implements the Distutils 'check' command.
+"""
+
+import contextlib
+from typing import ClassVar
+
+from ..core import Command
+from ..errors import DistutilsSetupError
+
+with contextlib.suppress(ImportError):
+ import docutils.frontend
+ import docutils.nodes
+ import docutils.parsers.rst
+ import docutils.utils
+
+ class SilentReporter(docutils.utils.Reporter):
+ def __init__(
+ self,
+ source,
+ report_level,
+ halt_level,
+ stream=None,
+ debug=False,
+ encoding='ascii',
+ error_handler='replace',
+ ):
+ self.messages = []
+ super().__init__(
+ source, report_level, halt_level, stream, debug, encoding, error_handler
+ )
+
+ def system_message(self, level, message, *children, **kwargs):
+ self.messages.append((level, message, children, kwargs))
+ return docutils.nodes.system_message(
+ message, *children, level=level, type=self.levels[level], **kwargs
+ )
+
+
+class check(Command):
+ """This command checks the meta-data of the package."""
+
+ description = "perform some checks on the package"
+ user_options: ClassVar[list[tuple[str, str, str]]] = [
+ ('metadata', 'm', 'Verify meta-data'),
+ (
+ 'restructuredtext',
+ 'r',
+ 'Checks if long string meta-data syntax are reStructuredText-compliant',
+ ),
+ ('strict', 's', 'Will exit with an error if a check fails'),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['metadata', 'restructuredtext', 'strict']
+
+ def initialize_options(self):
+ """Sets default values for options."""
+ self.restructuredtext = False
+ self.metadata = 1
+ self.strict = False
+ self._warnings = 0
+
+ def finalize_options(self):
+ pass
+
+ def warn(self, msg):
+ """Counts the number of warnings that occurs."""
+ self._warnings += 1
+ return Command.warn(self, msg)
+
+ def run(self):
+ """Runs the command."""
+ # perform the various tests
+ if self.metadata:
+ self.check_metadata()
+ if self.restructuredtext:
+ if 'docutils' in globals():
+ try:
+ self.check_restructuredtext()
+ except TypeError as exc:
+ raise DistutilsSetupError(str(exc))
+ elif self.strict:
+ raise DistutilsSetupError('The docutils package is needed.')
+
+ # let's raise an error in strict mode, if we have at least
+ # one warning
+ if self.strict and self._warnings > 0:
+ raise DistutilsSetupError('Please correct your package.')
+
+ def check_metadata(self):
+ """Ensures that all required elements of meta-data are supplied.
+
+ Required fields:
+ name, version
+
+ Warns if any are missing.
+ """
+ metadata = self.distribution.metadata
+
+ missing = [
+ attr for attr in ('name', 'version') if not getattr(metadata, attr, None)
+ ]
+
+ if missing:
+ self.warn("missing required meta-data: {}".format(', '.join(missing)))
+
+ def check_restructuredtext(self):
+ """Checks if the long string fields are reST-compliant."""
+ data = self.distribution.get_long_description()
+ for warning in self._check_rst_data(data):
+ line = warning[-1].get('line')
+ if line is None:
+ warning = warning[1]
+ else:
+ warning = f'{warning[1]} (line {line})'
+ self.warn(warning)
+
+ def _check_rst_data(self, data):
+ """Returns warnings when the provided data doesn't compile."""
+ # the include and csv_table directives need this to be a path
+ source_path = self.distribution.script_name or 'setup.py'
+ parser = docutils.parsers.rst.Parser()
+ settings = docutils.frontend.OptionParser(
+ components=(docutils.parsers.rst.Parser,)
+ ).get_default_values()
+ settings.tab_width = 4
+ settings.pep_references = None
+ settings.rfc_references = None
+ reporter = SilentReporter(
+ source_path,
+ settings.report_level,
+ settings.halt_level,
+ stream=settings.warning_stream,
+ debug=settings.debug,
+ encoding=settings.error_encoding,
+ error_handler=settings.error_encoding_error_handler,
+ )
+
+ document = docutils.nodes.document(settings, reporter, source=source_path)
+ document.note_source(source_path, -1)
+ try:
+ parser.parse(data, document)
+ except (AttributeError, TypeError) as e:
+ reporter.messages.append((
+ -1,
+ f'Could not finish the parsing: {e}.',
+ '',
+ {},
+ ))
+
+ return reporter.messages
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/clean.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/clean.py
new file mode 100644
index 0000000000000000000000000000000000000000..23427aba21132ec16122ec17b54794203b02baa5
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/clean.py
@@ -0,0 +1,77 @@
+"""distutils.command.clean
+
+Implements the Distutils 'clean' command."""
+
+# contributed by Bastian Kleineidam , added 2000-03-18
+
+import os
+from distutils._log import log
+from typing import ClassVar
+
+from ..core import Command
+from ..dir_util import remove_tree
+
+
+class clean(Command):
+ description = "clean up temporary files from 'build' command"
+ user_options = [
+ ('build-base=', 'b', "base build directory [default: 'build.build-base']"),
+ (
+ 'build-lib=',
+ None,
+ "build directory for all modules [default: 'build.build-lib']",
+ ),
+ ('build-temp=', 't', "temporary build directory [default: 'build.build-temp']"),
+ (
+ 'build-scripts=',
+ None,
+ "build directory for scripts [default: 'build.build-scripts']",
+ ),
+ ('bdist-base=', None, "temporary directory for built distributions"),
+ ('all', 'a', "remove all build output, not just temporary by-products"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['all']
+
+ def initialize_options(self):
+ self.build_base = None
+ self.build_lib = None
+ self.build_temp = None
+ self.build_scripts = None
+ self.bdist_base = None
+ self.all = None
+
+ def finalize_options(self):
+ self.set_undefined_options(
+ 'build',
+ ('build_base', 'build_base'),
+ ('build_lib', 'build_lib'),
+ ('build_scripts', 'build_scripts'),
+ ('build_temp', 'build_temp'),
+ )
+ self.set_undefined_options('bdist', ('bdist_base', 'bdist_base'))
+
+ def run(self):
+ # remove the build/temp. directory (unless it's already
+ # gone)
+ if os.path.exists(self.build_temp):
+ remove_tree(self.build_temp, dry_run=self.dry_run)
+ else:
+ log.debug("'%s' does not exist -- can't clean it", self.build_temp)
+
+ if self.all:
+ # remove build directories
+ for directory in (self.build_lib, self.bdist_base, self.build_scripts):
+ if os.path.exists(directory):
+ remove_tree(directory, dry_run=self.dry_run)
+ else:
+ log.warning("'%s' does not exist -- can't clean it", directory)
+
+ # just for the heck of it, try to remove the base build directory:
+ # we might have emptied it right now, but if not we don't care
+ if not self.dry_run:
+ try:
+ os.rmdir(self.build_base)
+ log.info("removing '%s'", self.build_base)
+ except OSError:
+ pass
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/config.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/config.py
new file mode 100644
index 0000000000000000000000000000000000000000..c825765c873f04e85b8c38869f0b3e5e416a2dad
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/config.py
@@ -0,0 +1,358 @@
+"""distutils.command.config
+
+Implements the Distutils 'config' command, a (mostly) empty command class
+that exists mainly to be sub-classed by specific module distributions and
+applications. The idea is that while every "config" command is different,
+at least they're all named the same, and users always see "config" in the
+list of standard commands. Also, this is a good place to put common
+configure-like tasks: "try to compile this C code", or "figure out where
+this header file lives".
+"""
+
+from __future__ import annotations
+
+import os
+import pathlib
+import re
+from collections.abc import Sequence
+from distutils._log import log
+
+from ..ccompiler import CCompiler, CompileError, LinkError, new_compiler
+from ..core import Command
+from ..errors import DistutilsExecError
+from ..sysconfig import customize_compiler
+
+LANG_EXT = {"c": ".c", "c++": ".cxx"}
+
+
+class config(Command):
+ description = "prepare to build"
+
+ user_options = [
+ ('compiler=', None, "specify the compiler type"),
+ ('cc=', None, "specify the compiler executable"),
+ ('include-dirs=', 'I', "list of directories to search for header files"),
+ ('define=', 'D', "C preprocessor macros to define"),
+ ('undef=', 'U', "C preprocessor macros to undefine"),
+ ('libraries=', 'l', "external C libraries to link with"),
+ ('library-dirs=', 'L', "directories to search for external C libraries"),
+ ('noisy', None, "show every action (compile, link, run, ...) taken"),
+ (
+ 'dump-source',
+ None,
+ "dump generated source files before attempting to compile them",
+ ),
+ ]
+
+ # The three standard command methods: since the "config" command
+ # does nothing by default, these are empty.
+
+ def initialize_options(self):
+ self.compiler = None
+ self.cc = None
+ self.include_dirs = None
+ self.libraries = None
+ self.library_dirs = None
+
+ # maximal output for now
+ self.noisy = 1
+ self.dump_source = 1
+
+ # list of temporary files generated along-the-way that we have
+ # to clean at some point
+ self.temp_files = []
+
+ def finalize_options(self):
+ if self.include_dirs is None:
+ self.include_dirs = self.distribution.include_dirs or []
+ elif isinstance(self.include_dirs, str):
+ self.include_dirs = self.include_dirs.split(os.pathsep)
+
+ if self.libraries is None:
+ self.libraries = []
+ elif isinstance(self.libraries, str):
+ self.libraries = [self.libraries]
+
+ if self.library_dirs is None:
+ self.library_dirs = []
+ elif isinstance(self.library_dirs, str):
+ self.library_dirs = self.library_dirs.split(os.pathsep)
+
+ def run(self):
+ pass
+
+ # Utility methods for actual "config" commands. The interfaces are
+ # loosely based on Autoconf macros of similar names. Sub-classes
+ # may use these freely.
+
+ def _check_compiler(self):
+ """Check that 'self.compiler' really is a CCompiler object;
+ if not, make it one.
+ """
+ if not isinstance(self.compiler, CCompiler):
+ self.compiler = new_compiler(
+ compiler=self.compiler, dry_run=self.dry_run, force=True
+ )
+ customize_compiler(self.compiler)
+ if self.include_dirs:
+ self.compiler.set_include_dirs(self.include_dirs)
+ if self.libraries:
+ self.compiler.set_libraries(self.libraries)
+ if self.library_dirs:
+ self.compiler.set_library_dirs(self.library_dirs)
+
+ def _gen_temp_sourcefile(self, body, headers, lang):
+ filename = "_configtest" + LANG_EXT[lang]
+ with open(filename, "w", encoding='utf-8') as file:
+ if headers:
+ for header in headers:
+ file.write(f"#include <{header}>\n")
+ file.write("\n")
+ file.write(body)
+ if body[-1] != "\n":
+ file.write("\n")
+ return filename
+
+ def _preprocess(self, body, headers, include_dirs, lang):
+ src = self._gen_temp_sourcefile(body, headers, lang)
+ out = "_configtest.i"
+ self.temp_files.extend([src, out])
+ self.compiler.preprocess(src, out, include_dirs=include_dirs)
+ return (src, out)
+
+ def _compile(self, body, headers, include_dirs, lang):
+ src = self._gen_temp_sourcefile(body, headers, lang)
+ if self.dump_source:
+ dump_file(src, f"compiling '{src}':")
+ (obj,) = self.compiler.object_filenames([src])
+ self.temp_files.extend([src, obj])
+ self.compiler.compile([src], include_dirs=include_dirs)
+ return (src, obj)
+
+ def _link(self, body, headers, include_dirs, libraries, library_dirs, lang):
+ (src, obj) = self._compile(body, headers, include_dirs, lang)
+ prog = os.path.splitext(os.path.basename(src))[0]
+ self.compiler.link_executable(
+ [obj],
+ prog,
+ libraries=libraries,
+ library_dirs=library_dirs,
+ target_lang=lang,
+ )
+
+ if self.compiler.exe_extension is not None:
+ prog = prog + self.compiler.exe_extension
+ self.temp_files.append(prog)
+
+ return (src, obj, prog)
+
+ def _clean(self, *filenames):
+ if not filenames:
+ filenames = self.temp_files
+ self.temp_files = []
+ log.info("removing: %s", ' '.join(filenames))
+ for filename in filenames:
+ try:
+ os.remove(filename)
+ except OSError:
+ pass
+
+ # XXX these ignore the dry-run flag: what to do, what to do? even if
+ # you want a dry-run build, you still need some sort of configuration
+ # info. My inclination is to make it up to the real config command to
+ # consult 'dry_run', and assume a default (minimal) configuration if
+ # true. The problem with trying to do it here is that you'd have to
+ # return either true or false from all the 'try' methods, neither of
+ # which is correct.
+
+ # XXX need access to the header search path and maybe default macros.
+
+ def try_cpp(self, body=None, headers=None, include_dirs=None, lang="c"):
+ """Construct a source file from 'body' (a string containing lines
+ of C/C++ code) and 'headers' (a list of header files to include)
+ and run it through the preprocessor. Return true if the
+ preprocessor succeeded, false if there were any errors.
+ ('body' probably isn't of much use, but what the heck.)
+ """
+ self._check_compiler()
+ ok = True
+ try:
+ self._preprocess(body, headers, include_dirs, lang)
+ except CompileError:
+ ok = False
+
+ self._clean()
+ return ok
+
+ def search_cpp(self, pattern, body=None, headers=None, include_dirs=None, lang="c"):
+ """Construct a source file (just like 'try_cpp()'), run it through
+ the preprocessor, and return true if any line of the output matches
+ 'pattern'. 'pattern' should either be a compiled regex object or a
+ string containing a regex. If both 'body' and 'headers' are None,
+ preprocesses an empty file -- which can be useful to determine the
+ symbols the preprocessor and compiler set by default.
+ """
+ self._check_compiler()
+ src, out = self._preprocess(body, headers, include_dirs, lang)
+
+ if isinstance(pattern, str):
+ pattern = re.compile(pattern)
+
+ with open(out, encoding='utf-8') as file:
+ match = any(pattern.search(line) for line in file)
+
+ self._clean()
+ return match
+
+ def try_compile(self, body, headers=None, include_dirs=None, lang="c"):
+ """Try to compile a source file built from 'body' and 'headers'.
+ Return true on success, false otherwise.
+ """
+ self._check_compiler()
+ try:
+ self._compile(body, headers, include_dirs, lang)
+ ok = True
+ except CompileError:
+ ok = False
+
+ log.info(ok and "success!" or "failure.")
+ self._clean()
+ return ok
+
+ def try_link(
+ self,
+ body,
+ headers=None,
+ include_dirs=None,
+ libraries=None,
+ library_dirs=None,
+ lang="c",
+ ):
+ """Try to compile and link a source file, built from 'body' and
+ 'headers', to executable form. Return true on success, false
+ otherwise.
+ """
+ self._check_compiler()
+ try:
+ self._link(body, headers, include_dirs, libraries, library_dirs, lang)
+ ok = True
+ except (CompileError, LinkError):
+ ok = False
+
+ log.info(ok and "success!" or "failure.")
+ self._clean()
+ return ok
+
+ def try_run(
+ self,
+ body,
+ headers=None,
+ include_dirs=None,
+ libraries=None,
+ library_dirs=None,
+ lang="c",
+ ):
+ """Try to compile, link to an executable, and run a program
+ built from 'body' and 'headers'. Return true on success, false
+ otherwise.
+ """
+ self._check_compiler()
+ try:
+ src, obj, exe = self._link(
+ body, headers, include_dirs, libraries, library_dirs, lang
+ )
+ self.spawn([exe])
+ ok = True
+ except (CompileError, LinkError, DistutilsExecError):
+ ok = False
+
+ log.info(ok and "success!" or "failure.")
+ self._clean()
+ return ok
+
+ # -- High-level methods --------------------------------------------
+ # (these are the ones that are actually likely to be useful
+ # when implementing a real-world config command!)
+
+ def check_func(
+ self,
+ func,
+ headers=None,
+ include_dirs=None,
+ libraries=None,
+ library_dirs=None,
+ decl=False,
+ call=False,
+ ):
+ """Determine if function 'func' is available by constructing a
+ source file that refers to 'func', and compiles and links it.
+ If everything succeeds, returns true; otherwise returns false.
+
+ The constructed source file starts out by including the header
+ files listed in 'headers'. If 'decl' is true, it then declares
+ 'func' (as "int func()"); you probably shouldn't supply 'headers'
+ and set 'decl' true in the same call, or you might get errors about
+ a conflicting declarations for 'func'. Finally, the constructed
+ 'main()' function either references 'func' or (if 'call' is true)
+ calls it. 'libraries' and 'library_dirs' are used when
+ linking.
+ """
+ self._check_compiler()
+ body = []
+ if decl:
+ body.append(f"int {func} ();")
+ body.append("int main () {")
+ if call:
+ body.append(f" {func}();")
+ else:
+ body.append(f" {func};")
+ body.append("}")
+ body = "\n".join(body) + "\n"
+
+ return self.try_link(body, headers, include_dirs, libraries, library_dirs)
+
+ def check_lib(
+ self,
+ library,
+ library_dirs=None,
+ headers=None,
+ include_dirs=None,
+ other_libraries: Sequence[str] = [],
+ ):
+ """Determine if 'library' is available to be linked against,
+ without actually checking that any particular symbols are provided
+ by it. 'headers' will be used in constructing the source file to
+ be compiled, but the only effect of this is to check if all the
+ header files listed are available. Any libraries listed in
+ 'other_libraries' will be included in the link, in case 'library'
+ has symbols that depend on other libraries.
+ """
+ self._check_compiler()
+ return self.try_link(
+ "int main (void) { }",
+ headers,
+ include_dirs,
+ [library] + list(other_libraries),
+ library_dirs,
+ )
+
+ def check_header(self, header, include_dirs=None, library_dirs=None, lang="c"):
+ """Determine if the system header file named by 'header_file'
+ exists and can be found by the preprocessor; return true if so,
+ false otherwise.
+ """
+ return self.try_cpp(
+ body="/* No body */", headers=[header], include_dirs=include_dirs
+ )
+
+
+def dump_file(filename, head=None):
+ """Dumps a file content into log.info.
+
+ If head is not None, will be dumped before the file content.
+ """
+ if head is None:
+ log.info('%s', filename)
+ else:
+ log.info(head)
+ log.info(pathlib.Path(filename).read_text(encoding='utf-8'))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install.py
new file mode 100644
index 0000000000000000000000000000000000000000..dc17e56a8070b26f0e3d09c82250e006f1aed826
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install.py
@@ -0,0 +1,805 @@
+"""distutils.command.install
+
+Implements the Distutils 'install' command."""
+
+from __future__ import annotations
+
+import collections
+import contextlib
+import itertools
+import os
+import sys
+import sysconfig
+from distutils._log import log
+from site import USER_BASE, USER_SITE
+from typing import ClassVar
+
+from ..core import Command
+from ..debug import DEBUG
+from ..errors import DistutilsOptionError, DistutilsPlatformError
+from ..file_util import write_file
+from ..sysconfig import get_config_vars
+from ..util import change_root, convert_path, get_platform, subst_vars
+from . import _framework_compat as fw
+
+HAS_USER_SITE = True
+
+WINDOWS_SCHEME = {
+ 'purelib': '{base}/Lib/site-packages',
+ 'platlib': '{base}/Lib/site-packages',
+ 'headers': '{base}/Include/{dist_name}',
+ 'scripts': '{base}/Scripts',
+ 'data': '{base}',
+}
+
+INSTALL_SCHEMES = {
+ 'posix_prefix': {
+ 'purelib': '{base}/lib/{implementation_lower}{py_version_short}/site-packages',
+ 'platlib': '{platbase}/{platlibdir}/{implementation_lower}'
+ '{py_version_short}/site-packages',
+ 'headers': '{base}/include/{implementation_lower}'
+ '{py_version_short}{abiflags}/{dist_name}',
+ 'scripts': '{base}/bin',
+ 'data': '{base}',
+ },
+ 'posix_home': {
+ 'purelib': '{base}/lib/{implementation_lower}',
+ 'platlib': '{base}/{platlibdir}/{implementation_lower}',
+ 'headers': '{base}/include/{implementation_lower}/{dist_name}',
+ 'scripts': '{base}/bin',
+ 'data': '{base}',
+ },
+ 'nt': WINDOWS_SCHEME,
+ 'pypy': {
+ 'purelib': '{base}/site-packages',
+ 'platlib': '{base}/site-packages',
+ 'headers': '{base}/include/{dist_name}',
+ 'scripts': '{base}/bin',
+ 'data': '{base}',
+ },
+ 'pypy_nt': {
+ 'purelib': '{base}/site-packages',
+ 'platlib': '{base}/site-packages',
+ 'headers': '{base}/include/{dist_name}',
+ 'scripts': '{base}/Scripts',
+ 'data': '{base}',
+ },
+}
+
+# user site schemes
+if HAS_USER_SITE:
+ INSTALL_SCHEMES['nt_user'] = {
+ 'purelib': '{usersite}',
+ 'platlib': '{usersite}',
+ 'headers': '{userbase}/{implementation}{py_version_nodot_plat}'
+ '/Include/{dist_name}',
+ 'scripts': '{userbase}/{implementation}{py_version_nodot_plat}/Scripts',
+ 'data': '{userbase}',
+ }
+
+ INSTALL_SCHEMES['posix_user'] = {
+ 'purelib': '{usersite}',
+ 'platlib': '{usersite}',
+ 'headers': '{userbase}/include/{implementation_lower}'
+ '{py_version_short}{abiflags}/{dist_name}',
+ 'scripts': '{userbase}/bin',
+ 'data': '{userbase}',
+ }
+
+
+INSTALL_SCHEMES.update(fw.schemes)
+
+
+# The keys to an installation scheme; if any new types of files are to be
+# installed, be sure to add an entry to every installation scheme above,
+# and to SCHEME_KEYS here.
+SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
+
+
+def _load_sysconfig_schemes():
+ with contextlib.suppress(AttributeError):
+ return {
+ scheme: sysconfig.get_paths(scheme, expand=False)
+ for scheme in sysconfig.get_scheme_names()
+ }
+
+
+def _load_schemes():
+ """
+ Extend default schemes with schemes from sysconfig.
+ """
+
+ sysconfig_schemes = _load_sysconfig_schemes() or {}
+
+ return {
+ scheme: {
+ **INSTALL_SCHEMES.get(scheme, {}),
+ **sysconfig_schemes.get(scheme, {}),
+ }
+ for scheme in set(itertools.chain(INSTALL_SCHEMES, sysconfig_schemes))
+ }
+
+
+def _get_implementation():
+ if hasattr(sys, 'pypy_version_info'):
+ return 'PyPy'
+ else:
+ return 'Python'
+
+
+def _select_scheme(ob, name):
+ scheme = _inject_headers(name, _load_scheme(_resolve_scheme(name)))
+ vars(ob).update(_remove_set(ob, _scheme_attrs(scheme)))
+
+
+def _remove_set(ob, attrs):
+ """
+ Include only attrs that are None in ob.
+ """
+ return {key: value for key, value in attrs.items() if getattr(ob, key) is None}
+
+
+def _resolve_scheme(name):
+ os_name, sep, key = name.partition('_')
+ try:
+ resolved = sysconfig.get_preferred_scheme(key)
+ except Exception:
+ resolved = fw.scheme(name)
+ return resolved
+
+
+def _load_scheme(name):
+ return _load_schemes()[name]
+
+
+def _inject_headers(name, scheme):
+ """
+ Given a scheme name and the resolved scheme,
+ if the scheme does not include headers, resolve
+ the fallback scheme for the name and use headers
+ from it. pypa/distutils#88
+ """
+ # Bypass the preferred scheme, which may not
+ # have defined headers.
+ fallback = _load_scheme(name)
+ scheme.setdefault('headers', fallback['headers'])
+ return scheme
+
+
+def _scheme_attrs(scheme):
+ """Resolve install directories by applying the install schemes."""
+ return {f'install_{key}': scheme[key] for key in SCHEME_KEYS}
+
+
+class install(Command):
+ description = "install everything from build directory"
+
+ user_options = [
+ # Select installation scheme and set base director(y|ies)
+ ('prefix=', None, "installation prefix"),
+ ('exec-prefix=', None, "(Unix only) prefix for platform-specific files"),
+ ('home=', None, "(Unix only) home directory to install under"),
+ # Or, just set the base director(y|ies)
+ (
+ 'install-base=',
+ None,
+ "base installation directory (instead of --prefix or --home)",
+ ),
+ (
+ 'install-platbase=',
+ None,
+ "base installation directory for platform-specific files (instead of --exec-prefix or --home)",
+ ),
+ ('root=', None, "install everything relative to this alternate root directory"),
+ # Or, explicitly set the installation scheme
+ (
+ 'install-purelib=',
+ None,
+ "installation directory for pure Python module distributions",
+ ),
+ (
+ 'install-platlib=',
+ None,
+ "installation directory for non-pure module distributions",
+ ),
+ (
+ 'install-lib=',
+ None,
+ "installation directory for all module distributions (overrides --install-purelib and --install-platlib)",
+ ),
+ ('install-headers=', None, "installation directory for C/C++ headers"),
+ ('install-scripts=', None, "installation directory for Python scripts"),
+ ('install-data=', None, "installation directory for data files"),
+ # Byte-compilation options -- see install_lib.py for details, as
+ # these are duplicated from there (but only install_lib does
+ # anything with them).
+ ('compile', 'c', "compile .py to .pyc [default]"),
+ ('no-compile', None, "don't compile .py files"),
+ (
+ 'optimize=',
+ 'O',
+ "also compile with optimization: -O1 for \"python -O\", "
+ "-O2 for \"python -OO\", and -O0 to disable [default: -O0]",
+ ),
+ # Miscellaneous control options
+ ('force', 'f', "force installation (overwrite any existing files)"),
+ ('skip-build', None, "skip rebuilding everything (for testing/debugging)"),
+ # Where to install documentation (eventually!)
+ # ('doc-format=', None, "format of documentation to generate"),
+ # ('install-man=', None, "directory for Unix man pages"),
+ # ('install-html=', None, "directory for HTML documentation"),
+ # ('install-info=', None, "directory for GNU info files"),
+ ('record=', None, "filename in which to record list of installed files"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['compile', 'force', 'skip-build']
+
+ if HAS_USER_SITE:
+ user_options.append((
+ 'user',
+ None,
+ f"install in user site-package '{USER_SITE}'",
+ ))
+ boolean_options.append('user')
+
+ negative_opt: ClassVar[dict[str, str]] = {'no-compile': 'compile'}
+
+ def initialize_options(self) -> None:
+ """Initializes options."""
+ # High-level options: these select both an installation base
+ # and scheme.
+ self.prefix: str | None = None
+ self.exec_prefix: str | None = None
+ self.home: str | None = None
+ self.user = False
+
+ # These select only the installation base; it's up to the user to
+ # specify the installation scheme (currently, that means supplying
+ # the --install-{platlib,purelib,scripts,data} options).
+ self.install_base = None
+ self.install_platbase = None
+ self.root: str | None = None
+
+ # These options are the actual installation directories; if not
+ # supplied by the user, they are filled in using the installation
+ # scheme implied by prefix/exec-prefix/home and the contents of
+ # that installation scheme.
+ self.install_purelib = None # for pure module distributions
+ self.install_platlib = None # non-pure (dists w/ extensions)
+ self.install_headers = None # for C/C++ headers
+ self.install_lib: str | None = None # set to either purelib or platlib
+ self.install_scripts = None
+ self.install_data = None
+ self.install_userbase = USER_BASE
+ self.install_usersite = USER_SITE
+
+ self.compile = None
+ self.optimize = None
+
+ # Deprecated
+ # These two are for putting non-packagized distributions into their
+ # own directory and creating a .pth file if it makes sense.
+ # 'extra_path' comes from the setup file; 'install_path_file' can
+ # be turned off if it makes no sense to install a .pth file. (But
+ # better to install it uselessly than to guess wrong and not
+ # install it when it's necessary and would be used!) Currently,
+ # 'install_path_file' is always true unless some outsider meddles
+ # with it.
+ self.extra_path = None
+ self.install_path_file = True
+
+ # 'force' forces installation, even if target files are not
+ # out-of-date. 'skip_build' skips running the "build" command,
+ # handy if you know it's not necessary. 'warn_dir' (which is *not*
+ # a user option, it's just there so the bdist_* commands can turn
+ # it off) determines whether we warn about installing to a
+ # directory not in sys.path.
+ self.force = False
+ self.skip_build = False
+ self.warn_dir = True
+
+ # These are only here as a conduit from the 'build' command to the
+ # 'install_*' commands that do the real work. ('build_base' isn't
+ # actually used anywhere, but it might be useful in future.) They
+ # are not user options, because if the user told the install
+ # command where the build directory is, that wouldn't affect the
+ # build command.
+ self.build_base = None
+ self.build_lib = None
+
+ # Not defined yet because we don't know anything about
+ # documentation yet.
+ # self.install_man = None
+ # self.install_html = None
+ # self.install_info = None
+
+ self.record = None
+
+ # -- Option finalizing methods -------------------------------------
+ # (This is rather more involved than for most commands,
+ # because this is where the policy for installing third-
+ # party Python modules on various platforms given a wide
+ # array of user input is decided. Yes, it's quite complex!)
+
+ def finalize_options(self) -> None: # noqa: C901
+ """Finalizes options."""
+ # This method (and its helpers, like 'finalize_unix()',
+ # 'finalize_other()', and 'select_scheme()') is where the default
+ # installation directories for modules, extension modules, and
+ # anything else we care to install from a Python module
+ # distribution. Thus, this code makes a pretty important policy
+ # statement about how third-party stuff is added to a Python
+ # installation! Note that the actual work of installation is done
+ # by the relatively simple 'install_*' commands; they just take
+ # their orders from the installation directory options determined
+ # here.
+
+ # Check for errors/inconsistencies in the options; first, stuff
+ # that's wrong on any platform.
+
+ if (self.prefix or self.exec_prefix or self.home) and (
+ self.install_base or self.install_platbase
+ ):
+ raise DistutilsOptionError(
+ "must supply either prefix/exec-prefix/home or install-base/install-platbase -- not both"
+ )
+
+ if self.home and (self.prefix or self.exec_prefix):
+ raise DistutilsOptionError(
+ "must supply either home or prefix/exec-prefix -- not both"
+ )
+
+ if self.user and (
+ self.prefix
+ or self.exec_prefix
+ or self.home
+ or self.install_base
+ or self.install_platbase
+ ):
+ raise DistutilsOptionError(
+ "can't combine user with prefix, "
+ "exec_prefix/home, or install_(plat)base"
+ )
+
+ # Next, stuff that's wrong (or dubious) only on certain platforms.
+ if os.name != "posix":
+ if self.exec_prefix:
+ self.warn("exec-prefix option ignored on this platform")
+ self.exec_prefix = None
+
+ # Now the interesting logic -- so interesting that we farm it out
+ # to other methods. The goal of these methods is to set the final
+ # values for the install_{lib,scripts,data,...} options, using as
+ # input a heady brew of prefix, exec_prefix, home, install_base,
+ # install_platbase, user-supplied versions of
+ # install_{purelib,platlib,lib,scripts,data,...}, and the
+ # install schemes. Phew!
+
+ self.dump_dirs("pre-finalize_{unix,other}")
+
+ if os.name == 'posix':
+ self.finalize_unix()
+ else:
+ self.finalize_other()
+
+ self.dump_dirs("post-finalize_{unix,other}()")
+
+ # Expand configuration variables, tilde, etc. in self.install_base
+ # and self.install_platbase -- that way, we can use $base or
+ # $platbase in the other installation directories and not worry
+ # about needing recursive variable expansion (shudder).
+
+ py_version = sys.version.split()[0]
+ (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
+ try:
+ abiflags = sys.abiflags
+ except AttributeError:
+ # sys.abiflags may not be defined on all platforms.
+ abiflags = ''
+ local_vars = {
+ 'dist_name': self.distribution.get_name(),
+ 'dist_version': self.distribution.get_version(),
+ 'dist_fullname': self.distribution.get_fullname(),
+ 'py_version': py_version,
+ 'py_version_short': f'{sys.version_info.major}.{sys.version_info.minor}',
+ 'py_version_nodot': f'{sys.version_info.major}{sys.version_info.minor}',
+ 'sys_prefix': prefix,
+ 'prefix': prefix,
+ 'sys_exec_prefix': exec_prefix,
+ 'exec_prefix': exec_prefix,
+ 'abiflags': abiflags,
+ 'platlibdir': getattr(sys, 'platlibdir', 'lib'),
+ 'implementation_lower': _get_implementation().lower(),
+ 'implementation': _get_implementation(),
+ }
+
+ # vars for compatibility on older Pythons
+ compat_vars = dict(
+ # Python 3.9 and earlier
+ py_version_nodot_plat=getattr(sys, 'winver', '').replace('.', ''),
+ )
+
+ if HAS_USER_SITE:
+ local_vars['userbase'] = self.install_userbase
+ local_vars['usersite'] = self.install_usersite
+
+ self.config_vars = collections.ChainMap(
+ local_vars,
+ sysconfig.get_config_vars(),
+ compat_vars,
+ fw.vars(),
+ )
+
+ self.expand_basedirs()
+
+ self.dump_dirs("post-expand_basedirs()")
+
+ # Now define config vars for the base directories so we can expand
+ # everything else.
+ local_vars['base'] = self.install_base
+ local_vars['platbase'] = self.install_platbase
+
+ if DEBUG:
+ from pprint import pprint
+
+ print("config vars:")
+ pprint(dict(self.config_vars))
+
+ # Expand "~" and configuration variables in the installation
+ # directories.
+ self.expand_dirs()
+
+ self.dump_dirs("post-expand_dirs()")
+
+ # Create directories in the home dir:
+ if self.user:
+ self.create_home_path()
+
+ # Pick the actual directory to install all modules to: either
+ # install_purelib or install_platlib, depending on whether this
+ # module distribution is pure or not. Of course, if the user
+ # already specified install_lib, use their selection.
+ if self.install_lib is None:
+ if self.distribution.has_ext_modules(): # has extensions: non-pure
+ self.install_lib = self.install_platlib
+ else:
+ self.install_lib = self.install_purelib
+
+ # Convert directories from Unix /-separated syntax to the local
+ # convention.
+ self.convert_paths(
+ 'lib',
+ 'purelib',
+ 'platlib',
+ 'scripts',
+ 'data',
+ 'headers',
+ 'userbase',
+ 'usersite',
+ )
+
+ # Deprecated
+ # Well, we're not actually fully completely finalized yet: we still
+ # have to deal with 'extra_path', which is the hack for allowing
+ # non-packagized module distributions (hello, Numerical Python!) to
+ # get their own directories.
+ self.handle_extra_path()
+ self.install_libbase = self.install_lib # needed for .pth file
+ self.install_lib = os.path.join(self.install_lib, self.extra_dirs)
+
+ # If a new root directory was supplied, make all the installation
+ # dirs relative to it.
+ if self.root is not None:
+ self.change_roots(
+ 'libbase', 'lib', 'purelib', 'platlib', 'scripts', 'data', 'headers'
+ )
+
+ self.dump_dirs("after prepending root")
+
+ # Find out the build directories, ie. where to install from.
+ self.set_undefined_options(
+ 'build', ('build_base', 'build_base'), ('build_lib', 'build_lib')
+ )
+
+ # Punt on doc directories for now -- after all, we're punting on
+ # documentation completely!
+
+ def dump_dirs(self, msg) -> None:
+ """Dumps the list of user options."""
+ if not DEBUG:
+ return
+ from ..fancy_getopt import longopt_xlate
+
+ log.debug(msg + ":")
+ for opt in self.user_options:
+ opt_name = opt[0]
+ if opt_name[-1] == "=":
+ opt_name = opt_name[0:-1]
+ if opt_name in self.negative_opt:
+ opt_name = self.negative_opt[opt_name]
+ opt_name = opt_name.translate(longopt_xlate)
+ val = not getattr(self, opt_name)
+ else:
+ opt_name = opt_name.translate(longopt_xlate)
+ val = getattr(self, opt_name)
+ log.debug(" %s: %s", opt_name, val)
+
+ def finalize_unix(self) -> None:
+ """Finalizes options for posix platforms."""
+ if self.install_base is not None or self.install_platbase is not None:
+ incomplete_scheme = (
+ (
+ self.install_lib is None
+ and self.install_purelib is None
+ and self.install_platlib is None
+ )
+ or self.install_headers is None
+ or self.install_scripts is None
+ or self.install_data is None
+ )
+ if incomplete_scheme:
+ raise DistutilsOptionError(
+ "install-base or install-platbase supplied, but "
+ "installation scheme is incomplete"
+ )
+ return
+
+ if self.user:
+ if self.install_userbase is None:
+ raise DistutilsPlatformError("User base directory is not specified")
+ self.install_base = self.install_platbase = self.install_userbase
+ self.select_scheme("posix_user")
+ elif self.home is not None:
+ self.install_base = self.install_platbase = self.home
+ self.select_scheme("posix_home")
+ else:
+ if self.prefix is None:
+ if self.exec_prefix is not None:
+ raise DistutilsOptionError(
+ "must not supply exec-prefix without prefix"
+ )
+
+ # Allow Fedora to add components to the prefix
+ _prefix_addition = getattr(sysconfig, '_prefix_addition', "")
+
+ self.prefix = os.path.normpath(sys.prefix) + _prefix_addition
+ self.exec_prefix = os.path.normpath(sys.exec_prefix) + _prefix_addition
+
+ else:
+ if self.exec_prefix is None:
+ self.exec_prefix = self.prefix
+
+ self.install_base = self.prefix
+ self.install_platbase = self.exec_prefix
+ self.select_scheme("posix_prefix")
+
+ def finalize_other(self) -> None:
+ """Finalizes options for non-posix platforms"""
+ if self.user:
+ if self.install_userbase is None:
+ raise DistutilsPlatformError("User base directory is not specified")
+ self.install_base = self.install_platbase = self.install_userbase
+ self.select_scheme(os.name + "_user")
+ elif self.home is not None:
+ self.install_base = self.install_platbase = self.home
+ self.select_scheme("posix_home")
+ else:
+ if self.prefix is None:
+ self.prefix = os.path.normpath(sys.prefix)
+
+ self.install_base = self.install_platbase = self.prefix
+ try:
+ self.select_scheme(os.name)
+ except KeyError:
+ raise DistutilsPlatformError(
+ f"I don't know how to install stuff on '{os.name}'"
+ )
+
+ def select_scheme(self, name) -> None:
+ _select_scheme(self, name)
+
+ def _expand_attrs(self, attrs):
+ for attr in attrs:
+ val = getattr(self, attr)
+ if val is not None:
+ if os.name in ('posix', 'nt'):
+ val = os.path.expanduser(val)
+ val = subst_vars(val, self.config_vars)
+ setattr(self, attr, val)
+
+ def expand_basedirs(self) -> None:
+ """Calls `os.path.expanduser` on install_base, install_platbase and
+ root."""
+ self._expand_attrs(['install_base', 'install_platbase', 'root'])
+
+ def expand_dirs(self) -> None:
+ """Calls `os.path.expanduser` on install dirs."""
+ self._expand_attrs([
+ 'install_purelib',
+ 'install_platlib',
+ 'install_lib',
+ 'install_headers',
+ 'install_scripts',
+ 'install_data',
+ ])
+
+ def convert_paths(self, *names) -> None:
+ """Call `convert_path` over `names`."""
+ for name in names:
+ attr = "install_" + name
+ setattr(self, attr, convert_path(getattr(self, attr)))
+
+ def handle_extra_path(self) -> None:
+ """Set `path_file` and `extra_dirs` using `extra_path`."""
+ if self.extra_path is None:
+ self.extra_path = self.distribution.extra_path
+
+ if self.extra_path is not None:
+ log.warning(
+ "Distribution option extra_path is deprecated. "
+ "See issue27919 for details."
+ )
+ if isinstance(self.extra_path, str):
+ self.extra_path = self.extra_path.split(',')
+
+ if len(self.extra_path) == 1:
+ path_file = extra_dirs = self.extra_path[0]
+ elif len(self.extra_path) == 2:
+ path_file, extra_dirs = self.extra_path
+ else:
+ raise DistutilsOptionError(
+ "'extra_path' option must be a list, tuple, or "
+ "comma-separated string with 1 or 2 elements"
+ )
+
+ # convert to local form in case Unix notation used (as it
+ # should be in setup scripts)
+ extra_dirs = convert_path(extra_dirs)
+ else:
+ path_file = None
+ extra_dirs = ''
+
+ # XXX should we warn if path_file and not extra_dirs? (in which
+ # case the path file would be harmless but pointless)
+ self.path_file = path_file
+ self.extra_dirs = extra_dirs
+
+ def change_roots(self, *names) -> None:
+ """Change the install directories pointed by name using root."""
+ for name in names:
+ attr = "install_" + name
+ setattr(self, attr, change_root(self.root, getattr(self, attr)))
+
+ def create_home_path(self) -> None:
+ """Create directories under ~."""
+ if not self.user:
+ return
+ home = convert_path(os.path.expanduser("~"))
+ for path in self.config_vars.values():
+ if str(path).startswith(home) and not os.path.isdir(path):
+ self.debug_print(f"os.makedirs('{path}', 0o700)")
+ os.makedirs(path, 0o700)
+
+ # -- Command execution methods -------------------------------------
+
+ def run(self):
+ """Runs the command."""
+ # Obviously have to build before we can install
+ if not self.skip_build:
+ self.run_command('build')
+ # If we built for any other platform, we can't install.
+ build_plat = self.distribution.get_command_obj('build').plat_name
+ # check warn_dir - it is a clue that the 'install' is happening
+ # internally, and not to sys.path, so we don't check the platform
+ # matches what we are running.
+ if self.warn_dir and build_plat != get_platform():
+ raise DistutilsPlatformError("Can't install when cross-compiling")
+
+ # Run all sub-commands (at least those that need to be run)
+ for cmd_name in self.get_sub_commands():
+ self.run_command(cmd_name)
+
+ if self.path_file:
+ self.create_path_file()
+
+ # write list of installed files, if requested.
+ if self.record:
+ outputs = self.get_outputs()
+ if self.root: # strip any package prefix
+ root_len = len(self.root)
+ for counter in range(len(outputs)):
+ outputs[counter] = outputs[counter][root_len:]
+ self.execute(
+ write_file,
+ (self.record, outputs),
+ f"writing list of installed files to '{self.record}'",
+ )
+
+ sys_path = map(os.path.normpath, sys.path)
+ sys_path = map(os.path.normcase, sys_path)
+ install_lib = os.path.normcase(os.path.normpath(self.install_lib))
+ if (
+ self.warn_dir
+ and not (self.path_file and self.install_path_file)
+ and install_lib not in sys_path
+ ):
+ log.debug(
+ (
+ "modules installed to '%s', which is not in "
+ "Python's module search path (sys.path) -- "
+ "you'll have to change the search path yourself"
+ ),
+ self.install_lib,
+ )
+
+ def create_path_file(self):
+ """Creates the .pth file"""
+ filename = os.path.join(self.install_libbase, self.path_file + ".pth")
+ if self.install_path_file:
+ self.execute(
+ write_file, (filename, [self.extra_dirs]), f"creating {filename}"
+ )
+ else:
+ self.warn(f"path file '{filename}' not created")
+
+ # -- Reporting methods ---------------------------------------------
+
+ def get_outputs(self):
+ """Assembles the outputs of all the sub-commands."""
+ outputs = []
+ for cmd_name in self.get_sub_commands():
+ cmd = self.get_finalized_command(cmd_name)
+ # Add the contents of cmd.get_outputs(), ensuring
+ # that outputs doesn't contain duplicate entries
+ for filename in cmd.get_outputs():
+ if filename not in outputs:
+ outputs.append(filename)
+
+ if self.path_file and self.install_path_file:
+ outputs.append(os.path.join(self.install_libbase, self.path_file + ".pth"))
+
+ return outputs
+
+ def get_inputs(self):
+ """Returns the inputs of all the sub-commands"""
+ # XXX gee, this looks familiar ;-(
+ inputs = []
+ for cmd_name in self.get_sub_commands():
+ cmd = self.get_finalized_command(cmd_name)
+ inputs.extend(cmd.get_inputs())
+
+ return inputs
+
+ # -- Predicates for sub-command list -------------------------------
+
+ def has_lib(self):
+ """Returns true if the current distribution has any Python
+ modules to install."""
+ return (
+ self.distribution.has_pure_modules() or self.distribution.has_ext_modules()
+ )
+
+ def has_headers(self):
+ """Returns true if the current distribution has any headers to
+ install."""
+ return self.distribution.has_headers()
+
+ def has_scripts(self):
+ """Returns true if the current distribution has any scripts to.
+ install."""
+ return self.distribution.has_scripts()
+
+ def has_data(self):
+ """Returns true if the current distribution has any data to.
+ install."""
+ return self.distribution.has_data_files()
+
+ # 'sub_commands': a list of commands this command might have to run to
+ # get its work done. See cmd.py for more info.
+ sub_commands = [
+ ('install_lib', has_lib),
+ ('install_headers', has_headers),
+ ('install_scripts', has_scripts),
+ ('install_data', has_data),
+ ('install_egg_info', lambda self: True),
+ ]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_data.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_data.py
new file mode 100644
index 0000000000000000000000000000000000000000..4ad186e8ec61b92967ea1c12cdca51d00e82dd15
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_data.py
@@ -0,0 +1,94 @@
+"""distutils.command.install_data
+
+Implements the Distutils 'install_data' command, for installing
+platform-independent data files."""
+
+# contributed by Bastian Kleineidam
+
+from __future__ import annotations
+
+import functools
+import os
+from collections.abc import Iterable
+from typing import ClassVar
+
+from ..core import Command
+from ..util import change_root, convert_path
+
+
+class install_data(Command):
+ description = "install data files"
+
+ user_options = [
+ (
+ 'install-dir=',
+ 'd',
+ "base directory for installing data files [default: installation base dir]",
+ ),
+ ('root=', None, "install everything relative to this alternate root directory"),
+ ('force', 'f', "force installation (overwrite existing files)"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['force']
+
+ def initialize_options(self):
+ self.install_dir = None
+ self.outfiles = []
+ self.root = None
+ self.force = False
+ self.data_files = self.distribution.data_files
+ self.warn_dir = True
+
+ def finalize_options(self) -> None:
+ self.set_undefined_options(
+ 'install',
+ ('install_data', 'install_dir'),
+ ('root', 'root'),
+ ('force', 'force'),
+ )
+
+ def run(self) -> None:
+ self.mkpath(self.install_dir)
+ for f in self.data_files:
+ self._copy(f)
+
+ @functools.singledispatchmethod
+ def _copy(self, f: tuple[str | os.PathLike, Iterable[str | os.PathLike]]):
+ # it's a tuple with path to install to and a list of files
+ dir = convert_path(f[0])
+ if not os.path.isabs(dir):
+ dir = os.path.join(self.install_dir, dir)
+ elif self.root:
+ dir = change_root(self.root, dir)
+ self.mkpath(dir)
+
+ if f[1] == []:
+ # If there are no files listed, the user must be
+ # trying to create an empty directory, so add the
+ # directory to the list of output files.
+ self.outfiles.append(dir)
+ else:
+ # Copy files, adding them to the list of output files.
+ for data in f[1]:
+ data = convert_path(data)
+ (out, _) = self.copy_file(data, dir)
+ self.outfiles.append(out)
+
+ @_copy.register(str)
+ @_copy.register(os.PathLike)
+ def _(self, f: str | os.PathLike):
+ # it's a simple file, so copy it
+ f = convert_path(f)
+ if self.warn_dir:
+ self.warn(
+ "setup script did not provide a directory for "
+ f"'{f}' -- installing right in '{self.install_dir}'"
+ )
+ (out, _) = self.copy_file(f, self.install_dir)
+ self.outfiles.append(out)
+
+ def get_inputs(self):
+ return self.data_files or []
+
+ def get_outputs(self):
+ return self.outfiles
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_egg_info.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_egg_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..230e94ab46f0c87f58428b456e9d2fe98eca27a4
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_egg_info.py
@@ -0,0 +1,91 @@
+"""
+distutils.command.install_egg_info
+
+Implements the Distutils 'install_egg_info' command, for installing
+a package's PKG-INFO metadata.
+"""
+
+import os
+import re
+import sys
+from typing import ClassVar
+
+from .. import dir_util
+from .._log import log
+from ..cmd import Command
+
+
+class install_egg_info(Command):
+ """Install an .egg-info file for the package"""
+
+ description = "Install package's PKG-INFO metadata as an .egg-info file"
+ user_options: ClassVar[list[tuple[str, str, str]]] = [
+ ('install-dir=', 'd', "directory to install to"),
+ ]
+
+ def initialize_options(self):
+ self.install_dir = None
+
+ @property
+ def basename(self):
+ """
+ Allow basename to be overridden by child class.
+ Ref pypa/distutils#2.
+ """
+ name = to_filename(safe_name(self.distribution.get_name()))
+ version = to_filename(safe_version(self.distribution.get_version()))
+ return f"{name}-{version}-py{sys.version_info.major}.{sys.version_info.minor}.egg-info"
+
+ def finalize_options(self):
+ self.set_undefined_options('install_lib', ('install_dir', 'install_dir'))
+ self.target = os.path.join(self.install_dir, self.basename)
+ self.outputs = [self.target]
+
+ def run(self):
+ target = self.target
+ if os.path.isdir(target) and not os.path.islink(target):
+ dir_util.remove_tree(target, dry_run=self.dry_run)
+ elif os.path.exists(target):
+ self.execute(os.unlink, (self.target,), "Removing " + target)
+ elif not os.path.isdir(self.install_dir):
+ self.execute(
+ os.makedirs, (self.install_dir,), "Creating " + self.install_dir
+ )
+ log.info("Writing %s", target)
+ if not self.dry_run:
+ with open(target, 'w', encoding='UTF-8') as f:
+ self.distribution.metadata.write_pkg_file(f)
+
+ def get_outputs(self):
+ return self.outputs
+
+
+# The following routines are taken from setuptools' pkg_resources module and
+# can be replaced by importing them from pkg_resources once it is included
+# in the stdlib.
+
+
+def safe_name(name):
+ """Convert an arbitrary string to a standard distribution name
+
+ Any runs of non-alphanumeric/. characters are replaced with a single '-'.
+ """
+ return re.sub('[^A-Za-z0-9.]+', '-', name)
+
+
+def safe_version(version):
+ """Convert an arbitrary string to a standard version string
+
+ Spaces become dots, and all other non-alphanumeric characters become
+ dashes, with runs of multiple dashes condensed to a single dash.
+ """
+ version = version.replace(' ', '.')
+ return re.sub('[^A-Za-z0-9.]+', '-', version)
+
+
+def to_filename(name):
+ """Convert a project or version name to its filename-escaped form
+
+ Any '-' characters are currently replaced with '_'.
+ """
+ return name.replace('-', '_')
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_headers.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_headers.py
new file mode 100644
index 0000000000000000000000000000000000000000..97af1371efcc73423e9b91d7b3ced684ff936377
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_headers.py
@@ -0,0 +1,46 @@
+"""distutils.command.install_headers
+
+Implements the Distutils 'install_headers' command, to install C/C++ header
+files to the Python include directory."""
+
+from typing import ClassVar
+
+from ..core import Command
+
+
+# XXX force is never used
+class install_headers(Command):
+ description = "install C/C++ header files"
+
+ user_options: ClassVar[list[tuple[str, str, str]]] = [
+ ('install-dir=', 'd', "directory to install header files to"),
+ ('force', 'f', "force installation (overwrite existing files)"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['force']
+
+ def initialize_options(self):
+ self.install_dir = None
+ self.force = False
+ self.outfiles = []
+
+ def finalize_options(self):
+ self.set_undefined_options(
+ 'install', ('install_headers', 'install_dir'), ('force', 'force')
+ )
+
+ def run(self):
+ headers = self.distribution.headers
+ if not headers:
+ return
+
+ self.mkpath(self.install_dir)
+ for header in headers:
+ (out, _) = self.copy_file(header, self.install_dir)
+ self.outfiles.append(out)
+
+ def get_inputs(self):
+ return self.distribution.headers or []
+
+ def get_outputs(self):
+ return self.outfiles
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_lib.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_lib.py
new file mode 100644
index 0000000000000000000000000000000000000000..2aababf8004d4636f039dd0609457387a0346ca0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_lib.py
@@ -0,0 +1,238 @@
+"""distutils.command.install_lib
+
+Implements the Distutils 'install_lib' command
+(install all Python modules)."""
+
+from __future__ import annotations
+
+import importlib.util
+import os
+import sys
+from typing import Any, ClassVar
+
+from ..core import Command
+from ..errors import DistutilsOptionError
+
+# Extension for Python source files.
+PYTHON_SOURCE_EXTENSION = ".py"
+
+
+class install_lib(Command):
+ description = "install all Python modules (extensions and pure Python)"
+
+ # The byte-compilation options are a tad confusing. Here are the
+ # possible scenarios:
+ # 1) no compilation at all (--no-compile --no-optimize)
+ # 2) compile .pyc only (--compile --no-optimize; default)
+ # 3) compile .pyc and "opt-1" .pyc (--compile --optimize)
+ # 4) compile "opt-1" .pyc only (--no-compile --optimize)
+ # 5) compile .pyc and "opt-2" .pyc (--compile --optimize-more)
+ # 6) compile "opt-2" .pyc only (--no-compile --optimize-more)
+ #
+ # The UI for this is two options, 'compile' and 'optimize'.
+ # 'compile' is strictly boolean, and only decides whether to
+ # generate .pyc files. 'optimize' is three-way (0, 1, or 2), and
+ # decides both whether to generate .pyc files and what level of
+ # optimization to use.
+
+ user_options = [
+ ('install-dir=', 'd', "directory to install to"),
+ ('build-dir=', 'b', "build directory (where to install from)"),
+ ('force', 'f', "force installation (overwrite existing files)"),
+ ('compile', 'c', "compile .py to .pyc [default]"),
+ ('no-compile', None, "don't compile .py files"),
+ (
+ 'optimize=',
+ 'O',
+ "also compile with optimization: -O1 for \"python -O\", "
+ "-O2 for \"python -OO\", and -O0 to disable [default: -O0]",
+ ),
+ ('skip-build', None, "skip the build steps"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['force', 'compile', 'skip-build']
+ negative_opt: ClassVar[dict[str, str]] = {'no-compile': 'compile'}
+
+ def initialize_options(self):
+ # let the 'install' command dictate our installation directory
+ self.install_dir = None
+ self.build_dir = None
+ self.force = False
+ self.compile = None
+ self.optimize = None
+ self.skip_build = None
+
+ def finalize_options(self) -> None:
+ # Get all the information we need to install pure Python modules
+ # from the umbrella 'install' command -- build (source) directory,
+ # install (target) directory, and whether to compile .py files.
+ self.set_undefined_options(
+ 'install',
+ ('build_lib', 'build_dir'),
+ ('install_lib', 'install_dir'),
+ ('force', 'force'),
+ ('compile', 'compile'),
+ ('optimize', 'optimize'),
+ ('skip_build', 'skip_build'),
+ )
+
+ if self.compile is None:
+ self.compile = True
+ if self.optimize is None:
+ self.optimize = False
+
+ if not isinstance(self.optimize, int):
+ try:
+ self.optimize = int(self.optimize)
+ except ValueError:
+ pass
+ if self.optimize not in (0, 1, 2):
+ raise DistutilsOptionError("optimize must be 0, 1, or 2")
+
+ def run(self) -> None:
+ # Make sure we have built everything we need first
+ self.build()
+
+ # Install everything: simply dump the entire contents of the build
+ # directory to the installation directory (that's the beauty of
+ # having a build directory!)
+ outfiles = self.install()
+
+ # (Optionally) compile .py to .pyc
+ if outfiles is not None and self.distribution.has_pure_modules():
+ self.byte_compile(outfiles)
+
+ # -- Top-level worker functions ------------------------------------
+ # (called from 'run()')
+
+ def build(self) -> None:
+ if not self.skip_build:
+ if self.distribution.has_pure_modules():
+ self.run_command('build_py')
+ if self.distribution.has_ext_modules():
+ self.run_command('build_ext')
+
+ # Any: https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#the-any-trick
+ def install(self) -> list[str] | Any:
+ if os.path.isdir(self.build_dir):
+ outfiles = self.copy_tree(self.build_dir, self.install_dir)
+ else:
+ self.warn(
+ f"'{self.build_dir}' does not exist -- no Python modules to install"
+ )
+ return
+ return outfiles
+
+ def byte_compile(self, files) -> None:
+ if sys.dont_write_bytecode:
+ self.warn('byte-compiling is disabled, skipping.')
+ return
+
+ from ..util import byte_compile
+
+ # Get the "--root" directory supplied to the "install" command,
+ # and use it as a prefix to strip off the purported filename
+ # encoded in bytecode files. This is far from complete, but it
+ # should at least generate usable bytecode in RPM distributions.
+ install_root = self.get_finalized_command('install').root
+
+ if self.compile:
+ byte_compile(
+ files,
+ optimize=0,
+ force=self.force,
+ prefix=install_root,
+ dry_run=self.dry_run,
+ )
+ if self.optimize > 0:
+ byte_compile(
+ files,
+ optimize=self.optimize,
+ force=self.force,
+ prefix=install_root,
+ verbose=self.verbose,
+ dry_run=self.dry_run,
+ )
+
+ # -- Utility methods -----------------------------------------------
+
+ def _mutate_outputs(self, has_any, build_cmd, cmd_option, output_dir):
+ if not has_any:
+ return []
+
+ build_cmd = self.get_finalized_command(build_cmd)
+ build_files = build_cmd.get_outputs()
+ build_dir = getattr(build_cmd, cmd_option)
+
+ prefix_len = len(build_dir) + len(os.sep)
+ outputs = [os.path.join(output_dir, file[prefix_len:]) for file in build_files]
+
+ return outputs
+
+ def _bytecode_filenames(self, py_filenames):
+ bytecode_files = []
+ for py_file in py_filenames:
+ # Since build_py handles package data installation, the
+ # list of outputs can contain more than just .py files.
+ # Make sure we only report bytecode for the .py files.
+ ext = os.path.splitext(os.path.normcase(py_file))[1]
+ if ext != PYTHON_SOURCE_EXTENSION:
+ continue
+ if self.compile:
+ bytecode_files.append(
+ importlib.util.cache_from_source(py_file, optimization='')
+ )
+ if self.optimize > 0:
+ bytecode_files.append(
+ importlib.util.cache_from_source(
+ py_file, optimization=self.optimize
+ )
+ )
+
+ return bytecode_files
+
+ # -- External interface --------------------------------------------
+ # (called by outsiders)
+
+ def get_outputs(self):
+ """Return the list of files that would be installed if this command
+ were actually run. Not affected by the "dry-run" flag or whether
+ modules have actually been built yet.
+ """
+ pure_outputs = self._mutate_outputs(
+ self.distribution.has_pure_modules(),
+ 'build_py',
+ 'build_lib',
+ self.install_dir,
+ )
+ if self.compile:
+ bytecode_outputs = self._bytecode_filenames(pure_outputs)
+ else:
+ bytecode_outputs = []
+
+ ext_outputs = self._mutate_outputs(
+ self.distribution.has_ext_modules(),
+ 'build_ext',
+ 'build_lib',
+ self.install_dir,
+ )
+
+ return pure_outputs + bytecode_outputs + ext_outputs
+
+ def get_inputs(self):
+ """Get the list of files that are input to this command, ie. the
+ files that get installed as they are named in the build tree.
+ The files in this list correspond one-to-one to the output
+ filenames returned by 'get_outputs()'.
+ """
+ inputs = []
+
+ if self.distribution.has_pure_modules():
+ build_py = self.get_finalized_command('build_py')
+ inputs.extend(build_py.get_outputs())
+
+ if self.distribution.has_ext_modules():
+ build_ext = self.get_finalized_command('build_ext')
+ inputs.extend(build_ext.get_outputs())
+
+ return inputs
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_scripts.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_scripts.py
new file mode 100644
index 0000000000000000000000000000000000000000..92e8694111ee29bd82a33218e1c7f2a9ecbd3a4e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/install_scripts.py
@@ -0,0 +1,62 @@
+"""distutils.command.install_scripts
+
+Implements the Distutils 'install_scripts' command, for installing
+Python scripts."""
+
+# contributed by Bastian Kleineidam
+
+import os
+from distutils._log import log
+from stat import ST_MODE
+from typing import ClassVar
+
+from ..core import Command
+
+
+class install_scripts(Command):
+ description = "install scripts (Python or otherwise)"
+
+ user_options = [
+ ('install-dir=', 'd', "directory to install scripts to"),
+ ('build-dir=', 'b', "build directory (where to install from)"),
+ ('force', 'f', "force installation (overwrite existing files)"),
+ ('skip-build', None, "skip the build steps"),
+ ]
+
+ boolean_options: ClassVar[list[str]] = ['force', 'skip-build']
+
+ def initialize_options(self):
+ self.install_dir = None
+ self.force = False
+ self.build_dir = None
+ self.skip_build = None
+
+ def finalize_options(self) -> None:
+ self.set_undefined_options('build', ('build_scripts', 'build_dir'))
+ self.set_undefined_options(
+ 'install',
+ ('install_scripts', 'install_dir'),
+ ('force', 'force'),
+ ('skip_build', 'skip_build'),
+ )
+
+ def run(self) -> None:
+ if not self.skip_build:
+ self.run_command('build_scripts')
+ self.outfiles = self.copy_tree(self.build_dir, self.install_dir)
+ if os.name == 'posix':
+ # Set the executable bits (owner, group, and world) on
+ # all the scripts we just installed.
+ for file in self.get_outputs():
+ if self.dry_run:
+ log.info("changing mode of %s", file)
+ else:
+ mode = ((os.stat(file)[ST_MODE]) | 0o555) & 0o7777
+ log.info("changing mode of %s to %o", file, mode)
+ os.chmod(file, mode)
+
+ def get_inputs(self):
+ return self.distribution.scripts or []
+
+ def get_outputs(self):
+ return self.outfiles or []
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py
new file mode 100644
index 0000000000000000000000000000000000000000..b3bf0c326aa04c00e8da0e82e8c74afa488be055
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/command/sdist.py
@@ -0,0 +1,521 @@
+"""distutils.command.sdist
+
+Implements the Distutils 'sdist' command (create a source distribution)."""
+
+from __future__ import annotations
+
+import os
+import sys
+from collections.abc import Callable
+from distutils import archive_util, dir_util, file_util
+from distutils._log import log
+from glob import glob
+from itertools import filterfalse
+from typing import ClassVar
+
+from ..core import Command
+from ..errors import DistutilsOptionError, DistutilsTemplateError
+from ..filelist import FileList
+from ..text_file import TextFile
+from ..util import convert_path
+
+
+def show_formats():
+ """Print all possible values for the 'formats' option (used by
+ the "--help-formats" command-line option).
+ """
+ from ..archive_util import ARCHIVE_FORMATS
+ from ..fancy_getopt import FancyGetopt
+
+ formats = sorted(
+ ("formats=" + format, None, ARCHIVE_FORMATS[format][2])
+ for format in ARCHIVE_FORMATS.keys()
+ )
+ FancyGetopt(formats).print_help("List of available source distribution formats:")
+
+
+class sdist(Command):
+ description = "create a source distribution (tarball, zip file, etc.)"
+
+ def checking_metadata(self) -> bool:
+ """Callable used for the check sub-command.
+
+ Placed here so user_options can view it"""
+ return self.metadata_check
+
+ user_options = [
+ ('template=', 't', "name of manifest template file [default: MANIFEST.in]"),
+ ('manifest=', 'm', "name of manifest file [default: MANIFEST]"),
+ (
+ 'use-defaults',
+ None,
+ "include the default file set in the manifest "
+ "[default; disable with --no-defaults]",
+ ),
+ ('no-defaults', None, "don't include the default file set"),
+ (
+ 'prune',
+ None,
+ "specifically exclude files/directories that should not be "
+ "distributed (build tree, RCS/CVS dirs, etc.) "
+ "[default; disable with --no-prune]",
+ ),
+ ('no-prune', None, "don't automatically exclude anything"),
+ (
+ 'manifest-only',
+ 'o',
+ "just regenerate the manifest and then stop (implies --force-manifest)",
+ ),
+ (
+ 'force-manifest',
+ 'f',
+ "forcibly regenerate the manifest and carry on as usual. "
+ "Deprecated: now the manifest is always regenerated.",
+ ),
+ ('formats=', None, "formats for source distribution (comma-separated list)"),
+ (
+ 'keep-temp',
+ 'k',
+ "keep the distribution tree around after creating " + "archive file(s)",
+ ),
+ (
+ 'dist-dir=',
+ 'd',
+ "directory to put the source distribution archive(s) in [default: dist]",
+ ),
+ (
+ 'metadata-check',
+ None,
+ "Ensure that all required elements of meta-data "
+ "are supplied. Warn if any missing. [default]",
+ ),
+ (
+ 'owner=',
+ 'u',
+ "Owner name used when creating a tar file [default: current user]",
+ ),
+ (
+ 'group=',
+ 'g',
+ "Group name used when creating a tar file [default: current group]",
+ ),
+ ]
+
+ boolean_options: ClassVar[list[str]] = [
+ 'use-defaults',
+ 'prune',
+ 'manifest-only',
+ 'force-manifest',
+ 'keep-temp',
+ 'metadata-check',
+ ]
+
+ help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], object]]]] = [
+ ('help-formats', None, "list available distribution formats", show_formats),
+ ]
+
+ negative_opt: ClassVar[dict[str, str]] = {
+ 'no-defaults': 'use-defaults',
+ 'no-prune': 'prune',
+ }
+
+ sub_commands = [('check', checking_metadata)]
+
+ READMES: ClassVar[tuple[str, ...]] = ('README', 'README.txt', 'README.rst')
+
+ def initialize_options(self):
+ # 'template' and 'manifest' are, respectively, the names of
+ # the manifest template and manifest file.
+ self.template = None
+ self.manifest = None
+
+ # 'use_defaults': if true, we will include the default file set
+ # in the manifest
+ self.use_defaults = True
+ self.prune = True
+
+ self.manifest_only = False
+ self.force_manifest = False
+
+ self.formats = ['gztar']
+ self.keep_temp = False
+ self.dist_dir = None
+
+ self.archive_files = None
+ self.metadata_check = True
+ self.owner = None
+ self.group = None
+
+ def finalize_options(self) -> None:
+ if self.manifest is None:
+ self.manifest = "MANIFEST"
+ if self.template is None:
+ self.template = "MANIFEST.in"
+
+ self.ensure_string_list('formats')
+
+ bad_format = archive_util.check_archive_formats(self.formats)
+ if bad_format:
+ raise DistutilsOptionError(f"unknown archive format '{bad_format}'")
+
+ if self.dist_dir is None:
+ self.dist_dir = "dist"
+
+ def run(self) -> None:
+ # 'filelist' contains the list of files that will make up the
+ # manifest
+ self.filelist = FileList()
+
+ # Run sub commands
+ for cmd_name in self.get_sub_commands():
+ self.run_command(cmd_name)
+
+ # Do whatever it takes to get the list of files to process
+ # (process the manifest template, read an existing manifest,
+ # whatever). File list is accumulated in 'self.filelist'.
+ self.get_file_list()
+
+ # If user just wanted us to regenerate the manifest, stop now.
+ if self.manifest_only:
+ return
+
+ # Otherwise, go ahead and create the source distribution tarball,
+ # or zipfile, or whatever.
+ self.make_distribution()
+
+ def get_file_list(self) -> None:
+ """Figure out the list of files to include in the source
+ distribution, and put it in 'self.filelist'. This might involve
+ reading the manifest template (and writing the manifest), or just
+ reading the manifest, or just using the default file set -- it all
+ depends on the user's options.
+ """
+ # new behavior when using a template:
+ # the file list is recalculated every time because
+ # even if MANIFEST.in or setup.py are not changed
+ # the user might have added some files in the tree that
+ # need to be included.
+ #
+ # This makes --force the default and only behavior with templates.
+ template_exists = os.path.isfile(self.template)
+ if not template_exists and self._manifest_is_not_generated():
+ self.read_manifest()
+ self.filelist.sort()
+ self.filelist.remove_duplicates()
+ return
+
+ if not template_exists:
+ self.warn(
+ ("manifest template '%s' does not exist " + "(using default file list)")
+ % self.template
+ )
+ self.filelist.findall()
+
+ if self.use_defaults:
+ self.add_defaults()
+
+ if template_exists:
+ self.read_template()
+
+ if self.prune:
+ self.prune_file_list()
+
+ self.filelist.sort()
+ self.filelist.remove_duplicates()
+ self.write_manifest()
+
+ def add_defaults(self) -> None:
+ """Add all the default files to self.filelist:
+ - README or README.txt
+ - setup.py
+ - tests/test*.py and test/test*.py
+ - all pure Python modules mentioned in setup script
+ - all files pointed by package_data (build_py)
+ - all files defined in data_files.
+ - all files defined as scripts.
+ - all C sources listed as part of extensions or C libraries
+ in the setup script (doesn't catch C headers!)
+ Warns if (README or README.txt) or setup.py are missing; everything
+ else is optional.
+ """
+ self._add_defaults_standards()
+ self._add_defaults_optional()
+ self._add_defaults_python()
+ self._add_defaults_data_files()
+ self._add_defaults_ext()
+ self._add_defaults_c_libs()
+ self._add_defaults_scripts()
+
+ @staticmethod
+ def _cs_path_exists(fspath):
+ """
+ Case-sensitive path existence check
+
+ >>> sdist._cs_path_exists(__file__)
+ True
+ >>> sdist._cs_path_exists(__file__.upper())
+ False
+ """
+ if not os.path.exists(fspath):
+ return False
+ # make absolute so we always have a directory
+ abspath = os.path.abspath(fspath)
+ directory, filename = os.path.split(abspath)
+ return filename in os.listdir(directory)
+
+ def _add_defaults_standards(self):
+ standards = [self.READMES, self.distribution.script_name]
+ for fn in standards:
+ if isinstance(fn, tuple):
+ alts = fn
+ got_it = False
+ for fn in alts:
+ if self._cs_path_exists(fn):
+ got_it = True
+ self.filelist.append(fn)
+ break
+
+ if not got_it:
+ self.warn(
+ "standard file not found: should have one of " + ', '.join(alts)
+ )
+ else:
+ if self._cs_path_exists(fn):
+ self.filelist.append(fn)
+ else:
+ self.warn(f"standard file '{fn}' not found")
+
+ def _add_defaults_optional(self):
+ optional = ['tests/test*.py', 'test/test*.py', 'setup.cfg']
+ for pattern in optional:
+ files = filter(os.path.isfile, glob(pattern))
+ self.filelist.extend(files)
+
+ def _add_defaults_python(self):
+ # build_py is used to get:
+ # - python modules
+ # - files defined in package_data
+ build_py = self.get_finalized_command('build_py')
+
+ # getting python files
+ if self.distribution.has_pure_modules():
+ self.filelist.extend(build_py.get_source_files())
+
+ # getting package_data files
+ # (computed in build_py.data_files by build_py.finalize_options)
+ for _pkg, src_dir, _build_dir, filenames in build_py.data_files:
+ for filename in filenames:
+ self.filelist.append(os.path.join(src_dir, filename))
+
+ def _add_defaults_data_files(self):
+ # getting distribution.data_files
+ if self.distribution.has_data_files():
+ for item in self.distribution.data_files:
+ if isinstance(item, str):
+ # plain file
+ item = convert_path(item)
+ if os.path.isfile(item):
+ self.filelist.append(item)
+ else:
+ # a (dirname, filenames) tuple
+ dirname, filenames = item
+ for f in filenames:
+ f = convert_path(f)
+ if os.path.isfile(f):
+ self.filelist.append(f)
+
+ def _add_defaults_ext(self):
+ if self.distribution.has_ext_modules():
+ build_ext = self.get_finalized_command('build_ext')
+ self.filelist.extend(build_ext.get_source_files())
+
+ def _add_defaults_c_libs(self):
+ if self.distribution.has_c_libraries():
+ build_clib = self.get_finalized_command('build_clib')
+ self.filelist.extend(build_clib.get_source_files())
+
+ def _add_defaults_scripts(self):
+ if self.distribution.has_scripts():
+ build_scripts = self.get_finalized_command('build_scripts')
+ self.filelist.extend(build_scripts.get_source_files())
+
+ def read_template(self) -> None:
+ """Read and parse manifest template file named by self.template.
+
+ (usually "MANIFEST.in") The parsing and processing is done by
+ 'self.filelist', which updates itself accordingly.
+ """
+ log.info("reading manifest template '%s'", self.template)
+ template = TextFile(
+ self.template,
+ strip_comments=True,
+ skip_blanks=True,
+ join_lines=True,
+ lstrip_ws=True,
+ rstrip_ws=True,
+ collapse_join=True,
+ )
+
+ try:
+ while True:
+ line = template.readline()
+ if line is None: # end of file
+ break
+
+ try:
+ self.filelist.process_template_line(line)
+ # the call above can raise a DistutilsTemplateError for
+ # malformed lines, or a ValueError from the lower-level
+ # convert_path function
+ except (DistutilsTemplateError, ValueError) as msg:
+ self.warn(
+ f"{template.filename}, line {int(template.current_line)}: {msg}"
+ )
+ finally:
+ template.close()
+
+ def prune_file_list(self) -> None:
+ """Prune off branches that might slip into the file list as created
+ by 'read_template()', but really don't belong there:
+ * the build tree (typically "build")
+ * the release tree itself (only an issue if we ran "sdist"
+ previously with --keep-temp, or it aborted)
+ * any RCS, CVS, .svn, .hg, .git, .bzr, _darcs directories
+ """
+ build = self.get_finalized_command('build')
+ base_dir = self.distribution.get_fullname()
+
+ self.filelist.exclude_pattern(None, prefix=os.fspath(build.build_base))
+ self.filelist.exclude_pattern(None, prefix=base_dir)
+
+ if sys.platform == 'win32':
+ seps = r'/|\\'
+ else:
+ seps = '/'
+
+ vcs_dirs = ['RCS', 'CVS', r'\.svn', r'\.hg', r'\.git', r'\.bzr', '_darcs']
+ vcs_ptrn = r'(^|{})({})({}).*'.format(seps, '|'.join(vcs_dirs), seps)
+ self.filelist.exclude_pattern(vcs_ptrn, is_regex=True)
+
+ def write_manifest(self) -> None:
+ """Write the file list in 'self.filelist' (presumably as filled in
+ by 'add_defaults()' and 'read_template()') to the manifest file
+ named by 'self.manifest'.
+ """
+ if self._manifest_is_not_generated():
+ log.info(
+ f"not writing to manually maintained manifest file '{self.manifest}'"
+ )
+ return
+
+ content = self.filelist.files[:]
+ content.insert(0, '# file GENERATED by distutils, do NOT edit')
+ self.execute(
+ file_util.write_file,
+ (self.manifest, content),
+ f"writing manifest file '{self.manifest}'",
+ )
+
+ def _manifest_is_not_generated(self):
+ # check for special comment used in 3.1.3 and higher
+ if not os.path.isfile(self.manifest):
+ return False
+
+ with open(self.manifest, encoding='utf-8') as fp:
+ first_line = next(fp)
+ return first_line != '# file GENERATED by distutils, do NOT edit\n'
+
+ def read_manifest(self) -> None:
+ """Read the manifest file (named by 'self.manifest') and use it to
+ fill in 'self.filelist', the list of files to include in the source
+ distribution.
+ """
+ log.info("reading manifest file '%s'", self.manifest)
+ with open(self.manifest, encoding='utf-8') as lines:
+ self.filelist.extend(
+ # ignore comments and blank lines
+ filter(None, filterfalse(is_comment, map(str.strip, lines)))
+ )
+
+ def make_release_tree(self, base_dir, files) -> None:
+ """Create the directory tree that will become the source
+ distribution archive. All directories implied by the filenames in
+ 'files' are created under 'base_dir', and then we hard link or copy
+ (if hard linking is unavailable) those files into place.
+ Essentially, this duplicates the developer's source tree, but in a
+ directory named after the distribution, containing only the files
+ to be distributed.
+ """
+ # Create all the directories under 'base_dir' necessary to
+ # put 'files' there; the 'mkpath()' is just so we don't die
+ # if the manifest happens to be empty.
+ self.mkpath(base_dir)
+ dir_util.create_tree(base_dir, files, dry_run=self.dry_run)
+
+ # And walk over the list of files, either making a hard link (if
+ # os.link exists) to each one that doesn't already exist in its
+ # corresponding location under 'base_dir', or copying each file
+ # that's out-of-date in 'base_dir'. (Usually, all files will be
+ # out-of-date, because by default we blow away 'base_dir' when
+ # we're done making the distribution archives.)
+
+ if hasattr(os, 'link'): # can make hard links on this system
+ link = 'hard'
+ msg = f"making hard links in {base_dir}..."
+ else: # nope, have to copy
+ link = None
+ msg = f"copying files to {base_dir}..."
+
+ if not files:
+ log.warning("no files to distribute -- empty manifest?")
+ else:
+ log.info(msg)
+ for file in files:
+ if not os.path.isfile(file):
+ log.warning("'%s' not a regular file -- skipping", file)
+ else:
+ dest = os.path.join(base_dir, file)
+ self.copy_file(file, dest, link=link)
+
+ self.distribution.metadata.write_pkg_info(base_dir)
+
+ def make_distribution(self) -> None:
+ """Create the source distribution(s). First, we create the release
+ tree with 'make_release_tree()'; then, we create all required
+ archive files (according to 'self.formats') from the release tree.
+ Finally, we clean up by blowing away the release tree (unless
+ 'self.keep_temp' is true). The list of archive files created is
+ stored so it can be retrieved later by 'get_archive_files()'.
+ """
+ # Don't warn about missing meta-data here -- should be (and is!)
+ # done elsewhere.
+ base_dir = self.distribution.get_fullname()
+ base_name = os.path.join(self.dist_dir, base_dir)
+
+ self.make_release_tree(base_dir, self.filelist.files)
+ archive_files = [] # remember names of files we create
+ # tar archive must be created last to avoid overwrite and remove
+ if 'tar' in self.formats:
+ self.formats.append(self.formats.pop(self.formats.index('tar')))
+
+ for fmt in self.formats:
+ file = self.make_archive(
+ base_name, fmt, base_dir=base_dir, owner=self.owner, group=self.group
+ )
+ archive_files.append(file)
+ self.distribution.dist_files.append(('sdist', '', file))
+
+ self.archive_files = archive_files
+
+ if not self.keep_temp:
+ dir_util.remove_tree(base_dir, dry_run=self.dry_run)
+
+ def get_archive_files(self):
+ """Return the list of archive files created when the command
+ was run, or None if the command hasn't run yet.
+ """
+ return self.archive_files
+
+
+def is_comment(line: str) -> bool:
+ return line.startswith('#')
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..2c43729b09ea5e5bf9d8c0708e63c69b5114a279
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/__init__.py
@@ -0,0 +1,18 @@
+from __future__ import annotations
+
+from collections.abc import Iterable
+from typing import TypeVar
+
+_IterableT = TypeVar("_IterableT", bound="Iterable[str]")
+
+
+def consolidate_linker_args(args: _IterableT) -> _IterableT | str:
+ """
+ Ensure the return value is a string for backward compatibility.
+
+ Retain until at least 2025-04-31. See pypa/distutils#246
+ """
+
+ if not all(arg.startswith('-Wl,') for arg in args):
+ return args
+ return '-Wl,' + ','.join(arg.removeprefix('-Wl,') for arg in args)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/numpy.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/numpy.py
new file mode 100644
index 0000000000000000000000000000000000000000..73eca7acb103b7c7ca8e7a9f7f2d772a64aa344b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/numpy.py
@@ -0,0 +1,2 @@
+# required for older numpy versions on Pythons prior to 3.12; see pypa/setuptools#4876
+from ..compilers.C.base import _default_compilers, compiler_class # noqa: F401
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/py39.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/py39.py
new file mode 100644
index 0000000000000000000000000000000000000000..1b436d76586cbcf38164548f3fc849ce1a3ff600
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compat/py39.py
@@ -0,0 +1,66 @@
+import functools
+import itertools
+import platform
+import sys
+
+
+def add_ext_suffix_39(vars):
+ """
+ Ensure vars contains 'EXT_SUFFIX'. pypa/distutils#130
+ """
+ import _imp
+
+ ext_suffix = _imp.extension_suffixes()[0]
+ vars.update(
+ EXT_SUFFIX=ext_suffix,
+ # sysconfig sets SO to match EXT_SUFFIX, so maintain
+ # that expectation.
+ # https://github.com/python/cpython/blob/785cc6770588de087d09e89a69110af2542be208/Lib/sysconfig.py#L671-L673
+ SO=ext_suffix,
+ )
+
+
+needs_ext_suffix = sys.version_info < (3, 10) and platform.system() == 'Windows'
+add_ext_suffix = add_ext_suffix_39 if needs_ext_suffix else lambda vars: None
+
+
+# from more_itertools
+class UnequalIterablesError(ValueError):
+ def __init__(self, details=None):
+ msg = 'Iterables have different lengths'
+ if details is not None:
+ msg += (': index 0 has length {}; index {} has length {}').format(*details)
+
+ super().__init__(msg)
+
+
+# from more_itertools
+def _zip_equal_generator(iterables):
+ _marker = object()
+ for combo in itertools.zip_longest(*iterables, fillvalue=_marker):
+ for val in combo:
+ if val is _marker:
+ raise UnequalIterablesError()
+ yield combo
+
+
+# from more_itertools
+def _zip_equal(*iterables):
+ # Check whether the iterables are all the same size.
+ try:
+ first_size = len(iterables[0])
+ for i, it in enumerate(iterables[1:], 1):
+ size = len(it)
+ if size != first_size:
+ raise UnequalIterablesError(details=(first_size, i, size))
+ # All sizes are equal, we can use the built-in zip.
+ return zip(*iterables)
+ # If any one of the iterables didn't have a length, start reading
+ # them until one runs out.
+ except TypeError:
+ return _zip_equal_generator(iterables)
+
+
+zip_strict = (
+ _zip_equal if sys.version_info < (3, 10) else functools.partial(zip, strict=True)
+)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/base.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..5efd2a39d6a8cd7a722b7aefc3de4f1def4e4788
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/base.py
@@ -0,0 +1,1394 @@
+"""distutils.ccompiler
+
+Contains Compiler, an abstract base class that defines the interface
+for the Distutils compiler abstraction model."""
+
+from __future__ import annotations
+
+import os
+import pathlib
+import re
+import sys
+import warnings
+from collections.abc import Callable, Iterable, MutableSequence, Sequence
+from typing import (
+ TYPE_CHECKING,
+ ClassVar,
+ Literal,
+ TypeVar,
+ Union,
+ overload,
+)
+
+from more_itertools import always_iterable
+
+from ..._log import log
+from ..._modified import newer_group
+from ...dir_util import mkpath
+from ...errors import (
+ DistutilsModuleError,
+ DistutilsPlatformError,
+)
+from ...file_util import move_file
+from ...spawn import spawn
+from ...util import execute, is_mingw, split_quoted
+from .errors import (
+ CompileError,
+ LinkError,
+ UnknownFileType,
+)
+
+if TYPE_CHECKING:
+ from typing_extensions import TypeAlias, TypeVarTuple, Unpack
+
+ _Ts = TypeVarTuple("_Ts")
+
+_Macro: TypeAlias = Union[tuple[str], tuple[str, Union[str, None]]]
+_StrPathT = TypeVar("_StrPathT", bound="str | os.PathLike[str]")
+_BytesPathT = TypeVar("_BytesPathT", bound="bytes | os.PathLike[bytes]")
+
+
+class Compiler:
+ """Abstract base class to define the interface that must be implemented
+ by real compiler classes. Also has some utility methods used by
+ several compiler classes.
+
+ The basic idea behind a compiler abstraction class is that each
+ instance can be used for all the compile/link steps in building a
+ single project. Thus, attributes common to all of those compile and
+ link steps -- include directories, macros to define, libraries to link
+ against, etc. -- are attributes of the compiler instance. To allow for
+ variability in how individual files are treated, most of those
+ attributes may be varied on a per-compilation or per-link basis.
+ """
+
+ # 'compiler_type' is a class attribute that identifies this class. It
+ # keeps code that wants to know what kind of compiler it's dealing with
+ # from having to import all possible compiler classes just to do an
+ # 'isinstance'. In concrete CCompiler subclasses, 'compiler_type'
+ # should really, really be one of the keys of the 'compiler_class'
+ # dictionary (see below -- used by the 'new_compiler()' factory
+ # function) -- authors of new compiler interface classes are
+ # responsible for updating 'compiler_class'!
+ compiler_type: ClassVar[str] = None # type: ignore[assignment]
+
+ # XXX things not handled by this compiler abstraction model:
+ # * client can't provide additional options for a compiler,
+ # e.g. warning, optimization, debugging flags. Perhaps this
+ # should be the domain of concrete compiler abstraction classes
+ # (UnixCCompiler, MSVCCompiler, etc.) -- or perhaps the base
+ # class should have methods for the common ones.
+ # * can't completely override the include or library searchg
+ # path, ie. no "cc -I -Idir1 -Idir2" or "cc -L -Ldir1 -Ldir2".
+ # I'm not sure how widely supported this is even by Unix
+ # compilers, much less on other platforms. And I'm even less
+ # sure how useful it is; maybe for cross-compiling, but
+ # support for that is a ways off. (And anyways, cross
+ # compilers probably have a dedicated binary with the
+ # right paths compiled in. I hope.)
+ # * can't do really freaky things with the library list/library
+ # dirs, e.g. "-Ldir1 -lfoo -Ldir2 -lfoo" to link against
+ # different versions of libfoo.a in different locations. I
+ # think this is useless without the ability to null out the
+ # library search path anyways.
+
+ executables: ClassVar[dict]
+
+ # Subclasses that rely on the standard filename generation methods
+ # implemented below should override these; see the comment near
+ # those methods ('object_filenames()' et. al.) for details:
+ src_extensions: ClassVar[list[str] | None] = None
+ obj_extension: ClassVar[str | None] = None
+ static_lib_extension: ClassVar[str | None] = None
+ shared_lib_extension: ClassVar[str | None] = None
+ static_lib_format: ClassVar[str | None] = None # format string
+ shared_lib_format: ClassVar[str | None] = None # prob. same as static_lib_format
+ exe_extension: ClassVar[str | None] = None
+
+ # Default language settings. language_map is used to detect a source
+ # file or Extension target language, checking source filenames.
+ # language_order is used to detect the language precedence, when deciding
+ # what language to use when mixing source types. For example, if some
+ # extension has two files with ".c" extension, and one with ".cpp", it
+ # is still linked as c++.
+ language_map: ClassVar[dict[str, str]] = {
+ ".c": "c",
+ ".cc": "c++",
+ ".cpp": "c++",
+ ".cxx": "c++",
+ ".m": "objc",
+ }
+ language_order: ClassVar[list[str]] = ["c++", "objc", "c"]
+
+ include_dirs: list[str] = []
+ """
+ include dirs specific to this compiler class
+ """
+
+ library_dirs: list[str] = []
+ """
+ library dirs specific to this compiler class
+ """
+
+ def __init__(
+ self, verbose: bool = False, dry_run: bool = False, force: bool = False
+ ) -> None:
+ self.dry_run = dry_run
+ self.force = force
+ self.verbose = verbose
+
+ # 'output_dir': a common output directory for object, library,
+ # shared object, and shared library files
+ self.output_dir: str | None = None
+
+ # 'macros': a list of macro definitions (or undefinitions). A
+ # macro definition is a 2-tuple (name, value), where the value is
+ # either a string or None (no explicit value). A macro
+ # undefinition is a 1-tuple (name,).
+ self.macros: list[_Macro] = []
+
+ # 'include_dirs': a list of directories to search for include files
+ self.include_dirs = []
+
+ # 'libraries': a list of libraries to include in any link
+ # (library names, not filenames: eg. "foo" not "libfoo.a")
+ self.libraries: list[str] = []
+
+ # 'library_dirs': a list of directories to search for libraries
+ self.library_dirs = []
+
+ # 'runtime_library_dirs': a list of directories to search for
+ # shared libraries/objects at runtime
+ self.runtime_library_dirs: list[str] = []
+
+ # 'objects': a list of object files (or similar, such as explicitly
+ # named library files) to include on any link
+ self.objects: list[str] = []
+
+ for key in self.executables.keys():
+ self.set_executable(key, self.executables[key])
+
+ def set_executables(self, **kwargs: str) -> None:
+ """Define the executables (and options for them) that will be run
+ to perform the various stages of compilation. The exact set of
+ executables that may be specified here depends on the compiler
+ class (via the 'executables' class attribute), but most will have:
+ compiler the C/C++ compiler
+ linker_so linker used to create shared objects and libraries
+ linker_exe linker used to create binary executables
+ archiver static library creator
+
+ On platforms with a command-line (Unix, DOS/Windows), each of these
+ is a string that will be split into executable name and (optional)
+ list of arguments. (Splitting the string is done similarly to how
+ Unix shells operate: words are delimited by spaces, but quotes and
+ backslashes can override this. See
+ 'distutils.util.split_quoted()'.)
+ """
+
+ # Note that some CCompiler implementation classes will define class
+ # attributes 'cpp', 'cc', etc. with hard-coded executable names;
+ # this is appropriate when a compiler class is for exactly one
+ # compiler/OS combination (eg. MSVCCompiler). Other compiler
+ # classes (UnixCCompiler, in particular) are driven by information
+ # discovered at run-time, since there are many different ways to do
+ # basically the same things with Unix C compilers.
+
+ for key in kwargs:
+ if key not in self.executables:
+ raise ValueError(
+ f"unknown executable '{key}' for class {self.__class__.__name__}"
+ )
+ self.set_executable(key, kwargs[key])
+
+ def set_executable(self, key, value):
+ if isinstance(value, str):
+ setattr(self, key, split_quoted(value))
+ else:
+ setattr(self, key, value)
+
+ def _find_macro(self, name):
+ i = 0
+ for defn in self.macros:
+ if defn[0] == name:
+ return i
+ i += 1
+ return None
+
+ def _check_macro_definitions(self, definitions):
+ """Ensure that every element of 'definitions' is valid."""
+ for defn in definitions:
+ self._check_macro_definition(*defn)
+
+ def _check_macro_definition(self, defn):
+ """
+ Raise a TypeError if defn is not valid.
+
+ A valid definition is either a (name, value) 2-tuple or a (name,) tuple.
+ """
+ if not isinstance(defn, tuple) or not self._is_valid_macro(*defn):
+ raise TypeError(
+ f"invalid macro definition '{defn}': "
+ "must be tuple (string,), (string, string), or (string, None)"
+ )
+
+ @staticmethod
+ def _is_valid_macro(name, value=None):
+ """
+ A valid macro is a ``name : str`` and a ``value : str | None``.
+
+ >>> Compiler._is_valid_macro('foo', None)
+ True
+ """
+ return isinstance(name, str) and isinstance(value, (str, type(None)))
+
+ # -- Bookkeeping methods -------------------------------------------
+
+ def define_macro(self, name: str, value: str | None = None) -> None:
+ """Define a preprocessor macro for all compilations driven by this
+ compiler object. The optional parameter 'value' should be a
+ string; if it is not supplied, then the macro will be defined
+ without an explicit value and the exact outcome depends on the
+ compiler used (XXX true? does ANSI say anything about this?)
+ """
+ # Delete from the list of macro definitions/undefinitions if
+ # already there (so that this one will take precedence).
+ i = self._find_macro(name)
+ if i is not None:
+ del self.macros[i]
+
+ self.macros.append((name, value))
+
+ def undefine_macro(self, name: str) -> None:
+ """Undefine a preprocessor macro for all compilations driven by
+ this compiler object. If the same macro is defined by
+ 'define_macro()' and undefined by 'undefine_macro()' the last call
+ takes precedence (including multiple redefinitions or
+ undefinitions). If the macro is redefined/undefined on a
+ per-compilation basis (ie. in the call to 'compile()'), then that
+ takes precedence.
+ """
+ # Delete from the list of macro definitions/undefinitions if
+ # already there (so that this one will take precedence).
+ i = self._find_macro(name)
+ if i is not None:
+ del self.macros[i]
+
+ undefn = (name,)
+ self.macros.append(undefn)
+
+ def add_include_dir(self, dir: str) -> None:
+ """Add 'dir' to the list of directories that will be searched for
+ header files. The compiler is instructed to search directories in
+ the order in which they are supplied by successive calls to
+ 'add_include_dir()'.
+ """
+ self.include_dirs.append(dir)
+
+ def set_include_dirs(self, dirs: list[str]) -> None:
+ """Set the list of directories that will be searched to 'dirs' (a
+ list of strings). Overrides any preceding calls to
+ 'add_include_dir()'; subsequence calls to 'add_include_dir()' add
+ to the list passed to 'set_include_dirs()'. This does not affect
+ any list of standard include directories that the compiler may
+ search by default.
+ """
+ self.include_dirs = dirs[:]
+
+ def add_library(self, libname: str) -> None:
+ """Add 'libname' to the list of libraries that will be included in
+ all links driven by this compiler object. Note that 'libname'
+ should *not* be the name of a file containing a library, but the
+ name of the library itself: the actual filename will be inferred by
+ the linker, the compiler, or the compiler class (depending on the
+ platform).
+
+ The linker will be instructed to link against libraries in the
+ order they were supplied to 'add_library()' and/or
+ 'set_libraries()'. It is perfectly valid to duplicate library
+ names; the linker will be instructed to link against libraries as
+ many times as they are mentioned.
+ """
+ self.libraries.append(libname)
+
+ def set_libraries(self, libnames: list[str]) -> None:
+ """Set the list of libraries to be included in all links driven by
+ this compiler object to 'libnames' (a list of strings). This does
+ not affect any standard system libraries that the linker may
+ include by default.
+ """
+ self.libraries = libnames[:]
+
+ def add_library_dir(self, dir: str) -> None:
+ """Add 'dir' to the list of directories that will be searched for
+ libraries specified to 'add_library()' and 'set_libraries()'. The
+ linker will be instructed to search for libraries in the order they
+ are supplied to 'add_library_dir()' and/or 'set_library_dirs()'.
+ """
+ self.library_dirs.append(dir)
+
+ def set_library_dirs(self, dirs: list[str]) -> None:
+ """Set the list of library search directories to 'dirs' (a list of
+ strings). This does not affect any standard library search path
+ that the linker may search by default.
+ """
+ self.library_dirs = dirs[:]
+
+ def add_runtime_library_dir(self, dir: str) -> None:
+ """Add 'dir' to the list of directories that will be searched for
+ shared libraries at runtime.
+ """
+ self.runtime_library_dirs.append(dir)
+
+ def set_runtime_library_dirs(self, dirs: list[str]) -> None:
+ """Set the list of directories to search for shared libraries at
+ runtime to 'dirs' (a list of strings). This does not affect any
+ standard search path that the runtime linker may search by
+ default.
+ """
+ self.runtime_library_dirs = dirs[:]
+
+ def add_link_object(self, object: str) -> None:
+ """Add 'object' to the list of object files (or analogues, such as
+ explicitly named library files or the output of "resource
+ compilers") to be included in every link driven by this compiler
+ object.
+ """
+ self.objects.append(object)
+
+ def set_link_objects(self, objects: list[str]) -> None:
+ """Set the list of object files (or analogues) to be included in
+ every link to 'objects'. This does not affect any standard object
+ files that the linker may include by default (such as system
+ libraries).
+ """
+ self.objects = objects[:]
+
+ # -- Private utility methods --------------------------------------
+ # (here for the convenience of subclasses)
+
+ # Helper method to prep compiler in subclass compile() methods
+
+ def _setup_compile(
+ self,
+ outdir: str | None,
+ macros: list[_Macro] | None,
+ incdirs: list[str] | tuple[str, ...] | None,
+ sources,
+ depends,
+ extra,
+ ):
+ """Process arguments and decide which source files to compile."""
+ outdir, macros, incdirs = self._fix_compile_args(outdir, macros, incdirs)
+
+ if extra is None:
+ extra = []
+
+ # Get the list of expected output (object) files
+ objects = self.object_filenames(sources, strip_dir=False, output_dir=outdir)
+ assert len(objects) == len(sources)
+
+ pp_opts = gen_preprocess_options(macros, incdirs)
+
+ build = {}
+ for i in range(len(sources)):
+ src = sources[i]
+ obj = objects[i]
+ ext = os.path.splitext(src)[1]
+ self.mkpath(os.path.dirname(obj))
+ build[obj] = (src, ext)
+
+ return macros, objects, extra, pp_opts, build
+
+ def _get_cc_args(self, pp_opts, debug, before):
+ # works for unixccompiler, cygwinccompiler
+ cc_args = pp_opts + ['-c']
+ if debug:
+ cc_args[:0] = ['-g']
+ if before:
+ cc_args[:0] = before
+ return cc_args
+
+ def _fix_compile_args(
+ self,
+ output_dir: str | None,
+ macros: list[_Macro] | None,
+ include_dirs: list[str] | tuple[str, ...] | None,
+ ) -> tuple[str, list[_Macro], list[str]]:
+ """Typecheck and fix-up some of the arguments to the 'compile()'
+ method, and return fixed-up values. Specifically: if 'output_dir'
+ is None, replaces it with 'self.output_dir'; ensures that 'macros'
+ is a list, and augments it with 'self.macros'; ensures that
+ 'include_dirs' is a list, and augments it with 'self.include_dirs'.
+ Guarantees that the returned values are of the correct type,
+ i.e. for 'output_dir' either string or None, and for 'macros' and
+ 'include_dirs' either list or None.
+ """
+ if output_dir is None:
+ output_dir = self.output_dir
+ elif not isinstance(output_dir, str):
+ raise TypeError("'output_dir' must be a string or None")
+
+ if macros is None:
+ macros = list(self.macros)
+ elif isinstance(macros, list):
+ macros = macros + (self.macros or [])
+ else:
+ raise TypeError("'macros' (if supplied) must be a list of tuples")
+
+ if include_dirs is None:
+ include_dirs = list(self.include_dirs)
+ elif isinstance(include_dirs, (list, tuple)):
+ include_dirs = list(include_dirs) + (self.include_dirs or [])
+ else:
+ raise TypeError("'include_dirs' (if supplied) must be a list of strings")
+
+ # add include dirs for class
+ include_dirs += self.__class__.include_dirs
+
+ return output_dir, macros, include_dirs
+
+ def _prep_compile(self, sources, output_dir, depends=None):
+ """Decide which source files must be recompiled.
+
+ Determine the list of object files corresponding to 'sources',
+ and figure out which ones really need to be recompiled.
+ Return a list of all object files and a dictionary telling
+ which source files can be skipped.
+ """
+ # Get the list of expected output (object) files
+ objects = self.object_filenames(sources, output_dir=output_dir)
+ assert len(objects) == len(sources)
+
+ # Return an empty dict for the "which source files can be skipped"
+ # return value to preserve API compatibility.
+ return objects, {}
+
+ def _fix_object_args(
+ self, objects: list[str] | tuple[str, ...], output_dir: str | None
+ ) -> tuple[list[str], str]:
+ """Typecheck and fix up some arguments supplied to various methods.
+ Specifically: ensure that 'objects' is a list; if output_dir is
+ None, replace with self.output_dir. Return fixed versions of
+ 'objects' and 'output_dir'.
+ """
+ if not isinstance(objects, (list, tuple)):
+ raise TypeError("'objects' must be a list or tuple of strings")
+ objects = list(objects)
+
+ if output_dir is None:
+ output_dir = self.output_dir
+ elif not isinstance(output_dir, str):
+ raise TypeError("'output_dir' must be a string or None")
+
+ return (objects, output_dir)
+
+ def _fix_lib_args(
+ self,
+ libraries: list[str] | tuple[str, ...] | None,
+ library_dirs: list[str] | tuple[str, ...] | None,
+ runtime_library_dirs: list[str] | tuple[str, ...] | None,
+ ) -> tuple[list[str], list[str], list[str]]:
+ """Typecheck and fix up some of the arguments supplied to the
+ 'link_*' methods. Specifically: ensure that all arguments are
+ lists, and augment them with their permanent versions
+ (eg. 'self.libraries' augments 'libraries'). Return a tuple with
+ fixed versions of all arguments.
+ """
+ if libraries is None:
+ libraries = list(self.libraries)
+ elif isinstance(libraries, (list, tuple)):
+ libraries = list(libraries) + (self.libraries or [])
+ else:
+ raise TypeError("'libraries' (if supplied) must be a list of strings")
+
+ if library_dirs is None:
+ library_dirs = list(self.library_dirs)
+ elif isinstance(library_dirs, (list, tuple)):
+ library_dirs = list(library_dirs) + (self.library_dirs or [])
+ else:
+ raise TypeError("'library_dirs' (if supplied) must be a list of strings")
+
+ # add library dirs for class
+ library_dirs += self.__class__.library_dirs
+
+ if runtime_library_dirs is None:
+ runtime_library_dirs = list(self.runtime_library_dirs)
+ elif isinstance(runtime_library_dirs, (list, tuple)):
+ runtime_library_dirs = list(runtime_library_dirs) + (
+ self.runtime_library_dirs or []
+ )
+ else:
+ raise TypeError(
+ "'runtime_library_dirs' (if supplied) must be a list of strings"
+ )
+
+ return (libraries, library_dirs, runtime_library_dirs)
+
+ def _need_link(self, objects, output_file):
+ """Return true if we need to relink the files listed in 'objects'
+ to recreate 'output_file'.
+ """
+ if self.force:
+ return True
+ else:
+ if self.dry_run:
+ newer = newer_group(objects, output_file, missing='newer')
+ else:
+ newer = newer_group(objects, output_file)
+ return newer
+
+ def detect_language(self, sources: str | list[str]) -> str | None:
+ """Detect the language of a given file, or list of files. Uses
+ language_map, and language_order to do the job.
+ """
+ if not isinstance(sources, list):
+ sources = [sources]
+ lang = None
+ index = len(self.language_order)
+ for source in sources:
+ base, ext = os.path.splitext(source)
+ extlang = self.language_map.get(ext)
+ try:
+ extindex = self.language_order.index(extlang)
+ if extindex < index:
+ lang = extlang
+ index = extindex
+ except ValueError:
+ pass
+ return lang
+
+ # -- Worker methods ------------------------------------------------
+ # (must be implemented by subclasses)
+
+ def preprocess(
+ self,
+ source: str | os.PathLike[str],
+ output_file: str | os.PathLike[str] | None = None,
+ macros: list[_Macro] | None = None,
+ include_dirs: list[str] | tuple[str, ...] | None = None,
+ extra_preargs: list[str] | None = None,
+ extra_postargs: Iterable[str] | None = None,
+ ):
+ """Preprocess a single C/C++ source file, named in 'source'.
+ Output will be written to file named 'output_file', or stdout if
+ 'output_file' not supplied. 'macros' is a list of macro
+ definitions as for 'compile()', which will augment the macros set
+ with 'define_macro()' and 'undefine_macro()'. 'include_dirs' is a
+ list of directory names that will be added to the default list.
+
+ Raises PreprocessError on failure.
+ """
+ pass
+
+ def compile(
+ self,
+ sources: Sequence[str | os.PathLike[str]],
+ output_dir: str | None = None,
+ macros: list[_Macro] | None = None,
+ include_dirs: list[str] | tuple[str, ...] | None = None,
+ debug: bool = False,
+ extra_preargs: list[str] | None = None,
+ extra_postargs: list[str] | None = None,
+ depends: list[str] | tuple[str, ...] | None = None,
+ ) -> list[str]:
+ """Compile one or more source files.
+
+ 'sources' must be a list of filenames, most likely C/C++
+ files, but in reality anything that can be handled by a
+ particular compiler and compiler class (eg. MSVCCompiler can
+ handle resource files in 'sources'). Return a list of object
+ filenames, one per source filename in 'sources'. Depending on
+ the implementation, not all source files will necessarily be
+ compiled, but all corresponding object filenames will be
+ returned.
+
+ If 'output_dir' is given, object files will be put under it, while
+ retaining their original path component. That is, "foo/bar.c"
+ normally compiles to "foo/bar.o" (for a Unix implementation); if
+ 'output_dir' is "build", then it would compile to
+ "build/foo/bar.o".
+
+ 'macros', if given, must be a list of macro definitions. A macro
+ definition is either a (name, value) 2-tuple or a (name,) 1-tuple.
+ The former defines a macro; if the value is None, the macro is
+ defined without an explicit value. The 1-tuple case undefines a
+ macro. Later definitions/redefinitions/ undefinitions take
+ precedence.
+
+ 'include_dirs', if given, must be a list of strings, the
+ directories to add to the default include file search path for this
+ compilation only.
+
+ 'debug' is a boolean; if true, the compiler will be instructed to
+ output debug symbols in (or alongside) the object file(s).
+
+ 'extra_preargs' and 'extra_postargs' are implementation- dependent.
+ On platforms that have the notion of a command-line (e.g. Unix,
+ DOS/Windows), they are most likely lists of strings: extra
+ command-line arguments to prepend/append to the compiler command
+ line. On other platforms, consult the implementation class
+ documentation. In any event, they are intended as an escape hatch
+ for those occasions when the abstract compiler framework doesn't
+ cut the mustard.
+
+ 'depends', if given, is a list of filenames that all targets
+ depend on. If a source file is older than any file in
+ depends, then the source file will be recompiled. This
+ supports dependency tracking, but only at a coarse
+ granularity.
+
+ Raises CompileError on failure.
+ """
+ # A concrete compiler class can either override this method
+ # entirely or implement _compile().
+ macros, objects, extra_postargs, pp_opts, build = self._setup_compile(
+ output_dir, macros, include_dirs, sources, depends, extra_postargs
+ )
+ cc_args = self._get_cc_args(pp_opts, debug, extra_preargs)
+
+ for obj in objects:
+ try:
+ src, ext = build[obj]
+ except KeyError:
+ continue
+ self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
+
+ # Return *all* object filenames, not just the ones we just built.
+ return objects
+
+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+ """Compile 'src' to product 'obj'."""
+ # A concrete compiler class that does not override compile()
+ # should implement _compile().
+ pass
+
+ def create_static_lib(
+ self,
+ objects: list[str] | tuple[str, ...],
+ output_libname: str,
+ output_dir: str | None = None,
+ debug: bool = False,
+ target_lang: str | None = None,
+ ) -> None:
+ """Link a bunch of stuff together to create a static library file.
+ The "bunch of stuff" consists of the list of object files supplied
+ as 'objects', the extra object files supplied to
+ 'add_link_object()' and/or 'set_link_objects()', the libraries
+ supplied to 'add_library()' and/or 'set_libraries()', and the
+ libraries supplied as 'libraries' (if any).
+
+ 'output_libname' should be a library name, not a filename; the
+ filename will be inferred from the library name. 'output_dir' is
+ the directory where the library file will be put.
+
+ 'debug' is a boolean; if true, debugging information will be
+ included in the library (note that on most platforms, it is the
+ compile step where this matters: the 'debug' flag is included here
+ just for consistency).
+
+ 'target_lang' is the target language for which the given objects
+ are being compiled. This allows specific linkage time treatment of
+ certain languages.
+
+ Raises LibError on failure.
+ """
+ pass
+
+ # values for target_desc parameter in link()
+ SHARED_OBJECT = "shared_object"
+ SHARED_LIBRARY = "shared_library"
+ EXECUTABLE = "executable"
+
+ def link(
+ self,
+ target_desc: str,
+ objects: list[str] | tuple[str, ...],
+ output_filename: str,
+ output_dir: str | None = None,
+ libraries: list[str] | tuple[str, ...] | None = None,
+ library_dirs: list[str] | tuple[str, ...] | None = None,
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
+ export_symbols: Iterable[str] | None = None,
+ debug: bool = False,
+ extra_preargs: list[str] | None = None,
+ extra_postargs: list[str] | None = None,
+ build_temp: str | os.PathLike[str] | None = None,
+ target_lang: str | None = None,
+ ):
+ """Link a bunch of stuff together to create an executable or
+ shared library file.
+
+ The "bunch of stuff" consists of the list of object files supplied
+ as 'objects'. 'output_filename' should be a filename. If
+ 'output_dir' is supplied, 'output_filename' is relative to it
+ (i.e. 'output_filename' can provide directory components if
+ needed).
+
+ 'libraries' is a list of libraries to link against. These are
+ library names, not filenames, since they're translated into
+ filenames in a platform-specific way (eg. "foo" becomes "libfoo.a"
+ on Unix and "foo.lib" on DOS/Windows). However, they can include a
+ directory component, which means the linker will look in that
+ specific directory rather than searching all the normal locations.
+
+ 'library_dirs', if supplied, should be a list of directories to
+ search for libraries that were specified as bare library names
+ (ie. no directory component). These are on top of the system
+ default and those supplied to 'add_library_dir()' and/or
+ 'set_library_dirs()'. 'runtime_library_dirs' is a list of
+ directories that will be embedded into the shared library and used
+ to search for other shared libraries that *it* depends on at
+ run-time. (This may only be relevant on Unix.)
+
+ 'export_symbols' is a list of symbols that the shared library will
+ export. (This appears to be relevant only on Windows.)
+
+ 'debug' is as for 'compile()' and 'create_static_lib()', with the
+ slight distinction that it actually matters on most platforms (as
+ opposed to 'create_static_lib()', which includes a 'debug' flag
+ mostly for form's sake).
+
+ 'extra_preargs' and 'extra_postargs' are as for 'compile()' (except
+ of course that they supply command-line arguments for the
+ particular linker being used).
+
+ 'target_lang' is the target language for which the given objects
+ are being compiled. This allows specific linkage time treatment of
+ certain languages.
+
+ Raises LinkError on failure.
+ """
+ raise NotImplementedError
+
+ # Old 'link_*()' methods, rewritten to use the new 'link()' method.
+
+ def link_shared_lib(
+ self,
+ objects: list[str] | tuple[str, ...],
+ output_libname: str,
+ output_dir: str | None = None,
+ libraries: list[str] | tuple[str, ...] | None = None,
+ library_dirs: list[str] | tuple[str, ...] | None = None,
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
+ export_symbols: Iterable[str] | None = None,
+ debug: bool = False,
+ extra_preargs: list[str] | None = None,
+ extra_postargs: list[str] | None = None,
+ build_temp: str | os.PathLike[str] | None = None,
+ target_lang: str | None = None,
+ ):
+ self.link(
+ Compiler.SHARED_LIBRARY,
+ objects,
+ self.library_filename(output_libname, lib_type='shared'),
+ output_dir,
+ libraries,
+ library_dirs,
+ runtime_library_dirs,
+ export_symbols,
+ debug,
+ extra_preargs,
+ extra_postargs,
+ build_temp,
+ target_lang,
+ )
+
+ def link_shared_object(
+ self,
+ objects: list[str] | tuple[str, ...],
+ output_filename: str,
+ output_dir: str | None = None,
+ libraries: list[str] | tuple[str, ...] | None = None,
+ library_dirs: list[str] | tuple[str, ...] | None = None,
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
+ export_symbols: Iterable[str] | None = None,
+ debug: bool = False,
+ extra_preargs: list[str] | None = None,
+ extra_postargs: list[str] | None = None,
+ build_temp: str | os.PathLike[str] | None = None,
+ target_lang: str | None = None,
+ ):
+ self.link(
+ Compiler.SHARED_OBJECT,
+ objects,
+ output_filename,
+ output_dir,
+ libraries,
+ library_dirs,
+ runtime_library_dirs,
+ export_symbols,
+ debug,
+ extra_preargs,
+ extra_postargs,
+ build_temp,
+ target_lang,
+ )
+
+ def link_executable(
+ self,
+ objects: list[str] | tuple[str, ...],
+ output_progname: str,
+ output_dir: str | None = None,
+ libraries: list[str] | tuple[str, ...] | None = None,
+ library_dirs: list[str] | tuple[str, ...] | None = None,
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
+ debug: bool = False,
+ extra_preargs: list[str] | None = None,
+ extra_postargs: list[str] | None = None,
+ target_lang: str | None = None,
+ ):
+ self.link(
+ Compiler.EXECUTABLE,
+ objects,
+ self.executable_filename(output_progname),
+ output_dir,
+ libraries,
+ library_dirs,
+ runtime_library_dirs,
+ None,
+ debug,
+ extra_preargs,
+ extra_postargs,
+ None,
+ target_lang,
+ )
+
+ # -- Miscellaneous methods -----------------------------------------
+ # These are all used by the 'gen_lib_options() function; there is
+ # no appropriate default implementation so subclasses should
+ # implement all of these.
+
+ def library_dir_option(self, dir: str) -> str:
+ """Return the compiler option to add 'dir' to the list of
+ directories searched for libraries.
+ """
+ raise NotImplementedError
+
+ def runtime_library_dir_option(self, dir: str) -> str:
+ """Return the compiler option to add 'dir' to the list of
+ directories searched for runtime libraries.
+ """
+ raise NotImplementedError
+
+ def library_option(self, lib: str) -> str:
+ """Return the compiler option to add 'lib' to the list of libraries
+ linked into the shared library or executable.
+ """
+ raise NotImplementedError
+
+ def has_function( # noqa: C901
+ self,
+ funcname: str,
+ includes: Iterable[str] | None = None,
+ include_dirs: list[str] | tuple[str, ...] | None = None,
+ libraries: list[str] | None = None,
+ library_dirs: list[str] | tuple[str, ...] | None = None,
+ ) -> bool:
+ """Return a boolean indicating whether funcname is provided as
+ a symbol on the current platform. The optional arguments can
+ be used to augment the compilation environment.
+
+ The libraries argument is a list of flags to be passed to the
+ linker to make additional symbol definitions available for
+ linking.
+
+ The includes and include_dirs arguments are deprecated.
+ Usually, supplying include files with function declarations
+ will cause function detection to fail even in cases where the
+ symbol is available for linking.
+
+ """
+ # this can't be included at module scope because it tries to
+ # import math which might not be available at that point - maybe
+ # the necessary logic should just be inlined?
+ import tempfile
+
+ if includes is None:
+ includes = []
+ else:
+ warnings.warn("includes is deprecated", DeprecationWarning)
+ if include_dirs is None:
+ include_dirs = []
+ else:
+ warnings.warn("include_dirs is deprecated", DeprecationWarning)
+ if libraries is None:
+ libraries = []
+ if library_dirs is None:
+ library_dirs = []
+ fd, fname = tempfile.mkstemp(".c", funcname, text=True)
+ with os.fdopen(fd, "w", encoding='utf-8') as f:
+ for incl in includes:
+ f.write(f"""#include "{incl}"\n""")
+ if not includes:
+ # Use "char func(void);" as the prototype to follow
+ # what autoconf does. This prototype does not match
+ # any well-known function the compiler might recognize
+ # as a builtin, so this ends up as a true link test.
+ # Without a fake prototype, the test would need to
+ # know the exact argument types, and the has_function
+ # interface does not provide that level of information.
+ f.write(
+ f"""\
+#ifdef __cplusplus
+extern "C"
+#endif
+char {funcname}(void);
+"""
+ )
+ f.write(
+ f"""\
+int main (int argc, char **argv) {{
+ {funcname}();
+ return 0;
+}}
+"""
+ )
+
+ try:
+ objects = self.compile([fname], include_dirs=include_dirs)
+ except CompileError:
+ return False
+ finally:
+ os.remove(fname)
+
+ try:
+ self.link_executable(
+ objects, "a.out", libraries=libraries, library_dirs=library_dirs
+ )
+ except (LinkError, TypeError):
+ return False
+ else:
+ os.remove(
+ self.executable_filename("a.out", output_dir=self.output_dir or '')
+ )
+ finally:
+ for fn in objects:
+ os.remove(fn)
+ return True
+
+ def find_library_file(
+ self, dirs: Iterable[str], lib: str, debug: bool = False
+ ) -> str | None:
+ """Search the specified list of directories for a static or shared
+ library file 'lib' and return the full path to that file. If
+ 'debug' true, look for a debugging version (if that makes sense on
+ the current platform). Return None if 'lib' wasn't found in any of
+ the specified directories.
+ """
+ raise NotImplementedError
+
+ # -- Filename generation methods -----------------------------------
+
+ # The default implementation of the filename generating methods are
+ # prejudiced towards the Unix/DOS/Windows view of the world:
+ # * object files are named by replacing the source file extension
+ # (eg. .c/.cpp -> .o/.obj)
+ # * library files (shared or static) are named by plugging the
+ # library name and extension into a format string, eg.
+ # "lib%s.%s" % (lib_name, ".a") for Unix static libraries
+ # * executables are named by appending an extension (possibly
+ # empty) to the program name: eg. progname + ".exe" for
+ # Windows
+ #
+ # To reduce redundant code, these methods expect to find
+ # several attributes in the current object (presumably defined
+ # as class attributes):
+ # * src_extensions -
+ # list of C/C++ source file extensions, eg. ['.c', '.cpp']
+ # * obj_extension -
+ # object file extension, eg. '.o' or '.obj'
+ # * static_lib_extension -
+ # extension for static library files, eg. '.a' or '.lib'
+ # * shared_lib_extension -
+ # extension for shared library/object files, eg. '.so', '.dll'
+ # * static_lib_format -
+ # format string for generating static library filenames,
+ # eg. 'lib%s.%s' or '%s.%s'
+ # * shared_lib_format
+ # format string for generating shared library filenames
+ # (probably same as static_lib_format, since the extension
+ # is one of the intended parameters to the format string)
+ # * exe_extension -
+ # extension for executable files, eg. '' or '.exe'
+
+ def object_filenames(
+ self,
+ source_filenames: Iterable[str | os.PathLike[str]],
+ strip_dir: bool = False,
+ output_dir: str | os.PathLike[str] | None = '',
+ ) -> list[str]:
+ if output_dir is None:
+ output_dir = ''
+ return list(
+ self._make_out_path(output_dir, strip_dir, src_name)
+ for src_name in source_filenames
+ )
+
+ @property
+ def out_extensions(self):
+ return dict.fromkeys(self.src_extensions, self.obj_extension)
+
+ def _make_out_path(self, output_dir, strip_dir, src_name):
+ return self._make_out_path_exts(
+ output_dir, strip_dir, src_name, self.out_extensions
+ )
+
+ @classmethod
+ def _make_out_path_exts(cls, output_dir, strip_dir, src_name, extensions):
+ r"""
+ >>> exts = {'.c': '.o'}
+ >>> Compiler._make_out_path_exts('.', False, '/foo/bar.c', exts).replace('\\', '/')
+ './foo/bar.o'
+ >>> Compiler._make_out_path_exts('.', True, '/foo/bar.c', exts).replace('\\', '/')
+ './bar.o'
+ """
+ src = pathlib.PurePath(src_name)
+ # Ensure base is relative to honor output_dir (python/cpython#37775).
+ base = cls._make_relative(src)
+ try:
+ new_ext = extensions[src.suffix]
+ except LookupError:
+ raise UnknownFileType(f"unknown file type '{src.suffix}' (from '{src}')")
+ if strip_dir:
+ base = pathlib.PurePath(base.name)
+ return os.path.join(output_dir, base.with_suffix(new_ext))
+
+ @staticmethod
+ def _make_relative(base: pathlib.Path):
+ return base.relative_to(base.anchor)
+
+ @overload
+ def shared_object_filename(
+ self,
+ basename: str,
+ strip_dir: Literal[False] = False,
+ output_dir: str | os.PathLike[str] = "",
+ ) -> str: ...
+ @overload
+ def shared_object_filename(
+ self,
+ basename: str | os.PathLike[str],
+ strip_dir: Literal[True],
+ output_dir: str | os.PathLike[str] = "",
+ ) -> str: ...
+ def shared_object_filename(
+ self,
+ basename: str | os.PathLike[str],
+ strip_dir: bool = False,
+ output_dir: str | os.PathLike[str] = '',
+ ) -> str:
+ assert output_dir is not None
+ if strip_dir:
+ basename = os.path.basename(basename)
+ return os.path.join(output_dir, basename + self.shared_lib_extension)
+
+ @overload
+ def executable_filename(
+ self,
+ basename: str,
+ strip_dir: Literal[False] = False,
+ output_dir: str | os.PathLike[str] = "",
+ ) -> str: ...
+ @overload
+ def executable_filename(
+ self,
+ basename: str | os.PathLike[str],
+ strip_dir: Literal[True],
+ output_dir: str | os.PathLike[str] = "",
+ ) -> str: ...
+ def executable_filename(
+ self,
+ basename: str | os.PathLike[str],
+ strip_dir: bool = False,
+ output_dir: str | os.PathLike[str] = '',
+ ) -> str:
+ assert output_dir is not None
+ if strip_dir:
+ basename = os.path.basename(basename)
+ return os.path.join(output_dir, basename + (self.exe_extension or ''))
+
+ def library_filename(
+ self,
+ libname: str,
+ lib_type: str = "static",
+ strip_dir: bool = False,
+ output_dir: str | os.PathLike[str] = "", # or 'shared'
+ ):
+ assert output_dir is not None
+ expected = '"static", "shared", "dylib", "xcode_stub"'
+ if lib_type not in eval(expected):
+ raise ValueError(f"'lib_type' must be {expected}")
+ fmt = getattr(self, lib_type + "_lib_format")
+ ext = getattr(self, lib_type + "_lib_extension")
+
+ dir, base = os.path.split(libname)
+ filename = fmt % (base, ext)
+ if strip_dir:
+ dir = ''
+
+ return os.path.join(output_dir, dir, filename)
+
+ # -- Utility methods -----------------------------------------------
+
+ def announce(self, msg: object, level: int = 1) -> None:
+ log.debug(msg)
+
+ def debug_print(self, msg: object) -> None:
+ from distutils.debug import DEBUG
+
+ if DEBUG:
+ print(msg)
+
+ def warn(self, msg: object) -> None:
+ sys.stderr.write(f"warning: {msg}\n")
+
+ def execute(
+ self,
+ func: Callable[[Unpack[_Ts]], object],
+ args: tuple[Unpack[_Ts]],
+ msg: object = None,
+ level: int = 1,
+ ) -> None:
+ execute(func, args, msg, self.dry_run)
+
+ def spawn(
+ self, cmd: MutableSequence[bytes | str | os.PathLike[str]], **kwargs
+ ) -> None:
+ spawn(cmd, dry_run=self.dry_run, **kwargs)
+
+ @overload
+ def move_file(
+ self, src: str | os.PathLike[str], dst: _StrPathT
+ ) -> _StrPathT | str: ...
+ @overload
+ def move_file(
+ self, src: bytes | os.PathLike[bytes], dst: _BytesPathT
+ ) -> _BytesPathT | bytes: ...
+ def move_file(
+ self,
+ src: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ dst: str | os.PathLike[str] | bytes | os.PathLike[bytes],
+ ) -> str | os.PathLike[str] | bytes | os.PathLike[bytes]:
+ return move_file(src, dst, dry_run=self.dry_run)
+
+ def mkpath(self, name, mode=0o777):
+ mkpath(name, mode, dry_run=self.dry_run)
+
+
+# Map a sys.platform/os.name ('posix', 'nt') to the default compiler
+# type for that platform. Keys are interpreted as re match
+# patterns. Order is important; platform mappings are preferred over
+# OS names.
+_default_compilers = (
+ # Platform string mappings
+ # on a cygwin built python we can use gcc like an ordinary UNIXish
+ # compiler
+ ('cygwin.*', 'unix'),
+ ('zos', 'zos'),
+ # OS name mappings
+ ('posix', 'unix'),
+ ('nt', 'msvc'),
+)
+
+
+def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str:
+ """Determine the default compiler to use for the given platform.
+
+ osname should be one of the standard Python OS names (i.e. the
+ ones returned by os.name) and platform the common value
+ returned by sys.platform for the platform in question.
+
+ The default values are os.name and sys.platform in case the
+ parameters are not given.
+ """
+ if osname is None:
+ osname = os.name
+ if platform is None:
+ platform = sys.platform
+ # Mingw is a special case where sys.platform is 'win32' but we
+ # want to use the 'mingw32' compiler, so check it first
+ if is_mingw():
+ return 'mingw32'
+ for pattern, compiler in _default_compilers:
+ if (
+ re.match(pattern, platform) is not None
+ or re.match(pattern, osname) is not None
+ ):
+ return compiler
+ # Default to Unix compiler
+ return 'unix'
+
+
+# Map compiler types to (module_name, class_name) pairs -- ie. where to
+# find the code that implements an interface to this compiler. (The module
+# is assumed to be in the 'distutils' package.)
+compiler_class = {
+ 'unix': ('unixccompiler', 'UnixCCompiler', "standard UNIX-style compiler"),
+ 'msvc': ('_msvccompiler', 'MSVCCompiler', "Microsoft Visual C++"),
+ 'cygwin': (
+ 'cygwinccompiler',
+ 'CygwinCCompiler',
+ "Cygwin port of GNU C Compiler for Win32",
+ ),
+ 'mingw32': (
+ 'cygwinccompiler',
+ 'Mingw32CCompiler',
+ "Mingw32 port of GNU C Compiler for Win32",
+ ),
+ 'bcpp': ('bcppcompiler', 'BCPPCompiler', "Borland C++ Compiler"),
+ 'zos': ('zosccompiler', 'zOSCCompiler', 'IBM XL C/C++ Compilers'),
+}
+
+
+def show_compilers() -> None:
+ """Print list of available compilers (used by the "--help-compiler"
+ options to "build", "build_ext", "build_clib").
+ """
+ # XXX this "knows" that the compiler option it's describing is
+ # "--compiler", which just happens to be the case for the three
+ # commands that use it.
+ from distutils.fancy_getopt import FancyGetopt
+
+ compilers = sorted(
+ ("compiler=" + compiler, None, compiler_class[compiler][2])
+ for compiler in compiler_class.keys()
+ )
+ pretty_printer = FancyGetopt(compilers)
+ pretty_printer.print_help("List of available compilers:")
+
+
+def new_compiler(
+ plat: str | None = None,
+ compiler: str | None = None,
+ verbose: bool = False,
+ dry_run: bool = False,
+ force: bool = False,
+) -> Compiler:
+ """Generate an instance of some CCompiler subclass for the supplied
+ platform/compiler combination. 'plat' defaults to 'os.name'
+ (eg. 'posix', 'nt'), and 'compiler' defaults to the default compiler
+ for that platform. Currently only 'posix' and 'nt' are supported, and
+ the default compilers are "traditional Unix interface" (UnixCCompiler
+ class) and Visual C++ (MSVCCompiler class). Note that it's perfectly
+ possible to ask for a Unix compiler object under Windows, and a
+ Microsoft compiler object under Unix -- if you supply a value for
+ 'compiler', 'plat' is ignored.
+ """
+ if plat is None:
+ plat = os.name
+
+ try:
+ if compiler is None:
+ compiler = get_default_compiler(plat)
+
+ (module_name, class_name, long_description) = compiler_class[compiler]
+ except KeyError:
+ msg = f"don't know how to compile C/C++ code on platform '{plat}'"
+ if compiler is not None:
+ msg = msg + f" with '{compiler}' compiler"
+ raise DistutilsPlatformError(msg)
+
+ try:
+ module_name = "distutils." + module_name
+ __import__(module_name)
+ module = sys.modules[module_name]
+ klass = vars(module)[class_name]
+ except ImportError:
+ raise DistutilsModuleError(
+ f"can't compile C/C++ code: unable to load module '{module_name}'"
+ )
+ except KeyError:
+ raise DistutilsModuleError(
+ f"can't compile C/C++ code: unable to find class '{class_name}' "
+ f"in module '{module_name}'"
+ )
+
+ # XXX The None is necessary to preserve backwards compatibility
+ # with classes that expect verbose to be the first positional
+ # argument.
+ return klass(None, dry_run, force)
+
+
+def gen_preprocess_options(
+ macros: Iterable[_Macro], include_dirs: Iterable[str]
+) -> list[str]:
+ """Generate C pre-processor options (-D, -U, -I) as used by at least
+ two types of compilers: the typical Unix compiler and Visual C++.
+ 'macros' is the usual thing, a list of 1- or 2-tuples, where (name,)
+ means undefine (-U) macro 'name', and (name,value) means define (-D)
+ macro 'name' to 'value'. 'include_dirs' is just a list of directory
+ names to be added to the header file search path (-I). Returns a list
+ of command-line options suitable for either Unix compilers or Visual
+ C++.
+ """
+ # XXX it would be nice (mainly aesthetic, and so we don't generate
+ # stupid-looking command lines) to go over 'macros' and eliminate
+ # redundant definitions/undefinitions (ie. ensure that only the
+ # latest mention of a particular macro winds up on the command
+ # line). I don't think it's essential, though, since most (all?)
+ # Unix C compilers only pay attention to the latest -D or -U
+ # mention of a macro on their command line. Similar situation for
+ # 'include_dirs'. I'm punting on both for now. Anyways, weeding out
+ # redundancies like this should probably be the province of
+ # CCompiler, since the data structures used are inherited from it
+ # and therefore common to all CCompiler classes.
+ pp_opts = []
+ for macro in macros:
+ if not (isinstance(macro, tuple) and 1 <= len(macro) <= 2):
+ raise TypeError(
+ f"bad macro definition '{macro}': "
+ "each element of 'macros' list must be a 1- or 2-tuple"
+ )
+
+ if len(macro) == 1: # undefine this macro
+ pp_opts.append(f"-U{macro[0]}")
+ elif len(macro) == 2:
+ if macro[1] is None: # define with no explicit value
+ pp_opts.append(f"-D{macro[0]}")
+ else:
+ # XXX *don't* need to be clever about quoting the
+ # macro value here, because we're going to avoid the
+ # shell at all costs when we spawn the command!
+ pp_opts.append("-D{}={}".format(*macro))
+
+ pp_opts.extend(f"-I{dir}" for dir in include_dirs)
+ return pp_opts
+
+
+def gen_lib_options(
+ compiler: Compiler,
+ library_dirs: Iterable[str],
+ runtime_library_dirs: Iterable[str],
+ libraries: Iterable[str],
+) -> list[str]:
+ """Generate linker options for searching library directories and
+ linking with specific libraries. 'libraries' and 'library_dirs' are,
+ respectively, lists of library names (not filenames!) and search
+ directories. Returns a list of command-line options suitable for use
+ with some compiler (depending on the two format strings passed in).
+ """
+ lib_opts = [compiler.library_dir_option(dir) for dir in library_dirs]
+
+ for dir in runtime_library_dirs:
+ lib_opts.extend(always_iterable(compiler.runtime_library_dir_option(dir)))
+
+ # XXX it's important that we *not* remove redundant library mentions!
+ # sometimes you really do have to say "-lfoo -lbar -lfoo" in order to
+ # resolve all symbols. I just hope we never have to say "-lfoo obj.o
+ # -lbar" to get things to work -- that's certainly a possibility, but a
+ # pretty nasty way to arrange your C code.
+
+ for lib in libraries:
+ (lib_dir, lib_name) = os.path.split(lib)
+ if lib_dir:
+ lib_file = compiler.find_library_file([lib_dir], lib_name)
+ if lib_file:
+ lib_opts.append(lib_file)
+ else:
+ compiler.warn(
+ f"no library file corresponding to '{lib}' found (skipping)"
+ )
+ else:
+ lib_opts.append(compiler.library_option(lib))
+ return lib_opts
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/cygwin.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/cygwin.py
new file mode 100644
index 0000000000000000000000000000000000000000..bfabbb306e7e44ed120d35f083304e65d7cecf83
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/cygwin.py
@@ -0,0 +1,340 @@
+"""distutils.cygwinccompiler
+
+Provides the CygwinCCompiler class, a subclass of UnixCCompiler that
+handles the Cygwin port of the GNU C compiler to Windows. It also contains
+the Mingw32CCompiler class which handles the mingw32 port of GCC (same as
+cygwin in no-cygwin mode).
+"""
+
+import copy
+import os
+import pathlib
+import shlex
+import sys
+import warnings
+from subprocess import check_output
+
+from ...errors import (
+ DistutilsExecError,
+ DistutilsPlatformError,
+)
+from ...file_util import write_file
+from ...sysconfig import get_config_vars
+from ...version import LooseVersion, suppress_known_deprecation
+from . import unix
+from .errors import (
+ CompileError,
+ Error,
+)
+
+
+def get_msvcr():
+ """No longer needed, but kept for backward compatibility."""
+ return []
+
+
+_runtime_library_dirs_msg = (
+ "Unable to set runtime library search path on Windows, "
+ "usually indicated by `runtime_library_dirs` parameter to Extension"
+)
+
+
+class Compiler(unix.Compiler):
+ """Handles the Cygwin port of the GNU C compiler to Windows."""
+
+ compiler_type = 'cygwin'
+ obj_extension = ".o"
+ static_lib_extension = ".a"
+ shared_lib_extension = ".dll.a"
+ dylib_lib_extension = ".dll"
+ static_lib_format = "lib%s%s"
+ shared_lib_format = "lib%s%s"
+ dylib_lib_format = "cyg%s%s"
+ exe_extension = ".exe"
+
+ def __init__(self, verbose=False, dry_run=False, force=False):
+ super().__init__(verbose, dry_run, force)
+
+ status, details = check_config_h()
+ self.debug_print(f"Python's GCC status: {status} (details: {details})")
+ if status is not CONFIG_H_OK:
+ self.warn(
+ "Python's pyconfig.h doesn't seem to support your compiler. "
+ f"Reason: {details}. "
+ "Compiling may fail because of undefined preprocessor macros."
+ )
+
+ self.cc, self.cxx = get_config_vars('CC', 'CXX')
+
+ # Override 'CC' and 'CXX' environment variables for
+ # building using MINGW compiler for MSVC python.
+ self.cc = os.environ.get('CC', self.cc or 'gcc')
+ self.cxx = os.environ.get('CXX', self.cxx or 'g++')
+
+ self.linker_dll = self.cc
+ self.linker_dll_cxx = self.cxx
+ shared_option = "-shared"
+
+ self.set_executables(
+ compiler=f'{self.cc} -mcygwin -O -Wall',
+ compiler_so=f'{self.cc} -mcygwin -mdll -O -Wall',
+ compiler_cxx=f'{self.cxx} -mcygwin -O -Wall',
+ compiler_so_cxx=f'{self.cxx} -mcygwin -mdll -O -Wall',
+ linker_exe=f'{self.cc} -mcygwin',
+ linker_so=f'{self.linker_dll} -mcygwin {shared_option}',
+ linker_exe_cxx=f'{self.cxx} -mcygwin',
+ linker_so_cxx=f'{self.linker_dll_cxx} -mcygwin {shared_option}',
+ )
+
+ self.dll_libraries = get_msvcr()
+
+ @property
+ def gcc_version(self):
+ # Older numpy depended on this existing to check for ancient
+ # gcc versions. This doesn't make much sense with clang etc so
+ # just hardcode to something recent.
+ # https://github.com/numpy/numpy/pull/20333
+ warnings.warn(
+ "gcc_version attribute of CygwinCCompiler is deprecated. "
+ "Instead of returning actual gcc version a fixed value 11.2.0 is returned.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ with suppress_known_deprecation():
+ return LooseVersion("11.2.0")
+
+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+ """Compiles the source by spawning GCC and windres if needed."""
+ if ext in ('.rc', '.res'):
+ # gcc needs '.res' and '.rc' compiled to object files !!!
+ try:
+ self.spawn(["windres", "-i", src, "-o", obj])
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
+ else: # for other files use the C-compiler
+ try:
+ if self.detect_language(src) == 'c++':
+ self.spawn(
+ self.compiler_so_cxx
+ + cc_args
+ + [src, '-o', obj]
+ + extra_postargs
+ )
+ else:
+ self.spawn(
+ self.compiler_so + cc_args + [src, '-o', obj] + extra_postargs
+ )
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
+
+ def link(
+ self,
+ target_desc,
+ objects,
+ output_filename,
+ output_dir=None,
+ libraries=None,
+ library_dirs=None,
+ runtime_library_dirs=None,
+ export_symbols=None,
+ debug=False,
+ extra_preargs=None,
+ extra_postargs=None,
+ build_temp=None,
+ target_lang=None,
+ ):
+ """Link the objects."""
+ # use separate copies, so we can modify the lists
+ extra_preargs = copy.copy(extra_preargs or [])
+ libraries = copy.copy(libraries or [])
+ objects = copy.copy(objects or [])
+
+ if runtime_library_dirs:
+ self.warn(_runtime_library_dirs_msg)
+
+ # Additional libraries
+ libraries.extend(self.dll_libraries)
+
+ # handle export symbols by creating a def-file
+ # with executables this only works with gcc/ld as linker
+ if (export_symbols is not None) and (
+ target_desc != self.EXECUTABLE or self.linker_dll == "gcc"
+ ):
+ # (The linker doesn't do anything if output is up-to-date.
+ # So it would probably better to check if we really need this,
+ # but for this we had to insert some unchanged parts of
+ # UnixCCompiler, and this is not what we want.)
+
+ # we want to put some files in the same directory as the
+ # object files are, build_temp doesn't help much
+ # where are the object files
+ temp_dir = os.path.dirname(objects[0])
+ # name of dll to give the helper files the same base name
+ (dll_name, dll_extension) = os.path.splitext(
+ os.path.basename(output_filename)
+ )
+
+ # generate the filenames for these files
+ def_file = os.path.join(temp_dir, dll_name + ".def")
+
+ # Generate .def file
+ contents = [f"LIBRARY {os.path.basename(output_filename)}", "EXPORTS"]
+ contents.extend(export_symbols)
+ self.execute(write_file, (def_file, contents), f"writing {def_file}")
+
+ # next add options for def-file
+
+ # for gcc/ld the def-file is specified as any object files
+ objects.append(def_file)
+
+ # end: if ((export_symbols is not None) and
+ # (target_desc != self.EXECUTABLE or self.linker_dll == "gcc")):
+
+ # who wants symbols and a many times larger output file
+ # should explicitly switch the debug mode on
+ # otherwise we let ld strip the output file
+ # (On my machine: 10KiB < stripped_file < ??100KiB
+ # unstripped_file = stripped_file + XXX KiB
+ # ( XXX=254 for a typical python extension))
+ if not debug:
+ extra_preargs.append("-s")
+
+ super().link(
+ target_desc,
+ objects,
+ output_filename,
+ output_dir,
+ libraries,
+ library_dirs,
+ runtime_library_dirs,
+ None, # export_symbols, we do this in our def-file
+ debug,
+ extra_preargs,
+ extra_postargs,
+ build_temp,
+ target_lang,
+ )
+
+ def runtime_library_dir_option(self, dir):
+ # cygwin doesn't support rpath. While in theory we could error
+ # out like MSVC does, code might expect it to work like on Unix, so
+ # just warn and hope for the best.
+ self.warn(_runtime_library_dirs_msg)
+ return []
+
+ # -- Miscellaneous methods -----------------------------------------
+
+ def _make_out_path(self, output_dir, strip_dir, src_name):
+ # use normcase to make sure '.rc' is really '.rc' and not '.RC'
+ norm_src_name = os.path.normcase(src_name)
+ return super()._make_out_path(output_dir, strip_dir, norm_src_name)
+
+ @property
+ def out_extensions(self):
+ """
+ Add support for rc and res files.
+ """
+ return {
+ **super().out_extensions,
+ **{ext: ext + self.obj_extension for ext in ('.res', '.rc')},
+ }
+
+
+# the same as cygwin plus some additional parameters
+class MinGW32Compiler(Compiler):
+ """Handles the Mingw32 port of the GNU C compiler to Windows."""
+
+ compiler_type = 'mingw32'
+
+ def __init__(self, verbose=False, dry_run=False, force=False):
+ super().__init__(verbose, dry_run, force)
+
+ shared_option = "-shared"
+
+ if is_cygwincc(self.cc):
+ raise Error('Cygwin gcc cannot be used with --compiler=mingw32')
+
+ self.set_executables(
+ compiler=f'{self.cc} -O -Wall',
+ compiler_so=f'{self.cc} -shared -O -Wall',
+ compiler_so_cxx=f'{self.cxx} -shared -O -Wall',
+ compiler_cxx=f'{self.cxx} -O -Wall',
+ linker_exe=f'{self.cc}',
+ linker_so=f'{self.linker_dll} {shared_option}',
+ linker_exe_cxx=f'{self.cxx}',
+ linker_so_cxx=f'{self.linker_dll_cxx} {shared_option}',
+ )
+
+ def runtime_library_dir_option(self, dir):
+ raise DistutilsPlatformError(_runtime_library_dirs_msg)
+
+
+# Because these compilers aren't configured in Python's pyconfig.h file by
+# default, we should at least warn the user if he is using an unmodified
+# version.
+
+CONFIG_H_OK = "ok"
+CONFIG_H_NOTOK = "not ok"
+CONFIG_H_UNCERTAIN = "uncertain"
+
+
+def check_config_h():
+ """Check if the current Python installation appears amenable to building
+ extensions with GCC.
+
+ Returns a tuple (status, details), where 'status' is one of the following
+ constants:
+
+ - CONFIG_H_OK: all is well, go ahead and compile
+ - CONFIG_H_NOTOK: doesn't look good
+ - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h
+
+ 'details' is a human-readable string explaining the situation.
+
+ Note there are two ways to conclude "OK": either 'sys.version' contains
+ the string "GCC" (implying that this Python was built with GCC), or the
+ installed "pyconfig.h" contains the string "__GNUC__".
+ """
+
+ # XXX since this function also checks sys.version, it's not strictly a
+ # "pyconfig.h" check -- should probably be renamed...
+
+ from distutils import sysconfig
+
+ # if sys.version contains GCC then python was compiled with GCC, and the
+ # pyconfig.h file should be OK
+ if "GCC" in sys.version:
+ return CONFIG_H_OK, "sys.version mentions 'GCC'"
+
+ # Clang would also work
+ if "Clang" in sys.version:
+ return CONFIG_H_OK, "sys.version mentions 'Clang'"
+
+ # let's see if __GNUC__ is mentioned in python.h
+ fn = sysconfig.get_config_h_filename()
+ try:
+ config_h = pathlib.Path(fn).read_text(encoding='utf-8')
+ except OSError as exc:
+ return (CONFIG_H_UNCERTAIN, f"couldn't read '{fn}': {exc.strerror}")
+ else:
+ substring = '__GNUC__'
+ if substring in config_h:
+ code = CONFIG_H_OK
+ mention_inflected = 'mentions'
+ else:
+ code = CONFIG_H_NOTOK
+ mention_inflected = 'does not mention'
+ return code, f"{fn!r} {mention_inflected} {substring!r}"
+
+
+def is_cygwincc(cc):
+ """Try to determine if the compiler that would be used is from cygwin."""
+ out_string = check_output(shlex.split(cc) + ['-dumpmachine'])
+ return out_string.strip().endswith(b'cygwin')
+
+
+get_versions = None
+"""
+A stand-in for the previous get_versions() function to prevent failures
+when monkeypatched. See pypa/setuptools#2969.
+"""
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/errors.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/errors.py
new file mode 100644
index 0000000000000000000000000000000000000000..01328592b2dad80f4d16c55cd9db9829b3c650f1
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/errors.py
@@ -0,0 +1,24 @@
+class Error(Exception):
+ """Some compile/link operation failed."""
+
+
+class PreprocessError(Error):
+ """Failure to preprocess one or more C/C++ files."""
+
+
+class CompileError(Error):
+ """Failure to compile one or more C/C++ source files."""
+
+
+class LibError(Error):
+ """Failure to create a static library from one or more C/C++ object
+ files."""
+
+
+class LinkError(Error):
+ """Failure to link one or more C/C++ object files into an executable
+ or shared library file."""
+
+
+class UnknownFileType(Error):
+ """Attempt to process an unknown file type."""
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/msvc.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/msvc.py
new file mode 100644
index 0000000000000000000000000000000000000000..6db062a9e714d0a95e1550d387abbffe5950547f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/msvc.py
@@ -0,0 +1,614 @@
+"""distutils._msvccompiler
+
+Contains MSVCCompiler, an implementation of the abstract CCompiler class
+for Microsoft Visual Studio 2015.
+
+This module requires VS 2015 or later.
+"""
+
+# Written by Perry Stoll
+# hacked by Robin Becker and Thomas Heller to do a better job of
+# finding DevStudio (through the registry)
+# ported to VS 2005 and VS 2008 by Christian Heimes
+# ported to VS 2015 by Steve Dower
+from __future__ import annotations
+
+import contextlib
+import os
+import subprocess
+import unittest.mock as mock
+import warnings
+from collections.abc import Iterable
+
+with contextlib.suppress(ImportError):
+ import winreg
+
+from itertools import count
+
+from ..._log import log
+from ...errors import (
+ DistutilsExecError,
+ DistutilsPlatformError,
+)
+from ...util import get_host_platform, get_platform
+from . import base
+from .base import gen_lib_options
+from .errors import (
+ CompileError,
+ LibError,
+ LinkError,
+)
+
+
+def _find_vc2015():
+ try:
+ key = winreg.OpenKeyEx(
+ winreg.HKEY_LOCAL_MACHINE,
+ r"Software\Microsoft\VisualStudio\SxS\VC7",
+ access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY,
+ )
+ except OSError:
+ log.debug("Visual C++ is not registered")
+ return None, None
+
+ best_version = 0
+ best_dir = None
+ with key:
+ for i in count():
+ try:
+ v, vc_dir, vt = winreg.EnumValue(key, i)
+ except OSError:
+ break
+ if v and vt == winreg.REG_SZ and os.path.isdir(vc_dir):
+ try:
+ version = int(float(v))
+ except (ValueError, TypeError):
+ continue
+ if version >= 14 and version > best_version:
+ best_version, best_dir = version, vc_dir
+ return best_version, best_dir
+
+
+def _find_vc2017():
+ """Returns "15, path" based on the result of invoking vswhere.exe
+ If no install is found, returns "None, None"
+
+ The version is returned to avoid unnecessarily changing the function
+ result. It may be ignored when the path is not None.
+
+ If vswhere.exe is not available, by definition, VS 2017 is not
+ installed.
+ """
+ root = os.environ.get("ProgramFiles(x86)") or os.environ.get("ProgramFiles")
+ if not root:
+ return None, None
+
+ variant = 'arm64' if get_platform() == 'win-arm64' else 'x86.x64'
+ suitable_components = (
+ f"Microsoft.VisualStudio.Component.VC.Tools.{variant}",
+ "Microsoft.VisualStudio.Workload.WDExpress",
+ )
+
+ for component in suitable_components:
+ # Workaround for `-requiresAny` (only available on VS 2017 > 15.6)
+ with contextlib.suppress(
+ subprocess.CalledProcessError, OSError, UnicodeDecodeError
+ ):
+ path = (
+ subprocess.check_output([
+ os.path.join(
+ root, "Microsoft Visual Studio", "Installer", "vswhere.exe"
+ ),
+ "-latest",
+ "-prerelease",
+ "-requires",
+ component,
+ "-property",
+ "installationPath",
+ "-products",
+ "*",
+ ])
+ .decode(encoding="mbcs", errors="strict")
+ .strip()
+ )
+
+ path = os.path.join(path, "VC", "Auxiliary", "Build")
+ if os.path.isdir(path):
+ return 15, path
+
+ return None, None # no suitable component found
+
+
+PLAT_SPEC_TO_RUNTIME = {
+ 'x86': 'x86',
+ 'x86_amd64': 'x64',
+ 'x86_arm': 'arm',
+ 'x86_arm64': 'arm64',
+}
+
+
+def _find_vcvarsall(plat_spec):
+ # bpo-38597: Removed vcruntime return value
+ _, best_dir = _find_vc2017()
+
+ if not best_dir:
+ best_version, best_dir = _find_vc2015()
+
+ if not best_dir:
+ log.debug("No suitable Visual C++ version found")
+ return None, None
+
+ vcvarsall = os.path.join(best_dir, "vcvarsall.bat")
+ if not os.path.isfile(vcvarsall):
+ log.debug("%s cannot be found", vcvarsall)
+ return None, None
+
+ return vcvarsall, None
+
+
+def _get_vc_env(plat_spec):
+ if os.getenv("DISTUTILS_USE_SDK"):
+ return {key.lower(): value for key, value in os.environ.items()}
+
+ vcvarsall, _ = _find_vcvarsall(plat_spec)
+ if not vcvarsall:
+ raise DistutilsPlatformError(
+ 'Microsoft Visual C++ 14.0 or greater is required. '
+ 'Get it with "Microsoft C++ Build Tools": '
+ 'https://visualstudio.microsoft.com/visual-cpp-build-tools/'
+ )
+
+ try:
+ out = subprocess.check_output(
+ f'cmd /u /c "{vcvarsall}" {plat_spec} && set',
+ stderr=subprocess.STDOUT,
+ ).decode('utf-16le', errors='replace')
+ except subprocess.CalledProcessError as exc:
+ log.error(exc.output)
+ raise DistutilsPlatformError(f"Error executing {exc.cmd}")
+
+ env = {
+ key.lower(): value
+ for key, _, value in (line.partition('=') for line in out.splitlines())
+ if key and value
+ }
+
+ return env
+
+
+def _find_exe(exe, paths=None):
+ """Return path to an MSVC executable program.
+
+ Tries to find the program in several places: first, one of the
+ MSVC program search paths from the registry; next, the directories
+ in the PATH environment variable. If any of those work, return an
+ absolute path that is known to exist. If none of them work, just
+ return the original program name, 'exe'.
+ """
+ if not paths:
+ paths = os.getenv('path').split(os.pathsep)
+ for p in paths:
+ fn = os.path.join(os.path.abspath(p), exe)
+ if os.path.isfile(fn):
+ return fn
+ return exe
+
+
+_vcvars_names = {
+ 'win32': 'x86',
+ 'win-amd64': 'amd64',
+ 'win-arm32': 'arm',
+ 'win-arm64': 'arm64',
+}
+
+
+def _get_vcvars_spec(host_platform, platform):
+ """
+ Given a host platform and platform, determine the spec for vcvarsall.
+
+ Uses the native MSVC host if the host platform would need expensive
+ emulation for x86.
+
+ >>> _get_vcvars_spec('win-arm64', 'win32')
+ 'arm64_x86'
+ >>> _get_vcvars_spec('win-arm64', 'win-amd64')
+ 'arm64_amd64'
+
+ Otherwise, always cross-compile from x86 to work with the
+ lighter-weight MSVC installs that do not include native 64-bit tools.
+
+ >>> _get_vcvars_spec('win32', 'win32')
+ 'x86'
+ >>> _get_vcvars_spec('win-arm32', 'win-arm32')
+ 'x86_arm'
+ >>> _get_vcvars_spec('win-amd64', 'win-arm64')
+ 'x86_arm64'
+ """
+ if host_platform != 'win-arm64':
+ host_platform = 'win32'
+ vc_hp = _vcvars_names[host_platform]
+ vc_plat = _vcvars_names[platform]
+ return vc_hp if vc_hp == vc_plat else f'{vc_hp}_{vc_plat}'
+
+
+class Compiler(base.Compiler):
+ """Concrete class that implements an interface to Microsoft Visual C++,
+ as defined by the CCompiler abstract class."""
+
+ compiler_type = 'msvc'
+
+ # Just set this so CCompiler's constructor doesn't barf. We currently
+ # don't use the 'set_executables()' bureaucracy provided by CCompiler,
+ # as it really isn't necessary for this sort of single-compiler class.
+ # Would be nice to have a consistent interface with UnixCCompiler,
+ # though, so it's worth thinking about.
+ executables = {}
+
+ # Private class data (need to distinguish C from C++ source for compiler)
+ _c_extensions = ['.c']
+ _cpp_extensions = ['.cc', '.cpp', '.cxx']
+ _rc_extensions = ['.rc']
+ _mc_extensions = ['.mc']
+
+ # Needed for the filename generation methods provided by the
+ # base class, CCompiler.
+ src_extensions = _c_extensions + _cpp_extensions + _rc_extensions + _mc_extensions
+ res_extension = '.res'
+ obj_extension = '.obj'
+ static_lib_extension = '.lib'
+ shared_lib_extension = '.dll'
+ static_lib_format = shared_lib_format = '%s%s'
+ exe_extension = '.exe'
+
+ def __init__(self, verbose=False, dry_run=False, force=False) -> None:
+ super().__init__(verbose, dry_run, force)
+ # target platform (.plat_name is consistent with 'bdist')
+ self.plat_name = None
+ self.initialized = False
+
+ @classmethod
+ def _configure(cls, vc_env):
+ """
+ Set class-level include/lib dirs.
+ """
+ cls.include_dirs = cls._parse_path(vc_env.get('include', ''))
+ cls.library_dirs = cls._parse_path(vc_env.get('lib', ''))
+
+ @staticmethod
+ def _parse_path(val):
+ return [dir.rstrip(os.sep) for dir in val.split(os.pathsep) if dir]
+
+ def initialize(self, plat_name: str | None = None) -> None:
+ # multi-init means we would need to check platform same each time...
+ assert not self.initialized, "don't init multiple times"
+ if plat_name is None:
+ plat_name = get_platform()
+ # sanity check for platforms to prevent obscure errors later.
+ if plat_name not in _vcvars_names:
+ raise DistutilsPlatformError(
+ f"--plat-name must be one of {tuple(_vcvars_names)}"
+ )
+
+ plat_spec = _get_vcvars_spec(get_host_platform(), plat_name)
+
+ vc_env = _get_vc_env(plat_spec)
+ if not vc_env:
+ raise DistutilsPlatformError(
+ "Unable to find a compatible Visual Studio installation."
+ )
+ self._configure(vc_env)
+
+ self._paths = vc_env.get('path', '')
+ paths = self._paths.split(os.pathsep)
+ self.cc = _find_exe("cl.exe", paths)
+ self.linker = _find_exe("link.exe", paths)
+ self.lib = _find_exe("lib.exe", paths)
+ self.rc = _find_exe("rc.exe", paths) # resource compiler
+ self.mc = _find_exe("mc.exe", paths) # message compiler
+ self.mt = _find_exe("mt.exe", paths) # message compiler
+
+ self.preprocess_options = None
+ # bpo-38597: Always compile with dynamic linking
+ # Future releases of Python 3.x will include all past
+ # versions of vcruntime*.dll for compatibility.
+ self.compile_options = ['/nologo', '/O2', '/W3', '/GL', '/DNDEBUG', '/MD']
+
+ self.compile_options_debug = [
+ '/nologo',
+ '/Od',
+ '/MDd',
+ '/Zi',
+ '/W3',
+ '/D_DEBUG',
+ ]
+
+ ldflags = ['/nologo', '/INCREMENTAL:NO', '/LTCG']
+
+ ldflags_debug = ['/nologo', '/INCREMENTAL:NO', '/LTCG', '/DEBUG:FULL']
+
+ self.ldflags_exe = [*ldflags, '/MANIFEST:EMBED,ID=1']
+ self.ldflags_exe_debug = [*ldflags_debug, '/MANIFEST:EMBED,ID=1']
+ self.ldflags_shared = [
+ *ldflags,
+ '/DLL',
+ '/MANIFEST:EMBED,ID=2',
+ '/MANIFESTUAC:NO',
+ ]
+ self.ldflags_shared_debug = [
+ *ldflags_debug,
+ '/DLL',
+ '/MANIFEST:EMBED,ID=2',
+ '/MANIFESTUAC:NO',
+ ]
+ self.ldflags_static = [*ldflags]
+ self.ldflags_static_debug = [*ldflags_debug]
+
+ self._ldflags = {
+ (base.Compiler.EXECUTABLE, None): self.ldflags_exe,
+ (base.Compiler.EXECUTABLE, False): self.ldflags_exe,
+ (base.Compiler.EXECUTABLE, True): self.ldflags_exe_debug,
+ (base.Compiler.SHARED_OBJECT, None): self.ldflags_shared,
+ (base.Compiler.SHARED_OBJECT, False): self.ldflags_shared,
+ (base.Compiler.SHARED_OBJECT, True): self.ldflags_shared_debug,
+ (base.Compiler.SHARED_LIBRARY, None): self.ldflags_static,
+ (base.Compiler.SHARED_LIBRARY, False): self.ldflags_static,
+ (base.Compiler.SHARED_LIBRARY, True): self.ldflags_static_debug,
+ }
+
+ self.initialized = True
+
+ # -- Worker methods ------------------------------------------------
+
+ @property
+ def out_extensions(self) -> dict[str, str]:
+ return {
+ **super().out_extensions,
+ **{
+ ext: self.res_extension
+ for ext in self._rc_extensions + self._mc_extensions
+ },
+ }
+
+ def compile( # noqa: C901
+ self,
+ sources,
+ output_dir=None,
+ macros=None,
+ include_dirs=None,
+ debug=False,
+ extra_preargs=None,
+ extra_postargs=None,
+ depends=None,
+ ):
+ if not self.initialized:
+ self.initialize()
+ compile_info = self._setup_compile(
+ output_dir, macros, include_dirs, sources, depends, extra_postargs
+ )
+ macros, objects, extra_postargs, pp_opts, build = compile_info
+
+ compile_opts = extra_preargs or []
+ compile_opts.append('/c')
+ if debug:
+ compile_opts.extend(self.compile_options_debug)
+ else:
+ compile_opts.extend(self.compile_options)
+
+ add_cpp_opts = False
+
+ for obj in objects:
+ try:
+ src, ext = build[obj]
+ except KeyError:
+ continue
+ if debug:
+ # pass the full pathname to MSVC in debug mode,
+ # this allows the debugger to find the source file
+ # without asking the user to browse for it
+ src = os.path.abspath(src)
+
+ if ext in self._c_extensions:
+ input_opt = f"/Tc{src}"
+ elif ext in self._cpp_extensions:
+ input_opt = f"/Tp{src}"
+ add_cpp_opts = True
+ elif ext in self._rc_extensions:
+ # compile .RC to .RES file
+ input_opt = src
+ output_opt = "/fo" + obj
+ try:
+ self.spawn([self.rc] + pp_opts + [output_opt, input_opt])
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
+ continue
+ elif ext in self._mc_extensions:
+ # Compile .MC to .RC file to .RES file.
+ # * '-h dir' specifies the directory for the
+ # generated include file
+ # * '-r dir' specifies the target directory of the
+ # generated RC file and the binary message resource
+ # it includes
+ #
+ # For now (since there are no options to change this),
+ # we use the source-directory for the include file and
+ # the build directory for the RC file and message
+ # resources. This works at least for win32all.
+ h_dir = os.path.dirname(src)
+ rc_dir = os.path.dirname(obj)
+ try:
+ # first compile .MC to .RC and .H file
+ self.spawn([self.mc, '-h', h_dir, '-r', rc_dir, src])
+ base, _ = os.path.splitext(os.path.basename(src))
+ rc_file = os.path.join(rc_dir, base + '.rc')
+ # then compile .RC to .RES file
+ self.spawn([self.rc, "/fo" + obj, rc_file])
+
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
+ continue
+ else:
+ # how to handle this file?
+ raise CompileError(f"Don't know how to compile {src} to {obj}")
+
+ args = [self.cc] + compile_opts + pp_opts
+ if add_cpp_opts:
+ args.append('/EHsc')
+ args.extend((input_opt, "/Fo" + obj))
+ args.extend(extra_postargs)
+
+ try:
+ self.spawn(args)
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
+
+ return objects
+
+ def create_static_lib(
+ self,
+ objects: list[str] | tuple[str, ...],
+ output_libname: str,
+ output_dir: str | None = None,
+ debug: bool = False,
+ target_lang: str | None = None,
+ ) -> None:
+ if not self.initialized:
+ self.initialize()
+ objects, output_dir = self._fix_object_args(objects, output_dir)
+ output_filename = self.library_filename(output_libname, output_dir=output_dir)
+
+ if self._need_link(objects, output_filename):
+ lib_args = objects + ['/OUT:' + output_filename]
+ if debug:
+ pass # XXX what goes here?
+ try:
+ log.debug('Executing "%s" %s', self.lib, ' '.join(lib_args))
+ self.spawn([self.lib] + lib_args)
+ except DistutilsExecError as msg:
+ raise LibError(msg)
+ else:
+ log.debug("skipping %s (up-to-date)", output_filename)
+
+ def link(
+ self,
+ target_desc: str,
+ objects: list[str] | tuple[str, ...],
+ output_filename: str,
+ output_dir: str | None = None,
+ libraries: list[str] | tuple[str, ...] | None = None,
+ library_dirs: list[str] | tuple[str, ...] | None = None,
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
+ export_symbols: Iterable[str] | None = None,
+ debug: bool = False,
+ extra_preargs: list[str] | None = None,
+ extra_postargs: Iterable[str] | None = None,
+ build_temp: str | os.PathLike[str] | None = None,
+ target_lang: str | None = None,
+ ) -> None:
+ if not self.initialized:
+ self.initialize()
+ objects, output_dir = self._fix_object_args(objects, output_dir)
+ fixed_args = self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
+ libraries, library_dirs, runtime_library_dirs = fixed_args
+
+ if runtime_library_dirs:
+ self.warn(
+ "I don't know what to do with 'runtime_library_dirs': "
+ + str(runtime_library_dirs)
+ )
+
+ lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs, libraries)
+ if output_dir is not None:
+ output_filename = os.path.join(output_dir, output_filename)
+
+ if self._need_link(objects, output_filename):
+ ldflags = self._ldflags[target_desc, debug]
+
+ export_opts = ["/EXPORT:" + sym for sym in (export_symbols or [])]
+
+ ld_args = (
+ ldflags + lib_opts + export_opts + objects + ['/OUT:' + output_filename]
+ )
+
+ # The MSVC linker generates .lib and .exp files, which cannot be
+ # suppressed by any linker switches. The .lib files may even be
+ # needed! Make sure they are generated in the temporary build
+ # directory. Since they have different names for debug and release
+ # builds, they can go into the same directory.
+ build_temp = os.path.dirname(objects[0])
+ if export_symbols is not None:
+ (dll_name, dll_ext) = os.path.splitext(
+ os.path.basename(output_filename)
+ )
+ implib_file = os.path.join(build_temp, self.library_filename(dll_name))
+ ld_args.append('/IMPLIB:' + implib_file)
+
+ if extra_preargs:
+ ld_args[:0] = extra_preargs
+ if extra_postargs:
+ ld_args.extend(extra_postargs)
+
+ output_dir = os.path.dirname(os.path.abspath(output_filename))
+ self.mkpath(output_dir)
+ try:
+ log.debug('Executing "%s" %s', self.linker, ' '.join(ld_args))
+ self.spawn([self.linker] + ld_args)
+ except DistutilsExecError as msg:
+ raise LinkError(msg)
+ else:
+ log.debug("skipping %s (up-to-date)", output_filename)
+
+ def spawn(self, cmd):
+ env = dict(os.environ, PATH=self._paths)
+ with self._fallback_spawn(cmd, env) as fallback:
+ return super().spawn(cmd, env=env)
+ return fallback.value
+
+ @contextlib.contextmanager
+ def _fallback_spawn(self, cmd, env):
+ """
+ Discovered in pypa/distutils#15, some tools monkeypatch the compiler,
+ so the 'env' kwarg causes a TypeError. Detect this condition and
+ restore the legacy, unsafe behavior.
+ """
+ bag = type('Bag', (), {})()
+ try:
+ yield bag
+ except TypeError as exc:
+ if "unexpected keyword argument 'env'" not in str(exc):
+ raise
+ else:
+ return
+ warnings.warn("Fallback spawn triggered. Please update distutils monkeypatch.")
+ with mock.patch.dict('os.environ', env):
+ bag.value = super().spawn(cmd)
+
+ # -- Miscellaneous methods -----------------------------------------
+ # These are all used by the 'gen_lib_options() function, in
+ # ccompiler.py.
+
+ def library_dir_option(self, dir):
+ return "/LIBPATH:" + dir
+
+ def runtime_library_dir_option(self, dir):
+ raise DistutilsPlatformError(
+ "don't know how to set runtime library search path for MSVC"
+ )
+
+ def library_option(self, lib):
+ return self.library_filename(lib)
+
+ def find_library_file(self, dirs, lib, debug=False):
+ # Prefer a debugging library if found (and requested), but deal
+ # with it if we don't have one.
+ if debug:
+ try_names = [lib + "_d", lib]
+ else:
+ try_names = [lib]
+ for dir in dirs:
+ for name in try_names:
+ libfile = os.path.join(dir, self.library_filename(name))
+ if os.path.isfile(libfile):
+ return libfile
+ else:
+ # Oops, didn't find it in *any* of 'dirs'
+ return None
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_base.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_base.py
new file mode 100644
index 0000000000000000000000000000000000000000..a762e2b649d7977ef42f4d35854eab26bd54e9e7
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_base.py
@@ -0,0 +1,83 @@
+import platform
+import sysconfig
+import textwrap
+
+import pytest
+
+from .. import base
+
+pytestmark = pytest.mark.usefixtures('suppress_path_mangle')
+
+
+@pytest.fixture
+def c_file(tmp_path):
+ c_file = tmp_path / 'foo.c'
+ gen_headers = ('Python.h',)
+ is_windows = platform.system() == "Windows"
+ plat_headers = ('windows.h',) * is_windows
+ all_headers = gen_headers + plat_headers
+ headers = '\n'.join(f'#include <{header}>\n' for header in all_headers)
+ payload = (
+ textwrap.dedent(
+ """
+ #headers
+ void PyInit_foo(void) {}
+ """
+ )
+ .lstrip()
+ .replace('#headers', headers)
+ )
+ c_file.write_text(payload, encoding='utf-8')
+ return c_file
+
+
+def test_set_include_dirs(c_file):
+ """
+ Extensions should build even if set_include_dirs is invoked.
+ In particular, compiler-specific paths should not be overridden.
+ """
+ compiler = base.new_compiler()
+ python = sysconfig.get_paths()['include']
+ compiler.set_include_dirs([python])
+ compiler.compile([c_file])
+
+ # do it again, setting include dirs after any initialization
+ compiler.set_include_dirs([python])
+ compiler.compile([c_file])
+
+
+def test_has_function_prototype():
+ # Issue https://github.com/pypa/setuptools/issues/3648
+ # Test prototype-generating behavior.
+
+ compiler = base.new_compiler()
+
+ # Every C implementation should have these.
+ assert compiler.has_function('abort')
+ assert compiler.has_function('exit')
+ with pytest.deprecated_call(match='includes is deprecated'):
+ # abort() is a valid expression with the prototype.
+ assert compiler.has_function('abort', includes=['stdlib.h'])
+ with pytest.deprecated_call(match='includes is deprecated'):
+ # But exit() is not valid with the actual prototype in scope.
+ assert not compiler.has_function('exit', includes=['stdlib.h'])
+ # And setuptools_does_not_exist is not declared or defined at all.
+ assert not compiler.has_function('setuptools_does_not_exist')
+ with pytest.deprecated_call(match='includes is deprecated'):
+ assert not compiler.has_function(
+ 'setuptools_does_not_exist', includes=['stdio.h']
+ )
+
+
+def test_include_dirs_after_multiple_compile_calls(c_file):
+ """
+ Calling compile multiple times should not change the include dirs
+ (regression test for setuptools issue #3591).
+ """
+ compiler = base.new_compiler()
+ python = sysconfig.get_paths()['include']
+ compiler.set_include_dirs([python])
+ compiler.compile([c_file])
+ assert compiler.include_dirs == [python]
+ compiler.compile([c_file])
+ assert compiler.include_dirs == [python]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py
new file mode 100644
index 0000000000000000000000000000000000000000..9adf6b8ebf165b4fe92a52d8a14aed21aebba539
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_cygwin.py
@@ -0,0 +1,76 @@
+"""Tests for distutils.cygwinccompiler."""
+
+import os
+import sys
+from distutils import sysconfig
+from distutils.tests import support
+
+import pytest
+
+from .. import cygwin
+
+
+@pytest.fixture(autouse=True)
+def stuff(request, monkeypatch, distutils_managed_tempdir):
+ self = request.instance
+ self.python_h = os.path.join(self.mkdtemp(), 'python.h')
+ monkeypatch.setattr(sysconfig, 'get_config_h_filename', self._get_config_h_filename)
+ monkeypatch.setattr(sys, 'version', sys.version)
+
+
+class TestCygwinCCompiler(support.TempdirManager):
+ def _get_config_h_filename(self):
+ return self.python_h
+
+ @pytest.mark.skipif('sys.platform != "cygwin"')
+ @pytest.mark.skipif('not os.path.exists("/usr/lib/libbash.dll.a")')
+ def test_find_library_file(self):
+ from distutils.cygwinccompiler import CygwinCCompiler
+
+ compiler = CygwinCCompiler()
+ link_name = "bash"
+ linkable_file = compiler.find_library_file(["/usr/lib"], link_name)
+ assert linkable_file is not None
+ assert os.path.exists(linkable_file)
+ assert linkable_file == f"/usr/lib/lib{link_name:s}.dll.a"
+
+ @pytest.mark.skipif('sys.platform != "cygwin"')
+ def test_runtime_library_dir_option(self):
+ from distutils.cygwinccompiler import CygwinCCompiler
+
+ compiler = CygwinCCompiler()
+ assert compiler.runtime_library_dir_option('/foo') == []
+
+ def test_check_config_h(self):
+ # check_config_h looks for "GCC" in sys.version first
+ # returns CONFIG_H_OK if found
+ sys.version = (
+ '2.6.1 (r261:67515, Dec 6 2008, 16:42:21) \n[GCC '
+ '4.0.1 (Apple Computer, Inc. build 5370)]'
+ )
+
+ assert cygwin.check_config_h()[0] == cygwin.CONFIG_H_OK
+
+ # then it tries to see if it can find "__GNUC__" in pyconfig.h
+ sys.version = 'something without the *CC word'
+
+ # if the file doesn't exist it returns CONFIG_H_UNCERTAIN
+ assert cygwin.check_config_h()[0] == cygwin.CONFIG_H_UNCERTAIN
+
+ # if it exists but does not contain __GNUC__, it returns CONFIG_H_NOTOK
+ self.write_file(self.python_h, 'xxx')
+ assert cygwin.check_config_h()[0] == cygwin.CONFIG_H_NOTOK
+
+ # and CONFIG_H_OK if __GNUC__ is found
+ self.write_file(self.python_h, 'xxx __GNUC__ xxx')
+ assert cygwin.check_config_h()[0] == cygwin.CONFIG_H_OK
+
+ def test_get_msvcr(self):
+ assert cygwin.get_msvcr() == []
+
+ @pytest.mark.skipif('sys.platform != "cygwin"')
+ def test_dll_libraries_not_none(self):
+ from distutils.cygwinccompiler import CygwinCCompiler
+
+ compiler = CygwinCCompiler()
+ assert compiler.dll_libraries is not None
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_mingw.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_mingw.py
new file mode 100644
index 0000000000000000000000000000000000000000..dc45687a917808edbf692ced18b0c99183d21e2d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_mingw.py
@@ -0,0 +1,48 @@
+from distutils import sysconfig
+from distutils.errors import DistutilsPlatformError
+from distutils.util import is_mingw, split_quoted
+
+import pytest
+
+from .. import cygwin, errors
+
+
+class TestMinGW32Compiler:
+ @pytest.mark.skipif(not is_mingw(), reason='not on mingw')
+ def test_compiler_type(self):
+ compiler = cygwin.MinGW32Compiler()
+ assert compiler.compiler_type == 'mingw32'
+
+ @pytest.mark.skipif(not is_mingw(), reason='not on mingw')
+ def test_set_executables(self, monkeypatch):
+ monkeypatch.setenv('CC', 'cc')
+ monkeypatch.setenv('CXX', 'c++')
+
+ compiler = cygwin.MinGW32Compiler()
+
+ assert compiler.compiler == split_quoted('cc -O -Wall')
+ assert compiler.compiler_so == split_quoted('cc -shared -O -Wall')
+ assert compiler.compiler_cxx == split_quoted('c++ -O -Wall')
+ assert compiler.linker_exe == split_quoted('cc')
+ assert compiler.linker_so == split_quoted('cc -shared')
+
+ @pytest.mark.skipif(not is_mingw(), reason='not on mingw')
+ def test_runtime_library_dir_option(self):
+ compiler = cygwin.MinGW32Compiler()
+ with pytest.raises(DistutilsPlatformError):
+ compiler.runtime_library_dir_option('/usr/lib')
+
+ @pytest.mark.skipif(not is_mingw(), reason='not on mingw')
+ def test_cygwincc_error(self, monkeypatch):
+ monkeypatch.setattr(cygwin, 'is_cygwincc', lambda _: True)
+
+ with pytest.raises(errors.Error):
+ cygwin.MinGW32Compiler()
+
+ @pytest.mark.skipif('sys.platform == "cygwin"')
+ def test_customize_compiler_with_msvc_python(self):
+ # In case we have an MSVC Python build, but still want to use
+ # MinGW32Compiler, then customize_compiler() shouldn't fail at least.
+ # https://github.com/pypa/setuptools/issues/4456
+ compiler = cygwin.MinGW32Compiler()
+ sysconfig.customize_compiler(compiler)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py
new file mode 100644
index 0000000000000000000000000000000000000000..eca831996adcb07f05560581fe4285cdb29392d3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_msvc.py
@@ -0,0 +1,136 @@
+import os
+import sys
+import sysconfig
+import threading
+import unittest.mock as mock
+from distutils.errors import DistutilsPlatformError
+from distutils.tests import support
+from distutils.util import get_platform
+
+import pytest
+
+from .. import msvc
+
+needs_winreg = pytest.mark.skipif('not hasattr(msvc, "winreg")')
+
+
+class Testmsvccompiler(support.TempdirManager):
+ def test_no_compiler(self, monkeypatch):
+ # makes sure query_vcvarsall raises
+ # a DistutilsPlatformError if the compiler
+ # is not found
+ def _find_vcvarsall(plat_spec):
+ return None, None
+
+ monkeypatch.setattr(msvc, '_find_vcvarsall', _find_vcvarsall)
+
+ with pytest.raises(DistutilsPlatformError):
+ msvc._get_vc_env(
+ 'wont find this version',
+ )
+
+ @pytest.mark.skipif(
+ not sysconfig.get_platform().startswith("win"),
+ reason="Only run test for non-mingw Windows platforms",
+ )
+ @pytest.mark.parametrize(
+ "plat_name, expected",
+ [
+ ("win-arm64", "win-arm64"),
+ ("win-amd64", "win-amd64"),
+ (None, get_platform()),
+ ],
+ )
+ def test_cross_platform_compilation_paths(self, monkeypatch, plat_name, expected):
+ """
+ Ensure a specified target platform is passed to _get_vcvars_spec.
+ """
+ compiler = msvc.Compiler()
+
+ def _get_vcvars_spec(host_platform, platform):
+ assert platform == expected
+
+ monkeypatch.setattr(msvc, '_get_vcvars_spec', _get_vcvars_spec)
+ compiler.initialize(plat_name)
+
+ @needs_winreg
+ def test_get_vc_env_unicode(self):
+ test_var = 'ṰḖṤṪ┅ṼẨṜ'
+ test_value = '₃⁴₅'
+
+ # Ensure we don't early exit from _get_vc_env
+ old_distutils_use_sdk = os.environ.pop('DISTUTILS_USE_SDK', None)
+ os.environ[test_var] = test_value
+ try:
+ env = msvc._get_vc_env('x86')
+ assert test_var.lower() in env
+ assert test_value == env[test_var.lower()]
+ finally:
+ os.environ.pop(test_var)
+ if old_distutils_use_sdk:
+ os.environ['DISTUTILS_USE_SDK'] = old_distutils_use_sdk
+
+ @needs_winreg
+ @pytest.mark.parametrize('ver', (2015, 2017))
+ def test_get_vc(self, ver):
+ # This function cannot be mocked, so pass if VC is found
+ # and skip otherwise.
+ lookup = getattr(msvc, f'_find_vc{ver}')
+ expected_version = {2015: 14, 2017: 15}[ver]
+ version, path = lookup()
+ if not version:
+ pytest.skip(f"VS {ver} is not installed")
+ assert version >= expected_version
+ assert os.path.isdir(path)
+
+
+class CheckThread(threading.Thread):
+ exc_info = None
+
+ def run(self):
+ try:
+ super().run()
+ except Exception:
+ self.exc_info = sys.exc_info()
+
+ def __bool__(self):
+ return not self.exc_info
+
+
+class TestSpawn:
+ def test_concurrent_safe(self):
+ """
+ Concurrent calls to spawn should have consistent results.
+ """
+ compiler = msvc.Compiler()
+ compiler._paths = "expected"
+ inner_cmd = 'import os; assert os.environ["PATH"] == "expected"'
+ command = [sys.executable, '-c', inner_cmd]
+
+ threads = [
+ CheckThread(target=compiler.spawn, args=[command]) for n in range(100)
+ ]
+ for thread in threads:
+ thread.start()
+ for thread in threads:
+ thread.join()
+ assert all(threads)
+
+ def test_concurrent_safe_fallback(self):
+ """
+ If CCompiler.spawn has been monkey-patched without support
+ for an env, it should still execute.
+ """
+ from distutils import ccompiler
+
+ compiler = msvc.Compiler()
+ compiler._paths = "expected"
+
+ def CCompiler_spawn(self, cmd):
+ "A spawn without an env argument."
+ assert os.environ["PATH"] == "expected"
+
+ with mock.patch.object(ccompiler.CCompiler, 'spawn', CCompiler_spawn):
+ compiler.spawn(["n/a"])
+
+ assert os.environ.get("PATH") != "expected"
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_unix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_unix.py
new file mode 100644
index 0000000000000000000000000000000000000000..35b6b0e050c654bd9eff711ec3b94bea9adff2af
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/tests/test_unix.py
@@ -0,0 +1,413 @@
+"""Tests for distutils.unixccompiler."""
+
+import os
+import sys
+import unittest.mock as mock
+from distutils import sysconfig
+from distutils.compat import consolidate_linker_args
+from distutils.errors import DistutilsPlatformError
+from distutils.tests import support
+from distutils.tests.compat.py39 import EnvironmentVarGuard
+from distutils.util import _clear_cached_macosx_ver
+
+import pytest
+
+from .. import unix
+
+
+@pytest.fixture(autouse=True)
+def save_values(monkeypatch):
+ monkeypatch.setattr(sys, 'platform', sys.platform)
+ monkeypatch.setattr(sysconfig, 'get_config_var', sysconfig.get_config_var)
+ monkeypatch.setattr(sysconfig, 'get_config_vars', sysconfig.get_config_vars)
+
+
+@pytest.fixture(autouse=True)
+def compiler_wrapper(request):
+ class CompilerWrapper(unix.Compiler):
+ def rpath_foo(self):
+ return self.runtime_library_dir_option('/foo')
+
+ request.instance.cc = CompilerWrapper()
+
+
+class TestUnixCCompiler(support.TempdirManager):
+ @pytest.mark.skipif('platform.system == "Windows"')
+ def test_runtime_libdir_option(self): # noqa: C901
+ # Issue #5900; GitHub Issue #37
+ #
+ # Ensure RUNPATH is added to extension modules with RPATH if
+ # GNU ld is used
+
+ # darwin
+ sys.platform = 'darwin'
+ darwin_ver_var = 'MACOSX_DEPLOYMENT_TARGET'
+ darwin_rpath_flag = '-Wl,-rpath,/foo'
+ darwin_lib_flag = '-L/foo'
+
+ # (macOS version from syscfg, macOS version from env var) -> flag
+ # Version value of None generates two tests: as None and as empty string
+ # Expected flag value of None means an mismatch exception is expected
+ darwin_test_cases = [
+ ((None, None), darwin_lib_flag),
+ ((None, '11'), darwin_rpath_flag),
+ (('10', None), darwin_lib_flag),
+ (('10.3', None), darwin_lib_flag),
+ (('10.3.1', None), darwin_lib_flag),
+ (('10.5', None), darwin_rpath_flag),
+ (('10.5.1', None), darwin_rpath_flag),
+ (('10.3', '10.3'), darwin_lib_flag),
+ (('10.3', '10.5'), darwin_rpath_flag),
+ (('10.5', '10.3'), darwin_lib_flag),
+ (('10.5', '11'), darwin_rpath_flag),
+ (('10.4', '10'), None),
+ ]
+
+ def make_darwin_gcv(syscfg_macosx_ver):
+ def gcv(var):
+ if var == darwin_ver_var:
+ return syscfg_macosx_ver
+ return "xxx"
+
+ return gcv
+
+ def do_darwin_test(syscfg_macosx_ver, env_macosx_ver, expected_flag):
+ env = os.environ
+ msg = f"macOS version = (sysconfig={syscfg_macosx_ver!r}, env={env_macosx_ver!r})"
+
+ # Save
+ old_gcv = sysconfig.get_config_var
+ old_env_macosx_ver = env.get(darwin_ver_var)
+
+ # Setup environment
+ _clear_cached_macosx_ver()
+ sysconfig.get_config_var = make_darwin_gcv(syscfg_macosx_ver)
+ if env_macosx_ver is not None:
+ env[darwin_ver_var] = env_macosx_ver
+ elif darwin_ver_var in env:
+ env.pop(darwin_ver_var)
+
+ # Run the test
+ if expected_flag is not None:
+ assert self.cc.rpath_foo() == expected_flag, msg
+ else:
+ with pytest.raises(
+ DistutilsPlatformError, match=darwin_ver_var + r' mismatch'
+ ):
+ self.cc.rpath_foo()
+
+ # Restore
+ if old_env_macosx_ver is not None:
+ env[darwin_ver_var] = old_env_macosx_ver
+ elif darwin_ver_var in env:
+ env.pop(darwin_ver_var)
+ sysconfig.get_config_var = old_gcv
+ _clear_cached_macosx_ver()
+
+ for macosx_vers, expected_flag in darwin_test_cases:
+ syscfg_macosx_ver, env_macosx_ver = macosx_vers
+ do_darwin_test(syscfg_macosx_ver, env_macosx_ver, expected_flag)
+ # Bonus test cases with None interpreted as empty string
+ if syscfg_macosx_ver is None:
+ do_darwin_test("", env_macosx_ver, expected_flag)
+ if env_macosx_ver is None:
+ do_darwin_test(syscfg_macosx_ver, "", expected_flag)
+ if syscfg_macosx_ver is None and env_macosx_ver is None:
+ do_darwin_test("", "", expected_flag)
+
+ old_gcv = sysconfig.get_config_var
+
+ # hp-ux
+ sys.platform = 'hp-ux'
+
+ def gcv(v):
+ return 'xxx'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == ['+s', '-L/foo']
+
+ def gcv(v):
+ return 'gcc'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == ['-Wl,+s', '-L/foo']
+
+ def gcv(v):
+ return 'g++'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == ['-Wl,+s', '-L/foo']
+
+ sysconfig.get_config_var = old_gcv
+
+ # GCC GNULD
+ sys.platform = 'bar'
+
+ def gcv(v):
+ if v == 'CC':
+ return 'gcc'
+ elif v == 'GNULD':
+ return 'yes'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == consolidate_linker_args([
+ '-Wl,--enable-new-dtags',
+ '-Wl,-rpath,/foo',
+ ])
+
+ def gcv(v):
+ if v == 'CC':
+ return 'gcc -pthread -B /bar'
+ elif v == 'GNULD':
+ return 'yes'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == consolidate_linker_args([
+ '-Wl,--enable-new-dtags',
+ '-Wl,-rpath,/foo',
+ ])
+
+ # GCC non-GNULD
+ sys.platform = 'bar'
+
+ def gcv(v):
+ if v == 'CC':
+ return 'gcc'
+ elif v == 'GNULD':
+ return 'no'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == '-Wl,-R/foo'
+
+ # GCC GNULD with fully qualified configuration prefix
+ # see #7617
+ sys.platform = 'bar'
+
+ def gcv(v):
+ if v == 'CC':
+ return 'x86_64-pc-linux-gnu-gcc-4.4.2'
+ elif v == 'GNULD':
+ return 'yes'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == consolidate_linker_args([
+ '-Wl,--enable-new-dtags',
+ '-Wl,-rpath,/foo',
+ ])
+
+ # non-GCC GNULD
+ sys.platform = 'bar'
+
+ def gcv(v):
+ if v == 'CC':
+ return 'cc'
+ elif v == 'GNULD':
+ return 'yes'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == consolidate_linker_args([
+ '-Wl,--enable-new-dtags',
+ '-Wl,-rpath,/foo',
+ ])
+
+ # non-GCC non-GNULD
+ sys.platform = 'bar'
+
+ def gcv(v):
+ if v == 'CC':
+ return 'cc'
+ elif v == 'GNULD':
+ return 'no'
+
+ sysconfig.get_config_var = gcv
+ assert self.cc.rpath_foo() == '-Wl,-R/foo'
+
+ @pytest.mark.skipif('platform.system == "Windows"')
+ def test_cc_overrides_ldshared(self):
+ # Issue #18080:
+ # ensure that setting CC env variable also changes default linker
+ def gcv(v):
+ if v == 'LDSHARED':
+ return 'gcc-4.2 -bundle -undefined dynamic_lookup '
+ return 'gcc-4.2'
+
+ def gcvs(*args, _orig=sysconfig.get_config_vars):
+ if args:
+ return list(map(sysconfig.get_config_var, args))
+ return _orig()
+
+ sysconfig.get_config_var = gcv
+ sysconfig.get_config_vars = gcvs
+ with EnvironmentVarGuard() as env:
+ env['CC'] = 'my_cc'
+ del env['LDSHARED']
+ sysconfig.customize_compiler(self.cc)
+ assert self.cc.linker_so[0] == 'my_cc'
+
+ @pytest.mark.skipif('platform.system == "Windows"')
+ def test_cxx_commands_used_are_correct(self):
+ def gcv(v):
+ if v == 'LDSHARED':
+ return 'ccache gcc-4.2 -bundle -undefined dynamic_lookup'
+ elif v == 'LDCXXSHARED':
+ return 'ccache g++-4.2 -bundle -undefined dynamic_lookup'
+ elif v == 'CXX':
+ return 'ccache g++-4.2'
+ elif v == 'CC':
+ return 'ccache gcc-4.2'
+ return ''
+
+ def gcvs(*args, _orig=sysconfig.get_config_vars):
+ if args:
+ return list(map(sysconfig.get_config_var, args))
+ return _orig() # pragma: no cover
+
+ sysconfig.get_config_var = gcv
+ sysconfig.get_config_vars = gcvs
+ with (
+ mock.patch.object(self.cc, 'spawn', return_value=None) as mock_spawn,
+ mock.patch.object(self.cc, '_need_link', return_value=True),
+ mock.patch.object(self.cc, 'mkpath', return_value=None),
+ EnvironmentVarGuard() as env,
+ ):
+ # override environment overrides in case they're specified by CI
+ del env['CXX']
+ del env['LDCXXSHARED']
+
+ sysconfig.customize_compiler(self.cc)
+ assert self.cc.linker_so_cxx[0:2] == ['ccache', 'g++-4.2']
+ assert self.cc.linker_exe_cxx[0:2] == ['ccache', 'g++-4.2']
+ self.cc.link(None, [], 'a.out', target_lang='c++')
+ call_args = mock_spawn.call_args[0][0]
+ expected = ['ccache', 'g++-4.2', '-bundle', '-undefined', 'dynamic_lookup']
+ assert call_args[:5] == expected
+
+ self.cc.link_executable([], 'a.out', target_lang='c++')
+ call_args = mock_spawn.call_args[0][0]
+ expected = ['ccache', 'g++-4.2', '-o', self.cc.executable_filename('a.out')]
+ assert call_args[:4] == expected
+
+ env['LDCXXSHARED'] = 'wrapper g++-4.2 -bundle -undefined dynamic_lookup'
+ env['CXX'] = 'wrapper g++-4.2'
+ sysconfig.customize_compiler(self.cc)
+ assert self.cc.linker_so_cxx[0:2] == ['wrapper', 'g++-4.2']
+ assert self.cc.linker_exe_cxx[0:2] == ['wrapper', 'g++-4.2']
+ self.cc.link(None, [], 'a.out', target_lang='c++')
+ call_args = mock_spawn.call_args[0][0]
+ expected = ['wrapper', 'g++-4.2', '-bundle', '-undefined', 'dynamic_lookup']
+ assert call_args[:5] == expected
+
+ self.cc.link_executable([], 'a.out', target_lang='c++')
+ call_args = mock_spawn.call_args[0][0]
+ expected = [
+ 'wrapper',
+ 'g++-4.2',
+ '-o',
+ self.cc.executable_filename('a.out'),
+ ]
+ assert call_args[:4] == expected
+
+ @pytest.mark.skipif('platform.system == "Windows"')
+ @pytest.mark.usefixtures('disable_macos_customization')
+ def test_cc_overrides_ldshared_for_cxx_correctly(self):
+ """
+ Ensure that setting CC env variable also changes default linker
+ correctly when building C++ extensions.
+
+ pypa/distutils#126
+ """
+
+ def gcv(v):
+ if v == 'LDSHARED':
+ return 'gcc-4.2 -bundle -undefined dynamic_lookup '
+ elif v == 'LDCXXSHARED':
+ return 'g++-4.2 -bundle -undefined dynamic_lookup '
+ elif v == 'CXX':
+ return 'g++-4.2'
+ elif v == 'CC':
+ return 'gcc-4.2'
+ return ''
+
+ def gcvs(*args, _orig=sysconfig.get_config_vars):
+ if args:
+ return list(map(sysconfig.get_config_var, args))
+ return _orig()
+
+ sysconfig.get_config_var = gcv
+ sysconfig.get_config_vars = gcvs
+ with (
+ mock.patch.object(self.cc, 'spawn', return_value=None) as mock_spawn,
+ mock.patch.object(self.cc, '_need_link', return_value=True),
+ mock.patch.object(self.cc, 'mkpath', return_value=None),
+ EnvironmentVarGuard() as env,
+ ):
+ env['CC'] = 'ccache my_cc'
+ env['CXX'] = 'my_cxx'
+ del env['LDSHARED']
+ sysconfig.customize_compiler(self.cc)
+ assert self.cc.linker_so[0:2] == ['ccache', 'my_cc']
+ self.cc.link(None, [], 'a.out', target_lang='c++')
+ call_args = mock_spawn.call_args[0][0]
+ expected = ['my_cxx', '-bundle', '-undefined', 'dynamic_lookup']
+ assert call_args[:4] == expected
+
+ @pytest.mark.skipif('platform.system == "Windows"')
+ def test_explicit_ldshared(self):
+ # Issue #18080:
+ # ensure that setting CC env variable does not change
+ # explicit LDSHARED setting for linker
+ def gcv(v):
+ if v == 'LDSHARED':
+ return 'gcc-4.2 -bundle -undefined dynamic_lookup '
+ return 'gcc-4.2'
+
+ def gcvs(*args, _orig=sysconfig.get_config_vars):
+ if args:
+ return list(map(sysconfig.get_config_var, args))
+ return _orig()
+
+ sysconfig.get_config_var = gcv
+ sysconfig.get_config_vars = gcvs
+ with EnvironmentVarGuard() as env:
+ env['CC'] = 'my_cc'
+ env['LDSHARED'] = 'my_ld -bundle -dynamic'
+ sysconfig.customize_compiler(self.cc)
+ assert self.cc.linker_so[0] == 'my_ld'
+
+ def test_has_function(self):
+ # Issue https://github.com/pypa/distutils/issues/64:
+ # ensure that setting output_dir does not raise
+ # FileNotFoundError: [Errno 2] No such file or directory: 'a.out'
+ self.cc.output_dir = 'scratch'
+ os.chdir(self.mkdtemp())
+ self.cc.has_function('abort')
+
+ def test_find_library_file(self, monkeypatch):
+ compiler = unix.Compiler()
+ compiler._library_root = lambda dir: dir
+ monkeypatch.setattr(os.path, 'exists', lambda d: 'existing' in d)
+
+ libname = 'libabc.dylib' if sys.platform != 'cygwin' else 'cygabc.dll'
+ dirs = ('/foo/bar/missing', '/foo/bar/existing')
+ assert (
+ compiler.find_library_file(dirs, 'abc').replace('\\', '/')
+ == f'/foo/bar/existing/{libname}'
+ )
+ assert (
+ compiler.find_library_file(reversed(dirs), 'abc').replace('\\', '/')
+ == f'/foo/bar/existing/{libname}'
+ )
+
+ monkeypatch.setattr(
+ os.path,
+ 'exists',
+ lambda d: 'existing' in d and '.a' in d and '.dll.a' not in d,
+ )
+ assert (
+ compiler.find_library_file(dirs, 'abc').replace('\\', '/')
+ == '/foo/bar/existing/libabc.a'
+ )
+ assert (
+ compiler.find_library_file(reversed(dirs), 'abc').replace('\\', '/')
+ == '/foo/bar/existing/libabc.a'
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/unix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/unix.py
new file mode 100644
index 0000000000000000000000000000000000000000..1231b32d20fc0524ea50f6a70d7e017211c69e9b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/unix.py
@@ -0,0 +1,422 @@
+"""distutils.unixccompiler
+
+Contains the UnixCCompiler class, a subclass of CCompiler that handles
+the "typical" Unix-style command-line C compiler:
+ * macros defined with -Dname[=value]
+ * macros undefined with -Uname
+ * include search directories specified with -Idir
+ * libraries specified with -lllib
+ * library search directories specified with -Ldir
+ * compile handled by 'cc' (or similar) executable with -c option:
+ compiles .c to .o
+ * link static library handled by 'ar' command (possibly with 'ranlib')
+ * link shared library handled by 'cc -shared'
+"""
+
+from __future__ import annotations
+
+import itertools
+import os
+import re
+import shlex
+import sys
+from collections.abc import Iterable
+
+from ... import sysconfig
+from ..._log import log
+from ..._macos_compat import compiler_fixup
+from ..._modified import newer
+from ...compat import consolidate_linker_args
+from ...errors import DistutilsExecError
+from . import base
+from .base import _Macro, gen_lib_options, gen_preprocess_options
+from .errors import (
+ CompileError,
+ LibError,
+ LinkError,
+)
+
+# XXX Things not currently handled:
+# * optimization/debug/warning flags; we just use whatever's in Python's
+# Makefile and live with it. Is this adequate? If not, we might
+# have to have a bunch of subclasses GNUCCompiler, SGICCompiler,
+# SunCCompiler, and I suspect down that road lies madness.
+# * even if we don't know a warning flag from an optimization flag,
+# we need some way for outsiders to feed preprocessor/compiler/linker
+# flags in to us -- eg. a sysadmin might want to mandate certain flags
+# via a site config file, or a user might want to set something for
+# compiling this module distribution only via the setup.py command
+# line, whatever. As long as these options come from something on the
+# current system, they can be as system-dependent as they like, and we
+# should just happily stuff them into the preprocessor/compiler/linker
+# options and carry on.
+
+
+def _split_env(cmd):
+ """
+ For macOS, split command into 'env' portion (if any)
+ and the rest of the linker command.
+
+ >>> _split_env(['a', 'b', 'c'])
+ ([], ['a', 'b', 'c'])
+ >>> _split_env(['/usr/bin/env', 'A=3', 'gcc'])
+ (['/usr/bin/env', 'A=3'], ['gcc'])
+ """
+ pivot = 0
+ if os.path.basename(cmd[0]) == "env":
+ pivot = 1
+ while '=' in cmd[pivot]:
+ pivot += 1
+ return cmd[:pivot], cmd[pivot:]
+
+
+def _split_aix(cmd):
+ """
+ AIX platforms prefix the compiler with the ld_so_aix
+ script, so split that from the linker command.
+
+ >>> _split_aix(['a', 'b', 'c'])
+ ([], ['a', 'b', 'c'])
+ >>> _split_aix(['/bin/foo/ld_so_aix', 'gcc'])
+ (['/bin/foo/ld_so_aix'], ['gcc'])
+ """
+ pivot = os.path.basename(cmd[0]) == 'ld_so_aix'
+ return cmd[:pivot], cmd[pivot:]
+
+
+def _linker_params(linker_cmd, compiler_cmd):
+ """
+ The linker command usually begins with the compiler
+ command (possibly multiple elements), followed by zero or more
+ params for shared library building.
+
+ If the LDSHARED env variable overrides the linker command,
+ however, the commands may not match.
+
+ Return the best guess of the linker parameters by stripping
+ the linker command. If the compiler command does not
+ match the linker command, assume the linker command is
+ just the first element.
+
+ >>> _linker_params('gcc foo bar'.split(), ['gcc'])
+ ['foo', 'bar']
+ >>> _linker_params('gcc foo bar'.split(), ['other'])
+ ['foo', 'bar']
+ >>> _linker_params('ccache gcc foo bar'.split(), 'ccache gcc'.split())
+ ['foo', 'bar']
+ >>> _linker_params(['gcc'], ['gcc'])
+ []
+ """
+ c_len = len(compiler_cmd)
+ pivot = c_len if linker_cmd[:c_len] == compiler_cmd else 1
+ return linker_cmd[pivot:]
+
+
+class Compiler(base.Compiler):
+ compiler_type = 'unix'
+
+ # These are used by CCompiler in two places: the constructor sets
+ # instance attributes 'preprocessor', 'compiler', etc. from them, and
+ # 'set_executable()' allows any of these to be set. The defaults here
+ # are pretty generic; they will probably have to be set by an outsider
+ # (eg. using information discovered by the sysconfig about building
+ # Python extensions).
+ executables = {
+ 'preprocessor': None,
+ 'compiler': ["cc"],
+ 'compiler_so': ["cc"],
+ 'compiler_cxx': ["c++"],
+ 'compiler_so_cxx': ["c++"],
+ 'linker_so': ["cc", "-shared"],
+ 'linker_so_cxx': ["c++", "-shared"],
+ 'linker_exe': ["cc"],
+ 'linker_exe_cxx': ["c++", "-shared"],
+ 'archiver': ["ar", "-cr"],
+ 'ranlib': None,
+ }
+
+ if sys.platform[:6] == "darwin":
+ executables['ranlib'] = ["ranlib"]
+
+ # Needed for the filename generation methods provided by the base
+ # class, CCompiler. NB. whoever instantiates/uses a particular
+ # UnixCCompiler instance should set 'shared_lib_ext' -- we set a
+ # reasonable common default here, but it's not necessarily used on all
+ # Unices!
+
+ src_extensions = [".c", ".C", ".cc", ".cxx", ".cpp", ".m"]
+ obj_extension = ".o"
+ static_lib_extension = ".a"
+ shared_lib_extension = ".so"
+ dylib_lib_extension = ".dylib"
+ xcode_stub_lib_extension = ".tbd"
+ static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
+ xcode_stub_lib_format = dylib_lib_format
+ if sys.platform == "cygwin":
+ exe_extension = ".exe"
+ shared_lib_extension = ".dll.a"
+ dylib_lib_extension = ".dll"
+ dylib_lib_format = "cyg%s%s"
+
+ def _fix_lib_args(self, libraries, library_dirs, runtime_library_dirs):
+ """Remove standard library path from rpath"""
+ libraries, library_dirs, runtime_library_dirs = super()._fix_lib_args(
+ libraries, library_dirs, runtime_library_dirs
+ )
+ libdir = sysconfig.get_config_var('LIBDIR')
+ if (
+ runtime_library_dirs
+ and libdir.startswith("/usr/lib")
+ and (libdir in runtime_library_dirs)
+ ):
+ runtime_library_dirs.remove(libdir)
+ return libraries, library_dirs, runtime_library_dirs
+
+ def preprocess(
+ self,
+ source: str | os.PathLike[str],
+ output_file: str | os.PathLike[str] | None = None,
+ macros: list[_Macro] | None = None,
+ include_dirs: list[str] | tuple[str, ...] | None = None,
+ extra_preargs: list[str] | None = None,
+ extra_postargs: Iterable[str] | None = None,
+ ):
+ fixed_args = self._fix_compile_args(None, macros, include_dirs)
+ ignore, macros, include_dirs = fixed_args
+ pp_opts = gen_preprocess_options(macros, include_dirs)
+ pp_args = self.preprocessor + pp_opts
+ if output_file:
+ pp_args.extend(['-o', output_file])
+ if extra_preargs:
+ pp_args[:0] = extra_preargs
+ if extra_postargs:
+ pp_args.extend(extra_postargs)
+ pp_args.append(source)
+
+ # reasons to preprocess:
+ # - force is indicated
+ # - output is directed to stdout
+ # - source file is newer than the target
+ preprocess = self.force or output_file is None or newer(source, output_file)
+ if not preprocess:
+ return
+
+ if output_file:
+ self.mkpath(os.path.dirname(output_file))
+
+ try:
+ self.spawn(pp_args)
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
+
+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+ compiler_so = compiler_fixup(self.compiler_so, cc_args + extra_postargs)
+ compiler_so_cxx = compiler_fixup(self.compiler_so_cxx, cc_args + extra_postargs)
+ try:
+ if self.detect_language(src) == 'c++':
+ self.spawn(
+ compiler_so_cxx + cc_args + [src, '-o', obj] + extra_postargs
+ )
+ else:
+ self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
+
+ def create_static_lib(
+ self, objects, output_libname, output_dir=None, debug=False, target_lang=None
+ ):
+ objects, output_dir = self._fix_object_args(objects, output_dir)
+
+ output_filename = self.library_filename(output_libname, output_dir=output_dir)
+
+ if self._need_link(objects, output_filename):
+ self.mkpath(os.path.dirname(output_filename))
+ self.spawn(self.archiver + [output_filename] + objects + self.objects)
+
+ # Not many Unices required ranlib anymore -- SunOS 4.x is, I
+ # think the only major Unix that does. Maybe we need some
+ # platform intelligence here to skip ranlib if it's not
+ # needed -- or maybe Python's configure script took care of
+ # it for us, hence the check for leading colon.
+ if self.ranlib:
+ try:
+ self.spawn(self.ranlib + [output_filename])
+ except DistutilsExecError as msg:
+ raise LibError(msg)
+ else:
+ log.debug("skipping %s (up-to-date)", output_filename)
+
+ def link(
+ self,
+ target_desc,
+ objects: list[str] | tuple[str, ...],
+ output_filename,
+ output_dir: str | None = None,
+ libraries: list[str] | tuple[str, ...] | None = None,
+ library_dirs: list[str] | tuple[str, ...] | None = None,
+ runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
+ export_symbols=None,
+ debug=False,
+ extra_preargs=None,
+ extra_postargs=None,
+ build_temp=None,
+ target_lang=None,
+ ):
+ objects, output_dir = self._fix_object_args(objects, output_dir)
+ fixed_args = self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
+ libraries, library_dirs, runtime_library_dirs = fixed_args
+
+ lib_opts = gen_lib_options(self, library_dirs, runtime_library_dirs, libraries)
+ if not isinstance(output_dir, (str, type(None))):
+ raise TypeError("'output_dir' must be a string or None")
+ if output_dir is not None:
+ output_filename = os.path.join(output_dir, output_filename)
+
+ if self._need_link(objects, output_filename):
+ ld_args = objects + self.objects + lib_opts + ['-o', output_filename]
+ if debug:
+ ld_args[:0] = ['-g']
+ if extra_preargs:
+ ld_args[:0] = extra_preargs
+ if extra_postargs:
+ ld_args.extend(extra_postargs)
+ self.mkpath(os.path.dirname(output_filename))
+ try:
+ # Select a linker based on context: linker_exe when
+ # building an executable or linker_so (with shared options)
+ # when building a shared library.
+ building_exe = target_desc == base.Compiler.EXECUTABLE
+ target_cxx = target_lang == "c++"
+ linker = (
+ (self.linker_exe_cxx if target_cxx else self.linker_exe)
+ if building_exe
+ else (self.linker_so_cxx if target_cxx else self.linker_so)
+ )[:]
+
+ if target_cxx and self.compiler_cxx:
+ env, linker_ne = _split_env(linker)
+ aix, linker_na = _split_aix(linker_ne)
+ _, compiler_cxx_ne = _split_env(self.compiler_cxx)
+ _, linker_exe_ne = _split_env(self.linker_exe_cxx)
+
+ params = _linker_params(linker_na, linker_exe_ne)
+ linker = env + aix + compiler_cxx_ne + params
+
+ linker = compiler_fixup(linker, ld_args)
+
+ self.spawn(linker + ld_args)
+ except DistutilsExecError as msg:
+ raise LinkError(msg)
+ else:
+ log.debug("skipping %s (up-to-date)", output_filename)
+
+ # -- Miscellaneous methods -----------------------------------------
+ # These are all used by the 'gen_lib_options() function, in
+ # ccompiler.py.
+
+ def library_dir_option(self, dir):
+ return "-L" + dir
+
+ def _is_gcc(self):
+ cc_var = sysconfig.get_config_var("CC")
+ compiler = os.path.basename(shlex.split(cc_var)[0])
+ return "gcc" in compiler or "g++" in compiler
+
+ def runtime_library_dir_option(self, dir: str) -> str | list[str]: # type: ignore[override] # Fixed in pypa/distutils#339
+ # XXX Hackish, at the very least. See Python bug #445902:
+ # https://bugs.python.org/issue445902
+ # Linkers on different platforms need different options to
+ # specify that directories need to be added to the list of
+ # directories searched for dependencies when a dynamic library
+ # is sought. GCC on GNU systems (Linux, FreeBSD, ...) has to
+ # be told to pass the -R option through to the linker, whereas
+ # other compilers and gcc on other systems just know this.
+ # Other compilers may need something slightly different. At
+ # this time, there's no way to determine this information from
+ # the configuration data stored in the Python installation, so
+ # we use this hack.
+ if sys.platform[:6] == "darwin":
+ from distutils.util import get_macosx_target_ver, split_version
+
+ macosx_target_ver = get_macosx_target_ver()
+ if macosx_target_ver and split_version(macosx_target_ver) >= [10, 5]:
+ return "-Wl,-rpath," + dir
+ else: # no support for -rpath on earlier macOS versions
+ return "-L" + dir
+ elif sys.platform[:7] == "freebsd":
+ return "-Wl,-rpath=" + dir
+ elif sys.platform[:5] == "hp-ux":
+ return [
+ "-Wl,+s" if self._is_gcc() else "+s",
+ "-L" + dir,
+ ]
+
+ # For all compilers, `-Wl` is the presumed way to pass a
+ # compiler option to the linker
+ if sysconfig.get_config_var("GNULD") == "yes":
+ return consolidate_linker_args([
+ # Force RUNPATH instead of RPATH
+ "-Wl,--enable-new-dtags",
+ "-Wl,-rpath," + dir,
+ ])
+ else:
+ return "-Wl,-R" + dir
+
+ def library_option(self, lib):
+ return "-l" + lib
+
+ @staticmethod
+ def _library_root(dir):
+ """
+ macOS users can specify an alternate SDK using'-isysroot'.
+ Calculate the SDK root if it is specified.
+
+ Note that, as of Xcode 7, Apple SDKs may contain textual stub
+ libraries with .tbd extensions rather than the normal .dylib
+ shared libraries installed in /. The Apple compiler tool
+ chain handles this transparently but it can cause problems
+ for programs that are being built with an SDK and searching
+ for specific libraries. Callers of find_library_file need to
+ keep in mind that the base filename of the returned SDK library
+ file might have a different extension from that of the library
+ file installed on the running system, for example:
+ /Applications/Xcode.app/Contents/Developer/Platforms/
+ MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/
+ usr/lib/libedit.tbd
+ vs
+ /usr/lib/libedit.dylib
+ """
+ cflags = sysconfig.get_config_var('CFLAGS')
+ match = re.search(r'-isysroot\s*(\S+)', cflags)
+
+ apply_root = (
+ sys.platform == 'darwin'
+ and match
+ and (
+ dir.startswith('/System/')
+ or (dir.startswith('/usr/') and not dir.startswith('/usr/local/'))
+ )
+ )
+
+ return os.path.join(match.group(1), dir[1:]) if apply_root else dir
+
+ def find_library_file(self, dirs, lib, debug=False):
+ """
+ Second-guess the linker with not much hard
+ data to go on: GCC seems to prefer the shared library, so
+ assume that *all* Unix C compilers do,
+ ignoring even GCC's "-static" option.
+ """
+ lib_names = (
+ self.library_filename(lib, lib_type=type)
+ for type in 'dylib xcode_stub shared static'.split()
+ )
+
+ roots = map(self._library_root, dirs)
+
+ searched = itertools.starmap(os.path.join, itertools.product(roots, lib_names))
+
+ found = filter(os.path.exists, searched)
+
+ # Return None if it could not be found in any dir.
+ return next(found, None)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/zos.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/zos.py
new file mode 100644
index 0000000000000000000000000000000000000000..82d017fc90db55b8f7b2517ba6c8a8fd2082cb5e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/compilers/C/zos.py
@@ -0,0 +1,230 @@
+"""distutils.zosccompiler
+
+Contains the selection of the c & c++ compilers on z/OS. There are several
+different c compilers on z/OS, all of them are optional, so the correct
+one needs to be chosen based on the users input. This is compatible with
+the following compilers:
+
+IBM C/C++ For Open Enterprise Languages on z/OS 2.0
+IBM Open XL C/C++ 1.1 for z/OS
+IBM XL C/C++ V2.4.1 for z/OS 2.4 and 2.5
+IBM z/OS XL C/C++
+"""
+
+import os
+
+from ... import sysconfig
+from ...errors import DistutilsExecError
+from . import unix
+from .errors import CompileError
+
+_cc_args = {
+ 'ibm-openxl': [
+ '-m64',
+ '-fvisibility=default',
+ '-fzos-le-char-mode=ascii',
+ '-fno-short-enums',
+ ],
+ 'ibm-xlclang': [
+ '-q64',
+ '-qexportall',
+ '-qascii',
+ '-qstrict',
+ '-qnocsect',
+ '-Wa,asa,goff',
+ '-Wa,xplink',
+ '-qgonumber',
+ '-qenum=int',
+ '-Wc,DLL',
+ ],
+ 'ibm-xlc': [
+ '-q64',
+ '-qexportall',
+ '-qascii',
+ '-qstrict',
+ '-qnocsect',
+ '-Wa,asa,goff',
+ '-Wa,xplink',
+ '-qgonumber',
+ '-qenum=int',
+ '-Wc,DLL',
+ '-qlanglvl=extc99',
+ ],
+}
+
+_cxx_args = {
+ 'ibm-openxl': [
+ '-m64',
+ '-fvisibility=default',
+ '-fzos-le-char-mode=ascii',
+ '-fno-short-enums',
+ ],
+ 'ibm-xlclang': [
+ '-q64',
+ '-qexportall',
+ '-qascii',
+ '-qstrict',
+ '-qnocsect',
+ '-Wa,asa,goff',
+ '-Wa,xplink',
+ '-qgonumber',
+ '-qenum=int',
+ '-Wc,DLL',
+ ],
+ 'ibm-xlc': [
+ '-q64',
+ '-qexportall',
+ '-qascii',
+ '-qstrict',
+ '-qnocsect',
+ '-Wa,asa,goff',
+ '-Wa,xplink',
+ '-qgonumber',
+ '-qenum=int',
+ '-Wc,DLL',
+ '-qlanglvl=extended0x',
+ ],
+}
+
+_asm_args = {
+ 'ibm-openxl': ['-fasm', '-fno-integrated-as', '-Wa,--ASA', '-Wa,--GOFF'],
+ 'ibm-xlclang': [],
+ 'ibm-xlc': [],
+}
+
+_ld_args = {
+ 'ibm-openxl': [],
+ 'ibm-xlclang': ['-Wl,dll', '-q64'],
+ 'ibm-xlc': ['-Wl,dll', '-q64'],
+}
+
+
+# Python on z/OS is built with no compiler specific options in it's CFLAGS.
+# But each compiler requires it's own specific options to build successfully,
+# though some of the options are common between them
+class Compiler(unix.Compiler):
+ src_extensions = ['.c', '.C', '.cc', '.cxx', '.cpp', '.m', '.s']
+ _cpp_extensions = ['.cc', '.cpp', '.cxx', '.C']
+ _asm_extensions = ['.s']
+
+ def _get_zos_compiler_name(self):
+ zos_compiler_names = [
+ os.path.basename(binary)
+ for envvar in ('CC', 'CXX', 'LDSHARED')
+ if (binary := os.environ.get(envvar, None))
+ ]
+ if len(zos_compiler_names) == 0:
+ return 'ibm-openxl'
+
+ zos_compilers = {}
+ for compiler in (
+ 'ibm-clang',
+ 'ibm-clang64',
+ 'ibm-clang++',
+ 'ibm-clang++64',
+ 'clang',
+ 'clang++',
+ 'clang-14',
+ ):
+ zos_compilers[compiler] = 'ibm-openxl'
+
+ for compiler in ('xlclang', 'xlclang++', 'njsc', 'njsc++'):
+ zos_compilers[compiler] = 'ibm-xlclang'
+
+ for compiler in ('xlc', 'xlC', 'xlc++'):
+ zos_compilers[compiler] = 'ibm-xlc'
+
+ return zos_compilers.get(zos_compiler_names[0], 'ibm-openxl')
+
+ def __init__(self, verbose=False, dry_run=False, force=False):
+ super().__init__(verbose, dry_run, force)
+ self.zos_compiler = self._get_zos_compiler_name()
+ sysconfig.customize_compiler(self)
+
+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+ local_args = []
+ if ext in self._cpp_extensions:
+ compiler = self.compiler_cxx
+ local_args.extend(_cxx_args[self.zos_compiler])
+ elif ext in self._asm_extensions:
+ compiler = self.compiler_so
+ local_args.extend(_cc_args[self.zos_compiler])
+ local_args.extend(_asm_args[self.zos_compiler])
+ else:
+ compiler = self.compiler_so
+ local_args.extend(_cc_args[self.zos_compiler])
+ local_args.extend(cc_args)
+
+ try:
+ self.spawn(compiler + local_args + [src, '-o', obj] + extra_postargs)
+ except DistutilsExecError as msg:
+ raise CompileError(msg)
+
+ def runtime_library_dir_option(self, dir):
+ return '-L' + dir
+
+ def link(
+ self,
+ target_desc,
+ objects,
+ output_filename,
+ output_dir=None,
+ libraries=None,
+ library_dirs=None,
+ runtime_library_dirs=None,
+ export_symbols=None,
+ debug=False,
+ extra_preargs=None,
+ extra_postargs=None,
+ build_temp=None,
+ target_lang=None,
+ ):
+ # For a built module to use functions from cpython, it needs to use Pythons
+ # side deck file. The side deck is located beside the libpython3.xx.so
+ ldversion = sysconfig.get_config_var('LDVERSION')
+ if sysconfig.python_build:
+ side_deck_path = os.path.join(
+ sysconfig.get_config_var('abs_builddir'),
+ f'libpython{ldversion}.x',
+ )
+ else:
+ side_deck_path = os.path.join(
+ sysconfig.get_config_var('installed_base'),
+ sysconfig.get_config_var('platlibdir'),
+ f'libpython{ldversion}.x',
+ )
+
+ if os.path.exists(side_deck_path):
+ if extra_postargs:
+ extra_postargs.append(side_deck_path)
+ else:
+ extra_postargs = [side_deck_path]
+
+ # Check and replace libraries included side deck files
+ if runtime_library_dirs:
+ for dir in runtime_library_dirs:
+ for library in libraries[:]:
+ library_side_deck = os.path.join(dir, f'{library}.x')
+ if os.path.exists(library_side_deck):
+ libraries.remove(library)
+ extra_postargs.append(library_side_deck)
+ break
+
+ # Any required ld args for the given compiler
+ extra_postargs.extend(_ld_args[self.zos_compiler])
+
+ super().link(
+ target_desc,
+ objects,
+ output_filename,
+ output_dir,
+ libraries,
+ library_dirs,
+ runtime_library_dirs,
+ export_symbols,
+ debug,
+ extra_preargs,
+ extra_postargs,
+ build_temp,
+ target_lang,
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py
new file mode 100644
index 0000000000000000000000000000000000000000..bd62546bdd9d35dcc46e0b46a46b0c61a43fd0ba
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/core.py
@@ -0,0 +1,289 @@
+"""distutils.core
+
+The only module that needs to be imported to use the Distutils; provides
+the 'setup' function (which is to be called from the setup script). Also
+indirectly provides the Distribution and Command classes, although they are
+really defined in distutils.dist and distutils.cmd.
+"""
+
+from __future__ import annotations
+
+import os
+import sys
+import tokenize
+from collections.abc import Iterable
+
+from .cmd import Command
+from .debug import DEBUG
+
+# Mainly import these so setup scripts can "from distutils.core import" them.
+from .dist import Distribution
+from .errors import (
+ CCompilerError,
+ DistutilsArgError,
+ DistutilsError,
+ DistutilsSetupError,
+)
+from .extension import Extension
+
+__all__ = ['Distribution', 'Command', 'Extension', 'setup']
+
+# This is a barebones help message generated displayed when the user
+# runs the setup script with no arguments at all. More useful help
+# is generated with various --help options: global help, list commands,
+# and per-command help.
+USAGE = """\
+usage: %(script)s [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
+ or: %(script)s --help [cmd1 cmd2 ...]
+ or: %(script)s --help-commands
+ or: %(script)s cmd --help
+"""
+
+
+def gen_usage(script_name):
+ script = os.path.basename(script_name)
+ return USAGE % locals()
+
+
+# Some mild magic to control the behaviour of 'setup()' from 'run_setup()'.
+_setup_stop_after = None
+_setup_distribution = None
+
+# Legal keyword arguments for the setup() function
+setup_keywords = (
+ 'distclass',
+ 'script_name',
+ 'script_args',
+ 'options',
+ 'name',
+ 'version',
+ 'author',
+ 'author_email',
+ 'maintainer',
+ 'maintainer_email',
+ 'url',
+ 'license',
+ 'description',
+ 'long_description',
+ 'keywords',
+ 'platforms',
+ 'classifiers',
+ 'download_url',
+ 'requires',
+ 'provides',
+ 'obsoletes',
+)
+
+# Legal keyword arguments for the Extension constructor
+extension_keywords = (
+ 'name',
+ 'sources',
+ 'include_dirs',
+ 'define_macros',
+ 'undef_macros',
+ 'library_dirs',
+ 'libraries',
+ 'runtime_library_dirs',
+ 'extra_objects',
+ 'extra_compile_args',
+ 'extra_link_args',
+ 'swig_opts',
+ 'export_symbols',
+ 'depends',
+ 'language',
+)
+
+
+def setup(**attrs): # noqa: C901
+ """The gateway to the Distutils: do everything your setup script needs
+ to do, in a highly flexible and user-driven way. Briefly: create a
+ Distribution instance; find and parse config files; parse the command
+ line; run each Distutils command found there, customized by the options
+ supplied to 'setup()' (as keyword arguments), in config files, and on
+ the command line.
+
+ The Distribution instance might be an instance of a class supplied via
+ the 'distclass' keyword argument to 'setup'; if no such class is
+ supplied, then the Distribution class (in dist.py) is instantiated.
+ All other arguments to 'setup' (except for 'cmdclass') are used to set
+ attributes of the Distribution instance.
+
+ The 'cmdclass' argument, if supplied, is a dictionary mapping command
+ names to command classes. Each command encountered on the command line
+ will be turned into a command class, which is in turn instantiated; any
+ class found in 'cmdclass' is used in place of the default, which is
+ (for command 'foo_bar') class 'foo_bar' in module
+ 'distutils.command.foo_bar'. The command class must provide a
+ 'user_options' attribute which is a list of option specifiers for
+ 'distutils.fancy_getopt'. Any command-line options between the current
+ and the next command are used to set attributes of the current command
+ object.
+
+ When the entire command-line has been successfully parsed, calls the
+ 'run()' method on each command object in turn. This method will be
+ driven entirely by the Distribution object (which each command object
+ has a reference to, thanks to its constructor), and the
+ command-specific options that became attributes of each command
+ object.
+ """
+
+ global _setup_stop_after, _setup_distribution
+
+ # Determine the distribution class -- either caller-supplied or
+ # our Distribution (see below).
+ klass = attrs.get('distclass')
+ if klass:
+ attrs.pop('distclass')
+ else:
+ klass = Distribution
+
+ if 'script_name' not in attrs:
+ attrs['script_name'] = os.path.basename(sys.argv[0])
+ if 'script_args' not in attrs:
+ attrs['script_args'] = sys.argv[1:]
+
+ # Create the Distribution instance, using the remaining arguments
+ # (ie. everything except distclass) to initialize it
+ try:
+ _setup_distribution = dist = klass(attrs)
+ except DistutilsSetupError as msg:
+ if 'name' not in attrs:
+ raise SystemExit(f"error in setup command: {msg}")
+ else:
+ raise SystemExit("error in {} setup command: {}".format(attrs['name'], msg))
+
+ if _setup_stop_after == "init":
+ return dist
+
+ # Find and parse the config file(s): they will override options from
+ # the setup script, but be overridden by the command line.
+ dist.parse_config_files()
+
+ if DEBUG:
+ print("options (after parsing config files):")
+ dist.dump_option_dicts()
+
+ if _setup_stop_after == "config":
+ return dist
+
+ # Parse the command line and override config files; any
+ # command-line errors are the end user's fault, so turn them into
+ # SystemExit to suppress tracebacks.
+ try:
+ ok = dist.parse_command_line()
+ except DistutilsArgError as msg:
+ raise SystemExit(gen_usage(dist.script_name) + f"\nerror: {msg}")
+
+ if DEBUG:
+ print("options (after parsing command line):")
+ dist.dump_option_dicts()
+
+ if _setup_stop_after == "commandline":
+ return dist
+
+ # And finally, run all the commands found on the command line.
+ if ok:
+ return run_commands(dist)
+
+ return dist
+
+
+# setup ()
+
+
+def run_commands(dist):
+ """Given a Distribution object run all the commands,
+ raising ``SystemExit`` errors in the case of failure.
+
+ This function assumes that either ``sys.argv`` or ``dist.script_args``
+ is already set accordingly.
+ """
+ try:
+ dist.run_commands()
+ except KeyboardInterrupt:
+ raise SystemExit("interrupted")
+ except OSError as exc:
+ if DEBUG:
+ sys.stderr.write(f"error: {exc}\n")
+ raise
+ else:
+ raise SystemExit(f"error: {exc}")
+
+ except (DistutilsError, CCompilerError) as msg:
+ if DEBUG:
+ raise
+ else:
+ raise SystemExit("error: " + str(msg))
+
+ return dist
+
+
+def run_setup(script_name, script_args: Iterable[str] | None = None, stop_after="run"):
+ """Run a setup script in a somewhat controlled environment, and
+ return the Distribution instance that drives things. This is useful
+ if you need to find out the distribution meta-data (passed as
+ keyword args from 'script' to 'setup()', or the contents of the
+ config files or command-line.
+
+ 'script_name' is a file that will be read and run with 'exec()';
+ 'sys.argv[0]' will be replaced with 'script' for the duration of the
+ call. 'script_args' is a list of strings; if supplied,
+ 'sys.argv[1:]' will be replaced by 'script_args' for the duration of
+ the call.
+
+ 'stop_after' tells 'setup()' when to stop processing; possible
+ values:
+ init
+ stop after the Distribution instance has been created and
+ populated with the keyword arguments to 'setup()'
+ config
+ stop after config files have been parsed (and their data
+ stored in the Distribution instance)
+ commandline
+ stop after the command-line ('sys.argv[1:]' or 'script_args')
+ have been parsed (and the data stored in the Distribution)
+ run [default]
+ stop after all commands have been run (the same as if 'setup()'
+ had been called in the usual way
+
+ Returns the Distribution instance, which provides all information
+ used to drive the Distutils.
+ """
+ if stop_after not in ('init', 'config', 'commandline', 'run'):
+ raise ValueError(f"invalid value for 'stop_after': {stop_after!r}")
+
+ global _setup_stop_after, _setup_distribution
+ _setup_stop_after = stop_after
+
+ save_argv = sys.argv.copy()
+ g = {'__file__': script_name, '__name__': '__main__'}
+ try:
+ try:
+ sys.argv[0] = script_name
+ if script_args is not None:
+ sys.argv[1:] = script_args
+ # tokenize.open supports automatic encoding detection
+ with tokenize.open(script_name) as f:
+ code = f.read().replace(r'\r\n', r'\n')
+ exec(code, g)
+ finally:
+ sys.argv = save_argv
+ _setup_stop_after = None
+ except SystemExit:
+ # Hmm, should we do something if exiting with a non-zero code
+ # (ie. error)?
+ pass
+
+ if _setup_distribution is None:
+ raise RuntimeError(
+ "'distutils.core.setup()' was never called -- "
+ f"perhaps '{script_name}' is not a Distutils setup script?"
+ )
+
+ # I wonder if the setup script's namespace -- g and l -- would be of
+ # any interest to callers?
+ # print "_setup_distribution:", _setup_distribution
+ return _setup_distribution
+
+
+# run_setup ()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/cygwinccompiler.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/cygwinccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..de89e3cd8402c9b7048c9e456ff67601934f972b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/cygwinccompiler.py
@@ -0,0 +1,31 @@
+from .compilers.C import cygwin
+from .compilers.C.cygwin import (
+ CONFIG_H_NOTOK,
+ CONFIG_H_OK,
+ CONFIG_H_UNCERTAIN,
+ check_config_h,
+ get_msvcr,
+ is_cygwincc,
+)
+
+__all__ = [
+ 'CONFIG_H_NOTOK',
+ 'CONFIG_H_OK',
+ 'CONFIG_H_UNCERTAIN',
+ 'CygwinCCompiler',
+ 'Mingw32CCompiler',
+ 'check_config_h',
+ 'get_msvcr',
+ 'is_cygwincc',
+]
+
+
+CygwinCCompiler = cygwin.Compiler
+Mingw32CCompiler = cygwin.MinGW32Compiler
+
+
+get_versions = None
+"""
+A stand-in for the previous get_versions() function to prevent failures
+when monkeypatched. See pypa/setuptools#2969.
+"""
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/debug.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/debug.py
new file mode 100644
index 0000000000000000000000000000000000000000..daf1660f0d821143e388d37532a39ddfd2ca0347
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/debug.py
@@ -0,0 +1,5 @@
+import os
+
+# If DISTUTILS_DEBUG is anything other than the empty string, we run in
+# debug mode.
+DEBUG = os.environ.get('DISTUTILS_DEBUG')
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dep_util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dep_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..09a8a2e126c8bb009dbbe61c5c4bd5e358744996
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dep_util.py
@@ -0,0 +1,14 @@
+import warnings
+
+from . import _modified
+
+
+def __getattr__(name):
+ if name not in ['newer', 'newer_group', 'newer_pairwise']:
+ raise AttributeError(name)
+ warnings.warn(
+ "dep_util is Deprecated. Use functions from setuptools instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ return getattr(_modified, name)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dir_util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dir_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..d9782602cfe78d4033fb43846965347de8ad9cdf
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dir_util.py
@@ -0,0 +1,244 @@
+"""distutils.dir_util
+
+Utility functions for manipulating directories and directory trees."""
+
+import functools
+import itertools
+import os
+import pathlib
+
+from . import file_util
+from ._log import log
+from .errors import DistutilsFileError, DistutilsInternalError
+
+
+class SkipRepeatAbsolutePaths(set):
+ """
+ Cache for mkpath.
+
+ In addition to cheapening redundant calls, eliminates redundant
+ "creating /foo/bar/baz" messages in dry-run mode.
+ """
+
+ def __init__(self):
+ SkipRepeatAbsolutePaths.instance = self
+
+ @classmethod
+ def clear(cls):
+ super(cls, cls.instance).clear()
+
+ def wrap(self, func):
+ @functools.wraps(func)
+ def wrapper(path, *args, **kwargs):
+ if path.absolute() in self:
+ return
+ result = func(path, *args, **kwargs)
+ self.add(path.absolute())
+ return result
+
+ return wrapper
+
+
+# Python 3.8 compatibility
+wrapper = SkipRepeatAbsolutePaths().wrap
+
+
+@functools.singledispatch
+@wrapper
+def mkpath(name: pathlib.Path, mode=0o777, verbose=True, dry_run=False) -> None:
+ """Create a directory and any missing ancestor directories.
+
+ If the directory already exists (or if 'name' is the empty string, which
+ means the current directory, which of course exists), then do nothing.
+ Raise DistutilsFileError if unable to create some directory along the way
+ (eg. some sub-path exists, but is a file rather than a directory).
+ If 'verbose' is true, log the directory created.
+ """
+ if verbose and not name.is_dir():
+ log.info("creating %s", name)
+
+ try:
+ dry_run or name.mkdir(mode=mode, parents=True, exist_ok=True)
+ except OSError as exc:
+ raise DistutilsFileError(f"could not create '{name}': {exc.args[-1]}")
+
+
+@mkpath.register
+def _(name: str, *args, **kwargs):
+ return mkpath(pathlib.Path(name), *args, **kwargs)
+
+
+@mkpath.register
+def _(name: None, *args, **kwargs):
+ """
+ Detect a common bug -- name is None.
+ """
+ raise DistutilsInternalError(f"mkpath: 'name' must be a string (got {name!r})")
+
+
+def create_tree(base_dir, files, mode=0o777, verbose=True, dry_run=False):
+ """Create all the empty directories under 'base_dir' needed to put 'files'
+ there.
+
+ 'base_dir' is just the name of a directory which doesn't necessarily
+ exist yet; 'files' is a list of filenames to be interpreted relative to
+ 'base_dir'. 'base_dir' + the directory portion of every file in 'files'
+ will be created if it doesn't already exist. 'mode', 'verbose' and
+ 'dry_run' flags are as for 'mkpath()'.
+ """
+ # First get the list of directories to create
+ need_dir = set(os.path.join(base_dir, os.path.dirname(file)) for file in files)
+
+ # Now create them
+ for dir in sorted(need_dir):
+ mkpath(dir, mode, verbose=verbose, dry_run=dry_run)
+
+
+def copy_tree(
+ src,
+ dst,
+ preserve_mode=True,
+ preserve_times=True,
+ preserve_symlinks=False,
+ update=False,
+ verbose=True,
+ dry_run=False,
+):
+ """Copy an entire directory tree 'src' to a new location 'dst'.
+
+ Both 'src' and 'dst' must be directory names. If 'src' is not a
+ directory, raise DistutilsFileError. If 'dst' does not exist, it is
+ created with 'mkpath()'. The end result of the copy is that every
+ file in 'src' is copied to 'dst', and directories under 'src' are
+ recursively copied to 'dst'. Return the list of files that were
+ copied or might have been copied, using their output name. The
+ return value is unaffected by 'update' or 'dry_run': it is simply
+ the list of all files under 'src', with the names changed to be
+ under 'dst'.
+
+ 'preserve_mode' and 'preserve_times' are the same as for
+ 'copy_file'; note that they only apply to regular files, not to
+ directories. If 'preserve_symlinks' is true, symlinks will be
+ copied as symlinks (on platforms that support them!); otherwise
+ (the default), the destination of the symlink will be copied.
+ 'update' and 'verbose' are the same as for 'copy_file'.
+ """
+ if not dry_run and not os.path.isdir(src):
+ raise DistutilsFileError(f"cannot copy tree '{src}': not a directory")
+ try:
+ names = os.listdir(src)
+ except OSError as e:
+ if dry_run:
+ names = []
+ else:
+ raise DistutilsFileError(f"error listing files in '{src}': {e.strerror}")
+
+ if not dry_run:
+ mkpath(dst, verbose=verbose)
+
+ copy_one = functools.partial(
+ _copy_one,
+ src=src,
+ dst=dst,
+ preserve_symlinks=preserve_symlinks,
+ verbose=verbose,
+ dry_run=dry_run,
+ preserve_mode=preserve_mode,
+ preserve_times=preserve_times,
+ update=update,
+ )
+ return list(itertools.chain.from_iterable(map(copy_one, names)))
+
+
+def _copy_one(
+ name,
+ *,
+ src,
+ dst,
+ preserve_symlinks,
+ verbose,
+ dry_run,
+ preserve_mode,
+ preserve_times,
+ update,
+):
+ src_name = os.path.join(src, name)
+ dst_name = os.path.join(dst, name)
+
+ if name.startswith('.nfs'):
+ # skip NFS rename files
+ return
+
+ if preserve_symlinks and os.path.islink(src_name):
+ link_dest = os.readlink(src_name)
+ if verbose >= 1:
+ log.info("linking %s -> %s", dst_name, link_dest)
+ if not dry_run:
+ os.symlink(link_dest, dst_name)
+ yield dst_name
+
+ elif os.path.isdir(src_name):
+ yield from copy_tree(
+ src_name,
+ dst_name,
+ preserve_mode,
+ preserve_times,
+ preserve_symlinks,
+ update,
+ verbose=verbose,
+ dry_run=dry_run,
+ )
+ else:
+ file_util.copy_file(
+ src_name,
+ dst_name,
+ preserve_mode,
+ preserve_times,
+ update,
+ verbose=verbose,
+ dry_run=dry_run,
+ )
+ yield dst_name
+
+
+def _build_cmdtuple(path, cmdtuples):
+ """Helper for remove_tree()."""
+ for f in os.listdir(path):
+ real_f = os.path.join(path, f)
+ if os.path.isdir(real_f) and not os.path.islink(real_f):
+ _build_cmdtuple(real_f, cmdtuples)
+ else:
+ cmdtuples.append((os.remove, real_f))
+ cmdtuples.append((os.rmdir, path))
+
+
+def remove_tree(directory, verbose=True, dry_run=False):
+ """Recursively remove an entire directory tree.
+
+ Any errors are ignored (apart from being reported to stdout if 'verbose'
+ is true).
+ """
+ if verbose >= 1:
+ log.info("removing '%s' (and everything under it)", directory)
+ if dry_run:
+ return
+ cmdtuples = []
+ _build_cmdtuple(directory, cmdtuples)
+ for cmd in cmdtuples:
+ try:
+ cmd[0](cmd[1])
+ # Clear the cache
+ SkipRepeatAbsolutePaths.clear()
+ except OSError as exc:
+ log.warning("error removing %s: %s", directory, exc)
+
+
+def ensure_relative(path):
+ """Take the full path 'path', and make it a relative path.
+
+ This is useful to make 'path' the second argument to os.path.join().
+ """
+ drive, path = os.path.splitdrive(path)
+ if path[0:1] == os.sep:
+ path = drive + path[1:]
+ return path
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py
new file mode 100644
index 0000000000000000000000000000000000000000..37b788df92549877684c2311ed1c71634f14dcd2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/dist.py
@@ -0,0 +1,1386 @@
+"""distutils.dist
+
+Provides the Distribution class, which represents the module distribution
+being built/installed/distributed.
+"""
+
+from __future__ import annotations
+
+import contextlib
+import logging
+import os
+import pathlib
+import re
+import sys
+import warnings
+from collections.abc import Iterable, MutableMapping
+from email import message_from_file
+from typing import (
+ IO,
+ TYPE_CHECKING,
+ Any,
+ ClassVar,
+ Literal,
+ TypeVar,
+ Union,
+ overload,
+)
+
+from packaging.utils import canonicalize_name, canonicalize_version
+
+from ._log import log
+from .debug import DEBUG
+from .errors import (
+ DistutilsArgError,
+ DistutilsClassError,
+ DistutilsModuleError,
+ DistutilsOptionError,
+)
+from .fancy_getopt import FancyGetopt, translate_longopt
+from .util import check_environ, rfc822_escape, strtobool
+
+if TYPE_CHECKING:
+ from _typeshed import SupportsWrite
+ from typing_extensions import TypeAlias
+
+ # type-only import because of mutual dependence between these modules
+ from .cmd import Command
+
+_CommandT = TypeVar("_CommandT", bound="Command")
+_OptionsList: TypeAlias = list[
+ Union[tuple[str, Union[str, None], str, int], tuple[str, Union[str, None], str]]
+]
+
+
+# Regex to define acceptable Distutils command names. This is not *quite*
+# the same as a Python NAME -- I don't allow leading underscores. The fact
+# that they're very similar is no coincidence; the default naming scheme is
+# to look for a Python module named after the command.
+command_re = re.compile(r'^[a-zA-Z]([a-zA-Z0-9_]*)$')
+
+
+def _ensure_list(value: str | Iterable[str], fieldname) -> str | list[str]:
+ if isinstance(value, str):
+ # a string containing comma separated values is okay. It will
+ # be converted to a list by Distribution.finalize_options().
+ pass
+ elif not isinstance(value, list):
+ # passing a tuple or an iterator perhaps, warn and convert
+ typename = type(value).__name__
+ msg = "Warning: '{fieldname}' should be a list, got type '{typename}'"
+ msg = msg.format(**locals())
+ log.warning(msg)
+ value = list(value)
+ return value
+
+
+class Distribution:
+ """The core of the Distutils. Most of the work hiding behind 'setup'
+ is really done within a Distribution instance, which farms the work out
+ to the Distutils commands specified on the command line.
+
+ Setup scripts will almost never instantiate Distribution directly,
+ unless the 'setup()' function is totally inadequate to their needs.
+ However, it is conceivable that a setup script might wish to subclass
+ Distribution for some specialized purpose, and then pass the subclass
+ to 'setup()' as the 'distclass' keyword argument. If so, it is
+ necessary to respect the expectations that 'setup' has of Distribution.
+ See the code for 'setup()', in core.py, for details.
+ """
+
+ # 'global_options' describes the command-line options that may be
+ # supplied to the setup script prior to any actual commands.
+ # Eg. "./setup.py -n" or "./setup.py --quiet" both take advantage of
+ # these global options. This list should be kept to a bare minimum,
+ # since every global option is also valid as a command option -- and we
+ # don't want to pollute the commands with too many options that they
+ # have minimal control over.
+ # The fourth entry for verbose means that it can be repeated.
+ global_options: ClassVar[_OptionsList] = [
+ ('verbose', 'v', "run verbosely (default)", 1),
+ ('quiet', 'q', "run quietly (turns verbosity off)"),
+ ('dry-run', 'n', "don't actually do anything"),
+ ('help', 'h', "show detailed help message"),
+ ('no-user-cfg', None, 'ignore pydistutils.cfg in your home directory'),
+ ]
+
+ # 'common_usage' is a short (2-3 line) string describing the common
+ # usage of the setup script.
+ common_usage: ClassVar[str] = """\
+Common commands: (see '--help-commands' for more)
+
+ setup.py build will build the package underneath 'build/'
+ setup.py install will install the package
+"""
+
+ # options that are not propagated to the commands
+ display_options: ClassVar[_OptionsList] = [
+ ('help-commands', None, "list all available commands"),
+ ('name', None, "print package name"),
+ ('version', 'V', "print package version"),
+ ('fullname', None, "print -"),
+ ('author', None, "print the author's name"),
+ ('author-email', None, "print the author's email address"),
+ ('maintainer', None, "print the maintainer's name"),
+ ('maintainer-email', None, "print the maintainer's email address"),
+ ('contact', None, "print the maintainer's name if known, else the author's"),
+ (
+ 'contact-email',
+ None,
+ "print the maintainer's email address if known, else the author's",
+ ),
+ ('url', None, "print the URL for this package"),
+ ('license', None, "print the license of the package"),
+ ('licence', None, "alias for --license"),
+ ('description', None, "print the package description"),
+ ('long-description', None, "print the long package description"),
+ ('platforms', None, "print the list of platforms"),
+ ('classifiers', None, "print the list of classifiers"),
+ ('keywords', None, "print the list of keywords"),
+ ('provides', None, "print the list of packages/modules provided"),
+ ('requires', None, "print the list of packages/modules required"),
+ ('obsoletes', None, "print the list of packages/modules made obsolete"),
+ ]
+ display_option_names: ClassVar[list[str]] = [
+ translate_longopt(x[0]) for x in display_options
+ ]
+
+ # negative options are options that exclude other options
+ negative_opt: ClassVar[dict[str, str]] = {'quiet': 'verbose'}
+
+ # -- Creation/initialization methods -------------------------------
+
+ # Can't Unpack a TypedDict with optional properties, so using Any instead
+ def __init__(self, attrs: MutableMapping[str, Any] | None = None) -> None: # noqa: C901
+ """Construct a new Distribution instance: initialize all the
+ attributes of a Distribution, and then use 'attrs' (a dictionary
+ mapping attribute names to values) to assign some of those
+ attributes their "real" values. (Any attributes not mentioned in
+ 'attrs' will be assigned to some null value: 0, None, an empty list
+ or dictionary, etc.) Most importantly, initialize the
+ 'command_obj' attribute to the empty dictionary; this will be
+ filled in with real command objects by 'parse_command_line()'.
+ """
+
+ # Default values for our command-line options
+ self.verbose = True
+ self.dry_run = False
+ self.help = False
+ for attr in self.display_option_names:
+ setattr(self, attr, False)
+
+ # Store the distribution meta-data (name, version, author, and so
+ # forth) in a separate object -- we're getting to have enough
+ # information here (and enough command-line options) that it's
+ # worth it. Also delegate 'get_XXX()' methods to the 'metadata'
+ # object in a sneaky and underhanded (but efficient!) way.
+ self.metadata = DistributionMetadata()
+ for basename in self.metadata._METHOD_BASENAMES:
+ method_name = "get_" + basename
+ setattr(self, method_name, getattr(self.metadata, method_name))
+
+ # 'cmdclass' maps command names to class objects, so we
+ # can 1) quickly figure out which class to instantiate when
+ # we need to create a new command object, and 2) have a way
+ # for the setup script to override command classes
+ self.cmdclass: dict[str, type[Command]] = {}
+
+ # 'command_packages' is a list of packages in which commands
+ # are searched for. The factory for command 'foo' is expected
+ # to be named 'foo' in the module 'foo' in one of the packages
+ # named here. This list is searched from the left; an error
+ # is raised if no named package provides the command being
+ # searched for. (Always access using get_command_packages().)
+ self.command_packages: str | list[str] | None = None
+
+ # 'script_name' and 'script_args' are usually set to sys.argv[0]
+ # and sys.argv[1:], but they can be overridden when the caller is
+ # not necessarily a setup script run from the command-line.
+ self.script_name: str | os.PathLike[str] | None = None
+ self.script_args: list[str] | None = None
+
+ # 'command_options' is where we store command options between
+ # parsing them (from config files, the command-line, etc.) and when
+ # they are actually needed -- ie. when the command in question is
+ # instantiated. It is a dictionary of dictionaries of 2-tuples:
+ # command_options = { command_name : { option : (source, value) } }
+ self.command_options: dict[str, dict[str, tuple[str, str]]] = {}
+
+ # 'dist_files' is the list of (command, pyversion, file) that
+ # have been created by any dist commands run so far. This is
+ # filled regardless of whether the run is dry or not. pyversion
+ # gives sysconfig.get_python_version() if the dist file is
+ # specific to a Python version, 'any' if it is good for all
+ # Python versions on the target platform, and '' for a source
+ # file. pyversion should not be used to specify minimum or
+ # maximum required Python versions; use the metainfo for that
+ # instead.
+ self.dist_files: list[tuple[str, str, str]] = []
+
+ # These options are really the business of various commands, rather
+ # than of the Distribution itself. We provide aliases for them in
+ # Distribution as a convenience to the developer.
+ self.packages = None
+ self.package_data: dict[str, list[str]] = {}
+ self.package_dir = None
+ self.py_modules = None
+ self.libraries = None
+ self.headers = None
+ self.ext_modules = None
+ self.ext_package = None
+ self.include_dirs = None
+ self.extra_path = None
+ self.scripts = None
+ self.data_files = None
+ self.password = ''
+
+ # And now initialize bookkeeping stuff that can't be supplied by
+ # the caller at all. 'command_obj' maps command names to
+ # Command instances -- that's how we enforce that every command
+ # class is a singleton.
+ self.command_obj: dict[str, Command] = {}
+
+ # 'have_run' maps command names to boolean values; it keeps track
+ # of whether we have actually run a particular command, to make it
+ # cheap to "run" a command whenever we think we might need to -- if
+ # it's already been done, no need for expensive filesystem
+ # operations, we just check the 'have_run' dictionary and carry on.
+ # It's only safe to query 'have_run' for a command class that has
+ # been instantiated -- a false value will be inserted when the
+ # command object is created, and replaced with a true value when
+ # the command is successfully run. Thus it's probably best to use
+ # '.get()' rather than a straight lookup.
+ self.have_run: dict[str, bool] = {}
+
+ # Now we'll use the attrs dictionary (ultimately, keyword args from
+ # the setup script) to possibly override any or all of these
+ # distribution options.
+
+ if attrs:
+ # Pull out the set of command options and work on them
+ # specifically. Note that this order guarantees that aliased
+ # command options will override any supplied redundantly
+ # through the general options dictionary.
+ options = attrs.get('options')
+ if options is not None:
+ del attrs['options']
+ for command, cmd_options in options.items():
+ opt_dict = self.get_option_dict(command)
+ for opt, val in cmd_options.items():
+ opt_dict[opt] = ("setup script", val)
+
+ if 'licence' in attrs:
+ attrs['license'] = attrs['licence']
+ del attrs['licence']
+ msg = "'licence' distribution option is deprecated; use 'license'"
+ warnings.warn(msg)
+
+ # Now work on the rest of the attributes. Any attribute that's
+ # not already defined is invalid!
+ for key, val in attrs.items():
+ if hasattr(self.metadata, "set_" + key):
+ getattr(self.metadata, "set_" + key)(val)
+ elif hasattr(self.metadata, key):
+ setattr(self.metadata, key, val)
+ elif hasattr(self, key):
+ setattr(self, key, val)
+ else:
+ msg = f"Unknown distribution option: {key!r}"
+ warnings.warn(msg)
+
+ # no-user-cfg is handled before other command line args
+ # because other args override the config files, and this
+ # one is needed before we can load the config files.
+ # If attrs['script_args'] wasn't passed, assume false.
+ #
+ # This also make sure we just look at the global options
+ self.want_user_cfg = True
+
+ if self.script_args is not None:
+ # Coerce any possible iterable from attrs into a list
+ self.script_args = list(self.script_args)
+ for arg in self.script_args:
+ if not arg.startswith('-'):
+ break
+ if arg == '--no-user-cfg':
+ self.want_user_cfg = False
+ break
+
+ self.finalize_options()
+
+ def get_option_dict(self, command):
+ """Get the option dictionary for a given command. If that
+ command's option dictionary hasn't been created yet, then create it
+ and return the new dictionary; otherwise, return the existing
+ option dictionary.
+ """
+ dict = self.command_options.get(command)
+ if dict is None:
+ dict = self.command_options[command] = {}
+ return dict
+
+ def dump_option_dicts(self, header=None, commands=None, indent: str = "") -> None:
+ from pprint import pformat
+
+ if commands is None: # dump all command option dicts
+ commands = sorted(self.command_options.keys())
+
+ if header is not None:
+ self.announce(indent + header)
+ indent = indent + " "
+
+ if not commands:
+ self.announce(indent + "no commands known yet")
+ return
+
+ for cmd_name in commands:
+ opt_dict = self.command_options.get(cmd_name)
+ if opt_dict is None:
+ self.announce(indent + f"no option dict for '{cmd_name}' command")
+ else:
+ self.announce(indent + f"option dict for '{cmd_name}' command:")
+ out = pformat(opt_dict)
+ for line in out.split('\n'):
+ self.announce(indent + " " + line)
+
+ # -- Config file finding/parsing methods ---------------------------
+
+ def find_config_files(self):
+ """Find as many configuration files as should be processed for this
+ platform, and return a list of filenames in the order in which they
+ should be parsed. The filenames returned are guaranteed to exist
+ (modulo nasty race conditions).
+
+ There are multiple possible config files:
+ - distutils.cfg in the Distutils installation directory (i.e.
+ where the top-level Distutils __inst__.py file lives)
+ - a file in the user's home directory named .pydistutils.cfg
+ on Unix and pydistutils.cfg on Windows/Mac; may be disabled
+ with the ``--no-user-cfg`` option
+ - setup.cfg in the current directory
+ - a file named by an environment variable
+ """
+ check_environ()
+ files = [str(path) for path in self._gen_paths() if os.path.isfile(path)]
+
+ if DEBUG:
+ self.announce("using config files: {}".format(', '.join(files)))
+
+ return files
+
+ def _gen_paths(self):
+ # The system-wide Distutils config file
+ sys_dir = pathlib.Path(sys.modules['distutils'].__file__).parent
+ yield sys_dir / "distutils.cfg"
+
+ # The per-user config file
+ prefix = '.' * (os.name == 'posix')
+ filename = prefix + 'pydistutils.cfg'
+ if self.want_user_cfg:
+ with contextlib.suppress(RuntimeError):
+ yield pathlib.Path('~').expanduser() / filename
+
+ # All platforms support local setup.cfg
+ yield pathlib.Path('setup.cfg')
+
+ # Additional config indicated in the environment
+ with contextlib.suppress(TypeError):
+ yield pathlib.Path(os.getenv("DIST_EXTRA_CONFIG"))
+
+ def parse_config_files(self, filenames=None): # noqa: C901
+ from configparser import ConfigParser
+
+ # Ignore install directory options if we have a venv
+ if sys.prefix != sys.base_prefix:
+ ignore_options = [
+ 'install-base',
+ 'install-platbase',
+ 'install-lib',
+ 'install-platlib',
+ 'install-purelib',
+ 'install-headers',
+ 'install-scripts',
+ 'install-data',
+ 'prefix',
+ 'exec-prefix',
+ 'home',
+ 'user',
+ 'root',
+ ]
+ else:
+ ignore_options = []
+
+ ignore_options = frozenset(ignore_options)
+
+ if filenames is None:
+ filenames = self.find_config_files()
+
+ if DEBUG:
+ self.announce("Distribution.parse_config_files():")
+
+ parser = ConfigParser()
+ for filename in filenames:
+ if DEBUG:
+ self.announce(f" reading {filename}")
+ parser.read(filename, encoding='utf-8')
+ for section in parser.sections():
+ options = parser.options(section)
+ opt_dict = self.get_option_dict(section)
+
+ for opt in options:
+ if opt != '__name__' and opt not in ignore_options:
+ val = parser.get(section, opt)
+ opt = opt.replace('-', '_')
+ opt_dict[opt] = (filename, val)
+
+ # Make the ConfigParser forget everything (so we retain
+ # the original filenames that options come from)
+ parser.__init__()
+
+ # If there was a "global" section in the config file, use it
+ # to set Distribution options.
+
+ if 'global' in self.command_options:
+ for opt, (_src, val) in self.command_options['global'].items():
+ alias = self.negative_opt.get(opt)
+ try:
+ if alias:
+ setattr(self, alias, not strtobool(val))
+ elif opt in ('verbose', 'dry_run'): # ugh!
+ setattr(self, opt, strtobool(val))
+ else:
+ setattr(self, opt, val)
+ except ValueError as msg:
+ raise DistutilsOptionError(msg)
+
+ # -- Command-line parsing methods ----------------------------------
+
+ def parse_command_line(self):
+ """Parse the setup script's command line, taken from the
+ 'script_args' instance attribute (which defaults to 'sys.argv[1:]'
+ -- see 'setup()' in core.py). This list is first processed for
+ "global options" -- options that set attributes of the Distribution
+ instance. Then, it is alternately scanned for Distutils commands
+ and options for that command. Each new command terminates the
+ options for the previous command. The allowed options for a
+ command are determined by the 'user_options' attribute of the
+ command class -- thus, we have to be able to load command classes
+ in order to parse the command line. Any error in that 'options'
+ attribute raises DistutilsGetoptError; any error on the
+ command-line raises DistutilsArgError. If no Distutils commands
+ were found on the command line, raises DistutilsArgError. Return
+ true if command-line was successfully parsed and we should carry
+ on with executing commands; false if no errors but we shouldn't
+ execute commands (currently, this only happens if user asks for
+ help).
+ """
+ #
+ # We now have enough information to show the Macintosh dialog
+ # that allows the user to interactively specify the "command line".
+ #
+ toplevel_options = self._get_toplevel_options()
+
+ # We have to parse the command line a bit at a time -- global
+ # options, then the first command, then its options, and so on --
+ # because each command will be handled by a different class, and
+ # the options that are valid for a particular class aren't known
+ # until we have loaded the command class, which doesn't happen
+ # until we know what the command is.
+
+ self.commands = []
+ parser = FancyGetopt(toplevel_options + self.display_options)
+ parser.set_negative_aliases(self.negative_opt)
+ parser.set_aliases({'licence': 'license'})
+ args = parser.getopt(args=self.script_args, object=self)
+ option_order = parser.get_option_order()
+ logging.getLogger().setLevel(logging.WARN - 10 * self.verbose)
+
+ # for display options we return immediately
+ if self.handle_display_options(option_order):
+ return
+ while args:
+ args = self._parse_command_opts(parser, args)
+ if args is None: # user asked for help (and got it)
+ return
+
+ # Handle the cases of --help as a "global" option, ie.
+ # "setup.py --help" and "setup.py --help command ...". For the
+ # former, we show global options (--verbose, --dry-run, etc.)
+ # and display-only options (--name, --version, etc.); for the
+ # latter, we omit the display-only options and show help for
+ # each command listed on the command line.
+ if self.help:
+ self._show_help(
+ parser, display_options=len(self.commands) == 0, commands=self.commands
+ )
+ return
+
+ # Oops, no commands found -- an end-user error
+ if not self.commands:
+ raise DistutilsArgError("no commands supplied")
+
+ # All is well: return true
+ return True
+
+ def _get_toplevel_options(self):
+ """Return the non-display options recognized at the top level.
+
+ This includes options that are recognized *only* at the top
+ level as well as options recognized for commands.
+ """
+ return self.global_options + [
+ (
+ "command-packages=",
+ None,
+ "list of packages that provide distutils commands",
+ ),
+ ]
+
+ def _parse_command_opts(self, parser, args): # noqa: C901
+ """Parse the command-line options for a single command.
+ 'parser' must be a FancyGetopt instance; 'args' must be the list
+ of arguments, starting with the current command (whose options
+ we are about to parse). Returns a new version of 'args' with
+ the next command at the front of the list; will be the empty
+ list if there are no more commands on the command line. Returns
+ None if the user asked for help on this command.
+ """
+ # late import because of mutual dependence between these modules
+ from distutils.cmd import Command
+
+ # Pull the current command from the head of the command line
+ command = args[0]
+ if not command_re.match(command):
+ raise SystemExit(f"invalid command name '{command}'")
+ self.commands.append(command)
+
+ # Dig up the command class that implements this command, so we
+ # 1) know that it's a valid command, and 2) know which options
+ # it takes.
+ try:
+ cmd_class = self.get_command_class(command)
+ except DistutilsModuleError as msg:
+ raise DistutilsArgError(msg)
+
+ # Require that the command class be derived from Command -- want
+ # to be sure that the basic "command" interface is implemented.
+ if not issubclass(cmd_class, Command):
+ raise DistutilsClassError(
+ f"command class {cmd_class} must subclass Command"
+ )
+
+ # Also make sure that the command object provides a list of its
+ # known options.
+ if not (
+ hasattr(cmd_class, 'user_options')
+ and isinstance(cmd_class.user_options, list)
+ ):
+ msg = (
+ "command class %s must provide "
+ "'user_options' attribute (a list of tuples)"
+ )
+ raise DistutilsClassError(msg % cmd_class)
+
+ # If the command class has a list of negative alias options,
+ # merge it in with the global negative aliases.
+ negative_opt = self.negative_opt
+ if hasattr(cmd_class, 'negative_opt'):
+ negative_opt = negative_opt.copy()
+ negative_opt.update(cmd_class.negative_opt)
+
+ # Check for help_options in command class. They have a different
+ # format (tuple of four) so we need to preprocess them here.
+ if hasattr(cmd_class, 'help_options') and isinstance(
+ cmd_class.help_options, list
+ ):
+ help_options = fix_help_options(cmd_class.help_options)
+ else:
+ help_options = []
+
+ # All commands support the global options too, just by adding
+ # in 'global_options'.
+ parser.set_option_table(
+ self.global_options + cmd_class.user_options + help_options
+ )
+ parser.set_negative_aliases(negative_opt)
+ (args, opts) = parser.getopt(args[1:])
+ if hasattr(opts, 'help') and opts.help:
+ self._show_help(parser, display_options=False, commands=[cmd_class])
+ return
+
+ if hasattr(cmd_class, 'help_options') and isinstance(
+ cmd_class.help_options, list
+ ):
+ help_option_found = 0
+ for help_option, _short, _desc, func in cmd_class.help_options:
+ if hasattr(opts, parser.get_attr_name(help_option)):
+ help_option_found = 1
+ if callable(func):
+ func()
+ else:
+ raise DistutilsClassError(
+ f"invalid help function {func!r} for help option '{help_option}': "
+ "must be a callable object (function, etc.)"
+ )
+
+ if help_option_found:
+ return
+
+ # Put the options from the command-line into their official
+ # holding pen, the 'command_options' dictionary.
+ opt_dict = self.get_option_dict(command)
+ for name, value in vars(opts).items():
+ opt_dict[name] = ("command line", value)
+
+ return args
+
+ def finalize_options(self) -> None:
+ """Set final values for all the options on the Distribution
+ instance, analogous to the .finalize_options() method of Command
+ objects.
+ """
+ for attr in ('keywords', 'platforms'):
+ value = getattr(self.metadata, attr)
+ if value is None:
+ continue
+ if isinstance(value, str):
+ value = [elm.strip() for elm in value.split(',')]
+ setattr(self.metadata, attr, value)
+
+ def _show_help(
+ self, parser, global_options=True, display_options=True, commands: Iterable = ()
+ ):
+ """Show help for the setup script command-line in the form of
+ several lists of command-line options. 'parser' should be a
+ FancyGetopt instance; do not expect it to be returned in the
+ same state, as its option table will be reset to make it
+ generate the correct help text.
+
+ If 'global_options' is true, lists the global options:
+ --verbose, --dry-run, etc. If 'display_options' is true, lists
+ the "display-only" options: --name, --version, etc. Finally,
+ lists per-command help for every command name or command class
+ in 'commands'.
+ """
+ # late import because of mutual dependence between these modules
+ from distutils.cmd import Command
+ from distutils.core import gen_usage
+
+ if global_options:
+ if display_options:
+ options = self._get_toplevel_options()
+ else:
+ options = self.global_options
+ parser.set_option_table(options)
+ parser.print_help(self.common_usage + "\nGlobal options:")
+ print()
+
+ if display_options:
+ parser.set_option_table(self.display_options)
+ parser.print_help(
+ "Information display options (just display information, ignore any commands)"
+ )
+ print()
+
+ for command in commands:
+ if isinstance(command, type) and issubclass(command, Command):
+ klass = command
+ else:
+ klass = self.get_command_class(command)
+ if hasattr(klass, 'help_options') and isinstance(klass.help_options, list):
+ parser.set_option_table(
+ klass.user_options + fix_help_options(klass.help_options)
+ )
+ else:
+ parser.set_option_table(klass.user_options)
+ parser.print_help(f"Options for '{klass.__name__}' command:")
+ print()
+
+ print(gen_usage(self.script_name))
+
+ def handle_display_options(self, option_order):
+ """If there were any non-global "display-only" options
+ (--help-commands or the metadata display options) on the command
+ line, display the requested info and return true; else return
+ false.
+ """
+ from distutils.core import gen_usage
+
+ # User just wants a list of commands -- we'll print it out and stop
+ # processing now (ie. if they ran "setup --help-commands foo bar",
+ # we ignore "foo bar").
+ if self.help_commands:
+ self.print_commands()
+ print()
+ print(gen_usage(self.script_name))
+ return 1
+
+ # If user supplied any of the "display metadata" options, then
+ # display that metadata in the order in which the user supplied the
+ # metadata options.
+ any_display_options = 0
+ is_display_option = set()
+ for option in self.display_options:
+ is_display_option.add(option[0])
+
+ for opt, val in option_order:
+ if val and opt in is_display_option:
+ opt = translate_longopt(opt)
+ value = getattr(self.metadata, "get_" + opt)()
+ if opt in ('keywords', 'platforms'):
+ print(','.join(value))
+ elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'):
+ print('\n'.join(value))
+ else:
+ print(value)
+ any_display_options = 1
+
+ return any_display_options
+
+ def print_command_list(self, commands, header, max_length) -> None:
+ """Print a subset of the list of all commands -- used by
+ 'print_commands()'.
+ """
+ print(header + ":")
+
+ for cmd in commands:
+ klass = self.cmdclass.get(cmd)
+ if not klass:
+ klass = self.get_command_class(cmd)
+ try:
+ description = klass.description
+ except AttributeError:
+ description = "(no description available)"
+
+ print(f" {cmd:<{max_length}} {description}")
+
+ def print_commands(self) -> None:
+ """Print out a help message listing all available commands with a
+ description of each. The list is divided into "standard commands"
+ (listed in distutils.command.__all__) and "extra commands"
+ (mentioned in self.cmdclass, but not a standard command). The
+ descriptions come from the command class attribute
+ 'description'.
+ """
+ import distutils.command
+
+ std_commands = distutils.command.__all__
+ is_std = set(std_commands)
+
+ extra_commands = [cmd for cmd in self.cmdclass.keys() if cmd not in is_std]
+
+ max_length = 0
+ for cmd in std_commands + extra_commands:
+ if len(cmd) > max_length:
+ max_length = len(cmd)
+
+ self.print_command_list(std_commands, "Standard commands", max_length)
+ if extra_commands:
+ print()
+ self.print_command_list(extra_commands, "Extra commands", max_length)
+
+ def get_command_list(self):
+ """Get a list of (command, description) tuples.
+ The list is divided into "standard commands" (listed in
+ distutils.command.__all__) and "extra commands" (mentioned in
+ self.cmdclass, but not a standard command). The descriptions come
+ from the command class attribute 'description'.
+ """
+ # Currently this is only used on Mac OS, for the Mac-only GUI
+ # Distutils interface (by Jack Jansen)
+ import distutils.command
+
+ std_commands = distutils.command.__all__
+ is_std = set(std_commands)
+
+ extra_commands = [cmd for cmd in self.cmdclass.keys() if cmd not in is_std]
+
+ rv = []
+ for cmd in std_commands + extra_commands:
+ klass = self.cmdclass.get(cmd)
+ if not klass:
+ klass = self.get_command_class(cmd)
+ try:
+ description = klass.description
+ except AttributeError:
+ description = "(no description available)"
+ rv.append((cmd, description))
+ return rv
+
+ # -- Command class/object methods ----------------------------------
+
+ def get_command_packages(self):
+ """Return a list of packages from which commands are loaded."""
+ pkgs = self.command_packages
+ if not isinstance(pkgs, list):
+ if pkgs is None:
+ pkgs = ''
+ pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != '']
+ if "distutils.command" not in pkgs:
+ pkgs.insert(0, "distutils.command")
+ self.command_packages = pkgs
+ return pkgs
+
+ def get_command_class(self, command: str) -> type[Command]:
+ """Return the class that implements the Distutils command named by
+ 'command'. First we check the 'cmdclass' dictionary; if the
+ command is mentioned there, we fetch the class object from the
+ dictionary and return it. Otherwise we load the command module
+ ("distutils.command." + command) and fetch the command class from
+ the module. The loaded class is also stored in 'cmdclass'
+ to speed future calls to 'get_command_class()'.
+
+ Raises DistutilsModuleError if the expected module could not be
+ found, or if that module does not define the expected class.
+ """
+ klass = self.cmdclass.get(command)
+ if klass:
+ return klass
+
+ for pkgname in self.get_command_packages():
+ module_name = f"{pkgname}.{command}"
+ klass_name = command
+
+ try:
+ __import__(module_name)
+ module = sys.modules[module_name]
+ except ImportError:
+ continue
+
+ try:
+ klass = getattr(module, klass_name)
+ except AttributeError:
+ raise DistutilsModuleError(
+ f"invalid command '{command}' (no class '{klass_name}' in module '{module_name}')"
+ )
+
+ self.cmdclass[command] = klass
+ return klass
+
+ raise DistutilsModuleError(f"invalid command '{command}'")
+
+ @overload
+ def get_command_obj(
+ self, command: str, create: Literal[True] = True
+ ) -> Command: ...
+ @overload
+ def get_command_obj(
+ self, command: str, create: Literal[False]
+ ) -> Command | None: ...
+ def get_command_obj(self, command: str, create: bool = True) -> Command | None:
+ """Return the command object for 'command'. Normally this object
+ is cached on a previous call to 'get_command_obj()'; if no command
+ object for 'command' is in the cache, then we either create and
+ return it (if 'create' is true) or return None.
+ """
+ cmd_obj = self.command_obj.get(command)
+ if not cmd_obj and create:
+ if DEBUG:
+ self.announce(
+ "Distribution.get_command_obj(): "
+ f"creating '{command}' command object"
+ )
+
+ klass = self.get_command_class(command)
+ cmd_obj = self.command_obj[command] = klass(self)
+ self.have_run[command] = False
+
+ # Set any options that were supplied in config files
+ # or on the command line. (NB. support for error
+ # reporting is lame here: any errors aren't reported
+ # until 'finalize_options()' is called, which means
+ # we won't report the source of the error.)
+ options = self.command_options.get(command)
+ if options:
+ self._set_command_options(cmd_obj, options)
+
+ return cmd_obj
+
+ def _set_command_options(self, command_obj, option_dict=None): # noqa: C901
+ """Set the options for 'command_obj' from 'option_dict'. Basically
+ this means copying elements of a dictionary ('option_dict') to
+ attributes of an instance ('command').
+
+ 'command_obj' must be a Command instance. If 'option_dict' is not
+ supplied, uses the standard option dictionary for this command
+ (from 'self.command_options').
+ """
+ command_name = command_obj.get_command_name()
+ if option_dict is None:
+ option_dict = self.get_option_dict(command_name)
+
+ if DEBUG:
+ self.announce(f" setting options for '{command_name}' command:")
+ for option, (source, value) in option_dict.items():
+ if DEBUG:
+ self.announce(f" {option} = {value} (from {source})")
+ try:
+ bool_opts = [translate_longopt(o) for o in command_obj.boolean_options]
+ except AttributeError:
+ bool_opts = []
+ try:
+ neg_opt = command_obj.negative_opt
+ except AttributeError:
+ neg_opt = {}
+
+ try:
+ is_string = isinstance(value, str)
+ if option in neg_opt and is_string:
+ setattr(command_obj, neg_opt[option], not strtobool(value))
+ elif option in bool_opts and is_string:
+ setattr(command_obj, option, strtobool(value))
+ elif hasattr(command_obj, option):
+ setattr(command_obj, option, value)
+ else:
+ raise DistutilsOptionError(
+ f"error in {source}: command '{command_name}' has no such option '{option}'"
+ )
+ except ValueError as msg:
+ raise DistutilsOptionError(msg)
+
+ @overload
+ def reinitialize_command(
+ self, command: str, reinit_subcommands: bool = False
+ ) -> Command: ...
+ @overload
+ def reinitialize_command(
+ self, command: _CommandT, reinit_subcommands: bool = False
+ ) -> _CommandT: ...
+ def reinitialize_command(
+ self, command: str | Command, reinit_subcommands=False
+ ) -> Command:
+ """Reinitializes a command to the state it was in when first
+ returned by 'get_command_obj()': ie., initialized but not yet
+ finalized. This provides the opportunity to sneak option
+ values in programmatically, overriding or supplementing
+ user-supplied values from the config files and command line.
+ You'll have to re-finalize the command object (by calling
+ 'finalize_options()' or 'ensure_finalized()') before using it for
+ real.
+
+ 'command' should be a command name (string) or command object. If
+ 'reinit_subcommands' is true, also reinitializes the command's
+ sub-commands, as declared by the 'sub_commands' class attribute (if
+ it has one). See the "install" command for an example. Only
+ reinitializes the sub-commands that actually matter, ie. those
+ whose test predicates return true.
+
+ Returns the reinitialized command object.
+ """
+ from distutils.cmd import Command
+
+ if not isinstance(command, Command):
+ command_name = command
+ command = self.get_command_obj(command_name)
+ else:
+ command_name = command.get_command_name()
+
+ if not command.finalized:
+ return command
+ command.initialize_options()
+ command.finalized = False
+ self.have_run[command_name] = False
+ self._set_command_options(command)
+
+ if reinit_subcommands:
+ for sub in command.get_sub_commands():
+ self.reinitialize_command(sub, reinit_subcommands)
+
+ return command
+
+ # -- Methods that operate on the Distribution ----------------------
+
+ def announce(self, msg, level: int = logging.INFO) -> None:
+ log.log(level, msg)
+
+ def run_commands(self) -> None:
+ """Run each command that was seen on the setup script command line.
+ Uses the list of commands found and cache of command objects
+ created by 'get_command_obj()'.
+ """
+ for cmd in self.commands:
+ self.run_command(cmd)
+
+ # -- Methods that operate on its Commands --------------------------
+
+ def run_command(self, command: str) -> None:
+ """Do whatever it takes to run a command (including nothing at all,
+ if the command has already been run). Specifically: if we have
+ already created and run the command named by 'command', return
+ silently without doing anything. If the command named by 'command'
+ doesn't even have a command object yet, create one. Then invoke
+ 'run()' on that command object (or an existing one).
+ """
+ # Already been here, done that? then return silently.
+ if self.have_run.get(command):
+ return
+
+ log.info("running %s", command)
+ cmd_obj = self.get_command_obj(command)
+ cmd_obj.ensure_finalized()
+ cmd_obj.run()
+ self.have_run[command] = True
+
+ # -- Distribution query methods ------------------------------------
+
+ def has_pure_modules(self) -> bool:
+ return len(self.packages or self.py_modules or []) > 0
+
+ def has_ext_modules(self) -> bool:
+ return self.ext_modules and len(self.ext_modules) > 0
+
+ def has_c_libraries(self) -> bool:
+ return self.libraries and len(self.libraries) > 0
+
+ def has_modules(self) -> bool:
+ return self.has_pure_modules() or self.has_ext_modules()
+
+ def has_headers(self) -> bool:
+ return self.headers and len(self.headers) > 0
+
+ def has_scripts(self) -> bool:
+ return self.scripts and len(self.scripts) > 0
+
+ def has_data_files(self) -> bool:
+ return self.data_files and len(self.data_files) > 0
+
+ def is_pure(self) -> bool:
+ return (
+ self.has_pure_modules()
+ and not self.has_ext_modules()
+ and not self.has_c_libraries()
+ )
+
+ # -- Metadata query methods ----------------------------------------
+
+ # If you're looking for 'get_name()', 'get_version()', and so forth,
+ # they are defined in a sneaky way: the constructor binds self.get_XXX
+ # to self.metadata.get_XXX. The actual code is in the
+ # DistributionMetadata class, below.
+ if TYPE_CHECKING:
+ # Unfortunately this means we need to specify them manually or not expose statically
+ def _(self) -> None:
+ self.get_name = self.metadata.get_name
+ self.get_version = self.metadata.get_version
+ self.get_fullname = self.metadata.get_fullname
+ self.get_author = self.metadata.get_author
+ self.get_author_email = self.metadata.get_author_email
+ self.get_maintainer = self.metadata.get_maintainer
+ self.get_maintainer_email = self.metadata.get_maintainer_email
+ self.get_contact = self.metadata.get_contact
+ self.get_contact_email = self.metadata.get_contact_email
+ self.get_url = self.metadata.get_url
+ self.get_license = self.metadata.get_license
+ self.get_licence = self.metadata.get_licence
+ self.get_description = self.metadata.get_description
+ self.get_long_description = self.metadata.get_long_description
+ self.get_keywords = self.metadata.get_keywords
+ self.get_platforms = self.metadata.get_platforms
+ self.get_classifiers = self.metadata.get_classifiers
+ self.get_download_url = self.metadata.get_download_url
+ self.get_requires = self.metadata.get_requires
+ self.get_provides = self.metadata.get_provides
+ self.get_obsoletes = self.metadata.get_obsoletes
+
+ # Default attributes generated in __init__ from self.display_option_names
+ help_commands: bool
+ name: str | Literal[False]
+ version: str | Literal[False]
+ fullname: str | Literal[False]
+ author: str | Literal[False]
+ author_email: str | Literal[False]
+ maintainer: str | Literal[False]
+ maintainer_email: str | Literal[False]
+ contact: str | Literal[False]
+ contact_email: str | Literal[False]
+ url: str | Literal[False]
+ license: str | Literal[False]
+ licence: str | Literal[False]
+ description: str | Literal[False]
+ long_description: str | Literal[False]
+ platforms: str | list[str] | Literal[False]
+ classifiers: str | list[str] | Literal[False]
+ keywords: str | list[str] | Literal[False]
+ provides: list[str] | Literal[False]
+ requires: list[str] | Literal[False]
+ obsoletes: list[str] | Literal[False]
+
+
+class DistributionMetadata:
+ """Dummy class to hold the distribution meta-data: name, version,
+ author, and so forth.
+ """
+
+ _METHOD_BASENAMES = (
+ "name",
+ "version",
+ "author",
+ "author_email",
+ "maintainer",
+ "maintainer_email",
+ "url",
+ "license",
+ "description",
+ "long_description",
+ "keywords",
+ "platforms",
+ "fullname",
+ "contact",
+ "contact_email",
+ "classifiers",
+ "download_url",
+ # PEP 314
+ "provides",
+ "requires",
+ "obsoletes",
+ )
+
+ def __init__(
+ self, path: str | bytes | os.PathLike[str] | os.PathLike[bytes] | None = None
+ ) -> None:
+ if path is not None:
+ self.read_pkg_file(open(path))
+ else:
+ self.name: str | None = None
+ self.version: str | None = None
+ self.author: str | None = None
+ self.author_email: str | None = None
+ self.maintainer: str | None = None
+ self.maintainer_email: str | None = None
+ self.url: str | None = None
+ self.license: str | None = None
+ self.description: str | None = None
+ self.long_description: str | None = None
+ self.keywords: str | list[str] | None = None
+ self.platforms: str | list[str] | None = None
+ self.classifiers: str | list[str] | None = None
+ self.download_url: str | None = None
+ # PEP 314
+ self.provides: str | list[str] | None = None
+ self.requires: str | list[str] | None = None
+ self.obsoletes: str | list[str] | None = None
+
+ def read_pkg_file(self, file: IO[str]) -> None:
+ """Reads the metadata values from a file object."""
+ msg = message_from_file(file)
+
+ def _read_field(name: str) -> str | None:
+ value = msg[name]
+ if value and value != "UNKNOWN":
+ return value
+ return None
+
+ def _read_list(name):
+ values = msg.get_all(name, None)
+ if values == []:
+ return None
+ return values
+
+ metadata_version = msg['metadata-version']
+ self.name = _read_field('name')
+ self.version = _read_field('version')
+ self.description = _read_field('summary')
+ # we are filling author only.
+ self.author = _read_field('author')
+ self.maintainer = None
+ self.author_email = _read_field('author-email')
+ self.maintainer_email = None
+ self.url = _read_field('home-page')
+ self.license = _read_field('license')
+
+ if 'download-url' in msg:
+ self.download_url = _read_field('download-url')
+ else:
+ self.download_url = None
+
+ self.long_description = _read_field('description')
+ self.description = _read_field('summary')
+
+ if 'keywords' in msg:
+ self.keywords = _read_field('keywords').split(',')
+
+ self.platforms = _read_list('platform')
+ self.classifiers = _read_list('classifier')
+
+ # PEP 314 - these fields only exist in 1.1
+ if metadata_version == '1.1':
+ self.requires = _read_list('requires')
+ self.provides = _read_list('provides')
+ self.obsoletes = _read_list('obsoletes')
+ else:
+ self.requires = None
+ self.provides = None
+ self.obsoletes = None
+
+ def write_pkg_info(self, base_dir: str | os.PathLike[str]) -> None:
+ """Write the PKG-INFO file into the release tree."""
+ with open(
+ os.path.join(base_dir, 'PKG-INFO'), 'w', encoding='UTF-8'
+ ) as pkg_info:
+ self.write_pkg_file(pkg_info)
+
+ def write_pkg_file(self, file: SupportsWrite[str]) -> None:
+ """Write the PKG-INFO format data to a file object."""
+ version = '1.0'
+ if (
+ self.provides
+ or self.requires
+ or self.obsoletes
+ or self.classifiers
+ or self.download_url
+ ):
+ version = '1.1'
+
+ # required fields
+ file.write(f'Metadata-Version: {version}\n')
+ file.write(f'Name: {self.get_name()}\n')
+ file.write(f'Version: {self.get_version()}\n')
+
+ def maybe_write(header, val):
+ if val:
+ file.write(f"{header}: {val}\n")
+
+ # optional fields
+ maybe_write("Summary", self.get_description())
+ maybe_write("Home-page", self.get_url())
+ maybe_write("Author", self.get_contact())
+ maybe_write("Author-email", self.get_contact_email())
+ maybe_write("License", self.get_license())
+ maybe_write("Download-URL", self.download_url)
+ maybe_write("Description", rfc822_escape(self.get_long_description() or ""))
+ maybe_write("Keywords", ",".join(self.get_keywords()))
+
+ self._write_list(file, 'Platform', self.get_platforms())
+ self._write_list(file, 'Classifier', self.get_classifiers())
+
+ # PEP 314
+ self._write_list(file, 'Requires', self.get_requires())
+ self._write_list(file, 'Provides', self.get_provides())
+ self._write_list(file, 'Obsoletes', self.get_obsoletes())
+
+ def _write_list(self, file, name, values):
+ values = values or []
+ for value in values:
+ file.write(f'{name}: {value}\n')
+
+ # -- Metadata query methods ----------------------------------------
+
+ def get_name(self) -> str:
+ return self.name or "UNKNOWN"
+
+ def get_version(self) -> str:
+ return self.version or "0.0.0"
+
+ def get_fullname(self) -> str:
+ return self._fullname(self.get_name(), self.get_version())
+
+ @staticmethod
+ def _fullname(name: str, version: str) -> str:
+ """
+ >>> DistributionMetadata._fullname('setup.tools', '1.0-2')
+ 'setup_tools-1.0.post2'
+ >>> DistributionMetadata._fullname('setup-tools', '1.2post2')
+ 'setup_tools-1.2.post2'
+ >>> DistributionMetadata._fullname('setup-tools', '1.0-r2')
+ 'setup_tools-1.0.post2'
+ >>> DistributionMetadata._fullname('setup.tools', '1.0.post')
+ 'setup_tools-1.0.post0'
+ >>> DistributionMetadata._fullname('setup.tools', '1.0+ubuntu-1')
+ 'setup_tools-1.0+ubuntu.1'
+ """
+ return "{}-{}".format(
+ canonicalize_name(name).replace('-', '_'),
+ canonicalize_version(version, strip_trailing_zero=False),
+ )
+
+ def get_author(self) -> str | None:
+ return self.author
+
+ def get_author_email(self) -> str | None:
+ return self.author_email
+
+ def get_maintainer(self) -> str | None:
+ return self.maintainer
+
+ def get_maintainer_email(self) -> str | None:
+ return self.maintainer_email
+
+ def get_contact(self) -> str | None:
+ return self.maintainer or self.author
+
+ def get_contact_email(self) -> str | None:
+ return self.maintainer_email or self.author_email
+
+ def get_url(self) -> str | None:
+ return self.url
+
+ def get_license(self) -> str | None:
+ return self.license
+
+ get_licence = get_license
+
+ def get_description(self) -> str | None:
+ return self.description
+
+ def get_long_description(self) -> str | None:
+ return self.long_description
+
+ def get_keywords(self) -> str | list[str]:
+ return self.keywords or []
+
+ def set_keywords(self, value: str | Iterable[str]) -> None:
+ self.keywords = _ensure_list(value, 'keywords')
+
+ def get_platforms(self) -> str | list[str] | None:
+ return self.platforms
+
+ def set_platforms(self, value: str | Iterable[str]) -> None:
+ self.platforms = _ensure_list(value, 'platforms')
+
+ def get_classifiers(self) -> str | list[str]:
+ return self.classifiers or []
+
+ def set_classifiers(self, value: str | Iterable[str]) -> None:
+ self.classifiers = _ensure_list(value, 'classifiers')
+
+ def get_download_url(self) -> str | None:
+ return self.download_url
+
+ # PEP 314
+ def get_requires(self) -> str | list[str]:
+ return self.requires or []
+
+ def set_requires(self, value: Iterable[str]) -> None:
+ import distutils.versionpredicate
+
+ for v in value:
+ distutils.versionpredicate.VersionPredicate(v)
+ self.requires = list(value)
+
+ def get_provides(self) -> str | list[str]:
+ return self.provides or []
+
+ def set_provides(self, value: Iterable[str]) -> None:
+ value = [v.strip() for v in value]
+ for v in value:
+ import distutils.versionpredicate
+
+ distutils.versionpredicate.split_provision(v)
+ self.provides = value
+
+ def get_obsoletes(self) -> str | list[str]:
+ return self.obsoletes or []
+
+ def set_obsoletes(self, value: Iterable[str]) -> None:
+ import distutils.versionpredicate
+
+ for v in value:
+ distutils.versionpredicate.VersionPredicate(v)
+ self.obsoletes = list(value)
+
+
+def fix_help_options(options):
+ """Convert a 4-tuple 'help_options' list as found in various command
+ classes to the 3-tuple form required by FancyGetopt.
+ """
+ return [opt[0:3] for opt in options]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/errors.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/errors.py
new file mode 100644
index 0000000000000000000000000000000000000000..409d21faa2caeb8a53fed10e4266f7cccc764d23
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/errors.py
@@ -0,0 +1,108 @@
+"""
+Exceptions used by the Distutils modules.
+
+Distutils modules may raise these or standard exceptions,
+including :exc:`SystemExit`.
+"""
+
+# compiler exceptions aliased for compatibility
+from .compilers.C.errors import CompileError as CompileError
+from .compilers.C.errors import Error as _Error
+from .compilers.C.errors import LibError as LibError
+from .compilers.C.errors import LinkError as LinkError
+from .compilers.C.errors import PreprocessError as PreprocessError
+from .compilers.C.errors import UnknownFileType as _UnknownFileType
+
+CCompilerError = _Error
+UnknownFileError = _UnknownFileType
+
+
+class DistutilsError(Exception):
+ """The root of all Distutils evil."""
+
+ pass
+
+
+class DistutilsModuleError(DistutilsError):
+ """Unable to load an expected module, or to find an expected class
+ within some module (in particular, command modules and classes)."""
+
+ pass
+
+
+class DistutilsClassError(DistutilsError):
+ """Some command class (or possibly distribution class, if anyone
+ feels a need to subclass Distribution) is found not to be holding
+ up its end of the bargain, ie. implementing some part of the
+ "command "interface."""
+
+ pass
+
+
+class DistutilsGetoptError(DistutilsError):
+ """The option table provided to 'fancy_getopt()' is bogus."""
+
+ pass
+
+
+class DistutilsArgError(DistutilsError):
+ """Raised by fancy_getopt in response to getopt.error -- ie. an
+ error in the command line usage."""
+
+ pass
+
+
+class DistutilsFileError(DistutilsError):
+ """Any problems in the filesystem: expected file not found, etc.
+ Typically this is for problems that we detect before OSError
+ could be raised."""
+
+ pass
+
+
+class DistutilsOptionError(DistutilsError):
+ """Syntactic/semantic errors in command options, such as use of
+ mutually conflicting options, or inconsistent options,
+ badly-spelled values, etc. No distinction is made between option
+ values originating in the setup script, the command line, config
+ files, or what-have-you -- but if we *know* something originated in
+ the setup script, we'll raise DistutilsSetupError instead."""
+
+ pass
+
+
+class DistutilsSetupError(DistutilsError):
+ """For errors that can be definitely blamed on the setup script,
+ such as invalid keyword arguments to 'setup()'."""
+
+ pass
+
+
+class DistutilsPlatformError(DistutilsError):
+ """We don't know how to do something on the current platform (but
+ we do know how to do it on some platform) -- eg. trying to compile
+ C files on a platform not supported by a CCompiler subclass."""
+
+ pass
+
+
+class DistutilsExecError(DistutilsError):
+ """Any problems executing an external program (such as the C
+ compiler, when compiling C files)."""
+
+ pass
+
+
+class DistutilsInternalError(DistutilsError):
+ """Internal inconsistencies or impossibilities (obviously, this
+ should never be seen if the code is working!)."""
+
+ pass
+
+
+class DistutilsTemplateError(DistutilsError):
+ """Syntax error in a file list template."""
+
+
+class DistutilsByteCompileError(DistutilsError):
+ """Byte compile error."""
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/extension.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/extension.py
new file mode 100644
index 0000000000000000000000000000000000000000..f51411266e4047275280d883b75e7103af21faef
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/extension.py
@@ -0,0 +1,258 @@
+"""distutils.extension
+
+Provides the Extension class, used to describe C/C++ extension
+modules in setup scripts."""
+
+from __future__ import annotations
+
+import os
+import warnings
+from collections.abc import Iterable
+
+# This class is really only used by the "build_ext" command, so it might
+# make sense to put it in distutils.command.build_ext. However, that
+# module is already big enough, and I want to make this class a bit more
+# complex to simplify some common cases ("foo" module in "foo.c") and do
+# better error-checking ("foo.c" actually exists).
+#
+# Also, putting this in build_ext.py means every setup script would have to
+# import that large-ish module (indirectly, through distutils.core) in
+# order to do anything.
+
+
+class Extension:
+ """Just a collection of attributes that describes an extension
+ module and everything needed to build it (hopefully in a portable
+ way, but there are hooks that let you be as unportable as you need).
+
+ Instance attributes:
+ name : string
+ the full name of the extension, including any packages -- ie.
+ *not* a filename or pathname, but Python dotted name
+ sources : Iterable[string | os.PathLike]
+ iterable of source filenames (except strings, which could be misinterpreted
+ as a single filename), relative to the distribution root (where the setup
+ script lives), in Unix form (slash-separated) for portability. Can be any
+ non-string iterable (list, tuple, set, etc.) containing strings or
+ PathLike objects. Source files may be C, C++, SWIG (.i), platform-specific
+ resource files, or whatever else is recognized by the "build_ext" command
+ as source for a Python extension.
+ include_dirs : [string]
+ list of directories to search for C/C++ header files (in Unix
+ form for portability)
+ define_macros : [(name : string, value : string|None)]
+ list of macros to define; each macro is defined using a 2-tuple,
+ where 'value' is either the string to define it to or None to
+ define it without a particular value (equivalent of "#define
+ FOO" in source or -DFOO on Unix C compiler command line)
+ undef_macros : [string]
+ list of macros to undefine explicitly
+ library_dirs : [string]
+ list of directories to search for C/C++ libraries at link time
+ libraries : [string]
+ list of library names (not filenames or paths) to link against
+ runtime_library_dirs : [string]
+ list of directories to search for C/C++ libraries at run time
+ (for shared extensions, this is when the extension is loaded)
+ extra_objects : [string]
+ list of extra files to link with (eg. object files not implied
+ by 'sources', static library that must be explicitly specified,
+ binary resource files, etc.)
+ extra_compile_args : [string]
+ any extra platform- and compiler-specific information to use
+ when compiling the source files in 'sources'. For platforms and
+ compilers where "command line" makes sense, this is typically a
+ list of command-line arguments, but for other platforms it could
+ be anything.
+ extra_link_args : [string]
+ any extra platform- and compiler-specific information to use
+ when linking object files together to create the extension (or
+ to create a new static Python interpreter). Similar
+ interpretation as for 'extra_compile_args'.
+ export_symbols : [string]
+ list of symbols to be exported from a shared extension. Not
+ used on all platforms, and not generally necessary for Python
+ extensions, which typically export exactly one symbol: "init" +
+ extension_name.
+ swig_opts : [string]
+ any extra options to pass to SWIG if a source file has the .i
+ extension.
+ depends : [string]
+ list of files that the extension depends on
+ language : string
+ extension language (i.e. "c", "c++", "objc"). Will be detected
+ from the source extensions if not provided.
+ optional : boolean
+ specifies that a build failure in the extension should not abort the
+ build process, but simply not install the failing extension.
+ """
+
+ # When adding arguments to this constructor, be sure to update
+ # setup_keywords in core.py.
+ def __init__(
+ self,
+ name: str,
+ sources: Iterable[str | os.PathLike[str]],
+ include_dirs: list[str] | None = None,
+ define_macros: list[tuple[str, str | None]] | None = None,
+ undef_macros: list[str] | None = None,
+ library_dirs: list[str] | None = None,
+ libraries: list[str] | None = None,
+ runtime_library_dirs: list[str] | None = None,
+ extra_objects: list[str] | None = None,
+ extra_compile_args: list[str] | None = None,
+ extra_link_args: list[str] | None = None,
+ export_symbols: list[str] | None = None,
+ swig_opts: list[str] | None = None,
+ depends: list[str] | None = None,
+ language: str | None = None,
+ optional: bool | None = None,
+ **kw, # To catch unknown keywords
+ ):
+ if not isinstance(name, str):
+ raise TypeError("'name' must be a string")
+
+ # handle the string case first; since strings are iterable, disallow them
+ if isinstance(sources, str):
+ raise TypeError(
+ "'sources' must be an iterable of strings or PathLike objects, not a string"
+ )
+
+ # now we check if it's iterable and contains valid types
+ try:
+ self.sources = list(map(os.fspath, sources))
+ except TypeError:
+ raise TypeError(
+ "'sources' must be an iterable of strings or PathLike objects"
+ )
+
+ self.name = name
+ self.include_dirs = include_dirs or []
+ self.define_macros = define_macros or []
+ self.undef_macros = undef_macros or []
+ self.library_dirs = library_dirs or []
+ self.libraries = libraries or []
+ self.runtime_library_dirs = runtime_library_dirs or []
+ self.extra_objects = extra_objects or []
+ self.extra_compile_args = extra_compile_args or []
+ self.extra_link_args = extra_link_args or []
+ self.export_symbols = export_symbols or []
+ self.swig_opts = swig_opts or []
+ self.depends = depends or []
+ self.language = language
+ self.optional = optional
+
+ # If there are unknown keyword options, warn about them
+ if len(kw) > 0:
+ options = [repr(option) for option in kw]
+ options = ', '.join(sorted(options))
+ msg = f"Unknown Extension options: {options}"
+ warnings.warn(msg)
+
+ def __repr__(self):
+ return f'<{self.__class__.__module__}.{self.__class__.__qualname__}({self.name!r}) at {id(self):#x}>'
+
+
+def read_setup_file(filename): # noqa: C901
+ """Reads a Setup file and returns Extension instances."""
+ from distutils.sysconfig import _variable_rx, expand_makefile_vars, parse_makefile
+ from distutils.text_file import TextFile
+ from distutils.util import split_quoted
+
+ # First pass over the file to gather "VAR = VALUE" assignments.
+ vars = parse_makefile(filename)
+
+ # Second pass to gobble up the real content: lines of the form
+ # ... [ ...] [ ...] [ ...]
+ file = TextFile(
+ filename,
+ strip_comments=True,
+ skip_blanks=True,
+ join_lines=True,
+ lstrip_ws=True,
+ rstrip_ws=True,
+ )
+ try:
+ extensions = []
+
+ while True:
+ line = file.readline()
+ if line is None: # eof
+ break
+ if _variable_rx.match(line): # VAR=VALUE, handled in first pass
+ continue
+
+ if line[0] == line[-1] == "*":
+ file.warn(f"'{line}' lines not handled yet")
+ continue
+
+ line = expand_makefile_vars(line, vars)
+ words = split_quoted(line)
+
+ # NB. this parses a slightly different syntax than the old
+ # makesetup script: here, there must be exactly one extension per
+ # line, and it must be the first word of the line. I have no idea
+ # why the old syntax supported multiple extensions per line, as
+ # they all wind up being the same.
+
+ module = words[0]
+ ext = Extension(module, [])
+ append_next_word = None
+
+ for word in words[1:]:
+ if append_next_word is not None:
+ append_next_word.append(word)
+ append_next_word = None
+ continue
+
+ suffix = os.path.splitext(word)[1]
+ switch = word[0:2]
+ value = word[2:]
+
+ if suffix in (".c", ".cc", ".cpp", ".cxx", ".c++", ".m", ".mm"):
+ # hmm, should we do something about C vs. C++ sources?
+ # or leave it up to the CCompiler implementation to
+ # worry about?
+ ext.sources.append(word)
+ elif switch == "-I":
+ ext.include_dirs.append(value)
+ elif switch == "-D":
+ equals = value.find("=")
+ if equals == -1: # bare "-DFOO" -- no value
+ ext.define_macros.append((value, None))
+ else: # "-DFOO=blah"
+ ext.define_macros.append((value[0:equals], value[equals + 2 :]))
+ elif switch == "-U":
+ ext.undef_macros.append(value)
+ elif switch == "-C": # only here 'cause makesetup has it!
+ ext.extra_compile_args.append(word)
+ elif switch == "-l":
+ ext.libraries.append(value)
+ elif switch == "-L":
+ ext.library_dirs.append(value)
+ elif switch == "-R":
+ ext.runtime_library_dirs.append(value)
+ elif word == "-rpath":
+ append_next_word = ext.runtime_library_dirs
+ elif word == "-Xlinker":
+ append_next_word = ext.extra_link_args
+ elif word == "-Xcompiler":
+ append_next_word = ext.extra_compile_args
+ elif switch == "-u":
+ ext.extra_link_args.append(word)
+ if not value:
+ append_next_word = ext.extra_link_args
+ elif suffix in (".a", ".so", ".sl", ".o", ".dylib"):
+ # NB. a really faithful emulation of makesetup would
+ # append a .o file to extra_objects only if it
+ # had a slash in it; otherwise, it would s/.o/.c/
+ # and append it to sources. Hmmmm.
+ ext.extra_objects.append(word)
+ else:
+ file.warn(f"unrecognized argument '{word}'")
+
+ extensions.append(ext)
+ finally:
+ file.close()
+
+ return extensions
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/fancy_getopt.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/fancy_getopt.py
new file mode 100644
index 0000000000000000000000000000000000000000..1a1d3a05da544b98ff84d03ecbee1185b2eb45f7
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/fancy_getopt.py
@@ -0,0 +1,471 @@
+"""distutils.fancy_getopt
+
+Wrapper around the standard getopt module that provides the following
+additional features:
+ * short and long options are tied together
+ * options have help strings, so fancy_getopt could potentially
+ create a complete usage summary
+ * options set attributes of a passed-in object
+"""
+
+from __future__ import annotations
+
+import getopt
+import re
+import string
+import sys
+from collections.abc import Sequence
+from typing import Any
+
+from .errors import DistutilsArgError, DistutilsGetoptError
+
+# Much like command_re in distutils.core, this is close to but not quite
+# the same as a Python NAME -- except, in the spirit of most GNU
+# utilities, we use '-' in place of '_'. (The spirit of LISP lives on!)
+# The similarities to NAME are again not a coincidence...
+longopt_pat = r'[a-zA-Z](?:[a-zA-Z0-9-]*)'
+longopt_re = re.compile(rf'^{longopt_pat}$')
+
+# For recognizing "negative alias" options, eg. "quiet=!verbose"
+neg_alias_re = re.compile(f"^({longopt_pat})=!({longopt_pat})$")
+
+# This is used to translate long options to legitimate Python identifiers
+# (for use as attributes of some object).
+longopt_xlate = str.maketrans('-', '_')
+
+
+class FancyGetopt:
+ """Wrapper around the standard 'getopt()' module that provides some
+ handy extra functionality:
+ * short and long options are tied together
+ * options have help strings, and help text can be assembled
+ from them
+ * options set attributes of a passed-in object
+ * boolean options can have "negative aliases" -- eg. if
+ --quiet is the "negative alias" of --verbose, then "--quiet"
+ on the command line sets 'verbose' to false
+ """
+
+ def __init__(self, option_table=None):
+ # The option table is (currently) a list of tuples. The
+ # tuples may have 3 or four values:
+ # (long_option, short_option, help_string [, repeatable])
+ # if an option takes an argument, its long_option should have '='
+ # appended; short_option should just be a single character, no ':'
+ # in any case. If a long_option doesn't have a corresponding
+ # short_option, short_option should be None. All option tuples
+ # must have long options.
+ self.option_table = option_table
+
+ # 'option_index' maps long option names to entries in the option
+ # table (ie. those 3-tuples).
+ self.option_index = {}
+ if self.option_table:
+ self._build_index()
+
+ # 'alias' records (duh) alias options; {'foo': 'bar'} means
+ # --foo is an alias for --bar
+ self.alias = {}
+
+ # 'negative_alias' keeps track of options that are the boolean
+ # opposite of some other option
+ self.negative_alias = {}
+
+ # These keep track of the information in the option table. We
+ # don't actually populate these structures until we're ready to
+ # parse the command-line, since the 'option_table' passed in here
+ # isn't necessarily the final word.
+ self.short_opts = []
+ self.long_opts = []
+ self.short2long = {}
+ self.attr_name = {}
+ self.takes_arg = {}
+
+ # And 'option_order' is filled up in 'getopt()'; it records the
+ # original order of options (and their values) on the command-line,
+ # but expands short options, converts aliases, etc.
+ self.option_order = []
+
+ def _build_index(self):
+ self.option_index.clear()
+ for option in self.option_table:
+ self.option_index[option[0]] = option
+
+ def set_option_table(self, option_table):
+ self.option_table = option_table
+ self._build_index()
+
+ def add_option(self, long_option, short_option=None, help_string=None):
+ if long_option in self.option_index:
+ raise DistutilsGetoptError(
+ f"option conflict: already an option '{long_option}'"
+ )
+ else:
+ option = (long_option, short_option, help_string)
+ self.option_table.append(option)
+ self.option_index[long_option] = option
+
+ def has_option(self, long_option):
+ """Return true if the option table for this parser has an
+ option with long name 'long_option'."""
+ return long_option in self.option_index
+
+ def get_attr_name(self, long_option):
+ """Translate long option name 'long_option' to the form it
+ has as an attribute of some object: ie., translate hyphens
+ to underscores."""
+ return long_option.translate(longopt_xlate)
+
+ def _check_alias_dict(self, aliases, what):
+ assert isinstance(aliases, dict)
+ for alias, opt in aliases.items():
+ if alias not in self.option_index:
+ raise DistutilsGetoptError(
+ f"invalid {what} '{alias}': option '{alias}' not defined"
+ )
+ if opt not in self.option_index:
+ raise DistutilsGetoptError(
+ f"invalid {what} '{alias}': aliased option '{opt}' not defined"
+ )
+
+ def set_aliases(self, alias):
+ """Set the aliases for this option parser."""
+ self._check_alias_dict(alias, "alias")
+ self.alias = alias
+
+ def set_negative_aliases(self, negative_alias):
+ """Set the negative aliases for this option parser.
+ 'negative_alias' should be a dictionary mapping option names to
+ option names, both the key and value must already be defined
+ in the option table."""
+ self._check_alias_dict(negative_alias, "negative alias")
+ self.negative_alias = negative_alias
+
+ def _grok_option_table(self): # noqa: C901
+ """Populate the various data structures that keep tabs on the
+ option table. Called by 'getopt()' before it can do anything
+ worthwhile.
+ """
+ self.long_opts = []
+ self.short_opts = []
+ self.short2long.clear()
+ self.repeat = {}
+
+ for option in self.option_table:
+ if len(option) == 3:
+ long, short, help = option
+ repeat = 0
+ elif len(option) == 4:
+ long, short, help, repeat = option
+ else:
+ # the option table is part of the code, so simply
+ # assert that it is correct
+ raise ValueError(f"invalid option tuple: {option!r}")
+
+ # Type- and value-check the option names
+ if not isinstance(long, str) or len(long) < 2:
+ raise DistutilsGetoptError(
+ f"invalid long option '{long}': must be a string of length >= 2"
+ )
+
+ if not ((short is None) or (isinstance(short, str) and len(short) == 1)):
+ raise DistutilsGetoptError(
+ f"invalid short option '{short}': must a single character or None"
+ )
+
+ self.repeat[long] = repeat
+ self.long_opts.append(long)
+
+ if long[-1] == '=': # option takes an argument?
+ if short:
+ short = short + ':'
+ long = long[0:-1]
+ self.takes_arg[long] = True
+ else:
+ # Is option is a "negative alias" for some other option (eg.
+ # "quiet" == "!verbose")?
+ alias_to = self.negative_alias.get(long)
+ if alias_to is not None:
+ if self.takes_arg[alias_to]:
+ raise DistutilsGetoptError(
+ f"invalid negative alias '{long}': "
+ f"aliased option '{alias_to}' takes a value"
+ )
+
+ self.long_opts[-1] = long # XXX redundant?!
+ self.takes_arg[long] = False
+
+ # If this is an alias option, make sure its "takes arg" flag is
+ # the same as the option it's aliased to.
+ alias_to = self.alias.get(long)
+ if alias_to is not None:
+ if self.takes_arg[long] != self.takes_arg[alias_to]:
+ raise DistutilsGetoptError(
+ f"invalid alias '{long}': inconsistent with "
+ f"aliased option '{alias_to}' (one of them takes a value, "
+ "the other doesn't"
+ )
+
+ # Now enforce some bondage on the long option name, so we can
+ # later translate it to an attribute name on some object. Have
+ # to do this a bit late to make sure we've removed any trailing
+ # '='.
+ if not longopt_re.match(long):
+ raise DistutilsGetoptError(
+ f"invalid long option name '{long}' "
+ "(must be letters, numbers, hyphens only"
+ )
+
+ self.attr_name[long] = self.get_attr_name(long)
+ if short:
+ self.short_opts.append(short)
+ self.short2long[short[0]] = long
+
+ def getopt(self, args: Sequence[str] | None = None, object=None): # noqa: C901
+ """Parse command-line options in args. Store as attributes on object.
+
+ If 'args' is None or not supplied, uses 'sys.argv[1:]'. If
+ 'object' is None or not supplied, creates a new OptionDummy
+ object, stores option values there, and returns a tuple (args,
+ object). If 'object' is supplied, it is modified in place and
+ 'getopt()' just returns 'args'; in both cases, the returned
+ 'args' is a modified copy of the passed-in 'args' list, which
+ is left untouched.
+ """
+ if args is None:
+ args = sys.argv[1:]
+ if object is None:
+ object = OptionDummy()
+ created_object = True
+ else:
+ created_object = False
+
+ self._grok_option_table()
+
+ short_opts = ' '.join(self.short_opts)
+ try:
+ opts, args = getopt.getopt(args, short_opts, self.long_opts)
+ except getopt.error as msg:
+ raise DistutilsArgError(msg)
+
+ for opt, val in opts:
+ if len(opt) == 2 and opt[0] == '-': # it's a short option
+ opt = self.short2long[opt[1]]
+ else:
+ assert len(opt) > 2 and opt[:2] == '--'
+ opt = opt[2:]
+
+ alias = self.alias.get(opt)
+ if alias:
+ opt = alias
+
+ if not self.takes_arg[opt]: # boolean option?
+ assert val == '', "boolean option can't have value"
+ alias = self.negative_alias.get(opt)
+ if alias:
+ opt = alias
+ val = 0
+ else:
+ val = 1
+
+ attr = self.attr_name[opt]
+ # The only repeating option at the moment is 'verbose'.
+ # It has a negative option -q quiet, which should set verbose = False.
+ if val and self.repeat.get(attr) is not None:
+ val = getattr(object, attr, 0) + 1
+ setattr(object, attr, val)
+ self.option_order.append((opt, val))
+
+ # for opts
+ if created_object:
+ return args, object
+ else:
+ return args
+
+ def get_option_order(self):
+ """Returns the list of (option, value) tuples processed by the
+ previous run of 'getopt()'. Raises RuntimeError if
+ 'getopt()' hasn't been called yet.
+ """
+ if self.option_order is None:
+ raise RuntimeError("'getopt()' hasn't been called yet")
+ else:
+ return self.option_order
+
+ def generate_help(self, header=None): # noqa: C901
+ """Generate help text (a list of strings, one per suggested line of
+ output) from the option table for this FancyGetopt object.
+ """
+ # Blithely assume the option table is good: probably wouldn't call
+ # 'generate_help()' unless you've already called 'getopt()'.
+
+ # First pass: determine maximum length of long option names
+ max_opt = 0
+ for option in self.option_table:
+ long = option[0]
+ short = option[1]
+ ell = len(long)
+ if long[-1] == '=':
+ ell = ell - 1
+ if short is not None:
+ ell = ell + 5 # " (-x)" where short == 'x'
+ if ell > max_opt:
+ max_opt = ell
+
+ opt_width = max_opt + 2 + 2 + 2 # room for indent + dashes + gutter
+
+ # Typical help block looks like this:
+ # --foo controls foonabulation
+ # Help block for longest option looks like this:
+ # --flimflam set the flim-flam level
+ # and with wrapped text:
+ # --flimflam set the flim-flam level (must be between
+ # 0 and 100, except on Tuesdays)
+ # Options with short names will have the short name shown (but
+ # it doesn't contribute to max_opt):
+ # --foo (-f) controls foonabulation
+ # If adding the short option would make the left column too wide,
+ # we push the explanation off to the next line
+ # --flimflam (-l)
+ # set the flim-flam level
+ # Important parameters:
+ # - 2 spaces before option block start lines
+ # - 2 dashes for each long option name
+ # - min. 2 spaces between option and explanation (gutter)
+ # - 5 characters (incl. space) for short option name
+
+ # Now generate lines of help text. (If 80 columns were good enough
+ # for Jesus, then 78 columns are good enough for me!)
+ line_width = 78
+ text_width = line_width - opt_width
+ big_indent = ' ' * opt_width
+ if header:
+ lines = [header]
+ else:
+ lines = ['Option summary:']
+
+ for option in self.option_table:
+ long, short, help = option[:3]
+ text = wrap_text(help, text_width)
+ if long[-1] == '=':
+ long = long[0:-1]
+
+ # Case 1: no short option at all (makes life easy)
+ if short is None:
+ if text:
+ lines.append(f" --{long:<{max_opt}} {text[0]}")
+ else:
+ lines.append(f" --{long:<{max_opt}}")
+
+ # Case 2: we have a short option, so we have to include it
+ # just after the long option
+ else:
+ opt_names = f"{long} (-{short})"
+ if text:
+ lines.append(f" --{opt_names:<{max_opt}} {text[0]}")
+ else:
+ lines.append(f" --{opt_names:<{max_opt}}")
+
+ for ell in text[1:]:
+ lines.append(big_indent + ell)
+ return lines
+
+ def print_help(self, header=None, file=None):
+ if file is None:
+ file = sys.stdout
+ for line in self.generate_help(header):
+ file.write(line + "\n")
+
+
+def fancy_getopt(options, negative_opt, object, args: Sequence[str] | None):
+ parser = FancyGetopt(options)
+ parser.set_negative_aliases(negative_opt)
+ return parser.getopt(args, object)
+
+
+WS_TRANS = {ord(_wschar): ' ' for _wschar in string.whitespace}
+
+
+def wrap_text(text, width):
+ """wrap_text(text : string, width : int) -> [string]
+
+ Split 'text' into multiple lines of no more than 'width' characters
+ each, and return the list of strings that results.
+ """
+ if text is None:
+ return []
+ if len(text) <= width:
+ return [text]
+
+ text = text.expandtabs()
+ text = text.translate(WS_TRANS)
+ chunks = re.split(r'( +|-+)', text)
+ chunks = [ch for ch in chunks if ch] # ' - ' results in empty strings
+ lines = []
+
+ while chunks:
+ cur_line = [] # list of chunks (to-be-joined)
+ cur_len = 0 # length of current line
+
+ while chunks:
+ ell = len(chunks[0])
+ if cur_len + ell <= width: # can squeeze (at least) this chunk in
+ cur_line.append(chunks[0])
+ del chunks[0]
+ cur_len = cur_len + ell
+ else: # this line is full
+ # drop last chunk if all space
+ if cur_line and cur_line[-1][0] == ' ':
+ del cur_line[-1]
+ break
+
+ if chunks: # any chunks left to process?
+ # if the current line is still empty, then we had a single
+ # chunk that's too big too fit on a line -- so we break
+ # down and break it up at the line width
+ if cur_len == 0:
+ cur_line.append(chunks[0][0:width])
+ chunks[0] = chunks[0][width:]
+
+ # all-whitespace chunks at the end of a line can be discarded
+ # (and we know from the re.split above that if a chunk has
+ # *any* whitespace, it is *all* whitespace)
+ if chunks[0][0] == ' ':
+ del chunks[0]
+
+ # and store this line in the list-of-all-lines -- as a single
+ # string, of course!
+ lines.append(''.join(cur_line))
+
+ return lines
+
+
+def translate_longopt(opt):
+ """Convert a long option name to a valid Python identifier by
+ changing "-" to "_".
+ """
+ return opt.translate(longopt_xlate)
+
+
+class OptionDummy:
+ """Dummy class just used as a place to hold command-line option
+ values as instance attributes."""
+
+ def __init__(self, options: Sequence[Any] = []):
+ """Create a new OptionDummy instance. The attributes listed in
+ 'options' will be initialized to None."""
+ for opt in options:
+ setattr(self, opt, None)
+
+
+if __name__ == "__main__":
+ text = """\
+Tra-la-la, supercalifragilisticexpialidocious.
+How *do* you spell that odd word, anyways?
+(Someone ask Mary -- she'll know [or she'll
+say, "How should I know?"].)"""
+
+ for w in (10, 20, 30, 40):
+ print(f"width: {w}")
+ print("\n".join(wrap_text(text, w)))
+ print()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/file_util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/file_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..0acc8cb84bd4d28363c4e33e7ff18d691bebfa48
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/file_util.py
@@ -0,0 +1,236 @@
+"""distutils.file_util
+
+Utility functions for operating on single files.
+"""
+
+import os
+
+from ._log import log
+from .errors import DistutilsFileError
+
+# for generating verbose output in 'copy_file()'
+_copy_action = {None: 'copying', 'hard': 'hard linking', 'sym': 'symbolically linking'}
+
+
+def _copy_file_contents(src, dst, buffer_size=16 * 1024): # noqa: C901
+ """Copy the file 'src' to 'dst'; both must be filenames. Any error
+ opening either file, reading from 'src', or writing to 'dst', raises
+ DistutilsFileError. Data is read/written in chunks of 'buffer_size'
+ bytes (default 16k). No attempt is made to handle anything apart from
+ regular files.
+ """
+ # Stolen from shutil module in the standard library, but with
+ # custom error-handling added.
+ fsrc = None
+ fdst = None
+ try:
+ try:
+ fsrc = open(src, 'rb')
+ except OSError as e:
+ raise DistutilsFileError(f"could not open '{src}': {e.strerror}")
+
+ if os.path.exists(dst):
+ try:
+ os.unlink(dst)
+ except OSError as e:
+ raise DistutilsFileError(f"could not delete '{dst}': {e.strerror}")
+
+ try:
+ fdst = open(dst, 'wb')
+ except OSError as e:
+ raise DistutilsFileError(f"could not create '{dst}': {e.strerror}")
+
+ while True:
+ try:
+ buf = fsrc.read(buffer_size)
+ except OSError as e:
+ raise DistutilsFileError(f"could not read from '{src}': {e.strerror}")
+
+ if not buf:
+ break
+
+ try:
+ fdst.write(buf)
+ except OSError as e:
+ raise DistutilsFileError(f"could not write to '{dst}': {e.strerror}")
+ finally:
+ if fdst:
+ fdst.close()
+ if fsrc:
+ fsrc.close()
+
+
+def copy_file( # noqa: C901
+ src,
+ dst,
+ preserve_mode=True,
+ preserve_times=True,
+ update=False,
+ link=None,
+ verbose=True,
+ dry_run=False,
+):
+ """Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is
+ copied there with the same name; otherwise, it must be a filename. (If
+ the file exists, it will be ruthlessly clobbered.) If 'preserve_mode'
+ is true (the default), the file's mode (type and permission bits, or
+ whatever is analogous on the current platform) is copied. If
+ 'preserve_times' is true (the default), the last-modified and
+ last-access times are copied as well. If 'update' is true, 'src' will
+ only be copied if 'dst' does not exist, or if 'dst' does exist but is
+ older than 'src'.
+
+ 'link' allows you to make hard links (os.link) or symbolic links
+ (os.symlink) instead of copying: set it to "hard" or "sym"; if it is
+ None (the default), files are copied. Don't set 'link' on systems that
+ don't support it: 'copy_file()' doesn't check if hard or symbolic
+ linking is available. If hardlink fails, falls back to
+ _copy_file_contents().
+
+ Under Mac OS, uses the native file copy function in macostools; on
+ other systems, uses '_copy_file_contents()' to copy file contents.
+
+ Return a tuple (dest_name, copied): 'dest_name' is the actual name of
+ the output file, and 'copied' is true if the file was copied (or would
+ have been copied, if 'dry_run' true).
+ """
+ # XXX if the destination file already exists, we clobber it if
+ # copying, but blow up if linking. Hmmm. And I don't know what
+ # macostools.copyfile() does. Should definitely be consistent, and
+ # should probably blow up if destination exists and we would be
+ # changing it (ie. it's not already a hard/soft link to src OR
+ # (not update) and (src newer than dst).
+
+ from distutils._modified import newer
+ from stat import S_IMODE, ST_ATIME, ST_MODE, ST_MTIME
+
+ if not os.path.isfile(src):
+ raise DistutilsFileError(
+ f"can't copy '{src}': doesn't exist or not a regular file"
+ )
+
+ if os.path.isdir(dst):
+ dir = dst
+ dst = os.path.join(dst, os.path.basename(src))
+ else:
+ dir = os.path.dirname(dst)
+
+ if update and not newer(src, dst):
+ if verbose >= 1:
+ log.debug("not copying %s (output up-to-date)", src)
+ return (dst, False)
+
+ try:
+ action = _copy_action[link]
+ except KeyError:
+ raise ValueError(f"invalid value '{link}' for 'link' argument")
+
+ if verbose >= 1:
+ if os.path.basename(dst) == os.path.basename(src):
+ log.info("%s %s -> %s", action, src, dir)
+ else:
+ log.info("%s %s -> %s", action, src, dst)
+
+ if dry_run:
+ return (dst, True)
+
+ # If linking (hard or symbolic), use the appropriate system call
+ # (Unix only, of course, but that's the caller's responsibility)
+ elif link == 'hard':
+ if not (os.path.exists(dst) and os.path.samefile(src, dst)):
+ try:
+ os.link(src, dst)
+ except OSError:
+ # If hard linking fails, fall back on copying file
+ # (some special filesystems don't support hard linking
+ # even under Unix, see issue #8876).
+ pass
+ else:
+ return (dst, True)
+ elif link == 'sym':
+ if not (os.path.exists(dst) and os.path.samefile(src, dst)):
+ os.symlink(src, dst)
+ return (dst, True)
+
+ # Otherwise (non-Mac, not linking), copy the file contents and
+ # (optionally) copy the times and mode.
+ _copy_file_contents(src, dst)
+ if preserve_mode or preserve_times:
+ st = os.stat(src)
+
+ # According to David Ascher , utime() should be done
+ # before chmod() (at least under NT).
+ if preserve_times:
+ os.utime(dst, (st[ST_ATIME], st[ST_MTIME]))
+ if preserve_mode:
+ os.chmod(dst, S_IMODE(st[ST_MODE]))
+
+ return (dst, True)
+
+
+# XXX I suspect this is Unix-specific -- need porting help!
+def move_file(src, dst, verbose=True, dry_run=False): # noqa: C901
+ """Move a file 'src' to 'dst'. If 'dst' is a directory, the file will
+ be moved into it with the same name; otherwise, 'src' is just renamed
+ to 'dst'. Return the new full name of the file.
+
+ Handles cross-device moves on Unix using 'copy_file()'. What about
+ other systems???
+ """
+ import errno
+ from os.path import basename, dirname, exists, isdir, isfile
+
+ if verbose >= 1:
+ log.info("moving %s -> %s", src, dst)
+
+ if dry_run:
+ return dst
+
+ if not isfile(src):
+ raise DistutilsFileError(f"can't move '{src}': not a regular file")
+
+ if isdir(dst):
+ dst = os.path.join(dst, basename(src))
+ elif exists(dst):
+ raise DistutilsFileError(
+ f"can't move '{src}': destination '{dst}' already exists"
+ )
+
+ if not isdir(dirname(dst)):
+ raise DistutilsFileError(
+ f"can't move '{src}': destination '{dst}' not a valid path"
+ )
+
+ copy_it = False
+ try:
+ os.rename(src, dst)
+ except OSError as e:
+ (num, msg) = e.args
+ if num == errno.EXDEV:
+ copy_it = True
+ else:
+ raise DistutilsFileError(f"couldn't move '{src}' to '{dst}': {msg}")
+
+ if copy_it:
+ copy_file(src, dst, verbose=verbose)
+ try:
+ os.unlink(src)
+ except OSError as e:
+ (num, msg) = e.args
+ try:
+ os.unlink(dst)
+ except OSError:
+ pass
+ raise DistutilsFileError(
+ f"couldn't move '{src}' to '{dst}' by copy/delete: "
+ f"delete '{src}' failed: {msg}"
+ )
+ return dst
+
+
+def write_file(filename, contents):
+ """Create a file with the specified name and write 'contents' (a
+ sequence of strings without line terminators) to it.
+ """
+ with open(filename, 'w', encoding='utf-8') as f:
+ f.writelines(line + '\n' for line in contents)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/filelist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/filelist.py
new file mode 100644
index 0000000000000000000000000000000000000000..70dc0fdebc3f4200245aa1c6280ab39861dcf8b0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/filelist.py
@@ -0,0 +1,431 @@
+"""distutils.filelist
+
+Provides the FileList class, used for poking about the filesystem
+and building lists of files.
+"""
+
+from __future__ import annotations
+
+import fnmatch
+import functools
+import os
+import re
+from collections.abc import Iterable
+from typing import Literal, overload
+
+from ._log import log
+from .errors import DistutilsInternalError, DistutilsTemplateError
+from .util import convert_path
+
+
+class FileList:
+ """A list of files built by on exploring the filesystem and filtered by
+ applying various patterns to what we find there.
+
+ Instance attributes:
+ dir
+ directory from which files will be taken -- only used if
+ 'allfiles' not supplied to constructor
+ files
+ list of filenames currently being built/filtered/manipulated
+ allfiles
+ complete list of files under consideration (ie. without any
+ filtering applied)
+ """
+
+ def __init__(self, warn: object = None, debug_print: object = None) -> None:
+ # ignore argument to FileList, but keep them for backwards
+ # compatibility
+ self.allfiles: Iterable[str] | None = None
+ self.files: list[str] = []
+
+ def set_allfiles(self, allfiles: Iterable[str]) -> None:
+ self.allfiles = allfiles
+
+ def findall(self, dir: str | os.PathLike[str] = os.curdir) -> None:
+ self.allfiles = findall(dir)
+
+ def debug_print(self, msg: object) -> None:
+ """Print 'msg' to stdout if the global DEBUG (taken from the
+ DISTUTILS_DEBUG environment variable) flag is true.
+ """
+ from distutils.debug import DEBUG
+
+ if DEBUG:
+ print(msg)
+
+ # Collection methods
+
+ def append(self, item: str) -> None:
+ self.files.append(item)
+
+ def extend(self, items: Iterable[str]) -> None:
+ self.files.extend(items)
+
+ def sort(self) -> None:
+ # Not a strict lexical sort!
+ sortable_files = sorted(map(os.path.split, self.files))
+ self.files = []
+ for sort_tuple in sortable_files:
+ self.files.append(os.path.join(*sort_tuple))
+
+ # Other miscellaneous utility methods
+
+ def remove_duplicates(self) -> None:
+ # Assumes list has been sorted!
+ for i in range(len(self.files) - 1, 0, -1):
+ if self.files[i] == self.files[i - 1]:
+ del self.files[i]
+
+ # "File template" methods
+
+ def _parse_template_line(self, line):
+ words = line.split()
+ action = words[0]
+
+ patterns = dir = dir_pattern = None
+
+ if action in ('include', 'exclude', 'global-include', 'global-exclude'):
+ if len(words) < 2:
+ raise DistutilsTemplateError(
+ f"'{action}' expects ..."
+ )
+ patterns = [convert_path(w) for w in words[1:]]
+ elif action in ('recursive-include', 'recursive-exclude'):
+ if len(words) < 3:
+ raise DistutilsTemplateError(
+ f"'{action}' expects ..."
+ )
+ dir = convert_path(words[1])
+ patterns = [convert_path(w) for w in words[2:]]
+ elif action in ('graft', 'prune'):
+ if len(words) != 2:
+ raise DistutilsTemplateError(
+ f"'{action}' expects a single "
+ )
+ dir_pattern = convert_path(words[1])
+ else:
+ raise DistutilsTemplateError(f"unknown action '{action}'")
+
+ return (action, patterns, dir, dir_pattern)
+
+ def process_template_line(self, line: str) -> None: # noqa: C901
+ # Parse the line: split it up, make sure the right number of words
+ # is there, and return the relevant words. 'action' is always
+ # defined: it's the first word of the line. Which of the other
+ # three are defined depends on the action; it'll be either
+ # patterns, (dir and patterns), or (dir_pattern).
+ (action, patterns, dir, dir_pattern) = self._parse_template_line(line)
+
+ # OK, now we know that the action is valid and we have the
+ # right number of words on the line for that action -- so we
+ # can proceed with minimal error-checking.
+ if action == 'include':
+ self.debug_print("include " + ' '.join(patterns))
+ for pattern in patterns:
+ if not self.include_pattern(pattern, anchor=True):
+ log.warning("warning: no files found matching '%s'", pattern)
+
+ elif action == 'exclude':
+ self.debug_print("exclude " + ' '.join(patterns))
+ for pattern in patterns:
+ if not self.exclude_pattern(pattern, anchor=True):
+ log.warning(
+ "warning: no previously-included files found matching '%s'",
+ pattern,
+ )
+
+ elif action == 'global-include':
+ self.debug_print("global-include " + ' '.join(patterns))
+ for pattern in patterns:
+ if not self.include_pattern(pattern, anchor=False):
+ log.warning(
+ (
+ "warning: no files found matching '%s' "
+ "anywhere in distribution"
+ ),
+ pattern,
+ )
+
+ elif action == 'global-exclude':
+ self.debug_print("global-exclude " + ' '.join(patterns))
+ for pattern in patterns:
+ if not self.exclude_pattern(pattern, anchor=False):
+ log.warning(
+ (
+ "warning: no previously-included files matching "
+ "'%s' found anywhere in distribution"
+ ),
+ pattern,
+ )
+
+ elif action == 'recursive-include':
+ self.debug_print("recursive-include {} {}".format(dir, ' '.join(patterns)))
+ for pattern in patterns:
+ if not self.include_pattern(pattern, prefix=dir):
+ msg = "warning: no files found matching '%s' under directory '%s'"
+ log.warning(msg, pattern, dir)
+
+ elif action == 'recursive-exclude':
+ self.debug_print("recursive-exclude {} {}".format(dir, ' '.join(patterns)))
+ for pattern in patterns:
+ if not self.exclude_pattern(pattern, prefix=dir):
+ log.warning(
+ (
+ "warning: no previously-included files matching "
+ "'%s' found under directory '%s'"
+ ),
+ pattern,
+ dir,
+ )
+
+ elif action == 'graft':
+ self.debug_print("graft " + dir_pattern)
+ if not self.include_pattern(None, prefix=dir_pattern):
+ log.warning("warning: no directories found matching '%s'", dir_pattern)
+
+ elif action == 'prune':
+ self.debug_print("prune " + dir_pattern)
+ if not self.exclude_pattern(None, prefix=dir_pattern):
+ log.warning(
+ ("no previously-included directories found matching '%s'"),
+ dir_pattern,
+ )
+ else:
+ raise DistutilsInternalError(
+ f"this cannot happen: invalid action '{action}'"
+ )
+
+ # Filtering/selection methods
+ @overload
+ def include_pattern(
+ self,
+ pattern: str,
+ anchor: bool = True,
+ prefix: str | None = None,
+ is_regex: Literal[False] = False,
+ ) -> bool: ...
+ @overload
+ def include_pattern(
+ self,
+ pattern: str | re.Pattern[str],
+ anchor: bool = True,
+ prefix: str | None = None,
+ *,
+ is_regex: Literal[True],
+ ) -> bool: ...
+ @overload
+ def include_pattern(
+ self,
+ pattern: str | re.Pattern[str],
+ anchor: bool,
+ prefix: str | None,
+ is_regex: Literal[True],
+ ) -> bool: ...
+ def include_pattern(
+ self,
+ pattern: str | re.Pattern,
+ anchor: bool = True,
+ prefix: str | None = None,
+ is_regex: bool = False,
+ ) -> bool:
+ """Select strings (presumably filenames) from 'self.files' that
+ match 'pattern', a Unix-style wildcard (glob) pattern. Patterns
+ are not quite the same as implemented by the 'fnmatch' module: '*'
+ and '?' match non-special characters, where "special" is platform-
+ dependent: slash on Unix; colon, slash, and backslash on
+ DOS/Windows; and colon on Mac OS.
+
+ If 'anchor' is true (the default), then the pattern match is more
+ stringent: "*.py" will match "foo.py" but not "foo/bar.py". If
+ 'anchor' is false, both of these will match.
+
+ If 'prefix' is supplied, then only filenames starting with 'prefix'
+ (itself a pattern) and ending with 'pattern', with anything in between
+ them, will match. 'anchor' is ignored in this case.
+
+ If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and
+ 'pattern' is assumed to be either a string containing a regex or a
+ regex object -- no translation is done, the regex is just compiled
+ and used as-is.
+
+ Selected strings will be added to self.files.
+
+ Return True if files are found, False otherwise.
+ """
+ # XXX docstring lying about what the special chars are?
+ files_found = False
+ pattern_re = translate_pattern(pattern, anchor, prefix, is_regex)
+ self.debug_print(f"include_pattern: applying regex r'{pattern_re.pattern}'")
+
+ # delayed loading of allfiles list
+ if self.allfiles is None:
+ self.findall()
+
+ for name in self.allfiles:
+ if pattern_re.search(name):
+ self.debug_print(" adding " + name)
+ self.files.append(name)
+ files_found = True
+ return files_found
+
+ @overload
+ def exclude_pattern(
+ self,
+ pattern: str,
+ anchor: bool = True,
+ prefix: str | None = None,
+ is_regex: Literal[False] = False,
+ ) -> bool: ...
+ @overload
+ def exclude_pattern(
+ self,
+ pattern: str | re.Pattern[str],
+ anchor: bool = True,
+ prefix: str | None = None,
+ *,
+ is_regex: Literal[True],
+ ) -> bool: ...
+ @overload
+ def exclude_pattern(
+ self,
+ pattern: str | re.Pattern[str],
+ anchor: bool,
+ prefix: str | None,
+ is_regex: Literal[True],
+ ) -> bool: ...
+ def exclude_pattern(
+ self,
+ pattern: str | re.Pattern,
+ anchor: bool = True,
+ prefix: str | None = None,
+ is_regex: bool = False,
+ ) -> bool:
+ """Remove strings (presumably filenames) from 'files' that match
+ 'pattern'. Other parameters are the same as for
+ 'include_pattern()', above.
+ The list 'self.files' is modified in place.
+ Return True if files are found, False otherwise.
+ """
+ files_found = False
+ pattern_re = translate_pattern(pattern, anchor, prefix, is_regex)
+ self.debug_print(f"exclude_pattern: applying regex r'{pattern_re.pattern}'")
+ for i in range(len(self.files) - 1, -1, -1):
+ if pattern_re.search(self.files[i]):
+ self.debug_print(" removing " + self.files[i])
+ del self.files[i]
+ files_found = True
+ return files_found
+
+
+# Utility functions
+
+
+def _find_all_simple(path):
+ """
+ Find all files under 'path'
+ """
+ all_unique = _UniqueDirs.filter(os.walk(path, followlinks=True))
+ results = (
+ os.path.join(base, file) for base, dirs, files in all_unique for file in files
+ )
+ return filter(os.path.isfile, results)
+
+
+class _UniqueDirs(set):
+ """
+ Exclude previously-seen dirs from walk results,
+ avoiding infinite recursion.
+ Ref https://bugs.python.org/issue44497.
+ """
+
+ def __call__(self, walk_item):
+ """
+ Given an item from an os.walk result, determine
+ if the item represents a unique dir for this instance
+ and if not, prevent further traversal.
+ """
+ base, dirs, files = walk_item
+ stat = os.stat(base)
+ candidate = stat.st_dev, stat.st_ino
+ found = candidate in self
+ if found:
+ del dirs[:]
+ self.add(candidate)
+ return not found
+
+ @classmethod
+ def filter(cls, items):
+ return filter(cls(), items)
+
+
+def findall(dir: str | os.PathLike[str] = os.curdir):
+ """
+ Find all files under 'dir' and return the list of full filenames.
+ Unless dir is '.', return full filenames with dir prepended.
+ """
+ files = _find_all_simple(dir)
+ if dir == os.curdir:
+ make_rel = functools.partial(os.path.relpath, start=dir)
+ files = map(make_rel, files)
+ return list(files)
+
+
+def glob_to_re(pattern):
+ """Translate a shell-like glob pattern to a regular expression; return
+ a string containing the regex. Differs from 'fnmatch.translate()' in
+ that '*' does not match "special characters" (which are
+ platform-specific).
+ """
+ pattern_re = fnmatch.translate(pattern)
+
+ # '?' and '*' in the glob pattern become '.' and '.*' in the RE, which
+ # IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix,
+ # and by extension they shouldn't match such "special characters" under
+ # any OS. So change all non-escaped dots in the RE to match any
+ # character except the special characters (currently: just os.sep).
+ sep = os.sep
+ if os.sep == '\\':
+ # we're using a regex to manipulate a regex, so we need
+ # to escape the backslash twice
+ sep = r'\\\\'
+ escaped = rf'\1[^{sep}]'
+ pattern_re = re.sub(r'((?= 2:
+ set_threshold(logging.DEBUG)
+
+
+class Log(logging.Logger):
+ """distutils.log.Log is deprecated, please use an alternative from `logging`."""
+
+ def __init__(self, threshold=WARN):
+ warnings.warn(Log.__doc__) # avoid DeprecationWarning to ensure warn is shown
+ super().__init__(__name__, level=threshold)
+
+ @property
+ def threshold(self):
+ return self.level
+
+ @threshold.setter
+ def threshold(self, level):
+ self.setLevel(level)
+
+ warn = logging.Logger.warning
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/spawn.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/spawn.py
new file mode 100644
index 0000000000000000000000000000000000000000..973668f2684054741b109bd8bbb573611309cc2f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/spawn.py
@@ -0,0 +1,134 @@
+"""distutils.spawn
+
+Provides the 'spawn()' function, a front-end to various platform-
+specific functions for launching another program in a sub-process.
+"""
+
+from __future__ import annotations
+
+import os
+import platform
+import shutil
+import subprocess
+import sys
+import warnings
+from collections.abc import Mapping, MutableSequence
+from typing import TYPE_CHECKING, TypeVar, overload
+
+from ._log import log
+from .debug import DEBUG
+from .errors import DistutilsExecError
+
+if TYPE_CHECKING:
+ from subprocess import _ENV
+
+
+_MappingT = TypeVar("_MappingT", bound=Mapping)
+
+
+def _debug(cmd):
+ """
+ Render a subprocess command differently depending on DEBUG.
+ """
+ return cmd if DEBUG else cmd[0]
+
+
+def _inject_macos_ver(env: _MappingT | None) -> _MappingT | dict[str, str | int] | None:
+ if platform.system() != 'Darwin':
+ return env
+
+ from .util import MACOSX_VERSION_VAR, get_macosx_target_ver
+
+ target_ver = get_macosx_target_ver()
+ update = {MACOSX_VERSION_VAR: target_ver} if target_ver else {}
+ return {**_resolve(env), **update}
+
+
+@overload
+def _resolve(env: None) -> os._Environ[str]: ...
+@overload
+def _resolve(env: _MappingT) -> _MappingT: ...
+def _resolve(env: _MappingT | None) -> _MappingT | os._Environ[str]:
+ return os.environ if env is None else env
+
+
+def spawn(
+ cmd: MutableSequence[bytes | str | os.PathLike[str]],
+ search_path: bool = True,
+ verbose: bool = False,
+ dry_run: bool = False,
+ env: _ENV | None = None,
+) -> None:
+ """Run another program, specified as a command list 'cmd', in a new process.
+
+ 'cmd' is just the argument list for the new process, ie.
+ cmd[0] is the program to run and cmd[1:] are the rest of its arguments.
+ There is no way to run a program with a name different from that of its
+ executable.
+
+ If 'search_path' is true (the default), the system's executable
+ search path will be used to find the program; otherwise, cmd[0]
+ must be the exact path to the executable. If 'dry_run' is true,
+ the command will not actually be run.
+
+ Raise DistutilsExecError if running the program fails in any way; just
+ return on success.
+ """
+ log.info(subprocess.list2cmdline(cmd))
+ if dry_run:
+ return
+
+ if search_path:
+ executable = shutil.which(cmd[0])
+ if executable is not None:
+ cmd[0] = executable
+
+ try:
+ subprocess.check_call(cmd, env=_inject_macos_ver(env))
+ except OSError as exc:
+ raise DistutilsExecError(
+ f"command {_debug(cmd)!r} failed: {exc.args[-1]}"
+ ) from exc
+ except subprocess.CalledProcessError as err:
+ raise DistutilsExecError(
+ f"command {_debug(cmd)!r} failed with exit code {err.returncode}"
+ ) from err
+
+
+def find_executable(executable: str, path: str | None = None) -> str | None:
+ """Tries to find 'executable' in the directories listed in 'path'.
+
+ A string listing directories separated by 'os.pathsep'; defaults to
+ os.environ['PATH']. Returns the complete filename or None if not found.
+ """
+ warnings.warn(
+ 'Use shutil.which instead of find_executable', DeprecationWarning, stacklevel=2
+ )
+ _, ext = os.path.splitext(executable)
+ if (sys.platform == 'win32') and (ext != '.exe'):
+ executable = executable + '.exe'
+
+ if os.path.isfile(executable):
+ return executable
+
+ if path is None:
+ path = os.environ.get('PATH', None)
+ # bpo-35755: Don't fall through if PATH is the empty string
+ if path is None:
+ try:
+ path = os.confstr("CS_PATH")
+ except (AttributeError, ValueError):
+ # os.confstr() or CS_PATH is not available
+ path = os.defpath
+
+ # PATH='' doesn't match, whereas PATH=':' looks in the current directory
+ if not path:
+ return None
+
+ paths = path.split(os.pathsep)
+ for p in paths:
+ f = os.path.join(p, executable)
+ if os.path.isfile(f):
+ # the file exists, we have a shot at spawn working
+ return f
+ return None
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/sysconfig.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/sysconfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..7ddc869ab5603d691a8863988da89ec84689de84
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/sysconfig.py
@@ -0,0 +1,598 @@
+"""Provide access to Python's configuration information. The specific
+configuration variables available depend heavily on the platform and
+configuration. The values may be retrieved using
+get_config_var(name), and the list of variables is available via
+get_config_vars().keys(). Additional convenience functions are also
+available.
+
+Written by: Fred L. Drake, Jr.
+Email:
+"""
+
+from __future__ import annotations
+
+import functools
+import os
+import pathlib
+import re
+import sys
+import sysconfig
+from typing import TYPE_CHECKING, Literal, overload
+
+from jaraco.functools import pass_none
+
+from .ccompiler import CCompiler
+from .compat import py39
+from .errors import DistutilsPlatformError
+from .util import is_mingw
+
+if TYPE_CHECKING:
+ from typing_extensions import deprecated
+else:
+
+ def deprecated(message):
+ return lambda fn: fn
+
+
+IS_PYPY = '__pypy__' in sys.builtin_module_names
+
+# These are needed in a couple of spots, so just compute them once.
+PREFIX = os.path.normpath(sys.prefix)
+EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+BASE_PREFIX = os.path.normpath(sys.base_prefix)
+BASE_EXEC_PREFIX = os.path.normpath(sys.base_exec_prefix)
+
+# Path to the base directory of the project. On Windows the binary may
+# live in project/PCbuild/win32 or project/PCbuild/amd64.
+# set for cross builds
+if "_PYTHON_PROJECT_BASE" in os.environ:
+ project_base = os.path.abspath(os.environ["_PYTHON_PROJECT_BASE"])
+else:
+ if sys.executable:
+ project_base = os.path.dirname(os.path.abspath(sys.executable))
+ else:
+ # sys.executable can be empty if argv[0] has been changed and Python is
+ # unable to retrieve the real program name
+ project_base = os.getcwd()
+
+
+def _is_python_source_dir(d):
+ """
+ Return True if the target directory appears to point to an
+ un-installed Python.
+ """
+ modules = pathlib.Path(d).joinpath('Modules')
+ return any(modules.joinpath(fn).is_file() for fn in ('Setup', 'Setup.local'))
+
+
+_sys_home = getattr(sys, '_home', None)
+
+
+def _is_parent(dir_a, dir_b):
+ """
+ Return True if a is a parent of b.
+ """
+ return os.path.normcase(dir_a).startswith(os.path.normcase(dir_b))
+
+
+if os.name == 'nt':
+
+ @pass_none
+ def _fix_pcbuild(d):
+ # In a venv, sys._home will be inside BASE_PREFIX rather than PREFIX.
+ prefixes = PREFIX, BASE_PREFIX
+ matched = (
+ prefix
+ for prefix in prefixes
+ if _is_parent(d, os.path.join(prefix, "PCbuild"))
+ )
+ return next(matched, d)
+
+ project_base = _fix_pcbuild(project_base)
+ _sys_home = _fix_pcbuild(_sys_home)
+
+
+def _python_build():
+ if _sys_home:
+ return _is_python_source_dir(_sys_home)
+ return _is_python_source_dir(project_base)
+
+
+python_build = _python_build()
+
+
+# Calculate the build qualifier flags if they are defined. Adding the flags
+# to the include and lib directories only makes sense for an installation, not
+# an in-source build.
+build_flags = ''
+try:
+ if not python_build:
+ build_flags = sys.abiflags
+except AttributeError:
+ # It's not a configure-based build, so the sys module doesn't have
+ # this attribute, which is fine.
+ pass
+
+
+def get_python_version():
+ """Return a string containing the major and minor Python version,
+ leaving off the patchlevel. Sample return values could be '1.5'
+ or '2.2'.
+ """
+ return f'{sys.version_info.major}.{sys.version_info.minor}'
+
+
+def get_python_inc(plat_specific: bool = False, prefix: str | None = None) -> str:
+ """Return the directory containing installed Python header files.
+
+ If 'plat_specific' is false (the default), this is the path to the
+ non-platform-specific header files, i.e. Python.h and so on;
+ otherwise, this is the path to platform-specific header files
+ (namely pyconfig.h).
+
+ If 'prefix' is supplied, use it instead of sys.base_prefix or
+ sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
+ """
+ default_prefix = BASE_EXEC_PREFIX if plat_specific else BASE_PREFIX
+ resolved_prefix = prefix if prefix is not None else default_prefix
+ # MinGW imitates posix like layout, but os.name != posix
+ os_name = "posix" if is_mingw() else os.name
+ try:
+ getter = globals()[f'_get_python_inc_{os_name}']
+ except KeyError:
+ raise DistutilsPlatformError(
+ "I don't know where Python installs its C header files "
+ f"on platform '{os.name}'"
+ )
+ return getter(resolved_prefix, prefix, plat_specific)
+
+
+@pass_none
+def _extant(path):
+ """
+ Replace path with None if it doesn't exist.
+ """
+ return path if os.path.exists(path) else None
+
+
+def _get_python_inc_posix(prefix, spec_prefix, plat_specific):
+ return (
+ _get_python_inc_posix_python(plat_specific)
+ or _extant(_get_python_inc_from_config(plat_specific, spec_prefix))
+ or _get_python_inc_posix_prefix(prefix)
+ )
+
+
+def _get_python_inc_posix_python(plat_specific):
+ """
+ Assume the executable is in the build directory. The
+ pyconfig.h file should be in the same directory. Since
+ the build directory may not be the source directory,
+ use "srcdir" from the makefile to find the "Include"
+ directory.
+ """
+ if not python_build:
+ return
+ if plat_specific:
+ return _sys_home or project_base
+ incdir = os.path.join(get_config_var('srcdir'), 'Include')
+ return os.path.normpath(incdir)
+
+
+def _get_python_inc_from_config(plat_specific, spec_prefix):
+ """
+ If no prefix was explicitly specified, provide the include
+ directory from the config vars. Useful when
+ cross-compiling, since the config vars may come from
+ the host
+ platform Python installation, while the current Python
+ executable is from the build platform installation.
+
+ >>> monkeypatch = getfixture('monkeypatch')
+ >>> gpifc = _get_python_inc_from_config
+ >>> monkeypatch.setitem(gpifc.__globals__, 'get_config_var', str.lower)
+ >>> gpifc(False, '/usr/bin/')
+ >>> gpifc(False, '')
+ >>> gpifc(False, None)
+ 'includepy'
+ >>> gpifc(True, None)
+ 'confincludepy'
+ """
+ if spec_prefix is None:
+ return get_config_var('CONF' * plat_specific + 'INCLUDEPY')
+
+
+def _get_python_inc_posix_prefix(prefix):
+ implementation = 'pypy' if IS_PYPY else 'python'
+ python_dir = implementation + get_python_version() + build_flags
+ return os.path.join(prefix, "include", python_dir)
+
+
+def _get_python_inc_nt(prefix, spec_prefix, plat_specific):
+ if python_build:
+ # Include both include dirs to ensure we can find pyconfig.h
+ return (
+ os.path.join(prefix, "include")
+ + os.path.pathsep
+ + os.path.dirname(sysconfig.get_config_h_filename())
+ )
+ return os.path.join(prefix, "include")
+
+
+# allow this behavior to be monkey-patched. Ref pypa/distutils#2.
+def _posix_lib(standard_lib, libpython, early_prefix, prefix):
+ if standard_lib:
+ return libpython
+ else:
+ return os.path.join(libpython, "site-packages")
+
+
+def get_python_lib(
+ plat_specific: bool = False, standard_lib: bool = False, prefix: str | None = None
+) -> str:
+ """Return the directory containing the Python library (standard or
+ site additions).
+
+ If 'plat_specific' is true, return the directory containing
+ platform-specific modules, i.e. any module from a non-pure-Python
+ module distribution; otherwise, return the platform-shared library
+ directory. If 'standard_lib' is true, return the directory
+ containing standard Python library modules; otherwise, return the
+ directory for site-specific modules.
+
+ If 'prefix' is supplied, use it instead of sys.base_prefix or
+ sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
+ """
+
+ early_prefix = prefix
+
+ if prefix is None:
+ if standard_lib:
+ prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
+ else:
+ prefix = plat_specific and EXEC_PREFIX or PREFIX
+
+ if os.name == "posix" or is_mingw():
+ if plat_specific or standard_lib:
+ # Platform-specific modules (any module from a non-pure-Python
+ # module distribution) or standard Python library modules.
+ libdir = getattr(sys, "platlibdir", "lib")
+ else:
+ # Pure Python
+ libdir = "lib"
+ implementation = 'pypy' if IS_PYPY else 'python'
+ libpython = os.path.join(prefix, libdir, implementation + get_python_version())
+ return _posix_lib(standard_lib, libpython, early_prefix, prefix)
+ elif os.name == "nt":
+ if standard_lib:
+ return os.path.join(prefix, "Lib")
+ else:
+ return os.path.join(prefix, "Lib", "site-packages")
+ else:
+ raise DistutilsPlatformError(
+ f"I don't know where Python installs its library on platform '{os.name}'"
+ )
+
+
+@functools.lru_cache
+def _customize_macos():
+ """
+ Perform first-time customization of compiler-related
+ config vars on macOS. Use after a compiler is known
+ to be needed. This customization exists primarily to support Pythons
+ from binary installers. The kind and paths to build tools on
+ the user system may vary significantly from the system
+ that Python itself was built on. Also the user OS
+ version and build tools may not support the same set
+ of CPU architectures for universal builds.
+ """
+
+ sys.platform == "darwin" and __import__('_osx_support').customize_compiler(
+ get_config_vars()
+ )
+
+
+def customize_compiler(compiler: CCompiler) -> None:
+ """Do any platform-specific customization of a CCompiler instance.
+
+ Mainly needed on Unix, so we can plug in the information that
+ varies across Unices and is stored in Python's Makefile.
+ """
+ if compiler.compiler_type in ["unix", "cygwin"] or (
+ compiler.compiler_type == "mingw32" and is_mingw()
+ ):
+ _customize_macos()
+
+ (
+ cc,
+ cxx,
+ cflags,
+ ccshared,
+ ldshared,
+ ldcxxshared,
+ shlib_suffix,
+ ar,
+ ar_flags,
+ ) = get_config_vars(
+ 'CC',
+ 'CXX',
+ 'CFLAGS',
+ 'CCSHARED',
+ 'LDSHARED',
+ 'LDCXXSHARED',
+ 'SHLIB_SUFFIX',
+ 'AR',
+ 'ARFLAGS',
+ )
+
+ cxxflags = cflags
+
+ if 'CC' in os.environ:
+ newcc = os.environ['CC']
+ if 'LDSHARED' not in os.environ and ldshared.startswith(cc):
+ # If CC is overridden, use that as the default
+ # command for LDSHARED as well
+ ldshared = newcc + ldshared[len(cc) :]
+ cc = newcc
+ cxx = os.environ.get('CXX', cxx)
+ ldshared = os.environ.get('LDSHARED', ldshared)
+ ldcxxshared = os.environ.get('LDCXXSHARED', ldcxxshared)
+ cpp = os.environ.get(
+ 'CPP',
+ cc + " -E", # not always
+ )
+
+ ldshared = _add_flags(ldshared, 'LD')
+ ldcxxshared = _add_flags(ldcxxshared, 'LD')
+ cflags = os.environ.get('CFLAGS', cflags)
+ ldshared = _add_flags(ldshared, 'C')
+ cxxflags = os.environ.get('CXXFLAGS', cxxflags)
+ ldcxxshared = _add_flags(ldcxxshared, 'CXX')
+ cpp = _add_flags(cpp, 'CPP')
+ cflags = _add_flags(cflags, 'CPP')
+ cxxflags = _add_flags(cxxflags, 'CPP')
+ ldshared = _add_flags(ldshared, 'CPP')
+ ldcxxshared = _add_flags(ldcxxshared, 'CPP')
+
+ ar = os.environ.get('AR', ar)
+
+ archiver = ar + ' ' + os.environ.get('ARFLAGS', ar_flags)
+ cc_cmd = cc + ' ' + cflags
+ cxx_cmd = cxx + ' ' + cxxflags
+
+ compiler.set_executables(
+ preprocessor=cpp,
+ compiler=cc_cmd,
+ compiler_so=cc_cmd + ' ' + ccshared,
+ compiler_cxx=cxx_cmd,
+ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
+ linker_so=ldshared,
+ linker_so_cxx=ldcxxshared,
+ linker_exe=cc,
+ linker_exe_cxx=cxx,
+ archiver=archiver,
+ )
+
+ if 'RANLIB' in os.environ and compiler.executables.get('ranlib', None):
+ compiler.set_executables(ranlib=os.environ['RANLIB'])
+
+ compiler.shared_lib_extension = shlib_suffix
+
+
+def get_config_h_filename() -> str:
+ """Return full pathname of installed pyconfig.h file."""
+ return sysconfig.get_config_h_filename()
+
+
+def get_makefile_filename() -> str:
+ """Return full pathname of installed Makefile from the Python build."""
+ return sysconfig.get_makefile_filename()
+
+
+def parse_config_h(fp, g=None):
+ """Parse a config.h-style file.
+
+ A dictionary containing name/value pairs is returned. If an
+ optional dictionary is passed in as the second argument, it is
+ used instead of a new dictionary.
+ """
+ return sysconfig.parse_config_h(fp, vars=g)
+
+
+# Regexes needed for parsing Makefile (and similar syntaxes,
+# like old-style Setup files).
+_variable_rx = re.compile(r"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
+_findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
+_findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
+
+
+def parse_makefile(fn, g=None): # noqa: C901
+ """Parse a Makefile-style file.
+
+ A dictionary containing name/value pairs is returned. If an
+ optional dictionary is passed in as the second argument, it is
+ used instead of a new dictionary.
+ """
+ from distutils.text_file import TextFile
+
+ fp = TextFile(
+ fn,
+ strip_comments=True,
+ skip_blanks=True,
+ join_lines=True,
+ errors="surrogateescape",
+ )
+
+ if g is None:
+ g = {}
+ done = {}
+ notdone = {}
+
+ while True:
+ line = fp.readline()
+ if line is None: # eof
+ break
+ m = _variable_rx.match(line)
+ if m:
+ n, v = m.group(1, 2)
+ v = v.strip()
+ # `$$' is a literal `$' in make
+ tmpv = v.replace('$$', '')
+
+ if "$" in tmpv:
+ notdone[n] = v
+ else:
+ try:
+ v = int(v)
+ except ValueError:
+ # insert literal `$'
+ done[n] = v.replace('$$', '$')
+ else:
+ done[n] = v
+
+ # Variables with a 'PY_' prefix in the makefile. These need to
+ # be made available without that prefix through sysconfig.
+ # Special care is needed to ensure that variable expansion works, even
+ # if the expansion uses the name without a prefix.
+ renamed_variables = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS')
+
+ # do variable interpolation here
+ while notdone:
+ for name in list(notdone):
+ value = notdone[name]
+ m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
+ if m:
+ n = m.group(1)
+ found = True
+ if n in done:
+ item = str(done[n])
+ elif n in notdone:
+ # get it on a subsequent round
+ found = False
+ elif n in os.environ:
+ # do it like make: fall back to environment
+ item = os.environ[n]
+
+ elif n in renamed_variables:
+ if name.startswith('PY_') and name[3:] in renamed_variables:
+ item = ""
+
+ elif 'PY_' + n in notdone:
+ found = False
+
+ else:
+ item = str(done['PY_' + n])
+ else:
+ done[n] = item = ""
+ if found:
+ after = value[m.end() :]
+ value = value[: m.start()] + item + after
+ if "$" in after:
+ notdone[name] = value
+ else:
+ try:
+ value = int(value)
+ except ValueError:
+ done[name] = value.strip()
+ else:
+ done[name] = value
+ del notdone[name]
+
+ if name.startswith('PY_') and name[3:] in renamed_variables:
+ name = name[3:]
+ if name not in done:
+ done[name] = value
+ else:
+ # bogus variable reference; just drop it since we can't deal
+ del notdone[name]
+
+ fp.close()
+
+ # strip spurious spaces
+ for k, v in done.items():
+ if isinstance(v, str):
+ done[k] = v.strip()
+
+ # save the results in the global dictionary
+ g.update(done)
+ return g
+
+
+def expand_makefile_vars(s, vars):
+ """Expand Makefile-style variables -- "${foo}" or "$(foo)" -- in
+ 'string' according to 'vars' (a dictionary mapping variable names to
+ values). Variables not present in 'vars' are silently expanded to the
+ empty string. The variable values in 'vars' should not contain further
+ variable expansions; if 'vars' is the output of 'parse_makefile()',
+ you're fine. Returns a variable-expanded version of 's'.
+ """
+
+ # This algorithm does multiple expansion, so if vars['foo'] contains
+ # "${bar}", it will expand ${foo} to ${bar}, and then expand
+ # ${bar}... and so forth. This is fine as long as 'vars' comes from
+ # 'parse_makefile()', which takes care of such expansions eagerly,
+ # according to make's variable expansion semantics.
+
+ while True:
+ m = _findvar1_rx.search(s) or _findvar2_rx.search(s)
+ if m:
+ (beg, end) = m.span()
+ s = s[0:beg] + vars.get(m.group(1)) + s[end:]
+ else:
+ break
+ return s
+
+
+_config_vars = None
+
+
+@overload
+def get_config_vars() -> dict[str, str | int]: ...
+@overload
+def get_config_vars(arg: str, /, *args: str) -> list[str | int]: ...
+def get_config_vars(*args: str) -> list[str | int] | dict[str, str | int]:
+ """With no arguments, return a dictionary of all configuration
+ variables relevant for the current platform. Generally this includes
+ everything needed to build extensions and install both pure modules and
+ extensions. On Unix, this means every variable defined in Python's
+ installed Makefile; on Windows it's a much smaller set.
+
+ With arguments, return a list of values that result from looking up
+ each argument in the configuration variable dictionary.
+ """
+ global _config_vars
+ if _config_vars is None:
+ _config_vars = sysconfig.get_config_vars().copy()
+ py39.add_ext_suffix(_config_vars)
+
+ return [_config_vars.get(name) for name in args] if args else _config_vars
+
+
+@overload
+@deprecated(
+ "SO is deprecated, use EXT_SUFFIX. Support will be removed when this module is synchronized with stdlib Python 3.11"
+)
+def get_config_var(name: Literal["SO"]) -> int | str | None: ...
+@overload
+def get_config_var(name: str) -> int | str | None: ...
+def get_config_var(name: str) -> int | str | None:
+ """Return the value of a single variable using the dictionary
+ returned by 'get_config_vars()'. Equivalent to
+ get_config_vars().get(name)
+ """
+ if name == 'SO':
+ import warnings
+
+ warnings.warn('SO is deprecated, use EXT_SUFFIX', DeprecationWarning, 2)
+ return get_config_vars().get(name)
+
+
+@pass_none
+def _add_flags(value: str, type: str) -> str:
+ """
+ Add any flags from the environment for the given type.
+
+ type is the prefix to FLAGS in the environment key (e.g. "C" for "CFLAGS").
+ """
+ flags = os.environ.get(f'{type}FLAGS')
+ return f'{value} {flags}' if flags else value
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..5a8ab061009f1cd87a53ce51eff3bc9e9a632273
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/__init__.py
@@ -0,0 +1,42 @@
+"""
+Test suite for distutils.
+
+Tests for the command classes in the distutils.command package are
+included in distutils.tests as well, instead of using a separate
+distutils.command.tests package, since command identification is done
+by import rather than matching pre-defined names.
+"""
+
+import shutil
+from collections.abc import Sequence
+
+
+def missing_compiler_executable(cmd_names: Sequence[str] = []): # pragma: no cover
+ """Check if the compiler components used to build the interpreter exist.
+
+ Check for the existence of the compiler executables whose names are listed
+ in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
+ and return the first missing executable or None when none is found
+ missing.
+
+ """
+ from distutils import ccompiler, errors, sysconfig
+
+ compiler = ccompiler.new_compiler()
+ sysconfig.customize_compiler(compiler)
+ if compiler.compiler_type == "msvc":
+ # MSVC has no executables, so check whether initialization succeeds
+ try:
+ compiler.initialize()
+ except errors.DistutilsPlatformError:
+ return "msvc"
+ for name in compiler.executables:
+ if cmd_names and name not in cmd_names:
+ continue
+ cmd = getattr(compiler, name)
+ if cmd_names:
+ assert cmd is not None, f"the '{name}' executable is not configured"
+ elif not cmd:
+ continue
+ if shutil.which(cmd[0]) is None:
+ return cmd[0]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/compat/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/compat/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/compat/py39.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/compat/py39.py
new file mode 100644
index 0000000000000000000000000000000000000000..aca3939a0cea90dd0a90d7f36fcf83a5167cbfc4
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/compat/py39.py
@@ -0,0 +1,40 @@
+import sys
+
+if sys.version_info >= (3, 10):
+ from test.support.import_helper import (
+ CleanImport as CleanImport,
+ )
+ from test.support.import_helper import (
+ DirsOnSysPath as DirsOnSysPath,
+ )
+ from test.support.os_helper import (
+ EnvironmentVarGuard as EnvironmentVarGuard,
+ )
+ from test.support.os_helper import (
+ rmtree as rmtree,
+ )
+ from test.support.os_helper import (
+ skip_unless_symlink as skip_unless_symlink,
+ )
+ from test.support.os_helper import (
+ unlink as unlink,
+ )
+else:
+ from test.support import (
+ CleanImport as CleanImport,
+ )
+ from test.support import (
+ DirsOnSysPath as DirsOnSysPath,
+ )
+ from test.support import (
+ EnvironmentVarGuard as EnvironmentVarGuard,
+ )
+ from test.support import (
+ rmtree as rmtree,
+ )
+ from test.support import (
+ skip_unless_symlink as skip_unless_symlink,
+ )
+ from test.support import (
+ unlink as unlink,
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/support.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/support.py
new file mode 100644
index 0000000000000000000000000000000000000000..9cd2b8a9eedbb9f11a3ed793af57b3290c5febef
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/support.py
@@ -0,0 +1,134 @@
+"""Support code for distutils test cases."""
+
+import itertools
+import os
+import pathlib
+import shutil
+import sys
+import sysconfig
+import tempfile
+from distutils.core import Distribution
+
+import pytest
+from more_itertools import always_iterable
+
+
+@pytest.mark.usefixtures('distutils_managed_tempdir')
+class TempdirManager:
+ """
+ Mix-in class that handles temporary directories for test cases.
+ """
+
+ def mkdtemp(self):
+ """Create a temporary directory that will be cleaned up.
+
+ Returns the path of the directory.
+ """
+ d = tempfile.mkdtemp()
+ self.tempdirs.append(d)
+ return d
+
+ def write_file(self, path, content='xxx'):
+ """Writes a file in the given path.
+
+ path can be a string or a sequence.
+ """
+ pathlib.Path(*always_iterable(path)).write_text(content, encoding='utf-8')
+
+ def create_dist(self, pkg_name='foo', **kw):
+ """Will generate a test environment.
+
+ This function creates:
+ - a Distribution instance using keywords
+ - a temporary directory with a package structure
+
+ It returns the package directory and the distribution
+ instance.
+ """
+ tmp_dir = self.mkdtemp()
+ pkg_dir = os.path.join(tmp_dir, pkg_name)
+ os.mkdir(pkg_dir)
+ dist = Distribution(attrs=kw)
+
+ return pkg_dir, dist
+
+
+class DummyCommand:
+ """Class to store options for retrieval via set_undefined_options()."""
+
+ def __init__(self, **kwargs):
+ vars(self).update(kwargs)
+
+ def ensure_finalized(self):
+ pass
+
+
+def copy_xxmodule_c(directory):
+ """Helper for tests that need the xxmodule.c source file.
+
+ Example use:
+
+ def test_compile(self):
+ copy_xxmodule_c(self.tmpdir)
+ self.assertIn('xxmodule.c', os.listdir(self.tmpdir))
+
+ If the source file can be found, it will be copied to *directory*. If not,
+ the test will be skipped. Errors during copy are not caught.
+ """
+ shutil.copy(_get_xxmodule_path(), os.path.join(directory, 'xxmodule.c'))
+
+
+def _get_xxmodule_path():
+ source_name = 'xxmodule.c' if sys.version_info > (3, 9) else 'xxmodule-3.8.c'
+ return os.path.join(os.path.dirname(__file__), source_name)
+
+
+def fixup_build_ext(cmd):
+ """Function needed to make build_ext tests pass.
+
+ When Python was built with --enable-shared on Unix, -L. is not enough to
+ find libpython.so, because regrtest runs in a tempdir, not in the
+ source directory where the .so lives.
+
+ When Python was built with in debug mode on Windows, build_ext commands
+ need their debug attribute set, and it is not done automatically for
+ some reason.
+
+ This function handles both of these things. Example use:
+
+ cmd = build_ext(dist)
+ support.fixup_build_ext(cmd)
+ cmd.ensure_finalized()
+
+ Unlike most other Unix platforms, Mac OS X embeds absolute paths
+ to shared libraries into executables, so the fixup is not needed there.
+ """
+ if os.name == 'nt':
+ cmd.debug = sys.executable.endswith('_d.exe')
+ elif sysconfig.get_config_var('Py_ENABLE_SHARED'):
+ # To further add to the shared builds fun on Unix, we can't just add
+ # library_dirs to the Extension() instance because that doesn't get
+ # plumbed through to the final compiler command.
+ runshared = sysconfig.get_config_var('RUNSHARED')
+ if runshared is None:
+ cmd.library_dirs = ['.']
+ else:
+ if sys.platform == 'darwin':
+ cmd.library_dirs = []
+ else:
+ name, equals, value = runshared.partition('=')
+ cmd.library_dirs = [d for d in value.split(os.pathsep) if d]
+
+
+def combine_markers(cls):
+ """
+ pytest will honor markers as found on the class, but when
+ markers are on multiple subclasses, only one appears. Use
+ this decorator to combine those markers.
+ """
+ cls.pytestmark = [
+ mark
+ for base in itertools.chain([cls], cls.__bases__)
+ for mark in getattr(base, 'pytestmark', [])
+ ]
+ return cls
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_archive_util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_archive_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..3e4ed75a761dc26fc7dc29066138a02531c6e9c3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_archive_util.py
@@ -0,0 +1,353 @@
+"""Tests for distutils.archive_util."""
+
+import functools
+import operator
+import os
+import pathlib
+import sys
+import tarfile
+from distutils import archive_util
+from distutils.archive_util import (
+ ARCHIVE_FORMATS,
+ check_archive_formats,
+ make_archive,
+ make_tarball,
+ make_zipfile,
+)
+from distutils.spawn import spawn
+from distutils.tests import support
+from os.path import splitdrive
+
+import path
+import pytest
+from test.support import patch
+
+from .unix_compat import UID_0_SUPPORT, grp, pwd, require_uid_0, require_unix_id
+
+
+def can_fs_encode(filename):
+ """
+ Return True if the filename can be saved in the file system.
+ """
+ if os.path.supports_unicode_filenames:
+ return True
+ try:
+ filename.encode(sys.getfilesystemencoding())
+ except UnicodeEncodeError:
+ return False
+ return True
+
+
+def all_equal(values):
+ return functools.reduce(operator.eq, values)
+
+
+def same_drive(*paths):
+ return all_equal(pathlib.Path(path).drive for path in paths)
+
+
+class ArchiveUtilTestCase(support.TempdirManager):
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_make_tarball(self, name='archive'):
+ # creating something to tar
+ tmpdir = self._create_files()
+ self._make_tarball(tmpdir, name, '.tar.gz')
+ # trying an uncompressed one
+ self._make_tarball(tmpdir, name, '.tar', compress=None)
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_make_tarball_gzip(self):
+ tmpdir = self._create_files()
+ self._make_tarball(tmpdir, 'archive', '.tar.gz', compress='gzip')
+
+ def test_make_tarball_bzip2(self):
+ pytest.importorskip('bz2')
+ tmpdir = self._create_files()
+ self._make_tarball(tmpdir, 'archive', '.tar.bz2', compress='bzip2')
+
+ def test_make_tarball_xz(self):
+ pytest.importorskip('lzma')
+ tmpdir = self._create_files()
+ self._make_tarball(tmpdir, 'archive', '.tar.xz', compress='xz')
+
+ @pytest.mark.skipif("not can_fs_encode('årchiv')")
+ def test_make_tarball_latin1(self):
+ """
+ Mirror test_make_tarball, except filename contains latin characters.
+ """
+ self.test_make_tarball('årchiv') # note this isn't a real word
+
+ @pytest.mark.skipif("not can_fs_encode('のアーカイブ')")
+ def test_make_tarball_extended(self):
+ """
+ Mirror test_make_tarball, except filename contains extended
+ characters outside the latin charset.
+ """
+ self.test_make_tarball('のアーカイブ') # japanese for archive
+
+ def _make_tarball(self, tmpdir, target_name, suffix, **kwargs):
+ tmpdir2 = self.mkdtemp()
+ if same_drive(tmpdir, tmpdir2):
+ pytest.skip("source and target should be on same drive")
+
+ base_name = os.path.join(tmpdir2, target_name)
+
+ # working with relative paths to avoid tar warnings
+ with path.Path(tmpdir):
+ make_tarball(splitdrive(base_name)[1], 'dist', **kwargs)
+
+ # check if the compressed tarball was created
+ tarball = base_name + suffix
+ assert os.path.exists(tarball)
+ assert self._tarinfo(tarball) == self._created_files
+
+ def _tarinfo(self, path):
+ tar = tarfile.open(path)
+ try:
+ names = tar.getnames()
+ names.sort()
+ return names
+ finally:
+ tar.close()
+
+ _zip_created_files = [
+ 'dist/',
+ 'dist/file1',
+ 'dist/file2',
+ 'dist/sub/',
+ 'dist/sub/file3',
+ 'dist/sub2/',
+ ]
+ _created_files = [p.rstrip('/') for p in _zip_created_files]
+
+ def _create_files(self):
+ # creating something to tar
+ tmpdir = self.mkdtemp()
+ dist = os.path.join(tmpdir, 'dist')
+ os.mkdir(dist)
+ self.write_file([dist, 'file1'], 'xxx')
+ self.write_file([dist, 'file2'], 'xxx')
+ os.mkdir(os.path.join(dist, 'sub'))
+ self.write_file([dist, 'sub', 'file3'], 'xxx')
+ os.mkdir(os.path.join(dist, 'sub2'))
+ return tmpdir
+
+ @pytest.mark.usefixtures('needs_zlib')
+ @pytest.mark.skipif("not (shutil.which('tar') and shutil.which('gzip'))")
+ def test_tarfile_vs_tar(self):
+ tmpdir = self._create_files()
+ tmpdir2 = self.mkdtemp()
+ base_name = os.path.join(tmpdir2, 'archive')
+ old_dir = os.getcwd()
+ os.chdir(tmpdir)
+ try:
+ make_tarball(base_name, 'dist')
+ finally:
+ os.chdir(old_dir)
+
+ # check if the compressed tarball was created
+ tarball = base_name + '.tar.gz'
+ assert os.path.exists(tarball)
+
+ # now create another tarball using `tar`
+ tarball2 = os.path.join(tmpdir, 'archive2.tar.gz')
+ tar_cmd = ['tar', '-cf', 'archive2.tar', 'dist']
+ gzip_cmd = ['gzip', '-f', '-9', 'archive2.tar']
+ old_dir = os.getcwd()
+ os.chdir(tmpdir)
+ try:
+ spawn(tar_cmd)
+ spawn(gzip_cmd)
+ finally:
+ os.chdir(old_dir)
+
+ assert os.path.exists(tarball2)
+ # let's compare both tarballs
+ assert self._tarinfo(tarball) == self._created_files
+ assert self._tarinfo(tarball2) == self._created_files
+
+ # trying an uncompressed one
+ base_name = os.path.join(tmpdir2, 'archive')
+ old_dir = os.getcwd()
+ os.chdir(tmpdir)
+ try:
+ make_tarball(base_name, 'dist', compress=None)
+ finally:
+ os.chdir(old_dir)
+ tarball = base_name + '.tar'
+ assert os.path.exists(tarball)
+
+ # now for a dry_run
+ base_name = os.path.join(tmpdir2, 'archive')
+ old_dir = os.getcwd()
+ os.chdir(tmpdir)
+ try:
+ make_tarball(base_name, 'dist', compress=None, dry_run=True)
+ finally:
+ os.chdir(old_dir)
+ tarball = base_name + '.tar'
+ assert os.path.exists(tarball)
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_make_zipfile(self):
+ zipfile = pytest.importorskip('zipfile')
+ # creating something to tar
+ tmpdir = self._create_files()
+ base_name = os.path.join(self.mkdtemp(), 'archive')
+ with path.Path(tmpdir):
+ make_zipfile(base_name, 'dist')
+
+ # check if the compressed tarball was created
+ tarball = base_name + '.zip'
+ assert os.path.exists(tarball)
+ with zipfile.ZipFile(tarball) as zf:
+ assert sorted(zf.namelist()) == self._zip_created_files
+
+ def test_make_zipfile_no_zlib(self):
+ zipfile = pytest.importorskip('zipfile')
+ patch(self, archive_util.zipfile, 'zlib', None) # force zlib ImportError
+
+ called = []
+ zipfile_class = zipfile.ZipFile
+
+ def fake_zipfile(*a, **kw):
+ if kw.get('compression', None) == zipfile.ZIP_STORED:
+ called.append((a, kw))
+ return zipfile_class(*a, **kw)
+
+ patch(self, archive_util.zipfile, 'ZipFile', fake_zipfile)
+
+ # create something to tar and compress
+ tmpdir = self._create_files()
+ base_name = os.path.join(self.mkdtemp(), 'archive')
+ with path.Path(tmpdir):
+ make_zipfile(base_name, 'dist')
+
+ tarball = base_name + '.zip'
+ assert called == [((tarball, "w"), {'compression': zipfile.ZIP_STORED})]
+ assert os.path.exists(tarball)
+ with zipfile.ZipFile(tarball) as zf:
+ assert sorted(zf.namelist()) == self._zip_created_files
+
+ def test_check_archive_formats(self):
+ assert check_archive_formats(['gztar', 'xxx', 'zip']) == 'xxx'
+ assert (
+ check_archive_formats(['gztar', 'bztar', 'xztar', 'ztar', 'tar', 'zip'])
+ is None
+ )
+
+ def test_make_archive(self):
+ tmpdir = self.mkdtemp()
+ base_name = os.path.join(tmpdir, 'archive')
+ with pytest.raises(ValueError):
+ make_archive(base_name, 'xxx')
+
+ def test_make_archive_cwd(self):
+ current_dir = os.getcwd()
+
+ def _breaks(*args, **kw):
+ raise RuntimeError()
+
+ ARCHIVE_FORMATS['xxx'] = (_breaks, [], 'xxx file')
+ try:
+ try:
+ make_archive('xxx', 'xxx', root_dir=self.mkdtemp())
+ except Exception:
+ pass
+ assert os.getcwd() == current_dir
+ finally:
+ ARCHIVE_FORMATS.pop('xxx')
+
+ def test_make_archive_tar(self):
+ base_dir = self._create_files()
+ base_name = os.path.join(self.mkdtemp(), 'archive')
+ res = make_archive(base_name, 'tar', base_dir, 'dist')
+ assert os.path.exists(res)
+ assert os.path.basename(res) == 'archive.tar'
+ assert self._tarinfo(res) == self._created_files
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_make_archive_gztar(self):
+ base_dir = self._create_files()
+ base_name = os.path.join(self.mkdtemp(), 'archive')
+ res = make_archive(base_name, 'gztar', base_dir, 'dist')
+ assert os.path.exists(res)
+ assert os.path.basename(res) == 'archive.tar.gz'
+ assert self._tarinfo(res) == self._created_files
+
+ def test_make_archive_bztar(self):
+ pytest.importorskip('bz2')
+ base_dir = self._create_files()
+ base_name = os.path.join(self.mkdtemp(), 'archive')
+ res = make_archive(base_name, 'bztar', base_dir, 'dist')
+ assert os.path.exists(res)
+ assert os.path.basename(res) == 'archive.tar.bz2'
+ assert self._tarinfo(res) == self._created_files
+
+ def test_make_archive_xztar(self):
+ pytest.importorskip('lzma')
+ base_dir = self._create_files()
+ base_name = os.path.join(self.mkdtemp(), 'archive')
+ res = make_archive(base_name, 'xztar', base_dir, 'dist')
+ assert os.path.exists(res)
+ assert os.path.basename(res) == 'archive.tar.xz'
+ assert self._tarinfo(res) == self._created_files
+
+ def test_make_archive_owner_group(self):
+ # testing make_archive with owner and group, with various combinations
+ # this works even if there's not gid/uid support
+ if UID_0_SUPPORT:
+ group = grp.getgrgid(0)[0]
+ owner = pwd.getpwuid(0)[0]
+ else:
+ group = owner = 'root'
+
+ base_dir = self._create_files()
+ root_dir = self.mkdtemp()
+ base_name = os.path.join(self.mkdtemp(), 'archive')
+ res = make_archive(
+ base_name, 'zip', root_dir, base_dir, owner=owner, group=group
+ )
+ assert os.path.exists(res)
+
+ res = make_archive(base_name, 'zip', root_dir, base_dir)
+ assert os.path.exists(res)
+
+ res = make_archive(
+ base_name, 'tar', root_dir, base_dir, owner=owner, group=group
+ )
+ assert os.path.exists(res)
+
+ res = make_archive(
+ base_name, 'tar', root_dir, base_dir, owner='kjhkjhkjg', group='oihohoh'
+ )
+ assert os.path.exists(res)
+
+ @pytest.mark.usefixtures('needs_zlib')
+ @require_unix_id
+ @require_uid_0
+ def test_tarfile_root_owner(self):
+ tmpdir = self._create_files()
+ base_name = os.path.join(self.mkdtemp(), 'archive')
+ old_dir = os.getcwd()
+ os.chdir(tmpdir)
+ group = grp.getgrgid(0)[0]
+ owner = pwd.getpwuid(0)[0]
+ try:
+ archive_name = make_tarball(
+ base_name, 'dist', compress=None, owner=owner, group=group
+ )
+ finally:
+ os.chdir(old_dir)
+
+ # check if the compressed tarball was created
+ assert os.path.exists(archive_name)
+
+ # now checks the rights
+ archive = tarfile.open(archive_name)
+ try:
+ for member in archive.getmembers():
+ assert member.uid == 0
+ assert member.gid == 0
+ finally:
+ archive.close()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist.py
new file mode 100644
index 0000000000000000000000000000000000000000..d5696fc3dcd8081335606dc92badd73a69ceac69
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist.py
@@ -0,0 +1,47 @@
+"""Tests for distutils.command.bdist."""
+
+from distutils.command.bdist import bdist
+from distutils.tests import support
+
+
+class TestBuild(support.TempdirManager):
+ def test_formats(self):
+ # let's create a command and make sure
+ # we can set the format
+ dist = self.create_dist()[1]
+ cmd = bdist(dist)
+ cmd.formats = ['gztar']
+ cmd.ensure_finalized()
+ assert cmd.formats == ['gztar']
+
+ # what formats does bdist offer?
+ formats = [
+ 'bztar',
+ 'gztar',
+ 'rpm',
+ 'tar',
+ 'xztar',
+ 'zip',
+ 'ztar',
+ ]
+ found = sorted(cmd.format_commands)
+ assert found == formats
+
+ def test_skip_build(self):
+ # bug #10946: bdist --skip-build should trickle down to subcommands
+ dist = self.create_dist()[1]
+ cmd = bdist(dist)
+ cmd.skip_build = True
+ cmd.ensure_finalized()
+ dist.command_obj['bdist'] = cmd
+
+ names = [
+ 'bdist_dumb',
+ ] # bdist_rpm does not support --skip-build
+
+ for name in names:
+ subcmd = cmd.get_finalized_command(name)
+ if getattr(subcmd, '_unsupported', False):
+ # command is not supported on this build
+ continue
+ assert subcmd.skip_build, f'{name} should take --skip-build from bdist'
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist_dumb.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist_dumb.py
new file mode 100644
index 0000000000000000000000000000000000000000..1fc51d244a78058329c56a618b092e466715e565
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist_dumb.py
@@ -0,0 +1,78 @@
+"""Tests for distutils.command.bdist_dumb."""
+
+import os
+import sys
+import zipfile
+from distutils.command.bdist_dumb import bdist_dumb
+from distutils.core import Distribution
+from distutils.tests import support
+
+import pytest
+
+SETUP_PY = """\
+from distutils.core import setup
+import foo
+
+setup(name='foo', version='0.1', py_modules=['foo'],
+ url='xxx', author='xxx', author_email='xxx')
+
+"""
+
+
+@support.combine_markers
+@pytest.mark.usefixtures('save_env')
+@pytest.mark.usefixtures('save_argv')
+@pytest.mark.usefixtures('save_cwd')
+class TestBuildDumb(
+ support.TempdirManager,
+):
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_simple_built(self):
+ # let's create a simple package
+ tmp_dir = self.mkdtemp()
+ pkg_dir = os.path.join(tmp_dir, 'foo')
+ os.mkdir(pkg_dir)
+ self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
+ self.write_file((pkg_dir, 'foo.py'), '#')
+ self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
+ self.write_file((pkg_dir, 'README'), '')
+
+ dist = Distribution({
+ 'name': 'foo',
+ 'version': '0.1',
+ 'py_modules': ['foo'],
+ 'url': 'xxx',
+ 'author': 'xxx',
+ 'author_email': 'xxx',
+ })
+ dist.script_name = 'setup.py'
+ os.chdir(pkg_dir)
+
+ sys.argv = ['setup.py']
+ cmd = bdist_dumb(dist)
+
+ # so the output is the same no matter
+ # what is the platform
+ cmd.format = 'zip'
+
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # see what we have
+ dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
+ base = f"{dist.get_fullname()}.{cmd.plat_name}.zip"
+
+ assert dist_created == [base]
+
+ # now let's check what we have in the zip file
+ fp = zipfile.ZipFile(os.path.join('dist', base))
+ try:
+ contents = fp.namelist()
+ finally:
+ fp.close()
+
+ contents = sorted(filter(None, map(os.path.basename, contents)))
+ wanted = ['foo-0.1-py{}.{}.egg-info'.format(*sys.version_info[:2]), 'foo.py']
+ if not sys.dont_write_bytecode:
+ wanted.append(f'foo.{sys.implementation.cache_tag}.pyc')
+ assert contents == sorted(wanted)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist_rpm.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist_rpm.py
new file mode 100644
index 0000000000000000000000000000000000000000..75051430e224c8908e22601133a40f5f82ee455a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_bdist_rpm.py
@@ -0,0 +1,127 @@
+"""Tests for distutils.command.bdist_rpm."""
+
+import os
+import shutil # noqa: F401
+import sys
+from distutils.command.bdist_rpm import bdist_rpm
+from distutils.core import Distribution
+from distutils.tests import support
+
+import pytest
+from test.support import requires_zlib
+
+SETUP_PY = """\
+from distutils.core import setup
+import foo
+
+setup(name='foo', version='0.1', py_modules=['foo'],
+ url='xxx', author='xxx', author_email='xxx')
+
+"""
+
+
+@pytest.fixture(autouse=True)
+def sys_executable_encodable():
+ try:
+ sys.executable.encode('UTF-8')
+ except UnicodeEncodeError:
+ pytest.skip("sys.executable is not encodable to UTF-8")
+
+
+mac_woes = pytest.mark.skipif(
+ "not sys.platform.startswith('linux')",
+ reason='spurious sdtout/stderr output under macOS',
+)
+
+
+@pytest.mark.usefixtures('save_env')
+@pytest.mark.usefixtures('save_argv')
+@pytest.mark.usefixtures('save_cwd')
+class TestBuildRpm(
+ support.TempdirManager,
+):
+ @mac_woes
+ @requires_zlib()
+ @pytest.mark.skipif("not shutil.which('rpm')")
+ @pytest.mark.skipif("not shutil.which('rpmbuild')")
+ def test_quiet(self):
+ # let's create a package
+ tmp_dir = self.mkdtemp()
+ os.environ['HOME'] = tmp_dir # to confine dir '.rpmdb' creation
+ pkg_dir = os.path.join(tmp_dir, 'foo')
+ os.mkdir(pkg_dir)
+ self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
+ self.write_file((pkg_dir, 'foo.py'), '#')
+ self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
+ self.write_file((pkg_dir, 'README'), '')
+
+ dist = Distribution({
+ 'name': 'foo',
+ 'version': '0.1',
+ 'py_modules': ['foo'],
+ 'url': 'xxx',
+ 'author': 'xxx',
+ 'author_email': 'xxx',
+ })
+ dist.script_name = 'setup.py'
+ os.chdir(pkg_dir)
+
+ sys.argv = ['setup.py']
+ cmd = bdist_rpm(dist)
+ cmd.fix_python = True
+
+ # running in quiet mode
+ cmd.quiet = True
+ cmd.ensure_finalized()
+ cmd.run()
+
+ dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
+ assert 'foo-0.1-1.noarch.rpm' in dist_created
+
+ # bug #2945: upload ignores bdist_rpm files
+ assert ('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm') in dist.dist_files
+ assert ('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm') in dist.dist_files
+
+ @mac_woes
+ @requires_zlib()
+ # https://bugs.python.org/issue1533164
+ @pytest.mark.skipif("not shutil.which('rpm')")
+ @pytest.mark.skipif("not shutil.which('rpmbuild')")
+ def test_no_optimize_flag(self):
+ # let's create a package that breaks bdist_rpm
+ tmp_dir = self.mkdtemp()
+ os.environ['HOME'] = tmp_dir # to confine dir '.rpmdb' creation
+ pkg_dir = os.path.join(tmp_dir, 'foo')
+ os.mkdir(pkg_dir)
+ self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
+ self.write_file((pkg_dir, 'foo.py'), '#')
+ self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
+ self.write_file((pkg_dir, 'README'), '')
+
+ dist = Distribution({
+ 'name': 'foo',
+ 'version': '0.1',
+ 'py_modules': ['foo'],
+ 'url': 'xxx',
+ 'author': 'xxx',
+ 'author_email': 'xxx',
+ })
+ dist.script_name = 'setup.py'
+ os.chdir(pkg_dir)
+
+ sys.argv = ['setup.py']
+ cmd = bdist_rpm(dist)
+ cmd.fix_python = True
+
+ cmd.quiet = True
+ cmd.ensure_finalized()
+ cmd.run()
+
+ dist_created = os.listdir(os.path.join(pkg_dir, 'dist'))
+ assert 'foo-0.1-1.noarch.rpm' in dist_created
+
+ # bug #2945: upload ignores bdist_rpm files
+ assert ('bdist_rpm', 'any', 'dist/foo-0.1-1.src.rpm') in dist.dist_files
+ assert ('bdist_rpm', 'any', 'dist/foo-0.1-1.noarch.rpm') in dist.dist_files
+
+ os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build.py
new file mode 100644
index 0000000000000000000000000000000000000000..f7fe69acd1ad39cf40d277afd6409648b18df146
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build.py
@@ -0,0 +1,49 @@
+"""Tests for distutils.command.build."""
+
+import os
+import sys
+from distutils.command.build import build
+from distutils.tests import support
+from sysconfig import get_config_var, get_platform
+
+
+class TestBuild(support.TempdirManager):
+ def test_finalize_options(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = build(dist)
+ cmd.finalize_options()
+
+ # if not specified, plat_name gets the current platform
+ assert cmd.plat_name == get_platform()
+
+ # build_purelib is build + lib
+ wanted = os.path.join(cmd.build_base, 'lib')
+ assert cmd.build_purelib == wanted
+
+ # build_platlib is 'build/lib.platform-cache_tag[-pydebug]'
+ # examples:
+ # build/lib.macosx-10.3-i386-cpython39
+ plat_spec = f'.{cmd.plat_name}-{sys.implementation.cache_tag}'
+ if get_config_var('Py_GIL_DISABLED'):
+ plat_spec += 't'
+ if hasattr(sys, 'gettotalrefcount'):
+ assert cmd.build_platlib.endswith('-pydebug')
+ plat_spec += '-pydebug'
+ wanted = os.path.join(cmd.build_base, 'lib' + plat_spec)
+ assert cmd.build_platlib == wanted
+
+ # by default, build_lib = build_purelib
+ assert cmd.build_lib == cmd.build_purelib
+
+ # build_temp is build/temp.
+ wanted = os.path.join(cmd.build_base, 'temp' + plat_spec)
+ assert cmd.build_temp == wanted
+
+ # build_scripts is build/scripts-x.x
+ wanted = os.path.join(
+ cmd.build_base, f'scripts-{sys.version_info.major}.{sys.version_info.minor}'
+ )
+ assert cmd.build_scripts == wanted
+
+ # executable is os.path.normpath(sys.executable)
+ assert cmd.executable == os.path.normpath(sys.executable)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_clib.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_clib.py
new file mode 100644
index 0000000000000000000000000000000000000000..f76f26bcea04ebeaeba20d3c65881198f841c9b5
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_clib.py
@@ -0,0 +1,134 @@
+"""Tests for distutils.command.build_clib."""
+
+import os
+from distutils.command.build_clib import build_clib
+from distutils.errors import DistutilsSetupError
+from distutils.tests import missing_compiler_executable, support
+
+import pytest
+
+
+class TestBuildCLib(support.TempdirManager):
+ def test_check_library_dist(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = build_clib(dist)
+
+ # 'libraries' option must be a list
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_library_list('foo')
+
+ # each element of 'libraries' must a 2-tuple
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_library_list(['foo1', 'foo2'])
+
+ # first element of each tuple in 'libraries'
+ # must be a string (the library name)
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_library_list([(1, 'foo1'), ('name', 'foo2')])
+
+ # library name may not contain directory separators
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_library_list(
+ [('name', 'foo1'), ('another/name', 'foo2')],
+ )
+
+ # second element of each tuple must be a dictionary (build info)
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_library_list(
+ [('name', {}), ('another', 'foo2')],
+ )
+
+ # those work
+ libs = [('name', {}), ('name', {'ok': 'good'})]
+ cmd.check_library_list(libs)
+
+ def test_get_source_files(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = build_clib(dist)
+
+ # "in 'libraries' option 'sources' must be present and must be
+ # a list of source filenames
+ cmd.libraries = [('name', {})]
+ with pytest.raises(DistutilsSetupError):
+ cmd.get_source_files()
+
+ cmd.libraries = [('name', {'sources': 1})]
+ with pytest.raises(DistutilsSetupError):
+ cmd.get_source_files()
+
+ cmd.libraries = [('name', {'sources': ['a', 'b']})]
+ assert cmd.get_source_files() == ['a', 'b']
+
+ cmd.libraries = [('name', {'sources': ('a', 'b')})]
+ assert cmd.get_source_files() == ['a', 'b']
+
+ cmd.libraries = [
+ ('name', {'sources': ('a', 'b')}),
+ ('name2', {'sources': ['c', 'd']}),
+ ]
+ assert cmd.get_source_files() == ['a', 'b', 'c', 'd']
+
+ def test_build_libraries(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = build_clib(dist)
+
+ class FakeCompiler:
+ def compile(*args, **kw):
+ pass
+
+ create_static_lib = compile
+
+ cmd.compiler = FakeCompiler()
+
+ # build_libraries is also doing a bit of typo checking
+ lib = [('name', {'sources': 'notvalid'})]
+ with pytest.raises(DistutilsSetupError):
+ cmd.build_libraries(lib)
+
+ lib = [('name', {'sources': list()})]
+ cmd.build_libraries(lib)
+
+ lib = [('name', {'sources': tuple()})]
+ cmd.build_libraries(lib)
+
+ def test_finalize_options(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = build_clib(dist)
+
+ cmd.include_dirs = 'one-dir'
+ cmd.finalize_options()
+ assert cmd.include_dirs == ['one-dir']
+
+ cmd.include_dirs = None
+ cmd.finalize_options()
+ assert cmd.include_dirs == []
+
+ cmd.distribution.libraries = 'WONTWORK'
+ with pytest.raises(DistutilsSetupError):
+ cmd.finalize_options()
+
+ @pytest.mark.skipif('platform.system() == "Windows"')
+ def test_run(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = build_clib(dist)
+
+ foo_c = os.path.join(pkg_dir, 'foo.c')
+ self.write_file(foo_c, 'int main(void) { return 1;}\n')
+ cmd.libraries = [('foo', {'sources': [foo_c]})]
+
+ build_temp = os.path.join(pkg_dir, 'build')
+ os.mkdir(build_temp)
+ cmd.build_temp = build_temp
+ cmd.build_clib = build_temp
+
+ # Before we run the command, we want to make sure
+ # all commands are present on the system.
+ ccmd = missing_compiler_executable()
+ if ccmd is not None:
+ self.skipTest(f'The {ccmd!r} command is not found')
+
+ # this should work
+ cmd.run()
+
+ # let's check the result
+ assert 'libfoo.a' in os.listdir(build_temp)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_ext.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_ext.py
new file mode 100644
index 0000000000000000000000000000000000000000..dab0507f3d3ec104fb4acfe5b15f92661ff33a37
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_ext.py
@@ -0,0 +1,628 @@
+import contextlib
+import glob
+import importlib
+import os.path
+import platform
+import re
+import shutil
+import site
+import subprocess
+import sys
+import tempfile
+import textwrap
+import time
+from distutils import sysconfig
+from distutils.command.build_ext import build_ext
+from distutils.core import Distribution
+from distutils.errors import (
+ CompileError,
+ DistutilsPlatformError,
+ DistutilsSetupError,
+ UnknownFileError,
+)
+from distutils.extension import Extension
+from distutils.tests import missing_compiler_executable
+from distutils.tests.support import TempdirManager, copy_xxmodule_c, fixup_build_ext
+from io import StringIO
+
+import jaraco.path
+import path
+import pytest
+from test import support
+
+from .compat import py39 as import_helper
+
+
+@pytest.fixture()
+def user_site_dir(request):
+ self = request.instance
+ self.tmp_dir = self.mkdtemp()
+ self.tmp_path = path.Path(self.tmp_dir)
+ from distutils.command import build_ext
+
+ orig_user_base = site.USER_BASE
+
+ site.USER_BASE = self.mkdtemp()
+ build_ext.USER_BASE = site.USER_BASE
+
+ # bpo-30132: On Windows, a .pdb file may be created in the current
+ # working directory. Create a temporary working directory to cleanup
+ # everything at the end of the test.
+ with self.tmp_path:
+ yield
+
+ site.USER_BASE = orig_user_base
+ build_ext.USER_BASE = orig_user_base
+
+ if sys.platform == 'cygwin':
+ time.sleep(1)
+
+
+@contextlib.contextmanager
+def safe_extension_import(name, path):
+ with import_helper.CleanImport(name):
+ with extension_redirect(name, path) as new_path:
+ with import_helper.DirsOnSysPath(new_path):
+ yield
+
+
+@contextlib.contextmanager
+def extension_redirect(mod, path):
+ """
+ Tests will fail to tear down an extension module if it's been imported.
+
+ Before importing, copy the file to a temporary directory that won't
+ be cleaned up. Yield the new path.
+ """
+ if platform.system() != "Windows" and sys.platform != "cygwin":
+ yield path
+ return
+ with import_helper.DirsOnSysPath(path):
+ spec = importlib.util.find_spec(mod)
+ filename = os.path.basename(spec.origin)
+ trash_dir = tempfile.mkdtemp(prefix='deleteme')
+ dest = os.path.join(trash_dir, os.path.basename(filename))
+ shutil.copy(spec.origin, dest)
+ yield trash_dir
+ # TODO: can the file be scheduled for deletion?
+
+
+@pytest.mark.usefixtures('user_site_dir')
+class TestBuildExt(TempdirManager):
+ def build_ext(self, *args, **kwargs):
+ return build_ext(*args, **kwargs)
+
+ @pytest.mark.parametrize("copy_so", [False])
+ def test_build_ext(self, copy_so):
+ missing_compiler_executable()
+ copy_xxmodule_c(self.tmp_dir)
+ xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
+ xx_ext = Extension('xx', [xx_c])
+ if sys.platform != "win32":
+ if not copy_so:
+ xx_ext = Extension(
+ 'xx',
+ [xx_c],
+ library_dirs=['/usr/lib'],
+ libraries=['z'],
+ runtime_library_dirs=['/usr/lib'],
+ )
+ elif sys.platform == 'linux':
+ libz_so = {
+ os.path.realpath(name) for name in glob.iglob('/usr/lib*/libz.so*')
+ }
+ libz_so = sorted(libz_so, key=lambda lib_path: len(lib_path))
+ shutil.copyfile(libz_so[-1], '/tmp/libxx_z.so')
+
+ xx_ext = Extension(
+ 'xx',
+ [xx_c],
+ library_dirs=['/tmp'],
+ libraries=['xx_z'],
+ runtime_library_dirs=['/tmp'],
+ )
+ dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
+ dist.package_dir = self.tmp_dir
+ cmd = self.build_ext(dist)
+ fixup_build_ext(cmd)
+ cmd.build_lib = self.tmp_dir
+ cmd.build_temp = self.tmp_dir
+
+ old_stdout = sys.stdout
+ if not support.verbose:
+ # silence compiler output
+ sys.stdout = StringIO()
+ try:
+ cmd.ensure_finalized()
+ cmd.run()
+ finally:
+ sys.stdout = old_stdout
+
+ with safe_extension_import('xx', self.tmp_dir):
+ self._test_xx(copy_so)
+
+ if sys.platform == 'linux' and copy_so:
+ os.unlink('/tmp/libxx_z.so')
+
+ @staticmethod
+ def _test_xx(copy_so):
+ import xx # type: ignore[import-not-found] # Module generated for tests
+
+ for attr in ('error', 'foo', 'new', 'roj'):
+ assert hasattr(xx, attr)
+
+ assert xx.foo(2, 5) == 7
+ assert xx.foo(13, 15) == 28
+ assert xx.new().demo() is None
+ if support.HAVE_DOCSTRINGS:
+ doc = 'This is a template module just for instruction.'
+ assert xx.__doc__ == doc
+ assert isinstance(xx.Null(), xx.Null)
+ assert isinstance(xx.Str(), xx.Str)
+
+ if sys.platform == 'linux':
+ so_headers = subprocess.check_output(
+ ["readelf", "-d", xx.__file__], universal_newlines=True
+ )
+ import pprint
+
+ pprint.pprint(so_headers)
+ rpaths = [
+ rpath
+ for line in so_headers.split("\n")
+ if "RPATH" in line or "RUNPATH" in line
+ for rpath in line.split()[2][1:-1].split(":")
+ ]
+ if not copy_so:
+ pprint.pprint(rpaths)
+ # Linked against a library in /usr/lib{,64}
+ assert "/usr/lib" not in rpaths and "/usr/lib64" not in rpaths
+ else:
+ # Linked against a library in /tmp
+ assert "/tmp" in rpaths
+ # The import is the real test here
+
+ def test_solaris_enable_shared(self):
+ dist = Distribution({'name': 'xx'})
+ cmd = self.build_ext(dist)
+ old = sys.platform
+
+ sys.platform = 'sunos' # fooling finalize_options
+ from distutils.sysconfig import _config_vars
+
+ old_var = _config_vars.get('Py_ENABLE_SHARED')
+ _config_vars['Py_ENABLE_SHARED'] = True
+ try:
+ cmd.ensure_finalized()
+ finally:
+ sys.platform = old
+ if old_var is None:
+ del _config_vars['Py_ENABLE_SHARED']
+ else:
+ _config_vars['Py_ENABLE_SHARED'] = old_var
+
+ # make sure we get some library dirs under solaris
+ assert len(cmd.library_dirs) > 0
+
+ def test_user_site(self):
+ import site
+
+ dist = Distribution({'name': 'xx'})
+ cmd = self.build_ext(dist)
+
+ # making sure the user option is there
+ options = [name for name, short, label in cmd.user_options]
+ assert 'user' in options
+
+ # setting a value
+ cmd.user = True
+
+ # setting user based lib and include
+ lib = os.path.join(site.USER_BASE, 'lib')
+ incl = os.path.join(site.USER_BASE, 'include')
+ os.mkdir(lib)
+ os.mkdir(incl)
+
+ # let's run finalize
+ cmd.ensure_finalized()
+
+ # see if include_dirs and library_dirs
+ # were set
+ assert lib in cmd.library_dirs
+ assert lib in cmd.rpath
+ assert incl in cmd.include_dirs
+
+ def test_optional_extension(self):
+ # this extension will fail, but let's ignore this failure
+ # with the optional argument.
+ modules = [Extension('foo', ['xxx'], optional=False)]
+ dist = Distribution({'name': 'xx', 'ext_modules': modules})
+ cmd = self.build_ext(dist)
+ cmd.ensure_finalized()
+ with pytest.raises((UnknownFileError, CompileError)):
+ cmd.run() # should raise an error
+
+ modules = [Extension('foo', ['xxx'], optional=True)]
+ dist = Distribution({'name': 'xx', 'ext_modules': modules})
+ cmd = self.build_ext(dist)
+ cmd.ensure_finalized()
+ cmd.run() # should pass
+
+ def test_finalize_options(self):
+ # Make sure Python's include directories (for Python.h, pyconfig.h,
+ # etc.) are in the include search path.
+ modules = [Extension('foo', ['xxx'], optional=False)]
+ dist = Distribution({'name': 'xx', 'ext_modules': modules})
+ cmd = self.build_ext(dist)
+ cmd.finalize_options()
+
+ py_include = sysconfig.get_python_inc()
+ for p in py_include.split(os.path.pathsep):
+ assert p in cmd.include_dirs
+
+ plat_py_include = sysconfig.get_python_inc(plat_specific=True)
+ for p in plat_py_include.split(os.path.pathsep):
+ assert p in cmd.include_dirs
+
+ # make sure cmd.libraries is turned into a list
+ # if it's a string
+ cmd = self.build_ext(dist)
+ cmd.libraries = 'my_lib, other_lib lastlib'
+ cmd.finalize_options()
+ assert cmd.libraries == ['my_lib', 'other_lib', 'lastlib']
+
+ # make sure cmd.library_dirs is turned into a list
+ # if it's a string
+ cmd = self.build_ext(dist)
+ cmd.library_dirs = f'my_lib_dir{os.pathsep}other_lib_dir'
+ cmd.finalize_options()
+ assert 'my_lib_dir' in cmd.library_dirs
+ assert 'other_lib_dir' in cmd.library_dirs
+
+ # make sure rpath is turned into a list
+ # if it's a string
+ cmd = self.build_ext(dist)
+ cmd.rpath = f'one{os.pathsep}two'
+ cmd.finalize_options()
+ assert cmd.rpath == ['one', 'two']
+
+ # make sure cmd.link_objects is turned into a list
+ # if it's a string
+ cmd = build_ext(dist)
+ cmd.link_objects = 'one two,three'
+ cmd.finalize_options()
+ assert cmd.link_objects == ['one', 'two', 'three']
+
+ # XXX more tests to perform for win32
+
+ # make sure define is turned into 2-tuples
+ # strings if they are ','-separated strings
+ cmd = self.build_ext(dist)
+ cmd.define = 'one,two'
+ cmd.finalize_options()
+ assert cmd.define == [('one', '1'), ('two', '1')]
+
+ # make sure undef is turned into a list of
+ # strings if they are ','-separated strings
+ cmd = self.build_ext(dist)
+ cmd.undef = 'one,two'
+ cmd.finalize_options()
+ assert cmd.undef == ['one', 'two']
+
+ # make sure swig_opts is turned into a list
+ cmd = self.build_ext(dist)
+ cmd.swig_opts = None
+ cmd.finalize_options()
+ assert cmd.swig_opts == []
+
+ cmd = self.build_ext(dist)
+ cmd.swig_opts = '1 2'
+ cmd.finalize_options()
+ assert cmd.swig_opts == ['1', '2']
+
+ def test_check_extensions_list(self):
+ dist = Distribution()
+ cmd = self.build_ext(dist)
+ cmd.finalize_options()
+
+ # 'extensions' option must be a list of Extension instances
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_extensions_list('foo')
+
+ # each element of 'ext_modules' option must be an
+ # Extension instance or 2-tuple
+ exts = [('bar', 'foo', 'bar'), 'foo']
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_extensions_list(exts)
+
+ # first element of each tuple in 'ext_modules'
+ # must be the extension name (a string) and match
+ # a python dotted-separated name
+ exts = [('foo-bar', '')]
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_extensions_list(exts)
+
+ # second element of each tuple in 'ext_modules'
+ # must be a dictionary (build info)
+ exts = [('foo.bar', '')]
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_extensions_list(exts)
+
+ # ok this one should pass
+ exts = [('foo.bar', {'sources': [''], 'libraries': 'foo', 'some': 'bar'})]
+ cmd.check_extensions_list(exts)
+ ext = exts[0]
+ assert isinstance(ext, Extension)
+
+ # check_extensions_list adds in ext the values passed
+ # when they are in ('include_dirs', 'library_dirs', 'libraries'
+ # 'extra_objects', 'extra_compile_args', 'extra_link_args')
+ assert ext.libraries == 'foo'
+ assert not hasattr(ext, 'some')
+
+ # 'macros' element of build info dict must be 1- or 2-tuple
+ exts = [
+ (
+ 'foo.bar',
+ {
+ 'sources': [''],
+ 'libraries': 'foo',
+ 'some': 'bar',
+ 'macros': [('1', '2', '3'), 'foo'],
+ },
+ )
+ ]
+ with pytest.raises(DistutilsSetupError):
+ cmd.check_extensions_list(exts)
+
+ exts[0][1]['macros'] = [('1', '2'), ('3',)]
+ cmd.check_extensions_list(exts)
+ assert exts[0].undef_macros == ['3']
+ assert exts[0].define_macros == [('1', '2')]
+
+ def test_get_source_files(self):
+ modules = [Extension('foo', ['xxx'], optional=False)]
+ dist = Distribution({'name': 'xx', 'ext_modules': modules})
+ cmd = self.build_ext(dist)
+ cmd.ensure_finalized()
+ assert cmd.get_source_files() == ['xxx']
+
+ def test_unicode_module_names(self):
+ modules = [
+ Extension('foo', ['aaa'], optional=False),
+ Extension('föö', ['uuu'], optional=False),
+ ]
+ dist = Distribution({'name': 'xx', 'ext_modules': modules})
+ cmd = self.build_ext(dist)
+ cmd.ensure_finalized()
+ assert re.search(r'foo(_d)?\..*', cmd.get_ext_filename(modules[0].name))
+ assert re.search(r'föö(_d)?\..*', cmd.get_ext_filename(modules[1].name))
+ assert cmd.get_export_symbols(modules[0]) == ['PyInit_foo']
+ assert cmd.get_export_symbols(modules[1]) == ['PyInitU_f_1gaa']
+
+ def test_export_symbols__init__(self):
+ # https://github.com/python/cpython/issues/80074
+ # https://github.com/pypa/setuptools/issues/4826
+ modules = [
+ Extension('foo.__init__', ['aaa']),
+ Extension('föö.__init__', ['uuu']),
+ ]
+ dist = Distribution({'name': 'xx', 'ext_modules': modules})
+ cmd = self.build_ext(dist)
+ cmd.ensure_finalized()
+ assert cmd.get_export_symbols(modules[0]) == ['PyInit_foo']
+ assert cmd.get_export_symbols(modules[1]) == ['PyInitU_f_1gaa']
+
+ def test_compiler_option(self):
+ # cmd.compiler is an option and
+ # should not be overridden by a compiler instance
+ # when the command is run
+ dist = Distribution()
+ cmd = self.build_ext(dist)
+ cmd.compiler = 'unix'
+ cmd.ensure_finalized()
+ cmd.run()
+ assert cmd.compiler == 'unix'
+
+ def test_get_outputs(self):
+ missing_compiler_executable()
+ tmp_dir = self.mkdtemp()
+ c_file = os.path.join(tmp_dir, 'foo.c')
+ self.write_file(c_file, 'void PyInit_foo(void) {}\n')
+ ext = Extension('foo', [c_file], optional=False)
+ dist = Distribution({'name': 'xx', 'ext_modules': [ext]})
+ cmd = self.build_ext(dist)
+ fixup_build_ext(cmd)
+ cmd.ensure_finalized()
+ assert len(cmd.get_outputs()) == 1
+
+ cmd.build_lib = os.path.join(self.tmp_dir, 'build')
+ cmd.build_temp = os.path.join(self.tmp_dir, 'tempt')
+
+ # issue #5977 : distutils build_ext.get_outputs
+ # returns wrong result with --inplace
+ other_tmp_dir = os.path.realpath(self.mkdtemp())
+ old_wd = os.getcwd()
+ os.chdir(other_tmp_dir)
+ try:
+ cmd.inplace = True
+ cmd.run()
+ so_file = cmd.get_outputs()[0]
+ finally:
+ os.chdir(old_wd)
+ assert os.path.exists(so_file)
+ ext_suffix = sysconfig.get_config_var('EXT_SUFFIX')
+ assert so_file.endswith(ext_suffix)
+ so_dir = os.path.dirname(so_file)
+ assert so_dir == other_tmp_dir
+
+ cmd.inplace = False
+ cmd.compiler = None
+ cmd.run()
+ so_file = cmd.get_outputs()[0]
+ assert os.path.exists(so_file)
+ assert so_file.endswith(ext_suffix)
+ so_dir = os.path.dirname(so_file)
+ assert so_dir == cmd.build_lib
+
+ # inplace = False, cmd.package = 'bar'
+ build_py = cmd.get_finalized_command('build_py')
+ build_py.package_dir = {'': 'bar'}
+ path = cmd.get_ext_fullpath('foo')
+ # checking that the last directory is the build_dir
+ path = os.path.split(path)[0]
+ assert path == cmd.build_lib
+
+ # inplace = True, cmd.package = 'bar'
+ cmd.inplace = True
+ other_tmp_dir = os.path.realpath(self.mkdtemp())
+ old_wd = os.getcwd()
+ os.chdir(other_tmp_dir)
+ try:
+ path = cmd.get_ext_fullpath('foo')
+ finally:
+ os.chdir(old_wd)
+ # checking that the last directory is bar
+ path = os.path.split(path)[0]
+ lastdir = os.path.split(path)[-1]
+ assert lastdir == 'bar'
+
+ def test_ext_fullpath(self):
+ ext = sysconfig.get_config_var('EXT_SUFFIX')
+ # building lxml.etree inplace
+ # etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c')
+ # etree_ext = Extension('lxml.etree', [etree_c])
+ # dist = Distribution({'name': 'lxml', 'ext_modules': [etree_ext]})
+ dist = Distribution()
+ cmd = self.build_ext(dist)
+ cmd.inplace = True
+ cmd.distribution.package_dir = {'': 'src'}
+ cmd.distribution.packages = ['lxml', 'lxml.html']
+ curdir = os.getcwd()
+ wanted = os.path.join(curdir, 'src', 'lxml', 'etree' + ext)
+ path = cmd.get_ext_fullpath('lxml.etree')
+ assert wanted == path
+
+ # building lxml.etree not inplace
+ cmd.inplace = False
+ cmd.build_lib = os.path.join(curdir, 'tmpdir')
+ wanted = os.path.join(curdir, 'tmpdir', 'lxml', 'etree' + ext)
+ path = cmd.get_ext_fullpath('lxml.etree')
+ assert wanted == path
+
+ # building twisted.runner.portmap not inplace
+ build_py = cmd.get_finalized_command('build_py')
+ build_py.package_dir = {}
+ cmd.distribution.packages = ['twisted', 'twisted.runner.portmap']
+ path = cmd.get_ext_fullpath('twisted.runner.portmap')
+ wanted = os.path.join(curdir, 'tmpdir', 'twisted', 'runner', 'portmap' + ext)
+ assert wanted == path
+
+ # building twisted.runner.portmap inplace
+ cmd.inplace = True
+ path = cmd.get_ext_fullpath('twisted.runner.portmap')
+ wanted = os.path.join(curdir, 'twisted', 'runner', 'portmap' + ext)
+ assert wanted == path
+
+ @pytest.mark.skipif('platform.system() != "Darwin"')
+ @pytest.mark.usefixtures('save_env')
+ def test_deployment_target_default(self):
+ # Issue 9516: Test that, in the absence of the environment variable,
+ # an extension module is compiled with the same deployment target as
+ # the interpreter.
+ self._try_compile_deployment_target('==', None)
+
+ @pytest.mark.skipif('platform.system() != "Darwin"')
+ @pytest.mark.usefixtures('save_env')
+ def test_deployment_target_too_low(self):
+ # Issue 9516: Test that an extension module is not allowed to be
+ # compiled with a deployment target less than that of the interpreter.
+ with pytest.raises(DistutilsPlatformError):
+ self._try_compile_deployment_target('>', '10.1')
+
+ @pytest.mark.skipif('platform.system() != "Darwin"')
+ @pytest.mark.usefixtures('save_env')
+ def test_deployment_target_higher_ok(self): # pragma: no cover
+ # Issue 9516: Test that an extension module can be compiled with a
+ # deployment target higher than that of the interpreter: the ext
+ # module may depend on some newer OS feature.
+ deptarget = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
+ if deptarget:
+ # increment the minor version number (i.e. 10.6 -> 10.7)
+ deptarget = [int(x) for x in deptarget.split('.')]
+ deptarget[-1] += 1
+ deptarget = '.'.join(str(i) for i in deptarget)
+ self._try_compile_deployment_target('<', deptarget)
+
+ def _try_compile_deployment_target(self, operator, target): # pragma: no cover
+ if target is None:
+ if os.environ.get('MACOSX_DEPLOYMENT_TARGET'):
+ del os.environ['MACOSX_DEPLOYMENT_TARGET']
+ else:
+ os.environ['MACOSX_DEPLOYMENT_TARGET'] = target
+
+ jaraco.path.build(
+ {
+ 'deptargetmodule.c': textwrap.dedent(f"""\
+ #include
+
+ int dummy;
+
+ #if TARGET {operator} MAC_OS_X_VERSION_MIN_REQUIRED
+ #else
+ #error "Unexpected target"
+ #endif
+
+ """),
+ },
+ self.tmp_path,
+ )
+
+ # get the deployment target that the interpreter was built with
+ target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
+ target = tuple(map(int, target.split('.')[0:2]))
+ # format the target value as defined in the Apple
+ # Availability Macros. We can't use the macro names since
+ # at least one value we test with will not exist yet.
+ if target[:2] < (10, 10):
+ # for 10.1 through 10.9.x -> "10n0"
+ tmpl = '{:02}{:01}0'
+ else:
+ # for 10.10 and beyond -> "10nn00"
+ if len(target) >= 2:
+ tmpl = '{:02}{:02}00'
+ else:
+ # 11 and later can have no minor version (11 instead of 11.0)
+ tmpl = '{:02}0000'
+ target = tmpl.format(*target)
+ deptarget_ext = Extension(
+ 'deptarget',
+ [self.tmp_path / 'deptargetmodule.c'],
+ extra_compile_args=[f'-DTARGET={target}'],
+ )
+ dist = Distribution({'name': 'deptarget', 'ext_modules': [deptarget_ext]})
+ dist.package_dir = self.tmp_dir
+ cmd = self.build_ext(dist)
+ cmd.build_lib = self.tmp_dir
+ cmd.build_temp = self.tmp_dir
+
+ try:
+ old_stdout = sys.stdout
+ if not support.verbose:
+ # silence compiler output
+ sys.stdout = StringIO()
+ try:
+ cmd.ensure_finalized()
+ cmd.run()
+ finally:
+ sys.stdout = old_stdout
+
+ except CompileError:
+ self.fail("Wrong deployment target during compilation")
+
+
+class TestParallelBuildExt(TestBuildExt):
+ def build_ext(self, *args, **kwargs):
+ build_ext = super().build_ext(*args, **kwargs)
+ build_ext.parallel = True
+ return build_ext
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_py.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_py.py
new file mode 100644
index 0000000000000000000000000000000000000000..b316ed43a11836210caeb7177bd8890a1f61d1bb
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_py.py
@@ -0,0 +1,196 @@
+"""Tests for distutils.command.build_py."""
+
+import os
+import sys
+from distutils.command.build_py import build_py
+from distutils.core import Distribution
+from distutils.errors import DistutilsFileError
+from distutils.tests import support
+
+import jaraco.path
+import pytest
+
+
+@support.combine_markers
+class TestBuildPy(support.TempdirManager):
+ def test_package_data(self):
+ sources = self.mkdtemp()
+ jaraco.path.build(
+ {
+ '__init__.py': "# Pretend this is a package.",
+ 'README.txt': 'Info about this package',
+ },
+ sources,
+ )
+
+ destination = self.mkdtemp()
+
+ dist = Distribution({"packages": ["pkg"], "package_dir": {"pkg": sources}})
+ # script_name need not exist, it just need to be initialized
+ dist.script_name = os.path.join(sources, "setup.py")
+ dist.command_obj["build"] = support.DummyCommand(
+ force=False, build_lib=destination
+ )
+ dist.packages = ["pkg"]
+ dist.package_data = {"pkg": ["README.txt"]}
+ dist.package_dir = {"pkg": sources}
+
+ cmd = build_py(dist)
+ cmd.compile = True
+ cmd.ensure_finalized()
+ assert cmd.package_data == dist.package_data
+
+ cmd.run()
+
+ # This makes sure the list of outputs includes byte-compiled
+ # files for Python modules but not for package data files
+ # (there shouldn't *be* byte-code files for those!).
+ assert len(cmd.get_outputs()) == 3
+ pkgdest = os.path.join(destination, "pkg")
+ files = os.listdir(pkgdest)
+ pycache_dir = os.path.join(pkgdest, "__pycache__")
+ assert "__init__.py" in files
+ assert "README.txt" in files
+ if sys.dont_write_bytecode:
+ assert not os.path.exists(pycache_dir)
+ else:
+ pyc_files = os.listdir(pycache_dir)
+ assert f"__init__.{sys.implementation.cache_tag}.pyc" in pyc_files
+
+ def test_empty_package_dir(self):
+ # See bugs #1668596/#1720897
+ sources = self.mkdtemp()
+ jaraco.path.build({'__init__.py': '', 'doc': {'testfile': ''}}, sources)
+
+ os.chdir(sources)
+ dist = Distribution({
+ "packages": ["pkg"],
+ "package_dir": {"pkg": ""},
+ "package_data": {"pkg": ["doc/*"]},
+ })
+ # script_name need not exist, it just need to be initialized
+ dist.script_name = os.path.join(sources, "setup.py")
+ dist.script_args = ["build"]
+ dist.parse_command_line()
+
+ try:
+ dist.run_commands()
+ except DistutilsFileError:
+ self.fail("failed package_data test when package_dir is ''")
+
+ @pytest.mark.skipif('sys.dont_write_bytecode')
+ def test_byte_compile(self):
+ project_dir, dist = self.create_dist(py_modules=['boiledeggs'])
+ os.chdir(project_dir)
+ self.write_file('boiledeggs.py', 'import antigravity')
+ cmd = build_py(dist)
+ cmd.compile = True
+ cmd.build_lib = 'here'
+ cmd.finalize_options()
+ cmd.run()
+
+ found = os.listdir(cmd.build_lib)
+ assert sorted(found) == ['__pycache__', 'boiledeggs.py']
+ found = os.listdir(os.path.join(cmd.build_lib, '__pycache__'))
+ assert found == [f'boiledeggs.{sys.implementation.cache_tag}.pyc']
+
+ @pytest.mark.skipif('sys.dont_write_bytecode')
+ def test_byte_compile_optimized(self):
+ project_dir, dist = self.create_dist(py_modules=['boiledeggs'])
+ os.chdir(project_dir)
+ self.write_file('boiledeggs.py', 'import antigravity')
+ cmd = build_py(dist)
+ cmd.compile = False
+ cmd.optimize = 1
+ cmd.build_lib = 'here'
+ cmd.finalize_options()
+ cmd.run()
+
+ found = os.listdir(cmd.build_lib)
+ assert sorted(found) == ['__pycache__', 'boiledeggs.py']
+ found = os.listdir(os.path.join(cmd.build_lib, '__pycache__'))
+ expect = f'boiledeggs.{sys.implementation.cache_tag}.opt-1.pyc'
+ assert sorted(found) == [expect]
+
+ def test_dir_in_package_data(self):
+ """
+ A directory in package_data should not be added to the filelist.
+ """
+ # See bug 19286
+ sources = self.mkdtemp()
+ jaraco.path.build(
+ {
+ 'pkg': {
+ '__init__.py': '',
+ 'doc': {
+ 'testfile': '',
+ # create a directory that could be incorrectly detected as a file
+ 'otherdir': {},
+ },
+ }
+ },
+ sources,
+ )
+
+ os.chdir(sources)
+ dist = Distribution({"packages": ["pkg"], "package_data": {"pkg": ["doc/*"]}})
+ # script_name need not exist, it just need to be initialized
+ dist.script_name = os.path.join(sources, "setup.py")
+ dist.script_args = ["build"]
+ dist.parse_command_line()
+
+ try:
+ dist.run_commands()
+ except DistutilsFileError:
+ self.fail("failed package_data when data dir includes a dir")
+
+ def test_dont_write_bytecode(self, caplog):
+ # makes sure byte_compile is not used
+ dist = self.create_dist()[1]
+ cmd = build_py(dist)
+ cmd.compile = True
+ cmd.optimize = 1
+
+ old_dont_write_bytecode = sys.dont_write_bytecode
+ sys.dont_write_bytecode = True
+ try:
+ cmd.byte_compile([])
+ finally:
+ sys.dont_write_bytecode = old_dont_write_bytecode
+
+ assert 'byte-compiling is disabled' in caplog.records[0].message
+
+ def test_namespace_package_does_not_warn(self, caplog):
+ """
+ Originally distutils implementation did not account for PEP 420
+ and included warns for package directories that did not contain
+ ``__init__.py`` files.
+ After the acceptance of PEP 420, these warnings don't make more sense
+ so we want to ensure there are not displayed to not confuse the users.
+ """
+ # Create a fake project structure with a package namespace:
+ tmp = self.mkdtemp()
+ jaraco.path.build({'ns': {'pkg': {'module.py': ''}}}, tmp)
+ os.chdir(tmp)
+
+ # Configure the package:
+ attrs = {
+ "name": "ns.pkg",
+ "packages": ["ns", "ns.pkg"],
+ "script_name": "setup.py",
+ }
+ dist = Distribution(attrs)
+
+ # Run code paths that would trigger the trap:
+ cmd = dist.get_command_obj("build_py")
+ cmd.finalize_options()
+ modules = cmd.find_all_modules()
+ assert len(modules) == 1
+ module_path = modules[0][-1]
+ assert module_path.replace(os.sep, "/") == "ns/pkg/module.py"
+
+ cmd.run()
+
+ assert not any(
+ "package init file" in msg and "not found" in msg for msg in caplog.messages
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_scripts.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_scripts.py
new file mode 100644
index 0000000000000000000000000000000000000000..3582f691ef578a419555c6ffbba6a619310517a6
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_build_scripts.py
@@ -0,0 +1,96 @@
+"""Tests for distutils.command.build_scripts."""
+
+import os
+import textwrap
+from distutils import sysconfig
+from distutils.command.build_scripts import build_scripts
+from distutils.core import Distribution
+from distutils.tests import support
+
+import jaraco.path
+
+
+class TestBuildScripts(support.TempdirManager):
+ def test_default_settings(self):
+ cmd = self.get_build_scripts_cmd("/foo/bar", [])
+ assert not cmd.force
+ assert cmd.build_dir is None
+
+ cmd.finalize_options()
+
+ assert cmd.force
+ assert cmd.build_dir == "/foo/bar"
+
+ def test_build(self):
+ source = self.mkdtemp()
+ target = self.mkdtemp()
+ expected = self.write_sample_scripts(source)
+
+ cmd = self.get_build_scripts_cmd(
+ target, [os.path.join(source, fn) for fn in expected]
+ )
+ cmd.finalize_options()
+ cmd.run()
+
+ built = os.listdir(target)
+ for name in expected:
+ assert name in built
+
+ def get_build_scripts_cmd(self, target, scripts):
+ import sys
+
+ dist = Distribution()
+ dist.scripts = scripts
+ dist.command_obj["build"] = support.DummyCommand(
+ build_scripts=target, force=True, executable=sys.executable
+ )
+ return build_scripts(dist)
+
+ @staticmethod
+ def write_sample_scripts(dir):
+ spec = {
+ 'script1.py': textwrap.dedent("""
+ #! /usr/bin/env python2.3
+ # bogus script w/ Python sh-bang
+ pass
+ """).lstrip(),
+ 'script2.py': textwrap.dedent("""
+ #!/usr/bin/python
+ # bogus script w/ Python sh-bang
+ pass
+ """).lstrip(),
+ 'shell.sh': textwrap.dedent("""
+ #!/bin/sh
+ # bogus shell script w/ sh-bang
+ exit 0
+ """).lstrip(),
+ }
+ jaraco.path.build(spec, dir)
+ return list(spec)
+
+ def test_version_int(self):
+ source = self.mkdtemp()
+ target = self.mkdtemp()
+ expected = self.write_sample_scripts(source)
+
+ cmd = self.get_build_scripts_cmd(
+ target, [os.path.join(source, fn) for fn in expected]
+ )
+ cmd.finalize_options()
+
+ # https://bugs.python.org/issue4524
+ #
+ # On linux-g++-32 with command line `./configure --enable-ipv6
+ # --with-suffix=3`, python is compiled okay but the build scripts
+ # failed when writing the name of the executable
+ old = sysconfig.get_config_vars().get('VERSION')
+ sysconfig._config_vars['VERSION'] = 4
+ try:
+ cmd.run()
+ finally:
+ if old is not None:
+ sysconfig._config_vars['VERSION'] = old
+
+ built = os.listdir(target)
+ for name in expected:
+ assert name in built
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_check.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_check.py
new file mode 100644
index 0000000000000000000000000000000000000000..b672b1f972b46f399eb5b2ef263da2548d52ef89
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_check.py
@@ -0,0 +1,194 @@
+"""Tests for distutils.command.check."""
+
+import os
+import textwrap
+from distutils.command.check import check
+from distutils.errors import DistutilsSetupError
+from distutils.tests import support
+
+import pytest
+
+try:
+ import pygments
+except ImportError:
+ pygments = None
+
+
+HERE = os.path.dirname(__file__)
+
+
+@support.combine_markers
+class TestCheck(support.TempdirManager):
+ def _run(self, metadata=None, cwd=None, **options):
+ if metadata is None:
+ metadata = {}
+ if cwd is not None:
+ old_dir = os.getcwd()
+ os.chdir(cwd)
+ pkg_info, dist = self.create_dist(**metadata)
+ cmd = check(dist)
+ cmd.initialize_options()
+ for name, value in options.items():
+ setattr(cmd, name, value)
+ cmd.ensure_finalized()
+ cmd.run()
+ if cwd is not None:
+ os.chdir(old_dir)
+ return cmd
+
+ def test_check_metadata(self):
+ # let's run the command with no metadata at all
+ # by default, check is checking the metadata
+ # should have some warnings
+ cmd = self._run()
+ assert cmd._warnings == 1
+
+ # now let's add the required fields
+ # and run it again, to make sure we don't get
+ # any warning anymore
+ metadata = {
+ 'url': 'xxx',
+ 'author': 'xxx',
+ 'author_email': 'xxx',
+ 'name': 'xxx',
+ 'version': 'xxx',
+ }
+ cmd = self._run(metadata)
+ assert cmd._warnings == 0
+
+ # now with the strict mode, we should
+ # get an error if there are missing metadata
+ with pytest.raises(DistutilsSetupError):
+ self._run({}, **{'strict': 1})
+
+ # and of course, no error when all metadata are present
+ cmd = self._run(metadata, strict=True)
+ assert cmd._warnings == 0
+
+ # now a test with non-ASCII characters
+ metadata = {
+ 'url': 'xxx',
+ 'author': '\u00c9ric',
+ 'author_email': 'xxx',
+ 'name': 'xxx',
+ 'version': 'xxx',
+ 'description': 'Something about esszet \u00df',
+ 'long_description': 'More things about esszet \u00df',
+ }
+ cmd = self._run(metadata)
+ assert cmd._warnings == 0
+
+ def test_check_author_maintainer(self):
+ for kind in ("author", "maintainer"):
+ # ensure no warning when author_email or maintainer_email is given
+ # (the spec allows these fields to take the form "Name ")
+ metadata = {
+ 'url': 'xxx',
+ kind + '_email': 'Name ',
+ 'name': 'xxx',
+ 'version': 'xxx',
+ }
+ cmd = self._run(metadata)
+ assert cmd._warnings == 0
+
+ # the check should not warn if only email is given
+ metadata[kind + '_email'] = 'name@email.com'
+ cmd = self._run(metadata)
+ assert cmd._warnings == 0
+
+ # the check should not warn if only the name is given
+ metadata[kind] = "Name"
+ del metadata[kind + '_email']
+ cmd = self._run(metadata)
+ assert cmd._warnings == 0
+
+ def test_check_document(self):
+ pytest.importorskip('docutils')
+ pkg_info, dist = self.create_dist()
+ cmd = check(dist)
+
+ # let's see if it detects broken rest
+ broken_rest = 'title\n===\n\ntest'
+ msgs = cmd._check_rst_data(broken_rest)
+ assert len(msgs) == 1
+
+ # and non-broken rest
+ rest = 'title\n=====\n\ntest'
+ msgs = cmd._check_rst_data(rest)
+ assert len(msgs) == 0
+
+ def test_check_restructuredtext(self):
+ pytest.importorskip('docutils')
+ # let's see if it detects broken rest in long_description
+ broken_rest = 'title\n===\n\ntest'
+ pkg_info, dist = self.create_dist(long_description=broken_rest)
+ cmd = check(dist)
+ cmd.check_restructuredtext()
+ assert cmd._warnings == 1
+
+ # let's see if we have an error with strict=True
+ metadata = {
+ 'url': 'xxx',
+ 'author': 'xxx',
+ 'author_email': 'xxx',
+ 'name': 'xxx',
+ 'version': 'xxx',
+ 'long_description': broken_rest,
+ }
+ with pytest.raises(DistutilsSetupError):
+ self._run(metadata, **{'strict': 1, 'restructuredtext': 1})
+
+ # and non-broken rest, including a non-ASCII character to test #12114
+ metadata['long_description'] = 'title\n=====\n\ntest \u00df'
+ cmd = self._run(metadata, strict=True, restructuredtext=True)
+ assert cmd._warnings == 0
+
+ # check that includes work to test #31292
+ metadata['long_description'] = 'title\n=====\n\n.. include:: includetest.rst'
+ cmd = self._run(metadata, cwd=HERE, strict=True, restructuredtext=True)
+ assert cmd._warnings == 0
+
+ def test_check_restructuredtext_with_syntax_highlight(self):
+ pytest.importorskip('docutils')
+ # Don't fail if there is a `code` or `code-block` directive
+
+ example_rst_docs = [
+ textwrap.dedent(
+ """\
+ Here's some code:
+
+ .. code:: python
+
+ def foo():
+ pass
+ """
+ ),
+ textwrap.dedent(
+ """\
+ Here's some code:
+
+ .. code-block:: python
+
+ def foo():
+ pass
+ """
+ ),
+ ]
+
+ for rest_with_code in example_rst_docs:
+ pkg_info, dist = self.create_dist(long_description=rest_with_code)
+ cmd = check(dist)
+ cmd.check_restructuredtext()
+ msgs = cmd._check_rst_data(rest_with_code)
+ if pygments is not None:
+ assert len(msgs) == 0
+ else:
+ assert len(msgs) == 1
+ assert (
+ str(msgs[0][1])
+ == 'Cannot analyze code. Pygments package not found.'
+ )
+
+ def test_check_all(self):
+ with pytest.raises(DistutilsSetupError):
+ self._run({}, **{'strict': 1, 'restructuredtext': 1})
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_clean.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_clean.py
new file mode 100644
index 0000000000000000000000000000000000000000..cc78f30f34b323845b977b9147c2153390774bd3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_clean.py
@@ -0,0 +1,45 @@
+"""Tests for distutils.command.clean."""
+
+import os
+from distutils.command.clean import clean
+from distutils.tests import support
+
+
+class TestClean(support.TempdirManager):
+ def test_simple_run(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = clean(dist)
+
+ # let's add some elements clean should remove
+ dirs = [
+ (d, os.path.join(pkg_dir, d))
+ for d in (
+ 'build_temp',
+ 'build_lib',
+ 'bdist_base',
+ 'build_scripts',
+ 'build_base',
+ )
+ ]
+
+ for name, path in dirs:
+ os.mkdir(path)
+ setattr(cmd, name, path)
+ if name == 'build_base':
+ continue
+ for f in ('one', 'two', 'three'):
+ self.write_file(os.path.join(path, f))
+
+ # let's run the command
+ cmd.all = 1
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # make sure the files where removed
+ for _name, path in dirs:
+ assert not os.path.exists(path), f'{path} was not removed'
+
+ # let's run the command again (should spit warnings but succeed)
+ cmd.all = 1
+ cmd.ensure_finalized()
+ cmd.run()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_cmd.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_cmd.py
new file mode 100644
index 0000000000000000000000000000000000000000..76e8f5989b3b102a32239436ff3b65f26e09e029
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_cmd.py
@@ -0,0 +1,107 @@
+"""Tests for distutils.cmd."""
+
+import os
+from distutils import debug
+from distutils.cmd import Command
+from distutils.dist import Distribution
+from distutils.errors import DistutilsOptionError
+
+import pytest
+
+
+class MyCmd(Command):
+ def initialize_options(self):
+ pass
+
+
+@pytest.fixture
+def cmd(request):
+ return MyCmd(Distribution())
+
+
+class TestCommand:
+ def test_ensure_string_list(self, cmd):
+ cmd.not_string_list = ['one', 2, 'three']
+ cmd.yes_string_list = ['one', 'two', 'three']
+ cmd.not_string_list2 = object()
+ cmd.yes_string_list2 = 'ok'
+ cmd.ensure_string_list('yes_string_list')
+ cmd.ensure_string_list('yes_string_list2')
+
+ with pytest.raises(DistutilsOptionError):
+ cmd.ensure_string_list('not_string_list')
+
+ with pytest.raises(DistutilsOptionError):
+ cmd.ensure_string_list('not_string_list2')
+
+ cmd.option1 = 'ok,dok'
+ cmd.ensure_string_list('option1')
+ assert cmd.option1 == ['ok', 'dok']
+
+ cmd.option2 = ['xxx', 'www']
+ cmd.ensure_string_list('option2')
+
+ cmd.option3 = ['ok', 2]
+ with pytest.raises(DistutilsOptionError):
+ cmd.ensure_string_list('option3')
+
+ def test_make_file(self, cmd):
+ # making sure it raises when infiles is not a string or a list/tuple
+ with pytest.raises(TypeError):
+ cmd.make_file(infiles=True, outfile='', func='func', args=())
+
+ # making sure execute gets called properly
+ def _execute(func, args, exec_msg, level):
+ assert exec_msg == 'generating out from in'
+
+ cmd.force = True
+ cmd.execute = _execute
+ cmd.make_file(infiles='in', outfile='out', func='func', args=())
+
+ def test_dump_options(self, cmd):
+ msgs = []
+
+ def _announce(msg, level):
+ msgs.append(msg)
+
+ cmd.announce = _announce
+ cmd.option1 = 1
+ cmd.option2 = 1
+ cmd.user_options = [('option1', '', ''), ('option2', '', '')]
+ cmd.dump_options()
+
+ wanted = ["command options for 'MyCmd':", ' option1 = 1', ' option2 = 1']
+ assert msgs == wanted
+
+ def test_ensure_string(self, cmd):
+ cmd.option1 = 'ok'
+ cmd.ensure_string('option1')
+
+ cmd.option2 = None
+ cmd.ensure_string('option2', 'xxx')
+ assert hasattr(cmd, 'option2')
+
+ cmd.option3 = 1
+ with pytest.raises(DistutilsOptionError):
+ cmd.ensure_string('option3')
+
+ def test_ensure_filename(self, cmd):
+ cmd.option1 = __file__
+ cmd.ensure_filename('option1')
+ cmd.option2 = 'xxx'
+ with pytest.raises(DistutilsOptionError):
+ cmd.ensure_filename('option2')
+
+ def test_ensure_dirname(self, cmd):
+ cmd.option1 = os.path.dirname(__file__) or os.curdir
+ cmd.ensure_dirname('option1')
+ cmd.option2 = 'xxx'
+ with pytest.raises(DistutilsOptionError):
+ cmd.ensure_dirname('option2')
+
+ def test_debug_print(self, cmd, capsys, monkeypatch):
+ cmd.debug_print('xxx')
+ assert capsys.readouterr().out == ''
+ monkeypatch.setattr(debug, 'DEBUG', True)
+ cmd.debug_print('xxx')
+ assert capsys.readouterr().out == 'xxx\n'
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_config_cmd.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_config_cmd.py
new file mode 100644
index 0000000000000000000000000000000000000000..ebee2ef93f0bc9d422984e2e4872665b1be3a1de
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_config_cmd.py
@@ -0,0 +1,87 @@
+"""Tests for distutils.command.config."""
+
+import os
+import sys
+from distutils._log import log
+from distutils.command.config import config, dump_file
+from distutils.tests import missing_compiler_executable, support
+
+import more_itertools
+import path
+import pytest
+
+
+@pytest.fixture(autouse=True)
+def info_log(request, monkeypatch):
+ self = request.instance
+ self._logs = []
+ monkeypatch.setattr(log, 'info', self._info)
+
+
+@support.combine_markers
+class TestConfig(support.TempdirManager):
+ def _info(self, msg, *args):
+ for line in msg.splitlines():
+ self._logs.append(line)
+
+ def test_dump_file(self):
+ this_file = path.Path(__file__).with_suffix('.py')
+ with this_file.open(encoding='utf-8') as f:
+ numlines = more_itertools.ilen(f)
+
+ dump_file(this_file, 'I am the header')
+ assert len(self._logs) == numlines + 1
+
+ @pytest.mark.skipif('platform.system() == "Windows"')
+ def test_search_cpp(self):
+ cmd = missing_compiler_executable(['preprocessor'])
+ if cmd is not None:
+ self.skipTest(f'The {cmd!r} command is not found')
+ pkg_dir, dist = self.create_dist()
+ cmd = config(dist)
+ cmd._check_compiler()
+ compiler = cmd.compiler
+ if sys.platform[:3] == "aix" and "xlc" in compiler.preprocessor[0].lower():
+ self.skipTest(
+ 'xlc: The -E option overrides the -P, -o, and -qsyntaxonly options'
+ )
+
+ # simple pattern searches
+ match = cmd.search_cpp(pattern='xxx', body='/* xxx */')
+ assert match == 0
+
+ match = cmd.search_cpp(pattern='_configtest', body='/* xxx */')
+ assert match == 1
+
+ def test_finalize_options(self):
+ # finalize_options does a bit of transformation
+ # on options
+ pkg_dir, dist = self.create_dist()
+ cmd = config(dist)
+ cmd.include_dirs = f'one{os.pathsep}two'
+ cmd.libraries = 'one'
+ cmd.library_dirs = f'three{os.pathsep}four'
+ cmd.ensure_finalized()
+
+ assert cmd.include_dirs == ['one', 'two']
+ assert cmd.libraries == ['one']
+ assert cmd.library_dirs == ['three', 'four']
+
+ def test_clean(self):
+ # _clean removes files
+ tmp_dir = self.mkdtemp()
+ f1 = os.path.join(tmp_dir, 'one')
+ f2 = os.path.join(tmp_dir, 'two')
+
+ self.write_file(f1, 'xxx')
+ self.write_file(f2, 'xxx')
+
+ for f in (f1, f2):
+ assert os.path.exists(f)
+
+ pkg_dir, dist = self.create_dist()
+ cmd = config(dist)
+ cmd._clean(f1, f2)
+
+ for f in (f1, f2):
+ assert not os.path.exists(f)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_core.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_core.py
new file mode 100644
index 0000000000000000000000000000000000000000..bad3fb7e8318d3ee73ecabe20ed98c279f606a77
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_core.py
@@ -0,0 +1,130 @@
+"""Tests for distutils.core."""
+
+import distutils.core
+import io
+import os
+import sys
+from distutils.dist import Distribution
+
+import pytest
+
+# setup script that uses __file__
+setup_using___file__ = """\
+
+__file__
+
+from distutils.core import setup
+setup()
+"""
+
+setup_prints_cwd = """\
+
+import os
+print(os.getcwd())
+
+from distutils.core import setup
+setup()
+"""
+
+setup_does_nothing = """\
+from distutils.core import setup
+setup()
+"""
+
+
+setup_defines_subclass = """\
+from distutils.core import setup
+from distutils.command.install import install as _install
+
+class install(_install):
+ sub_commands = _install.sub_commands + ['cmd']
+
+setup(cmdclass={'install': install})
+"""
+
+setup_within_if_main = """\
+from distutils.core import setup
+
+def main():
+ return setup(name="setup_within_if_main")
+
+if __name__ == "__main__":
+ main()
+"""
+
+
+@pytest.fixture(autouse=True)
+def save_stdout(monkeypatch):
+ monkeypatch.setattr(sys, 'stdout', sys.stdout)
+
+
+@pytest.fixture
+def temp_file(tmp_path):
+ return tmp_path / 'file'
+
+
+@pytest.mark.usefixtures('save_env')
+@pytest.mark.usefixtures('save_argv')
+class TestCore:
+ def test_run_setup_provides_file(self, temp_file):
+ # Make sure the script can use __file__; if that's missing, the test
+ # setup.py script will raise NameError.
+ temp_file.write_text(setup_using___file__, encoding='utf-8')
+ distutils.core.run_setup(temp_file)
+
+ def test_run_setup_preserves_sys_argv(self, temp_file):
+ # Make sure run_setup does not clobber sys.argv
+ argv_copy = sys.argv.copy()
+ temp_file.write_text(setup_does_nothing, encoding='utf-8')
+ distutils.core.run_setup(temp_file)
+ assert sys.argv == argv_copy
+
+ def test_run_setup_defines_subclass(self, temp_file):
+ # Make sure the script can use __file__; if that's missing, the test
+ # setup.py script will raise NameError.
+ temp_file.write_text(setup_defines_subclass, encoding='utf-8')
+ dist = distutils.core.run_setup(temp_file)
+ install = dist.get_command_obj('install')
+ assert 'cmd' in install.sub_commands
+
+ def test_run_setup_uses_current_dir(self, tmp_path):
+ """
+ Test that the setup script is run with the current directory
+ as its own current directory.
+ """
+ sys.stdout = io.StringIO()
+ cwd = os.getcwd()
+
+ # Create a directory and write the setup.py file there:
+ setup_py = tmp_path / 'setup.py'
+ setup_py.write_text(setup_prints_cwd, encoding='utf-8')
+ distutils.core.run_setup(setup_py)
+
+ output = sys.stdout.getvalue()
+ if output.endswith("\n"):
+ output = output[:-1]
+ assert cwd == output
+
+ def test_run_setup_within_if_main(self, temp_file):
+ temp_file.write_text(setup_within_if_main, encoding='utf-8')
+ dist = distutils.core.run_setup(temp_file, stop_after="config")
+ assert isinstance(dist, Distribution)
+ assert dist.get_name() == "setup_within_if_main"
+
+ def test_run_commands(self, temp_file):
+ sys.argv = ['setup.py', 'build']
+ temp_file.write_text(setup_within_if_main, encoding='utf-8')
+ dist = distutils.core.run_setup(temp_file, stop_after="commandline")
+ assert 'build' not in dist.have_run
+ distutils.core.run_commands(dist)
+ assert 'build' in dist.have_run
+
+ def test_debug_mode(self, capsys, monkeypatch):
+ # this covers the code called when DEBUG is set
+ sys.argv = ['setup.py', '--name']
+ distutils.core.setup(name='bar')
+ assert capsys.readouterr().out == 'bar\n'
+ monkeypatch.setattr(distutils.core, 'DEBUG', True)
+ distutils.core.setup(name='bar')
+ wanted = "options (after parsing config files):\n"
+ assert capsys.readouterr().out.startswith(wanted)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_dir_util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_dir_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..326cb346145ec7e3a1dd0384c33d4125131feaae
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_dir_util.py
@@ -0,0 +1,139 @@
+"""Tests for distutils.dir_util."""
+
+import os
+import pathlib
+import stat
+import sys
+import unittest.mock as mock
+from distutils import dir_util, errors
+from distutils.dir_util import (
+ copy_tree,
+ create_tree,
+ ensure_relative,
+ mkpath,
+ remove_tree,
+)
+from distutils.tests import support
+
+import jaraco.path
+import path
+import pytest
+
+
+@pytest.fixture(autouse=True)
+def stuff(request, monkeypatch, distutils_managed_tempdir):
+ self = request.instance
+ tmp_dir = self.mkdtemp()
+ self.root_target = os.path.join(tmp_dir, 'deep')
+ self.target = os.path.join(self.root_target, 'here')
+ self.target2 = os.path.join(tmp_dir, 'deep2')
+
+
+class TestDirUtil(support.TempdirManager):
+ def test_mkpath_remove_tree_verbosity(self, caplog):
+ mkpath(self.target, verbose=False)
+ assert not caplog.records
+ remove_tree(self.root_target, verbose=False)
+
+ mkpath(self.target, verbose=True)
+ wanted = [f'creating {self.target}']
+ assert caplog.messages == wanted
+ caplog.clear()
+
+ remove_tree(self.root_target, verbose=True)
+ wanted = [f"removing '{self.root_target}' (and everything under it)"]
+ assert caplog.messages == wanted
+
+ @pytest.mark.skipif("platform.system() == 'Windows'")
+ def test_mkpath_with_custom_mode(self):
+ # Get and set the current umask value for testing mode bits.
+ umask = os.umask(0o002)
+ os.umask(umask)
+ mkpath(self.target, 0o700)
+ assert stat.S_IMODE(os.stat(self.target).st_mode) == 0o700 & ~umask
+ mkpath(self.target2, 0o555)
+ assert stat.S_IMODE(os.stat(self.target2).st_mode) == 0o555 & ~umask
+
+ def test_create_tree_verbosity(self, caplog):
+ create_tree(self.root_target, ['one', 'two', 'three'], verbose=False)
+ assert caplog.messages == []
+ remove_tree(self.root_target, verbose=False)
+
+ wanted = [f'creating {self.root_target}']
+ create_tree(self.root_target, ['one', 'two', 'three'], verbose=True)
+ assert caplog.messages == wanted
+
+ remove_tree(self.root_target, verbose=False)
+
+ def test_copy_tree_verbosity(self, caplog):
+ mkpath(self.target, verbose=False)
+
+ copy_tree(self.target, self.target2, verbose=False)
+ assert caplog.messages == []
+
+ remove_tree(self.root_target, verbose=False)
+
+ mkpath(self.target, verbose=False)
+ a_file = path.Path(self.target) / 'ok.txt'
+ jaraco.path.build({'ok.txt': 'some content'}, self.target)
+
+ wanted = [f'copying {a_file} -> {self.target2}']
+ copy_tree(self.target, self.target2, verbose=True)
+ assert caplog.messages == wanted
+
+ remove_tree(self.root_target, verbose=False)
+ remove_tree(self.target2, verbose=False)
+
+ def test_copy_tree_skips_nfs_temp_files(self):
+ mkpath(self.target, verbose=False)
+
+ jaraco.path.build({'ok.txt': 'some content', '.nfs123abc': ''}, self.target)
+
+ copy_tree(self.target, self.target2)
+ assert os.listdir(self.target2) == ['ok.txt']
+
+ remove_tree(self.root_target, verbose=False)
+ remove_tree(self.target2, verbose=False)
+
+ def test_ensure_relative(self):
+ if os.sep == '/':
+ assert ensure_relative('/home/foo') == 'home/foo'
+ assert ensure_relative('some/path') == 'some/path'
+ else: # \\
+ assert ensure_relative('c:\\home\\foo') == 'c:home\\foo'
+ assert ensure_relative('home\\foo') == 'home\\foo'
+
+ def test_copy_tree_exception_in_listdir(self):
+ """
+ An exception in listdir should raise a DistutilsFileError
+ """
+ with (
+ mock.patch("os.listdir", side_effect=OSError()),
+ pytest.raises(errors.DistutilsFileError),
+ ):
+ src = self.tempdirs[-1]
+ dir_util.copy_tree(src, None)
+
+ def test_mkpath_exception_uncached(self, monkeypatch, tmp_path):
+ """
+ Caching should not remember failed attempts.
+
+ pypa/distutils#304
+ """
+
+ class FailPath(pathlib.Path):
+ def mkdir(self, *args, **kwargs):
+ raise OSError("Failed to create directory")
+
+ if sys.version_info < (3, 12):
+ _flavour = pathlib.Path()._flavour
+
+ target = tmp_path / 'foodir'
+
+ with pytest.raises(errors.DistutilsFileError):
+ mkpath(FailPath(target))
+
+ assert not target.exists()
+
+ mkpath(target)
+ assert target.exists()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_dist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_dist.py
new file mode 100644
index 0000000000000000000000000000000000000000..2c5beebe64eb9d747088cf117082a546330b29f3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_dist.py
@@ -0,0 +1,552 @@
+"""Tests for distutils.dist."""
+
+import email
+import email.generator
+import email.policy
+import functools
+import io
+import os
+import sys
+import textwrap
+import unittest.mock as mock
+import warnings
+from distutils.cmd import Command
+from distutils.dist import Distribution, fix_help_options
+from distutils.tests import support
+from typing import ClassVar
+
+import jaraco.path
+import pytest
+
+pydistutils_cfg = '.' * (os.name == 'posix') + 'pydistutils.cfg'
+
+
+class test_dist(Command):
+ """Sample distutils extension command."""
+
+ user_options: ClassVar[list[tuple[str, str, str]]] = [
+ ("sample-option=", "S", "help text"),
+ ]
+
+ def initialize_options(self):
+ self.sample_option = None
+
+
+class TestDistribution(Distribution):
+ """Distribution subclasses that avoids the default search for
+ configuration files.
+
+ The ._config_files attribute must be set before
+ .parse_config_files() is called.
+ """
+
+ def find_config_files(self):
+ return self._config_files
+
+
+@pytest.fixture
+def clear_argv():
+ del sys.argv[1:]
+
+
+@support.combine_markers
+@pytest.mark.usefixtures('save_env')
+@pytest.mark.usefixtures('save_argv')
+class TestDistributionBehavior(support.TempdirManager):
+ def create_distribution(self, configfiles=()):
+ d = TestDistribution()
+ d._config_files = configfiles
+ d.parse_config_files()
+ d.parse_command_line()
+ return d
+
+ def test_command_packages_unspecified(self, clear_argv):
+ sys.argv.append("build")
+ d = self.create_distribution()
+ assert d.get_command_packages() == ["distutils.command"]
+
+ def test_command_packages_cmdline(self, clear_argv):
+ from distutils.tests.test_dist import test_dist
+
+ sys.argv.extend([
+ "--command-packages",
+ "foo.bar,distutils.tests",
+ "test_dist",
+ "-Ssometext",
+ ])
+ d = self.create_distribution()
+ # let's actually try to load our test command:
+ assert d.get_command_packages() == [
+ "distutils.command",
+ "foo.bar",
+ "distutils.tests",
+ ]
+ cmd = d.get_command_obj("test_dist")
+ assert isinstance(cmd, test_dist)
+ assert cmd.sample_option == "sometext"
+
+ @pytest.mark.skipif(
+ 'distutils' not in Distribution.parse_config_files.__module__,
+ reason='Cannot test when virtualenv has monkey-patched Distribution',
+ )
+ def test_venv_install_options(self, tmp_path, clear_argv):
+ sys.argv.append("install")
+ file = str(tmp_path / 'file')
+
+ fakepath = '/somedir'
+
+ jaraco.path.build({
+ file: f"""
+ [install]
+ install-base = {fakepath}
+ install-platbase = {fakepath}
+ install-lib = {fakepath}
+ install-platlib = {fakepath}
+ install-purelib = {fakepath}
+ install-headers = {fakepath}
+ install-scripts = {fakepath}
+ install-data = {fakepath}
+ prefix = {fakepath}
+ exec-prefix = {fakepath}
+ home = {fakepath}
+ user = {fakepath}
+ root = {fakepath}
+ """,
+ })
+
+ # Base case: Not in a Virtual Environment
+ with mock.patch.multiple(sys, prefix='/a', base_prefix='/a'):
+ d = self.create_distribution([file])
+
+ option_tuple = (file, fakepath)
+
+ result_dict = {
+ 'install_base': option_tuple,
+ 'install_platbase': option_tuple,
+ 'install_lib': option_tuple,
+ 'install_platlib': option_tuple,
+ 'install_purelib': option_tuple,
+ 'install_headers': option_tuple,
+ 'install_scripts': option_tuple,
+ 'install_data': option_tuple,
+ 'prefix': option_tuple,
+ 'exec_prefix': option_tuple,
+ 'home': option_tuple,
+ 'user': option_tuple,
+ 'root': option_tuple,
+ }
+
+ assert sorted(d.command_options.get('install').keys()) == sorted(
+ result_dict.keys()
+ )
+
+ for key, value in d.command_options.get('install').items():
+ assert value == result_dict[key]
+
+ # Test case: In a Virtual Environment
+ with mock.patch.multiple(sys, prefix='/a', base_prefix='/b'):
+ d = self.create_distribution([file])
+
+ for key in result_dict.keys():
+ assert key not in d.command_options.get('install', {})
+
+ def test_command_packages_configfile(self, tmp_path, clear_argv):
+ sys.argv.append("build")
+ file = str(tmp_path / "file")
+ jaraco.path.build({
+ file: """
+ [global]
+ command_packages = foo.bar, splat
+ """,
+ })
+
+ d = self.create_distribution([file])
+ assert d.get_command_packages() == ["distutils.command", "foo.bar", "splat"]
+
+ # ensure command line overrides config:
+ sys.argv[1:] = ["--command-packages", "spork", "build"]
+ d = self.create_distribution([file])
+ assert d.get_command_packages() == ["distutils.command", "spork"]
+
+ # Setting --command-packages to '' should cause the default to
+ # be used even if a config file specified something else:
+ sys.argv[1:] = ["--command-packages", "", "build"]
+ d = self.create_distribution([file])
+ assert d.get_command_packages() == ["distutils.command"]
+
+ def test_empty_options(self, request):
+ # an empty options dictionary should not stay in the
+ # list of attributes
+
+ # catching warnings
+ warns = []
+
+ def _warn(msg):
+ warns.append(msg)
+
+ request.addfinalizer(
+ functools.partial(setattr, warnings, 'warn', warnings.warn)
+ )
+ warnings.warn = _warn
+ dist = Distribution(
+ attrs={
+ 'author': 'xxx',
+ 'name': 'xxx',
+ 'version': 'xxx',
+ 'url': 'xxxx',
+ 'options': {},
+ }
+ )
+
+ assert len(warns) == 0
+ assert 'options' not in dir(dist)
+
+ def test_finalize_options(self):
+ attrs = {'keywords': 'one,two', 'platforms': 'one,two'}
+
+ dist = Distribution(attrs=attrs)
+ dist.finalize_options()
+
+ # finalize_option splits platforms and keywords
+ assert dist.metadata.platforms == ['one', 'two']
+ assert dist.metadata.keywords == ['one', 'two']
+
+ attrs = {'keywords': 'foo bar', 'platforms': 'foo bar'}
+ dist = Distribution(attrs=attrs)
+ dist.finalize_options()
+ assert dist.metadata.platforms == ['foo bar']
+ assert dist.metadata.keywords == ['foo bar']
+
+ def test_get_command_packages(self):
+ dist = Distribution()
+ assert dist.command_packages is None
+ cmds = dist.get_command_packages()
+ assert cmds == ['distutils.command']
+ assert dist.command_packages == ['distutils.command']
+
+ dist.command_packages = 'one,two'
+ cmds = dist.get_command_packages()
+ assert cmds == ['distutils.command', 'one', 'two']
+
+ def test_announce(self):
+ # make sure the level is known
+ dist = Distribution()
+ with pytest.raises(TypeError):
+ dist.announce('ok', level='ok2')
+
+ def test_find_config_files_disable(self, temp_home):
+ # Ticket #1180: Allow user to disable their home config file.
+ jaraco.path.build({pydistutils_cfg: '[distutils]\n'}, temp_home)
+
+ d = Distribution()
+ all_files = d.find_config_files()
+
+ d = Distribution(attrs={'script_args': ['--no-user-cfg']})
+ files = d.find_config_files()
+
+ # make sure --no-user-cfg disables the user cfg file
+ assert len(all_files) - 1 == len(files)
+
+ def test_script_args_list_coercion(self):
+ d = Distribution(attrs={'script_args': ('build', '--no-user-cfg')})
+
+ # make sure script_args is a list even if it started as a different iterable
+ assert d.script_args == ['build', '--no-user-cfg']
+
+ @pytest.mark.skipif(
+ 'platform.system() == "Windows"',
+ reason='Windows does not honor chmod 000',
+ )
+ def test_find_config_files_permission_error(self, fake_home):
+ """
+ Finding config files should not fail when directory is inaccessible.
+ """
+ fake_home.joinpath(pydistutils_cfg).write_text('', encoding='utf-8')
+ fake_home.chmod(0o000)
+ Distribution().find_config_files()
+
+
+@pytest.mark.usefixtures('save_env')
+@pytest.mark.usefixtures('save_argv')
+class TestMetadata(support.TempdirManager):
+ def format_metadata(self, dist):
+ sio = io.StringIO()
+ dist.metadata.write_pkg_file(sio)
+ return sio.getvalue()
+
+ def test_simple_metadata(self):
+ attrs = {"name": "package", "version": "1.0"}
+ dist = Distribution(attrs)
+ meta = self.format_metadata(dist)
+ assert "Metadata-Version: 1.0" in meta
+ assert "provides:" not in meta.lower()
+ assert "requires:" not in meta.lower()
+ assert "obsoletes:" not in meta.lower()
+
+ def test_provides(self):
+ attrs = {
+ "name": "package",
+ "version": "1.0",
+ "provides": ["package", "package.sub"],
+ }
+ dist = Distribution(attrs)
+ assert dist.metadata.get_provides() == ["package", "package.sub"]
+ assert dist.get_provides() == ["package", "package.sub"]
+ meta = self.format_metadata(dist)
+ assert "Metadata-Version: 1.1" in meta
+ assert "requires:" not in meta.lower()
+ assert "obsoletes:" not in meta.lower()
+
+ def test_provides_illegal(self):
+ with pytest.raises(ValueError):
+ Distribution(
+ {"name": "package", "version": "1.0", "provides": ["my.pkg (splat)"]},
+ )
+
+ def test_requires(self):
+ attrs = {
+ "name": "package",
+ "version": "1.0",
+ "requires": ["other", "another (==1.0)"],
+ }
+ dist = Distribution(attrs)
+ assert dist.metadata.get_requires() == ["other", "another (==1.0)"]
+ assert dist.get_requires() == ["other", "another (==1.0)"]
+ meta = self.format_metadata(dist)
+ assert "Metadata-Version: 1.1" in meta
+ assert "provides:" not in meta.lower()
+ assert "Requires: other" in meta
+ assert "Requires: another (==1.0)" in meta
+ assert "obsoletes:" not in meta.lower()
+
+ def test_requires_illegal(self):
+ with pytest.raises(ValueError):
+ Distribution(
+ {"name": "package", "version": "1.0", "requires": ["my.pkg (splat)"]},
+ )
+
+ def test_requires_to_list(self):
+ attrs = {"name": "package", "requires": iter(["other"])}
+ dist = Distribution(attrs)
+ assert isinstance(dist.metadata.requires, list)
+
+ def test_obsoletes(self):
+ attrs = {
+ "name": "package",
+ "version": "1.0",
+ "obsoletes": ["other", "another (<1.0)"],
+ }
+ dist = Distribution(attrs)
+ assert dist.metadata.get_obsoletes() == ["other", "another (<1.0)"]
+ assert dist.get_obsoletes() == ["other", "another (<1.0)"]
+ meta = self.format_metadata(dist)
+ assert "Metadata-Version: 1.1" in meta
+ assert "provides:" not in meta.lower()
+ assert "requires:" not in meta.lower()
+ assert "Obsoletes: other" in meta
+ assert "Obsoletes: another (<1.0)" in meta
+
+ def test_obsoletes_illegal(self):
+ with pytest.raises(ValueError):
+ Distribution(
+ {"name": "package", "version": "1.0", "obsoletes": ["my.pkg (splat)"]},
+ )
+
+ def test_obsoletes_to_list(self):
+ attrs = {"name": "package", "obsoletes": iter(["other"])}
+ dist = Distribution(attrs)
+ assert isinstance(dist.metadata.obsoletes, list)
+
+ def test_classifier(self):
+ attrs = {
+ 'name': 'Boa',
+ 'version': '3.0',
+ 'classifiers': ['Programming Language :: Python :: 3'],
+ }
+ dist = Distribution(attrs)
+ assert dist.get_classifiers() == ['Programming Language :: Python :: 3']
+ meta = self.format_metadata(dist)
+ assert 'Metadata-Version: 1.1' in meta
+
+ def test_classifier_invalid_type(self, caplog):
+ attrs = {
+ 'name': 'Boa',
+ 'version': '3.0',
+ 'classifiers': ('Programming Language :: Python :: 3',),
+ }
+ d = Distribution(attrs)
+ # should have warning about passing a non-list
+ assert 'should be a list' in caplog.messages[0]
+ # should be converted to a list
+ assert isinstance(d.metadata.classifiers, list)
+ assert d.metadata.classifiers == list(attrs['classifiers'])
+
+ def test_keywords(self):
+ attrs = {
+ 'name': 'Monty',
+ 'version': '1.0',
+ 'keywords': ['spam', 'eggs', 'life of brian'],
+ }
+ dist = Distribution(attrs)
+ assert dist.get_keywords() == ['spam', 'eggs', 'life of brian']
+
+ def test_keywords_invalid_type(self, caplog):
+ attrs = {
+ 'name': 'Monty',
+ 'version': '1.0',
+ 'keywords': ('spam', 'eggs', 'life of brian'),
+ }
+ d = Distribution(attrs)
+ # should have warning about passing a non-list
+ assert 'should be a list' in caplog.messages[0]
+ # should be converted to a list
+ assert isinstance(d.metadata.keywords, list)
+ assert d.metadata.keywords == list(attrs['keywords'])
+
+ def test_platforms(self):
+ attrs = {
+ 'name': 'Monty',
+ 'version': '1.0',
+ 'platforms': ['GNU/Linux', 'Some Evil Platform'],
+ }
+ dist = Distribution(attrs)
+ assert dist.get_platforms() == ['GNU/Linux', 'Some Evil Platform']
+
+ def test_platforms_invalid_types(self, caplog):
+ attrs = {
+ 'name': 'Monty',
+ 'version': '1.0',
+ 'platforms': ('GNU/Linux', 'Some Evil Platform'),
+ }
+ d = Distribution(attrs)
+ # should have warning about passing a non-list
+ assert 'should be a list' in caplog.messages[0]
+ # should be converted to a list
+ assert isinstance(d.metadata.platforms, list)
+ assert d.metadata.platforms == list(attrs['platforms'])
+
+ def test_download_url(self):
+ attrs = {
+ 'name': 'Boa',
+ 'version': '3.0',
+ 'download_url': 'http://example.org/boa',
+ }
+ dist = Distribution(attrs)
+ meta = self.format_metadata(dist)
+ assert 'Metadata-Version: 1.1' in meta
+
+ def test_long_description(self):
+ long_desc = textwrap.dedent(
+ """\
+ example::
+ We start here
+ and continue here
+ and end here."""
+ )
+ attrs = {"name": "package", "version": "1.0", "long_description": long_desc}
+
+ dist = Distribution(attrs)
+ meta = self.format_metadata(dist)
+ meta = meta.replace('\n' + 8 * ' ', '\n')
+ assert long_desc in meta
+
+ def test_custom_pydistutils(self, temp_home):
+ """
+ pydistutils.cfg is found
+ """
+ jaraco.path.build({pydistutils_cfg: ''}, temp_home)
+ config_path = temp_home / pydistutils_cfg
+
+ assert str(config_path) in Distribution().find_config_files()
+
+ def test_extra_pydistutils(self, monkeypatch, tmp_path):
+ jaraco.path.build({'overrides.cfg': ''}, tmp_path)
+ filename = tmp_path / 'overrides.cfg'
+ monkeypatch.setenv('DIST_EXTRA_CONFIG', str(filename))
+ assert str(filename) in Distribution().find_config_files()
+
+ def test_fix_help_options(self):
+ help_tuples = [('a', 'b', 'c', 'd'), (1, 2, 3, 4)]
+ fancy_options = fix_help_options(help_tuples)
+ assert fancy_options[0] == ('a', 'b', 'c')
+ assert fancy_options[1] == (1, 2, 3)
+
+ def test_show_help(self, request, capsys):
+ # smoke test, just makes sure some help is displayed
+ dist = Distribution()
+ sys.argv = []
+ dist.help = True
+ dist.script_name = 'setup.py'
+ dist.parse_command_line()
+
+ output = [
+ line for line in capsys.readouterr().out.split('\n') if line.strip() != ''
+ ]
+ assert output
+
+ def test_read_metadata(self):
+ attrs = {
+ "name": "package",
+ "version": "1.0",
+ "long_description": "desc",
+ "description": "xxx",
+ "download_url": "http://example.com",
+ "keywords": ['one', 'two'],
+ "requires": ['foo'],
+ }
+
+ dist = Distribution(attrs)
+ metadata = dist.metadata
+
+ # write it then reloads it
+ PKG_INFO = io.StringIO()
+ metadata.write_pkg_file(PKG_INFO)
+ PKG_INFO.seek(0)
+ metadata.read_pkg_file(PKG_INFO)
+
+ assert metadata.name == "package"
+ assert metadata.version == "1.0"
+ assert metadata.description == "xxx"
+ assert metadata.download_url == 'http://example.com'
+ assert metadata.keywords == ['one', 'two']
+ assert metadata.platforms is None
+ assert metadata.obsoletes is None
+ assert metadata.requires == ['foo']
+
+ def test_round_trip_through_email_generator(self):
+ """
+ In pypa/setuptools#4033, it was shown that once PKG-INFO is
+ re-generated using ``email.generator.Generator``, some control
+ characters might cause problems.
+ """
+ # Given a PKG-INFO file ...
+ attrs = {
+ "name": "package",
+ "version": "1.0",
+ "long_description": "hello\x0b\nworld\n",
+ }
+ dist = Distribution(attrs)
+ metadata = dist.metadata
+
+ with io.StringIO() as buffer:
+ metadata.write_pkg_file(buffer)
+ msg = buffer.getvalue()
+
+ # ... when it is read and re-written using stdlib's email library,
+ orig = email.message_from_string(msg)
+ policy = email.policy.EmailPolicy(
+ utf8=True,
+ mangle_from_=False,
+ max_line_length=0,
+ )
+ with io.StringIO() as buffer:
+ email.generator.Generator(buffer, policy=policy).flatten(orig)
+
+ buffer.seek(0)
+ regen = email.message_from_file(buffer)
+
+ # ... then it should be the same as the original
+ # (except for the specific line break characters)
+ orig_desc = set(orig["Description"].splitlines())
+ regen_desc = set(regen["Description"].splitlines())
+ assert regen_desc == orig_desc
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_extension.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_extension.py
new file mode 100644
index 0000000000000000000000000000000000000000..5e8e768223ea40d7a629111db181a946cf8ca5b0
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_extension.py
@@ -0,0 +1,117 @@
+"""Tests for distutils.extension."""
+
+import os
+import pathlib
+import warnings
+from distutils.extension import Extension, read_setup_file
+
+import pytest
+from test.support.warnings_helper import check_warnings
+
+
+class TestExtension:
+ def test_read_setup_file(self):
+ # trying to read a Setup file
+ # (sample extracted from the PyGame project)
+ setup = os.path.join(os.path.dirname(__file__), 'Setup.sample')
+
+ exts = read_setup_file(setup)
+ names = [ext.name for ext in exts]
+ names.sort()
+
+ # here are the extensions read_setup_file should have created
+ # out of the file
+ wanted = [
+ '_arraysurfarray',
+ '_camera',
+ '_numericsndarray',
+ '_numericsurfarray',
+ 'base',
+ 'bufferproxy',
+ 'cdrom',
+ 'color',
+ 'constants',
+ 'display',
+ 'draw',
+ 'event',
+ 'fastevent',
+ 'font',
+ 'gfxdraw',
+ 'image',
+ 'imageext',
+ 'joystick',
+ 'key',
+ 'mask',
+ 'mixer',
+ 'mixer_music',
+ 'mouse',
+ 'movie',
+ 'overlay',
+ 'pixelarray',
+ 'pypm',
+ 'rect',
+ 'rwobject',
+ 'scrap',
+ 'surface',
+ 'surflock',
+ 'time',
+ 'transform',
+ ]
+
+ assert names == wanted
+
+ def test_extension_init(self):
+ # the first argument, which is the name, must be a string
+ with pytest.raises(TypeError):
+ Extension(1, [])
+ ext = Extension('name', [])
+ assert ext.name == 'name'
+
+ # the second argument, which is the list of files, must
+ # be an iterable of strings or PathLike objects, and not a string
+ with pytest.raises(TypeError):
+ Extension('name', 'file')
+ with pytest.raises(TypeError):
+ Extension('name', ['file', 1])
+ ext = Extension('name', ['file1', 'file2'])
+ assert ext.sources == ['file1', 'file2']
+ ext = Extension('name', [pathlib.Path('file1'), pathlib.Path('file2')])
+ assert ext.sources == ['file1', 'file2']
+
+ # any non-string iterable of strings or PathLike objects should work
+ ext = Extension('name', ('file1', 'file2')) # tuple
+ assert ext.sources == ['file1', 'file2']
+ ext = Extension('name', {'file1', 'file2'}) # set
+ assert sorted(ext.sources) == ['file1', 'file2']
+ ext = Extension('name', iter(['file1', 'file2'])) # iterator
+ assert ext.sources == ['file1', 'file2']
+ ext = Extension('name', [pathlib.Path('file1'), 'file2']) # mixed types
+ assert ext.sources == ['file1', 'file2']
+
+ # others arguments have defaults
+ for attr in (
+ 'include_dirs',
+ 'define_macros',
+ 'undef_macros',
+ 'library_dirs',
+ 'libraries',
+ 'runtime_library_dirs',
+ 'extra_objects',
+ 'extra_compile_args',
+ 'extra_link_args',
+ 'export_symbols',
+ 'swig_opts',
+ 'depends',
+ ):
+ assert getattr(ext, attr) == []
+
+ assert ext.language is None
+ assert ext.optional is None
+
+ # if there are unknown keyword options, warn about them
+ with check_warnings() as w:
+ warnings.simplefilter('always')
+ ext = Extension('name', ['file1', 'file2'], chic=True)
+
+ assert len(w.warnings) == 1
+ assert str(w.warnings[0].message) == "Unknown Extension options: 'chic'"
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_file_util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_file_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..a75d4a0317dc717c24f67127370aa87089eeba1a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_file_util.py
@@ -0,0 +1,95 @@
+"""Tests for distutils.file_util."""
+
+import errno
+import os
+import unittest.mock as mock
+from distutils.errors import DistutilsFileError
+from distutils.file_util import copy_file, move_file
+
+import jaraco.path
+import pytest
+
+
+@pytest.fixture(autouse=True)
+def stuff(request, tmp_path):
+ self = request.instance
+ self.source = tmp_path / 'f1'
+ self.target = tmp_path / 'f2'
+ self.target_dir = tmp_path / 'd1'
+
+
+class TestFileUtil:
+ def test_move_file_verbosity(self, caplog):
+ jaraco.path.build({self.source: 'some content'})
+
+ move_file(self.source, self.target, verbose=False)
+ assert not caplog.messages
+
+ # back to original state
+ move_file(self.target, self.source, verbose=False)
+
+ move_file(self.source, self.target, verbose=True)
+ wanted = [f'moving {self.source} -> {self.target}']
+ assert caplog.messages == wanted
+
+ # back to original state
+ move_file(self.target, self.source, verbose=False)
+
+ caplog.clear()
+ # now the target is a dir
+ os.mkdir(self.target_dir)
+ move_file(self.source, self.target_dir, verbose=True)
+ wanted = [f'moving {self.source} -> {self.target_dir}']
+ assert caplog.messages == wanted
+
+ def test_move_file_exception_unpacking_rename(self):
+ # see issue 22182
+ with (
+ mock.patch("os.rename", side_effect=OSError("wrong", 1)),
+ pytest.raises(DistutilsFileError),
+ ):
+ jaraco.path.build({self.source: 'spam eggs'})
+ move_file(self.source, self.target, verbose=False)
+
+ def test_move_file_exception_unpacking_unlink(self):
+ # see issue 22182
+ with (
+ mock.patch("os.rename", side_effect=OSError(errno.EXDEV, "wrong")),
+ mock.patch("os.unlink", side_effect=OSError("wrong", 1)),
+ pytest.raises(DistutilsFileError),
+ ):
+ jaraco.path.build({self.source: 'spam eggs'})
+ move_file(self.source, self.target, verbose=False)
+
+ def test_copy_file_hard_link(self):
+ jaraco.path.build({self.source: 'some content'})
+ # Check first that copy_file() will not fall back on copying the file
+ # instead of creating the hard link.
+ try:
+ os.link(self.source, self.target)
+ except OSError as e:
+ self.skipTest(f'os.link: {e}')
+ else:
+ self.target.unlink()
+ st = os.stat(self.source)
+ copy_file(self.source, self.target, link='hard')
+ st2 = os.stat(self.source)
+ st3 = os.stat(self.target)
+ assert os.path.samestat(st, st2), (st, st2)
+ assert os.path.samestat(st2, st3), (st2, st3)
+ assert self.source.read_text(encoding='utf-8') == 'some content'
+
+ def test_copy_file_hard_link_failure(self):
+ # If hard linking fails, copy_file() falls back on copying file
+ # (some special filesystems don't support hard linking even under
+ # Unix, see issue #8876).
+ jaraco.path.build({self.source: 'some content'})
+ st = os.stat(self.source)
+ with mock.patch("os.link", side_effect=OSError(0, "linking unsupported")):
+ copy_file(self.source, self.target, link='hard')
+ st2 = os.stat(self.source)
+ st3 = os.stat(self.target)
+ assert os.path.samestat(st, st2), (st, st2)
+ assert not os.path.samestat(st2, st3), (st2, st3)
+ for fn in (self.source, self.target):
+ assert fn.read_text(encoding='utf-8') == 'some content'
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_filelist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_filelist.py
new file mode 100644
index 0000000000000000000000000000000000000000..130e6fb53b0bd9670bdcfe6d4bc7fcf8fd90416e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_filelist.py
@@ -0,0 +1,336 @@
+"""Tests for distutils.filelist."""
+
+import logging
+import os
+import re
+from distutils import debug, filelist
+from distutils.errors import DistutilsTemplateError
+from distutils.filelist import FileList, glob_to_re, translate_pattern
+
+import jaraco.path
+import pytest
+
+from .compat import py39 as os_helper
+
+MANIFEST_IN = """\
+include ok
+include xo
+exclude xo
+include foo.tmp
+include buildout.cfg
+global-include *.x
+global-include *.txt
+global-exclude *.tmp
+recursive-include f *.oo
+recursive-exclude global *.x
+graft dir
+prune dir3
+"""
+
+
+def make_local_path(s):
+ """Converts '/' in a string to os.sep"""
+ return s.replace('/', os.sep)
+
+
+class TestFileList:
+ def assertNoWarnings(self, caplog):
+ warnings = [rec for rec in caplog.records if rec.levelno == logging.WARNING]
+ assert not warnings
+ caplog.clear()
+
+ def assertWarnings(self, caplog):
+ warnings = [rec for rec in caplog.records if rec.levelno == logging.WARNING]
+ assert warnings
+ caplog.clear()
+
+ def test_glob_to_re(self):
+ sep = os.sep
+ if os.sep == '\\':
+ sep = re.escape(os.sep)
+
+ for glob, regex in (
+ # simple cases
+ ('foo*', r'(?s:foo[^%(sep)s]*)\Z'),
+ ('foo?', r'(?s:foo[^%(sep)s])\Z'),
+ ('foo??', r'(?s:foo[^%(sep)s][^%(sep)s])\Z'),
+ # special cases
+ (r'foo\\*', r'(?s:foo\\\\[^%(sep)s]*)\Z'),
+ (r'foo\\\*', r'(?s:foo\\\\\\[^%(sep)s]*)\Z'),
+ ('foo????', r'(?s:foo[^%(sep)s][^%(sep)s][^%(sep)s][^%(sep)s])\Z'),
+ (r'foo\\??', r'(?s:foo\\\\[^%(sep)s][^%(sep)s])\Z'),
+ ):
+ regex = regex % {'sep': sep}
+ assert glob_to_re(glob) == regex
+
+ def test_process_template_line(self):
+ # testing all MANIFEST.in template patterns
+ file_list = FileList()
+ mlp = make_local_path
+
+ # simulated file list
+ file_list.allfiles = [
+ 'foo.tmp',
+ 'ok',
+ 'xo',
+ 'four.txt',
+ 'buildout.cfg',
+ # filelist does not filter out VCS directories,
+ # it's sdist that does
+ mlp('.hg/last-message.txt'),
+ mlp('global/one.txt'),
+ mlp('global/two.txt'),
+ mlp('global/files.x'),
+ mlp('global/here.tmp'),
+ mlp('f/o/f.oo'),
+ mlp('dir/graft-one'),
+ mlp('dir/dir2/graft2'),
+ mlp('dir3/ok'),
+ mlp('dir3/sub/ok.txt'),
+ ]
+
+ for line in MANIFEST_IN.split('\n'):
+ if line.strip() == '':
+ continue
+ file_list.process_template_line(line)
+
+ wanted = [
+ 'ok',
+ 'buildout.cfg',
+ 'four.txt',
+ mlp('.hg/last-message.txt'),
+ mlp('global/one.txt'),
+ mlp('global/two.txt'),
+ mlp('f/o/f.oo'),
+ mlp('dir/graft-one'),
+ mlp('dir/dir2/graft2'),
+ ]
+
+ assert file_list.files == wanted
+
+ def test_debug_print(self, capsys, monkeypatch):
+ file_list = FileList()
+ file_list.debug_print('xxx')
+ assert capsys.readouterr().out == ''
+
+ monkeypatch.setattr(debug, 'DEBUG', True)
+ file_list.debug_print('xxx')
+ assert capsys.readouterr().out == 'xxx\n'
+
+ def test_set_allfiles(self):
+ file_list = FileList()
+ files = ['a', 'b', 'c']
+ file_list.set_allfiles(files)
+ assert file_list.allfiles == files
+
+ def test_remove_duplicates(self):
+ file_list = FileList()
+ file_list.files = ['a', 'b', 'a', 'g', 'c', 'g']
+ # files must be sorted beforehand (sdist does it)
+ file_list.sort()
+ file_list.remove_duplicates()
+ assert file_list.files == ['a', 'b', 'c', 'g']
+
+ def test_translate_pattern(self):
+ # not regex
+ assert hasattr(translate_pattern('a', anchor=True, is_regex=False), 'search')
+
+ # is a regex
+ regex = re.compile('a')
+ assert translate_pattern(regex, anchor=True, is_regex=True) == regex
+
+ # plain string flagged as regex
+ assert hasattr(translate_pattern('a', anchor=True, is_regex=True), 'search')
+
+ # glob support
+ assert translate_pattern('*.py', anchor=True, is_regex=False).search(
+ 'filelist.py'
+ )
+
+ def test_exclude_pattern(self):
+ # return False if no match
+ file_list = FileList()
+ assert not file_list.exclude_pattern('*.py')
+
+ # return True if files match
+ file_list = FileList()
+ file_list.files = ['a.py', 'b.py']
+ assert file_list.exclude_pattern('*.py')
+
+ # test excludes
+ file_list = FileList()
+ file_list.files = ['a.py', 'a.txt']
+ file_list.exclude_pattern('*.py')
+ assert file_list.files == ['a.txt']
+
+ def test_include_pattern(self):
+ # return False if no match
+ file_list = FileList()
+ file_list.set_allfiles([])
+ assert not file_list.include_pattern('*.py')
+
+ # return True if files match
+ file_list = FileList()
+ file_list.set_allfiles(['a.py', 'b.txt'])
+ assert file_list.include_pattern('*.py')
+
+ # test * matches all files
+ file_list = FileList()
+ assert file_list.allfiles is None
+ file_list.set_allfiles(['a.py', 'b.txt'])
+ file_list.include_pattern('*')
+ assert file_list.allfiles == ['a.py', 'b.txt']
+
+ def test_process_template(self, caplog):
+ mlp = make_local_path
+ # invalid lines
+ file_list = FileList()
+ for action in (
+ 'include',
+ 'exclude',
+ 'global-include',
+ 'global-exclude',
+ 'recursive-include',
+ 'recursive-exclude',
+ 'graft',
+ 'prune',
+ 'blarg',
+ ):
+ with pytest.raises(DistutilsTemplateError):
+ file_list.process_template_line(action)
+
+ # include
+ file_list = FileList()
+ file_list.set_allfiles(['a.py', 'b.txt', mlp('d/c.py')])
+
+ file_list.process_template_line('include *.py')
+ assert file_list.files == ['a.py']
+ self.assertNoWarnings(caplog)
+
+ file_list.process_template_line('include *.rb')
+ assert file_list.files == ['a.py']
+ self.assertWarnings(caplog)
+
+ # exclude
+ file_list = FileList()
+ file_list.files = ['a.py', 'b.txt', mlp('d/c.py')]
+
+ file_list.process_template_line('exclude *.py')
+ assert file_list.files == ['b.txt', mlp('d/c.py')]
+ self.assertNoWarnings(caplog)
+
+ file_list.process_template_line('exclude *.rb')
+ assert file_list.files == ['b.txt', mlp('d/c.py')]
+ self.assertWarnings(caplog)
+
+ # global-include
+ file_list = FileList()
+ file_list.set_allfiles(['a.py', 'b.txt', mlp('d/c.py')])
+
+ file_list.process_template_line('global-include *.py')
+ assert file_list.files == ['a.py', mlp('d/c.py')]
+ self.assertNoWarnings(caplog)
+
+ file_list.process_template_line('global-include *.rb')
+ assert file_list.files == ['a.py', mlp('d/c.py')]
+ self.assertWarnings(caplog)
+
+ # global-exclude
+ file_list = FileList()
+ file_list.files = ['a.py', 'b.txt', mlp('d/c.py')]
+
+ file_list.process_template_line('global-exclude *.py')
+ assert file_list.files == ['b.txt']
+ self.assertNoWarnings(caplog)
+
+ file_list.process_template_line('global-exclude *.rb')
+ assert file_list.files == ['b.txt']
+ self.assertWarnings(caplog)
+
+ # recursive-include
+ file_list = FileList()
+ file_list.set_allfiles(['a.py', mlp('d/b.py'), mlp('d/c.txt'), mlp('d/d/e.py')])
+
+ file_list.process_template_line('recursive-include d *.py')
+ assert file_list.files == [mlp('d/b.py'), mlp('d/d/e.py')]
+ self.assertNoWarnings(caplog)
+
+ file_list.process_template_line('recursive-include e *.py')
+ assert file_list.files == [mlp('d/b.py'), mlp('d/d/e.py')]
+ self.assertWarnings(caplog)
+
+ # recursive-exclude
+ file_list = FileList()
+ file_list.files = ['a.py', mlp('d/b.py'), mlp('d/c.txt'), mlp('d/d/e.py')]
+
+ file_list.process_template_line('recursive-exclude d *.py')
+ assert file_list.files == ['a.py', mlp('d/c.txt')]
+ self.assertNoWarnings(caplog)
+
+ file_list.process_template_line('recursive-exclude e *.py')
+ assert file_list.files == ['a.py', mlp('d/c.txt')]
+ self.assertWarnings(caplog)
+
+ # graft
+ file_list = FileList()
+ file_list.set_allfiles(['a.py', mlp('d/b.py'), mlp('d/d/e.py'), mlp('f/f.py')])
+
+ file_list.process_template_line('graft d')
+ assert file_list.files == [mlp('d/b.py'), mlp('d/d/e.py')]
+ self.assertNoWarnings(caplog)
+
+ file_list.process_template_line('graft e')
+ assert file_list.files == [mlp('d/b.py'), mlp('d/d/e.py')]
+ self.assertWarnings(caplog)
+
+ # prune
+ file_list = FileList()
+ file_list.files = ['a.py', mlp('d/b.py'), mlp('d/d/e.py'), mlp('f/f.py')]
+
+ file_list.process_template_line('prune d')
+ assert file_list.files == ['a.py', mlp('f/f.py')]
+ self.assertNoWarnings(caplog)
+
+ file_list.process_template_line('prune e')
+ assert file_list.files == ['a.py', mlp('f/f.py')]
+ self.assertWarnings(caplog)
+
+
+class TestFindAll:
+ @os_helper.skip_unless_symlink
+ def test_missing_symlink(self, temp_cwd):
+ os.symlink('foo', 'bar')
+ assert filelist.findall() == []
+
+ def test_basic_discovery(self, temp_cwd):
+ """
+ When findall is called with no parameters or with
+ '.' as the parameter, the dot should be omitted from
+ the results.
+ """
+ jaraco.path.build({'foo': {'file1.txt': ''}, 'bar': {'file2.txt': ''}})
+ file1 = os.path.join('foo', 'file1.txt')
+ file2 = os.path.join('bar', 'file2.txt')
+ expected = [file2, file1]
+ assert sorted(filelist.findall()) == expected
+
+ def test_non_local_discovery(self, tmp_path):
+ """
+ When findall is called with another path, the full
+ path name should be returned.
+ """
+ jaraco.path.build({'file1.txt': ''}, tmp_path)
+ expected = [str(tmp_path / 'file1.txt')]
+ assert filelist.findall(tmp_path) == expected
+
+ @os_helper.skip_unless_symlink
+ def test_symlink_loop(self, tmp_path):
+ jaraco.path.build(
+ {
+ 'link-to-parent': jaraco.path.Symlink('.'),
+ 'somefile': '',
+ },
+ tmp_path,
+ )
+ files = filelist.findall(tmp_path)
+ assert len(files) == 1
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install.py
new file mode 100644
index 0000000000000000000000000000000000000000..b3ffb2e668ac5a042c5a2889d7b51b5755b73157
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install.py
@@ -0,0 +1,245 @@
+"""Tests for distutils.command.install."""
+
+import logging
+import os
+import pathlib
+import site
+import sys
+from distutils import sysconfig
+from distutils.command import install as install_module
+from distutils.command.build_ext import build_ext
+from distutils.command.install import INSTALL_SCHEMES, install
+from distutils.core import Distribution
+from distutils.errors import DistutilsOptionError
+from distutils.extension import Extension
+from distutils.tests import missing_compiler_executable, support
+from distutils.util import is_mingw
+
+import pytest
+
+
+def _make_ext_name(modname):
+ return modname + sysconfig.get_config_var('EXT_SUFFIX')
+
+
+@support.combine_markers
+@pytest.mark.usefixtures('save_env')
+class TestInstall(
+ support.TempdirManager,
+):
+ @pytest.mark.xfail(
+ 'platform.system() == "Windows" and sys.version_info > (3, 11)',
+ reason="pypa/distutils#148",
+ )
+ def test_home_installation_scheme(self):
+ # This ensure two things:
+ # - that --home generates the desired set of directory names
+ # - test --home is supported on all platforms
+ builddir = self.mkdtemp()
+ destination = os.path.join(builddir, "installation")
+
+ dist = Distribution({"name": "foopkg"})
+ # script_name need not exist, it just need to be initialized
+ dist.script_name = os.path.join(builddir, "setup.py")
+ dist.command_obj["build"] = support.DummyCommand(
+ build_base=builddir,
+ build_lib=os.path.join(builddir, "lib"),
+ )
+
+ cmd = install(dist)
+ cmd.home = destination
+ cmd.ensure_finalized()
+
+ assert cmd.install_base == destination
+ assert cmd.install_platbase == destination
+
+ def check_path(got, expected):
+ got = os.path.normpath(got)
+ expected = os.path.normpath(expected)
+ assert got == expected
+
+ impl_name = sys.implementation.name.replace("cpython", "python")
+ libdir = os.path.join(destination, "lib", impl_name)
+ check_path(cmd.install_lib, libdir)
+ _platlibdir = getattr(sys, "platlibdir", "lib")
+ platlibdir = os.path.join(destination, _platlibdir, impl_name)
+ check_path(cmd.install_platlib, platlibdir)
+ check_path(cmd.install_purelib, libdir)
+ check_path(
+ cmd.install_headers,
+ os.path.join(destination, "include", impl_name, "foopkg"),
+ )
+ check_path(cmd.install_scripts, os.path.join(destination, "bin"))
+ check_path(cmd.install_data, destination)
+
+ def test_user_site(self, monkeypatch):
+ # test install with --user
+ # preparing the environment for the test
+ self.tmpdir = self.mkdtemp()
+ orig_site = site.USER_SITE
+ orig_base = site.USER_BASE
+ monkeypatch.setattr(site, 'USER_BASE', os.path.join(self.tmpdir, 'B'))
+ monkeypatch.setattr(site, 'USER_SITE', os.path.join(self.tmpdir, 'S'))
+ monkeypatch.setattr(install_module, 'USER_BASE', site.USER_BASE)
+ monkeypatch.setattr(install_module, 'USER_SITE', site.USER_SITE)
+
+ def _expanduser(path):
+ if path.startswith('~'):
+ return os.path.normpath(self.tmpdir + path[1:])
+ return path
+
+ monkeypatch.setattr(os.path, 'expanduser', _expanduser)
+
+ for key in ('nt_user', 'posix_user'):
+ assert key in INSTALL_SCHEMES
+
+ dist = Distribution({'name': 'xx'})
+ cmd = install(dist)
+
+ # making sure the user option is there
+ options = [name for name, short, label in cmd.user_options]
+ assert 'user' in options
+
+ # setting a value
+ cmd.user = True
+
+ # user base and site shouldn't be created yet
+ assert not os.path.exists(site.USER_BASE)
+ assert not os.path.exists(site.USER_SITE)
+
+ # let's run finalize
+ cmd.ensure_finalized()
+
+ # now they should
+ assert os.path.exists(site.USER_BASE)
+ assert os.path.exists(site.USER_SITE)
+
+ assert 'userbase' in cmd.config_vars
+ assert 'usersite' in cmd.config_vars
+
+ actual_headers = os.path.relpath(cmd.install_headers, site.USER_BASE)
+ if os.name == 'nt' and not is_mingw():
+ site_path = os.path.relpath(os.path.dirname(orig_site), orig_base)
+ include = os.path.join(site_path, 'Include')
+ else:
+ include = sysconfig.get_python_inc(0, '')
+ expect_headers = os.path.join(include, 'xx')
+
+ assert os.path.normcase(actual_headers) == os.path.normcase(expect_headers)
+
+ def test_handle_extra_path(self):
+ dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'})
+ cmd = install(dist)
+
+ # two elements
+ cmd.handle_extra_path()
+ assert cmd.extra_path == ['path', 'dirs']
+ assert cmd.extra_dirs == 'dirs'
+ assert cmd.path_file == 'path'
+
+ # one element
+ cmd.extra_path = ['path']
+ cmd.handle_extra_path()
+ assert cmd.extra_path == ['path']
+ assert cmd.extra_dirs == 'path'
+ assert cmd.path_file == 'path'
+
+ # none
+ dist.extra_path = cmd.extra_path = None
+ cmd.handle_extra_path()
+ assert cmd.extra_path is None
+ assert cmd.extra_dirs == ''
+ assert cmd.path_file is None
+
+ # three elements (no way !)
+ cmd.extra_path = 'path,dirs,again'
+ with pytest.raises(DistutilsOptionError):
+ cmd.handle_extra_path()
+
+ def test_finalize_options(self):
+ dist = Distribution({'name': 'xx'})
+ cmd = install(dist)
+
+ # must supply either prefix/exec-prefix/home or
+ # install-base/install-platbase -- not both
+ cmd.prefix = 'prefix'
+ cmd.install_base = 'base'
+ with pytest.raises(DistutilsOptionError):
+ cmd.finalize_options()
+
+ # must supply either home or prefix/exec-prefix -- not both
+ cmd.install_base = None
+ cmd.home = 'home'
+ with pytest.raises(DistutilsOptionError):
+ cmd.finalize_options()
+
+ # can't combine user with prefix/exec_prefix/home or
+ # install_(plat)base
+ cmd.prefix = None
+ cmd.user = 'user'
+ with pytest.raises(DistutilsOptionError):
+ cmd.finalize_options()
+
+ def test_record(self):
+ install_dir = self.mkdtemp()
+ project_dir, dist = self.create_dist(py_modules=['hello'], scripts=['sayhi'])
+ os.chdir(project_dir)
+ self.write_file('hello.py', "def main(): print('o hai')")
+ self.write_file('sayhi', 'from hello import main; main()')
+
+ cmd = install(dist)
+ dist.command_obj['install'] = cmd
+ cmd.root = install_dir
+ cmd.record = os.path.join(project_dir, 'filelist')
+ cmd.ensure_finalized()
+ cmd.run()
+
+ content = pathlib.Path(cmd.record).read_text(encoding='utf-8')
+
+ found = [pathlib.Path(line).name for line in content.splitlines()]
+ expected = [
+ 'hello.py',
+ f'hello.{sys.implementation.cache_tag}.pyc',
+ 'sayhi',
+ 'UNKNOWN-0.0.0-py{}.{}.egg-info'.format(*sys.version_info[:2]),
+ ]
+ assert found == expected
+
+ def test_record_extensions(self):
+ cmd = missing_compiler_executable()
+ if cmd is not None:
+ pytest.skip(f'The {cmd!r} command is not found')
+ install_dir = self.mkdtemp()
+ project_dir, dist = self.create_dist(
+ ext_modules=[Extension('xx', ['xxmodule.c'])]
+ )
+ os.chdir(project_dir)
+ support.copy_xxmodule_c(project_dir)
+
+ buildextcmd = build_ext(dist)
+ support.fixup_build_ext(buildextcmd)
+ buildextcmd.ensure_finalized()
+
+ cmd = install(dist)
+ dist.command_obj['install'] = cmd
+ dist.command_obj['build_ext'] = buildextcmd
+ cmd.root = install_dir
+ cmd.record = os.path.join(project_dir, 'filelist')
+ cmd.ensure_finalized()
+ cmd.run()
+
+ content = pathlib.Path(cmd.record).read_text(encoding='utf-8')
+
+ found = [pathlib.Path(line).name for line in content.splitlines()]
+ expected = [
+ _make_ext_name('xx'),
+ 'UNKNOWN-0.0.0-py{}.{}.egg-info'.format(*sys.version_info[:2]),
+ ]
+ assert found == expected
+
+ def test_debug_mode(self, caplog, monkeypatch):
+ # this covers the code called when DEBUG is set
+ monkeypatch.setattr(install_module, 'DEBUG', True)
+ caplog.set_level(logging.DEBUG)
+ self.test_record()
+ assert any(rec for rec in caplog.records if rec.levelno == logging.DEBUG)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_data.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_data.py
new file mode 100644
index 0000000000000000000000000000000000000000..c800f86c645d86fcb11aa3bef1513325ef163132
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_data.py
@@ -0,0 +1,74 @@
+"""Tests for distutils.command.install_data."""
+
+import os
+import pathlib
+from distutils.command.install_data import install_data
+from distutils.tests import support
+
+import pytest
+
+
+@pytest.mark.usefixtures('save_env')
+class TestInstallData(
+ support.TempdirManager,
+):
+ def test_simple_run(self):
+ pkg_dir, dist = self.create_dist()
+ cmd = install_data(dist)
+ cmd.install_dir = inst = os.path.join(pkg_dir, 'inst')
+
+ # data_files can contain
+ # - simple files
+ # - a Path object
+ # - a tuple with a path, and a list of file
+ one = os.path.join(pkg_dir, 'one')
+ self.write_file(one, 'xxx')
+ inst2 = os.path.join(pkg_dir, 'inst2')
+ two = os.path.join(pkg_dir, 'two')
+ self.write_file(two, 'xxx')
+ three = pathlib.Path(pkg_dir) / 'three'
+ self.write_file(three, 'xxx')
+
+ cmd.data_files = [one, (inst2, [two]), three]
+ assert cmd.get_inputs() == [one, (inst2, [two]), three]
+
+ # let's run the command
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # let's check the result
+ assert len(cmd.get_outputs()) == 3
+ rthree = os.path.split(one)[-1]
+ assert os.path.exists(os.path.join(inst, rthree))
+ rtwo = os.path.split(two)[-1]
+ assert os.path.exists(os.path.join(inst2, rtwo))
+ rone = os.path.split(one)[-1]
+ assert os.path.exists(os.path.join(inst, rone))
+ cmd.outfiles = []
+
+ # let's try with warn_dir one
+ cmd.warn_dir = True
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # let's check the result
+ assert len(cmd.get_outputs()) == 3
+ assert os.path.exists(os.path.join(inst, rthree))
+ assert os.path.exists(os.path.join(inst2, rtwo))
+ assert os.path.exists(os.path.join(inst, rone))
+ cmd.outfiles = []
+
+ # now using root and empty dir
+ cmd.root = os.path.join(pkg_dir, 'root')
+ inst5 = os.path.join(pkg_dir, 'inst5')
+ four = os.path.join(cmd.install_dir, 'four')
+ self.write_file(four, 'xx')
+ cmd.data_files = [one, (inst2, [two]), three, ('inst5', [four]), (inst5, [])]
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # let's check the result
+ assert len(cmd.get_outputs()) == 5
+ assert os.path.exists(os.path.join(inst, rthree))
+ assert os.path.exists(os.path.join(inst2, rtwo))
+ assert os.path.exists(os.path.join(inst, rone))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_headers.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_headers.py
new file mode 100644
index 0000000000000000000000000000000000000000..2c74f06b976f3c3ea977667a5c16c0e7f201a558
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_headers.py
@@ -0,0 +1,33 @@
+"""Tests for distutils.command.install_headers."""
+
+import os
+from distutils.command.install_headers import install_headers
+from distutils.tests import support
+
+import pytest
+
+
+@pytest.mark.usefixtures('save_env')
+class TestInstallHeaders(
+ support.TempdirManager,
+):
+ def test_simple_run(self):
+ # we have two headers
+ header_list = self.mkdtemp()
+ header1 = os.path.join(header_list, 'header1')
+ header2 = os.path.join(header_list, 'header2')
+ self.write_file(header1)
+ self.write_file(header2)
+ headers = [header1, header2]
+
+ pkg_dir, dist = self.create_dist(headers=headers)
+ cmd = install_headers(dist)
+ assert cmd.get_inputs() == headers
+
+ # let's run the command
+ cmd.install_dir = os.path.join(pkg_dir, 'inst')
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # let's check the results
+ assert len(cmd.get_outputs()) == 2
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_lib.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_lib.py
new file mode 100644
index 0000000000000000000000000000000000000000..f685a579560ea70bceea221de0e54485975ce180
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_lib.py
@@ -0,0 +1,110 @@
+"""Tests for distutils.command.install_data."""
+
+import importlib.util
+import os
+import sys
+from distutils.command.install_lib import install_lib
+from distutils.errors import DistutilsOptionError
+from distutils.extension import Extension
+from distutils.tests import support
+
+import pytest
+
+
+@support.combine_markers
+@pytest.mark.usefixtures('save_env')
+class TestInstallLib(
+ support.TempdirManager,
+):
+ def test_finalize_options(self):
+ dist = self.create_dist()[1]
+ cmd = install_lib(dist)
+
+ cmd.finalize_options()
+ assert cmd.compile == 1
+ assert cmd.optimize == 0
+
+ # optimize must be 0, 1, or 2
+ cmd.optimize = 'foo'
+ with pytest.raises(DistutilsOptionError):
+ cmd.finalize_options()
+ cmd.optimize = '4'
+ with pytest.raises(DistutilsOptionError):
+ cmd.finalize_options()
+
+ cmd.optimize = '2'
+ cmd.finalize_options()
+ assert cmd.optimize == 2
+
+ @pytest.mark.skipif('sys.dont_write_bytecode')
+ def test_byte_compile(self):
+ project_dir, dist = self.create_dist()
+ os.chdir(project_dir)
+ cmd = install_lib(dist)
+ cmd.compile = cmd.optimize = 1
+
+ f = os.path.join(project_dir, 'foo.py')
+ self.write_file(f, '# python file')
+ cmd.byte_compile([f])
+ pyc_file = importlib.util.cache_from_source('foo.py', optimization='')
+ pyc_opt_file = importlib.util.cache_from_source(
+ 'foo.py', optimization=cmd.optimize
+ )
+ assert os.path.exists(pyc_file)
+ assert os.path.exists(pyc_opt_file)
+
+ def test_get_outputs(self):
+ project_dir, dist = self.create_dist()
+ os.chdir(project_dir)
+ os.mkdir('spam')
+ cmd = install_lib(dist)
+
+ # setting up a dist environment
+ cmd.compile = cmd.optimize = 1
+ cmd.install_dir = self.mkdtemp()
+ f = os.path.join(project_dir, 'spam', '__init__.py')
+ self.write_file(f, '# python package')
+ cmd.distribution.ext_modules = [Extension('foo', ['xxx'])]
+ cmd.distribution.packages = ['spam']
+ cmd.distribution.script_name = 'setup.py'
+
+ # get_outputs should return 4 elements: spam/__init__.py and .pyc,
+ # foo.import-tag-abiflags.so / foo.pyd
+ outputs = cmd.get_outputs()
+ assert len(outputs) == 4, outputs
+
+ def test_get_inputs(self):
+ project_dir, dist = self.create_dist()
+ os.chdir(project_dir)
+ os.mkdir('spam')
+ cmd = install_lib(dist)
+
+ # setting up a dist environment
+ cmd.compile = cmd.optimize = 1
+ cmd.install_dir = self.mkdtemp()
+ f = os.path.join(project_dir, 'spam', '__init__.py')
+ self.write_file(f, '# python package')
+ cmd.distribution.ext_modules = [Extension('foo', ['xxx'])]
+ cmd.distribution.packages = ['spam']
+ cmd.distribution.script_name = 'setup.py'
+
+ # get_inputs should return 2 elements: spam/__init__.py and
+ # foo.import-tag-abiflags.so / foo.pyd
+ inputs = cmd.get_inputs()
+ assert len(inputs) == 2, inputs
+
+ def test_dont_write_bytecode(self, caplog):
+ # makes sure byte_compile is not used
+ dist = self.create_dist()[1]
+ cmd = install_lib(dist)
+ cmd.compile = True
+ cmd.optimize = 1
+
+ old_dont_write_bytecode = sys.dont_write_bytecode
+ sys.dont_write_bytecode = True
+ try:
+ cmd.byte_compile([])
+ finally:
+ sys.dont_write_bytecode = old_dont_write_bytecode
+
+ assert 'byte-compiling is disabled' in caplog.messages[0]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_scripts.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_scripts.py
new file mode 100644
index 0000000000000000000000000000000000000000..868b1c22521f23a5dd398e4636c94330d4c238ac
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_install_scripts.py
@@ -0,0 +1,52 @@
+"""Tests for distutils.command.install_scripts."""
+
+import os
+from distutils.command.install_scripts import install_scripts
+from distutils.core import Distribution
+from distutils.tests import support
+
+from . import test_build_scripts
+
+
+class TestInstallScripts(support.TempdirManager):
+ def test_default_settings(self):
+ dist = Distribution()
+ dist.command_obj["build"] = support.DummyCommand(build_scripts="/foo/bar")
+ dist.command_obj["install"] = support.DummyCommand(
+ install_scripts="/splat/funk",
+ force=True,
+ skip_build=True,
+ )
+ cmd = install_scripts(dist)
+ assert not cmd.force
+ assert not cmd.skip_build
+ assert cmd.build_dir is None
+ assert cmd.install_dir is None
+
+ cmd.finalize_options()
+
+ assert cmd.force
+ assert cmd.skip_build
+ assert cmd.build_dir == "/foo/bar"
+ assert cmd.install_dir == "/splat/funk"
+
+ def test_installation(self):
+ source = self.mkdtemp()
+
+ expected = test_build_scripts.TestBuildScripts.write_sample_scripts(source)
+
+ target = self.mkdtemp()
+ dist = Distribution()
+ dist.command_obj["build"] = support.DummyCommand(build_scripts=source)
+ dist.command_obj["install"] = support.DummyCommand(
+ install_scripts=target,
+ force=True,
+ skip_build=True,
+ )
+ cmd = install_scripts(dist)
+ cmd.finalize_options()
+ cmd.run()
+
+ installed = os.listdir(target)
+ for name in expected:
+ assert name in installed
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_log.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_log.py
new file mode 100644
index 0000000000000000000000000000000000000000..d67779fc9fa0f58a010929d5a456890c6dde3376
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_log.py
@@ -0,0 +1,12 @@
+"""Tests for distutils.log"""
+
+import logging
+from distutils._log import log
+
+
+class TestLog:
+ def test_non_ascii(self, caplog):
+ caplog.set_level(logging.DEBUG)
+ log.debug('Dεbug\tMėssãge')
+ log.fatal('Fαtal\tÈrrōr')
+ assert caplog.messages == ['Dεbug\tMėssãge', 'Fαtal\tÈrrōr']
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_modified.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_modified.py
new file mode 100644
index 0000000000000000000000000000000000000000..e35cec2d6f1a8d27619e33c253f0a83f0f72a75d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_modified.py
@@ -0,0 +1,126 @@
+"""Tests for distutils._modified."""
+
+import os
+import types
+from distutils._modified import newer, newer_group, newer_pairwise, newer_pairwise_group
+from distutils.errors import DistutilsFileError
+from distutils.tests import support
+
+import pytest
+
+
+class TestDepUtil(support.TempdirManager):
+ def test_newer(self):
+ tmpdir = self.mkdtemp()
+ new_file = os.path.join(tmpdir, 'new')
+ old_file = os.path.abspath(__file__)
+
+ # Raise DistutilsFileError if 'new_file' does not exist.
+ with pytest.raises(DistutilsFileError):
+ newer(new_file, old_file)
+
+ # Return true if 'new_file' exists and is more recently modified than
+ # 'old_file', or if 'new_file' exists and 'old_file' doesn't.
+ self.write_file(new_file)
+ assert newer(new_file, 'I_dont_exist')
+ assert newer(new_file, old_file)
+
+ # Return false if both exist and 'old_file' is the same age or younger
+ # than 'new_file'.
+ assert not newer(old_file, new_file)
+
+ def _setup_1234(self):
+ tmpdir = self.mkdtemp()
+ sources = os.path.join(tmpdir, 'sources')
+ targets = os.path.join(tmpdir, 'targets')
+ os.mkdir(sources)
+ os.mkdir(targets)
+ one = os.path.join(sources, 'one')
+ two = os.path.join(sources, 'two')
+ three = os.path.abspath(__file__) # I am the old file
+ four = os.path.join(targets, 'four')
+ self.write_file(one)
+ self.write_file(two)
+ self.write_file(four)
+ return one, two, three, four
+
+ def test_newer_pairwise(self):
+ one, two, three, four = self._setup_1234()
+
+ assert newer_pairwise([one, two], [three, four]) == ([one], [three])
+
+ def test_newer_pairwise_mismatch(self):
+ one, two, three, four = self._setup_1234()
+
+ with pytest.raises(ValueError):
+ newer_pairwise([one], [three, four])
+
+ with pytest.raises(ValueError):
+ newer_pairwise([one, two], [three])
+
+ def test_newer_pairwise_empty(self):
+ assert newer_pairwise([], []) == ([], [])
+
+ def test_newer_pairwise_fresh(self):
+ one, two, three, four = self._setup_1234()
+
+ assert newer_pairwise([one, three], [two, four]) == ([], [])
+
+ def test_newer_group(self):
+ tmpdir = self.mkdtemp()
+ sources = os.path.join(tmpdir, 'sources')
+ os.mkdir(sources)
+ one = os.path.join(sources, 'one')
+ two = os.path.join(sources, 'two')
+ three = os.path.join(sources, 'three')
+ old_file = os.path.abspath(__file__)
+
+ # return true if 'old_file' is out-of-date with respect to any file
+ # listed in 'sources'.
+ self.write_file(one)
+ self.write_file(two)
+ self.write_file(three)
+ assert newer_group([one, two, three], old_file)
+ assert not newer_group([one, two, old_file], three)
+
+ # missing handling
+ os.remove(one)
+ with pytest.raises(OSError):
+ newer_group([one, two, old_file], three)
+
+ assert not newer_group([one, two, old_file], three, missing='ignore')
+
+ assert newer_group([one, two, old_file], three, missing='newer')
+
+
+@pytest.fixture
+def groups_target(tmp_path):
+ """
+ Set up some older sources, a target, and newer sources.
+
+ Returns a simple namespace with these values.
+ """
+ filenames = ['older.c', 'older.h', 'target.o', 'newer.c', 'newer.h']
+ paths = [tmp_path / name for name in filenames]
+
+ for mtime, path in enumerate(paths):
+ path.write_text('', encoding='utf-8')
+
+ # make sure modification times are sequential
+ os.utime(path, (mtime, mtime))
+
+ return types.SimpleNamespace(older=paths[:2], target=paths[2], newer=paths[3:])
+
+
+def test_newer_pairwise_group(groups_target):
+ older = newer_pairwise_group([groups_target.older], [groups_target.target])
+ newer = newer_pairwise_group([groups_target.newer], [groups_target.target])
+ assert older == ([], [])
+ assert newer == ([groups_target.newer], [groups_target.target])
+
+
+def test_newer_group_no_sources_no_target(tmp_path):
+ """
+ Consider no sources and no target "newer".
+ """
+ assert newer_group([], str(tmp_path / 'does-not-exist'))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_sdist.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_sdist.py
new file mode 100644
index 0000000000000000000000000000000000000000..6b1a376b262162aa7c8d3d989709c05b38563d6c
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_sdist.py
@@ -0,0 +1,470 @@
+"""Tests for distutils.command.sdist."""
+
+import os
+import pathlib
+import shutil # noqa: F401
+import tarfile
+import zipfile
+from distutils.archive_util import ARCHIVE_FORMATS
+from distutils.command.sdist import sdist, show_formats
+from distutils.core import Distribution
+from distutils.errors import DistutilsOptionError
+from distutils.filelist import FileList
+from os.path import join
+from textwrap import dedent
+
+import jaraco.path
+import path
+import pytest
+from more_itertools import ilen
+
+from . import support
+from .unix_compat import grp, pwd, require_uid_0, require_unix_id
+
+SETUP_PY = """
+from distutils.core import setup
+import somecode
+
+setup(name='fake')
+"""
+
+MANIFEST = """\
+# file GENERATED by distutils, do NOT edit
+README
+buildout.cfg
+inroot.txt
+setup.py
+data%(sep)sdata.dt
+scripts%(sep)sscript.py
+some%(sep)sfile.txt
+some%(sep)sother_file.txt
+somecode%(sep)s__init__.py
+somecode%(sep)sdoc.dat
+somecode%(sep)sdoc.txt
+"""
+
+
+@pytest.fixture(autouse=True)
+def project_dir(request, distutils_managed_tempdir):
+ self = request.instance
+ self.tmp_dir = self.mkdtemp()
+ jaraco.path.build(
+ {
+ 'somecode': {
+ '__init__.py': '#',
+ },
+ 'README': 'xxx',
+ 'setup.py': SETUP_PY,
+ },
+ self.tmp_dir,
+ )
+ with path.Path(self.tmp_dir):
+ yield
+
+
+def clean_lines(filepath):
+ with pathlib.Path(filepath).open(encoding='utf-8') as f:
+ yield from filter(None, map(str.strip, f))
+
+
+class TestSDist(support.TempdirManager):
+ def get_cmd(self, metadata=None):
+ """Returns a cmd"""
+ if metadata is None:
+ metadata = {
+ 'name': 'ns.fake--pkg',
+ 'version': '1.0',
+ 'url': 'xxx',
+ 'author': 'xxx',
+ 'author_email': 'xxx',
+ }
+ dist = Distribution(metadata)
+ dist.script_name = 'setup.py'
+ dist.packages = ['somecode']
+ dist.include_package_data = True
+ cmd = sdist(dist)
+ cmd.dist_dir = 'dist'
+ return dist, cmd
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_prune_file_list(self):
+ # this test creates a project with some VCS dirs and an NFS rename
+ # file, then launches sdist to check they get pruned on all systems
+
+ # creating VCS directories with some files in them
+ os.mkdir(join(self.tmp_dir, 'somecode', '.svn'))
+ self.write_file((self.tmp_dir, 'somecode', '.svn', 'ok.py'), 'xxx')
+
+ os.mkdir(join(self.tmp_dir, 'somecode', '.hg'))
+ self.write_file((self.tmp_dir, 'somecode', '.hg', 'ok'), 'xxx')
+
+ os.mkdir(join(self.tmp_dir, 'somecode', '.git'))
+ self.write_file((self.tmp_dir, 'somecode', '.git', 'ok'), 'xxx')
+
+ self.write_file((self.tmp_dir, 'somecode', '.nfs0001'), 'xxx')
+
+ # now building a sdist
+ dist, cmd = self.get_cmd()
+
+ # zip is available universally
+ # (tar might not be installed under win32)
+ cmd.formats = ['zip']
+
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # now let's check what we have
+ dist_folder = join(self.tmp_dir, 'dist')
+ files = os.listdir(dist_folder)
+ assert files == ['ns_fake_pkg-1.0.zip']
+
+ zip_file = zipfile.ZipFile(join(dist_folder, 'ns_fake_pkg-1.0.zip'))
+ try:
+ content = zip_file.namelist()
+ finally:
+ zip_file.close()
+
+ # making sure everything has been pruned correctly
+ expected = [
+ '',
+ 'PKG-INFO',
+ 'README',
+ 'setup.py',
+ 'somecode/',
+ 'somecode/__init__.py',
+ ]
+ assert sorted(content) == ['ns_fake_pkg-1.0/' + x for x in expected]
+
+ @pytest.mark.usefixtures('needs_zlib')
+ @pytest.mark.skipif("not shutil.which('tar')")
+ @pytest.mark.skipif("not shutil.which('gzip')")
+ def test_make_distribution(self):
+ # now building a sdist
+ dist, cmd = self.get_cmd()
+
+ # creating a gztar then a tar
+ cmd.formats = ['gztar', 'tar']
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # making sure we have two files
+ dist_folder = join(self.tmp_dir, 'dist')
+ result = os.listdir(dist_folder)
+ result.sort()
+ assert result == ['ns_fake_pkg-1.0.tar', 'ns_fake_pkg-1.0.tar.gz']
+
+ os.remove(join(dist_folder, 'ns_fake_pkg-1.0.tar'))
+ os.remove(join(dist_folder, 'ns_fake_pkg-1.0.tar.gz'))
+
+ # now trying a tar then a gztar
+ cmd.formats = ['tar', 'gztar']
+
+ cmd.ensure_finalized()
+ cmd.run()
+
+ result = os.listdir(dist_folder)
+ result.sort()
+ assert result == ['ns_fake_pkg-1.0.tar', 'ns_fake_pkg-1.0.tar.gz']
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_add_defaults(self):
+ # https://bugs.python.org/issue2279
+
+ # add_default should also include
+ # data_files and package_data
+ dist, cmd = self.get_cmd()
+
+ # filling data_files by pointing files
+ # in package_data
+ dist.package_data = {'': ['*.cfg', '*.dat'], 'somecode': ['*.txt']}
+ self.write_file((self.tmp_dir, 'somecode', 'doc.txt'), '#')
+ self.write_file((self.tmp_dir, 'somecode', 'doc.dat'), '#')
+
+ # adding some data in data_files
+ data_dir = join(self.tmp_dir, 'data')
+ os.mkdir(data_dir)
+ self.write_file((data_dir, 'data.dt'), '#')
+ some_dir = join(self.tmp_dir, 'some')
+ os.mkdir(some_dir)
+ # make sure VCS directories are pruned (#14004)
+ hg_dir = join(self.tmp_dir, '.hg')
+ os.mkdir(hg_dir)
+ self.write_file((hg_dir, 'last-message.txt'), '#')
+ # a buggy regex used to prevent this from working on windows (#6884)
+ self.write_file((self.tmp_dir, 'buildout.cfg'), '#')
+ self.write_file((self.tmp_dir, 'inroot.txt'), '#')
+ self.write_file((some_dir, 'file.txt'), '#')
+ self.write_file((some_dir, 'other_file.txt'), '#')
+
+ dist.data_files = [
+ ('data', ['data/data.dt', 'buildout.cfg', 'inroot.txt', 'notexisting']),
+ 'some/file.txt',
+ 'some/other_file.txt',
+ ]
+
+ # adding a script
+ script_dir = join(self.tmp_dir, 'scripts')
+ os.mkdir(script_dir)
+ self.write_file((script_dir, 'script.py'), '#')
+ dist.scripts = [join('scripts', 'script.py')]
+
+ cmd.formats = ['zip']
+ cmd.use_defaults = True
+
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # now let's check what we have
+ dist_folder = join(self.tmp_dir, 'dist')
+ files = os.listdir(dist_folder)
+ assert files == ['ns_fake_pkg-1.0.zip']
+
+ zip_file = zipfile.ZipFile(join(dist_folder, 'ns_fake_pkg-1.0.zip'))
+ try:
+ content = zip_file.namelist()
+ finally:
+ zip_file.close()
+
+ # making sure everything was added
+ expected = [
+ '',
+ 'PKG-INFO',
+ 'README',
+ 'buildout.cfg',
+ 'data/',
+ 'data/data.dt',
+ 'inroot.txt',
+ 'scripts/',
+ 'scripts/script.py',
+ 'setup.py',
+ 'some/',
+ 'some/file.txt',
+ 'some/other_file.txt',
+ 'somecode/',
+ 'somecode/__init__.py',
+ 'somecode/doc.dat',
+ 'somecode/doc.txt',
+ ]
+ assert sorted(content) == ['ns_fake_pkg-1.0/' + x for x in expected]
+
+ # checking the MANIFEST
+ manifest = pathlib.Path(self.tmp_dir, 'MANIFEST').read_text(encoding='utf-8')
+ assert manifest == MANIFEST % {'sep': os.sep}
+
+ @staticmethod
+ def warnings(messages, prefix='warning: '):
+ return [msg for msg in messages if msg.startswith(prefix)]
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_metadata_check_option(self, caplog):
+ # testing the `medata-check` option
+ dist, cmd = self.get_cmd(metadata={})
+
+ # this should raise some warnings !
+ # with the `check` subcommand
+ cmd.ensure_finalized()
+ cmd.run()
+ assert len(self.warnings(caplog.messages, 'warning: check: ')) == 1
+
+ # trying with a complete set of metadata
+ caplog.clear()
+ dist, cmd = self.get_cmd()
+ cmd.ensure_finalized()
+ cmd.metadata_check = False
+ cmd.run()
+ assert len(self.warnings(caplog.messages, 'warning: check: ')) == 0
+
+ def test_show_formats(self, capsys):
+ show_formats()
+
+ # the output should be a header line + one line per format
+ num_formats = len(ARCHIVE_FORMATS.keys())
+ output = [
+ line
+ for line in capsys.readouterr().out.split('\n')
+ if line.strip().startswith('--formats=')
+ ]
+ assert len(output) == num_formats
+
+ def test_finalize_options(self):
+ dist, cmd = self.get_cmd()
+ cmd.finalize_options()
+
+ # default options set by finalize
+ assert cmd.manifest == 'MANIFEST'
+ assert cmd.template == 'MANIFEST.in'
+ assert cmd.dist_dir == 'dist'
+
+ # formats has to be a string splitable on (' ', ',') or
+ # a stringlist
+ cmd.formats = 1
+ with pytest.raises(DistutilsOptionError):
+ cmd.finalize_options()
+ cmd.formats = ['zip']
+ cmd.finalize_options()
+
+ # formats has to be known
+ cmd.formats = 'supazipa'
+ with pytest.raises(DistutilsOptionError):
+ cmd.finalize_options()
+
+ # the following tests make sure there is a nice error message instead
+ # of a traceback when parsing an invalid manifest template
+
+ def _check_template(self, content, caplog):
+ dist, cmd = self.get_cmd()
+ os.chdir(self.tmp_dir)
+ self.write_file('MANIFEST.in', content)
+ cmd.ensure_finalized()
+ cmd.filelist = FileList()
+ cmd.read_template()
+ assert len(self.warnings(caplog.messages)) == 1
+
+ def test_invalid_template_unknown_command(self, caplog):
+ self._check_template('taunt knights *', caplog)
+
+ def test_invalid_template_wrong_arguments(self, caplog):
+ # this manifest command takes one argument
+ self._check_template('prune', caplog)
+
+ @pytest.mark.skipif("platform.system() != 'Windows'")
+ def test_invalid_template_wrong_path(self, caplog):
+ # on Windows, trailing slashes are not allowed
+ # this used to crash instead of raising a warning: #8286
+ self._check_template('include examples/', caplog)
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_get_file_list(self):
+ # make sure MANIFEST is recalculated
+ dist, cmd = self.get_cmd()
+
+ # filling data_files by pointing files in package_data
+ dist.package_data = {'somecode': ['*.txt']}
+ self.write_file((self.tmp_dir, 'somecode', 'doc.txt'), '#')
+ cmd.formats = ['gztar']
+ cmd.ensure_finalized()
+ cmd.run()
+
+ assert ilen(clean_lines(cmd.manifest)) == 5
+
+ # adding a file
+ self.write_file((self.tmp_dir, 'somecode', 'doc2.txt'), '#')
+
+ # make sure build_py is reinitialized, like a fresh run
+ build_py = dist.get_command_obj('build_py')
+ build_py.finalized = False
+ build_py.ensure_finalized()
+
+ cmd.run()
+
+ manifest2 = list(clean_lines(cmd.manifest))
+
+ # do we have the new file in MANIFEST ?
+ assert len(manifest2) == 6
+ assert 'doc2.txt' in manifest2[-1]
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_manifest_marker(self):
+ # check that autogenerated MANIFESTs have a marker
+ dist, cmd = self.get_cmd()
+ cmd.ensure_finalized()
+ cmd.run()
+
+ assert (
+ next(clean_lines(cmd.manifest))
+ == '# file GENERATED by distutils, do NOT edit'
+ )
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_manifest_comments(self):
+ # make sure comments don't cause exceptions or wrong includes
+ contents = dedent(
+ """\
+ # bad.py
+ #bad.py
+ good.py
+ """
+ )
+ dist, cmd = self.get_cmd()
+ cmd.ensure_finalized()
+ self.write_file((self.tmp_dir, cmd.manifest), contents)
+ self.write_file((self.tmp_dir, 'good.py'), '# pick me!')
+ self.write_file((self.tmp_dir, 'bad.py'), "# don't pick me!")
+ self.write_file((self.tmp_dir, '#bad.py'), "# don't pick me!")
+ cmd.run()
+ assert cmd.filelist.files == ['good.py']
+
+ @pytest.mark.usefixtures('needs_zlib')
+ def test_manual_manifest(self):
+ # check that a MANIFEST without a marker is left alone
+ dist, cmd = self.get_cmd()
+ cmd.formats = ['gztar']
+ cmd.ensure_finalized()
+ self.write_file((self.tmp_dir, cmd.manifest), 'README.manual')
+ self.write_file(
+ (self.tmp_dir, 'README.manual'),
+ 'This project maintains its MANIFEST file itself.',
+ )
+ cmd.run()
+ assert cmd.filelist.files == ['README.manual']
+
+ assert list(clean_lines(cmd.manifest)) == ['README.manual']
+
+ archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.0.tar.gz')
+ archive = tarfile.open(archive_name)
+ try:
+ filenames = [tarinfo.name for tarinfo in archive]
+ finally:
+ archive.close()
+ assert sorted(filenames) == [
+ 'ns_fake_pkg-1.0',
+ 'ns_fake_pkg-1.0/PKG-INFO',
+ 'ns_fake_pkg-1.0/README.manual',
+ ]
+
+ @pytest.mark.usefixtures('needs_zlib')
+ @require_unix_id
+ @require_uid_0
+ @pytest.mark.skipif("not shutil.which('tar')")
+ @pytest.mark.skipif("not shutil.which('gzip')")
+ def test_make_distribution_owner_group(self):
+ # now building a sdist
+ dist, cmd = self.get_cmd()
+
+ # creating a gztar and specifying the owner+group
+ cmd.formats = ['gztar']
+ cmd.owner = pwd.getpwuid(0)[0]
+ cmd.group = grp.getgrgid(0)[0]
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # making sure we have the good rights
+ archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.0.tar.gz')
+ archive = tarfile.open(archive_name)
+ try:
+ for member in archive.getmembers():
+ assert member.uid == 0
+ assert member.gid == 0
+ finally:
+ archive.close()
+
+ # building a sdist again
+ dist, cmd = self.get_cmd()
+
+ # creating a gztar
+ cmd.formats = ['gztar']
+ cmd.ensure_finalized()
+ cmd.run()
+
+ # making sure we have the good rights
+ archive_name = join(self.tmp_dir, 'dist', 'ns_fake_pkg-1.0.tar.gz')
+ archive = tarfile.open(archive_name)
+
+ # note that we are not testing the group ownership here
+ # because, depending on the platforms and the container
+ # rights (see #7408)
+ try:
+ for member in archive.getmembers():
+ assert member.uid == os.getuid()
+ finally:
+ archive.close()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_spawn.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_spawn.py
new file mode 100644
index 0000000000000000000000000000000000000000..3b9fc926f6ffc41673630fbf5775e6f4ad638b18
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_spawn.py
@@ -0,0 +1,141 @@
+"""Tests for distutils.spawn."""
+
+import os
+import stat
+import sys
+import unittest.mock as mock
+from distutils.errors import DistutilsExecError
+from distutils.spawn import find_executable, spawn
+from distutils.tests import support
+
+import path
+import pytest
+from test.support import unix_shell
+
+from .compat import py39 as os_helper
+
+
+class TestSpawn(support.TempdirManager):
+ @pytest.mark.skipif("os.name not in ('nt', 'posix')")
+ def test_spawn(self):
+ tmpdir = self.mkdtemp()
+
+ # creating something executable
+ # through the shell that returns 1
+ if sys.platform != 'win32':
+ exe = os.path.join(tmpdir, 'foo.sh')
+ self.write_file(exe, f'#!{unix_shell}\nexit 1')
+ else:
+ exe = os.path.join(tmpdir, 'foo.bat')
+ self.write_file(exe, 'exit 1')
+
+ os.chmod(exe, 0o777)
+ with pytest.raises(DistutilsExecError):
+ spawn([exe])
+
+ # now something that works
+ if sys.platform != 'win32':
+ exe = os.path.join(tmpdir, 'foo.sh')
+ self.write_file(exe, f'#!{unix_shell}\nexit 0')
+ else:
+ exe = os.path.join(tmpdir, 'foo.bat')
+ self.write_file(exe, 'exit 0')
+
+ os.chmod(exe, 0o777)
+ spawn([exe]) # should work without any error
+
+ def test_find_executable(self, tmp_path):
+ program_path = self._make_executable(tmp_path, '.exe')
+ program = program_path.name
+ program_noeext = program_path.with_suffix('').name
+ filename = str(program_path)
+ tmp_dir = path.Path(tmp_path)
+
+ # test path parameter
+ rv = find_executable(program, path=tmp_dir)
+ assert rv == filename
+
+ if sys.platform == 'win32':
+ # test without ".exe" extension
+ rv = find_executable(program_noeext, path=tmp_dir)
+ assert rv == filename
+
+ # test find in the current directory
+ with tmp_dir:
+ rv = find_executable(program)
+ assert rv == program
+
+ # test non-existent program
+ dont_exist_program = "dontexist_" + program
+ rv = find_executable(dont_exist_program, path=tmp_dir)
+ assert rv is None
+
+ # PATH='': no match, except in the current directory
+ with os_helper.EnvironmentVarGuard() as env:
+ env['PATH'] = ''
+ with (
+ mock.patch(
+ 'distutils.spawn.os.confstr', return_value=tmp_dir, create=True
+ ),
+ mock.patch('distutils.spawn.os.defpath', tmp_dir),
+ ):
+ rv = find_executable(program)
+ assert rv is None
+
+ # look in current directory
+ with tmp_dir:
+ rv = find_executable(program)
+ assert rv == program
+
+ # PATH=':': explicitly looks in the current directory
+ with os_helper.EnvironmentVarGuard() as env:
+ env['PATH'] = os.pathsep
+ with (
+ mock.patch('distutils.spawn.os.confstr', return_value='', create=True),
+ mock.patch('distutils.spawn.os.defpath', ''),
+ ):
+ rv = find_executable(program)
+ assert rv is None
+
+ # look in current directory
+ with tmp_dir:
+ rv = find_executable(program)
+ assert rv == program
+
+ # missing PATH: test os.confstr("CS_PATH") and os.defpath
+ with os_helper.EnvironmentVarGuard() as env:
+ env.pop('PATH', None)
+
+ # without confstr
+ with (
+ mock.patch(
+ 'distutils.spawn.os.confstr', side_effect=ValueError, create=True
+ ),
+ mock.patch('distutils.spawn.os.defpath', tmp_dir),
+ ):
+ rv = find_executable(program)
+ assert rv == filename
+
+ # with confstr
+ with (
+ mock.patch(
+ 'distutils.spawn.os.confstr', return_value=tmp_dir, create=True
+ ),
+ mock.patch('distutils.spawn.os.defpath', ''),
+ ):
+ rv = find_executable(program)
+ assert rv == filename
+
+ @staticmethod
+ def _make_executable(tmp_path, ext):
+ # Give the temporary program a suffix regardless of platform.
+ # It's needed on Windows and not harmful on others.
+ program = tmp_path.joinpath('program').with_suffix(ext)
+ program.write_text("", encoding='utf-8')
+ program.chmod(stat.S_IXUSR)
+ return program
+
+ def test_spawn_missing_exe(self):
+ with pytest.raises(DistutilsExecError) as ctx:
+ spawn(['does-not-exist'])
+ assert "command 'does-not-exist' failed" in str(ctx.value)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_sysconfig.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_sysconfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..43d77c23fad426be237b9f91a6d98d7c36233d84
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_sysconfig.py
@@ -0,0 +1,319 @@
+"""Tests for distutils.sysconfig."""
+
+import contextlib
+import distutils
+import os
+import pathlib
+import subprocess
+import sys
+from distutils import sysconfig
+from distutils.ccompiler import new_compiler # noqa: F401
+from distutils.unixccompiler import UnixCCompiler
+
+import jaraco.envs
+import path
+import pytest
+from jaraco.text import trim
+from test.support import swap_item
+
+
+def _gen_makefile(root, contents):
+ jaraco.path.build({'Makefile': trim(contents)}, root)
+ return root / 'Makefile'
+
+
+@pytest.mark.usefixtures('save_env')
+class TestSysconfig:
+ def test_get_config_h_filename(self):
+ config_h = sysconfig.get_config_h_filename()
+ assert os.path.isfile(config_h)
+
+ @pytest.mark.skipif("platform.system() == 'Windows'")
+ @pytest.mark.skipif("sys.implementation.name != 'cpython'")
+ def test_get_makefile_filename(self):
+ makefile = sysconfig.get_makefile_filename()
+ assert os.path.isfile(makefile)
+
+ def test_get_python_lib(self, tmp_path):
+ assert sysconfig.get_python_lib() != sysconfig.get_python_lib(prefix=tmp_path)
+
+ def test_get_config_vars(self):
+ cvars = sysconfig.get_config_vars()
+ assert isinstance(cvars, dict)
+ assert cvars
+
+ @pytest.mark.skipif('sysconfig.IS_PYPY')
+ @pytest.mark.skipif('sysconfig.python_build')
+ @pytest.mark.xfail('platform.system() == "Windows"')
+ def test_srcdir_simple(self):
+ # See #15364.
+ srcdir = pathlib.Path(sysconfig.get_config_var('srcdir'))
+
+ assert srcdir.absolute()
+ assert srcdir.is_dir()
+
+ makefile = pathlib.Path(sysconfig.get_makefile_filename())
+ assert makefile.parent.samefile(srcdir)
+
+ @pytest.mark.skipif('sysconfig.IS_PYPY')
+ @pytest.mark.skipif('not sysconfig.python_build')
+ def test_srcdir_python_build(self):
+ # See #15364.
+ srcdir = pathlib.Path(sysconfig.get_config_var('srcdir'))
+
+ # The python executable has not been installed so srcdir
+ # should be a full source checkout.
+ Python_h = srcdir.joinpath('Include', 'Python.h')
+ assert Python_h.is_file()
+ assert sysconfig._is_python_source_dir(srcdir)
+ assert sysconfig._is_python_source_dir(str(srcdir))
+
+ def test_srcdir_independent_of_cwd(self):
+ """
+ srcdir should be independent of the current working directory
+ """
+ # See #15364.
+ srcdir = sysconfig.get_config_var('srcdir')
+ with path.Path('..'):
+ srcdir2 = sysconfig.get_config_var('srcdir')
+ assert srcdir == srcdir2
+
+ def customize_compiler(self):
+ # make sure AR gets caught
+ class compiler:
+ compiler_type = 'unix'
+ executables = UnixCCompiler.executables
+
+ def __init__(self):
+ self.exes = {}
+
+ def set_executables(self, **kw):
+ for k, v in kw.items():
+ self.exes[k] = v
+
+ sysconfig_vars = {
+ 'AR': 'sc_ar',
+ 'CC': 'sc_cc',
+ 'CXX': 'sc_cxx',
+ 'ARFLAGS': '--sc-arflags',
+ 'CFLAGS': '--sc-cflags',
+ 'CCSHARED': '--sc-ccshared',
+ 'LDSHARED': 'sc_ldshared',
+ 'SHLIB_SUFFIX': 'sc_shutil_suffix',
+ }
+
+ comp = compiler()
+ with contextlib.ExitStack() as cm:
+ for key, value in sysconfig_vars.items():
+ cm.enter_context(swap_item(sysconfig._config_vars, key, value))
+ sysconfig.customize_compiler(comp)
+
+ return comp
+
+ @pytest.mark.skipif("not isinstance(new_compiler(), UnixCCompiler)")
+ @pytest.mark.usefixtures('disable_macos_customization')
+ def test_customize_compiler(self):
+ # Make sure that sysconfig._config_vars is initialized
+ sysconfig.get_config_vars()
+
+ os.environ['AR'] = 'env_ar'
+ os.environ['CC'] = 'env_cc'
+ os.environ['CPP'] = 'env_cpp'
+ os.environ['CXX'] = 'env_cxx --env-cxx-flags'
+ os.environ['LDSHARED'] = 'env_ldshared'
+ os.environ['LDFLAGS'] = '--env-ldflags'
+ os.environ['ARFLAGS'] = '--env-arflags'
+ os.environ['CFLAGS'] = '--env-cflags'
+ os.environ['CPPFLAGS'] = '--env-cppflags'
+ os.environ['RANLIB'] = 'env_ranlib'
+
+ comp = self.customize_compiler()
+ assert comp.exes['archiver'] == 'env_ar --env-arflags'
+ assert comp.exes['preprocessor'] == 'env_cpp --env-cppflags'
+ assert comp.exes['compiler'] == 'env_cc --env-cflags --env-cppflags'
+ assert comp.exes['compiler_so'] == (
+ 'env_cc --env-cflags --env-cppflags --sc-ccshared'
+ )
+ assert (
+ comp.exes['compiler_cxx']
+ == 'env_cxx --env-cxx-flags --sc-cflags --env-cppflags'
+ )
+ assert comp.exes['linker_exe'] == 'env_cc'
+ assert comp.exes['linker_so'] == (
+ 'env_ldshared --env-ldflags --env-cflags --env-cppflags'
+ )
+ assert comp.shared_lib_extension == 'sc_shutil_suffix'
+
+ if sys.platform == "darwin":
+ assert comp.exes['ranlib'] == 'env_ranlib'
+ else:
+ assert 'ranlib' not in comp.exes
+
+ del os.environ['AR']
+ del os.environ['CC']
+ del os.environ['CPP']
+ del os.environ['CXX']
+ del os.environ['LDSHARED']
+ del os.environ['LDFLAGS']
+ del os.environ['ARFLAGS']
+ del os.environ['CFLAGS']
+ del os.environ['CPPFLAGS']
+ del os.environ['RANLIB']
+
+ comp = self.customize_compiler()
+ assert comp.exes['archiver'] == 'sc_ar --sc-arflags'
+ assert comp.exes['preprocessor'] == 'sc_cc -E'
+ assert comp.exes['compiler'] == 'sc_cc --sc-cflags'
+ assert comp.exes['compiler_so'] == 'sc_cc --sc-cflags --sc-ccshared'
+ assert comp.exes['compiler_cxx'] == 'sc_cxx --sc-cflags'
+ assert comp.exes['linker_exe'] == 'sc_cc'
+ assert comp.exes['linker_so'] == 'sc_ldshared'
+ assert comp.shared_lib_extension == 'sc_shutil_suffix'
+ assert 'ranlib' not in comp.exes
+
+ def test_parse_makefile_base(self, tmp_path):
+ makefile = _gen_makefile(
+ tmp_path,
+ """
+ CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'
+ VAR=$OTHER
+ OTHER=foo
+ """,
+ )
+ d = sysconfig.parse_makefile(makefile)
+ assert d == {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'", 'OTHER': 'foo'}
+
+ def test_parse_makefile_literal_dollar(self, tmp_path):
+ makefile = _gen_makefile(
+ tmp_path,
+ """
+ CONFIG_ARGS= '--arg1=optarg1' 'ENV=\\$$LIB'
+ VAR=$OTHER
+ OTHER=foo
+ """,
+ )
+ d = sysconfig.parse_makefile(makefile)
+ assert d == {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", 'OTHER': 'foo'}
+
+ def test_sysconfig_module(self):
+ import sysconfig as global_sysconfig
+
+ assert global_sysconfig.get_config_var('CFLAGS') == sysconfig.get_config_var(
+ 'CFLAGS'
+ )
+ assert global_sysconfig.get_config_var('LDFLAGS') == sysconfig.get_config_var(
+ 'LDFLAGS'
+ )
+
+ # On macOS, binary installers support extension module building on
+ # various levels of the operating system with differing Xcode
+ # configurations, requiring customization of some of the
+ # compiler configuration directives to suit the environment on
+ # the installed machine. Some of these customizations may require
+ # running external programs and are thus deferred until needed by
+ # the first extension module build. Only
+ # the Distutils version of sysconfig is used for extension module
+ # builds, which happens earlier in the Distutils tests. This may
+ # cause the following tests to fail since no tests have caused
+ # the global version of sysconfig to call the customization yet.
+ # The solution for now is to simply skip this test in this case.
+ # The longer-term solution is to only have one version of sysconfig.
+ @pytest.mark.skipif("sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER')")
+ def test_sysconfig_compiler_vars(self):
+ import sysconfig as global_sysconfig
+
+ if sysconfig.get_config_var('CUSTOMIZED_OSX_COMPILER'):
+ pytest.skip('compiler flags customized')
+ assert global_sysconfig.get_config_var('LDSHARED') == sysconfig.get_config_var(
+ 'LDSHARED'
+ )
+ assert global_sysconfig.get_config_var('CC') == sysconfig.get_config_var('CC')
+
+ @pytest.mark.skipif("not sysconfig.get_config_var('EXT_SUFFIX')")
+ def test_SO_deprecation(self):
+ with pytest.warns(DeprecationWarning):
+ sysconfig.get_config_var('SO')
+
+ def test_customize_compiler_before_get_config_vars(self, tmp_path):
+ # Issue #21923: test that a Distribution compiler
+ # instance can be called without an explicit call to
+ # get_config_vars().
+ jaraco.path.build(
+ {
+ 'file': trim("""
+ from distutils.core import Distribution
+ config = Distribution().get_command_obj('config')
+ # try_compile may pass or it may fail if no compiler
+ # is found but it should not raise an exception.
+ rc = config.try_compile('int x;')
+ """)
+ },
+ tmp_path,
+ )
+ p = subprocess.Popen(
+ [sys.executable, tmp_path / 'file'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ universal_newlines=True,
+ encoding='utf-8',
+ )
+ outs, errs = p.communicate()
+ assert 0 == p.returncode, "Subprocess failed: " + outs
+
+ def test_parse_config_h(self):
+ config_h = sysconfig.get_config_h_filename()
+ input = {}
+ with open(config_h, encoding="utf-8") as f:
+ result = sysconfig.parse_config_h(f, g=input)
+ assert input is result
+ with open(config_h, encoding="utf-8") as f:
+ result = sysconfig.parse_config_h(f)
+ assert isinstance(result, dict)
+
+ @pytest.mark.skipif("platform.system() != 'Windows'")
+ @pytest.mark.skipif("sys.implementation.name != 'cpython'")
+ def test_win_ext_suffix(self):
+ assert sysconfig.get_config_var("EXT_SUFFIX").endswith(".pyd")
+ assert sysconfig.get_config_var("EXT_SUFFIX") != ".pyd"
+
+ @pytest.mark.skipif("platform.system() != 'Windows'")
+ @pytest.mark.skipif("sys.implementation.name != 'cpython'")
+ @pytest.mark.skipif(
+ '\\PCbuild\\'.casefold() not in sys.executable.casefold(),
+ reason='Need sys.executable to be in a source tree',
+ )
+ def test_win_build_venv_from_source_tree(self, tmp_path):
+ """Ensure distutils.sysconfig detects venvs from source tree builds."""
+ env = jaraco.envs.VEnv()
+ env.create_opts = env.clean_opts
+ env.root = tmp_path
+ env.ensure_env()
+ cmd = [
+ env.exe(),
+ "-c",
+ "import distutils.sysconfig; print(distutils.sysconfig.python_build)",
+ ]
+ distutils_path = os.path.dirname(os.path.dirname(distutils.__file__))
+ out = subprocess.check_output(
+ cmd, env={**os.environ, "PYTHONPATH": distutils_path}
+ )
+ assert out == "True"
+
+ def test_get_python_inc_missing_config_dir(self, monkeypatch):
+ """
+ In portable Python installations, the sysconfig will be broken,
+ pointing to the directories where the installation was built and
+ not where it currently is. In this case, ensure that the missing
+ directory isn't used for get_python_inc.
+
+ See pypa/distutils#178.
+ """
+
+ def override(name):
+ if name == 'INCLUDEPY':
+ return '/does-not-exist'
+ return sysconfig.get_config_var(name)
+
+ monkeypatch.setattr(sysconfig, 'get_config_var', override)
+
+ assert os.path.exists(sysconfig.get_python_inc())
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_text_file.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_text_file.py
new file mode 100644
index 0000000000000000000000000000000000000000..f51115656135cd3f348a45d4a14f97eeee47fb98
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_text_file.py
@@ -0,0 +1,127 @@
+"""Tests for distutils.text_file."""
+
+from distutils.tests import support
+from distutils.text_file import TextFile
+
+import jaraco.path
+import path
+
+TEST_DATA = """# test file
+
+line 3 \\
+# intervening comment
+ continues on next line
+"""
+
+
+class TestTextFile(support.TempdirManager):
+ def test_class(self):
+ # old tests moved from text_file.__main__
+ # so they are really called by the buildbots
+
+ # result 1: no fancy options
+ result1 = [
+ '# test file\n',
+ '\n',
+ 'line 3 \\\n',
+ '# intervening comment\n',
+ ' continues on next line\n',
+ ]
+
+ # result 2: just strip comments
+ result2 = ["\n", "line 3 \\\n", " continues on next line\n"]
+
+ # result 3: just strip blank lines
+ result3 = [
+ "# test file\n",
+ "line 3 \\\n",
+ "# intervening comment\n",
+ " continues on next line\n",
+ ]
+
+ # result 4: default, strip comments, blank lines,
+ # and trailing whitespace
+ result4 = ["line 3 \\", " continues on next line"]
+
+ # result 5: strip comments and blanks, plus join lines (but don't
+ # "collapse" joined lines
+ result5 = ["line 3 continues on next line"]
+
+ # result 6: strip comments and blanks, plus join lines (and
+ # "collapse" joined lines
+ result6 = ["line 3 continues on next line"]
+
+ def test_input(count, description, file, expected_result):
+ result = file.readlines()
+ assert result == expected_result
+
+ tmp_path = path.Path(self.mkdtemp())
+ filename = tmp_path / 'test.txt'
+ jaraco.path.build({filename.name: TEST_DATA}, tmp_path)
+
+ in_file = TextFile(
+ filename,
+ strip_comments=False,
+ skip_blanks=False,
+ lstrip_ws=False,
+ rstrip_ws=False,
+ )
+ try:
+ test_input(1, "no processing", in_file, result1)
+ finally:
+ in_file.close()
+
+ in_file = TextFile(
+ filename,
+ strip_comments=True,
+ skip_blanks=False,
+ lstrip_ws=False,
+ rstrip_ws=False,
+ )
+ try:
+ test_input(2, "strip comments", in_file, result2)
+ finally:
+ in_file.close()
+
+ in_file = TextFile(
+ filename,
+ strip_comments=False,
+ skip_blanks=True,
+ lstrip_ws=False,
+ rstrip_ws=False,
+ )
+ try:
+ test_input(3, "strip blanks", in_file, result3)
+ finally:
+ in_file.close()
+
+ in_file = TextFile(filename)
+ try:
+ test_input(4, "default processing", in_file, result4)
+ finally:
+ in_file.close()
+
+ in_file = TextFile(
+ filename,
+ strip_comments=True,
+ skip_blanks=True,
+ join_lines=True,
+ rstrip_ws=True,
+ )
+ try:
+ test_input(5, "join lines without collapsing", in_file, result5)
+ finally:
+ in_file.close()
+
+ in_file = TextFile(
+ filename,
+ strip_comments=True,
+ skip_blanks=True,
+ join_lines=True,
+ rstrip_ws=True,
+ collapse_join=True,
+ )
+ try:
+ test_input(6, "join lines with collapsing", in_file, result6)
+ finally:
+ in_file.close()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..00c9743ed0a2664039060ef149d30f165bf2f465
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_util.py
@@ -0,0 +1,243 @@
+"""Tests for distutils.util."""
+
+import email
+import email.generator
+import email.policy
+import io
+import os
+import pathlib
+import sys
+import sysconfig as stdlib_sysconfig
+import unittest.mock as mock
+from copy import copy
+from distutils import sysconfig, util
+from distutils.errors import DistutilsByteCompileError, DistutilsPlatformError
+from distutils.util import (
+ byte_compile,
+ change_root,
+ check_environ,
+ convert_path,
+ get_host_platform,
+ get_platform,
+ grok_environment_error,
+ rfc822_escape,
+ split_quoted,
+ strtobool,
+)
+
+import pytest
+
+
+@pytest.fixture(autouse=True)
+def environment(monkeypatch):
+ monkeypatch.setattr(os, 'name', os.name)
+ monkeypatch.setattr(sys, 'platform', sys.platform)
+ monkeypatch.setattr(sys, 'version', sys.version)
+ monkeypatch.setattr(os, 'sep', os.sep)
+ monkeypatch.setattr(os.path, 'join', os.path.join)
+ monkeypatch.setattr(os.path, 'isabs', os.path.isabs)
+ monkeypatch.setattr(os.path, 'splitdrive', os.path.splitdrive)
+ monkeypatch.setattr(sysconfig, '_config_vars', copy(sysconfig._config_vars))
+
+
+@pytest.mark.usefixtures('save_env')
+class TestUtil:
+ def test_get_host_platform(self):
+ with mock.patch('os.name', 'nt'):
+ with mock.patch('sys.version', '... [... (ARM64)]'):
+ assert get_host_platform() == 'win-arm64'
+ with mock.patch('sys.version', '... [... (ARM)]'):
+ assert get_host_platform() == 'win-arm32'
+
+ with mock.patch('sys.version_info', (3, 9, 0, 'final', 0)):
+ assert get_host_platform() == stdlib_sysconfig.get_platform()
+
+ def test_get_platform(self):
+ with mock.patch('os.name', 'nt'):
+ with mock.patch.dict('os.environ', {'VSCMD_ARG_TGT_ARCH': 'x86'}):
+ assert get_platform() == 'win32'
+ with mock.patch.dict('os.environ', {'VSCMD_ARG_TGT_ARCH': 'x64'}):
+ assert get_platform() == 'win-amd64'
+ with mock.patch.dict('os.environ', {'VSCMD_ARG_TGT_ARCH': 'arm'}):
+ assert get_platform() == 'win-arm32'
+ with mock.patch.dict('os.environ', {'VSCMD_ARG_TGT_ARCH': 'arm64'}):
+ assert get_platform() == 'win-arm64'
+
+ def test_convert_path(self):
+ expected = os.sep.join(('', 'home', 'to', 'my', 'stuff'))
+ assert convert_path('/home/to/my/stuff') == expected
+ assert convert_path(pathlib.Path('/home/to/my/stuff')) == expected
+ assert convert_path('.') == os.curdir
+
+ def test_change_root(self):
+ # linux/mac
+ os.name = 'posix'
+
+ def _isabs(path):
+ return path[0] == '/'
+
+ os.path.isabs = _isabs
+
+ def _join(*path):
+ return '/'.join(path)
+
+ os.path.join = _join
+
+ assert change_root('/root', '/old/its/here') == '/root/old/its/here'
+ assert change_root('/root', 'its/here') == '/root/its/here'
+
+ # windows
+ os.name = 'nt'
+ os.sep = '\\'
+
+ def _isabs(path):
+ return path.startswith('c:\\')
+
+ os.path.isabs = _isabs
+
+ def _splitdrive(path):
+ if path.startswith('c:'):
+ return ('', path.replace('c:', ''))
+ return ('', path)
+
+ os.path.splitdrive = _splitdrive
+
+ def _join(*path):
+ return '\\'.join(path)
+
+ os.path.join = _join
+
+ assert (
+ change_root('c:\\root', 'c:\\old\\its\\here') == 'c:\\root\\old\\its\\here'
+ )
+ assert change_root('c:\\root', 'its\\here') == 'c:\\root\\its\\here'
+
+ # BugsBunny os (it's a great os)
+ os.name = 'BugsBunny'
+ with pytest.raises(DistutilsPlatformError):
+ change_root('c:\\root', 'its\\here')
+
+ # XXX platforms to be covered: mac
+
+ def test_check_environ(self):
+ util.check_environ.cache_clear()
+ os.environ.pop('HOME', None)
+
+ check_environ()
+
+ assert os.environ['PLAT'] == get_platform()
+
+ @pytest.mark.skipif("os.name != 'posix'")
+ def test_check_environ_getpwuid(self):
+ util.check_environ.cache_clear()
+ os.environ.pop('HOME', None)
+
+ import pwd
+
+ # only set pw_dir field, other fields are not used
+ result = pwd.struct_passwd((
+ None,
+ None,
+ None,
+ None,
+ None,
+ '/home/distutils',
+ None,
+ ))
+ with mock.patch.object(pwd, 'getpwuid', return_value=result):
+ check_environ()
+ assert os.environ['HOME'] == '/home/distutils'
+
+ util.check_environ.cache_clear()
+ os.environ.pop('HOME', None)
+
+ # bpo-10496: Catch pwd.getpwuid() error
+ with mock.patch.object(pwd, 'getpwuid', side_effect=KeyError):
+ check_environ()
+ assert 'HOME' not in os.environ
+
+ def test_split_quoted(self):
+ assert split_quoted('""one"" "two" \'three\' \\four') == [
+ 'one',
+ 'two',
+ 'three',
+ 'four',
+ ]
+
+ def test_strtobool(self):
+ yes = ('y', 'Y', 'yes', 'True', 't', 'true', 'True', 'On', 'on', '1')
+ no = ('n', 'no', 'f', 'false', 'off', '0', 'Off', 'No', 'N')
+
+ for y in yes:
+ assert strtobool(y)
+
+ for n in no:
+ assert not strtobool(n)
+
+ indent = 8 * ' '
+
+ @pytest.mark.parametrize(
+ "given,wanted",
+ [
+ # 0x0b, 0x0c, ..., etc are also considered a line break by Python
+ ("hello\x0b\nworld\n", f"hello\x0b{indent}\n{indent}world\n{indent}"),
+ ("hello\x1eworld", f"hello\x1e{indent}world"),
+ ("", ""),
+ (
+ "I am a\npoor\nlonesome\nheader\n",
+ f"I am a\n{indent}poor\n{indent}lonesome\n{indent}header\n{indent}",
+ ),
+ ],
+ )
+ def test_rfc822_escape(self, given, wanted):
+ """
+ We want to ensure a multi-line header parses correctly.
+
+ For interoperability, the escaped value should also "round-trip" over
+ `email.generator.Generator.flatten` and `email.message_from_*`
+ (see pypa/setuptools#4033).
+
+ The main issue is that internally `email.policy.EmailPolicy` uses
+ `splitlines` which will split on some control chars. If all the new lines
+ are not prefixed with spaces, the parser will interrupt reading
+ the current header and produce an incomplete value, while
+ incorrectly interpreting the rest of the headers as part of the payload.
+ """
+ res = rfc822_escape(given)
+
+ policy = email.policy.EmailPolicy(
+ utf8=True,
+ mangle_from_=False,
+ max_line_length=0,
+ )
+ with io.StringIO() as buffer:
+ raw = f"header: {res}\nother-header: 42\n\npayload\n"
+ orig = email.message_from_string(raw)
+ email.generator.Generator(buffer, policy=policy).flatten(orig)
+ buffer.seek(0)
+ regen = email.message_from_file(buffer)
+
+ for msg in (orig, regen):
+ assert msg.get_payload() == "payload\n"
+ assert msg["other-header"] == "42"
+ # Generator may replace control chars with `\n`
+ assert set(msg["header"].splitlines()) == set(res.splitlines())
+
+ assert res == wanted
+
+ def test_dont_write_bytecode(self):
+ # makes sure byte_compile raise a DistutilsError
+ # if sys.dont_write_bytecode is True
+ old_dont_write_bytecode = sys.dont_write_bytecode
+ sys.dont_write_bytecode = True
+ try:
+ with pytest.raises(DistutilsByteCompileError):
+ byte_compile([])
+ finally:
+ sys.dont_write_bytecode = old_dont_write_bytecode
+
+ def test_grok_environment_error(self):
+ # test obsolete function to ensure backward compat (#4931)
+ exc = OSError("Unable to find batch file")
+ msg = grok_environment_error(exc)
+ assert msg == "error: Unable to find batch file"
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_version.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_version.py
new file mode 100644
index 0000000000000000000000000000000000000000..b68f0977249aa23aafbf31cf74a0e4127f777d05
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_version.py
@@ -0,0 +1,80 @@
+"""Tests for distutils.version."""
+
+import distutils
+from distutils.version import LooseVersion, StrictVersion
+
+import pytest
+
+
+@pytest.fixture(autouse=True)
+def suppress_deprecation():
+ with distutils.version.suppress_known_deprecation():
+ yield
+
+
+class TestVersion:
+ def test_prerelease(self):
+ version = StrictVersion('1.2.3a1')
+ assert version.version == (1, 2, 3)
+ assert version.prerelease == ('a', 1)
+ assert str(version) == '1.2.3a1'
+
+ version = StrictVersion('1.2.0')
+ assert str(version) == '1.2'
+
+ def test_cmp_strict(self):
+ versions = (
+ ('1.5.1', '1.5.2b2', -1),
+ ('161', '3.10a', ValueError),
+ ('8.02', '8.02', 0),
+ ('3.4j', '1996.07.12', ValueError),
+ ('3.2.pl0', '3.1.1.6', ValueError),
+ ('2g6', '11g', ValueError),
+ ('0.9', '2.2', -1),
+ ('1.2.1', '1.2', 1),
+ ('1.1', '1.2.2', -1),
+ ('1.2', '1.1', 1),
+ ('1.2.1', '1.2.2', -1),
+ ('1.2.2', '1.2', 1),
+ ('1.2', '1.2.2', -1),
+ ('0.4.0', '0.4', 0),
+ ('1.13++', '5.5.kw', ValueError),
+ )
+
+ for v1, v2, wanted in versions:
+ try:
+ res = StrictVersion(v1)._cmp(StrictVersion(v2))
+ except ValueError:
+ if wanted is ValueError:
+ continue
+ else:
+ raise AssertionError(f"cmp({v1}, {v2}) shouldn't raise ValueError")
+ assert res == wanted, f'cmp({v1}, {v2}) should be {wanted}, got {res}'
+ res = StrictVersion(v1)._cmp(v2)
+ assert res == wanted, f'cmp({v1}, {v2}) should be {wanted}, got {res}'
+ res = StrictVersion(v1)._cmp(object())
+ assert res is NotImplemented, (
+ f'cmp({v1}, {v2}) should be NotImplemented, got {res}'
+ )
+
+ def test_cmp(self):
+ versions = (
+ ('1.5.1', '1.5.2b2', -1),
+ ('161', '3.10a', 1),
+ ('8.02', '8.02', 0),
+ ('3.4j', '1996.07.12', -1),
+ ('3.2.pl0', '3.1.1.6', 1),
+ ('2g6', '11g', -1),
+ ('0.960923', '2.2beta29', -1),
+ ('1.13++', '5.5.kw', -1),
+ )
+
+ for v1, v2, wanted in versions:
+ res = LooseVersion(v1)._cmp(LooseVersion(v2))
+ assert res == wanted, f'cmp({v1}, {v2}) should be {wanted}, got {res}'
+ res = LooseVersion(v1)._cmp(v2)
+ assert res == wanted, f'cmp({v1}, {v2}) should be {wanted}, got {res}'
+ res = LooseVersion(v1)._cmp(object())
+ assert res is NotImplemented, (
+ f'cmp({v1}, {v2}) should be NotImplemented, got {res}'
+ )
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_versionpredicate.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/test_versionpredicate.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/unix_compat.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/unix_compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..a5d9ee45ccc639794d29ba0a5fd24f781ee5ecf5
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/tests/unix_compat.py
@@ -0,0 +1,17 @@
+import sys
+
+try:
+ import grp
+ import pwd
+except ImportError:
+ grp = pwd = None
+
+import pytest
+
+UNIX_ID_SUPPORT = grp and pwd
+UID_0_SUPPORT = UNIX_ID_SUPPORT and sys.platform != "cygwin"
+
+require_unix_id = pytest.mark.skipif(
+ not UNIX_ID_SUPPORT, reason="Requires grp and pwd support"
+)
+require_uid_0 = pytest.mark.skipif(not UID_0_SUPPORT, reason="Requires UID 0 support")
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/text_file.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/text_file.py
new file mode 100644
index 0000000000000000000000000000000000000000..89d9048d5902950516c3541ad212bff7b6cb2045
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/text_file.py
@@ -0,0 +1,286 @@
+"""text_file
+
+provides the TextFile class, which gives an interface to text files
+that (optionally) takes care of stripping comments, ignoring blank
+lines, and joining lines with backslashes."""
+
+import sys
+
+
+class TextFile:
+ """Provides a file-like object that takes care of all the things you
+ commonly want to do when processing a text file that has some
+ line-by-line syntax: strip comments (as long as "#" is your
+ comment character), skip blank lines, join adjacent lines by
+ escaping the newline (ie. backslash at end of line), strip
+ leading and/or trailing whitespace. All of these are optional
+ and independently controllable.
+
+ Provides a 'warn()' method so you can generate warning messages that
+ report physical line number, even if the logical line in question
+ spans multiple physical lines. Also provides 'unreadline()' for
+ implementing line-at-a-time lookahead.
+
+ Constructor is called as:
+
+ TextFile (filename=None, file=None, **options)
+
+ It bombs (RuntimeError) if both 'filename' and 'file' are None;
+ 'filename' should be a string, and 'file' a file object (or
+ something that provides 'readline()' and 'close()' methods). It is
+ recommended that you supply at least 'filename', so that TextFile
+ can include it in warning messages. If 'file' is not supplied,
+ TextFile creates its own using 'io.open()'.
+
+ The options are all boolean, and affect the value returned by
+ 'readline()':
+ strip_comments [default: true]
+ strip from "#" to end-of-line, as well as any whitespace
+ leading up to the "#" -- unless it is escaped by a backslash
+ lstrip_ws [default: false]
+ strip leading whitespace from each line before returning it
+ rstrip_ws [default: true]
+ strip trailing whitespace (including line terminator!) from
+ each line before returning it
+ skip_blanks [default: true}
+ skip lines that are empty *after* stripping comments and
+ whitespace. (If both lstrip_ws and rstrip_ws are false,
+ then some lines may consist of solely whitespace: these will
+ *not* be skipped, even if 'skip_blanks' is true.)
+ join_lines [default: false]
+ if a backslash is the last non-newline character on a line
+ after stripping comments and whitespace, join the following line
+ to it to form one "logical line"; if N consecutive lines end
+ with a backslash, then N+1 physical lines will be joined to
+ form one logical line.
+ collapse_join [default: false]
+ strip leading whitespace from lines that are joined to their
+ predecessor; only matters if (join_lines and not lstrip_ws)
+ errors [default: 'strict']
+ error handler used to decode the file content
+
+ Note that since 'rstrip_ws' can strip the trailing newline, the
+ semantics of 'readline()' must differ from those of the builtin file
+ object's 'readline()' method! In particular, 'readline()' returns
+ None for end-of-file: an empty string might just be a blank line (or
+ an all-whitespace line), if 'rstrip_ws' is true but 'skip_blanks' is
+ not."""
+
+ default_options = {
+ 'strip_comments': 1,
+ 'skip_blanks': 1,
+ 'lstrip_ws': 0,
+ 'rstrip_ws': 1,
+ 'join_lines': 0,
+ 'collapse_join': 0,
+ 'errors': 'strict',
+ }
+
+ def __init__(self, filename=None, file=None, **options):
+ """Construct a new TextFile object. At least one of 'filename'
+ (a string) and 'file' (a file-like object) must be supplied.
+ They keyword argument options are described above and affect
+ the values returned by 'readline()'."""
+ if filename is None and file is None:
+ raise RuntimeError(
+ "you must supply either or both of 'filename' and 'file'"
+ )
+
+ # set values for all options -- either from client option hash
+ # or fallback to default_options
+ for opt in self.default_options.keys():
+ if opt in options:
+ setattr(self, opt, options[opt])
+ else:
+ setattr(self, opt, self.default_options[opt])
+
+ # sanity check client option hash
+ for opt in options.keys():
+ if opt not in self.default_options:
+ raise KeyError(f"invalid TextFile option '{opt}'")
+
+ if file is None:
+ self.open(filename)
+ else:
+ self.filename = filename
+ self.file = file
+ self.current_line = 0 # assuming that file is at BOF!
+
+ # 'linebuf' is a stack of lines that will be emptied before we
+ # actually read from the file; it's only populated by an
+ # 'unreadline()' operation
+ self.linebuf = []
+
+ def open(self, filename):
+ """Open a new file named 'filename'. This overrides both the
+ 'filename' and 'file' arguments to the constructor."""
+ self.filename = filename
+ self.file = open(self.filename, errors=self.errors, encoding='utf-8')
+ self.current_line = 0
+
+ def close(self):
+ """Close the current file and forget everything we know about it
+ (filename, current line number)."""
+ file = self.file
+ self.file = None
+ self.filename = None
+ self.current_line = None
+ file.close()
+
+ def gen_error(self, msg, line=None):
+ outmsg = []
+ if line is None:
+ line = self.current_line
+ outmsg.append(self.filename + ", ")
+ if isinstance(line, (list, tuple)):
+ outmsg.append("lines {}-{}: ".format(*line))
+ else:
+ outmsg.append(f"line {int(line)}: ")
+ outmsg.append(str(msg))
+ return "".join(outmsg)
+
+ def error(self, msg, line=None):
+ raise ValueError("error: " + self.gen_error(msg, line))
+
+ def warn(self, msg, line=None):
+ """Print (to stderr) a warning message tied to the current logical
+ line in the current file. If the current logical line in the
+ file spans multiple physical lines, the warning refers to the
+ whole range, eg. "lines 3-5". If 'line' supplied, it overrides
+ the current line number; it may be a list or tuple to indicate a
+ range of physical lines, or an integer for a single physical
+ line."""
+ sys.stderr.write("warning: " + self.gen_error(msg, line) + "\n")
+
+ def readline(self): # noqa: C901
+ """Read and return a single logical line from the current file (or
+ from an internal buffer if lines have previously been "unread"
+ with 'unreadline()'). If the 'join_lines' option is true, this
+ may involve reading multiple physical lines concatenated into a
+ single string. Updates the current line number, so calling
+ 'warn()' after 'readline()' emits a warning about the physical
+ line(s) just read. Returns None on end-of-file, since the empty
+ string can occur if 'rstrip_ws' is true but 'strip_blanks' is
+ not."""
+ # If any "unread" lines waiting in 'linebuf', return the top
+ # one. (We don't actually buffer read-ahead data -- lines only
+ # get put in 'linebuf' if the client explicitly does an
+ # 'unreadline()'.
+ if self.linebuf:
+ line = self.linebuf[-1]
+ del self.linebuf[-1]
+ return line
+
+ buildup_line = ''
+
+ while True:
+ # read the line, make it None if EOF
+ line = self.file.readline()
+ if line == '':
+ line = None
+
+ if self.strip_comments and line:
+ # Look for the first "#" in the line. If none, never
+ # mind. If we find one and it's the first character, or
+ # is not preceded by "\", then it starts a comment --
+ # strip the comment, strip whitespace before it, and
+ # carry on. Otherwise, it's just an escaped "#", so
+ # unescape it (and any other escaped "#"'s that might be
+ # lurking in there) and otherwise leave the line alone.
+
+ pos = line.find("#")
+ if pos == -1: # no "#" -- no comments
+ pass
+
+ # It's definitely a comment -- either "#" is the first
+ # character, or it's elsewhere and unescaped.
+ elif pos == 0 or line[pos - 1] != "\\":
+ # Have to preserve the trailing newline, because it's
+ # the job of a later step (rstrip_ws) to remove it --
+ # and if rstrip_ws is false, we'd better preserve it!
+ # (NB. this means that if the final line is all comment
+ # and has no trailing newline, we will think that it's
+ # EOF; I think that's OK.)
+ eol = (line[-1] == '\n') and '\n' or ''
+ line = line[0:pos] + eol
+
+ # If all that's left is whitespace, then skip line
+ # *now*, before we try to join it to 'buildup_line' --
+ # that way constructs like
+ # hello \\
+ # # comment that should be ignored
+ # there
+ # result in "hello there".
+ if line.strip() == "":
+ continue
+ else: # it's an escaped "#"
+ line = line.replace("\\#", "#")
+
+ # did previous line end with a backslash? then accumulate
+ if self.join_lines and buildup_line:
+ # oops: end of file
+ if line is None:
+ self.warn("continuation line immediately precedes end-of-file")
+ return buildup_line
+
+ if self.collapse_join:
+ line = line.lstrip()
+ line = buildup_line + line
+
+ # careful: pay attention to line number when incrementing it
+ if isinstance(self.current_line, list):
+ self.current_line[1] = self.current_line[1] + 1
+ else:
+ self.current_line = [self.current_line, self.current_line + 1]
+ # just an ordinary line, read it as usual
+ else:
+ if line is None: # eof
+ return None
+
+ # still have to be careful about incrementing the line number!
+ if isinstance(self.current_line, list):
+ self.current_line = self.current_line[1] + 1
+ else:
+ self.current_line = self.current_line + 1
+
+ # strip whitespace however the client wants (leading and
+ # trailing, or one or the other, or neither)
+ if self.lstrip_ws and self.rstrip_ws:
+ line = line.strip()
+ elif self.lstrip_ws:
+ line = line.lstrip()
+ elif self.rstrip_ws:
+ line = line.rstrip()
+
+ # blank line (whether we rstrip'ed or not)? skip to next line
+ # if appropriate
+ if line in ('', '\n') and self.skip_blanks:
+ continue
+
+ if self.join_lines:
+ if line[-1] == '\\':
+ buildup_line = line[:-1]
+ continue
+
+ if line[-2:] == '\\\n':
+ buildup_line = line[0:-2] + '\n'
+ continue
+
+ # well, I guess there's some actual content there: return it
+ return line
+
+ def readlines(self):
+ """Read and return the list of all logical lines remaining in the
+ current file."""
+ lines = []
+ while True:
+ line = self.readline()
+ if line is None:
+ return lines
+ lines.append(line)
+
+ def unreadline(self, line):
+ """Push 'line' (a string) onto an internal buffer that will be
+ checked by future 'readline()' calls. Handy for implementing
+ a parser with line-at-a-time lookahead."""
+ self.linebuf.append(line)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..20b8ce6b9bba21bd709b77249bdcae5b4119e9ca
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py
@@ -0,0 +1,9 @@
+import importlib
+
+from .compilers.C import unix
+
+UnixCCompiler = unix.Compiler
+
+# ensure import of unixccompiler implies ccompiler imported
+# (pypa/setuptools#4871)
+importlib.import_module('distutils.ccompiler')
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/util.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/util.py
new file mode 100644
index 0000000000000000000000000000000000000000..6dbe049f4274f7177295491d7f433e8ca303df48
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/util.py
@@ -0,0 +1,518 @@
+"""distutils.util
+
+Miscellaneous utility functions -- anything that doesn't fit into
+one of the other *util.py modules.
+"""
+
+from __future__ import annotations
+
+import functools
+import importlib.util
+import os
+import pathlib
+import re
+import string
+import subprocess
+import sys
+import sysconfig
+import tempfile
+from collections.abc import Callable, Iterable, Mapping
+from typing import TYPE_CHECKING, AnyStr
+
+from jaraco.functools import pass_none
+
+from ._log import log
+from ._modified import newer
+from .errors import DistutilsByteCompileError, DistutilsPlatformError
+from .spawn import spawn
+
+if TYPE_CHECKING:
+ from typing_extensions import TypeVarTuple, Unpack
+
+ _Ts = TypeVarTuple("_Ts")
+
+
+def get_host_platform() -> str:
+ """
+ Return a string that identifies the current platform. Use this
+ function to distinguish platform-specific build directories and
+ platform-specific built distributions.
+ """
+
+ # This function initially exposed platforms as defined in Python 3.9
+ # even with older Python versions when distutils was split out.
+ # Now it delegates to stdlib sysconfig.
+
+ return sysconfig.get_platform()
+
+
+def get_platform() -> str:
+ if os.name == 'nt':
+ TARGET_TO_PLAT = {
+ 'x86': 'win32',
+ 'x64': 'win-amd64',
+ 'arm': 'win-arm32',
+ 'arm64': 'win-arm64',
+ }
+ target = os.environ.get('VSCMD_ARG_TGT_ARCH')
+ return TARGET_TO_PLAT.get(target) or get_host_platform()
+ return get_host_platform()
+
+
+if sys.platform == 'darwin':
+ _syscfg_macosx_ver = None # cache the version pulled from sysconfig
+MACOSX_VERSION_VAR = 'MACOSX_DEPLOYMENT_TARGET'
+
+
+def _clear_cached_macosx_ver():
+ """For testing only. Do not call."""
+ global _syscfg_macosx_ver
+ _syscfg_macosx_ver = None
+
+
+def get_macosx_target_ver_from_syscfg():
+ """Get the version of macOS latched in the Python interpreter configuration.
+ Returns the version as a string or None if can't obtain one. Cached."""
+ global _syscfg_macosx_ver
+ if _syscfg_macosx_ver is None:
+ from distutils import sysconfig
+
+ ver = sysconfig.get_config_var(MACOSX_VERSION_VAR) or ''
+ if ver:
+ _syscfg_macosx_ver = ver
+ return _syscfg_macosx_ver
+
+
+def get_macosx_target_ver():
+ """Return the version of macOS for which we are building.
+
+ The target version defaults to the version in sysconfig latched at time
+ the Python interpreter was built, unless overridden by an environment
+ variable. If neither source has a value, then None is returned"""
+
+ syscfg_ver = get_macosx_target_ver_from_syscfg()
+ env_ver = os.environ.get(MACOSX_VERSION_VAR)
+
+ if env_ver:
+ # Validate overridden version against sysconfig version, if have both.
+ # Ensure that the deployment target of the build process is not less
+ # than 10.3 if the interpreter was built for 10.3 or later. This
+ # ensures extension modules are built with correct compatibility
+ # values, specifically LDSHARED which can use
+ # '-undefined dynamic_lookup' which only works on >= 10.3.
+ if (
+ syscfg_ver
+ and split_version(syscfg_ver) >= [10, 3]
+ and split_version(env_ver) < [10, 3]
+ ):
+ my_msg = (
+ '$' + MACOSX_VERSION_VAR + ' mismatch: '
+ f'now "{env_ver}" but "{syscfg_ver}" during configure; '
+ 'must use 10.3 or later'
+ )
+ raise DistutilsPlatformError(my_msg)
+ return env_ver
+ return syscfg_ver
+
+
+def split_version(s: str) -> list[int]:
+ """Convert a dot-separated string into a list of numbers for comparisons"""
+ return [int(n) for n in s.split('.')]
+
+
+@pass_none
+def convert_path(pathname: str | os.PathLike[str]) -> str:
+ r"""
+ Allow for pathlib.Path inputs, coax to a native path string.
+
+ If None is passed, will just pass it through as
+ Setuptools relies on this behavior.
+
+ >>> convert_path(None) is None
+ True
+
+ Removes empty paths.
+
+ >>> convert_path('foo/./bar').replace('\\', '/')
+ 'foo/bar'
+ """
+ return os.fspath(pathlib.PurePath(pathname))
+
+
+def change_root(
+ new_root: AnyStr | os.PathLike[AnyStr], pathname: AnyStr | os.PathLike[AnyStr]
+) -> AnyStr:
+ """Return 'pathname' with 'new_root' prepended. If 'pathname' is
+ relative, this is equivalent to "os.path.join(new_root,pathname)".
+ Otherwise, it requires making 'pathname' relative and then joining the
+ two, which is tricky on DOS/Windows and Mac OS.
+ """
+ if os.name == 'posix':
+ if not os.path.isabs(pathname):
+ return os.path.join(new_root, pathname)
+ else:
+ return os.path.join(new_root, pathname[1:])
+
+ elif os.name == 'nt':
+ (drive, path) = os.path.splitdrive(pathname)
+ if path[0] == os.sep:
+ path = path[1:]
+ return os.path.join(new_root, path)
+
+ raise DistutilsPlatformError(f"nothing known about platform '{os.name}'")
+
+
+@functools.lru_cache
+def check_environ() -> None:
+ """Ensure that 'os.environ' has all the environment variables we
+ guarantee that users can use in config files, command-line options,
+ etc. Currently this includes:
+ HOME - user's home directory (Unix only)
+ PLAT - description of the current platform, including hardware
+ and OS (see 'get_platform()')
+ """
+ if os.name == 'posix' and 'HOME' not in os.environ:
+ try:
+ import pwd
+
+ os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
+ except (ImportError, KeyError):
+ # bpo-10496: if the current user identifier doesn't exist in the
+ # password database, do nothing
+ pass
+
+ if 'PLAT' not in os.environ:
+ os.environ['PLAT'] = get_platform()
+
+
+def subst_vars(s, local_vars: Mapping[str, object]) -> str:
+ """
+ Perform variable substitution on 'string'.
+ Variables are indicated by format-style braces ("{var}").
+ Variable is substituted by the value found in the 'local_vars'
+ dictionary or in 'os.environ' if it's not in 'local_vars'.
+ 'os.environ' is first checked/augmented to guarantee that it contains
+ certain values: see 'check_environ()'. Raise ValueError for any
+ variables not found in either 'local_vars' or 'os.environ'.
+ """
+ check_environ()
+ lookup = dict(os.environ)
+ lookup.update((name, str(value)) for name, value in local_vars.items())
+ try:
+ return _subst_compat(s).format_map(lookup)
+ except KeyError as var:
+ raise ValueError(f"invalid variable {var}")
+
+
+def _subst_compat(s):
+ """
+ Replace shell/Perl-style variable substitution with
+ format-style. For compatibility.
+ """
+
+ def _subst(match):
+ return f'{{{match.group(1)}}}'
+
+ repl = re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s)
+ if repl != s:
+ import warnings
+
+ warnings.warn(
+ "shell/Perl-style substitutions are deprecated",
+ DeprecationWarning,
+ )
+ return repl
+
+
+def grok_environment_error(exc: object, prefix: str = "error: ") -> str:
+ # Function kept for backward compatibility.
+ # Used to try clever things with EnvironmentErrors,
+ # but nowadays str(exception) produces good messages.
+ return prefix + str(exc)
+
+
+# Needed by 'split_quoted()'
+_wordchars_re = _squote_re = _dquote_re = None
+
+
+def _init_regex():
+ global _wordchars_re, _squote_re, _dquote_re
+ _wordchars_re = re.compile(rf'[^\\\'\"{string.whitespace} ]*')
+ _squote_re = re.compile(r"'(?:[^'\\]|\\.)*'")
+ _dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"')
+
+
+def split_quoted(s: str) -> list[str]:
+ """Split a string up according to Unix shell-like rules for quotes and
+ backslashes. In short: words are delimited by spaces, as long as those
+ spaces are not escaped by a backslash, or inside a quoted string.
+ Single and double quotes are equivalent, and the quote characters can
+ be backslash-escaped. The backslash is stripped from any two-character
+ escape sequence, leaving only the escaped character. The quote
+ characters are stripped from any quoted string. Returns a list of
+ words.
+ """
+
+ # This is a nice algorithm for splitting up a single string, since it
+ # doesn't require character-by-character examination. It was a little
+ # bit of a brain-bender to get it working right, though...
+ if _wordchars_re is None:
+ _init_regex()
+
+ s = s.strip()
+ words = []
+ pos = 0
+
+ while s:
+ m = _wordchars_re.match(s, pos)
+ end = m.end()
+ if end == len(s):
+ words.append(s[:end])
+ break
+
+ if s[end] in string.whitespace:
+ # unescaped, unquoted whitespace: now
+ # we definitely have a word delimiter
+ words.append(s[:end])
+ s = s[end:].lstrip()
+ pos = 0
+
+ elif s[end] == '\\':
+ # preserve whatever is being escaped;
+ # will become part of the current word
+ s = s[:end] + s[end + 1 :]
+ pos = end + 1
+
+ else:
+ if s[end] == "'": # slurp singly-quoted string
+ m = _squote_re.match(s, end)
+ elif s[end] == '"': # slurp doubly-quoted string
+ m = _dquote_re.match(s, end)
+ else:
+ raise RuntimeError(f"this can't happen (bad char '{s[end]}')")
+
+ if m is None:
+ raise ValueError(f"bad string (mismatched {s[end]} quotes?)")
+
+ (beg, end) = m.span()
+ s = s[:beg] + s[beg + 1 : end - 1] + s[end:]
+ pos = m.end() - 2
+
+ if pos >= len(s):
+ words.append(s)
+ break
+
+ return words
+
+
+# split_quoted ()
+
+
+def execute(
+ func: Callable[[Unpack[_Ts]], object],
+ args: tuple[Unpack[_Ts]],
+ msg: object = None,
+ verbose: bool = False,
+ dry_run: bool = False,
+) -> None:
+ """
+ Perform some action that affects the outside world (e.g. by
+ writing to the filesystem). Such actions are special because they
+ are disabled by the 'dry_run' flag. This method handles that
+ complication; simply supply the
+ function to call and an argument tuple for it (to embody the
+ "external action" being performed) and an optional message to
+ emit.
+ """
+ if msg is None:
+ msg = f"{func.__name__}{args!r}"
+ if msg[-2:] == ',)': # correct for singleton tuple
+ msg = msg[0:-2] + ')'
+
+ log.info(msg)
+ if not dry_run:
+ func(*args)
+
+
+def strtobool(val: str) -> bool:
+ """Convert a string representation of truth to true (1) or false (0).
+
+ True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values
+ are 'n', 'no', 'f', 'false', 'off', and '0'. Raises ValueError if
+ 'val' is anything else.
+ """
+ val = val.lower()
+ if val in ('y', 'yes', 't', 'true', 'on', '1'):
+ return True
+ elif val in ('n', 'no', 'f', 'false', 'off', '0'):
+ return False
+ else:
+ raise ValueError(f"invalid truth value {val!r}")
+
+
+def byte_compile( # noqa: C901
+ py_files: Iterable[str],
+ optimize: int = 0,
+ force: bool = False,
+ prefix: str | None = None,
+ base_dir: str | None = None,
+ verbose: bool = True,
+ dry_run: bool = False,
+ direct: bool | None = None,
+) -> None:
+ """Byte-compile a collection of Python source files to .pyc
+ files in a __pycache__ subdirectory. 'py_files' is a list
+ of files to compile; any files that don't end in ".py" are silently
+ skipped. 'optimize' must be one of the following:
+ 0 - don't optimize
+ 1 - normal optimization (like "python -O")
+ 2 - extra optimization (like "python -OO")
+ If 'force' is true, all files are recompiled regardless of
+ timestamps.
+
+ The source filename encoded in each bytecode file defaults to the
+ filenames listed in 'py_files'; you can modify these with 'prefix' and
+ 'basedir'. 'prefix' is a string that will be stripped off of each
+ source filename, and 'base_dir' is a directory name that will be
+ prepended (after 'prefix' is stripped). You can supply either or both
+ (or neither) of 'prefix' and 'base_dir', as you wish.
+
+ If 'dry_run' is true, doesn't actually do anything that would
+ affect the filesystem.
+
+ Byte-compilation is either done directly in this interpreter process
+ with the standard py_compile module, or indirectly by writing a
+ temporary script and executing it. Normally, you should let
+ 'byte_compile()' figure out to use direct compilation or not (see
+ the source for details). The 'direct' flag is used by the script
+ generated in indirect mode; unless you know what you're doing, leave
+ it set to None.
+ """
+
+ # nothing is done if sys.dont_write_bytecode is True
+ if sys.dont_write_bytecode:
+ raise DistutilsByteCompileError('byte-compiling is disabled.')
+
+ # First, if the caller didn't force us into direct or indirect mode,
+ # figure out which mode we should be in. We take a conservative
+ # approach: choose direct mode *only* if the current interpreter is
+ # in debug mode and optimize is 0. If we're not in debug mode (-O
+ # or -OO), we don't know which level of optimization this
+ # interpreter is running with, so we can't do direct
+ # byte-compilation and be certain that it's the right thing. Thus,
+ # always compile indirectly if the current interpreter is in either
+ # optimize mode, or if either optimization level was requested by
+ # the caller.
+ if direct is None:
+ direct = __debug__ and optimize == 0
+
+ # "Indirect" byte-compilation: write a temporary script and then
+ # run it with the appropriate flags.
+ if not direct:
+ (script_fd, script_name) = tempfile.mkstemp(".py")
+ log.info("writing byte-compilation script '%s'", script_name)
+ if not dry_run:
+ script = os.fdopen(script_fd, "w", encoding='utf-8')
+
+ with script:
+ script.write(
+ """\
+from distutils.util import byte_compile
+files = [
+"""
+ )
+
+ # XXX would be nice to write absolute filenames, just for
+ # safety's sake (script should be more robust in the face of
+ # chdir'ing before running it). But this requires abspath'ing
+ # 'prefix' as well, and that breaks the hack in build_lib's
+ # 'byte_compile()' method that carefully tacks on a trailing
+ # slash (os.sep really) to make sure the prefix here is "just
+ # right". This whole prefix business is rather delicate -- the
+ # problem is that it's really a directory, but I'm treating it
+ # as a dumb string, so trailing slashes and so forth matter.
+
+ script.write(",\n".join(map(repr, py_files)) + "]\n")
+ script.write(
+ f"""
+byte_compile(files, optimize={optimize!r}, force={force!r},
+ prefix={prefix!r}, base_dir={base_dir!r},
+ verbose={verbose!r}, dry_run=False,
+ direct=True)
+"""
+ )
+
+ cmd = [sys.executable]
+ cmd.extend(subprocess._optim_args_from_interpreter_flags())
+ cmd.append(script_name)
+ spawn(cmd, dry_run=dry_run)
+ execute(os.remove, (script_name,), f"removing {script_name}", dry_run=dry_run)
+
+ # "Direct" byte-compilation: use the py_compile module to compile
+ # right here, right now. Note that the script generated in indirect
+ # mode simply calls 'byte_compile()' in direct mode, a weird sort of
+ # cross-process recursion. Hey, it works!
+ else:
+ from py_compile import compile
+
+ for file in py_files:
+ if file[-3:] != ".py":
+ # This lets us be lazy and not filter filenames in
+ # the "install_lib" command.
+ continue
+
+ # Terminology from the py_compile module:
+ # cfile - byte-compiled file
+ # dfile - purported source filename (same as 'file' by default)
+ if optimize >= 0:
+ opt = '' if optimize == 0 else optimize
+ cfile = importlib.util.cache_from_source(file, optimization=opt)
+ else:
+ cfile = importlib.util.cache_from_source(file)
+ dfile = file
+ if prefix:
+ if file[: len(prefix)] != prefix:
+ raise ValueError(
+ f"invalid prefix: filename {file!r} doesn't start with {prefix!r}"
+ )
+ dfile = dfile[len(prefix) :]
+ if base_dir:
+ dfile = os.path.join(base_dir, dfile)
+
+ cfile_base = os.path.basename(cfile)
+ if direct:
+ if force or newer(file, cfile):
+ log.info("byte-compiling %s to %s", file, cfile_base)
+ if not dry_run:
+ compile(file, cfile, dfile)
+ else:
+ log.debug("skipping byte-compilation of %s to %s", file, cfile_base)
+
+
+def rfc822_escape(header: str) -> str:
+ """Return a version of the string escaped for inclusion in an
+ RFC-822 header, by ensuring there are 8 spaces space after each newline.
+ """
+ indent = 8 * " "
+ lines = header.splitlines(keepends=True)
+
+ # Emulate the behaviour of `str.split`
+ # (the terminal line break in `splitlines` does not result in an extra line):
+ ends_in_newline = lines and lines[-1].splitlines()[0] != lines[-1]
+ suffix = indent if ends_in_newline else ""
+
+ return indent.join(lines) + suffix
+
+
+def is_mingw() -> bool:
+ """Returns True if the current platform is mingw.
+
+ Python compiled with Mingw-w64 has sys.platform == 'win32' and
+ get_platform() starts with 'mingw'.
+ """
+ return sys.platform == 'win32' and get_platform().startswith('mingw')
+
+
+def is_freethreaded():
+ """Return True if the Python interpreter is built with free threading support."""
+ return bool(sysconfig.get_config_var('Py_GIL_DISABLED'))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/version.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/version.py
new file mode 100644
index 0000000000000000000000000000000000000000..2223ee9c8cab2495034a57d4585625feb81a8330
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/version.py
@@ -0,0 +1,348 @@
+#
+# distutils/version.py
+#
+# Implements multiple version numbering conventions for the
+# Python Module Distribution Utilities.
+#
+# $Id$
+#
+
+"""Provides classes to represent module version numbers (one class for
+each style of version numbering). There are currently two such classes
+implemented: StrictVersion and LooseVersion.
+
+Every version number class implements the following interface:
+ * the 'parse' method takes a string and parses it to some internal
+ representation; if the string is an invalid version number,
+ 'parse' raises a ValueError exception
+ * the class constructor takes an optional string argument which,
+ if supplied, is passed to 'parse'
+ * __str__ reconstructs the string that was passed to 'parse' (or
+ an equivalent string -- ie. one that will generate an equivalent
+ version number instance)
+ * __repr__ generates Python code to recreate the version number instance
+ * _cmp compares the current instance with either another instance
+ of the same class or a string (which will be parsed to an instance
+ of the same class, thus must follow the same rules)
+"""
+
+import contextlib
+import re
+import warnings
+
+
+@contextlib.contextmanager
+def suppress_known_deprecation():
+ with warnings.catch_warnings(record=True) as ctx:
+ warnings.filterwarnings(
+ action='default',
+ category=DeprecationWarning,
+ message="distutils Version classes are deprecated.",
+ )
+ yield ctx
+
+
+class Version:
+ """Abstract base class for version numbering classes. Just provides
+ constructor (__init__) and reproducer (__repr__), because those
+ seem to be the same for all version numbering classes; and route
+ rich comparisons to _cmp.
+ """
+
+ def __init__(self, vstring=None):
+ if vstring:
+ self.parse(vstring)
+ warnings.warn(
+ "distutils Version classes are deprecated. Use packaging.version instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+
+ def __repr__(self):
+ return f"{self.__class__.__name__} ('{self}')"
+
+ def __eq__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c == 0
+
+ def __lt__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c < 0
+
+ def __le__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c <= 0
+
+ def __gt__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c > 0
+
+ def __ge__(self, other):
+ c = self._cmp(other)
+ if c is NotImplemented:
+ return c
+ return c >= 0
+
+
+# Interface for version-number classes -- must be implemented
+# by the following classes (the concrete ones -- Version should
+# be treated as an abstract class).
+# __init__ (string) - create and take same action as 'parse'
+# (string parameter is optional)
+# parse (string) - convert a string representation to whatever
+# internal representation is appropriate for
+# this style of version numbering
+# __str__ (self) - convert back to a string; should be very similar
+# (if not identical to) the string supplied to parse
+# __repr__ (self) - generate Python code to recreate
+# the instance
+# _cmp (self, other) - compare two version numbers ('other' may
+# be an unparsed version string, or another
+# instance of your version class)
+
+
+class StrictVersion(Version):
+ """Version numbering for anal retentives and software idealists.
+ Implements the standard interface for version number classes as
+ described above. A version number consists of two or three
+ dot-separated numeric components, with an optional "pre-release" tag
+ on the end. The pre-release tag consists of the letter 'a' or 'b'
+ followed by a number. If the numeric components of two version
+ numbers are equal, then one with a pre-release tag will always
+ be deemed earlier (lesser) than one without.
+
+ The following are valid version numbers (shown in the order that
+ would be obtained by sorting according to the supplied cmp function):
+
+ 0.4 0.4.0 (these two are equivalent)
+ 0.4.1
+ 0.5a1
+ 0.5b3
+ 0.5
+ 0.9.6
+ 1.0
+ 1.0.4a3
+ 1.0.4b1
+ 1.0.4
+
+ The following are examples of invalid version numbers:
+
+ 1
+ 2.7.2.2
+ 1.3.a4
+ 1.3pl1
+ 1.3c4
+
+ The rationale for this version numbering system will be explained
+ in the distutils documentation.
+ """
+
+ version_re = re.compile(
+ r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', re.VERBOSE | re.ASCII
+ )
+
+ def parse(self, vstring):
+ match = self.version_re.match(vstring)
+ if not match:
+ raise ValueError(f"invalid version number '{vstring}'")
+
+ (major, minor, patch, prerelease, prerelease_num) = match.group(1, 2, 4, 5, 6)
+
+ if patch:
+ self.version = tuple(map(int, [major, minor, patch]))
+ else:
+ self.version = tuple(map(int, [major, minor])) + (0,)
+
+ if prerelease:
+ self.prerelease = (prerelease[0], int(prerelease_num))
+ else:
+ self.prerelease = None
+
+ def __str__(self):
+ if self.version[2] == 0:
+ vstring = '.'.join(map(str, self.version[0:2]))
+ else:
+ vstring = '.'.join(map(str, self.version))
+
+ if self.prerelease:
+ vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
+
+ return vstring
+
+ def _cmp(self, other):
+ if isinstance(other, str):
+ with suppress_known_deprecation():
+ other = StrictVersion(other)
+ elif not isinstance(other, StrictVersion):
+ return NotImplemented
+
+ if self.version == other.version:
+ # versions match; pre-release drives the comparison
+ return self._cmp_prerelease(other)
+
+ return -1 if self.version < other.version else 1
+
+ def _cmp_prerelease(self, other):
+ """
+ case 1: self has prerelease, other doesn't; other is greater
+ case 2: self doesn't have prerelease, other does: self is greater
+ case 3: both or neither have prerelease: compare them!
+ """
+ if self.prerelease and not other.prerelease:
+ return -1
+ elif not self.prerelease and other.prerelease:
+ return 1
+
+ if self.prerelease == other.prerelease:
+ return 0
+ elif self.prerelease < other.prerelease:
+ return -1
+ else:
+ return 1
+
+
+# end class StrictVersion
+
+
+# The rules according to Greg Stein:
+# 1) a version number has 1 or more numbers separated by a period or by
+# sequences of letters. If only periods, then these are compared
+# left-to-right to determine an ordering.
+# 2) sequences of letters are part of the tuple for comparison and are
+# compared lexicographically
+# 3) recognize the numeric components may have leading zeroes
+#
+# The LooseVersion class below implements these rules: a version number
+# string is split up into a tuple of integer and string components, and
+# comparison is a simple tuple comparison. This means that version
+# numbers behave in a predictable and obvious way, but a way that might
+# not necessarily be how people *want* version numbers to behave. There
+# wouldn't be a problem if people could stick to purely numeric version
+# numbers: just split on period and compare the numbers as tuples.
+# However, people insist on putting letters into their version numbers;
+# the most common purpose seems to be:
+# - indicating a "pre-release" version
+# ('alpha', 'beta', 'a', 'b', 'pre', 'p')
+# - indicating a post-release patch ('p', 'pl', 'patch')
+# but of course this can't cover all version number schemes, and there's
+# no way to know what a programmer means without asking him.
+#
+# The problem is what to do with letters (and other non-numeric
+# characters) in a version number. The current implementation does the
+# obvious and predictable thing: keep them as strings and compare
+# lexically within a tuple comparison. This has the desired effect if
+# an appended letter sequence implies something "post-release":
+# eg. "0.99" < "0.99pl14" < "1.0", and "5.001" < "5.001m" < "5.002".
+#
+# However, if letters in a version number imply a pre-release version,
+# the "obvious" thing isn't correct. Eg. you would expect that
+# "1.5.1" < "1.5.2a2" < "1.5.2", but under the tuple/lexical comparison
+# implemented here, this just isn't so.
+#
+# Two possible solutions come to mind. The first is to tie the
+# comparison algorithm to a particular set of semantic rules, as has
+# been done in the StrictVersion class above. This works great as long
+# as everyone can go along with bondage and discipline. Hopefully a
+# (large) subset of Python module programmers will agree that the
+# particular flavour of bondage and discipline provided by StrictVersion
+# provides enough benefit to be worth using, and will submit their
+# version numbering scheme to its domination. The free-thinking
+# anarchists in the lot will never give in, though, and something needs
+# to be done to accommodate them.
+#
+# Perhaps a "moderately strict" version class could be implemented that
+# lets almost anything slide (syntactically), and makes some heuristic
+# assumptions about non-digits in version number strings. This could
+# sink into special-case-hell, though; if I was as talented and
+# idiosyncratic as Larry Wall, I'd go ahead and implement a class that
+# somehow knows that "1.2.1" < "1.2.2a2" < "1.2.2" < "1.2.2pl3", and is
+# just as happy dealing with things like "2g6" and "1.13++". I don't
+# think I'm smart enough to do it right though.
+#
+# In any case, I've coded the test suite for this module (see
+# ../test/test_version.py) specifically to fail on things like comparing
+# "1.2a2" and "1.2". That's not because the *code* is doing anything
+# wrong, it's because the simple, obvious design doesn't match my
+# complicated, hairy expectations for real-world version numbers. It
+# would be a snap to fix the test suite to say, "Yep, LooseVersion does
+# the Right Thing" (ie. the code matches the conception). But I'd rather
+# have a conception that matches common notions about version numbers.
+
+
+class LooseVersion(Version):
+ """Version numbering for anarchists and software realists.
+ Implements the standard interface for version number classes as
+ described above. A version number consists of a series of numbers,
+ separated by either periods or strings of letters. When comparing
+ version numbers, the numeric components will be compared
+ numerically, and the alphabetic components lexically. The following
+ are all valid version numbers, in no particular order:
+
+ 1.5.1
+ 1.5.2b2
+ 161
+ 3.10a
+ 8.02
+ 3.4j
+ 1996.07.12
+ 3.2.pl0
+ 3.1.1.6
+ 2g6
+ 11g
+ 0.960923
+ 2.2beta29
+ 1.13++
+ 5.5.kw
+ 2.0b1pl0
+
+ In fact, there is no such thing as an invalid version number under
+ this scheme; the rules for comparison are simple and predictable,
+ but may not always give the results you want (for some definition
+ of "want").
+ """
+
+ component_re = re.compile(r'(\d+ | [a-z]+ | \.)', re.VERBOSE)
+
+ def parse(self, vstring):
+ # I've given up on thinking I can reconstruct the version string
+ # from the parsed tuple -- so I just store the string here for
+ # use by __str__
+ self.vstring = vstring
+ components = [x for x in self.component_re.split(vstring) if x and x != '.']
+ for i, obj in enumerate(components):
+ try:
+ components[i] = int(obj)
+ except ValueError:
+ pass
+
+ self.version = components
+
+ def __str__(self):
+ return self.vstring
+
+ def __repr__(self):
+ return f"LooseVersion ('{self}')"
+
+ def _cmp(self, other):
+ if isinstance(other, str):
+ other = LooseVersion(other)
+ elif not isinstance(other, LooseVersion):
+ return NotImplemented
+
+ if self.version == other.version:
+ return 0
+ if self.version < other.version:
+ return -1
+ if self.version > other.version:
+ return 1
+
+
+# end class LooseVersion
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/versionpredicate.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/versionpredicate.py
new file mode 100644
index 0000000000000000000000000000000000000000..fe31b0ed8ef843080ea64df9f58a398d317434ad
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/versionpredicate.py
@@ -0,0 +1,175 @@
+"""Module for parsing and testing package version predicate strings."""
+
+import operator
+import re
+
+from . import version
+
+re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)", re.ASCII)
+# (package) (rest)
+
+re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses
+re_splitComparison = re.compile(r"^\s*(<=|>=|<|>|!=|==)\s*([^\s,]+)\s*$")
+# (comp) (version)
+
+
+def splitUp(pred):
+ """Parse a single version comparison.
+
+ Return (comparison string, StrictVersion)
+ """
+ res = re_splitComparison.match(pred)
+ if not res:
+ raise ValueError(f"bad package restriction syntax: {pred!r}")
+ comp, verStr = res.groups()
+ with version.suppress_known_deprecation():
+ other = version.StrictVersion(verStr)
+ return (comp, other)
+
+
+compmap = {
+ "<": operator.lt,
+ "<=": operator.le,
+ "==": operator.eq,
+ ">": operator.gt,
+ ">=": operator.ge,
+ "!=": operator.ne,
+}
+
+
+class VersionPredicate:
+ """Parse and test package version predicates.
+
+ >>> v = VersionPredicate('pyepat.abc (>1.0, <3333.3a1, !=1555.1b3)')
+
+ The `name` attribute provides the full dotted name that is given::
+
+ >>> v.name
+ 'pyepat.abc'
+
+ The str() of a `VersionPredicate` provides a normalized
+ human-readable version of the expression::
+
+ >>> print(v)
+ pyepat.abc (> 1.0, < 3333.3a1, != 1555.1b3)
+
+ The `satisfied_by()` method can be used to determine with a given
+ version number is included in the set described by the version
+ restrictions::
+
+ >>> v.satisfied_by('1.1')
+ True
+ >>> v.satisfied_by('1.4')
+ True
+ >>> v.satisfied_by('1.0')
+ False
+ >>> v.satisfied_by('4444.4')
+ False
+ >>> v.satisfied_by('1555.1b3')
+ False
+
+ `VersionPredicate` is flexible in accepting extra whitespace::
+
+ >>> v = VersionPredicate(' pat( == 0.1 ) ')
+ >>> v.name
+ 'pat'
+ >>> v.satisfied_by('0.1')
+ True
+ >>> v.satisfied_by('0.2')
+ False
+
+ If any version numbers passed in do not conform to the
+ restrictions of `StrictVersion`, a `ValueError` is raised::
+
+ >>> v = VersionPredicate('p1.p2.p3.p4(>=1.0, <=1.3a1, !=1.2zb3)')
+ Traceback (most recent call last):
+ ...
+ ValueError: invalid version number '1.2zb3'
+
+ It the module or package name given does not conform to what's
+ allowed as a legal module or package name, `ValueError` is
+ raised::
+
+ >>> v = VersionPredicate('foo-bar')
+ Traceback (most recent call last):
+ ...
+ ValueError: expected parenthesized list: '-bar'
+
+ >>> v = VersionPredicate('foo bar (12.21)')
+ Traceback (most recent call last):
+ ...
+ ValueError: expected parenthesized list: 'bar (12.21)'
+
+ """
+
+ def __init__(self, versionPredicateStr):
+ """Parse a version predicate string."""
+ # Fields:
+ # name: package name
+ # pred: list of (comparison string, StrictVersion)
+
+ versionPredicateStr = versionPredicateStr.strip()
+ if not versionPredicateStr:
+ raise ValueError("empty package restriction")
+ match = re_validPackage.match(versionPredicateStr)
+ if not match:
+ raise ValueError(f"bad package name in {versionPredicateStr!r}")
+ self.name, paren = match.groups()
+ paren = paren.strip()
+ if paren:
+ match = re_paren.match(paren)
+ if not match:
+ raise ValueError(f"expected parenthesized list: {paren!r}")
+ str = match.groups()[0]
+ self.pred = [splitUp(aPred) for aPred in str.split(",")]
+ if not self.pred:
+ raise ValueError(f"empty parenthesized list in {versionPredicateStr!r}")
+ else:
+ self.pred = []
+
+ def __str__(self):
+ if self.pred:
+ seq = [cond + " " + str(ver) for cond, ver in self.pred]
+ return self.name + " (" + ", ".join(seq) + ")"
+ else:
+ return self.name
+
+ def satisfied_by(self, version):
+ """True if version is compatible with all the predicates in self.
+ The parameter version must be acceptable to the StrictVersion
+ constructor. It may be either a string or StrictVersion.
+ """
+ for cond, ver in self.pred:
+ if not compmap[cond](version, ver):
+ return False
+ return True
+
+
+_provision_rx = None
+
+
+def split_provision(value):
+ """Return the name and optional version number of a provision.
+
+ The version number, if given, will be returned as a `StrictVersion`
+ instance, otherwise it will be `None`.
+
+ >>> split_provision('mypkg')
+ ('mypkg', None)
+ >>> split_provision(' mypkg( 1.2 ) ')
+ ('mypkg', StrictVersion ('1.2'))
+ """
+ global _provision_rx
+ if _provision_rx is None:
+ _provision_rx = re.compile(
+ r"([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$", re.ASCII
+ )
+ value = value.strip()
+ m = _provision_rx.match(value)
+ if not m:
+ raise ValueError(f"illegal provides specification: {value!r}")
+ ver = m.group(2) or None
+ if ver:
+ with version.suppress_known_deprecation():
+ ver = version.StrictVersion(ver)
+ return m.group(1), ver
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/zosccompiler.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/zosccompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..e49630ac6ed8cad62c4d2ff8361758519e6dc83b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_distutils/zosccompiler.py
@@ -0,0 +1,3 @@
+from .compilers.C import zos
+
+zOSCCompiler = zos.Compiler
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..b49c3af060ce6326b8d91b9b73e76456ea0d9d2b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/LICENSE
@@ -0,0 +1,166 @@
+GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..32214fb4400035788bfe5c0de42dad106a4f54f1
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/METADATA
@@ -0,0 +1,420 @@
+Metadata-Version: 2.1
+Name: autocommand
+Version: 2.2.2
+Summary: A library to create a command-line program from a function
+Home-page: https://github.com/Lucretiel/autocommand
+Author: Nathan West
+License: LGPLv3
+Project-URL: Homepage, https://github.com/Lucretiel/autocommand
+Project-URL: Bug Tracker, https://github.com/Lucretiel/autocommand/issues
+Platform: any
+Classifier: Development Status :: 6 - Mature
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Topic :: Software Development
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >=3.7
+Description-Content-Type: text/markdown
+License-File: LICENSE
+
+[](https://badge.fury.io/py/autocommand)
+
+# autocommand
+
+A library to automatically generate and run simple argparse parsers from function signatures.
+
+## Installation
+
+Autocommand is installed via pip:
+
+```
+$ pip install autocommand
+```
+
+## Usage
+
+Autocommand turns a function into a command-line program. It converts the function's parameter signature into command-line arguments, and automatically runs the function if the module was called as `__main__`. In effect, it lets your create a smart main function.
+
+```python
+from autocommand import autocommand
+
+# This program takes exactly one argument and echos it.
+@autocommand(__name__)
+def echo(thing):
+ print(thing)
+```
+
+```
+$ python echo.py hello
+hello
+$ python echo.py -h
+usage: echo [-h] thing
+
+positional arguments:
+ thing
+
+optional arguments:
+ -h, --help show this help message and exit
+$ python echo.py hello world # too many arguments
+usage: echo.py [-h] thing
+echo.py: error: unrecognized arguments: world
+```
+
+As you can see, autocommand converts the signature of the function into an argument spec. When you run the file as a program, autocommand collects the command-line arguments and turns them into function arguments. The function is executed with these arguments, and then the program exits with the return value of the function, via `sys.exit`. Autocommand also automatically creates a usage message, which can be invoked with `-h` or `--help`, and automatically prints an error message when provided with invalid arguments.
+
+### Types
+
+You can use a type annotation to give an argument a type. Any type (or in fact any callable) that returns an object when given a string argument can be used, though there are a few special cases that are described later.
+
+```python
+@autocommand(__name__)
+def net_client(host, port: int):
+ ...
+```
+
+Autocommand will catch `TypeErrors` raised by the type during argument parsing, so you can supply a callable and do some basic argument validation as well.
+
+### Trailing Arguments
+
+You can add a `*args` parameter to your function to give it trailing arguments. The command will collect 0 or more trailing arguments and supply them to `args` as a tuple. If a type annotation is supplied, the type is applied to each argument.
+
+```python
+# Write the contents of each file, one by one
+@autocommand(__name__)
+def cat(*files):
+ for filename in files:
+ with open(filename) as file:
+ for line in file:
+ print(line.rstrip())
+```
+
+```
+$ python cat.py -h
+usage: ipython [-h] [file [file ...]]
+
+positional arguments:
+ file
+
+optional arguments:
+ -h, --help show this help message and exit
+```
+
+### Options
+
+To create `--option` switches, just assign a default. Autocommand will automatically create `--long` and `-s`hort switches.
+
+```python
+@autocommand(__name__)
+def do_with_config(argument, config='~/foo.conf'):
+ pass
+```
+
+```
+$ python example.py -h
+usage: example.py [-h] [-c CONFIG] argument
+
+positional arguments:
+ argument
+
+optional arguments:
+ -h, --help show this help message and exit
+ -c CONFIG, --config CONFIG
+```
+
+The option's type is automatically deduced from the default, unless one is explicitly given in an annotation:
+
+```python
+@autocommand(__name__)
+def http_connect(host, port=80):
+ print('{}:{}'.format(host, port))
+```
+
+```
+$ python http.py -h
+usage: http.py [-h] [-p PORT] host
+
+positional arguments:
+ host
+
+optional arguments:
+ -h, --help show this help message and exit
+ -p PORT, --port PORT
+$ python http.py localhost
+localhost:80
+$ python http.py localhost -p 8080
+localhost:8080
+$ python http.py localhost -p blah
+usage: http.py [-h] [-p PORT] host
+http.py: error: argument -p/--port: invalid int value: 'blah'
+```
+
+#### None
+
+If an option is given a default value of `None`, it reads in a value as normal, but supplies `None` if the option isn't provided.
+
+#### Switches
+
+If an argument is given a default value of `True` or `False`, or
+given an explicit `bool` type, it becomes an option switch.
+
+```python
+ @autocommand(__name__)
+ def example(verbose=False, quiet=False):
+ pass
+```
+
+```
+$ python example.py -h
+usage: example.py [-h] [-v] [-q]
+
+optional arguments:
+ -h, --help show this help message and exit
+ -v, --verbose
+ -q, --quiet
+```
+
+Autocommand attempts to do the "correct thing" in these cases- if the default is `True`, then supplying the switch makes the argument `False`; if the type is `bool` and the default is some other `True` value, then supplying the switch makes the argument `False`, while not supplying the switch makes the argument the default value.
+
+Autocommand also supports the creation of switch inverters. Pass `add_nos=True` to `autocommand` to enable this.
+
+```
+ @autocommand(__name__, add_nos=True)
+ def example(verbose=False):
+ pass
+```
+
+```
+$ python example.py -h
+usage: ipython [-h] [-v] [--no-verbose]
+
+optional arguments:
+ -h, --help show this help message and exit
+ -v, --verbose
+ --no-verbose
+```
+
+Using the `--no-` version of a switch will pass the opposite value in as a function argument. If multiple switches are present, the last one takes precedence.
+
+#### Files
+
+If the default value is a file object, such as `sys.stdout`, then autocommand just looks for a string, for a file path. It doesn't do any special checking on the string, though (such as checking if the file exists); it's better to let the client decide how to handle errors in this case. Instead, it provides a special context manager called `smart_open`, which behaves exactly like `open` if a filename or other openable type is provided, but also lets you use already open files:
+
+```python
+from autocommand import autocommand, smart_open
+import sys
+
+# Write the contents of stdin, or a file, to stdout
+@autocommand(__name__)
+def write_out(infile=sys.stdin):
+ with smart_open(infile) as f:
+ for line in f:
+ print(line.rstrip())
+ # If a file was opened, it is closed here. If it was just stdin, it is untouched.
+```
+
+```
+$ echo "Hello World!" | python write_out.py | tee hello.txt
+Hello World!
+$ python write_out.py --infile hello.txt
+Hello World!
+```
+
+### Descriptions and docstrings
+
+The `autocommand` decorator accepts `description` and `epilog` kwargs, corresponding to the `description `_ and `epilog `_ of the `ArgumentParser`. If no description is given, but the decorated function has a docstring, then it is taken as the `description` for the `ArgumentParser`. You can also provide both the description and epilog in the docstring by splitting it into two sections with 4 or more - characters.
+
+```python
+@autocommand(__name__)
+def copy(infile=sys.stdin, outfile=sys.stdout):
+ '''
+ Copy an the contents of a file (or stdin) to another file (or stdout)
+ ----------
+ Some extra documentation in the epilog
+ '''
+ with smart_open(infile) as istr:
+ with smart_open(outfile, 'w') as ostr:
+ for line in istr:
+ ostr.write(line)
+```
+
+```
+$ python copy.py -h
+usage: copy.py [-h] [-i INFILE] [-o OUTFILE]
+
+Copy an the contents of a file (or stdin) to another file (or stdout)
+
+optional arguments:
+ -h, --help show this help message and exit
+ -i INFILE, --infile INFILE
+ -o OUTFILE, --outfile OUTFILE
+
+Some extra documentation in the epilog
+$ echo "Hello World" | python copy.py --outfile hello.txt
+$ python copy.py --infile hello.txt --outfile hello2.txt
+$ python copy.py --infile hello2.txt
+Hello World
+```
+
+### Parameter descriptions
+
+You can also attach description text to individual parameters in the annotation. To attach both a type and a description, supply them both in any order in a tuple
+
+```python
+@autocommand(__name__)
+def copy_net(
+ infile: 'The name of the file to send',
+ host: 'The host to send the file to',
+ port: (int, 'The port to connect to')):
+
+ '''
+ Copy a file over raw TCP to a remote destination.
+ '''
+ # Left as an exercise to the reader
+```
+
+### Decorators and wrappers
+
+Autocommand automatically follows wrapper chains created by `@functools.wraps`. This means that you can apply other wrapping decorators to your main function, and autocommand will still correctly detect the signature.
+
+```python
+from functools import wraps
+from autocommand import autocommand
+
+def print_yielded(func):
+ '''
+ Convert a generator into a function that prints all yielded elements
+ '''
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ for thing in func(*args, **kwargs):
+ print(thing)
+ return wrapper
+
+@autocommand(__name__,
+ description= 'Print all the values from START to STOP, inclusive, in steps of STEP',
+ epilog= 'STOP and STEP default to 1')
+@print_yielded
+def seq(stop, start=1, step=1):
+ for i in range(start, stop + 1, step):
+ yield i
+```
+
+```
+$ seq.py -h
+usage: seq.py [-h] [-s START] [-S STEP] stop
+
+Print all the values from START to STOP, inclusive, in steps of STEP
+
+positional arguments:
+ stop
+
+optional arguments:
+ -h, --help show this help message and exit
+ -s START, --start START
+ -S STEP, --step STEP
+
+STOP and STEP default to 1
+```
+
+Even though autocommand is being applied to the `wrapper` returned by `print_yielded`, it still retreives the signature of the underlying `seq` function to create the argument parsing.
+
+### Custom Parser
+
+While autocommand's automatic parser generator is a powerful convenience, it doesn't cover all of the different features that argparse provides. If you need these features, you can provide your own parser as a kwarg to `autocommand`:
+
+```python
+from argparse import ArgumentParser
+from autocommand import autocommand
+
+parser = ArgumentParser()
+# autocommand can't do optional positonal parameters
+parser.add_argument('arg', nargs='?')
+# or mutually exclusive options
+group = parser.add_mutually_exclusive_group()
+group.add_argument('-v', '--verbose', action='store_true')
+group.add_argument('-q', '--quiet', action='store_true')
+
+@autocommand(__name__, parser=parser)
+def main(arg, verbose, quiet):
+ print(arg, verbose, quiet)
+```
+
+```
+$ python parser.py -h
+usage: write_file.py [-h] [-v | -q] [arg]
+
+positional arguments:
+ arg
+
+optional arguments:
+ -h, --help show this help message and exit
+ -v, --verbose
+ -q, --quiet
+$ python parser.py
+None False False
+$ python parser.py hello
+hello False False
+$ python parser.py -v
+None True False
+$ python parser.py -q
+None False True
+$ python parser.py -vq
+usage: parser.py [-h] [-v | -q] [arg]
+parser.py: error: argument -q/--quiet: not allowed with argument -v/--verbose
+```
+
+Any parser should work fine, so long as each of the parser's arguments has a corresponding parameter in the decorated main function. The order of parameters doesn't matter, as long as they are all present. Note that when using a custom parser, autocommand doesn't modify the parser or the retrieved arguments. This means that no description/epilog will be added, and the function's type annotations and defaults (if present) will be ignored.
+
+## Testing and Library use
+
+The decorated function is only called and exited from if the first argument to `autocommand` is `'__main__'` or `True`. If it is neither of these values, or no argument is given, then a new main function is created by the decorator. This function has the signature `main(argv=None)`, and is intended to be called with arguments as if via `main(sys.argv[1:])`. The function has the attributes `parser` and `main`, which are the generated `ArgumentParser` and the original main function that was decorated. This is to facilitate testing and library use of your main. Calling the function triggers a `parse_args()` with the supplied arguments, and returns the result of the main function. Note that, while it returns instead of calling `sys.exit`, the `parse_args()` function will raise a `SystemExit` in the event of a parsing error or `-h/--help` argument.
+
+```python
+ @autocommand()
+ def test_prog(arg1, arg2: int, quiet=False, verbose=False):
+ if not quiet:
+ print(arg1, arg2)
+ if verbose:
+ print("LOUD NOISES")
+
+ return 0
+
+ print(test_prog(['-v', 'hello', '80']))
+```
+
+```
+$ python test_prog.py
+hello 80
+LOUD NOISES
+0
+```
+
+If the function is called with no arguments, `sys.argv[1:]` is used. This is to allow the autocommand function to be used as a setuptools entry point.
+
+## Exceptions and limitations
+
+- There are a few possible exceptions that `autocommand` can raise. All of them derive from `autocommand.AutocommandError`.
+
+ - If an invalid annotation is given (that is, it isn't a `type`, `str`, `(type, str)`, or `(str, type)`, an `AnnotationError` is raised. The `type` may be any callable, as described in the `Types`_ section.
+ - If the function has a `**kwargs` parameter, a `KWargError` is raised.
+ - If, somehow, the function has a positional-only parameter, a `PositionalArgError` is raised. This means that the argument doesn't have a name, which is currently not possible with a plain `def` or `lambda`, though many built-in functions have this kind of parameter.
+
+- There are a few argparse features that are not supported by autocommand.
+
+ - It isn't possible to have an optional positional argument (as opposed to a `--option`). POSIX thinks this is bad form anyway.
+ - It isn't possible to have mutually exclusive arguments or options
+ - It isn't possible to have subcommands or subparsers, though I'm working on a few solutions involving classes or nested function definitions to allow this.
+
+## Development
+
+Autocommand cannot be important from the project root; this is to enforce separation of concerns and prevent accidental importing of `setup.py` or tests. To develop, install the project in editable mode:
+
+```
+$ python setup.py develop
+```
+
+This will create a link to the source files in the deployment directory, so that any source changes are reflected when it is imported.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..e6e12ea51e18b270be6c5103c8cb1f6ef62f9e4a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/RECORD
@@ -0,0 +1,18 @@
+autocommand-2.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+autocommand-2.2.2.dist-info/LICENSE,sha256=reeNBJgtaZctREqOFKlPh6IzTdOFXMgDSOqOJAqg3y0,7634
+autocommand-2.2.2.dist-info/METADATA,sha256=OADZuR3O6iBlpu1ieTgzYul6w4uOVrk0P0BO5TGGAJk,15006
+autocommand-2.2.2.dist-info/RECORD,,
+autocommand-2.2.2.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
+autocommand-2.2.2.dist-info/top_level.txt,sha256=AzfhgKKS8EdAwWUTSF8mgeVQbXOY9kokHB6kSqwwqu0,12
+autocommand/__init__.py,sha256=zko5Rnvolvb-UXjCx_2ArPTGBWwUK5QY4LIQIKYR7As,1037
+autocommand/__pycache__/__init__.cpython-312.pyc,,
+autocommand/__pycache__/autoasync.cpython-312.pyc,,
+autocommand/__pycache__/autocommand.cpython-312.pyc,,
+autocommand/__pycache__/automain.cpython-312.pyc,,
+autocommand/__pycache__/autoparse.cpython-312.pyc,,
+autocommand/__pycache__/errors.cpython-312.pyc,,
+autocommand/autoasync.py,sha256=AMdyrxNS4pqWJfP_xuoOcImOHWD-qT7x06wmKN1Vp-U,5680
+autocommand/autocommand.py,sha256=hmkEmQ72HtL55gnURVjDOnsfYlGd5lLXbvT4KG496Qw,2505
+autocommand/automain.py,sha256=A2b8i754Mxc_DjU9WFr6vqYDWlhz0cn8miu8d8EsxV8,2076
+autocommand/autoparse.py,sha256=WVWmZJPcbzUKXP40raQw_0HD8qPJ2V9VG1eFFmmnFxw,11642
+autocommand/errors.py,sha256=7aa3roh9Herd6nIKpQHNWEslWE8oq7GiHYVUuRqORnA,886
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..57e3d840d59a650ac5bccbad5baeec47d155f0ad
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.38.4)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..dda5158ff6d263927861b19ef5a5d183d2aa77ed
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand-2.2.2.dist-info/top_level.txt
@@ -0,0 +1 @@
+autocommand
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..73fbfca6b36927c6371839df3dfe733bebb2066f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2014-2016 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand. If not, see .
+
+# flake8 flags all these imports as unused, hence the NOQAs everywhere.
+
+from .automain import automain # NOQA
+from .autoparse import autoparse, smart_open # NOQA
+from .autocommand import autocommand # NOQA
+
+try:
+ from .autoasync import autoasync # NOQA
+except ImportError: # pragma: no cover
+ pass
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autoasync.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autoasync.py
new file mode 100644
index 0000000000000000000000000000000000000000..688f7e05544bb5b4914d290c9bfe73bb99f4e06a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autoasync.py
@@ -0,0 +1,142 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand. If not, see .
+
+from asyncio import get_event_loop, iscoroutine
+from functools import wraps
+from inspect import signature
+
+
+async def _run_forever_coro(coro, args, kwargs, loop):
+ '''
+ This helper function launches an async main function that was tagged with
+ forever=True. There are two possibilities:
+
+ - The function is a normal function, which handles initializing the event
+ loop, which is then run forever
+ - The function is a coroutine, which needs to be scheduled in the event
+ loop, which is then run forever
+ - There is also the possibility that the function is a normal function
+ wrapping a coroutine function
+
+ The function is therefore called unconditionally and scheduled in the event
+ loop if the return value is a coroutine object.
+
+ The reason this is a separate function is to make absolutely sure that all
+ the objects created are garbage collected after all is said and done; we
+ do this to ensure that any exceptions raised in the tasks are collected
+ ASAP.
+ '''
+
+ # Personal note: I consider this an antipattern, as it relies on the use of
+ # unowned resources. The setup function dumps some stuff into the event
+ # loop where it just whirls in the ether without a well defined owner or
+ # lifetime. For this reason, there's a good chance I'll remove the
+ # forever=True feature from autoasync at some point in the future.
+ thing = coro(*args, **kwargs)
+ if iscoroutine(thing):
+ await thing
+
+
+def autoasync(coro=None, *, loop=None, forever=False, pass_loop=False):
+ '''
+ Convert an asyncio coroutine into a function which, when called, is
+ evaluted in an event loop, and the return value returned. This is intented
+ to make it easy to write entry points into asyncio coroutines, which
+ otherwise need to be explictly evaluted with an event loop's
+ run_until_complete.
+
+ If `loop` is given, it is used as the event loop to run the coro in. If it
+ is None (the default), the loop is retreived using asyncio.get_event_loop.
+ This call is defered until the decorated function is called, so that
+ callers can install custom event loops or event loop policies after
+ @autoasync is applied.
+
+ If `forever` is True, the loop is run forever after the decorated coroutine
+ is finished. Use this for servers created with asyncio.start_server and the
+ like.
+
+ If `pass_loop` is True, the event loop object is passed into the coroutine
+ as the `loop` kwarg when the wrapper function is called. In this case, the
+ wrapper function's __signature__ is updated to remove this parameter, so
+ that autoparse can still be used on it without generating a parameter for
+ `loop`.
+
+ This coroutine can be called with ( @autoasync(...) ) or without
+ ( @autoasync ) arguments.
+
+ Examples:
+
+ @autoasync
+ def get_file(host, port):
+ reader, writer = yield from asyncio.open_connection(host, port)
+ data = reader.read()
+ sys.stdout.write(data.decode())
+
+ get_file(host, port)
+
+ @autoasync(forever=True, pass_loop=True)
+ def server(host, port, loop):
+ yield_from loop.create_server(Proto, host, port)
+
+ server('localhost', 8899)
+
+ '''
+ if coro is None:
+ return lambda c: autoasync(
+ c, loop=loop,
+ forever=forever,
+ pass_loop=pass_loop)
+
+ # The old and new signatures are required to correctly bind the loop
+ # parameter in 100% of cases, even if it's a positional parameter.
+ # NOTE: A future release will probably require the loop parameter to be
+ # a kwonly parameter.
+ if pass_loop:
+ old_sig = signature(coro)
+ new_sig = old_sig.replace(parameters=(
+ param for name, param in old_sig.parameters.items()
+ if name != "loop"))
+
+ @wraps(coro)
+ def autoasync_wrapper(*args, **kwargs):
+ # Defer the call to get_event_loop so that, if a custom policy is
+ # installed after the autoasync decorator, it is respected at call time
+ local_loop = get_event_loop() if loop is None else loop
+
+ # Inject the 'loop' argument. We have to use this signature binding to
+ # ensure it's injected in the correct place (positional, keyword, etc)
+ if pass_loop:
+ bound_args = old_sig.bind_partial()
+ bound_args.arguments.update(
+ loop=local_loop,
+ **new_sig.bind(*args, **kwargs).arguments)
+ args, kwargs = bound_args.args, bound_args.kwargs
+
+ if forever:
+ local_loop.create_task(_run_forever_coro(
+ coro, args, kwargs, local_loop
+ ))
+ local_loop.run_forever()
+ else:
+ return local_loop.run_until_complete(coro(*args, **kwargs))
+
+ # Attach the updated signature. This allows 'pass_loop' to be used with
+ # autoparse
+ if pass_loop:
+ autoasync_wrapper.__signature__ = new_sig
+
+ return autoasync_wrapper
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autocommand.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autocommand.py
new file mode 100644
index 0000000000000000000000000000000000000000..097e86de0720126a1390d728f7e50a4f89cac77f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autocommand.py
@@ -0,0 +1,70 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand. If not, see .
+
+from .autoparse import autoparse
+from .automain import automain
+try:
+ from .autoasync import autoasync
+except ImportError: # pragma: no cover
+ pass
+
+
+def autocommand(
+ module, *,
+ description=None,
+ epilog=None,
+ add_nos=False,
+ parser=None,
+ loop=None,
+ forever=False,
+ pass_loop=False):
+
+ if callable(module):
+ raise TypeError('autocommand requires a module name argument')
+
+ def autocommand_decorator(func):
+ # Step 1: if requested, run it all in an asyncio event loop. autoasync
+ # patches the __signature__ of the decorated function, so that in the
+ # event that pass_loop is True, the `loop` parameter of the original
+ # function will *not* be interpreted as a command-line argument by
+ # autoparse
+ if loop is not None or forever or pass_loop:
+ func = autoasync(
+ func,
+ loop=None if loop is True else loop,
+ pass_loop=pass_loop,
+ forever=forever)
+
+ # Step 2: create parser. We do this second so that the arguments are
+ # parsed and passed *before* entering the asyncio event loop, if it
+ # exists. This simplifies the stack trace and ensures errors are
+ # reported earlier. It also ensures that errors raised during parsing &
+ # passing are still raised if `forever` is True.
+ func = autoparse(
+ func,
+ description=description,
+ epilog=epilog,
+ add_nos=add_nos,
+ parser=parser)
+
+ # Step 3: call the function automatically if __name__ == '__main__' (or
+ # if True was provided)
+ func = automain(module)(func)
+
+ return func
+
+ return autocommand_decorator
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/automain.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/automain.py
new file mode 100644
index 0000000000000000000000000000000000000000..6cc45db66a1c1dbf1bedb993683b0700d0510643
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/automain.py
@@ -0,0 +1,59 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand. If not, see .
+
+import sys
+from .errors import AutocommandError
+
+
+class AutomainRequiresModuleError(AutocommandError, TypeError):
+ pass
+
+
+def automain(module, *, args=(), kwargs=None):
+ '''
+ This decorator automatically invokes a function if the module is being run
+ as the "__main__" module. Optionally, provide args or kwargs with which to
+ call the function. If `module` is "__main__", the function is called, and
+ the program is `sys.exit`ed with the return value. You can also pass `True`
+ to cause the function to be called unconditionally. If the function is not
+ called, it is returned unchanged by the decorator.
+
+ Usage:
+
+ @automain(__name__) # Pass __name__ to check __name__=="__main__"
+ def main():
+ ...
+
+ If __name__ is "__main__" here, the main function is called, and then
+ sys.exit called with the return value.
+ '''
+
+ # Check that @automain(...) was called, rather than @automain
+ if callable(module):
+ raise AutomainRequiresModuleError(module)
+
+ if module == '__main__' or module is True:
+ if kwargs is None:
+ kwargs = {}
+
+ # Use a function definition instead of a lambda for a neater traceback
+ def automain_decorator(main):
+ sys.exit(main(*args, **kwargs))
+
+ return automain_decorator
+ else:
+ return lambda main: main
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autoparse.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autoparse.py
new file mode 100644
index 0000000000000000000000000000000000000000..0276a3fae10eb367af326543bcd69e62432b2f7b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/autoparse.py
@@ -0,0 +1,333 @@
+# Copyright 2014-2015 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand. If not, see .
+
+import sys
+from re import compile as compile_regex
+from inspect import signature, getdoc, Parameter
+from argparse import ArgumentParser
+from contextlib import contextmanager
+from functools import wraps
+from io import IOBase
+from autocommand.errors import AutocommandError
+
+
+_empty = Parameter.empty
+
+
+class AnnotationError(AutocommandError):
+ '''Annotation error: annotation must be a string, type, or tuple of both'''
+
+
+class PositionalArgError(AutocommandError):
+ '''
+ Postional Arg Error: autocommand can't handle postional-only parameters
+ '''
+
+
+class KWArgError(AutocommandError):
+ '''kwarg Error: autocommand can't handle a **kwargs parameter'''
+
+
+class DocstringError(AutocommandError):
+ '''Docstring error'''
+
+
+class TooManySplitsError(DocstringError):
+ '''
+ The docstring had too many ---- section splits. Currently we only support
+ using up to a single split, to split the docstring into description and
+ epilog parts.
+ '''
+
+
+def _get_type_description(annotation):
+ '''
+ Given an annotation, return the (type, description) for the parameter.
+ If you provide an annotation that is somehow both a string and a callable,
+ the behavior is undefined.
+ '''
+ if annotation is _empty:
+ return None, None
+ elif callable(annotation):
+ return annotation, None
+ elif isinstance(annotation, str):
+ return None, annotation
+ elif isinstance(annotation, tuple):
+ try:
+ arg1, arg2 = annotation
+ except ValueError as e:
+ raise AnnotationError(annotation) from e
+ else:
+ if callable(arg1) and isinstance(arg2, str):
+ return arg1, arg2
+ elif isinstance(arg1, str) and callable(arg2):
+ return arg2, arg1
+
+ raise AnnotationError(annotation)
+
+
+def _add_arguments(param, parser, used_char_args, add_nos):
+ '''
+ Add the argument(s) to an ArgumentParser (using add_argument) for a given
+ parameter. used_char_args is the set of -short options currently already in
+ use, and is updated (if necessary) by this function. If add_nos is True,
+ this will also add an inverse switch for all boolean options. For
+ instance, for the boolean parameter "verbose", this will create --verbose
+ and --no-verbose.
+ '''
+
+ # Impl note: This function is kept separate from make_parser because it's
+ # already very long and I wanted to separate out as much as possible into
+ # its own call scope, to prevent even the possibility of suble mutation
+ # bugs.
+ if param.kind is param.POSITIONAL_ONLY:
+ raise PositionalArgError(param)
+ elif param.kind is param.VAR_KEYWORD:
+ raise KWArgError(param)
+
+ # These are the kwargs for the add_argument function.
+ arg_spec = {}
+ is_option = False
+
+ # Get the type and default from the annotation.
+ arg_type, description = _get_type_description(param.annotation)
+
+ # Get the default value
+ default = param.default
+
+ # If there is no explicit type, and the default is present and not None,
+ # infer the type from the default.
+ if arg_type is None and default not in {_empty, None}:
+ arg_type = type(default)
+
+ # Add default. The presence of a default means this is an option, not an
+ # argument.
+ if default is not _empty:
+ arg_spec['default'] = default
+ is_option = True
+
+ # Add the type
+ if arg_type is not None:
+ # Special case for bool: make it just a --switch
+ if arg_type is bool:
+ if not default or default is _empty:
+ arg_spec['action'] = 'store_true'
+ else:
+ arg_spec['action'] = 'store_false'
+
+ # Switches are always options
+ is_option = True
+
+ # Special case for file types: make it a string type, for filename
+ elif isinstance(default, IOBase):
+ arg_spec['type'] = str
+
+ # TODO: special case for list type.
+ # - How to specificy type of list members?
+ # - param: [int]
+ # - param: int =[]
+ # - action='append' vs nargs='*'
+
+ else:
+ arg_spec['type'] = arg_type
+
+ # nargs: if the signature includes *args, collect them as trailing CLI
+ # arguments in a list. *args can't have a default value, so it can never be
+ # an option.
+ if param.kind is param.VAR_POSITIONAL:
+ # TODO: consider depluralizing metavar/name here.
+ arg_spec['nargs'] = '*'
+
+ # Add description.
+ if description is not None:
+ arg_spec['help'] = description
+
+ # Get the --flags
+ flags = []
+ name = param.name
+
+ if is_option:
+ # Add the first letter as a -short option.
+ for letter in name[0], name[0].swapcase():
+ if letter not in used_char_args:
+ used_char_args.add(letter)
+ flags.append('-{}'.format(letter))
+ break
+
+ # If the parameter is a --long option, or is a -short option that
+ # somehow failed to get a flag, add it.
+ if len(name) > 1 or not flags:
+ flags.append('--{}'.format(name))
+
+ arg_spec['dest'] = name
+ else:
+ flags.append(name)
+
+ parser.add_argument(*flags, **arg_spec)
+
+ # Create the --no- version for boolean switches
+ if add_nos and arg_type is bool:
+ parser.add_argument(
+ '--no-{}'.format(name),
+ action='store_const',
+ dest=name,
+ const=default if default is not _empty else False)
+
+
+def make_parser(func_sig, description, epilog, add_nos):
+ '''
+ Given the signature of a function, create an ArgumentParser
+ '''
+ parser = ArgumentParser(description=description, epilog=epilog)
+
+ used_char_args = {'h'}
+
+ # Arange the params so that single-character arguments are first. This
+ # esnures they don't have to get --long versions. sorted is stable, so the
+ # parameters will otherwise still be in relative order.
+ params = sorted(
+ func_sig.parameters.values(),
+ key=lambda param: len(param.name) > 1)
+
+ for param in params:
+ _add_arguments(param, parser, used_char_args, add_nos)
+
+ return parser
+
+
+_DOCSTRING_SPLIT = compile_regex(r'\n\s*-{4,}\s*\n')
+
+
+def parse_docstring(docstring):
+ '''
+ Given a docstring, parse it into a description and epilog part
+ '''
+ if docstring is None:
+ return '', ''
+
+ parts = _DOCSTRING_SPLIT.split(docstring)
+
+ if len(parts) == 1:
+ return docstring, ''
+ elif len(parts) == 2:
+ return parts[0], parts[1]
+ else:
+ raise TooManySplitsError()
+
+
+def autoparse(
+ func=None, *,
+ description=None,
+ epilog=None,
+ add_nos=False,
+ parser=None):
+ '''
+ This decorator converts a function that takes normal arguments into a
+ function which takes a single optional argument, argv, parses it using an
+ argparse.ArgumentParser, and calls the underlying function with the parsed
+ arguments. If it is not given, sys.argv[1:] is used. This is so that the
+ function can be used as a setuptools entry point, as well as a normal main
+ function. sys.argv[1:] is not evaluated until the function is called, to
+ allow injecting different arguments for testing.
+
+ It uses the argument signature of the function to create an
+ ArgumentParser. Parameters without defaults become positional parameters,
+ while parameters *with* defaults become --options. Use annotations to set
+ the type of the parameter.
+
+ The `desctiption` and `epilog` parameters corrospond to the same respective
+ argparse parameters. If no description is given, it defaults to the
+ decorated functions's docstring, if present.
+
+ If add_nos is True, every boolean option (that is, every parameter with a
+ default of True/False or a type of bool) will have a --no- version created
+ as well, which inverts the option. For instance, the --verbose option will
+ have a --no-verbose counterpart. These are not mutually exclusive-
+ whichever one appears last in the argument list will have precedence.
+
+ If a parser is given, it is used instead of one generated from the function
+ signature. In this case, no parser is created; instead, the given parser is
+ used to parse the argv argument. The parser's results' argument names must
+ match up with the parameter names of the decorated function.
+
+ The decorated function is attached to the result as the `func` attribute,
+ and the parser is attached as the `parser` attribute.
+ '''
+
+ # If @autoparse(...) is used instead of @autoparse
+ if func is None:
+ return lambda f: autoparse(
+ f, description=description,
+ epilog=epilog,
+ add_nos=add_nos,
+ parser=parser)
+
+ func_sig = signature(func)
+
+ docstr_description, docstr_epilog = parse_docstring(getdoc(func))
+
+ if parser is None:
+ parser = make_parser(
+ func_sig,
+ description or docstr_description,
+ epilog or docstr_epilog,
+ add_nos)
+
+ @wraps(func)
+ def autoparse_wrapper(argv=None):
+ if argv is None:
+ argv = sys.argv[1:]
+
+ # Get empty argument binding, to fill with parsed arguments. This
+ # object does all the heavy lifting of turning named arguments into
+ # into correctly bound *args and **kwargs.
+ parsed_args = func_sig.bind_partial()
+ parsed_args.arguments.update(vars(parser.parse_args(argv)))
+
+ return func(*parsed_args.args, **parsed_args.kwargs)
+
+ # TODO: attach an updated __signature__ to autoparse_wrapper, just in case.
+
+ # Attach the wrapped function and parser, and return the wrapper.
+ autoparse_wrapper.func = func
+ autoparse_wrapper.parser = parser
+ return autoparse_wrapper
+
+
+@contextmanager
+def smart_open(filename_or_file, *args, **kwargs):
+ '''
+ This context manager allows you to open a filename, if you want to default
+ some already-existing file object, like sys.stdout, which shouldn't be
+ closed at the end of the context. If the filename argument is a str, bytes,
+ or int, the file object is created via a call to open with the given *args
+ and **kwargs, sent to the context, and closed at the end of the context,
+ just like "with open(filename) as f:". If it isn't one of the openable
+ types, the object simply sent to the context unchanged, and left unclosed
+ at the end of the context. Example:
+
+ def work_with_file(name=sys.stdout):
+ with smart_open(name) as f:
+ # Works correctly if name is a str filename or sys.stdout
+ print("Some stuff", file=f)
+ # If it was a filename, f is closed at the end here.
+ '''
+ if isinstance(filename_or_file, (str, bytes, int)):
+ with open(filename_or_file, *args, **kwargs) as file:
+ yield file
+ else:
+ yield filename_or_file
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/errors.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/errors.py
new file mode 100644
index 0000000000000000000000000000000000000000..2570607399a3ae13cb92db65a9171d955d3248c6
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/autocommand/errors.py
@@ -0,0 +1,23 @@
+# Copyright 2014-2016 Nathan West
+#
+# This file is part of autocommand.
+#
+# autocommand is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# autocommand is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with autocommand. If not, see .
+
+
+class AutocommandError(Exception):
+ '''Base class for autocommand exceptions'''
+ pass
+
+# Individual modules will define errors specific to that module.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..1bb5a44356f00884a71ceeefd24ded6caaba2418
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/LICENSE
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..db0a2dcdbe5f55f5815b2eaa243c507d0bdad002
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/METADATA
@@ -0,0 +1,46 @@
+Metadata-Version: 2.1
+Name: backports.tarfile
+Version: 1.2.0
+Summary: Backport of CPython tarfile module
+Author-email: "Jason R. Coombs"
+Project-URL: Homepage, https://github.com/jaraco/backports.tarfile
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Provides-Extra: docs
+Requires-Dist: sphinx >=3.5 ; extra == 'docs'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
+Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
+Requires-Dist: furo ; extra == 'docs'
+Requires-Dist: sphinx-lint ; extra == 'docs'
+Provides-Extra: testing
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'testing'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
+Requires-Dist: pytest-cov ; extra == 'testing'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
+Requires-Dist: jaraco.test ; extra == 'testing'
+Requires-Dist: pytest !=8.0.* ; extra == 'testing'
+
+.. image:: https://img.shields.io/pypi/v/backports.tarfile.svg
+ :target: https://pypi.org/project/backports.tarfile
+
+.. image:: https://img.shields.io/pypi/pyversions/backports.tarfile.svg
+
+.. image:: https://github.com/jaraco/backports.tarfile/actions/workflows/main.yml/badge.svg
+ :target: https://github.com/jaraco/backports.tarfile/actions?query=workflow%3A%22tests%22
+ :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+ :target: https://github.com/astral-sh/ruff
+ :alt: Ruff
+
+.. .. image:: https://readthedocs.org/projects/backportstarfile/badge/?version=latest
+.. :target: https://backportstarfile.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+ :target: https://blog.jaraco.com/skeleton
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..536dc2f09ed8a2e9b04f98b82625101bb9f74715
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/RECORD
@@ -0,0 +1,17 @@
+backports.tarfile-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+backports.tarfile-1.2.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+backports.tarfile-1.2.0.dist-info/METADATA,sha256=ghXFTq132dxaEIolxr3HK1mZqm9iyUmaRANZQSr6WlE,2020
+backports.tarfile-1.2.0.dist-info/RECORD,,
+backports.tarfile-1.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+backports.tarfile-1.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+backports.tarfile-1.2.0.dist-info/top_level.txt,sha256=cGjaLMOoBR1FK0ApojtzWVmViTtJ7JGIK_HwXiEsvtU,10
+backports/__init__.py,sha256=iOEMwnlORWezdO8-2vxBIPSR37D7JGjluZ8f55vzxls,81
+backports/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/__init__.py,sha256=Pwf2qUIfB0SolJPCKcx3vz3UEu_aids4g4sAfxy94qg,108491
+backports/tarfile/__main__.py,sha256=Yw2oGT1afrz2eBskzdPYL8ReB_3liApmhFkN2EbDmc4,59
+backports/tarfile/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/__pycache__/__main__.cpython-312.pyc,,
+backports/tarfile/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+backports/tarfile/compat/__pycache__/__init__.cpython-312.pyc,,
+backports/tarfile/compat/__pycache__/py38.cpython-312.pyc,,
+backports/tarfile/compat/py38.py,sha256=iYkyt_gvWjLzGUTJD9TuTfMMjOk-ersXZmRlvQYN2qE,568
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..bab98d675883cc7567a79df485cd7b4f015e376f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..99d2be5b64d7dc414f8ab9c002de06456b4bada2
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports.tarfile-1.2.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+backports
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..0d1f7edf5dc6343538563a8caa7de6829752c4f9
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/__init__.py
@@ -0,0 +1 @@
+__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c16881cb3ae1ea6e729b62bb2e5d625faa3f5fe
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/__init__.py
@@ -0,0 +1,2937 @@
+#-------------------------------------------------------------------
+# tarfile.py
+#-------------------------------------------------------------------
+# Copyright (C) 2002 Lars Gustaebel
+# All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person
+# obtaining a copy of this software and associated documentation
+# files (the "Software"), to deal in the Software without
+# restriction, including without limitation the rights to use,
+# copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+"""Read from and write to tar format archives.
+"""
+
+version = "0.9.0"
+__author__ = "Lars Gust\u00e4bel (lars@gustaebel.de)"
+__credits__ = "Gustavo Niemeyer, Niels Gust\u00e4bel, Richard Townsend."
+
+#---------
+# Imports
+#---------
+from builtins import open as bltn_open
+import sys
+import os
+import io
+import shutil
+import stat
+import time
+import struct
+import copy
+import re
+
+from .compat.py38 import removesuffix
+
+try:
+ import pwd
+except ImportError:
+ pwd = None
+try:
+ import grp
+except ImportError:
+ grp = None
+
+# os.symlink on Windows prior to 6.0 raises NotImplementedError
+# OSError (winerror=1314) will be raised if the caller does not hold the
+# SeCreateSymbolicLinkPrivilege privilege
+symlink_exception = (AttributeError, NotImplementedError, OSError)
+
+# from tarfile import *
+__all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError", "ReadError",
+ "CompressionError", "StreamError", "ExtractError", "HeaderError",
+ "ENCODING", "USTAR_FORMAT", "GNU_FORMAT", "PAX_FORMAT",
+ "DEFAULT_FORMAT", "open","fully_trusted_filter", "data_filter",
+ "tar_filter", "FilterError", "AbsoluteLinkError",
+ "OutsideDestinationError", "SpecialFileError", "AbsolutePathError",
+ "LinkOutsideDestinationError"]
+
+
+#---------------------------------------------------------
+# tar constants
+#---------------------------------------------------------
+NUL = b"\0" # the null character
+BLOCKSIZE = 512 # length of processing blocks
+RECORDSIZE = BLOCKSIZE * 20 # length of records
+GNU_MAGIC = b"ustar \0" # magic gnu tar string
+POSIX_MAGIC = b"ustar\x0000" # magic posix tar string
+
+LENGTH_NAME = 100 # maximum length of a filename
+LENGTH_LINK = 100 # maximum length of a linkname
+LENGTH_PREFIX = 155 # maximum length of the prefix field
+
+REGTYPE = b"0" # regular file
+AREGTYPE = b"\0" # regular file
+LNKTYPE = b"1" # link (inside tarfile)
+SYMTYPE = b"2" # symbolic link
+CHRTYPE = b"3" # character special device
+BLKTYPE = b"4" # block special device
+DIRTYPE = b"5" # directory
+FIFOTYPE = b"6" # fifo special device
+CONTTYPE = b"7" # contiguous file
+
+GNUTYPE_LONGNAME = b"L" # GNU tar longname
+GNUTYPE_LONGLINK = b"K" # GNU tar longlink
+GNUTYPE_SPARSE = b"S" # GNU tar sparse file
+
+XHDTYPE = b"x" # POSIX.1-2001 extended header
+XGLTYPE = b"g" # POSIX.1-2001 global header
+SOLARIS_XHDTYPE = b"X" # Solaris extended header
+
+USTAR_FORMAT = 0 # POSIX.1-1988 (ustar) format
+GNU_FORMAT = 1 # GNU tar format
+PAX_FORMAT = 2 # POSIX.1-2001 (pax) format
+DEFAULT_FORMAT = PAX_FORMAT
+
+#---------------------------------------------------------
+# tarfile constants
+#---------------------------------------------------------
+# File types that tarfile supports:
+SUPPORTED_TYPES = (REGTYPE, AREGTYPE, LNKTYPE,
+ SYMTYPE, DIRTYPE, FIFOTYPE,
+ CONTTYPE, CHRTYPE, BLKTYPE,
+ GNUTYPE_LONGNAME, GNUTYPE_LONGLINK,
+ GNUTYPE_SPARSE)
+
+# File types that will be treated as a regular file.
+REGULAR_TYPES = (REGTYPE, AREGTYPE,
+ CONTTYPE, GNUTYPE_SPARSE)
+
+# File types that are part of the GNU tar format.
+GNU_TYPES = (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK,
+ GNUTYPE_SPARSE)
+
+# Fields from a pax header that override a TarInfo attribute.
+PAX_FIELDS = ("path", "linkpath", "size", "mtime",
+ "uid", "gid", "uname", "gname")
+
+# Fields from a pax header that are affected by hdrcharset.
+PAX_NAME_FIELDS = {"path", "linkpath", "uname", "gname"}
+
+# Fields in a pax header that are numbers, all other fields
+# are treated as strings.
+PAX_NUMBER_FIELDS = {
+ "atime": float,
+ "ctime": float,
+ "mtime": float,
+ "uid": int,
+ "gid": int,
+ "size": int
+}
+
+#---------------------------------------------------------
+# initialization
+#---------------------------------------------------------
+if os.name == "nt":
+ ENCODING = "utf-8"
+else:
+ ENCODING = sys.getfilesystemencoding()
+
+#---------------------------------------------------------
+# Some useful functions
+#---------------------------------------------------------
+
+def stn(s, length, encoding, errors):
+ """Convert a string to a null-terminated bytes object.
+ """
+ if s is None:
+ raise ValueError("metadata cannot contain None")
+ s = s.encode(encoding, errors)
+ return s[:length] + (length - len(s)) * NUL
+
+def nts(s, encoding, errors):
+ """Convert a null-terminated bytes object to a string.
+ """
+ p = s.find(b"\0")
+ if p != -1:
+ s = s[:p]
+ return s.decode(encoding, errors)
+
+def nti(s):
+ """Convert a number field to a python number.
+ """
+ # There are two possible encodings for a number field, see
+ # itn() below.
+ if s[0] in (0o200, 0o377):
+ n = 0
+ for i in range(len(s) - 1):
+ n <<= 8
+ n += s[i + 1]
+ if s[0] == 0o377:
+ n = -(256 ** (len(s) - 1) - n)
+ else:
+ try:
+ s = nts(s, "ascii", "strict")
+ n = int(s.strip() or "0", 8)
+ except ValueError:
+ raise InvalidHeaderError("invalid header")
+ return n
+
+def itn(n, digits=8, format=DEFAULT_FORMAT):
+ """Convert a python number to a number field.
+ """
+ # POSIX 1003.1-1988 requires numbers to be encoded as a string of
+ # octal digits followed by a null-byte, this allows values up to
+ # (8**(digits-1))-1. GNU tar allows storing numbers greater than
+ # that if necessary. A leading 0o200 or 0o377 byte indicate this
+ # particular encoding, the following digits-1 bytes are a big-endian
+ # base-256 representation. This allows values up to (256**(digits-1))-1.
+ # A 0o200 byte indicates a positive number, a 0o377 byte a negative
+ # number.
+ original_n = n
+ n = int(n)
+ if 0 <= n < 8 ** (digits - 1):
+ s = bytes("%0*o" % (digits - 1, n), "ascii") + NUL
+ elif format == GNU_FORMAT and -256 ** (digits - 1) <= n < 256 ** (digits - 1):
+ if n >= 0:
+ s = bytearray([0o200])
+ else:
+ s = bytearray([0o377])
+ n = 256 ** digits + n
+
+ for i in range(digits - 1):
+ s.insert(1, n & 0o377)
+ n >>= 8
+ else:
+ raise ValueError("overflow in number field")
+
+ return s
+
+def calc_chksums(buf):
+ """Calculate the checksum for a member's header by summing up all
+ characters except for the chksum field which is treated as if
+ it was filled with spaces. According to the GNU tar sources,
+ some tars (Sun and NeXT) calculate chksum with signed char,
+ which will be different if there are chars in the buffer with
+ the high bit set. So we calculate two checksums, unsigned and
+ signed.
+ """
+ unsigned_chksum = 256 + sum(struct.unpack_from("148B8x356B", buf))
+ signed_chksum = 256 + sum(struct.unpack_from("148b8x356b", buf))
+ return unsigned_chksum, signed_chksum
+
+def copyfileobj(src, dst, length=None, exception=OSError, bufsize=None):
+ """Copy length bytes from fileobj src to fileobj dst.
+ If length is None, copy the entire content.
+ """
+ bufsize = bufsize or 16 * 1024
+ if length == 0:
+ return
+ if length is None:
+ shutil.copyfileobj(src, dst, bufsize)
+ return
+
+ blocks, remainder = divmod(length, bufsize)
+ for b in range(blocks):
+ buf = src.read(bufsize)
+ if len(buf) < bufsize:
+ raise exception("unexpected end of data")
+ dst.write(buf)
+
+ if remainder != 0:
+ buf = src.read(remainder)
+ if len(buf) < remainder:
+ raise exception("unexpected end of data")
+ dst.write(buf)
+ return
+
+def _safe_print(s):
+ encoding = getattr(sys.stdout, 'encoding', None)
+ if encoding is not None:
+ s = s.encode(encoding, 'backslashreplace').decode(encoding)
+ print(s, end=' ')
+
+
+class TarError(Exception):
+ """Base exception."""
+ pass
+class ExtractError(TarError):
+ """General exception for extract errors."""
+ pass
+class ReadError(TarError):
+ """Exception for unreadable tar archives."""
+ pass
+class CompressionError(TarError):
+ """Exception for unavailable compression methods."""
+ pass
+class StreamError(TarError):
+ """Exception for unsupported operations on stream-like TarFiles."""
+ pass
+class HeaderError(TarError):
+ """Base exception for header errors."""
+ pass
+class EmptyHeaderError(HeaderError):
+ """Exception for empty headers."""
+ pass
+class TruncatedHeaderError(HeaderError):
+ """Exception for truncated headers."""
+ pass
+class EOFHeaderError(HeaderError):
+ """Exception for end of file headers."""
+ pass
+class InvalidHeaderError(HeaderError):
+ """Exception for invalid headers."""
+ pass
+class SubsequentHeaderError(HeaderError):
+ """Exception for missing and invalid extended headers."""
+ pass
+
+#---------------------------
+# internal stream interface
+#---------------------------
+class _LowLevelFile:
+ """Low-level file object. Supports reading and writing.
+ It is used instead of a regular file object for streaming
+ access.
+ """
+
+ def __init__(self, name, mode):
+ mode = {
+ "r": os.O_RDONLY,
+ "w": os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
+ }[mode]
+ if hasattr(os, "O_BINARY"):
+ mode |= os.O_BINARY
+ self.fd = os.open(name, mode, 0o666)
+
+ def close(self):
+ os.close(self.fd)
+
+ def read(self, size):
+ return os.read(self.fd, size)
+
+ def write(self, s):
+ os.write(self.fd, s)
+
+class _Stream:
+ """Class that serves as an adapter between TarFile and
+ a stream-like object. The stream-like object only
+ needs to have a read() or write() method that works with bytes,
+ and the method is accessed blockwise.
+ Use of gzip or bzip2 compression is possible.
+ A stream-like object could be for example: sys.stdin.buffer,
+ sys.stdout.buffer, a socket, a tape device etc.
+
+ _Stream is intended to be used only internally.
+ """
+
+ def __init__(self, name, mode, comptype, fileobj, bufsize,
+ compresslevel):
+ """Construct a _Stream object.
+ """
+ self._extfileobj = True
+ if fileobj is None:
+ fileobj = _LowLevelFile(name, mode)
+ self._extfileobj = False
+
+ if comptype == '*':
+ # Enable transparent compression detection for the
+ # stream interface
+ fileobj = _StreamProxy(fileobj)
+ comptype = fileobj.getcomptype()
+
+ self.name = name or ""
+ self.mode = mode
+ self.comptype = comptype
+ self.fileobj = fileobj
+ self.bufsize = bufsize
+ self.buf = b""
+ self.pos = 0
+ self.closed = False
+
+ try:
+ if comptype == "gz":
+ try:
+ import zlib
+ except ImportError:
+ raise CompressionError("zlib module is not available") from None
+ self.zlib = zlib
+ self.crc = zlib.crc32(b"")
+ if mode == "r":
+ self.exception = zlib.error
+ self._init_read_gz()
+ else:
+ self._init_write_gz(compresslevel)
+
+ elif comptype == "bz2":
+ try:
+ import bz2
+ except ImportError:
+ raise CompressionError("bz2 module is not available") from None
+ if mode == "r":
+ self.dbuf = b""
+ self.cmp = bz2.BZ2Decompressor()
+ self.exception = OSError
+ else:
+ self.cmp = bz2.BZ2Compressor(compresslevel)
+
+ elif comptype == "xz":
+ try:
+ import lzma
+ except ImportError:
+ raise CompressionError("lzma module is not available") from None
+ if mode == "r":
+ self.dbuf = b""
+ self.cmp = lzma.LZMADecompressor()
+ self.exception = lzma.LZMAError
+ else:
+ self.cmp = lzma.LZMACompressor()
+
+ elif comptype != "tar":
+ raise CompressionError("unknown compression type %r" % comptype)
+
+ except:
+ if not self._extfileobj:
+ self.fileobj.close()
+ self.closed = True
+ raise
+
+ def __del__(self):
+ if hasattr(self, "closed") and not self.closed:
+ self.close()
+
+ def _init_write_gz(self, compresslevel):
+ """Initialize for writing with gzip compression.
+ """
+ self.cmp = self.zlib.compressobj(compresslevel,
+ self.zlib.DEFLATED,
+ -self.zlib.MAX_WBITS,
+ self.zlib.DEF_MEM_LEVEL,
+ 0)
+ timestamp = struct.pack(" self.bufsize:
+ self.fileobj.write(self.buf[:self.bufsize])
+ self.buf = self.buf[self.bufsize:]
+
+ def close(self):
+ """Close the _Stream object. No operation should be
+ done on it afterwards.
+ """
+ if self.closed:
+ return
+
+ self.closed = True
+ try:
+ if self.mode == "w" and self.comptype != "tar":
+ self.buf += self.cmp.flush()
+
+ if self.mode == "w" and self.buf:
+ self.fileobj.write(self.buf)
+ self.buf = b""
+ if self.comptype == "gz":
+ self.fileobj.write(struct.pack("= 0:
+ blocks, remainder = divmod(pos - self.pos, self.bufsize)
+ for i in range(blocks):
+ self.read(self.bufsize)
+ self.read(remainder)
+ else:
+ raise StreamError("seeking backwards is not allowed")
+ return self.pos
+
+ def read(self, size):
+ """Return the next size number of bytes from the stream."""
+ assert size is not None
+ buf = self._read(size)
+ self.pos += len(buf)
+ return buf
+
+ def _read(self, size):
+ """Return size bytes from the stream.
+ """
+ if self.comptype == "tar":
+ return self.__read(size)
+
+ c = len(self.dbuf)
+ t = [self.dbuf]
+ while c < size:
+ # Skip underlying buffer to avoid unaligned double buffering.
+ if self.buf:
+ buf = self.buf
+ self.buf = b""
+ else:
+ buf = self.fileobj.read(self.bufsize)
+ if not buf:
+ break
+ try:
+ buf = self.cmp.decompress(buf)
+ except self.exception as e:
+ raise ReadError("invalid compressed data") from e
+ t.append(buf)
+ c += len(buf)
+ t = b"".join(t)
+ self.dbuf = t[size:]
+ return t[:size]
+
+ def __read(self, size):
+ """Return size bytes from stream. If internal buffer is empty,
+ read another block from the stream.
+ """
+ c = len(self.buf)
+ t = [self.buf]
+ while c < size:
+ buf = self.fileobj.read(self.bufsize)
+ if not buf:
+ break
+ t.append(buf)
+ c += len(buf)
+ t = b"".join(t)
+ self.buf = t[size:]
+ return t[:size]
+# class _Stream
+
+class _StreamProxy(object):
+ """Small proxy class that enables transparent compression
+ detection for the Stream interface (mode 'r|*').
+ """
+
+ def __init__(self, fileobj):
+ self.fileobj = fileobj
+ self.buf = self.fileobj.read(BLOCKSIZE)
+
+ def read(self, size):
+ self.read = self.fileobj.read
+ return self.buf
+
+ def getcomptype(self):
+ if self.buf.startswith(b"\x1f\x8b\x08"):
+ return "gz"
+ elif self.buf[0:3] == b"BZh" and self.buf[4:10] == b"1AY&SY":
+ return "bz2"
+ elif self.buf.startswith((b"\x5d\x00\x00\x80", b"\xfd7zXZ")):
+ return "xz"
+ else:
+ return "tar"
+
+ def close(self):
+ self.fileobj.close()
+# class StreamProxy
+
+#------------------------
+# Extraction file object
+#------------------------
+class _FileInFile(object):
+ """A thin wrapper around an existing file object that
+ provides a part of its data as an individual file
+ object.
+ """
+
+ def __init__(self, fileobj, offset, size, name, blockinfo=None):
+ self.fileobj = fileobj
+ self.offset = offset
+ self.size = size
+ self.position = 0
+ self.name = name
+ self.closed = False
+
+ if blockinfo is None:
+ blockinfo = [(0, size)]
+
+ # Construct a map with data and zero blocks.
+ self.map_index = 0
+ self.map = []
+ lastpos = 0
+ realpos = self.offset
+ for offset, size in blockinfo:
+ if offset > lastpos:
+ self.map.append((False, lastpos, offset, None))
+ self.map.append((True, offset, offset + size, realpos))
+ realpos += size
+ lastpos = offset + size
+ if lastpos < self.size:
+ self.map.append((False, lastpos, self.size, None))
+
+ def flush(self):
+ pass
+
+ @property
+ def mode(self):
+ return 'rb'
+
+ def readable(self):
+ return True
+
+ def writable(self):
+ return False
+
+ def seekable(self):
+ return self.fileobj.seekable()
+
+ def tell(self):
+ """Return the current file position.
+ """
+ return self.position
+
+ def seek(self, position, whence=io.SEEK_SET):
+ """Seek to a position in the file.
+ """
+ if whence == io.SEEK_SET:
+ self.position = min(max(position, 0), self.size)
+ elif whence == io.SEEK_CUR:
+ if position < 0:
+ self.position = max(self.position + position, 0)
+ else:
+ self.position = min(self.position + position, self.size)
+ elif whence == io.SEEK_END:
+ self.position = max(min(self.size + position, self.size), 0)
+ else:
+ raise ValueError("Invalid argument")
+ return self.position
+
+ def read(self, size=None):
+ """Read data from the file.
+ """
+ if size is None:
+ size = self.size - self.position
+ else:
+ size = min(size, self.size - self.position)
+
+ buf = b""
+ while size > 0:
+ while True:
+ data, start, stop, offset = self.map[self.map_index]
+ if start <= self.position < stop:
+ break
+ else:
+ self.map_index += 1
+ if self.map_index == len(self.map):
+ self.map_index = 0
+ length = min(size, stop - self.position)
+ if data:
+ self.fileobj.seek(offset + (self.position - start))
+ b = self.fileobj.read(length)
+ if len(b) != length:
+ raise ReadError("unexpected end of data")
+ buf += b
+ else:
+ buf += NUL * length
+ size -= length
+ self.position += length
+ return buf
+
+ def readinto(self, b):
+ buf = self.read(len(b))
+ b[:len(buf)] = buf
+ return len(buf)
+
+ def close(self):
+ self.closed = True
+#class _FileInFile
+
+class ExFileObject(io.BufferedReader):
+
+ def __init__(self, tarfile, tarinfo):
+ fileobj = _FileInFile(tarfile.fileobj, tarinfo.offset_data,
+ tarinfo.size, tarinfo.name, tarinfo.sparse)
+ super().__init__(fileobj)
+#class ExFileObject
+
+
+#-----------------------------
+# extraction filters (PEP 706)
+#-----------------------------
+
+class FilterError(TarError):
+ pass
+
+class AbsolutePathError(FilterError):
+ def __init__(self, tarinfo):
+ self.tarinfo = tarinfo
+ super().__init__(f'member {tarinfo.name!r} has an absolute path')
+
+class OutsideDestinationError(FilterError):
+ def __init__(self, tarinfo, path):
+ self.tarinfo = tarinfo
+ self._path = path
+ super().__init__(f'{tarinfo.name!r} would be extracted to {path!r}, '
+ + 'which is outside the destination')
+
+class SpecialFileError(FilterError):
+ def __init__(self, tarinfo):
+ self.tarinfo = tarinfo
+ super().__init__(f'{tarinfo.name!r} is a special file')
+
+class AbsoluteLinkError(FilterError):
+ def __init__(self, tarinfo):
+ self.tarinfo = tarinfo
+ super().__init__(f'{tarinfo.name!r} is a link to an absolute path')
+
+class LinkOutsideDestinationError(FilterError):
+ def __init__(self, tarinfo, path):
+ self.tarinfo = tarinfo
+ self._path = path
+ super().__init__(f'{tarinfo.name!r} would link to {path!r}, '
+ + 'which is outside the destination')
+
+def _get_filtered_attrs(member, dest_path, for_data=True):
+ new_attrs = {}
+ name = member.name
+ dest_path = os.path.realpath(dest_path)
+ # Strip leading / (tar's directory separator) from filenames.
+ # Include os.sep (target OS directory separator) as well.
+ if name.startswith(('/', os.sep)):
+ name = new_attrs['name'] = member.path.lstrip('/' + os.sep)
+ if os.path.isabs(name):
+ # Path is absolute even after stripping.
+ # For example, 'C:/foo' on Windows.
+ raise AbsolutePathError(member)
+ # Ensure we stay in the destination
+ target_path = os.path.realpath(os.path.join(dest_path, name))
+ if os.path.commonpath([target_path, dest_path]) != dest_path:
+ raise OutsideDestinationError(member, target_path)
+ # Limit permissions (no high bits, and go-w)
+ mode = member.mode
+ if mode is not None:
+ # Strip high bits & group/other write bits
+ mode = mode & 0o755
+ if for_data:
+ # For data, handle permissions & file types
+ if member.isreg() or member.islnk():
+ if not mode & 0o100:
+ # Clear executable bits if not executable by user
+ mode &= ~0o111
+ # Ensure owner can read & write
+ mode |= 0o600
+ elif member.isdir() or member.issym():
+ # Ignore mode for directories & symlinks
+ mode = None
+ else:
+ # Reject special files
+ raise SpecialFileError(member)
+ if mode != member.mode:
+ new_attrs['mode'] = mode
+ if for_data:
+ # Ignore ownership for 'data'
+ if member.uid is not None:
+ new_attrs['uid'] = None
+ if member.gid is not None:
+ new_attrs['gid'] = None
+ if member.uname is not None:
+ new_attrs['uname'] = None
+ if member.gname is not None:
+ new_attrs['gname'] = None
+ # Check link destination for 'data'
+ if member.islnk() or member.issym():
+ if os.path.isabs(member.linkname):
+ raise AbsoluteLinkError(member)
+ if member.issym():
+ target_path = os.path.join(dest_path,
+ os.path.dirname(name),
+ member.linkname)
+ else:
+ target_path = os.path.join(dest_path,
+ member.linkname)
+ target_path = os.path.realpath(target_path)
+ if os.path.commonpath([target_path, dest_path]) != dest_path:
+ raise LinkOutsideDestinationError(member, target_path)
+ return new_attrs
+
+def fully_trusted_filter(member, dest_path):
+ return member
+
+def tar_filter(member, dest_path):
+ new_attrs = _get_filtered_attrs(member, dest_path, False)
+ if new_attrs:
+ return member.replace(**new_attrs, deep=False)
+ return member
+
+def data_filter(member, dest_path):
+ new_attrs = _get_filtered_attrs(member, dest_path, True)
+ if new_attrs:
+ return member.replace(**new_attrs, deep=False)
+ return member
+
+_NAMED_FILTERS = {
+ "fully_trusted": fully_trusted_filter,
+ "tar": tar_filter,
+ "data": data_filter,
+}
+
+#------------------
+# Exported Classes
+#------------------
+
+# Sentinel for replace() defaults, meaning "don't change the attribute"
+_KEEP = object()
+
+class TarInfo(object):
+ """Informational class which holds the details about an
+ archive member given by a tar header block.
+ TarInfo objects are returned by TarFile.getmember(),
+ TarFile.getmembers() and TarFile.gettarinfo() and are
+ usually created internally.
+ """
+
+ __slots__ = dict(
+ name = 'Name of the archive member.',
+ mode = 'Permission bits.',
+ uid = 'User ID of the user who originally stored this member.',
+ gid = 'Group ID of the user who originally stored this member.',
+ size = 'Size in bytes.',
+ mtime = 'Time of last modification.',
+ chksum = 'Header checksum.',
+ type = ('File type. type is usually one of these constants: '
+ 'REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, '
+ 'CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.'),
+ linkname = ('Name of the target file name, which is only present '
+ 'in TarInfo objects of type LNKTYPE and SYMTYPE.'),
+ uname = 'User name.',
+ gname = 'Group name.',
+ devmajor = 'Device major number.',
+ devminor = 'Device minor number.',
+ offset = 'The tar header starts here.',
+ offset_data = "The file's data starts here.",
+ pax_headers = ('A dictionary containing key-value pairs of an '
+ 'associated pax extended header.'),
+ sparse = 'Sparse member information.',
+ _tarfile = None,
+ _sparse_structs = None,
+ _link_target = None,
+ )
+
+ def __init__(self, name=""):
+ """Construct a TarInfo object. name is the optional name
+ of the member.
+ """
+ self.name = name # member name
+ self.mode = 0o644 # file permissions
+ self.uid = 0 # user id
+ self.gid = 0 # group id
+ self.size = 0 # file size
+ self.mtime = 0 # modification time
+ self.chksum = 0 # header checksum
+ self.type = REGTYPE # member type
+ self.linkname = "" # link name
+ self.uname = "" # user name
+ self.gname = "" # group name
+ self.devmajor = 0 # device major number
+ self.devminor = 0 # device minor number
+
+ self.offset = 0 # the tar header starts here
+ self.offset_data = 0 # the file's data starts here
+
+ self.sparse = None # sparse member information
+ self.pax_headers = {} # pax header information
+
+ @property
+ def tarfile(self):
+ import warnings
+ warnings.warn(
+ 'The undocumented "tarfile" attribute of TarInfo objects '
+ + 'is deprecated and will be removed in Python 3.16',
+ DeprecationWarning, stacklevel=2)
+ return self._tarfile
+
+ @tarfile.setter
+ def tarfile(self, tarfile):
+ import warnings
+ warnings.warn(
+ 'The undocumented "tarfile" attribute of TarInfo objects '
+ + 'is deprecated and will be removed in Python 3.16',
+ DeprecationWarning, stacklevel=2)
+ self._tarfile = tarfile
+
+ @property
+ def path(self):
+ 'In pax headers, "name" is called "path".'
+ return self.name
+
+ @path.setter
+ def path(self, name):
+ self.name = name
+
+ @property
+ def linkpath(self):
+ 'In pax headers, "linkname" is called "linkpath".'
+ return self.linkname
+
+ @linkpath.setter
+ def linkpath(self, linkname):
+ self.linkname = linkname
+
+ def __repr__(self):
+ return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self))
+
+ def replace(self, *,
+ name=_KEEP, mtime=_KEEP, mode=_KEEP, linkname=_KEEP,
+ uid=_KEEP, gid=_KEEP, uname=_KEEP, gname=_KEEP,
+ deep=True, _KEEP=_KEEP):
+ """Return a deep copy of self with the given attributes replaced.
+ """
+ if deep:
+ result = copy.deepcopy(self)
+ else:
+ result = copy.copy(self)
+ if name is not _KEEP:
+ result.name = name
+ if mtime is not _KEEP:
+ result.mtime = mtime
+ if mode is not _KEEP:
+ result.mode = mode
+ if linkname is not _KEEP:
+ result.linkname = linkname
+ if uid is not _KEEP:
+ result.uid = uid
+ if gid is not _KEEP:
+ result.gid = gid
+ if uname is not _KEEP:
+ result.uname = uname
+ if gname is not _KEEP:
+ result.gname = gname
+ return result
+
+ def get_info(self):
+ """Return the TarInfo's attributes as a dictionary.
+ """
+ if self.mode is None:
+ mode = None
+ else:
+ mode = self.mode & 0o7777
+ info = {
+ "name": self.name,
+ "mode": mode,
+ "uid": self.uid,
+ "gid": self.gid,
+ "size": self.size,
+ "mtime": self.mtime,
+ "chksum": self.chksum,
+ "type": self.type,
+ "linkname": self.linkname,
+ "uname": self.uname,
+ "gname": self.gname,
+ "devmajor": self.devmajor,
+ "devminor": self.devminor
+ }
+
+ if info["type"] == DIRTYPE and not info["name"].endswith("/"):
+ info["name"] += "/"
+
+ return info
+
+ def tobuf(self, format=DEFAULT_FORMAT, encoding=ENCODING, errors="surrogateescape"):
+ """Return a tar header as a string of 512 byte blocks.
+ """
+ info = self.get_info()
+ for name, value in info.items():
+ if value is None:
+ raise ValueError("%s may not be None" % name)
+
+ if format == USTAR_FORMAT:
+ return self.create_ustar_header(info, encoding, errors)
+ elif format == GNU_FORMAT:
+ return self.create_gnu_header(info, encoding, errors)
+ elif format == PAX_FORMAT:
+ return self.create_pax_header(info, encoding)
+ else:
+ raise ValueError("invalid format")
+
+ def create_ustar_header(self, info, encoding, errors):
+ """Return the object as a ustar header block.
+ """
+ info["magic"] = POSIX_MAGIC
+
+ if len(info["linkname"].encode(encoding, errors)) > LENGTH_LINK:
+ raise ValueError("linkname is too long")
+
+ if len(info["name"].encode(encoding, errors)) > LENGTH_NAME:
+ info["prefix"], info["name"] = self._posix_split_name(info["name"], encoding, errors)
+
+ return self._create_header(info, USTAR_FORMAT, encoding, errors)
+
+ def create_gnu_header(self, info, encoding, errors):
+ """Return the object as a GNU header block sequence.
+ """
+ info["magic"] = GNU_MAGIC
+
+ buf = b""
+ if len(info["linkname"].encode(encoding, errors)) > LENGTH_LINK:
+ buf += self._create_gnu_long_header(info["linkname"], GNUTYPE_LONGLINK, encoding, errors)
+
+ if len(info["name"].encode(encoding, errors)) > LENGTH_NAME:
+ buf += self._create_gnu_long_header(info["name"], GNUTYPE_LONGNAME, encoding, errors)
+
+ return buf + self._create_header(info, GNU_FORMAT, encoding, errors)
+
+ def create_pax_header(self, info, encoding):
+ """Return the object as a ustar header block. If it cannot be
+ represented this way, prepend a pax extended header sequence
+ with supplement information.
+ """
+ info["magic"] = POSIX_MAGIC
+ pax_headers = self.pax_headers.copy()
+
+ # Test string fields for values that exceed the field length or cannot
+ # be represented in ASCII encoding.
+ for name, hname, length in (
+ ("name", "path", LENGTH_NAME), ("linkname", "linkpath", LENGTH_LINK),
+ ("uname", "uname", 32), ("gname", "gname", 32)):
+
+ if hname in pax_headers:
+ # The pax header has priority.
+ continue
+
+ # Try to encode the string as ASCII.
+ try:
+ info[name].encode("ascii", "strict")
+ except UnicodeEncodeError:
+ pax_headers[hname] = info[name]
+ continue
+
+ if len(info[name]) > length:
+ pax_headers[hname] = info[name]
+
+ # Test number fields for values that exceed the field limit or values
+ # that like to be stored as float.
+ for name, digits in (("uid", 8), ("gid", 8), ("size", 12), ("mtime", 12)):
+ needs_pax = False
+
+ val = info[name]
+ val_is_float = isinstance(val, float)
+ val_int = round(val) if val_is_float else val
+ if not 0 <= val_int < 8 ** (digits - 1):
+ # Avoid overflow.
+ info[name] = 0
+ needs_pax = True
+ elif val_is_float:
+ # Put rounded value in ustar header, and full
+ # precision value in pax header.
+ info[name] = val_int
+ needs_pax = True
+
+ # The existing pax header has priority.
+ if needs_pax and name not in pax_headers:
+ pax_headers[name] = str(val)
+
+ # Create a pax extended header if necessary.
+ if pax_headers:
+ buf = self._create_pax_generic_header(pax_headers, XHDTYPE, encoding)
+ else:
+ buf = b""
+
+ return buf + self._create_header(info, USTAR_FORMAT, "ascii", "replace")
+
+ @classmethod
+ def create_pax_global_header(cls, pax_headers):
+ """Return the object as a pax global header block sequence.
+ """
+ return cls._create_pax_generic_header(pax_headers, XGLTYPE, "utf-8")
+
+ def _posix_split_name(self, name, encoding, errors):
+ """Split a name longer than 100 chars into a prefix
+ and a name part.
+ """
+ components = name.split("/")
+ for i in range(1, len(components)):
+ prefix = "/".join(components[:i])
+ name = "/".join(components[i:])
+ if len(prefix.encode(encoding, errors)) <= LENGTH_PREFIX and \
+ len(name.encode(encoding, errors)) <= LENGTH_NAME:
+ break
+ else:
+ raise ValueError("name is too long")
+
+ return prefix, name
+
+ @staticmethod
+ def _create_header(info, format, encoding, errors):
+ """Return a header block. info is a dictionary with file
+ information, format must be one of the *_FORMAT constants.
+ """
+ has_device_fields = info.get("type") in (CHRTYPE, BLKTYPE)
+ if has_device_fields:
+ devmajor = itn(info.get("devmajor", 0), 8, format)
+ devminor = itn(info.get("devminor", 0), 8, format)
+ else:
+ devmajor = stn("", 8, encoding, errors)
+ devminor = stn("", 8, encoding, errors)
+
+ # None values in metadata should cause ValueError.
+ # itn()/stn() do this for all fields except type.
+ filetype = info.get("type", REGTYPE)
+ if filetype is None:
+ raise ValueError("TarInfo.type must not be None")
+
+ parts = [
+ stn(info.get("name", ""), 100, encoding, errors),
+ itn(info.get("mode", 0) & 0o7777, 8, format),
+ itn(info.get("uid", 0), 8, format),
+ itn(info.get("gid", 0), 8, format),
+ itn(info.get("size", 0), 12, format),
+ itn(info.get("mtime", 0), 12, format),
+ b" ", # checksum field
+ filetype,
+ stn(info.get("linkname", ""), 100, encoding, errors),
+ info.get("magic", POSIX_MAGIC),
+ stn(info.get("uname", ""), 32, encoding, errors),
+ stn(info.get("gname", ""), 32, encoding, errors),
+ devmajor,
+ devminor,
+ stn(info.get("prefix", ""), 155, encoding, errors)
+ ]
+
+ buf = struct.pack("%ds" % BLOCKSIZE, b"".join(parts))
+ chksum = calc_chksums(buf[-BLOCKSIZE:])[0]
+ buf = buf[:-364] + bytes("%06o\0" % chksum, "ascii") + buf[-357:]
+ return buf
+
+ @staticmethod
+ def _create_payload(payload):
+ """Return the string payload filled with zero bytes
+ up to the next 512 byte border.
+ """
+ blocks, remainder = divmod(len(payload), BLOCKSIZE)
+ if remainder > 0:
+ payload += (BLOCKSIZE - remainder) * NUL
+ return payload
+
+ @classmethod
+ def _create_gnu_long_header(cls, name, type, encoding, errors):
+ """Return a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
+ for name.
+ """
+ name = name.encode(encoding, errors) + NUL
+
+ info = {}
+ info["name"] = "././@LongLink"
+ info["type"] = type
+ info["size"] = len(name)
+ info["magic"] = GNU_MAGIC
+
+ # create extended header + name blocks.
+ return cls._create_header(info, USTAR_FORMAT, encoding, errors) + \
+ cls._create_payload(name)
+
+ @classmethod
+ def _create_pax_generic_header(cls, pax_headers, type, encoding):
+ """Return a POSIX.1-2008 extended or global header sequence
+ that contains a list of keyword, value pairs. The values
+ must be strings.
+ """
+ # Check if one of the fields contains surrogate characters and thereby
+ # forces hdrcharset=BINARY, see _proc_pax() for more information.
+ binary = False
+ for keyword, value in pax_headers.items():
+ try:
+ value.encode("utf-8", "strict")
+ except UnicodeEncodeError:
+ binary = True
+ break
+
+ records = b""
+ if binary:
+ # Put the hdrcharset field at the beginning of the header.
+ records += b"21 hdrcharset=BINARY\n"
+
+ for keyword, value in pax_headers.items():
+ keyword = keyword.encode("utf-8")
+ if binary:
+ # Try to restore the original byte representation of 'value'.
+ # Needless to say, that the encoding must match the string.
+ value = value.encode(encoding, "surrogateescape")
+ else:
+ value = value.encode("utf-8")
+
+ l = len(keyword) + len(value) + 3 # ' ' + '=' + '\n'
+ n = p = 0
+ while True:
+ n = l + len(str(p))
+ if n == p:
+ break
+ p = n
+ records += bytes(str(p), "ascii") + b" " + keyword + b"=" + value + b"\n"
+
+ # We use a hardcoded "././@PaxHeader" name like star does
+ # instead of the one that POSIX recommends.
+ info = {}
+ info["name"] = "././@PaxHeader"
+ info["type"] = type
+ info["size"] = len(records)
+ info["magic"] = POSIX_MAGIC
+
+ # Create pax header + record blocks.
+ return cls._create_header(info, USTAR_FORMAT, "ascii", "replace") + \
+ cls._create_payload(records)
+
+ @classmethod
+ def frombuf(cls, buf, encoding, errors):
+ """Construct a TarInfo object from a 512 byte bytes object.
+ """
+ if len(buf) == 0:
+ raise EmptyHeaderError("empty header")
+ if len(buf) != BLOCKSIZE:
+ raise TruncatedHeaderError("truncated header")
+ if buf.count(NUL) == BLOCKSIZE:
+ raise EOFHeaderError("end of file header")
+
+ chksum = nti(buf[148:156])
+ if chksum not in calc_chksums(buf):
+ raise InvalidHeaderError("bad checksum")
+
+ obj = cls()
+ obj.name = nts(buf[0:100], encoding, errors)
+ obj.mode = nti(buf[100:108])
+ obj.uid = nti(buf[108:116])
+ obj.gid = nti(buf[116:124])
+ obj.size = nti(buf[124:136])
+ obj.mtime = nti(buf[136:148])
+ obj.chksum = chksum
+ obj.type = buf[156:157]
+ obj.linkname = nts(buf[157:257], encoding, errors)
+ obj.uname = nts(buf[265:297], encoding, errors)
+ obj.gname = nts(buf[297:329], encoding, errors)
+ obj.devmajor = nti(buf[329:337])
+ obj.devminor = nti(buf[337:345])
+ prefix = nts(buf[345:500], encoding, errors)
+
+ # Old V7 tar format represents a directory as a regular
+ # file with a trailing slash.
+ if obj.type == AREGTYPE and obj.name.endswith("/"):
+ obj.type = DIRTYPE
+
+ # The old GNU sparse format occupies some of the unused
+ # space in the buffer for up to 4 sparse structures.
+ # Save them for later processing in _proc_sparse().
+ if obj.type == GNUTYPE_SPARSE:
+ pos = 386
+ structs = []
+ for i in range(4):
+ try:
+ offset = nti(buf[pos:pos + 12])
+ numbytes = nti(buf[pos + 12:pos + 24])
+ except ValueError:
+ break
+ structs.append((offset, numbytes))
+ pos += 24
+ isextended = bool(buf[482])
+ origsize = nti(buf[483:495])
+ obj._sparse_structs = (structs, isextended, origsize)
+
+ # Remove redundant slashes from directories.
+ if obj.isdir():
+ obj.name = obj.name.rstrip("/")
+
+ # Reconstruct a ustar longname.
+ if prefix and obj.type not in GNU_TYPES:
+ obj.name = prefix + "/" + obj.name
+ return obj
+
+ @classmethod
+ def fromtarfile(cls, tarfile):
+ """Return the next TarInfo object from TarFile object
+ tarfile.
+ """
+ buf = tarfile.fileobj.read(BLOCKSIZE)
+ obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
+ obj.offset = tarfile.fileobj.tell() - BLOCKSIZE
+ return obj._proc_member(tarfile)
+
+ #--------------------------------------------------------------------------
+ # The following are methods that are called depending on the type of a
+ # member. The entry point is _proc_member() which can be overridden in a
+ # subclass to add custom _proc_*() methods. A _proc_*() method MUST
+ # implement the following
+ # operations:
+ # 1. Set self.offset_data to the position where the data blocks begin,
+ # if there is data that follows.
+ # 2. Set tarfile.offset to the position where the next member's header will
+ # begin.
+ # 3. Return self or another valid TarInfo object.
+ def _proc_member(self, tarfile):
+ """Choose the right processing method depending on
+ the type and call it.
+ """
+ if self.type in (GNUTYPE_LONGNAME, GNUTYPE_LONGLINK):
+ return self._proc_gnulong(tarfile)
+ elif self.type == GNUTYPE_SPARSE:
+ return self._proc_sparse(tarfile)
+ elif self.type in (XHDTYPE, XGLTYPE, SOLARIS_XHDTYPE):
+ return self._proc_pax(tarfile)
+ else:
+ return self._proc_builtin(tarfile)
+
+ def _proc_builtin(self, tarfile):
+ """Process a builtin type or an unknown type which
+ will be treated as a regular file.
+ """
+ self.offset_data = tarfile.fileobj.tell()
+ offset = self.offset_data
+ if self.isreg() or self.type not in SUPPORTED_TYPES:
+ # Skip the following data blocks.
+ offset += self._block(self.size)
+ tarfile.offset = offset
+
+ # Patch the TarInfo object with saved global
+ # header information.
+ self._apply_pax_info(tarfile.pax_headers, tarfile.encoding, tarfile.errors)
+
+ # Remove redundant slashes from directories. This is to be consistent
+ # with frombuf().
+ if self.isdir():
+ self.name = self.name.rstrip("/")
+
+ return self
+
+ def _proc_gnulong(self, tarfile):
+ """Process the blocks that hold a GNU longname
+ or longlink member.
+ """
+ buf = tarfile.fileobj.read(self._block(self.size))
+
+ # Fetch the next header and process it.
+ try:
+ next = self.fromtarfile(tarfile)
+ except HeaderError as e:
+ raise SubsequentHeaderError(str(e)) from None
+
+ # Patch the TarInfo object from the next header with
+ # the longname information.
+ next.offset = self.offset
+ if self.type == GNUTYPE_LONGNAME:
+ next.name = nts(buf, tarfile.encoding, tarfile.errors)
+ elif self.type == GNUTYPE_LONGLINK:
+ next.linkname = nts(buf, tarfile.encoding, tarfile.errors)
+
+ # Remove redundant slashes from directories. This is to be consistent
+ # with frombuf().
+ if next.isdir():
+ next.name = removesuffix(next.name, "/")
+
+ return next
+
+ def _proc_sparse(self, tarfile):
+ """Process a GNU sparse header plus extra headers.
+ """
+ # We already collected some sparse structures in frombuf().
+ structs, isextended, origsize = self._sparse_structs
+ del self._sparse_structs
+
+ # Collect sparse structures from extended header blocks.
+ while isextended:
+ buf = tarfile.fileobj.read(BLOCKSIZE)
+ pos = 0
+ for i in range(21):
+ try:
+ offset = nti(buf[pos:pos + 12])
+ numbytes = nti(buf[pos + 12:pos + 24])
+ except ValueError:
+ break
+ if offset and numbytes:
+ structs.append((offset, numbytes))
+ pos += 24
+ isextended = bool(buf[504])
+ self.sparse = structs
+
+ self.offset_data = tarfile.fileobj.tell()
+ tarfile.offset = self.offset_data + self._block(self.size)
+ self.size = origsize
+ return self
+
+ def _proc_pax(self, tarfile):
+ """Process an extended or global header as described in
+ POSIX.1-2008.
+ """
+ # Read the header information.
+ buf = tarfile.fileobj.read(self._block(self.size))
+
+ # A pax header stores supplemental information for either
+ # the following file (extended) or all following files
+ # (global).
+ if self.type == XGLTYPE:
+ pax_headers = tarfile.pax_headers
+ else:
+ pax_headers = tarfile.pax_headers.copy()
+
+ # Check if the pax header contains a hdrcharset field. This tells us
+ # the encoding of the path, linkpath, uname and gname fields. Normally,
+ # these fields are UTF-8 encoded but since POSIX.1-2008 tar
+ # implementations are allowed to store them as raw binary strings if
+ # the translation to UTF-8 fails.
+ match = re.search(br"\d+ hdrcharset=([^\n]+)\n", buf)
+ if match is not None:
+ pax_headers["hdrcharset"] = match.group(1).decode("utf-8")
+
+ # For the time being, we don't care about anything other than "BINARY".
+ # The only other value that is currently allowed by the standard is
+ # "ISO-IR 10646 2000 UTF-8" in other words UTF-8.
+ hdrcharset = pax_headers.get("hdrcharset")
+ if hdrcharset == "BINARY":
+ encoding = tarfile.encoding
+ else:
+ encoding = "utf-8"
+
+ # Parse pax header information. A record looks like that:
+ # "%d %s=%s\n" % (length, keyword, value). length is the size
+ # of the complete record including the length field itself and
+ # the newline. keyword and value are both UTF-8 encoded strings.
+ regex = re.compile(br"(\d+) ([^=]+)=")
+ pos = 0
+ while match := regex.match(buf, pos):
+ length, keyword = match.groups()
+ length = int(length)
+ if length == 0:
+ raise InvalidHeaderError("invalid header")
+ value = buf[match.end(2) + 1:match.start(1) + length - 1]
+
+ # Normally, we could just use "utf-8" as the encoding and "strict"
+ # as the error handler, but we better not take the risk. For
+ # example, GNU tar <= 1.23 is known to store filenames it cannot
+ # translate to UTF-8 as raw strings (unfortunately without a
+ # hdrcharset=BINARY header).
+ # We first try the strict standard encoding, and if that fails we
+ # fall back on the user's encoding and error handler.
+ keyword = self._decode_pax_field(keyword, "utf-8", "utf-8",
+ tarfile.errors)
+ if keyword in PAX_NAME_FIELDS:
+ value = self._decode_pax_field(value, encoding, tarfile.encoding,
+ tarfile.errors)
+ else:
+ value = self._decode_pax_field(value, "utf-8", "utf-8",
+ tarfile.errors)
+
+ pax_headers[keyword] = value
+ pos += length
+
+ # Fetch the next header.
+ try:
+ next = self.fromtarfile(tarfile)
+ except HeaderError as e:
+ raise SubsequentHeaderError(str(e)) from None
+
+ # Process GNU sparse information.
+ if "GNU.sparse.map" in pax_headers:
+ # GNU extended sparse format version 0.1.
+ self._proc_gnusparse_01(next, pax_headers)
+
+ elif "GNU.sparse.size" in pax_headers:
+ # GNU extended sparse format version 0.0.
+ self._proc_gnusparse_00(next, pax_headers, buf)
+
+ elif pax_headers.get("GNU.sparse.major") == "1" and pax_headers.get("GNU.sparse.minor") == "0":
+ # GNU extended sparse format version 1.0.
+ self._proc_gnusparse_10(next, pax_headers, tarfile)
+
+ if self.type in (XHDTYPE, SOLARIS_XHDTYPE):
+ # Patch the TarInfo object with the extended header info.
+ next._apply_pax_info(pax_headers, tarfile.encoding, tarfile.errors)
+ next.offset = self.offset
+
+ if "size" in pax_headers:
+ # If the extended header replaces the size field,
+ # we need to recalculate the offset where the next
+ # header starts.
+ offset = next.offset_data
+ if next.isreg() or next.type not in SUPPORTED_TYPES:
+ offset += next._block(next.size)
+ tarfile.offset = offset
+
+ return next
+
+ def _proc_gnusparse_00(self, next, pax_headers, buf):
+ """Process a GNU tar extended sparse header, version 0.0.
+ """
+ offsets = []
+ for match in re.finditer(br"\d+ GNU.sparse.offset=(\d+)\n", buf):
+ offsets.append(int(match.group(1)))
+ numbytes = []
+ for match in re.finditer(br"\d+ GNU.sparse.numbytes=(\d+)\n", buf):
+ numbytes.append(int(match.group(1)))
+ next.sparse = list(zip(offsets, numbytes))
+
+ def _proc_gnusparse_01(self, next, pax_headers):
+ """Process a GNU tar extended sparse header, version 0.1.
+ """
+ sparse = [int(x) for x in pax_headers["GNU.sparse.map"].split(",")]
+ next.sparse = list(zip(sparse[::2], sparse[1::2]))
+
+ def _proc_gnusparse_10(self, next, pax_headers, tarfile):
+ """Process a GNU tar extended sparse header, version 1.0.
+ """
+ fields = None
+ sparse = []
+ buf = tarfile.fileobj.read(BLOCKSIZE)
+ fields, buf = buf.split(b"\n", 1)
+ fields = int(fields)
+ while len(sparse) < fields * 2:
+ if b"\n" not in buf:
+ buf += tarfile.fileobj.read(BLOCKSIZE)
+ number, buf = buf.split(b"\n", 1)
+ sparse.append(int(number))
+ next.offset_data = tarfile.fileobj.tell()
+ next.sparse = list(zip(sparse[::2], sparse[1::2]))
+
+ def _apply_pax_info(self, pax_headers, encoding, errors):
+ """Replace fields with supplemental information from a previous
+ pax extended or global header.
+ """
+ for keyword, value in pax_headers.items():
+ if keyword == "GNU.sparse.name":
+ setattr(self, "path", value)
+ elif keyword == "GNU.sparse.size":
+ setattr(self, "size", int(value))
+ elif keyword == "GNU.sparse.realsize":
+ setattr(self, "size", int(value))
+ elif keyword in PAX_FIELDS:
+ if keyword in PAX_NUMBER_FIELDS:
+ try:
+ value = PAX_NUMBER_FIELDS[keyword](value)
+ except ValueError:
+ value = 0
+ if keyword == "path":
+ value = value.rstrip("/")
+ setattr(self, keyword, value)
+
+ self.pax_headers = pax_headers.copy()
+
+ def _decode_pax_field(self, value, encoding, fallback_encoding, fallback_errors):
+ """Decode a single field from a pax record.
+ """
+ try:
+ return value.decode(encoding, "strict")
+ except UnicodeDecodeError:
+ return value.decode(fallback_encoding, fallback_errors)
+
+ def _block(self, count):
+ """Round up a byte count by BLOCKSIZE and return it,
+ e.g. _block(834) => 1024.
+ """
+ blocks, remainder = divmod(count, BLOCKSIZE)
+ if remainder:
+ blocks += 1
+ return blocks * BLOCKSIZE
+
+ def isreg(self):
+ 'Return True if the Tarinfo object is a regular file.'
+ return self.type in REGULAR_TYPES
+
+ def isfile(self):
+ 'Return True if the Tarinfo object is a regular file.'
+ return self.isreg()
+
+ def isdir(self):
+ 'Return True if it is a directory.'
+ return self.type == DIRTYPE
+
+ def issym(self):
+ 'Return True if it is a symbolic link.'
+ return self.type == SYMTYPE
+
+ def islnk(self):
+ 'Return True if it is a hard link.'
+ return self.type == LNKTYPE
+
+ def ischr(self):
+ 'Return True if it is a character device.'
+ return self.type == CHRTYPE
+
+ def isblk(self):
+ 'Return True if it is a block device.'
+ return self.type == BLKTYPE
+
+ def isfifo(self):
+ 'Return True if it is a FIFO.'
+ return self.type == FIFOTYPE
+
+ def issparse(self):
+ return self.sparse is not None
+
+ def isdev(self):
+ 'Return True if it is one of character device, block device or FIFO.'
+ return self.type in (CHRTYPE, BLKTYPE, FIFOTYPE)
+# class TarInfo
+
+class TarFile(object):
+ """The TarFile Class provides an interface to tar archives.
+ """
+
+ debug = 0 # May be set from 0 (no msgs) to 3 (all msgs)
+
+ dereference = False # If true, add content of linked file to the
+ # tar file, else the link.
+
+ ignore_zeros = False # If true, skips empty or invalid blocks and
+ # continues processing.
+
+ errorlevel = 1 # If 0, fatal errors only appear in debug
+ # messages (if debug >= 0). If > 0, errors
+ # are passed to the caller as exceptions.
+
+ format = DEFAULT_FORMAT # The format to use when creating an archive.
+
+ encoding = ENCODING # Encoding for 8-bit character strings.
+
+ errors = None # Error handler for unicode conversion.
+
+ tarinfo = TarInfo # The default TarInfo class to use.
+
+ fileobject = ExFileObject # The file-object for extractfile().
+
+ extraction_filter = None # The default filter for extraction.
+
+ def __init__(self, name=None, mode="r", fileobj=None, format=None,
+ tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
+ errors="surrogateescape", pax_headers=None, debug=None,
+ errorlevel=None, copybufsize=None, stream=False):
+ """Open an (uncompressed) tar archive 'name'. 'mode' is either 'r' to
+ read from an existing archive, 'a' to append data to an existing
+ file or 'w' to create a new file overwriting an existing one. 'mode'
+ defaults to 'r'.
+ If 'fileobj' is given, it is used for reading or writing data. If it
+ can be determined, 'mode' is overridden by 'fileobj's mode.
+ 'fileobj' is not closed, when TarFile is closed.
+ """
+ modes = {"r": "rb", "a": "r+b", "w": "wb", "x": "xb"}
+ if mode not in modes:
+ raise ValueError("mode must be 'r', 'a', 'w' or 'x'")
+ self.mode = mode
+ self._mode = modes[mode]
+
+ if not fileobj:
+ if self.mode == "a" and not os.path.exists(name):
+ # Create nonexistent files in append mode.
+ self.mode = "w"
+ self._mode = "wb"
+ fileobj = bltn_open(name, self._mode)
+ self._extfileobj = False
+ else:
+ if (name is None and hasattr(fileobj, "name") and
+ isinstance(fileobj.name, (str, bytes))):
+ name = fileobj.name
+ if hasattr(fileobj, "mode"):
+ self._mode = fileobj.mode
+ self._extfileobj = True
+ self.name = os.path.abspath(name) if name else None
+ self.fileobj = fileobj
+
+ self.stream = stream
+
+ # Init attributes.
+ if format is not None:
+ self.format = format
+ if tarinfo is not None:
+ self.tarinfo = tarinfo
+ if dereference is not None:
+ self.dereference = dereference
+ if ignore_zeros is not None:
+ self.ignore_zeros = ignore_zeros
+ if encoding is not None:
+ self.encoding = encoding
+ self.errors = errors
+
+ if pax_headers is not None and self.format == PAX_FORMAT:
+ self.pax_headers = pax_headers
+ else:
+ self.pax_headers = {}
+
+ if debug is not None:
+ self.debug = debug
+ if errorlevel is not None:
+ self.errorlevel = errorlevel
+
+ # Init datastructures.
+ self.copybufsize = copybufsize
+ self.closed = False
+ self.members = [] # list of members as TarInfo objects
+ self._loaded = False # flag if all members have been read
+ self.offset = self.fileobj.tell()
+ # current position in the archive file
+ self.inodes = {} # dictionary caching the inodes of
+ # archive members already added
+
+ try:
+ if self.mode == "r":
+ self.firstmember = None
+ self.firstmember = self.next()
+
+ if self.mode == "a":
+ # Move to the end of the archive,
+ # before the first empty block.
+ while True:
+ self.fileobj.seek(self.offset)
+ try:
+ tarinfo = self.tarinfo.fromtarfile(self)
+ self.members.append(tarinfo)
+ except EOFHeaderError:
+ self.fileobj.seek(self.offset)
+ break
+ except HeaderError as e:
+ raise ReadError(str(e)) from None
+
+ if self.mode in ("a", "w", "x"):
+ self._loaded = True
+
+ if self.pax_headers:
+ buf = self.tarinfo.create_pax_global_header(self.pax_headers.copy())
+ self.fileobj.write(buf)
+ self.offset += len(buf)
+ except:
+ if not self._extfileobj:
+ self.fileobj.close()
+ self.closed = True
+ raise
+
+ #--------------------------------------------------------------------------
+ # Below are the classmethods which act as alternate constructors to the
+ # TarFile class. The open() method is the only one that is needed for
+ # public use; it is the "super"-constructor and is able to select an
+ # adequate "sub"-constructor for a particular compression using the mapping
+ # from OPEN_METH.
+ #
+ # This concept allows one to subclass TarFile without losing the comfort of
+ # the super-constructor. A sub-constructor is registered and made available
+ # by adding it to the mapping in OPEN_METH.
+
+ @classmethod
+ def open(cls, name=None, mode="r", fileobj=None, bufsize=RECORDSIZE, **kwargs):
+ r"""Open a tar archive for reading, writing or appending. Return
+ an appropriate TarFile class.
+
+ mode:
+ 'r' or 'r:\*' open for reading with transparent compression
+ 'r:' open for reading exclusively uncompressed
+ 'r:gz' open for reading with gzip compression
+ 'r:bz2' open for reading with bzip2 compression
+ 'r:xz' open for reading with lzma compression
+ 'a' or 'a:' open for appending, creating the file if necessary
+ 'w' or 'w:' open for writing without compression
+ 'w:gz' open for writing with gzip compression
+ 'w:bz2' open for writing with bzip2 compression
+ 'w:xz' open for writing with lzma compression
+
+ 'x' or 'x:' create a tarfile exclusively without compression, raise
+ an exception if the file is already created
+ 'x:gz' create a gzip compressed tarfile, raise an exception
+ if the file is already created
+ 'x:bz2' create a bzip2 compressed tarfile, raise an exception
+ if the file is already created
+ 'x:xz' create an lzma compressed tarfile, raise an exception
+ if the file is already created
+
+ 'r|\*' open a stream of tar blocks with transparent compression
+ 'r|' open an uncompressed stream of tar blocks for reading
+ 'r|gz' open a gzip compressed stream of tar blocks
+ 'r|bz2' open a bzip2 compressed stream of tar blocks
+ 'r|xz' open an lzma compressed stream of tar blocks
+ 'w|' open an uncompressed stream for writing
+ 'w|gz' open a gzip compressed stream for writing
+ 'w|bz2' open a bzip2 compressed stream for writing
+ 'w|xz' open an lzma compressed stream for writing
+ """
+
+ if not name and not fileobj:
+ raise ValueError("nothing to open")
+
+ if mode in ("r", "r:*"):
+ # Find out which *open() is appropriate for opening the file.
+ def not_compressed(comptype):
+ return cls.OPEN_METH[comptype] == 'taropen'
+ error_msgs = []
+ for comptype in sorted(cls.OPEN_METH, key=not_compressed):
+ func = getattr(cls, cls.OPEN_METH[comptype])
+ if fileobj is not None:
+ saved_pos = fileobj.tell()
+ try:
+ return func(name, "r", fileobj, **kwargs)
+ except (ReadError, CompressionError) as e:
+ error_msgs.append(f'- method {comptype}: {e!r}')
+ if fileobj is not None:
+ fileobj.seek(saved_pos)
+ continue
+ error_msgs_summary = '\n'.join(error_msgs)
+ raise ReadError(f"file could not be opened successfully:\n{error_msgs_summary}")
+
+ elif ":" in mode:
+ filemode, comptype = mode.split(":", 1)
+ filemode = filemode or "r"
+ comptype = comptype or "tar"
+
+ # Select the *open() function according to
+ # given compression.
+ if comptype in cls.OPEN_METH:
+ func = getattr(cls, cls.OPEN_METH[comptype])
+ else:
+ raise CompressionError("unknown compression type %r" % comptype)
+ return func(name, filemode, fileobj, **kwargs)
+
+ elif "|" in mode:
+ filemode, comptype = mode.split("|", 1)
+ filemode = filemode or "r"
+ comptype = comptype or "tar"
+
+ if filemode not in ("r", "w"):
+ raise ValueError("mode must be 'r' or 'w'")
+
+ compresslevel = kwargs.pop("compresslevel", 9)
+ stream = _Stream(name, filemode, comptype, fileobj, bufsize,
+ compresslevel)
+ try:
+ t = cls(name, filemode, stream, **kwargs)
+ except:
+ stream.close()
+ raise
+ t._extfileobj = False
+ return t
+
+ elif mode in ("a", "w", "x"):
+ return cls.taropen(name, mode, fileobj, **kwargs)
+
+ raise ValueError("undiscernible mode")
+
+ @classmethod
+ def taropen(cls, name, mode="r", fileobj=None, **kwargs):
+ """Open uncompressed tar archive name for reading or writing.
+ """
+ if mode not in ("r", "a", "w", "x"):
+ raise ValueError("mode must be 'r', 'a', 'w' or 'x'")
+ return cls(name, mode, fileobj, **kwargs)
+
+ @classmethod
+ def gzopen(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
+ """Open gzip compressed tar archive name for reading or writing.
+ Appending is not allowed.
+ """
+ if mode not in ("r", "w", "x"):
+ raise ValueError("mode must be 'r', 'w' or 'x'")
+
+ try:
+ from gzip import GzipFile
+ except ImportError:
+ raise CompressionError("gzip module is not available") from None
+
+ try:
+ fileobj = GzipFile(name, mode + "b", compresslevel, fileobj)
+ except OSError as e:
+ if fileobj is not None and mode == 'r':
+ raise ReadError("not a gzip file") from e
+ raise
+
+ try:
+ t = cls.taropen(name, mode, fileobj, **kwargs)
+ except OSError as e:
+ fileobj.close()
+ if mode == 'r':
+ raise ReadError("not a gzip file") from e
+ raise
+ except:
+ fileobj.close()
+ raise
+ t._extfileobj = False
+ return t
+
+ @classmethod
+ def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9, **kwargs):
+ """Open bzip2 compressed tar archive name for reading or writing.
+ Appending is not allowed.
+ """
+ if mode not in ("r", "w", "x"):
+ raise ValueError("mode must be 'r', 'w' or 'x'")
+
+ try:
+ from bz2 import BZ2File
+ except ImportError:
+ raise CompressionError("bz2 module is not available") from None
+
+ fileobj = BZ2File(fileobj or name, mode, compresslevel=compresslevel)
+
+ try:
+ t = cls.taropen(name, mode, fileobj, **kwargs)
+ except (OSError, EOFError) as e:
+ fileobj.close()
+ if mode == 'r':
+ raise ReadError("not a bzip2 file") from e
+ raise
+ except:
+ fileobj.close()
+ raise
+ t._extfileobj = False
+ return t
+
+ @classmethod
+ def xzopen(cls, name, mode="r", fileobj=None, preset=None, **kwargs):
+ """Open lzma compressed tar archive name for reading or writing.
+ Appending is not allowed.
+ """
+ if mode not in ("r", "w", "x"):
+ raise ValueError("mode must be 'r', 'w' or 'x'")
+
+ try:
+ from lzma import LZMAFile, LZMAError
+ except ImportError:
+ raise CompressionError("lzma module is not available") from None
+
+ fileobj = LZMAFile(fileobj or name, mode, preset=preset)
+
+ try:
+ t = cls.taropen(name, mode, fileobj, **kwargs)
+ except (LZMAError, EOFError) as e:
+ fileobj.close()
+ if mode == 'r':
+ raise ReadError("not an lzma file") from e
+ raise
+ except:
+ fileobj.close()
+ raise
+ t._extfileobj = False
+ return t
+
+ # All *open() methods are registered here.
+ OPEN_METH = {
+ "tar": "taropen", # uncompressed tar
+ "gz": "gzopen", # gzip compressed tar
+ "bz2": "bz2open", # bzip2 compressed tar
+ "xz": "xzopen" # lzma compressed tar
+ }
+
+ #--------------------------------------------------------------------------
+ # The public methods which TarFile provides:
+
+ def close(self):
+ """Close the TarFile. In write-mode, two finishing zero blocks are
+ appended to the archive.
+ """
+ if self.closed:
+ return
+
+ self.closed = True
+ try:
+ if self.mode in ("a", "w", "x"):
+ self.fileobj.write(NUL * (BLOCKSIZE * 2))
+ self.offset += (BLOCKSIZE * 2)
+ # fill up the end with zero-blocks
+ # (like option -b20 for tar does)
+ blocks, remainder = divmod(self.offset, RECORDSIZE)
+ if remainder > 0:
+ self.fileobj.write(NUL * (RECORDSIZE - remainder))
+ finally:
+ if not self._extfileobj:
+ self.fileobj.close()
+
+ def getmember(self, name):
+ """Return a TarInfo object for member 'name'. If 'name' can not be
+ found in the archive, KeyError is raised. If a member occurs more
+ than once in the archive, its last occurrence is assumed to be the
+ most up-to-date version.
+ """
+ tarinfo = self._getmember(name.rstrip('/'))
+ if tarinfo is None:
+ raise KeyError("filename %r not found" % name)
+ return tarinfo
+
+ def getmembers(self):
+ """Return the members of the archive as a list of TarInfo objects. The
+ list has the same order as the members in the archive.
+ """
+ self._check()
+ if not self._loaded: # if we want to obtain a list of
+ self._load() # all members, we first have to
+ # scan the whole archive.
+ return self.members
+
+ def getnames(self):
+ """Return the members of the archive as a list of their names. It has
+ the same order as the list returned by getmembers().
+ """
+ return [tarinfo.name for tarinfo in self.getmembers()]
+
+ def gettarinfo(self, name=None, arcname=None, fileobj=None):
+ """Create a TarInfo object from the result of os.stat or equivalent
+ on an existing file. The file is either named by 'name', or
+ specified as a file object 'fileobj' with a file descriptor. If
+ given, 'arcname' specifies an alternative name for the file in the
+ archive, otherwise, the name is taken from the 'name' attribute of
+ 'fileobj', or the 'name' argument. The name should be a text
+ string.
+ """
+ self._check("awx")
+
+ # When fileobj is given, replace name by
+ # fileobj's real name.
+ if fileobj is not None:
+ name = fileobj.name
+
+ # Building the name of the member in the archive.
+ # Backward slashes are converted to forward slashes,
+ # Absolute paths are turned to relative paths.
+ if arcname is None:
+ arcname = name
+ drv, arcname = os.path.splitdrive(arcname)
+ arcname = arcname.replace(os.sep, "/")
+ arcname = arcname.lstrip("/")
+
+ # Now, fill the TarInfo object with
+ # information specific for the file.
+ tarinfo = self.tarinfo()
+ tarinfo._tarfile = self # To be removed in 3.16.
+
+ # Use os.stat or os.lstat, depending on if symlinks shall be resolved.
+ if fileobj is None:
+ if not self.dereference:
+ statres = os.lstat(name)
+ else:
+ statres = os.stat(name)
+ else:
+ statres = os.fstat(fileobj.fileno())
+ linkname = ""
+
+ stmd = statres.st_mode
+ if stat.S_ISREG(stmd):
+ inode = (statres.st_ino, statres.st_dev)
+ if not self.dereference and statres.st_nlink > 1 and \
+ inode in self.inodes and arcname != self.inodes[inode]:
+ # Is it a hardlink to an already
+ # archived file?
+ type = LNKTYPE
+ linkname = self.inodes[inode]
+ else:
+ # The inode is added only if its valid.
+ # For win32 it is always 0.
+ type = REGTYPE
+ if inode[0]:
+ self.inodes[inode] = arcname
+ elif stat.S_ISDIR(stmd):
+ type = DIRTYPE
+ elif stat.S_ISFIFO(stmd):
+ type = FIFOTYPE
+ elif stat.S_ISLNK(stmd):
+ type = SYMTYPE
+ linkname = os.readlink(name)
+ elif stat.S_ISCHR(stmd):
+ type = CHRTYPE
+ elif stat.S_ISBLK(stmd):
+ type = BLKTYPE
+ else:
+ return None
+
+ # Fill the TarInfo object with all
+ # information we can get.
+ tarinfo.name = arcname
+ tarinfo.mode = stmd
+ tarinfo.uid = statres.st_uid
+ tarinfo.gid = statres.st_gid
+ if type == REGTYPE:
+ tarinfo.size = statres.st_size
+ else:
+ tarinfo.size = 0
+ tarinfo.mtime = statres.st_mtime
+ tarinfo.type = type
+ tarinfo.linkname = linkname
+ if pwd:
+ try:
+ tarinfo.uname = pwd.getpwuid(tarinfo.uid)[0]
+ except KeyError:
+ pass
+ if grp:
+ try:
+ tarinfo.gname = grp.getgrgid(tarinfo.gid)[0]
+ except KeyError:
+ pass
+
+ if type in (CHRTYPE, BLKTYPE):
+ if hasattr(os, "major") and hasattr(os, "minor"):
+ tarinfo.devmajor = os.major(statres.st_rdev)
+ tarinfo.devminor = os.minor(statres.st_rdev)
+ return tarinfo
+
+ def list(self, verbose=True, *, members=None):
+ """Print a table of contents to sys.stdout. If 'verbose' is False, only
+ the names of the members are printed. If it is True, an 'ls -l'-like
+ output is produced. 'members' is optional and must be a subset of the
+ list returned by getmembers().
+ """
+ # Convert tarinfo type to stat type.
+ type2mode = {REGTYPE: stat.S_IFREG, SYMTYPE: stat.S_IFLNK,
+ FIFOTYPE: stat.S_IFIFO, CHRTYPE: stat.S_IFCHR,
+ DIRTYPE: stat.S_IFDIR, BLKTYPE: stat.S_IFBLK}
+ self._check()
+
+ if members is None:
+ members = self
+ for tarinfo in members:
+ if verbose:
+ if tarinfo.mode is None:
+ _safe_print("??????????")
+ else:
+ modetype = type2mode.get(tarinfo.type, 0)
+ _safe_print(stat.filemode(modetype | tarinfo.mode))
+ _safe_print("%s/%s" % (tarinfo.uname or tarinfo.uid,
+ tarinfo.gname or tarinfo.gid))
+ if tarinfo.ischr() or tarinfo.isblk():
+ _safe_print("%10s" %
+ ("%d,%d" % (tarinfo.devmajor, tarinfo.devminor)))
+ else:
+ _safe_print("%10d" % tarinfo.size)
+ if tarinfo.mtime is None:
+ _safe_print("????-??-?? ??:??:??")
+ else:
+ _safe_print("%d-%02d-%02d %02d:%02d:%02d" \
+ % time.localtime(tarinfo.mtime)[:6])
+
+ _safe_print(tarinfo.name + ("/" if tarinfo.isdir() else ""))
+
+ if verbose:
+ if tarinfo.issym():
+ _safe_print("-> " + tarinfo.linkname)
+ if tarinfo.islnk():
+ _safe_print("link to " + tarinfo.linkname)
+ print()
+
+ def add(self, name, arcname=None, recursive=True, *, filter=None):
+ """Add the file 'name' to the archive. 'name' may be any type of file
+ (directory, fifo, symbolic link, etc.). If given, 'arcname'
+ specifies an alternative name for the file in the archive.
+ Directories are added recursively by default. This can be avoided by
+ setting 'recursive' to False. 'filter' is a function
+ that expects a TarInfo object argument and returns the changed
+ TarInfo object, if it returns None the TarInfo object will be
+ excluded from the archive.
+ """
+ self._check("awx")
+
+ if arcname is None:
+ arcname = name
+
+ # Skip if somebody tries to archive the archive...
+ if self.name is not None and os.path.abspath(name) == self.name:
+ self._dbg(2, "tarfile: Skipped %r" % name)
+ return
+
+ self._dbg(1, name)
+
+ # Create a TarInfo object from the file.
+ tarinfo = self.gettarinfo(name, arcname)
+
+ if tarinfo is None:
+ self._dbg(1, "tarfile: Unsupported type %r" % name)
+ return
+
+ # Change or exclude the TarInfo object.
+ if filter is not None:
+ tarinfo = filter(tarinfo)
+ if tarinfo is None:
+ self._dbg(2, "tarfile: Excluded %r" % name)
+ return
+
+ # Append the tar header and data to the archive.
+ if tarinfo.isreg():
+ with bltn_open(name, "rb") as f:
+ self.addfile(tarinfo, f)
+
+ elif tarinfo.isdir():
+ self.addfile(tarinfo)
+ if recursive:
+ for f in sorted(os.listdir(name)):
+ self.add(os.path.join(name, f), os.path.join(arcname, f),
+ recursive, filter=filter)
+
+ else:
+ self.addfile(tarinfo)
+
+ def addfile(self, tarinfo, fileobj=None):
+ """Add the TarInfo object 'tarinfo' to the archive. If 'tarinfo' represents
+ a non zero-size regular file, the 'fileobj' argument should be a binary file,
+ and tarinfo.size bytes are read from it and added to the archive.
+ You can create TarInfo objects directly, or by using gettarinfo().
+ """
+ self._check("awx")
+
+ if fileobj is None and tarinfo.isreg() and tarinfo.size != 0:
+ raise ValueError("fileobj not provided for non zero-size regular file")
+
+ tarinfo = copy.copy(tarinfo)
+
+ buf = tarinfo.tobuf(self.format, self.encoding, self.errors)
+ self.fileobj.write(buf)
+ self.offset += len(buf)
+ bufsize=self.copybufsize
+ # If there's data to follow, append it.
+ if fileobj is not None:
+ copyfileobj(fileobj, self.fileobj, tarinfo.size, bufsize=bufsize)
+ blocks, remainder = divmod(tarinfo.size, BLOCKSIZE)
+ if remainder > 0:
+ self.fileobj.write(NUL * (BLOCKSIZE - remainder))
+ blocks += 1
+ self.offset += blocks * BLOCKSIZE
+
+ self.members.append(tarinfo)
+
+ def _get_filter_function(self, filter):
+ if filter is None:
+ filter = self.extraction_filter
+ if filter is None:
+ import warnings
+ warnings.warn(
+ 'Python 3.14 will, by default, filter extracted tar '
+ + 'archives and reject files or modify their metadata. '
+ + 'Use the filter argument to control this behavior.',
+ DeprecationWarning, stacklevel=3)
+ return fully_trusted_filter
+ if isinstance(filter, str):
+ raise TypeError(
+ 'String names are not supported for '
+ + 'TarFile.extraction_filter. Use a function such as '
+ + 'tarfile.data_filter directly.')
+ return filter
+ if callable(filter):
+ return filter
+ try:
+ return _NAMED_FILTERS[filter]
+ except KeyError:
+ raise ValueError(f"filter {filter!r} not found") from None
+
+ def extractall(self, path=".", members=None, *, numeric_owner=False,
+ filter=None):
+ """Extract all members from the archive to the current working
+ directory and set owner, modification time and permissions on
+ directories afterwards. 'path' specifies a different directory
+ to extract to. 'members' is optional and must be a subset of the
+ list returned by getmembers(). If 'numeric_owner' is True, only
+ the numbers for user/group names are used and not the names.
+
+ The 'filter' function will be called on each member just
+ before extraction.
+ It can return a changed TarInfo or None to skip the member.
+ String names of common filters are accepted.
+ """
+ directories = []
+
+ filter_function = self._get_filter_function(filter)
+ if members is None:
+ members = self
+
+ for member in members:
+ tarinfo = self._get_extract_tarinfo(member, filter_function, path)
+ if tarinfo is None:
+ continue
+ if tarinfo.isdir():
+ # For directories, delay setting attributes until later,
+ # since permissions can interfere with extraction and
+ # extracting contents can reset mtime.
+ directories.append(tarinfo)
+ self._extract_one(tarinfo, path, set_attrs=not tarinfo.isdir(),
+ numeric_owner=numeric_owner)
+
+ # Reverse sort directories.
+ directories.sort(key=lambda a: a.name, reverse=True)
+
+ # Set correct owner, mtime and filemode on directories.
+ for tarinfo in directories:
+ dirpath = os.path.join(path, tarinfo.name)
+ try:
+ self.chown(tarinfo, dirpath, numeric_owner=numeric_owner)
+ self.utime(tarinfo, dirpath)
+ self.chmod(tarinfo, dirpath)
+ except ExtractError as e:
+ self._handle_nonfatal_error(e)
+
+ def extract(self, member, path="", set_attrs=True, *, numeric_owner=False,
+ filter=None):
+ """Extract a member from the archive to the current working directory,
+ using its full name. Its file information is extracted as accurately
+ as possible. 'member' may be a filename or a TarInfo object. You can
+ specify a different directory using 'path'. File attributes (owner,
+ mtime, mode) are set unless 'set_attrs' is False. If 'numeric_owner'
+ is True, only the numbers for user/group names are used and not
+ the names.
+
+ The 'filter' function will be called before extraction.
+ It can return a changed TarInfo or None to skip the member.
+ String names of common filters are accepted.
+ """
+ filter_function = self._get_filter_function(filter)
+ tarinfo = self._get_extract_tarinfo(member, filter_function, path)
+ if tarinfo is not None:
+ self._extract_one(tarinfo, path, set_attrs, numeric_owner)
+
+ def _get_extract_tarinfo(self, member, filter_function, path):
+ """Get filtered TarInfo (or None) from member, which might be a str"""
+ if isinstance(member, str):
+ tarinfo = self.getmember(member)
+ else:
+ tarinfo = member
+
+ unfiltered = tarinfo
+ try:
+ tarinfo = filter_function(tarinfo, path)
+ except (OSError, FilterError) as e:
+ self._handle_fatal_error(e)
+ except ExtractError as e:
+ self._handle_nonfatal_error(e)
+ if tarinfo is None:
+ self._dbg(2, "tarfile: Excluded %r" % unfiltered.name)
+ return None
+ # Prepare the link target for makelink().
+ if tarinfo.islnk():
+ tarinfo = copy.copy(tarinfo)
+ tarinfo._link_target = os.path.join(path, tarinfo.linkname)
+ return tarinfo
+
+ def _extract_one(self, tarinfo, path, set_attrs, numeric_owner):
+ """Extract from filtered tarinfo to disk"""
+ self._check("r")
+
+ try:
+ self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
+ set_attrs=set_attrs,
+ numeric_owner=numeric_owner)
+ except OSError as e:
+ self._handle_fatal_error(e)
+ except ExtractError as e:
+ self._handle_nonfatal_error(e)
+
+ def _handle_nonfatal_error(self, e):
+ """Handle non-fatal error (ExtractError) according to errorlevel"""
+ if self.errorlevel > 1:
+ raise
+ else:
+ self._dbg(1, "tarfile: %s" % e)
+
+ def _handle_fatal_error(self, e):
+ """Handle "fatal" error according to self.errorlevel"""
+ if self.errorlevel > 0:
+ raise
+ elif isinstance(e, OSError):
+ if e.filename is None:
+ self._dbg(1, "tarfile: %s" % e.strerror)
+ else:
+ self._dbg(1, "tarfile: %s %r" % (e.strerror, e.filename))
+ else:
+ self._dbg(1, "tarfile: %s %s" % (type(e).__name__, e))
+
+ def extractfile(self, member):
+ """Extract a member from the archive as a file object. 'member' may be
+ a filename or a TarInfo object. If 'member' is a regular file or
+ a link, an io.BufferedReader object is returned. For all other
+ existing members, None is returned. If 'member' does not appear
+ in the archive, KeyError is raised.
+ """
+ self._check("r")
+
+ if isinstance(member, str):
+ tarinfo = self.getmember(member)
+ else:
+ tarinfo = member
+
+ if tarinfo.isreg() or tarinfo.type not in SUPPORTED_TYPES:
+ # Members with unknown types are treated as regular files.
+ return self.fileobject(self, tarinfo)
+
+ elif tarinfo.islnk() or tarinfo.issym():
+ if isinstance(self.fileobj, _Stream):
+ # A small but ugly workaround for the case that someone tries
+ # to extract a (sym)link as a file-object from a non-seekable
+ # stream of tar blocks.
+ raise StreamError("cannot extract (sym)link as file object")
+ else:
+ # A (sym)link's file object is its target's file object.
+ return self.extractfile(self._find_link_target(tarinfo))
+ else:
+ # If there's no data associated with the member (directory, chrdev,
+ # blkdev, etc.), return None instead of a file object.
+ return None
+
+ def _extract_member(self, tarinfo, targetpath, set_attrs=True,
+ numeric_owner=False):
+ """Extract the TarInfo object tarinfo to a physical
+ file called targetpath.
+ """
+ # Fetch the TarInfo object for the given name
+ # and build the destination pathname, replacing
+ # forward slashes to platform specific separators.
+ targetpath = targetpath.rstrip("/")
+ targetpath = targetpath.replace("/", os.sep)
+
+ # Create all upper directories.
+ upperdirs = os.path.dirname(targetpath)
+ if upperdirs and not os.path.exists(upperdirs):
+ # Create directories that are not part of the archive with
+ # default permissions.
+ os.makedirs(upperdirs, exist_ok=True)
+
+ if tarinfo.islnk() or tarinfo.issym():
+ self._dbg(1, "%s -> %s" % (tarinfo.name, tarinfo.linkname))
+ else:
+ self._dbg(1, tarinfo.name)
+
+ if tarinfo.isreg():
+ self.makefile(tarinfo, targetpath)
+ elif tarinfo.isdir():
+ self.makedir(tarinfo, targetpath)
+ elif tarinfo.isfifo():
+ self.makefifo(tarinfo, targetpath)
+ elif tarinfo.ischr() or tarinfo.isblk():
+ self.makedev(tarinfo, targetpath)
+ elif tarinfo.islnk() or tarinfo.issym():
+ self.makelink(tarinfo, targetpath)
+ elif tarinfo.type not in SUPPORTED_TYPES:
+ self.makeunknown(tarinfo, targetpath)
+ else:
+ self.makefile(tarinfo, targetpath)
+
+ if set_attrs:
+ self.chown(tarinfo, targetpath, numeric_owner)
+ if not tarinfo.issym():
+ self.chmod(tarinfo, targetpath)
+ self.utime(tarinfo, targetpath)
+
+ #--------------------------------------------------------------------------
+ # Below are the different file methods. They are called via
+ # _extract_member() when extract() is called. They can be replaced in a
+ # subclass to implement other functionality.
+
+ def makedir(self, tarinfo, targetpath):
+ """Make a directory called targetpath.
+ """
+ try:
+ if tarinfo.mode is None:
+ # Use the system's default mode
+ os.mkdir(targetpath)
+ else:
+ # Use a safe mode for the directory, the real mode is set
+ # later in _extract_member().
+ os.mkdir(targetpath, 0o700)
+ except FileExistsError:
+ if not os.path.isdir(targetpath):
+ raise
+
+ def makefile(self, tarinfo, targetpath):
+ """Make a file called targetpath.
+ """
+ source = self.fileobj
+ source.seek(tarinfo.offset_data)
+ bufsize = self.copybufsize
+ with bltn_open(targetpath, "wb") as target:
+ if tarinfo.sparse is not None:
+ for offset, size in tarinfo.sparse:
+ target.seek(offset)
+ copyfileobj(source, target, size, ReadError, bufsize)
+ target.seek(tarinfo.size)
+ target.truncate()
+ else:
+ copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
+
+ def makeunknown(self, tarinfo, targetpath):
+ """Make a file from a TarInfo object with an unknown type
+ at targetpath.
+ """
+ self.makefile(tarinfo, targetpath)
+ self._dbg(1, "tarfile: Unknown file type %r, " \
+ "extracted as regular file." % tarinfo.type)
+
+ def makefifo(self, tarinfo, targetpath):
+ """Make a fifo called targetpath.
+ """
+ if hasattr(os, "mkfifo"):
+ os.mkfifo(targetpath)
+ else:
+ raise ExtractError("fifo not supported by system")
+
+ def makedev(self, tarinfo, targetpath):
+ """Make a character or block device called targetpath.
+ """
+ if not hasattr(os, "mknod") or not hasattr(os, "makedev"):
+ raise ExtractError("special devices not supported by system")
+
+ mode = tarinfo.mode
+ if mode is None:
+ # Use mknod's default
+ mode = 0o600
+ if tarinfo.isblk():
+ mode |= stat.S_IFBLK
+ else:
+ mode |= stat.S_IFCHR
+
+ os.mknod(targetpath, mode,
+ os.makedev(tarinfo.devmajor, tarinfo.devminor))
+
+ def makelink(self, tarinfo, targetpath):
+ """Make a (symbolic) link called targetpath. If it cannot be created
+ (platform limitation), we try to make a copy of the referenced file
+ instead of a link.
+ """
+ try:
+ # For systems that support symbolic and hard links.
+ if tarinfo.issym():
+ if os.path.lexists(targetpath):
+ # Avoid FileExistsError on following os.symlink.
+ os.unlink(targetpath)
+ os.symlink(tarinfo.linkname, targetpath)
+ else:
+ if os.path.exists(tarinfo._link_target):
+ os.link(tarinfo._link_target, targetpath)
+ else:
+ self._extract_member(self._find_link_target(tarinfo),
+ targetpath)
+ except symlink_exception:
+ try:
+ self._extract_member(self._find_link_target(tarinfo),
+ targetpath)
+ except KeyError:
+ raise ExtractError("unable to resolve link inside archive") from None
+
+ def chown(self, tarinfo, targetpath, numeric_owner):
+ """Set owner of targetpath according to tarinfo. If numeric_owner
+ is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
+ is False, fall back to .gid/.uid when the search based on name
+ fails.
+ """
+ if hasattr(os, "geteuid") and os.geteuid() == 0:
+ # We have to be root to do so.
+ g = tarinfo.gid
+ u = tarinfo.uid
+ if not numeric_owner:
+ try:
+ if grp and tarinfo.gname:
+ g = grp.getgrnam(tarinfo.gname)[2]
+ except KeyError:
+ pass
+ try:
+ if pwd and tarinfo.uname:
+ u = pwd.getpwnam(tarinfo.uname)[2]
+ except KeyError:
+ pass
+ if g is None:
+ g = -1
+ if u is None:
+ u = -1
+ try:
+ if tarinfo.issym() and hasattr(os, "lchown"):
+ os.lchown(targetpath, u, g)
+ else:
+ os.chown(targetpath, u, g)
+ except (OSError, OverflowError) as e:
+ # OverflowError can be raised if an ID doesn't fit in 'id_t'
+ raise ExtractError("could not change owner") from e
+
+ def chmod(self, tarinfo, targetpath):
+ """Set file permissions of targetpath according to tarinfo.
+ """
+ if tarinfo.mode is None:
+ return
+ try:
+ os.chmod(targetpath, tarinfo.mode)
+ except OSError as e:
+ raise ExtractError("could not change mode") from e
+
+ def utime(self, tarinfo, targetpath):
+ """Set modification time of targetpath according to tarinfo.
+ """
+ mtime = tarinfo.mtime
+ if mtime is None:
+ return
+ if not hasattr(os, 'utime'):
+ return
+ try:
+ os.utime(targetpath, (mtime, mtime))
+ except OSError as e:
+ raise ExtractError("could not change modification time") from e
+
+ #--------------------------------------------------------------------------
+ def next(self):
+ """Return the next member of the archive as a TarInfo object, when
+ TarFile is opened for reading. Return None if there is no more
+ available.
+ """
+ self._check("ra")
+ if self.firstmember is not None:
+ m = self.firstmember
+ self.firstmember = None
+ return m
+
+ # Advance the file pointer.
+ if self.offset != self.fileobj.tell():
+ if self.offset == 0:
+ return None
+ self.fileobj.seek(self.offset - 1)
+ if not self.fileobj.read(1):
+ raise ReadError("unexpected end of data")
+
+ # Read the next block.
+ tarinfo = None
+ while True:
+ try:
+ tarinfo = self.tarinfo.fromtarfile(self)
+ except EOFHeaderError as e:
+ if self.ignore_zeros:
+ self._dbg(2, "0x%X: %s" % (self.offset, e))
+ self.offset += BLOCKSIZE
+ continue
+ except InvalidHeaderError as e:
+ if self.ignore_zeros:
+ self._dbg(2, "0x%X: %s" % (self.offset, e))
+ self.offset += BLOCKSIZE
+ continue
+ elif self.offset == 0:
+ raise ReadError(str(e)) from None
+ except EmptyHeaderError:
+ if self.offset == 0:
+ raise ReadError("empty file") from None
+ except TruncatedHeaderError as e:
+ if self.offset == 0:
+ raise ReadError(str(e)) from None
+ except SubsequentHeaderError as e:
+ raise ReadError(str(e)) from None
+ except Exception as e:
+ try:
+ import zlib
+ if isinstance(e, zlib.error):
+ raise ReadError(f'zlib error: {e}') from None
+ else:
+ raise e
+ except ImportError:
+ raise e
+ break
+
+ if tarinfo is not None:
+ # if streaming the file we do not want to cache the tarinfo
+ if not self.stream:
+ self.members.append(tarinfo)
+ else:
+ self._loaded = True
+
+ return tarinfo
+
+ #--------------------------------------------------------------------------
+ # Little helper methods:
+
+ def _getmember(self, name, tarinfo=None, normalize=False):
+ """Find an archive member by name from bottom to top.
+ If tarinfo is given, it is used as the starting point.
+ """
+ # Ensure that all members have been loaded.
+ members = self.getmembers()
+
+ # Limit the member search list up to tarinfo.
+ skipping = False
+ if tarinfo is not None:
+ try:
+ index = members.index(tarinfo)
+ except ValueError:
+ # The given starting point might be a (modified) copy.
+ # We'll later skip members until we find an equivalent.
+ skipping = True
+ else:
+ # Happy fast path
+ members = members[:index]
+
+ if normalize:
+ name = os.path.normpath(name)
+
+ for member in reversed(members):
+ if skipping:
+ if tarinfo.offset == member.offset:
+ skipping = False
+ continue
+ if normalize:
+ member_name = os.path.normpath(member.name)
+ else:
+ member_name = member.name
+
+ if name == member_name:
+ return member
+
+ if skipping:
+ # Starting point was not found
+ raise ValueError(tarinfo)
+
+ def _load(self):
+ """Read through the entire archive file and look for readable
+ members. This should not run if the file is set to stream.
+ """
+ if not self.stream:
+ while self.next() is not None:
+ pass
+ self._loaded = True
+
+ def _check(self, mode=None):
+ """Check if TarFile is still open, and if the operation's mode
+ corresponds to TarFile's mode.
+ """
+ if self.closed:
+ raise OSError("%s is closed" % self.__class__.__name__)
+ if mode is not None and self.mode not in mode:
+ raise OSError("bad operation for mode %r" % self.mode)
+
+ def _find_link_target(self, tarinfo):
+ """Find the target member of a symlink or hardlink member in the
+ archive.
+ """
+ if tarinfo.issym():
+ # Always search the entire archive.
+ linkname = "/".join(filter(None, (os.path.dirname(tarinfo.name), tarinfo.linkname)))
+ limit = None
+ else:
+ # Search the archive before the link, because a hard link is
+ # just a reference to an already archived file.
+ linkname = tarinfo.linkname
+ limit = tarinfo
+
+ member = self._getmember(linkname, tarinfo=limit, normalize=True)
+ if member is None:
+ raise KeyError("linkname %r not found" % linkname)
+ return member
+
+ def __iter__(self):
+ """Provide an iterator object.
+ """
+ if self._loaded:
+ yield from self.members
+ return
+
+ # Yield items using TarFile's next() method.
+ # When all members have been read, set TarFile as _loaded.
+ index = 0
+ # Fix for SF #1100429: Under rare circumstances it can
+ # happen that getmembers() is called during iteration,
+ # which will have already exhausted the next() method.
+ if self.firstmember is not None:
+ tarinfo = self.next()
+ index += 1
+ yield tarinfo
+
+ while True:
+ if index < len(self.members):
+ tarinfo = self.members[index]
+ elif not self._loaded:
+ tarinfo = self.next()
+ if not tarinfo:
+ self._loaded = True
+ return
+ else:
+ return
+ index += 1
+ yield tarinfo
+
+ def _dbg(self, level, msg):
+ """Write debugging output to sys.stderr.
+ """
+ if level <= self.debug:
+ print(msg, file=sys.stderr)
+
+ def __enter__(self):
+ self._check()
+ return self
+
+ def __exit__(self, type, value, traceback):
+ if type is None:
+ self.close()
+ else:
+ # An exception occurred. We must not call close() because
+ # it would try to write end-of-archive blocks and padding.
+ if not self._extfileobj:
+ self.fileobj.close()
+ self.closed = True
+
+#--------------------
+# exported functions
+#--------------------
+
+def is_tarfile(name):
+ """Return True if name points to a tar archive that we
+ are able to handle, else return False.
+
+ 'name' should be a string, file, or file-like object.
+ """
+ try:
+ if hasattr(name, "read"):
+ pos = name.tell()
+ t = open(fileobj=name)
+ name.seek(pos)
+ else:
+ t = open(name)
+ t.close()
+ return True
+ except TarError:
+ return False
+
+open = TarFile.open
+
+
+def main():
+ import argparse
+
+ description = 'A simple command-line interface for tarfile module.'
+ parser = argparse.ArgumentParser(description=description)
+ parser.add_argument('-v', '--verbose', action='store_true', default=False,
+ help='Verbose output')
+ parser.add_argument('--filter', metavar='',
+ choices=_NAMED_FILTERS,
+ help='Filter for extraction')
+
+ group = parser.add_mutually_exclusive_group(required=True)
+ group.add_argument('-l', '--list', metavar='',
+ help='Show listing of a tarfile')
+ group.add_argument('-e', '--extract', nargs='+',
+ metavar=('', ''),
+ help='Extract tarfile into target dir')
+ group.add_argument('-c', '--create', nargs='+',
+ metavar=('', ''),
+ help='Create tarfile from sources')
+ group.add_argument('-t', '--test', metavar='',
+ help='Test if a tarfile is valid')
+
+ args = parser.parse_args()
+
+ if args.filter and args.extract is None:
+ parser.exit(1, '--filter is only valid for extraction\n')
+
+ if args.test is not None:
+ src = args.test
+ if is_tarfile(src):
+ with open(src, 'r') as tar:
+ tar.getmembers()
+ print(tar.getmembers(), file=sys.stderr)
+ if args.verbose:
+ print('{!r} is a tar archive.'.format(src))
+ else:
+ parser.exit(1, '{!r} is not a tar archive.\n'.format(src))
+
+ elif args.list is not None:
+ src = args.list
+ if is_tarfile(src):
+ with TarFile.open(src, 'r:*') as tf:
+ tf.list(verbose=args.verbose)
+ else:
+ parser.exit(1, '{!r} is not a tar archive.\n'.format(src))
+
+ elif args.extract is not None:
+ if len(args.extract) == 1:
+ src = args.extract[0]
+ curdir = os.curdir
+ elif len(args.extract) == 2:
+ src, curdir = args.extract
+ else:
+ parser.exit(1, parser.format_help())
+
+ if is_tarfile(src):
+ with TarFile.open(src, 'r:*') as tf:
+ tf.extractall(path=curdir, filter=args.filter)
+ if args.verbose:
+ if curdir == '.':
+ msg = '{!r} file is extracted.'.format(src)
+ else:
+ msg = ('{!r} file is extracted '
+ 'into {!r} directory.').format(src, curdir)
+ print(msg)
+ else:
+ parser.exit(1, '{!r} is not a tar archive.\n'.format(src))
+
+ elif args.create is not None:
+ tar_name = args.create.pop(0)
+ _, ext = os.path.splitext(tar_name)
+ compressions = {
+ # gz
+ '.gz': 'gz',
+ '.tgz': 'gz',
+ # xz
+ '.xz': 'xz',
+ '.txz': 'xz',
+ # bz2
+ '.bz2': 'bz2',
+ '.tbz': 'bz2',
+ '.tbz2': 'bz2',
+ '.tb2': 'bz2',
+ }
+ tar_mode = 'w:' + compressions[ext] if ext in compressions else 'w'
+ tar_files = args.create
+
+ with TarFile.open(tar_name, tar_mode) as tf:
+ for file_name in tar_files:
+ tf.add(file_name)
+
+ if args.verbose:
+ print('{!r} file created.'.format(tar_name))
+
+if __name__ == '__main__':
+ main()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/__main__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/__main__.py
new file mode 100644
index 0000000000000000000000000000000000000000..daf55090862ae43283b6552073549ac3ab2ad50a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/__main__.py
@@ -0,0 +1,5 @@
+from . import main
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/py38.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/py38.py
new file mode 100644
index 0000000000000000000000000000000000000000..20fbbfc1c095baf9f8c72902b24296b50ad3ab9d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/backports/tarfile/compat/py38.py
@@ -0,0 +1,24 @@
+import sys
+
+
+if sys.version_info < (3, 9):
+
+ def removesuffix(self, suffix):
+ # suffix='' should not call self[:-0].
+ if suffix and self.endswith(suffix):
+ return self[: -len(suffix)]
+ else:
+ return self[:]
+
+ def removeprefix(self, prefix):
+ if self.startswith(prefix):
+ return self[len(prefix) :]
+ else:
+ return self[:]
+else:
+
+ def removesuffix(self, suffix):
+ return self.removesuffix(suffix)
+
+ def removeprefix(self, prefix):
+ return self.removeprefix(prefix)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..85513e8a9f651c99f4a1fa372ba7768255bfa1c9
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/METADATA
@@ -0,0 +1,129 @@
+Metadata-Version: 2.1
+Name: importlib_metadata
+Version: 8.0.0
+Summary: Read metadata from Python packages
+Author-email: "Jason R. Coombs"
+Project-URL: Source, https://github.com/python/importlib_metadata
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: zipp >=0.5
+Requires-Dist: typing-extensions >=3.6.4 ; python_version < "3.8"
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: perf
+Requires-Dist: ipython ; extra == 'perf'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: packaging ; extra == 'test'
+Requires-Dist: pyfakefs ; extra == 'test'
+Requires-Dist: flufl.flake8 ; extra == 'test'
+Requires-Dist: pytest-perf >=0.9.2 ; extra == 'test'
+Requires-Dist: jaraco.test >=5.4 ; extra == 'test'
+Requires-Dist: importlib-resources >=1.3 ; (python_version < "3.9") and extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/importlib_metadata.svg
+ :target: https://pypi.org/project/importlib_metadata
+
+.. image:: https://img.shields.io/pypi/pyversions/importlib_metadata.svg
+
+.. image:: https://github.com/python/importlib_metadata/actions/workflows/main.yml/badge.svg
+ :target: https://github.com/python/importlib_metadata/actions?query=workflow%3A%22tests%22
+ :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+ :target: https://github.com/astral-sh/ruff
+ :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/importlib-metadata/badge/?version=latest
+ :target: https://importlib-metadata.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+ :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/importlib-metadata
+ :target: https://tidelift.com/subscription/pkg/pypi-importlib-metadata?utm_source=pypi-importlib-metadata&utm_medium=readme
+
+Library to access the metadata for a Python package.
+
+This package supplies third-party access to the functionality of
+`importlib.metadata `_
+including improvements added to subsequent Python versions.
+
+
+Compatibility
+=============
+
+New features are introduced in this third-party library and later merged
+into CPython. The following table indicates which versions of this library
+were contributed to different versions in the standard library:
+
+.. list-table::
+ :header-rows: 1
+
+ * - importlib_metadata
+ - stdlib
+ * - 7.0
+ - 3.13
+ * - 6.5
+ - 3.12
+ * - 4.13
+ - 3.11
+ * - 4.6
+ - 3.10
+ * - 1.4
+ - 3.8
+
+
+Usage
+=====
+
+See the `online documentation `_
+for usage details.
+
+`Finder authors
+`_ can
+also add support for custom package installers. See the above documentation
+for details.
+
+
+Caveats
+=======
+
+This project primarily supports third-party packages installed by PyPA
+tools (or other conforming packages). It does not support:
+
+- Packages in the stdlib.
+- Packages installed without metadata.
+
+Project details
+===============
+
+ * Project home: https://github.com/python/importlib_metadata
+ * Report bugs at: https://github.com/python/importlib_metadata/issues
+ * Code hosting: https://github.com/python/importlib_metadata
+ * Documentation: https://importlib-metadata.readthedocs.io/
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..07b7dc51dbf8da033f8cd0eb05a52ecfe26dcbeb
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/RECORD
@@ -0,0 +1,32 @@
+importlib_metadata-8.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+importlib_metadata-8.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
+importlib_metadata-8.0.0.dist-info/METADATA,sha256=anuQ7_7h4J1bSEzfcjIBakPi2cyVQ7y7jklLHsBeH1k,4648
+importlib_metadata-8.0.0.dist-info/RECORD,,
+importlib_metadata-8.0.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_metadata-8.0.0.dist-info/WHEEL,sha256=mguMlWGMX-VHnMpKOjjQidIo1ssRlCFu4a4mBpz1s2M,91
+importlib_metadata-8.0.0.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
+importlib_metadata/__init__.py,sha256=tZNB-23h8Bixi9uCrQqj9Yf0aeC--Josdy3IZRIQeB0,33798
+importlib_metadata/__pycache__/__init__.cpython-312.pyc,,
+importlib_metadata/__pycache__/_adapters.cpython-312.pyc,,
+importlib_metadata/__pycache__/_collections.cpython-312.pyc,,
+importlib_metadata/__pycache__/_compat.cpython-312.pyc,,
+importlib_metadata/__pycache__/_functools.cpython-312.pyc,,
+importlib_metadata/__pycache__/_itertools.cpython-312.pyc,,
+importlib_metadata/__pycache__/_meta.cpython-312.pyc,,
+importlib_metadata/__pycache__/_text.cpython-312.pyc,,
+importlib_metadata/__pycache__/diagnose.cpython-312.pyc,,
+importlib_metadata/_adapters.py,sha256=rIhWTwBvYA1bV7i-5FfVX38qEXDTXFeS5cb5xJtP3ks,2317
+importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743
+importlib_metadata/_compat.py,sha256=73QKrN9KNoaZzhbX5yPCCZa-FaALwXe8TPlDR72JgBU,1314
+importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895
+importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068
+importlib_metadata/_meta.py,sha256=nxZ7C8GVlcBFAKWyVOn_dn7ot_twBcbm1NmvjIetBHI,1801
+importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166
+importlib_metadata/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+importlib_metadata/compat/__pycache__/__init__.cpython-312.pyc,,
+importlib_metadata/compat/__pycache__/py311.cpython-312.pyc,,
+importlib_metadata/compat/__pycache__/py39.cpython-312.pyc,,
+importlib_metadata/compat/py311.py,sha256=uqm-K-uohyj1042TH4a9Er_I5o7667DvulcD-gC_fSA,608
+importlib_metadata/compat/py39.py,sha256=cPkMv6-0ilK-0Jw_Tkn0xYbOKJZc4WJKQHow0c2T44w,1102
+importlib_metadata/diagnose.py,sha256=nkSRMiowlmkhLYhKhvCg9glmt_11Cox-EmLzEbqYTa8,379
+importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/REQUESTED b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..edf4ec7c70d7dbfc16600ff1b368daf1097c5dc7
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: setuptools (70.1.1)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..bbb07547a19c30031d13c45cf01cba61dc434e47
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata-8.0.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+importlib_metadata
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..ed4813551ac238bfb9b5a48f4476463355415d27
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/__init__.py
@@ -0,0 +1,1083 @@
+from __future__ import annotations
+
+import os
+import re
+import abc
+import sys
+import json
+import zipp
+import email
+import types
+import inspect
+import pathlib
+import operator
+import textwrap
+import functools
+import itertools
+import posixpath
+import collections
+
+from . import _meta
+from .compat import py39, py311
+from ._collections import FreezableDefaultDict, Pair
+from ._compat import (
+ NullFinder,
+ install,
+)
+from ._functools import method_cache, pass_none
+from ._itertools import always_iterable, unique_everseen
+from ._meta import PackageMetadata, SimplePath
+
+from contextlib import suppress
+from importlib import import_module
+from importlib.abc import MetaPathFinder
+from itertools import starmap
+from typing import Any, Iterable, List, Mapping, Match, Optional, Set, cast
+
+__all__ = [
+ 'Distribution',
+ 'DistributionFinder',
+ 'PackageMetadata',
+ 'PackageNotFoundError',
+ 'distribution',
+ 'distributions',
+ 'entry_points',
+ 'files',
+ 'metadata',
+ 'packages_distributions',
+ 'requires',
+ 'version',
+]
+
+
+class PackageNotFoundError(ModuleNotFoundError):
+ """The package was not found."""
+
+ def __str__(self) -> str:
+ return f"No package metadata was found for {self.name}"
+
+ @property
+ def name(self) -> str: # type: ignore[override]
+ (name,) = self.args
+ return name
+
+
+class Sectioned:
+ """
+ A simple entry point config parser for performance
+
+ >>> for item in Sectioned.read(Sectioned._sample):
+ ... print(item)
+ Pair(name='sec1', value='# comments ignored')
+ Pair(name='sec1', value='a = 1')
+ Pair(name='sec1', value='b = 2')
+ Pair(name='sec2', value='a = 2')
+
+ >>> res = Sectioned.section_pairs(Sectioned._sample)
+ >>> item = next(res)
+ >>> item.name
+ 'sec1'
+ >>> item.value
+ Pair(name='a', value='1')
+ >>> item = next(res)
+ >>> item.value
+ Pair(name='b', value='2')
+ >>> item = next(res)
+ >>> item.name
+ 'sec2'
+ >>> item.value
+ Pair(name='a', value='2')
+ >>> list(res)
+ []
+ """
+
+ _sample = textwrap.dedent(
+ """
+ [sec1]
+ # comments ignored
+ a = 1
+ b = 2
+
+ [sec2]
+ a = 2
+ """
+ ).lstrip()
+
+ @classmethod
+ def section_pairs(cls, text):
+ return (
+ section._replace(value=Pair.parse(section.value))
+ for section in cls.read(text, filter_=cls.valid)
+ if section.name is not None
+ )
+
+ @staticmethod
+ def read(text, filter_=None):
+ lines = filter(filter_, map(str.strip, text.splitlines()))
+ name = None
+ for value in lines:
+ section_match = value.startswith('[') and value.endswith(']')
+ if section_match:
+ name = value.strip('[]')
+ continue
+ yield Pair(name, value)
+
+ @staticmethod
+ def valid(line: str):
+ return line and not line.startswith('#')
+
+
+class EntryPoint:
+ """An entry point as defined by Python packaging conventions.
+
+ See `the packaging docs on entry points
+ `_
+ for more information.
+
+ >>> ep = EntryPoint(
+ ... name=None, group=None, value='package.module:attr [extra1, extra2]')
+ >>> ep.module
+ 'package.module'
+ >>> ep.attr
+ 'attr'
+ >>> ep.extras
+ ['extra1', 'extra2']
+ """
+
+ pattern = re.compile(
+ r'(?P[\w.]+)\s*'
+ r'(:\s*(?P[\w.]+)\s*)?'
+ r'((?P\[.*\])\s*)?$'
+ )
+ """
+ A regular expression describing the syntax for an entry point,
+ which might look like:
+
+ - module
+ - package.module
+ - package.module:attribute
+ - package.module:object.attribute
+ - package.module:attr [extra1, extra2]
+
+ Other combinations are possible as well.
+
+ The expression is lenient about whitespace around the ':',
+ following the attr, and following any extras.
+ """
+
+ name: str
+ value: str
+ group: str
+
+ dist: Optional[Distribution] = None
+
+ def __init__(self, name: str, value: str, group: str) -> None:
+ vars(self).update(name=name, value=value, group=group)
+
+ def load(self) -> Any:
+ """Load the entry point from its definition. If only a module
+ is indicated by the value, return that module. Otherwise,
+ return the named object.
+ """
+ match = cast(Match, self.pattern.match(self.value))
+ module = import_module(match.group('module'))
+ attrs = filter(None, (match.group('attr') or '').split('.'))
+ return functools.reduce(getattr, attrs, module)
+
+ @property
+ def module(self) -> str:
+ match = self.pattern.match(self.value)
+ assert match is not None
+ return match.group('module')
+
+ @property
+ def attr(self) -> str:
+ match = self.pattern.match(self.value)
+ assert match is not None
+ return match.group('attr')
+
+ @property
+ def extras(self) -> List[str]:
+ match = self.pattern.match(self.value)
+ assert match is not None
+ return re.findall(r'\w+', match.group('extras') or '')
+
+ def _for(self, dist):
+ vars(self).update(dist=dist)
+ return self
+
+ def matches(self, **params):
+ """
+ EntryPoint matches the given parameters.
+
+ >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]')
+ >>> ep.matches(group='foo')
+ True
+ >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]')
+ True
+ >>> ep.matches(group='foo', name='other')
+ False
+ >>> ep.matches()
+ True
+ >>> ep.matches(extras=['extra1', 'extra2'])
+ True
+ >>> ep.matches(module='bing')
+ True
+ >>> ep.matches(attr='bong')
+ True
+ """
+ attrs = (getattr(self, param) for param in params)
+ return all(map(operator.eq, params.values(), attrs))
+
+ def _key(self):
+ return self.name, self.value, self.group
+
+ def __lt__(self, other):
+ return self._key() < other._key()
+
+ def __eq__(self, other):
+ return self._key() == other._key()
+
+ def __setattr__(self, name, value):
+ raise AttributeError("EntryPoint objects are immutable.")
+
+ def __repr__(self):
+ return (
+ f'EntryPoint(name={self.name!r}, value={self.value!r}, '
+ f'group={self.group!r})'
+ )
+
+ def __hash__(self) -> int:
+ return hash(self._key())
+
+
+class EntryPoints(tuple):
+ """
+ An immutable collection of selectable EntryPoint objects.
+ """
+
+ __slots__ = ()
+
+ def __getitem__(self, name: str) -> EntryPoint: # type: ignore[override]
+ """
+ Get the EntryPoint in self matching name.
+ """
+ try:
+ return next(iter(self.select(name=name)))
+ except StopIteration:
+ raise KeyError(name)
+
+ def __repr__(self):
+ """
+ Repr with classname and tuple constructor to
+ signal that we deviate from regular tuple behavior.
+ """
+ return '%s(%r)' % (self.__class__.__name__, tuple(self))
+
+ def select(self, **params) -> EntryPoints:
+ """
+ Select entry points from self that match the
+ given parameters (typically group and/or name).
+ """
+ return EntryPoints(ep for ep in self if py39.ep_matches(ep, **params))
+
+ @property
+ def names(self) -> Set[str]:
+ """
+ Return the set of all names of all entry points.
+ """
+ return {ep.name for ep in self}
+
+ @property
+ def groups(self) -> Set[str]:
+ """
+ Return the set of all groups of all entry points.
+ """
+ return {ep.group for ep in self}
+
+ @classmethod
+ def _from_text_for(cls, text, dist):
+ return cls(ep._for(dist) for ep in cls._from_text(text))
+
+ @staticmethod
+ def _from_text(text):
+ return (
+ EntryPoint(name=item.value.name, value=item.value.value, group=item.name)
+ for item in Sectioned.section_pairs(text or '')
+ )
+
+
+class PackagePath(pathlib.PurePosixPath):
+ """A reference to a path in a package"""
+
+ hash: Optional[FileHash]
+ size: int
+ dist: Distribution
+
+ def read_text(self, encoding: str = 'utf-8') -> str: # type: ignore[override]
+ return self.locate().read_text(encoding=encoding)
+
+ def read_binary(self) -> bytes:
+ return self.locate().read_bytes()
+
+ def locate(self) -> SimplePath:
+ """Return a path-like object for this path"""
+ return self.dist.locate_file(self)
+
+
+class FileHash:
+ def __init__(self, spec: str) -> None:
+ self.mode, _, self.value = spec.partition('=')
+
+ def __repr__(self) -> str:
+ return f''
+
+
+class Distribution(metaclass=abc.ABCMeta):
+ """
+ An abstract Python distribution package.
+
+ Custom providers may derive from this class and define
+ the abstract methods to provide a concrete implementation
+ for their environment. Some providers may opt to override
+ the default implementation of some properties to bypass
+ the file-reading mechanism.
+ """
+
+ @abc.abstractmethod
+ def read_text(self, filename) -> Optional[str]:
+ """Attempt to load metadata file given by the name.
+
+ Python distribution metadata is organized by blobs of text
+ typically represented as "files" in the metadata directory
+ (e.g. package-1.0.dist-info). These files include things
+ like:
+
+ - METADATA: The distribution metadata including fields
+ like Name and Version and Description.
+ - entry_points.txt: A series of entry points as defined in
+ `the entry points spec `_.
+ - RECORD: A record of files according to
+ `this recording spec `_.
+
+ A package may provide any set of files, including those
+ not listed here or none at all.
+
+ :param filename: The name of the file in the distribution info.
+ :return: The text if found, otherwise None.
+ """
+
+ @abc.abstractmethod
+ def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
+ """
+ Given a path to a file in this distribution, return a SimplePath
+ to it.
+ """
+
+ @classmethod
+ def from_name(cls, name: str) -> Distribution:
+ """Return the Distribution for the given package name.
+
+ :param name: The name of the distribution package to search for.
+ :return: The Distribution instance (or subclass thereof) for the named
+ package, if found.
+ :raises PackageNotFoundError: When the named package's distribution
+ metadata cannot be found.
+ :raises ValueError: When an invalid value is supplied for name.
+ """
+ if not name:
+ raise ValueError("A distribution name is required.")
+ try:
+ return next(iter(cls.discover(name=name)))
+ except StopIteration:
+ raise PackageNotFoundError(name)
+
+ @classmethod
+ def discover(
+ cls, *, context: Optional[DistributionFinder.Context] = None, **kwargs
+ ) -> Iterable[Distribution]:
+ """Return an iterable of Distribution objects for all packages.
+
+ Pass a ``context`` or pass keyword arguments for constructing
+ a context.
+
+ :context: A ``DistributionFinder.Context`` object.
+ :return: Iterable of Distribution objects for packages matching
+ the context.
+ """
+ if context and kwargs:
+ raise ValueError("cannot accept context and kwargs")
+ context = context or DistributionFinder.Context(**kwargs)
+ return itertools.chain.from_iterable(
+ resolver(context) for resolver in cls._discover_resolvers()
+ )
+
+ @staticmethod
+ def at(path: str | os.PathLike[str]) -> Distribution:
+ """Return a Distribution for the indicated metadata path.
+
+ :param path: a string or path-like object
+ :return: a concrete Distribution instance for the path
+ """
+ return PathDistribution(pathlib.Path(path))
+
+ @staticmethod
+ def _discover_resolvers():
+ """Search the meta_path for resolvers (MetadataPathFinders)."""
+ declared = (
+ getattr(finder, 'find_distributions', None) for finder in sys.meta_path
+ )
+ return filter(None, declared)
+
+ @property
+ def metadata(self) -> _meta.PackageMetadata:
+ """Return the parsed metadata for this Distribution.
+
+ The returned object will have keys that name the various bits of
+ metadata per the
+ `Core metadata specifications `_.
+
+ Custom providers may provide the METADATA file or override this
+ property.
+ """
+ # deferred for performance (python/cpython#109829)
+ from . import _adapters
+
+ opt_text = (
+ self.read_text('METADATA')
+ or self.read_text('PKG-INFO')
+ # This last clause is here to support old egg-info files. Its
+ # effect is to just end up using the PathDistribution's self._path
+ # (which points to the egg-info file) attribute unchanged.
+ or self.read_text('')
+ )
+ text = cast(str, opt_text)
+ return _adapters.Message(email.message_from_string(text))
+
+ @property
+ def name(self) -> str:
+ """Return the 'Name' metadata for the distribution package."""
+ return self.metadata['Name']
+
+ @property
+ def _normalized_name(self):
+ """Return a normalized version of the name."""
+ return Prepared.normalize(self.name)
+
+ @property
+ def version(self) -> str:
+ """Return the 'Version' metadata for the distribution package."""
+ return self.metadata['Version']
+
+ @property
+ def entry_points(self) -> EntryPoints:
+ """
+ Return EntryPoints for this distribution.
+
+ Custom providers may provide the ``entry_points.txt`` file
+ or override this property.
+ """
+ return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
+
+ @property
+ def files(self) -> Optional[List[PackagePath]]:
+ """Files in this distribution.
+
+ :return: List of PackagePath for this distribution or None
+
+ Result is `None` if the metadata file that enumerates files
+ (i.e. RECORD for dist-info, or installed-files.txt or
+ SOURCES.txt for egg-info) is missing.
+ Result may be empty if the metadata exists but is empty.
+
+ Custom providers are recommended to provide a "RECORD" file (in
+ ``read_text``) or override this property to allow for callers to be
+ able to resolve filenames provided by the package.
+ """
+
+ def make_file(name, hash=None, size_str=None):
+ result = PackagePath(name)
+ result.hash = FileHash(hash) if hash else None
+ result.size = int(size_str) if size_str else None
+ result.dist = self
+ return result
+
+ @pass_none
+ def make_files(lines):
+ # Delay csv import, since Distribution.files is not as widely used
+ # as other parts of importlib.metadata
+ import csv
+
+ return starmap(make_file, csv.reader(lines))
+
+ @pass_none
+ def skip_missing_files(package_paths):
+ return list(filter(lambda path: path.locate().exists(), package_paths))
+
+ return skip_missing_files(
+ make_files(
+ self._read_files_distinfo()
+ or self._read_files_egginfo_installed()
+ or self._read_files_egginfo_sources()
+ )
+ )
+
+ def _read_files_distinfo(self):
+ """
+ Read the lines of RECORD.
+ """
+ text = self.read_text('RECORD')
+ return text and text.splitlines()
+
+ def _read_files_egginfo_installed(self):
+ """
+ Read installed-files.txt and return lines in a similar
+ CSV-parsable format as RECORD: each file must be placed
+ relative to the site-packages directory and must also be
+ quoted (since file names can contain literal commas).
+
+ This file is written when the package is installed by pip,
+ but it might not be written for other installation methods.
+ Assume the file is accurate if it exists.
+ """
+ text = self.read_text('installed-files.txt')
+ # Prepend the .egg-info/ subdir to the lines in this file.
+ # But this subdir is only available from PathDistribution's
+ # self._path.
+ subdir = getattr(self, '_path', None)
+ if not text or not subdir:
+ return
+
+ paths = (
+ py311.relative_fix((subdir / name).resolve())
+ .relative_to(self.locate_file('').resolve(), walk_up=True)
+ .as_posix()
+ for name in text.splitlines()
+ )
+ return map('"{}"'.format, paths)
+
+ def _read_files_egginfo_sources(self):
+ """
+ Read SOURCES.txt and return lines in a similar CSV-parsable
+ format as RECORD: each file name must be quoted (since it
+ might contain literal commas).
+
+ Note that SOURCES.txt is not a reliable source for what
+ files are installed by a package. This file is generated
+ for a source archive, and the files that are present
+ there (e.g. setup.py) may not correctly reflect the files
+ that are present after the package has been installed.
+ """
+ text = self.read_text('SOURCES.txt')
+ return text and map('"{}"'.format, text.splitlines())
+
+ @property
+ def requires(self) -> Optional[List[str]]:
+ """Generated requirements specified for this Distribution"""
+ reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
+ return reqs and list(reqs)
+
+ def _read_dist_info_reqs(self):
+ return self.metadata.get_all('Requires-Dist')
+
+ def _read_egg_info_reqs(self):
+ source = self.read_text('requires.txt')
+ return pass_none(self._deps_from_requires_text)(source)
+
+ @classmethod
+ def _deps_from_requires_text(cls, source):
+ return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source))
+
+ @staticmethod
+ def _convert_egg_info_reqs_to_simple_reqs(sections):
+ """
+ Historically, setuptools would solicit and store 'extra'
+ requirements, including those with environment markers,
+ in separate sections. More modern tools expect each
+ dependency to be defined separately, with any relevant
+ extras and environment markers attached directly to that
+ requirement. This method converts the former to the
+ latter. See _test_deps_from_requires_text for an example.
+ """
+
+ def make_condition(name):
+ return name and f'extra == "{name}"'
+
+ def quoted_marker(section):
+ section = section or ''
+ extra, sep, markers = section.partition(':')
+ if extra and markers:
+ markers = f'({markers})'
+ conditions = list(filter(None, [markers, make_condition(extra)]))
+ return '; ' + ' and '.join(conditions) if conditions else ''
+
+ def url_req_space(req):
+ """
+ PEP 508 requires a space between the url_spec and the quoted_marker.
+ Ref python/importlib_metadata#357.
+ """
+ # '@' is uniquely indicative of a url_req.
+ return ' ' * ('@' in req)
+
+ for section in sections:
+ space = url_req_space(section.value)
+ yield section.value + space + quoted_marker(section.name)
+
+ @property
+ def origin(self):
+ return self._load_json('direct_url.json')
+
+ def _load_json(self, filename):
+ return pass_none(json.loads)(
+ self.read_text(filename),
+ object_hook=lambda data: types.SimpleNamespace(**data),
+ )
+
+
+class DistributionFinder(MetaPathFinder):
+ """
+ A MetaPathFinder capable of discovering installed distributions.
+
+ Custom providers should implement this interface in order to
+ supply metadata.
+ """
+
+ class Context:
+ """
+ Keyword arguments presented by the caller to
+ ``distributions()`` or ``Distribution.discover()``
+ to narrow the scope of a search for distributions
+ in all DistributionFinders.
+
+ Each DistributionFinder may expect any parameters
+ and should attempt to honor the canonical
+ parameters defined below when appropriate.
+
+ This mechanism gives a custom provider a means to
+ solicit additional details from the caller beyond
+ "name" and "path" when searching distributions.
+ For example, imagine a provider that exposes suites
+ of packages in either a "public" or "private" ``realm``.
+ A caller may wish to query only for distributions in
+ a particular realm and could call
+ ``distributions(realm="private")`` to signal to the
+ custom provider to only include distributions from that
+ realm.
+ """
+
+ name = None
+ """
+ Specific name for which a distribution finder should match.
+ A name of ``None`` matches all distributions.
+ """
+
+ def __init__(self, **kwargs):
+ vars(self).update(kwargs)
+
+ @property
+ def path(self) -> List[str]:
+ """
+ The sequence of directory path that a distribution finder
+ should search.
+
+ Typically refers to Python installed package paths such as
+ "site-packages" directories and defaults to ``sys.path``.
+ """
+ return vars(self).get('path', sys.path)
+
+ @abc.abstractmethod
+ def find_distributions(self, context=Context()) -> Iterable[Distribution]:
+ """
+ Find distributions.
+
+ Return an iterable of all Distribution instances capable of
+ loading the metadata for packages matching the ``context``,
+ a DistributionFinder.Context instance.
+ """
+
+
+class FastPath:
+ """
+ Micro-optimized class for searching a root for children.
+
+ Root is a path on the file system that may contain metadata
+ directories either as natural directories or within a zip file.
+
+ >>> FastPath('').children()
+ ['...']
+
+ FastPath objects are cached and recycled for any given root.
+
+ >>> FastPath('foobar') is FastPath('foobar')
+ True
+ """
+
+ @functools.lru_cache() # type: ignore
+ def __new__(cls, root):
+ return super().__new__(cls)
+
+ def __init__(self, root):
+ self.root = root
+
+ def joinpath(self, child):
+ return pathlib.Path(self.root, child)
+
+ def children(self):
+ with suppress(Exception):
+ return os.listdir(self.root or '.')
+ with suppress(Exception):
+ return self.zip_children()
+ return []
+
+ def zip_children(self):
+ zip_path = zipp.Path(self.root)
+ names = zip_path.root.namelist()
+ self.joinpath = zip_path.joinpath
+
+ return dict.fromkeys(child.split(posixpath.sep, 1)[0] for child in names)
+
+ def search(self, name):
+ return self.lookup(self.mtime).search(name)
+
+ @property
+ def mtime(self):
+ with suppress(OSError):
+ return os.stat(self.root).st_mtime
+ self.lookup.cache_clear()
+
+ @method_cache
+ def lookup(self, mtime):
+ return Lookup(self)
+
+
+class Lookup:
+ """
+ A micro-optimized class for searching a (fast) path for metadata.
+ """
+
+ def __init__(self, path: FastPath):
+ """
+ Calculate all of the children representing metadata.
+
+ From the children in the path, calculate early all of the
+ children that appear to represent metadata (infos) or legacy
+ metadata (eggs).
+ """
+
+ base = os.path.basename(path.root).lower()
+ base_is_egg = base.endswith(".egg")
+ self.infos = FreezableDefaultDict(list)
+ self.eggs = FreezableDefaultDict(list)
+
+ for child in path.children():
+ low = child.lower()
+ if low.endswith((".dist-info", ".egg-info")):
+ # rpartition is faster than splitext and suitable for this purpose.
+ name = low.rpartition(".")[0].partition("-")[0]
+ normalized = Prepared.normalize(name)
+ self.infos[normalized].append(path.joinpath(child))
+ elif base_is_egg and low == "egg-info":
+ name = base.rpartition(".")[0].partition("-")[0]
+ legacy_normalized = Prepared.legacy_normalize(name)
+ self.eggs[legacy_normalized].append(path.joinpath(child))
+
+ self.infos.freeze()
+ self.eggs.freeze()
+
+ def search(self, prepared: Prepared):
+ """
+ Yield all infos and eggs matching the Prepared query.
+ """
+ infos = (
+ self.infos[prepared.normalized]
+ if prepared
+ else itertools.chain.from_iterable(self.infos.values())
+ )
+ eggs = (
+ self.eggs[prepared.legacy_normalized]
+ if prepared
+ else itertools.chain.from_iterable(self.eggs.values())
+ )
+ return itertools.chain(infos, eggs)
+
+
+class Prepared:
+ """
+ A prepared search query for metadata on a possibly-named package.
+
+ Pre-calculates the normalization to prevent repeated operations.
+
+ >>> none = Prepared(None)
+ >>> none.normalized
+ >>> none.legacy_normalized
+ >>> bool(none)
+ False
+ >>> sample = Prepared('Sample__Pkg-name.foo')
+ >>> sample.normalized
+ 'sample_pkg_name_foo'
+ >>> sample.legacy_normalized
+ 'sample__pkg_name.foo'
+ >>> bool(sample)
+ True
+ """
+
+ normalized = None
+ legacy_normalized = None
+
+ def __init__(self, name: Optional[str]):
+ self.name = name
+ if name is None:
+ return
+ self.normalized = self.normalize(name)
+ self.legacy_normalized = self.legacy_normalize(name)
+
+ @staticmethod
+ def normalize(name):
+ """
+ PEP 503 normalization plus dashes as underscores.
+ """
+ return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
+
+ @staticmethod
+ def legacy_normalize(name):
+ """
+ Normalize the package name as found in the convention in
+ older packaging tools versions and specs.
+ """
+ return name.lower().replace('-', '_')
+
+ def __bool__(self):
+ return bool(self.name)
+
+
+@install
+class MetadataPathFinder(NullFinder, DistributionFinder):
+ """A degenerate finder for distribution packages on the file system.
+
+ This finder supplies only a find_distributions() method for versions
+ of Python that do not have a PathFinder find_distributions().
+ """
+
+ @classmethod
+ def find_distributions(
+ cls, context=DistributionFinder.Context()
+ ) -> Iterable[PathDistribution]:
+ """
+ Find distributions.
+
+ Return an iterable of all Distribution instances capable of
+ loading the metadata for packages matching ``context.name``
+ (or all names if ``None`` indicated) along the paths in the list
+ of directories ``context.path``.
+ """
+ found = cls._search_paths(context.name, context.path)
+ return map(PathDistribution, found)
+
+ @classmethod
+ def _search_paths(cls, name, paths):
+ """Find metadata directories in paths heuristically."""
+ prepared = Prepared(name)
+ return itertools.chain.from_iterable(
+ path.search(prepared) for path in map(FastPath, paths)
+ )
+
+ @classmethod
+ def invalidate_caches(cls) -> None:
+ FastPath.__new__.cache_clear()
+
+
+class PathDistribution(Distribution):
+ def __init__(self, path: SimplePath) -> None:
+ """Construct a distribution.
+
+ :param path: SimplePath indicating the metadata directory.
+ """
+ self._path = path
+
+ def read_text(self, filename: str | os.PathLike[str]) -> Optional[str]:
+ with suppress(
+ FileNotFoundError,
+ IsADirectoryError,
+ KeyError,
+ NotADirectoryError,
+ PermissionError,
+ ):
+ return self._path.joinpath(filename).read_text(encoding='utf-8')
+
+ return None
+
+ read_text.__doc__ = Distribution.read_text.__doc__
+
+ def locate_file(self, path: str | os.PathLike[str]) -> SimplePath:
+ return self._path.parent / path
+
+ @property
+ def _normalized_name(self):
+ """
+ Performance optimization: where possible, resolve the
+ normalized name from the file system path.
+ """
+ stem = os.path.basename(str(self._path))
+ return (
+ pass_none(Prepared.normalize)(self._name_from_stem(stem))
+ or super()._normalized_name
+ )
+
+ @staticmethod
+ def _name_from_stem(stem):
+ """
+ >>> PathDistribution._name_from_stem('foo-3.0.egg-info')
+ 'foo'
+ >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info')
+ 'CherryPy'
+ >>> PathDistribution._name_from_stem('face.egg-info')
+ 'face'
+ >>> PathDistribution._name_from_stem('foo.bar')
+ """
+ filename, ext = os.path.splitext(stem)
+ if ext not in ('.dist-info', '.egg-info'):
+ return
+ name, sep, rest = filename.partition('-')
+ return name
+
+
+def distribution(distribution_name: str) -> Distribution:
+ """Get the ``Distribution`` instance for the named package.
+
+ :param distribution_name: The name of the distribution package as a string.
+ :return: A ``Distribution`` instance (or subclass thereof).
+ """
+ return Distribution.from_name(distribution_name)
+
+
+def distributions(**kwargs) -> Iterable[Distribution]:
+ """Get all ``Distribution`` instances in the current environment.
+
+ :return: An iterable of ``Distribution`` instances.
+ """
+ return Distribution.discover(**kwargs)
+
+
+def metadata(distribution_name: str) -> _meta.PackageMetadata:
+ """Get the metadata for the named package.
+
+ :param distribution_name: The name of the distribution package to query.
+ :return: A PackageMetadata containing the parsed metadata.
+ """
+ return Distribution.from_name(distribution_name).metadata
+
+
+def version(distribution_name: str) -> str:
+ """Get the version string for the named package.
+
+ :param distribution_name: The name of the distribution package to query.
+ :return: The version string for the package as defined in the package's
+ "Version" metadata key.
+ """
+ return distribution(distribution_name).version
+
+
+_unique = functools.partial(
+ unique_everseen,
+ key=py39.normalized_name,
+)
+"""
+Wrapper for ``distributions`` to return unique distributions by name.
+"""
+
+
+def entry_points(**params) -> EntryPoints:
+ """Return EntryPoint objects for all installed packages.
+
+ Pass selection parameters (group or name) to filter the
+ result to entry points matching those properties (see
+ EntryPoints.select()).
+
+ :return: EntryPoints for all installed packages.
+ """
+ eps = itertools.chain.from_iterable(
+ dist.entry_points for dist in _unique(distributions())
+ )
+ return EntryPoints(eps).select(**params)
+
+
+def files(distribution_name: str) -> Optional[List[PackagePath]]:
+ """Return a list of files for the named package.
+
+ :param distribution_name: The name of the distribution package to query.
+ :return: List of files composing the distribution.
+ """
+ return distribution(distribution_name).files
+
+
+def requires(distribution_name: str) -> Optional[List[str]]:
+ """
+ Return a list of requirements for the named package.
+
+ :return: An iterable of requirements, suitable for
+ packaging.requirement.Requirement.
+ """
+ return distribution(distribution_name).requires
+
+
+def packages_distributions() -> Mapping[str, List[str]]:
+ """
+ Return a mapping of top-level packages to their
+ distributions.
+
+ >>> import collections.abc
+ >>> pkgs = packages_distributions()
+ >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
+ True
+ """
+ pkg_to_dist = collections.defaultdict(list)
+ for dist in distributions():
+ for pkg in _top_level_declared(dist) or _top_level_inferred(dist):
+ pkg_to_dist[pkg].append(dist.metadata['Name'])
+ return dict(pkg_to_dist)
+
+
+def _top_level_declared(dist):
+ return (dist.read_text('top_level.txt') or '').split()
+
+
+def _topmost(name: PackagePath) -> Optional[str]:
+ """
+ Return the top-most parent as long as there is a parent.
+ """
+ top, *rest = name.parts
+ return top if rest else None
+
+
+def _get_toplevel_name(name: PackagePath) -> str:
+ """
+ Infer a possibly importable module name from a name presumed on
+ sys.path.
+
+ >>> _get_toplevel_name(PackagePath('foo.py'))
+ 'foo'
+ >>> _get_toplevel_name(PackagePath('foo'))
+ 'foo'
+ >>> _get_toplevel_name(PackagePath('foo.pyc'))
+ 'foo'
+ >>> _get_toplevel_name(PackagePath('foo/__init__.py'))
+ 'foo'
+ >>> _get_toplevel_name(PackagePath('foo.pth'))
+ 'foo.pth'
+ >>> _get_toplevel_name(PackagePath('foo.dist-info'))
+ 'foo.dist-info'
+ """
+ return _topmost(name) or (
+ # python/typeshed#10328
+ inspect.getmodulename(name) # type: ignore
+ or str(name)
+ )
+
+
+def _top_level_inferred(dist):
+ opt_names = set(map(_get_toplevel_name, always_iterable(dist.files)))
+
+ def importable_name(name):
+ return '.' not in name
+
+ return filter(importable_name, opt_names)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py
new file mode 100644
index 0000000000000000000000000000000000000000..6223263ed53f22fc25c09de06789718d2cd3b6ea
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_adapters.py
@@ -0,0 +1,83 @@
+import re
+import textwrap
+import email.message
+
+from ._text import FoldedCase
+
+
+class Message(email.message.Message):
+ multiple_use_keys = set(
+ map(
+ FoldedCase,
+ [
+ 'Classifier',
+ 'Obsoletes-Dist',
+ 'Platform',
+ 'Project-URL',
+ 'Provides-Dist',
+ 'Provides-Extra',
+ 'Requires-Dist',
+ 'Requires-External',
+ 'Supported-Platform',
+ 'Dynamic',
+ ],
+ )
+ )
+ """
+ Keys that may be indicated multiple times per PEP 566.
+ """
+
+ def __new__(cls, orig: email.message.Message):
+ res = super().__new__(cls)
+ vars(res).update(vars(orig))
+ return res
+
+ def __init__(self, *args, **kwargs):
+ self._headers = self._repair_headers()
+
+ # suppress spurious error from mypy
+ def __iter__(self):
+ return super().__iter__()
+
+ def __getitem__(self, item):
+ """
+ Override parent behavior to typical dict behavior.
+
+ ``email.message.Message`` will emit None values for missing
+ keys. Typical mappings, including this ``Message``, will raise
+ a key error for missing keys.
+
+ Ref python/importlib_metadata#371.
+ """
+ res = super().__getitem__(item)
+ if res is None:
+ raise KeyError(item)
+ return res
+
+ def _repair_headers(self):
+ def redent(value):
+ "Correct for RFC822 indentation"
+ if not value or '\n' not in value:
+ return value
+ return textwrap.dedent(' ' * 8 + value)
+
+ headers = [(key, redent(value)) for key, value in vars(self)['_headers']]
+ if self._payload:
+ headers.append(('Description', self.get_payload()))
+ return headers
+
+ @property
+ def json(self):
+ """
+ Convert PackageMetadata to a JSON-compatible format
+ per PEP 0566.
+ """
+
+ def transform(key):
+ value = self.get_all(key) if key in self.multiple_use_keys else self[key]
+ if key == 'Keywords':
+ value = re.split(r'\s+', value)
+ tk = key.lower().replace('-', '_')
+ return tk, value
+
+ return dict(map(transform, map(FoldedCase, self)))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_collections.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_collections.py
new file mode 100644
index 0000000000000000000000000000000000000000..cf0954e1a30546d781bf25781ec716ef92a77e32
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_collections.py
@@ -0,0 +1,30 @@
+import collections
+
+
+# from jaraco.collections 3.3
+class FreezableDefaultDict(collections.defaultdict):
+ """
+ Often it is desirable to prevent the mutation of
+ a default dict after its initial construction, such
+ as to prevent mutation during iteration.
+
+ >>> dd = FreezableDefaultDict(list)
+ >>> dd[0].append('1')
+ >>> dd.freeze()
+ >>> dd[1]
+ []
+ >>> len(dd)
+ 1
+ """
+
+ def __missing__(self, key):
+ return getattr(self, '_frozen', super().__missing__)(key)
+
+ def freeze(self):
+ self._frozen = lambda key: self.default_factory()
+
+
+class Pair(collections.namedtuple('Pair', 'name value')):
+ @classmethod
+ def parse(cls, text):
+ return cls(*map(str.strip, text.split("=", 1)))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_compat.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..df312b1cbbf18a337278df0e618fb9e8c862e5f6
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_compat.py
@@ -0,0 +1,57 @@
+import sys
+import platform
+
+
+__all__ = ['install', 'NullFinder']
+
+
+def install(cls):
+ """
+ Class decorator for installation on sys.meta_path.
+
+ Adds the backport DistributionFinder to sys.meta_path and
+ attempts to disable the finder functionality of the stdlib
+ DistributionFinder.
+ """
+ sys.meta_path.append(cls())
+ disable_stdlib_finder()
+ return cls
+
+
+def disable_stdlib_finder():
+ """
+ Give the backport primacy for discovering path-based distributions
+ by monkey-patching the stdlib O_O.
+
+ See #91 for more background for rationale on this sketchy
+ behavior.
+ """
+
+ def matches(finder):
+ return getattr(
+ finder, '__module__', None
+ ) == '_frozen_importlib_external' and hasattr(finder, 'find_distributions')
+
+ for finder in filter(matches, sys.meta_path): # pragma: nocover
+ del finder.find_distributions
+
+
+class NullFinder:
+ """
+ A "Finder" (aka "MetaPathFinder") that never finds any modules,
+ but may find distributions.
+ """
+
+ @staticmethod
+ def find_spec(*args, **kwargs):
+ return None
+
+
+def pypy_partial(val):
+ """
+ Adjust for variable stacklevel on partial under PyPy.
+
+ Workaround for #327.
+ """
+ is_pypy = platform.python_implementation() == 'PyPy'
+ return val + is_pypy
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_functools.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_functools.py
new file mode 100644
index 0000000000000000000000000000000000000000..71f66bd03cb713a2190853bdf7170c4ea80d2425
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_functools.py
@@ -0,0 +1,104 @@
+import types
+import functools
+
+
+# from jaraco.functools 3.3
+def method_cache(method, cache_wrapper=None):
+ """
+ Wrap lru_cache to support storing the cache data in the object instances.
+
+ Abstracts the common paradigm where the method explicitly saves an
+ underscore-prefixed protected property on first call and returns that
+ subsequently.
+
+ >>> class MyClass:
+ ... calls = 0
+ ...
+ ... @method_cache
+ ... def method(self, value):
+ ... self.calls += 1
+ ... return value
+
+ >>> a = MyClass()
+ >>> a.method(3)
+ 3
+ >>> for x in range(75):
+ ... res = a.method(x)
+ >>> a.calls
+ 75
+
+ Note that the apparent behavior will be exactly like that of lru_cache
+ except that the cache is stored on each instance, so values in one
+ instance will not flush values from another, and when an instance is
+ deleted, so are the cached values for that instance.
+
+ >>> b = MyClass()
+ >>> for x in range(35):
+ ... res = b.method(x)
+ >>> b.calls
+ 35
+ >>> a.method(0)
+ 0
+ >>> a.calls
+ 75
+
+ Note that if method had been decorated with ``functools.lru_cache()``,
+ a.calls would have been 76 (due to the cached value of 0 having been
+ flushed by the 'b' instance).
+
+ Clear the cache with ``.cache_clear()``
+
+ >>> a.method.cache_clear()
+
+ Same for a method that hasn't yet been called.
+
+ >>> c = MyClass()
+ >>> c.method.cache_clear()
+
+ Another cache wrapper may be supplied:
+
+ >>> cache = functools.lru_cache(maxsize=2)
+ >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
+ >>> a = MyClass()
+ >>> a.method2()
+ 3
+
+ Caution - do not subsequently wrap the method with another decorator, such
+ as ``@property``, which changes the semantics of the function.
+
+ See also
+ http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
+ for another implementation and additional justification.
+ """
+ cache_wrapper = cache_wrapper or functools.lru_cache()
+
+ def wrapper(self, *args, **kwargs):
+ # it's the first call, replace the method with a cached, bound method
+ bound_method = types.MethodType(method, self)
+ cached_method = cache_wrapper(bound_method)
+ setattr(self, method.__name__, cached_method)
+ return cached_method(*args, **kwargs)
+
+ # Support cache clear even before cache has been created.
+ wrapper.cache_clear = lambda: None
+
+ return wrapper
+
+
+# From jaraco.functools 3.3
+def pass_none(func):
+ """
+ Wrap func so it's not called if its first param is None
+
+ >>> print_text = pass_none(print)
+ >>> print_text('text')
+ text
+ >>> print_text(None)
+ """
+
+ @functools.wraps(func)
+ def wrapper(param, *args, **kwargs):
+ if param is not None:
+ return func(param, *args, **kwargs)
+
+ return wrapper
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py
new file mode 100644
index 0000000000000000000000000000000000000000..d4ca9b9140e3f085b36609bb8dfdaea79c78e144
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py
@@ -0,0 +1,73 @@
+from itertools import filterfalse
+
+
+def unique_everseen(iterable, key=None):
+ "List unique elements, preserving order. Remember all elements ever seen."
+ # unique_everseen('AAAABBBCCDAABBB') --> A B C D
+ # unique_everseen('ABBCcAD', str.lower) --> A B C D
+ seen = set()
+ seen_add = seen.add
+ if key is None:
+ for element in filterfalse(seen.__contains__, iterable):
+ seen_add(element)
+ yield element
+ else:
+ for element in iterable:
+ k = key(element)
+ if k not in seen:
+ seen_add(k)
+ yield element
+
+
+# copied from more_itertools 8.8
+def always_iterable(obj, base_type=(str, bytes)):
+ """If *obj* is iterable, return an iterator over its items::
+
+ >>> obj = (1, 2, 3)
+ >>> list(always_iterable(obj))
+ [1, 2, 3]
+
+ If *obj* is not iterable, return a one-item iterable containing *obj*::
+
+ >>> obj = 1
+ >>> list(always_iterable(obj))
+ [1]
+
+ If *obj* is ``None``, return an empty iterable:
+
+ >>> obj = None
+ >>> list(always_iterable(None))
+ []
+
+ By default, binary and text strings are not considered iterable::
+
+ >>> obj = 'foo'
+ >>> list(always_iterable(obj))
+ ['foo']
+
+ If *base_type* is set, objects for which ``isinstance(obj, base_type)``
+ returns ``True`` won't be considered iterable.
+
+ >>> obj = {'a': 1}
+ >>> list(always_iterable(obj)) # Iterate over the dict's keys
+ ['a']
+ >>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit
+ [{'a': 1}]
+
+ Set *base_type* to ``None`` to avoid any special handling and treat objects
+ Python considers iterable as iterable:
+
+ >>> obj = 'foo'
+ >>> list(always_iterable(obj, base_type=None))
+ ['f', 'o', 'o']
+ """
+ if obj is None:
+ return iter(())
+
+ if (base_type is not None) and isinstance(obj, base_type):
+ return iter((obj,))
+
+ try:
+ return iter(obj)
+ except TypeError:
+ return iter((obj,))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_meta.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_meta.py
new file mode 100644
index 0000000000000000000000000000000000000000..1927d0f624d82f2fa12f81c80cce91279f039e84
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_meta.py
@@ -0,0 +1,67 @@
+from __future__ import annotations
+
+import os
+from typing import Protocol
+from typing import Any, Dict, Iterator, List, Optional, TypeVar, Union, overload
+
+
+_T = TypeVar("_T")
+
+
+class PackageMetadata(Protocol):
+ def __len__(self) -> int: ... # pragma: no cover
+
+ def __contains__(self, item: str) -> bool: ... # pragma: no cover
+
+ def __getitem__(self, key: str) -> str: ... # pragma: no cover
+
+ def __iter__(self) -> Iterator[str]: ... # pragma: no cover
+
+ @overload
+ def get(
+ self, name: str, failobj: None = None
+ ) -> Optional[str]: ... # pragma: no cover
+
+ @overload
+ def get(self, name: str, failobj: _T) -> Union[str, _T]: ... # pragma: no cover
+
+ # overload per python/importlib_metadata#435
+ @overload
+ def get_all(
+ self, name: str, failobj: None = None
+ ) -> Optional[List[Any]]: ... # pragma: no cover
+
+ @overload
+ def get_all(self, name: str, failobj: _T) -> Union[List[Any], _T]:
+ """
+ Return all values associated with a possibly multi-valued key.
+ """
+
+ @property
+ def json(self) -> Dict[str, Union[str, List[str]]]:
+ """
+ A JSON-compatible form of the metadata.
+ """
+
+
+class SimplePath(Protocol):
+ """
+ A minimal subset of pathlib.Path required by Distribution.
+ """
+
+ def joinpath(
+ self, other: Union[str, os.PathLike[str]]
+ ) -> SimplePath: ... # pragma: no cover
+
+ def __truediv__(
+ self, other: Union[str, os.PathLike[str]]
+ ) -> SimplePath: ... # pragma: no cover
+
+ @property
+ def parent(self) -> SimplePath: ... # pragma: no cover
+
+ def read_text(self, encoding=None) -> str: ... # pragma: no cover
+
+ def read_bytes(self) -> bytes: ... # pragma: no cover
+
+ def exists(self) -> bool: ... # pragma: no cover
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_text.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_text.py
new file mode 100644
index 0000000000000000000000000000000000000000..c88cfbb2349c6401336bc5ba6623f51afd1eb59d
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/_text.py
@@ -0,0 +1,99 @@
+import re
+
+from ._functools import method_cache
+
+
+# from jaraco.text 3.5
+class FoldedCase(str):
+ """
+ A case insensitive string class; behaves just like str
+ except compares equal when the only variation is case.
+
+ >>> s = FoldedCase('hello world')
+
+ >>> s == 'Hello World'
+ True
+
+ >>> 'Hello World' == s
+ True
+
+ >>> s != 'Hello World'
+ False
+
+ >>> s.index('O')
+ 4
+
+ >>> s.split('O')
+ ['hell', ' w', 'rld']
+
+ >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
+ ['alpha', 'Beta', 'GAMMA']
+
+ Sequence membership is straightforward.
+
+ >>> "Hello World" in [s]
+ True
+ >>> s in ["Hello World"]
+ True
+
+ You may test for set inclusion, but candidate and elements
+ must both be folded.
+
+ >>> FoldedCase("Hello World") in {s}
+ True
+ >>> s in {FoldedCase("Hello World")}
+ True
+
+ String inclusion works as long as the FoldedCase object
+ is on the right.
+
+ >>> "hello" in FoldedCase("Hello World")
+ True
+
+ But not if the FoldedCase object is on the left:
+
+ >>> FoldedCase('hello') in 'Hello World'
+ False
+
+ In that case, use in_:
+
+ >>> FoldedCase('hello').in_('Hello World')
+ True
+
+ >>> FoldedCase('hello') > FoldedCase('Hello')
+ False
+ """
+
+ def __lt__(self, other):
+ return self.lower() < other.lower()
+
+ def __gt__(self, other):
+ return self.lower() > other.lower()
+
+ def __eq__(self, other):
+ return self.lower() == other.lower()
+
+ def __ne__(self, other):
+ return self.lower() != other.lower()
+
+ def __hash__(self):
+ return hash(self.lower())
+
+ def __contains__(self, other):
+ return super().lower().__contains__(other.lower())
+
+ def in_(self, other):
+ "Does self appear in other?"
+ return self in FoldedCase(other)
+
+ # cache lower since it's likely to be called frequently.
+ @method_cache
+ def lower(self):
+ return super().lower()
+
+ def index(self, sub):
+ return self.lower().index(sub.lower())
+
+ def split(self, splitter=' ', maxsplit=0):
+ pattern = re.compile(re.escape(splitter), re.I)
+ return pattern.split(self, maxsplit)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py
new file mode 100644
index 0000000000000000000000000000000000000000..3a5327436f9b1d9eae371e321c491a270634b3cf
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py311.py
@@ -0,0 +1,22 @@
+import os
+import pathlib
+import sys
+import types
+
+
+def wrap(path): # pragma: no cover
+ """
+ Workaround for https://github.com/python/cpython/issues/84538
+ to add backward compatibility for walk_up=True.
+ An example affected package is dask-labextension, which uses
+ jupyter-packaging to install JupyterLab javascript files outside
+ of site-packages.
+ """
+
+ def relative_to(root, *, walk_up=False):
+ return pathlib.Path(os.path.relpath(path, root))
+
+ return types.SimpleNamespace(relative_to=relative_to)
+
+
+relative_fix = wrap if sys.version_info < (3, 12) else lambda x: x
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py
new file mode 100644
index 0000000000000000000000000000000000000000..1f15bd97e6aa028d3e86734dd08c0eb5c06d79bc
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/compat/py39.py
@@ -0,0 +1,36 @@
+"""
+Compatibility layer with Python 3.8/3.9
+"""
+
+from typing import TYPE_CHECKING, Any, Optional
+
+if TYPE_CHECKING: # pragma: no cover
+ # Prevent circular imports on runtime.
+ from .. import Distribution, EntryPoint
+else:
+ Distribution = EntryPoint = Any
+
+
+def normalized_name(dist: Distribution) -> Optional[str]:
+ """
+ Honor name normalization for distributions that don't provide ``_normalized_name``.
+ """
+ try:
+ return dist._normalized_name
+ except AttributeError:
+ from .. import Prepared # -> delay to prevent circular imports.
+
+ return Prepared.normalize(getattr(dist, "name", None) or dist.metadata['Name'])
+
+
+def ep_matches(ep: EntryPoint, **params) -> bool:
+ """
+ Workaround for ``EntryPoint`` objects without the ``matches`` method.
+ """
+ try:
+ return ep.matches(**params)
+ except AttributeError:
+ from .. import EntryPoint # -> delay to prevent circular imports.
+
+ # Reconstruct the EntryPoint object to make sure it is compatible.
+ return EntryPoint(ep.name, ep.value, ep.group).matches(**params)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py
new file mode 100644
index 0000000000000000000000000000000000000000..e405471ac4d94371b1ee9b1622227ff76b337180
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/diagnose.py
@@ -0,0 +1,21 @@
+import sys
+
+from . import Distribution
+
+
+def inspect(path):
+ print("Inspecting", path)
+ dists = list(Distribution.discover(path=[path]))
+ if not dists:
+ return
+ print("Found", len(dists), "packages:", end=' ')
+ print(', '.join(dist.name for dist in dists))
+
+
+def run():
+ for path in sys.path:
+ inspect(path)
+
+
+if __name__ == '__main__':
+ run()
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/py.typed b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/importlib_metadata/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..1bb5a44356f00884a71ceeefd24ded6caaba2418
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/LICENSE
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..9a2097a54aaaf21e7f46235a3ccf362213032ca9
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/METADATA
@@ -0,0 +1,591 @@
+Metadata-Version: 2.1
+Name: inflect
+Version: 7.3.1
+Summary: Correctly generate plurals, singular nouns, ordinals, indefinite articles
+Author-email: Paul Dyson
+Maintainer-email: "Jason R. Coombs"
+Project-URL: Source, https://github.com/jaraco/inflect
+Keywords: plural,inflect,participle
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Natural Language :: English
+Classifier: Operating System :: OS Independent
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Text Processing :: Linguistic
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: more-itertools >=8.5.0
+Requires-Dist: typeguard >=4.0.1
+Requires-Dist: typing-extensions ; python_version < "3.9"
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: pygments ; extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/inflect.svg
+ :target: https://pypi.org/project/inflect
+
+.. image:: https://img.shields.io/pypi/pyversions/inflect.svg
+
+.. image:: https://github.com/jaraco/inflect/actions/workflows/main.yml/badge.svg
+ :target: https://github.com/jaraco/inflect/actions?query=workflow%3A%22tests%22
+ :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+ :target: https://github.com/astral-sh/ruff
+ :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/inflect/badge/?version=latest
+ :target: https://inflect.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+ :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/inflect
+ :target: https://tidelift.com/subscription/pkg/pypi-inflect?utm_source=pypi-inflect&utm_medium=readme
+
+NAME
+====
+
+inflect.py - Correctly generate plurals, singular nouns, ordinals, indefinite articles; convert numbers to words.
+
+SYNOPSIS
+========
+
+.. code-block:: python
+
+ import inflect
+
+ p = inflect.engine()
+
+ # METHODS:
+
+ # plural plural_noun plural_verb plural_adj singular_noun no num
+ # compare compare_nouns compare_nouns compare_adjs
+ # a an
+ # present_participle
+ # ordinal number_to_words
+ # join
+ # inflect classical gender
+ # defnoun defverb defadj defa defan
+
+
+ # UNCONDITIONALLY FORM THE PLURAL
+
+ print("The plural of ", word, " is ", p.plural(word))
+
+
+ # CONDITIONALLY FORM THE PLURAL
+
+ print("I saw", cat_count, p.plural("cat", cat_count))
+
+
+ # FORM PLURALS FOR SPECIFIC PARTS OF SPEECH
+
+ print(
+ p.plural_noun("I", N1),
+ p.plural_verb("saw", N1),
+ p.plural_adj("my", N2),
+ p.plural_noun("saw", N2),
+ )
+
+
+ # FORM THE SINGULAR OF PLURAL NOUNS
+
+ print("The singular of ", word, " is ", p.singular_noun(word))
+
+ # SELECT THE GENDER OF SINGULAR PRONOUNS
+
+ print(p.singular_noun("they")) # 'it'
+ p.gender("feminine")
+ print(p.singular_noun("they")) # 'she'
+
+
+ # DEAL WITH "0/1/N" -> "no/1/N" TRANSLATION:
+
+ print("There ", p.plural_verb("was", errors), p.no(" error", errors))
+
+
+ # USE DEFAULT COUNTS:
+
+ print(
+ p.num(N1, ""),
+ p.plural("I"),
+ p.plural_verb(" saw"),
+ p.num(N2),
+ p.plural_noun(" saw"),
+ )
+ print("There ", p.num(errors, ""), p.plural_verb("was"), p.no(" error"))
+
+
+ # COMPARE TWO WORDS "NUMBER-INSENSITIVELY":
+
+ if p.compare(word1, word2):
+ print("same")
+ if p.compare_nouns(word1, word2):
+ print("same noun")
+ if p.compare_verbs(word1, word2):
+ print("same verb")
+ if p.compare_adjs(word1, word2):
+ print("same adj.")
+
+
+ # ADD CORRECT "a" OR "an" FOR A GIVEN WORD:
+
+ print("Did you want ", p.a(thing), " or ", p.an(idea))
+
+
+ # CONVERT NUMERALS INTO ORDINALS (i.e. 1->1st, 2->2nd, 3->3rd, etc.)
+
+ print("It was", p.ordinal(position), " from the left\n")
+
+ # CONVERT NUMERALS TO WORDS (i.e. 1->"one", 101->"one hundred and one", etc.)
+ # RETURNS A SINGLE STRING...
+
+ words = p.number_to_words(1234)
+ # "one thousand, two hundred and thirty-four"
+ words = p.number_to_words(p.ordinal(1234))
+ # "one thousand, two hundred and thirty-fourth"
+
+
+ # GET BACK A LIST OF STRINGS, ONE FOR EACH "CHUNK"...
+
+ words = p.number_to_words(1234, wantlist=True)
+ # ("one thousand","two hundred and thirty-four")
+
+
+ # OPTIONAL PARAMETERS CHANGE TRANSLATION:
+
+ words = p.number_to_words(12345, group=1)
+ # "one, two, three, four, five"
+
+ words = p.number_to_words(12345, group=2)
+ # "twelve, thirty-four, five"
+
+ words = p.number_to_words(12345, group=3)
+ # "one twenty-three, forty-five"
+
+ words = p.number_to_words(1234, andword="")
+ # "one thousand, two hundred thirty-four"
+
+ words = p.number_to_words(1234, andword=", plus")
+ # "one thousand, two hundred, plus thirty-four"
+ # TODO: I get no comma before plus: check perl
+
+ words = p.number_to_words(555_1202, group=1, zero="oh")
+ # "five, five, five, one, two, oh, two"
+
+ words = p.number_to_words(555_1202, group=1, one="unity")
+ # "five, five, five, unity, two, oh, two"
+
+ words = p.number_to_words(123.456, group=1, decimal="mark")
+ # "one two three mark four five six"
+ # TODO: DOCBUG: perl gives commas here as do I
+
+ # LITERAL STYLE ONLY NAMES NUMBERS LESS THAN A CERTAIN THRESHOLD...
+
+ words = p.number_to_words(9, threshold=10) # "nine"
+ words = p.number_to_words(10, threshold=10) # "ten"
+ words = p.number_to_words(11, threshold=10) # "11"
+ words = p.number_to_words(1000, threshold=10) # "1,000"
+
+ # JOIN WORDS INTO A LIST:
+
+ mylist = p.join(("apple", "banana", "carrot"))
+ # "apple, banana, and carrot"
+
+ mylist = p.join(("apple", "banana"))
+ # "apple and banana"
+
+ mylist = p.join(("apple", "banana", "carrot"), final_sep="")
+ # "apple, banana and carrot"
+
+
+ # REQUIRE "CLASSICAL" PLURALS (EG: "focus"->"foci", "cherub"->"cherubim")
+
+ p.classical() # USE ALL CLASSICAL PLURALS
+
+ p.classical(all=True) # USE ALL CLASSICAL PLURALS
+ p.classical(all=False) # SWITCH OFF CLASSICAL MODE
+
+ p.classical(zero=True) # "no error" INSTEAD OF "no errors"
+ p.classical(zero=False) # "no errors" INSTEAD OF "no error"
+
+ p.classical(herd=True) # "2 buffalo" INSTEAD OF "2 buffalos"
+ p.classical(herd=False) # "2 buffalos" INSTEAD OF "2 buffalo"
+
+ p.classical(persons=True) # "2 chairpersons" INSTEAD OF "2 chairpeople"
+ p.classical(persons=False) # "2 chairpeople" INSTEAD OF "2 chairpersons"
+
+ p.classical(ancient=True) # "2 formulae" INSTEAD OF "2 formulas"
+ p.classical(ancient=False) # "2 formulas" INSTEAD OF "2 formulae"
+
+
+ # INTERPOLATE "plural()", "plural_noun()", "plural_verb()", "plural_adj()", "singular_noun()",
+ # a()", "an()", "num()" AND "ordinal()" WITHIN STRINGS:
+
+ print(p.inflect("The plural of {0} is plural('{0}')".format(word)))
+ print(p.inflect("The singular of {0} is singular_noun('{0}')".format(word)))
+ print(p.inflect("I saw {0} plural('cat',{0})".format(cat_count)))
+ print(
+ p.inflect(
+ "plural('I',{0}) "
+ "plural_verb('saw',{0}) "
+ "plural('a',{1}) "
+ "plural_noun('saw',{1})".format(N1, N2)
+ )
+ )
+ print(
+ p.inflect(
+ "num({0}, False)plural('I') "
+ "plural_verb('saw') "
+ "num({1}, False)plural('a') "
+ "plural_noun('saw')".format(N1, N2)
+ )
+ )
+ print(p.inflect("I saw num({0}) plural('cat')\nnum()".format(cat_count)))
+ print(p.inflect("There plural_verb('was',{0}) no('error',{0})".format(errors)))
+ print(p.inflect("There num({0}, False)plural_verb('was') no('error')".format(errors)))
+ print(p.inflect("Did you want a('{0}') or an('{1}')".format(thing, idea)))
+ print(p.inflect("It was ordinal('{0}') from the left".format(position)))
+
+
+ # ADD USER-DEFINED INFLECTIONS (OVERRIDING INBUILT RULES):
+
+ p.defnoun("VAX", "VAXen") # SINGULAR => PLURAL
+
+ p.defverb(
+ "will", # 1ST PERSON SINGULAR
+ "shall", # 1ST PERSON PLURAL
+ "will", # 2ND PERSON SINGULAR
+ "will", # 2ND PERSON PLURAL
+ "will", # 3RD PERSON SINGULAR
+ "will", # 3RD PERSON PLURAL
+ )
+
+ p.defadj("hir", "their") # SINGULAR => PLURAL
+
+ p.defa("h") # "AY HALWAYS SEZ 'HAITCH'!"
+
+ p.defan("horrendous.*") # "AN HORRENDOUS AFFECTATION"
+
+
+DESCRIPTION
+===========
+
+The methods of the class ``engine`` in module ``inflect.py`` provide plural
+inflections, singular noun inflections, "a"/"an" selection for English words,
+and manipulation of numbers as words.
+
+Plural forms of all nouns, most verbs, and some adjectives are
+provided. Where appropriate, "classical" variants (for example: "brother" ->
+"brethren", "dogma" -> "dogmata", etc.) are also provided.
+
+Single forms of nouns are also provided. The gender of singular pronouns
+can be chosen (for example "they" -> "it" or "she" or "he" or "they").
+
+Pronunciation-based "a"/"an" selection is provided for all English
+words, and most initialisms.
+
+It is also possible to inflect numerals (1,2,3) to ordinals (1st, 2nd, 3rd)
+and to English words ("one", "two", "three").
+
+In generating these inflections, ``inflect.py`` follows the Oxford
+English Dictionary and the guidelines in Fowler's Modern English
+Usage, preferring the former where the two disagree.
+
+The module is built around standard British spelling, but is designed
+to cope with common American variants as well. Slang, jargon, and
+other English dialects are *not* explicitly catered for.
+
+Where two or more inflected forms exist for a single word (typically a
+"classical" form and a "modern" form), ``inflect.py`` prefers the
+more common form (typically the "modern" one), unless "classical"
+processing has been specified
+(see `MODERN VS CLASSICAL INFLECTIONS`).
+
+FORMING PLURALS AND SINGULARS
+=============================
+
+Inflecting Plurals and Singulars
+--------------------------------
+
+All of the ``plural...`` plural inflection methods take the word to be
+inflected as their first argument and return the corresponding inflection.
+Note that all such methods expect the *singular* form of the word. The
+results of passing a plural form are undefined (and unlikely to be correct).
+Similarly, the ``si...`` singular inflection method expects the *plural*
+form of the word.
+
+The ``plural...`` methods also take an optional second argument,
+which indicates the grammatical "number" of the word (or of another word
+with which the word being inflected must agree). If the "number" argument is
+supplied and is not ``1`` (or ``"one"`` or ``"a"``, or some other adjective that
+implies the singular), the plural form of the word is returned. If the
+"number" argument *does* indicate singularity, the (uninflected) word
+itself is returned. If the number argument is omitted, the plural form
+is returned unconditionally.
+
+The ``si...`` method takes a second argument in a similar fashion. If it is
+some form of the number ``1``, or is omitted, the singular form is returned.
+Otherwise the plural is returned unaltered.
+
+
+The various methods of ``inflect.engine`` are:
+
+
+
+``plural_noun(word, count=None)``
+
+ The method ``plural_noun()`` takes a *singular* English noun or
+ pronoun and returns its plural. Pronouns in the nominative ("I" ->
+ "we") and accusative ("me" -> "us") cases are handled, as are
+ possessive pronouns ("mine" -> "ours").
+
+
+``plural_verb(word, count=None)``
+
+ The method ``plural_verb()`` takes the *singular* form of a
+ conjugated verb (that is, one which is already in the correct "person"
+ and "mood") and returns the corresponding plural conjugation.
+
+
+``plural_adj(word, count=None)``
+
+ The method ``plural_adj()`` takes the *singular* form of
+ certain types of adjectives and returns the corresponding plural form.
+ Adjectives that are correctly handled include: "numerical" adjectives
+ ("a" -> "some"), demonstrative adjectives ("this" -> "these", "that" ->
+ "those"), and possessives ("my" -> "our", "cat's" -> "cats'", "child's"
+ -> "childrens'", etc.)
+
+
+``plural(word, count=None)``
+
+ The method ``plural()`` takes a *singular* English noun,
+ pronoun, verb, or adjective and returns its plural form. Where a word
+ has more than one inflection depending on its part of speech (for
+ example, the noun "thought" inflects to "thoughts", the verb "thought"
+ to "thought"), the (singular) noun sense is preferred to the (singular)
+ verb sense.
+
+ Hence ``plural("knife")`` will return "knives" ("knife" having been treated
+ as a singular noun), whereas ``plural("knifes")`` will return "knife"
+ ("knifes" having been treated as a 3rd person singular verb).
+
+ The inherent ambiguity of such cases suggests that,
+ where the part of speech is known, ``plural_noun``, ``plural_verb``, and
+ ``plural_adj`` should be used in preference to ``plural``.
+
+
+``singular_noun(word, count=None)``
+
+ The method ``singular_noun()`` takes a *plural* English noun or
+ pronoun and returns its singular. Pronouns in the nominative ("we" ->
+ "I") and accusative ("us" -> "me") cases are handled, as are
+ possessive pronouns ("ours" -> "mine"). When third person
+ singular pronouns are returned they take the neuter gender by default
+ ("they" -> "it"), not ("they"-> "she") nor ("they" -> "he"). This can be
+ changed with ``gender()``.
+
+Note that all these methods ignore any whitespace surrounding the
+word being inflected, but preserve that whitespace when the result is
+returned. For example, ``plural(" cat ")`` returns " cats ".
+
+
+``gender(genderletter)``
+
+ The third person plural pronoun takes the same form for the female, male and
+ neuter (e.g. "they"). The singular however, depends upon gender (e.g. "she",
+ "he", "it" and "they" -- "they" being the gender neutral form.) By default
+ ``singular_noun`` returns the neuter form, however, the gender can be selected with
+ the ``gender`` method. Pass the first letter of the gender to
+ ``gender`` to return the f(eminine), m(asculine), n(euter) or t(hey)
+ form of the singular. e.g.
+ gender('f') followed by singular_noun('themselves') returns 'herself'.
+
+Numbered plurals
+----------------
+
+The ``plural...`` methods return only the inflected word, not the count that
+was used to inflect it. Thus, in order to produce "I saw 3 ducks", it
+is necessary to use:
+
+.. code-block:: python
+
+ print("I saw", N, p.plural_noun(animal, N))
+
+Since the usual purpose of producing a plural is to make it agree with
+a preceding count, inflect.py provides a method
+(``no(word, count)``) which, given a word and a(n optional) count, returns the
+count followed by the correctly inflected word. Hence the previous
+example can be rewritten:
+
+.. code-block:: python
+
+ print("I saw ", p.no(animal, N))
+
+In addition, if the count is zero (or some other term which implies
+zero, such as ``"zero"``, ``"nil"``, etc.) the count is replaced by the
+word "no". Hence, if ``N`` had the value zero, the previous example
+would print (the somewhat more elegant)::
+
+ I saw no animals
+
+rather than::
+
+ I saw 0 animals
+
+Note that the name of the method is a pun: the method
+returns either a number (a *No.*) or a ``"no"``, in front of the
+inflected word.
+
+
+Reducing the number of counts required
+--------------------------------------
+
+In some contexts, the need to supply an explicit count to the various
+``plural...`` methods makes for tiresome repetition. For example:
+
+.. code-block:: python
+
+ print(
+ plural_adj("This", errors),
+ plural_noun(" error", errors),
+ plural_verb(" was", errors),
+ " fatal.",
+ )
+
+inflect.py therefore provides a method
+(``num(count=None, show=None)``) which may be used to set a persistent "default number"
+value. If such a value is set, it is subsequently used whenever an
+optional second "number" argument is omitted. The default value thus set
+can subsequently be removed by calling ``num()`` with no arguments.
+Hence we could rewrite the previous example:
+
+.. code-block:: python
+
+ p.num(errors)
+ print(p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal.")
+ p.num()
+
+Normally, ``num()`` returns its first argument, so that it may also
+be "inlined" in contexts like:
+
+.. code-block:: python
+
+ print(p.num(errors), p.plural_noun(" error"), p.plural_verb(" was"), " detected.")
+ if severity > 1:
+ print(
+ p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
+ )
+
+However, in certain contexts (see `INTERPOLATING INFLECTIONS IN STRINGS`)
+it is preferable that ``num()`` return an empty string. Hence ``num()``
+provides an optional second argument. If that argument is supplied (that is, if
+it is defined) and evaluates to false, ``num`` returns an empty string
+instead of its first argument. For example:
+
+.. code-block:: python
+
+ print(p.num(errors, 0), p.no("error"), p.plural_verb(" was"), " detected.")
+ if severity > 1:
+ print(
+ p.plural_adj("This"), p.plural_noun(" error"), p.plural_verb(" was"), "fatal."
+ )
+
+
+
+Number-insensitive equality
+---------------------------
+
+inflect.py also provides a solution to the problem
+of comparing words of differing plurality through the methods
+``compare(word1, word2)``, ``compare_nouns(word1, word2)``,
+``compare_verbs(word1, word2)``, and ``compare_adjs(word1, word2)``.
+Each of these methods takes two strings, and compares them
+using the corresponding plural-inflection method (``plural()``, ``plural_noun()``,
+``plural_verb()``, and ``plural_adj()`` respectively).
+
+The comparison returns true if:
+
+- the strings are equal, or
+- one string is equal to a plural form of the other, or
+- the strings are two different plural forms of the one word.
+
+
+Hence all of the following return true:
+
+.. code-block:: python
+
+ p.compare("index", "index") # RETURNS "eq"
+ p.compare("index", "indexes") # RETURNS "s:p"
+ p.compare("index", "indices") # RETURNS "s:p"
+ p.compare("indexes", "index") # RETURNS "p:s"
+ p.compare("indices", "index") # RETURNS "p:s"
+ p.compare("indices", "indexes") # RETURNS "p:p"
+ p.compare("indexes", "indices") # RETURNS "p:p"
+ p.compare("indices", "indices") # RETURNS "eq"
+
+As indicated by the comments in the previous example, the actual value
+returned by the various ``compare`` methods encodes which of the
+three equality rules succeeded: "eq" is returned if the strings were
+identical, "s:p" if the strings were singular and plural respectively,
+"p:s" for plural and singular, and "p:p" for two distinct plurals.
+Inequality is indicated by returning an empty string.
+
+It should be noted that two distinct singular words which happen to take
+the same plural form are *not* considered equal, nor are cases where
+one (singular) word's plural is the other (plural) word's singular.
+Hence all of the following return false:
+
+.. code-block:: python
+
+ p.compare("base", "basis") # ALTHOUGH BOTH -> "bases"
+ p.compare("syrinx", "syringe") # ALTHOUGH BOTH -> "syringes"
+ p.compare("she", "he") # ALTHOUGH BOTH -> "they"
+
+ p.compare("opus", "operas") # ALTHOUGH "opus" -> "opera" -> "operas"
+ p.compare("taxi", "taxes") # ALTHOUGH "taxi" -> "taxis" -> "taxes"
+
+Note too that, although the comparison is "number-insensitive" it is *not*
+case-insensitive (that is, ``plural("time","Times")`` returns false. To obtain
+both number and case insensitivity, use the ``lower()`` method on both strings
+(that is, ``plural("time".lower(), "Times".lower())`` returns true).
+
+Related Functionality
+=====================
+
+Shout out to these libraries that provide related functionality:
+
+* `WordSet `_
+ parses identifiers like variable names into sets of words suitable for re-assembling
+ in another form.
+
+* `word2number `_ converts words to
+ a number.
+
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..73ff576be5f4bf4cc1caa75633e475150b69cf2f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/RECORD
@@ -0,0 +1,13 @@
+inflect-7.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+inflect-7.3.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+inflect-7.3.1.dist-info/METADATA,sha256=ZgMNY0WAZRs-U8wZiV2SMfjSKqBrMngXyDMs_CAwMwg,21079
+inflect-7.3.1.dist-info/RECORD,,
+inflect-7.3.1.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
+inflect-7.3.1.dist-info/top_level.txt,sha256=m52ujdp10CqT6jh1XQxZT6kEntcnv-7Tl7UiGNTzWZA,8
+inflect/__init__.py,sha256=Jxy1HJXZiZ85kHeLAhkmvz6EMTdFqBe-duvt34R6IOc,103796
+inflect/__pycache__/__init__.cpython-312.pyc,,
+inflect/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+inflect/compat/__pycache__/__init__.cpython-312.pyc,,
+inflect/compat/__pycache__/py38.cpython-312.pyc,,
+inflect/compat/py38.py,sha256=oObVfVnWX9_OpnOuEJn1mFbJxVhwyR5epbiTNXDDaso,160
+inflect/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..564c6724e4bdf48d3dc10e804a73f100414c6533
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: setuptools (70.2.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0fd75fab3e9e94881f61ee5eb66aef862e637a36
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect-7.3.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+inflect
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..3eec27f4c67f24db167393895a6eaf0a9aa16d35
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/__init__.py
@@ -0,0 +1,3986 @@
+"""
+inflect: english language inflection
+ - correctly generate plurals, ordinals, indefinite articles
+ - convert numbers to words
+
+Copyright (C) 2010 Paul Dyson
+
+Based upon the Perl module
+`Lingua::EN::Inflect `_.
+
+methods:
+ classical inflect
+ plural plural_noun plural_verb plural_adj singular_noun no num a an
+ compare compare_nouns compare_verbs compare_adjs
+ present_participle
+ ordinal
+ number_to_words
+ join
+ defnoun defverb defadj defa defan
+
+INFLECTIONS:
+ classical inflect
+ plural plural_noun plural_verb plural_adj singular_noun compare
+ no num a an present_participle
+
+PLURALS:
+ classical inflect
+ plural plural_noun plural_verb plural_adj singular_noun no num
+ compare compare_nouns compare_verbs compare_adjs
+
+COMPARISONS:
+ classical
+ compare compare_nouns compare_verbs compare_adjs
+
+ARTICLES:
+ classical inflect num a an
+
+NUMERICAL:
+ ordinal number_to_words
+
+USER_DEFINED:
+ defnoun defverb defadj defa defan
+
+Exceptions:
+ UnknownClassicalModeError
+ BadNumValueError
+ BadChunkingOptionError
+ NumOutOfRangeError
+ BadUserDefinedPatternError
+ BadRcFileError
+ BadGenderError
+
+"""
+
+from __future__ import annotations
+
+import ast
+import collections
+import contextlib
+import functools
+import itertools
+import re
+from numbers import Number
+from typing import (
+ TYPE_CHECKING,
+ Any,
+ Callable,
+ Dict,
+ Iterable,
+ List,
+ Literal,
+ Match,
+ Optional,
+ Sequence,
+ Tuple,
+ Union,
+ cast,
+)
+
+from more_itertools import windowed_complete
+from typeguard import typechecked
+
+from .compat.py38 import Annotated
+
+
+class UnknownClassicalModeError(Exception):
+ pass
+
+
+class BadNumValueError(Exception):
+ pass
+
+
+class BadChunkingOptionError(Exception):
+ pass
+
+
+class NumOutOfRangeError(Exception):
+ pass
+
+
+class BadUserDefinedPatternError(Exception):
+ pass
+
+
+class BadRcFileError(Exception):
+ pass
+
+
+class BadGenderError(Exception):
+ pass
+
+
+def enclose(s: str) -> str:
+ return f"(?:{s})"
+
+
+def joinstem(cutpoint: Optional[int] = 0, words: Optional[Iterable[str]] = None) -> str:
+ """
+ Join stem of each word in words into a string for regex.
+
+ Each word is truncated at cutpoint.
+
+ Cutpoint is usually negative indicating the number of letters to remove
+ from the end of each word.
+
+ >>> joinstem(-2, ["ephemeris", "iris", ".*itis"])
+ '(?:ephemer|ir|.*it)'
+
+ >>> joinstem(None, ["ephemeris"])
+ '(?:ephemeris)'
+
+ >>> joinstem(5, None)
+ '(?:)'
+ """
+ return enclose("|".join(w[:cutpoint] for w in words or []))
+
+
+def bysize(words: Iterable[str]) -> Dict[int, set]:
+ """
+ From a list of words, return a dict of sets sorted by word length.
+
+ >>> words = ['ant', 'cat', 'dog', 'pig', 'frog', 'goat', 'horse', 'elephant']
+ >>> ret = bysize(words)
+ >>> sorted(ret[3])
+ ['ant', 'cat', 'dog', 'pig']
+ >>> ret[5]
+ {'horse'}
+ """
+ res: Dict[int, set] = collections.defaultdict(set)
+ for w in words:
+ res[len(w)].add(w)
+ return res
+
+
+def make_pl_si_lists(
+ lst: Iterable[str],
+ plending: str,
+ siendingsize: Optional[int],
+ dojoinstem: bool = True,
+):
+ """
+ given a list of singular words: lst
+
+ an ending to append to make the plural: plending
+
+ the number of characters to remove from the singular
+ before appending plending: siendingsize
+
+ a flag whether to create a joinstem: dojoinstem
+
+ return:
+ a list of pluralised words: si_list (called si because this is what you need to
+ look for to make the singular)
+
+ the pluralised words as a dict of sets sorted by word length: si_bysize
+ the singular words as a dict of sets sorted by word length: pl_bysize
+ if dojoinstem is True: a regular expression that matches any of the stems: stem
+ """
+ if siendingsize is not None:
+ siendingsize = -siendingsize
+ si_list = [w[:siendingsize] + plending for w in lst]
+ pl_bysize = bysize(lst)
+ si_bysize = bysize(si_list)
+ if dojoinstem:
+ stem = joinstem(siendingsize, lst)
+ return si_list, si_bysize, pl_bysize, stem
+ else:
+ return si_list, si_bysize, pl_bysize
+
+
+# 1. PLURALS
+
+pl_sb_irregular_s = {
+ "corpus": "corpuses|corpora",
+ "opus": "opuses|opera",
+ "genus": "genera",
+ "mythos": "mythoi",
+ "penis": "penises|penes",
+ "testis": "testes",
+ "atlas": "atlases|atlantes",
+ "yes": "yeses",
+}
+
+pl_sb_irregular = {
+ "child": "children",
+ "chili": "chilis|chilies",
+ "brother": "brothers|brethren",
+ "infinity": "infinities|infinity",
+ "loaf": "loaves",
+ "lore": "lores|lore",
+ "hoof": "hoofs|hooves",
+ "beef": "beefs|beeves",
+ "thief": "thiefs|thieves",
+ "money": "monies",
+ "mongoose": "mongooses",
+ "ox": "oxen",
+ "cow": "cows|kine",
+ "graffito": "graffiti",
+ "octopus": "octopuses|octopodes",
+ "genie": "genies|genii",
+ "ganglion": "ganglions|ganglia",
+ "trilby": "trilbys",
+ "turf": "turfs|turves",
+ "numen": "numina",
+ "atman": "atmas",
+ "occiput": "occiputs|occipita",
+ "sabretooth": "sabretooths",
+ "sabertooth": "sabertooths",
+ "lowlife": "lowlifes",
+ "flatfoot": "flatfoots",
+ "tenderfoot": "tenderfoots",
+ "romany": "romanies",
+ "jerry": "jerries",
+ "mary": "maries",
+ "talouse": "talouses",
+ "rom": "roma",
+ "carmen": "carmina",
+}
+
+pl_sb_irregular.update(pl_sb_irregular_s)
+# pl_sb_irregular_keys = enclose('|'.join(pl_sb_irregular.keys()))
+
+pl_sb_irregular_caps = {
+ "Romany": "Romanies",
+ "Jerry": "Jerrys",
+ "Mary": "Marys",
+ "Rom": "Roma",
+}
+
+pl_sb_irregular_compound = {"prima donna": "prima donnas|prime donne"}
+
+si_sb_irregular = {v: k for (k, v) in pl_sb_irregular.items()}
+for k in list(si_sb_irregular):
+ if "|" in k:
+ k1, k2 = k.split("|")
+ si_sb_irregular[k1] = si_sb_irregular[k2] = si_sb_irregular[k]
+ del si_sb_irregular[k]
+si_sb_irregular_caps = {v: k for (k, v) in pl_sb_irregular_caps.items()}
+si_sb_irregular_compound = {v: k for (k, v) in pl_sb_irregular_compound.items()}
+for k in list(si_sb_irregular_compound):
+ if "|" in k:
+ k1, k2 = k.split("|")
+ si_sb_irregular_compound[k1] = si_sb_irregular_compound[k2] = (
+ si_sb_irregular_compound[k]
+ )
+ del si_sb_irregular_compound[k]
+
+# si_sb_irregular_keys = enclose('|'.join(si_sb_irregular.keys()))
+
+# Z's that don't double
+
+pl_sb_z_zes_list = ("quartz", "topaz")
+pl_sb_z_zes_bysize = bysize(pl_sb_z_zes_list)
+
+pl_sb_ze_zes_list = ("snooze",)
+pl_sb_ze_zes_bysize = bysize(pl_sb_ze_zes_list)
+
+
+# CLASSICAL "..is" -> "..ides"
+
+pl_sb_C_is_ides_complete = [
+ # GENERAL WORDS...
+ "ephemeris",
+ "iris",
+ "clitoris",
+ "chrysalis",
+ "epididymis",
+]
+
+pl_sb_C_is_ides_endings = [
+ # INFLAMATIONS...
+ "itis"
+]
+
+pl_sb_C_is_ides = joinstem(
+ -2, pl_sb_C_is_ides_complete + [f".*{w}" for w in pl_sb_C_is_ides_endings]
+)
+
+pl_sb_C_is_ides_list = pl_sb_C_is_ides_complete + pl_sb_C_is_ides_endings
+
+(
+ si_sb_C_is_ides_list,
+ si_sb_C_is_ides_bysize,
+ pl_sb_C_is_ides_bysize,
+) = make_pl_si_lists(pl_sb_C_is_ides_list, "ides", 2, dojoinstem=False)
+
+
+# CLASSICAL "..a" -> "..ata"
+
+pl_sb_C_a_ata_list = (
+ "anathema",
+ "bema",
+ "carcinoma",
+ "charisma",
+ "diploma",
+ "dogma",
+ "drama",
+ "edema",
+ "enema",
+ "enigma",
+ "lemma",
+ "lymphoma",
+ "magma",
+ "melisma",
+ "miasma",
+ "oedema",
+ "sarcoma",
+ "schema",
+ "soma",
+ "stigma",
+ "stoma",
+ "trauma",
+ "gumma",
+ "pragma",
+)
+
+(
+ si_sb_C_a_ata_list,
+ si_sb_C_a_ata_bysize,
+ pl_sb_C_a_ata_bysize,
+ pl_sb_C_a_ata,
+) = make_pl_si_lists(pl_sb_C_a_ata_list, "ata", 1)
+
+# UNCONDITIONAL "..a" -> "..ae"
+
+pl_sb_U_a_ae_list = (
+ "alumna",
+ "alga",
+ "vertebra",
+ "persona",
+ "vita",
+)
+(
+ si_sb_U_a_ae_list,
+ si_sb_U_a_ae_bysize,
+ pl_sb_U_a_ae_bysize,
+ pl_sb_U_a_ae,
+) = make_pl_si_lists(pl_sb_U_a_ae_list, "e", None)
+
+# CLASSICAL "..a" -> "..ae"
+
+pl_sb_C_a_ae_list = (
+ "amoeba",
+ "antenna",
+ "formula",
+ "hyperbola",
+ "medusa",
+ "nebula",
+ "parabola",
+ "abscissa",
+ "hydra",
+ "nova",
+ "lacuna",
+ "aurora",
+ "umbra",
+ "flora",
+ "fauna",
+)
+(
+ si_sb_C_a_ae_list,
+ si_sb_C_a_ae_bysize,
+ pl_sb_C_a_ae_bysize,
+ pl_sb_C_a_ae,
+) = make_pl_si_lists(pl_sb_C_a_ae_list, "e", None)
+
+
+# CLASSICAL "..en" -> "..ina"
+
+pl_sb_C_en_ina_list = ("stamen", "foramen", "lumen")
+
+(
+ si_sb_C_en_ina_list,
+ si_sb_C_en_ina_bysize,
+ pl_sb_C_en_ina_bysize,
+ pl_sb_C_en_ina,
+) = make_pl_si_lists(pl_sb_C_en_ina_list, "ina", 2)
+
+
+# UNCONDITIONAL "..um" -> "..a"
+
+pl_sb_U_um_a_list = (
+ "bacterium",
+ "agendum",
+ "desideratum",
+ "erratum",
+ "stratum",
+ "datum",
+ "ovum",
+ "extremum",
+ "candelabrum",
+)
+(
+ si_sb_U_um_a_list,
+ si_sb_U_um_a_bysize,
+ pl_sb_U_um_a_bysize,
+ pl_sb_U_um_a,
+) = make_pl_si_lists(pl_sb_U_um_a_list, "a", 2)
+
+# CLASSICAL "..um" -> "..a"
+
+pl_sb_C_um_a_list = (
+ "maximum",
+ "minimum",
+ "momentum",
+ "optimum",
+ "quantum",
+ "cranium",
+ "curriculum",
+ "dictum",
+ "phylum",
+ "aquarium",
+ "compendium",
+ "emporium",
+ "encomium",
+ "gymnasium",
+ "honorarium",
+ "interregnum",
+ "lustrum",
+ "memorandum",
+ "millennium",
+ "rostrum",
+ "spectrum",
+ "speculum",
+ "stadium",
+ "trapezium",
+ "ultimatum",
+ "medium",
+ "vacuum",
+ "velum",
+ "consortium",
+ "arboretum",
+)
+
+(
+ si_sb_C_um_a_list,
+ si_sb_C_um_a_bysize,
+ pl_sb_C_um_a_bysize,
+ pl_sb_C_um_a,
+) = make_pl_si_lists(pl_sb_C_um_a_list, "a", 2)
+
+
+# UNCONDITIONAL "..us" -> "i"
+
+pl_sb_U_us_i_list = (
+ "alumnus",
+ "alveolus",
+ "bacillus",
+ "bronchus",
+ "locus",
+ "nucleus",
+ "stimulus",
+ "meniscus",
+ "sarcophagus",
+)
+(
+ si_sb_U_us_i_list,
+ si_sb_U_us_i_bysize,
+ pl_sb_U_us_i_bysize,
+ pl_sb_U_us_i,
+) = make_pl_si_lists(pl_sb_U_us_i_list, "i", 2)
+
+# CLASSICAL "..us" -> "..i"
+
+pl_sb_C_us_i_list = (
+ "focus",
+ "radius",
+ "genius",
+ "incubus",
+ "succubus",
+ "nimbus",
+ "fungus",
+ "nucleolus",
+ "stylus",
+ "torus",
+ "umbilicus",
+ "uterus",
+ "hippopotamus",
+ "cactus",
+)
+
+(
+ si_sb_C_us_i_list,
+ si_sb_C_us_i_bysize,
+ pl_sb_C_us_i_bysize,
+ pl_sb_C_us_i,
+) = make_pl_si_lists(pl_sb_C_us_i_list, "i", 2)
+
+
+# CLASSICAL "..us" -> "..us" (ASSIMILATED 4TH DECLENSION LATIN NOUNS)
+
+pl_sb_C_us_us = (
+ "status",
+ "apparatus",
+ "prospectus",
+ "sinus",
+ "hiatus",
+ "impetus",
+ "plexus",
+)
+pl_sb_C_us_us_bysize = bysize(pl_sb_C_us_us)
+
+# UNCONDITIONAL "..on" -> "a"
+
+pl_sb_U_on_a_list = (
+ "criterion",
+ "perihelion",
+ "aphelion",
+ "phenomenon",
+ "prolegomenon",
+ "noumenon",
+ "organon",
+ "asyndeton",
+ "hyperbaton",
+)
+(
+ si_sb_U_on_a_list,
+ si_sb_U_on_a_bysize,
+ pl_sb_U_on_a_bysize,
+ pl_sb_U_on_a,
+) = make_pl_si_lists(pl_sb_U_on_a_list, "a", 2)
+
+# CLASSICAL "..on" -> "..a"
+
+pl_sb_C_on_a_list = ("oxymoron",)
+
+(
+ si_sb_C_on_a_list,
+ si_sb_C_on_a_bysize,
+ pl_sb_C_on_a_bysize,
+ pl_sb_C_on_a,
+) = make_pl_si_lists(pl_sb_C_on_a_list, "a", 2)
+
+
+# CLASSICAL "..o" -> "..i" (BUT NORMALLY -> "..os")
+
+pl_sb_C_o_i = [
+ "solo",
+ "soprano",
+ "basso",
+ "alto",
+ "contralto",
+ "tempo",
+ "piano",
+ "virtuoso",
+] # list not tuple so can concat for pl_sb_U_o_os
+
+pl_sb_C_o_i_bysize = bysize(pl_sb_C_o_i)
+si_sb_C_o_i_bysize = bysize([f"{w[:-1]}i" for w in pl_sb_C_o_i])
+
+pl_sb_C_o_i_stems = joinstem(-1, pl_sb_C_o_i)
+
+# ALWAYS "..o" -> "..os"
+
+pl_sb_U_o_os_complete = {"ado", "ISO", "NATO", "NCO", "NGO", "oto"}
+si_sb_U_o_os_complete = {f"{w}s" for w in pl_sb_U_o_os_complete}
+
+
+pl_sb_U_o_os_endings = [
+ "aficionado",
+ "aggro",
+ "albino",
+ "allegro",
+ "ammo",
+ "Antananarivo",
+ "archipelago",
+ "armadillo",
+ "auto",
+ "avocado",
+ "Bamako",
+ "Barquisimeto",
+ "bimbo",
+ "bingo",
+ "Biro",
+ "bolero",
+ "Bolzano",
+ "bongo",
+ "Boto",
+ "burro",
+ "Cairo",
+ "canto",
+ "cappuccino",
+ "casino",
+ "cello",
+ "Chicago",
+ "Chimango",
+ "cilantro",
+ "cochito",
+ "coco",
+ "Colombo",
+ "Colorado",
+ "commando",
+ "concertino",
+ "contango",
+ "credo",
+ "crescendo",
+ "cyano",
+ "demo",
+ "ditto",
+ "Draco",
+ "dynamo",
+ "embryo",
+ "Esperanto",
+ "espresso",
+ "euro",
+ "falsetto",
+ "Faro",
+ "fiasco",
+ "Filipino",
+ "flamenco",
+ "furioso",
+ "generalissimo",
+ "Gestapo",
+ "ghetto",
+ "gigolo",
+ "gizmo",
+ "Greensboro",
+ "gringo",
+ "Guaiabero",
+ "guano",
+ "gumbo",
+ "gyro",
+ "hairdo",
+ "hippo",
+ "Idaho",
+ "impetigo",
+ "inferno",
+ "info",
+ "intermezzo",
+ "intertrigo",
+ "Iquico",
+ "jumbo",
+ "junto",
+ "Kakapo",
+ "kilo",
+ "Kinkimavo",
+ "Kokako",
+ "Kosovo",
+ "Lesotho",
+ "libero",
+ "libido",
+ "libretto",
+ "lido",
+ "Lilo",
+ "limbo",
+ "limo",
+ "lineno",
+ "lingo",
+ "lino",
+ "livedo",
+ "loco",
+ "logo",
+ "lumbago",
+ "macho",
+ "macro",
+ "mafioso",
+ "magneto",
+ "magnifico",
+ "Majuro",
+ "Malabo",
+ "manifesto",
+ "Maputo",
+ "Maracaibo",
+ "medico",
+ "memo",
+ "metro",
+ "Mexico",
+ "micro",
+ "Milano",
+ "Monaco",
+ "mono",
+ "Montenegro",
+ "Morocco",
+ "Muqdisho",
+ "myo",
+ "neutrino",
+ "Ningbo",
+ "octavo",
+ "oregano",
+ "Orinoco",
+ "Orlando",
+ "Oslo",
+ "panto",
+ "Paramaribo",
+ "Pardusco",
+ "pedalo",
+ "photo",
+ "pimento",
+ "pinto",
+ "pleco",
+ "Pluto",
+ "pogo",
+ "polo",
+ "poncho",
+ "Porto-Novo",
+ "Porto",
+ "pro",
+ "psycho",
+ "pueblo",
+ "quarto",
+ "Quito",
+ "repo",
+ "rhino",
+ "risotto",
+ "rococo",
+ "rondo",
+ "Sacramento",
+ "saddo",
+ "sago",
+ "salvo",
+ "Santiago",
+ "Sapporo",
+ "Sarajevo",
+ "scherzando",
+ "scherzo",
+ "silo",
+ "sirocco",
+ "sombrero",
+ "staccato",
+ "sterno",
+ "stucco",
+ "stylo",
+ "sumo",
+ "Taiko",
+ "techno",
+ "terrazzo",
+ "testudo",
+ "timpano",
+ "tiro",
+ "tobacco",
+ "Togo",
+ "Tokyo",
+ "torero",
+ "Torino",
+ "Toronto",
+ "torso",
+ "tremolo",
+ "typo",
+ "tyro",
+ "ufo",
+ "UNESCO",
+ "vaquero",
+ "vermicello",
+ "verso",
+ "vibrato",
+ "violoncello",
+ "Virgo",
+ "weirdo",
+ "WHO",
+ "WTO",
+ "Yamoussoukro",
+ "yo-yo",
+ "zero",
+ "Zibo",
+] + pl_sb_C_o_i
+
+pl_sb_U_o_os_bysize = bysize(pl_sb_U_o_os_endings)
+si_sb_U_o_os_bysize = bysize([f"{w}s" for w in pl_sb_U_o_os_endings])
+
+
+# UNCONDITIONAL "..ch" -> "..chs"
+
+pl_sb_U_ch_chs_list = ("czech", "eunuch", "stomach")
+
+(
+ si_sb_U_ch_chs_list,
+ si_sb_U_ch_chs_bysize,
+ pl_sb_U_ch_chs_bysize,
+ pl_sb_U_ch_chs,
+) = make_pl_si_lists(pl_sb_U_ch_chs_list, "s", None)
+
+
+# UNCONDITIONAL "..[ei]x" -> "..ices"
+
+pl_sb_U_ex_ices_list = ("codex", "murex", "silex")
+(
+ si_sb_U_ex_ices_list,
+ si_sb_U_ex_ices_bysize,
+ pl_sb_U_ex_ices_bysize,
+ pl_sb_U_ex_ices,
+) = make_pl_si_lists(pl_sb_U_ex_ices_list, "ices", 2)
+
+pl_sb_U_ix_ices_list = ("radix", "helix")
+(
+ si_sb_U_ix_ices_list,
+ si_sb_U_ix_ices_bysize,
+ pl_sb_U_ix_ices_bysize,
+ pl_sb_U_ix_ices,
+) = make_pl_si_lists(pl_sb_U_ix_ices_list, "ices", 2)
+
+# CLASSICAL "..[ei]x" -> "..ices"
+
+pl_sb_C_ex_ices_list = (
+ "vortex",
+ "vertex",
+ "cortex",
+ "latex",
+ "pontifex",
+ "apex",
+ "index",
+ "simplex",
+)
+
+(
+ si_sb_C_ex_ices_list,
+ si_sb_C_ex_ices_bysize,
+ pl_sb_C_ex_ices_bysize,
+ pl_sb_C_ex_ices,
+) = make_pl_si_lists(pl_sb_C_ex_ices_list, "ices", 2)
+
+
+pl_sb_C_ix_ices_list = ("appendix",)
+
+(
+ si_sb_C_ix_ices_list,
+ si_sb_C_ix_ices_bysize,
+ pl_sb_C_ix_ices_bysize,
+ pl_sb_C_ix_ices,
+) = make_pl_si_lists(pl_sb_C_ix_ices_list, "ices", 2)
+
+
+# ARABIC: ".." -> "..i"
+
+pl_sb_C_i_list = ("afrit", "afreet", "efreet")
+
+(si_sb_C_i_list, si_sb_C_i_bysize, pl_sb_C_i_bysize, pl_sb_C_i) = make_pl_si_lists(
+ pl_sb_C_i_list, "i", None
+)
+
+
+# HEBREW: ".." -> "..im"
+
+pl_sb_C_im_list = ("goy", "seraph", "cherub")
+
+(si_sb_C_im_list, si_sb_C_im_bysize, pl_sb_C_im_bysize, pl_sb_C_im) = make_pl_si_lists(
+ pl_sb_C_im_list, "im", None
+)
+
+
+# UNCONDITIONAL "..man" -> "..mans"
+
+pl_sb_U_man_mans_list = """
+ ataman caiman cayman ceriman
+ desman dolman farman harman hetman
+ human leman ottoman shaman talisman
+""".split()
+pl_sb_U_man_mans_caps_list = """
+ Alabaman Bahaman Burman German
+ Hiroshiman Liman Nakayaman Norman Oklahoman
+ Panaman Roman Selman Sonaman Tacoman Yakiman
+ Yokohaman Yuman
+""".split()
+
+(
+ si_sb_U_man_mans_list,
+ si_sb_U_man_mans_bysize,
+ pl_sb_U_man_mans_bysize,
+) = make_pl_si_lists(pl_sb_U_man_mans_list, "s", None, dojoinstem=False)
+(
+ si_sb_U_man_mans_caps_list,
+ si_sb_U_man_mans_caps_bysize,
+ pl_sb_U_man_mans_caps_bysize,
+) = make_pl_si_lists(pl_sb_U_man_mans_caps_list, "s", None, dojoinstem=False)
+
+# UNCONDITIONAL "..louse" -> "..lice"
+pl_sb_U_louse_lice_list = ("booklouse", "grapelouse", "louse", "woodlouse")
+
+(
+ si_sb_U_louse_lice_list,
+ si_sb_U_louse_lice_bysize,
+ pl_sb_U_louse_lice_bysize,
+) = make_pl_si_lists(pl_sb_U_louse_lice_list, "lice", 5, dojoinstem=False)
+
+pl_sb_uninflected_s_complete = [
+ # PAIRS OR GROUPS SUBSUMED TO A SINGULAR...
+ "breeches",
+ "britches",
+ "pajamas",
+ "pyjamas",
+ "clippers",
+ "gallows",
+ "hijinks",
+ "headquarters",
+ "pliers",
+ "scissors",
+ "testes",
+ "herpes",
+ "pincers",
+ "shears",
+ "proceedings",
+ "trousers",
+ # UNASSIMILATED LATIN 4th DECLENSION
+ "cantus",
+ "coitus",
+ "nexus",
+ # RECENT IMPORTS...
+ "contretemps",
+ "corps",
+ "debris",
+ "siemens",
+ # DISEASES
+ "mumps",
+ # MISCELLANEOUS OTHERS...
+ "diabetes",
+ "jackanapes",
+ "series",
+ "species",
+ "subspecies",
+ "rabies",
+ "chassis",
+ "innings",
+ "news",
+ "mews",
+ "haggis",
+]
+
+pl_sb_uninflected_s_endings = [
+ # RECENT IMPORTS...
+ "ois",
+ # DISEASES
+ "measles",
+]
+
+pl_sb_uninflected_s = pl_sb_uninflected_s_complete + [
+ f".*{w}" for w in pl_sb_uninflected_s_endings
+]
+
+pl_sb_uninflected_herd = (
+ # DON'T INFLECT IN CLASSICAL MODE, OTHERWISE NORMAL INFLECTION
+ "wildebeest",
+ "swine",
+ "eland",
+ "bison",
+ "buffalo",
+ "cattle",
+ "elk",
+ "rhinoceros",
+ "zucchini",
+ "caribou",
+ "dace",
+ "grouse",
+ "guinea fowl",
+ "guinea-fowl",
+ "haddock",
+ "hake",
+ "halibut",
+ "herring",
+ "mackerel",
+ "pickerel",
+ "pike",
+ "roe",
+ "seed",
+ "shad",
+ "snipe",
+ "teal",
+ "turbot",
+ "water fowl",
+ "water-fowl",
+)
+
+pl_sb_uninflected_complete = [
+ # SOME FISH AND HERD ANIMALS
+ "tuna",
+ "salmon",
+ "mackerel",
+ "trout",
+ "bream",
+ "sea-bass",
+ "sea bass",
+ "carp",
+ "cod",
+ "flounder",
+ "whiting",
+ "moose",
+ # OTHER ODDITIES
+ "graffiti",
+ "djinn",
+ "samuri",
+ "offspring",
+ "pence",
+ "quid",
+ "hertz",
+] + pl_sb_uninflected_s_complete
+# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
+
+pl_sb_uninflected_caps = [
+ # ALL NATIONALS ENDING IN -ese
+ "Portuguese",
+ "Amoyese",
+ "Borghese",
+ "Congoese",
+ "Faroese",
+ "Foochowese",
+ "Genevese",
+ "Genoese",
+ "Gilbertese",
+ "Hottentotese",
+ "Kiplingese",
+ "Kongoese",
+ "Lucchese",
+ "Maltese",
+ "Nankingese",
+ "Niasese",
+ "Pekingese",
+ "Piedmontese",
+ "Pistoiese",
+ "Sarawakese",
+ "Shavese",
+ "Vermontese",
+ "Wenchowese",
+ "Yengeese",
+]
+
+
+pl_sb_uninflected_endings = [
+ # UNCOUNTABLE NOUNS
+ "butter",
+ "cash",
+ "furniture",
+ "information",
+ # SOME FISH AND HERD ANIMALS
+ "fish",
+ "deer",
+ "sheep",
+ # ALL NATIONALS ENDING IN -ese
+ "nese",
+ "rese",
+ "lese",
+ "mese",
+ # DISEASES
+ "pox",
+ # OTHER ODDITIES
+ "craft",
+] + pl_sb_uninflected_s_endings
+# SOME WORDS ENDING IN ...s (OFTEN PAIRS TAKEN AS A WHOLE)
+
+
+pl_sb_uninflected_bysize = bysize(pl_sb_uninflected_endings)
+
+
+# SINGULAR WORDS ENDING IN ...s (ALL INFLECT WITH ...es)
+
+pl_sb_singular_s_complete = [
+ "acropolis",
+ "aegis",
+ "alias",
+ "asbestos",
+ "bathos",
+ "bias",
+ "bronchitis",
+ "bursitis",
+ "caddis",
+ "cannabis",
+ "canvas",
+ "chaos",
+ "cosmos",
+ "dais",
+ "digitalis",
+ "epidermis",
+ "ethos",
+ "eyas",
+ "gas",
+ "glottis",
+ "hubris",
+ "ibis",
+ "lens",
+ "mantis",
+ "marquis",
+ "metropolis",
+ "pathos",
+ "pelvis",
+ "polis",
+ "rhinoceros",
+ "sassafras",
+ "trellis",
+] + pl_sb_C_is_ides_complete
+
+
+pl_sb_singular_s_endings = ["ss", "us"] + pl_sb_C_is_ides_endings
+
+pl_sb_singular_s_bysize = bysize(pl_sb_singular_s_endings)
+
+si_sb_singular_s_complete = [f"{w}es" for w in pl_sb_singular_s_complete]
+si_sb_singular_s_endings = [f"{w}es" for w in pl_sb_singular_s_endings]
+si_sb_singular_s_bysize = bysize(si_sb_singular_s_endings)
+
+pl_sb_singular_s_es = ["[A-Z].*es"]
+
+pl_sb_singular_s = enclose(
+ "|".join(
+ pl_sb_singular_s_complete
+ + [f".*{w}" for w in pl_sb_singular_s_endings]
+ + pl_sb_singular_s_es
+ )
+)
+
+
+# PLURALS ENDING IN uses -> use
+
+
+si_sb_ois_oi_case = ("Bolshois", "Hanois")
+
+si_sb_uses_use_case = ("Betelgeuses", "Duses", "Meuses", "Syracuses", "Toulouses")
+
+si_sb_uses_use = (
+ "abuses",
+ "applauses",
+ "blouses",
+ "carouses",
+ "causes",
+ "chartreuses",
+ "clauses",
+ "contuses",
+ "douses",
+ "excuses",
+ "fuses",
+ "grouses",
+ "hypotenuses",
+ "masseuses",
+ "menopauses",
+ "misuses",
+ "muses",
+ "overuses",
+ "pauses",
+ "peruses",
+ "profuses",
+ "recluses",
+ "reuses",
+ "ruses",
+ "souses",
+ "spouses",
+ "suffuses",
+ "transfuses",
+ "uses",
+)
+
+si_sb_ies_ie_case = (
+ "Addies",
+ "Aggies",
+ "Allies",
+ "Amies",
+ "Angies",
+ "Annies",
+ "Annmaries",
+ "Archies",
+ "Arties",
+ "Aussies",
+ "Barbies",
+ "Barries",
+ "Basies",
+ "Bennies",
+ "Bernies",
+ "Berties",
+ "Bessies",
+ "Betties",
+ "Billies",
+ "Blondies",
+ "Bobbies",
+ "Bonnies",
+ "Bowies",
+ "Brandies",
+ "Bries",
+ "Brownies",
+ "Callies",
+ "Carnegies",
+ "Carries",
+ "Cassies",
+ "Charlies",
+ "Cheries",
+ "Christies",
+ "Connies",
+ "Curies",
+ "Dannies",
+ "Debbies",
+ "Dixies",
+ "Dollies",
+ "Donnies",
+ "Drambuies",
+ "Eddies",
+ "Effies",
+ "Ellies",
+ "Elsies",
+ "Eries",
+ "Ernies",
+ "Essies",
+ "Eugenies",
+ "Fannies",
+ "Flossies",
+ "Frankies",
+ "Freddies",
+ "Gillespies",
+ "Goldies",
+ "Gracies",
+ "Guthries",
+ "Hallies",
+ "Hatties",
+ "Hetties",
+ "Hollies",
+ "Jackies",
+ "Jamies",
+ "Janies",
+ "Jannies",
+ "Jeanies",
+ "Jeannies",
+ "Jennies",
+ "Jessies",
+ "Jimmies",
+ "Jodies",
+ "Johnies",
+ "Johnnies",
+ "Josies",
+ "Julies",
+ "Kalgoorlies",
+ "Kathies",
+ "Katies",
+ "Kellies",
+ "Kewpies",
+ "Kristies",
+ "Laramies",
+ "Lassies",
+ "Lauries",
+ "Leslies",
+ "Lessies",
+ "Lillies",
+ "Lizzies",
+ "Lonnies",
+ "Lories",
+ "Lorries",
+ "Lotties",
+ "Louies",
+ "Mackenzies",
+ "Maggies",
+ "Maisies",
+ "Mamies",
+ "Marcies",
+ "Margies",
+ "Maries",
+ "Marjories",
+ "Matties",
+ "McKenzies",
+ "Melanies",
+ "Mickies",
+ "Millies",
+ "Minnies",
+ "Mollies",
+ "Mounties",
+ "Nannies",
+ "Natalies",
+ "Nellies",
+ "Netties",
+ "Ollies",
+ "Ozzies",
+ "Pearlies",
+ "Pottawatomies",
+ "Reggies",
+ "Richies",
+ "Rickies",
+ "Robbies",
+ "Ronnies",
+ "Rosalies",
+ "Rosemaries",
+ "Rosies",
+ "Roxies",
+ "Rushdies",
+ "Ruthies",
+ "Sadies",
+ "Sallies",
+ "Sammies",
+ "Scotties",
+ "Selassies",
+ "Sherries",
+ "Sophies",
+ "Stacies",
+ "Stefanies",
+ "Stephanies",
+ "Stevies",
+ "Susies",
+ "Sylvies",
+ "Tammies",
+ "Terries",
+ "Tessies",
+ "Tommies",
+ "Tracies",
+ "Trekkies",
+ "Valaries",
+ "Valeries",
+ "Valkyries",
+ "Vickies",
+ "Virgies",
+ "Willies",
+ "Winnies",
+ "Wylies",
+ "Yorkies",
+)
+
+si_sb_ies_ie = (
+ "aeries",
+ "baggies",
+ "belies",
+ "biggies",
+ "birdies",
+ "bogies",
+ "bonnies",
+ "boogies",
+ "bookies",
+ "bourgeoisies",
+ "brownies",
+ "budgies",
+ "caddies",
+ "calories",
+ "camaraderies",
+ "cockamamies",
+ "collies",
+ "cookies",
+ "coolies",
+ "cooties",
+ "coteries",
+ "crappies",
+ "curies",
+ "cutesies",
+ "dogies",
+ "eyries",
+ "floozies",
+ "footsies",
+ "freebies",
+ "genies",
+ "goalies",
+ "groupies",
+ "hies",
+ "jalousies",
+ "junkies",
+ "kiddies",
+ "laddies",
+ "lassies",
+ "lies",
+ "lingeries",
+ "magpies",
+ "menageries",
+ "mommies",
+ "movies",
+ "neckties",
+ "newbies",
+ "nighties",
+ "oldies",
+ "organdies",
+ "overlies",
+ "pies",
+ "pinkies",
+ "pixies",
+ "potpies",
+ "prairies",
+ "quickies",
+ "reveries",
+ "rookies",
+ "rotisseries",
+ "softies",
+ "sorties",
+ "species",
+ "stymies",
+ "sweeties",
+ "ties",
+ "underlies",
+ "unties",
+ "veggies",
+ "vies",
+ "yuppies",
+ "zombies",
+)
+
+
+si_sb_oes_oe_case = (
+ "Chloes",
+ "Crusoes",
+ "Defoes",
+ "Faeroes",
+ "Ivanhoes",
+ "Joes",
+ "McEnroes",
+ "Moes",
+ "Monroes",
+ "Noes",
+ "Poes",
+ "Roscoes",
+ "Tahoes",
+ "Tippecanoes",
+ "Zoes",
+)
+
+si_sb_oes_oe = (
+ "aloes",
+ "backhoes",
+ "canoes",
+ "does",
+ "floes",
+ "foes",
+ "hoes",
+ "mistletoes",
+ "oboes",
+ "pekoes",
+ "roes",
+ "sloes",
+ "throes",
+ "tiptoes",
+ "toes",
+ "woes",
+)
+
+si_sb_z_zes = ("quartzes", "topazes")
+
+si_sb_zzes_zz = ("buzzes", "fizzes", "frizzes", "razzes")
+
+si_sb_ches_che_case = (
+ "Andromaches",
+ "Apaches",
+ "Blanches",
+ "Comanches",
+ "Nietzsches",
+ "Porsches",
+ "Roches",
+)
+
+si_sb_ches_che = (
+ "aches",
+ "avalanches",
+ "backaches",
+ "bellyaches",
+ "caches",
+ "cloches",
+ "creches",
+ "douches",
+ "earaches",
+ "fiches",
+ "headaches",
+ "heartaches",
+ "microfiches",
+ "niches",
+ "pastiches",
+ "psyches",
+ "quiches",
+ "stomachaches",
+ "toothaches",
+ "tranches",
+)
+
+si_sb_xes_xe = ("annexes", "axes", "deluxes", "pickaxes")
+
+si_sb_sses_sse_case = ("Hesses", "Jesses", "Larousses", "Matisses")
+si_sb_sses_sse = (
+ "bouillabaisses",
+ "crevasses",
+ "demitasses",
+ "impasses",
+ "mousses",
+ "posses",
+)
+
+si_sb_ves_ve_case = (
+ # *[nwl]ives -> [nwl]live
+ "Clives",
+ "Palmolives",
+)
+si_sb_ves_ve = (
+ # *[^d]eaves -> eave
+ "interweaves",
+ "weaves",
+ # *[nwl]ives -> [nwl]live
+ "olives",
+ # *[eoa]lves -> [eoa]lve
+ "bivalves",
+ "dissolves",
+ "resolves",
+ "salves",
+ "twelves",
+ "valves",
+)
+
+
+plverb_special_s = enclose(
+ "|".join(
+ [pl_sb_singular_s]
+ + pl_sb_uninflected_s
+ + list(pl_sb_irregular_s)
+ + ["(.*[csx])is", "(.*)ceps", "[A-Z].*s"]
+ )
+)
+
+_pl_sb_postfix_adj_defn = (
+ ("general", enclose(r"(?!major|lieutenant|brigadier|adjutant|.*star)\S+")),
+ ("martial", enclose("court")),
+ ("force", enclose("pound")),
+)
+
+pl_sb_postfix_adj: Iterable[str] = (
+ enclose(val + f"(?=(?:-|\\s+){key})") for key, val in _pl_sb_postfix_adj_defn
+)
+
+pl_sb_postfix_adj_stems = f"({'|'.join(pl_sb_postfix_adj)})(.*)"
+
+
+# PLURAL WORDS ENDING IS es GO TO SINGULAR is
+
+si_sb_es_is = (
+ "amanuenses",
+ "amniocenteses",
+ "analyses",
+ "antitheses",
+ "apotheoses",
+ "arterioscleroses",
+ "atheroscleroses",
+ "axes",
+ # 'bases', # bases -> basis
+ "catalyses",
+ "catharses",
+ "chasses",
+ "cirrhoses",
+ "cocces",
+ "crises",
+ "diagnoses",
+ "dialyses",
+ "diereses",
+ "electrolyses",
+ "emphases",
+ "exegeses",
+ "geneses",
+ "halitoses",
+ "hydrolyses",
+ "hypnoses",
+ "hypotheses",
+ "hystereses",
+ "metamorphoses",
+ "metastases",
+ "misdiagnoses",
+ "mitoses",
+ "mononucleoses",
+ "narcoses",
+ "necroses",
+ "nemeses",
+ "neuroses",
+ "oases",
+ "osmoses",
+ "osteoporoses",
+ "paralyses",
+ "parentheses",
+ "parthenogeneses",
+ "periphrases",
+ "photosyntheses",
+ "probosces",
+ "prognoses",
+ "prophylaxes",
+ "prostheses",
+ "preces",
+ "psoriases",
+ "psychoanalyses",
+ "psychokineses",
+ "psychoses",
+ "scleroses",
+ "scolioses",
+ "sepses",
+ "silicoses",
+ "symbioses",
+ "synopses",
+ "syntheses",
+ "taxes",
+ "telekineses",
+ "theses",
+ "thromboses",
+ "tuberculoses",
+ "urinalyses",
+)
+
+pl_prep_list = """
+ about above across after among around at athwart before behind
+ below beneath beside besides between betwixt beyond but by
+ during except for from in into near of off on onto out over
+ since till to under until unto upon with""".split()
+
+pl_prep_list_da = pl_prep_list + ["de", "du", "da"]
+
+pl_prep_bysize = bysize(pl_prep_list_da)
+
+pl_prep = enclose("|".join(pl_prep_list_da))
+
+pl_sb_prep_dual_compound = rf"(.*?)((?:-|\s+)(?:{pl_prep})(?:-|\s+))a(?:-|\s+)(.*)"
+
+
+singular_pronoun_genders = {
+ "neuter",
+ "feminine",
+ "masculine",
+ "gender-neutral",
+ "feminine or masculine",
+ "masculine or feminine",
+}
+
+pl_pron_nom = {
+ # NOMINATIVE REFLEXIVE
+ "i": "we",
+ "myself": "ourselves",
+ "you": "you",
+ "yourself": "yourselves",
+ "she": "they",
+ "herself": "themselves",
+ "he": "they",
+ "himself": "themselves",
+ "it": "they",
+ "itself": "themselves",
+ "they": "they",
+ "themself": "themselves",
+ # POSSESSIVE
+ "mine": "ours",
+ "yours": "yours",
+ "hers": "theirs",
+ "his": "theirs",
+ "its": "theirs",
+ "theirs": "theirs",
+}
+
+si_pron: Dict[str, Dict[str, Union[str, Dict[str, str]]]] = {
+ "nom": {v: k for (k, v) in pl_pron_nom.items()}
+}
+si_pron["nom"]["we"] = "I"
+
+
+pl_pron_acc = {
+ # ACCUSATIVE REFLEXIVE
+ "me": "us",
+ "myself": "ourselves",
+ "you": "you",
+ "yourself": "yourselves",
+ "her": "them",
+ "herself": "themselves",
+ "him": "them",
+ "himself": "themselves",
+ "it": "them",
+ "itself": "themselves",
+ "them": "them",
+ "themself": "themselves",
+}
+
+pl_pron_acc_keys = enclose("|".join(pl_pron_acc))
+pl_pron_acc_keys_bysize = bysize(pl_pron_acc)
+
+si_pron["acc"] = {v: k for (k, v) in pl_pron_acc.items()}
+
+for _thecase, _plur, _gend, _sing in (
+ ("nom", "they", "neuter", "it"),
+ ("nom", "they", "feminine", "she"),
+ ("nom", "they", "masculine", "he"),
+ ("nom", "they", "gender-neutral", "they"),
+ ("nom", "they", "feminine or masculine", "she or he"),
+ ("nom", "they", "masculine or feminine", "he or she"),
+ ("nom", "themselves", "neuter", "itself"),
+ ("nom", "themselves", "feminine", "herself"),
+ ("nom", "themselves", "masculine", "himself"),
+ ("nom", "themselves", "gender-neutral", "themself"),
+ ("nom", "themselves", "feminine or masculine", "herself or himself"),
+ ("nom", "themselves", "masculine or feminine", "himself or herself"),
+ ("nom", "theirs", "neuter", "its"),
+ ("nom", "theirs", "feminine", "hers"),
+ ("nom", "theirs", "masculine", "his"),
+ ("nom", "theirs", "gender-neutral", "theirs"),
+ ("nom", "theirs", "feminine or masculine", "hers or his"),
+ ("nom", "theirs", "masculine or feminine", "his or hers"),
+ ("acc", "them", "neuter", "it"),
+ ("acc", "them", "feminine", "her"),
+ ("acc", "them", "masculine", "him"),
+ ("acc", "them", "gender-neutral", "them"),
+ ("acc", "them", "feminine or masculine", "her or him"),
+ ("acc", "them", "masculine or feminine", "him or her"),
+ ("acc", "themselves", "neuter", "itself"),
+ ("acc", "themselves", "feminine", "herself"),
+ ("acc", "themselves", "masculine", "himself"),
+ ("acc", "themselves", "gender-neutral", "themself"),
+ ("acc", "themselves", "feminine or masculine", "herself or himself"),
+ ("acc", "themselves", "masculine or feminine", "himself or herself"),
+):
+ try:
+ si_pron[_thecase][_plur][_gend] = _sing # type: ignore
+ except TypeError:
+ si_pron[_thecase][_plur] = {}
+ si_pron[_thecase][_plur][_gend] = _sing # type: ignore
+
+
+si_pron_acc_keys = enclose("|".join(si_pron["acc"]))
+si_pron_acc_keys_bysize = bysize(si_pron["acc"])
+
+
+def get_si_pron(thecase, word, gender) -> str:
+ try:
+ sing = si_pron[thecase][word]
+ except KeyError:
+ raise # not a pronoun
+ try:
+ return sing[gender] # has several types due to gender
+ except TypeError:
+ return cast(str, sing) # answer independent of gender
+
+
+# These dictionaries group verbs by first, second and third person
+# conjugations.
+
+plverb_irregular_pres = {
+ "am": "are",
+ "are": "are",
+ "is": "are",
+ "was": "were",
+ "were": "were",
+ "have": "have",
+ "has": "have",
+ "do": "do",
+ "does": "do",
+}
+
+plverb_ambiguous_pres = {
+ "act": "act",
+ "acts": "act",
+ "blame": "blame",
+ "blames": "blame",
+ "can": "can",
+ "must": "must",
+ "fly": "fly",
+ "flies": "fly",
+ "copy": "copy",
+ "copies": "copy",
+ "drink": "drink",
+ "drinks": "drink",
+ "fight": "fight",
+ "fights": "fight",
+ "fire": "fire",
+ "fires": "fire",
+ "like": "like",
+ "likes": "like",
+ "look": "look",
+ "looks": "look",
+ "make": "make",
+ "makes": "make",
+ "reach": "reach",
+ "reaches": "reach",
+ "run": "run",
+ "runs": "run",
+ "sink": "sink",
+ "sinks": "sink",
+ "sleep": "sleep",
+ "sleeps": "sleep",
+ "view": "view",
+ "views": "view",
+}
+
+plverb_ambiguous_pres_keys = re.compile(
+ rf"^({enclose('|'.join(plverb_ambiguous_pres))})((\s.*)?)$", re.IGNORECASE
+)
+
+
+plverb_irregular_non_pres = (
+ "did",
+ "had",
+ "ate",
+ "made",
+ "put",
+ "spent",
+ "fought",
+ "sank",
+ "gave",
+ "sought",
+ "shall",
+ "could",
+ "ought",
+ "should",
+)
+
+plverb_ambiguous_non_pres = re.compile(
+ r"^((?:thought|saw|bent|will|might|cut))((\s.*)?)$", re.IGNORECASE
+)
+
+# "..oes" -> "..oe" (the rest are "..oes" -> "o")
+
+pl_v_oes_oe = ("canoes", "floes", "oboes", "roes", "throes", "woes")
+pl_v_oes_oe_endings_size4 = ("hoes", "toes")
+pl_v_oes_oe_endings_size5 = ("shoes",)
+
+
+pl_count_zero = ("0", "no", "zero", "nil")
+
+
+pl_count_one = ("1", "a", "an", "one", "each", "every", "this", "that")
+
+pl_adj_special = {"a": "some", "an": "some", "this": "these", "that": "those"}
+
+pl_adj_special_keys = re.compile(
+ rf"^({enclose('|'.join(pl_adj_special))})$", re.IGNORECASE
+)
+
+pl_adj_poss = {
+ "my": "our",
+ "your": "your",
+ "its": "their",
+ "her": "their",
+ "his": "their",
+ "their": "their",
+}
+
+pl_adj_poss_keys = re.compile(rf"^({enclose('|'.join(pl_adj_poss))})$", re.IGNORECASE)
+
+
+# 2. INDEFINITE ARTICLES
+
+# THIS PATTERN MATCHES STRINGS OF CAPITALS STARTING WITH A "VOWEL-SOUND"
+# CONSONANT FOLLOWED BY ANOTHER CONSONANT, AND WHICH ARE NOT LIKELY
+# TO BE REAL WORDS (OH, ALL RIGHT THEN, IT'S JUST MAGIC!)
+
+A_abbrev = re.compile(
+ r"""
+^(?! FJO | [HLMNS]Y. | RY[EO] | SQU
+ | ( F[LR]? | [HL] | MN? | N | RH? | S[CHKLMNPTVW]? | X(YL)?) [AEIOU])
+[FHLMNRSX][A-Z]
+""",
+ re.VERBOSE,
+)
+
+# THIS PATTERN CODES THE BEGINNINGS OF ALL ENGLISH WORDS BEGINING WITH A
+# 'y' FOLLOWED BY A CONSONANT. ANY OTHER Y-CONSONANT PREFIX THEREFORE
+# IMPLIES AN ABBREVIATION.
+
+A_y_cons = re.compile(r"^(y(b[lor]|cl[ea]|fere|gg|p[ios]|rou|tt))", re.IGNORECASE)
+
+# EXCEPTIONS TO EXCEPTIONS
+
+A_explicit_a = re.compile(r"^((?:unabomber|unanimous|US))", re.IGNORECASE)
+
+A_explicit_an = re.compile(
+ r"^((?:euler|hour(?!i)|heir|honest|hono[ur]|mpeg))", re.IGNORECASE
+)
+
+A_ordinal_an = re.compile(r"^([aefhilmnorsx]-?th)", re.IGNORECASE)
+
+A_ordinal_a = re.compile(r"^([bcdgjkpqtuvwyz]-?th)", re.IGNORECASE)
+
+
+# NUMERICAL INFLECTIONS
+
+nth = {
+ 0: "th",
+ 1: "st",
+ 2: "nd",
+ 3: "rd",
+ 4: "th",
+ 5: "th",
+ 6: "th",
+ 7: "th",
+ 8: "th",
+ 9: "th",
+ 11: "th",
+ 12: "th",
+ 13: "th",
+}
+nth_suff = set(nth.values())
+
+ordinal = dict(
+ ty="tieth",
+ one="first",
+ two="second",
+ three="third",
+ five="fifth",
+ eight="eighth",
+ nine="ninth",
+ twelve="twelfth",
+)
+
+ordinal_suff = re.compile(rf"({'|'.join(ordinal)})\Z")
+
+
+# NUMBERS
+
+unit = ["", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
+teen = [
+ "ten",
+ "eleven",
+ "twelve",
+ "thirteen",
+ "fourteen",
+ "fifteen",
+ "sixteen",
+ "seventeen",
+ "eighteen",
+ "nineteen",
+]
+ten = [
+ "",
+ "",
+ "twenty",
+ "thirty",
+ "forty",
+ "fifty",
+ "sixty",
+ "seventy",
+ "eighty",
+ "ninety",
+]
+mill = [
+ " ",
+ " thousand",
+ " million",
+ " billion",
+ " trillion",
+ " quadrillion",
+ " quintillion",
+ " sextillion",
+ " septillion",
+ " octillion",
+ " nonillion",
+ " decillion",
+]
+
+
+# SUPPORT CLASSICAL PLURALIZATIONS
+
+def_classical = dict(
+ all=False, zero=False, herd=False, names=True, persons=False, ancient=False
+)
+
+all_classical = {k: True for k in def_classical}
+no_classical = {k: False for k in def_classical}
+
+
+# Maps strings to built-in constant types
+string_to_constant = {"True": True, "False": False, "None": None}
+
+
+# Pre-compiled regular expression objects
+DOLLAR_DIGITS = re.compile(r"\$(\d+)")
+FUNCTION_CALL = re.compile(r"((\w+)\([^)]*\)*)", re.IGNORECASE)
+PARTITION_WORD = re.compile(r"\A(\s*)(.+?)(\s*)\Z")
+PL_SB_POSTFIX_ADJ_STEMS_RE = re.compile(
+ rf"^(?:{pl_sb_postfix_adj_stems})$", re.IGNORECASE
+)
+PL_SB_PREP_DUAL_COMPOUND_RE = re.compile(
+ rf"^(?:{pl_sb_prep_dual_compound})$", re.IGNORECASE
+)
+DENOMINATOR = re.compile(r"(?P.+)( (per|a) .+)")
+PLVERB_SPECIAL_S_RE = re.compile(rf"^({plverb_special_s})$")
+WHITESPACE = re.compile(r"\s")
+ENDS_WITH_S = re.compile(r"^(.*[^s])s$", re.IGNORECASE)
+ENDS_WITH_APOSTROPHE_S = re.compile(r"^(.*)'s?$")
+INDEFINITE_ARTICLE_TEST = re.compile(r"\A(\s*)(?:an?\s+)?(.+?)(\s*)\Z", re.IGNORECASE)
+SPECIAL_AN = re.compile(r"^[aefhilmnorsx]$", re.IGNORECASE)
+SPECIAL_A = re.compile(r"^[bcdgjkpqtuvwyz]$", re.IGNORECASE)
+SPECIAL_ABBREV_AN = re.compile(r"^[aefhilmnorsx][.-]", re.IGNORECASE)
+SPECIAL_ABBREV_A = re.compile(r"^[a-z][.-]", re.IGNORECASE)
+CONSONANTS = re.compile(r"^[^aeiouy]", re.IGNORECASE)
+ARTICLE_SPECIAL_EU = re.compile(r"^e[uw]", re.IGNORECASE)
+ARTICLE_SPECIAL_ONCE = re.compile(r"^onc?e\b", re.IGNORECASE)
+ARTICLE_SPECIAL_ONETIME = re.compile(r"^onetime\b", re.IGNORECASE)
+ARTICLE_SPECIAL_UNIT = re.compile(r"^uni([^nmd]|mo)", re.IGNORECASE)
+ARTICLE_SPECIAL_UBA = re.compile(r"^u[bcfghjkqrst][aeiou]", re.IGNORECASE)
+ARTICLE_SPECIAL_UKR = re.compile(r"^ukr", re.IGNORECASE)
+SPECIAL_CAPITALS = re.compile(r"^U[NK][AIEO]?")
+VOWELS = re.compile(r"^[aeiou]", re.IGNORECASE)
+
+DIGIT_GROUP = re.compile(r"(\d)")
+TWO_DIGITS = re.compile(r"(\d)(\d)")
+THREE_DIGITS = re.compile(r"(\d)(\d)(\d)")
+THREE_DIGITS_WORD = re.compile(r"(\d)(\d)(\d)(?=\D*\Z)")
+TWO_DIGITS_WORD = re.compile(r"(\d)(\d)(?=\D*\Z)")
+ONE_DIGIT_WORD = re.compile(r"(\d)(?=\D*\Z)")
+
+FOUR_DIGIT_COMMA = re.compile(r"(\d)(\d{3}(?:,|\Z))")
+NON_DIGIT = re.compile(r"\D")
+WHITESPACES_COMMA = re.compile(r"\s+,")
+COMMA_WORD = re.compile(r", (\S+)\s+\Z")
+WHITESPACES = re.compile(r"\s+")
+
+
+PRESENT_PARTICIPLE_REPLACEMENTS = (
+ (re.compile(r"ie$"), r"y"),
+ (
+ re.compile(r"ue$"),
+ r"u",
+ ), # TODO: isn't ue$ -> u encompassed in the following rule?
+ (re.compile(r"([auy])e$"), r"\g<1>"),
+ (re.compile(r"ski$"), r"ski"),
+ (re.compile(r"[^b]i$"), r""),
+ (re.compile(r"^(are|were)$"), r"be"),
+ (re.compile(r"^(had)$"), r"hav"),
+ (re.compile(r"^(hoe)$"), r"\g<1>"),
+ (re.compile(r"([^e])e$"), r"\g<1>"),
+ (re.compile(r"er$"), r"er"),
+ (re.compile(r"([^aeiou][aeiouy]([bdgmnprst]))$"), r"\g<1>\g<2>"),
+)
+
+DIGIT = re.compile(r"\d")
+
+
+class Words(str):
+ lowered: str
+ split_: List[str]
+ first: str
+ last: str
+
+ def __init__(self, orig) -> None:
+ self.lowered = self.lower()
+ self.split_ = self.split()
+ self.first = self.split_[0]
+ self.last = self.split_[-1]
+
+
+Falsish = Any # ideally, falsish would only validate on bool(value) is False
+
+
+_STATIC_TYPE_CHECKING = TYPE_CHECKING
+# ^-- Workaround for typeguard AST manipulation:
+# https://github.com/agronholm/typeguard/issues/353#issuecomment-1556306554
+
+if _STATIC_TYPE_CHECKING: # pragma: no cover
+ Word = Annotated[str, "String with at least 1 character"]
+else:
+
+ class _WordMeta(type): # Too dynamic to be supported by mypy...
+ def __instancecheck__(self, instance: Any) -> bool:
+ return isinstance(instance, str) and len(instance) >= 1
+
+ class Word(metaclass=_WordMeta): # type: ignore[no-redef]
+ """String with at least 1 character"""
+
+
+class engine:
+ def __init__(self) -> None:
+ self.classical_dict = def_classical.copy()
+ self.persistent_count: Optional[int] = None
+ self.mill_count = 0
+ self.pl_sb_user_defined: List[Optional[Word]] = []
+ self.pl_v_user_defined: List[Optional[Word]] = []
+ self.pl_adj_user_defined: List[Optional[Word]] = []
+ self.si_sb_user_defined: List[Optional[Word]] = []
+ self.A_a_user_defined: List[Optional[Word]] = []
+ self.thegender = "neuter"
+ self.__number_args: Optional[Dict[str, str]] = None
+
+ @property
+ def _number_args(self):
+ return cast(Dict[str, str], self.__number_args)
+
+ @_number_args.setter
+ def _number_args(self, val):
+ self.__number_args = val
+
+ @typechecked
+ def defnoun(self, singular: Optional[Word], plural: Optional[Word]) -> int:
+ """
+ Set the noun plural of singular to plural.
+
+ """
+ self.checkpat(singular)
+ self.checkpatplural(plural)
+ self.pl_sb_user_defined.extend((singular, plural))
+ self.si_sb_user_defined.extend((plural, singular))
+ return 1
+
+ @typechecked
+ def defverb(
+ self,
+ s1: Optional[Word],
+ p1: Optional[Word],
+ s2: Optional[Word],
+ p2: Optional[Word],
+ s3: Optional[Word],
+ p3: Optional[Word],
+ ) -> int:
+ """
+ Set the verb plurals for s1, s2 and s3 to p1, p2 and p3 respectively.
+
+ Where 1, 2 and 3 represent the 1st, 2nd and 3rd person forms of the verb.
+
+ """
+ self.checkpat(s1)
+ self.checkpat(s2)
+ self.checkpat(s3)
+ self.checkpatplural(p1)
+ self.checkpatplural(p2)
+ self.checkpatplural(p3)
+ self.pl_v_user_defined.extend((s1, p1, s2, p2, s3, p3))
+ return 1
+
+ @typechecked
+ def defadj(self, singular: Optional[Word], plural: Optional[Word]) -> int:
+ """
+ Set the adjective plural of singular to plural.
+
+ """
+ self.checkpat(singular)
+ self.checkpatplural(plural)
+ self.pl_adj_user_defined.extend((singular, plural))
+ return 1
+
+ @typechecked
+ def defa(self, pattern: Optional[Word]) -> int:
+ """
+ Define the indefinite article as 'a' for words matching pattern.
+
+ """
+ self.checkpat(pattern)
+ self.A_a_user_defined.extend((pattern, "a"))
+ return 1
+
+ @typechecked
+ def defan(self, pattern: Optional[Word]) -> int:
+ """
+ Define the indefinite article as 'an' for words matching pattern.
+
+ """
+ self.checkpat(pattern)
+ self.A_a_user_defined.extend((pattern, "an"))
+ return 1
+
+ def checkpat(self, pattern: Optional[Word]) -> None:
+ """
+ check for errors in a regex pattern
+ """
+ if pattern is None:
+ return
+ try:
+ re.match(pattern, "")
+ except re.error as err:
+ raise BadUserDefinedPatternError(pattern) from err
+
+ def checkpatplural(self, pattern: Optional[Word]) -> None:
+ """
+ check for errors in a regex replace pattern
+ """
+ return
+
+ @typechecked
+ def ud_match(self, word: Word, wordlist: Sequence[Optional[Word]]) -> Optional[str]:
+ for i in range(len(wordlist) - 2, -2, -2): # backwards through even elements
+ mo = re.search(rf"^{wordlist[i]}$", word, re.IGNORECASE)
+ if mo:
+ if wordlist[i + 1] is None:
+ return None
+ pl = DOLLAR_DIGITS.sub(
+ r"\\1", cast(Word, wordlist[i + 1])
+ ) # change $n to \n for expand
+ return mo.expand(pl)
+ return None
+
+ def classical(self, **kwargs) -> None:
+ """
+ turn classical mode on and off for various categories
+
+ turn on all classical modes:
+ classical()
+ classical(all=True)
+
+ turn on or off specific claassical modes:
+ e.g.
+ classical(herd=True)
+ classical(names=False)
+
+ By default all classical modes are off except names.
+
+ unknown value in args or key in kwargs raises
+ exception: UnknownClasicalModeError
+
+ """
+ if not kwargs:
+ self.classical_dict = all_classical.copy()
+ return
+ if "all" in kwargs:
+ if kwargs["all"]:
+ self.classical_dict = all_classical.copy()
+ else:
+ self.classical_dict = no_classical.copy()
+
+ for k, v in kwargs.items():
+ if k in def_classical:
+ self.classical_dict[k] = v
+ else:
+ raise UnknownClassicalModeError
+
+ def num(
+ self, count: Optional[int] = None, show: Optional[int] = None
+ ) -> str: # (;$count,$show)
+ """
+ Set the number to be used in other method calls.
+
+ Returns count.
+
+ Set show to False to return '' instead.
+
+ """
+ if count is not None:
+ try:
+ self.persistent_count = int(count)
+ except ValueError as err:
+ raise BadNumValueError from err
+ if (show is None) or show:
+ return str(count)
+ else:
+ self.persistent_count = None
+ return ""
+
+ def gender(self, gender: str) -> None:
+ """
+ set the gender for the singular of plural pronouns
+
+ can be one of:
+ 'neuter' ('they' -> 'it')
+ 'feminine' ('they' -> 'she')
+ 'masculine' ('they' -> 'he')
+ 'gender-neutral' ('they' -> 'they')
+ 'feminine or masculine' ('they' -> 'she or he')
+ 'masculine or feminine' ('they' -> 'he or she')
+ """
+ if gender in singular_pronoun_genders:
+ self.thegender = gender
+ else:
+ raise BadGenderError
+
+ def _get_value_from_ast(self, obj):
+ """
+ Return the value of the ast object.
+ """
+ if isinstance(obj, ast.Num):
+ return obj.n
+ elif isinstance(obj, ast.Str):
+ return obj.s
+ elif isinstance(obj, ast.List):
+ return [self._get_value_from_ast(e) for e in obj.elts]
+ elif isinstance(obj, ast.Tuple):
+ return tuple([self._get_value_from_ast(e) for e in obj.elts])
+
+ # None, True and False are NameConstants in Py3.4 and above.
+ elif isinstance(obj, ast.NameConstant):
+ return obj.value
+
+ # Probably passed a variable name.
+ # Or passed a single word without wrapping it in quotes as an argument
+ # ex: p.inflect("I plural(see)") instead of p.inflect("I plural('see')")
+ raise NameError(f"name '{obj.id}' is not defined")
+
+ def _string_to_substitute(
+ self, mo: Match, methods_dict: Dict[str, Callable]
+ ) -> str:
+ """
+ Return the string to be substituted for the match.
+ """
+ matched_text, f_name = mo.groups()
+ # matched_text is the complete match string. e.g. plural_noun(cat)
+ # f_name is the function name. e.g. plural_noun
+
+ # Return matched_text if function name is not in methods_dict
+ if f_name not in methods_dict:
+ return matched_text
+
+ # Parse the matched text
+ a_tree = ast.parse(matched_text)
+
+ # get the args and kwargs from ast objects
+ args_list = [
+ self._get_value_from_ast(a)
+ for a in a_tree.body[0].value.args # type: ignore[attr-defined]
+ ]
+ kwargs_list = {
+ kw.arg: self._get_value_from_ast(kw.value)
+ for kw in a_tree.body[0].value.keywords # type: ignore[attr-defined]
+ }
+
+ # Call the corresponding function
+ return methods_dict[f_name](*args_list, **kwargs_list)
+
+ # 0. PERFORM GENERAL INFLECTIONS IN A STRING
+
+ @typechecked
+ def inflect(self, text: Word) -> str:
+ """
+ Perform inflections in a string.
+
+ e.g. inflect('The plural of cat is plural(cat)') returns
+ 'The plural of cat is cats'
+
+ can use plural, plural_noun, plural_verb, plural_adj,
+ singular_noun, a, an, no, ordinal, number_to_words,
+ and prespart
+
+ """
+ save_persistent_count = self.persistent_count
+
+ # Dictionary of allowed methods
+ methods_dict: Dict[str, Callable] = {
+ "plural": self.plural,
+ "plural_adj": self.plural_adj,
+ "plural_noun": self.plural_noun,
+ "plural_verb": self.plural_verb,
+ "singular_noun": self.singular_noun,
+ "a": self.a,
+ "an": self.a,
+ "no": self.no,
+ "ordinal": self.ordinal,
+ "number_to_words": self.number_to_words,
+ "present_participle": self.present_participle,
+ "num": self.num,
+ }
+
+ # Regular expression to find Python's function call syntax
+ output = FUNCTION_CALL.sub(
+ lambda mo: self._string_to_substitute(mo, methods_dict), text
+ )
+ self.persistent_count = save_persistent_count
+ return output
+
+ # ## PLURAL SUBROUTINES
+
+ def postprocess(self, orig: str, inflected) -> str:
+ inflected = str(inflected)
+ if "|" in inflected:
+ word_options = inflected.split("|")
+ # When two parts of a noun need to be pluralized
+ if len(word_options[0].split(" ")) == len(word_options[1].split(" ")):
+ result = inflected.split("|")[self.classical_dict["all"]].split(" ")
+ # When only the last part of the noun needs to be pluralized
+ else:
+ result = inflected.split(" ")
+ for index, word in enumerate(result):
+ if "|" in word:
+ result[index] = word.split("|")[self.classical_dict["all"]]
+ else:
+ result = inflected.split(" ")
+
+ # Try to fix word wise capitalization
+ for index, word in enumerate(orig.split(" ")):
+ if word == "I":
+ # Is this the only word for exceptions like this
+ # Where the original is fully capitalized
+ # without 'meaning' capitalization?
+ # Also this fails to handle a capitalizaion in context
+ continue
+ if word.capitalize() == word:
+ result[index] = result[index].capitalize()
+ if word == word.upper():
+ result[index] = result[index].upper()
+ return " ".join(result)
+
+ def partition_word(self, text: str) -> Tuple[str, str, str]:
+ mo = PARTITION_WORD.search(text)
+ if mo:
+ return mo.group(1), mo.group(2), mo.group(3)
+ else:
+ return "", "", ""
+
+ @typechecked
+ def plural(self, text: Word, count: Optional[Union[str, int, Any]] = None) -> str:
+ """
+ Return the plural of text.
+
+ If count supplied, then return text if count is one of:
+ 1, a, an, one, each, every, this, that
+
+ otherwise return the plural.
+
+ Whitespace at the start and end is preserved.
+
+ """
+ pre, word, post = self.partition_word(text)
+ if not word:
+ return text
+ plural = self.postprocess(
+ word,
+ self._pl_special_adjective(word, count)
+ or self._pl_special_verb(word, count)
+ or self._plnoun(word, count),
+ )
+ return f"{pre}{plural}{post}"
+
+ @typechecked
+ def plural_noun(
+ self, text: Word, count: Optional[Union[str, int, Any]] = None
+ ) -> str:
+ """
+ Return the plural of text, where text is a noun.
+
+ If count supplied, then return text if count is one of:
+ 1, a, an, one, each, every, this, that
+
+ otherwise return the plural.
+
+ Whitespace at the start and end is preserved.
+
+ """
+ pre, word, post = self.partition_word(text)
+ if not word:
+ return text
+ plural = self.postprocess(word, self._plnoun(word, count))
+ return f"{pre}{plural}{post}"
+
+ @typechecked
+ def plural_verb(
+ self, text: Word, count: Optional[Union[str, int, Any]] = None
+ ) -> str:
+ """
+ Return the plural of text, where text is a verb.
+
+ If count supplied, then return text if count is one of:
+ 1, a, an, one, each, every, this, that
+
+ otherwise return the plural.
+
+ Whitespace at the start and end is preserved.
+
+ """
+ pre, word, post = self.partition_word(text)
+ if not word:
+ return text
+ plural = self.postprocess(
+ word,
+ self._pl_special_verb(word, count) or self._pl_general_verb(word, count),
+ )
+ return f"{pre}{plural}{post}"
+
+ @typechecked
+ def plural_adj(
+ self, text: Word, count: Optional[Union[str, int, Any]] = None
+ ) -> str:
+ """
+ Return the plural of text, where text is an adjective.
+
+ If count supplied, then return text if count is one of:
+ 1, a, an, one, each, every, this, that
+
+ otherwise return the plural.
+
+ Whitespace at the start and end is preserved.
+
+ """
+ pre, word, post = self.partition_word(text)
+ if not word:
+ return text
+ plural = self.postprocess(word, self._pl_special_adjective(word, count) or word)
+ return f"{pre}{plural}{post}"
+
+ @typechecked
+ def compare(self, word1: Word, word2: Word) -> Union[str, bool]:
+ """
+ compare word1 and word2 for equality regardless of plurality
+
+ return values:
+ eq - the strings are equal
+ p:s - word1 is the plural of word2
+ s:p - word2 is the plural of word1
+ p:p - word1 and word2 are two different plural forms of the one word
+ False - otherwise
+
+ >>> compare = engine().compare
+ >>> compare("egg", "eggs")
+ 's:p'
+ >>> compare('egg', 'egg')
+ 'eq'
+
+ Words should not be empty.
+
+ >>> compare('egg', '')
+ Traceback (most recent call last):
+ ...
+ typeguard.TypeCheckError:...is not an instance of inflect.Word
+ """
+ norms = self.plural_noun, self.plural_verb, self.plural_adj
+ results = (self._plequal(word1, word2, norm) for norm in norms)
+ return next(filter(None, results), False)
+
+ @typechecked
+ def compare_nouns(self, word1: Word, word2: Word) -> Union[str, bool]:
+ """
+ compare word1 and word2 for equality regardless of plurality
+ word1 and word2 are to be treated as nouns
+
+ return values:
+ eq - the strings are equal
+ p:s - word1 is the plural of word2
+ s:p - word2 is the plural of word1
+ p:p - word1 and word2 are two different plural forms of the one word
+ False - otherwise
+
+ """
+ return self._plequal(word1, word2, self.plural_noun)
+
+ @typechecked
+ def compare_verbs(self, word1: Word, word2: Word) -> Union[str, bool]:
+ """
+ compare word1 and word2 for equality regardless of plurality
+ word1 and word2 are to be treated as verbs
+
+ return values:
+ eq - the strings are equal
+ p:s - word1 is the plural of word2
+ s:p - word2 is the plural of word1
+ p:p - word1 and word2 are two different plural forms of the one word
+ False - otherwise
+
+ """
+ return self._plequal(word1, word2, self.plural_verb)
+
+ @typechecked
+ def compare_adjs(self, word1: Word, word2: Word) -> Union[str, bool]:
+ """
+ compare word1 and word2 for equality regardless of plurality
+ word1 and word2 are to be treated as adjectives
+
+ return values:
+ eq - the strings are equal
+ p:s - word1 is the plural of word2
+ s:p - word2 is the plural of word1
+ p:p - word1 and word2 are two different plural forms of the one word
+ False - otherwise
+
+ """
+ return self._plequal(word1, word2, self.plural_adj)
+
+ @typechecked
+ def singular_noun(
+ self,
+ text: Word,
+ count: Optional[Union[int, str, Any]] = None,
+ gender: Optional[str] = None,
+ ) -> Union[str, Literal[False]]:
+ """
+ Return the singular of text, where text is a plural noun.
+
+ If count supplied, then return the singular if count is one of:
+ 1, a, an, one, each, every, this, that or if count is None
+
+ otherwise return text unchanged.
+
+ Whitespace at the start and end is preserved.
+
+ >>> p = engine()
+ >>> p.singular_noun('horses')
+ 'horse'
+ >>> p.singular_noun('knights')
+ 'knight'
+
+ Returns False when a singular noun is passed.
+
+ >>> p.singular_noun('horse')
+ False
+ >>> p.singular_noun('knight')
+ False
+ >>> p.singular_noun('soldier')
+ False
+
+ """
+ pre, word, post = self.partition_word(text)
+ if not word:
+ return text
+ sing = self._sinoun(word, count=count, gender=gender)
+ if sing is not False:
+ plural = self.postprocess(word, sing)
+ return f"{pre}{plural}{post}"
+ return False
+
+ def _plequal(self, word1: str, word2: str, pl) -> Union[str, bool]: # noqa: C901
+ classval = self.classical_dict.copy()
+ self.classical_dict = all_classical.copy()
+ if word1 == word2:
+ return "eq"
+ if word1 == pl(word2):
+ return "p:s"
+ if pl(word1) == word2:
+ return "s:p"
+ self.classical_dict = no_classical.copy()
+ if word1 == pl(word2):
+ return "p:s"
+ if pl(word1) == word2:
+ return "s:p"
+ self.classical_dict = classval.copy()
+
+ if pl == self.plural or pl == self.plural_noun:
+ if self._pl_check_plurals_N(word1, word2):
+ return "p:p"
+ if self._pl_check_plurals_N(word2, word1):
+ return "p:p"
+ if pl == self.plural or pl == self.plural_adj:
+ if self._pl_check_plurals_adj(word1, word2):
+ return "p:p"
+ return False
+
+ def _pl_reg_plurals(self, pair: str, stems: str, end1: str, end2: str) -> bool:
+ pattern = rf"({stems})({end1}\|\1{end2}|{end2}\|\1{end1})"
+ return bool(re.search(pattern, pair))
+
+ def _pl_check_plurals_N(self, word1: str, word2: str) -> bool:
+ stem_endings = (
+ (pl_sb_C_a_ata, "as", "ata"),
+ (pl_sb_C_is_ides, "is", "ides"),
+ (pl_sb_C_a_ae, "s", "e"),
+ (pl_sb_C_en_ina, "ens", "ina"),
+ (pl_sb_C_um_a, "ums", "a"),
+ (pl_sb_C_us_i, "uses", "i"),
+ (pl_sb_C_on_a, "ons", "a"),
+ (pl_sb_C_o_i_stems, "os", "i"),
+ (pl_sb_C_ex_ices, "exes", "ices"),
+ (pl_sb_C_ix_ices, "ixes", "ices"),
+ (pl_sb_C_i, "s", "i"),
+ (pl_sb_C_im, "s", "im"),
+ (".*eau", "s", "x"),
+ (".*ieu", "s", "x"),
+ (".*tri", "xes", "ces"),
+ (".{2,}[yia]n", "xes", "ges"),
+ )
+
+ words = map(Words, (word1, word2))
+ pair = "|".join(word.last for word in words)
+
+ return (
+ pair in pl_sb_irregular_s.values()
+ or pair in pl_sb_irregular.values()
+ or pair in pl_sb_irregular_caps.values()
+ or any(
+ self._pl_reg_plurals(pair, stems, end1, end2)
+ for stems, end1, end2 in stem_endings
+ )
+ )
+
+ def _pl_check_plurals_adj(self, word1: str, word2: str) -> bool:
+ word1a = word1[: word1.rfind("'")] if word1.endswith(("'s", "'")) else ""
+ word2a = word2[: word2.rfind("'")] if word2.endswith(("'s", "'")) else ""
+
+ return (
+ bool(word1a)
+ and bool(word2a)
+ and (
+ self._pl_check_plurals_N(word1a, word2a)
+ or self._pl_check_plurals_N(word2a, word1a)
+ )
+ )
+
+ def get_count(self, count: Optional[Union[str, int]] = None) -> Union[str, int]:
+ if count is None and self.persistent_count is not None:
+ count = self.persistent_count
+
+ if count is not None:
+ count = (
+ 1
+ if (
+ (str(count) in pl_count_one)
+ or (
+ self.classical_dict["zero"]
+ and str(count).lower() in pl_count_zero
+ )
+ )
+ else 2
+ )
+ else:
+ count = ""
+ return count
+
+ # @profile
+ def _plnoun( # noqa: C901
+ self, word: str, count: Optional[Union[str, int]] = None
+ ) -> str:
+ count = self.get_count(count)
+
+ # DEFAULT TO PLURAL
+
+ if count == 1:
+ return word
+
+ # HANDLE USER-DEFINED NOUNS
+
+ value = self.ud_match(word, self.pl_sb_user_defined)
+ if value is not None:
+ return value
+
+ # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
+
+ if word == "":
+ return word
+
+ word = Words(word)
+
+ if word.last.lower() in pl_sb_uninflected_complete:
+ if len(word.split_) >= 3:
+ return self._handle_long_compounds(word, count=2) or word
+ return word
+
+ if word in pl_sb_uninflected_caps:
+ return word
+
+ for k, v in pl_sb_uninflected_bysize.items():
+ if word.lowered[-k:] in v:
+ return word
+
+ if self.classical_dict["herd"] and word.last.lower() in pl_sb_uninflected_herd:
+ return word
+
+ # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
+
+ mo = PL_SB_POSTFIX_ADJ_STEMS_RE.search(word)
+ if mo and mo.group(2) != "":
+ return f"{self._plnoun(mo.group(1), 2)}{mo.group(2)}"
+
+ if " a " in word.lowered or "-a-" in word.lowered:
+ mo = PL_SB_PREP_DUAL_COMPOUND_RE.search(word)
+ if mo and mo.group(2) != "" and mo.group(3) != "":
+ return (
+ f"{self._plnoun(mo.group(1), 2)}"
+ f"{mo.group(2)}"
+ f"{self._plnoun(mo.group(3))}"
+ )
+
+ if len(word.split_) >= 3:
+ handled_words = self._handle_long_compounds(word, count=2)
+ if handled_words is not None:
+ return handled_words
+
+ # only pluralize denominators in units
+ mo = DENOMINATOR.search(word.lowered)
+ if mo:
+ index = len(mo.group("denominator"))
+ return f"{self._plnoun(word[:index])}{word[index:]}"
+
+ # handle units given in degrees (only accept if
+ # there is no more than one word following)
+ # degree Celsius => degrees Celsius but degree
+ # fahrenheit hour => degree fahrenheit hours
+ if len(word.split_) >= 2 and word.split_[-2] == "degree":
+ return " ".join([self._plnoun(word.first)] + word.split_[1:])
+
+ with contextlib.suppress(ValueError):
+ return self._handle_prepositional_phrase(
+ word.lowered,
+ functools.partial(self._plnoun, count=2),
+ '-',
+ )
+
+ # HANDLE PRONOUNS
+
+ for k, v in pl_pron_acc_keys_bysize.items():
+ if word.lowered[-k:] in v: # ends with accusative pronoun
+ for pk, pv in pl_prep_bysize.items():
+ if word.lowered[:pk] in pv: # starts with a prep
+ if word.lowered.split() == [
+ word.lowered[:pk],
+ word.lowered[-k:],
+ ]:
+ # only whitespace in between
+ return word.lowered[:-k] + pl_pron_acc[word.lowered[-k:]]
+
+ try:
+ return pl_pron_nom[word.lowered]
+ except KeyError:
+ pass
+
+ try:
+ return pl_pron_acc[word.lowered]
+ except KeyError:
+ pass
+
+ # HANDLE ISOLATED IRREGULAR PLURALS
+
+ if word.last in pl_sb_irregular_caps:
+ llen = len(word.last)
+ return f"{word[:-llen]}{pl_sb_irregular_caps[word.last]}"
+
+ lowered_last = word.last.lower()
+ if lowered_last in pl_sb_irregular:
+ llen = len(lowered_last)
+ return f"{word[:-llen]}{pl_sb_irregular[lowered_last]}"
+
+ dash_split = word.lowered.split('-')
+ if (" ".join(dash_split[-2:])).lower() in pl_sb_irregular_compound:
+ llen = len(
+ " ".join(dash_split[-2:])
+ ) # TODO: what if 2 spaces between these words?
+ return (
+ f"{word[:-llen]}"
+ f"{pl_sb_irregular_compound[(' '.join(dash_split[-2:])).lower()]}"
+ )
+
+ if word.lowered[-3:] == "quy":
+ return f"{word[:-1]}ies"
+
+ if word.lowered[-6:] == "person":
+ if self.classical_dict["persons"]:
+ return f"{word}s"
+ else:
+ return f"{word[:-4]}ople"
+
+ # HANDLE FAMILIES OF IRREGULAR PLURALS
+
+ if word.lowered[-3:] == "man":
+ for k, v in pl_sb_U_man_mans_bysize.items():
+ if word.lowered[-k:] in v:
+ return f"{word}s"
+ for k, v in pl_sb_U_man_mans_caps_bysize.items():
+ if word[-k:] in v:
+ return f"{word}s"
+ return f"{word[:-3]}men"
+ if word.lowered[-5:] == "mouse":
+ return f"{word[:-5]}mice"
+ if word.lowered[-5:] == "louse":
+ v = pl_sb_U_louse_lice_bysize.get(len(word))
+ if v and word.lowered in v:
+ return f"{word[:-5]}lice"
+ return f"{word}s"
+ if word.lowered[-5:] == "goose":
+ return f"{word[:-5]}geese"
+ if word.lowered[-5:] == "tooth":
+ return f"{word[:-5]}teeth"
+ if word.lowered[-4:] == "foot":
+ return f"{word[:-4]}feet"
+ if word.lowered[-4:] == "taco":
+ return f"{word[:-5]}tacos"
+
+ if word.lowered == "die":
+ return "dice"
+
+ # HANDLE UNASSIMILATED IMPORTS
+
+ if word.lowered[-4:] == "ceps":
+ return word
+ if word.lowered[-4:] == "zoon":
+ return f"{word[:-2]}a"
+ if word.lowered[-3:] in ("cis", "sis", "xis"):
+ return f"{word[:-2]}es"
+
+ for lastlet, d, numend, post in (
+ ("h", pl_sb_U_ch_chs_bysize, None, "s"),
+ ("x", pl_sb_U_ex_ices_bysize, -2, "ices"),
+ ("x", pl_sb_U_ix_ices_bysize, -2, "ices"),
+ ("m", pl_sb_U_um_a_bysize, -2, "a"),
+ ("s", pl_sb_U_us_i_bysize, -2, "i"),
+ ("n", pl_sb_U_on_a_bysize, -2, "a"),
+ ("a", pl_sb_U_a_ae_bysize, None, "e"),
+ ):
+ if word.lowered[-1] == lastlet: # this test to add speed
+ for k, v in d.items():
+ if word.lowered[-k:] in v:
+ return word[:numend] + post
+
+ # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
+
+ if self.classical_dict["ancient"]:
+ if word.lowered[-4:] == "trix":
+ return f"{word[:-1]}ces"
+ if word.lowered[-3:] in ("eau", "ieu"):
+ return f"{word}x"
+ if word.lowered[-3:] in ("ynx", "inx", "anx") and len(word) > 4:
+ return f"{word[:-1]}ges"
+
+ for lastlet, d, numend, post in (
+ ("n", pl_sb_C_en_ina_bysize, -2, "ina"),
+ ("x", pl_sb_C_ex_ices_bysize, -2, "ices"),
+ ("x", pl_sb_C_ix_ices_bysize, -2, "ices"),
+ ("m", pl_sb_C_um_a_bysize, -2, "a"),
+ ("s", pl_sb_C_us_i_bysize, -2, "i"),
+ ("s", pl_sb_C_us_us_bysize, None, ""),
+ ("a", pl_sb_C_a_ae_bysize, None, "e"),
+ ("a", pl_sb_C_a_ata_bysize, None, "ta"),
+ ("s", pl_sb_C_is_ides_bysize, -1, "des"),
+ ("o", pl_sb_C_o_i_bysize, -1, "i"),
+ ("n", pl_sb_C_on_a_bysize, -2, "a"),
+ ):
+ if word.lowered[-1] == lastlet: # this test to add speed
+ for k, v in d.items():
+ if word.lowered[-k:] in v:
+ return word[:numend] + post
+
+ for d, numend, post in (
+ (pl_sb_C_i_bysize, None, "i"),
+ (pl_sb_C_im_bysize, None, "im"),
+ ):
+ for k, v in d.items():
+ if word.lowered[-k:] in v:
+ return word[:numend] + post
+
+ # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
+
+ if lowered_last in pl_sb_singular_s_complete:
+ return f"{word}es"
+
+ for k, v in pl_sb_singular_s_bysize.items():
+ if word.lowered[-k:] in v:
+ return f"{word}es"
+
+ if word.lowered[-2:] == "es" and word[0] == word[0].upper():
+ return f"{word}es"
+
+ if word.lowered[-1] == "z":
+ for k, v in pl_sb_z_zes_bysize.items():
+ if word.lowered[-k:] in v:
+ return f"{word}es"
+
+ if word.lowered[-2:-1] != "z":
+ return f"{word}zes"
+
+ if word.lowered[-2:] == "ze":
+ for k, v in pl_sb_ze_zes_bysize.items():
+ if word.lowered[-k:] in v:
+ return f"{word}s"
+
+ if word.lowered[-2:] in ("ch", "sh", "zz", "ss") or word.lowered[-1] == "x":
+ return f"{word}es"
+
+ # HANDLE ...f -> ...ves
+
+ if word.lowered[-3:] in ("elf", "alf", "olf"):
+ return f"{word[:-1]}ves"
+ if word.lowered[-3:] == "eaf" and word.lowered[-4:-3] != "d":
+ return f"{word[:-1]}ves"
+ if word.lowered[-4:] in ("nife", "life", "wife"):
+ return f"{word[:-2]}ves"
+ if word.lowered[-3:] == "arf":
+ return f"{word[:-1]}ves"
+
+ # HANDLE ...y
+
+ if word.lowered[-1] == "y":
+ if word.lowered[-2:-1] in "aeiou" or len(word) == 1:
+ return f"{word}s"
+
+ if self.classical_dict["names"]:
+ if word.lowered[-1] == "y" and word[0] == word[0].upper():
+ return f"{word}s"
+
+ return f"{word[:-1]}ies"
+
+ # HANDLE ...o
+
+ if lowered_last in pl_sb_U_o_os_complete:
+ return f"{word}s"
+
+ for k, v in pl_sb_U_o_os_bysize.items():
+ if word.lowered[-k:] in v:
+ return f"{word}s"
+
+ if word.lowered[-2:] in ("ao", "eo", "io", "oo", "uo"):
+ return f"{word}s"
+
+ if word.lowered[-1] == "o":
+ return f"{word}es"
+
+ # OTHERWISE JUST ADD ...s
+
+ return f"{word}s"
+
+ @classmethod
+ def _handle_prepositional_phrase(cls, phrase, transform, sep):
+ """
+ Given a word or phrase possibly separated by sep, parse out
+ the prepositional phrase and apply the transform to the word
+ preceding the prepositional phrase.
+
+ Raise ValueError if the pivot is not found or if at least two
+ separators are not found.
+
+ >>> engine._handle_prepositional_phrase("man-of-war", str.upper, '-')
+ 'MAN-of-war'
+ >>> engine._handle_prepositional_phrase("man of war", str.upper, ' ')
+ 'MAN of war'
+ """
+ parts = phrase.split(sep)
+ if len(parts) < 3:
+ raise ValueError("Cannot handle words with fewer than two separators")
+
+ pivot = cls._find_pivot(parts, pl_prep_list_da)
+
+ transformed = transform(parts[pivot - 1]) or parts[pivot - 1]
+ return " ".join(
+ parts[: pivot - 1] + [sep.join([transformed, parts[pivot], ''])]
+ ) + " ".join(parts[(pivot + 1) :])
+
+ def _handle_long_compounds(self, word: Words, count: int) -> Union[str, None]:
+ """
+ Handles the plural and singular for compound `Words` that
+ have three or more words, based on the given count.
+
+ >>> engine()._handle_long_compounds(Words("pair of scissors"), 2)
+ 'pairs of scissors'
+ >>> engine()._handle_long_compounds(Words("men beyond hills"), 1)
+ 'man beyond hills'
+ """
+ inflection = self._sinoun if count == 1 else self._plnoun
+ solutions = ( # type: ignore
+ " ".join(
+ itertools.chain(
+ leader,
+ [inflection(cand, count), prep], # type: ignore
+ trailer,
+ )
+ )
+ for leader, (cand, prep), trailer in windowed_complete(word.split_, 2)
+ if prep in pl_prep_list_da # type: ignore
+ )
+ return next(solutions, None)
+
+ @staticmethod
+ def _find_pivot(words, candidates):
+ pivots = (
+ index for index in range(1, len(words) - 1) if words[index] in candidates
+ )
+ try:
+ return next(pivots)
+ except StopIteration:
+ raise ValueError("No pivot found") from None
+
+ def _pl_special_verb( # noqa: C901
+ self, word: str, count: Optional[Union[str, int]] = None
+ ) -> Union[str, bool]:
+ if self.classical_dict["zero"] and str(count).lower() in pl_count_zero:
+ return False
+ count = self.get_count(count)
+
+ if count == 1:
+ return word
+
+ # HANDLE USER-DEFINED VERBS
+
+ value = self.ud_match(word, self.pl_v_user_defined)
+ if value is not None:
+ return value
+
+ # HANDLE IRREGULAR PRESENT TENSE (SIMPLE AND COMPOUND)
+
+ try:
+ words = Words(word)
+ except IndexError:
+ return False # word is ''
+
+ if words.first in plverb_irregular_pres:
+ return f"{plverb_irregular_pres[words.first]}{words[len(words.first) :]}"
+
+ # HANDLE IRREGULAR FUTURE, PRETERITE AND PERFECT TENSES
+
+ if words.first in plverb_irregular_non_pres:
+ return word
+
+ # HANDLE PRESENT NEGATIONS (SIMPLE AND COMPOUND)
+
+ if words.first.endswith("n't") and words.first[:-3] in plverb_irregular_pres:
+ return (
+ f"{plverb_irregular_pres[words.first[:-3]]}n't"
+ f"{words[len(words.first) :]}"
+ )
+
+ if words.first.endswith("n't"):
+ return word
+
+ # HANDLE SPECIAL CASES
+
+ mo = PLVERB_SPECIAL_S_RE.search(word)
+ if mo:
+ return False
+ if WHITESPACE.search(word):
+ return False
+
+ if words.lowered == "quizzes":
+ return "quiz"
+
+ # HANDLE STANDARD 3RD PERSON (CHOP THE ...(e)s OFF SINGLE WORDS)
+
+ if (
+ words.lowered[-4:] in ("ches", "shes", "zzes", "sses")
+ or words.lowered[-3:] == "xes"
+ ):
+ return words[:-2]
+
+ if words.lowered[-3:] == "ies" and len(words) > 3:
+ return words.lowered[:-3] + "y"
+
+ if (
+ words.last.lower() in pl_v_oes_oe
+ or words.lowered[-4:] in pl_v_oes_oe_endings_size4
+ or words.lowered[-5:] in pl_v_oes_oe_endings_size5
+ ):
+ return words[:-1]
+
+ if words.lowered.endswith("oes") and len(words) > 3:
+ return words.lowered[:-2]
+
+ mo = ENDS_WITH_S.search(words)
+ if mo:
+ return mo.group(1)
+
+ # OTHERWISE, A REGULAR VERB (HANDLE ELSEWHERE)
+
+ return False
+
+ def _pl_general_verb(
+ self, word: str, count: Optional[Union[str, int]] = None
+ ) -> str:
+ count = self.get_count(count)
+
+ if count == 1:
+ return word
+
+ # HANDLE AMBIGUOUS PRESENT TENSES (SIMPLE AND COMPOUND)
+
+ mo = plverb_ambiguous_pres_keys.search(word)
+ if mo:
+ return f"{plverb_ambiguous_pres[mo.group(1).lower()]}{mo.group(2)}"
+
+ # HANDLE AMBIGUOUS PRETERITE AND PERFECT TENSES
+
+ mo = plverb_ambiguous_non_pres.search(word)
+ if mo:
+ return word
+
+ # OTHERWISE, 1st OR 2ND PERSON IS UNINFLECTED
+
+ return word
+
+ def _pl_special_adjective(
+ self, word: str, count: Optional[Union[str, int]] = None
+ ) -> Union[str, bool]:
+ count = self.get_count(count)
+
+ if count == 1:
+ return word
+
+ # HANDLE USER-DEFINED ADJECTIVES
+
+ value = self.ud_match(word, self.pl_adj_user_defined)
+ if value is not None:
+ return value
+
+ # HANDLE KNOWN CASES
+
+ mo = pl_adj_special_keys.search(word)
+ if mo:
+ return pl_adj_special[mo.group(1).lower()]
+
+ # HANDLE POSSESSIVES
+
+ mo = pl_adj_poss_keys.search(word)
+ if mo:
+ return pl_adj_poss[mo.group(1).lower()]
+
+ mo = ENDS_WITH_APOSTROPHE_S.search(word)
+ if mo:
+ pl = self.plural_noun(mo.group(1))
+ trailing_s = "" if pl[-1] == "s" else "s"
+ return f"{pl}'{trailing_s}"
+
+ # OTHERWISE, NO IDEA
+
+ return False
+
+ # @profile
+ def _sinoun( # noqa: C901
+ self,
+ word: str,
+ count: Optional[Union[str, int]] = None,
+ gender: Optional[str] = None,
+ ) -> Union[str, bool]:
+ count = self.get_count(count)
+
+ # DEFAULT TO PLURAL
+
+ if count == 2:
+ return word
+
+ # SET THE GENDER
+
+ try:
+ if gender is None:
+ gender = self.thegender
+ elif gender not in singular_pronoun_genders:
+ raise BadGenderError
+ except (TypeError, IndexError) as err:
+ raise BadGenderError from err
+
+ # HANDLE USER-DEFINED NOUNS
+
+ value = self.ud_match(word, self.si_sb_user_defined)
+ if value is not None:
+ return value
+
+ # HANDLE EMPTY WORD, SINGULAR COUNT AND UNINFLECTED PLURALS
+
+ if word == "":
+ return word
+
+ if word in si_sb_ois_oi_case:
+ return word[:-1]
+
+ words = Words(word)
+
+ if words.last.lower() in pl_sb_uninflected_complete:
+ if len(words.split_) >= 3:
+ return self._handle_long_compounds(words, count=1) or word
+ return word
+
+ if word in pl_sb_uninflected_caps:
+ return word
+
+ for k, v in pl_sb_uninflected_bysize.items():
+ if words.lowered[-k:] in v:
+ return word
+
+ if self.classical_dict["herd"] and words.last.lower() in pl_sb_uninflected_herd:
+ return word
+
+ if words.last.lower() in pl_sb_C_us_us:
+ return word if self.classical_dict["ancient"] else False
+
+ # HANDLE COMPOUNDS ("Governor General", "mother-in-law", "aide-de-camp", ETC.)
+
+ mo = PL_SB_POSTFIX_ADJ_STEMS_RE.search(word)
+ if mo and mo.group(2) != "":
+ return f"{self._sinoun(mo.group(1), 1, gender=gender)}{mo.group(2)}"
+
+ with contextlib.suppress(ValueError):
+ return self._handle_prepositional_phrase(
+ words.lowered,
+ functools.partial(self._sinoun, count=1, gender=gender),
+ ' ',
+ )
+
+ with contextlib.suppress(ValueError):
+ return self._handle_prepositional_phrase(
+ words.lowered,
+ functools.partial(self._sinoun, count=1, gender=gender),
+ '-',
+ )
+
+ # HANDLE PRONOUNS
+
+ for k, v in si_pron_acc_keys_bysize.items():
+ if words.lowered[-k:] in v: # ends with accusative pronoun
+ for pk, pv in pl_prep_bysize.items():
+ if words.lowered[:pk] in pv: # starts with a prep
+ if words.lowered.split() == [
+ words.lowered[:pk],
+ words.lowered[-k:],
+ ]:
+ # only whitespace in between
+ return words.lowered[:-k] + get_si_pron(
+ "acc", words.lowered[-k:], gender
+ )
+
+ try:
+ return get_si_pron("nom", words.lowered, gender)
+ except KeyError:
+ pass
+
+ try:
+ return get_si_pron("acc", words.lowered, gender)
+ except KeyError:
+ pass
+
+ # HANDLE ISOLATED IRREGULAR PLURALS
+
+ if words.last in si_sb_irregular_caps:
+ llen = len(words.last)
+ return f"{word[:-llen]}{si_sb_irregular_caps[words.last]}"
+
+ if words.last.lower() in si_sb_irregular:
+ llen = len(words.last.lower())
+ return f"{word[:-llen]}{si_sb_irregular[words.last.lower()]}"
+
+ dash_split = words.lowered.split("-")
+ if (" ".join(dash_split[-2:])).lower() in si_sb_irregular_compound:
+ llen = len(
+ " ".join(dash_split[-2:])
+ ) # TODO: what if 2 spaces between these words?
+ return "{}{}".format(
+ word[:-llen],
+ si_sb_irregular_compound[(" ".join(dash_split[-2:])).lower()],
+ )
+
+ if words.lowered[-5:] == "quies":
+ return word[:-3] + "y"
+
+ if words.lowered[-7:] == "persons":
+ return word[:-1]
+ if words.lowered[-6:] == "people":
+ return word[:-4] + "rson"
+
+ # HANDLE FAMILIES OF IRREGULAR PLURALS
+
+ if words.lowered[-4:] == "mans":
+ for k, v in si_sb_U_man_mans_bysize.items():
+ if words.lowered[-k:] in v:
+ return word[:-1]
+ for k, v in si_sb_U_man_mans_caps_bysize.items():
+ if word[-k:] in v:
+ return word[:-1]
+ if words.lowered[-3:] == "men":
+ return word[:-3] + "man"
+ if words.lowered[-4:] == "mice":
+ return word[:-4] + "mouse"
+ if words.lowered[-4:] == "lice":
+ v = si_sb_U_louse_lice_bysize.get(len(word))
+ if v and words.lowered in v:
+ return word[:-4] + "louse"
+ if words.lowered[-5:] == "geese":
+ return word[:-5] + "goose"
+ if words.lowered[-5:] == "teeth":
+ return word[:-5] + "tooth"
+ if words.lowered[-4:] == "feet":
+ return word[:-4] + "foot"
+
+ if words.lowered == "dice":
+ return "die"
+
+ # HANDLE UNASSIMILATED IMPORTS
+
+ if words.lowered[-4:] == "ceps":
+ return word
+ if words.lowered[-3:] == "zoa":
+ return word[:-1] + "on"
+
+ for lastlet, d, unass_numend, post in (
+ ("s", si_sb_U_ch_chs_bysize, -1, ""),
+ ("s", si_sb_U_ex_ices_bysize, -4, "ex"),
+ ("s", si_sb_U_ix_ices_bysize, -4, "ix"),
+ ("a", si_sb_U_um_a_bysize, -1, "um"),
+ ("i", si_sb_U_us_i_bysize, -1, "us"),
+ ("a", si_sb_U_on_a_bysize, -1, "on"),
+ ("e", si_sb_U_a_ae_bysize, -1, ""),
+ ):
+ if words.lowered[-1] == lastlet: # this test to add speed
+ for k, v in d.items():
+ if words.lowered[-k:] in v:
+ return word[:unass_numend] + post
+
+ # HANDLE INCOMPLETELY ASSIMILATED IMPORTS
+
+ if self.classical_dict["ancient"]:
+ if words.lowered[-6:] == "trices":
+ return word[:-3] + "x"
+ if words.lowered[-4:] in ("eaux", "ieux"):
+ return word[:-1]
+ if words.lowered[-5:] in ("ynges", "inges", "anges") and len(word) > 6:
+ return word[:-3] + "x"
+
+ for lastlet, d, class_numend, post in (
+ ("a", si_sb_C_en_ina_bysize, -3, "en"),
+ ("s", si_sb_C_ex_ices_bysize, -4, "ex"),
+ ("s", si_sb_C_ix_ices_bysize, -4, "ix"),
+ ("a", si_sb_C_um_a_bysize, -1, "um"),
+ ("i", si_sb_C_us_i_bysize, -1, "us"),
+ ("s", pl_sb_C_us_us_bysize, None, ""),
+ ("e", si_sb_C_a_ae_bysize, -1, ""),
+ ("a", si_sb_C_a_ata_bysize, -2, ""),
+ ("s", si_sb_C_is_ides_bysize, -3, "s"),
+ ("i", si_sb_C_o_i_bysize, -1, "o"),
+ ("a", si_sb_C_on_a_bysize, -1, "on"),
+ ("m", si_sb_C_im_bysize, -2, ""),
+ ("i", si_sb_C_i_bysize, -1, ""),
+ ):
+ if words.lowered[-1] == lastlet: # this test to add speed
+ for k, v in d.items():
+ if words.lowered[-k:] in v:
+ return word[:class_numend] + post
+
+ # HANDLE PLURLS ENDING IN uses -> use
+
+ if (
+ words.lowered[-6:] == "houses"
+ or word in si_sb_uses_use_case
+ or words.last.lower() in si_sb_uses_use
+ ):
+ return word[:-1]
+
+ # HANDLE PLURLS ENDING IN ies -> ie
+
+ if word in si_sb_ies_ie_case or words.last.lower() in si_sb_ies_ie:
+ return word[:-1]
+
+ # HANDLE PLURLS ENDING IN oes -> oe
+
+ if (
+ words.lowered[-5:] == "shoes"
+ or word in si_sb_oes_oe_case
+ or words.last.lower() in si_sb_oes_oe
+ ):
+ return word[:-1]
+
+ # HANDLE SINGULAR NOUNS ENDING IN ...s OR OTHER SILIBANTS
+
+ if word in si_sb_sses_sse_case or words.last.lower() in si_sb_sses_sse:
+ return word[:-1]
+
+ if words.last.lower() in si_sb_singular_s_complete:
+ return word[:-2]
+
+ for k, v in si_sb_singular_s_bysize.items():
+ if words.lowered[-k:] in v:
+ return word[:-2]
+
+ if words.lowered[-4:] == "eses" and word[0] == word[0].upper():
+ return word[:-2]
+
+ if words.last.lower() in si_sb_z_zes:
+ return word[:-2]
+
+ if words.last.lower() in si_sb_zzes_zz:
+ return word[:-2]
+
+ if words.lowered[-4:] == "zzes":
+ return word[:-3]
+
+ if word in si_sb_ches_che_case or words.last.lower() in si_sb_ches_che:
+ return word[:-1]
+
+ if words.lowered[-4:] in ("ches", "shes"):
+ return word[:-2]
+
+ if words.last.lower() in si_sb_xes_xe:
+ return word[:-1]
+
+ if words.lowered[-3:] == "xes":
+ return word[:-2]
+
+ # HANDLE ...f -> ...ves
+
+ if word in si_sb_ves_ve_case or words.last.lower() in si_sb_ves_ve:
+ return word[:-1]
+
+ if words.lowered[-3:] == "ves":
+ if words.lowered[-5:-3] in ("el", "al", "ol"):
+ return word[:-3] + "f"
+ if words.lowered[-5:-3] == "ea" and word[-6:-5] != "d":
+ return word[:-3] + "f"
+ if words.lowered[-5:-3] in ("ni", "li", "wi"):
+ return word[:-3] + "fe"
+ if words.lowered[-5:-3] == "ar":
+ return word[:-3] + "f"
+
+ # HANDLE ...y
+
+ if words.lowered[-2:] == "ys":
+ if len(words.lowered) > 2 and words.lowered[-3] in "aeiou":
+ return word[:-1]
+
+ if self.classical_dict["names"]:
+ if words.lowered[-2:] == "ys" and word[0] == word[0].upper():
+ return word[:-1]
+
+ if words.lowered[-3:] == "ies":
+ return word[:-3] + "y"
+
+ # HANDLE ...o
+
+ if words.lowered[-2:] == "os":
+ if words.last.lower() in si_sb_U_o_os_complete:
+ return word[:-1]
+
+ for k, v in si_sb_U_o_os_bysize.items():
+ if words.lowered[-k:] in v:
+ return word[:-1]
+
+ if words.lowered[-3:] in ("aos", "eos", "ios", "oos", "uos"):
+ return word[:-1]
+
+ if words.lowered[-3:] == "oes":
+ return word[:-2]
+
+ # UNASSIMILATED IMPORTS FINAL RULE
+
+ if word in si_sb_es_is:
+ return word[:-2] + "is"
+
+ # OTHERWISE JUST REMOVE ...s
+
+ if words.lowered[-1] == "s":
+ return word[:-1]
+
+ # COULD NOT FIND SINGULAR
+
+ return False
+
+ # ADJECTIVES
+
+ @typechecked
+ def a(self, text: Word, count: Optional[Union[int, str, Any]] = 1) -> str:
+ """
+ Return the appropriate indefinite article followed by text.
+
+ The indefinite article is either 'a' or 'an'.
+
+ If count is not one, then return count followed by text
+ instead of 'a' or 'an'.
+
+ Whitespace at the start and end is preserved.
+
+ """
+ mo = INDEFINITE_ARTICLE_TEST.search(text)
+ if mo:
+ word = mo.group(2)
+ if not word:
+ return text
+ pre = mo.group(1)
+ post = mo.group(3)
+ result = self._indef_article(word, count)
+ return f"{pre}{result}{post}"
+ return ""
+
+ an = a
+
+ _indef_article_cases = (
+ # HANDLE ORDINAL FORMS
+ (A_ordinal_a, "a"),
+ (A_ordinal_an, "an"),
+ # HANDLE SPECIAL CASES
+ (A_explicit_an, "an"),
+ (SPECIAL_AN, "an"),
+ (SPECIAL_A, "a"),
+ # HANDLE ABBREVIATIONS
+ (A_abbrev, "an"),
+ (SPECIAL_ABBREV_AN, "an"),
+ (SPECIAL_ABBREV_A, "a"),
+ # HANDLE CONSONANTS
+ (CONSONANTS, "a"),
+ # HANDLE SPECIAL VOWEL-FORMS
+ (ARTICLE_SPECIAL_EU, "a"),
+ (ARTICLE_SPECIAL_ONCE, "a"),
+ (ARTICLE_SPECIAL_ONETIME, "a"),
+ (ARTICLE_SPECIAL_UNIT, "a"),
+ (ARTICLE_SPECIAL_UBA, "a"),
+ (ARTICLE_SPECIAL_UKR, "a"),
+ (A_explicit_a, "a"),
+ # HANDLE SPECIAL CAPITALS
+ (SPECIAL_CAPITALS, "a"),
+ # HANDLE VOWELS
+ (VOWELS, "an"),
+ # HANDLE y...
+ # (BEFORE CERTAIN CONSONANTS IMPLIES (UNNATURALIZED) "i.." SOUND)
+ (A_y_cons, "an"),
+ )
+
+ def _indef_article(self, word: str, count: Union[int, str, Any]) -> str:
+ mycount = self.get_count(count)
+
+ if mycount != 1:
+ return f"{count} {word}"
+
+ # HANDLE USER-DEFINED VARIANTS
+
+ value = self.ud_match(word, self.A_a_user_defined)
+ if value is not None:
+ return f"{value} {word}"
+
+ matches = (
+ f'{article} {word}'
+ for regexen, article in self._indef_article_cases
+ if regexen.search(word)
+ )
+
+ # OTHERWISE, GUESS "a"
+ fallback = f'a {word}'
+ return next(matches, fallback)
+
+ # 2. TRANSLATE ZERO-QUANTIFIED $word TO "no plural($word)"
+
+ @typechecked
+ def no(self, text: Word, count: Optional[Union[int, str]] = None) -> str:
+ """
+ If count is 0, no, zero or nil, return 'no' followed by the plural
+ of text.
+
+ If count is one of:
+ 1, a, an, one, each, every, this, that
+ return count followed by text.
+
+ Otherwise return count follow by the plural of text.
+
+ In the return value count is always followed by a space.
+
+ Whitespace at the start and end is preserved.
+
+ """
+ if count is None and self.persistent_count is not None:
+ count = self.persistent_count
+
+ if count is None:
+ count = 0
+ mo = PARTITION_WORD.search(text)
+ if mo:
+ pre = mo.group(1)
+ word = mo.group(2)
+ post = mo.group(3)
+ else:
+ pre = ""
+ word = ""
+ post = ""
+
+ if str(count).lower() in pl_count_zero:
+ count = 'no'
+ return f"{pre}{count} {self.plural(word, count)}{post}"
+
+ # PARTICIPLES
+
+ @typechecked
+ def present_participle(self, word: Word) -> str:
+ """
+ Return the present participle for word.
+
+ word is the 3rd person singular verb.
+
+ """
+ plv = self.plural_verb(word, 2)
+ ans = plv
+
+ for regexen, repl in PRESENT_PARTICIPLE_REPLACEMENTS:
+ ans, num = regexen.subn(repl, plv)
+ if num:
+ return f"{ans}ing"
+ return f"{ans}ing"
+
+ # NUMERICAL INFLECTIONS
+
+ @typechecked
+ def ordinal(self, num: Union[Number, Word]) -> str:
+ """
+ Return the ordinal of num.
+
+ >>> ordinal = engine().ordinal
+ >>> ordinal(1)
+ '1st'
+ >>> ordinal('one')
+ 'first'
+ """
+ if DIGIT.match(str(num)):
+ if isinstance(num, (float, int)) and int(num) == num:
+ n = int(num)
+ else:
+ if "." in str(num):
+ try:
+ # numbers after decimal,
+ # so only need last one for ordinal
+ n = int(str(num)[-1])
+
+ except ValueError: # ends with '.', so need to use whole string
+ n = int(str(num)[:-1])
+ else:
+ n = int(num) # type: ignore
+ try:
+ post = nth[n % 100]
+ except KeyError:
+ post = nth[n % 10]
+ return f"{num}{post}"
+ else:
+ return self._sub_ord(num)
+
+ def millfn(self, ind: int = 0) -> str:
+ if ind > len(mill) - 1:
+ raise NumOutOfRangeError
+ return mill[ind]
+
+ def unitfn(self, units: int, mindex: int = 0) -> str:
+ return f"{unit[units]}{self.millfn(mindex)}"
+
+ def tenfn(self, tens, units, mindex=0) -> str:
+ if tens != 1:
+ tens_part = ten[tens]
+ if tens and units:
+ hyphen = "-"
+ else:
+ hyphen = ""
+ unit_part = unit[units]
+ mill_part = self.millfn(mindex)
+ return f"{tens_part}{hyphen}{unit_part}{mill_part}"
+ return f"{teen[units]}{mill[mindex]}"
+
+ def hundfn(self, hundreds: int, tens: int, units: int, mindex: int) -> str:
+ if hundreds:
+ andword = f" {self._number_args['andword']} " if tens or units else ""
+ # use unit not unitfn as simpler
+ return (
+ f"{unit[hundreds]} hundred{andword}"
+ f"{self.tenfn(tens, units)}{self.millfn(mindex)}, "
+ )
+ if tens or units:
+ return f"{self.tenfn(tens, units)}{self.millfn(mindex)}, "
+ return ""
+
+ def group1sub(self, mo: Match) -> str:
+ units = int(mo.group(1))
+ if units == 1:
+ return f" {self._number_args['one']}, "
+ elif units:
+ return f"{unit[units]}, "
+ else:
+ return f" {self._number_args['zero']}, "
+
+ def group1bsub(self, mo: Match) -> str:
+ units = int(mo.group(1))
+ if units:
+ return f"{unit[units]}, "
+ else:
+ return f" {self._number_args['zero']}, "
+
+ def group2sub(self, mo: Match) -> str:
+ tens = int(mo.group(1))
+ units = int(mo.group(2))
+ if tens:
+ return f"{self.tenfn(tens, units)}, "
+ if units:
+ return f" {self._number_args['zero']} {unit[units]}, "
+ return f" {self._number_args['zero']} {self._number_args['zero']}, "
+
+ def group3sub(self, mo: Match) -> str:
+ hundreds = int(mo.group(1))
+ tens = int(mo.group(2))
+ units = int(mo.group(3))
+ if hundreds == 1:
+ hunword = f" {self._number_args['one']}"
+ elif hundreds:
+ hunword = str(unit[hundreds])
+ else:
+ hunword = f" {self._number_args['zero']}"
+ if tens:
+ tenword = self.tenfn(tens, units)
+ elif units:
+ tenword = f" {self._number_args['zero']} {unit[units]}"
+ else:
+ tenword = f" {self._number_args['zero']} {self._number_args['zero']}"
+ return f"{hunword} {tenword}, "
+
+ def hundsub(self, mo: Match) -> str:
+ ret = self.hundfn(
+ int(mo.group(1)), int(mo.group(2)), int(mo.group(3)), self.mill_count
+ )
+ self.mill_count += 1
+ return ret
+
+ def tensub(self, mo: Match) -> str:
+ return f"{self.tenfn(int(mo.group(1)), int(mo.group(2)), self.mill_count)}, "
+
+ def unitsub(self, mo: Match) -> str:
+ return f"{self.unitfn(int(mo.group(1)), self.mill_count)}, "
+
+ def enword(self, num: str, group: int) -> str:
+ # import pdb
+ # pdb.set_trace()
+
+ if group == 1:
+ num = DIGIT_GROUP.sub(self.group1sub, num)
+ elif group == 2:
+ num = TWO_DIGITS.sub(self.group2sub, num)
+ num = DIGIT_GROUP.sub(self.group1bsub, num, 1)
+ elif group == 3:
+ num = THREE_DIGITS.sub(self.group3sub, num)
+ num = TWO_DIGITS.sub(self.group2sub, num, 1)
+ num = DIGIT_GROUP.sub(self.group1sub, num, 1)
+ elif int(num) == 0:
+ num = self._number_args["zero"]
+ elif int(num) == 1:
+ num = self._number_args["one"]
+ else:
+ num = num.lstrip().lstrip("0")
+ self.mill_count = 0
+ # surely there's a better way to do the next bit
+ mo = THREE_DIGITS_WORD.search(num)
+ while mo:
+ num = THREE_DIGITS_WORD.sub(self.hundsub, num, 1)
+ mo = THREE_DIGITS_WORD.search(num)
+ num = TWO_DIGITS_WORD.sub(self.tensub, num, 1)
+ num = ONE_DIGIT_WORD.sub(self.unitsub, num, 1)
+ return num
+
+ @staticmethod
+ def _sub_ord(val):
+ new = ordinal_suff.sub(lambda match: ordinal[match.group(1)], val)
+ return new + "th" * (new == val)
+
+ @classmethod
+ def _chunk_num(cls, num, decimal, group):
+ if decimal:
+ max_split = -1 if group != 0 else 1
+ chunks = num.split(".", max_split)
+ else:
+ chunks = [num]
+ return cls._remove_last_blank(chunks)
+
+ @staticmethod
+ def _remove_last_blank(chunks):
+ """
+ Remove the last item from chunks if it's a blank string.
+
+ Return the resultant chunks and whether the last item was removed.
+ """
+ removed = chunks[-1] == ""
+ result = chunks[:-1] if removed else chunks
+ return result, removed
+
+ @staticmethod
+ def _get_sign(num):
+ return {'+': 'plus', '-': 'minus'}.get(num.lstrip()[0], '')
+
+ @typechecked
+ def number_to_words( # noqa: C901
+ self,
+ num: Union[Number, Word],
+ wantlist: bool = False,
+ group: int = 0,
+ comma: Union[Falsish, str] = ",",
+ andword: str = "and",
+ zero: str = "zero",
+ one: str = "one",
+ decimal: Union[Falsish, str] = "point",
+ threshold: Optional[int] = None,
+ ) -> Union[str, List[str]]:
+ """
+ Return a number in words.
+
+ group = 1, 2 or 3 to group numbers before turning into words
+ comma: define comma
+
+ andword:
+ word for 'and'. Can be set to ''.
+ e.g. "one hundred and one" vs "one hundred one"
+
+ zero: word for '0'
+ one: word for '1'
+ decimal: word for decimal point
+ threshold: numbers above threshold not turned into words
+
+ parameters not remembered from last call. Departure from Perl version.
+ """
+ self._number_args = {"andword": andword, "zero": zero, "one": one}
+ num = str(num)
+
+ # Handle "stylistic" conversions (up to a given threshold)...
+ if threshold is not None and float(num) > threshold:
+ spnum = num.split(".", 1)
+ while comma:
+ (spnum[0], n) = FOUR_DIGIT_COMMA.subn(r"\1,\2", spnum[0])
+ if n == 0:
+ break
+ try:
+ return f"{spnum[0]}.{spnum[1]}"
+ except IndexError:
+ return str(spnum[0])
+
+ if group < 0 or group > 3:
+ raise BadChunkingOptionError
+
+ sign = self._get_sign(num)
+
+ if num in nth_suff:
+ num = zero
+
+ myord = num[-2:] in nth_suff
+ if myord:
+ num = num[:-2]
+
+ chunks, finalpoint = self._chunk_num(num, decimal, group)
+
+ loopstart = chunks[0] == ""
+ first: bool | None = not loopstart
+
+ def _handle_chunk(chunk):
+ nonlocal first
+
+ # remove all non numeric \D
+ chunk = NON_DIGIT.sub("", chunk)
+ if chunk == "":
+ chunk = "0"
+
+ if group == 0 and not first:
+ chunk = self.enword(chunk, 1)
+ else:
+ chunk = self.enword(chunk, group)
+
+ if chunk[-2:] == ", ":
+ chunk = chunk[:-2]
+ chunk = WHITESPACES_COMMA.sub(",", chunk)
+
+ if group == 0 and first:
+ chunk = COMMA_WORD.sub(f" {andword} \\1", chunk)
+ chunk = WHITESPACES.sub(" ", chunk)
+ # chunk = re.sub(r"(\A\s|\s\Z)", self.blankfn, chunk)
+ chunk = chunk.strip()
+ if first:
+ first = None
+ return chunk
+
+ chunks[loopstart:] = map(_handle_chunk, chunks[loopstart:])
+
+ numchunks = []
+ if first != 0:
+ numchunks = chunks[0].split(f"{comma} ")
+
+ if myord and numchunks:
+ numchunks[-1] = self._sub_ord(numchunks[-1])
+
+ for chunk in chunks[1:]:
+ numchunks.append(decimal)
+ numchunks.extend(chunk.split(f"{comma} "))
+
+ if finalpoint:
+ numchunks.append(decimal)
+
+ if wantlist:
+ return [sign] * bool(sign) + numchunks
+
+ signout = f"{sign} " if sign else ""
+ valout = (
+ ', '.join(numchunks)
+ if group
+ else ''.join(self._render(numchunks, decimal, comma))
+ )
+ return signout + valout
+
+ @staticmethod
+ def _render(chunks, decimal, comma):
+ first_item = chunks.pop(0)
+ yield first_item
+ first = decimal is None or not first_item.endswith(decimal)
+ for nc in chunks:
+ if nc == decimal:
+ first = False
+ elif first:
+ yield comma
+ yield f" {nc}"
+
+ @typechecked
+ def join(
+ self,
+ words: Optional[Sequence[Word]],
+ sep: Optional[str] = None,
+ sep_spaced: bool = True,
+ final_sep: Optional[str] = None,
+ conj: str = "and",
+ conj_spaced: bool = True,
+ ) -> str:
+ """
+ Join words into a list.
+
+ e.g. join(['ant', 'bee', 'fly']) returns 'ant, bee, and fly'
+
+ options:
+ conj: replacement for 'and'
+ sep: separator. default ',', unless ',' is in the list then ';'
+ final_sep: final separator. default ',', unless ',' is in the list then ';'
+ conj_spaced: boolean. Should conj have spaces around it
+
+ """
+ if not words:
+ return ""
+ if len(words) == 1:
+ return words[0]
+
+ if conj_spaced:
+ if conj == "":
+ conj = " "
+ else:
+ conj = f" {conj} "
+
+ if len(words) == 2:
+ return f"{words[0]}{conj}{words[1]}"
+
+ if sep is None:
+ if "," in "".join(words):
+ sep = ";"
+ else:
+ sep = ","
+ if final_sep is None:
+ final_sep = sep
+
+ final_sep = f"{final_sep}{conj}"
+
+ if sep_spaced:
+ sep += " "
+
+ return f"{sep.join(words[0:-1])}{final_sep}{words[-1]}"
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/py38.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/py38.py
new file mode 100644
index 0000000000000000000000000000000000000000..a2d01bd98f4ae3d9236d0e6ec3b89faa9ca706ae
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/compat/py38.py
@@ -0,0 +1,7 @@
+import sys
+
+
+if sys.version_info > (3, 9):
+ from typing import Annotated
+else: # pragma: no cover
+ from typing_extensions import Annotated # noqa: F401
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/py.typed b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/inflect/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..1bb5a44356f00884a71ceeefd24ded6caaba2418
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/LICENSE
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..fe6ca5ad880ff2a77c81a94ed84ee60c742e298f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/METADATA
@@ -0,0 +1,85 @@
+Metadata-Version: 2.1
+Name: jaraco.collections
+Version: 5.1.0
+Summary: Collection objects similar to those in stdlib by jaraco
+Author-email: "Jason R. Coombs"
+Project-URL: Source, https://github.com/jaraco/jaraco.collections
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: jaraco.text
+Provides-Extra: check
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'check'
+Requires-Dist: pytest-ruff >=0.2.1 ; (sys_platform != "cygwin") and extra == 'check'
+Provides-Extra: cover
+Requires-Dist: pytest-cov ; extra == 'cover'
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: enabler
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'enabler'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Provides-Extra: type
+Requires-Dist: pytest-mypy ; extra == 'type'
+
+.. image:: https://img.shields.io/pypi/v/jaraco.collections.svg
+ :target: https://pypi.org/project/jaraco.collections
+
+.. image:: https://img.shields.io/pypi/pyversions/jaraco.collections.svg
+
+.. image:: https://github.com/jaraco/jaraco.collections/actions/workflows/main.yml/badge.svg
+ :target: https://github.com/jaraco/jaraco.collections/actions?query=workflow%3A%22tests%22
+ :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+ :target: https://github.com/astral-sh/ruff
+ :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/jaracocollections/badge/?version=latest
+ :target: https://jaracocollections.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+ :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/jaraco.collections
+ :target: https://tidelift.com/subscription/pkg/pypi-jaraco.collections?utm_source=pypi-jaraco.collections&utm_medium=readme
+
+Models and classes to supplement the stdlib 'collections' module.
+
+See the docs, linked above, for descriptions and usage examples.
+
+Highlights include:
+
+- RangeMap: A mapping that accepts a range of values for keys.
+- Projection: A subset over an existing mapping.
+- KeyTransformingDict: Generalized mapping with keys transformed by a function.
+- FoldedCaseKeyedDict: A dict whose string keys are case-insensitive.
+- BijectiveMap: A map where keys map to values and values back to their keys.
+- ItemsAsAttributes: A mapping mix-in exposing items as attributes.
+- IdentityOverrideMap: A map whose keys map by default to themselves unless overridden.
+- FrozenDict: A hashable, immutable map.
+- Enumeration: An object whose keys are enumerated.
+- Everything: A container that contains all things.
+- Least, Greatest: Objects that are always less than or greater than any other.
+- pop_all: Return all items from the mutable sequence and remove them from that sequence.
+- DictStack: A stack of dicts, great for sharing scopes.
+- WeightedLookup: A specialized RangeMap for selecting an item by weights.
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..48b957ec88588e68cf23d25ebf6f5f6b1cfcf43b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/RECORD
@@ -0,0 +1,10 @@
+jaraco.collections-5.1.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+jaraco.collections-5.1.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+jaraco.collections-5.1.0.dist-info/METADATA,sha256=IMUaliNsA5X1Ox9MXUWOagch5R4Wwb_3M7erp29dBtg,3933
+jaraco.collections-5.1.0.dist-info/RECORD,,
+jaraco.collections-5.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+jaraco.collections-5.1.0.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
+jaraco.collections-5.1.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
+jaraco/collections/__init__.py,sha256=Pc1-SqjWm81ad1P0-GttpkwO_LWlnaY6gUq8gcKh2v0,26640
+jaraco/collections/__pycache__/__init__.cpython-312.pyc,,
+jaraco/collections/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/REQUESTED b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..50e1e84e4a3fa44387f2798f8f465963bc3fc406
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: setuptools (73.0.1)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f6205a5f19a533fd30f90a433e610325ff02f989
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.collections-5.1.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+jaraco
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..1bb5a44356f00884a71ceeefd24ded6caaba2418
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/LICENSE
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..a36f7c5e82d796eadf667ad461fae3bb5cea0b4a
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/METADATA
@@ -0,0 +1,75 @@
+Metadata-Version: 2.1
+Name: jaraco.context
+Version: 5.3.0
+Summary: Useful decorators and context managers
+Home-page: https://github.com/jaraco/jaraco.context
+Author: Jason R. Coombs
+Author-email: jaraco@jaraco.com
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+License-File: LICENSE
+Requires-Dist: backports.tarfile ; python_version < "3.12"
+Provides-Extra: docs
+Requires-Dist: sphinx >=3.5 ; extra == 'docs'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
+Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
+Requires-Dist: furo ; extra == 'docs'
+Requires-Dist: sphinx-lint ; extra == 'docs'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'docs'
+Provides-Extra: testing
+Requires-Dist: pytest !=8.1.1,>=6 ; extra == 'testing'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
+Requires-Dist: pytest-cov ; extra == 'testing'
+Requires-Dist: pytest-mypy ; extra == 'testing'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
+Requires-Dist: portend ; extra == 'testing'
+
+.. image:: https://img.shields.io/pypi/v/jaraco.context.svg
+ :target: https://pypi.org/project/jaraco.context
+
+.. image:: https://img.shields.io/pypi/pyversions/jaraco.context.svg
+
+.. image:: https://github.com/jaraco/jaraco.context/actions/workflows/main.yml/badge.svg
+ :target: https://github.com/jaraco/jaraco.context/actions?query=workflow%3A%22tests%22
+ :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+ :target: https://github.com/astral-sh/ruff
+ :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/jaracocontext/badge/?version=latest
+ :target: https://jaracocontext.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+ :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/jaraco.context
+ :target: https://tidelift.com/subscription/pkg/pypi-jaraco.context?utm_source=pypi-jaraco.context&utm_medium=readme
+
+
+Highlights
+==========
+
+See the docs linked from the badge above for the full details, but here are some features that may be of interest.
+
+- ``ExceptionTrap`` provides a general-purpose wrapper for trapping exceptions and then acting on the outcome. Includes ``passes`` and ``raises`` decorators to replace the result of a wrapped function by a boolean indicating the outcome of the exception trap. See `this keyring commit `_ for an example of it in production.
+- ``suppress`` simply enables ``contextlib.suppress`` as a decorator.
+- ``on_interrupt`` is a decorator used by CLI entry points to affect the handling of a ``KeyboardInterrupt``. Inspired by `Lucretiel/autocommand#18 `_.
+- ``pushd`` is similar to pytest's ``monkeypatch.chdir`` or path's `default context `_, changes the current working directory for the duration of the context.
+- ``tarball`` will download a tarball, extract it, change directory, yield, then clean up after. Convenient when working with web assets.
+- ``null`` is there for those times when one code branch needs a context and the other doesn't; this null context provides symmetry across those branches.
+
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..09d191f214a1b83403df2ba891b21f5be94134dc
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/RECORD
@@ -0,0 +1,8 @@
+jaraco.context-5.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+jaraco.context-5.3.0.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+jaraco.context-5.3.0.dist-info/METADATA,sha256=xDtguJej0tN9iEXCUvxEJh2a7xceIRVBEakBLSr__tY,4020
+jaraco.context-5.3.0.dist-info/RECORD,,
+jaraco.context-5.3.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+jaraco.context-5.3.0.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
+jaraco/__pycache__/context.cpython-312.pyc,,
+jaraco/context.py,sha256=REoLIxDkO5MfEYowt_WoupNCRoxBS5v7YX2PbW8lIcs,9552
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..bab98d675883cc7567a79df485cd7b4f015e376f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f6205a5f19a533fd30f90a433e610325ff02f989
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.context-5.3.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+jaraco
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..1bb5a44356f00884a71ceeefd24ded6caaba2418
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/LICENSE
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..c865140ab2971d078e8605fa22d8e4a27c2fecff
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/METADATA
@@ -0,0 +1,64 @@
+Metadata-Version: 2.1
+Name: jaraco.functools
+Version: 4.0.1
+Summary: Functools like those found in stdlib
+Author-email: "Jason R. Coombs"
+Project-URL: Homepage, https://github.com/jaraco/jaraco.functools
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: more-itertools
+Provides-Extra: docs
+Requires-Dist: sphinx >=3.5 ; extra == 'docs'
+Requires-Dist: sphinx <7.2.5 ; extra == 'docs'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'docs'
+Requires-Dist: rst.linker >=1.9 ; extra == 'docs'
+Requires-Dist: furo ; extra == 'docs'
+Requires-Dist: sphinx-lint ; extra == 'docs'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'docs'
+Provides-Extra: testing
+Requires-Dist: pytest >=6 ; extra == 'testing'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'testing'
+Requires-Dist: pytest-cov ; extra == 'testing'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'testing'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'testing'
+Requires-Dist: jaraco.classes ; extra == 'testing'
+Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
+
+.. image:: https://img.shields.io/pypi/v/jaraco.functools.svg
+ :target: https://pypi.org/project/jaraco.functools
+
+.. image:: https://img.shields.io/pypi/pyversions/jaraco.functools.svg
+
+.. image:: https://github.com/jaraco/jaraco.functools/actions/workflows/main.yml/badge.svg
+ :target: https://github.com/jaraco/jaraco.functools/actions?query=workflow%3A%22tests%22
+ :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+ :target: https://github.com/astral-sh/ruff
+ :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/jaracofunctools/badge/?version=latest
+ :target: https://jaracofunctools.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+ :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/jaraco.functools
+ :target: https://tidelift.com/subscription/pkg/pypi-jaraco.functools?utm_source=pypi-jaraco.functools&utm_medium=readme
+
+Additional functools in the spirit of stdlib's functools.
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..ef3bc21e929e6881fc560bdef1505ed44bf838e1
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/RECORD
@@ -0,0 +1,10 @@
+jaraco.functools-4.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+jaraco.functools-4.0.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+jaraco.functools-4.0.1.dist-info/METADATA,sha256=i4aUaQDX-jjdEQK5wevhegyx8JyLfin2HyvaSk3FHso,2891
+jaraco.functools-4.0.1.dist-info/RECORD,,
+jaraco.functools-4.0.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+jaraco.functools-4.0.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
+jaraco/functools/__init__.py,sha256=hEAJaS2uSZRuF_JY4CxCHIYh79ZpxaPp9OiHyr9EJ1w,16642
+jaraco/functools/__init__.pyi,sha256=gk3dsgHzo5F_U74HzAvpNivFAPCkPJ1b2-yCd62dfnw,3878
+jaraco/functools/__pycache__/__init__.cpython-312.pyc,,
+jaraco/functools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..bab98d675883cc7567a79df485cd7b4f015e376f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f6205a5f19a533fd30f90a433e610325ff02f989
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.functools-4.0.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+jaraco
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..1bb5a44356f00884a71ceeefd24ded6caaba2418
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/LICENSE
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..0258a380f4acb6abb3b9e8d1bea70836b69a2559
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/METADATA
@@ -0,0 +1,95 @@
+Metadata-Version: 2.1
+Name: jaraco.text
+Version: 3.12.1
+Summary: Module for text manipulation
+Author-email: "Jason R. Coombs"
+Project-URL: Homepage, https://github.com/jaraco/jaraco.text
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3 :: Only
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Requires-Dist: jaraco.functools
+Requires-Dist: jaraco.context >=4.1
+Requires-Dist: autocommand
+Requires-Dist: inflect
+Requires-Dist: more-itertools
+Requires-Dist: importlib-resources ; python_version < "3.9"
+Provides-Extra: doc
+Requires-Dist: sphinx >=3.5 ; extra == 'doc'
+Requires-Dist: jaraco.packaging >=9.3 ; extra == 'doc'
+Requires-Dist: rst.linker >=1.9 ; extra == 'doc'
+Requires-Dist: furo ; extra == 'doc'
+Requires-Dist: sphinx-lint ; extra == 'doc'
+Requires-Dist: jaraco.tidelift >=1.4 ; extra == 'doc'
+Provides-Extra: test
+Requires-Dist: pytest !=8.1.*,>=6 ; extra == 'test'
+Requires-Dist: pytest-checkdocs >=2.4 ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-mypy ; extra == 'test'
+Requires-Dist: pytest-enabler >=2.2 ; extra == 'test'
+Requires-Dist: pytest-ruff >=0.2.1 ; extra == 'test'
+Requires-Dist: pathlib2 ; (python_version < "3.10") and extra == 'test'
+
+.. image:: https://img.shields.io/pypi/v/jaraco.text.svg
+ :target: https://pypi.org/project/jaraco.text
+
+.. image:: https://img.shields.io/pypi/pyversions/jaraco.text.svg
+
+.. image:: https://github.com/jaraco/jaraco.text/actions/workflows/main.yml/badge.svg
+ :target: https://github.com/jaraco/jaraco.text/actions?query=workflow%3A%22tests%22
+ :alt: tests
+
+.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
+ :target: https://github.com/astral-sh/ruff
+ :alt: Ruff
+
+.. image:: https://readthedocs.org/projects/jaracotext/badge/?version=latest
+ :target: https://jaracotext.readthedocs.io/en/latest/?badge=latest
+
+.. image:: https://img.shields.io/badge/skeleton-2024-informational
+ :target: https://blog.jaraco.com/skeleton
+
+.. image:: https://tidelift.com/badges/package/pypi/jaraco.text
+ :target: https://tidelift.com/subscription/pkg/pypi-jaraco.text?utm_source=pypi-jaraco.text&utm_medium=readme
+
+
+This package provides handy routines for dealing with text, such as
+wrapping, substitution, trimming, stripping, prefix and suffix removal,
+line continuation, indentation, comment processing, identifier processing,
+values parsing, case insensitive comparison, and more. See the docs
+(linked in the badge above) for the detailed documentation and examples.
+
+Layouts
+=======
+
+One of the features of this package is the layouts module, which
+provides a simple example of translating keystrokes from one keyboard
+layout to another::
+
+ echo qwerty | python -m jaraco.text.to-dvorak
+ ',.pyf
+ echo "',.pyf" | python -m jaraco.text.to-qwerty
+ qwerty
+
+Newline Reporting
+=================
+
+Need to know what newlines appear in a file?
+
+::
+
+ $ python -m jaraco.text.show-newlines README.rst
+ newline is '\n'
+
+For Enterprise
+==============
+
+Available as part of the Tidelift Subscription.
+
+This project and the maintainers of thousands of other packages are working with Tidelift to deliver one enterprise subscription that covers all of the open source you use.
+
+`Learn more `_.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..19e2d8402af9356a13a1335ef2b71222b0aadeec
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/RECORD
@@ -0,0 +1,20 @@
+jaraco.text-3.12.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+jaraco.text-3.12.1.dist-info/LICENSE,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
+jaraco.text-3.12.1.dist-info/METADATA,sha256=AzWdm6ViMfDOPoQMfLWn2zgBQSGJScyqeN29TcuWXVI,3658
+jaraco.text-3.12.1.dist-info/RECORD,,
+jaraco.text-3.12.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+jaraco.text-3.12.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
+jaraco.text-3.12.1.dist-info/top_level.txt,sha256=0JnN3LfXH4LIRfXL-QFOGCJzQWZO3ELx4R1d_louoQM,7
+jaraco/text/Lorem ipsum.txt,sha256=N_7c_79zxOufBY9HZ3yzMgOkNv-TkOTTio4BydrSjgs,1335
+jaraco/text/__init__.py,sha256=Y2YUqXR_orUoDaY4SkPRe6ZZhb5HUHB_Ah9RCNsVyho,16250
+jaraco/text/__pycache__/__init__.cpython-312.pyc,,
+jaraco/text/__pycache__/layouts.cpython-312.pyc,,
+jaraco/text/__pycache__/show-newlines.cpython-312.pyc,,
+jaraco/text/__pycache__/strip-prefix.cpython-312.pyc,,
+jaraco/text/__pycache__/to-dvorak.cpython-312.pyc,,
+jaraco/text/__pycache__/to-qwerty.cpython-312.pyc,,
+jaraco/text/layouts.py,sha256=HTC8aSTLZ7uXipyOXapRMC158juecjK6RVwitfmZ9_w,643
+jaraco/text/show-newlines.py,sha256=WGQa65e8lyhb92LUOLqVn6KaCtoeVgVws6WtSRmLk6w,904
+jaraco/text/strip-prefix.py,sha256=NfVXV8JVNo6nqcuYASfMV7_y4Eo8zMQqlCOGvAnRIVw,412
+jaraco/text/to-dvorak.py,sha256=1SNcbSsvISpXXg-LnybIHHY-RUFOQr36zcHkY1pWFqw,119
+jaraco/text/to-qwerty.py,sha256=s4UMQUnPwFn_dB5uZC27BurHOQcYondBfzIpVL5pEzw,119
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..bab98d675883cc7567a79df485cd7b4f015e376f
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.43.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f6205a5f19a533fd30f90a433e610325ff02f989
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco.text-3.12.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+jaraco
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/collections/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/collections/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..0d501cf9e9cef5859f3c1bf844bc7280ce1e7aaa
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/collections/__init__.py
@@ -0,0 +1,1091 @@
+from __future__ import annotations
+
+import collections.abc
+import copy
+import functools
+import itertools
+import operator
+import random
+import re
+from collections.abc import Container, Iterable, Mapping
+from typing import TYPE_CHECKING, Any, Callable, Dict, TypeVar, Union, overload
+
+import jaraco.text
+
+if TYPE_CHECKING:
+ from _operator import _SupportsComparison
+
+ from _typeshed import SupportsKeysAndGetItem
+ from typing_extensions import Self
+
+ _RangeMapKT = TypeVar('_RangeMapKT', bound=_SupportsComparison)
+else:
+ # _SupportsComparison doesn't exist at runtime,
+ # but _RangeMapKT is used in RangeMap's superclass' type parameters
+ _RangeMapKT = TypeVar('_RangeMapKT')
+
+_T = TypeVar('_T')
+_VT = TypeVar('_VT')
+
+_Matchable = Union[Callable, Container, Iterable, re.Pattern]
+
+
+def _dispatch(obj: _Matchable) -> Callable:
+ # can't rely on singledispatch for Union[Container, Iterable]
+ # due to ambiguity
+ # (https://peps.python.org/pep-0443/#abstract-base-classes).
+ if isinstance(obj, re.Pattern):
+ return obj.fullmatch
+ # mypy issue: https://github.com/python/mypy/issues/11071
+ if not isinstance(obj, Callable): # type: ignore[arg-type]
+ if not isinstance(obj, Container):
+ obj = set(obj) # type: ignore[arg-type]
+ obj = obj.__contains__
+ return obj # type: ignore[return-value]
+
+
+class Projection(collections.abc.Mapping):
+ """
+ Project a set of keys over a mapping
+
+ >>> sample = {'a': 1, 'b': 2, 'c': 3}
+ >>> prj = Projection(['a', 'c', 'd'], sample)
+ >>> dict(prj)
+ {'a': 1, 'c': 3}
+
+ Projection also accepts an iterable or callable or pattern.
+
+ >>> iter_prj = Projection(iter('acd'), sample)
+ >>> call_prj = Projection(lambda k: ord(k) in (97, 99, 100), sample)
+ >>> pat_prj = Projection(re.compile(r'[acd]'), sample)
+ >>> prj == iter_prj == call_prj == pat_prj
+ True
+
+ Keys should only appear if they were specified and exist in the space.
+ Order is retained.
+
+ >>> list(prj)
+ ['a', 'c']
+
+ Attempting to access a key not in the projection
+ results in a KeyError.
+
+ >>> prj['b']
+ Traceback (most recent call last):
+ ...
+ KeyError: 'b'
+
+ Use the projection to update another dict.
+
+ >>> target = {'a': 2, 'b': 2}
+ >>> target.update(prj)
+ >>> target
+ {'a': 1, 'b': 2, 'c': 3}
+
+ Projection keeps a reference to the original dict, so
+ modifying the original dict may modify the Projection.
+
+ >>> del sample['a']
+ >>> dict(prj)
+ {'c': 3}
+ """
+
+ def __init__(self, keys: _Matchable, space: Mapping):
+ self._match = _dispatch(keys)
+ self._space = space
+
+ def __getitem__(self, key):
+ if not self._match(key):
+ raise KeyError(key)
+ return self._space[key]
+
+ def _keys_resolved(self):
+ return filter(self._match, self._space)
+
+ def __iter__(self):
+ return self._keys_resolved()
+
+ def __len__(self):
+ return len(tuple(self._keys_resolved()))
+
+
+class Mask(Projection):
+ """
+ The inverse of a :class:`Projection`, masking out keys.
+
+ >>> sample = {'a': 1, 'b': 2, 'c': 3}
+ >>> msk = Mask(['a', 'c', 'd'], sample)
+ >>> dict(msk)
+ {'b': 2}
+ """
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ # self._match = compose(operator.not_, self._match)
+ self._match = lambda key, orig=self._match: not orig(key)
+
+
+def dict_map(function, dictionary):
+ """
+ Return a new dict with function applied to values of dictionary.
+
+ >>> dict_map(lambda x: x+1, dict(a=1, b=2))
+ {'a': 2, 'b': 3}
+ """
+ return dict((key, function(value)) for key, value in dictionary.items())
+
+
+class RangeMap(Dict[_RangeMapKT, _VT]):
+ """
+ A dictionary-like object that uses the keys as bounds for a range.
+ Inclusion of the value for that range is determined by the
+ key_match_comparator, which defaults to less-than-or-equal.
+ A value is returned for a key if it is the first key that matches in
+ the sorted list of keys.
+
+ One may supply keyword parameters to be passed to the sort function used
+ to sort keys (i.e. key, reverse) as sort_params.
+
+ Create a map that maps 1-3 -> 'a', 4-6 -> 'b'
+
+ >>> r = RangeMap({3: 'a', 6: 'b'}) # boy, that was easy
+ >>> r[1], r[2], r[3], r[4], r[5], r[6]
+ ('a', 'a', 'a', 'b', 'b', 'b')
+
+ Even float values should work so long as the comparison operator
+ supports it.
+
+ >>> r[4.5]
+ 'b'
+
+ Notice that the way rangemap is defined, it must be open-ended
+ on one side.
+
+ >>> r[0]
+ 'a'
+ >>> r[-1]
+ 'a'
+
+ One can close the open-end of the RangeMap by using undefined_value
+
+ >>> r = RangeMap({0: RangeMap.undefined_value, 3: 'a', 6: 'b'})
+ >>> r[0]
+ Traceback (most recent call last):
+ ...
+ KeyError: 0
+
+ One can get the first or last elements in the range by using RangeMap.Item
+
+ >>> last_item = RangeMap.Item(-1)
+ >>> r[last_item]
+ 'b'
+
+ .last_item is a shortcut for Item(-1)
+
+ >>> r[RangeMap.last_item]
+ 'b'
+
+ Sometimes it's useful to find the bounds for a RangeMap
+
+ >>> r.bounds()
+ (0, 6)
+
+ RangeMap supports .get(key, default)
+
+ >>> r.get(0, 'not found')
+ 'not found'
+
+ >>> r.get(7, 'not found')
+ 'not found'
+
+ One often wishes to define the ranges by their left-most values,
+ which requires use of sort params and a key_match_comparator.
+
+ >>> r = RangeMap({1: 'a', 4: 'b'},
+ ... sort_params=dict(reverse=True),
+ ... key_match_comparator=operator.ge)
+ >>> r[1], r[2], r[3], r[4], r[5], r[6]
+ ('a', 'a', 'a', 'b', 'b', 'b')
+
+ That wasn't nearly as easy as before, so an alternate constructor
+ is provided:
+
+ >>> r = RangeMap.left({1: 'a', 4: 'b', 7: RangeMap.undefined_value})
+ >>> r[1], r[2], r[3], r[4], r[5], r[6]
+ ('a', 'a', 'a', 'b', 'b', 'b')
+
+ """
+
+ def __init__(
+ self,
+ source: (
+ SupportsKeysAndGetItem[_RangeMapKT, _VT] | Iterable[tuple[_RangeMapKT, _VT]]
+ ),
+ sort_params: Mapping[str, Any] = {},
+ key_match_comparator: Callable[[_RangeMapKT, _RangeMapKT], bool] = operator.le,
+ ):
+ dict.__init__(self, source)
+ self.sort_params = sort_params
+ self.match = key_match_comparator
+
+ @classmethod
+ def left(
+ cls,
+ source: (
+ SupportsKeysAndGetItem[_RangeMapKT, _VT] | Iterable[tuple[_RangeMapKT, _VT]]
+ ),
+ ) -> Self:
+ return cls(
+ source, sort_params=dict(reverse=True), key_match_comparator=operator.ge
+ )
+
+ def __getitem__(self, item: _RangeMapKT) -> _VT:
+ sorted_keys = sorted(self.keys(), **self.sort_params)
+ if isinstance(item, RangeMap.Item):
+ result = self.__getitem__(sorted_keys[item])
+ else:
+ key = self._find_first_match_(sorted_keys, item)
+ result = dict.__getitem__(self, key)
+ if result is RangeMap.undefined_value:
+ raise KeyError(key)
+ return result
+
+ @overload # type: ignore[override] # Signature simplified over dict and Mapping
+ def get(self, key: _RangeMapKT, default: _T) -> _VT | _T: ...
+ @overload
+ def get(self, key: _RangeMapKT, default: None = None) -> _VT | None: ...
+ def get(self, key: _RangeMapKT, default: _T | None = None) -> _VT | _T | None:
+ """
+ Return the value for key if key is in the dictionary, else default.
+ If default is not given, it defaults to None, so that this method
+ never raises a KeyError.
+ """
+ try:
+ return self[key]
+ except KeyError:
+ return default
+
+ def _find_first_match_(
+ self, keys: Iterable[_RangeMapKT], item: _RangeMapKT
+ ) -> _RangeMapKT:
+ is_match = functools.partial(self.match, item)
+ matches = filter(is_match, keys)
+ try:
+ return next(matches)
+ except StopIteration:
+ raise KeyError(item) from None
+
+ def bounds(self) -> tuple[_RangeMapKT, _RangeMapKT]:
+ sorted_keys = sorted(self.keys(), **self.sort_params)
+ return (sorted_keys[RangeMap.first_item], sorted_keys[RangeMap.last_item])
+
+ # some special values for the RangeMap
+ undefined_value = type('RangeValueUndefined', (), {})()
+
+ class Item(int):
+ """RangeMap Item"""
+
+ first_item = Item(0)
+ last_item = Item(-1)
+
+
+def __identity(x):
+ return x
+
+
+def sorted_items(d, key=__identity, reverse=False):
+ """
+ Return the items of the dictionary sorted by the keys.
+
+ >>> sample = dict(foo=20, bar=42, baz=10)
+ >>> tuple(sorted_items(sample))
+ (('bar', 42), ('baz', 10), ('foo', 20))
+
+ >>> reverse_string = lambda s: ''.join(reversed(s))
+ >>> tuple(sorted_items(sample, key=reverse_string))
+ (('foo', 20), ('bar', 42), ('baz', 10))
+
+ >>> tuple(sorted_items(sample, reverse=True))
+ (('foo', 20), ('baz', 10), ('bar', 42))
+ """
+
+ # wrap the key func so it operates on the first element of each item
+ def pairkey_key(item):
+ return key(item[0])
+
+ return sorted(d.items(), key=pairkey_key, reverse=reverse)
+
+
+class KeyTransformingDict(dict):
+ """
+ A dict subclass that transforms the keys before they're used.
+ Subclasses may override the default transform_key to customize behavior.
+ """
+
+ @staticmethod
+ def transform_key(key): # pragma: nocover
+ return key
+
+ def __init__(self, *args, **kargs):
+ super().__init__()
+ # build a dictionary using the default constructs
+ d = dict(*args, **kargs)
+ # build this dictionary using transformed keys.
+ for item in d.items():
+ self.__setitem__(*item)
+
+ def __setitem__(self, key, val):
+ key = self.transform_key(key)
+ super().__setitem__(key, val)
+
+ def __getitem__(self, key):
+ key = self.transform_key(key)
+ return super().__getitem__(key)
+
+ def __contains__(self, key):
+ key = self.transform_key(key)
+ return super().__contains__(key)
+
+ def __delitem__(self, key):
+ key = self.transform_key(key)
+ return super().__delitem__(key)
+
+ def get(self, key, *args, **kwargs):
+ key = self.transform_key(key)
+ return super().get(key, *args, **kwargs)
+
+ def setdefault(self, key, *args, **kwargs):
+ key = self.transform_key(key)
+ return super().setdefault(key, *args, **kwargs)
+
+ def pop(self, key, *args, **kwargs):
+ key = self.transform_key(key)
+ return super().pop(key, *args, **kwargs)
+
+ def matching_key_for(self, key):
+ """
+ Given a key, return the actual key stored in self that matches.
+ Raise KeyError if the key isn't found.
+ """
+ try:
+ return next(e_key for e_key in self.keys() if e_key == key)
+ except StopIteration as err:
+ raise KeyError(key) from err
+
+
+class FoldedCaseKeyedDict(KeyTransformingDict):
+ """
+ A case-insensitive dictionary (keys are compared as insensitive
+ if they are strings).
+
+ >>> d = FoldedCaseKeyedDict()
+ >>> d['heLlo'] = 'world'
+ >>> list(d.keys()) == ['heLlo']
+ True
+ >>> list(d.values()) == ['world']
+ True
+ >>> d['hello'] == 'world'
+ True
+ >>> 'hello' in d
+ True
+ >>> 'HELLO' in d
+ True
+ >>> print(repr(FoldedCaseKeyedDict({'heLlo': 'world'})))
+ {'heLlo': 'world'}
+ >>> d = FoldedCaseKeyedDict({'heLlo': 'world'})
+ >>> print(d['hello'])
+ world
+ >>> print(d['Hello'])
+ world
+ >>> list(d.keys())
+ ['heLlo']
+ >>> d = FoldedCaseKeyedDict({'heLlo': 'world', 'Hello': 'world'})
+ >>> list(d.values())
+ ['world']
+ >>> key, = d.keys()
+ >>> key in ['heLlo', 'Hello']
+ True
+ >>> del d['HELLO']
+ >>> d
+ {}
+
+ get should work
+
+ >>> d['Sumthin'] = 'else'
+ >>> d.get('SUMTHIN')
+ 'else'
+ >>> d.get('OTHER', 'thing')
+ 'thing'
+ >>> del d['sumthin']
+
+ setdefault should also work
+
+ >>> d['This'] = 'that'
+ >>> print(d.setdefault('this', 'other'))
+ that
+ >>> len(d)
+ 1
+ >>> print(d['this'])
+ that
+ >>> print(d.setdefault('That', 'other'))
+ other
+ >>> print(d['THAT'])
+ other
+
+ Make it pop!
+
+ >>> print(d.pop('THAT'))
+ other
+
+ To retrieve the key in its originally-supplied form, use matching_key_for
+
+ >>> print(d.matching_key_for('this'))
+ This
+
+ >>> d.matching_key_for('missing')
+ Traceback (most recent call last):
+ ...
+ KeyError: 'missing'
+ """
+
+ @staticmethod
+ def transform_key(key):
+ return jaraco.text.FoldedCase(key)
+
+
+class DictAdapter:
+ """
+ Provide a getitem interface for attributes of an object.
+
+ Let's say you want to get at the string.lowercase property in a formatted
+ string. It's easy with DictAdapter.
+
+ >>> import string
+ >>> print("lowercase is %(ascii_lowercase)s" % DictAdapter(string))
+ lowercase is abcdefghijklmnopqrstuvwxyz
+ """
+
+ def __init__(self, wrapped_ob):
+ self.object = wrapped_ob
+
+ def __getitem__(self, name):
+ return getattr(self.object, name)
+
+
+class ItemsAsAttributes:
+ """
+ Mix-in class to enable a mapping object to provide items as
+ attributes.
+
+ >>> C = type('C', (dict, ItemsAsAttributes), dict())
+ >>> i = C()
+ >>> i['foo'] = 'bar'
+ >>> i.foo
+ 'bar'
+
+ Natural attribute access takes precedence
+
+ >>> i.foo = 'henry'
+ >>> i.foo
+ 'henry'
+
+ But as you might expect, the mapping functionality is preserved.
+
+ >>> i['foo']
+ 'bar'
+
+ A normal attribute error should be raised if an attribute is
+ requested that doesn't exist.
+
+ >>> i.missing
+ Traceback (most recent call last):
+ ...
+ AttributeError: 'C' object has no attribute 'missing'
+
+ It also works on dicts that customize __getitem__
+
+ >>> missing_func = lambda self, key: 'missing item'
+ >>> C = type(
+ ... 'C',
+ ... (dict, ItemsAsAttributes),
+ ... dict(__missing__ = missing_func),
+ ... )
+ >>> i = C()
+ >>> i.missing
+ 'missing item'
+ >>> i.foo
+ 'missing item'
+ """
+
+ def __getattr__(self, key):
+ try:
+ return getattr(super(), key)
+ except AttributeError as e:
+ # attempt to get the value from the mapping (return self[key])
+ # but be careful not to lose the original exception context.
+ noval = object()
+
+ def _safe_getitem(cont, key, missing_result):
+ try:
+ return cont[key]
+ except KeyError:
+ return missing_result
+
+ result = _safe_getitem(self, key, noval)
+ if result is not noval:
+ return result
+ # raise the original exception, but use the original class
+ # name, not 'super'.
+ (message,) = e.args
+ message = message.replace('super', self.__class__.__name__, 1)
+ e.args = (message,)
+ raise
+
+
+def invert_map(map):
+ """
+ Given a dictionary, return another dictionary with keys and values
+ switched. If any of the values resolve to the same key, raises
+ a ValueError.
+
+ >>> numbers = dict(a=1, b=2, c=3)
+ >>> letters = invert_map(numbers)
+ >>> letters[1]
+ 'a'
+ >>> numbers['d'] = 3
+ >>> invert_map(numbers)
+ Traceback (most recent call last):
+ ...
+ ValueError: Key conflict in inverted mapping
+ """
+ res = dict((v, k) for k, v in map.items())
+ if not len(res) == len(map):
+ raise ValueError('Key conflict in inverted mapping')
+ return res
+
+
+class IdentityOverrideMap(dict):
+ """
+ A dictionary that by default maps each key to itself, but otherwise
+ acts like a normal dictionary.
+
+ >>> d = IdentityOverrideMap()
+ >>> d[42]
+ 42
+ >>> d['speed'] = 'speedo'
+ >>> print(d['speed'])
+ speedo
+ """
+
+ def __missing__(self, key):
+ return key
+
+
+class DictStack(list, collections.abc.MutableMapping):
+ """
+ A stack of dictionaries that behaves as a view on those dictionaries,
+ giving preference to the last.
+
+ >>> stack = DictStack([dict(a=1, c=2), dict(b=2, a=2)])
+ >>> stack['a']
+ 2
+ >>> stack['b']
+ 2
+ >>> stack['c']
+ 2
+ >>> len(stack)
+ 3
+ >>> stack.push(dict(a=3))
+ >>> stack['a']
+ 3
+ >>> stack['a'] = 4
+ >>> set(stack.keys()) == set(['a', 'b', 'c'])
+ True
+ >>> set(stack.items()) == set([('a', 4), ('b', 2), ('c', 2)])
+ True
+ >>> dict(**stack) == dict(stack) == dict(a=4, c=2, b=2)
+ True
+ >>> d = stack.pop()
+ >>> stack['a']
+ 2
+ >>> d = stack.pop()
+ >>> stack['a']
+ 1
+ >>> stack.get('b', None)
+ >>> 'c' in stack
+ True
+ >>> del stack['c']
+ >>> dict(stack)
+ {'a': 1}
+ """
+
+ def __iter__(self):
+ dicts = list.__iter__(self)
+ return iter(set(itertools.chain.from_iterable(c.keys() for c in dicts)))
+
+ def __getitem__(self, key):
+ for scope in reversed(tuple(list.__iter__(self))):
+ if key in scope:
+ return scope[key]
+ raise KeyError(key)
+
+ push = list.append
+
+ def __contains__(self, other):
+ return collections.abc.Mapping.__contains__(self, other)
+
+ def __len__(self):
+ return len(list(iter(self)))
+
+ def __setitem__(self, key, item):
+ last = list.__getitem__(self, -1)
+ return last.__setitem__(key, item)
+
+ def __delitem__(self, key):
+ last = list.__getitem__(self, -1)
+ return last.__delitem__(key)
+
+ # workaround for mypy confusion
+ def pop(self, *args, **kwargs):
+ return list.pop(self, *args, **kwargs)
+
+
+class BijectiveMap(dict):
+ """
+ A Bijective Map (two-way mapping).
+
+ Implemented as a simple dictionary of 2x the size, mapping values back
+ to keys.
+
+ Note, this implementation may be incomplete. If there's not a test for
+ your use case below, it's likely to fail, so please test and send pull
+ requests or patches for additional functionality needed.
+
+
+ >>> m = BijectiveMap()
+ >>> m['a'] = 'b'
+ >>> m == {'a': 'b', 'b': 'a'}
+ True
+ >>> print(m['b'])
+ a
+
+ >>> m['c'] = 'd'
+ >>> len(m)
+ 2
+
+ Some weird things happen if you map an item to itself or overwrite a
+ single key of a pair, so it's disallowed.
+
+ >>> m['e'] = 'e'
+ Traceback (most recent call last):
+ ValueError: Key cannot map to itself
+
+ >>> m['d'] = 'e'
+ Traceback (most recent call last):
+ ValueError: Key/Value pairs may not overlap
+
+ >>> m['e'] = 'd'
+ Traceback (most recent call last):
+ ValueError: Key/Value pairs may not overlap
+
+ >>> print(m.pop('d'))
+ c
+
+ >>> 'c' in m
+ False
+
+ >>> m = BijectiveMap(dict(a='b'))
+ >>> len(m)
+ 1
+ >>> print(m['b'])
+ a
+
+ >>> m = BijectiveMap()
+ >>> m.update(a='b')
+ >>> m['b']
+ 'a'
+
+ >>> del m['b']
+ >>> len(m)
+ 0
+ >>> 'a' in m
+ False
+ """
+
+ def __init__(self, *args, **kwargs):
+ super().__init__()
+ self.update(*args, **kwargs)
+
+ def __setitem__(self, item, value):
+ if item == value:
+ raise ValueError("Key cannot map to itself")
+ overlap = (
+ item in self
+ and self[item] != value
+ or value in self
+ and self[value] != item
+ )
+ if overlap:
+ raise ValueError("Key/Value pairs may not overlap")
+ super().__setitem__(item, value)
+ super().__setitem__(value, item)
+
+ def __delitem__(self, item):
+ self.pop(item)
+
+ def __len__(self):
+ return super().__len__() // 2
+
+ def pop(self, key, *args, **kwargs):
+ mirror = self[key]
+ super().__delitem__(mirror)
+ return super().pop(key, *args, **kwargs)
+
+ def update(self, *args, **kwargs):
+ # build a dictionary using the default constructs
+ d = dict(*args, **kwargs)
+ # build this dictionary using transformed keys.
+ for item in d.items():
+ self.__setitem__(*item)
+
+
+class FrozenDict(collections.abc.Mapping, collections.abc.Hashable):
+ """
+ An immutable mapping.
+
+ >>> a = FrozenDict(a=1, b=2)
+ >>> b = FrozenDict(a=1, b=2)
+ >>> a == b
+ True
+
+ >>> a == dict(a=1, b=2)
+ True
+ >>> dict(a=1, b=2) == a
+ True
+ >>> 'a' in a
+ True
+ >>> type(hash(a)) is type(0)
+ True
+ >>> set(iter(a)) == {'a', 'b'}
+ True
+ >>> len(a)
+ 2
+ >>> a['a'] == a.get('a') == 1
+ True
+
+ >>> a['c'] = 3
+ Traceback (most recent call last):
+ ...
+ TypeError: 'FrozenDict' object does not support item assignment
+
+ >>> a.update(y=3)
+ Traceback (most recent call last):
+ ...
+ AttributeError: 'FrozenDict' object has no attribute 'update'
+
+ Copies should compare equal
+
+ >>> copy.copy(a) == a
+ True
+
+ Copies should be the same type
+
+ >>> isinstance(copy.copy(a), FrozenDict)
+ True
+
+ FrozenDict supplies .copy(), even though
+ collections.abc.Mapping doesn't demand it.
+
+ >>> a.copy() == a
+ True
+ >>> a.copy() is not a
+ True
+ """
+
+ __slots__ = ['__data']
+
+ def __new__(cls, *args, **kwargs):
+ self = super().__new__(cls)
+ self.__data = dict(*args, **kwargs)
+ return self
+
+ # Container
+ def __contains__(self, key):
+ return key in self.__data
+
+ # Hashable
+ def __hash__(self):
+ return hash(tuple(sorted(self.__data.items())))
+
+ # Mapping
+ def __iter__(self):
+ return iter(self.__data)
+
+ def __len__(self):
+ return len(self.__data)
+
+ def __getitem__(self, key):
+ return self.__data[key]
+
+ # override get for efficiency provided by dict
+ def get(self, *args, **kwargs):
+ return self.__data.get(*args, **kwargs)
+
+ # override eq to recognize underlying implementation
+ def __eq__(self, other):
+ if isinstance(other, FrozenDict):
+ other = other.__data
+ return self.__data.__eq__(other)
+
+ def copy(self):
+ "Return a shallow copy of self"
+ return copy.copy(self)
+
+
+class Enumeration(ItemsAsAttributes, BijectiveMap):
+ """
+ A convenient way to provide enumerated values
+
+ >>> e = Enumeration('a b c')
+ >>> e['a']
+ 0
+
+ >>> e.a
+ 0
+
+ >>> e[1]
+ 'b'
+
+ >>> set(e.names) == set('abc')
+ True
+
+ >>> set(e.codes) == set(range(3))
+ True
+
+ >>> e.get('d') is None
+ True
+
+ Codes need not start with 0
+
+ >>> e = Enumeration('a b c', range(1, 4))
+ >>> e['a']
+ 1
+
+ >>> e[3]
+ 'c'
+ """
+
+ def __init__(self, names, codes=None):
+ if isinstance(names, str):
+ names = names.split()
+ if codes is None:
+ codes = itertools.count()
+ super().__init__(zip(names, codes))
+
+ @property
+ def names(self):
+ return (key for key in self if isinstance(key, str))
+
+ @property
+ def codes(self):
+ return (self[name] for name in self.names)
+
+
+class Everything:
+ """
+ A collection "containing" every possible thing.
+
+ >>> 'foo' in Everything()
+ True
+
+ >>> import random
+ >>> random.randint(1, 999) in Everything()
+ True
+
+ >>> random.choice([None, 'foo', 42, ('a', 'b', 'c')]) in Everything()
+ True
+ """
+
+ def __contains__(self, other):
+ return True
+
+
+class InstrumentedDict(collections.UserDict):
+ """
+ Instrument an existing dictionary with additional
+ functionality, but always reference and mutate
+ the original dictionary.
+
+ >>> orig = {'a': 1, 'b': 2}
+ >>> inst = InstrumentedDict(orig)
+ >>> inst['a']
+ 1
+ >>> inst['c'] = 3
+ >>> orig['c']
+ 3
+ >>> inst.keys() == orig.keys()
+ True
+ """
+
+ def __init__(self, data):
+ super().__init__()
+ self.data = data
+
+
+class Least:
+ """
+ A value that is always lesser than any other
+
+ >>> least = Least()
+ >>> 3 < least
+ False
+ >>> 3 > least
+ True
+ >>> least < 3
+ True
+ >>> least <= 3
+ True
+ >>> least > 3
+ False
+ >>> 'x' > least
+ True
+ >>> None > least
+ True
+ """
+
+ def __le__(self, other):
+ return True
+
+ __lt__ = __le__
+
+ def __ge__(self, other):
+ return False
+
+ __gt__ = __ge__
+
+
+class Greatest:
+ """
+ A value that is always greater than any other
+
+ >>> greatest = Greatest()
+ >>> 3 < greatest
+ True
+ >>> 3 > greatest
+ False
+ >>> greatest < 3
+ False
+ >>> greatest > 3
+ True
+ >>> greatest >= 3
+ True
+ >>> 'x' > greatest
+ False
+ >>> None > greatest
+ False
+ """
+
+ def __ge__(self, other):
+ return True
+
+ __gt__ = __ge__
+
+ def __le__(self, other):
+ return False
+
+ __lt__ = __le__
+
+
+def pop_all(items):
+ """
+ Clear items in place and return a copy of items.
+
+ >>> items = [1, 2, 3]
+ >>> popped = pop_all(items)
+ >>> popped is items
+ False
+ >>> popped
+ [1, 2, 3]
+ >>> items
+ []
+ """
+ result, items[:] = items[:], []
+ return result
+
+
+class FreezableDefaultDict(collections.defaultdict):
+ """
+ Often it is desirable to prevent the mutation of
+ a default dict after its initial construction, such
+ as to prevent mutation during iteration.
+
+ >>> dd = FreezableDefaultDict(list)
+ >>> dd[0].append('1')
+ >>> dd.freeze()
+ >>> dd[1]
+ []
+ >>> len(dd)
+ 1
+ """
+
+ def __missing__(self, key):
+ return getattr(self, '_frozen', super().__missing__)(key)
+
+ def freeze(self):
+ self._frozen = lambda key: self.default_factory()
+
+
+class Accumulator:
+ def __init__(self, initial=0):
+ self.val = initial
+
+ def __call__(self, val):
+ self.val += val
+ return self.val
+
+
+class WeightedLookup(RangeMap):
+ """
+ Given parameters suitable for a dict representing keys
+ and a weighted proportion, return a RangeMap representing
+ spans of values proportial to the weights:
+
+ >>> even = WeightedLookup(a=1, b=1)
+
+ [0, 1) -> a
+ [1, 2) -> b
+
+ >>> lk = WeightedLookup(a=1, b=2)
+
+ [0, 1) -> a
+ [1, 3) -> b
+
+ >>> lk[.5]
+ 'a'
+ >>> lk[1.5]
+ 'b'
+
+ Adds ``.random()`` to select a random weighted value:
+
+ >>> lk.random() in ['a', 'b']
+ True
+
+ >>> choices = [lk.random() for x in range(1000)]
+
+ Statistically speaking, choices should be .5 a:b
+ >>> ratio = choices.count('a') / choices.count('b')
+ >>> .4 < ratio < .6
+ True
+ """
+
+ def __init__(self, *args, **kwargs):
+ raw = dict(*args, **kwargs)
+
+ # allocate keys by weight
+ indexes = map(Accumulator(), raw.values())
+ super().__init__(zip(indexes, raw.keys()), key_match_comparator=operator.lt)
+
+ def random(self):
+ lower, upper = self.bounds()
+ selector = random.random() * upper
+ return self[selector]
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/collections/py.typed b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/collections/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/context.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/context.py
new file mode 100644
index 0000000000000000000000000000000000000000..61b27135df1fc5504622ad69875249c87947e453
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/context.py
@@ -0,0 +1,361 @@
+from __future__ import annotations
+
+import contextlib
+import functools
+import operator
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+import urllib.request
+import warnings
+from typing import Iterator
+
+
+if sys.version_info < (3, 12):
+ from backports import tarfile
+else:
+ import tarfile
+
+
+@contextlib.contextmanager
+def pushd(dir: str | os.PathLike) -> Iterator[str | os.PathLike]:
+ """
+ >>> tmp_path = getfixture('tmp_path')
+ >>> with pushd(tmp_path):
+ ... assert os.getcwd() == os.fspath(tmp_path)
+ >>> assert os.getcwd() != os.fspath(tmp_path)
+ """
+
+ orig = os.getcwd()
+ os.chdir(dir)
+ try:
+ yield dir
+ finally:
+ os.chdir(orig)
+
+
+@contextlib.contextmanager
+def tarball(
+ url, target_dir: str | os.PathLike | None = None
+) -> Iterator[str | os.PathLike]:
+ """
+ Get a tarball, extract it, yield, then clean up.
+
+ >>> import urllib.request
+ >>> url = getfixture('tarfile_served')
+ >>> target = getfixture('tmp_path') / 'out'
+ >>> tb = tarball(url, target_dir=target)
+ >>> import pathlib
+ >>> with tb as extracted:
+ ... contents = pathlib.Path(extracted, 'contents.txt').read_text(encoding='utf-8')
+ >>> assert not os.path.exists(extracted)
+ """
+ if target_dir is None:
+ target_dir = os.path.basename(url).replace('.tar.gz', '').replace('.tgz', '')
+ # In the tar command, use --strip-components=1 to strip the first path and
+ # then
+ # use -C to cause the files to be extracted to {target_dir}. This ensures
+ # that we always know where the files were extracted.
+ os.mkdir(target_dir)
+ try:
+ req = urllib.request.urlopen(url)
+ with tarfile.open(fileobj=req, mode='r|*') as tf:
+ tf.extractall(path=target_dir, filter=strip_first_component)
+ yield target_dir
+ finally:
+ shutil.rmtree(target_dir)
+
+
+def strip_first_component(
+ member: tarfile.TarInfo,
+ path,
+) -> tarfile.TarInfo:
+ _, member.name = member.name.split('/', 1)
+ return member
+
+
+def _compose(*cmgrs):
+ """
+ Compose any number of dependent context managers into a single one.
+
+ The last, innermost context manager may take arbitrary arguments, but
+ each successive context manager should accept the result from the
+ previous as a single parameter.
+
+ Like :func:`jaraco.functools.compose`, behavior works from right to
+ left, so the context manager should be indicated from outermost to
+ innermost.
+
+ Example, to create a context manager to change to a temporary
+ directory:
+
+ >>> temp_dir_as_cwd = _compose(pushd, temp_dir)
+ >>> with temp_dir_as_cwd() as dir:
+ ... assert os.path.samefile(os.getcwd(), dir)
+ """
+
+ def compose_two(inner, outer):
+ def composed(*args, **kwargs):
+ with inner(*args, **kwargs) as saved, outer(saved) as res:
+ yield res
+
+ return contextlib.contextmanager(composed)
+
+ return functools.reduce(compose_two, reversed(cmgrs))
+
+
+tarball_cwd = _compose(pushd, tarball)
+
+
+@contextlib.contextmanager
+def tarball_context(*args, **kwargs):
+ warnings.warn(
+ "tarball_context is deprecated. Use tarball or tarball_cwd instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ pushd_ctx = kwargs.pop('pushd', pushd)
+ with tarball(*args, **kwargs) as tball, pushd_ctx(tball) as dir:
+ yield dir
+
+
+def infer_compression(url):
+ """
+ Given a URL or filename, infer the compression code for tar.
+
+ >>> infer_compression('http://foo/bar.tar.gz')
+ 'z'
+ >>> infer_compression('http://foo/bar.tgz')
+ 'z'
+ >>> infer_compression('file.bz')
+ 'j'
+ >>> infer_compression('file.xz')
+ 'J'
+ """
+ warnings.warn(
+ "infer_compression is deprecated with no replacement",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ # cheat and just assume it's the last two characters
+ compression_indicator = url[-2:]
+ mapping = dict(gz='z', bz='j', xz='J')
+ # Assume 'z' (gzip) if no match
+ return mapping.get(compression_indicator, 'z')
+
+
+@contextlib.contextmanager
+def temp_dir(remover=shutil.rmtree):
+ """
+ Create a temporary directory context. Pass a custom remover
+ to override the removal behavior.
+
+ >>> import pathlib
+ >>> with temp_dir() as the_dir:
+ ... assert os.path.isdir(the_dir)
+ ... _ = pathlib.Path(the_dir).joinpath('somefile').write_text('contents', encoding='utf-8')
+ >>> assert not os.path.exists(the_dir)
+ """
+ temp_dir = tempfile.mkdtemp()
+ try:
+ yield temp_dir
+ finally:
+ remover(temp_dir)
+
+
+@contextlib.contextmanager
+def repo_context(url, branch=None, quiet=True, dest_ctx=temp_dir):
+ """
+ Check out the repo indicated by url.
+
+ If dest_ctx is supplied, it should be a context manager
+ to yield the target directory for the check out.
+ """
+ exe = 'git' if 'git' in url else 'hg'
+ with dest_ctx() as repo_dir:
+ cmd = [exe, 'clone', url, repo_dir]
+ if branch:
+ cmd.extend(['--branch', branch])
+ devnull = open(os.path.devnull, 'w')
+ stdout = devnull if quiet else None
+ subprocess.check_call(cmd, stdout=stdout)
+ yield repo_dir
+
+
+def null():
+ """
+ A null context suitable to stand in for a meaningful context.
+
+ >>> with null() as value:
+ ... assert value is None
+
+ This context is most useful when dealing with two or more code
+ branches but only some need a context. Wrap the others in a null
+ context to provide symmetry across all options.
+ """
+ warnings.warn(
+ "null is deprecated. Use contextlib.nullcontext",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ return contextlib.nullcontext()
+
+
+class ExceptionTrap:
+ """
+ A context manager that will catch certain exceptions and provide an
+ indication they occurred.
+
+ >>> with ExceptionTrap() as trap:
+ ... raise Exception()
+ >>> bool(trap)
+ True
+
+ >>> with ExceptionTrap() as trap:
+ ... pass
+ >>> bool(trap)
+ False
+
+ >>> with ExceptionTrap(ValueError) as trap:
+ ... raise ValueError("1 + 1 is not 3")
+ >>> bool(trap)
+ True
+ >>> trap.value
+ ValueError('1 + 1 is not 3')
+ >>> trap.tb
+
+
+ >>> with ExceptionTrap(ValueError) as trap:
+ ... raise Exception()
+ Traceback (most recent call last):
+ ...
+ Exception
+
+ >>> bool(trap)
+ False
+ """
+
+ exc_info = None, None, None
+
+ def __init__(self, exceptions=(Exception,)):
+ self.exceptions = exceptions
+
+ def __enter__(self):
+ return self
+
+ @property
+ def type(self):
+ return self.exc_info[0]
+
+ @property
+ def value(self):
+ return self.exc_info[1]
+
+ @property
+ def tb(self):
+ return self.exc_info[2]
+
+ def __exit__(self, *exc_info):
+ type = exc_info[0]
+ matches = type and issubclass(type, self.exceptions)
+ if matches:
+ self.exc_info = exc_info
+ return matches
+
+ def __bool__(self):
+ return bool(self.type)
+
+ def raises(self, func, *, _test=bool):
+ """
+ Wrap func and replace the result with the truth
+ value of the trap (True if an exception occurred).
+
+ First, give the decorator an alias to support Python 3.8
+ Syntax.
+
+ >>> raises = ExceptionTrap(ValueError).raises
+
+ Now decorate a function that always fails.
+
+ >>> @raises
+ ... def fail():
+ ... raise ValueError('failed')
+ >>> fail()
+ True
+ """
+
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ with ExceptionTrap(self.exceptions) as trap:
+ func(*args, **kwargs)
+ return _test(trap)
+
+ return wrapper
+
+ def passes(self, func):
+ """
+ Wrap func and replace the result with the truth
+ value of the trap (True if no exception).
+
+ First, give the decorator an alias to support Python 3.8
+ Syntax.
+
+ >>> passes = ExceptionTrap(ValueError).passes
+
+ Now decorate a function that always fails.
+
+ >>> @passes
+ ... def fail():
+ ... raise ValueError('failed')
+
+ >>> fail()
+ False
+ """
+ return self.raises(func, _test=operator.not_)
+
+
+class suppress(contextlib.suppress, contextlib.ContextDecorator):
+ """
+ A version of contextlib.suppress with decorator support.
+
+ >>> @suppress(KeyError)
+ ... def key_error():
+ ... {}['']
+ >>> key_error()
+ """
+
+
+class on_interrupt(contextlib.ContextDecorator):
+ """
+ Replace a KeyboardInterrupt with SystemExit(1)
+
+ >>> def do_interrupt():
+ ... raise KeyboardInterrupt()
+ >>> on_interrupt('error')(do_interrupt)()
+ Traceback (most recent call last):
+ ...
+ SystemExit: 1
+ >>> on_interrupt('error', code=255)(do_interrupt)()
+ Traceback (most recent call last):
+ ...
+ SystemExit: 255
+ >>> on_interrupt('suppress')(do_interrupt)()
+ >>> with __import__('pytest').raises(KeyboardInterrupt):
+ ... on_interrupt('ignore')(do_interrupt)()
+ """
+
+ def __init__(self, action='error', /, code=1):
+ self.action = action
+ self.code = code
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, exctype, excinst, exctb):
+ if exctype is not KeyboardInterrupt or self.action == 'ignore':
+ return
+ elif self.action == 'error':
+ raise SystemExit(self.code) from excinst
+ return self.action == 'suppress'
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..ca6c22fa9ba2777507118fbfa38bc29ac2d84964
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.py
@@ -0,0 +1,633 @@
+import collections.abc
+import functools
+import inspect
+import itertools
+import operator
+import time
+import types
+import warnings
+
+import more_itertools
+
+
+def compose(*funcs):
+ """
+ Compose any number of unary functions into a single unary function.
+
+ >>> import textwrap
+ >>> expected = str.strip(textwrap.dedent(compose.__doc__))
+ >>> strip_and_dedent = compose(str.strip, textwrap.dedent)
+ >>> strip_and_dedent(compose.__doc__) == expected
+ True
+
+ Compose also allows the innermost function to take arbitrary arguments.
+
+ >>> round_three = lambda x: round(x, ndigits=3)
+ >>> f = compose(round_three, int.__truediv__)
+ >>> [f(3*x, x+1) for x in range(1,10)]
+ [1.5, 2.0, 2.25, 2.4, 2.5, 2.571, 2.625, 2.667, 2.7]
+ """
+
+ def compose_two(f1, f2):
+ return lambda *args, **kwargs: f1(f2(*args, **kwargs))
+
+ return functools.reduce(compose_two, funcs)
+
+
+def once(func):
+ """
+ Decorate func so it's only ever called the first time.
+
+ This decorator can ensure that an expensive or non-idempotent function
+ will not be expensive on subsequent calls and is idempotent.
+
+ >>> add_three = once(lambda a: a+3)
+ >>> add_three(3)
+ 6
+ >>> add_three(9)
+ 6
+ >>> add_three('12')
+ 6
+
+ To reset the stored value, simply clear the property ``saved_result``.
+
+ >>> del add_three.saved_result
+ >>> add_three(9)
+ 12
+ >>> add_three(8)
+ 12
+
+ Or invoke 'reset()' on it.
+
+ >>> add_three.reset()
+ >>> add_three(-3)
+ 0
+ >>> add_three(0)
+ 0
+ """
+
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ if not hasattr(wrapper, 'saved_result'):
+ wrapper.saved_result = func(*args, **kwargs)
+ return wrapper.saved_result
+
+ wrapper.reset = lambda: vars(wrapper).__delitem__('saved_result')
+ return wrapper
+
+
+def method_cache(method, cache_wrapper=functools.lru_cache()):
+ """
+ Wrap lru_cache to support storing the cache data in the object instances.
+
+ Abstracts the common paradigm where the method explicitly saves an
+ underscore-prefixed protected property on first call and returns that
+ subsequently.
+
+ >>> class MyClass:
+ ... calls = 0
+ ...
+ ... @method_cache
+ ... def method(self, value):
+ ... self.calls += 1
+ ... return value
+
+ >>> a = MyClass()
+ >>> a.method(3)
+ 3
+ >>> for x in range(75):
+ ... res = a.method(x)
+ >>> a.calls
+ 75
+
+ Note that the apparent behavior will be exactly like that of lru_cache
+ except that the cache is stored on each instance, so values in one
+ instance will not flush values from another, and when an instance is
+ deleted, so are the cached values for that instance.
+
+ >>> b = MyClass()
+ >>> for x in range(35):
+ ... res = b.method(x)
+ >>> b.calls
+ 35
+ >>> a.method(0)
+ 0
+ >>> a.calls
+ 75
+
+ Note that if method had been decorated with ``functools.lru_cache()``,
+ a.calls would have been 76 (due to the cached value of 0 having been
+ flushed by the 'b' instance).
+
+ Clear the cache with ``.cache_clear()``
+
+ >>> a.method.cache_clear()
+
+ Same for a method that hasn't yet been called.
+
+ >>> c = MyClass()
+ >>> c.method.cache_clear()
+
+ Another cache wrapper may be supplied:
+
+ >>> cache = functools.lru_cache(maxsize=2)
+ >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
+ >>> a = MyClass()
+ >>> a.method2()
+ 3
+
+ Caution - do not subsequently wrap the method with another decorator, such
+ as ``@property``, which changes the semantics of the function.
+
+ See also
+ http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
+ for another implementation and additional justification.
+ """
+
+ def wrapper(self, *args, **kwargs):
+ # it's the first call, replace the method with a cached, bound method
+ bound_method = types.MethodType(method, self)
+ cached_method = cache_wrapper(bound_method)
+ setattr(self, method.__name__, cached_method)
+ return cached_method(*args, **kwargs)
+
+ # Support cache clear even before cache has been created.
+ wrapper.cache_clear = lambda: None
+
+ return _special_method_cache(method, cache_wrapper) or wrapper
+
+
+def _special_method_cache(method, cache_wrapper):
+ """
+ Because Python treats special methods differently, it's not
+ possible to use instance attributes to implement the cached
+ methods.
+
+ Instead, install the wrapper method under a different name
+ and return a simple proxy to that wrapper.
+
+ https://github.com/jaraco/jaraco.functools/issues/5
+ """
+ name = method.__name__
+ special_names = '__getattr__', '__getitem__'
+
+ if name not in special_names:
+ return None
+
+ wrapper_name = '__cached' + name
+
+ def proxy(self, /, *args, **kwargs):
+ if wrapper_name not in vars(self):
+ bound = types.MethodType(method, self)
+ cache = cache_wrapper(bound)
+ setattr(self, wrapper_name, cache)
+ else:
+ cache = getattr(self, wrapper_name)
+ return cache(*args, **kwargs)
+
+ return proxy
+
+
+def apply(transform):
+ """
+ Decorate a function with a transform function that is
+ invoked on results returned from the decorated function.
+
+ >>> @apply(reversed)
+ ... def get_numbers(start):
+ ... "doc for get_numbers"
+ ... return range(start, start+3)
+ >>> list(get_numbers(4))
+ [6, 5, 4]
+ >>> get_numbers.__doc__
+ 'doc for get_numbers'
+ """
+
+ def wrap(func):
+ return functools.wraps(func)(compose(transform, func))
+
+ return wrap
+
+
+def result_invoke(action):
+ r"""
+ Decorate a function with an action function that is
+ invoked on the results returned from the decorated
+ function (for its side effect), then return the original
+ result.
+
+ >>> @result_invoke(print)
+ ... def add_two(a, b):
+ ... return a + b
+ >>> x = add_two(2, 3)
+ 5
+ >>> x
+ 5
+ """
+
+ def wrap(func):
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ result = func(*args, **kwargs)
+ action(result)
+ return result
+
+ return wrapper
+
+ return wrap
+
+
+def invoke(f, /, *args, **kwargs):
+ """
+ Call a function for its side effect after initialization.
+
+ The benefit of using the decorator instead of simply invoking a function
+ after defining it is that it makes explicit the author's intent for the
+ function to be called immediately. Whereas if one simply calls the
+ function immediately, it's less obvious if that was intentional or
+ incidental. It also avoids repeating the name - the two actions, defining
+ the function and calling it immediately are modeled separately, but linked
+ by the decorator construct.
+
+ The benefit of having a function construct (opposed to just invoking some
+ behavior inline) is to serve as a scope in which the behavior occurs. It
+ avoids polluting the global namespace with local variables, provides an
+ anchor on which to attach documentation (docstring), keeps the behavior
+ logically separated (instead of conceptually separated or not separated at
+ all), and provides potential to re-use the behavior for testing or other
+ purposes.
+
+ This function is named as a pithy way to communicate, "call this function
+ primarily for its side effect", or "while defining this function, also
+ take it aside and call it". It exists because there's no Python construct
+ for "define and call" (nor should there be, as decorators serve this need
+ just fine). The behavior happens immediately and synchronously.
+
+ >>> @invoke
+ ... def func(): print("called")
+ called
+ >>> func()
+ called
+
+ Use functools.partial to pass parameters to the initial call
+
+ >>> @functools.partial(invoke, name='bingo')
+ ... def func(name): print('called with', name)
+ called with bingo
+ """
+ f(*args, **kwargs)
+ return f
+
+
+class Throttler:
+ """Rate-limit a function (or other callable)."""
+
+ def __init__(self, func, max_rate=float('Inf')):
+ if isinstance(func, Throttler):
+ func = func.func
+ self.func = func
+ self.max_rate = max_rate
+ self.reset()
+
+ def reset(self):
+ self.last_called = 0
+
+ def __call__(self, *args, **kwargs):
+ self._wait()
+ return self.func(*args, **kwargs)
+
+ def _wait(self):
+ """Ensure at least 1/max_rate seconds from last call."""
+ elapsed = time.time() - self.last_called
+ must_wait = 1 / self.max_rate - elapsed
+ time.sleep(max(0, must_wait))
+ self.last_called = time.time()
+
+ def __get__(self, obj, owner=None):
+ return first_invoke(self._wait, functools.partial(self.func, obj))
+
+
+def first_invoke(func1, func2):
+ """
+ Return a function that when invoked will invoke func1 without
+ any parameters (for its side effect) and then invoke func2
+ with whatever parameters were passed, returning its result.
+ """
+
+ def wrapper(*args, **kwargs):
+ func1()
+ return func2(*args, **kwargs)
+
+ return wrapper
+
+
+method_caller = first_invoke(
+ lambda: warnings.warn(
+ '`jaraco.functools.method_caller` is deprecated, '
+ 'use `operator.methodcaller` instead',
+ DeprecationWarning,
+ stacklevel=3,
+ ),
+ operator.methodcaller,
+)
+
+
+def retry_call(func, cleanup=lambda: None, retries=0, trap=()):
+ """
+ Given a callable func, trap the indicated exceptions
+ for up to 'retries' times, invoking cleanup on the
+ exception. On the final attempt, allow any exceptions
+ to propagate.
+ """
+ attempts = itertools.count() if retries == float('inf') else range(retries)
+ for _ in attempts:
+ try:
+ return func()
+ except trap:
+ cleanup()
+
+ return func()
+
+
+def retry(*r_args, **r_kwargs):
+ """
+ Decorator wrapper for retry_call. Accepts arguments to retry_call
+ except func and then returns a decorator for the decorated function.
+
+ Ex:
+
+ >>> @retry(retries=3)
+ ... def my_func(a, b):
+ ... "this is my funk"
+ ... print(a, b)
+ >>> my_func.__doc__
+ 'this is my funk'
+ """
+
+ def decorate(func):
+ @functools.wraps(func)
+ def wrapper(*f_args, **f_kwargs):
+ bound = functools.partial(func, *f_args, **f_kwargs)
+ return retry_call(bound, *r_args, **r_kwargs)
+
+ return wrapper
+
+ return decorate
+
+
+def print_yielded(func):
+ """
+ Convert a generator into a function that prints all yielded elements.
+
+ >>> @print_yielded
+ ... def x():
+ ... yield 3; yield None
+ >>> x()
+ 3
+ None
+ """
+ print_all = functools.partial(map, print)
+ print_results = compose(more_itertools.consume, print_all, func)
+ return functools.wraps(func)(print_results)
+
+
+def pass_none(func):
+ """
+ Wrap func so it's not called if its first param is None.
+
+ >>> print_text = pass_none(print)
+ >>> print_text('text')
+ text
+ >>> print_text(None)
+ """
+
+ @functools.wraps(func)
+ def wrapper(param, /, *args, **kwargs):
+ if param is not None:
+ return func(param, *args, **kwargs)
+ return None
+
+ return wrapper
+
+
+def assign_params(func, namespace):
+ """
+ Assign parameters from namespace where func solicits.
+
+ >>> def func(x, y=3):
+ ... print(x, y)
+ >>> assigned = assign_params(func, dict(x=2, z=4))
+ >>> assigned()
+ 2 3
+
+ The usual errors are raised if a function doesn't receive
+ its required parameters:
+
+ >>> assigned = assign_params(func, dict(y=3, z=4))
+ >>> assigned()
+ Traceback (most recent call last):
+ TypeError: func() ...argument...
+
+ It even works on methods:
+
+ >>> class Handler:
+ ... def meth(self, arg):
+ ... print(arg)
+ >>> assign_params(Handler().meth, dict(arg='crystal', foo='clear'))()
+ crystal
+ """
+ sig = inspect.signature(func)
+ params = sig.parameters.keys()
+ call_ns = {k: namespace[k] for k in params if k in namespace}
+ return functools.partial(func, **call_ns)
+
+
+def save_method_args(method):
+ """
+ Wrap a method such that when it is called, the args and kwargs are
+ saved on the method.
+
+ >>> class MyClass:
+ ... @save_method_args
+ ... def method(self, a, b):
+ ... print(a, b)
+ >>> my_ob = MyClass()
+ >>> my_ob.method(1, 2)
+ 1 2
+ >>> my_ob._saved_method.args
+ (1, 2)
+ >>> my_ob._saved_method.kwargs
+ {}
+ >>> my_ob.method(a=3, b='foo')
+ 3 foo
+ >>> my_ob._saved_method.args
+ ()
+ >>> my_ob._saved_method.kwargs == dict(a=3, b='foo')
+ True
+
+ The arguments are stored on the instance, allowing for
+ different instance to save different args.
+
+ >>> your_ob = MyClass()
+ >>> your_ob.method({str('x'): 3}, b=[4])
+ {'x': 3} [4]
+ >>> your_ob._saved_method.args
+ ({'x': 3},)
+ >>> my_ob._saved_method.args
+ ()
+ """
+ args_and_kwargs = collections.namedtuple('args_and_kwargs', 'args kwargs')
+
+ @functools.wraps(method)
+ def wrapper(self, /, *args, **kwargs):
+ attr_name = '_saved_' + method.__name__
+ attr = args_and_kwargs(args, kwargs)
+ setattr(self, attr_name, attr)
+ return method(self, *args, **kwargs)
+
+ return wrapper
+
+
+def except_(*exceptions, replace=None, use=None):
+ """
+ Replace the indicated exceptions, if raised, with the indicated
+ literal replacement or evaluated expression (if present).
+
+ >>> safe_int = except_(ValueError)(int)
+ >>> safe_int('five')
+ >>> safe_int('5')
+ 5
+
+ Specify a literal replacement with ``replace``.
+
+ >>> safe_int_r = except_(ValueError, replace=0)(int)
+ >>> safe_int_r('five')
+ 0
+
+ Provide an expression to ``use`` to pass through particular parameters.
+
+ >>> safe_int_pt = except_(ValueError, use='args[0]')(int)
+ >>> safe_int_pt('five')
+ 'five'
+
+ """
+
+ def decorate(func):
+ @functools.wraps(func)
+ def wrapper(*args, **kwargs):
+ try:
+ return func(*args, **kwargs)
+ except exceptions:
+ try:
+ return eval(use)
+ except TypeError:
+ return replace
+
+ return wrapper
+
+ return decorate
+
+
+def identity(x):
+ """
+ Return the argument.
+
+ >>> o = object()
+ >>> identity(o) is o
+ True
+ """
+ return x
+
+
+def bypass_when(check, *, _op=identity):
+ """
+ Decorate a function to return its parameter when ``check``.
+
+ >>> bypassed = [] # False
+
+ >>> @bypass_when(bypassed)
+ ... def double(x):
+ ... return x * 2
+ >>> double(2)
+ 4
+ >>> bypassed[:] = [object()] # True
+ >>> double(2)
+ 2
+ """
+
+ def decorate(func):
+ @functools.wraps(func)
+ def wrapper(param, /):
+ return param if _op(check) else func(param)
+
+ return wrapper
+
+ return decorate
+
+
+def bypass_unless(check):
+ """
+ Decorate a function to return its parameter unless ``check``.
+
+ >>> enabled = [object()] # True
+
+ >>> @bypass_unless(enabled)
+ ... def double(x):
+ ... return x * 2
+ >>> double(2)
+ 4
+ >>> del enabled[:] # False
+ >>> double(2)
+ 2
+ """
+ return bypass_when(check, _op=operator.not_)
+
+
+@functools.singledispatch
+def _splat_inner(args, func):
+ """Splat args to func."""
+ return func(*args)
+
+
+@_splat_inner.register
+def _(args: collections.abc.Mapping, func):
+ """Splat kargs to func as kwargs."""
+ return func(**args)
+
+
+def splat(func):
+ """
+ Wrap func to expect its parameters to be passed positionally in a tuple.
+
+ Has a similar effect to that of ``itertools.starmap`` over
+ simple ``map``.
+
+ >>> pairs = [(-1, 1), (0, 2)]
+ >>> more_itertools.consume(itertools.starmap(print, pairs))
+ -1 1
+ 0 2
+ >>> more_itertools.consume(map(splat(print), pairs))
+ -1 1
+ 0 2
+
+ The approach generalizes to other iterators that don't have a "star"
+ equivalent, such as a "starfilter".
+
+ >>> list(filter(splat(operator.add), pairs))
+ [(0, 2)]
+
+ Splat also accepts a mapping argument.
+
+ >>> def is_nice(msg, code):
+ ... return "smile" in msg or code == 0
+ >>> msgs = [
+ ... dict(msg='smile!', code=20),
+ ... dict(msg='error :(', code=1),
+ ... dict(msg='unknown', code=0),
+ ... ]
+ >>> for msg in filter(splat(is_nice), msgs):
+ ... print(msg)
+ {'msg': 'smile!', 'code': 20}
+ {'msg': 'unknown', 'code': 0}
+ """
+ return functools.wraps(func)(functools.partial(_splat_inner, func=func))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..19191bf93eea22a55c8d47a57ec24de370caca27
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/__init__.pyi
@@ -0,0 +1,125 @@
+from collections.abc import Callable, Hashable, Iterator
+from functools import partial
+from operator import methodcaller
+import sys
+from typing import (
+ Any,
+ Generic,
+ Protocol,
+ TypeVar,
+ overload,
+)
+
+if sys.version_info >= (3, 10):
+ from typing import Concatenate, ParamSpec
+else:
+ from typing_extensions import Concatenate, ParamSpec
+
+_P = ParamSpec('_P')
+_R = TypeVar('_R')
+_T = TypeVar('_T')
+_R1 = TypeVar('_R1')
+_R2 = TypeVar('_R2')
+_V = TypeVar('_V')
+_S = TypeVar('_S')
+_R_co = TypeVar('_R_co', covariant=True)
+
+class _OnceCallable(Protocol[_P, _R]):
+ saved_result: _R
+ reset: Callable[[], None]
+ def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
+
+class _ProxyMethodCacheWrapper(Protocol[_R_co]):
+ cache_clear: Callable[[], None]
+ def __call__(self, *args: Hashable, **kwargs: Hashable) -> _R_co: ...
+
+class _MethodCacheWrapper(Protocol[_R_co]):
+ def cache_clear(self) -> None: ...
+ def __call__(self, *args: Hashable, **kwargs: Hashable) -> _R_co: ...
+
+# `compose()` overloads below will cover most use cases.
+
+@overload
+def compose(
+ __func1: Callable[[_R], _T],
+ __func2: Callable[_P, _R],
+ /,
+) -> Callable[_P, _T]: ...
+@overload
+def compose(
+ __func1: Callable[[_R], _T],
+ __func2: Callable[[_R1], _R],
+ __func3: Callable[_P, _R1],
+ /,
+) -> Callable[_P, _T]: ...
+@overload
+def compose(
+ __func1: Callable[[_R], _T],
+ __func2: Callable[[_R2], _R],
+ __func3: Callable[[_R1], _R2],
+ __func4: Callable[_P, _R1],
+ /,
+) -> Callable[_P, _T]: ...
+def once(func: Callable[_P, _R]) -> _OnceCallable[_P, _R]: ...
+def method_cache(
+ method: Callable[..., _R],
+ cache_wrapper: Callable[[Callable[..., _R]], _MethodCacheWrapper[_R]] = ...,
+) -> _MethodCacheWrapper[_R] | _ProxyMethodCacheWrapper[_R]: ...
+def apply(
+ transform: Callable[[_R], _T]
+) -> Callable[[Callable[_P, _R]], Callable[_P, _T]]: ...
+def result_invoke(
+ action: Callable[[_R], Any]
+) -> Callable[[Callable[_P, _R]], Callable[_P, _R]]: ...
+def invoke(
+ f: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs
+) -> Callable[_P, _R]: ...
+
+class Throttler(Generic[_R]):
+ last_called: float
+ func: Callable[..., _R]
+ max_rate: float
+ def __init__(
+ self, func: Callable[..., _R] | Throttler[_R], max_rate: float = ...
+ ) -> None: ...
+ def reset(self) -> None: ...
+ def __call__(self, *args: Any, **kwargs: Any) -> _R: ...
+ def __get__(self, obj: Any, owner: type[Any] | None = ...) -> Callable[..., _R]: ...
+
+def first_invoke(
+ func1: Callable[..., Any], func2: Callable[_P, _R]
+) -> Callable[_P, _R]: ...
+
+method_caller: Callable[..., methodcaller]
+
+def retry_call(
+ func: Callable[..., _R],
+ cleanup: Callable[..., None] = ...,
+ retries: int | float = ...,
+ trap: type[BaseException] | tuple[type[BaseException], ...] = ...,
+) -> _R: ...
+def retry(
+ cleanup: Callable[..., None] = ...,
+ retries: int | float = ...,
+ trap: type[BaseException] | tuple[type[BaseException], ...] = ...,
+) -> Callable[[Callable[..., _R]], Callable[..., _R]]: ...
+def print_yielded(func: Callable[_P, Iterator[Any]]) -> Callable[_P, None]: ...
+def pass_none(
+ func: Callable[Concatenate[_T, _P], _R]
+) -> Callable[Concatenate[_T, _P], _R]: ...
+def assign_params(
+ func: Callable[..., _R], namespace: dict[str, Any]
+) -> partial[_R]: ...
+def save_method_args(
+ method: Callable[Concatenate[_S, _P], _R]
+) -> Callable[Concatenate[_S, _P], _R]: ...
+def except_(
+ *exceptions: type[BaseException], replace: Any = ..., use: Any = ...
+) -> Callable[[Callable[_P, Any]], Callable[_P, Any]]: ...
+def identity(x: _T) -> _T: ...
+def bypass_when(
+ check: _V, *, _op: Callable[[_V], Any] = ...
+) -> Callable[[Callable[[_T], _R]], Callable[[_T], _T | _R]]: ...
+def bypass_unless(
+ check: Any,
+) -> Callable[[Callable[[_T], _R]], Callable[[_T], _T | _R]]: ...
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/py.typed b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/functools/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt
new file mode 100644
index 0000000000000000000000000000000000000000..986f944b60b9900c22464a0c027d713854cc204e
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt
@@ -0,0 +1,2 @@
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue, eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis, neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis, molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/__init__.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..0fabd0c3f036d47f2cd9b2a66828ba33a00ab7b3
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/__init__.py
@@ -0,0 +1,624 @@
+import re
+import itertools
+import textwrap
+import functools
+
+try:
+ from importlib.resources import files # type: ignore
+except ImportError: # pragma: nocover
+ from importlib_resources import files # type: ignore
+
+from jaraco.functools import compose, method_cache
+from jaraco.context import ExceptionTrap
+
+
+def substitution(old, new):
+ """
+ Return a function that will perform a substitution on a string
+ """
+ return lambda s: s.replace(old, new)
+
+
+def multi_substitution(*substitutions):
+ """
+ Take a sequence of pairs specifying substitutions, and create
+ a function that performs those substitutions.
+
+ >>> multi_substitution(('foo', 'bar'), ('bar', 'baz'))('foo')
+ 'baz'
+ """
+ substitutions = itertools.starmap(substitution, substitutions)
+ # compose function applies last function first, so reverse the
+ # substitutions to get the expected order.
+ substitutions = reversed(tuple(substitutions))
+ return compose(*substitutions)
+
+
+class FoldedCase(str):
+ """
+ A case insensitive string class; behaves just like str
+ except compares equal when the only variation is case.
+
+ >>> s = FoldedCase('hello world')
+
+ >>> s == 'Hello World'
+ True
+
+ >>> 'Hello World' == s
+ True
+
+ >>> s != 'Hello World'
+ False
+
+ >>> s.index('O')
+ 4
+
+ >>> s.split('O')
+ ['hell', ' w', 'rld']
+
+ >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
+ ['alpha', 'Beta', 'GAMMA']
+
+ Sequence membership is straightforward.
+
+ >>> "Hello World" in [s]
+ True
+ >>> s in ["Hello World"]
+ True
+
+ Allows testing for set inclusion, but candidate and elements
+ must both be folded.
+
+ >>> FoldedCase("Hello World") in {s}
+ True
+ >>> s in {FoldedCase("Hello World")}
+ True
+
+ String inclusion works as long as the FoldedCase object
+ is on the right.
+
+ >>> "hello" in FoldedCase("Hello World")
+ True
+
+ But not if the FoldedCase object is on the left:
+
+ >>> FoldedCase('hello') in 'Hello World'
+ False
+
+ In that case, use ``in_``:
+
+ >>> FoldedCase('hello').in_('Hello World')
+ True
+
+ >>> FoldedCase('hello') > FoldedCase('Hello')
+ False
+
+ >>> FoldedCase('ß') == FoldedCase('ss')
+ True
+ """
+
+ def __lt__(self, other):
+ return self.casefold() < other.casefold()
+
+ def __gt__(self, other):
+ return self.casefold() > other.casefold()
+
+ def __eq__(self, other):
+ return self.casefold() == other.casefold()
+
+ def __ne__(self, other):
+ return self.casefold() != other.casefold()
+
+ def __hash__(self):
+ return hash(self.casefold())
+
+ def __contains__(self, other):
+ return super().casefold().__contains__(other.casefold())
+
+ def in_(self, other):
+ "Does self appear in other?"
+ return self in FoldedCase(other)
+
+ # cache casefold since it's likely to be called frequently.
+ @method_cache
+ def casefold(self):
+ return super().casefold()
+
+ def index(self, sub):
+ return self.casefold().index(sub.casefold())
+
+ def split(self, splitter=' ', maxsplit=0):
+ pattern = re.compile(re.escape(splitter), re.I)
+ return pattern.split(self, maxsplit)
+
+
+# Python 3.8 compatibility
+_unicode_trap = ExceptionTrap(UnicodeDecodeError)
+
+
+@_unicode_trap.passes
+def is_decodable(value):
+ r"""
+ Return True if the supplied value is decodable (using the default
+ encoding).
+
+ >>> is_decodable(b'\xff')
+ False
+ >>> is_decodable(b'\x32')
+ True
+ """
+ value.decode()
+
+
+def is_binary(value):
+ r"""
+ Return True if the value appears to be binary (that is, it's a byte
+ string and isn't decodable).
+
+ >>> is_binary(b'\xff')
+ True
+ >>> is_binary('\xff')
+ False
+ """
+ return isinstance(value, bytes) and not is_decodable(value)
+
+
+def trim(s):
+ r"""
+ Trim something like a docstring to remove the whitespace that
+ is common due to indentation and formatting.
+
+ >>> trim("\n\tfoo = bar\n\t\tbar = baz\n")
+ 'foo = bar\n\tbar = baz'
+ """
+ return textwrap.dedent(s).strip()
+
+
+def wrap(s):
+ """
+ Wrap lines of text, retaining existing newlines as
+ paragraph markers.
+
+ >>> print(wrap(lorem_ipsum))
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
+ eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
+ minim veniam, quis nostrud exercitation ullamco laboris nisi ut
+ aliquip ex ea commodo consequat. Duis aute irure dolor in
+ reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
+ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
+ culpa qui officia deserunt mollit anim id est laborum.
+
+ Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam
+ varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus
+ magna felis sollicitudin mauris. Integer in mauris eu nibh euismod
+ gravida. Duis ac tellus et risus vulputate vehicula. Donec lobortis
+ risus a elit. Etiam tempor. Ut ullamcorper, ligula eu tempor congue,
+ eros est euismod turpis, id tincidunt sapien risus a quam. Maecenas
+ fermentum consequat mi. Donec fermentum. Pellentesque malesuada nulla
+ a mi. Duis sapien sem, aliquet nec, commodo eget, consequat quis,
+ neque. Aliquam faucibus, elit ut dictum aliquet, felis nisl adipiscing
+ sapien, sed malesuada diam lacus eget erat. Cras mollis scelerisque
+ nunc. Nullam arcu. Aliquam consequat. Curabitur augue lorem, dapibus
+ quis, laoreet et, pretium ac, nisi. Aenean magna nisl, mollis quis,
+ molestie eu, feugiat in, orci. In hac habitasse platea dictumst.
+ """
+ paragraphs = s.splitlines()
+ wrapped = ('\n'.join(textwrap.wrap(para)) for para in paragraphs)
+ return '\n\n'.join(wrapped)
+
+
+def unwrap(s):
+ r"""
+ Given a multi-line string, return an unwrapped version.
+
+ >>> wrapped = wrap(lorem_ipsum)
+ >>> wrapped.count('\n')
+ 20
+ >>> unwrapped = unwrap(wrapped)
+ >>> unwrapped.count('\n')
+ 1
+ >>> print(unwrapped)
+ Lorem ipsum dolor sit amet, consectetur adipiscing ...
+ Curabitur pretium tincidunt lacus. Nulla gravida orci ...
+
+ """
+ paragraphs = re.split(r'\n\n+', s)
+ cleaned = (para.replace('\n', ' ') for para in paragraphs)
+ return '\n'.join(cleaned)
+
+
+lorem_ipsum: str = (
+ files(__name__).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8')
+)
+
+
+class Splitter:
+ """object that will split a string with the given arguments for each call
+
+ >>> s = Splitter(',')
+ >>> s('hello, world, this is your, master calling')
+ ['hello', ' world', ' this is your', ' master calling']
+ """
+
+ def __init__(self, *args):
+ self.args = args
+
+ def __call__(self, s):
+ return s.split(*self.args)
+
+
+def indent(string, prefix=' ' * 4):
+ """
+ >>> indent('foo')
+ ' foo'
+ """
+ return prefix + string
+
+
+class WordSet(tuple):
+ """
+ Given an identifier, return the words that identifier represents,
+ whether in camel case, underscore-separated, etc.
+
+ >>> WordSet.parse("camelCase")
+ ('camel', 'Case')
+
+ >>> WordSet.parse("under_sep")
+ ('under', 'sep')
+
+ Acronyms should be retained
+
+ >>> WordSet.parse("firstSNL")
+ ('first', 'SNL')
+
+ >>> WordSet.parse("you_and_I")
+ ('you', 'and', 'I')
+
+ >>> WordSet.parse("A simple test")
+ ('A', 'simple', 'test')
+
+ Multiple caps should not interfere with the first cap of another word.
+
+ >>> WordSet.parse("myABCClass")
+ ('my', 'ABC', 'Class')
+
+ The result is a WordSet, providing access to other forms.
+
+ >>> WordSet.parse("myABCClass").underscore_separated()
+ 'my_ABC_Class'
+
+ >>> WordSet.parse('a-command').camel_case()
+ 'ACommand'
+
+ >>> WordSet.parse('someIdentifier').lowered().space_separated()
+ 'some identifier'
+
+ Slices of the result should return another WordSet.
+
+ >>> WordSet.parse('taken-out-of-context')[1:].underscore_separated()
+ 'out_of_context'
+
+ >>> WordSet.from_class_name(WordSet()).lowered().space_separated()
+ 'word set'
+
+ >>> example = WordSet.parse('figured it out')
+ >>> example.headless_camel_case()
+ 'figuredItOut'
+ >>> example.dash_separated()
+ 'figured-it-out'
+
+ """
+
+ _pattern = re.compile('([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))')
+
+ def capitalized(self):
+ return WordSet(word.capitalize() for word in self)
+
+ def lowered(self):
+ return WordSet(word.lower() for word in self)
+
+ def camel_case(self):
+ return ''.join(self.capitalized())
+
+ def headless_camel_case(self):
+ words = iter(self)
+ first = next(words).lower()
+ new_words = itertools.chain((first,), WordSet(words).camel_case())
+ return ''.join(new_words)
+
+ def underscore_separated(self):
+ return '_'.join(self)
+
+ def dash_separated(self):
+ return '-'.join(self)
+
+ def space_separated(self):
+ return ' '.join(self)
+
+ def trim_right(self, item):
+ """
+ Remove the item from the end of the set.
+
+ >>> WordSet.parse('foo bar').trim_right('foo')
+ ('foo', 'bar')
+ >>> WordSet.parse('foo bar').trim_right('bar')
+ ('foo',)
+ >>> WordSet.parse('').trim_right('bar')
+ ()
+ """
+ return self[:-1] if self and self[-1] == item else self
+
+ def trim_left(self, item):
+ """
+ Remove the item from the beginning of the set.
+
+ >>> WordSet.parse('foo bar').trim_left('foo')
+ ('bar',)
+ >>> WordSet.parse('foo bar').trim_left('bar')
+ ('foo', 'bar')
+ >>> WordSet.parse('').trim_left('bar')
+ ()
+ """
+ return self[1:] if self and self[0] == item else self
+
+ def trim(self, item):
+ """
+ >>> WordSet.parse('foo bar').trim('foo')
+ ('bar',)
+ """
+ return self.trim_left(item).trim_right(item)
+
+ def __getitem__(self, item):
+ result = super().__getitem__(item)
+ if isinstance(item, slice):
+ result = WordSet(result)
+ return result
+
+ @classmethod
+ def parse(cls, identifier):
+ matches = cls._pattern.finditer(identifier)
+ return WordSet(match.group(0) for match in matches)
+
+ @classmethod
+ def from_class_name(cls, subject):
+ return cls.parse(subject.__class__.__name__)
+
+
+# for backward compatibility
+words = WordSet.parse
+
+
+def simple_html_strip(s):
+ r"""
+ Remove HTML from the string `s`.
+
+ >>> str(simple_html_strip(''))
+ ''
+
+ >>> print(simple_html_strip('A stormy day in paradise'))
+ A stormy day in paradise
+
+ >>> print(simple_html_strip('Somebody tell the truth.'))
+ Somebody tell the truth.
+
+ >>> print(simple_html_strip('What about
\nmultiple lines?'))
+ What about
+ multiple lines?
+ """
+ html_stripper = re.compile('()|(<[^>]*>)|([^<]+)', re.DOTALL)
+ texts = (match.group(3) or '' for match in html_stripper.finditer(s))
+ return ''.join(texts)
+
+
+class SeparatedValues(str):
+ """
+ A string separated by a separator. Overrides __iter__ for getting
+ the values.
+
+ >>> list(SeparatedValues('a,b,c'))
+ ['a', 'b', 'c']
+
+ Whitespace is stripped and empty values are discarded.
+
+ >>> list(SeparatedValues(' a, b , c, '))
+ ['a', 'b', 'c']
+ """
+
+ separator = ','
+
+ def __iter__(self):
+ parts = self.split(self.separator)
+ return filter(None, (part.strip() for part in parts))
+
+
+class Stripper:
+ r"""
+ Given a series of lines, find the common prefix and strip it from them.
+
+ >>> lines = [
+ ... 'abcdefg\n',
+ ... 'abc\n',
+ ... 'abcde\n',
+ ... ]
+ >>> res = Stripper.strip_prefix(lines)
+ >>> res.prefix
+ 'abc'
+ >>> list(res.lines)
+ ['defg\n', '\n', 'de\n']
+
+ If no prefix is common, nothing should be stripped.
+
+ >>> lines = [
+ ... 'abcd\n',
+ ... '1234\n',
+ ... ]
+ >>> res = Stripper.strip_prefix(lines)
+ >>> res.prefix = ''
+ >>> list(res.lines)
+ ['abcd\n', '1234\n']
+ """
+
+ def __init__(self, prefix, lines):
+ self.prefix = prefix
+ self.lines = map(self, lines)
+
+ @classmethod
+ def strip_prefix(cls, lines):
+ prefix_lines, lines = itertools.tee(lines)
+ prefix = functools.reduce(cls.common_prefix, prefix_lines)
+ return cls(prefix, lines)
+
+ def __call__(self, line):
+ if not self.prefix:
+ return line
+ null, prefix, rest = line.partition(self.prefix)
+ return rest
+
+ @staticmethod
+ def common_prefix(s1, s2):
+ """
+ Return the common prefix of two lines.
+ """
+ index = min(len(s1), len(s2))
+ while s1[:index] != s2[:index]:
+ index -= 1
+ return s1[:index]
+
+
+def remove_prefix(text, prefix):
+ """
+ Remove the prefix from the text if it exists.
+
+ >>> remove_prefix('underwhelming performance', 'underwhelming ')
+ 'performance'
+
+ >>> remove_prefix('something special', 'sample')
+ 'something special'
+ """
+ null, prefix, rest = text.rpartition(prefix)
+ return rest
+
+
+def remove_suffix(text, suffix):
+ """
+ Remove the suffix from the text if it exists.
+
+ >>> remove_suffix('name.git', '.git')
+ 'name'
+
+ >>> remove_suffix('something special', 'sample')
+ 'something special'
+ """
+ rest, suffix, null = text.partition(suffix)
+ return rest
+
+
+def normalize_newlines(text):
+ r"""
+ Replace alternate newlines with the canonical newline.
+
+ >>> normalize_newlines('Lorem Ipsum\u2029')
+ 'Lorem Ipsum\n'
+ >>> normalize_newlines('Lorem Ipsum\r\n')
+ 'Lorem Ipsum\n'
+ >>> normalize_newlines('Lorem Ipsum\x85')
+ 'Lorem Ipsum\n'
+ """
+ newlines = ['\r\n', '\r', '\n', '\u0085', '\u2028', '\u2029']
+ pattern = '|'.join(newlines)
+ return re.sub(pattern, '\n', text)
+
+
+def _nonblank(str):
+ return str and not str.startswith('#')
+
+
+@functools.singledispatch
+def yield_lines(iterable):
+ r"""
+ Yield valid lines of a string or iterable.
+
+ >>> list(yield_lines(''))
+ []
+ >>> list(yield_lines(['foo', 'bar']))
+ ['foo', 'bar']
+ >>> list(yield_lines('foo\nbar'))
+ ['foo', 'bar']
+ >>> list(yield_lines('\nfoo\n#bar\nbaz #comment'))
+ ['foo', 'baz #comment']
+ >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n']))
+ ['foo', 'bar', 'baz', 'bing']
+ """
+ return itertools.chain.from_iterable(map(yield_lines, iterable))
+
+
+@yield_lines.register(str)
+def _(text):
+ return filter(_nonblank, map(str.strip, text.splitlines()))
+
+
+def drop_comment(line):
+ """
+ Drop comments.
+
+ >>> drop_comment('foo # bar')
+ 'foo'
+
+ A hash without a space may be in a URL.
+
+ >>> drop_comment('http://example.com/foo#bar')
+ 'http://example.com/foo#bar'
+ """
+ return line.partition(' #')[0]
+
+
+def join_continuation(lines):
+ r"""
+ Join lines continued by a trailing backslash.
+
+ >>> list(join_continuation(['foo \\', 'bar', 'baz']))
+ ['foobar', 'baz']
+ >>> list(join_continuation(['foo \\', 'bar', 'baz']))
+ ['foobar', 'baz']
+ >>> list(join_continuation(['foo \\', 'bar \\', 'baz']))
+ ['foobarbaz']
+
+ Not sure why, but...
+ The character preceding the backslash is also elided.
+
+ >>> list(join_continuation(['goo\\', 'dly']))
+ ['godly']
+
+ A terrible idea, but...
+ If no line is available to continue, suppress the lines.
+
+ >>> list(join_continuation(['foo', 'bar\\', 'baz\\']))
+ ['foo']
+ """
+ lines = iter(lines)
+ for item in lines:
+ while item.endswith('\\'):
+ try:
+ item = item[:-2].strip() + next(lines)
+ except StopIteration:
+ return
+ yield item
+
+
+def read_newlines(filename, limit=1024):
+ r"""
+ >>> tmp_path = getfixture('tmp_path')
+ >>> filename = tmp_path / 'out.txt'
+ >>> _ = filename.write_text('foo\n', newline='', encoding='utf-8')
+ >>> read_newlines(filename)
+ '\n'
+ >>> _ = filename.write_text('foo\r\n', newline='', encoding='utf-8')
+ >>> read_newlines(filename)
+ '\r\n'
+ >>> _ = filename.write_text('foo\r\nbar\nbing\r', newline='', encoding='utf-8')
+ >>> read_newlines(filename)
+ ('\r', '\n', '\r\n')
+ """
+ with open(filename, encoding='utf-8') as fp:
+ fp.read(limit)
+ return fp.newlines
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/layouts.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/layouts.py
new file mode 100644
index 0000000000000000000000000000000000000000..9636f0f7b53cb4d1ea5842e1eb62c998ddb91070
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/layouts.py
@@ -0,0 +1,25 @@
+qwerty = "-=qwertyuiop[]asdfghjkl;'zxcvbnm,./_+QWERTYUIOP{}ASDFGHJKL:\"ZXCVBNM<>?"
+dvorak = "[]',.pyfgcrl/=aoeuidhtns-;qjkxbmwvz{}\"<>PYFGCRL?+AOEUIDHTNS_:QJKXBMWVZ"
+
+
+to_dvorak = str.maketrans(qwerty, dvorak)
+to_qwerty = str.maketrans(dvorak, qwerty)
+
+
+def translate(input, translation):
+ """
+ >>> translate('dvorak', to_dvorak)
+ 'ekrpat'
+ >>> translate('qwerty', to_qwerty)
+ 'x,dokt'
+ """
+ return input.translate(translation)
+
+
+def _translate_stream(stream, translation):
+ """
+ >>> import io
+ >>> _translate_stream(io.StringIO('foo'), to_dvorak)
+ urr
+ """
+ print(translate(stream.read(), translation))
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/show-newlines.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/show-newlines.py
new file mode 100644
index 0000000000000000000000000000000000000000..e11d1ba4280e9a882ca788c27f56034e90987004
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/show-newlines.py
@@ -0,0 +1,33 @@
+import autocommand
+import inflect
+
+from more_itertools import always_iterable
+
+import jaraco.text
+
+
+def report_newlines(filename):
+ r"""
+ Report the newlines in the indicated file.
+
+ >>> tmp_path = getfixture('tmp_path')
+ >>> filename = tmp_path / 'out.txt'
+ >>> _ = filename.write_text('foo\nbar\n', newline='', encoding='utf-8')
+ >>> report_newlines(filename)
+ newline is '\n'
+ >>> filename = tmp_path / 'out.txt'
+ >>> _ = filename.write_text('foo\nbar\r\n', newline='', encoding='utf-8')
+ >>> report_newlines(filename)
+ newlines are ('\n', '\r\n')
+ """
+ newlines = jaraco.text.read_newlines(filename)
+ count = len(tuple(always_iterable(newlines)))
+ engine = inflect.engine()
+ print(
+ engine.plural_noun("newline", count),
+ engine.plural_verb("is", count),
+ repr(newlines),
+ )
+
+
+autocommand.autocommand(__name__)(report_newlines)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/strip-prefix.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/strip-prefix.py
new file mode 100644
index 0000000000000000000000000000000000000000..761717a9b9e1f837eeacf0e888822f6fad881361
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/strip-prefix.py
@@ -0,0 +1,21 @@
+import sys
+
+import autocommand
+
+from jaraco.text import Stripper
+
+
+def strip_prefix():
+ r"""
+ Strip any common prefix from stdin.
+
+ >>> import io, pytest
+ >>> getfixture('monkeypatch').setattr('sys.stdin', io.StringIO('abcdef\nabc123'))
+ >>> strip_prefix()
+ def
+ 123
+ """
+ sys.stdout.writelines(Stripper.strip_prefix(sys.stdin).lines)
+
+
+autocommand.autocommand(__name__)(strip_prefix)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/to-dvorak.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/to-dvorak.py
new file mode 100644
index 0000000000000000000000000000000000000000..a6d5da80b3b565b956b523a5e0aaea7b6274cfcb
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/to-dvorak.py
@@ -0,0 +1,6 @@
+import sys
+
+from . import layouts
+
+
+__name__ == '__main__' and layouts._translate_stream(sys.stdin, layouts.to_dvorak)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/to-qwerty.py b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/to-qwerty.py
new file mode 100644
index 0000000000000000000000000000000000000000..abe27286629cd3c1d95a984ad4a172957927af9b
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/jaraco/text/to-qwerty.py
@@ -0,0 +1,6 @@
+import sys
+
+from . import layouts
+
+
+__name__ == '__main__' and layouts._translate_stream(sys.stdin, layouts.to_qwerty)
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/INSTALLER b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/LICENSE b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..0a523bece3e50519653c4d7a38399baa487fefa1
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Erik Rose
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/METADATA b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..fb41b0cfe69bd01a045de31597a3f6d176604d25
--- /dev/null
+++ b/Scripts_RSCM_sim_growth_n_climate_to_Yield/.venv/lib/python3.10/site-packages/setuptools/_vendor/more_itertools-10.3.0.dist-info/METADATA
@@ -0,0 +1,266 @@
+Metadata-Version: 2.1
+Name: more-itertools
+Version: 10.3.0
+Summary: More routines for operating on iterables, beyond itertools
+Keywords: itertools,iterator,iteration,filter,peek,peekable,chunk,chunked
+Author-email: Erik Rose
+Requires-Python: >=3.8
+Description-Content-Type: text/x-rst
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Natural Language :: English
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3 :: Only
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Topic :: Software Development :: Libraries
+Project-URL: Homepage, https://github.com/more-itertools/more-itertools
+
+==============
+More Itertools
+==============
+
+.. image:: https://readthedocs.org/projects/more-itertools/badge/?version=latest
+ :target: https://more-itertools.readthedocs.io/en/stable/
+
+Python's ``itertools`` library is a gem - you can compose elegant solutions
+for a variety of problems with the functions it provides. In ``more-itertools``
+we collect additional building blocks, recipes, and routines for working with
+Python iterables.
+
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Grouping | `chunked `_, |
+| | `ichunked `_, |
+| | `chunked_even `_, |
+| | `sliced `_, |
+| | `constrained_batches `_, |
+| | `distribute `_, |
+| | `divide `_, |
+| | `split_at `_, |
+| | `split_before `_, |
+| | `split_after `_, |
+| | `split_into `_, |
+| | `split_when `_, |
+| | `bucket `_, |
+| | `unzip `_, |
+| | `batched `_, |
+| | `grouper `_, |
+| | `partition `_, |
+| | `transpose `_ |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Lookahead and lookback | `spy `_, |
+| | `peekable `_, |
+| | `seekable `_ |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Windowing | `windowed `_, |
+| | `substrings `_, |
+| | `substrings_indexes `_, |
+| | `stagger `_, |
+| | `windowed_complete `_, |
+| | `pairwise `_, |
+| | `triplewise `_, |
+| | `sliding_window `_, |
+| | `subslices `_ |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Augmenting | `count_cycle `_, |
+| | `intersperse `_, |
+| | `padded `_, |
+| | `repeat_each `_, |
+| | `mark_ends `_, |
+| | `repeat_last `_, |
+| | `adjacent `_, |
+| | `groupby_transform `_, |
+| | `pad_none `_, |
+| | `ncycles `_ |
++------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+| Combining | `collapse `_, |
+| | `sort_together `_, |
+| | `interleave `_, |
+| | `interleave_longest `_, |
+| | `interleave_evenly `_, |
+| | `zip_offset `_, |
+| | `zip_equal `_, |
+| | `zip_broadcast `_, |
+| | `flatten `_, |
+| | `roundrobin