cengal.data_containers.compound_dict_management.standard_library.key_counter.versions.v_0.key_counter
Module Docstring Docstrings: http://www.python.org/dev/peps/pep-0257/
1#!/usr/bin/env python 2# coding=utf-8 3 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space> 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18""" 19Module Docstring 20Docstrings: http://www.python.org/dev/peps/pep-0257/ 21""" 22 23__author__ = "ButenkoMS <gtalk@butenkoms.space>" 24__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>" 25__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ] 26__license__ = "Apache License, Version 2.0" 27__version__ = "4.4.1" 28__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>" 29__email__ = "gtalk@butenkoms.space" 30# __status__ = "Prototype" 31__status__ = "Development" 32# __status__ = "Production" 33 34 35from cengal.data_containers.compound_dict_management import AddToCompoundDict 36from cengal.code_flow_control.smart_values import ValueExistence 37 38 39class KeyCounter(AddToCompoundDict): 40 def __init__(self, original_dict): 41 super().__init__( 42 original_dict, 43 lambda: 0, 44 lambda container, key, value: (True, container[key] + 1) 45 )
class
KeyCounter(cengal.data_containers.compound_dict_management.manager.versions.v_1.manager.AddToCompoundDict):
40class KeyCounter(AddToCompoundDict): 41 def __init__(self, original_dict): 42 super().__init__( 43 original_dict, 44 lambda: 0, 45 lambda container, key, value: (True, container[key] + 1) 46 )
KeyCounter(original_dict)
41 def __init__(self, original_dict): 42 super().__init__( 43 original_dict, 44 lambda: 0, 45 lambda container, key, value: (True, container[key] + 1) 46 )
:param original_dict: :param default_value: functor. list(); {1:set(), 2:[set(), set(), list()]}; etc. :param mediator: functor. original_dict[index].add(y), original_dict[index] += y, etc. Should return ValueExistence(True, ...) or None/nothing :return:
Inherited Members
- cengal.data_containers.compound_dict_management.manager.versions.v_1.manager.AddToCompoundDict
- original_dict
- add