descriptor
Descriptors essentially contain exactly the information found in a .proto file, in types that make this information accessible in Python.
Descriptor
Bases: _NestedDescriptorBase
Descriptor for a protocol message type.
Attributes:
Name | Type | Description |
---|---|---|
name | str | Name of this protocol message type. |
full_name | str | Fully-qualified name of this protocol message type, which will include protocol "package" name and the name of any enclosing types. |
containing_type | Descriptor | Reference to the descriptor of the type containing us, or None if this is top-level. |
fields | list[FieldDescriptor] | Field descriptors for all fields in this type. |
fields_by_number | dict(int, FieldDescriptor | Same :class: |
fields_by_name | dict(str, FieldDescriptor | Same :class: |
nested_types | list[Descriptor] | Descriptor references for all protocol message types nested within this one. |
nested_types_by_name | dict(str, Descriptor | Same Descriptor objects as in :attr: |
enum_types | list[EnumDescriptor] | :class: |
enum_types_by_name | dict(str, EnumDescriptor | Same :class: |
enum_values_by_name | dict(str, EnumValueDescriptor | Dict mapping from enum value name to :class: |
extensions | list[FieldDescriptor] | All extensions defined directly within this message type (NOT within a nested type). |
extensions_by_name | dict(str, FieldDescriptor | Same FieldDescriptor objects as :attr: |
is_extendable | bool | Does this type define any extension ranges? |
oneofs | list[OneofDescriptor] | The list of descriptors for oneof fields in this message. |
oneofs_by_name | dict(str, OneofDescriptor | Same objects as in :attr: |
file | FileDescriptor | Reference to file descriptor. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
|
fields_by_camelcase_name
property
Same FieldDescriptor objects as in :attr:fields
, but indexed by :attr:FieldDescriptor.camelcase_name
.
CopyToProto(proto)
Copies this to a descriptor_pb2.DescriptorProto.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto | An empty descriptor_pb2.DescriptorProto. | required |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
399 400 401 402 403 404 405 406 |
|
EnumValueName(enum, value)
Returns the string name of an enum value.
This is just a small helper method to simplify a common operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enum | string name of the Enum. | required | |
value | int, value of the enum. | required |
Returns:
Type | Description |
---|---|
string name of the enum value. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 |
|
__init__(name, full_name, filename, containing_type, fields, nested_types, enum_types, extensions, options=None, serialized_options=None, is_extendable=True, extension_ranges=None, oneofs=None, file=None, serialized_start=None, serialized_end=None, syntax=None, create_key=None)
Arguments to init() are as described in the description of Descriptor fields above.
Note that filename is an obsolete argument, that is not used anymore. Please use file.name to access this as an attribute.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
|
DescriptorBase
Descriptors base class.
This class is the base of all descriptor classes. It provides common options related functionality.
Attributes:
Name | Type | Description |
---|---|---|
has_options | True if the descriptor has non-default options. Usually it is not necessary to read this -- just call GetOptions() which will happily return the default instance. However, it's sometimes useful for efficiency, and also useful inside the protobuf implementation to avoid some bootstrapping issues. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
GetOptions()
Retrieves descriptor options.
This method returns the options set or creates the default options for the descriptor.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
__init__(options, serialized_options, options_class_name)
Initialize the descriptor given its options message and the name of the class of the options message. The name of the class is required in case the options message is None and has to be created.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
133 134 135 136 137 138 139 140 141 142 143 |
|
EnumDescriptor
Bases: _NestedDescriptorBase
Descriptor for an enum defined in a .proto file.
Attributes:
Name | Type | Description |
---|---|---|
name | str | Name of the enum type. |
full_name | str | Full name of the type, including package name and any enclosing type(s). |
values | list[EnumValueDescriptor] | List of the values in this enum. |
values_by_name | dict(str, EnumValueDescriptor | Same as :attr: |
values_by_number | dict(int, EnumValueDescriptor | Same as :attr: |
containing_type | Descriptor | Descriptor of the immediate containing type of this enum, or None if this is an enum defined at the top level in a .proto file. Set by Descriptor's constructor if we're passed into one. |
file | FileDescriptor | Reference to file descriptor. |
options | EnumOptions | Enum options message or None to use default enum options. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 |
|
CopyToProto(proto)
Copies this to a descriptor_pb2.EnumDescriptorProto.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto | EnumDescriptorProto | An empty descriptor proto. | required |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
719 720 721 722 723 724 725 726 |
|
__init__(name, full_name, filename, values, containing_type=None, options=None, serialized_options=None, file=None, serialized_start=None, serialized_end=None, create_key=None)
Arguments are as described in the attribute description above.
Note that filename is an obsolete argument, that is not used anymore. Please use file.name to access this as an attribute.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 |
|
EnumValueDescriptor
Bases: DescriptorBase
Descriptor for a single value within an enum.
Attributes:
Name | Type | Description |
---|---|---|
name | str | Name of this value. |
index | int | Dense, 0-indexed index giving the order that this value appears textually within its enum in the .proto file. |
number | int | Actual number assigned to this enum value. |
type | EnumDescriptor | :class: |
options | EnumValueOptions | Enum value options message or None to use default enum value options options. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
|
__init__(name, index, number, type=None, options=None, serialized_options=None, create_key=None)
Arguments are as described in the attribute description above.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
758 759 760 761 762 763 764 765 766 767 768 769 770 |
|
Error
Bases: Exception
Base error for this module.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
51 52 |
|
FieldDescriptor
Bases: DescriptorBase
Descriptor for a single field in a .proto file.
Attributes:
Name | Type | Description |
---|---|---|
name | str | Name of this field, exactly as it appears in .proto. |
full_name | str | Name of this field, including containing scope. This is particularly relevant for extensions. |
index | int | Dense, 0-indexed index giving the order that this field textually appears within its message in the .proto file. |
number | int | Tag number declared for this field in the .proto file. |
type | int | (One of the TYPE_* constants below) Declared type. |
cpp_type | int | (One of the CPPTYPE_* constants below) C++ type used to represent this field. |
label | int | (One of the LABEL_* constants below) Tells whether this field is optional, required, or repeated. |
has_default_value | bool | True if this field has a default value defined, otherwise false. |
default_value | Varies | Default value of this field. Only meaningful for non-repeated scalar fields. Repeated fields should always set this to [], and non-repeated composite fields should always set this to None. |
containing_type | Descriptor | Descriptor of the protocol message type that contains this field. Set by the Descriptor constructor if we're passed into one. Somewhat confusingly, for extension fields, this is the descriptor of the EXTENDED message, not the descriptor of the message containing this field. (See is_extension and extension_scope below). |
message_type | Descriptor | If a composite field, a descriptor of the message type contained in this field. Otherwise, this is None. |
enum_type | EnumDescriptor | If this field contains an enum, a descriptor of that enum. Otherwise, this is None. |
is_extension | True iff this describes an extension field. | |
extension_scope | Descriptor | Only meaningful if is_extension is True. Gives the message that immediately contains this extension field. Will be None iff we're a top-level (file-level) extension field. |
options | FieldOptions | Protocol message field options or None to use default field options. |
containing_oneof | OneofDescriptor | If the field is a member of a oneof union, contains its descriptor. Otherwise, None. |
file | FileDescriptor | Reference to file descriptor. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
|
camelcase_name
property
Camelcase name of this field.
Returns:
Name | Type | Description |
---|---|---|
str | the name in CamelCase. |
has_presence
property
Whether the field distinguishes between unpopulated and default values.
Raises:
Type | Description |
---|---|
RuntimeError | singular field that is not linked with message nor file. |
ProtoTypeToCppProtoType(proto_type)
staticmethod
Converts from a Python proto type to a C++ Proto Type.
The Python ProtocolBuffer classes specify both the 'Python' datatype and the 'C++' datatype - and they're not the same. This helper method should translate from one to another.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto_type | the Python proto type (descriptor.FieldDescriptor.TYPE_*) | required |
Returns: int: descriptor.FieldDescriptor.CPPTYPE_*, the C++ type. Raises: TypeTransformationError: when the Python proto type isn't known.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 |
|
__init__(name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options=None, serialized_options=None, has_default_value=True, containing_oneof=None, json_name=None, file=None, create_key=None)
The arguments are as described in the description of FieldDescriptor attributes above.
Note that containing_type may be None, and may be set later if necessary (to deal with circular references between message types, for example). Likewise for extension_scope.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
|
FileDescriptor
Bases: DescriptorBase
Descriptor for a file. Mimics the descriptor_pb2.FileDescriptorProto.
Note that :attr:enum_types_by_name
, :attr:extensions_by_name
, and :attr:dependencies
fields are only set by the :py:mod:google.protobuf.message_factory
module, and not by the generated proto code.
Attributes:
Name | Type | Description |
---|---|---|
name | str | Name of file, relative to root of source tree. |
package | str | Name of the package |
syntax | str | string indicating syntax of the file (can be "proto2" or "proto3") |
serialized_pb | bytes | Byte string of serialized :class: |
dependencies | list[FileDescriptor] | List of other :class: |
public_dependencies | list[FileDescriptor] | A product of :attr: |
message_types_by_name | dict(str, Descriptor | Mapping from message names to their :class: |
enum_types_by_name | dict(str, EnumDescriptor | Mapping from enum names to their :class: |
extensions_by_name | dict(str, FieldDescriptor | Mapping from extension names declared at file scope to their :class: |
services_by_name | dict(str, ServiceDescriptor | Mapping from services' names to their :class: |
pool | DescriptorPool | The pool this descriptor belongs to. When not passed to the constructor, the global default pool is used. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
|
CopyToProto(proto)
Copies this to a descriptor_pb2.FileDescriptorProto.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto | An empty descriptor_pb2.FileDescriptorProto. | required |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
1055 1056 1057 1058 1059 1060 1061 |
|
__init__(name, package, options=None, serialized_options=None, serialized_pb=None, dependencies=None, public_dependencies=None, syntax=None, pool=None, create_key=None)
Constructor.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 |
|
MethodDescriptor
Bases: DescriptorBase
Descriptor for a method in a service.
Attributes:
Name | Type | Description |
---|---|---|
name | str | Name of the method within the service. |
full_name | str | Full name of method. |
index | int | 0-indexed index of the method inside the service. |
containing_service | ServiceDescriptor | The service that contains this method. |
input_type | Descriptor | The descriptor of the message that this method accepts. |
output_type | Descriptor | The descriptor of the message that this method returns. |
client_streaming | bool | Whether this method uses client streaming. |
server_streaming | bool | Whether this method uses server streaming. |
options | MethodOptions or None | Method options message, or None to use default method options. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 |
|
CopyToProto(proto)
Copies this to a descriptor_pb2.MethodDescriptorProto.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto | MethodDescriptorProto | An empty descriptor proto. | required |
Raises:
Type | Description |
---|---|
Error | If self couldn't be serialized, due to too few constructor arguments. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 |
|
__init__(name, full_name, index, containing_service, input_type, output_type, client_streaming=False, server_streaming=False, options=None, serialized_options=None, create_key=None)
The arguments are as described in the description of MethodDescriptor attributes above.
Note that containing_service may be None, and may be set later if necessary.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 |
|
OneofDescriptor
Bases: DescriptorBase
Descriptor for a oneof field.
Attributes:
Name | Type | Description |
---|---|---|
name | str | Name of the oneof field. |
full_name | str | Full name of the oneof field, including package name. |
index | int | 0-based index giving the order of the oneof field inside its containing type. |
containing_type | Descriptor | :class: |
fields | list[FieldDescriptor] | The list of field descriptors this oneof can contain. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
|
__init__(name, full_name, index, containing_type, fields, options=None, serialized_options=None, create_key=None)
Arguments are as described in the attribute description above.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
797 798 799 800 801 802 803 804 805 806 807 808 809 810 |
|
ServiceDescriptor
Bases: _NestedDescriptorBase
Descriptor for a service.
Attributes:
Name | Type | Description |
---|---|---|
name | str | Name of the service. |
full_name | str | Full name of the service, including package name. |
index | int | 0-indexed index giving the order that this services definition appears within the .proto file. |
methods | list[MethodDescriptor] | List of methods provided by this service. |
methods_by_name | dict(str, MethodDescriptor | Same :class: |
options | ServiceOptions | Service options message or None to use default service options. |
file | FileDescriptor | Reference to file info. |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 |
|
CopyToProto(proto)
Copies this to a descriptor_pb2.ServiceDescriptorProto.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proto | ServiceDescriptorProto | An empty descriptor proto. | required |
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
878 879 880 881 882 883 884 885 |
|
FindMethodByName(name)
Searches for the specified method, and returns its descriptor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | str | Name of the method. | required |
Returns: MethodDescriptor or None: the descriptor for the requested method, if found.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
867 868 869 870 871 872 873 874 875 876 |
|
TypeTransformationError
Bases: Error
Error transforming between python proto type and corresponding C++ type.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
55 56 |
|
MakeDescriptor(desc_proto, package='', build_file_if_cpp=True, syntax=None)
Make a protobuf Descriptor given a DescriptorProto protobuf.
Handles nested descriptors. Note that this is limited to the scope of defining a message inside of another message. Composite fields can currently only be resolved if the message is defined in the same scope as the field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
desc_proto | The descriptor_pb2.DescriptorProto protobuf message. | required | |
package | Optional package name for the new message Descriptor (string). | '' | |
build_file_if_cpp | Update the C++ descriptor pool if api matches. Set to False on recursion, so no duplicates are created. | True | |
syntax | The syntax/semantics that should be used. Set to "proto3" to get proto3 field presence semantics. | None |
Returns: A Descriptor for protobuf messages.
Source code in client/ayon_hiero/vendor/google/protobuf/descriptor.py
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 |
|