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