Skip to content

Commit

Permalink
Merge pull request #48 from hhoppe:main
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 640872341
  • Loading branch information
The mediapy Authors committed Jun 6, 2024
2 parents 8e12b3b + 448b801 commit d8dead3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
6 changes: 3 additions & 3 deletions mediapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
from __future__ import annotations

__docformat__ = 'google'
__version__ = '1.2.1'
__version__ = '1.2.2'
__version_info__ = tuple(int(num) for num in __version__.split('.'))

import base64
Expand Down Expand Up @@ -188,7 +188,7 @@

_IPYTHON_HTML_SIZE_LIMIT = 20_000_000
_T = typing.TypeVar('_T')
_Path = typing.Union[str, os.PathLike[str]]
_Path = typing.Union[str, 'os.PathLike[str]']

_IMAGE_COMPARISON_HTML = """\
<script
Expand Down Expand Up @@ -842,7 +842,7 @@ def to_rgb(
if hasattr(matplotlib, 'colormaps'):
rgb_from_scalar: Any = matplotlib.colormaps[cmap] # Newer version.
else:
rgb_from_scalar = matplotlib.pyplot.cm.get_cmap(cmap)
rgb_from_scalar = matplotlib.pyplot.cm.get_cmap(cmap) # type: ignore # pylint: disable=no-member
else:
rgb_from_scalar = cmap
a = rgb_from_scalar(a)
Expand Down
21 changes: 20 additions & 1 deletion mediapy_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@
"id": "aWsSq68z9RWv"
},
"source": [
"<!--\n",
"Copyright 2024 The mediapy Authors.\n",
"\n",
"Licensed under the Apache License, Version 2.0 (the \"License\");\n",
"you may not use this file except in compliance with the License.\n",
"You may obtain a copy of the License at\n",
"\n",
" http://www.apache.org/licenses/LICENSE-2.0\n",
"\n",
"Unless required by applicable law or agreed to in writing, software\n",
"distributed under the License is distributed on an \"AS IS\" BASIS,\n",
"WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
"See the License for the specific language governing permissions and\n",
"limitations under the License.\n",
"-->\n",
"<!--\n",
"pylint: disable=line-too-long\n",
"pylint: disable=missing-module-docstring\n",
"-->\n",
"# mediapy: Read/write/show images and videos in a Python notebook\n",
"\n",
"[**[GitHub source]**](https://github.com/google/mediapy) \u0026nbsp;\n",
Expand Down Expand Up @@ -49,7 +68,7 @@
"outputs": [],
"source": [
"!command -v ffmpeg \u003e/dev/null || (apt update \u0026\u0026 apt install -y ffmpeg)\n",
"!pip install -q mediapy\n"
"!pip install -q mediapy"
]
},
{
Expand Down
15 changes: 15 additions & 0 deletions mediapy_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@

# %% [markdown]
# <!--
# Copyright 2024 The mediapy Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -->
# <!--
# pylint: disable=line-too-long
# pylint: disable=missing-module-docstring
# -->
Expand Down
2 changes: 1 addition & 1 deletion mediapy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def gray(x):
if hasattr(matplotlib, 'colormaps'):
cmap = matplotlib.colormaps['gray'] # Newer version.
else:
cmap = matplotlib.pyplot.cm.get_cmap('gray')
cmap = matplotlib.pyplot.cm.get_cmap('gray') # pylint: disable=no-member
return cmap(x)[..., :3]

self.assert_all_close(media.to_rgb(a), gray([0.0, 0.5, 1.0]))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repository = "https://github.com/google/mediapy"
# Other: `documentation`, `changelog`

[project.optional-dependencies]
# Development deps (unittest, linting, formating,...)
# Development deps (unittest, linting, formatting,...)
# Installed through `pip install .[dev]`
dev = [
"absl-py",
Expand Down

0 comments on commit d8dead3

Please sign in to comment.