Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix example's BasicUnit array conversion.#19535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
tacaswell merged 3 commits intomatplotlib:masterfromQuLogic:fix-units-old-np
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions.circleci/config.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,8 +67,9 @@ commands:
- run:
name: Install Python dependencies
command: |
python -m pip install --user numpy<< parameters.numpy_version >> codecov coverage
python -m pip install --user -r requirements/doc/doc-requirements.txt
python -m pip install --user \
numpy<< parameters.numpy_version >> codecov coverage \
-r requirements/doc/doc-requirements.txt

mpl-install:
steps:
Expand Down
8 changes: 5 additions & 3 deletionsexamples/units/basic_units.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@

"""

from distutils.version import LooseVersion
import math

import numpy as np
Expand DownExpand Up@@ -154,8 +155,9 @@ def __str__(self):
def __len__(self):
return len(self.value)

def __getitem__(self, key):
return TaggedValue(self.value[key], self.unit)
if LooseVersion(np.__version__) >= '1.20':
def __getitem__(self, key):
return TaggedValue(self.value[key], self.unit)

def __iter__(self):
# Return a generator expression rather than use `yield`, so that
Expand DownExpand Up@@ -218,7 +220,7 @@ def __array_wrap__(self, array, context):
return TaggedValue(array, self)

def __array__(self, t=None, context=None):
ret = np.array([1])
ret = np.array(1)
if t is not None:
return ret.astype(t)
else:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp