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_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
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():...
[ "def", "_create_mturk_qualifications", "(", "self", ")", ":", "for", "name", ",", "desc", "in", "self", ".", "qualifications", ".", "items", "(", ")", ":", "try", ":", "self", ".", "mturkservice", ".", "create_qualification_type", "(", "name", ",", "desc", ...
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.
[ "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", ...
train
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), ...
[ "def", "open_recruitment", "(", "self", ",", "n", "=", "1", ")", ":", "logger", ".", "info", "(", "\"Opening Bot recruitment for {} participants\"", ".", "format", "(", "n", ")", ")", "factory", "=", "self", ".", "_get_bot_factory", "(", ")", "bot_class_name",...
Start recruiting right away.
[ "Start", "recruiting", "right", "away", "." ]
train
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...
[ "def", "recruit", "(", "self", ",", "n", "=", "1", ")", ":", "logger", ".", "info", "(", "\"Recruiting {} Bot participants\"", ".", "format", "(", "n", ")", ")", "factory", "=", "self", ".", "_get_bot_factory", "(", ")", "urls", "=", "[", "]", "q", "...
Recruit n new participant bots to the queue
[ "Recruit", "n", "new", "participant", "bots", "to", "the", "queue" ]
train
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()
[ "def", "notify_duration_exceeded", "(", "self", ",", "participants", ",", "reference_time", ")", ":", "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.
[ "The", "bot", "participant", "has", "been", "working", "longer", "than", "the", "time", "defined", "in", "the", "duration", "config", "value", "." ]
train
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...
[ "def", "parse_spec", "(", "self", ")", ":", "recruiters", "=", "[", "]", "spec", "=", "get_config", "(", ")", ".", "get", "(", "\"recruiters\"", ")", "for", "match", "in", "self", ".", "SPEC_RE", ".", "finditer", "(", "spec", ")", ":", "name", "=", ...
Parse the specification of how to recruit participants. Example: recruiters = bots: 5, mturk: 1
[ "Parse", "the", "specification", "of", "how", "to", "recruit", "participants", "." ]
train
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...
[ "def", "recruiters", "(", "self", ",", "n", "=", "1", ")", ":", "recruit_count", "=", "0", "while", "recruit_count", "<=", "n", ":", "counts", "=", "dict", "(", "session", ".", "query", "(", "Recruitment", ".", "recruiter_id", ",", "func", ".", "count"...
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 ...
[ "Iterator", "that", "provides", "recruiters", "along", "with", "the", "participant", "count", "to", "be", "recruited", "for", "up", "to", "n", "participants", "." ]
train
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: ...
[ "def", "open_recruitment", "(", "self", ",", "n", "=", "1", ")", ":", "logger", ".", "info", "(", "\"Multi recruitment running for {} participants\"", ".", "format", "(", "n", ")", ")", "recruitments", "=", "[", "]", "messages", "=", "{", "}", "remaining", ...
Return initial experiment URL list.
[ "Return", "initial", "experiment", "URL", "list", "." ]
train
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...
[ "def", "run_check", "(", "participants", ",", "config", ",", "reference_time", ")", ":", "recruiters_with_late_participants", "=", "defaultdict", "(", "list", ")", "for", "p", "in", "participants", ":", "timeline", "=", "ParticipationTime", "(", "p", ",", "refer...
For each participant, if they've been active for longer than the experiment duration + 2 minutes, we take action.
[ "For", "each", "participant", "if", "they", "ve", "been", "active", "for", "longer", "than", "the", "experiment", "duration", "+", "2", "minutes", "we", "take", "action", "." ]
train
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)
[ "def", "check_db_for_missing_notifications", "(", ")", ":", "config", "=", "dallinger", ".", "config", ".", "get_config", "(", ")", "participants", "=", "Participant", ".", "query", ".", "filter_by", "(", "status", "=", "\"working\"", ")", ".", "all", "(", "...
Check the database for missing notifications.
[ "Check", "the", "database", "for", "missing", "notifications", "." ]
train
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 ...
[ "def", "_work", "(", "self", ",", "burst", "=", "False", ",", "logging_level", "=", "logging", ".", "INFO", ")", ":", "setup_loghandlers", "(", "logging_level", ")", "self", ".", "_install_signal_handlers", "(", ")", "self", ".", "did_perform_work", "=", "Fa...
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.
[ "Starts", "the", "work", "loop", "." ]
train
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...
[ "def", "work", "(", "self", ",", "burst", "=", "False", ",", "logging_level", "=", "logging", ".", "INFO", ")", ":", "# If the is a burst worker it's not needed to spawn greenlet", "if", "burst", ":", "return", "self", ".", "_work", "(", "burst", ",", "logging_l...
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
[ "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" ]
train
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)
[ "def", "register", "(", "dlgr_id", ",", "snapshot", "=", "None", ")", ":", "try", ":", "config", ".", "get", "(", "\"osf_access_token\"", ")", "except", "KeyError", ":", "pass", "else", ":", "osf_id", "=", "_create_osf_project", "(", "dlgr_id", ")", "_uplo...
Register the experiment using configured services.
[ "Register", "the", "experiment", "using", "configured", "services", "." ]
train
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":...
[ "def", "_create_osf_project", "(", "dlgr_id", ",", "description", "=", "None", ")", ":", "if", "not", "description", ":", "description", "=", "\"Experiment {} registered by Dallinger.\"", ".", "format", "(", "dlgr_id", ")", "r", "=", "requests", ".", "post", "("...
Create a project on the OSF.
[ "Create", "a", "project", "on", "the", "OSF", "." ]
train
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...
[ "def", "_upload_assets_to_OSF", "(", "dlgr_id", ",", "osf_id", ",", "provider", "=", "\"osfstorage\"", ")", ":", "root", "=", "\"https://files.osf.io/v1\"", "snapshot_filename", "=", "\"{}-code.zip\"", ".", "format", "(", "dlgr_id", ")", "snapshot_path", "=", "os", ...
Upload experimental assets to the OSF.
[ "Upload", "experimental", "assets", "to", "the", "OSF", "." ]
train
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")
[ "def", "update_task", "(", "deadline", ",", "label", ",", "task_id", ")", ":", "client", "=", "get_client", "(", ")", "task_doc", "=", "assemble_generic_doc", "(", "\"task\"", ",", "label", "=", "label", ",", "deadline", "=", "deadline", ")", "res", "=", ...
Executor for `globus task update`
[ "Executor", "for", "globus", "task", "update" ]
train
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...
[ "def", "role_show", "(", "endpoint_id", ",", "role_id", ")", ":", "client", "=", "get_client", "(", ")", "role", "=", "client", ".", "get_endpoint_role", "(", "endpoint_id", ",", "role_id", ")", "formatted_print", "(", "role", ",", "text_format", "=", "FORMA...
Executor for `globus endpoint role show`
[ "Executor", "for", "globus", "endpoint", "role", "show" ]
train
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()
[ "def", "outformat_is_json", "(", ")", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "state", "=", "ctx", ".", "ensure_object", "(", "CommandState", ")", "return", "state", ".", "outformat_is_json", "(", ")" ]
Only safe to call within a click context.
[ "Only", "safe", "to", "call", "within", "a", "click", "context", "." ]
train
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()
[ "def", "outformat_is_unix", "(", ")", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "state", "=", "ctx", ".", "ensure_object", "(", "CommandState", ")", "return", "state", ".", "outformat_is_unix", "(", ")" ]
Only safe to call within a click context.
[ "Only", "safe", "to", "call", "within", "a", "click", "context", "." ]
train
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()
[ "def", "outformat_is_text", "(", ")", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "state", "=", "ctx", ".", "ensure_object", "(", "CommandState", ")", "return", "state", ".", "outformat_is_text", "(", ")" ]
Only safe to call within a click context.
[ "Only", "safe", "to", "call", "within", "a", "click", "context", "." ]
train
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
[ "def", "get_jmespath_expression", "(", ")", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "state", "=", "ctx", ".", "ensure_object", "(", "CommandState", ")", "return", "state", ".", "jmespath_expr" ]
Only safe to call within a click context.
[ "Only", "safe", "to", "call", "within", "a", "click", "context", "." ]
train
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
[ "def", "verbosity", "(", ")", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "state", "=", "ctx", ".", "ensure_object", "(", "CommandState", ")", "return", "state", ".", "verbosity" ]
Only safe to call within a click context.
[ "Only", "safe", "to", "call", "within", "a", "click", "context", "." ]
train
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()
[ "def", "is_verbose", "(", ")", ":", "ctx", "=", "click", ".", "get_current_context", "(", ")", "state", "=", "ctx", ".", "ensure_object", "(", "CommandState", ")", "return", "state", ".", "is_verbose", "(", ")" ]
Only safe to call within a click context.
[ "Only", "safe", "to", "call", "within", "a", "click", "context", "." ]
train
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( ...
[ "def", "server_show", "(", "endpoint_id", ",", "server_id", ")", ":", "client", "=", "get_client", "(", ")", "server_doc", "=", "client", ".", "get_endpoint_server", "(", "endpoint_id", ",", "server_id", ")", "if", "not", "server_doc", "[", "\"uri\"", "]", "...
Executor for `globus endpoint server show`
[ "Executor", "for", "globus", "endpoint", "server", "show" ]
train
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: ...
[ "def", "role_create", "(", "role", ",", "principal", ",", "endpoint_id", ")", ":", "principal_type", ",", "principal_val", "=", "principal", "client", "=", "get_client", "(", ")", "if", "principal_type", "==", "\"identity\"", ":", "principal_val", "=", "maybe_lo...
Executor for `globus endpoint role show`
[ "Executor", "for", "globus", "endpoint", "role", "show" ]
train
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)
[ "def", "show_task", "(", "successful_transfers", ",", "task_id", ")", ":", "client", "=", "get_client", "(", ")", "if", "successful_transfers", ":", "print_successful_transfers", "(", "client", ",", "task_id", ")", "else", ":", "print_task_detail", "(", "client", ...
Executor for `globus task show`
[ "Executor", "for", "globus", "task", "show" ]
train
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) ...
[ "def", "bookmark_create", "(", "endpoint_plus_path", ",", "bookmark_name", ")", ":", "endpoint_id", ",", "path", "=", "endpoint_plus_path", "client", "=", "get_client", "(", ")", "submit_data", "=", "{", "\"endpoint_id\"", ":", "str", "(", "endpoint_id", ")", ",...
Executor for `globus bookmark create`
[ "Executor", "for", "globus", "bookmark", "create" ]
train
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"]...
[ "def", "server_list", "(", "endpoint_id", ")", ":", "# 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_...
Executor for `globus endpoint server list`
[ "Executor", "for", "globus", "endpoint", "server", "list" ]
train
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...
[ "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_co...
Executor for `globus task-list`
[ "Executor", "for", "globus", "task", "-", "list" ]
train
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 ...
[ "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`
[ "Executor", "for", "globus", "delete" ]
train
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...
[ "def", "set_command", "(", "value", ",", "parameter", ")", ":", "conf", "=", "get_config_obj", "(", ")", "section", "=", "\"cli\"", "if", "\".\"", "in", "parameter", ":", "section", ",", "parameter", "=", "parameter", ".", "split", "(", "\".\"", ",", "1"...
Executor for `globus config set`
[ "Executor", "for", "globus", "config", "set" ]
train
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...
[ "def", "shlex_process_stdin", "(", "process_command", ",", "helptext", ")", ":", "# if input is interactive, print help to stderr", "if", "sys", ".", "stdin", ".", "isatty", "(", ")", ":", "safeprint", "(", "(", "\"{}\\n\"", ".", "format", "(", "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 sessions.
[ "Use", "shlex", "to", "process", "stdin", "line", "-", "by", "-", "line", ".", "Also", "prints", "help", "text", "." ]
train
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 ...
[ "def", "local_id", "(", "personal", ")", ":", "if", "personal", ":", "try", ":", "ep_id", "=", "LocalGlobusConnectPersonal", "(", ")", ".", "endpoint_id", "except", "IOError", "as", "e", ":", "safeprint", "(", "e", ",", "write_to_stderr", "=", "True", ")",...
Executor for `globus endpoint local-id`
[ "Executor", "for", "globus", "endpoint", "local", "-", "id" ]
train
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...
[ "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`
[ "Executor", "for", "globus", "endpoint", "activate" ]
train
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 --...
[ "def", "globus_group", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "inner_decorator", "(", "f", ")", ":", "f", "=", "click", ".", "group", "(", "*", "args", ",", "cls", "=", "GlobusCommandGroup", ",", "*", "*", "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 -- that wouldn't work (unnamed groups? weird ...
[ "Wrapper", "over", "click", ".", "group", "which", "sets", "GlobusCommandGroup", "as", "the", "Class" ]
train
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...
[ "def", "_get_package_data", "(", ")", ":", "moddata", "=", "[", "]", "modlist", "=", "(", "\"click\"", ",", "\"configobj\"", ",", "\"cryptography\"", ",", "\"globus_cli\"", ",", "\"globus_sdk\"", ",", "\"jmespath\"", ",", "\"requests\"", ",", "\"six\"", ",", "...
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.
[ "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", ...
train
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...
[ "def", "print_version", "(", ")", ":", "latest", ",", "current", "=", "get_versions", "(", ")", "if", "latest", "is", "None", ":", "safeprint", "(", "(", "\"Installed Version: {0}\\n\"", "\"Failed to lookup latest version.\"", ")", ".", "format", "(", "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.
[ "Print", "out", "the", "current", "version", "and", "at", "least", "try", "to", "fetch", "the", "latest", "from", "PyPi", "to", "print", "alongside", "it", "." ]
train
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)
[ "def", "_call_pip", "(", "*", "args", ")", ":", "all_args", "=", "[", "sys", ".", "executable", ",", "\"-m\"", ",", "\"pip\"", "]", "+", "list", "(", "args", ")", "print", "(", "\"> {}\"", ".", "format", "(", "\" \"", ".", "join", "(", "all_args", ...
Invoke pip *safely* and in the *supported* way: https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program
[ "Invoke", "pip", "*", "safely", "*", "and", "in", "the", "*", "supported", "*", "way", ":", "https", ":", "//", "pip", ".", "pypa", ".", "io", "/", "en", "/", "latest", "/", "user_guide", "/", "#using", "-", "pip", "-", "from", "-", "your", "-", ...
train
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. """ ...
[ "def", "_check_pip_installed", "(", ")", ":", "try", ":", "subprocess", ".", "check_output", "(", "[", "sys", ".", "executable", ",", "\"-m\"", ",", "\"pip\"", ",", "\"--version\"", "]", ",", "stderr", "=", "subprocess", ".", "STDOUT", ")", "return", "True...
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" ]
train
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, ...
[ "def", "update_command", "(", "yes", ",", "development", ",", "development_version", ")", ":", "# 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 wi...
Executor for `globus update`
[ "Executor", "for", "globus", "update" ]
train
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( ...
[ "def", "whoami_command", "(", "linked_identities", ")", ":", "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", "(", ")", "ex...
Executor for `globus whoami`
[ "Executor", "for", "globus", "whoami" ]
train
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...
[ "def", "get_completion_context", "(", "args", ")", ":", "# get the \"globus\" command as a click.Command", "root_command", "=", "click", ".", "get_current_context", "(", ")", ".", "find_root", "(", ")", ".", "command", "# build a new context object off of it, with resilient_p...
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...
[ "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", ...
train
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...
[ "def", "get_all_choices", "(", "completed_args", ",", "cur", ",", "quoted", ")", ":", "ctx", "=", "get_completion_context", "(", "completed_args", ")", "if", "not", "ctx", ":", "return", "[", "]", "# matching rules, so we can toggle by type and such", "def", "match_...
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?
[ "This", "is", "the", "main", "completion", "function", ".", "Inputs", ":", "-", "completed_args", ":", "a", "list", "of", "already", "-", "completed", "arguments", "-", "cur", ":", "the", "current", "word", "in", "progress", "or", "None", "-", "quoted", ...
train
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...
[ "def", "endpoint_is_activated", "(", "endpoint_id", ",", "until", ",", "absolute_time", ")", ":", "client", "=", "get_client", "(", ")", "res", "=", "client", ".", "endpoint_get_activation_requirements", "(", "endpoint_id", ")", "def", "fail", "(", "deadline", "...
Executor for `globus endpoint is-activated`
[ "Executor", "for", "globus", "endpoint", "is", "-", "activated" ]
train
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): ...
[ "def", "endpoint_create", "(", "*", "*", "kwargs", ")", ":", "client", "=", "get_client", "(", ")", "# get endpoint type, ensure unambiguous.", "personal", "=", "kwargs", ".", "pop", "(", "\"personal\"", ")", "server", "=", "kwargs", ".", "pop", "(", "\"server...
Executor for `globus endpoint create`
[ "Executor", "for", "globus", "endpoint", "create" ]
train
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...
[ "def", "server_update", "(", "endpoint_id", ",", "server_id", ",", "subject", ",", "port", ",", "scheme", ",", "hostname", ",", "incoming_data_ports", ",", "outgoing_data_ports", ",", ")", ":", "client", "=", "get_client", "(", ")", "server_doc", "=", "assembl...
Executor for `globus endpoint server update`
[ "Executor", "for", "globus", "endpoint", "server", "update" ]
train
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)
[ "def", "filename_command", "(", ")", ":", "try", ":", "config", "=", "get_config_obj", "(", "file_error", "=", "True", ")", "except", "IOError", "as", "e", ":", "safeprint", "(", "e", ",", "write_to_stderr", "=", "True", ")", "click", ".", "get_current_con...
Executor for `globus config filename`
[ "Executor", "for", "globus", "config", "filename" ]
train
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)
[ "def", "my_shared_endpoint_list", "(", "endpoint_id", ")", ":", "client", "=", "get_client", "(", ")", "ep_iterator", "=", "client", ".", "my_shared_endpoint_list", "(", "endpoint_id", ")", "formatted_print", "(", "ep_iterator", ",", "fields", "=", "ENDPOINT_LIST_FI...
Executor for `globus endpoint my-shared-endpoint-list`
[ "Executor", "for", "globus", "endpoint", "my", "-", "shared", "-", "endpoint", "-", "list" ]
train
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...
[ "def", "_try_b32_decode", "(", "v", ")", ":", "# should start with \"u_\"", "if", "not", "v", ".", "startswith", "(", "\"u_\"", ")", ":", "return", "None", "# usernames have @ , we want to allow `u_foo@example.com`", "# b32 names never have @", "if", "\"@\"", "in", "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 formatted correctly, return None.
[ "Attempt", "to", "decode", "a", "b32", "-", "encoded", "username", "which", "is", "sometimes", "generated", "by", "internal", "Globus", "components", "." ]
train
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 = ...
[ "def", "get_identities_command", "(", "values", ")", ":", "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,", ...
Executor for `globus get-identities`
[ "Executor", "for", "globus", "get", "-", "identities" ]
train
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...
[ "def", "supported_activation_methods", "(", "res", ")", ":", "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.
[ "Given", "an", "activation_requirements", "document", "returns", "a", "list", "of", "activation", "methods", "supported", "by", "this", "endpoint", "." ]
train
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...
[ "def", "activation_requirements_help_text", "(", "res", ",", "ep_id", ")", ":", "methods", "=", "supported_activation_methods", "(", "res", ")", "lines", "=", "[", "\"This endpoint supports the following activation methods: \"", ",", "\", \"", ".", "join", "(", "methods...
Given an activation requirements document and an endpoint_id returns a string of help text for how to activate the endpoint
[ "Given", "an", "activation", "requirements", "document", "and", "an", "endpoint_id", "returns", "a", "string", "of", "help", "text", "for", "how", "to", "activate", "the", "endpoint" ]
train
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 ...
[ "def", "autoactivate", "(", "client", ",", "endpoint_id", ",", "if_expires_in", "=", "None", ")", ":", "kwargs", "=", "{", "}", "if", "if_expires_in", "is", "not", "None", ":", "kwargs", "[", "\"if_expires_in\"", "]", "=", "if_expires_in", "res", "=", "cli...
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)
[ "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...
train
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...
[ "def", "get_endpoint_w_server_list", "(", "endpoint_id", ")", ":", "client", "=", "get_client", "(", ")", "endpoint", "=", "client", ".", "get_endpoint", "(", "endpoint_id", ")", "if", "endpoint", "[", "\"host_endpoint_id\"", "]", ":", "# not GCS -- this is a share ...
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
[ "A", "helper", "for", "handling", "endpoint", "server", "list", "lookups", "correctly", "accounting", "for", "various", "endpoint", "types", "." ]
train
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...
[ "def", "task_wait_with_io", "(", "meow", ",", "heartbeat", ",", "polling_interval", ",", "timeout", ",", "task_id", ",", "timeout_exit_code", ",", "client", "=", "None", ")", ":", "client", "=", "client", "or", "get_client", "(", ")", "def", "timed_out", "("...
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.)
[ "Options", "are", "the", "core", "task", "wait", "options", "including", "the", "--", "meow", "easter", "egg", "." ]
train
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: ...
[ "def", "retry", "(", "self", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "backoff", "=", "random", ".", "random", "(", ")", "/", "100", "# 5ms on average", "for", "_", "in", "range", "(", "self", ".", "tries", "-", "1", ")", ...
Retries the given function self.tries times on NetworkErros
[ "Retries", "the", "given", "function", "self", ".", "tries", "times", "on", "NetworkErros" ]
train
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...
[ "def", "recursive_operation_ls", "(", "self", ",", "endpoint_id", ",", "depth", "=", "3", ",", "filter_after_first", "=", "True", ",", "*", "*", "params", ")", ":", "endpoint_id", "=", "safe_stringify", "(", "endpoint_id", ")", "self", ".", "logger", ".", ...
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...
[ "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", "i...
train
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 ...
[ "def", "convert", "(", "self", ",", "value", ",", "param", ",", "ctx", ")", ":", "# passthrough conditions: None or already processed", "if", "value", "is", "None", "or", "isinstance", "(", "value", ",", "tuple", ")", ":", "return", "value", "# split the value o...
ParamType.convert() is the actual processing method that takes a provided parameter and parses it.
[ "ParamType", ".", "convert", "()", "is", "the", "actual", "processing", "method", "that", "takes", "a", "provided", "parameter", "and", "parses", "it", "." ]
train
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." ) ...
[ "def", "cancel_task", "(", "all", ",", "task_id", ")", ":", "if", "bool", "(", "all", ")", "+", "bool", "(", "task_id", ")", "!=", "1", ":", "raise", "click", ".", "UsageError", "(", "\"You must pass EITHER the special --all flag \"", "\"to cancel all in-progres...
Executor for `globus task cancel`
[ "Executor", "for", "globus", "task", "cancel" ]
train
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 )
[ "def", "task_wait", "(", "meow", ",", "heartbeat", ",", "polling_interval", ",", "timeout", ",", "task_id", ",", "timeout_exit_code", ")", ":", "task_wait_with_io", "(", "meow", ",", "heartbeat", ",", "polling_interval", ",", "timeout", ",", "task_id", ",", "t...
Executor for `globus task wait`
[ "Executor", "for", "globus", "task", "wait" ]
train
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(...
[ "def", "one_use_option", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# cannot force a multiple or count option to be single use", "if", "\"multiple\"", "in", "kwargs", "or", "\"count\"", "in", "kwargs", ":", "raise", "ValueError", "(", "\"Internal error, one...
Wrapper of the click.option decorator that replaces any instances of the Option class with the custom OneUseOption class
[ "Wrapper", "of", "the", "click", ".", "option", "decorator", "that", "replaces", "any", "instances", "of", "the", "Option", "class", "with", "the", "custom", "OneUseOption", "class" ]
train
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): ...
[ "def", "_spec_to_matches", "(", "server_list", ",", "server_spec", ",", "mode", ")", ":", "assert", "mode", "in", "(", "\"uri\"", ",", "\"hostname\"", ",", "\"hostname_port\"", ")", "def", "match", "(", "server_doc", ")", ":", "if", "mode", "==", "\"hostname...
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.
[ "mode", "is", "in", "{", "uri", "hostname", "hostname_port", "}" ]
train
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...
[ "def", "server_delete", "(", "endpoint_id", ",", "server", ")", ":", "client", "=", "get_client", "(", ")", "mode", "=", "_detect_mode", "(", "server", ")", "# list (even if not necessary) in order to make errors more consistent when", "# mode='id'", "endpoint", ",", "s...
Executor for `globus endpoint server show`
[ "Executor", "for", "globus", "endpoint", "server", "show" ]
train
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 ...
[ "def", "remove_command", "(", "parameter", ")", ":", "conf", "=", "get_config_obj", "(", ")", "section", "=", "\"cli\"", "if", "\".\"", "in", "parameter", ":", "section", ",", "parameter", "=", "parameter", ".", "split", "(", "\".\"", ",", "1", ")", "# e...
Executor for `globus config remove`
[ "Executor", "for", "globus", "config", "remove" ]
train
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"), ...
[ "def", "show_command", "(", "endpoint_id", ",", "rule_id", ")", ":", "client", "=", "get_client", "(", ")", "rule", "=", "client", ".", "get_endpoint_acl_rule", "(", "endpoint_id", ",", "rule_id", ")", "formatted_print", "(", "rule", ",", "text_format", "=", ...
Executor for `globus endpoint permission show`
[ "Executor", "for", "globus", "endpoint", "permission", "show" ]
train
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...
[ "def", "bookmark_rename", "(", "bookmark_id_or_name", ",", "new_bookmark_name", ")", ":", "client", "=", "get_client", "(", ")", "bookmark_id", "=", "resolve_id_or_name", "(", "client", ",", "bookmark_id_or_name", ")", "[", "\"id\"", "]", "submit_data", "=", "{", ...
Executor for `globus bookmark rename`
[ "Executor", "for", "globus", "bookmark", "rename" ]
train
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: ...
[ "def", "show_command", "(", "parameter", ")", ":", "section", "=", "\"cli\"", "if", "\".\"", "in", "parameter", ":", "section", ",", "parameter", "=", "parameter", ".", "split", "(", "\".\"", ",", "1", ")", "value", "=", "lookup_option", "(", "parameter", ...
Executor for `globus config show`
[ "Executor", "for", "globus", "config", "show" ]
train
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...
[ "def", "rename_command", "(", "source", ",", "destination", ")", ":", "source_ep", ",", "source_path", "=", "source", "dest_ep", ",", "dest_path", "=", "destination", "if", "source_ep", "!=", "dest_ep", ":", "raise", "click", ".", "UsageError", "(", "(", "\"...
Executor for `globus rename`
[ "Executor", "for", "globus", "rename" ]
train
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, )
[ "def", "endpoint_show", "(", "endpoint_id", ")", ":", "client", "=", "get_client", "(", ")", "res", "=", "client", ".", "get_endpoint", "(", "endpoint_id", ")", "formatted_print", "(", "res", ",", "text_format", "=", "FORMAT_TEXT_RECORD", ",", "fields", "=", ...
Executor for `globus endpoint show`
[ "Executor", "for", "globus", "endpoint", "show" ]
train
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...
[ "def", "update_command", "(", "permissions", ",", "rule_id", ",", "endpoint_id", ")", ":", "client", "=", "get_client", "(", ")", "rule_data", "=", "assemble_generic_doc", "(", "\"access\"", ",", "permissions", "=", "permissions", ")", "res", "=", "client", "....
Executor for `globus endpoint permission update`
[ "Executor", "for", "globus", "endpoint", "permission", "update" ]
train
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: ...
[ "def", "_format_value", "(", "self", ",", "val", ")", ":", "name", "=", "self", ".", "name", "+", "\":\"", "if", "not", "self", ".", "multiline", "or", "\"\\n\"", "not", "in", "val", ":", "val", "=", "u\"{0} {1}\"", ".", "format", "(", "name", ".", ...
formats a value to be good for textmode printing val must be unicode
[ "formats", "a", "value", "to", "be", "good", "for", "textmode", "printing", "val", "must", "be", "unicode" ]
train
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")
[ "def", "delete_command", "(", "endpoint_id", ",", "rule_id", ")", ":", "client", "=", "get_client", "(", ")", "res", "=", "client", ".", "delete_endpoint_acl_rule", "(", "endpoint_id", ",", "rule_id", ")", "formatted_print", "(", "res", ",", "text_format", "="...
Executor for `globus endpoint permission delete`
[ "Executor", "for", "globus", "endpoint", "permission", "delete" ]
train
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, ): """ ...
[ "def", "transfer_command", "(", "batch", ",", "sync_level", ",", "recursive", ",", "destination", ",", "source", ",", "label", ",", "preserve_mtime", ",", "verify_checksum", ",", "encrypt", ",", "submission_id", ",", "dry_run", ",", "delete", ",", "deadline", ...
Executor for `globus transfer`
[ "Executor", "for", "globus", "transfer" ]
train
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")
[ "def", "endpoint_delete", "(", "endpoint_id", ")", ":", "client", "=", "get_client", "(", ")", "res", "=", "client", ".", "delete_endpoint", "(", "endpoint_id", ")", "formatted_print", "(", "res", ",", "text_format", "=", "FORMAT_TEXT_RAW", ",", "response_key", ...
Executor for `globus endpoint delete`
[ "Executor", "for", "globus", "endpoint", "delete" ]
train
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...
[ "def", "bookmark_delete", "(", "bookmark_id_or_name", ")", ":", "client", "=", "get_client", "(", ")", "bookmark_id", "=", "resolve_id_or_name", "(", "client", ",", "bookmark_id_or_name", ")", "[", "\"id\"", "]", "res", "=", "client", ".", "delete_bookmark", "("...
Executor for `globus bookmark delete`
[ "Executor", "for", "globus", "bookmark", "delete" ]
train
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_...
[ "def", "mkdir_command", "(", "endpoint_plus_path", ")", ":", "endpoint_id", ",", "path", "=", "endpoint_plus_path", "client", "=", "get_client", "(", ")", "autoactivate", "(", "client", ",", "endpoint_id", ",", "if_expires_in", "=", "60", ")", "res", "=", "cli...
Executor for `globus mkdir`
[ "Executor", "for", "globus", "mkdir" ]
train
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...
[ "def", "init_command", "(", "default_output_format", ",", "default_myproxy_username", ")", ":", "# 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 sure tha...
Executor for `globus config init`
[ "Executor", "for", "globus", "config", "init" ]
train
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, ...
[ "def", "detect_and_decorate", "(", "decorator", ",", "args", ",", "kwargs", ")", ":", "# special behavior when invoked with only one non-keyword argument: act as", "# a normal decorator, decorating and returning that argument with", "# click.option", "if", "len", "(", "args", ")", ...
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.
[ "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", "." ]
train
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...
[ "def", "list_command", "(", "endpoint_id", ")", ":", "client", "=", "get_client", "(", ")", "rules", "=", "client", ".", "endpoint_acl_list", "(", "endpoint_id", ")", "resolved_ids", "=", "LazyIdentityMap", "(", "x", "[", "\"principal\"", "]", "for", "x", "i...
Executor for `globus endpoint permission list`
[ "Executor", "for", "globus", "endpoint", "permission", "list" ]
train
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_...
[ "def", "bookmark_list", "(", ")", ":", "client", "=", "get_client", "(", ")", "bookmark_iterator", "=", "client", ".", "bookmark_list", "(", ")", "def", "get_ep_name", "(", "item", ")", ":", "ep_id", "=", "item", "[", "\"endpoint_id\"", "]", "try", ":", ...
Executor for `globus bookmark list`
[ "Executor", "for", "globus", "bookmark", "list" ]
train
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...
[ "def", "rm_command", "(", "ignore_missing", ",", "star_silent", ",", "recursive", ",", "enable_globs", ",", "endpoint_plus_path", ",", "label", ",", "submission_id", ",", "dry_run", ",", "deadline", ",", "skip_activation_check", ",", "notify", ",", "meow", ",", ...
Executor for `globus rm`
[ "Executor", "for", "globus", "rm" ]
train
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...
[ "def", "do_link_auth_flow", "(", "session_params", "=", "None", ",", "force_new_client", "=", "False", ")", ":", "session_params", "=", "session_params", "or", "{", "}", "# get the ConfidentialApp client object", "auth_client", "=", "internal_auth_client", "(", "require...
Prompts the user with a link to authenticate with globus auth and authorize the CLI to act on their behalf.
[ "Prompts", "the", "user", "with", "a", "link", "to", "authenticate", "with", "globus", "auth", "and", "authorize", "the", "CLI", "to", "act", "on", "their", "behalf", "." ]
train
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...
[ "def", "do_local_server_auth_flow", "(", "session_params", "=", "None", ",", "force_new_client", "=", "False", ")", ":", "session_params", "=", "session_params", "or", "{", "}", "# start local server and create matching redirect_uri", "with", "start_local_server", "(", "l...
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)
[ "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", ")" ]
train
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...
[ "def", "exchange_code_and_store_config", "(", "auth_client", ",", "auth_code", ")", ":", "# do a token exchange with the given code", "tkn", "=", "auth_client", ".", "oauth2_exchange_code_for_tokens", "(", "auth_code", ")", "tkn", "=", "tkn", ".", "by_resource_server", "#...
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.
[ "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",...
train
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...
[ "def", "endpoint_search", "(", "filter_fulltext", ",", "filter_owner_id", ",", "filter_scope", ")", ":", "if", "filter_scope", "==", "\"all\"", "and", "not", "filter_fulltext", ":", "raise", "click", ".", "UsageError", "(", "\"When searching all endpoints (--filter-scop...
Executor for `globus endpoint search`
[ "Executor", "for", "globus", "endpoint", "search" ]
train
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"]: ...
[ "def", "endpoint_update", "(", "*", "*", "kwargs", ")", ":", "# validate params. Requires a get call to check the endpoint type", "client", "=", "get_client", "(", ")", "endpoint_id", "=", "kwargs", ".", "pop", "(", "\"endpoint_id\"", ")", "get_res", "=", "client", ...
Executor for `globus endpoint update`
[ "Executor", "for", "globus", "endpoint", "update" ]
train
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...
[ "def", "safeprint", "(", "message", ",", "write_to_stderr", "=", "False", ",", "newline", "=", "True", ")", ":", "try", ":", "click", ".", "echo", "(", "message", ",", "nl", "=", "newline", ",", "err", "=", "write_to_stderr", ")", "except", "IOError", ...
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.
[ "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", ...
train
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...
[ "def", "_key_to_keyfunc", "(", "k", ")", ":", "# if the key is a string, then the \"keyfunc\" is just a basic lookup", "# operation -- return that", "if", "isinstance", "(", "k", ",", "six", ".", "string_types", ")", ":", "def", "lookup", "(", "x", ")", ":", "return",...
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.
[ "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...
train
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...
[ "def", "formatted_print", "(", "response_data", ",", "simple_text", "=", "None", ",", "text_preamble", "=", "None", ",", "text_epilog", "=", "None", ",", "text_format", "=", "FORMAT_TEXT_TABLE", ",", "json_converter", "=", "None", ",", "fields", "=", "None", "...
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...
[ "A", "generic", "output", "formatter", ".", "Consumes", "the", "following", "pieces", "of", "data", ":" ]
train
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...
[ "def", "common_options", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "decorate", "(", "f", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n Work of actually decorating a function -- wrapped in here because we\n want to dispatch depending on how `co...
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 ...
[ "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", "." ]
train
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...
[ "def", "endpoint_id_arg", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "decorate", "(", "f", ",", "*", "*", "kwargs", ")", ":", "\"\"\"\n Work of actually decorating a function -- wrapped in here because we\n want to dispatch depending on how th...
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: >>...
[ "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", ".", "...
train
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) ...
[ "def", "endpoint_create_and_update_params", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "inner_decorator", "(", "f", ",", "create", "=", "False", ")", ":", "update_help_prefix", "=", "(", "not", "create", "and", "\"New \"", ")", "or", "\"\"...
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...
[ "Collection", "of", "options", "consumed", "by", "Transfer", "endpoint", "create", "and", "update", "operations", "--", "accepts", "toggle", "regarding", "create", "vs", ".", "update", "that", "makes", "display_name", "required", "vs", ".", "optional", "." ]
train
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": ...
[ "def", "validate_endpoint_create_and_update_params", "(", "endpoint_type", ",", "managed", ",", "params", ")", ":", "# options only allowed for GCS endpoints", "if", "endpoint_type", "!=", "\"server\"", ":", "# catch params with two option flags", "if", "params", "[", "\"publ...
Given an endpoint type of "shared" "server" or "personal" and option values Confirms the option values are valid for the given endpoint
[ "Given", "an", "endpoint", "type", "of", "shared", "server", "or", "personal", "and", "option", "values", "Confirms", "the", "option", "values", "are", "valid", "for", "the", "given", "endpoint" ]
train
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) >>>...
[ "def", "task_id_arg", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "inner_decorator", "(", "f", ",", "required", "=", "True", ")", ":", "f", "=", "click", ".", "argument", "(", "\"TASK_ID\"", ",", "required", "=", "required", ")", "(",...
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): >>> ... ...
[ "This", "is", "the", "TASK_ID", "argument", "consumed", "by", "many", "Transfer", "Task", "operations", ".", "It", "accept", "a", "toggle", "on", "whether", "or", "not", "it", "is", "required" ]
train
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...
[ "def", "task_submission_options", "(", "f", ")", ":", "def", "notify_opt_callback", "(", "ctx", ",", "param", ",", "value", ")", ":", "\"\"\"\n Parse --notify\n - \"\" is the same as \"off\"\n - parse by lowercase, comma-split, strip spaces\n - \"off,x\" i...
Options shared by both transfer and delete task submission
[ "Options", "shared", "by", "both", "transfer", "and", "delete", "task", "submission" ]
train
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) ...
[ "def", "delete_and_rm_options", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "inner_decorator", "(", "f", ",", "supports_batch", "=", "True", ",", "default_enable_globs", "=", "False", ")", ":", "f", "=", "click", ".", "option", "(", "\"--...
Options which apply both to `globus delete` and `globus rm`
[ "Options", "which", "apply", "both", "to", "globus", "delete", "and", "globus", "rm" ]
train
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...
[ "def", "server_add_and_update_opts", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "port_range_callback", "(", "ctx", ",", "param", ",", "value", ")", ":", "if", "not", "value", ":", "return", "None", "value", "=", "value", ".", "lower", ...
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): >>> ... ...
[ "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", ...
train
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")
[ "def", "endpoint_deactivate", "(", "endpoint_id", ")", ":", "client", "=", "get_client", "(", ")", "res", "=", "client", ".", "endpoint_deactivate", "(", "endpoint_id", ")", "formatted_print", "(", "res", ",", "text_format", "=", "FORMAT_TEXT_RAW", ",", "respons...
Executor for `globus endpoint deactivate`
[ "Executor", "for", "globus", "endpoint", "deactivate" ]
train
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...
[ "def", "version_option", "(", "f", ")", ":", "def", "callback", "(", "ctx", ",", "param", ",", "value", ")", ":", "# copied from click.decorators.version_option", "# no idea what resilient_parsing means, but...", "if", "not", "value", "or", "ctx", ".", "resilient_pars...
Largely a custom clone of click.version_option -- almost identical, but prints our special output.
[ "Largely", "a", "custom", "clone", "of", "click", ".", "version_option", "--", "almost", "identical", "but", "prints", "our", "special", "output", "." ]
train
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, ...
[ "def", "get_versions", "(", ")", ":", "# import in the func (rather than top-level scope) so that at setup time,", "# `requests` isn't required -- otherwise, setuptools will fail to run", "# because requests isn't installed yet.", "import", "requests", "try", ":", "version_data", "=", "r...
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
[ "Wrap", "in", "a", "function", "to", "ensure", "that", "we", "don", "t", "run", "this", "every", "time", "a", "CLI", "command", "runs", "(", "yuck!", ")" ]
train
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...
[ "def", "_lookup_identity_names", "(", "self", ")", ":", "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", ",", "l...
Batch resolve identities to usernames. Returns a dict mapping IDs to Usernames
[ "Batch", "resolve", "identities", "to", "usernames", ".", "Returns", "a", "dict", "mapping", "IDs", "to", "Usernames" ]
train
https://github.com/globus/globus-cli/blob/336675ff24da64c5ee487243f39ae39fc49a7e14/globus_cli/services/auth.py#L96-L110