Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
modules.py51 linesDownload Raw Back to proto
1# Copyright 2019 Google LLC2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7#     https://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14 15from typing import Set16import collections17 18 19_ProtoModule = collections.namedtuple(20    "ProtoModule",21    ["package", "marshal", "manifest"],22)23 24 25def define_module(26    *, package: str, marshal: str = None, manifest: Set[str] = frozenset()27) -> _ProtoModule:28    """Define a protocol buffers module.29 30    The settings defined here are used for all protobuf messages31    declared in the module of the given name.32 33    Args:34        package (str): The proto package name.35        marshal (str): The name of the marshal to use. It is recommended36            to use one marshal per Python library (e.g. package on PyPI).37        manifest (Set[str]): A set of messages and enums to be created. Setting38            this adds a slight efficiency in piecing together proto39            descriptors under the hood.40    """41    if not marshal:42        marshal = package43    return _ProtoModule(44        package=package,45        marshal=marshal,46        manifest=frozenset(manifest),47    )48 49 50__all__ = ("define_module",)51 
codekingpro/portable-devtools · Team Ai