def __eq__(self, other): if other == None: return False elif (hasattr2(other, '_get_object_id')): return self.equals(other) else: return other.__eq__(self)
def help(self, var, pattern=None, short_name=True, display=True): """Displays a help page about a class or an object. :param var: JavaObject or JavaClass for which a help page will be generated. :param pattern: Star-pattern used to filter the members. For example 'get*Foo' may return getMyFoo, getFoo, getFooBar, but not bargetFoo. :param short_name: If True, only the simple name of the parameter types and return types will be displayed. If False, the fully qualified name of the types will be displayed. :param display: If True, the help page is displayed in an interactive page similar to the `help` command in Python. If False, the page is returned as a string. """ if hasattr2(var, '_get_object_id'): command = HELP_COMMAND_NAME +\ HELP_OBJECT_SUBCOMMAND_NAME +\ var._get_object_id() + '\n' +\ get_command_part(pattern) +\ get_command_part(short_name) +\ END_COMMAND_PART answer = self._gateway_client.send_command(command) elif hasattr2(var, '_fqn'): command = HELP_COMMAND_NAME +\ HELP_CLASS_SUBCOMMAND_NAME +\ var._fqn + '\n' +\ get_command_part(pattern) +\ get_command_part(short_name) +\ END_COMMAND_PART answer = self._gateway_client.send_command(command) else: raise Py4JError('var is neither a Java Object nor a Java Class') help_page = get_return_value(answer, self._gateway_client, None, None) if (display): ttypager(help_page) else: return help_page
def can_convert(self, object): return hasattr2(object, "keys") and hasattr2(object, "__getitem__")
def can_convert(self, object): # Check for iterator protocol and should not be an instance of byte # array (taken care of by protocol) return hasattr2(object, "__iter__") and not isbytearray(object) and\ not ispython3bytestr(object) and not isinstance(object, basestring)
def can_convert(self, object): return hasattr2(object, 'keys') and hasattr2(object, '__getitem__')
def can_convert(self, object): return hasattr2(object, '__iter__')