Skip to content

Commit

Permalink
Improve type annotations for core.structure (materialsproject#3837)
Browse files Browse the repository at this point in the history
* remove a lot of ignore tags

* first go: quick look and comment/type tweaks

* remove ALL type: ignore[reportPossiblyUnboundVariable]

* a quick look

* tweak module docstring

* fix/supress PossiblyUnboundVariable

* pre-commit fix

* add debug tag

* fix some mypy errors

* fix some mypy errors

* suppress errors in `__setitem__`

* fix typos

* fix union

* revert change to md

* tweaks

---------

Co-authored-by: Janosh Riebesell <[email protected]>
  • Loading branch information
DanielYang59 and janosh authored May 25, 2024
1 parent 74e692b commit d0ad785
Show file tree
Hide file tree
Showing 11 changed files with 422 additions and 319 deletions.
2 changes: 1 addition & 1 deletion .github/code_of_conduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
level of experience, education, socioeconomic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards
Expand Down
3 changes: 2 additions & 1 deletion pymatgen/analysis/chemenv/utils/scripts_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def compute_environments(chemenv_configuration):
default_strategy.setup_options(chemenv_configuration.package_options["default_strategy"]["strategy_options"])
max_dist_factor = chemenv_configuration.package_options["default_max_distance_factor"]
first_time = True
test = None
while True:
if len(questions) > 1:
found = False
Expand Down Expand Up @@ -240,7 +241,7 @@ def compute_environments(chemenv_configuration):

input_source = ""
if found and len(questions) > 1:
input_source = test # type: ignore[reportPossiblyUnboundVariable]
input_source = test

structure = None
if source_type == "cif":
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/local_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ def get_all_voronoi_polyhedra(self, structure: Structure):
del indices # Save memory (tessellations can be costly)

# Run the tessellation
qvoronoi_input = [s.coords for s in sites]
qvoronoi_input = [s.coords for s in sites if s is not None]
voro = Voronoi(qvoronoi_input)

# Get the information for each neighbor
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/analysis/solar/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Modules for prediciting theoretical solar-cell efficiency."""
"""Module for predicting theoretical solar-cell efficiency."""
2 changes: 1 addition & 1 deletion pymatgen/analysis/topological/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Modules for prediciting topological properties."""
"""Module for predicting topological properties."""
2 changes: 1 addition & 1 deletion pymatgen/core/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def gb_from_parameters(
sites_away_gb.append(site)
if len(sites_near_gb) >= 1:
s_near_gb = Structure.from_sites(sites_near_gb)
s_near_gb.merge_sites(tol=bond_length * rm_ratio, mode="d")
s_near_gb.merge_sites(tol=bond_length * rm_ratio, mode="delete")
all_sites = sites_away_gb + s_near_gb.sites # type: ignore
gb_with_vac = Structure.from_sites(all_sites)

Expand Down
Loading

0 comments on commit d0ad785

Please sign in to comment.