id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
38,600 | MostAwesomeDude/gentleman | gentleman/base.py | FailoverInstance | def FailoverInstance(r, instance, iallocator=None, ignore_consistency=False,
target_node=None):
"""Does a failover of an instance.
@type instance: string
@param instance: Instance name
@type iallocator: string
@param iallocator: Iallocator for deciding the target node for
... | python | def FailoverInstance(r, instance, iallocator=None, ignore_consistency=False,
target_node=None):
"""Does a failover of an instance.
@type instance: string
@param instance: Instance name
@type iallocator: string
@param iallocator: Iallocator for deciding the target node for
... | [
"def",
"FailoverInstance",
"(",
"r",
",",
"instance",
",",
"iallocator",
"=",
"None",
",",
"ignore_consistency",
"=",
"False",
",",
"target_node",
"=",
"None",
")",
":",
"body",
"=",
"{",
"\"ignore_consistency\"",
":",
"ignore_consistency",
",",
"}",
"if",
"... | Does a failover of an instance.
@type instance: string
@param instance: Instance name
@type iallocator: string
@param iallocator: Iallocator for deciding the target node for
shared-storage instances
@type ignore_consistency: bool
@param ignore_consistency: Whether to ignore disk consist... | [
"Does",
"a",
"failover",
"of",
"an",
"instance",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L665-L693 |
38,601 | MostAwesomeDude/gentleman | gentleman/base.py | RenameInstance | def RenameInstance(r, instance, new_name, ip_check, name_check=None):
"""
Changes the name of an instance.
@type instance: string
@param instance: Instance name
@type new_name: string
@param new_name: New instance name
@type ip_check: bool
@param ip_check: Whether to ensure instance's I... | python | def RenameInstance(r, instance, new_name, ip_check, name_check=None):
"""
Changes the name of an instance.
@type instance: string
@param instance: Instance name
@type new_name: string
@param new_name: New instance name
@type ip_check: bool
@param ip_check: Whether to ensure instance's I... | [
"def",
"RenameInstance",
"(",
"r",
",",
"instance",
",",
"new_name",
",",
"ip_check",
",",
"name_check",
"=",
"None",
")",
":",
"body",
"=",
"{",
"\"ip_check\"",
":",
"ip_check",
",",
"\"new_name\"",
":",
"new_name",
",",
"}",
"if",
"name_check",
"is",
"... | Changes the name of an instance.
@type instance: string
@param instance: Instance name
@type new_name: string
@param new_name: New instance name
@type ip_check: bool
@param ip_check: Whether to ensure instance's IP address is inactive
@type name_check: bool
@param name_check: Whether to... | [
"Changes",
"the",
"name",
"of",
"an",
"instance",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L696-L718 |
38,602 | MostAwesomeDude/gentleman | gentleman/base.py | WaitForJobChange | def WaitForJobChange(r, job_id, fields, prev_job_info, prev_log_serial):
"""
Waits for job changes.
@type job_id: int
@param job_id: Job ID for which to wait
"""
body = {
"fields": fields,
"previous_job_info": prev_job_info,
"previous_log_serial": prev_log_serial,
}... | python | def WaitForJobChange(r, job_id, fields, prev_job_info, prev_log_serial):
"""
Waits for job changes.
@type job_id: int
@param job_id: Job ID for which to wait
"""
body = {
"fields": fields,
"previous_job_info": prev_job_info,
"previous_log_serial": prev_log_serial,
}... | [
"def",
"WaitForJobChange",
"(",
"r",
",",
"job_id",
",",
"fields",
",",
"prev_job_info",
",",
"prev_log_serial",
")",
":",
"body",
"=",
"{",
"\"fields\"",
":",
"fields",
",",
"\"previous_job_info\"",
":",
"prev_job_info",
",",
"\"previous_log_serial\"",
":",
"pr... | Waits for job changes.
@type job_id: int
@param job_id: Job ID for which to wait | [
"Waits",
"for",
"job",
"changes",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L758-L772 |
38,603 | MostAwesomeDude/gentleman | gentleman/base.py | CancelJob | def CancelJob(r, job_id, dry_run=False):
"""
Cancels a job.
@type job_id: int
@param job_id: id of the job to delete
@type dry_run: bool
@param dry_run: whether to perform a dry run
"""
return r.request("delete", "/2/jobs/%s" % job_id,
query={"dry-run": dry... | python | def CancelJob(r, job_id, dry_run=False):
"""
Cancels a job.
@type job_id: int
@param job_id: id of the job to delete
@type dry_run: bool
@param dry_run: whether to perform a dry run
"""
return r.request("delete", "/2/jobs/%s" % job_id,
query={"dry-run": dry... | [
"def",
"CancelJob",
"(",
"r",
",",
"job_id",
",",
"dry_run",
"=",
"False",
")",
":",
"return",
"r",
".",
"request",
"(",
"\"delete\"",
",",
"\"/2/jobs/%s\"",
"%",
"job_id",
",",
"query",
"=",
"{",
"\"dry-run\"",
":",
"dry_run",
"}",
")"
] | Cancels a job.
@type job_id: int
@param job_id: id of the job to delete
@type dry_run: bool
@param dry_run: whether to perform a dry run | [
"Cancels",
"a",
"job",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L775-L786 |
38,604 | MostAwesomeDude/gentleman | gentleman/base.py | GetNodes | def GetNodes(r, bulk=False):
"""
Gets all nodes in the cluster.
@type bulk: bool
@param bulk: whether to return all information about all instances
@rtype: list of dict or str
@return: if bulk is true, info about nodes in the cluster,
else list of nodes in the cluster
"""
... | python | def GetNodes(r, bulk=False):
"""
Gets all nodes in the cluster.
@type bulk: bool
@param bulk: whether to return all information about all instances
@rtype: list of dict or str
@return: if bulk is true, info about nodes in the cluster,
else list of nodes in the cluster
"""
... | [
"def",
"GetNodes",
"(",
"r",
",",
"bulk",
"=",
"False",
")",
":",
"if",
"bulk",
":",
"return",
"r",
".",
"request",
"(",
"\"get\"",
",",
"\"/2/nodes\"",
",",
"query",
"=",
"{",
"\"bulk\"",
":",
"1",
"}",
")",
"else",
":",
"nodes",
"=",
"r",
".",
... | Gets all nodes in the cluster.
@type bulk: bool
@param bulk: whether to return all information about all instances
@rtype: list of dict or str
@return: if bulk is true, info about nodes in the cluster,
else list of nodes in the cluster | [
"Gets",
"all",
"nodes",
"in",
"the",
"cluster",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L789-L805 |
38,605 | MostAwesomeDude/gentleman | gentleman/base.py | EvacuateNode | def EvacuateNode(r, node, iallocator=None, remote_node=None, dry_run=False,
early_release=False, mode=None, accept_old=False):
"""
Evacuates instances from a Ganeti node.
@type node: str
@param node: node to evacuate
@type iallocator: str or None
@param iallocator: instance all... | python | def EvacuateNode(r, node, iallocator=None, remote_node=None, dry_run=False,
early_release=False, mode=None, accept_old=False):
"""
Evacuates instances from a Ganeti node.
@type node: str
@param node: node to evacuate
@type iallocator: str or None
@param iallocator: instance all... | [
"def",
"EvacuateNode",
"(",
"r",
",",
"node",
",",
"iallocator",
"=",
"None",
",",
"remote_node",
"=",
"None",
",",
"dry_run",
"=",
"False",
",",
"early_release",
"=",
"False",
",",
"mode",
"=",
"None",
",",
"accept_old",
"=",
"False",
")",
":",
"if",
... | Evacuates instances from a Ganeti node.
@type node: str
@param node: node to evacuate
@type iallocator: str or None
@param iallocator: instance allocator to use
@type remote_node: str
@param remote_node: node to evaucate to
@type dry_run: bool
@param dry_run: whether to perform a dry ru... | [
"Evacuates",
"instances",
"from",
"a",
"Ganeti",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L822-L897 |
38,606 | MostAwesomeDude/gentleman | gentleman/base.py | MigrateNode | def MigrateNode(r, node, mode=None, dry_run=False, iallocator=None,
target_node=None):
"""
Migrates all primary instances from a node.
@type node: str
@param node: node to migrate
@type mode: string
@param mode: if passed, it will overwrite the live migration type,
o... | python | def MigrateNode(r, node, mode=None, dry_run=False, iallocator=None,
target_node=None):
"""
Migrates all primary instances from a node.
@type node: str
@param node: node to migrate
@type mode: string
@param mode: if passed, it will overwrite the live migration type,
o... | [
"def",
"MigrateNode",
"(",
"r",
",",
"node",
",",
"mode",
"=",
"None",
",",
"dry_run",
"=",
"False",
",",
"iallocator",
"=",
"None",
",",
"target_node",
"=",
"None",
")",
":",
"query",
"=",
"{",
"\"dry-run\"",
":",
"dry_run",
",",
"}",
"if",
"NODE_MI... | Migrates all primary instances from a node.
@type node: str
@param node: node to migrate
@type mode: string
@param mode: if passed, it will overwrite the live migration type,
otherwise the hypervisor default will be used
@type dry_run: bool
@param dry_run: whether to perform a dry r... | [
"Migrates",
"all",
"primary",
"instances",
"from",
"a",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L900-L947 |
38,607 | MostAwesomeDude/gentleman | gentleman/base.py | SetNodeRole | def SetNodeRole(r, node, role, force=False, auto_promote=False):
"""
Sets the role for a node.
@type node: str
@param node: the node whose role to set
@type role: str
@param role: the role to set for the node
@type force: bool
@param force: whether to force the role change
@type aut... | python | def SetNodeRole(r, node, role, force=False, auto_promote=False):
"""
Sets the role for a node.
@type node: str
@param node: the node whose role to set
@type role: str
@param role: the role to set for the node
@type force: bool
@param force: whether to force the role change
@type aut... | [
"def",
"SetNodeRole",
"(",
"r",
",",
"node",
",",
"role",
",",
"force",
"=",
"False",
",",
"auto_promote",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"force\"",
":",
"force",
",",
"\"auto_promote\"",
":",
"auto_promote",
",",
"}",
"return",
"r",
".",... | Sets the role for a node.
@type node: str
@param node: the node whose role to set
@type role: str
@param role: the role to set for the node
@type force: bool
@param force: whether to force the role change
@type auto_promote: bool
@param auto_promote: Whether node(s) should be promoted t... | [
"Sets",
"the",
"role",
"for",
"a",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L964-L988 |
38,608 | MostAwesomeDude/gentleman | gentleman/base.py | PowercycleNode | def PowercycleNode(r, node, force=False):
"""
Powercycles a node.
@type node: string
@param node: Node name
@type force: bool
@param force: Whether to force the operation
@rtype: string
@return: job id
"""
query = {
"force": force,
}
return r.request("post", "/... | python | def PowercycleNode(r, node, force=False):
"""
Powercycles a node.
@type node: string
@param node: Node name
@type force: bool
@param force: Whether to force the operation
@rtype: string
@return: job id
"""
query = {
"force": force,
}
return r.request("post", "/... | [
"def",
"PowercycleNode",
"(",
"r",
",",
"node",
",",
"force",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"force\"",
":",
"force",
",",
"}",
"return",
"r",
".",
"request",
"(",
"\"post\"",
",",
"\"/2/nodes/%s/powercycle\"",
"%",
"node",
",",
"query",
... | Powercycles a node.
@type node: string
@param node: Node name
@type force: bool
@param force: Whether to force the operation
@rtype: string
@return: job id | [
"Powercycles",
"a",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L991-L1007 |
38,609 | MostAwesomeDude/gentleman | gentleman/base.py | GetNodeStorageUnits | def GetNodeStorageUnits(r, node, storage_type, output_fields):
"""
Gets the storage units for a node.
@type node: str
@param node: the node whose storage units to return
@type storage_type: str
@param storage_type: storage type whose units to return
@type output_fields: str
@param outpu... | python | def GetNodeStorageUnits(r, node, storage_type, output_fields):
"""
Gets the storage units for a node.
@type node: str
@param node: the node whose storage units to return
@type storage_type: str
@param storage_type: storage type whose units to return
@type output_fields: str
@param outpu... | [
"def",
"GetNodeStorageUnits",
"(",
"r",
",",
"node",
",",
"storage_type",
",",
"output_fields",
")",
":",
"query",
"=",
"{",
"\"storage_type\"",
":",
"storage_type",
",",
"\"output_fields\"",
":",
"output_fields",
",",
"}",
"return",
"r",
".",
"request",
"(",
... | Gets the storage units for a node.
@type node: str
@param node: the node whose storage units to return
@type storage_type: str
@param storage_type: storage type whose units to return
@type output_fields: str
@param output_fields: storage type fields to return
@rtype: int
@return: job i... | [
"Gets",
"the",
"storage",
"units",
"for",
"a",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1025-L1045 |
38,610 | MostAwesomeDude/gentleman | gentleman/base.py | ModifyNodeStorageUnits | def ModifyNodeStorageUnits(r, node, storage_type, name, allocatable=None):
"""
Modifies parameters of storage units on the node.
@type node: str
@param node: node whose storage units to modify
@type storage_type: str
@param storage_type: storage type whose units to modify
@type name: str
... | python | def ModifyNodeStorageUnits(r, node, storage_type, name, allocatable=None):
"""
Modifies parameters of storage units on the node.
@type node: str
@param node: node whose storage units to modify
@type storage_type: str
@param storage_type: storage type whose units to modify
@type name: str
... | [
"def",
"ModifyNodeStorageUnits",
"(",
"r",
",",
"node",
",",
"storage_type",
",",
"name",
",",
"allocatable",
"=",
"None",
")",
":",
"query",
"=",
"{",
"\"storage_type\"",
":",
"storage_type",
",",
"\"name\"",
":",
"name",
",",
"}",
"if",
"allocatable",
"i... | Modifies parameters of storage units on the node.
@type node: str
@param node: node whose storage units to modify
@type storage_type: str
@param storage_type: storage type whose units to modify
@type name: str
@param name: name of the storage unit
@type allocatable: bool or None
@param ... | [
"Modifies",
"parameters",
"of",
"storage",
"units",
"on",
"the",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1048-L1074 |
38,611 | MostAwesomeDude/gentleman | gentleman/base.py | RepairNodeStorageUnits | def RepairNodeStorageUnits(r, node, storage_type, name):
"""
Repairs a storage unit on the node.
@type node: str
@param node: node whose storage units to repair
@type storage_type: str
@param storage_type: storage type to repair
@type name: str
@param name: name of the storage unit to r... | python | def RepairNodeStorageUnits(r, node, storage_type, name):
"""
Repairs a storage unit on the node.
@type node: str
@param node: node whose storage units to repair
@type storage_type: str
@param storage_type: storage type to repair
@type name: str
@param name: name of the storage unit to r... | [
"def",
"RepairNodeStorageUnits",
"(",
"r",
",",
"node",
",",
"storage_type",
",",
"name",
")",
":",
"query",
"=",
"{",
"\"storage_type\"",
":",
"storage_type",
",",
"\"name\"",
":",
"name",
",",
"}",
"return",
"r",
".",
"request",
"(",
"\"put\"",
",",
"\... | Repairs a storage unit on the node.
@type node: str
@param node: node whose storage units to repair
@type storage_type: str
@param storage_type: storage type to repair
@type name: str
@param name: name of the storage unit to repair
@rtype: int
@return: job id | [
"Repairs",
"a",
"storage",
"unit",
"on",
"the",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1077-L1097 |
38,612 | MostAwesomeDude/gentleman | gentleman/base.py | AddNodeTags | def AddNodeTags(r, node, tags, dry_run=False):
"""
Adds tags to a node.
@type node: str
@param node: node to add tags to
@type tags: list of str
@param tags: tags to add to the node
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: int
@return: job id
... | python | def AddNodeTags(r, node, tags, dry_run=False):
"""
Adds tags to a node.
@type node: str
@param node: node to add tags to
@type tags: list of str
@param tags: tags to add to the node
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: int
@return: job id
... | [
"def",
"AddNodeTags",
"(",
"r",
",",
"node",
",",
"tags",
",",
"dry_run",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"tag\"",
":",
"tags",
",",
"\"dry-run\"",
":",
"dry_run",
",",
"}",
"return",
"r",
".",
"request",
"(",
"\"put\"",
",",
"\"/2/nodes... | Adds tags to a node.
@type node: str
@param node: node to add tags to
@type tags: list of str
@param tags: tags to add to the node
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: int
@return: job id | [
"Adds",
"tags",
"to",
"a",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1114-L1135 |
38,613 | MostAwesomeDude/gentleman | gentleman/base.py | DeleteNodeTags | def DeleteNodeTags(r, node, tags, dry_run=False):
"""
Delete tags from a node.
@type node: str
@param node: node to remove tags from
@type tags: list of str
@param tags: tags to remove from the node
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: int
@r... | python | def DeleteNodeTags(r, node, tags, dry_run=False):
"""
Delete tags from a node.
@type node: str
@param node: node to remove tags from
@type tags: list of str
@param tags: tags to remove from the node
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: int
@r... | [
"def",
"DeleteNodeTags",
"(",
"r",
",",
"node",
",",
"tags",
",",
"dry_run",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"tag\"",
":",
"tags",
",",
"\"dry-run\"",
":",
"dry_run",
",",
"}",
"return",
"r",
".",
"request",
"(",
"\"delete\"",
",",
"\"/2... | Delete tags from a node.
@type node: str
@param node: node to remove tags from
@type tags: list of str
@param tags: tags to remove from the node
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: int
@return: job id | [
"Delete",
"tags",
"from",
"a",
"node",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1138-L1158 |
38,614 | MostAwesomeDude/gentleman | gentleman/base.py | GetGroups | def GetGroups(r, bulk=False):
"""
Gets all node groups in the cluster.
@type bulk: bool
@param bulk: whether to return all information about the groups
@rtype: list of dict or str
@return: if bulk is true, a list of dictionaries with info about all node
groups in the cluster, else ... | python | def GetGroups(r, bulk=False):
"""
Gets all node groups in the cluster.
@type bulk: bool
@param bulk: whether to return all information about the groups
@rtype: list of dict or str
@return: if bulk is true, a list of dictionaries with info about all node
groups in the cluster, else ... | [
"def",
"GetGroups",
"(",
"r",
",",
"bulk",
"=",
"False",
")",
":",
"if",
"bulk",
":",
"return",
"r",
".",
"request",
"(",
"\"get\"",
",",
"\"/2/groups\"",
",",
"query",
"=",
"{",
"\"bulk\"",
":",
"1",
"}",
")",
"else",
":",
"groups",
"=",
"r",
".... | Gets all node groups in the cluster.
@type bulk: bool
@param bulk: whether to return all information about the groups
@rtype: list of dict or str
@return: if bulk is true, a list of dictionaries with info about all node
groups in the cluster, else a list of names of those node groups | [
"Gets",
"all",
"node",
"groups",
"in",
"the",
"cluster",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1161-L1177 |
38,615 | MostAwesomeDude/gentleman | gentleman/base.py | CreateGroup | def CreateGroup(r, name, alloc_policy=None, dry_run=False):
"""
Creates a new node group.
@type name: str
@param name: the name of node group to create
@type alloc_policy: str
@param alloc_policy: the desired allocation policy for the group, if any
@type dry_run: bool
@param dry_run: wh... | python | def CreateGroup(r, name, alloc_policy=None, dry_run=False):
"""
Creates a new node group.
@type name: str
@param name: the name of node group to create
@type alloc_policy: str
@param alloc_policy: the desired allocation policy for the group, if any
@type dry_run: bool
@param dry_run: wh... | [
"def",
"CreateGroup",
"(",
"r",
",",
"name",
",",
"alloc_policy",
"=",
"None",
",",
"dry_run",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"dry-run\"",
":",
"dry_run",
",",
"}",
"body",
"=",
"{",
"\"name\"",
":",
"name",
",",
"\"alloc_policy\"",
":",
... | Creates a new node group.
@type name: str
@param name: the name of node group to create
@type alloc_policy: str
@param alloc_policy: the desired allocation policy for the group, if any
@type dry_run: bool
@param dry_run: whether to peform a dry run
@rtype: int
@return: job id | [
"Creates",
"a",
"new",
"node",
"group",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1194-L1218 |
38,616 | MostAwesomeDude/gentleman | gentleman/base.py | DeleteGroup | def DeleteGroup(r, group, dry_run=False):
"""
Deletes a node group.
@type group: str
@param group: the node group to delete
@type dry_run: bool
@param dry_run: whether to peform a dry run
@rtype: int
@return: job id
"""
query = {
"dry-run": dry_run,
}
return r... | python | def DeleteGroup(r, group, dry_run=False):
"""
Deletes a node group.
@type group: str
@param group: the node group to delete
@type dry_run: bool
@param dry_run: whether to peform a dry run
@rtype: int
@return: job id
"""
query = {
"dry-run": dry_run,
}
return r... | [
"def",
"DeleteGroup",
"(",
"r",
",",
"group",
",",
"dry_run",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"dry-run\"",
":",
"dry_run",
",",
"}",
"return",
"r",
".",
"request",
"(",
"\"delete\"",
",",
"\"/2/groups/%s\"",
"%",
"group",
",",
"query",
"="... | Deletes a node group.
@type group: str
@param group: the node group to delete
@type dry_run: bool
@param dry_run: whether to peform a dry run
@rtype: int
@return: job id | [
"Deletes",
"a",
"node",
"group",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1236-L1253 |
38,617 | MostAwesomeDude/gentleman | gentleman/base.py | RenameGroup | def RenameGroup(r, group, new_name):
"""
Changes the name of a node group.
@type group: string
@param group: Node group name
@type new_name: string
@param new_name: New node group name
@rtype: int
@return: job id
"""
body = {
"new_name": new_name,
}
return r.r... | python | def RenameGroup(r, group, new_name):
"""
Changes the name of a node group.
@type group: string
@param group: Node group name
@type new_name: string
@param new_name: New node group name
@rtype: int
@return: job id
"""
body = {
"new_name": new_name,
}
return r.r... | [
"def",
"RenameGroup",
"(",
"r",
",",
"group",
",",
"new_name",
")",
":",
"body",
"=",
"{",
"\"new_name\"",
":",
"new_name",
",",
"}",
"return",
"r",
".",
"request",
"(",
"\"put\"",
",",
"\"/2/groups/%s/rename\"",
"%",
"group",
",",
"content",
"=",
"body"... | Changes the name of a node group.
@type group: string
@param group: Node group name
@type new_name: string
@param new_name: New node group name
@rtype: int
@return: job id | [
"Changes",
"the",
"name",
"of",
"a",
"node",
"group",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1256-L1273 |
38,618 | MostAwesomeDude/gentleman | gentleman/base.py | AssignGroupNodes | def AssignGroupNodes(r, group, nodes, force=False, dry_run=False):
"""
Assigns nodes to a group.
@type group: string
@param group: Node gropu name
@type nodes: list of strings
@param nodes: List of nodes to assign to the group
@rtype: int
@return: job id
"""
query = {
... | python | def AssignGroupNodes(r, group, nodes, force=False, dry_run=False):
"""
Assigns nodes to a group.
@type group: string
@param group: Node gropu name
@type nodes: list of strings
@param nodes: List of nodes to assign to the group
@rtype: int
@return: job id
"""
query = {
... | [
"def",
"AssignGroupNodes",
"(",
"r",
",",
"group",
",",
"nodes",
",",
"force",
"=",
"False",
",",
"dry_run",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"force\"",
":",
"force",
",",
"\"dry-run\"",
":",
"dry_run",
",",
"}",
"body",
"=",
"{",
"\"node... | Assigns nodes to a group.
@type group: string
@param group: Node gropu name
@type nodes: list of strings
@param nodes: List of nodes to assign to the group
@rtype: int
@return: job id | [
"Assigns",
"nodes",
"to",
"a",
"group",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1277-L1301 |
38,619 | MostAwesomeDude/gentleman | gentleman/base.py | AddGroupTags | def AddGroupTags(r, group, tags, dry_run=False):
"""
Adds tags to a node group.
@type group: str
@param group: group to add tags to
@type tags: list of string
@param tags: tags to add to the group
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: string
@... | python | def AddGroupTags(r, group, tags, dry_run=False):
"""
Adds tags to a node group.
@type group: str
@param group: group to add tags to
@type tags: list of string
@param tags: tags to add to the group
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: string
@... | [
"def",
"AddGroupTags",
"(",
"r",
",",
"group",
",",
"tags",
",",
"dry_run",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"dry-run\"",
":",
"dry_run",
",",
"\"tag\"",
":",
"tags",
",",
"}",
"return",
"r",
".",
"request",
"(",
"\"put\"",
",",
"\"/2/gro... | Adds tags to a node group.
@type group: str
@param group: group to add tags to
@type tags: list of string
@param tags: tags to add to the group
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: string
@return: job id | [
"Adds",
"tags",
"to",
"a",
"node",
"group",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1318-L1338 |
38,620 | MostAwesomeDude/gentleman | gentleman/base.py | DeleteGroupTags | def DeleteGroupTags(r, group, tags, dry_run=False):
"""
Deletes tags from a node group.
@type group: str
@param group: group to delete tags from
@type tags: list of string
@param tags: tags to delete
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: string
... | python | def DeleteGroupTags(r, group, tags, dry_run=False):
"""
Deletes tags from a node group.
@type group: str
@param group: group to delete tags from
@type tags: list of string
@param tags: tags to delete
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: string
... | [
"def",
"DeleteGroupTags",
"(",
"r",
",",
"group",
",",
"tags",
",",
"dry_run",
"=",
"False",
")",
":",
"query",
"=",
"{",
"\"dry-run\"",
":",
"dry_run",
",",
"\"tag\"",
":",
"tags",
",",
"}",
"return",
"r",
".",
"request",
"(",
"\"delete\"",
",",
"\"... | Deletes tags from a node group.
@type group: str
@param group: group to delete tags from
@type tags: list of string
@param tags: tags to delete
@type dry_run: bool
@param dry_run: whether to perform a dry run
@rtype: string
@return: job id | [
"Deletes",
"tags",
"from",
"a",
"node",
"group",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1341-L1360 |
38,621 | MostAwesomeDude/gentleman | gentleman/base.py | Query | def Query(r, what, fields, qfilter=None):
"""
Retrieves information about resources.
@type what: string
@param what: Resource name, one of L{constants.QR_VIA_RAPI}
@type fields: list of string
@param fields: Requested fields
@type qfilter: None or list
@param qfilter: Query filter
... | python | def Query(r, what, fields, qfilter=None):
"""
Retrieves information about resources.
@type what: string
@param what: Resource name, one of L{constants.QR_VIA_RAPI}
@type fields: list of string
@param fields: Requested fields
@type qfilter: None or list
@param qfilter: Query filter
... | [
"def",
"Query",
"(",
"r",
",",
"what",
",",
"fields",
",",
"qfilter",
"=",
"None",
")",
":",
"body",
"=",
"{",
"\"fields\"",
":",
"fields",
",",
"}",
"if",
"qfilter",
"is",
"not",
"None",
":",
"body",
"[",
"\"qfilter\"",
"]",
"=",
"body",
"[",
"\... | Retrieves information about resources.
@type what: string
@param what: Resource name, one of L{constants.QR_VIA_RAPI}
@type fields: list of string
@param fields: Requested fields
@type qfilter: None or list
@param qfilter: Query filter
@rtype: string
@return: job id | [
"Retrieves",
"information",
"about",
"resources",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1363-L1385 |
38,622 | MostAwesomeDude/gentleman | gentleman/base.py | QueryFields | def QueryFields(r, what, fields=None):
"""
Retrieves available fields for a resource.
@type what: string
@param what: Resource name, one of L{constants.QR_VIA_RAPI}
@type fields: list of string
@param fields: Requested fields
@rtype: string
@return: job id
"""
query = {}
... | python | def QueryFields(r, what, fields=None):
"""
Retrieves available fields for a resource.
@type what: string
@param what: Resource name, one of L{constants.QR_VIA_RAPI}
@type fields: list of string
@param fields: Requested fields
@rtype: string
@return: job id
"""
query = {}
... | [
"def",
"QueryFields",
"(",
"r",
",",
"what",
",",
"fields",
"=",
"None",
")",
":",
"query",
"=",
"{",
"}",
"if",
"fields",
"is",
"not",
"None",
":",
"query",
"[",
"\"fields\"",
"]",
"=",
"\",\"",
".",
"join",
"(",
"fields",
")",
"return",
"r",
".... | Retrieves available fields for a resource.
@type what: string
@param what: Resource name, one of L{constants.QR_VIA_RAPI}
@type fields: list of string
@param fields: Requested fields
@rtype: string
@return: job id | [
"Retrieves",
"available",
"fields",
"for",
"a",
"resource",
"."
] | 17fb8ffb922aa4af9d8bcab85e452c9311d41805 | https://github.com/MostAwesomeDude/gentleman/blob/17fb8ffb922aa4af9d8bcab85e452c9311d41805/gentleman/base.py#L1388-L1406 |
38,623 | GeorgeArgyros/symautomata | symautomata/alphabet.py | createalphabet | def createalphabet(alphabetinput=None):
"""
Creates a sample alphabet containing printable ASCII characters
"""
if alphabetinput and os.path.isfile(alphabetinput):
return _load_alphabet(alphabetinput)
elif alphabetinput:
alpha = []
setlist = alphabetinput.split(',')
f... | python | def createalphabet(alphabetinput=None):
"""
Creates a sample alphabet containing printable ASCII characters
"""
if alphabetinput and os.path.isfile(alphabetinput):
return _load_alphabet(alphabetinput)
elif alphabetinput:
alpha = []
setlist = alphabetinput.split(',')
f... | [
"def",
"createalphabet",
"(",
"alphabetinput",
"=",
"None",
")",
":",
"if",
"alphabetinput",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"alphabetinput",
")",
":",
"return",
"_load_alphabet",
"(",
"alphabetinput",
")",
"elif",
"alphabetinput",
":",
"alpha",
... | Creates a sample alphabet containing printable ASCII characters | [
"Creates",
"a",
"sample",
"alphabet",
"containing",
"printable",
"ASCII",
"characters"
] | f5d66533573b27e155bec3f36b8c00b8e3937cb3 | https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/alphabet.py#L14-L32 |
38,624 | binbrain/OpenSesame | OpenSesame/searchable.py | Searchable._instant_search | def _instant_search(self):
"""Determine possible keys after a push or pop
"""
_keys = []
for k,v in self.searchables.iteritems():
if self.string in v:
_keys.append(k)
self.candidates.append(_keys) | python | def _instant_search(self):
"""Determine possible keys after a push or pop
"""
_keys = []
for k,v in self.searchables.iteritems():
if self.string in v:
_keys.append(k)
self.candidates.append(_keys) | [
"def",
"_instant_search",
"(",
"self",
")",
":",
"_keys",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"self",
".",
"searchables",
".",
"iteritems",
"(",
")",
":",
"if",
"self",
".",
"string",
"in",
"v",
":",
"_keys",
".",
"append",
"(",
"k",
")",
... | Determine possible keys after a push or pop | [
"Determine",
"possible",
"keys",
"after",
"a",
"push",
"or",
"pop"
] | e32c306385012646400ecb49fc65c64b14ce3a93 | https://github.com/binbrain/OpenSesame/blob/e32c306385012646400ecb49fc65c64b14ce3a93/OpenSesame/searchable.py#L25-L32 |
38,625 | binbrain/OpenSesame | OpenSesame/searchable.py | Searchable.best_guess | def best_guess(self):
"""Return the gnomekeyring position of the closest matching
"""
best_guess_ever = (0, 0) # (key, string)
points = defaultdict(float)
points[0] = 0
if len(self.string) > 0:
for key in self.candidate_keys:
guess = self.searc... | python | def best_guess(self):
"""Return the gnomekeyring position of the closest matching
"""
best_guess_ever = (0, 0) # (key, string)
points = defaultdict(float)
points[0] = 0
if len(self.string) > 0:
for key in self.candidate_keys:
guess = self.searc... | [
"def",
"best_guess",
"(",
"self",
")",
":",
"best_guess_ever",
"=",
"(",
"0",
",",
"0",
")",
"# (key, string)",
"points",
"=",
"defaultdict",
"(",
"float",
")",
"points",
"[",
"0",
"]",
"=",
"0",
"if",
"len",
"(",
"self",
".",
"string",
")",
">",
"... | Return the gnomekeyring position of the closest matching | [
"Return",
"the",
"gnomekeyring",
"position",
"of",
"the",
"closest",
"matching"
] | e32c306385012646400ecb49fc65c64b14ce3a93 | https://github.com/binbrain/OpenSesame/blob/e32c306385012646400ecb49fc65c64b14ce3a93/OpenSesame/searchable.py#L34-L61 |
38,626 | Vesuvium/lektor-htmlmin | lektor_htmlmin.py | HTMLMinPlugin.find_html_files | def find_html_files(self, destination):
"""
Finds all html files in the given destination.
"""
for root, dirs, files in os.walk(destination):
for f in files:
if f.endswith('.html'):
yield os.path.join(root, f) | python | def find_html_files(self, destination):
"""
Finds all html files in the given destination.
"""
for root, dirs, files in os.walk(destination):
for f in files:
if f.endswith('.html'):
yield os.path.join(root, f) | [
"def",
"find_html_files",
"(",
"self",
",",
"destination",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"destination",
")",
":",
"for",
"f",
"in",
"files",
":",
"if",
"f",
".",
"endswith",
"(",
"'.html'",
")",
"... | Finds all html files in the given destination. | [
"Finds",
"all",
"html",
"files",
"in",
"the",
"given",
"destination",
"."
] | 160756b5d8e608523a2916cbc830ed6eec1fcb48 | https://github.com/Vesuvium/lektor-htmlmin/blob/160756b5d8e608523a2916cbc830ed6eec1fcb48/lektor_htmlmin.py#L33-L40 |
38,627 | Vesuvium/lektor-htmlmin | lektor_htmlmin.py | HTMLMinPlugin.minify_file | def minify_file(self, target):
"""
Minifies the target html file.
"""
html = open(target, 'rb').read()
enc = chardet.detect(html)['encoding']
with codecs.open(target, 'r+', enc) as f:
result = htmlmin.minify(f.read(), **self.options)
f.seek(0)
... | python | def minify_file(self, target):
"""
Minifies the target html file.
"""
html = open(target, 'rb').read()
enc = chardet.detect(html)['encoding']
with codecs.open(target, 'r+', enc) as f:
result = htmlmin.minify(f.read(), **self.options)
f.seek(0)
... | [
"def",
"minify_file",
"(",
"self",
",",
"target",
")",
":",
"html",
"=",
"open",
"(",
"target",
",",
"'rb'",
")",
".",
"read",
"(",
")",
"enc",
"=",
"chardet",
".",
"detect",
"(",
"html",
")",
"[",
"'encoding'",
"]",
"with",
"codecs",
".",
"open",
... | Minifies the target html file. | [
"Minifies",
"the",
"target",
"html",
"file",
"."
] | 160756b5d8e608523a2916cbc830ed6eec1fcb48 | https://github.com/Vesuvium/lektor-htmlmin/blob/160756b5d8e608523a2916cbc830ed6eec1fcb48/lektor_htmlmin.py#L42-L52 |
38,628 | Vesuvium/lektor-htmlmin | lektor_htmlmin.py | HTMLMinPlugin.on_after_build_all | def on_after_build_all(self, builder, **extra):
"""
after-build-all lektor event
"""
# NOTE(vesuvium): compatibility for lektor 2.X and 3.X
try:
is_enabled = self.is_enabled(builder.build_flags)
except AttributeError:
is_enabled = self.is_enabled(b... | python | def on_after_build_all(self, builder, **extra):
"""
after-build-all lektor event
"""
# NOTE(vesuvium): compatibility for lektor 2.X and 3.X
try:
is_enabled = self.is_enabled(builder.build_flags)
except AttributeError:
is_enabled = self.is_enabled(b... | [
"def",
"on_after_build_all",
"(",
"self",
",",
"builder",
",",
"*",
"*",
"extra",
")",
":",
"# NOTE(vesuvium): compatibility for lektor 2.X and 3.X",
"try",
":",
"is_enabled",
"=",
"self",
".",
"is_enabled",
"(",
"builder",
".",
"build_flags",
")",
"except",
"Attr... | after-build-all lektor event | [
"after",
"-",
"build",
"-",
"all",
"lektor",
"event"
] | 160756b5d8e608523a2916cbc830ed6eec1fcb48 | https://github.com/Vesuvium/lektor-htmlmin/blob/160756b5d8e608523a2916cbc830ed6eec1fcb48/lektor_htmlmin.py#L54-L70 |
38,629 | standage/tag | tag/select.py | features | def features(entrystream, type=None, traverse=False):
"""
Pull features out of the specified entry stream.
:param entrystream: a stream of entries
:param type: retrieve only features of the specified type; set to
:code:`None` to retrieve all features
:param traverse: by default, on... | python | def features(entrystream, type=None, traverse=False):
"""
Pull features out of the specified entry stream.
:param entrystream: a stream of entries
:param type: retrieve only features of the specified type; set to
:code:`None` to retrieve all features
:param traverse: by default, on... | [
"def",
"features",
"(",
"entrystream",
",",
"type",
"=",
"None",
",",
"traverse",
"=",
"False",
")",
":",
"for",
"feature",
"in",
"entry_type_filter",
"(",
"entrystream",
",",
"tag",
".",
"Feature",
")",
":",
"if",
"traverse",
":",
"if",
"type",
"is",
... | Pull features out of the specified entry stream.
:param entrystream: a stream of entries
:param type: retrieve only features of the specified type; set to
:code:`None` to retrieve all features
:param traverse: by default, only top-level features are selected; set
to :c... | [
"Pull",
"features",
"out",
"of",
"the",
"specified",
"entry",
"stream",
"."
] | 94686adf57115cea1c5235e99299e691f80ba10b | https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/select.py#L13-L37 |
38,630 | standage/tag | tag/select.py | window | def window(featurestream, seqid, start=None, end=None, strict=True):
"""
Pull features out of the designated genomic interval.
This function uses 0-based half-open intervals, not the 1-based closed
intervals used by GFF3.
:param featurestream: a stream of feature entries
:param seqid: ID of th... | python | def window(featurestream, seqid, start=None, end=None, strict=True):
"""
Pull features out of the designated genomic interval.
This function uses 0-based half-open intervals, not the 1-based closed
intervals used by GFF3.
:param featurestream: a stream of feature entries
:param seqid: ID of th... | [
"def",
"window",
"(",
"featurestream",
",",
"seqid",
",",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"strict",
"=",
"True",
")",
":",
"region",
"=",
"None",
"if",
"start",
"and",
"end",
":",
"region",
"=",
"tag",
".",
"Range",
"(",
"start"... | Pull features out of the designated genomic interval.
This function uses 0-based half-open intervals, not the 1-based closed
intervals used by GFF3.
:param featurestream: a stream of feature entries
:param seqid: ID of the sequence from which to select features
:param start: start of the genomic i... | [
"Pull",
"features",
"out",
"of",
"the",
"designated",
"genomic",
"interval",
"."
] | 94686adf57115cea1c5235e99299e691f80ba10b | https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/select.py#L40-L70 |
38,631 | standage/tag | tag/select.py | directives | def directives(entrystream, type=None):
"""
Pull directives out of the specified entry stream.
:param entrystream: a stream of entries
:param type: retrieve only directives of the specified type; set to
:code:`None` to retrieve all directives
"""
for directive in entry_type_fil... | python | def directives(entrystream, type=None):
"""
Pull directives out of the specified entry stream.
:param entrystream: a stream of entries
:param type: retrieve only directives of the specified type; set to
:code:`None` to retrieve all directives
"""
for directive in entry_type_fil... | [
"def",
"directives",
"(",
"entrystream",
",",
"type",
"=",
"None",
")",
":",
"for",
"directive",
"in",
"entry_type_filter",
"(",
"entrystream",
",",
"tag",
".",
"Directive",
")",
":",
"if",
"not",
"type",
"or",
"type",
"==",
"directive",
".",
"type",
":"... | Pull directives out of the specified entry stream.
:param entrystream: a stream of entries
:param type: retrieve only directives of the specified type; set to
:code:`None` to retrieve all directives | [
"Pull",
"directives",
"out",
"of",
"the",
"specified",
"entry",
"stream",
"."
] | 94686adf57115cea1c5235e99299e691f80ba10b | https://github.com/standage/tag/blob/94686adf57115cea1c5235e99299e691f80ba10b/tag/select.py#L73-L83 |
38,632 | HPCC-Cloud-Computing/CAL | calplus/v1/utils.py | validate_driver | def validate_driver(f):
"""Check driver on"""
def check_driver(request):
drivers = get_all_driver()
drivers = filter(drivers, request)
if drivers:
return f(request, drivers)
else:
raise Exception('Driver is not found')
return check_driver | python | def validate_driver(f):
"""Check driver on"""
def check_driver(request):
drivers = get_all_driver()
drivers = filter(drivers, request)
if drivers:
return f(request, drivers)
else:
raise Exception('Driver is not found')
return check_driver | [
"def",
"validate_driver",
"(",
"f",
")",
":",
"def",
"check_driver",
"(",
"request",
")",
":",
"drivers",
"=",
"get_all_driver",
"(",
")",
"drivers",
"=",
"filter",
"(",
"drivers",
",",
"request",
")",
"if",
"drivers",
":",
"return",
"f",
"(",
"request",... | Check driver on | [
"Check",
"driver",
"on"
] | 7134b3dfe9ee3a383506a592765c7a12fa4ca1e9 | https://github.com/HPCC-Cloud-Computing/CAL/blob/7134b3dfe9ee3a383506a592765c7a12fa4ca1e9/calplus/v1/utils.py#L15-L27 |
38,633 | singularitti/scientific-string | scientific_string/strings.py | strings_to_integers | def strings_to_integers(strings: Iterable[str]) -> Iterable[int]:
"""
Convert a list of strings to a list of integers.
:param strings: a list of string
:return: a list of converted integers
.. doctest::
>>> strings_to_integers(['1', '1.0', '-0.2'])
[1, 1, 0]
"""
return str... | python | def strings_to_integers(strings: Iterable[str]) -> Iterable[int]:
"""
Convert a list of strings to a list of integers.
:param strings: a list of string
:return: a list of converted integers
.. doctest::
>>> strings_to_integers(['1', '1.0', '-0.2'])
[1, 1, 0]
"""
return str... | [
"def",
"strings_to_integers",
"(",
"strings",
":",
"Iterable",
"[",
"str",
"]",
")",
"->",
"Iterable",
"[",
"int",
"]",
":",
"return",
"strings_to_",
"(",
"strings",
",",
"lambda",
"x",
":",
"int",
"(",
"float",
"(",
"x",
")",
")",
")"
] | Convert a list of strings to a list of integers.
:param strings: a list of string
:return: a list of converted integers
.. doctest::
>>> strings_to_integers(['1', '1.0', '-0.2'])
[1, 1, 0] | [
"Convert",
"a",
"list",
"of",
"strings",
"to",
"a",
"list",
"of",
"integers",
"."
] | 615dca747e8fb1e89ed1d9f18aef4066295a17a9 | https://github.com/singularitti/scientific-string/blob/615dca747e8fb1e89ed1d9f18aef4066295a17a9/scientific_string/strings.py#L39-L51 |
38,634 | singularitti/scientific-string | scientific_string/strings.py | string_to_double_precision_float | def string_to_double_precision_float(s: str) -> float:
"""
Double precision float in Fortran file will have form 'x.ydz' or 'x.yDz', this cannot be convert directly to float
by Python ``float`` function, so I wrote this function to help conversion. For example,
:param s: a string denoting a double prec... | python | def string_to_double_precision_float(s: str) -> float:
"""
Double precision float in Fortran file will have form 'x.ydz' or 'x.yDz', this cannot be convert directly to float
by Python ``float`` function, so I wrote this function to help conversion. For example,
:param s: a string denoting a double prec... | [
"def",
"string_to_double_precision_float",
"(",
"s",
":",
"str",
")",
"->",
"float",
":",
"first",
",",
"second",
",",
"exponential",
"=",
"re",
".",
"match",
"(",
"\"(-?\\d*)\\.?(-?\\d*)d(-?\\d+)\"",
",",
"s",
",",
"re",
".",
"IGNORECASE",
")",
".",
"groups... | Double precision float in Fortran file will have form 'x.ydz' or 'x.yDz', this cannot be convert directly to float
by Python ``float`` function, so I wrote this function to help conversion. For example,
:param s: a string denoting a double precision number
:return: a Python floating point number
.. do... | [
"Double",
"precision",
"float",
"in",
"Fortran",
"file",
"will",
"have",
"form",
"x",
".",
"ydz",
"or",
"x",
".",
"yDz",
"this",
"cannot",
"be",
"convert",
"directly",
"to",
"float",
"by",
"Python",
"float",
"function",
"so",
"I",
"wrote",
"this",
"funct... | 615dca747e8fb1e89ed1d9f18aef4066295a17a9 | https://github.com/singularitti/scientific-string/blob/615dca747e8fb1e89ed1d9f18aef4066295a17a9/scientific_string/strings.py#L69-L90 |
38,635 | singularitti/scientific-string | scientific_string/strings.py | string_to_general_float | def string_to_general_float(s: str) -> float:
"""
Convert a string to corresponding single or double precision scientific number.
:param s: a string could be '0.1', '1e-5', '1.0D-5', or any other validated number
:return: a float or raise an error
.. doctest::
>>> string_to_general_float(... | python | def string_to_general_float(s: str) -> float:
"""
Convert a string to corresponding single or double precision scientific number.
:param s: a string could be '0.1', '1e-5', '1.0D-5', or any other validated number
:return: a float or raise an error
.. doctest::
>>> string_to_general_float(... | [
"def",
"string_to_general_float",
"(",
"s",
":",
"str",
")",
"->",
"float",
":",
"if",
"'D'",
"in",
"s",
".",
"upper",
"(",
")",
":",
"# Possible double precision number",
"try",
":",
"return",
"string_to_double_precision_float",
"(",
"s",
")",
"except",
"Valu... | Convert a string to corresponding single or double precision scientific number.
:param s: a string could be '0.1', '1e-5', '1.0D-5', or any other validated number
:return: a float or raise an error
.. doctest::
>>> string_to_general_float('1.0D-5')
1e-05
>>> string_to_general_floa... | [
"Convert",
"a",
"string",
"to",
"corresponding",
"single",
"or",
"double",
"precision",
"scientific",
"number",
"."
] | 615dca747e8fb1e89ed1d9f18aef4066295a17a9 | https://github.com/singularitti/scientific-string/blob/615dca747e8fb1e89ed1d9f18aef4066295a17a9/scientific_string/strings.py#L93-L120 |
38,636 | singularitti/scientific-string | scientific_string/strings.py | match_one_string | def match_one_string(pattern: str, s: str, *args):
"""
Make sure you know only none or one string will be matched! If you are not sure, use `match_one_pattern` instead.
:param pattern:
:param s:
:param args:
:return:
.. doctest::
>>> p = "\d+"
>>> s = "abc 123 def"
... | python | def match_one_string(pattern: str, s: str, *args):
"""
Make sure you know only none or one string will be matched! If you are not sure, use `match_one_pattern` instead.
:param pattern:
:param s:
:param args:
:return:
.. doctest::
>>> p = "\d+"
>>> s = "abc 123 def"
... | [
"def",
"match_one_string",
"(",
"pattern",
":",
"str",
",",
"s",
":",
"str",
",",
"*",
"args",
")",
":",
"try",
":",
"# `match` is either an empty list or a list of string.",
"match",
",",
"=",
"re",
".",
"findall",
"(",
"pattern",
",",
"s",
")",
"if",
"le... | Make sure you know only none or one string will be matched! If you are not sure, use `match_one_pattern` instead.
:param pattern:
:param s:
:param args:
:return:
.. doctest::
>>> p = "\d+"
>>> s = "abc 123 def"
>>> match_one_string(p, s, int)
123
>>> print(... | [
"Make",
"sure",
"you",
"know",
"only",
"none",
"or",
"one",
"string",
"will",
"be",
"matched!",
"If",
"you",
"are",
"not",
"sure",
"use",
"match_one_pattern",
"instead",
"."
] | 615dca747e8fb1e89ed1d9f18aef4066295a17a9 | https://github.com/singularitti/scientific-string/blob/615dca747e8fb1e89ed1d9f18aef4066295a17a9/scientific_string/strings.py#L123-L158 |
38,637 | singularitti/scientific-string | scientific_string/strings.py | match_one_pattern | def match_one_pattern(pattern: str, s: str, *args: Optional[Callable], **flags):
"""
Find a pattern in a certain string. If found and a wrapper is given, then return the wrapped matched-string; if no
wrapper is given, return the pure matched string. If no match is found, return None.
:param pattern: a ... | python | def match_one_pattern(pattern: str, s: str, *args: Optional[Callable], **flags):
"""
Find a pattern in a certain string. If found and a wrapper is given, then return the wrapped matched-string; if no
wrapper is given, return the pure matched string. If no match is found, return None.
:param pattern: a ... | [
"def",
"match_one_pattern",
"(",
"pattern",
":",
"str",
",",
"s",
":",
"str",
",",
"*",
"args",
":",
"Optional",
"[",
"Callable",
"]",
",",
"*",
"*",
"flags",
")",
":",
"match",
":",
"Optional",
"[",
"List",
"[",
"str",
"]",
"]",
"=",
"re",
".",
... | Find a pattern in a certain string. If found and a wrapper is given, then return the wrapped matched-string; if no
wrapper is given, return the pure matched string. If no match is found, return None.
:param pattern: a pattern, can be a string or a regular expression
:param s: a string
:param args: at m... | [
"Find",
"a",
"pattern",
"in",
"a",
"certain",
"string",
".",
"If",
"found",
"and",
"a",
"wrapper",
"is",
"given",
"then",
"return",
"the",
"wrapped",
"matched",
"-",
"string",
";",
"if",
"no",
"wrapper",
"is",
"given",
"return",
"the",
"pure",
"matched",... | 615dca747e8fb1e89ed1d9f18aef4066295a17a9 | https://github.com/singularitti/scientific-string/blob/615dca747e8fb1e89ed1d9f18aef4066295a17a9/scientific_string/strings.py#L161-L201 |
38,638 | singularitti/scientific-string | scientific_string/strings.py | all_string_like | def all_string_like(iterable: Iterable[object]) -> bool:
"""
If any element of an iterable is not a string, return `True`.
:param iterable: Can be a set, a tuple, a list, etc.
:return: Whether any element of an iterable is not a string.
.. doctest::
>>> all_string_like(['a', 'b', 'c', 3])... | python | def all_string_like(iterable: Iterable[object]) -> bool:
"""
If any element of an iterable is not a string, return `True`.
:param iterable: Can be a set, a tuple, a list, etc.
:return: Whether any element of an iterable is not a string.
.. doctest::
>>> all_string_like(['a', 'b', 'c', 3])... | [
"def",
"all_string_like",
"(",
"iterable",
":",
"Iterable",
"[",
"object",
"]",
")",
"->",
"bool",
":",
"return",
"all",
"(",
"is_string_like",
"(",
"_",
")",
"for",
"_",
"in",
"iterable",
")"
] | If any element of an iterable is not a string, return `True`.
:param iterable: Can be a set, a tuple, a list, etc.
:return: Whether any element of an iterable is not a string.
.. doctest::
>>> all_string_like(['a', 'b', 'c', 3])
False
>>> all_string_like(('a', 'b', 'c', 'd'))
... | [
"If",
"any",
"element",
"of",
"an",
"iterable",
"is",
"not",
"a",
"string",
"return",
"True",
"."
] | 615dca747e8fb1e89ed1d9f18aef4066295a17a9 | https://github.com/singularitti/scientific-string/blob/615dca747e8fb1e89ed1d9f18aef4066295a17a9/scientific_string/strings.py#L221-L235 |
38,639 | pauleveritt/kaybee | kaybee/plugins/articles/image_type.py | ImageModel.source_filename | def source_filename(self, docname: str, srcdir: str):
""" Get the full filename to referenced image """
docpath = Path(srcdir, docname)
parent = docpath.parent
imgpath = parent.joinpath(self.filename)
# Does this exist?
if not imgpath.exists():
msg = f'Image... | python | def source_filename(self, docname: str, srcdir: str):
""" Get the full filename to referenced image """
docpath = Path(srcdir, docname)
parent = docpath.parent
imgpath = parent.joinpath(self.filename)
# Does this exist?
if not imgpath.exists():
msg = f'Image... | [
"def",
"source_filename",
"(",
"self",
",",
"docname",
":",
"str",
",",
"srcdir",
":",
"str",
")",
":",
"docpath",
"=",
"Path",
"(",
"srcdir",
",",
"docname",
")",
"parent",
"=",
"docpath",
".",
"parent",
"imgpath",
"=",
"parent",
".",
"joinpath",
"(",... | Get the full filename to referenced image | [
"Get",
"the",
"full",
"filename",
"to",
"referenced",
"image"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/image_type.py#L23-L35 |
38,640 | pauleveritt/kaybee | kaybee/plugins/articles/image_type.py | ImageModel.env_updated | def env_updated(self,
kb_app,
sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
resource
):
""" Make images and enter them in Sphinx's output writer """
docname = resource.docname
srcdir = sphinx... | python | def env_updated(self,
kb_app,
sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
resource
):
""" Make images and enter them in Sphinx's output writer """
docname = resource.docname
srcdir = sphinx... | [
"def",
"env_updated",
"(",
"self",
",",
"kb_app",
",",
"sphinx_app",
":",
"Sphinx",
",",
"sphinx_env",
":",
"BuildEnvironment",
",",
"resource",
")",
":",
"docname",
"=",
"resource",
".",
"docname",
"srcdir",
"=",
"sphinx_app",
".",
"env",
".",
"srcdir",
"... | Make images and enter them in Sphinx's output writer | [
"Make",
"images",
"and",
"enter",
"them",
"in",
"Sphinx",
"s",
"output",
"writer"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/articles/image_type.py#L37-L61 |
38,641 | codeforamerica/epa_python | epa/envirofacts/envirofacts_api.py | Envirofacts.catalog | def catalog(self, table='', column=''):
"""Lookup the values available for querying."""
lookup_table = self.lookup_table
if lookup_table is not None:
if table:
if column:
column = column.upper()
return lookup_table[table][column... | python | def catalog(self, table='', column=''):
"""Lookup the values available for querying."""
lookup_table = self.lookup_table
if lookup_table is not None:
if table:
if column:
column = column.upper()
return lookup_table[table][column... | [
"def",
"catalog",
"(",
"self",
",",
"table",
"=",
"''",
",",
"column",
"=",
"''",
")",
":",
"lookup_table",
"=",
"self",
".",
"lookup_table",
"if",
"lookup_table",
"is",
"not",
"None",
":",
"if",
"table",
":",
"if",
"column",
":",
"column",
"=",
"col... | Lookup the values available for querying. | [
"Lookup",
"the",
"values",
"available",
"for",
"querying",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/envirofacts/envirofacts_api.py#L29-L40 |
38,642 | codeforamerica/epa_python | epa/envirofacts/envirofacts_api.py | Envirofacts._resolve_call | def _resolve_call(self, table, column='', value='', **kwargs):
"""Internal method to resolve the API wrapper call."""
if not column:
return self.catalog(table)
elif not value:
return self.catalog(table, column)
# We have all the table, column, and value, and now n... | python | def _resolve_call(self, table, column='', value='', **kwargs):
"""Internal method to resolve the API wrapper call."""
if not column:
return self.catalog(table)
elif not value:
return self.catalog(table, column)
# We have all the table, column, and value, and now n... | [
"def",
"_resolve_call",
"(",
"self",
",",
"table",
",",
"column",
"=",
"''",
",",
"value",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"column",
":",
"return",
"self",
".",
"catalog",
"(",
"table",
")",
"elif",
"not",
"value",
":",
... | Internal method to resolve the API wrapper call. | [
"Internal",
"method",
"to",
"resolve",
"the",
"API",
"wrapper",
"call",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/envirofacts/envirofacts_api.py#L42-L56 |
38,643 | codeforamerica/epa_python | epa/envirofacts/envirofacts_api.py | Envirofacts.call_api | def call_api(self, table, column, value, **kwargs):
"""Exposed method to connect and query the EPA's API."""
try:
output_format = kwargs.pop('output_format')
except KeyError:
output_format = self.output_format
url_list = [self.base_url, table, column,
... | python | def call_api(self, table, column, value, **kwargs):
"""Exposed method to connect and query the EPA's API."""
try:
output_format = kwargs.pop('output_format')
except KeyError:
output_format = self.output_format
url_list = [self.base_url, table, column,
... | [
"def",
"call_api",
"(",
"self",
",",
"table",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"output_format",
"=",
"kwargs",
".",
"pop",
"(",
"'output_format'",
")",
"except",
"KeyError",
":",
"output_format",
"=",
"self",
... | Exposed method to connect and query the EPA's API. | [
"Exposed",
"method",
"to",
"connect",
"and",
"query",
"the",
"EPA",
"s",
"API",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/envirofacts/envirofacts_api.py#L58-L71 |
38,644 | codeforamerica/epa_python | epa/envirofacts/envirofacts_api.py | Envirofacts._number_of_rows | def _number_of_rows(self, start=0, count=100, **kwargs):
"""Internal method to format the number of rows the EPA API returns."""
first = str(start)
last = str(start + count)
string_format = ':'.join([first, last])
return string_format | python | def _number_of_rows(self, start=0, count=100, **kwargs):
"""Internal method to format the number of rows the EPA API returns."""
first = str(start)
last = str(start + count)
string_format = ':'.join([first, last])
return string_format | [
"def",
"_number_of_rows",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"100",
",",
"*",
"*",
"kwargs",
")",
":",
"first",
"=",
"str",
"(",
"start",
")",
"last",
"=",
"str",
"(",
"start",
"+",
"count",
")",
"string_format",
"=",
"':'",
... | Internal method to format the number of rows the EPA API returns. | [
"Internal",
"method",
"to",
"format",
"the",
"number",
"of",
"rows",
"the",
"EPA",
"API",
"returns",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/envirofacts/envirofacts_api.py#L73-L78 |
38,645 | pauleveritt/kaybee | kaybee/plugins/references/container.py | ReferencesContainer.resource_references | def resource_references(self, resource) -> Mapping[str, List[Any]]:
""" Resolve and return reference resources pointed to by object
Fields in resource.props can flag that they are references by
using the references type. This method scans the model,
finds any fields that are referenc... | python | def resource_references(self, resource) -> Mapping[str, List[Any]]:
""" Resolve and return reference resources pointed to by object
Fields in resource.props can flag that they are references by
using the references type. This method scans the model,
finds any fields that are referenc... | [
"def",
"resource_references",
"(",
"self",
",",
"resource",
")",
"->",
"Mapping",
"[",
"str",
",",
"List",
"[",
"Any",
"]",
"]",
":",
"references",
"=",
"dict",
"(",
")",
"for",
"reference_label",
"in",
"resource",
".",
"props",
".",
"references",
":",
... | Resolve and return reference resources pointed to by object
Fields in resource.props can flag that they are references by
using the references type. This method scans the model,
finds any fields that are references, and returns the
reference resources pointed to by those references.... | [
"Resolve",
"and",
"return",
"reference",
"resources",
"pointed",
"to",
"by",
"object"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/references/container.py#L41-L66 |
38,646 | invinst/ResponseBot | responsebot/responsebot_stream.py | ResponseBotStream.start | def start(self, retry_limit=None):
"""
Try to connect to Twitter's streaming API.
:param retry_limit: The maximum number of retries in case of failures. Default is None (unlimited)
:raises :class:`~tweepy.error.TweepyError`: If there's some critical API error
"""
# Run t... | python | def start(self, retry_limit=None):
"""
Try to connect to Twitter's streaming API.
:param retry_limit: The maximum number of retries in case of failures. Default is None (unlimited)
:raises :class:`~tweepy.error.TweepyError`: If there's some critical API error
"""
# Run t... | [
"def",
"start",
"(",
"self",
",",
"retry_limit",
"=",
"None",
")",
":",
"# Run tweepy stream",
"wrapper_listener",
"=",
"TweepyWrapperListener",
"(",
"listener",
"=",
"self",
".",
"listener",
")",
"stream",
"=",
"tweepy",
".",
"Stream",
"(",
"auth",
"=",
"se... | Try to connect to Twitter's streaming API.
:param retry_limit: The maximum number of retries in case of failures. Default is None (unlimited)
:raises :class:`~tweepy.error.TweepyError`: If there's some critical API error | [
"Try",
"to",
"connect",
"to",
"Twitter",
"s",
"streaming",
"API",
"."
] | a6b1a431a343007f7ae55a193e432a61af22253f | https://github.com/invinst/ResponseBot/blob/a6b1a431a343007f7ae55a193e432a61af22253f/responsebot/responsebot_stream.py#L25-L54 |
38,647 | hollenstein/maspy | maspy/inference.py | _findProteinClusters | def _findProteinClusters(protToPeps, pepToProts):
"""Find protein clusters in the specified protein to peptide mappings.
A protein cluster is a group of proteins that are somehow directly or
indirectly connected by shared peptides.
:param protToPeps: dict, for each protein (=key) contains a set of
... | python | def _findProteinClusters(protToPeps, pepToProts):
"""Find protein clusters in the specified protein to peptide mappings.
A protein cluster is a group of proteins that are somehow directly or
indirectly connected by shared peptides.
:param protToPeps: dict, for each protein (=key) contains a set of
... | [
"def",
"_findProteinClusters",
"(",
"protToPeps",
",",
"pepToProts",
")",
":",
"clusters",
"=",
"list",
"(",
")",
"resolvingProteins",
"=",
"set",
"(",
"protToPeps",
")",
"while",
"resolvingProteins",
":",
"protein",
"=",
"resolvingProteins",
".",
"pop",
"(",
... | Find protein clusters in the specified protein to peptide mappings.
A protein cluster is a group of proteins that are somehow directly or
indirectly connected by shared peptides.
:param protToPeps: dict, for each protein (=key) contains a set of
associated peptides (=value). For Example {protein: ... | [
"Find",
"protein",
"clusters",
"in",
"the",
"specified",
"protein",
"to",
"peptide",
"mappings",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L649-L679 |
38,648 | hollenstein/maspy | maspy/inference.py | _findSamesetProteins | def _findSamesetProteins(protToPeps, proteins=None):
"""Find proteins that are mapped to an identical set of peptides.
:param protToPeps: dict, for each protein (=key) contains a set of
associated peptides (=value). For Example {protein: {peptide, ...}, ...}
:param proteins: iterable, proteins that... | python | def _findSamesetProteins(protToPeps, proteins=None):
"""Find proteins that are mapped to an identical set of peptides.
:param protToPeps: dict, for each protein (=key) contains a set of
associated peptides (=value). For Example {protein: {peptide, ...}, ...}
:param proteins: iterable, proteins that... | [
"def",
"_findSamesetProteins",
"(",
"protToPeps",
",",
"proteins",
"=",
"None",
")",
":",
"proteins",
"=",
"viewkeys",
"(",
"protToPeps",
")",
"if",
"proteins",
"is",
"None",
"else",
"proteins",
"equalEvidence",
"=",
"ddict",
"(",
"set",
")",
"for",
"protein... | Find proteins that are mapped to an identical set of peptides.
:param protToPeps: dict, for each protein (=key) contains a set of
associated peptides (=value). For Example {protein: {peptide, ...}, ...}
:param proteins: iterable, proteins that are tested for having equal
evidence. If not specif... | [
"Find",
"proteins",
"that",
"are",
"mapped",
"to",
"an",
"identical",
"set",
"of",
"peptides",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L682-L701 |
38,649 | hollenstein/maspy | maspy/inference.py | _findSubsetProteins | def _findSubsetProteins(proteins, protToPeps, pepToProts):
"""Find proteins which peptides are a sub-set, but not a same-set to other
proteins.
:param proteins: iterable, proteins that are tested for being a subset
:param pepToProts: dict, for each peptide (=key) contains a set of parent
protei... | python | def _findSubsetProteins(proteins, protToPeps, pepToProts):
"""Find proteins which peptides are a sub-set, but not a same-set to other
proteins.
:param proteins: iterable, proteins that are tested for being a subset
:param pepToProts: dict, for each peptide (=key) contains a set of parent
protei... | [
"def",
"_findSubsetProteins",
"(",
"proteins",
",",
"protToPeps",
",",
"pepToProts",
")",
":",
"proteinsEqual",
"=",
"lambda",
"prot1",
",",
"prot2",
":",
"protToPeps",
"[",
"prot1",
"]",
"==",
"protToPeps",
"[",
"prot2",
"]",
"subGroups",
"=",
"list",
"(",
... | Find proteins which peptides are a sub-set, but not a same-set to other
proteins.
:param proteins: iterable, proteins that are tested for being a subset
:param pepToProts: dict, for each peptide (=key) contains a set of parent
proteins (=value). For Example {peptide: {protein, ...}, ...}
:param... | [
"Find",
"proteins",
"which",
"peptides",
"are",
"a",
"sub",
"-",
"set",
"but",
"not",
"a",
"same",
"-",
"set",
"to",
"other",
"proteins",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L704-L735 |
38,650 | hollenstein/maspy | maspy/inference.py | _findRedundantProteins | def _findRedundantProteins(protToPeps, pepToProts, proteins=None):
"""Returns a set of proteins with redundant peptide evidence.
After removing the redundant proteins from the "protToPeps" and "pepToProts"
mapping, all remaining proteins have at least one unique peptide. The
remaining proteins are a "m... | python | def _findRedundantProteins(protToPeps, pepToProts, proteins=None):
"""Returns a set of proteins with redundant peptide evidence.
After removing the redundant proteins from the "protToPeps" and "pepToProts"
mapping, all remaining proteins have at least one unique peptide. The
remaining proteins are a "m... | [
"def",
"_findRedundantProteins",
"(",
"protToPeps",
",",
"pepToProts",
",",
"proteins",
"=",
"None",
")",
":",
"if",
"proteins",
"is",
"None",
":",
"proteins",
"=",
"viewkeys",
"(",
"protToPeps",
")",
"pepFrequency",
"=",
"_getValueCounts",
"(",
"pepToProts",
... | Returns a set of proteins with redundant peptide evidence.
After removing the redundant proteins from the "protToPeps" and "pepToProts"
mapping, all remaining proteins have at least one unique peptide. The
remaining proteins are a "minimal" set of proteins that are able to explain
all peptides. However... | [
"Returns",
"a",
"set",
"of",
"proteins",
"with",
"redundant",
"peptide",
"evidence",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L738-L811 |
38,651 | hollenstein/maspy | maspy/inference.py | _mergeProteinEntries | def _mergeProteinEntries(proteinLists, protToPeps):
"""Returns a new "protToPeps" dictionary with entries merged that are
present in proteinLists.
NOTE:
The key of the merged entry is a tuple of the sorted protein keys. This
behaviour might change in the future; the tuple might be replaced ... | python | def _mergeProteinEntries(proteinLists, protToPeps):
"""Returns a new "protToPeps" dictionary with entries merged that are
present in proteinLists.
NOTE:
The key of the merged entry is a tuple of the sorted protein keys. This
behaviour might change in the future; the tuple might be replaced ... | [
"def",
"_mergeProteinEntries",
"(",
"proteinLists",
",",
"protToPeps",
")",
":",
"mergedProtToPeps",
"=",
"dict",
"(",
"protToPeps",
")",
"for",
"proteins",
"in",
"proteinLists",
":",
"for",
"protein",
"in",
"proteins",
":",
"peptides",
"=",
"mergedProtToPeps",
... | Returns a new "protToPeps" dictionary with entries merged that are
present in proteinLists.
NOTE:
The key of the merged entry is a tuple of the sorted protein keys. This
behaviour might change in the future; the tuple might be replaced by
simply one of the protein entries which is then ... | [
"Returns",
"a",
"new",
"protToPeps",
"dictionary",
"with",
"entries",
"merged",
"that",
"are",
"present",
"in",
"proteinLists",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L814-L835 |
38,652 | hollenstein/maspy | maspy/inference.py | _reducedProtToPeps | def _reducedProtToPeps(protToPeps, proteins):
"""Returns a new, reduced "protToPeps" dictionary that does not contain
entries present in "proteins".
:param protToPeps: dict, for each protein (=key) contains a set of
associated peptides (=value). For Example {protein: {peptide, ...}, ...}
:param... | python | def _reducedProtToPeps(protToPeps, proteins):
"""Returns a new, reduced "protToPeps" dictionary that does not contain
entries present in "proteins".
:param protToPeps: dict, for each protein (=key) contains a set of
associated peptides (=value). For Example {protein: {peptide, ...}, ...}
:param... | [
"def",
"_reducedProtToPeps",
"(",
"protToPeps",
",",
"proteins",
")",
":",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"viewitems",
"(",
"protToPeps",
")",
"if",
"k",
"not",
"in",
"proteins",
"}"
] | Returns a new, reduced "protToPeps" dictionary that does not contain
entries present in "proteins".
:param protToPeps: dict, for each protein (=key) contains a set of
associated peptides (=value). For Example {protein: {peptide, ...}, ...}
:param proteins: a list of proteinSet
:returns: dict, p... | [
"Returns",
"a",
"new",
"reduced",
"protToPeps",
"dictionary",
"that",
"does",
"not",
"contain",
"entries",
"present",
"in",
"proteins",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L838-L847 |
38,653 | hollenstein/maspy | maspy/inference.py | _findUniqueMappingKeys | def _findUniqueMappingKeys(mapping):
"""Find mapping keys that only have one entry (value length of 1.
:param mapping: dict, for each key contains a set of entries
:returns: a set of unique mapping keys
"""
uniqueMappingKeys = set()
for key, entries in viewitems(mapping):
if len(entrie... | python | def _findUniqueMappingKeys(mapping):
"""Find mapping keys that only have one entry (value length of 1.
:param mapping: dict, for each key contains a set of entries
:returns: a set of unique mapping keys
"""
uniqueMappingKeys = set()
for key, entries in viewitems(mapping):
if len(entrie... | [
"def",
"_findUniqueMappingKeys",
"(",
"mapping",
")",
":",
"uniqueMappingKeys",
"=",
"set",
"(",
")",
"for",
"key",
",",
"entries",
"in",
"viewitems",
"(",
"mapping",
")",
":",
"if",
"len",
"(",
"entries",
")",
"==",
"1",
":",
"uniqueMappingKeys",
".",
"... | Find mapping keys that only have one entry (value length of 1.
:param mapping: dict, for each key contains a set of entries
:returns: a set of unique mapping keys | [
"Find",
"mapping",
"keys",
"that",
"only",
"have",
"one",
"entry",
"(",
"value",
"length",
"of",
"1",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L867-L878 |
38,654 | hollenstein/maspy | maspy/inference.py | _invertMapping | def _invertMapping(mapping):
"""Converts a protein to peptide or peptide to protein mapping.
:param mapping: dict, for each key contains a set of entries
:returns: an inverted mapping that each entry of the values points to a set
of initial keys.
"""
invertedMapping = ddict(set)
for ke... | python | def _invertMapping(mapping):
"""Converts a protein to peptide or peptide to protein mapping.
:param mapping: dict, for each key contains a set of entries
:returns: an inverted mapping that each entry of the values points to a set
of initial keys.
"""
invertedMapping = ddict(set)
for ke... | [
"def",
"_invertMapping",
"(",
"mapping",
")",
":",
"invertedMapping",
"=",
"ddict",
"(",
"set",
")",
"for",
"key",
",",
"values",
"in",
"viewitems",
"(",
"mapping",
")",
":",
"for",
"value",
"in",
"values",
":",
"invertedMapping",
"[",
"value",
"]",
".",... | Converts a protein to peptide or peptide to protein mapping.
:param mapping: dict, for each key contains a set of entries
:returns: an inverted mapping that each entry of the values points to a set
of initial keys. | [
"Converts",
"a",
"protein",
"to",
"peptide",
"or",
"peptide",
"to",
"protein",
"mapping",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L881-L893 |
38,655 | hollenstein/maspy | maspy/inference.py | _mappingGetValueSet | def _mappingGetValueSet(mapping, keys):
"""Return a combined set of values from the mapping.
:param mapping: dict, for each key contains a set of entries
returns a set of combined entries
"""
setUnion = set()
for k in keys:
setUnion = setUnion.union(mapping[k])
return setUnion | python | def _mappingGetValueSet(mapping, keys):
"""Return a combined set of values from the mapping.
:param mapping: dict, for each key contains a set of entries
returns a set of combined entries
"""
setUnion = set()
for k in keys:
setUnion = setUnion.union(mapping[k])
return setUnion | [
"def",
"_mappingGetValueSet",
"(",
"mapping",
",",
"keys",
")",
":",
"setUnion",
"=",
"set",
"(",
")",
"for",
"k",
"in",
"keys",
":",
"setUnion",
"=",
"setUnion",
".",
"union",
"(",
"mapping",
"[",
"k",
"]",
")",
"return",
"setUnion"
] | Return a combined set of values from the mapping.
:param mapping: dict, for each key contains a set of entries
returns a set of combined entries | [
"Return",
"a",
"combined",
"set",
"of",
"values",
"from",
"the",
"mapping",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L906-L916 |
38,656 | hollenstein/maspy | maspy/inference.py | _flattenMergedProteins | def _flattenMergedProteins(proteins):
"""Return a set where merged protein entries in proteins are flattened.
:param proteins: an iterable of proteins, can contain merged protein entries
in the form of tuple([protein1, protein2]).
returns a set of protein entries, where all entries are strings
... | python | def _flattenMergedProteins(proteins):
"""Return a set where merged protein entries in proteins are flattened.
:param proteins: an iterable of proteins, can contain merged protein entries
in the form of tuple([protein1, protein2]).
returns a set of protein entries, where all entries are strings
... | [
"def",
"_flattenMergedProteins",
"(",
"proteins",
")",
":",
"proteinSet",
"=",
"set",
"(",
")",
"for",
"protein",
"in",
"proteins",
":",
"if",
"isinstance",
"(",
"protein",
",",
"tuple",
")",
":",
"proteinSet",
".",
"update",
"(",
"protein",
")",
"else",
... | Return a set where merged protein entries in proteins are flattened.
:param proteins: an iterable of proteins, can contain merged protein entries
in the form of tuple([protein1, protein2]).
returns a set of protein entries, where all entries are strings | [
"Return",
"a",
"set",
"where",
"merged",
"protein",
"entries",
"in",
"proteins",
"are",
"flattened",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L919-L932 |
38,657 | hollenstein/maspy | maspy/inference.py | ProteinInference.getGroups | def getGroups(self, proteinId):
"""Return a list of protein groups a protein is associated with."""
return [self.groups[gId] for gId in self._proteinToGroupIds[proteinId]] | python | def getGroups(self, proteinId):
"""Return a list of protein groups a protein is associated with."""
return [self.groups[gId] for gId in self._proteinToGroupIds[proteinId]] | [
"def",
"getGroups",
"(",
"self",
",",
"proteinId",
")",
":",
"return",
"[",
"self",
".",
"groups",
"[",
"gId",
"]",
"for",
"gId",
"in",
"self",
".",
"_proteinToGroupIds",
"[",
"proteinId",
"]",
"]"
] | Return a list of protein groups a protein is associated with. | [
"Return",
"a",
"list",
"of",
"protein",
"groups",
"a",
"protein",
"is",
"associated",
"with",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L312-L314 |
38,658 | hollenstein/maspy | maspy/inference.py | ProteinInference.addProteinGroup | def addProteinGroup(self, groupRepresentative):
"""Adds a new protein group and returns the groupId.
The groupId is defined using an internal counter, which is incremented
every time a protein group is added. The groupRepresentative is added
as a leading protein.
:param groupRe... | python | def addProteinGroup(self, groupRepresentative):
"""Adds a new protein group and returns the groupId.
The groupId is defined using an internal counter, which is incremented
every time a protein group is added. The groupRepresentative is added
as a leading protein.
:param groupRe... | [
"def",
"addProteinGroup",
"(",
"self",
",",
"groupRepresentative",
")",
":",
"groupId",
"=",
"self",
".",
"_getNextGroupId",
"(",
")",
"self",
".",
"groups",
"[",
"groupId",
"]",
"=",
"ProteinGroup",
"(",
"groupId",
",",
"groupRepresentative",
")",
"self",
"... | Adds a new protein group and returns the groupId.
The groupId is defined using an internal counter, which is incremented
every time a protein group is added. The groupRepresentative is added
as a leading protein.
:param groupRepresentative: the protein group representing protein
... | [
"Adds",
"a",
"new",
"protein",
"group",
"and",
"returns",
"the",
"groupId",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L316-L329 |
38,659 | hollenstein/maspy | maspy/inference.py | ProteinInference.addLeadingToGroups | def addLeadingToGroups(self, proteinIds, groupIds):
"""Add one or multiple leading proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a groupId
... | python | def addLeadingToGroups(self, proteinIds, groupIds):
"""Add one or multiple leading proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a groupId
... | [
"def",
"addLeadingToGroups",
"(",
"self",
",",
"proteinIds",
",",
"groupIds",
")",
":",
"for",
"groupId",
"in",
"AUX",
".",
"toList",
"(",
"groupIds",
")",
":",
"self",
".",
"groups",
"[",
"groupId",
"]",
".",
"addLeadingProteins",
"(",
"proteinIds",
")",
... | Add one or multiple leading proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a groupId
must be a string. | [
"Add",
"one",
"or",
"multiple",
"leading",
"proteins",
"to",
"one",
"or",
"multiple",
"protein",
"groups",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L331-L342 |
38,660 | hollenstein/maspy | maspy/inference.py | ProteinInference.addSubsetToGroups | def addSubsetToGroups(self, proteinIds, groupIds):
"""Add one or multiple subset proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a groupId
... | python | def addSubsetToGroups(self, proteinIds, groupIds):
"""Add one or multiple subset proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a groupId
... | [
"def",
"addSubsetToGroups",
"(",
"self",
",",
"proteinIds",
",",
"groupIds",
")",
":",
"for",
"groupId",
"in",
"AUX",
".",
"toList",
"(",
"groupIds",
")",
":",
"self",
".",
"groups",
"[",
"groupId",
"]",
".",
"addSubsetProteins",
"(",
"proteinIds",
")",
... | Add one or multiple subset proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a groupId
must be a string. | [
"Add",
"one",
"or",
"multiple",
"subset",
"proteins",
"to",
"one",
"or",
"multiple",
"protein",
"groups",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L344-L355 |
38,661 | hollenstein/maspy | maspy/inference.py | ProteinInference.addSubsumableToGroups | def addSubsumableToGroups(self, proteinIds, groupIds):
"""Add one or multiple subsumable proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a grou... | python | def addSubsumableToGroups(self, proteinIds, groupIds):
"""Add one or multiple subsumable proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a grou... | [
"def",
"addSubsumableToGroups",
"(",
"self",
",",
"proteinIds",
",",
"groupIds",
")",
":",
"for",
"groupId",
"in",
"AUX",
".",
"toList",
"(",
"groupIds",
")",
":",
"self",
".",
"groups",
"[",
"groupId",
"]",
".",
"addSubsumableProteins",
"(",
"proteinIds",
... | Add one or multiple subsumable proteins to one or multiple protein
groups.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupIds: a groupId or a list of groupIds, a groupId
must be a string. | [
"Add",
"one",
"or",
"multiple",
"subsumable",
"proteins",
"to",
"one",
"or",
"multiple",
"protein",
"groups",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L357-L368 |
38,662 | hollenstein/maspy | maspy/inference.py | ProteinInference._addProteinIdsToGroupMapping | def _addProteinIdsToGroupMapping(self, proteinIds, groupId):
"""Add a groupId to one or multiple entries of the internal
proteinToGroupId mapping.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupId: str, a groupId
"""... | python | def _addProteinIdsToGroupMapping(self, proteinIds, groupId):
"""Add a groupId to one or multiple entries of the internal
proteinToGroupId mapping.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupId: str, a groupId
"""... | [
"def",
"_addProteinIdsToGroupMapping",
"(",
"self",
",",
"proteinIds",
",",
"groupId",
")",
":",
"for",
"proteinId",
"in",
"AUX",
".",
"toList",
"(",
"proteinIds",
")",
":",
"self",
".",
"_proteinToGroupIds",
"[",
"proteinId",
"]",
".",
"add",
"(",
"groupId"... | Add a groupId to one or multiple entries of the internal
proteinToGroupId mapping.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param groupId: str, a groupId | [
"Add",
"a",
"groupId",
"to",
"one",
"or",
"multiple",
"entries",
"of",
"the",
"internal",
"proteinToGroupId",
"mapping",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L376-L385 |
38,663 | hollenstein/maspy | maspy/inference.py | ProteinGroup._addProteins | def _addProteins(self, proteinIds, containerNames):
"""Add one or multiple proteinIds to the respective container.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param containerNames: list, entries must be one or multiple of
'leadi... | python | def _addProteins(self, proteinIds, containerNames):
"""Add one or multiple proteinIds to the respective container.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param containerNames: list, entries must be one or multiple of
'leadi... | [
"def",
"_addProteins",
"(",
"self",
",",
"proteinIds",
",",
"containerNames",
")",
":",
"proteinIds",
"=",
"AUX",
".",
"toList",
"(",
"proteinIds",
")",
"for",
"containerName",
"in",
"containerNames",
":",
"proteinContainer",
"=",
"getattr",
"(",
"self",
",",
... | Add one or multiple proteinIds to the respective container.
:param proteinIds: a proteinId or a list of proteinIds, a proteinId
must be a string.
:param containerNames: list, entries must be one or multiple of
'leading', 'subset', 'subsumableProteins' or 'proteins'
:para... | [
"Add",
"one",
"or",
"multiple",
"proteinIds",
"to",
"the",
"respective",
"container",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/inference.py#L408-L420 |
38,664 | diamondman/proteusisc | proteusisc/contracts.py | Requirement.satisfies | def satisfies(self, other):
"""Check if the capabilities of a primitive are enough to satisfy a requirement.
Should be called on a Requirement that is acting as a
capability of a primitive. This method returning true means
that the capability advertised here is enough to handle
... | python | def satisfies(self, other):
"""Check if the capabilities of a primitive are enough to satisfy a requirement.
Should be called on a Requirement that is acting as a
capability of a primitive. This method returning true means
that the capability advertised here is enough to handle
... | [
"def",
"satisfies",
"(",
"self",
",",
"other",
")",
":",
"if",
"other",
".",
"isnocare",
":",
"return",
"True",
"if",
"self",
".",
"isnocare",
":",
"return",
"False",
"if",
"self",
".",
"arbitrary",
":",
"return",
"True",
"if",
"self",
".",
"constant",... | Check if the capabilities of a primitive are enough to satisfy a requirement.
Should be called on a Requirement that is acting as a
capability of a primitive. This method returning true means
that the capability advertised here is enough to handle
representing the data described by the ... | [
"Check",
"if",
"the",
"capabilities",
"of",
"a",
"primitive",
"are",
"enough",
"to",
"satisfy",
"a",
"requirement",
"."
] | 7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c | https://github.com/diamondman/proteusisc/blob/7622b7b04e63f9dc0f5a04429ff78d9a490c9c5c/proteusisc/contracts.py#L122-L164 |
38,665 | nicferrier/md | src/mdlib/client.py | MdClient._list | def _list(self, foldername="INBOX", reverse=False, since=None):
"""Do structured list output.
Sorts the list by date, possibly reversed, filtered from 'since'.
The returned list is: foldername, message key, message object
"""
folder = self.folder \
if foldername == ... | python | def _list(self, foldername="INBOX", reverse=False, since=None):
"""Do structured list output.
Sorts the list by date, possibly reversed, filtered from 'since'.
The returned list is: foldername, message key, message object
"""
folder = self.folder \
if foldername == ... | [
"def",
"_list",
"(",
"self",
",",
"foldername",
"=",
"\"INBOX\"",
",",
"reverse",
"=",
"False",
",",
"since",
"=",
"None",
")",
":",
"folder",
"=",
"self",
".",
"folder",
"if",
"foldername",
"==",
"\"INBOX\"",
"else",
"self",
".",
"_getfolder",
"(",
"f... | Do structured list output.
Sorts the list by date, possibly reversed, filtered from 'since'.
The returned list is: foldername, message key, message object | [
"Do",
"structured",
"list",
"output",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L80-L100 |
38,666 | nicferrier/md | src/mdlib/client.py | MdClient.ls | def ls(self, foldername="INBOX", reverse=False, since=None, grep=None, field=None, stream=sys.stdout):
"""Do standard text list of the folder to the stream.
'foldername' is the folder to list.. INBOX by default.
'since' allows the listing to be date filtered since that
date. It should ... | python | def ls(self, foldername="INBOX", reverse=False, since=None, grep=None, field=None, stream=sys.stdout):
"""Do standard text list of the folder to the stream.
'foldername' is the folder to list.. INBOX by default.
'since' allows the listing to be date filtered since that
date. It should ... | [
"def",
"ls",
"(",
"self",
",",
"foldername",
"=",
"\"INBOX\"",
",",
"reverse",
"=",
"False",
",",
"since",
"=",
"None",
",",
"grep",
"=",
"None",
",",
"field",
"=",
"None",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"if",
"foldername",
"==... | Do standard text list of the folder to the stream.
'foldername' is the folder to list.. INBOX by default.
'since' allows the listing to be date filtered since that
date. It should be a float, a time since epoch.
'grep' allows text matching on the whole record
'field' ... | [
"Do",
"standard",
"text",
"list",
"of",
"the",
"folder",
"to",
"the",
"stream",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L102-L141 |
38,667 | nicferrier/md | src/mdlib/client.py | MdClient.lisp | def lisp(self, foldername="INBOX", reverse=False, since=None, stream=sys.stdout):
"""Do JSON list of the folder to the stream.
'since' allows the listing to be date filtered since that
date. It should be a float, a time since epoch.
"""
def fromval(hdr):
if hdr:
... | python | def lisp(self, foldername="INBOX", reverse=False, since=None, stream=sys.stdout):
"""Do JSON list of the folder to the stream.
'since' allows the listing to be date filtered since that
date. It should be a float, a time since epoch.
"""
def fromval(hdr):
if hdr:
... | [
"def",
"lisp",
"(",
"self",
",",
"foldername",
"=",
"\"INBOX\"",
",",
"reverse",
"=",
"False",
",",
"since",
"=",
"None",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"def",
"fromval",
"(",
"hdr",
")",
":",
"if",
"hdr",
":",
"return",
"parse... | Do JSON list of the folder to the stream.
'since' allows the listing to be date filtered since that
date. It should be a float, a time since epoch. | [
"Do",
"JSON",
"list",
"of",
"the",
"folder",
"to",
"the",
"stream",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L143-L169 |
38,668 | nicferrier/md | src/mdlib/client.py | MdClient.lsfolders | def lsfolders(self, stream=sys.stdout):
"""List the subfolders"""
for f in self.folder.folders():
print(f.folder.strip("."), file=stream) | python | def lsfolders(self, stream=sys.stdout):
"""List the subfolders"""
for f in self.folder.folders():
print(f.folder.strip("."), file=stream) | [
"def",
"lsfolders",
"(",
"self",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"for",
"f",
"in",
"self",
".",
"folder",
".",
"folders",
"(",
")",
":",
"print",
"(",
"f",
".",
"folder",
".",
"strip",
"(",
"\".\"",
")",
",",
"file",
"=",
"s... | List the subfolders | [
"List",
"the",
"subfolders"
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L171-L174 |
38,669 | nicferrier/md | src/mdlib/client.py | MdClient._get | def _get(self, msgid):
"""Yields the message header against each part from the message."""
foldername, msgkey = msgid.split(SEPERATOR)
folder = self.folder if foldername == "INBOX" else self._getfolder(foldername)
# Now look up the message
msg = folder[msgkey]
msg.is_seen... | python | def _get(self, msgid):
"""Yields the message header against each part from the message."""
foldername, msgkey = msgid.split(SEPERATOR)
folder = self.folder if foldername == "INBOX" else self._getfolder(foldername)
# Now look up the message
msg = folder[msgkey]
msg.is_seen... | [
"def",
"_get",
"(",
"self",
",",
"msgid",
")",
":",
"foldername",
",",
"msgkey",
"=",
"msgid",
".",
"split",
"(",
"SEPERATOR",
")",
"folder",
"=",
"self",
".",
"folder",
"if",
"foldername",
"==",
"\"INBOX\"",
"else",
"self",
".",
"_getfolder",
"(",
"fo... | Yields the message header against each part from the message. | [
"Yields",
"the",
"message",
"header",
"against",
"each",
"part",
"from",
"the",
"message",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L187-L197 |
38,670 | nicferrier/md | src/mdlib/client.py | MdClient.gettext | def gettext(self, msgid, stream=sys.stdout, splitter="--text follows this line--\n"):
"""Get the first text part we can find and print it as a message.
This is a simple cowpath, most of the time you want the first plain part.
'msgid' is the message to be used
'stream' is printed to wit... | python | def gettext(self, msgid, stream=sys.stdout, splitter="--text follows this line--\n"):
"""Get the first text part we can find and print it as a message.
This is a simple cowpath, most of the time you want the first plain part.
'msgid' is the message to be used
'stream' is printed to wit... | [
"def",
"gettext",
"(",
"self",
",",
"msgid",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"splitter",
"=",
"\"--text follows this line--\\n\"",
")",
":",
"for",
"hdr",
",",
"part",
"in",
"self",
".",
"_get",
"(",
"msgid",
")",
":",
"if",
"part",
".",... | Get the first text part we can find and print it as a message.
This is a simple cowpath, most of the time you want the first plain part.
'msgid' is the message to be used
'stream' is printed to with the header, splitter, first-textpart
'splitter' is text used to split the header from t... | [
"Get",
"the",
"first",
"text",
"part",
"we",
"can",
"find",
"and",
"print",
"it",
"as",
"a",
"message",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L199-L223 |
38,671 | nicferrier/md | src/mdlib/client.py | MdClient.getrawpart | def getrawpart(self, msgid, stream=sys.stdout):
"""Get the first part from the message and print it raw.
"""
for hdr, part in self._get(msgid):
pl = part.get_payload(decode=True)
if pl != None:
print(pl, file=stream)
break | python | def getrawpart(self, msgid, stream=sys.stdout):
"""Get the first part from the message and print it raw.
"""
for hdr, part in self._get(msgid):
pl = part.get_payload(decode=True)
if pl != None:
print(pl, file=stream)
break | [
"def",
"getrawpart",
"(",
"self",
",",
"msgid",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"for",
"hdr",
",",
"part",
"in",
"self",
".",
"_get",
"(",
"msgid",
")",
":",
"pl",
"=",
"part",
".",
"get_payload",
"(",
"decode",
"=",
"True",
"... | Get the first part from the message and print it raw. | [
"Get",
"the",
"first",
"part",
"from",
"the",
"message",
"and",
"print",
"it",
"raw",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L225-L232 |
38,672 | nicferrier/md | src/mdlib/client.py | MdClient.getrawpartid | def getrawpartid(self, msgid, partid, stream=sys.stdout):
"""Get a specific part from the message and print it raw.
"""
parts = [part for hdr,part in self._get(msgid)]
part = parts[int(partid)]
pl = part.get_payload(decode=True)
if pl != None:
print(pl, file=s... | python | def getrawpartid(self, msgid, partid, stream=sys.stdout):
"""Get a specific part from the message and print it raw.
"""
parts = [part for hdr,part in self._get(msgid)]
part = parts[int(partid)]
pl = part.get_payload(decode=True)
if pl != None:
print(pl, file=s... | [
"def",
"getrawpartid",
"(",
"self",
",",
"msgid",
",",
"partid",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"parts",
"=",
"[",
"part",
"for",
"hdr",
",",
"part",
"in",
"self",
".",
"_get",
"(",
"msgid",
")",
"]",
"part",
"=",
"parts",
"[... | Get a specific part from the message and print it raw. | [
"Get",
"a",
"specific",
"part",
"from",
"the",
"message",
"and",
"print",
"it",
"raw",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L234-L241 |
38,673 | nicferrier/md | src/mdlib/client.py | MdClient.getraw | def getraw(self, msgid, stream=sys.stdout):
"""Get the whole message and print it.
"""
foldername, msgkey = msgid.split(SEPERATOR)
folder = self.folder if foldername == "INBOX" else self._getfolder(foldername)
msg = folder[msgkey]
print(msg.content) | python | def getraw(self, msgid, stream=sys.stdout):
"""Get the whole message and print it.
"""
foldername, msgkey = msgid.split(SEPERATOR)
folder = self.folder if foldername == "INBOX" else self._getfolder(foldername)
msg = folder[msgkey]
print(msg.content) | [
"def",
"getraw",
"(",
"self",
",",
"msgid",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"foldername",
",",
"msgkey",
"=",
"msgid",
".",
"split",
"(",
"SEPERATOR",
")",
"folder",
"=",
"self",
".",
"folder",
"if",
"foldername",
"==",
"\"INBOX\"",... | Get the whole message and print it. | [
"Get",
"the",
"whole",
"message",
"and",
"print",
"it",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L244-L250 |
38,674 | nicferrier/md | src/mdlib/client.py | MdClient.getstruct | def getstruct(self, msgid, as_json=False, stream=sys.stdout):
"""Get and print the whole message.
as_json indicates whether to print the part list as JSON or not.
"""
parts = [part.get_content_type() for hdr, part in self._get(msgid)]
if as_json:
print(json.dumps(par... | python | def getstruct(self, msgid, as_json=False, stream=sys.stdout):
"""Get and print the whole message.
as_json indicates whether to print the part list as JSON or not.
"""
parts = [part.get_content_type() for hdr, part in self._get(msgid)]
if as_json:
print(json.dumps(par... | [
"def",
"getstruct",
"(",
"self",
",",
"msgid",
",",
"as_json",
"=",
"False",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"parts",
"=",
"[",
"part",
".",
"get_content_type",
"(",
")",
"for",
"hdr",
",",
"part",
"in",
"self",
".",
"_get",
"("... | Get and print the whole message.
as_json indicates whether to print the part list as JSON or not. | [
"Get",
"and",
"print",
"the",
"whole",
"message",
"."
] | 302ca8882dae060fb15bd5ae470d8e661fb67ec4 | https://github.com/nicferrier/md/blob/302ca8882dae060fb15bd5ae470d8e661fb67ec4/src/mdlib/client.py#L252-L262 |
38,675 | GeorgeArgyros/symautomata | symautomata/cfgpda.py | CfgPDA._extract_alphabet | def _extract_alphabet(self, grammar):
"""
Extract an alphabet from the given grammar.
"""
alphabet = set([])
for terminal in grammar.Terminals:
alphabet |= set([x for x in terminal])
self.alphabet = list(alphabet) | python | def _extract_alphabet(self, grammar):
"""
Extract an alphabet from the given grammar.
"""
alphabet = set([])
for terminal in grammar.Terminals:
alphabet |= set([x for x in terminal])
self.alphabet = list(alphabet) | [
"def",
"_extract_alphabet",
"(",
"self",
",",
"grammar",
")",
":",
"alphabet",
"=",
"set",
"(",
"[",
"]",
")",
"for",
"terminal",
"in",
"grammar",
".",
"Terminals",
":",
"alphabet",
"|=",
"set",
"(",
"[",
"x",
"for",
"x",
"in",
"terminal",
"]",
")",
... | Extract an alphabet from the given grammar. | [
"Extract",
"an",
"alphabet",
"from",
"the",
"given",
"grammar",
"."
] | f5d66533573b27e155bec3f36b8c00b8e3937cb3 | https://github.com/GeorgeArgyros/symautomata/blob/f5d66533573b27e155bec3f36b8c00b8e3937cb3/symautomata/cfgpda.py#L18-L25 |
38,676 | codeforamerica/epa_python | epa/gics/gics.py | GICS.action | def action(self, column=None, value=None, **kwargs):
"""
The underlying GICS table provides codes and descriptions
identifying the current status or disposition of a grant project.
>>> GICS().action('action_code', 'A')
"""
return self._resolve_call('GIC_ACTION', column, ... | python | def action(self, column=None, value=None, **kwargs):
"""
The underlying GICS table provides codes and descriptions
identifying the current status or disposition of a grant project.
>>> GICS().action('action_code', 'A')
"""
return self._resolve_call('GIC_ACTION', column, ... | [
"def",
"action",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_ACTION'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | The underlying GICS table provides codes and descriptions
identifying the current status or disposition of a grant project.
>>> GICS().action('action_code', 'A') | [
"The",
"underlying",
"GICS",
"table",
"provides",
"codes",
"and",
"descriptions",
"identifying",
"the",
"current",
"status",
"or",
"disposition",
"of",
"a",
"grant",
"project",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L23-L30 |
38,677 | codeforamerica/epa_python | epa/gics/gics.py | GICS.applicant | def applicant(self, column=None, value=None, **kwargs):
"""
Find the applicant information for a grant.
>>> GICS().applicant('zip_code', 94105)
"""
return self._resolve_call('GIC_APPLICANT', column, value, **kwargs) | python | def applicant(self, column=None, value=None, **kwargs):
"""
Find the applicant information for a grant.
>>> GICS().applicant('zip_code', 94105)
"""
return self._resolve_call('GIC_APPLICANT', column, value, **kwargs) | [
"def",
"applicant",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_APPLICANT'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Find the applicant information for a grant.
>>> GICS().applicant('zip_code', 94105) | [
"Find",
"the",
"applicant",
"information",
"for",
"a",
"grant",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L32-L38 |
38,678 | codeforamerica/epa_python | epa/gics/gics.py | GICS.authority | def authority(self, column=None, value=None, **kwargs):
"""Provides codes and associated authorizing statutes."""
return self._resolve_call('GIC_AUTHORITY', column, value, **kwargs) | python | def authority(self, column=None, value=None, **kwargs):
"""Provides codes and associated authorizing statutes."""
return self._resolve_call('GIC_AUTHORITY', column, value, **kwargs) | [
"def",
"authority",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_AUTHORITY'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Provides codes and associated authorizing statutes. | [
"Provides",
"codes",
"and",
"associated",
"authorizing",
"statutes",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L47-L49 |
38,679 | codeforamerica/epa_python | epa/gics/gics.py | GICS.construction | def construction(self, column=None, value=None, **kwargs):
"""
Identifies monetary, descriptive, and milestone information for
Wastewater Treatment construction grants.
>>> GICS().construction('complete_percent', 91)
"""
return self._resolve_call('GIC_CONSTRUCTION', colu... | python | def construction(self, column=None, value=None, **kwargs):
"""
Identifies monetary, descriptive, and milestone information for
Wastewater Treatment construction grants.
>>> GICS().construction('complete_percent', 91)
"""
return self._resolve_call('GIC_CONSTRUCTION', colu... | [
"def",
"construction",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_CONSTRUCTION'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Identifies monetary, descriptive, and milestone information for
Wastewater Treatment construction grants.
>>> GICS().construction('complete_percent', 91) | [
"Identifies",
"monetary",
"descriptive",
"and",
"milestone",
"information",
"for",
"Wastewater",
"Treatment",
"construction",
"grants",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L51-L58 |
38,680 | codeforamerica/epa_python | epa/gics/gics.py | GICS.eligible_cost | def eligible_cost(self, column=None, value=None, **kwargs):
"""
The assistance dollar amounts by eligible cost category.
>>> GICS().eligible_cost('amount', 100000)
"""
return self._resolve_call('GIC_ELIGIBLE_COST', column, value, **kwargs) | python | def eligible_cost(self, column=None, value=None, **kwargs):
"""
The assistance dollar amounts by eligible cost category.
>>> GICS().eligible_cost('amount', 100000)
"""
return self._resolve_call('GIC_ELIGIBLE_COST', column, value, **kwargs) | [
"def",
"eligible_cost",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_ELIGIBLE_COST'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"... | The assistance dollar amounts by eligible cost category.
>>> GICS().eligible_cost('amount', 100000) | [
"The",
"assistance",
"dollar",
"amounts",
"by",
"eligible",
"cost",
"category",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L60-L66 |
38,681 | codeforamerica/epa_python | epa/gics/gics.py | GICS.grant | def grant(self, column=None, value=None, **kwargs):
"""
Provides various award, project, and grant personnel information.
>>> GICS().grant('project_city_name', 'San Francisco')
"""
return self._resolve_call('GIC_GRANT', column, value, **kwargs) | python | def grant(self, column=None, value=None, **kwargs):
"""
Provides various award, project, and grant personnel information.
>>> GICS().grant('project_city_name', 'San Francisco')
"""
return self._resolve_call('GIC_GRANT', column, value, **kwargs) | [
"def",
"grant",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_GRANT'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Provides various award, project, and grant personnel information.
>>> GICS().grant('project_city_name', 'San Francisco') | [
"Provides",
"various",
"award",
"project",
"and",
"grant",
"personnel",
"information",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L68-L74 |
38,682 | codeforamerica/epa_python | epa/gics/gics.py | GICS.grant_assistance | def grant_assistance(self, column=None, value=None, **kwargs):
"""Many-to-many table connecting grants and assistance."""
return self._resolve_call('GIC_GRANT_ASST_PGM', column, value, **kwargs) | python | def grant_assistance(self, column=None, value=None, **kwargs):
"""Many-to-many table connecting grants and assistance."""
return self._resolve_call('GIC_GRANT_ASST_PGM', column, value, **kwargs) | [
"def",
"grant_assistance",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_GRANT_ASST_PGM'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
... | Many-to-many table connecting grants and assistance. | [
"Many",
"-",
"to",
"-",
"many",
"table",
"connecting",
"grants",
"and",
"assistance",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L76-L78 |
38,683 | codeforamerica/epa_python | epa/gics/gics.py | GICS.grant_authority | def grant_authority(self, column=None, value=None, **kwargs):
"""Many-to-many table connecting grants and authority."""
return self._resolve_call('GIC_GRANT_AUTH', column, value, **kwargs) | python | def grant_authority(self, column=None, value=None, **kwargs):
"""Many-to-many table connecting grants and authority."""
return self._resolve_call('GIC_GRANT_AUTH', column, value, **kwargs) | [
"def",
"grant_authority",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_GRANT_AUTH'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
... | Many-to-many table connecting grants and authority. | [
"Many",
"-",
"to",
"-",
"many",
"table",
"connecting",
"grants",
"and",
"authority",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L80-L82 |
38,684 | codeforamerica/epa_python | epa/gics/gics.py | GICS.lab_office | def lab_office(self, column=None, value=None, **kwargs):
"""Abbreviations, names, and locations of labratories and offices."""
return self._resolve_call('GIC_LAB_OFFICE', column, value, **kwargs) | python | def lab_office(self, column=None, value=None, **kwargs):
"""Abbreviations, names, and locations of labratories and offices."""
return self._resolve_call('GIC_LAB_OFFICE', column, value, **kwargs) | [
"def",
"lab_office",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_LAB_OFFICE'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Abbreviations, names, and locations of labratories and offices. | [
"Abbreviations",
"names",
"and",
"locations",
"of",
"labratories",
"and",
"offices",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L84-L86 |
38,685 | codeforamerica/epa_python | epa/gics/gics.py | GICS.milestone | def milestone(self, column=None, value=None, **kwargs):
"""
Status codes and related dates of certain grants,
>>> GICS().milestone('milestone_date', '16-MAR-01')
"""
return self._resolve_call('GIC_MILESTONE', column, value, **kwargs) | python | def milestone(self, column=None, value=None, **kwargs):
"""
Status codes and related dates of certain grants,
>>> GICS().milestone('milestone_date', '16-MAR-01')
"""
return self._resolve_call('GIC_MILESTONE', column, value, **kwargs) | [
"def",
"milestone",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_MILESTONE'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Status codes and related dates of certain grants,
>>> GICS().milestone('milestone_date', '16-MAR-01') | [
"Status",
"codes",
"and",
"related",
"dates",
"of",
"certain",
"grants"
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L88-L94 |
38,686 | codeforamerica/epa_python | epa/gics/gics.py | GICS.record_type | def record_type(self, column=None, value=None, **kwargs):
"""
Codes and descriptions indicating whether an award is for a new
project or for the continuation of a currently funded one.
>>> GICS().record_type('record_type_code', 'A')
"""
return self._resolve_call('GIC_REC... | python | def record_type(self, column=None, value=None, **kwargs):
"""
Codes and descriptions indicating whether an award is for a new
project or for the continuation of a currently funded one.
>>> GICS().record_type('record_type_code', 'A')
"""
return self._resolve_call('GIC_REC... | [
"def",
"record_type",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_RECORD_TYPE'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Codes and descriptions indicating whether an award is for a new
project or for the continuation of a currently funded one.
>>> GICS().record_type('record_type_code', 'A') | [
"Codes",
"and",
"descriptions",
"indicating",
"whether",
"an",
"award",
"is",
"for",
"a",
"new",
"project",
"or",
"for",
"the",
"continuation",
"of",
"a",
"currently",
"funded",
"one",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L96-L103 |
38,687 | codeforamerica/epa_python | epa/gics/gics.py | GICS.srf_cap | def srf_cap(self, column=None, value=None, **kwargs):
"""
Fiscal dollar amounts for State Revolving Fund Capitalization
Grants.
>>> GICS().srf_cap('grant_number', '340001900')
"""
return self._resolve_call('GIC_SRF_CAP', column, value, **kwargs) | python | def srf_cap(self, column=None, value=None, **kwargs):
"""
Fiscal dollar amounts for State Revolving Fund Capitalization
Grants.
>>> GICS().srf_cap('grant_number', '340001900')
"""
return self._resolve_call('GIC_SRF_CAP', column, value, **kwargs) | [
"def",
"srf_cap",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_SRF_CAP'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Fiscal dollar amounts for State Revolving Fund Capitalization
Grants.
>>> GICS().srf_cap('grant_number', '340001900') | [
"Fiscal",
"dollar",
"amounts",
"for",
"State",
"Revolving",
"Fund",
"Capitalization",
"Grants",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L105-L112 |
38,688 | codeforamerica/epa_python | epa/gics/gics.py | GICS.status | def status(self, column=None, value=None, **kwargs):
"""
Provides codes and descriptions of project milestones.
>>> GICS().status('status_code', 'AF')
"""
return self._resolve_call('GIC_STATUS', column, value, **kwargs) | python | def status(self, column=None, value=None, **kwargs):
"""
Provides codes and descriptions of project milestones.
>>> GICS().status('status_code', 'AF')
"""
return self._resolve_call('GIC_STATUS', column, value, **kwargs) | [
"def",
"status",
"(",
"self",
",",
"column",
"=",
"None",
",",
"value",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_resolve_call",
"(",
"'GIC_STATUS'",
",",
"column",
",",
"value",
",",
"*",
"*",
"kwargs",
")"
] | Provides codes and descriptions of project milestones.
>>> GICS().status('status_code', 'AF') | [
"Provides",
"codes",
"and",
"descriptions",
"of",
"project",
"milestones",
"."
] | 62a53da62936bea8daa487a01a52b973e9062b2c | https://github.com/codeforamerica/epa_python/blob/62a53da62936bea8daa487a01a52b973e9062b2c/epa/gics/gics.py#L114-L120 |
38,689 | hollenstein/maspy | maspy/xml.py | recRemoveTreeFormating | def recRemoveTreeFormating(element):
"""Removes whitespace characters, which are leftovers from previous xml
formatting.
:param element: an instance of lxml.etree._Element
str.strip() is applied to the "text" and the "tail" attribute of the
element and recursively to all child elements.
"""
... | python | def recRemoveTreeFormating(element):
"""Removes whitespace characters, which are leftovers from previous xml
formatting.
:param element: an instance of lxml.etree._Element
str.strip() is applied to the "text" and the "tail" attribute of the
element and recursively to all child elements.
"""
... | [
"def",
"recRemoveTreeFormating",
"(",
"element",
")",
":",
"children",
"=",
"element",
".",
"getchildren",
"(",
")",
"if",
"len",
"(",
"children",
")",
">",
"0",
":",
"for",
"child",
"in",
"children",
":",
"recRemoveTreeFormating",
"(",
"child",
")",
"if",... | Removes whitespace characters, which are leftovers from previous xml
formatting.
:param element: an instance of lxml.etree._Element
str.strip() is applied to the "text" and the "tail" attribute of the
element and recursively to all child elements. | [
"Removes",
"whitespace",
"characters",
"which",
"are",
"leftovers",
"from",
"previous",
"xml",
"formatting",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/xml.py#L104-L126 |
38,690 | hollenstein/maspy | maspy/xml.py | recCopyElement | def recCopyElement(oldelement):
"""Generates a copy of an xml element and recursively of all
child elements.
:param oldelement: an instance of lxml.etree._Element
:returns: a copy of the "oldelement"
.. warning::
doesn't copy ``.text`` or ``.tail`` of xml elements
"""
newelement =... | python | def recCopyElement(oldelement):
"""Generates a copy of an xml element and recursively of all
child elements.
:param oldelement: an instance of lxml.etree._Element
:returns: a copy of the "oldelement"
.. warning::
doesn't copy ``.text`` or ``.tail`` of xml elements
"""
newelement =... | [
"def",
"recCopyElement",
"(",
"oldelement",
")",
":",
"newelement",
"=",
"ETREE",
".",
"Element",
"(",
"oldelement",
".",
"tag",
",",
"oldelement",
".",
"attrib",
")",
"if",
"len",
"(",
"oldelement",
".",
"getchildren",
"(",
")",
")",
">",
"0",
":",
"f... | Generates a copy of an xml element and recursively of all
child elements.
:param oldelement: an instance of lxml.etree._Element
:returns: a copy of the "oldelement"
.. warning::
doesn't copy ``.text`` or ``.tail`` of xml elements | [
"Generates",
"a",
"copy",
"of",
"an",
"xml",
"element",
"and",
"recursively",
"of",
"all",
"child",
"elements",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/xml.py#L129-L144 |
38,691 | hollenstein/maspy | maspy/xml.py | getParam | def getParam(xmlelement):
"""Converts an mzML xml element to a param tuple.
:param xmlelement: #TODO docstring
:returns: a param tuple or False if the xmlelement is not a parameter
('userParam', 'cvParam' or 'referenceableParamGroupRef')
"""
elementTag = clearTag(xmlelement.tag)
if ele... | python | def getParam(xmlelement):
"""Converts an mzML xml element to a param tuple.
:param xmlelement: #TODO docstring
:returns: a param tuple or False if the xmlelement is not a parameter
('userParam', 'cvParam' or 'referenceableParamGroupRef')
"""
elementTag = clearTag(xmlelement.tag)
if ele... | [
"def",
"getParam",
"(",
"xmlelement",
")",
":",
"elementTag",
"=",
"clearTag",
"(",
"xmlelement",
".",
"tag",
")",
"if",
"elementTag",
"in",
"[",
"'userParam'",
",",
"'cvParam'",
",",
"'referenceableParamGroupRef'",
"]",
":",
"if",
"elementTag",
"==",
"'cvPara... | Converts an mzML xml element to a param tuple.
:param xmlelement: #TODO docstring
:returns: a param tuple or False if the xmlelement is not a parameter
('userParam', 'cvParam' or 'referenceableParamGroupRef') | [
"Converts",
"an",
"mzML",
"xml",
"element",
"to",
"a",
"param",
"tuple",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/xml.py#L204-L222 |
38,692 | hollenstein/maspy | maspy/xml.py | xmlAddParams | def xmlAddParams(parentelement, params):
"""Generates new mzML parameter xml elements and adds them to the
'parentelement' as xml children elements.
:param parentelement: :class:`xml.etree.Element`, an mzML element
:param params: a list of mzML parameter tuples ('cvParam', 'userParam' or
'refer... | python | def xmlAddParams(parentelement, params):
"""Generates new mzML parameter xml elements and adds them to the
'parentelement' as xml children elements.
:param parentelement: :class:`xml.etree.Element`, an mzML element
:param params: a list of mzML parameter tuples ('cvParam', 'userParam' or
'refer... | [
"def",
"xmlAddParams",
"(",
"parentelement",
",",
"params",
")",
":",
"if",
"not",
"params",
":",
"return",
"None",
"for",
"param",
"in",
"params",
":",
"if",
"len",
"(",
"param",
")",
"==",
"3",
":",
"cvAttrib",
"=",
"{",
"'cvRef'",
":",
"param",
"[... | Generates new mzML parameter xml elements and adds them to the
'parentelement' as xml children elements.
:param parentelement: :class:`xml.etree.Element`, an mzML element
:param params: a list of mzML parameter tuples ('cvParam', 'userParam' or
'referencableParamGroup') | [
"Generates",
"new",
"mzML",
"parameter",
"xml",
"elements",
"and",
"adds",
"them",
"to",
"the",
"parentelement",
"as",
"xml",
"children",
"elements",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/xml.py#L243-L287 |
38,693 | hollenstein/maspy | maspy/xml.py | interpretBitEncoding | def interpretBitEncoding(bitEncoding):
"""Returns a floattype string and a numpy array type.
:param bitEncoding: Must be either '64' or '32'
:returns: (floattype, numpyType)
"""
if bitEncoding == '64':
floattype = 'd' # 64-bit
numpyType = numpy.float64
elif bitEncoding == '32':... | python | def interpretBitEncoding(bitEncoding):
"""Returns a floattype string and a numpy array type.
:param bitEncoding: Must be either '64' or '32'
:returns: (floattype, numpyType)
"""
if bitEncoding == '64':
floattype = 'd' # 64-bit
numpyType = numpy.float64
elif bitEncoding == '32':... | [
"def",
"interpretBitEncoding",
"(",
"bitEncoding",
")",
":",
"if",
"bitEncoding",
"==",
"'64'",
":",
"floattype",
"=",
"'d'",
"# 64-bit",
"numpyType",
"=",
"numpy",
".",
"float64",
"elif",
"bitEncoding",
"==",
"'32'",
":",
"floattype",
"=",
"'f'",
"# 32-bit",
... | Returns a floattype string and a numpy array type.
:param bitEncoding: Must be either '64' or '32'
:returns: (floattype, numpyType) | [
"Returns",
"a",
"floattype",
"string",
"and",
"a",
"numpy",
"array",
"type",
"."
] | f15fcfd24df306d8420540460d902aa3073ec133 | https://github.com/hollenstein/maspy/blob/f15fcfd24df306d8420540460d902aa3073ec133/maspy/xml.py#L293-L311 |
38,694 | AshleySetter/optoanalysis | optoanalysis/optoanalysis/thermo/thermo.py | calc_partition_function | def calc_partition_function(mass, omega_array, temperature_array):
"""
Calculates the partition function of your system at each point in time.
Parameters
----------
mass : float
The mass of the particle in kg
omega_array : array
array which represents omega at every point in you... | python | def calc_partition_function(mass, omega_array, temperature_array):
"""
Calculates the partition function of your system at each point in time.
Parameters
----------
mass : float
The mass of the particle in kg
omega_array : array
array which represents omega at every point in you... | [
"def",
"calc_partition_function",
"(",
"mass",
",",
"omega_array",
",",
"temperature_array",
")",
":",
"Kappa_t",
"=",
"mass",
"*",
"omega_array",
"**",
"2",
"return",
"_np",
".",
"sqrt",
"(",
"4",
"*",
"_np",
".",
"pi",
"**",
"2",
"*",
"_scipy",
".",
... | Calculates the partition function of your system at each point in time.
Parameters
----------
mass : float
The mass of the particle in kg
omega_array : array
array which represents omega at every point in your time trace
and should therefore have the same length as the Hamiltoni... | [
"Calculates",
"the",
"partition",
"function",
"of",
"your",
"system",
"at",
"each",
"point",
"in",
"time",
"."
] | 9d390acc834d70024d47b574aea14189a5a5714e | https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/thermo/thermo.py#L185-L206 |
38,695 | AshleySetter/optoanalysis | optoanalysis/optoanalysis/thermo/thermo.py | ThermoObject.calc_mean_and_variance_of_variances | def calc_mean_and_variance_of_variances(self, NumberOfOscillations):
"""
Calculates the mean and variance of a set of varainces.
This set is obtained by splitting the timetrace into chunks
of points with a length of NumberOfOscillations oscillations.
Parameters
-----... | python | def calc_mean_and_variance_of_variances(self, NumberOfOscillations):
"""
Calculates the mean and variance of a set of varainces.
This set is obtained by splitting the timetrace into chunks
of points with a length of NumberOfOscillations oscillations.
Parameters
-----... | [
"def",
"calc_mean_and_variance_of_variances",
"(",
"self",
",",
"NumberOfOscillations",
")",
":",
"SplittedArraySize",
"=",
"int",
"(",
"self",
".",
"SampleFreq",
"/",
"self",
".",
"FTrap",
".",
"n",
")",
"*",
"NumberOfOscillations",
"VoltageArraySize",
"=",
"len"... | Calculates the mean and variance of a set of varainces.
This set is obtained by splitting the timetrace into chunks
of points with a length of NumberOfOscillations oscillations.
Parameters
----------
NumberOfOscillations : int
The number of oscillations each chun... | [
"Calculates",
"the",
"mean",
"and",
"variance",
"of",
"a",
"set",
"of",
"varainces",
".",
"This",
"set",
"is",
"obtained",
"by",
"splitting",
"the",
"timetrace",
"into",
"chunks",
"of",
"points",
"with",
"a",
"length",
"of",
"NumberOfOscillations",
"oscillatio... | 9d390acc834d70024d47b574aea14189a5a5714e | https://github.com/AshleySetter/optoanalysis/blob/9d390acc834d70024d47b574aea14189a5a5714e/optoanalysis/optoanalysis/thermo/thermo.py#L161-L182 |
38,696 | pauleveritt/kaybee | kaybee/plugins/resources/handlers.py | register_template_directory | def register_template_directory(kb_app: kb,
sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
docnames=List[str],
):
""" Add this resource's templates dir to template paths """
templa... | python | def register_template_directory(kb_app: kb,
sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
docnames=List[str],
):
""" Add this resource's templates dir to template paths """
templa... | [
"def",
"register_template_directory",
"(",
"kb_app",
":",
"kb",
",",
"sphinx_app",
":",
"Sphinx",
",",
"sphinx_env",
":",
"BuildEnvironment",
",",
"docnames",
"=",
"List",
"[",
"str",
"]",
",",
")",
":",
"template_bridge",
"=",
"sphinx_app",
".",
"builder",
... | Add this resource's templates dir to template paths | [
"Add",
"this",
"resource",
"s",
"templates",
"dir",
"to",
"template",
"paths"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/resources/handlers.py#L35-L48 |
38,697 | pauleveritt/kaybee | kaybee/plugins/resources/handlers.py | add_directives | def add_directives(kb_app: kb,
sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
docnames=List[str],
):
""" For each resource type, register a new Sphinx directive """
for k, v in list(kb_app.config.resources.items()):
sphinx_a... | python | def add_directives(kb_app: kb,
sphinx_app: Sphinx,
sphinx_env: BuildEnvironment,
docnames=List[str],
):
""" For each resource type, register a new Sphinx directive """
for k, v in list(kb_app.config.resources.items()):
sphinx_a... | [
"def",
"add_directives",
"(",
"kb_app",
":",
"kb",
",",
"sphinx_app",
":",
"Sphinx",
",",
"sphinx_env",
":",
"BuildEnvironment",
",",
"docnames",
"=",
"List",
"[",
"str",
"]",
",",
")",
":",
"for",
"k",
",",
"v",
"in",
"list",
"(",
"kb_app",
".",
"co... | For each resource type, register a new Sphinx directive | [
"For",
"each",
"resource",
"type",
"register",
"a",
"new",
"Sphinx",
"directive"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/resources/handlers.py#L52-L60 |
38,698 | pauleveritt/kaybee | kaybee/plugins/resources/handlers.py | stamp_title | def stamp_title(kb_app: kb,
sphinx_app: Sphinx,
doctree: doctree):
""" Walk the tree and extra RST title into resource.title """
# First, find out which resource this is. Won't be easy.
resources = sphinx_app.env.resources
confdir = sphinx_app.confdir
source = PurePa... | python | def stamp_title(kb_app: kb,
sphinx_app: Sphinx,
doctree: doctree):
""" Walk the tree and extra RST title into resource.title """
# First, find out which resource this is. Won't be easy.
resources = sphinx_app.env.resources
confdir = sphinx_app.confdir
source = PurePa... | [
"def",
"stamp_title",
"(",
"kb_app",
":",
"kb",
",",
"sphinx_app",
":",
"Sphinx",
",",
"doctree",
":",
"doctree",
")",
":",
"# First, find out which resource this is. Won't be easy.",
"resources",
"=",
"sphinx_app",
".",
"env",
".",
"resources",
"confdir",
"=",
"s... | Walk the tree and extra RST title into resource.title | [
"Walk",
"the",
"tree",
"and",
"extra",
"RST",
"title",
"into",
"resource",
".",
"title"
] | a00a718aaaa23b2d12db30dfacb6b2b6ec84459c | https://github.com/pauleveritt/kaybee/blob/a00a718aaaa23b2d12db30dfacb6b2b6ec84459c/kaybee/plugins/resources/handlers.py#L84-L102 |
38,699 | hbldh/flask-pybankid | flask_pybankid.py | PyBankID.handle_exception | def handle_exception(error):
"""Simple method for handling exceptions raised by `PyBankID`.
:param flask_pybankid.FlaskPyBankIDError error: The exception to handle.
:return: The exception represented as a dictionary.
:rtype: dict
"""
response = jsonify(error.to_dict())
... | python | def handle_exception(error):
"""Simple method for handling exceptions raised by `PyBankID`.
:param flask_pybankid.FlaskPyBankIDError error: The exception to handle.
:return: The exception represented as a dictionary.
:rtype: dict
"""
response = jsonify(error.to_dict())
... | [
"def",
"handle_exception",
"(",
"error",
")",
":",
"response",
"=",
"jsonify",
"(",
"error",
".",
"to_dict",
"(",
")",
")",
"response",
".",
"status_code",
"=",
"error",
".",
"status_code",
"return",
"response"
] | Simple method for handling exceptions raised by `PyBankID`.
:param flask_pybankid.FlaskPyBankIDError error: The exception to handle.
:return: The exception represented as a dictionary.
:rtype: dict | [
"Simple",
"method",
"for",
"handling",
"exceptions",
"raised",
"by",
"PyBankID",
"."
] | b9af666f587b027391b25d811788d934a12b57e6 | https://github.com/hbldh/flask-pybankid/blob/b9af666f587b027391b25d811788d934a12b57e6/flask_pybankid.py#L166-L176 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.