Skip to content

Instantly share code, notes, and snippets.

Avatar
🛰️

Matthew Barber honno

🛰️
View GitHub Profile
View old_hypothesis_api_version_inferrence.py
def make_strategies_namespace(
xp: Any, *, api_version: Optional[NominalVersion] = None
) -> SimpleNamespace:
...
if api_version is None:
# When api_version=None, we infer the most recent API version for which
# the passed xp is valid. We go through the released versions in
# descending order, passing them to x.__array_namespace__() until no
# errors are raised, thus inferring that specific api_version is
# supported. If errors are raised for all released versions, we raise
View mvp_compliance_reporting.md

A table which lists every function/method. A table which lists every function/method.

data-apis.org/array-api/latest/compliance-table

Pick a library and version:   numpy ▼   1.27.0 ▼

    abs                      🟢
    acos                     🟢
 add 🟡 ▶
@honno
honno / details_summary.md
Created Jun 14, 2022
Using `<details>` for code blocks
View details_summary.md
Summary text
your code
@honno
honno / get_mod.py
Created Feb 8, 2022
Get module via path
View get_mod.py
from importlib.util import spec_from_file_location, module_from_spec
from pathlib import Path
from types import ModuleType
def get_mod(path: Path) -> ModuleType:
mod_name = path.name.replace(".py", "")
spec = spec_from_file_location(mod_name, path)
assert spec is not None
mod = module_from_spec(spec)
assert spec.loader is not None
View _mxnet.py
# Wrapper of mxnet for use with github.com/data-apis/array-api-tests
# Tested with dask version 1.9.0
# How to use:
# 1. Place this file in `array_api_tests/_mxnet.py`
# 2. In `array_api_tests/_array_module.py` replace `array_module = None` with
# `from ._mxnet import array_module`
import mxnet as mx
View _dask.py
# Wrapper of dask for use with github.com/data-apis/array-api-tests
# Tested with dask version 2022.01.0
# How to use:
# 1. Place this file in `array_api_tests/_dask.py`
# 2. In `array_api_tests/_array_module.py` replace `array_module = None` with
# `from ._dask import array_module`
from dask import array as da
View test_benchmark.py
#!/usr/bin/env python
import pytest
from hypothesis import assume, given, strategies as st
from hypothesis.errors import InvalidArgument
from hypothesis.extra.array_api import DTYPE_NAMES, NUMERIC_NAMES
from tests.array_api.common import COMPLIANT_XP, xp, xps
from tests.common.debug import find_any, minimal
from tests.common.utils import fails_with, flaky
View hypothesis-array-api.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View wip_hypothesis_array_api_demo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View health_check_problems.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.