Skip to content

Commit

Permalink
Minor refactor (#591)
Browse files Browse the repository at this point in the history
* remove calling one-line funcs

* remove html related one-line funcs

* mention applied changes
  • Loading branch information
alirezazolanvari authored Feb 11, 2025
1 parent 1413a85 commit 3fd038b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- `README.md` modified
- String templates modified
### Removed
- `html_init` function
- `html_end` function
## [4.2] - 2025-01-14
### Added
- 5 new distance/similarity
Expand Down
4 changes: 2 additions & 2 deletions pycm/cm.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def save_html(
if normalize:
table = self.normalized_table
html_file = open(name + ".html", "w", encoding="utf-8")
html_file.write(html_init())
html_file.write(HTML_INIT_TEMPLATE.format(description=OG_DESCRIPTION, image_url=OG_IMAGE_URL))
html_file.write(html_dataset_type(self.binary, self.imbalance))
html_file.write(
html_table(
Expand All @@ -403,7 +403,7 @@ def save_html(
class_list,
self.recommended_list,
alt_link))
html_file.write(html_end(PYCM_VERSION))
html_file.write(HTML_END_TEMPLATE.format(version=PYCM_VERSION))
html_file.close()
if address:
message = os.path.join(
Expand Down
20 changes: 0 additions & 20 deletions pycm/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@
import webbrowser


def html_init():
"""
Return HTML report file first lines.
:return: html_init as str
"""
return HTML_INIT_TEMPLATE.format(description=OG_DESCRIPTION, image_url=OG_IMAGE_URL)


def html_dataset_type(is_binary, is_imbalanced):
"""
Return HTML report file dataset type.
Expand Down Expand Up @@ -263,17 +254,6 @@ def html_class_stat(
return result


def html_end(version):
"""
Return HTML report file end lines.
:param version: pycm version
:type version: str
:return: html_end as str
"""
return HTML_END_TEMPLATE.format(version=version)


def pycm_help():
"""
Print pycm details.
Expand Down

0 comments on commit 3fd038b

Please sign in to comment.