fastest.file_handler.read_file.read_file()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 2
nop 2
1
import os
2
3
4
def read_file(dir_path, file_path):
5
    """
6
    Read contents of a .py file and return as text
7
    :param dir_path: str
8
    :param file_path: str
9
    :return: str
10
    """
11
    goal_dir = os.path.join(dir_path, file_path)
12
    with open(os.path.abspath(goal_dir), 'r') as fp:
13
        contents = fp.read()
14
    return contents
15