forked from GridTools/gt4py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
30 lines (25 loc) · 1.12 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# GT4Py - GridTools Framework
#
# Copyright (c) 2014-2023, ETH Zurich
# All rights reserved.
#
# This file is part of the GT4Py project and the GridTools framework.
# GT4Py is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or any later
# version. See the LICENSE.txt file at the top-level directory of this
# distribution for a copy of the license or check <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
from . import definitions
__all__ = ["definitions", "get_processor_id"]
def get_processor_id(processor):
if hasattr(processor, "__module__") and hasattr(processor, "__name__"):
module_path = processor.__module__.split(".")[-1]
name = processor.__name__
return f"{module_path}.{name}"
elif hasattr(processor, "__module__") and hasattr(processor, "__class__"):
module_path = processor.__module__.split(".")[-1]
name = processor.__class__.__name__
return f"{module_path}.{name}"
return repr(processor)