repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_documentation_string
stringlengths
1
47.2k
func_code_url
stringlengths
85
339
Dallinger/Dallinger
dallinger/recruiters.py
MTurkRecruiter._create_mturk_qualifications
def _create_mturk_qualifications(self): """Create MTurk Qualification for experiment ID, and for group_name if it's been set. Qualifications with these names already exist, but it's faster to try and fail than to check, then try. """ for name, desc in self.qualifications.items():...
python
def _create_mturk_qualifications(self): """Create MTurk Qualification for experiment ID, and for group_name if it's been set. Qualifications with these names already exist, but it's faster to try and fail than to check, then try. """ for name, desc in self.qualifications.items():...
Create MTurk Qualification for experiment ID, and for group_name if it's been set. Qualifications with these names already exist, but it's faster to try and fail than to check, then try.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/recruiters.py#L670-L679
Dallinger/Dallinger
dallinger/recruiters.py
BotRecruiter.open_recruitment
def open_recruitment(self, n=1): """Start recruiting right away.""" logger.info("Opening Bot recruitment for {} participants".format(n)) factory = self._get_bot_factory() bot_class_name = factory("", "", "").__class__.__name__ return { "items": self.recruit(n), ...
python
def open_recruitment(self, n=1): """Start recruiting right away.""" logger.info("Opening Bot recruitment for {} participants".format(n)) factory = self._get_bot_factory() bot_class_name = factory("", "", "").__class__.__name__ return { "items": self.recruit(n), ...
Start recruiting right away.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/recruiters.py#L756-L764
Dallinger/Dallinger
dallinger/recruiters.py
BotRecruiter.recruit
def recruit(self, n=1): """Recruit n new participant bots to the queue""" logger.info("Recruiting {} Bot participants".format(n)) factory = self._get_bot_factory() urls = [] q = _get_queue() for _ in range(n): base_url = get_base_url() worker = gen...
python
def recruit(self, n=1): """Recruit n new participant bots to the queue""" logger.info("Recruiting {} Bot participants".format(n)) factory = self._get_bot_factory() urls = [] q = _get_queue() for _ in range(n): base_url = get_base_url() worker = gen...
Recruit n new participant bots to the queue
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/recruiters.py#L766-L787
Dallinger/Dallinger
dallinger/recruiters.py
BotRecruiter.notify_duration_exceeded
def notify_duration_exceeded(self, participants, reference_time): """The bot participant has been working longer than the time defined in the "duration" config value. """ for participant in participants: participant.status = "rejected" session.commit()
python
def notify_duration_exceeded(self, participants, reference_time): """The bot participant has been working longer than the time defined in the "duration" config value. """ for participant in participants: participant.status = "rejected" session.commit()
The bot participant has been working longer than the time defined in the "duration" config value.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/recruiters.py#L799-L805
Dallinger/Dallinger
dallinger/recruiters.py
MultiRecruiter.parse_spec
def parse_spec(self): """Parse the specification of how to recruit participants. Example: recruiters = bots: 5, mturk: 1 """ recruiters = [] spec = get_config().get("recruiters") for match in self.SPEC_RE.finditer(spec): name = match.group(1) coun...
python
def parse_spec(self): """Parse the specification of how to recruit participants. Example: recruiters = bots: 5, mturk: 1 """ recruiters = [] spec = get_config().get("recruiters") for match in self.SPEC_RE.finditer(spec): name = match.group(1) coun...
Parse the specification of how to recruit participants. Example: recruiters = bots: 5, mturk: 1
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/recruiters.py#L832-L843
Dallinger/Dallinger
dallinger/recruiters.py
MultiRecruiter.recruiters
def recruiters(self, n=1): """Iterator that provides recruiters along with the participant count to be recruited for up to `n` participants. We use the `Recruitment` table in the db to keep track of how many recruitments have been requested using each recruiter. We'll use the fi...
python
def recruiters(self, n=1): """Iterator that provides recruiters along with the participant count to be recruited for up to `n` participants. We use the `Recruitment` table in the db to keep track of how many recruitments have been requested using each recruiter. We'll use the fi...
Iterator that provides recruiters along with the participant count to be recruited for up to `n` participants. We use the `Recruitment` table in the db to keep track of how many recruitments have been requested using each recruiter. We'll use the first one from the specification that ...
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/recruiters.py#L845-L883
Dallinger/Dallinger
dallinger/recruiters.py
MultiRecruiter.open_recruitment
def open_recruitment(self, n=1): """Return initial experiment URL list. """ logger.info("Multi recruitment running for {} participants".format(n)) recruitments = [] messages = {} remaining = n for recruiter, count in self.recruiters(n): if not count: ...
python
def open_recruitment(self, n=1): """Return initial experiment URL list. """ logger.info("Multi recruitment running for {} participants".format(n)) recruitments = [] messages = {} remaining = n for recruiter, count in self.recruiters(n): if not count: ...
Return initial experiment URL list.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/recruiters.py#L885-L913
Dallinger/Dallinger
dallinger/heroku/clock.py
run_check
def run_check(participants, config, reference_time): """For each participant, if they've been active for longer than the experiment duration + 2 minutes, we take action. """ recruiters_with_late_participants = defaultdict(list) for p in participants: timeline = ParticipationTime(p, reference...
python
def run_check(participants, config, reference_time): """For each participant, if they've been active for longer than the experiment duration + 2 minutes, we take action. """ recruiters_with_late_participants = defaultdict(list) for p in participants: timeline = ParticipationTime(p, reference...
For each participant, if they've been active for longer than the experiment duration + 2 minutes, we take action.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/heroku/clock.py#L19-L35
Dallinger/Dallinger
dallinger/heroku/clock.py
check_db_for_missing_notifications
def check_db_for_missing_notifications(): """Check the database for missing notifications.""" config = dallinger.config.get_config() participants = Participant.query.filter_by(status="working").all() reference_time = datetime.now() run_check(participants, config, reference_time)
python
def check_db_for_missing_notifications(): """Check the database for missing notifications.""" config = dallinger.config.get_config() participants = Participant.query.filter_by(status="working").all() reference_time = datetime.now() run_check(participants, config, reference_time)
Check the database for missing notifications.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/heroku/clock.py#L39-L45
Dallinger/Dallinger
dallinger/heroku/rq_gevent_worker.py
GeventWorker._work
def _work(self, burst=False, logging_level=logging.INFO): """Starts the work loop. Pops and performs all jobs on the current list of queues. When all queues are empty, block and wait for new jobs to arrive on any of the queues, unless `burst` mode is enabled. The return value ...
python
def _work(self, burst=False, logging_level=logging.INFO): """Starts the work loop. Pops and performs all jobs on the current list of queues. When all queues are empty, block and wait for new jobs to arrive on any of the queues, unless `burst` mode is enabled. The return value ...
Starts the work loop. Pops and performs all jobs on the current list of queues. When all queues are empty, block and wait for new jobs to arrive on any of the queues, unless `burst` mode is enabled. The return value indicates whether any jobs were processed.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/heroku/rq_gevent_worker.py#L89-L146
Dallinger/Dallinger
dallinger/heroku/rq_gevent_worker.py
GeventWorker.work
def work(self, burst=False, logging_level=logging.INFO): """ Spawning a greenlet to be able to kill it when it's blocked dequeueing job :param burst: if it's burst worker don't need to spawn a greenlet """ # If the is a burst worker it's not needed to spawn greenlet if bu...
python
def work(self, burst=False, logging_level=logging.INFO): """ Spawning a greenlet to be able to kill it when it's blocked dequeueing job :param burst: if it's burst worker don't need to spawn a greenlet """ # If the is a burst worker it's not needed to spawn greenlet if bu...
Spawning a greenlet to be able to kill it when it's blocked dequeueing job :param burst: if it's burst worker don't need to spawn a greenlet
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/heroku/rq_gevent_worker.py#L148-L159
Dallinger/Dallinger
dallinger/registration.py
register
def register(dlgr_id, snapshot=None): """Register the experiment using configured services.""" try: config.get("osf_access_token") except KeyError: pass else: osf_id = _create_osf_project(dlgr_id) _upload_assets_to_OSF(dlgr_id, osf_id)
python
def register(dlgr_id, snapshot=None): """Register the experiment using configured services.""" try: config.get("osf_access_token") except KeyError: pass else: osf_id = _create_osf_project(dlgr_id) _upload_assets_to_OSF(dlgr_id, osf_id)
Register the experiment using configured services.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/registration.py#L15-L23
Dallinger/Dallinger
dallinger/registration.py
_create_osf_project
def _create_osf_project(dlgr_id, description=None): """Create a project on the OSF.""" if not description: description = "Experiment {} registered by Dallinger.".format(dlgr_id) r = requests.post( "{}/nodes/".format(root), data={ "type": "nodes", "category":...
python
def _create_osf_project(dlgr_id, description=None): """Create a project on the OSF.""" if not description: description = "Experiment {} registered by Dallinger.".format(dlgr_id) r = requests.post( "{}/nodes/".format(root), data={ "type": "nodes", "category":...
Create a project on the OSF.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/registration.py#L26-L47
Dallinger/Dallinger
dallinger/registration.py
_upload_assets_to_OSF
def _upload_assets_to_OSF(dlgr_id, osf_id, provider="osfstorage"): """Upload experimental assets to the OSF.""" root = "https://files.osf.io/v1" snapshot_filename = "{}-code.zip".format(dlgr_id) snapshot_path = os.path.join("snapshots", snapshot_filename) r = requests.put( "{}/resources/{}/p...
python
def _upload_assets_to_OSF(dlgr_id, osf_id, provider="osfstorage"): """Upload experimental assets to the OSF.""" root = "https://files.osf.io/v1" snapshot_filename = "{}-code.zip".format(dlgr_id) snapshot_path = os.path.join("snapshots", snapshot_filename) r = requests.put( "{}/resources/{}/p...
Upload experimental assets to the OSF.
https://github.com/Dallinger/Dallinger/blob/76ca8217c709989c116d0ebd8fca37bd22f591af/dallinger/registration.py#L50-L64
globus/globus-cli
globus_cli/commands/task/update.py
update_task
def update_task(deadline, label, task_id): """ Executor for `globus task update` """ client = get_client() task_doc = assemble_generic_doc("task", label=label, deadline=deadline) res = client.update_task(task_id, task_doc) formatted_print(res, simple_text="Success")
python
def update_task(deadline, label, task_id): """ Executor for `globus task update` """ client = get_client() task_doc = assemble_generic_doc("task", label=label, deadline=deadline) res = client.update_task(task_id, task_doc) formatted_print(res, simple_text="Success")
Executor for `globus task update`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/update.py#L17-L26
globus/globus-cli
globus_cli/commands/endpoint/role/show.py
role_show
def role_show(endpoint_id, role_id): """ Executor for `globus endpoint role show` """ client = get_client() role = client.get_endpoint_role(endpoint_id, role_id) formatted_print( role, text_format=FORMAT_TEXT_RECORD, fields=( ("Principal Type", "principal_typ...
python
def role_show(endpoint_id, role_id): """ Executor for `globus endpoint role show` """ client = get_client() role = client.get_endpoint_role(endpoint_id, role_id) formatted_print( role, text_format=FORMAT_TEXT_RECORD, fields=( ("Principal Type", "principal_typ...
Executor for `globus endpoint role show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/role/show.py#L17-L32
globus/globus-cli
globus_cli/safeio/get_option_vals.py
outformat_is_json
def outformat_is_json(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.outformat_is_json()
python
def outformat_is_json(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.outformat_is_json()
Only safe to call within a click context.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/get_option_vals.py#L6-L12
globus/globus-cli
globus_cli/safeio/get_option_vals.py
outformat_is_unix
def outformat_is_unix(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.outformat_is_unix()
python
def outformat_is_unix(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.outformat_is_unix()
Only safe to call within a click context.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/get_option_vals.py#L15-L21
globus/globus-cli
globus_cli/safeio/get_option_vals.py
outformat_is_text
def outformat_is_text(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.outformat_is_text()
python
def outformat_is_text(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.outformat_is_text()
Only safe to call within a click context.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/get_option_vals.py#L24-L30
globus/globus-cli
globus_cli/safeio/get_option_vals.py
get_jmespath_expression
def get_jmespath_expression(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.jmespath_expr
python
def get_jmespath_expression(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.jmespath_expr
Only safe to call within a click context.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/get_option_vals.py#L33-L39
globus/globus-cli
globus_cli/safeio/get_option_vals.py
verbosity
def verbosity(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.verbosity
python
def verbosity(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.verbosity
Only safe to call within a click context.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/get_option_vals.py#L42-L48
globus/globus-cli
globus_cli/safeio/get_option_vals.py
is_verbose
def is_verbose(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.is_verbose()
python
def is_verbose(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.is_verbose()
Only safe to call within a click context.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/get_option_vals.py#L51-L57
globus/globus-cli
globus_cli/commands/endpoint/server/show.py
server_show
def server_show(endpoint_id, server_id): """ Executor for `globus endpoint server show` """ client = get_client() server_doc = client.get_endpoint_server(endpoint_id, server_id) if not server_doc["uri"]: # GCP endpoint server fields = (("ID", "id"),) text_epilog = dedent( ...
python
def server_show(endpoint_id, server_id): """ Executor for `globus endpoint server show` """ client = get_client() server_doc = client.get_endpoint_server(endpoint_id, server_id) if not server_doc["uri"]: # GCP endpoint server fields = (("ID", "id"),) text_epilog = dedent( ...
Executor for `globus endpoint server show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/server/show.py#L14-L67
globus/globus-cli
globus_cli/commands/endpoint/role/create.py
role_create
def role_create(role, principal, endpoint_id): """ Executor for `globus endpoint role show` """ principal_type, principal_val = principal client = get_client() if principal_type == "identity": principal_val = maybe_lookup_identity_id(principal_val) if not principal_val: ...
python
def role_create(role, principal, endpoint_id): """ Executor for `globus endpoint role show` """ principal_type, principal_val = principal client = get_client() if principal_type == "identity": principal_val = maybe_lookup_identity_id(principal_val) if not principal_val: ...
Executor for `globus endpoint role show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/role/create.py#L26-L50
globus/globus-cli
globus_cli/commands/task/show.py
show_task
def show_task(successful_transfers, task_id): """ Executor for `globus task show` """ client = get_client() if successful_transfers: print_successful_transfers(client, task_id) else: print_task_detail(client, task_id)
python
def show_task(successful_transfers, task_id): """ Executor for `globus task show` """ client = get_client() if successful_transfers: print_successful_transfers(client, task_id) else: print_task_detail(client, task_id)
Executor for `globus task show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/show.py#L82-L91
globus/globus-cli
globus_cli/commands/bookmark/create.py
bookmark_create
def bookmark_create(endpoint_plus_path, bookmark_name): """ Executor for `globus bookmark create` """ endpoint_id, path = endpoint_plus_path client = get_client() submit_data = {"endpoint_id": str(endpoint_id), "path": path, "name": bookmark_name} res = client.create_bookmark(submit_data) ...
python
def bookmark_create(endpoint_plus_path, bookmark_name): """ Executor for `globus bookmark create` """ endpoint_id, path = endpoint_plus_path client = get_client() submit_data = {"endpoint_id": str(endpoint_id), "path": path, "name": bookmark_name} res = client.create_bookmark(submit_data) ...
Executor for `globus bookmark create`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/bookmark/create.py#L16-L26
globus/globus-cli
globus_cli/commands/endpoint/server/list.py
server_list
def server_list(endpoint_id): """ Executor for `globus endpoint server list` """ # raises usage error on shares for us endpoint, server_list = get_endpoint_w_server_list(endpoint_id) if server_list == "S3": # not GCS -- this is an S3 endpoint server_list = {"s3_url": endpoint["s3_url"]...
python
def server_list(endpoint_id): """ Executor for `globus endpoint server list` """ # raises usage error on shares for us endpoint, server_list = get_endpoint_w_server_list(endpoint_id) if server_list == "S3": # not GCS -- this is an S3 endpoint server_list = {"s3_url": endpoint["s3_url"]...
Executor for `globus endpoint server list`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/server/list.py#L11-L28
globus/globus-cli
globus_cli/commands/task/list.py
task_list
def task_list( limit, filter_task_id, filter_status, filter_type, filter_label, filter_not_label, inexact, filter_requested_after, filter_requested_before, filter_completed_after, filter_completed_before, ): """ Executor for `globus task-list` """ def _proces...
python
def task_list( limit, filter_task_id, filter_status, filter_type, filter_label, filter_not_label, inexact, filter_requested_after, filter_requested_before, filter_completed_after, filter_completed_before, ): """ Executor for `globus task-list` """ def _proces...
Executor for `globus task-list`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/list.py#L75-L143
globus/globus-cli
globus_cli/commands/delete.py
delete_command
def delete_command( batch, ignore_missing, star_silent, recursive, enable_globs, endpoint_plus_path, label, submission_id, dry_run, deadline, skip_activation_check, notify, ): """ Executor for `globus delete` """ endpoint_id, path = endpoint_plus_path ...
python
def delete_command( batch, ignore_missing, star_silent, recursive, enable_globs, endpoint_plus_path, label, submission_id, dry_run, deadline, skip_activation_check, notify, ): """ Executor for `globus delete` """ endpoint_id, path = endpoint_plus_path ...
Executor for `globus delete`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/delete.py#L35-L118
globus/globus-cli
globus_cli/commands/config/set.py
set_command
def set_command(value, parameter): """ Executor for `globus config set` """ conf = get_config_obj() section = "cli" if "." in parameter: section, parameter = parameter.split(".", 1) # ensure that the section exists if section not in conf: conf[section] = {} # set th...
python
def set_command(value, parameter): """ Executor for `globus config set` """ conf = get_config_obj() section = "cli" if "." in parameter: section, parameter = parameter.split(".", 1) # ensure that the section exists if section not in conf: conf[section] = {} # set th...
Executor for `globus config set`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/config/set.py#L12-L30
globus/globus-cli
globus_cli/parsing/process_stdin.py
shlex_process_stdin
def shlex_process_stdin(process_command, helptext): """ Use shlex to process stdin line-by-line. Also prints help text. Requires that @process_command be a Click command object, used for processing single lines of input. helptext is prepended to the standard message printed to interactive sessi...
python
def shlex_process_stdin(process_command, helptext): """ Use shlex to process stdin line-by-line. Also prints help text. Requires that @process_command be a Click command object, used for processing single lines of input. helptext is prepended to the standard message printed to interactive sessi...
Use shlex to process stdin line-by-line. Also prints help text. Requires that @process_command be a Click command object, used for processing single lines of input. helptext is prepended to the standard message printed to interactive sessions.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/process_stdin.py#L7-L40
globus/globus-cli
globus_cli/commands/endpoint/local_id.py
local_id
def local_id(personal): """ Executor for `globus endpoint local-id` """ if personal: try: ep_id = LocalGlobusConnectPersonal().endpoint_id except IOError as e: safeprint(e, write_to_stderr=True) click.get_current_context().exit(1) if ep_id is ...
python
def local_id(personal): """ Executor for `globus endpoint local-id` """ if personal: try: ep_id = LocalGlobusConnectPersonal().endpoint_id except IOError as e: safeprint(e, write_to_stderr=True) click.get_current_context().exit(1) if ep_id is ...
Executor for `globus endpoint local-id`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/local_id.py#L16-L31
globus/globus-cli
globus_cli/commands/endpoint/activate.py
endpoint_activate
def endpoint_activate( endpoint_id, myproxy, myproxy_username, myproxy_password, myproxy_lifetime, web, no_browser, delegate_proxy, proxy_lifetime, no_autoactivate, force, ): """ Executor for `globus endpoint activate` """ default_myproxy_username = lookup_opt...
python
def endpoint_activate( endpoint_id, myproxy, myproxy_username, myproxy_password, myproxy_lifetime, web, no_browser, delegate_proxy, proxy_lifetime, no_autoactivate, force, ): """ Executor for `globus endpoint activate` """ default_myproxy_username = lookup_opt...
Executor for `globus endpoint activate`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/activate.py#L142-L280
globus/globus-cli
globus_cli/parsing/custom_group.py
globus_group
def globus_group(*args, **kwargs): """ Wrapper over click.group which sets GlobusCommandGroup as the Class Caution! Don't get snake-bitten by this. `globus_group` is a decorator which MUST take arguments. It is not wrapped in our common detect-and-decorate pattern to allow it to be used bare --...
python
def globus_group(*args, **kwargs): """ Wrapper over click.group which sets GlobusCommandGroup as the Class Caution! Don't get snake-bitten by this. `globus_group` is a decorator which MUST take arguments. It is not wrapped in our common detect-and-decorate pattern to allow it to be used bare --...
Wrapper over click.group which sets GlobusCommandGroup as the Class Caution! Don't get snake-bitten by this. `globus_group` is a decorator which MUST take arguments. It is not wrapped in our common detect-and-decorate pattern to allow it to be used bare -- that wouldn't work (unnamed groups? weird ...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/custom_group.py#L32-L48
globus/globus-cli
globus_cli/helpers/version.py
_get_package_data
def _get_package_data(): """ Import a set of important packages and return relevant data about them in a dict. Imports are done in here to avoid potential for circular imports and other problems, and to make iteration simpler. """ moddata = [] modlist = ( "click", "config...
python
def _get_package_data(): """ Import a set of important packages and return relevant data about them in a dict. Imports are done in here to avoid potential for circular imports and other problems, and to make iteration simpler. """ moddata = [] modlist = ( "click", "config...
Import a set of important packages and return relevant data about them in a dict. Imports are done in here to avoid potential for circular imports and other problems, and to make iteration simpler.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/version.py#L9-L50
globus/globus-cli
globus_cli/helpers/version.py
print_version
def print_version(): """ Print out the current version, and at least try to fetch the latest from PyPi to print alongside it. It may seem odd that this isn't in globus_cli.version , but it's done this way to separate concerns over printing the version from looking it up. """ latest, current...
python
def print_version(): """ Print out the current version, and at least try to fetch the latest from PyPi to print alongside it. It may seem odd that this isn't in globus_cli.version , but it's done this way to separate concerns over printing the version from looking it up. """ latest, current...
Print out the current version, and at least try to fetch the latest from PyPi to print alongside it. It may seem odd that this isn't in globus_cli.version , but it's done this way to separate concerns over printing the version from looking it up.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/version.py#L53-L103
globus/globus-cli
globus_cli/commands/update.py
_call_pip
def _call_pip(*args): """ Invoke pip *safely* and in the *supported* way: https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program """ all_args = [sys.executable, "-m", "pip"] + list(args) print("> {}".format(" ".join(all_args))) subprocess.check_call(all_args)
python
def _call_pip(*args): """ Invoke pip *safely* and in the *supported* way: https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program """ all_args = [sys.executable, "-m", "pip"] + list(args) print("> {}".format(" ".join(all_args))) subprocess.check_call(all_args)
Invoke pip *safely* and in the *supported* way: https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/update.py#L18-L25
globus/globus-cli
globus_cli/commands/update.py
_check_pip_installed
def _check_pip_installed(): """ Invoke `pip --version` and make sure it doesn't error. Use check_output to capture stdout and stderr Invokes pip by the same manner that we plan to in _call_pip() Don't bother trying to reuse _call_pip to do this... Finnicky and not worth the effort. """ ...
python
def _check_pip_installed(): """ Invoke `pip --version` and make sure it doesn't error. Use check_output to capture stdout and stderr Invokes pip by the same manner that we plan to in _call_pip() Don't bother trying to reuse _call_pip to do this... Finnicky and not worth the effort. """ ...
Invoke `pip --version` and make sure it doesn't error. Use check_output to capture stdout and stderr Invokes pip by the same manner that we plan to in _call_pip() Don't bother trying to reuse _call_pip to do this... Finnicky and not worth the effort.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/update.py#L28-L44
globus/globus-cli
globus_cli/commands/update.py
update_command
def update_command(yes, development, development_version): """ Executor for `globus update` """ # enforce that pip MUST be installed # Why not just include it in the setup.py requirements? Mostly weak # reasons, but it shouldn't matter much. # - if someone has installed the CLI without pip, ...
python
def update_command(yes, development, development_version): """ Executor for `globus update` """ # enforce that pip MUST be installed # Why not just include it in the setup.py requirements? Mostly weak # reasons, but it shouldn't matter much. # - if someone has installed the CLI without pip, ...
Executor for `globus update`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/update.py#L55-L155
globus/globus-cli
globus_cli/commands/whoami.py
whoami_command
def whoami_command(linked_identities): """ Executor for `globus whoami` """ client = get_auth_client() # get userinfo from auth. # if we get back an error the user likely needs to log in again try: res = client.oauth2_userinfo() except AuthAPIError: safeprint( ...
python
def whoami_command(linked_identities): """ Executor for `globus whoami` """ client = get_auth_client() # get userinfo from auth. # if we get back an error the user likely needs to log in again try: res = client.oauth2_userinfo() except AuthAPIError: safeprint( ...
Executor for `globus whoami`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/whoami.py#L24-L83
globus/globus-cli
globus_cli/parsing/shell_completion.py
get_completion_context
def get_completion_context(args): """ Walk the tree of commands to a terminal command or multicommand, using the Click Context system. Effectively, we'll be using the resilient_parsing mode of commands to stop evaluation, then having them capture their options and arguments, passing us on to the...
python
def get_completion_context(args): """ Walk the tree of commands to a terminal command or multicommand, using the Click Context system. Effectively, we'll be using the resilient_parsing mode of commands to stop evaluation, then having them capture their options and arguments, passing us on to the...
Walk the tree of commands to a terminal command or multicommand, using the Click Context system. Effectively, we'll be using the resilient_parsing mode of commands to stop evaluation, then having them capture their options and arguments, passing us on to the next subcommand. If we walk "off the tree" wi...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shell_completion.py#L33-L78
globus/globus-cli
globus_cli/parsing/shell_completion.py
get_all_choices
def get_all_choices(completed_args, cur, quoted): """ This is the main completion function. Inputs: - completed_args: a list of already-completed arguments - cur: the current "word in progress" or None - quoted: is cur part of a quoted string? """ ctx = get_completion_context(completed_a...
python
def get_all_choices(completed_args, cur, quoted): """ This is the main completion function. Inputs: - completed_args: a list of already-completed arguments - cur: the current "word in progress" or None - quoted: is cur part of a quoted string? """ ctx = get_completion_context(completed_a...
This is the main completion function. Inputs: - completed_args: a list of already-completed arguments - cur: the current "word in progress" or None - quoted: is cur part of a quoted string?
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shell_completion.py#L81-L155
globus/globus-cli
globus_cli/commands/endpoint/is_activated.py
endpoint_is_activated
def endpoint_is_activated(endpoint_id, until, absolute_time): """ Executor for `globus endpoint is-activated` """ client = get_client() res = client.endpoint_get_activation_requirements(endpoint_id) def fail(deadline=None): exp_string = "" if deadline is not None: ex...
python
def endpoint_is_activated(endpoint_id, until, absolute_time): """ Executor for `globus endpoint is-activated` """ client = get_client() res = client.endpoint_get_activation_requirements(endpoint_id) def fail(deadline=None): exp_string = "" if deadline is not None: ex...
Executor for `globus endpoint is-activated`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/is_activated.py#L38-L76
globus/globus-cli
globus_cli/commands/endpoint/create.py
endpoint_create
def endpoint_create(**kwargs): """ Executor for `globus endpoint create` """ client = get_client() # get endpoint type, ensure unambiguous. personal = kwargs.pop("personal") server = kwargs.pop("server") shared = kwargs.pop("shared") if personal and (not server) and (not shared): ...
python
def endpoint_create(**kwargs): """ Executor for `globus endpoint create` """ client = get_client() # get endpoint type, ensure unambiguous. personal = kwargs.pop("personal") server = kwargs.pop("server") shared = kwargs.pop("shared") if personal and (not server) and (not shared): ...
Executor for `globus endpoint create`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/create.py#L56-L103
globus/globus-cli
globus_cli/commands/endpoint/server/update.py
server_update
def server_update( endpoint_id, server_id, subject, port, scheme, hostname, incoming_data_ports, outgoing_data_ports, ): """ Executor for `globus endpoint server update` """ client = get_client() server_doc = assemble_generic_doc( "server", subject=subject, p...
python
def server_update( endpoint_id, server_id, subject, port, scheme, hostname, incoming_data_ports, outgoing_data_ports, ): """ Executor for `globus endpoint server update` """ client = get_client() server_doc = assemble_generic_doc( "server", subject=subject, p...
Executor for `globus endpoint server update`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/server/update.py#L18-L51
globus/globus-cli
globus_cli/commands/config/filename.py
filename_command
def filename_command(): """ Executor for `globus config filename` """ try: config = get_config_obj(file_error=True) except IOError as e: safeprint(e, write_to_stderr=True) click.get_current_context().exit(1) else: safeprint(config.filename)
python
def filename_command(): """ Executor for `globus config filename` """ try: config = get_config_obj(file_error=True) except IOError as e: safeprint(e, write_to_stderr=True) click.get_current_context().exit(1) else: safeprint(config.filename)
Executor for `globus config filename`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/config/filename.py#L10-L20
globus/globus-cli
globus_cli/commands/endpoint/my_shared_endpoint_list.py
my_shared_endpoint_list
def my_shared_endpoint_list(endpoint_id): """ Executor for `globus endpoint my-shared-endpoint-list` """ client = get_client() ep_iterator = client.my_shared_endpoint_list(endpoint_id) formatted_print(ep_iterator, fields=ENDPOINT_LIST_FIELDS)
python
def my_shared_endpoint_list(endpoint_id): """ Executor for `globus endpoint my-shared-endpoint-list` """ client = get_client() ep_iterator = client.my_shared_endpoint_list(endpoint_id) formatted_print(ep_iterator, fields=ENDPOINT_LIST_FIELDS)
Executor for `globus endpoint my-shared-endpoint-list`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/my_shared_endpoint_list.py#L14-L21
globus/globus-cli
globus_cli/commands/get_identities.py
_try_b32_decode
def _try_b32_decode(v): """ Attempt to decode a b32-encoded username which is sometimes generated by internal Globus components. The expectation is that the string is a valid ID, username, or b32-encoded name. Therefore, we can do some simple checking on it. If it does not appear to be formatt...
python
def _try_b32_decode(v): """ Attempt to decode a b32-encoded username which is sometimes generated by internal Globus components. The expectation is that the string is a valid ID, username, or b32-encoded name. Therefore, we can do some simple checking on it. If it does not appear to be formatt...
Attempt to decode a b32-encoded username which is sometimes generated by internal Globus components. The expectation is that the string is a valid ID, username, or b32-encoded name. Therefore, we can do some simple checking on it. If it does not appear to be formatted correctly, return None.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/get_identities.py#L12-L43
globus/globus-cli
globus_cli/commands/get_identities.py
get_identities_command
def get_identities_command(values): """ Executor for `globus get-identities` """ client = get_auth_client() resolved_values = [_try_b32_decode(v) or v for v in values] # since API doesn't accept mixed ids and usernames, # split input values into separate lists ids = [] usernames = ...
python
def get_identities_command(values): """ Executor for `globus get-identities` """ client = get_auth_client() resolved_values = [_try_b32_decode(v) or v for v in values] # since API doesn't accept mixed ids and usernames, # split input values into separate lists ids = [] usernames = ...
Executor for `globus get-identities`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/get_identities.py#L55-L119
globus/globus-cli
globus_cli/services/transfer.py
supported_activation_methods
def supported_activation_methods(res): """ Given an activation_requirements document returns a list of activation methods supported by this endpoint. """ supported = ["web"] # web activation is always supported. # oauth if res["oauth_server"]: supported.append("oauth") for req...
python
def supported_activation_methods(res): """ Given an activation_requirements document returns a list of activation methods supported by this endpoint. """ supported = ["web"] # web activation is always supported. # oauth if res["oauth_server"]: supported.append("oauth") for req...
Given an activation_requirements document returns a list of activation methods supported by this endpoint.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/transfer.py#L159-L183
globus/globus-cli
globus_cli/services/transfer.py
activation_requirements_help_text
def activation_requirements_help_text(res, ep_id): """ Given an activation requirements document and an endpoint_id returns a string of help text for how to activate the endpoint """ methods = supported_activation_methods(res) lines = [ "This endpoint supports the following activation m...
python
def activation_requirements_help_text(res, ep_id): """ Given an activation requirements document and an endpoint_id returns a string of help text for how to activate the endpoint """ methods = supported_activation_methods(res) lines = [ "This endpoint supports the following activation m...
Given an activation requirements document and an endpoint_id returns a string of help text for how to activate the endpoint
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/transfer.py#L186-L231
globus/globus-cli
globus_cli/services/transfer.py
autoactivate
def autoactivate(client, endpoint_id, if_expires_in=None): """ Attempts to auto-activate the given endpoint with the given client If auto-activation fails, parses the returned activation requirements to determine which methods of activation are supported, then tells the user to use 'globus endpoint ...
python
def autoactivate(client, endpoint_id, if_expires_in=None): """ Attempts to auto-activate the given endpoint with the given client If auto-activation fails, parses the returned activation requirements to determine which methods of activation are supported, then tells the user to use 'globus endpoint ...
Attempts to auto-activate the given endpoint with the given client If auto-activation fails, parses the returned activation requirements to determine which methods of activation are supported, then tells the user to use 'globus endpoint activate' with the correct options(s)
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/transfer.py#L234-L258
globus/globus-cli
globus_cli/services/transfer.py
get_endpoint_w_server_list
def get_endpoint_w_server_list(endpoint_id): """ A helper for handling endpoint server list lookups correctly accounting for various endpoint types. - Raises click.UsageError when used on Shares - Returns (<get_endpoint_response>, "S3") for S3 endpoints - Returns (<get_endpoint_response>, <serv...
python
def get_endpoint_w_server_list(endpoint_id): """ A helper for handling endpoint server list lookups correctly accounting for various endpoint types. - Raises click.UsageError when used on Shares - Returns (<get_endpoint_response>, "S3") for S3 endpoints - Returns (<get_endpoint_response>, <serv...
A helper for handling endpoint server list lookups correctly accounting for various endpoint types. - Raises click.UsageError when used on Shares - Returns (<get_endpoint_response>, "S3") for S3 endpoints - Returns (<get_endpoint_response>, <server_list_response>) for all other Endpoints
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/transfer.py#L261-L294
globus/globus-cli
globus_cli/services/transfer.py
task_wait_with_io
def task_wait_with_io( meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code, client=None ): """ Options are the core "task wait" options, including the `--meow` easter egg. This does the core "task wait" loop, including all of the IO. It *does exit* on behalf of the caller. (W...
python
def task_wait_with_io( meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code, client=None ): """ Options are the core "task wait" options, including the `--meow` easter egg. This does the core "task wait" loop, including all of the IO. It *does exit* on behalf of the caller. (W...
Options are the core "task wait" options, including the `--meow` easter egg. This does the core "task wait" loop, including all of the IO. It *does exit* on behalf of the caller. (We can enhance with a `noabort=True` param or somesuch in the future if necessary.)
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/transfer.py#L297-L384
globus/globus-cli
globus_cli/services/transfer.py
RetryingTransferClient.retry
def retry(self, f, *args, **kwargs): """ Retries the given function self.tries times on NetworkErros """ backoff = random.random() / 100 # 5ms on average for _ in range(self.tries - 1): try: return f(*args, **kwargs) except NetworkError: ...
python
def retry(self, f, *args, **kwargs): """ Retries the given function self.tries times on NetworkErros """ backoff = random.random() / 100 # 5ms on average for _ in range(self.tries - 1): try: return f(*args, **kwargs) except NetworkError: ...
Retries the given function self.tries times on NetworkErros
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/transfer.py#L32-L43
globus/globus-cli
globus_cli/services/transfer.py
RetryingTransferClient.recursive_operation_ls
def recursive_operation_ls( self, endpoint_id, depth=3, filter_after_first=True, **params ): """ Makes recursive calls to ``GET /operation/endpoint/<endpoint_id>/ls`` Does not preserve access to top level operation_ls fields, but adds a "path" field for every item that repres...
python
def recursive_operation_ls( self, endpoint_id, depth=3, filter_after_first=True, **params ): """ Makes recursive calls to ``GET /operation/endpoint/<endpoint_id>/ls`` Does not preserve access to top level operation_ls fields, but adds a "path" field for every item that repres...
Makes recursive calls to ``GET /operation/endpoint/<endpoint_id>/ls`` Does not preserve access to top level operation_ls fields, but adds a "path" field for every item that represents the full path to that item. :rtype: iterable of :class:`GlobusResponse <globus_sdk.respo...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/transfer.py#L64-L103
globus/globus-cli
globus_cli/parsing/endpoint_plus_path.py
EndpointPlusPath.convert
def convert(self, value, param, ctx): """ ParamType.convert() is the actual processing method that takes a provided parameter and parses it. """ # passthrough conditions: None or already processed if value is None or isinstance(value, tuple): return value ...
python
def convert(self, value, param, ctx): """ ParamType.convert() is the actual processing method that takes a provided parameter and parses it. """ # passthrough conditions: None or already processed if value is None or isinstance(value, tuple): return value ...
ParamType.convert() is the actual processing method that takes a provided parameter and parses it.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/endpoint_plus_path.py#L39-L66
globus/globus-cli
globus_cli/commands/task/cancel.py
cancel_task
def cancel_task(all, task_id): """ Executor for `globus task cancel` """ if bool(all) + bool(task_id) != 1: raise click.UsageError( "You must pass EITHER the special --all flag " "to cancel all in-progress tasks OR a single " "task ID to cancel." ) ...
python
def cancel_task(all, task_id): """ Executor for `globus task cancel` """ if bool(all) + bool(task_id) != 1: raise click.UsageError( "You must pass EITHER the special --all flag " "to cancel all in-progress tasks OR a single " "task ID to cancel." ) ...
Executor for `globus task cancel`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/cancel.py#L16-L71
globus/globus-cli
globus_cli/commands/task/wait.py
task_wait
def task_wait(meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code): """ Executor for `globus task wait` """ task_wait_with_io( meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code )
python
def task_wait(meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code): """ Executor for `globus task wait` """ task_wait_with_io( meow, heartbeat, polling_interval, timeout, task_id, timeout_exit_code )
Executor for `globus task wait`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/task/wait.py#L15-L21
globus/globus-cli
globus_cli/parsing/one_use_option.py
one_use_option
def one_use_option(*args, **kwargs): """ Wrapper of the click.option decorator that replaces any instances of the Option class with the custom OneUseOption class """ # cannot force a multiple or count option to be single use if "multiple" in kwargs or "count" in kwargs: raise ValueError(...
python
def one_use_option(*args, **kwargs): """ Wrapper of the click.option decorator that replaces any instances of the Option class with the custom OneUseOption class """ # cannot force a multiple or count option to be single use if "multiple" in kwargs or "count" in kwargs: raise ValueError(...
Wrapper of the click.option decorator that replaces any instances of the Option class with the custom OneUseOption class
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/one_use_option.py#L43-L79
globus/globus-cli
globus_cli/commands/endpoint/server/delete.py
_spec_to_matches
def _spec_to_matches(server_list, server_spec, mode): """ mode is in {uri, hostname, hostname_port} A list of matching server docs. Should usually be 0 or 1 matches. Multiple matches are possible though. """ assert mode in ("uri", "hostname", "hostname_port") def match(server_doc): ...
python
def _spec_to_matches(server_list, server_spec, mode): """ mode is in {uri, hostname, hostname_port} A list of matching server docs. Should usually be 0 or 1 matches. Multiple matches are possible though. """ assert mode in ("uri", "hostname", "hostname_port") def match(server_doc): ...
mode is in {uri, hostname, hostname_port} A list of matching server docs. Should usually be 0 or 1 matches. Multiple matches are possible though.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/server/delete.py#L10-L33
globus/globus-cli
globus_cli/commands/endpoint/server/delete.py
server_delete
def server_delete(endpoint_id, server): """ Executor for `globus endpoint server show` """ client = get_client() mode = _detect_mode(server) # list (even if not necessary) in order to make errors more consistent when # mode='id' endpoint, server_list = get_endpoint_w_server_list(endpoi...
python
def server_delete(endpoint_id, server): """ Executor for `globus endpoint server show` """ client = get_client() mode = _detect_mode(server) # list (even if not necessary) in order to make errors more consistent when # mode='id' endpoint, server_list = get_endpoint_w_server_list(endpoi...
Executor for `globus endpoint server show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/server/delete.py#L64-L105
globus/globus-cli
globus_cli/commands/config/remove.py
remove_command
def remove_command(parameter): """ Executor for `globus config remove` """ conf = get_config_obj() section = "cli" if "." in parameter: section, parameter = parameter.split(".", 1) # ensure that the section exists if section not in conf: conf[section] = {} # remove ...
python
def remove_command(parameter): """ Executor for `globus config remove` """ conf = get_config_obj() section = "cli" if "." in parameter: section, parameter = parameter.split(".", 1) # ensure that the section exists if section not in conf: conf[section] = {} # remove ...
Executor for `globus config remove`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/config/remove.py#L11-L29
globus/globus-cli
globus_cli/commands/endpoint/permission/show.py
show_command
def show_command(endpoint_id, rule_id): """ Executor for `globus endpoint permission show` """ client = get_client() rule = client.get_endpoint_acl_rule(endpoint_id, rule_id) formatted_print( rule, text_format=FORMAT_TEXT_RECORD, fields=( ("Rule ID", "id"), ...
python
def show_command(endpoint_id, rule_id): """ Executor for `globus endpoint permission show` """ client = get_client() rule = client.get_endpoint_acl_rule(endpoint_id, rule_id) formatted_print( rule, text_format=FORMAT_TEXT_RECORD, fields=( ("Rule ID", "id"), ...
Executor for `globus endpoint permission show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/permission/show.py#L22-L38
globus/globus-cli
globus_cli/commands/bookmark/rename.py
bookmark_rename
def bookmark_rename(bookmark_id_or_name, new_bookmark_name): """ Executor for `globus bookmark rename` """ client = get_client() bookmark_id = resolve_id_or_name(client, bookmark_id_or_name)["id"] submit_data = {"name": new_bookmark_name} res = client.update_bookmark(bookmark_id, submit_da...
python
def bookmark_rename(bookmark_id_or_name, new_bookmark_name): """ Executor for `globus bookmark rename` """ client = get_client() bookmark_id = resolve_id_or_name(client, bookmark_id_or_name)["id"] submit_data = {"name": new_bookmark_name} res = client.update_bookmark(bookmark_id, submit_da...
Executor for `globus bookmark rename`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/bookmark/rename.py#L13-L23
globus/globus-cli
globus_cli/commands/config/show.py
show_command
def show_command(parameter): """ Executor for `globus config show` """ section = "cli" if "." in parameter: section, parameter = parameter.split(".", 1) value = lookup_option(parameter, section=section) if value is None: safeprint("{} not set".format(parameter)) else: ...
python
def show_command(parameter): """ Executor for `globus config show` """ section = "cli" if "." in parameter: section, parameter = parameter.split(".", 1) value = lookup_option(parameter, section=section) if value is None: safeprint("{} not set".format(parameter)) else: ...
Executor for `globus config show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/config/show.py#L11-L24
globus/globus-cli
globus_cli/commands/rename.py
rename_command
def rename_command(source, destination): """ Executor for `globus rename` """ source_ep, source_path = source dest_ep, dest_path = destination if source_ep != dest_ep: raise click.UsageError( ( "rename requires that the source and dest " "endp...
python
def rename_command(source, destination): """ Executor for `globus rename` """ source_ep, source_path = source dest_ep, dest_path = destination if source_ep != dest_ep: raise click.UsageError( ( "rename requires that the source and dest " "endp...
Executor for `globus rename`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/rename.py#L14-L34
globus/globus-cli
globus_cli/commands/endpoint/show.py
endpoint_show
def endpoint_show(endpoint_id): """ Executor for `globus endpoint show` """ client = get_client() res = client.get_endpoint(endpoint_id) formatted_print( res, text_format=FORMAT_TEXT_RECORD, fields=GCP_FIELDS if res["is_globus_connect"] else STANDARD_FIELDS, )
python
def endpoint_show(endpoint_id): """ Executor for `globus endpoint show` """ client = get_client() res = client.get_endpoint(endpoint_id) formatted_print( res, text_format=FORMAT_TEXT_RECORD, fields=GCP_FIELDS if res["is_globus_connect"] else STANDARD_FIELDS, )
Executor for `globus endpoint show`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/show.py#L11-L23
globus/globus-cli
globus_cli/commands/endpoint/permission/update.py
update_command
def update_command(permissions, rule_id, endpoint_id): """ Executor for `globus endpoint permission update` """ client = get_client() rule_data = assemble_generic_doc("access", permissions=permissions) res = client.update_endpoint_acl_rule(endpoint_id, rule_id, rule_data) formatted_print(re...
python
def update_command(permissions, rule_id, endpoint_id): """ Executor for `globus endpoint permission update` """ client = get_client() rule_data = assemble_generic_doc("access", permissions=permissions) res = client.update_endpoint_acl_rule(endpoint_id, rule_id, rule_data) formatted_print(re...
Executor for `globus endpoint permission update`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/permission/update.py#L21-L29
globus/globus-cli
globus_cli/safeio/errors.py
PrintableErrorField._format_value
def _format_value(self, val): """ formats a value to be good for textmode printing val must be unicode """ name = self.name + ":" if not self.multiline or "\n" not in val: val = u"{0} {1}".format(name.ljust(self._text_prefix_len), val) else: ...
python
def _format_value(self, val): """ formats a value to be good for textmode printing val must be unicode """ name = self.name + ":" if not self.multiline or "\n" not in val: val = u"{0} {1}".format(name.ljust(self._text_prefix_len), val) else: ...
formats a value to be good for textmode printing val must be unicode
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/errors.py#L27-L39
globus/globus-cli
globus_cli/commands/endpoint/permission/delete.py
delete_command
def delete_command(endpoint_id, rule_id): """ Executor for `globus endpoint permission delete` """ client = get_client() res = client.delete_endpoint_acl_rule(endpoint_id, rule_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
python
def delete_command(endpoint_id, rule_id): """ Executor for `globus endpoint permission delete` """ client = get_client() res = client.delete_endpoint_acl_rule(endpoint_id, rule_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
Executor for `globus endpoint permission delete`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/permission/delete.py#L14-L21
globus/globus-cli
globus_cli/commands/transfer.py
transfer_command
def transfer_command( batch, sync_level, recursive, destination, source, label, preserve_mtime, verify_checksum, encrypt, submission_id, dry_run, delete, deadline, skip_activation_check, notify, perf_cc, perf_p, perf_pp, perf_udt, ): """ ...
python
def transfer_command( batch, sync_level, recursive, destination, source, label, preserve_mtime, verify_checksum, encrypt, submission_id, dry_run, delete, deadline, skip_activation_check, notify, perf_cc, perf_p, perf_pp, perf_udt, ): """ ...
Executor for `globus transfer`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/transfer.py#L143-L268
globus/globus-cli
globus_cli/commands/endpoint/delete.py
endpoint_delete
def endpoint_delete(endpoint_id): """ Executor for `globus endpoint delete` """ client = get_client() res = client.delete_endpoint(endpoint_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
python
def endpoint_delete(endpoint_id): """ Executor for `globus endpoint delete` """ client = get_client() res = client.delete_endpoint(endpoint_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
Executor for `globus endpoint delete`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/delete.py#L11-L17
globus/globus-cli
globus_cli/commands/bookmark/delete.py
bookmark_delete
def bookmark_delete(bookmark_id_or_name): """ Executor for `globus bookmark delete` """ client = get_client() bookmark_id = resolve_id_or_name(client, bookmark_id_or_name)["id"] res = client.delete_bookmark(bookmark_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message...
python
def bookmark_delete(bookmark_id_or_name): """ Executor for `globus bookmark delete` """ client = get_client() bookmark_id = resolve_id_or_name(client, bookmark_id_or_name)["id"] res = client.delete_bookmark(bookmark_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message...
Executor for `globus bookmark delete`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/bookmark/delete.py#L12-L20
globus/globus-cli
globus_cli/commands/mkdir.py
mkdir_command
def mkdir_command(endpoint_plus_path): """ Executor for `globus mkdir` """ endpoint_id, path = endpoint_plus_path client = get_client() autoactivate(client, endpoint_id, if_expires_in=60) res = client.operation_mkdir(endpoint_id, path=path) formatted_print(res, text_format=FORMAT_TEXT_...
python
def mkdir_command(endpoint_plus_path): """ Executor for `globus mkdir` """ endpoint_id, path = endpoint_plus_path client = get_client() autoactivate(client, endpoint_id, if_expires_in=60) res = client.operation_mkdir(endpoint_id, path=path) formatted_print(res, text_format=FORMAT_TEXT_...
Executor for `globus mkdir`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/mkdir.py#L15-L25
globus/globus-cli
globus_cli/commands/config/init.py
init_command
def init_command(default_output_format, default_myproxy_username): """ Executor for `globus config init` """ # now handle the output format, requires a little bit more care # first, prompt if it isn't given, but be clear that we have a sensible # default if they don't set it # then, make sur...
python
def init_command(default_output_format, default_myproxy_username): """ Executor for `globus config init` """ # now handle the output format, requires a little bit more care # first, prompt if it isn't given, but be clear that we have a sensible # default if they don't set it # then, make sur...
Executor for `globus config init`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/config/init.py#L43-L83
globus/globus-cli
globus_cli/parsing/detect_and_decorate.py
detect_and_decorate
def detect_and_decorate(decorator, args, kwargs): """ Helper for applying a decorator when it is applied directly, and also applying it when it is given arguments and then applied to a function. """ # special behavior when invoked with only one non-keyword argument: act as # a normal decorator, ...
python
def detect_and_decorate(decorator, args, kwargs): """ Helper for applying a decorator when it is applied directly, and also applying it when it is given arguments and then applied to a function. """ # special behavior when invoked with only one non-keyword argument: act as # a normal decorator, ...
Helper for applying a decorator when it is applied directly, and also applying it when it is given arguments and then applied to a function.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/detect_and_decorate.py#L1-L27
globus/globus-cli
globus_cli/commands/endpoint/permission/list.py
list_command
def list_command(endpoint_id): """ Executor for `globus endpoint permission list` """ client = get_client() rules = client.endpoint_acl_list(endpoint_id) resolved_ids = LazyIdentityMap( x["principal"] for x in rules if x["principal_type"] == "identity" ) def principal_str(rule...
python
def list_command(endpoint_id): """ Executor for `globus endpoint permission list` """ client = get_client() rules = client.endpoint_acl_list(endpoint_id) resolved_ids = LazyIdentityMap( x["principal"] for x in rules if x["principal_type"] == "identity" ) def principal_str(rule...
Executor for `globus endpoint permission list`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/permission/list.py#L12-L44
globus/globus-cli
globus_cli/commands/bookmark/list.py
bookmark_list
def bookmark_list(): """ Executor for `globus bookmark list` """ client = get_client() bookmark_iterator = client.bookmark_list() def get_ep_name(item): ep_id = item["endpoint_id"] try: ep_doc = client.get_endpoint(ep_id) return display_name_or_cname(ep_...
python
def bookmark_list(): """ Executor for `globus bookmark list` """ client = get_client() bookmark_iterator = client.bookmark_list() def get_ep_name(item): ep_id = item["endpoint_id"] try: ep_doc = client.get_endpoint(ep_id) return display_name_or_cname(ep_...
Executor for `globus bookmark list`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/bookmark/list.py#L15-L45
globus/globus-cli
globus_cli/commands/rm.py
rm_command
def rm_command( ignore_missing, star_silent, recursive, enable_globs, endpoint_plus_path, label, submission_id, dry_run, deadline, skip_activation_check, notify, meow, heartbeat, polling_interval, timeout, timeout_exit_code, ): """ Executor for `gl...
python
def rm_command( ignore_missing, star_silent, recursive, enable_globs, endpoint_plus_path, label, submission_id, dry_run, deadline, skip_activation_check, notify, meow, heartbeat, polling_interval, timeout, timeout_exit_code, ): """ Executor for `gl...
Executor for `globus rm`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/rm.py#L38-L118
globus/globus-cli
globus_cli/helpers/auth_flows.py
do_link_auth_flow
def do_link_auth_flow(session_params=None, force_new_client=False): """ Prompts the user with a link to authenticate with globus auth and authorize the CLI to act on their behalf. """ session_params = session_params or {} # get the ConfidentialApp client object auth_client = internal_auth_c...
python
def do_link_auth_flow(session_params=None, force_new_client=False): """ Prompts the user with a link to authenticate with globus auth and authorize the CLI to act on their behalf. """ session_params = session_params or {} # get the ConfidentialApp client object auth_client = internal_auth_c...
Prompts the user with a link to authenticate with globus auth and authorize the CLI to act on their behalf.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/auth_flows.py#L26-L62
globus/globus-cli
globus_cli/helpers/auth_flows.py
do_local_server_auth_flow
def do_local_server_auth_flow(session_params=None, force_new_client=False): """ Starts a local http server, opens a browser to have the user authenticate, and gets the code redirected to the server (no copy and pasting required) """ session_params = session_params or {} # start local server and...
python
def do_local_server_auth_flow(session_params=None, force_new_client=False): """ Starts a local http server, opens a browser to have the user authenticate, and gets the code redirected to the server (no copy and pasting required) """ session_params = session_params or {} # start local server and...
Starts a local http server, opens a browser to have the user authenticate, and gets the code redirected to the server (no copy and pasting required)
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/auth_flows.py#L65-L104
globus/globus-cli
globus_cli/helpers/auth_flows.py
exchange_code_and_store_config
def exchange_code_and_store_config(auth_client, auth_code): """ Finishes auth flow after code is gotten from command line or local server. Exchanges code for tokens and gets user info from auth. Stores tokens and user info in config. """ # do a token exchange with the given code tkn = auth_c...
python
def exchange_code_and_store_config(auth_client, auth_code): """ Finishes auth flow after code is gotten from command line or local server. Exchanges code for tokens and gets user info from auth. Stores tokens and user info in config. """ # do a token exchange with the given code tkn = auth_c...
Finishes auth flow after code is gotten from command line or local server. Exchanges code for tokens and gets user info from auth. Stores tokens and user info in config.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/helpers/auth_flows.py#L107-L142
globus/globus-cli
globus_cli/commands/endpoint/search.py
endpoint_search
def endpoint_search(filter_fulltext, filter_owner_id, filter_scope): """ Executor for `globus endpoint search` """ if filter_scope == "all" and not filter_fulltext: raise click.UsageError( "When searching all endpoints (--filter-scope=all, the default), " "a full-text sea...
python
def endpoint_search(filter_fulltext, filter_owner_id, filter_scope): """ Executor for `globus endpoint search` """ if filter_scope == "all" and not filter_fulltext: raise click.UsageError( "When searching all endpoints (--filter-scope=all, the default), " "a full-text sea...
Executor for `globus endpoint search`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/search.py#L42-L70
globus/globus-cli
globus_cli/commands/endpoint/update.py
endpoint_update
def endpoint_update(**kwargs): """ Executor for `globus endpoint update` """ # validate params. Requires a get call to check the endpoint type client = get_client() endpoint_id = kwargs.pop("endpoint_id") get_res = client.get_endpoint(endpoint_id) if get_res["host_endpoint_id"]: ...
python
def endpoint_update(**kwargs): """ Executor for `globus endpoint update` """ # validate params. Requires a get call to check the endpoint type client = get_client() endpoint_id = kwargs.pop("endpoint_id") get_res = client.get_endpoint(endpoint_id) if get_res["host_endpoint_id"]: ...
Executor for `globus endpoint update`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/update.py#L17-L41
globus/globus-cli
globus_cli/safeio/write.py
safeprint
def safeprint(message, write_to_stderr=False, newline=True): """ Wrapper around click.echo used to encapsulate its functionality. Also protects against EPIPE during click.echo calls, as this can happen normally in piped commands when the consumer closes before the producer. """ try: clic...
python
def safeprint(message, write_to_stderr=False, newline=True): """ Wrapper around click.echo used to encapsulate its functionality. Also protects against EPIPE during click.echo calls, as this can happen normally in piped commands when the consumer closes before the producer. """ try: clic...
Wrapper around click.echo used to encapsulate its functionality. Also protects against EPIPE during click.echo calls, as this can happen normally in piped commands when the consumer closes before the producer.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/write.py#L12-L24
globus/globus-cli
globus_cli/safeio/output_formatter.py
_key_to_keyfunc
def _key_to_keyfunc(k): """ We allow for 'keys' which are functions that map columns onto value types -- they may do formatting or inspect multiple values on the object. In order to support this, wrap string keys in a simple function that does the natural lookup operation, but return any functions w...
python
def _key_to_keyfunc(k): """ We allow for 'keys' which are functions that map columns onto value types -- they may do formatting or inspect multiple values on the object. In order to support this, wrap string keys in a simple function that does the natural lookup operation, but return any functions w...
We allow for 'keys' which are functions that map columns onto value types -- they may do formatting or inspect multiple values on the object. In order to support this, wrap string keys in a simple function that does the natural lookup operation, but return any functions we receive as they are.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/output_formatter.py#L40-L58
globus/globus-cli
globus_cli/safeio/output_formatter.py
formatted_print
def formatted_print( response_data, simple_text=None, text_preamble=None, text_epilog=None, text_format=FORMAT_TEXT_TABLE, json_converter=None, fields=None, response_key=None, ): """ A generic output formatter. Consumes the following pieces of data: ``response_data`` is a di...
python
def formatted_print( response_data, simple_text=None, text_preamble=None, text_epilog=None, text_format=FORMAT_TEXT_TABLE, json_converter=None, fields=None, response_key=None, ): """ A generic output formatter. Consumes the following pieces of data: ``response_data`` is a di...
A generic output formatter. Consumes the following pieces of data: ``response_data`` is a dict or GlobusResponse object. It contains either an API response or synthesized data for printing. ``simple_text`` is a text override -- normal printing is skipped and this string is printed instead (text output...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/safeio/output_formatter.py#L158-L259
globus/globus-cli
globus_cli/parsing/shared_options.py
common_options
def common_options(*args, **kwargs): """ This is a multi-purpose decorator for applying a "base" set of options shared by all commands. It can be applied either directly, or given keyword arguments. Usage: >>> @common_options >>> def mycommand(abc, xyz): >>> ... or >>> @c...
python
def common_options(*args, **kwargs): """ This is a multi-purpose decorator for applying a "base" set of options shared by all commands. It can be applied either directly, or given keyword arguments. Usage: >>> @common_options >>> def mycommand(abc, xyz): >>> ... or >>> @c...
This is a multi-purpose decorator for applying a "base" set of options shared by all commands. It can be applied either directly, or given keyword arguments. Usage: >>> @common_options >>> def mycommand(abc, xyz): >>> ... or >>> @common_options(no_format_option=True) >>> def ...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shared_options.py#L18-L57
globus/globus-cli
globus_cli/parsing/shared_options.py
endpoint_id_arg
def endpoint_id_arg(*args, **kwargs): """ This is the `ENDPOINT_ID` argument consumed by many Transfer endpoint related operations. It accepts alternate metavars for cases when another name is desirable (e.x. `SHARE_ID`, `HOST_ENDPOINT_ID`), but can also be applied as a direct decorator if no specia...
python
def endpoint_id_arg(*args, **kwargs): """ This is the `ENDPOINT_ID` argument consumed by many Transfer endpoint related operations. It accepts alternate metavars for cases when another name is desirable (e.x. `SHARE_ID`, `HOST_ENDPOINT_ID`), but can also be applied as a direct decorator if no specia...
This is the `ENDPOINT_ID` argument consumed by many Transfer endpoint related operations. It accepts alternate metavars for cases when another name is desirable (e.x. `SHARE_ID`, `HOST_ENDPOINT_ID`), but can also be applied as a direct decorator if no specialized metavar is being passed. Usage: >>...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shared_options.py#L60-L89
globus/globus-cli
globus_cli/parsing/shared_options.py
endpoint_create_and_update_params
def endpoint_create_and_update_params(*args, **kwargs): """ Collection of options consumed by Transfer endpoint create and update operations -- accepts toggle regarding create vs. update that makes display_name required vs. optional. Usage: >>> @endpoint_create_and_update_params(create=True) ...
python
def endpoint_create_and_update_params(*args, **kwargs): """ Collection of options consumed by Transfer endpoint create and update operations -- accepts toggle regarding create vs. update that makes display_name required vs. optional. Usage: >>> @endpoint_create_and_update_params(create=True) ...
Collection of options consumed by Transfer endpoint create and update operations -- accepts toggle regarding create vs. update that makes display_name required vs. optional. Usage: >>> @endpoint_create_and_update_params(create=True) >>> def command_func(display_name, description, info_link, contac...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shared_options.py#L92-L293
globus/globus-cli
globus_cli/parsing/shared_options.py
validate_endpoint_create_and_update_params
def validate_endpoint_create_and_update_params(endpoint_type, managed, params): """ Given an endpoint type of "shared" "server" or "personal" and option values Confirms the option values are valid for the given endpoint """ # options only allowed for GCS endpoints if endpoint_type != "server": ...
python
def validate_endpoint_create_and_update_params(endpoint_type, managed, params): """ Given an endpoint type of "shared" "server" or "personal" and option values Confirms the option values are valid for the given endpoint """ # options only allowed for GCS endpoints if endpoint_type != "server": ...
Given an endpoint type of "shared" "server" or "personal" and option values Confirms the option values are valid for the given endpoint
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shared_options.py#L296-L400
globus/globus-cli
globus_cli/parsing/shared_options.py
task_id_arg
def task_id_arg(*args, **kwargs): """ This is the `TASK_ID` argument consumed by many Transfer Task operations. It accept a toggle on whether or not it is required Usage: >>> @task_id_option >>> def command_func(task_id): >>> ... or >>> @task_id_option(required=False) >>>...
python
def task_id_arg(*args, **kwargs): """ This is the `TASK_ID` argument consumed by many Transfer Task operations. It accept a toggle on whether or not it is required Usage: >>> @task_id_option >>> def command_func(task_id): >>> ... or >>> @task_id_option(required=False) >>>...
This is the `TASK_ID` argument consumed by many Transfer Task operations. It accept a toggle on whether or not it is required Usage: >>> @task_id_option >>> def command_func(task_id): >>> ... or >>> @task_id_option(required=False) >>> def command_func(task_id): >>> ... ...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shared_options.py#L403-L428
globus/globus-cli
globus_cli/parsing/shared_options.py
task_submission_options
def task_submission_options(f): """ Options shared by both transfer and delete task submission """ def notify_opt_callback(ctx, param, value): """ Parse --notify - "" is the same as "off" - parse by lowercase, comma-split, strip spaces - "off,x" is invalid for an...
python
def task_submission_options(f): """ Options shared by both transfer and delete task submission """ def notify_opt_callback(ctx, param, value): """ Parse --notify - "" is the same as "off" - parse by lowercase, comma-split, strip spaces - "off,x" is invalid for an...
Options shared by both transfer and delete task submission
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shared_options.py#L431-L531
globus/globus-cli
globus_cli/parsing/shared_options.py
delete_and_rm_options
def delete_and_rm_options(*args, **kwargs): """ Options which apply both to `globus delete` and `globus rm` """ def inner_decorator(f, supports_batch=True, default_enable_globs=False): f = click.option( "--recursive", "-r", is_flag=True, help="Recursively delete dirs" )(f) ...
python
def delete_and_rm_options(*args, **kwargs): """ Options which apply both to `globus delete` and `globus rm` """ def inner_decorator(f, supports_batch=True, default_enable_globs=False): f = click.option( "--recursive", "-r", is_flag=True, help="Recursively delete dirs" )(f) ...
Options which apply both to `globus delete` and `globus rm`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shared_options.py#L534-L583
globus/globus-cli
globus_cli/parsing/shared_options.py
server_add_and_update_opts
def server_add_and_update_opts(*args, **kwargs): """ shared collection of options for `globus transfer endpoint server add` and `globus transfer endpoint server update`. Accepts a toggle to know if it's being used as `add` or `update`. usage: >>> @server_add_and_update_opts >>> def command...
python
def server_add_and_update_opts(*args, **kwargs): """ shared collection of options for `globus transfer endpoint server add` and `globus transfer endpoint server update`. Accepts a toggle to know if it's being used as `add` or `update`. usage: >>> @server_add_and_update_opts >>> def command...
shared collection of options for `globus transfer endpoint server add` and `globus transfer endpoint server update`. Accepts a toggle to know if it's being used as `add` or `update`. usage: >>> @server_add_and_update_opts >>> def command_func(subject, port, scheme, hostname): >>> ... ...
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/shared_options.py#L664-L753
globus/globus-cli
globus_cli/commands/endpoint/deactivate.py
endpoint_deactivate
def endpoint_deactivate(endpoint_id): """ Executor for `globus endpoint deactivate` """ client = get_client() res = client.endpoint_deactivate(endpoint_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
python
def endpoint_deactivate(endpoint_id): """ Executor for `globus endpoint deactivate` """ client = get_client() res = client.endpoint_deactivate(endpoint_id) formatted_print(res, text_format=FORMAT_TEXT_RAW, response_key="message")
Executor for `globus endpoint deactivate`
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/commands/endpoint/deactivate.py#L11-L17
globus/globus-cli
globus_cli/parsing/version_option.py
version_option
def version_option(f): """ Largely a custom clone of click.version_option -- almost identical, but prints our special output. """ def callback(ctx, param, value): # copied from click.decorators.version_option # no idea what resilient_parsing means, but... if not value or ctx...
python
def version_option(f): """ Largely a custom clone of click.version_option -- almost identical, but prints our special output. """ def callback(ctx, param, value): # copied from click.decorators.version_option # no idea what resilient_parsing means, but... if not value or ctx...
Largely a custom clone of click.version_option -- almost identical, but prints our special output.
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/parsing/version_option.py#L7-L29
globus/globus-cli
globus_cli/version.py
get_versions
def get_versions(): """ Wrap in a function to ensure that we don't run this every time a CLI command runs (yuck!) Also protects import of `requests` from issues when grabbed by setuptools. More on that inline """ # import in the func (rather than top-level scope) so that at setup time, ...
python
def get_versions(): """ Wrap in a function to ensure that we don't run this every time a CLI command runs (yuck!) Also protects import of `requests` from issues when grabbed by setuptools. More on that inline """ # import in the func (rather than top-level scope) so that at setup time, ...
Wrap in a function to ensure that we don't run this every time a CLI command runs (yuck!) Also protects import of `requests` from issues when grabbed by setuptools. More on that inline
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/version.py#L12-L33
globus/globus-cli
globus_cli/services/auth.py
LazyIdentityMap._lookup_identity_names
def _lookup_identity_names(self): """ Batch resolve identities to usernames. Returns a dict mapping IDs to Usernames """ id_batch_size = 100 # fetch in batches of 100, store in a dict ac = get_auth_client() self._resolved_map = {} for i in range(0...
python
def _lookup_identity_names(self): """ Batch resolve identities to usernames. Returns a dict mapping IDs to Usernames """ id_batch_size = 100 # fetch in batches of 100, store in a dict ac = get_auth_client() self._resolved_map = {} for i in range(0...
Batch resolve identities to usernames. Returns a dict mapping IDs to Usernames
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/auth.py#L96-L110