def _truncate_timestamps(self, tags):
        # truncate timestamps to shortest unique representation
        # - date only
        # - date including hours and minutes
        # - date include hours, minutes and seconds
        lengths = [10, 16, 19]
        for length in lengths:
            # filter tags which have not been truncated yet
            considered_tags = [t for t in tags if len(t.timestamp) > length]
            # count tags which timestamps have the same truncated representation
            grouped_by_timestamp = {}
            for t in considered_tags:
                truncated_timestamp = t.timestamp[:length]
                if truncated_timestamp not in grouped_by_timestamp:
                    grouped_by_timestamp[truncated_timestamp] = []
                grouped_by_timestamp[truncated_timestamp].append(t)
            # truncate timestamp of tags which are unique
            for truncated_timestamp, similar_tags in grouped_by_timestamp.items():
                if len(similar_tags) == 1:
                    similar_tags[0].timestamp = truncated_timestamp
dataset/ETHPy150Open ros-infrastructure/catkin_pkg/src/catkin_pkg/changelog_generator_vcs.py/VcsClientBase._truncate_timestamps/original