Skip to content

Commit 1f44f56

Browse files
Fixed bug with cwd (#111)
Two main changes: 1. Everything that osa uses for work (images and so) is moved into osa_tool to use osa as app or from source 2. Now everything about repo is saved to cwd (git clone, report and so)
1 parent 5803231 commit 1f44f56

File tree

11 files changed

+10
-12
lines changed

11 files changed

+10
-12
lines changed

osa_tool/analytics/report_generator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def __init__(self,
2828
parse_folder_name(self.repo_url))
2929
self.prompt_path = os.path.join(
3030
osa_project_root(),
31-
"osa_tool",
3231
"config",
3332
"standart",
3433
"settings",

osa_tool/analytics/report_maker.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def __init__(self,
5454
"osa_logo.PNG"
5555
)
5656
self.output_path = os.path.join(
57-
osa_project_root(),
58-
"examples",
57+
os.getcwd(),
5958
f"{self.metadata.name}_report.pdf"
6059
)
6160

@@ -108,7 +107,7 @@ def generate_qr_code(self) -> str:
108107
str: The file path of the generated QR code image.
109108
"""
110109
qr = qrcode.make(self.osa_url)
111-
qr_path = os.path.join(osa_project_root(), "temp_qr.png")
110+
qr_path = os.path.join(os.getcwd(), "temp_qr.png")
112111
qr.save(qr_path)
113112
return qr_path
114113

osa_tool/analytics/sourcerank.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(
1818
self.config = config_loader.config
1919
self.repo_url = self.config.git.repository
2020
self.metadata = load_data_metadata(self.repo_url)
21-
self.repo_path = os.path.join(osa_project_root(),
21+
self.repo_path = os.path.join(os.getcwd(),
2222
parse_folder_name(self.repo_url))
2323
self.summary, self.tree, self.content = ingest(self.repo_path)
2424

File renamed without changes.

osa_tool/github_agent/github_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, repo_url: str, branch_name: str = "osa_tool"):
4848
"""
4949
load_dotenv()
5050
self.repo_url = repo_url
51-
self.clone_dir = parse_folder_name(repo_url)
51+
self.clone_dir = os.path.join(os.getcwd(), parse_folder_name(repo_url))
5252
self.branch_name = branch_name
5353
self.repo = None
5454
self.token = os.getenv("GIT_TOKEN")

osa_tool/readmeai/readme_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def readme_agent(config_loader, article: str | None) -> None:
3333
Exception: If an error occurs during README.md generation.
3434
"""
3535
repo_url = config_loader.config.git.repository
36-
repo_path = os.path.join(osa_project_root(), parse_folder_name(repo_url))
36+
repo_path = os.path.join(os.getcwd(), parse_folder_name(repo_url))
3737
file_to_save = os.path.join(repo_path, "README.md")
3838

3939
logger.info("Started generating README.md. Processing the repository: %s"

osa_tool/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ def load_configuration(
155155
if article is None:
156156

157157
config_loader = ConfigLoader(
158-
config_dir=os.path.join(osa_project_root(), "osa_tool", "config",
158+
config_dir=os.path.join(osa_project_root(), "config",
159159
"standart"))
160160
else:
161161
config_loader = ArticleConfigLoader(
162-
config_dir=os.path.join(osa_project_root(), "osa_tool", "config",
162+
config_dir=os.path.join(osa_project_root(), "config",
163163
"with_article"))
164164

165165
config_loader.config.git = GitSettings(repository=repo_url)

osa_tool/translation/dir_translator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(
3131
self.config = config_loader.config
3232
self.repo_url = self.config.git.repository
3333
self.model_handler: ModelHandler = ModelHandlerFactory.build(self.config)
34-
self.base_path = os.path.join(osa_project_root(), parse_folder_name(self.repo_url))
34+
self.base_path = os.path.join(os.getcwd(), parse_folder_name(self.repo_url))
3535

3636
self.excluded_dirs = {".git", ".venv"}
3737
self.extensions_code_files = {".py"}

osa_tool/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def parse_folder_name(repo_url: str) -> str:
2929

3030
def osa_project_root() -> Path:
3131
"""Returns osa_tool project root folder."""
32-
return Path(__file__).parent.parent
32+
return Path(__file__).parent
3333

3434

3535
def get_base_repo_url(repo_url: str) -> str:

0 commit comments

Comments
 (0)