GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 9e5000...620833 )
by thatsIch
01:12
created

get_cached_setting_path()   B

Complexity

Conditions 4

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
c 1
b 0
f 0
dl 0
loc 23
rs 8.7972
1
"""
2
This module provides methods for determine the settings path.
3
4
Rainmeter has an built-in variable called #SETTINGSPATH#.
5
With this you can directly route to the drive in which Rainmeter is contained.
6
If by some chance people use @Include on #SETTINGSPATH# it is still able to resolve
7
the path and open the include for you.
8
"""
9
10
11
import os
12
from functools import lru_cache
13
14
from .. import logger
15
# use absolute path because of re-occuraing imports '.' could not work
16
from .program_path_provider import get_cached_program_path
17
18
19
@lru_cache(maxsize=None)
20
def get_cached_setting_path():
21
    """Get the value of the #SETTINGSPATH# variable."""
22
    rainmeterpath = get_cached_program_path()
23
24
    if not rainmeterpath:
25
        return
26
27
    # Check if Rainmeter.ini is in Rainmeter program directory
28
    if os.path.exists(rainmeterpath + "Rainmeter.ini"):
29
        logger.info("Rainmeter.ini found in " + rainmeterpath)
30
        return rainmeterpath
31
32
    else:  # If not, look in %APPDATA%\Rainmeter\
33
        appdata = os.getenv("APPDATA")
34
        if os.path.exists(os.path.join(appdata, "Rainmeter\\Rainmeter.ini")):
35
            logger.info("Rainmeter.ini found in " +
36
                        os.path.join(appdata, "Rainmeter") + "\\")
37
            return os.path.join(appdata, "Rainmeter") + "\\"
38
39
        else:
40
            logger.info("Rainmeter.ini could not be located.")
41
            return None
42