Skip to content

Commit

Permalink
adjusted cache dir definition to be dependent on the config
Browse files Browse the repository at this point in the history
  • Loading branch information
tholzheim committed Jul 16, 2024
1 parent 90cdb1d commit 1b3931c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 3 additions & 1 deletion ceurws/loctime.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import yaml
from tabulate import tabulate

from ceurws.ceur_ws import CEURWS


class LoctimeParser:
"""
Expand Down Expand Up @@ -40,7 +42,7 @@ def __init__(self, filepath: str | None = None):
FileNotFoundError: Raises an error if the specified YAML file does not exist.
"""
if filepath is None:
self.ceurws_path = Path(os.path.expanduser("~/.ceurws"))
self.ceurws_path = CEURWS.CACHE_DIR
self.filepath: Path = self.ceurws_path.joinpath("loctime.yaml")
else:
self.file_path = Path(filepath)
Expand Down
9 changes: 5 additions & 4 deletions ceurws/volume_neo4j.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import argparse
import json
import os
import re
import socket
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import Optional

import requests
from ceurws.ceur_ws import CEURWS
from neo4j import GraphDatabase
from neo4j.exceptions import AuthError, ConfigurationError, ServiceUnavailable

from ceurws.ceur_ws import CEURWS


class Neo4j:
"""
Expand Down Expand Up @@ -137,7 +138,7 @@ def load_json_file(source: str) -> list["Volume"]:
return volumes

@classmethod
def default_source(cls) -> str:
def default_source(cls) -> Path:
"""
get the default source
"""
Expand All @@ -158,7 +159,7 @@ def parse_args(cls, argv: list | None = None):

default_source = cls.default_source()
parser = argparse.ArgumentParser(description="Volume/Editor/Location Information")
parser.add_argument("--source", default=default_source, help="Source JSON file path")
parser.add_argument("--source", default=str(default_source), help="Source JSON file path")
# Add progress option
parser.add_argument(
"--progress",
Expand Down
2 changes: 0 additions & 2 deletions tests/test_loctime.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
"""

import json
from pathlib import Path

from ceurws.ceur_ws import CEURWS

from ceurws.loctime import LoctimeParser, PercentageTable
from tests.basetest import Basetest

Expand Down
2 changes: 1 addition & 1 deletion tests/test_volume_neo4j.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_parse_args(self):
Test the parse_args function.
"""
source = Volume.default_source()
args = Volume.parse_args(["--source", source])
args = Volume.parse_args(["--source", str(source)])
self.assertEqual(args.source, source)

@requires_neo4j
Expand Down

0 comments on commit 1b3931c

Please sign in to comment.