heatmap_cli 0.22.32__tar.gz → 0.22.34__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {heatmap_cli-0.22.32/src/heatmap_cli.egg-info → heatmap_cli-0.22.34}/PKG-INFO +1 -1
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/pyproject.toml +1 -1
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli/__init__.py +1 -3
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli/cli.py +0 -4
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli/heatmap.py +11 -17
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34/src/heatmap_cli.egg-info}/PKG-INFO +1 -1
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/LICENSE.md +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/README.md +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/setup.cfg +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli/__main__.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli.egg-info/SOURCES.txt +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli.egg-info/dependency_links.txt +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli.egg-info/entry_points.txt +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli.egg-info/requires.txt +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/src/heatmap_cli.egg-info/top_level.txt +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_animate_by_week.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_annotate_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_cbar_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_cmap_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_cmax_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_cmin_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_debug_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_demo_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_end_date_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_env_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_heatmap_direct.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_heatmap_errors.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_heatmap_utils.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_help_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_output_dir_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_purge_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_quiet_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_start_date_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_title_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_verbose_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_version_flag.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_week_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_year_option.py +0 -0
- {heatmap_cli-0.22.32 → heatmap_cli-0.22.34}/tests/test_yes_flag.py +0 -0
|
@@ -25,7 +25,7 @@ classifiers = [
|
|
|
25
25
|
"Programming Language :: Python",
|
|
26
26
|
"Topic :: Scientific/Engineering :: Visualization",
|
|
27
27
|
]
|
|
28
|
-
version = "0.22.
|
|
28
|
+
version = "0.22.34"
|
|
29
29
|
keywords = ["heatmap", "cli", "visualization", "calendar", "data-viz"]
|
|
30
30
|
dependencies = [
|
|
31
31
|
"matplotlib",
|
|
@@ -13,8 +13,6 @@
|
|
|
13
13
|
# You should have received a copy of the GNU Affero General Public License
|
|
14
14
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
15
15
|
|
|
16
|
-
# pylint: disable=W0622,R0903
|
|
17
|
-
|
|
18
16
|
"""A console program that generates a yearly calendar heatmap."""
|
|
19
17
|
|
|
20
18
|
import argparse
|
|
@@ -58,7 +56,7 @@ def setup_logging(config: argparse.Namespace) -> None:
|
|
|
58
56
|
|
|
59
57
|
match config:
|
|
60
58
|
case argparse.Namespace(quiet=True):
|
|
61
|
-
logging.disable(
|
|
59
|
+
logging.disable()
|
|
62
60
|
return
|
|
63
61
|
case argparse.Namespace(debug=True):
|
|
64
62
|
level = logging.DEBUG
|
|
@@ -438,10 +438,6 @@ def main(args: Sequence[str] | None = None) -> None:
|
|
|
438
438
|
"""
|
|
439
439
|
argv = args if args is not None else sys.argv[1:]
|
|
440
440
|
parser = build_parser()
|
|
441
|
-
# Use parse_known_args to potentially capture debug flag even if other args
|
|
442
|
-
# fail. However, we'll rely on the full parse_args within the try block for
|
|
443
|
-
# simplicity here.
|
|
444
|
-
parsed_args = None
|
|
445
441
|
debug_active = False # Initialize to False, will be set after parsing
|
|
446
442
|
|
|
447
443
|
try:
|
|
@@ -56,9 +56,6 @@ COLORBAR_ASPECT = 60
|
|
|
56
56
|
# Define constant for filename sanitization
|
|
57
57
|
MAX_FILENAME_LENGTH = 100
|
|
58
58
|
|
|
59
|
-
# Define constants for week values
|
|
60
|
-
FIRST_WEEK = 1
|
|
61
|
-
SECOND_WEEK = 2
|
|
62
59
|
WEEKS_IN_YEAR = 52
|
|
63
60
|
|
|
64
61
|
# Define constants for annotation thresholds
|
|
@@ -76,7 +73,6 @@ COLORBAR_ANNOTATION_SUFFIX = ", count: nearest hundred"
|
|
|
76
73
|
|
|
77
74
|
# Define constants for count truncation
|
|
78
75
|
TRUNCATE_DIVISOR = 100
|
|
79
|
-
TRUNCATE_ROUND_DECIMALS = -2
|
|
80
76
|
|
|
81
77
|
# Define constants for week ranges
|
|
82
78
|
ALL_WEEKS_RANGE = range(1, 54)
|
|
@@ -339,8 +335,8 @@ def _filter_and_pivot_data(
|
|
|
339
335
|
.date()
|
|
340
336
|
)
|
|
341
337
|
end_date = pd.to_datetime(f"{config.year}-12-31")
|
|
342
|
-
logger.debug("start date
|
|
343
|
-
logger.debug("end date
|
|
338
|
+
logger.debug("start date: %s", start_date)
|
|
339
|
+
logger.debug("end date: %s", end_date)
|
|
344
340
|
full_year_dates = pd.date_range(start=start_date, end=end_date, freq="D")
|
|
345
341
|
full_year_structure = pd.DataFrame({"date": full_year_dates})
|
|
346
342
|
full_year_structure["weekday"] = full_year_structure["date"].dt.weekday + 1
|
|
@@ -378,7 +374,7 @@ def _filter_and_pivot_data(
|
|
|
378
374
|
def _truncate_rounded_count(count: float) -> int:
|
|
379
375
|
"""Truncate and round count values to fit them in heatmap box.
|
|
380
376
|
|
|
381
|
-
|
|
377
|
+
Divides the count by 100 and rounds to the nearest integer.
|
|
382
378
|
This transformation is applied when annotations are enabled to simplify
|
|
383
379
|
large numbers and make them fit visually within the heatmap cells.
|
|
384
380
|
For example, 12345 becomes 123, 5678 becomes 57.
|
|
@@ -389,7 +385,7 @@ def _truncate_rounded_count(count: float) -> int:
|
|
|
389
385
|
Returns:
|
|
390
386
|
int: Truncated count value (divided by 100).
|
|
391
387
|
"""
|
|
392
|
-
return
|
|
388
|
+
return round(count / TRUNCATE_DIVISOR)
|
|
393
389
|
|
|
394
390
|
|
|
395
391
|
def _setup_plot_artists(
|
|
@@ -404,7 +400,7 @@ def _setup_plot_artists(
|
|
|
404
400
|
Args:
|
|
405
401
|
cmap (str): Colormap name used for the heatmap.
|
|
406
402
|
config (argparse.Namespace): Config from command line arguments.
|
|
407
|
-
dataframe (pd.
|
|
403
|
+
dataframe (pd.DataFrame): DataFrame with data.
|
|
408
404
|
|
|
409
405
|
Returns:
|
|
410
406
|
plt.Axes: The Axes object with the heatmap plotted.
|
|
@@ -447,7 +443,7 @@ def _generate_heatmap(
|
|
|
447
443
|
seq (int): Sequence number for generated heatmap image file.
|
|
448
444
|
cmap (str): Colormap name used for the heatmap.
|
|
449
445
|
config (argparse.Namespace): Config from command line arguments.
|
|
450
|
-
dataframe (pd.
|
|
446
|
+
dataframe (pd.DataFrame): DataFrame with data loaded from
|
|
451
447
|
CSV file.
|
|
452
448
|
return_image (bool): If True, returns a PIL Image object instead of
|
|
453
449
|
saving to disk.
|
|
@@ -509,9 +505,9 @@ def _configure_heatmap_options(
|
|
|
509
505
|
"cbar_kws": cbar_options,
|
|
510
506
|
}
|
|
511
507
|
|
|
512
|
-
if config.cmap_min:
|
|
508
|
+
if config.cmap_min is not None:
|
|
513
509
|
options["vmin"] = config.cmap_min
|
|
514
|
-
if config.cmap_max:
|
|
510
|
+
if config.cmap_max is not None:
|
|
515
511
|
options["vmax"] = config.cmap_max
|
|
516
512
|
|
|
517
513
|
if config.annotate:
|
|
@@ -624,7 +620,7 @@ def _open_heatmap(filename: Path) -> None:
|
|
|
624
620
|
"""Open generated heatmap using the default program.
|
|
625
621
|
|
|
626
622
|
Args:
|
|
627
|
-
filename (
|
|
623
|
+
filename (Path): The filename of the heatmap to open.
|
|
628
624
|
|
|
629
625
|
Returns:
|
|
630
626
|
None
|
|
@@ -743,8 +739,6 @@ def _refresh_output_dir(config: argparse.Namespace) -> None:
|
|
|
743
739
|
shutil.rmtree(output_dir)
|
|
744
740
|
except OSError as e:
|
|
745
741
|
logger.error("Error removing directory: %s - %s.", output_dir, e)
|
|
746
|
-
# Depending on desired error handling, you might want to raise an
|
|
747
|
-
# exception here.
|
|
748
742
|
return
|
|
749
743
|
|
|
750
744
|
# Ensure the output directory exists for writing files.
|
|
@@ -754,13 +748,13 @@ def _refresh_output_dir(config: argparse.Namespace) -> None:
|
|
|
754
748
|
|
|
755
749
|
|
|
756
750
|
def _get_output_dir(config: argparse.Namespace) -> Path:
|
|
757
|
-
"""Get the
|
|
751
|
+
"""Get the output directory path, resolved relative to CWD.
|
|
758
752
|
|
|
759
753
|
Args:
|
|
760
754
|
config (argparse.Namespace): Config from command line arguments.
|
|
761
755
|
|
|
762
756
|
Returns:
|
|
763
|
-
|
|
757
|
+
Path: The output directory path.
|
|
764
758
|
"""
|
|
765
759
|
output_dir = Path(config.output_dir)
|
|
766
760
|
if output_dir.is_absolute():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|