Skip to content

Commit 3b7db44

Browse files
committed
pkg_resources replaced with importlib.metadata
1 parent de7d72e commit 3b7db44

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

firebird/base/protobuf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from __future__ import annotations
3838
from typing import Dict, Any, Callable, cast
3939
from dataclasses import dataclass
40-
from pkg_resources import iter_entry_points
40+
from importlib.metadata import entry_points
4141
from google.protobuf.message import Message as ProtoMessage
4242
from google.protobuf.descriptor import EnumDescriptor
4343
from google.protobuf.struct_pb2 import Struct as StructProto # pylint: disable=[E0611]
@@ -46,13 +46,21 @@
4646
from .types import Distinct
4747
from .collections import Registry
4848

49+
#: Name of well-known EMPTY protobuf message (for use with `.create_message()`)
4950
PROTO_EMPTY = 'google.protobuf.Empty'
51+
#: Name of well-known ANY protobuf message (for use with `.create_message()`)
5052
PROTO_ANY = 'google.protobuf.Any'
53+
#: Name of well-known DURATION protobuf message (for use with `.create_message()`)
5154
PROTO_DURATION = 'google.protobuf.Duration'
55+
#: Name of well-known TIMESTAMP protobuf message (for use with `.create_message()`)
5256
PROTO_TIMESTAMP = 'google.protobuf.Timestamp'
57+
#: Name of well-known STRUCT protobuf message (for use with `.create_message()`)
5358
PROTO_STRUCT = 'google.protobuf.Struct'
59+
#: Name of well-known VALUE protobuf message (for use with `.create_message()`)
5460
PROTO_VALUE = 'google.protobuf.Value'
61+
#: Name of well-known LISTVALUE protobuf message (for use with `.create_message()`)
5562
PROTO_LISTVALUE = 'google.protobuf.ListValue'
63+
#: Name of well-known FIELDMASK protobuf message (for use with `.create_message()`)
5664
PROTO_FIELDMASK = 'google.protobuf.FieldMask'
5765

5866
# Classes
@@ -229,7 +237,7 @@ def load_registered(group: str) -> None: # pragma: no cover
229237
230238
load_registered('firebird.base.protobuf')
231239
"""
232-
for desc in (entry.load() for entry in iter_entry_points(group)):
240+
for desc in (entry.load() for entry in entry_points().get(group, [])):
233241
register_decriptor(desc)
234242

235243

0 commit comments

Comments
 (0)