Skip to content

Commit a058be0

Browse files
committed
update variable name
1 parent e67a1c8 commit a058be0

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ c.DrivesConfig.access_key_id = "<Drives Access Key ID / IAM Access Key ID>"
4040
c.DrivesConfig.secret_access_key = "<Drives Secret Access Key / IAM Secret>"
4141
c.DrivesConfig.session_token = "<Drives Session Token / IAM Session Token (optional)>"
4242
c.DrivesConfig.provider = "<Drives provider e.g.: s3, gcs>"
43-
c.DrivesConfig.max_files_shown = "<Integer repersenting maximum number of files that can be shown in a listing, given any path (optional)>"
43+
c.DrivesConfig.max_files_listed = "<Integer repersenting maximum number of files that can be shown in a listing, given any path (optional)>"
4444
```
4545

4646
### Custom credentials file path
@@ -63,7 +63,7 @@ export JP_DRIVES_ACCESS_KEY_ID="<Drives Access Key ID>"
6363
export JP_DRIVES_SECRET_ACCESS_KEY="<Drives Secret Access Key>"
6464
export JP_DRIVES_SESSION_TOKEN="<Drives Session Token (optional)>"
6565
export JP_DRIVES_CUSTOM_CREDENTIALS_PATH="<Path to local file which contains credentials (optional)>"
66-
export JP_DRIVES_MAX_FILES_SHOWN="<Integer repersenting maximum number of files that can be shown in a listing, given any path (optional)>"
66+
export JP_DRIVES_MAX_FILES_LISTED="<Integer repersenting maximum number of files that can be shown in a listing, given any path (optional)>"
6767
```
6868

6969
## Uninstall

jupyter_drives/base.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class DrivesConfig(Configurable):
5959
help="Custom path of file where credentials are located. Extension automatically checks jupyter_notebook_config.py or directly in ~/.aws/credentials for AWS CLI users."
6060
)
6161

62-
max_files_shown = Int(
62+
max_files_listed = Int(
6363
None,
6464
config = True,
6565
allow_none = True,
@@ -89,11 +89,11 @@ def __init__(self, **kwargs):
8989

9090
def _load_credentials(self):
9191
# check if max_files_shown is not set in jupyter_notebook_config.py
92-
if self.max_files_shown is None:
93-
if "JP_DRIVES_MAX_FILES_SHOWN" in os.environ:
94-
self.max_files_shown = os.environ["JP_DRIVES_MAX_FILES_SHOWN"]
92+
if self.max_files_listed is None:
93+
if "JP_DRIVES_MAX_FILES_LISTED" in os.environ:
94+
self.max_files_listed = os.environ["JP_DRIVES_MAX_FILES_LISTED"]
9595
else:
96-
self.max_files_shown = 1000
96+
self.max_files_listed = 1000
9797

9898
# check if credentials were already set in jupyter_notebook_config.py
9999
if self.access_key_id is not None and self.secret_access_key is not None:
@@ -103,7 +103,7 @@ def _load_credentials(self):
103103
if self.custom_credentials_path is None and "JP_DRIVES_CUSTOM_CREDENTIALS_PATH" in os.environ:
104104
self.custom_credentials_path = os.environ["JP_DRIVES_CUSTOM_CREDENTIALS_PATH"]
105105
if self.custom_credentials_path is not None:
106-
self.provider, self.access_key_id, self.secret_access_key, self.session_token, self.max_files_shown = self._extract_credentials_from_file(self.custom_credentials_path)
106+
self.provider, self.access_key_id, self.secret_access_key, self.session_token, self.max_files_listed = self._extract_credentials_from_file(self.custom_credentials_path)
107107
return
108108

109109
# if not, try to load credentials from AWS CLI
@@ -126,7 +126,7 @@ def _extract_credentials_from_file(self, file_path):
126126
try:
127127
with open(file_path, 'r') as file:
128128
provider, access_key_id, secret_access_key, session_token = None, None, None, None
129-
max_files_shown = 1000
129+
max_files_listed = 1000
130130
lines = file.readlines()
131131
for line in lines:
132132
if line.startswith("drives_provider ="):
@@ -138,8 +138,8 @@ def _extract_credentials_from_file(self, file_path):
138138
elif line.startswith("drives_session_token ="):
139139
session_token = line.split("=")[1].strip()
140140
elif line.startswith("drives_max_files_shwon ="):
141-
max_files_shown = line.split("=")[1].strip()
142-
return provider, access_key_id, secret_access_key, session_token, max_files_shown
141+
max_files_listed = line.split("=")[1].strip()
142+
return provider, access_key_id, secret_access_key, session_token, max_files_listed
143143
except Exception as e:
144144
print(f"Failed loading credentials from {file_path}: {e}")
145145
return

jupyter_drives/manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ async def get_contents(self, drive_name, path):
194194
emptyDir = True # assume we are dealing with an empty directory
195195

196196
chunk_size = 100
197-
if self._config.max_files_shown < chunk_size:
198-
chunk_size = self._config.max_files_shown
199-
no_batches = int(self._config.max_files_shown/chunk_size)
197+
if self._config.max_files_listed < chunk_size:
198+
chunk_size = self._config.max_files_listed
199+
no_batches = int(self._config.max_files_listed/chunk_size)
200200

201201
# using Arrow lists as they are recommended for large results
202202
# stream will be an async iterable of RecordBatch
@@ -206,7 +206,7 @@ async def get_contents(self, drive_name, path):
206206
current_batch += 1
207207
# reached last batch that can be shown (partially)
208208
if current_batch == no_batches + 1:
209-
remaining_files = self._config.max_files_shown - no_batches*chunk_size
209+
remaining_files = self._config.max_files_listed - no_batches*chunk_size
210210

211211
# if content exists we are dealing with a directory
212212
if isDir is False and batch:

0 commit comments

Comments
 (0)