Check if an unclosed parenthesis exists, then attempt to get the argspec() for it. On success, update self.funcprops,self.arg_pos and return True, otherwise set self.funcprops to None and return False
(self)
| 660 | return None, None |
| 661 | |
| 662 | def get_args(self): |
| 663 | """Check if an unclosed parenthesis exists, then attempt to get the |
| 664 | argspec() for it. On success, update self.funcprops,self.arg_pos and |
| 665 | return True, otherwise set self.funcprops to None and return False""" |
| 666 | |
| 667 | self.current_func = None |
| 668 | |
| 669 | if not self.config.arg_spec: |
| 670 | return False |
| 671 | |
| 672 | func, arg_number = self._funcname_and_argnum(self.current_line) |
| 673 | if not func: |
| 674 | return False |
| 675 | |
| 676 | try: |
| 677 | if inspection.is_eval_safe_name(func): |
| 678 | f = self.get_object(func) |
| 679 | else: |
| 680 | try: |
| 681 | fake_cursor = self.current_line.index(func) + len(func) |
| 682 | f = simpleeval.evaluate_current_attribute( |
| 683 | fake_cursor, self.current_line, self.interp.locals |
| 684 | ) |
| 685 | except simpleeval.EvaluationError: |
| 686 | return False |
| 687 | |
| 688 | if inspect.isclass(f): |
| 689 | class_f = None |
| 690 | |
| 691 | if ( |
| 692 | (not class_f or not inspection.getfuncprops(func, class_f)) |
| 693 | and hasattr(f, "__new__") |
| 694 | and f.__new__ is not object.__new__ |
| 695 | and |
| 696 | # py3 |
| 697 | f.__new__.__class__ is not object.__new__.__class__ |
| 698 | ): |
| 699 | class_f = f.__new__ |
| 700 | |
| 701 | if class_f: |
| 702 | f = class_f |
| 703 | except Exception: |
| 704 | # another case of needing to catch every kind of error |
| 705 | # since user code is run in the case of descriptors |
| 706 | # XXX: Make sure you raise here if you're debugging the completion |
| 707 | # stuff ! |
| 708 | return False |
| 709 | |
| 710 | self.current_func = f |
| 711 | self.funcprops = inspection.getfuncprops(func, f) |
| 712 | if self.funcprops: |
| 713 | self.arg_pos = arg_number |
| 714 | return True |
| 715 | self.arg_pos = None |
| 716 | return False |
| 717 | |
| 718 | def get_source_of_current_name(self) -> str: |
| 719 | """Return the unicode source code of the object which is bound to the |