PHP 8.2.31
Preview: __init__.py Size: 1.08 KB
/opt/imunify360/venv/lib64/python3.11/site-packages/nats/micro/__init__.py

# Copyright 2021-2022 The NATS Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from dataclasses import replace
from typing import Optional

from nats.aio.client import Client

from .request import Handler, Request
from .service import Service, ServiceConfig


async def add_service(nc: Client, config: Optional[ServiceConfig] = None, **kwargs) -> Service:
    """Add a service."""
    if config:
        config = replace(config, **kwargs)
    else:
        config = ServiceConfig(**kwargs)

    service = Service(nc, config)
    await service.start()

    return service


__all__ = ["add_service"]

Directory Contents

Dirs: 1 × Files: 3

Name Size Perms Modified Actions
- drwxr-xr-x 2026-05-27 11:04:30
Edit Download
3.06 KB lrw-r--r-- 2026-04-14 09:45:18
Edit Download
22.27 KB lrw-r--r-- 2026-04-14 09:45:18
Edit Download
1.08 KB lrw-r--r-- 2026-04-14 09:45:18
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).