(self, name)
return pyo.value
Allows accessing Objective-C properties and methods using Python attribute syntax.

        If ``self`` has a Python attribute with the given name, its value is returned.

        If there is an Objective-C property with the given name, its value is returned using its getter method.
        An attribute is considered a property if any of the following are true:

        * A property with the name is present on the class (i. e. declared using ``@property`` in the source code)
        * There is both a getter and setter method for the name
        * The name has been declared as a property using :meth:`ObjCClass.declare_property`

        Otherwise, a method matching the given name is looked up. :class:`ObjCInstance` understands two syntaxes
        for calling Objective-C methods:

        * "Flat" syntax: the Objective-C method name is spelled out in the attribute name,
          with all colons replaced with underscores, and all arguments are passed as positional arguments.
          For example, the Objective-C method call ``[self initWithWidth:w height:h]``
          translates to ``self.initWithWidth_height_(w, h)``.
        * "Interleaved" syntax: the Objective-C method name is split up between the attribute name
          and the keyword arguments passed to the returned method. For example, the Objective-C method call
          ``[self initWithRed:r green:g blue:b]`` translates to ``self.initWithRed(r, green=g, blue=b)``.

        The "interleaved" syntax is usually preferred, since it looks more similar to normal Objective-C syntax.
        However, the "flat" syntax is also fully supported. Certain method names require the "flat" syntax,
        for example if two arguments have the same label (e. g. ``performSelector:withObject:withObject:``),
        which is not supported by Python's keyword argument syntax.

        .. warning::

            The "interleaved" syntax currently ignores the ordering of its keyword arguments.
            However, in the interest of readability, the keyword arguments should always be passed
            in the same order as they appear in the method name.

            This also means that two methods whose names which differ only in the ordering of their keywords
            will conflict with each other, and can only be called reliably using "flat" syntax.

            As of Python 3.6, the order of keyword arguments passed to functions is preserved (:pep:`468`).
            In the future, once Rubicon requires Python 3.6 or newer, "interleaved" method calls
            will respect keyword argument order. This will fix the kind of conflict described above,
            but will also disallow specifying the keyword arguments out of order.
Allows accessing Objective-C properties and methods using Python attribute syntax.
Allows accessing Objective - C properties and methods using Python attribute syntax .
def __getattr__(self, name):
        """Allows accessing Objective-C properties and methods using Python attribute syntax.

        If ``self`` has a Python attribute with the given name, its value is returned.

        If there is an Objective-C property with the given name, its value is returned using its getter method.
        An attribute is considered a property if any of the following are true:

        * A property with the name is present on the class (i. e. declared using ``@property`` in the source code)
        * There is both a getter and setter method for the name
        * The name has been declared as a property using :meth:`ObjCClass.declare_property`

        Otherwise, a method matching the given name is looked up. :class:`ObjCInstance` understands two syntaxes
        for calling Objective-C methods:

        * "Flat" syntax: the Objective-C method name is spelled out in the attribute name,
          with all colons replaced with underscores, and all arguments are passed as positional arguments.
          For example, the Objective-C method call ``[self initWithWidth:w height:h]``
          translates to ``self.initWithWidth_height_(w, h)``.
        * "Interleaved" syntax: the Objective-C method name is split up between the attribute name
          and the keyword arguments passed to the returned method. For example, the Objective-C method call
          ``[self initWithRed:r green:g blue:b]`` translates to ``self.initWithRed(r, green=g, blue=b)``.

        The "interleaved" syntax is usually preferred, since it looks more similar to normal Objective-C syntax.
        However, the "flat" syntax is also fully supported. Certain method names require the "flat" syntax,
        for example if two arguments have the same label (e. g. ``performSelector:withObject:withObject:``),
        which is not supported by Python's keyword argument syntax.

        .. warning::

            The "interleaved" syntax currently ignores the ordering of its keyword arguments.
            However, in the interest of readability, the keyword arguments should always be passed
            in the same order as they appear in the method name.

            This also means that two methods whose names which differ only in the ordering of their keywords
            will conflict with each other, and can only be called reliably using "flat" syntax.

            As of Python 3.6, the order of keyword arguments passed to functions is preserved (:pep:`468`).
            In the future, once Rubicon requires Python 3.6 or newer, "interleaved" method calls
            will respect keyword argument order. This will fix the kind of conflict described above,
            but will also disallow specifying the keyword arguments out of order.
        """

        # Search for named instance method in the class object and if it
        # exists, return callable object with self as hidden argument.
        # Note: you should give self and not self.ptr as a parameter to
        # ObjCBoundMethod, so that it will be able to keep the ObjCInstance
        # alive for chained calls like MyClass.alloc().init() where the
        # object created by alloc() is not assigned to a variable.

        # If there's a property with this name; return the value directly.
        # If the name ends with _, we can shortcut this step, because it's
        # clear that we're dealing with a method call.
        if not name.endswith('_'):
            method = self.objc_class._cache_property_accessor(name)
            if method:
                return ObjCBoundMethod(method, self)()

        # See if there's a partial method starting with the given name,
        # either on self's class or any of the superclasses.
        cls = self.objc_class
        while cls is not None:
            # Load the class's methods if we haven't done so yet.
            if cls.methods_ptr is None:
                cls._load_methods()

            try:
                method = cls.partial_methods[name]
                break
            except KeyError:
                cls = cls.superclass
        else:
            method = None

        if method is None or set(method.methods) == {frozenset()}:
            # Find a method whose full name matches the given name if no partial method was found,
            # or the partial method can only resolve to a single method that takes no arguments.
            # The latter case avoids returning partial methods in cases where a regular method works just as well.
            method = self.objc_class._cache_method(name.replace("_", ":"))

        if method:
            return ObjCBoundMethod(method, self)

        # Check if the attribute name corresponds to an instance attribute defined at
        # runtime from Python. Return it if yes, raise an AttributeError otherwise.
        key = self._associated_attr_key_for_name(name)
        pyo_wrapper = libobjc.objc_getAssociatedObject(self, key)

        if pyo_wrapper.value is None:
            raise AttributeError('%s.%s %s has no attribute %s' % (
                type(self).__module__, type(self).__qualname__, self.objc_class.name, name)
            )
        address = get_ivar(pyo_wrapper, "wrapped_pointer")
        pyo = cast(address.value, py_object)

        return pyo.value
def __getattr__ ( self , name ) : # Search for named instance method in the class object and if it # exists, return callable object with self as hidden argument. # Note: you should give self and not self.ptr as a parameter to # ObjCBoundMethod, so that it will be able to keep the ObjCInstance # alive for chained calls like MyClass.alloc().init() where the # object created by alloc() is not assigned to a variable. # If there's a property with this name; return the value directly. # If the name ends with _, we can shortcut this step, because it's # clear that we're dealing with a method call. if not name . endswith ( '_' ) : method = self . objc_class . _cache_property_accessor ( name ) if method : return ObjCBoundMethod ( method , self ) ( ) # See if there's a partial method starting with the given name, # either on self's class or any of the superclasses. cls = self . objc_class while cls is not None : # Load the class's methods if we haven't done so yet. if cls . methods_ptr is None : cls . _load_methods ( ) try : method = cls . partial_methods [ name ] break except KeyError : cls = cls . superclass else : method = None if method is None or set ( method . methods ) == { frozenset ( ) } : # Find a method whose full name matches the given name if no partial method was found, # or the partial method can only resolve to a single method that takes no arguments. # The latter case avoids returning partial methods in cases where a regular method works just as well. method = self . objc_class . _cache_method ( name . replace ( "_" , ":" ) ) if method : return ObjCBoundMethod ( method , self ) # Check if the attribute name corresponds to an instance attribute defined at # runtime from Python. Return it if yes, raise an AttributeError otherwise. key = self . _associated_attr_key_for_name ( name ) pyo_wrapper = libobjc . objc_getAssociatedObject ( self , key ) if pyo_wrapper . value is None : raise AttributeError ( '%s.%s %s has no attribute %s' % ( type ( self ) . __module__ , type ( self ) . __qualname__ , self . objc_class . name , name ) ) address = get_ivar ( pyo_wrapper , "wrapped_pointer" ) pyo = cast ( address . value , py_object ) return pyo . value