Skip to content

Commit 614e4b7

Browse files
committed
Make gdrive in drive.py constant
1 parent a9bd174 commit 614e4b7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

github_analytics/drive.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
PYDRIVE_CREDENTIALS = 'PYDRIVE_CREDENTIALS'
1616

1717
LOGGER = logging.getLogger(__name__)
18+
GDRIVE_LINK = 'gdrive://'
1819

1920

2021
def is_drive_path(path):
2122
"""Tell if the drive is a Google Drive path or not."""
22-
return path.startswith('gdrive://')
23+
return path.startswith(GDRIVE_LINK)
2324

2425

2526
def split_drive_path(path):
@@ -137,8 +138,8 @@ def get_or_create_gdrive_folder(parent_folder: str, folder_name: str) -> str:
137138
drive = _get_drive_client()
138139

139140
# Check if folder already exists
140-
if parent_folder.startswith('gdrive://'):
141-
parent_folder = parent_folder.replace('gdrive://', '')
141+
if parent_folder.startswith(GDRIVE_LINK):
142+
parent_folder = parent_folder.replace(GDRIVE_LINK, '')
142143

143144
query = {
144145
'q': f"title = '{folder_name}' and mimeType = 'application/vnd.google-apps.folder' "

0 commit comments

Comments
 (0)