Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a close-handler to the uncurl-annex remote #737

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions datalad_next/annexremotes/uncurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@
$ git annex addurl http://httpbin.org/basic-auth/myuser/mypassword
Credential needed for access to http://httpbin.org/basic-auth/myuser/mypassword
user: myuser
password:
password (repeat):
password:
password (repeat):
Enter a name to save the credential
(for accessing http://httpbin.org/basic-auth/myuser/mypassword) securely for future
reuse, or 'skip' to not save the credential
name: httpbin-dummy

addurl http://httpbin.org/basic-auth/myuser/mypassword (from uncurl) (to ...)
addurl http://httpbin.org/basic-auth/myuser/mypassword (from uncurl) (to ...)
ok
(recording state in git...)

Expand Down Expand Up @@ -258,6 +258,14 @@ def __init__(self, annex: Master):
# or across annex keys
self.persistent_tmpl_props: dict[str, str] = {}

def __del__(self):
self.close()

def close(self) -> None:
if self.url_handler:
del self.url_handler
self.url_handler = None

def initremote(self) -> None:
# at present there is nothing that needs to be done on init/enable.
# the remote is designed to work without any specific setup too
Expand Down