Skip to content

Commit 472bdfc

Browse files
author
ddraganov
committed
Mark non-remote ManagedObject and DataObject methods
"'Private' instance variables that cannot be accessed except from inside an object don’t exist in Python. However, there is a convention that is followed by most Python code: a name prefixed with an underscore (e.g. _spam) should be treated as a non-public part of the API (whether it is a function, a method or a data member). It should be considered an implementation detail and subject to change without notice." Ref. https://docs.python.org/3/tutorial/classes.html#private-variables This change adds comment before the non-remote methods available for ManagedObject and DataObject that explains that those methods are not private but this is the way non-remote methods are marked in the VMODL1 context.
1 parent e43a287 commit 472bdfc

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pyVmomi/VmomiSupport.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,19 +400,28 @@ def _InvokeAccessor(info, self):
400400

401401
_InvokeAccessor = staticmethod(_InvokeAccessor)
402402

403+
# In contrast with the Python convention for "private" methods,
404+
# the ManagedObject and DataObject method names beginning with
405+
# an underscore denote public, officially supported system methods.
406+
# The execution of these methods does not involve a remote call.
407+
403408
# Get the ID of a managed object
409+
# Public non-remote method. Officially supported.
404410
def _GetMoId(self):
405411
return self._moId
406412

407413
# Get the serverGuid of a managed object
414+
# Public non-remote method. Officially supported.
408415
def _GetServerGuid(self):
409416
return self._serverGuid
410417

411418
# Get the stub of a managed object
419+
# Public non-remote method. Officially supported.
412420
def _GetStub(self):
413421
return self._stub
414422

415423
# Get a list of all properties of this type and base types
424+
# Public non-remote method. Officially supported.
416425
#
417426
# @param cls The managed object type
418427
@classmethod
@@ -432,6 +441,7 @@ def _GetPropertyList(cls, includeBaseClassProps=True):
432441
return result
433442

434443
# Get a list of all methods of this type and base types
444+
# Public non-remote method. Officially supported.
435445
#
436446
# @param cls The managed object type
437447
@classmethod
@@ -449,6 +459,7 @@ def _GetMethodList(cls):
449459
return result
450460

451461
# Lookup a method for a given managed object type
462+
# Public non-remote method. Officially supported.
452463
#
453464
# @param type the type
454465
# @param name the name of the property
@@ -536,7 +547,13 @@ def __init__(self, **kwargs):
536547
for (k, v) in list(kwargs.items()):
537548
setattr(self, k, v)
538549

550+
# In contrast with the Python convention for "private" methods,
551+
# the ManagedObject and DataObject method names beginning with
552+
# an underscore denote public, officially supported system methods.
553+
# The execution of these methods does not involve a remote call.
554+
539555
# Get a list of all properties of this type and base types
556+
# Public non-remote method. Officially supported.
540557
#
541558
# @param cls the data object type
542559
@classmethod

0 commit comments

Comments
 (0)