blink1073 / oct2py

Compare 674bd36 ... +2 ... a10b64a

Flags

Flags have been temporarily removed from this view while the flagging feature is refactored for better performance and user experience.

You can still use flags when viewing individual files. Flag-level thresholds will also remain on pull and merge requests in your repository provider.

More information can be found in our documentation.

Showing 1 of 7 files from the diff.
Other files ignored by Codecov

@@ -275,8 +275,9 @@
Loading
275 275
            Name of function to run or a path to an m-file.
276 276
        func_args: object, optional
277 277
            Args to send to the function.
278 -
        nout: int, optional
279 -
            Desired number of return arguments, defaults to 1.
278 +
        nout: int or str, optional. 
279 +
            Desired number of return arguments, defaults to 1. If nout 
280 +
            value is 'max_nout', get_max_nout() will be used.
280 281
        store_as: str, optional
281 282
            If given, saves the result to the given Octave variable name
282 283
            instead of returning it.
@@ -342,6 +343,8 @@
Loading
342 343
        nout = kwargs.get('nout', None)
343 344
        if nout is None:
344 345
            nout = 1
346 +
        elif nout == 'max_nout':
347 +
            nout = self._get_max_nout(func_path)
345 348
346 349
        plot_dir = kwargs.get('plot_dir')
347 350
@@ -743,3 +746,31 @@
Loading
743 746
        setattr(self, attr, obj)
744 747
745 748
        return obj
749 +
750 +
    def _get_max_nout(self, func_path):
751 +
        """Get or count maximum nout of .m function."""
752 +
        
753 +
        if not osp.isabs(func_path):
754 +
            func_path = self.which(func_path)
755 +
756 +
        nout = 0
757 +
        status = 'NOT FUNCTION'
758 +
        with open(func_path, encoding='utf8') as f:
759 +
            for l in f: 
760 +
                if l[0] != 'f': #not function
761 +
                    if status == 'NOT FUNCTION':
762 +
                        continue
763 +
                l = l.translate(str.maketrans('', '', '[]()')).split()
764 +
                try:
765 +
                    l.remove('function')
766 +
                except:
767 +
                    pass
768 +
                for s in l:
769 +
                    if s == '...':
770 +
                        status = 'FUNCTION'
771 +
                        continue
772 +
                    if s != '=':
773 +
                        nout += 1
774 +
                    else:
775 +
                        return nout
776 +
        return nout

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
oct2py -1.34% 90.45%
Project Totals (10 files) 90.45%
Loading