Pylog test suite
[logging-analytics.git] / pylog / onaplogging / utils.py
1 # Copyright (c) 2020 Deutsche Telekom.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #       http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS,
9 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
11 import sys
12
13
14 def is_above_python_3_2():  # type: () -> bool
15     """Check if code is running at least on Python 3.2 version.
16
17     Returns:
18         bool: True if it's at least 3.2 version, False otherwise
19
20     """
21     return sys.version_info >= (3, 2, 0, "final", 0)
22
23
24 def is_above_python_2_7():  # type: () -> bool
25     """Check if code is running at least on Python 2.7 version.
26
27     Returns:
28         bool: True if it's at least 2.7 version, False otherwise
29
30     """
31     return sys.version_info >= (2, 7, 0, "final", 0)