Using pygount I am trying to get the SUM of: Codes, Comments and Empty. I do not have any errors but I think I messed my relative paths.
Firstly check the tree below for a visualization
C:\...\Projects\TestProject
├───utils
│ ├───__init__.py
│ └───loc.py
└───launcher.py
ROOT_DIR const def is inside __init__ of util folder. I am not sure if my relative path should have 1x or 2x .parent to reach "TestProject"(which is the root dir).
from pathlib import Path
from .loc import test
ROOT_DIR = Path(__file__).parent.parent
Below is the the .loc file
from utils import ROOT_DIR
class Counter:
def __init__(self):
self.code = 0
self.docs = 0
self.empty = 0
def count(self):
for subdir, _, files in os.walk(ROOT_DIR / "TestProject"):
for file in (f for f in files if f.endswith(".py")):
analysis = SourceAnalysis.from_file(f"{subdir}/{file}", "pygount", encoding="utf-8")
self.code += analysis.code_count
self.docs += analysis.documentation_count
self.empty += analysis.empty_count