Skip to content

Commit b3d5e21

Browse files
committed
clean-up path handling (use os.path.join and remove unnecessary f-strings)
1 parent a3dd718 commit b3d5e21

7 files changed

Lines changed: 13 additions & 13 deletions

File tree

google_custom_search/google_scratcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@
4040
# Set up file path for CSV report
4141
DATA_WRITE_FILE = os.path.join(
4242
PATH_WORK_DIR,
43-
f"/data_google_custom_search_"
43+
"data_google_custom_search_"
4444
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
4545
)
4646
DATA_WRITE_FILE_TIME = os.path.join(
4747
PATH_WORK_DIR,
48-
f"/data_google_custom_search_time_"
48+
"data_google_custom_search_time_"
4949
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
5050
)
5151
DATA_WRITE_FILE_COUNTRY = os.path.join(
5252
PATH_WORK_DIR,
53-
f"/data_google_custom_search_country_"
53+
"data_google_custom_search_country_"
5454
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
5555
)
5656

@@ -69,7 +69,7 @@ def get_license_list():
6969
"""
7070
# Read license data from file
7171
cc_license_data = pd.read_csv(
72-
f"{PATH_REPO_ROOT}/legal-tool-paths.txt", header=None
72+
os.path.join(PATH_REPO_ROOT, "legal-tool-paths.txt"), header=None
7373
)
7474
# Define regex pattern to extract license types
7575
license_pattern = r"((?:[^/]+/){2}(?:[^/]+)).*"
@@ -97,7 +97,7 @@ def get_lang_list():
9797
)
9898

9999
languages = pd.read_csv(
100-
f"{PATH_WORK_DIR}/google_lang.txt",
100+
os.path.join(PATH_WORK_DIR, "google_lang.txt"),
101101
sep=": ",
102102
header=None,
103103
engine="python",

internetarchive/internetarchive_scratcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Set up file path for CSV report
2929
DATA_WRITE_FILE = os.path.join(
3030
PATH_WORK_DIR,
31-
f"/data_internetarchive_"
31+
"data_internetarchive_"
3232
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
3333
)
3434

@@ -47,7 +47,7 @@ def get_license_list():
4747
"""
4848
# Read license data from file
4949
cc_license_data = pd.read_csv(
50-
f"{PATH_REPO_ROOT}/legal-tool-paths.txt", header=None
50+
os.path.join(PATH_REPO_ROOT, "legal-tool-paths.txt"), header=None
5151
)
5252
# Define regex pattern to extract license types
5353
license_pattern = r"((?:[^/]+/){2}(?:[^/]+)).*"

metmuseum/metmuseum_scratcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# Set up file path for CSV report
2525
DATA_WRITE_FILE = os.path.join(
2626
PATH_WORK_DIR,
27-
f"/data_metmuseum_"
27+
"data_metmuseum_"
2828
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
2929
)
3030

vimeo/vimeo_scratcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# Set up file path for CSV report
3737
DATA_WRITE_FILE = os.path.join(
3838
PATH_WORK_DIR,
39-
f"/data_vimeo_"
39+
"data_vimeo_"
4040
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
4141
)
4242

wikicommons/wikicommons_scratcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Set up file path for CSV report
2424
DATA_WRITE_FILE = os.path.join(
2525
PATH_WORK_DIR,
26-
f"/data_wikicommons_"
26+
"data_wikicommons_"
2727
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
2828
)
2929

wikipedia/wikipedia_scratcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Set up file path for CSV report
2424
DATA_WRITE_FILE = os.path.join(
2525
PATH_WORK_DIR,
26-
f"/data_wikipedia_"
26+
"data_wikipedia_"
2727
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
2828
)
2929

youtube/youtube_scratcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
# Set up file path for CSV report
3434
DATA_WRITE_FILE = os.path.join(
3535
PATH_WORK_DIR,
36-
f"/data_youtube_"
36+
"data_youtube_"
3737
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
3838
)
3939
DATA_WRITE_FILE_TIME = os.path.join(
4040
PATH_WORK_DIR,
41-
f"/data_youtube_time_"
41+
"data_youtube_time_"
4242
f"{DATETIME_TODAY.year}_{DATETIME_TODAY.month}_{DATETIME_TODAY.day}.csv",
4343
)
4444

0 commit comments

Comments
 (0)