コード例 #1
0
        def abs_file_dict(d):
            """Return a dict like d, but with keys modified by `abs_file`."""
            # The call to litems() ensures that the GIL protects the dictionary
            # iterator against concurrent modifications by tracers running
            # in other threads. We try three times in case of concurrent
            # access, hoping to get a clean copy.
            runtime_err = None
            for _ in range(3):
                try:
                    items = litems(d)
                except RuntimeError as ex:
                    runtime_err = ex
                else:
                    break
            else:
                raise runtime_err  # pylint: disable=raising-bad-type

            return dict((abs_file(k), v) for k, v in items)
コード例 #2
0
ファイル: collector.py プロジェクト: marcosptf/fedora
        def abs_file_dict(d):
            """Return a dict like d, but with keys modified by `abs_file`."""
            # The call to litems() ensures that the GIL protects the dictionary
            # iterator against concurrent modifications by tracers running
            # in other threads. We try three times in case of concurrent
            # access, hoping to get a clean copy.
            runtime_err = None
            for _ in range(3):
                try:
                    items = litems(d)
                except RuntimeError as ex:
                    runtime_err = ex
                else:
                    break
            else:
                raise runtime_err       # pylint: disable=raising-bad-type

            return dict((abs_file(k), v) for k, v in items)