Skip to content

Commit 20b9ff3

Browse files
authored
[MNT] Remove deprecated code and columns (#235)
* remove deprecated code and columns * remove deprecated functions * remove annotation * 💄
1 parent f7b558f commit 20b9ff3

File tree

5 files changed

+25
-90
lines changed

5 files changed

+25
-90
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""drop _annotation
2+
3+
Revision ID: e7191e2ea28b
4+
Revises: 285dd74e23de
5+
Create Date: 2025-03-22 18:56:26.410019
6+
7+
"""
8+
9+
# revision identifiers, used by Alembic.
10+
revision = 'e7191e2ea28b'
11+
down_revision = '285dd74e23de'
12+
branch_labels = None
13+
depends_on = None
14+
15+
from alembic import op
16+
import sqlalchemy as sa
17+
18+
19+
def upgrade():
20+
with op.batch_alter_table("elements") as batch_op:
21+
batch_op.drop_column("_annotation")
22+
23+
def downgrade():
24+
pass

docs/source/api/mendeleev.fetch.rst

-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@
88

99
.. autosummary::
1010

11-
add_plot_columns
1211
fetch_electronegativities
1312
fetch_ionic_radii
1413
fetch_ionization_energies
1514
fetch_neutral_data
1615
fetch_table
17-
get_app_data
18-
get_zeff
1916

mendeleev/elements.db

0 Bytes
Binary file not shown.

mendeleev/fetch.py

+1-72
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,16 @@
33
from typing import List, Union
44

55
import pandas as pd
6-
from deprecated import deprecated
76
from sqlalchemy.dialects import sqlite
87
from sqlalchemy import text
98

10-
from mendeleev import element, get_all_elements
11-
from mendeleev import __version__ as version
9+
from mendeleev import get_all_elements
1210
from mendeleev.electronegativity import allred_rochow, gordy, cottrell_sutton
1311

1412
from .db import get_engine, get_session
1513
from .models import Element, IonizationEnergy
1614

1715

18-
@deprecated(
19-
reason="This function is deprecated and will be removed in the future version."
20-
)
21-
def get_zeff(an, method: str = "slater") -> float:
22-
"""
23-
A helper function to calculate the effective nuclear charge.
24-
25-
Args:
26-
method: str
27-
Method to use, one of "slater" or "clementi", default="slater"
28-
29-
Returns:
30-
zeff: float
31-
Effective nuclear charge
32-
"""
33-
e = element(an)
34-
return e.zeff(method=method)
35-
36-
3716
def fetch_table(table: str, **kwargs) -> pd.DataFrame:
3817
"""
3918
Return a table from the database as :py:class:`pandas.DataFrame`
@@ -242,53 +221,3 @@ def fetch_ionic_radii(radius: str = "ionic_radius") -> pd.DataFrame:
242221
return ir.pivot_table(
243222
columns="coordination", values=radius, index=["atomic_number", "charge"]
244223
)
245-
246-
247-
@deprecated(
248-
reason="This function is deprecated and will be removed in the future version."
249-
)
250-
def add_plot_columns(elements: pd.DataFrame) -> pd.DataFrame:
251-
"""
252-
Add columns needed for the creating the plots
253-
254-
Args:
255-
elements: pd.DataFrame
256-
"""
257-
mask = elements["group_id"].notnull()
258-
259-
elements.loc[mask, "x"] = elements.loc[mask, "group_id"].astype(int)
260-
elements.loc[:, "y"] = elements.loc[:, "period"].astype(int)
261-
262-
elements.loc[mask, "group_name"] = (
263-
elements.loc[mask, "group_id"].astype(int).astype(str)
264-
)
265-
elements.loc[~mask, "group_name"] = "f block"
266-
267-
for period in [6, 7]:
268-
mask = (elements["block"] == "f") & (elements["period"] == period)
269-
elements.loc[mask, "x"] = (
270-
elements.loc[mask, "atomic_number"]
271-
- elements.loc[mask, "atomic_number"].min()
272-
+ 3
273-
)
274-
elements.loc[mask, "y"] = elements.loc[mask, "period"] + 2.5
275-
276-
# additional columns for positioning of the text
277-
278-
elements.loc[:, "y_symbol"] = elements["y"] - 0.05
279-
elements.loc[:, "y_anumber"] = elements["y"] - 0.3
280-
elements.loc[:, "y_name"] = elements["y"] + 0.18
281-
282-
return elements
283-
284-
285-
@deprecated(
286-
reason="This function is deprecated and will be removed in the future version."
287-
)
288-
def get_app_data() -> None:
289-
"write a file with the neutral data"
290-
data = fetch_neutral_data()
291-
data = add_plot_columns(data)
292-
fname = "neutral_{0:s}.pkl".format(version)
293-
data.to_pickle(fname)
294-
print("wrote file: ", fname)

mendeleev/models.py

-15
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class Element(Base):
6161
Args:
6262
abundance_crust (float): Abundance in the earth's crust in mg/kg
6363
abundance_sea (float): Abundance in the seas in mg/L
64-
annotation (str): Annotations regarding the data. Deprecated.
6564
atomic_number (int): Atomic number
6665
atomic_radius (float): Atomic radius in pm
6766
atomic_radius_rahm (float): Atomic radius by Rahm et al. in pm
@@ -159,8 +158,6 @@ class Element(Base):
159158

160159
abundance_crust = Column(Float)
161160
abundance_sea = Column(Float)
162-
# TODO: remove in a future version
163-
_annotation = Column(String)
164161
atomic_number = Column(Integer, primary_key=True)
165162
atomic_radius = Column(Float)
166163
atomic_radius_rahm = Column(Float)
@@ -326,18 +323,6 @@ def isotope(self, mass_number: int) -> Isotope:
326323
else:
327324
return selected
328325

329-
@property
330-
def annotation(self):
331-
"Temporary property before before removing annotation"
332-
# TODO: remove in a future version
333-
warnings.warn(
334-
"The 'annotation' attribute is deprecated and will be removed in a future version. "
335-
"Use the 'annotations' attribute of the 'PropertyMetadata' class instead.",
336-
DeprecationWarning,
337-
stacklevel=2,
338-
)
339-
return self._annotation
340-
341326
@property
342327
def boiling_point(self) -> float | None:
343328
"""Proxy for boiling point from the ``PhaseTransition`` object.

0 commit comments

Comments
 (0)