cengal.parallel_execution.coroutines.coro_standard_services.simple_yield.versions.v_0.simple_yield

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
19"""
20Module Docstring
21Docstrings: http://www.python.org/dev/peps/pep-0257/
22"""
23
24
25__author__ = "ButenkoMS <gtalk@butenkoms.space>"
26__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>"
27__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ]
28__license__ = "Apache License, Version 2.0"
29__version__ = "4.4.1"
30__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>"
31__email__ = "gtalk@butenkoms.space"
32# __status__ = "Prototype"
33__status__ = "Development"
34# __status__ = "Production"
35
36
37__all__ = ['Yield']
38
39from cengal.parallel_execution.coroutines.coro_scheduler import *
40from typing import Tuple
41
42
43class Yield(TypedService[None]):
44    def single_task_registration_or_immediate_processing(self) -> Tuple[bool, None, None]:
45        return True, None, None
46
47    def full_processing_iteration(self):
48        self.make_dead()
49
50    def in_work(self) -> bool:
51        result: bool = False
52        return self.thrifty_in_work(result)
class Yield(cengal.parallel_execution.coroutines.coro_scheduler.versions.v_0.coro_scheduler.TypedService[NoneType]):
44class Yield(TypedService[None]):
45    def single_task_registration_or_immediate_processing(self) -> Tuple[bool, None, None]:
46        return True, None, None
47
48    def full_processing_iteration(self):
49        self.make_dead()
50
51    def in_work(self) -> bool:
52        result: bool = False
53        return self.thrifty_in_work(result)

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as::

class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.

This class can then be used as follows::

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default

def single_task_registration_or_immediate_processing(self) -> Tuple[bool, NoneType, NoneType]:
45    def single_task_registration_or_immediate_processing(self) -> Tuple[bool, None, None]:
46        return True, None, None
def full_processing_iteration(self):
48    def full_processing_iteration(self):
49        self.make_dead()
def in_work(self) -> bool:
51    def in_work(self) -> bool:
52        result: bool = False
53        return self.thrifty_in_work(result)

Will be executed twice per iteration: once before and once after the full_processing_iteration() execution

Raises: NotImplementedError: _description_

Returns: bool: _description_

Inherited Members
cengal.parallel_execution.coroutines.coro_scheduler.versions.v_0.coro_scheduler.Service
Service
current_caller_coro_info
iteration
make_response
register_response
put_task
resolve_request
try_resolve_request
in_forground_work
thrifty_in_work
time_left_before_next_event
is_low_latency
make_live
make_dead
service_id_impl
service_id
destroy