Skip to content

Commit 5bca478

Browse files
committed
Fix some pyright errors.
1 parent d52ab63 commit 5bca478

File tree

15 files changed

+25
-9
lines changed

15 files changed

+25
-9
lines changed

src/pymatgen/analysis/adsorption.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from pymatgen.util.coord import in_coord_list_pbc
2323

2424
if TYPE_CHECKING:
25-
import matplotlib.pyplot as plt
25+
from matplotlib.axes import Axes
2626
from numpy.typing import ArrayLike
2727
from typing_extensions import Self
2828

@@ -636,7 +636,7 @@ def reorient_z(structure):
636636

637637
def plot_slab(
638638
slab: Slab,
639-
ax: plt.Axes,
639+
ax: Axes,
640640
scale=0.8,
641641
repeat=5,
642642
window=1.5,

src/pymatgen/analysis/chemenv/connectivity/structure_connectivity.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import collections
6+
import collections.abc
67
import logging
78
from typing import TYPE_CHECKING
89

src/pymatgen/analysis/chemenv/coordination_environments/structure_environments.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
from pymatgen.core import Element, PeriodicNeighbor, PeriodicSite, Species, Structure
2727

2828
if TYPE_CHECKING:
29+
from matplotlib.axes import Axes
30+
from matplotlib.figure import Figure
2931
from typing_extensions import Self
3032

3133
__author__ = "David Waroquiers"
@@ -654,7 +656,7 @@ def plot_csm_and_maps(self, isite, max_csm=8.0):
654656

655657
def get_csm_and_maps(
656658
self, isite, max_csm=8.0, figsize=None, symmetry_measure_type=None
657-
) -> tuple[plt.Figure, plt.Axes] | None:
659+
) -> tuple[Figure, Axes] | None:
658660
"""
659661
Plotting of the coordination numbers of a given site for all the distfactor/angfactor parameters. If the
660662
chemical environments are given, a color map is added to the plot, with the lowest continuous symmetry measure
@@ -813,7 +815,7 @@ def get_environments_figure(
813815
strategy: Whether to plot information about one of the Chemenv Strategies.
814816
815817
Returns:
816-
tuple[plt.Figure, plt.Axes]: matplotlib figure and axes representing the environments.
818+
tuple[Figure, Axes]: matplotlib figure and axes representing the environments.
817819
"""
818820
# Initializes the figure
819821
fig = plt.figure(figsize=figsize)

src/pymatgen/analysis/diffraction/core.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from pymatgen.util.plotting import add_fig_kwargs, pretty_plot
1414

1515
if TYPE_CHECKING:
16+
from matplotlib.axes import Axes
17+
1618
from pymatgen.core import Structure
1719

1820

@@ -77,10 +79,10 @@ def get_plot(
7779
structure: Structure,
7880
two_theta_range: tuple[float, float] = (0, 90),
7981
annotate_peaks="compact",
80-
ax: plt.Axes = None,
82+
ax: Axes = None,
8183
with_labels=True,
8284
fontsize=16,
83-
) -> plt.Axes:
85+
) -> Axes:
8486
"""Get the diffraction plot as a matplotlib Axes.
8587
8688
Args:

src/pymatgen/analysis/elasticity/strain.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from __future__ import annotations
88

99
import collections
10+
import collections.abc
1011
import itertools
1112
from typing import TYPE_CHECKING
1213

src/pymatgen/analysis/eos.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from typing import Any, ClassVar
2929

3030
import matplotlib.pyplot as plt
31+
from matplotlib.axes import Axes
3132

3233
__author__ = "Kiran Mathew, gmatteo"
3334
__credits__ = "Cormac Toher"
@@ -175,10 +176,10 @@ def plot(
175176
self,
176177
width: float = 8,
177178
height: float | None = None,
178-
ax: plt.Axes = None,
179+
ax: Axes = None,
179180
dpi: float | None = None,
180181
**kwargs,
181-
) -> plt.Axes:
182+
) -> Axes:
182183
"""
183184
Plot the equation of state.
184185
@@ -231,7 +232,7 @@ def plot(
231232
@add_fig_kwargs
232233
def plot_ax(
233234
self,
234-
ax: plt.Axes | None = None,
235+
ax: Axes | None = None,
235236
fontsize: float = 12,
236237
**kwargs,
237238
) -> plt.Figure:

src/pymatgen/core/composition.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from __future__ import annotations
66

77
import collections
8+
import collections.abc
89
import math
910
import os
1011
import re

src/pymatgen/core/sites.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import collections
6+
import collections.abc
67
import json
78
import warnings
89
from typing import TYPE_CHECKING, cast

src/pymatgen/core/structure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from __future__ import annotations
77

88
import collections
9+
import collections.abc
910
import contextlib
1011
import functools
1112
import inspect

src/pymatgen/core/tensors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from __future__ import annotations
77

88
import collections
9+
import collections.abc
910
import itertools
1011
import logging
1112
import os

0 commit comments

Comments
 (0)