def _clean_restrictions()

in cli/src/klio_cli/commands/job/profile.py [0:0]


    def _clean_restrictions(restrictions):
        # restrictions are passed in the CLI as strings, but they need to
        # be parsed before calling `pstats.Stats().print_stats`. Floats
        # are a % of top results, ints are # of top results, and strings
        # as a regex for filtering results; see docs:
        # docs.python.org/3/library/profile.html#pstats.Stats.print_stats
        for res in restrictions:
            if "." in res:
                try:
                    res = float(res)
                except Exception:
                    pass
            else:
                try:
                    res = int(res)
                except Exception:
                    pass
            yield res