Skip to content

Commit 8bd67e4

Browse files
authored
Merge pull request #162 from openzim/nopascal
Remove pascalize() and its use in add_metadata
2 parents 12f82b4 + dd6ab84 commit 8bd67e4

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
* `version.print_versions()` print it on stdout (or another fd)
1515
* `version.get_libzim_version()` returns the libzim version only
1616

17+
### Changed
18+
19+
* `Creator.add_metadata` no longer transforms (~pascalize) name (#161)
20+
21+
### Removed
22+
23+
* `writer.pascalize` function
24+
1725
## [2.1.0] - 2022-12-06
1826

1927
### Added

libzim/libzim.pyx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,6 @@ class BaseWritingItem:
547547
)
548548

549549

550-
def pascalize(keyword: str):
551-
"""Converts python case to pascal case.
552-
553-
example: long_description -> LongDescription"""
554-
return "".join(keyword.title().split("_"))
555-
556-
557550
class Creator(_Creator):
558551
__module__ = writer_module_name
559552
def config_compression(self, compression: Compression):
@@ -565,7 +558,6 @@ class Creator(_Creator):
565558
self, name: str, content: Union[str, bytes, datetime.date, datetime.datetime],
566559
mimetype: str = "text/plain;charset=UTF-8"
567560
):
568-
name = pascalize(name)
569561
if name == "Date" and isinstance(content, (datetime.date, datetime.datetime)):
570562
content = content.strftime("%Y-%m-%d").encode("UTF-8")
571563
if isinstance(content, str):
@@ -600,8 +592,7 @@ writer_public_objects = [
600592
ContentProvider,
601593
FileProvider,
602594
StringProvider,
603-
IndexData,
604-
pascalize
595+
IndexData
605596
]
606597
writer = create_module(writer_module_name, writer_module_doc, writer_public_objects)
607598

tests/test_libzim_creator.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,6 @@ def test_imports():
135135
assert libzim.writer.Creator # noqa
136136

137137

138-
def test_pascalize():
139-
assert libzim.writer.pascalize("title") == "Title"
140-
assert libzim.writer.pascalize("my man") == "My Man"
141-
assert libzim.writer.pascalize("THATisBAD") == "Thatisbad"
142-
143-
144138
def test_creator_filename(fpath):
145139
with Creator(fpath) as c:
146140
assert c.filename == fpath

0 commit comments

Comments
 (0)