@@ -1210,7 +1210,7 @@ def _ReadChildObjectsTree(self, file_object, root_node_offset):
1210
1210
leaf_node = self ._ReadChildObjectsTreeLeafNode (
1211
1211
node_cell .data , branch_node .leaf_node_offset )
1212
1212
1213
- for node_offset in (
1213
+ yield from (
1214
1214
leaf_node .value_node_offset1 ,
1215
1215
leaf_node .value_node_offset2 ,
1216
1216
leaf_node .value_node_offset3 ,
@@ -1220,8 +1220,7 @@ def _ReadChildObjectsTree(self, file_object, root_node_offset):
1220
1220
leaf_node .value_node_offset7 ,
1221
1221
leaf_node .value_node_offset8 ,
1222
1222
leaf_node .value_node_offset9 ,
1223
- leaf_node .value_node_offset10 ):
1224
- yield node_offset
1223
+ leaf_node .value_node_offset10 )
1225
1224
1226
1225
# TODO: rename
1227
1226
def _ReadChildObjectsTreeBranchNode (self , block_data , file_offset ):
@@ -1770,9 +1769,8 @@ def _ReadClassDefinitionHierarchy(self, file_object, root_node_offset):
1770
1769
for value_node_offset in self ._ReadChildObjectsTree (
1771
1770
file_object , root_node .sub_node_offset ):
1772
1771
if value_node_offset > 40 :
1773
- for instance in self ._ReadClassDefinitionHierarchy (
1774
- file_object , value_node_offset ):
1775
- yield instance
1772
+ yield from self ._ReadClassDefinitionHierarchy (
1773
+ file_object , value_node_offset )
1776
1774
1777
1775
if self ._debug :
1778
1776
if root_node .child_objects_root_node_offset > 40 :
@@ -1900,10 +1898,8 @@ def _ReadInstanceHierarchy(self, file_object, root_node_offset):
1900
1898
node_cell .data , instance_leaf_value_node .name_node_offset )
1901
1899
1902
1900
if instance_leaf_value_node .instance_root_node_offset > 40 :
1903
- for instance in self ._ReadInstanceHierarchy (
1904
- file_object ,
1905
- instance_leaf_value_node .instance_root_node_offset ):
1906
- yield instance
1901
+ yield from self ._ReadInstanceHierarchy (
1902
+ file_object , instance_leaf_value_node .instance_root_node_offset )
1907
1903
1908
1904
if self ._debug :
1909
1905
if root_node .child_objects_list_node_offset > 40 :
@@ -1956,11 +1952,10 @@ def _ReadNamespaceInstanceHierarchy(
1956
1952
node_cell .data , value_node_offset )
1957
1953
1958
1954
if instance_leaf_value_node .instance_root_node_offset > 40 :
1959
- for instance in self ._ReadNamespaceInstanceHierarchy (
1955
+ yield from self ._ReadNamespaceInstanceHierarchy (
1960
1956
file_object ,
1961
1957
instance_leaf_value_node .instance_root_node_offset ,
1962
- namespace_segments ):
1963
- yield instance
1958
+ namespace_segments )
1964
1959
1965
1960
def ReadClassDefinitions (self ):
1966
1961
"""Reads class definitions.
@@ -1969,9 +1964,8 @@ def ReadClassDefinitions(self):
1969
1964
Instance: instance.
1970
1965
"""
1971
1966
if self ._system_class_definition_root_node_offset > 40 :
1972
- for instance in self ._ReadClassDefinitionHierarchy (
1973
- self ._file_object , self ._system_class_definition_root_node_offset ):
1974
- yield instance
1967
+ yield from self ._ReadClassDefinitionHierarchy (
1968
+ self ._file_object , self ._system_class_definition_root_node_offset )
1975
1969
1976
1970
def ReadInstances (self ):
1977
1971
"""Reads instances.
@@ -1980,9 +1974,8 @@ def ReadInstances(self):
1980
1974
Instance: instance.
1981
1975
"""
1982
1976
if self ._root_namespace_node_offset > 40 :
1983
- for instance in self ._ReadInstanceHierarchy (
1984
- self ._file_object , self ._root_namespace_node_offset ):
1985
- yield instance
1977
+ yield from self ._ReadInstanceHierarchy (
1978
+ self ._file_object , self ._root_namespace_node_offset )
1986
1979
1987
1980
def ReadNamespaces (self ):
1988
1981
"""Reads namespace instances.
@@ -1991,9 +1984,8 @@ def ReadNamespaces(self):
1991
1984
Instance: instance.
1992
1985
"""
1993
1986
if self ._root_namespace_node_offset > 40 :
1994
- for instance in self ._ReadNamespaceInstanceHierarchy (
1995
- self ._file_object , self ._root_namespace_node_offset , []):
1996
- yield instance
1987
+ yield from self ._ReadNamespaceInstanceHierarchy (
1988
+ self ._file_object , self ._root_namespace_node_offset , [])
1997
1989
1998
1990
def ReadFileObject (self , file_object ):
1999
1991
"""Reads a mappings file-like object.
@@ -3462,14 +3454,12 @@ def _GetKeysFromIndexPage(self, index_page):
3462
3454
str: a CIM key.
3463
3455
"""
3464
3456
if index_page :
3465
- for key in index_page .keys :
3466
- yield key
3457
+ yield from index_page .keys
3467
3458
3468
3459
for mapped_page_number in index_page .sub_pages :
3469
3460
sub_index_page = self ._GetIndexPageByMappedPageNumber (
3470
3461
mapped_page_number )
3471
- for key in self ._GetKeysFromIndexPage (sub_index_page ):
3472
- yield key
3462
+ yield from self ._GetKeysFromIndexPage (sub_index_page )
3473
3463
3474
3464
def _GetObjectsPageByMappedPageNumber (self , mapped_page_number , is_data_page ):
3475
3465
"""Retrieves a specific objects page by mapped page number.
@@ -3942,8 +3932,7 @@ def GetInstances(self):
3942
3932
Instance: an instance.
3943
3933
"""
3944
3934
if self ._repository_file :
3945
- for instance in self ._repository_file .ReadInstances ():
3946
- yield instance
3935
+ yield from self ._repository_file .ReadInstances ()
3947
3936
3948
3937
else :
3949
3938
for _ , object_record in self ._ReadInstanceObjectRecords ():
@@ -3962,15 +3951,13 @@ def GetNamespaces(self):
3962
3951
Instance: an instance.
3963
3952
"""
3964
3953
if self ._repository_file :
3965
- for instance in self ._repository_file .ReadNamespaces ():
3966
- yield instance
3954
+ yield from self ._repository_file .ReadNamespaces ()
3967
3955
3968
3956
else :
3969
3957
if not self ._namespace_instances :
3970
3958
self ._ReadNamespacesFromObjectRecords ()
3971
3959
3972
- for instance in self ._namespace_instances :
3973
- yield instance
3960
+ yield from self ._namespace_instances
3974
3961
3975
3962
def GetIndexKeys (self ):
3976
3963
"""Retrieves the index keys.
@@ -3980,8 +3967,7 @@ def GetIndexKeys(self):
3980
3967
"""
3981
3968
if self ._index_binary_tree_file :
3982
3969
index_page = self ._GetIndexRootPage ()
3983
- for key in self ._GetKeysFromIndexPage (index_page ):
3984
- yield key
3970
+ yield from self ._GetKeysFromIndexPage (index_page )
3985
3971
3986
3972
# TODO: remove after debugging.
3987
3973
def GetObjectRecordByKey (self , key ):
0 commit comments