Skip to content

Commit 87185e7

Browse files
committed
Remove remove_dates_from_title
1 parent e029f56 commit 87185e7

8 files changed

Lines changed: 27 additions & 724 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: check-ast
1313

1414
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.14.13
15+
rev: v0.14.14
1616
hooks:
1717
# Run the linter.
1818
- id: ruff-check

documentation/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ The library has detailed API documentation which can be found in the menu at the
5454

5555

5656
## Breaking Changes
57+
From 6.6.5, removed DatasetTitleHelper class and Dataset method remove_dates_from_title
58+
5759
From 6.6.0, Python 3.10 or later is required
5860

5961
From 6.5.7, get_size_and_hash moved to HDX Python Utilities

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ dependencies = [
4242
"hdx-python-country>=4.0.1",
4343
"hdx-python-utilities>=4.0.4",
4444
"makefun",
45-
"quantulum3",
4645
"requests",
4746
]
4847

@@ -57,7 +56,7 @@ dev = [
5756
"pytest-cov",
5857
"pytest-mock",
5958
"pre-commit",
60-
"ruff==0.14.13",
59+
"ruff==0.14.14",
6160
]
6261

6362
[project.urls]

src/hdx/api/utilities/dataset_title_helper.py

Lines changed: 0 additions & 254 deletions
This file was deleted.

src/hdx/data/dataset.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import hdx.data.vocabulary as vocabulary
4141
from hdx.api.configuration import Configuration
4242
from hdx.api.locations import Locations
43-
from hdx.api.utilities.dataset_title_helper import DatasetTitleHelper
4443
from hdx.api.utilities.date_helper import DateHelper
4544
from hdx.api.utilities.filestore_helper import FilestoreHelper
4645
from hdx.data.hdxobject import HDXError, HDXObject
@@ -2379,33 +2378,6 @@ def get_api_url(self, prefer_name: bool = True) -> str | None:
23792378
return None
23802379
return f"{self.configuration.get_hdx_site_url()}/api/3/action/package_show?id={name_or_id}"
23812380

2382-
def remove_dates_from_title(
2383-
self, change_title: bool = True, set_time_period: bool = False
2384-
) -> list[tuple[datetime, datetime]]:
2385-
"""Remove dates from dataset title returning sorted the dates that were found in
2386-
title. The title in the dataset metadata will be changed by default. The
2387-
dataset's metadata field time period will not be changed by default, but if
2388-
set_time_period is True, then the range with the lowest start date will be used
2389-
to set the time period field.
2390-
2391-
Args:
2392-
change_title: Whether to change the dataset title. Defaults to True.
2393-
set_time_period: Whether to set time period from date or range in title. Defaults to False.
2394-
2395-
Returns:
2396-
Date ranges found in title
2397-
"""
2398-
if "title" not in self.data:
2399-
raise HDXError("Dataset has no title!")
2400-
title = self.data["title"]
2401-
newtitle, ranges = DatasetTitleHelper.get_dates_from_title(title)
2402-
if change_title:
2403-
self.data["title"] = newtitle
2404-
if set_time_period and len(ranges) != 0:
2405-
startdate, enddate = ranges[0]
2406-
self.set_time_period(startdate, enddate)
2407-
return ranges
2408-
24092381
def generate_resource(
24102382
self,
24112383
folder: Path | str,

0 commit comments

Comments
 (0)