@@ -11,7 +11,7 @@ class SchemeEntryType(enum.IntEnum):
11
11
"""
12
12
Enumerates all available entry types.
13
13
"""
14
-
14
+ TYPE_UNSPECIFIED = 0
15
15
DIRECTORY = 1
16
16
TABLE = 2
17
17
PERS_QUEUE_GROUP = 3
@@ -24,6 +24,10 @@ class SchemeEntryType(enum.IntEnum):
24
24
REPLICATION = 16
25
25
TOPIC = 17
26
26
27
+ @classmethod
28
+ def _missing_ (cls , value ):
29
+ return cls .TYPE_UNSPECIFIED
30
+
27
31
@staticmethod
28
32
def is_table (entry ):
29
33
"""
@@ -299,7 +303,7 @@ def _wrap_scheme_entry(entry_pb, scheme_entry_cls=None, *args, **kwargs):
299
303
return scheme_entry_cls (
300
304
entry_pb .name ,
301
305
entry_pb .owner ,
302
- getattr ( SchemeEntryType , _apis . ydb_scheme . Entry . Type . Name (entry_pb .type ) ),
306
+ SchemeEntryType (entry_pb .type ),
303
307
_wrap_permissions (entry_pb .effective_permissions ),
304
308
_wrap_permissions (entry_pb .permissions ),
305
309
entry_pb .size_bytes ,
@@ -318,7 +322,7 @@ def _wrap_list_directory_response(rpc_state, response):
318
322
message = _apis .ydb_scheme .ListDirectoryResult ()
319
323
response .operation .result .Unpack (message )
320
324
children = []
321
- supported_items = set ([ i .value for i in SchemeEntryType ] )
325
+ supported_items = set (i .value for i in SchemeEntryType )
322
326
for children_item in message .children :
323
327
if children_item .type not in supported_items :
324
328
continue
@@ -328,12 +332,10 @@ def _wrap_list_directory_response(rpc_state, response):
328
332
return Directory (
329
333
message .self .name ,
330
334
message .self .owner ,
331
- getattr ( SchemeEntryType , _apis . ydb_scheme . Entry . Type . Name (message .self .type ) ),
335
+ SchemeEntryType (message .self .type ),
332
336
_wrap_permissions (message .self .effective_permissions ),
333
337
_wrap_permissions (message .self .permissions ),
334
- tuple (
335
- children ,
336
- ),
338
+ tuple (children ),
337
339
)
338
340
339
341
0 commit comments