instance_id
stringlengths 10
57
| base_commit
stringlengths 40
40
| created_at
stringdate 2014-04-30 14:58:36
2025-04-30 20:14:11
| environment_setup_commit
stringlengths 40
40
| hints_text
stringlengths 0
273k
| patch
stringlengths 251
7.06M
| problem_statement
stringlengths 11
52.5k
| repo
stringlengths 7
53
| test_patch
stringlengths 231
997k
| meta
dict | version
stringclasses 851
values | install_config
dict | requirements
stringlengths 93
34.2k
⌀ | environment
stringlengths 760
20.5k
⌀ | FAIL_TO_PASS
listlengths 1
9.39k
| FAIL_TO_FAIL
listlengths 0
2.69k
| PASS_TO_PASS
listlengths 0
7.87k
| PASS_TO_FAIL
listlengths 0
192
| license_name
stringclasses 55
values | __index_level_0__
int64 0
21.4k
| before_filepaths
listlengths 1
105
| after_filepaths
listlengths 1
105
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tox-dev__tox-1046
|
1eccb2042dd96a08e8a2684945c811bf5c32402f
|
2018-10-09 07:59:22
|
b84efc8f1074351bbba7e226d629d9114e0cc1a4
|
diff --git a/docs/changelog/1042.bugfix.rst b/docs/changelog/1042.bugfix.rst
new file mode 100644
index 00000000..53bde7e2
--- /dev/null
+++ b/docs/changelog/1042.bugfix.rst
@@ -0,0 +1,4 @@
+session packages are now put inside a numbered directory (instead of prefix numbering it,
+because pip fails when wheels are not named according to
+`PEP-491 <https://www.python.org/dev/peps/pep-0491/#id9>`_, and prefix numbering messes with this)
+- by user:`gaborbernat`
diff --git a/src/tox/package.py b/src/tox/package.py
index 29548c65..45c88829 100644
--- a/src/tox/package.py
+++ b/src/tox/package.py
@@ -55,24 +55,30 @@ def create_session_view(package, temp_dir, report):
"""
if not package:
return package
- temp_dir.ensure(dir=True)
+ package_dir = temp_dir.join("package")
+ package_dir.ensure(dir=True)
- # we'll prefix it with a unique number, note adding as suffix can cause conflicts
- # with tools that check the files extension (e.g. pip)
- exists = [
- i.basename[: -len(package.basename) - 1]
- for i in temp_dir.listdir(fil="*-{}".format(package.basename))
- ]
+ # we'll number the active instances, and use the max value as session folder for a new build
+ # note we cannot change package names as PEP-491 (wheel binary format)
+ # is strict about file name structure
+ exists = [i.basename for i in package_dir.listdir()]
file_id = max(chain((0,), (int(i) for i in exists if six.text_type(i).isnumeric())))
- session_package = temp_dir.join("{}-{}".format(file_id + 1, package.basename))
+
+ session_dir = package_dir.join(str(file_id + 1))
+ session_dir.ensure(dir=True)
+ session_package = session_dir.join(package.basename)
# if we can do hard links do that, otherwise just copy
- operation = "links"
+ links = False
if hasattr(os, "link"):
- os.link(str(package), str(session_package))
- else:
- operation = "copied"
+ try:
+ os.link(str(package), str(session_package))
+ links = True
+ except (OSError, NotImplementedError):
+ pass
+ if not links:
package.copy(session_package)
+ operation = "links" if links else "copied"
common = session_package.common(package)
report.verbosity1(
"package {} {} to {} ({})".format(
diff --git a/src/tox/session.py b/src/tox/session.py
index 4fb7cb8d..f847aff1 100644
--- a/src/tox/session.py
+++ b/src/tox/session.py
@@ -459,6 +459,7 @@ class Session:
):
self.report.verbosity2("cleanup {}".format(tox_env.package))
tox_env.package.remove()
+ py.path.local(tox_env.package.dirname).remove(ignore_errors=True)
def _copyfiles(self, srcdir, pathlist, destdir):
for relpath in pathlist:
|
Testing with `--installpkg somewheel.whl` broken (Regression in 3.5.0)
Tox 3.5.0 seems to break my Travis tests for Prequ. I have set the Travis configuration so that it runs `python setup.py bdist_wheel` and then runs as `tox -v --installpkg dist/*.whl`. This worked fine with earlier Tox versions (<=3.4.0).
With Tox 3.5.0 my Travis job started to break with an exception raised from this line:
https://github.com/tox-dev/tox/blob/5f2535f1a697fe4bfbec571407a742615b410e24/src/tox/package.py#L64
The exception was `AttributeError: 'str' object has no attribute 'basename'`. Full trace back is available in the build log: https://travis-ci.org/suutari/prequ/jobs/438550460
I think the error happens because `acquire_package` returns a bare `str` if `--instalpkg` is used, but otherwise it seems to return a `_path.local.LocalPath` instance. The failing code in `create_session_view` seems to assume (since commit 6538f74fd7) that the `package` is a a rich `Path` object rather than bare string.
|
tox-dev/tox
|
diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py
index e4c39a48..46014b5b 100644
--- a/tests/unit/test_package.py
+++ b/tests/unit/test_package.py
@@ -54,13 +54,13 @@ def test_make_sdist_distshare(tmpdir, initproj):
package, dist = get_package(session)
assert package.check()
assert package.ext == ".zip"
- assert package == config.temp_dir.join(package.basename)
+ assert package == config.temp_dir.join("package", "1", package.basename)
- assert dist == config.distdir.join(package.basename[len("1-") :])
+ assert dist == config.distdir.join(package.basename)
assert dist.check()
assert os.stat(str(dist)).st_ino == os.stat(str(package)).st_ino
- sdist_share = config.distshare.join(package.basename[len("1-") :])
+ sdist_share = config.distshare.join(package.basename)
assert sdist_share.check()
assert sdist_share.read("rb") == dist.read("rb"), (sdist_share, package)
@@ -126,7 +126,7 @@ def test_separate_sdist(cmd, initproj, tmpdir):
assert msg in result.out, result.out
operation = "copied" if not hasattr(os, "link") else "links"
msg = "package {} {} to {}".format(
- os.sep.join(("pkg123", ".tox", ".tmp", "1-pkg123-0.7.zip")),
+ os.sep.join(("pkg123", ".tox", ".tmp", "package", "1", "pkg123-0.7.zip")),
operation,
os.sep.join(("distshare", "pkg123-0.7.zip")),
)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 2
}
|
3.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-mock pytest-xdist"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
distlib==0.3.9
execnet==1.9.0
filelock==3.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
packaging==21.3
platformdirs==2.4.0
pluggy==0.13.1
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
six==1.17.0
toml==0.10.2
tomli==1.2.3
-e git+https://github.com/tox-dev/tox.git@1eccb2042dd96a08e8a2684945c811bf5c32402f#egg=tox
typing_extensions==4.1.1
virtualenv==20.17.1
zipp==3.6.0
|
name: tox
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- distlib==0.3.9
- execnet==1.9.0
- filelock==3.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- packaging==21.3
- platformdirs==2.4.0
- pluggy==0.13.1
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- six==1.17.0
- toml==0.10.2
- tomli==1.2.3
- typing-extensions==4.1.1
- virtualenv==20.17.1
- zipp==3.6.0
prefix: /opt/conda/envs/tox
|
[
"tests/unit/test_package.py::test_make_sdist_distshare",
"tests/unit/test_package.py::test_separate_sdist"
] |
[
"tests/unit/test_package.py::test_package_isolated_toml_no_build_system",
"tests/unit/test_package.py::test_package_isolated_toml_no_requires",
"tests/unit/test_package.py::test_package_isolated_toml_no_backend",
"tests/unit/test_package.py::test_package_isolated_toml_bad_requires",
"tests/unit/test_package.py::test_package_isolated_toml_bad_backend"
] |
[
"tests/unit/test_package.py::test_make_sdist",
"tests/unit/test_package.py::test_sdistonly",
"tests/unit/test_package.py::test_separate_sdist_no_sdistfile",
"tests/unit/test_package.py::test_sdist_latest",
"tests/unit/test_package.py::test_installpkg",
"tests/unit/test_package.py::test_package_isolated_no_pyproject_toml",
"tests/unit/test_package.py::test_dist_exists_version_change",
"tests/unit/test_package.py::test_tox_parallel_build_safe",
"tests/unit/test_package.py::test_install_via_installpkg"
] |
[] |
MIT License
| 3,204 |
[
"docs/changelog/1042.bugfix.rst",
"src/tox/package.py",
"src/tox/session.py"
] |
[
"docs/changelog/1042.bugfix.rst",
"src/tox/package.py",
"src/tox/session.py"
] |
|
pydicom__pydicom-761
|
60bc71e1501bc8345f48f073f2dd56e9444ee780
|
2018-10-09 08:14:10
|
a3a7986a93e203bcf04da5e2f8668366f852b6f8
|
pep8speaks: Hello @erikced! Thanks for submitting the PR.
- There are no PEP8 issues in the file [`pydicom/pixel_data_handlers/gdcm_handler.py`](https://github.com/erikced/pydicom/blob/e352c46771e28ee060aefd569c16bc209b9594d1/pydicom/pixel_data_handlers/gdcm_handler.py) !
scaramallion: It's a good proposal but it breaks support for released GDCM versions, which will be what most of our GDCM-using users use (hah), and it fails our unit tests. Can you modify the PR to support both the `Image` and `ImageReader` usages?
I'd also prefer unit test coverage (and docstrings) for the functions you split out since it'll save me some work later when I get to refactoring the testing for the GDCM handler.
There's also a `get_expected_length` function in the numpy handler that would be nice if it were used here (since it already has good test coverage). If you could move the function to `pixel_data_handlers.util` that'd be great since I was intending to do it myself in the next refactor.
erikced: Sure, it doesn't seem like too much work. Supporting both `ImageReader` and `Image` directly seems like a good way to support current and new GDCM releases (I never expected this to be merged due to the pre-release GDCM requirement) and it shold be relatively easy as the readout is identical.
scaramallion: Can you outline how you're compiling the current GDCM master for use with python? I'd be nice to add a build to Travis so your changes can be tested.
erikced: > Can you outline how you're compiling the current GDCM master for use with python? I'd be nice to add a build to Travis so your changes can be tested.
Hah, gdcm 2.8.8 which contains the required patch was just (as in between your comment and now) released. Building requires `cmake` and `swig`, to build and install:
* Download and extract https://github.com/malaterre/GDCM/archive/v2.8.8.tar.gz
* Create an out-of-source build directory and enter it
* Configure & build: `cmake -DGDCM_WRAP_PYTHON:BOOL=ON -DGDCM_BUILD_DOCBOOK_MANPAGES:BOOL=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON /path/to/gdcm && make`
* Copy relevant artifacts: `cp bin/{gdcm.py,gdcmswig.py,_gdcmswig.so} /path/to/python/site-packages/`
Position independent code may or may not be required, to direct `cmake` to the correct python headers and libraries it may be required to add something similar to `-DPYTHON_INCLUDE_DIR:FILEPATH=~/.pyenv/versions/3.6.2/include/python3.6m` `-DPYTHON_LIBRARY:FILEPATH=~/.pyenv/versions/3.6.2/lib/libpython3.6m.so` to the `cmake` step.
scaramallion: It would be nice. I'll see if I can get a Travis build going and fix that conflict
scaramallion: Actually it looks like 2.8.8 is available on conda now anyway.
scaramallion: Codecov is having issues but looking at the report the coverage should increase.
@darcymason @mrbean-bremen anything else?
|
diff --git a/.travis.yml b/.travis.yml
index b9f98b9db..2c6b33f7d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -43,6 +43,7 @@ matrix:
- env: DISTRIB="conda" PYTHON_VERSION="3.6" NUMPY=true PILLOW=both JPEG_LS=false GDCM=false
- env: DISTRIB="conda" PYTHON_VERSION="3.6" NUMPY=true PILLOW=both JPEG_LS=true GDCM=false
- env: DISTRIB="conda" PYTHON_VERSION="3.6" NUMPY=true PILLOW=both JPEG_LS=true GDCM=true
+ - env: DISTRIB="conda" PYTHON_VERSION="3.6" NUMPY=true PILLOW=false JPEG_LS=false GDCM=old
- env: DISTRIB="conda" PYTHON_VERSION="3.7" NUMPY=false PILLOW=false JPEG_LS=false GDCM=false
- env: DISTRIB="conda" PYTHON_VERSION="3.7" NUMPY=true PILLOW=false JPEG_LS=false GDCM=false
diff --git a/build_tools/travis/install.sh b/build_tools/travis/install.sh
index cb52b4aaf..1e2b19ea2 100755
--- a/build_tools/travis/install.sh
+++ b/build_tools/travis/install.sh
@@ -59,6 +59,8 @@ if [[ "$DISTRIB" == "conda" ]]; then
fi
if [[ "$GDCM" == "true" ]]; then
conda install --yes -c conda-forge gdcm
+ elif [[ "$GDCM" == "old" ]]; then
+ conda install --yes -c conda-forge gdcm=2.8.4
fi
# Install nose-timer via pip
pip install nose-timer codecov
diff --git a/pydicom/pixel_data_handlers/gdcm_handler.py b/pydicom/pixel_data_handlers/gdcm_handler.py
index 86aa6badf..45dd3a945 100644
--- a/pydicom/pixel_data_handlers/gdcm_handler.py
+++ b/pydicom/pixel_data_handlers/gdcm_handler.py
@@ -12,11 +12,15 @@ except ImportError:
try:
import gdcm
HAVE_GDCM = True
+ HAVE_GDCM_IN_MEMORY_SUPPORT = hasattr(gdcm.DataElement,
+ 'SetByteStringValue')
except ImportError:
HAVE_GDCM = False
+ HAVE_GDCM_IN_MEMORY_SUPPORT = False
import pydicom.uid
from pydicom import compat
+from pydicom.pixel_data_handlers.util import get_expected_length, pixel_dtype
HANDLER_NAME = 'GDCM'
@@ -73,6 +77,101 @@ def supports_transfer_syntax(transfer_syntax):
return transfer_syntax in SUPPORTED_TRANSFER_SYNTAXES
+def create_data_element(dicom_dataset):
+ """Create a gdcm.DataElement containing PixelData from a FileDataset
+
+ Parameters
+ ----------
+ dicom_dataset : FileDataset
+
+
+ Returns
+ -------
+ gdcm.DataElement
+ Converted PixelData element
+ """
+ data_element = gdcm.DataElement(gdcm.Tag(0x7fe0, 0x0010))
+ if dicom_dataset.file_meta.TransferSyntaxUID.is_compressed:
+ if getattr(dicom_dataset, 'NumberOfFrames', 1) > 1:
+ pixel_data_sequence = pydicom.encaps.decode_data_sequence(
+ dicom_dataset.PixelData)
+ else:
+ pixel_data_sequence = [
+ pydicom.encaps.defragment_data(dicom_dataset.PixelData)
+ ]
+
+ fragments = gdcm.SequenceOfFragments.New()
+ for pixel_data in pixel_data_sequence:
+ fragment = gdcm.Fragment()
+ fragment.SetByteStringValue(pixel_data)
+ fragments.AddFragment(fragment)
+ data_element.SetValue(fragments.__ref__())
+ else:
+ data_element.SetByteStringValue(dicom_dataset.PixelData)
+
+ return data_element
+
+
+def create_image(dicom_dataset, data_element):
+ """Create a gdcm.Image from a FileDataset and a gdcm.DataElement containing
+ PixelData (0x7fe0, 0x0010)
+
+ Parameters
+ ----------
+ dicom_dataset : FileDataset
+ data_element : gdcm.DataElement
+ DataElement containing PixelData
+
+ Returns
+ -------
+ gdcm.Image
+ """
+ image = gdcm.Image()
+ number_of_frames = getattr(dicom_dataset, 'NumberOfFrames', 1)
+ image.SetNumberOfDimensions(2 if number_of_frames == 1 else 3)
+ image.SetDimensions(
+ (dicom_dataset.Columns, dicom_dataset.Rows, number_of_frames))
+ image.SetDataElement(data_element)
+ pi_type = gdcm.PhotometricInterpretation.GetPIType(
+ dicom_dataset.PhotometricInterpretation)
+ image.SetPhotometricInterpretation(
+ gdcm.PhotometricInterpretation(pi_type))
+ ts_type = gdcm.TransferSyntax.GetTSType(
+ str.__str__(dicom_dataset.file_meta.TransferSyntaxUID))
+ image.SetTransferSyntax(gdcm.TransferSyntax(ts_type))
+ pixel_format = gdcm.PixelFormat(
+ dicom_dataset.SamplesPerPixel, dicom_dataset.BitsAllocated,
+ dicom_dataset.BitsStored, dicom_dataset.HighBit,
+ dicom_dataset.PixelRepresentation)
+ image.SetPixelFormat(pixel_format)
+ if 'PlanarConfiguration' in dicom_dataset:
+ image.SetPlanarConfiguration(dicom_dataset.PlanarConfiguration)
+ return image
+
+
+def create_image_reader(filename):
+ """Create a gdcm.ImageReader
+
+ Parameters
+ ----------
+ filename: str or unicode (Python 2)
+
+ Returns
+ -------
+ gdcm.ImageReader
+ """
+ image_reader = gdcm.ImageReader()
+ if compat.in_py2:
+ if isinstance(filename, unicode):
+ image_reader.SetFileName(
+ filename.encode(sys.getfilesystemencoding()))
+ else:
+ image_reader.SetFileName(filename)
+ else:
+ image_reader.SetFileName(filename)
+ return image_reader
+
+
def get_pixeldata(dicom_dataset):
"""
Use the GDCM package to decode the PixelData attribute
@@ -97,48 +196,19 @@ def get_pixeldata(dicom_dataset):
if the decoded amount of data does not match the expected amount
"""
- # read the file using GDCM
- # FIXME this should just use dicom_dataset.PixelData
- # instead of dicom_dataset.filename
- # but it is unclear how this should be achieved using GDCM
if not HAVE_GDCM:
msg = ("GDCM requires both the gdcm package and numpy "
"and one or more could not be imported")
raise ImportError(msg)
- gdcm_image_reader = gdcm.ImageReader()
- if compat.in_py2:
- if isinstance(dicom_dataset.filename, unicode):
- gdcm_image_reader.SetFileName(
- dicom_dataset.filename.encode(sys.getfilesystemencoding()))
- else:
- gdcm_image_reader.SetFileName(dicom_dataset.filename)
+ if HAVE_GDCM_IN_MEMORY_SUPPORT:
+ gdcm_data_element = create_data_element(dicom_dataset)
+ gdcm_image = create_image(dicom_dataset, gdcm_data_element)
else:
- # python 3
- gdcm_image_reader.SetFileName(dicom_dataset.filename)
-
- if not gdcm_image_reader.Read():
- raise TypeError("GDCM could not read DICOM image")
-
- gdcm_image = gdcm_image_reader.GetImage()
-
- # determine the correct numpy datatype
- gdcm_numpy_typemap = {
- gdcm.PixelFormat.INT8: numpy.int8,
- gdcm.PixelFormat.UINT8: numpy.uint8,
- gdcm.PixelFormat.UINT16: numpy.uint16,
- gdcm.PixelFormat.INT16: numpy.int16,
- gdcm.PixelFormat.UINT32: numpy.uint32,
- gdcm.PixelFormat.INT32: numpy.int32,
- gdcm.PixelFormat.FLOAT32: numpy.float32,
- gdcm.PixelFormat.FLOAT64: numpy.float64
- }
- gdcm_pixel_format = gdcm_image.GetPixelFormat().GetScalarType()
- if gdcm_pixel_format in gdcm_numpy_typemap:
- numpy_dtype = gdcm_numpy_typemap[gdcm_pixel_format]
- else:
- raise TypeError('{0} is not a GDCM supported '
- 'pixel format'.format(gdcm_pixel_format))
+ gdcm_image_reader = create_image_reader(dicom_dataset.filename)
+ if not gdcm_image_reader.Read():
+ raise TypeError("GDCM could not read DICOM image")
+ gdcm_image = gdcm_image_reader.GetImage()
# GDCM returns char* as type str. Under Python 2 `str` are
# byte arrays by default. Python 3 decodes this to
@@ -148,57 +218,34 @@ def get_pixeldata(dicom_dataset):
# error handler configured.
# Therefore, we can encode them back to their original bytearray
# representation on Python 3 by using the same parameters.
- pixel_bytearray = gdcm_image.GetBuffer()
- if sys.version_info >= (3, 0):
- pixel_bytearray = pixel_bytearray.encode("utf-8",
- "surrogateescape")
-
- # if GDCM indicates that a byte swap is in order, make
- # sure to inform numpy as well
- if gdcm_image.GetNeedByteSwap():
- numpy_dtype = numpy_dtype.newbyteorder('S')
+ if compat.in_py2:
+ pixel_bytearray = gdcm_image.GetBuffer()
+ else:
+ pixel_bytearray = gdcm_image.GetBuffer().encode(
+ "utf-8", "surrogateescape")
# Here we need to be careful because in some cases, GDCM reads a
# buffer that is too large, so we need to make sure we only include
# the first n_rows * n_columns * dtype_size bytes.
-
- n_bytes = (dicom_dataset.Rows *
- dicom_dataset.Columns *
- numpy.dtype(numpy_dtype).itemsize)
- try:
- n_bytes *= dicom_dataset.NumberOfFrames
- except Exception:
- pass
- try:
- n_bytes *= dicom_dataset.SamplesPerPixel
- except Exception:
- pass
-
- if len(pixel_bytearray) > n_bytes:
+ expected_length_bytes = get_expected_length(dicom_dataset)
+ if len(pixel_bytearray) > expected_length_bytes:
# We make sure that all the bytes after are in fact zeros
- padding = pixel_bytearray[n_bytes:]
+ padding = pixel_bytearray[expected_length_bytes:]
if numpy.any(numpy.frombuffer(padding, numpy.byte)):
- pixel_bytearray = pixel_bytearray[:n_bytes]
+ pixel_bytearray = pixel_bytearray[:expected_length_bytes]
else:
# We revert to the old behavior which should then result
# in a Numpy error later on.
pass
+ numpy_dtype = pixel_dtype(dicom_dataset)
pixel_array = numpy.frombuffer(pixel_bytearray, dtype=numpy_dtype)
- length_of_pixel_array = pixel_array.nbytes
- expected_length = dicom_dataset.Rows * dicom_dataset.Columns
-
- expected_length *= dicom_dataset.get("NumberOfFrames", 1)
- expected_length *= dicom_dataset.get("SamplesPerPixel", 1)
-
- if dicom_dataset.BitsAllocated > 8:
- expected_length *= (dicom_dataset.BitsAllocated // 8)
-
- if length_of_pixel_array != expected_length:
+ expected_length_pixels = get_expected_length(dicom_dataset, 'pixels')
+ if pixel_array.size != expected_length_pixels:
raise AttributeError("Amount of pixel data %d does "
"not match the expected data %d" %
- (length_of_pixel_array, expected_length))
+ (pixel_array.size, expected_length_pixels))
if should_change_PhotometricInterpretation_to_RGB(dicom_dataset):
dicom_dataset.PhotometricInterpretation = "RGB"
diff --git a/pydicom/pixel_data_handlers/numpy_handler.py b/pydicom/pixel_data_handlers/numpy_handler.py
index f3030abe7..2d5c8a347 100644
--- a/pydicom/pixel_data_handlers/numpy_handler.py
+++ b/pydicom/pixel_data_handlers/numpy_handler.py
@@ -42,7 +42,7 @@ try:
except ImportError:
HAVE_NP = False
-from pydicom.pixel_data_handlers.util import pixel_dtype
+from pydicom.pixel_data_handlers.util import pixel_dtype, get_expected_length
import pydicom.uid
HANDLER_NAME = 'Numpy'
@@ -92,60 +92,6 @@ def should_change_PhotometricInterpretation_to_RGB(ds):
return False
-def get_expected_length(ds, unit='bytes'):
- """Return the expected length (in bytes or pixels) of the pixel data.
-
- +-----------------------------------+------+-------------+
- | Element | Type | Required or |
- +-------------+---------------------+ | optional |
- | Tag | Keyword | | |
- +=============+=====================+======+=============+
- | (0028,0002) | SamplesPerPixel | 1 | Required |
- +-------------+---------------------+------+-------------+
- | (0028,0008) | NumberOfFrames | 1C | Optional |
- +-------------+---------------------+------+-------------+
- | (0028,0010) | Rows | 1 | Required |
- +-------------+---------------------+------+-------------+
- | (0028,0011) | Columns | 1 | Required |
- +-------------+---------------------+------+-------------+
- | (0028,0100) | BitsAllocated | 1 | Required |
- +-------------+---------------------+------+-------------+
-
- Parameters
- ----------
- ds : dataset.Dataset
- The DICOM dataset containing the Image Pixel module and pixel data.
- unit : str, optional
- If 'bytes' then returns the expected length of the Pixel Data in
- whole bytes and NOT including an odd length trailing NULL padding
- byte. If 'pixels' then returns the expected length of the Pixel Data
- in terms of the total number of pixels (default 'bytes').
-
- Returns
- -------
- int
- The expected length of the pixel data in either whole bytes or pixels,
- excluding the NULL trailing padding byte for odd length data.
- """
- length = ds.Rows * ds.Columns * ds.SamplesPerPixel
- length *= getattr(ds, 'NumberOfFrames', 1)
-
- if unit == 'pixels':
- return length
-
- # Correct for the number of bytes per pixel
- bits_allocated = ds.BitsAllocated
- if bits_allocated == 1:
- # Determine the nearest whole number of bytes needed to contain
- # 1-bit pixel data. e.g. 10 x 10 1-bit pixels is 100 bits, which
- # are packed into 12.5 -> 13 bytes
- length = length // 8 + (length % 8 > 0)
- else:
- length *= bits_allocated // 8
-
- return length
-
-
def pack_bits(arr):
"""Pack a binary numpy ndarray into bytes for use with Pixel Data.
diff --git a/pydicom/pixel_data_handlers/util.py b/pydicom/pixel_data_handlers/util.py
index d127dc66e..87dd6c436 100644
--- a/pydicom/pixel_data_handlers/util.py
+++ b/pydicom/pixel_data_handlers/util.py
@@ -323,6 +323,60 @@ def reshape_pixel_array(ds, arr):
return arr
+def get_expected_length(ds, unit='bytes'):
+ """Return the expected length (in bytes or pixels) of the pixel data.
+
+ +-----------------------------------+------+-------------+
+ | Element | Type | Required or |
+ +-------------+---------------------+ | optional |
+ | Tag | Keyword | | |
+ +=============+=====================+======+=============+
+ | (0028,0002) | SamplesPerPixel | 1 | Required |
+ +-------------+---------------------+------+-------------+
+ | (0028,0008) | NumberOfFrames | 1C | Optional |
+ +-------------+---------------------+------+-------------+
+ | (0028,0010) | Rows | 1 | Required |
+ +-------------+---------------------+------+-------------+
+ | (0028,0011) | Columns | 1 | Required |
+ +-------------+---------------------+------+-------------+
+ | (0028,0100) | BitsAllocated | 1 | Required |
+ +-------------+---------------------+------+-------------+
+
+ Parameters
+ ----------
+ ds : dataset.Dataset
+ The DICOM dataset containing the Image Pixel module and pixel data.
+ unit : str, optional
+ If 'bytes' then returns the expected length of the Pixel Data in
+ whole bytes and NOT including an odd length trailing NULL padding
+ byte. If 'pixels' then returns the expected length of the Pixel Data
+ in terms of the total number of pixels (default 'bytes').
+
+ Returns
+ -------
+ int
+ The expected length of the pixel data in either whole bytes or pixels,
+ excluding the NULL trailing padding byte for odd length data.
+ """
+ length = ds.Rows * ds.Columns * ds.SamplesPerPixel
+ length *= getattr(ds, 'NumberOfFrames', 1)
+
+ if unit == 'pixels':
+ return length
+
+ # Correct for the number of bytes per pixel
+ bits_allocated = ds.BitsAllocated
+ if bits_allocated == 1:
+ # Determine the nearest whole number of bytes needed to contain
+ # 1-bit pixel data. e.g. 10 x 10 1-bit pixels is 100 bits, which
+ # are packed into 12.5 -> 13 bytes
+ length = length // 8 + (length % 8 > 0)
+ else:
+ length *= bits_allocated // 8
+
+ return length
+
+
def _convert_RGB_to_YBR_FULL(arr):
"""Return an ndarray converted from RGB to YBR_FULL color space.
|
Decompress data using GDCM without filename requirement
I've been in touch with the GDCM author Mathieu Malaterre to see how we can use GDCM without requiring the filename to be available as is currently the case (see #232).
He pointed me to this example:
http://gdcm.sourceforge.net/2.6/html/DecompressJPEGFile_8cs-example.xhtml
I'll be submitting a PR for this soon.
|
pydicom/pydicom
|
diff --git a/pydicom/tests/test_environment.py b/pydicom/tests/test_environment.py
index 82c70c36b..ab1e861ea 100644
--- a/pydicom/tests/test_environment.py
+++ b/pydicom/tests/test_environment.py
@@ -7,7 +7,7 @@ The current pydicom testing environments are as follows:
* Python 2.7:
* no additional packages
* numpy
- * numpy, gdcm
+ * numpy, gdcm (newest and v2.8.4)
* numpy, pillow (jpg, jpg2k)
* numpy, jpeg-ls
* numpy, pillow (jpg, jpg2k), jpeg-ls
@@ -32,7 +32,7 @@ PYTHON_VERSION: 2.7, 3.4, 3.5, 3.6, 3.7
NUMPY: true, false
PILLOW: jpeg, both, false
JPEG_LS: false, true
-GDCM: false, true
+GDCM: false, true, old
"""
import os
import platform
@@ -174,6 +174,12 @@ class TestBuilds(object):
elif have_gdcm == 'false':
with pytest.raises(ImportError):
import gdcm
+ elif have_gdcm == 'old':
+ try:
+ import gdcm
+ except ImportError:
+ pytest.fail("GDCM is 'old' but gdcm is not importable")
+ assert gdcm.Version_GetVersion() == '2.8.4'
else:
raise NotImplementedError(
"Unknown 'GDCM' value of '{}'".format(have_gdcm)
diff --git a/pydicom/tests/test_gdcm_pixel_data.py b/pydicom/tests/test_gdcm_pixel_data.py
index 4d4c41fda..5a4b9d9e5 100644
--- a/pydicom/tests/test_gdcm_pixel_data.py
+++ b/pydicom/tests/test_gdcm_pixel_data.py
@@ -14,6 +14,8 @@ from pydicom.pixel_data_handlers.util import _convert_YBR_FULL_to_RGB
from pydicom.tag import Tag
from pydicom import compat
gdcm_missing_message = "GDCM is not available in this test environment"
+gdcm_im_missing_message = "GDCM is not available or in-memory decoding"\
+ " not supported with this GDCM version"
gdcm_present_message = "GDCM is being tested"
have_numpy_testing = True
try:
@@ -31,8 +33,12 @@ except AttributeError:
try:
import pydicom.pixel_data_handlers.gdcm_handler as gdcm_handler
HAVE_GDCM = gdcm_handler.HAVE_GDCM
+ HAVE_GDCM_IN_MEMORY_SUPPORT = gdcm_handler.HAVE_GDCM_IN_MEMORY_SUPPORT
+ if HAVE_GDCM:
+ import gdcm
except ImportError as e:
HAVE_GDCM = False
+ HAVE_GDCM_IN_MEMORY_SUPPORT = False
gdcm_handler = None
try:
@@ -57,6 +63,8 @@ jpeg_ls_lossless_name = get_testdata_files(
"MR_small_jpeg_ls_lossless.dcm")[0]
jpeg_lossy_name = get_testdata_files("JPEG-lossy.dcm")[0]
jpeg_lossless_name = get_testdata_files("JPEG-LL.dcm")[0]
+jpeg_lossless_odd_data_size_name = get_testdata_files(
+ 'SC_rgb_small_odd_jpeg.dcm')[0]
deflate_name = get_testdata_files("image_dfl.dcm")[0]
rtstruct_name = get_testdata_files("rtstruct.dcm")[0]
priv_SQ_name = get_testdata_files("priv_SQ.dcm")[0]
@@ -238,192 +246,8 @@ class GDCM_JPEGlosslessTests_no_gdcm(unittest.TestCase):
_ = self.jpeg_lossless.pixel_array
[email protected](not HAVE_GDCM, reason=gdcm_missing_message)
-class GDCM_JPEG_LS_Tests_with_gdcm(unittest.TestCase):
- def setUp(self):
- if compat.in_py2:
- self.utf8_filename = os.path.join(
- tempfile.gettempdir(), "ДИКОМ.dcm")
- self.unicode_filename = self.utf8_filename.decode("utf8")
- shutil.copyfile(jpeg_ls_lossless_name.decode("utf8"),
- self.unicode_filename)
- else:
- self.unicode_filename = os.path.join(
- tempfile.gettempdir(), "ДИКОМ.dcm")
- shutil.copyfile(jpeg_ls_lossless_name, self.unicode_filename)
- self.jpeg_ls_lossless = dcmread(self.unicode_filename)
- self.mr_small = dcmread(mr_name)
- self.emri_jpeg_ls_lossless = dcmread(emri_jpeg_ls_lossless)
- self.emri_small = dcmread(emri_name)
- self.original_handlers = pydicom.config.pixel_data_handlers
- pydicom.config.pixel_data_handlers = [numpy_handler, gdcm_handler]
-
- def tearDown(self):
- pydicom.config.pixel_data_handlers = self.original_handlers
- os.remove(self.unicode_filename)
-
- def test_JPEG_LS_PixelArray(self):
- a = self.jpeg_ls_lossless.pixel_array
- b = self.mr_small.pixel_array
- self.assertEqual(
- a.mean(),
- b.mean(),
- "using GDCM Decoded pixel data is not "
- "all {0} (mean == {1})".format(b.mean(), a.mean()))
-
- assert a.flags.writeable
-
- def test_emri_JPEG_LS_PixelArray_with_gdcm(self):
- a = self.emri_jpeg_ls_lossless.pixel_array
- b = self.emri_small.pixel_array
- self.assertEqual(
- a.mean(),
- b.mean(),
- "Decoded pixel data is not all {0} "
- "(mean == {1})".format(b.mean(), a.mean()))
-
- assert a.flags.writeable
-
-
[email protected](not HAVE_GDCM, reason=gdcm_missing_message)
-class GDCM_JPEG2000Tests_with_gdcm(unittest.TestCase):
- def setUp(self):
- self.jpeg_2k = dcmread(jpeg2000_name)
- self.jpeg_2k_lossless = dcmread(jpeg2000_lossless_name)
- self.mr_small = dcmread(mr_name)
- self.emri_jpeg_2k_lossless = dcmread(emri_jpeg_2k_lossless)
- self.emri_small = dcmread(emri_name)
- self.sc_rgb_jpeg2k_gdcm_KY = dcmread(sc_rgb_jpeg2k_gdcm_KY)
- self.ground_truth_sc_rgb_jpeg2k_gdcm_KY_gdcm = dcmread(
- ground_truth_sc_rgb_jpeg2k_gdcm_KY_gdcm)
- self.original_handlers = pydicom.config.pixel_data_handlers
- pydicom.config.pixel_data_handlers = [numpy_handler, gdcm_handler]
-
- def tearDown(self):
- pydicom.config.pixel_data_handlers = self.original_handlers
-
- def test_JPEG2000(self):
- """JPEG2000: Returns correct values for sample data elements"""
- # XX also tests multiple-valued AT data element
- expected = [Tag(0x0054, 0x0010), Tag(0x0054, 0x0020)]
- got = self.jpeg_2k.FrameIncrementPointer
- self.assertEqual(
- got,
- expected,
- "JPEG2000 file, Frame Increment Pointer: "
- "expected %s, got %s" % (expected, got))
-
- got = self.jpeg_2k.DerivationCodeSequence[0].CodeMeaning
- expected = 'Lossy Compression'
- self.assertEqual(
- got,
- expected,
- "JPEG200 file, Code Meaning got %s, "
- "expected %s" % (got, expected))
-
- def test_JPEG2000PixelArray(self):
- a = self.jpeg_2k_lossless.pixel_array
- b = self.mr_small.pixel_array
- self.assertEqual(
- a.mean(),
- b.mean(),
- "Decoded pixel data is not all {0} "
- "(mean == {1})".format(b.mean(), a.mean()))
-
- assert a.flags.writeable
-
- def test_emri_JPEG2000PixelArray(self):
- a = self.emri_jpeg_2k_lossless.pixel_array
- b = self.emri_small.pixel_array
- self.assertEqual(
- a.mean(),
- b.mean(),
- "Decoded pixel data is not all {0} "
- "(mean == {1})".format(b.mean(), a.mean()))
-
- assert a.flags.writeable
-
- def test_jpeg2000_lossy(self):
- a = self.sc_rgb_jpeg2k_gdcm_KY.pixel_array
- b = self.ground_truth_sc_rgb_jpeg2k_gdcm_KY_gdcm.pixel_array
- if have_numpy_testing:
- numpy.testing.assert_array_equal(a, b)
- else:
- self.assertEqual(
- a.mean(),
- b.mean(),
- "Decoded pixel data is not all {0} "
- "(mean == {1})".format(b.mean(), a.mean()))
-
- assert a.flags.writeable
-
-
[email protected](not HAVE_GDCM, reason=gdcm_missing_message)
-class GDCM_JPEGlossyTests_with_gdcm(unittest.TestCase):
-
- def setUp(self):
- self.jpeg_lossy = dcmread(jpeg_lossy_name)
- self.color_3d_jpeg = dcmread(color_3d_jpeg_baseline)
- self.original_handlers = pydicom.config.pixel_data_handlers
- pydicom.config.pixel_data_handlers = [numpy_handler, gdcm_handler]
-
- def tearDown(self):
- pydicom.config.pixel_data_handlers = self.original_handlers
-
- def testJPEGlossless_odd_data_size(self):
- test_file = get_testdata_files('SC_rgb_small_odd_jpeg.dcm')[0]
- ds = dcmread(test_file)
- pixel_data = ds.pixel_array
- assert pixel_data.nbytes == 27
- assert pixel_data.shape == (3, 3, 3)
-
- def test_JPEGlossy(self):
- """JPEG-lossy: Returns correct values for sample data elements"""
- got = self.jpeg_lossy.DerivationCodeSequence[0].CodeMeaning
- expected = 'Lossy Compression'
- self.assertEqual(
- got,
- expected,
- "JPEG-lossy file, Code Meaning got %s, "
- "expected %s" % (got, expected))
-
- def test_JPEGlossyPixelArray(self):
- a = self.jpeg_lossy.pixel_array
- self.assertEqual(a.shape, (1024, 256))
- # this test points were manually identified in Osirix viewer
- self.assertEqual(a[420, 140], 244)
- self.assertEqual(a[230, 120], 95)
-
- assert a.flags.writeable
-
- def test_JPEGBaselineColor3DPixelArray(self):
- self.assertEqual(
- self.color_3d_jpeg.PhotometricInterpretation,
- "YBR_FULL_422")
- a = self.color_3d_jpeg.pixel_array
-
- assert a.flags.writeable
-
- self.assertEqual(a.shape, (120, 480, 640, 3))
- a = _convert_YBR_FULL_to_RGB(a)
- # this test points were manually identified in Osirix viewer
- self.assertEqual(tuple(a[3, 159, 290, :]), (41, 41, 41))
- self.assertEqual(tuple(a[3, 169, 290, :]), (57, 57, 57))
- self.assertEqual(
- self.color_3d_jpeg.PhotometricInterpretation,
- "YBR_FULL_422")
-
-
[email protected](scope="module")
-def test_with_gdcm():
- original_handlers = pydicom.config.pixel_data_handlers
- pydicom.config.pixel_data_handlers = [numpy_handler, gdcm_handler]
- yield original_handlers
- pydicom.config.pixel_data_handlers = original_handlers
-
-
if have_pytest_param:
- test_ids = [
+ pi_rgb_test_ids = [
"JPEG_RGB_RGB",
"JPEG_RGB_411_AS_YBR_FULL",
"JPEG_RGB_411_AS_YBR_FULL_422",
@@ -432,7 +256,7 @@ if have_pytest_param:
"JPEG_RGB_444_AS_YBR_FULL",
]
- testdata = [
+ pi_rgb_testdata = [
(sc_rgb_jpeg_dcmtk_RGB,
"RGB",
[
@@ -543,12 +367,18 @@ if have_pytest_param:
marks=pytest.mark.xfail(
reason="GDCM does not support "
"non default jpeg lossy colorspaces"))]
+
+ with_gdcm_params = [
+ pytest.param('File', marks=pytest.mark.skipif(
+ not HAVE_GDCM, reason=gdcm_missing_message)),
+ pytest.param('InMemory', marks=pytest.mark.skipif(
+ not HAVE_GDCM_IN_MEMORY_SUPPORT, reason=gdcm_im_missing_message))]
else:
# python 3.4 can't parameterize with xfails...
- test_ids = [
+ pi_rgb_test_ids = [
"JPEG_RGB_RGB",
]
- testdata = [
+ pi_rgb_testdata = [
(sc_rgb_jpeg_dcmtk_RGB,
"RGB",
[
@@ -566,71 +396,331 @@ else:
False),
]
-
[email protected](
- not HAVE_GDCM,
- reason=gdcm_missing_message)
[email protected](
- "image,PhotometricInterpretation,results,convert_yuv_to_rgb",
- testdata,
- ids=test_ids)
-def test_PI_RGB(test_with_gdcm,
- image,
- PhotometricInterpretation,
- results,
- convert_yuv_to_rgb):
- t = dcmread(image)
- assert t.PhotometricInterpretation == PhotometricInterpretation
- a = t.pixel_array
-
- assert a.flags.writeable
-
- assert a.shape == (100, 100, 3)
- if convert_yuv_to_rgb:
- a = _convert_YBR_FULL_to_RGB(a)
- # this test points are from the ImageComments tag
- assert tuple(a[5, 50, :]) == results[0]
- assert tuple(a[15, 50, :]) == results[1]
- assert tuple(a[25, 50, :]) == results[2]
- assert tuple(a[35, 50, :]) == results[3]
- assert tuple(a[45, 50, :]) == results[4]
- assert tuple(a[55, 50, :]) == results[5]
- assert tuple(a[65, 50, :]) == results[6]
- assert tuple(a[75, 50, :]) == results[7]
- assert tuple(a[85, 50, :]) == results[8]
- assert tuple(a[95, 50, :]) == results[9]
- assert t.PhotometricInterpretation == PhotometricInterpretation
-
-
[email protected](not HAVE_GDCM, reason=gdcm_missing_message)
-class GDCM_JPEGlosslessTests_with_gdcm(unittest.TestCase):
- def setUp(self):
- self.jpeg_lossless = dcmread(jpeg_lossless_name)
- self.original_handlers = pydicom.config.pixel_data_handlers
+ if HAVE_GDCM_IN_MEMORY_SUPPORT:
+ with_gdcm_params = ['File', 'InMemory']
+ elif HAVE_GDCM:
+ with_gdcm_params = ['File']
+ else:
+ with_gdcm_params = []
+
+
+class TestsWithGDCM():
+ @pytest.fixture(params=with_gdcm_params, scope='class', autouse=True)
+ def with_gdcm(self, request):
+ original_value = HAVE_GDCM_IN_MEMORY_SUPPORT
+ if request.param == 'File':
+ gdcm_handler.HAVE_GDCM_IN_MEMORY_SUPPORT = False
+ original_handlers = pydicom.config.pixel_data_handlers
pydicom.config.pixel_data_handlers = [numpy_handler, gdcm_handler]
+ yield
+ gdcm_handler.HAVE_GDCM_IN_MEMORY_SUPPORT = original_value
+ pydicom.config.pixel_data_handlers = original_handlers
- def tearDown(self):
- pydicom.config.pixel_data_handlers = self.original_handlers
+ @pytest.fixture(scope='class')
+ def unicode_filename(self):
+ if compat.in_py2:
+ utf8_filename = os.path.join(tempfile.gettempdir(), "ДИКОМ.dcm")
+ unicode_filename = utf8_filename.decode("utf8")
+ shutil.copyfile(jpeg_ls_lossless_name.decode("utf8"),
+ unicode_filename)
+ else:
+ unicode_filename = os.path.join(
+ tempfile.gettempdir(), "ДИКОМ.dcm")
+ shutil.copyfile(jpeg_ls_lossless_name, unicode_filename)
+ yield unicode_filename
+ os.remove(unicode_filename)
- def testJPEGlossless(self):
+ @pytest.fixture
+ def jpeg_ls_lossless(self, unicode_filename):
+ return dcmread(unicode_filename)
+
+ @pytest.fixture
+ def sc_rgb_jpeg2k_gdcm_KY(self):
+ return dcmread(sc_rgb_jpeg2k_gdcm_KY)
+
+ @pytest.fixture(scope='class')
+ def ground_truth_sc_rgb_jpeg2k_gdcm_KY_gdcm(self):
+ return dcmread(ground_truth_sc_rgb_jpeg2k_gdcm_KY_gdcm)
+
+ @pytest.fixture
+ def jpeg_2k(self):
+ return dcmread(jpeg2000_name)
+
+ @pytest.fixture
+ def jpeg_2k_lossless(self):
+ return dcmread(jpeg2000_lossless_name)
+
+ @pytest.fixture(scope='class')
+ def mr_small(self):
+ return dcmread(mr_name)
+
+ @pytest.fixture(scope='class')
+ def emri_small(self):
+ return dcmread(emri_name)
+
+ @pytest.fixture
+ def emri_jpeg_ls_lossless(self):
+ return dcmread(emri_jpeg_ls_lossless)
+
+ @pytest.fixture
+ def emri_jpeg_2k_lossless(self):
+ return dcmread(emri_jpeg_2k_lossless)
+
+ @pytest.fixture
+ def color_3d_jpeg(self):
+ return dcmread(color_3d_jpeg_baseline)
+
+ @pytest.fixture
+ def jpeg_lossy(self):
+ return dcmread(jpeg_lossy_name)
+
+ @pytest.fixture
+ def jpeg_lossless(self):
+ return dcmread(jpeg_lossless_name)
+
+ @pytest.fixture
+ def jpeg_lossless_odd_data_size(self):
+ return dcmread(jpeg_lossless_odd_data_size_name)
+
+ def test_JPEG_LS_PixelArray(self, jpeg_ls_lossless, mr_small):
+ a = jpeg_ls_lossless.pixel_array
+ b = mr_small.pixel_array
+ assert a.mean() == b.mean(), "using GDCM Decoded pixel data is not "\
+ "all {0} (mean == {1})".format(b.mean(), a.mean())
+
+ assert a.flags.writeable
+
+ def test_emri_JPEG_LS_PixelArray_with_gdcm(self, emri_jpeg_ls_lossless,
+ emri_small):
+ a = emri_jpeg_ls_lossless.pixel_array
+ b = emri_small.pixel_array
+ assert a.mean() == b.mean(), "Decoded pixel data is not all {0} "\
+ "(mean == {1})".format(b.mean(), a.mean())
+
+ assert a.flags.writeable
+
+ def test_JPEG2000(self, jpeg_2k):
+ """JPEG2000: Returns correct values for sample data elements"""
+ # XX also tests multiple-valued AT data element
+ expected = [Tag(0x0054, 0x0010), Tag(0x0054, 0x0020)]
+ got = jpeg_2k.FrameIncrementPointer
+ assert got == expected, "JPEG2000 file, Frame Increment Pointer: "\
+ "expected %s, got %s" % (expected, got)
+
+ got = jpeg_2k.DerivationCodeSequence[0].CodeMeaning
+ expected = 'Lossy Compression'
+ assert got == expected, "JPEG200 file, Code Meaning got %s, "\
+ "expected %s" % (got, expected)
+
+ def test_JPEG2000PixelArray(self, jpeg_2k_lossless, mr_small):
+ a = jpeg_2k_lossless.pixel_array
+ b = mr_small.pixel_array
+ assert a.mean() == b.mean(), "Decoded pixel data is not all {0} "\
+ "(mean == {1})".format(b.mean(), a.mean())
+
+ assert a.flags.writeable
+
+ def test_emri_JPEG2000PixelArray(self, emri_jpeg_2k_lossless, emri_small):
+ a = emri_jpeg_2k_lossless.pixel_array
+ b = emri_small.pixel_array
+ assert a.mean() == b.mean(), "Decoded pixel data is not all {0} "\
+ "(mean == {1})".format(b.mean(), a.mean())
+
+ assert a.flags.writeable
+
+ def test_JPEG2000_lossy(self, sc_rgb_jpeg2k_gdcm_KY,
+ ground_truth_sc_rgb_jpeg2k_gdcm_KY_gdcm):
+ a = sc_rgb_jpeg2k_gdcm_KY.pixel_array
+ b = ground_truth_sc_rgb_jpeg2k_gdcm_KY_gdcm.pixel_array
+ if have_numpy_testing:
+ numpy.testing.assert_array_equal(a, b)
+ else:
+ assert a.mean() == b.mean(), "Decoded pixel data is not all {0} "\
+ "(mean == {1})".format(b.mean(), a.mean())
+
+ assert a.flags.writeable
+
+ def test_JPEGlossless(self, jpeg_lossless):
"""JPEGlossless: Returns correct values for sample data elements"""
- got = self.\
- jpeg_lossless.\
+ got = jpeg_lossless.\
SourceImageSequence[0].\
PurposeOfReferenceCodeSequence[0].CodeMeaning
expected = 'Uncompressed predecessor'
- self.assertEqual(
- got,
- expected,
- "JPEG-lossless file, Code Meaning got %s, "
- "expected %s" % (got, expected))
+ assert got == expected, "JPEG-lossless file, Code Meaning got %s, "\
+ "expected %s" % (got, expected)
- def testJPEGlosslessPixelArray(self):
+ def test_JPEGlosslessPixelArray(self, jpeg_lossless):
"""JPEGlossless: Fails gracefully when uncompressed data asked for"""
- a = self.jpeg_lossless.pixel_array
- self.assertEqual(a.shape, (1024, 256))
+ a = jpeg_lossless.pixel_array
+ assert a.shape, (1024, 256)
+ # this test points were manually identified in Osirix viewer
+ assert a[420, 140], 227
+ assert a[230, 120], 105
+
+ assert a.flags.writeable
+
+ def test_JPEGlossless_odd_data_size(self, jpeg_lossless_odd_data_size):
+ pixel_data = jpeg_lossless_odd_data_size.pixel_array
+ assert pixel_data.nbytes == 27
+ assert pixel_data.shape == (3, 3, 3)
+
+ def test_JPEGlossy(self, jpeg_lossy):
+ """JPEG-lossy: Returns correct values for sample data elements"""
+ got = jpeg_lossy.DerivationCodeSequence[0].CodeMeaning
+ expected = 'Lossy Compression'
+ assert got == expected, "JPEG-lossy file, Code Meaning got %s, "\
+ "expected %s" % (got, expected)
+
+ def test_JPEGlossyPixelArray(self, jpeg_lossy):
+ a = jpeg_lossy.pixel_array
+ assert a.shape == (1024, 256)
+ # this test points were manually identified in Osirix viewer
+ assert a[420, 140] == 244
+ assert a[230, 120] == 95
+
+ assert a.flags.writeable
+
+ def test_JPEGBaselineColor3DPixelArray(self, color_3d_jpeg):
+ assert color_3d_jpeg.PhotometricInterpretation == "YBR_FULL_422"
+ a = color_3d_jpeg.pixel_array
+
+ assert a.flags.writeable
+
+ assert a.shape == (120, 480, 640, 3)
+ a = _convert_YBR_FULL_to_RGB(a)
# this test points were manually identified in Osirix viewer
- self.assertEqual(a[420, 140], 227)
- self.assertEqual(a[230, 120], 105)
+ assert tuple(a[3, 159, 290, :]) == (41, 41, 41)
+ assert tuple(a[3, 169, 290, :]) == (57, 57, 57)
+ assert color_3d_jpeg.PhotometricInterpretation == "YBR_FULL_422"
+
+ @pytest.mark.parametrize(
+ "image,PhotometricInterpretation,results,convert_yuv_to_rgb",
+ pi_rgb_testdata,
+ ids=pi_rgb_test_ids)
+ def test_PI_RGB(self, image, PhotometricInterpretation, results,
+ convert_yuv_to_rgb):
+ t = dcmread(image)
+ assert t.PhotometricInterpretation == PhotometricInterpretation
+ a = t.pixel_array
assert a.flags.writeable
+
+ assert a.shape == (100, 100, 3)
+ if convert_yuv_to_rgb:
+ a = _convert_YBR_FULL_to_RGB(a)
+ # this test points are from the ImageComments tag
+ assert tuple(a[5, 50, :]) == results[0]
+ assert tuple(a[15, 50, :]) == results[1]
+ assert tuple(a[25, 50, :]) == results[2]
+ assert tuple(a[35, 50, :]) == results[3]
+ assert tuple(a[45, 50, :]) == results[4]
+ assert tuple(a[55, 50, :]) == results[5]
+ assert tuple(a[65, 50, :]) == results[6]
+ assert tuple(a[75, 50, :]) == results[7]
+ assert tuple(a[85, 50, :]) == results[8]
+ assert tuple(a[95, 50, :]) == results[9]
+ assert t.PhotometricInterpretation == PhotometricInterpretation
+
+
+class TestSupportFunctions():
+ @pytest.fixture(scope='class')
+ def dataset_2d(self):
+ return dcmread(mr_name)
+
+ @pytest.fixture(scope='class')
+ def dataset_2d_compressed(self):
+ return dcmread(jpeg2000_name)
+
+ @pytest.fixture(scope='class')
+ def dataset_3d(self):
+ return dcmread(color_3d_jpeg_baseline)
+
+ @pytest.mark.skipif(not HAVE_GDCM_IN_MEMORY_SUPPORT,
+ reason=gdcm_im_missing_message)
+ def test_create_data_element_from_uncompressed_2d_dataset(
+ self, dataset_2d):
+ data_element = gdcm_handler.create_data_element(dataset_2d)
+
+ assert data_element.GetTag().GetGroup() == 0x7fe0
+ assert data_element.GetTag().GetElement() == 0x0010
+ assert data_element.GetSequenceOfFragments() is None
+ assert data_element.GetByteValue() is not None
+
+ @pytest.mark.skipif(not HAVE_GDCM_IN_MEMORY_SUPPORT,
+ reason=gdcm_im_missing_message)
+ def test_create_data_element_from_compressed_2d_dataset(
+ self, dataset_2d_compressed):
+ data_element = gdcm_handler.create_data_element(dataset_2d_compressed)
+
+ assert data_element.GetTag().GetGroup() == 0x7fe0
+ assert data_element.GetTag().GetElement() == 0x0010
+ assert data_element.GetSequenceOfFragments() is not None
+ assert data_element.GetByteValue() is None
+
+ @pytest.mark.skipif(not HAVE_GDCM_IN_MEMORY_SUPPORT,
+ reason=gdcm_im_missing_message)
+ def test_create_data_element_from_3d_dataset(self, dataset_3d):
+ data_element = gdcm_handler.create_data_element(dataset_3d)
+
+ assert data_element.GetTag().GetGroup() == 0x7fe0
+ assert data_element.GetTag().GetElement() == 0x0010
+ assert data_element.GetSequenceOfFragments() is not None
+ assert data_element.GetByteValue() is None
+
+ @pytest.mark.skipif(not HAVE_GDCM_IN_MEMORY_SUPPORT,
+ reason=gdcm_im_missing_message)
+ def test_create_image_from_2d_dataset(self, dataset_2d):
+ data_element = gdcm_handler.create_data_element(dataset_2d)
+ image = gdcm_handler.create_image(dataset_2d, data_element)
+ assert image.GetNumberOfDimensions() == 2
+ assert image.GetDimensions() == [dataset_2d.Rows, dataset_2d.Columns]
+ assert image.GetPhotometricInterpretation().GetType() == \
+ gdcm.PhotometricInterpretation.GetPIType(
+ dataset_2d.PhotometricInterpretation)
+ assert image.GetTransferSyntax().GetString() == str.__str__(
+ dataset_2d.file_meta.TransferSyntaxUID)
+ pixel_format = image.GetPixelFormat()
+ assert pixel_format.GetSamplesPerPixel() == dataset_2d.SamplesPerPixel
+ assert pixel_format.GetBitsAllocated() == dataset_2d.BitsAllocated
+ assert pixel_format.GetBitsStored() == dataset_2d.BitsStored
+ assert pixel_format.GetHighBit() == dataset_2d.HighBit
+ assert pixel_format.GetPixelRepresentation() ==\
+ dataset_2d.PixelRepresentation
+
+ @pytest.mark.skipif(not HAVE_GDCM_IN_MEMORY_SUPPORT,
+ reason=gdcm_im_missing_message)
+ def test_create_image_from_3d_dataset(self, dataset_3d):
+ data_element = gdcm_handler.create_data_element(dataset_3d)
+ image = gdcm_handler.create_image(dataset_3d, data_element)
+ assert image.GetNumberOfDimensions() == 3
+ assert image.GetDimensions() == [
+ dataset_3d.Columns, dataset_3d.Rows,
+ int(dataset_3d.NumberOfFrames)]
+ assert image.GetPhotometricInterpretation().GetType() == \
+ gdcm.PhotometricInterpretation.GetPIType(
+ dataset_3d.PhotometricInterpretation)
+ assert image.GetTransferSyntax().GetString() == str.__str__(
+ dataset_3d.file_meta.TransferSyntaxUID)
+ pixel_format = image.GetPixelFormat()
+ assert pixel_format.GetSamplesPerPixel() == dataset_3d.SamplesPerPixel
+ assert pixel_format.GetBitsAllocated() == dataset_3d.BitsAllocated
+ assert pixel_format.GetBitsStored() == dataset_3d.BitsStored
+ assert pixel_format.GetHighBit() == dataset_3d.HighBit
+ assert pixel_format.GetPixelRepresentation() ==\
+ dataset_3d.PixelRepresentation
+ assert image.GetPlanarConfiguration() ==\
+ dataset_3d.PlanarConfiguration
+
+ @pytest.mark.skipif(not HAVE_GDCM, reason=gdcm_missing_message)
+ def test_create_image_reader_with_string(self):
+ image_reader = gdcm_handler.create_image_reader(mr_name)
+ assert image_reader is not None
+ assert image_reader.Read()
+
+ @pytest.mark.skipif(not HAVE_GDCM, reason=gdcm_missing_message)
+ @pytest.mark.skipif(not compat.in_py2, reason='Python2 specific')
+ def test_create_image_reader_with_py2_unicode_string(self):
+ filename = mr_name.decode('utf-8')
+ image_reader = gdcm_handler.create_image_reader(filename)
+ assert image_reader is not None
+ assert image_reader.Read()
diff --git a/pydicom/tests/test_handler_util.py b/pydicom/tests/test_handler_util.py
index f63ffe210..14e6e6512 100644
--- a/pydicom/tests/test_handler_util.py
+++ b/pydicom/tests/test_handler_util.py
@@ -18,7 +18,8 @@ from pydicom.pixel_data_handlers.util import (
dtype_corrected_for_endianness,
reshape_pixel_array,
convert_color_space,
- pixel_dtype
+ pixel_dtype,
+ get_expected_length
)
from pydicom.uid import (ExplicitVRLittleEndian,
UncompressedPixelTransferSyntaxes)
@@ -653,3 +654,105 @@ class TestNumpy_DtypeCorrectedForEndianness(object):
with pytest.raises(ValueError,
match="attribute 'is_little_endian' has"):
dtype_corrected_for_endianness(None, None)
+
+
+REFERENCE_LENGTH = [
+ # (frames, rows, cols, samples), bit depth, result in (bytes, pixels)
+ # No 'NumberOfFrames' in dataset
+ ((0, 0, 0, 0), 1, (0, 0)),
+ ((0, 1, 1, 1), 1, (1, 1)), # 1 bit -> 1 byte
+ ((0, 1, 1, 3), 1, (1, 3)), # 3 bits -> 1 byte
+ ((0, 1, 3, 3), 1, (2, 9)), # 9 bits -> 2 bytes
+ ((0, 2, 2, 1), 1, (1, 4)), # 4 bits -> 1 byte
+ ((0, 2, 4, 1), 1, (1, 8)), # 8 bits -> 1 byte
+ ((0, 3, 3, 1), 1, (2, 9)), # 9 bits -> 2 bytes
+ ((0, 512, 512, 1), 1, (32768, 262144)), # Typical length
+ ((0, 512, 512, 3), 1, (98304, 786432)),
+ ((0, 0, 0, 0), 8, (0, 0)),
+ ((0, 1, 1, 1), 8, (1, 1)), # Odd length
+ ((0, 9, 1, 1), 8, (9, 9)), # Odd length
+ ((0, 1, 2, 1), 8, (2, 2)), # Even length
+ ((0, 512, 512, 1), 8, (262144, 262144)),
+ ((0, 512, 512, 3), 8, (786432, 786432)),
+ ((0, 0, 0, 0), 16, (0, 0)),
+ ((0, 1, 1, 1), 16, (2, 1)), # 16 bit data can't be odd length
+ ((0, 1, 2, 1), 16, (4, 2)),
+ ((0, 512, 512, 1), 16, (524288, 262144)),
+ ((0, 512, 512, 3), 16, (1572864, 786432)),
+ ((0, 0, 0, 0), 32, (0, 0)),
+ ((0, 1, 1, 1), 32, (4, 1)), # 32 bit data can't be odd length
+ ((0, 1, 2, 1), 32, (8, 2)),
+ ((0, 512, 512, 1), 32, (1048576, 262144)),
+ ((0, 512, 512, 3), 32, (3145728, 786432)),
+ # NumberOfFrames odd
+ ((3, 0, 0, 0), 1, (0, 0)),
+ ((3, 1, 1, 1), 1, (1, 3)),
+ ((3, 1, 1, 3), 1, (2, 9)),
+ ((3, 1, 3, 3), 1, (4, 27)),
+ ((3, 2, 4, 1), 1, (3, 24)),
+ ((3, 2, 2, 1), 1, (2, 12)),
+ ((3, 3, 3, 1), 1, (4, 27)),
+ ((3, 512, 512, 1), 1, (98304, 786432)),
+ ((3, 512, 512, 3), 1, (294912, 2359296)),
+ ((3, 0, 0, 0), 8, (0, 0)),
+ ((3, 1, 1, 1), 8, (3, 3)),
+ ((3, 9, 1, 1), 8, (27, 27)),
+ ((3, 1, 2, 1), 8, (6, 6)),
+ ((3, 512, 512, 1), 8, (786432, 786432)),
+ ((3, 512, 512, 3), 8, (2359296, 2359296)),
+ ((3, 0, 0, 0), 16, (0, 0)),
+ ((3, 512, 512, 1), 16, (1572864, 786432)),
+ ((3, 512, 512, 3), 16, (4718592, 2359296)),
+ ((3, 0, 0, 0), 32, (0, 0)),
+ ((3, 512, 512, 1), 32, (3145728, 786432)),
+ ((3, 512, 512, 3), 32, (9437184, 2359296)),
+ # NumberOfFrames even
+ ((4, 0, 0, 0), 1, (0, 0)),
+ ((4, 1, 1, 1), 1, (1, 4)),
+ ((4, 1, 1, 3), 1, (2, 12)),
+ ((4, 1, 3, 3), 1, (5, 36)),
+ ((4, 2, 4, 1), 1, (4, 32)),
+ ((4, 2, 2, 1), 1, (2, 16)),
+ ((4, 3, 3, 1), 1, (5, 36)),
+ ((4, 512, 512, 1), 1, (131072, 1048576)),
+ ((4, 512, 512, 3), 1, (393216, 3145728)),
+ ((4, 0, 0, 0), 8, (0, 0)),
+ ((4, 512, 512, 1), 8, (1048576, 1048576)),
+ ((4, 512, 512, 3), 8, (3145728, 3145728)),
+ ((4, 0, 0, 0), 16, (0, 0)),
+ ((4, 512, 512, 1), 16, (2097152, 1048576)),
+ ((4, 512, 512, 3), 16, (6291456, 3145728)),
+ ((4, 0, 0, 0), 32, (0, 0)),
+ ((4, 512, 512, 1), 32, (4194304, 1048576)),
+ ((4, 512, 512, 3), 32, (12582912, 3145728)),
+]
+
+
[email protected](not HAVE_NP, reason="Numpy is not available")
+class TestNumpy_GetExpectedLength(object):
+ """Tests for numpy_handler.get_expected_length."""
+ @pytest.mark.parametrize('shape, bits, length', REFERENCE_LENGTH)
+ def test_length_in_bytes(self, shape, bits, length):
+ """Test get_expected_length(ds, unit='bytes')."""
+ ds = Dataset()
+ ds.Rows = shape[1]
+ ds.Columns = shape[2]
+ ds.BitsAllocated = bits
+ if shape[0] != 0:
+ ds.NumberOfFrames = shape[0]
+ ds.SamplesPerPixel = shape[3]
+
+ assert length[0] == get_expected_length(ds, unit='bytes')
+
+ @pytest.mark.parametrize('shape, bits, length', REFERENCE_LENGTH)
+ def test_length_in_pixels(self, shape, bits, length):
+ """Test get_expected_length(ds, unit='pixels')."""
+ ds = Dataset()
+ ds.Rows = shape[1]
+ ds.Columns = shape[2]
+ ds.BitsAllocated = bits
+ if shape[0] != 0:
+ ds.NumberOfFrames = shape[0]
+ ds.SamplesPerPixel = shape[3]
+
+ assert length[1] == get_expected_length(ds, unit='pixels')
diff --git a/pydicom/tests/test_numpy_pixel_data.py b/pydicom/tests/test_numpy_pixel_data.py
index cc38bbdd1..616a1af8b 100644
--- a/pydicom/tests/test_numpy_pixel_data.py
+++ b/pydicom/tests/test_numpy_pixel_data.py
@@ -56,7 +56,6 @@ try:
get_pixeldata,
unpack_bits,
pack_bits,
- get_expected_length,
pixel_dtype,
)
except ImportError:
@@ -1098,105 +1097,3 @@ class TestNumpy_PackBits(object):
arr = ds.pixel_array
arr = arr.ravel()
assert ds.PixelData == pack_bits(arr)
-
-
-REFERENCE_LENGTH = [
- # (frames, rows, cols, samples), bit depth, result in (bytes, pixels)
- # No 'NumberOfFrames' in dataset
- ((0, 0, 0, 0), 1, (0, 0)),
- ((0, 1, 1, 1), 1, (1, 1)), # 1 bit -> 1 byte
- ((0, 1, 1, 3), 1, (1, 3)), # 3 bits -> 1 byte
- ((0, 1, 3, 3), 1, (2, 9)), # 9 bits -> 2 bytes
- ((0, 2, 2, 1), 1, (1, 4)), # 4 bits -> 1 byte
- ((0, 2, 4, 1), 1, (1, 8)), # 8 bits -> 1 byte
- ((0, 3, 3, 1), 1, (2, 9)), # 9 bits -> 2 bytes
- ((0, 512, 512, 1), 1, (32768, 262144)), # Typical length
- ((0, 512, 512, 3), 1, (98304, 786432)),
- ((0, 0, 0, 0), 8, (0, 0)),
- ((0, 1, 1, 1), 8, (1, 1)), # Odd length
- ((0, 9, 1, 1), 8, (9, 9)), # Odd length
- ((0, 1, 2, 1), 8, (2, 2)), # Even length
- ((0, 512, 512, 1), 8, (262144, 262144)),
- ((0, 512, 512, 3), 8, (786432, 786432)),
- ((0, 0, 0, 0), 16, (0, 0)),
- ((0, 1, 1, 1), 16, (2, 1)), # 16 bit data can't be odd length
- ((0, 1, 2, 1), 16, (4, 2)),
- ((0, 512, 512, 1), 16, (524288, 262144)),
- ((0, 512, 512, 3), 16, (1572864, 786432)),
- ((0, 0, 0, 0), 32, (0, 0)),
- ((0, 1, 1, 1), 32, (4, 1)), # 32 bit data can't be odd length
- ((0, 1, 2, 1), 32, (8, 2)),
- ((0, 512, 512, 1), 32, (1048576, 262144)),
- ((0, 512, 512, 3), 32, (3145728, 786432)),
- # NumberOfFrames odd
- ((3, 0, 0, 0), 1, (0, 0)),
- ((3, 1, 1, 1), 1, (1, 3)),
- ((3, 1, 1, 3), 1, (2, 9)),
- ((3, 1, 3, 3), 1, (4, 27)),
- ((3, 2, 4, 1), 1, (3, 24)),
- ((3, 2, 2, 1), 1, (2, 12)),
- ((3, 3, 3, 1), 1, (4, 27)),
- ((3, 512, 512, 1), 1, (98304, 786432)),
- ((3, 512, 512, 3), 1, (294912, 2359296)),
- ((3, 0, 0, 0), 8, (0, 0)),
- ((3, 1, 1, 1), 8, (3, 3)),
- ((3, 9, 1, 1), 8, (27, 27)),
- ((3, 1, 2, 1), 8, (6, 6)),
- ((3, 512, 512, 1), 8, (786432, 786432)),
- ((3, 512, 512, 3), 8, (2359296, 2359296)),
- ((3, 0, 0, 0), 16, (0, 0)),
- ((3, 512, 512, 1), 16, (1572864, 786432)),
- ((3, 512, 512, 3), 16, (4718592, 2359296)),
- ((3, 0, 0, 0), 32, (0, 0)),
- ((3, 512, 512, 1), 32, (3145728, 786432)),
- ((3, 512, 512, 3), 32, (9437184, 2359296)),
- # NumberOfFrames even
- ((4, 0, 0, 0), 1, (0, 0)),
- ((4, 1, 1, 1), 1, (1, 4)),
- ((4, 1, 1, 3), 1, (2, 12)),
- ((4, 1, 3, 3), 1, (5, 36)),
- ((4, 2, 4, 1), 1, (4, 32)),
- ((4, 2, 2, 1), 1, (2, 16)),
- ((4, 3, 3, 1), 1, (5, 36)),
- ((4, 512, 512, 1), 1, (131072, 1048576)),
- ((4, 512, 512, 3), 1, (393216, 3145728)),
- ((4, 0, 0, 0), 8, (0, 0)),
- ((4, 512, 512, 1), 8, (1048576, 1048576)),
- ((4, 512, 512, 3), 8, (3145728, 3145728)),
- ((4, 0, 0, 0), 16, (0, 0)),
- ((4, 512, 512, 1), 16, (2097152, 1048576)),
- ((4, 512, 512, 3), 16, (6291456, 3145728)),
- ((4, 0, 0, 0), 32, (0, 0)),
- ((4, 512, 512, 1), 32, (4194304, 1048576)),
- ((4, 512, 512, 3), 32, (12582912, 3145728)),
-]
-
-
[email protected](not HAVE_NP, reason="Numpy is not available")
-class TestNumpy_GetExpectedLength(object):
- """Tests for numpy_handler.get_expected_length."""
- @pytest.mark.parametrize('shape, bits, length', REFERENCE_LENGTH)
- def test_length_in_bytes(self, shape, bits, length):
- """Test get_expected_length(ds, unit='bytes')."""
- ds = Dataset()
- ds.Rows = shape[1]
- ds.Columns = shape[2]
- ds.BitsAllocated = bits
- if shape[0] != 0:
- ds.NumberOfFrames = shape[0]
- ds.SamplesPerPixel = shape[3]
-
- assert length[0] == get_expected_length(ds, unit='bytes')
-
- @pytest.mark.parametrize('shape, bits, length', REFERENCE_LENGTH)
- def test_length_in_pixels(self, shape, bits, length):
- """Test get_expected_length(ds, unit='pixels')."""
- ds = Dataset()
- ds.Rows = shape[1]
- ds.Columns = shape[2]
- ds.BitsAllocated = bits
- if shape[0] != 0:
- ds.NumberOfFrames = shape[0]
- ds.SamplesPerPixel = shape[3]
-
- assert length[1] == get_expected_length(ds, unit='pixels')
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 5
}
|
1.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"numpy>=1.16.0",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
importlib-metadata==4.8.3
iniconfig==1.1.1
numpy==1.19.5
packaging==21.3
pluggy==1.0.0
py==1.11.0
-e git+https://github.com/pydicom/pydicom.git@60bc71e1501bc8345f48f073f2dd56e9444ee780#egg=pydicom
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: pydicom
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- numpy==1.19.5
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/pydicom
|
[
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEG_LS_Tests_no_gdcm::test_JPEG_LS_PixelArray",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEG_LS_Tests_no_gdcm::test_emri_JPEG_LS_PixelArray",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEG2000Tests_no_gdcm::test_JPEG2000",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEG2000Tests_no_gdcm::test_JPEG2000PixelArray",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEG2000Tests_no_gdcm::test_emri_JPEG2000PixelArray",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEG2000Tests_no_gdcm::test_jpeg2000_lossy",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEGlossyTests_no_gdcm::test_JPEGBaselineColor3DPixelArray",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEGlossyTests_no_gdcm::test_JPEGlossy",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEGlossyTests_no_gdcm::test_JPEGlossyPixelArray",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEGlosslessTests_no_gdcm::testJPEGlossless",
"pydicom/tests/test_gdcm_pixel_data.py::GDCM_JPEGlosslessTests_no_gdcm::testJPEGlosslessPixelArray",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_unknown_pixel_representation_raises",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_unknown_bits_allocated_raises",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_unsupported_dtypes",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_supported_dtypes[1-0-uint8]",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_supported_dtypes[1-1-uint8]",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_supported_dtypes[8-0-uint8]",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_supported_dtypes[8-1-int8]",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_supported_dtypes[16-0-uint16]",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_supported_dtypes[16-1-int16]",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_supported_dtypes[32-0-uint32]",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_supported_dtypes[32-1-int32]",
"pydicom/tests/test_handler_util.py::TestNumpy_PixelDtype::test_byte_swapping",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_reference_1frame_1sample",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_reference_1frame_3sample",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_reference_2frame_1sample",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_reference_2frame_3sample",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_1frame_1sample",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_1frame_3sample_0conf",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_1frame_3sample_1conf",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_2frame_1sample",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_2frame_3sample_0conf",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_2frame_3sample_1conf",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_compressed_syntaxes_0conf",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_compressed_syntaxes_1conf",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_uncompressed_syntaxes",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_invalid_nr_frames_raises",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_invalid_samples_raises",
"pydicom/tests/test_handler_util.py::TestNumpy_ReshapePixelArray::test_invalid_planar_conf_raises",
"pydicom/tests/test_handler_util.py::TestNumpy_ConvertColourSpace::test_unknown_current_raises",
"pydicom/tests/test_handler_util.py::TestNumpy_ConvertColourSpace::test_unknown_desired_raises",
"pydicom/tests/test_handler_util.py::TestNumpy_ConvertColourSpace::test_current_is_desired",
"pydicom/tests/test_handler_util.py::TestNumpy_ConvertColourSpace::test_rgb_ybr_rgb_single_frame",
"pydicom/tests/test_handler_util.py::TestNumpy_ConvertColourSpace::test_rgb_ybr_rgb_multi_frame",
"pydicom/tests/test_handler_util.py::TestNumpy_DtypeCorrectedForEndianness::test_byte_swapping",
"pydicom/tests/test_handler_util.py::TestNumpy_DtypeCorrectedForEndianness::test_no_endian_raises",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape0-1-length0]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape1-1-length1]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape2-1-length2]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape3-1-length3]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape4-1-length4]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape5-1-length5]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape6-1-length6]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape7-1-length7]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape8-1-length8]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape9-8-length9]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape10-8-length10]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape11-8-length11]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape12-8-length12]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape13-8-length13]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape14-8-length14]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape15-16-length15]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape16-16-length16]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape17-16-length17]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape18-16-length18]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape19-16-length19]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape20-32-length20]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape21-32-length21]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape22-32-length22]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape23-32-length23]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape24-32-length24]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape25-1-length25]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape26-1-length26]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape27-1-length27]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape28-1-length28]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape29-1-length29]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape30-1-length30]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape31-1-length31]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape32-1-length32]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape33-1-length33]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape34-8-length34]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape35-8-length35]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape36-8-length36]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape37-8-length37]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape38-8-length38]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape39-8-length39]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape40-16-length40]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape41-16-length41]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape42-16-length42]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape43-32-length43]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape44-32-length44]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape45-32-length45]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape46-1-length46]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape47-1-length47]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape48-1-length48]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape49-1-length49]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape50-1-length50]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape51-1-length51]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape52-1-length52]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape53-1-length53]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape54-1-length54]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape55-8-length55]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape56-8-length56]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape57-8-length57]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape58-16-length58]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape59-16-length59]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape60-16-length60]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape61-32-length61]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape62-32-length62]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_bytes[shape63-32-length63]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape0-1-length0]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape1-1-length1]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape2-1-length2]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape3-1-length3]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape4-1-length4]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape5-1-length5]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape6-1-length6]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape7-1-length7]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape8-1-length8]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape9-8-length9]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape10-8-length10]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape11-8-length11]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape12-8-length12]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape13-8-length13]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape14-8-length14]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape15-16-length15]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape16-16-length16]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape17-16-length17]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape18-16-length18]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape19-16-length19]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape20-32-length20]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape21-32-length21]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape22-32-length22]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape23-32-length23]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape24-32-length24]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape25-1-length25]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape26-1-length26]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape27-1-length27]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape28-1-length28]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape29-1-length29]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape30-1-length30]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape31-1-length31]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape32-1-length32]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape33-1-length33]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape34-8-length34]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape35-8-length35]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape36-8-length36]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape37-8-length37]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape38-8-length38]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape39-8-length39]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape40-16-length40]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape41-16-length41]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape42-16-length42]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape43-32-length43]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape44-32-length44]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape45-32-length45]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape46-1-length46]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape47-1-length47]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape48-1-length48]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape49-1-length49]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape50-1-length50]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape51-1-length51]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape52-1-length52]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape53-1-length53]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape54-1-length54]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape55-8-length55]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape56-8-length56]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape57-8-length57]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape58-16-length58]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape59-16-length59]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape60-16-length60]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape61-32-length61]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape62-32-length62]",
"pydicom/tests/test_handler_util.py::TestNumpy_GetExpectedLength::test_length_in_pixels[shape63-32-length63]",
"pydicom/tests/test_numpy_pixel_data.py::test_unsupported_syntaxes",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_environment",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_can_access_supported_dataset",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/SC_rgb_jpeg_dcmtk.dcm-data0]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/JPEG-lossy.dcm-data1]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/SC_rgb_jpeg_gdcm.dcm-data2]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/MR_small_jpeg_ls_lossless.dcm-data3]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/emri_small_jpeg_2k_lossless.dcm-data4]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/JPEG2000.dcm-data5]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/MR_small_RLE.dcm-data6]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NoNumpyHandler::test_pixel_array_raises",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_environment",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_unsupported_syntax_raises",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_dataset_pixel_array_handler_needs_convert",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/SC_rgb_jpeg_dcmtk.dcm-data0]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/JPEG-lossy.dcm-data1]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/SC_rgb_jpeg_gdcm.dcm-data2]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/MR_small_jpeg_ls_lossless.dcm-data3]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/emri_small_jpeg_2k_lossless.dcm-data4]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/JPEG2000.dcm-data5]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_can_access_unsupported_dataset[/pydicom/pydicom/data/test_files/MR_small_RLE.dcm-data6]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_pixel_array_8bit_un_signed",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_pixel_array_16bit_un_signed",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_pixel_array_32bit_un_signed",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_8bit_1sample_1frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_8bit_1sample_2frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_8bit_3sample_1frame_odd_size",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_8bit_3sample_1frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_8bit_3sample_2frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/liver_1frame.dcm-data0]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/liver.dcm-data1]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/OBXXXX1A.dcm-data2]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/SC_rgb_small_odd.dcm-data3]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/OBXXXX1A_2frame.dcm-data4]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/SC_rgb.dcm-data5]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/SC_rgb_2frame.dcm-data6]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/MR_small.dcm-data7]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/emri_small.dcm-data8]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/SC_rgb_16bit.dcm-data9]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/SC_rgb_16bit_2frame.dcm-data10]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/rtdose_1frame.dcm-data11]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/rtdose.dcm-data12]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/SC_rgb_32bit.dcm-data13]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_properties[/pydicom/pydicom/data/test_files/SC_rgb_32bit_2frame.dcm-data14]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_1bit_1sample_1frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_1bit_1sample_3frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_16bit_1sample_1frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_16bit_1sample_10frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_16bit_3sample_1frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_16bit_3sample_2frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_32bit_1sample_1frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_32bit_1sample_15frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_32bit_3sample_1frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_little_32bit_3sample_2frame",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/liver_1frame.dcm-/pydicom/pydicom/data/test_files/liver_expb_1frame.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/liver.dcm-/pydicom/pydicom/data/test_files/liver_expb.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/OBXXXX1A.dcm-/pydicom/pydicom/data/test_files/OBXXXX1A_expb.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/OBXXXX1A_2frame.dcm-/pydicom/pydicom/data/test_files/OBXXXX1A_expb_2frame.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/SC_rgb.dcm-/pydicom/pydicom/data/test_files/SC_rgb_expb.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/SC_rgb_2frame.dcm-/pydicom/pydicom/data/test_files/SC_rgb_expb_2frame.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/MR_small.dcm-/pydicom/pydicom/data/test_files/MR_small_expb.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/emri_small.dcm-/pydicom/pydicom/data/test_files/emri_small_big_endian.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/SC_rgb_16bit.dcm-/pydicom/pydicom/data/test_files/SC_rgb_expb_16bit.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/SC_rgb_16bit_2frame.dcm-/pydicom/pydicom/data/test_files/SC_rgb_expb_16bit_2frame.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/rtdose_1frame.dcm-/pydicom/pydicom/data/test_files/rtdose_expb_1frame.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/rtdose.dcm-/pydicom/pydicom/data/test_files/rtdose_expb.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/SC_rgb_32bit.dcm-/pydicom/pydicom/data/test_files/SC_rgb_expb_32bit.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_big_endian_datasets[/pydicom/pydicom/data/test_files/SC_rgb_32bit_2frame.dcm-/pydicom/pydicom/data/test_files/SC_rgb_expb_32bit_2frame.dcm]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_endianness_not_set",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_NumpyHandler::test_read_only",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_GetPixelData::test_no_pixel_data_raises",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_GetPixelData::test_unknown_pixel_representation_raises",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_GetPixelData::test_unsupported_syntaxes_raises",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_GetPixelData::test_bad_length_raises",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_GetPixelData::test_change_photometric_interpretation",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_GetPixelData::test_array_read_only",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_GetPixelData::test_array_read_only_bit_packed",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[-output0]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x00-output1]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x01-output2]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x02-output3]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x04-output4]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x08-output5]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x10-output6]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[@-output8]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x80-output9]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\xaa-output10]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\xf0-output11]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x0f-output12]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\xff-output13]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x00\\x00-output14]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x00\\x01-output15]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x00\\x80-output16]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x00\\xff-output17]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x01\\x80-output18]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\x80\\x80-output19]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_UnpackBits::test_unpack[\\xff\\x80-output20]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[-input0]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x00-input1]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x01-input2]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x02-input3]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x04-input4]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x08-input5]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x10-input6]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[@-input8]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x80-input9]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\xaa-input10]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\xf0-input11]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x0f-input12]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\xff-input13]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x00\\x00-input14]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x00\\x01-input15]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x00\\x80-input16]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x00\\xff-input17]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x01\\x80-input18]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\x80\\x80-input19]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack[\\xff\\x80-input20]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_non_binary_input",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_non_array_input",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x00@-input0]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x00",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x00\\x10-input2]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x00\\x08-input3]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x00\\x04-input4]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x00\\x02-input5]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x00\\x01-input6]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x80-input7]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[@-input8]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x10-input10]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x08-input11]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x04-input12]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x02-input13]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[\\x01-input14]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_pack_partial[-input15]",
"pydicom/tests/test_numpy_pixel_data.py::TestNumpy_PackBits::test_functional"
] |
[] |
[] |
[] |
MIT License
| 3,205 |
[
"pydicom/pixel_data_handlers/numpy_handler.py",
"build_tools/travis/install.sh",
"pydicom/pixel_data_handlers/util.py",
".travis.yml",
"pydicom/pixel_data_handlers/gdcm_handler.py"
] |
[
"pydicom/pixel_data_handlers/numpy_handler.py",
"build_tools/travis/install.sh",
"pydicom/pixel_data_handlers/util.py",
".travis.yml",
"pydicom/pixel_data_handlers/gdcm_handler.py"
] |
tox-dev__tox-1048
|
bf51012768b314de891629bff1e61f07a90785ca
|
2018-10-09 08:18:58
|
b84efc8f1074351bbba7e226d629d9114e0cc1a4
|
diff --git a/docs/changelog/1042.bugfix.rst b/docs/changelog/1042.bugfix.rst
index 53bde7e2..14d27749 100644
--- a/docs/changelog/1042.bugfix.rst
+++ b/docs/changelog/1042.bugfix.rst
@@ -1,4 +1,4 @@
session packages are now put inside a numbered directory (instead of prefix numbering it,
because pip fails when wheels are not named according to
`PEP-491 <https://www.python.org/dev/peps/pep-0491/#id9>`_, and prefix numbering messes with this)
-- by user:`gaborbernat`
+- by :user:`gaborbernat`
diff --git a/docs/changelog/1047.feature.rst b/docs/changelog/1047.feature.rst
new file mode 100644
index 00000000..074a3574
--- /dev/null
+++ b/docs/changelog/1047.feature.rst
@@ -0,0 +1,1 @@
+level three verbosity (``-vvv``) show the packaging output - by :user:`gaborbernat`
diff --git a/src/tox/package.py b/src/tox/package.py
index 45c88829..e75a9f18 100644
--- a/src/tox/package.py
+++ b/src/tox/package.py
@@ -143,10 +143,12 @@ def make_sdist_legacy(report, config, session):
with session.newaction(None, "packaging") as action:
action.setactivity("sdist-make", setup)
session.make_emptydir(config.distdir)
- action.popen(
+ build_log = action.popen(
[sys.executable, setup, "sdist", "--formats=zip", "--dist-dir", config.distdir],
cwd=config.setupdir,
+ returnout=True,
)
+ report.verbosity2(build_log)
try:
return config.distdir.listdir()[0]
except py.error.ENOENT:
@@ -195,7 +197,7 @@ def build_isolated(config, report, session):
) as action:
package_venv.run_install_command(packages=build_requires_dep, action=action)
session.finishvenv(package_venv)
- return perform_isolated_build(build_info, package_venv, session, config)
+ return perform_isolated_build(build_info, package_venv, session, config, report)
def get_build_info(folder, report):
@@ -238,7 +240,7 @@ def get_build_info(folder, report):
return BuildInfo(requires, module, "{}{}".format(module, obj))
-def perform_isolated_build(build_info, package_venv, session, config):
+def perform_isolated_build(build_info, package_venv, session, config, report):
with session.newaction(
package_venv, "perform-isolated-build", package_venv.envconfig.envdir
) as action:
@@ -263,6 +265,7 @@ def perform_isolated_build(build_info, package_venv, session, config):
action=action,
cwd=session.config.setupdir,
)
+ report.verbosity2(result)
return config.distdir.join(result.split("\n")[-2])
diff --git a/src/tox/venv.py b/src/tox/venv.py
index 12cd44cd..29d5b644 100755
--- a/src/tox/venv.py
+++ b/src/tox/venv.py
@@ -91,7 +91,7 @@ class CreationConfig:
if self_deps != other_deps:
if deps_matches_subset:
diff = other_deps - self_deps
- if not diff:
+ if diff:
return False, "missing in previous {!r}".format(diff)
else:
return False, "{!r}!={!r}".format(self_deps, other_deps)
|
show packaging output
We should show packaging output when three level verbosity is passed in. This would help often with tracking down packaging issues. Three levels, as we reserve the first two as tox levels, two plus is verbosity for elements called by tox.
|
tox-dev/tox
|
diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py
index 46014b5b..9c117eb4 100644
--- a/tests/unit/test_package.py
+++ b/tests/unit/test_package.py
@@ -404,3 +404,40 @@ def test_install_via_installpkg(mock_venv, initproj, cmd):
fake_package = base.ensure(".tox", "dist", "pkg123-0.1.zip")
result = cmd("-e", "py", "--notest", "--installpkg", str(fake_package.relto(base)))
assert result.ret == 0, result.out
+
+
+def test_verbose_isolated_build(initproj, mock_venv, cmd):
+ initproj(
+ "example123-0.5",
+ filedefs={
+ "tox.ini": """
+ [tox]
+ isolated_build = true
+ """,
+ "pyproject.toml": """
+ [build-system]
+ requires = ["setuptools >= 35.0.2"]
+ build-backend = 'setuptools.build_meta'
+ """,
+ },
+ )
+ result = cmd("--sdistonly", "-vvv")
+ assert "running sdist" in result.out, result.out
+ assert "running egg_info" in result.out, result.out
+ assert "Writing example123-0.5{}setup.cfg".format(os.sep) in result.out, result.out
+
+
+def test_verbose_legacy_build(initproj, mock_venv, cmd):
+ initproj(
+ "example123-0.5",
+ filedefs={
+ "tox.ini": """
+ [tox]
+ isolated_build = false
+ """
+ },
+ )
+ result = cmd("--sdistonly", "-vvv")
+ assert "running sdist" in result.out, result.out
+ assert "running egg_info" in result.out, result.out
+ assert "Writing example123-0.5{}setup.cfg".format(os.sep) in result.out, result.out
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 3
}
|
3.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-timeout"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
coverage==6.2
distlib==0.3.9
execnet==1.9.0
filelock==3.4.1
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-timeout==2.1.0
pytest-xdist==3.0.2
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
-e git+https://github.com/tox-dev/tox.git@bf51012768b314de891629bff1e61f07a90785ca#egg=tox
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
virtualenv==20.17.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: tox
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==6.2
- distlib==0.3.9
- execnet==1.9.0
- filelock==3.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- platformdirs==2.4.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-timeout==2.1.0
- pytest-xdist==3.0.2
- six==1.17.0
- tomli==1.2.3
- virtualenv==20.17.1
prefix: /opt/conda/envs/tox
|
[
"tests/unit/test_package.py::test_verbose_isolated_build",
"tests/unit/test_package.py::test_verbose_legacy_build"
] |
[
"tests/unit/test_package.py::test_package_isolated_toml_no_build_system",
"tests/unit/test_package.py::test_package_isolated_toml_no_requires",
"tests/unit/test_package.py::test_package_isolated_toml_no_backend",
"tests/unit/test_package.py::test_package_isolated_toml_bad_requires",
"tests/unit/test_package.py::test_package_isolated_toml_bad_backend"
] |
[
"tests/unit/test_package.py::test_make_sdist",
"tests/unit/test_package.py::test_make_sdist_distshare",
"tests/unit/test_package.py::test_sdistonly",
"tests/unit/test_package.py::test_separate_sdist_no_sdistfile",
"tests/unit/test_package.py::test_separate_sdist",
"tests/unit/test_package.py::test_sdist_latest",
"tests/unit/test_package.py::test_installpkg",
"tests/unit/test_package.py::test_package_isolated_no_pyproject_toml",
"tests/unit/test_package.py::test_dist_exists_version_change",
"tests/unit/test_package.py::test_tox_parallel_build_safe",
"tests/unit/test_package.py::test_install_via_installpkg"
] |
[] |
MIT License
| 3,206 |
[
"docs/changelog/1042.bugfix.rst",
"src/tox/package.py",
"docs/changelog/1047.feature.rst",
"src/tox/venv.py"
] |
[
"docs/changelog/1042.bugfix.rst",
"src/tox/package.py",
"docs/changelog/1047.feature.rst",
"src/tox/venv.py"
] |
|
Duke-GCB__bespin-cli-15
|
70450d7b00c477580d6851b8aaa65433a54cf415
|
2018-10-09 13:37:32
|
2cef15b8296373f564d5cdf3c34503c1ca7f1e29
|
diff --git a/bespin/argparser.py b/bespin/argparser.py
index 5fc8fa3..f97d735 100644
--- a/bespin/argparser.py
+++ b/bespin/argparser.py
@@ -40,6 +40,8 @@ class ArgParser(object):
jobs_subparser = jobs_parser.add_subparsers()
list_jobs_parser = jobs_subparser.add_parser('list', description='list workflows')
+ list_jobs_parser.add_argument('-a', '--all', action='store_true',
+ help='show all workflow versions instead of just the most recent.')
list_jobs_parser.set_defaults(func=self._run_list_workflows)
def _create_job_parser(self, subparsers):
@@ -79,8 +81,8 @@ class ArgParser(object):
def _run_list_jobs(self, _):
self.target_object.jobs_list()
- def _run_list_workflows(self, _):
- self.target_object.workflows_list()
+ def _run_list_workflows(self, args):
+ self.target_object.workflows_list(all_versions=args.all)
def _run_init_job(self, args):
self.target_object.init_job(args.tag, args.outfile)
diff --git a/bespin/commands.py b/bespin/commands.py
index 8f7271d..c8c1fb6 100644
--- a/bespin/commands.py
+++ b/bespin/commands.py
@@ -44,6 +44,7 @@ USER_PLACEHOLDER_DICT = {
}
}
+
class Commands(object):
"""
Commands run based on command line input.
@@ -61,12 +62,13 @@ class Commands(object):
config = ConfigFile().read_or_create_config()
return BespinApi(config, user_agent_str=self.user_agent_str)
- def workflows_list(self):
+ def workflows_list(self, all_versions):
"""
Print out a table of workflows/questionnaires
+ :param all_versions: bool: when true show all versions otherwise show most recent
"""
api = self._create_api()
- workflow_data = WorkflowDetails(api)
+ workflow_data = WorkflowDetails(api, all_versions)
print(Table(workflow_data.column_names, workflow_data.get_column_data()))
def jobs_list(self):
@@ -167,10 +169,11 @@ class WorkflowDetails(object):
"""
Creates column data based on workflows/questionnaires
"""
- TAG_COLUMN_NAME = "latest version tag"
+ TAG_COLUMN_NAME = "version tag"
- def __init__(self, api):
+ def __init__(self, api, all_versions):
self.api = api
+ self.all_versions = all_versions
self.column_names = ["id", "name", self.TAG_COLUMN_NAME]
def get_column_data(self):
@@ -181,10 +184,13 @@ class WorkflowDetails(object):
data = []
for workflow in self.api.workflows_list():
if len(workflow['versions']):
- latest_version = workflow['versions'][-1]
- for questionnaire in self.api.questionnaires_list(workflow_version=latest_version):
- workflow[self.TAG_COLUMN_NAME] = questionnaire['tag']
- data.append(workflow)
+ versions = workflow['versions']
+ if not self.all_versions:
+ versions = versions[-1:]
+ for version in versions:
+ for questionnaire in self.api.questionnaires_list(workflow_version=version):
+ workflow[self.TAG_COLUMN_NAME] = questionnaire['tag']
+ data.append(dict(workflow))
return data
|
Allow listing all workflow versions
Allow users to see all version of workflows so the can pick older tags.
Initially we thought users could just change the `v#` portion of the tags, but due to changes in the suffix portion of tags this is not possible.
|
Duke-GCB/bespin-cli
|
diff --git a/bespin/test_argparse.py b/bespin/test_argparse.py
index 1f1cd6e..1af15be 100644
--- a/bespin/test_argparse.py
+++ b/bespin/test_argparse.py
@@ -10,9 +10,17 @@ class ArgParserTestCase(TestCase):
self.target_object = Mock()
self.arg_parser = ArgParser(version_str='1.0', target_object=self.target_object)
- def test_workflows_list(self):
+ def test_workflows_list_current_versions(self):
self.arg_parser.parse_and_run_commands(["workflows", "list"])
- self.target_object.workflows_list.assert_called()
+ self.target_object.workflows_list.assert_called_with(all_versions=False)
+
+ def test_workflows_list_all_versions(self):
+ self.arg_parser.parse_and_run_commands(["workflows", "list", "--all"])
+ self.target_object.workflows_list.assert_called_with(all_versions=True)
+
+ def test_workflows_list_all_versions_short_flag(self):
+ self.arg_parser.parse_and_run_commands(["workflows", "list", "-a"])
+ self.target_object.workflows_list.assert_called_with(all_versions=True)
def test_init_job(self):
self.arg_parser.parse_and_run_commands(["jobs", "init", "--tag", "exome/v1/human"])
diff --git a/bespin/test_commands.py b/bespin/test_commands.py
index e3756c8..5bd78a8 100644
--- a/bespin/test_commands.py
+++ b/bespin/test_commands.py
@@ -18,13 +18,30 @@ class CommandsTestCase(TestCase):
@patch('bespin.commands.WorkflowDetails')
@patch('bespin.commands.Table')
@patch('bespin.commands.print')
- def test_workflows_list(self, mock_print, mock_table, mock_workflow_details, mock_bespin_api, mock_config_file):
+ def test_workflows_list_latest_versions(self, mock_print, mock_table, mock_workflow_details, mock_bespin_api,
+ mock_config_file):
commands = Commands(self.version_str, self.user_agent_str)
- commands.workflows_list()
+ commands.workflows_list(all_versions=False)
workflow_details = mock_workflow_details.return_value
mock_table.assert_called_with(workflow_details.column_names,
workflow_details.get_column_data.return_value)
mock_print.assert_called_with(mock_table.return_value)
+ mock_workflow_details.assert_called_with(mock_bespin_api.return_value, False)
+
+ @patch('bespin.commands.ConfigFile')
+ @patch('bespin.commands.BespinApi')
+ @patch('bespin.commands.WorkflowDetails')
+ @patch('bespin.commands.Table')
+ @patch('bespin.commands.print')
+ def test_workflows_list_all_versions(self, mock_print, mock_table, mock_workflow_details, mock_bespin_api,
+ mock_config_file):
+ commands = Commands(self.version_str, self.user_agent_str)
+ commands.workflows_list(all_versions=True)
+ workflow_details = mock_workflow_details.return_value
+ mock_table.assert_called_with(workflow_details.column_names,
+ workflow_details.get_column_data.return_value)
+ mock_print.assert_called_with(mock_table.return_value)
+ mock_workflow_details.assert_called_with(mock_bespin_api.return_value, True)
@patch('bespin.commands.ConfigFile')
@patch('bespin.commands.BespinApi')
@@ -156,9 +173,9 @@ class WorkflowDetailsTestCase(TestCase):
mock_api.questionnaires_list.return_value = [
{'tag': 'exome/v2/human'}
]
- details = WorkflowDetails(mock_api)
+ details = WorkflowDetails(mock_api, all_versions=False)
expected_data = [{'id': 1,
- 'latest version tag': 'exome/v2/human',
+ 'version tag': 'exome/v2/human',
'name': 'exome',
'versions': [1, 2]}]
column_data = details.get_column_data()
@@ -166,12 +183,50 @@ class WorkflowDetailsTestCase(TestCase):
self.assertEqual(column_data, expected_data)
mock_api.questionnaires_list.assert_called_with(workflow_version=2)
- def test_ignores_workflows_without_versions(self):
+ mock_api.questionnaires_list.reset_mock()
+ mock_api.questionnaires_list.side_effect = [
+ [{'tag': 'exome/v1/human'}],
+ [{'tag': 'exome/v2/human'}]
+ ]
+ details = WorkflowDetails(mock_api, all_versions=True)
+ expected_data = [
+ {
+ 'id': 1,
+ 'version tag': 'exome/v1/human',
+ 'name': 'exome',
+ 'versions': [1, 2]
+ },
+ {
+ 'id': 1,
+ 'version tag': 'exome/v2/human',
+ 'name': 'exome',
+ 'versions': [1, 2]
+ },
+ ]
+ column_data = details.get_column_data()
+ self.assertEqual(len(column_data), 2)
+ self.assertEqual(column_data, expected_data)
+ mock_api.questionnaires_list.assert_has_calls([
+ call(workflow_version=1),
+ call(workflow_version=2),
+ ])
+
+ def test_ignores_workflows_without_versions_when_latest(self):
+ mock_api = Mock()
+ mock_api.workflows_list.return_value = [
+ {'id': 1, 'name': 'no-versions', 'versions': []},
+ ]
+ details = WorkflowDetails(mock_api, all_versions=False)
+ column_data = details.get_column_data()
+ self.assertEqual(len(column_data), 0)
+ mock_api.questionnaires_list.assert_not_called()
+
+ def test_ignores_workflows_without_versions_when_all(self):
mock_api = Mock()
mock_api.workflows_list.return_value = [
{'id': 1, 'name': 'no-versions', 'versions': []},
]
- details = WorkflowDetails(mock_api)
+ details = WorkflowDetails(mock_api, all_versions=True)
column_data = details.get_column_data()
self.assertEqual(len(column_data), 0)
mock_api.questionnaires_list.assert_not_called()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 2
}
|
0.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"devRequirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
azure-common==1.1.28
azure-core==1.32.0
azure-identity==1.21.0
azure-mgmt-core==1.5.0
azure-mgmt-storage==22.1.1
azure-storage-blob==12.25.1
azure-storage-file-datalake==12.20.0
-e git+https://github.com/Duke-GCB/bespin-cli.git@70450d7b00c477580d6851b8aaa65433a54cf415#egg=bespin_cli
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
cryptography==44.0.2
DukeDSClient==4.0.0
exceptiongroup==1.2.2
future==1.0.0
idna==3.10
iniconfig==2.1.0
isodate==0.7.2
mock==2.0.0
msal==1.32.0
msal-extensions==1.3.1
msgraph-core==0.2.2
packaging==24.2
pbr==6.1.1
pluggy==1.5.0
pycparser==2.22
PyJWT==2.10.1
pytest==8.3.5
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
six==1.17.0
tabulate==0.9.0
tenacity==6.2.0
tomli==2.2.1
typing_extensions==4.13.0
urllib3==2.3.0
|
name: bespin-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- azure-common==1.1.28
- azure-core==1.32.0
- azure-identity==1.21.0
- azure-mgmt-core==1.5.0
- azure-mgmt-storage==22.1.1
- azure-storage-blob==12.25.1
- azure-storage-file-datalake==12.20.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- cryptography==44.0.2
- dukedsclient==4.0.0
- exceptiongroup==1.2.2
- future==1.0.0
- idna==3.10
- iniconfig==2.1.0
- isodate==0.7.2
- mock==2.0.0
- msal==1.32.0
- msal-extensions==1.3.1
- msgraph-core==0.2.2
- packaging==24.2
- pbr==6.1.1
- pluggy==1.5.0
- pycparser==2.22
- pyjwt==2.10.1
- pytest==8.3.5
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- six==1.17.0
- tabulate==0.9.0
- tenacity==6.2.0
- tomli==2.2.1
- typing-extensions==4.13.0
- urllib3==2.3.0
prefix: /opt/conda/envs/bespin-cli
|
[
"bespin/test_argparse.py::ArgParserTestCase::test_workflows_list_all_versions",
"bespin/test_argparse.py::ArgParserTestCase::test_workflows_list_all_versions_short_flag",
"bespin/test_argparse.py::ArgParserTestCase::test_workflows_list_current_versions",
"bespin/test_commands.py::CommandsTestCase::test_workflows_list_all_versions",
"bespin/test_commands.py::CommandsTestCase::test_workflows_list_latest_versions",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_get_column_data",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_ignores_workflows_without_versions_when_all",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_ignores_workflows_without_versions_when_latest"
] |
[
"bespin/test_commands.py::JobFileTestCase::test_yaml_str"
] |
[
"bespin/test_argparse.py::ArgParserTestCase::test_cancel_job",
"bespin/test_argparse.py::ArgParserTestCase::test_create_job",
"bespin/test_argparse.py::ArgParserTestCase::test_delete_job",
"bespin/test_argparse.py::ArgParserTestCase::test_init_job",
"bespin/test_argparse.py::ArgParserTestCase::test_restart_job",
"bespin/test_argparse.py::ArgParserTestCase::test_start_job",
"bespin/test_argparse.py::ArgParserTestCase::test_start_job_with_optional_token",
"bespin/test_commands.py::CommandsTestCase::test_cancel_job",
"bespin/test_commands.py::CommandsTestCase::test_create_job",
"bespin/test_commands.py::CommandsTestCase::test_delete_job",
"bespin/test_commands.py::CommandsTestCase::test_init_job",
"bespin/test_commands.py::CommandsTestCase::test_jobs_list",
"bespin/test_commands.py::CommandsTestCase::test_restart_job",
"bespin/test_commands.py::CommandsTestCase::test_start_job_no_token",
"bespin/test_commands.py::CommandsTestCase::test_start_job_with_token",
"bespin/test_commands.py::TableTestCase::test_str",
"bespin/test_commands.py::JobFileTestCase::test_create_job",
"bespin/test_commands.py::JobFileTestCase::test_create_user_job_order_json",
"bespin/test_commands.py::JobFileTestCase::test_get_dds_files_details",
"bespin/test_commands.py::JobFileLoaderTestCase::test_create_job_file",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_invalid_job_order_params",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_invalid_name_and_fund_code",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_ok",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_create_job_file_with_placeholders",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_create_placeholder_value",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_format_user_fields",
"bespin/test_commands.py::JobOrderWalkerTestCase::test_format_file_path",
"bespin/test_commands.py::JobOrderWalkerTestCase::test_walk",
"bespin/test_commands.py::JobOrderPlaceholderCheckTestCase::test_walk",
"bespin/test_commands.py::JobOrderFormatFilesTestCase::test_walk",
"bespin/test_commands.py::JobOrderFileDetailsTestCase::test_walk",
"bespin/test_commands.py::JobsListTestCase::test_column_names",
"bespin/test_commands.py::JobsListTestCase::test_get_column_data",
"bespin/test_commands.py::JobsListTestCase::test_get_elapsed_hours",
"bespin/test_commands.py::JobsListTestCase::test_get_workflow_tag"
] |
[] |
MIT License
| 3,207 |
[
"bespin/argparser.py",
"bespin/commands.py"
] |
[
"bespin/argparser.py",
"bespin/commands.py"
] |
|
Duke-GCB__DukeDSClient-210
|
570bc4954d51f662e294b2f2352248623ea8bf8b
|
2018-10-09 17:15:36
|
a925790870cc14a61f04b2d7cd6075fe39be2690
|
diff --git a/ddsc/core/ddsapi.py b/ddsc/core/ddsapi.py
index c026b27..71710f4 100644
--- a/ddsc/core/ddsapi.py
+++ b/ddsc/core/ddsapi.py
@@ -609,12 +609,21 @@ class DataServiceApi(object):
}
return self._get_collection('/users', data)
- def get_all_users(self):
+ def get_users(self, full_name=None, email=None, username=None):
"""
- Send GET request to /users for all users.
+ Send GET request to /users for users with optional full_name, email, and/or username filtering.
+ :param full_name: str name of the user we are searching for
+ :param email: str: optional email to filter by
+ :param username: str: optional username to filter by
:return: requests.Response containing the successful result
"""
data = {}
+ if full_name:
+ data['full_name_contains'] = full_name
+ if email:
+ data['email'] = email
+ if username:
+ data['username'] = username
return self._get_collection('/users', data)
def get_user_by_id(self, id):
@@ -947,6 +956,26 @@ class DataServiceApi(object):
"""
return self._get_collection("/auth_providers", {})
+ def get_auth_provider(self, auth_provider_id):
+ """
+ Get auth provider details.
+ :param auth_provider_id: str: uuid of the auth provider
+ :return: requests.Response containing the successful result
+ """
+ return self._get_single_item('/auth_providers/{}/'.format(auth_provider_id), {})
+
+ def get_auth_provider_affiliates(self, auth_provider_id, full_name_contains):
+ """
+ List affiliates for a specific auth provider.
+ :param auth_provider_id: str: uuid of the auth provider to list affiliates of
+ :param full_name_contains: str: filters affiliates for this name
+ :return: requests.Response containing the successful result
+ """
+ data = {
+ 'full_name_contains': full_name_contains
+ }
+ return self._get_collection("/auth_providers/{}/affiliates/".format(auth_provider_id), data)
+
def auth_provider_add_user(self, auth_provider_id, username):
"""
Transform an institutional affiliates UID, such as a Duke NetID, to a DDS specific user identity;
|
Make use of DukeDS user filtering improvements
DukeDS API has been updated to allow filtering users by email and/or username: https://github.com/Duke-Translational-Bioinformatics/duke-data-service/issues/1103
This will speed up how long it takes to list users.
NOTE: This is new feature currently deployed to DukeDS dev API.
|
Duke-GCB/DukeDSClient
|
diff --git a/ddsc/core/remotestore.py b/ddsc/core/remotestore.py
index 178169d..35454bc 100644
--- a/ddsc/core/remotestore.py
+++ b/ddsc/core/remotestore.py
@@ -122,7 +122,7 @@ class RemoteStore(object):
:param username: str username we are looking for
:return: RemoteUser: user we found
"""
- matches = [user for user in self.fetch_all_users() if user.username == username]
+ matches = self.fetch_users(username=username)
if not matches:
raise NotFoundError('Username not found: {}.'.format(username))
if len(matches) > 1:
@@ -180,9 +180,9 @@ class RemoteStore(object):
:param email: str email we are looking for
:return: RemoteUser user we found
"""
- matches = [user for user in self.fetch_all_users() if user.email == email]
+ matches = self.fetch_users(email=email)
if not matches:
- raise ValueError('Email not found: {}.'.format(email))
+ raise NotFoundError('Email not found: {}.'.format(email))
if len(matches) > 1:
raise ValueError('Multiple users with same email found: {}.'.format(email))
return matches[0]
@@ -195,13 +195,15 @@ class RemoteStore(object):
response = self.data_service.get_current_user().json()
return RemoteUser(response)
- def fetch_all_users(self):
+ def fetch_users(self, email=None, username=None):
"""
- Retrieves all users from data service.
+ Retrieves users with optional email and/or username filtering from data service.
+ :param email: str: optional email to filter by
+ :param username: str: optional username to filter by
:return: [RemoteUser] list of all users we downloaded
"""
users = []
- result = self.data_service.get_all_users()
+ result = self.data_service.get_users(email=email, username=username)
user_list_json = result.json()
for user_json in user_list_json['results']:
users.append(RemoteUser(user_json))
diff --git a/ddsc/core/tests/test_ddsapi.py b/ddsc/core/tests/test_ddsapi.py
index 08810ce..2f4a471 100644
--- a/ddsc/core/tests/test_ddsapi.py
+++ b/ddsc/core/tests/test_ddsapi.py
@@ -5,7 +5,7 @@ from ddsc.core.ddsapi import MultiJSONResponse, DataServiceApi, DataServiceAuth,
from ddsc.core.ddsapi import MissingInitialSetupError, SoftwareAgentNotFoundError, AuthTokenCreationError, \
UnexpectedPagingReceivedError, DataServiceError, DSResourceNotConsistentError, \
retry_until_resource_is_consistent, retry_when_service_down
-from mock import MagicMock, Mock, patch
+from mock import MagicMock, Mock, patch, ANY
def fake_response_with_pages(status_code, json_return_value, num_pages=1):
@@ -234,6 +234,41 @@ class TestDataServiceApi(TestCase):
self.assertEqual(json_results, result.json())
self.assertEqual('something.com/v1/auth_providers', mock_requests.get.call_args_list[0][0][0])
+ def test_get_auth_provider(self):
+ mock_requests = MagicMock()
+ mock_requests.get.side_effect = [
+ fake_response(status_code=200, json_return_value={"ok": True})
+ ]
+ api = DataServiceApi(auth=self.create_mock_auth(config_page_size=100), url="something.com/v1",
+ http=mock_requests)
+ result = api.get_auth_provider('provider_id_123')
+ self.assertEqual(200, result.status_code)
+ mock_requests.get.assert_called_with('something.com/v1/auth_providers/provider_id_123/',
+ headers=ANY, params=ANY)
+
+ def test_get_auth_provider_affiliates(self):
+ user = {
+ "id": "abc4e9-9987-47eb-bb4e-19f0203efbf6",
+ "username": "joe",
+ }
+ json_results = {
+ "results": [
+ user
+ ]
+ }
+ mock_requests = MagicMock()
+ mock_requests.get.side_effect = [
+ fake_response_with_pages(status_code=200, json_return_value=json_results, num_pages=1)
+ ]
+ api = DataServiceApi(auth=self.create_mock_auth(config_page_size=100), url="something.com/v1",
+ http=mock_requests)
+ result = api.get_auth_provider_affiliates('provider_id_123', 'Joe Smith')
+ self.assertEqual(200, result.status_code)
+ self.assertEqual(json_results, result.json())
+ mock_requests.get.assert_called_with('something.com/v1/auth_providers/provider_id_123/affiliates/',
+ headers=ANY,
+ params={'full_name_contains': 'Joe Smith', 'page': 1, 'per_page': 100})
+
def test_auth_provider_add_user(self):
user = {
"id": "abc4e9-9987-47eb-bb4e-19f0203efbf6",
@@ -560,6 +595,52 @@ class TestDataServiceApi(TestCase):
self.assertEqual(results[0]['user']['id'], '8593aeac-9999-11e8-9eb6-529269fb1459')
self.assertEqual(results[0]['auth_role']['id'], 'project_admin')
+ def test_get_users_no_filtering(self):
+ mock_requests = MagicMock()
+ page1 = {
+ "results": [
+ {
+ "id": "8593aeac-9999-11e8-9eb6-529269fb1459"
+ }
+ ]
+ }
+ mock_requests.get.side_effect = [
+ fake_response_with_pages(status_code=200, json_return_value=page1, num_pages=1),
+ ]
+ api = DataServiceApi(auth=self.create_mock_auth(config_page_size=100), url="something.com/v1",
+ http=mock_requests)
+ response = api.get_users()
+
+ mock_requests.get.assert_called_with('something.com/v1/users', headers=ANY, params={'page': 1, 'per_page': 100})
+
+ results = response.json()['results']
+ self.assertEqual(len(results), 1)
+ self.assertEqual(results[0]['id'], '8593aeac-9999-11e8-9eb6-529269fb1459')
+
+ def test_get_users_with_filtering(self):
+ mock_requests = MagicMock()
+ page1 = {
+ "results": [
+ {
+ "id": "8593aeac-9999-11e8-9eb6-529269fb1459"
+ }
+ ]
+ }
+ mock_requests.get.side_effect = [
+ fake_response_with_pages(status_code=200, json_return_value=page1, num_pages=1),
+ ]
+ api = DataServiceApi(auth=self.create_mock_auth(config_page_size=100), url="something.com/v1",
+ http=mock_requests)
+ response = api.get_users(full_name='Joe Bob', email='[email protected]', username='joe')
+
+ mock_requests.get.assert_called_with('something.com/v1/users', headers=ANY,
+ params={'full_name_contains': 'Joe Bob', 'email': '[email protected]', 'username': 'joe',
+ 'page': 1, 'per_page': 100})
+
+ results = response.json()['results']
+ self.assertEqual(len(results), 1)
+ self.assertEqual(results[0]['id'], '8593aeac-9999-11e8-9eb6-529269fb1459')
+
class TestDataServiceAuth(TestCase):
@patch('ddsc.core.ddsapi.get_user_agent_str')
diff --git a/ddsc/core/tests/test_localstore.py b/ddsc/core/tests/test_localstore.py
index 0f6386b..f7ef640 100644
--- a/ddsc/core/tests/test_localstore.py
+++ b/ddsc/core/tests/test_localstore.py
@@ -1,6 +1,6 @@
import shutil
import tarfile
-from unittest import TestCase
+from unittest import TestCase, skip
from ddsc.core.localstore import LocalFile, LocalFolder, LocalProject
from mock import patch
@@ -99,6 +99,7 @@ class TestProjectContent(TestCase):
content.add_path('/tmp/DukeDsClientTestFolder/scripts')
self.assertEqual('project: [folder:scripts [file:makemoney.sh]]', str(content))
+ @skip(reason="Fragile test breaks due to item sorting differences on travis")
def test_nested_folder_str(self):
content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
content.add_path('/tmp/DukeDsClientTestFolder/results')
@@ -109,6 +110,7 @@ class TestProjectContent(TestCase):
'folder:subresults2 []'
']]'), str(content))
+ @skip(reason="Fragile test breaks due to item sorting differences on travis")
def test_big_folder_str(self):
content = LocalProject(False, file_exclude_regex=INCLUDE_ALL)
content.add_path('/tmp/DukeDsClientTestFolder')
diff --git a/ddsc/core/tests/test_remotestore.py b/ddsc/core/tests/test_remotestore.py
index d894537..e84512c 100644
--- a/ddsc/core/tests/test_remotestore.py
+++ b/ddsc/core/tests/test_remotestore.py
@@ -9,7 +9,7 @@ from ddsc.core.remotestore import RemoteAuthRole
from ddsc.core.remotestore import RemoteProjectChildren
from ddsc.core.remotestore import RemoteAuthProvider
from ddsc.core.remotestore import ProjectNameOrId
-from ddsc.core.remotestore import ProjectFile, RemoteFileUrl
+from ddsc.core.remotestore import ProjectFile, RemoteFileUrl, NotFoundError
class TestProjectFolderFile(TestCase):
@@ -515,6 +515,88 @@ class TestRemoteStore(TestCase):
remote_store = RemoteStore(config=mock_config)
self.assertTrue(mock_data_service_api.called)
+ @patch("ddsc.core.remotestore.DataServiceApi")
+ @patch("ddsc.core.remotestore.RemoteUser")
+ def test_fetch_users_no_filter(self, mock_remote_user, mock_data_service_api):
+ user_dict = {
+ 'id': '123',
+ }
+ users_resp = Mock()
+ users_resp.json.return_value = {
+ 'results': [
+ user_dict,
+ ]
+ }
+ mock_data_service_api.return_value.get_users.return_value = users_resp
+
+ remote_store = RemoteStore(config=MagicMock())
+ users = remote_store.fetch_users()
+
+ mock_data_service_api.return_value.get_users.assert_called_with(email=None, username=None)
+ self.assertEqual(len(users), 1)
+ self.assertEqual(users[0], mock_remote_user.return_value)
+ mock_remote_user.assert_called_with(user_dict)
+
+ @patch("ddsc.core.remotestore.DataServiceApi")
+ @patch("ddsc.core.remotestore.RemoteUser")
+ def test_fetch_users_with_filter(self, mock_remote_user, mock_data_service_api):
+ user_dict = {
+ 'id': '123',
+ }
+ users_resp = Mock()
+ users_resp.json.return_value = {
+ 'results': [
+ user_dict,
+ ]
+ }
+ mock_data_service_api.return_value.get_users.return_value = users_resp
+
+ remote_store = RemoteStore(config=MagicMock())
+ users = remote_store.fetch_users(email='[email protected]', username='joe')
+
+ mock_data_service_api.return_value.get_users.assert_called_with(email='[email protected]', username='joe')
+ self.assertEqual(len(users), 1)
+ self.assertEqual(users[0], mock_remote_user.return_value)
+ mock_remote_user.assert_called_with(user_dict)
+
+ def test_lookup_user_by_username(self):
+ mock_user = Mock()
+ mock_user2 = Mock()
+ remote_store = RemoteStore(config=MagicMock())
+ remote_store.fetch_users = Mock()
+
+ remote_store.fetch_users.return_value = []
+ with self.assertRaises(NotFoundError) as raised_exception:
+ remote_store.lookup_user_by_username('joe')
+ self.assertEqual(str(raised_exception.exception), 'Username not found: joe.')
+
+ remote_store.fetch_users.return_value = [mock_user]
+ self.assertEqual(remote_store.lookup_user_by_username('joe'), mock_user)
+
+ remote_store.fetch_users.return_value = [mock_user, mock_user2]
+ with self.assertRaises(ValueError) as raised_exception:
+ remote_store.lookup_user_by_username('joe')
+ self.assertEqual(str(raised_exception.exception), 'Multiple users with same username found: joe.')
+
+ def test_lookup_user_by_email(self):
+ mock_user = Mock()
+ mock_user2 = Mock()
+ remote_store = RemoteStore(config=MagicMock())
+ remote_store.fetch_users = Mock()
+
+ remote_store.fetch_users.return_value = []
+ with self.assertRaises(NotFoundError) as raised_exception:
+ remote_store.lookup_user_by_email('[email protected]')
+ self.assertEqual(str(raised_exception.exception), 'Email not found: [email protected].')
+
+ remote_store.fetch_users.return_value = [mock_user]
+ self.assertEqual(remote_store.lookup_user_by_email('[email protected]'), mock_user)
+
+ remote_store.fetch_users.return_value = [mock_user, mock_user2]
+ with self.assertRaises(ValueError) as raised_exception:
+ remote_store.lookup_user_by_email('[email protected]')
+ self.assertEqual(str(raised_exception.exception), 'Multiple users with same email found: [email protected].')
+
class TestRemoteProjectChildren(TestCase):
def test_simple_case(self):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 3,
"test_score": 3
},
"num_modified_files": 1
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock",
"flake8",
"nose"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/Duke-GCB/DukeDSClient.git@570bc4954d51f662e294b2f2352248623ea8bf8b#egg=DukeDSClient
exceptiongroup==1.2.2
flake8==7.2.0
future==0.16.0
iniconfig==2.1.0
mccabe==0.7.0
mock==5.2.0
nose==1.3.7
packaging==24.2
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.2
pytest==8.3.5
pytz==2025.2
PyYAML==3.12
requests==2.13.0
six==1.10.0
tomli==2.2.1
|
name: DukeDSClient
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- flake8==7.2.0
- future==0.16.0
- iniconfig==2.1.0
- mccabe==0.7.0
- mock==5.2.0
- nose==1.3.7
- packaging==24.2
- pluggy==1.5.0
- pycodestyle==2.13.0
- pyflakes==3.3.2
- pytest==8.3.5
- pytz==2025.2
- pyyaml==3.12
- requests==2.13.0
- six==1.10.0
- tomli==2.2.1
prefix: /opt/conda/envs/DukeDSClient
|
[
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_auth_provider",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_auth_provider_affiliates",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_users_no_filtering",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_users_with_filtering"
] |
[] |
[
"ddsc/core/tests/test_ddsapi.py::TestMultiJSONResponse::test_pass_through_works_with_one_response",
"ddsc/core/tests/test_ddsapi.py::TestMultiJSONResponse::test_pass_through_works_with_three_responses",
"ddsc/core/tests/test_ddsapi.py::TestMultiJSONResponse::test_pass_through_works_with_two_responses",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_auth_provider_add_user",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_check_err_with_400",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_check_err_with_404",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_check_err_with_404_with_flag",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_check_err_with_500",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_check_err_with_good_response",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_constructor_creates_session_when_passed_none",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_delete_file",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_delete_folder",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_delete_raises_error_on_paging_response",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_all_project_transfers",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_auth_providers",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_collection_one_page",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_collection_three_pages",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_collection_two_pages",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_folder",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_project_children",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_project_files",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_project_permissions",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_project_transfers",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_projects",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_single_item_raises_error_on_paging_response",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_get_single_page_works_on_paging_response",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_list_auth_roles",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_post_raises_error_on_paging_response",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_put_raises_error_on_paging_response",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceApi::test_relations_methods",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceAuth::test_claim_new_token",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceAuth::test_claim_new_token_error",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceAuth::test_claim_new_token_missing_agent",
"ddsc/core/tests/test_ddsapi.py::TestDataServiceAuth::test_claim_new_token_missing_setup",
"ddsc/core/tests/test_ddsapi.py::TestMissingInitialSetupError::test_constructor",
"ddsc/core/tests/test_ddsapi.py::TestSoftwareAgentNotFoundError::test_constructor",
"ddsc/core/tests/test_ddsapi.py::TestUnexpectedPagingReceivedError::test_constructor",
"ddsc/core/tests/test_ddsapi.py::TestAuthTokenCreationError::test_constructor",
"ddsc/core/tests/test_ddsapi.py::TestInconsistentResourceMonitoring::test_retry_until_resource_is_consistent",
"ddsc/core/tests/test_ddsapi.py::TestInconsistentResourceMonitoring::test_retry_until_resource_is_consistent_with_one_retry",
"ddsc/core/tests/test_ddsapi.py::TestInconsistentResourceMonitoring::test_retry_until_resource_is_consistent_with_two_retries",
"ddsc/core/tests/test_ddsapi.py::TestRetryWhenServiceDown::test_returns_value_when_ok",
"ddsc/core/tests/test_ddsapi.py::TestRetryWhenServiceDown::test_will_just_raise_when_other_error",
"ddsc/core/tests/test_ddsapi.py::TestRetryWhenServiceDown::test_will_retry_after_waiting",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_empty_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_file_str",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_folder_one_child_str",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_folder_two_children_str",
"ddsc/core/tests/test_localstore.py::TestProjectFolderFile::test_nested_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_folder_and_file_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_empty_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_exclude_dot_files",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_dot_name",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_name_no_slash",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_name_removes_slash",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_folder_up_and_back",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_ignore_one_dir",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_include_dot_files",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_one_folder_str",
"ddsc/core/tests/test_localstore.py::TestProjectContent::test_top_level_file_str",
"ddsc/core/tests/test_localstore.py::TestLocalFile::test_count_chunks_values",
"ddsc/core/tests/test_remotestore.py::TestProjectFolderFile::test_file_item",
"ddsc/core/tests/test_remotestore.py::TestProjectFolderFile::test_file_item_new_version",
"ddsc/core/tests/test_remotestore.py::TestProjectFolderFile::test_folder_item",
"ddsc/core/tests/test_remotestore.py::TestProjectFolderFile::test_project_list_item",
"ddsc/core/tests/test_remotestore.py::TestRemoteUser::test_parse_user",
"ddsc/core/tests/test_remotestore.py::TestRemoteAuthRole::test_deprecated_system_role",
"ddsc/core/tests/test_remotestore.py::TestRemoteAuthRole::test_parse_auth_role",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_auth_roles_project",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_auth_roles_system",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_constructor",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_fetch_remote_project_exclude_response_fields",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_fetch_users_no_filter",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_fetch_users_with_filter",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_get_project_files",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_get_projects_with_auth_role",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_lookup_user_by_email",
"ddsc/core/tests/test_remotestore.py::TestRemoteStore::test_lookup_user_by_username",
"ddsc/core/tests/test_remotestore.py::TestRemoteProjectChildren::test_simple_case",
"ddsc/core/tests/test_remotestore.py::TestRemoteProjectChildren::test_top_level_files",
"ddsc/core/tests/test_remotestore.py::TestReadRemoteHash::test_new_way_one_item",
"ddsc/core/tests/test_remotestore.py::TestReadRemoteHash::test_new_way_two_item",
"ddsc/core/tests/test_remotestore.py::TestReadRemoteHash::test_old_way",
"ddsc/core/tests/test_remotestore.py::TestRemoteAuthProvider::test_constructor",
"ddsc/core/tests/test_remotestore.py::TestRemoteAuthProvider::test_get_auth_providers",
"ddsc/core/tests/test_remotestore.py::TestRemoteAuthProvider::test_register_user_by_username",
"ddsc/core/tests/test_remotestore.py::TestRemoteAuthProvider::test_register_user_by_username_with_no_default_provider",
"ddsc/core/tests/test_remotestore.py::TestProjectNameOrId::test_constructors",
"ddsc/core/tests/test_remotestore.py::TestProjectNameOrId::test_contained_in_dict",
"ddsc/core/tests/test_remotestore.py::TestProjectNameOrId::test_description",
"ddsc/core/tests/test_remotestore.py::TestProjectFile::test_get_local_path",
"ddsc/core/tests/test_remotestore.py::TestProjectFile::test_get_remote_parent_path",
"ddsc/core/tests/test_remotestore.py::TestProjectFile::test_path",
"ddsc/core/tests/test_remotestore.py::TestRemoteFileUrl::test_constructor"
] |
[] |
MIT License
| 3,208 |
[
"ddsc/core/ddsapi.py"
] |
[
"ddsc/core/ddsapi.py"
] |
|
great-expectations__great_expectations-385
|
c0ab4f922b607f135caf6dac7bed16f61dbdeead
|
2018-10-10 16:28:20
|
10e1792ae5f9d250d5393bc14b488e189358cccc
|
diff --git a/docs/source/custom_expectations.rst b/docs/source/custom_expectations.rst
index f7340871b..419814e8d 100644
--- a/docs/source/custom_expectations.rst
+++ b/docs/source/custom_expectations.rst
@@ -74,7 +74,7 @@ For SqlAlchemyDataset, the decorators work slightly differently. See the MetaSql
mode_query = sa.select([
sa.column(column).label('value'),
sa.func.count(sa.column(column)).label('frequency')
- ]).select_from(sa.table(self.table_name)).group_by(sa.column(column)).order_by(sa.desc(sa.column('frequency')))
+ ]).select_from(self._table).group_by(sa.column(column)).order_by(sa.desc(sa.column('frequency')))
mode = self.engine.execute(mode_query).scalar()
return {
diff --git a/docs/source/roadmap_changelog.rst b/docs/source/roadmap_changelog.rst
index 4563e1084..339696554 100644
--- a/docs/source/roadmap_changelog.rst
+++ b/docs/source/roadmap_changelog.rst
@@ -14,6 +14,7 @@ Planned Features
v.0.4.4__develop
----------------
+* Add support for custom schema in SqlAlchemyDataset (#370)
v.0.4.4
----------------
diff --git a/great_expectations/dataset/sqlalchemy_dataset.py b/great_expectations/dataset/sqlalchemy_dataset.py
index 8028e95fe..ec86b4416 100644
--- a/great_expectations/dataset/sqlalchemy_dataset.py
+++ b/great_expectations/dataset/sqlalchemy_dataset.py
@@ -67,7 +67,7 @@ class MetaSqlAlchemyDataset(Dataset):
sa.column(column).is_(None) == False if None in ignore_values else True),
1)], else_=0)
).label('unexpected_count')
- ]).select_from(sa.table(self.table_name))
+ ]).select_from(self._table)
count_results = dict(self.engine.execute(count_query).fetchone())
@@ -81,7 +81,7 @@ class MetaSqlAlchemyDataset(Dataset):
# Retrieve unexpected values
unexpected_query_results = self.engine.execute(
- sa.select([sa.column(column)]).select_from(sa.table(self.table_name)).where(
+ sa.select([sa.column(column)]).select_from(self._table).where(
sa.and_(sa.not_(expected_condition),
sa.or_(
# SA normally evaluates `== None` as `IS NONE`. However `sa.in_()`
@@ -164,7 +164,7 @@ class MetaSqlAlchemyDataset(Dataset):
sa.func.sum(
sa.case([(sa.column(column) == None, 1)], else_=0)
).label('null_count'),
- ]).select_from(sa.table(self.table_name))
+ ]).select_from(self._table)
count_results = dict(self.engine.execute(count_query).fetchone())
@@ -204,11 +204,12 @@ class MetaSqlAlchemyDataset(Dataset):
class SqlAlchemyDataset(MetaSqlAlchemyDataset):
- def __init__(self, table_name=None, engine=None, connection_string=None, custom_sql=None, *args, **kwargs):
+ def __init__(self, table_name=None, engine=None, connection_string=None,
+ custom_sql=None, schema=None, *args, **kwargs):
if table_name is None:
raise ValueError("No table_name provided.")
- self.table_name = table_name
+ self._table = sa.Table(table_name, sa.MetaData(), schema=schema)
if engine is None and connection_string is None:
raise ValueError("Engine or connection_string must be provided.")
@@ -223,11 +224,17 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
# Currently we do no error handling if the engine doesn't work out of the box.
raise err
+ if schema is not None and custom_sql is not None:
+ # temporary table will be written to temp schema, so don't allow
+ # a user-defined schema
+ raise ValueError("Cannot specify both schema and custom_sql.")
+
+
if custom_sql:
- self.create_temporary_table(self.table_name, custom_sql)
+ self.create_temporary_table(table_name, custom_sql)
insp = reflection.Inspector.from_engine(engine)
- self.columns = insp.get_columns(self.table_name)
+ self.columns = insp.get_columns(table_name, schema=schema)
# Only call super once connection is established and table_name and columns known to allow autoinspection
super(SqlAlchemyDataset, self).__init__(*args, **kwargs)
@@ -282,7 +289,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
if value is None:
raise ValueError("value must be provided")
- count_query = sa.select([sa.func.count()]).select_from(sa.table(self.table_name))
+ count_query = sa.select([sa.func.count()]).select_from(self._table)
row_count = self.engine.execute(count_query).scalar()
return {
@@ -310,7 +317,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
except ValueError:
raise ValueError("min_value and max_value must be integers")
- count_query = sa.select([sa.func.count()]).select_from(sa.table(self.table_name))
+ count_query = sa.select([sa.func.count()]).select_from(self._table)
row_count = self.engine.execute(count_query).scalar()
if min_value != None and max_value != None:
@@ -521,7 +528,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
raise ValueError("parse_strings_as_datetimes is not supported in SqlAlchemy")
col_max = self.engine.execute(
- sa.select([sa.func.max(sa.column(column))]).select_from(sa.table(self.table_name))
+ sa.select([sa.func.max(sa.column(column))]).select_from(self._table)
).scalar()
# Handle possible missing values
@@ -568,7 +575,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
raise ValueError("parse_strings_as_datetimes is not supported in SqlAlchemy")
col_min = self.engine.execute(
- sa.select([sa.func.min(sa.column(column))]).select_from(sa.table(self.table_name))
+ sa.select([sa.func.min(sa.column(column))]).select_from(self._table)
).scalar()
# Handle possible missing values
@@ -609,7 +616,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
raise ValueError("min_value and max_value cannot both be None")
col_sum = self.engine.execute(
- sa.select([sa.func.sum(sa.column(column))]).select_from(sa.table(self.table_name))
+ sa.select([sa.func.sum(sa.column(column))]).select_from(self._table)
).scalar()
# Handle possible missing values
@@ -659,7 +666,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
raise ValueError("column is not numeric")
col_avg = self.engine.execute(
- sa.select([sa.func.avg(sa.column(column))]).select_from(sa.table(self.table_name))
+ sa.select([sa.func.avg(sa.column(column))]).select_from(self._table)
).scalar()
# Handle possible missing values
@@ -707,7 +714,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
sa.func.sum(
sa.case([(sa.column(column) == None, 1)], else_=0)
).label('null_count')
- ]).select_from(sa.table(self.table_name))
+ ]).select_from(self._table)
)
counts = dict(count_query.fetchone())
@@ -724,7 +731,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
element_values = self.engine.execute(
sa.select([sa.column(column)]).order_by(sa.column(column)).where(
sa.column(column) != None
- ).offset(nonnull_count // 2 - 1).limit(2).select_from(sa.table(self.table_name))
+ ).offset(nonnull_count // 2 - 1).limit(2).select_from(self._table)
)
column_values = list(element_values.fetchall())
@@ -761,7 +768,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
result_format=None, include_config=False, catch_exceptions=None, meta=None):
# Duplicates are found by filtering a group by query
dup_query = sa.select([sa.column(column)]).\
- select_from(sa.table(self.table_name)).\
+ select_from(self._table).\
group_by(sa.column(column)).\
having(sa.func.count(sa.column(column)) > 1)
@@ -777,7 +784,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
raise ValueError("min_value and max_value cannot both be None")
unique_value_count = self.engine.execute(
- sa.select([sa.func.count(sa.func.distinct(sa.column(column)))]).select_from(sa.table(self.table_name))
+ sa.select([sa.func.count(sa.func.distinct(sa.column(column)))]).select_from(self._table)
).scalar()
# Handle possible missing values
@@ -814,7 +821,7 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
sa.case([(sa.column(column) == None, 1)], else_=0)
).label('null_count'),
sa.func.count(sa.func.distinct(sa.column(column))).label('unique_value_count')
- ]).select_from(sa.table(self.table_name))
+ ]).select_from(self._table)
)
counts = count_query.fetchone()
|
Allow passing a schema name to SqlAlchemyDataset
Currently, SqlAlchemyDataset accepts a table name but not a schema name. I'm currently working in Redshift. When I try to instantiate a `SqlAlchemyDataset`, I get a `KeyError` with `public.<tablename>`. After some inspection, I determined that the issue is popping up in this line:https://github.com/great-expectations/great_expectations/blob/d7a4ee03cfce8bea66c5f91573bb87e4385b1eb1/great_expectations/dataset/sqlalchemy_dataset.py#L222
Because I'm not passing a schema name, it uses the default schema, which is "public" for Redshift. When I run this line myself but specifying the schema name, the line runs successfully. Accessing non-default schemas seems like a common use case, so a schema argument would be helpful in many other cases.
|
great-expectations/great_expectations
|
diff --git a/tests/sqlalchemy_dataset/test_sqlalchemydataset.py b/tests/sqlalchemy_dataset/test_sqlalchemydataset.py
index 4c32c47b3..59c2c3eff 100644
--- a/tests/sqlalchemy_dataset/test_sqlalchemydataset.py
+++ b/tests/sqlalchemy_dataset/test_sqlalchemydataset.py
@@ -18,7 +18,7 @@ def custom_dataset():
mode_query = sa.select([
sa.column(column).label('value'),
sa.func.count(sa.column(column)).label('frequency')
- ]).select_from(sa.table(self.table_name)).group_by(sa.column(column)).order_by(
+ ]).select_from(self._table).group_by(sa.column(column)).order_by(
sa.desc(sa.column('frequency')))
mode = self.engine.execute(mode_query).scalar()
@@ -85,6 +85,21 @@ def test_broken_decorator_errors(custom_dataset):
assert "Column aggregate expectation failed to return required information: observed_value" in str(err)
+def test_missing_engine_error():
+ with pytest.raises(ValueError) as err:
+ SqlAlchemyDataset('test_engine', schema='example')
+ assert "Engine or connection_string must be provided." in str(err)
+
+
+def test_schema_custom_sql_error():
+ engine = sa.create_engine('sqlite://')
+
+ with pytest.raises(ValueError) as err:
+ SqlAlchemyDataset('test_schema_custom', schema='example', engine=engine,
+ custom_sql='SELECT * FROM example.fake')
+ assert "Cannot specify both schema and custom_sql." in str(err)
+
+
def test_sqlalchemydataset_with_custom_sql():
engine = sa.create_engine('sqlite://')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 3
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
-e git+https://github.com/great-expectations/great_expectations.git@c0ab4f922b607f135caf6dac7bed16f61dbdeead#egg=great_expectations
greenlet==2.0.2
importlib-metadata==4.8.3
iniconfig==1.1.1
jsonschema==3.2.0
numpy==1.19.5
packaging==21.3
pandas==1.1.5
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
scipy==1.5.4
six==1.17.0
SQLAlchemy==1.4.54
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: great_expectations
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- greenlet==2.0.2
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jsonschema==3.2.0
- numpy==1.19.5
- packaging==21.3
- pandas==1.1.5
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pyrsistent==0.18.0
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- scipy==1.5.4
- six==1.17.0
- sqlalchemy==1.4.54
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/great_expectations
|
[
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_custom_sqlalchemydataset",
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_schema_custom_sql_error"
] |
[
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_sqlalchemydataset_with_custom_sql"
] |
[
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_broken_decorator_errors",
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_missing_engine_error"
] |
[] |
Apache License 2.0
| 3,209 |
[
"docs/source/roadmap_changelog.rst",
"great_expectations/dataset/sqlalchemy_dataset.py",
"docs/source/custom_expectations.rst"
] |
[
"docs/source/roadmap_changelog.rst",
"great_expectations/dataset/sqlalchemy_dataset.py",
"docs/source/custom_expectations.rst"
] |
|
mozilla__bleach-410
|
a39f7d6742cca84a4bb095e097c47b1d3770e58b
|
2018-10-10 18:58:35
|
cabd665db0b0a51aa4c58aac2c47bd4bf76e9c73
|
diff --git a/bleach/linkifier.py b/bleach/linkifier.py
index 6394c03..5d815f8 100644
--- a/bleach/linkifier.py
+++ b/bleach/linkifier.py
@@ -499,13 +499,11 @@ class LinkifyFilter(html5lib_shim.Filter):
# the tokens we're going to yield
in_a = False
token_buffer = []
- continue
-
else:
token_buffer.append(token)
- continue
+ continue
- elif token['type'] in ['StartTag', 'EmptyTag']:
+ if token['type'] in ['StartTag', 'EmptyTag']:
if token['name'] in self.skip_tags:
# Skip tags start a "special mode" where we don't linkify
# anything until the end tag.
diff --git a/bleach/sanitizer.py b/bleach/sanitizer.py
index 262915a..9ba4c57 100644
--- a/bleach/sanitizer.py
+++ b/bleach/sanitizer.py
@@ -267,8 +267,8 @@ class BleachSanitizerFilter(html5lib_shim.SanitizerFilter):
return super(BleachSanitizerFilter, self).__init__(source, **kwargs)
- def __iter__(self):
- for token in html5lib_shim.Filter.__iter__(self):
+ def sanitize_stream(self, token_iterator):
+ for token in token_iterator:
ret = self.sanitize_token(token)
if not ret:
@@ -280,6 +280,40 @@ class BleachSanitizerFilter(html5lib_shim.SanitizerFilter):
else:
yield ret
+ def merge_characters(self, token_iterator):
+ """Merge consecutive Characters tokens in a stream"""
+ characters_buffer = []
+
+ for token in token_iterator:
+ if characters_buffer:
+ if token['type'] == 'Characters':
+ characters_buffer.append(token)
+ continue
+ else:
+ # Merge all the characters tokens together into one and then
+ # operate on it.
+ new_token = {
+ 'data': ''.join([char_token['data'] for char_token in characters_buffer]),
+ 'type': 'Characters'
+ }
+ characters_buffer = []
+ yield new_token
+
+ elif token['type'] == 'Characters':
+ characters_buffer.append(token)
+ continue
+
+ yield token
+
+ new_token = {
+ 'data': ''.join([char_token['data'] for char_token in characters_buffer]),
+ 'type': 'Characters'
+ }
+ yield new_token
+
+ def __iter__(self):
+ return self.merge_characters(self.sanitize_stream(html5lib_shim.Filter.__iter__(self)))
+
def sanitize_token(self, token):
"""Sanitize a token either by HTML-encoding or dropping.
|
LinkifyFilter not working for URLs with ampersands
Example with bleach 2.1.3:
```
from bleach import Cleaner
from bleach.linkifier import LinkifyFilter
url1 = 'http://a.co?b=1&c=2'
url2 = 'http://a.co?b=1&c=2'
cleaner = Cleaner(filters=[LinkifyFilter])
cleaner.clean(url1)
cleaner.clean(url2)
```
Both result in `<a href="http://a.co?b=1">http://a.co?b=1</a>&c=2`
|
mozilla/bleach
|
diff --git a/tests/test_clean.py b/tests/test_clean.py
index b543cdf..5322767 100644
--- a/tests/test_clean.py
+++ b/tests/test_clean.py
@@ -58,6 +58,7 @@ def test_html_is_lowercased():
'<a href="http://example.com">foo</a>'
)
+
def test_invalid_uri_does_not_raise_error():
assert clean('<a href="http://example.com]">text</a>') == '<a>text</a>'
diff --git a/tests/test_linkify.py b/tests/test_linkify.py
index 876cb84..eeea3e3 100644
--- a/tests/test_linkify.py
+++ b/tests/test_linkify.py
@@ -4,7 +4,8 @@ import pytest
from six.moves.urllib_parse import quote_plus
from bleach import linkify, DEFAULT_CALLBACKS as DC
-from bleach.linkifier import Linker
+from bleach.linkifier import Linker, LinkifyFilter
+from bleach.sanitizer import Cleaner
def test_empty():
@@ -656,3 +657,20 @@ class TestLinkify:
with pytest.raises(TypeError):
linkify(no_type)
+
+
[email protected]('text, expected', [
+ ('abc', 'abc'),
+ ('example.com', '<a href="http://example.com">example.com</a>'),
+ (
+ 'http://example.com?b=1&c=2',
+ '<a href="http://example.com?b=1&c=2">http://example.com?b=1&c=2</a>'
+ ),
+ (
+ 'link: https://example.com/watch#anchor',
+ 'link: <a href="https://example.com/watch#anchor">https://example.com/watch#anchor</a>'
+ )
+])
+def test_linkify_filter(text, expected):
+ cleaner = Cleaner(filters=[LinkifyFilter])
+ assert cleaner.clean(text) == expected
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
3.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs==22.2.0
Babel==2.11.0
-e git+https://github.com/mozilla/bleach.git@a39f7d6742cca84a4bb095e097c47b1d3770e58b#egg=bleach
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
colorama==0.4.5
cryptography==40.0.2
distlib==0.3.9
docutils==0.17.1
filelock==3.4.1
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
jeepney==0.7.1
Jinja2==3.0.3
keyring==23.4.1
MarkupSafe==2.0.1
mccabe==0.7.0
packaging==21.3
pkginfo==1.10.0
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-wholenodeid==0.2
pytz==2025.2
readme-renderer==34.0
requests==2.27.1
requests-toolbelt==1.0.0
rfc3986==1.5.0
SecretStorage==3.3.3
six==1.17.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml==0.10.2
tomli==1.2.3
tox==3.28.0
tqdm==4.64.1
twine==3.8.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
webencodings==0.5.1
zipp==3.6.0
|
name: bleach
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- attrs==22.2.0
- babel==2.11.0
- cffi==1.15.1
- charset-normalizer==2.0.12
- colorama==0.4.5
- cryptography==40.0.2
- distlib==0.3.9
- docutils==0.17.1
- filelock==3.4.1
- flake8==5.0.4
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.2.0
- importlib-resources==5.4.0
- iniconfig==1.1.1
- jeepney==0.7.1
- jinja2==3.0.3
- keyring==23.4.1
- markupsafe==2.0.1
- mccabe==0.7.0
- packaging==21.3
- pkginfo==1.10.0
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pycparser==2.21
- pyflakes==2.5.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-wholenodeid==0.2
- pytz==2025.2
- readme-renderer==34.0
- requests==2.27.1
- requests-toolbelt==1.0.0
- rfc3986==1.5.0
- secretstorage==3.3.3
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==4.3.2
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- toml==0.10.2
- tomli==1.2.3
- tox==3.28.0
- tqdm==4.64.1
- twine==3.8.0
- typing-extensions==4.1.1
- urllib3==1.26.20
- virtualenv==20.16.2
- webencodings==0.5.1
- zipp==3.6.0
prefix: /opt/conda/envs/bleach
|
[
"tests/test_linkify.py::test_linkify_filter[http://example.com?b=1&c=2-<a"
] |
[] |
[
"tests/test_clean.py::test_clean_idempotent",
"tests/test_clean.py::test_only_text_is_cleaned",
"tests/test_clean.py::test_empty",
"tests/test_clean.py::test_content_has_no_html",
"tests/test_clean.py::test_content_has_allowed_html[an",
"tests/test_clean.py::test_content_has_allowed_html[another",
"tests/test_clean.py::test_html_is_lowercased",
"tests/test_clean.py::test_invalid_uri_does_not_raise_error",
"tests/test_clean.py::test_comments[<!--",
"tests/test_clean.py::test_comments[<!--open",
"tests/test_clean.py::test_comments[<!--comment-->text-True-text]",
"tests/test_clean.py::test_comments[<!--comment-->text-False-<!--comment-->text]",
"tests/test_clean.py::test_comments[text<!--",
"tests/test_clean.py::test_comments[text<!--comment-->-True-text]",
"tests/test_clean.py::test_comments[text<!--comment-->-False-text<!--comment-->]",
"tests/test_clean.py::test_invalid_char_in_tag",
"tests/test_clean.py::test_unclosed_tag",
"tests/test_clean.py::test_nested_script_tag",
"tests/test_clean.py::test_bare_entities_get_escaped_correctly[an",
"tests/test_clean.py::test_bare_entities_get_escaped_correctly[tag",
"tests/test_clean.py::test_character_entities_handling[&-&]",
"tests/test_clean.py::test_character_entities_handling[ - ]",
"tests/test_clean.py::test_character_entities_handling[ ",
"tests/test_clean.py::test_character_entities_handling[<em>strong</em>-<em>strong</em>]",
"tests/test_clean.py::test_character_entities_handling[&is",
"tests/test_clean.py::test_character_entities_handling[cool",
"tests/test_clean.py::test_character_entities_handling[&&",
"tests/test_clean.py::test_character_entities_handling[&",
"tests/test_clean.py::test_character_entities_handling[this",
"tests/test_clean.py::test_character_entities_handling[http://example.com?active=true¤t=true-http://example.com?active=true&current=true]",
"tests/test_clean.py::test_character_entities_handling[<a",
"tests/test_clean.py::test_character_entities_handling[&xx;-&xx;]",
"tests/test_clean.py::test_character_entities_handling['-']",
"tests/test_clean.py::test_character_entities_handling["-"]",
"tests/test_clean.py::test_character_entities_handling[{-{]",
"tests/test_clean.py::test_character_entities_handling[{-{]",
"tests/test_clean.py::test_character_entities_handling[{-{]",
"tests/test_clean.py::test_character_entities_handling[&#-&#]",
"tests/test_clean.py::test_character_entities_handling[&#<-&#<]",
"tests/test_clean.py::test_character_entities_handling['"-'"]",
"tests/test_clean.py::test_stripping_tags[a",
"tests/test_clean.py::test_stripping_tags[<p><a",
"tests/test_clean.py::test_stripping_tags[<p><span>multiply",
"tests/test_clean.py::test_stripping_tags[<ul><li><script></li></ul>-kwargs4-<ul><li></li></ul>]",
"tests/test_clean.py::test_stripping_tags[<isindex>-kwargs6-]",
"tests/test_clean.py::test_stripping_tags[Yeah",
"tests/test_clean.py::test_stripping_tags[<sarcasm>-kwargs8-]",
"tests/test_clean.py::test_stripping_tags[</sarcasm>-kwargs9-]",
"tests/test_clean.py::test_stripping_tags[</",
"tests/test_clean.py::test_stripping_tags[Foo",
"tests/test_clean.py::test_stripping_tags[Favorite",
"tests/test_clean.py::test_stripping_tags[</3-kwargs14-</3]",
"tests/test_clean.py::test_escaping_tags[<img",
"tests/test_clean.py::test_escaping_tags[<script>safe()</script>-<script>safe()</script>]",
"tests/test_clean.py::test_escaping_tags[<style>body{}</style>-<style>body{}</style>]",
"tests/test_clean.py::test_escaping_tags[<ul><li><script></li></ul>-<ul><li><script></li></ul>]",
"tests/test_clean.py::test_escaping_tags[<isindex>-<isindex>]",
"tests/test_clean.py::test_escaping_tags[<sarcasm/>-<sarcasm/>]",
"tests/test_clean.py::test_escaping_tags[<sarcasm>-<sarcasm>]",
"tests/test_clean.py::test_escaping_tags[</sarcasm>-</sarcasm>]",
"tests/test_clean.py::test_escaping_tags[</",
"tests/test_clean.py::test_escaping_tags[</3-</3]",
"tests/test_clean.py::test_escaping_tags[<[email protected]>-<[email protected]>]",
"tests/test_clean.py::test_escaping_tags[Favorite",
"tests/test_clean.py::test_stripping_tags_is_safe[<scri<script>pt>alert(1)</scr</script>ipt>-pt>alert(1)ipt>]",
"tests/test_clean.py::test_stripping_tags_is_safe[<scri<scri<script>pt>pt>alert(1)</script>-pt>pt>alert(1)]",
"tests/test_clean.py::test_allowed_styles",
"tests/test_clean.py::test_href_with_wrong_tag",
"tests/test_clean.py::test_disallowed_attr",
"tests/test_clean.py::test_unquoted_attr_values_are_quoted",
"tests/test_clean.py::test_unquoted_event_handler_attr_value",
"tests/test_clean.py::test_invalid_filter_attr",
"tests/test_clean.py::test_poster_attribute",
"tests/test_clean.py::test_attributes_callable",
"tests/test_clean.py::test_attributes_wildcard",
"tests/test_clean.py::test_attributes_wildcard_callable",
"tests/test_clean.py::test_attributes_tag_callable",
"tests/test_clean.py::test_attributes_tag_list",
"tests/test_clean.py::test_attributes_list",
"tests/test_clean.py::test_uri_value_allowed_protocols[<a",
"tests/test_clean.py::test_svg_attr_val_allows_ref",
"tests/test_clean.py::test_svg_allow_local_href[<svg><pattern",
"tests/test_clean.py::test_svg_allow_local_href_nonlocal[<svg><pattern",
"tests/test_clean.py::test_invisible_characters[1\\x0723-1?23]",
"tests/test_clean.py::test_invisible_characters[1\\x0823-1?23]",
"tests/test_clean.py::test_invisible_characters[1\\x0b23-1?23]",
"tests/test_clean.py::test_invisible_characters[1\\x0c23-1?23]",
"tests/test_clean.py::test_invisible_characters[import",
"tests/test_clean.py::test_nonexistent_namespace",
"tests/test_clean.py::test_regressions[1.test]",
"tests/test_clean.py::test_regressions[2.test]",
"tests/test_clean.py::test_regressions[3.test]",
"tests/test_clean.py::test_regressions[4.test]",
"tests/test_clean.py::test_regressions[5.test]",
"tests/test_clean.py::test_regressions[6.test]",
"tests/test_clean.py::test_regressions[7.test]",
"tests/test_clean.py::test_regressions[8.test]",
"tests/test_clean.py::test_regressions[9.test]",
"tests/test_clean.py::test_regressions[10.test]",
"tests/test_clean.py::test_regressions[11.test]",
"tests/test_clean.py::test_regressions[12.test]",
"tests/test_clean.py::test_regressions[13.test]",
"tests/test_clean.py::test_regressions[14.test]",
"tests/test_clean.py::test_regressions[15.test]",
"tests/test_clean.py::test_regressions[16.test]",
"tests/test_clean.py::test_regressions[17.test]",
"tests/test_clean.py::test_regressions[18.test]",
"tests/test_clean.py::test_regressions[19.test]",
"tests/test_clean.py::test_regressions[20.test]",
"tests/test_clean.py::TestCleaner::test_basics",
"tests/test_clean.py::TestCleaner::test_filters",
"tests/test_linkify.py::test_empty",
"tests/test_linkify.py::test_simple_link",
"tests/test_linkify.py::test_trailing_slash",
"tests/test_linkify.py::test_mangle_link",
"tests/test_linkify.py::test_mangle_text",
"tests/test_linkify.py::test_email_link[a",
"tests/test_linkify.py::test_email_link[aussie",
"tests/test_linkify.py::test_email_link[email",
"tests/test_linkify.py::test_email_link[<br>[email protected]<br><a",
"tests/test_linkify.py::test_email_link[mailto",
"tests/test_linkify.py::test_email_link[\"\\\\\\n\"@opa.ru-True-\"\\\\\\n\"@opa.ru]",
"tests/test_linkify.py::test_email_link_escaping[\"james\"@example.com-<a",
"tests/test_linkify.py::test_email_link_escaping[\"j'ames\"@example.com-<a",
"tests/test_linkify.py::test_email_link_escaping[\"ja>mes\"@example.com-<a",
"tests/test_linkify.py::test_prevent_links[callback0-a",
"tests/test_linkify.py::test_prevent_links[callback1-a",
"tests/test_linkify.py::test_prevent_links[callback2-a",
"tests/test_linkify.py::test_prevent_links[callback3-a",
"tests/test_linkify.py::test_prevent_links[callback4-a",
"tests/test_linkify.py::test_prevent_links[callback5-a",
"tests/test_linkify.py::test_set_attrs",
"tests/test_linkify.py::test_only_proto_links",
"tests/test_linkify.py::test_stop_email",
"tests/test_linkify.py::test_tlds[example.com-<a",
"tests/test_linkify.py::test_tlds[example.co-<a",
"tests/test_linkify.py::test_tlds[example.co.uk-<a",
"tests/test_linkify.py::test_tlds[example.edu-<a",
"tests/test_linkify.py::test_tlds[example.xxx-<a",
"tests/test_linkify.py::test_tlds[bit.ly/fun-<a",
"tests/test_linkify.py::test_tlds[example.yyy-example.yyy]",
"tests/test_linkify.py::test_tlds[brie-brie]",
"tests/test_linkify.py::test_escaping",
"tests/test_linkify.py::test_nofollow_off",
"tests/test_linkify.py::test_link_in_html",
"tests/test_linkify.py::test_links_https",
"tests/test_linkify.py::test_add_rel_nofollow",
"tests/test_linkify.py::test_url_with_path",
"tests/test_linkify.py::test_link_ftp",
"tests/test_linkify.py::test_link_query",
"tests/test_linkify.py::test_link_fragment",
"tests/test_linkify.py::test_link_entities",
"tests/test_linkify.py::test_escaped_html",
"tests/test_linkify.py::test_link_http_complete",
"tests/test_linkify.py::test_non_url",
"tests/test_linkify.py::test_javascript_url",
"tests/test_linkify.py::test_unsafe_url",
"tests/test_linkify.py::test_skip_tags",
"tests/test_linkify.py::test_libgl",
"tests/test_linkify.py::test_end_of_sentence[example.com-.]",
"tests/test_linkify.py::test_end_of_sentence[example.com-...]",
"tests/test_linkify.py::test_end_of_sentence[ex.com/foo-.]",
"tests/test_linkify.py::test_end_of_sentence[ex.com/foo-....]",
"tests/test_linkify.py::test_end_of_clause",
"tests/test_linkify.py::test_sarcasm",
"tests/test_linkify.py::test_wrapping_parentheses[(example.com)-expected_data0]",
"tests/test_linkify.py::test_wrapping_parentheses[(example.com/)-expected_data1]",
"tests/test_linkify.py::test_wrapping_parentheses[(example.com/foo)-expected_data2]",
"tests/test_linkify.py::test_wrapping_parentheses[(((example.com/))))-expected_data3]",
"tests/test_linkify.py::test_wrapping_parentheses[example.com/))-expected_data4]",
"tests/test_linkify.py::test_wrapping_parentheses[(foo",
"tests/test_linkify.py::test_wrapping_parentheses[http://en.wikipedia.org/wiki/Test_(assessment)-expected_data7]",
"tests/test_linkify.py::test_wrapping_parentheses[(http://en.wikipedia.org/wiki/Test_(assessment))-expected_data8]",
"tests/test_linkify.py::test_wrapping_parentheses[((http://en.wikipedia.org/wiki/Test_(assessment))-expected_data9]",
"tests/test_linkify.py::test_wrapping_parentheses[(http://en.wikipedia.org/wiki/Test_(assessment)))-expected_data10]",
"tests/test_linkify.py::test_wrapping_parentheses[(http://en.wikipedia.org/wiki/)Test_(assessment-expected_data11]",
"tests/test_linkify.py::test_wrapping_parentheses[hello",
"tests/test_linkify.py::test_parentheses_with_removing",
"tests/test_linkify.py::test_ports[http://foo.com:8000-expected_data0]",
"tests/test_linkify.py::test_ports[http://foo.com:8000/-expected_data1]",
"tests/test_linkify.py::test_ports[http://bar.com:xkcd-expected_data2]",
"tests/test_linkify.py::test_ports[http://foo.com:81/bar-expected_data3]",
"tests/test_linkify.py::test_ports[http://foo.com:-expected_data4]",
"tests/test_linkify.py::test_ports[http://foo.com:\\u0663\\u0669/-expected_data5]",
"tests/test_linkify.py::test_ports[http://foo.com:\\U0001d7e0\\U0001d7d8/-expected_data6]",
"tests/test_linkify.py::test_ignore_bad_protocols",
"tests/test_linkify.py::test_link_emails_and_urls",
"tests/test_linkify.py::test_links_case_insensitive",
"tests/test_linkify.py::test_elements_inside_links",
"tests/test_linkify.py::test_drop_link_tags",
"tests/test_linkify.py::test_naughty_unescaping[<br>-<br>]",
"tests/test_linkify.py::test_naughty_unescaping[<br>",
"tests/test_linkify.py::test_hang",
"tests/test_linkify.py::test_hyphen_in_mail",
"tests/test_linkify.py::test_url_re_arg",
"tests/test_linkify.py::test_email_re_arg",
"tests/test_linkify.py::test_linkify_idempotent",
"tests/test_linkify.py::TestLinkify::test_no_href_links",
"tests/test_linkify.py::TestLinkify::test_rel_already_there",
"tests/test_linkify.py::TestLinkify::test_only_text_is_linkified",
"tests/test_linkify.py::test_linkify_filter[abc-abc]",
"tests/test_linkify.py::test_linkify_filter[example.com-<a",
"tests/test_linkify.py::test_linkify_filter[link:"
] |
[] |
Apache License 2.0
| 3,210 |
[
"bleach/linkifier.py",
"bleach/sanitizer.py"
] |
[
"bleach/linkifier.py",
"bleach/sanitizer.py"
] |
|
streamlink__streamlink-2108
|
934ad3f0eb39cdc2d07b683756544ccca174916c
|
2018-10-10 20:38:57
|
42c34ca104f9a1761164dfce6c3ebabea984a823
|
codecov[bot]: # [Codecov](https://codecov.io/gh/streamlink/streamlink/pull/2108?src=pr&el=h1) Report
> Merging [#2108](https://codecov.io/gh/streamlink/streamlink/pull/2108?src=pr&el=desc) into [master](https://codecov.io/gh/streamlink/streamlink/commit/1e624b19b15a983d2dd3a82be89df76bb96beab9?src=pr&el=desc) will **increase** coverage by `0.01%`.
> The diff coverage is `62.5%`.
```diff
@@ Coverage Diff @@
## master #2108 +/- ##
==========================================
+ Coverage 35.91% 35.93% +0.01%
==========================================
Files 230 231 +1
Lines 20057 20090 +33
==========================================
+ Hits 7204 7219 +15
- Misses 12853 12871 +18
```
beardypig: Thanks for taking the time to submit a plugin. This looks fine to me, but I didn't have time to test it out yet.
|
diff --git a/docs/plugin_matrix.rst b/docs/plugin_matrix.rst
index 9cb83e2b..c34c9516 100644
--- a/docs/plugin_matrix.rst
+++ b/docs/plugin_matrix.rst
@@ -188,6 +188,7 @@ svtplay - svtplay.se Yes Yes Streams may be geo-rest
- oppetarkiv.se
swisstxt - srf.ch Yes No Streams are geo-restricted to Switzerland.
- rsi.ch
+tamago player.tamago.live Yes --
teamliquid teamliquid.net Yes Yes
teleclubzoom teleclubzoom.ch Yes No Streams are geo-restricted to Switzerland.
telefe telefe.com No Yes Streams are geo-restricted to Argentina.
diff --git a/src/streamlink/plugins/tamago.py b/src/streamlink/plugins/tamago.py
new file mode 100644
index 00000000..0b6dc719
--- /dev/null
+++ b/src/streamlink/plugins/tamago.py
@@ -0,0 +1,52 @@
+import re
+
+from streamlink.plugin import Plugin
+from streamlink.plugin.api import validate
+from streamlink.stream import HTTPStream
+from streamlink import NoStreamsError
+
+
+class Tamago(Plugin):
+
+ _url_re = re.compile(r"https?://(?:player\.)?tamago\.live/w/(?P<id>\d+)")
+
+ _api_url_base = "https://player.tamago.live/api/rooms/{id}"
+
+ _api_response_schema = validate.Schema({
+ u"status": 200,
+ u"message": u"Success",
+ u"data": {
+ u"room_number": validate.text,
+ u"stream": {validate.text: validate.url()}
+ }
+ })
+
+ _stream_qualities = {
+ u"150": "144p",
+ u"350": "360p",
+ u"550": "540p",
+ u"900": "720p",
+ }
+
+ @classmethod
+ def can_handle_url(cls, url):
+ return cls._url_re.match(url) is not None
+
+ def _get_streams(self):
+ user_id = self._url_re.match(self.url).group('id')
+
+ try:
+ api_response = self.session.http.get(self._api_url_base.format(id=user_id))
+ streams = self.session.http.json(api_response, schema=self._api_response_schema)['data']['stream']
+ except Exception:
+ raise NoStreamsError(self.url)
+
+ unique_stream_urls = []
+ for stream in streams.keys():
+ if streams[stream] not in unique_stream_urls:
+ unique_stream_urls.append(streams[stream])
+ quality = self._stream_qualities[stream] if stream in self._stream_qualities.keys() else "720p+"
+ yield quality, HTTPStream(self.session, streams[stream])
+
+
+__plugin__ = Tamago
diff --git a/src/streamlink_cli/utils/progress.py b/src/streamlink_cli/utils/progress.py
index dc7a0687..46dca155 100644
--- a/src/streamlink_cli/utils/progress.py
+++ b/src/streamlink_cli/utils/progress.py
@@ -13,22 +13,51 @@ PROGRESS_FORMATS = (
"[download] {written}"
)
+# widths generated from
+# http://www.unicode.org/Public/4.0-Update/EastAsianWidth-4.0.0.txt
-def terminal_len(value):
- """Returns the length of the string it would be when displayed.
- Attempts to decode the string as UTF-8 first if it's a bytestring.
- """
+widths = [
+ (13, 1), (15, 0), (126, 1), (159, 0), (687, 1), (710, 0),
+ (711, 1), (727, 0), (733, 1), (879, 0), (1154, 1), (1161, 0),
+ (4347, 1), (4447, 2), (7467, 1), (7521, 0), (8369, 1), (8426, 0),
+ (9000, 1), (9002, 2), (11021, 1), (12350, 2), (12351, 1), (12438, 2),
+ (12442, 0), (19893, 2), (19967, 1), (55203, 2), (63743, 1), (64106, 2),
+ (65039, 1), (65059, 0), (65131, 2), (65279, 1), (65376, 2), (65500, 1),
+ (65510, 2), (120831, 1), (262141, 2), (1114109, 1)
+]
+
+
+def get_width(o):
+ """Returns the screen column width for unicode ordinal."""
+ for num, wid in widths:
+ if o <= num:
+ return wid
+ return 1
+
+
+def terminal_width(value):
+ """Returns the width of the string it would be when displayed."""
if isinstance(value, bytes):
value = value.decode("utf8", "ignore")
+ return sum(map(get_width, map(ord, value)))
+
- return len(value)
+def get_cut_prefix(value, max_len):
+ """Drops Characters by unicode not by bytes."""
+ should_convert = isinstance(value, bytes)
+ if should_convert:
+ value = value.decode("utf8", "ignore")
+ for i in range(len(value)):
+ if terminal_width(value[i:]) <= max_len:
+ break
+ return value[i:].encode("utf8", "ignore") if should_convert else value[i:]
def print_inplace(msg):
"""Clears out the previous line and prints a new one."""
term_width = get_terminal_size().columns
- spacing = term_width - terminal_len(msg)
+ spacing = term_width - terminal_width(msg)
# On windows we need one less space or we overflow the line for some reason.
if is_win32:
@@ -89,7 +118,8 @@ def progress(iterator, prefix):
- Time elapsed
- Average speed, based on the last few seconds.
"""
- prefix = (".." + prefix[-23:]) if len(prefix) > 25 else prefix
+ if terminal_width(prefix) > 25:
+ prefix = (".." + get_cut_prefix(prefix, 23))
speed_updated = start = time()
speed_written = written = 0
speed_history = deque(maxlen=5)
|
player.tamago.live Plugin
<!--
Thanks for requesting a plugin!
USE THE TEMPLATE. Otherwise your plugin request may be rejected.
First, see the contribution guidelines and plugin request requirements:
https://github.com/streamlink/streamlink/blob/master/CONTRIBUTING.md#contributing-to-streamlink
Plugin requests which fall into the categories we will not implement will be closed immediately.
Also check the list of open and closed plugin requests:
https://github.com/streamlink/streamlink/issues?q=is%3Aissue+label%3A%22plugin+request%22
Please see the text preview to avoid unnecessary formatting errors.
-->
## Plugin Request
<!-- Replace [ ] with [x] in order to check the box -->
- [x] This is a plugin request and I have read the contribution guidelines and plugin request requirements.
### Description
https://player.tamago.live
**Tamago** is a live streaming social network that lets you watch or broadcast live video anytime, anywhere. Like *Twitch*, streamers can interact with their viewers in a chat box. Get exclusive content, from your favourite TV shows and concerts, to the hottest e-sports leagues and more, get front row seats or go behind the scenes with Tamago.
Showcase your talent to a wide audience of viewers and fellow broadcasters. Live video streaming is spontaneous and does not have to be perfect, so anyone can be a broadcaster! You can get rewarded for broadcasting too! Collect gifts during your live streams and keep the profits when you cash out.
https://download.tamago.live/faq
### Example stream URLs
<!-- Example URLs for streams are required. Plugin requests which do not have example URLs will be closed. -->
1. https://player.tamago.live/w/2009642
2. https://player.tamago.live/w/1882066
3. https://player.tamago.live/w/1870142
4. https://player.tamago.live/w/1729968
5. ...
### Additional comments, screenshots, etc.
[Love Streamlink? Please consider supporting our collective. Thanks!](https://opencollective.com/streamlink/donate)
|
streamlink/streamlink
|
diff --git a/tests/plugins/test_tamago.py b/tests/plugins/test_tamago.py
new file mode 100644
index 00000000..06afc7db
--- /dev/null
+++ b/tests/plugins/test_tamago.py
@@ -0,0 +1,24 @@
+import unittest
+
+from streamlink.plugins.tamago import Tamago
+
+
+class TestPluginTamago(unittest.TestCase):
+ def test_can_handle_url(self):
+ should_match = [
+ 'https://player.tamago.live/w/2009642',
+ 'https://player.tamago.live/w/1882066',
+ 'https://player.tamago.live/w/1870142',
+ 'https://player.tamago.live/w/1729968',
+ ]
+ for url in should_match:
+ self.assertTrue(Tamago.can_handle_url(url))
+
+ def test_can_handle_url_negative(self):
+ should_not_match = [
+ 'https://download.tamago.live/faq',
+ 'https://player.tamago.live/gaming/pubg',
+ 'https://www.twitch.tv/twitch'
+ ]
+ for url in should_not_match:
+ self.assertFalse(Tamago.can_handle_url(url))
diff --git a/tests/test_cli_util_progress.py b/tests/test_cli_util_progress.py
new file mode 100644
index 00000000..77afe5c2
--- /dev/null
+++ b/tests/test_cli_util_progress.py
@@ -0,0 +1,20 @@
+# coding: utf-8
+from streamlink_cli.utils.progress import terminal_width, get_cut_prefix
+import unittest
+
+
+class TestCliUtilProgess(unittest.TestCase):
+ def test_terminal_width(self):
+ self.assertEqual(10, terminal_width("ABCDEFGHIJ"))
+ self.assertEqual(30, terminal_width("A你好世界こんにちは안녕하세요B"))
+ self.assertEqual(30, terminal_width("·「」『』【】-=!@#¥%……&×()"))
+ pass
+
+ def test_get_cut_prefix(self):
+ self.assertEqual("녕하세요CD",
+ get_cut_prefix("你好世界こんにちは안녕하세요CD", 10))
+ self.assertEqual("하세요CD",
+ get_cut_prefix("你好世界こんにちは안녕하세요CD", 9))
+ self.assertEqual("こんにちは안녕하세요CD",
+ get_cut_prefix("你好世界こんにちは안녕하세요CD", 23))
+ pass
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 3,
"test_score": 1
},
"num_modified_files": 2
}
|
0.14
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.7",
"reqs_path": [
"dev-requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
codecov==2.1.13
coverage==7.2.7
distlib==0.3.9
exceptiongroup==1.2.2
freezegun==1.5.1
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
iso-639==0.4.5
iso3166==2.1.1
isodate==0.7.2
Jinja2==3.1.6
MarkupSafe==2.1.5
mock==5.2.0
packaging==24.0
pluggy==1.2.0
pycryptodome==3.22.0
pynsist==2.8
PySocks==1.7.1
pytest==7.4.4
pytest-cov==4.1.0
python-dateutil==2.9.0.post0
requests==2.31.0
requests-mock==1.12.1
requests_download==0.1.2
six==1.17.0
-e git+https://github.com/streamlink/streamlink.git@934ad3f0eb39cdc2d07b683756544ccca174916c#egg=streamlink
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
websocket-client==1.6.1
yarg==0.1.10
zipp==3.15.0
|
name: streamlink
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- charset-normalizer==3.4.1
- codecov==2.1.13
- coverage==7.2.7
- distlib==0.3.9
- exceptiongroup==1.2.2
- freezegun==1.5.1
- idna==3.10
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- iso-639==0.4.5
- iso3166==2.1.1
- isodate==0.7.2
- jinja2==3.1.6
- markupsafe==2.1.5
- mock==5.2.0
- packaging==24.0
- pluggy==1.2.0
- pycryptodome==3.22.0
- pynsist==2.8
- pysocks==1.7.1
- pytest==7.4.4
- pytest-cov==4.1.0
- python-dateutil==2.9.0.post0
- requests==2.31.0
- requests-download==0.1.2
- requests-mock==1.12.1
- six==1.17.0
- tomli==2.0.1
- typing-extensions==4.7.1
- urllib3==2.0.7
- websocket-client==1.6.1
- yarg==0.1.10
- zipp==3.15.0
prefix: /opt/conda/envs/streamlink
|
[
"tests/plugins/test_tamago.py::TestPluginTamago::test_can_handle_url",
"tests/plugins/test_tamago.py::TestPluginTamago::test_can_handle_url_negative",
"tests/test_cli_util_progress.py::TestCliUtilProgess::test_get_cut_prefix",
"tests/test_cli_util_progress.py::TestCliUtilProgess::test_terminal_width"
] |
[] |
[] |
[] |
BSD 2-Clause "Simplified" License
| 3,211 |
[
"docs/plugin_matrix.rst",
"src/streamlink_cli/utils/progress.py",
"src/streamlink/plugins/tamago.py"
] |
[
"docs/plugin_matrix.rst",
"src/streamlink_cli/utils/progress.py",
"src/streamlink/plugins/tamago.py"
] |
acorg__dark-matter-632
|
71d1941049e153d14615cdd6e3d694ff6a546b98
|
2018-10-10 22:02:23
|
71d1941049e153d14615cdd6e3d694ff6a546b98
|
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d82fc9b..0e884c1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 3.0.39 October 10, 2018
+
+The fix to solve [#630](https://github.com/acorg/dark-matter/issues/630)
+was insufficient. That's fixed in this release, hopefully!
+
## 3.0.38 October 5, 2018
Fixed [#630](https://github.com/acorg/dark-matter/issues/630) to deal with
diff --git a/dark/__init__.py b/dark/__init__.py
index 7513e6e..20729ae 100644
--- a/dark/__init__.py
+++ b/dark/__init__.py
@@ -7,4 +7,4 @@ if sys.version_info < (2, 7):
# will not be found by the version() function in ../setup.py
#
# Remember to update ../CHANGELOG.md describing what's new in each version.
-__version__ = '3.0.38'
+__version__ = '3.0.39'
diff --git a/dark/sam.py b/dark/sam.py
index 0167fdc..a4f2c1a 100644
--- a/dark/sam.py
+++ b/dark/sam.py
@@ -65,40 +65,56 @@ def samReferencesToStr(filenameOrSamfile, indent=0):
return _references(sam)
-def _hardClip(sequence, cigartuples):
+def _hardClip(sequence, quality, cigartuples):
"""
Hard clip (if necessary) a sequence.
@param sequence: A C{str} nucleotide sequence.
- @param cigartuples: An iterable of (operation, length) tuples, specifying
- matching as per the SAM specification.
- @return: A hard-clipped C{str} sequence if hard-clipping is indicated by
- the CIGAR operations and has not already been performed (as indicated
- by the lengths of the sequence and the sum of the CIGAR operation
- lengths).
+ @param quality: A C{str} quality string or a C{list} of C{int} quality
+ values as returned by pysam.
+ @param cigartuples: An iterable of (operation, length) tuples, detailing
+ the alignment, as per the SAM specification.
+ @return: A 3-tuple consisting of
+ 1) a hard-clipped C{str} sequence if hard-clipping is indicated by
+ the CIGAR operations.
+ 2) a hard-clipped quality C{str} or C{list} (depending on what
+ type we were passed) if hard-clipping is indicated by the CIGAR
+ operations.
+ 3) a Boolean, C{True} if hard clipping was performed by this
+ function or C{False} if the hard clipping had already been
+ done.
"""
hardClipCount = cigarLength = 0
for (operation, length) in cigartuples:
hardClipCount += operation == CHARD_CLIP
- cigarLength += length
+ cigarLength += length if operation in _CONSUMES_QUERY else 0
sequenceLength = len(sequence)
+ assert sequenceLength == len(quality)
clipLeft = clipRight = 0
+ clippedSequence = sequence
+ clippedQuality = quality
+
+ if sequenceLength > cigarLength:
+ alreadyClipped = False
+ else:
+ assert sequenceLength == cigarLength
+ alreadyClipped = True
if hardClipCount == 0:
pass
elif hardClipCount == 1:
# Hard clip either at the start or the end.
if cigartuples[0][0] == CHARD_CLIP:
- clipLeft = cigartuples[0][1]
- if sequenceLength == cigarLength:
- # The LHS hard clipping has not been done.
- sequence = sequence[clipLeft:]
+ if not alreadyClipped:
+ clipLeft = cigartuples[0][1]
+ clippedSequence = sequence[clipLeft:]
+ clippedQuality = quality[clipLeft:]
elif cigartuples[-1][0] == CHARD_CLIP:
- clipRight = cigartuples[-1][1]
- if sequenceLength == cigarLength:
- # The RHS hard clipping has not been done.
- sequence = sequence[:-clipRight]
+ if not alreadyClipped:
+ clipRight = cigartuples[-1][1]
+ clippedSequence = sequence[:-clipRight]
+ clippedQuality = quality[:-clipRight]
else:
raise ValueError(
'Invalid CIGAR tuples (%s) contains hard-clipping operation '
@@ -107,19 +123,33 @@ def _hardClip(sequence, cigartuples):
elif hardClipCount == 2:
# Hard clip at both the start and end.
assert cigartuples[0][0] == cigartuples[-1][0] == CHARD_CLIP
- clipLeft, clipRight = cigartuples[0][1], cigartuples[-1][1]
- if sequenceLength == cigarLength:
- # The hard clipping has not been done.
- sequence = sequence[clipLeft:-clipRight]
+ if not alreadyClipped:
+ clipLeft, clipRight = cigartuples[0][1], cigartuples[-1][1]
+ clippedSequence = sequence[clipLeft:-clipRight]
+ clippedQuality = quality[clipLeft:-clipRight]
else:
raise ValueError(
'Invalid CIGAR tuples (%s) specifies hard-clipping %d times (2 '
'is the maximum).' % (cigartuples, hardClipCount))
- assert len(sequence) + clipLeft + clipRight == cigarLength, (
- '%d + %d + %d != %d' % (len(sequence), clipLeft, clipRight,
- cigarLength))
- return sequence
+ weClipped = bool(clipLeft or clipRight)
+
+ if weClipped:
+ assert not alreadyClipped
+ if len(clippedSequence) + clipLeft + clipRight != sequenceLength:
+ raise ValueError(
+ 'Sequence %r (length %d) clipped to %r (length %d), but the '
+ 'difference between these two lengths (%d) is not equal to '
+ 'the sum (%d) of the left and right clip lengths (%d and %d '
+ 'respectively). CIGAR tuples: %s' %
+ (sequence, len(sequence),
+ clippedSequence, len(clippedSequence),
+ abs(len(sequence) - len(clippedSequence)),
+ clipLeft + clipRight, clipLeft, clipRight, cigartuples))
+ else:
+ assert len(clippedSequence) == len(clippedQuality) == sequenceLength
+
+ return clippedSequence, clippedQuality, weClipped
class SAMFilter(object):
@@ -280,6 +310,7 @@ class SAMFilter(object):
if storeQueryIds:
self.queryIds = queryIds = set()
+ lastAlignment = None
count = 0
with samfile(self.filename) as samAlignment:
for count, alignment in enumerate(samAlignment.fetch(), start=1):
@@ -296,6 +327,32 @@ class SAMFilter(object):
(maxScore is not None and score > maxScore)):
continue
+ # Secondary and supplementary alignments may have a '*'
+ # (pysam returns this as None) SEQ field, indicating that
+ # the previous sequence should be used. This is best
+ # practice according to section 2.5.2 of
+ # https://samtools.github.io/hts-specs/SAMv1.pdf So we use
+ # the last alignment if we get None as a query sequence.
+ if alignment.query_sequence is None:
+ if lastAlignment is None:
+ raise InvalidSAM(
+ 'pysam produced an alignment (number %d) with no '
+ 'query sequence without previously giving an '
+ 'alignment with a sequence.' % count)
+ # Use the previous query sequence and quality.
+ (alignment.query_sequence,
+ alignment.query_qualities, _) = _hardClip(
+ lastAlignment.query_sequence,
+ lastAlignment.query_qualities,
+ alignment.cigartuples)
+ else:
+ lastAlignment = alignment
+ (alignment.query_sequence,
+ alignment.query_qualities, _) = _hardClip(
+ alignment.query_sequence,
+ alignment.query_qualities,
+ alignment.cigartuples)
+
if ((filterRead is None or
filterRead(Read(alignment.query_name,
alignment.query_sequence,
@@ -372,8 +429,8 @@ class PaddedSAM(object):
self.referenceInsertions = defaultdict(list)
def queries(self, rcSuffix='', rcNeeded=False, padChar='-',
- queryInsertionChar='N', allowDuplicateIds=False,
- addAlignment=False):
+ queryInsertionChar='N', unknownQualityChar='!',
+ allowDuplicateIds=False, addAlignment=False):
"""
Produce padded (with gaps) queries according to the CIGAR string and
reference sequence length for each matching query sequence.
@@ -395,6 +452,9 @@ class PaddedSAM(object):
is inserted as a 'missing' query character (i.e., a base that can
be assumed to have been lost due to an error) whose existence is
necessary for the match to continue.
+ @param unknownQualityChar: The character to put into the quality
+ string when unknown bases are inserted in the query or the query
+ is padded on the left/right with gaps.
@param allowDuplicateIds: If C{True}, repeated query ids (due to
secondary or supplemental matches) will not have /1, /2, etc.
appended to their ids. So repeated ids may appear in the yielded
@@ -417,38 +477,17 @@ class PaddedSAM(object):
idCount = Counter()
MATCH_OPERATIONS = {CMATCH, CEQUAL, CDIFF}
- lastQuery = None
for lineNumber, alignment in enumerate(
self.samFilter.alignments(), start=1):
query = alignment.query_sequence
-
- # Secondary (and presumably supplementary) alignments may have
- # a '*' (None in pysam) SEQ field, indicating that the previous
- # sequence should be used. This is best practice according to
- # section 2.5.2 of https://samtools.github.io/hts-specs/SAMv1.pdf
- if query is None:
- if alignment.is_secondary or alignment.is_supplementary:
- if lastQuery is None:
- raise InvalidSAM(
- 'Query line %d has an empty SEQ field, but no '
- 'previous alignment is present.' % lineNumber)
- else:
- query = _hardClip(lastQuery, alignment.cigartuples)
- else:
- raise InvalidSAM(
- 'Query line %d has an empty SEQ field, but the '
- 'alignment is not marked as secondary or '
- 'supplementary.' % lineNumber)
- else:
- # Remember the last query here (before we potentially modify
- # it due to it being reverse complimented for the alignment).
- lastQuery = query
+ quality = ''.join(chr(q + 33) for q in alignment.query_qualities)
if alignment.is_reverse:
if rcNeeded:
query = DNARead('id', query).reverseComplement().sequence
+ quality = quality[::-1]
if rcSuffix:
alignment.query_name += rcSuffix
@@ -467,6 +506,7 @@ class PaddedSAM(object):
queryIndex = 0
referenceIndex = referenceStart
alignedSequence = ''
+ alignedQuality = ''
for operation, length in alignment.cigartuples:
@@ -477,6 +517,7 @@ class PaddedSAM(object):
if operation in MATCH_OPERATIONS:
atStart = False
alignedSequence += query[queryIndex:queryIndex + length]
+ alignedQuality += quality[queryIndex:queryIndex + length]
elif operation == CINS:
# Insertion to the reference. This consumes query bases but
# we don't output them because the reference cannot be
@@ -494,6 +535,7 @@ class PaddedSAM(object):
# an insertion into the query to compensate.
atStart = False
alignedSequence += queryInsertionChar * length
+ alignedQuality += unknownQualityChar * length
elif operation == CREF_SKIP:
# Skipped reference. Opens a gap in the query. For
# mRNA-to-genome alignment, an N operation represents an
@@ -502,6 +544,7 @@ class PaddedSAM(object):
# to occur.
atStart = False
alignedSequence += queryInsertionChar * length
+ alignedQuality += unknownQualityChar * length
elif operation == CSOFT_CLIP:
# Bases in the query that are not part of the match. We
# remove these from the query if they protrude before the
@@ -514,13 +557,17 @@ class PaddedSAM(object):
unwantedLeft = length - referenceStart
if unwantedLeft > 0:
# The query protrudes left. Copy its right part.
- alignedSequence += query[queryIndex + unwantedLeft:
- queryIndex + length]
+ alignedSequence += query[
+ queryIndex + unwantedLeft:queryIndex + length]
+ alignedQuality += quality[
+ queryIndex + unwantedLeft:queryIndex + length]
referenceStart = 0
else:
referenceStart -= length
alignedSequence += query[
queryIndex:queryIndex + length]
+ alignedQuality += quality[
+ queryIndex:queryIndex + length]
else:
unwantedRight = (
(referenceStart + len(alignedSequence) + length) -
@@ -530,9 +577,13 @@ class PaddedSAM(object):
# The query protrudes right. Copy its left part.
alignedSequence += query[
queryIndex:queryIndex + length - unwantedRight]
+ alignedQuality += quality[
+ queryIndex:queryIndex + length - unwantedRight]
else:
alignedSequence += query[
queryIndex:queryIndex + length]
+ alignedQuality += quality[
+ queryIndex:queryIndex + length]
elif operation == CHARD_CLIP:
# Some bases have been completely removed from the query.
# This (H) can only be present as the first and/or last
@@ -555,8 +606,8 @@ class PaddedSAM(object):
if queryIndex != len(query):
# Oops, we did not consume the entire query.
raise ValueError(
- 'Query %s not fully consumed when parsing CIGAR string. '
- 'Query %s (len %d), final query index %d, CIGAR: %r' %
+ 'Query %r not fully consumed when parsing CIGAR string. '
+ 'Query %r (len %d), final query index %d, CIGAR: %r' %
(alignment.query_name, query, len(query), queryIndex,
alignment.cigartuples))
@@ -567,13 +618,17 @@ class PaddedSAM(object):
# Put gap characters before and after the aligned sequence so that
# it is offset properly and matches the length of the reference.
- paddedSequence = (
- (padChar * referenceStart) +
- alignedSequence +
- padChar * (referenceLength -
- (referenceStart + len(alignedSequence))))
+ padRightLength = (referenceLength -
+ (referenceStart + len(alignedSequence)))
+ paddedSequence = (padChar * referenceStart +
+ alignedSequence +
+ padChar * padRightLength)
+ paddedQuality = (unknownQualityChar * referenceStart +
+ alignedQuality +
+ unknownQualityChar * padRightLength)
+
+ read = Read(queryId, paddedSequence, paddedQuality)
- read = Read(queryId, paddedSequence)
if addAlignment:
read.alignment = alignment
|
Change SAM filtering to allow for CIGAR strings that indicate hard clipping but that have sequences that are not clipped
It can happen that an aligner (`bwa mem -a` does this) can generate SAM lines like these two:
```
K00234:90:HTWVHBBXX:6:1101:1844:10493 0 Chimp-D00220 364 0 3S78M * 0 0
TTTTGGTTATCGCTGGATGTGTCTGCGGCGTTTTATCATCTTCCTCTTCATCCTGCTGCTATGCCTCATCTTATTGTTGGT
AAFFFJAJJJJJFJJJ7JJJJFJFJJFJFJAFJJJJAAF<FFFAF<JJ-FF<JF-AF7F<AJF--<-F7-AA-7JFJJFJ<
NM:i:1 MD:Z:69C8 AS:i:73 XS:i:73
K00234:90:HTWVHBBXX:6:1101:1844:10493 256 D-AM494716 364 0 3H78M * 0 0
* *
NM:i:1 MD:Z:69C8 AS:i:73
```
those are actually just 2 lines in the SAM file, giving alignments for the same read. The issue here is that the first alignment has a CIGAR string of `3S78M` (3 soft clipped nts, 78 matches) and because it's a soft clip the bases are still in the query string. On the next line we have `*` and `*` for the query and quality (because this is a secondary match (flag = 256)) and a CIGAR string of `3H78M` (3 hard clipped, 78 match). Normally with hard clipping the bases are removed from the sequence, but in this case because the query is first given with a soft clip the bases are retained. So code that assumes hard -clipped bases will be removed will break.
You might think `bwa mem -a -H` would cause hard clipping to always be done (perhaps by repeating the (clipped) query sequence in secondary matches) but that's not what happens - bwa reverts to the non- `-a` option behaviour.
So our code in `dark/sam.py` will need to be smarter. It should figure out in advance if the query has actually been hard clipped and use that to decide whether a hard clip indicator in the CIGAR string should consume query bases or not.
|
acorg/dark-matter
|
diff --git a/test/test_sam.py b/test/test_sam.py
index 35acba8..4abf556 100644
--- a/test/test_sam.py
+++ b/test/test_sam.py
@@ -313,7 +313,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testMixedMatch(self):
"""
@@ -328,7 +328,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testHardClipLeft(self):
"""
@@ -343,7 +343,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testHardClipRight(self):
"""
@@ -358,22 +358,23 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testRcNeeded(self):
"""
A reverse-complimented match (flag = 16) when rcNeeded=True is passed
- must result in the expected (reverse complimented) padded sequence.
+ must result in the expected (reverse complimented) padded sequence
+ and reversed quality string.
"""
data = '\n'.join([
'@SQ SN:ref1 LN:10',
- 'query1 16 ref1 2 60 6M * 0 0 TCTAGG ZZZZZZ',
+ 'query1 16 ref1 2 60 6M * 0 0 TCTAGG 123456',
]).replace(' ', '\t')
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries(rcNeeded=True))
- self.assertEqual(Read('query1', '-CCTAGA---'), read)
+ self.assertEqual(Read('query1', '-CCTAGA---', '!654321!!!'), read)
def testRcSuffix(self):
"""
@@ -382,13 +383,14 @@ class TestPaddedSAM(TestCase):
"""
data = '\n'.join([
'@SQ SN:ref1 LN:10',
- 'query1 16 ref1 2 60 6M * 0 0 TCTAGG ZZZZZZ',
+ 'query1 16 ref1 2 60 6M * 0 0 TCTAGG 123456',
]).replace(' ', '\t')
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
- (read,) = list(ps.queries(rcSuffix='-rc'))
- self.assertEqual(Read('query1-rc', '-TCTAGG---'), read)
+ (read,) = list(ps.queries(rcSuffix='-rc', rcNeeded=True))
+ self.assertEqual(Read('query1-rc', '-CCTAGA---', '!654321!!!'),
+ read)
def testQuerySoftClipLeft(self):
"""
@@ -403,7 +405,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testQuerySoftClipReachesLeftEdge(self):
"""
@@ -418,7 +420,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', 'TCTAGG----'), read)
+ self.assertEqual(Read('query1', 'TCTAGG----', 'ZZZZZZ!!!!'), read)
def testQuerySoftClipProtrudesLeft(self):
"""
@@ -433,7 +435,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', 'AGG-------'), read)
+ self.assertEqual(Read('query1', 'AGG-------', 'ZZZ!!!!!!!'), read)
def testKF414679SoftClipLeft(self):
"""
@@ -451,7 +453,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', seq[14:]), read)
+ self.assertEqual(Read('query1', seq[14:], quality[14:]), read)
def testQuerySoftClipRight(self):
"""
@@ -466,7 +468,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '---TCTAGG-'), read)
+ self.assertEqual(Read('query1', '---TCTAGG-', '!!!ZZZZZZ!'), read)
def testQuerySoftClipReachesRightEdge(self):
"""
@@ -481,7 +483,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '----TCTAGG'), read)
+ self.assertEqual(Read('query1', '----TCTAGG', '!!!!ZZZZZZ'), read)
def testQuerySoftClipProtrudesRight(self):
"""
@@ -496,7 +498,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-----TCTAG'), read)
+ self.assertEqual(Read('query1', '-----TCTAG', '!!!!!ZZZZZ'), read)
def testQuerySoftClipProtrudesBothSides(self):
"""
@@ -511,7 +513,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', 'TAGGCTGACT'), read)
+ self.assertEqual(Read('query1', 'TAGGCTGACT', 'ZZZZZZZZZZ'), read)
def testQueryHardClipAndSoftClipProtrudesBothSides(self):
"""
@@ -527,7 +529,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', 'TAGGCTGACT'), read)
+ self.assertEqual(Read('query1', 'TAGGCTGACT', 'ZZZZZZZZZZ'), read)
def testReferenceInsertion(self):
"""
@@ -542,7 +544,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCGG-----'), read)
+ self.assertEqual(Read('query1', '-TCGG-----', '!ZZZZ!!!!!'), read)
self.assertEqual(
{
'query1': [(3, 'TA')],
@@ -564,8 +566,9 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read1, read2) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCGG-----'), read1)
- self.assertEqual(Read('query1/1', '---TCG----'), read2)
+ self.assertEqual(Read('query1', '-TCGG-----', '!ZZZZ!!!!!'), read1)
+ self.assertEqual(Read('query1/1', '---TCG----', '!!!ZZZ!!!!'),
+ read2)
self.assertEqual(
{
'query1': [(3, 'TA')],
@@ -576,7 +579,7 @@ class TestPaddedSAM(TestCase):
def testReferenceDeletion(self):
"""
An deletion of reference bases must result in the expected padded
- sequence (with gaps).
+ sequence (with Ns inserted for the deleted reference bases).
"""
data = '\n'.join([
'@SQ SN:ref1 LN:10',
@@ -586,12 +589,14 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCNNTAGG-'), read)
+ self.assertEqual(Read('query1', '-TCNNTAGG-', '!ZZ!!ZZZZ!'), read)
- def testReferenceDeletionAlternateChar(self):
+ def testReferenceDeletionAlternateChars(self):
"""
An deletion of reference bases must result in the expected padded
- sequence (with gaps) when a queryInsertionChar is passed
+ sequence (with the passed query insertion character and unknown
+ quality character) when queryInsertionChar and unknownQualityChar
+ arguments are passed.
"""
data = '\n'.join([
'@SQ SN:ref1 LN:10',
@@ -600,13 +605,15 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
- (read,) = list(ps.queries(queryInsertionChar='?'))
- self.assertEqual(Read('query1', '-TC??TAGG-'), read)
+ (read,) = list(ps.queries(queryInsertionChar='?',
+ unknownQualityChar='+'))
+ self.assertEqual(Read('query1', '-TC??TAGG-', '+ZZ++ZZZZ+'), read)
def testReferenceSkip(self):
"""
An skip of reference bases must result in the expected padded
- sequence (with gaps).
+ sequence with the passed unknown quality character when the
+ unknownQualityChar argument is passed.
"""
data = '\n'.join([
'@SQ SN:ref1 LN:10',
@@ -615,13 +622,15 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
- (read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCNNTAGG-'), read)
+ (read,) = list(ps.queries(unknownQualityChar='.'))
+ self.assertEqual(Read('query1', '-TCNNTAGG-', '.ZZ..ZZZZ.'), read)
- def testReferenceSkipAlternateChar(self):
+ def testReferenceSkipAlternateChars(self):
"""
An skip of reference bases must result in the expected padded
- sequence (with gaps) when a queryInsertionChar is passed.
+ sequence (with the passed query insertion character and unknown
+ quality character) when queryInsertionChar and unknownQualityChar
+ arguments are passed.
"""
data = '\n'.join([
'@SQ SN:ref1 LN:10',
@@ -630,8 +639,9 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
- (read,) = list(ps.queries(queryInsertionChar='X'))
- self.assertEqual(Read('query1', '-TCXXTAGG-'), read)
+ (read,) = list(ps.queries(queryInsertionChar='X',
+ unknownQualityChar='+'))
+ self.assertEqual(Read('query1', '-TCXXTAGG-', '+ZZ++ZZZZ+'), read)
def testMixedMatchSpecificReferenceButNoMatches(self):
"""
@@ -662,7 +672,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename, referenceIds={'ref1'}))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testMinLength(self):
"""
@@ -679,7 +689,7 @@ class TestPaddedSAM(TestCase):
filterRead = ReadFilter(minLength=6).filter
ps = PaddedSAM(SAMFilter(filename, filterRead=filterRead))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testDropSecondary(self):
"""
@@ -694,7 +704,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename, dropSecondary=True))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testDropSupplementary(self):
"""
@@ -710,7 +720,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename, dropSupplementary=True))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testDropDuplicates(self):
"""
@@ -726,7 +736,7 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename, dropDuplicates=True))
(read,) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read)
def testAllowDuplicateIds(self):
"""
@@ -742,8 +752,9 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read1, read2) = list(ps.queries(allowDuplicateIds=True))
- self.assertEqual(Read('query1', '-TCTAGG---'), read1)
- self.assertEqual(Read('query1', '--TC------'), read2)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read1)
+ self.assertEqual(Read('query1', '--TC------', '!!ZZ!!!!!!'),
+ read2)
def testDuplicateIdDisambiguation(self):
"""
@@ -759,9 +770,11 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read1, read2, read3) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read1)
- self.assertEqual(Read('query1/1', '--TC------'), read2)
- self.assertEqual(Read('query1/2', '--TCGA----'), read3)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read1)
+ self.assertEqual(Read('query1/1', '--TC------', '!!ZZ!!!!!!'),
+ read2)
+ self.assertEqual(Read('query1/2', '--TCGA----', '!!ZZZZ!!!!'),
+ read3)
def testKeepQualityControlFailures(self):
"""
@@ -777,8 +790,8 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename, keepQCFailures=True))
(read1, read2) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCTAGG---'), read1)
- self.assertEqual(Read('query2', '---TC-----'), read2)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read1)
+ self.assertEqual(Read('query2', '---TC-----', '!!!ZZ!!!!!'), read2)
def testSecondaryWithNoPreviousSequence(self):
"""
@@ -792,8 +805,9 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
- error = ('^Query line 1 has an empty SEQ field, but no previous '
- 'alignment is present\\.$')
+ error = ('^pysam produced an alignment \\(number 1\\) with no '
+ 'query sequence without previously giving an alignment '
+ 'with a sequence\\.$')
queries = ps.queries()
assertRaisesRegex(self, InvalidSAM, error, list, queries)
@@ -812,9 +826,10 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read1, read2, read3) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCT------'), read1)
- self.assertEqual(Read('query2', '-TCTA-----'), read2)
- self.assertEqual(Read('query2/1', '-----TCTA-'), read3)
+ self.assertEqual(Read('query1', '-TCT------', '!ZZZ!!!!!!'), read1)
+ self.assertEqual(Read('query2', '-TCTA-----', '!ZZZZ!!!!!'), read2)
+ self.assertEqual(Read('query2/1', '-----TCTA-', '!!!!!ZZZZ!'),
+ read3)
def testSupplementaryWithNoPreviousSequence(self):
"""
@@ -828,8 +843,9 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
- error = ('^Query line 1 has an empty SEQ field, but no previous '
- 'alignment is present\\.$')
+ error = ('^pysam produced an alignment \\(number 1\\) with no '
+ 'query sequence without previously giving an alignment '
+ 'with a sequence\\.$')
queries = ps.queries()
assertRaisesRegex(self, InvalidSAM, error, list, queries)
@@ -848,9 +864,10 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read1, read2, read3) = list(ps.queries())
- self.assertEqual(Read('query1', '-TCT------'), read1)
- self.assertEqual(Read('query2', '-TCTA-----'), read2)
- self.assertEqual(Read('query2/1', '-----TCTA-'), read3)
+ self.assertEqual(Read('query1', '-TCT------', '!ZZZ!!!!!!'), read1)
+ self.assertEqual(Read('query2', '-TCTA-----', '!ZZZZ!!!!!'), read2)
+ self.assertEqual(Read('query2/1', '-----TCTA-', '!!!!!ZZZZ!'),
+ read3)
def testNotSecondaryAndNotSupplementaryWithNoSequence(self):
"""
@@ -864,8 +881,9 @@ class TestPaddedSAM(TestCase):
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
- error = ('^Query line 1 has an empty SEQ field, but the alignment '
- 'is not marked as secondary or supplementary\\.$')
+ error = ('^pysam produced an alignment \\(number 1\\) with no '
+ 'query sequence without previously giving an alignment '
+ 'with a sequence\\.$')
queries = ps.queries()
assertRaisesRegex(self, InvalidSAM, error, list, queries)
@@ -877,28 +895,28 @@ class TestPaddedSAM(TestCase):
data = '\n'.join([
'@SQ SN:ref1 LN:10',
'query1 0 ref1 2 60 2=2X2M * 0 0 TCTAGG 123456',
- 'query2 0 ref1 2 60 2= * 0 0 TC XY',
+ 'query2 0 ref1 2 60 2= * 0 0 TC 78',
]).replace(' ', '\t')
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
(read1, read2) = list(ps.queries(addAlignment=True))
- self.assertEqual(Read('query1', '-TCTAGG---'), read1)
+ self.assertEqual(Read('query1', '-TCTAGG---', '!123456!!!'), read1)
self.assertEqual('TCTAGG', read1.alignment.query_sequence)
self.assertEqual('123456', ''.join(
map(lambda x: chr(x + 33), read1.alignment.query_qualities)))
- self.assertEqual(Read('query2', '-TC-------'), read2)
+ self.assertEqual(Read('query2', '-TC-------', '!78!!!!!!!'), read2)
self.assertEqual('TC', read2.alignment.query_sequence)
- self.assertEqual('XY', ''.join(
+ self.assertEqual('78', ''.join(
map(lambda x: chr(x + 33), read2.alignment.query_qualities)))
def testHardClippingInCIGARButQueryNotHardClipped(self):
"""
As documented in https://github.com/acorg/dark-matter/issues/630 we
- have to deal correctly with a case in which the CIGAR string says a
- query should be hard clipped but the query sequence in the SAM file
+ must deal correctly with a case in which the CIGAR string says a
+ query is hard-clipped but the query sequence in the SAM file
actually isn't. This can be due to a prior alignment with a soft clip,
in which case the full query sequence has to be given before the
secondary alignment with the hard clip.
@@ -906,20 +924,77 @@ class TestPaddedSAM(TestCase):
data = '\n'.join([
'@SQ SN:Chimp-D00220 LN:8',
'@SQ SN:D-AM494716 LN:8',
+ '@SQ SN:D-XXX LN:8',
+ '@SQ SN:Chimp-YYY LN:8',
'query1 0 Chimp-D00220 1 0 3S5M * 0 0 TTTTGGTT 12345678',
'query1 256 D-AM494716 1 0 3H5M * 0 0 * *',
+ 'query1 256 D-XXX 1 0 5H3M * 0 0 * *',
+ 'query1 0 Chimp-YYY 1 0 8M * 0 0 * *',
]).replace(' ', '\t')
with dataFile(data) as filename:
ps = PaddedSAM(SAMFilter(filename))
- (read1, read2) = list(ps.queries(addAlignment=True))
+ (read1, read2, read3, read4) = list(ps.queries(addAlignment=True))
- self.assertEqual(Read('query1', 'TGGTT---'), read1)
+ self.assertEqual(Read('query1', 'TGGTT---', '45678!!!'), read1)
self.assertEqual('TTTTGGTT', read1.alignment.query_sequence)
- self.assertEqual(Read('query1/1', 'TGGTT---'), read2)
- # pysam uses None for the query sequence on a secondary alignment.
- self.assertIs(None, read2.alignment.query_sequence)
+ self.assertEqual(Read('query1/1', 'TGGTT---', '45678!!!'), read2)
+ self.assertEqual('TGGTT', read2.alignment.query_sequence)
+
+ self.assertEqual(Read('query1/2', 'GTT-----', '678!!!!!'), read3)
+ self.assertEqual('GTT', read3.alignment.query_sequence)
+
+ self.assertEqual(Read('query1/3', 'TTTTGGTT', '12345678'), read4)
+ self.assertEqual('TTTTGGTT', read4.alignment.query_sequence)
+
+ def testSecondaryAlignmentHasQuery(self):
+ """
+ If the first alignment of a query is against a reference that is not
+ wanted, a subsequent secondary alignment (SAM flag = 256) must have
+ the original query and quality strings (even though these are only
+ present in the SAM as * characters and the query is None when it comes
+ back from pysam).
+ """
+ data = '\n'.join([
+ '@SQ SN:ref1 LN:10',
+ '@SQ SN:ref2 LN:10',
+ 'query1 0 ref1 2 60 2=2X2M * 0 0 TCTAGG ZZZZZZ',
+ 'query1 256 ref2 2 60 2=2X2M * 0 0 * *',
+ ]).replace(' ', '\t')
+
+ with dataFile(data) as filename:
+ ps = PaddedSAM(SAMFilter(filename))
+ (read1, read2) = list(ps.queries(addAlignment=True))
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read1)
+ self.assertEqual('ref1', read1.alignment.reference_name)
+ self.assertEqual(Read('query1/1', '-TCTAGG---', '!ZZZZZZ!!!'),
+ read2)
+ self.assertEqual('ref2', read2.alignment.reference_name)
+
+ def testSupplementaryAlignmentHasQuery(self):
+ """
+ If the first alignment of a query is against a reference that is not
+ wanted, a subsequent supplementary alignment (SAM flag = 2048) must
+ have the original query and quality strings (even though these are only
+ present in the SAM as * characters and the query is None when it comes
+ back from pysam).
+ """
+ data = '\n'.join([
+ '@SQ SN:ref1 LN:10',
+ '@SQ SN:ref2 LN:10',
+ 'query1 0 ref1 2 60 2=2X2M * 0 0 TCTAGG ZZZZZZ',
+ 'query1 2048 ref2 2 60 2=2X2M * 0 0 * *',
+ ]).replace(' ', '\t')
+
+ with dataFile(data) as filename:
+ ps = PaddedSAM(SAMFilter(filename))
+ (read1, read2) = list(ps.queries(addAlignment=True))
+ self.assertEqual(Read('query1', '-TCTAGG---', '!ZZZZZZ!!!'), read1)
+ self.assertEqual('ref1', read1.alignment.reference_name)
+ self.assertEqual(Read('query1/1', '-TCTAGG---', '!ZZZZZZ!!!'),
+ read2)
+ self.assertEqual('ref2', read2.alignment.reference_name)
class TestSamReferencesToStr(TestCase):
@@ -958,20 +1033,6 @@ class TestHardClip(TestCase):
"""
Test the _hardClip function.
"""
- def testCIGARLengthTooHigh(self):
- """
- If the total length of the CIGAR operations exceeds the length of the
- sequence, an AssertionError must be raised.
- """
- self.assertRaises(AssertionError, _hardClip, 'CGT', ((CMATCH, 5),))
-
- def testCIGARLengthTooLow(self):
- """
- If the total length of the CIGAR operations is less than the length of
- the sequence, an AssertionError must be raised.
- """
- self.assertRaises(AssertionError, _hardClip, 'CGT', ((CMATCH, 2),))
-
def testHardClipInMiddle(self):
"""
If hard clipping is given as an operation not at the beginning or end
@@ -980,8 +1041,8 @@ class TestHardClip(TestCase):
error = ('^Invalid CIGAR tuples .* contains hard-clipping operation '
'that is neither at the start nor the end of the sequence\.$')
self.assertRaisesRegex(
- ValueError, error,
- _hardClip, 'CGT', ((CMATCH, 1), (CHARD_CLIP, 1), (CMATCH, 1),))
+ ValueError, error, _hardClip, 'CGT', '123',
+ ((CMATCH, 1), (CHARD_CLIP, 1), (CMATCH, 1),))
def testThreeHardClips(self):
"""
@@ -991,8 +1052,7 @@ class TestHardClip(TestCase):
error = ('^Invalid CIGAR tuples .* specifies hard-clipping 3 times '
'\(2 is the maximum\).$')
self.assertRaisesRegex(
- ValueError, error,
- _hardClip, 'CGT',
+ ValueError, error, _hardClip, 'CGT', '123',
((CHARD_CLIP, 1), (CHARD_CLIP, 1), (CHARD_CLIP, 1),))
def testNoClip(self):
@@ -1000,23 +1060,26 @@ class TestHardClip(TestCase):
If no hard clipping is indicated, the function must return the
original sequence.
"""
- self.assertEqual('CGT', _hardClip('CGT', ((CMATCH, 3),)))
+ self.assertEqual(('CGT', '123', False),
+ _hardClip('CGT', '123', ((CMATCH, 3),)))
def testClipLeft(self):
"""
If hard clipping on the left is indicated, and has not been done,
the function must return the expected sequence.
"""
- self.assertEqual('CGT',
- _hardClip('CAACGT', ((CHARD_CLIP, 3), (CMATCH, 3),)))
+ self.assertEqual(
+ ('CGT', '456', True),
+ _hardClip('CAACGT', '123456', ((CHARD_CLIP, 3), (CMATCH, 3),)))
def testClipRight(self):
"""
If hard clipping on the right is indicated, and has not been done,
the function must return the expected sequence.
"""
- self.assertEqual('CA',
- _hardClip('CAACGT', ((CMATCH, 2), (CHARD_CLIP, 4),)))
+ self.assertEqual(
+ ('CA', '12', True),
+ _hardClip('CAACGT', '123456', ((CMATCH, 2), (CHARD_CLIP, 4),)))
def testClipBoth(self):
"""
@@ -1024,8 +1087,8 @@ class TestHardClip(TestCase):
done, the function must return the expected sequence.
"""
self.assertEqual(
- 'AA',
- _hardClip('CAACGT',
+ ('AA', '23', True),
+ _hardClip('CAACGT', '123456',
((CHARD_CLIP, 1), (CMATCH, 2), (CHARD_CLIP, 3),)))
def testClipLeftAlreadyDone(self):
@@ -1033,16 +1096,18 @@ class TestHardClip(TestCase):
If hard clipping on the left is indicated, and has already been done,
the function must return the expected sequence.
"""
- self.assertEqual('CGT',
- _hardClip('CGT', ((CHARD_CLIP, 3), (CMATCH, 3),)))
+ self.assertEqual(
+ ('CGT', '123', False),
+ _hardClip('CGT', '123', ((CHARD_CLIP, 3), (CMATCH, 3),)))
def testClipRightAlreadyDone(self):
"""
If hard clipping on the right is indicated, and has already been done,
the function must return the expected sequence.
"""
- self.assertEqual('CA',
- _hardClip('CA', ((CMATCH, 2), (CHARD_CLIP, 4),)))
+ self.assertEqual(
+ ('CA', '12', False),
+ _hardClip('CA', '12', ((CMATCH, 2), (CHARD_CLIP, 4),)))
def testClipBothAlreadyDone(self):
"""
@@ -1050,6 +1115,6 @@ class TestHardClip(TestCase):
been done, the function must return the expected sequence.
"""
self.assertEqual(
- 'AA',
- _hardClip('AA',
+ ('AA', '12', False),
+ _hardClip('AA', '12',
((CHARD_CLIP, 1), (CMATCH, 2), (CHARD_CLIP, 3),)))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 3
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
backcall==0.2.0
biopython==1.79
bz2file==0.98
certifi==2021.5.30
cffi==1.15.1
charset-normalizer==2.0.12
cycler==0.11.0
-e git+https://github.com/acorg/dark-matter.git@71d1941049e153d14615cdd6e3d694ff6a546b98#egg=dark_matter
decorator==5.1.1
ete3==3.1.3
flake8==5.0.4
idna==3.10
importlib-metadata==4.2.0
iniconfig==1.1.1
ipython==7.16.3
ipython-genutils==0.2.0
jedi==0.17.2
kiwisolver==1.3.1
matplotlib==3.3.4
mccabe==0.7.0
mysql-connector-python==8.0.33
numpy==1.19.5
packaging==21.3
parso==0.7.1
pexpect==4.9.0
pickleshare==0.7.5
Pillow==8.4.0
pluggy==1.0.0
prompt-toolkit==3.0.36
protobuf==3.19.6
ptyprocess==0.7.0
py==1.11.0
pycodestyle==2.9.1
pycparser==2.21
pyfaidx==0.7.1
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pysam==0.23.0
pytest==7.0.1
python-dateutil==2.9.0.post0
pyzmq==25.1.2
requests==2.27.1
simplejson==3.20.1
six==1.17.0
tomli==1.2.3
traitlets==4.3.3
typing_extensions==4.1.1
urllib3==1.26.20
wcwidth==0.2.13
zipp==3.6.0
|
name: dark-matter
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- backcall==0.2.0
- biopython==1.79
- bz2file==0.98
- cffi==1.15.1
- charset-normalizer==2.0.12
- cycler==0.11.0
- decorator==5.1.1
- ete3==3.1.3
- flake8==5.0.4
- idna==3.10
- importlib-metadata==4.2.0
- iniconfig==1.1.1
- ipython==7.16.3
- ipython-genutils==0.2.0
- jedi==0.17.2
- kiwisolver==1.3.1
- matplotlib==3.3.4
- mccabe==0.7.0
- mysql-connector-python==8.0.33
- numpy==1.19.5
- packaging==21.3
- parso==0.7.1
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==8.4.0
- pluggy==1.0.0
- prompt-toolkit==3.0.36
- protobuf==3.19.6
- ptyprocess==0.7.0
- py==1.11.0
- pycodestyle==2.9.1
- pycparser==2.21
- pyfaidx==0.7.1
- pyflakes==2.5.0
- pygments==2.14.0
- pyparsing==3.1.4
- pysam==0.23.0
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pyzmq==25.1.2
- requests==2.27.1
- simplejson==3.20.1
- six==1.17.0
- tomli==1.2.3
- traitlets==4.3.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- wcwidth==0.2.13
- zipp==3.6.0
prefix: /opt/conda/envs/dark-matter
|
[
"test/test_sam.py::TestPaddedSAM::testAllMMatch",
"test/test_sam.py::TestPaddedSAM::testAllowDuplicateIds",
"test/test_sam.py::TestPaddedSAM::testAlsoYieldAlignments",
"test/test_sam.py::TestPaddedSAM::testDropDuplicates",
"test/test_sam.py::TestPaddedSAM::testDropSecondary",
"test/test_sam.py::TestPaddedSAM::testDropSupplementary",
"test/test_sam.py::TestPaddedSAM::testDuplicateIdDisambiguation",
"test/test_sam.py::TestPaddedSAM::testHardClipLeft",
"test/test_sam.py::TestPaddedSAM::testHardClipRight",
"test/test_sam.py::TestPaddedSAM::testHardClippingInCIGARButQueryNotHardClipped",
"test/test_sam.py::TestPaddedSAM::testKF414679SoftClipLeft",
"test/test_sam.py::TestPaddedSAM::testKeepQualityControlFailures",
"test/test_sam.py::TestPaddedSAM::testMinLength",
"test/test_sam.py::TestPaddedSAM::testMixedMatch",
"test/test_sam.py::TestPaddedSAM::testMixedMatchSpecificReference",
"test/test_sam.py::TestPaddedSAM::testNotSecondaryAndNotSupplementaryWithNoSequence",
"test/test_sam.py::TestPaddedSAM::testPrimaryAndSecondaryReferenceInsertion",
"test/test_sam.py::TestPaddedSAM::testQueryHardClipAndSoftClipProtrudesBothSides",
"test/test_sam.py::TestPaddedSAM::testQuerySoftClipLeft",
"test/test_sam.py::TestPaddedSAM::testQuerySoftClipProtrudesBothSides",
"test/test_sam.py::TestPaddedSAM::testQuerySoftClipProtrudesLeft",
"test/test_sam.py::TestPaddedSAM::testQuerySoftClipProtrudesRight",
"test/test_sam.py::TestPaddedSAM::testQuerySoftClipReachesLeftEdge",
"test/test_sam.py::TestPaddedSAM::testQuerySoftClipReachesRightEdge",
"test/test_sam.py::TestPaddedSAM::testQuerySoftClipRight",
"test/test_sam.py::TestPaddedSAM::testRcNeeded",
"test/test_sam.py::TestPaddedSAM::testRcSuffix",
"test/test_sam.py::TestPaddedSAM::testReferenceDeletion",
"test/test_sam.py::TestPaddedSAM::testReferenceDeletionAlternateChars",
"test/test_sam.py::TestPaddedSAM::testReferenceInsertion",
"test/test_sam.py::TestPaddedSAM::testReferenceSkip",
"test/test_sam.py::TestPaddedSAM::testReferenceSkipAlternateChars",
"test/test_sam.py::TestPaddedSAM::testSecondaryAlignmentHasQuery",
"test/test_sam.py::TestPaddedSAM::testSecondaryWithNoPreviousSequence",
"test/test_sam.py::TestPaddedSAM::testSecondaryWithNoSequence",
"test/test_sam.py::TestPaddedSAM::testSupplementaryAlignmentHasQuery",
"test/test_sam.py::TestPaddedSAM::testSupplementaryWithNoPreviousSequence",
"test/test_sam.py::TestPaddedSAM::testSupplementaryWithNoSequence",
"test/test_sam.py::TestHardClip::testClipBoth",
"test/test_sam.py::TestHardClip::testClipBothAlreadyDone",
"test/test_sam.py::TestHardClip::testClipLeft",
"test/test_sam.py::TestHardClip::testClipLeftAlreadyDone",
"test/test_sam.py::TestHardClip::testClipRight",
"test/test_sam.py::TestHardClip::testClipRightAlreadyDone",
"test/test_sam.py::TestHardClip::testHardClipInMiddle",
"test/test_sam.py::TestHardClip::testNoClip",
"test/test_sam.py::TestHardClip::testThreeHardClips"
] |
[] |
[
"test/test_sam.py::TestSAMFilter::testAlignmentCount",
"test/test_sam.py::TestSAMFilter::testDropDuplicates",
"test/test_sam.py::TestSAMFilter::testDropSecondary",
"test/test_sam.py::TestSAMFilter::testDropSupplementary",
"test/test_sam.py::TestSAMFilter::testKeepQualityControlFailures",
"test/test_sam.py::TestSAMFilter::testMaxScore",
"test/test_sam.py::TestSAMFilter::testMaxScoreNoScores",
"test/test_sam.py::TestSAMFilter::testMinAndMaxScore",
"test/test_sam.py::TestSAMFilter::testMinLength",
"test/test_sam.py::TestSAMFilter::testMinScore",
"test/test_sam.py::TestSAMFilter::testMinScoreNoScores",
"test/test_sam.py::TestSAMFilter::testStoreQueryIds",
"test/test_sam.py::TestSAMFilter::testUnknownReferences",
"test/test_sam.py::TestPaddedSAM::testMixedMatchSpecificReferenceButNoMatches",
"test/test_sam.py::TestPaddedSAM::testQueryTooLong",
"test/test_sam.py::TestPaddedSAM::testUnequalReferenceLengths",
"test/test_sam.py::TestSamReferencesToStr::testIndent",
"test/test_sam.py::TestSamReferencesToStr::testSimple"
] |
[] |
MIT License
| 3,212 |
[
"dark/__init__.py",
"dark/sam.py",
"CHANGELOG.md"
] |
[
"dark/__init__.py",
"dark/sam.py",
"CHANGELOG.md"
] |
|
google__mobly-530
|
e78255672c61f8f091e9eeb09f3b9f46481202d2
|
2018-10-11 02:22:37
|
95286a01a566e056d44acfa9577a45bc7f37f51d
|
diff --git a/mobly/utils.py b/mobly/utils.py
index a9f065c..bb2f316 100644
--- a/mobly/utils.py
+++ b/mobly/utils.py
@@ -283,7 +283,7 @@ def concurrent_exec(func, param_list):
return return_vals
-def start_standing_subprocess(cmd, shell=False):
+def start_standing_subprocess(cmd, shell=False, env=None):
"""Starts a long-running subprocess.
This is not a blocking call and the subprocess started by it should be
@@ -296,6 +296,9 @@ def start_standing_subprocess(cmd, shell=False):
cmd: string, the command to start the subprocess with.
shell: bool, True to run this command through the system shell,
False to invoke it directly. See subprocess.Proc() docs.
+ env: dict, a custom environment to run the standing subprocess. If not
+ specified, inherits the current environment. See subprocess.Popen()
+ docs.
Returns:
The subprocess that was started.
@@ -306,7 +309,8 @@ def start_standing_subprocess(cmd, shell=False):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- shell=shell)
+ shell=shell,
+ env=env)
# Leaving stdin open causes problems for input, e.g. breaking the
# code.inspect() shell (http://stackoverflow.com/a/25512460/1612937), so
# explicitly close it assuming it is not needed for standing subprocesses.
|
Add env argument to start_standing_subprocess
|
google/mobly
|
diff --git a/tests/mobly/utils_test.py b/tests/mobly/utils_test.py
index 605dc8c..b9b0c22 100755
--- a/tests/mobly/utils_test.py
+++ b/tests/mobly/utils_test.py
@@ -53,6 +53,31 @@ class UtilsTest(unittest.TestCase):
p.stderr.close()
p.wait()
+ @mock.patch('subprocess.Popen')
+ def test_start_standing_subproc_without_env(self, mock_Popen):
+ p = utils.start_standing_subprocess(self.sleep_cmd)
+ mock_Popen.assert_called_with(
+ self.sleep_cmd,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False,
+ env=None,
+ )
+
+ @mock.patch('subprocess.Popen')
+ def test_start_standing_subproc_with_custom_env(self, mock_Popen):
+ mock_env = mock.MagicMock(spec=dict)
+ p = utils.start_standing_subprocess(self.sleep_cmd, env=mock_env)
+ mock_Popen.assert_called_with(
+ self.sleep_cmd,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False,
+ env=mock_env,
+ )
+
def test_stop_standing_subproc(self):
p = utils.start_standing_subprocess([self.sleep_cmd, '4'])
p1 = psutil.Process(p.pid)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
1.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"mock",
"pytest",
"pytz"
],
"pre_install": [
"apt-get update",
"apt-get install -y adb"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
future==1.0.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/google/mobly.git@e78255672c61f8f091e9eeb09f3b9f46481202d2#egg=mobly
mock==5.2.0
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
portpicker==1.6.0
psutil==7.0.0
pyserial==3.5
pytest @ file:///croot/pytest_1738938843180/work
pytz==2025.2
PyYAML==6.0.2
timeout-decorator==0.5.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: mobly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- future==1.0.0
- mock==5.2.0
- portpicker==1.6.0
- psutil==7.0.0
- pyserial==3.5
- pytz==2025.2
- pyyaml==6.0.2
- timeout-decorator==0.5.0
prefix: /opt/conda/envs/mobly
|
[
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc_with_custom_env",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc_without_env"
] |
[] |
[
"tests/mobly/utils_test.py::UtilsTest::test_create_dir",
"tests/mobly/utils_test.py::UtilsTest::test_create_dir_already_exists",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_negative",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_positive",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_returns_free_port",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_bytes_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_text_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_unicode_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc",
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc",
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc_wihtout_pipe"
] |
[] |
Apache License 2.0
| 3,213 |
[
"mobly/utils.py"
] |
[
"mobly/utils.py"
] |
|
pre-commit__pre-commit-844
|
c0b1f2ff25b53efcfa03098f2b4cb90ded905063
|
2018-10-11 03:08:41
|
14df93ef3e212e24fc30a31038a68a3325bd36a3
|
diff --git a/pre_commit/resources/hook-tmpl b/pre_commit/resources/hook-tmpl
index cb25ec5..f455ca3 100755
--- a/pre_commit/resources/hook-tmpl
+++ b/pre_commit/resources/hook-tmpl
@@ -123,14 +123,15 @@ def _pre_push(stdin):
elif remote_sha != Z40 and _rev_exists(remote_sha):
opts = ('--origin', local_sha, '--source', remote_sha)
else:
- # First ancestor not found in remote
- first_ancestor = subprocess.check_output((
- 'git', 'rev-list', '--max-count=1', '--topo-order',
- '--reverse', local_sha, '--not', '--remotes={}'.format(remote),
+ # ancestors not found in remote
+ ancestors = subprocess.check_output((
+ 'git', 'rev-list', local_sha, '--topo-order', '--reverse',
+ '--not', '--remotes={}'.format(remote),
)).decode().strip()
- if not first_ancestor:
+ if not ancestors:
continue
else:
+ first_ancestor = ancestors.splitlines()[0]
cmd = ('git', 'rev-list', '--max-parents=0', local_sha)
roots = set(subprocess.check_output(cmd).decode().splitlines())
if first_ancestor in roots:
|
Pre-push not getting all relevant files
I seem to experiencing the case where the list of files passed to my hooks pre-push are only from the most recent commit.
|
pre-commit/pre-commit
|
diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py
index 40d9bee..76ab14f 100644
--- a/tests/commands/install_uninstall_test.py
+++ b/tests/commands/install_uninstall_test.py
@@ -527,11 +527,13 @@ def test_pre_push_integration_failing(tempdir_factory, store):
install(Runner(path, C.CONFIG_FILE), store, hook_type='pre-push')
# commit succeeds because pre-commit is only installed for pre-push
assert _get_commit_output(tempdir_factory)[0] == 0
+ assert _get_commit_output(tempdir_factory, touch_file='zzz')[0] == 0
retc, output = _get_push_output(tempdir_factory)
assert retc == 1
assert 'Failing hook' in output
assert 'Failed' in output
+ assert 'foo zzz' in output # both filenames should be printed
assert 'hookid: failing_hook' in output
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 1
}
|
1.11
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"cython",
"distro",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio",
"pytest-bdd",
"pytest-benchmark",
"pytest-randomly",
"responses",
"mock",
"hypothesis",
"freezegun",
"trustme",
"requests-mock",
"requests",
"tomlkit"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aspy.yaml==1.3.0
attrs==25.3.0
cached-property==2.0.1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
coverage==7.8.0
cryptography==44.0.2
Cython==3.0.12
distlib==0.3.9
distro==1.9.0
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
flake8==7.2.0
freezegun==1.5.1
gherkin-official==29.0.0
hypothesis==6.130.5
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
Mako==1.3.9
MarkupSafe==3.0.2
mccabe==0.7.0
mock==5.2.0
nodeenv==1.9.1
packaging==24.2
parse==1.20.2
parse_type==0.6.4
platformdirs==4.3.7
pluggy==1.5.0
-e git+https://github.com/pre-commit/pre-commit.git@c0b1f2ff25b53efcfa03098f2b4cb90ded905063#egg=pre_commit
py-cpuinfo==9.0.0
pycodestyle==2.13.0
pycparser==2.22
pyflakes==3.3.1
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-bdd==8.1.0
pytest-benchmark==5.1.0
pytest-cov==6.0.0
pytest-env==1.1.5
pytest-mock==3.14.0
pytest-randomly==3.16.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
requests-mock==1.12.1
responses==0.25.7
six==1.17.0
sortedcontainers==2.4.0
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
trustme==1.2.1
typing_extensions==4.13.0
urllib3==2.3.0
virtualenv==20.29.3
zipp==3.21.0
|
name: pre-commit
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aspy-yaml==1.3.0
- attrs==25.3.0
- cached-property==2.0.1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- coverage==7.8.0
- cryptography==44.0.2
- cython==3.0.12
- distlib==0.3.9
- distro==1.9.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- filelock==3.18.0
- flake8==7.2.0
- freezegun==1.5.1
- gherkin-official==29.0.0
- hypothesis==6.130.5
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- mako==1.3.9
- markupsafe==3.0.2
- mccabe==0.7.0
- mock==5.2.0
- nodeenv==1.9.1
- packaging==24.2
- parse==1.20.2
- parse-type==0.6.4
- platformdirs==4.3.7
- pluggy==1.5.0
- py-cpuinfo==9.0.0
- pycodestyle==2.13.0
- pycparser==2.22
- pyflakes==3.3.1
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-bdd==8.1.0
- pytest-benchmark==5.1.0
- pytest-cov==6.0.0
- pytest-env==1.1.5
- pytest-mock==3.14.0
- pytest-randomly==3.16.0
- pytest-xdist==3.6.1
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- requests-mock==1.12.1
- responses==0.25.7
- six==1.17.0
- sortedcontainers==2.4.0
- toml==0.10.2
- tomli==2.2.1
- tomlkit==0.13.2
- trustme==1.2.1
- typing-extensions==4.13.0
- urllib3==2.3.0
- virtualenv==20.29.3
- zipp==3.21.0
prefix: /opt/conda/envs/pre-commit
|
[
"tests/commands/install_uninstall_test.py::test_pre_push_integration_failing"
] |
[
"tests/commands/install_uninstall_test.py::test_environment_not_sourced",
"tests/commands/install_uninstall_test.py::test_install_in_submodule_and_run"
] |
[
"tests/commands/install_uninstall_test.py::test_uninstall_restores_legacy_hooks",
"tests/commands/install_uninstall_test.py::test_install_pre_commit_and_run_custom_path",
"tests/commands/install_uninstall_test.py::test_replace_old_commit_script",
"tests/commands/install_uninstall_test.py::test_install_disallow_mising_config",
"tests/commands/install_uninstall_test.py::test_pre_push_new_upstream",
"tests/commands/install_uninstall_test.py::test_commit_msg_legacy",
"tests/commands/install_uninstall_test.py::test_pre_push_integration_accepted",
"tests/commands/install_uninstall_test.py::test_install_overwrite_no_existing_hooks",
"tests/commands/install_uninstall_test.py::test_install_temporarily_allow_mising_config",
"tests/commands/install_uninstall_test.py::test_install_in_worktree_and_run",
"tests/commands/install_uninstall_test.py::test_is_script",
"tests/commands/install_uninstall_test.py::test_uninstall_doesnt_remove_not_our_hooks",
"tests/commands/install_uninstall_test.py::test_install_pre_commit",
"tests/commands/install_uninstall_test.py::test_install_refuses_core_hookspath",
"tests/commands/install_uninstall_test.py::test_failing_hooks_returns_nonzero",
"tests/commands/install_uninstall_test.py::test_install_hooks_directory_not_present",
"tests/commands/install_uninstall_test.py::test_pre_push_force_push_without_fetch",
"tests/commands/install_uninstall_test.py::test_install_hooks_command",
"tests/commands/install_uninstall_test.py::test_install_hooks_dead_symlink",
"tests/commands/install_uninstall_test.py::test_install_existing_hooks_no_overwrite",
"tests/commands/install_uninstall_test.py::test_commit_msg_integration_passing",
"tests/commands/install_uninstall_test.py::test_is_previous_pre_commit",
"tests/commands/install_uninstall_test.py::test_installed_from_venv",
"tests/commands/install_uninstall_test.py::test_install_pre_commit_and_run",
"tests/commands/install_uninstall_test.py::test_is_not_script",
"tests/commands/install_uninstall_test.py::test_pre_push_integration_empty_push",
"tests/commands/install_uninstall_test.py::test_installs_hooks_with_hooks_True",
"tests/commands/install_uninstall_test.py::test_install_existing_hook_no_overwrite_idempotent",
"tests/commands/install_uninstall_test.py::test_uninstall_does_not_blow_up_when_not_there",
"tests/commands/install_uninstall_test.py::test_install_allow_mising_config",
"tests/commands/install_uninstall_test.py::test_install_idempotent",
"tests/commands/install_uninstall_test.py::test_unicode_merge_commit_message",
"tests/commands/install_uninstall_test.py::test_pre_push_legacy",
"tests/commands/install_uninstall_test.py::test_uninstall",
"tests/commands/install_uninstall_test.py::test_install_overwrite",
"tests/commands/install_uninstall_test.py::test_commit_msg_integration_failing",
"tests/commands/install_uninstall_test.py::test_failing_existing_hook_returns_1",
"tests/commands/install_uninstall_test.py::test_commit_am"
] |
[] |
MIT License
| 3,214 |
[
"pre_commit/resources/hook-tmpl"
] |
[
"pre_commit/resources/hook-tmpl"
] |
|
EdinburghGenomics__EGCG-Core-88
|
f54591f5420dc4b4f8241e080e594a5fd6c5f87a
|
2018-10-11 09:01:18
|
ab4199beb3cfe1786d79743a4d5f3829fba5577b
|
diff --git a/egcg_core/clarity.py b/egcg_core/clarity.py
index 0068e9d..39d03f8 100644
--- a/egcg_core/clarity.py
+++ b/egcg_core/clarity.py
@@ -113,7 +113,7 @@ def get_genome_version(sample_id, species=None):
def sanitize_user_id(user_id):
if isinstance(user_id, str):
- return re.sub("[^\w_\-.]", "_", user_id)
+ return re.sub("[^\w]", "_", user_id)
substitutions = (
|
Replace (.) dots in user sample name with underscores
Change the sanitize_user_id function to remove dots
https://github.com/EdinburghGenomics/EGCG-Core/blob/f54591f5420dc4b4f8241e080e594a5fd6c5f87a/egcg_core/clarity.py#L114
|
EdinburghGenomics/EGCG-Core
|
diff --git a/tests/test_clarity.py b/tests/test_clarity.py
index c4446fb..271d1d2 100644
--- a/tests/test_clarity.py
+++ b/tests/test_clarity.py
@@ -117,6 +117,7 @@ class TestClarity(TestEGCG):
def test_sanitize_user_id(self):
assert clarity.sanitize_user_id('this?that$other another:more') == 'this_that_other_another_more'
+ assert clarity.sanitize_user_id('this.that$other another:more') == 'this_that_other_another_more'
def test_get_list_of_samples(self):
exp_lims_sample_ids = ['this', 'that:01', 'other _L:01']
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
asana==0.6.7
attrs==22.2.0
cached-property==1.5.2
certifi==2021.5.30
coverage==6.2
-e git+https://github.com/EdinburghGenomics/EGCG-Core.git@f54591f5420dc4b4f8241e080e594a5fd6c5f87a#egg=EGCG_Core
execnet==1.9.0
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==2.8
MarkupSafe==2.0.1
oauthlib==3.2.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyclarity-lims==0.4.8
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-xdist==3.0.2
PyYAML==6.0.1
requests==2.14.2
requests-oauthlib==0.8.0
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: EGCG-Core
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- asana==0.6.7
- attrs==22.2.0
- cached-property==1.5.2
- coverage==6.2
- execnet==1.9.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==2.8
- markupsafe==2.0.1
- oauthlib==3.2.2
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyclarity-lims==0.4.8
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-xdist==3.0.2
- pyyaml==6.0.1
- requests==2.14.2
- requests-oauthlib==0.8.0
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/EGCG-Core
|
[
"tests/test_clarity.py::TestClarity::test_sanitize_user_id"
] |
[] |
[
"tests/test_clarity.py::TestClarity::test_connection",
"tests/test_clarity.py::TestClarity::test_find_project_from_sample",
"tests/test_clarity.py::TestClarity::test_find_run_elements_from_sample",
"tests/test_clarity.py::TestClarity::test_get_genotype_information_from_lims",
"tests/test_clarity.py::TestClarity::test_get_list_of_samples",
"tests/test_clarity.py::TestClarity::test_get_list_of_samples_broken",
"tests/test_clarity.py::TestClarity::test_get_output_containers_from_sample_and_step_name",
"tests/test_clarity.py::TestClarity::test_get_plate_id_and_well_from_lims",
"tests/test_clarity.py::TestClarity::test_get_released_samples",
"tests/test_clarity.py::TestClarity::test_get_run",
"tests/test_clarity.py::TestClarity::test_get_sample",
"tests/test_clarity.py::TestClarity::test_get_sample_gender",
"tests/test_clarity.py::TestClarity::test_get_sample_names_from_plate_from_lims",
"tests/test_clarity.py::TestClarity::test_get_sample_names_from_project_from_lims",
"tests/test_clarity.py::TestClarity::test_get_sample_release_date",
"tests/test_clarity.py::TestClarity::test_get_samples",
"tests/test_clarity.py::TestClarity::test_get_samples_arrived_with",
"tests/test_clarity.py::TestClarity::test_get_samples_genotyped_with",
"tests/test_clarity.py::TestClarity::test_get_samples_sequenced_with",
"tests/test_clarity.py::TestClarity::test_get_species_from_sample",
"tests/test_clarity.py::TestClarity::test_get_user_sample_name",
"tests/test_clarity.py::TestClarity::test_get_valid_lanes",
"tests/test_clarity.py::TestClarity::test_route_samples_to_delivery_workflow_no_name",
"tests/test_clarity.py::TestClarity::test_route_samples_to_delivery_workflow_with_name"
] |
[] |
MIT License
| 3,215 |
[
"egcg_core/clarity.py"
] |
[
"egcg_core/clarity.py"
] |
|
conan-io__conan-3727
|
650688fb52ea32e97ac2cc6f67660fb9b50ac365
|
2018-10-11 09:19:02
|
2a9f3d734d7a4607d1db2ff8130425d3220e0e31
|
ArekPiekarz: What happens when we start the noninteractive terminal as root and run conan in a way that triggers installing system packages? Would it succeed without asking for the password? In that case, would `--askpass` unnecessarily block the execution until a password is provided? Or would it be successful anyway?
lasote: I think in that case "sudo" won't require a password so the `--askpass` argument won't have any effect, but please, @jgsogo can you try?
jgsogo: On docker ``lasote/conantests``, given
```python
from conans.client.tools.system_pm import SystemPackageTool
sp = SystemPackageTool()
```
Use cases:
1. No-root, tty:
```
>>> sp.install("boost-dev")
dpkg-query: no packages found matching boost-dev
Running: sudo apt-get update
[sudo] password for tom:
```
2. No-root, no-tty:
```
>>> sp._tool._sudo_str = "sudo --askpass "
>>> sp.install("boost-dev")
dpkg-query: no packages found matching boost-dev
Running: sudo --askpass apt-get install -y --no-install-recommends boost-dev
sudo: no askpass program specified, try setting SUDO_ASKPASS
Traceback (most recent call last):
```
3. No-root, no-tty, with SUDO_ASKPASS
With file ``pw.sh``:
```
#!/bin/bash
echo 'invalid-root-pass'
```
and running python with the env variable
```
$ SUDO_ASKPASS=/home/conan/conan/pw.sh python
```
```
>>> sp._tool._sudo_str = "sudo --askpass "
>>> sp.install("boost-dev")
dpkg-query: no packages found matching boost-dev
Running: sudo --askpass apt-get update
Sorry, try again.
Sorry, try again.
sudo: 3 incorrect password attempts
Traceback (most recent call last):
...
```
3. Root, tty
```
>>> sp.install("ssh")
dpkg-query: no packages found matching ssh
Running: sudo apt-get install -y --no-install-recommends ssh
Reading package lists... Done
...
```
4. Root, no-tty
```
>>> sp._tool._sudo_str = "sudo --askpass "
>>> sp.install("vlc")
dpkg-query: no packages found matching vlc
Running: sudo --askpass apt-get install -y --no-install-recommends vlc
Reading package lists... Done
Building dependency tree
```
I think all casuistry is covered. 👨🏫
|
diff --git a/conans/client/runner.py b/conans/client/runner.py
index 1ea09dbf3..af65c6d3f 100644
--- a/conans/client/runner.py
+++ b/conans/client/runner.py
@@ -56,7 +56,7 @@ class ConanRunner(object):
try:
# piping both stdout, stderr and then later only reading one will hang the process
- # if the other fills the pip. So piping stdout, and redirecting stderr to stdour,
+ # if the other fills the pip. So piping stdout, and redirecting stderr to stdout,
# so both are merged and use just a single get_stream_lines() call
proc = Popen(command, shell=True, stdout=PIPE, stderr=STDOUT, cwd=cwd)
except Exception as e:
diff --git a/conans/client/tools/system_pm.py b/conans/client/tools/system_pm.py
index 36cd56772..41984bdf4 100644
--- a/conans/client/tools/system_pm.py
+++ b/conans/client/tools/system_pm.py
@@ -1,5 +1,6 @@
import os
-from six import string_types
+import sys
+
from conans.client.runner import ConanRunner
from conans.client.tools.oss import OSInfo
from conans.errors import ConanException
@@ -14,10 +15,20 @@ class SystemPackageTool(object):
os_info = os_info or OSInfo()
self._is_up_to_date = False
self._tool = tool or self._create_tool(os_info)
- self._tool._sudo_str = "sudo " if self._is_sudo_enabled() else ""
+ self._tool._sudo_str = self._get_sudo_str()
self._tool._runner = runner or ConanRunner()
self._tool._recommends = recommends
+ @staticmethod
+ def _get_sudo_str():
+ if not SystemPackageTool._is_sudo_enabled():
+ return ""
+
+ if hasattr(sys.stdout, "isatty") and not sys.stdout.isatty():
+ return "sudo --askpass "
+ else:
+ return "sudo "
+
@staticmethod
def _is_sudo_enabled():
if "CONAN_SYSREQUIRES_SUDO" not in os.environ:
|
sudo in SystemPackageTool always fails when in non-interactive terminal
- [x] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [x] I've specified the Conan version, operating system version and any tool that can be relevant.
- [x] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
### Problem
Commands using `sudo` in SystemPackageTool always fail when used in non-interactive terminal.
This issue originated from https://github.com/bincrafters/community/issues/378.
Example: Loading a project using cmake-conan wrapper in Qt Creator, with not yet built Qt as Conan dependency.
### Proposal
This could be solved by detecting if we're in non-interactive terminal and telling `sudo` to get password from a specified `askpass` program. It could be controlled with an extension to a variable [CONAN_SYSREQUIRES_SUDO](https://docs.conan.io/en/latest/reference/env_vars.html#conan-sysrequires-sudo) or a new variable, like CONAN_SYSREQUIRES_SUDO_MODE.
Example: `sudo --askpass apt update` will try to use program from SUDO_ASKPASS, or sudo.conf, or fail. A popular application for that is `ssh-askpass`.
From sudo manual:
> -A, --askpass
> Normally, if sudo requires a password, it will read it from the user's terminal. If the -A (askpass) option is specified, a (possibly graphical) helper program is executed to read the
> user's password and output the password to the standard output. If the SUDO_ASKPASS environment variable is set, it specifies the path to the helper program. Otherwise, if sudo.conf(5)
> contains a line specifying the askpass program, that value will be used. For example:
>
> # Path to askpass helper program
> Path askpass /usr/X11R6/bin/ssh-askpass
>
> If no askpass program is available, sudo will exit with an error.
### Steps to reproduce
conanfile.txt
```
[requires]
Qt/5.11.1@bincrafters/stable
[options]
*:shared=True
[generators]
cmake
```
CMakeLists.txt
```
cmake_minimum_required(VERSION 3.10)
project(conan-qt-test LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.12/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(
CONANFILE conanfile.txt
BASIC_SETUP
BUILD missing)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
```
main.cpp
```
#include <QtCore/QDebug>
int main()
{
qDebug() << "hello\n";
return 0;
}
```
**Steps:**
* Open Qt Creator
* Click File -> Open file or project
* Find CMakeLists.txt and click Open
* Select your kit, click on details, uncheck Default, click Configure Project
**Expected result:**
CMake + Conan configuration should succeed.
**Actual result:**
CMake + Conan configuration fails with:
```
Running "/usr/local/bin/cmake -E server --pipe=/tmp/cmake-.BlsLST/socket --experimental" in /home/fazer/dev/project/test/build-conan-cmake-qtcreator-bug-Desktop-Debug.
Starting to parse CMake project, using: "-DCMAKE_BUILD_TYPE:STRING=Debug", "-DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++-8", "-DCMAKE_C_COMPILER:STRING=/usr/bin/gcc-8", "-DCMAKE_PREFIX_PATH:STRING=".
The CXX compiler identification is GNU 8.1.0
Check for working CXX compiler: /usr/bin/g++-8
Check for working CXX compiler: /usr/bin/g++-8 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Downloading conan.cmake from https://github.com/conan-io/cmake-conan
Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. Please check 'conan.cmake' and contribute
Conan executing: conan install /home/fazer/dev/project/test/conan-cmake-qtcreator-bug/conanfile.txt -g cmake -s build_type=Debug -s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 --build=missing
CMake Error at /home/fazer/dev/project/test/build-conan-cmake-qtcreator-bug-Desktop-Debug/conan.cmake:335 (message):
Conan install failed='1'
Call Stack (most recent call first):
/home/fazer/dev/project/test/build-conan-cmake-qtcreator-bug-Desktop-Debug/conan.cmake:413 (conan_cmake_install)
CMakeLists.txt:14 (conan_cmake_run)
Configuring incomplete, errors occurred!
See also "/home/fazer/dev/project/test/build-conan-cmake-qtcreator-bug-Desktop-Debug/CMakeFiles/CMakeOutput.log".
CMake Project parsing failed.
```
Note that due to a bug in CMake (https://gitlab.kitware.com/cmake/cmake/issues/17931), it doesn't pass the `conan install` command output to Qt Creator to its "General Messages" pane.
However, it is possible to see the output in "Compile Output" pane when you follow these steps:
* Comment Qt/5.11.1@bincrafters/stable in conanfile.txt
* In Qt Creator click Build -> Run CMake
The project will now be configured successfully.
* Uncomment Qt/5.11.1@bincrafters/stable in conanfile.txt
* Click Build -> Run (Ctrl+R)
Result:
```
13:20:15: Running steps for project conan-qt-test...
13:20:15: Starting: "/usr/local/bin/cmake" --build . --target all
[0/1 ?/sec] Re-running CMake...
-- Conan ** WARNING** : This detection of settings from cmake is experimental and incomplete. Please check 'conan.cmake' and contribute
-- Conan executing: conan install /home/fazer/dev/project/test/conan-cmake-qtcreator-bug/conanfile.txt -g cmake -s build_type=Debug -s os=Linux -s compiler=gcc -s compiler.version=8 -s compiler.libcxx=libstdc++11 --build=missing
Running: sudo apt-get update
sudo: no tty present and no askpass program specified
ERROR: Qt/5.11.1@bincrafters/stable: Error in requirements() method, line 111
installer.update() # Update the package database
ConanException: Command 'sudo apt-get update' failed
CMake Error at /home/fazer/dev/project/test/build-conan-cmake-qtcreator-bug-Desktop-Debug/conan.cmake:335 (message):
Conan install failed='1'
Call Stack (most recent call first):
/home/fazer/dev/project/test/build-conan-cmake-qtcreator-bug-Desktop-Debug/conan.cmake:413 (conan_cmake_install)
CMakeLists.txt:14 (conan_cmake_run)
-- Configuring incomplete, errors occurred!
See also "/home/fazer/dev/project/test/build-conan-cmake-qtcreator-bug-Desktop-Debug/CMakeFiles/CMakeOutput.log".
FAILED: build.ninja
/home/fazer/dev/app/cmake/bin/cmake -H/home/fazer/dev/project/test/conan-cmake-qtcreator-bug -B/home/fazer/dev/project/test/build-conan-cmake-qtcreator-bug-Desktop-Debug
ninja: error: rebuilding 'build.ninja': subcommand failed
13:20:15: The process "/usr/local/bin/cmake" exited with code 1.
Error while building/deploying project conan-qt-test (kit: Desktop)
When executing step "CMake Build"
13:20:15: Elapsed time: 00:00.
```
Also note that once the original problem is fixed, you will need to make two changes in CMakeLists.txt in order to compile the program (they weren't in the original version to stop unrelated errors):
* add this line:
`find_package(Qt5 5.11 COMPONENTS Core REQUIRED)`
* changing linking to
`target_link_libraries(${PROJECT_NAME} Qt5::Core)`
### Environment
Conan 1.6.1
Ubuntu 18.04 x64
|
conan-io/conan
|
diff --git a/conans/test/util/tools_test.py b/conans/test/util/tools_test.py
index ad7d4a637..74243c5c1 100644
--- a/conans/test/util/tools_test.py
+++ b/conans/test/util/tools_test.py
@@ -46,6 +46,18 @@ class SystemPackageToolTest(unittest.TestCase):
out = TestBufferConanOutput()
set_global_instances(out, requests)
+ def test_sudo_tty(self):
+ with tools.environment_append({"CONAN_SYSREQUIRES_SUDO": "False",}):
+ self.assertFalse(SystemPackageTool._is_sudo_enabled())
+ self.assertEqual(SystemPackageTool._get_sudo_str(), "")
+
+ with tools.environment_append({"CONAN_SYSREQUIRES_SUDO": "True"}):
+ self.assertTrue(SystemPackageTool._is_sudo_enabled())
+ self.assertEqual(SystemPackageTool._get_sudo_str(), "sudo --askpass ")
+
+ with mock.patch("sys.stdout.isatty", return_value=True):
+ self.assertEqual(SystemPackageTool._get_sudo_str(), "sudo ")
+
def verify_update_test(self):
# https://github.com/conan-io/conan/issues/3142
with tools.environment_append({"CONAN_SYSREQUIRES_SUDO": "False",
@@ -86,8 +98,11 @@ class SystemPackageToolTest(unittest.TestCase):
self.assertEqual(expected, command)
return ret
- def _run_add_repository_test(repository, gpg_key, sudo, update):
- sudo_cmd = "sudo " if sudo else ""
+ def _run_add_repository_test(repository, gpg_key, sudo, isatty, update):
+ sudo_cmd = ""
+ if sudo:
+ sudo_cmd = "sudo " if isatty else "sudo --askpass "
+
runner = RunnerOrderedMock()
runner.commands.append(("{}apt-add-repository {}".format(sudo_cmd, repository), 0))
if gpg_key:
@@ -110,12 +125,15 @@ class SystemPackageToolTest(unittest.TestCase):
# Run several test cases
repository = "deb http://repo/url/ saucy universe multiverse"
gpg_key = 'http://one/key.gpg'
- _run_add_repository_test(repository, gpg_key, sudo=True, update=True)
- _run_add_repository_test(repository, gpg_key, sudo=True, update=False)
- _run_add_repository_test(repository, gpg_key, sudo=False, update=True)
- _run_add_repository_test(repository, gpg_key, sudo=False, update=False)
- _run_add_repository_test(repository, gpg_key=None, sudo=True, update=True)
- _run_add_repository_test(repository, gpg_key=None, sudo=False, update=False)
+ _run_add_repository_test(repository, gpg_key, sudo=True, isatty=False, update=True)
+ _run_add_repository_test(repository, gpg_key, sudo=True, isatty=False, update=False)
+ _run_add_repository_test(repository, gpg_key, sudo=False, isatty=False, update=True)
+ _run_add_repository_test(repository, gpg_key, sudo=False, isatty=False, update=False)
+ _run_add_repository_test(repository, gpg_key=None, sudo=True, isatty=False, update=True)
+ _run_add_repository_test(repository, gpg_key=None, sudo=False, isatty=True, update=False)
+
+ with mock.patch("sys.stdout.isatty", return_value=True):
+ _run_add_repository_test(repository, gpg_key, sudo=True, isatty=True, update=True)
def system_package_tool_test(self):
@@ -129,41 +147,41 @@ class SystemPackageToolTest(unittest.TestCase):
os_info.linux_distro = "debian"
spt = SystemPackageTool(runner=runner, os_info=os_info)
spt.update()
- self.assertEquals(runner.command_called, "sudo apt-get update")
+ self.assertEquals(runner.command_called, "sudo --askpass apt-get update")
os_info.linux_distro = "ubuntu"
spt = SystemPackageTool(runner=runner, os_info=os_info)
spt.update()
- self.assertEquals(runner.command_called, "sudo apt-get update")
+ self.assertEquals(runner.command_called, "sudo --askpass apt-get update")
os_info.linux_distro = "knoppix"
spt = SystemPackageTool(runner=runner, os_info=os_info)
spt.update()
- self.assertEquals(runner.command_called, "sudo apt-get update")
+ self.assertEquals(runner.command_called, "sudo --askpass apt-get update")
os_info.linux_distro = "fedora"
spt = SystemPackageTool(runner=runner, os_info=os_info)
spt.update()
- self.assertEquals(runner.command_called, "sudo yum update -y")
+ self.assertEquals(runner.command_called, "sudo --askpass yum update -y")
os_info.linux_distro = "opensuse"
spt = SystemPackageTool(runner=runner, os_info=os_info)
spt.update()
- self.assertEquals(runner.command_called, "sudo zypper --non-interactive ref")
+ self.assertEquals(runner.command_called, "sudo --askpass zypper --non-interactive ref")
os_info.linux_distro = "redhat"
spt = SystemPackageTool(runner=runner, os_info=os_info)
spt.install("a_package", force=False)
self.assertEquals(runner.command_called, "rpm -q a_package")
spt.install("a_package", force=True)
- self.assertEquals(runner.command_called, "sudo yum install -y a_package")
+ self.assertEquals(runner.command_called, "sudo --askpass yum install -y a_package")
os_info.linux_distro = "debian"
spt = SystemPackageTool(runner=runner, os_info=os_info)
with self.assertRaises(ConanException):
runner.return_ok = False
spt.install("a_package")
- self.assertEquals(runner.command_called, "sudo apt-get install -y --no-install-recommends a_package")
+ self.assertEquals(runner.command_called, "sudo --askpass apt-get install -y --no-install-recommends a_package")
runner.return_ok = True
spt.install("a_package", force=False)
@@ -184,9 +202,9 @@ class SystemPackageToolTest(unittest.TestCase):
spt = SystemPackageTool(runner=runner, os_info=os_info)
spt.update()
- self.assertEquals(runner.command_called, "sudo pkg update")
+ self.assertEquals(runner.command_called, "sudo --askpass pkg update")
spt.install("a_package", force=True)
- self.assertEquals(runner.command_called, "sudo pkg install -y a_package")
+ self.assertEquals(runner.command_called, "sudo --askpass pkg install -y a_package")
spt.install("a_package", force=False)
self.assertEquals(runner.command_called, "pkg info a_package")
@@ -286,13 +304,13 @@ class SystemPackageToolTest(unittest.TestCase):
spt = SystemPackageTool(runner=runner, tool=AptTool())
spt.install(packages)
self.assertEquals(2, runner.calls)
- runner = RunnerMultipleMock(["sudo apt-get update",
- "sudo apt-get install -y --no-install-recommends yet_another_package"])
+ runner = RunnerMultipleMock(["sudo --askpass apt-get update",
+ "sudo --askpass apt-get install -y --no-install-recommends yet_another_package"])
spt = SystemPackageTool(runner=runner, tool=AptTool())
spt.install(packages)
self.assertEquals(7, runner.calls)
- runner = RunnerMultipleMock(["sudo apt-get update"])
+ runner = RunnerMultipleMock(["sudo --askpass apt-get update"])
spt = SystemPackageTool(runner=runner, tool=AptTool())
with self.assertRaises(ConanException):
spt.install(packages)
@@ -334,7 +352,7 @@ class SystemPackageToolTest(unittest.TestCase):
"CONAN_SYSREQUIRES_SUDO": "True"
}):
packages = ["verify_package", "verify_another_package", "verify_yet_another_package"]
- runner = RunnerMultipleMock(["sudo apt-get update"])
+ runner = RunnerMultipleMock(["sudo --askpass apt-get update"])
spt = SystemPackageTool(runner=runner, tool=AptTool())
with self.assertRaises(ConanException) as exc:
spt.install(packages)
@@ -349,7 +367,7 @@ class SystemPackageToolTest(unittest.TestCase):
"CONAN_SYSREQUIRES_SUDO": "True"
}):
packages = ["disabled_package", "disabled_another_package", "disabled_yet_another_package"]
- runner = RunnerMultipleMock(["sudo apt-get update"])
+ runner = RunnerMultipleMock(["sudo --askpass apt-get update"])
spt = SystemPackageTool(runner=runner, tool=AptTool())
spt.install(packages)
self.assertIn('\n'.join(packages), tools.system_pm._global_output)
@@ -360,7 +378,7 @@ class SystemPackageToolTest(unittest.TestCase):
"CONAN_SYSREQUIRES_MODE": "EnAbLeD",
"CONAN_SYSREQUIRES_SUDO": "True"
}):
- runner = RunnerMultipleMock(["sudo apt-get update"])
+ runner = RunnerMultipleMock(["sudo --askpass apt-get update"])
spt = SystemPackageTool(runner=runner, tool=AptTool())
with self.assertRaises(ConanException) as exc:
spt.install(packages)
@@ -391,13 +409,13 @@ class SystemPackageToolTest(unittest.TestCase):
os_info = OSInfo()
update_command = None
if os_info.with_apt:
- update_command = "sudo apt-get update"
+ update_command = "sudo --askpass apt-get update"
elif os_info.with_yum:
- update_command = "sudo yum update -y"
+ update_command = "sudo --askpass yum update -y"
elif os_info.with_zypper:
- update_command = "sudo zypper --non-interactive ref"
+ update_command = "sudo --askpass zypper --non-interactive ref"
elif os_info.with_pacman:
- update_command = "sudo pacman -Syyu --noconfirm"
+ update_command = "sudo --askpass pacman -Syyu --noconfirm"
return "Command '{0}' failed".format(update_command) if update_command is not None else None
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 1
},
"num_modified_files": 2
}
|
1.8
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"cmake",
"ninja",
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"conans/requirements.txt",
"conans/requirements_server.txt",
"conans/requirements_dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
astroid==2.11.7
attrs==22.2.0
beautifulsoup4==4.12.3
bottle==0.12.25
certifi==2021.5.30
charset-normalizer==2.0.12
cmake==3.28.4
codecov==2.1.13
colorama==0.3.9
-e git+https://github.com/conan-io/conan.git@650688fb52ea32e97ac2cc6f67660fb9b50ac365#egg=conan
coverage==4.2
deprecation==2.0.7
dill==0.3.4
distro==1.1.0
execnet==1.9.0
fasteners==0.19
future==0.16.0
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
isort==5.10.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
mock==1.3.0
ninja==1.11.1.1
node-semver==0.2.0
nose==1.3.7
packaging==21.3
parameterized==0.8.1
patch==1.16
pbr==6.1.1
platformdirs==2.4.0
pluggy==1.0.0
pluginbase==0.7
py==1.11.0
Pygments==2.14.0
PyJWT==1.7.1
pylint==2.13.9
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
PyYAML==3.13
requests==2.27.1
six==1.17.0
soupsieve==2.3.2.post1
tomli==1.2.3
tqdm==4.20.0
typed-ast==1.5.5
typing_extensions==4.1.1
urllib3==1.26.20
waitress==2.0.0
WebOb==1.8.9
WebTest==2.0.35
wrapt==1.16.0
zipp==3.6.0
|
name: conan
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- astroid==2.11.7
- attrs==22.2.0
- beautifulsoup4==4.12.3
- bottle==0.12.25
- charset-normalizer==2.0.12
- cmake==3.28.4
- codecov==2.1.13
- colorama==0.3.9
- coverage==4.2
- deprecation==2.0.7
- dill==0.3.4
- distro==1.1.0
- execnet==1.9.0
- fasteners==0.19
- future==0.16.0
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isort==5.10.1
- lazy-object-proxy==1.7.1
- mccabe==0.7.0
- mock==1.3.0
- ninja==1.11.1.1
- node-semver==0.2.0
- nose==1.3.7
- packaging==21.3
- parameterized==0.8.1
- patch==1.16
- pbr==6.1.1
- platformdirs==2.4.0
- pluggy==1.0.0
- pluginbase==0.7
- py==1.11.0
- pygments==2.14.0
- pyjwt==1.7.1
- pylint==2.13.9
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- pyyaml==3.13
- requests==2.27.1
- six==1.17.0
- soupsieve==2.3.2.post1
- tomli==1.2.3
- tqdm==4.20.0
- typed-ast==1.5.5
- typing-extensions==4.1.1
- urllib3==1.26.20
- waitress==2.0.0
- webob==1.8.9
- webtest==2.0.35
- wrapt==1.16.0
- zipp==3.6.0
prefix: /opt/conda/envs/conan
|
[
"conans/test/util/tools_test.py::SystemPackageToolTest::test_sudo_tty"
] |
[
"conans/test/util/tools_test.py::ToolsTest::test_get_env_in_conanfile",
"conans/test/util/tools_test.py::ToolsTest::test_global_tools_overrided",
"conans/test/util/tools_test.py::GitToolTest::test_clone_submodule_git",
"conans/test/util/tools_test.py::SVNToolsTestsRecipe::test_clone_root_folder",
"conans/test/util/tools_test.py::SVNToolsTestsRecipe::test_clone_subfolder"
] |
[
"conans/test/util/tools_test.py::ReplaceInFileTest::test_replace_in_file",
"conans/test/util/tools_test.py::ToolsTest::test_environment_nested",
"conans/test/util/tools_test.py::GitToolTest::test_clone_existing_folder_git",
"conans/test/util/tools_test.py::GitToolTest::test_clone_existing_folder_without_branch",
"conans/test/util/tools_test.py::GitToolTest::test_clone_git",
"conans/test/util/tools_test.py::GitToolTest::test_credentials",
"conans/test/util/tools_test.py::GitToolTest::test_is_local_repository",
"conans/test/util/tools_test.py::GitToolTest::test_is_pristine",
"conans/test/util/tools_test.py::GitToolTest::test_repo_root",
"conans/test/util/tools_test.py::GitToolTest::test_verify_ssl",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_branch",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_checkout",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_clone",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_clone_over_dirty_directory",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_credentials",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_excluded_files",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_is_local_repository",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_last_changed_revision",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_repo_project_url",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_repo_root",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_repo_url",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_revision_number",
"conans/test/util/tools_test.py::SVNToolTestsBasic::test_verify_ssl",
"conans/test/util/tools_test.py::SVNToolTestsPristine::test_checkout",
"conans/test/util/tools_test.py::SVNToolTestsPristine::test_checkout_project",
"conans/test/util/tools_test.py::SVNToolTestsPristine::test_conflicted_file",
"conans/test/util/tools_test.py::SVNToolTestsPristine::test_ignored_file",
"conans/test/util/tools_test.py::SVNToolTestsPristine::test_modified_file",
"conans/test/util/tools_test.py::SVNToolTestsPristine::test_untracked_file"
] |
[] |
MIT License
| 3,216 |
[
"conans/client/tools/system_pm.py",
"conans/client/runner.py"
] |
[
"conans/client/tools/system_pm.py",
"conans/client/runner.py"
] |
sarugaku__vistir-17
|
99262588e04434528f1c4bfa3b3c9e6bb7cabf0b
|
2018-10-11 09:58:47
|
aa20733dfe0f3a9f179510a5ead38758a85afb15
|
diff --git a/news/16.feature b/news/16.feature
new file mode 100644
index 0000000..56c5040
--- /dev/null
+++ b/news/16.feature
@@ -0,0 +1,1 @@
+Updated ``misc.run`` to accept new arguments for ``spinner``, ``combine_stderr``, and ``display_limit``.
diff --git a/src/vistir/misc.py b/src/vistir/misc.py
index 723bb11..44607a9 100644
--- a/src/vistir/misc.py
+++ b/src/vistir/misc.py
@@ -75,7 +75,7 @@ def dedup(iterable):
return iter(OrderedDict.fromkeys(iterable))
-def _spawn_subprocess(script, env={}, block=True, cwd=None):
+def _spawn_subprocess(script, env={}, block=True, cwd=None, combine_stderr=True):
from distutils.spawn import find_executable
command = find_executable(script.command)
@@ -83,7 +83,7 @@ def _spawn_subprocess(script, env={}, block=True, cwd=None):
"env": env,
"universal_newlines": True,
"stdout": subprocess.PIPE,
- "stderr": subprocess.PIPE if block else subprocess.STDOUT,
+ "stderr": subprocess.PIPE if not combine_stderr else subprocess.STDOUT,
"shell": False,
}
if not block:
@@ -117,58 +117,90 @@ def _create_subprocess(
cwd=os.curdir,
verbose=False,
spinner=None,
+ combine_stderr=False,
+ display_limit=200
):
try:
- c = _spawn_subprocess(cmd, env=env, block=block, cwd=cwd)
+ c = _spawn_subprocess(cmd, env=env, block=block, cwd=cwd,
+ combine_stderr=combine_stderr)
except Exception as exc:
print("Error %s while executing command %s", exc, " ".join(cmd._parts))
raise
if not block:
c.stdin.close()
output = []
+ err = []
spinner_orig_text = ""
if spinner:
spinner_orig_text = spinner.text
- if c.stdout is not None:
- while True:
- line = to_text(c.stdout.readline())
+ streams = {
+ "stdout": c.stdout,
+ "stderr": c.stderr
+ }
+ while True:
+ stdout_line = None
+ stderr_line = None
+ for outstream in streams.keys():
+ stream = streams[outstream]
+ if not stream:
+ continue
+ line = to_text(stream.readline())
if not line:
- break
+ continue
line = line.rstrip()
- output.append(line)
- display_line = line
- if len(line) > 200:
- display_line = "{0}...".format(line[:200])
+ if outstream == "stderr":
+ stderr_line = line
+ else:
+ stdout_line = line
+ if not (stdout_line or stderr_line):
+ break
+ if stderr_line:
+ err.append(line)
+ if stdout_line:
+ output.append(stdout_line)
+ display_line = stdout_line
+ if len(stdout_line) > display_limit:
+ display_line = "{0}...".format(stdout_line[:display_limit])
if verbose:
spinner.write(display_line)
- else:
- spinner.text = "{0} {1}".format(spinner_orig_text, display_line)
- continue
+ spinner.text = "{0} {1}".format(spinner_orig_text, display_line)
+ continue
try:
c.wait()
finally:
if c.stdout:
c.stdout.close()
+ if c.stderr:
+ c.stderr.close()
if spinner:
+ if c.returncode > 0:
+ spinner.fail("Failed...cleaning up...")
spinner.text = "Complete!"
spinner.ok("✔")
- c.out = "".join(output)
- c.err = ""
+ c.out = "\n".join(output)
+ c.err = "\n".join(err) if err else ""
else:
c.out, c.err = c.communicate()
if not return_object:
- return c.out.strip(), c.err.strip()
+ if not block:
+ c.wait()
+ out = c.out if c.out else ""
+ err = c.err if c.err else ""
+ return out.strip(), err.strip()
return c
def run(
cmd,
- env={},
+ env=None,
return_object=False,
block=True,
cwd=None,
verbose=False,
nospin=False,
+ spinner=None,
+ combine_stderr=True,
+ display_limit=200
):
"""Use `subprocess.Popen` to get the output of a command and decode it.
@@ -179,8 +211,18 @@ def run(
:param str cwd: Current working directory contect to use for spawning the subprocess.
:param bool verbose: Whether to print stdout in real time when non-blocking.
:param bool nospin: Whether to disable the cli spinner.
+ :param str spinner: The name of the spinner to use if enabled, defaults to bouncingBar
+ :param bool combine_stderr: Optionally merge stdout and stderr in the subprocess, false if nonblocking.
+ :param int dispay_limit: The max width of output lines to display when using a spinner.
:returns: A 2-tuple of (output, error) or a :class:`subprocess.Popen` object.
+
+ .. Warning:: Merging standard out and standarad error in a nonblocking subprocess
+ can cause errors in some cases and may not be ideal. Consider disabling
+ this functionality.
"""
+
+ if not env:
+ env = os.environ.copy()
if six.PY2:
fs_encode = partial(to_bytes, encoding=locale_encoding)
_env = {fs_encode(k): fs_encode(v) for k, v in os.environ.items()}
@@ -188,6 +230,8 @@ def run(
_env[fs_encode(key)] = fs_encode(val)
else:
_env = {k: fs_str(v) for k, v in os.environ.items()}
+ if not spinner:
+ spinner = "bouncingBar"
if six.PY2:
if isinstance(cmd, six.string_types):
cmd = cmd.encode("utf-8")
@@ -195,22 +239,35 @@ def run(
cmd = [c.encode("utf-8") for c in cmd]
if not isinstance(cmd, Script):
cmd = Script.parse(cmd)
+ if block or not return_object:
+ combine_stderr = False
+ sigmap = {}
if nospin is False:
try:
+ import signal
from yaspin import yaspin
from yaspin import spinners
+ from yaspin.signal_handlers import fancy_handler
except ImportError:
raise RuntimeError(
"Failed to import spinner! Reinstall vistir with command:"
" pip install --upgrade vistir[spinner]"
)
else:
- spinner = yaspin
- animation = spinners.Spinners.bouncingBar
+ animation = getattr(spinners.Spinners, spinner)
+ sigmap = {
+ signal.SIGINT: fancy_handler
+ }
+ if os.name == "nt":
+ sigmap.update({
+ signal.CTRL_C_EVENT: fancy_handler,
+ signal.CTRL_BREAK_EVENT: fancy_handler
+ })
+ spinner_func = yaspin
else:
@contextmanager
- def spinner(spin_type, text):
+ def spinner_func(spin_type, text, **kwargs):
class FakeClass(object):
def __init__(self, text=""):
self.text = text
@@ -225,7 +282,7 @@ def run(
yield myobj
animation = None
- with spinner(animation, text="Running...") as sp:
+ with spinner_func(animation, sigmap=sigmap, text="Running...") as sp:
return _create_subprocess(
cmd,
env=_env,
@@ -234,6 +291,7 @@ def run(
cwd=cwd,
verbose=verbose,
spinner=sp,
+ combine_stderr=combine_stderr
)
@@ -249,7 +307,8 @@ def load_path(python):
"""
python = Path(python).as_posix()
- out, err = run([python, "-c", "import json, sys; print(json.dumps(sys.path))"])
+ out, err = run([python, "-c", "import json, sys; print(json.dumps(sys.path))"],
+ nospin=True)
if out:
return json.loads(out)
else:
diff --git a/tox.ini b/tox.ini
index 99dcca3..68550f3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,7 +7,7 @@ passenv = CI GIT_SSL_CAINFO
setenv =
LC_ALL = en_US.UTF-8
deps =
- -e .[tests]
+ -e .[spinner,tests]
coverage
commands = coverage run --parallel -m pytest --timeout 300 []
install_command = python -m pip install {opts} {packages}
|
Allow specifying spinner name, line length, and whether to combine stdout and stderr in "run" params
|
sarugaku/vistir
|
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 110bf68..f05ae4d 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -57,24 +57,34 @@ def test_dedup():
def test_run():
- out, err = vistir.misc.run(["python", "-c", "print('hello')"])
+ out, err = vistir.misc.run(["python", "-c", "print('hello')"], nospin=True)
assert out == "hello"
- out, err = vistir.misc.run(["python", "-c", "import ajwfoiejaoiwj"])
- assert any(error_text in err for error_text in ["ImportError", "ModuleNotFoundError"])
+ out, err = vistir.misc.run(["python", "-c", "import ajwfoiejaoiwj"], nospin=True)
+ assert any(error_text in err for error_text in ["ImportError", "ModuleNotFoundError"]), "{0} => {1}".format(out, err)
def test_run_return_subprocess():
- c = vistir.misc.run(["python", "-c", "print('test')"], return_object=True)
+ c = vistir.misc.run(["python", "-c", "print('test')"], return_object=True, nospin=True)
assert c.returncode == 0
assert c.out.strip() == "test"
def test_nonblocking_run():
- c = vistir.misc.run(["python", "--help"], block=False, return_object=True)
+ c = vistir.misc.run(["python", "--help"], block=False, return_object=True, nospin=True)
assert c.returncode == 0
- assert "PYTHONHOME" in c.out
- out, err = vistir.misc.run(["python", "--help"], block=False)
- assert "PYTHONHOME" in out
+ c.wait()
+ assert "PYTHONDONTWRITEBYTECODE" in c.out, c.out
+ out, err = vistir.misc.run(["python", "--help"], block=False, nospin=True)
+ assert "PYTHONDONTWRITEBYTECODE" in out, out
+ # historical = []
+ # while out:
+ # pos = out.find("\n")
+ # if not pos:
+ # historical.append(out)
+ # line, _, out = out.partition("\n")
+ # if line not in historical:
+ # historical.append(line)
+ # assert any(["PYTHONHOME" in line for line in historical]), historical
def test_load_path():
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[tests]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
execnet==1.9.0
hypothesis==6.31.6
hypothesis-fspaths==0.1
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-timeout==2.1.0
pytest-xdist==3.0.2
requests==2.27.1
six==1.17.0
sortedcontainers==2.4.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
-e git+https://github.com/sarugaku/vistir.git@99262588e04434528f1c4bfa3b3c9e6bb7cabf0b#egg=vistir
zipp==3.6.0
|
name: vistir
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- coverage==6.2
- execnet==1.9.0
- hypothesis==6.31.6
- hypothesis-fspaths==0.1
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-timeout==2.1.0
- pytest-xdist==3.0.2
- requests==2.27.1
- six==1.17.0
- sortedcontainers==2.4.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/vistir
|
[
"tests/test_misc.py::test_load_path"
] |
[] |
[
"tests/test_misc.py::test_shell_escape",
"tests/test_misc.py::test_unnest",
"tests/test_misc.py::test_dedup",
"tests/test_misc.py::test_run",
"tests/test_misc.py::test_run_return_subprocess",
"tests/test_misc.py::test_nonblocking_run",
"tests/test_misc.py::test_partialclass"
] |
[] |
ISC License
| 3,217 |
[
"tox.ini",
"news/16.feature",
"src/vistir/misc.py"
] |
[
"tox.ini",
"news/16.feature",
"src/vistir/misc.py"
] |
|
globocom__m3u8-125
|
6a97b296fabfd32cd2731f4ec94cd014ee272d25
|
2018-10-11 15:03:10
|
5cbf61314f8cb1a2fcee860a49f770eca16b29f9
|
diff --git a/m3u8/parser.py b/m3u8/parser.py
index cc9a76a..9b2a44e 100644
--- a/m3u8/parser.py
+++ b/m3u8/parser.py
@@ -237,7 +237,7 @@ def _parse_attribute_list(prefix, line, atribute_parser):
def _parse_stream_inf(line, data, state):
data['is_variant'] = True
data['media_sequence'] = None
- atribute_parser = remove_quotes_parser('codecs', 'audio', 'video', 'subtitles')
+ atribute_parser = remove_quotes_parser('codecs', 'audio', 'video', 'subtitles', 'closed_captions')
atribute_parser["program_id"] = int
atribute_parser["bandwidth"] = lambda x: int(float(x))
atribute_parser["average_bandwidth"] = int
|
stream_info.closed_captions returns "cc" instead of cc
stream_info.closed_captions returns "cc" instead of cc without quotation marks
```
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=768647,CODECS="avc1.4d001f,mp4a.40.2",RESOLUTION=480x270,CLOSED-CAPTIONS="cc",SUBTITLES="sub",AUDIO="aud"
http://10.129.6.151:8080/dump/video_4/video_4.m3u8
```
|
globocom/m3u8
|
diff --git a/tests/playlists.py b/tests/playlists.py
index 9ca09f2..fbec958 100755
--- a/tests/playlists.py
+++ b/tests/playlists.py
@@ -88,6 +88,14 @@ http://example.com/hi.m3u8
http://example.com/audio-only.m3u8
'''
+VARIANT_PLAYLIST_WITH_CC_SUBS_AND_AUDIO = '''
+#EXTM3U
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=7680000,CLOSED-CAPTIONS="cc",SUBTITLES="sub",AUDIO="aud"
+http://example.com/with-cc-hi.m3u8
+#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=65000,CLOSED-CAPTIONS="cc",SUBTITLES="sub",AUDIO="aud"
+http://example.com/with-cc-low.m3u8
+'''
+
VARIANT_PLAYLIST_WITH_AVERAGE_BANDWIDTH = '''
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1280000,AVERAGE-BANDWIDTH=1252345
diff --git a/tests/test_parser.py b/tests/test_parser.py
index ff3d826..bd67a59 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -115,6 +115,28 @@ def test_should_parse_variant_playlist():
assert 65000 == playlists_list[-1]['stream_info']['bandwidth']
assert 'mp4a.40.5,avc1.42801e' == playlists_list[-1]['stream_info']['codecs']
+def test_should_parse_variant_playlist_with_cc_subtitles_and_audio():
+ data = m3u8.parse(playlists.VARIANT_PLAYLIST_WITH_CC_SUBS_AND_AUDIO)
+ playlists_list = list(data['playlists'])
+
+ assert True == data['is_variant']
+ assert None == data['media_sequence']
+ assert 2 == len(playlists_list)
+
+ assert 'http://example.com/with-cc-hi.m3u8' == playlists_list[0]['uri']
+ assert 1 == playlists_list[0]['stream_info']['program_id']
+ assert 7680000 == playlists_list[0]['stream_info']['bandwidth']
+ assert 'cc' == playlists_list[0]['stream_info']['closed_captions']
+ assert 'sub' == playlists_list[0]['stream_info']['subtitles']
+ assert 'aud' == playlists_list[0]['stream_info']['audio']
+
+ assert 'http://example.com/with-cc-low.m3u8' == playlists_list[-1]['uri']
+ assert 1 == playlists_list[-1]['stream_info']['program_id']
+ assert 65000 == playlists_list[-1]['stream_info']['bandwidth']
+ assert 'cc' == playlists_list[-1]['stream_info']['closed_captions']
+ assert 'sub' == playlists_list[-1]['stream_info']['subtitles']
+ assert 'aud' == playlists_list[-1]['stream_info']['audio']
+
def test_should_parse_variant_playlist_with_average_bandwidth():
data = m3u8.parse(playlists.VARIANT_PLAYLIST_WITH_AVERAGE_BANDWIDTH)
playlists_list = list(data['playlists'])
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
exceptiongroup==1.2.2
iniconfig==2.1.0
iso8601==2.1.0
-e git+https://github.com/globocom/m3u8.git@6a97b296fabfd32cd2731f4ec94cd014ee272d25#egg=m3u8
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
tomli==2.2.1
|
name: m3u8
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- iso8601==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cov==6.0.0
- tomli==2.2.1
prefix: /opt/conda/envs/m3u8
|
[
"tests/test_parser.py::test_should_parse_variant_playlist_with_cc_subtitles_and_audio"
] |
[] |
[
"tests/test_parser.py::test_should_parse_simple_playlist_from_string",
"tests/test_parser.py::test_should_parse_non_integer_duration_from_playlist_string",
"tests/test_parser.py::test_should_parse_comma_in_title",
"tests/test_parser.py::test_should_parse_simple_playlist_from_string_with_different_linebreaks",
"tests/test_parser.py::test_should_parse_sliding_window_playlist_from_string",
"tests/test_parser.py::test_should_parse_playlist_with_encripted_segments_from_string",
"tests/test_parser.py::test_should_load_playlist_with_iv_from_string",
"tests/test_parser.py::test_should_add_key_attribute_to_segment_from_playlist",
"tests/test_parser.py::test_should_add_non_key_for_multiple_keys_unencrypted_and_encrypted",
"tests/test_parser.py::test_should_handle_key_method_none_and_no_uri_attr",
"tests/test_parser.py::test_should_parse_title_from_playlist",
"tests/test_parser.py::test_should_parse_variant_playlist",
"tests/test_parser.py::test_should_parse_variant_playlist_with_average_bandwidth",
"tests/test_parser.py::test_should_parse_variant_playlist_with_bandwidth_as_float",
"tests/test_parser.py::test_should_parse_variant_playlist_with_iframe_playlists",
"tests/test_parser.py::test_should_parse_variant_playlist_with_alt_iframe_playlists_layout",
"tests/test_parser.py::test_should_parse_iframe_playlist",
"tests/test_parser.py::test_should_parse_playlist_using_byteranges",
"tests/test_parser.py::test_should_parse_endlist_playlist",
"tests/test_parser.py::test_should_parse_ALLOW_CACHE",
"tests/test_parser.py::test_should_parse_VERSION",
"tests/test_parser.py::test_should_parse_program_date_time_from_playlist",
"tests/test_parser.py::test_should_parse_scte35_from_playlist",
"tests/test_parser.py::test_should_parse_envivio_cue_playlist",
"tests/test_parser.py::test_parse_simple_playlist_messy",
"tests/test_parser.py::test_parse_simple_playlist_messy_strict",
"tests/test_parser.py::test_commaless_extinf",
"tests/test_parser.py::test_commaless_extinf_strict",
"tests/test_parser.py::test_should_parse_segment_map_uri",
"tests/test_parser.py::test_should_parse_segment_map_uri_with_byterange",
"tests/test_parser.py::test_should_parse_empty_uri_with_base_path",
"tests/test_parser.py::test_should_parse_start_with_negative_time_offset",
"tests/test_parser.py::test_should_parse_start_with_precise",
"tests/test_parser.py::test_simple_playlist_with_discontinuity_sequence"
] |
[] |
MIT License
| 3,218 |
[
"m3u8/parser.py"
] |
[
"m3u8/parser.py"
] |
|
pytorch__ignite-286
|
83fe17dd513a4f0ed7fe1cfea6ea00541557465b
|
2018-10-11 15:42:14
|
6b8b16bac961f3d3af60befaa28ddd2f192fef16
|
vfdev-5: @miguelvr can you also add a test for the argument ?
miguelvr: Sure thing
miguelvr: @vfdev-5 I'm trying to do something similar to what I've done with the other unit tests.
However, I'm getting weird behaviours.
The snippet for the code is like this:
```python
def test_pbar_no_metric_names(capsys):
n_epochs = 2
loader = [1, 2]
engine = Engine(update_fn)
pbar = ProgressBar()
pbar.attach(engine)
engine.run(loader, max_epochs=n_epochs)
captured = capsys.readouterr()
stderr = captured.err.split('\r')
err = list(map(lambda x: x.strip(), stderr))
err = list(filter(None, err))
actual = err[-1]
expected = u'Epoch 2: [1/2] 50%|█████ [00:00<00:00]'
assert actual == expected
```
The comparison with the stderr string is behaving in a weird way and I'm obtaining a bunch of hexadecimal characters. However, if I debug and do everything manually the assertion checks out...
miguelvr: LGTM!
|
diff --git a/ignite/contrib/handlers/tqdm_logger.py b/ignite/contrib/handlers/tqdm_logger.py
index 196f57f7..61a742ad 100644
--- a/ignite/contrib/handlers/tqdm_logger.py
+++ b/ignite/contrib/handlers/tqdm_logger.py
@@ -47,6 +47,7 @@ class ProgressBar:
if metric_names is not None:
if not all(metric in engine.state.metrics for metric in metric_names):
+ self._close(engine)
raise KeyError("metrics not found in engine.state.metrics")
metrics = {name: '{:.2e}'.format(engine.state.metrics[name]) for name in metric_names}
@@ -72,7 +73,7 @@ class ProgressBar:
engine (Engine): engine object
metric_names (list): (Optional) list of the metrics names to log as the bar progresses
"""
- if not isinstance(metric_names, list):
+ if metric_names is not None and not isinstance(metric_names, list):
raise TypeError("metric_names should be a list, got {} instead".format(type(metric_names)))
engine.add_event_handler(Events.EPOCH_COMPLETED, self._close)
|
tqm_logger: metric_names is currently not optional
Hi,
https://github.com/pytorch/ignite/blob/master/ignite/contrib/handlers/tqdm_logger.py#L75
This line should be modified to make `metric_names` optional. Here is a suggestion:
```
if metric_names is not None and not isinstance(metric_names, list):
raise TypeError("metric_names should be a list, got {} instead".format(type(metric_names)))
```
Thanks
|
pytorch/ignite
|
diff --git a/tests/ignite/contrib/handlers/test_pbar.py b/tests/ignite/contrib/handlers/test_pbar.py
index aeecbb51..1fd3a68b 100644
--- a/tests/ignite/contrib/handlers/test_pbar.py
+++ b/tests/ignite/contrib/handlers/test_pbar.py
@@ -66,3 +66,23 @@ def test_pbar_with_metric():
with pytest.raises(KeyError):
trainer.run(data=data, max_epochs=1)
+
+
+def test_pbar_no_metric_names(capsys):
+
+ n_epochs = 2
+ loader = [1, 2]
+ engine = Engine(update_fn)
+
+ pbar = ProgressBar()
+ pbar.attach(engine)
+
+ engine.run(loader, max_epochs=n_epochs)
+
+ captured = capsys.readouterr()
+ err = captured.err.split('\r')
+ err = list(map(lambda x: x.strip(), err))
+ err = list(filter(None, err))
+ actual = err[-1]
+ expected = u'Epoch 2: [1/2] 50%|█████ [00:00<00:00]'
+ assert actual == expected
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"numpy",
"mock",
"pytest",
"codecov",
"pytest-cov",
"tqdm",
"scikit-learn",
"visdom",
"torchvision",
"tensorboardX",
"gym"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
charset-normalizer==2.0.12
cloudpickle==2.2.1
codecov==2.1.13
coverage==6.2
dataclasses==0.8
decorator==4.4.2
gym==0.26.2
gym-notices==0.0.8
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
joblib==1.1.1
jsonpatch==1.32
jsonpointer==2.3
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
networkx==2.5.1
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
Pillow==8.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
protobuf==4.21.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-cov==4.0.0
-e git+https://github.com/pytorch/ignite.git@83fe17dd513a4f0ed7fe1cfea6ea00541557465b#egg=pytorch_ignite
requests==2.27.1
scikit-learn==0.24.2
scipy==1.5.4
six==1.17.0
tensorboardX==2.6.2.2
threadpoolctl==3.1.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
torch==1.10.1
torchvision==0.11.2
tornado==6.1
tqdm==4.64.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
visdom==0.2.4
websocket-client==1.3.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: ignite
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- charset-normalizer==2.0.12
- cloudpickle==2.2.1
- codecov==2.1.13
- coverage==6.2
- dataclasses==0.8
- decorator==4.4.2
- gym==0.26.2
- gym-notices==0.0.8
- idna==3.10
- importlib-resources==5.4.0
- joblib==1.1.1
- jsonpatch==1.32
- jsonpointer==2.3
- mock==5.2.0
- networkx==2.5.1
- numpy==1.19.5
- pillow==8.4.0
- protobuf==4.21.0
- pytest-cov==4.0.0
- requests==2.27.1
- scikit-learn==0.24.2
- scipy==1.5.4
- six==1.17.0
- tensorboardx==2.6.2.2
- threadpoolctl==3.1.0
- tomli==1.2.3
- torch==1.10.1
- torchvision==0.11.2
- tornado==6.1
- tqdm==4.64.1
- urllib3==1.26.20
- visdom==0.2.4
- websocket-client==1.3.1
prefix: /opt/conda/envs/ignite
|
[
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar_no_metric_names"
] |
[] |
[
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar",
"tests/ignite/contrib/handlers/test_pbar.py::test_attach_fail_with_string",
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar_with_metric"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,219 |
[
"ignite/contrib/handlers/tqdm_logger.py"
] |
[
"ignite/contrib/handlers/tqdm_logger.py"
] |
oduwsdl__MementoEmbed-137
|
124675643fd680804b50ab268ebcd60c958dc6a1
|
2018-10-11 19:37:39
|
124675643fd680804b50ab268ebcd60c958dc6a1
|
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 00e7098..230f9e2 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -26,7 +26,7 @@ author = 'Shawn M. Jones'
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
-release = '0.2018.10.11.153710'
+release = '0.2018.10.11.193540'
# -- General configuration ---------------------------------------------------
diff --git a/mementoembed/mementoresource.py b/mementoembed/mementoresource.py
index c444937..52f65c4 100644
--- a/mementoembed/mementoresource.py
+++ b/mementoembed/mementoresource.py
@@ -105,8 +105,9 @@ def get_timegate_from_response(response):
urig = None
try:
- urig = aiu.convert_LinkTimeMap_to_dict(
- response.headers['link'] )['timegate_uri']
+ # urig = aiu.convert_LinkTimeMap_to_dict(
+ # response.headers['link'] )['timegate_uri']
+ urig = response.links['timegate']['url']
except KeyError as e:
raise NotAMementoError(
"link header coult not be parsed for timegate URI",
@@ -119,8 +120,9 @@ def get_original_uri_from_response(response):
urir = None
try:
- urir = aiu.convert_LinkTimeMap_to_dict(
- response.headers['link'] )['original_uri']
+ # urir = aiu.convert_LinkTimeMap_to_dict(
+ # response.headers['link'] )['original_uri']
+ urir = response.links['original']['url']
except KeyError as e:
raise NotAMementoError(
"link header coult not be parsed for original URI",
diff --git a/mementoembed/version.py b/mementoembed/version.py
index fe6ad2b..74615bf 100644
--- a/mementoembed/version.py
+++ b/mementoembed/version.py
@@ -1,3 +1,3 @@
__appname__ = "MementoEmbed"
-__appversion__ = '0.2018.10.11.153710'
+__appversion__ = '0.2018.10.11.193540'
__useragent__ = "{}/{}".format(__appname__, __appversion__)
|
parsing multiple Link: response headers
Martin brought this to my attention. Here's a sample URL:
https://scholarlyorphans.org/memento/20181009212548/https://ianmilligan.ca/
and it returns two different Link headers:
$ curl -IL https://scholarlyorphans.org/memento/20181009212548/https://ianmilligan.ca/
HTTP/1.1 200 OK
Server: nginx/1.12.1
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Archive-Orig-Server: nginx
Date: Tue, 09 Oct 2018 21:25:48 GMT
X-Archive-Orig-Transfer-Encoding: chunked
X-Archive-Orig-Connection: keep-alive
X-Archive-Orig-Strict-Transport-Security: max-age=86400
X-Archive-Orig-Vary: Accept-Encoding
X-Archive-Orig-Vary: Cookie
X-hacker: If you're reading this, you should visit automattic.com/jobs and apply to join the fun, mention this header.
Link: <https://wp.me/4cEB>; rel=shortlink
X-Archive-Orig-Content-Encoding: gzip
X-ac: 3.sea _bur
Memento-Datetime: Tue, 09 Oct 2018 21:25:48 GMT
Link: <https://ianmilligan.ca/>; rel="original", <https://scholarlyorphans.org/memento/https://ianmilligan.ca/>; rel="timegate", <https://scholarlyorphans.org/memento/timemap/link/https://ianmilligan.ca/>; rel="timemap"; type="application/link-format", <https://scholarlyorphans.org/memento/20181009212548/https://ianmilligan.ca/>; rel="memento"; datetime="Tue, 09 Oct 2018 21:25:48 GMT"; collection="memento"
Content-Location: https://scholarlyorphans.org/memento/20181009212548/https://ianmilligan.ca/
Content-Security-Policy: default-src 'unsafe-eval' 'unsafe-inline' 'self' data: blob: mediastream: ws: wss: ; form-action 'self'
Now, the first header is in error (it should be in X-Archive-orig-Link), but multiple Link headers *are* allowed as per RFC 2616 (and 7230). Martin said MementoEmbed wasn't finding link rel="original", probably bc it occurs in the 2nd Link header and not the first.
|
oduwsdl/MementoEmbed
|
diff --git a/tests/test_mementoresource.py b/tests/test_mementoresource.py
index aaff116..e9a45e5 100644
--- a/tests/test_mementoresource.py
+++ b/tests/test_mementoresource.py
@@ -13,10 +13,11 @@ testdir = os.path.dirname(os.path.realpath(__file__))
class mock_response:
- def __init__(self, headers, text, status, url, content=None):
+ def __init__(self, headers, text, status, url, content=None, links={}):
self.headers = headers
self.text = text
self.url = url
+ self.links = links
if content is None:
@@ -82,7 +83,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_urig: # requests follows all redirects, so we present the result at the end of the chain
mock_response(
@@ -97,7 +106,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
)
}
@@ -160,7 +177,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
raw_urim:
mock_response(
@@ -232,7 +257,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
raw_urim:
mock_response(
@@ -314,7 +347,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
zipurim:
mock_response(
@@ -476,7 +517,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
"http://archive.is/20130508132946id_/http://flexispy.com/":
mock_response(
@@ -552,7 +601,15 @@ class TestMementoResource(unittest.TestCase):
text = metaredirecthtml,
content = metaredirecthtml,
status = 200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
redirurim:
mock_response(
@@ -568,7 +625,15 @@ class TestMementoResource(unittest.TestCase):
text = expected_content,
content = expected_content,
status = 200,
- url = redirurim
+ url = redirurim,
+ links = {
+ "original": {
+ "url": redir_expected_original_uri
+ },
+ "timegate": {
+ "url": redir_expected_urig
+ }
+ }
),
redirurim_raw:
mock_response(
@@ -624,7 +689,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_raw_uri:
mock_response(
@@ -639,7 +712,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_raw_content,
status = 200,
- url = expected_raw_uri
+ url = expected_raw_uri,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_urig: # requests follows all redirects, so we present the result at the end of the chain
mock_response(
@@ -654,7 +735,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status = 200, # after following redirects
- url = expected_urim
+ url = expected_urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_urim:
mock_response(
@@ -669,7 +758,15 @@ class TestMementoResource(unittest.TestCase):
},
text = expected_content,
status = 200, # after following redirects
- url = expected_urim
+ url = expected_urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
)
}
diff --git a/tests/test_originalresource.py b/tests/test_originalresource.py
index 6f2e84e..db1a790 100644
--- a/tests/test_originalresource.py
+++ b/tests/test_originalresource.py
@@ -5,7 +5,7 @@ from mementoembed.originalresource import OriginalResource
class mock_response:
- def __init__(self, headers, text, status, url, content=None):
+ def __init__(self, headers, text, status, url, content=None, links={}):
self.headers = headers
self.text = text
if content is None:
@@ -16,6 +16,8 @@ class mock_response:
self.status_code = status
self.url = url
+ self.links = links
+
class mock_httpcache:
"""
rather than hitting the actual HTTP cache,
@@ -64,7 +66,15 @@ class TestOriginalResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_urig:
mock_response(
@@ -79,7 +89,15 @@ class TestOriginalResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_original_uri:
mock_response(
@@ -130,7 +148,15 @@ class TestOriginalResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_urig:
mock_response(
@@ -145,7 +171,15 @@ class TestOriginalResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_original_uri:
mock_response(
@@ -202,7 +236,15 @@ class TestOriginalResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_urig:
mock_response(
@@ -217,7 +259,15 @@ class TestOriginalResource(unittest.TestCase):
},
text = expected_content,
status=200,
- url = urim
+ url = urim,
+ links = {
+ "original": {
+ "url": expected_original_uri
+ },
+ "timegate": {
+ "url": expected_urig
+ }
+ }
),
expected_original_uri:
mock_response(
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 3
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"numpy>=1.16.0",
"pandas>=1.0.0"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiu==0.2.4
async-timeout==5.0.1
beautifulsoup4==4.13.3
blinker==1.9.0
bs4==0.0.2
certifi==2025.1.31
chardet==5.2.0
charset-normalizer==3.4.1
click==8.1.8
cssselect==1.3.0
dicttoxml==1.7.16
exceptiongroup==1.2.2
filelock==3.18.0
Flask==3.1.0
html5lib==1.1
htmlmin==0.1.12
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
itsdangerous==2.2.0
Jinja2==3.1.6
jusText==3.0.2
lxml==5.3.1
lxml_html_clean==0.4.1
MarkupSafe==3.0.2
-e git+https://github.com/oduwsdl/MementoEmbed.git@124675643fd680804b50ab268ebcd60c958dc6a1#egg=mementoembed
numpy==2.0.2
packaging==24.2
pandas==2.2.3
pillow==11.1.0
pluggy==1.5.0
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
readability-lxml==0.8.1
redis==5.2.1
requests==2.32.3
requests-cache==0.5.2
requests-file==2.1.0
requests-futures==1.0.2
six==1.17.0
soupsieve==2.6
tldextract==5.1.3
tomli==2.2.1
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
warcio==1.7.5
webencodings==0.5.1
Werkzeug==3.1.3
zipp==3.21.0
|
name: MementoEmbed
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aiu==0.2.4
- async-timeout==5.0.1
- beautifulsoup4==4.13.3
- blinker==1.9.0
- bs4==0.0.2
- certifi==2025.1.31
- chardet==5.2.0
- charset-normalizer==3.4.1
- click==8.1.8
- cssselect==1.3.0
- dicttoxml==1.7.16
- exceptiongroup==1.2.2
- filelock==3.18.0
- flask==3.1.0
- html5lib==1.1
- htmlmin==0.1.12
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- itsdangerous==2.2.0
- jinja2==3.1.6
- justext==3.0.2
- lxml==5.3.1
- lxml-html-clean==0.4.1
- markupsafe==3.0.2
- numpy==2.0.2
- packaging==24.2
- pandas==2.2.3
- pillow==11.1.0
- pluggy==1.5.0
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pytz==2025.2
- readability-lxml==0.8.1
- redis==5.2.1
- requests==2.32.3
- requests-cache==0.5.2
- requests-file==2.1.0
- requests-futures==1.0.2
- six==1.17.0
- soupsieve==2.6
- tldextract==5.1.3
- tomli==2.2.1
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- warcio==1.7.5
- webencodings==0.5.1
- werkzeug==3.1.3
- zipp==3.21.0
prefix: /opt/conda/envs/MementoEmbed
|
[
"tests/test_mementoresource.py::TestMementoResource::test_archiveiscase",
"tests/test_mementoresource.py::TestMementoResource::test_archiveiscase_datetime_in_uri",
"tests/test_mementoresource.py::TestMementoResource::test_imfcase",
"tests/test_mementoresource.py::TestMementoResource::test_meta_redirect",
"tests/test_mementoresource.py::TestMementoResource::test_permacc_hashstyle_uris",
"tests/test_mementoresource.py::TestMementoResource::test_simplecase",
"tests/test_mementoresource.py::TestMementoResource::test_waybackcase",
"tests/test_originalresource.py::TestOriginalResource::test_favicon_from_html",
"tests/test_originalresource.py::TestOriginalResource::test_simplecase_live_resource",
"tests/test_originalresource.py::TestOriginalResource::test_simplecase_rotten_resource"
] |
[] |
[
"tests/test_mementoresource.py::TestMementoResource::test_bad_headers"
] |
[] |
MIT License
| 3,220 |
[
"mementoembed/mementoresource.py",
"mementoembed/version.py",
"docs/source/conf.py"
] |
[
"mementoembed/mementoresource.py",
"mementoembed/version.py",
"docs/source/conf.py"
] |
|
encode__starlette-105
|
cc09042c1ca5ccac78bf0ff689faa5dcd3e04f3a
|
2018-10-11 22:53:24
|
66cce0f1c309d1df872652cbb3d23eb543254cdc
|
tomchristie: Nice one!
|
diff --git a/starlette/middleware/cors.py b/starlette/middleware/cors.py
index 7345531..8bc3380 100644
--- a/starlette/middleware/cors.py
+++ b/starlette/middleware/cors.py
@@ -32,6 +32,8 @@ class CORSMiddleware:
simple_headers = {}
if "*" in allow_origins:
simple_headers["Access-Control-Allow-Origin"] = "*"
+ else:
+ simple_headers["Vary"] = "Origin"
if allow_credentials:
simple_headers["Access-Control-Allow-Credentials"] = "true"
if expose_headers:
@@ -74,7 +76,7 @@ class CORSMiddleware:
return self.preflight_response(request_headers=headers)
else:
return functools.partial(
- self.simple_response, scope=scope, origin=origin
+ self.simple_response, scope=scope, request_headers=headers
)
return self.app(scope)
@@ -130,22 +132,31 @@ class CORSMiddleware:
return PlainTextResponse("OK", status_code=200, headers=headers)
- async def simple_response(self, receive, send, scope=None, origin=None):
+ async def simple_response(self, receive, send, scope=None, request_headers=None):
inner = self.app(scope)
- send = functools.partial(self.send, send=send, origin=origin)
+ send = functools.partial(self.send, send=send, request_headers=request_headers)
await inner(receive, send)
- async def send(self, message, send=None, origin=None):
+ async def send(self, message, send=None, request_headers=None):
if message["type"] != "http.response.start":
await send(message)
return
message.setdefault("headers", [])
headers = MutableHeaders(message["headers"])
+ origin = request_headers["Origin"]
+ has_cookie = "cookie" in request_headers
+
+ # If request includes any cookie headers, then we must respond
+ # with the specific origin instead of '*'.
+ if self.allow_all_origins and has_cookie:
+ self.simple_headers["Access-Control-Allow-Origin"] = origin
# If we only allow specific origins, then we have to mirror back
# the Origin header in the response.
- if not self.allow_all_origins and self.is_allowed_origin(origin=origin):
+ elif not self.allow_all_origins and self.is_allowed_origin(origin=origin):
headers["Access-Control-Allow-Origin"] = origin
+ if "vary" in headers:
+ self.simple_headers["Vary"] = f"{headers.get('vary')}, Origin"
headers.update(self.simple_headers)
await send(message)
|
Credentialed CORS standard requests should not respond with wildcard origins
See https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Credentialed_requests_and_wildcards
If a standard request is made, that includes any cookie headers, then CORSMiddleware *ought* to strictly respond with the requested origin, rather than a wildcard.
This is actually potentially a bit fiddly since we maybe also need to make sure to *set or add* Vary: Origin in those cases, in order to ensure correct cacheability.
|
encode/starlette
|
diff --git a/tests/test_middleware.py b/tests/test_middleware.py
index 1b42a2f..ab3a077 100644
--- a/tests/test_middleware.py
+++ b/tests/test_middleware.py
@@ -206,3 +206,60 @@ def test_cors_allow_origin_regex():
assert response.status_code == 400
assert response.text == "Disallowed CORS origin"
assert "access-control-allow-origin" not in response.headers
+
+
+def test_cors_credentialed_requests_return_specific_origin():
+ app = Starlette()
+
+ app.add_middleware(CORSMiddleware, allow_origins=["*"])
+
+ @app.route("/")
+ def homepage(request):
+ return PlainTextResponse("Homepage", status_code=200)
+
+ client = TestClient(app)
+
+ # Test credentialed request
+ headers = {"Origin": "https://example.org", "Cookie": "star_cookie=sugar"}
+ response = client.get("/", headers=headers)
+ assert response.status_code == 200
+ assert response.text == "Homepage"
+ assert response.headers["access-control-allow-origin"] == "https://example.org"
+
+
+def test_cors_vary_header_defaults_to_origin():
+ app = Starlette()
+
+ app.add_middleware(CORSMiddleware, allow_origins=["https://example.org"])
+
+ headers = {"Origin": "https://example.org"}
+
+ @app.route("/")
+ def homepage(request):
+ return PlainTextResponse("Homepage", status_code=200)
+
+ client = TestClient(app)
+
+ response = client.get("/", headers=headers)
+ assert response.status_code == 200
+ assert response.headers["vary"] == "Origin"
+
+
+def test_cors_vary_header_is_properly_set():
+ app = Starlette()
+
+ app.add_middleware(CORSMiddleware, allow_origins=["https://example.org"])
+
+ headers = {"Origin": "https://example.org"}
+
+ @app.route("/")
+ def homepage(request):
+ return PlainTextResponse(
+ "Homepage", status_code=200, headers={"Vary": "Accept-Encoding"}
+ )
+
+ client = TestClient(app)
+
+ response = client.get("/", headers=headers)
+ assert response.status_code == 200
+ assert response.headers["vary"] == "Accept-Encoding, Origin"
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 1
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[full]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": null,
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiofiles==24.1.0
babel==2.17.0
backrefs==5.8
black==25.1.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
codecov==2.1.13
colorama==0.4.6
coverage==7.8.0
exceptiongroup==1.2.2
ghp-import==2.1.0
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
Markdown==3.7
MarkupSafe==3.0.2
mergedeep==1.3.4
mkdocs==1.6.1
mkdocs-get-deps==0.2.0
mkdocs-material==9.6.10
mkdocs-material-extensions==1.3.1
mypy==1.15.0
mypy-extensions==1.0.0
packaging==24.2
paginate==0.5.7
pathspec==0.12.1
platformdirs==4.3.7
pluggy==1.5.0
Pygments==2.19.1
pymdown-extensions==10.14.3
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
pyyaml_env_tag==0.1
requests==2.32.3
six==1.17.0
-e git+https://github.com/encode/starlette.git@cc09042c1ca5ccac78bf0ff689faa5dcd3e04f3a#egg=starlette
tomli==2.2.1
typing_extensions==4.13.0
ujson==5.10.0
urllib3==2.3.0
watchdog==6.0.0
zipp==3.21.0
|
name: starlette
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aiofiles==24.1.0
- babel==2.17.0
- backrefs==5.8
- black==25.1.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- click==8.1.8
- codecov==2.1.13
- colorama==0.4.6
- coverage==7.8.0
- exceptiongroup==1.2.2
- ghp-import==2.1.0
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markdown==3.7
- markupsafe==3.0.2
- mergedeep==1.3.4
- mkdocs==1.6.1
- mkdocs-get-deps==0.2.0
- mkdocs-material==9.6.10
- mkdocs-material-extensions==1.3.1
- mypy==1.15.0
- mypy-extensions==1.0.0
- packaging==24.2
- paginate==0.5.7
- pathspec==0.12.1
- platformdirs==4.3.7
- pluggy==1.5.0
- pygments==2.19.1
- pymdown-extensions==10.14.3
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- pyyaml-env-tag==0.1
- requests==2.32.3
- six==1.17.0
- tomli==2.2.1
- typing-extensions==4.13.0
- ujson==5.10.0
- urllib3==2.3.0
- watchdog==6.0.0
- zipp==3.21.0
prefix: /opt/conda/envs/starlette
|
[
"tests/test_middleware.py::test_cors_credentialed_requests_return_specific_origin",
"tests/test_middleware.py::test_cors_vary_header_defaults_to_origin",
"tests/test_middleware.py::test_cors_vary_header_is_properly_set"
] |
[] |
[
"tests/test_middleware.py::test_trusted_host_middleware",
"tests/test_middleware.py::test_https_redirect_middleware",
"tests/test_middleware.py::test_cors_allow_all",
"tests/test_middleware.py::test_cors_allow_specific_origin",
"tests/test_middleware.py::test_cors_disallowed_preflight",
"tests/test_middleware.py::test_cors_allow_origin_regex"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,221 |
[
"starlette/middleware/cors.py"
] |
[
"starlette/middleware/cors.py"
] |
google__mobly-531
|
e78255672c61f8f091e9eeb09f3b9f46481202d2
|
2018-10-11 23:26:51
|
95286a01a566e056d44acfa9577a45bc7f37f51d
|
diff --git a/mobly/controllers/android_device_lib/adb.py b/mobly/controllers/android_device_lib/adb.py
index 41af20c..15e2a5c 100644
--- a/mobly/controllers/android_device_lib/adb.py
+++ b/mobly/controllers/android_device_lib/adb.py
@@ -44,13 +44,17 @@ class AdbError(Error):
stdout: byte string, the raw stdout of the command.
stderr: byte string, the raw stderr of the command.
ret_code: int, the return code of the command.
+ serial: string, the serial of the device the command is executed on.
+ This is an empty string if the adb command is not specific to a
+ device.
"""
- def __init__(self, cmd, stdout, stderr, ret_code):
+ def __init__(self, cmd, stdout, stderr, ret_code, serial=''):
self.cmd = cmd
self.stdout = stdout
self.stderr = stderr
self.ret_code = ret_code
+ self.serial = serial
def __str__(self):
return ('Error executing adb cmd "%s". ret: %d, stdout: %s, stderr: %s'
@@ -64,11 +68,15 @@ class AdbTimeoutError(Error):
Args:
cmd: list of strings, the adb command that timed out
timeout: float, the number of seconds passed before timing out.
+ serial: string, the serial of the device the command is executed on.
+ This is an empty string if the adb command is not specific to a
+ device.
"""
- def __init__(self, cmd, timeout):
+ def __init__(self, cmd, timeout, serial=''):
self.cmd = cmd
self.timeout = timeout
+ self.serial = serial
def __str__(self):
return 'Timed out executing command "%s" after %ss.' % (
@@ -155,6 +163,7 @@ class AdbProxy(object):
The output of the adb command run if exit code is 0.
Raises:
+ ValueError: timeout value is invalid.
AdbError: The adb command exit code is not 0.
AdbTimeoutError: The adb command timed out.
"""
@@ -162,13 +171,14 @@ class AdbProxy(object):
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)
process = psutil.Process(proc.pid)
if timeout and timeout <= 0:
- raise Error('Timeout is not a positive value: %s' % timeout)
+ raise ValueError('Timeout is not a positive value: %s' % timeout)
if timeout and timeout > 0:
try:
process.wait(timeout=timeout)
except psutil.TimeoutExpired:
process.terminate()
- raise AdbTimeoutError(cmd=args, timeout=timeout)
+ raise AdbTimeoutError(
+ cmd=args, timeout=timeout, serial=self.serial)
(out, err) = proc.communicate()
if stderr:
@@ -179,7 +189,12 @@ class AdbProxy(object):
if ret == 0:
return out
else:
- raise AdbError(cmd=args, stdout=out, stderr=err, ret_code=ret)
+ raise AdbError(
+ cmd=args,
+ stdout=out,
+ stderr=err,
+ ret_code=ret,
+ serial=self.serial)
def _execute_and_process_stdout(self, args, shell, handler):
"""Executes adb commands and processes the stdout with a handler.
diff --git a/mobly/utils.py b/mobly/utils.py
index a9f065c..bb2f316 100644
--- a/mobly/utils.py
+++ b/mobly/utils.py
@@ -283,7 +283,7 @@ def concurrent_exec(func, param_list):
return return_vals
-def start_standing_subprocess(cmd, shell=False):
+def start_standing_subprocess(cmd, shell=False, env=None):
"""Starts a long-running subprocess.
This is not a blocking call and the subprocess started by it should be
@@ -296,6 +296,9 @@ def start_standing_subprocess(cmd, shell=False):
cmd: string, the command to start the subprocess with.
shell: bool, True to run this command through the system shell,
False to invoke it directly. See subprocess.Proc() docs.
+ env: dict, a custom environment to run the standing subprocess. If not
+ specified, inherits the current environment. See subprocess.Popen()
+ docs.
Returns:
The subprocess that was started.
@@ -306,7 +309,8 @@ def start_standing_subprocess(cmd, shell=False):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- shell=shell)
+ shell=shell,
+ env=env)
# Leaving stdin open causes problems for input, e.g. breaking the
# code.inspect() shell (http://stackoverflow.com/a/25512460/1612937), so
# explicitly close it assuming it is not needed for standing subprocesses.
|
`expects` APIs crash in execution stages before the test case
In `setup_class` and `setup_generated_tests`, calling `expects` APIs would cause crashes.
Also in `teardown_class`, `expects` APIs would probably attach errors to the wrong record.
|
google/mobly
|
diff --git a/mobly/base_test.py b/mobly/base_test.py
index 03db500..56d8d4e 100644
--- a/mobly/base_test.py
+++ b/mobly/base_test.py
@@ -292,9 +292,46 @@ class BaseTestClass(object):
def _setup_class(self):
"""Proxy function to guarantee the base implementation of setup_class
is called.
+
+ Returns:
+ If `self.results` is returned instead of None, this means something
+ has gone wrong, and the rest of the test class should not execute.
"""
- with self._log_test_stage(STAGE_NAME_SETUP_CLASS):
- self.setup_class()
+ # Setup for the class.
+ class_record = records.TestResultRecord(STAGE_NAME_SETUP_CLASS,
+ self.TAG)
+ class_record.test_begin()
+ self.current_test_info = runtime_test_info.RuntimeTestInfo(
+ STAGE_NAME_SETUP_CLASS, self.log_path, class_record)
+ expects.recorder.reset_internal_states(class_record)
+ try:
+ with self._log_test_stage(STAGE_NAME_SETUP_CLASS):
+ self.setup_class()
+ except signals.TestAbortSignal:
+ # Throw abort signals to outer try block for handling.
+ raise
+ except Exception as e:
+ # Setup class failed for unknown reasons.
+ # Fail the class and skip all tests.
+ logging.exception('Error in %s#setup_class.', self.TAG)
+ class_record.test_error(e)
+ self.results.add_class_error(class_record)
+ self._exec_procedure_func(self._on_fail, class_record)
+ class_record.update_record()
+ self.summary_writer.dump(class_record.to_dict(),
+ records.TestSummaryEntryType.RECORD)
+ self._skip_remaining_tests(e)
+ return self.results
+ if expects.recorder.has_error:
+ self._exec_procedure_func(self._on_fail, class_record)
+ class_record.test_error()
+ class_record.update_record()
+ self.summary_writer.dump(class_record.to_dict(),
+ records.TestSummaryEntryType.RECORD)
+ self.results.add_class_error(class_record)
+ self._skip_remaining_tests(
+ class_record.termination_signal.exception)
+ return self.results
def setup_class(self):
"""Setup function that will be called before executing any test in the
@@ -302,6 +339,8 @@ class BaseTestClass(object):
To signal setup failure, use asserts or raise your own exception.
+ Errors raised from `setup_class` will trigger `on_fail`.
+
Implementation is optional.
"""
@@ -314,6 +353,7 @@ class BaseTestClass(object):
record.test_begin()
self.current_test_info = runtime_test_info.RuntimeTestInfo(
stage_name, self.log_path, record)
+ expects.recorder.reset_internal_states(record)
try:
with self._log_test_stage(stage_name):
self.teardown_class()
@@ -327,6 +367,12 @@ class BaseTestClass(object):
self.results.add_class_error(record)
self.summary_writer.dump(record.to_dict(),
records.TestSummaryEntryType.RECORD)
+ else:
+ if expects.recorder.has_error:
+ record.update_record()
+ self.results.add_class_error(record)
+ self.summary_writer.dump(record.to_dict(),
+ records.TestSummaryEntryType.RECORD)
finally:
# Write controller info and summary to summary file.
self._record_controller_info()
@@ -336,6 +382,8 @@ class BaseTestClass(object):
"""Teardown function that will be called after all the selected tests in
the test class have been executed.
+ Errors raised from `teardown_class` do not trigger `on_fail`.
+
Implementation is optional.
"""
@@ -775,28 +823,9 @@ class BaseTestClass(object):
records.TestSummaryEntryType.TEST_NAME_LIST)
tests = self._get_test_methods(test_names)
try:
- # Setup for the class.
- class_record = records.TestResultRecord(STAGE_NAME_SETUP_CLASS,
- self.TAG)
- class_record.test_begin()
- self.current_test_info = runtime_test_info.RuntimeTestInfo(
- STAGE_NAME_SETUP_CLASS, self.log_path, class_record)
- try:
- self._setup_class()
- except signals.TestAbortSignal:
- # Throw abort signals to outer try block for handling.
- raise
- except Exception as e:
- # Setup class failed for unknown reasons.
- # Fail the class and skip all tests.
- logging.exception('Error in %s#setup_class.', self.TAG)
- class_record.test_error(e)
- self.results.add_class_error(class_record)
- self.summary_writer.dump(class_record.to_dict(),
- records.TestSummaryEntryType.RECORD)
- self._exec_procedure_func(self._on_fail, class_record)
- self._skip_remaining_tests(e)
- return self.results
+ setup_class_result = self._setup_class()
+ if setup_class_result:
+ return setup_class_result
# Run tests in order.
for test_name, test_method in tests:
self.exec_one_test(test_name, test_method)
diff --git a/tests/mobly/base_test_test.py b/tests/mobly/base_test_test.py
index 7fb2b1d..1183133 100755
--- a/tests/mobly/base_test_test.py
+++ b/tests/mobly/base_test_test.py
@@ -1485,6 +1485,122 @@ class BaseTestTest(unittest.TestCase):
must_call.assert_called_with('ha')
self.assertEqual(len(bt_cls.results.passed), 2)
+ @mock.patch('mobly.records.TestSummaryWriter.dump')
+ def test_expect_in_setup_class(self, mock_dump):
+ must_call = mock.Mock()
+ must_call2 = mock.Mock()
+
+ class MockBaseTest(base_test.BaseTestClass):
+ def setup_class(self):
+ expects.expect_true(
+ False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
+ must_call('ha')
+
+ def test_func(self):
+ pass
+
+ def on_fail(self, record):
+ must_call2('on_fail')
+
+ bt_cls = MockBaseTest(self.mock_test_cls_configs)
+ bt_cls.run()
+ must_call.assert_called_once_with('ha')
+ must_call2.assert_called_once_with('on_fail')
+ actual_record = bt_cls.results.error[0]
+ self.assertEqual(actual_record.test_name, 'setup_class')
+ self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
+ self.assertEqual(actual_record.extras, MOCK_EXTRA)
+ # Verify the class record is written out correctly.
+ setup_class_dict = mock_dump.call_args_list[1][0][0]
+ self.assertIsNotNone(setup_class_dict['Begin Time'])
+ self.assertIsNotNone(setup_class_dict['End Time'])
+ self.assertEqual(setup_class_dict['Test Name'], 'setup_class')
+
+ @mock.patch('mobly.records.TestSummaryWriter.dump')
+ def test_expect_in_setup_class_and_on_fail(self, mock_dump):
+ must_call = mock.Mock()
+ must_call2 = mock.Mock()
+
+ class MockBaseTest(base_test.BaseTestClass):
+ def setup_class(self):
+ expects.expect_true(
+ False, 'Failure in setup_class', extras=MOCK_EXTRA)
+ must_call('ha')
+
+ def test_func(self):
+ pass
+
+ def on_fail(self, record):
+ expects.expect_true(
+ False, 'Failure in on_fail', extras=MOCK_EXTRA)
+ must_call2('on_fail')
+
+ bt_cls = MockBaseTest(self.mock_test_cls_configs)
+ bt_cls.run()
+ must_call.assert_called_once_with('ha')
+ must_call2.assert_called_once_with('on_fail')
+ actual_record = bt_cls.results.error[0]
+ self.assertEqual(actual_record.test_name, 'setup_class')
+ self.assertEqual(actual_record.details, 'Failure in setup_class')
+ self.assertEqual(actual_record.extras, MOCK_EXTRA)
+ on_fail_error = next(iter(actual_record.extra_errors.values()))
+ self.assertEqual(on_fail_error.details, 'Failure in on_fail')
+ self.assertEqual(on_fail_error.extras, MOCK_EXTRA)
+ # Verify the class record is written out correctly.
+ setup_class_dict = mock_dump.call_args_list[1][0][0]
+ self.assertIsNotNone(setup_class_dict['Begin Time'])
+ self.assertIsNotNone(setup_class_dict['End Time'])
+ self.assertEqual(setup_class_dict['Test Name'], 'setup_class')
+ # Verify the on_fail error is recorded in summary result.
+ extra_error_dict = next(
+ iter(setup_class_dict['Extra Errors'].values()))
+ self.assertEqual(extra_error_dict['Details'], 'Failure in on_fail')
+
+ def test_expect_in_teardown_class(self):
+ must_call = mock.Mock()
+
+ class MockBaseTest(base_test.BaseTestClass):
+ def test_func(self):
+ pass
+
+ def teardown_class(self):
+ expects.expect_true(
+ False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
+ must_call('ha')
+
+ bt_cls = MockBaseTest(self.mock_test_cls_configs)
+ bt_cls.run()
+ must_call.assert_called_once_with('ha')
+ actual_record = bt_cls.results.error[0]
+ self.assertEqual(actual_record.test_name, 'teardown_class')
+ self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
+ self.assertEqual(actual_record.extras, MOCK_EXTRA)
+
+ def test_expect_in_setup_test(self):
+ must_call = mock.Mock()
+ must_call2 = mock.Mock()
+
+ class MockBaseTest(base_test.BaseTestClass):
+ def setup_test(self):
+ expects.expect_true(
+ False, MSG_EXPECTED_EXCEPTION, extras=MOCK_EXTRA)
+ must_call('ha')
+
+ def test_func(self):
+ pass
+
+ def on_fail(self, record):
+ must_call2('on_fail')
+
+ bt_cls = MockBaseTest(self.mock_test_cls_configs)
+ bt_cls.run()
+ must_call.assert_called_once_with('ha')
+ must_call2.assert_called_once_with('on_fail')
+ actual_record = bt_cls.results.failed[0]
+ self.assertEqual(actual_record.test_name, 'test_func')
+ self.assertEqual(actual_record.details, MSG_EXPECTED_EXCEPTION)
+ self.assertEqual(actual_record.extras, MOCK_EXTRA)
+
def test_expect_in_teardown_test(self):
must_call = mock.Mock()
must_call2 = mock.Mock()
diff --git a/tests/mobly/controllers/android_device_lib/adb_test.py b/tests/mobly/controllers/android_device_lib/adb_test.py
index 71fab9c..9430795 100755
--- a/tests/mobly/controllers/android_device_lib/adb_test.py
+++ b/tests/mobly/controllers/android_device_lib/adb_test.py
@@ -91,15 +91,29 @@ class AdbTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
- def test_exec_cmd_error_no_timeout(self, mock_psutil_process, mock_popen):
+ def test_exec_cmd_error_with_serial(self, mock_psutil_process, mock_popen):
self._mock_process(mock_psutil_process, mock_popen)
# update return code to indicate command execution error
mock_popen.return_value.returncode = 1
+ mock_serial = 'ABCD1234'
+ with self.assertRaisesRegex(adb.AdbError,
+ 'Error executing adb cmd .*') as context:
+ adb.AdbProxy(mock_serial).fake_cmd()
+ self.assertEqual(context.exception.serial, mock_serial)
+ self.assertIn(mock_serial, context.exception.cmd)
+ @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
+ @mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
+ def test_exec_cmd_error_without_serial(self, mock_psutil_process,
+ mock_popen):
+ self._mock_process(mock_psutil_process, mock_popen)
+ # update return code to indicate command execution error
+ mock_popen.return_value.returncode = 1
with self.assertRaisesRegex(adb.AdbError,
- 'Error executing adb cmd .*'):
+ 'Error executing adb cmd .*') as context:
adb.AdbProxy()._exec_cmd(
['fake_cmd'], shell=False, timeout=None, stderr=None)
+ self.assertFalse(context.exception.serial)
@mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
@@ -115,23 +129,34 @@ class AdbTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
def test_exec_cmd_timed_out(self, mock_psutil_process, mock_popen):
self._mock_process(mock_psutil_process, mock_popen)
- # mock process.wait(timeout=timeout) to
- # throw psutil.TimeoutExpired exception
mock_psutil_process.return_value.wait.side_effect = (
adb.psutil.TimeoutExpired('Timed out'))
+ mock_serial = '1234Abcd'
+ with self.assertRaisesRegex(
+ adb.AdbTimeoutError, 'Timed out executing command "adb -s '
+ '1234Abcd fake-cmd" after 0.01s.') as context:
+ adb.AdbProxy(mock_serial).fake_cmd(timeout=0.01)
+ self.assertEqual(context.exception.serial, mock_serial)
+ self.assertIn(mock_serial, context.exception.cmd)
+ @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
+ @mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
+ def test_exec_cmd_timed_out_without_serial(self, mock_psutil_process,
+ mock_popen):
+ self._mock_process(mock_psutil_process, mock_popen)
+ mock_psutil_process.return_value.wait.side_effect = (
+ adb.psutil.TimeoutExpired('Timed out'))
with self.assertRaisesRegex(adb.AdbTimeoutError,
- 'Timed out executing command "fake_cmd" '
- 'after 0.1s.'):
- adb.AdbProxy()._exec_cmd(
- ['fake_cmd'], shell=False, timeout=0.1, stderr=None)
+ 'Timed out executing command "adb '
+ 'fake-cmd" after 0.01s.') as context:
+ adb.AdbProxy().fake_cmd(timeout=0.01)
@mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
def test_exec_cmd_with_negative_timeout_value(self, mock_psutil_process,
mock_popen):
self._mock_process(mock_psutil_process, mock_popen)
- with self.assertRaisesRegex(adb.Error,
+ with self.assertRaisesRegex(ValueError,
'Timeout is not a positive value: -1'):
adb.AdbProxy()._exec_cmd(
['fake_cmd'], shell=False, timeout=-1, stderr=None)
@@ -156,8 +181,8 @@ class AdbTest(unittest.TestCase):
self._mock_execute_and_process_stdout_process(mock_popen)
mock_handler = mock.MagicMock()
mock_popen.return_value.communicate = mock.Mock(
- return_value=(unexpected_stdout, MOCK_DEFAULT_STDERR.encode(
- 'utf-8')))
+ return_value=(unexpected_stdout,
+ MOCK_DEFAULT_STDERR.encode('utf-8')))
err = adb.AdbProxy()._execute_and_process_stdout(
['fake_cmd'], shell=False, handler=mock_handler)
diff --git a/tests/mobly/utils_test.py b/tests/mobly/utils_test.py
index 605dc8c..b9b0c22 100755
--- a/tests/mobly/utils_test.py
+++ b/tests/mobly/utils_test.py
@@ -53,6 +53,31 @@ class UtilsTest(unittest.TestCase):
p.stderr.close()
p.wait()
+ @mock.patch('subprocess.Popen')
+ def test_start_standing_subproc_without_env(self, mock_Popen):
+ p = utils.start_standing_subprocess(self.sleep_cmd)
+ mock_Popen.assert_called_with(
+ self.sleep_cmd,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False,
+ env=None,
+ )
+
+ @mock.patch('subprocess.Popen')
+ def test_start_standing_subproc_with_custom_env(self, mock_Popen):
+ mock_env = mock.MagicMock(spec=dict)
+ p = utils.start_standing_subprocess(self.sleep_cmd, env=mock_env)
+ mock_Popen.assert_called_with(
+ self.sleep_cmd,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False,
+ env=mock_env,
+ )
+
def test_stop_standing_subproc(self):
p = utils.start_standing_subprocess([self.sleep_cmd, '4'])
p1 = psutil.Process(p.pid)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 2
}
|
1.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"mock",
"pytest",
"pytz"
],
"pre_install": [
"apt-get update",
"apt-get install -y adb python3-setuptools"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
future==1.0.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/google/mobly.git@e78255672c61f8f091e9eeb09f3b9f46481202d2#egg=mobly
mock==5.2.0
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
portpicker==1.6.0
psutil==7.0.0
pyserial==3.5
pytest @ file:///croot/pytest_1738938843180/work
pytz==2025.2
PyYAML==6.0.2
timeout-decorator==0.5.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: mobly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- future==1.0.0
- mock==5.2.0
- portpicker==1.6.0
- psutil==7.0.0
- pyserial==3.5
- pytz==2025.2
- pyyaml==6.0.2
- timeout-decorator==0.5.0
prefix: /opt/conda/envs/mobly
|
[
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_error_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_error_without_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_timed_out",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_with_negative_timeout_value",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc_with_custom_env",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc_without_env"
] |
[
"tests/mobly/base_test_test.py::BaseTestTest::test_write_user_data"
] |
[
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_on_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_on_fail_from_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_setup_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_teardown_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_class_in_on_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_class_in_setup_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_class_in_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_class_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_equal_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_equal_fail_with_msg",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_equal_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_fail_with_noop",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_fail_with_wrong_error",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_fail_with_wrong_regex",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_regex_fail_with_noop",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_regex_fail_with_wrong_error",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_regex_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_true",
"tests/mobly/base_test_test.py::BaseTestTest::test_both_teardown_and_test_body_raise_exceptions",
"tests/mobly/base_test_test.py::BaseTestTest::test_cli_test_selection_fail_by_convention",
"tests/mobly/base_test_test.py::BaseTestTest::test_cli_test_selection_override_self_tests_list",
"tests/mobly/base_test_test.py::BaseTestTest::test_current_test_info",
"tests/mobly/base_test_test.py::BaseTestTest::test_current_test_info_in_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_current_test_name",
"tests/mobly/base_test_test.py::BaseTestTest::test_default_execution_of_all_tests",
"tests/mobly/base_test_test.py::BaseTestTest::test_exception_objects_in_record",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_equal",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_false",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_setup_class_and_on_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_setup_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_teardown_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_teardown_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_multiple_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_no_op",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_no_raises_custom_msg",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_no_raises_default_msg",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_true",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_true_and_assert_true",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_two_tests",
"tests/mobly/base_test_test.py::BaseTestTest::test_explicit_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_explicit_pass_but_teardown_test_raises_an_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_failure_in_procedure_functions_is_recorded",
"tests/mobly/base_test_test.py::BaseTestTest::test_failure_to_call_procedure_function_is_recorded",
"tests/mobly/base_test_test.py::BaseTestTest::test_generate_tests_call_outside_of_setup_generated_tests",
"tests/mobly/base_test_test.py::BaseTestTest::test_generate_tests_dup_test_name",
"tests/mobly/base_test_test.py::BaseTestTest::test_generate_tests_run",
"tests/mobly/base_test_test.py::BaseTestTest::test_generate_tests_selected_run",
"tests/mobly/base_test_test.py::BaseTestTest::test_implicit_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_missing_requested_test_func",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_cannot_modify_original_record",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_both_test_and_teardown_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_setup_class_fails_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_setup_test_fails_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_teardown_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_raise_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_triggered_by_setup_class_failure_then_fail_too",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_pass_cannot_modify_original_record",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_pass_raise_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_procedure_function_gets_correct_record",
"tests/mobly/base_test_test.py::BaseTestTest::test_promote_extra_errors_to_termination_signal",
"tests/mobly/base_test_test.py::BaseTestTest::test_record_controller_info",
"tests/mobly/base_test_test.py::BaseTestTest::test_self_tests_list",
"tests/mobly/base_test_test.py::BaseTestTest::test_self_tests_list_fail_by_convention",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_and_teardown_execution_count",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_class_fail_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_generated_tests_failure",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_test_fail_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_test_fail_by_test_signal",
"tests/mobly/base_test_test.py::BaseTestTest::test_skip",
"tests/mobly/base_test_test.py::BaseTestTest::test_skip_if",
"tests/mobly/base_test_test.py::BaseTestTest::test_skip_in_setup_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_class_fail_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_class_raise_abort_all",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_assert_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_executed_if_setup_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_executed_if_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_executed_if_test_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_raise_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_uncaught_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_basic",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_default_None",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_default_overwrite",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_default_overwrite_by_optional_param_list",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_default_overwrite_by_required_param_list",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_optional",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_optional_missing",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_optional_with_default",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_required",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_required_missing",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_cli_cmd_to_string",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_arg_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_arg_command_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_serial_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_auto_quotes",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_arg_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_arg_command_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_serial_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_special_characters",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_formats_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_formats_command_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_with_stderr_pipe",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_no_timeout_success",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_timed_out_without_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_with_timeout_success",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_adb_and_process_stdout_formats_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_despite_cmd_exits",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_logs_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_logs_cmd_with_unexpected_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_raises_adb_error",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_reads_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_reads_unexpected_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_returns_stderr",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_when_cmd_eof",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_when_handler_crash",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_forward",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_called_correctly",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_existing_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_missing_command_on_newer_devices",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_missing_command_on_older_devices",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler_with_options",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler_with_runner",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_options",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_runner",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_without_parameters",
"tests/mobly/utils_test.py::UtilsTest::test_create_dir",
"tests/mobly/utils_test.py::UtilsTest::test_create_dir_already_exists",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_negative",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_positive",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_returns_free_port",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_bytes_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_text_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_unicode_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc",
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc",
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc_wihtout_pipe"
] |
[] |
Apache License 2.0
| 3,222 |
[
"mobly/utils.py",
"mobly/controllers/android_device_lib/adb.py"
] |
[
"mobly/utils.py",
"mobly/controllers/android_device_lib/adb.py"
] |
|
dask__dask-4086
|
d8d0fee917cc8bfcc83da08916023977821da0b0
|
2018-10-11 23:39:48
|
faab2a4f5b37972f412b1c209877f82a1fb828ab
|
mrocklin: Seems fine to me. I wonder if it would be easy to test this with a diagnostic, similar to what produced the image you made in the MRE.
|
diff --git a/dask/array/core.py b/dask/array/core.py
index 07aff0ac2..00d09a00c 100644
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -2387,6 +2387,8 @@ def from_delayed(value, shape, dtype, name=None):
name = name or 'from-value-' + tokenize(value, shape, dtype)
dsk = {(name,) + (0,) * len(shape): value.key}
chunks = tuple((d,) for d in shape)
+ # TODO: value._key may not be the name of the layer in value.dask
+ # This should be fixed after we build full expression graphs
return Array(sharedict.merge(value.dask, (name, dsk),
dependencies={name: {value._key}}),
name, chunks, dtype)
diff --git a/dask/array/linalg.py b/dask/array/linalg.py
index a12c06b89..cd9929b58 100644
--- a/dask/array/linalg.py
+++ b/dask/array/linalg.py
@@ -128,21 +128,23 @@ def tsqr(data, compute_svd=False, _max_vchunk_size=None):
name_qr_st1 = 'qr' + token
dsk_qr_st1 = top(_wrapped_qr, name_qr_st1, 'ij', data.name, 'ij',
numblocks={data.name: numblocks})
- dsk.update_with_key(dsk_qr_st1, key=name_qr_st1)
+ dsk.update_with_key(dsk_qr_st1, key=name_qr_st1,
+ dependencies={name_qr_st1, data.name})
# Block qr[0]
name_q_st1 = 'getitem' + token + '-q1'
dsk_q_st1 = dict(((name_q_st1, i, 0),
(operator.getitem, (name_qr_st1, i, 0), 0))
for i in range(numblocks[0]))
- dsk.update_with_key(dsk_q_st1, key=name_q_st1)
+ dsk.update_with_key(dsk_q_st1, key=name_q_st1,
+ dependencies={name_qr_st1})
# Block qr[1]
name_r_st1 = 'getitem' + token + '-r1'
dsk_r_st1 = dict(((name_r_st1, i, 0),
(operator.getitem, (name_qr_st1, i, 0), 1))
for i in range(numblocks[0]))
- dsk.update_with_key(dsk_r_st1, key=name_r_st1)
+ dsk.update_with_key(dsk_r_st1, key=name_r_st1, dependencies={name_qr_st1})
# Next step is to obtain a QR decomposition for the stacked R factors, so either:
# - gather R factors into a single core and do a QR decomposition
@@ -183,10 +185,12 @@ def tsqr(data, compute_svd=False, _max_vchunk_size=None):
[(name_r_st1, idx, 0)
for idx, _ in sub_block_info])))
for i, sub_block_info in enumerate(all_blocks))
- dsk.update_with_key(dsk_r_stacked, key=name_r_stacked)
+ dsk.update_with_key(dsk_r_stacked, key=name_r_stacked,
+ dependencies={name_r_st1})
# retrieve R_stacked for recursion with tsqr
vchunks_rstacked = tuple([sum(map(lambda x: x[1], sub_block_info)) for sub_block_info in all_blocks])
+ dsk.dependencies[name_r_stacked] = {data.name}
r_stacked = Array(dsk, name_r_stacked,
shape=(sum(vchunks_rstacked), n), chunks=(vchunks_rstacked, (n)), dtype=rr.dtype)
@@ -204,19 +208,22 @@ def tsqr(data, compute_svd=False, _max_vchunk_size=None):
for i, sub_block_info in enumerate(all_blocks)
for j, e in zip([x[0] for x in sub_block_info],
_cumsum_blocks([x[1] for x in sub_block_info])))
- dsk.update_with_key(dsk_q_st2, key=name_q_st2)
+ dsk.update_with_key(dsk_q_st2, key=name_q_st2,
+ dependencies={q_inner.name})
# R: R_inner
name_r_st2 = 'r-inner-' + token
dsk_r_st2 = {(name_r_st2, 0, 0): (r_inner.name, 0, 0)}
- dsk.update_with_key(dsk_r_st2, key=name_r_st2)
+ dsk.update_with_key(dsk_r_st2, key=name_r_st2,
+ dependencies={r_inner.name})
# Q: Block qr[0] (*) Q_inner
name_q_st3 = 'dot-' + token + '-q3'
dsk_q_st3 = top(np.dot, name_q_st3, 'ij', name_q_st1, 'ij',
name_q_st2, 'ij', numblocks={name_q_st1: numblocks,
name_q_st2: numblocks})
- dsk.update_with_key(dsk_q_st3, key=name_q_st3)
+ dsk.update_with_key(dsk_q_st3, key=name_q_st3,
+ dependencies={name_q_st1, name_q_st2, name_q_st3})
else:
# Do single core computation
@@ -225,19 +232,22 @@ def tsqr(data, compute_svd=False, _max_vchunk_size=None):
name_r_st1_stacked = 'stack' + token + '-r1'
dsk_r_st1_stacked = {(name_r_st1_stacked, 0, 0): (np.vstack,
(tuple, to_stack))}
- dsk.update_with_key(dsk_r_st1_stacked, key=name_r_st1_stacked)
+ dsk.update_with_key(dsk_r_st1_stacked, key=name_r_st1_stacked,
+ dependencies={name_r_st1})
# In-core QR computation
name_qr_st2 = 'qr' + token + '-qr2'
dsk_qr_st2 = top(np.linalg.qr, name_qr_st2, 'ij', name_r_st1_stacked, 'ij',
numblocks={name_r_st1_stacked: (1, 1)})
- dsk.update_with_key(dsk_qr_st2, key=name_qr_st2)
+ dsk.update_with_key(dsk_qr_st2, key=name_qr_st2,
+ dependencies={name_r_st1_stacked})
# In-core qr[0]
name_q_st2_aux = 'getitem' + token + '-q2-aux'
dsk_q_st2_aux = {(name_q_st2_aux, 0, 0): (operator.getitem,
(name_qr_st2, 0, 0), 0)}
- dsk.update_with_key(dsk_q_st2_aux, key=name_q_st2_aux)
+ dsk.update_with_key(dsk_q_st2_aux, key=name_q_st2_aux,
+ dependencies={name_qr_st2})
if not any(np.isnan(c) for cs in data.chunks for c in cs):
# when chunks are all known...
@@ -246,6 +256,7 @@ def tsqr(data, compute_svd=False, _max_vchunk_size=None):
block_slices = [(slice(e[0], e[1]), slice(0, n))
for e in _cumsum_blocks(q2_block_sizes)]
dsk_q_blockslices = {}
+ dependencies = set()
else:
# when chunks are not already known...
@@ -276,28 +287,33 @@ def tsqr(data, compute_svd=False, _max_vchunk_size=None):
dsk_q2_cumsum,
dsk_block_slices)
+ dependencies = {data.name, name_q2bs, name_q2cs}
block_slices = [(name_blockslice, i) for i in range(numblocks[0])]
- dsk.update_with_key(dsk_q_blockslices, key='q-blocksizes' + token)
+ dsk.update_with_key(dsk_q_blockslices, key='q-blocksizes' + token,
+ dependencies=dependencies)
# In-core qr[0] unstacking
name_q_st2 = 'getitem' + token + '-q2'
dsk_q_st2 = dict(((name_q_st2, i, 0),
(operator.getitem, (name_q_st2_aux, 0, 0), b))
for i, b in enumerate(block_slices))
- dsk.update_with_key(dsk_q_st2, key=name_q_st2)
+ dsk.update_with_key(dsk_q_st2, key=name_q_st2,
+ dependencies={name_q_st2_aux})
# Q: Block qr[0] (*) In-core qr[0]
name_q_st3 = 'dot' + token + '-q3'
dsk_q_st3 = top(np.dot, name_q_st3, 'ij', name_q_st1, 'ij',
name_q_st2, 'ij', numblocks={name_q_st1: numblocks,
name_q_st2: numblocks})
- dsk.update_with_key(dsk_q_st3, key=name_q_st3)
+ dsk.update_with_key(dsk_q_st3, key=name_q_st3,
+ dependencies={name_q_st1, name_q_st2})
# R: In-core qr[1]
name_r_st2 = 'getitem' + token + '-r2'
dsk_r_st2 = {(name_r_st2, 0, 0): (operator.getitem, (name_qr_st2, 0, 0), 1)}
- dsk.update_with_key(dsk_r_st2, key=name_r_st2)
+ dsk.update_with_key(dsk_r_st2, key=name_r_st2,
+ dependencies={name_qr_st2})
if not compute_svd:
is_unknown_m = np.isnan(data.shape[0]) or any(np.isnan(c) for c in data.chunks[0])
@@ -327,6 +343,8 @@ def tsqr(data, compute_svd=False, _max_vchunk_size=None):
r_shape = (n, n) if data.shape[0] >= data.shape[1] else data.shape
r_chunks = r_shape
+ dsk.dependencies[name_q_st3] = {data.name}
+ dsk.dependencies[name_r_st2] = {data.name}
q = Array(dsk, name_q_st3,
shape=q_shape, chunks=q_chunks, dtype=qq.dtype)
r = Array(dsk, name_r_st2,
@@ -355,11 +373,11 @@ def tsqr(data, compute_svd=False, _max_vchunk_size=None):
name_u_st2, 'kj', numblocks={name_q_st3: numblocks,
name_u_st2: (1, 1)})
- dsk.update_with_key(dsk_svd_st2, key=name_svd_st2)
- dsk.update_with_key(dsk_u_st2, key=name_u_st2)
- dsk.update_with_key(dsk_u_st4, key=name_u_st4)
- dsk.update_with_key(dsk_s_st2, key=name_s_st2)
- dsk.update_with_key(dsk_v_st2, key=name_v_st2)
+ dsk.update_with_key(dsk_svd_st2, key=name_svd_st2, dependencies={name_r_st2})
+ dsk.update_with_key(dsk_u_st2, key=name_u_st2, dependencies={name_svd_st2})
+ dsk.update_with_key(dsk_u_st4, key=name_u_st4, dependencies={name_q_st3, name_u_st2})
+ dsk.update_with_key(dsk_s_st2, key=name_s_st2, dependencies={name_svd_st2})
+ dsk.update_with_key(dsk_v_st2, key=name_v_st2, dependencies={name_svd_st2})
uu, ss, vvh = np.linalg.svd(np.ones(shape=(1, 1), dtype=data.dtype))
@@ -434,11 +452,11 @@ def sfqr(data, name=None):
name_A_rest = prefix + 'A_rest'
dsk.update_with_key({
(name_A_1, 0, 0): (data.name, 0, 0)
- }, key=name_A_1)
+ }, key=name_A_1, dependencies={data.name})
dsk.update_with_key({
(name_A_rest, 0, idx): (data.name, 0, 1 + idx)
for idx in range(nc - 1)
- }, key=name_A_rest)
+ }, key=name_A_rest, dependencies={data.name})
# Q R_1 = A_1
name_Q_R1 = prefix + 'Q_R_1'
@@ -446,13 +464,13 @@ def sfqr(data, name=None):
name_R_1 = prefix + 'R_1'
dsk.update_with_key({
(name_Q_R1, 0, 0): (np.linalg.qr, (name_A_1, 0, 0))
- }, key=name_Q_R1)
+ }, key=name_Q_R1, dependencies={name_A_1})
dsk.update_with_key({
(name_Q, 0, 0): (operator.getitem, (name_Q_R1, 0, 0), 0)
- }, key=name_Q)
+ }, key=name_Q, dependencies={name_Q_R1})
dsk.update_with_key({
(name_R_1, 0, 0): (operator.getitem, (name_Q_R1, 0, 0), 1),
- }, key=name_R_1)
+ }, key=name_R_1, dependencies={name_Q_R1})
Q = Array(dsk, name_Q,
shape=(m, min(m, n)), chunks=(m, min(m, n)), dtype=qq.dtype)
diff --git a/dask/array/top.py b/dask/array/top.py
index 7db97a7d2..266ba37bb 100644
--- a/dask/array/top.py
+++ b/dask/array/top.py
@@ -69,7 +69,7 @@ def _top(func, output, output_indices, *arrind_pairs, **kwargs):
for a in arrind_pairs[1::2]]
arrind_pairs[1::2] = [index_subs(a, sub)
for a in arrind_pairs[1::2]]
- new_axes = {index_subs(k, sub)[0]: v for k, v in new_axes.items()}
+ new_axes = {index_subs((k,), sub)[0]: v for k, v in new_axes.items()}
# Unpack dask values in non-array arguments
argpairs = list(toolz.partition(2, arrind_pairs))
@@ -572,7 +572,7 @@ def optimize_atop(full_graph, keys=()):
keep = {k[0] if type(k) is tuple else k for k in keys}
layers = full_graph.dicts
dependents = core.reverse_dict(full_graph.dependencies)
- roots = {k for k, v in full_graph.dicts.items()
+ roots = {k for k in full_graph.dicts
if not dependents.get(k)}
stack = list(roots)
@@ -582,7 +582,7 @@ def optimize_atop(full_graph, keys=()):
while stack:
layer = stack.pop()
- if layer in seen:
+ if layer in seen or layer not in layers:
continue
seen.add(layer)
@@ -695,11 +695,16 @@ def rewrite_atop(inputs):
# Bump new inputs up in list
sub = {}
for i, index in enumerate(new_indices):
- if index not in indices: # use old inputs if available
+ try:
+ contains = index in indices
+ except (ValueError, TypeError):
+ contains = False
+
+ if contains: # use old inputs if available
+ sub[atop_token(i)] = atop_token(indices.index(index))
+ else:
sub[atop_token(i)] = atop_token(len(indices))
indices.append(index)
- else:
- sub[atop_token(i)] = atop_token(indices.index(index))
new_dsk = subs(inputs[dep].dsk, sub)
# indices.extend(new_indices)
@@ -725,9 +730,10 @@ def rewrite_atop(inputs):
sub = {atop_token(k): atop_token(v) for k, v in sub.items()}
dsk = {k: subs(v, sub) for k, v in dsk.items()}
+ indices_check = {k for k, v in indices if v is not None}
numblocks = toolz.merge([inp.numblocks for inp in inputs.values()])
numblocks = {k: v for k, v in numblocks.items()
- if k in toolz.pluck(0, indices)}
+ if v is None or k in indices_check}
out = TOP(root, inputs[root].output_indices, dsk, new_indices,
numblocks=numblocks, new_axes=new_axes, concatenate=concatenate)
diff --git a/dask/delayed.py b/dask/delayed.py
index a072c8706..ff3cbe358 100644
--- a/dask/delayed.py
+++ b/dask/delayed.py
@@ -502,7 +502,8 @@ class DelayedLeaf(Delayed):
@property
def dask(self):
- return sharedict.ShareDict({self._key: {self._key: self._obj}}, {})
+ return sharedict.ShareDict({self._key: {self._key: self._obj}},
+ dependencies={self._key: set()})
def __call__(self, *args, **kwargs):
return call_function(self._obj, self._key, args, kwargs,
diff --git a/dask/multiprocessing.py b/dask/multiprocessing.py
index aa825da6b..3a377b54c 100644
--- a/dask/multiprocessing.py
+++ b/dask/multiprocessing.py
@@ -160,6 +160,7 @@ def get(dsk, keys, num_workers=None, func_loads=None, func_dumps=None,
If True [default], `fuse` is applied to the graph before computation.
"""
pool = config.get('pool', None)
+ num_workers = num_workers or config.get('num_workers', None)
if pool is None:
context = get_context()
pool = context.Pool(num_workers,
diff --git a/dask/sharedict.py b/dask/sharedict.py
index ce239e7bd..438d7ea44 100644
--- a/dask/sharedict.py
+++ b/dask/sharedict.py
@@ -53,7 +53,9 @@ class ShareDict(Mapping):
self.dicts = dicts or dict()
self.dependencies = dependencies or dict()
- def update_with_key(self, arg, key=None):
+ assert set(self.dependencies) == set(self.dicts)
+
+ def update_with_key(self, arg, key=None, dependencies=None):
if type(arg) is ShareDict:
assert key is None or key in arg.dicts
self.dicts.update(arg.dicts)
@@ -63,6 +65,10 @@ class ShareDict(Mapping):
if key is None:
key = id(arg)
+ if dependencies:
+ assert isinstance(dependencies, (tuple, list, set))
+ self.dependencies[key] = set(dependencies)
+
assert isinstance(arg, Mapping)
if arg:
self.dicts[key] = arg
diff --git a/dask/threaded.py b/dask/threaded.py
index fd336db63..84a382e9c 100644
--- a/dask/threaded.py
+++ b/dask/threaded.py
@@ -56,6 +56,7 @@ def get(dsk, result, cache=None, num_workers=None, **kwargs):
"""
global default_pool
pool = config.get('pool', None)
+ num_workers = num_workers or config.get('num_workers', None)
thread = current_thread()
with pools_lock:
|
`dask.config.set(num_workers=n)` context doesn't seem to work anymore
I don't know how to make a self contained example, but suffice to say that if I try something like
```python
with dask.config.set(num_workers=2):
# code the does something
```
All cores start firing, not just 2.
```
%watermark -v -m -p dask
CPython 3.6.6
IPython 7.0.1
dask 0.19.3
compiler : MSC v.1900 64 bit (AMD64)
system : Windows
release : 10
machine : AMD64
processor : Intel64 Family 6 Model 63 Stepping 2, GenuineIntel
CPU cores : 48
interpreter: 64bit
```
|
dask/dask
|
diff --git a/dask/array/tests/test_atop.py b/dask/array/tests/test_atop.py
index 6ae073d81..7d0541767 100644
--- a/dask/array/tests/test_atop.py
+++ b/dask/array/tests/test_atop.py
@@ -231,6 +231,18 @@ def test_atop_new_axes():
assert_eq(y, np.ones((4, 5)) * 6)
+def test_atop_new_axes_2():
+ x = da.ones((2, 2), chunks=(1, 1))
+
+ def func(x):
+ return np.stack([x, -x], axis=-1)
+
+ y = atop(func, ('x', 'y', 'sign'), x, ('x', 'y'), dtype=x.dtype,
+ concatenate=True, new_axes={'sign': 2})
+
+ assert_eq(y, y)
+
+
@pytest.mark.parametrize('concatenate', [True, False])
def test_atop_stacked_new_axes(concatenate):
def f(x):
@@ -319,3 +331,33 @@ def test_atop_raises_on_incorrect_indices():
assert 'ii' in str(info.value)
assert '1' in str(info.value)
+
+
+def test_atop_numpy_arg():
+ x = da.arange(10, chunks=(5,))
+ y = np.arange(1000)
+
+ x = x.map_blocks(lambda x, y: x, 1.0)
+ x = x.map_blocks(lambda x, y: x, 'abc')
+ x = x.map_blocks(lambda x, y: x, y)
+ x = x.map_blocks(lambda x, y: x, 'abc')
+ x = x.map_blocks(lambda x, y: x, 1.0)
+ x = x.map_blocks(lambda x, y, z: x, 'abc', np.array(['a', 'b'], dtype=object))
+ assert_eq(x, np.arange(10))
+
+
+def test_bag_array_conversion():
+ import dask.bag as db
+ b = db.range(10, npartitions=1)
+ x, = b.map_partitions(np.asarray).to_delayed()
+ x, = [da.from_delayed(a, shape=(10,), dtype=int) for a in [x]]
+ z = da.concatenate([x])
+ assert_eq(z, np.arange(10), check_graph=False)
+
+
+def test_svd():
+ x = da.ones((1, 1), chunks=(1, 1))
+ y = x * 2
+ u, s, v = da.linalg.svd(y)
+ z = y + u
+ assert_eq(z, z)
diff --git a/dask/dataframe/tests/test_rolling.py b/dask/dataframe/tests/test_rolling.py
index 04be39fa1..a37b2dbc7 100644
--- a/dask/dataframe/tests/test_rolling.py
+++ b/dask/dataframe/tests/test_rolling.py
@@ -100,8 +100,8 @@ rolling_method_args_check_less_precise = [
('median', (), False),
('min', (), False),
('max', (), False),
- ('std', (), False),
- ('var', (), False),
+ ('std', (), True),
+ ('var', (), True),
('skew', (), True), # here and elsewhere, results for kurt and skew are
('kurt', (), True), # checked with check_less_precise=True so that we are
# only looking at 3ish decimal places for the equality check
diff --git a/dask/tests/test_base.py b/dask/tests/test_base.py
index 6f1c0a01b..24cef408b 100644
--- a/dask/tests/test_base.py
+++ b/dask/tests/test_base.py
@@ -19,6 +19,7 @@ from dask.delayed import Delayed
from dask.utils import tmpdir, tmpfile, ignoring
from dask.utils_test import inc, dec
from dask.compatibility import long, unicode, PY2
+from dask.diagnostics import Profiler
def import_or_none(path):
@@ -868,3 +869,18 @@ def test_callable_scheduler():
assert delayed(lambda: 1)().compute(scheduler=get) == 1
assert called[0]
+
+
[email protected]('not da')
[email protected]('num_workers', range(1, 4))
[email protected]('scheduler', ['threads', 'processes'])
+def test_num_workers_config(num_workers, scheduler):
+ # Regression test for issue #4082
+ a = da.random.randint(0, 10, size=400, chunks=2)
+
+ with dask.config.set(num_workers=num_workers), Profiler() as prof:
+ a.compute(scheduler=scheduler)
+
+ workers = {i.worker_id for i in prof.results}
+
+ assert len(workers) == num_workers
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 7
}
|
0.19
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[complete]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
click==8.0.4
cloudpickle==2.2.1
-e git+https://github.com/dask/dask.git@d8d0fee917cc8bfcc83da08916023977821da0b0#egg=dask
distributed==1.28.1
HeapDict==1.0.1
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
locket==1.0.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
msgpack==1.0.5
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pandas==1.1.5
partd==1.2.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
psutil==7.0.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.1
six==1.17.0
sortedcontainers==2.4.0
tblib==1.7.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
toolz==0.12.0
tornado==6.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zict==2.1.0
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: dask
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- click==8.0.4
- cloudpickle==2.2.1
- distributed==1.28.1
- heapdict==1.0.1
- locket==1.0.0
- msgpack==1.0.5
- numpy==1.19.5
- pandas==1.1.5
- partd==1.2.0
- psutil==7.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.1
- six==1.17.0
- sortedcontainers==2.4.0
- tblib==1.7.0
- toolz==0.12.0
- tornado==6.1
- zict==2.1.0
prefix: /opt/conda/envs/dask
|
[
"dask/array/tests/test_atop.py::test_atop_new_axes_2",
"dask/array/tests/test_atop.py::test_atop_numpy_arg",
"dask/array/tests/test_atop.py::test_bag_array_conversion",
"dask/array/tests/test_atop.py::test_svd",
"dask/tests/test_base.py::test_num_workers_config[threads-1]",
"dask/tests/test_base.py::test_num_workers_config[threads-2]",
"dask/tests/test_base.py::test_num_workers_config[threads-3]",
"dask/tests/test_base.py::test_num_workers_config[processes-1]",
"dask/tests/test_base.py::test_num_workers_config[processes-2]",
"dask/tests/test_base.py::test_num_workers_config[processes-3]"
] |
[
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[1S-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[2S-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[3S-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_methods[window3-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling[6s-6s]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling[2s-2s]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling[6s-2s]",
"dask/dataframe/tests/test_rolling.py::test_rolling_agg_aggregate"
] |
[
"dask/array/tests/test_atop.py::test_rewrite[inputs0-expected0]",
"dask/array/tests/test_atop.py::test_rewrite[inputs1-expected1]",
"dask/array/tests/test_atop.py::test_rewrite[inputs2-expected2]",
"dask/array/tests/test_atop.py::test_rewrite[inputs3-expected3]",
"dask/array/tests/test_atop.py::test_rewrite[inputs4-expected4]",
"dask/array/tests/test_atop.py::test_rewrite[inputs5-expected5]",
"dask/array/tests/test_atop.py::test_rewrite[inputs6-expected6]",
"dask/array/tests/test_atop.py::test_rewrite[inputs7-expected7]",
"dask/array/tests/test_atop.py::test_rewrite[inputs8-expected8]",
"dask/array/tests/test_atop.py::test_rewrite[inputs9-expected9]",
"dask/array/tests/test_atop.py::test_rewrite[inputs10-expected10]",
"dask/array/tests/test_atop.py::test_rewrite[inputs11-expected11]",
"dask/array/tests/test_atop.py::test_rewrite[inputs12-expected12]",
"dask/array/tests/test_atop.py::test_rewrite[inputs13-expected13]",
"dask/array/tests/test_atop.py::test_index_subs",
"dask/array/tests/test_atop.py::test_optimize_atop",
"dask/array/tests/test_atop.py::test_atop_non_atop_output",
"dask/array/tests/test_atop.py::test_top_len",
"dask/array/tests/test_atop.py::test_inner_compute",
"dask/array/tests/test_atop.py::test_common_token_names_args[_]",
"dask/array/tests/test_atop.py::test_common_token_names_args[_0]",
"dask/array/tests/test_atop.py::test_common_token_names_args[_1]",
"dask/array/tests/test_atop.py::test_common_token_names_args[.]",
"dask/array/tests/test_atop.py::test_common_token_names_args[.0]",
"dask/array/tests/test_atop.py::test_common_token_names_kwargs[_0]",
"dask/array/tests/test_atop.py::test_common_token_names_kwargs[_1]",
"dask/array/tests/test_atop.py::test_common_token_names_kwargs[.]",
"dask/array/tests/test_atop.py::test_common_token_names_kwargs[.0]",
"dask/array/tests/test_atop.py::test_common_token_names_kwargs[_]",
"dask/array/tests/test_atop.py::test_atop_names",
"dask/array/tests/test_atop.py::test_atop_new_axes",
"dask/array/tests/test_atop.py::test_atop_stacked_new_axes[True]",
"dask/array/tests/test_atop.py::test_atop_stacked_new_axes[False]",
"dask/array/tests/test_atop.py::test_atop_stacked_new_axes_front[True]",
"dask/array/tests/test_atop.py::test_atop_stacked_new_axes_front[False]",
"dask/array/tests/test_atop.py::test_atop_stacked_new_axes_same_dim[True]",
"dask/array/tests/test_atop.py::test_atop_stacked_new_axes_same_dim[False]",
"dask/array/tests/test_atop.py::test_atop_kwargs",
"dask/array/tests/test_atop.py::test_atop_chunks",
"dask/array/tests/test_atop.py::test_atop_raises_on_incorrect_indices",
"dask/dataframe/tests/test_rolling.py::test_map_overlap[1]",
"dask/dataframe/tests/test_rolling.py::test_map_overlap[4]",
"dask/dataframe/tests/test_rolling.py::test_map_partitions_names",
"dask/dataframe/tests/test_rolling.py::test_map_partitions_errors",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-1-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-2-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-4-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[True-5-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-1-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-2-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-4-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-count-args0-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-sum-args1-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-mean-args2-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-median-args3-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-min-args4-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-max-args5-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-std-args6-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-var-args7-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-skew-args8-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-kurt-args9-True]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-quantile-args10-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_methods[False-5-apply-args11-False]",
"dask/dataframe/tests/test_rolling.py::test_rolling_raises",
"dask/dataframe/tests/test_rolling.py::test_rolling_names",
"dask/dataframe/tests/test_rolling.py::test_rolling_axis",
"dask/dataframe/tests/test_rolling.py::test_rolling_partition_size",
"dask/dataframe/tests/test_rolling.py::test_rolling_repr",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_repr",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_constructor",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_window_too_large[window0]",
"dask/dataframe/tests/test_rolling.py::test_time_rolling_window_too_large[window1]",
"dask/tests/test_base.py::test_normalize_function",
"dask/tests/test_base.py::test_tokenize",
"dask/tests/test_base.py::test_tokenize_numpy_array_consistent_on_values",
"dask/tests/test_base.py::test_tokenize_numpy_array_supports_uneven_sizes",
"dask/tests/test_base.py::test_tokenize_discontiguous_numpy_array",
"dask/tests/test_base.py::test_tokenize_numpy_datetime",
"dask/tests/test_base.py::test_tokenize_numpy_scalar",
"dask/tests/test_base.py::test_tokenize_numpy_array_on_object_dtype",
"dask/tests/test_base.py::test_tokenize_numpy_memmap",
"dask/tests/test_base.py::test_tokenize_numpy_memmap_no_filename",
"dask/tests/test_base.py::test_tokenize_numpy_ufunc_consistent",
"dask/tests/test_base.py::test_tokenize_partial_func_args_kwargs_consistent",
"dask/tests/test_base.py::test_normalize_base",
"dask/tests/test_base.py::test_tokenize_pandas",
"dask/tests/test_base.py::test_tokenize_kwargs",
"dask/tests/test_base.py::test_tokenize_same_repr",
"dask/tests/test_base.py::test_tokenize_method",
"dask/tests/test_base.py::test_tokenize_sequences",
"dask/tests/test_base.py::test_tokenize_dict",
"dask/tests/test_base.py::test_tokenize_set",
"dask/tests/test_base.py::test_tokenize_ordered_dict",
"dask/tests/test_base.py::test_tokenize_object_array_with_nans",
"dask/tests/test_base.py::test_tokenize_base_types[1]",
"dask/tests/test_base.py::test_tokenize_base_types[True]",
"dask/tests/test_base.py::test_tokenize_base_types[a0]",
"dask/tests/test_base.py::test_tokenize_base_types[a1]",
"dask/tests/test_base.py::test_tokenize_base_types[1.0]",
"dask/tests/test_base.py::test_tokenize_base_types[x5]",
"dask/tests/test_base.py::test_tokenize_base_types[x6]",
"dask/tests/test_base.py::test_tokenize_base_types[x7]",
"dask/tests/test_base.py::test_tokenize_base_types[x8]",
"dask/tests/test_base.py::test_tokenize_base_types[x9]",
"dask/tests/test_base.py::test_tokenize_base_types[None]",
"dask/tests/test_base.py::test_tokenize_base_types[str]",
"dask/tests/test_base.py::test_tokenize_base_types[int]",
"dask/tests/test_base.py::test_tokenize_numpy_matrix",
"dask/tests/test_base.py::test_is_dask_collection",
"dask/tests/test_base.py::test_unpack_collections",
"dask/tests/test_base.py::test_custom_collection",
"dask/tests/test_base.py::test_compute_no_opt",
"dask/tests/test_base.py::test_compute_array",
"dask/tests/test_base.py::test_persist_array",
"dask/tests/test_base.py::test_compute_dataframe",
"dask/tests/test_base.py::test_compute_array_dataframe",
"dask/tests/test_base.py::test_compute_array_bag",
"dask/tests/test_base.py::test_compute_with_literal",
"dask/tests/test_base.py::test_compute_nested",
"dask/tests/test_base.py::test_use_cloudpickle_to_tokenize_functions_in__main__",
"dask/tests/test_base.py::test_optimizations_keyword",
"dask/tests/test_base.py::test_optimize",
"dask/tests/test_base.py::test_optimize_nested",
"dask/tests/test_base.py::test_default_imports",
"dask/tests/test_base.py::test_persist_literals",
"dask/tests/test_base.py::test_persist_nested",
"dask/tests/test_base.py::test_persist_delayed",
"dask/tests/test_base.py::test_persist_array_bag",
"dask/tests/test_base.py::test_normalize_function_limited_size",
"dask/tests/test_base.py::test_optimize_globals",
"dask/tests/test_base.py::test_optimize_None",
"dask/tests/test_base.py::test_scheduler_keyword",
"dask/tests/test_base.py::test_warn_get_keyword",
"dask/tests/test_base.py::test_get_scheduler",
"dask/tests/test_base.py::test_callable_scheduler"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,223 |
[
"dask/array/top.py",
"dask/sharedict.py",
"dask/delayed.py",
"dask/multiprocessing.py",
"dask/array/core.py",
"dask/threaded.py",
"dask/array/linalg.py"
] |
[
"dask/array/top.py",
"dask/sharedict.py",
"dask/delayed.py",
"dask/multiprocessing.py",
"dask/array/core.py",
"dask/threaded.py",
"dask/array/linalg.py"
] |
streamlink__streamlink-2112
|
1961201e6e4dd74f4c1d0f9fecf8a4ed87a60e66
|
2018-10-12 00:30:49
|
42c34ca104f9a1761164dfce6c3ebabea984a823
|
codecov[bot]: # [Codecov](https://codecov.io/gh/streamlink/streamlink/pull/2112?src=pr&el=h1) Report
> Merging [#2112](https://codecov.io/gh/streamlink/streamlink/pull/2112?src=pr&el=desc) into [master](https://codecov.io/gh/streamlink/streamlink/commit/1961201e6e4dd74f4c1d0f9fecf8a4ed87a60e66?src=pr&el=desc) will **decrease** coverage by `0.03%`.
> The diff coverage is `44.44%`.
```diff
@@ Coverage Diff @@
## master #2112 +/- ##
==========================================
- Coverage 35.81% 35.78% -0.04%
==========================================
Files 231 232 +1
Lines 20289 20343 +54
==========================================
+ Hits 7267 7279 +12
- Misses 13022 13064 +42
```
|
diff --git a/docs/cli.rst b/docs/cli.rst
index 02c5ed31..0ebcadf0 100644
--- a/docs/cli.rst
+++ b/docs/cli.rst
@@ -239,6 +239,27 @@ For this, the plugin provides the :option:`--crunchyroll-purge-credentials`
option, which removes your saved session and credentials and tries to log
in again using your username and password.
+.. _cli-funimationnow:
+
+Authenticating with FunimationNow
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Like Crunchyroll, the FunimationNow plugin requires authenticating with a premium account to access some
+content: :option:`--funimation-email`, :option:`--funimation-password`. In addition, this plugin requires a ``incap_ses`` cookie to be
+sent with each HTTP request (see issue #2088); this unique session cookie can be found in your browser and sent via the :option:`--http-cookie` option.
+
+For example:
+
+.. sourcecode:: console
+
+ $ streamlink --funimation-email='xxx' --funimation-password='xxx' --http-cookie 'incap_ses_xxx=xxxx=' https://funimation.com/shows/show/an-episode-link
+
+.. note::
+
+ There are multiple ways to retrieve the required cookie. For more
+ information on browser cookies, please consult the following:
+
+ - `What are cookies? <http://www.whatarecookies.com/view.asp>`_
+
Sideloading plugins
-------------------
diff --git a/docs/donate.rst b/docs/donate.rst
index 94e2ec4c..575852c7 100644
--- a/docs/donate.rst
+++ b/docs/donate.rst
@@ -10,9 +10,7 @@ below. If you would prefer to donate to the team as a whole, please use our
donations are not tax deductible as Streamlink does not operate as a charitable
organization. Your donation to the team or a team member may be used in any
way and does not come with expectations of work to be provided or as payment
-for future work. If you would like a specific feature implemented consider
-creating a bounty on
-`Bountysource <https://www.bountysource.com/teams/streamlink>`_.
+for future work.
---------------
Streamlink Team
@@ -38,5 +36,5 @@ Gravyboat
- `Github <https://github.com/gravyboat>`__
- `Bitcoin <https://blockchain.info/qr?data=1PpdFh9LkTsjtG2AAcrWqk6RiFrC2iTCxj>`__ (`1PpdFh9LkTsjtG2AAcrWqk6RiFrC2iTCxj`)
-- `Flattr <https://flattr.com/profile/gravyboat>`__
+- `Flattr <https://flattr.com/@gravyboat>`__
- `Gratipay <https://gratipay.com/~gravyboat/>`__
diff --git a/docs/plugin_matrix.rst b/docs/plugin_matrix.rst
index 9cb83e2b..0c2a56e0 100644
--- a/docs/plugin_matrix.rst
+++ b/docs/plugin_matrix.rst
@@ -81,7 +81,7 @@ europaplus europaplus.ru Yes --
facebook facebook.com Yes No Only 360p HLS streams.
filmon filmon.com Yes Yes Only SD quality streams.
foxtr fox.com.tr Yes No
-funimationnow - funimation.com -- Yes
+funimationnow - funimation.com -- Yes :ref:`Requires session cookies <cli-funimationnow>`
- funimationnow.uk
gardenersworld gardenersworld.com -- Yes
garena garena.live Yes --
@@ -108,6 +108,7 @@ livestream new.livestream.com Yes --
lrt lrt.lt Yes No
ltv_lsm_lv ltv.lsm.lv Yes No Streams may be geo-restricted to Latvia.
mediaklikk mediaklikk.hu Yes No Streams may be geo-restricted to Hungary.
+metube metube.id Yes Yes
mitele mitele.es Yes No Streams may be geo-restricted to Spain.
mixer mixer.com Yes Yes
mjunoon mjunoon.tv Yes Yes
@@ -141,7 +142,7 @@ playtv - playtv.fr Yes -- Streams may be geo-rest
pluzz - france.tv Yes Yes Streams may be geo-restricted to France, Andorra and Monaco.
- ludo.fr
- zouzous.fr
- - france3-reg.. [8]_
+ - francetvinfo.fr
powerapp powerapp.com.tr Yes No
qq live.qq.com Yes No
radionet - radio.net Yes --
@@ -188,6 +189,7 @@ svtplay - svtplay.se Yes Yes Streams may be geo-rest
- oppetarkiv.se
swisstxt - srf.ch Yes No Streams are geo-restricted to Switzerland.
- rsi.ch
+tamago player.tamago.live Yes --
teamliquid teamliquid.net Yes Yes
teleclubzoom teleclubzoom.ch Yes No Streams are geo-restricted to Switzerland.
telefe telefe.com No Yes Streams are geo-restricted to Argentina.
@@ -214,7 +216,7 @@ tv4play - tv4play.se Yes Yes Streams may be geo-rest
- fotbollskanalen.se
tv5monde - tv5monde.com Yes Yes Streams may be geo-restricted to France, Belgium and Switzerland.
- tv5mondeplus.com
- - tv5mondepl... [9]_
+ - tv5mondepl... [8]_
tv8 tv8.com.tr Yes No
tv360 tv360.com.tr Yes No
tvcatchup tvcatchup.com Yes No Streams may be geo-restricted to Great Britain.
@@ -256,10 +258,10 @@ youtube - youtube.com Yes Yes Protected videos are no
- youtu.be
yupptv yupptv.com Yes Yes Some streams require an account and subscription.
zattoo - zattoo.com Yes Yes
- - nettv.net... [10]_
+ - nettv.net... [9]_
- tvonline.ewe.de
- - iptv.glat... [11]_
- - mobiltv.q... [12]_
+ - iptv.glat... [10]_
+ - mobiltv.q... [11]_
- player.waly.tv
- tvplus.m-net.de
- www.bbv-tv.net
@@ -279,8 +281,7 @@ zhanqi zhanqi.tv Yes No
.. [5] mediathek.daserste.de
.. [6] players.brightcove.net
.. [7] player.theplatform.com
-.. [8] france3-regions.francetvinfo.fr
-.. [9] tv5mondeplusafrique.com
-.. [10] nettv.netcologne.de
-.. [11] iptv.glattvision.ch
-.. [12] mobiltv.quickline.com
+.. [8] tv5mondeplusafrique.com
+.. [9] nettv.netcologne.de
+.. [10] iptv.glattvision.ch
+.. [11] mobiltv.quickline.com
diff --git a/src/streamlink/_version.py b/src/streamlink/_version.py
index 5e81ded0..48366bc0 100644
--- a/src/streamlink/_version.py
+++ b/src/streamlink/_version.py
@@ -235,7 +235,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
# if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
- "--always", "--long",
+ "--always", "--long", "--abbrev=7",
"--match", "%s*" % tag_prefix],
cwd=root)
# --long was added in git-1.5.5
diff --git a/src/streamlink/plugin/plugin.py b/src/streamlink/plugin/plugin.py
index 1f5513d7..ef38ac47 100644
--- a/src/streamlink/plugin/plugin.py
+++ b/src/streamlink/plugin/plugin.py
@@ -384,6 +384,7 @@ class Plugin(object):
stream_names = filter(stream_weight_only, streams.keys())
sorted_streams = sorted(stream_names, key=stream_weight_only)
+ unfiltered_sorted_streams = sorted_streams
if isinstance(sorting_excludes, list):
for expr in sorting_excludes:
@@ -402,6 +403,11 @@ class Plugin(object):
worst = sorted_streams[0]
final_sorted_streams["worst"] = streams[worst]
final_sorted_streams["best"] = streams[best]
+ elif len(unfiltered_sorted_streams) > 0:
+ best = unfiltered_sorted_streams[-1]
+ worst = unfiltered_sorted_streams[0]
+ final_sorted_streams["worst-unfiltered"] = streams[worst]
+ final_sorted_streams["best-unfiltered"] = streams[best]
return final_sorted_streams
diff --git a/src/streamlink/plugins/bilibili.py b/src/streamlink/plugins/bilibili.py
index 4e3c068e..8ddb95cd 100644
--- a/src/streamlink/plugins/bilibili.py
+++ b/src/streamlink/plugins/bilibili.py
@@ -1,15 +1,12 @@
-import hashlib
import re
-import time
from requests.adapters import HTTPAdapter
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate, useragents
from streamlink.stream import HTTPStream
-API_URL = "http://live.bilibili.com/api/playurl?cid={0}&player=1&quality=0&sign={1}&otype=json"
+API_URL = "https://api.live.bilibili.com/room/v1/Room/playUrl?cid={0}&quality=0&platform=web"
ROOM_API = "https://api.live.bilibili.com/room/v1/Room/room_init?id={}"
-API_SECRET = "95acd7f6cc3392f3"
SHOW_STATUS_OFFLINE = 0
SHOW_STATUS_ONLINE = 1
SHOW_STATUS_ROUND = 2
@@ -32,6 +29,15 @@ _room_id_schema = validate.Schema(
validate.get("data")
)
+_room_stream_list_schema = validate.Schema(
+ {
+ "data": validate.any(None, {
+ "durl": [{"url": validate.url()}]
+ })
+ },
+ validate.get("data")
+)
+
class Bilibili(Plugin):
@classmethod
@@ -56,11 +62,8 @@ class Bilibili(Plugin):
if room_id_json['live_status'] != SHOW_STATUS_ONLINE:
return
- ts = int(time.time() / 60)
- sign = hashlib.md5(("{0}{1}".format(channel, API_SECRET, ts)).encode("utf-8")).hexdigest()
-
- res = self.session.http.get(API_URL.format(room_id, sign))
- room = self.session.http.json(res)
+ res = self.session.http.get(API_URL.format(room_id))
+ room = self.session.http.json(res, schema=_room_stream_list_schema)
if not room:
return
diff --git a/src/streamlink/plugins/huomao.py b/src/streamlink/plugins/huomao.py
index aee762b3..e0d5770f 100644
--- a/src/streamlink/plugins/huomao.py
+++ b/src/streamlink/plugins/huomao.py
@@ -4,8 +4,8 @@ simply extracts the videos stream_id, stream_url and stream_quality by
scraping the HTML and JS of one of Huomaos mobile webpages.
When viewing a stream on huomao.com, the base URL references a room_id. This
-room_id is mapped one-to-one to a stream_id which references the actual .flv
-video. Both stream_id, stream_url and stream_quality can be found in the
+room_id is mapped one-to-one to a stream_id which references the actual .m3u8
+file. Both stream_id, stream_url and stream_quality can be found in the
HTML and JS source of the mobile_page. Since one stream can occur in many
different qualities, we scrape all stream_url and stream_quality occurrences
and return each option to the user.
@@ -14,7 +14,7 @@ and return each option to the user.
import re
from streamlink.plugin import Plugin
-from streamlink.stream import HTTPStream
+from streamlink.stream import HLSStream
# URL pattern for recognizing inputed Huomao.tv / Huomao.com URL.
url_re = re.compile(r"""
@@ -35,18 +35,15 @@ mobile_url = "http://www.huomao.com/mobile/mob_live/{0}"
# <input id="html_stream" value="efmrCH" type="hidden">
stream_id_pattern = re.compile(r'id=\"html_stream\" value=\"(?P<stream_id>\w+)\"')
-# Pattern for extracting each stream_url, stream_quality_url and a prettified
+# Pattern for extracting each stream_url and
# stream_quality_name used for quality naming.
#
# Example from HTML:
-# "2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8'"
+# src="http://live-ws-hls.huomaotv.cn/live/<stream_id>_720/playlist.m3u8"
stream_info_pattern = re.compile(r"""
- [1-9]:
- \s+
- '(?P<stream_url>(?:\w|\.|:|-|/)+)
- '\+stream\+'
- (?P<stream_quality_url>_?(?P<stream_quality_name>\d*))
- /playlist.m3u8'
+ (?P<stream_url>(?:[\w\/\.\-:]+)
+ \/[^_\"]+(?:_(?P<stream_quality_name>\d+))
+ ?/playlist.m3u8)
""", re.VERBOSE)
@@ -65,11 +62,11 @@ class Huomao(Plugin):
return stream_id.group("stream_id")
def get_stream_info(self, html):
- """Returns a nested list of different stream options.
+ """
+ Returns a nested list of different stream options.
- Each entry in the list will contain a stream_url, stream_quality_url
- and stream_quality_name for each stream occurrence that was found in
- the JS.
+ Each entry in the list will contain a stream_url and stream_quality_name
+ for each stream occurrence that was found in the JS.
"""
stream_info = stream_info_pattern.findall(html)
@@ -80,8 +77,8 @@ class Huomao(Plugin):
# list and reassigning.
stream_info_list = []
for info in stream_info:
- if not info[2]:
- stream_info_list.append([info[0], info[1], "source"])
+ if not info[1]:
+ stream_info_list.append([info[0], "source"])
else:
stream_info_list.append(list(info))
@@ -95,8 +92,8 @@ class Huomao(Plugin):
streams = {}
for info in stream_info:
- streams[info[2]] = HTTPStream(self.session,
- info[0] + stream_id + info[1] + ".flv")
+ if stream_id in info[0]:
+ streams[info[1]] = HLSStream(self.session, info[0])
return streams
diff --git a/src/streamlink/plugins/metube.py b/src/streamlink/plugins/metube.py
new file mode 100644
index 00000000..8e78e929
--- /dev/null
+++ b/src/streamlink/plugins/metube.py
@@ -0,0 +1,58 @@
+import re
+
+from streamlink.plugin import Plugin
+from streamlink.plugin.api import useragents
+from streamlink.stream import HLSStream
+
+
+class MeTube(Plugin):
+
+ _url_re = re.compile(r"""https?://(?:www\.)?metube\.id/
+ (?P<type>live|videos)/\w+(?:/.*)?""", re.VERBOSE)
+
+ # extracted from webpage source
+ _VOD_STREAM_NAMES = {
+ "3000k": "1080p",
+ "1800k": "720p",
+ "800k": "480p",
+ "300k": "240p"
+ }
+
+ @classmethod
+ def can_handle_url(cls, url):
+ return cls._url_re.match(url) is not None
+
+ def _get_streams(self):
+ stream_type = self._url_re.match(self.url).group("type")
+ hls_re = re.compile(r"""["'](?P<url>[^"']+\.m3u8[^"']*?)["']""")
+
+ headers = {
+ "Origin": "https://www.metube.id",
+ "User-Agent": useragents.FIREFOX
+ }
+
+ res = self.session.http.get(self.url)
+ match = hls_re.search(res.text)
+
+ if not match:
+ return
+
+ stream_url = match.group("url")
+
+ if stream_type == "live":
+ return HLSStream.parse_variant_playlist(self.session, stream_url,
+ headers=headers)
+ else:
+ streams = {}
+
+ for quality, stream in HLSStream.parse_variant_playlist(
+ self.session,
+ stream_url,
+ headers=headers).items():
+ name = self._VOD_STREAM_NAMES.get(quality, quality)
+ streams[name] = stream
+
+ return streams
+
+
+__plugin__ = MeTube
diff --git a/src/streamlink/plugins/pluzz.py b/src/streamlink/plugins/pluzz.py
index 3e00b4eb..7ba24028 100644
--- a/src/streamlink/plugins/pluzz.py
+++ b/src/streamlink/plugins/pluzz.py
@@ -6,25 +6,24 @@ from streamlink.plugin import Plugin, PluginArguments, PluginArgument
from streamlink.plugin.api import validate
from streamlink.stream import DASHStream, HDSStream, HLSStream, HTTPStream
from streamlink.stream.ffmpegmux import MuxedStream
-from streamlink.utils import update_scheme
class Pluzz(Plugin):
GEO_URL = 'http://geo.francetv.fr/ws/edgescape.json'
API_URL = 'http://sivideo.webservices.francetelevisions.fr/tools/getInfosOeuvre/v2/?idDiffusion={0}'
- PLAYER_GENERATOR_URL = 'https://sivideo.webservices.francetelevisions.fr/assets/staticmd5/getUrl?id=jquery.player.7.js'
TOKEN_URL = 'http://hdfauthftv-a.akamaihd.net/esi/TA?url={0}'
-
- _url_re = re.compile(
- r'https?://((?:www)\.france\.tv/.+\.html|www\.(ludo|zouzous)\.fr/heros/[\w-]+|(sport|france3-regions)\.francetvinfo\.fr/.+?/(tv/direct)?)')
+ SWF_PLAYER_URL = 'https://staticftv-a.akamaihd.net/player/bower_components/player_flash/dist/FranceTVNVPVFlashPlayer.akamai-7301b6035a43c4e29b7935c9c36771d2.swf'
+
+ _url_re = re.compile(r'''
+ https?://(
+ (?:www\.)france\.tv/.+\.html |
+ www\.(ludo|zouzous)\.fr/heros/[\w-]+ |
+ (.+\.)?francetvinfo\.fr)
+ ''', re.VERBOSE)
_pluzz_video_id_re = re.compile(r'data-main-video="(?P<video_id>.+?)"')
_jeunesse_video_id_re = re.compile(r'playlist: \[{.*?,"identity":"(?P<video_id>.+?)@(?P<catalogue>Ludo|Zouzous)"')
- _f3_regions_video_id_re = re.compile(r'"http://videos\.francetv\.fr/video/(?P<video_id>.+?)@Regions"')
_sport_video_id_re = re.compile(r'data-video="(?P<video_id>.+?)"')
- _player_re = re.compile(
- r'src="(?P<player>//staticftv-a\.akamaihd\.net/player/jquery\.player.+?-[0-9a-f]+?\.js)"></script>')
- _swf_re = re.compile(
- r'"(bower_components/player_flash/dist/FranceTVNVPVFlashPlayer\.akamai-[0-9a-f]+\.swf)"')
+ _embed_video_id_re = re.compile(r'href="http://videos\.francetv\.fr/video/(?P<video_id>.+?)(?:@.+?)?"')
_hds_pv_data_re = re.compile(r"~data=.+?!")
_mp4_bitrate_re = re.compile(r'.*-(?P<bitrate>[0-9]+k)\.mp4')
@@ -107,23 +106,14 @@ class Pluzz(Plugin):
match = self._pluzz_video_id_re.search(res.text)
elif 'ludo.fr' in self.url or 'zouzous.fr' in self.url:
match = self._jeunesse_video_id_re.search(res.text)
- elif 'france3-regions.francetvinfo.fr' in self.url:
- match = self._f3_regions_video_id_re.search(res.text)
elif 'sport.francetvinfo.fr' in self.url:
match = self._sport_video_id_re.search(res.text)
+ else:
+ match = self._embed_video_id_re.search(res.text)
if match is None:
return
video_id = match.group('video_id')
- # Retrieve SWF player URL
- swf_url = None
- res = self.session.http.get(self.PLAYER_GENERATOR_URL)
- player_url = update_scheme(self.url, self.session.http.json(res, schema=self._player_schema)['result'])
- res = self.session.http.get(player_url)
- match = self._swf_re.search(res.text)
- if match is not None:
- swf_url = 'https://staticftv-a.akamaihd.net/player/' + match.group(1)
-
res = self.session.http.get(self.API_URL.format(video_id))
videos = self.session.http.json(res, schema=self._api_schema)
now = time.time()
@@ -162,12 +152,8 @@ class Pluzz(Plugin):
expired = expired or True
continue
- if ('.f4m' in video_url or
- '.mpd' in video_url or
- 'france.tv' in self.url or
- 'sport.francetvinfo.fr' in self.url):
- res = self.session.http.get(self.TOKEN_URL.format(video_url))
- video_url = res.text
+ res = self.session.http.get(self.TOKEN_URL.format(video_url))
+ video_url = res.text
if '.mpd' in video_url:
# Get redirect video URL
@@ -176,11 +162,11 @@ class Pluzz(Plugin):
for bitrate, stream in DASHStream.parse_manifest(self.session,
video_url).items():
streams.append((bitrate, stream))
- elif '.f4m' in video_url and swf_url is not None:
+ elif '.f4m' in video_url:
for bitrate, stream in HDSStream.parse_manifest(self.session,
video_url,
is_akamai=True,
- pvswf=swf_url).items():
+ pvswf=self.SWF_PLAYER_URL).items():
# HDS videos with data in their manifest fragment token
# doesn't seem to be supported by HDSStream. Ignore such
# stream (but HDS stream having only the hdntl parameter in
diff --git a/src/streamlink/plugins/tamago.py b/src/streamlink/plugins/tamago.py
new file mode 100644
index 00000000..0b6dc719
--- /dev/null
+++ b/src/streamlink/plugins/tamago.py
@@ -0,0 +1,52 @@
+import re
+
+from streamlink.plugin import Plugin
+from streamlink.plugin.api import validate
+from streamlink.stream import HTTPStream
+from streamlink import NoStreamsError
+
+
+class Tamago(Plugin):
+
+ _url_re = re.compile(r"https?://(?:player\.)?tamago\.live/w/(?P<id>\d+)")
+
+ _api_url_base = "https://player.tamago.live/api/rooms/{id}"
+
+ _api_response_schema = validate.Schema({
+ u"status": 200,
+ u"message": u"Success",
+ u"data": {
+ u"room_number": validate.text,
+ u"stream": {validate.text: validate.url()}
+ }
+ })
+
+ _stream_qualities = {
+ u"150": "144p",
+ u"350": "360p",
+ u"550": "540p",
+ u"900": "720p",
+ }
+
+ @classmethod
+ def can_handle_url(cls, url):
+ return cls._url_re.match(url) is not None
+
+ def _get_streams(self):
+ user_id = self._url_re.match(self.url).group('id')
+
+ try:
+ api_response = self.session.http.get(self._api_url_base.format(id=user_id))
+ streams = self.session.http.json(api_response, schema=self._api_response_schema)['data']['stream']
+ except Exception:
+ raise NoStreamsError(self.url)
+
+ unique_stream_urls = []
+ for stream in streams.keys():
+ if streams[stream] not in unique_stream_urls:
+ unique_stream_urls.append(streams[stream])
+ quality = self._stream_qualities[stream] if stream in self._stream_qualities.keys() else "720p+"
+ yield quality, HTTPStream(self.session, streams[stream])
+
+
+__plugin__ = Tamago
diff --git a/src/streamlink/plugins/youtube.py b/src/streamlink/plugins/youtube.py
index 38e07368..b1081c13 100644
--- a/src/streamlink/plugins/youtube.py
+++ b/src/streamlink/plugins/youtube.py
@@ -7,7 +7,7 @@ import re
from streamlink.compat import parse_qsl, is_py2
from streamlink.plugin import Plugin, PluginError, PluginArguments, PluginArgument
from streamlink.plugin.api import validate, useragents
-from streamlink.plugin.api.utils import parse_query
+from streamlink.plugin.api.utils import itertags, parse_query
from streamlink.stream import HTTPStream, HLSStream
from streamlink.stream.ffmpegmux import MuxedStream
from streamlink.utils import parse_json, search_dict
@@ -89,23 +89,26 @@ _config_schema = validate.Schema(
)
_ytdata_re = re.compile(r'window\["ytInitialData"\]\s*=\s*({.*?});', re.DOTALL)
-_url_re = re.compile(r"""
- http(s)?://(\w+\.)?youtube.com
+_url_re = re.compile(r"""(?x)https?://(?:\w+\.)?youtube\.com
(?:
(?:
- /(watch.+v=|embed/|v/)
+ /(?:watch.+v=|embed/(?!live_stream)|v/)
(?P<video_id>[0-9A-z_-]{11})
)
|
(?:
- /(user|channel)/(?P<user>[^/?]+)
+ /(?:
+ (?:user|channel)/
+ |
+ embed/live_stream\?channel=
+ )(?P<user>[^/?&]+)
)
|
(?:
- /(c/)?(?P<liveChannel>[^/?]+)/live
+ /(?:c/)?(?P<liveChannel>[^/?]+)/live/?$
)
)
-""", re.VERBOSE)
+""")
class YouTube(Plugin):
@@ -270,6 +273,14 @@ class YouTube(Plugin):
log.debug("Video ID from videoRenderer (live)")
return x["videoId"]
+ if "/embed/live_stream" in url:
+ for link in itertags(res.text, "link"):
+ if link.attributes.get("rel") == "canonical":
+ canon_link = link.attributes.get("href")
+ if canon_link != url:
+ log.debug("Re-directing to canonical URL: {0}".format(canon_link))
+ return self._find_video_id(canon_link)
+
raise PluginError("Could not find a video on this page")
def _get_stream_info(self, video_id):
diff --git a/src/streamlink_cli/argparser.py b/src/streamlink_cli/argparser.py
index 0c77adb3..6af91976 100644
--- a/src/streamlink_cli/argparser.py
+++ b/src/streamlink_cli/argparser.py
@@ -107,7 +107,7 @@ def build_parser():
help="""
Stream to play.
- Use "best" or "worst" for selecting the highest or lowest available
+ Use ``best`` or ``worst`` for selecting the highest or lowest available
quality.
Fallback streams can be specified by using a comma-separated list:
@@ -523,7 +523,7 @@ def build_parser():
help="""
Stream to play.
- Use "best" or "worst" for selecting the highest or lowest available
+ Use ``best`` or ``worst`` for selecting the highest or lowest available
quality.
Fallback streams can be specified by using a comma-separated list:
@@ -590,13 +590,17 @@ def build_parser():
metavar="STREAMS",
type=comma_list,
help="""
- Fine tune best/worst synonyms by excluding unwanted streams.
+ Fine tune the ``best`` and ``worst`` stream name synonyms by excluding unwanted streams.
+
+ If all of the available streams get excluded, ``best`` and ``worst`` will become
+ inaccessible and new special stream synonyms ``best-unfiltered`` and ``worst-unfiltered``
+ can be used as a fallback selection method.
Uses a filter expression in the format:
[operator]<value>
- Valid operators are >, >=, < and <=. If no operator is specified then
+ Valid operators are ``>``, ``>=``, ``<`` and ``<=``. If no operator is specified then
equality is tested.
For example this will exclude streams ranked higher than "480p":
diff --git a/src/streamlink_cli/constants.py b/src/streamlink_cli/constants.py
index 05ec5dba..45eb7894 100644
--- a/src/streamlink_cli/constants.py
+++ b/src/streamlink_cli/constants.py
@@ -28,7 +28,7 @@ else:
]
PLUGINS_DIR = os.path.expanduser(XDG_CONFIG_HOME + "/streamlink/plugins")
-STREAM_SYNONYMS = ["best", "worst"]
+STREAM_SYNONYMS = ["best", "worst", "best-unfiltered", "worst-unfiltered"]
STREAM_PASSTHROUGH = ["hls", "http", "rtmp"]
__all__ = [
diff --git a/src/streamlink_cli/main.py b/src/streamlink_cli/main.py
index 3fe315ce..b43175a6 100644
--- a/src/streamlink_cli/main.py
+++ b/src/streamlink_cli/main.py
@@ -57,10 +57,14 @@ def check_file_output(filename, force):
log.debug("Checking file output")
if os.path.isfile(filename) and not force:
- answer = console.ask("File {0} already exists! Overwrite it? [y/N] ",
- filename)
+ if sys.stdin.isatty():
+ answer = console.ask("File {0} already exists! Overwrite it? [y/N] ",
+ filename)
- if answer.lower() != "y":
+ if answer.lower() != "y":
+ sys.exit()
+ else:
+ log.error("File {0} already exists, use --force to overwrite it.".format(filename))
sys.exit()
return FileOutput(filename)
@@ -322,7 +326,7 @@ def read_stream(stream, output, prebuffer, chunk_size=8192):
is_player = isinstance(output, PlayerOutput)
is_http = isinstance(output, HTTPServer)
is_fifo = is_player and output.namedpipe
- show_progress = isinstance(output, FileOutput) and output.fd is not stdout
+ show_progress = isinstance(output, FileOutput) and output.fd is not stdout and sys.stdout.isatty()
stream_iterator = chain(
[prebuffer],
diff --git a/versioneer.py b/versioneer.py
index 64fea1c8..831dac8b 100644
--- a/versioneer.py
+++ b/versioneer.py
@@ -1047,7 +1047,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
# if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
# if there isn't one, this yields HEX[-dirty] (no NUM)
describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
- "--always", "--long",
+ "--always", "--long", "--abbrev=7",
"--match", "%s*" % tag_prefix],
cwd=root)
# --long was added in git-1.5.5
|
metube.id plugin request
## Plugin Request
- [x] This is a plugin request and I have read the contribution guidelines and plugin request requirements.
### Description
www.metube.id
- serveral Indonesia TV channels / legal streaming portal, see TERMS & CONDITIONS
link to live channel selection:
- https://www.metube.id/live
### Example stream URLs
1. https://www.metube.id/live/METROTV
2. https://www.metube.id/live/GTV
3. https://www.metube.id/live/RCTI
4. https://www.metube.id/live/TRANS7
5. ...
### Additional comments, screenshots, etc.
sample embeded stream: m3u8 / accessing: HTTP 502 bad Gateway
1. https://cdn-livetv1.metube.id/hls/metrotv.m3u8 /
https://cdn-livetv1.metube.id/hls/metrotv_480/index.m3u8
2. https://cdn-livetv2.metube.id/hls/globaltv.m3u8 /
https://cdn-livetv2.metube.id/hls/globaltv_480/index.m3u8
3. https://cdn-livetv2.metube.id/hls/rcti.m3u8
https://cdn-livetv2.metube.id/hls/rcti_480/index.m3u8
4. https://cdn-livetv1.metube.id/hls/trans7.m3u8
https://cdn-livetv1.metube.id/hls/trans7_480/index.m3u8
5. .....
######
|
streamlink/streamlink
|
diff --git a/tests/plugins/test_huomao.py b/tests/plugins/test_huomao.py
index a27efdcb..1261680f 100644
--- a/tests/plugins/test_huomao.py
+++ b/tests/plugins/test_huomao.py
@@ -15,15 +15,12 @@ class TestPluginHuomao(unittest.TestCase):
# room_id = 123456
# stream_id = 9qsvyF24659
# stream_url = http://live-ws.huomaotv.cn/live/
- # stream_quality = source, _720 and _480
# stream_quality_name = source, 720 and 480
self.mock_html = """
<input id="html_stream" value="9qsvyF24659" type="hidden">
- <!-- urls:{-->
- <!-- 1: 'http://live-ws.huomaotv.cn/live/'+stream+'/playlist.m3u8',-->
- <!-- 2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8',-->
- <!-- 3: 'http://live-ws.huomaotv.cn/live/'+stream+'_480/playlist.m3u8'-->
- <!-- },-->
+ <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659/playlist.m3u8">
+ <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_720/playlist.m3u8">
+ <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_480/playlist.m3u8">
"""
# Create a mock Huomao object.
@@ -43,9 +40,9 @@ class TestPluginHuomao(unittest.TestCase):
# Assert that the stream_url, stream_quality and stream_quality_name
# is correctly extracted from the mock HTML.
self.assertEqual(self.mock_huomao.get_stream_info(self.mock_html), [
- ["http://live-ws.huomaotv.cn/live/", "", "source"],
- ["http://live-ws.huomaotv.cn/live/", "_720", "720"],
- ["http://live-ws.huomaotv.cn/live/", "_480", "480"]
+ ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659/playlist.m3u8", "source"],
+ ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_720/playlist.m3u8", "720"],
+ ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_480/playlist.m3u8", "480"]
])
def test_can_handle_url(self):
diff --git a/tests/plugins/test_metube.py b/tests/plugins/test_metube.py
new file mode 100644
index 00000000..0848dac8
--- /dev/null
+++ b/tests/plugins/test_metube.py
@@ -0,0 +1,24 @@
+import unittest
+
+from streamlink.plugins.metube import MeTube
+
+
+class TestPluginMeTube(unittest.TestCase):
+ def test_can_handle_url(self):
+ should_match = [
+ 'https://www.metube.id/live/METROTV',
+ 'https://www.metube.id/live/GTV',
+ 'https://www.metube.id/videos/16881738/yudi_28_bogor_-amazingakak',
+ 'https://www.metube.id/videos/16873428/liverpool-vs-psg-3-2-goals-and-highlights-2018',
+ ]
+ for url in should_match:
+ self.assertTrue(MeTube.can_handle_url(url))
+
+ def test_can_handle_url_negative(self):
+ should_not_match = [
+ 'https://www.metube.id/me/IMAA2018',
+ 'https://www.metube.id/auditions',
+ 'https://www.twitch.tv/twitch'
+ ]
+ for url in should_not_match:
+ self.assertFalse(MeTube.can_handle_url(url))
diff --git a/tests/plugins/test_pluzz.py b/tests/plugins/test_pluzz.py
index 5a709c31..f49018eb 100644
--- a/tests/plugins/test_pluzz.py
+++ b/tests/plugins/test_pluzz.py
@@ -23,6 +23,7 @@ class TestPluginPluzz(unittest.TestCase):
self.assertTrue(Pluzz.can_handle_url("http://sport.francetvinfo.fr/roland-garros/direct"))
self.assertTrue(Pluzz.can_handle_url("http://sport.francetvinfo.fr/roland-garros/live-court-3"))
self.assertTrue(Pluzz.can_handle_url("http://sport.francetvinfo.fr/roland-garros/andy-murray-gbr-1-andrey-kuznetsov-rus-1er-tour-court-philippe-chatrier"))
+ self.assertTrue(Pluzz.can_handle_url("https://www.francetvinfo.fr/en-direct/tv.html"))
# shouldn't match
self.assertFalse(Pluzz.can_handle_url("http://www.france.tv/"))
@@ -30,6 +31,5 @@ class TestPluginPluzz(unittest.TestCase):
self.assertFalse(Pluzz.can_handle_url("http://www.ludo.fr/"))
self.assertFalse(Pluzz.can_handle_url("http://www.ludo.fr/jeux"))
self.assertFalse(Pluzz.can_handle_url("http://www.zouzous.fr/"))
- self.assertFalse(Pluzz.can_handle_url("http://france3-regions.francetvinfo.fr/"))
self.assertFalse(Pluzz.can_handle_url("http://www.tvcatchup.com/"))
self.assertFalse(Pluzz.can_handle_url("http://www.youtube.com/"))
diff --git a/tests/plugins/test_tamago.py b/tests/plugins/test_tamago.py
new file mode 100644
index 00000000..06afc7db
--- /dev/null
+++ b/tests/plugins/test_tamago.py
@@ -0,0 +1,24 @@
+import unittest
+
+from streamlink.plugins.tamago import Tamago
+
+
+class TestPluginTamago(unittest.TestCase):
+ def test_can_handle_url(self):
+ should_match = [
+ 'https://player.tamago.live/w/2009642',
+ 'https://player.tamago.live/w/1882066',
+ 'https://player.tamago.live/w/1870142',
+ 'https://player.tamago.live/w/1729968',
+ ]
+ for url in should_match:
+ self.assertTrue(Tamago.can_handle_url(url))
+
+ def test_can_handle_url_negative(self):
+ should_not_match = [
+ 'https://download.tamago.live/faq',
+ 'https://player.tamago.live/gaming/pubg',
+ 'https://www.twitch.tv/twitch'
+ ]
+ for url in should_not_match:
+ self.assertFalse(Tamago.can_handle_url(url))
diff --git a/tests/plugins/test_youtube.py b/tests/plugins/test_youtube.py
index 4b1934d0..d6e1ab60 100644
--- a/tests/plugins/test_youtube.py
+++ b/tests/plugins/test_youtube.py
@@ -1,17 +1,19 @@
import unittest
-from streamlink.plugins.youtube import YouTube
+from streamlink.plugins.youtube import YouTube, _url_re
class TestPluginYouTube(unittest.TestCase):
def test_can_handle_url(self):
should_match = [
"https://www.youtube.com/c/EXAMPLE/live",
+ "https://www.youtube.com/c/EXAMPLE/live/",
"https://www.youtube.com/channel/EXAMPLE",
"https://www.youtube.com/v/aqz-KE-bpKQ",
"https://www.youtube.com/embed/aqz-KE-bpKQ",
"https://www.youtube.com/user/EXAMPLE/",
"https://www.youtube.com/watch?v=aqz-KE-bpKQ",
+ "https://www.youtube.com/embed/live_stream?channel=UCNye-wNBqNL5ZzHSJj3l8Bg",
]
for url in should_match:
self.assertTrue(YouTube.can_handle_url(url))
@@ -21,3 +23,44 @@ class TestPluginYouTube(unittest.TestCase):
]
for url in should_not_match:
self.assertFalse(YouTube.can_handle_url(url))
+
+ def _test_regex(self, url, expected_string, expected_group):
+ m = _url_re.match(url)
+ self.assertIsNotNone(m)
+ self.assertEqual(expected_string, m.group(expected_group))
+
+ def test_regex_liveChannel_c(self):
+ self._test_regex("https://www.youtube.com/c/EXAMPLE/live",
+ "EXAMPLE", "liveChannel")
+
+ def test_regex_liveChannel_no_c(self):
+ self._test_regex("https://www.youtube.com/EXAMPLE1/live",
+ "EXAMPLE1", "liveChannel")
+
+ def test_regex_user_channel(self):
+ self._test_regex("https://www.youtube.com/channel/EXAMPLE2",
+ "EXAMPLE2", "user")
+
+ def test_regex_user_user(self):
+ self._test_regex("https://www.youtube.com/channel/EXAMPLE3",
+ "EXAMPLE3", "user")
+
+ def test_regex_user_embed_list_stream(self):
+ self._test_regex("https://www.youtube.com/embed/live_stream?channel=UCNye-wNBqNL5ZzHSJj3l8Bg",
+ "UCNye-wNBqNL5ZzHSJj3l8Bg", "user")
+
+ def test_regex_user_embed_list_stream_2(self):
+ self._test_regex("https://www.youtube.com/embed/live_stream?channel=UCNye-wNBqNL5ZzHSJj3l8Bg&autoplay=1&modestbranding=1&rel=0&showinfo=0&color=white&fs=1",
+ "UCNye-wNBqNL5ZzHSJj3l8Bg", "user")
+
+ def test_regex_video_id_v(self):
+ self._test_regex("https://www.youtube.com/v/aqz-KE-bpKQ",
+ "aqz-KE-bpKQ", "video_id")
+
+ def test_regex_video_id_embed(self):
+ self._test_regex("https://www.youtube.com/embed/aqz-KE-bpKQ",
+ "aqz-KE-bpKQ", "video_id")
+
+ def test_regex_video_id_watch(self):
+ self._test_regex("https://www.youtube.com/watch?v=aqz-KE-bpKQ",
+ "aqz-KE-bpKQ", "video_id")
diff --git a/tests/plugins/testplugin.py b/tests/plugins/testplugin.py
index 06b693c4..66822ef4 100644
--- a/tests/plugins/testplugin.py
+++ b/tests/plugins/testplugin.py
@@ -37,6 +37,14 @@ class TestPlugin(Plugin):
def _get_streams(self):
if "empty" in self.url:
return
+
+ if "UnsortableStreamNames" in self.url:
+ def gen():
+ for i in range(3):
+ yield "vod", HTTPStream(self.session, "http://test.se/stream")
+
+ return gen()
+
if "NoStreamsError" in self.url:
raise NoStreamsError(self.url)
diff --git a/tests/test_cli_main.py b/tests/test_cli_main.py
index 9d817da7..2b58ea5f 100644
--- a/tests/test_cli_main.py
+++ b/tests/test_cli_main.py
@@ -3,8 +3,9 @@ import os.path
import tempfile
import streamlink_cli.main
-from streamlink_cli.main import resolve_stream_name, check_file_output
+from streamlink_cli.main import resolve_stream_name, format_valid_streams, check_file_output
from streamlink_cli.output import FileOutput
+from streamlink.plugin.plugin import Plugin
import unittest
from tests.mock import Mock, patch
@@ -18,12 +19,25 @@ class TestCLIMain(unittest.TestCase):
tmpfile = tempfile.NamedTemporaryFile()
try:
streamlink_cli.main.console = console = Mock()
+ streamlink_cli.main.sys.stdin = stdin = Mock()
+ stdin.isatty.return_value = True
console.ask.return_value = "y"
self.assertTrue(os.path.exists(tmpfile.name))
self.assertIsInstance(check_file_output(tmpfile.name, False), FileOutput)
finally:
tmpfile.close()
+ def test_check_file_output_exists_notty(self):
+ tmpfile = tempfile.NamedTemporaryFile()
+ try:
+ streamlink_cli.main.console = console = Mock()
+ streamlink_cli.main.sys.stdin = stdin = Mock()
+ stdin.isatty.return_value = False
+ self.assertTrue(os.path.exists(tmpfile.name))
+ self.assertRaises(SystemExit, check_file_output, tmpfile.name, False)
+ finally:
+ tmpfile.close()
+
def test_check_file_output_exists_force(self):
tmpfile = tempfile.NamedTemporaryFile()
try:
@@ -46,19 +60,71 @@ class TestCLIMain(unittest.TestCase):
tmpfile.close()
def test_resolve_stream_name(self):
- high = Mock()
- medium = Mock()
- low = Mock()
+ a = Mock()
+ b = Mock()
+ c = Mock()
+ d = Mock()
+ e = Mock()
streams = {
- "low": low,
- "medium": medium,
- "high": high,
- "worst": low,
- "best": high
+ "160p": a,
+ "360p": b,
+ "480p": c,
+ "720p": d,
+ "1080p": e,
+ "worst": b,
+ "best": d,
+ "worst-unfiltered": a,
+ "best-unfiltered": e
}
- self.assertEqual("high", resolve_stream_name(streams, "best"))
- self.assertEqual("low", resolve_stream_name(streams, "worst"))
- self.assertEqual("medium", resolve_stream_name(streams, "medium"))
- self.assertEqual("high", resolve_stream_name(streams, "high"))
- self.assertEqual("low", resolve_stream_name(streams, "low"))
+ self.assertEqual(resolve_stream_name(streams, "unknown"), "unknown")
+ self.assertEqual(resolve_stream_name(streams, "160p"), "160p")
+ self.assertEqual(resolve_stream_name(streams, "360p"), "360p")
+ self.assertEqual(resolve_stream_name(streams, "480p"), "480p")
+ self.assertEqual(resolve_stream_name(streams, "720p"), "720p")
+ self.assertEqual(resolve_stream_name(streams, "1080p"), "1080p")
+ self.assertEqual(resolve_stream_name(streams, "worst"), "360p")
+ self.assertEqual(resolve_stream_name(streams, "best"), "720p")
+ self.assertEqual(resolve_stream_name(streams, "worst-unfiltered"), "160p")
+ self.assertEqual(resolve_stream_name(streams, "best-unfiltered"), "1080p")
+
+ def test_format_valid_streams(self):
+ class FakePlugin:
+ @classmethod
+ def stream_weight(cls, stream):
+ return Plugin.stream_weight(stream)
+ a = Mock()
+ b = Mock()
+ c = Mock()
+
+ streams = {
+ "audio": a,
+ "720p": b,
+ "1080p": c,
+ "worst": b,
+ "best": c
+ }
+ self.assertEqual(
+ format_valid_streams(FakePlugin, streams),
+ ", ".join([
+ "audio",
+ "720p (worst)",
+ "1080p (best)"
+ ])
+ )
+
+ streams = {
+ "audio": a,
+ "720p": b,
+ "1080p": c,
+ "worst-unfiltered": b,
+ "best-unfiltered": c
+ }
+ self.assertEqual(
+ format_valid_streams(FakePlugin, streams),
+ ", ".join([
+ "audio",
+ "720p (worst-unfiltered)",
+ "1080p (best-unfiltered)"
+ ])
+ )
diff --git a/tests/test_session.py b/tests/test_session.py
index 573aae37..e923ab53 100644
--- a/tests/test_session.py
+++ b/tests/test_session.py
@@ -99,12 +99,23 @@ class TestSession(unittest.TestCase):
self.assertTrue(isinstance(streams["480p"], RTMPStream))
self.assertTrue(isinstance(streams["480p_http"], HTTPStream))
- def test_plugin_stream_sorted_excludes(self):
+ def test_plugin_stream_sorting_excludes(self):
channel = self.session.resolve_url("http://test.se/channel")
- streams = channel.streams(sorting_excludes=["1080p", "3000k"])
+ streams = channel.streams(sorting_excludes=[])
self.assertTrue("best" in streams)
self.assertTrue("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst"] is streams["350k"])
+ self.assertTrue(streams["best"] is streams["1080p"])
+
+ streams = channel.streams(sorting_excludes=["1080p", "3000k"])
+ self.assertTrue("best" in streams)
+ self.assertTrue("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst"] is streams["350k"])
self.assertTrue(streams["best"] is streams["1500k"])
streams = channel.streams(sorting_excludes=[">=1080p", ">1500k"])
@@ -113,6 +124,24 @@ class TestSession(unittest.TestCase):
streams = channel.streams(sorting_excludes=lambda q: not q.endswith("p"))
self.assertTrue(streams["best"] is streams["3000k"])
+ streams = channel.streams(sorting_excludes=lambda q: False)
+ self.assertFalse("best" in streams)
+ self.assertFalse("worst" in streams)
+ self.assertTrue("best-unfiltered" in streams)
+ self.assertTrue("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst-unfiltered"] is streams["350k"])
+ self.assertTrue(streams["best-unfiltered"] is streams["1080p"])
+
+ channel = self.session.resolve_url("http://test.se/UnsortableStreamNames")
+ streams = channel.streams()
+ self.assertFalse("best" in streams)
+ self.assertFalse("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue("vod" in streams)
+ self.assertTrue("vod_alt" in streams)
+ self.assertTrue("vod_alt2" in streams)
+
def test_plugin_support(self):
channel = self.session.resolve_url("http://test.se/channel")
streams = channel.streams()
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 13
}
|
0.14
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"codecov",
"coverage",
"mock",
"requests-mock",
"pynsist",
"freezegun",
"sphinx",
"recommonmark"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.7",
"reqs_path": [
"dev-requirements.txt",
"docs-requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
Babel==2.14.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
codecov==2.1.13
commonmark==0.9.1
coverage==7.2.7
distlib==0.3.9
docutils==0.20.1
exceptiongroup==1.2.2
freezegun==1.5.1
idna==3.10
imagesize==1.4.1
importlib-metadata==6.7.0
iniconfig==2.0.0
iso-639==0.4.5
iso3166==2.1.1
isodate==0.7.2
Jinja2==3.1.6
MarkupSafe==2.1.5
mock==5.2.0
packaging==24.0
pluggy==1.2.0
pycryptodome==3.22.0
Pygments==2.17.2
pynsist==2.8
PySocks==1.7.1
pytest==7.4.4
pytest-cov==4.1.0
python-dateutil==2.9.0.post0
pytz==2025.2
recommonmark==0.7.1
requests==2.31.0
requests-mock==1.12.1
requests_download==0.1.2
six==1.17.0
snowballstemmer==2.2.0
Sphinx==1.6.7
sphinxcontrib-serializinghtml==1.1.5
sphinxcontrib-websupport==1.2.4
-e git+https://github.com/streamlink/streamlink.git@1961201e6e4dd74f4c1d0f9fecf8a4ed87a60e66#egg=streamlink
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
websocket-client==1.6.1
yarg==0.1.10
zipp==3.15.0
|
name: streamlink
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- babel==2.14.0
- charset-normalizer==3.4.1
- codecov==2.1.13
- commonmark==0.9.1
- coverage==7.2.7
- distlib==0.3.9
- docutils==0.20.1
- exceptiongroup==1.2.2
- freezegun==1.5.1
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- iso-639==0.4.5
- iso3166==2.1.1
- isodate==0.7.2
- jinja2==3.1.6
- markupsafe==2.1.5
- mock==5.2.0
- packaging==24.0
- pluggy==1.2.0
- pycryptodome==3.22.0
- pygments==2.17.2
- pynsist==2.8
- pysocks==1.7.1
- pytest==7.4.4
- pytest-cov==4.1.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- recommonmark==0.7.1
- requests==2.31.0
- requests-download==0.1.2
- requests-mock==1.12.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==1.6.7
- sphinxcontrib-serializinghtml==1.1.5
- sphinxcontrib-websupport==1.2.4
- tomli==2.0.1
- typing-extensions==4.7.1
- urllib3==2.0.7
- websocket-client==1.6.1
- yarg==0.1.10
- zipp==3.15.0
prefix: /opt/conda/envs/streamlink
|
[
"tests/plugins/test_huomao.py::TestPluginHuomao::test_can_handle_url",
"tests/plugins/test_huomao.py::TestPluginHuomao::test_get_stream_id",
"tests/plugins/test_huomao.py::TestPluginHuomao::test_get_stream_quality",
"tests/plugins/test_metube.py::TestPluginMeTube::test_can_handle_url",
"tests/plugins/test_metube.py::TestPluginMeTube::test_can_handle_url_negative",
"tests/plugins/test_pluzz.py::TestPluginPluzz::test_can_handle_url",
"tests/plugins/test_tamago.py::TestPluginTamago::test_can_handle_url",
"tests/plugins/test_tamago.py::TestPluginTamago::test_can_handle_url_negative",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_can_handle_url",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_liveChannel_c",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_liveChannel_no_c",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_user_channel",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_user_embed_list_stream",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_user_embed_list_stream_2",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_user_user",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_video_id_embed",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_video_id_v",
"tests/plugins/test_youtube.py::TestPluginYouTube::test_regex_video_id_watch",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists_force",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists_no",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists_notty",
"tests/test_cli_main.py::TestCLIMain::test_format_valid_streams",
"tests/test_cli_main.py::TestCLIMain::test_resolve_stream_name",
"tests/test_session.py::TestSession::test_builtin_plugins",
"tests/test_session.py::TestSession::test_exceptions",
"tests/test_session.py::TestSession::test_load_plugins",
"tests/test_session.py::TestSession::test_options",
"tests/test_session.py::TestSession::test_plugin",
"tests/test_session.py::TestSession::test_plugin_stream_sorting_excludes",
"tests/test_session.py::TestSession::test_plugin_stream_types",
"tests/test_session.py::TestSession::test_plugin_support",
"tests/test_session.py::TestSession::test_resolve_url",
"tests/test_session.py::TestSession::test_resolve_url_no_redirect",
"tests/test_session.py::TestSession::test_resolve_url_priority",
"tests/test_session.py::TestSession::test_set_and_get_locale",
"tests/test_session.py::TestSession::test_short_exception"
] |
[] |
[] |
[] |
BSD 2-Clause "Simplified" License
| 3,224 |
[
"versioneer.py",
"src/streamlink/_version.py",
"src/streamlink/plugins/pluzz.py",
"src/streamlink/plugins/youtube.py",
"src/streamlink_cli/constants.py",
"src/streamlink_cli/main.py",
"src/streamlink_cli/argparser.py",
"docs/plugin_matrix.rst",
"docs/donate.rst",
"src/streamlink/plugins/tamago.py",
"src/streamlink/plugins/metube.py",
"src/streamlink/plugins/huomao.py",
"docs/cli.rst",
"src/streamlink/plugins/bilibili.py",
"src/streamlink/plugin/plugin.py"
] |
[
"versioneer.py",
"src/streamlink/_version.py",
"src/streamlink/plugins/pluzz.py",
"src/streamlink/plugins/youtube.py",
"src/streamlink_cli/constants.py",
"src/streamlink_cli/main.py",
"src/streamlink_cli/argparser.py",
"docs/plugin_matrix.rst",
"docs/donate.rst",
"src/streamlink/plugins/tamago.py",
"src/streamlink/plugins/metube.py",
"src/streamlink/plugins/huomao.py",
"docs/cli.rst",
"src/streamlink/plugins/bilibili.py",
"src/streamlink/plugin/plugin.py"
] |
google__mobly-532
|
e78255672c61f8f091e9eeb09f3b9f46481202d2
|
2018-10-12 01:06:13
|
95286a01a566e056d44acfa9577a45bc7f37f51d
|
diff --git a/mobly/controllers/android_device_lib/adb.py b/mobly/controllers/android_device_lib/adb.py
index 41af20c..5e0c36f 100644
--- a/mobly/controllers/android_device_lib/adb.py
+++ b/mobly/controllers/android_device_lib/adb.py
@@ -44,13 +44,17 @@ class AdbError(Error):
stdout: byte string, the raw stdout of the command.
stderr: byte string, the raw stderr of the command.
ret_code: int, the return code of the command.
+ serial: string, the serial of the device the command is executed on.
+ This is an empty string if the adb command is not specific to a
+ device.
"""
- def __init__(self, cmd, stdout, stderr, ret_code):
+ def __init__(self, cmd, stdout, stderr, ret_code, serial=None):
self.cmd = cmd
self.stdout = stdout
self.stderr = stderr
self.ret_code = ret_code
+ self.serial = serial
def __str__(self):
return ('Error executing adb cmd "%s". ret: %d, stdout: %s, stderr: %s'
@@ -179,7 +183,12 @@ class AdbProxy(object):
if ret == 0:
return out
else:
- raise AdbError(cmd=args, stdout=out, stderr=err, ret_code=ret)
+ raise AdbError(
+ cmd=args,
+ stdout=out,
+ stderr=err,
+ ret_code=ret,
+ serial=self.serial)
def _execute_and_process_stdout(self, args, shell, handler):
"""Executes adb commands and processes the stdout with a handler.
diff --git a/mobly/utils.py b/mobly/utils.py
index a9f065c..bb2f316 100644
--- a/mobly/utils.py
+++ b/mobly/utils.py
@@ -283,7 +283,7 @@ def concurrent_exec(func, param_list):
return return_vals
-def start_standing_subprocess(cmd, shell=False):
+def start_standing_subprocess(cmd, shell=False, env=None):
"""Starts a long-running subprocess.
This is not a blocking call and the subprocess started by it should be
@@ -296,6 +296,9 @@ def start_standing_subprocess(cmd, shell=False):
cmd: string, the command to start the subprocess with.
shell: bool, True to run this command through the system shell,
False to invoke it directly. See subprocess.Proc() docs.
+ env: dict, a custom environment to run the standing subprocess. If not
+ specified, inherits the current environment. See subprocess.Popen()
+ docs.
Returns:
The subprocess that was started.
@@ -306,7 +309,8 @@ def start_standing_subprocess(cmd, shell=False):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- shell=shell)
+ shell=shell,
+ env=env)
# Leaving stdin open causes problems for input, e.g. breaking the
# code.inspect() shell (http://stackoverflow.com/a/25512460/1612937), so
# explicitly close it assuming it is not needed for standing subprocesses.
|
`AdbError` should have a serial number attr
Our `AdbError` does not include an easily accessible serial number.
When handling an `AdbError`, it is sometimes useful to know which device the command was issued to, especially when you cannot change the code around the adb call directly and have to handle at an upper level.
Is this something worth adding?
|
google/mobly
|
diff --git a/tests/mobly/controllers/android_device_lib/adb_test.py b/tests/mobly/controllers/android_device_lib/adb_test.py
index 71fab9c..63ae285 100755
--- a/tests/mobly/controllers/android_device_lib/adb_test.py
+++ b/tests/mobly/controllers/android_device_lib/adb_test.py
@@ -91,15 +91,29 @@ class AdbTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
- def test_exec_cmd_error_no_timeout(self, mock_psutil_process, mock_popen):
+ def test_exec_cmd_error_with_serial(self, mock_psutil_process, mock_popen):
self._mock_process(mock_psutil_process, mock_popen)
# update return code to indicate command execution error
mock_popen.return_value.returncode = 1
+ mock_serial = 'ABCD1234'
+ with self.assertRaisesRegex(adb.AdbError,
+ 'Error executing adb cmd .*') as context:
+ adb.AdbProxy(mock_serial)._exec_cmd(
+ ['fake_cmd'], shell=False, timeout=None, stderr=None)
+ self.assertEqual(context.exception.serial, mock_serial)
+ @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
+ @mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
+ def test_exec_cmd_error_without_serial(self, mock_psutil_process,
+ mock_popen):
+ self._mock_process(mock_psutil_process, mock_popen)
+ # update return code to indicate command execution error
+ mock_popen.return_value.returncode = 1
with self.assertRaisesRegex(adb.AdbError,
- 'Error executing adb cmd .*'):
+ 'Error executing adb cmd .*') as context:
adb.AdbProxy()._exec_cmd(
['fake_cmd'], shell=False, timeout=None, stderr=None)
+ self.assertFalse(context.exception.serial)
@mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
@@ -156,8 +170,8 @@ class AdbTest(unittest.TestCase):
self._mock_execute_and_process_stdout_process(mock_popen)
mock_handler = mock.MagicMock()
mock_popen.return_value.communicate = mock.Mock(
- return_value=(unexpected_stdout, MOCK_DEFAULT_STDERR.encode(
- 'utf-8')))
+ return_value=(unexpected_stdout,
+ MOCK_DEFAULT_STDERR.encode('utf-8')))
err = adb.AdbProxy()._execute_and_process_stdout(
['fake_cmd'], shell=False, handler=mock_handler)
diff --git a/tests/mobly/utils_test.py b/tests/mobly/utils_test.py
index 605dc8c..b9b0c22 100755
--- a/tests/mobly/utils_test.py
+++ b/tests/mobly/utils_test.py
@@ -53,6 +53,31 @@ class UtilsTest(unittest.TestCase):
p.stderr.close()
p.wait()
+ @mock.patch('subprocess.Popen')
+ def test_start_standing_subproc_without_env(self, mock_Popen):
+ p = utils.start_standing_subprocess(self.sleep_cmd)
+ mock_Popen.assert_called_with(
+ self.sleep_cmd,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False,
+ env=None,
+ )
+
+ @mock.patch('subprocess.Popen')
+ def test_start_standing_subproc_with_custom_env(self, mock_Popen):
+ mock_env = mock.MagicMock(spec=dict)
+ p = utils.start_standing_subprocess(self.sleep_cmd, env=mock_env)
+ mock_Popen.assert_called_with(
+ self.sleep_cmd,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False,
+ env=mock_env,
+ )
+
def test_stop_standing_subproc(self):
p = utils.start_standing_subprocess([self.sleep_cmd, '4'])
p1 = psutil.Process(p.pid)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
1.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "",
"pip_packages": [
"mock",
"pytest",
"pytz"
],
"pre_install": [],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup==1.2.2
future==1.0.0
iniconfig==2.1.0
-e git+https://github.com/google/mobly.git@e78255672c61f8f091e9eeb09f3b9f46481202d2#egg=mobly
mock==5.2.0
packaging==24.2
pluggy==1.5.0
portpicker==1.6.0
psutil==7.0.0
pyserial==3.5
pytest==8.3.5
pytz==2025.2
PyYAML==6.0.2
timeout-decorator==0.5.0
tomli==2.2.1
|
name: mobly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- future==1.0.0
- iniconfig==2.1.0
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- portpicker==1.6.0
- psutil==7.0.0
- pyserial==3.5
- pytest==8.3.5
- pytz==2025.2
- pyyaml==6.0.2
- timeout-decorator==0.5.0
- tomli==2.2.1
prefix: /opt/conda/envs/mobly
|
[
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_error_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_error_without_serial",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc_with_custom_env",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc_without_env"
] |
[] |
[
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_cli_cmd_to_string",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_arg_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_arg_command_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_serial_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_auto_quotes",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_arg_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_arg_command_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_serial_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_special_characters",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_formats_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_formats_command_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_with_stderr_pipe",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_no_timeout_success",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_timed_out",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_with_negative_timeout_value",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_with_timeout_success",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_adb_and_process_stdout_formats_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_despite_cmd_exits",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_logs_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_logs_cmd_with_unexpected_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_raises_adb_error",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_reads_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_reads_unexpected_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_returns_stderr",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_when_cmd_eof",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_when_handler_crash",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_forward",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_called_correctly",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_existing_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_missing_command_on_newer_devices",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_missing_command_on_older_devices",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler_with_options",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler_with_runner",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_options",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_runner",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_without_parameters",
"tests/mobly/utils_test.py::UtilsTest::test_create_dir",
"tests/mobly/utils_test.py::UtilsTest::test_create_dir_already_exists",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_negative",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_positive",
"tests/mobly/utils_test.py::UtilsTest::test_get_available_port_returns_free_port",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_bytes_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_text_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_load_file_to_base64_str_reads_unicode_file_as_base64_string",
"tests/mobly/utils_test.py::UtilsTest::test_start_standing_subproc",
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc",
"tests/mobly/utils_test.py::UtilsTest::test_stop_standing_subproc_wihtout_pipe"
] |
[] |
Apache License 2.0
| 3,225 |
[
"mobly/utils.py",
"mobly/controllers/android_device_lib/adb.py"
] |
[
"mobly/utils.py",
"mobly/controllers/android_device_lib/adb.py"
] |
|
dask__dask-4087
|
d33125c5249c9e996913ffca9315b3b9ce5cc55d
|
2018-10-12 06:10:35
|
faab2a4f5b37972f412b1c209877f82a1fb828ab
|
diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py
index 510913a45..d478d9ff9 100644
--- a/dask/dataframe/core.py
+++ b/dask/dataframe/core.py
@@ -3124,8 +3124,8 @@ class DataFrame(_Frame):
def _repr_data(self):
meta = self._meta
index = self._repr_divisions
- values = {c: _repr_data_series(meta[c], index) for c in meta.columns}
- return pd.DataFrame(values, columns=meta.columns)
+ series_list = [_repr_data_series(s, index=index) for _, s in meta.iteritems()]
+ return pd.concat(series_list, axis=1)
_HTML_FMT = """<div><strong>Dask DataFrame Structure:</strong></div>
{data}
diff --git a/dask/multiprocessing.py b/dask/multiprocessing.py
index aa825da6b..3a377b54c 100644
--- a/dask/multiprocessing.py
+++ b/dask/multiprocessing.py
@@ -160,6 +160,7 @@ def get(dsk, keys, num_workers=None, func_loads=None, func_dumps=None,
If True [default], `fuse` is applied to the graph before computation.
"""
pool = config.get('pool', None)
+ num_workers = num_workers or config.get('num_workers', None)
if pool is None:
context = get_context()
pool = context.Pool(num_workers,
diff --git a/dask/threaded.py b/dask/threaded.py
index fd336db63..84a382e9c 100644
--- a/dask/threaded.py
+++ b/dask/threaded.py
@@ -56,6 +56,7 @@ def get(dsk, result, cache=None, num_workers=None, **kwargs):
"""
global default_pool
pool = config.get('pool', None)
+ num_workers = num_workers or config.get('num_workers', None)
thread = current_thread()
with pools_lock:
|
Dataframe does not support duplicate column names perfectly
I just realized that dask datafrmaes, in contrast to pandas, does not support duplicate column names (perfectly).
```
import dask.array as da
import dask.dataframe as dd
import numpy as np
arr = da.from_array(np.arange(10).reshape(5,2), chunks=(5,2))
dd.from_dask_array(arr, columns=['a', 'a'])
```
raises the following error message:
<details>
```
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/anaconda3/envs/dask-ml-dev/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
700 type_pprinters=self.type_printers,
701 deferred_pprinters=self.deferred_printers)
--> 702 printer.pretty(obj)
703 printer.flush()
704 return stream.getvalue()
~/anaconda3/envs/dask-ml-dev/lib/python3.6/site-packages/IPython/lib/pretty.py in pretty(self, obj)
398 if cls is not object \
399 and callable(cls.__dict__.get('__repr__')):
--> 400 return _repr_pprint(obj, self, cycle)
401
402 return _default_pprint(obj, self, cycle)
~/anaconda3/envs/dask-ml-dev/lib/python3.6/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
693 """A pprint that just redirects to the normal repr function."""
694 # Find newlines and replace them with p.break_()
--> 695 output = repr(obj)
696 for idx,output_line in enumerate(output.splitlines()):
697 if idx:
~/anaconda3/envs/dask-ml-dev/lib/python3.6/site-packages/dask/dataframe/core.py in __repr__(self)
392
393 def __repr__(self):
--> 394 data = self._repr_data.to_string(max_rows=5, show_dimensions=False)
395 return """Dask {klass} Structure:
396 {data}
~/anaconda3/envs/dask-ml-dev/lib/python3.6/site-packages/dask/dataframe/core.py in __getattr__(self, key)
2518 return new_dd_object(merge(self.dask, dsk), name,
2519 meta, self.divisions)
-> 2520 raise AttributeError("'DataFrame' object has no attribute %r" % key)
2521
2522 def __dir__(self):
AttributeError: 'DataFrame' object has no attribute '_repr_data'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/anaconda3/envs/dask-ml-dev/lib/python3.6/site-packages/IPython/core/formatters.py in __call__(self, obj)
343 method = get_real_method(obj, self.print_method)
344 if method is not None:
--> 345 return method()
346 return None
347 else:
~/anaconda3/envs/dask-ml-dev/lib/python3.6/site-packages/dask/dataframe/core.py in _repr_html_(self)
3131
3132 def _repr_html_(self):
-> 3133 data = self._repr_data.to_html(max_rows=5,
3134 show_dimensions=False, notebook=True)
3135 return self._HTML_FMT.format(data=data, name=key_split(self._name),
~/anaconda3/envs/dask-ml-dev/lib/python3.6/site-packages/dask/dataframe/core.py in __getattr__(self, key)
2518 return new_dd_object(merge(self.dask, dsk), name,
2519 meta, self.divisions)
-> 2520 raise AttributeError("'DataFrame' object has no attribute %r" % key)
2521
2522 def __dir__(self):
AttributeError: 'DataFrame' object has no attribute '_repr_data'
```
</details>
However, assigning the frame to a variable and computing the array works
```
m = dd.from_dask_array(arr, columns=['a', 'a'])
m.compute()
| a | a
-- | -- | --
0 | 1
2 | 3
4 | 5
6 | 7
8 | 9
```
I didn't find the issue, so please apologies if it's a duplicate
|
dask/dask
|
diff --git a/dask/dataframe/tests/test_format.py b/dask/dataframe/tests/test_format.py
index c9463eb25..3c9055737 100644
--- a/dask/dataframe/tests/test_format.py
+++ b/dask/dataframe/tests/test_format.py
@@ -3,6 +3,8 @@ import pandas as pd
from textwrap import dedent
import dask.dataframe as dd
+import dask.array as da
+import numpy as np
from dask.dataframe.utils import PANDAS_VERSION
if PANDAS_VERSION >= '0.21.0':
@@ -487,3 +489,9 @@ def test_categorical_format():
"dtype: category\n"
"Dask Name: from_pandas, 1 tasks")
assert repr(unknown) == exp
+
+
+def test_duplicate_columns_repr():
+ arr = da.from_array(np.arange(10).reshape(5, 2), chunks=(5, 2))
+ frame = dd.from_dask_array(arr, columns=['a', 'a'])
+ repr(frame)
diff --git a/dask/tests/test_base.py b/dask/tests/test_base.py
index 6f1c0a01b..24cef408b 100644
--- a/dask/tests/test_base.py
+++ b/dask/tests/test_base.py
@@ -19,6 +19,7 @@ from dask.delayed import Delayed
from dask.utils import tmpdir, tmpfile, ignoring
from dask.utils_test import inc, dec
from dask.compatibility import long, unicode, PY2
+from dask.diagnostics import Profiler
def import_or_none(path):
@@ -868,3 +869,18 @@ def test_callable_scheduler():
assert delayed(lambda: 1)().compute(scheduler=get) == 1
assert called[0]
+
+
[email protected]('not da')
[email protected]('num_workers', range(1, 4))
[email protected]('scheduler', ['threads', 'processes'])
+def test_num_workers_config(num_workers, scheduler):
+ # Regression test for issue #4082
+ a = da.random.randint(0, 10, size=400, chunks=2)
+
+ with dask.config.set(num_workers=num_workers), Profiler() as prof:
+ a.compute(scheduler=scheduler)
+
+ workers = {i.worker_id for i in prof.results}
+
+ assert len(workers) == num_workers
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 3,
"test_score": 3
},
"num_modified_files": 3
}
|
0.19
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[complete]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
click==8.0.4
cloudpickle==2.2.1
-e git+https://github.com/dask/dask.git@d33125c5249c9e996913ffca9315b3b9ce5cc55d#egg=dask
distributed==1.28.1
HeapDict==1.0.1
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
locket==1.0.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
msgpack==1.0.5
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pandas==1.1.5
partd==1.2.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
psutil==7.0.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.1
six==1.17.0
sortedcontainers==2.4.0
tblib==1.7.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
toolz==0.12.0
tornado==6.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zict==2.1.0
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: dask
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- click==8.0.4
- cloudpickle==2.2.1
- distributed==1.28.1
- heapdict==1.0.1
- locket==1.0.0
- msgpack==1.0.5
- numpy==1.19.5
- pandas==1.1.5
- partd==1.2.0
- psutil==7.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.1
- six==1.17.0
- sortedcontainers==2.4.0
- tblib==1.7.0
- toolz==0.12.0
- tornado==6.1
- zict==2.1.0
prefix: /opt/conda/envs/dask
|
[
"dask/dataframe/tests/test_format.py::test_duplicate_columns_repr",
"dask/tests/test_base.py::test_num_workers_config[threads-1]",
"dask/tests/test_base.py::test_num_workers_config[threads-2]",
"dask/tests/test_base.py::test_num_workers_config[threads-3]",
"dask/tests/test_base.py::test_num_workers_config[processes-1]",
"dask/tests/test_base.py::test_num_workers_config[processes-2]",
"dask/tests/test_base.py::test_num_workers_config[processes-3]"
] |
[] |
[
"dask/dataframe/tests/test_format.py::test_repr",
"dask/dataframe/tests/test_format.py::test_repr_meta_mutation",
"dask/dataframe/tests/test_format.py::test_dataframe_format",
"dask/dataframe/tests/test_format.py::test_dataframe_format_with_index",
"dask/dataframe/tests/test_format.py::test_dataframe_format_unknown_divisions",
"dask/dataframe/tests/test_format.py::test_dataframe_format_long",
"dask/dataframe/tests/test_format.py::test_series_format",
"dask/dataframe/tests/test_format.py::test_series_format_long",
"dask/dataframe/tests/test_format.py::test_index_format",
"dask/dataframe/tests/test_format.py::test_categorical_format",
"dask/tests/test_base.py::test_normalize_function",
"dask/tests/test_base.py::test_tokenize",
"dask/tests/test_base.py::test_tokenize_numpy_array_consistent_on_values",
"dask/tests/test_base.py::test_tokenize_numpy_array_supports_uneven_sizes",
"dask/tests/test_base.py::test_tokenize_discontiguous_numpy_array",
"dask/tests/test_base.py::test_tokenize_numpy_datetime",
"dask/tests/test_base.py::test_tokenize_numpy_scalar",
"dask/tests/test_base.py::test_tokenize_numpy_array_on_object_dtype",
"dask/tests/test_base.py::test_tokenize_numpy_memmap",
"dask/tests/test_base.py::test_tokenize_numpy_memmap_no_filename",
"dask/tests/test_base.py::test_tokenize_numpy_ufunc_consistent",
"dask/tests/test_base.py::test_tokenize_partial_func_args_kwargs_consistent",
"dask/tests/test_base.py::test_normalize_base",
"dask/tests/test_base.py::test_tokenize_pandas",
"dask/tests/test_base.py::test_tokenize_kwargs",
"dask/tests/test_base.py::test_tokenize_same_repr",
"dask/tests/test_base.py::test_tokenize_method",
"dask/tests/test_base.py::test_tokenize_sequences",
"dask/tests/test_base.py::test_tokenize_dict",
"dask/tests/test_base.py::test_tokenize_set",
"dask/tests/test_base.py::test_tokenize_ordered_dict",
"dask/tests/test_base.py::test_tokenize_object_array_with_nans",
"dask/tests/test_base.py::test_tokenize_base_types[1]",
"dask/tests/test_base.py::test_tokenize_base_types[True]",
"dask/tests/test_base.py::test_tokenize_base_types[a0]",
"dask/tests/test_base.py::test_tokenize_base_types[a1]",
"dask/tests/test_base.py::test_tokenize_base_types[1.0]",
"dask/tests/test_base.py::test_tokenize_base_types[x5]",
"dask/tests/test_base.py::test_tokenize_base_types[x6]",
"dask/tests/test_base.py::test_tokenize_base_types[x7]",
"dask/tests/test_base.py::test_tokenize_base_types[x8]",
"dask/tests/test_base.py::test_tokenize_base_types[x9]",
"dask/tests/test_base.py::test_tokenize_base_types[None]",
"dask/tests/test_base.py::test_tokenize_base_types[str]",
"dask/tests/test_base.py::test_tokenize_base_types[int]",
"dask/tests/test_base.py::test_tokenize_numpy_matrix",
"dask/tests/test_base.py::test_is_dask_collection",
"dask/tests/test_base.py::test_unpack_collections",
"dask/tests/test_base.py::test_custom_collection",
"dask/tests/test_base.py::test_compute_no_opt",
"dask/tests/test_base.py::test_compute_array",
"dask/tests/test_base.py::test_persist_array",
"dask/tests/test_base.py::test_compute_dataframe",
"dask/tests/test_base.py::test_compute_array_dataframe",
"dask/tests/test_base.py::test_compute_array_bag",
"dask/tests/test_base.py::test_compute_with_literal",
"dask/tests/test_base.py::test_compute_nested",
"dask/tests/test_base.py::test_use_cloudpickle_to_tokenize_functions_in__main__",
"dask/tests/test_base.py::test_optimizations_keyword",
"dask/tests/test_base.py::test_optimize",
"dask/tests/test_base.py::test_optimize_nested",
"dask/tests/test_base.py::test_default_imports",
"dask/tests/test_base.py::test_persist_literals",
"dask/tests/test_base.py::test_persist_nested",
"dask/tests/test_base.py::test_persist_delayed",
"dask/tests/test_base.py::test_persist_array_bag",
"dask/tests/test_base.py::test_normalize_function_limited_size",
"dask/tests/test_base.py::test_optimize_globals",
"dask/tests/test_base.py::test_optimize_None",
"dask/tests/test_base.py::test_scheduler_keyword",
"dask/tests/test_base.py::test_warn_get_keyword",
"dask/tests/test_base.py::test_get_scheduler",
"dask/tests/test_base.py::test_callable_scheduler"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,226 |
[
"dask/dataframe/core.py",
"dask/multiprocessing.py",
"dask/threaded.py"
] |
[
"dask/dataframe/core.py",
"dask/multiprocessing.py",
"dask/threaded.py"
] |
|
PlasmaPy__PlasmaPy-561
|
15a77592b6b5ba8ea3ed8b1dadd3e4e3f71bc631
|
2018-10-12 08:26:58
|
24113f1659d809930288374f6b1f95dc573aff47
|
codecov[bot]: # [Codecov](https://codecov.io/gh/PlasmaPy/PlasmaPy/pull/561?src=pr&el=h1) Report
> Merging [#561](https://codecov.io/gh/PlasmaPy/PlasmaPy/pull/561?src=pr&el=desc) into [master](https://codecov.io/gh/PlasmaPy/PlasmaPy/commit/ec90f19064721cfae35edd63c2330c26d9bb46f7?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/PlasmaPy/PlasmaPy/pull/561?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #561 +/- ##
==========================================
- Coverage 97.44% 97.43% -0.01%
==========================================
Files 46 46
Lines 3835 3827 -8
==========================================
- Hits 3737 3729 -8
Misses 98 98
```
| [Impacted Files](https://codecov.io/gh/PlasmaPy/PlasmaPy/pull/561?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [plasmapy/\_\_init\_\_.py](https://codecov.io/gh/PlasmaPy/PlasmaPy/pull/561/diff?src=pr&el=tree#diff-cGxhc21hcHkvX19pbml0X18ucHk=) | `56.25% <ø> (-14.59%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/PlasmaPy/PlasmaPy/pull/561?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/PlasmaPy/PlasmaPy/pull/561?src=pr&el=footer). Last update [ec90f19...9e14346](https://codecov.io/gh/PlasmaPy/PlasmaPy/pull/561?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
dstansby: I think it might be most useful to explicitly specify optional dependencies for each sub-module of plasmapy, instead of for certain functionality. That way `pip install plasmapy[submodule]` is a nice way of doing "I want to use this sub-module, this command will install all the dependencies I need".
StanczakDominik: Ooooh. That's a really neat idea!
StanczakDominik: Okay, now this seems rather silly. Apparently, some of our .rst documentation files were not getting checked for doctests (I have no idea what caused them to get tested now). The first of these is not a big deal - a nuclear reaction syntax example.
But the second is `plasmapy.test()`.
In a doctest.
And this is getting launched now.
StanczakDominik: I did forget to update the docs to account for @dstansby 's idea, so that's one thing!
StanczakDominik: All in all, I'm not sure the split of optional dependencies that we have right now (as per David's suggestion) is optimal. I have no idea how to describe this in docs. What we might need to do is reorganize our subpackages again:
* merge `math`, `physics` and `transport` into, maybe, `theory` (this would then involve lmfit and mpmath)
* keep diagnostics depending on `matplotlib` (maybe even throw in an optional pandas interface because if you're working with experimental data you most likely want something compatible with dataframes)
* rename `classes` somehow because that name is completely out of whack right now (there's a bunch of classes in each module now). I'm not sure what a good name would be.
* remove unused `io` and `visualization` subpackages, maybe even get rid of `plasmapy.constants` because they're wrappers to astropy anyway.
But that's probably out of scope for this PR. For optional dependency name sets, I'm kind of pondering going back to what we had before 414c and leaving the above changes for a future PR.
Thoughts?
|
diff --git a/.coveragerc b/.coveragerc
index 61ea1967..332aba95 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -8,6 +8,5 @@ omit =
plasmapy/version.py
exclude_lines =
coverage: ignore
- def __repr__
ImportError
ModuleNotFoundError
diff --git a/docs/install.rst b/docs/install.rst
index 7cd479bf..0bcd2291 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -22,12 +22,18 @@ installation:
- `NumPy <http://www.numpy.org/>`_ 1.13 or newer
- `SciPy <https://www.scipy.org/>`_ 0.19 or newer
- `Astropy <http://www.astropy.org/>`_ 2.0 or newer
-- `matplotlib <https://matplotlib.org/>`_ 2.0 or newer
- `Cython <http://cython.org/>`_ 0.27.2 or newer
+- `colorama <https://pypi.org/project/colorama/>`_ 0.3 or newer
+
+PlasmaPy also uses the following optional dependencies:
+
+- `matplotlib <https://matplotlib.org/>`_ 2.0 or newer
- `h5py <https://www.h5py.org/>`_ 2.8 or newer
- `mpmath <http://mpmath.org/>`_ 1.0 or newer
- `lmfit <https://lmfit.github.io/lmfit-py/>`_ 0.9.7 or newer
-- `colorama <https://pypi.org/project/colorama/>`_ 0.3 or newer
+
+PlasmaPy can be installed with all of the optional dependencies via
+`pip install plasmapy[optional]`.
.. _create-conda-env:
@@ -71,12 +77,20 @@ Installation with pip
---------------------
To install the most recent release of PlasmaPy `on PyPI`_ with `pip
-<https://pip.pypa.io/en/stable/>`_ into an existing Python environment,
-run
+<https://pip.pypa.io/en/stable/>`_ into an existing Python environment
+alongside all optional dependencies, run
+
+.. code:: bash
+
+ pip install plasmapy[optional]
+
+To install a minimal set of dependencies (which does not guarantee that
+everything will run and may result in `ImportError`s, skip `[all]` and run
+simply
.. code:: bash
- pip install plasmapy
+ pip install plasmapy
.. _install-conda:
@@ -85,6 +99,8 @@ Installation with conda
We’re not on conda just yet, but we’re working on it!
+Conda installs all dependencies by default.
+
Building and installing from source code
========================================
diff --git a/plasmapy/__init__.py b/plasmapy/__init__.py
index be054fa4..23eabcc3 100644
--- a/plasmapy/__init__.py
+++ b/plasmapy/__init__.py
@@ -23,16 +23,6 @@ class UnsupportedPythonError(Exception):
if sys.version_info < tuple((int(val) for val in "3.6".split('.'))):
raise UnsupportedPythonError("plasmapy does not support Python < {}".format(3.6))
-if not _ASTROPY_SETUP_:
- # For egg_info test builds to pass, put package imports here.
- from . import atomic
- from . import classes
- from . import constants
- from . import diagnostics
- from . import mathematics
- from . import physics
- from . import utils
-
def online_help(query):
"""
Search the online PlasmaPy documentation for the given query from plasmapy.org
diff --git a/plasmapy/atomic/__init__.py b/plasmapy/atomic/__init__.py
index f9fc6d7a..872e7810 100644
--- a/plasmapy/atomic/__init__.py
+++ b/plasmapy/atomic/__init__.py
@@ -37,6 +37,11 @@
nuclear_reaction_energy,
)
+from .ionization_state import IonizationState, State
+from .ionization_states import IonizationStates
+
+# Create instances of the most commonly used particles
+
proton = Particle("p+")
electron = Particle("e-")
neutron = Particle("n")
diff --git a/plasmapy/atomic/atomic.py b/plasmapy/atomic/atomic.py
index 47c54f19..c89ce4fa 100644
--- a/plasmapy/atomic/atomic.py
+++ b/plasmapy/atomic/atomic.py
@@ -7,6 +7,7 @@
Any,
)
+import numpy as np
import astropy.constants as const
import astropy.units as u
diff --git a/plasmapy/atomic/ionization_state.py b/plasmapy/atomic/ionization_state.py
new file mode 100644
index 00000000..ae833765
--- /dev/null
+++ b/plasmapy/atomic/ionization_state.py
@@ -0,0 +1,665 @@
+"""
+Objects for storing ionization state data for a single element or for
+a single ionization level.
+"""
+
+from numbers import Integral, Real
+from typing import Union, List, Optional
+import collections
+import warnings
+
+import numpy as np
+import astropy.units as u
+
+from plasmapy.atomic import Particle, particle_input
+from plasmapy.utils import AtomicError, ChargeError, InvalidParticleError, check_quantity
+
+__all__ = ["IonizationState", "State"]
+
+
+_number_density_errmsg = (
+ "Number densities must be Quantity objects with units of inverse "
+ "volume."
+)
+
+# TODO: Change `State` into a class with validations for all of the
+# TODO: attributes.
+
+State = collections.namedtuple(
+ 'State', [
+ 'integer_charge',
+ 'ionic_fraction',
+ 'ionic_symbol',
+ 'number_density',
+ ])
+
+
+class IonizationState:
+ """
+ Representation of the ionization state distribution of a single
+ element or isotope.
+
+ Parameters
+ ----------
+ particle: str, integer, or ~plasmapy.atomic.Particle
+ A `str` or `~plasmapy.atomic.Particle` instance representing
+ an element or isotope, or an integer representing the atomic
+ number of an element.
+
+ ionic_fractions: ~numpy.ndarray, list, tuple, or ~astropy.units.Quantity; optional
+ The ionization fractions of an element, where the indices
+ correspond to integer charge. This argument should contain the
+ atomic number plus one items, and must sum to one within an
+ absolute tolerance of ``tol`` if dimensionless. Alternatively,
+ this argument may be a `~astropy.units.Quantity` that represents
+ the number densities of each neutral/ion.
+
+ T_e: ~astropy.units.Quantity, keyword-only, optional
+ The electron temperature or thermal energy per particle.
+
+ n_elem: ~astropy.units.Quantity, keyword-only, optional
+ The number density of the element, including neutrals and all
+ ions.
+
+ tol: float or integer, keyword-only, optional
+ The absolute tolerance used by `~numpy.isclose` when testing
+ normalizations and making comparisons. Defaults to ``1e-15``.
+
+ Raises
+ ------
+ ~plasmapy.utils.AtomicError
+ If the ionic fractions are not normalized or contain invalid
+ values, or if number density information is provided through
+ both ``ionic_fractions`` and ``n_elem``.
+
+ ~plasmapy.utils.InvalidParticleError
+ If the particle is invalid.
+
+ Examples
+ --------
+ >>> states = IonizationState('H', [0.6, 0.4], n_elem=1*u.cm**-3, T_e=11000*u.K)
+ >>> states.ionic_fractions[0] # fraction of hydrogen that is neutral
+ 0.6
+ >>> states.ionic_fractions[1] # fraction of hydrogen that is ionized
+ 0.4
+ >>> states.n_e # electron number density
+ <Quantity 400000. 1 / m3>
+ >>> states.n_elem # element number density
+ <Quantity 1000000. 1 / m3>
+
+ Notes
+ -----
+ Calculation of collisional ionization equilibrium has not yet been
+ implemented.
+
+ """
+
+ # TODO: Allow this class to (optionally?) handle negatively charged
+ # TODO: ions. There are instances where singly negatively charged
+ # TODO: ions are important in astrophysical plasmas, such as H- in
+ # TODO: the atmospheres of relatively cool stars. There may be some
+ # TODO: rare situations where doubly negatively charged ions show up
+ # TODO: too, but triply negatively charged ions are very unlikely.
+
+ # TODO: Add in functionality to find equilibrium ionization states.
+
+ @check_quantity(
+ T_e={"units": u.K},
+ n_elem={"units": u.m ** -3},
+ )
+ @particle_input(require='element', exclude='ion')
+ def __init__(self,
+ particle: Particle,
+ ionic_fractions=None,
+ *,
+ T_e: u.K = np.nan * u.K,
+ kappa: Real = np.inf,
+ n_elem: u.m ** -3 = np.nan * u.m ** -3,
+ tol: Union[float, int] = 1e-15):
+ """Initialize an `~plasmapy.atomic.IonizationState` instance."""
+
+ self._particle_instance = particle
+
+ try:
+ self.tol = tol
+ self.T_e = T_e
+ self.kappa = kappa
+
+ if not np.isnan(n_elem) and isinstance(ionic_fractions, u.Quantity) and \
+ ionic_fractions.si.unit == u.m ** -3:
+ raise AtomicError(
+ "Cannot simultaneously provide number density "
+ "through both n_elem and ionic_fractions.")
+
+ self.n_elem = n_elem
+ self.ionic_fractions = ionic_fractions
+
+ if ionic_fractions is None and not np.isnan(self.T_e):
+ warnings.warn(
+ "Collisional ionization equilibration has not yet "
+ "been implemented in IonizationState; cannot set "
+ "ionic fractions.")
+
+ except Exception as exc:
+ raise AtomicError(
+ f"Unable to create IonizationState instance for "
+ f"{particle.particle}.") from exc
+
+ def __str__(self) -> str:
+ return f"<IonizationState instance for {self.base_particle}>"
+
+ def __repr__(self) -> str:
+ return self.__str__()
+
+ def __getitem__(self, value) -> State:
+ """Return information for a single ionization level."""
+ if isinstance(value, slice):
+ raise TypeError("IonizationState instances cannot be sliced.")
+
+ if isinstance(value, Integral) and 0 <= value <= self.atomic_number:
+ result = State(
+ value,
+ self.ionic_fractions[value],
+ self.ionic_symbols[value],
+ self.number_densities[value],
+ )
+ else:
+ if not isinstance(value, Particle):
+ try:
+ value = Particle(value)
+ except InvalidParticleError as exc:
+ raise InvalidParticleError(
+ f"{value} is not a valid integer charge or "
+ f"particle.") from exc
+
+ same_element = value.element == self.element
+ same_isotope = value.isotope == self.isotope
+ has_charge_info = value.is_category(any_of=["charged", "uncharged"])
+
+ if same_element and same_isotope and has_charge_info:
+ Z = value.integer_charge
+ result = State(
+ Z,
+ self.ionic_fractions[Z],
+ self.ionic_symbols[Z],
+ self.number_densities[Z],
+ )
+ else:
+ if not same_element or not same_isotope:
+ raise AtomicError("Inconsistent element or isotope.")
+ elif not has_charge_info:
+ raise ChargeError("No integer charge provided.")
+ return result
+
+ def __setitem__(self, key, value):
+ raise NotImplementedError(
+ "Item assignment of an IonizationState instance is not "
+ "allowed because the ionic fractions for different "
+ "ionization levels must be set simultaneously due to the "
+ "normalization constraint.")
+
+ def __iter__(self):
+ """Initialize an instance prior to iteration."""
+ self._charge_index = 0
+ return self
+
+ def __next__(self):
+ """
+ Return a `~plasmapy.atomic.State` instance that contains
+ information about a particular ionization level.
+ """
+ if self._charge_index <= self.atomic_number:
+ result = State(
+ self._charge_index,
+ self._ionic_fractions[self._charge_index],
+ self.ionic_symbols[self._charge_index],
+ self.number_densities[self._charge_index],
+ )
+ self._charge_index += 1
+ return result
+ else:
+ del self._charge_index
+ raise StopIteration
+
+ def __eq__(self, other):
+ """
+ Return `True` if the ionic fractions, number density scaling
+ factor (if set), and electron temperature (if set) are all
+ equal, and `False` otherwise.
+
+ Raises
+ ------
+ TypeError
+ If ``other`` is not an `~plasmapy.atomic.IonizationState`
+ instance.
+
+ AtomicError
+ If ``other`` corresponds to a different element or isotope.
+
+ Examples
+ --------
+ >>> IonizationState('H', [1, 0], tol=1e-6) == IonizationState('H', [1, 1e-6], tol=1e-6)
+ True
+ >>> IonizationState('H', [1, 0], tol=1e-8) == IonizationState('H', [1, 1e-6], tol=1e-5)
+ False
+
+ """
+ if not isinstance(other, IonizationState):
+ raise TypeError(
+ "An instance of the IonizationState class may only be "
+ "compared with another IonizationState instance.")
+
+ same_element = self.element == other.element
+ same_isotope = self.isotope == other.isotope
+
+ if not same_element or not same_isotope:
+ raise AtomicError(
+ "An instance of the IonizationState class may only be "
+ "compared with another IonizationState instance if "
+ "both correspond to the same element and/or isotope.")
+
+ # Use the tighter of the two tolerances. For thermodynamic
+ # quantities, use it as a relative tolerance because the values
+ # may substantially depart from order unity.
+
+ min_tol = np.min([self.tol, other.tol])
+
+ same_T_e = np.isnan(self.T_e) and np.isnan(other.T_e) or \
+ u.allclose(self.T_e, other.T_e, rtol=min_tol*u.K, atol=0*u.K)
+
+ same_n_elem = np.isnan(self.n_elem) and np.isnan(other.n_elem) or \
+ u.allclose(self.n_elem, other.n_elem, rtol=min_tol*u.m**-3, atol=0*u.m**-3)
+
+ # For the next line, recall that np.nan == np.nan is False (sigh)
+
+ same_fractions = np.any([
+ np.allclose(self.ionic_fractions, other.ionic_fractions, rtol=0, atol=min_tol),
+ np.all(np.isnan(self.ionic_fractions)) and np.all(np.isnan(other.ionic_fractions)),
+ ])
+
+ return np.all([same_element, same_isotope, same_T_e, same_n_elem, same_fractions])
+
+ @property
+ def ionic_fractions(self) -> np.ndarray:
+ """
+ Return the ionic fractions, where the index corresponds to
+ the integer charge.
+
+ Examples
+ --------
+ >>> hydrogen_states = IonizationState('H', [0.9, 0.1])
+ >>> hydrogen_states.ionic_fractions
+ array([0.9, 0.1])
+
+ """
+ return self._ionic_fractions
+
+ @ionic_fractions.setter
+ def ionic_fractions(self, fractions):
+ """
+ Set the ionic fractions, while checking that the new values are
+ valid and normalized to one.
+ """
+ if fractions is None or np.all(np.isnan(fractions)):
+ self._ionic_fractions = np.full(self.atomic_number + 1, np.nan, dtype=np.float64)
+ return
+
+ try:
+ if np.min(fractions) < 0:
+ raise AtomicError("Cannot have negative ionic fractions.")
+
+ if len(fractions) != self.atomic_number + 1:
+ raise AtomicError(
+ "The length of ionic_fractions must be "
+ f"{self.atomic_number + 1}.")
+
+ if isinstance(fractions, u.Quantity):
+ fractions = fractions.to(u.m ** -3)
+ self.n_elem = np.sum(fractions)
+ self._ionic_fractions = np.array(fractions/self.n_elem)
+ else:
+ fractions = np.array(fractions, dtype=np.float64)
+ sum_of_fractions = np.sum(fractions)
+ all_nans = np.all(np.isnan(fractions))
+
+ if not all_nans:
+ if np.any(fractions < 0) or np.any(fractions > 1):
+ raise AtomicError("Ionic fractions must be between 0 and 1.")
+
+ if not np.isclose(sum_of_fractions, 1, rtol=0, atol=self.tol):
+ raise AtomicError("Ionic fractions must sum to one.")
+
+ self._ionic_fractions = fractions
+
+ except Exception as exc:
+ raise AtomicError(f"Unable to set ionic fractions of {self.element} "
+ f"to {fractions}.") from exc
+
+ def _is_normalized(self, tol: Optional[Real] = None) -> bool:
+ """
+ Return `True` if the sum of the ionization fractions is equal to
+ one within the allowed tolerance, and `False` otherwise.
+ """
+ tol = tol if tol is not None else self.tol
+ if not isinstance(tol, Real):
+ raise TypeError("tol must be an int or float.")
+ if not 0 <= tol < 1:
+ raise ValueError("Need 0 <= tol < 1.")
+ total = np.sum(self._ionic_fractions)
+ return np.isclose(total, 1, atol=tol, rtol=0)
+
+ def normalize(self) -> None:
+ """
+ Normalize the ionization state distribution (if set) so that the
+ sum becomes equal to one.
+ """
+ self._ionic_fractions = self._ionic_fractions / np.sum(self._ionic_fractions)
+
+ @property
+ def equil_ionic_fractions(self, T_e: u.K = None):
+ """
+ Return the equilibrium ionic fractions for temperature ``T_e``
+ or the temperature set in the IonizationState instance. Not
+ implemented.
+ """
+ raise NotImplementedError
+
+ @u.quantity_input(equivalencies=u.temperature_energy())
+ def equilibrate(self, T_e: u.K = np.nan * u.K):
+ """
+ Set the ionic fractions to collisional ionization equilibrium
+ for temperature ``T_e``. Not implemented.
+ """
+ # self.ionic_fractions = self.equil_ionic_fractions
+ raise NotImplementedError
+
+ @property
+ @u.quantity_input
+ def n_e(self) -> u.m ** -3:
+ """
+ Return the electron number density assuming a single species
+ plasma.
+ """
+ return np.sum(self._n_elem * self.ionic_fractions * self.integer_charges)
+
+ @property
+ @u.quantity_input
+ def n_elem(self) -> u.m ** -3:
+ """Return the total number density of neutrals and all ions."""
+ return self._n_elem.to(u.m ** -3)
+
+ @n_elem.setter
+ @u.quantity_input
+ def n_elem(self, value: u.m ** -3):
+ """Set the number density of neutrals and all ions."""
+ if value < 0 * u.m ** -3:
+ raise AtomicError
+ if 0 * u.m ** -3 < value <= np.inf * u.m ** -3:
+ self._n_elem = value.to(u.m ** -3)
+ elif np.isnan(value):
+ self._n_elem = np.nan * u.m ** -3
+
+ @property
+ @u.quantity_input
+ def number_densities(self) -> u.m ** -3:
+ """Return the number densities for each state."""
+ try:
+ return (self.n_elem * self.ionic_fractions).to(u.m ** -3)
+ except Exception:
+ return np.full(self.atomic_number + 1, np.nan) * u.m ** -3
+
+ @number_densities.setter
+ @u.quantity_input
+ def number_densities(self, value: u.m ** -3):
+ """Set the number densities for each state."""
+ if np.any(value.value < 0):
+ raise AtomicError("Number densities cannot be negative.")
+ if len(value) != self.atomic_number + 1:
+ raise AtomicError(
+ f"Incorrect number of charge states for "
+ f"{self.base_particle}")
+ value = value.to(u.m ** -3)
+
+ self._n_elem = value.sum()
+ self._ionic_fractions = value / self._n_elem
+
+ @property
+ @u.quantity_input(equivalencies=u.temperature_energy())
+ def T_e(self) -> u.K:
+ """Return the electron temperature."""
+ if self._T_e is None:
+ raise AtomicError("No electron temperature has been specified.")
+ return self._T_e.to(u.K, equivalencies=u.temperature_energy())
+
+ @T_e.setter
+ @u.quantity_input(equivalencies=u.temperature_energy())
+ def T_e(self, value: u.K):
+ """Set the electron temperature."""
+ try:
+ value = value.to(u.K, equivalencies=u.temperature_energy())
+ except (AttributeError, u.UnitsError, u.UnitConversionError):
+ raise AtomicError("Invalid temperature.") from None
+ else:
+ if value < 0 * u.K:
+ raise AtomicError("T_e cannot be negative.")
+ self._T_e = value
+
+ @property
+ def kappa(self) -> np.real:
+ """
+ Return the kappa parameter for a kappa distribution function
+ for electrons.
+
+ The value of ``kappa`` must be greater than ``1.5`` in order to
+ have a valid distribution function. If ``kappa`` equals
+ `~numpy.inf`, then the distribution function reduces to a
+ Maxwellian.
+
+ """
+ return self._kappa
+
+ @kappa.setter
+ def kappa(self, value: Real):
+ """
+ Set the kappa parameter for a kappa distribution function for
+ electrons. The value must be between ``1.5`` and `~numpy.inf`.
+ """
+ kappa_errmsg = "kappa must be a real number greater than 1.5"
+ if not isinstance(value, Real):
+ raise TypeError(kappa_errmsg)
+ if value <= 1.5:
+ raise ValueError(kappa_errmsg)
+ self._kappa = np.real(value)
+
+ @property
+ def element(self) -> str:
+ """Return the atomic symbol of the element."""
+ return self._particle_instance.element
+
+ @property
+ def isotope(self) -> Optional[str]:
+ """
+ Return the isotope symbol for an isotope, or `None` if the
+ particle is not an isotope.
+ """
+ return self._particle_instance.isotope
+
+ @property
+ def base_particle(self) -> str:
+ """Return the symbol of the element or isotope."""
+ return self.isotope if self.isotope else self.element
+
+ @property
+ def atomic_number(self) -> int:
+ """Return the atomic number of the element."""
+ return self._particle_instance.atomic_number
+
+ @property
+ def _particle_instances(self) -> List[Particle]:
+ """
+ Return a list of the `~plasmapy.atomic.Particle` class
+ instances corresponding to each ion.
+ """
+ return [
+ Particle(self._particle_instance.particle, Z=i)
+ for i in range(self.atomic_number + 1)
+ ]
+
+ @property
+ def ionic_symbols(self) -> List[str]:
+ """Return the ionic symbols for all charge states."""
+ return [particle.ionic_symbol for particle in self._particle_instances]
+
+ @property
+ def integer_charges(self) -> np.ndarray:
+ """Return an array with the integer charges."""
+ return np.arange(0, self.atomic_number + 1, dtype=np.int)
+
+ @property
+ def Z_mean(self) -> np.float64:
+ """Return the mean integer charge"""
+ if np.nan in self.ionic_fractions:
+ raise ChargeError(
+ "Z_mean cannot be found because no ionic fraction "
+ f"information is available for {self.base_particle}.")
+ return np.sum(self.ionic_fractions * np.arange(self.atomic_number + 1))
+
+ @property
+ def Z_rms(self) -> np.float64:
+ """Return the root mean square integer charge."""
+ return np.sqrt(np.sum(self.ionic_fractions * np.arange(self.atomic_number + 1) ** 2))
+
+ @property
+ def Z_most_abundant(self) -> List[Integral]:
+ """
+ Return a `list` of the integer charges with the highest ionic
+ fractions.
+
+ Examples
+ --------
+ >>> He = IonizationState('He', [0.2, 0.5, 0.3])
+ >>> He.Z_most_abundant
+ [1]
+ >>> Li = IonizationState('Li', [0.4, 0.4, 0.2, 0.0])
+ >>> Li.Z_most_abundant
+ [0, 1]
+
+ """
+ if np.any(np.isnan(self.ionic_fractions)):
+ raise AtomicError(
+ f"Cannot find most abundant ion of {self.base_particle} "
+ f"because the ionic fractions have not been defined.")
+
+ return np.flatnonzero(
+ self.ionic_fractions == self.ionic_fractions.max()
+ ).tolist()
+
+ @property
+ def tol(self) -> Real:
+ """Return the absolute tolerance for comparisons."""
+ return self._tol
+
+ @tol.setter
+ def tol(self, atol: Real):
+ """Set the absolute tolerance for comparisons."""
+ if not isinstance(atol, Real):
+ raise TypeError("The attribute tol must be a real number.")
+ if 0 <= atol < 1:
+ self._tol = atol
+ else:
+ raise ValueError("Need 0 <= tol < 1.")
+
+
+ def _get_states_info(self, minimum_ionic_fraction=0.01) -> List[str]:
+ """
+ Return a `list` containing the ion symbol, ionic fraction, and
+ (if available) the number density for that ion.
+ """
+
+ states_info = []
+
+ for state in self:
+ if state.ionic_fraction > minimum_ionic_fraction:
+ state_info = ""
+ symbol = state.ionic_symbol
+ if state.integer_charge < 10:
+ symbol = symbol[:-2] + ' ' + symbol[-2:]
+ fraction = "{:.3f}".format(state.ionic_fraction)
+
+ state_info += f'{symbol}: {fraction}'
+
+ if np.isfinite(self.n_elem):
+ value = "{:.2e}".format(state.number_density.si.value)
+ state_info += f" n_i = {value} m**-3"
+
+ states_info.append(state_info)
+
+ return states_info
+
+ def info(self, minimum_ionic_fraction: Real = 0.01) -> None:
+ """
+ Print quicklook information for an
+ `~plasmapy.atomic.IonizationState` instance.
+
+ Parameters
+ ----------
+ minimum_ionic_fraction: Real
+ If the ionic fraction for a particular ionization state is
+ below this level, then information for it will not be
+ printed. Defaults to 0.01.
+
+ Example
+ -------
+ >>> He_states = IonizationState(
+ ... 'He',
+ ... [0.941, 0.058, 0.001],
+ ... T_e = 5.34 * u.K,
+ ... kappa = 4.05,
+ ... n_elem = 5.51e19 * u.m ** -3,
+ ... )
+ >>> He_states.info()
+ IonizationState instance for He with Z_mean = 0.06
+ ----------------------------------------------------------------
+ He 0+: 0.941 n_i = 5.18e+19 m**-3
+ He 1+: 0.058 n_i = 3.20e+18 m**-3
+ ----------------------------------------------------------------
+ n_elem = 5.51e+19 m**-3
+ n_e = 3.31e+18 m**-3
+ T_e = 5.34e+00 K
+ kappa = 4.05
+ ----------------------------------------------------------------
+
+ """
+ separator_line = [64 * '-']
+
+ scientific = "{:.2e}"
+ floaty = "{:.2f}"
+
+ n_elem = scientific.format(self.n_elem.value)
+ n_e = scientific.format(self.n_e.value)
+ T_e = scientific.format(self.T_e.value)
+ kappa = floaty.format(self.kappa)
+ Z_mean = floaty.format(self.Z_mean)
+
+ output = [f"IonizationState instance for {self.base_particle} with Z_mean = {Z_mean}"]
+ attributes = []
+
+ if not np.all(np.isnan(self.ionic_fractions)):
+ output += separator_line
+ output += self._get_states_info(minimum_ionic_fraction)
+ output += separator_line
+
+ if not np.isnan(self.n_elem):
+ attributes.append(f"n_elem = {n_elem} m**-3")
+ attributes.append(f"n_e = {n_e} m**-3")
+ if not np.isnan(self.T_e):
+ attributes.append(f"T_e = {T_e} K")
+ if np.isfinite(self.kappa):
+ attributes.append(f"kappa = {kappa}")
+
+ if attributes:
+ attributes += separator_line
+ output += attributes
+
+ for line in output:
+ print(line)
diff --git a/plasmapy/atomic/ionization_states.py b/plasmapy/atomic/ionization_states.py
new file mode 100644
index 00000000..a414c559
--- /dev/null
+++ b/plasmapy/atomic/ionization_states.py
@@ -0,0 +1,918 @@
+"""
+A class for storing ionization state data for multiple elements or
+isotopes.
+"""
+
+from numbers import Real, Integral
+from typing import Dict, List, Optional, Tuple, Union
+import collections
+
+import numpy as np
+import astropy.units as u
+
+from plasmapy.atomic import atomic_number, Particle, particle_symbol, IonizationState, State
+from plasmapy.utils import AtomicError, ChargeError, InvalidParticleError, check_quantity
+
+__all__ = ["IonizationStates"]
+
+
+class IonizationStates:
+ """
+ Describe the ionization state distributions of multiple elements
+ or isotopes.
+
+ Parameters
+ ----------
+ inputs: `list`, `tuple`, or `dict`
+ A `list` or `tuple` of elements or isotopes (if ``T_e`` is
+ provided); a `list` of `~plasmapy.atomic.IonizationState`
+ instances; a `dict` with elements or isotopes as keys and
+ a `~numpy.ndarray` of ionic fractions as the values; or a `dict`
+ with elements or isotopes as keys and `~astropy.units.Quantity`
+ instances with units of number density.
+
+ abundances: `dict` or `str`, optional, keyword-only
+ The relative abundances of each element in the plasma.
+
+ log_abundances: `dict`, optional, keyword-only
+ The base 10 logarithm of the relative abundances of each element
+ in the plasma.
+
+ n: ~astropy.units.Quantity, optional, keyword-only
+ The number density scaling factor. The number density of an
+ element will be the product of its abundance and ``n``.
+
+ T_e: `~astropy.units.Quantity`, optional, keyword-only
+ The electron temperature in units of temperature or thermal
+ energy per base_particle.
+
+ kappa: float, optional, keyword-only
+ The value of kappa for a kappa distribution function.
+
+ tol: float or integer, keyword-only, optional
+ The absolute tolerance used by `~numpy.isclose` when testing
+ normalizations and making comparisons. Defaults to ``1e-15``.
+
+ equilibrate: `bool`, optional, keyword-only
+ Set the ionic fractions to the estimated collisional ionization
+ equilibrium. Not implemented.
+
+ Raises
+ ------
+ AtomicError
+ If `~plasmapy.atomic.IonizationStates` cannot be instantiated.
+
+ Examples
+ --------
+ >>> from astropy import units as u
+ >>> from plasmapy.atomic import IonizationStates
+ >>> states = IonizationStates(
+ ... {'H': [0.5, 0.5], 'He': [0.95, 0.05, 0]},
+ ... T_e = 1.2e4 * u.K,
+ ... n = 1e15 * u.m ** -3,
+ ... abundances = {'H': 1, 'He': 0.08},
+ ... )
+ >>> states.ionic_fractions
+ {'H': array([0.5, 0.5]), 'He': array([0.95, 0.05, 0. ])}
+
+ The number densities are given by the ionic fractions multiplied by
+ the abundance and the
+
+ >>> states.number_densities['H']
+ <Quantity [5.e+14, 5.e+14] 1 / m3>
+ >>> states['He'] = [0.4, 0.59, 0.01]
+
+ To change the ionic fractions for a single element, use item
+ assignment.
+
+ >>> states = IonizationStates(['H', 'He'])
+ >>> states['H'] = [0.1, 0.9]
+
+ Item assignment will also work if you supply number densities.
+
+ >>> states['He'] = [0.4, 0.6, 0.0] * u.m ** -3
+ >>> states.ionic_fractions['He']
+ array([0.4, 0.6, 0. ])
+ >>> states.number_densities['He']
+ <Quantity [0.4, 0.6, 0. ] 1 / m3>
+
+ Notes
+ -----
+ No more than one of ``abundances``, ``log_abundances``, and
+ ``number_densities`` may be specified.
+
+ If the value provided during item assignment is a
+ `~astropy.units.Quantity` with units of number density that retains
+ the total element density, then the ionic fractions will be set
+ proportionately.
+
+ When making comparisons between `~plasmapy.atomic.IonizationStates`
+ instances, `~numpy.nan` values are treated as equal. Equality tests
+ are performed to within a tolerance of ``tol``.
+
+ Collisional ionization equilibrium is based on atomic data that
+ has relative errors of order 20%.
+
+ """
+
+ # TODO: The docstring above needs to be expanded and revised to
+ # TODO: better describe what the magic methods do.
+
+ @check_quantity(
+ T_e={"units": u.K},
+ n={"units": u.m ** -3},
+ )
+ def __init__(
+ self,
+ inputs: Union[Dict[str, np.ndarray], List, Tuple],
+ *,
+ T_e: u.K = np.nan * u.K,
+ equilibrate: Optional[bool] = None,
+ abundances: Optional[Dict[str, Real]] = None,
+ log_abundances: Optional[Dict[str, Real]] = None,
+ n: u.m ** -3 = np.nan * u.m ** -3,
+ tol: Real = 1e-15,
+ kappa: Real = np.inf):
+
+ abundances_provided = abundances is not None or log_abundances is not None
+
+ set_abundances = True
+ if isinstance(inputs, dict):
+ all_quantities = np.all([isinstance(fracs, u.Quantity) for fracs in inputs.values()])
+ if all_quantities:
+ right_units = np.all([fracs[0].si.unit == u.m ** -3 for fracs in inputs.values()])
+ if not right_units:
+ raise AtomicError("Units must be inverse volume for number densities.")
+ if abundances_provided:
+ raise AtomicError(
+ "Abundances cannot be provided if inputs "
+ "provides number density information.")
+ set_abundances = False
+
+ try:
+ self._pars = collections.defaultdict(lambda: None)
+ self.T_e = T_e
+ self.n = n
+ self.tol = tol
+ self.ionic_fractions = inputs
+ if set_abundances:
+ self.abundances = abundances
+ self.log_abundances = log_abundances
+ self.kappa = kappa
+ except Exception as exc:
+ raise AtomicError("Unable to create IonizationStates instance.") from exc
+
+ if equilibrate:
+ self.equilibrate() # for now, this raises a NotImplementedError
+
+ def __str__(self) -> str:
+ return f"<IonizationStates for: {', '.join(self.base_particles)}>"
+
+ def __repr__(self) -> str:
+ return self.__str__()
+
+ def __getitem__(self, *values) -> IonizationState:
+
+ errmsg = f"Invalid indexing for IonizationStates instance: {values[0]}"
+
+ one_input = not isinstance(values[0], tuple)
+ two_inputs = len(values[0]) == 2
+
+ if not one_input and not two_inputs:
+ raise IndexError(errmsg)
+
+ try:
+ arg1 = values[0] if one_input else values[0][0]
+ int_charge = None if one_input else values[0][1]
+ particle = arg1 if arg1 in self.base_particles else particle_symbol(arg1)
+
+ if int_charge is None:
+ return IonizationState(
+ particle=particle,
+ ionic_fractions=self.ionic_fractions[particle],
+ T_e=self._pars["T_e"],
+ n_elem=np.sum(self.number_densities[particle]),
+ tol=self.tol,
+ )
+ else:
+ if not isinstance(int_charge, Integral):
+ raise TypeError(f"{int_charge} is not a valid charge for {base_particle}.")
+ elif not 0 <= int_charge <= atomic_number(particle):
+ raise ChargeError(f"{int_charge} is not a valid charge for {base_particle}.")
+ return State(
+ integer_charge=int_charge,
+ ionic_fraction=self.ionic_fractions[particle][int_charge],
+ ionic_symbol=particle_symbol(particle, Z=int_charge),
+ number_density=self.number_densities[particle][int_charge]
+ )
+ except Exception as exc:
+ raise IndexError(errmsg) from exc
+
+ def __setitem__(self, key, value):
+
+ errmsg = (
+ f"Cannot set item for this IonizationStates instance for "
+ f"key = {repr(key)} and value = {repr(value)}")
+
+ try:
+ particle = particle_symbol(key)
+ self.ionic_fractions[key]
+ except (AtomicError, TypeError):
+ raise KeyError(
+ f"{errmsg} because {repr(key)} is an invalid particle."
+ ) from None
+ except KeyError:
+ raise KeyError(
+ f"{errmsg} because {repr(key)} is not one of the base "
+ f"particles whose ionization state is being kept track "
+ f"of.") from None
+
+ if isinstance(value, u.Quantity) and value.unit != u.dimensionless_unscaled:
+ try:
+ new_number_densities = value.to(u.m ** -3)
+ except u.UnitConversionError:
+ raise ValueError(
+ f"{errmsg} because the units of value do not "
+ f"correspond to a number density.") from None
+
+ old_n_elem = np.sum(self.number_densities[particle])
+ new_n_elem = np.sum(new_number_densities)
+
+ density_was_nan = np.all(np.isnan(self.number_densities[particle]))
+ same_density = u.quantity.allclose(old_n_elem, new_n_elem, rtol=self.tol)
+
+ if not same_density and not density_was_nan:
+ raise ValueError(
+ f"{errmsg} because the old element number density "
+ f"of {old_n_elem} is not approximately equal to "
+ f"the new element number density of {new_n_elem}.")
+
+ value = (new_number_densities / new_n_elem).to(u.dimensionless_unscaled)
+
+ # If the abundance of this particle has not been defined,
+ # then set the abundance if there is enough (but not too
+ # much) information to do so.
+
+ abundance_is_undefined = np.isnan(self.abundances[particle])
+ isnan_of_abundance_values = np.isnan(list(self.abundances.values()))
+ all_abundances_are_nan = np.all(isnan_of_abundance_values)
+ n_is_defined = not np.isnan(self.n)
+
+ if abundance_is_undefined:
+ if n_is_defined:
+ self._pars['abundances'][particle] = new_n_elem / self.n
+ elif all_abundances_are_nan:
+ self.n = new_n_elem
+ self._pars['abundances'][particle] = 1
+ else:
+ raise AtomicError(
+ f"Cannot set number density of {particle} to "
+ f"{value * new_n_elem} when the number density "
+ f"scaling factor is undefined, the abundance "
+ f"of {particle} is undefined, and some of the "
+ f"abundances of other elements/isotopes is "
+ f"defined.")
+
+ try:
+ new_fractions = np.array(value, dtype=np.float64)
+ except Exception as exc:
+ raise TypeError(
+ f"{errmsg} because value cannot be converted into an "
+ f"array that represents ionic fractions.") from exc
+
+ # TODO: Create a separate function that makes sure ionic
+ # TODO: fractions are valid to reduce code repetition. This
+ # TODO: would probably best go as a private function in
+ # TODO: ionization_state.py.
+
+ required_nstates = atomic_number(particle) + 1
+ new_nstates = len(new_fractions)
+ if new_nstates != required_nstates:
+ raise ValueError(
+ f"{errmsg} because value must have {required_nstates} "
+ f"ionization levels but instead corresponds to "
+ f"{new_nstates} levels.")
+
+ all_nans = np.all(np.isnan(new_fractions))
+ if not all_nans and (new_fractions.min() < 0 or new_fractions.max() > 1):
+ raise ValueError(
+ f"{errmsg} because the new ionic fractions are not "
+ f"all between 0 and 1.")
+
+ normalized = np.isclose(np.sum(new_fractions), 1, rtol=self.tol)
+ if not normalized and not all_nans:
+ raise ValueError(
+ f"{errmsg} because the ionic fractions are not "
+ f"normalized to one.")
+
+ self._ionic_fractions[particle][:] = new_fractions[:]
+
+ def __iter__(self):
+ """
+ Prepare an `~plasmapy.atomic.IonizationStates` instance for
+ iteration.
+ """
+ self._element_index = 0
+ return self
+
+ @property
+ def __ITER__(self): # coverage: ignore
+ """
+ Recall that our code development guide states that there should
+ be at most one pun per 1284 lines of code.
+ """
+ raise NotImplementedError(
+ "The International Thermonuclear Experimental Reactor "
+ "is still under construction.")
+
+ def __next__(self):
+ if self._element_index < len(self.base_particles):
+ particle = self.base_particles[self._element_index]
+ result = IonizationState(
+ particle,
+ self.ionic_fractions[particle],
+ T_e=self.T_e,
+ n_elem=np.sum(self.number_densities[particle]),
+ tol=self.tol,
+ )
+ self._element_index += 1
+ return result
+ else:
+ del self._element_index
+ raise StopIteration
+
+ def __eq__(self, other):
+
+ if not isinstance(other, IonizationStates):
+ raise TypeError(
+ "IonizationStates instance can only be compared with "
+ "other IonizationStates instances.")
+
+ if self.base_particles != other.base_particles:
+ raise AtomicError(
+ "Two IonizationStates instances can be compared only "
+ "if the base particles are the same.")
+
+ min_tol = np.min([self.tol, other.tol])
+
+ # Check any of a whole bunch of equality measures, recalling
+ # that np.nan == np.nan is False.
+
+ for attribute in ['T_e', 'n_e', 'kappa']:
+ this = eval(f"self.{attribute}")
+ that = eval(f"other.{attribute}")
+
+ # TODO: Maybe create a function in utils called same_enough
+ # TODO: that would take care of all of these disparate
+ # TODO: equality measures.
+
+ this_equals_that = np.any([
+ this == that,
+ this is that,
+ np.isnan(this) and np.isnan(that),
+ np.isinf(this) and np.isinf(that),
+ u.quantity.allclose(this, that, rtol=min_tol),
+ ])
+
+ if not this_equals_that:
+ return False
+
+ for attribute in ['ionic_fractions', 'number_densities']:
+
+ this_dict = eval(f"self.{attribute}")
+ that_dict = eval(f"other.{attribute}")
+
+ for particle in self.base_particles:
+
+ this = this_dict[particle]
+ that = that_dict[particle]
+
+ this_equals_that = np.any([
+ this is that,
+ np.all(np.isnan(this)) and np.all(np.isnan(that)),
+ u.quantity.allclose(this, that, rtol=min_tol),
+ ])
+
+ if not this_equals_that:
+ return False
+
+ return True
+
+ @property
+ def ionic_fractions(self) -> Dict[str, np.array]:
+ """
+ Return a `dict` containing the ionic fractions for each element
+ and isotope.
+
+ The keys of this `dict` are the symbols for each element or
+ isotope. The values will be `~numpy.ndarray` objects containing
+ the ionic fractions for each ionization level corresponding to
+ each element or isotope.
+
+ """
+ return self._ionic_fractions
+
+ @ionic_fractions.setter
+ def ionic_fractions(self, inputs: Union[Dict, List, Tuple]):
+ """
+ Set the ionic fractions.
+
+ Notes
+ -----
+ The ionic fractions are initialized during instantiation of
+ `~plasmapy.atomic.IonizationStates`. After this, the only way
+ to reset the ionic fractions via the ``ionic_fractions``
+ attribute is via a `dict` with elements or isotopes that are a
+ superset of the previous elements or isotopes. However, you may
+ use item assignment of the `~plasmapy.atomic.IonizationState`
+ instance to assign new ionic fractions one element or isotope
+ at a time.
+
+ Raises
+ ------
+ AtomicError
+ If the ionic fractions cannot be set.
+
+ TypeError
+ If ``inputs`` is not a `list`, `tuple`, or `dict` during
+ instantiation, or if ``inputs`` is not a `dict` when it is
+ being set.
+
+ """
+
+ # A potential problem is that using item assignment on the
+ # ionic_fractions attribute could cause the original attributes
+ # to be overwritten without checks being performed. We might
+ # eventually want to create a new class or subclass of UserDict
+ # that goes through these checks. In the meantime, we should
+ # make it clear to users to set ionic_fractions by using item
+ # assignment on the IonizationStates instance as a whole. An
+ # example of the problem is `s = IonizationStates(["He"])` being
+ # followed by `s.ionic_fractions["He"] = 0.3`.
+
+ if hasattr(self, '_ionic_fractions'):
+ if not isinstance(inputs, dict):
+ raise TypeError(
+ "Can only reset ionic_fractions with a dict if "
+ "ionic_fractions has been set already.")
+ old_particles = set(self.base_particles)
+ new_particles = {particle_symbol(key) for key in inputs.keys()}
+ missing_particles = old_particles - new_particles
+ if missing_particles:
+ raise AtomicError(
+ "Can only reset ionic fractions with a dict if "
+ "the new base particles are a superset of the "
+ "prior base particles. To change ionic fractions "
+ "for one base particle, use item assignment on the "
+ "IonizationStates instance instead.")
+
+ if isinstance(inputs, dict):
+ original_keys = inputs.keys()
+ ionfrac_types = {type(inputs[key]) for key in original_keys}
+ inputs_have_quantities = u.Quantity in ionfrac_types
+
+ if inputs_have_quantities and len(ionfrac_types) != 1:
+ raise TypeError(
+ "Ionic fraction information may only be inputted "
+ "as a Quantity object if all ionic fractions are "
+ "Quantity arrays with units of inverse volume.")
+
+ try:
+ particles = {key: Particle(key) for key in original_keys}
+ except (InvalidParticleError, TypeError) as exc:
+ raise AtomicError(
+ "Unable to create IonizationStates instance "
+ "because not all particles are valid.") from exc
+
+ # The particles whose ionization states are to be recorded
+ # should be elements or isotopes but not ions or neutrals.
+
+ for key in particles.keys():
+ is_element = particles[key].is_category('element')
+ has_charge_info = particles[key].is_category(any_of=["charged", "uncharged"])
+
+ if not is_element or has_charge_info:
+ raise AtomicError(
+ f"{key} is not an element or isotope without "
+ f"charge information.")
+
+ # We are sorting the elements/isotopes by atomic number and
+ # mass number since we will often want to plot and analyze
+ # things and this is the most sensible order.
+
+ sorted_keys = sorted(original_keys, key=lambda k: (
+ particles[k].atomic_number,
+ particles[k].mass_number if particles[k].isotope else 0,
+ ))
+
+ _elements_and_isotopes = []
+ _particle_instances = []
+ new_ionic_fractions = {}
+
+ if inputs_have_quantities:
+ n_elems = {}
+
+ for key in sorted_keys:
+ new_key = particles[key].particle
+ _particle_instances.append(particles[key])
+ if new_key in _elements_and_isotopes:
+ raise AtomicError("Repeated particles in IonizationStates.")
+
+ nstates_input = len(inputs[key])
+ nstates = particles[key].atomic_number + 1
+ if nstates != nstates_input:
+ raise AtomicError(
+ f"The ionic fractions array for {key} must "
+ f"have a length of {nstates}.")
+
+ _elements_and_isotopes.append(new_key)
+ if inputs_have_quantities:
+ try:
+ number_densities = inputs[key].to(u.m ** -3)
+ n_elem = np.sum(number_densities)
+ new_ionic_fractions[new_key] = np.array(number_densities / n_elem)
+ n_elems[key] = n_elem
+ except u.UnitConversionError as exc:
+ raise AtomicError("Units are not inverse volume.") from exc
+ elif isinstance(inputs[key], np.ndarray) and inputs[key].dtype.kind == 'f':
+ new_ionic_fractions[particles[key].particle] = inputs[key]
+ else:
+ try:
+ new_ionic_fractions[particles[key].particle] = \
+ np.array(inputs[key], dtype=np.float)
+ except ValueError as exc:
+ raise AtomicError(f"Inappropriate ionic fractions for {key}.") from exc
+
+ for key in _elements_and_isotopes:
+ fractions = new_ionic_fractions[key]
+ if not np.all(np.isnan(fractions)):
+ if np.min(fractions) < 0 or np.max(fractions) > 1:
+ raise AtomicError(f"Ionic fractions for {key} are not between 0 and 1.")
+ if not np.isclose(np.sum(fractions), 1, atol=self.tol, rtol=0):
+ raise AtomicError(f"Ionic fractions for {key} are not normalized to 1.")
+
+ # When the inputs provide the densities, the abundances must
+ # not have been provided because that would be redundant
+ # or contradictory information. The number density scaling
+ # factor might or might not have been provided. Have the
+ # number density scaling factor default to the total number
+ # of neutrals and ions across all elements and isotopes, if
+ # it was not provided. Then go ahead and calculate the
+ # abundances based on that. However, we need to be careful
+ # that the abundances are not overwritten during the
+ # instantiation of the class.
+
+ if inputs_have_quantities:
+ if np.isnan(self.n):
+ new_n = 0 * u.m ** -3
+ for key in _elements_and_isotopes:
+ new_n += n_elems[key]
+ self.n = new_n
+
+ new_abundances = {}
+ for key in _elements_and_isotopes:
+ new_abundances[key] = np.float(n_elems[key] / self.n)
+
+ self._pars['abundances'] = new_abundances
+
+ elif isinstance(inputs, (list, tuple)):
+
+ try:
+ _particle_instances = [Particle(particle) for particle in inputs]
+ except (InvalidParticleError, TypeError) as exc:
+ raise AtomicError("Invalid inputs to IonizationStates.") from exc
+
+ _particle_instances.sort(
+ key=lambda p: (p.atomic_number, p.mass_number if p.isotope else 0)
+ )
+ _elements_and_isotopes = [particle.particle for particle in _particle_instances]
+ new_ionic_fractions = {
+ particle.particle: np.full(
+ particle.atomic_number + 1,
+ fill_value=np.nan,
+ dtype=np.float64
+ ) for particle in _particle_instances
+ }
+ else:
+ raise TypeError("Incorrect inputs to set ionic_fractions.")
+
+ for i in range(1, len(_particle_instances)):
+ if _particle_instances[i - 1].element == _particle_instances[i].element:
+ if not _particle_instances[i - 1].isotope and _particle_instances[i].isotope:
+ raise AtomicError("Cannot have an element and isotopes of that element.")
+
+ self._particle_instances = _particle_instances
+ self._base_particles = _elements_and_isotopes
+ self._ionic_fractions = new_ionic_fractions
+
+ def normalize(self) -> None:
+ """
+ Normalize the ionic fractions so that the sum for each element
+ equals one.
+ """
+ for particle in self.base_particles:
+ tot = np.sum(self.ionic_fractions[particle])
+ self.ionic_fractions[particle] = self.ionic_fractions[particle] / tot
+
+ def equilibrate(
+ self,
+ T_e: u.K = np.nan * u.K,
+ particles: str = 'all',
+ kappa: Real = np.inf):
+ """
+ Set the ionic fractions to collisional ionization equilibrium.
+ Not implemented.
+
+ The electron temperature used to calculate the new equilibrium
+ ionic fractions will be the argument ``T_e`` to this method if
+ given, and otherwise the attribute ``T_e`` if no electon
+ temperature is provided to this method.
+
+ Parameters
+ ----------
+ T_e: ~astropy.units.Quantity, optional
+ The electron temperature.
+
+ particles: `list`, `tuple`, or `str`, optional
+ The elements and isotopes to be equilibrated. If
+ ``particles`` is ``'all'`` (default), then all
+ elements and isotopes will be equilibrated.
+
+ kappa: Real
+ The value of kappa for a kappa distribution for electrons.
+
+ """
+ raise NotImplementedError
+
+ @property
+ @u.quantity_input
+ def n_e(self) -> u.m ** -3:
+ """
+ Return the electron number density under the assumption of
+ quasineutrality.
+ """
+ number_densities = self.number_densities
+ n_e = 0.0 * u.m ** -3
+ for elem in self.base_particles:
+ atomic_numb = atomic_number(elem)
+ number_of_ionization_states = atomic_numb + 1
+ integer_charges = np.linspace(0, atomic_numb, number_of_ionization_states)
+ n_e += np.sum(number_densities[elem] * integer_charges)
+ return n_e
+
+ @property
+ @u.quantity_input
+ def n(self) -> u.m ** -3:
+ """Return the number density scaling factor."""
+ return self._pars['n']
+
+ @n.setter
+ @u.quantity_input
+ def n(self, n: u.m ** -3):
+ """Set the number density scaling factor."""
+ try:
+ n = n.to(u.m ** -3)
+ except u.UnitConversionError as exc:
+ raise AtomicError("Units cannot be converted to u.m ** -3.") from exc
+ except Exception as exc:
+ raise AtomicError(f"{n} is not a valid number density.") from exc
+ if n < 0 * u.m ** -3:
+ raise AtomicError("Number density cannot be negative.")
+ self._pars['n'] = n.to(u.m ** -3)
+
+ @property
+ def number_densities(self) -> Dict[str, u.Quantity]:
+ """
+ Return a `dict` containing the number densities for element or
+ isotope.
+ """
+ return {
+ elem: self.n * self.abundances[elem] * self.ionic_fractions[elem]
+ for elem in self.base_particles
+ }
+
+ @property
+ def abundances(self) -> Optional[Dict]:
+ """Return the elemental abundances."""
+ return self._pars['abundances']
+
+ @abundances.setter
+ def abundances(self, abundances_dict: Optional[Dict]):
+ """
+ Set the elemental (or isotopic) abundances. The elements and
+ isotopes must be the same as or a superset of the elements whose
+ ionization states are being tracked.
+ """
+ if abundances_dict is None:
+ self._pars['abundances'] = {elem: np.nan for elem in self.base_particles}
+ elif not isinstance(abundances_dict, dict):
+ raise TypeError(
+ f"The abundances attribute must be a dict with "
+ f"elements or isotopes as keys and real numbers "
+ f"representing relative abundances as values.")
+ else:
+ old_keys = abundances_dict.keys()
+ try:
+ new_keys_dict = {particle_symbol(old_key): old_key for old_key in old_keys}
+ except Exception:
+ raise AtomicError(
+ f"The key {repr(old_key)} in the abundances "
+ f"dictionary is not a valid element or isotope.")
+
+ new_elements = new_keys_dict.keys()
+
+ old_elements_set = set(self.base_particles)
+ new_elements_set = set(new_elements)
+
+ if old_elements_set - new_elements_set:
+ raise AtomicError(
+ f"The abundances of the following particles are "
+ f"missing: {old_elements_set - new_elements_set}")
+
+ new_abundances_dict = {}
+
+ for element in new_elements:
+ inputted_abundance = abundances_dict[new_keys_dict[element]]
+ try:
+ inputted_abundance = float(inputted_abundance)
+ except Exception:
+ raise TypeError(
+ f"The abundance for {element} was provided as"
+ f"{inputted_abundance}, which cannot be "
+ f"converted to a real number.") from None
+
+ if inputted_abundance < 0:
+ raise AtomicError(f"The abundance of {element} is negative.")
+ new_abundances_dict[element] = inputted_abundance
+
+ self._pars['abundances'] = new_abundances_dict
+
+ @property
+ def log_abundances(self) -> Dict[str, Real]:
+ """
+ Return a `dict` with atomic or isotope symbols as keys and the
+ base 10 logarithms of the relative abundances as the
+ corresponding values.
+ """
+ log_abundances_dict = {}
+ for key in self.abundances.keys():
+ log_abundances_dict[key] = np.log10(self.abundances[key])
+ return log_abundances_dict
+
+ @log_abundances.setter
+ def log_abundances(self, value: Optional[Dict[str, Real]]):
+ """
+ Set the base 10 logarithm of the relative abundances.
+ """
+ if value is not None:
+ try:
+ new_abundances_input = {}
+ for key in value.keys():
+ new_abundances_input[key] = 10 ** value[key]
+ self.abundances = new_abundances_input
+ except Exception:
+ raise AtomicError("Invalid log_abundances.") from None
+
+ @property
+ @u.quantity_input(equivalencies=u.temperature_energy())
+ def T_e(self) -> u.K:
+ """Return the electron temperature."""
+ return self._pars['T_e']
+
+ @T_e.setter
+ @u.quantity_input(equivalencies=u.temperature_energy())
+ def T_e(self, electron_temperature: u.K):
+ """Set the electron temperature."""
+ try:
+ temperature = electron_temperature.to(u.K, equivalencies=u.temperature_energy())
+ except (AttributeError, u.UnitsError):
+ raise AtomicError(
+ f"{electron_temperature} is not a valid temperature.") from None
+ if temperature < 0 * u.K:
+ raise AtomicError("The electron temperature cannot be negative.")
+ self._pars['T_e'] = temperature
+
+ @property
+ def kappa(self) -> np.real:
+ """
+ Return the kappa parameter for a kappa distribution function
+ for electrons.
+
+ The value of ``kappa`` must be greater than ``1.5`` in order to
+ have a valid distribution function. If ``kappa`` equals
+ `~numpy.inf`, then the distribution function reduces to a
+ Maxwellian.
+
+ """
+ return self._pars['kappa']
+
+ @kappa.setter
+ def kappa(self, value: Real):
+ """
+ Set the kappa parameter for a kappa distribution function for
+ electrons. The value must be between ``1.5`` and `~numpy.inf`.
+ """
+ kappa_errmsg = "kappa must be a real number greater than 1.5"
+ if not isinstance(value, Real):
+ raise TypeError(kappa_errmsg)
+ if value <= 1.5:
+ raise ValueError(kappa_errmsg)
+ self._pars['kappa'] = np.real(value)
+
+ @property
+ def base_particles(self) -> List[str]:
+ """
+ Return a list of the elements and isotopes whose ionization
+ states are being kept track of.
+ """
+ return self._base_particles
+
+ @property
+ def tol(self) -> np.real:
+ """Return the absolute tolerance for comparisons."""
+ return self._tol
+
+ @tol.setter
+ def tol(self, atol: Real):
+ """
+ Set the absolute tolerance for comparisons.
+ """
+ if not isinstance(atol, Real):
+ raise TypeError("The attribute tol must be a real number.")
+ if 0 <= atol <= 1.0:
+ self._tol = np.real(atol)
+ else:
+ raise ValueError("Need 0 <= tol <= 1.")
+
+ def info(self, minimum_ionic_fraction: Real = 0.01) -> None:
+ """
+ Print quicklook information for an
+ `~plasmapy.atomic.IonizationStates` instance.
+
+ Parameters
+ ----------
+ minimum_ionic_fraction: Real
+ If the ionic fraction for a particular ionization state is
+ below this level, then information for it will not be
+ printed. Defaults to 0.01.
+
+ Examples
+ --------
+ >>> states = IonizationStates(
+ ... {'H': [0.1, 0.9], 'He': [0.95, 0.05, 0.0]},
+ ... T_e = 12000 * u.K,
+ ... n = 3e9 * u.cm ** -3,
+ ... abundances = {'H': 1.0, 'He': 0.1},
+ ... kappa = 3.4,
+ ... )
+ >>> states.info()
+ IonizationStates instance for: H, He
+ ----------------------------------------------------------------
+ H 0+: 0.100 n_i = 3.00e+14 m**-3
+ H 1+: 0.900 n_i = 2.70e+15 m**-3
+ ----------------------------------------------------------------
+ He 0+: 0.950 n_i = 2.85e+14 m**-3
+ He 1+: 0.050 n_i = 1.50e+13 m**-3
+ ----------------------------------------------------------------
+ n_e = 2.71e+15 m**-3
+ T_e = 1.20e+04 K
+ kappa = 3.40
+ ----------------------------------------------------------------
+
+ """
+ separator_line = 64 * '-'
+
+ output = []
+
+ output.append(f"IonizationStates instance for: {', '.join(self.base_particles)}")
+
+ # Get the ionic symbol with the corresponding ionic fraction and
+ # number density (if available), but only for the most abundant
+ # ionization levels for each element.
+
+ for ionization_state in self:
+ states_info = ionization_state._get_states_info(minimum_ionic_fraction)
+ if len(states_info) > 0:
+ output += states_info
+ output[-1] += '\n' + separator_line
+
+ attributes = []
+ if np.isfinite(self.n_e):
+ attributes.append("n_e = " + "{:.2e}".format(self.n_e.value) + " m**-3")
+ if np.isfinite(self.T_e):
+ attributes.append("T_e = " + "{:.2e}".format(self.T_e.value) + " K")
+ if np.isfinite(self.kappa):
+ attributes.append("kappa = " + "{:.2f}".format(self.kappa))
+
+ if attributes:
+ attributes.append(separator_line)
+
+ output.append("\n".join(attributes))
+
+ if len(output) > 1:
+ output[0] += '\n' + separator_line
+ output_string = "\n".join(output)
+ else:
+ output_string = output[0]
+
+ print(output_string.strip('\n'))
diff --git a/plasmapy/atomic/particle_class.py b/plasmapy/atomic/particle_class.py
index bfa931d3..e89c4378 100644
--- a/plasmapy/atomic/particle_class.py
+++ b/plasmapy/atomic/particle_class.py
@@ -1,15 +1,17 @@
"""The Particle class."""
-import numpy as np
import warnings
from typing import (Union, Set, Tuple, List, Optional)
import collections
-import plasmapy.utils.roman as roman
-import numbers
+from numbers import Integral, Real
+import numpy as np
import astropy.units as u
import astropy.constants as const
+import plasmapy.utils.roman as roman
+from plasmapy.atomic.elements import _Elements, _PeriodicTable
+from plasmapy.atomic.isotopes import _Isotopes
from plasmapy.utils import (
AtomicError,
AtomicWarning,
@@ -21,17 +23,12 @@
MissingAtomicDataError,
MissingAtomicDataWarning,
)
-
-from .parsing import (
+from plasmapy.atomic.parsing import (
_dealias_particle_aliases,
_parse_and_check_atomic_input,
_invalid_particle_errmsg,
)
-
-from .elements import _Elements, _PeriodicTable
-from .isotopes import _Isotopes
-
-from .special_particles import (
+from plasmapy.atomic.special_particles import (
_Particles,
ParticleZoo,
_special_ion_masses,
@@ -39,7 +36,7 @@
)
__all__ = [
- "Particle",
+ 'Particle',
]
_classification_categories = {
@@ -173,10 +170,8 @@ class Particle:
>>> positron.particle
'e+'
- The `~plasmapy.atomic.Particle.atomic_symbol`,
- `~plasmapy.atomic.Particle.isotope_symbol`, and
- `~plasmapy.atomic.Particle.ionic_symbol` attributes return the
- symbols for each of these different types of particles.
+ The ``element``, ``isotope``, and ``ionic_symbol`` attributes return
+ the symbols for each of these different types of particles.
>>> proton.element
'H'
@@ -280,19 +275,19 @@ class Particle:
def __init__(
self,
- argument: Union[str, numbers.Integral],
- mass_numb: numbers.Integral = None,
- Z: numbers.Integral = None):
+ argument: Union[str, Integral],
+ mass_numb: Integral = None,
+ Z: Integral = None):
"""
Instantiate a `~plasmapy.atomic.Particle` object and set private
attributes.
"""
- if not isinstance(argument, (numbers.Integral, np.integer, str, Particle)):
+ if not isinstance(argument, (Integral, np.integer, str, Particle)):
raise TypeError(
- "The first positional argument when creating a Particle "
- "object must be either an integer, string, or another"
- "Particle object.")
+ "The first positional argument when creating a "
+ "Particle object must be either an integer, string, or "
+ "another Particle object.")
# If argument is a Particle instance, then we will construct a
# new Particle instance for the same Particle (essentially a
@@ -301,10 +296,10 @@ def __init__(
if isinstance(argument, Particle):
argument = argument.particle
- if mass_numb is not None and not isinstance(mass_numb, numbers.Integral):
+ if mass_numb is not None and not isinstance(mass_numb, Integral):
raise TypeError("mass_numb is not an integer")
- if Z is not None and not isinstance(Z, numbers.Integral):
+ if Z is not None and not isinstance(Z, Integral):
raise TypeError("Z is not an integer.")
self._attributes = collections.defaultdict(lambda: None)
@@ -527,7 +522,7 @@ def __ne__(self, other) -> bool:
"""
Test whether or not two objects are different particles.
- This method will return `False` if `other` is an identical
+ This method will return `False` if ``other`` is an identical
`~plasmapy.atomic.Particle` instance or a `str` representing the
same particle, and return `True` if ``other`` is a different
`~plasmapy.atomic.Particle` or a `str` representing a different
@@ -542,12 +537,19 @@ def __ne__(self, other) -> bool:
"""
return not self.__eq__(other)
+ def __hash__(self) -> int:
+ """
+ Allow use of `hash` so that a `~plasmapy.atomic.Particle`
+ instance may be used as a key in a `dict`.
+ """
+ return hash(self.__repr__())
+
def __bool__(self):
"""
Raise an `~plasmapy.utils.AtomicError` because Particle objects
do not have a truth value.
"""
- raise AtomicError("The truthiness of a Particle object is not defined.")
+ raise AtomicError("The truthiness of a Particle instance is not defined.")
def __invert__(self):
"""
@@ -734,7 +736,7 @@ def isotope_name(self) -> str:
return isotope_name
@property
- def integer_charge(self) -> numbers.Integral:
+ def integer_charge(self) -> Integral:
"""
Return the particle's integer charge.
@@ -1032,7 +1034,7 @@ def binding_energy(self) -> u.Quantity:
return nuclear_binding_energy.to(u.J)
@property
- def atomic_number(self) -> numbers.Integral:
+ def atomic_number(self) -> Integral:
"""
Return the number of protons in an element, isotope, or ion.
@@ -1054,7 +1056,7 @@ def atomic_number(self) -> numbers.Integral:
return self._attributes['atomic number']
@property
- def mass_number(self) -> numbers.Integral:
+ def mass_number(self) -> Integral:
"""
Return the number of nucleons in an isotope.
@@ -1076,7 +1078,7 @@ def mass_number(self) -> numbers.Integral:
return self._attributes['mass number']
@property
- def neutron_number(self) -> numbers.Integral:
+ def neutron_number(self) -> Integral:
"""
Return the number of neutrons in an isotope or nucleon.
@@ -1103,7 +1105,7 @@ def neutron_number(self) -> numbers.Integral:
raise InvalidIsotopeError(_category_errmsg(self, 'isotope'))
@property
- def electron_number(self) -> numbers.Integral:
+ def electron_number(self) -> Integral:
"""
Return the number of electrons in an ion.
@@ -1161,7 +1163,7 @@ def isotopic_abundance(self) -> u.Quantity:
return abundance
@property
- def baryon_number(self) -> numbers.Integral:
+ def baryon_number(self) -> Integral:
"""
Return the number of baryons in a particle.
@@ -1185,7 +1187,7 @@ def baryon_number(self) -> numbers.Integral:
return self._attributes['baryon number']
@property
- def lepton_number(self) -> numbers.Integral:
+ def lepton_number(self) -> Integral:
"""
Return ``1`` for leptons, ``-1`` for antileptons, and ``0``
otherwise.
@@ -1242,7 +1244,7 @@ def half_life(self) -> Union[u.Quantity, str]:
return self._attributes['half-life']
@property
- def spin(self) -> Union[numbers.Integral, numbers.Real]:
+ def spin(self) -> Real:
"""
Return the spin of the particle.
@@ -1290,7 +1292,8 @@ def periodic_table(self) -> collections.namedtuple:
@property
def categories(self) -> Set[str]:
- """Return the particle's categories.
+ """
+ Return the particle's categories.
Examples
--------
@@ -1317,9 +1320,9 @@ def is_category(self,
Required categories may be entered as positional arguments,
including as a `list`, `set`, or `tuple` of required categories.
- These may also be included using the `require` keyword argument.
- This method will return `False` if the particle is not in all of
- the required categories.
+ These may also be included using the ``require`` keyword
+ argument. This method will return `False` if the particle is
+ not in all of the required categories.
If categories are inputted using the ``any_of`` keyword
argument, then this method will return `False` if the particle
@@ -1410,8 +1413,7 @@ def is_electron(self) -> bool:
@property
def is_ion(self) -> bool:
"""
- Return `True` if the particle is an ion, and `False`
- otherwise.
+ Return `True` if the particle is an ion, and `False` otherwise.
Examples
--------
@@ -1425,7 +1427,7 @@ def is_ion(self) -> bool:
"""
return self.is_category('ion')
- def ionize(self, n: numbers.Integral = 1, inplace: bool = False):
+ def ionize(self, n: Integral = 1, inplace: bool = False):
"""
Create a new `~plasmapy.atomic.Particle` instance corresponding
to the current `~plasmapy.atomic.Particle` after being ionized
@@ -1494,7 +1496,7 @@ def ionize(self, n: numbers.Integral = 1, inplace: bool = False):
raise InvalidIonError(
f"The particle {self.particle} is already fully "
f"ionized and cannot be ionized further.")
- if not isinstance(n, numbers.Integral):
+ if not isinstance(n, Integral):
raise TypeError("n must be a positive integer.")
if n <= 0:
raise ValueError("n must be a positive number.")
@@ -1507,7 +1509,7 @@ def ionize(self, n: numbers.Integral = 1, inplace: bool = False):
else:
return Particle(base_particle, Z=new_integer_charge)
- def recombine(self, n: numbers.Integral = 1, inplace=False):
+ def recombine(self, n: Integral = 1, inplace=False):
"""
Create a new `~plasmapy.atomic.Particle` instance corresponding
to the current `~plasmapy.atomic.Particle` after undergoing
@@ -1537,7 +1539,7 @@ def recombine(self, n: numbers.Integral = 1, inplace=False):
particle : ~plasmapy.atomic.Particle
A new `~plasmapy.atomic.Particle` object that has undergone
recombination ``n`` times relative to the original
- `~plasmapy.atomic.Particle`. If `inplace` is `False`,
+ `~plasmapy.atomic.Particle`. If ``inplace`` is `False`,
instead return `None`.
Raises
@@ -1571,7 +1573,7 @@ def recombine(self, n: numbers.Integral = 1, inplace=False):
raise ChargeError(
f"{self.particle} cannot undergo recombination because "
f"its charge is not specified.")
- if not isinstance(n, numbers.Integral):
+ if not isinstance(n, Integral):
raise TypeError("n must be a positive integer.")
if n <= 0:
raise ValueError("n must be a positive number.")
diff --git a/plasmapy/atomic/particle_input.py b/plasmapy/atomic/particle_input.py
index e50d4172..f7f5bf10 100644
--- a/plasmapy/atomic/particle_input.py
+++ b/plasmapy/atomic/particle_input.py
@@ -11,12 +11,14 @@
from .particle_class import Particle
-from plasmapy.utils import (AtomicError,
- InvalidParticleError,
- InvalidElementError,
- InvalidIonError,
- InvalidIsotopeError,
- ChargeError)
+from plasmapy.utils import (
+ AtomicError,
+ InvalidParticleError,
+ InvalidElementError,
+ InvalidIonError,
+ InvalidIsotopeError,
+ ChargeError,
+)
__all__ = [
"particle_input",
diff --git a/plasmapy/classes/sources/openpmd_hdf5.py b/plasmapy/classes/sources/openpmd_hdf5.py
index 8b4c602c..bf53b121 100644
--- a/plasmapy/classes/sources/openpmd_hdf5.py
+++ b/plasmapy/classes/sources/openpmd_hdf5.py
@@ -1,6 +1,10 @@
-import h5py
import numpy as np
import astropy.units as u
+try:
+ import h5py
+except (ImportError, ModuleNotFoundError) as e:
+ from plasmapy.optional_deps import h5py_import_error
+ raise ImportError(h5py_import_error) from e
from plasmapy.classes import GenericPlasma
from plasmapy.utils import DataStandardError
diff --git a/plasmapy/diagnostics/langmuir.py b/plasmapy/diagnostics/langmuir.py
index f645d37d..5d8fff7b 100644
--- a/plasmapy/diagnostics/langmuir.py
+++ b/plasmapy/diagnostics/langmuir.py
@@ -6,7 +6,11 @@
import plasmapy.constants as const
import copy
from astropy.visualization import quantity_support
-import matplotlib.pyplot as plt
+try:
+ import matplotlib.pyplot as plt
+except (ImportError, ModuleNotFoundError) as e:
+ from plasmapy.optional_deps import mpl_import_error
+ raise mpl_import_error from e
from scipy.optimize import curve_fit
from plasmapy.atomic import Particle
diff --git a/plasmapy/mathematics/mathematics.py b/plasmapy/mathematics/mathematics.py
index 7474d6a7..6aa17a52 100644
--- a/plasmapy/mathematics/mathematics.py
+++ b/plasmapy/mathematics/mathematics.py
@@ -3,7 +3,11 @@
import numbers
import numpy as np
from astropy import units as u
-from mpmath import polylog
+try:
+ from mpmath import polylog
+except (ImportError, ModuleNotFoundError) as e:
+ from plasmapy.optional_deps import mpmath_import_error
+ raise mpmath_import_error from e
from scipy.special import wofz as Faddeeva_function
from typing import Union
diff --git a/plasmapy/optional_deps.py b/plasmapy/optional_deps.py
new file mode 100644
index 00000000..1a360b32
--- /dev/null
+++ b/plasmapy/optional_deps.py
@@ -0,0 +1,61 @@
+""" Useful error messages for optional dependencies that aren't found. """
+from typing import Optional
+
+
+def _optional_import_error_template(pkgname: str,
+ url: str,
+ library: Optional[str] = None,
+ conda_channel: Optional[str] = None,
+ ) -> ImportError:
+ """
+ Simple template to prevent text duplication.
+
+ Parameters
+ ----------
+ pkgname : str
+ Package name on pip or conda
+ url : str
+ Link to install page for given package
+ library : str (optional)
+ Full package name
+ conda_channel: str (optional)
+ set to "conda-forge" to add -c conda-forge to the conda install line
+
+ Returns
+ -------
+ ImportError
+
+ """
+ library = pkgname if library is None else library
+ conda_channel = f"-c {conda_channel} " if conda_channel is not None else ""
+
+ template = f"""
+ {library} could not be found. Try either
+
+ conda install {conda_channel}{pkgname}
+
+ on Anaconda environments or
+
+ pip install {pkgname}
+
+ in general. In case of trouble refer to
+
+ {url}
+
+ (link active as of 2018.10.31 - please report dead links on GitHub!)"""
+
+ return ImportError(template)
+
+
+h5py_import_error = _optional_import_error_template("h5py",
+ "http://docs.h5py.org/en/latest/build.html")
+
+mpl_import_error = _optional_import_error_template("matplotlib",
+ "https://matplotlib.org/users/installing.html")
+
+mpmath_import_error = _optional_import_error_template("mpmath",
+ "http://mpmath.org/doc/current/setup.html#download-and-installation")
+
+lmfit_import_error = _optional_import_error_template("lmfit",
+ "https://lmfit.github.io/lmfit-py/installation.html")
+
diff --git a/plasmapy/physics/parameters.py b/plasmapy/physics/parameters.py
index 86f78b29..07eb2d33 100644
--- a/plasmapy/physics/parameters.py
+++ b/plasmapy/physics/parameters.py
@@ -1154,28 +1154,28 @@ def Debye_number(T_e: u.K, n_e: u.m**-3):
return N_D.to(u.dimensionless_unscaled)
+
@utils.check_quantity(
n={'units': u.m ** -3, 'can_be_negative': False}
)
-def inertial_length(n: u.m**-3, particle='e-'):
- r"""Calculate the particle inertial length. At this length, the Hall effect
- becomes important.
[email protected]_input(require='charged')
+def inertial_length(n: u.m**-3, particle: atomic.Particle):
+ r"""
+ Calculate a charged particle's inertial length.
Parameters
----------
n : ~astropy.units.Quantity
- Particle number density in units convertible to m**-3.
+ Particle number density in units convertible to m ** -3.
particle : str, optional
- Representation of the particle species (e.g., 'p' for protons, 'D+'
- for deuterium, or 'He-4 +1' for singly ionized helium-4),
- which defaults to electrons. If no charge state information is
- provided, then the particles are assumed to be singly charged.
+ Representation of the particle species (e.g., 'p+' for protons,
+ 'D+' for deuterium, or 'He-4 +1' for singly ionized helium-4).
Returns
-------
d : ~astropy.units.Quantity
- Particles inertial length in meters.
+ The particle's inertial length in meters.
Raises
------
@@ -1191,22 +1191,27 @@ def inertial_length(n: u.m**-3, particle='e-'):
Warns
-----
~astropy.units.UnitsWarning
- If units are not provided, SI units are assumed
+ If units are not provided and SI units are assumed.
Notes
-----
- The particle inertial length is also known as an particle skin depth and is
- given by:
+ The inertial length of a particle of species :math:`s` is given by
.. math::
- d = \frac{c}{\omega_{pi}}
+ d = \frac{c}{\omega_{ps}}
+
+ The inertial length is the characteristic length scale for a
+ particle to be accelerated in a plasma. The Hall effect becomes
+ important on length scales shorter than the ion inertial length.
+
+ The inertial length is also known as the skin depth.
Example
-------
>>> from astropy import units as u
- >>> inertial_length(5*u.m**-3, particle='He+')
+ >>> inertial_length(5 * u.m ** -3, 'He+')
<Quantity 2.02985802e+08 m>
- >>> inertial_length(5*u.m**-3)
+ >>> inertial_length(5 * u.m ** -3, 'e-')
<Quantity 2376534.75601976 m>
"""
diff --git a/plasmapy/physics/quantum.py b/plasmapy/physics/quantum.py
index 0cc7ef2e..a9a85f7b 100644
--- a/plasmapy/physics/quantum.py
+++ b/plasmapy/physics/quantum.py
@@ -6,6 +6,11 @@
# python modules
import numpy as np
from astropy import units as u
+try:
+ from lmfit import minimize, Parameters
+except (ImportError, ModuleNotFoundError) as e:
+ from plasmapy.optional_deps import lmfit_import_error
+ raise lmfit_import_error from e
# plasmapy modules
from plasmapy import atomic, utils, mathematics
@@ -447,7 +452,6 @@ def chemical_potential(n_e: u.m ** -3, T: u.K):
<Quantity 2.00039985e-12>
"""
- from lmfit import minimize, Parameters
# deBroglie wavelength
lambdaDB = thermal_deBroglie_wavelength(T)
# degeneracy parameter
diff --git a/setup.cfg b/setup.cfg
index f7316236..ef355f0c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -9,7 +9,15 @@ edit_on_github = True
github_project = PlasmaPy/PlasmaPy
# install_requires should be formatted as a comma-separated list, e.g.:
# install_requires = astropy, scipy, matplotlib
-install_requires = numpy, scipy, astropy, cython, lmfit, matplotlib, colorama, mpmath, h5py
+install_requires = numpy, scipy, astropy, cython, colorama
+
+extra_requires = classes, diagnostics, tests, math, physics
+classes_requires = h5py, matplotlib
+diagnostics_requires = matplotlib
+tests_requires = pytest, pytest_astropy
+math_requires = mpmath
+physics_requires = lmfit
+
# version should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
version = 0.1.1.dev
diff --git a/setup.py b/setup.py
index 46c9ca79..25b6eb9d 100644
--- a/setup.py
+++ b/setup.py
@@ -4,6 +4,7 @@
import glob
import os
import sys
+import itertools
# Enforce Python version check - this is the same check as in __init__.py but
# this one has to happen before importing ah_bootstrap.
@@ -127,6 +128,18 @@
setup_requires = ['numpy']
+extra_tags = [m.strip() for m in metadata.get("extra_requires", "").split(',')]
+if extra_tags:
+ # TODO: the line below will prove useful once #576 is in play
+ extras_require = {tag: [m.strip() for m in metadata[f"{tag}_requires"].split(',')]
+ for tag in extra_tags}
+
+ # but for now we'll limit ourselves to pip install plasmapy[optional]
+ optionals_require = list(itertools.chain.from_iterable(extras_require.values()))
+ extras_require = dict(optional=optionals_require)
+else:
+ extras_require = None
+
# Make sure to have the packages needed for building PlasmaPy, but do not require them
# when installing from an sdist as the c files are included there.
if not os.path.exists(os.path.join(os.path.dirname(__file__), 'PKG-INFO')):
@@ -172,6 +185,7 @@
include_package_data=True,
entry_points=entry_points,
python_requires='>={}'.format("3.6"),
- tests_require=["pytest", "pytest-astropy"],
+ tests_require=extras_require.get("optional", ""),
+ extras_require=extras_require,
**package_info
)
|
Importing a plasmapy module fails if h5py isn't installed
```python
from plasmapy.physics import dimensionless
File "/Users/dstansby/github/plasmapy/plasmapy/__init__.py", line 29, in <module>
from . import classes
File "/Users/dstansby/github/plasmapy/plasmapy/classes/__init__.py", line 4, in <module>
from . import sources
File "/Users/dstansby/github/plasmapy/plasmapy/classes/sources/__init__.py", line 3, in <module>
from .openpmd_hdf5 import HDF5Reader
File "/Users/dstansby/github/plasmapy/plasmapy/classes/sources/openpmd_hdf5.py", line 1, in <module>
import h5py
ModuleNotFoundError: No module named 'h5py'
```
The problem is that `__init__.py` in the `plasmapy` directory tries to import *everything*, which means e.g. `h5py` is required for plasmapy to work. I'm guessing this is an optional dependency, and shouldn't be required?
|
PlasmaPy/PlasmaPy
|
diff --git a/plasmapy/atomic/tests/test_ionization_state.py b/plasmapy/atomic/tests/test_ionization_state.py
new file mode 100644
index 00000000..7f935591
--- /dev/null
+++ b/plasmapy/atomic/tests/test_ionization_state.py
@@ -0,0 +1,553 @@
+import pytest
+import collections
+
+import numpy as np
+import astropy.units as u
+
+from plasmapy.atomic.ionization_state import IonizationState
+from plasmapy.utils import AtomicError, InvalidIsotopeError, run_test
+from plasmapy.atomic import (
+ atomic_number,
+ atomic_symbol,
+ particle_symbol,
+ isotope_symbol,
+ Particle,
+)
+
+test_cases = {
+ 'Li': {
+ 'particle': 'Li',
+ 'ionic_fractions': np.array([0.4, 0.3, 0.2, 0.1]),
+ 'tol': 1e-15,
+ },
+
+ 'Li ground state': {
+ 'particle': 'Li',
+ 'ionic_fractions': np.array([1, 0, 0, 0], dtype=np.int64),
+ 'tol': 1e-15,
+ },
+
+ 'H': {
+ 'particle': 'H',
+ 'ionic_fractions': [0.6, 0.4],
+ 'tol': 1e-8,
+ },
+
+ 'H acceptable error': {
+ 'particle': 'H',
+ 'ionic_fractions': [0.6, 0.400_000_001],
+ 'tol': 1e-8,
+ },
+
+ 'D': {
+ 'particle': 'deuterium',
+ 'ionic_fractions': [0.7, 0.3],
+ 'tol': 1e-15,
+ 'n_elem': 3e14 * u.m ** -3,
+ },
+
+ 'He': {
+ 'particle': 'He',
+ 'ionic_fractions': [0.5, 0.3, 0.2],
+ 'n_elem': 1e20 * u.m ** -3,
+ },
+
+ 'number densities': {
+ 'particle': 'T',
+ 'ionic_fractions': np.array([1e4, 1]) * u.cm ** -3,
+ }
+
+}
+
+test_names = test_cases.keys()
+
+
+class Test_IonizationState:
+ """Test instances of IonizationState."""
+
+ @classmethod
+ def setup_class(cls):
+ cls.instances = {}
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_instantiation(self, test_name):
+ """
+ Test that each IonizationState test case can be instantiated.
+ """
+ try:
+ self.instances[test_name] = IonizationState(**test_cases[test_name])
+ except Exception:
+ pytest.fail(f"Unable to create IonizationState instance for test case {test_name}.")
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_integer_charges(self, test_name):
+ """
+ Test that an `IonizationState` instance has the correct integer
+ charges.
+ """
+ instance = self.instances[test_name]
+ expected_integer_charges = np.arange(instance.atomic_number + 1)
+ assert np.allclose(instance.integer_charges, expected_integer_charges)
+
+ @pytest.mark.parametrize(
+ 'test_name',
+ [name for name in test_names if 'ionic_fractions' in test_cases[name].keys()],
+ )
+ def test_ionic_fractions(self, test_name):
+ """
+ Test that each `IonizationState` instance has the expected
+ ionic fractions.
+ """
+ instance = self.instances[test_name]
+ inputted_fractions = test_cases[test_name]['ionic_fractions']
+ if isinstance(inputted_fractions, u.Quantity):
+ inputted_fractions = inputted_fractions.to(u.m ** -3)
+ inputted_fractions = (inputted_fractions / inputted_fractions.sum()).value
+ if not np.allclose(instance.ionic_fractions, inputted_fractions):
+ pytest.fail(f"Mismatch in ionic fractions for test {test_name}.")
+
+ def test_equal_to_itself(self):
+ """
+ Test that `IonizationState.__eq__` returns `True for two identical
+ `IonizationState` instances.
+ """
+ assert self.instances['Li'] == self.instances['Li'], \
+ "Identical IonizationState instances are not equal."
+
+ def test_equal_to_within_tolerance(self):
+ """
+ Test that `IonizationState.__eq__` returns `True` for two
+ `IonizationState` instances that differ within the inputted
+ tolerance.
+ """
+ assert self.instances['H'] == self.instances['H acceptable error'], \
+ ("Two IonizationState instances that are approximately the "
+ "same to within the tolerance are not testing as equal.")
+
+ def test_inequality(self):
+ """
+ Test that instances with different ionic fractions are not equal
+ to each other.
+ """
+ assert self.instances['Li ground state'] != self.instances['Li'], \
+ "Different IonizationState instances are equal."
+
+ def test_equality_exception(self):
+ """
+ Test that comparisons of `IonizationState` instances for
+ different elements fail.
+ """
+ with pytest.raises(AtomicError):
+ self.instances['Li'] == self.instances['H']
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_iteration(self, test_name: str):
+ """Test that `IonizationState` instances iterate impeccably."""
+ try:
+ states = [state for state in self.instances[test_name]]
+ except Exception:
+ pytest.fail(f"Unable to perform iteration for {test_name}.")
+
+ try:
+ integer_charges = [state.integer_charge for state in states]
+ ionic_fractions = np.array([state.ionic_fraction for state in states])
+ ionic_symbols = [state.ionic_symbol for state in states]
+ except Exception:
+ pytest.fail(f"An attribute may be misnamed or missing ({test_name}).")
+
+ try:
+ base_symbol = isotope_symbol(ionic_symbols[0])
+ except InvalidIsotopeError:
+ base_symbol = atomic_symbol(ionic_symbols[0])
+ finally:
+ atomic_numb = atomic_number(ionic_symbols[1])
+
+ errors = []
+
+ expected_charges = np.arange(atomic_numb + 1)
+ if not np.all(integer_charges == expected_charges):
+ errors.append(
+ f"The resulting integer charges are {integer_charges}, "
+ f"which are not equal to the expected integer charges, "
+ f"which are {expected_charges}.")
+
+ expected_fracs = test_cases[test_name]['ionic_fractions']
+ if isinstance(expected_fracs, u.Quantity):
+ expected_fracs = (expected_fracs / expected_fracs.sum()).value
+
+ if not np.allclose(ionic_fractions, expected_fracs):
+ errors.append(
+ f"The resulting ionic fractions are {ionic_fractions}, "
+ f"which are not equal to the expected ionic fractions "
+ f"of {expected_fracs}.")
+
+ expected_particles = [Particle(base_symbol, Z=charge) for charge in integer_charges]
+ expected_symbols = [particle.ionic_symbol for particle in expected_particles]
+ if not ionic_symbols == expected_symbols:
+ errors.append(
+ f"The resulting ionic symbols are {ionic_symbols}, "
+ f"which are not equal to the expected ionic symbols of "
+ f"{expected_symbols}.")
+
+ if errors:
+ errors.insert(0, (
+ f"The test of IonizationState named '{test_name}' has "
+ f"resulted in the following errors when attempting to "
+ f"iterate."))
+ errmsg = " ".join(errors)
+ pytest.fail(errmsg)
+
+ def test_slicing_error(self):
+ """
+ Test that an IonizationState instance cannot be sliced.
+ """
+ with pytest.raises(TypeError):
+ self.instances['Li'][1:3]
+
+ @pytest.mark.parametrize('index', [-1, 4, 'Li'])
+ def test_indexing_error(self, index):
+ """
+ Test that an `IonizationState` instance cannot be indexed
+ outside of the bounds of allowed integer charges.
+ """
+ with pytest.raises(AtomicError):
+ self.instances['Li'][index]
+
+ def test_normalization(self):
+ """
+ Test that `_is_normalized` returns `False` when there is an
+ error greater than the tolerance, and `True` after normalizing.
+ """
+ H = self.instances['H acceptable error']
+ assert not H._is_normalized(tol=1e-15)
+ H.normalize()
+ assert H._is_normalized(tol=1e-15)
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_identifications(self, test_name):
+ """
+ Test that the identification attributes for test
+ `IonizationState` instances match the expected values from the
+ `Particle` instance.
+ """
+
+ Identifications = collections.namedtuple(
+ "Identifications",
+ ["element", "isotope", "atomic_number"],
+ )
+
+ expected_identifications = Identifications(
+ self.instances[test_name].element,
+ self.instances[test_name].isotope,
+ self.instances[test_name].atomic_number,
+ )
+
+ expected_element = self.instances[test_name]._particle_instance.element
+ expected_isotope = self.instances[test_name]._particle_instance.isotope
+ expected_atomic_number = self.instances[test_name]._particle_instance.atomic_number
+
+ resulting_identifications = Identifications(
+ expected_element,
+ expected_isotope,
+ expected_atomic_number,
+ )
+
+ assert resulting_identifications == expected_identifications, (
+ f"For IonizationState test {test_name}, the resulting "
+ f"identifications of {resulting_identifications} differ "
+ f"from the expected identifications of "
+ f"{expected_identifications}."
+ )
+
+ @pytest.mark.parametrize('tol', [-1e-16, 1.0000001])
+ def test_invalid_tolerances(self, tol):
+ """Test that invalid tolerances raise appropriate errors."""
+ test_name = "Li"
+ instance = self.instances[test_name]
+ with pytest.raises(ValueError):
+ instance.tol = tol
+
+ @pytest.mark.parametrize('test_name', test_cases.keys())
+ def test_particle_instances(self, test_name):
+ """
+ Test that `IonizationState` returns the correct `Particle`
+ instances.
+ """
+ instance = self.instances[test_name]
+ atom = instance.base_particle
+ nstates = instance.atomic_number + 1
+ expected_particles = [Particle(atom, Z=Z) for Z in range(nstates)]
+ assert expected_particles == instance._particle_instances, (
+ f"The expected Particle instances of {expected_particles} "
+ f"are not all equal to the IonizationState particles of "
+ f"{instance._particle_instances} for test {test_name}.")
+
+ @pytest.mark.parametrize(
+ 'test_name',
+ [name for name in test_names if 'n_elem' in test_cases[name].keys()])
+ def test_electron_density_from_n_elem_ionic_fractions(self, test_name):
+ instance = self.instances[test_name]
+ n_elem = test_cases[test_name]['n_elem']
+ ionic_fractions = test_cases[test_name]['ionic_fractions']
+ assert instance.n_elem == n_elem, \
+ f"n_elem is not being stored correctly for test {test_name}"
+ assert np.isclose(
+ instance.n_e,
+ np.sum(n_elem * ionic_fractions * np.arange(instance.atomic_number + 1)),
+ rtol=1e-12, atol=0 * u.m ** -3), \
+ "n_e is not the expected value."
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_getitem(self, test_name):
+ """
+ Test that `IonizationState.__getitem__` returns the same value
+ when using equivalent keys (integer charge, particle symbol, and
+ `Particle` instance).
+
+ For example, if we create
+
+ >>> He_states = IonizationState('He', [0.2, 0.3, 0.5])
+
+ then this checks to make sure that `He_states[2]`,
+ `He_states['He 2+']`, and `He_states[Particle('He 2+')]` all
+ return the same result.
+
+ """
+ instance = self.instances[test_name]
+ particle_name = instance.base_particle
+
+ integer_charges = np.arange(instance.atomic_number + 1)
+ symbols = [particle_symbol(particle_name, Z=Z) for Z in integer_charges]
+ particles = instance._particle_instances
+
+ errors = []
+
+ # In the following loop, instance[key] will return a namedtuple
+ # or class which may contain Quantity objects with values of
+ # numpy.nan. Because of the difficulty of comparing nans in
+ # these objects, we compare the string representations instead
+ # (see Astropy issue #7901 on GitHub).
+
+ for keys in zip(integer_charges, symbols, particles):
+ set_of_str_values = {str(instance[key]) for key in keys}
+ if len(set_of_str_values) != 1:
+ errors.append(
+ f'\n\n'
+ f'The following keys in test {test_name} did not '
+ f'produce identical outputs as required: {keys}. '
+ f'The set containing string representations of'
+ f'the values is:\n\n{set_of_str_values}')
+
+ if errors:
+ pytest.fail(str.join('', errors))
+
+ @pytest.mark.parametrize('attr', ['integer_charge', 'ionic_fraction', 'ionic_symbol'])
+ def test_State_attrs(self, attr):
+ """
+ Test that an IonizationState instance returns something with the
+ correct attributes (be it a `collections.namedtuple` or a
+ `class`).
+ """
+ test_name = 'He'
+ state = self.instances[test_name][1]
+ assert hasattr(state, attr)
+
+ def test_State_equality_and_getitem(self):
+ test_name = 'He'
+ instance = self.instances[test_name]
+ charge = 2
+ symbol = 'He 2+'
+ result_from_charge = instance[charge]
+ result_from_symbol = instance[symbol]
+ assert result_from_charge == result_from_symbol
+
+
+IE = collections.namedtuple("IE", ["inputs", "expected_exception"])
+
+tests_for_exceptions = {
+ 'too few nstates': IE({'particle': 'H', 'ionic_fractions': [1.0]}, AtomicError),
+ 'too many nstates': IE({'particle': 'H', 'ionic_fractions': [1, 0, 0, 0]}, AtomicError),
+ 'ionic fraction < 0': IE({'particle': 'He', 'ionic_fractions': [-0.1, 0.1, 1]}, AtomicError),
+ 'ionic fraction > 1': IE({'particle': 'He', 'ionic_fractions': [1.1, 0.0, 0.0]}, AtomicError),
+
+ 'invalid ionic fraction': IE({
+ 'particle': 'He', 'ionic_fractions': [1.0, 0.0, 'a']
+ }, AtomicError),
+
+ 'bad n_elem units': IE({
+ 'particle': 'H', 'ionic_fractions': [0, 1], 'n_elem': 3 * u.m ** 3
+ }, u.UnitConversionError),
+
+ 'bad T_e units': IE({
+ 'particle': 'H', 'ionic_fractions': [0, 1], 'T_e': 1 * u.m
+ }, u.UnitConversionError),
+
+ 'negative n_elem': IE({
+ 'particle': 'He', 'ionic_fractions': [1.0, 0.0, 0.0], 'n_elem': -1 * u.m ** -3
+ }, AtomicError),
+
+ 'negative T_e': IE({
+ 'particle': 'He', 'ionic_fractions': [1.0, 0.0, 0.0], 'T_e': -1 * u.K
+ }, AtomicError),
+
+ 'redundant ndens': IE({
+ 'particle': 'H', 'ionic_fractions': np.array([3, 4]) * u.m ** -3, 'n_elem': 4 * u.m ** -3,
+ }, AtomicError),
+
+}
+
+
[email protected]('test', tests_for_exceptions.keys())
+def test_IonizationState_exceptions(test):
+ """
+ Test that appropriate exceptions are raised for inappropriate inputs
+ to `IonizationState`.
+ """
+ run_test(
+ IonizationState,
+ kwargs=tests_for_exceptions[test].inputs,
+ expected_outcome=tests_for_exceptions[test].expected_exception,
+ )
+
+
+kwargs = {
+ 'particle': 'He-4',
+ 'ionic_fractions': [0.2, 0.3, 0.5],
+ 'T_e': 5.0 * u.kK,
+ 'tol': 2e-14,
+ 'n_elem': 1e13 * u.cm ** -3
+}
+
+expected_properties = {
+ 'T_e': 5000.0 * u.K,
+ 'tol': 2e-14,
+ 'isotope': 'He-4',
+ 'element': 'He',
+ 'atomic_number': 2,
+ 'Z_mean': 1.3,
+ 'Z_rms': 1.51657508881031,
+ 'n_e': 1.3e19 * u.m ** -3,
+ 'n_elem': 1e19 * u.m ** -3,
+ 'integer_charges': [0, 1, 2],
+ 'ionic_fractions': np.array([0.2, 0.3, 0.5]),
+ 'ionic_symbols': ['He-4 0+', 'He-4 1+', 'He-4 2+'],
+ '_is_normalized()': True,
+ 'number_densities': np.array([2e18, 3e18, 5e18]) * u.m ** -3,
+ 'tol': 2e-14,
+ '__str__()': "<IonizationState instance for He-4>",
+}
+
+instance = IonizationState(**kwargs)
+
+
[email protected]('key', expected_properties.keys())
+def test_IonizationState_attributes(key):
+ """
+ Test a specific case that the `IonizationState` attributes are
+ working as expected.
+ """
+ expected = expected_properties[key]
+ actual = eval(f'instance.{key}')
+
+ if isinstance(expected, u.Quantity):
+ assert expected.unit == actual.unit, f"Unit mismatch for IonizationState.{key}"
+ assert np.allclose(expected, actual, atol=1e-15 * expected.unit), \
+ f"Quantity.value mismatch for IonizationState.{key}"
+ else:
+ try:
+ assert expected == actual
+ except ValueError:
+ assert np.allclose(expected, actual)
+
+
+def test_nans():
+ """
+ Test that when no ionic fractions or temperature are inputted,
+ the result is an array full of `~numpy.nan` of the right size.
+ """
+ element = 'He'
+ nstates = atomic_number(element) + 1
+ instance = IonizationState(element)
+ assert len(instance.ionic_fractions) == nstates, \
+ f"Incorrect number of ionization states for {element}"
+ assert np.all([np.isnan(instance.ionic_fractions)]), (
+ f"The ionic fractions for IonizationState are not defaulting "
+ f"to numpy.nan when not set by user.")
+
+
+def test_setting_ionic_fractions():
+ instance = IonizationState('He')
+ new_ionic_fractions = [0.2, 0.5, 0.3]
+ instance.ionic_fractions = new_ionic_fractions
+ assert np.allclose(instance.ionic_fractions, new_ionic_fractions)
+
+
+class Test_IonizationStateNumberDensitiesSetter:
+ """Test that setting IonizationState.number_densities works correctly."""
+
+ def setup_class(self):
+ self.element = 'H'
+ self.valid_number_densities = u.Quantity([0.1, 0.2], unit=u.m**-3)
+ self.expected_n_elem = np.sum(self.valid_number_densities)
+ self.expected_ionic_fractions = self.valid_number_densities / self.expected_n_elem
+ try:
+ self.instance = IonizationState(self.element)
+ except Exception:
+ pytest.fail("Unable to instantiate IonizationState with no ionic fractions.")
+
+ def test_setting_number_densities(self):
+ try:
+ self.instance.number_densities = self.valid_number_densities
+ except Exception:
+ pytest.fail(
+ f"Unable to set number densities of {self.element} to "
+ f"{self.valid_number_densities}.")
+
+ assert u.quantity.allclose(
+ self.instance.number_densities,
+ self.valid_number_densities), (
+ f"The number densities of {self.element} were set to "
+ f"{self.instance.number_densities} instead of the expceted "
+ f"value of {self.valid_number_densities}.")
+
+ def test_ionic_fractions(self):
+ assert np.allclose(
+ self.instance.ionic_fractions,
+ self.expected_ionic_fractions), (
+ "The IonizationState.ionic_fractions attribute was not set "
+ "correctly after the number densities were set.")
+
+ def test_n_elem(self):
+ assert u.quantity.allclose(
+ self.instance.n_elem,
+ self.expected_n_elem), (
+ "IonizationState.n_elem not set correctly after "
+ "number_densities was set.")
+
+ def test_n_e(self):
+ assert u.quantity.allclose(
+ self.instance.n_e,
+ self.valid_number_densities[1]), (
+ "IonizationState.n_e not set correctly after "
+ "number_densities was set.")
+
+ def test_that_negative_density_raises_error(self):
+ with pytest.raises(AtomicError, message="cannot be negative"):
+ self.instance.number_densities = u.Quantity([-0.1, 0.2], unit=u.m**-3)
+
+ def test_incorrect_number_of_charge_states_error(self):
+ with pytest.raises(AtomicError, message="Incorrect number of charge states"):
+ self.instance.number_densities = u.Quantity([0.1, 0.2, 0.3], unit=u.m**-3)
+
+ def test_incorrect_units_error(self):
+ with pytest.raises(u.UnitsError):
+ self.instance.number_densities = u.Quantity([0.1, 0.2], unit=u.kg)
+
+ # The following two tests are not related to setting the
+ # number_densities attribute, but are helpful to test anyway.
+
+ def test_T_e_isnan_when_not_set(self):
+ assert np.isnan(self.instance.T_e)
+
+ def test_kappa_isinf_when_not_set(self):
+ assert np.isinf(self.instance.kappa)
diff --git a/plasmapy/atomic/tests/test_ionization_states.py b/plasmapy/atomic/tests/test_ionization_states.py
new file mode 100644
index 00000000..53a81e8e
--- /dev/null
+++ b/plasmapy/atomic/tests/test_ionization_states.py
@@ -0,0 +1,837 @@
+import pytest
+import collections
+from typing import Dict
+from numbers import Real
+import itertools
+
+import numpy as np
+import astropy.units as u
+
+from plasmapy.utils import AtomicError, InvalidIsotopeError, run_test
+from plasmapy.atomic import (
+ State,
+ IonizationState,
+ IonizationStates,
+ atomic_number,
+ mass_number,
+ particle_symbol,
+ Particle,
+)
+
+
+def check_abundances_consistency(abundances: Dict[str, Real], log_abundances: Dict[str, Real]):
+ """
+ Test that a set of abundances is consistent with a set of the base
+ 10 logarithm of abundances.
+ """
+ assert abundances.keys() == log_abundances.keys(), (
+ f"Mismatch between keys from abundances and log_abundances.\n\n"
+ f"abundances.keys(): {abundances.keys()}\n\n"
+ f"log_abundances.keys(): {log_abundances.keys()}")
+
+ for element in abundances.keys():
+ abundance_from_abundances = abundances[element]
+ abundance_from_log_abundances = 10 ** log_abundances[element]
+ assert np.isclose(abundance_from_abundances, abundance_from_log_abundances), (
+ f"Mismatch between abundances and log_abundances.")
+
+def has_attribute(attribute, tests_dict):
+ cases = [test for test in tests_dict.keys() if attribute in tests_dict[test].keys()]
+ if cases:
+ return cases
+ else:
+ raise ValueError(f"No cases with attribute {attribute}")
+
+
+tests = {
+
+ 'basic': {
+ 'inputs': {'H': [0.1, 0.9], 'helium': (0.2, 0.3, 0.5)},
+ 'T_e': 1e6 * u.K,
+ 'tol': 1e-15,
+ 'abundances': {'hydrogen': 1.0, 'He': 0.1},
+ 'kappa': 1.5001,
+ },
+
+ 'quantities': {
+ 'inputs': {'H': np.array([10, 90]) * u.m ** -3, 'He': np.array([1, 9, 0]) * u.m ** -3},
+ },
+
+ 'just H': {
+ 'inputs': {'H': [0.1, 0.9]},
+ },
+
+ 'H acceptable error': {
+ 'inputs': {'H': [1.0, 1e-6]},
+ 'tol': 1e-5,
+ },
+
+ 'n': {
+ 'inputs': {'He': [1, 0, 0], 'H': [1, 0]},
+ 'abundances': {'H': 1, 'He': 0.1},
+ 'n': 1e9 * u.cm ** -3,
+ },
+
+ 'T_e and n': {
+ 'inputs': {'H': [0.9, 0.1], 'helium': [0.5, 0.3, 0.2]},
+ 'abundances': {'H': 1, 'He': 0.1},
+ 'T_e': 1e4 * u.K,
+ 'n': 1e15 * u.m ** -3,
+ 'kappa': np.inf,
+ },
+
+ 'log_abundances': {
+ 'inputs': {'H': [1, 0], 'He': [1, 0, 0]},
+ 'log_abundances': {'H': 1, 'He': 0},
+ 'n': 1e9 * u.cm ** -3,
+ },
+
+ 'elements & isotopes': {
+ 'inputs': {'H': [0.9, 0.1], 'He-3': [0.3, 0.7, 0.0], 'He-4': [0.29, 0.69, 0.02]},
+ 'abundances': {'H': 1, 'He-3': 1e-7, 'He-4': 0.1},
+ 'n': 1e12 * u.m ** -3,
+ },
+
+ 'ordered elements -> inputs': {
+ 'inputs': ['O', 'C', 'H', 'Fe', 'Ar'],
+ },
+
+ 'mixed and unordered elements and isotopes': {
+ 'inputs': ('Og', 'O', 'H', 'Fe-56', 'He', 'Li-7', 'Li-6'),
+ },
+
+ 'number densities -> inputs': {
+ 'inputs': {'H': np.array([2, 3]) * u.m ** -3, 'He': np.array([5, 7, 11]) * u.m ** -3},
+ },
+
+ 'number densities and n are both inputs': {
+ 'inputs': {'H': [0.1, 0.3] * u.cm ** -3},
+ 'n': 1e-5 * u.mm ** -3,
+ }
+
+}
+
+test_names = tests.keys()
+
+
+class TestIonizationStates:
+
+ @classmethod
+ def setup_class(cls):
+ cls.instances = {}
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_instantiation(self, test_name):
+ try:
+ self.instances[test_name] = IonizationStates(**tests[test_name])
+ except Exception:
+ pytest.fail(f"Cannot create IonizationStates instance for test='{test_name}'")
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_no_exceptions_from_str(self, test_name):
+ self.instances[test_name].__str__()
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_no_exceptions_from_repr(self, test_name):
+ self.instances[test_name].__repr__()
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_no_exceptions_from_info(self, test_name):
+ self.instances[test_name].info()
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_simple_equality(self, test_name):
+ """Test that __eq__ is not extremely broken."""
+ a = IonizationStates(**tests[test_name])
+ b = IonizationStates(**tests[test_name])
+ assert a == a, f"IonizationStates instance does not equal itself."
+ assert a == b, f"IonizationStates instance does not equal identical instance."
+
+ @pytest.mark.parametrize(
+ 'test_name',
+ [test_name for test_name in test_names if isinstance(tests[test_name]['inputs'], dict)],
+ )
+ def test_that_particles_were_set_correctly(self, test_name):
+ input_particles = tests[test_name]['inputs'].keys()
+ particles = [Particle(input_particle) for input_particle in input_particles]
+ expected_particles = {p.particle for p in particles}
+ actual_particles = {particle for particle in self.instances[test_name].ionic_fractions.keys()}
+
+ assert actual_particles == expected_particles, (
+ f"For test='{test_name}', the following should be equal:\n"
+ f" actual_particles = {actual_particles}\n"
+ f"expected_particles = {expected_particles}")
+
+ @pytest.mark.parametrize('test_name', has_attribute('abundances', tests))
+ def test_that_abundances_kwarg_sets_abundances(self, test_name):
+ try:
+ actual_abundances = self.instances[test_name].abundances
+ except Exception as exc:
+ pytest.fail("Unable to access abundances.")
+
+ elements = set(self.instances[test_name].base_particles)
+ elements_from_abundances = set(actual_abundances.keys())
+
+ if not elements.issubset(elements_from_abundances):
+ pytest.fail(
+ f"The elements whose IonizationStates are being kept "
+ f"track of ({elements}) are not a subset of the "
+ f"elements whose abundances are being kept track of "
+ f"({elements_from_abundances}) for test {test_name}.")
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_that_elements_and_isotopes_are_sorted(self, test_name):
+ elements = self.instances[test_name].base_particles
+ before_sorting = []
+ for element in elements:
+ atomic_numb = atomic_number(element)
+ try:
+ mass_numb = mass_number(element)
+ except InvalidIsotopeError:
+ mass_numb = 0
+ before_sorting.append((atomic_numb, mass_numb))
+ after_sorting = sorted(before_sorting)
+
+ assert before_sorting == after_sorting, (
+ f"Elements/isotopes are not sorted for test='{test_name}':\n"
+ f" before_sorting = {before_sorting}\n"
+ f" after_sorting = {after_sorting}\n"
+ f"where above is (atomic_number, mass_number if isotope else 0)")
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_that_ionic_fractions_are_set_correctly(self, test_name):
+
+ errmsg = ""
+
+ elements_actual = self.instances[test_name].base_particles
+ inputs = tests[test_name]["inputs"]
+
+ if isinstance(inputs, dict):
+ input_keys = list(tests[test_name]["inputs"].keys())
+
+ input_keys = sorted(
+ input_keys,
+ key=lambda k: (atomic_number(k), mass_number(k) if Particle(k).isotope else 0)
+ )
+
+ for element, input_key in zip(elements_actual, input_keys):
+ expected = tests[test_name]["inputs"][input_key]
+
+ if isinstance(expected, u.Quantity):
+ expected = np.array(expected.value / np.sum(expected.value))
+
+ actual = self.instances[test_name].ionic_fractions[element]
+
+ if not np.allclose(actual, expected):
+ errmsg += (
+ f"\n\nThere is a discrepancy in ionic fractions for "
+ f"({test_name}, {element}, {input_key})\n"
+ f" expected = {expected}\n"
+ f" actual = {actual}")
+
+ if not isinstance(actual, np.ndarray) or isinstance(actual, u.Quantity):
+ raise AtomicError(f"\n\nNot a numpy.ndarray: ({test_name}, {element})")
+ else:
+ elements_expected = {particle_symbol(element) for element in inputs}
+
+ assert set(self.instances[test_name].base_particles) == elements_expected
+
+ for element in elements_expected:
+ assert all(np.isnan(self.instances[test_name].ionic_fractions[element]))
+ if errmsg:
+ pytest.fail(errmsg)
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_getitem_element(self, test_name):
+ """Test that __get_item__ returns an IonizationState instance"""
+ instance = self.instances[test_name]
+
+ for key in instance.base_particles:
+
+ try:
+ expected = instance.ionic_fractions[key]
+ except Exception as exc:
+ pytest.fail(f"Unable to get ionic_fractions for '{key}' in test='{test_name}'.")
+
+ try:
+ actual = instance[key].ionic_fractions
+ except Exception as exc:
+ pytest(
+ f"Unable to get item {key} in test={test_name}."
+ )
+
+ try:
+ if all(np.isnan(expected)):
+ test_passed = True
+ else:
+ test_passed = np.allclose(expected, actual)
+ except Exception:
+ raise TypeError(
+ f"For test='{test_name}' and key='{key}', cannot "
+ f"compare expected ionic fractions of {expected} "
+ f"with the resulting ionic fractions of {actual}.") from None
+
+ if not test_passed:
+ pytest.fail(
+ f"For test='{test_name}' and key='{key}', the expected "
+ f"ionic fractions of {expected} are not all equal "
+ f"to the resulting ionic fractions of {actual}.")
+
+ @pytest.mark.parametrize('test_name', test_names)
+ def test_getitem_element_intcharge(self, test_name):
+ instance = self.instances[test_name]
+ for particle in instance.base_particles:
+ for int_charge in range(0, atomic_number(particle) + 1):
+ actual = instance[particle, int_charge].ionic_fraction
+ expected = instance.ionic_fractions[particle][int_charge]
+ # We only need to check if one is broken
+ if not np.isnan(actual) and np.isnan(expected):
+ assert np.isclose(actual, expected), (
+ f"Indexing broken for:\n"
+ f" test = '{test_name}'\n"
+ f" particle = '{particle}'")
+
+ @pytest.mark.parametrize('test_name', [
+ test_name for test_name in test_names
+ if isinstance(tests[test_name]['inputs'], dict)
+ ])
+ def test_normalization(self, test_name):
+ instance = self.instances[test_name]
+ instance.normalize()
+ not_normalized_elements = []
+ for element in instance.base_particles:
+ is_not_normalized = not np.isclose(
+ np.sum(instance.ionic_fractions[element]),
+ 1,
+ atol=1e-19,
+ rtol=0,
+ )
+
+ if is_not_normalized:
+ not_normalized_elements.append(element)
+
+ if not_normalized_elements:
+ pytest.fail(
+ f"In test = '{test_name}', ionic fractions for the "
+ f"following particles were not normalized: "
+ f"{', '.join(not_normalized_elements)}.")
+
+
+def test_abundances_consistency():
+ """Test that ``abundances`` and ``log_abundances`` are consistent."""
+
+ inputs = {'H': [1, 0], 'He': [1, 0, 0]}
+ abundances = {'H': 1.0, 'He': 0.1}
+ elements = abundances.keys()
+
+ log_abundances = {element: np.log10(abundances[element]) for element in elements}
+
+ instance_nolog = IonizationStates(inputs, abundances=abundances)
+ instance_log = IonizationStates(inputs, log_abundances=log_abundances)
+
+ for element in elements:
+ assert np.allclose(
+ instance_log.abundances[element],
+ instance_nolog.abundances[element],
+ ), 'abundances not consistent.'
+
+ for element in elements:
+ assert np.allclose(
+ instance_log.log_abundances[element],
+ instance_nolog.log_abundances[element],
+ ), 'log_abundances not consistent.'
+
+
+class TestIonizationStatesItemAssignment:
+ """
+ Test IonizationStates.__setitem__ and exceptions.
+ """
+
+ @classmethod
+ def setup_class(cls):
+ cls.states = IonizationStates({'H': [0.9, 0.1], 'He': [0.5, 0.4999, 1e-4]})
+
+ @pytest.mark.parametrize("element, new_states", [
+ ('H', [np.nan, np.nan]),
+ ('He', [np.nan, np.nan, np.nan]),
+ ('H', [0.1, 0.9]),
+ ('He', [0.89, 0.1, 0.01]),
+ ])
+ def test_setitem(self, element, new_states):
+ """Test item assignment in an IonizationStates instance."""
+ try:
+ self.states[element] = new_states
+ except Exception:
+ pytest.fail(
+ "Unable to change ionic fractions for an "
+ "IonizationStates instance.")
+ resulting_states = self.states[element].ionic_fractions
+
+ assert np.any([
+ np.allclose(resulting_states, new_states),
+ np.all(np.isnan(resulting_states)) and np.all(np.isnan(new_states)),
+ ])
+
+ @pytest.mark.parametrize('base_particle, new_states, expected_exception', [
+ ('H', (0, 0.9), ValueError),
+ ('H', (-0.1, 1.1), ValueError),
+ ('H', (0.0, 1.0, 0.0), ValueError),
+ ('Li', (0.0, 1.0, 0.0, 0.0), KeyError),
+ ('sdfasd', (0, 1), KeyError),
+ (KeyError, KeyError, KeyError),
+ ])
+ def test_setitem_errors(self, base_particle, new_states, expected_exception):
+ with pytest.raises(expected_exception):
+ self.states[base_particle] = new_states
+
+
+class TestIonizationStatesDensities:
+
+ @classmethod
+ def setup_class(cls):
+
+ cls.initial_ionfracs = {'H': np.array([0.87, 0.13]), 'He': np.array([0.24, 0.37, 0.39])}
+ cls.abundances = {'H': 1.0, 'He': 0.0835}
+ cls.n = 10 * u.m ** -3
+
+ cls.expected_densities = {
+ 'H': np.array([8.7, 1.3]) * u.m ** -3,
+ 'He': np.array([0.2004, 0.30895, 0.32565]) * u.m ** -3,
+ }
+
+ cls.expected_electron_density = 2.26025 * u.m ** -3
+ cls.states = IonizationStates(cls.initial_ionfracs, abundances=cls.abundances, n=cls.n)
+
+ def test_electron_density(self):
+ assert np.isclose(self.states.n_e.value, self.expected_electron_density.value), (
+ 'Mismatch in electron density calculation:\n'
+ f'Calculated = {self.states.n_e}\n'
+ f'Expected = {self.expected_electron_density}')
+
+ @pytest.mark.parametrize('elem', ['H', 'He'])
+ def test_number_densities(self, elem):
+ assert np.allclose(
+ self.states.number_densities[elem].value,
+ self.expected_densities[elem].value), (
+ f"Mismatch in number densities for {elem}\n"
+ f"Calculated = {self.states.number_densities[elem]}\n"
+ f"Expected = {self.expected_electron_density}")
+
+
+class TestIonizationStatesAttributes:
+
+ @classmethod
+ def setup_class(cls):
+ cls.elements = ['H', 'He', 'Li', 'Fe']
+ cls.instance = IonizationStates(cls.elements)
+ cls.new_n = 5.153 * u.cm ** -3
+
+ @pytest.mark.parametrize("uninitialized_attribute", ['T_e', 'n', 'n_e'])
+ def test_attribute_defaults_to_nan(self, uninitialized_attribute):
+ command = f"self.instance.{uninitialized_attribute}"
+ default_value = eval(command)
+ assert np.isnan(default_value), (
+ f"{uninitialized_attribute} does not default to nan but "
+ f"instead defaults to {default_value}.")
+
+ def test_kappa_defaults_to_inf(self):
+ assert np.isinf(self.instance.kappa), \
+ "kappa does not default to a value of inf."
+
+ @pytest.mark.parametrize(
+ "uninitialized_attribute",
+ ["number_densities", "ionic_fractions"])
+ def test_attribute_defaults_to_dict_of_nans(self, uninitialized_attribute):
+ command = f"self.instance.{uninitialized_attribute}"
+ default_value = eval(command)
+ assert list(default_value.keys()) == self.elements, "Incorrect base particle keys."
+ for element in self.elements:
+ assert len(default_value[element]) == atomic_number(element) + 1, \
+ f"Incorrect number of ionization levels for {element}."
+ assert np.all(np.isnan(default_value[element])), (
+ f"The values do not default to an array of nans for "
+ f"{element}.")
+
+ @pytest.mark.parametrize("uninitialized_attribute", ["abundances", "log_abundances"])
+ def test_abundances_default_to_nans(self, uninitialized_attribute):
+ command = f"self.instance.{uninitialized_attribute}"
+ default_value = eval(command)
+ for element in self.elements:
+ assert isinstance(default_value[element], Real)
+ assert np.isnan(default_value[element])
+
+ @pytest.mark.parametrize(
+ "attribute, invalid_value, expected_exception", [
+ ('T_e', '5 * u.m', u.UnitsError),
+ ('T_e', '-1 * u.K', AtomicError),
+ ('n', '5 * u.m', u.UnitsError),
+ ('n', '-1 * u.m ** -3', AtomicError),
+ ('ionic_fractions', {'H': [0.3, 0.7], 'He': [-0.1, 0.4, 0.7]}, AtomicError),
+ ('ionic_fractions', {'H': [0.3, 0.7], 'He': [1.01, 0.0, 0.7]}, AtomicError),
+ ('ionic_fractions', {'H': [0.3, 0.6], 'He': [1.0, 0.0, 0.0]}, AtomicError),
+ ('ionic_fractions', {'H': [1.0, 0.0]}, AtomicError),
+ ])
+ def test_attribute_exceptions(self, attribute, invalid_value, expected_exception):
+
+ command = f"self.instance.{attribute} = {invalid_value}"
+ errmsg = f"No {expected_exception} was raised for command\n\n: {command}"
+
+ with pytest.raises(expected_exception, message=errmsg):
+ exec(command)
+
+ def test_setting_ionic_fractions_for_single_element(self):
+ """
+ Test that __setitem__ correctly sets new ionic fractions when
+ used for just H, while not changing the ionic fractions for He
+ from the uninitialized default of an array of nans of length 3.
+ """
+ self.new_fractions = [0.3, 0.7]
+ self.instance['H'] = self.new_fractions
+ resulting_fractions = self.instance.ionic_fractions['H']
+ assert np.allclose(self.new_fractions, resulting_fractions), \
+ "Ionic fractions for H not set using __setitem__."
+ assert 'He' in self.instance.ionic_fractions.keys(), (
+ "He is missing in ionic_fractions after __setitem__ was "
+ "used to set H ionic fractions.")
+ assert np.all(np.isnan(self.instance.ionic_fractions['He'])), (
+ "He ionic fractions are not all nans after __setitem__ "
+ "was used to set H ionic fractions.")
+
+ @pytest.mark.parametrize(
+ "key, invalid_fracs, expected_exception",[
+ ('H', [-0.01, 1.01], ValueError),
+ ('H', [0.4, 0.5], ValueError),
+ ('H', [0.5, 0.5, 0.0], ValueError),
+ ('He', [0.5, 0.5], ValueError),
+ ('He', [0.1, 0.9, 0.0, 0.0], ValueError),
+ ('He', [0.9, 0.1, 0.0] * u.m ** -2, ValueError),
+ ('He', [-0.01, 0.99, 0.02], ValueError),
+ ('He', [1.01, -0.02, 0.01], ValueError),
+ ])
+ def test_setting_invalid_ionfracs(self, key, invalid_fracs, expected_exception):
+ errmsg = (
+ f"No {expected_exception} is raised when trying to assign "
+ f"{invalid_fracs} to {key} in an IonizationStates instance.")
+ with pytest.raises(expected_exception, message=errmsg):
+ self.instance[key] = invalid_fracs
+
+ def test_setting_incomplete_abundances(self):
+ new_abundances = {'H': 1, 'He': 0.1, 'Fe': 1e-5, 'Au': 1e-8} # missing lithium
+ with pytest.raises(AtomicError):
+ self.instance.abundances = new_abundances
+
+ def test_setting_abundances(self):
+ new_abundances = {'H': 1, 'He': 0.1, 'Li': 1e-4, 'Fe': 1e-5, 'Au': 1e-8}
+
+ log_new_abundances = {
+ element: np.log10(new_abundances[element])
+ for element in new_abundances.keys()
+ }
+
+ try:
+ self.instance.abundances = new_abundances
+ except Exception:
+ pytest(f"Could not set abundances to {new_abundances}.")
+ else:
+ check_abundances_consistency(self.instance.abundances, self.instance.log_abundances)
+
+ try:
+ self.instance.log_abundances = log_new_abundances
+ except Exception:
+ pytest.fail(f"Could not set log_abundances to {log_new_abundances}.")
+ else:
+ check_abundances_consistency(self.instance.abundances, self.instance.log_abundances)
+
+ @pytest.mark.parametrize(
+ "invalid_indices", [
+ (1, 2, 3),
+ 'C',
+ 'H-1',
+ ('Fe', -1),
+ ('Fe', 27),
+ ('He', -1),
+ ('He', 3),
+ ('Fe', slice(3, 7)),
+ ])
+ def test_invalid_indices(self, invalid_indices):
+ with pytest.raises(IndexError):
+ self.instance[invalid_indices]
+
+ @pytest.mark.parametrize("index", ["H", "Fe"])
+ def test_getitem_one_index(self, index):
+ instance = self.instance
+ result = instance[index]
+
+ if np.all(np.isnan(instance.number_densities[index])):
+ inputs = instance.ionic_fractions[index]
+ else:
+ inputs = instance.number_densities[index]
+
+ expected = IonizationState(index, inputs, T_e=instance.T_e, kappa=instance.kappa)
+
+ assert isinstance(result, IonizationState)
+ assert result == expected
+
+ @pytest.mark.parametrize("indices", [("H", 1), ("Fe", 6)])
+ def test_getitem_two_indices(self, indices):
+ instance = self.instance
+ result = instance[indices]
+
+ particle = indices[0]
+ integer_charge = indices[1]
+
+ assert isinstance(result, State)
+ assert result.integer_charge == integer_charge
+
+ expected_ionic_fraction = instance.ionic_fractions[particle][integer_charge]
+
+ assert np.any([
+ np.isclose(result.ionic_fraction, expected_ionic_fraction),
+ np.isnan(result.ionic_fraction) and np.isnan(expected_ionic_fraction),
+ ])
+
+ assert result.ionic_symbol == particle_symbol(particle, Z=integer_charge)
+
+ def test_setting_n(self):
+ try:
+ self.instance.n = self.new_n
+ except Exception:
+ pytest.fail("Unable to set number density scaling factor attribute")
+ if not u.quantity.allclose(self.instance.n, self.new_n):
+ pytest.fail("Number density scaling factor was not set correctly.")
+ if not self.instance.n.unit == u.m ** -3:
+ pytest.fail("Incorrect units for new number density.")
+
+ def test_resetting_valid_densities(self):
+ """
+ Test that item assignment can be used to set number densities
+ that preserve the total element number density.
+ """
+
+ element = "H"
+ valid_ionic_fractions = [0.54, 0.46]
+ original_n_elem = np.sum(self.instance.number_densities[element])
+ valid_number_densities = valid_ionic_fractions * original_n_elem
+
+ try:
+ self.instance[element] = valid_number_densities
+ except Exception:
+ pytest.fail("Unable to set valid number densities using item assignment.")
+
+ assert u.quantity.allclose(
+ self.instance.ionic_fractions[element],
+ valid_ionic_fractions,
+ ), "Item assignment of valid number densities did not yield correct ionic fractions."
+
+ assert u.quantity.allclose(
+ self.instance.number_densities[element],
+ valid_number_densities,
+ ), "Item assignment of valid number densities did not yield correct number densities."
+
+ def test_resetting_invalid_densities(self):
+ """
+ Test that item assignment with number densities that would
+ change the total element number density raises an exception.
+ """
+ element = "H"
+ original_n_elem = np.sum(self.instance.number_densities[element])
+ invalid_number_densities = np.array([1.0001, 0]) * original_n_elem
+ with pytest.raises(ValueError):
+ self.instance[element] = invalid_number_densities
+
+ def test_elemental_abundances_not_quantities(self):
+ for element in self.instance.base_particles:
+ assert not isinstance(self.instance.abundances[element], u.Quantity)
+
+ @pytest.mark.parametrize("element", ["H", "He", "Fe"])
+ def test_ionic_fractions_not_quantities(self, element):
+ ionic_fractions = self.instance.ionic_fractions[element]
+ if isinstance(ionic_fractions, u.Quantity):
+ pytest.fail(f"The ionic fractions of {element} are a Quantity but should not be.")
+
+ def test_that_iron_ionic_fractions_are_still_undefined(self):
+ assert 'Fe' in self.instance.ionic_fractions.keys()
+ iron_fractions = self.instance.ionic_fractions['Fe']
+ assert len(iron_fractions) == atomic_number('Fe') + 1
+ assert np.all(np.isnan(iron_fractions))
+
+ def test_base_particles(self):
+ """
+ Test that the original base particles remain as the base
+ particles after performing a bunch of operations that should not
+ change them.
+ """
+ assert self.instance.base_particles == self.elements
+
+ def test_base_particles_equal_ionic_fraction_particles(self):
+ assert self.instance.base_particles == list(self.instance.ionic_fractions.keys())
+
+
+IE = collections.namedtuple("IE", ["inputs", "expected_exception"])
+
+tests_for_exceptions = {
+
+ 'wrong type': IE({
+ "inputs": None,
+ }, AtomicError),
+
+ 'not normalized': IE({
+ "inputs": {'He': [0.4, 0.5, 0.0]}, "tol": 1e-9
+ }, AtomicError),
+
+ 'negative ionfrac': IE({
+ "inputs": {'H': [-0.1, 1.1]},
+ }, AtomicError),
+
+ 'ion': IE({
+ "inputs": {'H': [0.1, 0.9], 'He+': [0.0, 0.9, 0.1]},
+ }, AtomicError),
+
+ 'repeat elements': IE({
+ "inputs": {'H': [0.1, 0.9], "hydrogen": [0.2, 0.8]},
+ }, AtomicError),
+
+ 'isotope of element': IE({
+ "inputs": {'H': [0.1, 0.9], "D": [0.2, 0.8]},
+ }, AtomicError),
+
+ 'negative abundance': IE({
+ "inputs": {"H": [0.1, 0.9], "He": [0.4, 0.5, 0.1]},
+ "abundances": {"H": 1, "He": -0.1},
+ }, AtomicError),
+
+ 'imaginary abundance': IE({
+ "inputs": {"H": [0.1, 0.9], "He": [0.4, 0.5, 0.1]},
+ "abundances": {"H": 1, "He": 0.1j},
+ }, AtomicError),
+
+ 'wrong density units': IE({
+ "inputs": {"H": [10, 90] * u.m ** -3, "He": [0.1, 0.9, 0] * u.m ** -2},
+ "abundances": {"H": 1, "He": 0.1},
+ }, AtomicError),
+
+ 'abundance redundance': IE({
+ "inputs": {"H": [10, 90] * u.m ** -3, "He": [0.1, 0.9, 0] * u.m ** -3},
+ "abundances": {"H": 1, "He": 0.1},
+ }, AtomicError),
+
+ 'abundance contradiction': IE({
+ "inputs": {"H": [10, 90] * u.m ** -3, "He": [0.1, 0.9, 0] * u.m ** -3},
+ "abundances": {"H": 1, "He": 0.11},
+ }, AtomicError),
+
+ 'kappa too small': IE({
+ "inputs": ["H"],
+ "kappa": 1.499999,
+ }, AtomicError),
+
+ 'negative n': IE({
+ "inputs": ["H"],
+ "n": -1 * u.cm ** -3,
+ }, AtomicError),
+
+ 'negative T_e': IE({
+ "inputs": ["H-1"],
+ "T_e": -1 * u.K,
+ }, AtomicError),
+}
+
+
[email protected]('test_name', tests_for_exceptions.keys())
+def test_exceptions_upon_instantiation(test_name):
+ """
+ Test that appropriate exceptions are raised for inappropriate inputs
+ to IonizationStates when first instantiated.
+ """
+ run_test(
+ IonizationStates,
+ kwargs=tests_for_exceptions[test_name].inputs,
+ expected_outcome=tests_for_exceptions[test_name].expected_exception,
+ )
+
+
+class TestIonizationStatesDensityEqualities:
+ """
+ Test that IonizationStates instances are equal or not equal to each
+ other as they should be for different combinations of inputs
+ related to ionic_fractions, number densities, and abundances.
+ """
+
+ @classmethod
+ def setup_class(cls):
+
+ # Create arguments to IonizationStates that are all consistent
+ # with each other.
+
+ cls.ionic_fractions = {'H': [0.9, 0.1], 'He': [0.99, 0.01, 0.0]}
+ cls.abundances = {'H': 1, 'He': 0.08}
+ cls.n = 5.3 * u.m ** -3
+ cls.number_densities = {
+ element: cls.ionic_fractions[element] * cls.n * cls.abundances[element]
+ for element in cls.ionic_fractions.keys()
+ }
+
+ # The keys that begin with 'ndens' have enough information to
+ # yield the number_densities attribute, whereas the keys that
+ # begin with "no_ndens" do not.
+
+ cls.dict_of_kwargs = {
+ 'ndens1': {'inputs': cls.ionic_fractions, 'abundances': cls.abundances, 'n': cls.n},
+ 'ndens2': {'inputs': cls.number_densities},
+ 'no_ndens3': {'inputs': cls.ionic_fractions},
+ 'no_ndens4': {'inputs': cls.ionic_fractions, 'abundances': cls.abundances},
+ 'no_ndens5': {'inputs': cls.ionic_fractions, 'n': cls.n},
+ }
+
+ cls.instances = {
+ key: IonizationStates(**cls.dict_of_kwargs[key])
+ for key in cls.dict_of_kwargs.keys()
+ }
+
+ @pytest.mark.parametrize("test_key", ['ndens1', 'ndens2'])
+ def test_number_densities_defined(self, test_key):
+ number_densities = self.instances[test_key].number_densities
+ for base_particle in self.instances[test_key].base_particles:
+ assert not np.any(np.isnan(number_densities[base_particle])), (
+ f"Test {test_key} should have number densities "
+ f"defined, but doesn't.")
+
+ @pytest.mark.parametrize("test_key", ['no_ndens3', 'no_ndens4', 'no_ndens5'])
+ def test_number_densities_undefined(self, test_key):
+ number_densities = self.instances[test_key].number_densities
+ for base_particle in self.instances[test_key].base_particles:
+ assert np.all(np.isnan(number_densities[base_particle])), (
+ f"Test {test_key} should not have number densities "
+ f"defined, but does.")
+
+ @pytest.mark.parametrize("this, that", itertools.product(
+ ['ndens1', 'ndens2', 'no_ndens3', 'no_ndens4', 'no_ndens5'],
+ repeat=2,
+ ))
+ def test_equality(self, this, that):
+ """
+ Test that the IonizationStates instances that should provide
+ ``number_densities`` are all equal to each other. Test that the
+ instances that should not provide ``number_densities`` are all
+ equal to each other. Test that each instance that should
+ provide ``number_densities`` is not equal to each instance that
+ should not provide ``number_densities``.
+ """
+ expect_equality = this[0:4] == that[0:4]
+ are_equal = self.instances[this] == self.instances[that]
+ if expect_equality != are_equal:
+ print(f"{this} kwargs:\n {self.dict_of_kwargs[this]}\n")
+ self.instances[this].info()
+ print()
+ print(f"{that} kwargs:\n {self.dict_of_kwargs[that]}\n")
+ self.instances[that].info()
+ descriptor = "equal" if expect_equality else "unequal"
+ pytest.fail(
+ f"Cases {this} and {that} should be {descriptor} but "
+ f"are not.")
+
+
+def test_number_density_assignment():
+ instance = IonizationStates(["H", "He"])
+ number_densities = [2, 3, 5] * u.m ** -3
+ instance["He"] = number_densities
diff --git a/plasmapy/atomic/tests/test_particle_class.py b/plasmapy/atomic/tests/test_particle_class.py
index 59b282f1..881e74e0 100644
--- a/plasmapy/atomic/tests/test_particle_class.py
+++ b/plasmapy/atomic/tests/test_particle_class.py
@@ -1,12 +1,17 @@
import pytest
-import numpy as np
-from astropy import units as u
import inspect
-from plasmapy.utils import roman
+import collections
-from ...constants import m_p, m_e, m_n, e, c
+import numpy as np
+from astropy import units as u
-from ...utils import (
+from plasmapy.utils import roman
+from plasmapy.constants import m_p, m_e, m_n, e, c
+from plasmapy.atomic.atomic import known_isotopes
+from plasmapy.atomic.isotopes import _Isotopes
+from plasmapy.atomic.particle_class import Particle
+from plasmapy.atomic.special_particles import ParticleZoo
+from plasmapy.utils import (
AtomicWarning,
AtomicError,
MissingAtomicDataError,
@@ -20,12 +25,7 @@
run_test_equivalent_calls,
)
-from ..atomic import known_isotopes
-from ..isotopes import _Isotopes
-from ..particle_class import Particle
-from ..special_particles import ParticleZoo
-
-# (arg, kwargs, results_dict
+# (arg, kwargs, results_dict)
test_Particle_table = [
('neutron', {},
@@ -559,7 +559,7 @@ def test_Particle_warnings(arg, kwargs, attribute, warning):
def test_Particle_cmp():
- """Test __eq__ and __ne__ in the Particle class."""
+ """Test ``__eq__`` and ``__ne__`` in the Particle class."""
proton1 = Particle('p+')
proton2 = Particle('proton')
electron = Particle('e-')
@@ -589,7 +589,7 @@ def test_Particle_cmp():
@pytest.mark.parametrize('isotope, ion', nuclide_mass_and_mass_equiv_table)
def test_particle_class_mass_nuclide_mass(isotope: str, ion: str):
"""
- Test that the `mass` and `nuclide_mass` attributes return
+ Test that the ``mass`` and ``nuclide_mass`` attributes return
equivalent values when appropriate. The inputs should generally be
an isotope with no charge information, and a fully ionized ion of
that isotope, in order to make sure that the nuclide mass of the
@@ -610,12 +610,13 @@ def test_particle_class_mass_nuclide_mass(isotope: str, ion: str):
else:
- inputerrmsg = (f"isotope = {repr(isotope)} and ion = {repr(ion)} are "
- f"not valid inputs to this test. The inputs should be "
- f"an isotope with no charge information, and a fully "
- f"ionized ion of that isotope, in order to make sure "
- f"that the nuclide mass of the isotope equals the mass "
- f"of the ion.")
+ inputerrmsg = (
+ f"isotope = {repr(isotope)} and ion = {repr(ion)} are "
+ f"not valid inputs to this test. The inputs should be "
+ f"an isotope with no charge information, and a fully "
+ f"ionized ion of that isotope, in order to make sure "
+ f"that the nuclide mass of the isotope equals the mass "
+ f"of the ion.")
assert Isotope.isotope and not Isotope.ion, inputerrmsg
assert Isotope.isotope == Ion.isotope, inputerrmsg
@@ -634,7 +635,7 @@ def test_particle_half_life_string():
"""
Find the first isotope where the half-life is stored as a string
(because the uncertainties are too great), and tests that requesting
- the half-life of that isotope causes a MissingAtomicDataWarning
+ the half-life of that isotope causes a `MissingAtomicDataWarning`
whilst returning a string.
"""
@@ -701,8 +702,8 @@ def opposite(particle):
opposite_particle = ~particle
except Exception as exc:
raise InvalidParticleError(
- f"The unary ~ (invert) operator is unable to find the "
- f"antiparticle of {particle}.") from exc
+ f"The unary ~ (invert) operator is unable to find the "
+ f"antiparticle of {particle}.") from exc
return opposite_particle
@@ -769,3 +770,41 @@ def test_particleing_a_particle(arg):
f"Particle({repr(arg)}) is the same object in memory as "
f"Particle(Particle({repr(arg)})), when it is intended to "
f"create a new object in memory (e.g., a copy).")
+
+
[email protected]("key", [Particle('H'), Particle('e+')])
+def test_that_object_can_be_dict_key(key):
+ """
+ Test that ``key`` can be used as the key of a `dict`.
+
+ This test will fail if ``key`` does not equal itself or if ``key``
+ is not hashable. If this test fails, there is a problem with the
+ ``__eq__`` and ``__hash__`` methods of ``key``.
+
+ In most cases, objects that are mutable should not be hashable since
+ they may change.
+
+ """
+ # TODO: I wrote this to be pretty general since I felt like
+ # TODO: procrastinating other things, so we can probably put this
+ # TODO: into utils.pytest_helpers later on. There are likely other
+ # TODO: classes that should be able to be used as keys of dicts.
+
+ value = 42
+
+ try:
+ dictionary = {key: value}
+ except Exception as exc:
+ error_message = f"{key} is not a valid key for a dict. "
+ if not isinstance(key, collections.Hashable):
+ error_message += f"{key} is not hashable. "
+ try:
+ key_equals_itself = key == key
+ except Exception:
+ error_message += f"{key} == {key} cannot be evaluated. "
+ else:
+ if not key_equals_itself:
+ error_message += f"{key} does not equal itself."
+ raise TypeError(error_message) from exc
+
+ assert dictionary[key] is value
diff --git a/plasmapy/physics/tests/test_parameters.py b/plasmapy/physics/tests/test_parameters.py
index 63686127..03ca5588 100644
--- a/plasmapy/physics/tests/test_parameters.py
+++ b/plasmapy/physics/tests/test_parameters.py
@@ -809,28 +809,28 @@ def test_inertial_length():
with pytest.raises(ValueError):
inertial_length(-5 * u.m ** -3, particle='p')
- with pytest.raises(ValueError):
+ with pytest.raises(InvalidParticleError):
inertial_length(n_i, particle=-135)
with pytest.warns(u.UnitsWarning):
inertial_length_no_units = inertial_length(1e19, particle='p')
assert inertial_length_no_units == inertial_length(1e19 * u.m ** -3, particle='p')
- assert inertial_length(n_e).unit.is_equivalent(u.m)
+ assert inertial_length(n_e, 'e-').unit.is_equivalent(u.m)
- assert np.isclose(inertial_length(1 * u.cm ** -3).cgs.value, 5.31e5, rtol=1e-3)
+ assert np.isclose(inertial_length(1 * u.cm ** -3, 'e-').cgs.value, 5.31e5, rtol=1e-3)
with pytest.warns(u.UnitsWarning):
- inertial_length(5)
+ inertial_length(5, 'e-')
with pytest.raises(u.UnitConversionError):
- inertial_length(5 * u.m)
+ inertial_length(5 * u.m, 'e-')
with pytest.raises(ValueError):
- inertial_length(-5 * u.m ** -3)
+ inertial_length(-5 * u.m ** -3, 'e-')
with pytest.warns(u.UnitsWarning):
- assert inertial_length(1e19) == inertial_length(1e19 * u.m ** -3)
+ assert inertial_length(1e19, 'e-') == inertial_length(1e19 * u.m ** -3, 'e-')
assert_can_handle_nparray(inertial_length)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 14
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
asteval==0.9.26
astropy==4.1
attrs==22.2.0
cached-property==1.5.2
certifi==2021.5.30
colorama==0.4.5
cycler==0.11.0
Cython==3.0.12
future==1.0.0
h5py==3.1.0
importlib-metadata==4.8.3
iniconfig==1.1.1
kiwisolver==1.3.1
lmfit==1.0.3
matplotlib==3.3.4
mpmath==1.3.0
numpy==1.19.5
packaging==21.3
Pillow==8.4.0
-e git+https://github.com/PlasmaPy/PlasmaPy.git@15a77592b6b5ba8ea3ed8b1dadd3e4e3f71bc631#egg=plasmapy
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
scipy==1.5.4
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
uncertainties==3.1.7
zipp==3.6.0
|
name: PlasmaPy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- asteval==0.9.26
- astropy==4.1
- attrs==22.2.0
- cached-property==1.5.2
- colorama==0.4.5
- cycler==0.11.0
- cython==3.0.12
- future==1.0.0
- h5py==3.1.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- kiwisolver==1.3.1
- lmfit==1.0.3
- matplotlib==3.3.4
- mpmath==1.3.0
- numpy==1.19.5
- packaging==21.3
- pillow==8.4.0
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- scipy==1.5.4
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- uncertainties==3.1.7
- zipp==3.6.0
prefix: /opt/conda/envs/PlasmaPy
|
[
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_instantiation[Li]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_instantiation[Li",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_instantiation[H]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_instantiation[H",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_instantiation[D]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_instantiation[He]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_instantiation[number",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_integer_charges[Li]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_integer_charges[Li",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_integer_charges[H]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_integer_charges[H",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_integer_charges[D]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_integer_charges[He]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_integer_charges[number",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_ionic_fractions[Li]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_ionic_fractions[Li",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_ionic_fractions[H]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_ionic_fractions[H",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_ionic_fractions[D]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_ionic_fractions[He]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_ionic_fractions[number",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_equal_to_itself",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_equal_to_within_tolerance",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_inequality",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_equality_exception",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_iteration[Li]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_iteration[Li",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_iteration[H]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_iteration[H",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_iteration[D]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_iteration[He]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_iteration[number",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_slicing_error",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_indexing_error[-1]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_indexing_error[4]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_indexing_error[Li]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_normalization",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_identifications[Li]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_identifications[Li",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_identifications[H]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_identifications[H",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_identifications[D]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_identifications[He]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_identifications[number",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_invalid_tolerances[-1e-16]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_invalid_tolerances[1.0000001]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_particle_instances[Li]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_particle_instances[Li",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_particle_instances[H]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_particle_instances[H",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_particle_instances[D]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_particle_instances[He]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_particle_instances[number",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_electron_density_from_n_elem_ionic_fractions[D]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_electron_density_from_n_elem_ionic_fractions[He]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_getitem[Li]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_getitem[Li",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_getitem[H]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_getitem[H",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_getitem[D]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_getitem[He]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_getitem[number",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_State_attrs[integer_charge]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_State_attrs[ionic_fraction]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_State_attrs[ionic_symbol]",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationState::test_State_equality_and_getitem",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_exceptions[too",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_exceptions[ionic",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_exceptions[invalid",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_exceptions[bad",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_exceptions[negative",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_exceptions[redundant",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[T_e]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[tol]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[isotope]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[element]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[atomic_number]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[Z_mean]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[Z_rms]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[n_e]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[n_elem]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[integer_charges]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[ionic_fractions]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[ionic_symbols]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[_is_normalized()]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[number_densities]",
"plasmapy/atomic/tests/test_ionization_state.py::test_IonizationState_attributes[__str__()]",
"plasmapy/atomic/tests/test_ionization_state.py::test_nans",
"plasmapy/atomic/tests/test_ionization_state.py::test_setting_ionic_fractions",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_setting_number_densities",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_ionic_fractions",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_n_elem",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_n_e",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_incorrect_units_error",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_T_e_isnan_when_not_set",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_kappa_isinf_when_not_set",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_instantiation[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_str[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_repr[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_no_exceptions_from_info[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_simple_equality[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_particles_were_set_correctly[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_abundances_kwarg_sets_abundances[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_abundances_kwarg_sets_abundances[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_abundances_kwarg_sets_abundances[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_abundances_kwarg_sets_abundances[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_elements_and_isotopes_are_sorted[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_that_ionic_fractions_are_set_correctly[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[ordered",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[mixed",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_getitem_element_intcharge[number",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[basic]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[quantities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[just",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[H",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[T_e",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[elements",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStates::test_normalization[number",
"plasmapy/atomic/tests/test_ionization_states.py::test_abundances_consistency",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem[H-new_states0]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem[He-new_states1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem[H-new_states2]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem[He-new_states3]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem_errors[H-new_states0-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem_errors[H-new_states1-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem_errors[H-new_states2-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem_errors[Li-new_states3-KeyError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem_errors[sdfasd-new_states4-KeyError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesItemAssignment::test_setitem_errors[KeyError-KeyError-KeyError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensities::test_electron_density",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensities::test_number_densities[H]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensities::test_number_densities[He]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_defaults_to_nan[T_e]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_defaults_to_nan[n]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_defaults_to_nan[n_e]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_kappa_defaults_to_inf",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_defaults_to_dict_of_nans[number_densities]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_defaults_to_dict_of_nans[ionic_fractions]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_abundances_default_to_nans[abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_abundances_default_to_nans[log_abundances]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_ionic_fractions_for_single_element",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_incomplete_abundances",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_abundances",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_invalid_indices[invalid_indices0]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_invalid_indices[C]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_invalid_indices[H-1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_invalid_indices[invalid_indices3]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_invalid_indices[invalid_indices4]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_invalid_indices[invalid_indices5]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_invalid_indices[invalid_indices6]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_invalid_indices[invalid_indices7]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_getitem_one_index[H]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_getitem_one_index[Fe]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_getitem_two_indices[indices0]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_getitem_two_indices[indices1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_n",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_resetting_valid_densities",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_resetting_invalid_densities",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_elemental_abundances_not_quantities",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_ionic_fractions_not_quantities[H]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_ionic_fractions_not_quantities[He]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_ionic_fractions_not_quantities[Fe]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_that_iron_ionic_fractions_are_still_undefined",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_base_particles",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_base_particles_equal_ionic_fraction_particles",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[wrong",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[not",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[negative",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[ion]",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[repeat",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[isotope",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[imaginary",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[abundance",
"plasmapy/atomic/tests/test_ionization_states.py::test_exceptions_upon_instantiation[kappa",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_number_densities_defined[ndens1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_number_densities_defined[ndens2]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_number_densities_undefined[no_ndens3]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_number_densities_undefined[no_ndens4]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_number_densities_undefined[no_ndens5]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens1-ndens1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens1-ndens2]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens1-no_ndens3]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens1-no_ndens4]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens1-no_ndens5]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens2-ndens1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens2-ndens2]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens2-no_ndens3]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens2-no_ndens4]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[ndens2-no_ndens5]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens3-ndens1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens3-ndens2]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens3-no_ndens3]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens3-no_ndens4]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens3-no_ndens5]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens4-ndens1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens4-ndens2]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens4-no_ndens3]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens4-no_ndens4]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens4-no_ndens5]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens5-ndens1]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens5-ndens2]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens5-no_ndens3]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens5-no_ndens4]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesDensityEqualities::test_equality[no_ndens5-no_ndens5]",
"plasmapy/atomic/tests/test_ionization_states.py::test_number_density_assignment",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[neutron-kwargs0-expected_dict0]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[p+-kwargs1-expected_dict1]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[p--kwargs2-expected_dict2]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[e--kwargs3-expected_dict3]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[e+-kwargs4-expected_dict4]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[H-kwargs5-expected_dict5]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[H",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[H-1",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[D+-kwargs8-expected_dict8]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[tritium-kwargs9-expected_dict9]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[Fe-kwargs10-expected_dict10]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[Cn-276-kwargs14-expected_dict14]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[muon-kwargs15-expected_dict15]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[nu_tau-kwargs16-expected_dict16]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[Particle(\"C\")-kwargs17-expected_dict17]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[Particle(\"C\")-kwargs18-expected_dict18]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles0]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles1]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles2]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles3]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles4]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles5]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles6]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles7]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles8]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles9]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles10]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles11]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_equivalent_cases[equivalent_particles12]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_cmp",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_class_mass_nuclide_mass[n-neutron]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_class_mass_nuclide_mass[p+-proton]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_class_mass_nuclide_mass[H-1-p+]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_class_mass_nuclide_mass[H-1",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_class_mass_nuclide_mass[D-D+]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_class_mass_nuclide_mass[T-T+]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_class_mass_nuclide_mass[He-4-alpha]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_class_mass_nuclide_mass[Fe-56-Fe-56",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_half_life_string",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_is_electron[Particle(\"e-\")-True]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_is_electron[Particle(\"p+\")-False]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_bool_error",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_inversion[p+-p-]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_inversion[n-antineutron]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_inversion[e--e+]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_inversion[mu--mu+]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_inversion[tau--tau+]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_inversion[nu_e-anti_nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_inversion[nu_mu-anti_nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::test_particle_inversion[nu_tau-anti_nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::test_antiparticle_inversion[p+-p-]",
"plasmapy/atomic/tests/test_particle_class.py::test_antiparticle_inversion[n-antineutron]",
"plasmapy/atomic/tests/test_particle_class.py::test_antiparticle_inversion[e--e+]",
"plasmapy/atomic/tests/test_particle_class.py::test_antiparticle_inversion[mu--mu+]",
"plasmapy/atomic/tests/test_particle_class.py::test_antiparticle_inversion[tau--tau+]",
"plasmapy/atomic/tests/test_particle_class.py::test_antiparticle_inversion[nu_e-anti_nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::test_antiparticle_inversion[nu_mu-anti_nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::test_antiparticle_inversion[nu_tau-anti_nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::test_unary_operator_for_elements",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[anti_nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[antineutron]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[anti_nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[anti_nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[mu+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[p-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[p+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[n]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[mu-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[tau+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[tau-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[e+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_inverted_inversion[e-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[anti_nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[antineutron]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[anti_nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[anti_nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[mu+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[p-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[p+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[n]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[mu-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[tau+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[tau-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[e+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_opposite_charge[e-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[anti_nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[antineutron]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[anti_nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[anti_nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[mu+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[p-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[p+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[n]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[mu-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[tau+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[tau-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[e+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_equal_mass[e-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[anti_nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[nu_mu]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[antineutron]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[anti_nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[anti_nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[nu_tau]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[mu+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[p-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[p+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[n]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[mu-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[tau+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[nu_e]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[tau-]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[e+]",
"plasmapy/atomic/tests/test_particle_class.py::Test_antiparticle_properties_inversion::test_antiparticle_attribute_and_operator[e-]",
"plasmapy/atomic/tests/test_particle_class.py::test_particleing_a_particle[e-]",
"plasmapy/atomic/tests/test_particle_class.py::test_particleing_a_particle[D+]",
"plasmapy/atomic/tests/test_particle_class.py::test_particleing_a_particle[Fe",
"plasmapy/atomic/tests/test_particle_class.py::test_particleing_a_particle[H-]",
"plasmapy/atomic/tests/test_particle_class.py::test_particleing_a_particle[mu+]",
"plasmapy/atomic/tests/test_particle_class.py::test_that_object_can_be_dict_key[Particle(\"H\")]",
"plasmapy/atomic/tests/test_particle_class.py::test_that_object_can_be_dict_key[Particle(\"e+\")]",
"plasmapy/physics/tests/test_parameters.py::Test_mass_density::test_particleless",
"plasmapy/physics/tests/test_parameters.py::Test_mass_density::test_wrong_units",
"plasmapy/physics/tests/test_parameters.py::Test_mass_density::test_handle_nparrays",
"plasmapy/physics/tests/test_parameters.py::test_thermal_speed",
"plasmapy/physics/tests/test_parameters.py::test_thermal_pressure",
"plasmapy/physics/tests/test_parameters.py::Test_kappa_thermal_speed::test_invalid_kappa",
"plasmapy/physics/tests/test_parameters.py::Test_kappa_thermal_speed::test_invalid_method",
"plasmapy/physics/tests/test_parameters.py::Test_kappa_thermal_speed::test_probable1",
"plasmapy/physics/tests/test_parameters.py::Test_kappa_thermal_speed::test_rms1",
"plasmapy/physics/tests/test_parameters.py::Test_kappa_thermal_speed::test_mean1",
"plasmapy/physics/tests/test_parameters.py::Test_kappa_thermal_speed::test_handle_nparrays",
"plasmapy/physics/tests/test_parameters.py::test_gyroradius",
"plasmapy/physics/tests/test_parameters.py::Test_gyroradius::test_handle_numpy_array",
"plasmapy/physics/tests/test_parameters.py::Test_gyroradius::test_handle_mixed_Qarrays",
"plasmapy/physics/tests/test_parameters.py::Test_gyroradius::test_raise_two_valid_inputs",
"plasmapy/physics/tests/test_parameters.py::Test_gyroradius::test_all_valid_and_one_valid",
"plasmapy/physics/tests/test_parameters.py::Test_gyroradius::test_scalar_and_nan_qarray",
"plasmapy/physics/tests/test_parameters.py::Test_gyroradius::test_keeps_arguments_unchanged",
"plasmapy/physics/tests/test_parameters.py::test_Debye_length",
"plasmapy/physics/tests/test_parameters.py::test_Debye_number",
"plasmapy/physics/tests/test_parameters.py::test_inertial_length",
"plasmapy/physics/tests/test_parameters.py::test_magnetic_pressure",
"plasmapy/physics/tests/test_parameters.py::test_magnetic_energy_density",
"plasmapy/physics/tests/test_parameters.py::test_upper_hybrid_frequency",
"plasmapy/physics/tests/test_parameters.py::test_lower_hybrid_frequency"
] |
[
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_that_negative_density_raises_error",
"plasmapy/atomic/tests/test_ionization_state.py::Test_IonizationStateNumberDensitiesSetter::test_incorrect_number_of_charge_states_error",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_exceptions[T_e-5",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_exceptions[T_e--1",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_exceptions[n-5",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_exceptions[n--1",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_exceptions[ionic_fractions-invalid_value4-AtomicError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_exceptions[ionic_fractions-invalid_value5-AtomicError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_exceptions[ionic_fractions-invalid_value6-AtomicError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_attribute_exceptions[ionic_fractions-invalid_value7-AtomicError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_invalid_ionfracs[H-invalid_fracs0-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_invalid_ionfracs[H-invalid_fracs1-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_invalid_ionfracs[H-invalid_fracs2-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_invalid_ionfracs[He-invalid_fracs3-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_invalid_ionfracs[He-invalid_fracs4-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_invalid_ionfracs[He-invalid_fracs5-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_invalid_ionfracs[He-invalid_fracs6-ValueError]",
"plasmapy/atomic/tests/test_ionization_states.py::TestIonizationStatesAttributes::test_setting_invalid_ionfracs[He-invalid_fracs7-ValueError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[alpha-kwargs11-expected_dict11]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[He-4",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_class[Li-kwargs13-expected_dict13]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[a-kwargs0--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[d+-kwargs1--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[H-kwargs2--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Au-818-kwargs3--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Au-12-kwargs4--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Au-kwargs5--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Au-kwargs6--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[e--kwargs7--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[e--kwargs8-.atomic_number-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[alpha-kwargs9-.standard_atomic_weight-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Fe-56-kwargs10-.standard_atomic_weight-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[e--kwargs11-.standard_atomic_weight-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[tau--kwargs12-.element_name-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[tau+-kwargs13-.atomic_number-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[neutron-kwargs14-.atomic_number-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[H-kwargs15-.mass_number-InvalidIsotopeError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[neutron-kwargs16-.mass_number-InvalidIsotopeError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[He-kwargs17-.charge-ChargeError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[He-kwargs18-.integer_charge-ChargeError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Fe-kwargs19-.spin-MissingAtomicDataError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[nu_e-kwargs20-.mass-MissingAtomicDataError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Og-kwargs21-.standard_atomic_weight-MissingAtomicDataError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Particle(\"C-14\")-kwargs22--InvalidParticleError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Particle(\"Au",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[arg24-kwargs24--TypeError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Fe-kwargs25-.ionize()-ChargeError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[D-kwargs26-.recombine()-ChargeError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[Fe",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[e--kwargs32-.ionize()-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_errors[e+-kwargs33-.recombine()-InvalidElementError]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_warnings[H-----kwargs0--AtomicWarning]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_warnings[alpha-kwargs1--AtomicWarning]",
"plasmapy/atomic/tests/test_particle_class.py::test_Particle_warnings[alpha-kwargs2--AtomicWarning]",
"plasmapy/physics/tests/test_parameters.py::test_Alfven_speed",
"plasmapy/physics/tests/test_parameters.py::test_ion_sound_speed",
"plasmapy/physics/tests/test_parameters.py::test_gyrofrequency",
"plasmapy/physics/tests/test_parameters.py::test_plasma_frequency"
] |
[] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,227 |
[
"plasmapy/classes/sources/openpmd_hdf5.py",
"plasmapy/atomic/__init__.py",
"plasmapy/physics/quantum.py",
"plasmapy/mathematics/mathematics.py",
"plasmapy/atomic/ionization_state.py",
"setup.py",
"plasmapy/diagnostics/langmuir.py",
"plasmapy/__init__.py",
"plasmapy/atomic/atomic.py",
"plasmapy/physics/parameters.py",
"docs/install.rst",
".coveragerc",
"plasmapy/atomic/ionization_states.py",
"setup.cfg",
"plasmapy/optional_deps.py",
"plasmapy/atomic/particle_input.py",
"plasmapy/atomic/particle_class.py"
] |
[
"plasmapy/classes/sources/openpmd_hdf5.py",
"plasmapy/atomic/__init__.py",
"plasmapy/physics/quantum.py",
"plasmapy/mathematics/mathematics.py",
"plasmapy/atomic/ionization_state.py",
"setup.py",
"plasmapy/diagnostics/langmuir.py",
"plasmapy/__init__.py",
"plasmapy/atomic/atomic.py",
"plasmapy/physics/parameters.py",
"docs/install.rst",
".coveragerc",
"plasmapy/atomic/ionization_states.py",
"setup.cfg",
"plasmapy/optional_deps.py",
"plasmapy/atomic/particle_input.py",
"plasmapy/atomic/particle_class.py"
] |
M3t0r__tpl-12
|
b534fa59fb808b10031869fe51f5e6382a1055dd
|
2018-10-12 19:00:06
|
b534fa59fb808b10031869fe51f5e6382a1055dd
|
diff --git a/tpl/__init__.py b/tpl/__init__.py
index 96b6c41..32297a0 100644
--- a/tpl/__init__.py
+++ b/tpl/__init__.py
@@ -61,15 +61,19 @@ def main(*args):
for data in loaded_data:
collated_data = merge_data(collated_data, data)
+ # set up Jinja2 environment
+ j_env = jinja2.Environment(
+ keep_trailing_newline=True
+ )
+
# create template
with open_file(arguments[0]) as template_stream:
- template = jinja2.Template(template_stream.read())
+ template = j_env.from_string(template_stream.read())
template.filename = arguments[0]
# and render to output
with open_file(arguments[1], "w") as output:
template.stream(collated_data).dump(output)
- output.write("\n") # does the template eat this or the dump call?
return os.EX_OK
|
Fix trailing newline issue
In https://github.com/M3t0r/tpl/blob/feceeed182f1c2553b827d8f431f6be800204250/tpl/__init__.py#L72 `tpl` always adds a trailing newline instead of respecting what the template has. I added this to have nicer output on the command line, but it turns out Jinja has a setting if it should keep the last newline, if any. It's called `keep_trailing_newline` and is part of the [`jinja2.Environment`](http://jinja.pocoo.org/docs/2.10/api/#jinja2.Environment).
We should add tests to see if `tpl` only prints a newline if one is actually present in the template.
|
M3t0r/tpl
|
diff --git a/tests/cli/test_faulty_invocations.py b/tests/cli/test_faulty_invocations.py
index d81fbd8..d538ec6 100644
--- a/tests/cli/test_faulty_invocations.py
+++ b/tests/cli/test_faulty_invocations.py
@@ -9,7 +9,7 @@ def test_key_does_not_exist(cli):
cli.path_for_content("{{FOO}}"),
env={}
)
- assert p.stdout == "\n"
+ assert p.stdout == ""
def test_corrupt_yaml(cli):
diff --git a/tests/cli/test_standard_usecases.py b/tests/cli/test_standard_usecases.py
index c3c9426..90d0c68 100644
--- a/tests/cli/test_standard_usecases.py
+++ b/tests/cli/test_standard_usecases.py
@@ -3,12 +3,12 @@ from . import cli
def test_source_environment(cli):
p = cli("-e", cli.path_for_content("{{FOO}}"), env={"FOO": "bar"})
- assert p.stdout == "bar\n"
+ assert p.stdout == "bar"
def test_unicode_var(cli):
p = cli("-e", cli.path_for_content("{{FOO}}"), env={"FOO": "🐍"})
- assert p.stdout == "🐍\n"
+ assert p.stdout == "🐍"
def test_shadowing_json_env(cli):
@@ -18,7 +18,7 @@ def test_shadowing_json_env(cli):
cli.path_for_content("{{FOO}}"),
env={"FOO": "env"}
)
- assert p.stdout == "env\n"
+ assert p.stdout == "env"
def test_shadowing_yaml_env(cli):
@@ -28,7 +28,7 @@ def test_shadowing_yaml_env(cli):
cli.path_for_content("{{FOO}}"),
env={"FOO": "env"}
)
- assert p.stdout == "env\n"
+ assert p.stdout == "env"
def test_yaml_flow_style(cli):
@@ -36,7 +36,7 @@ def test_yaml_flow_style(cli):
"--yaml", cli.path_for_content('{"FOO": "yaml"}'),
cli.path_for_content("{{FOO}}")
)
- assert p.stdout == "yaml\n"
+ assert p.stdout == "yaml"
def test_environment_by_default(cli):
@@ -44,7 +44,7 @@ def test_environment_by_default(cli):
cli.path_for_content("{{FOO}}"),
env={"FOO": "bar"}
)
- assert p.stdout == "bar\n"
+ assert p.stdout == "bar"
def test_sub_dict_shadowing(cli):
@@ -53,7 +53,7 @@ def test_sub_dict_shadowing(cli):
"--json", cli.path_for_json({"FOO": {"BAR": "second"}}),
cli.path_for_content("{{FOO['BAR']}}")
)
- assert p.stdout == "second\n"
+ assert p.stdout == "second"
def test_sub_dict_merging(cli):
@@ -62,7 +62,7 @@ def test_sub_dict_merging(cli):
"--json", cli.path_for_json({"merge": {"BAR": "bar"}}),
cli.path_for_content("{{merge['FOO']}}{{merge['BAR']}}")
)
- assert p.stdout == "foobar\n"
+ assert p.stdout == "foobar"
def test_second_sub_dict_shadowing(cli):
@@ -71,7 +71,7 @@ def test_second_sub_dict_shadowing(cli):
"--json", cli.path_for_json({"merge": {"deeper": {"overwritten": "bar"}}}),
cli.path_for_content("{{merge.deeper.overwritten}}")
)
- assert p.stdout == "bar\n"
+ assert p.stdout == "bar"
def test_second_sub_dict_merging(cli):
@@ -80,7 +80,7 @@ def test_second_sub_dict_merging(cli):
"--json", cli.path_for_json({"merge": {"deeper": {"BAR": "bar"}}}),
cli.path_for_content("{{merge.deeper.FOO}}{{merge.deeper.BAR}}")
)
- assert p.stdout == "foobar\n"
+ assert p.stdout == "foobar"
def test_shadowing_of_dict(cli):
@@ -89,4 +89,29 @@ def test_shadowing_of_dict(cli):
"--json", cli.path_for_json({"merge": 'bar'}),
cli.path_for_content("{{merge}}")
)
+ assert p.stdout == "bar"
+
+
+def test_keep_no_newline_at_end(cli):
+ p = cli(cli.path_for_content("{{FOO}}"), env={"FOO": "bar"})
+ assert p.stdout == "bar"
+
+
+def test_keep_one_newline_at_end(cli):
+ p = cli(cli.path_for_content("{{FOO}}\n"), env={"FOO": "bar"})
assert p.stdout == "bar\n"
+
+
+def test_keep_two_newlines_at_end(cli):
+ p = cli(cli.path_for_content("{{FOO}}\n\n"), env={"FOO": "bar"})
+ assert p.stdout == "bar\n\n"
+
+
+def test_keep_one_newline_at_beginning(cli):
+ p = cli(cli.path_for_content("\n{{FOO}}"), env={"FOO": "bar"})
+ assert p.stdout == "\nbar"
+
+
+def test_keep_two_newlines_at_beginning(cli):
+ p = cli(cli.path_for_content("\n\n{{FOO}}"), env={"FOO": "bar"})
+ assert p.stdout == "\n\nbar"
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"flake8"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup==1.2.2
flake8==7.2.0
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
mccabe==0.7.0
packaging==24.2
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.2
pytest==8.3.5
PyYAML==6.0.2
tomli==2.2.1
-e git+https://github.com/M3t0r/tpl.git@b534fa59fb808b10031869fe51f5e6382a1055dd#egg=tpl
|
name: tpl
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- flake8==7.2.0
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- mccabe==0.7.0
- packaging==24.2
- pluggy==1.5.0
- pycodestyle==2.13.0
- pyflakes==3.3.2
- pytest==8.3.5
- pyyaml==6.0.2
- tomli==2.2.1
prefix: /opt/conda/envs/tpl
|
[
"tests/cli/test_faulty_invocations.py::test_key_does_not_exist",
"tests/cli/test_standard_usecases.py::test_source_environment",
"tests/cli/test_standard_usecases.py::test_unicode_var",
"tests/cli/test_standard_usecases.py::test_shadowing_json_env",
"tests/cli/test_standard_usecases.py::test_shadowing_yaml_env",
"tests/cli/test_standard_usecases.py::test_yaml_flow_style",
"tests/cli/test_standard_usecases.py::test_environment_by_default",
"tests/cli/test_standard_usecases.py::test_sub_dict_shadowing",
"tests/cli/test_standard_usecases.py::test_sub_dict_merging",
"tests/cli/test_standard_usecases.py::test_second_sub_dict_shadowing",
"tests/cli/test_standard_usecases.py::test_second_sub_dict_merging",
"tests/cli/test_standard_usecases.py::test_shadowing_of_dict",
"tests/cli/test_standard_usecases.py::test_keep_no_newline_at_end",
"tests/cli/test_standard_usecases.py::test_keep_one_newline_at_beginning",
"tests/cli/test_standard_usecases.py::test_keep_two_newlines_at_beginning"
] |
[] |
[
"tests/cli/test_faulty_invocations.py::test_corrupt_yaml",
"tests/cli/test_faulty_invocations.py::test_corrupt_json",
"tests/cli/test_standard_usecases.py::test_keep_one_newline_at_end",
"tests/cli/test_standard_usecases.py::test_keep_two_newlines_at_end"
] |
[] |
MIT License
| 3,228 |
[
"tpl/__init__.py"
] |
[
"tpl/__init__.py"
] |
|
great-expectations__great_expectations-390
|
10e1792ae5f9d250d5393bc14b488e189358cccc
|
2018-10-12 19:12:39
|
10e1792ae5f9d250d5393bc14b488e189358cccc
|
diff --git a/docs/source/roadmap_changelog.rst b/docs/source/roadmap_changelog.rst
index 7656d1f47..5e62bc5a5 100644
--- a/docs/source/roadmap_changelog.rst
+++ b/docs/source/roadmap_changelog.rst
@@ -14,6 +14,8 @@ Planned Features
v.0.4.4__develop
----------------
+* Enable custom_sql datasets for databases with multiple schemas, by
+ adding a fallback for column reflection (#387)
* Remove `IF NOT EXISTS` check for custom sql temporary tables, for
Redshift compatibility (#372)
* Allow users to pass args/kwargs for engine creation in
diff --git a/great_expectations/dataset/sqlalchemy_dataset.py b/great_expectations/dataset/sqlalchemy_dataset.py
index 7a4f440cd..8d98a7660 100644
--- a/great_expectations/dataset/sqlalchemy_dataset.py
+++ b/great_expectations/dataset/sqlalchemy_dataset.py
@@ -255,8 +255,14 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
if custom_sql:
self.create_temporary_table(table_name, custom_sql)
- insp = reflection.Inspector.from_engine(engine)
- self.columns = insp.get_columns(table_name, schema=schema)
+
+ try:
+ insp = reflection.Inspector.from_engine(engine)
+ self.columns = insp.get_columns(table_name, schema=schema)
+ except KeyError:
+ # we will get a KeyError for temporary tables, since
+ # reflection will not find the temporary schema
+ self.columns = self.column_reflection_fallback()
# Only call super once connection is established and table_name and columns known to allow autoinspection
super(SqlAlchemyDataset, self).__init__(*args, **kwargs)
@@ -272,17 +278,13 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
table_name=table_name, custom_sql=custom_sql)
self.engine.execute(stmt)
- def _is_numeric_column(self, column):
- for col in self.columns:
- if (col['name'] == column and
- isinstance(col['type'],
- (sa.types.Integer, sa.types.BigInteger, sa.types.Float,
- sa.types.Numeric, sa.types.SmallInteger, sa.types.Boolean)
- )
- ):
- return True
+ def column_reflection_fallback(self):
+ """If we can't reflect the table, use a query to at least get column names."""
+ sql = sa.select([sa.text("*")]).select_from(self._table)
+ col_names = self.engine.execute(sql).keys()
+ col_dict = [{'name': col_name} for col_name in col_names]
+ return col_dict
- return False
###
###
@@ -689,9 +691,6 @@ class SqlAlchemyDataset(MetaSqlAlchemyDataset):
if max_value is not None and not isinstance(max_value, (Number)):
raise ValueError("max_value must be a number")
- if not self._is_numeric_column(column):
- raise ValueError("column is not numeric")
-
col_avg = self.engine.execute(
sa.select([sa.func.avg(sa.column(column))]).select_from(
self._table)
|
SqlAlchemyDatasets can't be used with custom sql for databases with multiple schemas
Instantiating a `SqlAlchemyDataset` with a database which supports multiple schemas fails on the following line:
https://github.com/great-expectations/great_expectations/blob/d7a4ee03cfce8bea66c5f91573bb87e4385b1eb1/great_expectations/dataset/sqlalchemy_dataset.py#L222
The issue is that the inspector prepends the default schema when one is not provided. The custom sql tables are written to a temporary schema, so the default schema is incorrect. I looked into this a bit, and as far as I can tell, the inspector just won't work unless you look up and pass the name of the temporary schema.
I have a fix for this issue that I'm going to submit, and I'm just filing an issue for documentation purposes. My proposed solution is to get the column names from a simple query rather than the inspector.
|
great-expectations/great_expectations
|
diff --git a/tests/column_aggregate_expectations/expect_column_mean_to_be_between.json b/tests/column_aggregate_expectations/expect_column_mean_to_be_between.json
index 01b00b791..159966849 100644
--- a/tests/column_aggregate_expectations/expect_column_mean_to_be_between.json
+++ b/tests/column_aggregate_expectations/expect_column_mean_to_be_between.json
@@ -112,6 +112,7 @@
"tests": [{
"title": "type mismatch: null observed_value",
"exact_match_out": false,
+ "suppress_test_for": ["SQLAlchemy"],
"in": {
"column": "s",
"min_value": 0,
@@ -204,4 +205,4 @@
}
}]
}]
-}
\ No newline at end of file
+}
diff --git a/tests/sqlalchemy_dataset/test_sqlalchemydataset.py b/tests/sqlalchemy_dataset/test_sqlalchemydataset.py
index c418d709f..51fcbb60e 100644
--- a/tests/sqlalchemy_dataset/test_sqlalchemydataset.py
+++ b/tests/sqlalchemy_dataset/test_sqlalchemydataset.py
@@ -129,3 +129,30 @@ def test_sqlalchemydataset_with_custom_sql():
result = custom_sql_dataset.expect_column_to_exist("age")
assert result['success'] == False
+
+
+def test_column_fallback():
+ engine = sa.create_engine('sqlite://')
+
+ data = pd.DataFrame({
+ "name": ["Frank", "Steve", "Jane", "Frank", "Michael"],
+ "age": [16, 21, 38, 22, 10],
+ "pet": ["fish", "python", "cat", "python", "frog"]
+ })
+
+ data.to_sql(name='test_sql_data', con=engine, index=False)
+ dataset = SqlAlchemyDataset('test_sql_data', engine=engine)
+ fallback_dataset = SqlAlchemyDataset('test_sql_data', engine=engine)
+ # override columns attribute to test fallback
+ fallback_dataset.columns = fallback_dataset.column_reflection_fallback()
+
+ # check that the results are the same for a few expectations
+ assert (dataset.expect_column_to_exist('age') ==
+ fallback_dataset.expect_column_to_exist('age'))
+
+ assert (dataset.expect_column_mean_to_be_between('age', min_value=10) ==
+ fallback_dataset.expect_column_mean_to_be_between('age', min_value=10))
+
+ # Test a failing expectation
+ assert (dataset.expect_table_row_count_to_equal(value=3) ==
+ fallback_dataset.expect_table_row_count_to_equal(value=3))
diff --git a/tests/test_utils.py b/tests/test_utils.py
index c9dcc8f0f..74c916a22 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -128,7 +128,7 @@ def evaluate_json_test(dataset, expectation_type, test):
"""
This method will evaluate the result of a test build using the Great Expectations json test format.
- NOTE: Tests can be suppressed for certain data types if the test contains the Key 'suppress_tests_for' with a list
+ NOTE: Tests can be suppressed for certain data types if the test contains the Key 'suppress_test_for' with a list
of Dataset types to suppress, such as ['SQLAlchemy', 'Pandas'].
:param dataset: (Dataset) A great expectations Dataset
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
-e git+https://github.com/great-expectations/great_expectations.git@10e1792ae5f9d250d5393bc14b488e189358cccc#egg=great_expectations
greenlet==2.0.2
importlib-metadata==4.8.3
iniconfig==1.1.1
jsonschema==3.2.0
numpy==1.19.5
packaging==21.3
pandas==1.1.5
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
scipy==1.5.4
six==1.17.0
SQLAlchemy==1.4.54
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: great_expectations
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- greenlet==2.0.2
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jsonschema==3.2.0
- numpy==1.19.5
- packaging==21.3
- pandas==1.1.5
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pyrsistent==0.18.0
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- scipy==1.5.4
- six==1.17.0
- sqlalchemy==1.4.54
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/great_expectations
|
[
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_column_fallback"
] |
[
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_sqlalchemydataset_with_custom_sql"
] |
[
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_custom_sqlalchemydataset",
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_broken_decorator_errors",
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_missing_engine_error",
"tests/sqlalchemy_dataset/test_sqlalchemydataset.py::test_schema_custom_sql_error"
] |
[] |
Apache License 2.0
| 3,229 |
[
"docs/source/roadmap_changelog.rst",
"great_expectations/dataset/sqlalchemy_dataset.py"
] |
[
"docs/source/roadmap_changelog.rst",
"great_expectations/dataset/sqlalchemy_dataset.py"
] |
|
destag__at-date-15
|
dc4d4b9dc25ad7b4039bfd4b9dea771df23ee282
|
2018-10-12 19:27:47
|
dc4d4b9dc25ad7b4039bfd4b9dea771df23ee282
|
codecov[bot]: # [Codecov](https://codecov.io/gh/destag/at-date/pull/15?src=pr&el=h1) Report
> Merging [#15](https://codecov.io/gh/destag/at-date/pull/15?src=pr&el=desc) into [master](https://codecov.io/gh/destag/at-date/commit/dc4d4b9dc25ad7b4039bfd4b9dea771df23ee282?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/destag/at-date/pull/15?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #15 +/- ##
=======================================
Coverage 99.21% 99.21%
=======================================
Files 3 3
Lines 128 128
=======================================
Hits 127 127
Misses 1 1
```
| [Impacted Files](https://codecov.io/gh/destag/at-date/pull/15?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [atdate/atdate\_format.py](https://codecov.io/gh/destag/at-date/pull/15/diff?src=pr&el=tree#diff-YXRkYXRlL2F0ZGF0ZV9mb3JtYXQucHk=) | `100% <ø> (ø)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/destag/at-date/pull/15?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/destag/at-date/pull/15?src=pr&el=footer). Last update [dc4d4b9...7489498](https://codecov.io/gh/destag/at-date/pull/15?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
|
diff --git a/atdate/atdate_format.py b/atdate/atdate_format.py
index 6749166..42e910b 100644
--- a/atdate/atdate_format.py
+++ b/atdate/atdate_format.py
@@ -7,6 +7,7 @@ format_string = r'''
| date increment
| nowspec
| nowspec increment
+ | increment
time: HR24CLOCK_HR_MIN -> _hr24clock_hr_min
| HR24CLOCK_HOUR ":" MINUTE -> _hr24clock_hour_minute
| WALLCLOCK_HR_MIN AM_PM -> _wallclock_hr_min_am_pm
diff --git a/docs/README.md b/docs/README.md
index bd6e1fc..b33fdbd 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -93,14 +93,20 @@ Valid at date string consists of tokens which can be in order:
tokens|example
---|---
-time|17:32
-time date|17:32 11/22/2033
-time increment|17:32 next day
-time date increment|17:32 11/22/2033 next day
-date|11/22/2033
-date increment|11/22/2033 next month
-now|now
-now increment|now next day
+[time]|17:32
+[time] [date]|17:32 11/22/2033
+[time] [increment]|17:32 next day
+[time] [date] [increment]|17:32 11/22/2033 next day
+[date]|11/22/2033
+[date] [increment]|11/22/2033 next month
+[now]|now
+[now] [increment]|now next day
+[increment]|next month
+
+[time]: #time
+[date]: #date
+[increment]: #increment
+[now]: #now
### At date tokens
|
Add rule to parser to omit word 'now'
Parser now require string in format like `now next month`.
It would be good if word `now` would be optional and strings like `next month` would be parsed like one above.
This change requires adding rule to parser string and probably adding additional methods to **api.py**.
|
destag/at-date
|
diff --git a/test/test_atdate.py b/test/test_atdate.py
index 5f1a4b8..fdbf0ce 100644
--- a/test/test_atdate.py
+++ b/test/test_atdate.py
@@ -206,3 +206,17 @@ def test_wallclock_hour_minute_am_pm():
test_string = '02:01 pm'
result = atdate.parse(test_string)
assert result == datetime(2000, 7, 2, 14, 1, 0, 0)
+
+
+@freeze_time('2000-07-02 03:04:05')
+def test_next_month_without_now():
+ test_string = 'next month'
+ result = atdate.parse(test_string)
+ assert result == datetime(2000, 8, 2, 3, 4, 5, 0)
+
+
+@freeze_time('2000-07-02 03:04:05')
+def test_plus_one_day_without_now():
+ test_string = '+1days'
+ result = atdate.parse(test_string)
+ assert result == datetime(2000, 7, 3, 3, 4, 5, 0)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 2
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"freezegun"
],
"pre_install": [
"pip install pipenv"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/destag/at-date.git@dc4d4b9dc25ad7b4039bfd4b9dea771df23ee282#egg=atdate
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
distlib==0.3.9
filelock==3.4.1
freezegun==1.2.2
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
lark-parser==0.12.0
packaging==21.3
pipenv==2022.4.8
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
virtualenv==20.17.1
virtualenv-clone==0.5.7
zipp==3.6.0
|
name: at-date
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- distlib==0.3.9
- filelock==3.4.1
- freezegun==1.2.2
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- lark-parser==0.12.0
- packaging==21.3
- pipenv==2022.4.8
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- python-dateutil==2.9.0.post0
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- virtualenv==20.17.1
- virtualenv-clone==0.5.7
- zipp==3.6.0
prefix: /opt/conda/envs/at-date
|
[
"test/test_atdate.py::test_next_month_without_now",
"test/test_atdate.py::test_plus_one_day_without_now"
] |
[] |
[
"test/test_atdate.py::test_at_date_has_parse_attribute",
"test/test_atdate.py::test_at_date_has_atdateparser_attribute",
"test/test_atdate.py::test_parse_return_datetime_object",
"test/test_atdate.py::test_at_noon_before_noon",
"test/test_atdate.py::test_at_noon_after_noon",
"test/test_atdate.py::test_at_noon_month_change",
"test/test_atdate.py::test_at_noon_year_change",
"test/test_atdate.py::test_at_midnight",
"test/test_atdate.py::test_at_midnight_month_change",
"test/test_atdate.py::test_at_midnight_year_change",
"test/test_atdate.py::test_at_now",
"test/test_atdate.py::test_at_now_next_minute_change_minute",
"test/test_atdate.py::test_at_now_next_minutes",
"test/test_atdate.py::test_at_now_next_minute_change_hour",
"test/test_atdate.py::test_at_now_next_minute_change_day",
"test/test_atdate.py::test_at_now_next_hour",
"test/test_atdate.py::test_at_now_next_day",
"test/test_atdate.py::test_at_now_next_week",
"test/test_atdate.py::test_at_now_next_month",
"test/test_atdate.py::test_at_now_next_year",
"test/test_atdate.py::test_month_number_day_number",
"test/test_atdate.py::test_month_name_day_number",
"test/test_atdate.py::test_month_number_day_number_year_number",
"test/test_atdate.py::test_day_number_month_number",
"test/test_atdate.py::test_day_number_month_number_year_number",
"test/test_atdate.py::test_inc_period",
"test/test_atdate.py::test_hr24clock_hr_min",
"test/test_atdate.py::test_hr24clock_hour_minute",
"test/test_atdate.py::test_wallclock_hr_min_am_pm",
"test/test_atdate.py::test_wallclock_hour_minute_am_pm"
] |
[] |
MIT License
| 3,230 |
[
"docs/README.md",
"atdate/atdate_format.py"
] |
[
"docs/README.md",
"atdate/atdate_format.py"
] |
google__mobly-534
|
95286a01a566e056d44acfa9577a45bc7f37f51d
|
2018-10-12 20:15:20
|
95286a01a566e056d44acfa9577a45bc7f37f51d
|
diff --git a/mobly/controllers/android_device_lib/adb.py b/mobly/controllers/android_device_lib/adb.py
index 5e0c36f..15e2a5c 100644
--- a/mobly/controllers/android_device_lib/adb.py
+++ b/mobly/controllers/android_device_lib/adb.py
@@ -49,7 +49,7 @@ class AdbError(Error):
device.
"""
- def __init__(self, cmd, stdout, stderr, ret_code, serial=None):
+ def __init__(self, cmd, stdout, stderr, ret_code, serial=''):
self.cmd = cmd
self.stdout = stdout
self.stderr = stderr
@@ -68,11 +68,15 @@ class AdbTimeoutError(Error):
Args:
cmd: list of strings, the adb command that timed out
timeout: float, the number of seconds passed before timing out.
+ serial: string, the serial of the device the command is executed on.
+ This is an empty string if the adb command is not specific to a
+ device.
"""
- def __init__(self, cmd, timeout):
+ def __init__(self, cmd, timeout, serial=''):
self.cmd = cmd
self.timeout = timeout
+ self.serial = serial
def __str__(self):
return 'Timed out executing command "%s" after %ss.' % (
@@ -159,6 +163,7 @@ class AdbProxy(object):
The output of the adb command run if exit code is 0.
Raises:
+ ValueError: timeout value is invalid.
AdbError: The adb command exit code is not 0.
AdbTimeoutError: The adb command timed out.
"""
@@ -166,13 +171,14 @@ class AdbProxy(object):
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)
process = psutil.Process(proc.pid)
if timeout and timeout <= 0:
- raise Error('Timeout is not a positive value: %s' % timeout)
+ raise ValueError('Timeout is not a positive value: %s' % timeout)
if timeout and timeout > 0:
try:
process.wait(timeout=timeout)
except psutil.TimeoutExpired:
process.terminate()
- raise AdbTimeoutError(cmd=args, timeout=timeout)
+ raise AdbTimeoutError(
+ cmd=args, timeout=timeout, serial=self.serial)
(out, err) = proc.communicate()
if stderr:
|
`AdbError` should have a serial number attr
Our `AdbError` does not include an easily accessible serial number.
When handling an `AdbError`, it is sometimes useful to know which device the command was issued to, especially when you cannot change the code around the adb call directly and have to handle at an upper level.
Is this something worth adding?
|
google/mobly
|
diff --git a/tests/mobly/controllers/android_device_lib/adb_test.py b/tests/mobly/controllers/android_device_lib/adb_test.py
index 63ae285..9430795 100755
--- a/tests/mobly/controllers/android_device_lib/adb_test.py
+++ b/tests/mobly/controllers/android_device_lib/adb_test.py
@@ -98,9 +98,9 @@ class AdbTest(unittest.TestCase):
mock_serial = 'ABCD1234'
with self.assertRaisesRegex(adb.AdbError,
'Error executing adb cmd .*') as context:
- adb.AdbProxy(mock_serial)._exec_cmd(
- ['fake_cmd'], shell=False, timeout=None, stderr=None)
+ adb.AdbProxy(mock_serial).fake_cmd()
self.assertEqual(context.exception.serial, mock_serial)
+ self.assertIn(mock_serial, context.exception.cmd)
@mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
@@ -129,23 +129,34 @@ class AdbTest(unittest.TestCase):
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
def test_exec_cmd_timed_out(self, mock_psutil_process, mock_popen):
self._mock_process(mock_psutil_process, mock_popen)
- # mock process.wait(timeout=timeout) to
- # throw psutil.TimeoutExpired exception
mock_psutil_process.return_value.wait.side_effect = (
adb.psutil.TimeoutExpired('Timed out'))
+ mock_serial = '1234Abcd'
+ with self.assertRaisesRegex(
+ adb.AdbTimeoutError, 'Timed out executing command "adb -s '
+ '1234Abcd fake-cmd" after 0.01s.') as context:
+ adb.AdbProxy(mock_serial).fake_cmd(timeout=0.01)
+ self.assertEqual(context.exception.serial, mock_serial)
+ self.assertIn(mock_serial, context.exception.cmd)
+ @mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
+ @mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
+ def test_exec_cmd_timed_out_without_serial(self, mock_psutil_process,
+ mock_popen):
+ self._mock_process(mock_psutil_process, mock_popen)
+ mock_psutil_process.return_value.wait.side_effect = (
+ adb.psutil.TimeoutExpired('Timed out'))
with self.assertRaisesRegex(adb.AdbTimeoutError,
- 'Timed out executing command "fake_cmd" '
- 'after 0.1s.'):
- adb.AdbProxy()._exec_cmd(
- ['fake_cmd'], shell=False, timeout=0.1, stderr=None)
+ 'Timed out executing command "adb '
+ 'fake-cmd" after 0.01s.') as context:
+ adb.AdbProxy().fake_cmd(timeout=0.01)
@mock.patch('mobly.controllers.android_device_lib.adb.subprocess.Popen')
@mock.patch('mobly.controllers.android_device_lib.adb.psutil.Process')
def test_exec_cmd_with_negative_timeout_value(self, mock_psutil_process,
mock_popen):
self._mock_process(mock_psutil_process, mock_popen)
- with self.assertRaisesRegex(adb.Error,
+ with self.assertRaisesRegex(ValueError,
'Timeout is not a positive value: -1'):
adb.AdbProxy()._exec_cmd(
['fake_cmd'], shell=False, timeout=-1, stderr=None)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 1
}
|
1.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"mock",
"pytz"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
future==1.0.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/google/mobly.git@95286a01a566e056d44acfa9577a45bc7f37f51d#egg=mobly
mock==5.2.0
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
portpicker==1.6.0
psutil==7.0.0
pyserial==3.5
pytest @ file:///croot/pytest_1738938843180/work
pytz==2025.2
PyYAML==6.0.2
timeout-decorator==0.5.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: mobly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- future==1.0.0
- mock==5.2.0
- portpicker==1.6.0
- psutil==7.0.0
- pyserial==3.5
- pytz==2025.2
- pyyaml==6.0.2
- timeout-decorator==0.5.0
prefix: /opt/conda/envs/mobly
|
[
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_timed_out",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_with_negative_timeout_value"
] |
[] |
[
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_cli_cmd_to_string",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_arg_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_arg_command_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_one_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_serial_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_auto_quotes",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_arg_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_arg_command_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_one_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_shell_true_with_serial_with_list",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_construct_adb_cmd_with_special_characters",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_formats_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_formats_command_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_with_shell_true",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_adb_cmd_with_stderr_pipe",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_error_with_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_error_without_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_no_timeout_success",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_timed_out_without_serial",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_exec_cmd_with_timeout_success",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_adb_and_process_stdout_formats_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_despite_cmd_exits",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_logs_cmd",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_logs_cmd_with_unexpected_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_raises_adb_error",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_reads_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_reads_unexpected_stdout",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_returns_stderr",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_when_cmd_eof",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_execute_and_process_stdout_when_handler_crash",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_forward",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_called_correctly",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_existing_command",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_missing_command_on_newer_devices",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_has_shell_command_with_missing_command_on_older_devices",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler_with_options",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_handler_with_runner",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_options",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_with_runner",
"tests/mobly/controllers/android_device_lib/adb_test.py::AdbTest::test_instrument_without_parameters"
] |
[] |
Apache License 2.0
| 3,231 |
[
"mobly/controllers/android_device_lib/adb.py"
] |
[
"mobly/controllers/android_device_lib/adb.py"
] |
|
pre-commit__pre-commit-hooks-327
|
e01bc2c2a1dc289eca5e41ea73f0942efe6e95ca
|
2018-10-13 11:36:08
|
e01bc2c2a1dc289eca5e41ea73f0942efe6e95ca
|
diff --git a/pre_commit_hooks/end_of_file_fixer.py b/pre_commit_hooks/end_of_file_fixer.py
index 4fe82b7..5ab1b7b 100644
--- a/pre_commit_hooks/end_of_file_fixer.py
+++ b/pre_commit_hooks/end_of_file_fixer.py
@@ -15,13 +15,13 @@ def fix_file(file_obj):
return 0
last_character = file_obj.read(1)
# last_character will be '' for an empty file
- if last_character != b'\n' and last_character != b'':
+ if last_character not in {b'\n', b'\r'} and last_character != b'':
# Needs this seek for windows, otherwise IOError
file_obj.seek(0, os.SEEK_END)
file_obj.write(b'\n')
return 1
- while last_character == b'\n':
+ while last_character in {b'\n', b'\r'}:
# Deal with the beginning of the file
if file_obj.tell() == 1:
# If we've reached the beginning of the file and it is all
@@ -35,13 +35,16 @@ def fix_file(file_obj):
last_character = file_obj.read(1)
# Our current position is at the end of the file just before any amount of
- # newlines. If we read two characters and get two newlines back we know
- # there are extraneous newlines at the ned of the file. Then backtrack and
- # trim the end off.
- if len(file_obj.read(2)) == 2:
- file_obj.seek(-1, os.SEEK_CUR)
- file_obj.truncate()
- return 1
+ # newlines. If we find extraneous newlines, then backtrack and trim them.
+ position = file_obj.tell()
+ remaining = file_obj.read()
+ for sequence in (b'\n', b'\r\n', b'\r'):
+ if remaining == sequence:
+ return 0
+ elif remaining.startswith(sequence):
+ file_obj.seek(position + len(sequence))
+ file_obj.truncate()
+ return 1
return 0
|
end-of-file-fixer doesn't handle CRLF
When comparing the last two characters for consecutive `\n`, since `\r` doesn't match, it won't fix `\r\n\r\n\r\n` and so on. Noticed this in an old version (0.7.0), but it still applies to the latest (2.0.0) as well.
|
pre-commit/pre-commit-hooks
|
diff --git a/tests/end_of_file_fixer_test.py b/tests/end_of_file_fixer_test.py
index ae899d2..f8710af 100644
--- a/tests/end_of_file_fixer_test.py
+++ b/tests/end_of_file_fixer_test.py
@@ -15,6 +15,10 @@ TESTS = (
(b'foo', 1, b'foo\n'),
(b'foo\n\n\n', 1, b'foo\n'),
(b'\xe2\x98\x83', 1, b'\xe2\x98\x83\n'),
+ (b'foo\r\n', 0, b'foo\r\n'),
+ (b'foo\r\n\r\n\r\n', 1, b'foo\r\n'),
+ (b'foo\r', 0, b'foo\r'),
+ (b'foo\r\r\r\r', 1, b'foo\r'),
)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 1
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
cfgv==3.3.1
coverage==6.2
distlib==0.3.9
filelock==3.4.1
flake8==5.0.4
identify==2.4.4
importlib-metadata==4.2.0
importlib-resources==5.2.3
iniconfig==1.1.1
mccabe==0.7.0
mock==5.2.0
nodeenv==1.6.0
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
pre-commit==2.17.0
-e git+https://github.com/pre-commit/pre-commit-hooks.git@e01bc2c2a1dc289eca5e41ea73f0942efe6e95ca#egg=pre_commit_hooks
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
PyYAML==6.0.1
six==1.17.0
toml==0.10.2
tomli==1.2.3
typing_extensions==4.1.1
virtualenv==20.16.2
zipp==3.6.0
|
name: pre-commit-hooks
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- cfgv==3.3.1
- coverage==6.2
- distlib==0.3.9
- filelock==3.4.1
- flake8==5.0.4
- identify==2.4.4
- importlib-metadata==4.2.0
- importlib-resources==5.2.3
- iniconfig==1.1.1
- mccabe==0.7.0
- mock==5.2.0
- nodeenv==1.6.0
- packaging==21.3
- platformdirs==2.4.0
- pluggy==1.0.0
- pre-commit==2.17.0
- py==1.11.0
- pycodestyle==2.9.1
- pyflakes==2.5.0
- pyparsing==3.1.4
- pytest==7.0.1
- pyyaml==6.0.1
- six==1.17.0
- toml==0.10.2
- tomli==1.2.3
- typing-extensions==4.1.1
- virtualenv==20.16.2
- zipp==3.6.0
prefix: /opt/conda/envs/pre-commit-hooks
|
[
"tests/end_of_file_fixer_test.py::test_fix_file[foo\\r\\n\\r\\n\\r\\n-1-foo\\r\\n]",
"tests/end_of_file_fixer_test.py::test_fix_file[foo\\r-0-foo\\r]",
"tests/end_of_file_fixer_test.py::test_fix_file[foo\\r\\r\\r\\r-1-foo\\r]",
"tests/end_of_file_fixer_test.py::test_integration[foo\\r\\n\\r\\n\\r\\n-1-foo\\r\\n]",
"tests/end_of_file_fixer_test.py::test_integration[foo\\r-0-foo\\r]",
"tests/end_of_file_fixer_test.py::test_integration[foo\\r\\r\\r\\r-1-foo\\r]"
] |
[] |
[
"tests/end_of_file_fixer_test.py::test_fix_file[foo\\n-0-foo\\n]",
"tests/end_of_file_fixer_test.py::test_fix_file[-0-]",
"tests/end_of_file_fixer_test.py::test_fix_file[\\n\\n-1-]",
"tests/end_of_file_fixer_test.py::test_fix_file[\\n\\n\\n\\n-1-]",
"tests/end_of_file_fixer_test.py::test_fix_file[foo-1-foo\\n]",
"tests/end_of_file_fixer_test.py::test_fix_file[foo\\n\\n\\n-1-foo\\n]",
"tests/end_of_file_fixer_test.py::test_fix_file[\\xe2\\x98\\x83-1-\\xe2\\x98\\x83\\n]",
"tests/end_of_file_fixer_test.py::test_fix_file[foo\\r\\n-0-foo\\r\\n]",
"tests/end_of_file_fixer_test.py::test_integration[foo\\n-0-foo\\n]",
"tests/end_of_file_fixer_test.py::test_integration[-0-]",
"tests/end_of_file_fixer_test.py::test_integration[\\n\\n-1-]",
"tests/end_of_file_fixer_test.py::test_integration[\\n\\n\\n\\n-1-]",
"tests/end_of_file_fixer_test.py::test_integration[foo-1-foo\\n]",
"tests/end_of_file_fixer_test.py::test_integration[foo\\n\\n\\n-1-foo\\n]",
"tests/end_of_file_fixer_test.py::test_integration[\\xe2\\x98\\x83-1-\\xe2\\x98\\x83\\n]",
"tests/end_of_file_fixer_test.py::test_integration[foo\\r\\n-0-foo\\r\\n]"
] |
[] |
MIT License
| 3,232 |
[
"pre_commit_hooks/end_of_file_fixer.py"
] |
[
"pre_commit_hooks/end_of_file_fixer.py"
] |
|
missionpinball__mpf-1236
|
1a9272de79eab757957e1aba112a59997f8f4f1a
|
2018-10-13 15:52:07
|
2c1bb3aa1e25674916bc4e0d17ccb6c3c87bd01b
|
diff --git a/mpf/devices/drop_target.py b/mpf/devices/drop_target.py
index 2ac95d3b5..e6eb21095 100644
--- a/mpf/devices/drop_target.py
+++ b/mpf/devices/drop_target.py
@@ -326,11 +326,18 @@ class DropTargetBank(SystemWideDevice, ModeDevice):
del kwargs
self.debug_log('Resetting')
+ if self.down == 0:
+ self.info_log('All targets are already up. Will not reset bank.')
+ return
+ else:
+ self.info_log('%s targets are down. Will reset those.', self.down)
+
# figure out all the coils we need to pulse
coils = set() # type: Set[Driver]
for drop_target in self.drop_targets:
- if drop_target.reset_coil:
+ # add all reset coil for targets which are down
+ if drop_target.reset_coil and drop_target.complete:
coils.add(drop_target.reset_coil)
for coil in self.reset_coils:
|
Only reset drop target banks when they are not reset
Currently we always trigger a reset no matter if the bank of up or down. Mirror the behavior of reset on individual drop targets. See this thread for an example: https://groups.google.com/forum/#!topic/mpf-users/kHq3dM1PMyo
|
missionpinball/mpf
|
diff --git a/mpf/tests/test_DropTargets.py b/mpf/tests/test_DropTargets.py
index 9b672f623..9be9c3b93 100644
--- a/mpf/tests/test_DropTargets.py
+++ b/mpf/tests/test_DropTargets.py
@@ -58,6 +58,16 @@ class TestDropTargets(MpfTestCase):
self.assertFalse(self.machine.drop_targets.left3.complete)
self.assertFalse(self.machine.drop_target_banks.left_bank.complete)
+ # check that the bank does not reset if already down
+ self.machine.coils.coil1.pulse = MagicMock()
+ self.machine.drop_target_banks['left_bank'].reset()
+ assert not self.machine.coils.coil1.pulse.called
+
+ # reset should work with one target down
+ self.hit_switch_and_run("switch1", 1)
+ self.machine.drop_target_banks['left_bank'].reset()
+ self.machine.coils.coil1.pulse.assert_called_once_with(max_wait_ms=100)
+
def test_knockdown_and_reset(self):
self.mock_event("unexpected_ball_on_playfield")
self.machine.coils.coil2.pulse = MagicMock(wraps=self.machine.coils.coil2.pulse)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
0.33
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"virtualenv",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y python3-venv"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
asciimatics==1.14.0
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
distlib==0.3.9
filelock==3.4.1
future==1.0.0
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
-e git+https://github.com/missionpinball/mpf.git@1a9272de79eab757957e1aba112a59997f8f4f1a#egg=mpf
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
Pillow==8.4.0
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
psutil==7.0.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyfiglet==0.8.post1
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pyserial==3.5
pyserial-asyncio==0.6
pytest==6.2.4
ruamel.base==1.0.0
ruamel.yaml==0.10.23
terminaltables==3.1.10
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing==3.7.4.3
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
virtualenv==20.17.1
wcwidth==0.2.13
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: mpf
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- asciimatics==1.14.0
- distlib==0.3.9
- filelock==3.4.1
- future==1.0.0
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- pillow==8.4.0
- platformdirs==2.4.0
- psutil==7.0.0
- pyfiglet==0.8.post1
- pyserial==3.5
- pyserial-asyncio==0.6
- ruamel-base==1.0.0
- ruamel-yaml==0.10.23
- terminaltables==3.1.10
- typing==3.7.4.3
- virtualenv==20.17.1
- wcwidth==0.2.13
prefix: /opt/conda/envs/mpf
|
[
"mpf/tests/test_DropTargets.py::TestDropTargets::test_drop_target_bank"
] |
[] |
[
"mpf/tests/test_DropTargets.py::TestDropTargets::test_drop_target_bank_ignore_ms",
"mpf/tests/test_DropTargets.py::TestDropTargets::test_drop_target_ignore_ms",
"mpf/tests/test_DropTargets.py::TestDropTargets::test_drop_target_reset",
"mpf/tests/test_DropTargets.py::TestDropTargets::test_drop_targets_in_mode",
"mpf/tests/test_DropTargets.py::TestDropTargets::test_knockdown_and_reset"
] |
[] |
MIT License
| 3,233 |
[
"mpf/devices/drop_target.py"
] |
[
"mpf/devices/drop_target.py"
] |
|
iterative__dvc-1223
|
a0b5bdd1433f116f39951d6b573ed2dccd263abf
|
2018-10-13 19:26:48
|
0ee7d5a7f823822445514dae1dc1db8bb4daec99
|
diff --git a/dvc/remote/local.py b/dvc/remote/local.py
index b6c4aa19c..2effd5b2b 100644
--- a/dvc/remote/local.py
+++ b/dvc/remote/local.py
@@ -81,14 +81,35 @@ class RemoteLOCAL(RemoteBase):
relpath = os.path.relpath(path, self.cache_dir)
return os.path.dirname(relpath) + os.path.basename(relpath)
- def changed_cache(self, md5):
+ def changed_cache_file(self, md5):
cache = self.get(md5)
if self.state.changed(cache, md5=md5):
if os.path.exists(cache):
- msg = 'Corrupted cache file {}'
+ msg = 'Corrupted cache file {}.'
Logger.warn(msg.format(os.path.relpath(cache)))
remove(cache)
return True
+ return False
+
+ def changed_cache(self, md5):
+ cache = self.get(md5)
+ clist = [(cache, md5)]
+
+ while True:
+ if len(clist) == 0:
+ break
+
+ cache, md5 = clist.pop()
+ if self.changed_cache_file(md5):
+ return True
+
+ if not self.is_dir_cache(cache):
+ continue
+
+ for entry in self.load_dir_cache(md5):
+ md5 = entry[self.PARAM_MD5]
+ cache = self.get(md5)
+ clist.append((cache, md5))
return False
@@ -512,7 +533,7 @@ class RemoteLOCAL(RemoteBase):
progress.update_target(title, 90, 100)
- local_exists = [not self.changed_cache(md5) for md5 in md5s]
+ local_exists = [not self.changed_cache_file(md5) for md5 in md5s]
progress.finish_target(title)
@@ -539,7 +560,7 @@ class RemoteLOCAL(RemoteBase):
names = []
# NOTE: filter files that are not corrupted
for md5, name in grouped:
- if self.changed_cache(md5):
+ if self.changed_cache_file(md5):
md5s.append(md5)
names.append(name)
@@ -617,7 +638,7 @@ class RemoteLOCAL(RemoteBase):
# NOTE: verifying that our cache is not corrupted
def func(info):
- return not self.changed_cache(info[self.PARAM_MD5])
+ return not self.changed_cache_file(info[self.PARAM_MD5])
checksum_infos = list(filter(func, checksum_infos))
progress.update_target(title, 20, 100)
diff --git a/dvc/state.py b/dvc/state.py
index 240aa3761..eccaf6c76 100644
--- a/dvc/state.py
+++ b/dvc/state.py
@@ -86,33 +86,34 @@ class State(object):
Logger.debug(cmd)
return self.c.execute(cmd)
- def _load(self):
+ def _load(self, empty=False):
from dvc import VERSION
- cmd = "PRAGMA user_version;"
- self._execute(cmd)
- ret = self.c.fetchall()
- assert len(ret) == 1
- assert len(ret[0]) == 1
- assert isinstance(ret[0][0], int)
- self.version = ret[0][0]
-
- if self.version > self.VERSION:
- msg = "You are using an old version '{}' of dvc that is using " \
- "state file version '{}' which is not compatible with the " \
- "state file version '{}' that is used in this projet. " \
- "Please upgrade right now!"
- raise DvcException(msg.format(VERSION,
- self.VERSION,
- self.version))
- elif self.version < self.VERSION:
- msg = "State file version '{}' is too old. " \
- "Reformatting to the current version '{}'."
- self.project.logger.warn(msg.format(self.version, self.VERSION))
- cmd = "DROP TABLE IF EXISTS {};"
- self._execute(cmd.format(self.STATE_TABLE))
- self._execute(cmd.format(self.STATE_INFO_TABLE))
- self._execute(cmd.format(self.LINK_STATE_TABLE))
+ if not empty:
+ cmd = "PRAGMA user_version;"
+ self._execute(cmd)
+ ret = self.c.fetchall()
+ assert len(ret) == 1
+ assert len(ret[0]) == 1
+ assert isinstance(ret[0][0], int)
+ version = ret[0][0]
+
+ if version > self.VERSION:
+ msg = "You are using an old version '{}' of dvc that is " \
+ "using state file version '{}' which is not " \
+ "compatible with the state file version '{}' that " \
+ "is used in this projet. Please upgrade right now!"
+ raise DvcException(msg.format(VERSION,
+ self.VERSION,
+ version))
+ elif version < self.VERSION:
+ msg = "State file version '{}' is too old. " \
+ "Reformatting to the current version '{}'."
+ self.project.logger.warn(msg.format(version, self.VERSION))
+ cmd = "DROP TABLE IF EXISTS {};"
+ self._execute(cmd.format(self.STATE_TABLE))
+ self._execute(cmd.format(self.STATE_INFO_TABLE))
+ self._execute(cmd.format(self.LINK_STATE_TABLE))
# Check that the state file is indeed a database
cmd = "CREATE TABLE IF NOT EXISTS {} ({})"
@@ -137,13 +138,14 @@ class State(object):
assert self.db is None
assert self.c is None
assert self.inserts == 0
+ empty = not os.path.exists(self.state_file)
self.db = sqlite3.connect(self.state_file)
self.c = self.db.cursor()
# Try loading once to check that the file is indeed a database
# and reformat it if it is not.
try:
- self._load()
+ self._load(empty=empty)
return
except sqlite3.DatabaseError:
self.c.close()
|
dvc: don't forget to check if cache of the file inside directories had changed
I.e. changed_cache() from RemoteLOCAL should open dir cache entry and check that underlying cache files are ok as well.
|
iterative/dvc
|
diff --git a/tests/basic_env.py b/tests/basic_env.py
index 8c865a25d..978dba7d9 100644
--- a/tests/basic_env.py
+++ b/tests/basic_env.py
@@ -1,4 +1,5 @@
import os
+import uuid
import shutil
import tempfile
from git import Repo
@@ -38,8 +39,15 @@ class TestDir(TestCase):
with open(name, 'a') as f:
f.write(contents)
+ @staticmethod
+ def mkdtemp():
+ prefix = 'dvc-test.{}.'.format(os.getpid())
+ suffix = '.{}'.format(uuid.uuid4())
+ return tempfile.mkdtemp(prefix=prefix, suffix=suffix)
+
def setUp(self):
- self._root_dir = tempfile.mkdtemp()
+ self._root_dir = TestDir.mkdtemp()
+
self._pushd(self._root_dir)
self.create(self.FOO, self.FOO_CONTENTS)
self.create(self.BAR, self.BAR_CONTENTS)
diff --git a/tests/test_add.py b/tests/test_add.py
index 9fa7436f5..8b9e1af2b 100644
--- a/tests/test_add.py
+++ b/tests/test_add.py
@@ -2,7 +2,6 @@ import os
import stat
import shutil
import filecmp
-import tempfile
from dvc.main import main
from dvc.utils import file_md5
@@ -132,7 +131,7 @@ class TestAddFileInDir(TestDvc):
class TestAddExternalLocalFile(TestDvc):
def test(self):
- dname = tempfile.mkdtemp()
+ dname = TestDvc.mkdtemp()
fname = os.path.join(dname, 'foo')
shutil.copyfile(self.FOO, fname)
diff --git a/tests/test_cache.py b/tests/test_cache.py
index e73da66ff..1705eedd3 100644
--- a/tests/test_cache.py
+++ b/tests/test_cache.py
@@ -1,6 +1,5 @@
import os
import shutil
-import tempfile
from dvc.cache import Cache
from dvc.system import System
@@ -52,7 +51,7 @@ class TestCacheLoadBadDirCache(TestDvc):
class TestExternalCacheDir(TestDvc):
def test(self):
- cache_dir = tempfile.mkdtemp()
+ cache_dir = TestDvc.mkdtemp()
ret = main(['config', 'cache.dir', cache_dir])
self.assertEqual(ret, 0)
diff --git a/tests/test_checkout.py b/tests/test_checkout.py
index 1b15352c9..8df2c9d4d 100644
--- a/tests/test_checkout.py
+++ b/tests/test_checkout.py
@@ -6,6 +6,7 @@ import shutil
import filecmp
from dvc.main import main
+from dvc.project import Project
from tests.basic_env import TestDvc
from tests.test_repro import TestRepro
from dvc.stage import Stage
@@ -65,6 +66,32 @@ class TestCheckoutCorruptedCacheFile(TestRepro):
self.assertFalse(os.path.isfile(cache))
+class TestCheckoutCorruptedCacheDir(TestDvc):
+ def test(self):
+ # NOTE: using 'copy' so that cache and link don't have same inode
+ ret = main(['config', 'cache.type', 'copy'])
+ self.assertEqual(ret, 0)
+
+ self.dvc = Project('.')
+ stages = self.dvc.add(self.DATA_DIR)
+ self.assertEqual(len(stages), 1)
+ self.assertEqual(len(stages[0].outs), 1)
+ out = stages[0].outs[0]
+
+ # NOTE: modifying cache file for one of the files inside the directory
+ # to check if dvc will detect that the cache is corrupted.
+ entry = self.dvc.cache.local.load_dir_cache(out.md5)[0]
+ md5 = entry[self.dvc.cache.local.PARAM_MD5]
+ cache = self.dvc.cache.local.get(md5)
+
+ with open(cache, 'w+') as fobj:
+ fobj.write('1')
+
+ self.dvc.checkout()
+
+ self.assertFalse(os.path.exists(cache))
+
+
class TestCmdCheckout(TestCheckout):
def test(self):
ret = main(['checkout'])
diff --git a/tests/test_data_cloud.py b/tests/test_data_cloud.py
index 0e3737deb..f44051fed 100644
--- a/tests/test_data_cloud.py
+++ b/tests/test_data_cloud.py
@@ -6,7 +6,6 @@ import time
import uuid
import shutil
import getpass
-import tempfile
import platform
from dvc.main import main
@@ -105,7 +104,7 @@ def _should_test_hdfs():
def get_local_storagepath():
- return tempfile.mkdtemp()
+ return TestDvc.mkdtemp()
def get_local_url():
@@ -164,7 +163,7 @@ class TestDataCloud(TestDvc):
clist = [('s3://', RemoteS3),
('gs://', RemoteGS),
('ssh://user@localhost:/', RemoteSSH),
- (tempfile.mkdtemp(), RemoteLOCAL)]
+ (TestDvc.mkdtemp(), RemoteLOCAL)]
if _should_test_azure():
clist.append(('azure://ContainerName=', RemoteAzure))
diff --git a/tests/test_repro.py b/tests/test_repro.py
index ba55a949a..70db0abdc 100644
--- a/tests/test_repro.py
+++ b/tests/test_repro.py
@@ -4,7 +4,6 @@ import stat
import shutil
import filecmp
import getpass
-import tempfile
import posixpath
from subprocess import Popen, PIPE
@@ -655,7 +654,7 @@ class TestReproExternalSSH(TestReproExternalBase):
@property
def bucket(self):
if not self._dir:
- self._dir = tempfile.mkdtemp()
+ self._dir = TestDvc.mkdtemp()
return '{}@127.0.0.1:{}'.format(getpass.getuser(), self._dir)
def cmd(self, i, o):
@@ -702,7 +701,7 @@ class TestReproExternalSSH(TestReproExternalBase):
class TestReproExternalLOCAL(TestReproExternalBase):
def setUp(self):
super(TestReproExternalLOCAL, self).setUp()
- self.tmpdir = tempfile.mkdtemp()
+ self.tmpdir = TestDvc.mkdtemp()
def should_test(self):
return True
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
0.19
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[all]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage",
"codecov",
"xmltodict",
"awscli",
"google-compute-engine",
"Pygments",
"collective.checkdocs"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
altgraph==0.17.4
asciimatics==1.15.0
awscli==1.38.23
azure-common==1.1.28
azure-nspkg==3.0.2
azure-storage-blob==1.3.0
azure-storage-common==1.3.0
azure-storage-nspkg==3.1.0
bcrypt==4.3.0
boto==2.49.0
boto3==1.7.4
botocore==1.10.84
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
codecov==2.1.13
collective.checkdocs==0.2
colorama==0.4.6
configobj==5.0.9
configparser==7.2.0
coverage==7.8.0
cryptography==44.0.2
decorator==5.2.1
distro==1.9.0
docutils==0.16
-e git+https://github.com/iterative/dvc.git@a0b5bdd1433f116f39951d6b573ed2dccd263abf#egg=dvc
exceptiongroup==1.2.2
future==1.0.0
gitdb==4.0.12
GitPython==3.1.44
google-api-core==1.34.1
google-auth==2.38.0
google-cloud-core==0.28.1
google-cloud-storage==1.12.0
google-compute-engine==2.8.13
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
grandalf==0.6
idna==3.10
iniconfig==2.1.0
jmespath==0.10.0
jsonpath-rw==1.4.0
macholib==1.16.3
nanotime==0.5.2
networkx==3.2.1
packaging==24.2
paramiko==3.5.1
pefile==2024.8.26
pillow==11.1.0
pluggy==1.5.0
ply==3.11
protobuf==3.20.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pydot==3.0.4
pyfiglet==1.0.2
Pygments==2.19.1
PyInstaller==3.3.1
PyNaCl==1.5.0
pyparsing==3.2.3
pytest==8.3.5
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
rsa==4.7.2
s3transfer==0.1.13
schema==0.7.7
six==1.17.0
smmap==5.0.2
tomli==2.2.1
urllib3==1.26.20
wcwidth==0.2.13
xmltodict==0.14.2
zc.lockfile==3.0.post1
|
name: dvc
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- altgraph==0.17.4
- asciimatics==1.15.0
- awscli==1.38.23
- azure-common==1.1.28
- azure-nspkg==3.0.2
- azure-storage-blob==1.3.0
- azure-storage-common==1.3.0
- azure-storage-nspkg==3.1.0
- bcrypt==4.3.0
- boto==2.49.0
- boto3==1.7.4
- botocore==1.10.84
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- codecov==2.1.13
- collective-checkdocs==0.2
- colorama==0.4.6
- configobj==5.0.9
- configparser==7.2.0
- coverage==7.8.0
- cryptography==44.0.2
- decorator==5.2.1
- distro==1.9.0
- docutils==0.16
- exceptiongroup==1.2.2
- future==1.0.0
- gitdb==4.0.12
- gitpython==3.1.44
- google-api-core==1.34.1
- google-auth==2.38.0
- google-cloud-core==0.28.1
- google-cloud-storage==1.12.0
- google-compute-engine==2.8.13
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- grandalf==0.6
- idna==3.10
- iniconfig==2.1.0
- jmespath==0.10.0
- jsonpath-rw==1.4.0
- macholib==1.16.3
- nanotime==0.5.2
- networkx==3.2.1
- packaging==24.2
- paramiko==3.5.1
- pefile==2024.8.26
- pillow==11.1.0
- pluggy==1.5.0
- ply==3.11
- protobuf==3.20.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pydot==3.0.4
- pyfiglet==1.0.2
- pygments==2.19.1
- pyinstaller==3.3.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- rsa==4.7.2
- s3transfer==0.1.13
- schema==0.7.7
- six==1.17.0
- smmap==5.0.2
- tomli==2.2.1
- urllib3==1.26.20
- wcwidth==0.2.13
- xmltodict==0.14.2
- zc-lockfile==3.0.post1
prefix: /opt/conda/envs/dvc
|
[
"tests/test_checkout.py::TestCheckoutCorruptedCacheDir::test"
] |
[
"tests/test_checkout.py::TestCheckoutMissingMd5InStageFile::test",
"tests/test_repro.py::TestReproMissingMd5InStageFile::test",
"tests/test_repro.py::TestReproShell::test"
] |
[
"tests/test_add.py::TestAdd::test",
"tests/test_add.py::TestAddUnupportedFile::test",
"tests/test_add.py::TestAddDirectory::test",
"tests/test_add.py::TestAddDirectoryRecursive::test",
"tests/test_add.py::TestAddCmdDirectoryRecursive::test",
"tests/test_add.py::TestAddDirectoryWithForwardSlash::test",
"tests/test_add.py::TestAddTrackedFile::test",
"tests/test_add.py::TestAddDirWithExistingCache::test",
"tests/test_add.py::TestAddModifiedDir::test",
"tests/test_add.py::TestAddFileInDir::test",
"tests/test_add.py::TestAddExternalLocalFile::test",
"tests/test_add.py::TestCmdAdd::test",
"tests/test_cache.py::TestCache::test_all",
"tests/test_cache.py::TestCache::test_get",
"tests/test_cache.py::TestCacheLoadBadDirCache::test",
"tests/test_cache.py::TestExternalCacheDir::test",
"tests/test_cache.py::TestSharedCacheDir::test",
"tests/test_cache.py::TestCacheLinkType::test",
"tests/test_checkout.py::TestCheckout::test",
"tests/test_checkout.py::TestCheckoutSingleStage::test",
"tests/test_checkout.py::TestCheckoutCorruptedCacheFile::test",
"tests/test_checkout.py::TestCmdCheckout::test",
"tests/test_checkout.py::TestRemoveFilesWhenCheckout::test",
"tests/test_checkout.py::TestGitIgnoreBasic::test",
"tests/test_checkout.py::TestGitIgnoreWhenCheckout::test",
"tests/test_checkout.py::TestCheckoutEmptyDir::test",
"tests/test_checkout.py::TestCheckoutNotCachedFile::test",
"tests/test_data_cloud.py::TestDataCloud::test",
"tests/test_data_cloud.py::TestDataCloud::test_unsupported",
"tests/test_data_cloud.py::TestRemoteLOCAL::test",
"tests/test_data_cloud.py::TestDataCloudCLIBase::test",
"tests/test_data_cloud.py::TestCompatRemoteLOCALCLI::test",
"tests/test_data_cloud.py::TestRemoteLOCALCLI::test",
"tests/test_data_cloud.py::TestRemoteSSHCLI::test",
"tests/test_data_cloud.py::TestRemoteHDFSCLI::test",
"tests/test_data_cloud.py::TestCompatRemoteS3CLI::test",
"tests/test_data_cloud.py::TestRemoteS3CLI::test",
"tests/test_data_cloud.py::TestCompatRemoteGSCLI::test",
"tests/test_data_cloud.py::TestRemoteGSCLI::test",
"tests/test_data_cloud.py::TestRemoteAzureCLI::test",
"tests/test_data_cloud.py::TestDataCloudErrorCLI::test_error",
"tests/test_repro.py::TestReproFail::test",
"tests/test_repro.py::TestReproDepUnderDir::test",
"tests/test_repro.py::TestReproNoDeps::test",
"tests/test_repro.py::TestReproForce::test",
"tests/test_repro.py::TestReproChangedCode::test",
"tests/test_repro.py::TestReproChangedData::test",
"tests/test_repro.py::TestReproDry::test",
"tests/test_repro.py::TestReproUpToDate::test",
"tests/test_repro.py::TestReproDryNoExec::test",
"tests/test_repro.py::TestReproChangedDeepData::test",
"tests/test_repro.py::TestReproPipeline::test",
"tests/test_repro.py::TestReproPipeline::test_cli",
"tests/test_repro.py::TestReproPipelines::test",
"tests/test_repro.py::TestReproPipelines::test_cli",
"tests/test_repro.py::TestReproLocked::test",
"tests/test_repro.py::TestReproLocked::test_non_existing",
"tests/test_repro.py::TestReproPhony::test",
"tests/test_repro.py::TestNonExistingOutput::test",
"tests/test_repro.py::TestReproDataSource::test",
"tests/test_repro.py::TestReproChangedDir::test",
"tests/test_repro.py::TestReproChangedDirData::test",
"tests/test_repro.py::TestCmdRepro::test",
"tests/test_repro.py::TestCmdReproChdir::test",
"tests/test_repro.py::TestReproExternalBase::test",
"tests/test_repro.py::TestReproExternalS3::test",
"tests/test_repro.py::TestReproExternalGS::test",
"tests/test_repro.py::TestReproExternalHDFS::test",
"tests/test_repro.py::TestReproExternalSSH::test",
"tests/test_repro.py::TestReproExternalLOCAL::test"
] |
[] |
Apache License 2.0
| 3,234 |
[
"dvc/remote/local.py",
"dvc/state.py"
] |
[
"dvc/remote/local.py",
"dvc/state.py"
] |
|
PyCQA__pyflakes-371
|
60c3b35769984534e2ad03d76637357818fe0112
|
2018-10-14 01:49:34
|
f1444872d7e4abfe1359778bca56ad3fd59a6f9b
|
asottile: (your example of what I _should_ use also is invalid, your first function has parameter 1 typed as both `str` and `None`)
jayvdb: Ah sorry about that `str`/`None`, I was melding the pep example with your test function names, and messed up.
asottile: @jayvdb what did you want me to change about the test? please clarify
jayvdb: The [PEP](https://www.python.org/dev/peps/pep-0484/#function-method-overloading) uses
```
from typing import overload
class bytes:
...
@overload
def __getitem__(self, i: int) -> int: ...
@overload
def __getitem__(self, s: slice) -> bytes: ...
```
It is because of the inputs and outputs that this is beneficial and can not be expressed using `typing.Union`.
I thought it would be useful to include that, but it isnt necessary.
asottile: > The [PEP](https://www.python.org/dev/peps/pep-0484/#function-method-overloading) uses
>
> ```
> from typing import overload
>
> class bytes:
> ...
> @overload
> def __getitem__(self, i: int) -> int: ...
> @overload
> def __getitem__(self, s: slice) -> bytes: ...
> ```
>
> It is because of the inputs and outputs that this is beneficial and can not be expressed using `typing.Union`.
>
> I thought it would be useful to include that, but it isnt necessary.
The minimal example in the test also cannot be expressed via union:
```
None -> None
int -> int
```
|
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index f520325..ad25b5e 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -495,6 +495,28 @@ def getNodeName(node):
return node.name
+def is_typing_overload(value, scope):
+ def is_typing_overload_decorator(node):
+ return (
+ (
+ isinstance(node, ast.Name) and
+ node.id in scope and
+ scope[node.id].fullName == 'typing.overload'
+ ) or (
+ isinstance(node, ast.Attribute) and
+ isinstance(node.value, ast.Name) and
+ node.value.id == 'typing' and
+ node.attr == 'overload'
+ )
+ )
+
+ return (
+ isinstance(value.source, ast.FunctionDef) and
+ len(value.source.decorator_list) == 1 and
+ is_typing_overload_decorator(value.source.decorator_list[0])
+ )
+
+
class Checker(object):
"""
I check the cleanliness and sanity of Python code.
@@ -747,8 +769,9 @@ class Checker(object):
node, value.name, existing.source)
elif not existing.used and value.redefines(existing):
if value.name != '_' or isinstance(existing, Importation):
- self.report(messages.RedefinedWhileUnused,
- node, value.name, existing.source)
+ if not is_typing_overload(existing, self.scope):
+ self.report(messages.RedefinedWhileUnused,
+ node, value.name, existing.source)
elif isinstance(existing, Importation) and value.redefines(existing):
existing.redefined.append(node)
|
F811 (redefinition of unused variable) incorrectly triggered with @overload decorator
PEP 484 [introduced](https://www.python.org/dev/peps/pep-0484/#function-method-overloading) the `@overload` decorator for type annotations.
> [...] a series of `@overload`-decorated definitions must be followed by exactly one non-@overload-decorated definition (for the same function/method). The `@overload`-decorated definitions are for the benefit of the type checker only, since they will be overwritten by the non-`@overload`-decorated definition, while the latter is used at runtime but should be ignored by a type checker.
The following should pass PyFlakes without errors, but currently triggers F811 errors:
```python
from typing import overload
@overload
def utf8(value: None) -> None:
pass
@overload
def utf8(value: bytes) -> bytes:
pass
@overload
def utf8(value: str) -> bytes:
pass
def utf8(value):
pass # actual implementation
```
```
test.py:9:1: F811 redefinition of unused 'utf8' from line 4
test.py:14:1: F811 redefinition of unused 'utf8' from line 9
test.py:19:1: F811 redefinition of unused 'utf8' from line 14
```
|
PyCQA/pyflakes
|
diff --git a/pyflakes/test/test_doctests.py b/pyflakes/test/test_doctests.py
index aed7957..b6d0f65 100644
--- a/pyflakes/test/test_doctests.py
+++ b/pyflakes/test/test_doctests.py
@@ -33,7 +33,8 @@ class _DoctestMixin(object):
line.startswith('except ') or
line.startswith('finally:') or
line.startswith('else:') or
- line.startswith('elif ')):
+ line.startswith('elif ') or
+ (lines and lines[-1].startswith(('>>> @', '... @')))):
line = "... %s" % line
else:
line = ">>> %s" % line
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
index e5da024..b8301ea 100644
--- a/pyflakes/test/test_other.py
+++ b/pyflakes/test/test_other.py
@@ -291,6 +291,35 @@ class Test(TestCase):
pass
""")
+ def test_typingOverload(self):
+ """Allow intentional redefinitions via @typing.overload"""
+ self.flakes("""
+ import typing
+ from typing import overload
+
+ @overload
+ def f(s): # type: (None) -> None
+ pass
+
+ @overload
+ def f(s): # type: (int) -> int
+ pass
+
+ def f(s):
+ return s
+
+ @typing.overload
+ def g(s): # type: (None) -> None
+ pass
+
+ @typing.overload
+ def g(s): # type: (int) -> int
+ pass
+
+ def g(s):
+ return s
+ """)
+
def test_unaryPlus(self):
"""Don't die on unary +."""
self.flakes('+1')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"flake8==2.1.0",
"pep8==1.5.6",
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
flake8==2.1.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mccabe==0.7.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pep8==1.5.6
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
-e git+https://github.com/PyCQA/pyflakes.git@60c3b35769984534e2ad03d76637357818fe0112#egg=pyflakes
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: pyflakes
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- flake8==2.1.0
- mccabe==0.7.0
- pep8==1.5.6
prefix: /opt/conda/envs/pyflakes
|
[
"pyflakes/test/test_doctests.py::TestOther::test_typingOverload",
"pyflakes/test/test_other.py::Test::test_typingOverload"
] |
[] |
[
"pyflakes/test/test_doctests.py::Test::test_doctestCanReferToClass",
"pyflakes/test/test_doctests.py::Test::test_doctestCanReferToFunction",
"pyflakes/test/test_doctests.py::Test::test_global_module_scope_pollution",
"pyflakes/test/test_doctests.py::Test::test_global_undefined",
"pyflakes/test/test_doctests.py::Test::test_ignore_nested_function",
"pyflakes/test/test_doctests.py::Test::test_importBeforeDoctest",
"pyflakes/test/test_doctests.py::Test::test_importInDoctestAndAfter",
"pyflakes/test/test_doctests.py::Test::test_inaccessible_scope_class",
"pyflakes/test/test_doctests.py::Test::test_indentationErrorInDoctest",
"pyflakes/test/test_doctests.py::Test::test_nested_class",
"pyflakes/test/test_doctests.py::Test::test_nested_doctest_ignored",
"pyflakes/test/test_doctests.py::Test::test_noOffsetSyntaxErrorInDoctest",
"pyflakes/test/test_doctests.py::Test::test_offsetAfterDoctests",
"pyflakes/test/test_doctests.py::Test::test_offsetInDoctests",
"pyflakes/test/test_doctests.py::Test::test_offsetInLambdasInDoctests",
"pyflakes/test/test_doctests.py::Test::test_offsetWithMultiLineArgs",
"pyflakes/test/test_doctests.py::Test::test_scope_class",
"pyflakes/test/test_doctests.py::Test::test_singleUnderscoreInDoctest",
"pyflakes/test/test_doctests.py::Test::test_syntaxErrorInDoctest",
"pyflakes/test/test_doctests.py::TestOther::test_attrAugmentedAssignment",
"pyflakes/test/test_doctests.py::TestOther::test_breakInsideLoop",
"pyflakes/test/test_doctests.py::TestOther::test_breakOutsideLoop",
"pyflakes/test/test_doctests.py::TestOther::test_classFunctionDecorator",
"pyflakes/test/test_doctests.py::TestOther::test_classNameDefinedPreviously",
"pyflakes/test/test_doctests.py::TestOther::test_classNameUndefinedInClassBody",
"pyflakes/test/test_doctests.py::TestOther::test_classRedefinedAsFunction",
"pyflakes/test/test_doctests.py::TestOther::test_classRedefinition",
"pyflakes/test/test_doctests.py::TestOther::test_classWithReturn",
"pyflakes/test/test_doctests.py::TestOther::test_classWithYield",
"pyflakes/test/test_doctests.py::TestOther::test_classWithYieldFrom",
"pyflakes/test/test_doctests.py::TestOther::test_comparison",
"pyflakes/test/test_doctests.py::TestOther::test_containment",
"pyflakes/test/test_doctests.py::TestOther::test_continueInFinally",
"pyflakes/test/test_doctests.py::TestOther::test_continueInsideLoop",
"pyflakes/test/test_doctests.py::TestOther::test_continueOutsideLoop",
"pyflakes/test/test_doctests.py::TestOther::test_defaultExceptLast",
"pyflakes/test/test_doctests.py::TestOther::test_defaultExceptNotLast",
"pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentConditionally",
"pyflakes/test/test_doctests.py::TestOther::test_doubleAssignmentWithUse",
"pyflakes/test/test_doctests.py::TestOther::test_duplicateArgs",
"pyflakes/test/test_doctests.py::TestOther::test_ellipsis",
"pyflakes/test/test_doctests.py::TestOther::test_extendedSlice",
"pyflakes/test/test_doctests.py::TestOther::test_functionDecorator",
"pyflakes/test/test_doctests.py::TestOther::test_functionRedefinedAsClass",
"pyflakes/test/test_doctests.py::TestOther::test_function_arguments",
"pyflakes/test/test_doctests.py::TestOther::test_function_arguments_python3",
"pyflakes/test/test_doctests.py::TestOther::test_globalDeclaredInDifferentScope",
"pyflakes/test/test_doctests.py::TestOther::test_identity",
"pyflakes/test/test_doctests.py::TestOther::test_localReferencedBeforeAssignment",
"pyflakes/test/test_doctests.py::TestOther::test_loopControl",
"pyflakes/test/test_doctests.py::TestOther::test_modernProperty",
"pyflakes/test/test_doctests.py::TestOther::test_moduleWithReturn",
"pyflakes/test/test_doctests.py::TestOther::test_moduleWithYield",
"pyflakes/test/test_doctests.py::TestOther::test_moduleWithYieldFrom",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedClassFunction",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedFunction",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseFunction",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedIfElseInListComp",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedIfFunction",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedInDictComprehension",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedInGenerator",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedInSetComprehension",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedTryExceptFunction",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedTryFunction",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreFunction",
"pyflakes/test/test_doctests.py::TestOther::test_redefinedUnderscoreImportation",
"pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentErrors",
"pyflakes/test/test_doctests.py::TestOther::test_starredAssignmentNoError",
"pyflakes/test/test_doctests.py::TestOther::test_unaryPlus",
"pyflakes/test/test_doctests.py::TestOther::test_undefinedBaseClass",
"pyflakes/test/test_doctests.py::TestOther::test_varAugmentedAssignment",
"pyflakes/test/test_doctests.py::TestImports::test_aliasedImport",
"pyflakes/test/test_doctests.py::TestImports::test_aliasedImportShadowModule",
"pyflakes/test/test_doctests.py::TestImports::test_assignRHSFirst",
"pyflakes/test/test_doctests.py::TestImports::test_assignedToGlobal",
"pyflakes/test/test_doctests.py::TestImports::test_differentSubmoduleImport",
"pyflakes/test/test_doctests.py::TestImports::test_duplicateSubmoduleImport",
"pyflakes/test/test_doctests.py::TestImports::test_functionNamesAreBoundNow",
"pyflakes/test/test_doctests.py::TestImports::test_functionsRunLater",
"pyflakes/test/test_doctests.py::TestImports::test_futureImport",
"pyflakes/test/test_doctests.py::TestImports::test_futureImportFirst",
"pyflakes/test/test_doctests.py::TestImports::test_futureImportStar",
"pyflakes/test/test_doctests.py::TestImports::test_futureImportUndefined",
"pyflakes/test/test_doctests.py::TestImports::test_futureImportUsed",
"pyflakes/test/test_doctests.py::TestImports::test_ignoreNonImportRedefinitions",
"pyflakes/test/test_doctests.py::TestImports::test_importInClass",
"pyflakes/test/test_doctests.py::TestImports::test_importStar",
"pyflakes/test/test_doctests.py::TestImports::test_importStar_relative",
"pyflakes/test/test_doctests.py::TestImports::test_importUsedInMethodDefinition",
"pyflakes/test/test_doctests.py::TestImports::test_importedInClass",
"pyflakes/test/test_doctests.py::TestImports::test_localImportStar",
"pyflakes/test/test_doctests.py::TestImports::test_methodsDontUseClassScope",
"pyflakes/test/test_doctests.py::TestImports::test_nestedClassAndFunctionScope",
"pyflakes/test/test_doctests.py::TestImports::test_nestedFunctionsNestScope",
"pyflakes/test/test_doctests.py::TestImports::test_newAssignment",
"pyflakes/test/test_doctests.py::TestImports::test_nonGlobalDoesNotRedefine",
"pyflakes/test/test_doctests.py::TestImports::test_notUsedInNestedScope",
"pyflakes/test/test_doctests.py::TestImports::test_packageImport",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedButUsedLater",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedByClass",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedByExcept",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedByFor",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedByFunction",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedBySubclass",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedIf",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedIfElse",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedInClass",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunction",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedInNestedFunctionTwice",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedTry",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedTryElse",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExcept",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElse",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptElseFinally",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptFinally",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedTryExceptMulti",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedTryNested",
"pyflakes/test/test_doctests.py::TestImports::test_redefinedWhileUnused",
"pyflakes/test/test_doctests.py::TestImports::test_shadowedByFor",
"pyflakes/test/test_doctests.py::TestImports::test_shadowedByForDeep",
"pyflakes/test/test_doctests.py::TestImports::test_shadowedByLambda",
"pyflakes/test/test_doctests.py::TestImports::test_shadowedByParameter",
"pyflakes/test/test_doctests.py::TestImports::test_tryingMultipleImports",
"pyflakes/test/test_doctests.py::TestImports::test_unusedImport",
"pyflakes/test/test_doctests.py::TestImports::test_unusedImport_relative",
"pyflakes/test/test_doctests.py::TestImports::test_unusedInNestedScope",
"pyflakes/test/test_doctests.py::TestImports::test_unusedPackageImport",
"pyflakes/test/test_doctests.py::TestImports::test_unused_package_with_submodule_import",
"pyflakes/test/test_doctests.py::TestImports::test_usedAndGlobal",
"pyflakes/test/test_doctests.py::TestImports::test_usedImport",
"pyflakes/test/test_doctests.py::TestImports::test_usedImport_relative",
"pyflakes/test/test_doctests.py::TestImports::test_usedInAssert",
"pyflakes/test/test_doctests.py::TestImports::test_usedInAssignment",
"pyflakes/test/test_doctests.py::TestImports::test_usedInAttributeAssign",
"pyflakes/test/test_doctests.py::TestImports::test_usedInCall",
"pyflakes/test/test_doctests.py::TestImports::test_usedInClass",
"pyflakes/test/test_doctests.py::TestImports::test_usedInClassBase",
"pyflakes/test/test_doctests.py::TestImports::test_usedInDict",
"pyflakes/test/test_doctests.py::TestImports::test_usedInElifConditional",
"pyflakes/test/test_doctests.py::TestImports::test_usedInElse",
"pyflakes/test/test_doctests.py::TestImports::test_usedInExcept",
"pyflakes/test/test_doctests.py::TestImports::test_usedInExec",
"pyflakes/test/test_doctests.py::TestImports::test_usedInFor",
"pyflakes/test/test_doctests.py::TestImports::test_usedInForElse",
"pyflakes/test/test_doctests.py::TestImports::test_usedInFunction",
"pyflakes/test/test_doctests.py::TestImports::test_usedInGetattr",
"pyflakes/test/test_doctests.py::TestImports::test_usedInGlobal",
"pyflakes/test/test_doctests.py::TestImports::test_usedInIfBody",
"pyflakes/test/test_doctests.py::TestImports::test_usedInIfConditional",
"pyflakes/test/test_doctests.py::TestImports::test_usedInKeywordArg",
"pyflakes/test/test_doctests.py::TestImports::test_usedInLambda",
"pyflakes/test/test_doctests.py::TestImports::test_usedInList",
"pyflakes/test/test_doctests.py::TestImports::test_usedInListComp",
"pyflakes/test/test_doctests.py::TestImports::test_usedInLogic",
"pyflakes/test/test_doctests.py::TestImports::test_usedInOperators",
"pyflakes/test/test_doctests.py::TestImports::test_usedInParameterDefault",
"pyflakes/test/test_doctests.py::TestImports::test_usedInRaise",
"pyflakes/test/test_doctests.py::TestImports::test_usedInReturn",
"pyflakes/test/test_doctests.py::TestImports::test_usedInSlice",
"pyflakes/test/test_doctests.py::TestImports::test_usedInSliceObj",
"pyflakes/test/test_doctests.py::TestImports::test_usedInSubscript",
"pyflakes/test/test_doctests.py::TestImports::test_usedInTry",
"pyflakes/test/test_doctests.py::TestImports::test_usedInTryFinally",
"pyflakes/test/test_doctests.py::TestImports::test_usedInTuple",
"pyflakes/test/test_doctests.py::TestImports::test_usedInWhile",
"pyflakes/test/test_doctests.py::TestImports::test_usedInYield",
"pyflakes/test/test_doctests.py::TestImports::test_used_package_with_submodule_import",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_annotationUndefined",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_badNestedClass",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtinWindowsError",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_builtins",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarArgs",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedAsStarUnpack",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobal",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedByGlobalMultipleNames",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInDictionaryComprehension",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedFromLambdaInGenerator",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClass",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInClassNested",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInGenExp",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_definedInListComp",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_del",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditional",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_delConditionalNested",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_delExceptionInExcept",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_delGlobal",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_delUndefined",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhile",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileNested",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_delWhileTestUsage",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_doubleNestingReportsClosestName",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_dunderClass",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_functionsNeedGlobalScope",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalFromNestedScope",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalImportStar",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_globalInGlobalScope",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_global_reset_name_only",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_intermediateClassScopeIgnored",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgs",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_keywordOnlyArgsUndefined",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope2",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_laterRedefinedGlobalFromNestedScope3",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsBuiltins",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsFile",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsName",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicGlobalsPath",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_magicModuleInClassScope",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_metaClassUndefined",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_namesDeclaredInExceptBlocks",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_nestedClass",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefined",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedAugmentedAssignment",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionName",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive1",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringGlobalVariableFalsePositive2",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariable2",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive1",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedExceptionNameObscuringLocalVariableFalsePositive2",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInComprehension",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedFromLambdaInDictionaryComprehension",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInGenExpNested",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInListComp",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedInLoop",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_undefinedWithErrorHandler",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_unusedAsStarUnpack",
"pyflakes/test/test_doctests.py::TestUndefinedNames::test_usedAsStarUnpack",
"pyflakes/test/test_other.py::Test::test_attrAugmentedAssignment",
"pyflakes/test/test_other.py::Test::test_breakInsideLoop",
"pyflakes/test/test_other.py::Test::test_breakOutsideLoop",
"pyflakes/test/test_other.py::Test::test_classFunctionDecorator",
"pyflakes/test/test_other.py::Test::test_classNameDefinedPreviously",
"pyflakes/test/test_other.py::Test::test_classNameUndefinedInClassBody",
"pyflakes/test/test_other.py::Test::test_classRedefinedAsFunction",
"pyflakes/test/test_other.py::Test::test_classRedefinition",
"pyflakes/test/test_other.py::Test::test_classWithReturn",
"pyflakes/test/test_other.py::Test::test_classWithYield",
"pyflakes/test/test_other.py::Test::test_classWithYieldFrom",
"pyflakes/test/test_other.py::Test::test_comparison",
"pyflakes/test/test_other.py::Test::test_containment",
"pyflakes/test/test_other.py::Test::test_continueInFinally",
"pyflakes/test/test_other.py::Test::test_continueInsideLoop",
"pyflakes/test/test_other.py::Test::test_continueOutsideLoop",
"pyflakes/test/test_other.py::Test::test_defaultExceptLast",
"pyflakes/test/test_other.py::Test::test_defaultExceptNotLast",
"pyflakes/test/test_other.py::Test::test_doubleAssignmentConditionally",
"pyflakes/test/test_other.py::Test::test_doubleAssignmentWithUse",
"pyflakes/test/test_other.py::Test::test_duplicateArgs",
"pyflakes/test/test_other.py::Test::test_ellipsis",
"pyflakes/test/test_other.py::Test::test_extendedSlice",
"pyflakes/test/test_other.py::Test::test_functionDecorator",
"pyflakes/test/test_other.py::Test::test_functionRedefinedAsClass",
"pyflakes/test/test_other.py::Test::test_function_arguments",
"pyflakes/test/test_other.py::Test::test_function_arguments_python3",
"pyflakes/test/test_other.py::Test::test_globalDeclaredInDifferentScope",
"pyflakes/test/test_other.py::Test::test_identity",
"pyflakes/test/test_other.py::Test::test_localReferencedBeforeAssignment",
"pyflakes/test/test_other.py::Test::test_loopControl",
"pyflakes/test/test_other.py::Test::test_modernProperty",
"pyflakes/test/test_other.py::Test::test_moduleWithReturn",
"pyflakes/test/test_other.py::Test::test_moduleWithYield",
"pyflakes/test/test_other.py::Test::test_moduleWithYieldFrom",
"pyflakes/test/test_other.py::Test::test_redefinedClassFunction",
"pyflakes/test/test_other.py::Test::test_redefinedFunction",
"pyflakes/test/test_other.py::Test::test_redefinedIfElseFunction",
"pyflakes/test/test_other.py::Test::test_redefinedIfElseInListComp",
"pyflakes/test/test_other.py::Test::test_redefinedIfFunction",
"pyflakes/test/test_other.py::Test::test_redefinedInDictComprehension",
"pyflakes/test/test_other.py::Test::test_redefinedInGenerator",
"pyflakes/test/test_other.py::Test::test_redefinedInSetComprehension",
"pyflakes/test/test_other.py::Test::test_redefinedTryExceptFunction",
"pyflakes/test/test_other.py::Test::test_redefinedTryFunction",
"pyflakes/test/test_other.py::Test::test_redefinedUnderscoreFunction",
"pyflakes/test/test_other.py::Test::test_redefinedUnderscoreImportation",
"pyflakes/test/test_other.py::Test::test_starredAssignmentErrors",
"pyflakes/test/test_other.py::Test::test_starredAssignmentNoError",
"pyflakes/test/test_other.py::Test::test_unaryPlus",
"pyflakes/test/test_other.py::Test::test_undefinedBaseClass",
"pyflakes/test/test_other.py::Test::test_varAugmentedAssignment",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_static",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_tuple_empty",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_with_message",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assert_without_message",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInForLoop",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignInListComprehension",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToGlobal",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToMember",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignToNonlocal",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_assignmentInsideLoop",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_augmentedAssignmentImportedFunctionCall",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_closedOver",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_dictComprehension",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_doubleClosedOver",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunction",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptWithoutNameInFunctionTuple",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExcept",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUnusedInExceptInFunction",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_exceptionUsedInExcept",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_f_string",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_generatorExpression",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_ifexp",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_listUnpacking",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_setComprehensionAndLiteral",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_tracebackhideSpecialVariable",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_tupleUnpacking",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedUnderscoreVariable",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariable",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableAsLocals",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_unusedVariableNoLocals",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_variableUsedInLoop",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementAttributeName",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementComplicatedTarget",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementListNames",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNameDefinedInBody",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementNoNames",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleName",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameRedefined",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSingleNameUndefined",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscript",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementSubscriptUndefined",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNames",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesRedefined",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementTupleNamesUndefined",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInExpression",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_withStatementUndefinedInside",
"pyflakes/test/test_other.py::TestUnusedAssignment::test_yieldFromUndefined",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDef",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefAwait",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncDefUndefined",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncFor",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncForUnderscoreLoopVar",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWith",
"pyflakes/test/test_other.py::TestAsyncStatements::test_asyncWithItem",
"pyflakes/test/test_other.py::TestAsyncStatements::test_continueInAsyncForFinally",
"pyflakes/test/test_other.py::TestAsyncStatements::test_formatstring",
"pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncFor",
"pyflakes/test/test_other.py::TestAsyncStatements::test_loopControlInAsyncForElse",
"pyflakes/test/test_other.py::TestAsyncStatements::test_matmul",
"pyflakes/test/test_other.py::TestAsyncStatements::test_raise_notimplemented",
"pyflakes/test/test_other.py::TestAsyncStatements::test_variable_annotations",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_invalid_print_when_imported_from_future",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_as_condition_test",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_function_assignment",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_in_lambda",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_print_returned_in_function",
"pyflakes/test/test_other.py::TestIncompatiblePrintOperator::test_valid_print"
] |
[] |
MIT License
| 3,235 |
[
"pyflakes/checker.py"
] |
[
"pyflakes/checker.py"
] |
pytorch__ignite-288
|
83fe17dd513a4f0ed7fe1cfea6ea00541557465b
|
2018-10-14 12:05:14
|
6b8b16bac961f3d3af60befaa28ddd2f192fef16
|
diff --git a/.travis.yml b/.travis.yml
index 460e31d2..b50ef8a2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,14 +1,16 @@
language: python
+
python:
- "2.7"
- "3.5"
stages:
- - lint_check
- - test
- - docs
+ - Lint check
+ - Test
+ - Docs
+ - Deploy
-install:
+before_install: &before_install
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
@@ -18,13 +20,15 @@ install:
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
- - conda create -q -n test-environment -c pytorch python=$TRAVIS_PYTHON_VERSION numpy mock pytorch-cpu
- - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install enum34; fi
+ - conda create -q -n test-environment -c pytorch python=$TRAVIS_PYTHON_VERSION pytorch-cpu
- source activate test-environment
- - python setup.py install
- - pip install --upgrade pytest codecov pytest-cov
+ - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install enum34; fi
# Test contrib dependencies
- pip install tqdm scikit-learn
+
+install:
+ - python setup.py install
+ - pip install numpy mock pytest codecov pytest-cov
# Examples dependencies
- pip install visdom torchvision tensorboardX
- pip install gym
@@ -52,7 +56,7 @@ script:
# RL
# 1) Actor-Critic
- python examples/reinforcement_learning/actor_critic.py --max-episodes=2
- # 1) Reinforce
+ # 2) Reinforce
- python examples/reinforcement_learning/reinforce.py --max-episodes=2
#fast-neural-style
@@ -60,37 +64,37 @@ script:
- python examples/fast_neural_style/neural_style.py train --epochs 1 --cuda 0 --dataset test --dataroot . --image_size 32 --style_image examples/fast_neural_style/images/style_images/mosaic.jpg --style_size 32
after_success:
- # Ignore codecov failures as the codecov server is not
- # very reliable but we don't want travis to report a failure
- # in the github UI just because the coverage report failed to
- # be published.
- - codecov || echo "codecov upload failed"
+ - codecov
+
jobs:
include:
- - stage: lint_check
- python: "2.7"
+ - stage: Lint check
+ python: "3.5"
+ before_install: # Nothing to do
install: pip install flake8
script: flake8
after_success: # Nothing to do
-
# GitHub Pages Deployment: https://docs.travis-ci.com/user/deployment/pages/
- - stage: docs
+ - stage: Docs
python: "3.5"
+
+ # Use previously defined before_install
+ before_install: *before_install
+
install:
- # Minimal install : ignite and dependencies just to build the docs
- pip install -r docs/requirements.txt
- - pip install http://download.pytorch.org/whl/cpu/torch-0.4.1-cp35-cp35m-linux_x86_64.whl
- # Add contrib dependencies (otherwise doc is not built)
- - pip install scikit-learn scipy tqdm
# `pip install .` vs `python setup.py install` : 1st works better to produce _module/ignite with source links
- pip install .
+
script:
- cd docs && make html
# Create .nojekyll file to serve correctly _static and friends
- touch build/html/.nojekyll
after_success: # Nothing to do
+
+ # Deploy built docs when PR is merged to master
deploy:
provider: pages
skip-cleanup: true
@@ -99,3 +103,55 @@ jobs:
local_dir: docs/build/html
on:
branch: master
+
+ - stage: Deploy
+ python: "3.5"
+ if: tag IS present
+
+ # Use previously defined before_install
+ before_install: *before_install
+
+ install:
+ - python setup.py install
+
+ script: true
+
+ after_success: # Nothing to do
+
+ before_deploy:
+ # Conda deploy if on tag
+ # ANACONDA_TOKEN should be provided by Travis
+ # How to generate ANACONDA_TOKEN: https://docs.anaconda.com/anaconda-cloud/user-guide/tasks/work-with-accounts#creating-access-tokens
+
+ # https://conda.io/docs/user-guide/tasks/build-packages/install-conda-build.html
+ - conda install -y conda-build conda-verify anaconda-client
+ - conda config --set anaconda_upload no
+ - conda build --quiet --no-test --output-folder conda_build conda.recipe
+ # Convert to other platforms: OSX, WIN
+ - conda convert --platform win-64 conda_build/linux-64/*.tar.bz2 -o conda_build/
+ - conda convert --platform osx-64 conda_build/linux-64/*.tar.bz2 -o conda_build/
+ # Upload to Anaconda
+ # We could use --all but too much platforms to uploaded
+ - ls conda_build/*/*.tar.bz2 | xargs -I {} anaconda -v -t $ANACONDA_TOKEN upload -u pytorch {}
+
+
+ # PyPI Deployment: https://docs.travis-ci.com/user/deployment/pypi/
+ deploy:
+
+ provider: pypi
+
+ user: $PYPI_USER
+ # If password contains non alphanumeric characters
+ # https://github.com/travis-ci/dpl/issues/377
+ # pass it as secured variable
+ password: $PYPI_TOKEN
+ # otherwise, follow "How to encrypt the password": https://docs.travis-ci.com/user/encryption-keys/
+ # `travis encrypt deploy.password="password"`
+ # secure: "secured_password"
+
+ skip_cleanup: true
+
+ distributions: "sdist bdist_wheel"
+
+ on:
+ tags: true
diff --git a/conda.recipe/conda_build_config.yaml b/conda.recipe/conda_build_config.yaml
new file mode 100644
index 00000000..ac94cebf
--- /dev/null
+++ b/conda.recipe/conda_build_config.yaml
@@ -0,0 +1,5 @@
+python:
+ - 2.7
+ - 3.5
+ - 3.6
+ - 3.7
diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml
new file mode 100644
index 00000000..05db78d4
--- /dev/null
+++ b/conda.recipe/meta.yaml
@@ -0,0 +1,38 @@
+{% set data = load_setup_py_data() %}
+
+package:
+ name: ignite
+ version: {{ data['version'] }}
+
+source:
+ path: ..
+
+build:
+ number: 0
+ script: python setup.py install --single-version-externally-managed --record=record.txt
+
+# https://conda.io/docs/user-guide/tasks/build-packages/define-metadata.html#export-runtime-requirements
+requirements:
+ build:
+ - python
+ - setuptools
+ - pytorch
+ - enum34 # [py < 34]
+
+ run:
+ - python
+ - pytorch
+ - enum34 # [py < 34]
+
+test:
+ imports:
+ - ignite
+ - ignite.engine
+ - ignite.handlers
+ - ignite.metrics
+ - ignite.contrib
+
+about:
+ home: {{ data['url'] }}
+ license: {{ data['license'] }}
+ summary: {{ data['description'] }}
diff --git a/docs/source/concepts.rst b/docs/source/concepts.rst
index 6180e50b..04cfa862 100644
--- a/docs/source/concepts.rst
+++ b/docs/source/concepts.rst
@@ -28,7 +28,7 @@ For example, model trainer for a supervised task:
loss = loss_fn(y_pred, y)
loss.backward()
optimizer.step()
- return loss.data[0]
+ return loss.item()
trainer = Engine(update_model)
trainer.run(data, max_epochs=100)
diff --git a/docs/source/contrib/metrics.rst b/docs/source/contrib/metrics.rst
index f66573ef..9a1b1078 100644
--- a/docs/source/contrib/metrics.rst
+++ b/docs/source/contrib/metrics.rst
@@ -8,3 +8,5 @@ Contribution module of metrics
.. autoclass:: ROC_AUC
.. autoclass:: AveragePrecision
+
+.. autoclass:: MaximumAbsoluteError
diff --git a/examples/gan/dcgan.py b/examples/gan/dcgan.py
index cbeef985..03669add 100644
--- a/examples/gan/dcgan.py
+++ b/examples/gan/dcgan.py
@@ -308,8 +308,11 @@ def main(dataset, dataroot,
# attach running average metrics
monitoring_metrics = ['errD', 'errG', 'D_x', 'D_G_z1', 'D_G_z2']
- for metric in monitoring_metrics:
- RunningAverage(alpha=alpha, output_transform=lambda x: x[metric]).attach(trainer, metric)
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['errD']).attach(trainer, 'errD')
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['errG']).attach(trainer, 'errG')
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['D_x']).attach(trainer, 'D_x')
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['D_G_z1']).attach(trainer, 'D_G_z1')
+ RunningAverage(alpha=alpha, output_transform=lambda x: x['D_G_z2']).attach(trainer, 'D_G_z2')
# attach progress bar
pbar = ProgressBar()
diff --git a/ignite/__init__.py b/ignite/__init__.py
index ecd84fe4..65cd025d 100644
--- a/ignite/__init__.py
+++ b/ignite/__init__.py
@@ -1,4 +1,7 @@
import ignite.engine
import ignite.handlers
+import ignite.metrics
+import ignite.exceptions
+import ignite.contrib
__version__ = '0.1.0'
diff --git a/ignite/contrib/engines/tbptt.py b/ignite/contrib/engines/tbptt.py
index 33a85690..ba71a557 100644
--- a/ignite/contrib/engines/tbptt.py
+++ b/ignite/contrib/engines/tbptt.py
@@ -4,8 +4,8 @@ from enum import Enum
import torch
-from ignite._utils import convert_tensor, apply_to_tensor
-from ignite.engine import Engine
+from ignite._utils import apply_to_tensor
+from ignite.engine import Engine, _prepare_batch
class Tbptt_Events(Enum):
@@ -19,18 +19,6 @@ class Tbptt_Events(Enum):
TIME_ITERATION_COMPLETED = "time_iteration_completed"
-def _prepare_tbptt_batch(batch, tbptt_step, dim=0, device=None):
- """Prepare batch for tbptt trainer.
-
- Batch come from the dataloader. It is split in chunks along the time
- dimension and fed to the truncated backpropagation throught time trainer.
- """
- x, y = batch
- x = convert_tensor(x, device=device)
- y = convert_tensor(y, device=device)
- return zip(x.split(tbptt_step, dim=dim), y.split(tbptt_step, dim=dim))
-
-
def _detach_hidden(hidden):
"""Cut backpropagation graph.
@@ -46,7 +34,9 @@ def create_supervised_tbptt_trainer(
loss_fn,
tbtt_step,
dim=0,
- device=None
+ device=None,
+ non_blocking=False,
+ prepare_batch=_prepare_batch
):
"""Create a trainer for truncated backprop through time supervised models.
@@ -70,6 +60,11 @@ def create_supervised_tbptt_trainer(
dim (int): axis representing the time dimension
device (str, optional): device type specification (default: None).
Applies to both model and batches.
+ non_blocking (bool, optional): if True and this copy is between CPU and GPU,
+ the copy may occur asynchronously with respect to the host. For other cases,
+ this argument has no effect.
+ prepare_batch (Callable, optional): function that receives `batch`, `device`,
+ `non_blocking` and outputs tuple of tensors `(batch_x, batch_y)`.
Returns:
Engine: a trainer engine with supervised update function
@@ -82,11 +77,9 @@ def create_supervised_tbptt_trainer(
loss_list = []
hidden = None
- # Batches split in time chunks
- batch_splits = _prepare_tbptt_batch(
- batch, tbtt_step, dim=dim, device=device
- )
- for x_t, y_t in batch_splits:
+ x, y = batch
+ for batch_t in zip(x.split(tbtt_step, dim=dim), y.split(tbtt_step, dim=dim)):
+ x_t, y_t = prepare_batch(batch_t, device=device, non_blocking=non_blocking)
# Fire event for start of iteration
engine.fire_event(Tbptt_Events.TIME_ITERATION_STARTED)
# Forward, backward and
diff --git a/ignite/contrib/handlers/param_scheduler.py b/ignite/contrib/handlers/param_scheduler.py
index 6a663385..0ec27bbc 100644
--- a/ignite/contrib/handlers/param_scheduler.py
+++ b/ignite/contrib/handlers/param_scheduler.py
@@ -4,7 +4,14 @@ import numpy as np
class ParamScheduler(object):
- """Updates an optimizer's parameter value during training.
+ """An abstract class for updating an optimizer's parameter value during
+ training.
+
+ Args:
+ optimizer (`torch.optim.Optimizer`): the optimizer to use
+ param_name (str): name of optimizer's parameter to update
+ save_history (bool, optional): whether to log the parameter values
+ (default=False)
"""
def __init__(self, optimizer, param_name, save_history=False):
self.optimizer = optimizer
@@ -28,16 +35,28 @@ class ParamScheduler(object):
def get_param(self):
"""Method to get current optimizer's parameter value
-
"""
raise NotImplementedError()
class CyclicalScheduler(ParamScheduler):
- """Updates an optimizer's parameter value over a cycle of some size.
+ """An abstract class for updating an optimizer's parameter value over a
+ cycle of some size.
+
+ Args:
+ optimizer (`torch.optim.Optimizer`): the optimizer to use
+ param_name (str): name of optimizer's parameter to update
+ start_value (float): value at start of cycle
+ end_value (float) : value at the middle of the cycle
+ cycle_size (int) : length of cycle.
+ cycle_mult (float, optional) : ratio by which to change the cycle_size
+ at the end of each cycle (default=1),
+ save_history (bool, optional): whether to log the parameter values
+ (default: False)
- NOTE: If the scheduler is bound to an 'ITERATION_*' event, 'cycle_size' should usually be
- the number of batches in an epoch.
+ Note:
+ If the scheduler is bound to an 'ITERATION_*' event, 'cycle_size' should
+ usually be the number of batches in an epoch.
"""
def __init__(self,
optimizer,
@@ -47,7 +66,11 @@ class CyclicalScheduler(ParamScheduler):
cycle_size,
cycle_mult=1,
save_history=False):
- super(CyclicalScheduler, self).__init__(optimizer, param_name, save_history=save_history)
+ super(CyclicalScheduler, self).__init__(
+ optimizer,
+ param_name,
+ save_history=save_history
+ )
self.start_value = start_value
self.end_value = end_value
self.cycle_size = cycle_size
@@ -64,25 +87,172 @@ class CyclicalScheduler(ParamScheduler):
class LinearCyclicalScheduler(CyclicalScheduler):
- """
- Linearly adjusts param value to 'end_value' for a half-cycle, then linearly
+ """Linearly adjusts param value to 'end_value' for a half-cycle, then linearly
adjusts it back to 'start_value' for a half-cycle.
- """
- def __init__(self, *args, **kwargs):
- super(LinearCyclicalScheduler, self).__init__(*args, **kwargs)
+ Args:
+ optimizer (`torch.optim.Optimizer`): the optimizer to use
+ param_name (str): name of optimizer's parameter to update
+ start_value (float): value at start of cycle
+ end_value (float) : value at the middle of the cycle
+ cycle_size (int) : length of cycle.
+ cycle_mult (float, optional) : ratio by which to change the cycle_size
+ at the end of each cycle (default=1),
+ save_history (bool, optional): whether to log the parameter values
+ (default: False)
+
+ Note:
+ If the scheduler is bound to an 'ITERATION_*' event, 'cycle_size' should
+ usually be the number of batches in an epoch.
+
+ Examples:
+
+ .. code-block:: python
+
+ from ignite.contrib.handlers.param_scheduler import LinearCyclicalScheduler
+
+ scheduler = LinearCyclicalScheduler(optimizer, 'lr', 1e-3, 1e-1, len(train_loader))
+ trainer.add_event_handler(Events.ITERATION_COMPLETED, scheduler)
+ #
+ # Linearly increases the learning rate from 1e-3 to 1e-1 and back to 1e-3
+ # over the course of 1 epoch
+ #
+ """
def get_param(self):
cycle_progress = self.event_index / self.cycle_size
return self.end_value + (self.start_value - self.end_value) * abs(cycle_progress - 0.5) * 2
class CosineAnnealingScheduler(CyclicalScheduler):
- """
- Anneals 'start_value' to 'end_value' over each cycle.
- """
- def __init__(self, *args, **kwargs):
- super(CosineAnnealingScheduler, self).__init__(*args, **kwargs)
+ """Anneals 'start_value' to 'end_value' over each cycle.
+
+ The annealing takes the form of the first half of a cosine
+ wave (as suggested in [Smith17]_).
+
+ Args:
+ optimizer (`torch.optim.Optimizer`): the optimizer to use
+ param_name (str): name of optimizer's parameter to update
+ start_value (float): value at start of cycle
+ end_value (float) : value at the end of the cycle
+ cycle_size (int) : length of cycle.
+ cycle_mult (float, optional) : ratio by which to change the cycle_size
+ at the end of each cycle (default=1),
+ save_history (bool, optional): whether to log the parameter values
+ (default: False)
+
+ Note:
+ If the scheduler is bound to an 'ITERATION_*' event, 'cycle_size' should
+ usually be the number of batches in an epoch.
+ Examples:
+
+ .. code-block:: python
+
+ from ignite.contrib.handlers.param_scheduler import CosineAnnealingScheduler
+
+ scheduler = CosineAnnealingScheduler(optimizer, 'lr', 1e-1, 1e-3, len(train_loader))
+ trainer.add_event_handler(Events.ITERATION_COMPLETED, scheduler)
+ #
+ # Anneals the learning rate from 1e-1 to 1e-3 over the course of 1 epoch.
+ #
+
+ .. [Smith17] Smith, Leslie N. "Cyclical learning rates for training neural networks."
+ Applications of Computer Vision (WACV), 2017 IEEE Winter Conference on. IEEE, 2017
+ """
def get_param(self):
+ """Method to get current optimizer's parameter value
+ """
cycle_progress = self.event_index / self.cycle_size
- return self.start_value + ((self.end_value - self.start_value) / 2) * (1 + np.cos(np.pi * cycle_progress))
+ return self.start_value + ((self.end_value - self.start_value) / 2) * (1 - np.cos(np.pi * cycle_progress))
+
+
+class ConcatScheduler(ParamScheduler):
+ """Concat a list of Schedulers.
+
+ The `ConcatScheduler` cycles through a list of schedulers (given by
+ `schedulers_list`). Each element in the list is a tuple whose first
+ element is the scheduler class, the second is the parameters used for
+ instantiating the scheduler, and the third is the duration of the
+ scheduler. If duration is `None` the `ConcatScheduler` will not
+ switch to the next scheduler.
+
+ Args:
+ optimizer (`torch.optim.Optimizer`): the optimizer to use
+ param_name (str): name of optimizer's parameter to update
+ schedulers_list (list): List of three tuple of the order (scheduler_cls,
+ scheduler_kwds, duration).
+ save_history (bool, optional): whether to log the parameter values
+ (default: False)
+
+ Examples:
+
+ .. code-block:: python
+
+ from ignite.contrib.handlers.param_scheduler import ConcatScheduler
+ from ignite.contrib.handlers.param_scheduler import LinearCyclicalScheduler
+ from ignite.contrib.handlers.param_scheduler import CosineAnnealingScheduler
+
+ scheduler = ConcatScheduler(
+ optimizer,
+ "lr",
+ [
+ (
+ LinearCyclicalScheduler,
+ dict(
+ start_value=0.1,
+ end_value=0.5,
+ cycle_size=60
+ ),
+ 30
+ ),
+ (
+ CosineAnnealingScheduler,
+ dict(
+ start_value=0.5,
+ end_value=0.01,
+ cycle_size=60
+ ),
+ None
+ ),
+ ],
+ )
+ trainer.add_event_handler(Events.ITERATION_COMPLETED, scheduler)
+ #
+ # Sets the Learning rate linearly from 0.1 to 0.5 over 30 iterations. Then
+ # starts an annealing schedule from 0.5 to 0.01 over 60 iterations.
+ # The annealing cycles are repeated indefinitely.
+ #
+ """
+ def __init__(self,
+ optimizer,
+ param_name,
+ schedulers_list,
+ save_history=False):
+ super(ConcatScheduler, self).__init__(optimizer, param_name, save_history=save_history)
+ self._schedulers_list = schedulers_list
+ self._schedulers_index = 0
+ self._next_scheduler_switch = 0
+
+ def _next_scheduler(self):
+ scheduler_cls, scheduler_kwds, self._next_scheduler_switch = \
+ self._schedulers_list[self._schedulers_index]
+
+ kwds = scheduler_kwds.copy()
+ kwds.update(
+ dict(
+ optimizer=self.optimizer,
+ param_name=self.param_name,
+ save_history=self.save_history
+ )
+ )
+
+ self._scheduler = scheduler_cls(**kwds)
+ self._schedulers_index = (self._schedulers_index + 1) % len(self._schedulers_list)
+
+ def __call__(self, engine):
+ if self._next_scheduler_switch is not None:
+ self._next_scheduler_switch -= 1
+ if self._next_scheduler_switch <= 0:
+ self._next_scheduler()
+
+ return self._scheduler(engine)
diff --git a/ignite/contrib/handlers/tqdm_logger.py b/ignite/contrib/handlers/tqdm_logger.py
index 196f57f7..7cc0723a 100644
--- a/ignite/contrib/handlers/tqdm_logger.py
+++ b/ignite/contrib/handlers/tqdm_logger.py
@@ -10,46 +10,83 @@ class ProgressBar:
"""
TQDM progress bar handler to log training progress and computed metrics.
+ Args:
+ persist (bool, optional): set to ``True`` to persist the progress bar after completion (default = ``False``)
+
Examples:
- Create a progress bar that shows you some metrics as they are computed,
- by simply attaching the progress bar object to your engine.
+ Simple progress bar
+
+ .. code-block:: python
+
+ trainer = create_supervised_trainer(model, optimizer, loss)
+
+ pbar = ProgressBar()
+ pbar.attach(trainer)
+
+ Attach metrics that already have been computed at `ITERATION_COMPLETED` (such as `RunningAverage`)
.. code-block:: python
+ trainer = create_supervised_trainer(model, optimizer, loss)
+
+ RunningAverage(output_transform=lambda x: x).attach(trainer, 'loss')
+
pbar = ProgressBar()
pbar.attach(trainer, ['loss'])
+ Directly attach the engine's output
+
+ .. code-block:: python
+
+ trainer = create_supervised_trainer(model, optimizer, loss)
+
+ pbar = ProgressBar()
+ pbar.attach(trainer, output_transform=lambda x: {'loss': x})
+
Note:
When adding attaching the progress bar to an engine, it is recommend that you replace
every print operation in the engine's handlers triggered every iteration with
``pbar.log_message`` to guarantee the correct format of the stdout.
"""
- def __init__(self):
+ def __init__(self, persist=False):
self.pbar = None
+ self.persist = persist
def _reset(self, engine):
self.pbar = tqdm(
total=len(engine.state.dataloader),
- leave=False,
+ leave=self.persist,
bar_format='{desc}[{n_fmt}/{total_fmt}] {percentage:3.0f}%|{bar}{postfix} [{elapsed}<{remaining}]')
def _close(self, engine):
self.pbar.close()
self.pbar = None
- def _update(self, engine, metric_names=None):
+ def _update(self, engine, metric_names=None, output_transform=None):
if self.pbar is None:
self._reset(engine)
- self.pbar.set_description('Epoch {}'.format(engine.state.epoch))
+ self.pbar.set_description('Epoch [{}/{}]'.format(engine.state.epoch, engine.state.max_epochs))
+ metrics = {}
if metric_names is not None:
if not all(metric in engine.state.metrics for metric in metric_names):
+ self._close(engine)
raise KeyError("metrics not found in engine.state.metrics")
- metrics = {name: '{:.2e}'.format(engine.state.metrics[name]) for name in metric_names}
+ metrics.update({name: '{:.2e}'.format(engine.state.metrics[name]) for name in metric_names})
+
+ if output_transform is not None:
+ output_dict = output_transform(engine.state.output)
+
+ if not isinstance(output_dict, dict):
+ output_dict = {"output": output_dict}
+
+ metrics.update({name: '{:.2e}'.format(value) for name, value in output_dict.items()})
+
+ if metrics:
self.pbar.set_postfix(**metrics)
self.pbar.update()
@@ -64,16 +101,23 @@ class ProgressBar:
"""
tqdm.write(message)
- def attach(self, engine, metric_names=None):
+ def attach(self, engine, metric_names=None, output_transform=None):
"""
Attaches the progress bar to an engine object
Args:
engine (Engine): engine object
- metric_names (list): (Optional) list of the metrics names to log as the bar progresses
+ metric_names (list, optional): list of the metrics names to log as the bar progresses
+ output_transform (Callable, optional): a function to select what you want to print from the engine's
+ output. This function may return either a dictionary with entries in the format of ``{name: value}``,
+ or a single scalar, which will be displayed with the default name `output`.
"""
- if not isinstance(metric_names, list):
+ if metric_names is not None and not isinstance(metric_names, list):
raise TypeError("metric_names should be a list, got {} instead".format(type(metric_names)))
+ if output_transform is not None and not callable(output_transform):
+ raise TypeError("output_transform should be a function, got {} instead"
+ .format(type(output_transform)))
+
engine.add_event_handler(Events.EPOCH_COMPLETED, self._close)
- engine.add_event_handler(Events.ITERATION_COMPLETED, self._update, metric_names)
+ engine.add_event_handler(Events.ITERATION_COMPLETED, self._update, metric_names, output_transform)
diff --git a/ignite/contrib/metrics/__init__.py b/ignite/contrib/metrics/__init__.py
index 3e52ca91..9f0d40b1 100644
--- a/ignite/contrib/metrics/__init__.py
+++ b/ignite/contrib/metrics/__init__.py
@@ -1,3 +1,4 @@
from ignite.contrib.metrics.average_precision import AveragePrecision
from ignite.contrib.metrics.roc_auc import ROC_AUC
+from ignite.contrib.metrics.mae import MaximumAbsoluteError
diff --git a/ignite/contrib/metrics/mae.py b/ignite/contrib/metrics/mae.py
new file mode 100644
index 00000000..45f3fbae
--- /dev/null
+++ b/ignite/contrib/metrics/mae.py
@@ -0,0 +1,24 @@
+from ignite.metrics import Metric
+from ignite.exceptions import NotComputableError
+import torch
+
+
+class MaximumAbsoluteError(Metric):
+ """
+ Calculates the maximum absolute error.
+
+ - `update` must receive output of the form `(y_pred, y)`.
+ """
+ def reset(self):
+ self._max_of_absolute_errors = -1
+
+ def update(self, output):
+ y_pred, y = output
+ mae = torch.abs(y_pred - y.view_as(y_pred)).max().item()
+ if self._max_of_absolute_errors < mae:
+ self._max_of_absolute_errors = mae
+
+ def compute(self):
+ if self._max_of_absolute_errors < 0:
+ raise NotComputableError('MaximumAbsoluteError must have at least one example before it can be computed')
+ return self._max_of_absolute_errors
diff --git a/ignite/engine/__init__.py b/ignite/engine/__init__.py
index ac7128d3..ccb4de54 100644
--- a/ignite/engine/__init__.py
+++ b/ignite/engine/__init__.py
@@ -5,6 +5,9 @@ from ignite._utils import convert_tensor
def _prepare_batch(batch, device=None, non_blocking=False):
+ """Prepare batch for training: pass to a device with options
+
+ """
x, y = batch
return (convert_tensor(x, device=device, non_blocking=non_blocking),
convert_tensor(y, device=device, non_blocking=non_blocking))
diff --git a/ignite/metrics/loss.py b/ignite/metrics/loss.py
index ca809855..41fe6deb 100644
--- a/ignite/metrics/loss.py
+++ b/ignite/metrics/loss.py
@@ -20,12 +20,16 @@ class Loss(Metric):
The output is is expected to be a tuple (prediction, target) or
(prediction, target, kwargs) where kwargs is a dictionary of extra
keywords arguments.
+ batch_size (callable): a callable taking a target tensor that returns the
+ first dimension size (usually the batch size).
"""
- def __init__(self, loss_fn, output_transform=lambda x: x):
+ def __init__(self, loss_fn, output_transform=lambda x: x,
+ batch_size=lambda x: x.shape[0]):
super(Loss, self).__init__(output_transform)
self._loss_fn = loss_fn
+ self._batch_size = batch_size
def reset(self):
self._sum = 0
@@ -42,8 +46,9 @@ class Loss(Metric):
if len(average_loss.shape) != 0:
raise ValueError('loss_fn did not return the average loss')
- self._sum += average_loss.item() * y.shape[0]
- self._num_examples += y.shape[0]
+ N = self._batch_size(y)
+ self._sum += average_loss.item() * N
+ self._num_examples += N
def compute(self):
if self._num_examples == 0:
|
[Feature Request] Parameter scheduling
Providing an abstraction to adjust optimizer parameters during training seems like it might be useful - techniques like [SGDR](https://arxiv.org/pdf/1608.03983.pdf) seem applicable to many types of models.
The [`torch.optim.lr_scheduler`](https://pytorch.org/docs/master/optim.html#how-to-adjust-learning-rate) module in PyTorch core implements some useful schedulers, but (a) can only adjust the LR, and (b) only adjusts it per-epoch.
On the other hand, the `Engine` event API seems like a really natural way to adjust parameter values, since handlers that manipulate them could be added for either `ITERATION_*` or `EPOCH_*` events, and modifying multiple parameters at once (e.g. LR and momentum) would be straightforward too.
I wrote a short [IPython notebook](https://gist.github.com/sean-adler/467321a23805736f8dc06a19157b0567) as a prototype of one way it could look to do this with the event API in a general way (plots are at the very bottom). I left most of the actual scheduler code in separate files for now to try and see if the idea is even worth it first. Would this be useful?
|
pytorch/ignite
|
diff --git a/tests/ignite/contrib/handlers/test_param_scheduler.py b/tests/ignite/contrib/handlers/test_param_scheduler.py
index 927d70da..d6c3bf0b 100644
--- a/tests/ignite/contrib/handlers/test_param_scheduler.py
+++ b/tests/ignite/contrib/handlers/test_param_scheduler.py
@@ -4,6 +4,7 @@ import torch
from ignite.engine import Engine, Events
from ignite.contrib.handlers.param_scheduler import LinearCyclicalScheduler, CosineAnnealingScheduler
+from ignite.contrib.handlers.param_scheduler import ConcatScheduler
def test_linear_scheduler():
@@ -56,7 +57,7 @@ def test_cosine_annealing_scheduler():
tensor = torch.zeros([1], requires_grad=True)
optimizer = torch.optim.SGD([tensor], lr=0)
- scheduler = CosineAnnealingScheduler(optimizer, 'lr', 1, 0, 10)
+ scheduler = CosineAnnealingScheduler(optimizer, 'lr', 0, 1, 10)
lrs = []
def save_lr(engine):
@@ -75,6 +76,56 @@ def test_cosine_annealing_scheduler():
]))
+def test_concat_scheduler():
+ tensor = torch.zeros([1], requires_grad=True)
+ optimizer = torch.optim.SGD([tensor], lr=0)
+
+ concat_scheduler = ConcatScheduler(
+ optimizer=optimizer,
+ param_name='lr',
+ schedulers_list=[
+ (
+ LinearCyclicalScheduler,
+ dict(
+ start_value=1,
+ end_value=0,
+ cycle_size=10
+ ),
+ 10
+ ),
+ (
+ CosineAnnealingScheduler,
+ dict(
+ start_value=0,
+ end_value=1,
+ cycle_size=10
+ ),
+ None
+ )
+ ],
+ save_history=True
+ )
+
+ lrs = []
+
+ def save_lr(engine):
+ lrs.append(optimizer.param_groups[0]['lr'])
+
+ trainer = Engine(lambda engine, batch: None)
+ trainer.add_event_handler(Events.ITERATION_COMPLETED, concat_scheduler)
+ trainer.add_event_handler(Events.ITERATION_COMPLETED, save_lr)
+ trainer.run([0] * 10, max_epochs=2)
+
+ assert lrs == list(map(pytest.approx, [
+ # Cycle 1 of the LinearCyclicalScheduler
+ 1.0, 0.8, 0.6, 0.4, 0.2,
+ 0.0, 0.2, 0.4, 0.6, 0.8,
+ # Cycle 1 of the CosineAnnealingScheduler
+ 0.0, 0.02447174185242318, 0.09549150281252627, 0.20610737385376332, 0.3454915028125263,
+ 0.5, 0.6545084971874737, 0.7938926261462365, 0.9045084971874737, 0.9755282581475768,
+ ]))
+
+
def test_save_param_history():
tensor = torch.zeros([1], requires_grad=True)
optimizer = torch.optim.SGD([tensor], lr=0)
diff --git a/tests/ignite/contrib/handlers/test_pbar.py b/tests/ignite/contrib/handlers/test_pbar.py
index aeecbb51..68d1d1f1 100644
--- a/tests/ignite/contrib/handlers/test_pbar.py
+++ b/tests/ignite/contrib/handlers/test_pbar.py
@@ -9,8 +9,9 @@ from ignite.metrics import CategoricalAccuracy
def update_fn(engine, batch):
- engine.state.metrics['a'] = 1
- return None
+ a = 1
+ engine.state.metrics['a'] = a
+ return a
def test_pbar(capsys):
@@ -28,7 +29,7 @@ def test_pbar(capsys):
err = captured.err.split('\r')
err = list(map(lambda x: x.strip(), err))
err = list(filter(None, err))
- expected = u'Epoch 2: [1/2] 50%|█████ , a=1.00e+00 [00:00<00:00]'
+ expected = u'Epoch [2/2]: [1/2] 50%|█████ , a=1.00e+00 [00:00<00:00]'
assert err[-1] == expected
@@ -66,3 +67,67 @@ def test_pbar_with_metric():
with pytest.raises(KeyError):
trainer.run(data=data, max_epochs=1)
+
+
+def test_pbar_no_metric_names(capsys):
+
+ n_epochs = 2
+ loader = [1, 2]
+ engine = Engine(update_fn)
+
+ pbar = ProgressBar()
+ pbar.attach(engine)
+
+ engine.run(loader, max_epochs=n_epochs)
+
+ captured = capsys.readouterr()
+ err = captured.err.split('\r')
+ err = list(map(lambda x: x.strip(), err))
+ err = list(filter(None, err))
+ actual = err[-1]
+ expected = u'Epoch [2/2]: [1/2] 50%|█████ [00:00<00:00]'
+ assert actual == expected
+
+
+def test_pbar_with_output(capsys):
+ n_epochs = 2
+ loader = [1, 2]
+ engine = Engine(update_fn)
+
+ pbar = ProgressBar()
+ pbar.attach(engine, output_transform=lambda x: {'a': x})
+
+ engine.run(loader, max_epochs=n_epochs)
+
+ captured = capsys.readouterr()
+ err = captured.err.split('\r')
+ err = list(map(lambda x: x.strip(), err))
+ err = list(filter(None, err))
+ expected = u'Epoch [2/2]: [1/2] 50%|█████ , a=1.00e+00 [00:00<00:00]'
+ assert err[-1] == expected
+
+
+def test_pbar_fail_with_non_callable_transform():
+ engine = Engine(update_fn)
+ pbar = ProgressBar()
+
+ with pytest.raises(TypeError):
+ pbar.attach(engine, output_transform=1)
+
+
+def test_pbar_with_scalar_output(capsys):
+ n_epochs = 2
+ loader = [1, 2]
+ engine = Engine(update_fn)
+
+ pbar = ProgressBar()
+ pbar.attach(engine, output_transform=lambda x: x)
+
+ engine.run(loader, max_epochs=n_epochs)
+
+ captured = capsys.readouterr()
+ err = captured.err.split('\r')
+ err = list(map(lambda x: x.strip(), err))
+ err = list(filter(None, err))
+ expected = u'Epoch [2/2]: [1/2] 50%|█████ , output=1.00e+00 [00:00<00:00]'
+ assert err[-1] == expected
diff --git a/tests/ignite/contrib/metrics/test_mae.py b/tests/ignite/contrib/metrics/test_mae.py
new file mode 100644
index 00000000..46f36cf4
--- /dev/null
+++ b/tests/ignite/contrib/metrics/test_mae.py
@@ -0,0 +1,26 @@
+from ignite.contrib.metrics import MaximumAbsoluteError
+import torch
+from pytest import approx
+
+
+def test_maximum_absolute_error():
+ a = torch.tensor([0.0, 0.2, -0.8])
+ b = torch.tensor([1.0, -2.0, 3.0])
+ c = torch.tensor([0.0, 2.0, 0.0])
+ d = torch.tensor([0.0, 0.0, -5.0])
+ ground_truth = torch.tensor([0.0, 0.0, 0.0])
+
+ m = MaximumAbsoluteError()
+ m.reset()
+
+ m.update((a, ground_truth))
+ assert m.compute() == approx(0.8)
+
+ m.update((b, ground_truth))
+ assert m.compute() == approx(3.0)
+
+ m.update((c, ground_truth))
+ assert m.compute() == approx(3.0)
+
+ m.update((d, ground_truth))
+ assert m.compute() == approx(5.0)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 11
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"numpy",
"mock",
"pytest",
"codecov",
"pytest-cov",
"tqdm",
"scikit-learn",
"visdom",
"torchvision",
"tensorboardX",
"gym"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
charset-normalizer==2.0.12
cloudpickle==2.2.1
codecov==2.1.13
coverage==6.2
dataclasses==0.8
decorator==4.4.2
gym==0.26.2
gym-notices==0.0.8
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
importlib-resources==5.4.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
joblib==1.1.1
jsonpatch==1.32
jsonpointer==2.3
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
networkx==2.5.1
numpy==1.19.5
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
Pillow==8.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
protobuf==4.21.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytest-cov==4.0.0
-e git+https://github.com/pytorch/ignite.git@83fe17dd513a4f0ed7fe1cfea6ea00541557465b#egg=pytorch_ignite
requests==2.27.1
scikit-learn==0.24.2
scipy==1.5.4
six==1.17.0
tensorboardX==2.6.2.2
threadpoolctl==3.1.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
torch==1.10.1
torchvision==0.11.2
tornado==6.1
tqdm==4.64.1
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
visdom==0.2.4
websocket-client==1.3.1
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: ignite
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- charset-normalizer==2.0.12
- cloudpickle==2.2.1
- codecov==2.1.13
- coverage==6.2
- dataclasses==0.8
- decorator==4.4.2
- gym==0.26.2
- gym-notices==0.0.8
- idna==3.10
- importlib-resources==5.4.0
- joblib==1.1.1
- jsonpatch==1.32
- jsonpointer==2.3
- mock==5.2.0
- networkx==2.5.1
- numpy==1.19.5
- pillow==8.4.0
- protobuf==4.21.0
- pytest-cov==4.0.0
- requests==2.27.1
- scikit-learn==0.24.2
- scipy==1.5.4
- six==1.17.0
- tensorboardx==2.6.2.2
- threadpoolctl==3.1.0
- tomli==1.2.3
- torch==1.10.1
- torchvision==0.11.2
- tornado==6.1
- tqdm==4.64.1
- urllib3==1.26.20
- visdom==0.2.4
- websocket-client==1.3.1
prefix: /opt/conda/envs/ignite
|
[
"tests/ignite/contrib/handlers/test_param_scheduler.py::test_linear_scheduler",
"tests/ignite/contrib/handlers/test_param_scheduler.py::test_cosine_annealing_scheduler",
"tests/ignite/contrib/handlers/test_param_scheduler.py::test_concat_scheduler",
"tests/ignite/contrib/handlers/test_param_scheduler.py::test_save_param_history",
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar",
"tests/ignite/contrib/handlers/test_pbar.py::test_attach_fail_with_string",
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar_with_metric",
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar_no_metric_names",
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar_with_output",
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar_fail_with_non_callable_transform",
"tests/ignite/contrib/handlers/test_pbar.py::test_pbar_with_scalar_output",
"tests/ignite/contrib/metrics/test_mae.py::test_maximum_absolute_error"
] |
[] |
[] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,237 |
[
"examples/gan/dcgan.py",
"ignite/contrib/metrics/__init__.py",
"ignite/contrib/metrics/mae.py",
"conda.recipe/meta.yaml",
"ignite/__init__.py",
"docs/source/contrib/metrics.rst",
"ignite/engine/__init__.py",
".travis.yml",
"ignite/contrib/engines/tbptt.py",
"ignite/contrib/handlers/tqdm_logger.py",
"docs/source/concepts.rst",
"conda.recipe/conda_build_config.yaml",
"ignite/contrib/handlers/param_scheduler.py",
"ignite/metrics/loss.py"
] |
[
"examples/gan/dcgan.py",
"ignite/contrib/metrics/__init__.py",
"ignite/contrib/metrics/mae.py",
"conda.recipe/meta.yaml",
"ignite/__init__.py",
"docs/source/contrib/metrics.rst",
"ignite/engine/__init__.py",
".travis.yml",
"ignite/contrib/engines/tbptt.py",
"ignite/contrib/handlers/tqdm_logger.py",
"docs/source/concepts.rst",
"conda.recipe/conda_build_config.yaml",
"ignite/contrib/handlers/param_scheduler.py",
"ignite/metrics/loss.py"
] |
|
mahmoud__boltons-183
|
874e930bd6dbd92e64412e1bdb46a4053587c86d
|
2018-10-14 14:29:42
|
874e930bd6dbd92e64412e1bdb46a4053587c86d
|
diff --git a/.travis.yml b/.travis.yml
index 685ee76..517970b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,4 @@
language: python
-sudo: false
cache: pip
# Python targets, as defined by https://github.com/travis-ci/travis-build/blob
@@ -28,10 +27,8 @@ matrix:
include:
- python: 3.7
dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069)
- sudo: required # required for Python 3.7 (travis-ci/travis-ci#9069)
- python: nightly # Python 3.8.0a0
dist: xenial # required for Python 3.8-dev (travis-ci/travis-ci#9069)
- sudo: required # required for Python 3.8-dev (travis-ci/travis-ci#9069)
allow_failures:
- python: nightly
diff --git a/boltons/cacheutils.py b/boltons/cacheutils.py
index 6f90651..01009f0 100644
--- a/boltons/cacheutils.py
+++ b/boltons/cacheutils.py
@@ -511,6 +511,7 @@ class CachedMethod(object):
"""
def __init__(self, func, cache, scoped=True, typed=False, key=None):
self.func = func
+ self.__isabstractmethod__ = getattr(func, '__isabstractmethod__', False)
if isinstance(cache, basestring):
self.get_cache = attrgetter(cache)
elif callable(cache):
@@ -652,6 +653,7 @@ class cachedproperty(object):
"""
def __init__(self, func):
self.__doc__ = getattr(func, '__doc__')
+ self.__isabstractmethod__ = getattr(func, '__isabstractmethod__', False)
self.func = func
def __get__(self, obj, objtype=None):
diff --git a/boltons/dictutils.py b/boltons/dictutils.py
index f3583f7..c38fc26 100644
--- a/boltons/dictutils.py
+++ b/boltons/dictutils.py
@@ -106,17 +106,11 @@ class OrderedMultiDict(dict):
>>> omd
OrderedMultiDict([('b', 2)])
- Note that calling :func:`dict` on an OMD results in a dict of keys
- to *lists* of values:
+ If you want a safe-to-modify or flat dictionary, use
+ :meth:`OrderedMultiDict.todict()`.
- >>> from pprint import pprint as pp # ensuring proper key ordering
+ >>> from pprint import pprint as pp # preserve printed ordering
>>> omd = OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)])
- >>> pp(dict(omd))
- {'a': [1, 3], 'b': [2]}
-
- Note that modifying those lists will modify the OMD. If you want a
- safe-to-modify or flat dictionary, use :meth:`OrderedMultiDict.todict()`.
-
>>> pp(omd.todict())
{'a': 3, 'b': 2}
>>> pp(omd.todict(multi=True))
@@ -129,6 +123,19 @@ class OrderedMultiDict(dict):
>>> OrderedMultiDict([('a', 1), ('b', 2), ('a', 3)]).items(multi=False)
[('a', 3), ('b', 2)]
+ .. warning::
+
+ ``dict(omd)`` changed behavior `in Python 3.7
+ <https://bugs.python.org/issue34320>`_ due to changes made to
+ support the transition from :class:`collections.OrderedDict` to
+ the built-in dictionary being ordered. Before 3.7, the result
+ would be a new dictionary, with values that were lists, similar
+ to ``omd.todict(multi=True)`` (but only shallow-copy; the lists
+ were direct references to OMD internal structures). From 3.7
+ onward, the values became singular, like
+ ``omd.todict(multi=False)``. For reliable cross-version
+ behavior, just use :meth:`~OrderedMultiDict.todict()`.
+
"""
def __init__(self, *args, **kwargs):
if len(args) > 1:
diff --git a/boltons/fileutils.py b/boltons/fileutils.py
index 459b762..4d05647 100644
--- a/boltons/fileutils.py
+++ b/boltons/fileutils.py
@@ -455,9 +455,9 @@ _CUR_DIR = os.path.dirname(os.path.abspath(__file__))
def iter_find_files(directory, patterns, ignored=None):
- """Returns a generator that yields file paths under a *directory*,
- matching *patterns* using `glob`_ syntax (e.g., ``*.txt``). Also
- supports *ignored* patterns.
+ """Returns a generator that yields file paths under a *directory*
+ (recursively), matching *patterns* using `glob`_ syntax (e.g., ``*.txt``).
+ Also supports *ignored* patterns.
Args:
directory (str): Path that serves as the root of the
diff --git a/boltons/funcutils.py b/boltons/funcutils.py
index d5b7f33..3e30017 100644
--- a/boltons/funcutils.py
+++ b/boltons/funcutils.py
@@ -514,8 +514,6 @@ class FunctionBuilder(object):
body = self.body or self._default_body
tmpl = 'def {name}{sig_str}:'
- if self.doc:
- tmpl += '\n """{doc}"""'
tmpl += '\n{body}'
body = _indent(self.body, ' ' * self.indent)
diff --git a/boltons/iterutils.py b/boltons/iterutils.py
index 8f93cb2..bf89f1f 100644
--- a/boltons/iterutils.py
+++ b/boltons/iterutils.py
@@ -1182,6 +1182,51 @@ guid_iter = GUIDerator()
seq_guid_iter = SequentialGUIDerator()
+def soft_sorted(iterable, first=None, last=None, key=None, reverse=False):
+ """For when you care about the order of some elements, but not about
+ others.
+
+ Use this to float to the top and/or sink to the bottom a specific
+ ordering, while sorting the rest of the elements according to
+ normal :func:`sorted` rules.
+
+ >>> soft_sorted(['two', 'b', 'one', 'a'], first=['one', 'two'])
+ ['one', 'two', 'a', 'b']
+ >>> soft_sorted(range(7), first=[6, 15], last=[2, 4], reverse=True)
+ [6, 5, 3, 1, 0, 2, 4]
+ >>> import string
+ >>> ''.join(soft_sorted(string.hexdigits, first='za1', last='b', key=str.lower))
+ 'aA1023456789cCdDeEfFbB'
+
+ Args:
+ iterable (list): A list or other iterable to sort.
+ first (list): A sequence to enforce for elements which should
+ appear at the beginning of the returned list.
+ last (list): A sequence to enforce for elements which should
+ appear at the end of the returned list.
+ key (callable): Callable used to generate a comparable key for
+ each item to be sorted, same as the key in
+ :func:`sorted`. Note that entries in *first* and *last*
+ should be the keys for the items. Defaults to
+ passthrough/the identity function.
+ reverse (bool): Whether or not elements not explicitly ordered
+ by *first* and *last* should be in reverse order or not.
+
+ Returns a new list in sorted order.
+ """
+ first = first or []
+ last = last or []
+ key = key or (lambda x: x)
+ seq = list(iterable)
+ other = [x for x in seq if not ((first and key(x) in first) or (last and key(x) in last))]
+ other.sort(key=key, reverse=reverse)
+
+ if first:
+ first = sorted([x for x in seq if key(x) in first], key=lambda x: first.index(key(x)))
+ if last:
+ last = sorted([x for x in seq if key(x) in last], key=lambda x: last.index(key(x)))
+ return first + other + last
+
"""
May actually be faster to do an isinstance check for a str path
diff --git a/boltons/setutils.py b/boltons/setutils.py
index 3331069..6d0a957 100644
--- a/boltons/setutils.py
+++ b/boltons/setutils.py
@@ -402,9 +402,9 @@ class IndexedSet(MutableSet):
self.item_index_map[item] = i
del self.dead_indices[:]
- def sort(self):
+ def sort(self, **kwargs):
"sort() -> sort the contents of the set in-place"
- sorted_list = sorted(self)
+ sorted_list = sorted(self, **kwargs)
if sorted_list == self.item_list:
return
self.item_list[:] = sorted_list
diff --git a/boltons/strutils.py b/boltons/strutils.py
index 52f613d..a5baada 100644
--- a/boltons/strutils.py
+++ b/boltons/strutils.py
@@ -175,8 +175,12 @@ def singularize(word):
"""Semi-intelligently converts an English plural *word* to its
singular form, preserving case pattern.
- >>> singularize('records')
- 'record'
+ >>> singularize('chances')
+ 'chance'
+ >>> singularize('Activities')
+ 'Activity'
+ >>> singularize('Glasses')
+ 'Glass'
>>> singularize('FEET')
'FOOT'
@@ -192,9 +196,9 @@ def singularize(word):
return orig_word
elif len(word) == 2:
singular = word[:-1] # or just return word?
- elif word.endswith('ies') and word[-5:-4] not in 'aeiou':
+ elif word.endswith('ies') and word[-4:-3] not in 'aeiou':
singular = word[:-3] + 'y'
- elif word.endswith('es'):
+ elif word.endswith('es') and word[-3] == 's':
singular = word[:-2]
else:
singular = word[:-1]
@@ -234,8 +238,8 @@ def _match_case(master, disciple):
return disciple.lower()
elif master.upper() == master:
return disciple.upper()
- elif master.capitalize() == master:
- return disciple.capitalize()
+ elif master.title() == master:
+ return disciple.title()
return disciple
diff --git a/boltons/tableutils.py b/boltons/tableutils.py
index bc769d7..5cd07e0 100644
--- a/boltons/tableutils.py
+++ b/boltons/tableutils.py
@@ -27,10 +27,12 @@ from itertools import islice
from collections import Sequence, Mapping, MutableSequence
try:
string_types, integer_types = (str, unicode), (int, long)
+ from cgi import escape as html_escape
except NameError:
# Python 3 compat
unicode = str
string_types, integer_types = (str, bytes), (int,)
+ from html import escape as html_escape
try:
from typeutils import make_sentinel
@@ -75,7 +77,7 @@ def to_text(obj, maxlen=None):
def escape_html(obj, maxlen=None):
text = to_text(obj, maxlen=maxlen)
- return cgi.escape(text, quote=True)
+ return html_escape(text, quote=True)
_DNR = set((type(None), bool, complex, float,
diff --git a/boltons/urlutils.py b/boltons/urlutils.py
index c96ec08..223fad7 100644
--- a/boltons/urlutils.py
+++ b/boltons/urlutils.py
@@ -770,6 +770,12 @@ class URL(object):
cn = self.__class__.__name__
return u'%s(%r)' % (cn, self.to_text())
+ def __str__(self):
+ return self.to_text()
+
+ def __unicode__(self):
+ return self.to_text()
+
def __eq__(self, other):
for attr in self._cmp_attrs:
if not getattr(self, attr) == getattr(other, attr, None):
|
Represent the URL when str(url)
When working with `boltons.urlutils.URL`, it would be nice for `str(url)` to generate a string version of the URL, the same way it does when executing `url.to_text()`.
As of now it returns `URL('...')`, which is what you would expect when executing `repr()` but not `str()` (as per python docs, str should return a nice human representation whereas repr a formal python expression).
A part from making URL more intuitive and pythonic to use, this small change would allow it to nicely integrate with other libraries like [requests](https://github.com/requests/requests), which [automatically performs `str()`](https://github.com/requests/requests/pull/766) to non-string passed-in objects, so this would work:
```python
url = boltons.urlutils.URL('http://foo.com')
response = requests.get(url)
```
Which is just extra nice and useful :-)
Anyway, it is just a small enhancement in an already amazing library. Congratulations for it!
|
mahmoud/boltons
|
diff --git a/tests/test_cacheutils.py b/tests/test_cacheutils.py
index e617492..3911606 100644
--- a/tests/test_cacheutils.py
+++ b/tests/test_cacheutils.py
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
-
import string
+from abc import abstractmethod, ABCMeta
+
+import pytest
from boltons.cacheutils import LRU, LRI, cached, cachedmethod, cachedproperty, MinIDMap
@@ -263,6 +265,24 @@ def test_cachedmethod():
return
+def test_cachedmethod_maintains_func_abstraction():
+ ABC = ABCMeta('ABC', (object,), {})
+
+ class Car(ABC):
+
+ def __init__(self, cache=None):
+ self.h_cache = LRI() if cache is None else cache
+ self.hand_count = 0
+
+ @cachedmethod('h_cache')
+ @abstractmethod
+ def hand(self, *a, **kw):
+ self.hand_count += 1
+
+ with pytest.raises(TypeError):
+ Car()
+
+
def test_cachedproperty():
class Proper(object):
def __init__(self):
@@ -295,6 +315,20 @@ def test_cachedproperty():
repr(Proper.useful_attr)
+def test_cachedproperty_maintains_func_abstraction():
+ ABC = ABCMeta('ABC', (object,), {})
+
+ class AbstractExpensiveCalculator(ABC):
+
+ @cachedproperty
+ @abstractmethod
+ def calculate(self):
+ pass
+
+ with pytest.raises(TypeError):
+ AbstractExpensiveCalculator()
+
+
def test_min_id_map():
import sys
if '__pypy__' in sys.builtin_module_names:
diff --git a/tests/test_dictutils.py b/tests/test_dictutils.py
index 87c6317..01c9ab5 100644
--- a/tests/test_dictutils.py
+++ b/tests/test_dictutils.py
@@ -27,7 +27,7 @@ def test_todict():
assert len(omd) == 1
assert omd['A'] == 'One'
- d = dict(omd)
+ d = omd.todict(multi=True)
assert len(d) == 1
assert d['A'] == ['One', 'One', 'One']
@@ -40,6 +40,7 @@ def test_todict():
flat = omd.todict()
assert flat == d
+ return
def test_eq():
diff --git a/tests/test_funcutils.py b/tests/test_funcutils.py
index fe00c83..a0047a3 100644
--- a/tests/test_funcutils.py
+++ b/tests/test_funcutils.py
@@ -42,7 +42,7 @@ def test_copy_function():
assert callee() == callee_copy()
-class test_total_ordering():
+def test_total_ordering():
@total_ordering
class Number(object):
def __init__(self, val):
diff --git a/tests/test_funcutils_fb.py b/tests/test_funcutils_fb.py
index 625a85c..5420bc7 100644
--- a/tests/test_funcutils_fb.py
+++ b/tests/test_funcutils_fb.py
@@ -26,15 +26,15 @@ def test_wraps_basic():
@pita_wrap(flag=True)
def simple_func():
- "my doc string"
+ '''"""a tricky docstring"""'''
return 'hello'
assert simple_func() == (True, 'simple_func', 'hello')
- assert simple_func.__doc__ == "my doc string"
+ assert simple_func.__doc__ == '''"""a tricky docstring"""'''
assert callable(simple_func.__wrapped__)
assert simple_func.__wrapped__() == 'hello'
- assert simple_func.__wrapped__.__doc__ == "my doc string"
+ assert simple_func.__wrapped__.__doc__ == '''"""a tricky docstring"""'''
@pita_wrap(flag=False)
def less_simple_func(arg='hello'):
diff --git a/tests/test_urlutils.py b/tests/test_urlutils.py
index 924bf45..a8e1539 100644
--- a/tests/test_urlutils.py
+++ b/tests/test_urlutils.py
@@ -463,3 +463,6 @@ def test_unicodey():
assert url.to_text(full_quote=False) == unicodey
fully_quoted = 'http://xn--9ca.com/%C3%A9?%C3%A1=%C3%AD#%C3%BA'
assert url.to_text(full_quote=True) == fully_quoted
+
+def test_str_repr():
+ assert str(URL("http://googlewebsite.com/e-shops.aspx")) == "http://googlewebsite.com/e-shops.aspx"
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 10
}
|
18.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements-test.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/mahmoud/boltons.git@874e930bd6dbd92e64412e1bdb46a4053587c86d#egg=boltons
coverage==4.5.1
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
py==1.5.4
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==2.5.1
pytest-mock==3.14.0
pytest-xdist==3.6.1
six==1.17.0
tomli==2.2.1
tox==2.9.1
tox-virtualenv-no-download==1.0.2
typing_extensions==4.13.0
virtualenv==15.0.2
|
name: boltons
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==4.5.1
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- py==1.5.4
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==2.5.1
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- six==1.17.0
- tomli==2.2.1
- tox==2.9.1
- tox-virtualenv-no-download==1.0.2
- typing-extensions==4.13.0
- virtualenv==15.0.2
prefix: /opt/conda/envs/boltons
|
[
"tests/test_cacheutils.py::test_cachedmethod_maintains_func_abstraction",
"tests/test_cacheutils.py::test_cachedproperty_maintains_func_abstraction",
"tests/test_funcutils_fb.py::test_wraps_basic",
"tests/test_urlutils.py::test_str_repr"
] |
[] |
[
"tests/test_cacheutils.py::test_lru_add",
"tests/test_cacheutils.py::test_lri",
"tests/test_cacheutils.py::test_lru_basic",
"tests/test_cacheutils.py::test_lru_with_dupes",
"tests/test_cacheutils.py::test_lru_with_dupes_2",
"tests/test_cacheutils.py::test_cached_dec",
"tests/test_cacheutils.py::test_unscoped_cached_dec",
"tests/test_cacheutils.py::test_callable_cached_dec",
"tests/test_cacheutils.py::test_cachedmethod",
"tests/test_cacheutils.py::test_cachedproperty",
"tests/test_cacheutils.py::test_min_id_map",
"tests/test_dictutils.py::test_dict_init",
"tests/test_dictutils.py::test_todict",
"tests/test_dictutils.py::test_eq",
"tests/test_dictutils.py::test_copy",
"tests/test_dictutils.py::test_clear",
"tests/test_dictutils.py::test_types",
"tests/test_dictutils.py::test_multi_correctness",
"tests/test_dictutils.py::test_kv_consistency",
"tests/test_dictutils.py::test_update_basic",
"tests/test_dictutils.py::test_update",
"tests/test_dictutils.py::test_update_extend",
"tests/test_dictutils.py::test_invert",
"tests/test_dictutils.py::test_poplast",
"tests/test_dictutils.py::test_pop",
"tests/test_dictutils.py::test_pop_all",
"tests/test_dictutils.py::test_reversed",
"tests/test_dictutils.py::test_setdefault",
"tests/test_dictutils.py::test_one_to_one",
"tests/test_funcutils.py::test_partials",
"tests/test_funcutils.py::test_copy_function",
"tests/test_funcutils.py::test_total_ordering",
"tests/test_funcutils_fb.py::test_wraps_injected",
"tests/test_funcutils_fb.py::test_wraps_update_dict",
"tests/test_funcutils_fb.py::test_wraps_unknown_args",
"tests/test_funcutils_fb.py::test_FunctionBuilder_invalid_args",
"tests/test_funcutils_fb.py::test_FunctionBuilder_invalid_body",
"tests/test_funcutils_fb.py::test_FunctionBuilder_modify",
"tests/test_funcutils_fb.py::test_wraps_wrappers",
"tests/test_urlutils.py::test_regex[http://googlewebsite.com/e-shops.aspx]",
"tests/test_urlutils.py::test_roundtrip[http://googlewebsite.com/e-shops.aspx]",
"tests/test_urlutils.py::test_query_params[http://googlewebsite.com/e-shops.aspx]",
"tests/test_urlutils.py::test_regex[http://example.com:8080/search?q=123&business=Nothing%20Special]",
"tests/test_urlutils.py::test_roundtrip[http://example.com:8080/search?q=123&business=Nothing%20Special]",
"tests/test_urlutils.py::test_query_params[http://example.com:8080/search?q=123&business=Nothing%20Special]",
"tests/test_urlutils.py::test_regex[http://hatnote.com:9000?arg=1&arg=2&arg=3]",
"tests/test_urlutils.py::test_roundtrip[http://hatnote.com:9000?arg=1&arg=2&arg=3]",
"tests/test_urlutils.py::test_query_params[http://hatnote.com:9000?arg=1&arg=2&arg=3]",
"tests/test_urlutils.py::test_regex[https://xn--bcher-kva.ch]",
"tests/test_urlutils.py::test_roundtrip[https://xn--bcher-kva.ch]",
"tests/test_urlutils.py::test_query_params[https://xn--bcher-kva.ch]",
"tests/test_urlutils.py::test_regex[http://xn--ggbla1c4e.xn--ngbc5azd/]",
"tests/test_urlutils.py::test_roundtrip[http://xn--ggbla1c4e.xn--ngbc5azd/]",
"tests/test_urlutils.py::test_query_params[http://xn--ggbla1c4e.xn--ngbc5azd/]",
"tests/test_urlutils.py::test_regex[http://tools.ietf.org/html/rfc3986#section-3.4]",
"tests/test_urlutils.py::test_roundtrip[http://tools.ietf.org/html/rfc3986#section-3.4]",
"tests/test_urlutils.py::test_query_params[http://tools.ietf.org/html/rfc3986#section-3.4]",
"tests/test_urlutils.py::test_regex[http://wiki:[email protected]]",
"tests/test_urlutils.py::test_roundtrip[http://wiki:[email protected]]",
"tests/test_urlutils.py::test_query_params[http://wiki:[email protected]]",
"tests/test_urlutils.py::test_regex[ftp://ftp.rfc-editor.org/in-notes/tar/RFCs0001-0500.tar.gz]",
"tests/test_urlutils.py::test_roundtrip[ftp://ftp.rfc-editor.org/in-notes/tar/RFCs0001-0500.tar.gz]",
"tests/test_urlutils.py::test_query_params[ftp://ftp.rfc-editor.org/in-notes/tar/RFCs0001-0500.tar.gz]",
"tests/test_urlutils.py::test_regex[http://[1080:0:0:0:8:800:200C:417A]/index.html]",
"tests/test_urlutils.py::test_roundtrip[http://[1080:0:0:0:8:800:200C:417A]/index.html]",
"tests/test_urlutils.py::test_query_params[http://[1080:0:0:0:8:800:200C:417A]/index.html]",
"tests/test_urlutils.py::test_regex[ssh://192.0.2.16:2222/]",
"tests/test_urlutils.py::test_roundtrip[ssh://192.0.2.16:2222/]",
"tests/test_urlutils.py::test_query_params[ssh://192.0.2.16:2222/]",
"tests/test_urlutils.py::test_regex[https://[::101.45.75.219]:80/?hi=bye]",
"tests/test_urlutils.py::test_roundtrip[https://[::101.45.75.219]:80/?hi=bye]",
"tests/test_urlutils.py::test_query_params[https://[::101.45.75.219]:80/?hi=bye]",
"tests/test_urlutils.py::test_regex[ldap://[::192.9.5.5]/dc=example,dc=com??sub?(sn=Jensen)]",
"tests/test_urlutils.py::test_roundtrip[ldap://[::192.9.5.5]/dc=example,dc=com??sub?(sn=Jensen)]",
"tests/test_urlutils.py::test_query_params[ldap://[::192.9.5.5]/dc=example,dc=com??sub?(sn=Jensen)]",
"tests/test_urlutils.py::test_regex[mailto:[email protected][email protected]&body=hi%20http://wikipedia.org]",
"tests/test_urlutils.py::test_roundtrip[mailto:[email protected][email protected]&body=hi%20http://wikipedia.org]",
"tests/test_urlutils.py::test_query_params[mailto:[email protected][email protected]&body=hi%20http://wikipedia.org]",
"tests/test_urlutils.py::test_regex[news:alt.rec.motorcycle]",
"tests/test_urlutils.py::test_roundtrip[news:alt.rec.motorcycle]",
"tests/test_urlutils.py::test_query_params[news:alt.rec.motorcycle]",
"tests/test_urlutils.py::test_regex[tel:+1-800-867-5309]",
"tests/test_urlutils.py::test_roundtrip[tel:+1-800-867-5309]",
"tests/test_urlutils.py::test_query_params[tel:+1-800-867-5309]",
"tests/test_urlutils.py::test_regex[urn:oasis:member:A00024:x]",
"tests/test_urlutils.py::test_roundtrip[urn:oasis:member:A00024:x]",
"tests/test_urlutils.py::test_query_params[urn:oasis:member:A00024:x]",
"tests/test_urlutils.py::test_regex[magnet:?xt=urn:btih:1a42b9e04e122b97a5254e3df77ab3c4b7da725f&dn=Puppy%20Linux%20precise-5.7.1.iso&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.istole.it:6969&tr=udp://tracker.ccc.de:80&tr=udp://open.demonii.com:1337]",
"tests/test_urlutils.py::test_roundtrip[magnet:?xt=urn:btih:1a42b9e04e122b97a5254e3df77ab3c4b7da725f&dn=Puppy%20Linux%20precise-5.7.1.iso&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.istole.it:6969&tr=udp://tracker.ccc.de:80&tr=udp://open.demonii.com:1337]",
"tests/test_urlutils.py::test_query_params[magnet:?xt=urn:btih:1a42b9e04e122b97a5254e3df77ab3c4b7da725f&dn=Puppy%20Linux%20precise-5.7.1.iso&tr=udp://tracker.openbittorrent.com:80&tr=udp://tracker.publicbt.com:80&tr=udp://tracker.istole.it:6969&tr=udp://tracker.ccc.de:80&tr=udp://open.demonii.com:1337]",
"tests/test_urlutils.py::test_regex[http://localhost]",
"tests/test_urlutils.py::test_roundtrip[http://localhost]",
"tests/test_urlutils.py::test_query_params[http://localhost]",
"tests/test_urlutils.py::test_regex[http://localhost/]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/]",
"tests/test_urlutils.py::test_query_params[http://localhost/]",
"tests/test_urlutils.py::test_regex[http://localhost/foo]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/foo]",
"tests/test_urlutils.py::test_query_params[http://localhost/foo]",
"tests/test_urlutils.py::test_regex[http://localhost/foo/]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/foo/]",
"tests/test_urlutils.py::test_query_params[http://localhost/foo/]",
"tests/test_urlutils.py::test_regex[http://localhost/foo!!bar/]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/foo!!bar/]",
"tests/test_urlutils.py::test_query_params[http://localhost/foo!!bar/]",
"tests/test_urlutils.py::test_regex[http://localhost/foo%20bar/]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/foo%20bar/]",
"tests/test_urlutils.py::test_query_params[http://localhost/foo%20bar/]",
"tests/test_urlutils.py::test_regex[http://localhost/foo%2Fbar/]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/foo%2Fbar/]",
"tests/test_urlutils.py::test_query_params[http://localhost/foo%2Fbar/]",
"tests/test_urlutils.py::test_regex[http://localhost/foo?n]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/foo?n]",
"tests/test_urlutils.py::test_query_params[http://localhost/foo?n]",
"tests/test_urlutils.py::test_regex[http://localhost/foo?n=v]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/foo?n=v]",
"tests/test_urlutils.py::test_query_params[http://localhost/foo?n=v]",
"tests/test_urlutils.py::test_regex[http://localhost/foo?n=/a/b]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/foo?n=/a/b]",
"tests/test_urlutils.py::test_query_params[http://localhost/foo?n=/a/b]",
"tests/test_urlutils.py::test_regex[http://example.com/foo!@$bar?b!@z=123]",
"tests/test_urlutils.py::test_roundtrip[http://example.com/foo!@$bar?b!@z=123]",
"tests/test_urlutils.py::test_query_params[http://example.com/foo!@$bar?b!@z=123]",
"tests/test_urlutils.py::test_regex[http://localhost/asd?a=asd%20sdf/345]",
"tests/test_urlutils.py::test_roundtrip[http://localhost/asd?a=asd%20sdf/345]",
"tests/test_urlutils.py::test_query_params[http://localhost/asd?a=asd%20sdf/345]",
"tests/test_urlutils.py::test_regex[http://(%2525)/(%2525)?(%2525)&(%2525)=(%2525)#(%2525)]",
"tests/test_urlutils.py::test_roundtrip[http://(%2525)/(%2525)?(%2525)&(%2525)=(%2525)#(%2525)]",
"tests/test_urlutils.py::test_query_params[http://(%2525)/(%2525)?(%2525)&(%2525)=(%2525)#(%2525)]",
"tests/test_urlutils.py::test_regex[http://(%C3%A9)/(%C3%A9)?(%C3%A9)&(%C3%A9)=(%C3%A9)#(%C3%A9)]",
"tests/test_urlutils.py::test_roundtrip[http://(%C3%A9)/(%C3%A9)?(%C3%A9)&(%C3%A9)=(%C3%A9)#(%C3%A9)]",
"tests/test_urlutils.py::test_query_params[http://(%C3%A9)/(%C3%A9)?(%C3%A9)&(%C3%A9)=(%C3%A9)#(%C3%A9)]",
"tests/test_urlutils.py::test_basic",
"tests/test_urlutils.py::test_utf8_url",
"tests/test_urlutils.py::test_idna",
"tests/test_urlutils.py::test_iri_query",
"tests/test_urlutils.py::test_iri_path",
"tests/test_urlutils.py::test_url_copy",
"tests/test_urlutils.py::test_invalid_port",
"tests/test_urlutils.py::test_invalid_ipv6",
"tests/test_urlutils.py::test_parse_url",
"tests/test_urlutils.py::test_parse_equals_in_qp_value",
"tests/test_urlutils.py::test_identical_equal",
"tests/test_urlutils.py::test_equal",
"tests/test_urlutils.py::test_not_equal",
"tests/test_urlutils.py::test_userinfo",
"tests/test_urlutils.py::test_quoted_userinfo",
"tests/test_urlutils.py::test_mailto",
"tests/test_urlutils.py::test_rel_navigate",
"tests/test_urlutils.py::test_navigate",
"tests/test_urlutils.py::test_self_normalize",
"tests/test_urlutils.py::test_normalize_with_case",
"tests/test_urlutils.py::test_netloc_slashes",
"tests/test_urlutils.py::test_find_all_links_basic",
"tests/test_urlutils.py::test_find_all_links",
"tests/test_urlutils.py::test_unicodey"
] |
[] |
BSD License
| 3,238 |
[
"boltons/dictutils.py",
"boltons/funcutils.py",
"boltons/strutils.py",
".travis.yml",
"boltons/urlutils.py",
"boltons/iterutils.py",
"boltons/tableutils.py",
"boltons/fileutils.py",
"boltons/cacheutils.py",
"boltons/setutils.py"
] |
[
"boltons/dictutils.py",
"boltons/funcutils.py",
"boltons/strutils.py",
".travis.yml",
"boltons/urlutils.py",
"boltons/iterutils.py",
"boltons/tableutils.py",
"boltons/fileutils.py",
"boltons/cacheutils.py",
"boltons/setutils.py"
] |
|
pre-commit__pre-commit-846
|
14df93ef3e212e24fc30a31038a68a3325bd36a3
|
2018-10-14 20:25:01
|
14df93ef3e212e24fc30a31038a68a3325bd36a3
|
diff --git a/.coveragerc b/.coveragerc
index 2dca763..d7a2481 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -8,6 +8,7 @@ omit =
# Don't complain if non-runnable code isn't run
*/__main__.py
pre_commit/color_windows.py
+ pre_commit/resources/*
[report]
show_missing = True
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index aa237a5..b5a9260 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,9 +1,10 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v2.0.0
+ rev: v1.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
+ - id: autopep8-wrapper
- id: check-docstring-first
- id: check-json
- id: check-yaml
@@ -11,21 +12,17 @@ repos:
- id: name-tests-test
- id: requirements-txt-fixer
- id: flake8
-- repo: https://github.com/pre-commit/mirrors-autopep8
- rev: v1.4
- hooks:
- - id: autopep8
- repo: https://github.com/pre-commit/pre-commit
- rev: v1.11.2
+ rev: v1.10.5
hooks:
- id: validate_manifest
- repo: https://github.com/asottile/reorder_python_imports
- rev: v1.3.0
+ rev: v1.1.0
hooks:
- id: reorder-python-imports
language_version: python2.7
- repo: https://github.com/asottile/add-trailing-comma
- rev: v0.7.1
+ rev: v0.6.4
hooks:
- id: add-trailing-comma
- repo: meta
diff --git a/pre_commit/commands/install_uninstall.py b/pre_commit/commands/install_uninstall.py
index d76a6c1..d313306 100644
--- a/pre_commit/commands/install_uninstall.py
+++ b/pre_commit/commands/install_uninstall.py
@@ -12,7 +12,7 @@ from pre_commit.repository import repositories
from pre_commit.util import cmd_output
from pre_commit.util import make_executable
from pre_commit.util import mkdirp
-from pre_commit.util import resource_filename
+from pre_commit.util import resource_text
logger = logging.getLogger(__name__)
@@ -80,8 +80,7 @@ def install(
}
with io.open(hook_path, 'w') as hook_file:
- with io.open(resource_filename('hook-tmpl')) as f:
- contents = f.read()
+ contents = resource_text('hook-tmpl')
before, rest = contents.split(TEMPLATE_START)
to_template, after = rest.split(TEMPLATE_END)
diff --git a/pre_commit/constants.py b/pre_commit/constants.py
index 48ba2cb..a8cdc2e 100644
--- a/pre_commit/constants.py
+++ b/pre_commit/constants.py
@@ -1,7 +1,7 @@
from __future__ import absolute_import
from __future__ import unicode_literals
-import pkg_resources
+import importlib_metadata # TODO: importlib.metadata py38?
CONFIG_FILE = '.pre-commit-config.yaml'
MANIFEST_FILE = '.pre-commit-hooks.yaml'
@@ -18,8 +18,7 @@ INSTALLED_STATE_VERSION = '1'
# Bump when modifying `empty_template`
LOCAL_REPO_VERSION = '1'
-VERSION = pkg_resources.get_distribution('pre-commit').version
-VERSION_PARSED = pkg_resources.parse_version(VERSION)
+VERSION = importlib_metadata.version('pre_commit')
# `manual` is not invoked by any installed git hook. See #719
STAGES = ('commit', 'commit-msg', 'manual', 'push')
diff --git a/pre_commit/languages/ruby.py b/pre_commit/languages/ruby.py
index 3bd7130..bef3fe3 100644
--- a/pre_commit/languages/ruby.py
+++ b/pre_commit/languages/ruby.py
@@ -11,7 +11,7 @@ from pre_commit.envcontext import Var
from pre_commit.languages import helpers
from pre_commit.util import CalledProcessError
from pre_commit.util import clean_path_on_failure
-from pre_commit.util import resource_filename
+from pre_commit.util import resource_bytesio
from pre_commit.xargs import xargs
@@ -47,22 +47,23 @@ def in_env(prefix, language_version): # pragma: windows no cover
yield
+def _extract_resource(filename, dest):
+ with resource_bytesio(filename) as bio:
+ with tarfile.open(fileobj=bio) as tf:
+ tf.extractall(dest)
+
+
def _install_rbenv(prefix, version='default'): # pragma: windows no cover
directory = helpers.environment_dir(ENVIRONMENT_DIR, version)
- with tarfile.open(resource_filename('rbenv.tar.gz')) as tf:
- tf.extractall(prefix.path('.'))
+ _extract_resource('rbenv.tar.gz', prefix.path('.'))
shutil.move(prefix.path('rbenv'), prefix.path(directory))
# Only install ruby-build if the version is specified
if version != 'default':
- # ruby-download
- with tarfile.open(resource_filename('ruby-download.tar.gz')) as tf:
- tf.extractall(prefix.path(directory, 'plugins'))
-
- # ruby-build
- with tarfile.open(resource_filename('ruby-build.tar.gz')) as tf:
- tf.extractall(prefix.path(directory, 'plugins'))
+ plugins_dir = prefix.path(directory, 'plugins')
+ _extract_resource('ruby-download.tar.gz', plugins_dir)
+ _extract_resource('ruby-build.tar.gz', plugins_dir)
activate_path = prefix.path(directory, 'bin', 'activate')
with io.open(activate_path, 'w') as activate_file:
diff --git a/pre_commit/make_archives.py b/pre_commit/make_archives.py
index e85a8f4..865ef06 100644
--- a/pre_commit/make_archives.py
+++ b/pre_commit/make_archives.py
@@ -8,7 +8,6 @@ import tarfile
from pre_commit import output
from pre_commit.util import cmd_output
-from pre_commit.util import resource_filename
from pre_commit.util import rmtree
from pre_commit.util import tmpdir
@@ -56,7 +55,7 @@ def make_archive(name, repo, ref, destdir):
def main(argv=None):
parser = argparse.ArgumentParser()
- parser.add_argument('--dest', default=resource_filename())
+ parser.add_argument('--dest', default='pre_commit/resources')
args = parser.parse_args(argv)
for archive_name, repo, ref in REPOS:
output.write_line('Making {}.tar.gz for {}@{}'.format(
diff --git a/pre_commit/repository.py b/pre_commit/repository.py
index 278f31a..d718c2f 100644
--- a/pre_commit/repository.py
+++ b/pre_commit/repository.py
@@ -8,7 +8,6 @@ import pipes
import shutil
import sys
-import pkg_resources
from cached_property import cached_property
from cfgv import apply_defaults
from cfgv import validate
@@ -23,6 +22,7 @@ from pre_commit.clientlib import MANIFEST_HOOK_DICT
from pre_commit.languages.all import languages
from pre_commit.languages.helpers import environment_dir
from pre_commit.prefix import Prefix
+from pre_commit.util import parse_version
logger = logging.getLogger('pre_commit')
@@ -110,13 +110,13 @@ def _hook(*hook_dicts):
for dct in rest:
ret.update(dct)
- version = pkg_resources.parse_version(ret['minimum_pre_commit_version'])
- if version > C.VERSION_PARSED:
+ version = ret['minimum_pre_commit_version']
+ if parse_version(version) > parse_version(C.VERSION):
logger.error(
'The hook `{}` requires pre-commit version {} but version {} '
'is installed. '
'Perhaps run `pip install --upgrade pre-commit`.'.format(
- ret['id'], version, C.VERSION_PARSED,
+ ret['id'], version, C.VERSION,
),
)
exit(1)
diff --git a/pre_commit/resources/__init__.py b/pre_commit/resources/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pre_commit/resources/empty_template/.npmignore b/pre_commit/resources/empty_template_.npmignore
similarity index 100%
rename from pre_commit/resources/empty_template/.npmignore
rename to pre_commit/resources/empty_template_.npmignore
diff --git a/pre_commit/resources/empty_template/Cargo.toml b/pre_commit/resources/empty_template_Cargo.toml
similarity index 100%
rename from pre_commit/resources/empty_template/Cargo.toml
rename to pre_commit/resources/empty_template_Cargo.toml
diff --git a/pre_commit/resources/empty_template/main.go b/pre_commit/resources/empty_template_main.go
similarity index 100%
rename from pre_commit/resources/empty_template/main.go
rename to pre_commit/resources/empty_template_main.go
diff --git a/pre_commit/resources/empty_template/main.rs b/pre_commit/resources/empty_template_main.rs
similarity index 100%
rename from pre_commit/resources/empty_template/main.rs
rename to pre_commit/resources/empty_template_main.rs
diff --git a/pre_commit/resources/empty_template/package.json b/pre_commit/resources/empty_template_package.json
similarity index 100%
rename from pre_commit/resources/empty_template/package.json
rename to pre_commit/resources/empty_template_package.json
diff --git a/pre_commit/resources/empty_template/pre_commit_dummy_package.gemspec b/pre_commit/resources/empty_template_pre_commit_dummy_package.gemspec
similarity index 100%
rename from pre_commit/resources/empty_template/pre_commit_dummy_package.gemspec
rename to pre_commit/resources/empty_template_pre_commit_dummy_package.gemspec
diff --git a/pre_commit/resources/empty_template/setup.py b/pre_commit/resources/empty_template_setup.py
similarity index 100%
rename from pre_commit/resources/empty_template/setup.py
rename to pre_commit/resources/empty_template_setup.py
diff --git a/pre_commit/store.py b/pre_commit/store.py
index 07702fb..f3096fc 100644
--- a/pre_commit/store.py
+++ b/pre_commit/store.py
@@ -11,9 +11,8 @@ import pre_commit.constants as C
from pre_commit import file_lock
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
-from pre_commit.util import copy_tree_to_path
from pre_commit.util import no_git_env
-from pre_commit.util import resource_filename
+from pre_commit.util import resource_text
logger = logging.getLogger('pre_commit')
@@ -149,9 +148,17 @@ class Store(object):
return self._new_repo(repo, ref, deps, clone_strategy)
+ LOCAL_RESOURCES = (
+ 'Cargo.toml', 'main.go', 'main.rs', '.npmignore', 'package.json',
+ 'pre_commit_dummy_package.gemspec', 'setup.py',
+ )
+
def make_local(self, deps):
def make_local_strategy(directory):
- copy_tree_to_path(resource_filename('empty_template'), directory)
+ for resource in self.LOCAL_RESOURCES:
+ contents = resource_text('empty_template_{}'.format(resource))
+ with io.open(os.path.join(directory, resource), 'w') as f:
+ f.write(contents)
env = no_git_env()
name, email = 'pre-commit', '[email protected]'
diff --git a/pre_commit/util.py b/pre_commit/util.py
index bcb47c3..963461d 100644
--- a/pre_commit/util.py
+++ b/pre_commit/util.py
@@ -7,14 +7,21 @@ import os.path
import shutil
import stat
import subprocess
+import sys
import tempfile
-import pkg_resources
import six
from pre_commit import five
from pre_commit import parse_shebang
+if sys.version_info >= (3, 7): # pragma: no cover (PY37+)
+ from importlib.resources import open_binary
+ from importlib.resources import read_text
+else: # pragma: no cover (<PY37)
+ from importlib_resources import open_binary
+ from importlib_resources import read_text
+
def mkdirp(path):
try:
@@ -84,10 +91,12 @@ def tmpdir():
rmtree(tempdir)
-def resource_filename(*segments):
- return pkg_resources.resource_filename(
- 'pre_commit', os.path.join('resources', *segments),
- )
+def resource_bytesio(filename):
+ return open_binary('pre_commit.resources', filename)
+
+
+def resource_text(filename):
+ return read_text('pre_commit.resources', filename)
def make_executable(filename):
@@ -195,19 +204,6 @@ def rmtree(path):
shutil.rmtree(path, ignore_errors=False, onerror=handle_remove_readonly)
-def copy_tree_to_path(src_dir, dest_dir):
- """Copies all of the things inside src_dir to an already existing dest_dir.
-
- This looks eerily similar to shutil.copytree, but copytree has no option
- for not creating dest_dir.
- """
- names = os.listdir(src_dir)
-
- for name in names:
- srcname = os.path.join(src_dir, name)
- destname = os.path.join(dest_dir, name)
-
- if os.path.isdir(srcname):
- shutil.copytree(srcname, destname)
- else:
- shutil.copy(srcname, destname)
+def parse_version(s):
+ """poor man's version comparison"""
+ return tuple(int(p) for p in s.split('.'))
diff --git a/setup.py b/setup.py
index 3eb04d8..8994da6 100644
--- a/setup.py
+++ b/setup.py
@@ -29,10 +29,9 @@ setup(
packages=find_packages(exclude=('tests*', 'testing*')),
package_data={
'pre_commit': [
- 'resources/*-tmpl',
+ 'resources/hook-tmpl',
'resources/*.tar.gz',
- 'resources/empty_template/*',
- 'resources/empty_template/.npmignore',
+ 'resources/empty_template_*',
],
},
install_requires=[
@@ -40,12 +39,15 @@ setup(
'cached-property',
'cfgv>=1.0.0',
'identify>=1.0.0',
+ # if this makes it into python3.8 move to extras_require
+ 'importlib-metadata',
'nodeenv>=0.11.1',
'pyyaml',
'six',
'toml',
'virtualenv',
],
+ extras_require={':python_version<"3.7"': ['importlib-resources']},
entry_points={
'console_scripts': [
'pre-commit = pre_commit.main:main',
|
port to packaging to avoid pkg_resources import cost
its expensive to import pkg_resources if all that's needed is version parsing of packaging
it should be relatively straightforward to simplify and port
|
pre-commit/pre-commit
|
diff --git a/testing/fixtures.py b/testing/fixtures.py
index cbcb7bb..2b2e280 100644
--- a/testing/fixtures.py
+++ b/testing/fixtures.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
import contextlib
import io
import os.path
+import shutil
from collections import OrderedDict
from aspy.yaml import ordered_dump
@@ -16,10 +17,27 @@ from pre_commit import git
from pre_commit.clientlib import CONFIG_SCHEMA
from pre_commit.clientlib import load_manifest
from pre_commit.util import cmd_output
-from pre_commit.util import copy_tree_to_path
from testing.util import get_resource_path
+def copy_tree_to_path(src_dir, dest_dir):
+ """Copies all of the things inside src_dir to an already existing dest_dir.
+
+ This looks eerily similar to shutil.copytree, but copytree has no option
+ for not creating dest_dir.
+ """
+ names = os.listdir(src_dir)
+
+ for name in names:
+ srcname = os.path.join(src_dir, name)
+ destname = os.path.join(dest_dir, name)
+
+ if os.path.isdir(srcname):
+ shutil.copytree(srcname, destname)
+ else:
+ shutil.copy(srcname, destname)
+
+
def git_dir(tempdir_factory):
path = tempdir_factory.get()
cmd_output('git', 'init', path)
diff --git a/tests/commands/install_uninstall_test.py b/tests/commands/install_uninstall_test.py
index 76ab14f..fce0010 100644
--- a/tests/commands/install_uninstall_test.py
+++ b/tests/commands/install_uninstall_test.py
@@ -22,7 +22,7 @@ from pre_commit.runner import Runner
from pre_commit.util import cmd_output
from pre_commit.util import make_executable
from pre_commit.util import mkdirp
-from pre_commit.util import resource_filename
+from pre_commit.util import resource_text
from testing.fixtures import git_dir
from testing.fixtures import make_consuming_repo
from testing.fixtures import remove_config_from_repo
@@ -36,7 +36,7 @@ def test_is_not_script():
def test_is_script():
- assert is_our_script(resource_filename('hook-tmpl'))
+ assert is_our_script('pre_commit/resources/hook-tmpl')
def test_is_previous_pre_commit(tmpdir):
@@ -415,8 +415,7 @@ def test_replace_old_commit_script(tempdir_factory, store):
runner = Runner(path, C.CONFIG_FILE)
# Install a script that looks like our old script
- with io.open(resource_filename('hook-tmpl')) as f:
- pre_commit_contents = f.read()
+ pre_commit_contents = resource_text('hook-tmpl')
new_contents = pre_commit_contents.replace(
CURRENT_HASH, PRIOR_HASHES[-1],
)
diff --git a/tests/store_test.py b/tests/store_test.py
index 4e80f05..bed0e90 100644
--- a/tests/store_test.py
+++ b/tests/store_test.py
@@ -153,3 +153,12 @@ def test_require_created_when_directory_exists_but_not_db(store):
os.makedirs(store.directory)
store.require_created()
assert os.path.exists(store.db_path)
+
+
+def test_local_resources_reflects_reality():
+ on_disk = {
+ res[len('empty_template_'):]
+ for res in os.listdir('pre_commit/resources')
+ if res.startswith('empty_template_')
+ }
+ assert on_disk == set(Store.LOCAL_RESOURCES)
diff --git a/tests/util_test.py b/tests/util_test.py
index 967163e..56eb5aa 100644
--- a/tests/util_test.py
+++ b/tests/util_test.py
@@ -9,6 +9,7 @@ from pre_commit.util import CalledProcessError
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
from pre_commit.util import memoize_by_cwd
+from pre_commit.util import parse_version
from pre_commit.util import tmpdir
from testing.util import cwd
@@ -117,3 +118,9 @@ def test_cmd_output_exe_not_found():
ret, out, _ = cmd_output('i-dont-exist', retcode=None)
assert ret == 1
assert out == 'Executable `i-dont-exist` not found'
+
+
+def test_parse_version():
+ assert parse_version('0.0') == parse_version('0.0')
+ assert parse_version('0.1') > parse_version('0.0')
+ assert parse_version('2.1') >= parse_version('2')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 10
}
|
1.11
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"cython",
"distro",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio",
"pytest-bdd",
"pytest-benchmark",
"pytest-randomly",
"responses",
"mock",
"hypothesis",
"freezegun",
"trustme",
"requests-mock",
"requests",
"tomlkit"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aspy.yaml==1.3.0
attrs==25.3.0
cached-property==2.0.1
certifi==2025.1.31
cffi==1.17.1
cfgv==3.4.0
charset-normalizer==3.4.1
coverage==7.8.0
cryptography==44.0.2
Cython==3.0.12
distlib==0.3.9
distro==1.9.0
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
flake8==7.2.0
freezegun==1.5.1
gherkin-official==29.0.0
hypothesis==6.130.5
identify==2.6.9
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
Mako==1.3.9
MarkupSafe==3.0.2
mccabe==0.7.0
mock==5.2.0
nodeenv==1.9.1
packaging==24.2
parse==1.20.2
parse_type==0.6.4
platformdirs==4.3.7
pluggy==1.5.0
-e git+https://github.com/pre-commit/pre-commit.git@14df93ef3e212e24fc30a31038a68a3325bd36a3#egg=pre_commit
py-cpuinfo==9.0.0
pycodestyle==2.13.0
pycparser==2.22
pyflakes==3.3.1
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-bdd==8.1.0
pytest-benchmark==5.1.0
pytest-cov==6.0.0
pytest-env==1.1.5
pytest-mock==3.14.0
pytest-randomly==3.16.0
pytest-xdist==3.6.1
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
requests-mock==1.12.1
responses==0.25.7
six==1.17.0
sortedcontainers==2.4.0
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
trustme==1.2.1
typing_extensions==4.13.0
urllib3==2.3.0
virtualenv==20.29.3
zipp==3.21.0
|
name: pre-commit
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aspy-yaml==1.3.0
- attrs==25.3.0
- cached-property==2.0.1
- certifi==2025.1.31
- cffi==1.17.1
- cfgv==3.4.0
- charset-normalizer==3.4.1
- coverage==7.8.0
- cryptography==44.0.2
- cython==3.0.12
- distlib==0.3.9
- distro==1.9.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- filelock==3.18.0
- flake8==7.2.0
- freezegun==1.5.1
- gherkin-official==29.0.0
- hypothesis==6.130.5
- identify==2.6.9
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- mako==1.3.9
- markupsafe==3.0.2
- mccabe==0.7.0
- mock==5.2.0
- nodeenv==1.9.1
- packaging==24.2
- parse==1.20.2
- parse-type==0.6.4
- platformdirs==4.3.7
- pluggy==1.5.0
- py-cpuinfo==9.0.0
- pycodestyle==2.13.0
- pycparser==2.22
- pyflakes==3.3.1
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-bdd==8.1.0
- pytest-benchmark==5.1.0
- pytest-cov==6.0.0
- pytest-env==1.1.5
- pytest-mock==3.14.0
- pytest-randomly==3.16.0
- pytest-xdist==3.6.1
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- requests-mock==1.12.1
- responses==0.25.7
- six==1.17.0
- sortedcontainers==2.4.0
- toml==0.10.2
- tomli==2.2.1
- tomlkit==0.13.2
- trustme==1.2.1
- typing-extensions==4.13.0
- urllib3==2.3.0
- virtualenv==20.29.3
- zipp==3.21.0
prefix: /opt/conda/envs/pre-commit
|
[
"tests/util_test.py::test_clean_on_failure_noop",
"tests/util_test.py::test_memoized_by_cwd_returns_same_twice_in_a_row",
"tests/util_test.py::test_clean_path_on_failure_cleans_for_system_exit",
"tests/util_test.py::test_CalledProcessError_str_nooutput",
"tests/util_test.py::test_memoized_by_cwd_changes_with_different_cwd",
"tests/util_test.py::test_clean_path_on_failure_cleans_for_normal_exception",
"tests/util_test.py::test_CalledProcessError_str",
"tests/util_test.py::test_memoized_by_cwd_returns_different_for_different_args",
"tests/util_test.py::test_parse_version",
"tests/util_test.py::test_clean_path_on_failure_does_nothing_when_not_raising",
"tests/util_test.py::test_cmd_output_exe_not_found",
"tests/util_test.py::test_tmpdir",
"tests/commands/install_uninstall_test.py::test_commit_msg_integration_failing",
"tests/commands/install_uninstall_test.py::test_commit_msg_legacy",
"tests/commands/install_uninstall_test.py::test_installed_from_venv",
"tests/commands/install_uninstall_test.py::test_is_previous_pre_commit",
"tests/commands/install_uninstall_test.py::test_pre_push_integration_accepted",
"tests/commands/install_uninstall_test.py::test_install_temporarily_allow_mising_config",
"tests/commands/install_uninstall_test.py::test_install_hooks_command",
"tests/commands/install_uninstall_test.py::test_commit_am",
"tests/commands/install_uninstall_test.py::test_is_not_script",
"tests/commands/install_uninstall_test.py::test_install_hooks_dead_symlink",
"tests/commands/install_uninstall_test.py::test_is_script",
"tests/commands/install_uninstall_test.py::test_pre_push_integration_failing",
"tests/commands/install_uninstall_test.py::test_pre_push_force_push_without_fetch",
"tests/commands/install_uninstall_test.py::test_uninstall",
"tests/commands/install_uninstall_test.py::test_pre_push_legacy",
"tests/commands/install_uninstall_test.py::test_uninstall_restores_legacy_hooks",
"tests/commands/install_uninstall_test.py::test_install_existing_hook_no_overwrite_idempotent",
"tests/commands/install_uninstall_test.py::test_install_hooks_directory_not_present",
"tests/commands/install_uninstall_test.py::test_pre_push_integration_empty_push",
"tests/commands/install_uninstall_test.py::test_install_idempotent",
"tests/commands/install_uninstall_test.py::test_installs_hooks_with_hooks_True",
"tests/commands/install_uninstall_test.py::test_commit_msg_integration_passing",
"tests/commands/install_uninstall_test.py::test_unicode_merge_commit_message",
"tests/commands/install_uninstall_test.py::test_failing_existing_hook_returns_1",
"tests/commands/install_uninstall_test.py::test_pre_push_new_upstream",
"tests/commands/install_uninstall_test.py::test_replace_old_commit_script",
"tests/commands/install_uninstall_test.py::test_uninstall_doesnt_remove_not_our_hooks",
"tests/commands/install_uninstall_test.py::test_install_pre_commit_and_run_custom_path",
"tests/commands/install_uninstall_test.py::test_failing_hooks_returns_nonzero",
"tests/commands/install_uninstall_test.py::test_install_pre_commit",
"tests/commands/install_uninstall_test.py::test_install_overwrite_no_existing_hooks",
"tests/commands/install_uninstall_test.py::test_install_refuses_core_hookspath",
"tests/commands/install_uninstall_test.py::test_install_in_worktree_and_run",
"tests/commands/install_uninstall_test.py::test_uninstall_does_not_blow_up_when_not_there",
"tests/commands/install_uninstall_test.py::test_install_pre_commit_and_run",
"tests/commands/install_uninstall_test.py::test_install_overwrite",
"tests/commands/install_uninstall_test.py::test_install_disallow_mising_config",
"tests/commands/install_uninstall_test.py::test_install_allow_mising_config",
"tests/commands/install_uninstall_test.py::test_install_existing_hooks_no_overwrite",
"tests/store_test.py::test_get_default_directory_defaults_to_home",
"tests/store_test.py::test_uses_environment_variable_when_present",
"tests/store_test.py::test_does_not_recreate_if_directory_already_exists",
"tests/store_test.py::test_clone",
"tests/store_test.py::test_store_require_created",
"tests/store_test.py::test_store_require_created_does_not_create_twice",
"tests/store_test.py::test_clone_when_repo_already_exists",
"tests/store_test.py::test_local_resources_reflects_reality",
"tests/store_test.py::test_our_session_fixture_works",
"tests/store_test.py::test_adheres_to_xdg_specification",
"tests/store_test.py::test_clone_cleans_up_on_checkout_failure",
"tests/store_test.py::test_require_created_when_directory_exists_but_not_db"
] |
[
"tests/commands/install_uninstall_test.py::test_environment_not_sourced",
"tests/commands/install_uninstall_test.py::test_install_in_submodule_and_run"
] |
[] |
[] |
MIT License
| 3,239 |
[
"pre_commit/resources/empty_template/setup.py",
"pre_commit/resources/empty_template/main.go",
"pre_commit/make_archives.py",
"setup.py",
"pre_commit/resources/empty_template/package.json",
"pre_commit/resources/empty_template/main.rs",
"pre_commit/resources/empty_template/.npmignore",
"pre_commit/languages/ruby.py",
"pre_commit/resources/__init__.py",
"pre_commit/commands/install_uninstall.py",
"pre_commit/resources/empty_template/pre_commit_dummy_package.gemspec",
".coveragerc",
"pre_commit/repository.py",
"pre_commit/util.py",
"pre_commit/resources/empty_template/Cargo.toml",
"pre_commit/constants.py",
"pre_commit/store.py",
".pre-commit-config.yaml"
] |
[
"pre_commit/make_archives.py",
"pre_commit/resources/empty_template_.npmignore",
"pre_commit/resources/empty_template_setup.py",
"pre_commit/resources/empty_template_main.rs",
"setup.py",
"pre_commit/resources/empty_template_Cargo.toml",
"pre_commit/languages/ruby.py",
"pre_commit/resources/empty_template_main.go",
"pre_commit/resources/__init__.py",
"pre_commit/commands/install_uninstall.py",
"pre_commit/resources/empty_template_package.json",
".coveragerc",
"pre_commit/repository.py",
"pre_commit/resources/empty_template_pre_commit_dummy_package.gemspec",
"pre_commit/util.py",
"pre_commit/constants.py",
"pre_commit/store.py",
".pre-commit-config.yaml"
] |
|
ipython__ipython-11398
|
8ed6e67ed9d7662222542d9f4c4bd92bd68d5adb
|
2018-10-15 01:28:16
|
f0ac04900b586a080b61a2f9ea00c8e9d3a3163b
|
diff --git a/IPython/core/inputtransformer2.py b/IPython/core/inputtransformer2.py
index 5777559fb..e2dd2d087 100644
--- a/IPython/core/inputtransformer2.py
+++ b/IPython/core/inputtransformer2.py
@@ -355,9 +355,14 @@ def find(cls, tokens_by_line):
"""Find the first escaped command (%foo, !foo, etc.) in the cell.
"""
for line in tokens_by_line:
+ if not line:
+ continue
ix = 0
- while line[ix].type in {tokenize.INDENT, tokenize.DEDENT}:
+ ll = len(line)
+ while ll > ix and line[ix].type in {tokenize.INDENT, tokenize.DEDENT}:
ix += 1
+ if ix >= ll:
+ continue
if line[ix].string in ESCAPE_SINGLES:
return cls(line[ix].start)
|
Cannot enter docstring in IPython
Type the following snippet and then hit `C-m` or `C-j` or `C-o` then IPython produces "Exception list index out of range" from `IPython/core/inputtransformer2.py`
```
In [1]: def f():
...: """
```
Traceback:
```pytb
Unhandled exception in event loop:
File "/home/takafumi/.virtualenvs/ipy7/lib/python3.7/site-packages/prompt_toolkit/eventloop/posix.py", line 154, in _run_task
t()
File "/home/takafumi/.virtualenvs/ipy7/lib/python3.7/site-packages/prompt_toolkit/eventloop/context.py", line 115, in new_func
return func(*a, **kw)
File "/home/takafumi/.virtualenvs/ipy7/lib/python3.7/site-packages/prompt_toolkit/application/application.py", line 548, in read_from_input
self.key_processor.process_keys()
File "/home/takafumi/.virtualenvs/ipy7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 272, in process_keys
self._process_coroutine.send(key_press)
File "/home/takafumi/.virtualenvs/ipy7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 179, in _process
self._call_handler(matches[-1], key_sequence=buffer[:])
File "/home/takafumi/.virtualenvs/ipy7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
handler.call(event)
File "/home/takafumi/.virtualenvs/ipy7/lib/python3.7/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 78, in call
return self.handler(event)
File "/home/takafumi/repos/watch/ipython/IPython/terminal/shortcuts.py", line 109, in newline_or_execute
status, indent = shell.check_complete(check_text)
File "/home/takafumi/repos/watch/ipython/IPython/core/interactiveshell.py", line 3307, in check_complete
status, nspaces = self.input_transformer_manager.check_complete(code)
File "/home/takafumi/repos/watch/ipython/IPython/core/inputtransformer2.py", line 627, in check_complete
lines = self.do_token_transforms(lines)
File "/home/takafumi/repos/watch/ipython/IPython/core/inputtransformer2.py", line 551, in do_token_transforms
changed, lines = self.do_one_token_transform(lines)
File "/home/takafumi/repos/watch/ipython/IPython/core/inputtransformer2.py", line 534, in do_one_token_transform
transformer = transformer_cls.find(tokens_by_line)
File "/home/takafumi/repos/watch/ipython/IPython/core/inputtransformer2.py", line 359, in find
while line[ix].type in {tokenize.INDENT, tokenize.DEDENT}:
Exception list index out of range
Press ENTER to continue...
```
Checked with current master eb8dac350abdabc350883ee72c12a151c6a0d138
|
ipython/ipython
|
diff --git a/IPython/core/tests/test_inputtransformer2.py b/IPython/core/tests/test_inputtransformer2.py
index 6a57b681c..d6c2fa3bd 100644
--- a/IPython/core/tests/test_inputtransformer2.py
+++ b/IPython/core/tests/test_inputtransformer2.py
@@ -233,6 +233,17 @@ def test_check_complete():
for k in short:
cc(c+k)
+def test_check_complete_II():
+ """
+ Test that multiple line strings are properly handled.
+
+ Separate test function for convenience
+
+ """
+ cc = ipt2.TransformerManager().check_complete
+ nt.assert_equal(cc('''def foo():\n """'''), ('incomplete', 4))
+
+
def test_null_cleanup_transformer():
manager = ipt2.TransformerManager()
manager.cleanup_transforms.insert(0, null_cleanup_transformer)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_git_commit_hash"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
7.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y graphviz"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==25.3.0
backcall==0.2.0
certifi==2025.1.31
charset-normalizer==3.4.1
decorator==5.2.1
exceptiongroup==1.2.2
fastjsonschema==2.21.1
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
ipykernel==5.5.6
-e git+https://github.com/ipython/ipython.git@8ed6e67ed9d7662222542d9f4c4bd92bd68d5adb#egg=ipython
ipython-genutils==0.2.0
jedi==0.19.2
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter_client==8.6.3
jupyter_core==5.7.2
nbformat==5.10.4
nose==1.3.7
numpy==2.0.2
packaging==24.2
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
platformdirs==4.3.7
pluggy==1.5.0
prompt-toolkit==2.0.10
ptyprocess==0.7.0
Pygments==2.19.1
pytest==8.3.5
python-dateutil==2.9.0.post0
pyzmq==26.3.0
referencing==0.36.2
requests==2.32.3
rpds-py==0.24.0
simplegeneric==0.8.1
six==1.17.0
testpath==0.6.0
tomli==2.2.1
tornado==6.4.2
traitlets==5.14.3
typing_extensions==4.13.0
urllib3==2.3.0
wcwidth==0.2.13
zipp==3.21.0
|
name: ipython
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==25.3.0
- backcall==0.2.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- decorator==5.2.1
- exceptiongroup==1.2.2
- fastjsonschema==2.21.1
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- ipykernel==5.5.6
- ipython-genutils==0.2.0
- jedi==0.19.2
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- nbformat==5.10.4
- nose==1.3.7
- numpy==2.0.2
- packaging==24.2
- parso==0.8.4
- pexpect==4.9.0
- pickleshare==0.7.5
- platformdirs==4.3.7
- pluggy==1.5.0
- prompt-toolkit==2.0.10
- ptyprocess==0.7.0
- pygments==2.19.1
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pyzmq==26.3.0
- referencing==0.36.2
- requests==2.32.3
- rpds-py==0.24.0
- simplegeneric==0.8.1
- six==1.17.0
- testpath==0.6.0
- tomli==2.2.1
- tornado==6.4.2
- traitlets==5.14.3
- typing-extensions==4.13.0
- urllib3==2.3.0
- wcwidth==0.2.13
- zipp==3.21.0
prefix: /opt/conda/envs/ipython
|
[
"IPython/core/tests/test_inputtransformer2.py::test_check_complete_II"
] |
[] |
[
"IPython/core/tests/test_inputtransformer2.py::test_continued_line",
"IPython/core/tests/test_inputtransformer2.py::test_find_assign_magic",
"IPython/core/tests/test_inputtransformer2.py::test_transform_assign_magic",
"IPython/core/tests/test_inputtransformer2.py::test_find_assign_system",
"IPython/core/tests/test_inputtransformer2.py::test_transform_assign_system",
"IPython/core/tests/test_inputtransformer2.py::test_find_magic_escape",
"IPython/core/tests/test_inputtransformer2.py::test_transform_magic_escape",
"IPython/core/tests/test_inputtransformer2.py::test_find_autocalls",
"IPython/core/tests/test_inputtransformer2.py::test_transform_autocall",
"IPython/core/tests/test_inputtransformer2.py::test_find_help",
"IPython/core/tests/test_inputtransformer2.py::test_transform_help",
"IPython/core/tests/test_inputtransformer2.py::test_check_complete",
"IPython/core/tests/test_inputtransformer2.py::test_null_cleanup_transformer"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,240 |
[
"IPython/core/inputtransformer2.py"
] |
[
"IPython/core/inputtransformer2.py"
] |
|
albertyw__git-reviewers-30
|
c3a916e554a058e3e3e3527f5692d0efed97ed83
|
2018-10-15 03:42:39
|
c3a916e554a058e3e3e3527f5692d0efed97ed83
|
diff --git a/git_reviewers/reviewers.py b/git_reviewers/reviewers.py
index e4eee15..77ec78e 100755
--- a/git_reviewers/reviewers.py
+++ b/git_reviewers/reviewers.py
@@ -101,6 +101,18 @@ class FindLogReviewers(FindFileLogReviewers):
""" Find the changed files between current status and master """
git_diff_files_command = ['git', 'diff', 'master', '--name-only']
git_diff_files = self.run_command(git_diff_files_command)
+ if not git_diff_files:
+ return FindHistoricalReviewers().get_changed_files()
+ return git_diff_files
+
+
+class FindHistoricalReviewers(FindFileLogReviewers):
+ def get_changed_files(self) -> List[str]:
+ """Find all git files """
+ git_diff_files_command = [
+ 'git', 'ls-tree', '-r', 'master', '--name-only'
+ ]
+ git_diff_files = self.run_command(git_diff_files_command)
return git_diff_files
|
Make git-reviewers work with commits that only add new files
Read reviewers from entire repository history
|
albertyw/git-reviewers
|
diff --git a/git_reviewers/tests/test.py b/git_reviewers/tests/test.py
index 87e2df4..933ebd6 100644
--- a/git_reviewers/tests/test.py
+++ b/git_reviewers/tests/test.py
@@ -110,6 +110,27 @@ class TestLogReviewers(unittest.TestCase):
files = self.finder.get_changed_files()
self.assertEqual(files, ['README.rst', 'setup.py'])
+ @patch('git_reviewers.reviewers.FindHistoricalReviewers')
+ @patch('subprocess.run')
+ def test_no_diffs(self, mock_run, mock_historical):
+ process = MagicMock()
+ process.stdout = b''
+ mock_run.return_value = process
+ mock_historical().get_changed_files.return_value = ['asdf']
+ files = self.finder.get_changed_files()
+ self.assertEqual(files, ['asdf'])
+
+
+class TestHistoricalReviewers(unittest.TestCase):
+ def setUp(self):
+ self.finder = reviewers.FindHistoricalReviewers()
+
+ def test_get_changed_files(self):
+ changed_files = ['README.rst', 'setup.py']
+ self.finder.run_command = MagicMock(return_value=changed_files)
+ files = self.finder.get_changed_files()
+ self.assertEqual(files, ['README.rst', 'setup.py'])
+
class TestFindArcCommitReviewers(unittest.TestCase):
def setUp(self):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 1
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[tests]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.7",
"reqs_path": [
"docs/requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi @ file:///croot/certifi_1671487769961/work/certifi
exceptiongroup==1.2.2
-e git+https://github.com/albertyw/git-reviewers.git@c3a916e554a058e3e3e3527f5692d0efed97ed83#egg=git_reviewers
importlib-metadata==6.7.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.2.0
pytest==7.4.4
tomli==2.0.1
typing_extensions==4.7.1
zipp==3.15.0
|
name: git-reviewers
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- packaging==24.0
- pluggy==1.2.0
- pytest==7.4.4
- tomli==2.0.1
- typing-extensions==4.7.1
- zipp==3.15.0
prefix: /opt/conda/envs/git-reviewers
|
[
"git_reviewers/tests/test.py::TestLogReviewers::test_no_diffs",
"git_reviewers/tests/test.py::TestHistoricalReviewers::test_get_changed_files"
] |
[] |
[
"git_reviewers/tests/test.py::TestFindReviewers::test_check_phabricator_activated",
"git_reviewers/tests/test.py::TestFindReviewers::test_check_phabricator_activated_none",
"git_reviewers/tests/test.py::TestFindReviewers::test_extract_uber_username_from_email",
"git_reviewers/tests/test.py::TestFindReviewers::test_extract_username_from_generic_email",
"git_reviewers/tests/test.py::TestFindReviewers::test_get_reviewers",
"git_reviewers/tests/test.py::TestFindReviewers::test_run_command",
"git_reviewers/tests/test.py::TestFindReviewers::test_run_command_empty_response",
"git_reviewers/tests/test.py::TestFindLogReviewers::test_get_changed_files",
"git_reviewers/tests/test.py::TestFindLogReviewers::test_gets_generic_emails",
"git_reviewers/tests/test.py::TestFindLogReviewers::test_gets_reviewers",
"git_reviewers/tests/test.py::TestFindLogReviewers::test_gets_uber_emails",
"git_reviewers/tests/test.py::TestFindLogReviewers::test_gets_user_weight",
"git_reviewers/tests/test.py::TestLogReviewers::test_get_changed_files",
"git_reviewers/tests/test.py::TestFindArcCommitReviewers::test_multiple_reviews",
"git_reviewers/tests/test.py::TestFindArcCommitReviewers::test_no_reviewers",
"git_reviewers/tests/test.py::TestFindArcCommitReviewers::test_reviewers",
"git_reviewers/tests/test.py::TestShowReviewers::test_copy_reviewers",
"git_reviewers/tests/test.py::TestShowReviewers::test_copy_reviewers_no_pbcopy",
"git_reviewers/tests/test.py::TestShowReviewers::test_show_reviewers",
"git_reviewers/tests/test.py::TestGetReviewers::test_verbose_reviewers",
"git_reviewers/tests/test.py::TestMain::test_ignore_reviewers",
"git_reviewers/tests/test.py::TestMain::test_main",
"git_reviewers/tests/test.py::TestMain::test_phabricator_disabled_reviewers",
"git_reviewers/tests/test.py::TestMain::test_version"
] |
[] |
MIT License
| 3,241 |
[
"git_reviewers/reviewers.py"
] |
[
"git_reviewers/reviewers.py"
] |
|
marshmallow-code__marshmallow-1002
|
74854d37376b5c9ca0b52d87bd9d3600b820a1a3
|
2018-10-15 08:12:10
|
8e217c8d6fefb7049ab3389f31a8d35824fa2d96
|
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index bf80e7dc..4f6a064f 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,6 +4,11 @@ Changelog
3.0.0b18 (unreleased)
+++++++++++++++++++++
+Bug fixes:
+
+- Fix ``Date`` deserialization when using custom format (:issue:`1001`). Thanks
+ :user:`Ondkloss` for reporting.
+
Deprecations/Removals:
- ``prefix`` parameter or ``Schema`` class is removed (:issue:`991`). The same
diff --git a/marshmallow/fields.py b/marshmallow/fields.py
index 893a8b74..d20b2b88 100644
--- a/marshmallow/fields.py
+++ b/marshmallow/fields.py
@@ -981,13 +981,6 @@ class DateTime(Field):
else:
return value.strftime(data_format)
- def _create_data_object_from_parsed_value(self, parsed):
- """Return a datetime from a parsed object that contains the needed info."""
- return dt.datetime(
- parsed.year, parsed.month, parsed.day, parsed.hour, parsed.minute,
- parsed.second,
- )
-
def _deserialize(self, value, attr, data):
if not value: # Falsy values, e.g. '', None, [] are not valid
raise self.fail('invalid', obj_type=self.OBJ_TYPE)
@@ -1000,10 +993,14 @@ class DateTime(Field):
raise self.fail('invalid', obj_type=self.OBJ_TYPE)
else:
try:
- return dt.datetime.strptime(value, data_format)
+ return self._make_object_from_format(value, data_format)
except (TypeError, AttributeError, ValueError):
raise self.fail('invalid', obj_type=self.OBJ_TYPE)
+ @staticmethod
+ def _make_object_from_format(value, data_format):
+ return dt.datetime.strptime(value, data_format)
+
class LocalDateTime(DateTime):
"""A formatted datetime string in localized time, relative to UTC.
@@ -1074,9 +1071,9 @@ class Date(DateTime):
SCHEMA_OPTS_VAR_NAME = 'dateformat'
- def _create_data_object_from_parsed_value(self, parsed):
- """Return a date from a parsed object that contains the need information."""
- return dt.date(parsed.year, parsed.month, parsed.day)
+ @staticmethod
+ def _make_object_from_format(value, data_format):
+ return dt.datetime.strptime(value, data_format).date()
class TimeDelta(Field):
|
fields.Date deserialize resulting in datetime
Today I moved from 3.0.0b16 to 3.0.0b17 since I wanted the `format` option for `fields.Date` ([this commit](https://github.com/marshmallow-code/marshmallow/commit/8efb79a8ed45906853c53335b0ca1b36e8528208)). However I'm getting some unexpected results:
>>> import marshmallow
>>> print(marshmallow.__version__)
3.0.0b17
>>> d = marshmallow.fields.Date(format='%Y-%m-%d')
>>> result = d.deserialize('2018-01-01')
>>> print(type(result), result)
<class 'datetime.datetime'> 2018-01-01 00:00:00
The functionality is greatly desired, however I wasn't expected that using a `format` for a `fields.Date` resulted in a `datetime.datetime`. Is this really intended?
(This is my first issue here. Provide constructive feedback if I should somehow improve my format)
|
marshmallow-code/marshmallow
|
diff --git a/tests/test_deserialization.py b/tests/test_deserialization.py
index 0f83d5b9..126620ea 100644
--- a/tests/test_deserialization.py
+++ b/tests/test_deserialization.py
@@ -561,12 +561,13 @@ class TestFieldDeserialization:
field.deserialize(in_value)
assert excinfo.value.args[0] == 'Not a valid period of time.'
- def test_date_field_deserialization(self):
- field = fields.Date()
+ @pytest.mark.parametrize('format', (None, '%Y-%m-%d'))
+ def test_date_field_deserialization(self, format):
+ field = fields.Date(format=format)
d = dt.date(2014, 8, 21)
iso_date = d.isoformat()
result = field.deserialize(iso_date)
- assert isinstance(result, dt.date)
+ assert type(result) == dt.date
assert_date_equal(result, d)
@pytest.mark.parametrize(
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
3.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[reco]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"dev-requirements.txt",
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aspy.yaml==1.3.0
atomicwrites==1.4.1
attrs==25.3.0
cached-property==2.0.1
cachetools==5.5.2
cfgv==3.4.0
chardet==5.2.0
colorama==0.4.6
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
flake8==3.5.0
identify==2.6.9
iniconfig==2.1.0
invoke==1.2.0
-e git+https://github.com/marshmallow-code/marshmallow.git@74854d37376b5c9ca0b52d87bd9d3600b820a1a3#egg=marshmallow
mccabe==0.6.1
more-itertools==10.6.0
nodeenv==1.9.1
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
pre-commit==1.11.2
py==1.11.0
pycodestyle==2.3.1
pyflakes==1.6.0
pyproject-api==1.9.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
python-dateutil==2.7.3
pytz==2018.5
PyYAML==6.0.2
simplejson==3.16.0
six==1.17.0
-e git+ssh://[email protected]/nebius/swebench_matterhorn.git@ae4d15b4472bd322342107dd10c47d793189f5b2#egg=swebench_matterhorn
toml==0.10.2
tomli==2.2.1
tox==4.25.0
typing_extensions==4.13.0
virtualenv==20.29.3
|
name: marshmallow
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aspy-yaml==1.3.0
- atomicwrites==1.4.1
- attrs==25.3.0
- cached-property==2.0.1
- cachetools==5.5.2
- cfgv==3.4.0
- chardet==5.2.0
- colorama==0.4.6
- coverage==7.8.0
- distlib==0.3.9
- exceptiongroup==1.2.2
- execnet==2.1.1
- filelock==3.18.0
- flake8==3.5.0
- identify==2.6.9
- iniconfig==2.1.0
- invoke==1.2.0
- mccabe==0.6.1
- more-itertools==10.6.0
- nodeenv==1.9.1
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pre-commit==1.11.2
- py==1.11.0
- pycodestyle==2.3.1
- pyflakes==1.6.0
- pyproject-api==1.9.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- python-dateutil==2.7.3
- pytz==2018.5
- pyyaml==6.0.2
- simplejson==3.16.0
- six==1.17.0
- toml==0.10.2
- tomli==2.2.1
- tox==4.25.0
- typing-extensions==4.13.0
- virtualenv==20.29.3
prefix: /opt/conda/envs/marshmallow
|
[
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization[10:37:31",
"tests/test_deserialization.py::TestFieldDeserialization::test_date_field_deserialization[%Y-%m-%d]"
] |
[] |
[
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[String]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Integer]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Boolean]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Float]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Number]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[DateTime]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[LocalDateTime]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Time]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Date]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[TimeDelta]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Dict]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Url]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Email]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[FormattedString]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[UUID]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_allow_none_deserialize_to_none[Decimal]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[String]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Integer]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Boolean]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Float]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Number]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[DateTime]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[LocalDateTime]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Time]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Date]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[TimeDelta]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Dict]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Url]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Email]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[FormattedString]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[UUID]",
"tests/test_deserialization.py::TestDeserializingNone::test_fields_dont_allow_none_by_default[Decimal]",
"tests/test_deserialization.py::TestDeserializingNone::test_allow_none_is_true_if_missing_is_true",
"tests/test_deserialization.py::TestDeserializingNone::test_list_field_deserialize_none_to_empty_list",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_float_field_deserialization[bad]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_float_field_deserialization[]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_float_field_deserialization[in_val2]",
"tests/test_deserialization.py::TestFieldDeserialization::test_integer_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_strict_integer_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_decimal_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_decimal_field_with_places",
"tests/test_deserialization.py::TestFieldDeserialization::test_decimal_field_with_places_and_rounding",
"tests/test_deserialization.py::TestFieldDeserialization::test_decimal_field_deserialization_string",
"tests/test_deserialization.py::TestFieldDeserialization::test_decimal_field_special_values",
"tests/test_deserialization.py::TestFieldDeserialization::test_decimal_field_special_values_not_permitted",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[nan-None]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[nan-False]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[nan-True]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[-nan-None]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[-nan-False]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[-nan-True]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[inf-None]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[inf-False]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[inf-True]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[-inf-None]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[-inf-False]",
"tests/test_deserialization.py::TestFieldDeserialization::test_float_field_allow_nan[-inf-True]",
"tests/test_deserialization.py::TestFieldDeserialization::test_string_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization_with_custom_truthy_values",
"tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization_with_custom_truthy_values_invalid[notvalid]",
"tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization_with_custom_truthy_values_invalid[123]",
"tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization_with_empty_truthy",
"tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization_with_custom_falsy_values",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization[not-a-datetime]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization[42]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization[]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization[in_value3]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization[2018-01-01]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization[03-31-2025",
"tests/test_deserialization.py::TestFieldDeserialization::test_datetime_passed_year_is_invalid",
"tests/test_deserialization.py::TestFieldDeserialization::test_datetime_passed_date_is_invalid",
"tests/test_deserialization.py::TestFieldDeserialization::test_custom_date_format_datetime_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_rfc_datetime_field_deserialization[rfc]",
"tests/test_deserialization.py::TestFieldDeserialization::test_rfc_datetime_field_deserialization[rfc822]",
"tests/test_deserialization.py::TestFieldDeserialization::test_iso_datetime_field_deserialization[iso]",
"tests/test_deserialization.py::TestFieldDeserialization::test_iso_datetime_field_deserialization[iso8601]",
"tests/test_deserialization.py::TestFieldDeserialization::test_localdatetime_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_time_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_time_field_deserialization[badvalue]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_time_field_deserialization[]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_time_field_deserialization[in_data2]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_time_field_deserialization[42]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_timedelta_precision",
"tests/test_deserialization.py::TestFieldDeserialization::test_timedelta_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_timedelta_field_deserialization[]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_timedelta_field_deserialization[badvalue]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_timedelta_field_deserialization[in_value2]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_timedelta_field_deserialization[9999999999]",
"tests/test_deserialization.py::TestFieldDeserialization::test_date_field_deserialization[None]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_date_field_deserialization[]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_date_field_deserialization[123]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_date_field_deserialization[in_value2]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_date_field_deserialization[21-08-2014]",
"tests/test_deserialization.py::TestFieldDeserialization::test_dict_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_structured_dict_value_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_structured_dict_key_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_structured_dict_key_value_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_url_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_relative_url_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_url_field_schemes_argument",
"tests/test_deserialization.py::TestFieldDeserialization::test_email_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_is_noop_by_default",
"tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_with_callable",
"tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_with_context",
"tests/test_deserialization.py::TestFieldDeserialization::test_function_field_passed_deserialize_only_is_load_only",
"tests/test_deserialization.py::TestFieldDeserialization::test_function_field_passed_deserialize_and_serialize_is_not_load_only",
"tests/test_deserialization.py::TestFieldDeserialization::test_uuid_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_uuid_deserialization[malformed]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_uuid_deserialization[123]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_uuid_deserialization[in_value2]",
"tests/test_deserialization.py::TestFieldDeserialization::test_invalid_uuid_deserialization[tooshort]",
"tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_function_must_be_callable",
"tests/test_deserialization.py::TestFieldDeserialization::test_method_field_deserialization_is_noop_by_default",
"tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_method",
"tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_method_must_be_a_method",
"tests/test_deserialization.py::TestFieldDeserialization::test_method_field_deserialize_only",
"tests/test_deserialization.py::TestFieldDeserialization::test_datetime_list_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_invalid_item",
"tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_multiple_invalid_items",
"tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_value_that_is_not_a_list[notalist]",
"tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_value_that_is_not_a_list[42]",
"tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_value_that_is_not_a_list[value2]",
"tests/test_deserialization.py::TestFieldDeserialization::test_constant_field_deserialization",
"tests/test_deserialization.py::TestFieldDeserialization::test_constant_is_always_included_in_deserialized_data",
"tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validator_function",
"tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validator_class_that_returns_bool",
"tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validator_that_raises_error_with_list",
"tests/test_deserialization.py::TestFieldDeserialization::test_validator_must_return_false_to_raise_error",
"tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_validator_with_nonascii_input",
"tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validators",
"tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_custom_error_message",
"tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_non_utf8_value",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_to_dict",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_missing_values",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_many",
"tests/test_deserialization.py::TestSchemaDeserialization::test_exclude",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_single_deserialization_to_dict",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_list_deserialization_to_dict",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_single_none_not_allowed",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_many_non_not_allowed",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_single_required_missing",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_many_required_missing",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_only_basestring",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_only_basestring_with_list_data",
"tests/test_deserialization.py::TestSchemaDeserialization::test_nested_none_deserialization",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_attribute_param",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_attribute_param_symmetry",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_attribute_param_error_returns_field_name_not_attribute_name",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_attribute_param_error_returns_data_key_not_attribute_name",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_data_key_param",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_dump_only_param",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_missing_param_value",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_missing_param_callable",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_missing_param_none",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_raises_with_errors",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_raises_with_errors_with_multiple_validators",
"tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_many_raises_errors",
"tests/test_deserialization.py::TestSchemaDeserialization::test_validation_errors_are_stored",
"tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_a_field",
"tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_an_email_field",
"tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_a_url_field",
"tests/test_deserialization.py::TestSchemaDeserialization::test_required_value_only_passed_to_validators_if_provided",
"tests/test_deserialization.py::TestSchemaDeserialization::test_partial_deserialization[True]",
"tests/test_deserialization.py::TestSchemaDeserialization::test_partial_deserialization[False]",
"tests/test_deserialization.py::TestSchemaDeserialization::test_partial_fields_deserialization",
"tests/test_deserialization.py::TestSchemaDeserialization::test_partial_fields_validation",
"tests/test_deserialization.py::TestSchemaDeserialization::test_unknown_fields_deserialization",
"tests/test_deserialization.py::TestSchemaDeserialization::test_unknown_fields_deserialization_precedence",
"tests/test_deserialization.py::TestSchemaDeserialization::test_unknown_fields_deserialization_with_data_key",
"tests/test_deserialization.py::TestSchemaDeserialization::test_unknown_fields_deserialization_with_index_errors_false",
"tests/test_deserialization.py::TestSchemaDeserialization::test_dump_only_fields_considered_unknown",
"tests/test_deserialization.py::TestValidation::test_integer_with_validator",
"tests/test_deserialization.py::TestValidation::test_integer_with_validators[field0]",
"tests/test_deserialization.py::TestValidation::test_integer_with_validators[field1]",
"tests/test_deserialization.py::TestValidation::test_integer_with_validators[field2]",
"tests/test_deserialization.py::TestValidation::test_float_with_validators[field0]",
"tests/test_deserialization.py::TestValidation::test_float_with_validators[field1]",
"tests/test_deserialization.py::TestValidation::test_float_with_validators[field2]",
"tests/test_deserialization.py::TestValidation::test_string_validator",
"tests/test_deserialization.py::TestValidation::test_function_validator",
"tests/test_deserialization.py::TestValidation::test_function_validators[field0]",
"tests/test_deserialization.py::TestValidation::test_function_validators[field1]",
"tests/test_deserialization.py::TestValidation::test_function_validators[field2]",
"tests/test_deserialization.py::TestValidation::test_method_validator",
"tests/test_deserialization.py::TestValidation::test_nested_data_is_stored_when_validation_fails",
"tests/test_deserialization.py::TestValidation::test_false_value_validation",
"tests/test_deserialization.py::test_required_field_failure[String]",
"tests/test_deserialization.py::test_required_field_failure[Integer]",
"tests/test_deserialization.py::test_required_field_failure[Boolean]",
"tests/test_deserialization.py::test_required_field_failure[Float]",
"tests/test_deserialization.py::test_required_field_failure[Number]",
"tests/test_deserialization.py::test_required_field_failure[DateTime]",
"tests/test_deserialization.py::test_required_field_failure[LocalDateTime]",
"tests/test_deserialization.py::test_required_field_failure[Time]",
"tests/test_deserialization.py::test_required_field_failure[Date]",
"tests/test_deserialization.py::test_required_field_failure[TimeDelta]",
"tests/test_deserialization.py::test_required_field_failure[Dict]",
"tests/test_deserialization.py::test_required_field_failure[Url]",
"tests/test_deserialization.py::test_required_field_failure[Email]",
"tests/test_deserialization.py::test_required_field_failure[UUID]",
"tests/test_deserialization.py::test_required_field_failure[Decimal]",
"tests/test_deserialization.py::test_required_message_can_be_changed[My",
"tests/test_deserialization.py::test_required_message_can_be_changed[message1]",
"tests/test_deserialization.py::test_required_message_can_be_changed[message2]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[True-exclude]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[True-include]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[True-raise]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[False-exclude]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[False-include]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[False-raise]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[42-exclude]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[42-include]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[42-raise]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[None-exclude]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[None-include]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[None-raise]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[data4-exclude]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[data4-include]",
"tests/test_deserialization.py::test_deserialize_raises_exception_if_input_type_is_incorrect[data4-raise]"
] |
[] |
MIT License
| 3,242 |
[
"CHANGELOG.rst",
"marshmallow/fields.py"
] |
[
"CHANGELOG.rst",
"marshmallow/fields.py"
] |
|
encode__starlette-109
|
02aaa4bddfe126b1458184b1ee1e8604af5041c7
|
2018-10-15 08:34:17
|
66cce0f1c309d1df872652cbb3d23eb543254cdc
|
diff --git a/starlette/datastructures.py b/starlette/datastructures.py
index 558c8a9..2705fd3 100644
--- a/starlette/datastructures.py
+++ b/starlette/datastructures.py
@@ -7,16 +7,20 @@ class URL:
def __init__(self, url: str = "", scope: Scope = None) -> None:
if scope is not None:
assert not url, 'Cannot set both "url" and "scope".'
- scheme = scope["scheme"]
- host, port = scope["server"]
+ scheme = scope.get("scheme", "http")
+ server = scope.get("server", None)
path = scope.get("root_path", "") + scope["path"]
query_string = scope["query_string"]
- default_port = {"http": 80, "https": 443, "ws": 80, "wss": 443}[scheme]
- if port == default_port:
- url = "%s://%s%s" % (scheme, host, path)
+ if server is None:
+ url = path
else:
- url = "%s://%s:%s%s" % (scheme, host, port, path)
+ host, port = server
+ default_port = {"http": 80, "https": 443, "ws": 80, "wss": 443}[scheme]
+ if port == default_port:
+ url = "%s://%s%s" % (scheme, host, path)
+ else:
+ url = "%s://%s:%s%s" % (scheme, host, port, path)
if query_string:
url += "?" + unquote(query_string.decode())
@@ -85,6 +89,9 @@ class URL:
def __str__(self):
return self._url
+ def __repr__(self):
+ return "%s(%s)" % (self.__class__.__name__, repr(self._url))
+
# Type annotations for valid `__init__` values to QueryParams and Headers.
StrPairs = typing.Sequence[typing.Tuple[str, str]]
|
scope["server"] can be None
From https://asgi.readthedocs.io/en/latest/specs/www.html#connection-scope
> server: A two-item iterable of [host, port], where host is the listening address for this server as a unicode string, and port is the integer listening port. Optional, defaults to None.
https://github.com/encode/starlette/blob/master/starlette/datastructures.py#L11 doesn't handle that option, it assumes scope["server"] is always a two-pair
|
encode/starlette
|
diff --git a/tests/test_datastructures.py b/tests/test_datastructures.py
index d6aa62f..4312e1c 100644
--- a/tests/test_datastructures.py
+++ b/tests/test_datastructures.py
@@ -27,6 +27,23 @@ def test_url():
assert new.hostname == "example.com"
+def test_url_from_scope():
+ u = URL(scope={"path": "/path/to/somewhere", "query_string": b"abc=123"})
+ assert u == "/path/to/somewhere?abc=123"
+ assert repr(u) == "URL('/path/to/somewhere?abc=123')"
+
+ u = URL(
+ scope={
+ "scheme": "https",
+ "server": ("example.org", 123),
+ "path": "/path/to/somewhere",
+ "query_string": b"abc=123",
+ }
+ )
+ assert u == "https://example.org:123/path/to/somewhere?abc=123"
+ assert repr(u) == "URL('https://example.org:123/path/to/somewhere?abc=123')"
+
+
def test_headers():
h = Headers([(b"a", b"123"), (b"a", b"456"), (b"b", b"789")])
assert "a" in h
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[full]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiofiles==24.1.0
babel==2.17.0
backrefs==5.8
black==25.1.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
codecov==2.1.13
colorama==0.4.6
coverage==7.8.0
exceptiongroup==1.2.2
ghp-import==2.1.0
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
Markdown==3.7
MarkupSafe==3.0.2
mergedeep==1.3.4
mkdocs==1.6.1
mkdocs-get-deps==0.2.0
mkdocs-material==9.6.10
mkdocs-material-extensions==1.3.1
mypy==1.15.0
mypy-extensions==1.0.0
packaging==24.2
paginate==0.5.7
pathspec==0.12.1
platformdirs==4.3.7
pluggy==1.5.0
Pygments==2.19.1
pymdown-extensions==10.14.3
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
python-multipart==0.0.20
PyYAML==6.0.2
pyyaml_env_tag==0.1
requests==2.32.3
six==1.17.0
-e git+https://github.com/encode/starlette.git@02aaa4bddfe126b1458184b1ee1e8604af5041c7#egg=starlette
tomli==2.2.1
typing_extensions==4.13.0
ujson==5.10.0
urllib3==2.3.0
watchdog==6.0.0
zipp==3.21.0
|
name: starlette
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aiofiles==24.1.0
- babel==2.17.0
- backrefs==5.8
- black==25.1.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- click==8.1.8
- codecov==2.1.13
- colorama==0.4.6
- coverage==7.8.0
- exceptiongroup==1.2.2
- ghp-import==2.1.0
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markdown==3.7
- markupsafe==3.0.2
- mergedeep==1.3.4
- mkdocs==1.6.1
- mkdocs-get-deps==0.2.0
- mkdocs-material==9.6.10
- mkdocs-material-extensions==1.3.1
- mypy==1.15.0
- mypy-extensions==1.0.0
- packaging==24.2
- paginate==0.5.7
- pathspec==0.12.1
- platformdirs==4.3.7
- pluggy==1.5.0
- pygments==2.19.1
- pymdown-extensions==10.14.3
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- python-multipart==0.0.20
- pyyaml==6.0.2
- pyyaml-env-tag==0.1
- requests==2.32.3
- six==1.17.0
- tomli==2.2.1
- typing-extensions==4.13.0
- ujson==5.10.0
- urllib3==2.3.0
- watchdog==6.0.0
- zipp==3.21.0
prefix: /opt/conda/envs/starlette
|
[
"tests/test_datastructures.py::test_url_from_scope"
] |
[] |
[
"tests/test_datastructures.py::test_url",
"tests/test_datastructures.py::test_headers",
"tests/test_datastructures.py::test_mutable_headers",
"tests/test_datastructures.py::test_headers_mutablecopy",
"tests/test_datastructures.py::test_queryparams"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,243 |
[
"starlette/datastructures.py"
] |
[
"starlette/datastructures.py"
] |
|
allo-media__text2num-8
|
c61648e492097249d9a8f7ed6fd3c25fd12ef572
|
2018-10-15 08:58:26
|
c61648e492097249d9a8f7ed6fd3c25fd12ef572
|
diff --git a/.circleci/config.yml b/.circleci/config.yml
index f4de54e..7dfbf33 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -23,6 +23,7 @@ jobs:
python3 -m venv venv
. venv/bin/activate
pip install sphinx
+ pip install flake8
python setup.py develop
- save_cache:
@@ -37,6 +38,7 @@ jobs:
command: |
. venv/bin/activate
python setup.py test
+ flake8 --max-line-length=110 text_to_num
# Build the documentation
- run:
diff --git a/README.rst b/README.rst
index 84edb04..81fd418 100644
--- a/README.rst
+++ b/README.rst
@@ -6,8 +6,8 @@ text2num
``text2num`` is a python package that provides functions and parser classes for:
-- parsing numbers expressed as words in french and convert them to integer values;
-- detect ordinal, cardinal and decimal numbers in a stream of french words and get their decimal digit representations.
+- parsing numbers expressed as words in French and convert them to integer values;
+- detect ordinal, cardinal and decimal numbers in a stream of French words and get their decimal digit representations.
Compatibility
-------------
@@ -39,17 +39,23 @@ Parse and convert
.. code-block:: python
>>> from text_to_num import text2num
+ >>> text2num('quatre-vingt-quinze')
+ 95
+
>>> text2num('nonante-cinq')
95
>>> text2num('mille neuf cent quatre-vingt dix-neuf')
1999
+ >>> text2num('dix-neuf cent quatre-vingt dix-neuf')
+ 1999
+
>>> text2num("cinquante et un million cinq cent soixante dix-huit mille trois cent deux")
51578302
>>> text2num('mille mille deux cents')
- AssertionError
+ ValueError: invalid literal for text2num: 'mille mille deux cent'
Find and transcribe
diff --git a/doc/index.rst b/doc/index.rst
index da4a1f2..e169bdb 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -8,8 +8,8 @@ Welcome to text2num's documentation!
``text2num`` is a package that provides functions and parser classes for:
-- parsing numbers expressed as words in french and convert them to integer values;
-- detect ordinals, cardinals and decimal numbers in a stream of french words and get their decimal digit representations.
+- parsing numbers expressed as words in French and convert them to integer values;
+- detect ordinals, cardinals and decimal numbers in a stream of French words and get their decimal digit representations.
``text2num`` is distributed under the MIT license and is known to work on python version 3.6 and above.
diff --git a/doc/quickstart.rst b/doc/quickstart.rst
index 570b9ab..1216c80 100644
--- a/doc/quickstart.rst
+++ b/doc/quickstart.rst
@@ -23,17 +23,23 @@ Integers only.
.. code-block:: python
>>> from text_to_num import text2num
+ >>> text2num('quatre-vingt-quinze')
+ 95
+
>>> text2num('nonante-cinq')
95
>>> text2num('mille neuf cent quatre-vingt dix-neuf')
1999
+ >>> text2num('dix-neuf cent quatre-vingt dix-neuf')
+ 1999
+
>>> text2num("cinquante et un million cinq cent soixante dix-huit mille trois cent deux")
51578302
>>> text2num('mille mille deux cents')
- AssertionError
+ ValueError: invalid literal for text2num: 'mille mille deux cent'
Find and transcribe
diff --git a/setup.py b/setup.py
index 68a7fd9..997789e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,6 @@
-import os
-import sys
-
from setuptools import setup, find_packages
-from setuptools.command.install import install
-VERSION = '1.0.0'
+VERSION = '1.1.0'
def readme():
@@ -14,7 +10,7 @@ def readme():
setup(name='text2num',
version=VERSION,
- description='Parse and convert numbers written in french into their digit representation.',
+ description='Parse and convert numbers written in French into their digit representation.',
long_description=readme(),
classifiers=[
'Development Status :: 5 - Production/Stable',
@@ -24,7 +20,7 @@ setup(name='text2num',
'Topic :: Text Processing :: Filters',
'Natural Language :: French'
],
- keywords='french NLP words-to-numbers',
+ keywords='French NLP words-to-numbers',
url='https://github.com/allo-media/text2num',
author='Allo-Media',
author_email='[email protected]',
diff --git a/text_to_num/__init__.py b/text_to_num/__init__.py
index 9aa0bc4..b83bd39 100644
--- a/text_to_num/__init__.py
+++ b/text_to_num/__init__.py
@@ -20,4 +20,4 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
-from .transforms import text2num, alpha2digit
+from .transforms import text2num, alpha2digit # noqa: F401
diff --git a/text_to_num/parsers.py b/text_to_num/parsers.py
index 667333b..d3ffb5f 100644
--- a/text_to_num/parsers.py
+++ b/text_to_num/parsers.py
@@ -1,5 +1,27 @@
+# MIT License
+
+# Copyright (c) 2018 Groupe Allo-Media
+
+# 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.
+
"""
-Convert french spelled numbers into numeric values or digit strings.
+Convert French spelled numbers into numeric values or digit strings.
"""
#
@@ -45,11 +67,12 @@ NUMBERS.update(STENS)
# Exceptions: "soixante" & "quatre-ving" (see Rules)
MTENS = {
word: value * 10
- for value, word in enumerate("vingt trente quarante cinquante soixante septante octante nonante".split(),
+ for value, word in enumerate("vingt trente quarante cinquante soixante septante huitante nonante".split(),
2)
}
-# Variant
+# Variants
MTENS['quatre-vingt'] = 80
+MTENS['octante'] = 80
NUMBERS.update(MTENS)
@@ -71,7 +94,7 @@ COMPOSITES.update({
"-".join((ten_word, et_word)): ten_val + et_val
for ten_word, ten_val in MTENS.items()
for et_word, et_val in (('et-un', 1), ('et-une', 1))
- if 10 < ten_val < 80
+ if 10 < ten_val <= 90
})
COMPOSITES['quatre-vingt-un'] = 81
@@ -151,7 +174,8 @@ class WordStreamValueParser:
expected = False
if self.last_word is None:
expected = True
- elif self.last_word in UNITS and self.grp_val < 10:
+ elif (self.last_word in UNITS and self.grp_val < 10 or
+ self.last_word in STENS and self.grp_val < 20):
expected = word in CENT
elif self.last_word in MTENS:
expected = word in UNITS or word in STENS and self.last_word in ("soixante", "quatre-vingt")
diff --git a/text_to_num/transforms.py b/text_to_num/transforms.py
index 39bea74..cfb99d2 100644
--- a/text_to_num/transforms.py
+++ b/text_to_num/transforms.py
@@ -26,7 +26,17 @@ from .parsers import WordStreamValueParser, WordToDigitParser
def look_ahead(sequence):
- """Look-ahead iterator"""
+ """Look-ahead iterator.
+
+ Iterate over a sequence by returning couples (current element, next element).
+ The last couple returned before StopIteration is raised, is (last element, None).
+
+ Example:
+
+ >>> for elt, nxt_elt in look_ahead(sequence):
+ ... # do something
+
+ """
maxi = len(sequence) - 1
for i, val in enumerate(sequence):
ahead = sequence[i + 1] if i < maxi else None
@@ -34,7 +44,7 @@ def look_ahead(sequence):
def text2num(text, relaxed=False):
- """Convert the ``text`` string containing an integer number written in french
+ """Convert the ``text`` string containing an integer number written in French
into an integer value.
Set ``relaxed`` to True if you want to accept "quatre vingt(s)" as "quatre-vingt".
@@ -45,12 +55,13 @@ def text2num(text, relaxed=False):
num_parser = WordStreamValueParser(relaxed=relaxed)
tokens = text.split()
- assert all(num_parser.push(word, ahead) for word, ahead in look_ahead(tokens))
+ if not all(num_parser.push(word, ahead) for word, ahead in look_ahead(tokens)):
+ raise ValueError('invalid literal for text2num: {}'.format(repr(text)))
return num_parser.value
def alpha2digit(text, relaxed=False):
- """Return the text of ``text`` with all the french spelled numbers converted to digits.
+ """Return the text of ``text`` with all the French spelled numbers converted to digits.
Takes care of punctuation.
Set ``relaxed`` to True if you want to accept "quatre vingt(s)" as "quatre-vingt".
"""
|
text2num should raise ValueError instead of AssertionError
From the docs
```py
>>> text2num('mille mille deux cents')
AssertionError
```
First, an error message would be helpful to know what went wrong.
Second, the use of `AssertionError` here is a bad choice. An assertion error should only be raised if the program is internally inconsistent (has a bug). It should not be possible to cause an assertion error by supplying bad input (unless the program _is_ internally inconsistent, and therefore is indicating it has a bug).
I think `ValueError` would be a better choice in this case since the user supplied a bad value. This is the same as passing a bad value to the built in `int` function:
```py
>>> int("not a number")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: 'not a number'
```
`text2num` can't do anything about bad values passed to it other than raise an error indicating that it got a bad value.
|
allo-media/text2num
|
diff --git a/text_to_num/tests/test_text_to_num.py b/text_to_num/tests/test_text_to_num.py
index d857316..1a19d9a 100644
--- a/text_to_num/tests/test_text_to_num.py
+++ b/text_to_num/tests/test_text_to_num.py
@@ -42,8 +42,25 @@ class TestTextToNum(TestCase):
test4 = "quatre-vingt un"
self.assertEqual(text2num(test4), 81)
+ self.assertEqual(text2num('quinze'), 15)
+ self.assertEqual(text2num('soixante quinze mille'), 75000)
+
+ def test_text2num_variants(self):
+ self.assertEqual(text2num('quatre-vingt dix-huit'), 98)
+ self.assertEqual(text2num('nonante-huit'), 98)
+ self.assertEqual(text2num('soixante-dix-huit'), 78)
+ self.assertEqual(text2num('septante-huit'), 78)
+ self.assertEqual(text2num('quatre-vingt-huit'), 88)
+ self.assertEqual(text2num('octante-huit'), 88)
+ self.assertEqual(text2num('huitante-huit'), 88)
+ self.assertEqual(text2num('huitante-et-un'), 81)
+
+ def test_text2num_centuries(self):
+ self.assertEqual(text2num('dix-neuf cent soixante-treize'), 1973)
+
def test_text2num_exc(self):
- self.assertRaises(AssertionError, text2num, "mille mille deux cent")
+ self.assertRaises(ValueError, text2num, "mille mille deux cent")
+ self.assertRaises(ValueError, text2num, "soixante quinze cent")
def test_alpha2digit_integers(self):
source = "Vingt-cinq vaches, douze poulets et cent vingt-cinq kg de pommes de terre."
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 8
}
|
1.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
-e git+https://github.com/allo-media/text2num.git@c61648e492097249d9a8f7ed6fd3c25fd12ef572#egg=text2num
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: text2num
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
prefix: /opt/conda/envs/text2num
|
[
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_text2num_centuries",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_text2num_exc",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_text2num_variants"
] |
[] |
[
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_alpha2digit_decimals",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_alpha2digit_formal",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_alpha2digit_integers",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_alpha2digit_ordinals",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_alpha2digit_zero",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_article",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_relaxed",
"text_to_num/tests/test_text_to_num.py::TestTextToNum::test_text2num"
] |
[] |
MIT License
| 3,244 |
[
"README.rst",
"setup.py",
".circleci/config.yml",
"text_to_num/__init__.py",
"doc/quickstart.rst",
"doc/index.rst",
"text_to_num/transforms.py",
"text_to_num/parsers.py"
] |
[
"README.rst",
"setup.py",
".circleci/config.yml",
"text_to_num/__init__.py",
"doc/quickstart.rst",
"doc/index.rst",
"text_to_num/transforms.py",
"text_to_num/parsers.py"
] |
|
python-visualization__folium-990
|
9f648a2be574481d17e0bfba25e8400561f20f23
|
2018-10-15 11:51:22
|
110a90aa3e43927113f584e7c0804d0d5973cdd9
|
Conengmo: Do we need to make the path explicit with `os.path.abspath` or is the current relative path sufficient?
|
diff --git a/CHANGES.txt b/CHANGES.txt
index ffd37970..0cb937ce 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,7 @@
- Update leaflet to 1.3.4 (ocefpaf #939)
- More options (tms, opacity, kwargs) in TileLayer (mpickering #948)
- Add MousePosition plugin (btozer #916)
+- Add Minimap plugin (talbertc-usgs #968)
Bug Fixes
diff --git a/docs/conf.py b/docs/conf.py
index 553fc65c..bd829543 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -11,7 +11,11 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import sys
+import os
+
+# Use the currently checked out folium of this folder
+sys.path.insert(0, os.path.abspath(os.pardir))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
diff --git a/examples/MiniMap.ipynb b/examples/MiniMap.ipynb
new file mode 100644
index 00000000..ccbece51
--- /dev/null
+++ b/examples/MiniMap.ipynb
@@ -0,0 +1,241 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Demo of a Minimap in Folium"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import folium\n",
+ "from folium.plugins import MiniMap"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfY2IzNDY4ZTkyYzJjNGMyOWEyZDQ3N2M0ZTcxOGYwZGIgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC1taW5pbWFwLzMuNi4xL0NvbnRyb2wuTWluaU1hcC5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQtbWluaW1hcC8zLjYuMS9Db250cm9sLk1pbmlNYXAuY3NzIi8+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwX2NiMzQ2OGU5MmMyYzRjMjlhMmQ0NzdjNGU3MThmMGRiIiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF9jYjM0NjhlOTJjMmM0YzI5YTJkNDc3YzRlNzE4ZjBkYiA9IEwubWFwKAogICAgICAgICdtYXBfY2IzNDY4ZTkyYzJjNGMyOWEyZDQ3N2M0ZTcxOGYwZGInLCB7CiAgICAgICAgY2VudGVyOiBbMzAsIDIwXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNzMxMGM1MDZjMzk3NDFmYjhlNjdkYTYwOTNkZmI3MmMgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwX2NiMzQ2OGU5MmMyYzRjMjlhMmQ0NzdjNGU3MThmMGRiKTsKICAgIAoKICAgICAgICB2YXIgdGlsZV9sYXllcl83MTQyMThiNzZhYTk0MTBiOGVkODZmOTUxOWNkNjBjZSA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9ICk7CgogICAgICAgIHZhciBtaW5pX21hcF83ZjhjYzEwOTVjZTc0YTc3OWE3OTRkY2U5MTNiZmRjOSA9IG5ldyBMLkNvbnRyb2wuTWluaU1hcCggdGlsZV9sYXllcl83MTQyMThiNzZhYTk0MTBiOGVkODZmOTUxOWNkNjBjZSwKICAgICAgICAgewogICJhdXRvVG9nZ2xlRGlzcGxheSI6IGZhbHNlLAogICJjZW50ZXJGaXhlZCI6IGZhbHNlLAogICJjb2xsYXBzZWRIZWlnaHQiOiAyNSwKICAiY29sbGFwc2VkV2lkdGgiOiAyNSwKICAiaGVpZ2h0IjogMTUwLAogICJtaW5pbWl6ZWQiOiBmYWxzZSwKICAicG9zaXRpb24iOiAiYm90dG9tcmlnaHQiLAogICJ0b2dnbGVEaXNwbGF5IjogZmFsc2UsCiAgIndpZHRoIjogMTUwLAogICJ6b29tQW5pbWF0aW9uIjogZmFsc2UsCiAgInpvb21MZXZlbEZpeGVkIjogbnVsbCwKICAiem9vbUxldmVsT2Zmc2V0IjogLTUKfSk7CiAgICAgICAgbWFwX2NiMzQ2OGU5MmMyYzRjMjlhMmQ0NzdjNGU3MThmMGRiLmFkZENvbnRyb2wobWluaV9tYXBfN2Y4Y2MxMDk1Y2U3NGE3NzlhNzk0ZGNlOTEzYmZkYzkpOwoKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ ],
+ "text/plain": [
+ "<folium.folium.Map at 0x1b624bec048>"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = folium.Map(location=(30, 20), zoom_start=4)\n",
+ "\n",
+ "minimap = MiniMap()\n",
+ "m.add_child(minimap)\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Make the minimap collapsable"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfMWU5MzFhZWRkYzMwNDg5ODkxOWNiZDVmNmE0NGJhM2EgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC1taW5pbWFwLzMuNi4xL0NvbnRyb2wuTWluaU1hcC5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQtbWluaW1hcC8zLjYuMS9Db250cm9sLk1pbmlNYXAuY3NzIi8+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwXzFlOTMxYWVkZGMzMDQ4OTg5MTljYmQ1ZjZhNDRiYTNhIiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF8xZTkzMWFlZGRjMzA0ODk4OTE5Y2JkNWY2YTQ0YmEzYSA9IEwubWFwKAogICAgICAgICdtYXBfMWU5MzFhZWRkYzMwNDg5ODkxOWNiZDVmNmE0NGJhM2EnLCB7CiAgICAgICAgY2VudGVyOiBbMzAsIDIwXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNzBjNTI0M2VmNWMyNDhkZWEzYmUwYmExN2Y4MGQ1NjIgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwXzFlOTMxYWVkZGMzMDQ4OTg5MTljYmQ1ZjZhNDRiYTNhKTsKICAgIAoKICAgICAgICB2YXIgdGlsZV9sYXllcl9iMmFmNTAzYThhYzI0ODYwYjc5ZTYzN2NmMTllNjA2MSA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9ICk7CgogICAgICAgIHZhciBtaW5pX21hcF85ZWRhMjk5ZmU2MzU0NTcxOTY5NDk1NTZhMTgyY2FmOCA9IG5ldyBMLkNvbnRyb2wuTWluaU1hcCggdGlsZV9sYXllcl9iMmFmNTAzYThhYzI0ODYwYjc5ZTYzN2NmMTllNjA2MSwKICAgICAgICAgewogICJhdXRvVG9nZ2xlRGlzcGxheSI6IGZhbHNlLAogICJjZW50ZXJGaXhlZCI6IGZhbHNlLAogICJjb2xsYXBzZWRIZWlnaHQiOiAyNSwKICAiY29sbGFwc2VkV2lkdGgiOiAyNSwKICAiaGVpZ2h0IjogMTUwLAogICJtaW5pbWl6ZWQiOiBmYWxzZSwKICAicG9zaXRpb24iOiAiYm90dG9tcmlnaHQiLAogICJ0b2dnbGVEaXNwbGF5IjogdHJ1ZSwKICAid2lkdGgiOiAxNTAsCiAgInpvb21BbmltYXRpb24iOiBmYWxzZSwKICAiem9vbUxldmVsRml4ZWQiOiBudWxsLAogICJ6b29tTGV2ZWxPZmZzZXQiOiAtNQp9KTsKICAgICAgICBtYXBfMWU5MzFhZWRkYzMwNDg5ODkxOWNiZDVmNmE0NGJhM2EuYWRkQ29udHJvbChtaW5pX21hcF85ZWRhMjk5ZmU2MzU0NTcxOTY5NDk1NTZhMTgyY2FmOCk7CgogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ ],
+ "text/plain": [
+ "<folium.folium.Map at 0x1b624bfaeb8>"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = folium.Map(location=(30, 20), zoom_start=4)\n",
+ "minimap = MiniMap(toggle_display=True)\n",
+ "minimap.add_to(m)\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Change the minimap tile layer"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfZWE0YjRiNzdlNWY5NDBiYmJjMGYyYWMwNjlhODE0N2YgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC1taW5pbWFwLzMuNi4xL0NvbnRyb2wuTWluaU1hcC5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQtbWluaW1hcC8zLjYuMS9Db250cm9sLk1pbmlNYXAuY3NzIi8+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwX2VhNGI0Yjc3ZTVmOTQwYmJiYzBmMmFjMDY5YTgxNDdmIiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF9lYTRiNGI3N2U1Zjk0MGJiYmMwZjJhYzA2OWE4MTQ3ZiA9IEwubWFwKAogICAgICAgICdtYXBfZWE0YjRiNzdlNWY5NDBiYmJjMGYyYWMwNjlhODE0N2YnLCB7CiAgICAgICAgY2VudGVyOiBbMzAsIDIwXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfYzRlNDgwNDRjYzlkNGQ0YjllMzNmYjFmMDBmNTBlYzMgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwX2VhNGI0Yjc3ZTVmOTQwYmJiYzBmMmFjMDY5YTgxNDdmKTsKICAgIAoKICAgICAgICB2YXIgdGlsZV9sYXllcl82YTk0M2YyZDk4NzE0ZWVjYjdhMDNjMzlmMTFlODQyZSA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3N0YW1lbi10aWxlcy17c30uYS5zc2wuZmFzdGx5Lm5ldC90b25lci97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSApOwoKICAgICAgICB2YXIgbWluaV9tYXBfMzY2ZTZiYWI3ZDQyNGQyMGFkZTIxMTNmNzYzZTM0MmYgPSBuZXcgTC5Db250cm9sLk1pbmlNYXAoIHRpbGVfbGF5ZXJfNmE5NDNmMmQ5ODcxNGVlY2I3YTAzYzM5ZjExZTg0MmUsCiAgICAgICAgIHsKICAiYXV0b1RvZ2dsZURpc3BsYXkiOiBmYWxzZSwKICAiY2VudGVyRml4ZWQiOiBmYWxzZSwKICAiY29sbGFwc2VkSGVpZ2h0IjogMjUsCiAgImNvbGxhcHNlZFdpZHRoIjogMjUsCiAgImhlaWdodCI6IDE1MCwKICAibWluaW1pemVkIjogZmFsc2UsCiAgInBvc2l0aW9uIjogImJvdHRvbXJpZ2h0IiwKICAidG9nZ2xlRGlzcGxheSI6IGZhbHNlLAogICJ3aWR0aCI6IDE1MCwKICAiem9vbUFuaW1hdGlvbiI6IGZhbHNlLAogICJ6b29tTGV2ZWxGaXhlZCI6IG51bGwsCiAgInpvb21MZXZlbE9mZnNldCI6IC01Cn0pOwogICAgICAgIG1hcF9lYTRiNGI3N2U1Zjk0MGJiYmMwZjJhYzA2OWE4MTQ3Zi5hZGRDb250cm9sKG1pbmlfbWFwXzM2NmU2YmFiN2Q0MjRkMjBhZGUyMTEzZjc2M2UzNDJmKTsKCiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ ],
+ "text/plain": [
+ "<folium.folium.Map at 0x1b624c27d30>"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = folium.Map(location=(30, 20), zoom_start=4)\n",
+ "minimap = MiniMap(tile_layer=\"Stamen Toner\")\n",
+ "minimap.add_to(m)\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Change the minimap position"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfZDliNTMyY2Y2YTg3NGZjZWFlZjI4YzU1MTU4NDVkMzAgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC1taW5pbWFwLzMuNi4xL0NvbnRyb2wuTWluaU1hcC5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQtbWluaW1hcC8zLjYuMS9Db250cm9sLk1pbmlNYXAuY3NzIi8+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwX2Q5YjUzMmNmNmE4NzRmY2VhZWYyOGM1NTE1ODQ1ZDMwIiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF9kOWI1MzJjZjZhODc0ZmNlYWVmMjhjNTUxNTg0NWQzMCA9IEwubWFwKAogICAgICAgICdtYXBfZDliNTMyY2Y2YTg3NGZjZWFlZjI4YzU1MTU4NDVkMzAnLCB7CiAgICAgICAgY2VudGVyOiBbMzAsIDIwXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNGY0YzJlMDg5YjI4NDY5ZjhjMzgxMTE2OGU2NWE1NGIgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwX2Q5YjUzMmNmNmE4NzRmY2VhZWYyOGM1NTE1ODQ1ZDMwKTsKICAgIAoKICAgICAgICB2YXIgdGlsZV9sYXllcl8xYTBjYzMxZmY1ZTQ0OGQwOWYxNGQyYzI0MGMzZjViMyA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9ICk7CgogICAgICAgIHZhciBtaW5pX21hcF82MDllYWY1YmNjMmE0YmQ1ODY1ZGFjNWI2ZTA4NDgwZiA9IG5ldyBMLkNvbnRyb2wuTWluaU1hcCggdGlsZV9sYXllcl8xYTBjYzMxZmY1ZTQ0OGQwOWYxNGQyYzI0MGMzZjViMywKICAgICAgICAgewogICJhdXRvVG9nZ2xlRGlzcGxheSI6IGZhbHNlLAogICJjZW50ZXJGaXhlZCI6IGZhbHNlLAogICJjb2xsYXBzZWRIZWlnaHQiOiAyNSwKICAiY29sbGFwc2VkV2lkdGgiOiAyNSwKICAiaGVpZ2h0IjogMTUwLAogICJtaW5pbWl6ZWQiOiBmYWxzZSwKICAicG9zaXRpb24iOiAidG9wbGVmdCIsCiAgInRvZ2dsZURpc3BsYXkiOiBmYWxzZSwKICAid2lkdGgiOiAxNTAsCiAgInpvb21BbmltYXRpb24iOiBmYWxzZSwKICAiem9vbUxldmVsRml4ZWQiOiBudWxsLAogICJ6b29tTGV2ZWxPZmZzZXQiOiAtNQp9KTsKICAgICAgICBtYXBfZDliNTMyY2Y2YTg3NGZjZWFlZjI4YzU1MTU4NDVkMzAuYWRkQ29udHJvbChtaW5pX21hcF82MDllYWY1YmNjMmE0YmQ1ODY1ZGFjNWI2ZTA4NDgwZik7CgogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ ],
+ "text/plain": [
+ "<folium.folium.Map at 0x1b624c4b898>"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = folium.Map(location=(30, 20), zoom_start=4)\n",
+ "minimap = MiniMap(position=\"topleft\")\n",
+ "minimap.add_to(m)\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Change the minimap size"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfYTBmZDc3NTc3ZTZmNDliNTgwZTI5MDlmNzNmMjMwMGUgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC1taW5pbWFwLzMuNi4xL0NvbnRyb2wuTWluaU1hcC5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQtbWluaW1hcC8zLjYuMS9Db250cm9sLk1pbmlNYXAuY3NzIi8+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwX2EwZmQ3NzU3N2U2ZjQ5YjU4MGUyOTA5ZjczZjIzMDBlIiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF9hMGZkNzc1NzdlNmY0OWI1ODBlMjkwOWY3M2YyMzAwZSA9IEwubWFwKAogICAgICAgICdtYXBfYTBmZDc3NTc3ZTZmNDliNTgwZTI5MDlmNzNmMjMwMGUnLCB7CiAgICAgICAgY2VudGVyOiBbMzAsIDIwXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNzY5Nzc2YWYzNGFhNGRhYmFjOTdkMTQ2MWZjMDY0MjIgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwX2EwZmQ3NzU3N2U2ZjQ5YjU4MGUyOTA5ZjczZjIzMDBlKTsKICAgIAoKICAgICAgICB2YXIgdGlsZV9sYXllcl9hMTk2MmViN2MyNjk0MzY1ODUyY2FjNTM4YWQ1ODMyZSA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9ICk7CgogICAgICAgIHZhciBtaW5pX21hcF9lNzZlMDk1MjliMDg0ZWE3OGNhZTBlNjE5MGE5OWUyZCA9IG5ldyBMLkNvbnRyb2wuTWluaU1hcCggdGlsZV9sYXllcl9hMTk2MmViN2MyNjk0MzY1ODUyY2FjNTM4YWQ1ODMyZSwKICAgICAgICAgewogICJhdXRvVG9nZ2xlRGlzcGxheSI6IGZhbHNlLAogICJjZW50ZXJGaXhlZCI6IGZhbHNlLAogICJjb2xsYXBzZWRIZWlnaHQiOiAyNSwKICAiY29sbGFwc2VkV2lkdGgiOiAyNSwKICAiaGVpZ2h0IjogMTAwLAogICJtaW5pbWl6ZWQiOiBmYWxzZSwKICAicG9zaXRpb24iOiAiYm90dG9tcmlnaHQiLAogICJ0b2dnbGVEaXNwbGF5IjogZmFsc2UsCiAgIndpZHRoIjogNDAwLAogICJ6b29tQW5pbWF0aW9uIjogZmFsc2UsCiAgInpvb21MZXZlbEZpeGVkIjogbnVsbCwKICAiem9vbUxldmVsT2Zmc2V0IjogLTUKfSk7CiAgICAgICAgbWFwX2EwZmQ3NzU3N2U2ZjQ5YjU4MGUyOTA5ZjczZjIzMDBlLmFkZENvbnRyb2wobWluaV9tYXBfZTc2ZTA5NTI5YjA4NGVhNzhjYWUwZTYxOTBhOTllMmQpOwoKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ ],
+ "text/plain": [
+ "<folium.folium.Map at 0x1b624c56358>"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = folium.Map(location=(30, 20), zoom_start=4)\n",
+ "minimap = MiniMap(width=400, height=100)\n",
+ "minimap.add_to(m)\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Change the zoom offset"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfNTc4NGM3NTQ1MmNjNGJkOWEyMzJiOGYzMzc5MWQ2M2QgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC1taW5pbWFwLzMuNi4xL0NvbnRyb2wuTWluaU1hcC5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQtbWluaW1hcC8zLjYuMS9Db250cm9sLk1pbmlNYXAuY3NzIi8+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwXzU3ODRjNzU0NTJjYzRiZDlhMjMyYjhmMzM3OTFkNjNkIiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF81Nzg0Yzc1NDUyY2M0YmQ5YTIzMmI4ZjMzNzkxZDYzZCA9IEwubWFwKAogICAgICAgICdtYXBfNTc4NGM3NTQ1MmNjNGJkOWEyMzJiOGYzMzc5MWQ2M2QnLCB7CiAgICAgICAgY2VudGVyOiBbMzAsIDIwXSwKICAgICAgICB6b29tOiA4LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfN2M1MDU3MGM2MWQwNDVkOGEyZWI5NTQwYTZkMTFhMTYgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwXzU3ODRjNzU0NTJjYzRiZDlhMjMyYjhmMzM3OTFkNjNkKTsKICAgIAoKICAgICAgICB2YXIgdGlsZV9sYXllcl82NzdlZGY4MjhhMzM0YWRlYjZmZjUzNGUzY2JiYzMwMCA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9ICk7CgogICAgICAgIHZhciBtaW5pX21hcF8xZjU5MTBmN2ZjN2E0YmY4YmQyYmJhMWUxN2FhM2VhOCA9IG5ldyBMLkNvbnRyb2wuTWluaU1hcCggdGlsZV9sYXllcl82NzdlZGY4MjhhMzM0YWRlYjZmZjUzNGUzY2JiYzMwMCwKICAgICAgICAgewogICJhdXRvVG9nZ2xlRGlzcGxheSI6IGZhbHNlLAogICJjZW50ZXJGaXhlZCI6IGZhbHNlLAogICJjb2xsYXBzZWRIZWlnaHQiOiAyNSwKICAiY29sbGFwc2VkV2lkdGgiOiAyNSwKICAiaGVpZ2h0IjogMTUwLAogICJtaW5pbWl6ZWQiOiBmYWxzZSwKICAicG9zaXRpb24iOiAiYm90dG9tcmlnaHQiLAogICJ0b2dnbGVEaXNwbGF5IjogZmFsc2UsCiAgIndpZHRoIjogMTUwLAogICJ6b29tQW5pbWF0aW9uIjogZmFsc2UsCiAgInpvb21MZXZlbEZpeGVkIjogbnVsbCwKICAiem9vbUxldmVsT2Zmc2V0IjogLTgKfSk7CiAgICAgICAgbWFwXzU3ODRjNzU0NTJjYzRiZDlhMjMyYjhmMzM3OTFkNjNkLmFkZENvbnRyb2wobWluaV9tYXBfMWY1OTEwZjdmYzdhNGJmOGJkMmJiYTFlMTdhYTNlYTgpOwoKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ ],
+ "text/plain": [
+ "<folium.folium.Map at 0x1b624c56470>"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "m = folium.Map(location=(30, 20), zoom_start=8)\n",
+ "minimap = MiniMap(zoom_level_offset=-8)\n",
+ "minimap.add_to(m)\n",
+ "m"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.6"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/examples/Plugins.ipynb b/examples/Plugins.ipynb
index 53b45914..3bcbba27 100644
--- a/examples/Plugins.ipynb
+++ b/examples/Plugins.ipynb
@@ -9,7 +9,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
- "0.5.0+114.gd5c3342.dirty\n"
+ "0.6.0+23.g2e3a79e.dirty\n"
]
}
],
@@ -61,10 +61,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfNTMyZDQwZjE1Y2RlNGZmMGI3N2M2ZjdjYjc5MDBlZTQgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICAKICAgICAgICAgICAgICAgIDxzdHlsZT4KICAgICAgICAgICAgICAgICAgICAjc2Nyb2xsX3pvb21fdG9nZ2xlcl85MjU5MjlmNjhiNzY0M2IyOTI3MDdjNDM3MGQ1NzNhZCB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOmFic29sdXRlOwogICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDozNXB4OwogICAgICAgICAgICAgICAgICAgICAgICBib3R0b206MTBweDsKICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OjM1cHg7CiAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6MTBweDsKICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjojZmZmOwogICAgICAgICAgICAgICAgICAgICAgICB0ZXh0LWFsaWduOmNlbnRlcjsKICAgICAgICAgICAgICAgICAgICAgICAgbGluZS1oZWlnaHQ6MzVweDsKICAgICAgICAgICAgICAgICAgICAgICAgdmVydGljYWwtYWxpZ246IG1pZGRsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgPC9zdHlsZT4KICAgICAgICAgICAgCjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwXzUzMmQ0MGYxNWNkZTRmZjBiNzdjNmY3Y2I3OTAwZWU0IiA+PC9kaXY+CiAgICAKICAgICAgICAgICAgPGltZyBpZD0ic2Nyb2xsX3pvb21fdG9nZ2xlcl85MjU5MjlmNjhiNzY0M2IyOTI3MDdjNDM3MGQ1NzNhZCIgYWx0PSJzY3JvbGwiCiAgICAgICAgICAgICAgICAgc3JjPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9pb25pY29ucy8yLjAuMS9wbmcvNTEyL2Fycm93LW1vdmUucG5nIgogICAgICAgICAgICAgICAgIHN0eWxlPSJ6LWluZGV4OiA5OTk5OTkiCiAgICAgICAgICAgICAgICAgb25jbGljaz0ibWFwXzUzMmQ0MGYxNWNkZTRmZjBiNzdjNmY3Y2I3OTAwZWU0LnRvZ2dsZVNjcm9sbCgpIj4KICAgICAgICAgICAgPC9pbWc+CiAgICAgICAgICAgIAo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfNTMyZDQwZjE1Y2RlNGZmMGI3N2M2ZjdjYjc5MDBlZTQgPSBMLm1hcCgKICAgICAgICAnbWFwXzUzMmQ0MGYxNWNkZTRmZjBiNzdjNmY3Y2I3OTAwZWU0JywgewogICAgICAgIGNlbnRlcjogWzQ1LCAzXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NwogICAgICAgIH0pOwoKICAgIAogICAgCiAgICB2YXIgdGlsZV9sYXllcl83OTI2YmUxOWY5Y2M0MmI1YTg4NTI3OTRmMWIyZDk1MCA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIKfSkuYWRkVG8obWFwXzUzMmQ0MGYxNWNkZTRmZjBiNzdjNmY3Y2I3OTAwZWU0KTsKICAgIAogICAgICAgICAgICAgICAgICAgIG1hcF81MzJkNDBmMTVjZGU0ZmYwYjc3YzZmN2NiNzkwMGVlNC5zY3JvbGxFbmFibGVkID0gdHJ1ZTsKCiAgICAgICAgICAgICAgICAgICAgbWFwXzUzMmQ0MGYxNWNkZTRmZjBiNzdjNmY3Y2I3OTAwZWU0LnRvZ2dsZVNjcm9sbCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zY3JvbGxFbmFibGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbEVuYWJsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsV2hlZWxab29tLmRpc2FibGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbEVuYWJsZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zY3JvbGxXaGVlbFpvb20uZW5hYmxlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CgogICAgICAgICAgICAgICAgICAgIG1hcF81MzJkNDBmMTVjZGU0ZmYwYjc3YzZmN2NiNzkwMGVlNC50b2dnbGVTY3JvbGwoKTsKICAgICAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfODIwZmYyM2IwMzYzNGMwNmI5YjFjMGIwYzY5NGI5OTEgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICAKICAgICAgICAgICAgICAgIDxzdHlsZT4KICAgICAgICAgICAgICAgICAgICAjc2Nyb2xsX3pvb21fdG9nZ2xlcl9lNzcyOWI5MzhhMzY0ODY2ODcwODZiODE5MjZlOTk4MiB7CiAgICAgICAgICAgICAgICAgICAgICAgIHBvc2l0aW9uOmFic29sdXRlOwogICAgICAgICAgICAgICAgICAgICAgICB3aWR0aDozNXB4OwogICAgICAgICAgICAgICAgICAgICAgICBib3R0b206MTBweDsKICAgICAgICAgICAgICAgICAgICAgICAgaGVpZ2h0OjM1cHg7CiAgICAgICAgICAgICAgICAgICAgICAgIGxlZnQ6MTBweDsKICAgICAgICAgICAgICAgICAgICAgICAgYmFja2dyb3VuZC1jb2xvcjojZmZmOwogICAgICAgICAgICAgICAgICAgICAgICB0ZXh0LWFsaWduOmNlbnRlcjsKICAgICAgICAgICAgICAgICAgICAgICAgbGluZS1oZWlnaHQ6MzVweDsKICAgICAgICAgICAgICAgICAgICAgICAgdmVydGljYWwtYWxpZ246IG1pZGRsZTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgPC9zdHlsZT4KICAgICAgICAgICAgCjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwXzgyMGZmMjNiMDM2MzRjMDZiOWIxYzBiMGM2OTRiOTkxIiA+PC9kaXY+CiAgICAKICAgICAgICAgICAgPGltZyBpZD0ic2Nyb2xsX3pvb21fdG9nZ2xlcl9lNzcyOWI5MzhhMzY0ODY2ODcwODZiODE5MjZlOTk4MiIgYWx0PSJzY3JvbGwiCiAgICAgICAgICAgICAgICAgc3JjPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9pb25pY29ucy8yLjAuMS9wbmcvNTEyL2Fycm93LW1vdmUucG5nIgogICAgICAgICAgICAgICAgIHN0eWxlPSJ6LWluZGV4OiA5OTk5OTkiCiAgICAgICAgICAgICAgICAgb25jbGljaz0ibWFwXzgyMGZmMjNiMDM2MzRjMDZiOWIxYzBiMGM2OTRiOTkxLnRvZ2dsZVNjcm9sbCgpIj4KICAgICAgICAgICAgPC9pbWc+CiAgICAgICAgICAgIAo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfODIwZmYyM2IwMzYzNGMwNmI5YjFjMGIwYzY5NGI5OTEgPSBMLm1hcCgKICAgICAgICAnbWFwXzgyMGZmMjNiMDM2MzRjMDZiOWIxYzBiMGM2OTRiOTkxJywgewogICAgICAgIGNlbnRlcjogWzQ1LCAzXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNTAwMGNlODBmOWRmNDI4NjgxMzE0ZThiNTk2MTMyOGIgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwXzgyMGZmMjNiMDM2MzRjMDZiOWIxYzBiMGM2OTRiOTkxKTsKICAgIAogICAgICAgICAgICAgICAgICAgIG1hcF84MjBmZjIzYjAzNjM0YzA2YjliMWMwYjBjNjk0Yjk5MS5zY3JvbGxFbmFibGVkID0gdHJ1ZTsKCiAgICAgICAgICAgICAgICAgICAgbWFwXzgyMGZmMjNiMDM2MzRjMDZiOWIxYzBiMGM2OTRiOTkxLnRvZ2dsZVNjcm9sbCA9IGZ1bmN0aW9uKCkgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAodGhpcy5zY3JvbGxFbmFibGVkKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbEVuYWJsZWQgPSBmYWxzZTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoaXMuc2Nyb2xsV2hlZWxab29tLmRpc2FibGUoKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGlzLnNjcm9sbEVuYWJsZWQgPSB0cnVlOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhpcy5zY3JvbGxXaGVlbFpvb20uZW5hYmxlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIH07CgogICAgICAgICAgICAgICAgICAgIG1hcF84MjBmZjIzYjAzNjM0YzA2YjliMWMwYjBjNjk0Yjk5MS50b2dnbGVTY3JvbGwoKTsKICAgICAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bbb05940>"
+ "<folium.folium.Map at 0x1b7d54bbcc0>"
]
},
"execution_count": 3,
@@ -104,10 +104,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfMTYxM2JmMmE1MTc4NDhkNWFkZDFlMTk4Y2JhMzdkZGQgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC5tYXJrZXJjbHVzdGVyLzEuMS4wL2xlYWZsZXQubWFya2VyY2x1c3Rlci5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQubWFya2VyY2x1c3Rlci8xLjEuMC9NYXJrZXJDbHVzdGVyLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9sZWFmbGV0Lm1hcmtlcmNsdXN0ZXIvMS4xLjAvTWFya2VyQ2x1c3Rlci5EZWZhdWx0LmNzcyIvPgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF8xNjEzYmYyYTUxNzg0OGQ1YWRkMWUxOThjYmEzN2RkZCIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfMTYxM2JmMmE1MTc4NDhkNWFkZDFlMTk4Y2JhMzdkZGQgPSBMLm1hcCgKICAgICAgICAnbWFwXzE2MTNiZjJhNTE3ODQ4ZDVhZGQxZTE5OGNiYTM3ZGRkJywgewogICAgICAgIGNlbnRlcjogWzQ1LCAzXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NwogICAgICAgIH0pOwoKICAgIAogICAgCiAgICB2YXIgdGlsZV9sYXllcl81M2E1ZWUwMDlhODg0NWZhYjhiNjkxNjQ4OWJjMmU1OSA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIKfSkuYWRkVG8obWFwXzE2MTNiZjJhNTE3ODQ4ZDVhZGQxZTE5OGNiYTM3ZGRkKTsKICAgIAogICAgICAgICAgICB2YXIgbWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEgPSBMLm1hcmtlckNsdXN0ZXJHcm91cCh7CiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIG1hcF8xNjEzYmYyYTUxNzg0OGQ1YWRkMWUxOThjYmEzN2RkZC5hZGRMYXllcihtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzI3NjljNmFkMDM0MDQ2NzhhOGQxYjliOGFhYjI2MzQ3ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTEuNjM2MzE1Nzg5Nzc0MzM2LCA3LjgxMjQ1MTg3OTU3NDEwOV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzI5NmIyOWNjMjg5MzRjNThiZGUxYjRlM2UyZTVjYzg3ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTkuMzgwNTM2MTk0NjA5NDgsIDI0LjQ3Njg4MDU4NTMwODE5NF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2VkOTcwNDMxNzJlMzQ4NWE4MmIzMDQ4MTU0NTNkNWY2ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTAuOTM1ODgxMDEzMzYyNjUsIDIwLjk1MjU3NTI1MjQ3MTQ5XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfMDA0ODYwMDA0NmNhNGE0NzhkMjY1ZjgyYjQ2OWE4ZjIgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1NC43ODI5MDg2NTM4OTEyMSwgLTguNDU1MDQ4Nzk4ODAyMTkyXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfNWNiZDg3NmFkMzUyNGU3ODlmYTRmNDFkYWU0OTEwMjEgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1Ni4xMzUxMjg3MDIzMTY5OCwgNS4yMzI3Njk1OTUwOTQ5ODJdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8yZWM5N2VhNjhkMDY0NTQ3YWQwY2E3NDEzYmQyMzE5YSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQzLjYzNzIzNTE3OTQyMTIsIDE1LjQ4Njk0MzU3MzMyNzhdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9jNDM5Yzg3ZDk1NDg0N2Q3OTVkYjQ0ZjkwNDNjODkyOCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzUzLjU3OTczMjUyNTM0OTcsIC04LjQ2MzUxMzIxMDQxODA4OV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2QwNjY4MWU0NmJlMjQxNmQ4NzljYzEwOWMwOTVjNGUwID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTUuMjY2OTc1ODU3ODkyNDYsIDI4LjYyNDExMzgxMTcwMzIxOF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2Y5NzM3YWI2YjhlZjQ0MGI5YzlhNTNkNGI2YmRiYjRlID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTIuNjQxMTQ5ODU2NTU1MjQ1LCAyOC4yNzM4NTU0OTIzMzU4ODNdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl84YTAyYmRmYjk0M2U0MGFmOGIzNjcxNGJmMTQ2ZmNhOCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzU5LjQ1ODc2MjMwMzk3MzYzLCAxMi4xNTAxNjgxNjk1MDExMThdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8yZjI0YWIzM2Q2MmU0NmUzYjM4ZTZiZDVlZGE5NmFlMCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQ3LjE5OTUyODU5ODA1MjQ0LCAwLjY5MDg3NjMyMTc3OTE4NThdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl82NzFkNWI1ODMyY2U0OGI4YTMwNjYyZDRmZjdlMzVkMyA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzUzLjI2MzAzMzU3Mjg4MDA5LCA3LjQwMDEwMDY5NDgyNjY1ODZdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8wMWI3N2JlNTU3ZDk0NDE2YWZmNmM5ZjE2ZWVjZWE1YiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM3LjI4NzgyMjkxMzYwNjA4NSwgLTYuODA5NzY5NTc0MjM4MDU5XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfYzJhYjdlZDI5ZjE0NGU1MzlkYTRjN2VlNjdhOGQ1ODggPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFszOS40NjEwNzk0MzQ2MzI4NiwgLTExLjAzNzAyNDM5MTU5ODU0Nl0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzNjMzU3M2NjZDBlYTQ4YzY5Yzg1MDEwNTRlYWE5NGVlID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTcuMjQ1NTkyMzY1ODE3NDQ0LCA3LjU2MzgwODI4MzIwMzY0OV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzY2MWU0NDNlNDhkYzQwNTE5NTBjYjQ3OTcxMzJmODI3ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTYuODIwNzI2Njc4MDA2MDA0LCAyNC4wMDc1ODU4OTg3NDM3MjddLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9iMjY3YTkzN2VjYTA0OGU3YmE2OGEzZTc0ZDhkNDc0OCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzUzLjE4NzA3MTc0MjU3MSwgLTIuMDk4MTE2ODMwMTU0NDYxN10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzIzOGZmYzFlNTE2NTQ4OTFiNmZjNjE2OGFiMmRiODVkID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMzkuMDI2MjYwNjUxNDMzNzcsIC0xLjk0MjQ5NTUxNzI4NjUwMDhdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl81NDBhZTM1YzQ4MjU0MGY0ODUzYjVmMzU4ZDMxMzYzNiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQ3LjA5NzM3NzY2NTg5MDUzNCwgLTkuOTUwODQyNzQ5NTM0ODM3XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfMWRlM2ExOWMzN2EyNDkyODg4NzBlMzZhOWZiOTI0NWYgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0MS40MjY1NTMxMjU1MDQzMDYsIDcuNjI3OTY0Njg3ODY5ODg4XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfMDgxNDJiYThmNGE0NDQ5NWI5YzU5NWRjZDU1OWQyNWUgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFszNy4xNDg1NzY4Nzc4NzUxNCwgNS43NjQzNzU1MjU4NjMyNjldLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9jZDM0YmZmMWVmMzE0M2Y4YTE1ZjRhYTYzOTVkMzRiNyA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM5LjcxMjkwMDc5NjE0NTg3NCwgLTExLjIyODUwNjc2NDMzOTI2Ml0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzdlOWRkZmE1MTA3NDRjOGE4MWZkMzNhZmM0Y2Y0NjdhID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMzYuODgwNTU0MTg1MDk5MTg2LCAyNS44NDUyODI5OTE2OTM3N10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzA0NTA2YjBjNGFjZTRkYzBhMzQ5ZGU3YWVkNTc1N2JmID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMzguODUzOTM3NDAwNDk4NTQ1LCA1LjEzNjM2MjQ4OTI2MTcwM10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzRjYWU1OThjNzY0MzRlMmFhZmY1MDk1NDlhYWY0Yzg2ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTEuNDcyODk1Mzc2NjA2NzYsIC03Ljc0MjQ1MzkwOTUwNjE3OF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2E4ZGRjMmM3ZTg4OTQ5OTg5YzliNTQyNWNjMTQwZmIxID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMzguNjIxODk0ODYyNjM0NTEsIDMuOTE0MjQzMDA1MzcyNDczXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfMGVhODY0YmRmNTdlNGE1ZWIyOTYyMDUxZGQzMjVkNTMgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0My4yMzgyNzU2ODQ3NTQsIC01LjU4MDk4NjkwMTE4M10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzdhZDI3NGE0YzczZTQ1ODliYjMxOGZlNmNmMjQyNTUzID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDYuNTE4MjAxMjk4NDYzODE1LCAtOC45MTk2NjU0MDY2ODk4MDZdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl84YmQyMmJhMTQ2N2Y0NGJkOGZiOTM5OGUwYmRjZTk0MSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQyLjA0ODM2Njk2Mzc5MTc1LCAxNC4yODA0MTkwOTIzNzYxOTZdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9mODQ3ZmMyNGE0MmU0NzFkOGUyMTM0ZTFkOWUxODhhYSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM2LjQxOTUyNzY0MDQzOTI0LCAwLjYyNjQyODA5NjMyMTkwMjJdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl81NGZiMmQ4ZjA3ODI0NDlmOGE0OGYzNTU3ZjQxNmUzMiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQ5LjYwMTgwNzcwNDAzNDExLCAtMTEuMTY0MzEyMjcxNzY5MDE3XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfNDg4NmM2ZDBhNTExNDMyM2E2YmUxMTUzZmIyNzk2YTYgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFszNy4wMzAzOTk5NDIxMDI2NCwgMC4zMjMwNTUwMDU5NDEyMDMyXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfOGJjNDBmYjdlNTZjNGUyN2IzNGMyNjkwM2Q0MGVlMjkgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1NC43Mzk5NzY5MzQ4NjkwNiwgMjYuNTIyNTgzODAzODQ1MTM3XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfZGM0OTM5ZTZlYjM0NGE5MmE1ODUwMzcyOWU5ZTU2NmEgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0MS42MTMzMTQzMzY1NTQ1OTUsIC0wLjMwNDk2Mzg2MjAxNDc0M10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzU1ZjdhOWJmY2FjMzQxYTliMWZmZDNiOTJkZjEzNjFjID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDUuMzYyODQ1ODM0ODM2MjYsIDE0Ljk3OTAzNTAwNzEzNTQyNl0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzA0OTQzZmNmZDk5MDQyZDBiYWE0ODcyY2VhMzEwOGQ4ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTEuNzg1MzQ4MzA2MDA0MDMsIC0wLjMyMjkzMDQ5MjMwOTYxNDhdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8yY2QzNTdhMTMxZjY0M2RjYTA2OWMwOGI4ODU5NzgwYyA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQxLjM2NjY4NTEyMTAwODMsIDAuMTIzNTkxNTYwMTUyMzg3ODFdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl81NzhiNTUyYjk4YjQ0MWJkOTUzN2M3MTI0NjU2YmMwMyA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM2LjQxNzA2OTMyOTc5MzYxLCAtMTAuNjgxMDU2MjYzMDA4MzEyXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfMDA1NGFmYWJmNjllNDEzZDhhYmIzY2FhMmE4ODYwNmMgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1NS4yNTY4Njg0ODI2NjgzNzQsIDcuMzczMjMxNzc2NjAyMjE0XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfNGY0MzU1MTcxZjA2NDk1MWJmNzhiODYyNWU0NzQxOTYgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0Ny44Njk0Njg0MDQxMTU4NjQsIDE2LjA0MzkwNjYwNTU5OTgxXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfYzE0ODdiYTdjY2Q2NDYzMWEzODcxNDA2YmEwYWZiNjUgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1Ny44Mjk1MzU2OTczOTk3OSwgOS4xNTIxNTI1Njc0OTQ4NDldLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl85NmIzMzM0YzI1YjA0MzQxOTlmOGU2YWQ0NTllZjk1NSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQwLjYwNDE2NDc1NTEyMzUwNiwgLTMuMzQxNTE3Mzg0NTMxODMyXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfYjJhZjg4NTdkNzM3NDZmYzk4N2E5N2IzZWJjOGYxYTkgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1My4xNTIyMTgzNzQ0NDk4MSwgMTAuMDIxMzgwMTU0MjA4OTUyXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfNTk3NDk1MzczNzc4NGM2M2FkNDc4MzY2M2VkNWFjMzQgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFszNi45MjMxNDk4NTc2NDczNzQsIDE3LjIyNTc2Mzc2MTU5MzMwNl0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzY4N2VhZjNlMWQwMzRmMGI4MzNhM2RiMDI4Zjg5NWZhID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTguMjcwMjkxMTU1NzUxMzgsIDE3LjA5NzMwOTUzMTg3Mzk4XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfYWRlNGNmODVhZjIwNDhlN2E3OTA5OTU2NjhjOGY3NzAgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1Ni4yNjMxMzU5MjIxMDA5ODYsIDI2LjA0MjAxNzc1NzM0ODc3M10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzc1MmZkODllOWQ1YTRmMGQ5ZTNhZDZkMzJmYTI1NGFkID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTMuNDgyOTIxMzc5NjczOTYsIDE3Ljk1MDIwMzA2OTMzNzY5N10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzkwNDdhOWU4ZjY0MDQwYWJiYTc4MGI0MzlmZTgxZTAzID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTguNjgwNzYyNjI3MzUzMjYsIDIxLjA4NjU5Nzc4OTI2OTU0N10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzMxZTY4YzUwNjQzNzQyNzk5ZGM5Yjg0MjI1NWYwMWY1ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTcuMTYwMDYxOTUxNDg1NDMsIDEyLjAwNTIwNjEzNzkwNzczNF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2Q0YjU3YmZiY2ViMzRjYTBhMTdlM2FiNmI4ZTU0N2Y0ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTYuNTE0MDMwMTc4ODM0MjUsIDQuMTA5MjE4NDEzMzc1MDI1XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfZjlhMjRjN2ZlMTVhNGM4Njk1OGM0ZGYyZDk0YTJkMTUgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1Mi43MTYwMjM5ODM4ODYzOSwgMy44NjQ1MDk3NTMxODExOTJdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl84ZjJjNTRhNmIxZTg0ODJjOWE4OGRjOTIxY2EyOWUzYyA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQwLjI0Nzg3MDMzMjY0Njg3LCAxOS4zNTkyMDYxMzg2MzMxNF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzIwYWRlZmMyNmQ2NDQyMzNiMWYxZGM1MzI3MzBkOTI3ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDYuNDE0NTA2NjM1OTg0OTQsIDQuOTQ3MzEwNTQyMzI3NTA3XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfMmZjY2IxY2UwYzZhNDY1ZGEwOTJjM2I4MWMzYzQ0ZDYgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0Ny42NDQzNDg1MDgxNTg2NywgLTQuNDAxNTY1MzQ0OTE2OTcxXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfNjZmZDk3MjNmOGE5NGMzYzlkNmVhZmY1YjZmYTYxOWUgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0NC4wNjI0ODU4NTQwMTM0MiwgOC42NjgzNzM3ODQ5NjMwMjddLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl85OTk0YmZkODM1MmI0NzU5OWNmMDQ3Yzk0YmM3N2M1OSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzU5LjU1NDcxNTczNjUwNTc3LCAtOS4wOTg4Mjg5NTgzNDI4MDNdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl80OTI2YTk2NmIzMDQ0MjEwOTIzYTA5OTQxN2Y1OWIzYiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM2Ljg2Mjk4ODk2NTYwMzcyLCAwLjg5OTAyOTA1MjQ0MzE1NzldLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9mZjJjMzZjNjljNWY0M2VkYmQzYWYzMTUxZWEwNmU1YSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM5LjcxOTAwNTg1MzM2MzAxNSwgMTQuNjI4NjI2Mzk0Mzg0MjQxXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfNTQ5MTkwOWUwNTJkNGExNjliMDkzNjMzNGE5Y2JmMWQgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1MS4wMTc4OTgxMzU4NjE0NSwgMjcuMDM0MzM1MjQ1NTQ0NDgzXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfYmRmNzk2N2I3OGNjNDUxMDlhODVmNDQ1OGFlMDc5NWMgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0MC4zOTIzNDE0NDI4MjcxOSwgMS45OTA1NjM2NjM0MzYwMTUzXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfMzgwNTgwOTYzZmVlNDc0N2ExNmFiMmI5ZjZkNTkxYzQgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFszNy4wODMxMTAyMjIwOTEwOSwgMjYuNzg0MjQzMjQ3NjYwNDddLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8yZTNkNmYwMDlhOWM0Y2JiOWYwYmJmNGM3NGE3YjgwNCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzU3Ljc4MDQ1OTg1ODMyNDk5NiwgLTIuMjQ3NDk1MjM2MjEzODg2NV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzM5OGM2MDM1MzBkNDRkZDg5YmQxZjNhNzNmYmVjNDNmID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTYuMDcwMzM4MjM1NjYwMDk1LCAxLjg2NjMwNzg3NjE5OTU3OTVdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9hZTYzY2IyYjQ0NGY0YWRmYTU3OGVlOTMxMGJlNjdiNCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM2Ljk5NzcxMTA0MDI3MjM3LCAyMi42MzU2NzI2MzQ1MDk5ODddLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9jYjRjN2M4MGQ2OTQ0YTZmYTdiMTczY2VlMDNlOGEwZiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQ2LjEyMjA2NzM1NjE4NTIsIDEzLjcxNzE4NjU1Nzg2OTE5OF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzQ4YmViNDVhOTg1YzRlMTA5NTJhMjQ3NWZlZDUxOWQ2ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDguMzI2MDY1MDQ4NzY2MjIsIDE4LjcwODU2MTYwODUxMTI2OF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2I0OTE4ZDMyNGJhYTQ1ZjE5OTkzZTJhMWUyNTZiYjcwID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDcuMTc2OTQ3NDIwNjM4NzI2LCAwLjQwNDE2MzE3NDQyNzk0OTldLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8yODhhYjZkYzVhMTE0ZTY0OTNlNDUzYjg2YzVlM2QxZiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQ1Ljc4MjI3Mzc1MjczMzg3LCAtMi43NzIxNzY1NjYxNjY3MV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2FjMTNlM2VjYWJkNDQ0YzQ5OWRiNmFmOGY3NDhkNDliID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDUuNjY5MDY2NjQ2NjEwMzU0LCAyMi40MzczNTIyMDk3Njk3OV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzUzZmNhOWNiYzRmODQ1N2NhNjQ5YzY0OGQxNmIxOTQxID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMzcuNjI5OTM5NzY4OTA4NjksIDI5LjI3NTE0MTY3MzQ3MjIwNl0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzY2NWYxYWQxNzE2NzRhZjVhNTZhMjM3MmY5ZDExMWFiID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTYuNzA5MTE1ODgwMjQ2NTIsIDIzLjMzNzg2MzI4NDA0NDU2Nl0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzEzMDc5YjhkNzBkMTQ3YzViY2E4MDJjMWRiMjc0ODljID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDguODYwMjg3NTc4NzU3OTc2LCAtNy40MTU4NDA5NjM3ODgwNTA1XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfZTBlNWFkMzY3ZTg4NDNjNTk2ZmQ0MTEzNTcyYTVmZWIgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1Ny40NjU0MjQ2MTEwNjMsIC0xMS4xNDcwMDk3ODk1MzYxMV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2UwOTJlZTRmMmY5YjQzMzNhMmIwYjEyYzBlNmE3ZTVlID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTAuMDkwNjA3OTQyNjYwODc0LCAxOC42MzkzNTEwNzkxNzU3NjRdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8zOWMxYjYxN2E0Mjg0NDVlOWNkODAwMTRiZDc2MWY4ZCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzUyLjIyNTA1OTY1MDU2NDMsIC02LjQ5MjEwMDAxMTU5NzM5OV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzQ3NGVlNjRlZWIwYzQzODNiYTI5ZGI3ZmRjY2Q4ZmVkID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDYuMjI1NDEwNjgwMTMwODEsIDE4LjI0NDI3NTQ4ODE2NjM5NF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzBiMTQ0N2I2N2YxYzRjNTFiN2Y1YjEwYjgzNzM2OGJjID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDAuNjk4NzIyNTY2MjEwNTU2LCAzLjA5NzAxMjc0NTE1NTI4MjddLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl82MTJlMzY2NjZmYzY0N2JiOWJiZmNkZmQzMzY5MDJhNyA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM3LjI4NjYwOTU0MDAzMTI3LCAtOC43Njk3OTc4Njc5ODA1MThdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8yMjMwNDc4NjgzNDU0NjNjOTk4MmFjOTljODg0ZWVlNiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQxLjc4NzAzMzA1OTIzMzE3LCAtOC41OTM0NjU1ODAxMDc1NTVdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl81ZWQ0YWNiNjBmZWY0Y2VhOWNjNWQxZGQ2Y2JhOTcyYyA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQwLjg1NDEzNjUzOTU1OSwgMTcuMjcxMzM3NjY3NjA2OTddLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9lOWEwNjNiMjQ1ZTU0OWIxOGJmMmJjNzFkNTgyY2ViYiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM5Ljk1MDg3Njc1Mzc3MzQyLCAxOS4xNTA2NjEyNDcwMzldLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl84OTRjNTQ5NTViMTg0NDEwYjI2M2EzNGIwODU0OTU0MSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzU0LjQ1OTMwMjkzMjM2OTIsIDI2Ljc1MDA1OTc2MjM4MTcxN10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzNiMjQ0NTA4YjI2MjQ2NmE5NGU0YTE3NzNiYjc2YjY4ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMzkuODc2NjM0NjA0NDA5OTMsIDguODA0MDA4MTQ2NjYzNDc0XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfYTcxMGRmMjAyYzdjNDk5ZWI3YjM1ZjYxYjFhNjY5MzQgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0NC4xMzEzOTM5NDcyNzY1MSwgLTIuNTMwMzcwNTE4NDE5NDY1XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfMjI4NjI4Y2Y1YTMwNDc1NTliNWJhMmNmMDg2M2E0NjcgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFszOS4wNzI0ODQ5OTIzODA1MjQsIDE5LjA2ODMwNTIwMTY5ODMzN10sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzQ4ODZjNTY1YzAwOTRhNGJhMDlmZTQ0ZDIyNzNlMzk0ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTQuOTYzMTQ1NTU3MDUxOCwgMTkuNDA2MzkyNzAwOTg5MDE2XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfZTAwZDgwYjA0YzkyNDI3NGFkZTI3ZjFlMzI0ZDM3MzggPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0Mi42OTcxNDY4NzUxMjUzNiwgNC4yNjI3ODUyMTAzMTc2ODhdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl81ZDBkNWJmNzM5OGM0OTRjOGU0YjY2NDc5M2U2ZWUzNSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzM5Ljk2NTkxOTYxNTg1NDIyLCAtMTEuNDM0NTQwMTkxOTAzNTEyXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfYTI2YmU2ODIzMWRlNDY1ZThhMWRkZDRhNGVmOGU0N2QgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs1Ny41MDk1MDYzMDc0OTk2MiwgMTguMjIzMDI4MjcxNjU5NjhdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl82MTdiNmQ3OGRlNTU0MjVjOTZjNmZlMjI2MjkzYjA3NCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQ4LjkyNTIzODkwMDI4NTk3NiwgLTEwLjEyMDc2NjQ5ODU2NDI4Nl0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2Q1MmQ5NDYzZDM0ODQxZmE4ZjRiNWU2ODlmODE1MTUzID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMzguNDM3MjMwNzI3ODEwMzMsIC0xLjU1MTI4ODg3NzE1MTAzNThdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl83ZjBlNDg0NzI5N2U0NDU3YTBhZmViNzIyZTljOTNlZCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQzLjYyNDYxMDA1NDcyNTE0LCA4LjcyOTQ2MDYxNDA1MTkzNF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2FmYjZiYTc1NzMxMzQ4MjdhNDQxZTJiYTNmZTVlOTdkID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNTkuOTczNjY5NTkyMDE3OTksIDE5LjUzMDc5NTU0OTA2MDA1XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfZWZlYzAxMWY4NWJkNDg5NWJkN2VlNjEyYjNlMzAyNGMgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0My45NDU4ODY5OTU3MTA0NywgLTAuMDI4MTM2ODU4NzY3MTEyNDddLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl9mM2MwNmEyNzBkZGQ0Mzk4YmM5NmVlYzY5YzYwNTczYiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzU3LjE3NTg5MzA3NDE5MTU1LCA3LjE3NjY2NjYyODg5NzA4OF0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2M3Zjk4M2JlNGZiYTQ0MDFiMzk4MTI1MWEyYjFlNmEwID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMzcuNDUxMjQxMDMxNDc4MjYsIC0wLjE1MzE5NzEzMzMwNTQyOTRdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl82M2Q3YTJlZTViYTE0YTdjYmU1YTYzZDNjNzZiZDQ0ZSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzQ1Ljc1OTg2MzYzNTIyOTA4LCAtMS40NDkyNTQwMjY0NjYyNjAxXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfZDEyMjI4NjU2NTQ0NDdiMzg5ZTgxNjA5N2FhN2I3ZjMgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFs0OS4wOTU4NzU1NDYyMzczLCAtNi4zMTc5NDEyMjI5OTQxMTFdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFya2VyX2NsdXN0ZXJfNjRiODJmYjQ2NGZkNGQ1ZThmMmYwMzkyOWRlOGY4ZGEpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8yYTU1YjcyYzRjYTE0MDJkYTk4MmQ4ODFiOWMwZjM1MSA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzU5LjMyNzMwNjczOTEwOTA2LCA1LjI3NjY4MzQyODU0NDk0OV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhtYXJrZXJfY2x1c3Rlcl82NGI4MmZiNDY0ZmQ0ZDVlOGYyZjAzOTI5ZGU4ZjhkYSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzM1NWU4M2JmYjM5MTQ2N2M5MjJlY2NkY2ZmMTI4MDczID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDUuMzIzNjMxMzYxOTg4NDA0LCAtMS4yMDQyNDc1MDk2MDg0MDc1XSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzY0YjgyZmI0NjRmZDRkNWU4ZjJmMDM5MjlkZThmOGRhKTsKICAgICAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfYWRlNGY0ODBmNTk2NDYxYzk0ZjJiYTM1Y2JmMDgzNTYgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC5tYXJrZXJjbHVzdGVyLzEuMS4wL2xlYWZsZXQubWFya2VyY2x1c3Rlci5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQubWFya2VyY2x1c3Rlci8xLjEuMC9NYXJrZXJDbHVzdGVyLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9sZWFmbGV0Lm1hcmtlcmNsdXN0ZXIvMS4xLjAvTWFya2VyQ2x1c3Rlci5EZWZhdWx0LmNzcyIvPgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF9hZGU0ZjQ4MGY1OTY0NjFjOTRmMmJhMzVjYmYwODM1NiIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfYWRlNGY0ODBmNTk2NDYxYzk0ZjJiYTM1Y2JmMDgzNTYgPSBMLm1hcCgKICAgICAgICAnbWFwX2FkZTRmNDgwZjU5NjQ2MWM5NGYyYmEzNWNiZjA4MzU2JywgewogICAgICAgIGNlbnRlcjogWzQ1LCAzXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfOGVhZmFmMGNmYzg2NDViOWEwOGY2YjhhMmI3YzJlZDYgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwX2FkZTRmNDgwZjU5NjQ2MWM5NGYyYmEzNWNiZjA4MzU2KTsKICAgIAogICAgICAgICAgICB2YXIgbWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcgPSBMLm1hcmtlckNsdXN0ZXJHcm91cCh7fSk7CiAgICAgICAgICAgIG1hcF9hZGU0ZjQ4MGY1OTY0NjFjOTRmMmJhMzVjYmYwODM1Ni5hZGRMYXllcihtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9kMGExYTE5YWYzNjQ0OGJkYmI5N2M4NDBlMDU3NDIxNCA9IEwubWFya2VyKAogICAgICAgICAgICBbNTguMjk1NjQ0NjkwMzk3NDI0LCAtMTEuNTMzMTkxNjU3Njg4Mzk3XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzBjZWVjYjJlMjMwYTRhYWRiN2E2MjQwOWVlMDUxOTliID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1Mi4zMzI1MjEyNTI2ODgyMywgMy44MDEzNzE5OTM3MjI3ODcyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzkzMjE4Nzc3ZjZkNzQ4MTlhOTVlZDJmZDY4ZDUyNTNmID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1MC41MDMyMDYxMjQzNTkwOTYsIDE1LjY5ODAwODU1NTYzNDg1XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzI2NTVmZjU1ZTQ0NzQyMTBiYjVhY2U0MTMxMmYzNTJmID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0MS4zNDk3OTE0OTUwNDYwNSwgMTMuODQ0MzY1MzMzMTYyNTUzXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2M3Y2VhZmYxOTc3MTQ0NTQ5ZTA4MDI3YjYzNDdjNjk4ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFszNy4zNzIxNTU0MTMwNjc4NCwgMS40MTQyNTIyMzk4ODQxOTJdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfN2FjOTdiZmZjNjkyNGQ0M2E0N2ViMGI5MzQxOWRiZDEgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM5LjMwMjA3MDYwMDg3NDU2NSwgLTkuMDU1MTQ1MzgyNTAwNjNdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfMWQ5MGRhMzEyYTExNDJjZDk1YTZjZjBlNjFhZjJkYmEgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzQ3Ljk2ODg4NDE3OTgxMjM1NiwgLTQuNjczMjE0MTg5ODM4ODk3XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2M0OWEyOGZlYWQwZDQxOWFiZTRkNDgwYTlhOGM1ZTUwID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFszOC44NTMwNTA0NDU1NTE3OCwgOC42NjIxNzc0MjY4MzAxMl0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9iMzQ4YmM3OGRiZDY0OTc1YTZlNzdmY2EyZDYwOTEzMiA9IEwubWFya2VyKAogICAgICAgICAgICBbNTUuMzkzNjM4Mzg3ODU5MzEsIDExLjgyNTA5MzAyMjA4MTEwNl0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9jODQ2ZGFkMmM4ODM0ZmEzODI1ZGI4ODY3OTFmNWJmYiA9IEwubWFya2VyKAogICAgICAgICAgICBbNTAuMTI5NTAxMTMyNjExNDk1LCAtMC40MDYzODI4MjU4MDcxOTIyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzM0MGQ0NmNlYjgzNDQ2NjQ5NWJlYzc2YmFjMDgwZDU1ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0MS44Mjg3Njk5Mjc3ODc1NSwgMTguNjY3NzE3MzQ5MzIwNzhdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfNzViYWU1NjhkMTM4NGQ2MGI2NTc0NTRiNDQ4NjNjNjkgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzQ3LjQ4NjE0NDUzODc3NTEyLCAxMC43NDQzNTU5NTYyMjM5NzddLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfODEyZWIzZmIxNGNkNDdiN2I0Mjg5MGRmNThmY2I5M2IgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzQ2Ljg1NTI1NzI4ODIxMTY2LCAxNS42MzUzODQxMjEzMjE0NzZdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfNzQ3YmVlZWFkNDE5NGFjMzg5N2EyZWFjMzkwNWEwZWYgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM3LjQ5NjM4NzgwNjYxMzEsIDE0LjAxNjM1NjkzMTcwNTMzNV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8wMmVkZGM2ZTczMjE0YzMxOWVjMmRhMDM3MjgyNDA5NSA9IEwubWFya2VyKAogICAgICAgICAgICBbNDEuMjczNTg4Njg2ODkzMDksIC00LjUwMTU2NjM0ODMwMzY3MV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9hNzI3YjAxY2ZiMzc0NTQyOWYyZGJkMWU5NjlkZjliNyA9IEwubWFya2VyKAogICAgICAgICAgICBbNDAuNzYwOTUxNzQzODM1MDQ0LCAyNy4wNzc5MDU5NjkwNzY5NzNdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfZGM1NDRjM2FjNzRmNGI2ZWExODU1ODE5NmE2NDM3MDEgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzQ1LjY4NDEwMTIyMTcwNzIxLCAtMi42ODAyMDY1MzIwMDQxNDA0XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzI5YTkzODA5YWJkODRlYThiZDBjZTU1YmNmZDdiODA5ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1NC41Nzg4NTE0OTEyMDAyMjYsIDIuNjE1Nzk0MDM1NzY5NzI4XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzRjYzFiZWM0NGM4NDQxODRhMDNjMTZjNDZmMDY2MTNmID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0Mi4wNjM1MzYxNTIzMzQ0NywgMTAuMjA4MzM3NjM2Mjk4NDk1XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzNkYTI1NWI1YzVkMzRkN2RhZWM5ZDA5ODY3MTU5NGVjID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0MC4yNjUxODczMDIyNTk5NCwgLTUuNTMyNzc1MzY2MDYzMjVdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfMGUyMmEzZjg4ZjEwNGY4ZGJiYTI4NWE5MGE4YmE1MWIgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzQyLjkxNTk0MTQ1MDYwNTcsIDE4Ljg5NzAxNjc5Mzc5MTAyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2UxOTRhZTFkMTdiMjQ4OGQ5ODBmMWNhYWFlNTZmNjY1ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFszNi41NDU3MTcxMTAwNzI3NSwgLTExLjI1NjM3NTA4Mzk1NjYzMl0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9iZWI2ZTNhMzljOGQ0OTgxOTJhOWJkMzQ2MjczNjZkNSA9IEwubWFya2VyKAogICAgICAgICAgICBbMzYuODIxMjQ3ODk2MTQ3NDI2LCAtOS40ODYyNjIyNzk3OTM5OV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl82ZWU4Y2Q3NDc4ODA0M2ZhYWQxMTM4NDJkYjQxNzkzMCA9IEwubWFya2VyKAogICAgICAgICAgICBbNDYuNjE2Njk3NzY5OTI2MjIsIDI0Ljg0MTIyNTMyMjMyMjkwNl0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl84MWMyZTRhZjE1ZmQ0YTg0OGU2OTllY2RhZTI1YzJmOCA9IEwubWFya2VyKAogICAgICAgICAgICBbMzUuNjI1MzcwMDkwNzgzNjYsIDE4LjA4MDMyNzAyNjYxODA4Ml0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9lMzhkNDFiYmM1ZjQ0NjFkOGE4MmE5YjllMWQ4N2M2ZSA9IEwubWFya2VyKAogICAgICAgICAgICBbNTAuMzQ2MjkyNTg1MjY3Mjg1LCAwLjA2NTAxNTE0OTkxNjM4OTM1XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2ZhOWI1YmIzZDQwNDQ1NzlhN2NkNDUwYjJjYzUyZTUxID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0NS4wNTk5MjA3NTc5OTQ3OCwgMjYuNDY3NzYyNzkxMzA0OTg1XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2I5NmNhMTkyMGQ1YzQ0MzE4ZWZlMDA3YjUxMTg3YTAxID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0Ny4wMzA1ODU2MTcyMzIyNywgLTQuMDEzNzcwODczNzMzNTk0XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzUwMmE3OTIzMGRkNDQ4YTE5MWU0OTA3OGZiM2YzNzA3ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0NC4xNDczNjQyMjY3ODUwMiwgMTguODQzNDYyNTQxMjc2NjE1XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2M4ZmZkYTEyODg5MjQ2YTU5YmRiN2ZmZmQxZjY3ZGNhID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFszNi4zMTIzMzc5MjE2Mjg4NDYsIDI1LjUxOTk0OTI5MDI5MjM4XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2E4ZDhhODU5ODkwZTQ0YjQ4ZjAzMzIwNjhhMzkzZWE0ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0OC45NzEwOTk5MjQwNzg5LCAyNC4yMjMzNDI1MDk3NzE0NjNdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfNWZhNTdmZGYzNmQxNGRiYjhiOWVmOWNmZGE1OTkyYmIgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM2LjA3NjQ3MzY2NjY5Mzg4LCAyNi4wMzIzMzU0MzYyMzc0MDNdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfY2I3ZDNmMGMwZTIxNGViN2JlYTMzZWRmMzAwZTE5YWIgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM1Ljk3OTkxMTY1MDI1Njg0LCAyMS43NzcxMDk1Njg0MjU1MjNdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfY2YxM2I0ZDZhNmYxNDQxMmFhYjEzY2E3NDAwMmQwZTUgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUwLjY4NjY1MzM1NDY3NTQ4NSwgMC41NTgxMjQzMTg1NTE2OTI5XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzljNDhmMWUxMzAyMzRkMTZiNjZjNmU1NTlhMDVmMTBkID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0NS40NzA2NTY5MDg0NDIwMjQsIC0xMS4yMDU2MzE4OTU2MzA0MTVdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfYjA2MTgxNTM2MzlkNDM3MDkzYjEyYWYwMDg4ZTAxZmYgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUyLjA1NDgyMjMwNDM1NjU4LCAyNS4yOTQwNjI1MDkxODQ5NF0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8wYzFiOWViN2Y1YzQ0M2M2YjRhMTY1MjllMmYxNzgzNSA9IEwubWFya2VyKAogICAgICAgICAgICBbMzkuNjE1NDA5OTUzMDMyOTIsIDE5LjE4MjQ5NTE0ODI0NjQ5Ml0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl82YTIzNDlhZGI4MTg0ZTAzOTI4NTJmYzVkMjhmODI3ZSA9IEwubWFya2VyKAogICAgICAgICAgICBbNDQuNTIxNTI1NDc2NjQyOTIsIDQuNTMyMzc5MzE0NzYxODcyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzQ1ZTRjMjhjOGMxNzQzYjQ5MGYzNGI3ODFjYzcyYTkyID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0OS4wMjkxMTY3NjMwMDg0NzQsIDI4LjA4NDkyNTgwNjE0NzI5N10sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl85MzYyODE1NDVlNjg0NWY4OGRlZmIzZmUxMGM0NmM3MiA9IEwubWFya2VyKAogICAgICAgICAgICBbNDYuNDkzNzk3MzIyNDY3NjQsIDIxLjYxMDcxNzU3MjE1MDcxMl0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8zYjJiNWY3MzIyYzQ0ZTkxYWM0MGNkMTFkY2JlZDdkYyA9IEwubWFya2VyKAogICAgICAgICAgICBbNDQuMjg0MTc0NzcwOTgwMDEsIDI1LjQ1MTc4NDAyOTg3MTc4XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzA4ZTZjMzcxYzIzYTQ3OGU4ODUxZmQwODQ0M2QyZDFjID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1OS44Mzc5MTAwNTYxNTkwNDYsIDIzLjQ4NzY4Mjk1MjI0NTk5N10sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl82YThiM2E5NjdmNDE0MzIwOGFkMTgzODExN2YzNTM2NiA9IEwubWFya2VyKAogICAgICAgICAgICBbMzguNzI5Nzg3MTU0NTUzOTMsIDI5LjI1NzA5MjE1ODY1MzM5M10sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8wMDZiNGM3OTEzNzk0NjRkOGMzNmVlZjQzYmJlZTA1NyA9IEwubWFya2VyKAogICAgICAgICAgICBbNDMuNDIzODc3MDc5ODI5MDgsIDguNTkxNjI1NzI3NjEyNDFdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfM2VlODdlNzEzMDU5NDkxOTkyYTQ3MDI5ZjhjNmQ1N2IgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzU0Ljc2NzA5MDIxMzA1MDg1LCAxNC4wMzk3NDg1NjQ4MzM1MV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8yOWZjZmU3NTFiYWM0NDU2YjgzMjA1YTlkNzllOWNhZCA9IEwubWFya2VyKAogICAgICAgICAgICBbNTMuODQzNDQ1NTU3MTczOTgsIC01Ljg0MDI5OTQxMjE2NzAwOV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8zY2RmZmU4YjBhMWM0YTQ1OGE1YTYxYjY5NTE0MDFlZCA9IEwubWFya2VyKAogICAgICAgICAgICBbMzYuMTE3MTQxNzM3MTkwMjgsIDEzLjIzMDQzNDQ0MzMxNTkwN10sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl84N2JkOWMxZDdkODU0ZjRlYmU5ZmZlYjFlZmFkYjEwZSA9IEwubWFya2VyKAogICAgICAgICAgICBbNTkuMDM0MDcxNTE5NzE5MTU2LCAtNS4yNzE1NDc2Njk4NzUwMjVdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfZTFkNWEwZGEwYjUxNDRlNTkzZWJhOGVhOTY5MjFiNzcgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM1LjI5MTYzMTU0MzYxNDUzNSwgNC40NDA5MzA2ODU0NDg1NjddLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfYzMyMzJhYmVkZmQzNDhhYmE0NmMzZjEwMDBhNzdhMmQgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM4LjI2NDI2ODAxMTE0OTk2NiwgMTguNzA0NjYwNDU5ODgyMjEzXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzFlOTA5N2JkNjJmNTQ3NzA5YThjOTVlZDZiOTJkNjQ1ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0NC40MDk1NjQ2MzY5NzI4NDYsIC04LjM1NjA5MzYyNDAzMjQ0NV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9kYmExMjhiZTc5ODM0ZmQ0YWVmOTk2OWQ0ODQ2YWM3OCA9IEwubWFya2VyKAogICAgICAgICAgICBbNDQuMTAwMDkzNDk4MTc0OTgsIDE3Ljc5MDc5MzIwOTk3OTY4XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2YwNzhkYTMwZDcwNjQwM2JiMmE3ODBjYTBlNzM1MDAwID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0MS45Nzg5NjUwMjE0NTk0OSwgLTAuMTc1NDQyNjk5NzE2OTcwOV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl81ZTljMWNlYTkyZWU0NGIyYjk4ZGQ1YTRkNThiZDJhNiA9IEwubWFya2VyKAogICAgICAgICAgICBbNTMuNTA3NzI4ODY1NjUxMTYsIC02Ljk1NzYzNjM3OTE1MzczOTRdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfYzI3ODU2ZjVkODlmNGYxYmFiMWI4ZWMyODkyYzUwMGUgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM5LjE1OTM3OTAxMjM3ODY2NSwgLTExLjkxNjUzNDUzNzk4MDk1NF0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl82MDAwMmIzYzQxMTE0NGNkOTQ3OGQwZjNhYjcxMGY1OSA9IEwubWFya2VyKAogICAgICAgICAgICBbNDEuMzU5ODM2NTM2NzMzNTc1LCAtNC41NjYxNjU1ODc5NzQ1NTZdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfZTMzZTRiNmE0MTQ4NDMwZGI2OTVmMzhiNDI4YmY4MjYgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUzLjM2ODY1MDI1MjExODMzLCAxLjM0OTAxMTc5MjQ1MzE1NDZdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfZDQ1NDQyY2MzNTk0NGZkMjg4ZWYwMGJkNmRjODVmMTkgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUyLjUwNjI5NzkxMzE3OTQyNCwgMi4zMzg0MTE2MTMwNjE3NTg1XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzlmMTI2NGM3MjEzOTQ0ODI4ZjkzMzFjNDM4MWEyNzJhID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1MC4xNTkzMDEzMjgyNDI0MSwgLTkuNDM0MjI0Mzk1Njg5OTA2XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzNiYjM2NzcyNTUwODQxZjdiNTAzOGE3YjU4NTE4NzM5ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1OC40ODg0MzQ0MDgzMDAyOCwgNy41MzYyMjYzNTkwNTc1MjZdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfMjI4NDI1ZDgwMjM2NDNmMThmMmEzNTkwMDQwMmEzNDAgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzU1LjQ3OTMyNzk2NTM4MDU5LCA2LjQzMzY1NTkwNzI3Nzg1M10sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8zMDU2MTM5ZTIwZTU0OTIwYWY5YTZkYjE3MjQ3MzNiZSA9IEwubWFya2VyKAogICAgICAgICAgICBbMzkuMTg0NzE2MzQ5NjM5ODcsIC0yLjkzNjgzNTg1MzY5Njk4MzZdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfOGY3ODA1YzU5MmNmNGZjYThmMGI4ZWZhNzBjODUzN2YgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzQ5LjE4NjkxMzU1MzMxODY2LCAtMC4zNzg3NzUzMTI5NzUyMDk0XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2VlNDdlMTc2Yzc4YzQ4YmI4NTkzOTIxNjQwMjRjNjU0ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0My42Mjc5NDk3MTE4MTk4NSwgMTYuNTk0NzM2NzI3NDk3NzMyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzMxNzVhNTg2ZDM1YzRhN2Q4MTEwODMxNzk1MWE4ZTlhID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1NC4wNDMwODEyOTQ2OTc2OSwgMjEuMTc3NTExMDM1NDk1NzYyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2M4MzRmZjdlN2YyYzRmZmNhNDJlOWZlMmY3ZjA3NmFmID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0Mi4zODQ4NTI5NjA1MDAzNiwgMjkuNDQ3MjI3MTkxMDA2NDldLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfYWNhMjc5NGJmYzhlNDFlYWFjMWVjZDIwODE5ODkyMGYgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUzLjAxODQ3NDUyNDAxMzI3LCAxNy43MTY1MzA5MDcyNjUyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzc5ZmExOTFjMWUyNjQ2YWVhOGMyOGM0MjQzMDMyNDliID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0Ni45MDE1ODYxMDQ2NjQzMywgMjYuMDMwMjAxNTE2MDg2MDNdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfZWMzY2JjZmI1ZjFhNGQ0Y2E2ZTgwYzI4NjNkYjMwN2MgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM3Ljk5NzgyMDY2NTYwMDQ1LCAxLjYzODM3NTA5NzE0Nzg3MzddLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfZDQ2MWM4YmIxODRhNDBmMWFjYTIyN2VmMmNhNzIxNmYgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzQzLjEwNTU2ODYyMjU0ODc2LCAtMi41MTEwOTQ3MzEzNzcxODI4XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2I0OTFmZmM3NDcxMTQ3NzY5OTBhOGZiN2ExOGFiYjcyID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0Ny4xODQzNDMzODc2MzkzNiwgMjMuNDIzNTg2NDAyNzkzNzhdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfNzNiYjBlOTI4YTQwNGI0YTkyNDExZWUwY2UxNGJhZTkgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzU3LjU0MzIxOTg2MDIxNjI3LCAtMy4wMjExNDEwMDcyODUxMzZdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfYzRlYzYyMGI4ODM4NGE5MGI4ZTY4Mjg3YTEzYzcwM2UgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUzLjI4MDUyNDcxMjI0Mzg0NiwgMTQuMDA2MzIzMzMyODUxMDY0XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzJkNTQ2ZWRmZDAxYzQyNzg4NzYxYzhlYjg2YWNkZGNhID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1NC4yNDgzMjk0OTI4Nzk3MywgMTkuMzIxMzQyMzY0ODQwOTJdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfZjEzNTUxYmRmMWI3NGZmOTg1NTRmYjg2MDIzOWM2N2YgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM4LjYzODA1MTczNzg2MzE1LCAtNy42MDQ2MjgwMzA3ODgyMDVdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfNGJlM2ZjZjVhYTYxNGJmYmE5Yjc0YWFhNWM3ZDZkODcgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUyLjUxNjU5ODYxOTc0NDUzNSwgLTkuODAyNjA3ODgxNjcyNjE2XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2I4MDQwMGUwMTUyZDRmODg4OGU3OTBhMmNmY2VjMTRiID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0My4zMzQ0NDk0NDYzNjE3NSwgLTIuNTgyNjI3NTE1NTgwODA1XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2Q3NTU2ZmY1ODBkNDQzMzNhNjc5NDg0OWFkNzg4ZDcxID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0Ni4yODc4ODU0OTUwMzYxNywgMi4xNDQ1MDgzNzM3MzIwMjY3XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2JiODQwOGM0OGVkMjQ5NjViNjU4Zjk2MjVmMWU0YTkwID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0OC4xNzc5MDcxNzMwNjIwMSwgMC44ODYxNDM1MDQxMzIzNTQyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzU4MDE5ZTNmZTUzNTQzZDViMjAyODZkMWM0OWFiMTA5ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0My4yMzY5MjA5MDE2NjczNiwgLTQuOTU1MzI5MTI5MTg1MTU5XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzlmYzdjNGFmZjU2YjQzYWY4ZGZkZTY3Y2I4NTJlYjVlID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0Ni40MzYxNjc1OTIyMzE4NTQsIC0wLjA5Nzc4MTkwNDc5NDc4OTY1XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzY1M2RhY2MxNWMxNjQwOGJiNjk0YmEzNjI4OGRlNzMxID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0My44OTE1NzYwNzM2MDM0NiwgMC44MTA1NDAzODMxNzYzNTk2XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzA5M2M5ODRmZWMyNzQyOWU5NGE2ZWJmMTQ3MjRjZjg3ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0OS44MTE4MzQ4MTI4NzY5NywgMTIuNzU1NzgyNDM2NzU2MTg5XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzg1OTdjMmMyMzg1NjQxMDA5YmM2YzUxODVjZTRhMmVkID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs0Ni44NTc4NzQ5MDYxODU1OSwgMC4yMjQwNDUxMjMxMTM1NDI3NF0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl83NjM2YTk3NGQyYWQ0ODBiOTUyNzE1ZGJiMWRjNjIwZiA9IEwubWFya2VyKAogICAgICAgICAgICBbNDMuNDkxMDM0Mzg0Mzg3ODQ1LCAxNy41Njc2MTU1MDgwMDY0MjZdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfYzA1YzYyNzFhNmI5NGRlMjkwMTI4OWZhMDZkY2M3M2QgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzM3LjA2NTYzMTE4NTYxMDk0LCAwLjAyODMyNTgzMzI2ODYxMDI2OF0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8yMDg4ODIxODdjZDY0MzQyOTkxODhiOTNmNjAyZGY0ZiA9IEwubWFya2VyKAogICAgICAgICAgICBbNDIuNjA1ODE5ODcwMTQxMTUsIC03LjU0NjY0NTk1Njk0MjUyN10sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9jZWU1OWY4MjkxZWE0YWYxODUxMTMxODIzNzFiZjMyMCA9IEwubWFya2VyKAogICAgICAgICAgICBbNDUuMDMxNjI0MTI5MDc1ODcsIC03LjI4MzQ5MzMzMzk0NTg1OV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9kZjEwZDY0ZmU3NTY0NGRhOThhMmJhY2Y2MGI3NTgxNiA9IEwubWFya2VyKAogICAgICAgICAgICBbNTMuMjI1ODcxMjg4OTQ4NzUsIC0yLjAzNzI2ODgwNzE4NjgxOTddLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfM2JhNThmNTQzNWE1NDdmNjg5OTFiNTM4MGQ3MWJjYTUgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUzLjQ4MjkxOTczNjEyOTAwNiwgMy45NDkzNDQ3NTgxNjExXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzI3M2Q1OWIxYzIwNDQ1YjdiYTg5ZTlkMWYzYzdkNDhkID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1My44MTk3MzUzMDIwNTYzNiwgLTEuMjc1NjU2NDA0MDY2NjMwNV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl83MWVmMjgzYmM4NTA0MGY5YTNlNmViMmY3OGFmY2JiNSA9IEwubWFya2VyKAogICAgICAgICAgICBbNDMuNzkxODY5MjI3MzAzNjM2LCA1LjIxMDgxNzM5MTI0MTU4N10sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl84YTI4ZGYyNjBjN2M0NDExYmE4ZDNlODQyMWY0YTU0ZSA9IEwubWFya2VyKAogICAgICAgICAgICBbNTUuNjcyMDYxNzM0MjYyOTQsIDI1LjgwOTQxODY0MTgyMjA5XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzM1YTRkNmFlNzlmMjQyOGViZDM4YmQwNWM0NGY5Y2E2ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1MS4xMDcwNDY3MjgyODUxNiwgMjYuNTIyMjA4Mjk2Nzc2MDM2XSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2RjY2E3MzYzYjRjMTRkMzliMjcyMjdkOGFjODMwYWM4ID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1Ni4zMzgzMjIxOTc5ODg3LCAxMS45MjY3OTcwNDE1Mzc2MjJdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfYzExMzRhNmIwZmI5NGE5NDg1NWEzNDMzMGE2MjI5YjAgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzU3Ljg4MzM1ODEyNTI2MzEsIDExLjk0ODg4MDQyODI4MDA0NV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl83Y2Q4ZGE0MzVlZDI0NGVlOTM2NjgxZGNiMzEzNDhjZSA9IEwubWFya2VyKAogICAgICAgICAgICBbNTkuMjE2Nzg5MDc1NTM1NDk1LCAtMTAuMjA1NDYxOTIzMTg3MjkzXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXJrZXJfY2x1c3Rlcl83ZmQ3YjU3ZDhmNmM0MmZmOGI2NzNiYWVmMDM0MDBhNyk7CiAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyX2MyMjc5NThiYjU1MTRmYmJiYTY1OTI5YjczZGQ3YWNhID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFs1MS4zNTAxMTA3NTg2MjY1NywgLTYuMjYxNjg3MjY5NzgwMjM3NV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl9jNDE3ZmM4MTAzY2I0MjRjOWU5Njg2ZGJiMDlkYzgyNSA9IEwubWFya2VyKAogICAgICAgICAgICBbNTAuODM3ODcxNDEzMjA1NzYsIDkuNjQyMzgwMzAxODIyNTZdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcmtlcl9jbHVzdGVyXzdmZDdiNTdkOGY2YzQyZmY4YjY3M2JhZWYwMzQwMGE3KTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfOTBlMDk3OWJmOTY5NDViY2I5ZWZkYjVhZTYwMjUyMjEgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUwLjc3Mzk3MjMyMjczMzg3LCAyOS4wNTc0Nzc3NDY1NzkxOV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8obWFya2VyX2NsdXN0ZXJfN2ZkN2I1N2Q4ZjZjNDJmZjhiNjczYmFlZjAzNDAwYTcpOwogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bbac1588>"
+ "<folium.folium.Map at 0x1b7d54fc4e0>"
]
},
"execution_count": 4,
@@ -153,10 +153,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfMzRlZGJlMGU3MzMwNGI3MmFjYzExN2MyYmVkMWE3YWEgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9yYXdnaXRodWIuY29tL2pvZXJnZGlldHJpY2gvTGVhZmxldC5UZXJtaW5hdG9yL21hc3Rlci9MLlRlcm1pbmF0b3IuanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF8zNGVkYmUwZTczMzA0YjcyYWNjMTE3YzJiZWQxYTdhYSIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfMzRlZGJlMGU3MzMwNGI3MmFjYzExN2MyYmVkMWE3YWEgPSBMLm1hcCgKICAgICAgICAnbWFwXzM0ZWRiZTBlNzMzMDRiNzJhY2MxMTdjMmJlZDFhN2FhJywgewogICAgICAgIGNlbnRlcjogWzQ1LCAzXSwKICAgICAgICB6b29tOiAxLAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NwogICAgICAgIH0pOwoKICAgIAogICAgCiAgICB2YXIgdGlsZV9sYXllcl9lMGM3NTcyYzVkNjk0Y2FmODE2MjE5OGM2NjQ3M2NmMSA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIKfSkuYWRkVG8obWFwXzM0ZWRiZTBlNzMzMDRiNzJhY2MxMTdjMmJlZDFhN2FhKTsKICAgIAogICAgICAgICAgICAgICAgTC50ZXJtaW5hdG9yKCkuYWRkVG8obWFwXzM0ZWRiZTBlNzMzMDRiNzJhY2MxMTdjMmJlZDFhN2FhKTsKICAgICAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfYTVjM2NiMGI3YzZkNDk0YWJiMGFiMmEyMWRkY2Y4NTcgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly91bnBrZy5jb20vQGpvZXJnZGlldHJpY2gvbGVhZmxldC50ZXJtaW5hdG9yIj48L3NjcmlwdD4KPC9oZWFkPgo8Ym9keT4gICAgCiAgICAKICAgIDxkaXYgY2xhc3M9ImZvbGl1bS1tYXAiIGlkPSJtYXBfYTVjM2NiMGI3YzZkNDk0YWJiMGFiMmEyMWRkY2Y4NTciID48L2Rpdj4KPC9ib2R5Pgo8c2NyaXB0PiAgICAKICAgIAogICAgCiAgICAgICAgdmFyIGJvdW5kcyA9IG51bGw7CiAgICAKCiAgICB2YXIgbWFwX2E1YzNjYjBiN2M2ZDQ5NGFiYjBhYjJhMjFkZGNmODU3ID0gTC5tYXAoCiAgICAgICAgJ21hcF9hNWMzY2IwYjdjNmQ0OTRhYmIwYWIyYTIxZGRjZjg1NycsIHsKICAgICAgICBjZW50ZXI6IFs0NSwgM10sCiAgICAgICAgem9vbTogMSwKICAgICAgICBtYXhCb3VuZHM6IGJvdW5kcywKICAgICAgICBsYXllcnM6IFtdLAogICAgICAgIHdvcmxkQ29weUp1bXA6IGZhbHNlLAogICAgICAgIGNyczogTC5DUlMuRVBTRzM4NTcsCiAgICAgICAgem9vbUNvbnRyb2w6IHRydWUsCiAgICAgICAgfSk7CgogICAgCiAgICAKICAgIHZhciB0aWxlX2xheWVyXzU5NmQ5MDIyOTAzZjQ4ZWZiZjI1NWFjNmVlOGVlMmM4ID0gTC50aWxlTGF5ZXIoCiAgICAgICAgJ2h0dHBzOi8ve3N9LnRpbGUub3BlbnN0cmVldG1hcC5vcmcve3p9L3t4fS97eX0ucG5nJywKICAgICAgICB7CiAgICAgICAgImF0dHJpYnV0aW9uIjogbnVsbCwKICAgICAgICAiZGV0ZWN0UmV0aW5hIjogZmFsc2UsCiAgICAgICAgIm1heE5hdGl2ZVpvb20iOiAxOCwKICAgICAgICAibWF4Wm9vbSI6IDE4LAogICAgICAgICJtaW5ab29tIjogMCwKICAgICAgICAibm9XcmFwIjogZmFsc2UsCiAgICAgICAgIm9wYWNpdHkiOiAxLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIsCiAgICAgICAgInRtcyI6IGZhbHNlCn0pLmFkZFRvKG1hcF9hNWMzY2IwYjdjNmQ0OTRhYmIwYWIyYTIxZGRjZjg1Nyk7CiAgICAKICAgICAgICAgICAgICAgIEwudGVybWluYXRvcigpLmFkZFRvKG1hcF9hNWMzY2IwYjdjNmQ0OTRhYmIwYWIyYTIxZGRjZjg1Nyk7CiAgICAgICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bbb059e8>"
+ "<folium.folium.Map at 0x1b7d54f1eb8>"
]
},
"execution_count": 5,
@@ -189,10 +189,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfYTM2ODhhN2VhYTRmNDU5MzhjYzJjMjNlNGVmOWMxOTIgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly91bnBrZy5jb20vbGVhZmxldC5ib2F0bWFya2VyL2xlYWZsZXQuYm9hdG1hcmtlci5taW4uanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF9hMzY4OGE3ZWFhNGY0NTkzOGNjMmMyM2U0ZWY5YzE5MiIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfYTM2ODhhN2VhYTRmNDU5MzhjYzJjMjNlNGVmOWMxOTIgPSBMLm1hcCgKICAgICAgICAnbWFwX2EzNjg4YTdlYWE0ZjQ1OTM4Y2MyYzIzZTRlZjljMTkyJywgewogICAgICAgIGNlbnRlcjogWzMwLCAwXSwKICAgICAgICB6b29tOiAzLAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NwogICAgICAgIH0pOwoKICAgIAogICAgCiAgICB2YXIgdGlsZV9sYXllcl9mNmZkOTVmMDQ5M2Q0Yjg2ODg3ZjIzZTViNDUzMmI1YSA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIKfSkuYWRkVG8obWFwX2EzNjg4YTdlYWE0ZjQ1OTM4Y2MyYzIzZTRlZjljMTkyKTsKICAgIAogICAgICAgICAgICAgICAgdmFyIGJvYXRfbWFya2VyXzY1YTY4ODcxZjlmZTRkZDY4OWM2NDJmODRhMjQ2NWZjID0gTC5ib2F0TWFya2VyKAogICAgICAgICAgICAgICAgICAgIFszNCwtNDNdLAogICAgICAgICAgICAgICAgICAgIHsiY29sb3IiOiAiIzhmOCJ9KS5hZGRUbyhtYXBfYTM2ODhhN2VhYTRmNDU5MzhjYzJjMjNlNGVmOWMxOTIpOwogICAgICAgICAgICAgICAgYm9hdF9tYXJrZXJfNjVhNjg4NzFmOWZlNGRkNjg5YzY0MmY4NGEyNDY1ZmMuc2V0SGVhZGluZ1dpbmQoNDUsIDQ1LCAxNTApOwogICAgICAgICAgICAgICAgCiAgICAKICAgICAgICAgICAgICAgIHZhciBib2F0X21hcmtlcl85MDM0OTc5YTMxMTk0ODU2YmRhM2FhYmRjZWExODJmZiA9IEwuYm9hdE1hcmtlcigKICAgICAgICAgICAgICAgICAgICBbNDYsLTMwXSwKICAgICAgICAgICAgICAgICAgICB7ImNvbG9yIjogIiM4OGYifSkuYWRkVG8obWFwX2EzNjg4YTdlYWE0ZjQ1OTM4Y2MyYzIzZTRlZjljMTkyKTsKICAgICAgICAgICAgICAgIGJvYXRfbWFya2VyXzkwMzQ5NzlhMzExOTQ4NTZiZGEzYWFiZGNlYTE4MmZmLnNldEhlYWRpbmdXaW5kKC0yMCwgMjUsIDQ2KTsKICAgICAgICAgICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfNjY4ZDgwMDBhY2E1NDNiMzk1YzRkY2M2NDc3Y2Q5NTcgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly91bnBrZy5jb20vbGVhZmxldC5ib2F0bWFya2VyL2xlYWZsZXQuYm9hdG1hcmtlci5taW4uanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF82NjhkODAwMGFjYTU0M2IzOTVjNGRjYzY0NzdjZDk1NyIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfNjY4ZDgwMDBhY2E1NDNiMzk1YzRkY2M2NDc3Y2Q5NTcgPSBMLm1hcCgKICAgICAgICAnbWFwXzY2OGQ4MDAwYWNhNTQzYjM5NWM0ZGNjNjQ3N2NkOTU3JywgewogICAgICAgIGNlbnRlcjogWzMwLCAwXSwKICAgICAgICB6b29tOiAzLAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNTE0NzNkYjM2NDVlNGYzZDljOTQ5NDU5ZjQ5M2Y0YzIgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwXzY2OGQ4MDAwYWNhNTQzYjM5NWM0ZGNjNjQ3N2NkOTU3KTsKICAgIAogICAgICAgICAgICAgICAgdmFyIGJvYXRfbWFya2VyXzRhZDFkYmNjODZiODQ3OTFiZDM5Y2NiMWI0MmU5YmM2ID0gTC5ib2F0TWFya2VyKAogICAgICAgICAgICAgICAgICAgIFszNCwtNDNdLAogICAgICAgICAgICAgICAgICAgIHsiY29sb3IiOiAiIzhmOCJ9KS5hZGRUbyhtYXBfNjY4ZDgwMDBhY2E1NDNiMzk1YzRkY2M2NDc3Y2Q5NTcpOwogICAgICAgICAgICAgICAgYm9hdF9tYXJrZXJfNGFkMWRiY2M4NmI4NDc5MWJkMzljY2IxYjQyZTliYzYuc2V0SGVhZGluZ1dpbmQoNDUsIDQ1LCAxNTApOwogICAgICAgICAgICAgICAgCiAgICAKICAgICAgICAgICAgICAgIHZhciBib2F0X21hcmtlcl8yMGEyZTVhOWY5NmQ0MzQxYjk2YzlkNTRhMDgzZmQ1YSA9IEwuYm9hdE1hcmtlcigKICAgICAgICAgICAgICAgICAgICBbNDYsLTMwXSwKICAgICAgICAgICAgICAgICAgICB7ImNvbG9yIjogIiM4OGYifSkuYWRkVG8obWFwXzY2OGQ4MDAwYWNhNTQzYjM5NWM0ZGNjNjQ3N2NkOTU3KTsKICAgICAgICAgICAgICAgIGJvYXRfbWFya2VyXzIwYTJlNWE5Zjk2ZDQzNDFiOTZjOWQ1NGEwODNmZDVhLnNldEhlYWRpbmdXaW5kKC0yMCwgMjUsIDQ2KTsKICAgICAgICAgICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bb9f5518>"
+ "<folium.folium.Map at 0x1b7d55ac5f8>"
]
},
"execution_count": 6,
@@ -240,10 +240,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfNDk0MDlhODk5YzU2NDk1OGFhZDQ2MzA0OTA5OTQ0YmQgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuLnJhd2dpdC5jb20vbWFyc2xhbjM5MC9CZWF1dGlmeU1hcmtlci9tYXN0ZXIvbGVhZmxldC1iZWF1dGlmeS1tYXJrZXItaWNvbi5jc3MiLz4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5yYXdnaXQuY29tL21hcnNsYW4zOTAvQmVhdXRpZnlNYXJrZXIvbWFzdGVyL2xlYWZsZXQtYmVhdXRpZnktbWFya2VyLWljb24uanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF80OTQwOWE4OTljNTY0OTU4YWFkNDYzMDQ5MDk5NDRiZCIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfNDk0MDlhODk5YzU2NDk1OGFhZDQ2MzA0OTA5OTQ0YmQgPSBMLm1hcCgKICAgICAgICAnbWFwXzQ5NDA5YTg5OWM1NjQ5NThhYWQ0NjMwNDkwOTk0NGJkJywgewogICAgICAgIGNlbnRlcjogWzQ1LjUsIC0xMjJdLAogICAgICAgIHpvb206IDMsCiAgICAgICAgbWF4Qm91bmRzOiBib3VuZHMsCiAgICAgICAgbGF5ZXJzOiBbXSwKICAgICAgICB3b3JsZENvcHlKdW1wOiBmYWxzZSwKICAgICAgICBjcnM6IEwuQ1JTLkVQU0czODU3CiAgICAgICAgfSk7CgogICAgCiAgICAKICAgIHZhciB0aWxlX2xheWVyXzQyMjQ5NmZmZjAyMTQ5NzQ4ZmExM2IwNzEyZTJkNzJjID0gTC50aWxlTGF5ZXIoCiAgICAgICAgJ2h0dHBzOi8ve3N9LnRpbGUub3BlbnN0cmVldG1hcC5vcmcve3p9L3t4fS97eX0ucG5nJywKICAgICAgICB7CiAgICAgICAgImF0dHJpYnV0aW9uIjogbnVsbCwKICAgICAgICAiZGV0ZWN0UmV0aW5hIjogZmFsc2UsCiAgICAgICAgIm1heE5hdGl2ZVpvb20iOiAxOCwKICAgICAgICAibWF4Wm9vbSI6IDE4LAogICAgICAgICJtaW5ab29tIjogMCwKICAgICAgICAibm9XcmFwIjogZmFsc2UsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIgp9KS5hZGRUbyhtYXBfNDk0MDlhODk5YzU2NDk1OGFhZDQ2MzA0OTA5OTQ0YmQpOwogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2M5NjQ5YzhkOThjNTQ3Y2ZhODQyMTNkMDM2YWFlMDQyID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbNDYsIC0xMjJdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8obWFwXzQ5NDA5YTg5OWM1NjQ5NThhYWQ0NjMwNDkwOTk0NGJkKTsKICAgICAgICAgICAgCiAgICAKICAgICAgICAgICAgICAgIHZhciBiZWF1dGlmeV9pY29uX2I3ZWI1ZmNkOTc4MzQ4Y2E5OWUwZDIyMWJhMzA2MjJiID0gbmV3IEwuQmVhdXRpZnlJY29uLmljb24oewogICJiYWNrZ3JvdW5kQ29sb3IiOiAiI0ZGRiIsCiAgImJvcmRlckNvbG9yIjogIiNiMzMzNGYiLAogICJib3JkZXJXaWR0aCI6IDMsCiAgImljb24iOiAicGxhbmUiLAogICJpY29uU2hhcGUiOiAidHJpYW5nbGUiLAogICJpbm5lckljb25TdHlsZSI6ICIiLAogICJpc0FscGhhTnVtZXJpY0ljb24iOiBmYWxzZSwKICAic3BpbiI6IGZhbHNlLAogICJ0ZXh0Q29sb3IiOiAiI2IzMzM0ZiIKfSkKICAgICAgICAgICAgICAgIG1hcmtlcl9jOTY0OWM4ZDk4YzU0N2NmYTg0MjEzZDAzNmFhZTA0Mi5zZXRJY29uKGJlYXV0aWZ5X2ljb25fYjdlYjVmY2Q5NzgzNDhjYTk5ZTBkMjIxYmEzMDYyMmIpOwogICAgICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgcG9wdXBfNGZhYjY2YzUzMmFjNGI3M2JhMTIxODA0YzE1MDY5ZjkgPSBMLnBvcHVwKHttYXhXaWR0aDogJzMwMCcKICAgICAgICAgICAgCiAgICAgICAgICAgIH0pOwoKICAgICAgICAgICAgCiAgICAgICAgICAgICAgICB2YXIgaHRtbF80MmQ4M2FkNGFjNzM0ZGNhYThmYTk4YWM2NWM5YzU5MiA9ICQoJzxkaXYgaWQ9Imh0bWxfNDJkODNhZDRhYzczNGRjYWE4ZmE5OGFjNjVjOWM1OTIiIHN0eWxlPSJ3aWR0aDogMTAwLjAlOyBoZWlnaHQ6IDEwMC4wJTsiPlBvcnRsYW5kLCBPUjwvZGl2PicpWzBdOwogICAgICAgICAgICAgICAgcG9wdXBfNGZhYjY2YzUzMmFjNGI3M2JhMTIxODA0YzE1MDY5Zjkuc2V0Q29udGVudChodG1sXzQyZDgzYWQ0YWM3MzRkY2FhOGZhOThhYzY1YzljNTkyKTsKICAgICAgICAgICAgCgogICAgICAgICAgICBtYXJrZXJfYzk2NDljOGQ5OGM1NDdjZmE4NDIxM2QwMzZhYWUwNDIuYmluZFBvcHVwKHBvcHVwXzRmYWI2NmM1MzJhYzRiNzNiYTEyMTgwNGMxNTA2OWY5KQogICAgICAgICAgICA7CgogICAgICAgICAgICAKICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl8yNzVhMTUzMjRlMmI0ODk4YTExNTNhZGY2OWEwNzUwMCA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzUwLCAtMTIyXSwKICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICkKICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgLmFkZFRvKG1hcF80OTQwOWE4OTljNTY0OTU4YWFkNDYzMDQ5MDk5NDRiZCk7CiAgICAgICAgICAgIAogICAgCiAgICAgICAgICAgICAgICB2YXIgYmVhdXRpZnlfaWNvbl85YjU3MDE1ZTBhMzE0Y2JhODJlMDY3ZDU4ZjBlZjRmZiA9IG5ldyBMLkJlYXV0aWZ5SWNvbi5pY29uKHsKICAiYmFja2dyb3VuZENvbG9yIjogIiNGRkYiLAogICJib3JkZXJDb2xvciI6ICIjMDBBQkRDIiwKICAiYm9yZGVyV2lkdGgiOiAzLAogICJpbm5lckljb25TdHlsZSI6ICJtYXJnaW4tdG9wOjA7IiwKICAiaXNBbHBoYU51bWVyaWNJY29uIjogdHJ1ZSwKICAic3BpbiI6IGZhbHNlLAogICJ0ZXh0IjogMTAsCiAgInRleHRDb2xvciI6ICIjMDBBQkRDIgp9KQogICAgICAgICAgICAgICAgbWFya2VyXzI3NWExNTMyNGUyYjQ4OThhMTE1M2FkZjY5YTA3NTAwLnNldEljb24oYmVhdXRpZnlfaWNvbl85YjU3MDE1ZTBhMzE0Y2JhODJlMDY3ZDU4ZjBlZjRmZik7CiAgICAgICAgICAgIAogICAgCiAgICAgICAgICAgIHZhciBwb3B1cF9mMzNhNzVlOTQ5ZjM0ZjEzOWViMDk1ZTQ0YjViZWVhYSA9IEwucG9wdXAoe21heFdpZHRoOiAnMzAwJwogICAgICAgICAgICAKICAgICAgICAgICAgfSk7CgogICAgICAgICAgICAKICAgICAgICAgICAgICAgIHZhciBodG1sXzI3MTdiZTQ4ZDI1MjRmOTQ5ZGFkMDBkOTg3MjdlZjlhID0gJCgnPGRpdiBpZD0iaHRtbF8yNzE3YmU0OGQyNTI0Zjk0OWRhZDAwZDk4NzI3ZWY5YSIgc3R5bGU9IndpZHRoOiAxMDAuMCU7IGhlaWdodDogMTAwLjAlOyI+UG9ydGxhbmQsIE9SPC9kaXY+JylbMF07CiAgICAgICAgICAgICAgICBwb3B1cF9mMzNhNzVlOTQ5ZjM0ZjEzOWViMDk1ZTQ0YjViZWVhYS5zZXRDb250ZW50KGh0bWxfMjcxN2JlNDhkMjUyNGY5NDlkYWQwMGQ5ODcyN2VmOWEpOwogICAgICAgICAgICAKCiAgICAgICAgICAgIG1hcmtlcl8yNzVhMTUzMjRlMmI0ODk4YTExNTNhZGY2OWEwNzUwMC5iaW5kUG9wdXAocG9wdXBfZjMzYTc1ZTk0OWYzNGYxMzllYjA5NWU0NGI1YmVlYWEpCiAgICAgICAgICAgIDsKCiAgICAgICAgICAgIAogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfODRkZTY0OTM3MTdkNGZiZmFlZmM1OGQ2NDZkNjIyYTYgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuLnJhd2dpdC5jb20vbWFyc2xhbjM5MC9CZWF1dGlmeU1hcmtlci9tYXN0ZXIvbGVhZmxldC1iZWF1dGlmeS1tYXJrZXItaWNvbi5jc3MiLz4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5yYXdnaXQuY29tL21hcnNsYW4zOTAvQmVhdXRpZnlNYXJrZXIvbWFzdGVyL2xlYWZsZXQtYmVhdXRpZnktbWFya2VyLWljb24uanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF84NGRlNjQ5MzcxN2Q0ZmJmYWVmYzU4ZDY0NmQ2MjJhNiIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfODRkZTY0OTM3MTdkNGZiZmFlZmM1OGQ2NDZkNjIyYTYgPSBMLm1hcCgKICAgICAgICAnbWFwXzg0ZGU2NDkzNzE3ZDRmYmZhZWZjNThkNjQ2ZDYyMmE2JywgewogICAgICAgIGNlbnRlcjogWzQ1LjUsIC0xMjJdLAogICAgICAgIHpvb206IDMsCiAgICAgICAgbWF4Qm91bmRzOiBib3VuZHMsCiAgICAgICAgbGF5ZXJzOiBbXSwKICAgICAgICB3b3JsZENvcHlKdW1wOiBmYWxzZSwKICAgICAgICBjcnM6IEwuQ1JTLkVQU0czODU3LAogICAgICAgIHpvb21Db250cm9sOiB0cnVlLAogICAgICAgIH0pOwoKICAgIAogICAgCiAgICB2YXIgdGlsZV9sYXllcl84YzlhZTU5ZTRmZGI0NjJhOTc4ZTY0YzdlMjgwMTVjNyA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9KS5hZGRUbyhtYXBfODRkZTY0OTM3MTdkNGZiZmFlZmM1OGQ2NDZkNjIyYTYpOwogICAgCiAgICAgICAgdmFyIG1hcmtlcl9iYmZkN2FkMWNhMWI0OTE2YjBlYmMyZGQ0YzA5YzU1MiA9IEwubWFya2VyKAogICAgICAgICAgICBbNDYsIC0xMjJdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKG1hcF84NGRlNjQ5MzcxN2Q0ZmJmYWVmYzU4ZDY0NmQ2MjJhNik7CiAgICAgICAgCiAgICAKICAgICAgICAgICAgICAgIHZhciBiZWF1dGlmeV9pY29uX2QxMDIzMDA3YjViZDQ2MDhiYmFjM2QwMzRlNDQ4ZDI4ID0gbmV3IEwuQmVhdXRpZnlJY29uLmljb24oewogICJiYWNrZ3JvdW5kQ29sb3IiOiAiI0ZGRiIsCiAgImJvcmRlckNvbG9yIjogIiNiMzMzNGYiLAogICJib3JkZXJXaWR0aCI6IDMsCiAgImljb24iOiAicGxhbmUiLAogICJpY29uU2hhcGUiOiAidHJpYW5nbGUiLAogICJpbm5lckljb25TdHlsZSI6ICIiLAogICJpc0FscGhhTnVtZXJpY0ljb24iOiBmYWxzZSwKICAic3BpbiI6IGZhbHNlLAogICJ0ZXh0Q29sb3IiOiAiI2IzMzM0ZiIKfSkKICAgICAgICAgICAgICAgIG1hcmtlcl9iYmZkN2FkMWNhMWI0OTE2YjBlYmMyZGQ0YzA5YzU1Mi5zZXRJY29uKGJlYXV0aWZ5X2ljb25fZDEwMjMwMDdiNWJkNDYwOGJiYWMzZDAzNGU0NDhkMjgpOwogICAgICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgcG9wdXBfYzE3ZTUyNmZhY2ExNGQwMzhhMDE3YWI1ZmI3NDdhMWUgPSBMLnBvcHVwKHttYXhXaWR0aDogJzMwMCcKICAgICAgICAgICAgCiAgICAgICAgICAgIH0pOwoKICAgICAgICAgICAgCiAgICAgICAgICAgICAgICB2YXIgaHRtbF9kOWY3ZDQ5NWE5YTI0MWQ5YjJmMDE2OWIxMGJjMWEyNSA9ICQoJzxkaXYgaWQ9Imh0bWxfZDlmN2Q0OTVhOWEyNDFkOWIyZjAxNjliMTBiYzFhMjUiIHN0eWxlPSJ3aWR0aDogMTAwLjAlOyBoZWlnaHQ6IDEwMC4wJTsiPlBvcnRsYW5kLCBPUjwvZGl2PicpWzBdOwogICAgICAgICAgICAgICAgcG9wdXBfYzE3ZTUyNmZhY2ExNGQwMzhhMDE3YWI1ZmI3NDdhMWUuc2V0Q29udGVudChodG1sX2Q5ZjdkNDk1YTlhMjQxZDliMmYwMTY5YjEwYmMxYTI1KTsKICAgICAgICAgICAgCgogICAgICAgICAgICBtYXJrZXJfYmJmZDdhZDFjYTFiNDkxNmIwZWJjMmRkNGMwOWM1NTIuYmluZFBvcHVwKHBvcHVwX2MxN2U1MjZmYWNhMTRkMDM4YTAxN2FiNWZiNzQ3YTFlKQogICAgICAgICAgICA7CgogICAgICAgICAgICAKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfZmFlOGNkZTFiMGRiNDIxNDk1NThmMmI4ODg0M2NjZGUgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzUwLCAtMTIyXSwKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgKS5hZGRUbyhtYXBfODRkZTY0OTM3MTdkNGZiZmFlZmM1OGQ2NDZkNjIyYTYpOwogICAgICAgIAogICAgCiAgICAgICAgICAgICAgICB2YXIgYmVhdXRpZnlfaWNvbl9lZTEzYTYxYmJiMTk0MTM3YTg1NTI0MzNmZTczYWJkMSA9IG5ldyBMLkJlYXV0aWZ5SWNvbi5pY29uKHsKICAiYmFja2dyb3VuZENvbG9yIjogIiNGRkYiLAogICJib3JkZXJDb2xvciI6ICIjMDBBQkRDIiwKICAiYm9yZGVyV2lkdGgiOiAzLAogICJpbm5lckljb25TdHlsZSI6ICJtYXJnaW4tdG9wOjA7IiwKICAiaXNBbHBoYU51bWVyaWNJY29uIjogdHJ1ZSwKICAic3BpbiI6IGZhbHNlLAogICJ0ZXh0IjogMTAsCiAgInRleHRDb2xvciI6ICIjMDBBQkRDIgp9KQogICAgICAgICAgICAgICAgbWFya2VyX2ZhZThjZGUxYjBkYjQyMTQ5NTU4ZjJiODg4NDNjY2RlLnNldEljb24oYmVhdXRpZnlfaWNvbl9lZTEzYTYxYmJiMTk0MTM3YTg1NTI0MzNmZTczYWJkMSk7CiAgICAgICAgICAgIAogICAgCiAgICAgICAgICAgIHZhciBwb3B1cF8wZjg4YWUxNDRjMzE0NjYwYTdhY2FhNjVmNTBmOTI0NCA9IEwucG9wdXAoe21heFdpZHRoOiAnMzAwJwogICAgICAgICAgICAKICAgICAgICAgICAgfSk7CgogICAgICAgICAgICAKICAgICAgICAgICAgICAgIHZhciBodG1sXzI3MjNkZDNlM2Q4MTQ0MTRiM2I0ZmExOTc2OTQwMGEyID0gJCgnPGRpdiBpZD0iaHRtbF8yNzIzZGQzZTNkODE0NDE0YjNiNGZhMTk3Njk0MDBhMiIgc3R5bGU9IndpZHRoOiAxMDAuMCU7IGhlaWdodDogMTAwLjAlOyI+UG9ydGxhbmQsIE9SPC9kaXY+JylbMF07CiAgICAgICAgICAgICAgICBwb3B1cF8wZjg4YWUxNDRjMzE0NjYwYTdhY2FhNjVmNTBmOTI0NC5zZXRDb250ZW50KGh0bWxfMjcyM2RkM2UzZDgxNDQxNGIzYjRmYTE5NzY5NDAwYTIpOwogICAgICAgICAgICAKCiAgICAgICAgICAgIG1hcmtlcl9mYWU4Y2RlMWIwZGI0MjE0OTU1OGYyYjg4ODQzY2NkZS5iaW5kUG9wdXAocG9wdXBfMGY4OGFlMTQ0YzMxNDY2MGE3YWNhYTY1ZjUwZjkyNDQpCiAgICAgICAgICAgIDsKCiAgICAgICAgICAgIAogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bba00630>"
+ "<folium.folium.Map at 0x1b7d55a8b00>"
]
},
"execution_count": 7,
@@ -299,10 +299,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfNDMxNDZhZDE1ZGY4NDVkOTliY2NkZGQxMDAxY2RmMTggewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC5mdWxsc2NyZWVuLzEuNC4yL0NvbnRyb2wuRnVsbFNjcmVlbi5taW4uanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9sZWFmbGV0LmZ1bGxzY3JlZW4vMS40LjIvQ29udHJvbC5GdWxsU2NyZWVuLm1pbi5jc3MiLz4KPC9oZWFkPgo8Ym9keT4gICAgCiAgICAKICAgIDxkaXYgY2xhc3M9ImZvbGl1bS1tYXAiIGlkPSJtYXBfNDMxNDZhZDE1ZGY4NDVkOTliY2NkZGQxMDAxY2RmMTgiID48L2Rpdj4KPC9ib2R5Pgo8c2NyaXB0PiAgICAKICAgIAogICAgCiAgICAgICAgdmFyIGJvdW5kcyA9IG51bGw7CiAgICAKCiAgICB2YXIgbWFwXzQzMTQ2YWQxNWRmODQ1ZDk5YmNjZGRkMTAwMWNkZjE4ID0gTC5tYXAoCiAgICAgICAgJ21hcF80MzE0NmFkMTVkZjg0NWQ5OWJjY2RkZDEwMDFjZGYxOCcsIHsKICAgICAgICBjZW50ZXI6IFs0MS45LCAtOTcuM10sCiAgICAgICAgem9vbTogNCwKICAgICAgICBtYXhCb3VuZHM6IGJvdW5kcywKICAgICAgICBsYXllcnM6IFtdLAogICAgICAgIHdvcmxkQ29weUp1bXA6IGZhbHNlLAogICAgICAgIGNyczogTC5DUlMuRVBTRzM4NTcKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNzY2M2ExNGY1ODM5NGY0MzkwMmM2MTM4MjFmYTJiZmMgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiCn0pLmFkZFRvKG1hcF80MzE0NmFkMTVkZjg0NWQ5OWJjY2RkZDEwMDFjZGYxOCk7CiAgICAKICAgICAgICAgICAgTC5jb250cm9sLmZ1bGxzY3JlZW4oewogICAgICAgICAgICAgICAgcG9zaXRpb246ICd0b3ByaWdodCcsCiAgICAgICAgICAgICAgICB0aXRsZTogJ0V4cGFuZCBtZScsCiAgICAgICAgICAgICAgICB0aXRsZUNhbmNlbDogJ0V4aXQgbWUnLAogICAgICAgICAgICAgICAgZm9yY2VTZXBhcmF0ZUJ1dHRvbjogdHJ1ZSwKICAgICAgICAgICAgICAgIH0pLmFkZFRvKG1hcF80MzE0NmFkMTVkZjg0NWQ5OWJjY2RkZDEwMDFjZGYxOCk7CiAgICAgICAgICAgIG1hcF80MzE0NmFkMTVkZjg0NWQ5OWJjY2RkZDEwMDFjZGYxOC5vbignZW50ZXJGdWxsc2NyZWVuJywgZnVuY3Rpb24oKXsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdlbnRlcmVkIGZ1bGxzY3JlZW4nKTsKICAgICAgICAgICAgfSk7CgogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfMmIxYjg1M2QyNWYzNDlhOWEzZGEzN2Q2YzQxN2E4NmYgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC5mdWxsc2NyZWVuLzEuNC4yL0NvbnRyb2wuRnVsbFNjcmVlbi5taW4uanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9sZWFmbGV0LmZ1bGxzY3JlZW4vMS40LjIvQ29udHJvbC5GdWxsU2NyZWVuLm1pbi5jc3MiLz4KPC9oZWFkPgo8Ym9keT4gICAgCiAgICAKICAgIDxkaXYgY2xhc3M9ImZvbGl1bS1tYXAiIGlkPSJtYXBfMmIxYjg1M2QyNWYzNDlhOWEzZGEzN2Q2YzQxN2E4NmYiID48L2Rpdj4KPC9ib2R5Pgo8c2NyaXB0PiAgICAKICAgIAogICAgCiAgICAgICAgdmFyIGJvdW5kcyA9IG51bGw7CiAgICAKCiAgICB2YXIgbWFwXzJiMWI4NTNkMjVmMzQ5YTlhM2RhMzdkNmM0MTdhODZmID0gTC5tYXAoCiAgICAgICAgJ21hcF8yYjFiODUzZDI1ZjM0OWE5YTNkYTM3ZDZjNDE3YTg2ZicsIHsKICAgICAgICBjZW50ZXI6IFs0MS45LCAtOTcuM10sCiAgICAgICAgem9vbTogNCwKICAgICAgICBtYXhCb3VuZHM6IGJvdW5kcywKICAgICAgICBsYXllcnM6IFtdLAogICAgICAgIHdvcmxkQ29weUp1bXA6IGZhbHNlLAogICAgICAgIGNyczogTC5DUlMuRVBTRzM4NTcsCiAgICAgICAgem9vbUNvbnRyb2w6IHRydWUsCiAgICAgICAgfSk7CgogICAgCiAgICAKICAgIHZhciB0aWxlX2xheWVyX2MxM2YwM2M5ZjhmMTQzMGI5MTJhODNiN2I5OTc3ZmVhID0gTC50aWxlTGF5ZXIoCiAgICAgICAgJ2h0dHBzOi8ve3N9LnRpbGUub3BlbnN0cmVldG1hcC5vcmcve3p9L3t4fS97eX0ucG5nJywKICAgICAgICB7CiAgICAgICAgImF0dHJpYnV0aW9uIjogbnVsbCwKICAgICAgICAiZGV0ZWN0UmV0aW5hIjogZmFsc2UsCiAgICAgICAgIm1heE5hdGl2ZVpvb20iOiAxOCwKICAgICAgICAibWF4Wm9vbSI6IDE4LAogICAgICAgICJtaW5ab29tIjogMCwKICAgICAgICAibm9XcmFwIjogZmFsc2UsCiAgICAgICAgIm9wYWNpdHkiOiAxLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIsCiAgICAgICAgInRtcyI6IGZhbHNlCn0pLmFkZFRvKG1hcF8yYjFiODUzZDI1ZjM0OWE5YTNkYTM3ZDZjNDE3YTg2Zik7CiAgICAKICAgICAgICAgICAgTC5jb250cm9sLmZ1bGxzY3JlZW4oewogICAgICAgICAgICAgICAgcG9zaXRpb246ICd0b3ByaWdodCcsCiAgICAgICAgICAgICAgICB0aXRsZTogJ0V4cGFuZCBtZScsCiAgICAgICAgICAgICAgICB0aXRsZUNhbmNlbDogJ0V4aXQgbWUnLAogICAgICAgICAgICAgICAgZm9yY2VTZXBhcmF0ZUJ1dHRvbjogdHJ1ZSwKICAgICAgICAgICAgICAgIH0pLmFkZFRvKG1hcF8yYjFiODUzZDI1ZjM0OWE5YTNkYTM3ZDZjNDE3YTg2Zik7CiAgICAgICAgICAgIG1hcF8yYjFiODUzZDI1ZjM0OWE5YTNkYTM3ZDZjNDE3YTg2Zi5vbignZW50ZXJGdWxsc2NyZWVuJywgZnVuY3Rpb24oKXsKICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKCdlbnRlcmVkIGZ1bGxzY3JlZW4nKTsKICAgICAgICAgICAgfSk7CgogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bbb05978>"
+ "<folium.folium.Map at 0x1b7d5588e48>"
]
},
"execution_count": 8,
@@ -340,10 +340,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfMzcwNjgzNjcwZTJmNDBlN2EzNzYyMTJjZjA4ZmUxOGIgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvanF1ZXJ5LzIuMC4wL2pxdWVyeS5taW4uanMiPjwvc2NyaXB0PgogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2pxdWVyeXVpLzEuMTAuMi9qcXVlcnktdWkubWluLmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL3Jhd2dpdC5jb20vbmV6YXNhL2lzbzg2MDEtanMtcGVyaW9kL21hc3Rlci9pc284NjAxLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9yYXdnaXQuY29tL3NvY2liL0xlYWZsZXQuVGltZURpbWVuc2lvbi9tYXN0ZXIvZGlzdC9sZWFmbGV0LnRpbWVkaW1lbnNpb24ubWluLmpzIj48L3NjcmlwdD4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvaGlnaGxpZ2h0LmpzLzguNC9zdHlsZXMvZGVmYXVsdC5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHA6Ly9hcHBzLnNvY2liLmVzL0xlYWZsZXQuVGltZURpbWVuc2lvbi9kaXN0L2xlYWZsZXQudGltZWRpbWVuc2lvbi5jb250cm9sLm1pbi5jc3MiLz4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9tb21lbnQuanMvMi4xOC4xL21vbWVudC5taW4uanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF8zNzA2ODM2NzBlMmY0MGU3YTM3NjIxMmNmMDhmZTE4YiIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfMzcwNjgzNjcwZTJmNDBlN2EzNzYyMTJjZjA4ZmUxOGIgPSBMLm1hcCgKICAgICAgICAnbWFwXzM3MDY4MzY3MGUyZjQwZTdhMzc2MjEyY2YwOGZlMThiJywgewogICAgICAgIGNlbnRlcjogWzM1LjY4MTU5NjU5MDYxNTY5LCAxMzkuNzY0NTE1MTYxNTE0MjhdLAogICAgICAgIHpvb206IDE2LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NwogICAgICAgIH0pOwoKICAgIAogICAgCiAgICB2YXIgdGlsZV9sYXllcl84ZTkzM2RmNjc4YTU0ZGFiODQ0NTM2ZTZlMzNhYzJmNiA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIKfSkuYWRkVG8obWFwXzM3MDY4MzY3MGUyZjQwZTdhMzc2MjEyY2YwOGZlMThiKTsKICAgIAogICAgICAgICAgICBMLkNvbnRyb2wuVGltZURpbWVuc2lvbkN1c3RvbSA9IEwuQ29udHJvbC5UaW1lRGltZW5zaW9uLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBfZ2V0RGlzcGxheURhdGVGb3JtYXQ6IGZ1bmN0aW9uKGRhdGUpewogICAgICAgICAgICAgICAgICAgIHZhciBuZXdkYXRlID0gbmV3IG1vbWVudChkYXRlKTsKICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhuZXdkYXRlKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXdkYXRlLmZvcm1hdCgiWVlZWS9NTS9ERCBoaDptbTpzcyIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgbWFwXzM3MDY4MzY3MGUyZjQwZTdhMzc2MjEyY2YwOGZlMThiLnRpbWVEaW1lbnNpb24gPSBMLnRpbWVEaW1lbnNpb24oe3BlcmlvZDoiUFQxTSJ9KTsKICAgICAgICAgICAgdmFyIHRpbWVEaW1lbnNpb25Db250cm9sID0gbmV3IEwuQ29udHJvbC5UaW1lRGltZW5zaW9uQ3VzdG9tKHsKICAiYXV0b1BsYXkiOiB0cnVlLAogICJsb29wQnV0dG9uIjogZmFsc2UsCiAgIm1heFNwZWVkIjogMTAsCiAgIm1pblNwZWVkIjogMC4xLAogICJwbGF5ZXJPcHRpb25zIjogewogICAgImxvb3AiOiB0cnVlLAogICAgInN0YXJ0T3ZlciI6IHRydWUsCiAgICAidHJhbnNpdGlvblRpbWUiOiAyMDAKICB9LAogICJwb3NpdGlvbiI6ICJib3R0b21sZWZ0IiwKICAidGltZVNsaWRlckRyYWdVcGRhdGUiOiBmYWxzZQp9KTsKICAgICAgICAgICAgbWFwXzM3MDY4MzY3MGUyZjQwZTdhMzc2MjEyY2YwOGZlMThiLmFkZENvbnRyb2wodGhpcy50aW1lRGltZW5zaW9uQ29udHJvbCk7CgogICAgICAgICAgICBjb25zb2xlLmxvZygiIik7CgogICAgICAgICAgICB2YXIgZ2VvSnNvbkxheWVyID0gTC5nZW9Kc29uKHsidHlwZSI6ICJGZWF0dXJlQ29sbGVjdGlvbiIsICJmZWF0dXJlcyI6IFt7InR5cGUiOiAiRmVhdHVyZSIsICJnZW9tZXRyeSI6IHsidHlwZSI6ICJMaW5lU3RyaW5nIiwgImNvb3JkaW5hdGVzIjogW1sxMzkuNzY0NTE1MTYxNTE0MjgsIDM1LjY4MTU5NjU5MDYxNTY5XSwgWzEzOS43NTk2NDQyNjk5NDMyNCwgMzUuNjgyNTkwMDYyNjg0MjA2XV19LCAicHJvcGVydGllcyI6IHsidGltZXMiOiBbIjIwMTctMDYtMDJUMDA6MDA6MDAiLCAiMjAxNy0wNi0wMlQwMDoxMDowMCJdLCAic3R5bGUiOiB7ImNvbG9yIjogInJlZCIsICJ3ZWlnaHQiOiA1fX19LCB7InR5cGUiOiAiRmVhdHVyZSIsICJnZW9tZXRyeSI6IHsidHlwZSI6ICJMaW5lU3RyaW5nIiwgImNvb3JkaW5hdGVzIjogW1sxMzkuNzU5NjQ0MjY5OTQzMjQsIDM1LjY4MjU5MDA2MjY4NDIwNl0sIFsxMzkuNzU3NTg0MzMzNDE5OCwgMzUuNjc5NTA1MDMwMDM4NTA2XV19LCAicHJvcGVydGllcyI6IHsidGltZXMiOiBbIjIwMTctMDYtMDJUMDA6MTA6MDAiLCAiMjAxNy0wNi0wMlQwMDoyMDowMCJdLCAic3R5bGUiOiB7ImNvbG9yIjogImJsdWUiLCAid2VpZ2h0IjogNX19fSwgeyJ0eXBlIjogIkZlYXR1cmUiLCAiZ2VvbWV0cnkiOiB7InR5cGUiOiAiTGluZVN0cmluZyIsICJjb29yZGluYXRlcyI6IFtbMTM5Ljc1NzU4NDMzMzQxOTgsIDM1LjY3OTUwNTAzMDAzODUwNl0sIFsxMzkuNzYzMzc3OTA0ODkxOTcsIDM1LjY3ODA0MDkwNTAxNDA2NV1dfSwgInByb3BlcnRpZXMiOiB7InRpbWVzIjogWyIyMDE3LTA2LTAyVDAwOjIwOjAwIiwgIjIwMTctMDYtMDJUMDA6MzA6MDAiXSwgInN0eWxlIjogeyJjb2xvciI6ICJncmVlbiIsICJ3ZWlnaHQiOiAxNX19fSwgeyJ0eXBlIjogIkZlYXR1cmUiLCAiZ2VvbWV0cnkiOiB7InR5cGUiOiAiTGluZVN0cmluZyIsICJjb29yZGluYXRlcyI6IFtbMTM5Ljc2MzM3NzkwNDg5MTk3LCAzNS42NzgwNDA5MDUwMTQwNjVdLCBbMTM5Ljc2NDUxNTE2MTUxNDI4LCAzNS42ODE1OTY1OTA2MTU2OV1dfSwgInByb3BlcnRpZXMiOiB7InRpbWVzIjogWyIyMDE3LTA2LTAyVDAwOjMwOjAwIiwgIjIwMTctMDYtMDJUMDA6NDA6MDAiXSwgInN0eWxlIjogeyJjb2xvciI6ICIjRkZGRkZGIiwgIndlaWdodCI6IDV9fX1dfSwgewogICAgICAgICAgICAgICAgICAgIHBvaW50VG9MYXllcjogZnVuY3Rpb24gKGZlYXR1cmUsIGxhdExuZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmVhdHVyZS5wcm9wZXJ0aWVzLmljb24gPT0gJ21hcmtlcicpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGZlYXR1cmUucHJvcGVydGllcy5pY29uc3R5bGUpewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTC5NYXJrZXIobGF0TG5nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGljb246IEwuaWNvbihmZWF0dXJlLnByb3BlcnRpZXMuaWNvbnN0eWxlKX0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9lbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuTWFya2VyKGxhdExuZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmUucHJvcGVydGllcy5pY29uID09ICdjaXJjbGUnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmVhdHVyZS5wcm9wZXJ0aWVzLmljb25zdHlsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTC5jaXJjbGVNYXJrZXIobGF0TG5nLCBmZWF0dXJlLnByb3BlcnRpZXMuaWNvbnN0eWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2Vsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTC5jaXJjbGVNYXJrZXIobGF0TG5nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAvL2Vsc2UKCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTC5NYXJrZXIobGF0TG5nKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHN0eWxlOiBmdW5jdGlvbiAoZmVhdHVyZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmVhdHVyZS5wcm9wZXJ0aWVzLnN0eWxlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgb25FYWNoRmVhdHVyZTogZnVuY3Rpb24oZmVhdHVyZSwgbGF5ZXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmUucHJvcGVydGllcy5wb3B1cCkgewogICAgICAgICAgICAgICAgICAgICAgICBsYXllci5iaW5kUG9wdXAoZmVhdHVyZS5wcm9wZXJ0aWVzLnBvcHVwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pCgogICAgICAgICAgICB2YXIgdGltZXN0YW1wZWRfZ2VvX2pzb25fMTdiYTlkYjA2NGQ1NDA1MWI0YWExNTM4ZmJiNjM1OTAgPSBMLnRpbWVEaW1lbnNpb24ubGF5ZXIuZ2VvSnNvbihnZW9Kc29uTGF5ZXIsCiAgICAgICAgICAgICAgICB7dXBkYXRlVGltZURpbWVuc2lvbjogdHJ1ZSxhZGRsYXN0UG9pbnQ6IHRydWV9CiAgICAgICAgICAgICAgICApLmFkZFRvKG1hcF8zNzA2ODM2NzBlMmY0MGU3YTM3NjIxMmNmMDhmZTE4Yik7CiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfYTgyYTE3NDMwNWYzNDcxMGJhMmNjZWY3OTk3MWVlZTEgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvanF1ZXJ5LzIuMC4wL2pxdWVyeS5taW4uanMiPjwvc2NyaXB0PgogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2pxdWVyeXVpLzEuMTAuMi9qcXVlcnktdWkubWluLmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL3Jhd2dpdC5jb20vbmV6YXNhL2lzbzg2MDEtanMtcGVyaW9kL21hc3Rlci9pc284NjAxLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9yYXdnaXQuY29tL3NvY2liL0xlYWZsZXQuVGltZURpbWVuc2lvbi9tYXN0ZXIvZGlzdC9sZWFmbGV0LnRpbWVkaW1lbnNpb24ubWluLmpzIj48L3NjcmlwdD4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvaGlnaGxpZ2h0LmpzLzguNC9zdHlsZXMvZGVmYXVsdC5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHA6Ly9hcHBzLnNvY2liLmVzL0xlYWZsZXQuVGltZURpbWVuc2lvbi9kaXN0L2xlYWZsZXQudGltZWRpbWVuc2lvbi5jb250cm9sLm1pbi5jc3MiLz4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9tb21lbnQuanMvMi4xOC4xL21vbWVudC5taW4uanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF9hODJhMTc0MzA1ZjM0NzEwYmEyY2NlZjc5OTcxZWVlMSIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfYTgyYTE3NDMwNWYzNDcxMGJhMmNjZWY3OTk3MWVlZTEgPSBMLm1hcCgKICAgICAgICAnbWFwX2E4MmExNzQzMDVmMzQ3MTBiYTJjY2VmNzk5NzFlZWUxJywgewogICAgICAgIGNlbnRlcjogWzM1LjY4MTU5NjU5MDYxNTY5LCAxMzkuNzY0NTE1MTYxNTE0MjhdLAogICAgICAgIHpvb206IDE2LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfNGUwMmNiZDhjNmIyNDU2YTlhMTVlMmVlMGI2M2E4NTYgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwX2E4MmExNzQzMDVmMzQ3MTBiYTJjY2VmNzk5NzFlZWUxKTsKICAgIAogICAgICAgICAgICBMLkNvbnRyb2wuVGltZURpbWVuc2lvbkN1c3RvbSA9IEwuQ29udHJvbC5UaW1lRGltZW5zaW9uLmV4dGVuZCh7CiAgICAgICAgICAgICAgICBfZ2V0RGlzcGxheURhdGVGb3JtYXQ6IGZ1bmN0aW9uKGRhdGUpewogICAgICAgICAgICAgICAgICAgIHZhciBuZXdkYXRlID0gbmV3IG1vbWVudChkYXRlKTsKICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhuZXdkYXRlKQogICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXdkYXRlLmZvcm1hdCgiWVlZWS1NTS1ERCBISDptbTpzcyIpOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9KTsKICAgICAgICAgICAgbWFwX2E4MmExNzQzMDVmMzQ3MTBiYTJjY2VmNzk5NzFlZWUxLnRpbWVEaW1lbnNpb24gPSBMLnRpbWVEaW1lbnNpb24oe3BlcmlvZDoiUFQxTSJ9KTsKICAgICAgICAgICAgdmFyIHRpbWVEaW1lbnNpb25Db250cm9sID0gbmV3IEwuQ29udHJvbC5UaW1lRGltZW5zaW9uQ3VzdG9tKHsKICAiYXV0b1BsYXkiOiB0cnVlLAogICJsb29wQnV0dG9uIjogZmFsc2UsCiAgIm1heFNwZWVkIjogMTAsCiAgIm1pblNwZWVkIjogMC4xLAogICJwbGF5ZXJPcHRpb25zIjogewogICAgImxvb3AiOiB0cnVlLAogICAgInN0YXJ0T3ZlciI6IHRydWUsCiAgICAidHJhbnNpdGlvblRpbWUiOiAyMDAKICB9LAogICJwb3NpdGlvbiI6ICJib3R0b21sZWZ0IiwKICAidGltZVNsaWRlckRyYWdVcGRhdGUiOiBmYWxzZQp9KTsKICAgICAgICAgICAgbWFwX2E4MmExNzQzMDVmMzQ3MTBiYTJjY2VmNzk5NzFlZWUxLmFkZENvbnRyb2wodGhpcy50aW1lRGltZW5zaW9uQ29udHJvbCk7CgogICAgICAgICAgICBjb25zb2xlLmxvZygiIik7CgogICAgICAgICAgICB2YXIgZ2VvSnNvbkxheWVyID0gTC5nZW9Kc29uKHsidHlwZSI6ICJGZWF0dXJlQ29sbGVjdGlvbiIsICJmZWF0dXJlcyI6IFt7InR5cGUiOiAiRmVhdHVyZSIsICJnZW9tZXRyeSI6IHsidHlwZSI6ICJMaW5lU3RyaW5nIiwgImNvb3JkaW5hdGVzIjogW1sxMzkuNzY0NTE1MTYxNTE0MjgsIDM1LjY4MTU5NjU5MDYxNTY5XSwgWzEzOS43NTk2NDQyNjk5NDMyNCwgMzUuNjgyNTkwMDYyNjg0MjA2XV19LCAicHJvcGVydGllcyI6IHsidGltZXMiOiBbIjIwMTctMDYtMDJUMDA6MDA6MDAiLCAiMjAxNy0wNi0wMlQwMDoxMDowMCJdLCAic3R5bGUiOiB7ImNvbG9yIjogInJlZCIsICJ3ZWlnaHQiOiA1fX19LCB7InR5cGUiOiAiRmVhdHVyZSIsICJnZW9tZXRyeSI6IHsidHlwZSI6ICJMaW5lU3RyaW5nIiwgImNvb3JkaW5hdGVzIjogW1sxMzkuNzU5NjQ0MjY5OTQzMjQsIDM1LjY4MjU5MDA2MjY4NDIwNl0sIFsxMzkuNzU3NTg0MzMzNDE5OCwgMzUuNjc5NTA1MDMwMDM4NTA2XV19LCAicHJvcGVydGllcyI6IHsidGltZXMiOiBbIjIwMTctMDYtMDJUMDA6MTA6MDAiLCAiMjAxNy0wNi0wMlQwMDoyMDowMCJdLCAic3R5bGUiOiB7ImNvbG9yIjogImJsdWUiLCAid2VpZ2h0IjogNX19fSwgeyJ0eXBlIjogIkZlYXR1cmUiLCAiZ2VvbWV0cnkiOiB7InR5cGUiOiAiTGluZVN0cmluZyIsICJjb29yZGluYXRlcyI6IFtbMTM5Ljc1NzU4NDMzMzQxOTgsIDM1LjY3OTUwNTAzMDAzODUwNl0sIFsxMzkuNzYzMzc3OTA0ODkxOTcsIDM1LjY3ODA0MDkwNTAxNDA2NV1dfSwgInByb3BlcnRpZXMiOiB7InRpbWVzIjogWyIyMDE3LTA2LTAyVDAwOjIwOjAwIiwgIjIwMTctMDYtMDJUMDA6MzA6MDAiXSwgInN0eWxlIjogeyJjb2xvciI6ICJncmVlbiIsICJ3ZWlnaHQiOiAxNX19fSwgeyJ0eXBlIjogIkZlYXR1cmUiLCAiZ2VvbWV0cnkiOiB7InR5cGUiOiAiTGluZVN0cmluZyIsICJjb29yZGluYXRlcyI6IFtbMTM5Ljc2MzM3NzkwNDg5MTk3LCAzNS42NzgwNDA5MDUwMTQwNjVdLCBbMTM5Ljc2NDUxNTE2MTUxNDI4LCAzNS42ODE1OTY1OTA2MTU2OV1dfSwgInByb3BlcnRpZXMiOiB7InRpbWVzIjogWyIyMDE3LTA2LTAyVDAwOjMwOjAwIiwgIjIwMTctMDYtMDJUMDA6NDA6MDAiXSwgInN0eWxlIjogeyJjb2xvciI6ICIjRkZGRkZGIiwgIndlaWdodCI6IDV9fX1dfSwgewogICAgICAgICAgICAgICAgICAgIHBvaW50VG9MYXllcjogZnVuY3Rpb24gKGZlYXR1cmUsIGxhdExuZykgewogICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmVhdHVyZS5wcm9wZXJ0aWVzLmljb24gPT0gJ21hcmtlcicpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKGZlYXR1cmUucHJvcGVydGllcy5pY29uc3R5bGUpewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTC5NYXJrZXIobGF0TG5nLCB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGljb246IEwuaWNvbihmZWF0dXJlLnByb3BlcnRpZXMuaWNvbnN0eWxlKX0pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9lbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuTWFya2VyKGxhdExuZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmUucHJvcGVydGllcy5pY29uID09ICdjaXJjbGUnKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoZmVhdHVyZS5wcm9wZXJ0aWVzLmljb25zdHlsZSkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTC5jaXJjbGVNYXJrZXIobGF0TG5nLCBmZWF0dXJlLnByb3BlcnRpZXMuaWNvbnN0eWxlKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvL2Vsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTC5jaXJjbGVNYXJrZXIobGF0TG5nKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAvL2Vsc2UKCiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBuZXcgTC5NYXJrZXIobGF0TG5nKTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIHN0eWxlOiBmdW5jdGlvbiAoZmVhdHVyZSkgewogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmVhdHVyZS5wcm9wZXJ0aWVzLnN0eWxlOwogICAgICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAgICAgb25FYWNoRmVhdHVyZTogZnVuY3Rpb24oZmVhdHVyZSwgbGF5ZXIpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmUucHJvcGVydGllcy5wb3B1cCkgewogICAgICAgICAgICAgICAgICAgICAgICBsYXllci5iaW5kUG9wdXAoZmVhdHVyZS5wcm9wZXJ0aWVzLnBvcHVwKTsKICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIH0pCgogICAgICAgICAgICB2YXIgdGltZXN0YW1wZWRfZ2VvX2pzb25fMjgyNDg3MDFiYmYzNDNmYjk5NDFkMGRhODNlYTVhMDIgPSBMLnRpbWVEaW1lbnNpb24ubGF5ZXIuZ2VvSnNvbihnZW9Kc29uTGF5ZXIsCiAgICAgICAgICAgICAgICB7dXBkYXRlVGltZURpbWVuc2lvbjogdHJ1ZSwKICAgICAgICAgICAgICAgICBhZGRsYXN0UG9pbnQ6IHRydWUsCiAgICAgICAgICAgICAgICAgZHVyYXRpb246IHVuZGVmaW5lZCwKICAgICAgICAgICAgICAgIH0pLmFkZFRvKG1hcF9hODJhMTc0MzA1ZjM0NzEwYmEyY2NlZjc5OTcxZWVlMSk7CiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bba0f9e8>"
+ "<folium.folium.Map at 0x1b7d55eb940>"
]
},
"execution_count": 9,
@@ -450,10 +450,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfNjE1NWFiZThmZTgwNDA1YWFlYTIwNDQwNTQ1M2NiY2YgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvanF1ZXJ5LzIuMC4wL2pxdWVyeS5taW4uanMiPjwvc2NyaXB0PgogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2pxdWVyeXVpLzEuMTAuMi9qcXVlcnktdWkubWluLmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL3Jhd2dpdC5jb20vbmV6YXNhL2lzbzg2MDEtanMtcGVyaW9kL21hc3Rlci9pc284NjAxLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9yYXdnaXQuY29tL3NvY2liL0xlYWZsZXQuVGltZURpbWVuc2lvbi9tYXN0ZXIvZGlzdC9sZWFmbGV0LnRpbWVkaW1lbnNpb24ubWluLmpzIj48L3NjcmlwdD4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvaGlnaGxpZ2h0LmpzLzguNC9zdHlsZXMvZGVmYXVsdC5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHA6Ly9hcHBzLnNvY2liLmVzL0xlYWZsZXQuVGltZURpbWVuc2lvbi9kaXN0L2xlYWZsZXQudGltZWRpbWVuc2lvbi5jb250cm9sLm1pbi5jc3MiLz4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9tb21lbnQuanMvMi4xOC4xL21vbWVudC5taW4uanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF82MTU1YWJlOGZlODA0MDVhYWVhMjA0NDA1NDUzY2JjZiIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfNjE1NWFiZThmZTgwNDA1YWFlYTIwNDQwNTQ1M2NiY2YgPSBMLm1hcCgKICAgICAgICAnbWFwXzYxNTVhYmU4ZmU4MDQwNWFhZWEyMDQ0MDU0NTNjYmNmJywgewogICAgICAgIGNlbnRlcjogWzU2LjA5NjU1NSwgLTMuNjQ3NDZdLAogICAgICAgIHpvb206IDUsCiAgICAgICAgbWF4Qm91bmRzOiBib3VuZHMsCiAgICAgICAgbGF5ZXJzOiBbXSwKICAgICAgICB3b3JsZENvcHlKdW1wOiBmYWxzZSwKICAgICAgICBjcnM6IEwuQ1JTLkVQU0czODU3CiAgICAgICAgfSk7CgogICAgCiAgICAKICAgIHZhciB0aWxlX2xheWVyXzU1OWM3YWYxODBmMDQ2MDRhNmZiNWQ0NjI4YzMxOGNmID0gTC50aWxlTGF5ZXIoCiAgICAgICAgJ2h0dHBzOi8vY2FydG9kYi1iYXNlbWFwcy17c30uZ2xvYmFsLnNzbC5mYXN0bHkubmV0L2xpZ2h0X2FsbC97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiCn0pLmFkZFRvKG1hcF82MTU1YWJlOGZlODA0MDVhYWVhMjA0NDA1NDUzY2JjZik7CiAgICAKICAgICAgICAgICAgTC5Db250cm9sLlRpbWVEaW1lbnNpb25DdXN0b20gPSBMLkNvbnRyb2wuVGltZURpbWVuc2lvbi5leHRlbmQoewogICAgICAgICAgICAgICAgX2dldERpc3BsYXlEYXRlRm9ybWF0OiBmdW5jdGlvbihkYXRlKXsKICAgICAgICAgICAgICAgICAgICB2YXIgbmV3ZGF0ZSA9IG5ldyBtb21lbnQoZGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cobmV3ZGF0ZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3ZGF0ZS5mb3JtYXQoIllZWVkvTU0vREQiKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIG1hcF82MTU1YWJlOGZlODA0MDVhYWVhMjA0NDA1NDUzY2JjZi50aW1lRGltZW5zaW9uID0gTC50aW1lRGltZW5zaW9uKHtwZXJpb2Q6IlAxTSJ9KTsKICAgICAgICAgICAgdmFyIHRpbWVEaW1lbnNpb25Db250cm9sID0gbmV3IEwuQ29udHJvbC5UaW1lRGltZW5zaW9uQ3VzdG9tKHsKICAiYXV0b1BsYXkiOiBmYWxzZSwKICAibG9vcEJ1dHRvbiI6IHRydWUsCiAgIm1heFNwZWVkIjogMSwKICAibWluU3BlZWQiOiAwLjEsCiAgInBsYXllck9wdGlvbnMiOiB7CiAgICAibG9vcCI6IGZhbHNlLAogICAgInN0YXJ0T3ZlciI6IHRydWUsCiAgICAidHJhbnNpdGlvblRpbWUiOiAyMDAKICB9LAogICJwb3NpdGlvbiI6ICJib3R0b21sZWZ0IiwKICAidGltZVNsaWRlckRyYWdVcGRhdGUiOiB0cnVlCn0pOwogICAgICAgICAgICBtYXBfNjE1NWFiZThmZTgwNDA1YWFlYTIwNDQwNTQ1M2NiY2YuYWRkQ29udHJvbCh0aGlzLnRpbWVEaW1lbnNpb25Db250cm9sKTsKCiAgICAgICAgICAgIGNvbnNvbGUubG9nKCIiKTsKCiAgICAgICAgICAgIHZhciBnZW9Kc29uTGF5ZXIgPSBMLmdlb0pzb24oeyJ0eXBlIjogIkZlYXR1cmVDb2xsZWN0aW9uIiwgImZlYXR1cmVzIjogW3sidHlwZSI6ICJGZWF0dXJlIiwgImdlb21ldHJ5IjogeyJ0eXBlIjogIlBvaW50IiwgImNvb3JkaW5hdGVzIjogWy0yLjU0ODgyOCwgNTEuNDY3Njk3XX0sICJwcm9wZXJ0aWVzIjogeyJ0aW1lIjogIjIwMTctMDYtMDIiLCAicG9wdXAiOiAiPGgxPmFkZHJlc3MxPC9oMT4iLCAiaWQiOiAiaG91c2UiLCAiaWNvbiI6ICJtYXJrZXIiLCAiaWNvbnN0eWxlIjogeyJpY29uVXJsIjogImh0dHA6Ly9kb3dubG9hZGljb25zLm5ldC9zaXRlcy9kZWZhdWx0L2ZpbGVzL3NtYWxsLWhvdXNlLXdpdGgtYS1jaGltbmV5LWljb24tNzAwNTMucG5nIiwgImljb25TaXplIjogWzIwLCAyMF19fX0sIHsidHlwZSI6ICJGZWF0dXJlIiwgImdlb21ldHJ5IjogeyJ0eXBlIjogIlBvaW50IiwgImNvb3JkaW5hdGVzIjogWy0wLjA4Nzg5MSwgNTEuNTM2MDg2XX0sICJwcm9wZXJ0aWVzIjogeyJ0aW1lIjogIjIwMTctMDctMDIiLCAicG9wdXAiOiAiPGgyIHN0eWxlPVwiY29sb3I6Ymx1ZTtcIj5hZGRyZXNzMjxoMj4iLCAiaWQiOiAiaG91c2UiLCAiaWNvbiI6ICJtYXJrZXIiLCAiaWNvbnN0eWxlIjogeyJpY29uVXJsIjogImh0dHA6Ly9kb3dubG9hZGljb25zLm5ldC9zaXRlcy9kZWZhdWx0L2ZpbGVzL3NtYWxsLWhvdXNlLXdpdGgtYS1jaGltbmV5LWljb24tNzAwNTMucG5nIiwgImljb25TaXplIjogWzIwLCAyMF19fX0sIHsidHlwZSI6ICJGZWF0dXJlIiwgImdlb21ldHJ5IjogeyJ0eXBlIjogIlBvaW50IiwgImNvb3JkaW5hdGVzIjogWy02LjI0MDIzNCwgNTMuMzgzMzI4XX0sICJwcm9wZXJ0aWVzIjogeyJ0aW1lIjogIjIwMTctMDgtMDIiLCAicG9wdXAiOiAiPGgyIHN0eWxlPVwiY29sb3I6b3JhbmdlO1wiPmFkZHJlc3MzPGgyPiIsICJpZCI6ICJob3VzZSIsICJpY29uIjogIm1hcmtlciIsICJpY29uc3R5bGUiOiB7Imljb25VcmwiOiAiaHR0cDovL2Rvd25sb2FkaWNvbnMubmV0L3NpdGVzL2RlZmF1bHQvZmlsZXMvc21hbGwtaG91c2Utd2l0aC1hLWNoaW1uZXktaWNvbi03MDA1My5wbmciLCAiaWNvblNpemUiOiBbMjAsIDIwXX19fSwgeyJ0eXBlIjogIkZlYXR1cmUiLCAiZ2VvbWV0cnkiOiB7InR5cGUiOiAiUG9pbnQiLCAiY29vcmRpbmF0ZXMiOiBbLTEuNDA2MjUsIDYwLjI2MTYxN119LCAicHJvcGVydGllcyI6IHsidGltZSI6ICIyMDE3LTA5LTAyIiwgInBvcHVwIjogIjxoMiBzdHlsZT1cImNvbG9yOmdyZWVuO1wiPmFkZHJlc3M0PGgyPiIsICJpZCI6ICJob3VzZSIsICJpY29uIjogIm1hcmtlciIsICJpY29uc3R5bGUiOiB7Imljb25VcmwiOiAiaHR0cDovL2Rvd25sb2FkaWNvbnMubmV0L3NpdGVzL2RlZmF1bHQvZmlsZXMvc21hbGwtaG91c2Utd2l0aC1hLWNoaW1uZXktaWNvbi03MDA1My5wbmciLCAiaWNvblNpemUiOiBbMjAsIDIwXX19fSwgeyJ0eXBlIjogIkZlYXR1cmUiLCAiZ2VvbWV0cnkiOiB7InR5cGUiOiAiUG9pbnQiLCAiY29vcmRpbmF0ZXMiOiBbLTEuNTE2MTEzLCA1My44MDA2NTFdfSwgInByb3BlcnRpZXMiOiB7InRpbWUiOiAiMjAxNy0xMC0wMiIsICJwb3B1cCI6ICI8dGFibGUgc3R5bGU9XCJ3aWR0aDoxMDAlXCI+XG4gIDx0cj5cbiAgICA8dGg+Rmlyc3RuYW1lPC90aD5cbiAgICA8dGg+TGFzdG5hbWU8L3RoPiBcbiAgICA8dGg+QWdlPC90aD5cbiAgPC90cj5cbiAgPHRyPlxuICAgIDx0ZD5KaWxsPC90ZD5cbiAgICA8dGQ+U21pdGg8L3RkPiBcbiAgICA8dGQ+NTA8L3RkPlxuICA8L3RyPlxuICA8dHI+XG4gICAgPHRkPkV2ZTwvdGQ+XG4gICAgPHRkPkphY2tzb248L3RkPiBcbiAgICA8dGQ+OTQ8L3RkPlxuICA8L3RyPlxuPC90YWJsZT4iLCAiaWQiOiAiaG91c2UiLCAiaWNvbiI6ICJtYXJrZXIiLCAiaWNvbnN0eWxlIjogeyJpY29uVXJsIjogImh0dHA6Ly9kb3dubG9hZGljb25zLm5ldC9zaXRlcy9kZWZhdWx0L2ZpbGVzL3NtYWxsLWhvdXNlLXdpdGgtYS1jaGltbmV5LWljb24tNzAwNTMucG5nIiwgImljb25TaXplIjogWzIwLCAyMF19fX0sIHsidHlwZSI6ICJGZWF0dXJlIiwgImdlb21ldHJ5IjogeyJ0eXBlIjogIkxpbmVTdHJpbmciLCAiY29vcmRpbmF0ZXMiOiBbWy0yLjU0ODgyOCwgNTEuNDY3Njk3XSwgWy0wLjA4Nzg5MSwgNTEuNTM2MDg2XSwgWy02LjI0MDIzNCwgNTMuMzgzMzI4XSwgWy0xLjQwNjI1LCA2MC4yNjE2MTddLCBbLTEuNTE2MTEzLCA1My44MDA2NTFdXX0sICJwcm9wZXJ0aWVzIjogeyJwb3B1cCI6ICJDdXJyZW50IGFkZHJlc3MiLCAidGltZXMiOiBbIjIwMTctMDYtMDIiLCAiMjAxNy0wNy0wMiIsICIyMDE3LTA4LTAyIiwgIjIwMTctMDktMDIiLCAiMjAxNy0xMC0wMiJdLCAiaWNvbiI6ICJjaXJjbGUiLCAiaWNvbnN0eWxlIjogeyJmaWxsQ29sb3IiOiAiZ3JlZW4iLCAiZmlsbE9wYWNpdHkiOiAwLjYsICJzdHJva2UiOiAiZmFsc2UiLCAicmFkaXVzIjogMTN9LCAic3R5bGUiOiB7IndlaWdodCI6IDB9LCAiaWQiOiAibWFuIn19XX0sIHsKICAgICAgICAgICAgICAgICAgICBwb2ludFRvTGF5ZXI6IGZ1bmN0aW9uIChmZWF0dXJlLCBsYXRMbmcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmUucHJvcGVydGllcy5pY29uID09ICdtYXJrZXInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihmZWF0dXJlLnByb3BlcnRpZXMuaWNvbnN0eWxlKXsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuTWFya2VyKGxhdExuZywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpY29uOiBMLmljb24oZmVhdHVyZS5wcm9wZXJ0aWVzLmljb25zdHlsZSl9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBMLk1hcmtlcihsYXRMbmcpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmZWF0dXJlLnByb3BlcnRpZXMuaWNvbiA9PSAnY2lyY2xlJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmUucHJvcGVydGllcy5pY29uc3R5bGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuY2lyY2xlTWFya2VyKGxhdExuZywgZmVhdHVyZS5wcm9wZXJ0aWVzLmljb25zdHlsZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9lbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuY2lyY2xlTWFya2VyKGxhdExuZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgLy9lbHNlCgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuTWFya2VyKGxhdExuZyk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzdHlsZTogZnVuY3Rpb24gKGZlYXR1cmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZlYXR1cmUucHJvcGVydGllcy5zdHlsZTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG9uRWFjaEZlYXR1cmU6IGZ1bmN0aW9uKGZlYXR1cmUsIGxheWVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmZWF0dXJlLnByb3BlcnRpZXMucG9wdXApIHsKICAgICAgICAgICAgICAgICAgICAgICAgbGF5ZXIuYmluZFBvcHVwKGZlYXR1cmUucHJvcGVydGllcy5wb3B1cCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KQoKICAgICAgICAgICAgdmFyIHRpbWVzdGFtcGVkX2dlb19qc29uX2FmNTJkMGU1NTZmODRhYWU4NWUxZjBjZTcxYmE3ODBjID0gTC50aW1lRGltZW5zaW9uLmxheWVyLmdlb0pzb24oZ2VvSnNvbkxheWVyLAogICAgICAgICAgICAgICAge3VwZGF0ZVRpbWVEaW1lbnNpb246IHRydWUsYWRkbGFzdFBvaW50OiB0cnVlfQogICAgICAgICAgICAgICAgKS5hZGRUbyhtYXBfNjE1NWFiZThmZTgwNDA1YWFlYTIwNDQwNTQ1M2NiY2YpOwogICAgICAgIAo8L3NjcmlwdD4=\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfNWE4ZGQxZDBmZGZlNDllYTgxYWJjOTc4NTQ2ZThhNmMgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvanF1ZXJ5LzIuMC4wL2pxdWVyeS5taW4uanMiPjwvc2NyaXB0PgogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2pxdWVyeXVpLzEuMTAuMi9qcXVlcnktdWkubWluLmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL3Jhd2dpdC5jb20vbmV6YXNhL2lzbzg2MDEtanMtcGVyaW9kL21hc3Rlci9pc284NjAxLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9yYXdnaXQuY29tL3NvY2liL0xlYWZsZXQuVGltZURpbWVuc2lvbi9tYXN0ZXIvZGlzdC9sZWFmbGV0LnRpbWVkaW1lbnNpb24ubWluLmpzIj48L3NjcmlwdD4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvaGlnaGxpZ2h0LmpzLzguNC9zdHlsZXMvZGVmYXVsdC5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHA6Ly9hcHBzLnNvY2liLmVzL0xlYWZsZXQuVGltZURpbWVuc2lvbi9kaXN0L2xlYWZsZXQudGltZWRpbWVuc2lvbi5jb250cm9sLm1pbi5jc3MiLz4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9tb21lbnQuanMvMi4xOC4xL21vbWVudC5taW4uanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF81YThkZDFkMGZkZmU0OWVhODFhYmM5Nzg1NDZlOGE2YyIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfNWE4ZGQxZDBmZGZlNDllYTgxYWJjOTc4NTQ2ZThhNmMgPSBMLm1hcCgKICAgICAgICAnbWFwXzVhOGRkMWQwZmRmZTQ5ZWE4MWFiYzk3ODU0NmU4YTZjJywgewogICAgICAgIGNlbnRlcjogWzU2LjA5NjU1NSwgLTMuNjQ3NDZdLAogICAgICAgIHpvb206IDUsCiAgICAgICAgbWF4Qm91bmRzOiBib3VuZHMsCiAgICAgICAgbGF5ZXJzOiBbXSwKICAgICAgICB3b3JsZENvcHlKdW1wOiBmYWxzZSwKICAgICAgICBjcnM6IEwuQ1JTLkVQU0czODU3LAogICAgICAgIHpvb21Db250cm9sOiB0cnVlLAogICAgICAgIH0pOwoKICAgIAogICAgCiAgICB2YXIgdGlsZV9sYXllcl8yZTI3Njk2ZTM0NDU0YWQ0YjY3ZjQ2YzkxY2ExMzU1NCA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL2NhcnRvZGItYmFzZW1hcHMte3N9Lmdsb2JhbC5zc2wuZmFzdGx5Lm5ldC9saWdodF9hbGwve3p9L3t4fS97eX0ucG5nJywKICAgICAgICB7CiAgICAgICAgImF0dHJpYnV0aW9uIjogbnVsbCwKICAgICAgICAiZGV0ZWN0UmV0aW5hIjogZmFsc2UsCiAgICAgICAgIm1heE5hdGl2ZVpvb20iOiAxOCwKICAgICAgICAibWF4Wm9vbSI6IDE4LAogICAgICAgICJtaW5ab29tIjogMCwKICAgICAgICAibm9XcmFwIjogZmFsc2UsCiAgICAgICAgIm9wYWNpdHkiOiAxLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIsCiAgICAgICAgInRtcyI6IGZhbHNlCn0pLmFkZFRvKG1hcF81YThkZDFkMGZkZmU0OWVhODFhYmM5Nzg1NDZlOGE2Yyk7CiAgICAKICAgICAgICAgICAgTC5Db250cm9sLlRpbWVEaW1lbnNpb25DdXN0b20gPSBMLkNvbnRyb2wuVGltZURpbWVuc2lvbi5leHRlbmQoewogICAgICAgICAgICAgICAgX2dldERpc3BsYXlEYXRlRm9ybWF0OiBmdW5jdGlvbihkYXRlKXsKICAgICAgICAgICAgICAgICAgICB2YXIgbmV3ZGF0ZSA9IG5ldyBtb21lbnQoZGF0ZSk7CiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2cobmV3ZGF0ZSkKICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3ZGF0ZS5mb3JtYXQoIllZWVkvTU0vREQiKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSk7CiAgICAgICAgICAgIG1hcF81YThkZDFkMGZkZmU0OWVhODFhYmM5Nzg1NDZlOGE2Yy50aW1lRGltZW5zaW9uID0gTC50aW1lRGltZW5zaW9uKHtwZXJpb2Q6IlAxTSJ9KTsKICAgICAgICAgICAgdmFyIHRpbWVEaW1lbnNpb25Db250cm9sID0gbmV3IEwuQ29udHJvbC5UaW1lRGltZW5zaW9uQ3VzdG9tKHsKICAiYXV0b1BsYXkiOiBmYWxzZSwKICAibG9vcEJ1dHRvbiI6IHRydWUsCiAgIm1heFNwZWVkIjogMSwKICAibWluU3BlZWQiOiAwLjEsCiAgInBsYXllck9wdGlvbnMiOiB7CiAgICAibG9vcCI6IGZhbHNlLAogICAgInN0YXJ0T3ZlciI6IHRydWUsCiAgICAidHJhbnNpdGlvblRpbWUiOiAyMDAKICB9LAogICJwb3NpdGlvbiI6ICJib3R0b21sZWZ0IiwKICAidGltZVNsaWRlckRyYWdVcGRhdGUiOiB0cnVlCn0pOwogICAgICAgICAgICBtYXBfNWE4ZGQxZDBmZGZlNDllYTgxYWJjOTc4NTQ2ZThhNmMuYWRkQ29udHJvbCh0aGlzLnRpbWVEaW1lbnNpb25Db250cm9sKTsKCiAgICAgICAgICAgIGNvbnNvbGUubG9nKCIiKTsKCiAgICAgICAgICAgIHZhciBnZW9Kc29uTGF5ZXIgPSBMLmdlb0pzb24oeyJ0eXBlIjogIkZlYXR1cmVDb2xsZWN0aW9uIiwgImZlYXR1cmVzIjogW3sidHlwZSI6ICJGZWF0dXJlIiwgImdlb21ldHJ5IjogeyJ0eXBlIjogIlBvaW50IiwgImNvb3JkaW5hdGVzIjogWy0yLjU0ODgyOCwgNTEuNDY3Njk3XX0sICJwcm9wZXJ0aWVzIjogeyJ0aW1lIjogIjIwMTctMDYtMDIiLCAicG9wdXAiOiAiPGgxPmFkZHJlc3MxPC9oMT4iLCAiaWQiOiAiaG91c2UiLCAiaWNvbiI6ICJtYXJrZXIiLCAiaWNvbnN0eWxlIjogeyJpY29uVXJsIjogImh0dHA6Ly9kb3dubG9hZGljb25zLm5ldC9zaXRlcy9kZWZhdWx0L2ZpbGVzL3NtYWxsLWhvdXNlLXdpdGgtYS1jaGltbmV5LWljb24tNzAwNTMucG5nIiwgImljb25TaXplIjogWzIwLCAyMF19fX0sIHsidHlwZSI6ICJGZWF0dXJlIiwgImdlb21ldHJ5IjogeyJ0eXBlIjogIlBvaW50IiwgImNvb3JkaW5hdGVzIjogWy0wLjA4Nzg5MSwgNTEuNTM2MDg2XX0sICJwcm9wZXJ0aWVzIjogeyJ0aW1lIjogIjIwMTctMDctMDIiLCAicG9wdXAiOiAiPGgyIHN0eWxlPVwiY29sb3I6Ymx1ZTtcIj5hZGRyZXNzMjxoMj4iLCAiaWQiOiAiaG91c2UiLCAiaWNvbiI6ICJtYXJrZXIiLCAiaWNvbnN0eWxlIjogeyJpY29uVXJsIjogImh0dHA6Ly9kb3dubG9hZGljb25zLm5ldC9zaXRlcy9kZWZhdWx0L2ZpbGVzL3NtYWxsLWhvdXNlLXdpdGgtYS1jaGltbmV5LWljb24tNzAwNTMucG5nIiwgImljb25TaXplIjogWzIwLCAyMF19fX0sIHsidHlwZSI6ICJGZWF0dXJlIiwgImdlb21ldHJ5IjogeyJ0eXBlIjogIlBvaW50IiwgImNvb3JkaW5hdGVzIjogWy02LjI0MDIzNCwgNTMuMzgzMzI4XX0sICJwcm9wZXJ0aWVzIjogeyJ0aW1lIjogIjIwMTctMDgtMDIiLCAicG9wdXAiOiAiPGgyIHN0eWxlPVwiY29sb3I6b3JhbmdlO1wiPmFkZHJlc3MzPGgyPiIsICJpZCI6ICJob3VzZSIsICJpY29uIjogIm1hcmtlciIsICJpY29uc3R5bGUiOiB7Imljb25VcmwiOiAiaHR0cDovL2Rvd25sb2FkaWNvbnMubmV0L3NpdGVzL2RlZmF1bHQvZmlsZXMvc21hbGwtaG91c2Utd2l0aC1hLWNoaW1uZXktaWNvbi03MDA1My5wbmciLCAiaWNvblNpemUiOiBbMjAsIDIwXX19fSwgeyJ0eXBlIjogIkZlYXR1cmUiLCAiZ2VvbWV0cnkiOiB7InR5cGUiOiAiUG9pbnQiLCAiY29vcmRpbmF0ZXMiOiBbLTEuNDA2MjUsIDYwLjI2MTYxN119LCAicHJvcGVydGllcyI6IHsidGltZSI6ICIyMDE3LTA5LTAyIiwgInBvcHVwIjogIjxoMiBzdHlsZT1cImNvbG9yOmdyZWVuO1wiPmFkZHJlc3M0PGgyPiIsICJpZCI6ICJob3VzZSIsICJpY29uIjogIm1hcmtlciIsICJpY29uc3R5bGUiOiB7Imljb25VcmwiOiAiaHR0cDovL2Rvd25sb2FkaWNvbnMubmV0L3NpdGVzL2RlZmF1bHQvZmlsZXMvc21hbGwtaG91c2Utd2l0aC1hLWNoaW1uZXktaWNvbi03MDA1My5wbmciLCAiaWNvblNpemUiOiBbMjAsIDIwXX19fSwgeyJ0eXBlIjogIkZlYXR1cmUiLCAiZ2VvbWV0cnkiOiB7InR5cGUiOiAiUG9pbnQiLCAiY29vcmRpbmF0ZXMiOiBbLTEuNTE2MTEzLCA1My44MDA2NTFdfSwgInByb3BlcnRpZXMiOiB7InRpbWUiOiAiMjAxNy0xMC0wMiIsICJwb3B1cCI6ICI8dGFibGUgc3R5bGU9XCJ3aWR0aDoxMDAlXCI+XG4gIDx0cj5cbiAgICA8dGg+Rmlyc3RuYW1lPC90aD5cbiAgICA8dGg+TGFzdG5hbWU8L3RoPiBcbiAgICA8dGg+QWdlPC90aD5cbiAgPC90cj5cbiAgPHRyPlxuICAgIDx0ZD5KaWxsPC90ZD5cbiAgICA8dGQ+U21pdGg8L3RkPiBcbiAgICA8dGQ+NTA8L3RkPlxuICA8L3RyPlxuICA8dHI+XG4gICAgPHRkPkV2ZTwvdGQ+XG4gICAgPHRkPkphY2tzb248L3RkPiBcbiAgICA8dGQ+OTQ8L3RkPlxuICA8L3RyPlxuPC90YWJsZT4iLCAiaWQiOiAiaG91c2UiLCAiaWNvbiI6ICJtYXJrZXIiLCAiaWNvbnN0eWxlIjogeyJpY29uVXJsIjogImh0dHA6Ly9kb3dubG9hZGljb25zLm5ldC9zaXRlcy9kZWZhdWx0L2ZpbGVzL3NtYWxsLWhvdXNlLXdpdGgtYS1jaGltbmV5LWljb24tNzAwNTMucG5nIiwgImljb25TaXplIjogWzIwLCAyMF19fX0sIHsidHlwZSI6ICJGZWF0dXJlIiwgImdlb21ldHJ5IjogeyJ0eXBlIjogIkxpbmVTdHJpbmciLCAiY29vcmRpbmF0ZXMiOiBbWy0yLjU0ODgyOCwgNTEuNDY3Njk3XSwgWy0wLjA4Nzg5MSwgNTEuNTM2MDg2XSwgWy02LjI0MDIzNCwgNTMuMzgzMzI4XSwgWy0xLjQwNjI1LCA2MC4yNjE2MTddLCBbLTEuNTE2MTEzLCA1My44MDA2NTFdXX0sICJwcm9wZXJ0aWVzIjogeyJwb3B1cCI6ICJDdXJyZW50IGFkZHJlc3MiLCAidGltZXMiOiBbIjIwMTctMDYtMDIiLCAiMjAxNy0wNy0wMiIsICIyMDE3LTA4LTAyIiwgIjIwMTctMDktMDIiLCAiMjAxNy0xMC0wMiJdLCAiaWNvbiI6ICJjaXJjbGUiLCAiaWNvbnN0eWxlIjogeyJmaWxsQ29sb3IiOiAiZ3JlZW4iLCAiZmlsbE9wYWNpdHkiOiAwLjYsICJzdHJva2UiOiAiZmFsc2UiLCAicmFkaXVzIjogMTN9LCAic3R5bGUiOiB7IndlaWdodCI6IDB9LCAiaWQiOiAibWFuIn19XX0sIHsKICAgICAgICAgICAgICAgICAgICBwb2ludFRvTGF5ZXI6IGZ1bmN0aW9uIChmZWF0dXJlLCBsYXRMbmcpIHsKICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmUucHJvcGVydGllcy5pY29uID09ICdtYXJrZXInKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZihmZWF0dXJlLnByb3BlcnRpZXMuaWNvbnN0eWxlKXsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuTWFya2VyKGxhdExuZywgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpY29uOiBMLmljb24oZmVhdHVyZS5wcm9wZXJ0aWVzLmljb25zdHlsZSl9KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vZWxzZQogICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBMLk1hcmtlcihsYXRMbmcpOwogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmZWF0dXJlLnByb3BlcnRpZXMuaWNvbiA9PSAnY2lyY2xlJykgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGZlYXR1cmUucHJvcGVydGllcy5pY29uc3R5bGUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuY2lyY2xlTWFya2VyKGxhdExuZywgZmVhdHVyZS5wcm9wZXJ0aWVzLmljb25zdHlsZSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9OwogICAgICAgICAgICAgICAgICAgICAgICAgICAgLy9lbHNlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuY2lyY2xlTWFya2VyKGxhdExuZyk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICAgICAgLy9lbHNlCgogICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEwuTWFya2VyKGxhdExuZyk7CiAgICAgICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICAgICBzdHlsZTogZnVuY3Rpb24gKGZlYXR1cmUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIGZlYXR1cmUucHJvcGVydGllcy5zdHlsZTsKICAgICAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgICAgIG9uRWFjaEZlYXR1cmU6IGZ1bmN0aW9uKGZlYXR1cmUsIGxheWVyKSB7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChmZWF0dXJlLnByb3BlcnRpZXMucG9wdXApIHsKICAgICAgICAgICAgICAgICAgICAgICAgbGF5ZXIuYmluZFBvcHVwKGZlYXR1cmUucHJvcGVydGllcy5wb3B1cCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KQoKICAgICAgICAgICAgdmFyIHRpbWVzdGFtcGVkX2dlb19qc29uXzViNTRhZDg0MGEzZTQ3MjM4M2JkYTA0NGVmNDhjZjFhID0gTC50aW1lRGltZW5zaW9uLmxheWVyLmdlb0pzb24oZ2VvSnNvbkxheWVyLAogICAgICAgICAgICAgICAge3VwZGF0ZVRpbWVEaW1lbnNpb246IHRydWUsCiAgICAgICAgICAgICAgICAgYWRkbGFzdFBvaW50OiB0cnVlLAogICAgICAgICAgICAgICAgIGR1cmF0aW9uOiAiUDJNIiwKICAgICAgICAgICAgICAgIH0pLmFkZFRvKG1hcF81YThkZDFkMGZkZmU0OWVhODFhYmM5Nzg1NDZlOGE2Yyk7CiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bb9d44e0>"
+ "<folium.folium.Map at 0x1b7d551b358>"
]
},
"execution_count": 10,
@@ -594,10 +594,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfN2VkMjhkYjUxYWQ5NGMyY2IzZDkwMzRhYTVlYzFmZjIgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly91bnBrZy5jb20vbGVhZmxldC5mZWF0dXJlZ3JvdXAuc3ViZ3JvdXBAMS4wLjIvZGlzdC9sZWFmbGV0LmZlYXR1cmVncm91cC5zdWJncm91cC5qcyI+PC9zY3JpcHQ+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwXzdlZDI4ZGI1MWFkOTRjMmNiM2Q5MDM0YWE1ZWMxZmYyIiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF83ZWQyOGRiNTFhZDk0YzJjYjNkOTAzNGFhNWVjMWZmMiA9IEwubWFwKAogICAgICAgICdtYXBfN2VkMjhkYjUxYWQ5NGMyY2IzZDkwMzRhYTVlYzFmZjInLCB7CiAgICAgICAgY2VudGVyOiBbMCwgMF0sCiAgICAgICAgem9vbTogNiwKICAgICAgICBtYXhCb3VuZHM6IGJvdW5kcywKICAgICAgICBsYXllcnM6IFtdLAogICAgICAgIHdvcmxkQ29weUp1bXA6IGZhbHNlLAogICAgICAgIGNyczogTC5DUlMuRVBTRzM4NTcKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfOTNkMjEwYjM1MmU4NGZkYzk3NThhNjRkYTk1YjAyMTIgPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiCn0pLmFkZFRvKG1hcF83ZWQyOGRiNTFhZDk0YzJjYjNkOTAzNGFhNWVjMWZmMik7CiAgICAKICAgICAgICAgICAgdmFyIGZlYXR1cmVfZ3JvdXBfZjhjZTJlZjk2NjYyNDUyYzliZjM0ZWJmOGMzNTkxZGUgPSBMLmZlYXR1cmVHcm91cCgKICAgICAgICAgICAgICAgICkuYWRkVG8obWFwXzdlZDI4ZGI1MWFkOTRjMmNiM2Q5MDM0YWE1ZWMxZmYyKTsKICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfMWNhNmQyMzhhOGQ1NGQzZDkyMTc1OTM4OWIyNDExYjIgPSBMLmZlYXR1cmVHcm91cC5zdWJHcm91cChmZWF0dXJlX2dyb3VwX2Y4Y2UyZWY5NjY2MjQ1MmM5YmYzNGViZjhjMzU5MWRlKTsKICAgICAgICAgICAgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfMWNhNmQyMzhhOGQ1NGQzZDkyMTc1OTM4OWIyNDExYjIuYWRkVG8obWFwXzdlZDI4ZGI1MWFkOTRjMmNiM2Q5MDM0YWE1ZWMxZmYyKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfN2I4NjQxZTNkOWU5NDUwNWJmNzcyMzI1ZmVkYzk4ZGEgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFstMSwgLTFdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8oZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfMWNhNmQyMzhhOGQ1NGQzZDkyMTc1OTM4OWIyNDExYjIpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl83OWE0MTdkMGI1YTI0Y2U1OTA2MGY2ZDYyN2UzZDFlNiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWzEsIDFdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8oZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfMWNhNmQyMzhhOGQ1NGQzZDkyMTc1OTM4OWIyNDExYjIpOwogICAgICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfYWJjZGE3ZDcwYTk3NGFjNjk2NjgzMmQzNTY1NzBmOTEgPSBMLmZlYXR1cmVHcm91cC5zdWJHcm91cChmZWF0dXJlX2dyb3VwX2Y4Y2UyZWY5NjY2MjQ1MmM5YmYzNGViZjhjMzU5MWRlKTsKICAgICAgICAgICAgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfYWJjZGE3ZDcwYTk3NGFjNjk2NjgzMmQzNTY1NzBmOTEuYWRkVG8obWFwXzdlZDI4ZGI1MWFkOTRjMmNiM2Q5MDM0YWE1ZWMxZmYyKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfNDUzYzZjZTUzZTJhNGZhOGEzNTBiMzJkYjRjNGRhY2IgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFstMSwgMV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF9hYmNkYTdkNzBhOTc0YWM2OTY2ODMyZDM1NjU3MGY5MSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2FiMzg4NDMyZjYzODRiNDBiYTY1YmI5YmM5MDA2ODAxID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMSwgLTFdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8oZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfYWJjZGE3ZDcwYTk3NGFjNjk2NjgzMmQzNTY1NzBmOTEpOwogICAgICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgbGF5ZXJfY29udHJvbF8wZGZmMGIyMjU3NmU0ZWY5OWU0MDAwNjAxYzRmOTgwYiA9IHsKICAgICAgICAgICAgICAgIGJhc2VfbGF5ZXJzIDogeyAib3BlbnN0cmVldG1hcCIgOiB0aWxlX2xheWVyXzkzZDIxMGIzNTJlODRmZGM5NzU4YTY0ZGE5NWIwMjEyLCB9LAogICAgICAgICAgICAgICAgb3ZlcmxheXMgOiB7ICJtYWNyb19lbGVtZW50X2Y4Y2UyZWY5NjY2MjQ1MmM5YmYzNGViZjhjMzU5MWRlIiA6IGZlYXR1cmVfZ3JvdXBfZjhjZTJlZjk2NjYyNDUyYzliZjM0ZWJmOGMzNTkxZGUsImcxIiA6IGZlYXR1cmVfZ3JvdXBfc3ViX2dyb3VwXzFjYTZkMjM4YThkNTRkM2Q5MjE3NTkzODliMjQxMWIyLCJnMiIgOiBmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF9hYmNkYTdkNzBhOTc0YWM2OTY2ODMyZDM1NjU3MGY5MSwgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgTC5jb250cm9sLmxheWVycygKICAgICAgICAgICAgICAgIGxheWVyX2NvbnRyb2xfMGRmZjBiMjI1NzZlNGVmOTllNDAwMDYwMWM0Zjk4MGIuYmFzZV9sYXllcnMsCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzBkZmYwYjIyNTc2ZTRlZjk5ZTQwMDA2MDFjNGY5ODBiLm92ZXJsYXlzLAogICAgICAgICAgICAgICAge3Bvc2l0aW9uOiAndG9wcmlnaHQnLAogICAgICAgICAgICAgICAgIGNvbGxhcHNlZDogdHJ1ZSwKICAgICAgICAgICAgICAgICBhdXRvWkluZGV4OiB0cnVlCiAgICAgICAgICAgICAgICB9KS5hZGRUbyhtYXBfN2VkMjhkYjUxYWQ5NGMyY2IzZDkwMzRhYTVlYzFmZjIpOwogICAgICAgICAgICAKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfZWI5M2Y2Y2Y4MzNiNGE0NmIwODBmNDM1OTU3ZGEyYjcgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly91bnBrZy5jb20vbGVhZmxldC5mZWF0dXJlZ3JvdXAuc3ViZ3JvdXBAMS4wLjIvZGlzdC9sZWFmbGV0LmZlYXR1cmVncm91cC5zdWJncm91cC5qcyI+PC9zY3JpcHQ+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwX2ViOTNmNmNmODMzYjRhNDZiMDgwZjQzNTk1N2RhMmI3IiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF9lYjkzZjZjZjgzM2I0YTQ2YjA4MGY0MzU5NTdkYTJiNyA9IEwubWFwKAogICAgICAgICdtYXBfZWI5M2Y2Y2Y4MzNiNGE0NmIwODBmNDM1OTU3ZGEyYjcnLCB7CiAgICAgICAgY2VudGVyOiBbMCwgMF0sCiAgICAgICAgem9vbTogNiwKICAgICAgICBtYXhCb3VuZHM6IGJvdW5kcywKICAgICAgICBsYXllcnM6IFtdLAogICAgICAgIHdvcmxkQ29weUp1bXA6IGZhbHNlLAogICAgICAgIGNyczogTC5DUlMuRVBTRzM4NTcsCiAgICAgICAgem9vbUNvbnRyb2w6IHRydWUsCiAgICAgICAgfSk7CgogICAgCiAgICAKICAgIHZhciB0aWxlX2xheWVyXzUwMWFhODZlZWNlNDRmN2ViOWYyZWEwZGMxYjg2NmE4ID0gTC50aWxlTGF5ZXIoCiAgICAgICAgJ2h0dHBzOi8ve3N9LnRpbGUub3BlbnN0cmVldG1hcC5vcmcve3p9L3t4fS97eX0ucG5nJywKICAgICAgICB7CiAgICAgICAgImF0dHJpYnV0aW9uIjogbnVsbCwKICAgICAgICAiZGV0ZWN0UmV0aW5hIjogZmFsc2UsCiAgICAgICAgIm1heE5hdGl2ZVpvb20iOiAxOCwKICAgICAgICAibWF4Wm9vbSI6IDE4LAogICAgICAgICJtaW5ab29tIjogMCwKICAgICAgICAibm9XcmFwIjogZmFsc2UsCiAgICAgICAgIm9wYWNpdHkiOiAxLAogICAgICAgICJzdWJkb21haW5zIjogImFiYyIsCiAgICAgICAgInRtcyI6IGZhbHNlCn0pLmFkZFRvKG1hcF9lYjkzZjZjZjgzM2I0YTQ2YjA4MGY0MzU5NTdkYTJiNyk7CiAgICAKICAgICAgICAgICAgdmFyIGZlYXR1cmVfZ3JvdXBfZDM4ZmUwNTZhMzNiNDZkNzliZGFlNzgxNTJhNTk4NTUgPSBMLmZlYXR1cmVHcm91cCgKICAgICAgICAgICAgICAgICkuYWRkVG8obWFwX2ViOTNmNmNmODMzYjRhNDZiMDgwZjQzNTk1N2RhMmI3KTsKICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfYTcwNTdlOWJjMDA0NDVhYWExNTIzZmQ3ODQ4N2I0YzIgPSBMLmZlYXR1cmVHcm91cC5zdWJHcm91cChmZWF0dXJlX2dyb3VwX2QzOGZlMDU2YTMzYjQ2ZDc5YmRhZTc4MTUyYTU5ODU1KTsKICAgICAgICAgICAgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfYTcwNTdlOWJjMDA0NDVhYWExNTIzZmQ3ODQ4N2I0YzIuYWRkVG8obWFwX2ViOTNmNmNmODMzYjRhNDZiMDgwZjQzNTk1N2RhMmI3KTsKICAgICAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzk4ZjY5NzI0M2MyMzQ0NTA4MWYzYmI1ZTU2MGNlNjBlID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFstMSwgLTFdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKGZlYXR1cmVfZ3JvdXBfc3ViX2dyb3VwX2E3MDU3ZTliYzAwNDQ1YWFhMTUyM2ZkNzg0ODdiNGMyKTsKICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfODQ3ZDc0MGM4NWQ0NDI4ZGIwNjllMjU3ZWJiZDI4Y2QgPSBMLm1hcmtlcigKICAgICAgICAgICAgWzEsIDFdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKGZlYXR1cmVfZ3JvdXBfc3ViX2dyb3VwX2E3MDU3ZTliYzAwNDQ1YWFhMTUyM2ZkNzg0ODdiNGMyKTsKICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfMWE3NmQxYzk1MzkxNGI2NDg4MjYzMzM2NmJiNzNmZDYgPSBMLmZlYXR1cmVHcm91cC5zdWJHcm91cChmZWF0dXJlX2dyb3VwX2QzOGZlMDU2YTMzYjQ2ZDc5YmRhZTc4MTUyYTU5ODU1KTsKICAgICAgICAgICAgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfMWE3NmQxYzk1MzkxNGI2NDg4MjYzMzM2NmJiNzNmZDYuYWRkVG8obWFwX2ViOTNmNmNmODMzYjRhNDZiMDgwZjQzNTk1N2RhMmI3KTsKICAgICAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzc4NTBlMDc2ZWM4NTQyMzhhNmUwMzM3N2Y1YzM1YTZlID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFstMSwgMV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8oZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfMWE3NmQxYzk1MzkxNGI2NDg4MjYzMzM2NmJiNzNmZDYpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8xY2Y0ZmE4NGFkMTY0MTNjOGRmZTFiYTljYzE5NTRmOCA9IEwubWFya2VyKAogICAgICAgICAgICBbMSwgLTFdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKGZlYXR1cmVfZ3JvdXBfc3ViX2dyb3VwXzFhNzZkMWM5NTM5MTRiNjQ4ODI2MzMzNjZiYjczZmQ2KTsKICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgbGF5ZXJfY29udHJvbF8yZWY3MDVhYmIxOTU0NmFjODNhMzI3MTE2OWRkNGMyOCA9IHsKICAgICAgICAgICAgICAgIGJhc2VfbGF5ZXJzIDogeyAib3BlbnN0cmVldG1hcCIgOiB0aWxlX2xheWVyXzUwMWFhODZlZWNlNDRmN2ViOWYyZWEwZGMxYjg2NmE4LCB9LAogICAgICAgICAgICAgICAgb3ZlcmxheXMgOiB7ICJtYWNyb19lbGVtZW50X2QzOGZlMDU2YTMzYjQ2ZDc5YmRhZTc4MTUyYTU5ODU1IiA6IGZlYXR1cmVfZ3JvdXBfZDM4ZmUwNTZhMzNiNDZkNzliZGFlNzgxNTJhNTk4NTUsImcxIiA6IGZlYXR1cmVfZ3JvdXBfc3ViX2dyb3VwX2E3MDU3ZTliYzAwNDQ1YWFhMTUyM2ZkNzg0ODdiNGMyLCJnMiIgOiBmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF8xYTc2ZDFjOTUzOTE0YjY0ODgyNjMzMzY2YmI3M2ZkNiwgfQogICAgICAgICAgICAgICAgfTsKICAgICAgICAgICAgTC5jb250cm9sLmxheWVycygKICAgICAgICAgICAgICAgIGxheWVyX2NvbnRyb2xfMmVmNzA1YWJiMTk1NDZhYzgzYTMyNzExNjlkZDRjMjguYmFzZV9sYXllcnMsCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzJlZjcwNWFiYjE5NTQ2YWM4M2EzMjcxMTY5ZGQ0YzI4Lm92ZXJsYXlzLAogICAgICAgICAgICAgICAge3Bvc2l0aW9uOiAndG9wcmlnaHQnLAogICAgICAgICAgICAgICAgIGNvbGxhcHNlZDogdHJ1ZSwKICAgICAgICAgICAgICAgICBhdXRvWkluZGV4OiB0cnVlCiAgICAgICAgICAgICAgICB9KS5hZGRUbyhtYXBfZWI5M2Y2Y2Y4MzNiNGE0NmIwODBmNDM1OTU3ZGEyYjcpOwogICAgICAgICAgICAKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bba0ff60>"
+ "<folium.folium.Map at 0x1b7d5534f28>"
]
},
"execution_count": 11,
@@ -647,10 +647,10 @@
{
"data": {
"text/html": [
- "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4yLjAvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfZDM4OWY3N2Y0YTU0NGMwYmExMzc5MTZkMDhjMmI5ZmQgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC5tYXJrZXJjbHVzdGVyLzEuMS4wL2xlYWZsZXQubWFya2VyY2x1c3Rlci5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQubWFya2VyY2x1c3Rlci8xLjEuMC9NYXJrZXJDbHVzdGVyLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9sZWFmbGV0Lm1hcmtlcmNsdXN0ZXIvMS4xLjAvTWFya2VyQ2x1c3Rlci5EZWZhdWx0LmNzcyIvPgogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vdW5wa2cuY29tL2xlYWZsZXQuZmVhdHVyZWdyb3VwLnN1Ymdyb3VwQDEuMC4yL2Rpc3QvbGVhZmxldC5mZWF0dXJlZ3JvdXAuc3ViZ3JvdXAuanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF9kMzg5Zjc3ZjRhNTQ0YzBiYTEzNzkxNmQwOGMyYjlmZCIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfZDM4OWY3N2Y0YTU0NGMwYmExMzc5MTZkMDhjMmI5ZmQgPSBMLm1hcCgKICAgICAgICAnbWFwX2QzODlmNzdmNGE1NDRjMGJhMTM3OTE2ZDA4YzJiOWZkJywgewogICAgICAgIGNlbnRlcjogWzAsIDBdLAogICAgICAgIHpvb206IDYsCiAgICAgICAgbWF4Qm91bmRzOiBib3VuZHMsCiAgICAgICAgbGF5ZXJzOiBbXSwKICAgICAgICB3b3JsZENvcHlKdW1wOiBmYWxzZSwKICAgICAgICBjcnM6IEwuQ1JTLkVQU0czODU3CiAgICAgICAgfSk7CgogICAgCiAgICAKICAgIHZhciB0aWxlX2xheWVyXzBiZjI2N2IzYTk1OTQ5MDliMzUwYjI3Y2U5YWE4Nzg0ID0gTC50aWxlTGF5ZXIoCiAgICAgICAgJ2h0dHBzOi8ve3N9LnRpbGUub3BlbnN0cmVldG1hcC5vcmcve3p9L3t4fS97eX0ucG5nJywKICAgICAgICB7CiAgICAgICAgImF0dHJpYnV0aW9uIjogbnVsbCwKICAgICAgICAiZGV0ZWN0UmV0aW5hIjogZmFsc2UsCiAgICAgICAgIm1heE5hdGl2ZVpvb20iOiAxOCwKICAgICAgICAibWF4Wm9vbSI6IDE4LAogICAgICAgICJtaW5ab29tIjogMCwKICAgICAgICAibm9XcmFwIjogZmFsc2UsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIgp9KS5hZGRUbyhtYXBfZDM4OWY3N2Y0YTU0NGMwYmExMzc5MTZkMDhjMmI5ZmQpOwogICAgCiAgICAgICAgICAgIHZhciBtYXJrZXJfY2x1c3Rlcl9iMmJhODVmY2M2N2U0NzUwOWVhYzc0ZmYyYmQzOTgyZCA9IEwubWFya2VyQ2x1c3Rlckdyb3VwKHsKICAgICAgICAgICAgICAgIAogICAgICAgICAgICB9KTsKICAgICAgICAgICAgbWFwX2QzODlmNzdmNGE1NDRjMGJhMTM3OTE2ZDA4YzJiOWZkLmFkZExheWVyKG1hcmtlcl9jbHVzdGVyX2IyYmE4NWZjYzY3ZTQ3NTA5ZWFjNzRmZjJiZDM5ODJkKTsKICAgICAgICAgICAgCiAgICAKICAgICAgICAgICAgdmFyIGZlYXR1cmVfZ3JvdXBfc3ViX2dyb3VwXzA4ZjA0MTdhZDA0YTRiNWZhMzU4NWNiODY3NjYwNjYzID0gTC5mZWF0dXJlR3JvdXAuc3ViR3JvdXAobWFya2VyX2NsdXN0ZXJfYjJiYTg1ZmNjNjdlNDc1MDllYWM3NGZmMmJkMzk4MmQpOwogICAgICAgICAgICBmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF8wOGYwNDE3YWQwNGE0YjVmYTM1ODVjYjg2NzY2MDY2My5hZGRUbyhtYXBfZDM4OWY3N2Y0YTU0NGMwYmExMzc5MTZkMDhjMmI5ZmQpOwogICAgICAgICAgICAKICAgIAoKICAgICAgICAgICAgdmFyIG1hcmtlcl80ODdiNmI4OWRkNDA0OWQ2YjdlNmYxZDAwNDNiOTBlYiA9IEwubWFya2VyKAogICAgICAgICAgICAgICAgWy0xLCAtMV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF8wOGYwNDE3YWQwNGE0YjVmYTM1ODVjYjg2NzY2MDY2Myk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyX2NmZDMwZDYzZDBjODRiNDk5ZDUzMmVkZmZmMjk1MWNlID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMSwgMV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF8wOGYwNDE3YWQwNGE0YjVmYTM1ODVjYjg2NzY2MDY2Myk7CiAgICAgICAgICAgIAogICAgCiAgICAgICAgICAgIHZhciBmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF84YmE1MDE0Y2JhNjc0NTdkOTI5Mzk5OWI1M2ZiNzdjZSA9IEwuZmVhdHVyZUdyb3VwLnN1Ykdyb3VwKG1hcmtlcl9jbHVzdGVyX2IyYmE4NWZjYzY3ZTQ3NTA5ZWFjNzRmZjJiZDM5ODJkKTsKICAgICAgICAgICAgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfOGJhNTAxNGNiYTY3NDU3ZDkyOTM5OTliNTNmYjc3Y2UuYWRkVG8obWFwX2QzODlmNzdmNGE1NDRjMGJhMTM3OTE2ZDA4YzJiOWZkKTsKICAgICAgICAgICAgCiAgICAKCiAgICAgICAgICAgIHZhciBtYXJrZXJfZmMwNGI4ZDRhN2U1NDk2OGJlZGRhNzcyMjA4NTIzY2MgPSBMLm1hcmtlcigKICAgICAgICAgICAgICAgIFstMSwgMV0sCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaWNvbjogbmV3IEwuSWNvbi5EZWZhdWx0KCkKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICApCiAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgIC5hZGRUbyhmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF84YmE1MDE0Y2JhNjc0NTdkOTI5Mzk5OWI1M2ZiNzdjZSk7CiAgICAgICAgICAgIAogICAgCgogICAgICAgICAgICB2YXIgbWFya2VyXzcyMGVlMzUyMjFlODQ1Yzk5NTgxN2U0YTQzMWU5MDY0ID0gTC5tYXJrZXIoCiAgICAgICAgICAgICAgICBbMSwgLTFdLAogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgKQogICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAuYWRkVG8oZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfOGJhNTAxNGNiYTY3NDU3ZDkyOTM5OTliNTNmYjc3Y2UpOwogICAgICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgbGF5ZXJfY29udHJvbF85Njg4MTgwYmZkNDQ0MjVkYTRhNjhmNTI3YTljOTIyZCA9IHsKICAgICAgICAgICAgICAgIGJhc2VfbGF5ZXJzIDogeyAib3BlbnN0cmVldG1hcCIgOiB0aWxlX2xheWVyXzBiZjI2N2IzYTk1OTQ5MDliMzUwYjI3Y2U5YWE4Nzg0LCB9LAogICAgICAgICAgICAgICAgb3ZlcmxheXMgOiB7ICJnMSIgOiBmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF8wOGYwNDE3YWQwNGE0YjVmYTM1ODVjYjg2NzY2MDY2MywiZzIiIDogZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfOGJhNTAxNGNiYTY3NDU3ZDkyOTM5OTliNTNmYjc3Y2UsIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEwuY29udHJvbC5sYXllcnMoCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sXzk2ODgxODBiZmQ0NDQyNWRhNGE2OGY1MjdhOWM5MjJkLmJhc2VfbGF5ZXJzLAogICAgICAgICAgICAgICAgbGF5ZXJfY29udHJvbF85Njg4MTgwYmZkNDQ0MjVkYTRhNjhmNTI3YTljOTIyZC5vdmVybGF5cywKICAgICAgICAgICAgICAgIHtwb3NpdGlvbjogJ3RvcHJpZ2h0JywKICAgICAgICAgICAgICAgICBjb2xsYXBzZWQ6IHRydWUsCiAgICAgICAgICAgICAgICAgYXV0b1pJbmRleDogdHJ1ZQogICAgICAgICAgICAgICAgfSkuYWRkVG8obWFwX2QzODlmNzdmNGE1NDRjMGJhMTM3OTE2ZDA4YzJiOWZkKTsKICAgICAgICAgICAgCiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfZmQ1NTQ3YjdhZDM3NGIwNWE3NzMzY2IyZjcxMTE2MTYgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC5tYXJrZXJjbHVzdGVyLzEuMS4wL2xlYWZsZXQubWFya2VyY2x1c3Rlci5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQubWFya2VyY2x1c3Rlci8xLjEuMC9NYXJrZXJDbHVzdGVyLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9sZWFmbGV0Lm1hcmtlcmNsdXN0ZXIvMS4xLjAvTWFya2VyQ2x1c3Rlci5EZWZhdWx0LmNzcyIvPgogICAgPHNjcmlwdCBzcmM9Imh0dHBzOi8vdW5wa2cuY29tL2xlYWZsZXQuZmVhdHVyZWdyb3VwLnN1Ymdyb3VwQDEuMC4yL2Rpc3QvbGVhZmxldC5mZWF0dXJlZ3JvdXAuc3ViZ3JvdXAuanMiPjwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PiAgICAKICAgIAogICAgPGRpdiBjbGFzcz0iZm9saXVtLW1hcCIgaWQ9Im1hcF9mZDU1NDdiN2FkMzc0YjA1YTc3MzNjYjJmNzExMTYxNiIgPjwvZGl2Pgo8L2JvZHk+CjxzY3JpcHQ+ICAgIAogICAgCiAgICAKICAgICAgICB2YXIgYm91bmRzID0gbnVsbDsKICAgIAoKICAgIHZhciBtYXBfZmQ1NTQ3YjdhZDM3NGIwNWE3NzMzY2IyZjcxMTE2MTYgPSBMLm1hcCgKICAgICAgICAnbWFwX2ZkNTU0N2I3YWQzNzRiMDVhNzczM2NiMmY3MTExNjE2JywgewogICAgICAgIGNlbnRlcjogWzAsIDBdLAogICAgICAgIHpvb206IDYsCiAgICAgICAgbWF4Qm91bmRzOiBib3VuZHMsCiAgICAgICAgbGF5ZXJzOiBbXSwKICAgICAgICB3b3JsZENvcHlKdW1wOiBmYWxzZSwKICAgICAgICBjcnM6IEwuQ1JTLkVQU0czODU3LAogICAgICAgIHpvb21Db250cm9sOiB0cnVlLAogICAgICAgIH0pOwoKICAgIAogICAgCiAgICB2YXIgdGlsZV9sYXllcl8xOWRkMjBkNjMyYzA0ZjA4ODAzMzhhOTMzOWQ5YjE5NSA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9KS5hZGRUbyhtYXBfZmQ1NTQ3YjdhZDM3NGIwNWE3NzMzY2IyZjcxMTE2MTYpOwogICAgCiAgICAgICAgICAgIHZhciBtYXJrZXJfY2x1c3Rlcl9jYTA3YjNmYWIyODI0MDVjYjMzNGJhNWM5YTExZWUyOCA9IEwubWFya2VyQ2x1c3Rlckdyb3VwKHt9KTsKICAgICAgICAgICAgbWFwX2ZkNTU0N2I3YWQzNzRiMDVhNzczM2NiMmY3MTExNjE2LmFkZExheWVyKG1hcmtlcl9jbHVzdGVyX2NhMDdiM2ZhYjI4MjQwNWNiMzM0YmE1YzlhMTFlZTI4KTsKICAgICAgICAgICAgCiAgICAKICAgICAgICAgICAgdmFyIGZlYXR1cmVfZ3JvdXBfc3ViX2dyb3VwX2ZjYTRlNWNmMDEwMDQ2ZWI5OWI1MzgzM2VmOWVjNjEzID0gTC5mZWF0dXJlR3JvdXAuc3ViR3JvdXAobWFya2VyX2NsdXN0ZXJfY2EwN2IzZmFiMjgyNDA1Y2IzMzRiYTVjOWExMWVlMjgpOwogICAgICAgICAgICBmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF9mY2E0ZTVjZjAxMDA0NmViOTliNTM4MzNlZjllYzYxMy5hZGRUbyhtYXBfZmQ1NTQ3YjdhZDM3NGIwNWE3NzMzY2IyZjcxMTE2MTYpOwogICAgICAgICAgICAKICAgIAogICAgICAgIHZhciBtYXJrZXJfOTg1YzhiYTE2ODI3NGIyMmFlMmU0ZjdmOWRlNGU2OWYgPSBMLm1hcmtlcigKICAgICAgICAgICAgWy0xLCAtMV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8oZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfZmNhNGU1Y2YwMTAwNDZlYjk5YjUzODMzZWY5ZWM2MTMpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl8zYTg2MjA5NTI1YjU0YWQ3OWMwMzRkMzEwODQ4ODY1MCA9IEwubWFya2VyKAogICAgICAgICAgICBbMSwgMV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8oZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfZmNhNGU1Y2YwMTAwNDZlYjk5YjUzODMzZWY5ZWM2MTMpOwogICAgICAgIAogICAgCiAgICAgICAgICAgIHZhciBmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF85ZGQ4ZWQ5ZTY0OTM0YjI0OWQwYzIzOWQ1YzViNDQyZCA9IEwuZmVhdHVyZUdyb3VwLnN1Ykdyb3VwKG1hcmtlcl9jbHVzdGVyX2NhMDdiM2ZhYjI4MjQwNWNiMzM0YmE1YzlhMTFlZTI4KTsKICAgICAgICAgICAgZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfOWRkOGVkOWU2NDkzNGIyNDlkMGMyMzlkNWM1YjQ0MmQuYWRkVG8obWFwX2ZkNTU0N2I3YWQzNzRiMDVhNzczM2NiMmY3MTExNjE2KTsKICAgICAgICAgICAgCiAgICAKICAgICAgICB2YXIgbWFya2VyXzYwN2Y5MmFiYzBmYjQ3ZTc5YjY1YTBjYmUxNGVmZDAyID0gTC5tYXJrZXIoCiAgICAgICAgICAgIFstMSwgMV0sCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGljb246IG5ldyBMLkljb24uRGVmYXVsdCgpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICkuYWRkVG8oZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfOWRkOGVkOWU2NDkzNGIyNDlkMGMyMzlkNWM1YjQ0MmQpOwogICAgICAgIAogICAgCiAgICAgICAgdmFyIG1hcmtlcl81MjMyMmEzMDM1MzQ0MWFjOTgwMzA5NDk2NzJjODM4NCA9IEwubWFya2VyKAogICAgICAgICAgICBbMSwgLTFdLAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBpY29uOiBuZXcgTC5JY29uLkRlZmF1bHQoKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICApLmFkZFRvKGZlYXR1cmVfZ3JvdXBfc3ViX2dyb3VwXzlkZDhlZDllNjQ5MzRiMjQ5ZDBjMjM5ZDVjNWI0NDJkKTsKICAgICAgICAKICAgIAogICAgICAgICAgICB2YXIgbGF5ZXJfY29udHJvbF9kZjc2NDMxNDJhZGE0NjBmODMyMjQxMTY5M2E1NmMwNiA9IHsKICAgICAgICAgICAgICAgIGJhc2VfbGF5ZXJzIDogeyAib3BlbnN0cmVldG1hcCIgOiB0aWxlX2xheWVyXzE5ZGQyMGQ2MzJjMDRmMDg4MDMzOGE5MzM5ZDliMTk1LCB9LAogICAgICAgICAgICAgICAgb3ZlcmxheXMgOiB7ICJnMSIgOiBmZWF0dXJlX2dyb3VwX3N1Yl9ncm91cF9mY2E0ZTVjZjAxMDA0NmViOTliNTM4MzNlZjllYzYxMywiZzIiIDogZmVhdHVyZV9ncm91cF9zdWJfZ3JvdXBfOWRkOGVkOWU2NDkzNGIyNDlkMGMyMzlkNWM1YjQ0MmQsIH0KICAgICAgICAgICAgICAgIH07CiAgICAgICAgICAgIEwuY29udHJvbC5sYXllcnMoCiAgICAgICAgICAgICAgICBsYXllcl9jb250cm9sX2RmNzY0MzE0MmFkYTQ2MGY4MzIyNDExNjkzYTU2YzA2LmJhc2VfbGF5ZXJzLAogICAgICAgICAgICAgICAgbGF5ZXJfY29udHJvbF9kZjc2NDMxNDJhZGE0NjBmODMyMjQxMTY5M2E1NmMwNi5vdmVybGF5cywKICAgICAgICAgICAgICAgIHtwb3NpdGlvbjogJ3RvcHJpZ2h0JywKICAgICAgICAgICAgICAgICBjb2xsYXBzZWQ6IHRydWUsCiAgICAgICAgICAgICAgICAgYXV0b1pJbmRleDogdHJ1ZQogICAgICAgICAgICAgICAgfSkuYWRkVG8obWFwX2ZkNTU0N2I3YWQzNzRiMDVhNzczM2NiMmY3MTExNjE2KTsKICAgICAgICAgICAgCiAgICAgICAgCjwvc2NyaXB0Pg==\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
- "<folium.folium.Map at 0x7f20bb9b3710>"
+ "<folium.folium.Map at 0x1b7d55ac470>"
]
},
"execution_count": 12,
@@ -682,6 +682,44 @@
"\n",
"m"
]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Minimap\n",
+ "\n",
+ "Adds a locator minimap to a folium document"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><iframe src=\"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIGh0bWw+CjxoZWFkPiAgICAKICAgIDxtZXRhIGh0dHAtZXF1aXY9ImNvbnRlbnQtdHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PVVURi04IiAvPgogICAgPHNjcmlwdD5MX1BSRUZFUl9DQU5WQVM9ZmFsc2U7IExfTk9fVE9VQ0g9ZmFsc2U7IExfRElTQUJMRV8zRD1mYWxzZTs8L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmpzIj48L3NjcmlwdD4KICAgIDxzY3JpcHQgc3JjPSJodHRwczovL2FqYXguZ29vZ2xlYXBpcy5jb20vYWpheC9saWJzL2pxdWVyeS8xLjExLjEvanF1ZXJ5Lm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvanMvYm9vdHN0cmFwLm1pbi5qcyI+PC9zY3JpcHQ+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvTGVhZmxldC5hd2Vzb21lLW1hcmtlcnMvMi4wLjIvbGVhZmxldC5hd2Vzb21lLW1hcmtlcnMuanMiPjwvc2NyaXB0PgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2Nkbi5qc2RlbGl2ci5uZXQvbnBtL2xlYWZsZXRAMS4zLjQvZGlzdC9sZWFmbGV0LmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL21heGNkbi5ib290c3RyYXBjZG4uY29tL2Jvb3RzdHJhcC8zLjIuMC9jc3MvYm9vdHN0cmFwLm1pbi5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9tYXhjZG4uYm9vdHN0cmFwY2RuLmNvbS9ib290c3RyYXAvMy4yLjAvY3NzL2Jvb3RzdHJhcC10aGVtZS5taW4uY3NzIi8+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vbWF4Y2RuLmJvb3RzdHJhcGNkbi5jb20vZm9udC1hd2Vzb21lLzQuNi4zL2Nzcy9mb250LWF3ZXNvbWUubWluLmNzcyIvPgogICAgPGxpbmsgcmVsPSJzdHlsZXNoZWV0IiBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9MZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy8yLjAuMi9sZWFmbGV0LmF3ZXNvbWUtbWFya2Vycy5jc3MiLz4KICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iaHR0cHM6Ly9yYXdnaXQuY29tL3B5dGhvbi12aXN1YWxpemF0aW9uL2ZvbGl1bS9tYXN0ZXIvZm9saXVtL3RlbXBsYXRlcy9sZWFmbGV0LmF3ZXNvbWUucm90YXRlLmNzcyIvPgogICAgPHN0eWxlPmh0bWwsIGJvZHkge3dpZHRoOiAxMDAlO2hlaWdodDogMTAwJTttYXJnaW46IDA7cGFkZGluZzogMDt9PC9zdHlsZT4KICAgIDxzdHlsZT4jbWFwIHtwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MDtib3R0b206MDtyaWdodDowO2xlZnQ6MDt9PC9zdHlsZT4KICAgIAogICAgPHN0eWxlPiNtYXBfZTk2N2FlMmU2YTU4NGExNzliYzVmZTZiYjM1NTg2OTQgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICB3aWR0aDogMTAwLjAlOwogICAgICAgIGhlaWdodDogMTAwLjAlOwogICAgICAgIGxlZnQ6IDAuMCU7CiAgICAgICAgdG9wOiAwLjAlOwogICAgICAgIH0KICAgIDwvc3R5bGU+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbGVhZmxldC1taW5pbWFwLzMuNi4xL0NvbnRyb2wuTWluaU1hcC5qcyI+PC9zY3JpcHQ+CiAgICA8bGluayByZWw9InN0eWxlc2hlZXQiIGhyZWY9Imh0dHBzOi8vY2RuanMuY2xvdWRmbGFyZS5jb20vYWpheC9saWJzL2xlYWZsZXQtbWluaW1hcC8zLjYuMS9Db250cm9sLk1pbmlNYXAuY3NzIi8+CjwvaGVhZD4KPGJvZHk+ICAgIAogICAgCiAgICA8ZGl2IGNsYXNzPSJmb2xpdW0tbWFwIiBpZD0ibWFwX2U5NjdhZTJlNmE1ODRhMTc5YmM1ZmU2YmIzNTU4Njk0IiA+PC9kaXY+CjwvYm9keT4KPHNjcmlwdD4gICAgCiAgICAKICAgIAogICAgICAgIHZhciBib3VuZHMgPSBudWxsOwogICAgCgogICAgdmFyIG1hcF9lOTY3YWUyZTZhNTg0YTE3OWJjNWZlNmJiMzU1ODY5NCA9IEwubWFwKAogICAgICAgICdtYXBfZTk2N2FlMmU2YTU4NGExNzliYzVmZTZiYjM1NTg2OTQnLCB7CiAgICAgICAgY2VudGVyOiBbMzAsIDIwXSwKICAgICAgICB6b29tOiA0LAogICAgICAgIG1heEJvdW5kczogYm91bmRzLAogICAgICAgIGxheWVyczogW10sCiAgICAgICAgd29ybGRDb3B5SnVtcDogZmFsc2UsCiAgICAgICAgY3JzOiBMLkNSUy5FUFNHMzg1NywKICAgICAgICB6b29tQ29udHJvbDogdHJ1ZSwKICAgICAgICB9KTsKCiAgICAKICAgIAogICAgdmFyIHRpbGVfbGF5ZXJfZWE4NjQ5ODExYmE0NDc3MmI5ZWEwNzQxNzljODk3YjggPSBMLnRpbGVMYXllcigKICAgICAgICAnaHR0cHM6Ly97c30udGlsZS5vcGVuc3RyZWV0bWFwLm9yZy97en0ve3h9L3t5fS5wbmcnLAogICAgICAgIHsKICAgICAgICAiYXR0cmlidXRpb24iOiBudWxsLAogICAgICAgICJkZXRlY3RSZXRpbmEiOiBmYWxzZSwKICAgICAgICAibWF4TmF0aXZlWm9vbSI6IDE4LAogICAgICAgICJtYXhab29tIjogMTgsCiAgICAgICAgIm1pblpvb20iOiAwLAogICAgICAgICJub1dyYXAiOiBmYWxzZSwKICAgICAgICAib3BhY2l0eSI6IDEsCiAgICAgICAgInN1YmRvbWFpbnMiOiAiYWJjIiwKICAgICAgICAidG1zIjogZmFsc2UKfSkuYWRkVG8obWFwX2U5NjdhZTJlNmE1ODRhMTc5YmM1ZmU2YmIzNTU4Njk0KTsKICAgIAoKICAgICAgICB2YXIgdGlsZV9sYXllcl85ODM0MjNhNWUyODg0YmYyOWIyYzU2NzlkZGIzOWEzNCA9IEwudGlsZUxheWVyKAogICAgICAgICdodHRwczovL3tzfS50aWxlLm9wZW5zdHJlZXRtYXAub3JnL3t6fS97eH0ve3l9LnBuZycsCiAgICAgICAgewogICAgICAgICJhdHRyaWJ1dGlvbiI6IG51bGwsCiAgICAgICAgImRldGVjdFJldGluYSI6IGZhbHNlLAogICAgICAgICJtYXhOYXRpdmVab29tIjogMTgsCiAgICAgICAgIm1heFpvb20iOiAxOCwKICAgICAgICAibWluWm9vbSI6IDAsCiAgICAgICAgIm5vV3JhcCI6IGZhbHNlLAogICAgICAgICJvcGFjaXR5IjogMSwKICAgICAgICAic3ViZG9tYWlucyI6ICJhYmMiLAogICAgICAgICJ0bXMiOiBmYWxzZQp9ICk7CgogICAgICAgIHZhciBtaW5pX21hcF85NmJkOWVhZWU5NDA0OGIzOTIwZTY3MDA2ZGI3NzQxNyA9IG5ldyBMLkNvbnRyb2wuTWluaU1hcCggdGlsZV9sYXllcl85ODM0MjNhNWUyODg0YmYyOWIyYzU2NzlkZGIzOWEzNCwKICAgICAgICAgewogICJhdXRvVG9nZ2xlRGlzcGxheSI6IGZhbHNlLAogICJjZW50ZXJGaXhlZCI6IGZhbHNlLAogICJjb2xsYXBzZWRIZWlnaHQiOiAyNSwKICAiY29sbGFwc2VkV2lkdGgiOiAyNSwKICAiaGVpZ2h0IjogMTUwLAogICJtaW5pbWl6ZWQiOiBmYWxzZSwKICAicG9zaXRpb24iOiAiYm90dG9tcmlnaHQiLAogICJ0b2dnbGVEaXNwbGF5IjogZmFsc2UsCiAgIndpZHRoIjogMTUwLAogICJ6b29tQW5pbWF0aW9uIjogZmFsc2UsCiAgInpvb21MZXZlbEZpeGVkIjogbnVsbCwKICAiem9vbUxldmVsT2Zmc2V0IjogLTUKfSk7CiAgICAgICAgbWFwX2U5NjdhZTJlNmE1ODRhMTc5YmM1ZmU2YmIzNTU4Njk0LmFkZENvbnRyb2wobWluaV9tYXBfOTZiZDllYWVlOTQwNDhiMzkyMGU2NzAwNmRiNzc0MTcpOwoKICAgICAgICAKPC9zY3JpcHQ+\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
+ ],
+ "text/plain": [
+ "<folium.folium.Map at 0x1b7d5697198>"
+ ]
+ },
+ "execution_count": 16,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "from folium.plugins import MiniMap\n",
+ "\n",
+ "m = folium.Map(location=(30, 20), zoom_start=4)\n",
+ "\n",
+ "minimap = MiniMap()\n",
+ "m.add_child(minimap)\n",
+ "m"
+ ]
}
],
"metadata": {
@@ -700,9 +738,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.6.5"
+ "version": "3.6.6"
}
},
"nbformat": 4,
- "nbformat_minor": 1
+ "nbformat_minor": 2
}
diff --git a/folium/plugins/__init__.py b/folium/plugins/__init__.py
index ecf650f1..ff6b47ef 100644
--- a/folium/plugins/__init__.py
+++ b/folium/plugins/__init__.py
@@ -29,6 +29,7 @@ from folium.plugins.time_slider_choropleth import TimeSliderChoropleth
from folium.plugins.timestamped_geo_json import TimestampedGeoJson
from folium.plugins.timestamped_wmstilelayer import TimestampedWmsTileLayers
from folium.plugins.search import Search
+from folium.plugins.minimap import MiniMap
__all__ = [
'BeautifyIcon',
@@ -50,4 +51,5 @@ __all__ = [
'TimestampedGeoJson',
'TimestampedWmsTileLayers',
'Search',
+ 'MiniMap',
]
diff --git a/folium/plugins/minimap.py b/folium/plugins/minimap.py
new file mode 100644
index 00000000..b3267989
--- /dev/null
+++ b/folium/plugins/minimap.py
@@ -0,0 +1,121 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import (absolute_import, division, print_function)
+
+import json
+
+from branca.element import CssLink, Figure, JavascriptLink, MacroElement
+from folium.raster_layers import TileLayer
+
+from jinja2 import Template
+
+
+class MiniMap(MacroElement):
+ """Add a minimap (locator) to an existing map.
+
+ Uses the Leaflet plugin by Norkart under BSD 2-Clause "Simplified" License.
+ https://github.com/Norkart/Leaflet-MiniMap
+
+ Parameters
+ ----------
+ tile_layer : folium TileLayer object or str, default None
+ Provide a folium TileLayer object or the wanted tiles as string.
+ If not provided it will use the default of 'TileLayer', currently
+ OpenStreetMap.
+ position : str, default 'bottomright'
+ The standard Control position parameter for the widget.
+ width : int, default 150
+ The width of the minimap in pixels.
+ height : int, default 150
+ The height of the minimap in pixels.
+ collapsed_width : int, default 25
+ The width of the toggle marker and the minimap when collapsed in pixels.
+ collapsed_height : int, default 25
+ The height of the toggle marker and the minimap when collapsed
+ zoom_level_offset : int, default -5
+ The offset applied to the zoom in the minimap compared to the zoom of
+ the main map. Can be positive or negative.
+ zoom_level_fixed : int, default None
+ Overrides the offset to apply a fixed zoom level to the minimap
+ regardless of the main map zoom.
+ Set it to any valid zoom level, if unset zoom_level_offset is used
+ instead.
+ center_fixed : bool, default False
+ Applies a fixed position to the minimap regardless of the main map's
+ view / position. Prevents panning the minimap, but does allow zooming
+ (both in the minimap and the main map).
+ If the minimap is zoomed, it will always zoom around the centerFixed
+ point. You can pass in a LatLng-equivalent object.
+ zoom_animation : bool, default False
+ Sets whether the minimap should have an animated zoom.
+ (Will cause it to lag a bit after the movement of the main map.)
+ toggle_display : bool, default False
+ Sets whether the minimap should have a button to minimise it.
+ auto_toggle_display : bool, default False
+ Sets whether the minimap should hide automatically
+ if the parent map bounds does not fit within the minimap bounds.
+ Especially useful when 'zoomLevelFixed' is set.
+ minimized : bool, default False
+ Sets whether the minimap should start in a minimized position.
+
+ Examples
+ --------
+ >>> MiniMap(tile_layer='Stamen WaterColor', position='bottomleft')
+ """
+
+ _template = Template("""
+ {% macro script(this, kwargs) %}
+
+ var {{ this.tile_layer.get_name() }} = L.tileLayer(
+ '{{ this.tile_layer.tiles }}',
+ {{ this.tile_layer.options }} );
+
+ var {{ this.get_name() }} = new L.Control.MiniMap( {{this.tile_layer.get_name()}},
+ {{ this.options }});
+ {{ this._parent.get_name() }}.addControl({{ this.get_name() }});
+
+ {% endmacro %}
+ """) # noqa
+
+ def __init__(self, tile_layer=None, position='bottomright', width=150,
+ height=150, collapsed_width=25, collapsed_height=25,
+ zoom_level_offset=-5, zoom_level_fixed=None,
+ center_fixed=False, zoom_animation=False,
+ toggle_display=False, auto_toggle_display=False,
+ minimized=False):
+
+ super(MiniMap, self).__init__()
+ self._name = 'MiniMap'
+
+ if tile_layer is None:
+ self.tile_layer = TileLayer()
+ elif isinstance(tile_layer, TileLayer):
+ self.tile_layer = tile_layer
+ else:
+ self.tile_layer = TileLayer(tile_layer)
+
+ options = {
+ 'position': position,
+ 'width': width,
+ 'height': height,
+ 'collapsedWidth': collapsed_width,
+ 'collapsedHeight': collapsed_height,
+ 'zoomLevelOffset': zoom_level_offset,
+ 'zoomLevelFixed': zoom_level_fixed,
+ 'centerFixed': center_fixed,
+ 'zoomAnimation': zoom_animation,
+ 'toggleDisplay': toggle_display,
+ 'autoToggleDisplay': auto_toggle_display,
+ 'minimized': minimized,
+ }
+ self.options = json.dumps(options, sort_keys=True, indent=2)
+
+ def render(self, **kwargs):
+ figure = self.get_root()
+ assert isinstance(figure, Figure), ('You cannot render this Element '
+ 'if it is not in a Figure.')
+ super(MiniMap, self).render()
+
+ figure.header.add_child(JavascriptLink('https://cdnjs.cloudflare.com/ajax/libs/leaflet-minimap/3.6.1/Control.MiniMap.js')) # noqa
+
+ figure.header.add_child(CssLink('https://cdnjs.cloudflare.com/ajax/libs/leaflet-minimap/3.6.1/Control.MiniMap.css')) # noqa
|
Creating documentation latex files fails (Python 3.5)
#### Please add a code sample or a nbviewer link, copy-pastable if possible
```shell
cd ./docs
make latex
```
#### Problem description
Instead of creating the tex files the following happens:
```shell
sphinx-build -b latex -d _build/doctrees . _build/latex
Running Sphinx v1.8.1
Configuration error:
There is a programmable error in your configuration file:
Traceback (most recent call last):
File "/XXXXXXXXX/.local/lib/python3.5/site-packages/sphinx/config.py", line 368, in eval_config_file
execfile_(filename, namespace)
File "/XXXXXXXXX/.local/lib/python3.5/site-packages/sphinx/util/pycompat.py", line 150, in execfile_
exec_(code, _globals)
File "/YYYYYYYYY/folium/folium/docs/conf.py", line 52, in <module>
from folium._version import get_versions
ImportError: No module named 'folium'
Makefile:99: recipe for target 'latex' failed
make: *** [latex] Error 2
```
#### Expected Output
Nice latex files which I could use for creating a PDF.
#### Output of ``folium.__version__``
0.6.0+30.g9f648a2.dirty'
|
python-visualization/folium
|
diff --git a/tests/plugins/test_minimap.py b/tests/plugins/test_minimap.py
new file mode 100644
index 00000000..a8b58d45
--- /dev/null
+++ b/tests/plugins/test_minimap.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+
+"""
+Test MiniMap
+---------------
+"""
+
+from __future__ import (absolute_import, division, print_function)
+
+import folium
+
+from folium import plugins
+
+
+def test_minimap():
+ m = folium.Map(location=(30, 20), zoom_start=4)
+
+ minimap = plugins.MiniMap()
+ m.add_child(minimap)
+
+ out = m._parent.render()
+
+ # Verify that a new minimap is getting created.
+ assert 'new L.Control.MiniMap' in out
+
+ m = folium.Map(location=(30, 20), zoom_start=4)
+ minimap = plugins.MiniMap(tile_layer="Stamen Toner")
+ minimap.add_to(m)
+
+ out = m._parent.render()
+ # verify that Stamen Toner tiles are being used
+ assert 'https://stamen-tiles' in out
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": -1,
"issue_text_score": 0,
"test_score": -1
},
"num_modified_files": 4
}
|
0.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
branca==0.5.0
certifi==2021.5.30
charset-normalizer==2.0.12
-e git+https://github.com/python-visualization/folium.git@9f648a2be574481d17e0bfba25e8400561f20f23#egg=folium
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
numpy==1.19.5
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
requests==2.27.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: folium
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- branca==0.5.0
- charset-normalizer==2.0.12
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jinja2==3.0.3
- markupsafe==2.0.1
- numpy==1.19.5
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- requests==2.27.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/folium
|
[
"tests/plugins/test_minimap.py::test_minimap"
] |
[] |
[] |
[] |
MIT License
| 3,245 |
[
"CHANGES.txt",
"docs/conf.py",
"examples/MiniMap.ipynb",
"folium/plugins/minimap.py",
"examples/Plugins.ipynb",
"folium/plugins/__init__.py"
] |
[
"CHANGES.txt",
"docs/conf.py",
"examples/MiniMap.ipynb",
"folium/plugins/minimap.py",
"examples/Plugins.ipynb",
"folium/plugins/__init__.py"
] |
joke2k__faker-836
|
ba4994a9c1f84bab3aa3b21c7cc2a1e0e76d3f1c
|
2018-10-15 13:46:22
|
d26db45eebb9dcd02eb73099bb98b660f0e03aad
|
diff --git a/faker/providers/phone_number/pt_BR/__init__.py b/faker/providers/phone_number/pt_BR/__init__.py
index 95707ba6..ca3efbd3 100644
--- a/faker/providers/phone_number/pt_BR/__init__.py
+++ b/faker/providers/phone_number/pt_BR/__init__.py
@@ -71,6 +71,7 @@ class Provider(PhoneNumberProvider):
'#### ####',
'####-####',
)
+
msisdn_formats = (
'5511#########',
'5521#########',
@@ -81,3 +82,11 @@ class Provider(PhoneNumberProvider):
'5571#########',
'5581#########',
)
+
+ cellphone_formats = (
+ '+55 9#### ####',
+ )
+
+ def cellphone_number(self):
+ pattern = self.random_element(self.cellphone_formats)
+ return self.numerify(self.generator.parse(pattern))
|
Add method to generate a cell phone number to pt-BR
Faker doesn't have a function to generate a cellphone to Brazilian.
Steps to reproduce
Create fake instance using localization "pt_BR"
Call fake.msisdn() or fake.phone_number()
Expected behavior
It should generate a cell phone number.
Actual behavior
Sometimes these methods return a "residential" numbers.
Reference difference between cell phones and residential numbers:
http://www.teleco.com.br/num.asp
|
joke2k/faker
|
diff --git a/tests/providers/test_phone_number.py b/tests/providers/test_phone_number.py
index 156082cb..572e80d7 100644
--- a/tests/providers/test_phone_number.py
+++ b/tests/providers/test_phone_number.py
@@ -64,6 +64,12 @@ class TestPhoneNumber(unittest.TestCase):
assert msisdn.isdigit()
assert msisdn[0:4] in formats
+ def test_cellphone_pt_br(self):
+ factory = Faker('pt_BR')
+ cellphone = factory.cellphone_number()
+ assert cellphone is not None
+ assert len(cellphone) == 14
+
class TestHuHU(unittest.TestCase):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup==1.2.2
-e git+https://github.com/joke2k/faker.git@ba4994a9c1f84bab3aa3b21c7cc2a1e0e76d3f1c#egg=Faker
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
python-dateutil==2.9.0.post0
six==1.17.0
text-unidecode==1.2
tomli==2.2.1
|
name: faker
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- six==1.17.0
- text-unidecode==1.2
- tomli==2.2.1
prefix: /opt/conda/envs/faker
|
[
"tests/providers/test_phone_number.py::TestPhoneNumber::test_cellphone_pt_br"
] |
[] |
[
"tests/providers/test_phone_number.py::TestPhoneNumber::test_msisdn",
"tests/providers/test_phone_number.py::TestPhoneNumber::test_msisdn_pt_br",
"tests/providers/test_phone_number.py::TestPhoneNumber::test_phone_number",
"tests/providers/test_phone_number.py::TestPhoneNumber::test_phone_number_ja",
"tests/providers/test_phone_number.py::TestHuHU::test_phone_number"
] |
[] |
MIT License
| 3,246 |
[
"faker/providers/phone_number/pt_BR/__init__.py"
] |
[
"faker/providers/phone_number/pt_BR/__init__.py"
] |
|
Duke-GCB__bespin-cli-16
|
471cd4df56c852bee11fcb4725dc6b4e9053e08c
|
2018-10-15 15:07:04
|
2cef15b8296373f564d5cdf3c34503c1ca7f1e29
|
diff --git a/bespin/api.py b/bespin/api.py
index 5558ccd..dad9652 100644
--- a/bespin/api.py
+++ b/bespin/api.py
@@ -103,7 +103,7 @@ class BespinApi(object):
return self._post_request('/job-file-stage-groups/', {})
def dds_job_input_files_post(self, project_id, file_id, destination_path, sequence_group, sequence,
- dds_user_credentials, stage_group_id):
+ dds_user_credentials, stage_group_id, size):
data = {
"project_id": project_id,
"file_id": file_id,
@@ -111,7 +111,8 @@ class BespinApi(object):
"sequence_group": sequence_group,
"sequence": sequence,
"dds_user_credentials": dds_user_credentials,
- "stage_group": stage_group_id
+ "stage_group": stage_group_id,
+ "size": size,
}
return self._post_request('/dds-job-input-files/', data)
diff --git a/bespin/commands.py b/bespin/commands.py
index c8c1fb6..e30d252 100644
--- a/bespin/commands.py
+++ b/bespin/commands.py
@@ -288,8 +288,10 @@ class JobFile(object):
dds_project_ids = set()
sequence = 0
for dds_file, path in self.get_dds_files_details():
+ file_size = dds_file.current_version['upload']['size']
api.dds_job_input_files_post(dds_file.project_id, dds_file.id, path, 0, sequence,
- dds_user_credential['id'], stage_group_id=stage_group['id'])
+ dds_user_credential['id'], stage_group_id=stage_group['id'],
+ size=file_size)
sequence += 1
dds_project_ids.add(dds_file.project_id)
user_job_order_json = self.create_user_job_order_json()
diff --git a/bespin/dukeds.py b/bespin/dukeds.py
index 8753d3f..47816e2 100644
--- a/bespin/dukeds.py
+++ b/bespin/dukeds.py
@@ -8,6 +8,7 @@ INVALID_DUKEDS_FILE_PATH_MSG = "Invalid DukeDS file path ({})"
DUKEDS_FILE_PATH_MISSING_PREFIX = INVALID_DUKEDS_FILE_PATH_MSG.format("missing prefix")
DUKEDS_FILE_PATH_MISSING_SLASH = INVALID_DUKEDS_FILE_PATH_MSG.format("missing / between project and file path")
+
class DDSFileUtil(object):
def __init__(self):
self.client = Client()
|
Jobs created appear to have 0-byte input files
I created job 46 in dev, with two files from data service. Viewing the job in the UI suggests the files are zero bytes (see screenshot).

I logged into the VM and confirmed the files are downloading, so I expect this to work. Looks like the job created by bespin-cli does not include the input file's size.
|
Duke-GCB/bespin-cli
|
diff --git a/bespin/test_api.py b/bespin/test_api.py
index 99ad636..30f1804 100644
--- a/bespin/test_api.py
+++ b/bespin/test_api.py
@@ -145,7 +145,8 @@ class BespinApiTestCase(TestCase):
api = BespinApi(config=self.mock_config, user_agent_str=self.mock_user_agent_str)
dds_input_file = api.dds_job_input_files_post(project_id='123', file_id='456', destination_path='data.txt',
sequence_group=1, sequence=2,
- dds_user_credentials=4, stage_group_id=5)
+ dds_user_credentials=4, stage_group_id=5,
+ size=1000)
self.assertEqual(dds_input_file, 'dds-job-input-file1')
expected_json = {
@@ -155,7 +156,8 @@ class BespinApiTestCase(TestCase):
'sequence_group': 1,
'sequence': 2,
'dds_user_credentials': 4,
- 'stage_group': 5
+ 'stage_group': 5,
+ 'size': 1000,
}
mock_requests.post.assert_called_with('someurl/dds-job-input-files/', headers=self.expected_headers,
json=expected_json)
diff --git a/bespin/test_commands.py b/bespin/test_commands.py
index 5bd78a8..486bf81 100644
--- a/bespin/test_commands.py
+++ b/bespin/test_commands.py
@@ -336,14 +336,15 @@ class JobFileTestCase(TestCase):
'myint': 555
})
job_file.get_dds_files_details = Mock()
- mock_file = Mock(project_id=666)
+ mock_file = Mock(project_id=666, current_version={'upload': {'size': 4002}})
mock_file.id = 777
job_file.get_dds_files_details.return_value = [[mock_file, 'somepath']]
job_file.create_job(mock_api)
mock_api.questionnaires_list.assert_called_with(tag='sometag')
- mock_api.dds_job_input_files_post.assert_called_with(666, 777, 'somepath', 0, 0, 111, stage_group_id=333)
+ mock_api.dds_job_input_files_post.assert_called_with(666, 777, 'somepath', 0, 0, 111, stage_group_id=333,
+ size=4002)
json_payload = '{"myfile": {"class": "File", "path": "dds_project_somepath.txt"}, "myint": 555}'
mock_api.job_answer_set_post.assert_called_with('myjob', '001', json_payload, 222, 333)
mock_api.job_answer_set_create_job.assert_called_with(444)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 3
}
|
0.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
azure-common==1.1.28
azure-core==1.32.0
azure-identity==1.21.0
azure-mgmt-core==1.5.0
azure-mgmt-storage==22.1.1
azure-storage-blob==12.25.1
azure-storage-file-datalake==12.20.0
-e git+https://github.com/Duke-GCB/bespin-cli.git@471cd4df56c852bee11fcb4725dc6b4e9053e08c#egg=bespin_cli
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
cryptography==44.0.2
DukeDSClient==4.0.0
exceptiongroup==1.2.2
future==1.0.0
idna==3.10
iniconfig==2.1.0
isodate==0.7.2
mock==5.2.0
msal==1.32.0
msal-extensions==1.3.1
msgraph-core==0.2.2
packaging==24.2
pluggy==1.5.0
pycparser==2.22
PyJWT==2.10.1
pytest==8.3.5
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
six==1.17.0
tabulate==0.9.0
tenacity==6.2.0
tomli==2.2.1
typing_extensions==4.13.0
urllib3==2.3.0
|
name: bespin-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- azure-common==1.1.28
- azure-core==1.32.0
- azure-identity==1.21.0
- azure-mgmt-core==1.5.0
- azure-mgmt-storage==22.1.1
- azure-storage-blob==12.25.1
- azure-storage-file-datalake==12.20.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- cryptography==44.0.2
- dukedsclient==4.0.0
- exceptiongroup==1.2.2
- future==1.0.0
- idna==3.10
- iniconfig==2.1.0
- isodate==0.7.2
- mock==5.2.0
- msal==1.32.0
- msal-extensions==1.3.1
- msgraph-core==0.2.2
- packaging==24.2
- pluggy==1.5.0
- pycparser==2.22
- pyjwt==2.10.1
- pytest==8.3.5
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- six==1.17.0
- tabulate==0.9.0
- tenacity==6.2.0
- tomli==2.2.1
- typing-extensions==4.13.0
- urllib3==2.3.0
prefix: /opt/conda/envs/bespin-cli
|
[
"bespin/test_api.py::BespinApiTestCase::test_dds_job_input_files_post",
"bespin/test_commands.py::JobFileTestCase::test_create_job"
] |
[
"bespin/test_commands.py::JobFileTestCase::test_yaml_str"
] |
[
"bespin/test_api.py::BespinApiTestCase::test_authorize_job",
"bespin/test_api.py::BespinApiTestCase::test_cancel_job",
"bespin/test_api.py::BespinApiTestCase::test_dds_user_credentials_list",
"bespin/test_api.py::BespinApiTestCase::test_delete_connection_error",
"bespin/test_api.py::BespinApiTestCase::test_delete_job",
"bespin/test_api.py::BespinApiTestCase::test_get_connection_error",
"bespin/test_api.py::BespinApiTestCase::test_job_answer_set_create_job",
"bespin/test_api.py::BespinApiTestCase::test_job_answer_set_post",
"bespin/test_api.py::BespinApiTestCase::test_jobs_list",
"bespin/test_api.py::BespinApiTestCase::test_post_connection_error",
"bespin/test_api.py::BespinApiTestCase::test_questionnaire_get",
"bespin/test_api.py::BespinApiTestCase::test_questionnaires_list",
"bespin/test_api.py::BespinApiTestCase::test_restart_job",
"bespin/test_api.py::BespinApiTestCase::test_stage_group_post",
"bespin/test_api.py::BespinApiTestCase::test_start_job",
"bespin/test_api.py::BespinApiTestCase::test_workflow_version_get",
"bespin/test_api.py::BespinApiTestCase::test_workflow_versions_list",
"bespin/test_api.py::BespinApiTestCase::test_workflows_list",
"bespin/test_commands.py::CommandsTestCase::test_cancel_job",
"bespin/test_commands.py::CommandsTestCase::test_create_job",
"bespin/test_commands.py::CommandsTestCase::test_delete_job",
"bespin/test_commands.py::CommandsTestCase::test_init_job",
"bespin/test_commands.py::CommandsTestCase::test_jobs_list",
"bespin/test_commands.py::CommandsTestCase::test_restart_job",
"bespin/test_commands.py::CommandsTestCase::test_start_job_no_token",
"bespin/test_commands.py::CommandsTestCase::test_start_job_with_token",
"bespin/test_commands.py::CommandsTestCase::test_workflows_list_all_versions",
"bespin/test_commands.py::CommandsTestCase::test_workflows_list_latest_versions",
"bespin/test_commands.py::TableTestCase::test_str",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_get_column_data",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_ignores_workflows_without_versions_when_all",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_ignores_workflows_without_versions_when_latest",
"bespin/test_commands.py::JobFileTestCase::test_create_user_job_order_json",
"bespin/test_commands.py::JobFileTestCase::test_get_dds_files_details",
"bespin/test_commands.py::JobFileLoaderTestCase::test_create_job_file",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_invalid_job_order_params",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_invalid_name_and_fund_code",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_ok",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_create_job_file_with_placeholders",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_create_placeholder_value",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_format_user_fields",
"bespin/test_commands.py::JobOrderWalkerTestCase::test_format_file_path",
"bespin/test_commands.py::JobOrderWalkerTestCase::test_walk",
"bespin/test_commands.py::JobOrderPlaceholderCheckTestCase::test_walk",
"bespin/test_commands.py::JobOrderFormatFilesTestCase::test_walk",
"bespin/test_commands.py::JobOrderFileDetailsTestCase::test_walk",
"bespin/test_commands.py::JobsListTestCase::test_column_names",
"bespin/test_commands.py::JobsListTestCase::test_get_column_data",
"bespin/test_commands.py::JobsListTestCase::test_get_elapsed_hours",
"bespin/test_commands.py::JobsListTestCase::test_get_workflow_tag"
] |
[] |
MIT License
| 3,247 |
[
"bespin/api.py",
"bespin/dukeds.py",
"bespin/commands.py"
] |
[
"bespin/api.py",
"bespin/dukeds.py",
"bespin/commands.py"
] |
|
sky-uk__anticipy-71
|
abf46202f20ef148073903593d2ec571ca8b0793
|
2018-10-15 16:45:09
|
5fd4a26540955b34ae8ea06a82ce2714ba7985c8
|
slenas: @capelastegui @bezes guys could you please check my reply above and comment? As I'm seeing it, for me "path" is not exactly an optional parameter...
codecov-io: # [Codecov](https://codecov.io/gh/sky-uk/anticipy/pull/71?src=pr&el=h1) Report
> Merging [#71](https://codecov.io/gh/sky-uk/anticipy/pull/71?src=pr&el=desc) into [master](https://codecov.io/gh/sky-uk/anticipy/commit/abf46202f20ef148073903593d2ec571ca8b0793?src=pr&el=desc) will **decrease** coverage by `0.24%`.
> The diff coverage is `37.5%`.
[](https://codecov.io/gh/sky-uk/anticipy/pull/71?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #71 +/- ##
=========================================
- Coverage 84.85% 84.6% -0.25%
=========================================
Files 6 6
Lines 1373 1377 +4
=========================================
Hits 1165 1165
- Misses 208 212 +4
```
| [Impacted Files](https://codecov.io/gh/sky-uk/anticipy/pull/71?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [anticipy/app.py](https://codecov.io/gh/sky-uk/anticipy/pull/71/diff?src=pr&el=tree#diff-YW50aWNpcHkvYXBwLnB5) | `0% <0%> (ø)` | :arrow_up: |
| [anticipy/forecast\_plot.py](https://codecov.io/gh/sky-uk/anticipy/pull/71/diff?src=pr&el=tree#diff-YW50aWNpcHkvZm9yZWNhc3RfcGxvdC5weQ==) | `85.33% <42.85%> (-2.17%)` | :arrow_down: |
| [anticipy/forecast\_models.py](https://codecov.io/gh/sky-uk/anticipy/pull/71/diff?src=pr&el=tree#diff-YW50aWNpcHkvZm9yZWNhc3RfbW9kZWxzLnB5) | `86.84% <0%> (-0.05%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/sky-uk/anticipy/pull/71?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/sky-uk/anticipy/pull/71?src=pr&el=footer). Last update [abf4620...2782ecd](https://codecov.io/gh/sky-uk/anticipy/pull/71?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
|
diff --git a/anticipy/app.py b/anticipy/app.py
index 91ab7ff..05511cc 100644
--- a/anticipy/app.py
+++ b/anticipy/app.py
@@ -95,9 +95,8 @@ def run_forecast_app(path_in, path_out=None, forecast_years=2.0,
df_metadata.to_csv(path_metadata, index=False)
try:
- forecast_plot.plot_forecast(
- df_result, path_plot, output=output_format, width=1920,
- height=1080)
+ forecast_plot.plot_forecast(df_result, output_format, path_plot,
+ width=1920, height=1080)
except AssertionError:
logger.info("Couldn't generate plot - The required plotting library "
"is not installed")
diff --git a/anticipy/forecast_plot.py b/anticipy/forecast_plot.py
index 7427ccc..889a667 100644
--- a/anticipy/forecast_plot.py
+++ b/anticipy/forecast_plot.py
@@ -322,9 +322,8 @@ def _plotly_forecast_create(df_fcast, subplots, sources, nrows, ncols,
return fig
-def plot_forecast(df_fcast, path, output='html', width=None,
- height=None, title=None, dpi=70, show_legend=True,
- auto_open=False):
+def plot_forecast(df_fcast, output, path=None, width=None, height=None,
+ title=None, dpi=70, show_legend=True, auto_open=False):
"""
Generates matplotlib or plotly plot and saves it respectively as png or
html
@@ -334,12 +333,13 @@ def plot_forecast(df_fcast, path, output='html', width=None,
| - date (timestamp)
| - model (str) : ID for the forecast model
| - y (float) : Value of the time series in that sample
- | - is_actuals (bool) : True for actuals samples, False for forecasted samples # noqa
+ | - is_actuals (bool) : True for actuals samples, False for
+ | forecasted samples # noqa
:type df_fcast: pandas.DataFrame
+ :param output: Indicates the output type (html=Default, png or jupyter)
+ :type output: basestring
:param path: File path for output
:type path: basestring
- :param output: ...
- :type output: ...
:param width: Image width, in pixels
:type width: int
:param height: Image height, in pixels
@@ -353,10 +353,17 @@ def plot_forecast(df_fcast, path, output='html', width=None,
:param auto_open: Indicates whether the output will be displayed
automatically
:type auto_open: bool
+
+ :return: Success or failure code.
+ :rtype: int
"""
assert isinstance(df_fcast, pd.DataFrame)
+ if not path and (output == 'html' or output == 'png'):
+ logger.error('No export path provided.')
+ return 1
+
if 'source' in df_fcast.columns:
subplots = True
sources = df_fcast.loc[df_fcast['is_actuals'], 'source'].unique()
@@ -375,6 +382,7 @@ def plot_forecast(df_fcast, path, output='html', width=None,
fig = _matplotlib_forecast_create(df_fcast, subplots, sources,
nrows, ncols, width, height,
title, dpi, show_legend)
+
path = '{}.png'.format(path)
dirname, fname = os.path.split(path)
if not os.path.exists(dirname):
@@ -412,5 +420,6 @@ def plot_forecast(df_fcast, path, output='html', width=None,
else:
logger.error('Wrong exporting format provided. Either png, html or '
'jupyter formats are supported at the moment.')
- return 0
+ return 1
+ return 0
diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst
index df92fa1..5278592 100755
--- a/docs/source/tutorial.rst
+++ b/docs/source/tutorial.rst
@@ -41,19 +41,20 @@ The tool automatically selects the best model from a list of defaults - in this
users can instead provide their preferred model or lists of candidate models, as explained in :ref:`models`.
You can plot the forecast output using the functions in :py:mod:`forecast_plot`.
-:py:func:`anticipy.forecast_plot.plot_forecast_save` saves the plot as a file. If you use
-nsa.forecast in a Jupyter notebook, :py:func:`anticipy.forecast_plot.plot_forecast` shows the plot as the output of
-a notebook cell. The plot looks as follows:
+:py:func:`anticipy.forecast_plot.plot_forecast` saves the plot as a file or
+exports it to a jupyter notebook. The plot looks as follows:
.. image:: resources/tutorial-forecast1.png
The code to generate the plot is::
- path_tutorial_plot = 'plot-tutorial.png'
+ path_tutorial_plot = 'plot-tutorial'
# Save plot as a file
- forecast_plot.plot_forecast_save(df_forecast, path_tutorial_plot,width=350, height=240, title='Tutorial Forecast')
+ forecast_plot.plot_forecast(df_forecast, output='html',
+ path=path_tutorial_plot, width=350, height=240, title='Tutorial Forecast')
# Show plot in a jupyter notebook
- forecast_plot.plot_forecast(df_forecast, width=350, height=240, title='Tutorial Forecast')
+ forecast_plot.plot_forecast(df_forecast, output='jupyter', width=350,
+ height=240, title='Tutorial Forecast')
|
Make path an optional input variable in forecast_plot.plot_forecast()
When using `output='jupyter'`, no path is needed.
When `output='png'` or `output='html'` we need to verify path is not empty.
|
sky-uk/anticipy
|
diff --git a/tests/test_forecast_plot.py b/tests/test_forecast_plot.py
index cc97abb..c50a2cf 100644
--- a/tests/test_forecast_plot.py
+++ b/tests/test_forecast_plot.py
@@ -96,59 +96,85 @@ class TestForecastPlot(PandasTest):
if not forecast_plot._matplotlib_imported:
self.skipTest('Test skipped as Matplotlib is not installed...')
path = get_file_path(base_folder, 'test_mpl')
- forecast_plot.plot_forecast(df_forecast, path, 'png', 900, 600,
+ forecast_plot.plot_forecast(df_forecast, 'png', path, 900, 600,
'Test Plot', show_legend=False,
auto_open=False)
self.assertTrue(os.path.isfile('{}.png'.format(path)))
path = get_file_path(base_folder, 'test_facet_mpl')
- forecast_plot.plot_forecast(df_forecast_facet, path, 'png', 1200, 900,
+ forecast_plot.plot_forecast(df_forecast_facet, 'png', path, 1200, 900,
'Test Plot', show_legend=True,
auto_open=False)
self.assertTrue(os.path.isfile('{}.png'.format(path)))
# Repeat test with prediction intervals
path = get_file_path(base_folder, 'test_pi_mpl')
- forecast_plot.plot_forecast(df_forecast_pi, path, 'png', 900, 600,
+ forecast_plot.plot_forecast(df_forecast_pi, 'png', path, 900, 600,
'Test Plot', show_legend=True,
auto_open=False)
self.assertTrue(os.path.isfile('{}.png'.format(path)))
path = get_file_path(base_folder, 'test_pi_facet_mpl')
- forecast_plot.plot_forecast(df_forecast_pi_facet, path, 'png', 1200,
+ forecast_plot.plot_forecast(df_forecast_pi_facet, 'png', path, 1200,
900, 'Test Plot', show_legend=True,
auto_open=False)
self.assertTrue(os.path.isfile('{}.png'.format(path)))
+ # Test the case where a 'None' or an empty path is provided
+ self.assertTrue(forecast_plot.plot_forecast(df_forecast_pi_facet,
+ 'png', None, 1200, 900,
+ 'Test Plot',
+ show_legend=True,
+ auto_open=False))
+
+ self.assertTrue(forecast_plot.plot_forecast(df_forecast_pi_facet,
+ 'png', '', 1200, 900,
+ 'Test Plot',
+ show_legend=True,
+ auto_open=False))
+
def test_plot_forecast_html(self):
if not forecast_plot._plotly_imported:
self.skipTest('Test skipped as Plotly is not installed...')
path = get_file_path(base_folder, 'test_plotly')
- forecast_plot.plot_forecast(df_forecast, path, 'html', 900, 600,
+ forecast_plot.plot_forecast(df_forecast, 'html', path, 900, 600,
'Test Plot', show_legend=False,
auto_open=False)
self.assertTrue(os.path.isfile('{}.html'.format(path)))
path = get_file_path(base_folder, 'test_facet_plotly')
- forecast_plot.plot_forecast(df_forecast_facet, path, 'html', 1900,
+ forecast_plot.plot_forecast(df_forecast_facet, 'html', path, 1900,
1200, 'Test Plot', show_legend=False,
auto_open=False)
self.assertTrue(os.path.isfile('{}.html'.format(path)))
# Repeat test with prediction intervals
path = get_file_path(base_folder, 'test_pi_plotly')
- forecast_plot.plot_forecast(df_forecast_pi, path, 'html', 900, 600,
+ forecast_plot.plot_forecast(df_forecast_pi, 'html', path, 900, 600,
'Test Plot', show_legend=False,
auto_open=False)
self.assertTrue(os.path.isfile('{}.html'.format(path)))
path = get_file_path(base_folder, 'test_pi_facet_plotly')
- forecast_plot.plot_forecast(df_forecast_pi_facet, path, 'html', 1900,
+ forecast_plot.plot_forecast(df_forecast_pi_facet, 'html', path, 1900,
1200, 'Test Plot', show_legend=False,
auto_open=False)
self.assertTrue(os.path.isfile('{}.html'.format(path)))
+ # Test the case where a 'None' or an empty path is provided
+ self.assertTrue(forecast_plot.plot_forecast(df_forecast_pi_facet,
+ 'html', None, 1900, 1200,
+ 'Test Plot',
+ show_legend=False,
+ auto_open=False))
+
+ self.assertTrue(forecast_plot.plot_forecast(df_forecast_pi_facet,
+ 'html', '', 1900, 1200,
+ 'Test Plot',
+ show_legend=False,
+ auto_open=False))
+
def test_plot_forecast_jupyter(self):
if (not forecast_plot._plotly_imported) or \
(not forecast_plot._ipython_imported):
@@ -156,7 +182,6 @@ class TestForecastPlot(PandasTest):
'not installed...')
forecast_plot.plot_forecast(df_forecast_pi_facet,
- path=None,
output='jupyter',
width=1900,
height=1200,
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 3
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[extras]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/sky-uk/anticipy.git@abf46202f20ef148073903593d2ec571ca8b0793#egg=anticipy
attrs==22.2.0
backcall==0.2.0
certifi==2021.5.30
cycler==0.11.0
decorator==5.1.1
importlib-metadata==4.8.3
iniconfig==1.1.1
ipython==7.16.3
ipython-genutils==0.2.0
jedi==0.17.2
kiwisolver==1.3.1
matplotlib==3.3.4
numpy==1.19.5
packaging==21.3
pandas==1.1.5
parso==0.7.1
pexpect==4.9.0
pickleshare==0.7.5
Pillow==8.4.0
plotly==5.18.0
pluggy==1.0.0
prompt-toolkit==3.0.36
ptyprocess==0.7.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
scipy==1.5.4
six==1.17.0
tenacity==8.2.2
tomli==1.2.3
traitlets==4.3.3
typing_extensions==4.1.1
wcwidth==0.2.13
zipp==3.6.0
|
name: anticipy
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- backcall==0.2.0
- cycler==0.11.0
- decorator==5.1.1
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- ipython==7.16.3
- ipython-genutils==0.2.0
- jedi==0.17.2
- kiwisolver==1.3.1
- matplotlib==3.3.4
- numpy==1.19.5
- packaging==21.3
- pandas==1.1.5
- parso==0.7.1
- pexpect==4.9.0
- pickleshare==0.7.5
- pillow==8.4.0
- plotly==5.18.0
- pluggy==1.0.0
- prompt-toolkit==3.0.36
- ptyprocess==0.7.0
- py==1.11.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- scipy==1.5.4
- six==1.17.0
- tenacity==8.2.2
- tomli==1.2.3
- traitlets==4.3.3
- typing-extensions==4.1.1
- wcwidth==0.2.13
- zipp==3.6.0
prefix: /opt/conda/envs/anticipy
|
[
"tests/test_forecast_plot.py::TestForecastPlot::test_plot_forecast_html",
"tests/test_forecast_plot.py::TestForecastPlot::test_plot_forecast_png"
] |
[
"tests/test_forecast_plot.py::TestForecastPlot::test_plot_forecast_jupyter"
] |
[] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,249 |
[
"anticipy/app.py",
"anticipy/forecast_plot.py",
"docs/source/tutorial.rst"
] |
[
"anticipy/app.py",
"anticipy/forecast_plot.py",
"docs/source/tutorial.rst"
] |
dropbox__stone-117
|
1a5cb6d9eab6383dccd12678c3b8723e2a9317d5
|
2018-10-15 20:44:41
|
1a5cb6d9eab6383dccd12678c3b8723e2a9317d5
|
diff --git a/stone/backends/python_helpers.py b/stone/backends/python_helpers.py
index a3c4385..fa58f91 100644
--- a/stone/backends/python_helpers.py
+++ b/stone/backends/python_helpers.py
@@ -37,12 +37,12 @@ _type_table = {
Float32: 'float',
Float64: 'float',
Int32: 'int',
- Int64: 'long',
+ Int64: 'int',
List: 'list',
String: 'str',
Timestamp: 'datetime',
- UInt32: 'long',
- UInt64: 'long',
+ UInt32: 'int',
+ UInt64: 'int',
}
_reserved_keywords = {
diff --git a/stone/backends/python_type_mapping.py b/stone/backends/python_type_mapping.py
index d28fae0..10b6358 100644
--- a/stone/backends/python_type_mapping.py
+++ b/stone/backends/python_type_mapping.py
@@ -60,7 +60,7 @@ def map_stone_type_to_python_type(ns, data_type, override_dict=None):
elif is_float_type(data_type):
return 'float'
elif is_integer_type(data_type):
- return 'long'
+ return 'int'
elif is_void_type(data_type):
return 'None'
elif is_timestamp_type(data_type):
|
Generated .pyi files reference 'long', which is not Python 3 compatible
I can think of two ways to fix this:
1. The easy way: replace `'long'` with `'int'` [here](https://github.com/dropbox/stone/blob/master/stone/backends/python_type_mapping.py#L63)
2. Do something with the override_dict
A potential problem for (1) would be that it will not only change the generated .pyi files but also the generated .py files. I do think that even in Python 2 the distinction between int and long is rarely useful though, so perhaps this is acceptable.
The problem with (2) is that it's a lot more code, since the architecture for the override_dict doesn't really map cleanly to the way is_integer_type() is used. (In order to allow separate mappings for Int32, UIint32, Int64 and UInt64, we'd need 4 isinstance checks.)
|
dropbox/stone
|
diff --git a/test/test_python_type_stubs.py b/test/test_python_type_stubs.py
index 2e6e42e..ec85dea 100644
--- a/test/test_python_type_stubs.py
+++ b/test/test_python_type_stubs.py
@@ -276,15 +276,15 @@ class TestPythonTypeStubs(unittest.TestCase):
class Struct2(object):
def __init__(self,
- f2: List[long] = ...,
+ f2: List[int] = ...,
f3: datetime.datetime = ...,
- f4: Dict[Text, long] = ...) -> None: ...
+ f4: Dict[Text, int] = ...) -> None: ...
@property
- def f2(self) -> List[long]: ...
+ def f2(self) -> List[int]: ...
@f2.setter
- def f2(self, val: List[long]) -> None: ...
+ def f2(self, val: List[int]) -> None: ...
@f2.deleter
def f2(self) -> None: ...
@@ -301,10 +301,10 @@ class TestPythonTypeStubs(unittest.TestCase):
@property
- def f4(self) -> Dict[Text, long]: ...
+ def f4(self) -> Dict[Text, int]: ...
@f4.setter
- def f4(self, val: Dict[Text, long]) -> None: ...
+ def f4(self, val: Dict[Text, int]) -> None: ...
@f4.deleter
def f4(self) -> None: ...
@@ -340,24 +340,24 @@ class TestPythonTypeStubs(unittest.TestCase):
class NestedTypes(object):
def __init__(self,
- list_of_nullables: List[Optional[long]] = ...,
- nullable_list: Optional[List[long]] = ...) -> None: ...
+ list_of_nullables: List[Optional[int]] = ...,
+ nullable_list: Optional[List[int]] = ...) -> None: ...
@property
- def list_of_nullables(self) -> List[Optional[long]]: ...
+ def list_of_nullables(self) -> List[Optional[int]]: ...
@list_of_nullables.setter
- def list_of_nullables(self, val: List[Optional[long]]) -> None: ...
+ def list_of_nullables(self, val: List[Optional[int]]) -> None: ...
@list_of_nullables.deleter
def list_of_nullables(self) -> None: ...
@property
- def nullable_list(self) -> Optional[List[long]]: ...
+ def nullable_list(self) -> Optional[List[int]]: ...
@nullable_list.setter
- def nullable_list(self, val: Optional[List[long]]) -> None: ...
+ def nullable_list(self, val: Optional[List[int]]) -> None: ...
@nullable_list.deleter
def nullable_list(self) -> None: ...
diff --git a/test/test_python_types.py b/test/test_python_types.py
index 0f84f49..5c00cc2 100644
--- a/test/test_python_types.py
+++ b/test/test_python_types.py
@@ -165,7 +165,7 @@ class TestGeneratedPythonTypes(unittest.TestCase):
@property
def annotated_field(self):
"""
- :rtype: long
+ :rtype: int
"""
if self._annotated_field_present:
return self._annotated_field_value
@@ -186,7 +186,7 @@ class TestGeneratedPythonTypes(unittest.TestCase):
@property
def unannotated_field(self):
"""
- :rtype: long
+ :rtype: int
"""
if self._unannotated_field_present:
return self._unannotated_field_value
@@ -268,14 +268,14 @@ class TestGeneratedPythonTypes(unittest.TestCase):
"""
test parameter
- :rtype: long
+ :rtype: int
"""
return self._test_param
@property
def test_default_param(self):
"""
- :rtype: long
+ :rtype: int
"""
return self._test_default_param
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 2
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "ply>=3.4 six>=1.3.0 typing>=3.5.2",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
ply==3.11
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
six @ file:///tmp/build/80754af9/six_1644875935023/work
-e git+https://github.com/dropbox/stone.git@1a5cb6d9eab6383dccd12678c3b8723e2a9317d5#egg=stone
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: stone
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- ply=3.11=py36_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- six=1.16.0=pyhd3eb1b0_1
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- typing=3.10.0.0=py36h06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/stone
|
[
"test/test_python_type_stubs.py::TestPythonTypeStubs::test__generate_base_namespace_module__with_many_structs",
"test/test_python_type_stubs.py::TestPythonTypeStubs::test__generate_base_namespace_module__with_nested_types",
"test/test_python_types.py::TestGeneratedPythonTypes::test_annotation_type_class",
"test/test_python_types.py::TestGeneratedPythonTypes::test_struct_with_custom_annotations"
] |
[] |
[
"test/test_python_type_stubs.py::TestPythonTypeStubs::test__generate_base_namespace_module__with_alias",
"test/test_python_type_stubs.py::TestPythonTypeStubs::test__generate_base_namespace_module_with_empty_union",
"test/test_python_type_stubs.py::TestPythonTypeStubs::test__generate_base_namespace_module_with_union__generates_stuff",
"test/test_python_type_stubs.py::TestPythonTypeStubs::test__generate_routes",
"test/test_python_type_stubs.py::TestPythonTypeStubs::test__generate_routes_name_conflict",
"test/test_python_types.py::TestGeneratedPythonTypes::test_route_with_version_number",
"test/test_python_types.py::TestGeneratedPythonTypes::test_route_with_version_number_name_conflict"
] |
[] |
MIT License
| 3,250 |
[
"stone/backends/python_type_mapping.py",
"stone/backends/python_helpers.py"
] |
[
"stone/backends/python_type_mapping.py",
"stone/backends/python_helpers.py"
] |
|
oasis-open__cti-python-stix2-214
|
d69cc53dd2bdbcba9cdb2f9cf3eb3f80b7a73138
|
2018-10-15 23:19:44
|
3084c9f51fcd00cf6b0ed76827af90d0e86746d5
|
diff --git a/stix2/datastore/filters.py b/stix2/datastore/filters.py
index 03585ad..0172a50 100644
--- a/stix2/datastore/filters.py
+++ b/stix2/datastore/filters.py
@@ -123,8 +123,11 @@ def apply_common_filters(stix_objs, query):
Supports only STIX 2.0 common property properties.
Args:
- stix_objs (list): list of STIX objects to apply the query to
- query (set): set of filters (combined form complete query)
+ stix_objs (iterable): iterable of STIX objects to apply the query to
+ query (non-iterator iterable): iterable of filters. Can't be an
+ iterator (e.g. generator iterators won't work), since this is
+ used in an inner loop of a nested loop. So we require the ability
+ to traverse the filters repeatedly.
Yields:
STIX objects that successfully evaluate against the query.
diff --git a/stix2/datastore/memory.py b/stix2/datastore/memory.py
index c1d202d..eb8580e 100644
--- a/stix2/datastore/memory.py
+++ b/stix2/datastore/memory.py
@@ -1,27 +1,18 @@
"""
Python STIX 2.0 Memory Source/Sink
-
-TODO:
- Use deduplicate() calls only when memory corpus is dirty (been added to)
- can save a lot of time for successive queries
-
-Note:
- Not worrying about STIX versioning. The in memory STIX data at anytime
- will only hold one version of a STIX object. As such, when save() is called,
- the single versions of all the STIX objects are what is written to file.
-
"""
+import itertools
import json
import os
from stix2.base import _STIXBase
from stix2.core import Bundle, parse
from stix2.datastore import DataSink, DataSource, DataStoreMixin
-from stix2.datastore.filters import Filter, FilterSet, apply_common_filters
+from stix2.datastore.filters import FilterSet, apply_common_filters
-def _add(store, stix_data=None, version=None):
+def _add(store, stix_data=None, allow_custom=True, version=None):
"""Add STIX objects to MemoryStore/Sink.
Adds STIX objects to an in-memory dictionary for fast lookup.
@@ -33,27 +24,77 @@ def _add(store, stix_data=None, version=None):
None, use latest version.
"""
- if isinstance(stix_data, _STIXBase):
- # adding a python STIX object
- store._data[stix_data["id"]] = stix_data
+ if isinstance(stix_data, list):
+ # STIX objects are in a list- recurse on each object
+ for stix_obj in stix_data:
+ _add(store, stix_obj, allow_custom, version)
- elif isinstance(stix_data, dict):
- if stix_data["type"] == "bundle":
- # adding a json bundle - so just grab STIX objects
- for stix_obj in stix_data.get("objects", []):
- _add(store, stix_obj, version=version)
+ elif stix_data["type"] == "bundle":
+ # adding a json bundle - so just grab STIX objects
+ for stix_obj in stix_data.get("objects", []):
+ _add(store, stix_obj, allow_custom, version)
+
+ else:
+ # Adding a single non-bundle object
+ if isinstance(stix_data, _STIXBase):
+ stix_obj = stix_data
else:
- # adding a json STIX object
- store._data[stix_data["id"]] = stix_data
+ stix_obj = parse(stix_data, allow_custom, version)
- elif isinstance(stix_data, list):
- # STIX objects are in a list- recurse on each object
- for stix_obj in stix_data:
- _add(store, stix_obj, version=version)
+ # Map ID directly to the object, if it is a marking. Otherwise,
+ # map to a family, so we can track multiple versions.
+ if _is_marking(stix_obj):
+ store._data[stix_obj.id] = stix_obj
+ else:
+ if stix_obj.id in store._data:
+ obj_family = store._data[stix_obj.id]
+ else:
+ obj_family = _ObjectFamily()
+ store._data[stix_obj.id] = obj_family
+
+ obj_family.add(stix_obj)
+
+
+def _is_marking(obj_or_id):
+ """Determines whether the given object or object ID is/is for a marking
+ definition.
+
+ :param obj_or_id: A STIX object or object ID as a string.
+ :return: True if a marking definition, False otherwise.
+ """
+
+ if isinstance(obj_or_id, _STIXBase):
+ id_ = obj_or_id.id
else:
- raise TypeError("stix_data expected to be a python-stix2 object (or list of), JSON formatted STIX (or list of),"
- " or a JSON formatted STIX bundle. stix_data was of type: " + str(type(stix_data)))
+ id_ = obj_or_id
+
+ return id_.startswith("marking-definition--")
+
+
+class _ObjectFamily(object):
+ """
+ An internal implementation detail of memory sources/sinks/stores.
+ Represents a "family" of STIX objects: all objects with a particular
+ ID. (I.e. all versions.) The latest version is also tracked so that it
+ can be obtained quickly.
+ """
+ def __init__(self):
+ self.all_versions = {}
+ self.latest_version = None
+
+ def add(self, obj):
+ self.all_versions[obj.modified] = obj
+ if self.latest_version is None or \
+ obj.modified > self.latest_version.modified:
+ self.latest_version = obj
+
+ def __str__(self):
+ return "<<{}; latest={}>>".format(self.all_versions,
+ self.latest_version.modified)
+
+ def __repr__(self):
+ return str(self)
class MemoryStore(DataStoreMixin):
@@ -83,7 +124,7 @@ class MemoryStore(DataStoreMixin):
self._data = {}
if stix_data:
- _add(self, stix_data, version=version)
+ _add(self, stix_data, allow_custom, version=version)
super(MemoryStore, self).__init__(
source=MemorySource(stix_data=self._data, allow_custom=allow_custom, version=version, _store=True),
@@ -138,25 +179,32 @@ class MemorySink(DataSink):
"""
def __init__(self, stix_data=None, allow_custom=True, version=None, _store=False):
super(MemorySink, self).__init__()
- self._data = {}
self.allow_custom = allow_custom
if _store:
self._data = stix_data
- elif stix_data:
- _add(self, stix_data, version=version)
+ else:
+ self._data = {}
+ if stix_data:
+ _add(self, stix_data, allow_custom, version=version)
def add(self, stix_data, version=None):
- _add(self, stix_data, version=version)
+ _add(self, stix_data, self.allow_custom, version)
add.__doc__ = _add.__doc__
def save_to_file(self, file_path):
file_path = os.path.abspath(file_path)
+ all_objs = itertools.chain.from_iterable(
+ value.all_versions.values() if isinstance(value, _ObjectFamily)
+ else [value]
+ for value in self._data.values()
+ )
+
if not os.path.exists(os.path.dirname(file_path)):
os.makedirs(os.path.dirname(file_path))
with open(file_path, "w") as f:
- f.write(str(Bundle(list(self._data.values()), allow_custom=self.allow_custom)))
+ f.write(str(Bundle(list(all_objs), allow_custom=self.allow_custom)))
save_to_file.__doc__ = MemoryStore.save_to_file.__doc__
@@ -184,13 +232,14 @@ class MemorySource(DataSource):
"""
def __init__(self, stix_data=None, allow_custom=True, version=None, _store=False):
super(MemorySource, self).__init__()
- self._data = {}
self.allow_custom = allow_custom
if _store:
self._data = stix_data
- elif stix_data:
- _add(self, stix_data, version=version)
+ else:
+ self._data = {}
+ if stix_data:
+ _add(self, stix_data, allow_custom, version=version)
def get(self, stix_id, _composite_filters=None):
"""Retrieve STIX object from in-memory dict via STIX ID.
@@ -207,26 +256,26 @@ class MemorySource(DataSource):
is returned in the same form as it as added
"""
- if _composite_filters is None:
- # if get call is only based on 'id', no need to search, just retrieve from dict
- try:
- stix_obj = self._data[stix_id]
- except KeyError:
- stix_obj = None
- return stix_obj
+ stix_obj = None
- # if there are filters from the composite level, process full query
- query = [Filter("id", "=", stix_id)]
+ if _is_marking(stix_id):
+ stix_obj = self._data.get(stix_id)
+ else:
+ object_family = self._data.get(stix_id)
+ if object_family:
+ stix_obj = object_family.latest_version
- all_data = self.query(query=query, _composite_filters=_composite_filters)
+ if stix_obj:
+ all_filters = list(
+ itertools.chain(
+ _composite_filters or [],
+ self.filters
+ )
+ )
- if all_data:
- # reduce to most recent version
- stix_obj = sorted(all_data, key=lambda k: k['modified'])[0]
+ stix_obj = next(apply_common_filters([stix_obj], all_filters), None)
- return stix_obj
- else:
- return None
+ return stix_obj
def all_versions(self, stix_id, _composite_filters=None):
"""Retrieve STIX objects from in-memory dict via STIX ID, all versions of it
@@ -246,8 +295,30 @@ class MemorySource(DataSource):
is returned in the same form as it as added
"""
+ results = []
+ stix_objs_to_filter = None
+ if _is_marking(stix_id):
+ stix_obj = self._data.get(stix_id)
+ if stix_obj:
+ stix_objs_to_filter = [stix_obj]
+ else:
+ object_family = self._data.get(stix_id)
+ if object_family:
+ stix_objs_to_filter = object_family.all_versions.values()
+
+ if stix_objs_to_filter:
+ all_filters = list(
+ itertools.chain(
+ _composite_filters or [],
+ self.filters
+ )
+ )
- return [self.get(stix_id=stix_id, _composite_filters=_composite_filters)]
+ results.extend(
+ apply_common_filters(stix_objs_to_filter, all_filters)
+ )
+
+ return results
def query(self, query=None, _composite_filters=None):
"""Search and retrieve STIX objects based on the complete query.
@@ -265,7 +336,7 @@ class MemorySource(DataSource):
(list): list of STIX objects that matches the supplied
query. As the MemoryStore(i.e. MemorySink) adds STIX objects to memory
as they are supplied (either as python dictionary or STIX object), it
- is returned in the same form as it as added.
+ is returned in the same form as it was added.
"""
query = FilterSet(query)
@@ -276,17 +347,24 @@ class MemorySource(DataSource):
if _composite_filters:
query.add(_composite_filters)
+ all_objs = itertools.chain.from_iterable(
+ value.all_versions.values() if isinstance(value, _ObjectFamily)
+ else [value]
+ for value in self._data.values()
+ )
+
# Apply STIX common property filters.
- all_data = list(apply_common_filters(self._data.values(), query))
+ all_data = list(apply_common_filters(all_objs, query))
return all_data
def load_from_file(self, file_path, version=None):
- stix_data = json.load(open(os.path.abspath(file_path), "r"))
+ with open(os.path.abspath(file_path), "r") as f:
+ stix_data = json.load(f)
+ # Override user version selection if loading a bundle
if stix_data["type"] == "bundle":
- for stix_obj in stix_data["objects"]:
- _add(self, stix_data=parse(stix_obj, allow_custom=self.allow_custom, version=stix_data["spec_version"]))
- else:
- _add(self, stix_data=parse(stix_data, allow_custom=self.allow_custom, version=version))
+ version = stix_data["spec_version"]
+
+ _add(self, stix_data, self.allow_custom, version)
load_from_file.__doc__ = MemoryStore.load_from_file.__doc__
|
Support multiple versions of an object in MemorySource
This would probably involve storing the objects in a dictionary of lists instead of just a list.
|
oasis-open/cti-python-stix2
|
diff --git a/stix2/test/test_datastore_memory.py b/stix2/test/test_datastore_memory.py
index 3d69953..cdb3818 100644
--- a/stix2/test/test_datastore_memory.py
+++ b/stix2/test/test_datastore_memory.py
@@ -2,7 +2,9 @@ import pytest
from stix2.datastore import CompositeDataSource, make_id
from stix2.datastore.filters import Filter
-from stix2.datastore.memory import MemorySink, MemorySource
+from stix2.datastore.memory import MemorySink, MemorySource, MemoryStore
+from stix2.utils import parse_into_datetime
+from stix2.v20.common import TLP_GREEN
def test_add_remove_composite_datasource():
@@ -44,14 +46,14 @@ def test_composite_datasource_operations(stix_objs1, stix_objs2):
indicators = cds1.all_versions("indicator--00000000-0000-4000-8000-000000000001")
# In STIX_OBJS2 changed the 'modified' property to a later time...
- assert len(indicators) == 2
+ assert len(indicators) == 3
cds1.add_data_sources([cds2])
indicator = cds1.get("indicator--00000000-0000-4000-8000-000000000001")
assert indicator["id"] == "indicator--00000000-0000-4000-8000-000000000001"
- assert indicator["modified"] == "2017-01-31T13:49:53.935Z"
+ assert indicator["modified"] == parse_into_datetime("2017-01-31T13:49:53.935Z")
assert indicator["type"] == "indicator"
query1 = [
@@ -68,20 +70,80 @@ def test_composite_datasource_operations(stix_objs1, stix_objs2):
# STIX_OBJS2 has indicator with later time, one with different id, one with
# original time in STIX_OBJS1
- assert len(results) == 3
+ assert len(results) == 4
indicator = cds1.get("indicator--00000000-0000-4000-8000-000000000001")
assert indicator["id"] == "indicator--00000000-0000-4000-8000-000000000001"
- assert indicator["modified"] == "2017-01-31T13:49:53.935Z"
+ assert indicator["modified"] == parse_into_datetime("2017-01-31T13:49:53.935Z")
assert indicator["type"] == "indicator"
- # There is only one indicator with different ID. Since we use the same data
- # when deduplicated, only two indicators (one with different modified).
results = cds1.all_versions("indicator--00000000-0000-4000-8000-000000000001")
- assert len(results) == 2
+ assert len(results) == 3
# Since we have filters already associated with our CompositeSource providing
# nothing returns the same as cds1.query(query1) (the associated query is query2)
results = cds1.query([])
- assert len(results) == 3
+ assert len(results) == 4
+
+
+def test_source_markings():
+ msrc = MemorySource(TLP_GREEN)
+
+ assert msrc.get(TLP_GREEN.id) == TLP_GREEN
+ assert msrc.all_versions(TLP_GREEN.id) == [TLP_GREEN]
+ assert msrc.query(Filter("id", "=", TLP_GREEN.id)) == [TLP_GREEN]
+
+
+def test_sink_markings():
+ # just make sure there is no crash
+ msink = MemorySink(TLP_GREEN)
+ msink.add(TLP_GREEN)
+
+
+def test_store_markings():
+ mstore = MemoryStore(TLP_GREEN)
+
+ assert mstore.get(TLP_GREEN.id) == TLP_GREEN
+ assert mstore.all_versions(TLP_GREEN.id) == [TLP_GREEN]
+ assert mstore.query(Filter("id", "=", TLP_GREEN.id)) == [TLP_GREEN]
+
+
+def test_source_mixed(indicator):
+ msrc = MemorySource([TLP_GREEN, indicator])
+
+ assert msrc.get(TLP_GREEN.id) == TLP_GREEN
+ assert msrc.all_versions(TLP_GREEN.id) == [TLP_GREEN]
+ assert msrc.query(Filter("id", "=", TLP_GREEN.id)) == [TLP_GREEN]
+
+ assert msrc.get(indicator.id) == indicator
+ assert msrc.all_versions(indicator.id) == [indicator]
+ assert msrc.query(Filter("id", "=", indicator.id)) == [indicator]
+
+ all_objs = msrc.query()
+ assert TLP_GREEN in all_objs
+ assert indicator in all_objs
+ assert len(all_objs) == 2
+
+
+def test_sink_mixed(indicator):
+ # just make sure there is no crash
+ msink = MemorySink([TLP_GREEN, indicator])
+ msink.add([TLP_GREEN, indicator])
+
+
+def test_store_mixed(indicator):
+ mstore = MemoryStore([TLP_GREEN, indicator])
+
+ assert mstore.get(TLP_GREEN.id) == TLP_GREEN
+ assert mstore.all_versions(TLP_GREEN.id) == [TLP_GREEN]
+ assert mstore.query(Filter("id", "=", TLP_GREEN.id)) == [TLP_GREEN]
+
+ assert mstore.get(indicator.id) == indicator
+ assert mstore.all_versions(indicator.id) == [indicator]
+ assert mstore.query(Filter("id", "=", indicator.id)) == [indicator]
+
+ all_objs = mstore.query()
+ assert TLP_GREEN in all_objs
+ assert indicator in all_objs
+ assert len(all_objs) == 2
diff --git a/stix2/test/test_environment.py b/stix2/test/test_environment.py
index d179ae9..a3ec469 100644
--- a/stix2/test/test_environment.py
+++ b/stix2/test/test_environment.py
@@ -113,7 +113,7 @@ def test_environment_functions():
# Get both versions of the object
resp = env.all_versions(INDICATOR_ID)
- assert len(resp) == 1 # should be 2, but MemoryStore only keeps 1 version of objects
+ assert len(resp) == 2
# Get just the most recent version of the object
resp = env.get(INDICATOR_ID)
diff --git a/stix2/test/test_memory.py b/stix2/test/test_memory.py
index 44f90ba..7499326 100644
--- a/stix2/test/test_memory.py
+++ b/stix2/test/test_memory.py
@@ -7,6 +7,7 @@ from stix2 import (Bundle, Campaign, CustomObject, Filter, Identity, Indicator,
Malware, MemorySource, MemoryStore, Relationship,
properties)
from stix2.datastore import make_id
+from stix2.utils import parse_into_datetime
from .constants import (CAMPAIGN_ID, CAMPAIGN_KWARGS, IDENTITY_ID,
IDENTITY_KWARGS, INDICATOR_ID, INDICATOR_KWARGS,
@@ -167,7 +168,7 @@ def test_memory_store_all_versions(mem_store):
type="bundle"))
resp = mem_store.all_versions("indicator--00000000-0000-4000-8000-000000000001")
- assert len(resp) == 1 # MemoryStore can only store 1 version of each object
+ assert len(resp) == 3
def test_memory_store_query(mem_store):
@@ -179,25 +180,27 @@ def test_memory_store_query(mem_store):
def test_memory_store_query_single_filter(mem_store):
query = Filter('id', '=', 'indicator--00000000-0000-4000-8000-000000000001')
resp = mem_store.query(query)
- assert len(resp) == 1
+ assert len(resp) == 2
def test_memory_store_query_empty_query(mem_store):
resp = mem_store.query()
# sort since returned in random order
- resp = sorted(resp, key=lambda k: k['id'])
- assert len(resp) == 2
+ resp = sorted(resp, key=lambda k: (k['id'], k['modified']))
+ assert len(resp) == 3
assert resp[0]['id'] == 'indicator--00000000-0000-4000-8000-000000000001'
- assert resp[0]['modified'] == '2017-01-27T13:49:53.936Z'
- assert resp[1]['id'] == 'indicator--00000000-0000-4000-8000-000000000002'
- assert resp[1]['modified'] == '2017-01-27T13:49:53.935Z'
+ assert resp[0]['modified'] == parse_into_datetime('2017-01-27T13:49:53.935Z')
+ assert resp[1]['id'] == 'indicator--00000000-0000-4000-8000-000000000001'
+ assert resp[1]['modified'] == parse_into_datetime('2017-01-27T13:49:53.936Z')
+ assert resp[2]['id'] == 'indicator--00000000-0000-4000-8000-000000000002'
+ assert resp[2]['modified'] == parse_into_datetime('2017-01-27T13:49:53.935Z')
def test_memory_store_query_multiple_filters(mem_store):
mem_store.source.filters.add(Filter('type', '=', 'indicator'))
query = Filter('id', '=', 'indicator--00000000-0000-4000-8000-000000000001')
resp = mem_store.query(query)
- assert len(resp) == 1
+ assert len(resp) == 2
def test_memory_store_save_load_file(mem_store, fs_mem_store):
@@ -218,12 +221,8 @@ def test_memory_store_save_load_file(mem_store, fs_mem_store):
def test_memory_store_add_invalid_object(mem_store):
ind = ('indicator', IND1) # tuple isn't valid
- with pytest.raises(TypeError) as excinfo:
+ with pytest.raises(TypeError):
mem_store.add(ind)
- assert 'stix_data expected to be' in str(excinfo.value)
- assert 'a python-stix2 object' in str(excinfo.value)
- assert 'JSON formatted STIX' in str(excinfo.value)
- assert 'JSON formatted STIX bundle' in str(excinfo.value)
def test_memory_store_object_with_custom_property(mem_store):
@@ -246,10 +245,9 @@ def test_memory_store_object_with_custom_property_in_bundle(mem_store):
allow_custom=True)
bundle = Bundle(camp, allow_custom=True)
- mem_store.add(bundle, True)
+ mem_store.add(bundle)
- bundle_r = mem_store.get(bundle.id)
- camp_r = bundle_r['objects'][0]
+ camp_r = mem_store.get(camp.id)
assert camp_r.id == camp.id
assert camp_r.x_empire == camp.x_empire
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 2
}
|
1.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
antlr4-python3-runtime==4.9.3
async-generator==1.10
attrs==22.2.0
Babel==2.11.0
backcall==0.2.0
bleach==4.1.0
bump2version==1.0.1
bumpversion==0.6.0
certifi==2021.5.30
cfgv==3.3.1
charset-normalizer==2.0.12
coverage==6.2
decorator==5.1.1
defusedxml==0.7.1
distlib==0.3.9
docutils==0.18.1
entrypoints==0.4
filelock==3.4.1
identify==2.4.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
importlib-resources==5.2.3
iniconfig==1.1.1
ipython==7.16.3
ipython-genutils==0.2.0
jedi==0.17.2
Jinja2==3.0.3
jsonschema==3.2.0
jupyter-client==7.1.2
jupyter-core==4.9.2
jupyterlab-pygments==0.1.2
MarkupSafe==2.0.1
mistune==0.8.4
nbclient==0.5.9
nbconvert==6.0.7
nbformat==5.1.3
nbsphinx==0.3.2
nest-asyncio==1.6.0
nodeenv==1.6.0
packaging==21.3
pandocfilters==1.5.1
parso==0.7.1
pexpect==4.9.0
pickleshare==0.7.5
platformdirs==2.4.0
pluggy==1.0.0
pre-commit==2.17.0
prompt-toolkit==3.0.36
ptyprocess==0.7.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.1
pyzmq==25.1.2
requests==2.27.1
simplejson==3.20.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==1.5.6
sphinx-prompt==1.5.0
-e git+https://github.com/oasis-open/cti-python-stix2.git@d69cc53dd2bdbcba9cdb2f9cf3eb3f80b7a73138#egg=stix2
stix2-patterns==2.0.0
testpath==0.6.0
toml==0.10.2
tomli==1.2.3
tornado==6.1
tox==3.28.0
traitlets==4.3.3
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
wcwidth==0.2.13
webencodings==0.5.1
zipp==3.6.0
|
name: cti-python-stix2
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- antlr4-python3-runtime==4.9.3
- async-generator==1.10
- attrs==22.2.0
- babel==2.11.0
- backcall==0.2.0
- bleach==4.1.0
- bump2version==1.0.1
- bumpversion==0.6.0
- cfgv==3.3.1
- charset-normalizer==2.0.12
- coverage==6.2
- decorator==5.1.1
- defusedxml==0.7.1
- distlib==0.3.9
- docutils==0.18.1
- entrypoints==0.4
- filelock==3.4.1
- identify==2.4.4
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.8.3
- importlib-resources==5.2.3
- iniconfig==1.1.1
- ipython==7.16.3
- ipython-genutils==0.2.0
- jedi==0.17.2
- jinja2==3.0.3
- jsonschema==3.2.0
- jupyter-client==7.1.2
- jupyter-core==4.9.2
- jupyterlab-pygments==0.1.2
- markupsafe==2.0.1
- mistune==0.8.4
- nbclient==0.5.9
- nbconvert==6.0.7
- nbformat==5.1.3
- nbsphinx==0.3.2
- nest-asyncio==1.6.0
- nodeenv==1.6.0
- packaging==21.3
- pandocfilters==1.5.1
- parso==0.7.1
- pexpect==4.9.0
- pickleshare==0.7.5
- platformdirs==2.4.0
- pluggy==1.0.0
- pre-commit==2.17.0
- prompt-toolkit==3.0.36
- ptyprocess==0.7.0
- py==1.11.0
- pygments==2.14.0
- pyparsing==3.1.4
- pyrsistent==0.18.0
- pytest==7.0.1
- pytest-cov==4.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.1
- pyzmq==25.1.2
- requests==2.27.1
- simplejson==3.20.1
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==1.5.6
- sphinx-prompt==1.5.0
- stix2-patterns==2.0.0
- testpath==0.6.0
- toml==0.10.2
- tomli==1.2.3
- tornado==6.1
- tox==3.28.0
- traitlets==4.3.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- virtualenv==20.16.2
- wcwidth==0.2.13
- webencodings==0.5.1
- zipp==3.6.0
prefix: /opt/conda/envs/cti-python-stix2
|
[
"stix2/test/test_datastore_memory.py::test_composite_datasource_operations",
"stix2/test/test_environment.py::test_environment_functions",
"stix2/test/test_memory.py::test_memory_store_all_versions",
"stix2/test/test_memory.py::test_memory_store_query_single_filter",
"stix2/test/test_memory.py::test_memory_store_query_empty_query",
"stix2/test/test_memory.py::test_memory_store_query_multiple_filters",
"stix2/test/test_memory.py::test_memory_store_object_with_custom_property_in_bundle"
] |
[] |
[
"stix2/test/test_datastore_memory.py::test_add_remove_composite_datasource",
"stix2/test/test_datastore_memory.py::test_source_markings",
"stix2/test/test_datastore_memory.py::test_sink_markings",
"stix2/test/test_datastore_memory.py::test_store_markings",
"stix2/test/test_datastore_memory.py::test_source_mixed",
"stix2/test/test_datastore_memory.py::test_sink_mixed",
"stix2/test/test_datastore_memory.py::test_store_mixed",
"stix2/test/test_environment.py::test_object_factory_created_by_ref_str",
"stix2/test/test_environment.py::test_object_factory_created_by_ref_obj",
"stix2/test/test_environment.py::test_object_factory_override_default",
"stix2/test/test_environment.py::test_object_factory_created",
"stix2/test/test_environment.py::test_object_factory_external_reference",
"stix2/test/test_environment.py::test_object_factory_obj_markings",
"stix2/test/test_environment.py::test_object_factory_list_append",
"stix2/test/test_environment.py::test_object_factory_list_replace",
"stix2/test/test_environment.py::test_environment_source_and_sink",
"stix2/test/test_environment.py::test_environment_datastore_and_sink",
"stix2/test/test_environment.py::test_environment_no_datastore",
"stix2/test/test_environment.py::test_environment_add_filters",
"stix2/test/test_environment.py::test_environment_datastore_and_no_object_factory",
"stix2/test/test_environment.py::test_parse_malware",
"stix2/test/test_environment.py::test_creator_of",
"stix2/test/test_environment.py::test_creator_of_no_datasource",
"stix2/test/test_environment.py::test_creator_of_not_found",
"stix2/test/test_environment.py::test_creator_of_no_created_by_ref",
"stix2/test/test_environment.py::test_relationships",
"stix2/test/test_environment.py::test_relationships_no_id",
"stix2/test/test_environment.py::test_relationships_by_type",
"stix2/test/test_environment.py::test_relationships_by_source",
"stix2/test/test_environment.py::test_relationships_by_target",
"stix2/test/test_environment.py::test_relationships_by_target_and_type",
"stix2/test/test_environment.py::test_relationships_by_target_and_source",
"stix2/test/test_environment.py::test_related_to",
"stix2/test/test_environment.py::test_related_to_no_id",
"stix2/test/test_environment.py::test_related_to_by_source",
"stix2/test/test_environment.py::test_related_to_by_target",
"stix2/test/test_memory.py::test_memory_source_get",
"stix2/test/test_memory.py::test_memory_source_get_nonexistant_object",
"stix2/test/test_memory.py::test_memory_store_query",
"stix2/test/test_memory.py::test_memory_store_save_load_file",
"stix2/test/test_memory.py::test_memory_store_add_invalid_object",
"stix2/test/test_memory.py::test_memory_store_object_with_custom_property",
"stix2/test/test_memory.py::test_memory_store_custom_object",
"stix2/test/test_memory.py::test_relationships",
"stix2/test/test_memory.py::test_relationships_by_type",
"stix2/test/test_memory.py::test_relationships_by_source",
"stix2/test/test_memory.py::test_relationships_by_target",
"stix2/test/test_memory.py::test_relationships_by_target_and_type",
"stix2/test/test_memory.py::test_relationships_by_target_and_source",
"stix2/test/test_memory.py::test_related_to",
"stix2/test/test_memory.py::test_related_to_by_source",
"stix2/test/test_memory.py::test_related_to_by_target"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,251 |
[
"stix2/datastore/filters.py",
"stix2/datastore/memory.py"
] |
[
"stix2/datastore/filters.py",
"stix2/datastore/memory.py"
] |
|
seequent__pure_interface-24
|
cf06d397e09fb0b643264185eecc39b4a9d4e26f
|
2018-10-16 04:49:43
|
cf06d397e09fb0b643264185eecc39b4a9d4e26f
|
diff --git a/README.rst b/README.rst
index 82807e6..9ba6420 100644
--- a/README.rst
+++ b/README.rst
@@ -8,7 +8,8 @@ A Python interface library that disallows function body content on interfaces an
Jump to the `Reference`_.
-**Features:**
+Features
+--------
* Prevents code in method bodies of an interface class
* Ensures that method overrides have compatible signatures
* Allows concrete implementations the flexibility to implement abstract properties as instance attributes.
@@ -32,7 +33,7 @@ pure_interface depends on the six_ and typing_ modules (typing is included in py
.. _six: https://pypi.python.org/pypi/six
.. _typing: https://pypi.python.org/pypi/typing
-You can install released versions of pure_interface using pip::
+You can install released versions of ``pure_interface`` using pip::
pip install pure_interface
@@ -64,16 +65,17 @@ on Python 2.7 ``abstractclassmethod`` and ``abstractstaticmethod`` are also avai
However these decorators are optional as **ALL** methods and properties on a pure interface are abstract. In the
example above, both ``height`` and ``speak`` are considered abstract and must be overridden by subclasses.
-Because of this, interface classes cannot be instantiated ::
-
- IAnimal()
- TypeError: Interfaces cannot be instantiated.
Including abstract decorators in your code can be useful for reminding yourself (and telling your IDE) that you need
to override those methods. Another common way of informing an IDE that a method needs to be overridden is for
the method to raise ``NotImplementedError``. For this reason methods that just raise ``NotImplementedError`` are also
considered empty.
+Interface classes cannot be instantiated ::
+
+ IAnimal()
+ TypeError: Interfaces cannot be instantiated.
+
Including code in a method will result in an ``InterfaceError`` being raised when the module is imported. For example::
class BadInterface(PureInterface):
@@ -84,11 +86,12 @@ Including code in a method will result in an ``InterfaceError`` being raised whe
Did you forget to inherit from object to make the class concrete?
Inspired by PEP-544_ ``pure_interface`` also allows using class attributes to specify required interface attributes.
+This is now the preferred way to specify the existance of an attribute in an interface.
+The use of class attribute or ``@property`` to define a the existance of an attribute are usually interchangable [#attr]_.
.. _PEP-544: https://www.python.org/dev/peps/pep-0544/
-The use of class attribute or ``@property`` to define a class attribute are interchangable. This interface is equivalent
-to the one above::
+This interface is equivalent to the one above::
class IAnimal(PureInterface):
height = None
@@ -104,7 +107,7 @@ The value assigned to class attributes *must* be ``None`` and the attribute is r
This is because ``IAnimal`` is an interface definition and not an implementation. Of course, concrete implementations
may use class attributes as normal.
-In Python 3.6 and later type annotations can also be used to define interface properties::
+In Python 3.6 and later type annotations are the preferred way to define interface attributes::
class IAnimal(PureInterface):
height: float
@@ -150,6 +153,8 @@ and properties that satisfy the empty method criteria will result in a type that
def bar(self):
pass
+.. _attributes:
+
Concrete implementations may implement interface properties as normal attributes,
provided that they are all set in the constructor::
@@ -165,8 +170,8 @@ You can also implement interface class attributes as properties if desired.
The astute reader will notice that the ``Animal2`` bases list makes an inconsistent method resolution order.
This is handled by the ``PureInterfaceType`` meta-class by removing ``object`` from the front of the bases list.
-However static checkers such as mypy_ will complain. To get around this, ``pure_interface`` includes an empty
-``Concrete`` class which you can use to keep mypy happy::
+However static checkers such as mypy_ and some IDE's will complain. To get around this, ``pure_interface`` includes an empty
+``Concrete`` class which you can use to keep mypy and your IDE happy::
class Concrete(object):
pass
@@ -579,3 +584,31 @@ Module Attributes
**missing_method_warnings**
The list of warning messages for concrete classes with missing interface (abstract) method overrides.
Note that missing properties are NOT checked for as they may be provided by instance attributes.
+
+Footnotes
+---------
+
+.. [#attr] For the sake of clarity lets consider 2 interfaces and 2 concrete implementations
+
+::
+
+ class I1(PureInterface)
+ @property
+ def foo(self):
+ pass
+
+ class I2(PureInterface):
+ foo = None
+
+ class C1(I1):
+ def __init__(self):
+ self.foo = 1
+
+ class C2(I2):
+ def __init__(self):
+ self.foo = 1
+
+
+When constructing class ``C1`` the meta-class creates a property for ``foo`` to override the abstract property on ``I1``.
+When constructing class ``C2`` this is not necessary.
+This also means that ``C1().foo`` is a descriptor call whereas ``C2().foo`` is a faster ``__dict__`` lookup.
diff --git a/pure_interface.py b/pure_interface.py
index e3fb607..1791684 100644
--- a/pure_interface.py
+++ b/pure_interface.py
@@ -77,7 +77,8 @@ class _PIAttributes(object):
def __init__(self, type_is_interface, interface_method_signatures, interface_property_names,
interface_attribute_names):
self.type_is_pure_interface = type_is_interface
- self.abstractproperties = frozenset() # properties that must be provided by instances
+ # abstractproperties are checked for at instantiation
+ self.abstractproperties = frozenset(interface_attribute_names)
self.interface_method_names = frozenset(interface_method_signatures.keys()) # type: FrozenSet[str]
self.interface_property_names = frozenset(interface_property_names) # type: FrozenSet[str]
self.interface_attribute_names = frozenset(interface_attribute_names) # type: FrozenSet[str]
@@ -269,7 +270,7 @@ def _get_instructions(code_obj):
def _is_descriptor(obj): # in our context we only care about __get__
- return hasattr(obj, '__get__')
+ return hasattr(obj, '__get__') and not isinstance(obj, types.FunctionType)
def _signature_info(arg_spec):
@@ -528,8 +529,6 @@ class PureInterfaceType(abc.ABCMeta):
missing_method_warnings.append(message)
warnings.warn(message, stacklevel=stacklevel)
- if type_is_interface and not cls.__abstractmethods__:
- cls.__abstractmethods__ = frozenset({''}) # empty interfaces still should not be instantiated
return cls
def __call__(cls, *args, **kwargs):
@@ -540,9 +539,6 @@ class PureInterfaceType(abc.ABCMeta):
for attr in cls._pi.abstractproperties:
if not hasattr(self, attr):
raise TypeError('{}.__init__ does not create required attribute "{}"'.format(cls.__name__, attr))
- for attr in cls._pi.interface_attribute_names:
- if not hasattr(self, attr):
- raise TypeError('{}.__init__ does not create required attribute "{}"'.format(cls.__name__, attr))
return self
def __dir__(cls):
|
Implementation attribute check failing if exception raised within property
The following code snippet produces the error:
TypeError: AnimalAttribute.__init__ does not create required attribute "height"
```python
class IAnimalAttribute(PureInterface):
height = None
class AnimalAttribute(object, IAnimalAttribute):
@property
def height(self):
raise Exception("Bang")
animal = AnimalAttribute()
```
This is caused by python 2 hasattr behaviour meaning if any exception in a property is raised hasattr returns false. Also confusingly the following works, contrary to the README which states "The use of class attribute or @property to define a class attribute are interchangeable":
```python
class IAnimal(PureInterface):
@abstractproperty
def height(self):
pass
class Animal(object, IAnimal):
@property
def height(self):
raise Exception("Bang")
animal = Animal()
```
|
seequent/pure_interface
|
diff --git a/tests/test_implementation_checks.py b/tests/test_implementation_checks.py
index 46e87eb..cfc2dc6 100644
--- a/tests/test_implementation_checks.py
+++ b/tests/test_implementation_checks.py
@@ -63,6 +63,20 @@ class ISimple(pure_interface.PureInterface):
pass
+class ICrossImplementation(pure_interface.PureInterface):
+ """ interface to test class attributes implemented as properties and vice versa """
+ a = None
+ b = None
+
+ @property
+ def c(self):
+ pass
+
+ @property
+ def d(self):
+ pass
+
+
class TestImplementationChecks(unittest.TestCase):
def test_instantiation_fails(self):
with self.assertRaises(TypeError):
@@ -379,6 +393,12 @@ class IAttribute(pure_interface.PureInterface):
a = None
+class RaisingProperty(object, IAttribute):
+ @property
+ def a(self):
+ raise Exception("Bang")
+
+
class TestAttributeImplementations(unittest.TestCase):
def test_class_attribute_in_interface(self):
self.assertIn('a', pure_interface.get_interface_attribute_names(IAttribute))
@@ -443,12 +463,19 @@ class TestAttributeImplementations(unittest.TestCase):
exec(py_36_tests)
def test_mock_spec_includes_attrs(self):
- m = mock.MagicMock(spec=IAttribute)
+ m = mock.MagicMock(spec=IAttribute, instance=True)
try:
x = m.a
except AttributeError:
self.fail("class attribute not mocked")
+ def test_raising_property(self):
+ """ Issue 23 """
+ try:
+ a = RaisingProperty()
+ except:
+ self.fail('Instantiation with property that raises failed')
+
py_36_tests = """
def test_annotations(self):
@@ -469,3 +496,25 @@ def test_annotations2(self):
test_annotations(self)
test_annotations2(self)
"""
+
+
+class TestCrossImplementations(unittest.TestCase):
+ """ test class attributes implemented as properties and vice versa """
+ def test_cross_implementations(self):
+ class CrossImplementation(pure_interface.Concrete, ICrossImplementation):
+ def __init__(self):
+ self.a = 1
+ self.c = 2
+
+ @property
+ def b(self):
+ return 3
+
+ @property
+ def d(self):
+ return 4
+
+ c = CrossImplementation()
+ self.assertEqual(frozenset(['a', 'c']), CrossImplementation._pi.abstractproperties)
+ self.assertEqual(frozenset(['a', 'b']), CrossImplementation._pi.interface_attribute_names)
+ self.assertEqual(frozenset(['c', 'd']), CrossImplementation._pi.interface_property_names)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 2
}
|
3.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt",
"requirements_dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
decorator==5.2.1
exceptiongroup==1.2.2
future==1.0.0
iniconfig==2.1.0
mock==5.2.0
packaging==24.2
pluggy==1.5.0
-e git+https://github.com/seequent/pure_interface.git@cf06d397e09fb0b643264185eecc39b4a9d4e26f#egg=pure_interface
PyContracts==1.8.12
pyparsing==3.2.3
pytest==8.3.5
six==1.17.0
tomli==2.2.1
typing==3.7.4.3
|
name: pure_interface
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- decorator==5.2.1
- exceptiongroup==1.2.2
- future==1.0.0
- iniconfig==2.1.0
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pycontracts==1.8.12
- pyparsing==3.2.3
- pytest==8.3.5
- six==1.17.0
- tomli==2.2.1
- typing==3.7.4.3
prefix: /opt/conda/envs/pure_interface
|
[
"tests/test_implementation_checks.py::TestAttributeImplementations::test_raising_property",
"tests/test_implementation_checks.py::TestCrossImplementations::test_cross_implementations"
] |
[] |
[
"tests/test_implementation_checks.py::TestImplementationChecks::test_can_override_func_with_descriptor",
"tests/test_implementation_checks.py::TestImplementationChecks::test_can_use_type_methods",
"tests/test_implementation_checks.py::TestImplementationChecks::test_concrete_abc_detection",
"tests/test_implementation_checks.py::TestImplementationChecks::test_concrete_base_detection",
"tests/test_implementation_checks.py::TestImplementationChecks::test_concrete_base_detection2",
"tests/test_implementation_checks.py::TestImplementationChecks::test_decorators_not_unwrapped",
"tests/test_implementation_checks.py::TestImplementationChecks::test_instantiation_fails",
"tests/test_implementation_checks.py::TestImplementationChecks::test_interface_abc_detection",
"tests/test_implementation_checks.py::TestImplementationChecks::test_is_development_flag_stops_warnings",
"tests/test_implementation_checks.py::TestImplementationChecks::test_missing_methods_warning",
"tests/test_implementation_checks.py::TestImplementationChecks::test_partial_implementation_attribute",
"tests/test_implementation_checks.py::TestImplementationChecks::test_partial_implementation_warning",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_abstract_attribute_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_abstract_property_is_cleared",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_abstract_property_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_attribute_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_class_and_static_methods",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_getattr_property_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_missing_abstract_property_fails",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_missing_property_fails",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_missing_property_subclass_fails",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_property_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_abstract_attribute_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_abstract_property_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_attribute_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_property_override_passes",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_annotations",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_in_dir",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_in_interface",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_is_removed",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_is_required",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_must_be_none",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_passes",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_instance_attribute_passes",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_mock_spec_includes_attrs",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_property_passes"
] |
[] |
MIT License
| 3,252 |
[
"README.rst",
"pure_interface.py"
] |
[
"README.rst",
"pure_interface.py"
] |
|
pypr__automan-12
|
d3bc2dc671597d3e48919ffddaeb30cadeecd0cb
|
2018-10-16 05:34:39
|
d3bc2dc671597d3e48919ffddaeb30cadeecd0cb
|
diff --git a/automan/automation.py b/automan/automation.py
index bf7b07f..bd2f330 100644
--- a/automan/automation.py
+++ b/automan/automation.py
@@ -39,7 +39,7 @@ class Task(object):
"""Return iterable of tasks this task requires.
It is important that one either return tasks that are idempotent or
- return the same instance as this method is called repeateadly.
+ return the same instance as this method is called repeatedly.
"""
return []
@@ -67,6 +67,8 @@ class TaskRunner(object):
self.scheduler = scheduler
self.todo = []
self.task_status = dict()
+ self.task_outputs = set()
+ self.repeat_tasks = set()
for task in tasks:
self.add_task(task)
@@ -93,7 +95,22 @@ class TaskRunner(object):
return complete
def _get_tasks_with_status(self, status):
- return [t for t, s in self.task_status.items() if s == status]
+ return [
+ t for t, s in self.task_status.items()
+ if s == status and t not in self.repeat_tasks
+ ]
+
+ def _is_output_registered(self, task):
+ # Note, this has a side-effect of registering the task's output
+ # when called.
+ output = task.output()
+ output_str = str(output)
+ if output and output_str in self.task_outputs:
+ self.repeat_tasks.add(task)
+ return True
+ else:
+ self.task_outputs.add(output_str)
+ return False
def _run(self, task):
try:
@@ -130,6 +147,11 @@ class TaskRunner(object):
# #### Public protocol ##############################################
def add_task(self, task):
+ if task in self.task_status or self._is_output_registered(task):
+ # This task is already added or another task produces exactly
+ # the same output, so do nothing.
+ return
+
if not task.complete():
self.todo.append(task)
self.task_status[task] = 'not started'
@@ -165,14 +187,14 @@ class TaskRunner(object):
class CommandTask(Task):
- """Convenience class to run a command via the framework. The class provides a
- method to run the simulation and also check if the simulation is completed.
- The command should ideally produce all of its outputs inside an output
- directory that is specified.
+ """Convenience class to run a command via the framework. The class provides
+ a method to run the simulation and also check if the simulation is
+ completed. The command should ideally produce all of its outputs inside an
+ output directory that is specified.
"""
- def __init__(self, command, output_dir, job_info=None):
+ def __init__(self, command, output_dir, job_info=None, depends=None):
"""Constructor
**Parameters**
@@ -180,6 +202,7 @@ class CommandTask(Task):
command: str or list: command to run $output_dir is substituted.
output_dir: str : path of output directory.
job_info: dict: dictionary of job information.
+ depends: list: list of tasks this depends on.
"""
if isinstance(command, str):
@@ -190,6 +213,7 @@ class CommandTask(Task):
for x in self.command]
self.output_dir = output_dir
self.job_info = job_info if job_info is not None else {}
+ self.depends = depends if depends is not None else []
self.job_proxy = None
self._copy_proc = None
# This is a sentinel set to true when the job is finished
@@ -231,6 +255,14 @@ class CommandTask(Task):
if os.path.exists(self.output_dir):
shutil.rmtree(self.output_dir)
+ def output(self):
+ """Return list of output paths.
+ """
+ return [self.output_dir]
+
+ def requires(self):
+ return self.depends
+
# #### Private protocol ###########################################
@property
@@ -299,7 +331,7 @@ class PySPHTask(CommandTask):
"""
- def __init__(self, command, output_dir, job_info=None):
+ def __init__(self, command, output_dir, job_info=None, depends=None):
"""Constructor
**Parameters**
@@ -307,9 +339,10 @@ class PySPHTask(CommandTask):
command: str or list: command to run $output_dir is substituted.
output_dir: str : path of output directory.
job_info: dict: dictionary of job information.
+ depends: list: list of tasks this depends on.
"""
- super(PySPHTask, self).__init__(command, output_dir, job_info)
+ super(PySPHTask, self).__init__(command, output_dir, job_info, depends)
self.command += ['-d', output_dir]
# #### Private protocol ###########################################
@@ -351,8 +384,8 @@ class Problem(object):
results and simulations are collected inside a directory with
this name.
- `get_commands(self)`: returns a sequence of (directory_name,
- command_string, job_info) tuples. These are to be exeuted before the
- `run` method is called.
+ command_string, job_info, depends) tuples. These are to be executed
+ before the `run` method is called.
- `get_requires(self)`: returns a sequence of (name, task) tuples. These
are to be exeuted before the `run` method is called.
- `run(self)`: Processes the completed simulations to make plots etc.
@@ -379,6 +412,32 @@ class Problem(object):
self.cases = None
self.setup()
+ def _make_depends(self, depends):
+ if not depends:
+ return []
+ deps = []
+ for x in depends:
+ if isinstance(x, Task):
+ deps.append(x)
+ elif isinstance(x, Simulation):
+ if x.depends:
+ my_depends = self._make_depends(x.depends)
+ else:
+ my_depends = None
+ task = self.task_cls(
+ x.command, self.input_path(x.name), x.job_info,
+ depends=my_depends
+ )
+ deps.append(task)
+ else:
+ raise RuntimeError(
+ 'Invalid dependency: {0} for problem {1}'.format(
+ x, self
+ )
+ )
+
+ return deps
+
# #### Public protocol ###########################################
def input_path(self, *args):
@@ -413,20 +472,27 @@ class Problem(object):
return self.__class__.__name__
def get_commands(self):
- """Return a sequence of (name, command_string, job_info_dict).
+ """Return a sequence of (name, command_string, job_info_dict)
+ or (name, command_string, job_info_dict, depends).
- The name represents the command being run and is used as
- a subdirectory for generated output.
+ The name represents the command being run and is used as a subdirectory
+ for generated output.
The command_string is the command that needs to be run.
The job_info_dict is a dictionary with any additional info to be used
by the job, these are additional arguments to the
- `automan.jobss.Job` class. It may be None if nothing special need
+ `automan.jobs.Job` class. It may be None if nothing special need
be passed.
+
+ The depends is any dependencies this simulation has in terms of other
+ simulations/tasks.
+
"""
if self.cases is not None:
- return [(x.name, x.command, x.job_info) for x in self.cases]
+ return [
+ (x.name, x.command, x.job_info, x.depends) for x in self.cases
+ ]
else:
return []
@@ -440,9 +506,14 @@ class Problem(object):
"""
base = self.get_name()
result = []
- for name, cmd, job_info in self.get_commands():
+ for cmd_info in self.get_commands():
+ name, cmd, job_info = cmd_info[:3]
+ deps = cmd_info[3] if len(cmd_info) == 4 else []
sim_output_dir = self.input_path(name)
- task = self.task_cls(cmd, sim_output_dir, job_info)
+ depends = self._make_depends(deps)
+ task = self.task_cls(
+ cmd, sim_output_dir, job_info, depends=depends
+ )
task_name = '%s.%s' % (base, name)
result.append((task_name, task))
return result
@@ -457,7 +528,7 @@ class Problem(object):
"""Run any analysis code for the simulations completed. This
is usually run after the simulation commands are completed.
"""
- raise NotImplementedError()
+ pass
def clean(self):
"""Cleanup any generated output from the analysis code. This does not
@@ -549,7 +620,7 @@ class Simulation(object):
this is an extremely powerful way to automate and compare results.
"""
- def __init__(self, root, base_command, job_info=None, **kw):
+ def __init__(self, root, base_command, job_info=None, depends=None, **kw):
"""Constructor
**Parameters**
@@ -560,6 +631,8 @@ class Simulation(object):
Base command to run.
job_info: dict
Extra arguments to the `automan.jobs.Job` class.
+ depends: list
+ List of other simulations/tasks this simulation depends on.
**kw: dict
Additional parameters to pass to command.
"""
@@ -567,6 +640,7 @@ class Simulation(object):
self.name = os.path.basename(root)
self.base_command = base_command
self.job_info = job_info
+ self.depends = depends if depends is not None else []
self.params = dict(kw)
self._results = None
@@ -699,11 +773,26 @@ class SolveProblem(Task):
self.problem = problem
self.match = match
self._requires = [
- task
+ self._make_task(task)
for name, task in self.problem.get_requires()
if len(match) == 0 or fnmatch(name, match)
]
+ def _make_task(self, obj):
+ if isinstance(obj, Task):
+ return obj
+ elif isinstance(obj, Problem):
+ return SolveProblem(problem=obj, match=self.match)
+ elif isinstance(obj, type) and issubclass(obj, Problem):
+ problem = obj(self.problem.sim_dir, self.problem.out_dir)
+ return SolveProblem(problem=problem, match=self.match)
+ else:
+ raise RuntimeError(
+ 'Unknown requirement: {0}, for problem: {1}.'.format(
+ obj, self.problem
+ )
+ )
+
def __str__(self):
return 'Problem named %s' % self.problem.get_name()
@@ -846,8 +935,8 @@ class Automator(object):
self.parser.exit(1)
def _get_exclude_paths(self):
- """Returns a list of exclude paths suitable for passing on to rsync to exclude
- syncing some directories on remote machines.
+ """Returns a list of exclude paths suitable for passing on to rsync to
+ exclude syncing some directories on remote machines.
"""
paths = []
for path in [self.simulation_dir, self.output_dir]:
diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst
index 55255f3..a65d9fc 100644
--- a/docs/source/tutorial.rst
+++ b/docs/source/tutorial.rst
@@ -84,16 +84,16 @@ Let us execute this to see what it does::
Writing config.json
4 tasks pending and 0 tasks running
- Running task <automan.automation.CommandTask object at 0x10628d978>...
+ Running task CommandTask with output directory: 2 ...
Starting worker on localhost.
Job run by localhost
Running python square.py 2
- Running task <automan.automation.CommandTask object at 0x10628d9b0>...
+ Running task CommandTask with output directory: 1 ...
Job run by localhost
Running python square.py 1
2 tasks pending and 2 tasks running
- Running task <automan.automation.SolveProblem object at 0x10628d940>...
+ Running task Problem named squares...
Running task <automan.automation.RunAll object at 0x10628d908>...
Finished!
@@ -499,12 +499,12 @@ availability. For example::
$ python automate4.py
14 tasks pending and 0 tasks running
- Running task <automan.automation.CommandTask object at 0x1141da748>...
+ Running task CommandTask with output directory: 4 ...
Starting worker on localhost.
Job run by localhost
Running python powers.py --output-dir outputs/powers/4 --power=4.0
- Running task <automan.automation.CommandTask object at 0x1141da6d8>...
+ Running task CommandTask with output directory: 3 ...
Starting worker on 10.1.10.242.
Job run by 10.1.10.242
Running python powers.py --output-dir outputs/powers/3 --power=3.0
@@ -653,6 +653,76 @@ https://github.com/pypr/automan/tree/master/examples/edm_conda_cluster
The README in the directory tells you how to run the examples.
+Specifying simulation dependencies
+-----------------------------------
+
+There are times when one simulation uses the output from another and you wish
+to execute them in the right order. This can be quite easily achieved. Here is
+a simple example from the test suite that illustrates this::
+
+ class MyProblem(Problem):
+ def setup(self):
+ cmd = 'python -c "import time; print(time.time())"'
+ s1 = Simulation(self.input_path('1'), cmd)
+ s2 = Simulation(self.input_path('2'), cmd, depends=[s1])
+ s3 = Simulation(self.input_path('3'), cmd, depends=[s1, s2])
+ self.cases = [s1, s2, s3]
+
+Notice the extra keyword argument, ``depends=`` which specifies a list of
+other simulations. In the above case, we could have also used ``self.cases =
+[s3]`` and that would have automatically picked up the other simulations.
+
+When this problem is run, ``s1`` will run first followed by ``s2`` and then by
+``s3``. Note that this will only execute ``s1`` once even though it is
+declared as a dependency for two other simulations. This makes it possible to
+easily define inter-dependent tasks/simulations. In general, the dependencies
+could be any :py:class:`automan.automation.Simulation` or
+:py:class:`automan.automation.Task` instance.
+
+Internally, these simulations create suitable task instances that support
+dependencies see :py:class:`automan.automation.CommandTask`
+
+
+Specifying inter-problem dependencies
+--------------------------------------
+
+Sometimes you may have a situation where one problem depends on the output of
+another. These may be done by overriding the ``Problem.get_requires`` method.
+Here is an example from the test suite::
+
+ class A(Problem):
+ def get_requires(self):
+ cmd = 'python -c "print(1)"'
+ ct = CommandTask(cmd, output_dir=self.sim_dir)
+ return [('task1', ct)]
+
+ class B(Problem):
+ def get_requires(self):
+ # or return Problem instances ...
+ return [('a', A(self.sim_dir, self.out_dir))]
+
+ class C(Problem):
+ def get_requires(self):
+ # ... or Problem subclasses
+ return [('a', A), ('b', B)]
+
+Normally, the ``get_requires`` method automatically creates tasks from the
+simulations specified but in the above example we show a case (problem ``A``)
+where we explicitly create command tasks. In the above example, the problem
+``B`` depends on the problem ``A`` and simply returns an instance of ``A``. On
+the other hand ``C`` only returns the problem class and not an instance. This
+shows how one can specify inter problem dependencies.
+
+Note that if the problem performs some simulations (by setting
+``self.cases``), you should call the parent method (via ``super``) and add
+your additional dependencies to this.
+
+Also note that the dependencies are resolved based on the "outputs" of a task.
+So two tasks with the same outputs are treated as the same. This is consistent
+with the design of automan where each simulation's output goes in its own
+directory.
+
+
Using docker
------------
|
Add ability to specify inter-simulation dependencies
With tasks one can have complex dependencies but there isn't an easy way to spell this out when creating simulations.
|
pypr/automan
|
diff --git a/automan/tests/test_automation.py b/automan/tests/test_automation.py
index 4e07c93..f544148 100644
--- a/automan/tests/test_automation.py
+++ b/automan/tests/test_automation.py
@@ -1,7 +1,6 @@
from __future__ import print_function
import os
-import shutil
import sys
import tempfile
import unittest
@@ -12,8 +11,8 @@ except ImportError:
import mock
from automan.automation import (
- Automator, CommandTask, PySPHProblem, Simulation, SolveProblem,
- TaskRunner, compare_runs, filter_cases
+ Automator, CommandTask, Problem, PySPHProblem, RunAll, Simulation,
+ SolveProblem, TaskRunner, compare_runs, filter_cases
)
try:
from automan.jobs import Scheduler, RemoteWorker
@@ -35,8 +34,8 @@ class MySimulation(Simulation):
class EllipticalDrop(PySPHProblem):
- """We define a simple example problem which we will run using the automation
- framework.
+ """We define a simple example problem which we will run using the
+ automation framework.
In this case we run two variants of the elliptical drop problem.
@@ -102,6 +101,168 @@ class TestAutomationBase(unittest.TestCase):
safe_rmtree(self.root)
+class TestTaskRunner(TestAutomationBase):
+ def _make_scheduler(self):
+ worker = dict(host='localhost')
+ s = Scheduler(root='.', worker_config=[worker])
+ return s
+
+ def _get_time(self, path):
+ with open(os.path.join(path, 'stdout.txt')) as f:
+ t = float(f.read())
+ return t
+
+ def test_task_runner_does_not_add_repeated_tasks(self):
+ # Given
+ s = self._make_scheduler()
+ cmd = 'python -c "print(1)"'
+ ct1 = CommandTask(cmd, output_dir=self.sim_dir)
+ ct2 = CommandTask(cmd, output_dir=self.sim_dir)
+
+ # When
+ t = TaskRunner(tasks=[ct1, ct2, ct1], scheduler=s)
+
+ # Then
+ self.assertEqual(len(t.todo), 1)
+
+ def test_problem_depending_on_other_problems(self):
+ # Given
+ class A(Problem):
+ def get_requires(self):
+ cmd = 'python -c "print(1)"'
+ # Can return tasks ...
+ ct = CommandTask(cmd, output_dir=self.sim_dir)
+ return [('task1', ct)]
+
+ def run(self):
+ self.make_output_dir()
+
+ class B(Problem):
+ def get_requires(self):
+ # or return Problem instances ...
+ return [('a', A(self.sim_dir, self.out_dir))]
+
+ def run(self):
+ self.make_output_dir()
+
+ class C(Problem):
+ def get_requires(self):
+ # ... or Problem subclasses
+ return [('a', A), ('b', B)]
+
+ def run(self):
+ self.make_output_dir()
+
+ s = self._make_scheduler()
+
+ # When
+ task = RunAll(
+ simulation_dir=self.sim_dir, output_dir=self.output_dir,
+ problem_classes=[A, B, C]
+ )
+ t = TaskRunner(tasks=[task], scheduler=s)
+
+ # Then
+ self.assertEqual(len(t.todo), 5)
+ # Basically only one instance of CommandTask should be created.
+ names = [x.__class__.__name__ for x in t.todo]
+ problems = [x.problem for x in t.todo if isinstance(x, SolveProblem)]
+ self.assertEqual(names.count('RunAll'), 1)
+ self.assertEqual(names.count('CommandTask'), 1)
+ self.assertEqual(names.count('SolveProblem'), 3)
+ self.assertEqual(len(problems), 3)
+ self.assertEqual(
+ sorted(x.__class__.__name__ for x in problems),
+ ['A', 'B', 'C']
+ )
+
+ # When
+ t.run(wait=0.1)
+
+ # Then.
+ self.assertEqual(t.todo, [])
+
+ def test_problem_with_bad_requires_raises_error(self):
+ # Given
+ class D(Problem):
+ def get_requires(self):
+ return [('a', 'A')]
+
+ # When
+ self.assertRaises(
+ RuntimeError,
+ SolveProblem, D(self.sim_dir, self.output_dir)
+ )
+
+ def test_tasks_with_dependencies(self):
+ # Given
+ s = self._make_scheduler()
+ cmd = 'python -c "import time; print(time.time())"'
+ ct1_dir = os.path.join(self.sim_dir, '1')
+ ct2_dir = os.path.join(self.sim_dir, '2')
+ ct3_dir = os.path.join(self.sim_dir, '3')
+ ct1 = CommandTask(cmd, output_dir=ct1_dir)
+ ct2 = CommandTask(cmd, output_dir=ct2_dir, depends=[ct1])
+ ct3 = CommandTask(cmd, output_dir=ct3_dir, depends=[ct1, ct2])
+
+ # When
+ t = TaskRunner(tasks=[ct1, ct2, ct3], scheduler=s)
+
+ # Then
+ self.assertEqual(len(t.todo), 3)
+
+ # When
+ t.run(wait=0.1)
+
+ wait_until(lambda: not ct3.complete())
+
+ # Then.
+ # Ensure that the tasks are run in the right order.
+ ct1_t, ct2_t, ct3_t = [
+ self._get_time(x) for x in (ct1_dir, ct2_dir, ct3_dir)
+ ]
+ self.assertTrue(ct2_t > ct1_t)
+ self.assertTrue(ct3_t > ct2_t)
+
+ def test_simulation_with_dependencies(self):
+ # Given
+ class A(Problem):
+ def setup(self):
+ cmd = 'python -c "import time; print(time.time())"'
+ s1 = Simulation(self.input_path('1'), cmd)
+ s2 = Simulation(self.input_path('2'), cmd, depends=[s1])
+ s3 = Simulation(self.input_path('3'), cmd, depends=[s1, s2])
+ self.cases = [s1, s2, s3]
+
+ def run(self):
+ self.make_output_dir()
+
+ s = self._make_scheduler()
+
+ # When
+ problem = A(self.sim_dir, self.output_dir)
+ task = SolveProblem(problem)
+ t = TaskRunner(tasks=[task], scheduler=s)
+
+ # Then
+ self.assertEqual(len(t.todo), 4)
+ # Basically only one instance of CommandTask should be created.
+ names = [x.__class__.__name__ for x in t.todo]
+ self.assertEqual(names.count('CommandTask'), 3)
+ self.assertEqual(names.count('SolveProblem'), 1)
+
+ # When
+ t.run(wait=0.1)
+ wait_until(lambda: not task.complete())
+
+ # Then
+ ct1_t, ct2_t, ct3_t = [
+ self._get_time(problem.input_path(x)) for x in ('1', '2', '3')
+ ]
+ self.assertTrue(ct2_t > ct1_t)
+ self.assertTrue(ct3_t > ct2_t)
+
+
class TestLocalAutomation(TestAutomationBase):
def _make_scheduler(self):
worker = dict(host='localhost')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "psutil execnet",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
-e git+https://github.com/pypr/automan.git@d3bc2dc671597d3e48919ffddaeb30cadeecd0cb#egg=automan
certifi==2021.5.30
execnet @ file:///tmp/build/80754af9/execnet_1623921183358/work
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
psutil @ file:///tmp/build/80754af9/psutil_1612297621795/work
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: automan
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- execnet=1.9.0=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- psutil=5.8.0=py36h27cfd23_1
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/automan
|
[
"automan/tests/test_automation.py::TestTaskRunner::test_problem_depending_on_other_problems",
"automan/tests/test_automation.py::TestTaskRunner::test_problem_with_bad_requires_raises_error",
"automan/tests/test_automation.py::TestTaskRunner::test_simulation_with_dependencies",
"automan/tests/test_automation.py::TestTaskRunner::test_task_runner_does_not_add_repeated_tasks",
"automan/tests/test_automation.py::TestTaskRunner::test_tasks_with_dependencies"
] |
[] |
[
"automan/tests/test_automation.py::TestLocalAutomation::test_automation",
"automan/tests/test_automation.py::TestLocalAutomation::test_nothing_is_run_when_output_exists",
"automan/tests/test_automation.py::TestRemoteAutomation::test_automation",
"automan/tests/test_automation.py::TestRemoteAutomation::test_job_with_error_is_handled_correctly",
"automan/tests/test_automation.py::TestRemoteAutomation::test_nothing_is_run_when_output_exists",
"automan/tests/test_automation.py::TestCommandTask::test_command_tasks_converts_dollar_output_dir",
"automan/tests/test_automation.py::TestCommandTask::test_command_tasks_executes_simple_command",
"automan/tests/test_automation.py::TestCommandTask::test_command_tasks_handles_errors_correctly",
"automan/tests/test_automation.py::test_simulation_get_labels",
"automan/tests/test_automation.py::test_compare_runs_calls_methods_when_given_names",
"automan/tests/test_automation.py::test_compare_runs_works_when_given_callables",
"automan/tests/test_automation.py::test_filter_cases_works_with_params",
"automan/tests/test_automation.py::test_filter_cases_works_with_predicate",
"automan/tests/test_automation.py::TestAutomator::test_automator",
"automan/tests/test_automation.py::TestAutomator::test_automator_accepts_cluster_manager"
] |
[] |
BSD-3-Clause
| 3,253 |
[
"docs/source/tutorial.rst",
"automan/automation.py"
] |
[
"docs/source/tutorial.rst",
"automan/automation.py"
] |
|
encode__uvicorn-227
|
21494a0e7b4a063793ec1165c9e94b2c09ead2aa
|
2018-10-16 13:43:28
|
ba8afcef13b2a94308df3c6cf0a78a5445195384
|
tomchristie: This way around we'll get an error immediately if lifespan instantiation is not supported. That will gracefully disable it, and should resolve #222.
|
diff --git a/uvicorn/middleware/message_logger.py b/uvicorn/middleware/message_logger.py
index 3ddc9c9..a33736d 100644
--- a/uvicorn/middleware/message_logger.py
+++ b/uvicorn/middleware/message_logger.py
@@ -36,20 +36,27 @@ class MessageLoggerMiddleware:
class MessageLoggerResponder:
def __init__(self, scope, app, logger, task_counter):
self.scope = scope
- self.app = app
self.logger = logger
self.task_counter = task_counter
self.client_addr = scope.get('client')
+ logged_scope = message_with_placeholders(scope)
+ log_text = '%s - ASGI [%d] Initialized %s'
+ self.logger.debug(log_text, self.client_addr, self.task_counter, logged_scope)
+ try:
+ self.inner = app(scope)
+ except:
+ log_text = '%s - ASGI [%d] Raised exception'
+ self.logger.debug(log_text, self.client_addr, self.task_counter)
+ raise
+
async def __call__(self, receive, send):
self._receive = receive
self._send = send
- logged_scope = message_with_placeholders(self.scope)
- log_text = '%s - ASGI [%d] Started %s'
- self.logger.debug(log_text, self.client_addr, self.task_counter, logged_scope)
+ log_text = '%s - ASGI [%d] Started task'
+ self.logger.debug(log_text, self.client_addr, self.task_counter)
try:
- inner = self.app(self.scope)
- await inner(self.receive, self.send)
+ await self.inner(self.receive, self.send)
except:
log_text = '%s - ASGI [%d] Raised exception'
self.logger.debug(log_text, self.client_addr, self.task_counter)
|
Error integrating with Channels if 'lifespan' is not specified in router
I'm not entirely sure if I should be posting this here or on `channels`.
I'm using v0.3.12 which I believe has already introduced the new `lifespan` protocol defined in asgiref. But this causes an error with `channels`' router
```bash
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/uvicorn/lifespan.py", line 29, in run
await self.asgi(self.receive, self.send)
File "/usr/local/lib/python3.6/site-packages/uvicorn/middleware/message_logger.py", line 51, in __call__
inner = self.app(self.scope)
File "/usr/local/lib/python3.6/site-packages/channels/routing.py", line 58, in __call__
raise ValueError("No application configured for scope type %r" % scope["type"])
ValueError: No application configured for scope type 'lifespan'
```
My `routing.py` file looks like this:
```python
application = ProtocolTypeRouter({
# Empty for now (http->django views is added by default)
'websocket': JWTWebsocketMiddleware(
URLRouter(urlpatterns)
)
})
```
**EDIT**: Sorry my workaround wasn't actually working as you'll need at least one `path` in the `URLRouter`, so I've removed it.
To temporarily get around this, I had to downgrade to `v0.3.9`.
|
encode/uvicorn
|
diff --git a/tests/middleware/test_message_logger.py b/tests/middleware/test_message_logger.py
index 2541dc0..1d07ed6 100644
--- a/tests/middleware/test_message_logger.py
+++ b/tests/middleware/test_message_logger.py
@@ -19,7 +19,8 @@ def test_message_logger(caplog):
response = client.get("/")
assert response.status_code == 200
messages = [record.msg % record.args for record in caplog.records]
- assert sum(['ASGI [1] Started' in message for message in messages]) == 1
+ assert sum(['ASGI [1] Initialized' in message for message in messages]) == 1
+ assert sum(['ASGI [1] Started task' in message for message in messages]) == 1
assert sum(['ASGI [1] Sent' in message for message in messages]) == 1
assert sum(['ASGI [1] Received' in message for message in messages]) == 2
assert sum(['ASGI [1] Completed' in message for message in messages]) == 1
@@ -39,7 +40,26 @@ def test_message_logger_exc(caplog):
with pytest.raises(RuntimeError):
client.get("/")
messages = [record.msg % record.args for record in caplog.records]
- assert sum(['ASGI [1] Started' in message for message in messages]) == 1
+ assert sum(['ASGI [1] Initialized' in message for message in messages]) == 1
+ assert sum(['ASGI [1] Started task' in message for message in messages]) == 1
+ assert sum(['ASGI [1] Sent' in message for message in messages]) == 0
+ assert sum(['ASGI [1] Received' in message for message in messages]) == 0
+ assert sum(['ASGI [1] Completed' in message for message in messages]) == 0
+ assert sum(['ASGI [1] Raised exception' in message for message in messages]) == 1
+
+
+def test_message_logger_scope_exc(caplog):
+ def app(scope):
+ raise RuntimeError()
+
+ caplog.set_level(logging.DEBUG)
+ app = MessageLoggerMiddleware(app)
+ client = TestClient(app)
+ with pytest.raises(RuntimeError):
+ client.get("/")
+ messages = [record.msg % record.args for record in caplog.records]
+ assert sum(['ASGI [1] Initialized' in message for message in messages]) == 1
+ assert sum(['ASGI [1] Started task' in message for message in messages]) == 0
assert sum(['ASGI [1] Sent' in message for message in messages]) == 0
assert sum(['ASGI [1] Received' in message for message in messages]) == 0
assert sum(['ASGI [1] Completed' in message for message in messages]) == 0
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"requests",
"codecov"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
click==8.0.4
codecov==2.1.13
coverage==6.2
dataclasses==0.8
h11==0.13.0
httptools==0.6.0
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
requests==2.27.1
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
-e git+https://github.com/encode/uvicorn.git@21494a0e7b4a063793ec1165c9e94b2c09ead2aa#egg=uvicorn
uvloop==0.14.0
websockets==9.1
wsproto==1.0.0
zipp==3.6.0
|
name: uvicorn
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- click==8.0.4
- codecov==2.1.13
- coverage==6.2
- dataclasses==0.8
- h11==0.13.0
- httptools==0.6.0
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- requests==2.27.1
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- uvloop==0.14.0
- websockets==9.1
- wsproto==1.0.0
- zipp==3.6.0
prefix: /opt/conda/envs/uvicorn
|
[
"tests/middleware/test_message_logger.py::test_message_logger",
"tests/middleware/test_message_logger.py::test_message_logger_exc",
"tests/middleware/test_message_logger.py::test_message_logger_scope_exc"
] |
[] |
[] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,254 |
[
"uvicorn/middleware/message_logger.py"
] |
[
"uvicorn/middleware/message_logger.py"
] |
zopefoundation__zope.traversing-11
|
cfaa1fa9f3bed5758b3d8c5a01959bd0ab6295ff
|
2018-10-16 14:36:46
|
cfaa1fa9f3bed5758b3d8c5a01959bd0ab6295ff
|
diff --git a/.gitignore b/.gitignore
index 7fe07b7..bc6e42c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,5 +11,6 @@ develop-eggs/
eggs/
parts/
.coverage
+.coverage.*
htmlcov/
docs/_build/
diff --git a/CHANGES.rst b/CHANGES.rst
index 79076a8..c99bcb4 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -2,10 +2,12 @@
Changes
=========
-4.4 (unreleased)
-================
+4.3.1 (unreleased)
+==================
-- Nothing changed yet.
+- Fix DeprecationWarnings for ``ComponentLookupError`` by
+ importing them from ``zope.interface.interfaces``. See `issue 10
+ <https://github.com/zopefoundation/zope.traversing/issues/10>`_.
4.3 (2018-10-05)
diff --git a/setup.py b/setup.py
index 66d0f5c..3d9f59b 100644
--- a/setup.py
+++ b/setup.py
@@ -44,7 +44,7 @@ TESTS_REQUIRE = [
setup(
name='zope.traversing',
- version='4.4.dev0',
+ version='4.3.1.dev0',
url='https://github.com/zopefoundation/zope.traversing',
license='ZPL 2.1',
author='Zope Foundation and Contributors',
diff --git a/src/zope/traversing/namespace.py b/src/zope/traversing/namespace.py
index 8cb2527..fdea21a 100644
--- a/src/zope/traversing/namespace.py
+++ b/src/zope/traversing/namespace.py
@@ -67,7 +67,7 @@ import six
import zope.component
import zope.interface
from zope.i18n.interfaces import IModifiableUserPreferredLanguages
-from zope.component.interfaces import ComponentLookupError
+from zope.interface.interfaces import ComponentLookupError
from zope.interface import providedBy, directlyProvides
from zope.location.interfaces import LocationError
from zope.publisher.interfaces.browser import IBrowserSkinType
|
DeprecationWarning: ComponentLookupError is deprecated
```
zope/traversing/namespace.py:70: DeprecationWarning: ComponentLookupError is deprecated. Import from zope.interface.interfaces
from zope.component.interfaces import ComponentLookupError
```
|
zopefoundation/zope.traversing
|
diff --git a/src/zope/traversing/browser/tests.py b/src/zope/traversing/browser/tests.py
index 861cb9c..51c58dd 100644
--- a/src/zope/traversing/browser/tests.py
+++ b/src/zope/traversing/browser/tests.py
@@ -73,6 +73,9 @@ class FooLocation(object):
class TestAbsoluteURL(PlacelessSetup, unittest.TestCase):
+ assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegex',
+ getattr(unittest.TestCase, 'assertRaisesRegexp'))
+
def setUp(self):
PlacelessSetup.setUp(self)
from zope.traversing.browser import AbsoluteURL, SiteAbsoluteURL
@@ -306,8 +309,8 @@ class TestAbsoluteURL(PlacelessSetup, unittest.TestCase):
def test_breadcrumbs_no_parent(self):
view = AbsoluteURL(self, None)
- with self.assertRaisesRegexp(TypeError,
- "There isn't enough context"):
+ with self.assertRaisesRegex(TypeError,
+ "There isn't enough context"):
view.breadcrumbs()
def test_nameless_context(self):
@@ -343,8 +346,8 @@ class TestAbsoluteURL(PlacelessSetup, unittest.TestCase):
# First the view
view = AbsoluteURL(context, request)
- with self.assertRaisesRegexp(TypeError,
- "There isn't enough context"):
+ with self.assertRaisesRegex(TypeError,
+ "There isn't enough context"):
str(view)
self.assertTrue(DummyAbsoluteURL.called)
@@ -352,8 +355,8 @@ class TestAbsoluteURL(PlacelessSetup, unittest.TestCase):
# Now the breadcrumbs
view = AbsoluteURL(context, request)
- with self.assertRaisesRegexp(TypeError,
- "There isn't enough context"):
+ with self.assertRaisesRegex(TypeError,
+ "There isn't enough context"):
view.breadcrumbs()
self.assertTrue(DummyAbsoluteURL.called)
diff --git a/src/zope/traversing/tests/test_conveniencefunctions.py b/src/zope/traversing/tests/test_conveniencefunctions.py
index be50c6a..c0b9b6d 100644
--- a/src/zope/traversing/tests/test_conveniencefunctions.py
+++ b/src/zope/traversing/tests/test_conveniencefunctions.py
@@ -384,6 +384,9 @@ class TestStandalone(unittest.TestCase):
# Unlike TestFunctional, we don't register gobs of
# adapters, making these tests more self-contained
+ assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegex',
+ getattr(unittest.TestCase, 'assertRaisesRegexp'))
+
def test_getParent_no_location_info(self):
from zope.traversing.api import getParent
test = self
@@ -395,8 +398,8 @@ class TestStandalone(unittest.TestCase):
raise TypeError()
context = Context()
- with self.assertRaisesRegexp(TypeError,
- "Not enough context"):
+ with self.assertRaisesRegex(TypeError,
+ "Not enough context"):
getParent(context)
self.assertTrue(context.called)
diff --git a/src/zope/traversing/tests/test_namespacetrversal.py b/src/zope/traversing/tests/test_namespacetrversal.py
index cfd2e31..5f91195 100644
--- a/src/zope/traversing/tests/test_namespacetrversal.py
+++ b/src/zope/traversing/tests/test_namespacetrversal.py
@@ -123,9 +123,12 @@ class TestView(unittest.TestCase):
class TestVh(unittest.TestCase):
+ assertRaisesRegex = getattr(unittest.TestCase, 'assertRaisesRegex',
+ getattr(unittest.TestCase, 'assertRaisesRegexp'))
+
def test_invalid_vh(self):
- with self.assertRaisesRegexp(ValueError,
- 'Vhost directive should have the form'):
+ with self.assertRaisesRegex(ValueError,
+ 'Vhost directive should have the form'):
namespace.vh(None, None).traverse(u'invalid name', ())
def test_suite():
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 4
}
|
4.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"zope.testrunner",
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
multipart==1.2.1
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
python-gettext==5.0
pytz==2025.2
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
transaction==5.0
zope.annotation==5.1
zope.browser==3.1
zope.browserresource==5.2
zope.component==6.0
zope.configuration==6.0
zope.contenttype==5.2
zope.deprecation==5.1
zope.event==5.0
zope.exceptions==5.2
zope.hookable==7.0
zope.i18n==5.2
zope.i18nmessageid==7.0
zope.interface==7.2
zope.location==5.1
zope.proxy==6.1
zope.publisher==7.3
zope.schema==7.0.1
zope.security==7.3
zope.tales==6.1
zope.testing==5.1
zope.testrunner==7.2
-e git+https://github.com/zopefoundation/zope.traversing.git@cfaa1fa9f3bed5758b3d8c5a01959bd0ab6295ff#egg=zope.traversing
|
name: zope.traversing
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- multipart==1.2.1
- python-gettext==5.0
- pytz==2025.2
- six==1.17.0
- transaction==5.0
- zope-annotation==5.1
- zope-browser==3.1
- zope-browserresource==5.2
- zope-component==6.0
- zope-configuration==6.0
- zope-contenttype==5.2
- zope-deprecation==5.1
- zope-event==5.0
- zope-exceptions==5.2
- zope-hookable==7.0
- zope-i18n==5.2
- zope-i18nmessageid==7.0
- zope-interface==7.2
- zope-location==5.1
- zope-proxy==6.1
- zope-publisher==7.3
- zope-schema==7.0.1
- zope-security==7.3
- zope-tales==6.1
- zope-testing==5.1
- zope-testrunner==7.2
prefix: /opt/conda/envs/zope.traversing
|
[
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testAdaptedContext",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testBadObject",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testBasicContext",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testBasicContext_unicode",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testNoContext",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testNoContextInformation",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testParentButNoLocation",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testParentTrumpsAdapter",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testRetainSkin",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testVirtualHosting",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testVirtualHostingInFront",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testVirtualHostingWithVHElements",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::testVirtualHostingWithoutContextInformation",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::test_breadcrumbs_no_parent",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::test_interface",
"src/zope/traversing/browser/tests.py::TestAbsoluteURL::test_nameless_context",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testCanonicalPath",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetName",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetNameOfRoot",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetParent",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetParentBrokenChain",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetParentFromRoot",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetParentFromUnwrapped",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetParents",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetParentsBrokenChain",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetPath",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetPathOfRoot",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testGetRoot",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testTraverse",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testTraverseFromUnwrapped",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testTraverseName",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::testTraverseNameBadValue",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::test_joinPath",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::test_joinPath_empty_args",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::test_joinPath_normalize",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::test_joinPath_slashes",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::test_normalizePath",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestFunctional::test_traverse_with_default",
"src/zope/traversing/tests/test_conveniencefunctions.py::TestStandalone::test_getParent_no_location_info",
"src/zope/traversing/tests/test_namespacetrversal.py::TestSimpleHandler::test_constructor",
"src/zope/traversing/tests/test_namespacetrversal.py::TestFunctions::test_getResource_not_found",
"src/zope/traversing/tests/test_namespacetrversal.py::TestAcquire::test_excessive_depth_on_path_extension",
"src/zope/traversing/tests/test_namespacetrversal.py::TestEtc::test_traverse_non_site_name",
"src/zope/traversing/tests/test_namespacetrversal.py::TestEtc::test_traverse_site_lookup_error",
"src/zope/traversing/tests/test_namespacetrversal.py::TestEtc::test_traverse_site_no_manager",
"src/zope/traversing/tests/test_namespacetrversal.py::TestEtc::test_traverse_utility",
"src/zope/traversing/tests/test_namespacetrversal.py::TestView::test_not_found",
"src/zope/traversing/tests/test_namespacetrversal.py::TestVh::test_invalid_vh",
"src/zope/traversing/tests/test_namespacetrversal.py::test_suite"
] |
[] |
[] |
[] |
Zope Public License 2.1
| 3,255 |
[
"setup.py",
".gitignore",
"CHANGES.rst",
"src/zope/traversing/namespace.py"
] |
[
"setup.py",
".gitignore",
"CHANGES.rst",
"src/zope/traversing/namespace.py"
] |
|
modm-io__lbuild-11
|
b27975301922834e0173369873cd705673391708
|
2018-10-16 16:01:10
|
b27975301922834e0173369873cd705673391708
|
diff --git a/lbuild/main.py b/lbuild/main.py
index 7593491..95016c1 100644
--- a/lbuild/main.py
+++ b/lbuild/main.py
@@ -24,7 +24,7 @@ from lbuild.format import format_option_short_description
from lbuild.api import Builder
-__version__ = '1.4.3'
+__version__ = '1.4.4'
class InitAction:
diff --git a/lbuild/node.py b/lbuild/node.py
index ae95df9..030ca97 100644
--- a/lbuild/node.py
+++ b/lbuild/node.py
@@ -308,7 +308,7 @@ class BaseNode(anytree.Node):
except LbuildException as b:
if not ignore_failure:
raise LbuildException("Cannot resolve dependencies!\n" + str(b))
- print("ignoring", dependency_name)
+ LOGGER.debug("ignoring", dependency_name)
self._dependencies = list(dependencies)
self._dependencies_resolved = not ignore_failure
for child in self.children:
diff --git a/lbuild/parser.py b/lbuild/parser.py
index 7c9fb19..dbc69d0 100644
--- a/lbuild/parser.py
+++ b/lbuild/parser.py
@@ -220,7 +220,10 @@ class Parser(BaseNode):
def find_any(self, queries, types=None):
nodes = set()
for query in utils.listify(queries):
- nodes |= set(self._resolve_partial(query, set()))
+ result = self._resolve_partial(query, None)
+ if result is None:
+ raise LbuildException("Cannot resolve '{}'".format(query))
+ nodes |= set(result)
if types:
types = utils.listify(types)
nodes = [n for n in nodes if any(n.type == t for t in types)]
|
No warning/error on non-existing modules
You can add arbitrary module lines like `<module>This does not exist and is bullshit</module>` and there will be no error or warning. This is very unpleasant if modules names in modm changed and you will get no feedback from lbuild that a requested module was not found.
Accidentally reported against wrong project dergraaf/library-builder#31
|
modm-io/lbuild
|
diff --git a/test/parser_test.py b/test/parser_test.py
index 4479f3b..20834a0 100644
--- a/test/parser_test.py
+++ b/test/parser_test.py
@@ -138,6 +138,16 @@ class ParserTest(unittest.TestCase):
self.assertIn("repo1:other", self.parser.modules)
self.assertIn("repo1:module1", self.parser.modules)
+ def test_raise_unknown_module(self):
+ self.parser.parse_repository(self._get_path("combined/repo1.lb"))
+ self.parser._config_flat = lbuild.config.ConfigNode.from_file(self._get_path("combined/test1.xml"))
+
+ self.parser.merge_repository_options()
+ modules = self.parser.prepare_repositories()
+ self.parser.config.modules.append(":unknown")
+ self.assertRaises(lbuild.exception.LbuildException,
+ lambda: self.parser.find_modules(self.parser.config.modules))
+
def _get_build_modules(self):
self.parser.parse_repository(self._get_path("combined/repo1.lb"))
self.parser.parse_repository(self._get_path("combined/repo2/repo2.lb"))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 3
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
anytree==2.12.1
colorful==0.5.6
coverage==7.8.0
exceptiongroup==1.2.2
gitdb==4.0.12
GitPython==3.1.44
iniconfig==2.1.0
Jinja2==3.1.6
-e git+https://github.com/modm-io/lbuild.git@b27975301922834e0173369873cd705673391708#egg=lbuild
lxml==5.3.1
MarkupSafe==3.0.2
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
six==1.17.0
smmap==5.0.2
testfixtures==8.3.0
tomli==2.2.1
|
name: lbuild
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- anytree==2.12.1
- colorful==0.5.6
- coverage==7.8.0
- exceptiongroup==1.2.2
- gitdb==4.0.12
- gitpython==3.1.44
- iniconfig==2.1.0
- jinja2==3.1.6
- lxml==5.3.1
- markupsafe==3.0.2
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- six==1.17.0
- smmap==5.0.2
- testfixtures==8.3.0
- tomli==2.2.1
prefix: /opt/conda/envs/lbuild
|
[
"test/parser_test.py::ParserTest::test_raise_unknown_module"
] |
[] |
[
"test/parser_test.py::ParserTest::test_repository_should_contain_options",
"test/parser_test.py::ParserTest::test_should_build_archive_modules",
"test/parser_test.py::ParserTest::test_should_build_jinja_2_modules",
"test/parser_test.py::ParserTest::test_should_build_modules",
"test/parser_test.py::ParserTest::test_should_find_files_in_repository_1",
"test/parser_test.py::ParserTest::test_should_find_files_in_repository_2",
"test/parser_test.py::ParserTest::test_should_merge_build_module_options",
"test/parser_test.py::ParserTest::test_should_merge_options",
"test/parser_test.py::ParserTest::test_should_parse_modules",
"test/parser_test.py::ParserTest::test_should_parse_modules_from_multiple_repositories",
"test/parser_test.py::ParserTest::test_should_parse_optional_functions_in_module",
"test/parser_test.py::ParserTest::test_should_parse_repository_1",
"test/parser_test.py::ParserTest::test_should_raise_when_no_module_is_found",
"test/parser_test.py::ParserTest::test_should_raise_when_overwriting_file",
"test/parser_test.py::ParserTest::test_should_raise_when_overwriting_file_in_tree",
"test/parser_test.py::ParserTest::test_should_resolve_module_dependencies",
"test/parser_test.py::ParserTest::test_should_select_available_modules"
] |
[] |
BSD 2-Clause "Simplified" License
| 3,256 |
[
"lbuild/main.py",
"lbuild/node.py",
"lbuild/parser.py"
] |
[
"lbuild/main.py",
"lbuild/node.py",
"lbuild/parser.py"
] |
|
pydata__sparse-200
|
76b98bc009c1fafa137f1dcf7d889a56b2f3a47b
|
2018-10-16 20:44:59
|
e46a2a734dce1b25a775641f744cbcbea1a15910
|
codecov[bot]: # [Codecov](https://codecov.io/gh/pydata/sparse/pull/200?src=pr&el=h1) Report
> Merging [#200](https://codecov.io/gh/pydata/sparse/pull/200?src=pr&el=desc) into [master](https://codecov.io/gh/pydata/sparse/commit/76b98bc009c1fafa137f1dcf7d889a56b2f3a47b?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.
[](https://codecov.io/gh/pydata/sparse/pull/200?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #200 +/- ##
=======================================
Coverage 97.65% 97.65%
=======================================
Files 11 11
Lines 1447 1447
=======================================
Hits 1413 1413
Misses 34 34
```
| [Impacted Files](https://codecov.io/gh/pydata/sparse/pull/200?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [sparse/coo/core.py](https://codecov.io/gh/pydata/sparse/pull/200/diff?src=pr&el=tree#diff-c3BhcnNlL2Nvby9jb3JlLnB5) | `97.14% <100%> (ø)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/pydata/sparse/pull/200?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pydata/sparse/pull/200?src=pr&el=footer). Last update [76b98bc...25d04c8](https://codecov.io/gh/pydata/sparse/pull/200?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
|
diff --git a/sparse/coo/core.py b/sparse/coo/core.py
index 44943fc..de0524a 100644
--- a/sparse/coo/core.py
+++ b/sparse/coo/core.py
@@ -315,7 +315,7 @@ class COO(SparseArray, NDArrayOperatorsMixin):
>>> COO.from_numpy(x, fill_value=np.nan)
<COO: shape=(5, 5), dtype=float64, nnz=5, fill_value=nan>
"""
- x = np.asanyarray(x)
+ x = np.asanyarray(x).view(type=np.ndarray)
if fill_value is None:
fill_value = _zero_of_dtype(x.dtype)
|
sparse.as_coo does not work for N-by-1 np.matrix
When input a N-by-1 matrix of type np.matrix, sparse.as_coo throws an error. It correctly dispatchs to sparse.COO.from_numpy but can not handle it. Please see the following
```python
In [1]: import scipy.sparse,sparse
In [2]: sp = scipy.sparse.random(10,1,0.5)
In [3]: mat = sp.argmax(1)
In [4]: sparse.as_coo(mat)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-5492fc8fff45> in <module>()
----> 1 sparse.as_coo(mat)
C:\Users\Liyu\Anaconda3\lib\site-packages\sparse\coo\core.py in as_coo(x, shape, fill_value)
1749
1750 if isinstance(x, np.ndarray):
-> 1751 return COO.from_numpy(x, fill_value=fill_value)
1752
1753 if isinstance(x, scipy.sparse.spmatrix):
C:\Users\Liyu\Anaconda3\lib\site-packages\sparse\coo\core.py in from_numpy(cls, x, fill_value)
308 data = np.array(x, ndmin=1)
309 return cls(coords, data, shape=x.shape, has_duplicates=False,
--> 310 sorted=True, fill_value=fill_value)
311
312 def todense(self):
C:\Users\Liyu\Anaconda3\lib\site-packages\sparse\coo\core.py in __init__(self, coords, data, shape, has_duplicates, sorted, cache, fill_value)
223 msg = ('The data length does not match the coordinates '
224 'given.\nlen(data) = {}, but {} coords specified.')
--> 225 raise ValueError(msg.format(len(data), self.coords.shape[1]))
226 if len(self.shape) != self.coords.shape[0]:
227 msg = ("Shape specified by `shape` doesn't match the "
ValueError: The data length does not match the coordinates given.
len(data) = 1, but 0 coords specified.
```
|
pydata/sparse
|
diff --git a/sparse/tests/test_coo.py b/sparse/tests/test_coo.py
index 03e0268..e629989 100644
--- a/sparse/tests/test_coo.py
+++ b/sparse/tests/test_coo.py
@@ -1971,3 +1971,10 @@ def test_complex_methods(complex):
assert_eq(s.imag, x.imag)
assert_eq(s.real, x.real)
assert_eq(s.conj(), x.conj())
+
+
+def test_np_matrix():
+ x = np.random.rand(10, 1).view(type=np.matrix)
+ s = sparse.COO.from_numpy(x)
+
+ assert_eq(x, s)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
0.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[all]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-flake8",
"pytest-cov"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
asv==0.5.1
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
distlib==0.3.9
docutils==0.17.1
filelock==3.4.1
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
Jinja2==3.0.3
llvmlite==0.36.0
MarkupSafe==2.0.1
mccabe==0.7.0
numba==0.53.1
numpy==1.19.5
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-flake8==1.1.1
pytz==2025.2
requests==2.27.1
scipy==1.5.4
six==1.17.0
snowballstemmer==2.2.0
-e git+https://github.com/pydata/sparse.git@76b98bc009c1fafa137f1dcf7d889a56b2f3a47b#egg=sparse
Sphinx==4.3.2
sphinx-rtd-theme==1.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
zipp==3.6.0
|
name: sparse
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- asv==0.5.1
- attrs==22.2.0
- babel==2.11.0
- charset-normalizer==2.0.12
- coverage==6.2
- distlib==0.3.9
- docutils==0.17.1
- filelock==3.4.1
- flake8==5.0.4
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.2.0
- importlib-resources==5.4.0
- iniconfig==1.1.1
- jinja2==3.0.3
- llvmlite==0.36.0
- markupsafe==2.0.1
- mccabe==0.7.0
- numba==0.53.1
- numpy==1.19.5
- packaging==21.3
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pyflakes==2.5.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-flake8==1.1.1
- pytz==2025.2
- requests==2.27.1
- scipy==1.5.4
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==4.3.2
- sphinx-rtd-theme==1.3.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- toml==0.10.2
- tomli==1.2.3
- tox==3.28.0
- typing-extensions==4.1.1
- urllib3==1.26.20
- virtualenv==20.16.2
- zipp==3.6.0
prefix: /opt/conda/envs/sparse
|
[
"sparse/tests/test_coo.py::test_np_matrix"
] |
[
"sparse/tests/test_coo.py::flake-8::FLAKE8"
] |
[
"sparse/tests/test_coo.py::test_reductions[f8-True-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[prod-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[reduce-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[reduce-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[reduce-kwargs5]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nanmin]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[None-nanmax]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[None-nanmin]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[None-nanmean]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[0-nanmax]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[0-nanmin]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[0-nanmean]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[1-nanmax]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[1-nanmin]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[1-nanmean]",
"sparse/tests/test_coo.py::test_transpose[None]",
"sparse/tests/test_coo.py::test_transpose[axis1]",
"sparse/tests/test_coo.py::test_transpose[axis2]",
"sparse/tests/test_coo.py::test_transpose[axis3]",
"sparse/tests/test_coo.py::test_transpose[axis4]",
"sparse/tests/test_coo.py::test_transpose[axis5]",
"sparse/tests/test_coo.py::test_transpose[axis6]",
"sparse/tests/test_coo.py::test_transpose_error[axis0]",
"sparse/tests/test_coo.py::test_transpose_error[axis1]",
"sparse/tests/test_coo.py::test_transpose_error[axis2]",
"sparse/tests/test_coo.py::test_transpose_error[axis3]",
"sparse/tests/test_coo.py::test_transpose_error[axis4]",
"sparse/tests/test_coo.py::test_transpose_error[axis5]",
"sparse/tests/test_coo.py::test_transpose_error[0.3]",
"sparse/tests/test_coo.py::test_transpose_error[axis7]",
"sparse/tests/test_coo.py::test_reshape[a0-b0]",
"sparse/tests/test_coo.py::test_reshape[a1-b1]",
"sparse/tests/test_coo.py::test_reshape[a2-b2]",
"sparse/tests/test_coo.py::test_reshape[a3-b3]",
"sparse/tests/test_coo.py::test_reshape[a4-b4]",
"sparse/tests/test_coo.py::test_reshape[a5-b5]",
"sparse/tests/test_coo.py::test_reshape[a6-b6]",
"sparse/tests/test_coo.py::test_reshape[a7-b7]",
"sparse/tests/test_coo.py::test_reshape[a8-b8]",
"sparse/tests/test_coo.py::test_reshape[a9-b9]",
"sparse/tests/test_coo.py::test_large_reshape",
"sparse/tests/test_coo.py::test_reshape_same",
"sparse/tests/test_coo.py::test_reshape_function",
"sparse/tests/test_coo.py::test_to_scipy_sparse",
"sparse/tests/test_coo.py::test_tensordot[a_shape0-b_shape0-axes0]",
"sparse/tests/test_coo.py::test_tensordot[a_shape1-b_shape1-axes1]",
"sparse/tests/test_coo.py::test_tensordot[a_shape2-b_shape2-axes2]",
"sparse/tests/test_coo.py::test_tensordot[a_shape3-b_shape3-axes3]",
"sparse/tests/test_coo.py::test_tensordot[a_shape4-b_shape4-axes4]",
"sparse/tests/test_coo.py::test_tensordot[a_shape5-b_shape5-axes5]",
"sparse/tests/test_coo.py::test_tensordot[a_shape6-b_shape6-axes6]",
"sparse/tests/test_coo.py::test_tensordot[a_shape7-b_shape7-axes7]",
"sparse/tests/test_coo.py::test_tensordot[a_shape8-b_shape8-axes8]",
"sparse/tests/test_coo.py::test_tensordot[a_shape9-b_shape9-0]",
"sparse/tests/test_coo.py::test_dot[a_shape0-b_shape0]",
"sparse/tests/test_coo.py::test_dot[a_shape1-b_shape1]",
"sparse/tests/test_coo.py::test_dot[a_shape2-b_shape2]",
"sparse/tests/test_coo.py::test_dot[a_shape3-b_shape3]",
"sparse/tests/test_coo.py::test_dot[a_shape4-b_shape4]",
"sparse/tests/test_coo.py::test_kron[1-1]",
"sparse/tests/test_coo.py::test_kron[1-2]",
"sparse/tests/test_coo.py::test_kron[1-3]",
"sparse/tests/test_coo.py::test_kron[2-1]",
"sparse/tests/test_coo.py::test_kron[2-2]",
"sparse/tests/test_coo.py::test_kron[2-3]",
"sparse/tests/test_coo.py::test_kron[3-1]",
"sparse/tests/test_coo.py::test_kron[3-2]",
"sparse/tests/test_coo.py::test_kron[3-3]",
"sparse/tests/test_coo.py::test_kron_spmatrix[True-True]",
"sparse/tests/test_coo.py::test_kron_spmatrix[True-False]",
"sparse/tests/test_coo.py::test_kron_spmatrix[False-True]",
"sparse/tests/test_coo.py::test_kron_scalar[1]",
"sparse/tests/test_coo.py::test_kron_scalar[2]",
"sparse/tests/test_coo.py::test_kron_scalar[3]",
"sparse/tests/test_coo.py::test_elemwise[expm1]",
"sparse/tests/test_coo.py::test_elemwise[log1p]",
"sparse/tests/test_coo.py::test_elemwise[sin]",
"sparse/tests/test_coo.py::test_elemwise[tan]",
"sparse/tests/test_coo.py::test_elemwise[sinh]",
"sparse/tests/test_coo.py::test_elemwise[tanh]",
"sparse/tests/test_coo.py::test_elemwise[floor]",
"sparse/tests/test_coo.py::test_elemwise[ceil]",
"sparse/tests/test_coo.py::test_elemwise[sqrt]",
"sparse/tests/test_coo.py::test_elemwise[conjugate0]",
"sparse/tests/test_coo.py::test_elemwise[round_]",
"sparse/tests/test_coo.py::test_elemwise[rint]",
"sparse/tests/test_coo.py::test_elemwise[<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise[conjugate1]",
"sparse/tests/test_coo.py::test_elemwise[conjugate2]",
"sparse/tests/test_coo.py::test_elemwise[<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise[abs]",
"sparse/tests/test_coo.py::test_elemwise_inplace[expm1]",
"sparse/tests/test_coo.py::test_elemwise_inplace[log1p]",
"sparse/tests/test_coo.py::test_elemwise_inplace[sin]",
"sparse/tests/test_coo.py::test_elemwise_inplace[tan]",
"sparse/tests/test_coo.py::test_elemwise_inplace[sinh]",
"sparse/tests/test_coo.py::test_elemwise_inplace[tanh]",
"sparse/tests/test_coo.py::test_elemwise_inplace[floor]",
"sparse/tests/test_coo.py::test_elemwise_inplace[ceil]",
"sparse/tests/test_coo.py::test_elemwise_inplace[sqrt]",
"sparse/tests/test_coo.py::test_elemwise_inplace[conjugate0]",
"sparse/tests/test_coo.py::test_elemwise_inplace[round_]",
"sparse/tests/test_coo.py::test_elemwise_inplace[rint]",
"sparse/tests/test_coo.py::test_elemwise_inplace[conjugate1]",
"sparse/tests/test_coo.py::test_elemwise_inplace[conjugate2]",
"sparse/tests/test_coo.py::test_elemwise_inplace[<lambda>]",
"sparse/tests/test_coo.py::test_elemwise_mixed",
"sparse/tests/test_coo.py::test_elemwise_mixed_empty",
"sparse/tests/test_coo.py::test_ndarray_bigger_shape",
"sparse/tests/test_coo.py::test_elemwise_unsupported",
"sparse/tests/test_coo.py::test_elemwise_mixed_broadcast",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-mul]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-add]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-sub]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-gt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-lt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-ne]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-mul]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-add]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-sub]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-gt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-lt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-ne]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-mul]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-add]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-sub]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-gt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-lt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-ne]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-mul]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-add]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-sub]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-gt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-lt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-ne]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape0-imul]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape0-iadd]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape0-isub]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape1-imul]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape1-iadd]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape1-isub]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape2-imul]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape2-iadd]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape2-isub]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape3-imul]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape3-iadd]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape3-isub]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape0-<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape0-<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape0-<lambda>2]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape0-<lambda>3]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape1-<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape1-<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape1-<lambda>2]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape1-<lambda>3]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape2-<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape2-<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape2-<lambda>2]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape2-<lambda>3]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape3-<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape3-<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape3-<lambda>2]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape3-<lambda>3]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape10-shape20-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape10-shape20-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape11-shape21-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape11-shape21-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape12-shape22-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape12-shape22-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape13-shape23-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape13-shape23-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape14-shape24-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape14-shape24-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape15-shape25-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape15-shape25-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape16-shape26-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape16-shape26-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape17-shape27-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape17-shape27-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape18-shape28-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape18-shape28-mul]",
"sparse/tests/test_coo.py::test_broadcast_to[shape10-shape20]",
"sparse/tests/test_coo.py::test_broadcast_to[shape11-shape21]",
"sparse/tests/test_coo.py::test_broadcast_to[shape12-shape22]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-nan-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-nan-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-nan-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-nan-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25--inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25--inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25--inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25--inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-nan-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-nan-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-nan-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-nan-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5--inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5--inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5--inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5--inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-nan-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-nan-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-nan-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-nan-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75--inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75--inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75--inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75--inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-nan-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-nan-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-nan-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-nan-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0--inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0--inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0--inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0--inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_sparse_broadcasting",
"sparse/tests/test_coo.py::test_dense_broadcasting",
"sparse/tests/test_coo.py::test_sparsearray_elemwise[coo]",
"sparse/tests/test_coo.py::test_sparsearray_elemwise[dok]",
"sparse/tests/test_coo.py::test_ndarray_densification_fails",
"sparse/tests/test_coo.py::test_elemwise_noargs",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[pow]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[truediv]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[floordiv]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[ge]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[le]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[eq]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[mod]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-mul-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-add-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-sub-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-pow-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-truediv-3]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-floordiv-4]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-gt-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-lt--5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-ne-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-ge-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-le--3]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-eq-1]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-mod-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-mul-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-add-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-sub-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-pow-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-truediv-3]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-floordiv-4]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-gt-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-lt--5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-ne-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-ge-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-le--3]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-eq-1]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-mod-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-mul-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-add-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-sub-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-gt--5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-lt-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-ne-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-ge--5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-le-3]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-eq-1]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-mul-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-add-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-sub-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-gt--5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-lt-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-ne-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-ge--5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-le-3]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-eq-1]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[add-5]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[sub--5]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[pow--3]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[truediv-0]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[floordiv-0]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[gt--5]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[lt-5]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[ne-1]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[ge--3]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[le-3]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[eq-0]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape0-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape0-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape0-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape1-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape1-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape1-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape2-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape2-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape2-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape3-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape3-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape3-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape0-iand]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape0-ior]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape0-ixor]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape1-iand]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape1-ior]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape1-ixor]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape2-iand]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape2-ior]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape2-ixor]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape3-iand]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape3-ior]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape3-ixor]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape0-lshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape0-rshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape1-lshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape1-rshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape2-lshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape2-rshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape3-lshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape3-rshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape0-ilshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape0-irshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape1-ilshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape1-irshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape2-ilshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape2-irshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape3-ilshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape3-irshift]",
"sparse/tests/test_coo.py::test_bitwise_scalar[shape0-and_]",
"sparse/tests/test_coo.py::test_bitwise_scalar[shape1-and_]",
"sparse/tests/test_coo.py::test_bitwise_scalar[shape2-and_]",
"sparse/tests/test_coo.py::test_bitwise_scalar[shape3-and_]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape0-lshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape0-rshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape1-lshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape1-rshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape2-lshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape2-rshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape3-lshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape3-rshift]",
"sparse/tests/test_coo.py::test_unary_bitwise_nonzero_output_fv[shape0-invert]",
"sparse/tests/test_coo.py::test_unary_bitwise_nonzero_output_fv[shape1-invert]",
"sparse/tests/test_coo.py::test_unary_bitwise_nonzero_output_fv[shape2-invert]",
"sparse/tests/test_coo.py::test_unary_bitwise_nonzero_output_fv[shape3-invert]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape0-or_]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape0-xor]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape1-or_]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape1-xor]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape2-or_]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape2-xor]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape3-or_]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape3-xor]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-mul]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-add]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-sub]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-gt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-lt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-ne]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-mul]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-add]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-sub]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-gt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-lt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-ne]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-mul]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-add]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-sub]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-gt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-lt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-ne]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-mul]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-add]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-sub]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-gt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-lt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-ne]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape0-lshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape0-rshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape1-lshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape1-rshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape2-lshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape2-rshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape3-lshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape3-rshift]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape0-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape0-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape0-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape1-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape1-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape1-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape2-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape2-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape2-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape3-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape3-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape3-xor]",
"sparse/tests/test_coo.py::test_elemwise_binary_empty",
"sparse/tests/test_coo.py::test_gt",
"sparse/tests/test_coo.py::test_slicing[0]",
"sparse/tests/test_coo.py::test_slicing[1]",
"sparse/tests/test_coo.py::test_slicing[-1]",
"sparse/tests/test_coo.py::test_slicing[index3]",
"sparse/tests/test_coo.py::test_slicing[index4]",
"sparse/tests/test_coo.py::test_slicing[index5]",
"sparse/tests/test_coo.py::test_slicing[index6]",
"sparse/tests/test_coo.py::test_slicing[index7]",
"sparse/tests/test_coo.py::test_slicing[index8]",
"sparse/tests/test_coo.py::test_slicing[index9]",
"sparse/tests/test_coo.py::test_slicing[index10]",
"sparse/tests/test_coo.py::test_slicing[index11]",
"sparse/tests/test_coo.py::test_slicing[index12]",
"sparse/tests/test_coo.py::test_slicing[index13]",
"sparse/tests/test_coo.py::test_slicing[index14]",
"sparse/tests/test_coo.py::test_slicing[index15]",
"sparse/tests/test_coo.py::test_slicing[index16]",
"sparse/tests/test_coo.py::test_slicing[index17]",
"sparse/tests/test_coo.py::test_slicing[index18]",
"sparse/tests/test_coo.py::test_slicing[index19]",
"sparse/tests/test_coo.py::test_slicing[index20]",
"sparse/tests/test_coo.py::test_slicing[index21]",
"sparse/tests/test_coo.py::test_slicing[index22]",
"sparse/tests/test_coo.py::test_slicing[index23]",
"sparse/tests/test_coo.py::test_slicing[index24]",
"sparse/tests/test_coo.py::test_slicing[index25]",
"sparse/tests/test_coo.py::test_slicing[index26]",
"sparse/tests/test_coo.py::test_slicing[index27]",
"sparse/tests/test_coo.py::test_slicing[index28]",
"sparse/tests/test_coo.py::test_slicing[index29]",
"sparse/tests/test_coo.py::test_slicing[index30]",
"sparse/tests/test_coo.py::test_slicing[index31]",
"sparse/tests/test_coo.py::test_slicing[index32]",
"sparse/tests/test_coo.py::test_slicing[index33]",
"sparse/tests/test_coo.py::test_slicing[index34]",
"sparse/tests/test_coo.py::test_slicing[index35]",
"sparse/tests/test_coo.py::test_slicing[index36]",
"sparse/tests/test_coo.py::test_slicing[index37]",
"sparse/tests/test_coo.py::test_slicing[index38]",
"sparse/tests/test_coo.py::test_slicing[index39]",
"sparse/tests/test_coo.py::test_slicing[index40]",
"sparse/tests/test_coo.py::test_slicing[index41]",
"sparse/tests/test_coo.py::test_slicing[index42]",
"sparse/tests/test_coo.py::test_slicing[index43]",
"sparse/tests/test_coo.py::test_slicing[index44]",
"sparse/tests/test_coo.py::test_slicing[index45]",
"sparse/tests/test_coo.py::test_advanced_indexing[index0]",
"sparse/tests/test_coo.py::test_advanced_indexing[index1]",
"sparse/tests/test_coo.py::test_advanced_indexing[index2]",
"sparse/tests/test_coo.py::test_advanced_indexing[index3]",
"sparse/tests/test_coo.py::test_advanced_indexing[index4]",
"sparse/tests/test_coo.py::test_advanced_indexing[index5]",
"sparse/tests/test_coo.py::test_advanced_indexing[index6]",
"sparse/tests/test_coo.py::test_advanced_indexing[index7]",
"sparse/tests/test_coo.py::test_advanced_indexing[index8]",
"sparse/tests/test_coo.py::test_advanced_indexing[index9]",
"sparse/tests/test_coo.py::test_custom_dtype_slicing",
"sparse/tests/test_coo.py::test_slicing_errors[index0]",
"sparse/tests/test_coo.py::test_slicing_errors[index1]",
"sparse/tests/test_coo.py::test_slicing_errors[index2]",
"sparse/tests/test_coo.py::test_slicing_errors[5]",
"sparse/tests/test_coo.py::test_slicing_errors[-5]",
"sparse/tests/test_coo.py::test_slicing_errors[foo]",
"sparse/tests/test_coo.py::test_slicing_errors[index6]",
"sparse/tests/test_coo.py::test_slicing_errors[0.5]",
"sparse/tests/test_coo.py::test_slicing_errors[index8]",
"sparse/tests/test_coo.py::test_slicing_errors[index9]",
"sparse/tests/test_coo.py::test_slicing_errors[index10]",
"sparse/tests/test_coo.py::test_slicing_errors[index11]",
"sparse/tests/test_coo.py::test_concatenate",
"sparse/tests/test_coo.py::test_concatenate_mixed[stack-0]",
"sparse/tests/test_coo.py::test_concatenate_mixed[stack-1]",
"sparse/tests/test_coo.py::test_concatenate_mixed[concatenate-0]",
"sparse/tests/test_coo.py::test_concatenate_mixed[concatenate-1]",
"sparse/tests/test_coo.py::test_concatenate_noarrays",
"sparse/tests/test_coo.py::test_stack[0-shape0]",
"sparse/tests/test_coo.py::test_stack[0-shape1]",
"sparse/tests/test_coo.py::test_stack[0-shape2]",
"sparse/tests/test_coo.py::test_stack[1-shape0]",
"sparse/tests/test_coo.py::test_stack[1-shape1]",
"sparse/tests/test_coo.py::test_stack[1-shape2]",
"sparse/tests/test_coo.py::test_stack[-1-shape0]",
"sparse/tests/test_coo.py::test_stack[-1-shape1]",
"sparse/tests/test_coo.py::test_stack[-1-shape2]",
"sparse/tests/test_coo.py::test_large_concat_stack",
"sparse/tests/test_coo.py::test_addition",
"sparse/tests/test_coo.py::test_scalar_multiplication[2]",
"sparse/tests/test_coo.py::test_scalar_multiplication[2.5]",
"sparse/tests/test_coo.py::test_scalar_multiplication[scalar2]",
"sparse/tests/test_coo.py::test_scalar_multiplication[scalar3]",
"sparse/tests/test_coo.py::test_scalar_exponentiation",
"sparse/tests/test_coo.py::test_create_with_lists_of_tuples",
"sparse/tests/test_coo.py::test_sizeof",
"sparse/tests/test_coo.py::test_scipy_sparse_interface",
"sparse/tests/test_coo.py::test_scipy_sparse_interaction[coo]",
"sparse/tests/test_coo.py::test_scipy_sparse_interaction[csr]",
"sparse/tests/test_coo.py::test_scipy_sparse_interaction[dok]",
"sparse/tests/test_coo.py::test_scipy_sparse_interaction[csc]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[mul]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[add]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[sub]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[gt]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[lt]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[ne]",
"sparse/tests/test_coo.py::test_op_scipy_sparse_left[add]",
"sparse/tests/test_coo.py::test_op_scipy_sparse_left[sub]",
"sparse/tests/test_coo.py::test_cache_csr",
"sparse/tests/test_coo.py::test_empty_shape",
"sparse/tests/test_coo.py::test_single_dimension",
"sparse/tests/test_coo.py::test_large_sum",
"sparse/tests/test_coo.py::test_add_many_sparse_arrays",
"sparse/tests/test_coo.py::test_caching",
"sparse/tests/test_coo.py::test_scalar_slicing",
"sparse/tests/test_coo.py::test_triul[shape0-0]",
"sparse/tests/test_coo.py::test_triul[shape1-1]",
"sparse/tests/test_coo.py::test_triul[shape2--1]",
"sparse/tests/test_coo.py::test_triul[shape3--2]",
"sparse/tests/test_coo.py::test_triul[shape4-1000]",
"sparse/tests/test_coo.py::test_empty_reduction",
"sparse/tests/test_coo.py::test_random_shape[0.1-shape0]",
"sparse/tests/test_coo.py::test_random_shape[0.1-shape1]",
"sparse/tests/test_coo.py::test_random_shape[0.1-shape2]",
"sparse/tests/test_coo.py::test_random_shape[0.3-shape0]",
"sparse/tests/test_coo.py::test_random_shape[0.3-shape1]",
"sparse/tests/test_coo.py::test_random_shape[0.3-shape2]",
"sparse/tests/test_coo.py::test_random_shape[0.5-shape0]",
"sparse/tests/test_coo.py::test_random_shape[0.5-shape1]",
"sparse/tests/test_coo.py::test_random_shape[0.5-shape2]",
"sparse/tests/test_coo.py::test_random_shape[0.7-shape0]",
"sparse/tests/test_coo.py::test_random_shape[0.7-shape1]",
"sparse/tests/test_coo.py::test_random_shape[0.7-shape2]",
"sparse/tests/test_coo.py::test_two_random_unequal",
"sparse/tests/test_coo.py::test_two_random_same_seed",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape0-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape0-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape0-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape1-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape1-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape1-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape0-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape0-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape0-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape1-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape1-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape1-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape0-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape0-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape0-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape1-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape1-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape1-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape0-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape0-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape0-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape1-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape1-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape1-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_fv[coo]",
"sparse/tests/test_coo.py::test_random_fv[dok]",
"sparse/tests/test_coo.py::test_scalar_shape_construction",
"sparse/tests/test_coo.py::test_len",
"sparse/tests/test_coo.py::test_density",
"sparse/tests/test_coo.py::test_size",
"sparse/tests/test_coo.py::test_np_array",
"sparse/tests/test_coo.py::test_three_arg_where[shapes0]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes1]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes2]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes3]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes4]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes5]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes6]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes7]",
"sparse/tests/test_coo.py::test_one_arg_where",
"sparse/tests/test_coo.py::test_one_arg_where_dense",
"sparse/tests/test_coo.py::test_two_arg_where",
"sparse/tests/test_coo.py::test_inplace_invalid_shape[imul]",
"sparse/tests/test_coo.py::test_inplace_invalid_shape[iadd]",
"sparse/tests/test_coo.py::test_inplace_invalid_shape[isub]",
"sparse/tests/test_coo.py::test_nonzero",
"sparse/tests/test_coo.py::test_argwhere",
"sparse/tests/test_coo.py::test_asformat[coo]",
"sparse/tests/test_coo.py::test_asformat[dok]",
"sparse/tests/test_coo.py::test_as_coo[COO]",
"sparse/tests/test_coo.py::test_as_coo[DOK]",
"sparse/tests/test_coo.py::test_as_coo[csr_matrix]",
"sparse/tests/test_coo.py::test_as_coo[asarray]",
"sparse/tests/test_coo.py::test_invalid_attrs_error",
"sparse/tests/test_coo.py::test_invalid_iterable_error",
"sparse/tests/test_coo.py::test_prod_along_axis",
"sparse/tests/test_coo.py::TestRoll::test_1d[0]",
"sparse/tests/test_coo.py::TestRoll::test_1d[2]",
"sparse/tests/test_coo.py::TestRoll::test_1d[-2]",
"sparse/tests/test_coo.py::TestRoll::test_1d[20]",
"sparse/tests/test_coo.py::TestRoll::test_1d[-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None-0]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None-2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None--2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None--20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0-0]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0-2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0--2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0--20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1-0]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1-2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1--2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1--20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3-0]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3-2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3--2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3--20]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax0-shift0]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax0-shift1]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax0-shift2]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax0-shift3]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax1-shift0]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax1-shift1]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax1-shift2]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax1-shift3]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax2-shift0]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax2-shift1]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax2-shift2]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax2-shift3]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax3-shift0]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax3-shift1]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax3-shift2]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax3-shift3]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None-0]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None-2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None--2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None-20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None--20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0-0]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0-2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0--2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0-20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0--20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1-0]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1-2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1--2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1-20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1--20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3-0]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3-2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3--2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3-20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3--20]",
"sparse/tests/test_coo.py::TestRoll::test_empty",
"sparse/tests/test_coo.py::TestRoll::test_valerr[args0]",
"sparse/tests/test_coo.py::TestRoll::test_valerr[args1]",
"sparse/tests/test_coo.py::TestRoll::test_valerr[args2]",
"sparse/tests/test_coo.py::TestRoll::test_valerr[args3]",
"sparse/tests/test_coo.py::test_clip",
"sparse/tests/test_coo.py::TestFailFillValue::test_nonzero_fv",
"sparse/tests/test_coo.py::TestFailFillValue::test_inconsistent_fv",
"sparse/tests/test_coo.py::test_pickle",
"sparse/tests/test_coo.py::test_copy[True]",
"sparse/tests/test_coo.py::test_copy[False]",
"sparse/tests/test_coo.py::test_initialization[2]",
"sparse/tests/test_coo.py::test_initialization[3]",
"sparse/tests/test_coo.py::test_initialization[4]",
"sparse/tests/test_coo.py::test_initialization[5]",
"sparse/tests/test_coo.py::test_eye[4-None]",
"sparse/tests/test_coo.py::test_eye[4-10]",
"sparse/tests/test_coo.py::test_eye[10-4]",
"sparse/tests/test_coo.py::test_eye[0-10]",
"sparse/tests/test_coo.py::test_ones_zeros[ones]",
"sparse/tests/test_coo.py::test_ones_zeros[zeros]",
"sparse/tests/test_coo.py::test_ones_zeros_like[ones_like]",
"sparse/tests/test_coo.py::test_ones_zeros_like[zeros_like]",
"sparse/tests/test_coo.py::test_full",
"sparse/tests/test_coo.py::test_full_like",
"sparse/tests/test_coo.py::test_complex_methods[True]",
"sparse/tests/test_coo.py::test_complex_methods[False]"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,257 |
[
"sparse/coo/core.py"
] |
[
"sparse/coo/core.py"
] |
faucetsdn__beka-19
|
a9e33b75342afa0a8e96d8b3475df8b6a5611af3
|
2018-10-17 04:35:26
|
1150fee38789d9513934f0cc286d7b8e081abcce
|
diff --git a/beka/beka.py b/beka/beka.py
index 8985684..2907ceb 100644
--- a/beka/beka.py
+++ b/beka/beka.py
@@ -97,3 +97,6 @@ class Beka(object):
self.stream_server.stop()
for peering in self.peerings:
peering.shutdown()
+
+ def listening_on(self, address, port):
+ return self.local_address == address and self.bgp_port == port
|
Comparing Bekas
It'd be great to be able to compare Bekas, using (for example):
self.local_address = local_address
self.bgp_port = bgp_port
self.local_as = local_as
self.router_id = router_id
That way we can decide whether we need to start a new Beka or not by comparing it to an existing one.
|
faucetsdn/beka
|
diff --git a/test/test_beka.py b/test/test_beka.py
index b5de955..066fd0a 100644
--- a/test/test_beka.py
+++ b/test/test_beka.py
@@ -48,3 +48,20 @@ class BekaTestCase(unittest.TestCase):
)
)
+ def test_listening_on(self):
+ beka = Beka(
+ local_address='1.2.3.4',
+ bgp_port=12345,
+ local_as=23456,
+ router_id='4.3.2.1',
+ peer_up_handler=None,
+ peer_down_handler=None,
+ route_handler=None,
+ error_handler=None
+ )
+ self.assertTrue(beka.listening_on('1.2.3.4', 12345))
+ self.assertFalse(beka.listening_on('1.2.3.4', 23456))
+ self.assertFalse(beka.listening_on('4.3.2.1', 12345))
+ self.assertFalse(beka.listening_on('4.3.2.1', 23456))
+ self.assertFalse(beka.listening_on('8.8.8.8', 53))
+
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 3,
"test_score": 2
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/faucetsdn/beka.git@a9e33b75342afa0a8e96d8b3475df8b6a5611af3#egg=beka
dnspython==2.7.0
eventlet==0.39.1
exceptiongroup==1.2.2
greenlet==3.1.1
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
tomli==2.2.1
|
name: beka
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- dnspython==2.7.0
- eventlet==0.39.1
- exceptiongroup==1.2.2
- greenlet==3.1.1
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pytest==8.3.5
- tomli==2.2.1
prefix: /opt/conda/envs/beka
|
[
"test/test_beka.py::BekaTestCase::test_listening_on"
] |
[] |
[
"test/test_beka.py::BekaTestCase::test_add_neighbor_cannot_add_twice",
"test/test_beka.py::BekaTestCase::test_add_neighbor_must_be_passive",
"test/test_beka.py::BekaTestCase::test_add_route_adds_route"
] |
[] |
Apache License 2.0
| 3,258 |
[
"beka/beka.py"
] |
[
"beka/beka.py"
] |
|
albertyw__git-browse-39
|
f8acdd38d1c28524e0ba5f2c44fdd472bfccb1d7
|
2018-10-17 07:01:10
|
f8acdd38d1c28524e0ba5f2c44fdd472bfccb1d7
|
diff --git a/git_browse/browse.py b/git_browse/browse.py
index 6a71221..bde7c54 100755
--- a/git_browse/browse.py
+++ b/git_browse/browse.py
@@ -15,15 +15,19 @@ import webbrowser
__version__ = '2.6.0'
+GITHUB_HOST = '(?P<host>github\.com)'
+UBER_HOST = '(?P<host>code\.uber\.internal)'
+UBER_CONFIG_HOST = '(?P<host>config\.uber\.internal)'
USER_REGEX = '(?P<user>[\w\.@:\/~_-]+)'
REPOSITORY_REGEX = '(?P<repository>[\w\.@:\/~_-]+)'
-GITHUB_SSH_URL = '[email protected]:%s/%s' % (USER_REGEX, REPOSITORY_REGEX)
-GITHUB_HTTPS_URL = 'https://github.com/%s/%s' % (USER_REGEX, REPOSITORY_REGEX)
-UBER_SSH_GITOLITE_URL = '[email protected]:%s' % (REPOSITORY_REGEX)
-UBER_SSH_CONFIG_GITOLITE_URL = '[email protected]:%s' % \
- (REPOSITORY_REGEX)
-UBER_HTTPS_GITOLITE_URL = 'https://code.uber.internal/%s/%s' % \
- (USER_REGEX, REPOSITORY_REGEX)
+GITHUB_SSH_URL = 'git@%s:%s/%s' % (GITHUB_HOST, USER_REGEX, REPOSITORY_REGEX)
+GITHUB_HTTPS_URL = 'https://%s/%s/%s' % \
+ (GITHUB_HOST, USER_REGEX, REPOSITORY_REGEX)
+UBER_SSH_GITOLITE_URL = 'gitolite@%s:%s' % (UBER_HOST, REPOSITORY_REGEX)
+UBER_SSH_CONFIG_GITOLITE_URL = 'gitolite@%s:%s' % \
+ (UBER_CONFIG_HOST, REPOSITORY_REGEX)
+UBER_HTTPS_GITOLITE_URL = 'https://%s/%s/%s' % \
+ (UBER_HOST, USER_REGEX, REPOSITORY_REGEX)
class GithubHost(object):
@@ -115,6 +119,66 @@ class PhabricatorHost(object):
return None
+class SourcegraphHost(object):
+ SOURCEGRAPH_URL = 'https://sourcegraph.uberinternal.com/'
+
+ def __init__(self, host: str, repository: str):
+ self.host = host
+ self.repository = repository
+
+ @staticmethod
+ def create(url_regex_match: Match) -> 'SourcegraphHost':
+ repository = url_regex_match.group('repository')
+ if repository[-4:] == '.git':
+ repository = repository[:-4]
+ host = url_regex_match.group('host')
+ return SourcegraphHost(host, repository)
+
+ def get_url(self, git_object: 'GitObject') -> str:
+ repository_url = "%s%s/%s" % (
+ self.SOURCEGRAPH_URL,
+ self.host,
+ self.repository
+ )
+ if git_object.is_commit_hash():
+ return self.commit_hash_url(repository_url, git_object)
+ if git_object.is_root():
+ return repository_url
+ if git_object.is_directory():
+ return self.directory_url(repository_url, git_object)
+ return self.file_url(repository_url, git_object)
+
+ def commit_hash_url(
+ self,
+ repository_url: str,
+ focus_hash: 'GitObject') -> str:
+ repository_url = "%s/-/commit/%s" % (
+ repository_url,
+ focus_hash.identifier
+ )
+ return repository_url
+
+ def directory_url(
+ self,
+ repository_url: str,
+ focus_object: 'GitObject') -> str:
+ repository_url = "%s/-/tree/%s" % (
+ repository_url,
+ focus_object.identifier
+ )
+ return repository_url
+
+ def file_url(self, repository_url: str, focus_object: 'GitObject') -> str:
+ repository_url = "%s/-/blob/%s" % (
+ repository_url,
+ focus_object.identifier
+ )
+ return repository_url
+
+ def valid_focus_object(self, arg: str):
+ return None
+
+
HOST_REGEXES = {
GITHUB_SSH_URL: GithubHost,
GITHUB_HTTPS_URL: GithubHost,
@@ -188,21 +252,24 @@ def get_git_url(git_config_file: str) -> str:
return git_url
-def parse_git_url(git_url: str) -> Any:
+def parse_git_url(git_url: str, sourcegraph: bool=False) -> Any:
for regex, host_class in HOST_REGEXES.items():
match = re.search(regex, git_url)
if match:
break
if not match:
raise ValueError("git url not parseable")
- host = host_class.create(match)
+ if sourcegraph:
+ host = SourcegraphHost.create(match)
+ else:
+ host = host_class.create(match)
return host
-def get_repository_host() -> Any:
+def get_repository_host(sourcegraph: bool=False) -> Any:
git_config_file = get_git_config()
git_url = get_git_url(git_config_file)
- repo_host = parse_git_url(git_url)
+ repo_host = parse_git_url(git_url, sourcegraph)
return repo_host
@@ -274,12 +341,18 @@ def main() -> None:
action='store_true',
help='Do not open the url in the brower, and only print to stdout'
)
+ parser.add_argument(
+ '-s',
+ '--sourcegraph',
+ action='store_true',
+ help='Open objects in sourcegraph'
+ )
parser.add_argument(
'-v', '--version', action='version', version=__version__,
)
args = parser.parse_args()
- host = get_repository_host()
+ host = get_repository_host(args.sourcegraph)
path = os.path.join(os.getcwd(), args.path)
git_object = get_git_object(args.target, path, host)
url = host.get_url(git_object)
|
Support opening git objects in uber sourcegraph
Files: https://sourcegraph.uberinternal.com/code.uber.internal/path/to/repo/-/blob/path/to/file
Repositories: https://sourcegraph.uberinternal.com/code.uber.internal/path/to/repo/
Commits: https://sourcegraph.uberinternal.com/code.uber.internal/path/to/repo/-/commit/commitID
|
albertyw/git-browse
|
diff --git a/git_browse/tests/test.py b/git_browse/tests/test.py
index 0608c86..0742094 100644
--- a/git_browse/tests/test.py
+++ b/git_browse/tests/test.py
@@ -1,4 +1,5 @@
import os
+import re
import shutil
import sys
import unittest
@@ -60,6 +61,63 @@ class TestGithubHost(unittest.TestCase):
)
+class SourcegraphHost(unittest.TestCase):
+ def setUp(self):
+ self.obj = browse.SourcegraphHost('code.uber.internal', 'asdf')
+
+ def test_init(self):
+ self.assertEqual(self.obj.host, 'code.uber.internal')
+ self.assertEqual(self.obj.repository, 'asdf')
+
+ def test_create(self):
+ repo = '[email protected]:a/b'
+ match = re.search(browse.UBER_SSH_GITOLITE_URL, repo)
+ obj = browse.SourcegraphHost.create(match)
+ self.assertEqual(obj.repository, 'a/b')
+
+ def test_create_dot_git(self):
+ repo = '[email protected]:a/b.git'
+ match = re.search(browse.UBER_SSH_GITOLITE_URL, repo)
+ obj = browse.SourcegraphHost.create(match)
+ self.assertEqual(obj.repository, 'a/b')
+
+ def test_get_url_commit(self):
+ git_object = browse.FocusHash('abcd')
+ url = self.obj.get_url(git_object)
+ self.assertEqual(
+ url,
+ self.obj.SOURCEGRAPH_URL + 'code.uber.internal/asdf/-/commit/abcd'
+ )
+
+ def test_get_url_root(self):
+ git_object = browse.FocusObject(os.sep)
+ url = self.obj.get_url(git_object)
+ self.assertEqual(
+ url,
+ self.obj.SOURCEGRAPH_URL + 'code.uber.internal/asdf'
+ )
+
+ def test_get_url_directory(self):
+ git_object = browse.FocusObject('zxcv' + os.sep)
+ url = self.obj.get_url(git_object)
+ self.assertEqual(
+ url,
+ self.obj.SOURCEGRAPH_URL + 'code.uber.internal/asdf/-/tree/zxcv/'
+ )
+
+ def test_get_url_file(self):
+ git_object = browse.FocusObject('zxcv')
+ url = self.obj.get_url(git_object)
+ self.assertEqual(
+ url,
+ self.obj.SOURCEGRAPH_URL + 'code.uber.internal/asdf/-/blob/zxcv'
+ )
+
+ def test_valid_focus_object(self):
+ valid = self.obj.valid_focus_object('asdf')
+ self.assertEqual(valid, None)
+
+
class GitObject(unittest.TestCase):
def test_is_directory(self):
obj = browse.GitObject('/asdf')
@@ -159,6 +217,12 @@ class ParseGitURL(unittest.TestCase):
self.assertEqual(host.user, 'albertyw')
self.assertEqual(host.repository, 'git-browse')
+ def test_sourcegraph_host(self):
+ host = browse.parse_git_url(self.ssh_url, sourcegraph=True)
+ self.assertTrue(host.__class__ is browse.SourcegraphHost)
+ self.assertEqual(host.host, 'github.com')
+ self.assertEqual(host.repository, 'git-browse')
+
def test_broken_url(self):
with self.assertRaises(ValueError):
browse.parse_git_url(self.broken_url)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 3,
"issue_text_score": 3,
"test_score": 3
},
"num_modified_files": 1
}
|
2.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"coverage",
"flake8",
"mypy",
"pytest"
],
"pre_install": [],
"python": "3.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
coverage==7.2.7
flake8==5.0.4
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
-e git+https://github.com/albertyw/git-browse.git@f8acdd38d1c28524e0ba5f2c44fdd472bfccb1d7#egg=git_browse
importlib-metadata==4.2.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mccabe==0.7.0
mypy==1.4.1
mypy-extensions==1.0.0
packaging @ file:///croot/packaging_1671697413597/work
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pycodestyle==2.9.1
pyflakes==2.5.0
pytest==7.1.2
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typed-ast==1.5.5
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zipp @ file:///croot/zipp_1672387121353/work
|
name: git-browse
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=22.1.0=py37h06a4308_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- flit-core=3.6.0=pyhd3eb1b0_0
- importlib_metadata=4.11.3=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=22.0=py37h06a4308_0
- pip=22.3.1=py37h06a4308_0
- pluggy=1.0.0=py37h06a4308_1
- py=1.11.0=pyhd3eb1b0_0
- pytest=7.1.2=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py37h06a4308_0
- typing_extensions=4.4.0=py37h06a4308_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zipp=3.11.0=py37h06a4308_0
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.2.7
- flake8==5.0.4
- importlib-metadata==4.2.0
- mccabe==0.7.0
- mypy==1.4.1
- mypy-extensions==1.0.0
- pycodestyle==2.9.1
- pyflakes==2.5.0
- typed-ast==1.5.5
prefix: /opt/conda/envs/git-browse
|
[
"git_browse/tests/test.py::SourcegraphHost::test_create",
"git_browse/tests/test.py::SourcegraphHost::test_create_dot_git",
"git_browse/tests/test.py::SourcegraphHost::test_get_url_commit",
"git_browse/tests/test.py::SourcegraphHost::test_get_url_directory",
"git_browse/tests/test.py::SourcegraphHost::test_get_url_file",
"git_browse/tests/test.py::SourcegraphHost::test_get_url_root",
"git_browse/tests/test.py::SourcegraphHost::test_init",
"git_browse/tests/test.py::SourcegraphHost::test_valid_focus_object",
"git_browse/tests/test.py::ParseGitURL::test_sourcegraph_host"
] |
[
"git_browse/tests/test.py::GetGitURL::test_url"
] |
[
"git_browse/tests/test.py::TestGithubHost::test_commit_hash_url",
"git_browse/tests/test.py::TestGithubHost::test_directory_url",
"git_browse/tests/test.py::TestGithubHost::test_file_url",
"git_browse/tests/test.py::TestGithubHost::test_get_url",
"git_browse/tests/test.py::TestGithubHost::test_init",
"git_browse/tests/test.py::TestGithubHost::test_root_url",
"git_browse/tests/test.py::GitObject::test_is_directory",
"git_browse/tests/test.py::FocusObject::test_default",
"git_browse/tests/test.py::FocusObject::test_init",
"git_browse/tests/test.py::FocusObject::test_is_directory",
"git_browse/tests/test.py::FocusObject::test_is_not_directory",
"git_browse/tests/test.py::FocusObject::test_is_not_root",
"git_browse/tests/test.py::FocusObject::test_is_root",
"git_browse/tests/test.py::FocusHash::test_init",
"git_browse/tests/test.py::FocusHash::test_is_commit_hash",
"git_browse/tests/test.py::GetRepositoryRoot::test_fail_get",
"git_browse/tests/test.py::GetRepositoryRoot::test_get",
"git_browse/tests/test.py::GetGitConfig::test_get",
"git_browse/tests/test.py::GetGitURL::test_bad_url",
"git_browse/tests/test.py::ParseGitURL::test_broken_url",
"git_browse/tests/test.py::ParseGitURL::test_https_url",
"git_browse/tests/test.py::ParseGitURL::test_ssh_url",
"git_browse/tests/test.py::TestGetRepositoryHost::test_repository_host",
"git_browse/tests/test.py::TestGetFocusObject::test_default_focus_object",
"git_browse/tests/test.py::TestGetFocusObject::test_directory_focus_object",
"git_browse/tests/test.py::TestGetFocusObject::test_file_focus_object",
"git_browse/tests/test.py::TestGetFocusObject::test_get_focus_hash",
"git_browse/tests/test.py::TestGetFocusObject::test_invalid_phabricator_object",
"git_browse/tests/test.py::TestGetFocusObject::test_nonexistend_focus_object",
"git_browse/tests/test.py::TestGetFocusObject::test_phabricator_object",
"git_browse/tests/test.py::TestGetCommitHash::test_get_hash",
"git_browse/tests/test.py::TestGetCommitHash::test_get_unknown_hash",
"git_browse/tests/test.py::TestOpenURL::test_dry_open_url",
"git_browse/tests/test.py::TestOpenURL::test_open_subprocess",
"git_browse/tests/test.py::TestOpenURL::test_open_url",
"git_browse/tests/test.py::FullTest::test_chdir_subdirectory",
"git_browse/tests/test.py::FullTest::test_chdir_subdirectory_file",
"git_browse/tests/test.py::FullTest::test_check_version",
"git_browse/tests/test.py::FullTest::test_default",
"git_browse/tests/test.py::FullTest::test_directory",
"git_browse/tests/test.py::FullTest::test_file",
"git_browse/tests/test.py::FullTest::test_subdirectory",
"git_browse/tests/test.py::FullTest::test_subdirectory_file"
] |
[] |
MIT License
| 3,259 |
[
"git_browse/browse.py"
] |
[
"git_browse/browse.py"
] |
|
Duke-GCB__bespin-cli-18
|
3cb0cf75ca821e051ea48d4b1a990f34acedd98d
|
2018-10-17 13:35:13
|
2cef15b8296373f564d5cdf3c34503c1ca7f1e29
|
diff --git a/bespin/commands.py b/bespin/commands.py
index e30d252..1766e96 100644
--- a/bespin/commands.py
+++ b/bespin/commands.py
@@ -3,6 +3,7 @@ from bespin.config import ConfigFile
from bespin.api import BespinApi
from bespin.exceptions import IncompleteJobFileException
from bespin.dukeds import DDSFileUtil
+from bespin.dukeds import PATH_PREFIX as DUKEDS_PATH_PREFIX
from tabulate import tabulate
import yaml
import json
@@ -411,8 +412,8 @@ class JobOrderWalker(object):
:param path: str: format dds://<projectname>/<filepath>
:return: str: file path to be used for staging data when running the workflow
"""
- if path.startswith("dds://"):
- return path.replace("dds://", "dds_").replace("/", "_").replace(":", "_")
+ if path.startswith(DUKEDS_PATH_PREFIX):
+ return path.replace(DUKEDS_PATH_PREFIX, "dds_").replace("/", "_").replace(":", "_")
return path
@@ -421,8 +422,10 @@ class JobOrderPlaceholderCheck(JobOrderWalker):
self.keys_with_placeholders = set()
def on_class_value(self, top_level_key, value):
- if value['class'] == 'File' and value['path'] in USER_PLACEHOLDER_VALUES:
- self.keys_with_placeholders.add(top_level_key)
+ if value['class'] == 'File':
+ path = value.get('path')
+ if path and path in USER_PLACEHOLDER_VALUES:
+ self.keys_with_placeholders.add(top_level_key)
def on_simple_value(self, top_level_key, value):
if value in USER_PLACEHOLDER_VALUES:
@@ -432,7 +435,9 @@ class JobOrderPlaceholderCheck(JobOrderWalker):
class JobOrderFormatFiles(JobOrderWalker):
def on_class_value(self, top_level_key, value):
if value['class'] == 'File':
- value['path'] = self.format_file_path(value['path'])
+ path = value.get('path')
+ if path:
+ value['path'] = self.format_file_path(path)
class JobOrderFileDetails(JobOrderWalker):
@@ -442,6 +447,7 @@ class JobOrderFileDetails(JobOrderWalker):
def on_class_value(self, top_level_key, value):
if value['class'] == 'File':
- path = value['path']
- dds_file = self.dds_file_util.find_file_for_path(path)
- self.dds_files.append((dds_file, self.format_file_path(path)))
+ path = value.get('path')
+ if path and path.startswith(DUKEDS_PATH_PREFIX):
+ dds_file = self.dds_file_util.find_file_for_path(path)
+ self.dds_files.append((dds_file, self.format_file_path(path)))
|
Allow using non-DukeDS File parameters
Currently all files are expected to begin with the `dds:` prefix. If a user attempts to use a ` class: File` input specifying either a url or a file path they will receive an error.
```
Invalid DukeDS file path (missing prefix): /data/exome-seq/b37/SUPERSNIPS.vcf
```
If a user attempts to use the location option they receive the following:
```
...
self.on_class_value(top_level_key, obj)
File "/Users/jpb67/Documents/work/bespin-cli/env3/lib/python3.6/site-packages/bespin/commands.py", line 424, in on_class_value
if value['class'] == 'File' and value['path'] in USER_PLACEHOLDER_VALUES:
KeyError: 'path'
```
Documentation on CWL File:
https://www.commonwl.org/v1.0/Workflow.html#File
|
Duke-GCB/bespin-cli
|
diff --git a/bespin/test_commands.py b/bespin/test_commands.py
index 486bf81..c03c245 100644
--- a/bespin/test_commands.py
+++ b/bespin/test_commands.py
@@ -250,6 +250,14 @@ class JobFileTestCase(TestCase):
'class': 'File',
'path': 'dds://project/somepath.txt'
},
+ 'my_path_file': {
+ 'class': 'File',
+ 'path': '/tmp/data.txt'
+ },
+ 'my_url_file': {
+ 'class': 'File',
+ 'location': 'https://github.com/datafile1.dat'
+ },
'myint': 123,
'myfileary': [
{
@@ -298,6 +306,14 @@ class JobFileTestCase(TestCase):
'path': 'dds_myproject_rawData_SAAAA_R2_001.fastq.gz'
},
'name': 'Sample1'}])
+ self.assertEqual(user_job_order['my_path_file'], {
+ 'class': 'File',
+ 'path': '/tmp/data.txt'
+ }, "Plain file paths should not be modified.")
+ self.assertEqual(user_job_order['my_url_file'], {
+ 'class': 'File',
+ 'location': 'https://github.com/datafile1.dat'
+ }, "URL file paths should not be modified.")
@patch('bespin.commands.DDSFileUtil')
def test_get_dds_files_details(self, mock_dds_file_util):
@@ -529,7 +545,15 @@ class JobOrderWalkerTestCase(TestCase):
'class': 'File',
'path': 'somepath3'
}]
- }
+ },
+ 'plain_path_file': {
+ 'class': 'File',
+ 'path': '/tmp/data.txt'
+ },
+ 'url_file': {
+ 'class': 'File',
+ 'location': 'https://github.com/datafile1.dat'
+ },
})
walker.on_simple_value.assert_has_calls([
@@ -592,6 +616,14 @@ class JobOrderPlaceholderCheckTestCase(TestCase):
'path': FILE_PLACEHOLDER,
}
},
+ 'plain_path_file': {
+ 'class': 'File',
+ 'path': '/tmp/data.txt'
+ },
+ 'url_file': {
+ 'class': 'File',
+ 'location': 'https://github.com/datafile1.dat'
+ },
}
expected_keys = [
'bad_str', 'bad_int', 'bad_file', 'bad_str_ary', 'bad_file_ary', 'bad_file_dict',
@@ -623,6 +655,14 @@ class JobOrderFormatFilesTestCase(TestCase):
'path': 'dds://project3/data/other/somepath.txt',
}
},
+ 'plain_path_file': {
+ 'class': 'File',
+ 'path': '/tmp/data.txt'
+ },
+ 'url_file': {
+ 'class': 'File',
+ 'location': 'https://github.com/datafile1.dat'
+ },
}
formatter = JobOrderFormatFiles()
@@ -661,6 +701,14 @@ class JobOrderFileDetailsTestCase(TestCase):
'path': 'dds://project3/data/other/somepath.txt',
}
},
+ 'plain_path_file': {
+ 'class': 'File',
+ 'path': '/tmp/data.txt'
+ },
+ 'url_file': {
+ 'class': 'File',
+ 'location': 'https://github.com/datafile1.dat'
+ },
}
expected_dds_file_info = [
('ddsfiledata', 'dds_project1_data_somepath.txt'),
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 1
}
|
0.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
azure-common==1.1.28
azure-core==1.32.0
azure-identity==1.21.0
azure-mgmt-core==1.5.0
azure-mgmt-storage==22.1.1
azure-storage-blob==12.25.1
azure-storage-file-datalake==12.20.0
-e git+https://github.com/Duke-GCB/bespin-cli.git@3cb0cf75ca821e051ea48d4b1a990f34acedd98d#egg=bespin_cli
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
cryptography==44.0.2
DukeDSClient==4.0.0
exceptiongroup==1.2.2
future==1.0.0
idna==3.10
iniconfig==2.1.0
isodate==0.7.2
mock==5.2.0
msal==1.32.0
msal-extensions==1.3.1
msgraph-core==0.2.2
packaging==24.2
pluggy==1.5.0
pycparser==2.22
PyJWT==2.10.1
pytest==8.3.5
pytz==2025.2
PyYAML==6.0.2
requests==2.32.3
six==1.17.0
tabulate==0.9.0
tenacity==6.2.0
tomli==2.2.1
typing_extensions==4.13.0
urllib3==2.3.0
|
name: bespin-cli
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- azure-common==1.1.28
- azure-core==1.32.0
- azure-identity==1.21.0
- azure-mgmt-core==1.5.0
- azure-mgmt-storage==22.1.1
- azure-storage-blob==12.25.1
- azure-storage-file-datalake==12.20.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- cryptography==44.0.2
- dukedsclient==4.0.0
- exceptiongroup==1.2.2
- future==1.0.0
- idna==3.10
- iniconfig==2.1.0
- isodate==0.7.2
- mock==5.2.0
- msal==1.32.0
- msal-extensions==1.3.1
- msgraph-core==0.2.2
- packaging==24.2
- pluggy==1.5.0
- pycparser==2.22
- pyjwt==2.10.1
- pytest==8.3.5
- pytz==2025.2
- pyyaml==6.0.2
- requests==2.32.3
- six==1.17.0
- tabulate==0.9.0
- tenacity==6.2.0
- tomli==2.2.1
- typing-extensions==4.13.0
- urllib3==2.3.0
prefix: /opt/conda/envs/bespin-cli
|
[
"bespin/test_commands.py::JobFileTestCase::test_create_user_job_order_json",
"bespin/test_commands.py::JobOrderPlaceholderCheckTestCase::test_walk",
"bespin/test_commands.py::JobOrderFormatFilesTestCase::test_walk",
"bespin/test_commands.py::JobOrderFileDetailsTestCase::test_walk"
] |
[
"bespin/test_commands.py::JobFileTestCase::test_yaml_str"
] |
[
"bespin/test_commands.py::CommandsTestCase::test_cancel_job",
"bespin/test_commands.py::CommandsTestCase::test_create_job",
"bespin/test_commands.py::CommandsTestCase::test_delete_job",
"bespin/test_commands.py::CommandsTestCase::test_init_job",
"bespin/test_commands.py::CommandsTestCase::test_jobs_list",
"bespin/test_commands.py::CommandsTestCase::test_restart_job",
"bespin/test_commands.py::CommandsTestCase::test_start_job_no_token",
"bespin/test_commands.py::CommandsTestCase::test_start_job_with_token",
"bespin/test_commands.py::CommandsTestCase::test_workflows_list_all_versions",
"bespin/test_commands.py::CommandsTestCase::test_workflows_list_latest_versions",
"bespin/test_commands.py::TableTestCase::test_str",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_get_column_data",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_ignores_workflows_without_versions_when_all",
"bespin/test_commands.py::WorkflowDetailsTestCase::test_ignores_workflows_without_versions_when_latest",
"bespin/test_commands.py::JobFileTestCase::test_create_job",
"bespin/test_commands.py::JobFileTestCase::test_get_dds_files_details",
"bespin/test_commands.py::JobFileLoaderTestCase::test_create_job_file",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_invalid_job_order_params",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_invalid_name_and_fund_code",
"bespin/test_commands.py::JobFileLoaderTestCase::test_validate_job_file_data_ok",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_create_job_file_with_placeholders",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_create_placeholder_value",
"bespin/test_commands.py::JobQuestionnaireTestCase::test_format_user_fields",
"bespin/test_commands.py::JobOrderWalkerTestCase::test_format_file_path",
"bespin/test_commands.py::JobOrderWalkerTestCase::test_walk",
"bespin/test_commands.py::JobsListTestCase::test_column_names",
"bespin/test_commands.py::JobsListTestCase::test_get_column_data",
"bespin/test_commands.py::JobsListTestCase::test_get_elapsed_hours",
"bespin/test_commands.py::JobsListTestCase::test_get_workflow_tag"
] |
[] |
MIT License
| 3,260 |
[
"bespin/commands.py"
] |
[
"bespin/commands.py"
] |
|
keleshev__schema-174
|
f463ab62d4d5078484e97fec071bac6876b9beef
|
2018-10-17 18:37:36
|
f463ab62d4d5078484e97fec071bac6876b9beef
|
codecov-io: # [Codecov](https://codecov.io/gh/keleshev/schema/pull/174?src=pr&el=h1) Report
> Merging [#174](https://codecov.io/gh/keleshev/schema/pull/174?src=pr&el=desc) into [master](https://codecov.io/gh/keleshev/schema/commit/23b729ec91cf12cbaf076e3171b68dd6ed49de0a?src=pr&el=desc) will **increase** coverage by `0.1%`.
> The diff coverage is `100%`.
[](https://codecov.io/gh/keleshev/schema/pull/174?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #174 +/- ##
=========================================
+ Coverage 98.15% 98.26% +0.1%
=========================================
Files 1 1
Lines 217 230 +13
=========================================
+ Hits 213 226 +13
Misses 4 4
```
| [Impacted Files](https://codecov.io/gh/keleshev/schema/pull/174?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [schema.py](https://codecov.io/gh/keleshev/schema/pull/174/diff?src=pr&el=tree#diff-c2NoZW1hLnB5) | `98.26% <100%> (+0.1%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/keleshev/schema/pull/174?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/keleshev/schema/pull/174?src=pr&el=footer). Last update [23b729e...aeb5226](https://codecov.io/gh/keleshev/schema/pull/174?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
skorokithakis: Sorry, can you post a bit of code that illustrates the problem? I'm not sure I got it from the description...
julienduchesne: Oh sorry, it's mostly from #106. In short, Or("key", "newkey") in a dict will accept
```{
"key": value",
"newkey": "value"
}```
This PR allows for an exclusive Or. This is useful in a deprecation use case. You want the user to switch to the new key name but you still want to support the old one. However, setting both can cause issues so it should be rejected.
julienduchesne: Oh sorry, it's mostly from #106. In short, Or("key", "newkey") in a dict will accept
```{
"key": value",
"newkey": "value"
}```
This PR allows for an exclusive Or. This is useful in a deprecation use case. You want the user to switch to the new key name but you still want to support the old one. However, setting both can cause issues so it should be rejected.
julienduchesne: Oh sorry, it's mostly from #106. In short, Or("key", "newkey") in a dict will accept
```{
"key": value",
"newkey": "value"
}```
This PR allows for an exclusive Or. This is useful in a deprecation use case. You want the user to switch to the new key name but you still want to support the old one. However, setting both can cause issues so it should be rejected.
julienduchesne: Oh sorry, it's mostly from #106. In short, Or("key", "newkey") in a dict will accept
```{
"key": value",
"newkey": "value"
}```
This PR allows for an exclusive Or. This is useful in a deprecation use case. You want the user to switch to the new key name but you still want to support the old one. However, setting both can cause issues so it should be rejected.
julienduchesne: Oh sorry, it's mostly from #106. In short, Or("key", "newkey") in a dict will accept
```{
"key": value",
"newkey": "value"
}```
This PR allows for an exclusive Or. This is useful in a deprecation use case. You want the user to switch to the new key name but you still want to support the old one. However, setting both can cause issues so it should be rejected.
skorokithakis: Oh sorry, I see what you mean. I thought your comment was the motivation for this PR, but I now realize it's a comment on the implementation. From a first look, this looks good, I will review in more depth soon!
skorokithakis: Github is having some trouble, I saw your comment posted ten times, I tried to delete a few but they went away again. I'll return later when Github is feeling better.
skorokithakis: Also, can you remove the [WIP] if this is good to merge?
julienduchesne: Github did not trigger travis but it should be ready now
skorokithakis: Hmm, I can't access the online conflict resolution UI either... I just merged your other PR, but it conflicts with this one, can you resolve so I can merge this too?
|
diff --git a/README.rst b/README.rst
index 0d1855c..28186f8 100644
--- a/README.rst
+++ b/README.rst
@@ -298,6 +298,18 @@ for the same data:
>>> Schema(And(Or(int, float), lambda x: x > 0)).validate(3.1415)
3.1415
+In a dictionary, you can also combine two keys in a "one or the other" manner. To do
+so, use the `Or` class as a key:
+
+.. code:: python
+ from schema import Or, Schema
+ schema = Schema({
+ Or("key1", "key2", only_one=True): str
+ })
+
+ schema.validate({"key1": "test"}) # Ok
+ schema.validate({"key1": "test", "key2": "test"}) # SchemaWrongKeyError
+
Hooks
~~~~~~~~~~
You can define hooks which are functions that are executed whenever a valid key:value is found.
diff --git a/schema.py b/schema.py
index 03e6909..cfae8b9 100644
--- a/schema.py
+++ b/schema.py
@@ -71,6 +71,7 @@ class And(object):
"""
Utility function to combine validation directives in AND Boolean fashion.
"""
+
def __init__(self, *args, **kw):
self._args = args
if not set(kw).issubset({'error', 'schema', 'ignore_extra_keys'}):
@@ -102,6 +103,15 @@ class And(object):
class Or(And):
"""Utility function to combine validation directives in a OR Boolean
fashion."""
+
+ def __init__(self, *args, **kwargs):
+ self.only_one = kwargs.pop('only_one', False)
+ self.reset()
+ super(Or, self).__init__(*args, **kwargs)
+
+ def reset(self):
+ self.got_one = False
+
def validate(self, data):
"""
Validate data using sub defined schema/expressions ensuring at least
@@ -114,7 +124,11 @@ class Or(And):
ignore_extra_keys=self._ignore_extra_keys)
for s in self._args]:
try:
- return s.validate(data)
+ validation = s.validate(data)
+ if self.got_one and self.only_one:
+ break
+ self.got_one = True
+ return validation
except SchemaError as _x:
autos, errors = _x.autos, _x.errors
raise SchemaError(['%r did not validate %r' % (self, data)] + autos,
@@ -170,6 +184,7 @@ class Use(object):
For more general use cases, you can use the Use class to transform
the data while it is being validate.
"""
+
def __init__(self, callable_, error=None):
if not callable(callable_):
raise TypeError('Expected a callable, not %r' % callable_)
@@ -217,6 +232,7 @@ class Schema(object):
Entry point of the library, use this class to instantiate validation
schema for the data that will be validated.
"""
+
def __init__(self, schema, error=None, ignore_extra_keys=False):
self._schema = schema
self._error = error
@@ -266,6 +282,10 @@ class Schema(object):
coverage = set() # matched schema keys
# for each key and value find a schema entry matching them, if any
sorted_skeys = sorted(s, key=self._dict_key_priority)
+ for skey in sorted_skeys:
+ if isinstance(skey, Or):
+ skey.reset()
+
for key, value in data.items():
for skey in sorted_skeys:
svalue = s[skey]
|
XOr implementation
First of all, this library is awesome.
I've implemented a `XOr` class for exclusive schemas (shamelessly copying from the `Or` class). Maybe this is naively wrong, but so far this has worked as expected.
``` python
class XOr(And):
def validate(self, data):
accepted = False
x = SchemaError([], [])
for s in [Schema(s, error=self._error) for s in self._args]:
try:
validated = s.validate(data)
if accepted:
raise SchemaError(['%r did not validate %r' % (self, data)],
[self._error])
accepted = True
except SchemaError as _x:
x = _x
if not accepted:
raise SchemaError(['%r did not validate %r' % (self, data)] + x.autos,
[self._error] + x.errors)
return validated
```
If you are interested in this, I can open a PR.
|
keleshev/schema
|
diff --git a/test_schema.py b/test_schema.py
index 553e841..e230ba1 100644
--- a/test_schema.py
+++ b/test_schema.py
@@ -81,6 +81,16 @@ def test_or():
with SE: Or().validate(2)
+def test_or_only_one():
+ schema = Schema({
+ Or("test1", "test2", only_one=True): str
+ })
+ assert schema.validate({"test1": "value"})
+ assert schema.validate({"test2": "other_value"})
+ with SE: schema.validate({"test1": "value", "test2": "other_value"})
+ with SE: schema.validate({"othertest": "value"})
+
+
def test_test():
def unique_list(_list):
return len(_list) == len(set(_list))
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 2
}
|
0.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"mock"
],
"pre_install": null,
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
-e git+https://github.com/keleshev/schema.git@f463ab62d4d5078484e97fec071bac6876b9beef#egg=schema
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: schema
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- mock==5.2.0
prefix: /opt/conda/envs/schema
|
[
"test_schema.py::test_or_only_one"
] |
[] |
[
"test_schema.py::test_schema",
"test_schema.py::test_validate_file",
"test_schema.py::test_and",
"test_schema.py::test_or",
"test_schema.py::test_test",
"test_schema.py::test_regex",
"test_schema.py::test_validate_list",
"test_schema.py::test_list_tuple_set_frozenset",
"test_schema.py::test_strictly",
"test_schema.py::test_dict",
"test_schema.py::test_dict_keys",
"test_schema.py::test_ignore_extra_keys",
"test_schema.py::test_ignore_extra_keys_validation_and_return_keys",
"test_schema.py::test_dict_forbidden_keys",
"test_schema.py::test_dict_hook",
"test_schema.py::test_dict_optional_keys",
"test_schema.py::test_dict_optional_defaults",
"test_schema.py::test_dict_subtypes",
"test_schema.py::test_dict_key_error",
"test_schema.py::test_complex",
"test_schema.py::test_nice_errors",
"test_schema.py::test_use_error_handling",
"test_schema.py::test_or_error_handling",
"test_schema.py::test_and_error_handling",
"test_schema.py::test_schema_error_handling",
"test_schema.py::test_use_json",
"test_schema.py::test_error_reporting",
"test_schema.py::test_schema_repr",
"test_schema.py::test_validate_object",
"test_schema.py::test_issue_9_prioritized_key_comparison",
"test_schema.py::test_issue_9_prioritized_key_comparison_in_dicts",
"test_schema.py::test_missing_keys_exception_with_non_str_dict_keys",
"test_schema.py::test_issue_56_cant_rely_on_callables_to_have_name",
"test_schema.py::test_exception_handling_with_bad_validators",
"test_schema.py::test_issue_83_iterable_validation_return_type",
"test_schema.py::test_optional_key_convert_failed_randomly_while_with_another_optional_object",
"test_schema.py::test_copy",
"test_schema.py::test_inheritance"
] |
[] |
MIT License
| 3,261 |
[
"README.rst",
"schema.py"
] |
[
"README.rst",
"schema.py"
] |
destag__at-date-17
|
3957d0b750ef1205adb0ba2fc3dccf34c3f0ce62
|
2018-10-17 19:42:01
|
3957d0b750ef1205adb0ba2fc3dccf34c3f0ce62
|
codecov[bot]: # [Codecov](https://codecov.io/gh/destag/at-date/pull/17?src=pr&el=h1) Report
> Merging [#17](https://codecov.io/gh/destag/at-date/pull/17?src=pr&el=desc) into [master](https://codecov.io/gh/destag/at-date/commit/3957d0b750ef1205adb0ba2fc3dccf34c3f0ce62?src=pr&el=desc) will **increase** coverage by `0.03%`.
> The diff coverage is `100%`.
[](https://codecov.io/gh/destag/at-date/pull/17?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #17 +/- ##
==========================================
+ Coverage 99.21% 99.25% +0.03%
==========================================
Files 3 3
Lines 128 134 +6
==========================================
+ Hits 127 133 +6
Misses 1 1
```
| [Impacted Files](https://codecov.io/gh/destag/at-date/pull/17?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [atdate/atdate\_format.py](https://codecov.io/gh/destag/at-date/pull/17/diff?src=pr&el=tree#diff-YXRkYXRlL2F0ZGF0ZV9mb3JtYXQucHk=) | `100% <ø> (ø)` | :arrow_up: |
| [atdate/api.py](https://codecov.io/gh/destag/at-date/pull/17/diff?src=pr&el=tree#diff-YXRkYXRlL2FwaS5weQ==) | `99.21% <100%> (+0.03%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/destag/at-date/pull/17?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/destag/at-date/pull/17?src=pr&el=footer). Last update [3957d0b...4c68f85](https://codecov.io/gh/destag/at-date/pull/17?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
andrzej3393: I fixed it :slightly_smiling_face: Also, added some docs, but I'm not sure if they're enough.
|
diff --git a/atdate/api.py b/atdate/api.py
index b42b2ac..7f1af8e 100644
--- a/atdate/api.py
+++ b/atdate/api.py
@@ -15,7 +15,9 @@ class AtDateParser:
tree = self.parser.parse(string_to_parse.lower())
new_tree = transformer.transform(tree)
- next_time_run = new_tree if isinstance(new_tree, datetime) else new_tree.children[-1]
+ next_time_run = new_tree
+ while not isinstance(next_time_run, datetime):
+ next_time_run = next_time_run.children[-1]
if next_time_run < transformer.now:
raise ValueError
@@ -65,7 +67,7 @@ class AtDateTransformer(Transformer):
self.datetime_params['second'] = 0
return datetime(**self.datetime_params)
- def _hr24clock_hour_minute(self, matches):
+ def _iso_time(self, matches):
hour = int(matches[0])
minute = int(matches[1])
next_day = self._check_if_next_day(hour, minute)
@@ -152,6 +154,13 @@ class AtDateTransformer(Transformer):
self.datetime_params['year'] = year
return datetime(**self.datetime_params)
+ def _iso_date(self, matches):
+ year, month, day = map(int, matches)
+ self.datetime_params['day'] = day
+ self.datetime_params['month'] = month
+ self.datetime_params['year'] = year
+ return datetime(**self.datetime_params)
+
def _next(self, matches):
inc_period = matches[0] if matches[0].endswith('s') else matches[0] + 's'
dt = datetime(**self.datetime_params)
diff --git a/atdate/atdate_format.py b/atdate/atdate_format.py
index 42e910b..f163137 100644
--- a/atdate/atdate_format.py
+++ b/atdate/atdate_format.py
@@ -3,25 +3,30 @@ format_string = r'''
| time date
| time increment
| time date increment
+ | date time
+ | isodate "t" isotime
| date
| date increment
| nowspec
| nowspec increment
| increment
-time: HR24CLOCK_HR_MIN -> _hr24clock_hr_min
- | HR24CLOCK_HOUR ":" MINUTE -> _hr24clock_hour_minute
- | WALLCLOCK_HR_MIN AM_PM -> _wallclock_hr_min_am_pm
- | WALLCLOCK_HOUR ":" MINUTE AM_PM -> _wallclock_hour_minute_am_pm
- | "noon" -> _noon
- | "midnight" -> _midnight
-date: MONTH_NAME DAY_NUMBER -> _month_name_day_number
- | MONTH_NUMBER "/" DAY_NUMBER -> _month_number_day_number
- | MONTH_NUMBER "/" DAY_NUMBER "/" YEAR_NUMBER -> _month_number_day_number_year_number
- | DAY_NUMBER "." MONTH_NUMBER -> _day_number_month_number
- | DAY_NUMBER "." MONTH_NUMBER "." YEAR_NUMBER -> _day_number_month_number_year_number
-increment: "next" INC_PERIOD -> _next
- | "+" INT INC_PERIOD -> _inc_number
-nowspec: "now" -> _now
+time: HR24CLOCK_HR_MIN -> _hr24clock_hr_min
+ | WALLCLOCK_HR_MIN AM_PM -> _wallclock_hr_min_am_pm
+ | WALLCLOCK_HOUR ":" MINUTE AM_PM -> _wallclock_hour_minute_am_pm
+ | "noon" -> _noon
+ | "midnight" -> _midnight
+ | isotime
+date: MONTH_NAME DAY_NUMBER -> _month_name_day_number
+ | MONTH_NUMBER "/" DAY_NUMBER -> _month_number_day_number
+ | MONTH_NUMBER "/" DAY_NUMBER "/" YEAR_NUMBER -> _month_number_day_number_year_number
+ | DAY_NUMBER "." MONTH_NUMBER -> _day_number_month_number
+ | DAY_NUMBER "." MONTH_NUMBER "." YEAR_NUMBER -> _day_number_month_number_year_number
+ | isodate
+isodate: YEAR_NUMBER "-" MONTH_NUMBER "-" DAY_NUMBER -> _iso_date
+isotime: HR24CLOCK_HOUR ":" MINUTE -> _iso_time
+increment: "next" INC_PERIOD -> _next
+ | "+" INT INC_PERIOD -> _inc_number
+nowspec: "now" -> _now
INC_PERIOD: "minutes" | "minute"
| "hours" | "hour"
| "days" | "day"
diff --git a/docs/README.md b/docs/README.md
index b33fdbd..ab82ea5 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -98,15 +98,18 @@ tokens|example
[time] [increment]|17:32 next day
[time] [date] [increment]|17:32 11/22/2033 next day
[date]|11/22/2033
+[date] [time]|11/22/2033 17:32
[date] [increment]|11/22/2033 next month
[now]|now
[now] [increment]|now next day
[increment]|next month
+[isodatetime]|2033-11-22T17:32
[time]: #time
[date]: #date
[increment]: #increment
[now]: #now
+[isodatetime]: #isodatetime
### At date tokens
@@ -135,6 +138,7 @@ format|example
\[1-12\] / \[1-31\] / \[0-9999\]|10/27/2006
\[1-12\] . \[1-31\]|10.27
\[1-12\] . \[1-31\] . \[0-9999\]|10.27.2006
+\[0-9999\] - \[1-12\] - \[1-31\]|2006-10-27
#### increment
@@ -145,6 +149,14 @@ format|example
next \[[period](#period)\]|next month
\+ \[0-9999\] \[[period](#period)\]|\+ 12 minutes
+#### isodatetime
+
+Format for ISO 8601 date time.
+
+format|example
+---|---
+\[0-9999\] - \[1-12\] - \[1-31\] T \[0-23\] : \[0-59\]|2033-11-22T17:32
+
#### now
Format for this token is literally `now`.
|
ISO 8601 compatibility
I think that it would be nice to support dates and times in ISO 8601 format.
|
destag/at-date
|
diff --git a/test/test_atdate.py b/test/test_atdate.py
index fdbf0ce..8c23f7c 100644
--- a/test/test_atdate.py
+++ b/test/test_atdate.py
@@ -220,3 +220,31 @@ def test_plus_one_day_without_now():
test_string = '+1days'
result = atdate.parse(test_string)
assert result == datetime(2000, 7, 3, 3, 4, 5, 0)
+
+
+@freeze_time('2000-07-02 03:04:05')
+def test_isodate():
+ test_string = '2011-09-22'
+ result = atdate.parse(test_string)
+ assert result == datetime(2011, 9, 22, 3, 4, 5, 0)
+
+
+@freeze_time('2000-07-02 03:04:05')
+def test_time_date():
+ test_string = "12:24 01.02.2011"
+ result = atdate.parse(test_string)
+ assert result == datetime(2011, 2, 1, 12, 24, 0, 0)
+
+
+@freeze_time('2000-07-02 03:04:05')
+def test_isodatetime():
+ test_string = '2011-09-22T11:44'
+ result = atdate.parse(test_string)
+ assert result == datetime(2011, 9, 22, 11, 44, 0, 0)
+
+
+@freeze_time('2000-07-02 03:04:05')
+def test_isodatetime_without_t():
+ test_string = '2011-09-22 11:44'
+ result = atdate.parse(test_string)
+ assert result == datetime(2011, 9, 22, 11, 44, 0, 0)
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 1
},
"num_modified_files": 3
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"freezegun"
],
"pre_install": [
"pip install pipenv"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/destag/at-date.git@3957d0b750ef1205adb0ba2fc3dccf34c3f0ce62#egg=atdate
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
distlib==0.3.9
filelock==3.4.1
freezegun==1.2.2
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
lark-parser==0.12.0
packaging==21.3
pipenv==2022.4.8
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
virtualenv==20.17.1
virtualenv-clone==0.5.7
zipp==3.6.0
|
name: at-date
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- distlib==0.3.9
- filelock==3.4.1
- freezegun==1.2.2
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- lark-parser==0.12.0
- packaging==21.3
- pipenv==2022.4.8
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- python-dateutil==2.9.0.post0
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- virtualenv==20.17.1
- virtualenv-clone==0.5.7
- zipp==3.6.0
prefix: /opt/conda/envs/at-date
|
[
"test/test_atdate.py::test_isodate",
"test/test_atdate.py::test_isodatetime",
"test/test_atdate.py::test_isodatetime_without_t"
] |
[] |
[
"test/test_atdate.py::test_at_date_has_parse_attribute",
"test/test_atdate.py::test_at_date_has_atdateparser_attribute",
"test/test_atdate.py::test_parse_return_datetime_object",
"test/test_atdate.py::test_at_noon_before_noon",
"test/test_atdate.py::test_at_noon_after_noon",
"test/test_atdate.py::test_at_noon_month_change",
"test/test_atdate.py::test_at_noon_year_change",
"test/test_atdate.py::test_at_midnight",
"test/test_atdate.py::test_at_midnight_month_change",
"test/test_atdate.py::test_at_midnight_year_change",
"test/test_atdate.py::test_at_now",
"test/test_atdate.py::test_at_now_next_minute_change_minute",
"test/test_atdate.py::test_at_now_next_minutes",
"test/test_atdate.py::test_at_now_next_minute_change_hour",
"test/test_atdate.py::test_at_now_next_minute_change_day",
"test/test_atdate.py::test_at_now_next_hour",
"test/test_atdate.py::test_at_now_next_day",
"test/test_atdate.py::test_at_now_next_week",
"test/test_atdate.py::test_at_now_next_month",
"test/test_atdate.py::test_at_now_next_year",
"test/test_atdate.py::test_month_number_day_number",
"test/test_atdate.py::test_month_name_day_number",
"test/test_atdate.py::test_month_number_day_number_year_number",
"test/test_atdate.py::test_day_number_month_number",
"test/test_atdate.py::test_day_number_month_number_year_number",
"test/test_atdate.py::test_inc_period",
"test/test_atdate.py::test_hr24clock_hr_min",
"test/test_atdate.py::test_hr24clock_hour_minute",
"test/test_atdate.py::test_wallclock_hr_min_am_pm",
"test/test_atdate.py::test_wallclock_hour_minute_am_pm",
"test/test_atdate.py::test_next_month_without_now",
"test/test_atdate.py::test_plus_one_day_without_now",
"test/test_atdate.py::test_time_date"
] |
[] |
MIT License
| 3,263 |
[
"docs/README.md",
"atdate/api.py",
"atdate/atdate_format.py"
] |
[
"docs/README.md",
"atdate/api.py",
"atdate/atdate_format.py"
] |
hynek__pem-34
|
9f3bc654d17503a18ace83329f4724a4c0271e10
|
2018-10-18 11:14:53
|
9f3bc654d17503a18ace83329f4724a4c0271e10
|
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 4735f42..779f442 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -26,7 +26,7 @@ Deprecations:
Changes:
^^^^^^^^
-*none*
+- You can now load encrypted PKCS#8 PEM key as ``pem.Key``.
----
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index dcabac2..57802b5 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -18,6 +18,8 @@ Workflow
Whether you prefer to rebase on master or merge master into your branch, do whatever is more comfortable for you.
- *Always* add tests and docs for your code.
This is a hard rule; patches with missing tests or documentation can't be merged.
+- Consider updating CHANGELOG.rst to reflect the changes as observed by people
+ using this library.
- Make sure your changes pass our CI_.
You won't get any feedback until it's green unless you ask for it.
- Once you've addressed review feedback, make sure to bump the pull request with a short note, so we know you're done.
diff --git a/setup.cfg b/setup.cfg
index b0a9418..8aac42a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -24,4 +24,4 @@ multi_line_output=3
not_skip=__init__.py
known_first_party=pem
-known_third_party=OpenSSL,certifi,pem,pretend,pytest,setuptools,sphinx_rtd_theme,twisted
+known_third_party=OpenSSL,certifi,pem,pretend,pytest,setuptools,sphinx_rtd_theme,twisted,typing
diff --git a/src/pem/_core.py b/src/pem/_core.py
index 0acdce6..b3998d3 100644
--- a/src/pem/_core.py
+++ b/src/pem/_core.py
@@ -141,6 +141,7 @@ class DHParameters(AbstractPEMObject):
_PEM_TO_CLASS = {
b"CERTIFICATE": Certificate,
b"PRIVATE KEY": Key,
+ b"ENCRYPTED PRIVATE KEY": Key,
b"RSA PRIVATE KEY": RSAPrivateKey,
b"DH PARAMETERS": DHParameters,
b"NEW CERTIFICATE REQUEST": CertificateRequest,
|
Add support for PCKS#8 encrypted `BEGIN ENCRYPTED PRIVATE KEY`
It looks like for now only `RSA PRIVATE KEY` is supported.
OpenSSL docs https://www.openssl.org/docs/man1.0.2/apps/openssl-pkcs8.html
A comparison
https://github.com/kjur/jsrsasign/wiki/Tutorial-for-PKCS5-and-PKCS8-PEM-private-key-formats-differences
--------
I will try to add a patch, but for now I have created this issue for reference
|
hynek/pem
|
diff --git a/tests/data.py b/tests/data.py
index 81f9b0f..5c82cc2 100644
--- a/tests/data.py
+++ b/tests/data.py
@@ -54,6 +54,75 @@ kjBF/mzooA==
-----END RSA PRIVATE KEY-----
"""
+# KEY_PEM_PKCS8_* and KEY_PEM_PKCS5_* contain the same private key, but in
+# different formats.
+
+# PKCS#5 RSA unencrypted.
+# Generated with:
+# openssl genrsa -out private.pem 512
+KEY_PEM_PKCS5_UNENCRYPTED = b"""-----BEGIN RSA PRIVATE KEY-----
+MIIBOwIBAAJBAKX6cRhPHvdyoftEHGiRje3tTLRDnddg01AvgsJJcCFoIjwdgfa9
+aKFdzCcgD/htjvfRZl24M7E89sMUBMNHk8ECAwEAAQJABcBi8OO1AAAh6tIWZe09
+TNRfRxPcwVzilbG/xznCP/YMf72E8hsZazu+HGMKITg9dFeJOyjXZ4e8sD/pL/I6
+0QIhANzULu4JjJxpoTK8NnF/CemF7neLROA18NDB/mao5ZZtAiEAwGnYobinxuHS
+UQh8cT3w7aLsVlarZmCtoapxjW+ObiUCIQCcAltVV/G63vU/PrDH5hQ+opwiYIW8
+UN9c3HC6XkA00QIhAJ8YpfwKgAfNfyZrmuHTspv7Q+mb3jtXoxnyodOtsxpVAiBC
+a4FDqkr+bDwV4SwaGdG/AC40fR3P8hhOADAhtFDwlw==
+-----END RSA PRIVATE KEY-----
+"""
+
+# PKCS#5 RSA encrypted with `test` as password.
+# Generated with:
+# openssl genrsa -des3 -out private.pem 512
+KEY_PEM_PKCS5_ENCRYPTED = b"""-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: DES-EDE3-CBC,8A72BD2DC1C9092F
+
+6LgvCNeXdcuTayEOKhQo2N4IveCP0S3t8xJCeihW9yizLeQFzSjqSfKtmRyImjfg
+fMl8IMDFozR+xVE9uWaIo98wKWpjyu6cytYyjL/8SP3jswBoSP5P9OekUSLifPWM
+ghUEu6tGissqSs/8i2wzLIdho3DdUnUMPZIprENmK6HrYmdRtJT3qMgkFTCtCS9Q
+r9oPm7xKPsfKBhaUHK51JcsPkPjrny8Dl56W0IYf/dfvRPwSr5yFQFLk6Nbgnx0N
+32aT3ZMRCEvOTxhX1cO3f5JqYLxFAGKBFwvsulTisJ6rGYOEDSMBDwZc3sqLvt5g
+h0vKRPqSkylQ0W5shNg0bwbxySiRxJPBL8kWDAbJVfauArabLPuNkUNwmYhIjy7j
+lY0oYw2xeJ9hTUly/Zg3+DI8oYYY3z7WaxPHXEoicCE=
+-----END RSA PRIVATE KEY-----
+"""
+
+# PKCS#8 RSA encrypted with `test` as password.
+# Generated with pkc5 as intermediate file:
+# openssl genrsa -des3 -out private.pem 512
+# openssl pkcs8 -topk8 -in private.pem
+KEY_PEM_PKCS8_ENCRYPTED = b"""-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIIBvTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQIyqwWErm7rlcCAggA
+MAwGCCqGSIb3DQIJBQAwHQYJYIZIAWUDBAEqBBAkVu+KRbmcfWIGKzgnjjBMBIIB
+YI3aRS0ebuzb1Tq26/HAq8pplPu+96dM1SnRNXwH0ijmP3fLBjEDH4hB/X9H8arT
+xWSfKQ80+FKI07DsLQKmO+cuB12MAWPSoCNBRtLwGUiwYvlMcBp6XR4NQQ+YG/Nw
+OgZ1InH2w7uSnDPdxV9dZculYWzJE82IohnFVZokO2nYSEfIqr1xVQZht6lfzpx2
+aRje42fpYfgkEm13w4oJKIlekzA9M4CeYku7Q4l9GDSHRmoeypMSHPI8RFV9pxub
+ME3AMXGcRioJ0Ic/cpmwqFaJbTVRPsqFVEsMCz1T/CQ4oLjPTWg+zkxfsPIyGj7L
+K3yLZmTA6IxSu+wuO/bsbqiM3x718AW6U0FHXd4zk+llu3mUfhTiMYPvN/cedv/M
+wsT85CHM6reIBopGMqeZD965tNEcWPGMEvXXnG71dxxgrfHFv7l/o8+moVRNIQCh
+EArlaXgT3MlI1jb9HoNvVNg=
+-----END ENCRYPTED PRIVATE KEY-----
+"""
+
+# RSA unencrypted
+# Generated with pkc5 as intermediate file:
+# openssl genrsa -des3 -out private.pem 512
+# openssl pkcs8 -topk8 -in private.pem -nocrypt
+KEY_PEM_PKCS8_UNENCRYPTED = b"""-----BEGIN PRIVATE KEY-----
+MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEApfpxGE8e93Kh+0Qc
+aJGN7e1MtEOd12DTUC+CwklwIWgiPB2B9r1ooV3MJyAP+G2O99FmXbgzsTz2wxQE
+w0eTwQIDAQABAkAFwGLw47UAACHq0hZl7T1M1F9HE9zBXOKVsb/HOcI/9gx/vYTy
+GxlrO74cYwohOD10V4k7KNdnh7ywP+kv8jrRAiEA3NQu7gmMnGmhMrw2cX8J6YXu
+d4tE4DXw0MH+Zqjllm0CIQDAadihuKfG4dJRCHxxPfDtouxWVqtmYK2hqnGNb45u
+JQIhAJwCW1VX8bre9T8+sMfmFD6inCJghbxQ31zccLpeQDTRAiEAnxil/AqAB81/
+Jmua4dOym/tD6ZveO1ejGfKh062zGlUCIEJrgUOqSv5sPBXhLBoZ0b8ALjR9Hc/y
+GE4AMCG0UPCX
+-----END PRIVATE KEY-----
+"""
+
+
DH_PEM = b"""-----BEGIN DH PARAMETERS-----
MIICCAKCAgEAj9/hwPNNKlQEANXqFBXViNy9nVpYlqIIHaLhoKdwAFzgYM+9hNSz
FM/k+K5FS5dXrM63Zh9NgTI1M+ZRHJAxM2hhsG8AA333PN+c3exTRGwjQhU16XJg
diff --git a/tests/test_core.py b/tests/test_core.py
index 6e4349f..a9d5f17 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -6,6 +6,8 @@ from itertools import combinations
import certifi
+from OpenSSL import crypto
+
import pem
from pem._compat import text_type
@@ -16,7 +18,10 @@ from .data import (
CERT_PEMS_NO_NEW_LINE,
CRL_PEMS,
DH_PEM,
- KEY_PEM,
+ KEY_PEM_PKCS5_ENCRYPTED,
+ KEY_PEM_PKCS5_UNENCRYPTED,
+ KEY_PEM_PKCS8_ENCRYPTED,
+ KEY_PEM_PKCS8_UNENCRYPTED,
)
@@ -339,15 +344,76 @@ class TestPEMObjects(object):
class TestParse(object):
- def test_key(self):
+ """
+ Tests for parsing input with one or multiple PEM objects.
+ """
+
+ def test_key_pkcs5_unencrypted(self):
"""
- Parses a PEM string with a key into an RSAPrivateKey.
+ It can load an unencrypted PKCS#5 RSA key as PEM string
+ as an RSAPrivateKey.
"""
- rv = pem.parse(KEY_PEM)
+ rv = pem.parse(KEY_PEM_PKCS5_UNENCRYPTED)
key, = rv
assert isinstance(key, pem.RSAPrivateKey)
- assert KEY_PEM == key.as_bytes()
+ assert KEY_PEM_PKCS5_UNENCRYPTED == key.as_bytes()
+
+ crypto_key = crypto.load_privatekey(
+ crypto.FILETYPE_PEM, key.as_bytes()
+ )
+ assert crypto.TYPE_RSA, crypto_key.type()
+ assert 512, crypto_key.bits()
+
+ def test_key_pkcs5_encrypted(self):
+ """
+ It can load an encrypted PKCS#5 RSA key as PEM string
+ as an RSAPrivateKey.
+ """
+ rv = pem.parse(KEY_PEM_PKCS5_ENCRYPTED)
+ key, = rv
+
+ assert isinstance(key, pem.RSAPrivateKey)
+ assert KEY_PEM_PKCS5_ENCRYPTED == key.as_bytes()
+
+ crypto_key = crypto.load_privatekey(
+ crypto.FILETYPE_PEM, key.as_bytes(), b"test"
+ )
+ assert crypto.TYPE_RSA, crypto_key.type()
+ assert 512, crypto_key.bits()
+
+ def test_key_pkcs8_unencrypted(self):
+ """
+ It can load an unencrypted PKCS#8 RSA key as PEM string
+ as an RSAPrivateKey.
+ """
+ rv = pem.parse(KEY_PEM_PKCS8_UNENCRYPTED)
+ key, = rv
+
+ assert isinstance(key, pem.Key)
+ assert KEY_PEM_PKCS8_UNENCRYPTED == key.as_bytes()
+
+ crypto_key = crypto.load_privatekey(
+ crypto.FILETYPE_PEM, key.as_bytes()
+ )
+ assert crypto.TYPE_RSA, crypto_key.type()
+ assert 512, crypto_key.bits()
+
+ def test_key_pkcs8_encrypted(self):
+ """
+ It can load an encrypted PKCS#8 RSA key as PEM string
+ as an RSAPrivateKey.
+ """
+ rv = pem.parse(KEY_PEM_PKCS8_ENCRYPTED)
+ key, = rv
+
+ assert isinstance(key, pem.Key)
+ assert KEY_PEM_PKCS8_ENCRYPTED == key.as_bytes()
+
+ crypto_key = crypto.load_privatekey(
+ crypto.FILETYPE_PEM, key.as_bytes(), b"test"
+ )
+ assert crypto.TYPE_RSA, crypto_key
def test_certificates(self):
"""
@@ -423,7 +489,7 @@ class TestParse(object):
"""
\n and \r\n are treated equal.
"""
- lf_pem = KEY_PEM.replace(b"\n", b"\r\n")
+ lf_pem = KEY_PEM_PKCS5_UNENCRYPTED.replace(b"\n", b"\r\n")
rv, = pem.parse(lf_pem)
assert rv.as_bytes() == lf_pem
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 1
},
"num_modified_files": 4
}
|
18.2
|
{
"env_vars": null,
"env_yml_path": [],
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest"
],
"pre_install": [],
"python": "3.6",
"reqs_path": [],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
Automat==22.10.0
Babel==2.11.0
certifi==2021.5.30
cffi==1.15.1
cfgv==3.3.1
charset-normalizer==2.0.12
constantly==15.1.0
coverage==6.2
cryptography==40.0.2
distlib==0.3.9
docutils==0.18.1
filelock==3.4.1
hyperlink==21.0.0
identify==2.4.4
idna==3.10
imagesize==1.4.1
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
importlib-resources==5.2.3
incremental==22.10.0
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.0.3
MarkupSafe==2.0.1
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nodeenv==1.6.0
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
-e git+https://github.com/hynek/pem.git@9f3bc654d17503a18ace83329f4724a4c0271e10#egg=pem
platformdirs==2.4.0
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
pre-commit==2.17.0
pretend==1.0.9
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycparser==2.21
Pygments==2.14.0
pyOpenSSL==23.2.0
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
pytz==2025.2
PyYAML==6.0.1
requests==2.27.1
service-identity==21.1.0
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
Twisted==22.4.0
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
urllib3==1.26.20
virtualenv==20.16.2
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
zope.interface==5.5.2
|
name: pem
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- automat==22.10.0
- babel==2.11.0
- cffi==1.15.1
- cfgv==3.3.1
- charset-normalizer==2.0.12
- constantly==15.1.0
- coverage==6.2
- cryptography==40.0.2
- distlib==0.3.9
- docutils==0.18.1
- filelock==3.4.1
- hyperlink==21.0.0
- identify==2.4.4
- idna==3.10
- imagesize==1.4.1
- importlib-resources==5.2.3
- incremental==22.10.0
- jinja2==3.0.3
- markupsafe==2.0.1
- nodeenv==1.6.0
- platformdirs==2.4.0
- pre-commit==2.17.0
- pretend==1.0.9
- pyasn1==0.5.1
- pyasn1-modules==0.3.0
- pycparser==2.21
- pygments==2.14.0
- pyopenssl==23.2.0
- pytz==2025.2
- pyyaml==6.0.1
- requests==2.27.1
- service-identity==21.1.0
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==5.3.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- twisted==22.4.0
- urllib3==1.26.20
- virtualenv==20.16.2
- zope-interface==5.5.2
prefix: /opt/conda/envs/pem
|
[
"tests/test_core.py::TestParse::test_key_pkcs8_encrypted"
] |
[] |
[
"tests/test_core.py::TestPEMObjects::test_cert_has_correct_repr",
"tests/test_core.py::TestPEMObjects::test_cert_has_correct_str",
"tests/test_core.py::TestPEMObjects::test_cert_req_has_correct_repr",
"tests/test_core.py::TestPEMObjects::test_sha1_hexdigest",
"tests/test_core.py::TestPEMObjects::test_as_text",
"tests/test_core.py::TestPEMObjects::test_cert_req_has_correct_str",
"tests/test_core.py::TestPEMObjects::test_key_has_correct_repr",
"tests/test_core.py::TestPEMObjects::test_key_has_correct_str",
"tests/test_core.py::TestPEMObjects::test_rsa_key_has_correct_repr",
"tests/test_core.py::TestPEMObjects::test_rsa_key_has_correct_str",
"tests/test_core.py::TestPEMObjects::test_dh_params_has_correct_repr",
"tests/test_core.py::TestPEMObjects::test_dh_params_has_correct_str",
"tests/test_core.py::TestPEMObjects::test_crl_has_correct_repr",
"tests/test_core.py::TestPEMObjects::test_crl_has_correct_str",
"tests/test_core.py::TestPEMObjects::test_certificate_unicode",
"tests/test_core.py::TestPEMObjects::test_certificate_request_unicode",
"tests/test_core.py::TestPEMObjects::test_key_unicode",
"tests/test_core.py::TestPEMObjects::test_rsa_key_unicode",
"tests/test_core.py::TestPEMObjects::test_dhparams_unicode_deprecated",
"tests/test_core.py::TestPEMObjects::test_crl_unicode",
"tests/test_core.py::TestPEMObjects::test_certs_equal",
"tests/test_core.py::TestPEMObjects::test_cert_reqs_equal",
"tests/test_core.py::TestPEMObjects::test_keys_equal",
"tests/test_core.py::TestPEMObjects::test_rsa_keys_equal",
"tests/test_core.py::TestPEMObjects::test_dh_params_equal",
"tests/test_core.py::TestPEMObjects::test_crl_equal",
"tests/test_core.py::TestPEMObjects::test_cert_contents_unequal",
"tests/test_core.py::TestPEMObjects::test_cert_req_contents_unequal",
"tests/test_core.py::TestPEMObjects::test_crl_unequal",
"tests/test_core.py::TestPEMObjects::test_different_objects_unequal",
"tests/test_core.py::TestPEMObjects::test_incompatible_types",
"tests/test_core.py::TestParse::test_key_pkcs5_unencrypted",
"tests/test_core.py::TestParse::test_key_pkcs5_encrypted",
"tests/test_core.py::TestParse::test_key_pkcs8_unencrypted",
"tests/test_core.py::TestParse::test_certificates",
"tests/test_core.py::TestParse::test_certificate_no_new_line",
"tests/test_core.py::TestParse::test_certificates_no_new_line",
"tests/test_core.py::TestParse::test_dh",
"tests/test_core.py::TestParse::test_crl",
"tests/test_core.py::TestParse::test_file",
"tests/test_core.py::TestParse::test_loads_certifi",
"tests/test_core.py::TestParse::test_allows_lf"
] |
[] |
MIT License
| 3,264 |
[
"CHANGELOG.rst",
"CONTRIBUTING.rst",
"src/pem/_core.py",
"setup.cfg"
] |
[
"CHANGELOG.rst",
"CONTRIBUTING.rst",
"src/pem/_core.py",
"setup.cfg"
] |
|
mkaz__termgraph-40
|
ca79e57b02f321a2f23c44677014e9e7013c0436
|
2018-10-18 12:05:51
|
ca79e57b02f321a2f23c44677014e9e7013c0436
|
diff --git a/setup.py b/setup.py
index 7b9e577..389e794 100644
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@ setup(
name='termgraph',
packages=['termgraph'],
entry_points={'console_scripts': ['termgraph=termgraph.termgraph:main']},
- version='0.1.4',
+ version='0.1.5',
author="mkaz",
author_email="[email protected]",
url='https://github.com/mkaz/termgraph',
diff --git a/termgraph/termgraph.py b/termgraph/termgraph.py
index 520a12a..ae3a90e 100755
--- a/termgraph/termgraph.py
+++ b/termgraph/termgraph.py
@@ -13,7 +13,7 @@ from itertools import zip_longest
from colorama import init
-VERSION = '0.1.4'
+VERSION = '0.1.5'
init()
@@ -267,7 +267,8 @@ def stacked_graph(labels, data, normal_data, len_categories, args, colors):
# Hide the labels.
label = ''
else:
- label = "{}: ".format(labels[i])
+ label = "{:<{x}}: ".format(labels[i],
+ x=find_max_label_length(labels))
print(label, end="")
values = data[i]
|
Bad display with --stacked
The display in column doesn't work properly with the --stacked option.
```
Example1: ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 22.00
Longertext example : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 36.00
```
I have to use `column -t -s ':'` to clean it up.
|
mkaz/termgraph
|
diff --git a/tests/test_termgraph.py b/tests/test_termgraph.py
index 441c0a5..aef7b4c 100644
--- a/tests/test_termgraph.py
+++ b/tests/test_termgraph.py
@@ -168,6 +168,24 @@ class TermgraphTest(unittest.TestCase):
output = output.getvalue().strip()
assert output == '2007: [91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇[0m[94m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇[0m 373.84\n2008: [91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇[0m[94m▏[0m 236.23\n2009: [91m▇▇▇[0m[94m▇▇▇▇▇▇▇▇▇▇▇▇[0m 69.53\n2010: [91m▇▇▇▇▇▇▇▇▇▇▇▇[0m[94m▏[0m 57.21\n2011: [91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇[0m[94m▇[0m 519.42\n2012: [91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇[0m[94m▇▇▇▇[0m 232.25\n2014: [91m▇▇▇▇▇▇[0m[94m▇▇▇▇[0m 50.00'
+ def test_stacked_graph_different_label_length_prints_correct_graph(self):
+ with patch('sys.stdout', new=StringIO()) as output:
+ labels = ['LOOOOOOOOOOOOOOOOOOOOOOOOONG LINE', 'SHORT LINE']
+ data = [[10.0, 20.0], [10.0, 20.0]]
+ normal_data = [[10.0, 20.0], [10.0, 20.0]]
+ len_categories = 2
+ args = {'filename': '-', 'title': 'BEAUTIFUL', 'width': 50,
+ 'format': '{:<5.2f}', 'suffix': '',
+ 'no_labels': False, 'color': ['blue', 'red'],
+ 'vertical': False, 'stacked': True,
+ 'different_scale': False, 'calendar': False,
+ 'start_dt': None, 'custom_tick': '', 'delim': '',
+ 'verbose': False, 'version': False}
+ colors = [94, 91]
+ tg.chart(colors, data, args, labels)
+ output = output.getvalue().strip()
+ assert output == 'LOOOOOOOOOOOOOOOOOOOOOOOOONG LINE: \x1b[94m▇▇▇▇▇▇▇▇▇▇\x1b[0m\x1b[91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m 30.00\nSHORT LINE : \x1b[94m▇▇▇▇▇▇▇▇▇▇\x1b[0m\x1b[91m▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇\x1b[0m 30.00'
+
def test_stacked_graph_no_label_prints_no_labels(self):
with patch('sys.stdout', new=StringIO()) as output:
labels = ['2007', '2008', '2009', '2010', '2011', '2012', '2014']
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 2
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
colorama==0.4.6
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
execnet==2.1.1
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
-e git+https://github.com/mkaz/termgraph.git@ca79e57b02f321a2f23c44677014e9e7013c0436#egg=termgraph
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions==4.13.0
|
name: termgraph
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- colorama==0.4.6
- coverage==7.8.0
- execnet==2.1.1
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- typing-extensions==4.13.0
prefix: /opt/conda/envs/termgraph
|
[
"tests/test_termgraph.py::TermgraphTest::test_stacked_graph_different_label_length_prints_correct_graph"
] |
[
"tests/test_termgraph.py::TermgraphTest::test_calendar_heatmap_without_start_date_prints_correctly",
"tests/test_termgraph.py::TermgraphTest::test_init_args"
] |
[
"tests/test_termgraph.py::TermgraphTest::test_calendar_heatmap_color_prints_correctly",
"tests/test_termgraph.py::TermgraphTest::test_calendar_heatmap_custom_tick_prints_correctly",
"tests/test_termgraph.py::TermgraphTest::test_calendar_heatmap_prints_correct_heatmap",
"tests/test_termgraph.py::TermgraphTest::test_chart_multiple_series_different_scale_prints_correctly",
"tests/test_termgraph.py::TermgraphTest::test_chart_multiple_series_no_colors_prints_correctly",
"tests/test_termgraph.py::TermgraphTest::test_chart_multiple_series_prints_correctly",
"tests/test_termgraph.py::TermgraphTest::test_chart_prints_correct_chart",
"tests/test_termgraph.py::TermgraphTest::test_chart_stacked_prints_correctly",
"tests/test_termgraph.py::TermgraphTest::test_check_data_mismatching_color_and_category_count_exits_with_one",
"tests/test_termgraph.py::TermgraphTest::test_check_data_mismatching_data_and_labels_count_exits_with_one",
"tests/test_termgraph.py::TermgraphTest::test_check_data_missing_data_for_categories_count_exits_with_one",
"tests/test_termgraph.py::TermgraphTest::test_check_data_returns_correct_result",
"tests/test_termgraph.py::TermgraphTest::test_check_data_stacked_with_no_color_returns_correct_result",
"tests/test_termgraph.py::TermgraphTest::test_check_data_vertical_multiple_series_same_scale_exits_with_one",
"tests/test_termgraph.py::TermgraphTest::test_check_data_with_color_returns_correct_result",
"tests/test_termgraph.py::TermgraphTest::test_find_max_label_length_returns_correct_length",
"tests/test_termgraph.py::TermgraphTest::test_find_max_returns_highest_value",
"tests/test_termgraph.py::TermgraphTest::test_find_min_returns_lowest_value",
"tests/test_termgraph.py::TermgraphTest::test_horiz_rows_multiple_series_only_has_label_at_beginning",
"tests/test_termgraph.py::TermgraphTest::test_horiz_rows_no_labels_yields_no_labels",
"tests/test_termgraph.py::TermgraphTest::test_horiz_rows_yields_correct_values",
"tests/test_termgraph.py::TermgraphTest::test_main",
"tests/test_termgraph.py::TermgraphTest::test_normalize_returns_correct_results",
"tests/test_termgraph.py::TermgraphTest::test_normalize_with_larger_width_does_not_normalize",
"tests/test_termgraph.py::TermgraphTest::test_normalize_with_negative_datapoint_returns_correct_results",
"tests/test_termgraph.py::TermgraphTest::test_print_categories_prints_correct_categories",
"tests/test_termgraph.py::TermgraphTest::test_print_row_prints_correct_block_count",
"tests/test_termgraph.py::TermgraphTest::test_print_vertical",
"tests/test_termgraph.py::TermgraphTest::test_read_data_returns_correct_results",
"tests/test_termgraph.py::TermgraphTest::test_read_data_verbose",
"tests/test_termgraph.py::TermgraphTest::test_read_data_with_title_prints_title",
"tests/test_termgraph.py::TermgraphTest::test_stacked_graph_no_label_prints_no_labels",
"tests/test_termgraph.py::TermgraphTest::test_stacked_graph_prints_correct_graph",
"tests/test_termgraph.py::TermgraphTest::test_vertically_returns_correct_result"
] |
[] |
MIT License
| 3,265 |
[
"setup.py",
"termgraph/termgraph.py"
] |
[
"setup.py",
"termgraph/termgraph.py"
] |
|
qutech__qupulse-407
|
e978d24fdef1304874ea6b7dd006abd4a5b8ac6b
|
2018-10-18 15:53:55
|
3fd329fed4675ab4c878b9c8a984b97a7fcaba19
|
diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
index 667edc4b..b4d2d22b 100644
--- a/ReleaseNotes.txt
+++ b/ReleaseNotes.txt
@@ -1,15 +1,8 @@
## pending/current ##
-- General:
- - Introduce qupulse.utils.isclose (an alias for math.isclose if available)
-
-- Pulse Templates:
- - `AtomicMultichannelPulseTemplate`:
- - Add duration keyword argument & example (see MultiChannelTemplates notebook)
- - Make duration equality check approximate (numeric tolerance)
-
- Expressions:
- Make ExpressionScalar hashable
+ - Fix bug that prevented evaluation of expressions containing some special functions (`erfc`, `factorial`, etc.)
## 0.2 ##
diff --git a/doc/source/examples/07MultiChannelTemplates.ipynb b/doc/source/examples/07MultiChannelTemplates.ipynb
index b0dd1e48..4110c07e 100644
--- a/doc/source/examples/07MultiChannelTemplates.ipynb
+++ b/doc/source/examples/07MultiChannelTemplates.ipynb
@@ -1684,82 +1684,6 @@
"Note that an exception will be raised during the sampling of the waveforms (i.e., during the sequencing process) if the subtemplates have different length."
]
},
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Instantionation duration check\n",
- "By default the AtomicMultiChannelPulseTemplate checks whether the durations are equal on construction. It is possible to do this check during instantiation (when create_program is called) by providing the `duration` keyword argument. This can either be an expression or `True`. If it is an expression all subwaveforms have to have a duration equal to it. If it is `True` all waveforms have to have an unspecified equal duration."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Instantiation duration check:\n",
- "Could not assert duration equality of duration_a and duration_b\n",
- "\n",
- "Instantionation duration check with no specified value:\n",
- "The durations are not all equal. {'a': mpq(3,1), 'b': mpq(4,1)}\n",
- "\n",
- "Instantionation duration check with specified value\n",
- "The duration does not equal the expected duration 4\n"
- ]
- }
- ],
- "source": [
- "from qupulse.pulses import FunctionPT, AtomicMultiChannelPT\n",
- "\n",
- "template_a = FunctionPT('-sin(t)**2', 'duration_a', channel='a')\n",
- "template_b = FunctionPT('-cos(t)**2', 'duration_b', channel='b')\n",
- "\n",
- "try:\n",
- " # instantiation duration check\n",
- " template = AtomicMultiChannelPT(\n",
- " template_a,\n",
- " template_b,\n",
- " identifier='3-channel-combined-template'\n",
- " )\n",
- "except ValueError as err:\n",
- " print('Instantiation duration check:')\n",
- " print(err)\n",
- "\n",
- "# instantionation duration check with no specified value\n",
- "template_unspecified = AtomicMultiChannelPT(\n",
- " template_a,\n",
- " template_b,\n",
- " duration=True\n",
- ")\n",
- "\n",
- "template_unspecified.create_program(parameters=dict(duration_a=3, duration_b=3))\n",
- "try:\n",
- " template_unspecified.create_program(parameters=dict(duration_a=3, duration_b=4))\n",
- "except ValueError as err:\n",
- " print()\n",
- " print('Instantionation duration check with no specified value:')\n",
- " print(err.args[0], err.args[1])\n",
- "\n",
- "\n",
- "# instantionation duration check with specified value\n",
- "template_specified = AtomicMultiChannelPT(\n",
- " template_a,\n",
- " template_b,\n",
- " duration='my_duration'\n",
- ")\n",
- "template_specified.create_program(parameters=dict(duration_a=3, duration_b=3, my_duration=3))\n",
- "try:\n",
- " template_specified.create_program(parameters=dict(duration_a=3, duration_b=3, my_duration=4))\n",
- "except ValueError as err:\n",
- " print()\n",
- " print('Instantionation duration check with specified value')\n",
- " print(err.args[0], err.args[1])\n"
- ]
- },
{
"cell_type": "markdown",
"metadata": {},
@@ -1771,7 +1695,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 3,
"metadata": {},
"outputs": [
{
diff --git a/qupulse/_program/waveforms.py b/qupulse/_program/waveforms.py
index 102792e6..010827c6 100644
--- a/qupulse/_program/waveforms.py
+++ b/qupulse/_program/waveforms.py
@@ -12,7 +12,7 @@ from typing import Union, Set, Sequence, NamedTuple, Tuple, Any, Iterable, Froze
import numpy as np
from qupulse import ChannelID
-from qupulse.utils import checked_int_cast, isclose
+from qupulse.utils import checked_int_cast
from qupulse.utils.types import TimeType, time_from_float
from qupulse.comparable import Comparable
from qupulse.expressions import ExpressionScalar
@@ -395,30 +395,17 @@ class MultiChannelWaveform(Waveform):
self._sub_waveforms = tuple(sorted(flatten_sub_waveforms(sub_waveforms),
key=get_sub_waveform_sort_key))
+ if not all(waveform.duration == self._sub_waveforms[0].duration for waveform in self._sub_waveforms[1:]):
+ raise ValueError(
+ "MultiChannelWaveform cannot be constructed from channel waveforms of different"
+ "lengths."
+ )
self.__defined_channels = set()
for waveform in self._sub_waveforms:
if waveform.defined_channels & self.__defined_channels:
- raise ValueError('Channel may not be defined in multiple waveforms',
- waveform.defined_channels & self.__defined_channels)
+ raise ValueError('Channel may not be defined in multiple waveforms')
self.__defined_channels |= waveform.defined_channels
- if not all(isclose(waveform.duration, self._sub_waveforms[0].duration) for waveform in self._sub_waveforms[1:]):
- # meaningful error message:
- durations = {}
-
- for waveform in self._sub_waveforms:
- for duration, channels in durations.items():
- if isclose(waveform.duration, duration):
- channels.update(waveform.defined_channels)
- break
- else:
- durations[waveform.duration] = set(waveform.defined_channels)
-
- raise ValueError(
- "MultiChannelWaveform cannot be constructed from channel waveforms of different durations.",
- durations
- )
-
@property
def duration(self) -> TimeType:
return self._sub_waveforms[0].duration
diff --git a/qupulse/pulses/multi_channel_pulse_template.py b/qupulse/pulses/multi_channel_pulse_template.py
index 30988c28..a90a7cca 100644
--- a/qupulse/pulses/multi_channel_pulse_template.py
+++ b/qupulse/pulses/multi_channel_pulse_template.py
@@ -11,13 +11,14 @@ from typing import Dict, List, Optional, Any, Iterable, Union, Set, Sequence
import numbers
import warnings
+import numpy
+
+
from qupulse.serialization import Serializer, PulseRegistryType
from qupulse.pulses.conditions import Condition
-from qupulse.utils import isclose
-from qupulse.utils.sympy import almost_equal
from qupulse.utils.types import ChannelID, TimeType
-from qupulse._program.waveforms import MultiChannelWaveform, Waveform
+from qupulse._program.waveforms import MultiChannelWaveform
from qupulse.pulses.pulse_template import PulseTemplate, AtomicPulseTemplate
from qupulse.pulses.mapping_pulse_template import MappingPulseTemplate, MappingTuple
from qupulse.pulses.parameters import Parameter, ParameterConstrainer
@@ -28,29 +29,13 @@ __all__ = ["AtomicMultiChannelPulseTemplate"]
class AtomicMultiChannelPulseTemplate(AtomicPulseTemplate, ParameterConstrainer):
- """Combines multiple PulseTemplates that are defined on different channels into an AtomicPulseTemplate."""
def __init__(self,
*subtemplates: Union[AtomicPulseTemplate, MappingTuple, MappingPulseTemplate],
external_parameters: Optional[Set[str]]=None,
identifier: Optional[str]=None,
parameter_constraints: Optional[List]=None,
measurements: Optional[List[MeasurementDeclaration]]=None,
- registry: PulseRegistryType=None,
- duration: Union[str, Expression, bool]=False) -> None:
- """Parallels multiple AtomicPulseTemplates of the same duration. The duration equality check is performed on
- construction by default. If the duration keyword argument is given the check is performed on instantiation
- (when build_waveform is called). duration can be a Expression to enforce a certain duration or True for an
- unspecified duration.
-
- Args:
- *subtemplates: Positional arguments are subtemplates to combine.
- identifier: Forwarded to AtomicPulseTemplate.__init__
- parameter_constraints: Forwarded to ParameterConstrainer.__init__
- measurements: Forwarded to AtomicPulseTemplate.__init__
- duration: Enforced duration of the pulse template on instantiation. build_waveform checks all sub-waveforms
- have this duration. If True the equality of durations is only checked durtin instantiation not construction.
- external_parameters: No functionality. (Deprecated)
- """
+ registry: PulseRegistryType=None) -> None:
AtomicPulseTemplate.__init__(self, identifier=identifier, measurements=measurements)
ParameterConstrainer.__init__(self, parameter_constraints=parameter_constraints)
@@ -85,38 +70,28 @@ class AtomicMultiChannelPulseTemplate(AtomicPulseTemplate, ParameterConstrainer)
warnings.warn("external_parameters is an obsolete argument and will be removed in the future.",
category=DeprecationWarning)
- if not duration:
- duration = self._subtemplates[0].duration
- for subtemplate in self._subtemplates[1:]:
- if almost_equal(duration.sympified_expression, subtemplate.duration.sympified_expression):
- continue
- else:
- raise ValueError('Could not assert duration equality of {} and {}'.format(duration,
- subtemplate.duration))
- self._duration = None
- elif duration is True:
- self._duration = None
- else:
- self._duration = ExpressionScalar(duration)
+ duration = self._subtemplates[0].duration
+ for subtemplate in self._subtemplates[1:]:
+ if (duration == subtemplate.duration) is True:
+ continue
+ else:
+ raise ValueError('Could not assert duration equality of {} and {}'.format(duration,
+ subtemplate.duration))
self._register(registry=registry)
@property
- def duration(self) -> ExpressionScalar:
- if self._duration:
- return self._duration
- else:
- return self._subtemplates[0].duration
+ def duration(self) -> Expression:
+ return self._subtemplates[0].duration
@property
def parameter_names(self) -> Set[str]:
return set.union(self.measurement_parameters,
self.constrained_parameters,
- *(st.parameter_names for st in self._subtemplates),
- self._duration.variables if self._duration else ())
+ *(st.parameter_names for st in self._subtemplates))
@property
- def subtemplates(self) -> Sequence[Union[AtomicPulseTemplate, MappingPulseTemplate]]:
+ def subtemplates(self) -> Sequence[AtomicPulseTemplate]:
return self._subtemplates
@property
@@ -128,7 +103,7 @@ class AtomicMultiChannelPulseTemplate(AtomicPulseTemplate, ParameterConstrainer)
return super().measurement_names.union(*(st.measurement_names for st in self._subtemplates))
def build_waveform(self, parameters: Dict[str, numbers.Real],
- channel_mapping: Dict[ChannelID, Optional[ChannelID]]) -> Optional[Waveform]:
+ channel_mapping: Dict[ChannelID, Optional[ChannelID]]) -> Optional['MultiChannelWaveform']:
self.validate_parameter_constraints(parameters=parameters)
sub_waveforms = []
@@ -140,21 +115,10 @@ class AtomicMultiChannelPulseTemplate(AtomicPulseTemplate, ParameterConstrainer)
if len(sub_waveforms) == 0:
return None
-
if len(sub_waveforms) == 1:
- waveform = sub_waveforms[0]
+ return sub_waveforms[0]
else:
- waveform = MultiChannelWaveform(sub_waveforms)
-
- if self._duration:
- expected_duration = self._duration.evaluate_numeric(**parameters)
-
- if not isclose(expected_duration, waveform.duration):
- raise ValueError('The duration does not '
- 'equal the expected duration',
- expected_duration, waveform.duration)
-
- return waveform
+ return MultiChannelWaveform(sub_waveforms)
def get_measurement_windows(self,
parameters: Dict[str, numbers.Real],
diff --git a/qupulse/utils/__init__.py b/qupulse/utils/__init__.py
index 6f3ad0ce..1abd16b7 100644
--- a/qupulse/utils/__init__.py
+++ b/qupulse/utils/__init__.py
@@ -2,13 +2,7 @@ from typing import Union
import numpy
-try:
- from math import isclose
-except ImportError:
- # py version < 3.5
- isclose = None
-
-__all__ = ["checked_int_cast", "is_integer", "isclose"]
+__all__ = ["checked_int_cast", "is_integer"]
def checked_int_cast(x: Union[float, int, numpy.ndarray], epsilon: float=1e-6) -> int:
@@ -25,13 +19,3 @@ def checked_int_cast(x: Union[float, int, numpy.ndarray], epsilon: float=1e-6) -
def is_integer(x: Union[float, int], epsilon: float=1e-6) -> bool:
return abs(x - int(round(x))) < epsilon
-
-
-def _fallback_is_close(a, b, *, rel_tol=1e-09, abs_tol=0.0):
- """Copied from https://docs.python.org/3/library/math.html
- Does no error checks."""
- return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol) # pragma: no cover
-
-
-if not isclose:
- isclose = _fallback_is_close
diff --git a/qupulse/utils/sympy.py b/qupulse/utils/sympy.py
index e4592332..70956224 100644
--- a/qupulse/utils/sympy.py
+++ b/qupulse/utils/sympy.py
@@ -1,6 +1,7 @@
from typing import Union, Dict, Tuple, Any, Sequence, Optional
from numbers import Number
from types import CodeType
+import warnings
import builtins
import math
@@ -8,6 +9,15 @@ import math
import sympy
import numpy
+try:
+ import scipy.special as _special_functions
+except ImportError:
+ _special_functions = {fname: numpy.vectorize(fobject)
+ for fname, fobject in math.__dict__.items()
+ if not fname.startswith('_') and fname not in numpy.__dict__}
+ warnings.warn('scipy is not installed. This reduces the set of available functions to those present in numpy + '
+ 'manually vectorized functions in math.')
+
__all__ = ["sympify", "substitute_with_eval", "to_numpy", "get_variables", "get_free_symbols", "recursive_substitution",
"evaluate_lambdified", "get_most_simple_representation"]
@@ -189,6 +199,8 @@ _math_environment = {**_base_environment, **math.__dict__}
_numpy_environment = {**_base_environment, **numpy.__dict__}
_sympy_environment = {**_base_environment, **sympy.__dict__}
+_lambdify_modules = [{'ceiling': numpy_compatible_ceiling}, 'numpy', _special_functions]
+
def evaluate_compiled(expression: sympy.Expr,
parameters: Dict[str, Union[numpy.ndarray, Number]],
@@ -211,20 +223,6 @@ def evaluate_lambdified(expression: Union[sympy.Expr, numpy.ndarray],
variables: Sequence[str],
parameters: Dict[str, Union[numpy.ndarray, Number]],
lambdified) -> Tuple[Any, Any]:
- lambdified = lambdified or sympy.lambdify(variables, expression,
- [{'ceiling': numpy_compatible_ceiling}, 'numpy'])
+ lambdified = lambdified or sympy.lambdify(variables, expression, _lambdify_modules)
return lambdified(**parameters), lambdified
-
-
-def almost_equal(lhs: sympy.Expr, rhs: sympy.Expr, epsilon: float=1e-15) -> Optional[bool]:
- """Returns True (or False) if the two expressions are almost equal (or not). Returns None if this cannot be
- determined."""
- relation = sympy.simplify(sympy.Abs(lhs - rhs) <= epsilon)
-
- if relation is sympy.true:
- return True
- elif relation is sympy.false:
- return False
- else:
- return None
diff --git a/requirements.txt b/requirements.txt
index 78a3ca6d..08762bcf 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,6 +5,7 @@ PyVISA==1.9.1
sympy==1.3
gmpy2==2.0.8
+certifi==2018.8.24
cycler==0.10.0
kiwisolver==1.0.1
mpmath==1.0.0
|
utils.sympy.evaluate_lambdified fails if erfc is in expression
We currently only use `numpy` for lambdification which does not have the erfc function.
The user probably expects that functions from sympy can be used in such a case.
Two options:
- vectorize functions from `math`
- use `scipy.special`
|
qutech/qupulse
|
diff --git a/tests/expression_tests.py b/tests/expression_tests.py
index c2981c07..c6097a1d 100644
--- a/tests/expression_tests.py
+++ b/tests/expression_tests.py
@@ -348,6 +348,14 @@ class ExpressionScalarTests(unittest.TestCase):
self.assertFalse(ExpressionScalar(456).is_nan())
+ def test_special_function_numeric_evaluation(self):
+ expr = Expression('erfc(t)')
+ data = [-1., 0., 1.]
+ expected = np.array([1.84270079, 1., 0.15729921])
+ result = expr.evaluate_numeric(t=data)
+
+ np.testing.assert_allclose(expected, result)
+
class ExpressionExceptionTests(unittest.TestCase):
def test_expression_variable_missing(self):
diff --git a/tests/pulses/multi_channel_pulse_template_tests.py b/tests/pulses/multi_channel_pulse_template_tests.py
index cffe2bb9..dd476d62 100644
--- a/tests/pulses/multi_channel_pulse_template_tests.py
+++ b/tests/pulses/multi_channel_pulse_template_tests.py
@@ -65,49 +65,6 @@ class AtomicMultiChannelPulseTemplateTest(unittest.TestCase):
with self.assertRaises(TypeError):
AtomicMultiChannelPulseTemplate((non_atomic_pt, {'A': 'C'}), atomic_pt)
- def test_instantiation_duration_check(self):
- subtemplates = [DummyPulseTemplate(parameter_names={'p1'},
- measurement_names={'m1'},
- defined_channels={'c1'},
- duration='t_1',
- waveform=DummyWaveform(duration=3, defined_channels={'c1'})),
- DummyPulseTemplate(parameter_names={'p2'},
- measurement_names={'m2'},
- defined_channels={'c2'},
- duration='t_2',
- waveform=DummyWaveform(duration=3, defined_channels={'c2'})),
- DummyPulseTemplate(parameter_names={'p3'},
- measurement_names={'m3'},
- defined_channels={'c3'},
- duration='t_3',
- waveform=DummyWaveform(duration=4, defined_channels={'c3'}))]
-
- with self.assertRaisesRegex(ValueError, 'duration equality'):
- AtomicMultiChannelPulseTemplate(*subtemplates)
-
- amcpt = AtomicMultiChannelPulseTemplate(*subtemplates, duration=True)
- self.assertIs(amcpt.duration, subtemplates[0].duration)
-
- with self.assertRaisesRegex(ValueError, 'duration'):
- amcpt.build_waveform(parameters=dict(t_1=3, t_2=3, t_3=3),
- channel_mapping={ch: ch for ch in 'c1 c2 c3'.split()})
-
- subtemplates[2].waveform = None
- amcpt.build_waveform(parameters=dict(t_1=3, t_2=3, t_3=3),
- channel_mapping={ch: ch for ch in 'c1 c2 c3'.split()})
-
- amcpt = AtomicMultiChannelPulseTemplate(*subtemplates, duration='t_0')
- with self.assertRaisesRegex(ValueError, 'duration'):
- amcpt.build_waveform(parameters=dict(t_1=3, t_2=3, t_3=3, t_0=4),
- channel_mapping={ch: ch for ch in 'c1 c2 c3'.split()})
- with self.assertRaisesRegex(ValueError, 'duration'):
- amcpt.build_waveform(parameters=dict(t_1=3+1e-9, t_2=3, t_3=3, t_0=4),
- channel_mapping={ch: ch for ch in 'c1 c2 c3'.split()})
- amcpt.build_waveform(parameters=dict(t_1=3, t_2=3, t_3=3, t_0=3),
- channel_mapping={ch: ch for ch in 'c1 c2 c3'.split()})
- amcpt.build_waveform(parameters=dict(t_1=3+1e-11, t_2=3, t_3=3, t_0=3),
- channel_mapping={ch: ch for ch in 'c1 c2 c3'.split()})
-
def test_external_parameters_warning(self):
with self.assertWarnsRegex(DeprecationWarning, "external_parameters",
msg="AtomicMultiChannelPulseTemplate did not issue a warning for argument external_parameters"):
@@ -126,6 +83,11 @@ class AtomicMultiChannelPulseTemplateTest(unittest.TestCase):
self.assertEqual(template.duration, 't1')
+ def test_parameter_names(self) -> None:
+ template = AtomicMultiChannelPulseTemplate(*zip(self.subtemplates, self.param_maps, self.chan_maps),
+ parameter_constraints={'pp1 > hugo'}, measurements={('meas', 'd', 1)})
+ self.assertEqual({'pp1', 'pp2', 'pp3', 'hugo', 'd'}, template.parameter_names)
+
def test_mapping_template_pure_conversion(self):
template = AtomicMultiChannelPulseTemplate(*zip(self.subtemplates, self.param_maps, self.chan_maps))
@@ -173,12 +135,6 @@ class AtomicMultiChannelPulseTemplateTest(unittest.TestCase):
self.assertEqual(pt.parameter_names,
{'a', 'b', 'c', 'd', 'e'})
- def test_parameter_names_2(self):
- template = AtomicMultiChannelPulseTemplate(*zip(self.subtemplates, self.param_maps, self.chan_maps),
- parameter_constraints={'pp1 > hugo'},
- measurements={('meas', 'd', 1)},
- duration='my_duration')
- self.assertEqual({'pp1', 'pp2', 'pp3', 'hugo', 'd', 'my_duration'}, template.parameter_names)
def test_integral(self) -> None:
sts = [DummyPulseTemplate(duration='t1', defined_channels={'A'},
diff --git a/tests/utils/sympy_tests.py b/tests/utils/sympy_tests.py
index 42f0eb5c..effee275 100644
--- a/tests/utils/sympy_tests.py
+++ b/tests/utils/sympy_tests.py
@@ -14,8 +14,7 @@ a_ = IndexedBase(a)
b_ = IndexedBase(b)
from qupulse.utils.sympy import sympify as qc_sympify, substitute_with_eval, recursive_substitution, Len,\
- evaluate_lambdified, evaluate_compiled, get_most_simple_representation, get_variables, get_free_symbols,\
- almost_equal
+ evaluate_lambdified, evaluate_compiled, get_most_simple_representation, get_variables, get_free_symbols
################################################### SUBSTITUTION #######################################################
@@ -310,13 +309,4 @@ class RepresentationTest(unittest.TestCase):
st = get_most_simple_representation(qc_sympify('a + b'))
self.assertIsInstance(st, str)
- self.assertEqual(st, 'a + b')
-
-
-class AlmostEqualTests(unittest.TestCase):
- def test_almost_equal(self):
- self.assertTrue(almost_equal(sympy.sin(a) * 0.5, sympy.sin(a) / 2))
- self.assertIsNone(almost_equal(sympy.sin(a) * 0.5, sympy.sin(b) / 2))
- self.assertFalse(almost_equal(sympy.sin(a), sympy.sin(a) + 1e-14))
-
- self.assertTrue(almost_equal(sympy.sin(a), sympy.sin(a) + 1e-14, epsilon=1e-13))
+ self.assertEqual(st, 'a + b')
\ No newline at end of file
diff --git a/tests/utils/utils_tests.py b/tests/utils/utils_tests.py
index c7b4dc8e..a3251a23 100644
--- a/tests/utils/utils_tests.py
+++ b/tests/utils/utils_tests.py
@@ -1,5 +1,4 @@
import unittest
-from unittest import mock
from qupulse.utils import checked_int_cast
@@ -33,44 +32,3 @@ class CheckedIntCastTest(unittest.TestCase):
checked_int_cast(6 + 1e-11, epsilon=1e-15)
-class IsCloseTest(unittest.TestCase):
- def test_isclose_fallback(self):
- import math
- import importlib
- import builtins
- import qupulse.utils as qutils
-
- def dummy_is_close():
- pass
-
- if hasattr(math, 'isclose'):
- dummy_is_close = math.isclose
-
- original_import = builtins.__import__
-
- def mock_import_missing_isclose(name, globals=None, locals=None, fromlist=(), level=0):
- if name == 'math' and 'isclose' in fromlist:
- raise ImportError(name)
- else:
- return original_import(name, globals=globals, locals=locals, fromlist=fromlist, level=level)
-
- def mock_import_exsiting_isclose(name, globals=None, locals=None, fromlist=(), level=0):
- if name == 'math' and 'isclose' in fromlist:
- if not hasattr(math, 'isclose'):
- math.isclose = dummy_is_close
- return math
- else:
- return original_import(name, globals=globals, locals=locals, fromlist=fromlist, level=level)
-
- with mock.patch('builtins.__import__', mock_import_missing_isclose):
- reloaded_qutils = importlib.reload(qutils)
- self.assertIs(reloaded_qutils.isclose, reloaded_qutils._fallback_is_close)
-
- with mock.patch('builtins.__import__', mock_import_exsiting_isclose):
- reloaded_qutils = importlib.reload(qutils)
- self.assertIs(reloaded_qutils.isclose, math.isclose)
-
- if math.isclose is dummy_is_close:
- # cleanup
- delattr(math, 'isclose')
-
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 7
}
|
0.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip3 install .[plotting,zurich-instruments,tektronix,Faster-fractions]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y libgmp-dev libmpfr-dev libmpc-dev"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
cached-property==1.5.2
certifi==2021.5.30
coverage==6.2
cycler==0.11.0
execnet==1.9.0
gmpy2==2.1.5
importlib-metadata==4.8.3
iniconfig==1.1.1
kiwisolver==1.3.1
matplotlib==3.3.4
mpmath==1.3.0
numpy==1.19.5
packaging==21.3
Pillow==8.4.0
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
python-dateutil==2.9.0.post0
qupulse @ file:///qupulse
six==1.17.0
sympy==1.9
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: qupulse
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- cached-property==1.5.2
- coverage==6.2
- cycler==0.11.0
- execnet==1.9.0
- gmpy2==2.1.5
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- kiwisolver==1.3.1
- matplotlib==3.3.4
- mpmath==1.3.0
- numpy==1.19.5
- packaging==21.3
- pillow==8.4.0
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- python-dateutil==2.9.0.post0
- qupulse==0.2
- six==1.17.0
- sympy==1.9
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/qupulse
|
[
"tests/expression_tests.py::ExpressionScalarTests::test_special_function_numeric_evaluation"
] |
[
"tests/expression_tests.py::ExpressionScalarTests::test_indexing",
"tests/expression_tests.py::ExpressionScalarTests::test_partial_evaluation_vectorized",
"tests/expression_tests.py::ExpressionScalarTests::test_variables_indexed",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_parameter_names",
"tests/pulses/multi_channel_pulse_template_tests.py::MultiChannelPulseTemplateSequencingTests::test_build_sequence",
"tests/pulses/multi_channel_pulse_template_tests.py::MultiChannelPulseTemplateSequencingTests::test_build_waveform",
"tests/pulses/multi_channel_pulse_template_tests.py::MultiChannelPulseTemplateSequencingTests::test_build_waveform_none",
"tests/pulses/multi_channel_pulse_template_tests.py::MultiChannelPulseTemplateSequencingTests::test_get_measurement_windows",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_conversion",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_deserialization",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_duplication_error",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_get_type_identifier",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_identifier",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_manual_garbage_collect",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_no_registration_before_correct_serialization",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_renamed",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_renamed_of_anonymous",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_serialization",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateSerializationTests::test_serialization_and_deserialization",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateOldSerializationTests::test_deserialize_old",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateOldSerializationTests::test_serialize_old",
"tests/utils/sympy_tests.py::SympifyWrapperTests::test_index_sympify"
] |
[
"tests/expression_tests.py::ExpressionTests::test_make",
"tests/expression_tests.py::ExpressionVectorTests::test_eq",
"tests/expression_tests.py::ExpressionVectorTests::test_evaluate_numeric",
"tests/expression_tests.py::ExpressionVectorTests::test_evaluate_numeric_2d",
"tests/expression_tests.py::ExpressionVectorTests::test_numeric_expression",
"tests/expression_tests.py::ExpressionVectorTests::test_partial_evaluation",
"tests/expression_tests.py::ExpressionVectorTests::test_symbolic_evaluation",
"tests/expression_tests.py::ExpressionScalarTests::test_defined_comparison",
"tests/expression_tests.py::ExpressionScalarTests::test_evaluate_numeric",
"tests/expression_tests.py::ExpressionScalarTests::test_evaluate_numeric_without_numpy",
"tests/expression_tests.py::ExpressionScalarTests::test_evaluate_numpy",
"tests/expression_tests.py::ExpressionScalarTests::test_evaluate_symbolic",
"tests/expression_tests.py::ExpressionScalarTests::test_evaluate_variable_missing",
"tests/expression_tests.py::ExpressionScalarTests::test_hash",
"tests/expression_tests.py::ExpressionScalarTests::test_is_nan",
"tests/expression_tests.py::ExpressionScalarTests::test_number_comparison",
"tests/expression_tests.py::ExpressionScalarTests::test_number_math",
"tests/expression_tests.py::ExpressionScalarTests::test_original_expression",
"tests/expression_tests.py::ExpressionScalarTests::test_partial_evaluation",
"tests/expression_tests.py::ExpressionScalarTests::test_repr",
"tests/expression_tests.py::ExpressionScalarTests::test_str",
"tests/expression_tests.py::ExpressionScalarTests::test_symbolic_math",
"tests/expression_tests.py::ExpressionScalarTests::test_sympy_math",
"tests/expression_tests.py::ExpressionScalarTests::test_undefined_comparison",
"tests/expression_tests.py::ExpressionScalarTests::test_variables",
"tests/expression_tests.py::ExpressionExceptionTests::test_expression_variable_missing",
"tests/expression_tests.py::ExpressionExceptionTests::test_non_numeric_evaluation",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_channel_intersection",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_defined_channels",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_duration",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_external_parameters_warning",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_init_empty",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_integral",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_mapping_template_mixed_conversion",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_mapping_template_pure_conversion",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_measurement_names",
"tests/pulses/multi_channel_pulse_template_tests.py::AtomicMultiChannelPulseTemplateTest::test_non_atomic_subtemplates",
"tests/pulses/multi_channel_pulse_template_tests.py::MultiChannelPulseTemplateSequencingTests::test_requires_stop",
"tests/utils/sympy_tests.py::SympifyTests::test_complex_sympify",
"tests/utils/sympy_tests.py::SympifyTests::test_index_sympify",
"tests/utils/sympy_tests.py::SympifyTests::test_len_sympify",
"tests/utils/sympy_tests.py::SympifyTests::test_simple_sympify",
"tests/utils/sympy_tests.py::SympifyWrapperTests::test_complex_sympify",
"tests/utils/sympy_tests.py::SympifyWrapperTests::test_len_sympify",
"tests/utils/sympy_tests.py::SympifyWrapperTests::test_simple_sympify",
"tests/utils/sympy_tests.py::SubstitutionTests::test_elem_func_substitution_cases",
"tests/utils/sympy_tests.py::SubstitutionTests::test_simple_substitution_cases",
"tests/utils/sympy_tests.py::SubstitutionTests::test_sum_substitution_cases",
"tests/utils/sympy_tests.py::SubstituteWithEvalTests::test_elem_func_substitution_cases",
"tests/utils/sympy_tests.py::SubstituteWithEvalTests::test_indexed_substitution_cases",
"tests/utils/sympy_tests.py::SubstituteWithEvalTests::test_simple_substitution_cases",
"tests/utils/sympy_tests.py::SubstituteWithEvalTests::test_vector_valued_cases",
"tests/utils/sympy_tests.py::RecursiveSubstitutionTests::test_elem_func_substitution_cases",
"tests/utils/sympy_tests.py::RecursiveSubstitutionTests::test_full_featured_cases",
"tests/utils/sympy_tests.py::RecursiveSubstitutionTests::test_indexed_substitution_cases",
"tests/utils/sympy_tests.py::RecursiveSubstitutionTests::test_simple_substitution_cases",
"tests/utils/sympy_tests.py::RecursiveSubstitutionTests::test_sum_substitution_cases",
"tests/utils/sympy_tests.py::RecursiveSubstitutionTests::test_vector_valued_cases",
"tests/utils/sympy_tests.py::GetFreeSymbolsTests::test_get_free_symbols",
"tests/utils/sympy_tests.py::GetFreeSymbolsTests::test_get_free_symbols_indexed",
"tests/utils/sympy_tests.py::GetFreeSymbolsTests::test_get_variables",
"tests/utils/sympy_tests.py::GetFreeSymbolsTests::test_get_variables_indexed",
"tests/utils/sympy_tests.py::EvaluationTests::test_eval_array_expression",
"tests/utils/sympy_tests.py::EvaluationTests::test_eval_array_values",
"tests/utils/sympy_tests.py::EvaluationTests::test_eval_many_arguments",
"tests/utils/sympy_tests.py::EvaluationTests::test_eval_simple",
"tests/utils/sympy_tests.py::EvaluationTests::test_eval_simple_functions",
"tests/utils/sympy_tests.py::EvaluationTests::test_eval_sum",
"tests/utils/sympy_tests.py::CompiledEvaluationTest::test_eval_array_expression",
"tests/utils/sympy_tests.py::CompiledEvaluationTest::test_eval_array_values",
"tests/utils/sympy_tests.py::CompiledEvaluationTest::test_eval_many_arguments",
"tests/utils/sympy_tests.py::CompiledEvaluationTest::test_eval_simple",
"tests/utils/sympy_tests.py::CompiledEvaluationTest::test_eval_simple_functions",
"tests/utils/sympy_tests.py::CompiledEvaluationTest::test_eval_sum",
"tests/utils/sympy_tests.py::RepresentationTest::test_get_most_simple_representation",
"tests/utils/utils_tests.py::CheckedIntCastTest::test_float_cast",
"tests/utils/utils_tests.py::CheckedIntCastTest::test_int_forwarding",
"tests/utils/utils_tests.py::CheckedIntCastTest::test_no_int_detection",
"tests/utils/utils_tests.py::CheckedIntCastTest::test_variable_epsilon"
] |
[] | null | 3,266 |
[
"requirements.txt",
"doc/source/examples/07MultiChannelTemplates.ipynb",
"ReleaseNotes.txt",
"qupulse/utils/sympy.py",
"qupulse/pulses/multi_channel_pulse_template.py",
"qupulse/_program/waveforms.py",
"qupulse/utils/__init__.py"
] |
[
"requirements.txt",
"doc/source/examples/07MultiChannelTemplates.ipynb",
"ReleaseNotes.txt",
"qupulse/utils/sympy.py",
"qupulse/pulses/multi_channel_pulse_template.py",
"qupulse/_program/waveforms.py",
"qupulse/utils/__init__.py"
] |
|
google__mobly-538
|
df643c7778fa7980fdb5f634dc4f2d6227fef7e3
|
2018-10-18 16:20:03
|
f4e68b574170665f789430d985348ba9dd84c0e6
|
diff --git a/mobly/controller_manager.py b/mobly/controller_manager.py
index 75370dd..775ad3c 100644
--- a/mobly/controller_manager.py
+++ b/mobly/controller_manager.py
@@ -17,6 +17,7 @@ import copy
import logging
import yaml
+from mobly import expects
from mobly import records
from mobly import signals
@@ -152,10 +153,9 @@ class ControllerManager(object):
# logging them.
for name, module in self._controller_modules.items():
logging.debug('Destroying %s.', name)
- try:
+ with expects.expect_no_raises(
+ 'Exception occurred destroying %s.' % name):
module.destroy(self._controller_objects[name])
- except:
- logging.exception('Exception occurred destroying %s.', name)
self._controller_objects = collections.OrderedDict()
self._controller_modules = {}
@@ -204,8 +204,11 @@ class ControllerManager(object):
"""
info_records = []
for controller_module_name in self._controller_objects.keys():
- record = self._create_controller_info_record(
- controller_module_name)
- if record:
- info_records.append(record)
+ with expects.expect_no_raises(
+ 'Failed to collect controller info from %s' %
+ controller_module_name):
+ record = self._create_controller_info_record(
+ controller_module_name)
+ if record:
+ info_records.append(record)
return info_records
|
Errors in `teardown_class` are not properly recorded
If Mobly encounters an error in the cleanup stage of `teardown_class`, the error would not be recorded anywhere except the cli output, which makes debugging difficult.
This points to a bigger problem: the errors occurred in base test and runner themselves are not clearly handled.
|
google/mobly
|
diff --git a/mobly/base_test.py b/mobly/base_test.py
index 8ea90d3..2add2f2 100644
--- a/mobly/base_test.py
+++ b/mobly/base_test.py
@@ -41,6 +41,7 @@ STAGE_NAME_SETUP_CLASS = 'setup_class'
STAGE_NAME_SETUP_TEST = 'setup_test'
STAGE_NAME_TEARDOWN_TEST = 'teardown_test'
STAGE_NAME_TEARDOWN_CLASS = 'teardown_class'
+STAGE_NAME_CLEAN_UP = 'clean_up'
class Error(Exception):
@@ -374,9 +375,7 @@ class BaseTestClass(object):
self.summary_writer.dump(record.to_dict(),
records.TestSummaryEntryType.RECORD)
finally:
- # Write controller info and summary to summary file.
- self._record_controller_info()
- self._controller_manager.unregister_controllers()
+ self._clean_up()
def teardown_class(self):
"""Teardown function that will be called after all the selected tests in
@@ -846,10 +845,36 @@ class BaseTestClass(object):
logging.info('Summary for test class %s: %s', self.TAG,
self.results.summary_str())
+ def _clean_up(self):
+ """The final stage of a test class execution."""
+ stage_name = STAGE_NAME_CLEAN_UP
+ record = records.TestResultRecord(stage_name, self.TAG)
+ record.test_begin()
+ self.current_test_info = runtime_test_info.RuntimeTestInfo(
+ stage_name, self.log_path, record)
+ expects.recorder.reset_internal_states(record)
+ with self._log_test_stage(stage_name):
+ # Write controller info and summary to summary file.
+ self._record_controller_info()
+ self._controller_manager.unregister_controllers()
+ if expects.recorder.has_error:
+ record.test_error()
+ record.update_record()
+ self.results.add_class_error(record)
+ self.summary_writer.dump(record.to_dict(),
+ records.TestSummaryEntryType.RECORD)
+
def clean_up(self):
- """A function that is executed upon completion of all tests selected in
+ """.. deprecated:: 1.8.1
+
+ Use `teardown_class` instead.
+
+ A function that is executed upon completion of all tests selected in
the test class.
This function should clean up objects initialized in the constructor by
user.
+
+ Generally this should not be used as nothing should be instantiated
+ from the constructor of a test class.
"""
diff --git a/tests/mobly/base_test_test.py b/tests/mobly/base_test_test.py
index 1183133..8d77017 100755
--- a/tests/mobly/base_test_test.py
+++ b/tests/mobly/base_test_test.py
@@ -2001,6 +2001,53 @@ class BaseTestTest(unittest.TestCase):
}
}])
+ def test_record_controller_info_fail(self):
+ mock_test_config = self.mock_test_cls_configs.copy()
+ mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
+ mock_ctrlr_2_config_name = mock_second_controller.MOBLY_CONTROLLER_CONFIG_NAME
+ my_config = [{'serial': 'xxxx', 'magic': 'Magic'}]
+ mock_test_config.controller_configs[mock_ctrlr_config_name] = my_config
+ mock_test_config.controller_configs[
+ mock_ctrlr_2_config_name] = copy.copy(my_config)
+
+ class ControllerInfoTest(base_test.BaseTestClass):
+ """Registers two different controller types and modifies controller
+ info at runtime.
+ """
+
+ def setup_class(self):
+ device = self.register_controller(mock_controller)[0]
+ device.who_am_i = mock.MagicMock()
+ device.who_am_i.side_effect = Exception('Some failure')
+ second_controller = self.register_controller(
+ mock_second_controller)[0]
+ # This should appear in recorded controller info.
+ second_controller.set_magic('haha')
+
+ def test_func(self):
+ pass
+
+ bt_cls = ControllerInfoTest(mock_test_config)
+ bt_cls.run()
+ info = bt_cls.results.controller_info[0]
+ self.assertEqual(len(bt_cls.results.controller_info), 1)
+ self.assertEqual(info.test_class, 'ControllerInfoTest')
+ self.assertEqual(info.controller_name, 'AnotherMagicDevice')
+ self.assertEqual(info.controller_info, [{
+ 'MyOtherMagic': {
+ 'magic': 'Magic',
+ 'extra_magic': 'haha'
+ }
+ }])
+ record = bt_cls.results.error[0]
+ print(record.to_dict())
+ self.assertEqual(record.test_name, 'clean_up')
+ self.assertIsNotNone(record.begin_time)
+ self.assertIsNotNone(record.end_time)
+ expected_msg = ('Failed to collect controller info from '
+ 'mock_controller: Some failure')
+ self.assertEqual(record.details, expected_msg)
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/mobly/controller_manager_test.py b/tests/mobly/controller_manager_test.py
index 7c9f1b6..4bfc4ca 100755
--- a/tests/mobly/controller_manager_test.py
+++ b/tests/mobly/controller_manager_test.py
@@ -150,6 +150,16 @@ class ControllerManagerTest(unittest.TestCase):
self.assertEqual(record.test_class, 'SomeClass')
self.assertEqual(record.controller_name, 'MagicDevice')
+ @mock.patch('tests.lib.mock_controller.get_info')
+ def test_get_controller_info_records_error(self, mock_get_info_func):
+ mock_get_info_func.side_effect = Exception('Record info failed.')
+ mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
+ controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
+ c_manager = controller_manager.ControllerManager(
+ 'SomeClass', controller_configs)
+ c_manager.register_controller(mock_controller)
+ self.assertFalse(c_manager.get_controller_info_records())
+
def test_get_controller_info_records(self):
mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
@@ -189,6 +199,18 @@ class ControllerManagerTest(unittest.TestCase):
self.assertFalse(c_manager._controller_objects)
self.assertFalse(c_manager._controller_modules)
+ @mock.patch('tests.lib.mock_controller.destroy')
+ def test_unregister_controller_error(self, mock_destroy_func):
+ mock_ctrlr_config_name = mock_controller.MOBLY_CONTROLLER_CONFIG_NAME
+ controller_configs = {mock_ctrlr_config_name: ['magic1', 'magic2']}
+ c_manager = controller_manager.ControllerManager(
+ 'SomeClass', controller_configs)
+ c_manager.register_controller(mock_controller)
+ mock_destroy_func.side_effect = Exception('Failed in destroy.')
+ c_manager.unregister_controllers()
+ self.assertFalse(c_manager._controller_objects)
+ self.assertFalse(c_manager._controller_modules)
+
@mock.patch('tests.lib.mock_controller.destroy')
def test_unregister_controller_without_registration(
self, mock_destroy_func):
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 1
}
|
1.8
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"mock",
"pytest",
"pytz"
],
"pre_install": [
"apt-get update",
"apt-get install -y adb"
],
"python": "3.5",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
future==1.0.0
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
-e git+https://github.com/google/mobly.git@df643c7778fa7980fdb5f634dc4f2d6227fef7e3#egg=mobly
mock==5.2.0
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
portpicker==1.6.0
psutil==7.0.0
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pyserial==3.5
pytest==6.2.4
pytz==2025.2
PyYAML==6.0.1
timeout-decorator==0.5.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work
|
name: mobly
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=21.4.0=pyhd3eb1b0_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- importlib-metadata=4.8.1=py36h06a4308_0
- importlib_metadata=4.8.1=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- more-itertools=8.12.0=pyhd3eb1b0_0
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=21.3=pyhd3eb1b0_0
- pip=21.2.2=py36h06a4308_0
- pluggy=0.13.1=py36h06a4308_0
- py=1.11.0=pyhd3eb1b0_0
- pyparsing=3.0.4=pyhd3eb1b0_0
- pytest=6.2.4=py36h06a4308_2
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- typing_extensions=4.1.1=pyh06a4308_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zipp=3.6.0=pyhd3eb1b0_0
- zlib=1.2.13=h5eee18b_1
- pip:
- future==1.0.0
- mock==5.2.0
- portpicker==1.6.0
- psutil==7.0.0
- pyserial==3.5
- pytz==2025.2
- pyyaml==6.0.1
- timeout-decorator==0.5.0
prefix: /opt/conda/envs/mobly
|
[
"tests/mobly/base_test_test.py::BaseTestTest::test_record_controller_info_fail",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_get_controller_info_records_error"
] |
[
"tests/mobly/base_test_test.py::BaseTestTest::test_write_user_data"
] |
[
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_on_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_on_fail_from_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_setup_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_teardown_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_all_in_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_class_in_on_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_class_in_setup_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_class_in_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_abort_class_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_equal_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_equal_fail_with_msg",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_equal_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_fail_with_noop",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_fail_with_wrong_error",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_fail_with_wrong_regex",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_regex_fail_with_noop",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_regex_fail_with_wrong_error",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_raises_regex_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_assert_true",
"tests/mobly/base_test_test.py::BaseTestTest::test_both_teardown_and_test_body_raise_exceptions",
"tests/mobly/base_test_test.py::BaseTestTest::test_cli_test_selection_fail_by_convention",
"tests/mobly/base_test_test.py::BaseTestTest::test_cli_test_selection_override_self_tests_list",
"tests/mobly/base_test_test.py::BaseTestTest::test_current_test_info",
"tests/mobly/base_test_test.py::BaseTestTest::test_current_test_info_in_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_current_test_name",
"tests/mobly/base_test_test.py::BaseTestTest::test_default_execution_of_all_tests",
"tests/mobly/base_test_test.py::BaseTestTest::test_exception_objects_in_record",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_equal",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_false",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_setup_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_setup_class_and_on_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_setup_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_teardown_class",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_in_teardown_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_multiple_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_no_op",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_no_raises_custom_msg",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_no_raises_default_msg",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_true",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_true_and_assert_true",
"tests/mobly/base_test_test.py::BaseTestTest::test_expect_two_tests",
"tests/mobly/base_test_test.py::BaseTestTest::test_explicit_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_explicit_pass_but_teardown_test_raises_an_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_failure_in_procedure_functions_is_recorded",
"tests/mobly/base_test_test.py::BaseTestTest::test_failure_to_call_procedure_function_is_recorded",
"tests/mobly/base_test_test.py::BaseTestTest::test_generate_tests_call_outside_of_setup_generated_tests",
"tests/mobly/base_test_test.py::BaseTestTest::test_generate_tests_dup_test_name",
"tests/mobly/base_test_test.py::BaseTestTest::test_generate_tests_run",
"tests/mobly/base_test_test.py::BaseTestTest::test_generate_tests_selected_run",
"tests/mobly/base_test_test.py::BaseTestTest::test_implicit_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_missing_requested_test_func",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_cannot_modify_original_record",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_both_test_and_teardown_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_setup_class_fails_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_setup_test_fails_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_teardown_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_executed_if_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_raise_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_fail_triggered_by_setup_class_failure_then_fail_too",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_pass_cannot_modify_original_record",
"tests/mobly/base_test_test.py::BaseTestTest::test_on_pass_raise_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_procedure_function_gets_correct_record",
"tests/mobly/base_test_test.py::BaseTestTest::test_promote_extra_errors_to_termination_signal",
"tests/mobly/base_test_test.py::BaseTestTest::test_record_controller_info",
"tests/mobly/base_test_test.py::BaseTestTest::test_self_tests_list",
"tests/mobly/base_test_test.py::BaseTestTest::test_self_tests_list_fail_by_convention",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_and_teardown_execution_count",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_class_fail_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_generated_tests_failure",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_test_fail_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_setup_test_fail_by_test_signal",
"tests/mobly/base_test_test.py::BaseTestTest::test_skip",
"tests/mobly/base_test_test.py::BaseTestTest::test_skip_if",
"tests/mobly/base_test_test.py::BaseTestTest::test_skip_in_setup_test",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_class_fail_by_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_class_raise_abort_all",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_assert_fail",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_executed_if_setup_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_executed_if_test_fails",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_executed_if_test_pass",
"tests/mobly/base_test_test.py::BaseTestTest::test_teardown_test_raise_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_uncaught_exception",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_basic",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_default_None",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_default_overwrite",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_default_overwrite_by_optional_param_list",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_default_overwrite_by_required_param_list",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_optional",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_optional_missing",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_optional_with_default",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_required",
"tests/mobly/base_test_test.py::BaseTestTest::test_unpack_userparams_required_missing",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_controller_record_exists_without_get_info",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_get_controller_info_record_not_serializable",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_get_controller_info_records",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_get_controller_info_records_empty",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_get_controller_info_without_registration",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_register_controller_change_return_value",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_register_controller_dup_register",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_register_controller_less_than_min_number",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_register_controller_no_config",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_register_controller_no_config_for_not_required",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_register_controller_return_value",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_unregister_controller",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_unregister_controller_error",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_unregister_controller_without_registration",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_verify_controller_module",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_verify_controller_module_missing_attr",
"tests/mobly/controller_manager_test.py::ControllerManagerTest::test_verify_controller_module_null_attr"
] |
[] |
Apache License 2.0
| 3,267 |
[
"mobly/controller_manager.py"
] |
[
"mobly/controller_manager.py"
] |
|
drdoctr__doctr-332
|
3d81f52da6c52b0e062a3c7c5d179cc062287a6b
|
2018-10-18 21:47:06
|
b212186dc2a09ca3c817cdeb57da6e450d858ca4
|
diff --git a/.travis.yml b/.travis.yml
index 5e0cee53..5badcd81 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,7 +41,10 @@ script:
echo `date` >> test
python -m doctr deploy --key-path deploy_key.enc --no-require-master docs;
# Test syncing a tracked file with a change
- python -m doctr deploy --sync --key-path deploy_key.enc stash-test --built-docs test;
+ python -m doctr deploy --sync --key-path deploy_key.enc stash-test/ --built-docs test;
+ # Test syncing a single file
+ echo `date` >> test-file
+ python -m doctr deploy --sync --key-path deploy_key.enc . --built-docs test-file;
# Test deploy branch creation. Delete the branch gh-pages-testing on drdoctr/doctr whenever you want to test this.
python -m doctr deploy --sync --key-path deploy_key.enc --no-require-master --deploy-branch gh-pages-testing docs;
# Test pushing to .github.io
@@ -64,7 +67,7 @@ script:
fi
- if [[ "${TESTS}" == "true" ]]; then
pyflakes doctr;
- py.test doctr;
+ py.test doctr -v -rs;
fi
doctr:
diff --git a/doctr/travis.py b/doctr/travis.py
index 8df96da2..5f34d682 100644
--- a/doctr/travis.py
+++ b/doctr/travis.py
@@ -13,6 +13,8 @@ import pathlib
import tempfile
import time
+import requests
+
from cryptography.fernet import Fernet
from .common import red, blue
@@ -214,10 +216,21 @@ def setup_GitHub_push(deploy_repo, *, auth_type='deploy_key',
TRAVIS_BRANCH = os.environ.get("TRAVIS_BRANCH", "")
TRAVIS_PULL_REQUEST = os.environ.get("TRAVIS_PULL_REQUEST", "")
+ # Check if the repo is a fork
+ TRAVIS_REPO_SLUG = os.environ["TRAVIS_REPO_SLUG"]
+ REPO_URL = 'https://api.github.com/repos/{slug}'
+ r = requests.get(REPO_URL.format(slug=TRAVIS_REPO_SLUG))
+ fork = r.json().get('fork', False)
+ # Rate limits prevent this check from working every time. By default, we
+ # assume it isn't a fork so that things just work on non-fork builds.
+ if r.status_code == 403:
+ print(red("Warning: GitHub's API rate limits prevented doctr from detecting if this build is a fork. If it is, doctr will fail with an error like 'DOCTR_DEPLOY_ENCRYPTION_KEY environment variable is not set'. This error can be safely ignored. If this is not a fork build, you can ignore this warning."), file=sys.stderr)
+
canpush = determine_push_rights(
branch_whitelist=branch_whitelist,
TRAVIS_BRANCH=TRAVIS_BRANCH,
TRAVIS_PULL_REQUEST=TRAVIS_PULL_REQUEST,
+ fork=fork,
TRAVIS_TAG=TRAVIS_TAG,
build_tags=build_tags)
@@ -434,14 +447,17 @@ def sync_from_log(src, dst, log_file, exclude=()):
files = glob.iglob(join(src, '**'), recursive=True)
else:
files = [src]
- src = os.path.dirname(src) + os.sep
+ src = os.path.dirname(src) + os.sep if os.sep in src else ''
+
+ os.makedirs(dst, exist_ok=True)
# sorted makes this easier to test
for f in sorted(files):
if any(is_subdir(f, os.path.join(src, i)) for i in exclude):
continue
new_f = join(dst, f[len(src):])
- if isdir(f):
+
+ if isdir(f) or f.endswith(os.sep):
os.makedirs(new_f, exist_ok=True)
else:
shutil.copy2(f, new_f)
@@ -549,7 +565,7 @@ def last_commit_by_doctr():
return False
def determine_push_rights(*, branch_whitelist, TRAVIS_BRANCH,
- TRAVIS_PULL_REQUEST, TRAVIS_TAG, build_tags):
+ TRAVIS_PULL_REQUEST, TRAVIS_TAG, build_tags, fork):
"""Check if Travis is running on ``master`` (or a whitelisted branch) to
determine if we can/should push the docs to the deploy repo
"""
@@ -570,6 +586,10 @@ def determine_push_rights(*, branch_whitelist, TRAVIS_BRANCH,
print("The website and docs are not pushed to gh-pages on pull requests", file=sys.stderr)
canpush = False
+ if fork:
+ print("The website and docs are not pushed to gh-pages on fork builds.", file=sys.stderr)
+ canpush = False
+
if last_commit_by_doctr():
print(red("The last commit on this branch was pushed by doctr. Not pushing to "
"avoid an infinite build-loop."), file=sys.stderr)
|
Detect if the repo is a fork
If I'm understanding the behavior I'm seeing correctly, encrypted environment variables aren't available on forks at all, even if they are encrypted with the key for the fork.
|
drdoctr/doctr
|
diff --git a/doctr/tests/test_local.py b/doctr/tests/test_local.py
index 78064556..70ea9c94 100644
--- a/doctr/tests/test_local.py
+++ b/doctr/tests/test_local.py
@@ -68,10 +68,11 @@ def test_GIT_URL():
assert not GIT_URL.fullmatch('https://gitlab.com/drdoctr/doctr.git')
[email protected](os.environ.get('TRAVIS_REPO_SLUG', '') != 'drdoctr/doctr', reason="Not run on Travis fork builds")
[email protected](not on_travis(), reason="Not on Travis")
def test_guess_github_repo():
"""
Only works if run in this repo, and if cloned from origin. For safety,
- only run on Travis
+ only run on Travis and not run on fork builds.
"""
- if on_travis():
- assert guess_github_repo() == 'drdoctr/doctr'
+ assert guess_github_repo() == 'drdoctr/doctr'
diff --git a/doctr/tests/test_travis.py b/doctr/tests/test_travis.py
index 09b9e5bf..81286cec 100644
--- a/doctr/tests/test_travis.py
+++ b/doctr/tests/test_travis.py
@@ -221,46 +221,91 @@ def test_sync_from_log(src, dst):
os.chdir(old_curdir)
[email protected]("dst", ['dst', 'dst/'])
+def test_sync_from_log_file_to_dir(dst):
+ with tempfile.TemporaryDirectory() as dir:
+ try:
+ old_curdir = os.path.abspath(os.curdir)
+ os.chdir(dir)
+
+ src = 'file'
+
+ with open(src, 'w') as f:
+ f.write('test1')
+
+ # Test that the sync happens
+ added, removed = sync_from_log(src, dst, 'logfile')
+
+ assert added == [
+ os.path.join('dst', 'file'),
+ 'logfile',
+ ]
+
+ assert removed == []
+
+ assert os.path.isdir(dst)
+ # Make sure dst is a file
+ with open(os.path.join('dst', 'file')) as f:
+ assert f.read() == 'test1'
+
+
+ with open('logfile') as f:
+ assert f.read() == '\n'.join([
+ os.path.join('dst', 'file')
+ ])
+
+ finally:
+ os.chdir(old_curdir)
+
+
@pytest.mark.parametrize("""branch_whitelist, TRAVIS_BRANCH,
- TRAVIS_PULL_REQUEST, TRAVIS_TAG, build_tags,
+ TRAVIS_PULL_REQUEST, TRAVIS_TAG, fork, build_tags,
canpush""",
[
- ('master', 'doctr', 'true', "", False, False),
- ('master', 'doctr', 'false', "", False, False),
- ('master', 'master', 'true', "", False, False),
- ('master', 'master', 'false', "", False, True),
- ('doctr', 'doctr', 'True', "", False, False),
- ('doctr', 'doctr', 'false', "", False, True),
- ('set()', 'doctr', 'false', "", False, False),
-
- ('master', 'doctr', 'true', "tagname", False, False),
- ('master', 'doctr', 'false', "tagname", False, False),
- ('master', 'master', 'true', "tagname", False, False),
- ('master', 'master', 'false', "tagname", False, False),
- ('doctr', 'doctr', 'True', "tagname", False, False),
- ('doctr', 'doctr', 'false', "tagname", False, False),
- ('set()', 'doctr', 'false', "tagname", False, False),
-
- ('master', 'doctr', 'true', "", True, False),
- ('master', 'doctr', 'false', "", True, False),
- ('master', 'master', 'true', "", True, False),
- ('master', 'master', 'false', "", True, True),
- ('doctr', 'doctr', 'True', "", True, False),
- ('doctr', 'doctr', 'false', "", True, True),
- ('set()', 'doctr', 'false', "", True, False),
-
- ('master', 'doctr', 'true', "tagname", True, True),
- ('master', 'doctr', 'false', "tagname", True, True),
- ('master', 'master', 'true', "tagname", True, True),
- ('master', 'master', 'false', "tagname", True, True),
- ('doctr', 'doctr', 'True', "tagname", True, True),
- ('doctr', 'doctr', 'false', "tagname", True, True),
- ('set()', 'doctr', 'false', "tagname", True, True),
+ ('master', 'doctr', 'true', "", False, False, False),
+ ('master', 'doctr', 'false', "", False, False, False),
+ ('master', 'master', 'true', "", False, False, False),
+ ('master', 'master', 'false', "", False, False, True),
+ ('doctr', 'doctr', 'True', "", False, False, False),
+ ('doctr', 'doctr', 'false', "", False, False, True),
+ ('set()', 'doctr', 'false', "", False, False, False),
+
+ ('master', 'doctr', 'true', "tagname", False, False, False),
+ ('master', 'doctr', 'false', "tagname", False, False, False),
+ ('master', 'master', 'true', "tagname", False, False, False),
+ ('master', 'master', 'false', "tagname", False, False, False),
+ ('doctr', 'doctr', 'True', "tagname", False, False, False),
+ ('doctr', 'doctr', 'false', "tagname", False, False, False),
+ ('set()', 'doctr', 'false', "tagname", False, False, False),
+
+ ('master', 'doctr', 'true', "", False, True, False),
+ ('master', 'doctr', 'false', "", False, True, False),
+ ('master', 'master', 'true', "", False, True, False),
+ ('master', 'master', 'false', "", False, True, True),
+ ('doctr', 'doctr', 'True', "", False, True, False),
+ ('doctr', 'doctr', 'false', "", False, True, True),
+ ('set()', 'doctr', 'false', "", False, True, False),
+
+ ('master', 'doctr', 'true', "tagname", False, True, True),
+ ('master', 'doctr', 'false', "tagname", False, True, True),
+ ('master', 'master', 'true', "tagname", False, True, True),
+ ('master', 'master', 'false', "tagname", False, True, True),
+ ('doctr', 'doctr', 'True', "tagname", False, True, True),
+ ('doctr', 'doctr', 'false', "tagname", False, True, True),
+ ('set()', 'doctr', 'false', "tagname", False, True, True),
+
+ ('master', 'doctr', 'true', "", True, False, False),
+ ('master', 'doctr', 'false', "", True, False, False),
+ ('master', 'master', 'true', "", True, False, False),
+ ('master', 'master', 'false', "", True, False, False),
+ ('doctr', 'doctr', 'True', "", True, False, False),
+ ('doctr', 'doctr', 'false', "", True, False, False),
+ ('set()', 'doctr', 'false', "", True, False, False),
])
def test_determine_push_rights(branch_whitelist, TRAVIS_BRANCH,
- TRAVIS_PULL_REQUEST, TRAVIS_TAG, build_tags, canpush, monkeypatch):
+ TRAVIS_PULL_REQUEST, TRAVIS_TAG, build_tags, fork, canpush, monkeypatch):
branch_whitelist = {branch_whitelist}
assert determine_push_rights(
@@ -268,6 +313,7 @@ def test_determine_push_rights(branch_whitelist, TRAVIS_BRANCH,
TRAVIS_BRANCH=TRAVIS_BRANCH,
TRAVIS_PULL_REQUEST=TRAVIS_PULL_REQUEST,
TRAVIS_TAG=TRAVIS_TAG,
+ fork=fork,
build_tags=build_tags) == canpush
@pytest.mark.parametrize("src", ["src", "."])
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 2
}
|
1.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
cryptography==44.0.2
-e git+https://github.com/drdoctr/doctr.git@3d81f52da6c52b0e062a3c7c5d179cc062287a6b#egg=doctr
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
packaging==24.2
pluggy==1.5.0
pycparser==2.22
pytest==8.3.5
PyYAML==6.0.2
requests==2.32.3
tomli==2.2.1
urllib3==2.3.0
|
name: doctr
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- cryptography==44.0.2
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- packaging==24.2
- pluggy==1.5.0
- pycparser==2.22
- pytest==8.3.5
- pyyaml==6.0.2
- requests==2.32.3
- tomli==2.2.1
- urllib3==2.3.0
prefix: /opt/conda/envs/doctr
|
[
"doctr/tests/test_travis.py::test_sync_from_log_file_to_dir[dst]",
"doctr/tests/test_travis.py::test_sync_from_log_file_to_dir[dst/]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-true--False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-false--False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-true--False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-false--False-False-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-True--False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-false--False-False-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[set()-doctr-false--False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-true-tagname-False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-false-tagname-False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-true-tagname-False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-false-tagname-False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-True-tagname-False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-false-tagname-False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[set()-doctr-false-tagname-False-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-true--False-True-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-false--False-True-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-true--False-True-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-false--False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-True--False-True-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-false--False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[set()-doctr-false--False-True-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-true-tagname-False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-false-tagname-False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-true-tagname-False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-false-tagname-False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-True-tagname-False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-false-tagname-False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[set()-doctr-false-tagname-False-True-True]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-true--True-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-doctr-false--True-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-true--True-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[master-master-false--True-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-True--True-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[doctr-doctr-false--True-False-False]",
"doctr/tests/test_travis.py::test_determine_push_rights[set()-doctr-false--True-False-False]"
] |
[
"doctr/tests/test_local.py::test_travis_bad_user",
"doctr/tests/test_local.py::test_travis_bad_repo",
"doctr/tests/test_local.py::test_travis_repo_exists"
] |
[
"doctr/tests/test_local.py::test_GIT_URL",
"doctr/tests/test_travis.py::test_sync_from_log[.-src]",
"doctr/tests/test_travis.py::test_sync_from_log[dst-src]",
"doctr/tests/test_travis.py::test_copy_to_tmp[src]",
"doctr/tests/test_travis.py::test_copy_to_tmp[.]"
] |
[] |
MIT License
| 3,268 |
[
".travis.yml",
"doctr/travis.py"
] |
[
".travis.yml",
"doctr/travis.py"
] |
|
seequent__pure_interface-30
|
d5c56fabe1bdf4d1f0f5835a0382949cef2497f9
|
2018-10-18 23:57:49
|
3c26b3ac10ed81fbd49eab936142498269d3b810
|
diff --git a/pure_interface.py b/pure_interface.py
index 78b5254..0324fdb 100644
--- a/pure_interface.py
+++ b/pure_interface.py
@@ -91,6 +91,28 @@ class _PIAttributes(object):
return self.interface_method_names.union(self.interface_attribute_names)
+class AttributeProperty(object):
+ """ Property that stores it's value in the instance dict under the same name.
+ Abstract properties for concrete classes are replaced with these in the type definition to allow
+ implementations to use attributes.
+ """
+
+ def __init__(self, name):
+ self.name = name
+ super(AttributeProperty, self).__init__()
+
+ def __get__(self, instance, owner):
+ if instance is None:
+ return self
+ try:
+ return instance.__dict__[self.name]
+ except KeyError:
+ raise AttributeError(self.name)
+
+ def __set__(self, instance, value):
+ instance.__dict__[self.name] = value
+
+
class _ImplementationWrapper(object):
def __init__(self, implementation, interface):
self.__impl = implementation
@@ -243,7 +265,7 @@ def _get_instructions(code_obj):
def _is_descriptor(obj): # in our context we only care about __get__
- return hasattr(obj, '__get__') and not isinstance(obj, types.FunctionType)
+ return hasattr(obj, '__get__')
def _signature_info(arg_spec):
|
functions are not removed from abstractproperties
This is not a biggie, but it does mean that they are checked for at instantiation.
|
seequent/pure_interface
|
diff --git a/tests/test_implementation_checks.py b/tests/test_implementation_checks.py
index 2698387..77a355d 100644
--- a/tests/test_implementation_checks.py
+++ b/tests/test_implementation_checks.py
@@ -514,6 +514,19 @@ class TestAttributeImplementations(unittest.TestCase):
except:
self.fail('Instantiation with property that raises failed')
+ def test_attr_overridden_with_func(self):
+ # forgotten @property decorator
+ try:
+ class Function(pure_interface.Concrete, IAttribute):
+ def a(self):
+ return 2
+
+ Function()
+ except:
+ self.fail('Overriding attribute with function should not crash')
+
+ self.assertEqual(frozenset(), Function._pi.abstractproperties)
+
py_36_tests = """
def test_annotations(self):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 2
},
"num_modified_files": 1
}
|
3.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"mock",
"pycontracts",
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
decorator==5.1.1
future==1.0.0
importlib-metadata==4.8.3
iniconfig==1.1.1
mock==5.2.0
packaging==21.3
pluggy==1.0.0
-e git+https://github.com/seequent/pure_interface.git@d5c56fabe1bdf4d1f0f5835a0382949cef2497f9#egg=pure_interface
py==1.11.0
PyContracts==1.8.12
pyparsing==3.1.4
pytest==7.0.1
six==1.17.0
tomli==1.2.3
typing==3.7.4.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: pure_interface
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- decorator==5.1.1
- future==1.0.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- mock==5.2.0
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pycontracts==1.8.12
- pyparsing==3.1.4
- pytest==7.0.1
- six==1.17.0
- tomli==1.2.3
- typing==3.7.4.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/pure_interface
|
[
"tests/test_implementation_checks.py::TestAttributeImplementations::test_attr_overridden_with_func"
] |
[] |
[
"tests/test_implementation_checks.py::TestImplementationChecks::test_can_override_func_with_descriptor",
"tests/test_implementation_checks.py::TestImplementationChecks::test_can_use_type_methods",
"tests/test_implementation_checks.py::TestImplementationChecks::test_concrete_abc_detection",
"tests/test_implementation_checks.py::TestImplementationChecks::test_concrete_base_detection",
"tests/test_implementation_checks.py::TestImplementationChecks::test_concrete_base_detection2",
"tests/test_implementation_checks.py::TestImplementationChecks::test_decorators_not_unwrapped",
"tests/test_implementation_checks.py::TestImplementationChecks::test_instantiation_fails",
"tests/test_implementation_checks.py::TestImplementationChecks::test_interface_abc_detection",
"tests/test_implementation_checks.py::TestImplementationChecks::test_is_development_flag_stops_warnings",
"tests/test_implementation_checks.py::TestImplementationChecks::test_missing_methods_warning",
"tests/test_implementation_checks.py::TestImplementationChecks::test_partial_implementation_attribute",
"tests/test_implementation_checks.py::TestImplementationChecks::test_partial_implementation_warning",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_abstract_attribute_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_abstract_property_is_cleared",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_abstract_property_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_attribute_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_class_and_static_methods",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_getattr_property_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_missing_abstract_property_fails",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_missing_property_fails",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_missing_property_subclass_fails",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_property_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_abstract_attribute_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_abstract_attribute_override_passes3",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_abstract_property_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_abstract_property_override_passes3",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_attribute_override_passes",
"tests/test_implementation_checks.py::TestPropertyImplementations::test_ro_property_override_passes",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_annotations",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_in_dir",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_in_interface",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_is_removed",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_is_required",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_must_be_none",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_class_attribute_passes",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_instance_attribute_passes",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_mock_spec_includes_attrs",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_property_passes",
"tests/test_implementation_checks.py::TestAttributeImplementations::test_raising_property",
"tests/test_implementation_checks.py::TestCrossImplementations::test_cross_implementations"
] |
[] |
MIT License
| 3,269 |
[
"pure_interface.py"
] |
[
"pure_interface.py"
] |
|
seequent__pure_interface-31
|
3c26b3ac10ed81fbd49eab936142498269d3b810
|
2018-10-19 00:16:23
|
3c26b3ac10ed81fbd49eab936142498269d3b810
|
diff --git a/README.rst b/README.rst
index 14a8b6b..3fa08d2 100644
--- a/README.rst
+++ b/README.rst
@@ -290,6 +290,14 @@ using ``filter_adapt(objects)``::
list(ISpeaker.filter_adapt([None, Talker(), a_speaker, 'text']) --> [TalkerToSpeaker, a_speaker]
+To adapt an object only if it is not ``None`` then use::
+
+ ISpeaker.optional_adapt(optional_talker)
+
+This is equivalent to::
+
+ ISpeaker.adapt(optional_talker) if optional_talker is not None else None
+
By default the adaption functions will return an object which provides **only**
the functions and properties specified by the interface. For example given the
following implementation of the ``ISpeaker`` interface above::
@@ -485,6 +493,10 @@ Classes
**adapt_or_none** *(obj, allow_implicit=False, interface_only=None)*
As per **adapt()** except returns ``None`` instead of raising a ``ValueError``
+ **optional_adapt** *(obj, allow_implicit=False, interface_only=None)*
+ Adapts obj to this interface if it is not ``None`` returning ``None`` otherwise.
+ Short-cut for ``adapt(obj) if obj is not None else None``
+
**can_adapt** *(obj, allow_implicit=False)*
Returns ``True`` if ``adapt(obj, allow_implicit)`` will succeed. Short-cut for
``adapt_or_none(obj) is not None``
diff --git a/pure_interface.py b/pure_interface.py
index 9ecb7fd..4ecb744 100644
--- a/pure_interface.py
+++ b/pure_interface.py
@@ -38,7 +38,7 @@ else:
super(abstractstaticmethod, self).__init__(callable)
-__version__ = '3.2.0'
+__version__ = '3.3.0'
is_development = not hasattr(sys, 'frozen')
@@ -616,6 +616,14 @@ class PureInterface(ABC):
adapted = cls.interface_only(adapted)
return adapted
+ @classmethod
+ def optional_adapt(cls, obj, allow_implicit=False, interface_only=None):
+ # type: (Type[PI], Any, bool, Optional[bool]) -> Optional[PI]
+ """ Adapt obj to to_interface or return None if adaption fails """
+ if obj is None:
+ return None
+ return cls.adapt(obj, allow_implicit=allow_implicit, interface_only=interface_only)
+
@classmethod
def adapt_or_none(cls, obj, allow_implicit=False, interface_only=None):
# type: (Type[PI], Any, bool, Optional[bool]) -> Optional[PI]
diff --git a/setup.py b/setup.py
index af5d976..e4ef140 100644
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
setup(
name='pure_interface',
- version='3.2.0',
+ version='3.3.0',
py_modules=['pure_interface', 'pure_contracts'],
url='https://github.com/aranzgeo/pure_interface',
install_requires=['six', 'typing'],
|
Add optional_adapt() function
This idiom is quite common
`obj = Interface.adapt(obj) if obj is not None else None`
create `optional_adapt(obj)` to replace it.
`optional_adapt(obj)` should adapt obj if it is not None.
|
seequent/pure_interface
|
diff --git a/tests/test_adaption.py b/tests/test_adaption.py
index d9541cc..5611957 100644
--- a/tests/test_adaption.py
+++ b/tests/test_adaption.py
@@ -4,6 +4,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
import pure_interface
import unittest
+import mock
class ISpeaker(pure_interface.PureInterface):
@@ -310,3 +311,15 @@ class TestAdaptionToInterfaceOnly(unittest.TestCase):
a = IA.adapt_or_none(4, interface_only=False)
self.assertIsInstance(a, IntToA)
+ def test_optional_adapt(self):
+ a_speaker = Speaker()
+ allow = object()
+ interface_only = object()
+ with mock.patch('pure_interface.PureInterface.adapt') as adapt:
+ # act
+ s = ISpeaker.optional_adapt(a_speaker, allow_implicit=allow, interface_only=interface_only)
+ none = ISpeaker.optional_adapt(None, allow_implicit=allow, interface_only=interface_only)
+ # assert
+ adapt.assert_called_once_with(a_speaker, allow_implicit=allow, interface_only=interface_only)
+ self.assertIs(s, adapt.return_value)
+ self.assertIsNone(none, 'optional_adapt(None) did not return None')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 1
},
"num_modified_files": 3
}
|
3.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"mock",
"pycontracts"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
decorator==5.2.1
exceptiongroup==1.2.2
future==1.0.0
iniconfig==2.1.0
mock==5.2.0
packaging==24.2
pluggy==1.5.0
-e git+https://github.com/seequent/pure_interface.git@3c26b3ac10ed81fbd49eab936142498269d3b810#egg=pure_interface
PyContracts==1.8.12
pyparsing==3.2.3
pytest==8.3.5
six==1.17.0
tomli==2.2.1
typing==3.7.4.3
|
name: pure_interface
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- decorator==5.2.1
- exceptiongroup==1.2.2
- future==1.0.0
- iniconfig==2.1.0
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pycontracts==1.8.12
- pyparsing==3.2.3
- pytest==8.3.5
- six==1.17.0
- tomli==2.2.1
- typing==3.7.4.3
prefix: /opt/conda/envs/pure_interface
|
[
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_optional_adapt"
] |
[] |
[
"tests/test_adaption.py::TestAdaption::test_adapt_on_class_works",
"tests/test_adaption.py::TestAdaption::test_adapt_to_interface_or_none",
"tests/test_adaption.py::TestAdaption::test_adapt_to_interface_raises",
"tests/test_adaption.py::TestAdaption::test_adapter_call_check",
"tests/test_adaption.py::TestAdaption::test_adapter_check",
"tests/test_adaption.py::TestAdaption::test_adaption_passes",
"tests/test_adaption.py::TestAdaption::test_callable_adapter_passes",
"tests/test_adaption.py::TestAdaption::test_filter_adapt",
"tests/test_adaption.py::TestAdaption::test_from_type_check",
"tests/test_adaption.py::TestAdaption::test_implicit_adapter",
"tests/test_adaption.py::TestAdaption::test_implicit_filter_adapt",
"tests/test_adaption.py::TestAdaption::test_no_interface_on_class_raises",
"tests/test_adaption.py::TestAdaption::test_to_interface_check",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_adapt_to_interface_or_none",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_adapter_preference",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_adapter_to_sub_interface_used",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_callable_adapter_passes",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_filter_adapt",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_implicit_adapter_passes",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_implicit_filter_adapt",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_wrapping_works",
"tests/test_adaption.py::TestAdaptionToInterfaceOnly::test_wrapping_works2"
] |
[] |
MIT License
| 3,270 |
[
"README.rst",
"pure_interface.py",
"setup.py"
] |
[
"README.rst",
"pure_interface.py",
"setup.py"
] |
|
conan-io__conan-3795
|
16984450b4cd07ff9ea1d4758e26e6d141a38cf8
|
2018-10-19 08:04:27
|
2a9f3d734d7a4607d1db2ff8130425d3220e0e31
|
diff --git a/conans/__init__.py b/conans/__init__.py
index c5564cfc9..d6bb0a50f 100644
--- a/conans/__init__.py
+++ b/conans/__init__.py
@@ -19,4 +19,3 @@ REVISIONS = "revisions" # Only when enabled in config, not by default look at s
SERVER_CAPABILITIES = [COMPLEX_SEARCH_CAPABILITY, ] # Still without v2 because it is changing
__version__ = '1.9.0-dev'
-
diff --git a/conans/client/cmd/build.py b/conans/client/cmd/build.py
new file mode 100644
index 000000000..2b5f59278
--- /dev/null
+++ b/conans/client/cmd/build.py
@@ -0,0 +1,70 @@
+import os
+
+from conans.client.output import ScopedOutput
+from conans.util.log import logger
+from conans.errors import (NotFoundException, ConanException,
+ conanfile_exception_formatter)
+from conans.paths import CONANFILE, CONANFILE_TXT
+from conans.util.files import mkdir
+from conans.model.conan_file import get_env_context_manager
+
+
+def build(graph_manager, plugin_manager, conanfile_path, output,
+ source_folder, build_folder, package_folder, install_folder,
+ test=False, should_configure=True, should_build=True, should_install=True,
+ should_test=True):
+ """ Call to build() method saved on the conanfile.py
+ param conanfile_path: path to a conanfile.py
+ """
+ logger.debug("Building in %s" % build_folder)
+ logger.debug("Conanfile in %s" % conanfile_path)
+
+ try:
+ # Append env_vars to execution environment and clear when block code ends
+ output = ScopedOutput(("%s (test package)" % test) if test else "Project",
+ output)
+ conan_file = graph_manager.load_consumer_conanfile(conanfile_path, install_folder,
+ output, deps_info_required=True)
+ except NotFoundException:
+ # TODO: Auto generate conanfile from requirements file
+ raise ConanException("'%s' file is needed for build.\n"
+ "Create a '%s' and move manually the "
+ "requirements and generators from '%s' file"
+ % (CONANFILE, CONANFILE, CONANFILE_TXT))
+
+ if test:
+ try:
+ conan_file.requires.add(test)
+ except ConanException:
+ pass
+
+ conan_file.should_configure = should_configure
+ conan_file.should_build = should_build
+ conan_file.should_install = should_install
+ conan_file.should_test = should_test
+
+ try:
+ mkdir(build_folder)
+ os.chdir(build_folder)
+ conan_file.build_folder = build_folder
+ conan_file.source_folder = source_folder
+ conan_file.package_folder = package_folder
+ conan_file.install_folder = install_folder
+ plugin_manager.execute("pre_build", conanfile=conan_file,
+ conanfile_path=conanfile_path)
+ with get_env_context_manager(conan_file):
+ output.highlight("Running build()")
+ with conanfile_exception_formatter(str(conan_file), "build"):
+ conan_file.build()
+ plugin_manager.execute("post_build", conanfile=conan_file,
+ conanfile_path=conanfile_path)
+ if test:
+ output.highlight("Running test()")
+ with conanfile_exception_formatter(str(conan_file), "test"):
+ conan_file.test()
+ except ConanException:
+ raise # Raise but not let to reach the Exception except (not print traceback)
+ except Exception:
+ import traceback
+ trace = traceback.format_exc().split('\n')
+ raise ConanException("Unable to build it successfully\n%s" % '\n'.join(trace[3:]))
diff --git a/conans/client/cmd/export_pkg.py b/conans/client/cmd/export_pkg.py
new file mode 100644
index 000000000..d5ccbe8ae
--- /dev/null
+++ b/conans/client/cmd/export_pkg.py
@@ -0,0 +1,52 @@
+import os
+
+from conans.client.output import ScopedOutput
+from conans.client import packager
+from conans.errors import ConanException
+
+from conans.util.files import rmdir
+from conans.model.ref import PackageReference
+from conans.client.graph.graph_manager import load_deps_info
+
+
+def export_pkg(client_cache, graph_manager, plugin_manager, recorder, output,
+ reference, source_folder, build_folder, package_folder, install_folder,
+ profile, force):
+
+ conan_file_path = client_cache.conanfile(reference)
+ if not os.path.exists(conan_file_path):
+ raise ConanException("Package recipe '%s' does not exist" % str(reference))
+
+ deps_graph = graph_manager.load_simple_graph(reference, profile, recorder)
+
+ # this is a bit tricky, but works. The root (virtual), has only 1 neighbor,
+ # which is the exported pkg
+ nodes = deps_graph.root.neighbors()
+ conanfile = nodes[0].conanfile
+ from conans.client.conan_api import existing_info_files
+ if install_folder and existing_info_files(install_folder):
+ load_deps_info(install_folder, conanfile, required=True)
+ pkg_id = conanfile.info.package_id()
+ output.info("Packaging to %s" % pkg_id)
+ pkg_reference = PackageReference(reference, pkg_id)
+ dest_package_folder = client_cache.package(pkg_reference,
+ short_paths=conanfile.short_paths)
+
+ if os.path.exists(dest_package_folder):
+ if force:
+ rmdir(dest_package_folder)
+ else:
+ raise ConanException("Package already exists. Please use --force, -f to "
+ "overwrite it")
+
+ recipe_hash = client_cache.load_manifest(reference).summary_hash
+ conanfile.info.recipe_hash = recipe_hash
+ conanfile.develop = True
+ package_output = ScopedOutput(str(reference), output)
+ if package_folder:
+ packager.export_pkg(conanfile, pkg_id, package_folder, dest_package_folder,
+ package_output, plugin_manager, conan_file_path, reference)
+ else:
+ packager.create_package(conanfile, pkg_id, source_folder, build_folder,
+ dest_package_folder, install_folder, package_output,
+ plugin_manager, conan_file_path, reference, local=True)
diff --git a/conans/client/cmd/uploader.py b/conans/client/cmd/uploader.py
index 7cf31eebc..e81fd1a83 100644
--- a/conans/client/cmd/uploader.py
+++ b/conans/client/cmd/uploader.py
@@ -1,9 +1,10 @@
+import os
import time
-
from conans.client.source import complete_recipe_sources
from conans.errors import ConanException, NotFoundException
from conans.model.ref import PackageReference, ConanFileReference
from conans.search.search import search_recipes, search_packages
+from conans.util.files import load
from conans.util.log import logger
@@ -167,8 +168,31 @@ class CmdUpload(object):
if (remote_recipe_manifest != local_manifest and
remote_recipe_manifest.time > local_manifest.time):
+ self._print_manifest_information(remote_recipe_manifest, local_manifest, conan_ref, remote)
raise ConanException("Remote recipe is newer than local recipe: "
"\n Remote date: %s\n Local date: %s" %
(remote_recipe_manifest.time, local_manifest.time))
return remote_recipe_manifest
+
+ def _print_manifest_information(self, remote_recipe_manifest, local_manifest, conan_ref, remote):
+ try:
+ self._user_io.out.info("\n%s" % ("-"*40))
+ self._user_io.out.info("Remote manifest:")
+ self._user_io.out.info(remote_recipe_manifest)
+ self._user_io.out.info("Local manifest:")
+ self._user_io.out.info(local_manifest)
+ difference = remote_recipe_manifest.difference(local_manifest)
+ if "conanfile.py" in difference:
+ contents = load(os.path.join(self._client_cache.export(conan_ref),
+ "conanfile.py"))
+ endlines = "\\r\\n" if "\r\n" in contents else "\\n"
+ self._user_io.out.info("Local 'conanfile.py' using '%s' line-ends" % endlines)
+ remote_contents = self._remote_manager.get_path(conan_ref, package_id=None,
+ path="conanfile.py", remote=remote)
+ endlines = "\\r\\n" if "\r\n" in remote_contents else "\\n"
+ self._user_io.out.info("Remote 'conanfile.py' using '%s' line-ends" % endlines)
+ self._user_io.out.info("\n%s" % ("-"*40))
+ except Exception as e:
+ self._user_io.out.info("Error printing information about the diff: %s" % str(e))
+
diff --git a/conans/client/conan_api.py b/conans/client/conan_api.py
index 1c25e4696..f068b4e64 100644
--- a/conans/client/conan_api.py
+++ b/conans/client/conan_api.py
@@ -11,9 +11,9 @@ from conans.client.plugin_manager import PluginManager
from conans.client.recorder.action_recorder import ActionRecorder
from conans.client.client_cache import ClientCache
from conans.client.conf import MIN_SERVER_COMPATIBLE_VERSION, ConanClientConfigParser
-from conans.client.manager import ConanManager, existing_info_files
+from conans.client.manager import ConanManager
from conans.client.migrations import ClientMigrator
-from conans.client.output import ConanOutput
+from conans.client.output import ConanOutput, ScopedOutput
from conans.client.profile_loader import read_profile, profile_from_args, \
read_conaninfo_profile
from conans.client.recorder.search_recorder import SearchRecorder
@@ -42,8 +42,8 @@ from conans.client.cmd.profile import cmd_profile_update, cmd_profile_get,\
cmd_profile_delete_key, cmd_profile_create, cmd_profile_list
from conans.client.cmd.search import Search
from conans.client.cmd.user import users_clean, users_list, user_set
-from conans.client.importer import undo_imports
-from conans.client.cmd.export import cmd_export, export_alias
+from conans.client.importer import undo_imports, run_imports
+from conans.client.cmd.export import cmd_export, export_alias, _execute_export
from conans.unicode import get_cwd
from conans.client.remover import ConanRemover
from conans.client.cmd.download import download
@@ -53,6 +53,10 @@ from conans.client.loader import ConanFileLoader
from conans.client.graph.proxy import ConanProxy
from conans.client.graph.python_requires import ConanPythonRequire
from conans.client.graph.range_resolver import RangeResolver
+from conans.client import packager
+from conans.client.source import config_source_local
+from conans.client.cmd.build import build
+from conans.client.cmd.export_pkg import export_pkg
default_manifest_folder = '.conan_manifests'
@@ -398,14 +402,8 @@ class ConanAPIV1(object):
source_folder = _make_abs_path(source_folder, cwd, default=os.path.dirname(conanfile_path))
# Checks that no both settings and info files are specified
- if install_folder and existing_info_files(install_folder) and \
- (profile_name or settings or options or env):
- raise ConanException("%s and %s are found, at '%s' folder, so specifying profile, "
- "settings, options or env is not allowed" % (CONANINFO, BUILD_INFO,
- install_folder))
-
infos_present = existing_info_files(install_folder)
- if not infos_present:
+ if profile_name or settings or options or env or not infos_present:
profile = profile_from_args(profile_name, settings, options, env=env,
cwd=cwd, client_cache=self._client_cache)
else:
@@ -416,10 +414,11 @@ class ConanAPIV1(object):
self._client_cache, self._plugin_manager, self._registry)
recorder = ActionRecorder()
- manager = self._init_manager(recorder)
- manager.export_pkg(reference, source_folder=source_folder, build_folder=build_folder,
- package_folder=package_folder, install_folder=install_folder,
- profile=profile, force=force)
+ export_pkg(self._client_cache, self._graph_manager, self._plugin_manager, recorder,
+ self._user_io.out,
+ reference, source_folder=source_folder, build_folder=build_folder,
+ package_folder=package_folder, install_folder=install_folder,
+ profile=profile, force=force)
@api_method
def download(self, reference, remote_name=None, package=None, recipe=False):
@@ -610,11 +609,10 @@ class ConanAPIV1(object):
default_pkg_folder = os.path.join(build_folder, "package")
package_folder = _make_abs_path(package_folder, cwd, default=default_pkg_folder)
- recorder = ActionRecorder()
- manager = self._init_manager(recorder)
- manager.build(conanfile_path, source_folder, build_folder, package_folder,
- install_folder, should_configure=should_configure, should_build=should_build,
- should_install=should_install, should_test=should_test)
+ build(self._graph_manager, self._plugin_manager, conanfile_path, self._user_io.out,
+ source_folder, build_folder, package_folder, install_folder,
+ should_configure=should_configure, should_build=should_build,
+ should_install=should_install, should_test=should_test)
@api_method
def package(self, path, build_folder, package_folder, source_folder=None, install_folder=None,
@@ -627,10 +625,15 @@ class ConanAPIV1(object):
default_pkg_folder = os.path.join(build_folder, "package")
package_folder = _make_abs_path(package_folder, cwd, default=default_pkg_folder)
- recorder = ActionRecorder()
- manager = self._init_manager(recorder)
- manager.local_package(package_folder, conanfile_path, build_folder, source_folder,
- install_folder)
+ if package_folder == build_folder:
+ raise ConanException("Cannot 'conan package' to the build folder. "
+ "--build-folder and package folder can't be the same")
+ output = ScopedOutput("PROJECT", self._user_io.out)
+ conanfile = self._graph_manager.load_consumer_conanfile(conanfile_path, install_folder,
+ output, deps_info_required=True)
+ packager.create_package(conanfile, None, source_folder, build_folder, package_folder,
+ install_folder, output, self._plugin_manager, conanfile_path, None,
+ local=True, copy_info=True)
@api_method
def source(self, path, source_folder=None, info_folder=None, cwd=None):
@@ -643,9 +646,15 @@ class ConanAPIV1(object):
if not os.path.exists(info_folder):
raise ConanException("Specified info-folder doesn't exist")
- recorder = ActionRecorder()
- manager = self._init_manager(recorder)
- manager.source(conanfile_path, source_folder, info_folder)
+ output = ScopedOutput("PROJECT", self._user_io.out)
+ # only infos if exist
+ conanfile = self._graph_manager.load_consumer_conanfile(conanfile_path, info_folder, output)
+ conanfile_folder = os.path.dirname(conanfile_path)
+ if conanfile_folder != source_folder:
+ output.info("Executing exports to: %s" % source_folder)
+ _execute_export(conanfile_path, conanfile, source_folder, source_folder, output)
+ config_source_local(source_folder, conanfile, conanfile_folder, output, conanfile_path,
+ self._plugin_manager)
@api_method
def imports(self, path, dest=None, info_folder=None, cwd=None):
@@ -662,9 +671,10 @@ class ConanAPIV1(object):
mkdir(dest)
conanfile_abs_path = _get_conanfile_path(path, cwd, py=None)
- recorder = ActionRecorder()
- manager = self._init_manager(recorder)
- manager.imports(conanfile_abs_path, dest, info_folder)
+ output = ScopedOutput("PROJECT", self._user_io.out)
+ conanfile = self._graph_manager.load_consumer_conanfile(conanfile_abs_path, info_folder,
+ output, deps_info_required=True)
+ run_imports(conanfile, dest, output)
@api_method
def imports_undo(self, manifest_path):
@@ -935,6 +945,11 @@ def _parse_manifests_arguments(verify, manifests, manifests_interactive, cwd):
return manifest_folder, manifest_interactive, manifest_verify
+def existing_info_files(folder):
+ return os.path.exists(os.path.join(folder, CONANINFO)) and \
+ os.path.exists(os.path.join(folder, BUILD_INFO))
+
+
def get_conan_runner():
print_commands_to_output = get_env("CONAN_PRINT_RUN_COMMANDS", False)
generate_run_log_file = get_env("CONAN_LOG_RUN_TO_FILE", False)
diff --git a/conans/client/manager.py b/conans/client/manager.py
index 500f6e201..75f9f3fd8 100644
--- a/conans/client/manager.py
+++ b/conans/client/manager.py
@@ -1,23 +1,19 @@
import os
-from conans.client import packager
from conans.client.client_cache import ClientCache
-from conans.client.cmd.export import _execute_export
from conans.client.generators import write_generators
from conans.client.importer import run_imports, run_deploy
from conans.client.installer import ConanInstaller, call_system_requirements
from conans.client.manifest_manager import ManifestManager
from conans.client.output import ScopedOutput, Color
-from conans.client.source import config_source_local, complete_recipe_sources
+from conans.client.source import complete_recipe_sources
from conans.client.tools import cross_building, get_cross_building_settings
from conans.client.userio import UserIO
-from conans.errors import NotFoundException, ConanException, conanfile_exception_formatter
-from conans.model.conan_file import get_env_context_manager
-from conans.model.ref import ConanFileReference, PackageReference
-from conans.paths import CONANFILE, CONANINFO, CONANFILE_TXT, BUILD_INFO
-from conans.util.files import save, rmdir, normalize, mkdir
-from conans.util.log import logger
-from conans.client.graph.graph_manager import load_deps_info
+from conans.errors import ConanException
+from conans.model.ref import ConanFileReference
+from conans.paths import CONANINFO
+from conans.util.files import save, normalize
+
from conans.client.graph.printer import print_graph
@@ -38,46 +34,6 @@ class ConanManager(object):
self._graph_manager = graph_manager
self._plugin_manager = plugin_manager
- def export_pkg(self, reference, source_folder, build_folder, package_folder, install_folder,
- profile, force):
-
- conan_file_path = self._client_cache.conanfile(reference)
- if not os.path.exists(conan_file_path):
- raise ConanException("Package recipe '%s' does not exist" % str(reference))
-
- deps_graph = self._graph_manager.load_simple_graph(reference, profile, self._recorder)
-
- # this is a bit tricky, but works. The root (virtual), has only 1 neighbor,
- # which is the exported pkg
- nodes = deps_graph.root.neighbors()
- conanfile = nodes[0].conanfile
- if install_folder and existing_info_files(install_folder):
- load_deps_info(install_folder, conanfile, required=True)
- pkg_id = conanfile.info.package_id()
- self._user_io.out.info("Packaging to %s" % pkg_id)
- pkg_reference = PackageReference(reference, pkg_id)
- dest_package_folder = self._client_cache.package(pkg_reference,
- short_paths=conanfile.short_paths)
-
- if os.path.exists(dest_package_folder):
- if force:
- rmdir(dest_package_folder)
- else:
- raise ConanException("Package already exists. Please use --force, -f to "
- "overwrite it")
-
- recipe_hash = self._client_cache.load_manifest(reference).summary_hash
- conanfile.info.recipe_hash = recipe_hash
- conanfile.develop = True
- package_output = ScopedOutput(str(reference), self._user_io.out)
- if package_folder:
- packager.export_pkg(conanfile, pkg_id, package_folder, dest_package_folder,
- package_output, self._plugin_manager, conan_file_path, reference)
- else:
- packager.create_package(conanfile, pkg_id, source_folder, build_folder,
- dest_package_folder, install_folder, package_output,
- self._plugin_manager, conan_file_path, reference, local=True)
-
def install_workspace(self, profile, workspace, remote_name, build_modes, update):
references = [ConanFileReference(v, "root", "project", "develop") for v in workspace.root]
deps_graph, _, _ = self._graph_manager.load_graph(references, None, profile, build_modes,
@@ -184,110 +140,3 @@ class ConanManager(object):
deploy_conanfile = neighbours[0].conanfile
if hasattr(deploy_conanfile, "deploy") and callable(deploy_conanfile.deploy):
run_deploy(deploy_conanfile, install_folder, output)
-
- def source(self, conanfile_path, source_folder, info_folder):
- """
- :param conanfile_path: Absolute path to a conanfile
- :param source_folder: Absolute path where to put the files
- :param info_folder: Absolute path where to read the info files
- :param package_folder: Absolute path to the package_folder, only to have the var present
- :return:
- """
- output = ScopedOutput("PROJECT", self._user_io.out)
- # only infos if exist
- conanfile = self._graph_manager.load_consumer_conanfile(conanfile_path, info_folder, output)
- conanfile_folder = os.path.dirname(conanfile_path)
- if conanfile_folder != source_folder:
- output.info("Executing exports to: %s" % source_folder)
- _execute_export(conanfile_path, conanfile, source_folder, source_folder, output)
- config_source_local(source_folder, conanfile, conanfile_folder, output, conanfile_path,
- self._plugin_manager)
-
- def imports(self, conan_file_path, dest_folder, info_folder):
- """
- :param conan_file_path: Abs path to a conanfile
- :param dest_folder: Folder where to put the files
- :param info_folder: Folder containing the conaninfo/conanbuildinfo.txt files
- :return:
- """
-
- output = ScopedOutput("PROJECT", self._user_io.out)
- conanfile = self._graph_manager.load_consumer_conanfile(conan_file_path, info_folder, output,
- deps_info_required=True)
- run_imports(conanfile, dest_folder, output)
-
- def local_package(self, package_folder, conanfile_path, build_folder, source_folder,
- install_folder):
- if package_folder == build_folder:
- raise ConanException("Cannot 'conan package' to the build folder. "
- "--build-folder and package folder can't be the same")
- output = ScopedOutput("PROJECT", self._user_io.out)
- conanfile = self._graph_manager.load_consumer_conanfile(conanfile_path, install_folder,
- output, deps_info_required=True)
- packager.create_package(conanfile, None, source_folder, build_folder, package_folder,
- install_folder, output, self._plugin_manager, conanfile_path, None,
- local=True, copy_info=True)
-
- def build(self, conanfile_path, source_folder, build_folder, package_folder, install_folder,
- test=False, should_configure=True, should_build=True, should_install=True,
- should_test=True):
- """ Call to build() method saved on the conanfile.py
- param conanfile_path: path to a conanfile.py
- """
- logger.debug("Building in %s" % build_folder)
- logger.debug("Conanfile in %s" % conanfile_path)
-
- try:
- # Append env_vars to execution environment and clear when block code ends
- output = ScopedOutput(("%s (test package)" % test) if test else "Project",
- self._user_io.out)
- conan_file = self._graph_manager.load_consumer_conanfile(conanfile_path, install_folder,
- output, deps_info_required=True)
- except NotFoundException:
- # TODO: Auto generate conanfile from requirements file
- raise ConanException("'%s' file is needed for build.\n"
- "Create a '%s' and move manually the "
- "requirements and generators from '%s' file"
- % (CONANFILE, CONANFILE, CONANFILE_TXT))
-
- if test:
- try:
- conan_file.requires.add(test)
- except ConanException:
- pass
-
- conan_file.should_configure = should_configure
- conan_file.should_build = should_build
- conan_file.should_install = should_install
- conan_file.should_test = should_test
-
- try:
- mkdir(build_folder)
- os.chdir(build_folder)
- conan_file.build_folder = build_folder
- conan_file.source_folder = source_folder
- conan_file.package_folder = package_folder
- conan_file.install_folder = install_folder
- self._plugin_manager.execute("pre_build", conanfile=conan_file,
- conanfile_path=conanfile_path)
- with get_env_context_manager(conan_file):
- output.highlight("Running build()")
- with conanfile_exception_formatter(str(conan_file), "build"):
- conan_file.build()
- self._plugin_manager.execute("post_build", conanfile=conan_file,
- conanfile_path=conanfile_path)
- if test:
- output.highlight("Running test()")
- with conanfile_exception_formatter(str(conan_file), "test"):
- conan_file.test()
- except ConanException:
- raise # Raise but not let to reach the Exception except (not print traceback)
- except Exception:
- import traceback
- trace = traceback.format_exc().split('\n')
- raise ConanException("Unable to build it successfully\n%s" % '\n'.join(trace[3:]))
-
-
-def existing_info_files(folder):
- return os.path.exists(os.path.join(folder, CONANINFO)) and \
- os.path.exists(os.path.join(folder, BUILD_INFO))
diff --git a/conans/client/packager.py b/conans/client/packager.py
index b439afd63..9b1914d7b 100644
--- a/conans/client/packager.py
+++ b/conans/client/packager.py
@@ -5,7 +5,8 @@ from conans.client import tools
from conans.util.files import mkdir, save, rmdir
from conans.util.log import logger
from conans.paths import CONANINFO
-from conans.errors import ConanException, ConanExceptionInUserConanfileMethod, conanfile_exception_formatter
+from conans.errors import (ConanException, ConanExceptionInUserConanfileMethod,
+ conanfile_exception_formatter)
from conans.model.manifest import FileTreeManifest
from conans.client.output import ScopedOutput
from conans.client.file_copier import FileCopier
@@ -17,7 +18,6 @@ def export_pkg(conanfile, pkg_id, src_package_folder, package_folder, output, pl
conanfile.package_folder = src_package_folder
output.info("Exporting to cache existing package from user folder")
output.info("Package folder %s" % package_folder)
- print("export_pkg", type(reference))
plugin_manager.execute("pre_package", conanfile=conanfile, conanfile_path=conanfile_path,
reference=reference, package_id=pkg_id)
diff --git a/conans/model/manifest.py b/conans/model/manifest.py
index dd70fc8f1..a710e8af7 100644
--- a/conans/model/manifest.py
+++ b/conans/model/manifest.py
@@ -1,10 +1,10 @@
-import os
import calendar
+import datetime
+import os
import time
-from conans.util.files import md5sum, md5, save, load, walk
-from conans.paths import PACKAGE_TGZ_NAME, EXPORT_TGZ_NAME, CONAN_MANIFEST, EXPORT_SOURCES_TGZ_NAME
from conans.errors import ConanException
-import datetime
+from conans.paths import PACKAGE_TGZ_NAME, EXPORT_TGZ_NAME, CONAN_MANIFEST, EXPORT_SOURCES_TGZ_NAME
+from conans.util.files import md5sum, md5, save, load, walk
def discarded_file(filename):
@@ -39,9 +39,9 @@ def gather_files(folder):
class FileTreeManifest(object):
- def __init__(self, time, file_sums):
+ def __init__(self, the_time, file_sums):
"""file_sums is a dict with filepaths and md5's: {filepath/to/file.txt: md5}"""
- self.time = time
+ self.time = the_time
self.file_sums = file_sums
def files(self):
@@ -63,14 +63,14 @@ class FileTreeManifest(object):
ConanDigest
"""
tokens = text.split("\n")
- time = int(tokens[0])
+ the_time = int(tokens[0])
file_sums = {}
for md5line in tokens[1:]:
if md5line:
filename, file_md5 = md5line.split(": ")
if not discarded_file(filename):
file_sums[filename] = file_md5
- return FileTreeManifest(time, file_sums)
+ return FileTreeManifest(the_time, file_sums)
@staticmethod
def load(folder):
@@ -78,16 +78,25 @@ class FileTreeManifest(object):
return FileTreeManifest.loads(text)
def __repr__(self):
- ret = ["%s" % (self.time)]
- for filepath, file_md5 in sorted(self.file_sums.items()):
- ret.append("%s: %s" % (filepath, file_md5))
+ ret = ["%s" % self.time]
+ for file_path, file_md5 in sorted(self.file_sums.items()):
+ ret.append("%s: %s" % (file_path, file_md5))
+ ret.append("")
+ content = "\n".join(ret)
+ return content
+
+ def __str__(self):
+ dt = datetime.datetime.utcfromtimestamp(self.time).strftime('%Y-%m-%d %H:%M:%S')
+ ret = ["Time: %s" % dt]
+ for file_path, file_md5 in sorted(self.file_sums.items()):
+ ret.append("%s, MD5: %s" % (file_path, file_md5))
ret.append("")
content = "\n".join(ret)
return content
def save(self, folder, filename=CONAN_MANIFEST):
path = os.path.join(folder, filename)
- save(path, str(self))
+ save(path, repr(self))
@classmethod
def create(cls, folder, exports_sources_folder=None):
diff --git a/conans/requirements.txt b/conans/requirements.txt
index ce691cf17..5b4a32db0 100644
--- a/conans/requirements.txt
+++ b/conans/requirements.txt
@@ -12,4 +12,4 @@ future==0.16.0
pygments>=2.0, <3.0
astroid>=1.6.5
deprecation>=2.0, <2.1
-tqdm>=4.27.0, <5.0
+tqdm-conan==4.27.0
diff --git a/conans/requirements_osx.txt b/conans/requirements_osx.txt
index b9de59ac6..39f2a5366 100644
--- a/conans/requirements_osx.txt
+++ b/conans/requirements_osx.txt
@@ -1,5 +1,3 @@
idna==2.6 # Solving conflict, somehow is installing 2.7 when requests require 2.6
cryptography>=1.3.4, <2.4.0
pyOpenSSL>=16.0.0, <18.0.0
-ndg-httpsclient>=0.4.1, <0.5.0
-pyasn>=1.5.0b7, <1.6.0
|
Private static library dependencies
To help us debug your issue please explain:
- [✅ ] I've read the [CONTRIBUTING guide](https://raw.githubusercontent.com/conan-io/conan/develop/.github/CONTRIBUTING.md).
- [✅ ] I've specified the Conan version, operating system version and any tool that can be relevant.
- [ ✅] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
I am having a problem I'll try to explain with the following example:
Let's have following packages that are all static libraries: `Aaa`, `Bbb`, `Ccc`, `Ddd` and `Ooo`. Also, let `Eee` be an executable that depends on `Ddd`.
Additionally, `Ddd` depends on `Ccc`, `Ccc` depends on `Bbb` and `Bbb` depends on `Aaa`.
`Aaa` has following conanfile:
```python
class AConan(ConanFile):
name = 'Aaa'
version = '1.0.0'
options = {
'use_o': [True, False]
}
default_options = {
'use_o': False
}
def requirements(self):
if self.options.use_o:
self.requires('Ooo/1.0.0@user/testing')
```
i.e. `A` has an option `use_o`, it depends on `Ooo` package. Otherwise, it does not have any dependencies.
Now, let's first build `Ooo` with `conan create` and then build both versions of `Aaa` - the version with default options and the version with `use_o=True`. This simulates what a CI server would do when building `Aaa` package.
Next, let's build packages `Bbb`, `Ccc` and `Ddd` in correct order, but using only default settings, as none of those packages care about `Aaa's` `use_o` parameter.
Now, when installing package `Eee` with `conan install` everything works OK, but if `Eee` now wants to change `Aaa:use_o` to `True` with `conan install /path/to/Eee/conanfile.py -o Aaa:use_o=True`, it will need to rebuild `Bbb`, `Ccc` and `Ddd` packages even though they do not depend at all on `Aaa's` `use_o` parameter. The `Bbb's`, `Ccc's` and `Ddd's` binary will be **exactly the same** as with `Aaa:use_o=False`, but their `package_id's` will change because there is one more dependency in the graph.
Of course, `Eee` must be aware of `Ooo` in order to correctly link to it when creating final executable, but `Bbb`, `Ccc` and `Ddd` should not be rebuilt in that case. This wastes a lot of time in our real setup, as more than 100 packages are rebuilt because the top level package changes an option in bottom level package that introduces a new dependency and this wastes a lot of time and disk space for our developers.
All packages in between are static libraries and should not be rebuilt. Actually, sometimes they should, but that should then depend on specific option of the dependent package, as mentioned in issue #3776. Is there a way to prevent rebuilding of packages `Bbb`, `Ccc` and `Ddd` when change in `Aaa's` option introduces a new dependency to the graph, i.e. is there a way to keep `Bbb's`, `Ccc's` and `Ddd's` `package_id` unchanged after `Aaa` introduces `Ooo` as its dependency?
Here is a little demo that follows the description above:
[conan-static-deps.zip](https://github.com/conan-io/conan/files/2493207/conan-static-deps.zip)
|
conan-io/conan
|
diff --git a/conans/client/cmd/test.py b/conans/client/cmd/test.py
index 87ecc1c42..e0614c05d 100644
--- a/conans/client/cmd/test.py
+++ b/conans/client/cmd/test.py
@@ -4,6 +4,7 @@ import tempfile
from conans.util.files import rmdir
from conans.util.env_reader import get_env
+from conans.client.cmd.build import build
class PackageTester(object):
@@ -21,7 +22,8 @@ class PackageTester(object):
and builds the test_package/conanfile.py running the test() method.
"""
base_folder = os.path.dirname(conanfile_abs_path)
- test_build_folder, delete_after_build = self._build_folder(test_build_folder, profile, base_folder)
+ test_build_folder, delete_after_build = self._build_folder(test_build_folder, profile,
+ base_folder)
rmdir(test_build_folder)
if build_modes is None:
build_modes = ["never"]
@@ -37,11 +39,14 @@ class PackageTester(object):
manifest_verify=manifest_verify,
manifest_interactive=manifest_interactive,
keep_build=keep_build)
- self._manager.build(conanfile_abs_path, base_folder, test_build_folder, package_folder=None,
- install_folder=test_build_folder, test=str(reference))
+ # FIXME: This is ugly access to graph_manager and plugin_manager. Will be cleaned in 2.0
+ build(self._manager._graph_manager, self._manager._plugin_manager, conanfile_abs_path,
+ self._user_io.out,
+ base_folder, test_build_folder, package_folder=None,
+ install_folder=test_build_folder, test=str(reference))
finally:
if delete_after_build:
- os.chdir(base_folder) # Required for windows where deleting the cwd is not possible.
+ os.chdir(base_folder) # Required for windows where deleting the cwd is not possible.
rmdir(test_build_folder)
@staticmethod
diff --git a/conans/test/command/export_pkg_test.py b/conans/test/command/export_pkg_test.py
index 446272655..a073ddebb 100644
--- a/conans/test/command/export_pkg_test.py
+++ b/conans/test/command/export_pkg_test.py
@@ -29,6 +29,36 @@ class Pkg(ConanFile):
client.run("install .")
client.run("export-pkg . Pkg/0.1@user/testing")
+ def test_transitive_without_settings(self):
+ # https://github.com/conan-io/conan/issues/3367
+ conanfile = """from conans import ConanFile
+class PkgC(ConanFile):
+ pass
+"""
+ client = TestClient()
+ client.save({CONANFILE: conanfile})
+ client.run("create . PkgC/0.1@user/testing")
+ conanfile = """from conans import ConanFile
+class PkgB(ConanFile):
+ settings = "arch"
+ requires = "PkgC/0.1@user/testing"
+"""
+ client.save({CONANFILE: conanfile})
+ client.run("create . PkgB/0.1@user/testing")
+ conanfile = """from conans import ConanFile
+class PkgA(ConanFile):
+ requires = "PkgB/0.1@user/testing"
+ def build(self):
+ self.output.info("BUILDING PKGA")
+"""
+ client.save({CONANFILE: conanfile})
+ client.run("install . -if=build")
+ client.run("build . -bf=build")
+ client.run("export-pkg . PkgA/0.1@user/testing -bf=build -pr=default")
+ self.assertIn("PkgA/0.1@user/testing: Package "
+ "'8f97510bcea8206c1c046cc8d71cc395d4146547' created",
+ client.out)
+
def test_package_folder_errors(self):
# https://github.com/conan-io/conan/issues/2350
conanfile = """from conans import ConanFile
@@ -179,45 +209,42 @@ class TestConan(ConanFile):
client.user_io.out)
# Now repeat
- client.save({CONANFILE: conanfile}, clean_first=True)
- client.save({"include/header.h": "//Windows header2"})
+ client.save({CONANFILE: conanfile,
+ "include/header.h": "//Windows header2"}, clean_first=True)
+ # Without force it fails
err = client.run("export-pkg . Hello/0.1@lasote/stable -s os=Windows",
ignore_error=True)
self.assertIn("Package already exists. Please use --force, -f to overwrite it",
client.user_io.out)
self.assertTrue(err)
-
- # Will fail because it finds the info files in the curdir.
- client.run("install . -s os=Windows")
- err = client.run("export-pkg . Hello/0.1@lasote/stable -s os=Windows -f", ignore_error=True)
- self.assertTrue(err)
- self.assertIn("conaninfo.txt and conanbuildinfo.txt are found", client.out)
-
- client.save({CONANFILE: conanfile, "include/header.h": "//Windows header2"},
- clean_first=True)
+ # With force works
client.run("export-pkg . Hello/0.1@lasote/stable -s os=Windows -f")
self.assertEqual(load(os.path.join(package_folder, "include/header.h")),
"//Windows header2")
- # Now use --install-folder and avoid the -s os=Windows, should fail without -f
+ # Now use --install-folder
+ client.save({CONANFILE: conanfile,
+ "include/header.h": "//Windows header3"}, clean_first=True)
+ # Without force it fails
client.run("install . --install-folder=inst -s os=Windows")
err = client.run("export-pkg . Hello/0.1@lasote/stable -if inst", ignore_error=True)
self.assertTrue(err)
self.assertIn("Package already exists. Please use --force, -f to overwrite it",
client.user_io.out)
+ # With force works
client.run("export-pkg . Hello/0.1@lasote/stable -if inst -f")
+ self.assertIn("Hello/0.1@lasote/stable: Package '3475bd55b91ae904ac96fde0f106a136ab951a5e'"
+ " created", client.out)
self.assertEqual(load(os.path.join(package_folder, "include/header.h")),
- "//Windows header2")
-
- # Try to specify a setting and the install folder
- error = client.run("export-pkg . Hello/0.1@lasote/stable -if inst -s os=Linux", ignore_error=True)
- self.assertTrue(error)
- self.assertIn("conaninfo.txt and conanbuildinfo.txt are found", client.user_io.out)
+ "//Windows header3")
- error = client.run("export-pkg . Hello/0.1@lasote/stable -if inst -f --profile=default",
- ignore_error=True)
- self.assertIn("conaninfo.txt and conanbuildinfo.txt are found", client.user_io.out)
- self.assertTrue(error)
+ # we can specify settings too
+ client.save({"include/header.h": "//Windows header4"})
+ client.run("export-pkg . Hello/0.1@lasote/stable -if inst -f -s os=Windows")
+ self.assertIn("Hello/0.1@lasote/stable: Package '3475bd55b91ae904ac96fde0f106a136ab951a5e'"
+ " created", client.out)
+ self.assertEqual(load(os.path.join(package_folder, "include/header.h")),
+ "//Windows header4")
# Try to specify a install folder with no files
error = client.run("export-pkg . Hello/0.1@lasote/stable -if fake", ignore_error=True)
@@ -376,7 +403,8 @@ class TestConan(ConanFile):
# Partial reference is ok
client.save({CONANFILE: conanfile, "file.txt": "txt contents"})
client.run("export-pkg . anyname/1.222@conan/stable")
- self.assertIn("anyname/1.222@conan/stable package(): Copied 1 '.txt' file: file.txt", client.out)
+ self.assertIn("anyname/1.222@conan/stable package(): Copied 1 '.txt' file: file.txt",
+ client.out)
def test_with_deps(self):
client = TestClient()
diff --git a/conans/test/command/upload_complete_test.py b/conans/test/command/upload_complete_test.py
index 5719cd22c..37ef391a5 100644
--- a/conans/test/command/upload_complete_test.py
+++ b/conans/test/command/upload_complete_test.py
@@ -1,19 +1,21 @@
+import os
import json
import unittest
+import platform
+import stat
+
+from requests.packages.urllib3.exceptions import ConnectionError
+
from conans.test.utils.tools import TestClient, TestServer, TestRequester
from conans.test.utils.test_files import hello_source_files, temp_folder,\
hello_conan_files
-from conans.client.manager import CONANFILE
-import os
-from conans.paths import CONAN_MANIFEST, EXPORT_TGZ_NAME, CONANINFO
-import platform
-import stat
+from conans.paths import CONAN_MANIFEST, EXPORT_TGZ_NAME, CONANINFO, CONANFILE
from conans.util.files import load, mkdir, save
from conans.model.ref import ConanFileReference, PackageReference
from conans.model.manifest import FileTreeManifest
from conans.test.utils.test_files import uncompress_packaged_files
from conans.tools import untargz
-from requests.packages.urllib3.exceptions import ConnectionError
+
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
myconan1 = """
@@ -169,7 +171,7 @@ class UploadTest(unittest.TestCase):
client.run("export . frodo/stable")
client.run("upload Hello* --confirm --retry 10 --retry-wait=0", ignore_error=True)
self.assertIn("Waiting 0 seconds to retry...", client.user_io.out)
- self.assertIn("ERROR: Execute upload again to retry upload the failed files", client.user_io.out)
+ self.assertIn("ERROR: Execute upload again to retry upload the failed files", client.out)
# For each file will fail the first time and will success in the second one
client = self._get_client(FailPairFilesUploader)
diff --git a/conans/test/command/upload_test.py b/conans/test/command/upload_test.py
index ba978efce..aaa41a9b5 100644
--- a/conans/test/command/upload_test.py
+++ b/conans/test/command/upload_test.py
@@ -1,15 +1,14 @@
+import itertools
+import os
import unittest
-from conans.tools import environment_append
-from conans.test.utils.tools import TestClient, TestServer
-from conans.test.utils.cpp_test_files import cpp_hello_conan_files
+from conans.errors import ConanException
from conans.model.ref import ConanFileReference, PackageReference
+from conans.paths import EXPORT_SOURCES_TGZ_NAME, PACKAGE_TGZ_NAME
+from conans.test.utils.cpp_test_files import cpp_hello_conan_files
+from conans.test.utils.tools import TestClient, TestServer
+from conans.tools import environment_append
from conans.util.files import save, is_dirty, gzopen_without_timestamps
-import os
-import itertools
from mock import mock
-from conans.errors import ConanException
-from conans.paths import EXPORT_SOURCES_TGZ_NAME, PACKAGE_TGZ_NAME
-
conanfile = """from conans import ConanFile
class MyPkg(ConanFile):
@@ -200,7 +199,7 @@ class UploadTest(unittest.TestCase):
client = self._client()
client.save({"conanfile.py": conanfile,
- "hello.cpp": ""})
+ "hello.cpp": "int i=0"})
client.run("export . frodo/stable")
client.run("upload Hello0/1.2.1@frodo/stable")
self.assertIn("Uploading conanmanifest.txt", client.user_io.out)
@@ -208,9 +207,8 @@ class UploadTest(unittest.TestCase):
client.out)
client2 = self._client()
-
- client2.save({"conanfile.py": conanfile,
- "hello.cpp": "//comamend"})
+ client2.save({"conanfile.py": conanfile + "\r\n#end",
+ "hello.cpp": "int i=1"})
client2.run("export . frodo/stable")
ref = ConanFileReference.loads("Hello0/1.2.1@frodo/stable")
manifest = client2.client_cache.load_manifest(ref)
@@ -224,7 +222,9 @@ class UploadTest(unittest.TestCase):
# first client tries to upload again
error = client.run("upload Hello0/1.2.1@frodo/stable", ignore_error=True)
self.assertTrue(error)
- self.assertIn("ERROR: Remote recipe is newer than local recipe", client.user_io.out)
+ self.assertIn("Remote recipe is newer than local recipe", client.user_io.out)
+ self.assertIn("Local 'conanfile.py' using '\\n' line-ends", client.user_io.out)
+ self.assertIn("Remote 'conanfile.py' using '\\r\\n' line-ends", client.user_io.out)
def upload_unmodified_recipe_test(self):
client = self._client()
diff --git a/conans/test/conditional_requirements_id_test.py b/conans/test/conditional_requirements_id_test.py
new file mode 100644
index 000000000..d8ebf0e3b
--- /dev/null
+++ b/conans/test/conditional_requirements_id_test.py
@@ -0,0 +1,58 @@
+import unittest
+
+from conans.test.utils.tools import TestClient
+
+
+class ConditionalRequirementsIdTest(unittest.TestCase):
+
+ def basic_test(self):
+ # https://github.com/conan-io/conan/issues/3792
+ # Default might be improved 2.0 in https://github.com/conan-io/conan/issues/3762
+ client = TestClient()
+ conanfile = '''from conans import ConanFile
+class ConanLib(ConanFile):
+ pass
+'''
+ client.save({"conanfile.py": conanfile})
+ client.run("create . optional/0.1@user/testing")
+ conanfile = '''from conans import ConanFile
+class ConanLib(ConanFile):
+ options = {"use_lib": [True, False]}
+ default_options= "use_lib=False"
+ def requirements(self):
+ if self.options.use_lib:
+ self.requires("optional/0.1@user/testing")
+ def package_id(self):
+ if self.options.use_lib:
+ self.info.requires.remove("optional")
+'''
+ client.save({"conanfile.py": conanfile})
+ client.run("create . pkgA/0.1@user/testing")
+ self.assertIn("5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9", client.out)
+ client.run("create . pkgA/0.1@user/testing -o pkgA:use_lib=True")
+ self.assertIn("b3485d1af719b8ddc636d57800186fc73cefff8d", client.out)
+ conanfile = '''from conans import ConanFile
+class ConanLib(ConanFile):
+ requires = "pkgA/0.1@user/testing"
+'''
+ client.save({"conanfile.py": conanfile})
+ client.run("create . pkgB/0.1@user/testing")
+ self.assertIn("pkgA/0.1@user/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9", client.out)
+ self.assertIn("pkgB/0.1@user/testing:4778d500bd98ecb57d331d591aa43a7b4788d870", client.out)
+
+ client.save({"conanfile.py": conanfile.replace("pkgA", "pkgB")})
+ client.run("create . pkgC/0.1@user/testing")
+ self.assertIn("pkgA/0.1@user/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9", client.out)
+ self.assertIn("pkgB/0.1@user/testing:4778d500bd98ecb57d331d591aa43a7b4788d870", client.out)
+ self.assertIn("pkgC/0.1@user/testing:4866ff85840783bec107794cce1bc12b7b8df188", client.out)
+
+ client.save({"conanfile.py": conanfile.replace("pkgA", "pkgC")})
+ client.run("install .")
+ self.assertIn("pkgA/0.1@user/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9", client.out)
+ self.assertIn("pkgB/0.1@user/testing:4778d500bd98ecb57d331d591aa43a7b4788d870", client.out)
+ self.assertIn("pkgC/0.1@user/testing:4866ff85840783bec107794cce1bc12b7b8df188", client.out)
+
+ client.run("install . -o pkgA:use_lib=True")
+ self.assertIn("pkgA/0.1@user/testing:b3485d1af719b8ddc636d57800186fc73cefff8d", client.out)
+ self.assertIn("pkgB/0.1@user/testing:4778d500bd98ecb57d331d591aa43a7b4788d870", client.out)
+ self.assertIn("pkgC/0.1@user/testing:4866ff85840783bec107794cce1bc12b7b8df188", client.out)
diff --git a/conans/test/functional/create_package_test.py b/conans/test/functional/create_package_test.py
index 6c5e14a36..425890c6f 100644
--- a/conans/test/functional/create_package_test.py
+++ b/conans/test/functional/create_package_test.py
@@ -1,16 +1,14 @@
import unittest
import os
+import shutil
+
from conans.test.utils.tools import TestClient, TestBufferConanOutput
from conans.test.utils.test_files import hello_source_files
-from conans.client.manager import CONANFILE
from conans.model.ref import ConanFileReference, PackageReference
-import shutil
-from conans.paths import CONANINFO
+from conans.paths import CONANINFO, CONANFILE
from conans.client.packager import create_package
from conans.client.loader import ConanFileLoader, ProcessedProfile
-from conans.model.settings import Settings
from conans.client.output import ScopedOutput
-from conans.model.profile import Profile
from conans.client.graph.python_requires import ConanPythonRequire
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_issue_reference",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 3,
"test_score": 0
},
"num_modified_files": 8
}
|
1.8
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"nose",
"nose-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc",
"apt-get install -y gcc-multilib g++-multilib"
],
"python": "3.6",
"reqs_path": [
"conans/requirements.txt",
"conans/requirements_server.txt",
"conans/requirements_dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
astroid==2.11.7
attrs==22.2.0
beautifulsoup4==4.12.3
bottle==0.12.25
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
colorama==0.3.9
-e git+https://github.com/conan-io/conan.git@16984450b4cd07ff9ea1d4758e26e6d141a38cf8#egg=conan
cov-core==1.15.0
coverage==4.2
deprecation==2.0.7
dill==0.3.4
distro==1.1.0
fasteners==0.19
future==0.16.0
idna==3.10
importlib-metadata==4.8.3
importlib-resources==5.4.0
iniconfig==1.1.1
isort==5.10.1
lazy-object-proxy==1.7.1
mccabe==0.7.0
mock==1.3.0
node-semver==0.2.0
nose==1.3.7
nose-cov==1.6
packaging==21.3
parameterized==0.8.1
patch==1.16
pbr==6.1.1
platformdirs==2.4.0
pluggy==1.0.0
pluginbase==0.7
py==1.11.0
Pygments==2.14.0
PyJWT==1.7.1
pylint==2.13.9
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
PyYAML==3.13
requests==2.27.1
six==1.17.0
soupsieve==2.3.2.post1
tomli==1.2.3
tqdm==4.64.1
typed-ast==1.5.5
typing_extensions==4.1.1
urllib3==1.26.20
waitress==2.0.0
WebOb==1.8.9
WebTest==2.0.35
wrapt==1.16.0
zipp==3.6.0
|
name: conan
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- astroid==2.11.7
- attrs==22.2.0
- beautifulsoup4==4.12.3
- bottle==0.12.25
- charset-normalizer==2.0.12
- codecov==2.1.13
- colorama==0.3.9
- cov-core==1.15.0
- coverage==4.2
- deprecation==2.0.7
- dill==0.3.4
- distro==1.1.0
- fasteners==0.19
- future==0.16.0
- idna==3.10
- importlib-metadata==4.8.3
- importlib-resources==5.4.0
- iniconfig==1.1.1
- isort==5.10.1
- lazy-object-proxy==1.7.1
- mccabe==0.7.0
- mock==1.3.0
- node-semver==0.2.0
- nose==1.3.7
- nose-cov==1.6
- packaging==21.3
- parameterized==0.8.1
- patch==1.16
- pbr==6.1.1
- platformdirs==2.4.0
- pluggy==1.0.0
- pluginbase==0.7
- py==1.11.0
- pygments==2.14.0
- pyjwt==1.7.1
- pylint==2.13.9
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pyyaml==3.13
- requests==2.27.1
- six==1.17.0
- soupsieve==2.3.2.post1
- tomli==1.2.3
- tqdm==4.64.1
- typed-ast==1.5.5
- typing-extensions==4.1.1
- urllib3==1.26.20
- waitress==2.0.0
- webob==1.8.9
- webtest==2.0.35
- wrapt==1.16.0
- zipp==3.6.0
prefix: /opt/conda/envs/conan
|
[
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_new",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_package_folder"
] |
[
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_basic_0",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_basic_1",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_build_folders",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_build_source_folders",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_default_source_folder",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_develop",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_dont_touch_server",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_options",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_options_install",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_package_folder_errors",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_partial_references",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_transitive_without_settings",
"conans/test/command/export_pkg_test.py::ExportPkgTest::test_with_deps"
] |
[] |
[] |
MIT License
| 3,271 |
[
"conans/client/manager.py",
"conans/model/manifest.py",
"conans/client/cmd/build.py",
"conans/__init__.py",
"conans/client/packager.py",
"conans/client/conan_api.py",
"conans/client/cmd/uploader.py",
"conans/requirements_osx.txt",
"conans/requirements.txt",
"conans/client/cmd/export_pkg.py"
] |
[
"conans/client/manager.py",
"conans/model/manifest.py",
"conans/client/cmd/build.py",
"conans/__init__.py",
"conans/client/packager.py",
"conans/client/conan_api.py",
"conans/client/cmd/uploader.py",
"conans/requirements_osx.txt",
"conans/requirements.txt",
"conans/client/cmd/export_pkg.py"
] |
|
zopefoundation__zope.componentvocabulary-7
|
b876ffc5b172710f976bc49aad58998302720998
|
2018-10-19 11:54:45
|
b876ffc5b172710f976bc49aad58998302720998
|
diff --git a/CHANGES.rst b/CHANGES.rst
index ae85acd..89282ad 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,14 +1,16 @@
-Changes
-=======
+=========
+ Changes
+=========
2.1.1 (unreleased)
-------------------
+==================
- Add support for Python 3.7.
+- Drop support for ``setup.py test``.
2.1.0 (2017-07-25)
-------------------
+==================
- Add support for Python 3.5 and 3.6.
@@ -16,7 +18,7 @@ Changes
2.0.0 (2014-12-24)
-------------------
+==================
- Added support for PyPy. (PyPy3 is pending release of a fix for:
https://bitbucket.org/pypy/pypy/issue/1946)
@@ -27,7 +29,7 @@ Changes
2.0.0a1 (2013-02-25)
---------------------
+====================
- Add support for Python 3.3.
@@ -44,7 +46,7 @@ Changes
1.0.1 (2010-09-25)
-------------------
+==================
- Add undeclared but needed dependency on ``zope.component``.
@@ -52,7 +54,7 @@ Changes
1.0 (2009-05-19)
-----------------
+================
* Initial public release, derived from zope.app.component and
zope.app.interface to replace them.
diff --git a/setup.py b/setup.py
index 17cf9cb..175f21c 100644
--- a/setup.py
+++ b/setup.py
@@ -20,20 +20,6 @@ def read(*rnames):
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
return f.read()
-def alltests():
- import sys
- import unittest
- # use the zope.testrunner machinery to find all the
- # test suites we've put under ourselves
- import zope.testrunner.find
- import zope.testrunner.options
- here = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
- args = sys.argv[:]
- defaults = ["--test-path", here]
- options = zope.testrunner.options.get_options(args, defaults)
- suites = list(zope.testrunner.find.find_suites(options))
- return unittest.TestSuite(suites)
-
TEST_REQUIRES = [
'zope.configuration',
'zope.testing',
@@ -89,7 +75,6 @@ setup(name='zope.componentvocabulary',
'test': TEST_REQUIRES,
},
tests_require=TEST_REQUIRES,
- test_suite='__main__.alltests',
include_package_data=True,
zip_safe=False,
)
diff --git a/src/zope/componentvocabulary/vocabulary.py b/src/zope/componentvocabulary/vocabulary.py
index 329548f..311911d 100644
--- a/src/zope/componentvocabulary/vocabulary.py
+++ b/src/zope/componentvocabulary/vocabulary.py
@@ -20,9 +20,9 @@ import base64
import six
import zope.component
from zope.component.interface import interfaceToName
-from zope.component.interfaces import IUtilityRegistration
from zope.interface import implementer, provider, Interface, providedBy
from zope.interface.interfaces import IInterface
+from zope.interface.interfaces import IUtilityRegistration
from zope.security.proxy import removeSecurityProxy
from zope.schema.interfaces import IVocabularyTokenized
from zope.schema.interfaces import ITokenizedTerm, ITitledTokenizedTerm
@@ -287,7 +287,7 @@ class UtilityComponentInterfacesVocabulary(ObjectInterfacesVocabulary):
@implementer(ITitledTokenizedTerm)
-class UtilityNameTerm:
+class UtilityNameTerm(object):
r"""Simple term that provides a utility name as a value.
>>> t1 = UtilityNameTerm('abc')
@@ -338,7 +338,7 @@ class UtilityNameTerm:
@implementer(IVocabularyTokenized)
-class UtilityNames:
+class UtilityNames(object):
"""Vocabulary with utility names for a single interface as values.
>>> class IMyUtility(Interface):
@@ -380,6 +380,15 @@ class UtilityNames:
>>> u'three' in vocab
True
+ If the term is not found, a ValueError is raised from ``getTerm``
+
+ >>> u'four' in vocab
+ False
+ >>> vocab.getTerm(u'four')
+ Traceback (most recent call last):
+ ...
+ ValueError: four
+
>>> component.provideUtility(MyUtility(), IMyUtility)
>>> u'' in vocab
True
@@ -394,6 +403,14 @@ class UtilityNames:
>>> term3.value
u'one'
+ If we ask ``getTermByToken`` to find a missing token, a
+ ``LookupError`` is raised:
+
+ >>> vocab.getTermByToken(u'no such term')
+ Traceback (most recent call last):
+ ...
+ LookupError: no matching token: 'no such term'
+
>>> ps.tearDown()
"""
diff --git a/tox.ini b/tox.ini
index 4978f79..5996d47 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,14 +5,16 @@ envlist =
[testenv]
usedevelop = true
commands =
- python setup.py -q test -q
+ zope-testrunner --test-path=src
deps =
.[test]
[testenv:coverage]
+basepython =
+ python3.6
commands =
- coverage run setup.py -q test -q
- coverage report
+ coverage run -m zope.testrunner --test-path=src
+ coverage report --fail-under=100
deps =
{[testenv]deps}
coverage
|
Fix DeprecationWarnings
```
zope/componentvocabulary/vocabulary.py:23: DeprecationWarning: IUtilityRegistration is deprecated. Import from zope.interface.interfaces
from zope.component.interfaces import IUtilityRegistration
```
|
zopefoundation/zope.componentvocabulary
|
diff --git a/src/zope/componentvocabulary/tests/test_configure.py b/src/zope/componentvocabulary/tests/test_configure.py
index c7a30e9..b930057 100644
--- a/src/zope/componentvocabulary/tests/test_configure.py
+++ b/src/zope/componentvocabulary/tests/test_configure.py
@@ -21,11 +21,11 @@ import zope.configuration.xmlconfig
class ZCMLTest(unittest.TestCase):
def test_configure_zcml_should_be_loadable(self):
- try:
- zope.configuration.xmlconfig.XMLConfig(
+ # If this raises, let it be a test error.
+ # We get a more clear exception than if we catch
+ # what it raises and do self.fail(ex)
+ zope.configuration.xmlconfig.XMLConfig(
'configure.zcml', zope.componentvocabulary)()
- except Exception as e:
- self.fail(e)
def test_configure_should_register_n_utilities(self):
gsm = zope.component.getGlobalSiteManager()
diff --git a/src/zope/componentvocabulary/tests/test_vocabulary.py b/src/zope/componentvocabulary/tests/test_vocabulary.py
index 6ababce..93ea143 100644
--- a/src/zope/componentvocabulary/tests/test_vocabulary.py
+++ b/src/zope/componentvocabulary/tests/test_vocabulary.py
@@ -16,8 +16,51 @@
__docformat__ = "reStructuredText"
import doctest
import re
+import unittest
+
from zope.testing import renormalizing
+
+class TestUtilityComponentInterfacesVocabulary(unittest.TestCase):
+
+ def _getTargetClass(self):
+ from zope.componentvocabulary.vocabulary import UtilityComponentInterfacesVocabulary
+ return UtilityComponentInterfacesVocabulary
+
+ def _makeOne(self, context):
+ return self._getTargetClass()(context)
+
+ def test_construct_without_registration(self):
+ context = object()
+ vocab = self._makeOne(context)
+
+ self.assertIsNotNone(vocab.getTermByToken('zope.interface.Interface'))
+
+ def test_construct_with_registration_unwraps(self):
+ from zope.interface import Interface
+ from zope.interface import implementer
+ from zope.interface.interfaces import IUtilityRegistration
+
+ @implementer(IUtilityRegistration)
+ class Reg(object):
+ def __init__(self, component):
+ self.component = component
+
+ class IComponent(Interface):
+ "A component interface"
+
+ @implementer(IComponent)
+ class Component(object):
+ "A component"
+
+
+ reg = Reg(Component())
+
+ vocab = self._makeOne(reg)
+ self.assertIsNotNone(
+ vocab.getTermByToken('zope.componentvocabulary.tests.test_vocabulary.IComponent'))
+
+
checker = renormalizing.RENormalizing([
# Python 3 unicode removed the "u".
(re.compile("u('.*?')"),
@@ -28,5 +71,9 @@ checker = renormalizing.RENormalizing([
def test_suite():
- return doctest.DocTestSuite(
- 'zope.componentvocabulary.vocabulary', checker=checker)
+ suite = unittest.defaultTestLoader.loadTestsFromName(__name__)
+ suite.addTest(
+ doctest.DocTestSuite(
+ 'zope.componentvocabulary.vocabulary', checker=checker)
+ )
+ return suite
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 4
}
|
2.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": null,
"python": "3.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
coverage==7.2.7
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
packaging @ file:///croot/packaging_1671697413597/work
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
pytest-cov==4.1.0
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zipp @ file:///croot/zipp_1672387121353/work
zope.component==6.0
-e git+https://github.com/zopefoundation/zope.componentvocabulary.git@b876ffc5b172710f976bc49aad58998302720998#egg=zope.componentvocabulary
zope.configuration==5.0.1
zope.event==5.0
zope.exceptions==5.1
zope.hookable==6.0
zope.i18nmessageid==6.1.0
zope.interface==6.4.post2
zope.location==5.0
zope.proxy==5.3
zope.schema==7.0.1
zope.security==6.2
zope.testing==5.0.1
zope.testrunner==6.5
|
name: zope.componentvocabulary
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=22.1.0=py37h06a4308_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- flit-core=3.6.0=pyhd3eb1b0_0
- importlib-metadata=4.11.3=py37h06a4308_0
- importlib_metadata=4.11.3=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=22.0=py37h06a4308_0
- pip=22.3.1=py37h06a4308_0
- pluggy=1.0.0=py37h06a4308_1
- py=1.11.0=pyhd3eb1b0_0
- pytest=7.1.2=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py37h06a4308_0
- typing_extensions=4.4.0=py37h06a4308_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zipp=3.11.0=py37h06a4308_0
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.2.7
- pytest-cov==4.1.0
- six==1.17.0
- zope-component==6.0
- zope-configuration==5.0.1
- zope-event==5.0
- zope-exceptions==5.1
- zope-hookable==6.0
- zope-i18nmessageid==6.1.0
- zope-interface==6.4.post2
- zope-location==5.0
- zope-proxy==5.3
- zope-schema==7.0.1
- zope-security==6.2
- zope-testing==5.0.1
- zope-testrunner==6.5
prefix: /opt/conda/envs/zope.componentvocabulary
|
[
"src/zope/componentvocabulary/tests/test_configure.py::ZCMLTest::test_configure_should_register_n_utilities",
"src/zope/componentvocabulary/tests/test_vocabulary.py::TestUtilityComponentInterfacesVocabulary::test_construct_with_registration_unwraps",
"src/zope/componentvocabulary/tests/test_vocabulary.py::TestUtilityComponentInterfacesVocabulary::test_construct_without_registration",
"src/zope/componentvocabulary/tests/test_vocabulary.py::test_suite"
] |
[] |
[
"src/zope/componentvocabulary/tests/test_configure.py::ZCMLTest::test_configure_zcml_should_be_loadable"
] |
[] |
Zope Public License 2.1
| 3,272 |
[
"setup.py",
"src/zope/componentvocabulary/vocabulary.py",
"tox.ini",
"CHANGES.rst"
] |
[
"setup.py",
"src/zope/componentvocabulary/vocabulary.py",
"tox.ini",
"CHANGES.rst"
] |
|
zopefoundation__zope.site-11
|
a711e599297c8f42044f88137850a2c48b4a29b2
|
2018-10-19 12:48:56
|
a711e599297c8f42044f88137850a2c48b4a29b2
|
diff --git a/CHANGES.rst b/CHANGES.rst
index 2a49792..1ddb1ad 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,14 +5,15 @@
4.2.2 (unreleased)
==================
-- Nothing changed yet.
+- Fix more ``DeprecationWarnings``. See `issue 10
+ <https://github.com/zopefoundation/zope.site/issues/10>`_.
4.2.1 (2018-10-11)
==================
-- Use current location for `UtilityRegistration` and `IUtilityRegistration`
- classes.
+- Use current import location for ``UtilityRegistration`` and ``IUtilityRegistration``
+ classes to avoid ``DeprecationWarning``.
4.2.0 (2018-10-09)
@@ -33,7 +34,7 @@
with ``zope.deprecation``. These will be removed in version 5.0.
They all have replacements in ``zope.component``.
-- Added implementation for _p_repr in LocalSiteManager.
+- Added implementation for _p_repr in LocalSiteManager.
For further information see github issue #8.
- Reach 100% test coverage and ensure we remain there.
diff --git a/setup.py b/setup.py
index cefd6ea..ea99fe9 100644
--- a/setup.py
+++ b/setup.py
@@ -97,9 +97,9 @@ setup(name='zope.site',
'zope.container',
'zope.deprecation',
'zope.security',
- 'zope.component',
+ 'zope.component >= 4.5.0',
'zope.event',
- 'zope.interface',
+ 'zope.interface >= 4.5.0',
'zope.lifecycleevent',
'zope.location',
],
diff --git a/src/zope/site/configure.zcml b/src/zope/site/configure.zcml
index 387388b..aee508e 100644
--- a/src/zope/site/configure.zcml
+++ b/src/zope/site/configure.zcml
@@ -21,7 +21,7 @@
interface="zope.container.interfaces.IReadContainer" />
<require
permission="zope.ManageSite"
- interface="zope.component.interfaces.IComponentLookup
+ interface="zope.interface.interfaces.IComponentLookup
zope.container.interfaces.IWriteContainer" />
</class>
@@ -47,7 +47,7 @@
</class>
<adapter
- for="zope.component.interfaces.IComponentLookup"
+ for="zope.interface.interfaces.IComponentLookup"
provides="zope.filerepresentation.interfaces.IDirectoryFactory"
factory=".site.SMFolderFactory"
permission="zope.ManageContent"
diff --git a/src/zope/site/folder.py b/src/zope/site/folder.py
index 51dc6e2..1e4ec07 100644
--- a/src/zope/site/folder.py
+++ b/src/zope/site/folder.py
@@ -50,7 +50,7 @@ class FolderSublocations(object):
>>> sm = Contained()
>>> from zope.interface import directlyProvides
- >>> from zope.component.interfaces import IComponentLookup
+ >>> from zope.interface.interfaces import IComponentLookup
>>> directlyProvides(sm, IComponentLookup)
>>> folder.setSiteManager(sm)
>>> directlyProvides(folder, zope.component.interfaces.ISite)
diff --git a/src/zope/site/interfaces.py b/src/zope/site/interfaces.py
index 215cc80..3696cb2 100644
--- a/src/zope/site/interfaces.py
+++ b/src/zope/site/interfaces.py
@@ -15,7 +15,7 @@
"""
import zope.interface
-import zope.component.interfaces
+import zope.interface.interfaces
import zope.container.interfaces
import zope.container.constraints
import zope.location.interfaces
@@ -37,7 +37,7 @@ class NewLocalSite(object):
self.manager = manager
-class ILocalSiteManager(zope.component.interfaces.IComponents):
+class ILocalSiteManager(zope.interface.interfaces.IComponents):
"""Site Managers act as containers for registerable components.
If a Site Manager is asked for an adapter or utility, it checks for those
diff --git a/src/zope/site/site.py b/src/zope/site/site.py
index c2a3e94..b5f4d12 100644
--- a/src/zope/site/site.py
+++ b/src/zope/site/site.py
@@ -32,7 +32,8 @@ import zope.component.interfaces
import zope.location
import zope.location.interfaces
-from zope.component.interfaces import ComponentLookupError
+from zope.interface.interfaces import IComponentLookup
+from zope.interface.interfaces import ComponentLookupError
from zope.lifecycleevent import ObjectCreatedEvent
from zope.filerepresentation.interfaces import IDirectoryFactory
@@ -86,7 +87,7 @@ class SiteManagerContainer(Contained):
if zope.component.interfaces.ISite.providedBy(self):
raise TypeError("Already a site")
- if zope.component.interfaces.IComponentLookup.providedBy(sm):
+ if IComponentLookup.providedBy(sm):
self._sm = sm
else:
raise ValueError('setSiteManager requires an IComponentLookup')
@@ -212,7 +213,7 @@ else:
@zope.component.adapter(zope.interface.Interface)
[email protected](zope.component.interfaces.IComponentLookup)
[email protected](IComponentLookup)
def SiteManagerAdapter(ob):
"""An adapter from :class:`~.ILocation` to :class:`~.IComponentLookup`.
diff --git a/src/zope/site/site.rst b/src/zope/site/site.rst
index 07baac6..ef29bea 100644
--- a/src/zope/site/site.rst
+++ b/src/zope/site/site.rst
@@ -73,13 +73,13 @@ There is also an adapter you can use to get the next site manager from any
location:
>>> myfolder['mysubfolder'] = folder.Folder()
- >>> import zope.component
- >>> zope.component.interfaces.IComponentLookup(myfolder['mysubfolder']) is sm
+ >>> import zope.interface.interfaces
+ >>> zope.interface.interfaces.IComponentLookup(myfolder['mysubfolder']) is sm
True
If the location passed is a site, the site manager of that site is returned:
- >>> zope.component.interfaces.IComponentLookup(myfolder) is sm
+ >>> zope.interface.interfaces.IComponentLookup(myfolder) is sm
True
|
Fix DeprecationWarnings
e.g.,
```
zope/site/site.py:35: DeprecationWarning: ComponentLookupError is deprecated. Import from zope.interface.interfaces
from zope.component.interfaces import ComponentLookupError
```
|
zopefoundation/zope.site
|
diff --git a/src/zope/site/testing.py b/src/zope/site/testing.py
index 534e3b2..e133583 100644
--- a/src/zope/site/testing.py
+++ b/src/zope/site/testing.py
@@ -20,7 +20,7 @@ import zope.component.interfaces
import zope.container.interfaces
import zope.container.testing
import zope.site.site
-from zope.component.interfaces import IComponentLookup
+from zope.interface.interfaces import IComponentLookup
from zope.interface import Interface
from zope.site import LocalSiteManager, SiteManagerAdapter
from zope.site.folder import rootFolder
diff --git a/src/zope/site/tests/test_bwc.py b/src/zope/site/tests/test_bwc.py
index 93330a6..c4533c7 100644
--- a/src/zope/site/tests/test_bwc.py
+++ b/src/zope/site/tests/test_bwc.py
@@ -14,16 +14,23 @@
# Test BWC shims
import unittest
+import warnings
class TestNext(unittest.TestCase):
def test_import(self):
- from zope.site import next as FUT
- self.assertTrue(hasattr(FUT, 'queryNextUtility'))
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore')
+
+ from zope.site import next as FUT
+ self.assertTrue(hasattr(FUT, 'queryNextUtility'))
class TestHooks(unittest.TestCase):
def test_import(self):
- from zope.site import hooks as FUT
- self.assertTrue(hasattr(FUT, 'setSite'))
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore')
+
+ from zope.site import hooks as FUT
+ self.assertTrue(hasattr(FUT, 'setSite'))
diff --git a/src/zope/site/tests/test_registration.py b/src/zope/site/tests/test_registration.py
index 041ecc6..80f4677 100644
--- a/src/zope/site/tests/test_registration.py
+++ b/src/zope/site/tests/test_registration.py
@@ -68,8 +68,8 @@ class Test(unittest.TestCase):
# We want to make sure that we see updates correctly.
- import ZODB.tests.util
- db = ZODB.tests.util.DB()
+ from ZODB.MappingStorage import DB
+ db = DB()
tm1 = transaction.TransactionManager()
c1 = db.open(transaction_manager=tm1)
r1 = zope.site.site._LocalAdapterRegistry((base,))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 7
}
|
4.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"coverage",
"pytest"
],
"pre_install": null,
"python": "3.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///croot/attrs_1668696182826/work
BTrees==5.2
certifi @ file:///croot/certifi_1671487769961/work/certifi
cffi==1.15.1
coverage==7.2.7
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
multipart==1.1.0
packaging @ file:///croot/packaging_1671697413597/work
persistent==5.2
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pycparser==2.21
pytest==7.1.2
python-gettext==5.0
pytz==2025.2
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
transaction==4.0
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zc.lockfile==3.0.post1
ZConfig==4.1
zipp @ file:///croot/zipp_1672387121353/work
ZODB==6.0
zodbpickle==3.3
zope.annotation==5.0
zope.browser==3.0
zope.cachedescriptors==5.0
zope.component==6.0
zope.configuration==5.0.1
zope.container==5.2
zope.contenttype==5.1
zope.deferredimport==5.0
zope.deprecation==5.0
zope.dottedname==6.0
zope.event==5.0
zope.exceptions==5.1
zope.filerepresentation==6.0
zope.hookable==6.0
zope.i18n==5.1
zope.i18nmessageid==6.1.0
zope.interface==6.4.post2
zope.lifecycleevent==5.0
zope.location==5.0
zope.proxy==5.3
zope.publisher==7.0
zope.schema==7.0.1
zope.security==6.2
-e git+https://github.com/zopefoundation/zope.site.git@a711e599297c8f42044f88137850a2c48b4a29b2#egg=zope.site
zope.size==5.0
zope.testing==5.0.1
zope.testrunner==6.5
zope.traversing==5.0
|
name: zope.site
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=22.1.0=py37h06a4308_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- flit-core=3.6.0=pyhd3eb1b0_0
- importlib-metadata=4.11.3=py37h06a4308_0
- importlib_metadata=4.11.3=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=22.0=py37h06a4308_0
- pip=22.3.1=py37h06a4308_0
- pluggy=1.0.0=py37h06a4308_1
- py=1.11.0=pyhd3eb1b0_0
- pytest=7.1.2=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py37h06a4308_0
- typing_extensions=4.4.0=py37h06a4308_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zipp=3.11.0=py37h06a4308_0
- zlib=1.2.13=h5eee18b_1
- pip:
- btrees==5.2
- cffi==1.15.1
- coverage==7.2.7
- multipart==1.1.0
- persistent==5.2
- pycparser==2.21
- python-gettext==5.0
- pytz==2025.2
- transaction==4.0
- zc-lockfile==3.0.post1
- zconfig==4.1
- zodb==6.0
- zodbpickle==3.3
- zope-annotation==5.0
- zope-browser==3.0
- zope-cachedescriptors==5.0
- zope-component==6.0
- zope-configuration==5.0.1
- zope-container==5.2
- zope-contenttype==5.1
- zope-deferredimport==5.0
- zope-deprecation==5.0
- zope-dottedname==6.0
- zope-event==5.0
- zope-exceptions==5.1
- zope-filerepresentation==6.0
- zope-hookable==6.0
- zope-i18n==5.1
- zope-i18nmessageid==6.1.0
- zope-interface==6.4.post2
- zope-lifecycleevent==5.0
- zope-location==5.0
- zope-proxy==5.3
- zope-publisher==7.0
- zope-schema==7.0.1
- zope-security==6.2
- zope-size==5.0
- zope-testing==5.0.1
- zope-testrunner==6.5
- zope-traversing==5.0
prefix: /opt/conda/envs/zope.site
|
[
"src/zope/site/tests/test_bwc.py::TestNext::test_import",
"src/zope/site/tests/test_bwc.py::TestHooks::test_import",
"src/zope/site/tests/test_registration.py::Test::test_deghostification_of_persistent_adapter_registries"
] |
[] |
[] |
[] |
Zope Public License 2.1
| 3,273 |
[
"src/zope/site/configure.zcml",
"setup.py",
"src/zope/site/site.py",
"src/zope/site/site.rst",
"src/zope/site/interfaces.py",
"CHANGES.rst",
"src/zope/site/folder.py"
] |
[
"src/zope/site/configure.zcml",
"setup.py",
"src/zope/site/site.py",
"src/zope/site/site.rst",
"src/zope/site/interfaces.py",
"CHANGES.rst",
"src/zope/site/folder.py"
] |
|
kofferdahl__bme590hrm-23
|
744f3fa1931c73cde846eba0e61b3df82f4fe683
|
2018-10-19 14:03:40
|
744f3fa1931c73cde846eba0e61b3df82f4fe683
|
diff --git a/HRM_Processor.py b/HRM_Processor.py
index b6234c5..6b4e7c3 100644
--- a/HRM_Processor.py
+++ b/HRM_Processor.py
@@ -15,3 +15,39 @@ class HRM_Processor:
self.input_data = DataReader.output_dict
self.output_dict = {}
+ self.write_outputs_to_dict()
+
+ def write_outputs_to_dict(self):
+ """Writes all of the HRM_Processor's outputs to it's output
+ dictionary by calling the relevant functions to generate those outputs.
+
+ Returns
+ -------
+ None
+
+ """
+ voltage_extremes = self.determine_voltage_extremes(self.input_data[
+ "voltage"])
+ self.output_dict["voltage_extremes"] = voltage_extremes
+
+ def determine_voltage_extremes(self, voltage):
+ """Determines the min and max values of the voltage data
+
+ Parameters
+ ----------
+ voltage: numpy array
+ Contains the voltage ad
+
+ Returns
+ -------
+ voltage_extremes: tuple(float, float)
+ A tuple containing the min and max values of the
+ voltage data in the format (min, max)
+
+ """
+ voltage_min = np.amin(voltage)
+ voltage_max = np.amax(voltage)
+
+ voltage_extremes = (voltage_min, voltage_max)
+
+ return voltage_extremes
|
HRM_Processor must be able to determine voltage extremes
The HRM_Processor requires functionality to determine the extremes of a voltage array, and output the min and max voltages as a tuple to the output dictionary.
Input: numpy arrays containing voltage data
Output: a tuple containing the minimum and maximum values of the voltage data
The test for this feature will be whether or not the function that determines the voltage extremes reliably returns a tuple containing the min and maximum values of a numpy array.
|
kofferdahl/bme590hrm
|
diff --git a/conftest.py b/conftest.py
index 075fe64..e86293e 100644
--- a/conftest.py
+++ b/conftest.py
@@ -1,5 +1,6 @@
import pytest
from DataReader import DataReader
+from HRM_Processor import HRM_Processor
@pytest.fixture
@@ -11,7 +12,7 @@ def dr():
@pytest.fixture
-def hrm():
+def hrm(dr):
"""Create a basic HRM_Processor from the dr object"""
hrm = HRM_Processor(dr)
diff --git a/test_HRM_Processor.py b/test_HRM_Processor.py
index 00a05d0..f0f5bac 100644
--- a/test_HRM_Processor.py
+++ b/test_HRM_Processor.py
@@ -1,6 +1,7 @@
import pytest
from DataReader import DataReader
from HRM_Processor import HRM_Processor
+import numpy as np
def test_HRM_Processor_init(dr):
@@ -18,3 +19,17 @@ def test_HRM_Processor_init(dr):
"""
hrm_proc = HRM_Processor(dr)
assert dr.output_dict == hrm_proc.input_data
+
+
+def test_voltage_extremes(hrm):
+
+ voltage = np.array([-1.502, -7.9, 3.5, 2.1, 8.7, 4.0])
+
+ voltage_extremes = hrm.determine_voltage_extremes(voltage)
+
+ assert voltage_extremes == (-7.9, 8.7)
+
+
+def test_write_outputs_to_dict_voltage_extremes(hrm):
+
+ assert hrm.output_dict["voltage_extremes"] == (10.0, 20.0)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 1
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -r requirements.txt",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
numpy==2.0.2
packaging==24.2
pep8==1.7.1
pluggy==1.5.0
pytest==8.3.5
pytest-cache==1.0
pytest-cov==6.0.0
pytest-pep8==1.0.6
tomli==2.2.1
|
name: bme590hrm
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- numpy==2.0.2
- packaging==24.2
- pep8==1.7.1
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cache==1.0
- pytest-cov==6.0.0
- pytest-pep8==1.0.6
- tomli==2.2.1
prefix: /opt/conda/envs/bme590hrm
|
[
"test_HRM_Processor.py::test_voltage_extremes",
"test_HRM_Processor.py::test_write_outputs_to_dict_voltage_extremes"
] |
[] |
[
"test_HRM_Processor.py::test_HRM_Processor_init"
] |
[] | null | 3,274 |
[
"HRM_Processor.py"
] |
[
"HRM_Processor.py"
] |
|
datosgobar__pydatajson-210
|
3b9447bbe8f4250cc1b3def1e014f67c4fca0eb0
|
2018-10-19 14:09:54
|
adb85a7de7dfa073ddf9817a5fe2d125f9ce4e54
|
diff --git a/docs/MANUAL.md b/docs/MANUAL.md
index 207d9fe..e03b74f 100644
--- a/docs/MANUAL.md
+++ b/docs/MANUAL.md
@@ -428,6 +428,15 @@ Toma los siguientes parámetros:
portal de destino. Si no se pasa, se toma como organización el catalog_id
Retorna el id en el nodo de destino de los datasets federados.
+
+### Métodos para manejo de organizaciones
+
+- **pydatajson.federation.get_organizations_from_ckan()**: Devuelve el árbol de organizaciones del portal pasado por parámetro.
+Toma los siguientes parámetros:
+ - **portal_url**: URL del portal de CKAN. Debe implementar el endpoint `/group_tree`.
+
+ Retorna una lista de diccionarios con la información de las organizaciones. Recursivamente, dentro del campo `children`,
+ se encuentran las organizaciones dependientes en la jerarquía.
## Anexo I: Estructura de respuestas
diff --git a/pydatajson/federation.py b/pydatajson/federation.py
index 6e57ec1..1138121 100644
--- a/pydatajson/federation.py
+++ b/pydatajson/federation.py
@@ -300,3 +300,17 @@ def push_new_themes(catalog, portal_url, apikey):
catalog, portal_url, apikey, identifier=new_theme)
pushed_names.append(name)
return pushed_names
+
+
+def get_organizations_from_ckan(portal_url):
+ """Toma la url de un portal y devuelve su árbol de organizaciones.
+
+ Args:
+ portal_url (str): La URL del portal CKAN de origen.
+ Returns:
+ dict: Diccionarios anidados con la información de
+ las organizaciones.
+ """
+ ckan_portal = RemoteCKAN(portal_url)
+ return ckan_portal.call_action('group_tree',
+ data_dict={'type': 'organization'})
|
Get organizations from ckan
El objetivo es implementar un método que pasada la url de un portal, devuelva las organizaciones presentes completas con su jerarquía.
|
datosgobar/pydatajson
|
diff --git a/tests/test_federation.py b/tests/test_federation.py
index 746ae23..58449e4 100644
--- a/tests/test_federation.py
+++ b/tests/test_federation.py
@@ -18,12 +18,15 @@ from ckanapi.errors import NotFound
SAMPLES_DIR = os.path.join("tests", "samples")
-class PushDatasetTestCase(unittest.TestCase):
-
+class FederationSuite(unittest.TestCase):
@classmethod
def get_sample(cls, sample_filename):
return os.path.join(SAMPLES_DIR, sample_filename)
+
+@patch('pydatajson.federation.RemoteCKAN', autospec=True)
+class PushDatasetTestCase(FederationSuite):
+
@classmethod
def setUpClass(cls):
cls.catalog = pydatajson.DataJson(cls.get_sample('full_data.json'))
@@ -43,7 +46,6 @@ class PushDatasetTestCase(unittest.TestCase):
cls.minimum_dataset['distribution'][0][
'identifier'] = cls.dataset['distribution'][0]['identifier']
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_id_is_created_correctly(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'package_update':
@@ -62,7 +64,6 @@ class PushDatasetTestCase(unittest.TestCase):
catalog_id=self.catalog_id)
self.assertEqual(self.catalog_id + '_' + self.dataset_id, res_id)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_id_is_updated_correctly(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'package_update':
@@ -81,7 +82,6 @@ class PushDatasetTestCase(unittest.TestCase):
catalog_id=self.catalog_id)
self.assertEqual(self.catalog_id + '_' + self.dataset_id, res_id)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_dataset_id_is_preserved_if_catalog_id_is_not_passed(
self, mock_portal):
def mock_call_action(action, data_dict=None):
@@ -97,7 +97,6 @@ class PushDatasetTestCase(unittest.TestCase):
'portal', 'key')
self.assertEqual(self.dataset_id, res_id)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_tags_are_passed_correctly(self, mock_portal):
themes = self.dataset['theme']
keywords = [kw for kw in self.dataset['keyword']]
@@ -132,7 +131,6 @@ class PushDatasetTestCase(unittest.TestCase):
catalog_id=self.catalog_id)
self.assertEqual(self.catalog_id + '_' + self.dataset_id, res_id)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_licenses_are_interpreted_correctly(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'license_list':
@@ -149,7 +147,6 @@ class PushDatasetTestCase(unittest.TestCase):
push_dataset_to_ckan(self.catalog, 'owner', self.dataset_id,
'portal', 'key', catalog_id=self.catalog_id)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_dataset_without_license_sets_notspecified(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'license_list':
@@ -172,7 +169,6 @@ class PushDatasetTestCase(unittest.TestCase):
'key',
catalog_id=self.minimum_catalog_id)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_dataset_level_wrappers(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'package_update':
@@ -192,7 +188,6 @@ class PushDatasetTestCase(unittest.TestCase):
self.assertEqual(self.dataset_id, restored_id)
self.assertEqual(self.catalog_id + '_' + self.dataset_id, harvested_id)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_harvest_catalog_with_no_optional_parametres(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'package_update':
@@ -218,7 +213,6 @@ class PushDatasetTestCase(unittest.TestCase):
for ds in self.catalog.datasets],
harvested_ids)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_harvest_catalog_with_dataset_list(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'package_update':
@@ -254,7 +248,6 @@ class PushDatasetTestCase(unittest.TestCase):
[self.catalog_id + '_' + ds_id for ds_id in dataset_list],
harvested_ids)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_harvest_catalog_with_owner_org(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'package_update':
@@ -275,7 +268,6 @@ class PushDatasetTestCase(unittest.TestCase):
for ds in self.catalog.datasets],
harvested_ids)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_harvest_catalog_with_errors(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'package_update':
@@ -292,7 +284,6 @@ class PushDatasetTestCase(unittest.TestCase):
self.assertDictEqual(
{self.catalog.datasets[1]['identifier']: "some message"}, errors)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_harvest_catalog_with_empty_list(self, mock_portal):
harvested_ids, _ = harvest_catalog_to_ckan(
self.catalog, 'portal', 'key', self.catalog_id,
@@ -301,7 +292,7 @@ class PushDatasetTestCase(unittest.TestCase):
self.assertEqual([], harvested_ids)
-class RemoveDatasetTestCase(unittest.TestCase):
+class RemoveDatasetTestCase(FederationSuite):
@patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_empty_search_doesnt_call_purge(self, mock_portal):
@@ -378,22 +369,17 @@ class RemoveDatasetTestCase(unittest.TestCase):
'dataset_purge', data_dict={'id': 'id_2'})
-class PushThemeTestCase(unittest.TestCase):
-
- @classmethod
- def get_sample(cls, sample_filename):
- return os.path.join(SAMPLES_DIR, sample_filename)
+@patch('pydatajson.federation.RemoteCKAN', autospec=True)
+class PushThemeTestCase(FederationSuite):
@classmethod
def setUpClass(cls):
cls.catalog = pydatajson.DataJson(cls.get_sample('full_data.json'))
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_empty_theme_search_raises_exception(self, mock_portal):
with self.assertRaises(AssertionError):
push_theme_to_ckan(self.catalog, 'portal_url', 'apikey')
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_function_pushes_theme_by_identifier(self, mock_portal):
mock_portal.return_value.call_action = MagicMock(
return_value={'name': 'group_name'})
@@ -404,7 +390,6 @@ class PushThemeTestCase(unittest.TestCase):
identifier='compras')
self.assertEqual('group_name', result)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_function_pushes_theme_by_label(self, mock_portal):
mock_portal.return_value.call_action = MagicMock(
return_value={'name': 'other_name'})
@@ -415,7 +400,6 @@ class PushThemeTestCase(unittest.TestCase):
label='Adjudicaciones')
self.assertEqual('other_name', result)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_ckan_portal_is_called_with_correct_parametres(self, mock_portal):
mock_portal.return_value.call_action = MagicMock(
return_value={'name': u'contrataciones'})
@@ -431,16 +415,13 @@ class PushThemeTestCase(unittest.TestCase):
'group_create', data_dict=group)
-class PushCatalogThemesTestCase(unittest.TestCase):
- @classmethod
- def get_sample(cls, sample_filename):
- return os.path.join(SAMPLES_DIR, sample_filename)
+@patch('pydatajson.federation.RemoteCKAN', autospec=True)
+class PushCatalogThemesTestCase(FederationSuite):
@classmethod
def setUpClass(cls):
cls.catalog = pydatajson.DataJson(cls.get_sample('full_data.json'))
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_empty_portal_pushes_every_theme(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'group_list':
@@ -461,7 +442,6 @@ class PushCatalogThemesTestCase(unittest.TestCase):
[theme['id'] for theme in self.catalog['themeTaxonomy']],
res_names)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_full_portal_pushes_nothing(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'group_list':
@@ -476,7 +456,6 @@ class PushCatalogThemesTestCase(unittest.TestCase):
except AttributeError:
self.assertCountEqual([], res_names)
- @patch('pydatajson.federation.RemoteCKAN', autospec=True)
def test_non_empty_intersection_pushes_missing_themes(self, mock_portal):
def mock_call_action(action, data_dict=None):
if action == 'group_list':
@@ -497,3 +476,12 @@ class PushCatalogThemesTestCase(unittest.TestCase):
self.assertCountEqual(
[theme['id'] for theme in self.catalog['themeTaxonomy']][2:],
res_names)
+
+
+@patch('pydatajson.federation.RemoteCKAN', autospec=True)
+class OrganizationsTestCase(FederationSuite):
+
+ def test_get_organization_calls_api_correctly(self, mock_portal):
+ get_organizations_from_ckan('portal_url')
+ mock_portal.return_value.call_action.assert_called_with(
+ 'group_tree', data_dict={'type': 'organization'})
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 2
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
ckanapi==4.0
docopt==0.6.2
et-xmlfile==1.1.0
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.0
jdcal==1.4.1
jsonschema==2.6.0
openpyxl==2.4.11
packaging==21.3
pluggy==1.0.0
py==1.11.0
-e git+https://github.com/datosgobar/pydatajson.git@3b9447bbe8f4250cc1b3def1e014f67c4fca0eb0#egg=pydatajson
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.6.1
requests==2.27.1
rfc3987==1.3.7
six==1.11.0
tomli==1.2.3
typing_extensions==4.1.1
unicodecsv==0.14.1
Unidecode==0.4.21
urllib3==1.22
zipp==3.6.0
|
name: pydatajson
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- ckanapi==4.0
- docopt==0.6.2
- et-xmlfile==1.1.0
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.6.0
- jdcal==1.4.1
- jsonschema==2.6.0
- openpyxl==2.4.11
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.6.1
- requests==2.27.1
- rfc3987==1.3.7
- six==1.11.0
- tomli==1.2.3
- typing-extensions==4.1.1
- unicodecsv==0.14.1
- unidecode==0.04.21
- urllib3==1.22
- zipp==3.6.0
prefix: /opt/conda/envs/pydatajson
|
[
"tests/test_federation.py::OrganizationsTestCase::test_get_organization_calls_api_correctly"
] |
[] |
[
"tests/test_federation.py::PushDatasetTestCase::test_dataset_id_is_preserved_if_catalog_id_is_not_passed",
"tests/test_federation.py::PushDatasetTestCase::test_dataset_level_wrappers",
"tests/test_federation.py::PushDatasetTestCase::test_dataset_without_license_sets_notspecified",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_dataset_list",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_empty_list",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_errors",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_no_optional_parametres",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_owner_org",
"tests/test_federation.py::PushDatasetTestCase::test_id_is_created_correctly",
"tests/test_federation.py::PushDatasetTestCase::test_id_is_updated_correctly",
"tests/test_federation.py::PushDatasetTestCase::test_licenses_are_interpreted_correctly",
"tests/test_federation.py::PushDatasetTestCase::test_tags_are_passed_correctly",
"tests/test_federation.py::RemoveDatasetTestCase::test_empty_search_doesnt_call_purge",
"tests/test_federation.py::RemoveDatasetTestCase::test_filter_in_datasets",
"tests/test_federation.py::RemoveDatasetTestCase::test_filter_in_out_datasets",
"tests/test_federation.py::RemoveDatasetTestCase::test_query_one_dataset",
"tests/test_federation.py::RemoveDatasetTestCase::test_query_over_500_datasets",
"tests/test_federation.py::RemoveDatasetTestCase::test_remove_through_filters_and_organization",
"tests/test_federation.py::PushThemeTestCase::test_ckan_portal_is_called_with_correct_parametres",
"tests/test_federation.py::PushThemeTestCase::test_empty_theme_search_raises_exception",
"tests/test_federation.py::PushThemeTestCase::test_function_pushes_theme_by_identifier",
"tests/test_federation.py::PushThemeTestCase::test_function_pushes_theme_by_label",
"tests/test_federation.py::PushCatalogThemesTestCase::test_empty_portal_pushes_every_theme",
"tests/test_federation.py::PushCatalogThemesTestCase::test_full_portal_pushes_nothing",
"tests/test_federation.py::PushCatalogThemesTestCase::test_non_empty_intersection_pushes_missing_themes"
] |
[] |
MIT License
| 3,275 |
[
"pydatajson/federation.py",
"docs/MANUAL.md"
] |
[
"pydatajson/federation.py",
"docs/MANUAL.md"
] |
|
kofferdahl__bme590hrm-24
|
8aff88d12a3c30bc3bcbfcff2be8954e20047035
|
2018-10-19 14:32:42
|
8aff88d12a3c30bc3bcbfcff2be8954e20047035
|
diff --git a/HRM_Processor.py b/HRM_Processor.py
index 6b4e7c3..b3ed186 100644
--- a/HRM_Processor.py
+++ b/HRM_Processor.py
@@ -30,6 +30,10 @@ class HRM_Processor:
"voltage"])
self.output_dict["voltage_extremes"] = voltage_extremes
+ ecg_strip_duration = self.determine_ecg_strip_duration(self.input_data[
+ "time"])
+ self.output_dict["duration"] = ecg_strip_duration
+
def determine_voltage_extremes(self, voltage):
"""Determines the min and max values of the voltage data
@@ -51,3 +55,19 @@ class HRM_Processor:
voltage_extremes = (voltage_min, voltage_max)
return voltage_extremes
+
+ def determine_ecg_strip_duration(self, time):
+ """
+
+ Parameters
+ ----------
+ time: np array
+ Contains the time vector from the CSV file
+
+ Returns
+ -------
+ strip_duration: float
+ The max time value of the ecg strip = strip duration
+ """
+ strip_duration = np.amax(time)
+ return strip_duration
|
HRM_Processor needs to determine the duration of an ECG strip
The HRM_Processor should be able to determine the duration of an ECG strip, and write that value to the output dictionary.
Input: numpy array containing time data
Output: a float containing the maximum value in the time array
The test for this function will be whether or not it returns the maximum value of an input time array.
|
kofferdahl/bme590hrm
|
diff --git a/test_HRM_Processor.py b/test_HRM_Processor.py
index f0f5bac..ef1ec7e 100644
--- a/test_HRM_Processor.py
+++ b/test_HRM_Processor.py
@@ -33,3 +33,16 @@ def test_voltage_extremes(hrm):
def test_write_outputs_to_dict_voltage_extremes(hrm):
assert hrm.output_dict["voltage_extremes"] == (10.0, 20.0)
+
+
+def test_determine_ecg_strip_duration(hrm):
+ time = np.array([0, 2.2, 5, 7.5])
+
+ strip_duration = hrm.determine_ecg_strip_duration(time)
+
+ assert strip_duration == 7.5
+
+
+def test_write_strip_duration(hrm):
+
+ assert hrm.output_dict["duration"] == 2
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 1
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -r requirements.txt",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
numpy==2.0.2
packaging==24.2
pep8==1.7.1
pluggy==1.5.0
pytest==8.3.5
pytest-cache==1.0
pytest-cov==6.0.0
pytest-pep8==1.0.6
tomli==2.2.1
|
name: bme590hrm
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- numpy==2.0.2
- packaging==24.2
- pep8==1.7.1
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cache==1.0
- pytest-cov==6.0.0
- pytest-pep8==1.0.6
- tomli==2.2.1
prefix: /opt/conda/envs/bme590hrm
|
[
"test_HRM_Processor.py::test_determine_ecg_strip_duration",
"test_HRM_Processor.py::test_write_strip_duration"
] |
[] |
[
"test_HRM_Processor.py::test_HRM_Processor_init",
"test_HRM_Processor.py::test_voltage_extremes",
"test_HRM_Processor.py::test_write_outputs_to_dict_voltage_extremes"
] |
[] | null | 3,276 |
[
"HRM_Processor.py"
] |
[
"HRM_Processor.py"
] |
|
ansible__ansible-runner-161
|
d9940a55288386abcce8e1e41bd93d8c671a06ca
|
2018-10-19 15:49:22
|
339810c1573cb54d116b8eba4af5c454c18acc56
|
softwarefactory-project-zuul[bot]: Build failed.
- [tox ](https://ansible.softwarefactory-project.io/logs/61/161/7b31a8f7b603d672b9c8fbb4371fb1c1aa200446/check/tox/3807b7a/) : FAILURE in 4m 49s
|
diff --git a/ansible_runner/runner.py b/ansible_runner/runner.py
index 23b711b..2e8a6cf 100644
--- a/ansible_runner/runner.py
+++ b/ansible_runner/runner.py
@@ -71,12 +71,11 @@ class Runner(object):
def status_callback(self, status):
self.status = status
+ status_data = dict(status=status, runner_ident=str(self.config.ident))
for plugin in ansible_runner.plugins:
- ansible_runner.plugins[plugin].status_handler(self.config,
- dict(status=status,
- runner_ident=str(self.config.ident)))
+ ansible_runner.plugins[plugin].status_handler(self.config, status_data)
if self.status_handler is not None:
- self.status_handler(status)
+ self.status_handler(status_data)
def run(self):
'''
|
Different data passed to status_handler plugin vs kwargs
Hi,
As you can see from my PR, I'm using `ansible.runner.run(status_handler=my_handler)`. I noticed that [Runner.status_callback](https://github.com/ansible/ansible-runner/blob/ce3c90f97fc7c7e7bdc6a53494503b9a907875c0/ansible_runner/runner.py#L76) passes different "data" to `status_handler` defined via **kwargs** vs `status_handler` defined in **plugins**.
Basically, plugins get a dict with *status* and *runner_ident*, opposed to the "kwargs-status_handler" that only gets the status.
Is there any reasoning behind? For me this looks odd, I'd like to get the runner-ident, too.
If you agree to change this, I could create another PR if you like.
|
ansible/ansible-runner
|
diff --git a/test/unit/test_runner.py b/test/unit/test_runner.py
index c527ab6..1ac3c67 100644
--- a/test/unit/test_runner.py
+++ b/test/unit/test_runner.py
@@ -109,5 +109,5 @@ def test_status_callback_interface(rc):
runner.status_handler = mock.Mock()
runner.status_callback("running")
assert runner.status_handler.call_count == 1
- runner.status_handler.assert_called_with('running')
+ runner.status_handler.assert_called_with(dict(status='running', runner_ident=str(rc.ident)))
assert runner.status == 'running'
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 1,
"test_score": 3
},
"num_modified_files": 1
}
|
1.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "Pipfile",
"pip_packages": [
"pytest",
"mock",
"ansible"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
ansible==8.7.0
ansible-core==2.15.13
-e git+https://github.com/ansible/ansible-runner.git@d9940a55288386abcce8e1e41bd93d8c671a06ca#egg=ansible_runner
cffi==1.17.1
cryptography==44.0.2
exceptiongroup==1.2.2
importlib-resources==5.0.7
iniconfig==2.1.0
Jinja2==3.1.6
lockfile==0.12.2
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pexpect==4.9.0
pipfile==0.0.2
pluggy==1.5.0
psutil==7.0.0
ptyprocess==0.7.0
pycparser==2.22
pytest==8.3.5
python-daemon==3.1.2
PyYAML==6.0.2
resolvelib==1.0.1
six==1.17.0
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==2.2.1
|
name: ansible-runner
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- pipfile=0.0.2=py_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- ansible==8.7.0
- ansible-core==2.15.13
- cffi==1.17.1
- cryptography==44.0.2
- exceptiongroup==1.2.2
- importlib-resources==5.0.7
- iniconfig==2.1.0
- jinja2==3.1.6
- lockfile==0.12.2
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pexpect==4.9.0
- pluggy==1.5.0
- psutil==7.0.0
- ptyprocess==0.7.0
- pycparser==2.22
- pytest==8.3.5
- python-daemon==3.1.2
- pyyaml==6.0.2
- resolvelib==1.0.1
- six==1.17.0
- tomli==2.2.1
prefix: /opt/conda/envs/ansible-runner
|
[
"test/unit/test_runner.py::test_status_callback_interface"
] |
[
"test/unit/test_runner.py::test_job_timeout",
"test/unit/test_runner.py::test_cancel_callback",
"test/unit/test_runner.py::test_cancel_callback_error",
"test/unit/test_runner.py::test_env_vars[abc123]",
"test/unit/test_runner.py::test_env_vars[I\\xf1t\\xebrn\\xe2ti\\xf4n\\xe0liz\\xe6ti\\xf8n]"
] |
[
"test/unit/test_runner.py::test_simple_spawn",
"test/unit/test_runner.py::test_error_code",
"test/unit/test_runner.py::test_event_callback_interface_has_ident"
] |
[] |
Apache License 2.0
| 3,277 |
[
"ansible_runner/runner.py"
] |
[
"ansible_runner/runner.py"
] |
dwavesystems__dimod-296
|
30c9b5a8bc289aee9b276a4ebc2ce27e8413e2f9
|
2018-10-19 20:29:22
|
2f6e129f4894ae07d16aa290c35d7e7859138cc8
|
diff --git a/dimod/sampleset.py b/dimod/sampleset.py
index 682aac68..70e3795f 100644
--- a/dimod/sampleset.py
+++ b/dimod/sampleset.py
@@ -21,6 +21,8 @@ of NumPy's array_like_ to allow for arbitrary variable labels.
like-objects-to-numpy-arrays
"""
+import itertools
+
from collections import Iterable, Sized, Mapping, Iterator
from collections import namedtuple
|
Missing itertools import
**Description**
Missing itertools import in `sampleset.py`
https://github.com/dwavesystems/dimod/blob/30c9b5a8bc289aee9b276a4ebc2ce27e8413e2f9/dimod/sampleset.py#L517
**Steps To Reproduce**
```
resp.samples(n=1)
```
|
dwavesystems/dimod
|
diff --git a/tests/test_sampleset.py b/tests/test_sampleset.py
index 0e952b2e..2c2b8be4 100644
--- a/tests/test_sampleset.py
+++ b/tests/test_sampleset.py
@@ -83,6 +83,11 @@ class TestSampleSet(unittest.TestCase):
self.assertNotEqual(ss0, ss2)
self.assertNotEqual(ss1, ss3)
+ def test_shorter_samples(self):
+ ss = dimod.SampleSet.from_samples(np.ones((100, 5), dtype='int8'), dimod.BINARY, energy=np.ones(100))
+
+ self.assertEqual(len(list(ss.samples(n=1))), 1)
+
class TestSampleSetSerialization(unittest.TestCase):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 1
}
|
0.7
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[all]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc libboost-dev"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
Cython==3.0.12
decorator==5.1.1
-e git+https://github.com/dwavesystems/dimod.git@30c9b5a8bc289aee9b276a4ebc2ce27e8413e2f9#egg=dimod
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
jsonschema==2.6.0
mock==2.0.0
networkx==2.0
numpy==1.15.0
packaging==21.3
pandas==0.22.0
pbr==6.1.1
pluggy==1.0.0
py==1.11.0
pymongo==3.7.1
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
pytz==2025.2
requests==2.27.1
six==1.11.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0
|
name: dimod
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- codecov==2.1.13
- coverage==6.2
- cython==3.0.12
- decorator==5.1.1
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- jsonschema==2.6.0
- mock==2.0.0
- networkx==2.0
- numpy==1.15.0
- packaging==21.3
- pandas==0.22.0
- pbr==6.1.1
- pluggy==1.0.0
- py==1.11.0
- pymongo==3.7.1
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pytz==2025.2
- requests==2.27.1
- six==1.11.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- zipp==3.6.0
prefix: /opt/conda/envs/dimod
|
[
"tests/test_sampleset.py::TestSampleSet::test_shorter_samples"
] |
[] |
[
"tests/test_sampleset.py::TestSampleSet::test_eq_ordered",
"tests/test_sampleset.py::TestSampleSet::test_from_samples",
"tests/test_sampleset.py::TestSampleSet::test_from_samples_iterator",
"tests/test_sampleset.py::TestSampleSet::test_from_samples_single_sample",
"tests/test_sampleset.py::TestSampleSet::test_from_samples_str_labels",
"tests/test_sampleset.py::TestSampleSetSerialization::test_functional_json",
"tests/test_sampleset.py::TestSampleSetSerialization::test_functional_simple_shapes",
"tests/test_sampleset.py::TestSampleSetSerialization::test_functional_str"
] |
[] |
Apache License 2.0
| 3,278 |
[
"dimod/sampleset.py"
] |
[
"dimod/sampleset.py"
] |
|
zopefoundation__persistent-97
|
598f9ab73dbf8b8d70cb706dc6eb53ec8598c8fe
|
2018-10-19 20:44:19
|
767328558857cc2fb02064b85981cbab87bc3d94
|
diff --git a/CHANGES.rst b/CHANGES.rst
index c9272ea..69afaec 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,7 +4,10 @@
4.4.3 (unreleased)
------------------
-- Nothing changed yet.
+- Fix the repr of the persistent objects to include the module name
+ when using the C extension. This matches the pure-Python behaviour
+ and the behaviour prior to 4.4.0. See `issue 92
+ <https://github.com/zopefoundation/persistent/issues/92>`_.
4.4.2 (2018-08-28)
diff --git a/persistent/cPersistence.c b/persistent/cPersistence.c
index 9e0f3ae..5e78cdc 100644
--- a/persistent/cPersistence.c
+++ b/persistent/cPersistence.c
@@ -1423,6 +1423,8 @@ Per_repr(cPersistentObject *self)
PyObject *prepr = NULL;
PyObject *prepr_exc_str = NULL;
+ PyObject *module = NULL;
+ PyObject *name = NULL;
PyObject *oid_str = NULL;
PyObject *jar_str = NULL;
PyObject *result = NULL;
@@ -1454,15 +1456,32 @@ Per_repr(cPersistentObject *self)
if (!jar_str)
goto cleanup;
- result = PyUnicode_FromFormat("<%s object at %p%S%S%S>",
- Py_TYPE(self)->tp_name, self,
- oid_str, jar_str, prepr_exc_str);
+ module = PyObject_GetAttrString((PyObject*)Py_TYPE(self), "__module__");
+ name = PyObject_GetAttrString((PyObject*)Py_TYPE(self), "__name__");
+
+ if (!module || !name) {
+ /*
+ Some error retrieving __module__ or __name__. Ignore it, use the
+ C data.
+ */
+ PyErr_Clear();
+ result = PyUnicode_FromFormat("<%s object at %p%S%S%S>",
+ Py_TYPE(self)->tp_name, self,
+ oid_str, jar_str, prepr_exc_str);
+ }
+ else {
+ result = PyUnicode_FromFormat("<%S.%S object at %p%S%S%S>",
+ module, name, self,
+ oid_str, jar_str, prepr_exc_str);
+ }
cleanup:
Py_XDECREF(prepr);
Py_XDECREF(prepr_exc_str);
Py_XDECREF(oid_str);
Py_XDECREF(jar_str);
+ Py_XDECREF(name);
+ Py_XDECREF(module);
return result;
}
diff --git a/persistent/persistence.py b/persistent/persistence.py
index 8d72ce1..8af2b8a 100644
--- a/persistent/persistence.py
+++ b/persistent/persistence.py
@@ -585,7 +585,9 @@ class Persistent(object):
jar_str = ' in %r' % (e,)
return '<%s.%s object at 0x%x%s%s%s>' % (
- type(self).__module__, type(self).__name__, id(self),
+ # Match the C name for this exact class
+ type(self).__module__ if type(self) is not Persistent else 'persistent',
+ type(self).__name__, id(self),
oid_str, jar_str, p_repr_str
)
|
Type name varies in the repr() depending on the presence of the C extension
This manifests in breakage of [BTrees tests](https://travis-ci.org/zopefoundation/BTrees/jobs/415400906) when the C extensions are used (they pass when the pure-Python extensions are available).
This is a somewhat common problem. There's a [python-dev thread](https://mail.python.org/pipermail/python-dev/2018-September/155150.html) and [bpo-issue](https://bugs.python.org/issue34595) about this. In particular, in the issue, and one of the [PRs that fixes it](https://github.com/python/cpython/pull/9122/) it's pointed out that getting the correct qualified name in a C type can be complex depending on things like `Py_TPFLAGS_HEAPTYPE` (and that's just on Python 3, I don't know if there's an equivalent of `ht_qualname` on Python 2).
Is this a bug here that we should fix, or should downstream consumers be prepared to deal with the difference? In one of my own downstream projects I dealt with the difference. But BTrees already deals with the difference in its own code to produce equivalent reprs in Python as we *used* to get from C. (See https://github.com/zopefoundation/BTrees/issues/94)
|
zopefoundation/persistent
|
diff --git a/persistent/tests/test_persistence.py b/persistent/tests/test_persistence.py
index 9ded7e2..7b502dc 100644
--- a/persistent/tests/test_persistence.py
+++ b/persistent/tests/test_persistence.py
@@ -1698,9 +1698,6 @@ class _Persistent_Base(object):
self.assertEqual(candidate.set_by_new, 1)
def _normalize_repr(self, r):
- # Pure-python vs C
- r = r.replace('persistent.persistence.Persistent', 'persistent.Persistent')
- r = r.replace("persistent.tests.test_persistence.", '')
# addresses
r = re.sub(r'0x[0-9a-fA-F]*', '0xdeadbeef', r)
# Python 3.7 removed the trailing , in exception reprs
@@ -1842,14 +1839,14 @@ class _Persistent_Base(object):
result = self._normalized_repr(p)
self.assertEqual(
result,
- "<P object at 0xdeadbeef"
+ "<persistent.tests.test_persistence.P object at 0xdeadbeef"
" _p_repr Exception('_p_repr failed')>")
p._p_oid = b'12345678'
result = self._normalized_repr(p)
self.assertEqual(
result,
- "<P object at 0xdeadbeef oid b'12345678'"
+ "<persistent.tests.test_persistence.P object at 0xdeadbeef oid b'12345678'"
" _p_repr Exception('_p_repr failed')>")
class Jar(object):
@@ -1860,7 +1857,7 @@ class _Persistent_Base(object):
result = self._normalized_repr(p)
self.assertEqual(
result,
- "<P object at 0xdeadbeef oid b'12345678'"
+ "<persistent.tests.test_persistence.P object at 0xdeadbeef oid b'12345678'"
" in <SomeJar> _p_repr Exception('_p_repr failed')>")
def test__p_repr_in_instance_ignored(self):
@@ -1869,7 +1866,8 @@ class _Persistent_Base(object):
p = P()
p._p_repr = lambda: "Instance"
result = self._normalized_repr(p)
- self.assertEqual(result, '<P object at 0xdeadbeef>')
+ self.assertEqual(result,
+ '<persistent.tests.test_persistence.P object at 0xdeadbeef>')
def test__p_repr_baseexception(self):
class P(self._getTargetClass()):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 3
}
|
4.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"zope.testrunner",
"manuel",
"cffi",
"coverage",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
cffi==1.15.1
coverage==6.2
importlib-metadata==4.8.3
iniconfig==1.1.1
manuel==1.13.0
packaging==21.3
-e git+https://github.com/zopefoundation/persistent.git@598f9ab73dbf8b8d70cb706dc6eb53ec8598c8fe#egg=persistent
pluggy==1.0.0
py==1.11.0
pycparser==2.21
pyparsing==3.1.4
pytest==7.0.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
zope.exceptions==4.6
zope.interface==5.5.2
zope.testrunner==5.6
|
name: persistent
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- cffi==1.15.1
- coverage==6.2
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- manuel==1.13.0
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pycparser==2.21
- pyparsing==3.1.4
- pytest==7.0.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
- zope-exceptions==4.6
- zope-interface==5.5.2
- zope-testrunner==5.6
prefix: /opt/conda/envs/persistent
|
[
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_no_oid_in_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_no_oid_no_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_no_oid_repr_jar_raises_exception",
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_oid_and_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_oid_and_jar_raise_exception",
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_oid_no_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_oid_raises_exception_no_jar"
] |
[
"persistent/tests/test_persistence.py::CPersistentTests::test__p_repr_exception",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_repr_in_instance_ignored"
] |
[
"persistent/tests/test_persistence.py::PyPersistentTests::test___delattr___p__names",
"persistent/tests/test_persistence.py::PyPersistentTests::test___delattr__normal_name_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test___delattr__normal_name_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test___delattr__normal_name_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test___delattr__normal_name_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getattribute___non_cooperative",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getattribute___p__names",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getattribute__normal_name_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getattribute__normal_name_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getattribute__normal_name_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getattribute__normal_name_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getattribute__special_name",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getstate__",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getstate___derived_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getstate___derived_w_slots",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getstate___derived_w_slots_in_base_and_derived",
"persistent/tests/test_persistence.py::PyPersistentTests::test___getstate___derived_w_slots_in_base_but_not_derived",
"persistent/tests/test_persistence.py::PyPersistentTests::test___reduce__",
"persistent/tests/test_persistence.py::PyPersistentTests::test___reduce__w_subclass_having_getnewargs",
"persistent/tests/test_persistence.py::PyPersistentTests::test___reduce__w_subclass_having_getnewargs_and_getstate",
"persistent/tests/test_persistence.py::PyPersistentTests::test___reduce__w_subclass_having_getstate",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setattr___p__names",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setattr___v__name",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setattr__normal_name_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setattr__normal_name_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setattr__normal_name_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setattr__normal_name_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___derived_w_slots",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___derived_w_slots_in_base_but_not_derived",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___derived_w_slots_in_base_classes",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___doesnt_fail_on_non_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___doesnt_fail_on_non_string_keys",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___empty",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___interns_dict_keys",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___nonempty",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___nonempty_derived_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test___setstate___nonempty_derived_w_dict_w_two_keys",
"persistent/tests/test_persistence.py::PyPersistentTests::test__ancient_dict_layout_bug",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_activate_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_activate_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_activate_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_activate_leaves_object_in_saved_even_if_object_mutated_self",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_activate_only_sets_state_once",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_activate_w_broken_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_deactivate_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_deactivate_from_changed_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_deactivate_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_deactivate_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_deactivate_from_saved_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_deactivate_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_deactivate_from_unsaved_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_deactivate_when_sticky",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_delattr_w__p__names",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_delattr_w_normal_name",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_getattr_w__p__names",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_getattr_w_normal_name",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_getattr_w_special_names",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_changed_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_changed_w_slots",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_changed_w_slots_compat",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_saved_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_sticky",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_sticky_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_invalidate_from_unsaved_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_mtime_activates_object",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_mtime_no_serial",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_mtime_w_serial",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_repr",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_repr_baseexception",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_repr_exception",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_repr_in_instance_ignored",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_setattr_w__p__name",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_setattr_w_normal_name",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_state_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_state_changed_sticky",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_state_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_state_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_state_saved_sticky",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_state_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_status_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_status_changed_sticky",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_status_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_status_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_status_saved_sticky",
"persistent/tests/test_persistence.py::PyPersistentTests::test__p_status_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_accessed_invalidated_with_jar_and_oid_but_no_cache",
"persistent/tests/test_persistence.py::PyPersistentTests::test_accessed_with_jar_and_oid_but_not_in_cache",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_false_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_false_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_false_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_false_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_none_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_none_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_none_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_none_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_none_when_sticky",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_true_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_true_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_true_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_changed_true_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_estimated_size_bigger",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_estimated_size_just_over_threshold",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_estimated_size_negative",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_estimated_size_small",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_estimated_size_wrong_type",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_jar_not_in_cache_allowed",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_jar_w_new_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_jar_w_valid_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_oid_not_in_cache_allowed",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_oid_w_None_wo_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_oid_w_invalid_oid",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_oid_w_new_oid_w_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_oid_w_new_oid_wo_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_oid_w_valid_oid",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_serial_too_long",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_serial_too_short",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_serial_w_None",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_serial_w_invalid_type",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_serial_w_valid_serial",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_sticky_false_non_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_sticky_false_when_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_sticky_true_non_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_assign_p_sticky_true_when_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_can_set__p_attrs_if_subclass_denies_setattr",
"persistent/tests/test_persistence.py::PyPersistentTests::test_class_conforms_to_IPersistent",
"persistent/tests/test_persistence.py::PyPersistentTests::test_ctor",
"persistent/tests/test_persistence.py::PyPersistentTests::test_del_jar_like_ZODB_abort",
"persistent/tests/test_persistence.py::PyPersistentTests::test_del_jar_no_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_del_jar_of_inactive_object_that_has_no_state",
"persistent/tests/test_persistence.py::PyPersistentTests::test_del_jar_while_in_cache",
"persistent/tests/test_persistence.py::PyPersistentTests::test_del_oid_like_ZODB_abort",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_changed_from_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_changed_from_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_changed_from_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_changed_from_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_changed_from_unsaved_w_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_changed_when_sticky",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_oid_of_subclass_calling_p_delattr",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_oid_w_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_oid_wo_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_delete_p_serial",
"persistent/tests/test_persistence.py::PyPersistentTests::test_instance_conforms_to_IPersistent",
"persistent/tests/test_persistence.py::PyPersistentTests::test_new_ghost_success_not_already_ghost_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test_new_ghost_success_not_already_ghost_slot",
"persistent/tests/test_persistence.py::PyPersistentTests::test_p_accessed_with_jar_with_oid_as_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_p_accessed_with_jar_without_oid",
"persistent/tests/test_persistence.py::PyPersistentTests::test_p_activate_with_jar_without_oid",
"persistent/tests/test_persistence.py::PyPersistentTests::test_p_invalidate_calls_p_deactivate",
"persistent/tests/test_persistence.py::PyPersistentTests::test_p_invalidate_with_slots_broken_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_pickle_roundtrip_simple",
"persistent/tests/test_persistence.py::PyPersistentTests::test_pickle_roundtrip_w_getnewargs_and_getstate",
"persistent/tests/test_persistence.py::PyPersistentTests::test_pickle_roundtrip_w_slots_and_empty_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test_pickle_roundtrip_w_slots_and_filled_dict",
"persistent/tests/test_persistence.py::PyPersistentTests::test_pickle_roundtrip_w_slots_filled_slot",
"persistent/tests/test_persistence.py::PyPersistentTests::test_pickle_roundtrip_w_slots_missing_slot",
"persistent/tests/test_persistence.py::PyPersistentTests::test_query_p_changed_changed",
"persistent/tests/test_persistence.py::PyPersistentTests::test_query_p_changed_ghost",
"persistent/tests/test_persistence.py::PyPersistentTests::test_query_p_changed_saved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_query_p_changed_unsaved",
"persistent/tests/test_persistence.py::PyPersistentTests::test_query_p_estimated_size_del",
"persistent/tests/test_persistence.py::PyPersistentTests::test_query_p_estimated_size_new",
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_no_oid_repr_jar_raises_baseexception",
"persistent/tests/test_persistence.py::PyPersistentTests::test_repr_oid_raises_baseexception_no_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_set__p_changed_w_broken_jar",
"persistent/tests/test_persistence.py::PyPersistentTests::test_setattr_in_subclass_is_not_called_creating_an_instance",
"persistent/tests/test_persistence.py::PyPersistentTests::test_w_alternate_metaclass",
"persistent/tests/test_persistence.py::PyPersistentTests::test_w_diamond_inheritance",
"persistent/tests/test_persistence.py::CPersistentTests::test___delattr___p__names",
"persistent/tests/test_persistence.py::CPersistentTests::test___delattr__normal_name_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test___delattr__normal_name_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test___delattr__normal_name_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test___delattr__normal_name_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test___getattribute___non_cooperative",
"persistent/tests/test_persistence.py::CPersistentTests::test___getattribute___p__names",
"persistent/tests/test_persistence.py::CPersistentTests::test___getattribute__normal_name_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test___getattribute__normal_name_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test___getattribute__normal_name_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test___getattribute__normal_name_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test___getattribute__special_name",
"persistent/tests/test_persistence.py::CPersistentTests::test___getstate__",
"persistent/tests/test_persistence.py::CPersistentTests::test___getstate___derived_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test___getstate___derived_w_slots",
"persistent/tests/test_persistence.py::CPersistentTests::test___getstate___derived_w_slots_in_base_and_derived",
"persistent/tests/test_persistence.py::CPersistentTests::test___getstate___derived_w_slots_in_base_but_not_derived",
"persistent/tests/test_persistence.py::CPersistentTests::test___reduce__",
"persistent/tests/test_persistence.py::CPersistentTests::test___reduce__w_subclass_having_getnewargs",
"persistent/tests/test_persistence.py::CPersistentTests::test___reduce__w_subclass_having_getnewargs_and_getstate",
"persistent/tests/test_persistence.py::CPersistentTests::test___reduce__w_subclass_having_getstate",
"persistent/tests/test_persistence.py::CPersistentTests::test___setattr___p__names",
"persistent/tests/test_persistence.py::CPersistentTests::test___setattr___v__name",
"persistent/tests/test_persistence.py::CPersistentTests::test___setattr__normal_name_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test___setattr__normal_name_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test___setattr__normal_name_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test___setattr__normal_name_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___derived_w_slots",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___derived_w_slots_in_base_but_not_derived",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___derived_w_slots_in_base_classes",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___doesnt_fail_on_non_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___doesnt_fail_on_non_string_keys",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___empty",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___interns_dict_keys",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___nonempty",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___nonempty_derived_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test___setstate___nonempty_derived_w_dict_w_two_keys",
"persistent/tests/test_persistence.py::CPersistentTests::test__ancient_dict_layout_bug",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_activate_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_activate_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_activate_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_activate_leaves_object_in_saved_even_if_object_mutated_self",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_activate_only_sets_state_once",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_activate_w_broken_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_deactivate_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_deactivate_from_changed_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_deactivate_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_deactivate_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_deactivate_from_saved_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_deactivate_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_deactivate_from_unsaved_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_deactivate_when_sticky",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_delattr_w__p__names",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_delattr_w_normal_name",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_getattr_w__p__names",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_getattr_w_normal_name",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_getattr_w_special_names",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_changed_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_changed_w_slots",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_changed_w_slots_compat",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_saved_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_sticky",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_sticky_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_invalidate_from_unsaved_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_mtime_activates_object",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_mtime_no_serial",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_mtime_w_serial",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_repr",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_repr_baseexception",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_setattr_w__p__name",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_setattr_w_normal_name",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_state_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_state_changed_sticky",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_state_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_state_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_state_saved_sticky",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_state_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_status_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_status_changed_sticky",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_status_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_status_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_status_saved_sticky",
"persistent/tests/test_persistence.py::CPersistentTests::test__p_status_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_false_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_false_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_false_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_false_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_none_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_none_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_none_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_none_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_none_when_sticky",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_true_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_true_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_true_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_changed_true_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_estimated_size_bigger",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_estimated_size_just_over_threshold",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_estimated_size_negative",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_estimated_size_small",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_estimated_size_wrong_type",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_jar_not_in_cache_allowed",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_jar_w_new_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_jar_w_valid_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_oid_not_in_cache_allowed",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_oid_w_None_wo_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_oid_w_invalid_oid",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_oid_w_new_oid_w_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_oid_w_new_oid_wo_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_oid_w_valid_oid",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_serial_too_long",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_serial_too_short",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_serial_w_None",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_serial_w_invalid_type",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_serial_w_valid_serial",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_sticky_false_non_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_sticky_false_when_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_sticky_true_non_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_assign_p_sticky_true_when_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_can_set__p_attrs_if_subclass_denies_setattr",
"persistent/tests/test_persistence.py::CPersistentTests::test_class_conforms_to_IPersistent",
"persistent/tests/test_persistence.py::CPersistentTests::test_ctor",
"persistent/tests/test_persistence.py::CPersistentTests::test_del_jar_like_ZODB_abort",
"persistent/tests/test_persistence.py::CPersistentTests::test_del_jar_no_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_del_jar_of_inactive_object_that_has_no_state",
"persistent/tests/test_persistence.py::CPersistentTests::test_del_jar_while_in_cache",
"persistent/tests/test_persistence.py::CPersistentTests::test_del_oid_like_ZODB_abort",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_changed_from_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_changed_from_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_changed_from_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_changed_from_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_changed_from_unsaved_w_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_changed_when_sticky",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_oid_of_subclass_calling_p_delattr",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_oid_w_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_oid_wo_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_delete_p_serial",
"persistent/tests/test_persistence.py::CPersistentTests::test_instance_conforms_to_IPersistent",
"persistent/tests/test_persistence.py::CPersistentTests::test_new_ghost_success_not_already_ghost_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test_new_ghost_success_not_already_ghost_slot",
"persistent/tests/test_persistence.py::CPersistentTests::test_p_invalidate_calls_p_deactivate",
"persistent/tests/test_persistence.py::CPersistentTests::test_p_invalidate_with_slots_broken_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_pickle_roundtrip_simple",
"persistent/tests/test_persistence.py::CPersistentTests::test_pickle_roundtrip_w_getnewargs_and_getstate",
"persistent/tests/test_persistence.py::CPersistentTests::test_pickle_roundtrip_w_slots_and_empty_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test_pickle_roundtrip_w_slots_and_filled_dict",
"persistent/tests/test_persistence.py::CPersistentTests::test_pickle_roundtrip_w_slots_filled_slot",
"persistent/tests/test_persistence.py::CPersistentTests::test_pickle_roundtrip_w_slots_missing_slot",
"persistent/tests/test_persistence.py::CPersistentTests::test_query_p_changed_changed",
"persistent/tests/test_persistence.py::CPersistentTests::test_query_p_changed_ghost",
"persistent/tests/test_persistence.py::CPersistentTests::test_query_p_changed_saved",
"persistent/tests/test_persistence.py::CPersistentTests::test_query_p_changed_unsaved",
"persistent/tests/test_persistence.py::CPersistentTests::test_query_p_estimated_size_del",
"persistent/tests/test_persistence.py::CPersistentTests::test_query_p_estimated_size_new",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_no_oid_in_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_no_oid_no_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_no_oid_repr_jar_raises_baseexception",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_no_oid_repr_jar_raises_exception",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_oid_and_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_oid_and_jar_raise_exception",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_oid_no_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_oid_raises_baseexception_no_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_repr_oid_raises_exception_no_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_set__p_changed_w_broken_jar",
"persistent/tests/test_persistence.py::CPersistentTests::test_setattr_in_subclass_is_not_called_creating_an_instance",
"persistent/tests/test_persistence.py::CPersistentTests::test_w_alternate_metaclass",
"persistent/tests/test_persistence.py::CPersistentTests::test_w_diamond_inheritance",
"persistent/tests/test_persistence.py::Test_simple_new::test_w_non_type",
"persistent/tests/test_persistence.py::Test_simple_new::test_w_type",
"persistent/tests/test_persistence.py::test_suite"
] |
[] |
Zope Public License 2.1
| 3,279 |
[
"persistent/persistence.py",
"CHANGES.rst",
"persistent/cPersistence.c"
] |
[
"persistent/persistence.py",
"CHANGES.rst",
"persistent/cPersistence.c"
] |
|
kutaslab__fitgrid-39
|
06e5803882f11412adf99d32c57f04381d581ffa
|
2018-10-20 06:58:37
|
fa73573d86934c0d22d09eb0b0af1d0849218ff6
|
codecov-io: # [Codecov](https://codecov.io/gh/kutaslab/fitgrid/pull/39?src=pr&el=h1) Report
> Merging [#39](https://codecov.io/gh/kutaslab/fitgrid/pull/39?src=pr&el=desc) into [master](https://codecov.io/gh/kutaslab/fitgrid/commit/06e5803882f11412adf99d32c57f04381d581ffa?src=pr&el=desc) will **increase** coverage by `0.19%`.
> The diff coverage is `100%`.
[](https://codecov.io/gh/kutaslab/fitgrid/pull/39?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #39 +/- ##
==========================================
+ Coverage 86.33% 86.52% +0.19%
==========================================
Files 8 8
Lines 278 282 +4
==========================================
+ Hits 240 244 +4
Misses 38 38
```
| [Impacted Files](https://codecov.io/gh/kutaslab/fitgrid/pull/39?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [fitgrid/epochs.py](https://codecov.io/gh/kutaslab/fitgrid/pull/39/diff?src=pr&el=tree#diff-Zml0Z3JpZC9lcG9jaHMucHk=) | `79.12% <100%> (ø)` | :arrow_up: |
| [fitgrid/tools.py](https://codecov.io/gh/kutaslab/fitgrid/pull/39/diff?src=pr&el=tree#diff-Zml0Z3JpZC90b29scy5weQ==) | `100% <100%> (ø)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/kutaslab/fitgrid/pull/39?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/kutaslab/fitgrid/pull/39?src=pr&el=footer). Last update [06e5803...107b849](https://codecov.io/gh/kutaslab/fitgrid/pull/39?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
|
diff --git a/fitgrid/epochs.py b/fitgrid/epochs.py
index d1f5b86..899298a 100644
--- a/fitgrid/epochs.py
+++ b/fitgrid/epochs.py
@@ -87,7 +87,7 @@ class Epochs:
self.channels = channels
self.table = table
self._snapshots = snapshots
- self._epoch_index = snapshots.get_group(0).index.copy()
+ self._epoch_index = tools.get_first_group(snapshots).index.copy()
def _validate_LHS(self, LHS):
diff --git a/fitgrid/tools.py b/fitgrid/tools.py
index 114907f..a75d482 100644
--- a/fitgrid/tools.py
+++ b/fitgrid/tools.py
@@ -25,3 +25,10 @@ def get_index_duplicates_table(df, level):
msg += '{0:<20} {1}\n'.format(value, ', '.join(locations))
return msg
+
+
+def get_first_group(groupby):
+
+ first_group_name = list(groupby.groups)[0]
+ first_group = groupby.get_group(first_group_name)
+ return first_group
|
BUG: usage of `groupby.get_group(0)` is bad
`groupby.get_group(0)` gets the group with name `0`, not the first group.
Possible fix is to replace with
```python
first_group_name = list(groupby.groups)[0]
first_group = groupby.get_group(first_group_name)
```
|
kutaslab/fitgrid
|
diff --git a/tests/test_fitgrid.py b/tests/test_fitgrid.py
index 43cb7e0..f14a93a 100644
--- a/tests/test_fitgrid.py
+++ b/tests/test_fitgrid.py
@@ -2,6 +2,7 @@ import pytest
import numpy as np
from .context import fitgrid
from fitgrid.errors import FitGridError
+from fitgrid import tools
import matplotlib
matplotlib.use('Agg')
@@ -51,7 +52,8 @@ def test__residuals_have_long_form_and_correct_index():
RHS='categorical + continuous',
)
- single_epoch = epochs._snapshots.get_group(0)
+ single_epoch = tools.get_first_group(epochs._snapshots)
+
assert single_epoch.index.equals(grid.resid.index.levels[1])
@@ -69,7 +71,7 @@ def test__epoch_id_substitution():
epochs = fitgrid.epochs_from_dataframe(data, channels)
# remember epoch_index
- epoch_index = epochs._snapshots.get_group(0).index
+ epoch_index = tools.get_first_group(epochs._snapshots).index
assert (epoch_index == unusual_index).all()
# take just two channels for speed
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 2
}
|
0.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"black",
"pytest",
"pytest-cov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
black==25.1.0
blosc2==2.5.1
click==8.1.8
contourpy==1.3.0
coverage==7.8.0
cycler==0.12.1
exceptiongroup==1.2.2
-e git+https://github.com/kutaslab/fitgrid.git@06e5803882f11412adf99d32c57f04381d581ffa#egg=fitgrid
fonttools==4.56.0
importlib_resources==6.5.2
iniconfig==2.1.0
kiwisolver==1.4.7
matplotlib==3.9.4
msgpack==1.1.0
mypy-extensions==1.0.0
ndindex==1.9.2
numexpr==2.10.2
numpy==2.0.2
packaging==24.2
pandas==2.2.3
pathspec==0.12.1
patsy==1.0.1
pillow==11.1.0
platformdirs==4.3.7
pluggy==1.5.0
py-cpuinfo==9.0.0
pyparsing==3.2.3
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
scipy==1.13.1
six==1.17.0
statsmodels==0.14.4
tables==3.9.2
tomli==2.2.1
tqdm==4.67.1
typing_extensions==4.13.0
tzdata==2025.2
zipp==3.21.0
|
name: fitgrid
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- black==25.1.0
- blosc2==2.5.1
- click==8.1.8
- contourpy==1.3.0
- coverage==7.8.0
- cycler==0.12.1
- exceptiongroup==1.2.2
- fonttools==4.56.0
- importlib-resources==6.5.2
- iniconfig==2.1.0
- kiwisolver==1.4.7
- matplotlib==3.9.4
- msgpack==1.1.0
- mypy-extensions==1.0.0
- ndindex==1.9.2
- numexpr==2.10.2
- numpy==2.0.2
- packaging==24.2
- pandas==2.2.3
- pathspec==0.12.1
- patsy==1.0.1
- pillow==11.1.0
- platformdirs==4.3.7
- pluggy==1.5.0
- py-cpuinfo==9.0.0
- pyparsing==3.2.3
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- pytz==2025.2
- scipy==1.13.1
- six==1.17.0
- statsmodels==0.14.4
- tables==3.9.2
- tomli==2.2.1
- tqdm==4.67.1
- typing-extensions==4.13.0
- tzdata==2025.2
- zipp==3.21.0
prefix: /opt/conda/envs/fitgrid
|
[
"tests/test_fitgrid.py::test__residuals_have_long_form_and_correct_index"
] |
[
"tests/test_fitgrid.py::test__epoch_id_substitution",
"tests/test_fitgrid.py::test__smoke_influential_epochs"
] |
[
"tests/test_fitgrid.py::test__correct_channels_in_fitgrid",
"tests/test_fitgrid.py::test__method_returning_dataframe_expands_correctly",
"tests/test_fitgrid.py::test__slicing",
"tests/test_fitgrid.py::test__smoke_plot_betas",
"tests/test_fitgrid.py::test__smoke_plot_adj_rsquared"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,280 |
[
"fitgrid/tools.py",
"fitgrid/epochs.py"
] |
[
"fitgrid/tools.py",
"fitgrid/epochs.py"
] |
dgasmith__opt_einsum-72
|
7daf290b236d3f464845152b25ee58509410d976
|
2018-10-20 13:23:19
|
7daf290b236d3f464845152b25ee58509410d976
|
codecov-io: # [Codecov](https://codecov.io/gh/dgasmith/opt_einsum/pull/72?src=pr&el=h1) Report
> Merging [#72](https://codecov.io/gh/dgasmith/opt_einsum/pull/72?src=pr&el=desc) into [master](https://codecov.io/gh/dgasmith/opt_einsum/commit/7daf290b236d3f464845152b25ee58509410d976?src=pr&el=desc) will **increase** coverage by `0.18%`.
> The diff coverage is `100%`.
dgasmith: This pull request **introduces 1 alert** when merging aa47e5b549d7ec464bf975db3815f0444f84caf4 into 7daf290b236d3f464845152b25ee58509410d976 - [view on LGTM.com](https://lgtm.com/projects/g/dgasmith/opt_einsum/rev/pr-eed860d86e7d7251d2af7be5199ad3c1bf274446)
**new alerts:**
* 1 for Syntax error
---
*Comment posted by [LGTM.com](https://lgtm.com)*
|
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 5d0c74c..612c602 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -123,6 +123,7 @@ Table of Contents
:caption: Getting Started
install
+ input_format
backends
reusing_paths
sharing_intermediates
@@ -147,6 +148,5 @@ Table of Contents
:maxdepth: 1
:caption: Help & Reference:
- input_format
api
changelog
diff --git a/docs/source/input_format.rst b/docs/source/input_format.rst
index fa7b1e7..937d744 100644
--- a/docs/source/input_format.rst
+++ b/docs/source/input_format.rst
@@ -2,13 +2,72 @@
Input Format
============
-The ``opt_einsum`` package is a drop-in replacement for the ``np.einsum`` function
-and supports all input formats that ``np.einsum`` supports.
+The ``opt_einsum`` package is a drop-in replacement for the ``np.einsum``
+function and supports all input formats that ``np.einsum`` supports. There are
+two styles of input accepted, a basic introduction to which can be found in the
+documentation for :func:`numpy.einsum`. In addition to this, ``opt_einsum``
+extends the allowed index labels to unicode or arbitrary hashable, comparable
+objects in order to handle large contractions with many indices.
-TBA: "Normal" inputs
-In ``opt_einsum``, you can also put anything hashable and comparable such as `str` in the subscript list.
-Note ``np.einsum`` currently does not support this syntax. A simple example of the syntax is:
+'Equation' Input
+----------------
+
+As with :func:`numpy.einsum`, here you specify an equation as a string,
+followed by the array arguments:
+
+.. code:: python
+
+ >>> eq = 'ijk,jkl->li'
+ >>> x, y = np.random.rand(2, 3, 4), np.random.rand(3, 4, 5)
+ >>> z = oe.contract(eq, x, y)
+ >>> z.shape
+ (5, 2)
+
+However, in addition to the standard alphabet, ``opt_einsum`` also supports
+unicode characters:
+
+.. code:: python
+
+ >>> eq = "αβγ,βγδ->δα"
+ >>> oe.contract(eq, x, y).shape
+ (5, 2)
+
+This enables access to thousands of possible index labels. One way to access
+these programmatically is through the function
+:func:`~opt_einsum.parser.get_symbol`:
+
+ >>> oe.get_symbol(805)
+ 'α'
+
+which maps an ``int`` to a unicode characater. Note that as with
+:func:`numpy.einsum` if the output is not specified with ``->`` it will default
+to the sorted order of all indices appearing once:
+
+.. code:: python
+
+ >>> eq = "αβγ,βγδ" # "->αδ" is implicit
+ >>> oe.contract(eq, x, y).shape
+ (2, 5)
+
+
+'Interleaved' Input
+-------------------
+
+The other input format is to 'interleave' the array arguments with their index
+labels ('subscripts') in pairs, optionally specifying the output indices as a
+final argument. As with :func:`numpy.einsum`, integers are allowed as these
+index labels:
+
+.. code:: python
+
+ >>> oe.contract(x, [1, 2, 3], y, [2, 3, 4], [4, 1]).shape
+ >>> (5, 2)
+
+with the default output order again specified by the sorted order of indices
+appearing once. However, unlike :func:`numpy.einsum`, in ``opt_einsum`` you can
+also put *anything* hashable and comparable such as `str` in the subscript list.
+A simple example of this syntax is:
.. code:: python
@@ -17,8 +76,7 @@ Note ``np.einsum`` currently does not support this syntax. A simple example of t
array([[4.]])
The subscripts need to be hashable so that ``opt_einsum`` can efficiently process them, and
-they should also be comparable because in this way we can keep a consistent behavior between integer
-subscripts and other types of subscripts. For example:
+they should also be comparable so as to allow a default sorted output. For example:
.. code:: python
diff --git a/opt_einsum/contract.py b/opt_einsum/contract.py
index 4a42176..6d4f26b 100644
--- a/opt_einsum/contract.py
+++ b/opt_einsum/contract.py
@@ -805,6 +805,9 @@ def contract_expression(subscripts, *shapes, **kwargs):
raise ValueError("'{}' should only be specified when calling a "
"`ContractExpression`, not when building it.".format(arg))
+ if not isinstance(subscripts, compat.strings):
+ subscripts, shapes = parser.convert_interleaved_input((subscripts,) + shapes)
+
kwargs['_gen_expression'] = True
# build dict of constant indices mapped to arrays
diff --git a/opt_einsum/parser.py b/opt_einsum/parser.py
index 8c93213..bb15846 100644
--- a/opt_einsum/parser.py
+++ b/opt_einsum/parser.py
@@ -208,6 +208,43 @@ def convert_subscripts(old_sub, symbol_map):
return new_sub
+def convert_interleaved_input(operands):
+ """Convert 'interleaved' input to standard einsum input.
+ """
+ tmp_operands = list(operands)
+ operand_list = []
+ subscript_list = []
+ for p in range(len(operands) // 2):
+ operand_list.append(tmp_operands.pop(0))
+ subscript_list.append(tmp_operands.pop(0))
+
+ output_list = tmp_operands[-1] if len(tmp_operands) else None
+ operands = [possibly_convert_to_numpy(x) for x in operand_list]
+
+ # build a map from user symbols to single-character symbols based on `get_symbol`
+ # The map retains the intrinsic order of user symbols
+ try:
+ # collect all user symbols
+ symbol_set = set(itertools.chain.from_iterable(subscript_list))
+
+ # remove Ellipsis because it can not be compared with other objects
+ symbol_set.discard(Ellipsis)
+
+ # build the map based on sorted user symbols, retaining the order we lost in the `set`
+ symbol_map = {symbol: get_symbol(idx) for idx, symbol in enumerate(sorted(symbol_set))}
+
+ except TypeError: # unhashable or uncomparable object
+ raise TypeError("For this input type lists must contain either Ellipsis "
+ "or hashable and comparable object (e.g. int, str).")
+
+ subscripts = ','.join(convert_subscripts(sub, symbol_map) for sub in subscript_list)
+ if output_list is not None:
+ subscripts += "->"
+ subscripts += convert_subscripts(output_list, symbol_map)
+
+ return subscripts, operands
+
+
def parse_einsum_input(operands):
"""
A reproduction of einsum c side einsum parsing in python.
@@ -242,36 +279,7 @@ def parse_einsum_input(operands):
operands = [possibly_convert_to_numpy(x) for x in operands[1:]]
else:
- tmp_operands = list(operands)
- operand_list = []
- subscript_list = []
- for p in range(len(operands) // 2):
- operand_list.append(tmp_operands.pop(0))
- subscript_list.append(tmp_operands.pop(0))
-
- output_list = tmp_operands[-1] if len(tmp_operands) else None
- operands = [possibly_convert_to_numpy(x) for x in operand_list]
-
- # build a map from user symbols to single-character symbols based on `get_symbol`
- # The map retains the intrinsic order of user symbols
- try:
- # collect all user symbols
- symbol_set = set(itertools.chain.from_iterable(subscript_list))
- except TypeError: # unhashable object
- raise TypeError("For this input type lists must contain either Ellipsis or hashable and comparable object (e.g. int, str)")
- # remove Ellipsis because it can not be compared with other objects
- if Ellipsis in symbol_set:
- symbol_set.remove(Ellipsis)
- try:
- # build the map based on sorted user symbols, retaining the order we lost in the `set`
- symbol_map = {symbol: get_symbol(idx) for idx, symbol in enumerate(sorted(symbol_set))}
- except TypeError: # uncomparable object
- raise TypeError("For this input type lists must contain either Ellipsis or hashable and comparable object (e.g. int, str)")
-
- subscripts = ','.join(convert_subscripts(sub, symbol_map) for sub in subscript_list)
- if output_list is not None:
- subscripts += "->"
- subscripts += convert_subscripts(output_list, symbol_map)
+ subscripts, operands = convert_interleaved_input(operands)
# Check for proper "->"
if ("-" in subscripts) or (">" in subscripts):
|
let contract_expression use interleaved input
Currently, ``contract_expression`` only accepts the 'equation' style input. This is an easy fix that I will do shortly. As part of that I can flesh out the docs on input (#70), unless you are already planning that @dgasmith ?
|
dgasmith/opt_einsum
|
diff --git a/opt_einsum/tests/test_contract.py b/opt_einsum/tests/test_contract.py
index dbbc39e..3371876 100644
--- a/opt_einsum/tests/test_contract.py
+++ b/opt_einsum/tests/test_contract.py
@@ -194,6 +194,15 @@ def test_contract_expressions(string, optimize, use_blas, out_spec):
assert string in expr.__str__()
+def test_contract_expression_interleaved_input():
+ x, y, z = (np.random.randn(2, 2) for _ in 'xyz')
+ expected = np.einsum(x, [0, 1], y, [1, 2], z, [2, 3], [3, 0])
+ xshp, yshp, zshp = ((2, 2) for _ in 'xyz')
+ expr = contract_expression(xshp, [0, 1], yshp, [1, 2], zshp, [2, 3], [3, 0])
+ out = expr(x, y, z)
+ assert np.allclose(out, expected)
+
+
@pytest.mark.parametrize("string,constants", [
('hbc,bdef,cdkj,ji,ikeh,lfo', [1, 2, 3, 4]),
('bdef,cdkj,ji,ikeh,hbc,lfo', [0, 1, 2, 3]),
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_issue_reference",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 4
}
|
2.2
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov"
],
"pre_install": null,
"python": "3.9",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
numpy==2.0.2
-e git+https://github.com/dgasmith/opt_einsum.git@7daf290b236d3f464845152b25ee58509410d976#egg=opt_einsum
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
|
name: opt_einsum
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- exceptiongroup=1.2.0=py39h06a4308_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- packaging=24.2=py39h06a4308_0
- pip=25.0=py39h06a4308_0
- pluggy=1.5.0=py39h06a4308_0
- pytest=8.3.4=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py39h06a4308_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- numpy==2.0.2
- pytest-cov==6.0.0
prefix: /opt/conda/envs/opt_einsum
|
[
"opt_einsum/tests/test_contract.py::test_contract_expression_interleaved_input"
] |
[] |
[
"opt_einsum/tests/test_contract.py::test_compare[greedy-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare[greedy-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare[optimal-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare[eager-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare[eager-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare[eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare[eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare[eager-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare[eager-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare[eager-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare[eager-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare[eager-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare[eager-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare[eager-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare[eager-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare[eager-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare[eager-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare[eager-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare[eager-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare[eager-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare[eager-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare[eager-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare[eager-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare[eager-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare[eager-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare[eager-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare[eager-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare[eager-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare[eager-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare[eager-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare[eager-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare[eager-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abcd,ad]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,ab]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,ba]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abc,abc]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abc,bac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abc,cba]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,bc]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,cb]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ba,bc]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ba,cb]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abcd,cd]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abcd,ab]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_drop_in_replacement[aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_greek[greedy-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_greek[optimal-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_greek[eager-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_blas[greedy-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_blas[optimal-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_blas[eager-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[greedy-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[optimal-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,ba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abc,abc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abc,bac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abc,cba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ba,bc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ba,cb]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_compare_blas_greek[eager-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_some_non_alphabet_maintains_order",
"opt_einsum/tests/test_contract.py::test_printing",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-greedy-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-optimal-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-False-eager-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-greedy-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-optimal-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[False-True-eager-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-greedy-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-optimal-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-False-eager-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-greedy-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-optimal-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abcd,ad]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,ba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abc,abc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abc,bac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abc,cba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ba,bc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ba,cb]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abcd,cd]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abcd,ab]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_contract_expressions[True-True-eager-aef,fbc,dca->bde]",
"opt_einsum/tests/test_contract.py::test_contract_expression_with_constants[hbc,bdef,cdkj,ji,ikeh,lfo-constants0]",
"opt_einsum/tests/test_contract.py::test_contract_expression_with_constants[bdef,cdkj,ji,ikeh,hbc,lfo-constants1]",
"opt_einsum/tests/test_contract.py::test_contract_expression_with_constants[hbc,bdef,cdkj,ji,ikeh,lfo-constants2]",
"opt_einsum/tests/test_contract.py::test_contract_expression_with_constants[hbc,bdef,cdkj,ji,ikeh,lfo-constants3]",
"opt_einsum/tests/test_contract.py::test_contract_expression_with_constants[ijab,acd,bce,df,ef->ji-constants4]",
"opt_einsum/tests/test_contract.py::test_contract_expression_with_constants[ab,cd,ad,cb-constants5]",
"opt_einsum/tests/test_contract.py::test_contract_expression_with_constants[ab,bc,cd-constants6]",
"opt_einsum/tests/test_contract.py::test_rand_equation[0-3-3-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[0-3-3-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[0-3-5-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[0-3-5-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[0-4-3-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[0-4-3-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[0-4-5-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[0-4-5-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[2-3-3-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[2-3-3-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[2-3-5-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[2-3-5-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[2-4-3-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[2-4-3-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[2-4-5-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[2-4-5-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[4-3-3-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[4-3-3-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[4-3-5-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[4-3-5-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[4-4-3-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[4-4-3-optimal]",
"opt_einsum/tests/test_contract.py::test_rand_equation[4-4-5-greedy]",
"opt_einsum/tests/test_contract.py::test_rand_equation[4-4-5-optimal]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[a,ab,abc->abc]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[a,b,ab->ab]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ea,fb,gc,hd,abcd->efgh]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ea,fb,abcd,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abcd,ea,fb,gc,hd->efgh]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[acdf,jbje,gihb,hfac,gfac,gifabc,hfac0]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[acdf,jbje,gihb,hfac,gfac,gifabc,hfac1]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[cd,bdhe,aidb,hgca,gc,hgibcd,hgac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abhe,hidj,jgba,hiab,gab]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[bde,cdh,agdb,hica,ibd,hgicd,hiac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[chd,bde,agbc,hiad,hgc,hgi,hiad]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[chd,bde,agbc,hiad,bdi,cgh,agdb]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[bdhe,acad,hiab,agac,hibd]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,ab,c->]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,ab,c->c]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,ab,cd,cd->]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,ab,cd,cd->ac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,ab,cd,cd->cd]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,ab,cd,cd,ef,ef->]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,cd,ef->abcdef]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,cd,ef->acdf]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,cd,de->abcde]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,cd,de->be]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,bcd,cd->abcd]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,bcd,cd->abd]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[eb,cb,fb->cef]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[dd,fb,be,cdb->cef]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[bca,cdb,dbf,afc->]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[dcc,fce,ea,dbf->ab]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[fdf,cdd,ccd,afe->ae]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abcd,ad]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ed,fcd,ff,bcf->be]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[baa,dcf,af,cde->be]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[bd,db,eac->ace]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[fff,fae,bef,def->abd]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[efc,dbc,acf,fd->abe]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,ab]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,ba]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abc,abc]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abc,bac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abc,cba]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,bc]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,cb]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ba,bc]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ba,cb]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abcd,cd]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abcd,ab]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abcd,cdef]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abcd,cdef->feba]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[abcd,efdc]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[aab,bc->ac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[aab,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[baa,bcc->ac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[aab,ccb->ac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[aab,fa,df,ecc->bde]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[ecb,fef,bad,ed->ac]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[bcf,bbb,fbf,fc->]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[bb,ff,be->e]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[bcb,bb,fc,fff->]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[fbb,dfd,fc,fc->]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[afd,ba,cc,dc->bf]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[adb,bc,fa,cfc->d]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[bbd,bda,fc,db->acf]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[dba,ead,cad->bce]",
"opt_einsum/tests/test_contract.py::test_linear_vs_ssa[aef,fbc,dca->bde]"
] |
[] |
MIT License
| 3,281 |
[
"opt_einsum/contract.py",
"opt_einsum/parser.py",
"docs/source/input_format.rst",
"docs/source/index.rst"
] |
[
"opt_einsum/contract.py",
"opt_einsum/parser.py",
"docs/source/input_format.rst",
"docs/source/index.rst"
] |
ipython__ipython-11418
|
4b3baed67bceb4a10f6189d87580d7fcfe5ef079
|
2018-10-20 17:52:39
|
f0ac04900b586a080b61a2f9ea00c8e9d3a3163b
|
diff --git a/IPython/core/inputtransformer2.py b/IPython/core/inputtransformer2.py
index e2dd2d087..b73d70121 100644
--- a/IPython/core/inputtransformer2.py
+++ b/IPython/core/inputtransformer2.py
@@ -13,7 +13,7 @@
from codeop import compile_command
import re
import tokenize
-from typing import List, Tuple
+from typing import List, Tuple, Union
import warnings
_indent_re = re.compile(r'^[ \t]+')
@@ -87,7 +87,7 @@ def cell_magic(lines):
% (magic_name, first_line, body)]
-def _find_assign_op(token_line):
+def _find_assign_op(token_line) -> Union[int, None]:
"""Get the index of the first assignment in the line ('=' not inside brackets)
Note: We don't try to support multiple special assignment (a = b = %foo)
@@ -97,9 +97,9 @@ def _find_assign_op(token_line):
s = ti.string
if s == '=' and paren_level == 0:
return i
- if s in '([{':
+ if s in {'(','[','{'}:
paren_level += 1
- elif s in ')]}':
+ elif s in {')', ']', '}'}:
if paren_level > 0:
paren_level -= 1
@@ -449,11 +449,14 @@ def transform(self, lines):
return lines_before + [new_line] + lines_after
-def make_tokens_by_line(lines):
+def make_tokens_by_line(lines:List[str]):
"""Tokenize a series of lines and group tokens by line.
- The tokens for a multiline Python string or expression are
- grouped as one line.
+ The tokens for a multiline Python string or expression are grouped as one
+ line. All lines except the last lines should keep their line ending ('\\n',
+ '\\r\\n') for this to properly work. Use `.splitlines(keeplineending=True)`
+ for example when passing block of text to this function.
+
"""
# NL tokens are used inside multiline expressions, but also after blank
# lines or comments. This is intentional - see https://bugs.python.org/issue17061
@@ -461,6 +464,8 @@ def make_tokens_by_line(lines):
# track parentheses level, similar to the internals of tokenize.
NEWLINE, NL = tokenize.NEWLINE, tokenize.NL
tokens_by_line = [[]]
+ if len(lines) > 1 and not lines[0].endswith(('\n', '\r', '\r\n', '\x0b', '\x0c')):
+ warnings.warn("`make_tokens_by_line` received a list of lines which do not have lineending markers ('\\n', '\\r', '\\r\\n', '\\x0b', '\\x0c'), behavior will be unspecified")
parenlev = 0
try:
for token in tokenize.generate_tokens(iter(lines).__next__):
|
Capturing shell command output after indentation causes SyntaxError in IPython console.
To reproduce, type this in console:
```python
def test():
for i in range(1):
print(i)
res =! ls
```
But if something is put above the line, everything will seem to be fine.
```python
def test():
for i in range(1):
print(i)
'just a separate line'
res =! ls
```
Find this in IPython 7.1.0.dev
|
ipython/ipython
|
diff --git a/IPython/core/tests/test_inputtransformer2.py b/IPython/core/tests/test_inputtransformer2.py
index d6c2fa3bd..9c92c394e 100644
--- a/IPython/core/tests/test_inputtransformer2.py
+++ b/IPython/core/tests/test_inputtransformer2.py
@@ -8,7 +8,7 @@
import string
from IPython.core import inputtransformer2 as ipt2
-from IPython.core.inputtransformer2 import make_tokens_by_line
+from IPython.core.inputtransformer2 import make_tokens_by_line, _find_assign_op
from textwrap import dedent
@@ -53,6 +53,22 @@
g()
""".splitlines(keepends=True))
+#####
+
+MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT = ("""\
+def test():
+ for i in range(1):
+ print(i)
+ res =! ls
+""".splitlines(keepends=True), (4, 7), '''\
+def test():
+ for i in range(1):
+ print(i)
+ res =get_ipython().getoutput(\' ls\')
+'''.splitlines(keepends=True))
+
+######
+
AUTOCALL_QUOTE = (
[",f 1 2 3\n"], (1, 0),
['f("1", "2", "3")\n']
@@ -103,6 +119,7 @@
[r"get_ipython().set_next_input('(a,\nb) = zip');get_ipython().run_line_magic('pinfo', 'zip')" + "\n"]
)
+
def null_cleanup_transformer(lines):
"""
A cleanup transform that returns an empty list.
@@ -144,18 +161,21 @@ def test_continued_line():
def test_find_assign_magic():
check_find(ipt2.MagicAssign, MULTILINE_MAGIC_ASSIGN)
check_find(ipt2.MagicAssign, MULTILINE_SYSTEM_ASSIGN, match=False)
+ check_find(ipt2.MagicAssign, MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT, match=False)
def test_transform_assign_magic():
check_transform(ipt2.MagicAssign, MULTILINE_MAGIC_ASSIGN)
def test_find_assign_system():
check_find(ipt2.SystemAssign, MULTILINE_SYSTEM_ASSIGN)
+ check_find(ipt2.SystemAssign, MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT)
check_find(ipt2.SystemAssign, (["a = !ls\n"], (1, 5), None))
check_find(ipt2.SystemAssign, (["a=!ls\n"], (1, 2), None))
check_find(ipt2.SystemAssign, MULTILINE_MAGIC_ASSIGN, match=False)
def test_transform_assign_system():
check_transform(ipt2.SystemAssign, MULTILINE_SYSTEM_ASSIGN)
+ check_transform(ipt2.SystemAssign, MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT)
def test_find_magic_escape():
check_find(ipt2.EscapedCommand, MULTILINE_MAGIC)
@@ -203,6 +223,17 @@ def test_transform_help():
tf = ipt2.HelpEnd((1, 0), (2, 8))
nt.assert_equal(tf.transform(HELP_MULTILINE[0]), HELP_MULTILINE[2])
+def test_find_assign_op_dedent():
+ """
+ be carefull that empty token like dedent are not counted as parens
+ """
+ class Tk:
+ def __init__(self, s):
+ self.string = s
+
+ nt.assert_equal(_find_assign_op([Tk(s) for s in ('','a','=','b')]), 2)
+ nt.assert_equal(_find_assign_op([Tk(s) for s in ('','(', 'a','=','b', ')', '=' ,'5')]), 6)
+
def test_check_complete():
cc = ipt2.TransformerManager().check_complete
nt.assert_equal(cc("a = 1"), ('complete', None))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
7.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"nose",
"requests",
"testpath",
"pygments",
"nbformat",
"ipykernel",
"numpy",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.5",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
backcall==0.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
decorator==5.1.1
entrypoints==0.4
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
ipykernel==5.5.6
-e git+https://github.com/ipython/ipython.git@4b3baed67bceb4a10f6189d87580d7fcfe5ef079#egg=ipython
ipython-genutils==0.2.0
jedi==0.17.2
jsonschema==3.2.0
jupyter-client==7.1.2
jupyter-core==4.9.2
nbformat==5.1.3
nest-asyncio==1.6.0
nose==1.3.7
numpy==1.19.5
packaging==21.3
parso==0.7.1
pexpect==4.9.0
pickleshare==0.7.5
pluggy==1.0.0
prompt-toolkit==2.0.10
ptyprocess==0.7.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pyrsistent==0.18.0
pytest==7.0.1
python-dateutil==2.9.0.post0
pyzmq==25.1.2
requests==2.27.1
six==1.17.0
testpath==0.6.0
tomli==1.2.3
tornado==6.1
traitlets==4.3.3
typing_extensions==4.1.1
urllib3==1.26.20
wcwidth==0.2.13
zipp==3.6.0
|
name: ipython
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- backcall==0.2.0
- charset-normalizer==2.0.12
- decorator==5.1.1
- entrypoints==0.4
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- ipykernel==5.5.6
- ipython-genutils==0.2.0
- jedi==0.17.2
- jsonschema==3.2.0
- jupyter-client==7.1.2
- jupyter-core==4.9.2
- nbformat==5.1.3
- nest-asyncio==1.6.0
- nose==1.3.7
- numpy==1.19.5
- packaging==21.3
- parso==0.7.1
- pexpect==4.9.0
- pickleshare==0.7.5
- pluggy==1.0.0
- prompt-toolkit==2.0.10
- ptyprocess==0.7.0
- py==1.11.0
- pygments==2.14.0
- pyparsing==3.1.4
- pyrsistent==0.18.0
- pytest==7.0.1
- python-dateutil==2.9.0.post0
- pyzmq==25.1.2
- requests==2.27.1
- six==1.17.0
- testpath==0.6.0
- tomli==1.2.3
- tornado==6.1
- traitlets==4.3.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- wcwidth==0.2.13
- zipp==3.6.0
prefix: /opt/conda/envs/ipython
|
[
"IPython/core/tests/test_inputtransformer2.py::test_find_assign_system",
"IPython/core/tests/test_inputtransformer2.py::test_find_assign_op_dedent"
] |
[] |
[
"IPython/core/tests/test_inputtransformer2.py::test_continued_line",
"IPython/core/tests/test_inputtransformer2.py::test_find_assign_magic",
"IPython/core/tests/test_inputtransformer2.py::test_transform_assign_magic",
"IPython/core/tests/test_inputtransformer2.py::test_transform_assign_system",
"IPython/core/tests/test_inputtransformer2.py::test_find_magic_escape",
"IPython/core/tests/test_inputtransformer2.py::test_transform_magic_escape",
"IPython/core/tests/test_inputtransformer2.py::test_find_autocalls",
"IPython/core/tests/test_inputtransformer2.py::test_transform_autocall",
"IPython/core/tests/test_inputtransformer2.py::test_find_help",
"IPython/core/tests/test_inputtransformer2.py::test_transform_help",
"IPython/core/tests/test_inputtransformer2.py::test_check_complete",
"IPython/core/tests/test_inputtransformer2.py::test_check_complete_II",
"IPython/core/tests/test_inputtransformer2.py::test_null_cleanup_transformer"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,282 |
[
"IPython/core/inputtransformer2.py"
] |
[
"IPython/core/inputtransformer2.py"
] |
|
pre-commit__pre-commit-851
|
1f1cd2bc394271540955794b3d2d3e6d8f4e65bb
|
2018-10-20 20:13:01
|
6b6ebe7e3015ac72bc3c3e4e1515975e1c009a22
|
chriskuehl: Heh, on AppVeyor:
```
================================== FAILURES ===================================
___________________________ test_xargs_concurrency ____________________________
def test_xargs_concurrency():
bash_cmd = ('bash', '-c')
print_pid = ('sleep 0.5 && echo $$',)
start = time.time()
ret, stdout, _ = xargs.xargs(
bash_cmd, print_pid * 5,
target_concurrency=5,
_max_length=len(' '.join(bash_cmd + print_pid)),
)
elapsed = time.time() - start
assert ret == 0
pids = stdout.splitlines()
assert len(pids) == 5
> assert elapsed < 1
E assert 1.0390000343322754 < 1
tests\xargs_test.py:124: AssertionError
== 1 failed, 491 passed, 6 skipped, 9 xfailed, 10 xpassed in 529.27 seconds ===
```
It's been passing most of the time on AppVeyor, probably flaky :\
Guess I should increase the elapsed duration... or just delete the test.
asottile: > Guess I should increase the elapsed duration... or just delete the test.
🔪 😆
chriskuehl: @asottile switched to a `concurrent.futures` backport and added an env var to force it to run in serial during tests. Let me know what you think!
|
diff --git a/pre_commit/clientlib.py b/pre_commit/clientlib.py
index 4570e10..2fa7b15 100644
--- a/pre_commit/clientlib.py
+++ b/pre_commit/clientlib.py
@@ -56,6 +56,7 @@ MANIFEST_HOOK_DICT = cfgv.Map(
cfgv.Optional('language_version', cfgv.check_string, 'default'),
cfgv.Optional('log_file', cfgv.check_string, ''),
cfgv.Optional('minimum_pre_commit_version', cfgv.check_string, '0'),
+ cfgv.Optional('require_serial', cfgv.check_bool, False),
cfgv.Optional('stages', cfgv.check_array(cfgv.check_one_of(C.STAGES)), []),
cfgv.Optional('verbose', cfgv.check_bool, False),
)
diff --git a/pre_commit/languages/docker.py b/pre_commit/languages/docker.py
index f3c46a3..bfdd358 100644
--- a/pre_commit/languages/docker.py
+++ b/pre_commit/languages/docker.py
@@ -9,7 +9,6 @@ from pre_commit.languages import helpers
from pre_commit.util import CalledProcessError
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = 'docker'
@@ -97,4 +96,4 @@ def run_hook(prefix, hook, file_args): # pragma: windows no cover
entry_tag = ('--entrypoint', entry_exe, docker_tag(prefix))
cmd = docker_cmd() + entry_tag + cmd_rest
- return xargs(cmd, file_args)
+ return helpers.run_xargs(hook, cmd, file_args)
diff --git a/pre_commit/languages/docker_image.py b/pre_commit/languages/docker_image.py
index 6301970..e7ebad7 100644
--- a/pre_commit/languages/docker_image.py
+++ b/pre_commit/languages/docker_image.py
@@ -4,7 +4,6 @@ from __future__ import unicode_literals
from pre_commit.languages import helpers
from pre_commit.languages.docker import assert_docker_available
from pre_commit.languages.docker import docker_cmd
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = None
@@ -16,4 +15,4 @@ install_environment = helpers.no_install
def run_hook(prefix, hook, file_args): # pragma: windows no cover
assert_docker_available()
cmd = docker_cmd() + helpers.to_cmd(hook)
- return xargs(cmd, file_args)
+ return helpers.run_xargs(hook, cmd, file_args)
diff --git a/pre_commit/languages/golang.py b/pre_commit/languages/golang.py
index 14354e0..09e3476 100644
--- a/pre_commit/languages/golang.py
+++ b/pre_commit/languages/golang.py
@@ -11,7 +11,6 @@ from pre_commit.languages import helpers
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
from pre_commit.util import rmtree
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = 'golangenv'
@@ -81,4 +80,4 @@ def install_environment(prefix, version, additional_dependencies):
def run_hook(prefix, hook, file_args):
with in_env(prefix):
- return xargs(helpers.to_cmd(hook), file_args)
+ return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
diff --git a/pre_commit/languages/helpers.py b/pre_commit/languages/helpers.py
index ddbe2e8..aa5a5d1 100644
--- a/pre_commit/languages/helpers.py
+++ b/pre_commit/languages/helpers.py
@@ -1,8 +1,11 @@
from __future__ import unicode_literals
+import multiprocessing
+import os
import shlex
from pre_commit.util import cmd_output
+from pre_commit.xargs import xargs
def run_setup_cmd(prefix, cmd):
@@ -45,3 +48,21 @@ def basic_healthy(prefix, language_version):
def no_install(prefix, version, additional_dependencies):
raise AssertionError('This type is not installable')
+
+
+def target_concurrency(hook):
+ if hook['require_serial'] or 'PRE_COMMIT_NO_CONCURRENCY' in os.environ:
+ return 1
+ else:
+ # Travis appears to have a bunch of CPUs, but we can't use them all.
+ if 'TRAVIS' in os.environ:
+ return 2
+ else:
+ try:
+ return multiprocessing.cpu_count()
+ except NotImplementedError:
+ return 1
+
+
+def run_xargs(hook, cmd, file_args):
+ return xargs(cmd, file_args, target_concurrency=target_concurrency(hook))
diff --git a/pre_commit/languages/node.py b/pre_commit/languages/node.py
index 7b46493..8e5dc7e 100644
--- a/pre_commit/languages/node.py
+++ b/pre_commit/languages/node.py
@@ -10,7 +10,6 @@ from pre_commit.languages import helpers
from pre_commit.languages.python import bin_dir
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = 'node_env'
@@ -71,4 +70,4 @@ def install_environment(prefix, version, additional_dependencies):
def run_hook(prefix, hook, file_args):
with in_env(prefix, hook['language_version']):
- return xargs(helpers.to_cmd(hook), file_args)
+ return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
diff --git a/pre_commit/languages/python.py b/pre_commit/languages/python.py
index ee7b2a4..4b7580a 100644
--- a/pre_commit/languages/python.py
+++ b/pre_commit/languages/python.py
@@ -12,7 +12,6 @@ from pre_commit.parse_shebang import find_executable
from pre_commit.util import CalledProcessError
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = 'py_env'
@@ -127,7 +126,7 @@ def py_interface(_dir, _make_venv):
def run_hook(prefix, hook, file_args):
with in_env(prefix, hook['language_version']):
- return xargs(helpers.to_cmd(hook), file_args)
+ return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
def install_environment(prefix, version, additional_dependencies):
additional_dependencies = tuple(additional_dependencies)
diff --git a/pre_commit/languages/ruby.py b/pre_commit/languages/ruby.py
index bef3fe3..0330ae8 100644
--- a/pre_commit/languages/ruby.py
+++ b/pre_commit/languages/ruby.py
@@ -12,7 +12,6 @@ from pre_commit.languages import helpers
from pre_commit.util import CalledProcessError
from pre_commit.util import clean_path_on_failure
from pre_commit.util import resource_bytesio
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = 'rbenv'
@@ -126,4 +125,4 @@ def install_environment(
def run_hook(prefix, hook, file_args): # pragma: windows no cover
with in_env(prefix, hook['language_version']):
- return xargs(helpers.to_cmd(hook), file_args)
+ return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
diff --git a/pre_commit/languages/rust.py b/pre_commit/languages/rust.py
index 41053f8..8a5a070 100644
--- a/pre_commit/languages/rust.py
+++ b/pre_commit/languages/rust.py
@@ -10,7 +10,6 @@ from pre_commit.envcontext import Var
from pre_commit.languages import helpers
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = 'rustenv'
@@ -91,4 +90,4 @@ def install_environment(prefix, version, additional_dependencies):
def run_hook(prefix, hook, file_args):
with in_env(prefix):
- return xargs(helpers.to_cmd(hook), file_args)
+ return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
diff --git a/pre_commit/languages/script.py b/pre_commit/languages/script.py
index 551b4d8..809efb8 100644
--- a/pre_commit/languages/script.py
+++ b/pre_commit/languages/script.py
@@ -1,7 +1,6 @@
from __future__ import unicode_literals
from pre_commit.languages import helpers
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = None
@@ -13,4 +12,4 @@ install_environment = helpers.no_install
def run_hook(prefix, hook, file_args):
cmd = helpers.to_cmd(hook)
cmd = (prefix.path(cmd[0]),) + cmd[1:]
- return xargs(cmd, file_args)
+ return helpers.run_xargs(hook, cmd, file_args)
diff --git a/pre_commit/languages/swift.py b/pre_commit/languages/swift.py
index 2863fbe..c282de5 100644
--- a/pre_commit/languages/swift.py
+++ b/pre_commit/languages/swift.py
@@ -8,7 +8,6 @@ from pre_commit.envcontext import Var
from pre_commit.languages import helpers
from pre_commit.util import clean_path_on_failure
from pre_commit.util import cmd_output
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = 'swift_env'
get_default_version = helpers.basic_get_default_version
@@ -53,4 +52,4 @@ def install_environment(
def run_hook(prefix, hook, file_args): # pragma: windows no cover
with in_env(prefix):
- return xargs(helpers.to_cmd(hook), file_args)
+ return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
diff --git a/pre_commit/languages/system.py b/pre_commit/languages/system.py
index 84cd1fe..e590d48 100644
--- a/pre_commit/languages/system.py
+++ b/pre_commit/languages/system.py
@@ -1,7 +1,6 @@
from __future__ import unicode_literals
from pre_commit.languages import helpers
-from pre_commit.xargs import xargs
ENVIRONMENT_DIR = None
@@ -11,4 +10,4 @@ install_environment = helpers.no_install
def run_hook(prefix, hook, file_args):
- return xargs(helpers.to_cmd(hook), file_args)
+ return helpers.run_xargs(hook, helpers.to_cmd(hook), file_args)
diff --git a/pre_commit/xargs.py b/pre_commit/xargs.py
index 2fe8a45..3b4a25f 100644
--- a/pre_commit/xargs.py
+++ b/pre_commit/xargs.py
@@ -1,8 +1,12 @@
from __future__ import absolute_import
+from __future__ import division
from __future__ import unicode_literals
+import contextlib
+import math
import sys
+import concurrent.futures
import six
from pre_commit import parse_shebang
@@ -34,8 +38,13 @@ class ArgumentTooLongError(RuntimeError):
pass
-def partition(cmd, varargs, _max_length=None):
+def partition(cmd, varargs, target_concurrency, _max_length=None):
_max_length = _max_length or _get_platform_max_length()
+
+ # Generally, we try to partition evenly into at least `target_concurrency`
+ # partitions, but we don't want a bunch of tiny partitions.
+ max_args = max(4, math.ceil(len(varargs) / target_concurrency))
+
cmd = tuple(cmd)
ret = []
@@ -48,7 +57,10 @@ def partition(cmd, varargs, _max_length=None):
arg = varargs.pop()
arg_length = _command_length(arg) + 1
- if total_length + arg_length <= _max_length:
+ if (
+ total_length + arg_length <= _max_length
+ and len(ret_cmd) < max_args
+ ):
ret_cmd.append(arg)
total_length += arg_length
elif not ret_cmd:
@@ -65,12 +77,23 @@ def partition(cmd, varargs, _max_length=None):
return tuple(ret)
[email protected]
+def _thread_mapper(maxsize):
+ if maxsize == 1:
+ yield map
+ else:
+ with concurrent.futures.ThreadPoolExecutor(maxsize) as ex:
+ yield ex.map
+
+
def xargs(cmd, varargs, **kwargs):
"""A simplified implementation of xargs.
negate: Make nonzero successful and zero a failure
+ target_concurrency: Target number of partitions to run concurrently
"""
negate = kwargs.pop('negate', False)
+ target_concurrency = kwargs.pop('target_concurrency', 1)
retcode = 0
stdout = b''
stderr = b''
@@ -80,22 +103,28 @@ def xargs(cmd, varargs, **kwargs):
except parse_shebang.ExecutableNotFoundError as e:
return e.to_output()
- for run_cmd in partition(cmd, varargs, **kwargs):
- proc_retcode, proc_out, proc_err = cmd_output(
- *run_cmd, encoding=None, retcode=None
- )
- # This is *slightly* too clever so I'll explain it.
- # First the xor boolean table:
- # T | F |
- # +-------+
- # T | F | T |
- # --+-------+
- # F | T | F |
- # --+-------+
- # When negate is True, it has the effect of flipping the return code
- # Otherwise, the retuncode is unchanged
- retcode |= bool(proc_retcode) ^ negate
- stdout += proc_out
- stderr += proc_err
+ partitions = partition(cmd, varargs, target_concurrency, **kwargs)
+
+ def run_cmd_partition(run_cmd):
+ return cmd_output(*run_cmd, encoding=None, retcode=None)
+
+ threads = min(len(partitions), target_concurrency)
+ with _thread_mapper(threads) as thread_map:
+ results = thread_map(run_cmd_partition, partitions)
+
+ for proc_retcode, proc_out, proc_err in results:
+ # This is *slightly* too clever so I'll explain it.
+ # First the xor boolean table:
+ # T | F |
+ # +-------+
+ # T | F | T |
+ # --+-------+
+ # F | T | F |
+ # --+-------+
+ # When negate is True, it has the effect of flipping the return
+ # code. Otherwise, the returncode is unchanged.
+ retcode |= bool(proc_retcode) ^ negate
+ stdout += proc_out
+ stderr += proc_err
return retcode, stdout, stderr
diff --git a/setup.py b/setup.py
index 7c0a958..dd3eb42 100644
--- a/setup.py
+++ b/setup.py
@@ -47,7 +47,10 @@ setup(
'toml',
'virtualenv',
],
- extras_require={':python_version<"3.7"': ['importlib-resources']},
+ extras_require={
+ ':python_version<"3.2"': ['futures'],
+ ':python_version<"3.7"': ['importlib-resources'],
+ },
entry_points={
'console_scripts': [
'pre-commit = pre_commit.main:main',
diff --git a/tox.ini b/tox.ini
index d4b590b..52f3d3e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -27,3 +27,4 @@ env =
[email protected]
[email protected]
VIRTUALENV_NO_DOWNLOAD=1
+ PRE_COMMIT_NO_CONCURRENCY=1
|
Parallel execution of individual hooks?
I have this one hook that runs `puppet parser validate` which is extremely slow. Running it on just 185 files takes 105 seconds which makes my tests (which call `pre-commit run --all-files`, among other things) annoying enough to run that most people don't run them locally.
What if pre-commit's xargs implementation could do things in parallel? Here's a sketch of a patch that does that (only works on Python 3): https://i.fluffy.cc/t43V5vqd3VH9lTQfl8djnfZWBV2zDDTZ.html
This takes my test time from 105 seconds to 15 seconds.
Some thoughts:
* If any hooks write to files besides the ones they are linting, this could break. This is a problem, though pre-commit is heavily designed around operations on individual files, so the vast majority of hooks should be okay. We could offer an opt-in or opt-out at the individual hook level?
* Parallelizing different hooks (running puppet-lint at the same time as puppet-validate) would be neat but I think is way more problematic (and introduces crazy locking problems since you can't have two hooks running on the same file at once).
* Because pre-commit captures output and displays it at the end, I don't think we have any of the usual problems of interleaved/confusing output. The printing happens in the main thread when collecting statuses and shouldn't have races.
* `concurrent.futures` works great here, but is Python 3 only. I'm not sure how hard this is to do in a compatible way.
@asottile what do you think? Is this too complicated to be worth pursuing?
|
pre-commit/pre-commit
|
diff --git a/tests/languages/helpers_test.py b/tests/languages/helpers_test.py
index ada2095..e7bd470 100644
--- a/tests/languages/helpers_test.py
+++ b/tests/languages/helpers_test.py
@@ -1,8 +1,11 @@
from __future__ import absolute_import
from __future__ import unicode_literals
+import multiprocessing
+import os
import sys
+import mock
import pytest
from pre_commit.languages import helpers
@@ -28,3 +31,34 @@ def test_failed_setup_command_does_not_unicode_error():
# an assertion that this does not raise `UnicodeError`
with pytest.raises(CalledProcessError):
helpers.run_setup_cmd(Prefix('.'), (sys.executable, '-c', script))
+
+
+def test_target_concurrency_normal():
+ with mock.patch.object(multiprocessing, 'cpu_count', return_value=123):
+ with mock.patch.dict(os.environ, {}, clear=True):
+ assert helpers.target_concurrency({'require_serial': False}) == 123
+
+
+def test_target_concurrency_cpu_count_require_serial_true():
+ with mock.patch.dict(os.environ, {}, clear=True):
+ assert helpers.target_concurrency({'require_serial': True}) == 1
+
+
+def test_target_concurrency_testing_env_var():
+ with mock.patch.dict(
+ os.environ, {'PRE_COMMIT_NO_CONCURRENCY': '1'}, clear=True,
+ ):
+ assert helpers.target_concurrency({'require_serial': False}) == 1
+
+
+def test_target_concurrency_on_travis():
+ with mock.patch.dict(os.environ, {'TRAVIS': '1'}, clear=True):
+ assert helpers.target_concurrency({'require_serial': False}) == 2
+
+
+def test_target_concurrency_cpu_count_not_implemented():
+ with mock.patch.object(
+ multiprocessing, 'cpu_count', side_effect=NotImplementedError,
+ ):
+ with mock.patch.dict(os.environ, {}, clear=True):
+ assert helpers.target_concurrency({'require_serial': False}) == 1
diff --git a/tests/repository_test.py b/tests/repository_test.py
index 8d578f3..f1b0f6e 100644
--- a/tests/repository_test.py
+++ b/tests/repository_test.py
@@ -837,6 +837,7 @@ def test_manifest_hooks(tempdir_factory, store):
'minimum_pre_commit_version': '0',
'name': 'Bash hook',
'pass_filenames': True,
+ 'require_serial': False,
'stages': [],
'types': ['file'],
'exclude_types': [],
diff --git a/tests/xargs_test.py b/tests/xargs_test.py
index bf685e1..ed65ed4 100644
--- a/tests/xargs_test.py
+++ b/tests/xargs_test.py
@@ -3,7 +3,9 @@ from __future__ import absolute_import
from __future__ import unicode_literals
import sys
+import time
+import concurrent.futures
import mock
import pytest
import six
@@ -35,11 +37,11 @@ def linux_mock():
def test_partition_trivial():
- assert xargs.partition(('cmd',), ()) == (('cmd',),)
+ assert xargs.partition(('cmd',), (), 1) == (('cmd',),)
def test_partition_simple():
- assert xargs.partition(('cmd',), ('foo',)) == (('cmd', 'foo'),)
+ assert xargs.partition(('cmd',), ('foo',), 1) == (('cmd', 'foo'),)
def test_partition_limits():
@@ -53,6 +55,7 @@ def test_partition_limits():
'.' * 5,
'.' * 6,
),
+ 1,
_max_length=20,
)
assert ret == (
@@ -67,21 +70,21 @@ def test_partition_limit_win32_py3(win32_py3_mock):
cmd = ('ninechars',)
# counted as half because of utf-16 encode
varargs = ('😑' * 5,)
- ret = xargs.partition(cmd, varargs, _max_length=20)
+ ret = xargs.partition(cmd, varargs, 1, _max_length=20)
assert ret == (cmd + varargs,)
def test_partition_limit_win32_py2(win32_py2_mock):
cmd = ('ninechars',)
varargs = ('😑' * 5,) # 4 bytes * 5
- ret = xargs.partition(cmd, varargs, _max_length=30)
+ ret = xargs.partition(cmd, varargs, 1, _max_length=30)
assert ret == (cmd + varargs,)
def test_partition_limit_linux(linux_mock):
cmd = ('ninechars',)
varargs = ('😑' * 5,)
- ret = xargs.partition(cmd, varargs, _max_length=30)
+ ret = xargs.partition(cmd, varargs, 1, _max_length=30)
assert ret == (cmd + varargs,)
@@ -89,12 +92,39 @@ def test_argument_too_long_with_large_unicode(linux_mock):
cmd = ('ninechars',)
varargs = ('😑' * 10,) # 4 bytes * 10
with pytest.raises(xargs.ArgumentTooLongError):
- xargs.partition(cmd, varargs, _max_length=20)
+ xargs.partition(cmd, varargs, 1, _max_length=20)
+
+
+def test_partition_target_concurrency():
+ ret = xargs.partition(
+ ('foo',), ('A',) * 22,
+ 4,
+ _max_length=50,
+ )
+ assert ret == (
+ ('foo',) + ('A',) * 6,
+ ('foo',) + ('A',) * 6,
+ ('foo',) + ('A',) * 6,
+ ('foo',) + ('A',) * 4,
+ )
+
+
+def test_partition_target_concurrency_wont_make_tiny_partitions():
+ ret = xargs.partition(
+ ('foo',), ('A',) * 10,
+ 4,
+ _max_length=50,
+ )
+ assert ret == (
+ ('foo',) + ('A',) * 4,
+ ('foo',) + ('A',) * 4,
+ ('foo',) + ('A',) * 2,
+ )
def test_argument_too_long():
with pytest.raises(xargs.ArgumentTooLongError):
- xargs.partition(('a' * 5,), ('a' * 5,), _max_length=10)
+ xargs.partition(('a' * 5,), ('a' * 5,), 1, _max_length=10)
def test_xargs_smoke():
@@ -132,3 +162,34 @@ def test_xargs_retcode_normal():
ret, _, _ = xargs.xargs(exit_cmd, ('0', '1'), _max_length=max_length)
assert ret == 1
+
+
+def test_xargs_concurrency():
+ bash_cmd = ('bash', '-c')
+ print_pid = ('sleep 0.5 && echo $$',)
+
+ start = time.time()
+ ret, stdout, _ = xargs.xargs(
+ bash_cmd, print_pid * 5,
+ target_concurrency=5,
+ _max_length=len(' '.join(bash_cmd + print_pid)),
+ )
+ elapsed = time.time() - start
+ assert ret == 0
+ pids = stdout.splitlines()
+ assert len(pids) == 5
+ # It would take 0.5*5=2.5 seconds ot run all of these in serial, so if it
+ # takes less, they must have run concurrently.
+ assert elapsed < 2.5
+
+
+def test_thread_mapper_concurrency_uses_threadpoolexecutor_map():
+ with xargs._thread_mapper(10) as thread_map:
+ assert isinstance(
+ thread_map.__self__, concurrent.futures.ThreadPoolExecutor,
+ ) is True
+
+
+def test_thread_mapper_concurrency_uses_regular_map():
+ with xargs._thread_mapper(1) as thread_map:
+ assert thread_map is map
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 0
},
"num_modified_files": 15
}
|
1.12
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio",
"mock"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aspy.yaml==1.3.0
cached-property==2.0.1
cfgv==3.4.0
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
execnet==2.1.1
filelock==3.18.0
identify==2.6.9
importlib_metadata==8.6.1
iniconfig==2.1.0
mock==5.2.0
nodeenv==1.9.1
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
-e git+https://github.com/pre-commit/pre-commit.git@1f1cd2bc394271540955794b3d2d3e6d8f4e65bb#egg=pre_commit
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
PyYAML==6.0.2
six==1.17.0
toml==0.10.2
tomli==2.2.1
typing_extensions==4.13.0
virtualenv==20.29.3
zipp==3.21.0
|
name: pre-commit
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aspy-yaml==1.3.0
- cached-property==2.0.1
- cfgv==3.4.0
- coverage==7.8.0
- distlib==0.3.9
- exceptiongroup==1.2.2
- execnet==2.1.1
- filelock==3.18.0
- identify==2.6.9
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- mock==5.2.0
- nodeenv==1.9.1
- packaging==24.2
- platformdirs==4.3.7
- pluggy==1.5.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- pytest-xdist==3.6.1
- pyyaml==6.0.2
- six==1.17.0
- toml==0.10.2
- tomli==2.2.1
- typing-extensions==4.13.0
- virtualenv==20.29.3
- zipp==3.21.0
prefix: /opt/conda/envs/pre-commit
|
[
"tests/languages/helpers_test.py::test_target_concurrency_normal",
"tests/languages/helpers_test.py::test_target_concurrency_cpu_count_require_serial_true",
"tests/languages/helpers_test.py::test_target_concurrency_testing_env_var",
"tests/languages/helpers_test.py::test_target_concurrency_on_travis",
"tests/languages/helpers_test.py::test_target_concurrency_cpu_count_not_implemented",
"tests/repository_test.py::test_manifest_hooks",
"tests/xargs_test.py::test_partition_simple",
"tests/xargs_test.py::test_partition_limits",
"tests/xargs_test.py::test_partition_limit_win32_py3",
"tests/xargs_test.py::test_partition_limit_win32_py2",
"tests/xargs_test.py::test_partition_limit_linux",
"tests/xargs_test.py::test_argument_too_long_with_large_unicode",
"tests/xargs_test.py::test_partition_target_concurrency",
"tests/xargs_test.py::test_partition_target_concurrency_wont_make_tiny_partitions",
"tests/xargs_test.py::test_argument_too_long",
"tests/xargs_test.py::test_xargs_concurrency",
"tests/xargs_test.py::test_thread_mapper_concurrency_uses_threadpoolexecutor_map",
"tests/xargs_test.py::test_thread_mapper_concurrency_uses_regular_map"
] |
[
"tests/repository_test.py::test_switch_language_versions_doesnt_clobber",
"tests/repository_test.py::test_run_a_ruby_hook",
"tests/repository_test.py::test_run_versioned_ruby_hook",
"tests/repository_test.py::test_run_ruby_hook_with_disable_shared_gems",
"tests/repository_test.py::test_golang_hook",
"tests/repository_test.py::test_rust_hook",
"tests/repository_test.py::test_additional_rust_cli_dependencies_installed[cli:shellharden:3.1.0]",
"tests/repository_test.py::test_additional_rust_cli_dependencies_installed[cli:shellharden]",
"tests/repository_test.py::test_additional_rust_lib_dependencies_installed",
"tests/repository_test.py::test_additional_ruby_dependencies_installed",
"tests/repository_test.py::test_additional_golang_dependencies_installed",
"tests/repository_test.py::test_local_golang_additional_dependencies",
"tests/repository_test.py::test_local_rust_additional_dependencies"
] |
[
"tests/languages/helpers_test.py::test_basic_get_default_version",
"tests/languages/helpers_test.py::test_basic_healthy",
"tests/languages/helpers_test.py::test_failed_setup_command_does_not_unicode_error",
"tests/repository_test.py::test_python_hook",
"tests/repository_test.py::test_python_hook_default_version",
"tests/repository_test.py::test_python_hook_args_with_spaces",
"tests/repository_test.py::test_python_hook_weird_setup_cfg",
"tests/repository_test.py::test_python_venv",
"tests/repository_test.py::test_versioned_python_hook",
"tests/repository_test.py::test_run_a_node_hook",
"tests/repository_test.py::test_run_versioned_node_hook",
"tests/repository_test.py::test_system_hook_with_spaces",
"tests/repository_test.py::test_missing_executable",
"tests/repository_test.py::test_run_a_script_hook",
"tests/repository_test.py::test_run_hook_with_spaced_args",
"tests/repository_test.py::test_run_hook_with_curly_braced_arguments",
"tests/repository_test.py::TestPygrep::test_grep_hook_matching",
"tests/repository_test.py::TestPygrep::test_grep_hook_case_insensitive",
"tests/repository_test.py::TestPygrep::test_grep_hook_not_matching[nope]",
"tests/repository_test.py::TestPygrep::test_grep_hook_not_matching[foo'bar]",
"tests/repository_test.py::TestPygrep::test_grep_hook_not_matching[^\\\\[INFO\\\\]]",
"tests/repository_test.py::TestPCRE::test_grep_hook_matching",
"tests/repository_test.py::TestPCRE::test_grep_hook_case_insensitive",
"tests/repository_test.py::TestPCRE::test_grep_hook_not_matching[nope]",
"tests/repository_test.py::TestPCRE::test_grep_hook_not_matching[foo'bar]",
"tests/repository_test.py::TestPCRE::test_grep_hook_not_matching[^\\\\[INFO\\\\]]",
"tests/repository_test.py::TestPCRE::test_pcre_hook_many_files",
"tests/repository_test.py::TestPCRE::test_missing_pcre_support",
"tests/repository_test.py::test_cwd_of_hook",
"tests/repository_test.py::test_lots_of_files",
"tests/repository_test.py::test_venvs",
"tests/repository_test.py::test_additional_dependencies",
"tests/repository_test.py::test_additional_dependencies_roll_forward",
"tests/repository_test.py::test_additional_node_dependencies_installed",
"tests/repository_test.py::test_fail_hooks",
"tests/repository_test.py::test_reinstall",
"tests/repository_test.py::test_control_c_control_c_on_install",
"tests/repository_test.py::test_invalidated_virtualenv",
"tests/repository_test.py::test_really_long_file_paths",
"tests/repository_test.py::test_config_overrides_repo_specifics",
"tests/repository_test.py::test_tags_on_repositories",
"tests/repository_test.py::test_local_repository",
"tests/repository_test.py::test_local_python_repo",
"tests/repository_test.py::test_hook_id_not_present",
"tests/repository_test.py::test_meta_hook_not_present",
"tests/repository_test.py::test_too_new_version",
"tests/repository_test.py::test_versions_ok[0.1.0]",
"tests/repository_test.py::test_versions_ok[1.12.0]",
"tests/xargs_test.py::test_partition_trivial",
"tests/xargs_test.py::test_xargs_smoke",
"tests/xargs_test.py::test_xargs_negate",
"tests/xargs_test.py::test_xargs_negate_command_not_found",
"tests/xargs_test.py::test_xargs_retcode_normal"
] |
[] |
MIT License
| 3,283 |
[
"pre_commit/languages/swift.py",
"pre_commit/xargs.py",
"pre_commit/languages/golang.py",
"setup.py",
"pre_commit/languages/helpers.py",
"pre_commit/languages/rust.py",
"pre_commit/languages/node.py",
"pre_commit/languages/ruby.py",
"pre_commit/languages/docker_image.py",
"pre_commit/languages/system.py",
"pre_commit/languages/script.py",
"tox.ini",
"pre_commit/languages/docker.py",
"pre_commit/clientlib.py",
"pre_commit/languages/python.py"
] |
[
"pre_commit/languages/swift.py",
"pre_commit/xargs.py",
"pre_commit/languages/golang.py",
"setup.py",
"pre_commit/languages/helpers.py",
"pre_commit/languages/rust.py",
"pre_commit/languages/node.py",
"pre_commit/languages/ruby.py",
"pre_commit/languages/docker_image.py",
"pre_commit/languages/system.py",
"pre_commit/languages/script.py",
"tox.ini",
"pre_commit/languages/docker.py",
"pre_commit/clientlib.py",
"pre_commit/languages/python.py"
] |
encode__uvicorn-234
|
c754a22105e4f9399222ec16ac7c5fdaf832784c
|
2018-10-20 20:13:52
|
ba8afcef13b2a94308df3c6cf0a78a5445195384
|
tomchristie: Looks great! Let’s make sure we’ve also got a new release of Starlette that handles *both* cases before we merge this in and release.
|
diff --git a/uvicorn/lifespan.py b/uvicorn/lifespan.py
index aa53860..e419beb 100644
--- a/uvicorn/lifespan.py
+++ b/uvicorn/lifespan.py
@@ -7,12 +7,12 @@ STATE_TRANSITION_ERROR = 'Got invalid state transition on lifespan protocol.'
class Lifespan:
- def __init__(self, app, logger=None, startup_timeout=10, cleanup_timeout=10):
+ def __init__(self, app, logger=None, startup_timeout=10, shutdown_timeout=10):
self.logger = logger or logging.getLogger("uvicorn")
self.startup_timeout = startup_timeout
- self.cleanup_timeout = cleanup_timeout
+ self.shutdown_timeout = shutdown_timeout
self.startup_event = asyncio.Event()
- self.cleanup_event = asyncio.Event()
+ self.shutdown_event = asyncio.Event()
self.receive_queue = asyncio.Queue()
try:
self.asgi = app({'type': 'lifespan'})
@@ -39,12 +39,12 @@ class Lifespan:
async def send(self, message):
if message['type'] == 'lifespan.startup.complete':
assert not self.startup_event.is_set(), STATE_TRANSITION_ERROR
- assert not self.cleanup_event.is_set(), STATE_TRANSITION_ERROR
+ assert not self.shutdown_event.is_set(), STATE_TRANSITION_ERROR
self.startup_event.set()
- elif message['type'] == 'lifespan.cleanup.complete':
+ elif message['type'] == 'lifespan.shutdown.complete':
assert self.startup_event.is_set(), STATE_TRANSITION_ERROR
- assert not self.cleanup_event.is_set(), STATE_TRANSITION_ERROR
- self.cleanup_event.set()
+ assert not self.shutdown_event.is_set(), STATE_TRANSITION_ERROR
+ self.shutdown_event.set()
else:
error = 'Got invalid message type on lifespan protocol "%s"'
raise RuntimeError(error % message['type'])
@@ -57,6 +57,6 @@ class Lifespan:
await self.receive_queue.put({'type': 'lifespan.startup'})
await asyncio.wait_for(self.startup_event.wait(), timeout=self.startup_timeout)
- async def wait_cleanup(self):
- await self.receive_queue.put({'type': 'lifespan.cleanup'})
- await asyncio.wait_for(self.cleanup_event.wait(), timeout=self.cleanup_timeout)
+ async def wait_shutdown(self):
+ await self.receive_queue.put({'type': 'lifespan.shutdown'})
+ await asyncio.wait_for(self.shutdown_event.wait(), timeout=self.shutdown_timeout)
diff --git a/uvicorn/main.py b/uvicorn/main.py
index 5119352..2066a0c 100644
--- a/uvicorn/main.py
+++ b/uvicorn/main.py
@@ -410,7 +410,7 @@ class Server:
if self.lifespan.is_enabled:
self.logger.info("Waiting for application cleanup.")
- await self.lifespan.wait_cleanup()
+ await self.lifespan.wait_shutdown()
self.loop.stop()
diff --git a/uvicorn/middleware/wsgi.py b/uvicorn/middleware/wsgi.py
index 82e45ec..901a260 100644
--- a/uvicorn/middleware/wsgi.py
+++ b/uvicorn/middleware/wsgi.py
@@ -55,6 +55,7 @@ class WSGIMiddleware:
self.executor = concurrent.futures.ThreadPoolExecutor(max_workers=workers)
def __call__(self, scope):
+ assert scope["type"] == "http"
return WSGIResponder(self.app, self.executor, scope)
|
Lifespan `cleanup` should become `shutdown`
Naming in ASGI spec recently tweaked here. Good one of a contributor to jump on.
We’re first want to update Starlette to deal with *either* of the two names.
|
encode/uvicorn
|
diff --git a/tests/test_lifespan.py b/tests/test_lifespan.py
index 8efb414..642d71e 100644
--- a/tests/test_lifespan.py
+++ b/tests/test_lifespan.py
@@ -14,7 +14,7 @@ class LifespanContext:
return self.app
async def __aexit__(self, exc_type, exc, tb):
- await self.lifespan.wait_cleanup()
+ await self.lifespan.wait_shutdown()
def test_lifespan_enabled():
@@ -40,9 +40,9 @@ def test_lifespan():
startup_complete = True
await send({'type': 'lifespan.startup.complete'})
message = await receive()
- assert message['type'] == 'lifespan.cleanup'
+ assert message['type'] == 'lifespan.shutdown'
cleanup_complete = True
- await send({'type': 'lifespan.cleanup.complete'})
+ await send({'type': 'lifespan.shutdown.complete'})
return lifespan
async def test(app):
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 3
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"requests",
"codecov"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.7",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
click==8.1.8
codecov==2.1.13
coverage==7.2.7
exceptiongroup==1.2.2
h11==0.14.0
httptools==0.6.0
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
packaging==24.0
pluggy==1.2.0
pytest==7.4.4
pytest-cov==4.1.0
requests==2.31.0
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
-e git+https://github.com/encode/uvicorn.git@c754a22105e4f9399222ec16ac7c5fdaf832784c#egg=uvicorn
uvloop==0.18.0
websockets==11.0.3
wsproto==1.2.0
zipp==3.15.0
|
name: uvicorn
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=22.3.1=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- charset-normalizer==3.4.1
- click==8.1.8
- codecov==2.1.13
- coverage==7.2.7
- exceptiongroup==1.2.2
- h11==0.14.0
- httptools==0.6.0
- idna==3.10
- importlib-metadata==6.7.0
- iniconfig==2.0.0
- packaging==24.0
- pluggy==1.2.0
- pytest==7.4.4
- pytest-cov==4.1.0
- requests==2.31.0
- tomli==2.0.1
- typing-extensions==4.7.1
- urllib3==2.0.7
- uvloop==0.18.0
- websockets==11.0.3
- wsproto==1.2.0
- zipp==3.15.0
prefix: /opt/conda/envs/uvicorn
|
[
"tests/test_lifespan.py::test_lifespan"
] |
[] |
[
"tests/test_lifespan.py::test_lifespan_enabled"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,284 |
[
"uvicorn/middleware/wsgi.py",
"uvicorn/lifespan.py",
"uvicorn/main.py"
] |
[
"uvicorn/middleware/wsgi.py",
"uvicorn/lifespan.py",
"uvicorn/main.py"
] |
encode__starlette-134
|
49f76ab5e9ef0ce5d966485553ad6019a9d37da5
|
2018-10-20 20:45:45
|
a32ea0a8e89567b24f3b8cd04847a1b01c9e98f0
|
alexbotello: Not sure how to resolve the tests for this one. Or if we would even want to, since the current tests will be perfectly fine once we drop support of 'cleanup'
tomchristie: Using `# pragma: no cover` to exclude specific lines in contexts like this is perfectly okay. Let’s do that.
tomchristie: Looks great! Will merge this once in at a keyboard and able to push a new release. Thanks!!
|
diff --git a/docs/applications.md b/docs/applications.md
index 2cce4ab..d4b44ca 100644
--- a/docs/applications.md
+++ b/docs/applications.md
@@ -56,7 +56,7 @@ There are two ways to add event handlers:
* `@app.on_event(event_type)` - Add an event, decorator style
* `app.add_event_handler(event_type, func)` - Add an event through a function call.
-`event_type` must be specified as either `'startup'` or `'cleanup'`.
+`event_type` must be specified as either `'startup'` or `'shutdown'`.
### Submounting other applications
diff --git a/docs/events.md b/docs/events.md
index b6696bb..3378a83 100644
--- a/docs/events.md
+++ b/docs/events.md
@@ -20,7 +20,7 @@ app = Starlette()
async def open_database_connection_pool():
...
[email protected]_event('cleanup')
[email protected]_event('shutdown')
async def close_database_connection_pool():
...
```
@@ -39,14 +39,14 @@ async def close_database_connection_pool():
...
app.add_event_handler('startup', open_database_connection_pool)
-app.add_event_handler('cleanup', close_database_connection_pool)
+app.add_event_handler('shutdown', close_database_connection_pool)
```
Starlette will not start serving any incoming requests until all of the
registered startup handlers have completed.
-The cleanup handlers will run once all connections have been closed, and
+The shutdown handlers will run once all connections have been closed, and
any in-process background tasks have completed.
**Note**: The ASGI lifespan protocol has only recently been added to the spec,
@@ -74,5 +74,5 @@ def test_homepage():
response = client.get("/")
assert response.status_code == 200
- # Application 'cleanup' handlers are called on exiting the block.
+ # Application 'shutdown' handlers are called on exiting the block.
```
diff --git a/starlette/lifespan.py b/starlette/lifespan.py
index a862298..b25ec8c 100644
--- a/starlette/lifespan.py
+++ b/starlette/lifespan.py
@@ -22,7 +22,7 @@ class LifespanHandler:
return decorator
def add_event_handler(self, event_type: str, func: typing.Callable) -> None:
- assert event_type in ("startup", "cleanup")
+ assert event_type in ("startup", "shutdown", "cleanup")
if event_type == "startup":
self.startup_handlers.append(func)
@@ -53,19 +53,26 @@ class LifespanHandler:
await self.run_startup()
await send({"type": "lifespan.startup.complete"})
message = await receive()
- assert message["type"] == "lifespan.cleanup"
+ assert (
+ message["type"] == "lifespan.shutdown"
+ or message["type"] == "lifespan.cleanup"
+ )
await self.run_cleanup()
- await send({"type": "lifespan.cleanup.complete"})
+ if message["type"] == "lifespan.shutdown":
+ await send({"type": "lifespan.shutdown.complete"})
+
+ if message["type"] == "lifespan.cleanup":
+ await send({"type": "lifespan.cleanup.complete"}) # pragma: no cover
class LifespanContext:
def __init__(
- self, app: ASGIApp, startup_timeout: int = 10, cleanup_timeout: int = 10
+ self, app: ASGIApp, startup_timeout: int = 10, shutdown_timeout: int = 10
) -> None:
self.startup_timeout = startup_timeout
- self.cleanup_timeout = cleanup_timeout
+ self.shutdown_timeout = shutdown_timeout
self.startup_event = asyncio.Event()
- self.cleanup_event = asyncio.Event()
+ self.shutdown_event = asyncio.Event()
self.receive_queue = asyncio.Queue() # type: asyncio.Queue
self.asgi = app({"type": "lifespan"}) # type: ASGIInstance
@@ -81,25 +88,25 @@ class LifespanContext:
tb: TracebackType,
) -> None:
loop = asyncio.get_event_loop()
- loop.run_until_complete(self.wait_cleanup())
+ loop.run_until_complete(self.wait_shutdown())
async def run_lifespan(self) -> None:
try:
await self.asgi(self.receive, self.send)
finally:
self.startup_event.set()
- self.cleanup_event.set()
+ self.shutdown_event.set()
async def send(self, message: Message) -> None:
if message["type"] == "lifespan.startup.complete":
assert not self.startup_event.is_set(), STATE_TRANSITION_ERROR
- assert not self.cleanup_event.is_set(), STATE_TRANSITION_ERROR
+ assert not self.shutdown_event.is_set(), STATE_TRANSITION_ERROR
self.startup_event.set()
else:
- assert message["type"] == "lifespan.cleanup.complete"
+ assert message["type"] == "lifespan.shutdown.complete"
assert self.startup_event.is_set(), STATE_TRANSITION_ERROR
- assert not self.cleanup_event.is_set(), STATE_TRANSITION_ERROR
- self.cleanup_event.set()
+ assert not self.shutdown_event.is_set(), STATE_TRANSITION_ERROR
+ self.shutdown_event.set()
async def receive(self) -> Message:
return await self.receive_queue.get()
@@ -108,6 +115,8 @@ class LifespanContext:
await self.receive_queue.put({"type": "lifespan.startup"})
await asyncio.wait_for(self.startup_event.wait(), timeout=self.startup_timeout)
- async def wait_cleanup(self) -> None:
- await self.receive_queue.put({"type": "lifespan.cleanup"})
- await asyncio.wait_for(self.cleanup_event.wait(), timeout=self.cleanup_timeout)
+ async def wait_shutdown(self) -> None:
+ await self.receive_queue.put({"type": "lifespan.shutdown"})
+ await asyncio.wait_for(
+ self.shutdown_event.wait(), timeout=self.shutdown_timeout
+ )
|
Support `shutdown` as a synonym for `cleanup`
* Support either `cleanup` or `shutdown` as the ASGI lifespan message name.
* Update uvicorn to move to shutdown - https://github.com/encode/uvicorn/issues/233
* Finally, after a small period of time, drop `cleanup`
Easy PR for a contributor to jump on would be addressing the first part of this, and supporting either name.
|
encode/starlette
|
diff --git a/tests/test_applications.py b/tests/test_applications.py
index 8dc4c40..64a48c0 100644
--- a/tests/test_applications.py
+++ b/tests/test_applications.py
@@ -181,7 +181,7 @@ def test_app_add_event_handler():
cleanup_complete = True
app.add_event_handler("startup", run_startup)
- app.add_event_handler("cleanup", run_cleanup)
+ app.add_event_handler("shutdown", run_cleanup)
assert not startup_complete
assert not cleanup_complete
diff --git a/tests/test_lifespan.py b/tests/test_lifespan.py
index db4cb73..7b7372d 100644
--- a/tests/test_lifespan.py
+++ b/tests/test_lifespan.py
@@ -12,7 +12,7 @@ def test_lifespan_handler():
nonlocal startup_complete
startup_complete = True
- @handler.on_event("cleanup")
+ @handler.on_event("shutdown")
def run_cleanup():
nonlocal cleanup_complete
cleanup_complete = True
@@ -36,7 +36,7 @@ def test_async_lifespan_handler():
nonlocal startup_complete
startup_complete = True
- @handler.on_event("cleanup")
+ @handler.on_event("shutdown")
async def run_cleanup():
nonlocal cleanup_complete
cleanup_complete = True
@@ -60,7 +60,7 @@ def test_app_lifespan():
nonlocal startup_complete
startup_complete = True
- @app.on_event("cleanup")
+ @app.on_event("shutdown")
def run_cleanup():
nonlocal cleanup_complete
cleanup_complete = True
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 3
}
|
0.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[full]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": null,
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
aiofiles==24.1.0
babel==2.17.0
backrefs==5.8
black==25.1.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
codecov==2.1.13
colorama==0.4.6
coverage==7.8.0
exceptiongroup==1.2.2
ghp-import==2.1.0
graphene==3.4.3
graphql-core==3.2.6
graphql-relay==3.2.0
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
Jinja2==3.1.6
Markdown==3.7
MarkupSafe==3.0.2
mergedeep==1.3.4
mkdocs==1.6.1
mkdocs-get-deps==0.2.0
mkdocs-material==9.6.10
mkdocs-material-extensions==1.3.1
mypy==1.15.0
mypy-extensions==1.0.0
packaging==24.2
paginate==0.5.7
pathspec==0.12.1
platformdirs==4.3.7
pluggy==1.5.0
Pygments==2.19.1
pymdown-extensions==10.14.3
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
python-multipart==0.0.20
PyYAML==6.0.2
pyyaml_env_tag==0.1
requests==2.32.3
six==1.17.0
-e git+https://github.com/encode/starlette.git@49f76ab5e9ef0ce5d966485553ad6019a9d37da5#egg=starlette
tomli==2.2.1
typing_extensions==4.13.0
ujson==5.10.0
urllib3==2.3.0
watchdog==6.0.0
zipp==3.21.0
|
name: starlette
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- aiofiles==24.1.0
- babel==2.17.0
- backrefs==5.8
- black==25.1.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- click==8.1.8
- codecov==2.1.13
- colorama==0.4.6
- coverage==7.8.0
- exceptiongroup==1.2.2
- ghp-import==2.1.0
- graphene==3.4.3
- graphql-core==3.2.6
- graphql-relay==3.2.0
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- jinja2==3.1.6
- markdown==3.7
- markupsafe==3.0.2
- mergedeep==1.3.4
- mkdocs==1.6.1
- mkdocs-get-deps==0.2.0
- mkdocs-material==9.6.10
- mkdocs-material-extensions==1.3.1
- mypy==1.15.0
- mypy-extensions==1.0.0
- packaging==24.2
- paginate==0.5.7
- pathspec==0.12.1
- platformdirs==4.3.7
- pluggy==1.5.0
- pygments==2.19.1
- pymdown-extensions==10.14.3
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- python-multipart==0.0.20
- pyyaml==6.0.2
- pyyaml-env-tag==0.1
- requests==2.32.3
- six==1.17.0
- tomli==2.2.1
- typing-extensions==4.13.0
- ujson==5.10.0
- urllib3==2.3.0
- watchdog==6.0.0
- zipp==3.21.0
prefix: /opt/conda/envs/starlette
|
[
"tests/test_applications.py::test_app_add_event_handler",
"tests/test_lifespan.py::test_lifespan_handler",
"tests/test_lifespan.py::test_async_lifespan_handler",
"tests/test_lifespan.py::test_app_lifespan"
] |
[] |
[
"tests/test_applications.py::test_func_route",
"tests/test_applications.py::test_async_route",
"tests/test_applications.py::test_class_route",
"tests/test_applications.py::test_route_kwargs",
"tests/test_applications.py::test_websocket_route",
"tests/test_applications.py::test_400",
"tests/test_applications.py::test_405",
"tests/test_applications.py::test_500",
"tests/test_applications.py::test_middleware",
"tests/test_applications.py::test_app_mount",
"tests/test_applications.py::test_app_debug"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,285 |
[
"docs/applications.md",
"docs/events.md",
"starlette/lifespan.py"
] |
[
"docs/applications.md",
"docs/events.md",
"starlette/lifespan.py"
] |
ipython__ipython-11425
|
36550f17759c1624d4dc76797c7212219d75f5d8
|
2018-10-20 20:56:50
|
f0ac04900b586a080b61a2f9ea00c8e9d3a3163b
|
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 179d45e56..576f1ae78 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,10 +1,10 @@
## Triaging Issues
-On the IPython repository, we strive to trust users and give them responsibility.
-By using one of our bot, any user can close issues or add and remove
+On the IPython repository we strive to trust users and give them responsibility.
+By using one of our bot, any user can close issues, add and remove
labels by mentioning the bot and asking it to do things on your behalf.
-To close an issue (or PR), even if you did not create it, use the following:
+To close and issue (or PR), even if you did not create it, use the following:
> @meeseeksdev close
@@ -16,7 +16,7 @@ tags to add:
> @meeseeksdev tag windows, documentation
-Only already pre-created tags can be added. So far, the list is limited to:
+Only already pre-created tags can be added, and the list is so far limited to
`async/await`, `backported`, `help wanted`, `documentation`, `notebook`,
`tab-completion`, `windows`
diff --git a/IPython/__init__.py b/IPython/__init__.py
index 043a946ab..7bd0ee3c4 100644
--- a/IPython/__init__.py
+++ b/IPython/__init__.py
@@ -75,7 +75,7 @@ def embed_kernel(module=None, local_ns=None, **kwargs):
Parameters
----------
- module : types.ModuleType, optional
+ module : ModuleType, optional
The module to load into IPython globals (default: caller)
local_ns : dict, optional
The namespace to load into IPython user namespace (default: caller)
diff --git a/IPython/core/inputtransformer2.py b/IPython/core/inputtransformer2.py
index b73d70121..7402b8a39 100644
--- a/IPython/core/inputtransformer2.py
+++ b/IPython/core/inputtransformer2.py
@@ -13,7 +13,7 @@
from codeop import compile_command
import re
import tokenize
-from typing import List, Tuple, Union
+from typing import List, Tuple
import warnings
_indent_re = re.compile(r'^[ \t]+')
@@ -87,7 +87,7 @@ def cell_magic(lines):
% (magic_name, first_line, body)]
-def _find_assign_op(token_line) -> Union[int, None]:
+def _find_assign_op(token_line):
"""Get the index of the first assignment in the line ('=' not inside brackets)
Note: We don't try to support multiple special assignment (a = b = %foo)
@@ -97,9 +97,9 @@ def _find_assign_op(token_line) -> Union[int, None]:
s = ti.string
if s == '=' and paren_level == 0:
return i
- if s in {'(','[','{'}:
+ if s in '([{':
paren_level += 1
- elif s in {')', ']', '}'}:
+ elif s in ')]}':
if paren_level > 0:
paren_level -= 1
@@ -449,14 +449,11 @@ def transform(self, lines):
return lines_before + [new_line] + lines_after
-def make_tokens_by_line(lines:List[str]):
+def make_tokens_by_line(lines):
"""Tokenize a series of lines and group tokens by line.
- The tokens for a multiline Python string or expression are grouped as one
- line. All lines except the last lines should keep their line ending ('\\n',
- '\\r\\n') for this to properly work. Use `.splitlines(keeplineending=True)`
- for example when passing block of text to this function.
-
+ The tokens for a multiline Python string or expression are
+ grouped as one line.
"""
# NL tokens are used inside multiline expressions, but also after blank
# lines or comments. This is intentional - see https://bugs.python.org/issue17061
@@ -464,8 +461,6 @@ def make_tokens_by_line(lines:List[str]):
# track parentheses level, similar to the internals of tokenize.
NEWLINE, NL = tokenize.NEWLINE, tokenize.NL
tokens_by_line = [[]]
- if len(lines) > 1 and not lines[0].endswith(('\n', '\r', '\r\n', '\x0b', '\x0c')):
- warnings.warn("`make_tokens_by_line` received a list of lines which do not have lineending markers ('\\n', '\\r', '\\r\\n', '\\x0b', '\\x0c'), behavior will be unspecified")
parenlev = 0
try:
for token in tokenize.generate_tokens(iter(lines).__next__):
@@ -604,7 +599,7 @@ def check_complete(self, cell: str):
else:
continue
- if ends_with_newline:
+ if not ends_with_newline:
# Append an newline for consistent tokenization
# See https://bugs.python.org/issue33899
cell += '\n'
@@ -649,10 +644,13 @@ def check_complete(self, cell: str):
newline_types = {tokenize.NEWLINE, tokenize.COMMENT, tokenize.ENDMARKER}
- # Remove newline_types for the list of tokens
- while len(tokens_by_line) > 1 and len(tokens_by_line[-1]) == 1 \
- and tokens_by_line[-1][-1].type in newline_types:
- tokens_by_line.pop()
+ # Pop the last line which only contains DEDENTs and ENDMARKER
+ last_token_line = None
+ if {t.type for t in tokens_by_line[-1]} in [
+ {tokenize.DEDENT, tokenize.ENDMARKER},
+ {tokenize.ENDMARKER}
+ ] and len(tokens_by_line) > 1:
+ last_token_line = tokens_by_line.pop()
while tokens_by_line[-1] and tokens_by_line[-1][-1].type in newline_types:
tokens_by_line[-1].pop()
@@ -685,7 +683,7 @@ def check_complete(self, cell: str):
if res is None:
return 'incomplete', find_last_indent(lines)
- if tokens_by_line[-1][-1].type == tokenize.DEDENT:
+ if last_token_line and last_token_line[0].type == tokenize.DEDENT:
if ends_with_newline:
return 'complete', None
return 'incomplete', find_last_indent(lines)
diff --git a/IPython/sphinxext/ipython_directive.py b/IPython/sphinxext/ipython_directive.py
index f264340f6..72d3d4f7a 100644
--- a/IPython/sphinxext/ipython_directive.py
+++ b/IPython/sphinxext/ipython_directive.py
@@ -579,7 +579,7 @@ def process_input(self, data, input_prompt, lineno):
w.filename, w.lineno, w.line)
sys.stdout.write(s)
sys.stdout.write('<<<' + ('-' * 73) + '\n')
- if self.warning_is_error:
+ if self.shell.warning_is_error:
raise RuntimeError('Non Expected warning in `{}` line {}'.format(filename, lineno))
self.cout.truncate(0)
@@ -1009,15 +1009,6 @@ def run(self):
if figure is not None:
figures.append(figure)
- else:
- message = 'Code input with no code at {}, line {}'\
- .format(
- self.state.document.current_source,
- self.state.document.current_line)
- if self.shell.warning_is_error:
- raise RuntimeError(message)
- else:
- warnings.warn(message)
for figure in figures:
lines.append('')
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 21906b088..0df8b44c9 100755
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -233,8 +233,7 @@ def is_stable(extra):
'ipykernel': ('https://ipykernel.readthedocs.io/en/latest/', None),
'prompt_toolkit' : ('https://python-prompt-toolkit.readthedocs.io/en/stable/', None),
'ipywidgets': ('https://ipywidgets.readthedocs.io/en/stable/', None),
- 'ipyparallel': ('https://ipyparallel.readthedocs.io/en/stable/', None),
- 'pip': ('https://pip.pypa.io/en/stable/', None)
+ 'ipyparallel': ('https://ipyparallel.readthedocs.io/en/stable/', None)
}
# Options for LaTeX output
diff --git a/docs/source/config/details.rst b/docs/source/config/details.rst
index 6685b14d8..31e26094f 100644
--- a/docs/source/config/details.rst
+++ b/docs/source/config/details.rst
@@ -216,35 +216,15 @@ a :ref:`startup file <startup_files>`::
def insert_unexpected(event):
buf = event.current_buffer
buf.insert_text('The Spanish Inquisition')
+
# Register the shortcut if IPython is using prompt_toolkit
- if getattr(ip, 'pt_app', None):
- registry = ip.pt_app.key_bindings
+ if getattr(ip, 'pt_cli'):
+ registry = ip.pt_cli.application.key_bindings_registry
registry.add_binding(Keys.ControlN,
filter=(HasFocus(DEFAULT_BUFFER)
& ~HasSelection()
& insert_mode))(insert_unexpected)
-
-Here is a second example that bind the key sequence ``j``, ``k`` to switch to
-VI input mode to ``Normal`` when in insert mode::
-
- from IPython import get_ipython
- from prompt_toolkit.enums import DEFAULT_BUFFER
- from prompt_toolkit.filters import HasFocus, ViInsertMode
- from prompt_toolkit.key_binding.vi_state import InputMode
-
- ip = get_ipython()
-
- def switch_to_navigation_mode(event):
- vi_state = event.cli.vi_state
- vi_state.input_mode = InputMode.NAVIGATION
-
- if getattr(ip, 'pt_app', None):
- registry = ip.pt_app.key_bindings
- registry.add_binding(u'j',u'k',
- filter=(HasFocus(DEFAULT_BUFFER)
- & ViInsertMode()))(switch_to_navigation_mode)
-
For more information on filters and what you can do with the ``event`` object,
`see the prompt_toolkit docs
<http://python-prompt-toolkit.readthedocs.io/en/latest/pages/building_prompts.html#adding-custom-key-bindings>`__.
diff --git a/docs/source/whatsnew/pr/video-width-height.rst b/docs/source/whatsnew/pr/video-width-height.rst
new file mode 100644
index 000000000..84757f1b4
--- /dev/null
+++ b/docs/source/whatsnew/pr/video-width-height.rst
@@ -0,0 +1,1 @@
+``IPython.display.Video`` now supports ``width`` and ``height`` arguments, allowing a custom width and height to be set instead of using the video's width and height
\ No newline at end of file
diff --git a/docs/source/whatsnew/version7.rst b/docs/source/whatsnew/version7.rst
index dc5a4d0e5..19352cc0d 100644
--- a/docs/source/whatsnew/version7.rst
+++ b/docs/source/whatsnew/version7.rst
@@ -2,79 +2,6 @@
7.x Series
============
-.. _whatsnew710:
-
-IPython 7.1.0
-=============
-
-
-IPython 7.1.0 is the first minor release after 7.0.0 and mostly bring fixes to
-new feature, internal refactor and regressions that happen during the 6.x->7.x
-transition. It also bring **Compatibility with Python 3.7.1**, as were
-unwillingly relying on a bug in CPython.
-
-New Core Dev:
-
- - We welcome Jonathan Slenders to the commiters. Jonathan has done a fantastic
- work on Prompt toolkit, and we'd like to recognise his impact by giving him
- commit rights. :ghissue:`11397`
-
-Notable New Features:
-
- - Restore functionality and documentation of the **sphinx directive**, which is
- now stricter (fail on error by default), gained configuration options, have a
- brand new documentation page :ref:`ipython_directive`, which need some cleanup.
- It is also now *tested* so we hope to have less regressions.
- :ghpull:`11402`
-
- - ``IPython.display.Video`` now supports ``width`` and ``height`` arguments,
- allowing a custom width and height to be set instead of using the video's
- width and height. :ghpull:`11353`
-
- - Warn when using ``HTML('<iframe>')`` instead of ``IFrame`` :ghpull:`11350`
-
- - Allow Dynamic switching of editing mode between vi/emacs and show
- normal/input mode in prompt when using vi. :ghpull:`11390`. Use ``%config
- TerminalInteractiveShell.editing_mode = 'vi'`` or ``%config
- TerminalInteractiveShell.editing_mode = 'emacs'`` to dynamically spwitch
-
-
-Notable Fixes:
-
- - Fix entering of **multi-line block in terminal** IPython, and various crashes
- in the new input transformation machinery :ghpull:`11354`, :ghpull:`11356`, :ghpull:`11358`, these
- ones also fix a **Compatibility but with Python 3.7.1**.
-
- - Fix moving through generator stack in ipdb :ghpull:`11266`
-
- - Magics arguments now support quoting. :ghpull:`11330`
-
- - Re-add ``rprint`` and ``rprinte`` aliases. :ghpull:`11331`
-
- - Remove implicit dependency to ``ipython_genutils`` :ghpull:`11317`
-
- - Make ``nonlocal`` raise ``SyntaxError`` instead of silently failing in async
- mode. :ghpull:`11382`
-
-
-Notable Internals improvements:
-
- - Use of ``os.scandir`` (Python 3 only) to speedup some file system operations.
- :ghpull:`11365`
-
- - use ``perf_counter`` instead of ``clock`` for more precise
- timing result with ``%time`` :ghpull:`11376`
-
-Many thanks to all the contributors and in particular to ``bartskowron``, and
-``tonyfast`` who handled a pretty complicated bugs in the input machinery. We
-had a number of first time contributors and maybe hacktoberfest participant that
-made significant contributions, and helped us free some time to focus on more
-complicated bugs.
-
-You
-can see all the closed issues and Merged PR, new features and fixes `here
-<https://github.com/ipython/ipython/issues?utf8=%E2%9C%93&q=+is%3Aclosed+milestone%3A7.1+>`_.
-
.. _whatsnew700:
IPython 7.0.0
@@ -279,8 +206,8 @@ Make :magic:`%run -n -i ... <run>` work correctly. Earlier, if :magic:`%run` was
passed both arguments, ``-n`` would be silently ignored. See :ghpull:`10308`
-The :cellmagic:`%%script` (as well as :cellmagic:`%%bash`,
-:cellmagic:`%%ruby`... ) cell magics now raise by default if the return code of
+The :cellmagic:`%%script`` (as well as :cellmagic:`%%bash``,
+:cellmagic:`%%ruby``... ) cell magics now raise by default if the return code of
the given code is non-zero (thus halting execution of further cells in a
notebook). The behavior can be disable by passing the ``--no-raise-error`` flag.
|
Wrong autoindent for class method.
```
class F:
def a(self):<enter>
```
Only 4 spaces are inserted.
|
ipython/ipython
|
diff --git a/IPython/core/tests/test_inputtransformer2.py b/IPython/core/tests/test_inputtransformer2.py
index 9c92c394e..ea0645238 100644
--- a/IPython/core/tests/test_inputtransformer2.py
+++ b/IPython/core/tests/test_inputtransformer2.py
@@ -8,7 +8,7 @@
import string
from IPython.core import inputtransformer2 as ipt2
-from IPython.core.inputtransformer2 import make_tokens_by_line, _find_assign_op
+from IPython.core.inputtransformer2 import make_tokens_by_line
from textwrap import dedent
@@ -53,22 +53,6 @@
g()
""".splitlines(keepends=True))
-#####
-
-MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT = ("""\
-def test():
- for i in range(1):
- print(i)
- res =! ls
-""".splitlines(keepends=True), (4, 7), '''\
-def test():
- for i in range(1):
- print(i)
- res =get_ipython().getoutput(\' ls\')
-'''.splitlines(keepends=True))
-
-######
-
AUTOCALL_QUOTE = (
[",f 1 2 3\n"], (1, 0),
['f("1", "2", "3")\n']
@@ -119,7 +103,6 @@ def test():
[r"get_ipython().set_next_input('(a,\nb) = zip');get_ipython().run_line_magic('pinfo', 'zip')" + "\n"]
)
-
def null_cleanup_transformer(lines):
"""
A cleanup transform that returns an empty list.
@@ -161,21 +144,18 @@ def test_continued_line():
def test_find_assign_magic():
check_find(ipt2.MagicAssign, MULTILINE_MAGIC_ASSIGN)
check_find(ipt2.MagicAssign, MULTILINE_SYSTEM_ASSIGN, match=False)
- check_find(ipt2.MagicAssign, MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT, match=False)
def test_transform_assign_magic():
check_transform(ipt2.MagicAssign, MULTILINE_MAGIC_ASSIGN)
def test_find_assign_system():
check_find(ipt2.SystemAssign, MULTILINE_SYSTEM_ASSIGN)
- check_find(ipt2.SystemAssign, MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT)
check_find(ipt2.SystemAssign, (["a = !ls\n"], (1, 5), None))
check_find(ipt2.SystemAssign, (["a=!ls\n"], (1, 2), None))
check_find(ipt2.SystemAssign, MULTILINE_MAGIC_ASSIGN, match=False)
def test_transform_assign_system():
check_transform(ipt2.SystemAssign, MULTILINE_SYSTEM_ASSIGN)
- check_transform(ipt2.SystemAssign, MULTILINE_SYSTEM_ASSIGN_AFTER_DEDENT)
def test_find_magic_escape():
check_find(ipt2.EscapedCommand, MULTILINE_MAGIC)
@@ -223,21 +203,11 @@ def test_transform_help():
tf = ipt2.HelpEnd((1, 0), (2, 8))
nt.assert_equal(tf.transform(HELP_MULTILINE[0]), HELP_MULTILINE[2])
-def test_find_assign_op_dedent():
- """
- be carefull that empty token like dedent are not counted as parens
- """
- class Tk:
- def __init__(self, s):
- self.string = s
-
- nt.assert_equal(_find_assign_op([Tk(s) for s in ('','a','=','b')]), 2)
- nt.assert_equal(_find_assign_op([Tk(s) for s in ('','(', 'a','=','b', ')', '=' ,'5')]), 6)
-
def test_check_complete():
cc = ipt2.TransformerManager().check_complete
nt.assert_equal(cc("a = 1"), ('complete', None))
nt.assert_equal(cc("for a in range(5):"), ('incomplete', 4))
+ nt.assert_equal(cc("for a in range(5):\n if a > 0:"), ('incomplete', 8))
nt.assert_equal(cc("raise = 2"), ('invalid', None))
nt.assert_equal(cc("a = [1,\n2,"), ('incomplete', 0))
nt.assert_equal(cc(")"), ('incomplete', 0))
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 7
}
|
7.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[test]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"numpy>=1.16.0",
"pandas>=1.0.0"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"swebench_instance_requirements/requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==25.3.0
backcall==0.2.0
certifi==2025.1.31
charset-normalizer==3.4.1
decorator==5.2.1
exceptiongroup==1.2.2
fastjsonschema==2.21.1
idna==3.10
importlib_metadata==8.6.1
iniconfig==2.1.0
ipykernel==5.5.6
-e git+https://github.com/ipython/ipython.git@36550f17759c1624d4dc76797c7212219d75f5d8#egg=ipython
ipython-genutils==0.2.0
jedi==0.19.2
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter_client==8.6.3
jupyter_core==5.7.2
nbformat==5.10.4
nose==1.3.7
numpy==2.0.2
packaging==24.2
pandas==2.2.3
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
platformdirs==4.3.7
pluggy==1.5.0
prompt-toolkit==2.0.10
ptyprocess==0.7.0
Pygments==2.19.1
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
pyzmq==26.3.0
referencing==0.36.2
requests==2.32.3
rpds-py==0.24.0
six==1.17.0
testpath==0.6.0
tomli==2.2.1
tornado==6.4.2
traitlets==5.14.3
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
wcwidth==0.2.13
zipp==3.21.0
|
name: ipython
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==25.3.0
- backcall==0.2.0
- certifi==2025.1.31
- charset-normalizer==3.4.1
- decorator==5.2.1
- exceptiongroup==1.2.2
- fastjsonschema==2.21.1
- idna==3.10
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- ipykernel==5.5.6
- ipython-genutils==0.2.0
- jedi==0.19.2
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- nbformat==5.10.4
- nose==1.3.7
- numpy==2.0.2
- packaging==24.2
- pandas==2.2.3
- parso==0.8.4
- pexpect==4.9.0
- pickleshare==0.7.5
- platformdirs==4.3.7
- pluggy==1.5.0
- prompt-toolkit==2.0.10
- ptyprocess==0.7.0
- pygments==2.19.1
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyzmq==26.3.0
- referencing==0.36.2
- requests==2.32.3
- rpds-py==0.24.0
- six==1.17.0
- testpath==0.6.0
- tomli==2.2.1
- tornado==6.4.2
- traitlets==5.14.3
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- wcwidth==0.2.13
- zipp==3.21.0
prefix: /opt/conda/envs/ipython
|
[
"IPython/core/tests/test_inputtransformer2.py::test_check_complete"
] |
[] |
[
"IPython/core/tests/test_inputtransformer2.py::test_continued_line",
"IPython/core/tests/test_inputtransformer2.py::test_find_assign_magic",
"IPython/core/tests/test_inputtransformer2.py::test_transform_assign_magic",
"IPython/core/tests/test_inputtransformer2.py::test_find_assign_system",
"IPython/core/tests/test_inputtransformer2.py::test_transform_assign_system",
"IPython/core/tests/test_inputtransformer2.py::test_find_magic_escape",
"IPython/core/tests/test_inputtransformer2.py::test_transform_magic_escape",
"IPython/core/tests/test_inputtransformer2.py::test_find_autocalls",
"IPython/core/tests/test_inputtransformer2.py::test_transform_autocall",
"IPython/core/tests/test_inputtransformer2.py::test_find_help",
"IPython/core/tests/test_inputtransformer2.py::test_transform_help",
"IPython/core/tests/test_inputtransformer2.py::test_check_complete_II",
"IPython/core/tests/test_inputtransformer2.py::test_null_cleanup_transformer"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,286 |
[
"docs/source/config/details.rst",
"IPython/core/inputtransformer2.py",
"CONTRIBUTING.md",
"docs/source/whatsnew/pr/video-width-height.rst",
"docs/source/whatsnew/version7.rst",
"IPython/sphinxext/ipython_directive.py",
"IPython/__init__.py",
"docs/source/conf.py"
] |
[
"docs/source/config/details.rst",
"IPython/core/inputtransformer2.py",
"CONTRIBUTING.md",
"docs/source/whatsnew/pr/video-width-height.rst",
"docs/source/whatsnew/version7.rst",
"IPython/sphinxext/ipython_directive.py",
"IPython/__init__.py",
"docs/source/conf.py"
] |
|
python-visualization__folium-1002
|
3777456a11418e04ff85e9ce406f928ab5ef548e
|
2018-10-20 22:52:33
|
110a90aa3e43927113f584e7c0804d0d5973cdd9
|
ocefpaf: @jtbaker I'm not sure you meant for all those commits, right?
Conengmo: @jtbaker the xml's ended up being committed again :) Can you remove them? After that I'll add a changelog entry and merge. Thanks for making this PR!
By the way, what do you use to do git stuff? If you'd like we could maybe share our workflows, see what can be improved.
ocefpaf: > By the way, what do you use to do git stuff? If you'd like we could maybe share our workflows, see what can be improved.
That is a good question! I'm a big fan of fork-branch-PR. Sometimes I don't even have a master on my fork so I'm forced to always fetch the latest master-dev and branch from there when adding a new feature or fixing a bug.
PS: would you two be available for a live meeting to discuss that and more about `folium`?
Conengmo: I removed the xmls and added a line to the changelog. Good to merge IMO.
> would you two be available for a live meeting to discuss that and more about folium?
That would be nice! What's a good channel to set this up, Gitter? I should check more often or enable notifications then.
|
diff --git a/.gitignore b/.gitignore
index 42ecb965..677e7b15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,9 @@ dist/
docs/_build/
docs/quickstart.ipynb
examples/results/*
+.cache/
+.idea/
+/*.xml
+/codestyles/*.xml
+/_mac/*.xml
+/inspection/*.xml
diff --git a/CHANGES.txt b/CHANGES.txt
index 0cb937ce..dcfd43a1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,7 @@
- More options (tms, opacity, kwargs) in TileLayer (mpickering #948)
- Add MousePosition plugin (btozer #916)
- Add Minimap plugin (talbertc-usgs #968)
+- Replace Rawgit CDN with Githack (jtbaker #1002)
Bug Fixes
diff --git a/folium/folium.py b/folium/folium.py
index 183ee3b7..f79cbfd3 100644
--- a/folium/folium.py
+++ b/folium/folium.py
@@ -47,7 +47,7 @@ _default_css = [
('awesome_markers_css',
'https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css'), # noqa
('awesome_rotate_css',
- 'https://rawgit.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css'), # noqa
+ 'https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css'), # noqa
]
diff --git a/folium/plugins/beautify_icon.py b/folium/plugins/beautify_icon.py
index 0e5243c2..09d7709d 100644
--- a/folium/plugins/beautify_icon.py
+++ b/folium/plugins/beautify_icon.py
@@ -86,9 +86,9 @@ class BeautifyIcon(MacroElement):
assert isinstance(figure, Figure), ('You cannot render this Element '
'if it is not in a Figure.')
figure.header.add_child(
- CssLink('https://cdn.rawgit.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.css'), # noqa
+ CssLink('https://rawcdn.githack.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.css'), # noqa
name='beautify_icon_css')
figure.header.add_child(
- JavascriptLink('https://cdn.rawgit.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.js'), # noqa
+ JavascriptLink('https://rawcdn.githack.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.js'), # noqa
name='beautify_icon_js')
diff --git a/folium/plugins/heat_map_withtime.py b/folium/plugins/heat_map_withtime.py
index 04cc7211..fe6cd145 100644
--- a/folium/plugins/heat_map_withtime.py
+++ b/folium/plugins/heat_map_withtime.py
@@ -162,16 +162,16 @@ class HeatMapWithTime(Layer):
'if it is not in a Figure.')
figure.header.add_child(
- JavascriptLink('https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'), # noqa
+ JavascriptLink('https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'), # noqa
name='leaflet.timedimension.min.js')
figure.header.add_child(
JavascriptLink(
- 'https://rawgit.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js'), # noqa
+ 'https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js'), # noqa
name='heatmap.min.js')
figure.header.add_child(
- JavascriptLink('https://rawgit.com/pa7/heatmap.js/develop/plugins/leaflet-heatmap/leaflet-heatmap.js'), # noqa
+ JavascriptLink('https://rawcdn.githack.com/pa7/heatmap.js/develop/plugins/leaflet-heatmap/leaflet-heatmap.js'), # noqa
name='leaflet-heatmap.js')
figure.header.add_child(
diff --git a/folium/plugins/measure_control.py b/folium/plugins/measure_control.py
index d3cd1f6f..cfa49104 100644
--- a/folium/plugins/measure_control.py
+++ b/folium/plugins/measure_control.py
@@ -60,7 +60,7 @@ class MeasureControl(MacroElement):
'if it is not in a Figure.')
figure.header.add_child(
- JavascriptLink('https://cdn.rawgit.com/ljagis/leaflet-measure/2.1.7/dist/leaflet-measure.js')) # noqa
+ JavascriptLink('https://rawcdn.githack.com/ljagis/leaflet-measure/2.1.7/dist/leaflet-measure.js')) # noqa
figure.header.add_child(
- CssLink('https://cdn.rawgit.com/ljagis/leaflet-measure/2.1.7/dist/leaflet-measure.css')) # noqa
+ CssLink('https://rawcdn.githack.com/ljagis/leaflet-measure/2.1.7/dist/leaflet-measure.css')) # noqa
diff --git a/folium/plugins/mouse_position.py b/folium/plugins/mouse_position.py
index 3d42f5bb..04f79d76 100644
--- a/folium/plugins/mouse_position.py
+++ b/folium/plugins/mouse_position.py
@@ -81,6 +81,6 @@ class MousePosition(MacroElement):
assert isinstance(figure, Figure), ('You cannot render this Element '
'if it is not in a Figure.')
- figure.header.add_child(JavascriptLink('https://cdn.rawgit.com/ardhi/Leaflet.MousePosition/c32f1c84/src/L.Control.MousePosition.js')) # noqa
+ figure.header.add_child(JavascriptLink('https://rawcdn.githack.com/ardhi/Leaflet.MousePosition/c32f1c84/src/L.Control.MousePosition.js')) # noqa
- figure.header.add_child(CssLink('https://cdn.rawgit.com/ardhi/Leaflet.MousePosition/c32f1c84/src/L.Control.MousePosition.css')) # noqa
+ figure.header.add_child(CssLink('https://rawcdn.githack.com/ardhi/Leaflet.MousePosition/c32f1c84/src/L.Control.MousePosition.css')) # noqa
diff --git a/folium/plugins/polyline_text_path.py b/folium/plugins/polyline_text_path.py
index a48682a4..4cf8e2b2 100644
--- a/folium/plugins/polyline_text_path.py
+++ b/folium/plugins/polyline_text_path.py
@@ -79,5 +79,5 @@ class PolyLineTextPath(MacroElement):
'if it is not in a Figure.')
figure.header.add_child(
- JavascriptLink("https://rawgit.com/makinacorpus/Leaflet.TextPath/leaflet0.8-dev/leaflet.textpath.js"), # noqa
+ JavascriptLink("https://rawcdn.githack.com/makinacorpus/Leaflet.TextPath/leaflet0.8-dev/leaflet.textpath.js"), # noqa
name='polylinetextpath')
diff --git a/folium/plugins/timestamped_geo_json.py b/folium/plugins/timestamped_geo_json.py
index 26604ec7..20699a70 100644
--- a/folium/plugins/timestamped_geo_json.py
+++ b/folium/plugins/timestamped_geo_json.py
@@ -180,11 +180,11 @@ class TimestampedGeoJson(MacroElement):
name='jqueryui1.10.2')
figure.header.add_child(
- JavascriptLink('https://rawgit.com/nezasa/iso8601-js-period/master/iso8601.min.js'), # noqa
+ JavascriptLink('https://rawcdn.githack.com/nezasa/iso8601-js-period/master/iso8601.min.js'), # noqa
name='iso8601')
figure.header.add_child(
- JavascriptLink('https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'), # noqa
+ JavascriptLink('https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'), # noqa
name='leaflet.timedimension')
figure.header.add_child(
@@ -192,7 +192,7 @@ class TimestampedGeoJson(MacroElement):
name='highlight.js_css')
figure.header.add_child(
- CssLink("https://cdn.rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css"), # noqa
+ CssLink("https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css"), # noqa
name='leaflet.timedimension_css')
figure.header.add_child(
diff --git a/folium/plugins/timestamped_wmstilelayer.py b/folium/plugins/timestamped_wmstilelayer.py
index 07e70899..aaa0d152 100644
--- a/folium/plugins/timestamped_wmstilelayer.py
+++ b/folium/plugins/timestamped_wmstilelayer.py
@@ -135,11 +135,11 @@ class TimestampedWmsTileLayers(Layer):
name='jqueryui1.10.2')
figure.header.add_child(
- JavascriptLink('https://rawgit.com/nezasa/iso8601-js-period/master/iso8601.min.js'), # noqa
+ JavascriptLink('https://rawcdn.githack.com/nezasa/iso8601-js-period/master/iso8601.min.js'), # noqa
name='iso8601')
figure.header.add_child(
- JavascriptLink('https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'), # noqa
+ JavascriptLink('https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js'), # noqa
name='leaflet.timedimension')
figure.header.add_child(
diff --git a/folium/templates/fol_template.html b/folium/templates/fol_template.html
index ea7af831..58eb1e9e 100644
--- a/folium/templates/fol_template.html
+++ b/folium/templates/fol_template.html
@@ -11,7 +11,7 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
- <link rel="stylesheet" href="https://rawgit.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css"/>
+ <link rel="stylesheet" href="https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/leaflet.awesome.rotate.css"/>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
|
Remove use of rawgit
Rawgit is being deprecated: https://rawgit.com/
We cannot use it for new URL's and have to stop using it for current ones and move to other CDN's before October 2019.
Currently there are 13 places where we use Rawgit:
https://github.com/python-visualization/folium/search?q=rawgit&unscoped_q=rawgit
|
python-visualization/folium
|
diff --git a/tests/plugins/test_beautify_icon.py b/tests/plugins/test_beautify_icon.py
index b9ba88b9..2af4448a 100644
--- a/tests/plugins/test_beautify_icon.py
+++ b/tests/plugins/test_beautify_icon.py
@@ -43,11 +43,11 @@ def test_beautify_icon():
out = m._parent.render()
# We verify that the script import is present.
- script = '<script src="https://cdn.rawgit.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.js"></script>' # noqa
+ script = '<script src="https://rawcdn.githack.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.js"></script>' # noqa
assert script in out
# We verify that the css import is present.
- css = '<link rel="stylesheet" href="https://cdn.rawgit.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.css"/>' # noqa
+ css = '<link rel="stylesheet" href="https://rawcdn.githack.com/marslan390/BeautifyMarker/master/leaflet-beautify-marker-icon.css"/>' # noqa
assert css in out
# We verify that the Beautiful Icons are rendered correctly.
diff --git a/tests/plugins/test_heat_map_withtime.py b/tests/plugins/test_heat_map_withtime.py
index a33e3f52..4fb9323b 100644
--- a/tests/plugins/test_heat_map_withtime.py
+++ b/tests/plugins/test_heat_map_withtime.py
@@ -34,11 +34,11 @@ def test_heat_map_with_time():
out = m._parent.render()
# We verify that the script imports are present.
- script = '<script src="https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js"></script>' # noqa
+ script = '<script src="https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js"></script>' # noqa
assert script in out
- script = '<script src="https://rawgit.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js"></script>' # noqa
+ script = '<script src="https://rawcdn.githack.com/python-visualization/folium/master/folium/templates/pa7_hm.min.js"></script>' # noqa
assert script in out
- script = '<script src="https://rawgit.com/pa7/heatmap.js/develop/plugins/leaflet-heatmap/leaflet-heatmap.js"></script>' # noqa
+ script = '<script src="https://rawcdn.githack.com/pa7/heatmap.js/develop/plugins/leaflet-heatmap/leaflet-heatmap.js"></script>' # noqa
assert script in out
script = '<link rel="stylesheet" href="http://apps.socib.es/Leaflet.TimeDimension/dist/leaflet.timedimension.control.min.css"/>' # noqa
assert script in out
diff --git a/tests/plugins/test_polyline_text_path.py b/tests/plugins/test_polyline_text_path.py
index 1292b065..6c305619 100644
--- a/tests/plugins/test_polyline_text_path.py
+++ b/tests/plugins/test_polyline_text_path.py
@@ -49,7 +49,7 @@ def test_polyline_text_path():
out = m._parent.render()
# We verify that the script import is present.
- script = '<script src="https://rawgit.com/makinacorpus/Leaflet.TextPath/leaflet0.8-dev/leaflet.textpath.js"></script>' # noqa
+ script = '<script src="https://rawcdn.githack.com/makinacorpus/Leaflet.TextPath/leaflet0.8-dev/leaflet.textpath.js"></script>' # noqa
assert script in out
# We verify that the script part is correct.
diff --git a/tests/plugins/test_timestamped_geo_json.py b/tests/plugins/test_timestamped_geo_json.py
index 1727315b..0bfd9ea7 100644
--- a/tests/plugins/test_timestamped_geo_json.py
+++ b/tests/plugins/test_timestamped_geo_json.py
@@ -102,10 +102,10 @@ def test_timestamped_geo_json():
# Verify the imports.
assert '<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>' in out
assert '<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>' in out
- assert '<script src="https://rawgit.com/nezasa/iso8601-js-period/master/iso8601.min.js"></script>' in out
- assert '<script src="https://rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js"></script>' in out # noqa
+ assert '<script src="https://rawcdn.githack.com/nezasa/iso8601-js-period/master/iso8601.min.js"></script>' in out
+ assert '<script src="https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.min.js"></script>' in out # noqa
assert '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css"/>' in out # noqa
- assert '<link rel="stylesheet" href="https://cdn.rawgit.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css"/>' in out # noqa
+ assert '<link rel="stylesheet" href="https://rawcdn.githack.com/socib/Leaflet.TimeDimension/master/dist/leaflet.timedimension.control.min.css"/>' in out # noqa
assert '<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>' in out
# Verify that the script is okay.
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 1
},
"num_modified_files": 11
}
|
0.6
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.16
altair==5.5.0
asttokens==3.0.0
attrs==25.3.0
babel==2.17.0
backports.tarfile==1.2.0
beautifulsoup4==4.13.3
bleach==6.2.0
branca==0.8.1
Cartopy==0.23.0
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
comm==0.2.2
contourpy==1.3.0
cryptography==44.0.2
cycler==0.12.1
debugpy==1.8.13
decorator==5.2.1
defusedxml==0.7.1
descartes==1.1.0
docutils==0.21.2
exceptiongroup==1.2.2
executing==2.2.0
fastjsonschema==2.21.1
flake8==7.2.0
flake8-builtins==2.5.0
flake8-comprehensions==3.16.0
flake8-import-order==0.18.2
flake8-mutable==1.2.0
flake8-print==5.0.0
flake8-quotes==3.4.0
-e git+https://github.com/python-visualization/folium.git@3777456a11418e04ff85e9ce406f928ab5ef548e#egg=folium
fonttools==4.56.0
geographiclib==2.0
geopandas==1.0.1
gpxpy==1.6.2
h11==0.14.0
id==1.5.0
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
importlib_resources==6.5.2
iniconfig==2.1.0
ipykernel==6.29.5
ipython==8.18.1
jaraco.classes==3.4.0
jaraco.context==6.0.1
jaraco.functools==4.1.0
jedi==0.19.2
jeepney==0.9.0
Jinja2==3.1.6
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyterlab_pygments==0.3.0
keyring==25.6.0
kiwisolver==1.4.7
lxml==5.3.1
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.9.4
matplotlib-inline==0.1.7
mccabe==0.7.0
mdurl==0.1.2
mistune==3.1.3
more-itertools==10.6.0
mplleaflet==0.0.5
narwhals==1.32.0
nbclient==0.10.2
nbconvert==7.16.6
nbformat==5.10.4
nbsphinx==0.9.7
nest-asyncio==1.6.0
nh3==0.2.21
numpy==2.0.2
outcome==1.3.0.post0
OWSLib==0.31.0
packaging==24.2
pandas==2.2.3
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pillow==11.1.0
platformdirs==4.3.7
pluggy==1.5.0
prompt_toolkit==3.0.50
psutil==7.0.0
ptyprocess==0.7.0
pure_eval==0.2.3
pycodestyle==2.13.0
pycparser==2.22
pyflakes==3.3.1
Pygments==2.19.1
pyogrio==0.10.0
pyparsing==3.2.3
pyproj==3.6.1
pyshp==2.3.1
PySocks==1.7.1
pytest==8.3.5
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
pyzmq==26.3.0
readme_renderer==44.0
referencing==0.36.2
requests==2.32.3
requests-toolbelt==1.0.0
rfc3986==2.0.0
rich==14.0.0
rpds-py==0.24.0
scipy==1.13.1
SecretStorage==3.3.3
selenium==4.30.0
shapely==2.0.7
six==1.17.0
sniffio==1.3.1
snowballstemmer==2.2.0
sortedcontainers==2.4.0
soupsieve==2.6
Sphinx==7.4.7
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stack-data==0.6.3
tinycss2==1.4.0
tomli==2.2.1
tornado==6.4.2
traitlets==5.14.3
trio==0.29.0
trio-websocket==0.12.2
twine==6.1.0
typing_extensions==4.13.0
tzdata==2025.2
urllib3==2.3.0
vega-datasets==0.9.0
vincent==0.4.4
wcwidth==0.2.13
webencodings==0.5.1
websocket-client==1.8.0
wsproto==1.2.0
zipp==3.21.0
|
name: folium
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.16
- altair==5.5.0
- asttokens==3.0.0
- attrs==25.3.0
- babel==2.17.0
- backports-tarfile==1.2.0
- beautifulsoup4==4.13.3
- bleach==6.2.0
- branca==0.8.1
- cartopy==0.23.0
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- comm==0.2.2
- contourpy==1.3.0
- cryptography==44.0.2
- cycler==0.12.1
- debugpy==1.8.13
- decorator==5.2.1
- defusedxml==0.7.1
- descartes==1.1.0
- docutils==0.21.2
- exceptiongroup==1.2.2
- executing==2.2.0
- fastjsonschema==2.21.1
- flake8==7.2.0
- flake8-builtins==2.5.0
- flake8-comprehensions==3.16.0
- flake8-import-order==0.18.2
- flake8-mutable==1.2.0
- flake8-print==5.0.0
- flake8-quotes==3.4.0
- fonttools==4.56.0
- geographiclib==2.0
- geopandas==1.0.1
- gpxpy==1.6.2
- h11==0.14.0
- id==1.5.0
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==8.6.1
- importlib-resources==6.5.2
- iniconfig==2.1.0
- ipykernel==6.29.5
- ipython==8.18.1
- jaraco-classes==3.4.0
- jaraco-context==6.0.1
- jaraco-functools==4.1.0
- jedi==0.19.2
- jeepney==0.9.0
- jinja2==3.1.6
- jsonschema==4.23.0
- jsonschema-specifications==2024.10.1
- jupyter-client==8.6.3
- jupyter-core==5.7.2
- jupyterlab-pygments==0.3.0
- keyring==25.6.0
- kiwisolver==1.4.7
- lxml==5.3.1
- markdown-it-py==3.0.0
- markupsafe==3.0.2
- matplotlib==3.9.4
- matplotlib-inline==0.1.7
- mccabe==0.7.0
- mdurl==0.1.2
- mistune==3.1.3
- more-itertools==10.6.0
- mplleaflet==0.0.5
- narwhals==1.32.0
- nbclient==0.10.2
- nbconvert==7.16.6
- nbformat==5.10.4
- nbsphinx==0.9.7
- nest-asyncio==1.6.0
- nh3==0.2.21
- numpy==2.0.2
- outcome==1.3.0.post0
- owslib==0.31.0
- packaging==24.2
- pandas==2.2.3
- pandocfilters==1.5.1
- parso==0.8.4
- pexpect==4.9.0
- pillow==11.1.0
- platformdirs==4.3.7
- pluggy==1.5.0
- prompt-toolkit==3.0.50
- psutil==7.0.0
- ptyprocess==0.7.0
- pure-eval==0.2.3
- pycodestyle==2.13.0
- pycparser==2.22
- pyflakes==3.3.1
- pygments==2.19.1
- pyogrio==0.10.0
- pyparsing==3.2.3
- pyproj==3.6.1
- pyshp==2.3.1
- pysocks==1.7.1
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pytz==2025.2
- pyyaml==6.0.2
- pyzmq==26.3.0
- readme-renderer==44.0
- referencing==0.36.2
- requests==2.32.3
- requests-toolbelt==1.0.0
- rfc3986==2.0.0
- rich==14.0.0
- rpds-py==0.24.0
- scipy==1.13.1
- secretstorage==3.3.3
- selenium==4.30.0
- shapely==2.0.7
- six==1.17.0
- sniffio==1.3.1
- snowballstemmer==2.2.0
- sortedcontainers==2.4.0
- soupsieve==2.6
- sphinx==7.4.7
- sphinxcontrib-applehelp==2.0.0
- sphinxcontrib-devhelp==2.0.0
- sphinxcontrib-htmlhelp==2.1.0
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==2.0.0
- sphinxcontrib-serializinghtml==2.0.0
- stack-data==0.6.3
- tinycss2==1.4.0
- tomli==2.2.1
- tornado==6.4.2
- traitlets==5.14.3
- trio==0.29.0
- trio-websocket==0.12.2
- twine==6.1.0
- typing-extensions==4.13.0
- tzdata==2025.2
- urllib3==2.3.0
- vega-datasets==0.9.0
- vincent==0.4.4
- wcwidth==0.2.13
- webencodings==0.5.1
- websocket-client==1.8.0
- wsproto==1.2.0
- zipp==3.21.0
prefix: /opt/conda/envs/folium
|
[
"tests/plugins/test_beautify_icon.py::test_beautify_icon",
"tests/plugins/test_heat_map_withtime.py::test_heat_map_with_time",
"tests/plugins/test_polyline_text_path.py::test_polyline_text_path",
"tests/plugins/test_timestamped_geo_json.py::test_timestamped_geo_json"
] |
[] |
[] |
[] |
MIT License
| 3,287 |
[
"CHANGES.txt",
"folium/plugins/beautify_icon.py",
"folium/plugins/mouse_position.py",
"folium/plugins/timestamped_geo_json.py",
"folium/templates/fol_template.html",
"folium/plugins/timestamped_wmstilelayer.py",
"folium/plugins/heat_map_withtime.py",
"folium/folium.py",
"folium/plugins/polyline_text_path.py",
".gitignore",
"folium/plugins/measure_control.py"
] |
[
"CHANGES.txt",
"folium/plugins/beautify_icon.py",
"folium/plugins/mouse_position.py",
"folium/plugins/timestamped_geo_json.py",
"folium/templates/fol_template.html",
"folium/plugins/timestamped_wmstilelayer.py",
"folium/plugins/heat_map_withtime.py",
"folium/folium.py",
"folium/plugins/polyline_text_path.py",
".gitignore",
"folium/plugins/measure_control.py"
] |
capsulecorplab__mindgraph-17
|
78d3cd912e2a882a2b6cb9569d3122afec05c47e
|
2018-10-21 02:26:58
|
78d3cd912e2a882a2b6cb9569d3122afec05c47e
|
diff --git a/mindgraph/graph.py b/mindgraph/graph.py
index 640c52d..a1a5ad7 100644
--- a/mindgraph/graph.py
+++ b/mindgraph/graph.py
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
import functools
+from typing import (Any, Callable, Generator, Iterator, List, Optional, Set,
+ Tuple)
-from typing import List
from yaml import dump, load
@@ -72,9 +73,42 @@ class Node(object):
functools.partial(node.custom_repr,
depth=depth + 1),
node.threads))
-
return " " * (depth - 1) + "- {}".format(node.name)
+ def _postorder(self,
+ depth: int = 0,
+ visited: Set["Node"] = None,
+ node_key: Callable[["Node"], Any]=None,
+ ) -> Generator[Tuple[int, "Node"], None, Set["Node"]]:
+ """Post-order traversal of graph rooted at node"""
+ if visited is None:
+ visited = set()
+
+ children = self._threads
+ if node_key is not None:
+ children = sorted(self._threads, key=node_key)
+
+ for child in children:
+ if child not in visited:
+ visited = yield from child._postorder(depth+1,
+ visited,
+ node_key)
+
+ yield (depth, self)
+ visited.add(self)
+
+ return visited
+
+ def todo(self) -> Iterator["Node"]:
+ """Generate nodes in todo order
+
+ Nodes are scheduled by weight and to resolve blocking tasks
+ """
+ # sorts by weight (2 before 1), then alphabetical
+ def node_key(node):
+ return (-node.weight, node.name)
+ return (x[1] for x in self._postorder(node_key=node_key))
+
def __str__(self) -> str:
return dump(load(str(self.__repr__())), default_flow_style=False)
|
add method that returns a generator of a "sorted to-do list"
As eluded to in #5, this would be a `Node` object method that traverses its threads, and returns a sequential data structure of all head nodes. Nodes should be sorted by weight, but nodes containing dependencies should be preceded by their dependencies.
I'm thinking this should be a [generator](https://www.programiz.com/python-programming/generator) w/ the following behavior...
e.g.,
```
>>> print(graph)
build a thing:
- task 1: # has a weight of 3 (default weight: 1)
- task 1.1
- task 1.2 # depends on task 2.2
- task 1.3 # has a weight of 3
- task 2: # has a weight of 2
- task 2.1
- task 2.2:
- task 2.2.1
- task 2.2.2
- task 3:
- task 3.1
- task 3.2 # depends on task 2.2
>>> todo = graph.sorted()
>>> next(todo)
task 1.3
>>> next(todo)
task 1.1
>>> next(todo)
task 2.2.1
>>> next(todo)
task 2.2.2
>>> next(todo)
task 1.2
>>> next(todo)
task 2.1
>>> next(todo)
task 3.1
>>> next(todo)
task 3.2
```
Feel free to point out any edge cases I may've missed, such as cyclic graphs (see #1)
|
capsulecorplab/mindgraph
|
diff --git a/test/test_mindgraph.py b/test/test_mindgraph.py
index f21f08d..9dbac53 100644
--- a/test/test_mindgraph.py
+++ b/test/test_mindgraph.py
@@ -1,7 +1,9 @@
-from mindgraph import *
+import os
+
import pytest
import yaml
-import os
+
+from mindgraph import *
@pytest.fixture(scope="module")
@@ -10,6 +12,56 @@ def graph():
return graph
[email protected]
+def task_graph():
+ # setup example graph from issue #14
+ g = Graph('build a thing')
+
+ t1 = g.append('task 1')
+ t1.weight = 3
+ t11 = t1.append('task 1.1')
+ t12 = t1.append('task 1.2')
+ t13 = t1.append('task 1.3')
+ t13.weight = 3
+
+ t2 = g.append('task 2')
+ t2.weight = 2
+ t21 = t2.append('task 2.1')
+ t22 = t2.append('task 2.2')
+ t221 = t22.append('task 2.2.1')
+ t222 = t22.append('task 2.2.2')
+
+ t3 = g.append('task 3')
+ t31 = t3.append('task 3.1')
+ t32 = t3.append('task 3.2')
+
+ t32.threads.append(t22)
+ t12.threads.append(t22)
+ return g
+
+
+def test_todo_high_weights_win(task_graph):
+ """High weights are scheduled before low weights"""
+ todo = [n.name for n in task_graph.todo()]
+ assert todo.index('task 1') < todo.index('task 2')
+ assert todo.index('task 1') < todo.index('task 3')
+ assert todo.index('task 1.3') < todo.index('task 1.1')
+
+
+def test_todo_blocking_tasks_win(task_graph):
+ """Blocking tasks are scheduled before blocked tasks"""
+ todo = [n.name for n in task_graph.todo()]
+ assert todo.index('task 2.2') < todo.index('task 3.2')
+ assert todo.index('task 2.2') < todo.index('task 1.2')
+ assert todo.index('task 1.1') < todo.index('task 1.2')
+
+
+def test_postorder_default_weights_ignored(task_graph):
+ """Post-order traversal ignores node weights by default"""
+ po = [n.name for _, n in task_graph._postorder()]
+ assert po.index('task 1.1') < po.index('task 1.3')
+
+
def test_node_init_typeerror():
with pytest.raises(TypeError) as info:
node = Node(47)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_issue_reference"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-pep8"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
execnet==1.9.0
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/capsulecorplab/mindgraph.git@78d3cd912e2a882a2b6cb9569d3122afec05c47e#egg=mindgraph
mypy==0.971
mypy-extensions==1.0.0
packaging==21.3
pep8==1.7.1
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cache==1.0
pytest-cov==4.0.0
pytest-pep8==1.0.6
PyYAML==6.0.1
tomli==1.2.3
typed-ast==1.5.5
typing_extensions==4.1.1
zipp==3.6.0
|
name: mindgraph
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- execnet==1.9.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- mypy==0.971
- mypy-extensions==1.0.0
- packaging==21.3
- pep8==1.7.1
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cache==1.0
- pytest-cov==4.0.0
- pytest-pep8==1.0.6
- pyyaml==6.0.1
- tomli==1.2.3
- typed-ast==1.5.5
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/mindgraph
|
[
"test/test_mindgraph.py::test_todo_high_weights_win",
"test/test_mindgraph.py::test_todo_blocking_tasks_win",
"test/test_mindgraph.py::test_postorder_default_weights_ignored"
] |
[
"test/test_mindgraph.py::test_repr",
"test/test_mindgraph.py::test_deep_repr",
"test/test_mindgraph.py::test_to_yaml"
] |
[
"test/test_mindgraph.py::test_node_init_typeerror",
"test/test_mindgraph.py::test_node_append_node",
"test/test_mindgraph.py::test_node_append",
"test/test_mindgraph.py::test_node_pop",
"test/test_mindgraph.py::test_node_pop_fail1",
"test/test_mindgraph.py::test_node_append_TypeError",
"test/test_mindgraph.py::test_blockedby",
"test/test_mindgraph.py::test_blocking",
"test/test_mindgraph.py::test_weight_getter_setter",
"test/test_mindgraph.py::test_name_getter_setter",
"test/test_mindgraph.py::test_to_yaml_TypeError"
] |
[] |
MIT License
| 3,288 |
[
"mindgraph/graph.py"
] |
[
"mindgraph/graph.py"
] |
|
missionpinball__mpf-1244
|
ea714f2719e28818d07afbc52d774c79e148a4b3
|
2018-10-21 15:33:01
|
2c1bb3aa1e25674916bc4e0d17ccb6c3c87bd01b
|
diff --git a/mpf/config_spec.yaml b/mpf/config_spec.yaml
index 937b708c5..39c05c8eb 100644
--- a/mpf/config_spec.yaml
+++ b/mpf/config_spec.yaml
@@ -544,7 +544,9 @@ game:
balls_per_game: single|template_int|3
max_players: single|template_int|4
start_game_switch_tag: single|str|start
+ start_game_event: single|str|None
add_player_switch_tag: single|str|start
+ add_player_event: single|str|None
allow_start_with_loose_balls: single|bool|False
allow_start_with_ball_in_drain: single|bool|False
hardware:
diff --git a/mpf/modes/attract/code/attract.py b/mpf/modes/attract/code/attract.py
index 365d7e1c7..1a933ac27 100644
--- a/mpf/modes/attract/code/attract.py
+++ b/mpf/modes/attract/code/attract.py
@@ -38,6 +38,9 @@ class Attract(Mode):
self.machine.switch_controller.add_switch_handler(
switch.name, self.start_button_released, 0))
+ if self.machine.config['game']['start_game_event']:
+ self.add_mode_event_handler(self.machine.config['game']['start_game_event'], self.start_button_released)
+
if hasattr(self.machine, 'ball_devices'):
self.machine.ball_controller.collect_balls()
@@ -61,7 +64,7 @@ class Attract(Mode):
"""
self.start_button_pressed_time = self.machine.clock.get_time()
- def start_button_released(self):
+ def start_button_released(self, **kwargs):
"""Handle start button release.
Called when the a switch tagged with *start* is deactivated.
@@ -70,6 +73,7 @@ class Attract(Mode):
called *request_to_start_game*. If that event comes back True, this
method calls :meth:`result_of_start_request`.
"""
+ del kwargs
self.start_hold_time = self.machine.clock.get_time() - self.start_button_pressed_time
self.start_buttons_held = list()
diff --git a/mpf/modes/game/code/game.py b/mpf/modes/game/code/game.py
index 663774e91..a4b548115 100644
--- a/mpf/modes/game/code/game.py
+++ b/mpf/modes/game/code/game.py
@@ -73,6 +73,9 @@ class Game(AsyncMode):
'%', self.machine.config['game']['add_player_switch_tag']),
self.request_player_add)
+ if self.machine.config['game']['add_player_event']:
+ self.add_mode_event_handler(self.machine.config['game']['add_player_event'], self.request_player_add)
+
self.max_players = self.machine.config['game']['max_players'].evaluate({})
yield from self._start_game()
|
Support game start/player add with an event in attract and game mode
Currently we only support switches to start a game. Also allow event only starts (e.g. with combo_switches). See: https://groups.google.com/forum/#!topic/mpf-users/vuUJMdSI2_A
|
missionpinball/mpf
|
diff --git a/mpf/tests/machine_files/game/config/config.yaml b/mpf/tests/machine_files/game/config/config.yaml
index c43ae23eb..d8aa231d6 100644
--- a/mpf/tests/machine_files/game/config/config.yaml
+++ b/mpf/tests/machine_files/game/config/config.yaml
@@ -2,6 +2,8 @@
game:
balls_per_game: 3
+ start_game_event: start_my_game
+ add_player_event: add_my_player
coils:
eject_coil1:
diff --git a/mpf/tests/test_Game.py b/mpf/tests/test_Game.py
index 65064903f..9b6483c7d 100644
--- a/mpf/tests/test_Game.py
+++ b/mpf/tests/test_Game.py
@@ -388,6 +388,29 @@ class TestGame(MpfGameTestCase):
self.assertEqual('game_ending', self._events.call_args_list[7][1]['event_name'])
self.assertEqual('game_ended', self._events.call_args_list[8][1]['event_name'])
+ def testGameEvents(self):
+ self.machine.switch_controller.process_switch('s_ball_switch1', 1)
+ self.machine.switch_controller.process_switch('s_ball_switch2', 1)
+ self.advance_time_and_run(10)
+ self.assertEqual(2, self.machine.ball_controller.num_balls_known)
+ self.assertEqual(2, self.machine.ball_devices.bd_trough.balls)
+
+ self.post_event("start_my_game")
+ self.assertGameIsRunning()
+ self.advance_time_and_run()
+ self.assertPlayerCount(1)
+ self.post_event("start_my_game")
+ self.assertPlayerCount(1)
+
+ self.post_event("add_my_player")
+ self.assertPlayerCount(2)
+ self.post_event("add_my_player")
+ self.assertPlayerCount(3)
+ self.post_event("add_my_player")
+ self.assertPlayerCount(4)
+ self.post_event("add_my_player")
+ self.assertPlayerCount(4)
+
class TestGameLogic(MpfFakeGameTestCase):
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 3
}
|
0.33
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
asciimatics==1.14.0
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
execnet==1.9.0
future==1.0.0
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/missionpinball/mpf.git@ea714f2719e28818d07afbc52d774c79e148a4b3#egg=mpf
packaging==21.3
Pillow==8.4.0
pluggy==1.0.0
psutil==7.0.0
py==1.11.0
pyfiglet==0.8.post1
pyparsing==3.1.4
pyserial==3.5
pyserial-asyncio==0.6
pytest==7.0.1
pytest-asyncio==0.16.0
pytest-cov==4.0.0
pytest-mock==3.6.1
pytest-xdist==3.0.2
ruamel.base==1.0.0
ruamel.yaml==0.10.23
terminaltables==3.1.10
tomli==1.2.3
typing==3.7.4.3
typing_extensions==4.1.1
wcwidth==0.2.13
zipp==3.6.0
|
name: mpf
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- asciimatics==1.14.0
- attrs==22.2.0
- coverage==6.2
- execnet==1.9.0
- future==1.0.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pillow==8.4.0
- pluggy==1.0.0
- psutil==7.0.0
- py==1.11.0
- pyfiglet==0.8.post1
- pyparsing==3.1.4
- pyserial==3.5
- pyserial-asyncio==0.6
- pytest==7.0.1
- pytest-asyncio==0.16.0
- pytest-cov==4.0.0
- pytest-mock==3.6.1
- pytest-xdist==3.0.2
- ruamel-base==1.0.0
- ruamel-yaml==0.10.23
- terminaltables==3.1.10
- tomli==1.2.3
- typing==3.7.4.3
- typing-extensions==4.1.1
- wcwidth==0.2.13
- zipp==3.6.0
prefix: /opt/conda/envs/mpf
|
[
"mpf/tests/test_Game.py::TestGame::testGameEvents",
"mpf/tests/test_Game.py::TestGame::testMultiplePlayerGame",
"mpf/tests/test_Game.py::TestGame::testSinglePlayerGame"
] |
[] |
[
"mpf/tests/test_Game.py::TestGameLogic::testLastGameScore"
] |
[] |
MIT License
| 3,289 |
[
"mpf/modes/attract/code/attract.py",
"mpf/modes/game/code/game.py",
"mpf/config_spec.yaml"
] |
[
"mpf/modes/attract/code/attract.py",
"mpf/modes/game/code/game.py",
"mpf/config_spec.yaml"
] |
|
python-trio__trio-744
|
106991f970d13b51a65d0c94ae5e1e33227b76a8
|
2018-10-21 21:44:46
|
5a03bee3fbf1a5364a3584ef8150b04143dcecdb
|
diff --git a/newsfragments/609.bugfix.rst b/newsfragments/609.bugfix.rst
new file mode 100644
index 00000000..2982905e
--- /dev/null
+++ b/newsfragments/609.bugfix.rst
@@ -0,0 +1,2 @@
+Fixed a race condition on macOS, where Trio's TCP listener would crash if an
+incoming TCP connection was closed before the listener had a chance to accept it.
diff --git a/trio/_highlevel_socket.py b/trio/_highlevel_socket.py
index 62b085b5..fef97622 100644
--- a/trio/_highlevel_socket.py
+++ b/trio/_highlevel_socket.py
@@ -62,11 +62,6 @@ class SocketStream(HalfCloseableStream):
raise TypeError("SocketStream requires trio socket object")
if socket.type != tsocket.SOCK_STREAM:
raise ValueError("SocketStream requires a SOCK_STREAM socket")
- try:
- socket.getpeername()
- except OSError:
- err = ValueError("SocketStream requires a connected socket")
- raise err from None
self.socket = socket
self._send_conflict_detector = ConflictDetector(
|
SocketStream.__init__'s check for whether the socket is connected is unreliable on MacOS
On IRC, @dstufft told me about a strange crash he sometimes gets in [linehaul](https://github.com/pypa/linehaul) when dumping test data in using netcat, which looked like it might be a bug in trio's `SocketListener` or something.
Unfortunately, I didn't save the traceback, and I'm not really sure how to reproduce it... @dstufft, any idea?
|
python-trio/trio
|
diff --git a/trio/tests/test_highlevel_open_tcp_stream.py b/trio/tests/test_highlevel_open_tcp_stream.py
index e677d4b6..707f57ec 100644
--- a/trio/tests/test_highlevel_open_tcp_stream.py
+++ b/trio/tests/test_highlevel_open_tcp_stream.py
@@ -128,9 +128,6 @@ class FakeSocket(trio.socket.SocketType):
def setsockopt(self, *args, **kwargs):
pass
- def getpeername(self):
- return (self.ip, self.port)
-
class Scenario(trio.abc.SocketFactory, trio.abc.HostnameResolver):
def __init__(self, port, ip_list, ipv6_supported):
diff --git a/trio/tests/test_highlevel_socket.py b/trio/tests/test_highlevel_socket.py
index aa1839d0..90f8ebd0 100644
--- a/trio/tests/test_highlevel_socket.py
+++ b/trio/tests/test_highlevel_socket.py
@@ -24,11 +24,6 @@ async def test_SocketStream_basics():
with pytest.raises(ValueError):
SocketStream(sock)
- # disconnected socket bad
- with tsocket.socket() as sock:
- with pytest.raises(ValueError):
- SocketStream(sock)
-
a, b = tsocket.socketpair()
with a, b:
s = SocketStream(a)
@@ -220,10 +215,6 @@ async def test_SocketListener_accept_errors():
def setsockopt(self, level, opt, value):
pass
- # Fool the check for connection in SocketStream.__init__
- def getpeername(self):
- pass
-
async def accept(self):
await _core.checkpoint()
event = next(self._events)
@@ -262,3 +253,12 @@ async def test_SocketListener_accept_errors():
with assert_checkpoints():
s = await l.accept()
assert s.socket is fake_server_sock
+
+
+async def test_socket_stream_works_when_peer_has_already_closed():
+ sock_a, sock_b = tsocket.socketpair()
+ await sock_b.send(b"x")
+ sock_b.close()
+ stream = SocketStream(sock_a)
+ assert await stream.receive_some(1) == b"x"
+ assert await stream.receive_some(1) == b""
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_added_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 1
}
|
0.9
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-faulthandler",
"pytest-xdist",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
async-generator==1.10
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
coverage==7.2.7
execnet==2.0.2
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
outcome==1.3.0.post0
packaging @ file:///croot/packaging_1671697413597/work
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
pytest-asyncio==0.21.2
pytest-cov==4.1.0
pytest-faulthandler==2.0.1
pytest-mock==3.11.1
pytest-xdist==3.5.0
sniffio==1.3.1
sortedcontainers==2.4.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
-e git+https://github.com/python-trio/trio.git@106991f970d13b51a65d0c94ae5e1e33227b76a8#egg=trio
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
zipp @ file:///croot/zipp_1672387121353/work
|
name: trio
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=22.1.0=py37h06a4308_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- flit-core=3.6.0=pyhd3eb1b0_0
- importlib-metadata=4.11.3=py37h06a4308_0
- importlib_metadata=4.11.3=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=22.0=py37h06a4308_0
- pip=22.3.1=py37h06a4308_0
- pluggy=1.0.0=py37h06a4308_1
- py=1.11.0=pyhd3eb1b0_0
- pytest=7.1.2=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py37h06a4308_0
- typing_extensions=4.4.0=py37h06a4308_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zipp=3.11.0=py37h06a4308_0
- zlib=1.2.13=h5eee18b_1
- pip:
- async-generator==1.10
- coverage==7.2.7
- execnet==2.0.2
- idna==3.10
- outcome==1.3.0.post0
- pytest-asyncio==0.21.2
- pytest-cov==4.1.0
- pytest-faulthandler==2.0.1
- pytest-mock==3.11.1
- pytest-xdist==3.5.0
- sniffio==1.3.1
- sortedcontainers==2.4.0
- trio==0.9.0+dev
prefix: /opt/conda/envs/trio
|
[
"trio/tests/test_highlevel_open_tcp_stream.py::test_one_host_quick_success",
"trio/tests/test_highlevel_open_tcp_stream.py::test_one_host_slow_success",
"trio/tests/test_highlevel_open_tcp_stream.py::test_basic_fallthrough",
"trio/tests/test_highlevel_open_tcp_stream.py::test_early_success",
"trio/tests/test_highlevel_open_tcp_stream.py::test_custom_delay",
"trio/tests/test_highlevel_open_tcp_stream.py::test_custom_errors_expedite",
"trio/tests/test_highlevel_open_tcp_stream.py::test_multi_success",
"trio/tests/test_highlevel_open_tcp_stream.py::test_does_reorder",
"trio/tests/test_highlevel_open_tcp_stream.py::test_handles_no_ipv6",
"trio/tests/test_highlevel_socket.py::test_SocketListener_accept_errors"
] |
[] |
[
"trio/tests/test_highlevel_open_tcp_stream.py::test_close_on_error",
"trio/tests/test_highlevel_open_tcp_stream.py::test_reorder_for_rfc_6555_section_5_4",
"trio/tests/test_highlevel_open_tcp_stream.py::test_format_host_port",
"trio/tests/test_highlevel_open_tcp_stream.py::test_open_tcp_stream_real_socket_smoketest",
"trio/tests/test_highlevel_open_tcp_stream.py::test_open_tcp_stream_input_validation",
"trio/tests/test_highlevel_open_tcp_stream.py::test_one_host_quick_fail",
"trio/tests/test_highlevel_open_tcp_stream.py::test_one_host_slow_fail",
"trio/tests/test_highlevel_open_tcp_stream.py::test_all_fail",
"trio/tests/test_highlevel_open_tcp_stream.py::test_no_hosts",
"trio/tests/test_highlevel_open_tcp_stream.py::test_cancel",
"trio/tests/test_highlevel_socket.py::test_SocketStream_basics",
"trio/tests/test_highlevel_socket.py::test_SocketStream_send_all",
"trio/tests/test_highlevel_socket.py::test_SocketStream_generic",
"trio/tests/test_highlevel_socket.py::test_SocketListener",
"trio/tests/test_highlevel_socket.py::test_SocketListener_socket_closed_underfoot",
"trio/tests/test_highlevel_socket.py::test_socket_stream_works_when_peer_has_already_closed"
] |
[] |
MIT/Apache-2.0 Dual License
| 3,290 |
[
"newsfragments/609.bugfix.rst",
"trio/_highlevel_socket.py"
] |
[
"newsfragments/609.bugfix.rst",
"trio/_highlevel_socket.py"
] |
|
iterative__dvc-1249
|
94cf83c1cd340e5507af4c11c24a2d3adac9e24d
|
2018-10-21 22:23:28
|
0ee7d5a7f823822445514dae1dc1db8bb4daec99
|
diff --git a/dvc/scm.py b/dvc/scm.py
index 742feb4f7..5230d00a0 100644
--- a/dvc/scm.py
+++ b/dvc/scm.py
@@ -240,18 +240,22 @@ class Git(Base):
def list_tags(self):
return [t.name for t in self.repo.tags]
- def install(self):
+ def _install_hook(self, name, cmd):
hook = os.path.join(self.root_dir,
self.GIT_DIR,
'hooks',
- 'post-checkout')
+ name)
if os.path.isfile(hook):
msg = 'Git hook \'{}\' already exists.'
raise SCMError(msg.format(os.path.relpath(hook)))
with open(hook, 'w+') as fd:
- fd.write('#!/bin/sh\nexec dvc checkout\n')
+ fd.write('#!/bin/sh\nexec dvc {}\n'.format(cmd))
os.chmod(hook, 0o777)
+ def install(self):
+ self._install_hook('post-checkout', 'checkout')
+ self._install_hook('pre-commit', 'status')
+
def SCM(root_dir, no_scm=False, project=None):
if Git.is_repo(root_dir) or Git.is_submodule(root_dir):
|
install: add pre-commit hook with `dvc status`
|
iterative/dvc
|
diff --git a/tests/test_install.py b/tests/test_install.py
index 28b67095f..a94458cb7 100644
--- a/tests/test_install.py
+++ b/tests/test_install.py
@@ -13,7 +13,11 @@ class TestInstall(TestDvc):
ret = main(['install'])
self.assertNotEqual(ret, 0)
- self.assertTrue(os.path.isfile('.git/hooks/post-checkout'))
+ def hook(name):
+ return os.path.join('.git', 'hooks', name)
+
+ self.assertTrue(os.path.isfile(hook('post-checkout')))
+ self.assertTrue(os.path.isfile(hook('pre-commit')))
self.dvc.add(self.FOO)
os.unlink(self.FOO)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 3,
"test_score": 2
},
"num_modified_files": 1
}
|
0.19
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[all]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"coverage",
"codecov",
"xmltodict",
"awscli",
"google-compute-engine",
"Pygments",
"collective.checkdocs"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
altgraph==0.17.4
asciimatics==1.15.0
awscli==1.38.23
azure-common==1.1.28
azure-nspkg==3.0.2
azure-storage-blob==1.3.0
azure-storage-common==1.3.0
azure-storage-nspkg==3.1.0
bcrypt==4.3.0
boto==2.49.0
boto3==1.7.4
botocore==1.10.84
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
codecov==2.1.13
collective.checkdocs==0.2
colorama==0.4.6
configobj==5.0.9
configparser==7.2.0
coverage==7.8.0
cryptography==44.0.2
decorator==5.2.1
distro==1.9.0
docutils==0.16
-e git+https://github.com/iterative/dvc.git@94cf83c1cd340e5507af4c11c24a2d3adac9e24d#egg=dvc
exceptiongroup==1.2.2
future==1.0.0
gitdb==4.0.12
GitPython==3.1.44
google-api-core==1.34.1
google-auth==2.38.0
google-cloud-core==0.28.1
google-cloud-storage==1.12.0
google-compute-engine==2.8.13
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
grandalf==0.6
idna==3.10
iniconfig==2.1.0
jmespath==0.10.0
jsonpath-rw==1.4.0
macholib==1.16.3
nanotime==0.5.2
networkx==3.2.1
packaging==24.2
paramiko==3.5.1
pefile==2024.8.26
pillow==11.1.0
pluggy==1.5.0
ply==3.11
protobuf==3.20.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pydot==3.0.4
pyfiglet==1.0.2
Pygments==2.19.1
PyInstaller==3.3.1
PyNaCl==1.5.0
pyparsing==3.2.3
pytest==8.3.5
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
rsa==4.7.2
s3transfer==0.1.13
schema==0.7.7
six==1.17.0
smmap==5.0.2
tomli==2.2.1
urllib3==1.26.20
wcwidth==0.2.13
xmltodict==0.14.2
zc.lockfile==3.0.post1
|
name: dvc
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- altgraph==0.17.4
- asciimatics==1.15.0
- awscli==1.38.23
- azure-common==1.1.28
- azure-nspkg==3.0.2
- azure-storage-blob==1.3.0
- azure-storage-common==1.3.0
- azure-storage-nspkg==3.1.0
- bcrypt==4.3.0
- boto==2.49.0
- boto3==1.7.4
- botocore==1.10.84
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- codecov==2.1.13
- collective-checkdocs==0.2
- colorama==0.4.6
- configobj==5.0.9
- configparser==7.2.0
- coverage==7.8.0
- cryptography==44.0.2
- decorator==5.2.1
- distro==1.9.0
- docutils==0.16
- exceptiongroup==1.2.2
- future==1.0.0
- gitdb==4.0.12
- gitpython==3.1.44
- google-api-core==1.34.1
- google-auth==2.38.0
- google-cloud-core==0.28.1
- google-cloud-storage==1.12.0
- google-compute-engine==2.8.13
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- grandalf==0.6
- idna==3.10
- iniconfig==2.1.0
- jmespath==0.10.0
- jsonpath-rw==1.4.0
- macholib==1.16.3
- nanotime==0.5.2
- networkx==3.2.1
- packaging==24.2
- paramiko==3.5.1
- pefile==2024.8.26
- pillow==11.1.0
- pluggy==1.5.0
- ply==3.11
- protobuf==3.20.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pydot==3.0.4
- pyfiglet==1.0.2
- pygments==2.19.1
- pyinstaller==3.3.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- rsa==4.7.2
- s3transfer==0.1.13
- schema==0.7.7
- six==1.17.0
- smmap==5.0.2
- tomli==2.2.1
- urllib3==1.26.20
- wcwidth==0.2.13
- xmltodict==0.14.2
- zc-lockfile==3.0.post1
prefix: /opt/conda/envs/dvc
|
[
"tests/test_install.py::TestInstall::test"
] |
[] |
[] |
[] |
Apache License 2.0
| 3,291 |
[
"dvc/scm.py"
] |
[
"dvc/scm.py"
] |
|
steemit__tinman-166
|
910179ae21242ab567bbd52e2d4070dd3c3c4b40
|
2018-10-22 03:28:51
|
910179ae21242ab567bbd52e2d4070dd3c3c4b40
|
diff --git a/tinman/submit.py b/tinman/submit.py
index 3db4eea..94fe525 100755
--- a/tinman/submit.py
+++ b/tinman/submit.py
@@ -19,6 +19,7 @@ from . import util
ACTIONS_MAJOR_VERSION_SUPPORTED = 0
ACTIONS_MINOR_VERSION_SUPPORTED = 2
+STEEM_BLOCK_INTERVAL = 3
class TransactionSigner(object):
def __init__(self, sign_transaction_exe=None, chain_id=None):
@@ -168,19 +169,30 @@ def main(argv):
try:
if cmd == "metadata":
metadata = args
- transactions_per_block = metadata.get("txgen:transactions_per_block", transactions_per_block)
- semver = metadata.get("txgen:semver", '0.0')
- major_version, minor_version = semver.split('.')
- major_version = int(major_version)
- minor_version = int(minor_version)
-
- if major_version == ACTIONS_MAJOR_VERSION_SUPPORTED:
- print("metadata:", metadata)
- else:
- raise RuntimeError("Unsupported actions:", metadata)
+
+ if args.get("post_backfill"):
+ dgpo = cached_dgpo.get()
+ now = datetime.datetime.utcnow()
+ head_block_time = datetime.datetime.strptime(dgpo["time"], "%Y-%m-%dT%H:%M:%S")
+ join_head = int((now - head_block_time).total_seconds()) // STEEM_BLOCK_INTERVAL
- if minor_version < ACTIONS_MINOR_VERSION_SUPPORTED:
- print("WARNING: Older actions encountered.", file=sys.stderr)
+ if join_head > STEEM_BLOCK_INTERVAL:
+ generate_blocks(steemd, {"count": join_head}, cached_dgpo=cached_dgpo, produce_realtime=produce_realtime)
+ cached_dgpo.reset()
+ else:
+ transactions_per_block = metadata.get("txgen:transactions_per_block", transactions_per_block)
+ semver = metadata.get("txgen:semver", '0.0')
+ major_version, minor_version = semver.split('.')
+ major_version = int(major_version)
+ minor_version = int(minor_version)
+
+ if major_version == ACTIONS_MAJOR_VERSION_SUPPORTED:
+ print("metadata:", metadata)
+ else:
+ raise RuntimeError("Unsupported actions:", metadata)
+
+ if minor_version < ACTIONS_MINOR_VERSION_SUPPORTED:
+ print("WARNING: Older actions encountered.", file=sys.stderr)
elif cmd == "wait_blocks":
if metadata and args.get("count") == 1 and args.get("miss_blocks"):
if args["miss_blocks"] < metadata["recommend:miss_blocks"]:
diff --git a/tinman/txgen.py b/tinman/txgen.py
index 0facf58..04bc774 100755
--- a/tinman/txgen.py
+++ b/tinman/txgen.py
@@ -30,6 +30,7 @@ NUM_BLOCKS_TO_CLEAR_WITNESS_ROUND = 21
TRANSACTION_WITNESS_SETUP_PAD = 100
STEEM_MAX_AUTHORITY_MEMBERSHIP = 10
DENOM = 10**12 # we need stupidly high precision because VESTS
+STEEM_BLOCKS_PER_DAY = 28800
def create_system_accounts(conf, keydb, name):
desc = conf["accounts"][name]
@@ -431,6 +432,8 @@ def build_actions(conf, silent=True):
if num_lines > 0:
metadata["backfill_actions:count"] = num_lines
metadata["actions:count"] += num_lines
+ miss_blocks -= max(num_lines // transactions_per_block, STEEM_BLOCKS_PER_DAY * 30)
+ metadata["recommend:miss_blocks"] = miss_blocks
has_backfill = True
yield ["metadata", metadata]
@@ -444,6 +447,8 @@ def build_actions(conf, silent=True):
with open(backfill_file, "r") as f:
for line in f:
yield json.loads(line)
+
+ yield ["metadata", {"post_backfill" : True}]
for tx in update_witnesses(conf, keydb, "init"):
yield ["submit_transaction", {"tx" : tx}]
diff --git a/tinman/util.py b/tinman/util.py
index 605a832..40f7221 100644
--- a/tinman/util.py
+++ b/tinman/util.py
@@ -130,7 +130,7 @@ def action_to_str(action):
This serializes actions, picking a string that does not occur in the JSON
serialization to escape public/private key notes.
"""
- if "esc" in action:
+ if action and action[1] and "esc" in action[1]:
return json.dumps(action, separators=(",", ":"), sort_keys=True)
json_empty_esc = json.dumps(action, separators=(",", ":"), default=prockey.PubkeySerializer(esc=""), sort_keys=True)
|
TN: Submit needs to generate blocks after backfill
Backfill actions start 30 days before realtime. But if the backfill doesn't supply 30 days of activity, `submit` should just generate blocks, in the situation where the backfill is too short on actions (or if the correct number of actions provided do not actually result in blocks).
To do this, `txgen` should signal that the backfill is done so that `submit` can deal with it or ignore it. When `txgen` completes the backfill actions, it should signal with metadata.
When `submit` sees the metadata about backfill completion, it will calculate the number of blocks needed to reach realtime.
|
steemit/tinman
|
diff --git a/test/keysub_test.py b/test/keysub_test.py
index d010a19..86d568f 100644
--- a/test/keysub_test.py
+++ b/test/keysub_test.py
@@ -6,7 +6,6 @@ from tinman import keysub
class KeysubTest(unittest.TestCase):
def test_process_esc(self):
- # Note, resolver needs to be mocked to properly test.
self.assertRaises(AttributeError, keysub.process_esc, 'Bpublickey:owner-initminerB', 'B')
def test_process_esc_ignored(self):
@@ -17,7 +16,9 @@ class KeysubTest(unittest.TestCase):
def test_compute_keypair_from_seed(self):
try:
# Try in case the binary is in the path environment.
- self.assertRaises(json.decoder.JSONDecodeError, keysub.compute_keypair_from_seed, '1234', 'secret')
+ result = keysub.compute_keypair_from_seed('1234', 'secret')
+ expected_result = "('TST6n6jNUngRVCkh3GKBEZVe6r8reBPHmi8bRkwFZ1yh83iKfGcSN', '5JFQtrsidduA79M523UZ2yKub4383BUykWthPkmTD2TAiVfDrA6')"
+ self.assertEqual(result, expected_result)
except FileNotFoundError:
# Note, resolver needs to be mocked to properly test.
true_exe = shutil.which("true")
diff --git a/test/txgen_test.py b/test/txgen_test.py
index ed28747..6f93b8a 100644
--- a/test/txgen_test.py
+++ b/test/txgen_test.py
@@ -223,7 +223,7 @@ class TxgenTest(unittest.TestCase):
self.assertEqual(args["txgen:transactions_per_block"], 40)
self.assertIsNotNone(args["epoch:created"])
self.assertEqual(args["actions:count"], 73)
- self.assertGreater(args["recommend:miss_blocks"], 28968013)
+ self.assertGreater(args["recommend:miss_blocks"], 28631339)
self.assertEqual(args["snapshot:semver"], "0.2")
self.assertEqual(args["snapshot:origin_api"], "http://calculon.local")
elif cmd == "wait_blocks":
@@ -233,9 +233,11 @@ class TxgenTest(unittest.TestCase):
self.assertIsInstance(args["tx"]["wif_sigs"], list)
for wif in args["tx"]["wif_sigs"]:
if isinstance(wif, str):
- if len(wif) < 51:
- self.assertEqual(args["esc"], wif[0])
- self.assertEqual(args["esc"], wif[-1])
+ esc = args.get("esc", None)
+
+ if esc and len(wif) < 51:
+ self.assertEqual(esc, wif[0])
+ self.assertEqual(esc, wif[-1])
else:
self.assertEqual(len(wif), 51)
else:
diff --git a/test/util_test.py b/test/util_test.py
index 5ecd3d8..e93481e 100644
--- a/test/util_test.py
+++ b/test/util_test.py
@@ -69,3 +69,8 @@ class UtilTest(unittest.TestCase):
action = ["metadata", {}]
result = util.action_to_str(action)
self.assertEqual(result, '["metadata",{"esc":"b"}]')
+
+ def test_action_to_str_with_esc(self):
+ action = ["metadata", {"esc": "C"}]
+ result = util.action_to_str(action)
+ self.assertEqual(result, '["metadata",{"esc":"C"}]')
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 3
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "Pipfile",
"pip_packages": [
"ijson",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y libyajl-dev"
],
"python": "3.6",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
ijson==3.3.0
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pipfile==0.0.2
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
-e git+https://github.com/steemit/tinman.git@910179ae21242ab567bbd52e2d4070dd3c3c4b40#egg=tinman
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: tinman
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- pipfile=0.0.2=py_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- toml=0.10.2=pyhd3eb1b0_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- ijson==3.3.0
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/tinman
|
[
"test/util_test.py::UtilTest::test_action_to_str_with_esc"
] |
[
"test/txgen_test.py::TxgenTest::test_build_actions",
"test/txgen_test.py::TxgenTest::test_build_actions_future_snapshot",
"test/txgen_test.py::TxgenTest::test_create_accounts",
"test/txgen_test.py::TxgenTest::test_get_account_stats",
"test/txgen_test.py::TxgenTest::test_get_proportions",
"test/txgen_test.py::TxgenTest::test_update_accounts"
] |
[
"test/keysub_test.py::KeysubTest::test_compute_keypair_from_seed",
"test/keysub_test.py::KeysubTest::test_process_esc",
"test/keysub_test.py::KeysubTest::test_process_esc_ignored",
"test/txgen_test.py::TxgenTest::test_create_system_accounts_bad_args",
"test/txgen_test.py::TxgenTest::test_create_witnesses",
"test/txgen_test.py::TxgenTest::test_update_witnesses",
"test/txgen_test.py::TxgenTest::test_vote_witnesses",
"test/util_test.py::UtilTest::test_action_to_str",
"test/util_test.py::UtilTest::test_batch",
"test/util_test.py::UtilTest::test_find_non_substr",
"test/util_test.py::UtilTest::test_iterate_operations_from",
"test/util_test.py::UtilTest::test_tag_escape_sequences"
] |
[] | null | 3,292 |
[
"tinman/txgen.py",
"tinman/util.py",
"tinman/submit.py"
] |
[
"tinman/txgen.py",
"tinman/util.py",
"tinman/submit.py"
] |
|
streamlink__streamlink-2127
|
7b5f4f775b70281c0970af9048e556258da11582
|
2018-10-22 12:13:43
|
42c34ca104f9a1761164dfce6c3ebabea984a823
|
bastimeyer: Something on GH seems to be broken right now, oh boy... https://status.github.com/messages :confused:
codecov[bot]: # [Codecov](https://codecov.io/gh/streamlink/streamlink/pull/2127?src=pr&el=h1) Report
> Merging [#2127](https://codecov.io/gh/streamlink/streamlink/pull/2127?src=pr&el=desc) into [master](https://codecov.io/gh/streamlink/streamlink/commit/b21df07689023f1f6fc79b228da4faa76c617667?src=pr&el=desc) will **decrease** coverage by `0.16%`.
> The diff coverage is `100%`.
```diff
@@ Coverage Diff @@
## master #2127 +/- ##
==========================================
- Coverage 51.31% 51.14% -0.17%
==========================================
Files 232 232
Lines 14184 14189 +5
==========================================
- Hits 7278 7257 -21
- Misses 6906 6932 +26
```
bastimeyer: > will decrease coverage by 0.16%
?????
https://codecov.io/gh/streamlink/streamlink/commit/0aad083fdc23ed649b736f29cccab1b2ae25e5be
https://codecov.io/gh/streamlink/streamlink/compare/b21df07689023f1f6fc79b228da4faa76c617667...0aad083fdc23ed649b736f29cccab1b2ae25e5be/changes
gravyboat: Talk about an edge case. This looks good to me @bastimeyer. I'll leave it open for a bit longer in case anyone else wants to weigh in, but if not we'll get it merged.
bastimeyer: Let's tag it as enhancement...
> edge case
The main problem and motivation for this change is that people who are using the Twitch GUI can set different stream quality selections which filter out unwanted streams by using the stream-sorting-excludes parameter. This has to be done because Twitch doesn't provide an API for knowing the available qualities, so you have to define the selection beforehand (or manually parse the HLS playlist in a couple of redundant requests, which is kinda stupid when using Streamlink).
Now If a user has selected a medium quality and thus filters out everything above the specified medium qualities and a streamer on Twitch doesn't have a full partnership and only a certain quality above "medium" is available, this stream-sorting-excludes filter fails. By having fallback stream name synonyms, this won't happen.
bastimeyer: Interesting... There's something going on with parsing the `vod_alt` stream name on Python<=3.5. This is unrelated to the PR because I was using the suggested stream names by @back-to.
|
diff --git a/src/streamlink/plugin/plugin.py b/src/streamlink/plugin/plugin.py
index 1f5513d7..ef38ac47 100644
--- a/src/streamlink/plugin/plugin.py
+++ b/src/streamlink/plugin/plugin.py
@@ -384,6 +384,7 @@ class Plugin(object):
stream_names = filter(stream_weight_only, streams.keys())
sorted_streams = sorted(stream_names, key=stream_weight_only)
+ unfiltered_sorted_streams = sorted_streams
if isinstance(sorting_excludes, list):
for expr in sorting_excludes:
@@ -402,6 +403,11 @@ class Plugin(object):
worst = sorted_streams[0]
final_sorted_streams["worst"] = streams[worst]
final_sorted_streams["best"] = streams[best]
+ elif len(unfiltered_sorted_streams) > 0:
+ best = unfiltered_sorted_streams[-1]
+ worst = unfiltered_sorted_streams[0]
+ final_sorted_streams["worst-unfiltered"] = streams[worst]
+ final_sorted_streams["best-unfiltered"] = streams[best]
return final_sorted_streams
diff --git a/src/streamlink/plugins/bilibili.py b/src/streamlink/plugins/bilibili.py
index 8ddb95cd..4e3c068e 100644
--- a/src/streamlink/plugins/bilibili.py
+++ b/src/streamlink/plugins/bilibili.py
@@ -1,12 +1,15 @@
+import hashlib
import re
+import time
from requests.adapters import HTTPAdapter
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate, useragents
from streamlink.stream import HTTPStream
-API_URL = "https://api.live.bilibili.com/room/v1/Room/playUrl?cid={0}&quality=0&platform=web"
+API_URL = "http://live.bilibili.com/api/playurl?cid={0}&player=1&quality=0&sign={1}&otype=json"
ROOM_API = "https://api.live.bilibili.com/room/v1/Room/room_init?id={}"
+API_SECRET = "95acd7f6cc3392f3"
SHOW_STATUS_OFFLINE = 0
SHOW_STATUS_ONLINE = 1
SHOW_STATUS_ROUND = 2
@@ -29,15 +32,6 @@ _room_id_schema = validate.Schema(
validate.get("data")
)
-_room_stream_list_schema = validate.Schema(
- {
- "data": validate.any(None, {
- "durl": [{"url": validate.url()}]
- })
- },
- validate.get("data")
-)
-
class Bilibili(Plugin):
@classmethod
@@ -62,8 +56,11 @@ class Bilibili(Plugin):
if room_id_json['live_status'] != SHOW_STATUS_ONLINE:
return
- res = self.session.http.get(API_URL.format(room_id))
- room = self.session.http.json(res, schema=_room_stream_list_schema)
+ ts = int(time.time() / 60)
+ sign = hashlib.md5(("{0}{1}".format(channel, API_SECRET, ts)).encode("utf-8")).hexdigest()
+
+ res = self.session.http.get(API_URL.format(room_id, sign))
+ room = self.session.http.json(res)
if not room:
return
diff --git a/src/streamlink/plugins/huomao.py b/src/streamlink/plugins/huomao.py
index e0d5770f..aee762b3 100644
--- a/src/streamlink/plugins/huomao.py
+++ b/src/streamlink/plugins/huomao.py
@@ -4,8 +4,8 @@ simply extracts the videos stream_id, stream_url and stream_quality by
scraping the HTML and JS of one of Huomaos mobile webpages.
When viewing a stream on huomao.com, the base URL references a room_id. This
-room_id is mapped one-to-one to a stream_id which references the actual .m3u8
-file. Both stream_id, stream_url and stream_quality can be found in the
+room_id is mapped one-to-one to a stream_id which references the actual .flv
+video. Both stream_id, stream_url and stream_quality can be found in the
HTML and JS source of the mobile_page. Since one stream can occur in many
different qualities, we scrape all stream_url and stream_quality occurrences
and return each option to the user.
@@ -14,7 +14,7 @@ and return each option to the user.
import re
from streamlink.plugin import Plugin
-from streamlink.stream import HLSStream
+from streamlink.stream import HTTPStream
# URL pattern for recognizing inputed Huomao.tv / Huomao.com URL.
url_re = re.compile(r"""
@@ -35,15 +35,18 @@ mobile_url = "http://www.huomao.com/mobile/mob_live/{0}"
# <input id="html_stream" value="efmrCH" type="hidden">
stream_id_pattern = re.compile(r'id=\"html_stream\" value=\"(?P<stream_id>\w+)\"')
-# Pattern for extracting each stream_url and
+# Pattern for extracting each stream_url, stream_quality_url and a prettified
# stream_quality_name used for quality naming.
#
# Example from HTML:
-# src="http://live-ws-hls.huomaotv.cn/live/<stream_id>_720/playlist.m3u8"
+# "2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8'"
stream_info_pattern = re.compile(r"""
- (?P<stream_url>(?:[\w\/\.\-:]+)
- \/[^_\"]+(?:_(?P<stream_quality_name>\d+))
- ?/playlist.m3u8)
+ [1-9]:
+ \s+
+ '(?P<stream_url>(?:\w|\.|:|-|/)+)
+ '\+stream\+'
+ (?P<stream_quality_url>_?(?P<stream_quality_name>\d*))
+ /playlist.m3u8'
""", re.VERBOSE)
@@ -62,11 +65,11 @@ class Huomao(Plugin):
return stream_id.group("stream_id")
def get_stream_info(self, html):
- """
- Returns a nested list of different stream options.
+ """Returns a nested list of different stream options.
- Each entry in the list will contain a stream_url and stream_quality_name
- for each stream occurrence that was found in the JS.
+ Each entry in the list will contain a stream_url, stream_quality_url
+ and stream_quality_name for each stream occurrence that was found in
+ the JS.
"""
stream_info = stream_info_pattern.findall(html)
@@ -77,8 +80,8 @@ class Huomao(Plugin):
# list and reassigning.
stream_info_list = []
for info in stream_info:
- if not info[1]:
- stream_info_list.append([info[0], "source"])
+ if not info[2]:
+ stream_info_list.append([info[0], info[1], "source"])
else:
stream_info_list.append(list(info))
@@ -92,8 +95,8 @@ class Huomao(Plugin):
streams = {}
for info in stream_info:
- if stream_id in info[0]:
- streams[info[1]] = HLSStream(self.session, info[0])
+ streams[info[2]] = HTTPStream(self.session,
+ info[0] + stream_id + info[1] + ".flv")
return streams
diff --git a/src/streamlink_cli/argparser.py b/src/streamlink_cli/argparser.py
index 0c77adb3..6af91976 100644
--- a/src/streamlink_cli/argparser.py
+++ b/src/streamlink_cli/argparser.py
@@ -107,7 +107,7 @@ def build_parser():
help="""
Stream to play.
- Use "best" or "worst" for selecting the highest or lowest available
+ Use ``best`` or ``worst`` for selecting the highest or lowest available
quality.
Fallback streams can be specified by using a comma-separated list:
@@ -523,7 +523,7 @@ def build_parser():
help="""
Stream to play.
- Use "best" or "worst" for selecting the highest or lowest available
+ Use ``best`` or ``worst`` for selecting the highest or lowest available
quality.
Fallback streams can be specified by using a comma-separated list:
@@ -590,13 +590,17 @@ def build_parser():
metavar="STREAMS",
type=comma_list,
help="""
- Fine tune best/worst synonyms by excluding unwanted streams.
+ Fine tune the ``best`` and ``worst`` stream name synonyms by excluding unwanted streams.
+
+ If all of the available streams get excluded, ``best`` and ``worst`` will become
+ inaccessible and new special stream synonyms ``best-unfiltered`` and ``worst-unfiltered``
+ can be used as a fallback selection method.
Uses a filter expression in the format:
[operator]<value>
- Valid operators are >, >=, < and <=. If no operator is specified then
+ Valid operators are ``>``, ``>=``, ``<`` and ``<=``. If no operator is specified then
equality is tested.
For example this will exclude streams ranked higher than "480p":
diff --git a/src/streamlink_cli/constants.py b/src/streamlink_cli/constants.py
index 05ec5dba..45eb7894 100644
--- a/src/streamlink_cli/constants.py
+++ b/src/streamlink_cli/constants.py
@@ -28,7 +28,7 @@ else:
]
PLUGINS_DIR = os.path.expanduser(XDG_CONFIG_HOME + "/streamlink/plugins")
-STREAM_SYNONYMS = ["best", "worst"]
+STREAM_SYNONYMS = ["best", "worst", "best-unfiltered", "worst-unfiltered"]
STREAM_PASSTHROUGH = ["hls", "http", "rtmp"]
__all__ = [
diff --git a/src/streamlink_cli/main.py b/src/streamlink_cli/main.py
index b43175a6..3fe315ce 100644
--- a/src/streamlink_cli/main.py
+++ b/src/streamlink_cli/main.py
@@ -57,14 +57,10 @@ def check_file_output(filename, force):
log.debug("Checking file output")
if os.path.isfile(filename) and not force:
- if sys.stdin.isatty():
- answer = console.ask("File {0} already exists! Overwrite it? [y/N] ",
- filename)
+ answer = console.ask("File {0} already exists! Overwrite it? [y/N] ",
+ filename)
- if answer.lower() != "y":
- sys.exit()
- else:
- log.error("File {0} already exists, use --force to overwrite it.".format(filename))
+ if answer.lower() != "y":
sys.exit()
return FileOutput(filename)
@@ -326,7 +322,7 @@ def read_stream(stream, output, prebuffer, chunk_size=8192):
is_player = isinstance(output, PlayerOutput)
is_http = isinstance(output, HTTPServer)
is_fifo = is_player and output.namedpipe
- show_progress = isinstance(output, FileOutput) and output.fd is not stdout and sys.stdout.isatty()
+ show_progress = isinstance(output, FileOutput) and output.fd is not stdout
stream_iterator = chain(
[prebuffer],
|
Fallback selection for --stream-sorting-excludes
### Checklist
- [ ] This is a bug report.
- [x] This is a feature request.
- [ ] This is a plugin (improvement) request.
- [ ] I have read the contribution guidelines.
### Description
Related issue:
https://github.com/streamlink/streamlink-twitch-gui/issues/481
In certain situations, the usage of `--stream-sorting-excludes` can lead to an empty stream selection. This is an issue for applications which try to map the available streams to a custom list of qualities.
The Streamlink Twitch GUI needs to do this stream quality mapping because of Twitch's inconsistent quality naming. This is an example of trying to find the "low" quality:
```
# available: 160p, 360p, 480p, 720p, 1080p
streamlink --stream-sorting-excludes ">360p" twitch.tv/CHANNEL low,best
# will open 360p
# available: low, medium, high, source
streamlink --stream-sorting-excludes ">360p" twitch.tv/CHANNEL low,best
# will open low
# available: 720p
streamlink --stream-sorting-excludes ">360p" twitch.tv/CHANNEL low,best
# returns an empty selection (channel doesn't have re-encoded qualities)
```
Having a fallback parameter (eg. `--stream-sorting-excludes-fallback`) with a list of streams that will be opened if no matching stream could be found would fix this situation.
Another solution could be having a different notation in the actual quality selection, but this is probably a bit too complex.
```
# 1. try to find the quality labeled "medium"
# 2. look for qualities named by video resolution matching the defined range
# 3. fall back to lower qualities
# 4. use any available quality
streamlink twitch.tv/CHANNEL "medium||>360p&&<=480p||<=360p||best"
streamlink twitch.tv/CHANNEL "medium,>360p<=480p,<=360p,best"
```
|
streamlink/streamlink
|
diff --git a/tests/plugins/test_huomao.py b/tests/plugins/test_huomao.py
index 1261680f..a27efdcb 100644
--- a/tests/plugins/test_huomao.py
+++ b/tests/plugins/test_huomao.py
@@ -15,12 +15,15 @@ class TestPluginHuomao(unittest.TestCase):
# room_id = 123456
# stream_id = 9qsvyF24659
# stream_url = http://live-ws.huomaotv.cn/live/
+ # stream_quality = source, _720 and _480
# stream_quality_name = source, 720 and 480
self.mock_html = """
<input id="html_stream" value="9qsvyF24659" type="hidden">
- <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659/playlist.m3u8">
- <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_720/playlist.m3u8">
- <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_480/playlist.m3u8">
+ <!-- urls:{-->
+ <!-- 1: 'http://live-ws.huomaotv.cn/live/'+stream+'/playlist.m3u8',-->
+ <!-- 2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8',-->
+ <!-- 3: 'http://live-ws.huomaotv.cn/live/'+stream+'_480/playlist.m3u8'-->
+ <!-- },-->
"""
# Create a mock Huomao object.
@@ -40,9 +43,9 @@ class TestPluginHuomao(unittest.TestCase):
# Assert that the stream_url, stream_quality and stream_quality_name
# is correctly extracted from the mock HTML.
self.assertEqual(self.mock_huomao.get_stream_info(self.mock_html), [
- ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659/playlist.m3u8", "source"],
- ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_720/playlist.m3u8", "720"],
- ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_480/playlist.m3u8", "480"]
+ ["http://live-ws.huomaotv.cn/live/", "", "source"],
+ ["http://live-ws.huomaotv.cn/live/", "_720", "720"],
+ ["http://live-ws.huomaotv.cn/live/", "_480", "480"]
])
def test_can_handle_url(self):
diff --git a/tests/plugins/testplugin.py b/tests/plugins/testplugin.py
index 06b693c4..66822ef4 100644
--- a/tests/plugins/testplugin.py
+++ b/tests/plugins/testplugin.py
@@ -37,6 +37,14 @@ class TestPlugin(Plugin):
def _get_streams(self):
if "empty" in self.url:
return
+
+ if "UnsortableStreamNames" in self.url:
+ def gen():
+ for i in range(3):
+ yield "vod", HTTPStream(self.session, "http://test.se/stream")
+
+ return gen()
+
if "NoStreamsError" in self.url:
raise NoStreamsError(self.url)
diff --git a/tests/test_cli_main.py b/tests/test_cli_main.py
index dccd30a7..86c3b9c4 100644
--- a/tests/test_cli_main.py
+++ b/tests/test_cli_main.py
@@ -3,8 +3,9 @@ import os.path
import tempfile
import streamlink_cli.main
-from streamlink_cli.main import resolve_stream_name, check_file_output
+from streamlink_cli.main import resolve_stream_name, format_valid_streams, check_file_output
from streamlink_cli.output import FileOutput
+from streamlink.plugin.plugin import Plugin
import unittest
from tests.mock import Mock, patch
@@ -18,25 +19,12 @@ class TestCLIMain(unittest.TestCase):
tmpfile = tempfile.NamedTemporaryFile()
try:
streamlink_cli.main.console = console = Mock()
- streamlink_cli.main.sys.stdin = stdin = Mock()
- stdin.isatty.return_value = True
console.ask.return_value = "y"
self.assertTrue(os.path.exists(tmpfile.name))
self.assertIsInstance(check_file_output(tmpfile.name, False), FileOutput)
finally:
tmpfile.close()
- def test_check_file_output_exists_notty(self):
- tmpfile = tempfile.NamedTemporaryFile()
- try:
- streamlink_cli.main.console = console = Mock()
- streamlink_cli.main.sys.stdin = stdin = Mock()
- stdin.isatty.return_value = False
- self.assertTrue(os.path.exists(tmpfile.name))
- self.assertRaises(SystemExit, check_file_output, tmpfile.name, False)
- finally:
- tmpfile.close()
-
def test_check_file_output_exists_force(self):
tmpfile = tempfile.NamedTemporaryFile()
try:
@@ -59,19 +47,71 @@ class TestCLIMain(unittest.TestCase):
tmpfile.close()
def test_resolve_stream_name(self):
- high = Mock()
- medium = Mock()
- low = Mock()
+ a = Mock()
+ b = Mock()
+ c = Mock()
+ d = Mock()
+ e = Mock()
streams = {
- "low": low,
- "medium": medium,
- "high": high,
- "worst": low,
- "best": high
+ "160p": a,
+ "360p": b,
+ "480p": c,
+ "720p": d,
+ "1080p": e,
+ "worst": b,
+ "best": d,
+ "worst-unfiltered": a,
+ "best-unfiltered": e
}
- self.assertEqual("high", resolve_stream_name(streams, "best"))
- self.assertEqual("low", resolve_stream_name(streams, "worst"))
- self.assertEqual("medium", resolve_stream_name(streams, "medium"))
- self.assertEqual("high", resolve_stream_name(streams, "high"))
- self.assertEqual("low", resolve_stream_name(streams, "low"))
+ self.assertEqual(resolve_stream_name(streams, "unknown"), "unknown")
+ self.assertEqual(resolve_stream_name(streams, "160p"), "160p")
+ self.assertEqual(resolve_stream_name(streams, "360p"), "360p")
+ self.assertEqual(resolve_stream_name(streams, "480p"), "480p")
+ self.assertEqual(resolve_stream_name(streams, "720p"), "720p")
+ self.assertEqual(resolve_stream_name(streams, "1080p"), "1080p")
+ self.assertEqual(resolve_stream_name(streams, "worst"), "360p")
+ self.assertEqual(resolve_stream_name(streams, "best"), "720p")
+ self.assertEqual(resolve_stream_name(streams, "worst-unfiltered"), "160p")
+ self.assertEqual(resolve_stream_name(streams, "best-unfiltered"), "1080p")
+
+ def test_format_valid_streams(self):
+ class FakePlugin:
+ @classmethod
+ def stream_weight(cls, stream):
+ return Plugin.stream_weight(stream)
+ a = Mock()
+ b = Mock()
+ c = Mock()
+
+ streams = {
+ "audio": a,
+ "720p": b,
+ "1080p": c,
+ "worst": b,
+ "best": c
+ }
+ self.assertEqual(
+ format_valid_streams(FakePlugin, streams),
+ ", ".join([
+ "audio",
+ "720p (worst)",
+ "1080p (best)"
+ ])
+ )
+
+ streams = {
+ "audio": a,
+ "720p": b,
+ "1080p": c,
+ "worst-unfiltered": b,
+ "best-unfiltered": c
+ }
+ self.assertEqual(
+ format_valid_streams(FakePlugin, streams),
+ ", ".join([
+ "audio",
+ "720p (worst-unfiltered)",
+ "1080p (best-unfiltered)"
+ ])
+ )
diff --git a/tests/test_session.py b/tests/test_session.py
index 573aae37..e923ab53 100644
--- a/tests/test_session.py
+++ b/tests/test_session.py
@@ -99,12 +99,23 @@ class TestSession(unittest.TestCase):
self.assertTrue(isinstance(streams["480p"], RTMPStream))
self.assertTrue(isinstance(streams["480p_http"], HTTPStream))
- def test_plugin_stream_sorted_excludes(self):
+ def test_plugin_stream_sorting_excludes(self):
channel = self.session.resolve_url("http://test.se/channel")
- streams = channel.streams(sorting_excludes=["1080p", "3000k"])
+ streams = channel.streams(sorting_excludes=[])
self.assertTrue("best" in streams)
self.assertTrue("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst"] is streams["350k"])
+ self.assertTrue(streams["best"] is streams["1080p"])
+
+ streams = channel.streams(sorting_excludes=["1080p", "3000k"])
+ self.assertTrue("best" in streams)
+ self.assertTrue("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst"] is streams["350k"])
self.assertTrue(streams["best"] is streams["1500k"])
streams = channel.streams(sorting_excludes=[">=1080p", ">1500k"])
@@ -113,6 +124,24 @@ class TestSession(unittest.TestCase):
streams = channel.streams(sorting_excludes=lambda q: not q.endswith("p"))
self.assertTrue(streams["best"] is streams["3000k"])
+ streams = channel.streams(sorting_excludes=lambda q: False)
+ self.assertFalse("best" in streams)
+ self.assertFalse("worst" in streams)
+ self.assertTrue("best-unfiltered" in streams)
+ self.assertTrue("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst-unfiltered"] is streams["350k"])
+ self.assertTrue(streams["best-unfiltered"] is streams["1080p"])
+
+ channel = self.session.resolve_url("http://test.se/UnsortableStreamNames")
+ streams = channel.streams()
+ self.assertFalse("best" in streams)
+ self.assertFalse("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue("vod" in streams)
+ self.assertTrue("vod_alt" in streams)
+ self.assertTrue("vod_alt2" in streams)
+
def test_plugin_support(self):
channel = self.session.resolve_url("http://test.se/channel")
streams = channel.streams()
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 6
}
|
0.14
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"codecov",
"coverage",
"mock",
"requests-mock",
"pynsist",
"freezegun"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"dev-requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
codecov==2.1.13
coverage==6.2
distlib==0.3.9
freezegun==1.2.2
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
iso-639==0.4.5
iso3166==2.1.1
isodate==0.6.1
Jinja2==3.0.3
MarkupSafe==2.0.1
mock==5.2.0
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycryptodome==3.21.0
pynsist==2.8
pyparsing==3.1.4
PySocks==1.7.1
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
requests==2.27.1
requests-mock==1.12.1
requests_download==0.1.2
six==1.17.0
-e git+https://github.com/streamlink/streamlink.git@7b5f4f775b70281c0970af9048e556258da11582#egg=streamlink
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
websocket-client==1.3.1
yarg==0.1.10
zipp==3.6.0
|
name: streamlink
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- codecov==2.1.13
- coverage==6.2
- distlib==0.3.9
- freezegun==1.2.2
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- iso-639==0.4.5
- iso3166==2.1.1
- isodate==0.6.1
- jinja2==3.0.3
- markupsafe==2.0.1
- mock==5.2.0
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pycryptodome==3.21.0
- pynsist==2.8
- pyparsing==3.1.4
- pysocks==1.7.1
- pytest==7.0.1
- pytest-cov==4.0.0
- python-dateutil==2.9.0.post0
- requests==2.27.1
- requests-download==0.1.2
- requests-mock==1.12.1
- six==1.17.0
- tomli==1.2.3
- typing-extensions==4.1.1
- urllib3==1.26.20
- websocket-client==1.3.1
- yarg==0.1.10
- zipp==3.6.0
prefix: /opt/conda/envs/streamlink
|
[
"tests/plugins/test_huomao.py::TestPluginHuomao::test_get_stream_quality",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists",
"tests/test_cli_main.py::TestCLIMain::test_format_valid_streams",
"tests/test_cli_main.py::TestCLIMain::test_resolve_stream_name",
"tests/test_session.py::TestSession::test_plugin_stream_sorting_excludes"
] |
[] |
[
"tests/plugins/test_huomao.py::TestPluginHuomao::test_can_handle_url",
"tests/plugins/test_huomao.py::TestPluginHuomao::test_get_stream_id",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists_force",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists_no",
"tests/test_session.py::TestSession::test_builtin_plugins",
"tests/test_session.py::TestSession::test_exceptions",
"tests/test_session.py::TestSession::test_load_plugins",
"tests/test_session.py::TestSession::test_options",
"tests/test_session.py::TestSession::test_plugin",
"tests/test_session.py::TestSession::test_plugin_stream_types",
"tests/test_session.py::TestSession::test_plugin_support",
"tests/test_session.py::TestSession::test_resolve_url",
"tests/test_session.py::TestSession::test_resolve_url_no_redirect",
"tests/test_session.py::TestSession::test_resolve_url_priority",
"tests/test_session.py::TestSession::test_set_and_get_locale",
"tests/test_session.py::TestSession::test_short_exception"
] |
[] |
BSD 2-Clause "Simplified" License
| 3,293 |
[
"src/streamlink_cli/constants.py",
"src/streamlink_cli/main.py",
"src/streamlink/plugins/huomao.py",
"src/streamlink_cli/argparser.py",
"src/streamlink/plugins/bilibili.py",
"src/streamlink/plugin/plugin.py"
] |
[
"src/streamlink_cli/constants.py",
"src/streamlink_cli/main.py",
"src/streamlink/plugins/huomao.py",
"src/streamlink_cli/argparser.py",
"src/streamlink/plugins/bilibili.py",
"src/streamlink/plugin/plugin.py"
] |
Duke-GCB__DukeDSClient-215
|
e2cf592ba0d9b2ee1bfdf51a723677275fee3998
|
2018-10-22 14:55:23
|
a925790870cc14a61f04b2d7cd6075fe39be2690
|
diff --git a/ddsc/core/download.py b/ddsc/core/download.py
index f9bf81b..545d438 100644
--- a/ddsc/core/download.py
+++ b/ddsc/core/download.py
@@ -439,6 +439,7 @@ class RetryChunkDownloader(object):
if response.status_code == 401:
raise DownloadInconsistentError(response.text)
response.raise_for_status()
+ self.actual_bytes_read = 0
self._write_response_to_file(response)
self._verify_download_complete()
|
User received TooLargeChunkDownloadError exception
User was downloading a project via `ddsclient download -p <projectname> --include <filepath>`.
Error:
```
File ".../conda/envs/bespin/lib/python3.7/site-packages/ddsc/core/download.py", line 455,
in _write_response_to_file
self._on_bytes_read(len(chunk))
File ".../conda/envs/bespin/lib/python3.7/site-packages/ddsc/core/download.py", line 464,
in _on_bytes_read
raise TooLargeChunkDownloadError(self.actual_bytes_read, self.bytes_to_read,
self.local_path)
ddsc.core.download.TooLargeChunkDownloadError:
Received too many bytes downloading part of a file.
Actual: 44159228 Expected: 32963486 File: <filename>
```
I was unable to reproduce the issue the same file downloaded fine for me.
In this place in the code we are reading from a GET request with `Range` headers delimited to the part of the file we are downloading. So we should only receive the amount we are expecting.
This exception was added to catch the unlikely case that we received more than we asked for.
|
Duke-GCB/DukeDSClient
|
diff --git a/ddsc/core/tests/test_download.py b/ddsc/core/tests/test_download.py
index 4fa9275..7535a22 100644
--- a/ddsc/core/tests/test_download.py
+++ b/ddsc/core/tests/test_download.py
@@ -541,3 +541,41 @@ class TestRetryChunkDownloader(TestCase):
with self.assertRaises(PartialChunkDownloadError):
downloader._verify_download_complete()
+
+ @patch('ddsc.core.download.RemoteFileUrl')
+ @patch('ddsc.core.download.requests')
+ def test_retry_download_loop_too_few_actual_bytes_read(self, mock_requests, mock_remote_file_url):
+ mock_requests.exceptions.ConnectionError = ValueError
+ mock_project_file = Mock()
+ mock_context = Mock()
+ downloader = RetryChunkDownloader(project_file=mock_project_file, local_path=None, seek_amt=0,
+ bytes_to_read=100, download_context=mock_context)
+ downloader.max_retry_times = 2
+ downloader.get_url_and_headers_for_range = Mock()
+ downloader.get_url_and_headers_for_range.return_value = ('someurl', ['headers'])
+ mock_requests.get.return_value.iter_content.return_value = ['X' * 10]
+ fake_open = mock_open()
+ with patch('ddsc.core.download.open', fake_open, create=True):
+ with self.assertRaises(PartialChunkDownloadError):
+ downloader.retry_download_loop()
+ self.assertEqual(downloader.actual_bytes_read, 10)
+
+ @patch('ddsc.core.download.RemoteFileUrl')
+ @patch('ddsc.core.download.requests')
+ def test_retry_download_loop_too_few_actual_bytes_read_then_works(self, mock_requests, mock_remote_file_url):
+ mock_requests.exceptions.ConnectionError = ValueError
+ mock_project_file = Mock()
+ mock_context = Mock()
+ downloader = RetryChunkDownloader(project_file=mock_project_file, local_path=None, seek_amt=0,
+ bytes_to_read=100, download_context=mock_context)
+ downloader.max_retry_times = 2
+ downloader.get_url_and_headers_for_range = Mock()
+ downloader.get_url_and_headers_for_range.return_value = ('someurl', ['headers'])
+ mock_requests.get.return_value.iter_content.side_effect = [
+ ['X' * 10], # only 10 bytes the first time
+ ['X' * 100], # all 100 bytes the second time
+ ]
+ fake_open = mock_open()
+ with patch('ddsc.core.download.open', fake_open, create=True):
+ downloader.retry_download_loop()
+ self.assertEqual(downloader.actual_bytes_read, 100)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 1
}
|
2.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"mock",
"flake8",
"nose",
"coveralls",
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
coveralls==4.0.1
docopt==0.6.2
-e git+https://github.com/Duke-GCB/DukeDSClient.git@e2cf592ba0d9b2ee1bfdf51a723677275fee3998#egg=DukeDSClient
exceptiongroup==1.2.2
flake8==7.2.0
future==0.16.0
iniconfig==2.1.0
mccabe==0.7.0
mock==5.2.0
nose==1.3.7
packaging==24.2
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.1
pytest==8.3.5
pytz==2025.2
PyYAML==3.12
requests==2.13.0
six==1.10.0
tomli==2.2.1
|
name: DukeDSClient
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- coveralls==4.0.1
- docopt==0.6.2
- exceptiongroup==1.2.2
- flake8==7.2.0
- future==0.16.0
- iniconfig==2.1.0
- mccabe==0.7.0
- mock==5.2.0
- nose==1.3.7
- packaging==24.2
- pluggy==1.5.0
- pycodestyle==2.13.0
- pyflakes==3.3.1
- pytest==8.3.5
- pytz==2025.2
- pyyaml==3.12
- requests==2.13.0
- six==1.10.0
- tomli==2.2.1
prefix: /opt/conda/envs/DukeDSClient
|
[
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_retry_download_loop_too_few_actual_bytes_read",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_retry_download_loop_too_few_actual_bytes_read_then_works"
] |
[] |
[
"ddsc/core/tests/test_download.py::TestProjectDownload::test_check_warnings",
"ddsc/core/tests/test_download.py::TestProjectDownload::test_include_project_file",
"ddsc/core/tests/test_download.py::TestProjectDownload::test_run",
"ddsc/core/tests/test_download.py::TestProjectDownload::test_run_preprocessor",
"ddsc/core/tests/test_download.py::TestDownloadSettings::test_get_data_service_auth_data",
"ddsc/core/tests/test_download.py::TestDownloadContext::test_create_data_service",
"ddsc/core/tests/test_download.py::TestDownloadContext::test_create_remote_store",
"ddsc/core/tests/test_download.py::TestDownloadContext::test_send_error_message",
"ddsc/core/tests/test_download.py::TestDownloadContext::test_send_message",
"ddsc/core/tests/test_download.py::TestDownloadContext::test_send_processed_message",
"ddsc/core/tests/test_download.py::TestFileUrlDownloader::test_check_downloaded_files_sizes",
"ddsc/core/tests/test_download.py::TestFileUrlDownloader::test_check_file_size",
"ddsc/core/tests/test_download.py::TestFileUrlDownloader::test_determine_bytes_per_chunk",
"ddsc/core/tests/test_download.py::TestFileUrlDownloader::test_download_files",
"ddsc/core/tests/test_download.py::TestFileUrlDownloader::test_make_big_empty_files",
"ddsc/core/tests/test_download.py::TestFileUrlDownloader::test_make_local_directories",
"ddsc/core/tests/test_download.py::TestFileUrlDownloader::test_make_ranges",
"ddsc/core/tests/test_download.py::TestFileUrlDownloader::test_split_file_urls_by_size",
"ddsc/core/tests/test_download.py::TestDownloadFilePartCommand::test_create_context",
"ddsc/core/tests/test_download.py::TestDownloadFilePartCommand::test_on_message_error",
"ddsc/core/tests/test_download.py::TestDownloadFilePartCommand::test_on_message_processed",
"ddsc/core/tests/test_download.py::TestDownloadFilePartRun::test_download_file_part_run",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_download_chunk_inconsistent",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_download_chunk_works",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_get_range_headers",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_get_url_and_headers_for_range",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_on_bytes_read",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_on_bytes_read_too_much",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_retry_download_loop",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_retry_download_loop_raises_when_out_of_retries",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_retry_download_loop_retries_then_works",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_run_handles_exception",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_verify_download_complete_ok",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_verify_download_complete_partial",
"ddsc/core/tests/test_download.py::TestRetryChunkDownloader::test_verify_download_complete_too_large"
] |
[] |
MIT License
| 3,294 |
[
"ddsc/core/download.py"
] |
[
"ddsc/core/download.py"
] |
|
kofferdahl__bme590hrm-25
|
110598c9b418dac359aa4d171815f5afce35c746
|
2018-10-22 15:39:54
|
110598c9b418dac359aa4d171815f5afce35c746
|
diff --git a/HRM_Processor.py b/HRM_Processor.py
index b3ed186..c4bdeda 100644
--- a/HRM_Processor.py
+++ b/HRM_Processor.py
@@ -34,6 +34,10 @@ class HRM_Processor:
"time"])
self.output_dict["duration"] = ecg_strip_duration
+ beat_start_times = self.determine_beat_start_times(
+ self.input_data["time"], self.input_data["voltage"])
+ self.output_dict["start_times"] = beat_start_times
+
def determine_voltage_extremes(self, voltage):
"""Determines the min and max values of the voltage data
@@ -71,3 +75,153 @@ class HRM_Processor:
"""
strip_duration = np.amax(time)
return strip_duration
+
+ def determine_beat_start_times(self, time, voltage):
+ """
+
+ Parameters
+ ----------
+ time: Numpy array
+ Time values read in from CSV file
+ voltage: Numpy array
+ Voltages read in from CSV file
+
+ Returns
+ -------
+ start_times: Numpy array
+ Start times of each beat (defined as the time of the
+ peak of each QRS complex)
+ """
+ threshold = self.determine_threshold(voltage)
+ inx_above_threshold = self.find_indices_above_threshold(voltage,
+ threshold)
+ beat_sep_points = self.find_beat_separation_points(inx_above_threshold)
+ qrs_peak_inx = self.find_beat_separation_points(beat_sep_points)
+ start_times = self.index_beat_start_times(time, qrs_peak_inx)
+ return start_times
+
+ def determine_threshold(self, voltage):
+ """Determines the threshold
+
+ Parameters
+ ----------
+ voltage: Numpy array
+ The voltage values from the CSV file
+
+ Returns
+ -------
+ threshold: float
+ The 'threshold' for the QRS complex, which occurs when
+ the voltage value is above 75% of its original value.
+ """
+ threshold = 0.75*np.amax(voltage)
+
+ return threshold
+
+ def find_indices_above_threshold(self, voltage, threshold):
+ """Finds the indices of the voltage array where it is above the
+ threshold value.
+
+ Parameters
+ ----------
+ voltage: Numpy array
+ The voltage values from the CSV file
+ threshold: float
+ The threshold for the QRS complex, determined by the
+ determine_threshold function.
+
+ Returns
+ -------
+ indices: Numpy array
+ The indices for which the voltage data exceeds the
+ threshold value.
+ """
+ indices = np.argwhere(voltage > threshold).flatten()
+ return indices
+
+ def find_beat_separation_points(self, indices_array):
+ """Find the separation points between beats, i.e. the points where
+ the difference between neighboring elements in the indices_array > 2
+ (which indicates areas where there was 'jump' in indices above the
+ threshold). Then, it indexes those indices in the indices_array,
+ to determine the indices in the original voltage arrays where the
+ 'end' of a beat occurs.
+
+ Parameters
+ ----------
+ indices_array: numpy array
+ The indices of the voltage array where the voltage
+ values are above the threshold values.
+
+ Returns
+ -------
+ beat_sep_inx: numpy array
+ The indices in the voltage array where there is a
+ discontinuity b/w voltage indices above the
+ threshold. So, these represent the points at which
+ the QRS complex goes below the threshold for each
+ beat (i.e. the beat separations)
+ """
+
+ diff_array = np.diff(indices_array)
+ beat_seps = np.argwhere(diff_array > 2).flatten()
+ beat_sep_inx = indices_array[beat_seps]
+ return beat_sep_inx
+
+ def find_qrs_peak_indices(self, voltage, beat_sep_inx):
+ """Indexes the voltage array during the QRS complex of each beat (
+ determined by the indices specified in beat_sep_inx), finds the max
+ value in each range, and finds the index of the peak of the QRS
+ complex.
+
+ Parameters
+ ----------
+ voltage: numpy array
+ Voltage values read in from CSV file
+ beat_sep_inx: Numpy array
+ Indices where the voltage goes below the threshold
+ value at the end of the QRS complex
+
+ Returns
+ -------
+ qrs_peak_locations numpy array
+ The locations of the peak of the QRS complex for
+ each beat
+ """
+ start_inx = 0
+ qrs_peak_locations = np.array([])
+ for beat_sep in beat_sep_inx:
+ temp = voltage[start_inx:beat_sep+1]
+ qrs_max_loc = start_inx + np.asscalar(np.where(temp == np.amax(
+ temp))[0])
+ qrs_peak_locations = np.append(qrs_peak_locations, qrs_max_loc)
+ start_inx = beat_sep
+ temp = voltage[beat_sep+1:np.alen(voltage)]
+ qrs_max_loc = start_inx + np.asscalar(np.where(temp == np.amax(
+ temp))[0])
+ qrs_peak_locations = np.append(qrs_peak_locations, qrs_max_loc)
+
+ return qrs_peak_locations
+
+ def index_beat_start_times(self, time, qrs_peak_locations):
+ """Determines the beat start times by indexing the time array at the
+ peak of each QRS complex, as determined by qrs_locations.
+
+ Parameters
+ ----------
+ time: numpy array
+ Time array read in from the CSV file.
+
+ qrs_peak_locations: numpy array
+ Contains the indices where the peak of the QRS
+ complex for each beat is located.
+
+ Returns
+ -------
+ beat_start_times numpy array
+ Contains the times where each beat starts (defined
+ as the time of the peak of the QRS complex)
+ """
+
+ beat_start_times = time[qrs_peak_locations].flatten()
+ return beat_start_times
|
The HRM_Processor needs to determine the times at which the beats occurred.
The HRM_Processor needs to be able to determine the times at which the beats occurred. For the initial implementation of this functionality, this will be based on a thresholding operation - a beat will be defined by the time of the maximum value when the voltage has exceeded a certain threshold. This feature will consist of multiple functions, roughly as follows:
- [x] - Calculate threshold = 75% of the maximum value (roughly, the precise % is subject to change)
- [x] - Find the indices associated with the voltage array exceeding that threshold value.
- [x] - Segment the indices into continuous sections (i.e. find ranges where the indices are consecutive or almost consecutive, followed by an instance where there is a large separation between indices). The point at which there is a large separation between indices represents the beginning of a new segment
- [x] - Find the index of the maximum voltage values for each segment.
- [x] - Index the time array at the point of the maximum voltage values, which is the "start time" of a beat.
|
kofferdahl/bme590hrm
|
diff --git a/test_HRM_Processor.py b/test_HRM_Processor.py
index ef1ec7e..951fb0f 100644
--- a/test_HRM_Processor.py
+++ b/test_HRM_Processor.py
@@ -18,10 +18,23 @@ def test_HRM_Processor_init(dr):
"""
hrm_proc = HRM_Processor(dr)
+ print(hrm_proc.input_data)
assert dr.output_dict == hrm_proc.input_data
def test_voltage_extremes(hrm):
+ """Tests the determine_voltage_extremes function to ensure that it
+ returns the max and minimum of a voltage numpy array as a tuple in the
+ form (max, min)
+
+ Parameters
+ ----------
+ hrm: A basic HRM_Processor object
+
+ Returns
+ -------
+ None
+ """
voltage = np.array([-1.502, -7.9, 3.5, 2.1, 8.7, 4.0])
@@ -31,11 +44,35 @@ def test_voltage_extremes(hrm):
def test_write_outputs_to_dict_voltage_extremes(hrm):
+ """Tests that the voltage extremes was written to the output_dict of the
+ HRM_Processor object from the voltage data. The comparision is to the
+ 'voltage' extremes of test_file.csv
+
+ Parameters
+ ----------
+ hrm: Basic HRM_Processor object made from test_file.csv
+
+ Returns
+ -------
+ None
+ """
assert hrm.output_dict["voltage_extremes"] == (10.0, 20.0)
def test_determine_ecg_strip_duration(hrm):
+ """Checks that the determine_ecg_strip duration function the max value
+ of the time numpy array that it is given.
+
+ Parameters
+ ----------
+ hrm: HRM_Processor
+ Basic HRM_Processor object made from test_file.csv
+
+ Returns
+ -------
+ None
+ """
time = np.array([0, 2.2, 5, 7.5])
strip_duration = hrm.determine_ecg_strip_duration(time)
@@ -44,5 +81,125 @@ def test_determine_ecg_strip_duration(hrm):
def test_write_strip_duration(hrm):
+ """Tests that the max value of the time numpy array was written to the
+ "duration" entry of the output_dict upon construction of hrm. The max
+ time value in test_file.csv is 2.
+
+ Parameters
+ ----------
+ hrm: HRM_Processor
+ Basic HRM_Processor object created from test_file.csv
+
+ Returns
+ -------
+ None
+ """
assert hrm.output_dict["duration"] == 2
+
+
+def test_determine_threshold(hrm):
+ """Checks that the determine_threshold function returns 90% of the
+ highest value in a numpy array
+
+ Parameters
+ ----------
+ hrm: HRM_Processor
+ Basic HRM_Processor object created from test_file.csv
+ Returns
+ -------
+ None
+ """
+
+ voltage = np.array([1, 2, 4, 10, 5])
+ threshold = hrm.determine_threshold(voltage)
+ assert threshold == 7.5
+
+
+def test_find_indices_above_threshold(hrm):
+ """Tests that the find_indices_above_threshold function finds the
+ indices where the voltage numpy array are above a specified threshold.
+
+ Parameters
+ ----------
+ hrm: HRM_Processor
+ Basic HRM_Processor object created from test_file.csv
+
+ Returns
+ -------
+ None
+ """
+
+ threshold = 5
+ voltage = np.array([1, 6, 4, 5, 2, 9.7])
+
+ expected_indices = np.array([1, 5])
+ calculated_indices = hrm.find_indices_above_threshold(voltage, threshold)
+
+ assert np.array_equal(calculated_indices, expected_indices)
+
+
+def test_find_beat_separation_points(hrm):
+ """Tests the find_beat_separation_points function, which finds indices
+ in an array of indices where there is a separation between consecutive
+ indices greater than 2 (indicating the likely start of a new beat/QRS
+ complex).
+
+ Parameters
+ ----------
+ hrm: HRM_Processor
+ Generic HRM_Processor created from test_file.csv
+
+ Returns
+ -------
+
+ """
+ indices = np.array([1, 2, 3, 4, 5, 10, 11, 12, 14, 30, 31, 32, 40, 41])
+ expected_sep_inx = np.array([5, 14, 32])
+ measured_sep_inx = hrm.find_beat_separation_points(indices)
+
+ assert np.array_equal(measured_sep_inx, expected_sep_inx)
+
+
+def test_find_qrs_peak_indices(hrm):
+ """Tests the find_qrs_peak_indices function, which should be able to
+ find the maximum value in a voltage array within a range specified by
+ the beat_sep_inx array.
+
+ Parameters
+ ----------
+ hrm: HRM_Processor
+ A basic HRM_Processor object made from input_file.csv
+
+ Returns
+ -------
+ None
+ """
+ beat_sep_inx = np.array([3, 5, 10])
+ voltage = np.array([0, 1, 6, 8, 12, 10, 18, 4, 29, 1, 8, 3, 5, 6])
+ expected_beat_max = np.array([3, 4, 8, 12])
+ measured_beat_max = hrm.find_qrs_peak_indices(voltage, beat_sep_inx)
+
+ assert np.array_equal(expected_beat_max, measured_beat_max)
+
+
+def test_index_beat_start_times(hrm):
+ """Tests index_beat_start_times, which finds the start times of a beat
+ in a numpy array based on indices specified by the qrs_peak_locations
+ array.
+
+ Parameters
+ ----------
+ hrm: HRM_Processor
+ A basic HRM_Processor created from test_file.csv
+
+ Returns
+ -------
+ None
+ """
+ qrs_peak_locations = np.array([0, 3, 6, 8])
+ time = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
+ expected_start_times = np.array([1, 4, 7, 9])
+ measured_start_times = hrm.index_beat_start_times(time, qrs_peak_locations)
+
+ assert np.array_equal(expected_start_times, measured_start_times)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 1
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -r requirements.txt",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
numpy==2.0.2
packaging==24.2
pep8==1.7.1
pluggy==1.5.0
pytest==8.3.5
pytest-cache==1.0
pytest-cov==6.0.0
pytest-pep8==1.0.6
tomli==2.2.1
|
name: bme590hrm
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- numpy==2.0.2
- packaging==24.2
- pep8==1.7.1
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cache==1.0
- pytest-cov==6.0.0
- pytest-pep8==1.0.6
- tomli==2.2.1
prefix: /opt/conda/envs/bme590hrm
|
[
"test_HRM_Processor.py::test_determine_threshold",
"test_HRM_Processor.py::test_find_indices_above_threshold",
"test_HRM_Processor.py::test_find_beat_separation_points",
"test_HRM_Processor.py::test_index_beat_start_times"
] |
[
"test_HRM_Processor.py::test_find_qrs_peak_indices"
] |
[
"test_HRM_Processor.py::test_HRM_Processor_init",
"test_HRM_Processor.py::test_voltage_extremes",
"test_HRM_Processor.py::test_write_outputs_to_dict_voltage_extremes",
"test_HRM_Processor.py::test_determine_ecg_strip_duration",
"test_HRM_Processor.py::test_write_strip_duration"
] |
[] | null | 3,295 |
[
"HRM_Processor.py"
] |
[
"HRM_Processor.py"
] |
|
Yelp__py_zipkin-107
|
2f18c3f2bdbce87d929bead1c555f3404e9371af
|
2018-10-22 15:50:14
|
2f18c3f2bdbce87d929bead1c555f3404e9371af
|
diff --git a/py_zipkin/logging_helper.py b/py_zipkin/logging_helper.py
index 029fd8f..8fb8b64 100644
--- a/py_zipkin/logging_helper.py
+++ b/py_zipkin/logging_helper.py
@@ -174,10 +174,10 @@ class ZipkinBatchSender(object):
is_over_size_limit = (
self.max_payload_bytes is not None and
not self.encoder.fits(
- self.queue,
- self.current_size,
- self.max_payload_bytes,
- encoded_span,
+ current_count=len(self.queue),
+ current_size=self.current_size,
+ max_size=self.max_payload_bytes,
+ new_span=encoded_span,
)
)
is_over_portion_limit = len(self.queue) >= self.max_portion_size
|
Error while encoding Json (_BaseJSONEncoder)
I'm trying to use Encoding.V2_JSON \ Encoding.V1_JSON but I'm receiving an exception:
```Traceback (most recent call last):
File "/home/dmytro/anaconda3/lib/python3.6/site-packages/py_zipkin/logging_helper.py", line 129, in _emit_spans_with_span_sender
report_timestamp=self.report_root_timestamp,
File "/home/dmytro/anaconda3/lib/python3.6/site-packages/py_zipkin/logging_helper.py", line 180, in add_span
encoded_span,
File "/home/dmytro/anaconda3/lib/python3.6/site-packages/py_zipkin/encoding/_encoders.py", line 141, in fits
return 2 + current_count + current_size + len(new_span) <= max_size
TypeError: unsupported operand type(s) for +: 'int' and 'list'
```
I use master branch, there is a similar exception for 0.14.1 (I switched to master hoping that the issue was fixed in master):
```Traceback (most recent call last):
File "/home/dmytro/anaconda3/lib/python3.6/site-packages/py_zipkin/logging_helper.py", line 129, in _emit_spans_with_span_sender
report_timestamp=self.report_root_timestamp,
File "/home/dmytro/anaconda3/lib/python3.6/site-packages/py_zipkin/logging_helper.py", line 180, in add_span
encoded_span,
File "/home/dmytro/anaconda3/lib/python3.6/site-packages/py_zipkin/_encoding_helpers.py", line 343, in fits
return 2 + current_count + current_size + len(new_span) <= max_size
TypeError: unsupported operand type(s) for +: 'int' and 'list'
```
I tried to debug a little: it seems `_BaseJSONEncoder.fits` expects an integer as the first argument but in `ZipkinBatchSender.add_span` we pass `self.queue` that is in fact a list
|
Yelp/py_zipkin
|
diff --git a/tests/conftest.py b/tests/conftest.py
index f3a1841..7f7b7e4 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,5 +1,6 @@
import mock
import pytest
+import six
from py_zipkin.encoding._encoders import IEncoder
from py_zipkin.transport import BaseTransportHandler
@@ -46,8 +47,15 @@ class MockTransportHandler(BaseTransportHandler):
class MockEncoder(IEncoder):
def __init__(self, fits=True, encoded_span='', encoded_queue=''):
- self.fits = mock.Mock(return_value=fits)
+ self.fits_bool = fits
self.encode_span = mock.Mock(
return_value=(encoded_span, len(encoded_span)),
)
self.encode_queue = mock.Mock(return_value=encoded_queue)
+
+ def fits(self, current_count, current_size, max_size, new_span):
+ assert isinstance(current_count, int)
+ assert isinstance(current_size, int)
+ assert isinstance(max_size, int)
+ assert isinstance(new_span, six.string_types)
+ return self.fits_bool
diff --git a/tests/integration/encoding_test.py b/tests/integration/encoding_test.py
index 44454fb..588c8c7 100644
--- a/tests/integration/encoding_test.py
+++ b/tests/integration/encoding_test.py
@@ -16,15 +16,7 @@ from py_zipkin.thrift import zipkin_core
from py_zipkin import thrift
from py_zipkin.util import generate_random_64bit_string
from py_zipkin.zipkin import ZipkinAttrs
-
-
-def mock_logger():
- mock_logs = []
-
- def mock_transport_handler(message):
- mock_logs.append(message)
-
- return mock_transport_handler, mock_logs
+from tests.conftest import MockTransportHandler
def _decode_binary_thrift_objs(obj):
@@ -243,7 +235,7 @@ def test_encoding(encoding, validate_fn):
flags=None,
)
inner_span_id = generate_random_64bit_string()
- mock_transport_handler, mock_logs = mock_logger()
+ mock_transport_handler = MockTransportHandler(10000)
# Let's hardcode the timestamp rather than call time.time() every time.
# The issue with time.time() is that the convertion to int of the
# returned float value * 1000000 is not precise and in the same test
@@ -284,4 +276,5 @@ def test_encoding(encoding, validate_fn):
'2001:0db8:85a3:0000:0000:8a2e:0370:7334',
)
- validate_fn(mock_logs[0], zipkin_attrs, inner_span_id, ts)
+ output = mock_transport_handler.get_payloads()[0]
+ validate_fn(output, zipkin_attrs, inner_span_id, ts)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
0.14
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-benchmark[histogram]"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements-dev.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
importlib-metadata==4.8.3
iniconfig==1.1.1
mock==5.2.0
ordereddict==1.1
packaging==21.3
pluggy==1.0.0
ply==3.11
py==1.11.0
py-cpuinfo==9.0.0
-e git+https://github.com/Yelp/py_zipkin.git@2f18c3f2bdbce87d929bead1c555f3404e9371af#egg=py_zipkin
pygal==3.0.1
pygaljs==1.0.2
pyparsing==3.1.4
pytest==7.0.1
pytest-benchmark==3.4.1
six==1.17.0
thriftpy==0.3.9
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0
|
name: py_zipkin
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- coverage==6.2
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- mock==5.2.0
- ordereddict==1.1
- packaging==21.3
- pluggy==1.0.0
- ply==3.11
- py==1.11.0
- py-cpuinfo==9.0.0
- pygal==3.0.1
- pygaljs==1.0.2
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-benchmark==3.4.1
- six==1.17.0
- thriftpy==0.3.9
- tomli==1.2.3
- typing-extensions==4.1.1
- zipp==3.6.0
prefix: /opt/conda/envs/py_zipkin
|
[
"tests/integration/encoding_test.py::test_encoding[Encoding.V1_JSON-check_v1_json]",
"tests/integration/encoding_test.py::test_encoding[Encoding.V2_JSON-check_v2_json]"
] |
[] |
[
"tests/integration/encoding_test.py::test_encoding[Encoding.V1_THRIFT-check_v1_thrift]"
] |
[] |
Apache License 2.0
| 3,296 |
[
"py_zipkin/logging_helper.py"
] |
[
"py_zipkin/logging_helper.py"
] |
|
Roguelazer__muttdown-14
|
61809de9a445bda848d4933822070e0dd705c192
|
2018-10-22 16:11:11
|
a8d8b954fa0dcc51a215df36041c2d330d7f1c19
|
diff --git a/muttdown/config.py b/muttdown/config.py
index 236d16f..a09e9c7 100644
--- a/muttdown/config.py
+++ b/muttdown/config.py
@@ -80,6 +80,7 @@ class Config(object):
if self._config['smtp_password'] and self._config['smtp_password_command']:
raise ConfigError('Cannot set smtp_password *and* smtp_password_command')
if self._config['css_file']:
+ self._css = None
self._config['css_file'] = os.path.expanduser(self._config['css_file'])
if not os.path.exists(self._config['css_file']):
raise ConfigError('CSS file %s does not exist' % self._config['css_file'])
@@ -101,6 +102,6 @@ class Config(object):
@property
def smtp_password(self):
if self._config['smtp_password_command']:
- return check_output(self._config['smtp_password_command'], shell=True).rstrip('\n')
+ return check_output(self._config['smtp_password_command'], shell=True, universal_newlines=True).rstrip('\n')
else:
return self._config['smtp_password']
|
Error when trying to run gpg command as smtp_password_command
Hello, I've just switched machines and have been setting things up as I usually have them. I seem to be having an issue with the `smtp_password_command` parameter. My yaml file looks like this:
```yaml
smtp_host: smtp.gmail.com
smtp_port: 465
smtp_ssl: true
smtp_username: [email protected]
smtp_password_command: gpg -d --no-tty /home/jacklenox/.passwd/gmail.gpg
```
But when I try to send an email, I get the following error.
```
Traceback (most recent call last):
File "/home/jacklenox/.local/bin/muttdown", line 11, in <module>
sys.exit(main())
File "/home/jacklenox/.local/lib/python3.6/site-packages/muttdown/main.py",
line 169, in main
conn = smtp_connection(c)
File "/home/jacklenox/.local/lib/python3.6/site-packages/muttdown/main.py",
line 120, in smtp_connection
conn.login(c.smtp_username, c.smtp_password)
File "/home/jacklenox/.local/lib/python3.6/site-packages/muttdown/config.py",
line 104, in smtp_password
return check_output(self._config['smtp_password_command'],
shell=True).rstrip('\n')
TypeError: a bytes-like object is required, not 'str'
```
If I replace `smtp_password_command` with the decrypted `smtp_password`, everything works fine. And if I try to run the GPG command on its own, equally everything works.
Any thoughts?
|
Roguelazer/muttdown
|
diff --git a/tests/test_basic.py b/tests/test_basic.py
index 7f69017..1eb2df9 100644
--- a/tests/test_basic.py
+++ b/tests/test_basic.py
@@ -1,6 +1,8 @@
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.message import Message
+import tempfile
+import shutil
import pytest
@@ -15,11 +17,21 @@ def basic_config():
@pytest.fixture
-def config_with_css(tmpdir):
- with open('%s/test.css' % tmpdir, 'w') as f:
+def tempdir():
+ # workaround because pytest's bultin tmpdir fixture is broken on python 3.3
+ dirname = tempfile.mkdtemp()
+ try:
+ yield dirname
+ finally:
+ shutil.rmtree(dirname)
+
+
[email protected]
+def config_with_css(tempdir):
+ with open('%s/test.css' % tempdir, 'w') as f:
f.write('html, body, p { font-family: serif; }\n')
c = Config()
- c.merge_config({'css_file': '%s/test.css' % tmpdir})
+ c.merge_config({'css_file': '%s/test.css' % tempdir})
return c
diff --git a/tests/test_config.py b/tests/test_config.py
new file mode 100644
index 0000000..f5a040b
--- /dev/null
+++ b/tests/test_config.py
@@ -0,0 +1,27 @@
+import tempfile
+
+from muttdown.config import Config
+
+
+def test_smtp_password_literal():
+ c = Config()
+ c.merge_config({'smtp_password': 'foo'})
+ assert c.smtp_password == 'foo'
+
+
+def test_smtp_password_command():
+ c = Config()
+ c.merge_config({'smtp_password_command': 'sh -c "echo foo"'})
+ assert c.smtp_password == 'foo'
+
+
+def test_css():
+ c = Config()
+ c.merge_config({'css_file': None})
+ assert c.css == ''
+
+ with tempfile.NamedTemporaryFile(delete=True) as css_file:
+ css_file.write(b'html { background-color: black; }\n')
+ css_file.flush()
+ c.merge_config({'css_file': css_file.name})
+ assert c.css == 'html { background-color: black; }\n'
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
0.3
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"markdown",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
beautifulsoup4==4.13.3
cssutils==2.11.1
exceptiongroup==1.2.2
importlib_metadata==8.6.1
iniconfig==2.1.0
Markdown==3.7
more-itertools==10.6.0
-e git+https://github.com/Roguelazer/muttdown.git@61809de9a445bda848d4933822070e0dd705c192#egg=muttdown
packaging==24.2
pluggy==1.5.0
pynliner==0.8.0
pytest==8.3.5
PyYAML==6.0.2
six==1.17.0
soupsieve==2.6
tomli==2.2.1
typing_extensions==4.13.0
zipp==3.21.0
|
name: muttdown
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- beautifulsoup4==4.13.3
- cssutils==2.11.1
- exceptiongroup==1.2.2
- importlib-metadata==8.6.1
- iniconfig==2.1.0
- markdown==3.7
- more-itertools==10.6.0
- packaging==24.2
- pluggy==1.5.0
- pynliner==0.8.0
- pytest==8.3.5
- pyyaml==6.0.2
- six==1.17.0
- soupsieve==2.6
- tomli==2.2.1
- typing-extensions==4.13.0
- zipp==3.21.0
prefix: /opt/conda/envs/muttdown
|
[
"tests/test_config.py::test_smtp_password_command",
"tests/test_config.py::test_css"
] |
[] |
[
"tests/test_basic.py::test_unmodified_no_match",
"tests/test_basic.py::test_simple_message",
"tests/test_basic.py::test_with_css",
"tests/test_config.py::test_smtp_password_literal"
] |
[] |
ISC License
| 3,297 |
[
"muttdown/config.py"
] |
[
"muttdown/config.py"
] |
|
kofferdahl__bme590hrm-34
|
980ebd48ffc09f11020623a8d037d103af5afbae
|
2018-10-22 17:45:31
|
980ebd48ffc09f11020623a8d037d103af5afbae
|
diff --git a/HRM_Processor.py b/HRM_Processor.py
index c4bdeda..a195f4f 100644
--- a/HRM_Processor.py
+++ b/HRM_Processor.py
@@ -38,6 +38,9 @@ class HRM_Processor:
self.input_data["time"], self.input_data["voltage"])
self.output_dict["start_times"] = beat_start_times
+ num_beats = self.determine_num_beats(beat_start_times)
+ self.output_dict["num_beats"] = num_beats
+
def determine_voltage_extremes(self, voltage):
"""Determines the min and max values of the voltage data
@@ -225,3 +228,21 @@ class HRM_Processor:
beat_start_times = time[qrs_peak_locations].flatten()
return beat_start_times
+
+ def determine_num_beats(self, beat_start_times):
+ """Determines the number of beats that occurred based on the number
+ of elements in the beat_start_times array
+
+ Parameters
+ ----------
+ beat_start_times: numpy array
+ A numpy array containing the start times (time
+ of the peak of each QRS complex) fo reach beat
+
+ Returns
+ -------
+ num_beats int
+ The number of beats
+ """
+ num_beats = np.size(beat_start_times)
+ return num_beats
|
The HRM_Processor needs to determine the BPM
The HRM_Processor should be able to write the mean BPM calculated either during a user specified duration or the default duration.
Input: Array of beat start times, duration of interest as a tuple.
Output: mean BPM, rounded to the nearest int
Basic steps:
- Access the duration of interest
- Find the first index where the start times array exceeds the beginning of the start time of the duration of interest
- Find the index where the start time array exceeds the end time of the duration of interest
- Find the number of beats = the difference between those two indices
- Calculate the duration in seconds (= difference between them), convert to minutes
- BPM = number of beats / duration in minutes
** It may end up being best to split this into multiple functions.
|
kofferdahl/bme590hrm
|
diff --git a/test_HRM_Processor.py b/test_HRM_Processor.py
index 951fb0f..7c46b58 100644
--- a/test_HRM_Processor.py
+++ b/test_HRM_Processor.py
@@ -203,3 +203,15 @@ def test_index_beat_start_times(hrm):
measured_start_times = hrm.index_beat_start_times(time, qrs_peak_locations)
assert np.array_equal(expected_start_times, measured_start_times)
+
+
+def test_determine_num_beats(hrm):
+ """Tests the most basic functionality of the determine_num_beats
+ function, which simply returns the length of the start_times array that
+ has been passed into it."""
+
+ start_times = np.array([1, 2, 3, 4])
+ expected_num_beats = 4
+ measured_num_beats = hrm.determine_num_beats(start_times)
+
+ assert expected_num_beats == measured_num_beats
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 0,
"test_score": 0
},
"num_modified_files": 1
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -r requirements.txt",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
numpy==2.0.2
packaging==24.2
pep8==1.7.1
pluggy==1.5.0
pytest==8.3.5
pytest-cache==1.0
pytest-cov==6.0.0
pytest-pep8==1.0.6
tomli==2.2.1
|
name: bme590hrm
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- numpy==2.0.2
- packaging==24.2
- pep8==1.7.1
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cache==1.0
- pytest-cov==6.0.0
- pytest-pep8==1.0.6
- tomli==2.2.1
prefix: /opt/conda/envs/bme590hrm
|
[
"test_HRM_Processor.py::test_determine_num_beats"
] |
[
"test_HRM_Processor.py::test_find_qrs_peak_indices"
] |
[
"test_HRM_Processor.py::test_HRM_Processor_init",
"test_HRM_Processor.py::test_voltage_extremes",
"test_HRM_Processor.py::test_write_outputs_to_dict_voltage_extremes",
"test_HRM_Processor.py::test_determine_ecg_strip_duration",
"test_HRM_Processor.py::test_write_strip_duration",
"test_HRM_Processor.py::test_determine_threshold",
"test_HRM_Processor.py::test_find_indices_above_threshold",
"test_HRM_Processor.py::test_find_beat_separation_points",
"test_HRM_Processor.py::test_index_beat_start_times"
] |
[] | null | 3,298 |
[
"HRM_Processor.py"
] |
[
"HRM_Processor.py"
] |
|
kofferdahl__bme590hrm-35
|
f57c4d8cb4d263603ffdbde28b115e2cd114b09b
|
2018-10-22 18:18:47
|
f57c4d8cb4d263603ffdbde28b115e2cd114b09b
|
diff --git a/DataReader.py b/DataReader.py
index 6b08776..1842b8c 100644
--- a/DataReader.py
+++ b/DataReader.py
@@ -119,7 +119,7 @@ class DataReader:
Parameters
----------
- time_array: numpy array of time values (from CSV file, or directly
+ time_array: numpy array of time values (from CSV file or directly
inserted for testing cases.
duration: tuple specifying the min and max times defining the
duration of interest, specified by user.
diff --git a/HRM_Processor.py b/HRM_Processor.py
index a195f4f..ba0451c 100644
--- a/HRM_Processor.py
+++ b/HRM_Processor.py
@@ -39,7 +39,14 @@ class HRM_Processor:
self.output_dict["start_times"] = beat_start_times
num_beats = self.determine_num_beats(beat_start_times)
- self.output_dict["num_beats"] = num_beats
+ self.output_dict["beats"] = num_beats
+
+ try:
+ mean_hr_bpm = self.determine_bpm(beat_start_times, self.input_data[
+ "duration"])
+ self.output_dict["mean_hr_bpm"] = mean_hr_bpm
+ except ValueError:
+ print("Invalid duration (no beats in that duration)")
def determine_voltage_extremes(self, voltage):
"""Determines the min and max values of the voltage data
@@ -246,3 +253,16 @@ class HRM_Processor:
"""
num_beats = np.size(beat_start_times)
return num_beats
+
+ def determine_bpm(self, beat_start_times, duration):
+ start_inx = np.argmax(beat_start_times >= duration[0])
+ end_inx = np.argmax(beat_start_times >= duration[1])
+
+ num_beats_in_duration = end_inx - start_inx
+ time_in_seconds = duration[1] - duration[0]
+ if time_in_seconds == 0:
+ raise ValueError
+ time_in_minutes = time_in_seconds / 60
+
+ mean_hr_bpm = num_beats_in_duration / time_in_minutes
+ return mean_hr_bpm
|
The HRM_Processor needs to determine the number of beats.
The HRM_Processor needs to determine the number of beats that occurred in the ecg strip. This value will be written to the output dictionary.
Input: numpy array containing start times of beats
Output: the length of that numpy array
|
kofferdahl/bme590hrm
|
diff --git a/test_HRM_Processor.py b/test_HRM_Processor.py
index 7c46b58..01d5b90 100644
--- a/test_HRM_Processor.py
+++ b/test_HRM_Processor.py
@@ -215,3 +215,14 @@ def test_determine_num_beats(hrm):
measured_num_beats = hrm.determine_num_beats(start_times)
assert expected_num_beats == measured_num_beats
+
+
+def test_determine_bpm(hrm):
+
+ start_times = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
+ duration = (3, 7)
+
+ expected_bpm = 60
+ calculated_bpm = hrm.determine_bpm(start_times, duration)
+
+ assert expected_bpm == calculated_bpm
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_many_modified_files"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 1,
"test_score": 2
},
"num_modified_files": 2
}
|
unknown
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -r requirements.txt",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
coverage==7.8.0
exceptiongroup==1.2.2
execnet==2.1.1
iniconfig==2.1.0
numpy==2.0.2
packaging==24.2
pep8==1.7.1
pluggy==1.5.0
pytest==8.3.5
pytest-cache==1.0
pytest-cov==6.0.0
pytest-pep8==1.0.6
tomli==2.2.1
|
name: bme590hrm
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- coverage==7.8.0
- exceptiongroup==1.2.2
- execnet==2.1.1
- iniconfig==2.1.0
- numpy==2.0.2
- packaging==24.2
- pep8==1.7.1
- pluggy==1.5.0
- pytest==8.3.5
- pytest-cache==1.0
- pytest-cov==6.0.0
- pytest-pep8==1.0.6
- tomli==2.2.1
prefix: /opt/conda/envs/bme590hrm
|
[
"test_HRM_Processor.py::test_determine_bpm"
] |
[
"test_HRM_Processor.py::test_find_qrs_peak_indices"
] |
[
"test_HRM_Processor.py::test_HRM_Processor_init",
"test_HRM_Processor.py::test_voltage_extremes",
"test_HRM_Processor.py::test_write_outputs_to_dict_voltage_extremes",
"test_HRM_Processor.py::test_determine_ecg_strip_duration",
"test_HRM_Processor.py::test_write_strip_duration",
"test_HRM_Processor.py::test_determine_threshold",
"test_HRM_Processor.py::test_find_indices_above_threshold",
"test_HRM_Processor.py::test_find_beat_separation_points",
"test_HRM_Processor.py::test_index_beat_start_times",
"test_HRM_Processor.py::test_determine_num_beats"
] |
[] | null | 3,299 |
[
"HRM_Processor.py",
"DataReader.py"
] |
[
"HRM_Processor.py",
"DataReader.py"
] |
|
pydata__sparse-204
|
87f414c0e63c3c3213225d2db0d354ea51b4f3f2
|
2018-10-22 19:15:12
|
e46a2a734dce1b25a775641f744cbcbea1a15910
|
gongliyu: Sure, I will add some test cases. Do I need to close this PR and open another one after I add the tests in my forked repo? Does pydata/sparse contains a script to run the tests before push to remote repo? I'm sorry I'm very new to the github PR feature. I will really appreciate it if you can help me on this.
Thanks!
hameerabbasi: Hi! Like you, I was also very new a year or so ago! I'd like to personally thank (and congratulate) you for doing this.
Usually it's recommended to push your changes to a branch and keep your `master` branch sync'd to the main branch, but for this PR it's okay.
If you push changes to your branch, this PR will be automatically updated.
hameerabbasi: To run the tests, you can run `pip install -e .[all]` in the root of the repository and then run `py.test` there. It will run all tests for you, including for code style.
hameerabbasi: This pull request **introduces 1 alert** when merging 99c15a904a743501baf5b8ce51a122855d6df8c8 into 87f414c0e63c3c3213225d2db0d354ea51b4f3f2 - [view on LGTM.com](https://lgtm.com/projects/g/pydata/sparse/rev/pr-e46ffd4c0a5c90ec43636e43a8d714a5e6e3cbbb)
**new alerts:**
* 1 for Syntax error
---
*Comment posted by [LGTM.com](https://lgtm.com)*
gongliyu: I realized that np.dot and np.matmul are different for some cases,
https://docs.scipy.org/doc/numpy-1.15.1/reference/generated/numpy.matmul.html
So I add a function: common.matmul with some tests, and redirect COO.__matmul__ to common.matmul.
hameerabbasi: This pull request **introduces 1 alert** when merging 6fe10d51e7020fdfffe7bfde8d8fc27f5d05de14 into 87f414c0e63c3c3213225d2db0d354ea51b4f3f2 - [view on LGTM.com](https://lgtm.com/projects/g/pydata/sparse/rev/pr-893a662ddb8f544d20edc38c907cd7f91ce336af)
**new alerts:**
* 1 for Syntax error
---
*Comment posted by [LGTM.com](https://lgtm.com)*
gongliyu: I tried to read the report and improve it. If it still can not pass the coverage test, please help me add some test cases.
hameerabbasi: Sure thing! You will need to do one more thing, add docs for `matmul`. You need to edit the file `docs/generated/sparse.rst` and add `matmul` (everything is in alphabetical order). Then run `sphinx-build -W -b html . _build/html` while in the `docs/` directory.
|
diff --git a/docs/generated/sparse.matmul.rst b/docs/generated/sparse.matmul.rst
new file mode 100644
index 0000000..4db8012
--- /dev/null
+++ b/docs/generated/sparse.matmul.rst
@@ -0,0 +1,6 @@
+matmul
+======
+
+.. currentmodule:: sparse
+
+.. autofunction:: matmul
\ No newline at end of file
diff --git a/docs/generated/sparse.rst b/docs/generated/sparse.rst
index 9551e5a..1d78385 100644
--- a/docs/generated/sparse.rst
+++ b/docs/generated/sparse.rst
@@ -41,6 +41,8 @@ API
load_npz
+ matmul
+
nanmax
nanmean
diff --git a/sparse/coo/__init__.py b/sparse/coo/__init__.py
index 0d4ef10..b4ea805 100644
--- a/sparse/coo/__init__.py
+++ b/sparse/coo/__init__.py
@@ -1,6 +1,6 @@
from .core import COO, as_coo
from .umath import elemwise
-from .common import (tensordot, dot, concatenate, stack, triu, tril, where,
+from .common import (tensordot, dot, matmul, concatenate, stack, triu, tril, where,
nansum, nanmean, nanprod, nanmin, nanmax, nanreduce, roll,
eye, full, full_like, zeros, zeros_like, ones, ones_like,
kron)
diff --git a/sparse/coo/common.py b/sparse/coo/common.py
index c6d022d..0187c9a 100644
--- a/sparse/coo/common.py
+++ b/sparse/coo/common.py
@@ -86,6 +86,11 @@ def tensordot(a, b, axes=2):
from .core import COO
check_zero_fill_value(a, b)
+ if scipy.sparse.issparse(a):
+ a = asCOO(a)
+ if scipy.sparse.issparse(b):
+ b = asCOO(b)
+
try:
iter(axes)
except TypeError:
@@ -154,6 +159,76 @@ def tensordot(a, b, axes=2):
return res.reshape(olda + oldb)
+def matmul(a, b):
+ """Perform the equivalent of :obj:`numpy.matmul` on two arrays.
+
+ Parameters
+ ----------
+ a, b : Union[COO, np.ndarray, scipy.sparse.spmatrix]
+ The arrays to perform the :code:`matmul` operation on.
+
+ Returns
+ -------
+ Union[COO, numpy.ndarray]
+ The result of the operation.
+
+ Raises
+ ------
+ ValueError
+ If all arguments don't have zero fill-values, or the shape of the two arrays is not broadcastable.
+
+ See Also
+ --------
+ numpy.matmul : NumPy equivalent function.
+ COO.__matmul__ : Equivalent function for COO objects.
+ """
+ check_zero_fill_value(a, b)
+ if not hasattr(a, 'ndim') or not hasattr(b, 'ndim'):
+ raise TypeError(
+ "Cannot perform dot product on types %s, %s" %
+ (type(a), type(b)))
+
+ # When one of the input is less than 2-d, it is equivalent to dot
+ if a.ndim <= 2 or b.ndim <= 2:
+ return dot(a, b)
+
+ # If a can be squeeze to a vector, use dot will be faster
+ if a.ndim <= b.ndim and np.prod(a.shape[:-1]) == 1:
+ res = dot(a.reshape(-1), b)
+ shape = list(res.shape)
+ shape.insert(-1, 1)
+ return res.reshape(shape)
+
+ # If b can be squeeze to a matrix, use dot will be faster
+ if b.ndim <= a.ndim and np.prod(b.shape[:-2]) == 1:
+ return dot(a, b.reshape(b.shape[-2:]))
+
+ if a.ndim < b.ndim:
+ a = a[(None,) * (b.ndim - a.ndim)]
+ if a.ndim > b.ndim:
+ b = b[(None,) * (a.ndim - b.ndim)]
+ for i, j in zip(a.shape[:-2], b.shape[:-2]):
+ if i != 1 and j != 1 and i != j:
+ raise ValueError('shapes of a and b are not broadcastable')
+
+ def _matmul_recurser(a, b):
+ if a.ndim == 2:
+ return dot(a, b)
+ res = []
+ for i in range(max(a.shape[0], b.shape[0])):
+ a_i = a[0] if a.shape[0] == 1 else a[i]
+ b_i = b[0] if b.shape[0] == 1 else b[i]
+ res.append(_matmul_recurser(a_i, b_i))
+ mask = [isinstance(x, SparseArray) for x in res]
+ if all(mask):
+ return stack(res)
+ else:
+ res = [x.todense() if isinstance(x, SparseArray) else x
+ for x in res]
+ return np.stack(res)
+ return _matmul_recurser(a, b)
+
+
def dot(a, b):
"""
Perform the equivalent of :obj:`numpy.dot` on two arrays.
@@ -192,7 +267,6 @@ def dot(a, b):
if b.ndim == 1:
b_axis = -1
-
return tensordot(a, b, axes=(a_axis, b_axis))
@@ -201,11 +275,13 @@ def _dot(a, b):
if isinstance(b, COO) and not isinstance(a, COO):
return _dot(b.T, a.T).T
- aa = a.tocsr()
+
+ if isinstance(a, (COO, scipy.sparse.spmatrix)):
+ a = a.tocsr()
if isinstance(b, (COO, scipy.sparse.spmatrix)):
b = b.tocsc()
- return aa.dot(b)
+ return a.dot(b)
def kron(a, b):
diff --git a/sparse/coo/core.py b/sparse/coo/core.py
index de0524a..9b97029 100644
--- a/sparse/coo/core.py
+++ b/sparse/coo/core.py
@@ -7,7 +7,7 @@ import numpy as np
import scipy.sparse
from numpy.lib.mixins import NDArrayOperatorsMixin
-from .common import dot
+from .common import dot, matmul
from .indexing import getitem
from .umath import elemwise, broadcast_to
from ..compatibility import int, range
@@ -1405,13 +1405,13 @@ class COO(SparseArray, NDArrayOperatorsMixin):
def __matmul__(self, other):
try:
- return dot(self, other)
+ return matmul(self, other)
except NotImplementedError:
return NotImplemented
def __rmatmul__(self, other):
try:
- return dot(other, self)
+ return matmul(other, self)
except NotImplementedError:
return NotImplemented
|
COO.__matmul__ gives the wrong shape of resultant array
Please see the following, COO.__matmul__ is not consistent with np.ndarray.__matmul__
```python
In [1]: import numpy as np
In [2]: import sparse
In [3]: npx = np.random.random((1,2,3,4))
In [4]: npy = np.random.random((1,2,4,3))
In [5]: npz = npx @ npy
In [6]: npz.shape
Out[6]: (1, 2, 3, 3)
In [7]: spx = sparse.random((1,2,3,4), 0.8)
In [8]: spy = sparse.random((1,2,4,3), 0.8)
In [9]: spz = spx @ spy
In [10]: type(spz)
Out[10]: numpy.ndarray
In [11]: spz.shape
Out[11]: (1, 2, 3, 1, 2, 3)
```
|
pydata/sparse
|
diff --git a/sparse/tests/test_coo.py b/sparse/tests/test_coo.py
index c403b3d..c56cea5 100644
--- a/sparse/tests/test_coo.py
+++ b/sparse/tests/test_coo.py
@@ -272,6 +272,49 @@ def test_tensordot(a_shape, b_shape, axes):
@pytest.mark.parametrize('a_shape, b_shape', [
+ ((3, 1, 6, 5), (2, 1, 4, 5, 6)),
+ ((2, 1, 4, 5, 6), (3, 1, 6, 5)),
+ ((1, 1, 5), (3, 5, 6)),
+ ((3, 4, 5), (1, 5, 6)),
+ ((3, 4, 5), (3, 5, 6)),
+ ((3, 4, 5), (5, 6)),
+ ((4, 5), (5, 6)),
+ ((5,), (5, 6)),
+ ((4, 5), (5,)),
+ ((5,), (5,)),
+])
+def test_matmul(a_shape, b_shape):
+ sa = sparse.random(a_shape, density=0.5)
+ sb = sparse.random(b_shape, density=0.5)
+
+ a = sa.todense()
+ b = sb.todense()
+
+ assert_eq(np.matmul(a, b), sparse.matmul(sa, sb))
+ assert_eq(sparse.matmul(sa, b), sparse.matmul(a, sb))
+ assert_eq(sparse.matmul(a, b), sparse.matmul(sa, sb))
+
+ if a.ndim == 2 or b.ndim == 2:
+ assert_eq(
+ np.matmul(a, b),
+ sparse.matmul(scipy.sparse.coo_matrix(a) if a.ndim == 2 else sa,
+ scipy.sparse.coo_matrix(b) if b.ndim == 2 else sb))
+
+ if hasattr(operator, 'matmul'):
+ assert_eq(operator.matmul(a, b), operator.matmul(sa, sb))
+
+
+def test_matmul_errors():
+ with pytest.raises(ValueError):
+ sa = sparse.random((3, 4, 5, 6), 0.5)
+ sb = sparse.random((3, 6, 5, 6), 0.5)
+ sparse.matmul(sa, sb)
+
+
[email protected]('a_shape, b_shape', [
+ ((1, 4, 5), (3, 5, 6)),
+ ((3, 4, 5), (1, 5, 6)),
+ ((3, 4, 5), (3, 5, 6)),
((3, 4, 5), (5, 6)),
((4, 5), (5, 6)),
((5,), (5, 6)),
@@ -287,11 +330,12 @@ def test_dot(a_shape, b_shape):
assert_eq(a.dot(b), sa.dot(sb))
assert_eq(np.dot(a, b), sparse.dot(sa, sb))
+ assert_eq(sparse.dot(sa, b), sparse.dot(a, sb))
+ assert_eq(sparse.dot(a, b), sparse.dot(sa, sb))
if hasattr(operator, 'matmul'):
# Basic equivalences
assert_eq(operator.matmul(a, b), operator.matmul(sa, sb))
-
# Test that SOO's and np.array's combine correctly
# Not possible due to https://github.com/numpy/numpy/issues/9028
# assert_eq(eval("a @ sb"), eval("sa @ b"))
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_added_files",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 4
}
|
0.5
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[all]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": null,
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
alabaster==0.7.13
asv==0.5.1
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
distlib==0.3.9
docutils==0.17.1
filelock==3.4.1
flake8==5.0.4
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
importlib-resources==5.4.0
iniconfig==1.1.1
Jinja2==3.0.3
llvmlite==0.36.0
MarkupSafe==2.0.1
mccabe==0.7.0
numba==0.53.1
numpy==1.19.5
packaging==21.3
platformdirs==2.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-flake8==1.1.1
pytz==2025.2
requests==2.27.1
scipy==1.5.4
six==1.17.0
snowballstemmer==2.2.0
-e git+https://github.com/pydata/sparse.git@87f414c0e63c3c3213225d2db0d354ea51b4f3f2#egg=sparse
Sphinx==4.3.2
sphinx-rtd-theme==1.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
toml==0.10.2
tomli==1.2.3
tox==3.28.0
typing_extensions==4.1.1
urllib3==1.26.20
virtualenv==20.16.2
zipp==3.6.0
|
name: sparse
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- alabaster==0.7.13
- asv==0.5.1
- attrs==22.2.0
- babel==2.11.0
- charset-normalizer==2.0.12
- coverage==6.2
- distlib==0.3.9
- docutils==0.17.1
- filelock==3.4.1
- flake8==5.0.4
- idna==3.10
- imagesize==1.4.1
- importlib-metadata==4.2.0
- importlib-resources==5.4.0
- iniconfig==1.1.1
- jinja2==3.0.3
- llvmlite==0.36.0
- markupsafe==2.0.1
- mccabe==0.7.0
- numba==0.53.1
- numpy==1.19.5
- packaging==21.3
- platformdirs==2.4.0
- pluggy==1.0.0
- py==1.11.0
- pycodestyle==2.9.1
- pyflakes==2.5.0
- pygments==2.14.0
- pyparsing==3.1.4
- pytest==7.0.1
- pytest-cov==4.0.0
- pytest-flake8==1.1.1
- pytz==2025.2
- requests==2.27.1
- scipy==1.5.4
- six==1.17.0
- snowballstemmer==2.2.0
- sphinx==4.3.2
- sphinx-rtd-theme==1.3.0
- sphinxcontrib-applehelp==1.0.2
- sphinxcontrib-devhelp==1.0.2
- sphinxcontrib-htmlhelp==2.0.0
- sphinxcontrib-jquery==4.1
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.3
- sphinxcontrib-serializinghtml==1.1.5
- toml==0.10.2
- tomli==1.2.3
- tox==3.28.0
- typing-extensions==4.1.1
- urllib3==1.26.20
- virtualenv==20.16.2
- zipp==3.6.0
prefix: /opt/conda/envs/sparse
|
[
"sparse/tests/test_coo.py::test_matmul[a_shape0-b_shape0]",
"sparse/tests/test_coo.py::test_matmul[a_shape1-b_shape1]",
"sparse/tests/test_coo.py::test_matmul[a_shape2-b_shape2]",
"sparse/tests/test_coo.py::test_matmul[a_shape3-b_shape3]",
"sparse/tests/test_coo.py::test_matmul[a_shape4-b_shape4]",
"sparse/tests/test_coo.py::test_matmul[a_shape5-b_shape5]",
"sparse/tests/test_coo.py::test_matmul[a_shape6-b_shape6]",
"sparse/tests/test_coo.py::test_matmul[a_shape7-b_shape7]",
"sparse/tests/test_coo.py::test_matmul[a_shape8-b_shape8]",
"sparse/tests/test_coo.py::test_matmul[a_shape9-b_shape9]",
"sparse/tests/test_coo.py::test_matmul_errors",
"sparse/tests/test_coo.py::test_dot[a_shape0-b_shape0]",
"sparse/tests/test_coo.py::test_dot[a_shape1-b_shape1]",
"sparse/tests/test_coo.py::test_dot[a_shape2-b_shape2]",
"sparse/tests/test_coo.py::test_dot[a_shape3-b_shape3]",
"sparse/tests/test_coo.py::test_dot[a_shape4-b_shape4]",
"sparse/tests/test_coo.py::test_dot[a_shape5-b_shape5]",
"sparse/tests/test_coo.py::test_dot[a_shape6-b_shape6]"
] |
[
"sparse/tests/test_coo.py::flake-8::FLAKE8"
] |
[
"sparse/tests/test_coo.py::test_reductions[f8-True-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-True-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f8-False-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-True-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f8-False-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-True-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f8-False-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-True-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[f4-False-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-True-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[f4-False-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-True-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[f4-False-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-True-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i8-False-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-True-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i8-False-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-True-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i8-False-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-True-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-None-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-0-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-1-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-2-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis4-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False--3-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-sum-kwargs0]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-mean-kwargs2]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-prod-kwargs4]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-max-kwargs5]",
"sparse/tests/test_coo.py::test_reductions[i4-False-axis6-min-kwargs6]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-True-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-None-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-None-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-0-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-0-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-1-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-1-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-2-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-2-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-axis4-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-axis4-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False--3-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False--3-all-kwargs1]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-axis6-any-kwargs0]",
"sparse/tests/test_coo.py::test_reductions_bool[i4-False-axis6-all-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-True-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-None-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-0-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-2-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis4-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False--1-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-sum-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-mean-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-mean-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-prod-kwargs5]",
"sparse/tests/test_coo.py::test_ufunc_reductions[i4-False-axis6-amin-kwargs6]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[amax-kwargs0]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[sum-kwargs1]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[prod-kwargs2]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[reduce-kwargs3]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[reduce-kwargs4]",
"sparse/tests/test_coo.py::test_ufunc_reductions_kwargs[reduce-kwargs5]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-None-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-0-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.25-False-1-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-None-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-0-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.5-False-1-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-None-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-0-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[0.75-False-1-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-None-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-0-nanmin]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nansum]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nanmean]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nanprod]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nanmax]",
"sparse/tests/test_coo.py::test_nan_reductions[1.0-False-1-nanmin]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[None-nanmax]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[None-nanmin]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[None-nanmean]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[0-nanmax]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[0-nanmin]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[0-nanmean]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[1-nanmax]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[1-nanmin]",
"sparse/tests/test_coo.py::test_all_nan_reduction_warning[1-nanmean]",
"sparse/tests/test_coo.py::test_transpose[None]",
"sparse/tests/test_coo.py::test_transpose[axis1]",
"sparse/tests/test_coo.py::test_transpose[axis2]",
"sparse/tests/test_coo.py::test_transpose[axis3]",
"sparse/tests/test_coo.py::test_transpose[axis4]",
"sparse/tests/test_coo.py::test_transpose[axis5]",
"sparse/tests/test_coo.py::test_transpose[axis6]",
"sparse/tests/test_coo.py::test_transpose_error[axis0]",
"sparse/tests/test_coo.py::test_transpose_error[axis1]",
"sparse/tests/test_coo.py::test_transpose_error[axis2]",
"sparse/tests/test_coo.py::test_transpose_error[axis3]",
"sparse/tests/test_coo.py::test_transpose_error[axis4]",
"sparse/tests/test_coo.py::test_transpose_error[axis5]",
"sparse/tests/test_coo.py::test_transpose_error[0.3]",
"sparse/tests/test_coo.py::test_transpose_error[axis7]",
"sparse/tests/test_coo.py::test_reshape[a0-b0]",
"sparse/tests/test_coo.py::test_reshape[a1-b1]",
"sparse/tests/test_coo.py::test_reshape[a2-b2]",
"sparse/tests/test_coo.py::test_reshape[a3-b3]",
"sparse/tests/test_coo.py::test_reshape[a4-b4]",
"sparse/tests/test_coo.py::test_reshape[a5-b5]",
"sparse/tests/test_coo.py::test_reshape[a6-b6]",
"sparse/tests/test_coo.py::test_reshape[a7-b7]",
"sparse/tests/test_coo.py::test_reshape[a8-b8]",
"sparse/tests/test_coo.py::test_reshape[a9-b9]",
"sparse/tests/test_coo.py::test_large_reshape",
"sparse/tests/test_coo.py::test_reshape_same",
"sparse/tests/test_coo.py::test_reshape_function",
"sparse/tests/test_coo.py::test_to_scipy_sparse",
"sparse/tests/test_coo.py::test_tensordot[a_shape0-b_shape0-axes0]",
"sparse/tests/test_coo.py::test_tensordot[a_shape1-b_shape1-axes1]",
"sparse/tests/test_coo.py::test_tensordot[a_shape2-b_shape2-axes2]",
"sparse/tests/test_coo.py::test_tensordot[a_shape3-b_shape3-axes3]",
"sparse/tests/test_coo.py::test_tensordot[a_shape4-b_shape4-axes4]",
"sparse/tests/test_coo.py::test_tensordot[a_shape5-b_shape5-axes5]",
"sparse/tests/test_coo.py::test_tensordot[a_shape6-b_shape6-axes6]",
"sparse/tests/test_coo.py::test_tensordot[a_shape7-b_shape7-axes7]",
"sparse/tests/test_coo.py::test_tensordot[a_shape8-b_shape8-axes8]",
"sparse/tests/test_coo.py::test_tensordot[a_shape9-b_shape9-0]",
"sparse/tests/test_coo.py::test_dot[a_shape7-b_shape7]",
"sparse/tests/test_coo.py::test_dot_type[False-False-SparseArray]",
"sparse/tests/test_coo.py::test_dot_type[False-True-ndarray]",
"sparse/tests/test_coo.py::test_dot_type[True-False-ndarray]",
"sparse/tests/test_coo.py::test_kron[1-1]",
"sparse/tests/test_coo.py::test_kron[1-2]",
"sparse/tests/test_coo.py::test_kron[1-3]",
"sparse/tests/test_coo.py::test_kron[2-1]",
"sparse/tests/test_coo.py::test_kron[2-2]",
"sparse/tests/test_coo.py::test_kron[2-3]",
"sparse/tests/test_coo.py::test_kron[3-1]",
"sparse/tests/test_coo.py::test_kron[3-2]",
"sparse/tests/test_coo.py::test_kron[3-3]",
"sparse/tests/test_coo.py::test_kron_spmatrix[True-True]",
"sparse/tests/test_coo.py::test_kron_spmatrix[True-False]",
"sparse/tests/test_coo.py::test_kron_spmatrix[False-True]",
"sparse/tests/test_coo.py::test_kron_scalar[1]",
"sparse/tests/test_coo.py::test_kron_scalar[2]",
"sparse/tests/test_coo.py::test_kron_scalar[3]",
"sparse/tests/test_coo.py::test_elemwise[expm1]",
"sparse/tests/test_coo.py::test_elemwise[log1p]",
"sparse/tests/test_coo.py::test_elemwise[sin]",
"sparse/tests/test_coo.py::test_elemwise[tan]",
"sparse/tests/test_coo.py::test_elemwise[sinh]",
"sparse/tests/test_coo.py::test_elemwise[tanh]",
"sparse/tests/test_coo.py::test_elemwise[floor]",
"sparse/tests/test_coo.py::test_elemwise[ceil]",
"sparse/tests/test_coo.py::test_elemwise[sqrt]",
"sparse/tests/test_coo.py::test_elemwise[conjugate0]",
"sparse/tests/test_coo.py::test_elemwise[round_]",
"sparse/tests/test_coo.py::test_elemwise[rint]",
"sparse/tests/test_coo.py::test_elemwise[<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise[conjugate1]",
"sparse/tests/test_coo.py::test_elemwise[conjugate2]",
"sparse/tests/test_coo.py::test_elemwise[<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise[abs]",
"sparse/tests/test_coo.py::test_elemwise_inplace[expm1]",
"sparse/tests/test_coo.py::test_elemwise_inplace[log1p]",
"sparse/tests/test_coo.py::test_elemwise_inplace[sin]",
"sparse/tests/test_coo.py::test_elemwise_inplace[tan]",
"sparse/tests/test_coo.py::test_elemwise_inplace[sinh]",
"sparse/tests/test_coo.py::test_elemwise_inplace[tanh]",
"sparse/tests/test_coo.py::test_elemwise_inplace[floor]",
"sparse/tests/test_coo.py::test_elemwise_inplace[ceil]",
"sparse/tests/test_coo.py::test_elemwise_inplace[sqrt]",
"sparse/tests/test_coo.py::test_elemwise_inplace[conjugate0]",
"sparse/tests/test_coo.py::test_elemwise_inplace[round_]",
"sparse/tests/test_coo.py::test_elemwise_inplace[rint]",
"sparse/tests/test_coo.py::test_elemwise_inplace[conjugate1]",
"sparse/tests/test_coo.py::test_elemwise_inplace[conjugate2]",
"sparse/tests/test_coo.py::test_elemwise_inplace[<lambda>]",
"sparse/tests/test_coo.py::test_elemwise_mixed",
"sparse/tests/test_coo.py::test_elemwise_mixed_empty",
"sparse/tests/test_coo.py::test_ndarray_bigger_shape",
"sparse/tests/test_coo.py::test_elemwise_unsupported",
"sparse/tests/test_coo.py::test_elemwise_mixed_broadcast",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-mul]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-add]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-sub]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-gt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-lt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape0-ne]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-mul]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-add]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-sub]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-gt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-lt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape1-ne]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-mul]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-add]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-sub]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-gt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-lt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape2-ne]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-mul]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-add]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-sub]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-gt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-lt]",
"sparse/tests/test_coo.py::test_elemwise_binary[shape3-ne]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape0-imul]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape0-iadd]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape0-isub]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape1-imul]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape1-iadd]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape1-isub]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape2-imul]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape2-iadd]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape2-isub]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape3-imul]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape3-iadd]",
"sparse/tests/test_coo.py::test_elemwise_binary_inplace[shape3-isub]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape0-<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape0-<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape0-<lambda>2]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape0-<lambda>3]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape1-<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape1-<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape1-<lambda>2]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape1-<lambda>3]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape2-<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape2-<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape2-<lambda>2]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape2-<lambda>3]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape3-<lambda>0]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape3-<lambda>1]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape3-<lambda>2]",
"sparse/tests/test_coo.py::test_elemwise_trinary[shape3-<lambda>3]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape10-shape20-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape10-shape20-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape11-shape21-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape11-shape21-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape12-shape22-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape12-shape22-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape13-shape23-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape13-shape23-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape14-shape24-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape14-shape24-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape15-shape25-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape15-shape25-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape16-shape26-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape16-shape26-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape17-shape27-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape17-shape27-mul]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape18-shape28-add]",
"sparse/tests/test_coo.py::test_binary_broadcasting[shape18-shape28-mul]",
"sparse/tests/test_coo.py::test_broadcast_to[shape10-shape20]",
"sparse/tests/test_coo.py::test_broadcast_to[shape11-shape21]",
"sparse/tests/test_coo.py::test_broadcast_to[shape12-shape22]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>0-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>1-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>2-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>3-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>4-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes0]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes1]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes2]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes3]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes4]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes5]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes6]",
"sparse/tests/test_coo.py::test_trinary_broadcasting[<lambda>5-shapes7]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-nan-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-nan-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-nan-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-nan-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25-inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25--inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25--inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25--inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.25--inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-nan-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-nan-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-nan-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-nan-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5-inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5--inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5--inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5--inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.5--inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-nan-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-nan-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-nan-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-nan-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75-inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75--inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75--inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75--inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[0.75--inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-nan-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-nan-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-nan-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-nan-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0-inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0--inf-shapes0-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0--inf-shapes1-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0--inf-shapes2-<lambda>]",
"sparse/tests/test_coo.py::test_trinary_broadcasting_pathological[1.0--inf-shapes3-<lambda>]",
"sparse/tests/test_coo.py::test_sparse_broadcasting",
"sparse/tests/test_coo.py::test_dense_broadcasting",
"sparse/tests/test_coo.py::test_sparsearray_elemwise[coo]",
"sparse/tests/test_coo.py::test_sparsearray_elemwise[dok]",
"sparse/tests/test_coo.py::test_ndarray_densification_fails",
"sparse/tests/test_coo.py::test_elemwise_noargs",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[pow]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[truediv]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[floordiv]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[ge]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[le]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[eq]",
"sparse/tests/test_coo.py::test_nonzero_outout_fv_ufunc[mod]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-mul-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-add-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-sub-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-pow-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-truediv-3]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-floordiv-4]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-gt-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-lt--5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-ne-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-ge-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-le--3]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-eq-1]",
"sparse/tests/test_coo.py::test_elemwise_scalar[True-mod-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-mul-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-add-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-sub-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-pow-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-truediv-3]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-floordiv-4]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-gt-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-lt--5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-ne-0]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-ge-5]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-le--3]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-eq-1]",
"sparse/tests/test_coo.py::test_elemwise_scalar[False-mod-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-mul-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-add-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-sub-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-gt--5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-lt-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-ne-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-ge--5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-le-3]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[True-eq-1]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-mul-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-add-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-sub-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-gt--5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-lt-5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-ne-0]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-ge--5]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-le-3]",
"sparse/tests/test_coo.py::test_leftside_elemwise_scalar[False-eq-1]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[add-5]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[sub--5]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[pow--3]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[truediv-0]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[floordiv-0]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[gt--5]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[lt-5]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[ne-1]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[ge--3]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[le-3]",
"sparse/tests/test_coo.py::test_scalar_output_nonzero_fv[eq-0]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape0-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape0-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape0-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape1-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape1-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape1-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape2-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape2-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape2-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape3-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape3-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary[shape3-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape0-iand]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape0-ior]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape0-ixor]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape1-iand]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape1-ior]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape1-ixor]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape2-iand]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape2-ior]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape2-ixor]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape3-iand]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape3-ior]",
"sparse/tests/test_coo.py::test_bitwise_binary_inplace[shape3-ixor]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape0-lshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape0-rshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape1-lshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape1-rshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape2-lshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape2-rshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape3-lshift]",
"sparse/tests/test_coo.py::test_bitshift_binary[shape3-rshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape0-ilshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape0-irshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape1-ilshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape1-irshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape2-ilshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape2-irshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape3-ilshift]",
"sparse/tests/test_coo.py::test_bitshift_binary_inplace[shape3-irshift]",
"sparse/tests/test_coo.py::test_bitwise_scalar[shape0-and_]",
"sparse/tests/test_coo.py::test_bitwise_scalar[shape1-and_]",
"sparse/tests/test_coo.py::test_bitwise_scalar[shape2-and_]",
"sparse/tests/test_coo.py::test_bitwise_scalar[shape3-and_]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape0-lshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape0-rshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape1-lshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape1-rshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape2-lshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape2-rshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape3-lshift]",
"sparse/tests/test_coo.py::test_bitshift_scalar[shape3-rshift]",
"sparse/tests/test_coo.py::test_unary_bitwise_nonzero_output_fv[shape0-invert]",
"sparse/tests/test_coo.py::test_unary_bitwise_nonzero_output_fv[shape1-invert]",
"sparse/tests/test_coo.py::test_unary_bitwise_nonzero_output_fv[shape2-invert]",
"sparse/tests/test_coo.py::test_unary_bitwise_nonzero_output_fv[shape3-invert]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape0-or_]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape0-xor]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape1-or_]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape1-xor]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape2-or_]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape2-xor]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape3-or_]",
"sparse/tests/test_coo.py::test_binary_bitwise_nonzero_output_fv[shape3-xor]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-mul]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-add]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-sub]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-gt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-lt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape0-ne]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-mul]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-add]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-sub]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-gt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-lt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape1-ne]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-mul]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-add]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-sub]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-gt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-lt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape2-ne]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-mul]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-add]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-sub]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-gt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-lt]",
"sparse/tests/test_coo.py::test_elemwise_nonzero_input_fv[shape3-ne]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape0-lshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape0-rshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape1-lshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape1-rshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape2-lshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape2-rshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape3-lshift]",
"sparse/tests/test_coo.py::test_binary_bitshift_densification_fails[shape3-rshift]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape0-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape0-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape0-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape1-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape1-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape1-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape2-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape2-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape2-xor]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape3-and_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape3-or_]",
"sparse/tests/test_coo.py::test_bitwise_binary_bool[shape3-xor]",
"sparse/tests/test_coo.py::test_elemwise_binary_empty",
"sparse/tests/test_coo.py::test_gt",
"sparse/tests/test_coo.py::test_slicing[0]",
"sparse/tests/test_coo.py::test_slicing[1]",
"sparse/tests/test_coo.py::test_slicing[-1]",
"sparse/tests/test_coo.py::test_slicing[index3]",
"sparse/tests/test_coo.py::test_slicing[index4]",
"sparse/tests/test_coo.py::test_slicing[index5]",
"sparse/tests/test_coo.py::test_slicing[index6]",
"sparse/tests/test_coo.py::test_slicing[index7]",
"sparse/tests/test_coo.py::test_slicing[index8]",
"sparse/tests/test_coo.py::test_slicing[index9]",
"sparse/tests/test_coo.py::test_slicing[index10]",
"sparse/tests/test_coo.py::test_slicing[index11]",
"sparse/tests/test_coo.py::test_slicing[index12]",
"sparse/tests/test_coo.py::test_slicing[index13]",
"sparse/tests/test_coo.py::test_slicing[index14]",
"sparse/tests/test_coo.py::test_slicing[index15]",
"sparse/tests/test_coo.py::test_slicing[index16]",
"sparse/tests/test_coo.py::test_slicing[index17]",
"sparse/tests/test_coo.py::test_slicing[index18]",
"sparse/tests/test_coo.py::test_slicing[index19]",
"sparse/tests/test_coo.py::test_slicing[index20]",
"sparse/tests/test_coo.py::test_slicing[index21]",
"sparse/tests/test_coo.py::test_slicing[index22]",
"sparse/tests/test_coo.py::test_slicing[index23]",
"sparse/tests/test_coo.py::test_slicing[index24]",
"sparse/tests/test_coo.py::test_slicing[index25]",
"sparse/tests/test_coo.py::test_slicing[index26]",
"sparse/tests/test_coo.py::test_slicing[index27]",
"sparse/tests/test_coo.py::test_slicing[index28]",
"sparse/tests/test_coo.py::test_slicing[index29]",
"sparse/tests/test_coo.py::test_slicing[index30]",
"sparse/tests/test_coo.py::test_slicing[index31]",
"sparse/tests/test_coo.py::test_slicing[index32]",
"sparse/tests/test_coo.py::test_slicing[index33]",
"sparse/tests/test_coo.py::test_slicing[index34]",
"sparse/tests/test_coo.py::test_slicing[index35]",
"sparse/tests/test_coo.py::test_slicing[index36]",
"sparse/tests/test_coo.py::test_slicing[index37]",
"sparse/tests/test_coo.py::test_slicing[index38]",
"sparse/tests/test_coo.py::test_slicing[index39]",
"sparse/tests/test_coo.py::test_slicing[index40]",
"sparse/tests/test_coo.py::test_slicing[index41]",
"sparse/tests/test_coo.py::test_slicing[index42]",
"sparse/tests/test_coo.py::test_slicing[index43]",
"sparse/tests/test_coo.py::test_slicing[index44]",
"sparse/tests/test_coo.py::test_slicing[index45]",
"sparse/tests/test_coo.py::test_advanced_indexing[index0]",
"sparse/tests/test_coo.py::test_advanced_indexing[index1]",
"sparse/tests/test_coo.py::test_advanced_indexing[index2]",
"sparse/tests/test_coo.py::test_advanced_indexing[index3]",
"sparse/tests/test_coo.py::test_advanced_indexing[index4]",
"sparse/tests/test_coo.py::test_advanced_indexing[index5]",
"sparse/tests/test_coo.py::test_advanced_indexing[index6]",
"sparse/tests/test_coo.py::test_advanced_indexing[index7]",
"sparse/tests/test_coo.py::test_advanced_indexing[index8]",
"sparse/tests/test_coo.py::test_advanced_indexing[index9]",
"sparse/tests/test_coo.py::test_custom_dtype_slicing",
"sparse/tests/test_coo.py::test_slicing_errors[index0]",
"sparse/tests/test_coo.py::test_slicing_errors[index1]",
"sparse/tests/test_coo.py::test_slicing_errors[index2]",
"sparse/tests/test_coo.py::test_slicing_errors[5]",
"sparse/tests/test_coo.py::test_slicing_errors[-5]",
"sparse/tests/test_coo.py::test_slicing_errors[foo]",
"sparse/tests/test_coo.py::test_slicing_errors[index6]",
"sparse/tests/test_coo.py::test_slicing_errors[0.5]",
"sparse/tests/test_coo.py::test_slicing_errors[index8]",
"sparse/tests/test_coo.py::test_slicing_errors[index9]",
"sparse/tests/test_coo.py::test_slicing_errors[index10]",
"sparse/tests/test_coo.py::test_slicing_errors[index11]",
"sparse/tests/test_coo.py::test_concatenate",
"sparse/tests/test_coo.py::test_concatenate_mixed[stack-0]",
"sparse/tests/test_coo.py::test_concatenate_mixed[stack-1]",
"sparse/tests/test_coo.py::test_concatenate_mixed[concatenate-0]",
"sparse/tests/test_coo.py::test_concatenate_mixed[concatenate-1]",
"sparse/tests/test_coo.py::test_concatenate_noarrays",
"sparse/tests/test_coo.py::test_stack[0-shape0]",
"sparse/tests/test_coo.py::test_stack[0-shape1]",
"sparse/tests/test_coo.py::test_stack[0-shape2]",
"sparse/tests/test_coo.py::test_stack[1-shape0]",
"sparse/tests/test_coo.py::test_stack[1-shape1]",
"sparse/tests/test_coo.py::test_stack[1-shape2]",
"sparse/tests/test_coo.py::test_stack[-1-shape0]",
"sparse/tests/test_coo.py::test_stack[-1-shape1]",
"sparse/tests/test_coo.py::test_stack[-1-shape2]",
"sparse/tests/test_coo.py::test_large_concat_stack",
"sparse/tests/test_coo.py::test_addition",
"sparse/tests/test_coo.py::test_scalar_multiplication[2]",
"sparse/tests/test_coo.py::test_scalar_multiplication[2.5]",
"sparse/tests/test_coo.py::test_scalar_multiplication[scalar2]",
"sparse/tests/test_coo.py::test_scalar_multiplication[scalar3]",
"sparse/tests/test_coo.py::test_scalar_exponentiation",
"sparse/tests/test_coo.py::test_create_with_lists_of_tuples",
"sparse/tests/test_coo.py::test_sizeof",
"sparse/tests/test_coo.py::test_scipy_sparse_interface",
"sparse/tests/test_coo.py::test_scipy_sparse_interaction[coo]",
"sparse/tests/test_coo.py::test_scipy_sparse_interaction[csr]",
"sparse/tests/test_coo.py::test_scipy_sparse_interaction[dok]",
"sparse/tests/test_coo.py::test_scipy_sparse_interaction[csc]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[mul]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[add]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[sub]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[gt]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[lt]",
"sparse/tests/test_coo.py::test_op_scipy_sparse[ne]",
"sparse/tests/test_coo.py::test_op_scipy_sparse_left[add]",
"sparse/tests/test_coo.py::test_op_scipy_sparse_left[sub]",
"sparse/tests/test_coo.py::test_cache_csr",
"sparse/tests/test_coo.py::test_empty_shape",
"sparse/tests/test_coo.py::test_single_dimension",
"sparse/tests/test_coo.py::test_large_sum",
"sparse/tests/test_coo.py::test_add_many_sparse_arrays",
"sparse/tests/test_coo.py::test_caching",
"sparse/tests/test_coo.py::test_scalar_slicing",
"sparse/tests/test_coo.py::test_triul[shape0-0]",
"sparse/tests/test_coo.py::test_triul[shape1-1]",
"sparse/tests/test_coo.py::test_triul[shape2--1]",
"sparse/tests/test_coo.py::test_triul[shape3--2]",
"sparse/tests/test_coo.py::test_triul[shape4-1000]",
"sparse/tests/test_coo.py::test_empty_reduction",
"sparse/tests/test_coo.py::test_random_shape[0.1-shape0]",
"sparse/tests/test_coo.py::test_random_shape[0.1-shape1]",
"sparse/tests/test_coo.py::test_random_shape[0.1-shape2]",
"sparse/tests/test_coo.py::test_random_shape[0.3-shape0]",
"sparse/tests/test_coo.py::test_random_shape[0.3-shape1]",
"sparse/tests/test_coo.py::test_random_shape[0.3-shape2]",
"sparse/tests/test_coo.py::test_random_shape[0.5-shape0]",
"sparse/tests/test_coo.py::test_random_shape[0.5-shape1]",
"sparse/tests/test_coo.py::test_random_shape[0.5-shape2]",
"sparse/tests/test_coo.py::test_random_shape[0.7-shape0]",
"sparse/tests/test_coo.py::test_random_shape[0.7-shape1]",
"sparse/tests/test_coo.py::test_random_shape[0.7-shape2]",
"sparse/tests/test_coo.py::test_two_random_unequal",
"sparse/tests/test_coo.py::test_two_random_same_seed",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape0-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape0-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape0-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape1-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape1-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.0-shape1-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape0-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape0-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape0-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape1-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape1-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.01-shape1-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape0-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape0-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape0-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape1-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape1-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.1-shape1-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape0-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape0-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape0-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape1-None-float64]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape1-rvs-int]",
"sparse/tests/test_coo.py::test_random_rvs[0.2-shape1-<lambda>-bool]",
"sparse/tests/test_coo.py::test_random_fv[coo]",
"sparse/tests/test_coo.py::test_random_fv[dok]",
"sparse/tests/test_coo.py::test_scalar_shape_construction",
"sparse/tests/test_coo.py::test_len",
"sparse/tests/test_coo.py::test_density",
"sparse/tests/test_coo.py::test_size",
"sparse/tests/test_coo.py::test_np_array",
"sparse/tests/test_coo.py::test_three_arg_where[shapes0]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes1]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes2]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes3]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes4]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes5]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes6]",
"sparse/tests/test_coo.py::test_three_arg_where[shapes7]",
"sparse/tests/test_coo.py::test_one_arg_where",
"sparse/tests/test_coo.py::test_one_arg_where_dense",
"sparse/tests/test_coo.py::test_two_arg_where",
"sparse/tests/test_coo.py::test_inplace_invalid_shape[imul]",
"sparse/tests/test_coo.py::test_inplace_invalid_shape[iadd]",
"sparse/tests/test_coo.py::test_inplace_invalid_shape[isub]",
"sparse/tests/test_coo.py::test_nonzero",
"sparse/tests/test_coo.py::test_argwhere",
"sparse/tests/test_coo.py::test_asformat[coo]",
"sparse/tests/test_coo.py::test_asformat[dok]",
"sparse/tests/test_coo.py::test_as_coo[COO]",
"sparse/tests/test_coo.py::test_as_coo[DOK]",
"sparse/tests/test_coo.py::test_as_coo[csr_matrix]",
"sparse/tests/test_coo.py::test_as_coo[asarray]",
"sparse/tests/test_coo.py::test_invalid_attrs_error",
"sparse/tests/test_coo.py::test_invalid_iterable_error",
"sparse/tests/test_coo.py::test_prod_along_axis",
"sparse/tests/test_coo.py::TestRoll::test_1d[0]",
"sparse/tests/test_coo.py::TestRoll::test_1d[2]",
"sparse/tests/test_coo.py::TestRoll::test_1d[-2]",
"sparse/tests/test_coo.py::TestRoll::test_1d[20]",
"sparse/tests/test_coo.py::TestRoll::test_1d[-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None-0]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None-2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None--2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[None--20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0-0]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0-2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0--2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[0--20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1-0]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1-2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1--2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[1--20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3-0]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3-2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3--2]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3-20]",
"sparse/tests/test_coo.py::TestRoll::test_2d[ax3--20]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax0-shift0]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax0-shift1]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax0-shift2]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax0-shift3]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax1-shift0]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax1-shift1]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax1-shift2]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax1-shift3]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax2-shift0]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax2-shift1]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax2-shift2]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax2-shift3]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax3-shift0]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax3-shift1]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax3-shift2]",
"sparse/tests/test_coo.py::TestRoll::test_multiaxis[ax3-shift3]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None-0]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None-2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None--2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None-20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[None--20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0-0]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0-2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0--2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0-20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[0--20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1-0]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1-2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1--2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1-20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[1--20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3-0]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3-2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3--2]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3-20]",
"sparse/tests/test_coo.py::TestRoll::test_original_is_copied[ax3--20]",
"sparse/tests/test_coo.py::TestRoll::test_empty",
"sparse/tests/test_coo.py::TestRoll::test_valerr[args0]",
"sparse/tests/test_coo.py::TestRoll::test_valerr[args1]",
"sparse/tests/test_coo.py::TestRoll::test_valerr[args2]",
"sparse/tests/test_coo.py::TestRoll::test_valerr[args3]",
"sparse/tests/test_coo.py::test_clip",
"sparse/tests/test_coo.py::TestFailFillValue::test_nonzero_fv",
"sparse/tests/test_coo.py::TestFailFillValue::test_inconsistent_fv",
"sparse/tests/test_coo.py::test_pickle",
"sparse/tests/test_coo.py::test_copy[True]",
"sparse/tests/test_coo.py::test_copy[False]",
"sparse/tests/test_coo.py::test_initialization[2]",
"sparse/tests/test_coo.py::test_initialization[3]",
"sparse/tests/test_coo.py::test_initialization[4]",
"sparse/tests/test_coo.py::test_initialization[5]",
"sparse/tests/test_coo.py::test_eye[4-None]",
"sparse/tests/test_coo.py::test_eye[4-10]",
"sparse/tests/test_coo.py::test_eye[10-4]",
"sparse/tests/test_coo.py::test_eye[0-10]",
"sparse/tests/test_coo.py::test_ones_zeros[ones]",
"sparse/tests/test_coo.py::test_ones_zeros[zeros]",
"sparse/tests/test_coo.py::test_ones_zeros_like[ones_like]",
"sparse/tests/test_coo.py::test_ones_zeros_like[zeros_like]",
"sparse/tests/test_coo.py::test_full",
"sparse/tests/test_coo.py::test_full_like",
"sparse/tests/test_coo.py::test_complex_methods[True]",
"sparse/tests/test_coo.py::test_complex_methods[False]",
"sparse/tests/test_coo.py::test_np_matrix"
] |
[] |
BSD 3-Clause "New" or "Revised" License
| 3,300 |
[
"sparse/coo/common.py",
"sparse/coo/__init__.py",
"docs/generated/sparse.matmul.rst",
"docs/generated/sparse.rst",
"sparse/coo/core.py"
] |
[
"sparse/coo/common.py",
"sparse/coo/__init__.py",
"docs/generated/sparse.matmul.rst",
"docs/generated/sparse.rst",
"sparse/coo/core.py"
] |
stuartmccoll__gitlab-changelog-generator-19
|
7e6b2ef2d74c19b89f88eda28c4b1b912d2aab1c
|
2018-10-22 20:29:28
|
16757a63153df4c653c878eab9e897ff4515ba94
|
diff --git a/.gitignore b/.gitignore
index aae64a7..0c9be46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+# Application specific
+CHANGELOG_generated.md
+
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
@@ -24,6 +27,8 @@ wheels/
.installed.cfg
*.egg
MANIFEST
+bin/
+include/
# PyInstaller
# Usually these files are written by a python script from a template
diff --git a/.travis.yml b/.travis.yml
index d6aa6ab..881e436 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,13 +1,14 @@
language: python
-python:
+python:
- "3.6"
- "3.7-dev"
install:
-- pip install requests
-- pip install pyre-check
-- pip install pytest-cov
+ - pip install python-dateutil
+ - pip install requests
+ - pip install pyre-check
+ - pip install pytest-cov
+ - pip install pytz
script:
-- python3 -m pytest --cov-report term-missing --cov=changelog_generator
-- pyre --source-directory . check
\ No newline at end of file
+ - python3 -m pytest --cov-report term-missing --cov=changelog_generator
diff --git a/changelog_generator/calls.py b/changelog_generator/calls.py
index 18cef91..c7d57cd 100644
--- a/changelog_generator/calls.py
+++ b/changelog_generator/calls.py
@@ -44,6 +44,64 @@ def get_last_commit_date(cli_args: dict) -> str:
)
+def get_closed_issues_for_project(cli_args: dict) -> dict:
+ """
+ Queries a specified GitLab API and returns a list containing
+ the titles and URLs of closed issues since a given date.
+ """
+ request_url = f"http://{cli_args['ip_address']}/api/v{cli_args['api_version']}/projects/{cli_args['project_group']}%2F{cli_args['project']}/issues?state=closed"
+ logger.info(
+ f"Requesting tags for project {cli_args['project']} with URL: {request_url}"
+ )
+ try:
+ response = requests.get(request_url)
+ response.raise_for_status()
+ except requests.exceptions.HTTPError as ex:
+ logger.error(
+ f"{get_commits_since_date.__name__} call to GitLab API failed with HTTPError: {ex}"
+ )
+ sys.exit(1)
+ except requests.exceptions.ConnectionError as ex:
+ logger.error(
+ f"{get_commits_since_date.__name__} call to GitLab API failed with ConnectionError: {ex}"
+ )
+ sys.exit(1)
+
+ logger.debug(response.status_code)
+ logger.debug(response.json())
+
+ return response.json()
+
+
+def get_last_tagged_release_date(cli_args: dict) -> str:
+ """
+ Queries a specified GitLab API and returns a string containing
+ the created_at date of the last tagged release.
+ """
+ request_url = f"http://{cli_args['ip_address']}/api/v{cli_args['api_version']}/projects/{cli_args['project_group']}%2F{cli_args['project']}/repository/tags"
+ logger.info(
+ f"Requesting tags for project {cli_args['project']} with URL: {request_url}"
+ )
+ try:
+ response = requests.get(request_url)
+ response.raise_for_status()
+ except requests.exceptions.HTTPError as ex:
+ logger.error(
+ f"{get_commits_since_date.__name__} call to GitLab API failed with HTTPError: {ex}"
+ )
+ sys.exit(1)
+ except requests.exceptions.ConnectionError as ex:
+ logger.error(
+ f"{get_commits_since_date.__name__} call to GitLab API failed with ConnectionError: {ex}"
+ )
+ sys.exit(1)
+
+ logger.debug(response.status_code)
+ logger.debug(response.json())
+
+ return response.json()[0]["commit"]["created_at"]
+
+
def get_commits_since_date(date: str, cli_args: dict) -> list:
"""
Queries a specified GitLab API and returns a JSON response containing
diff --git a/changelog_generator/generator.py b/changelog_generator/generator.py
index 24b94c0..cea4db2 100644
--- a/changelog_generator/generator.py
+++ b/changelog_generator/generator.py
@@ -1,10 +1,13 @@
import datetime
+import dateutil.parser
import os.path
from changelog_generator.log_handlers import logger
from changelog_generator.calls import (
- get_last_commit_date,
+ get_closed_issues_for_project,
get_commits_since_date,
+ get_last_commit_date,
+ get_last_tagged_release_date,
)
@@ -12,6 +15,8 @@ def generate_changelog(cli_args: dict) -> str:
# Get the date of the last commit
last_commit = get_last_commit_date(cli_args)
+ closed_issues_since_last_tag = get_closed_issues_since_last_tag(cli_args)
+
# Get any commits since that date
new_commits = get_commits_since_date(last_commit, cli_args)
@@ -35,6 +40,15 @@ def generate_changelog(cli_args: dict) -> str:
for commit in new_commits
for y in commit["message"].split("\n")
]
+
+ if closed_issues_since_last_tag:
+ modified_changelog.write(f"\n### Closed Issues\n")
+ [
+ modified_changelog.write(
+ f"* {closed_issue['title']}"
+ )
+ for closed_issue in closed_issues_since_last_tag
+ ]
modified_changelog.write(f"\n")
modified_changelog.write(original_changelog_data)
return "CHANGELOG.md updated successfully"
@@ -50,6 +64,13 @@ def generate_changelog(cli_args: dict) -> str:
for commit in new_commits
for y in commit["message"].split("\n")
]
+
+ if closed_issues_since_last_tag:
+ changelog.write(f"\n### Closed Issues\n")
+ [
+ changelog.write(f"* {closed_issue['title']}")
+ for closed_issue in closed_issues_since_last_tag
+ ]
return "CHANGELOG_generated.md written successfully"
else:
logger.info("No CHANGELOG.md found and no CHANGELOG.md specified...")
@@ -61,5 +82,28 @@ def generate_changelog(cli_args: dict) -> str:
for commit in new_commits
for y in commit["message"].split("\n")
]
-
+ if closed_issues_since_last_tag:
+ changelog.write(f"\n### Closed Issues\n")
+ [
+ changelog.write(f"* {closed_issue['title']}")
+ for closed_issue in closed_issues_since_last_tag
+ ]
return "New CHANGELOG.md file written successfully"
+
+
+def get_closed_issues_since_last_tag(cli_args: dict) -> list:
+ last_tagged_release_date = get_last_tagged_release_date(cli_args)
+
+ closed_issues = get_closed_issues_for_project(cli_args)
+
+ closed_issues_since_tag = []
+ for issue in closed_issues:
+ logger.info(issue)
+ if dateutil.parser.parse(issue["closed_at"]) > dateutil.parser.parse(
+ last_tagged_release_date
+ ):
+ closed_issues_since_tag.append(
+ {"closed_at": issue["closed_at"], "title": issue["title"]}
+ )
+
+ return closed_issues_since_tag
|
Implement 'fixed bugs' section in CHANGELOG.md
The [GitLab API](https://docs.gitlab.com/ee/api/) can be queried to find closed issues since the last tagged version of a repository. We can query this at a more granular level to determine closed issues which had a `bug` label applied to them. This feature can be used to add a new section to the `CHANGELOG.md` file which is generated by this utility, something along the lines of 'Fixed Bugs' which details those issues labelled as bugs which have been closed.
|
stuartmccoll/gitlab-changelog-generator
|
diff --git a/changelog_generator/tests/test_calls.py b/changelog_generator/tests/test_calls.py
index caf19f4..0024e2f 100644
--- a/changelog_generator/tests/test_calls.py
+++ b/changelog_generator/tests/test_calls.py
@@ -4,6 +4,8 @@ import unittest
from changelog_generator.calls import (
get_last_commit_date,
+ get_last_tagged_release_date,
+ get_closed_issues_for_project,
get_commits_since_date,
)
@@ -116,3 +118,56 @@ class TestCalls(unittest.TestCase):
)
for commit in commits
]
+
+ @mock.patch("changelog_generator.calls.requests.get")
+ def test_get_closed_issues_for_project(self, mock_get):
+
+ mock_get.return_value.json.return_value = [
+ {
+ "closed_at": "2018-06-10T14:01:44.000+00:00",
+ "title": "A Closed Issue",
+ }
+ ]
+
+ cli_args = {
+ "ip_address": "localhost",
+ "api_version": "4",
+ "project_group": "test-group",
+ "project": "test-project",
+ "branch_one": "release",
+ "branch_two": "master",
+ "version": "1",
+ "changelog": "N",
+ }
+
+ self.assertEqual(
+ mock_get.return_value.json.return_value,
+ get_closed_issues_for_project(cli_args),
+ )
+
+ @mock.patch("changelog_generator.calls.requests.get")
+ def test_get_last_tagged_release_date(self, mock_get):
+ mock_get.return_value.json.return_value = [
+ {
+ "commit": {
+ "created_at": "2018-06-10T14:01:44.000+00:00",
+ "name": "A Closed Issue",
+ }
+ }
+ ]
+
+ cli_args = {
+ "ip_address": "localhost",
+ "api_version": "4",
+ "project_group": "test-group",
+ "project": "test-project",
+ "branch_one": "release",
+ "branch_two": "master",
+ "version": "1",
+ "changelog": "N",
+ }
+
+ self.assertEqual(
+ "2018-06-10T14:01:44.000+00:00",
+ get_last_tagged_release_date(cli_args),
+ )
diff --git a/changelog_generator/tests/test_generator.py b/changelog_generator/tests/test_generator.py
index 7fd8668..c52c15d 100644
--- a/changelog_generator/tests/test_generator.py
+++ b/changelog_generator/tests/test_generator.py
@@ -2,15 +2,25 @@ import datetime
import mock
import unittest
-from changelog_generator.generator import generate_changelog
+from changelog_generator.generator import (
+ generate_changelog,
+ get_closed_issues_since_last_tag,
+)
class TestGenerator(unittest.TestCase):
+ @mock.patch(
+ "changelog_generator.generator.get_closed_issues_since_last_tag"
+ )
@mock.patch("os.path.isfile")
@mock.patch("changelog_generator.generator.get_commits_since_date")
@mock.patch("changelog_generator.generator.get_last_commit_date")
def test_generate_changelog_existing(
- self, mock_get_commit_date, mock_get_commits, mock_is_file
+ self,
+ mock_get_commit_date,
+ mock_get_commits,
+ mock_is_file,
+ mock_closed_issues,
):
mock_is_file.return_value = True
mock_get_commit_date.return_value = "2018-06-10T14:01:45.000000+00:00"
@@ -21,6 +31,12 @@ class TestGenerator(unittest.TestCase):
"message": "Test commit message",
}
]
+ mock_closed_issues.return_value = [
+ {
+ "title": "A Closed Issue",
+ "closed_at": "2018-06-10T14:01:44.000+00:00",
+ }
+ ]
cli_args = {
"ip_address": "localhost",
@@ -36,13 +52,22 @@ class TestGenerator(unittest.TestCase):
with mock.patch("builtins.open", mock.mock_open()) as mock_file:
result = generate_changelog(cli_args)
mock_file.assert_called_once_with(mock.ANY, "w")
- mock_file().write.assert_called_with(
- "* 2018-06-10 - Test commit message \n"
- )
+ mock_file_write_calls = [
+ mock.call(
+ f"## v1 ({datetime.datetime.now().strftime('%Y-%m-%d')})\n"
+ ),
+ mock.call("* 2018-06-10 - Test commit message \n"),
+ mock.call("\n### Closed Issues\n"),
+ mock.call("* A Closed Issue"),
+ ]
+ mock_file().write.assert_has_calls(mock_file_write_calls)
self.assertEqual(
result, "CHANGELOG_generated.md written successfully"
)
+ @mock.patch(
+ "changelog_generator.generator.get_closed_issues_since_last_tag"
+ )
@mock.patch("changelog_generator.generator.datetime")
@mock.patch("os.path.isfile")
@mock.patch("changelog_generator.generator.get_commits_since_date")
@@ -53,6 +78,7 @@ class TestGenerator(unittest.TestCase):
mock_get_commits,
mock_is_file,
mock_datetime,
+ mock_closed_issues,
):
mock_datetime.datetime.now.return_value = datetime.date(2018, 6, 18)
mock_is_file.return_value = True
@@ -64,6 +90,12 @@ class TestGenerator(unittest.TestCase):
"message": "Test commit message",
}
]
+ mock_closed_issues.return_value = [
+ {
+ "title": "A Closed Issue",
+ "closed_at": "2018-06-10T14:01:44.000+00:00",
+ }
+ ]
cli_args = {
"ip_address": "localhost",
@@ -85,17 +117,26 @@ class TestGenerator(unittest.TestCase):
[
mock.call("## v1 (2018-06-18)\n"),
mock.call("* 2018-06-10 - Test commit message \n"),
+ mock.call("\n### Closed Issues\n"),
+ mock.call("* A Closed Issue"),
mock.call("\n"),
mock.call("Existing data"),
]
)
self.assertEqual(result, "CHANGELOG.md updated successfully")
+ @mock.patch(
+ "changelog_generator.generator.get_closed_issues_since_last_tag"
+ )
@mock.patch("os.path.isfile")
@mock.patch("changelog_generator.generator.get_commits_since_date")
@mock.patch("changelog_generator.generator.get_last_commit_date")
def test_generate_changelog_new(
- self, mock_get_commit_date, mock_get_commits, mock_is_file
+ self,
+ mock_get_commit_date,
+ mock_get_commits,
+ mock_is_file,
+ mock_closed_issues,
):
mock_is_file.return_value = False
mock_get_commit_date.return_value = "2018-06-10T14:01:45.000000+00:00"
@@ -106,6 +147,12 @@ class TestGenerator(unittest.TestCase):
"message": "Test commit message",
}
]
+ mock_closed_issues.return_value = [
+ {
+ "title": "A Closed Issue",
+ "closed_at": "2018-06-10T14:01:44.000+00:00",
+ }
+ ]
cli_args = {
"ip_address": "localhost",
@@ -121,9 +168,77 @@ class TestGenerator(unittest.TestCase):
with mock.patch("builtins.open", mock.mock_open()) as mock_file:
result = generate_changelog(cli_args)
mock_file.assert_called_once_with(mock.ANY, "w")
- mock_file().write.assert_called_with(
- "* 2018-06-10 - Test commit message \n"
- )
+ mock_file_write_calls = [
+ mock.call(
+ f"## v1 ({datetime.datetime.now().strftime('%Y-%m-%d')})\n"
+ ),
+ mock.call("* 2018-06-10 - Test commit message \n"),
+ mock.call("\n### Closed Issues\n"),
+ mock.call("* A Closed Issue"),
+ ]
+ mock_file().write.assert_has_calls(mock_file_write_calls)
self.assertEqual(
result, "New CHANGELOG.md file written successfully"
)
+
+ @mock.patch("changelog_generator.generator.get_closed_issues_for_project")
+ @mock.patch("changelog_generator.generator.get_last_tagged_release_date")
+ def test_get_closed_issues_since_last_tag(
+ self, mock_release_date, mock_closed_project_issues
+ ):
+ mock_release_date.return_value = "2018-06-10T14:01:44.000+00:00"
+ mock_closed_project_issues.return_value = [
+ {
+ "closed_at": "2050-06-10T14:01:44.000+00:00",
+ "title": "A Closed Issue",
+ "assignee": 1,
+ }
+ ]
+
+ cli_args = {
+ "ip_address": "localhost",
+ "api_version": "4",
+ "project_group": "test-group",
+ "project": "test-project",
+ "branch_one": "release",
+ "branch_two": "master",
+ "version": "1",
+ "changelog": "N",
+ }
+
+ self.assertEqual(
+ get_closed_issues_since_last_tag(cli_args),
+ [
+ {
+ "closed_at": "2050-06-10T14:01:44.000+00:00",
+ "title": "A Closed Issue",
+ }
+ ],
+ )
+
+ @mock.patch("changelog_generator.generator.get_closed_issues_for_project")
+ @mock.patch("changelog_generator.generator.get_last_tagged_release_date")
+ def test_get_closed_issues_since_last_tag_no_issues(
+ self, mock_release_date, mock_closed_project_issues
+ ):
+ mock_release_date.return_value = "2018-06-10T14:01:44.000+00:00"
+ mock_closed_project_issues.return_value = [
+ {
+ "closed_at": "1990-06-10T14:01:44.000+00:00",
+ "title": "A Closed Issue",
+ "assignee": 1,
+ }
+ ]
+
+ cli_args = {
+ "ip_address": "localhost",
+ "api_version": "4",
+ "project_group": "test-group",
+ "project": "test-project",
+ "branch_one": "release",
+ "branch_two": "master",
+ "version": "1",
+ "changelog": "N",
+ }
+
+ self.assertEqual(get_closed_issues_since_last_tag(cli_args), [])
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 2
},
"num_modified_files": 4
}
|
1.0
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "pytest",
"pip_packages": [
"pytest",
"mock",
"python-dateutil"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.7",
"reqs_path": null,
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs @ file:///croot/attrs_1668696182826/work
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
flit_core @ file:///opt/conda/conda-bld/flit-core_1644941570762/work/source/flit_core
-e git+https://github.com/stuartmccoll/gitlab-changelog-generator.git@7e6b2ef2d74c19b89f88eda28c4b1b912d2aab1c#egg=gitlab_changelog_generator
idna==3.10
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1648562407465/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mock==5.2.0
packaging @ file:///croot/packaging_1671697413597/work
pluggy @ file:///tmp/build/80754af9/pluggy_1648042572264/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pytest==7.1.2
python-dateutil==2.9.0.post0
requests==2.31.0
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
typing_extensions @ file:///croot/typing_extensions_1669924550328/work
urllib3==2.0.7
zipp @ file:///croot/zipp_1672387121353/work
|
name: gitlab-changelog-generator
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- attrs=22.1.0=py37h06a4308_0
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2022.12.7=py37h06a4308_0
- flit-core=3.6.0=pyhd3eb1b0_0
- importlib-metadata=4.11.3=py37h06a4308_0
- importlib_metadata=4.11.3=hd3eb1b0_0
- iniconfig=1.1.1=pyhd3eb1b0_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- packaging=22.0=py37h06a4308_0
- pip=22.3.1=py37h06a4308_0
- pluggy=1.0.0=py37h06a4308_1
- py=1.11.0=pyhd3eb1b0_0
- pytest=7.1.2=py37h06a4308_0
- python=3.7.16=h7a1cb2a_0
- readline=8.2=h5eee18b_0
- setuptools=65.6.3=py37h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tomli=2.0.1=py37h06a4308_0
- typing_extensions=4.4.0=py37h06a4308_0
- wheel=0.38.4=py37h06a4308_0
- xz=5.6.4=h5eee18b_1
- zipp=3.11.0=py37h06a4308_0
- zlib=1.2.13=h5eee18b_1
- pip:
- charset-normalizer==3.4.1
- idna==3.10
- mock==5.2.0
- python-dateutil==2.9.0.post0
- requests==2.31.0
- six==1.17.0
- urllib3==2.0.7
prefix: /opt/conda/envs/gitlab-changelog-generator
|
[
"changelog_generator/tests/test_calls.py::TestCalls::test_commits_since_date",
"changelog_generator/tests/test_calls.py::TestCalls::test_get_closed_issues_for_project",
"changelog_generator/tests/test_calls.py::TestCalls::test_get_last_commit_date",
"changelog_generator/tests/test_calls.py::TestCalls::test_get_last_tagged_release_date",
"changelog_generator/tests/test_calls.py::TestCalls::test_unsuccessful_commits_since_date",
"changelog_generator/tests/test_calls.py::TestCalls::test_unsuccessful_get_last_commit_date",
"changelog_generator/tests/test_generator.py::TestGenerator::test_generate_changelog_new",
"changelog_generator/tests/test_generator.py::TestGenerator::test_generate_changelog_update",
"changelog_generator/tests/test_generator.py::TestGenerator::test_get_closed_issues_since_last_tag",
"changelog_generator/tests/test_generator.py::TestGenerator::test_get_closed_issues_since_last_tag_no_issues"
] |
[
"changelog_generator/tests/test_generator.py::TestGenerator::test_generate_changelog_existing"
] |
[] |
[] |
MIT License
| 3,301 |
[
".gitignore",
".travis.yml",
"changelog_generator/calls.py",
"changelog_generator/generator.py"
] |
[
".gitignore",
".travis.yml",
"changelog_generator/calls.py",
"changelog_generator/generator.py"
] |
|
cekit__cekit-323
|
6a7fbc5e7bf675fedd137d4c5f58064084a627ef
|
2018-10-23 10:17:13
|
6a7fbc5e7bf675fedd137d4c5f58064084a627ef
|
jmtd: I might raise a second PR to implement a test based on the stuff in #322 comments
jmtd: > I might raise a second PR to implement a test based on the stuff in #322 comments
done
|
diff --git a/cekit/builders/docker_builder.py b/cekit/builders/docker_builder.py
index cca5865..7383404 100644
--- a/cekit/builders/docker_builder.py
+++ b/cekit/builders/docker_builder.py
@@ -50,9 +50,9 @@ class DockerBuilder(Builder):
logger.info("Building container image...")
try:
- last_tag = ""
+ docker_layer_ids = []
out = docker_client.build(**args)
- lastmsg = ""
+ build_log = [""]
for line in out:
if b'stream' in line:
line = yaml.safe_load(line)['stream']
@@ -63,14 +63,17 @@ class DockerBuilder(Builder):
raise CekitError("Image build failed: '%s'" % line)
if '---> Running in ' in line:
- last_tag = line.split(' ')[-1]
+ docker_layer_ids.append(line.split(' ')[-1])
- if line != lastmsg:
+ if '---> Using cache' in build_log[-1]:
+ docker_layer_ids.append(line.split(' ')[-1])
+
+ if line != build_log[-1]:
# this prevents poluting cekit log with dowloading/extracting msgs
log_msg = ANSI_ESCAPE.sub('', line).strip()
for msg in log_msg.split('\n'):
logger.info('Docker: %s' % msg)
- lastmsg = line
+ build_log.append(line)
for tag in self._tags[1:]:
if ':' in tag:
@@ -82,14 +85,14 @@ class DockerBuilder(Builder):
% ", ".join(self._tags))
except Exception as ex:
- if last_tag:
- failed_img = self._tags[0] + '-failed'
- if ':' in failed_img:
- img_repo, img_tag = failed_img.split(":")
- docker_client.commit(last_tag, img_repo, tag=img_tag)
- else:
- docker_client.commit(last_tag, failed_img)
-
+ msg = "Image build failed, see logs above."
+ if len(docker_layer_ids) >= 2:
logger.error("You can look inside the failed image by running "
- "'docker run --rm -ti %s bash'" % failed_img)
- raise CekitError("Image build failed, see logs above.", ex)
+ "'docker run --rm -ti %s bash'" % docker_layer_ids[-2])
+ if "To enable Red Hat Subscription Management repositories:" in ' '.join(build_log) and \
+ not os.path.exists(os.path.join(self.target, 'image', 'repos')):
+ msg = "Image build failed with a yum error and you don't " \
+ "have any yum repository configured, please check " \
+ "your image/module descriptor for proper repository " \
+ " definitions."
+ raise CekitError(msg, ex)
diff --git a/cekit/cli.py b/cekit/cli.py
index edc011b..c97f557 100644
--- a/cekit/cli.py
+++ b/cekit/cli.py
@@ -59,6 +59,12 @@ class Cekit(object):
dest='work_dir',
help="Location of Cekit working directory.")
+ parser.add_argument('--package-manager',
+ dest='package_manager',
+ choices=['yum', 'microdnf'],
+ help='Package manager to use. Supports yum and microdnf, \
+ defaults: yum')
+
test_group = parser.add_argument_group('test',
"Arguments valid for the 'test' target")
@@ -182,7 +188,8 @@ class Cekit(object):
config.configure(self.args.config, {'redhat': self.args.redhat,
'work_dir': self.args.work_dir,
- 'addhelp': self.args.addhelp})
+ 'addhelp': self.args.addhelp,
+ 'package_manager': self.args.package_manager})
cleanup(self.args.target)
@@ -191,7 +198,8 @@ class Cekit(object):
params = {
'addhelp': config.get('doc', 'addhelp'),
'redhat': config.get('common', 'redhat'),
- 'help_template': config.get('doc', 'help_template')
+ 'help_template': config.get('doc', 'help_template'),
+ 'package_manager': config.get('common', 'package_manager')
}
self.generator = Generator(self.args.descriptor,
@@ -273,7 +281,7 @@ class Cekit(object):
if self.args.verbose:
logger.exception(e)
else:
- logger.error(str(e))
+ logger.error(e.message)
sys.exit(1)
diff --git a/cekit/config.py b/cekit/config.py
index e6f8fe0..75cfa5d 100644
--- a/cekit/config.py
+++ b/cekit/config.py
@@ -22,6 +22,8 @@ class Config(object):
cls.cfg['common']['redhat'] = cmdline_args.get('redhat')
if cmdline_args.get('work_dir'):
cls.cfg['common']['work_dir'] = cmdline_args.get('work_dir')
+ if cmdline_args.get('package_manager'):
+ cls.cfg['common']['package_manager'] = cmdline_args.get('package_manager')
if isinstance(cmdline_args.get('addhelp'), bool):
cls.cfg['doc']['addhelp'] = cmdline_args.get('addhelp')
@@ -39,6 +41,8 @@ class Config(object):
cls.cfg['common']['work_dir'] = cls.cfg.get('common').get('work_dir', '~/.cekit')
cls.cfg['common']['redhat'] = yaml.safe_load(
cls.cfg.get('common', {}).get('redhat', 'False'))
+ cls.cfg['common']['package_manager'] = yaml.safe_load(
+ cls.cfg.get('common', {}).get('package_manager', 'yum'))
cls.cfg['doc'] = cls.cfg.get('doc', {})
cls.cfg['doc']['addhelp'] = yaml.safe_load(
diff --git a/cekit/errors.py b/cekit/errors.py
index 6d45af9..54d1627 100644
--- a/cekit/errors.py
+++ b/cekit/errors.py
@@ -1,7 +1,5 @@
+class CekitError(Exception):
-class Error(Exception):
- pass
-
-
-class CekitError(Error):
- pass
+ def __init__(self, message, *args, **kwargs):
+ super(CekitError, self).__init__(message, *args, **kwargs)
+ self.message = message
diff --git a/cekit/generator/base.py b/cekit/generator/base.py
index a2d00ce..cfa46b2 100644
--- a/cekit/generator/base.py
+++ b/cekit/generator/base.py
@@ -185,6 +185,7 @@ class Generator(object):
if self._params.get('redhat'):
self._inject_redhat_defaults()
+ self.image['pkg_manager'] = self._params.get('package_manager', 'yum')
self.image.process_defaults()
template_file = os.path.join(os.path.dirname(__file__),
diff --git a/cekit/module.py b/cekit/module.py
index 711b7a8..c3ca796 100644
--- a/cekit/module.py
+++ b/cekit/module.py
@@ -40,7 +40,7 @@ def copy_module_to_target(name, version, target):
check_module_version(dest, version)
if not os.path.exists(dest):
- logger.debug("Copying module '%s' to: '%s'" % (name, dest))
+ logger.debug("Copying module '%s' from '%s' to: '%s'" % (name, module.path, dest))
shutil.copytree(module.path, dest)
return module
@@ -51,9 +51,9 @@ def check_module_version(path, version):
descriptor = Module(tools.load_descriptor(os.path.join(path, 'module.yaml')),
path,
os.path.dirname(os.path.abspath(os.path.join(path, 'module.yaml'))))
- if descriptor.version != version:
+ if hasattr(descriptor, 'version') and descriptor.version != version:
raise CekitError("Requested conflicting version '%s' of module '%s'" %
- (version, descriptor['name']))
+ (version, descriptor['name']))
def get_dependencies(descriptor, base_dir):
diff --git a/cekit/templates/template.jinja b/cekit/templates/template.jinja
index bdde650..8daa324 100644
--- a/cekit/templates/template.jinja
+++ b/cekit/templates/template.jinja
@@ -1,3 +1,29 @@
+{% macro repo_create(pkg_manager, repositories) -%}
+ {% if pkg_manager in ['microdnf', 'yum'] %}
+ {% for repo in repositories %}
+repos/{{ repo.filename }} \
+ {% endfor %}
+ /etc/yum.repos.d/
+ {% endif %}
+{%- endmacro %}
+{% macro repo_remove(pkg_manager, repositories) -%}
+ {% if pkg_manager in ['microdnf', 'yum'] %}
+rm{% for repo in repositories %} /etc/yum.repos.d/{{ repo.filename }}{% endfor %}
+ {% endif %}
+{%- endmacro %}
+{% macro repo_install(pkg_manager, rpm) -%}
+ {% if pkg_manager in ['microdnf', 'yum'] %}
+{{ pkg_manager }} install -y {{ rpm }} \
+ && {{ pkg_manager }} clean all && rm -rf /var/cache/yum
+ {% endif %}
+{%- endmacro %}
+{% macro pkg_install(pkg_manager, packages) -%}
+ {% if pkg_manager in ['microdnf', 'yum'] %}
+{{ pkg_manager }} install -y {%- for package in packages %} {{ package }}{% endfor %} \
+ && {{ pkg_manager }} clean all && rm -rf /var/cache/yum \
+ && rpm -q {% for package in packages %}{{ package }}{% endfor %}
+ {% endif %}
+{%- endmacro %}
# Copyright 2017 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,30 +49,24 @@ USER root
{% if packages and packages.install %}
{% if packages.repositories_injected %}
# Add custom repo files
-COPY \ {% for repo in packages.repositories_injected %}
- repos/{{ repo.filename }} \
-{% endfor %}
- /etc/yum.repos.d/
+COPY {{ repo_create(pkg_manager, packages.repositories_injected) }}
{% endif %}
{% if packages.repositories %}
{% for repo in packages.repositories %}
{% if repo.present and repo.rpm %}
-RUN yum install -y {{ repo.rpm }} \
- && yum clean all && rm -rf /var/cache/yum
+RUN {{ repo_install(pkg_manager, repo.rpm) }}
{% endif %}
{% endfor %}
{% endif %}
# Install required RPMs and ensure that the packages were installed
-RUN yum install -y {%- for package in packages.install %} {{ package }}{% endfor %} \
- && yum clean all && rm -rf /var/cache/yum && \
- rpm -q {% for package in packages.install %} {{ package }}{% endfor %}
+RUN {{ pkg_install(pkg_manager, packages.install) }}
{% if packages.repositories_injected %}
# Remove custom repo files
-RUN rm{% for repo in packages.repositories_injected %} /etc/yum.repos.d/{{ repo.filename }}{% endfor %}
+RUN {{ repo_remove(pkg_manager, packages.repositories_injected) }}
{% endif %}
diff --git a/completion/bash/cekit b/completion/bash/cekit
index 2398fe7..13c1599 100755
--- a/completion/bash/cekit
+++ b/completion/bash/cekit
@@ -81,6 +81,7 @@ _cekit_complete()
options+='--version '
options+='--config '
options+='--redhat '
+ options+='--package-manager '
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
return
fi
diff --git a/completion/zsh/_cekit b/completion/zsh/_cekit
index cb33cc1..b2b0db7 100644
--- a/completion/zsh/_cekit
+++ b/completion/zsh/_cekit
@@ -30,6 +30,7 @@ _cekit() {
"--config[path for cekit config file (~/.cekit/config is default)]:config:_files" \
"--redhat[Set default options for Red Hat internal infrastructure]" \
"--work-dir[Location of cekit working directory, it's used to store dist-git repos]:workdir:_files -/" \
+ "--package-manager[Package manager to use for installing dependencies. default: 'yum']:package_manager:" \
"*--tag[tag used to build/test the image, can be used multiple times]:tags:" \
"*--overrides[a YAML object to override image descriptor, can be used multiple times]:overrides:" \
"*--overrides-file[path to a file containing overrides, can be used multiple times]:overrides-files:_files" \
diff --git a/docs/build.rst b/docs/build.rst
index 74eca71..33145df 100644
--- a/docs/build.rst
+++ b/docs/build.rst
@@ -23,6 +23,7 @@ You can execute an container image build by running:
* `--add-help`` -- add generated `help.md` file to the image
* `--no-add-help`` -- don't add generated `help.md` file to the image
* ``--work-dir`` -- sets Cekit works directory where dist_git repositories are cloned into See :ref:`Configuration section for work_dir<workdir_config>`
+* ``--package-manager`` -- allows selecting between different package managers such as ``yum`` or ``microdnf``. Defaults to ``yum```
* ``--build-engine`` -- a builder engine to use ``osbs``, ``buildah`` or ``docker`` [#f1]_
* ``--build-pull`` -- ask a builder engine to check and fetch latest base image
* ``--build-osbs-stage`` -- use ``rhpkg-stage`` tool instead of ``rhpkg``
@@ -32,7 +33,7 @@ You can execute an container image build by running:
* ``--build-osbs-commit-msg`` -- custom commit message for dist-git
* ``--build-osbs-nowait`` -- run `rhpkg container-build` with `--nowait` option specified
* ``--build-tech-preview`` [#f2]_ -- updates image descriptor ``name`` key to contain ``-tech-preview`` suffix in family part of the image name
-
+
**Example**: If your ``name`` in image descriptor is: ``jboss-eap-7/eap7``, generated name will be: ``jboss-eap-7-tech-preview/eap7``.
.. [#f1] docker build engine is default
|
AttributeError: 'Module' object has no attribute 'version' with certain module dependency graph
Given this stripped-down example of inter-dependent modules, that looks like this:

The version dependency from image.yaml is crucial to reproduce the bug
image.yaml:
```
schema_version: 1
from: "rhel7"
name: "testimage"
version: "1.0"
modules:
repositories:
- path: modules
install:
- name: a
version: "foo"
- name: b
```
modules/a/module.yaml:
```
schema_version: 1
name: a
version: "foo"
```
modules/b/module.yaml:
```
schema_version: 1
name: b
version: '1.0'
modules:
install:
- name: c
```
modules/c/module.yaml:
```
schema_version: 1
name: c
version: '1.0'
modules:
install:
- name: d
```
modules/d/module.yaml:
```
schema_version: 1
name: d
version: '1.0'
modules:
install:
- name: a
```
The result is as follows
```
$ cekit -v generate
2018-10-19 08:35:32,942 cekit DEBUG Running version 2.1.4
2018-10-19 08:35:32,943 cekit INFO Generating files for docker engine.
2018-10-19 08:35:32,944 cekit DEBUG Loading descriptor from path 'image.yaml'.
2018-10-19 08:35:32,974 cekit INFO Initializing image descriptor...
2018-10-19 08:35:32,974 cekit DEBUG Retrieving module repositories for 'testimage'
2018-10-19 08:35:32,975 cekit DEBUG Preparing resource 'modules'
2018-10-19 08:35:32,975 cekit DEBUG Copying repository from '/home/ce/mod-bug/strip/redhat-openjdk-18-openshift-image/modules' to 'target/repo/modules'.
2018-10-19 08:35:32,982 cekit DEBUG Loading descriptor from path 'target/repo/modules/a/module.yaml'.
2018-10-19 08:35:32,985 cekit DEBUG Retrieving module repositories for 'a'
2018-10-19 08:35:32,985 cekit DEBUG No module repositories specified in descriptor
2018-10-19 08:35:32,985 cekit DEBUG Adding module 'a', path: 'target/repo/modules/a'
2018-10-19 08:35:32,985 cekit DEBUG Loading descriptor from path 'target/repo/modules/b/module.yaml'.
2018-10-19 08:35:32,989 cekit DEBUG Retrieving module repositories for 'b'
2018-10-19 08:35:32,989 cekit DEBUG No module repositories specified in descriptor
2018-10-19 08:35:32,989 cekit DEBUG Adding module 'b', path: 'target/repo/modules/b'
2018-10-19 08:35:32,989 cekit DEBUG Loading descriptor from path 'target/repo/modules/c/module.yaml'.
2018-10-19 08:35:32,993 cekit DEBUG Retrieving module repositories for 'c'
2018-10-19 08:35:32,993 cekit DEBUG No module repositories specified in descriptor
2018-10-19 08:35:32,993 cekit DEBUG Adding module 'c', path: 'target/repo/modules/c'
2018-10-19 08:35:32,993 cekit DEBUG Loading descriptor from path 'target/repo/modules/d/module.yaml'.
2018-10-19 08:35:32,996 cekit DEBUG Retrieving module repositories for 'd'
2018-10-19 08:35:32,996 cekit DEBUG No module repositories specified in descriptor
2018-10-19 08:35:32,997 cekit DEBUG Adding module 'd', path: 'target/repo/modules/d'
2018-10-19 08:35:32,997 cekit DEBUG Loading descriptor from path 'target/repo/modules/a/module.yaml'.
2018-10-19 08:35:32,999 cekit DEBUG Retrieving module repositories for 'a'
2018-10-19 08:35:32,999 cekit DEBUG No module repositories specified in descriptor
2018-10-19 08:35:32,999 cekit DEBUG Adding module 'a', path: 'target/repo/modules/a'
2018-10-19 08:35:32,999 cekit DEBUG Loading descriptor from path 'target/repo/modules/b/module.yaml'.
2018-10-19 08:35:33,004 cekit DEBUG Retrieving module repositories for 'b'
2018-10-19 08:35:33,004 cekit DEBUG No module repositories specified in descriptor
2018-10-19 08:35:33,004 cekit DEBUG Adding module 'b', path: 'target/repo/modules/b'
2018-10-19 08:35:33,004 cekit DEBUG Loading descriptor from path 'target/repo/modules/c/module.yaml'.
2018-10-19 08:35:33,007 cekit DEBUG Retrieving module repositories for 'c'
2018-10-19 08:35:33,007 cekit DEBUG No module repositories specified in descriptor
2018-10-19 08:35:33,007 cekit DEBUG Adding module 'c', path: 'target/repo/modules/c'
2018-10-19 08:35:33,007 cekit DEBUG Loading descriptor from path 'target/repo/modules/d/module.yaml'.
2018-10-19 08:35:33,011 cekit DEBUG Retrieving module repositories for 'd'
2018-10-19 08:35:33,011 cekit DEBUG No module repositories specified in descriptor
2018-10-19 08:35:33,011 cekit DEBUG Adding module 'd', path: 'target/repo/modules/d'
2018-10-19 08:35:33,012 cekit DEBUG Preparing module 'b' requested by 'testimage'.
2018-10-19 08:35:33,012 cekit DEBUG Copying module 'b' to: 'target/image/modules/b'
2018-10-19 08:35:33,012 cekit DEBUG Preparing module 'c' requested by 'b'.
2018-10-19 08:35:33,013 cekit DEBUG Copying module 'c' to: 'target/image/modules/c'
2018-10-19 08:35:33,013 cekit DEBUG Preparing module 'd' requested by 'c'.
2018-10-19 08:35:33,013 cekit DEBUG Copying module 'd' to: 'target/image/modules/d'
2018-10-19 08:35:33,014 cekit DEBUG Preparing module 'a' requested by 'd'.
2018-10-19 08:35:33,014 cekit DEBUG Copying module 'a' to: 'target/image/modules/a'
2018-10-19 08:35:33,017 cekit DEBUG Merging 'a' module into 'd'.
2018-10-19 08:35:33,017 cekit DEBUG Merging 'd' module into 'c'.
2018-10-19 08:35:33,017 cekit DEBUG Merging 'c' module into 'b'.
2018-10-19 08:35:33,018 cekit DEBUG Merging 'b' module into 'testimage'.
2018-10-19 08:35:33,018 cekit DEBUG Preparing module 'a' requested by 'testimage'.
2018-10-19 08:35:33,018 cekit DEBUG Loading descriptor from path 'target/image/modules/a/module.yaml'.
Traceback (most recent call last):
File "/usr/bin/cekit", line 9, in <module>
load_entry_point('cekit==2.1.4', 'console_scripts', 'cekit')()
File "/usr/lib/python2.7/site-packages/cekit/cli.py", line 283, in run
Cekit().parse().run()
File "/usr/lib/python2.7/site-packages/cekit/cli.py", line 222, in run
generator.prepare_modules()
File "/usr/lib/python2.7/site-packages/cekit/generator/base.py", line 102, in prepare_modules
os.path.join(self.target, 'image', 'modules'))
File "/usr/lib/python2.7/site-packages/cekit/module.py", line 40, in copy_module_to_target
check_module_version(dest, version)
File "/usr/lib/python2.7/site-packages/cekit/module.py", line 54, in check_module_version
if descriptor.version != version:
AttributeError: 'Module' object has no attribute 'version'
```
|
cekit/cekit
|
diff --git a/tests/issue_322/image.yaml b/tests/issue_322/image.yaml
new file mode 100644
index 0000000..ba3ceb0
--- /dev/null
+++ b/tests/issue_322/image.yaml
@@ -0,0 +1,13 @@
+schema_version: 1
+
+from: "rhel7"
+name: "testimage"
+version: "1.0"
+
+modules:
+ repositories:
+ - path: modules
+ install:
+ - name: a
+ version: "foo"
+ - name: b
diff --git a/tests/issue_322/modules/a/module.yaml b/tests/issue_322/modules/a/module.yaml
new file mode 100644
index 0000000..eac2e6b
--- /dev/null
+++ b/tests/issue_322/modules/a/module.yaml
@@ -0,0 +1,3 @@
+schema_version: 1
+name: a
+version: "foo"
diff --git a/tests/issue_322/modules/b/module.yaml b/tests/issue_322/modules/b/module.yaml
new file mode 100644
index 0000000..7263d7b
--- /dev/null
+++ b/tests/issue_322/modules/b/module.yaml
@@ -0,0 +1,7 @@
+schema_version: 1
+name: b
+version: '1.0'
+
+modules:
+ install:
+ - name: c
diff --git a/tests/issue_322/modules/c/module.yaml b/tests/issue_322/modules/c/module.yaml
new file mode 100644
index 0000000..15e74c5
--- /dev/null
+++ b/tests/issue_322/modules/c/module.yaml
@@ -0,0 +1,7 @@
+schema_version: 1
+name: c
+version: '1.0'
+
+modules:
+ install:
+ - name: d
diff --git a/tests/issue_322/modules/d/module.yaml b/tests/issue_322/modules/d/module.yaml
new file mode 100644
index 0000000..9e6fb07
--- /dev/null
+++ b/tests/issue_322/modules/d/module.yaml
@@ -0,0 +1,7 @@
+schema_version: 1
+name: d
+version: '1.0'
+
+modules:
+ install:
+ - name: a
diff --git a/tests/test_dockerfile.py b/tests/test_dockerfile.py
index ba4b627..971fd9f 100644
--- a/tests/test_dockerfile.py
+++ b/tests/test_dockerfile.py
@@ -143,6 +143,21 @@ def test_dockerfile_docker_odcs_rpm(tmpdir, mocker):
generator.render_dockerfile()
regex_dockerfile(target, 'RUN yum install -y foo-repo.rpm')
+def test_dockerfile_docker_odcs_rpm_microdnf(tmpdir, mocker):
+ mocker.patch.object(subprocess, 'check_output', return_value=odcs_fake_resp)
+ mocker.patch.object(Repository, 'fetch')
+ target = str(tmpdir.mkdir('target'))
+ desc_part = {'packages': {'repositories': [{'name': 'foo',
+ 'rpm': 'foo-repo.rpm'}],
+ 'install': ['a']}}
+
+ generator = prepare_generator(target, desc_part, 'image')
+ generator._params['package_manager'] = 'microdnf'
+ generator.prepare_repositories()
+ generator.render_dockerfile()
+ regex_dockerfile(target, 'RUN microdnf install -y foo-repo.rpm')
+ regex_dockerfile(target, 'RUN microdnf install -y a')
+ regex_dockerfile(target, 'rpm -q a')
def test_dockerfile_osbs_odcs_pulp(tmpdir, mocker):
mocker.patch.object(subprocess, 'check_output', return_value=odcs_fake_resp)
@@ -279,7 +294,24 @@ def test_dockerfile_osbs_odcs_rpm(tmpdir, mocker):
generator.render_dockerfile()
regex_dockerfile(target, 'RUN yum install -y foo-repo.rpm')
-
+
+def test_dockerfile_osbs_odcs_rpm_microdnf(tmpdir, mocker):
+ mocker.patch.object(subprocess, 'check_output', return_value=odcs_fake_resp)
+ mocker.patch.object(Repository, 'fetch')
+ target = str(tmpdir.mkdir('target'))
+ desc_part = {'packages': {'repositories': [{'name': 'foo',
+ 'rpm': 'foo-repo.rpm'}],
+ 'install': ['a']}}
+
+ generator = prepare_generator(target, desc_part, 'image', 'osbs')
+ generator._params['package_manager'] = 'microdnf'
+ generator.prepare_repositories()
+ generator.render_dockerfile()
+ regex_dockerfile(target, 'RUN microdnf install -y foo-repo.rpm')
+ regex_dockerfile(target, 'RUN microdnf install -y a')
+ regex_dockerfile(target, 'rpm -q a')
+
+
def prepare_generator(target, desc_part, desc_type="image", engine="docker"):
# create basic descriptor
diff --git a/tests/test_unit_module.py b/tests/test_unit_module.py
index 31b7e4f..49d6761 100644
--- a/tests/test_unit_module.py
+++ b/tests/test_unit_module.py
@@ -1,8 +1,10 @@
import os
+import yaml
from cekit.config import Config
from cekit.descriptor import Module
from cekit.module import modules
+from cekit.generator.base import Generator
module_desc = {
'schema_version': 1,
@@ -26,3 +28,18 @@ def test_modules_repos(tmpdir):
module = Module(module_desc, os.getcwd(), '/tmp')
module.fetch_dependencies(tmpdir)
assert 'foo' in [m['name'] for m in modules]
+
+def test_issue_322(tmpdir):
+ """tests a particular inheritance issue reported as GitHub issue #322"""
+ target_dir = str(tmpdir.mkdir('target'))
+ artifact_dir = str(tmpdir.mkdir('artifacts'))
+ clone_dir = str(tmpdir.mkdir('clone'))
+
+ descriptor = yaml.load(open("tests/issue_322/image.yaml").read())
+ image = Module(descriptor=descriptor, path="tests/issue_322", artifact_dir=artifact_dir)
+ image.fetch_dependencies(clone_dir)
+
+ generator = Generator.__new__(Generator, descriptor_path="tests/issue_322", target=target_dir, builder="docker", overrides=None, params={})
+ generator.image = image
+ generator.target = target_dir
+ generator.prepare_modules()
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_git_commit_hash",
"has_media",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 10
}
|
2.1
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"pytest-cov",
"pytest-mock",
"pytest-asyncio"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
-e git+https://github.com/cekit/cekit.git@6a7fbc5e7bf675fedd137d4c5f58064084a627ef#egg=cekit
certifi==2025.1.31
charset-normalizer==3.4.1
colorlog==6.9.0
coverage==7.8.0
docker==7.1.0
docopt==0.6.2
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
Jinja2==3.1.6
MarkupSafe==3.0.2
packaging==24.2
pluggy==1.5.0
pykwalify==1.8.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
ruamel.yaml==0.18.10
ruamel.yaml.clib==0.2.12
six==1.17.0
tomli==2.2.1
typing_extensions==4.13.0
urllib3==2.3.0
|
name: cekit
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- colorlog==6.9.0
- coverage==7.8.0
- docker==7.1.0
- docopt==0.6.2
- exceptiongroup==1.2.2
- idna==3.10
- iniconfig==2.1.0
- jinja2==3.1.6
- markupsafe==3.0.2
- packaging==24.2
- pluggy==1.5.0
- pykwalify==1.8.0
- pytest==8.3.5
- pytest-asyncio==0.26.0
- pytest-cov==6.0.0
- pytest-mock==3.14.0
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- ruamel-yaml==0.18.10
- ruamel-yaml-clib==0.2.12
- six==1.17.0
- tomli==2.2.1
- typing-extensions==4.13.0
- urllib3==2.3.0
prefix: /opt/conda/envs/cekit
|
[
"tests/test_dockerfile.py::test_dockerfile_docker_odcs_rpm_microdnf",
"tests/test_dockerfile.py::test_dockerfile_osbs_odcs_rpm_microdnf"
] |
[
"tests/test_unit_module.py::test_modules_repos",
"tests/test_unit_module.py::test_issue_322"
] |
[
"tests/test_dockerfile.py::test_dockerfile_rendering[test_run_user-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_default_run_user-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_custom_cmd-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_entrypoint-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_workdir-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_volumes-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_ports-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_env-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_execute-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_execute_user-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_concrt_label_version-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering[test_cekit_label_version-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering_tech_preview[test_without_family-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_rendering_tech_preview[test_with_family-\\x08-\\x08]",
"tests/test_dockerfile.py::test_dockerfile_docker_odcs_pulp",
"tests/test_dockerfile.py::test_dockerfile_docker_odcs_rpm",
"tests/test_dockerfile.py::test_dockerfile_osbs_odcs_pulp",
"tests/test_dockerfile.py::test_dockerfile_osbs_odcs_pulp_no_redhat",
"tests/test_dockerfile.py::test_dockerfile_osbs_id_redhat",
"tests/test_dockerfile.py::test_dockerfile_osbs_id_redhat_false",
"tests/test_dockerfile.py::test_dockerfile_osbs_url_only",
"tests/test_dockerfile.py::test_dockerfile_osbs__and_url_",
"tests/test_dockerfile.py::test_dockerfile_osbs_odcs_rpm"
] |
[] |
MIT License
| 3,302 |
[
"cekit/config.py",
"cekit/generator/base.py",
"cekit/module.py",
"cekit/cli.py",
"cekit/templates/template.jinja",
"docs/build.rst",
"completion/zsh/_cekit",
"completion/bash/cekit",
"cekit/builders/docker_builder.py",
"cekit/errors.py"
] |
[
"cekit/config.py",
"cekit/generator/base.py",
"cekit/module.py",
"cekit/cli.py",
"cekit/templates/template.jinja",
"docs/build.rst",
"completion/zsh/_cekit",
"completion/bash/cekit",
"cekit/builders/docker_builder.py",
"cekit/errors.py"
] |
terryyin__lizard-241
|
b631dfd3561366539633a7279f755e237541f3bf
|
2018-10-23 11:19:34
|
b631dfd3561366539633a7279f755e237541f3bf
|
Coeur: There is a Travis test failing on:
class Time
{
var minutes: Double
{
get
{
return (seconds / 60)
}
set
{
self.seconds = (newValue * 60)
}
}
}
The reason may be that `'\n'` isn't the correct way to identify a newline token?
Coeur: If a newline can't be tokenized, an alternative may be to leave the state on `:` and `=`.
|
diff --git a/lizard_languages/swift.py b/lizard_languages/swift.py
index 8aea377..a7f4795 100644
--- a/lizard_languages/swift.py
+++ b/lizard_languages/swift.py
@@ -30,17 +30,24 @@ class SwiftStates(CodeStateMachine): # pylint: disable=R0903
def _state_global(self, token):
if token == 'func':
self._state = self._function_name
- if token == 'init':
+ if token in ('init', 'subscript'):
self._function_name(token)
- if token in ('get', 'set', 'deinit'):
+ if token in ('get', 'set', 'willSet', 'didSet', 'deinit'):
self.context.start_new_function(token)
self._state = self._expect_function_impl
if token == 'protocol':
self._state = self._protocol
+ if token in ('let', 'var', 'case', ','):
+ self._state = self._expect_declaration_name
+
+ def _expect_declaration_name(self, token):
+ if token != '`':
+ self._state = self._state_global
def _function_name(self, token):
- self.context.start_new_function(token)
- self._state = self._expect_function_dec
+ if token != '`':
+ self.context.start_new_function(token)
+ self._state = self._expect_function_dec
def _expect_function_dec(self, token):
if token == '(':
|
Incorrect behavior when a variable named `get` is used in Swift
I have the following Swift file, but lizard (master branch at b631dfd3561366539633a7279f755e237541f3bf) believes it is one single giant getter:
```
// AFNetworkingWrapper.swift
// Created by Antoine Cœur on 20/10/2016.
// Copyright © 2016 EF Education. All rights reserved.
/*...*/
/// HTTP method definitions.
///
/// See https://tools.ietf.org/html/rfc7231#section-4.3
public enum HTTPMethod: String {
case options = "OPTIONS"
case get = "GET"
case head = "HEAD"
case post = "POST"
case put = "PUT"
case patch = "PATCH"
case delete = "DELETE"
case trace = "TRACE"
case connect = "CONNECT"
}
extension AFHTTPSessionManager {
convenience init(baseURL url: URL?, requestEncoding: ParameterSerializer?, responseEncoding: ParameterSerializer? = nil) {
self.init(baseURL: url)
/*...*/
}
func foo(_ requestHeaders: [String:String]) {
/*...*/
}
func bar(_ requestHeaders: [String:String]) {
/*...*/
}
/*...*/
}
```
lizard output:
```
$ python lizard.py AFNetworkingWrapper.swift
================================================
NLOC CCN token PARAM length location
------------------------------------------------
106 29 714 0 118 get@29-146@/coeur/AFNetworkingWrapper.swift
1 file analyzed.
==============================================================
NLOC Avg.NLOC AvgCCN Avg.token function_cnt file
--------------------------------------------------------------
115 106.0 29.0 714.0 1 /coeur/AFNetworkingWrapper.swift
=========================================================================================
!!!! Warnings (cyclomatic_complexity > 15 or length > 1000 or parameter_count > 100) !!!!
================================================
NLOC CCN token PARAM length location
------------------------------------------------
106 29 714 0 118 get@29-146@/coeur/AFNetworkingWrapper.swift
==========================================================================================
Total nloc Avg.NLOC AvgCCN Avg.token Fun Cnt Warning cnt Fun Rt nloc Rt
------------------------------------------------------------------------------------------
115 106.0 29.0 714.0 1 1 1.00 1.00
```
|
terryyin/lizard
|
diff --git a/test/test_languages/testSwift.py b/test/test_languages/testSwift.py
index 06bed37..0fec26e 100644
--- a/test/test_languages/testSwift.py
+++ b/test/test_languages/testSwift.py
@@ -93,18 +93,39 @@ class Test_parser_for_Swift(unittest.TestCase):
''')
self.assertEqual(0, len(result))
+#https://docs.swift.org/swift-book/LanguageGuide/Initialization.html
def test_init(self):
result = get_swift_function_list('''
init() {}
''')
self.assertEqual("init", result[0].name)
+#https://docs.swift.org/swift-book/LanguageGuide/Deinitialization.html
def test_deinit(self):
result = get_swift_function_list('''
deinit {}
''')
self.assertEqual("deinit", result[0].name)
+#https://docs.swift.org/swift-book/LanguageGuide/Subscripts.html
+ def test_subscript(self):
+ result = get_swift_function_list('''
+ override subscript(index: Int) -> Int {}
+ ''')
+ self.assertEqual("subscript", result[0].name)
+
+#https://stackoverflow.com/a/30593673
+ def test_labeled_subscript(self):
+ result = get_swift_function_list('''
+ extension Collection {
+ /// Returns the element at the specified index iff it is within bounds, otherwise nil.
+ subscript (safe index: Index) -> Iterator.Element? {
+ return indices.contains(index) ? self[index] : nil
+ }
+ }
+ ''')
+ self.assertEqual("subscript", result[0].name)
+
def test_getter_setter(self):
result = get_swift_function_list('''
class Time
@@ -125,6 +146,70 @@ class Test_parser_for_Swift(unittest.TestCase):
self.assertEqual("get", result[0].name)
self.assertEqual("set", result[1].name)
+#https://docs.swift.org/swift-book/LanguageGuide/Properties.html#ID259
+ def test_explicit_getter_setter(self):
+ result = get_swift_function_list('''
+ var center: Point {
+ get {
+ let centerX = origin.x + (size.width / 2)
+ let centerY = origin.y + (size.height / 2)
+ return Point(x: centerX, y: centerY)
+ }
+ set(newCenter) {
+ origin.x = newCenter.x - (size.width / 2)
+ origin.y = newCenter.y - (size.height / 2)
+ }
+ }
+ ''')
+ self.assertEqual("get", result[0].name)
+ self.assertEqual("set", result[1].name)
+
+ def test_willset_didset(self):
+ result = get_swift_function_list('''
+ var cue = -1 {
+ willSet {
+ if newValue != cue {
+ tableView.reloadData()
+ }
+ }
+ didSet {
+ tableView.scrollToRow(at: IndexPath(row: cue, section: 0), at: .bottom, animated: true)
+ }
+ }
+ ''')
+ self.assertEqual("willSet", result[0].name)
+ self.assertEqual("didSet", result[1].name)
+
+#https://docs.swift.org/swift-book/LanguageGuide/Properties.html#ID262
+ def test_explicit_willset_didset(self):
+ result = get_swift_function_list('''
+ class StepCounter {
+ var totalSteps: Int = 0 {
+ willSet(newTotalSteps) {
+ print("About to set totalSteps to \(newTotalSteps)")
+ }
+ didSet {
+ if totalSteps > oldValue {
+ print("Added \(totalSteps - oldValue) steps")
+ }
+ }
+ }
+ }
+ ''')
+ self.assertEqual("willSet", result[0].name)
+ self.assertEqual("didSet", result[1].name)
+
+ def test_keyword_declarations(self):
+ result = get_swift_function_list('''
+ enum Func {
+ static var `init`: Bool?, willSet: Bool?
+ static let `deinit` = 0, didSet = 0
+ case `func`; case get, set
+ func `default`() {}
+ }
+ ''')
+ self.assertEqual("default", result[0].name)
+
def test_generic_function(self):
result = get_swift_function_list('''
func f<T>() {}
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_git_commit_hash"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 1,
"issue_text_score": 0,
"test_score": 3
},
"num_modified_files": 1
}
|
1.15
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[sidecar]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest",
"flake8",
"isort",
"mypy"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements/base.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
exceptiongroup==1.2.2
flake8==7.2.0
iniconfig==2.1.0
isort==6.0.1
-e git+https://github.com/terryyin/lizard.git@b631dfd3561366539633a7279f755e237541f3bf#egg=lizard
mccabe==0.7.0
mypy==1.15.0
mypy-extensions==1.0.0
packaging==24.2
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.1
pytest==8.3.5
tomli==2.2.1
typing_extensions==4.13.0
|
name: lizard
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- exceptiongroup==1.2.2
- flake8==7.2.0
- iniconfig==2.1.0
- isort==6.0.1
- mccabe==0.7.0
- mypy==1.15.0
- mypy-extensions==1.0.0
- packaging==24.2
- pluggy==1.5.0
- pycodestyle==2.13.0
- pyflakes==3.3.1
- pytest==8.3.5
- tomli==2.2.1
- typing-extensions==4.13.0
prefix: /opt/conda/envs/lizard
|
[
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_explicit_willset_didset",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_keyword_declarations",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_labeled_subscript",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_subscript",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_willset_didset"
] |
[] |
[
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_coalescing_operator",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_deinit",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_empty",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_explicit_getter_setter",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_generic_function",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_getter_setter",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_init",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_interface",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_interface_followed_by_a_class",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_interface_with_var",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_no_function",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_one_function",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_one_function_with_complexity",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_one_function_with_return_value",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_one_with_parameter",
"test/test_languages/testSwift.py::Test_parser_for_Swift::test_optional"
] |
[] |
MIT License
| 3,303 |
[
"lizard_languages/swift.py"
] |
[
"lizard_languages/swift.py"
] |
datosgobar__pydatajson-211
|
185d79d95555dd3041404b208a09583cb95a9a19
|
2018-10-23 12:34:37
|
adb85a7de7dfa073ddf9817a5fe2d125f9ce4e54
|
diff --git a/.gitignore b/.gitignore
index e6e7bf3..35e9136 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,7 +74,6 @@ TODO.md
# Archivos temporales de prueba
tests/temp/*
-tests/results/catalog/*
.ipynb_checkpoints
samples/archivos-generados/*
.DS_Store
diff --git a/HISTORY.md b/HISTORY.md
index f99fae6..ae16245 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,12 +1,6 @@
Versiones
=========
-0.4.25 (2018-10-22)
--------------------
-* Agrega indicador 'datasets_con_datos_cant' para identificar la cantidad de datasets que tienen alguna distribución potencialmente con datos y los que no.
-* Expande la función `backup.make_catalogs_backup()` con argumentos opcionales para facilitar la generación de backups descargando las distribuciones.
-
-
0.4.24 (2018-10-16)
-------------------
* Cambia el valor default en el indicador `datasets_frecuencias_cant`.
@@ -52,7 +46,6 @@ Versiones
* Validación de keywords, themes, y lenguajes vacíos.
* Bugfix en `distribution_has_time_index` para capturar excepciones en field inválidos.
-
0.4.17 (2018-07-10)
-------------------
diff --git a/docs/MANUAL.md b/docs/MANUAL.md
index e03b74f..8a0c2f6 100644
--- a/docs/MANUAL.md
+++ b/docs/MANUAL.md
@@ -438,6 +438,19 @@ Toma los siguientes parámetros:
Retorna una lista de diccionarios con la información de las organizaciones. Recursivamente, dentro del campo `children`,
se encuentran las organizaciones dependientes en la jerarquía.
+- **pydatajson.federation.push_organization_tree_to_ckan()**: Tomando un árbol de organizaciones como el creado por
+`get_organizations_from_ckan()` crea en el portal de destino las organizaciones dentro de su jerarquía. Toma los siguientes
+parámetros:
+ - **portal_url**: La URL del portal CKAN de destino.
+ - **apikey**: La apikey de un usuario con los permisos que le permitan crear las organizaciones.
+ - **org_tree**: lista de diccionarios con la data de organizaciones a crear.
+ - **parent** (opcional, default: None): Si se pasa, el árbol de organizaciones pasado en `org_tree` se
+ crea bajo la organización con `name` pasado en `parent`. Si no se pasa un parámetro, las organizaciones son creadas
+ como primer nivel.
+
+ Retorna el árbol de organizaciones creadas. Cada nodo tiene un campo `success` que indica si fue creado exitosamente o
+ no. En caso de que `success` sea False, los hijos de esa organización no son creados.
+
## Anexo I: Estructura de respuestas
### validate_catalog()
diff --git a/pydatajson/__init__.py b/pydatajson/__init__.py
index eac4dd6..cd46a0c 100644
--- a/pydatajson/__init__.py
+++ b/pydatajson/__init__.py
@@ -13,7 +13,7 @@ import logging
__author__ = """Datos Argentina"""
__email__ = '[email protected]'
-__version__ = '0.4.25'
+__version__ = '0.4.24'
"""
Logger base para librería pydatajson
diff --git a/pydatajson/backup.py b/pydatajson/backup.py
index 2ee5544..6e4a7a8 100644
--- a/pydatajson/backup.py
+++ b/pydatajson/backup.py
@@ -7,7 +7,7 @@ from __future__ import unicode_literals
from __future__ import print_function
from __future__ import with_statement
import os
-import sys
+import traceback
import logging
import pydatajson
@@ -21,7 +21,7 @@ logger = logging.getLogger('pydatajson')
def make_catalogs_backup(catalogs, local_catalogs_dir="",
include_metadata=True, include_data=True,
- include_metadata_xlsx=False, use_short_path=False):
+ include_metadata_xlsx=False):
"""Realiza una copia local de los datos y metadatos de un catálogo.
Args:
@@ -57,8 +57,7 @@ def make_catalogs_backup(catalogs, local_catalogs_dir="",
local_catalogs_dir=local_catalogs_dir,
include_metadata=include_metadata,
include_metadata_xlsx=include_metadata_xlsx,
- include_data=include_data,
- use_short_path=use_short_path)
+ include_data=include_data)
except Exception:
logger.exception("ERROR en {}".format(catalog))
@@ -70,8 +69,7 @@ def make_catalogs_backup(catalogs, local_catalogs_dir="",
local_catalogs_dir=local_catalogs_dir,
include_metadata=include_metadata,
include_metadata_xlsx=include_metadata_xlsx,
- include_data=include_data,
- use_short_path=use_short_path)
+ include_data=include_data)
except Exception:
logger.exception(
"ERROR en {} ({})".format(catalog, catalog_id))
@@ -79,9 +77,7 @@ def make_catalogs_backup(catalogs, local_catalogs_dir="",
def make_catalog_backup(catalog, catalog_id=None, local_catalogs_dir="",
include_metadata=True, include_data=True,
- include_datasets=[],
- include_distribution_formats=['CSV', 'XLS'],
- include_metadata_xlsx=True, use_short_path=False):
+ include_metadata_xlsx=True):
"""Realiza una copia local de los datos y metadatos de un catálogo.
Args:
@@ -90,21 +86,14 @@ def make_catalog_backup(catalog, catalog_id=None, local_catalogs_dir="",
archivo con la metadata de un catálogo, en formato JSON o XLSX. La
representación _interna_ de un catálogo es un diccionario.
catalog_id (str): Si se especifica, se usa este identificador para el
- backup. Si no se especifica, se usa catalog["identifier"].
+ backup. Si no se espedifica, se usa catalog["identifier"].
local_catalogs_dir (str): Directorio local en el cual se va a crear
la carpeta "catalog/..." con todos los catálogos.
include_metadata (bool): Si es verdadero, se generan los archivos
data.json y catalog.xlsx.
include_data (bool): Si es verdadero, se descargan todas las
distribuciones de todos los catálogos.
- include_datasets (list): Si se especifica, se descargan únicamente los
- datasets indicados. Si no, se descargan todos.
- include_distribution_formats (list): Si se especifica, se descargan
- únicamente las distribuciones de los formatos indicados. Si no, se
- descargan todas.
- use_short_path (bool): No implementado. Si es verdadero, se utiliza una
- jerarquía de directorios simplificada. Caso contrario, se replica
- la existente en infra.
+
Return:
None
"""
@@ -138,75 +127,45 @@ def make_catalog_backup(catalog, catalog_id=None, local_catalogs_dir="",
index + 1, distributions_num, catalog_identifier))
dataset_id = distribution["dataset_identifier"]
+ distribution_id = distribution["identifier"]
+ distribution_download_url = distribution["downloadURL"]
+
+ # si no se especifica un file name, se toma de la URL
+ distribution_file_name = distribution.get(
+ "fileName",
+ distribution_download_url[
+ distribution_download_url.rfind("/") + 1:]
+ )
+
+ # genera el path local donde descargar el archivo
+ file_path = get_distribution_path(
+ catalog_identifier, dataset_id, distribution_id,
+ distribution_file_name, local_catalogs_dir)
+ ensure_dir_exists(os.path.dirname(file_path))
- if include_datasets and (dataset_id not in include_datasets):
- pass
- else:
- distribution_id = distribution["identifier"]
- distribution_download_url = distribution["downloadURL"]
-
- # si no se especifica un file name, se toma de la URL
- distribution_file_name = distribution.get(
- "fileName",
- distribution_download_url[
- distribution_download_url.rfind("/") + 1:]
- )
-
- # si no espicifica un formato, toma de distribution_file_name
- # asume que formato está al menos en distribution_file_name
- distribution_format = distribution.get(
- "format",
- distribution_file_name[
- distribution_file_name.rfind(".") + 1:]
- )
- if (include_distribution_formats and
- (distribution_format
- not in include_distribution_formats)):
- pass
- else:
-
- # genera el path local donde descargar el archivo
- file_path = get_distribution_path(
- catalog_identifier, dataset_id, distribution_id,
- distribution_file_name, local_catalogs_dir,
- use_short_path=use_short_path)
- ensure_dir_exists(os.path.dirname(file_path))
-
- # decarga el archivo
- download_to_file(distribution_download_url, file_path)
+ # decarga el archivo
+ download_to_file(distribution_download_url, file_path)
def get_distribution_dir(catalog_id, dataset_id, distribution_id,
- catalogs_dir=CATALOGS_DIR, use_short_path=False):
+ catalogs_dir=CATALOGS_DIR):
"""Genera el path estándar de un catálogo en un filesystem."""
- if use_short_path:
- catalog_path = os.path.join(catalogs_dir, "catalog", catalog_id)
- distribution_dir = os.path.join(catalog_path, dataset_id)
- else:
- catalog_path = os.path.join(catalogs_dir, "catalog", catalog_id)
- dataset_path = os.path.join(catalog_path, "dataset", dataset_id)
- distribution_dir = os.path.join(
- dataset_path, "distribution", distribution_id)
+ catalog_path = os.path.join(catalogs_dir, "catalog", catalog_id)
+ dataset_path = os.path.join(catalog_path, "dataset", dataset_id)
+ distribution_dir = os.path.join(dataset_path, "distribution",
+ distribution_id)
return os.path.abspath(distribution_dir)
def get_distribution_path(catalog_id, dataset_id, distribution_id,
- distribution_file_name, catalogs_dir=CATALOGS_DIR,
- use_short_path=False):
+ distribution_file_name, catalogs_dir=CATALOGS_DIR):
"""Genera el path estándar de un catálogo en un filesystem."""
- if use_short_path:
- distribution_dir = get_distribution_dir(
- catalog_id, dataset_id, distribution_id, catalogs_dir,
- use_short_path=True)
- distribution_file_path = os.path.join(
- distribution_dir, distribution_file_name)
- else:
- distribution_dir = get_distribution_dir(
- catalog_id, dataset_id, distribution_id, catalogs_dir,
- use_short_path=False)
- distribution_file_path = os.path.join(
- distribution_dir, "download", distribution_file_name)
+
+ distribution_dir = get_distribution_dir(
+ catalog_id, dataset_id, distribution_id, catalogs_dir)
+ distribution_file_path = os.path.join(
+ distribution_dir, "download", distribution_file_name)
return os.path.abspath(distribution_file_path)
@@ -224,7 +183,7 @@ def get_catalog_path(catalog_id, catalogs_dir=CATALOGS_DIR, fmt="json"):
fmt))
-def main(catalogs, include_data=True, use_short_path=True):
+def main(catalogs, include_data=True):
"""Permite hacer backups de uno o más catálogos por línea de comandos.
Args:
@@ -232,8 +191,7 @@ def main(catalogs, include_data=True, use_short_path=True):
locales) para hacer backups.
"""
include_data = bool(int(include_data))
- make_catalogs_backup(catalogs.split(
- ","), include_data=include_data, use_short_path=use_short_path)
+ make_catalogs_backup(catalogs.split(","), include_data=include_data)
if __name__ == '__main__':
diff --git a/pydatajson/ckan_reader.py b/pydatajson/ckan_reader.py
index b92a636..e14b4fe 100644
--- a/pydatajson/ckan_reader.py
+++ b/pydatajson/ckan_reader.py
@@ -9,7 +9,6 @@ from __future__ import unicode_literals, print_function,\
import os.path
import logging
import json
-import time
from six.moves.urllib_parse import urljoin
from six import iteritems
from ckanapi import RemoteCKAN
@@ -70,9 +69,6 @@ def read_ckan_catalog(portal_url):
requests_kwargs={"verify": False}
))
- # tiempo de espera padra evitar baneos
- time.sleep(0.2)
-
# itera leyendo todos los temas del portal
groups = [portal.call_action(
'group_show', {'id': grp},
@@ -87,7 +83,6 @@ def read_ckan_catalog(portal_url):
except Exception as e:
logger.exception(
'Error al procesar el portal %s', portal_url, exc_info=True)
- print(e)
return catalog
diff --git a/pydatajson/core.py b/pydatajson/core.py
index 6a4ca14..09f1b5e 100644
--- a/pydatajson/core.py
+++ b/pydatajson/core.py
@@ -42,6 +42,13 @@ logger = logging.getLogger('pydatajson')
ABSOLUTE_PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
CENTRAL_CATALOG = "http://datos.gob.ar/data.json"
+DATA_FORMATS = [
+ "csv", "xls", "xlsx", "ods", "dta",
+ "shp", "kml",
+ "json", "xml",
+ "zip", "rar",
+ "html", "php"
+]
MIN_DATASET_TITLE = 10
MIN_DATASET_DESCRIPTION = 20
@@ -378,7 +385,7 @@ class DataJson(dict):
# crea lista de formatos
distributions_formats = json.dumps(
- helpers.count_distribution_formats_dataset(dataset))
+ cls._count_distribution_formats_dataset(dataset))
fields = OrderedDict()
fields["dataset_identifier"] = dataset.get("identifier")
@@ -493,7 +500,15 @@ el argumento 'report'. Por favor, intentelo nuevamente.""")
# 1. VALIDACIONES
# chequea que haya por lo menos algún formato de datos reconocido
- has_data_format = helpers.dataset_has_data_distributions(dataset)
+ has_data_format = False
+ formats = self._count_distribution_formats_dataset(dataset).keys()
+ for distrib_format in formats:
+ for data_format in DATA_FORMATS:
+ if data_format.lower() in distrib_format.lower():
+ has_data_format = True
+ break
+ if has_data_format:
+ break
# chequea que algunos campos tengan longitudes mínimas
has_title = "title" in dataset
@@ -1002,7 +1017,7 @@ Por favor, consulte el informe [`datasets.csv`](datasets.csv).
catalog_readme = readme_template.format(**content)
if export_path:
- with io.open(export_path, 'w+', encoding='utf-8') as target:
+ with io.open(export_path, 'w', encoding='utf-8') as target:
target.write(catalog_readme)
else:
return catalog_readme
@@ -1059,6 +1074,22 @@ El reporte no contiene la clave obligatoria {}. Pruebe con otro archivo.
return indicators.generate_catalogs_indicators(
catalogs, central_catalog, validator=self.validator)
+ @staticmethod
+ def _count_distribution_formats_dataset(dataset):
+
+ formats = {}
+ for distribution in dataset['distribution']:
+ # 'format' es recomendado, no obligatorio. Puede no estar.
+ distribution_format = distribution.get('format', None)
+
+ if distribution_format:
+ # Si no está en el diccionario, devuelvo 0
+ count = formats.get(distribution_format, 0)
+
+ formats[distribution_format] = count + 1
+
+ return formats
+
def _count_fields_recursive(self, dataset, fields):
"""Cuenta la información de campos optativos/recomendados/requeridos
desde 'fields', y cuenta la ocurrencia de los mismos en 'dataset'.
diff --git a/pydatajson/documentation.py b/pydatajson/documentation.py
index 48d8b99..51745d1 100644
--- a/pydatajson/documentation.py
+++ b/pydatajson/documentation.py
@@ -47,10 +47,12 @@ def dataset_to_markdown(dataset):
def distribution_to_markdown(distribution):
- """Genera texto en markdown a partir de los metadatos de una `distribution`.
+ """Genera texto en markdown a partir de los metadatos de una
+ `distribution`.
Args:
- distribution (dict): Diccionario con metadatos de una `distribution`.
+ distribution (dict): Diccionario con metadatos de una
+ `distribution`.
Returns:
str: Texto que describe una `distribution`.
diff --git a/pydatajson/federation.py b/pydatajson/federation.py
index 1138121..fa0b31b 100644
--- a/pydatajson/federation.py
+++ b/pydatajson/federation.py
@@ -286,7 +286,7 @@ def push_new_themes(catalog, portal_url, apikey):
taxonomía.
portal_url (str): La URL del portal CKAN de destino.
apikey (str): La apikey de un usuario con los permisos que le
- permitan crear o actualizar el dataset.
+ permitan crear o actualizar los temas.
Returns:
str: Los ids de los temas creados.
"""
@@ -314,3 +314,42 @@ def get_organizations_from_ckan(portal_url):
ckan_portal = RemoteCKAN(portal_url)
return ckan_portal.call_action('group_tree',
data_dict={'type': 'organization'})
+
+
+def push_organization_tree_to_ckan(portal_url, apikey, org_tree, parent=None):
+ """Toma un árbol de organizaciones y lo replica en el portal de
+ destino.
+
+ Args:
+ portal_url (str): La URL del portal CKAN de destino.
+ apikey (str): La apikey de un usuario con los permisos que le
+ permitan crear las organizaciones.
+ org_tree(list): lista de diccionarios con la data de las
+ organizaciones a crear.
+ parent(str): campo name de la organizacion padre.
+ Returns:
+ (list): Devuelve el arbol de organizaciones recorridas,
+ junto con el status detallando si la creación fue
+ exitosa o no.
+
+ """
+ portal = RemoteCKAN(portal_url, apikey=apikey)
+ created = []
+ for node in org_tree:
+ if parent:
+ node['groups'] = [{'name': parent}]
+ try:
+ pushed_org = portal.call_action('organization_create',
+ data_dict=node)
+ pushed_org['success'] = True
+ except Exception as e:
+ logger.exception('Ocurrió un error creando la organización {}: {}'
+ .format(node['title'], str(e)))
+ pushed_org = {'name': node, 'success': False}
+
+ if pushed_org['success']:
+ pushed_org['children'] = push_organization_tree_to_ckan(
+ portal_url, apikey, node['children'], parent=node['name'])
+
+ created.append(pushed_org)
+ return created
diff --git a/pydatajson/helpers.py b/pydatajson/helpers.py
index 1e0b48c..e697c8b 100644
--- a/pydatajson/helpers.py
+++ b/pydatajson/helpers.py
@@ -26,43 +26,6 @@ STOP_WORDS = [
"y", "a",
"un", "una", "en"
]
-DATA_FORMATS = [
- "csv", "xls", "xlsx", "ods", "dta",
- "shp", "kml",
- "json", "xml",
- "zip", "rar",
- "html", "php"
-]
-
-
-def count_distribution_formats_dataset(dataset):
-
- formats = {}
- for distribution in dataset['distribution']:
- # 'format' es recomendado, no obligatorio. Puede no estar.
- distribution_format = distribution.get('format', None)
-
- if distribution_format:
- # Si no está en el diccionario, devuelvo 0
- count = formats.get(distribution_format, 0)
-
- formats[distribution_format] = count + 1
-
- return formats
-
-
-def dataset_has_data_distributions(dataset):
- has_data_format = False
- formats = count_distribution_formats_dataset(dataset).keys()
- for distrib_format in formats:
- for data_format in DATA_FORMATS:
- if data_format.lower() in distrib_format.lower():
- has_data_format = True
- break
- if has_data_format:
- break
-
- return has_data_format
def title_to_name(title, decode=True, max_len=None, use_complete_words=True):
diff --git a/pydatajson/indicators.py b/pydatajson/indicators.py
index e6be6d4..9629656 100644
--- a/pydatajson/indicators.py
+++ b/pydatajson/indicators.py
@@ -27,7 +27,6 @@ CENTRAL_CATALOG = "http://datos.gob.ar/data.json"
ABSOLUTE_PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
CATALOG_FIELDS_PATH = os.path.join(ABSOLUTE_PROJECT_DIR, "fields")
-
logger = logging.getLogger('pydatajson')
@@ -118,16 +117,12 @@ def _generate_indicators(catalog, validator=None, only_numeric=False):
Returns:
dict: diccionario con los indicadores del catálogo provisto
"""
-
result = {}
-
# Obtengo summary para los indicadores del estado de los metadatos
result.update(_generate_status_indicators(catalog, validator=validator))
-
# Genero los indicadores relacionados con fechas, y los agrego
result.update(
_generate_date_indicators(catalog, only_numeric=only_numeric))
-
# Agrego la cuenta de los formatos de las distribuciones
if not only_numeric:
if 'dataset' in catalog:
@@ -326,10 +321,7 @@ def _generate_status_indicators(catalog, validator=None):
'distribuciones_cant': None,
'datasets_meta_ok_cant': None,
'datasets_meta_error_cant': None,
- 'datasets_meta_ok_pct': None,
- 'datasets_con_datos_cant': None,
- 'datasets_sin_datos_cant': None,
- 'datasets_con_datos_pct': None
+ 'datasets_meta_ok_pct': None
}
try:
summary = generate_datasets_summary(catalog, validator=validator)
@@ -341,43 +333,25 @@ def _generate_status_indicators(catalog, validator=None):
cant_ok = 0
cant_error = 0
- cant_data = 0
- cant_without_data = 0
cant_distribuciones = 0
datasets_total = len(summary)
for dataset in summary:
cant_distribuciones += dataset['cant_distribuciones']
- print(dataset)
- # chequea si el dataset tiene datos
- if dataset['tiene_datos'] == "SI":
- cant_data += 1
- else: # == "ERROR"
- cant_without_data += 1
-
- # chequea estado de los metadatos
if dataset['estado_metadatos'] == "OK":
cant_ok += 1
else: # == "ERROR"
cant_error += 1
datasets_ok_pct = 0
- datasets_with_data_pct = 0
if datasets_total:
datasets_ok_pct = round(100 * float(cant_ok) / datasets_total, 2)
- datasets_with_data_pct = round(
- 100 * float(cant_data) / datasets_total, 2)
-
result.update({
'datasets_cant': datasets_total,
'distribuciones_cant': cant_distribuciones,
'datasets_meta_ok_cant': cant_ok,
'datasets_meta_error_cant': cant_error,
- 'datasets_meta_ok_pct': datasets_ok_pct,
- 'datasets_con_datos_cant': cant_data,
- 'datasets_sin_datos_cant': cant_without_data,
- 'datasets_con_datos_pct': datasets_with_data_pct
-
+ 'datasets_meta_ok_pct': datasets_ok_pct
})
return result
diff --git a/pydatajson/reporting.py b/pydatajson/reporting.py
index 4d38c06..d376a3b 100644
--- a/pydatajson/reporting.py
+++ b/pydatajson/reporting.py
@@ -15,7 +15,6 @@ from pydatajson import writers
from .validation import validate_catalog
from . import readers
-from . import helpers
def generate_datasets_summary(catalog, export_path=None, validator=None):
@@ -64,10 +63,6 @@ def generate_datasets_summary(catalog, export_path=None, validator=None):
info["estado_metadatos"] = validation[index]["status"]
info["cant_errores"] = len(validation[index]["errors"])
info["cant_distribuciones"] = len(dataset["distribution"])
- if helpers.dataset_has_data_distributions(dataset):
- info["tiene_datos"] = "SI"
- else:
- info["tiene_datos"] = "NO"
return info
diff --git a/setup.cfg b/setup.cfg
index ad1d067..cdebfe7 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 0.4.25
+current_version = 0.1.0
commit = True
tag = True
diff --git a/setup.py b/setup.py
index db86aaa..bc683e6 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ with open(os.path.abspath("requirements_2.7.txt")) as f:
setup(
name='pydatajson',
- version='0.4.25',
+ version='0.4.24',
description="Paquete en python con herramientas para generar y validar metadatos de catálogos de datos en formato data.json.",
long_description=readme + '\n\n' + history,
long_description_content_type='text/markdown',
|
Push organizations to ckan
Dado un árbol jerárquico de organizaciones, el objetivo es crear las organizaciones allí descriptas, manteniendo la jerarquía original
|
datosgobar/pydatajson
|
diff --git a/tests/samples/organization_tree.json b/tests/samples/organization_tree.json
new file mode 100644
index 0000000..0e0ff6d
--- /dev/null
+++ b/tests/samples/organization_tree.json
@@ -0,0 +1,235 @@
+[
+ {
+ "highlighted": false,
+ "title": " Jefatura de Gabinete de Ministros",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Agencia de Acceso a la Informaci\u00f3n P\u00fablica",
+ "children": [],
+ "name": "aaip",
+ "id": "daa8b40c-fa37-478c-a7ef-081305aeadd8"
+ },
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Ambiente y Desarrollo Sustentable",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Autoridad de Cuenca Matanza Riachuelo",
+ "children": [],
+ "name": "acumar",
+ "id": "1b6b28cd-098f-41d7-b43f-d5a01ffa8759"
+ }
+ ],
+ "name": "ambiente",
+ "id": "0e5aa328-825e-4509-851d-5421e866635e"
+ },
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Modernizaci\u00f3n",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Empresa Argentina de Soluciones Satelitales",
+ "children": [],
+ "name": "arsat",
+ "id": "b2509ac0-3af6-4f66-9ffa-8c6fb4206791"
+ },
+ {
+ "highlighted": false,
+ "title": "Ente Nacional de Comunicaciones",
+ "children": [],
+ "name": "enacom",
+ "id": "6eb7d19b-2d42-494f-8e57-d67c501d23eb"
+ }
+ ],
+ "name": "modernizacion",
+ "id": "4c7a6f6b-5caf-42a1-aae5-0a07e609a235"
+ },
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Turismo",
+ "children": [],
+ "name": "turismo",
+ "id": "3a751de6-128e-4f9a-a479-4672ef79a0e8"
+ }
+ ],
+ "name": "jgm",
+ "id": "f917ad65-28ea-42a9-81ae-61a2bb8f58d0"
+ },
+ {
+ "highlighted": false,
+ "title": " Ministerio de Defensa",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Instituto Geogr\u00e1fico Nacional",
+ "children": [],
+ "name": "ign",
+ "id": "9b47c8eb-bb5c-40df-bbaa-589374d14da8"
+ },
+ {
+ "highlighted": false,
+ "title": "Servicio Meteorol\u00f3gico Nacional",
+ "children": [],
+ "name": "smn",
+ "id": "dba2a17e-e2ea-4e0b-b0ef-bf4ffe9f9ad9"
+ }
+ ],
+ "name": "defensa",
+ "id": "5e80ed4f-8bfb-4451-8240-e8f39e695ee1"
+ },
+ {
+ "highlighted": false,
+ "title": "Ministerio de Educaci\u00f3n, Cultura, Ciencia y Tecnolog\u00eda",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Ciencia y Tecnolog\u00eda",
+ "children": [],
+ "name": "mincyt",
+ "id": "772ab9b7-056d-4ae4-b7a2-a1329e979690"
+ },
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Cultura",
+ "children": [],
+ "name": "cultura",
+ "id": "9fcc8ffc-3dcc-4437-acc8-72c5b08d8d51"
+ }
+ ],
+ "name": "educacion",
+ "id": "27d39ff7-7110-4c6d-b7e8-1b8eba392d7e"
+ },
+ {
+ "highlighted": false,
+ "title": " Ministerio de Hacienda",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Energ\u00eda",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Ente Nacional Regulador del Gas",
+ "children": [],
+ "name": "enargas",
+ "id": "dddda9d3-644d-4e3d-974b-302fd8945a86"
+ }
+ ],
+ "name": "energia",
+ "id": "cd1b32a2-2d3a-44ac-8c98-a425a7b62d42"
+ },
+ {
+ "highlighted": false,
+ "title": "Subsecretar\u00eda de Presupuesto",
+ "children": [],
+ "name": "sspre",
+ "id": "a753aeb8-52eb-4cfc-a6ee-6d930094b0f2"
+ },
+ {
+ "highlighted": false,
+ "title": "Subsecretar\u00eda de Programaci\u00f3n Macroecon\u00f3mica",
+ "children": [],
+ "name": "sspm",
+ "id": "68f9ee22-5ec3-44cf-a32b-b87d9db46b93"
+ },
+ {
+ "highlighted": false,
+ "title": "Subsecretar\u00eda de Programaci\u00f3n Microecon\u00f3mica",
+ "children": [],
+ "name": "sspmi",
+ "id": "b4baa84a-16a7-4db0-af9c-bd925971d26a"
+ }
+ ],
+ "name": "hacienda",
+ "id": "b2a6e77e-a3c8-4e1a-bcba-7134a9436051"
+ },
+ {
+ "highlighted": false,
+ "title": " Ministerio de Justicia y Derechos Humanos",
+ "children": [],
+ "name": "justicia",
+ "id": "06b380f8-888f-43c0-8367-16a7ddf47d4f"
+ },
+ {
+ "highlighted": false,
+ "title": " Ministerio del Interior, Obras P\u00fablicas y Vivienda ",
+ "children": [],
+ "name": "interior",
+ "id": "c88b1ad1-f78d-4cf9-848d-d73ccae6cd8e"
+ },
+ {
+ "highlighted": false,
+ "title": "Ministerio de Producci\u00f3n y Trabajo",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Agroindustria",
+ "children": [],
+ "name": "agroindustria",
+ "id": "b10c94e2-ade1-4a97-8c4c-b1ada7878d60"
+ },
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Trabajo y Empleo",
+ "children": [],
+ "name": "trabajo",
+ "id": "f31cb5dc-79ab-442b-ac7f-87ef6ad7749d"
+ },
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Transformaci\u00f3n Productiva",
+ "children": [],
+ "name": "siep",
+ "id": "83a04686-747a-4ba3-a0b1-2f05c3196bc4"
+ }
+ ],
+ "name": "produccion",
+ "id": "1ca8d15b-31fc-4f09-ba09-53edd3d4cce6"
+ },
+ {
+ "highlighted": false,
+ "title": "Ministerio de Relaciones Exteriores y Culto",
+ "children": [],
+ "name": "exterior",
+ "id": "89cd05f2-11c1-4f1a-875f-b4faf97eb4d4"
+ },
+ {
+ "highlighted": false,
+ "title": "Ministerio de Salud y Desarrollo Social",
+ "children": [
+ {
+ "highlighted": false,
+ "title": "Secretar\u00eda de Gobierno de Salud",
+ "children": [],
+ "name": "salud",
+ "id": "dd1f2018-587f-43af-9b07-fc32f5ab588b"
+ }
+ ],
+ "name": "desarrollo-social",
+ "id": "ef25c735-2abb-4165-94a6-a6798a103603"
+ },
+ {
+ "highlighted": false,
+ "title": " Ministerio de Seguridad",
+ "children": [],
+ "name": "seguridad",
+ "id": "908fd413-5a22-40e7-9204-38ef380ae232"
+ },
+ {
+ "highlighted": false,
+ "title": " Ministerio de Transporte",
+ "children": [],
+ "name": "transporte",
+ "id": "71418928-10c4-4625-aeaf-69a4d73d00ed"
+ },
+ {
+ "highlighted": false,
+ "title": "Sin organizaci\u00f3n asignada",
+ "children": [],
+ "name": "otros",
+ "id": "109d53ef-3ed3-498e-97d0-a456698969f7"
+ }
+]
\ No newline at end of file
diff --git a/tests/test_federation.py b/tests/test_federation.py
index 58449e4..d2a0af6 100644
--- a/tests/test_federation.py
+++ b/tests/test_federation.py
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
import unittest
import os
import re
+import json
try:
from mock import patch, MagicMock
@@ -481,7 +482,49 @@ class PushCatalogThemesTestCase(FederationSuite):
@patch('pydatajson.federation.RemoteCKAN', autospec=True)
class OrganizationsTestCase(FederationSuite):
+ def setUp(self):
+ self.portal_url = 'portal_url'
+ self.apikey = 'apikey'
+ self.org_tree = json.load(open(
+ self.get_sample('organization_tree.json')))
+
+ def check_hierarchy(self, node, parent=None):
+ if not node['success']:
+ self.assertTrue('children' not in node)
+ return
+ if parent is None:
+ self.assertTrue('groups' not in node)
+ else:
+ self.assertDictEqual(node['groups'][0],
+ {'name': parent})
+
+ for child in node['children']:
+ self.check_hierarchy(child, parent=node['name'])
+
def test_get_organization_calls_api_correctly(self, mock_portal):
- get_organizations_from_ckan('portal_url')
+ get_organizations_from_ckan(self.portal_url)
mock_portal.return_value.call_action.assert_called_with(
'group_tree', data_dict={'type': 'organization'})
+
+ def test_push_organizations_sends_correct_hierarchy(self, mock_portal):
+ mock_portal.return_value.call_action = (lambda _, data_dict: data_dict)
+ pushed_tree = push_organization_tree_to_ckan(self.portal_url,
+ self.apikey,
+ self.org_tree)
+ for node in pushed_tree:
+ self.check_hierarchy(node)
+
+ def test_push_organizations_cuts_trees_on_failures(self, mock_portal):
+ def mock_org_create(_action, data_dict):
+ broken_orgs = ('acumar', 'modernizacion', 'hacienda')
+ if data_dict['name'] in broken_orgs:
+ raise Exception('broken org on each level')
+ else:
+ return data_dict
+
+ mock_portal.return_value.call_action = mock_org_create
+ pushed_tree = push_organization_tree_to_ckan(self.portal_url,
+ self.apikey,
+ self.org_tree)
+ for node in pushed_tree:
+ self.check_hierarchy(node)
|
{
"commit_name": "head_commit",
"failed_lite_validators": [
"has_short_problem_statement",
"has_many_modified_files",
"has_many_hunks"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 2,
"test_score": 3
},
"num_modified_files": 14
}
|
0.4
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"nose",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.6",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
attrs==22.2.0
certifi==2021.5.30
charset-normalizer==2.0.12
ckanapi==4.0
docopt==0.6.2
et-xmlfile==1.1.0
idna==3.10
importlib-metadata==4.8.3
iniconfig==1.1.1
isodate==0.6.0
jdcal==1.4.1
jsonschema==2.6.0
nose==1.3.7
openpyxl==2.4.11
packaging==21.3
pluggy==1.0.0
py==1.11.0
-e git+https://github.com/datosgobar/pydatajson.git@185d79d95555dd3041404b208a09583cb95a9a19#egg=pydatajson
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.6.1
requests==2.27.1
rfc3987==1.3.7
six==1.11.0
tomli==1.2.3
typing_extensions==4.1.1
unicodecsv==0.14.1
Unidecode==0.4.21
urllib3==1.22
zipp==3.6.0
|
name: pydatajson
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- certifi=2021.5.30=py36h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.3=he6710b0_2
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1w=h7f8727e_0
- pip=21.2.2=py36h06a4308_0
- python=3.6.13=h12debd9_1
- readline=8.2=h5eee18b_0
- setuptools=58.0.4=py36h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- wheel=0.37.1=pyhd3eb1b0_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- attrs==22.2.0
- charset-normalizer==2.0.12
- ckanapi==4.0
- docopt==0.6.2
- et-xmlfile==1.1.0
- idna==3.10
- importlib-metadata==4.8.3
- iniconfig==1.1.1
- isodate==0.6.0
- jdcal==1.4.1
- jsonschema==2.6.0
- nose==1.3.7
- openpyxl==2.4.11
- packaging==21.3
- pluggy==1.0.0
- py==1.11.0
- pyparsing==3.1.4
- pytest==7.0.1
- python-dateutil==2.6.1
- requests==2.27.1
- rfc3987==1.3.7
- six==1.11.0
- tomli==1.2.3
- typing-extensions==4.1.1
- unicodecsv==0.14.1
- unidecode==0.04.21
- urllib3==1.22
- zipp==3.6.0
prefix: /opt/conda/envs/pydatajson
|
[
"tests/test_federation.py::OrganizationsTestCase::test_push_organizations_cuts_trees_on_failures",
"tests/test_federation.py::OrganizationsTestCase::test_push_organizations_sends_correct_hierarchy"
] |
[] |
[
"tests/test_federation.py::PushDatasetTestCase::test_dataset_id_is_preserved_if_catalog_id_is_not_passed",
"tests/test_federation.py::PushDatasetTestCase::test_dataset_level_wrappers",
"tests/test_federation.py::PushDatasetTestCase::test_dataset_without_license_sets_notspecified",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_dataset_list",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_empty_list",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_errors",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_no_optional_parametres",
"tests/test_federation.py::PushDatasetTestCase::test_harvest_catalog_with_owner_org",
"tests/test_federation.py::PushDatasetTestCase::test_id_is_created_correctly",
"tests/test_federation.py::PushDatasetTestCase::test_id_is_updated_correctly",
"tests/test_federation.py::PushDatasetTestCase::test_licenses_are_interpreted_correctly",
"tests/test_federation.py::PushDatasetTestCase::test_tags_are_passed_correctly",
"tests/test_federation.py::RemoveDatasetTestCase::test_empty_search_doesnt_call_purge",
"tests/test_federation.py::RemoveDatasetTestCase::test_filter_in_datasets",
"tests/test_federation.py::RemoveDatasetTestCase::test_filter_in_out_datasets",
"tests/test_federation.py::RemoveDatasetTestCase::test_query_one_dataset",
"tests/test_federation.py::RemoveDatasetTestCase::test_query_over_500_datasets",
"tests/test_federation.py::RemoveDatasetTestCase::test_remove_through_filters_and_organization",
"tests/test_federation.py::PushThemeTestCase::test_ckan_portal_is_called_with_correct_parametres",
"tests/test_federation.py::PushThemeTestCase::test_empty_theme_search_raises_exception",
"tests/test_federation.py::PushThemeTestCase::test_function_pushes_theme_by_identifier",
"tests/test_federation.py::PushThemeTestCase::test_function_pushes_theme_by_label",
"tests/test_federation.py::PushCatalogThemesTestCase::test_empty_portal_pushes_every_theme",
"tests/test_federation.py::PushCatalogThemesTestCase::test_full_portal_pushes_nothing",
"tests/test_federation.py::PushCatalogThemesTestCase::test_non_empty_intersection_pushes_missing_themes",
"tests/test_federation.py::OrganizationsTestCase::test_get_organization_calls_api_correctly"
] |
[] |
MIT License
| 3,304 |
[
"pydatajson/documentation.py",
"pydatajson/indicators.py",
"docs/MANUAL.md",
"setup.py",
"pydatajson/backup.py",
"pydatajson/reporting.py",
".gitignore",
"pydatajson/federation.py",
"pydatajson/helpers.py",
"setup.cfg",
"HISTORY.md",
"pydatajson/__init__.py",
"pydatajson/ckan_reader.py",
"pydatajson/core.py"
] |
[
"pydatajson/documentation.py",
"pydatajson/indicators.py",
"docs/MANUAL.md",
"setup.py",
"pydatajson/backup.py",
"pydatajson/reporting.py",
".gitignore",
"pydatajson/federation.py",
"pydatajson/helpers.py",
"setup.cfg",
"HISTORY.md",
"pydatajson/__init__.py",
"pydatajson/ckan_reader.py",
"pydatajson/core.py"
] |
|
iterative__dvc-1262
|
548dc3657b42b2f67e41439e447015664af5eb9a
|
2018-10-23 13:53:42
|
0ee7d5a7f823822445514dae1dc1db8bb4daec99
|
diff --git a/dvc/command/root.py b/dvc/command/root.py
index 8d83f5c89..feff9cb01 100644
--- a/dvc/command/root.py
+++ b/dvc/command/root.py
@@ -4,6 +4,9 @@ from dvc.command.base import CmdBase
class CmdRoot(CmdBase):
+ def run_cmd(self):
+ return self.run()
+
def run(self):
self.project.logger.info(os.path.relpath(self.project.root_dir))
return 0
|
Don't require a lock for the dvc root command
Is there any way that the `dvc root` would change in the middle of some `dvc` command that acquired lock? If not, I think `dvc root` could simply skip acquiring a lock so it can be used freely.
|
iterative/dvc
|
diff --git a/tests/test_config.py b/tests/test_config.py
index 5f9d9ff02..93e8d5c9b 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -28,6 +28,11 @@ class TestConfigCLI(TestDvc):
ret = main(['root'])
self.assertEqual(ret, 0)
+ # NOTE: check that `dvc root` is not blocked with dvc lock
+ with self.dvc.lock:
+ ret = main(['root'])
+ self.assertEqual(ret, 0)
+
def _do_test(self, local=False):
section = 'setsection'
field = 'setfield'
|
{
"commit_name": "head_commit",
"failed_lite_validators": [],
"has_test_patch": true,
"is_lite": true,
"llm_score": {
"difficulty_score": 0,
"issue_text_score": 2,
"test_score": 0
},
"num_modified_files": 1
}
|
0.19
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[all]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest>=3.3.1",
"nose>=1.3.7",
"mock>=2.0.0",
"coverage>=4.5.1",
"codecov>=2.0.15",
"xmltodict>=0.11.0",
"awscli>=1.14.18",
"google-compute-engine",
"Pygments",
"collective.checkdocs",
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
altgraph==0.17.4
asciimatics==1.15.0
awscli==1.38.23
azure-common==1.1.28
azure-nspkg==3.0.2
azure-storage-blob==1.3.0
azure-storage-common==1.3.0
azure-storage-nspkg==3.1.0
bcrypt==4.3.0
boto==2.49.0
boto3==1.7.4
botocore==1.10.84
cachetools==5.5.2
certifi==2025.1.31
cffi==1.17.1
charset-normalizer==3.4.1
codecov==2.1.13
collective.checkdocs==0.2
colorama==0.4.6
configobj==5.0.9
configparser==7.2.0
coverage==7.8.0
cryptography==44.0.2
decorator==5.2.1
distro==1.9.0
docutils==0.16
-e git+https://github.com/iterative/dvc.git@548dc3657b42b2f67e41439e447015664af5eb9a#egg=dvc
exceptiongroup==1.2.2
future==1.0.0
gitdb==4.0.12
GitPython==3.1.44
google-api-core==1.34.1
google-auth==2.38.0
google-cloud-core==0.28.1
google-cloud-storage==1.12.0
google-compute-engine==2.8.13
google-crc32c==1.7.1
google-resumable-media==2.7.2
googleapis-common-protos==1.69.2
grandalf==0.6
idna==3.10
iniconfig==2.1.0
jmespath==0.10.0
jsonpath-rw==1.4.0
macholib==1.16.3
mock==5.2.0
nanotime==0.5.2
networkx==3.2.1
nose==1.3.7
packaging==24.2
paramiko==3.5.1
pefile==2024.8.26
pillow==11.1.0
pluggy==1.5.0
ply==3.11
protobuf==3.20.3
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
pydot==3.0.4
pyfiglet==1.0.2
Pygments==2.19.1
PyInstaller==3.3.1
PyNaCl==1.5.0
pyparsing==3.2.3
pytest==8.3.5
python-dateutil==2.9.0.post0
PyYAML==6.0.2
requests==2.32.3
rsa==4.7.2
s3transfer==0.1.13
schema==0.7.7
six==1.17.0
smmap==5.0.2
tomli==2.2.1
urllib3==1.26.20
wcwidth==0.2.13
xmltodict==0.14.2
zc.lockfile==3.0.post1
|
name: dvc
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- altgraph==0.17.4
- asciimatics==1.15.0
- awscli==1.38.23
- azure-common==1.1.28
- azure-nspkg==3.0.2
- azure-storage-blob==1.3.0
- azure-storage-common==1.3.0
- azure-storage-nspkg==3.1.0
- bcrypt==4.3.0
- boto==2.49.0
- boto3==1.7.4
- botocore==1.10.84
- cachetools==5.5.2
- certifi==2025.1.31
- cffi==1.17.1
- charset-normalizer==3.4.1
- codecov==2.1.13
- collective-checkdocs==0.2
- colorama==0.4.6
- configobj==5.0.9
- configparser==7.2.0
- coverage==7.8.0
- cryptography==44.0.2
- decorator==5.2.1
- distro==1.9.0
- docutils==0.16
- exceptiongroup==1.2.2
- future==1.0.0
- gitdb==4.0.12
- gitpython==3.1.44
- google-api-core==1.34.1
- google-auth==2.38.0
- google-cloud-core==0.28.1
- google-cloud-storage==1.12.0
- google-compute-engine==2.8.13
- google-crc32c==1.7.1
- google-resumable-media==2.7.2
- googleapis-common-protos==1.69.2
- grandalf==0.6
- idna==3.10
- iniconfig==2.1.0
- jmespath==0.10.0
- jsonpath-rw==1.4.0
- macholib==1.16.3
- mock==5.2.0
- nanotime==0.5.2
- networkx==3.2.1
- nose==1.3.7
- packaging==24.2
- paramiko==3.5.1
- pefile==2024.8.26
- pillow==11.1.0
- pluggy==1.5.0
- ply==3.11
- protobuf==3.20.3
- pyasn1==0.6.1
- pyasn1-modules==0.4.2
- pycparser==2.22
- pydot==3.0.4
- pyfiglet==1.0.2
- pygments==2.19.1
- pyinstaller==3.3.1
- pynacl==1.5.0
- pyparsing==3.2.3
- pytest==8.3.5
- python-dateutil==2.9.0.post0
- pyyaml==6.0.2
- requests==2.32.3
- rsa==4.7.2
- s3transfer==0.1.13
- schema==0.7.7
- six==1.17.0
- smmap==5.0.2
- tomli==2.2.1
- urllib3==1.26.20
- wcwidth==0.2.13
- xmltodict==0.14.2
- zc-lockfile==3.0.post1
prefix: /opt/conda/envs/dvc
|
[
"tests/test_config.py::TestConfigCLI::test_root"
] |
[] |
[
"tests/test_config.py::TestConfigCLI::test",
"tests/test_config.py::TestConfigCLI::test_failed_write",
"tests/test_config.py::TestConfigCLI::test_local",
"tests/test_config.py::TestConfigCLI::test_non_existing"
] |
[] |
Apache License 2.0
| 3,305 |
[
"dvc/command/root.py"
] |
[
"dvc/command/root.py"
] |
|
streamlink__streamlink-2130
|
b21df07689023f1f6fc79b228da4faa76c617667
|
2018-10-23 16:59:19
|
42c34ca104f9a1761164dfce6c3ebabea984a823
|
diff --git a/docs/plugin_matrix.rst b/docs/plugin_matrix.rst
index 664e80f6..81d3ec1d 100644
--- a/docs/plugin_matrix.rst
+++ b/docs/plugin_matrix.rst
@@ -108,6 +108,7 @@ livestream new.livestream.com Yes --
lrt lrt.lt Yes No
ltv_lsm_lv ltv.lsm.lv Yes No Streams may be geo-restricted to Latvia.
mediaklikk mediaklikk.hu Yes No Streams may be geo-restricted to Hungary.
+metube metube.id Yes Yes
mitele mitele.es Yes No Streams may be geo-restricted to Spain.
mixer mixer.com Yes Yes
mjunoon mjunoon.tv Yes Yes
@@ -219,6 +220,7 @@ tv5monde - tv5monde.com Yes Yes Streams may be geo-rest
tv8 tv8.com.tr Yes No
tv360 tv360.com.tr Yes No
tvcatchup tvcatchup.com Yes No Streams may be geo-restricted to Great Britain.
+tvibo player.tvibo.com Yes --
tvnbg - tvn.bg Yes -
- live.tvn.bg
tvp tvpstream.vod.tvp.pl Yes No Streams may be geo-restricted to Poland.
diff --git a/src/streamlink/plugin/plugin.py b/src/streamlink/plugin/plugin.py
index 1f5513d7..ef38ac47 100644
--- a/src/streamlink/plugin/plugin.py
+++ b/src/streamlink/plugin/plugin.py
@@ -384,6 +384,7 @@ class Plugin(object):
stream_names = filter(stream_weight_only, streams.keys())
sorted_streams = sorted(stream_names, key=stream_weight_only)
+ unfiltered_sorted_streams = sorted_streams
if isinstance(sorting_excludes, list):
for expr in sorting_excludes:
@@ -402,6 +403,11 @@ class Plugin(object):
worst = sorted_streams[0]
final_sorted_streams["worst"] = streams[worst]
final_sorted_streams["best"] = streams[best]
+ elif len(unfiltered_sorted_streams) > 0:
+ best = unfiltered_sorted_streams[-1]
+ worst = unfiltered_sorted_streams[0]
+ final_sorted_streams["worst-unfiltered"] = streams[worst]
+ final_sorted_streams["best-unfiltered"] = streams[best]
return final_sorted_streams
diff --git a/src/streamlink/plugins/bilibili.py b/src/streamlink/plugins/bilibili.py
index 4e3c068e..8ddb95cd 100644
--- a/src/streamlink/plugins/bilibili.py
+++ b/src/streamlink/plugins/bilibili.py
@@ -1,15 +1,12 @@
-import hashlib
import re
-import time
from requests.adapters import HTTPAdapter
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate, useragents
from streamlink.stream import HTTPStream
-API_URL = "http://live.bilibili.com/api/playurl?cid={0}&player=1&quality=0&sign={1}&otype=json"
+API_URL = "https://api.live.bilibili.com/room/v1/Room/playUrl?cid={0}&quality=0&platform=web"
ROOM_API = "https://api.live.bilibili.com/room/v1/Room/room_init?id={}"
-API_SECRET = "95acd7f6cc3392f3"
SHOW_STATUS_OFFLINE = 0
SHOW_STATUS_ONLINE = 1
SHOW_STATUS_ROUND = 2
@@ -32,6 +29,15 @@ _room_id_schema = validate.Schema(
validate.get("data")
)
+_room_stream_list_schema = validate.Schema(
+ {
+ "data": validate.any(None, {
+ "durl": [{"url": validate.url()}]
+ })
+ },
+ validate.get("data")
+)
+
class Bilibili(Plugin):
@classmethod
@@ -56,11 +62,8 @@ class Bilibili(Plugin):
if room_id_json['live_status'] != SHOW_STATUS_ONLINE:
return
- ts = int(time.time() / 60)
- sign = hashlib.md5(("{0}{1}".format(channel, API_SECRET, ts)).encode("utf-8")).hexdigest()
-
- res = self.session.http.get(API_URL.format(room_id, sign))
- room = self.session.http.json(res)
+ res = self.session.http.get(API_URL.format(room_id))
+ room = self.session.http.json(res, schema=_room_stream_list_schema)
if not room:
return
diff --git a/src/streamlink/plugins/huomao.py b/src/streamlink/plugins/huomao.py
index aee762b3..e0d5770f 100644
--- a/src/streamlink/plugins/huomao.py
+++ b/src/streamlink/plugins/huomao.py
@@ -4,8 +4,8 @@ simply extracts the videos stream_id, stream_url and stream_quality by
scraping the HTML and JS of one of Huomaos mobile webpages.
When viewing a stream on huomao.com, the base URL references a room_id. This
-room_id is mapped one-to-one to a stream_id which references the actual .flv
-video. Both stream_id, stream_url and stream_quality can be found in the
+room_id is mapped one-to-one to a stream_id which references the actual .m3u8
+file. Both stream_id, stream_url and stream_quality can be found in the
HTML and JS source of the mobile_page. Since one stream can occur in many
different qualities, we scrape all stream_url and stream_quality occurrences
and return each option to the user.
@@ -14,7 +14,7 @@ and return each option to the user.
import re
from streamlink.plugin import Plugin
-from streamlink.stream import HTTPStream
+from streamlink.stream import HLSStream
# URL pattern for recognizing inputed Huomao.tv / Huomao.com URL.
url_re = re.compile(r"""
@@ -35,18 +35,15 @@ mobile_url = "http://www.huomao.com/mobile/mob_live/{0}"
# <input id="html_stream" value="efmrCH" type="hidden">
stream_id_pattern = re.compile(r'id=\"html_stream\" value=\"(?P<stream_id>\w+)\"')
-# Pattern for extracting each stream_url, stream_quality_url and a prettified
+# Pattern for extracting each stream_url and
# stream_quality_name used for quality naming.
#
# Example from HTML:
-# "2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8'"
+# src="http://live-ws-hls.huomaotv.cn/live/<stream_id>_720/playlist.m3u8"
stream_info_pattern = re.compile(r"""
- [1-9]:
- \s+
- '(?P<stream_url>(?:\w|\.|:|-|/)+)
- '\+stream\+'
- (?P<stream_quality_url>_?(?P<stream_quality_name>\d*))
- /playlist.m3u8'
+ (?P<stream_url>(?:[\w\/\.\-:]+)
+ \/[^_\"]+(?:_(?P<stream_quality_name>\d+))
+ ?/playlist.m3u8)
""", re.VERBOSE)
@@ -65,11 +62,11 @@ class Huomao(Plugin):
return stream_id.group("stream_id")
def get_stream_info(self, html):
- """Returns a nested list of different stream options.
+ """
+ Returns a nested list of different stream options.
- Each entry in the list will contain a stream_url, stream_quality_url
- and stream_quality_name for each stream occurrence that was found in
- the JS.
+ Each entry in the list will contain a stream_url and stream_quality_name
+ for each stream occurrence that was found in the JS.
"""
stream_info = stream_info_pattern.findall(html)
@@ -80,8 +77,8 @@ class Huomao(Plugin):
# list and reassigning.
stream_info_list = []
for info in stream_info:
- if not info[2]:
- stream_info_list.append([info[0], info[1], "source"])
+ if not info[1]:
+ stream_info_list.append([info[0], "source"])
else:
stream_info_list.append(list(info))
@@ -95,8 +92,8 @@ class Huomao(Plugin):
streams = {}
for info in stream_info:
- streams[info[2]] = HTTPStream(self.session,
- info[0] + stream_id + info[1] + ".flv")
+ if stream_id in info[0]:
+ streams[info[1]] = HLSStream(self.session, info[0])
return streams
diff --git a/src/streamlink/plugins/metube.py b/src/streamlink/plugins/metube.py
new file mode 100644
index 00000000..8e78e929
--- /dev/null
+++ b/src/streamlink/plugins/metube.py
@@ -0,0 +1,58 @@
+import re
+
+from streamlink.plugin import Plugin
+from streamlink.plugin.api import useragents
+from streamlink.stream import HLSStream
+
+
+class MeTube(Plugin):
+
+ _url_re = re.compile(r"""https?://(?:www\.)?metube\.id/
+ (?P<type>live|videos)/\w+(?:/.*)?""", re.VERBOSE)
+
+ # extracted from webpage source
+ _VOD_STREAM_NAMES = {
+ "3000k": "1080p",
+ "1800k": "720p",
+ "800k": "480p",
+ "300k": "240p"
+ }
+
+ @classmethod
+ def can_handle_url(cls, url):
+ return cls._url_re.match(url) is not None
+
+ def _get_streams(self):
+ stream_type = self._url_re.match(self.url).group("type")
+ hls_re = re.compile(r"""["'](?P<url>[^"']+\.m3u8[^"']*?)["']""")
+
+ headers = {
+ "Origin": "https://www.metube.id",
+ "User-Agent": useragents.FIREFOX
+ }
+
+ res = self.session.http.get(self.url)
+ match = hls_re.search(res.text)
+
+ if not match:
+ return
+
+ stream_url = match.group("url")
+
+ if stream_type == "live":
+ return HLSStream.parse_variant_playlist(self.session, stream_url,
+ headers=headers)
+ else:
+ streams = {}
+
+ for quality, stream in HLSStream.parse_variant_playlist(
+ self.session,
+ stream_url,
+ headers=headers).items():
+ name = self._VOD_STREAM_NAMES.get(quality, quality)
+ streams[name] = stream
+
+ return streams
+
+
+__plugin__ = MeTube
diff --git a/src/streamlink/plugins/tvibo.py b/src/streamlink/plugins/tvibo.py
new file mode 100644
index 00000000..71ec03a7
--- /dev/null
+++ b/src/streamlink/plugins/tvibo.py
@@ -0,0 +1,34 @@
+import logging
+import re
+
+from streamlink.plugin import Plugin
+from streamlink.stream import HLSStream
+
+log = logging.getLogger(__name__)
+
+
+class Tvibo(Plugin):
+
+ _url_re = re.compile(r"https?://player\.tvibo\.com/\w+/(?P<id>\d+)")
+ _api_url = "http://panel.tvibo.com/api/player/streamurl/{id}"
+
+ @classmethod
+ def can_handle_url(cls, url):
+ return cls._url_re.match(url) is not None
+
+ def _get_streams(self):
+ channel_id = self._url_re.match(self.url).group("id")
+
+ api_response = self.session.http.get(
+ self._api_url.format(id=channel_id),
+ acceptable_status=(200, 404))
+
+ data = self.session.http.json(api_response)
+ log.trace("{0!r}".format(data))
+ if data.get("st"):
+ yield "source", HLSStream(self.session, data["st"])
+ elif data.get("error"):
+ log.error(data["error"]["message"])
+
+
+__plugin__ = Tvibo
diff --git a/src/streamlink_cli/argparser.py b/src/streamlink_cli/argparser.py
index 0c77adb3..6af91976 100644
--- a/src/streamlink_cli/argparser.py
+++ b/src/streamlink_cli/argparser.py
@@ -107,7 +107,7 @@ def build_parser():
help="""
Stream to play.
- Use "best" or "worst" for selecting the highest or lowest available
+ Use ``best`` or ``worst`` for selecting the highest or lowest available
quality.
Fallback streams can be specified by using a comma-separated list:
@@ -523,7 +523,7 @@ def build_parser():
help="""
Stream to play.
- Use "best" or "worst" for selecting the highest or lowest available
+ Use ``best`` or ``worst`` for selecting the highest or lowest available
quality.
Fallback streams can be specified by using a comma-separated list:
@@ -590,13 +590,17 @@ def build_parser():
metavar="STREAMS",
type=comma_list,
help="""
- Fine tune best/worst synonyms by excluding unwanted streams.
+ Fine tune the ``best`` and ``worst`` stream name synonyms by excluding unwanted streams.
+
+ If all of the available streams get excluded, ``best`` and ``worst`` will become
+ inaccessible and new special stream synonyms ``best-unfiltered`` and ``worst-unfiltered``
+ can be used as a fallback selection method.
Uses a filter expression in the format:
[operator]<value>
- Valid operators are >, >=, < and <=. If no operator is specified then
+ Valid operators are ``>``, ``>=``, ``<`` and ``<=``. If no operator is specified then
equality is tested.
For example this will exclude streams ranked higher than "480p":
diff --git a/src/streamlink_cli/constants.py b/src/streamlink_cli/constants.py
index 05ec5dba..45eb7894 100644
--- a/src/streamlink_cli/constants.py
+++ b/src/streamlink_cli/constants.py
@@ -28,7 +28,7 @@ else:
]
PLUGINS_DIR = os.path.expanduser(XDG_CONFIG_HOME + "/streamlink/plugins")
-STREAM_SYNONYMS = ["best", "worst"]
+STREAM_SYNONYMS = ["best", "worst", "best-unfiltered", "worst-unfiltered"]
STREAM_PASSTHROUGH = ["hls", "http", "rtmp"]
__all__ = [
diff --git a/src/streamlink_cli/main.py b/src/streamlink_cli/main.py
index 3fe315ce..b43175a6 100644
--- a/src/streamlink_cli/main.py
+++ b/src/streamlink_cli/main.py
@@ -57,10 +57,14 @@ def check_file_output(filename, force):
log.debug("Checking file output")
if os.path.isfile(filename) and not force:
- answer = console.ask("File {0} already exists! Overwrite it? [y/N] ",
- filename)
+ if sys.stdin.isatty():
+ answer = console.ask("File {0} already exists! Overwrite it? [y/N] ",
+ filename)
- if answer.lower() != "y":
+ if answer.lower() != "y":
+ sys.exit()
+ else:
+ log.error("File {0} already exists, use --force to overwrite it.".format(filename))
sys.exit()
return FileOutput(filename)
@@ -322,7 +326,7 @@ def read_stream(stream, output, prebuffer, chunk_size=8192):
is_player = isinstance(output, PlayerOutput)
is_http = isinstance(output, HTTPServer)
is_fifo = is_player and output.namedpipe
- show_progress = isinstance(output, FileOutput) and output.fd is not stdout
+ show_progress = isinstance(output, FileOutput) and output.fd is not stdout and sys.stdout.isatty()
stream_iterator = chain(
[prebuffer],
|
Azerbaycan stations
## Feature Request
- [x ] This is a feature request and I have read the contribution guidelines.
### Description
I want see the LiveStream over Streamlink Plugin
### Expected / Actual behavior
The livestreams can be played on the page http://www.idmantv.az via the Firefox browser.
The site includes the broadcasters AZTV, Idman TV and Medeniyet TV
About the VLC player, it is not possible because the transmitter permanently tokens changes, the Streamlinkplugin should be able to handle it.
### Additional comments, screenshots, etc.

AZ TV
http://185.102.219.82/5929820/tracks-v1a1/index.m3u8?token=
http://player.tvibo.com/aztv/5929820
Medeniyet
http://185.102.219.82/6858270/tracks-v1a1/index.m3u8?token=
http://player.tvibo.com/aztv/6858270/
Idman TV
http://185.102.219.82/3977238/tracks-v1a1/index.m3u8?token=
http://player.tvibo.com/aztv/3977238/
|
streamlink/streamlink
|
diff --git a/tests/plugins/test_huomao.py b/tests/plugins/test_huomao.py
index a27efdcb..1261680f 100644
--- a/tests/plugins/test_huomao.py
+++ b/tests/plugins/test_huomao.py
@@ -15,15 +15,12 @@ class TestPluginHuomao(unittest.TestCase):
# room_id = 123456
# stream_id = 9qsvyF24659
# stream_url = http://live-ws.huomaotv.cn/live/
- # stream_quality = source, _720 and _480
# stream_quality_name = source, 720 and 480
self.mock_html = """
<input id="html_stream" value="9qsvyF24659" type="hidden">
- <!-- urls:{-->
- <!-- 1: 'http://live-ws.huomaotv.cn/live/'+stream+'/playlist.m3u8',-->
- <!-- 2: 'http://live-ws.huomaotv.cn/live/'+stream+'_720/playlist.m3u8',-->
- <!-- 3: 'http://live-ws.huomaotv.cn/live/'+stream+'_480/playlist.m3u8'-->
- <!-- },-->
+ <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659/playlist.m3u8">
+ <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_720/playlist.m3u8">
+ <source src="http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_480/playlist.m3u8">
"""
# Create a mock Huomao object.
@@ -43,9 +40,9 @@ class TestPluginHuomao(unittest.TestCase):
# Assert that the stream_url, stream_quality and stream_quality_name
# is correctly extracted from the mock HTML.
self.assertEqual(self.mock_huomao.get_stream_info(self.mock_html), [
- ["http://live-ws.huomaotv.cn/live/", "", "source"],
- ["http://live-ws.huomaotv.cn/live/", "_720", "720"],
- ["http://live-ws.huomaotv.cn/live/", "_480", "480"]
+ ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659/playlist.m3u8", "source"],
+ ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_720/playlist.m3u8", "720"],
+ ["http://live-ws-hls.huomaotv.cn/live/9qsvyF24659_480/playlist.m3u8", "480"]
])
def test_can_handle_url(self):
diff --git a/tests/plugins/test_metube.py b/tests/plugins/test_metube.py
new file mode 100644
index 00000000..0848dac8
--- /dev/null
+++ b/tests/plugins/test_metube.py
@@ -0,0 +1,24 @@
+import unittest
+
+from streamlink.plugins.metube import MeTube
+
+
+class TestPluginMeTube(unittest.TestCase):
+ def test_can_handle_url(self):
+ should_match = [
+ 'https://www.metube.id/live/METROTV',
+ 'https://www.metube.id/live/GTV',
+ 'https://www.metube.id/videos/16881738/yudi_28_bogor_-amazingakak',
+ 'https://www.metube.id/videos/16873428/liverpool-vs-psg-3-2-goals-and-highlights-2018',
+ ]
+ for url in should_match:
+ self.assertTrue(MeTube.can_handle_url(url))
+
+ def test_can_handle_url_negative(self):
+ should_not_match = [
+ 'https://www.metube.id/me/IMAA2018',
+ 'https://www.metube.id/auditions',
+ 'https://www.twitch.tv/twitch'
+ ]
+ for url in should_not_match:
+ self.assertFalse(MeTube.can_handle_url(url))
diff --git a/tests/plugins/test_tvibo.py b/tests/plugins/test_tvibo.py
new file mode 100644
index 00000000..401bc70b
--- /dev/null
+++ b/tests/plugins/test_tvibo.py
@@ -0,0 +1,22 @@
+import unittest
+
+from streamlink.plugins.tvibo import Tvibo
+
+
+class TestPluginTvibo(unittest.TestCase):
+ def test_can_handle_url(self):
+ should_match = [
+ 'http://player.tvibo.com/aztv/5929820',
+ 'http://player.tvibo.com/aztv/6858270/',
+ 'http://player.tvibo.com/aztv/3977238/',
+ ]
+ for url in should_match:
+ self.assertTrue(Tvibo.can_handle_url(url))
+
+ def test_can_handle_url_negative(self):
+ should_not_match = [
+ 'http://www.idmantv.az/',
+ 'https://www.twitch.tv/twitch'
+ ]
+ for url in should_not_match:
+ self.assertFalse(Tvibo.can_handle_url(url))
diff --git a/tests/plugins/testplugin.py b/tests/plugins/testplugin.py
index 06b693c4..66822ef4 100644
--- a/tests/plugins/testplugin.py
+++ b/tests/plugins/testplugin.py
@@ -37,6 +37,14 @@ class TestPlugin(Plugin):
def _get_streams(self):
if "empty" in self.url:
return
+
+ if "UnsortableStreamNames" in self.url:
+ def gen():
+ for i in range(3):
+ yield "vod", HTTPStream(self.session, "http://test.se/stream")
+
+ return gen()
+
if "NoStreamsError" in self.url:
raise NoStreamsError(self.url)
diff --git a/tests/test_cli_main.py b/tests/test_cli_main.py
index 9d817da7..2b58ea5f 100644
--- a/tests/test_cli_main.py
+++ b/tests/test_cli_main.py
@@ -3,8 +3,9 @@ import os.path
import tempfile
import streamlink_cli.main
-from streamlink_cli.main import resolve_stream_name, check_file_output
+from streamlink_cli.main import resolve_stream_name, format_valid_streams, check_file_output
from streamlink_cli.output import FileOutput
+from streamlink.plugin.plugin import Plugin
import unittest
from tests.mock import Mock, patch
@@ -18,12 +19,25 @@ class TestCLIMain(unittest.TestCase):
tmpfile = tempfile.NamedTemporaryFile()
try:
streamlink_cli.main.console = console = Mock()
+ streamlink_cli.main.sys.stdin = stdin = Mock()
+ stdin.isatty.return_value = True
console.ask.return_value = "y"
self.assertTrue(os.path.exists(tmpfile.name))
self.assertIsInstance(check_file_output(tmpfile.name, False), FileOutput)
finally:
tmpfile.close()
+ def test_check_file_output_exists_notty(self):
+ tmpfile = tempfile.NamedTemporaryFile()
+ try:
+ streamlink_cli.main.console = console = Mock()
+ streamlink_cli.main.sys.stdin = stdin = Mock()
+ stdin.isatty.return_value = False
+ self.assertTrue(os.path.exists(tmpfile.name))
+ self.assertRaises(SystemExit, check_file_output, tmpfile.name, False)
+ finally:
+ tmpfile.close()
+
def test_check_file_output_exists_force(self):
tmpfile = tempfile.NamedTemporaryFile()
try:
@@ -46,19 +60,71 @@ class TestCLIMain(unittest.TestCase):
tmpfile.close()
def test_resolve_stream_name(self):
- high = Mock()
- medium = Mock()
- low = Mock()
+ a = Mock()
+ b = Mock()
+ c = Mock()
+ d = Mock()
+ e = Mock()
streams = {
- "low": low,
- "medium": medium,
- "high": high,
- "worst": low,
- "best": high
+ "160p": a,
+ "360p": b,
+ "480p": c,
+ "720p": d,
+ "1080p": e,
+ "worst": b,
+ "best": d,
+ "worst-unfiltered": a,
+ "best-unfiltered": e
}
- self.assertEqual("high", resolve_stream_name(streams, "best"))
- self.assertEqual("low", resolve_stream_name(streams, "worst"))
- self.assertEqual("medium", resolve_stream_name(streams, "medium"))
- self.assertEqual("high", resolve_stream_name(streams, "high"))
- self.assertEqual("low", resolve_stream_name(streams, "low"))
+ self.assertEqual(resolve_stream_name(streams, "unknown"), "unknown")
+ self.assertEqual(resolve_stream_name(streams, "160p"), "160p")
+ self.assertEqual(resolve_stream_name(streams, "360p"), "360p")
+ self.assertEqual(resolve_stream_name(streams, "480p"), "480p")
+ self.assertEqual(resolve_stream_name(streams, "720p"), "720p")
+ self.assertEqual(resolve_stream_name(streams, "1080p"), "1080p")
+ self.assertEqual(resolve_stream_name(streams, "worst"), "360p")
+ self.assertEqual(resolve_stream_name(streams, "best"), "720p")
+ self.assertEqual(resolve_stream_name(streams, "worst-unfiltered"), "160p")
+ self.assertEqual(resolve_stream_name(streams, "best-unfiltered"), "1080p")
+
+ def test_format_valid_streams(self):
+ class FakePlugin:
+ @classmethod
+ def stream_weight(cls, stream):
+ return Plugin.stream_weight(stream)
+ a = Mock()
+ b = Mock()
+ c = Mock()
+
+ streams = {
+ "audio": a,
+ "720p": b,
+ "1080p": c,
+ "worst": b,
+ "best": c
+ }
+ self.assertEqual(
+ format_valid_streams(FakePlugin, streams),
+ ", ".join([
+ "audio",
+ "720p (worst)",
+ "1080p (best)"
+ ])
+ )
+
+ streams = {
+ "audio": a,
+ "720p": b,
+ "1080p": c,
+ "worst-unfiltered": b,
+ "best-unfiltered": c
+ }
+ self.assertEqual(
+ format_valid_streams(FakePlugin, streams),
+ ", ".join([
+ "audio",
+ "720p (worst-unfiltered)",
+ "1080p (best-unfiltered)"
+ ])
+ )
diff --git a/tests/test_session.py b/tests/test_session.py
index 573aae37..e923ab53 100644
--- a/tests/test_session.py
+++ b/tests/test_session.py
@@ -99,12 +99,23 @@ class TestSession(unittest.TestCase):
self.assertTrue(isinstance(streams["480p"], RTMPStream))
self.assertTrue(isinstance(streams["480p_http"], HTTPStream))
- def test_plugin_stream_sorted_excludes(self):
+ def test_plugin_stream_sorting_excludes(self):
channel = self.session.resolve_url("http://test.se/channel")
- streams = channel.streams(sorting_excludes=["1080p", "3000k"])
+ streams = channel.streams(sorting_excludes=[])
self.assertTrue("best" in streams)
self.assertTrue("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst"] is streams["350k"])
+ self.assertTrue(streams["best"] is streams["1080p"])
+
+ streams = channel.streams(sorting_excludes=["1080p", "3000k"])
+ self.assertTrue("best" in streams)
+ self.assertTrue("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst"] is streams["350k"])
self.assertTrue(streams["best"] is streams["1500k"])
streams = channel.streams(sorting_excludes=[">=1080p", ">1500k"])
@@ -113,6 +124,24 @@ class TestSession(unittest.TestCase):
streams = channel.streams(sorting_excludes=lambda q: not q.endswith("p"))
self.assertTrue(streams["best"] is streams["3000k"])
+ streams = channel.streams(sorting_excludes=lambda q: False)
+ self.assertFalse("best" in streams)
+ self.assertFalse("worst" in streams)
+ self.assertTrue("best-unfiltered" in streams)
+ self.assertTrue("worst-unfiltered" in streams)
+ self.assertTrue(streams["worst-unfiltered"] is streams["350k"])
+ self.assertTrue(streams["best-unfiltered"] is streams["1080p"])
+
+ channel = self.session.resolve_url("http://test.se/UnsortableStreamNames")
+ streams = channel.streams()
+ self.assertFalse("best" in streams)
+ self.assertFalse("worst" in streams)
+ self.assertFalse("best-unfiltered" in streams)
+ self.assertFalse("worst-unfiltered" in streams)
+ self.assertTrue("vod" in streams)
+ self.assertTrue("vod_alt" in streams)
+ self.assertTrue("vod_alt2" in streams)
+
def test_plugin_support(self):
channel = self.session.resolve_url("http://test.se/channel")
streams = channel.streams()
|
{
"commit_name": "merge_commit",
"failed_lite_validators": [
"has_hyperlinks",
"has_media",
"has_added_files",
"has_many_modified_files",
"has_many_hunks",
"has_pytest_match_arg"
],
"has_test_patch": true,
"is_lite": false,
"llm_score": {
"difficulty_score": 2,
"issue_text_score": 0,
"test_score": 2
},
"num_modified_files": 7
}
|
0.14
|
{
"env_vars": null,
"env_yml_path": null,
"install": "pip install -e .[dev]",
"log_parser": "parse_log_pytest",
"no_use_env": null,
"packages": "requirements.txt",
"pip_packages": [
"pytest"
],
"pre_install": [
"apt-get update",
"apt-get install -y gcc"
],
"python": "3.9",
"reqs_path": [
"dev-requirements.txt"
],
"test_cmd": "pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning"
}
|
certifi==2025.1.31
charset-normalizer==3.4.1
codecov==2.1.13
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
freezegun==1.5.1
idna==3.10
iniconfig==2.1.0
iso-639==0.4.5
iso3166==2.1.1
isodate==0.7.2
Jinja2==3.1.6
MarkupSafe==3.0.2
mock==5.2.0
packaging==24.2
pluggy==1.5.0
pycryptodome==3.22.0
pynsist==2.8
PySocks==1.7.1
pytest==8.3.5
pytest-cov==6.0.0
python-dateutil==2.9.0.post0
requests==2.32.3
requests-mock==1.12.1
requests_download==0.1.2
six==1.17.0
-e git+https://github.com/streamlink/streamlink.git@b21df07689023f1f6fc79b228da4faa76c617667#egg=streamlink
tomli==2.2.1
urllib3==2.3.0
websocket-client==1.8.0
yarg==0.1.10
|
name: streamlink
channels:
- defaults
- https://repo.anaconda.com/pkgs/main
- https://repo.anaconda.com/pkgs/r
- conda-forge
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2025.2.25=h06a4308_0
- ld_impl_linux-64=2.40=h12ee557_0
- libffi=3.4.4=h6a678d5_1
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=3.0.16=h5eee18b_0
- pip=25.0=py39h06a4308_0
- python=3.9.21=he870216_1
- readline=8.2=h5eee18b_0
- setuptools=75.8.0=py39h06a4308_0
- sqlite=3.45.3=h5eee18b_0
- tk=8.6.14=h39e8969_0
- tzdata=2025a=h04d1e81_0
- wheel=0.45.1=py39h06a4308_0
- xz=5.6.4=h5eee18b_1
- zlib=1.2.13=h5eee18b_1
- pip:
- certifi==2025.1.31
- charset-normalizer==3.4.1
- codecov==2.1.13
- coverage==7.8.0
- distlib==0.3.9
- exceptiongroup==1.2.2
- freezegun==1.5.1
- idna==3.10
- iniconfig==2.1.0
- iso-639==0.4.5
- iso3166==2.1.1
- isodate==0.7.2
- jinja2==3.1.6
- markupsafe==3.0.2
- mock==5.2.0
- packaging==24.2
- pluggy==1.5.0
- pycryptodome==3.22.0
- pynsist==2.8
- pysocks==1.7.1
- pytest==8.3.5
- pytest-cov==6.0.0
- python-dateutil==2.9.0.post0
- requests==2.32.3
- requests-download==0.1.2
- requests-mock==1.12.1
- six==1.17.0
- tomli==2.2.1
- urllib3==2.3.0
- websocket-client==1.8.0
- yarg==0.1.10
prefix: /opt/conda/envs/streamlink
|
[
"tests/plugins/test_huomao.py::TestPluginHuomao::test_can_handle_url",
"tests/plugins/test_huomao.py::TestPluginHuomao::test_get_stream_id",
"tests/plugins/test_huomao.py::TestPluginHuomao::test_get_stream_quality",
"tests/plugins/test_metube.py::TestPluginMeTube::test_can_handle_url",
"tests/plugins/test_metube.py::TestPluginMeTube::test_can_handle_url_negative",
"tests/plugins/test_tvibo.py::TestPluginTvibo::test_can_handle_url",
"tests/plugins/test_tvibo.py::TestPluginTvibo::test_can_handle_url_negative",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists_force",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists_no",
"tests/test_cli_main.py::TestCLIMain::test_check_file_output_exists_notty",
"tests/test_cli_main.py::TestCLIMain::test_format_valid_streams",
"tests/test_cli_main.py::TestCLIMain::test_resolve_stream_name",
"tests/test_session.py::TestSession::test_builtin_plugins",
"tests/test_session.py::TestSession::test_exceptions",
"tests/test_session.py::TestSession::test_load_plugins",
"tests/test_session.py::TestSession::test_options",
"tests/test_session.py::TestSession::test_plugin",
"tests/test_session.py::TestSession::test_plugin_stream_sorting_excludes",
"tests/test_session.py::TestSession::test_plugin_stream_types",
"tests/test_session.py::TestSession::test_plugin_support",
"tests/test_session.py::TestSession::test_resolve_url",
"tests/test_session.py::TestSession::test_resolve_url_no_redirect",
"tests/test_session.py::TestSession::test_resolve_url_priority",
"tests/test_session.py::TestSession::test_set_and_get_locale",
"tests/test_session.py::TestSession::test_short_exception"
] |
[] |
[] |
[] |
BSD 2-Clause "Simplified" License
| 3,306 |
[
"src/streamlink_cli/constants.py",
"src/streamlink_cli/main.py",
"docs/plugin_matrix.rst",
"src/streamlink/plugins/metube.py",
"src/streamlink/plugins/huomao.py",
"src/streamlink_cli/argparser.py",
"src/streamlink/plugins/tvibo.py",
"src/streamlink/plugins/bilibili.py",
"src/streamlink/plugin/plugin.py"
] |
[
"src/streamlink_cli/constants.py",
"src/streamlink_cli/main.py",
"docs/plugin_matrix.rst",
"src/streamlink/plugins/metube.py",
"src/streamlink/plugins/huomao.py",
"src/streamlink_cli/argparser.py",
"src/streamlink/plugins/tvibo.py",
"src/streamlink/plugins/bilibili.py",
"src/streamlink/plugin/plugin.py"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.