nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
msracver/Deformable-ConvNets | 6aeda878a95bcb55eadffbe125804e730574de8d | rfcn/core/DataParallelExecutorGroup.py | python | DataParallelExecutorGroup.backward | (self, out_grads=None) | Run backward on all devices. A backward should be called after
a call to the forward function. Backward cannot be called unless
`self.for_training` is `True`.
Parameters
----------
out_grads : NDArray or list of NDArray, optional
Gradient on the outputs to be propaga... | Run backward on all devices. A backward should be called after
a call to the forward function. Backward cannot be called unless
`self.for_training` is `True`. | [
"Run",
"backward",
"on",
"all",
"devices",
".",
"A",
"backward",
"should",
"be",
"called",
"after",
"a",
"call",
"to",
"the",
"forward",
"function",
".",
"Backward",
"cannot",
"be",
"called",
"unless",
"self",
".",
"for_training",
"is",
"True",
"."
] | def backward(self, out_grads=None):
"""Run backward on all devices. A backward should be called after
a call to the forward function. Backward cannot be called unless
`self.for_training` is `True`.
Parameters
----------
out_grads : NDArray or list of NDArray, optional
... | [
"def",
"backward",
"(",
"self",
",",
"out_grads",
"=",
"None",
")",
":",
"assert",
"self",
".",
"for_training",
",",
"'re-bind with for_training=True to run backward'",
"if",
"out_grads",
"is",
"None",
":",
"out_grads",
"=",
"[",
"]",
"for",
"i",
",",
"exec_",... | https://github.com/msracver/Deformable-ConvNets/blob/6aeda878a95bcb55eadffbe125804e730574de8d/rfcn/core/DataParallelExecutorGroup.py#L450-L468 | ||
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/build/pip/pip/_vendor/pkg_resources/__init__.py | python | WorkingSet.__init__ | (self, entries=None) | Create working set from list of path entries (default=sys.path) | Create working set from list of path entries (default=sys.path) | [
"Create",
"working",
"set",
"from",
"list",
"of",
"path",
"entries",
"(",
"default",
"=",
"sys",
".",
"path",
")"
] | def __init__(self, entries=None):
"""Create working set from list of path entries (default=sys.path)"""
self.entries = []
self.entry_keys = {}
self.by_key = {}
self.callbacks = []
if entries is None:
entries = sys.path
for entry in entries:
... | [
"def",
"__init__",
"(",
"self",
",",
"entries",
"=",
"None",
")",
":",
"self",
".",
"entries",
"=",
"[",
"]",
"self",
".",
"entry_keys",
"=",
"{",
"}",
"self",
".",
"by_key",
"=",
"{",
"}",
"self",
".",
"callbacks",
"=",
"[",
"]",
"if",
"entries"... | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/build/pip/pip/_vendor/pkg_resources/__init__.py#L618-L629 | ||
youfou/hsdata | 49866116eaeb78516829da59df59a2c0b1141c08 | hsdata/utils.py | python | cards_value | (decks, mode=MODE_STANDARD) | return stats | 区分职业的单卡价值排名,可在纠结是否合成或拆解时作为参考
decks: 所在卡组数量
games: 所在卡组游戏次数总和
wins: 所在卡组获胜次数总和
win_rate: 所在卡组平均胜率 (wins/games)
*_rank: 在当前职业所有卡牌中的 * 排名
*_rank%: 在当前职业所有卡牌中的 * 排名百分比 (排名/卡牌数)
:param decks: 卡组合集,作为分析数据源
:param mode: 模式
:return: 单卡价值排名数据 | 区分职业的单卡价值排名,可在纠结是否合成或拆解时作为参考 | [
"区分职业的单卡价值排名,可在纠结是否合成或拆解时作为参考"
] | def cards_value(decks, mode=MODE_STANDARD):
"""
区分职业的单卡价值排名,可在纠结是否合成或拆解时作为参考
decks: 所在卡组数量
games: 所在卡组游戏次数总和
wins: 所在卡组获胜次数总和
win_rate: 所在卡组平均胜率 (wins/games)
*_rank: 在当前职业所有卡牌中的 * 排名
*_rank%: 在当前职业所有卡牌中的 * 排名百分比 (排名/卡牌数)
:param decks: 卡组合集,作为分析数据源
:param mode: 模式
:return: 单... | [
"def",
"cards_value",
"(",
"decks",
",",
"mode",
"=",
"MODE_STANDARD",
")",
":",
"if",
"not",
"isinstance",
"(",
"decks",
",",
"Decks",
")",
":",
"raise",
"TypeError",
"(",
"'from_decks 须为 Decks 对象')",
"",
"total",
"=",
"'total'",
"ranked_keys",
"=",
"'decks... | https://github.com/youfou/hsdata/blob/49866116eaeb78516829da59df59a2c0b1141c08/hsdata/utils.py#L58-L129 | |
facebookresearch/Large-Scale-VRD | 7ababfe1023941c3653d7aebe9f835a47f5e8277 | lib/utils/lr_policy.py | python | get_step_index | (cur_iter) | return ind - 1 | Given an iteration, find which learning rate step we're at. | Given an iteration, find which learning rate step we're at. | [
"Given",
"an",
"iteration",
"find",
"which",
"learning",
"rate",
"step",
"we",
"re",
"at",
"."
] | def get_step_index(cur_iter):
"""Given an iteration, find which learning rate step we're at."""
assert cfg.SOLVER.STEPS[0] == 0, 'The first step should always start at 0.'
steps = cfg.SOLVER.STEPS + [cfg.SOLVER.MAX_ITER]
for ind, step in enumerate(steps): # NoQA
if cur_iter < step:
... | [
"def",
"get_step_index",
"(",
"cur_iter",
")",
":",
"assert",
"cfg",
".",
"SOLVER",
".",
"STEPS",
"[",
"0",
"]",
"==",
"0",
",",
"'The first step should always start at 0.'",
"steps",
"=",
"cfg",
".",
"SOLVER",
".",
"STEPS",
"+",
"[",
"cfg",
".",
"SOLVER",... | https://github.com/facebookresearch/Large-Scale-VRD/blob/7ababfe1023941c3653d7aebe9f835a47f5e8277/lib/utils/lr_policy.py#L89-L96 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/tkinter/__init__.py | python | Wm.wm_positionfrom | (self, who=None) | return self.tk.call('wm', 'positionfrom', self._w, who) | Instruct the window manager that the position of this widget shall
be defined by the user if WHO is "user", and by its own policy if WHO is
"program". | Instruct the window manager that the position of this widget shall
be defined by the user if WHO is "user", and by its own policy if WHO is
"program". | [
"Instruct",
"the",
"window",
"manager",
"that",
"the",
"position",
"of",
"this",
"widget",
"shall",
"be",
"defined",
"by",
"the",
"user",
"if",
"WHO",
"is",
"user",
"and",
"by",
"its",
"own",
"policy",
"if",
"WHO",
"is",
"program",
"."
] | def wm_positionfrom(self, who=None):
"""Instruct the window manager that the position of this widget shall
be defined by the user if WHO is "user", and by its own policy if WHO is
"program"."""
return self.tk.call('wm', 'positionfrom', self._w, who) | [
"def",
"wm_positionfrom",
"(",
"self",
",",
"who",
"=",
"None",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"'wm'",
",",
"'positionfrom'",
",",
"self",
".",
"_w",
",",
"who",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/tkinter/__init__.py#L1601-L1605 | |
PyAr/fades | 40a4cda535b2af6e141bdd68d6cfaab217eabe44 | fades/pipmanager.py | python | PipManager.get_version | (self, dependency) | Return the installed version parsing the output of 'pip show'. | Return the installed version parsing the output of 'pip show'. | [
"Return",
"the",
"installed",
"version",
"parsing",
"the",
"output",
"of",
"pip",
"show",
"."
] | def get_version(self, dependency):
"""Return the installed version parsing the output of 'pip show'."""
logger.debug("getting installed version for %s", dependency)
stdout = helpers.logged_exec([self.pip_exe, "show", str(dependency)])
version = [line for line in stdout if line.startswith... | [
"def",
"get_version",
"(",
"self",
",",
"dependency",
")",
":",
"logger",
".",
"debug",
"(",
"\"getting installed version for %s\"",
",",
"dependency",
")",
"stdout",
"=",
"helpers",
".",
"logged_exec",
"(",
"[",
"self",
".",
"pip_exe",
",",
"\"show\"",
",",
... | https://github.com/PyAr/fades/blob/40a4cda535b2af6e141bdd68d6cfaab217eabe44/fades/pipmanager.py#L84-L96 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/PIL/ImageDraw2.py | python | Font.__init__ | (self, color, file, size=12) | [] | def __init__(self, color, file, size=12):
# FIXME: add support for bitmap fonts
self.color = ImageColor.getrgb(color)
self.font = ImageFont.truetype(file, size) | [
"def",
"__init__",
"(",
"self",
",",
"color",
",",
"file",
",",
"size",
"=",
"12",
")",
":",
"# FIXME: add support for bitmap fonts",
"self",
".",
"color",
"=",
"ImageColor",
".",
"getrgb",
"(",
"color",
")",
"self",
".",
"font",
"=",
"ImageFont",
".",
"... | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/PIL/ImageDraw2.py#L34-L37 | ||||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v8/services/services/customer_client_service/client.py | python | CustomerClientServiceClient.common_project_path | (project: str,) | return "projects/{project}".format(project=project,) | Return a fully-qualified project string. | Return a fully-qualified project string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"project",
"string",
"."
] | def common_project_path(project: str,) -> str:
"""Return a fully-qualified project string."""
return "projects/{project}".format(project=project,) | [
"def",
"common_project_path",
"(",
"project",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"projects/{project}\"",
".",
"format",
"(",
"project",
"=",
"project",
",",
")"
] | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v8/services/services/customer_client_service/client.py#L236-L238 | |
Cadene/tensorflow-model-zoo.torch | 990b10ffc22d4c8eacb2a502f20415b4f70c74c2 | models/research/pcl_rl/controller.py | python | Controller.convert_from_batched_episodes | (
self, initial_state, observations, actions, rewards,
terminated, pads) | return episodes | Convert time-major batch of episodes to batch-major list of episodes. | Convert time-major batch of episodes to batch-major list of episodes. | [
"Convert",
"time",
"-",
"major",
"batch",
"of",
"episodes",
"to",
"batch",
"-",
"major",
"list",
"of",
"episodes",
"."
] | def convert_from_batched_episodes(
self, initial_state, observations, actions, rewards,
terminated, pads):
"""Convert time-major batch of episodes to batch-major list of episodes."""
rewards = np.array(rewards)
pads = np.array(pads)
observations = [np.array(obs) for obs in observations]
... | [
"def",
"convert_from_batched_episodes",
"(",
"self",
",",
"initial_state",
",",
"observations",
",",
"actions",
",",
"rewards",
",",
"terminated",
",",
"pads",
")",
":",
"rewards",
"=",
"np",
".",
"array",
"(",
"rewards",
")",
"pads",
"=",
"np",
".",
"arra... | https://github.com/Cadene/tensorflow-model-zoo.torch/blob/990b10ffc22d4c8eacb2a502f20415b4f70c74c2/models/research/pcl_rl/controller.py#L336-L361 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Misc/Vim/vim_syntax.py | python | str_regexes | () | Generator to yield various combinations of strings regexes | Generator to yield various combinations of strings regexes | [
"Generator",
"to",
"yield",
"various",
"combinations",
"of",
"strings",
"regexes"
] | def str_regexes():
"""Generator to yield various combinations of strings regexes"""
regex_template = Template('matchgroup=Normal ' +
'start=+[uU]\=${raw}${sep}+ ' +
'end=+${sep}+ ' +
'${skip} ' +
... | [
"def",
"str_regexes",
"(",
")",
":",
"regex_template",
"=",
"Template",
"(",
"'matchgroup=Normal '",
"+",
"'start=+[uU]\\=${raw}${sep}+ '",
"+",
"'end=+${sep}+ '",
"+",
"'${skip} '",
"+",
"'${contains}'",
")",
"skip_regex",
"=",
"Template",
"(",
"r'skip=+\\\\\\\\\\|\\\\... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Misc/Vim/vim_syntax.py#L57-L73 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/sre_parse.py | python | Pattern.checkgroup | (self, gid) | return gid < self.groups and gid not in self.open | [] | def checkgroup(self, gid):
return gid < self.groups and gid not in self.open | [
"def",
"checkgroup",
"(",
"self",
",",
"gid",
")",
":",
"return",
"gid",
"<",
"self",
".",
"groups",
"and",
"gid",
"not",
"in",
"self",
".",
"open"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/sre_parse.py#L86-L87 | |||
hellerbarde/stapler | 1cabc85521e2badfc1e0d690086e286e701c2d9e | staplelib/iohelper.py | python | read_pdf | (filename) | return pdf | Open a PDF file with PyPDF2. | Open a PDF file with PyPDF2. | [
"Open",
"a",
"PDF",
"file",
"with",
"PyPDF2",
"."
] | def read_pdf(filename):
"""Open a PDF file with PyPDF2."""
if not os.path.exists(filename):
raise CommandError("{} does not exist".format(filename))
pdf = PdfFileReader(open(filename, "rb"))
if pdf.isEncrypted:
while True:
pw = prompt_for_pw(filename)
matched = pd... | [
"def",
"read_pdf",
"(",
"filename",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"raise",
"CommandError",
"(",
"\"{} does not exist\"",
".",
"format",
"(",
"filename",
")",
")",
"pdf",
"=",
"PdfFileReader",
"(",
"op... | https://github.com/hellerbarde/stapler/blob/1cabc85521e2badfc1e0d690086e286e701c2d9e/staplelib/iohelper.py#L30-L43 | |
ChunyuanLI/Optimus | f63f4a7ca10aea022978500a37d72dd53a37a576 | code/examples/run_bertology.py | python | compute_heads_importance | (args, model, eval_dataloader, compute_entropy=True, compute_importance=True, head_mask=None) | return attn_entropy, head_importance, preds, labels | This method shows how to compute:
- head attention entropy
- head importance scores according to http://arxiv.org/abs/1905.10650 | This method shows how to compute:
- head attention entropy
- head importance scores according to http://arxiv.org/abs/1905.10650 | [
"This",
"method",
"shows",
"how",
"to",
"compute",
":",
"-",
"head",
"attention",
"entropy",
"-",
"head",
"importance",
"scores",
"according",
"to",
"http",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1905",
".",
"10650"
] | def compute_heads_importance(args, model, eval_dataloader, compute_entropy=True, compute_importance=True, head_mask=None):
""" This method shows how to compute:
- head attention entropy
- head importance scores according to http://arxiv.org/abs/1905.10650
"""
# Prepare our tensors
n_laye... | [
"def",
"compute_heads_importance",
"(",
"args",
",",
"model",
",",
"eval_dataloader",
",",
"compute_entropy",
"=",
"True",
",",
"compute_importance",
"=",
"True",
",",
"head_mask",
"=",
"None",
")",
":",
"# Prepare our tensors",
"n_layers",
",",
"n_heads",
"=",
... | https://github.com/ChunyuanLI/Optimus/blob/f63f4a7ca10aea022978500a37d72dd53a37a576/code/examples/run_bertology.py#L65-L135 | |
ProjectQ-Framework/ProjectQ | 0d32c1610ba4e9aefd7f19eb52dadb4fbe5f9005 | projectq/backends/_awsbraket/_awsbraket_boto3_client.py | python | AWSBraket.can_run_experiment | (self, info, device) | return nb_qubit_needed <= nb_qubit_max, nb_qubit_max, nb_qubit_needed | Check if the device is big enough to run the code.
Args:
info (dict): dictionary sent by the backend containing the code to run
device (str): name of the device to use
Returns:
(tuple): (bool) True if device is big enough, False otherwise (int)
... | Check if the device is big enough to run the code. | [
"Check",
"if",
"the",
"device",
"is",
"big",
"enough",
"to",
"run",
"the",
"code",
"."
] | def can_run_experiment(self, info, device):
"""
Check if the device is big enough to run the code.
Args:
info (dict): dictionary sent by the backend containing the code to run
device (str): name of the device to use
Returns:
(tuple): (bool) True if d... | [
"def",
"can_run_experiment",
"(",
"self",
",",
"info",
",",
"device",
")",
":",
"nb_qubit_max",
"=",
"self",
".",
"backends",
"[",
"device",
"]",
"[",
"'nq'",
"]",
"nb_qubit_needed",
"=",
"info",
"[",
"'nq'",
"]",
"return",
"nb_qubit_needed",
"<=",
"nb_qub... | https://github.com/ProjectQ-Framework/ProjectQ/blob/0d32c1610ba4e9aefd7f19eb52dadb4fbe5f9005/projectq/backends/_awsbraket/_awsbraket_boto3_client.py#L155-L170 | |
readthedocs/readthedocs.org | 0852d7c10d725d954d3e9a93513171baa1116d9f | readthedocs/analytics/utils.py | python | anonymize_ip_address | (ip_address) | return anonymized_ip.compressed | Anonymizes an IP address by zeroing the last 2 bytes. | Anonymizes an IP address by zeroing the last 2 bytes. | [
"Anonymizes",
"an",
"IP",
"address",
"by",
"zeroing",
"the",
"last",
"2",
"bytes",
"."
] | def anonymize_ip_address(ip_address):
"""Anonymizes an IP address by zeroing the last 2 bytes."""
# Used to anonymize an IP by zero-ing out the last 2 bytes
ip_mask = int('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000', 16)
try:
ip_obj = ipaddress.ip_address(force_str(ip_address))
except ValueError:
... | [
"def",
"anonymize_ip_address",
"(",
"ip_address",
")",
":",
"# Used to anonymize an IP by zero-ing out the last 2 bytes",
"ip_mask",
"=",
"int",
"(",
"'0xFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000'",
",",
"16",
")",
"try",
":",
"ip_obj",
"=",
"ipaddress",
".",
"ip_address",
"(",
... | https://github.com/readthedocs/readthedocs.org/blob/0852d7c10d725d954d3e9a93513171baa1116d9f/readthedocs/analytics/utils.py#L44-L55 | |
googledatalab/pydatalab | 1c86e26a0d24e3bc8097895ddeab4d0607be4c40 | google/datalab/bigquery/_schema.py | python | SchemaField.__getitem__ | (self, item) | [] | def __getitem__(self, item):
# TODO(gram): Currently we need this for a Schema object to work with the Parser object.
# Eventually if we change Parser to only work with Schema (and not also with the
# schema dictionaries in query results) we can remove this.
if item == 'name':
return self.name
... | [
"def",
"__getitem__",
"(",
"self",
",",
"item",
")",
":",
"# TODO(gram): Currently we need this for a Schema object to work with the Parser object.",
"# Eventually if we change Parser to only work with Schema (and not also with the",
"# schema dictionaries in query results) we can remove this.",... | https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/google/datalab/bigquery/_schema.py#L62-L74 | ||||
microsoft/NimbusML | f6be39ce9359786976429bab0ccd837e849b4ba5 | src/python/nimbusml/datasets/datasets.py | python | DataSet.__setattr__ | (self, name, value) | Creation of a new column.
We add it to the members of the class. | Creation of a new column.
We add it to the members of the class. | [
"Creation",
"of",
"a",
"new",
"column",
".",
"We",
"add",
"it",
"to",
"the",
"members",
"of",
"the",
"class",
"."
] | def __setattr__(self, name, value):
"""
Creation of a new column.
We add it to the members of the class.
"""
if isinstance(value, (list, pandas.Series, numpy.ndarray)):
if isinstance(value, pandas.Series):
if value.dtype == bool:
va... | [
"def",
"__setattr__",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"list",
",",
"pandas",
".",
"Series",
",",
"numpy",
".",
"ndarray",
")",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"pandas",
... | https://github.com/microsoft/NimbusML/blob/f6be39ce9359786976429bab0ccd837e849b4ba5/src/python/nimbusml/datasets/datasets.py#L46-L69 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/tsf/v20180326/models.py | python | DescribePublicConfigsRequest.__init__ | (self) | r"""
:param ConfigId: 配置项ID,不传入时查询全量,高优先级
:type ConfigId: str
:param Offset: 偏移量,默认为0
:type Offset: int
:param Limit: 每页条数,默认为20
:type Limit: int
:param ConfigIdList: 配置项ID列表,不传入时查询全量,低优先级
:type ConfigIdList: list of str
:param ConfigName: 配置项名称,精确... | r"""
:param ConfigId: 配置项ID,不传入时查询全量,高优先级
:type ConfigId: str
:param Offset: 偏移量,默认为0
:type Offset: int
:param Limit: 每页条数,默认为20
:type Limit: int
:param ConfigIdList: 配置项ID列表,不传入时查询全量,低优先级
:type ConfigIdList: list of str
:param ConfigName: 配置项名称,精确... | [
"r",
":",
"param",
"ConfigId",
":",
"配置项ID,不传入时查询全量,高优先级",
":",
"type",
"ConfigId",
":",
"str",
":",
"param",
"Offset",
":",
"偏移量,默认为0",
":",
"type",
"Offset",
":",
"int",
":",
"param",
"Limit",
":",
"每页条数,默认为20",
":",
"type",
"Limit",
":",
"int",
":",
... | def __init__(self):
r"""
:param ConfigId: 配置项ID,不传入时查询全量,高优先级
:type ConfigId: str
:param Offset: 偏移量,默认为0
:type Offset: int
:param Limit: 每页条数,默认为20
:type Limit: int
:param ConfigIdList: 配置项ID列表,不传入时查询全量,低优先级
:type ConfigIdList: list of str
... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"ConfigId",
"=",
"None",
"self",
".",
"Offset",
"=",
"None",
"self",
".",
"Limit",
"=",
"None",
"self",
".",
"ConfigIdList",
"=",
"None",
"self",
".",
"ConfigName",
"=",
"None",
"self",
".",
"Con... | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/tsf/v20180326/models.py#L8419-L8439 | ||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/case_importer/views.py | python | _bulk_case_upload_api | (request, domain) | return json_response({"code": 200, "message": "success", "status_url": status_url}) | [] | def _bulk_case_upload_api(request, domain):
try:
upload_file = request.FILES["file"]
case_type = request.POST["case_type"]
if not upload_file or not case_type:
raise Exception
except Exception:
raise ImporterError("Invalid POST request. "
"Both 'file' and 'cas... | [
"def",
"_bulk_case_upload_api",
"(",
"request",
",",
"domain",
")",
":",
"try",
":",
"upload_file",
"=",
"request",
".",
"FILES",
"[",
"\"file\"",
"]",
"case_type",
"=",
"request",
".",
"POST",
"[",
"\"case_type\"",
"]",
"if",
"not",
"upload_file",
"or",
"... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/case_importer/views.py#L305-L370 | |||
lorentzenman/sheepl | a999bcfc5e73d8c173b76a6082cbe65b6618984e | tasks/shell/CommandShell.py | python | CommandShellAutoITBlock.text_typing_block | (self) | return textwrap.indent(typing_text, self.indent_space) | Takes the Typing Text Input | Takes the Typing Text Input | [
"Takes",
"the",
"Typing",
"Text",
"Input"
] | def text_typing_block(self):
"""
Takes the Typing Text Input
"""
# Grabas the command list and goes through it
# This uses the textwrap.indent to add in the indentation
typing_text = '\n'
for command in self.commands:
# these are individual send co... | [
"def",
"text_typing_block",
"(",
"self",
")",
":",
"# Grabas the command list and goes through it",
"# This uses the textwrap.indent to add in the indentation",
"typing_text",
"=",
"'\\n'",
"for",
"command",
"in",
"self",
".",
"commands",
":",
"# these are individual send command... | https://github.com/lorentzenman/sheepl/blob/a999bcfc5e73d8c173b76a6082cbe65b6618984e/tasks/shell/CommandShell.py#L369-L391 | |
balanced/status.balancedpayments.com | e51a371079a8fa215732be3cfa57497a9d113d35 | venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/util.py | python | egg_link_path | (dist) | Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site_packages
3) in a yes-global virtualenv
try to find in site_packages, ... | Return the path for the .egg-link file if it exists, otherwise, None. | [
"Return",
"the",
"path",
"for",
"the",
".",
"egg",
"-",
"link",
"file",
"if",
"it",
"exists",
"otherwise",
"None",
"."
] | def egg_link_path(dist):
"""
Return the path for the .egg-link file if it exists, otherwise, None.
There's 3 scenarios:
1) not in a virtualenv
try to find in site.USER_SITE, then site_packages
2) in a no-global virtualenv
try to find in site_packages
3) in a yes-global virtualenv
... | [
"def",
"egg_link_path",
"(",
"dist",
")",
":",
"sites",
"=",
"[",
"]",
"if",
"running_under_virtualenv",
"(",
")",
":",
"if",
"virtualenv_no_global",
"(",
")",
":",
"sites",
".",
"append",
"(",
"site_packages",
")",
"else",
":",
"sites",
".",
"append",
"... | https://github.com/balanced/status.balancedpayments.com/blob/e51a371079a8fa215732be3cfa57497a9d113d35/venv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/util.py#L391-L422 | ||
SanPen/GridCal | d3f4566d2d72c11c7e910c9d162538ef0e60df31 | src/GridCal/Engine/Devices/branch.py | python | Branch.apply_tap_changer | (self, tap_changer: TapChanger) | Apply a new tap changer
Argument:
**tap_changer** (:class:`GridCal.Engine.Devices.branch.TapChanger`): Tap changer object | Apply a new tap changer | [
"Apply",
"a",
"new",
"tap",
"changer"
] | def apply_tap_changer(self, tap_changer: TapChanger):
"""
Apply a new tap changer
Argument:
**tap_changer** (:class:`GridCal.Engine.Devices.branch.TapChanger`): Tap changer object
"""
self.tap_changer = tap_changer
if self.tap_module != 0:
self... | [
"def",
"apply_tap_changer",
"(",
"self",
",",
"tap_changer",
":",
"TapChanger",
")",
":",
"self",
".",
"tap_changer",
"=",
"tap_changer",
"if",
"self",
".",
"tap_module",
"!=",
"0",
":",
"self",
".",
"tap_changer",
".",
"set_tap",
"(",
"self",
".",
"tap_mo... | https://github.com/SanPen/GridCal/blob/d3f4566d2d72c11c7e910c9d162538ef0e60df31/src/GridCal/Engine/Devices/branch.py#L525-L539 | ||
colinsongf/keyword_spotting | 6f93c5d6356932dc34d9956100e869a4f430a386 | normalize.py | python | run_command | (cmd, raw=True) | Generic function to run a command.
Set raw to pass the actual command.
Set dry to just print and don't actually run.
Returns stdout + stderr. | Generic function to run a command.
Set raw to pass the actual command.
Set dry to just print and don't actually run. | [
"Generic",
"function",
"to",
"run",
"a",
"command",
".",
"Set",
"raw",
"to",
"pass",
"the",
"actual",
"command",
".",
"Set",
"dry",
"to",
"just",
"print",
"and",
"don",
"t",
"actually",
"run",
"."
] | def run_command(cmd, raw=True):
logger.info(cmd)
"""
Generic function to run a command.
Set raw to pass the actual command.
Set dry to just print and don't actually run.
Returns stdout + stderr.
"""
logger.debug("[command] {0}".format(cmd))
if raw:
p = subprocess.Popen(cmd,... | [
"def",
"run_command",
"(",
"cmd",
",",
"raw",
"=",
"True",
")",
":",
"logger",
".",
"info",
"(",
"cmd",
")",
"logger",
".",
"debug",
"(",
"\"[command] {0}\"",
".",
"format",
"(",
"cmd",
")",
")",
"if",
"raw",
":",
"p",
"=",
"subprocess",
".",
"Pope... | https://github.com/colinsongf/keyword_spotting/blob/6f93c5d6356932dc34d9956100e869a4f430a386/normalize.py#L132-L158 | ||
OpenZWave/python-openzwave | 8be4c070294348f3fc268bc1d7ad2c535f352f5a | src-api/openzwave/command.py | python | ZWaveNodeSwitch.get_rgbbulbs | (self) | return self.get_values(class_id=0x33, genre='User', \
type='String', readonly=False, writeonly=False) | The command 0x33 (COMMAND_CLASS_COLOR) of this node.
Retrieve the list of values to consider as RGBW bulbs.
Filter rules are :
command_class = 0x33
genre = "User"
type = "String"
readonly = False
writeonly = False
:return: The list of... | The command 0x33 (COMMAND_CLASS_COLOR) of this node.
Retrieve the list of values to consider as RGBW bulbs.
Filter rules are : | [
"The",
"command",
"0x33",
"(",
"COMMAND_CLASS_COLOR",
")",
"of",
"this",
"node",
".",
"Retrieve",
"the",
"list",
"of",
"values",
"to",
"consider",
"as",
"RGBW",
"bulbs",
".",
"Filter",
"rules",
"are",
":"
] | def get_rgbbulbs(self):
"""
The command 0x33 (COMMAND_CLASS_COLOR) of this node.
Retrieve the list of values to consider as RGBW bulbs.
Filter rules are :
command_class = 0x33
genre = "User"
type = "String"
readonly = False
wri... | [
"def",
"get_rgbbulbs",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_values",
"(",
"class_id",
"=",
"0x33",
",",
"genre",
"=",
"'User'",
",",
"type",
"=",
"'String'",
",",
"readonly",
"=",
"False",
",",
"writeonly",
"=",
"False",
")"
] | https://github.com/OpenZWave/python-openzwave/blob/8be4c070294348f3fc268bc1d7ad2c535f352f5a/src-api/openzwave/command.py#L634-L651 | |
corpnewt/ProperTree | da07e88a95eadc7fbeb5c3739f4e2c293eed764e | Scripts/plist.py | python | _BinaryPlistParser._get_size | (self, tokenL) | return tokenL | return the size of the next object. | return the size of the next object. | [
"return",
"the",
"size",
"of",
"the",
"next",
"object",
"."
] | def _get_size(self, tokenL):
""" return the size of the next object."""
if tokenL == 0xF:
m = ord(self._fp.read(1)[0]) & 0x3
s = 1 << m
f = '>' + _BINARY_FORMAT[s]
return struct.unpack(f, self._fp.read(s))[0]
return tokenL | [
"def",
"_get_size",
"(",
"self",
",",
"tokenL",
")",
":",
"if",
"tokenL",
"==",
"0xF",
":",
"m",
"=",
"ord",
"(",
"self",
".",
"_fp",
".",
"read",
"(",
"1",
")",
"[",
"0",
"]",
")",
"&",
"0x3",
"s",
"=",
"1",
"<<",
"m",
"f",
"=",
"'>'",
"... | https://github.com/corpnewt/ProperTree/blob/da07e88a95eadc7fbeb5c3739f4e2c293eed764e/Scripts/plist.py#L242-L250 | |
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/pickletools.py | python | dis | (pickle, out=None, memo=None, indentlevel=4) | Produce a symbolic disassembly of a pickle.
'pickle' is a file-like object, or string, containing a (at least one)
pickle. The pickle is disassembled from the current position, through
the first STOP opcode encountered.
Optional arg 'out' is a file-like object to which the disassembly is
printed.... | Produce a symbolic disassembly of a pickle. | [
"Produce",
"a",
"symbolic",
"disassembly",
"of",
"a",
"pickle",
"."
] | def dis(pickle, out=None, memo=None, indentlevel=4):
"""Produce a symbolic disassembly of a pickle.
'pickle' is a file-like object, or string, containing a (at least one)
pickle. The pickle is disassembled from the current position, through
the first STOP opcode encountered.
Optional arg 'out' is... | [
"def",
"dis",
"(",
"pickle",
",",
"out",
"=",
"None",
",",
"memo",
"=",
"None",
",",
"indentlevel",
"=",
"4",
")",
":",
"# Most of the hair here is for sanity checks, but most of it is needed",
"# anyway to detect when a protocol 0 POP takes a MARK off the stack",
"# (which i... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/pickletools.py#L1892-L2026 | ||
nipy/heudiconv | 80a65385ef867124611d037fceac27d27e30f480 | heudiconv/main.py | python | setup_exceptionhook | () | Overloads default sys.excepthook with our exceptionhook handler.
If interactive, our exceptionhook handler will invoke pdb.post_mortem;
if not interactive, then invokes default handler. | Overloads default sys.excepthook with our exceptionhook handler. | [
"Overloads",
"default",
"sys",
".",
"excepthook",
"with",
"our",
"exceptionhook",
"handler",
"."
] | def setup_exceptionhook():
"""
Overloads default sys.excepthook with our exceptionhook handler.
If interactive, our exceptionhook handler will invoke pdb.post_mortem;
if not interactive, then invokes default handler.
"""
def _pdb_excepthook(type, value, tb):
if is_interactive():
... | [
"def",
"setup_exceptionhook",
"(",
")",
":",
"def",
"_pdb_excepthook",
"(",
"type",
",",
"value",
",",
"tb",
")",
":",
"if",
"is_interactive",
"(",
")",
":",
"import",
"traceback",
"import",
"pdb",
"traceback",
".",
"print_exception",
"(",
"type",
",",
"va... | https://github.com/nipy/heudiconv/blob/80a65385ef867124611d037fceac27d27e30f480/heudiconv/main.py#L25-L43 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/xml/etree/ElementPath.py | python | xpath_tokenizer | (pattern, namespaces=None) | [] | def xpath_tokenizer(pattern, namespaces=None):
default_namespace = namespaces.get('') if namespaces else None
parsing_attribute = False
for token in xpath_tokenizer_re.findall(pattern):
ttype, tag = token
if tag and tag[0] != "{":
if ":" in tag:
prefix, uri = tag.... | [
"def",
"xpath_tokenizer",
"(",
"pattern",
",",
"namespaces",
"=",
"None",
")",
":",
"default_namespace",
"=",
"namespaces",
".",
"get",
"(",
"''",
")",
"if",
"namespaces",
"else",
"None",
"parsing_attribute",
"=",
"False",
"for",
"token",
"in",
"xpath_tokenize... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xml/etree/ElementPath.py#L74-L95 | ||||
fluentpython/notebooks | 0f6e1e8d1686743dacd9281df7c5b5921812010a | attic/metaprog/spreadsheet.py | python | Spreadsheet.__setitem__ | (self, key, formula) | [] | def __setitem__(self, key, formula):
self._cells[key] = formula | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"formula",
")",
":",
"self",
".",
"_cells",
"[",
"key",
"]",
"=",
"formula"
] | https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/attic/metaprog/spreadsheet.py#L37-L38 | ||||
bugcrowd/HUNT | ed3e1adee724bf6c98750f377f6c40cd656c82d3 | Burp/lib/methodology_view.py | python | View.set_checklist | (self, file_name) | [] | def set_checklist(self, file_name):
self.data.set_checklist(file_name)
self.checklist = self.data.get_checklist() | [
"def",
"set_checklist",
"(",
"self",
",",
"file_name",
")",
":",
"self",
".",
"data",
".",
"set_checklist",
"(",
"file_name",
")",
"self",
".",
"checklist",
"=",
"self",
".",
"data",
".",
"get_checklist",
"(",
")"
] | https://github.com/bugcrowd/HUNT/blob/ed3e1adee724bf6c98750f377f6c40cd656c82d3/Burp/lib/methodology_view.py#L37-L39 | ||||
intel/virtual-storage-manager | 00706ab9701acbd0d5e04b19cc80c6b66a2973b8 | source/vsm/vsm/api/urlmap.py | python | URLMap._accept_strategy | (self, host, port, environ, supported_content_types) | return mime_type, app | Check Accept header for best matching MIME type and API version. | Check Accept header for best matching MIME type and API version. | [
"Check",
"Accept",
"header",
"for",
"best",
"matching",
"MIME",
"type",
"and",
"API",
"version",
"."
] | def _accept_strategy(self, host, port, environ, supported_content_types):
"""Check Accept header for best matching MIME type and API version."""
accept = Accept(environ.get('HTTP_ACCEPT', ''))
app = None
# Find the best match in the Accept header
mime_type, params = accept.best... | [
"def",
"_accept_strategy",
"(",
"self",
",",
"host",
",",
"port",
",",
"environ",
",",
"supported_content_types",
")",
":",
"accept",
"=",
"Accept",
"(",
"environ",
".",
"get",
"(",
"'HTTP_ACCEPT'",
",",
"''",
")",
")",
"app",
"=",
"None",
"# Find the best... | https://github.com/intel/virtual-storage-manager/blob/00706ab9701acbd0d5e04b19cc80c6b66a2973b8/source/vsm/vsm/api/urlmap.py#L219-L232 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/ntp.py | python | get_peers_for | (node: Node) | Return NTP peers to use for the given node.
For all node types other than region or region+rack controllers, this
returns the empty set. | Return NTP peers to use for the given node. | [
"Return",
"NTP",
"peers",
"to",
"use",
"for",
"the",
"given",
"node",
"."
] | def get_peers_for(node: Node) -> FrozenSet[str]:
"""Return NTP peers to use for the given node.
For all node types other than region or region+rack controllers, this
returns the empty set.
"""
if node is None:
return frozenset()
elif node.is_region_controller:
peer_regions = Reg... | [
"def",
"get_peers_for",
"(",
"node",
":",
"Node",
")",
"->",
"FrozenSet",
"[",
"str",
"]",
":",
"if",
"node",
"is",
"None",
":",
"return",
"frozenset",
"(",
")",
"elif",
"node",
".",
"is_region_controller",
":",
"peer_regions",
"=",
"RegionController",
"."... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/ntp.py#L48-L62 | ||
kelvinguu/neural-editor | 3390140cb727b8c44092398fa68ceb0231b28e8b | third-party/gtd/gtd/turk.py | python | ExternalQuestionTask.url | (self) | return self._url | The task URL, not including parameters appended to the end (str). | The task URL, not including parameters appended to the end (str). | [
"The",
"task",
"URL",
"not",
"including",
"parameters",
"appended",
"to",
"the",
"end",
"(",
"str",
")",
"."
] | def url(self):
"""The task URL, not including parameters appended to the end (str)."""
return self._url | [
"def",
"url",
"(",
"self",
")",
":",
"return",
"self",
".",
"_url"
] | https://github.com/kelvinguu/neural-editor/blob/3390140cb727b8c44092398fa68ceb0231b28e8b/third-party/gtd/gtd/turk.py#L244-L246 | |
igraph/python-igraph | e9f83e8af08f24ea025596e745917197d8b44d94 | src/igraph/app/shell.py | python | Shell.get_status_handler | (self) | return None | Returns the status handler (if exists) or None (if not). | Returns the status handler (if exists) or None (if not). | [
"Returns",
"the",
"status",
"handler",
"(",
"if",
"exists",
")",
"or",
"None",
"(",
"if",
"not",
")",
"."
] | def get_status_handler(self):
"""Returns the status handler (if exists) or None (if not)."""
if self.supports_status_messages():
return self._status_handler
return None | [
"def",
"get_status_handler",
"(",
"self",
")",
":",
"if",
"self",
".",
"supports_status_messages",
"(",
")",
":",
"return",
"self",
".",
"_status_handler",
"return",
"None"
] | https://github.com/igraph/python-igraph/blob/e9f83e8af08f24ea025596e745917197d8b44d94/src/igraph/app/shell.py#L317-L321 | |
EventGhost/EventGhost | 177be516849e74970d2e13cda82244be09f277ce | plugins/IrfanView/__init__.py | python | IrfanView.GetIrfanViewPath | (self) | return IrfanViewPath | Get the path of IrfanView's install-dir through querying the
Windows registry. | Get the path of IrfanView's install-dir through querying the
Windows registry. | [
"Get",
"the",
"path",
"of",
"IrfanView",
"s",
"install",
"-",
"dir",
"through",
"querying",
"the",
"Windows",
"registry",
"."
] | def GetIrfanViewPath(self):
"""
Get the path of IrfanView's install-dir through querying the
Windows registry.
"""
try:
iv_reg = _winreg.OpenKey(
_winreg.HKEY_CLASSES_ROOT,
"\\Applications\\i_view32.exe\\shell\\open\\command"
... | [
"def",
"GetIrfanViewPath",
"(",
"self",
")",
":",
"try",
":",
"iv_reg",
"=",
"_winreg",
".",
"OpenKey",
"(",
"_winreg",
".",
"HKEY_CLASSES_ROOT",
",",
"\"\\\\Applications\\\\i_view32.exe\\\\shell\\\\open\\\\command\"",
")",
"IrfanViewPath",
"=",
"_winreg",
".",
"Query... | https://github.com/EventGhost/EventGhost/blob/177be516849e74970d2e13cda82244be09f277ce/plugins/IrfanView/__init__.py#L318-L334 | |
scipy/scipy | e0a749f01e79046642ccfdc419edbf9e7ca141ad | scipy/sparse/linalg/_norm.py | python | norm | (x, ord=None, axis=None) | Norm of a sparse matrix
This function is able to return one of seven different matrix norms,
depending on the value of the ``ord`` parameter.
Parameters
----------
x : a sparse matrix
Input sparse matrix.
ord : {non-zero int, inf, -inf, 'fro'}, optional
Order of the norm (see t... | Norm of a sparse matrix | [
"Norm",
"of",
"a",
"sparse",
"matrix"
] | def norm(x, ord=None, axis=None):
"""
Norm of a sparse matrix
This function is able to return one of seven different matrix norms,
depending on the value of the ``ord`` parameter.
Parameters
----------
x : a sparse matrix
Input sparse matrix.
ord : {non-zero int, inf, -inf, 'fr... | [
"def",
"norm",
"(",
"x",
",",
"ord",
"=",
"None",
",",
"axis",
"=",
"None",
")",
":",
"if",
"not",
"issparse",
"(",
"x",
")",
":",
"raise",
"TypeError",
"(",
"\"input is not sparse. use numpy.linalg.norm\"",
")",
"# Check the default case first and handle it immed... | https://github.com/scipy/scipy/blob/e0a749f01e79046642ccfdc419edbf9e7ca141ad/scipy/sparse/linalg/_norm.py#L20-L182 | ||
clinicalml/cfrnet | 9daea5d8ba7cb89f413065c5ce7f0136f0e84c9b | cfr/util.py | python | pdist2sq | (X,Y) | return D | Computes the squared Euclidean distance between all pairs x in X, y in Y | Computes the squared Euclidean distance between all pairs x in X, y in Y | [
"Computes",
"the",
"squared",
"Euclidean",
"distance",
"between",
"all",
"pairs",
"x",
"in",
"X",
"y",
"in",
"Y"
] | def pdist2sq(X,Y):
""" Computes the squared Euclidean distance between all pairs x in X, y in Y """
C = -2*tf.matmul(X,tf.transpose(Y))
nx = tf.reduce_sum(tf.square(X),1,keep_dims=True)
ny = tf.reduce_sum(tf.square(Y),1,keep_dims=True)
D = (C + tf.transpose(ny)) + nx
return D | [
"def",
"pdist2sq",
"(",
"X",
",",
"Y",
")",
":",
"C",
"=",
"-",
"2",
"*",
"tf",
".",
"matmul",
"(",
"X",
",",
"tf",
".",
"transpose",
"(",
"Y",
")",
")",
"nx",
"=",
"tf",
".",
"reduce_sum",
"(",
"tf",
".",
"square",
"(",
"X",
")",
",",
"1... | https://github.com/clinicalml/cfrnet/blob/9daea5d8ba7cb89f413065c5ce7f0136f0e84c9b/cfr/util.py#L142-L148 | |
maxpumperla/betago | ff06b467e16d7a7a22555d14181b723d853e1a70 | betago/dataloader/goboard.py | python | GoBoard.fold_go_strings | (self, target, source, join_position) | Merge two go strings by joining their common moves | Merge two go strings by joining their common moves | [
"Merge",
"two",
"go",
"strings",
"by",
"joining",
"their",
"common",
"moves"
] | def fold_go_strings(self, target, source, join_position):
''' Merge two go strings by joining their common moves'''
if target == source:
return
for stone_position in source.stones.stones:
self.go_strings[stone_position] = target
target.insert_stone(stone_posit... | [
"def",
"fold_go_strings",
"(",
"self",
",",
"target",
",",
"source",
",",
"join_position",
")",
":",
"if",
"target",
"==",
"source",
":",
"return",
"for",
"stone_position",
"in",
"source",
".",
"stones",
".",
"stones",
":",
"self",
".",
"go_strings",
"[",
... | https://github.com/maxpumperla/betago/blob/ff06b467e16d7a7a22555d14181b723d853e1a70/betago/dataloader/goboard.py#L30-L38 | ||
Pymol-Scripts/Pymol-script-repo | bcd7bb7812dc6db1595953dfa4471fa15fb68c77 | plugins/bnitools.py | python | AboutGui.tag_list | (self, txt_parent) | Tag list for tags to color log output. | Tag list for tags to color log output. | [
"Tag",
"list",
"for",
"tags",
"to",
"color",
"log",
"output",
"."
] | def tag_list(self, txt_parent):
'''Tag list for tags to color log output.
'''
for color, filter in self.txtcolors:
txt_parent.tag_configure(color, foreground=color) | [
"def",
"tag_list",
"(",
"self",
",",
"txt_parent",
")",
":",
"for",
"color",
",",
"filter",
"in",
"self",
".",
"txtcolors",
":",
"txt_parent",
".",
"tag_configure",
"(",
"color",
",",
"foreground",
"=",
"color",
")"
] | https://github.com/Pymol-Scripts/Pymol-script-repo/blob/bcd7bb7812dc6db1595953dfa4471fa15fb68c77/plugins/bnitools.py#L514-L518 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/ext/admin/__init__.py | python | MemcachePageHandler.post | (self) | Handle modifying actions and/or redirect to GET page. | Handle modifying actions and/or redirect to GET page. | [
"Handle",
"modifying",
"actions",
"and",
"/",
"or",
"redirect",
"to",
"GET",
"page",
"."
] | def post(self):
"""Handle modifying actions and/or redirect to GET page."""
next_param = {}
if self.request.get('action:flush'):
if memcache.flush_all():
next_param['message'] = 'Cache flushed, all keys dropped.'
else:
next_param['message'] = 'Flushing the cache failed. Please ... | [
"def",
"post",
"(",
"self",
")",
":",
"next_param",
"=",
"{",
"}",
"if",
"self",
".",
"request",
".",
"get",
"(",
"'action:flush'",
")",
":",
"if",
"memcache",
".",
"flush_all",
"(",
")",
":",
"next_param",
"[",
"'message'",
"]",
"=",
"'Cache flushed, ... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/ext/admin/__init__.py#L1046-L1098 | ||
tp4a/teleport | 1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad | server/www/packages/packages-linux/x64/tornado/locks.py | python | Lock.__init__ | (self) | [] | def __init__(self) -> None:
self._block = BoundedSemaphore(value=1) | [
"def",
"__init__",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_block",
"=",
"BoundedSemaphore",
"(",
"value",
"=",
"1",
")"
] | https://github.com/tp4a/teleport/blob/1fafd34f1f775d2cf80ea4af6e44468d8e0b24ad/server/www/packages/packages-linux/x64/tornado/locks.py#L522-L523 | ||||
maoschanz/drawing | d4a69258570c7a120817484eaadac1145dedb62d | src/optionsbars/classic/optionsbar_classic.py | python | OptionsBarClassic._build_color_buttons | (self, builder) | Initialize the 2 color-buttons and popovers with the 2 previously
memorized RGBA values. | Initialize the 2 color-buttons and popovers with the 2 previously
memorized RGBA values. | [
"Initialize",
"the",
"2",
"color",
"-",
"buttons",
"and",
"popovers",
"with",
"the",
"2",
"previously",
"memorized",
"RGBA",
"values",
"."
] | def _build_color_buttons(self, builder):
"""Initialize the 2 color-buttons and popovers with the 2 previously
memorized RGBA values."""
options_manager = self.window.options_manager
thumbnail_r = builder.get_object('r_btn_image')
self._color_r = OptionsBarClassicColorPopover(self.color_menu_btn_r, \
... | [
"def",
"_build_color_buttons",
"(",
"self",
",",
"builder",
")",
":",
"options_manager",
"=",
"self",
".",
"window",
".",
"options_manager",
"thumbnail_r",
"=",
"builder",
".",
"get_object",
"(",
"'r_btn_image'",
")",
"self",
".",
"_color_r",
"=",
"OptionsBarCla... | https://github.com/maoschanz/drawing/blob/d4a69258570c7a120817484eaadac1145dedb62d/src/optionsbars/classic/optionsbar_classic.py#L110-L121 | ||
deanishe/alfred-workflow | 70d04df5bded8e501ce3bb82fa55ecc1f947f240 | workflow/background.py | python | _pid_file | (name) | return wf().cachefile(name + '.pid') | Return path to PID file for ``name``.
:param name: name of task
:type name: ``unicode``
:returns: Path to PID file for task
:rtype: ``unicode`` filepath | Return path to PID file for ``name``. | [
"Return",
"path",
"to",
"PID",
"file",
"for",
"name",
"."
] | def _pid_file(name):
"""Return path to PID file for ``name``.
:param name: name of task
:type name: ``unicode``
:returns: Path to PID file for task
:rtype: ``unicode`` filepath
"""
return wf().cachefile(name + '.pid') | [
"def",
"_pid_file",
"(",
"name",
")",
":",
"return",
"wf",
"(",
")",
".",
"cachefile",
"(",
"name",
"+",
"'.pid'",
")"
] | https://github.com/deanishe/alfred-workflow/blob/70d04df5bded8e501ce3bb82fa55ecc1f947f240/workflow/background.py#L58-L67 | |
mwouts/jupytext | f8e8352859cc22e17b11154d0770fd946c4a430a | jupytext/config.py | python | validate_jupytext_configuration_file | (config_file, config_dict) | return config | Turn a dict-like config into a JupytextConfiguration object | Turn a dict-like config into a JupytextConfiguration object | [
"Turn",
"a",
"dict",
"-",
"like",
"config",
"into",
"a",
"JupytextConfiguration",
"object"
] | def validate_jupytext_configuration_file(config_file, config_dict):
"""Turn a dict-like config into a JupytextConfiguration object"""
if config_dict is None:
return None
try:
config = JupytextConfiguration(**config_dict)
except TraitError as err:
raise JupytextConfigurationError(... | [
"def",
"validate_jupytext_configuration_file",
"(",
"config_file",
",",
"config_dict",
")",
":",
"if",
"config_dict",
"is",
"None",
":",
"return",
"None",
"try",
":",
"config",
"=",
"JupytextConfiguration",
"(",
"*",
"*",
"config_dict",
")",
"except",
"TraitError"... | https://github.com/mwouts/jupytext/blob/f8e8352859cc22e17b11154d0770fd946c4a430a/jupytext/config.py#L406-L425 | |
tanghaibao/goatools | 647e9dd833695f688cd16c2f9ea18f1692e5c6bc | goatools/associations.py | python | read_associations | (assoc_fn, anno_type='id2gos', namespace='BP', **kws) | return obj.get_id2gos(namespace, **kws) | Return associatinos in id2gos format | Return associatinos in id2gos format | [
"Return",
"associatinos",
"in",
"id2gos",
"format"
] | def read_associations(assoc_fn, anno_type='id2gos', namespace='BP', **kws):
"""Return associatinos in id2gos format"""
# kws get_objanno: taxids hdr_only prt allow_missing_symbol
obj = get_objanno(assoc_fn, anno_type, **kws)
# kws get_id2gos: ev_include ev_exclude keep_ND keep_NOT b_geneid2gos go2geneid... | [
"def",
"read_associations",
"(",
"assoc_fn",
",",
"anno_type",
"=",
"'id2gos'",
",",
"namespace",
"=",
"'BP'",
",",
"*",
"*",
"kws",
")",
":",
"# kws get_objanno: taxids hdr_only prt allow_missing_symbol",
"obj",
"=",
"get_objanno",
"(",
"assoc_fn",
",",
"anno_type"... | https://github.com/tanghaibao/goatools/blob/647e9dd833695f688cd16c2f9ea18f1692e5c6bc/goatools/associations.py#L51-L56 | |
akfamily/akshare | 590e50eece9ec067da3538c7059fd660b71f1339 | akshare/utils/demjson.py | python | buffered_stream.peek | (self, offset=0) | return self.__rawbuf[i] | Returns the character at the current position, or at a
given offset away from the current position. If the position
is beyond the limits of the document size, then an empty
string '' is returned. | Returns the character at the current position, or at a
given offset away from the current position. If the position
is beyond the limits of the document size, then an empty
string '' is returned. | [
"Returns",
"the",
"character",
"at",
"the",
"current",
"position",
"or",
"at",
"a",
"given",
"offset",
"away",
"from",
"the",
"current",
"position",
".",
"If",
"the",
"position",
"is",
"beyond",
"the",
"limits",
"of",
"the",
"document",
"size",
"then",
"an... | def peek(self, offset=0):
"""Returns the character at the current position, or at a
given offset away from the current position. If the position
is beyond the limits of the document size, then an empty
string '' is returned.
"""
i = self.cpos + offset
if i < 0 o... | [
"def",
"peek",
"(",
"self",
",",
"offset",
"=",
"0",
")",
":",
"i",
"=",
"self",
".",
"cpos",
"+",
"offset",
"if",
"i",
"<",
"0",
"or",
"i",
">=",
"self",
".",
"__cmax",
":",
"return",
"''",
"return",
"self",
".",
"__rawbuf",
"[",
"i",
"]"
] | https://github.com/akfamily/akshare/blob/590e50eece9ec067da3538c7059fd660b71f1339/akshare/utils/demjson.py#L1780-L1790 | |
enthought/mayavi | 2103a273568b8f0bd62328801aafbd6252543ae8 | mayavi/components/poly_data_normals.py | python | PolyDataNormals.update_pipeline | (self) | Override this method so that it *updates* the tvtk pipeline
when data upstream is known to have changed.
This method is invoked (automatically) when the input fires a
`pipeline_changed` event. | Override this method so that it *updates* the tvtk pipeline
when data upstream is known to have changed. | [
"Override",
"this",
"method",
"so",
"that",
"it",
"*",
"updates",
"*",
"the",
"tvtk",
"pipeline",
"when",
"data",
"upstream",
"is",
"known",
"to",
"have",
"changed",
"."
] | def update_pipeline(self):
"""Override this method so that it *updates* the tvtk pipeline
when data upstream is known to have changed.
This method is invoked (automatically) when the input fires a
`pipeline_changed` event.
"""
if (len(self.inputs) == 0) or \
(... | [
"def",
"update_pipeline",
"(",
"self",
")",
":",
"if",
"(",
"len",
"(",
"self",
".",
"inputs",
")",
"==",
"0",
")",
"or",
"(",
"len",
"(",
"self",
".",
"inputs",
"[",
"0",
"]",
".",
"outputs",
")",
"==",
"0",
")",
":",
"return",
"f",
"=",
"se... | https://github.com/enthought/mayavi/blob/2103a273568b8f0bd62328801aafbd6252543ae8/mayavi/components/poly_data_normals.py#L55-L69 | ||
IronLanguages/ironpython2 | 51fdedeeda15727717fb8268a805f71b06c0b9f1 | Src/StdLib/Lib/collections.py | python | OrderedDict.setdefault | (self, key, default=None) | return default | od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od | od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od | [
"od",
".",
"setdefault",
"(",
"k",
"[",
"d",
"]",
")",
"-",
">",
"od",
".",
"get",
"(",
"k",
"d",
")",
"also",
"set",
"od",
"[",
"k",
"]",
"=",
"d",
"if",
"k",
"not",
"in",
"od"
] | def setdefault(self, key, default=None):
'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
if key in self:
return self[key]
self[key] = default
return default | [
"def",
"setdefault",
"(",
"self",
",",
"key",
",",
"default",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
"[",
"key",
"]",
"self",
"[",
"key",
"]",
"=",
"default",
"return",
"default"
] | https://github.com/IronLanguages/ironpython2/blob/51fdedeeda15727717fb8268a805f71b06c0b9f1/Src/StdLib/Lib/collections.py#L163-L168 | |
HKUST-Aerial-Robotics/Stereo-RCNN | 63c6ab98b7a5e36c7bcfdec4529804fc940ee900 | lib/setup.py | python | customize_compiler_for_nvcc | (self) | inject deep into distutils to customize how the dispatch
to gcc/nvcc works.
If you subclass UnixCCompiler, it's not trivial to get your subclass
injected in, and still have the right customizations (i.e.
distutils.sysconfig.customize_compiler) run on it. So instead of going
the OO route, I have thi... | inject deep into distutils to customize how the dispatch
to gcc/nvcc works. | [
"inject",
"deep",
"into",
"distutils",
"to",
"customize",
"how",
"the",
"dispatch",
"to",
"gcc",
"/",
"nvcc",
"works",
"."
] | def customize_compiler_for_nvcc(self):
"""inject deep into distutils to customize how the dispatch
to gcc/nvcc works.
If you subclass UnixCCompiler, it's not trivial to get your subclass
injected in, and still have the right customizations (i.e.
distutils.sysconfig.customize_compiler) run on it. So... | [
"def",
"customize_compiler_for_nvcc",
"(",
"self",
")",
":",
"# tell the compiler it can processes .cu",
"self",
".",
"src_extensions",
".",
"append",
"(",
"'.cu'",
")",
"# save references to the default compiler_so and _comple methods",
"default_compiler_so",
"=",
"self",
".",... | https://github.com/HKUST-Aerial-Robotics/Stereo-RCNN/blob/63c6ab98b7a5e36c7bcfdec4529804fc940ee900/lib/setup.py#L69-L105 | ||
samuelclay/NewsBlur | 2c45209df01a1566ea105e04d499367f32ac9ad2 | apps/social/models.py | python | MSharedStory.set_source_user_id | (self, source_user_id) | [] | def set_source_user_id(self, source_user_id):
if source_user_id == self.user_id:
return
def find_source(source_user_id, seen_user_ids):
parent_shared_story = MSharedStory.objects.filter(user_id=source_user_id,
... | [
"def",
"set_source_user_id",
"(",
"self",
",",
"source_user_id",
")",
":",
"if",
"source_user_id",
"==",
"self",
".",
"user_id",
":",
"return",
"def",
"find_source",
"(",
"source_user_id",
",",
"seen_user_ids",
")",
":",
"parent_shared_story",
"=",
"MSharedStory",... | https://github.com/samuelclay/NewsBlur/blob/2c45209df01a1566ea105e04d499367f32ac9ad2/apps/social/models.py#L1713-L1745 | ||||
davidpany/WMI_Forensics | 0ab08dca7938d26846497be9e450b7bb2ca7fff3 | CCM_RUA_Finder.py | python | sanitize_string | (input_string) | return (input_string.replace("\\\\\\\\x0020", " ")
.replace("\\\\\\\\\\\\\\\\", "\\").replace("\\\\x0020", " ")
.replace("\\\\\\\\", "\\").replace("®", "(R)")
.replace("\\x0020", " ")) | Remove non-friendly characters from output strings | Remove non-friendly characters from output strings | [
"Remove",
"non",
"-",
"friendly",
"characters",
"from",
"output",
"strings"
] | def sanitize_string(input_string):
"""Remove non-friendly characters from output strings"""
return (input_string.replace("\\\\\\\\x0020", " ")
.replace("\\\\\\\\\\\\\\\\", "\\").replace("\\\\x0020", " ")
.replace("\\\\\\\\", "\\").replace("®", "(R)")
.replace("\\x0020",... | [
"def",
"sanitize_string",
"(",
"input_string",
")",
":",
"return",
"(",
"input_string",
".",
"replace",
"(",
"\"\\\\\\\\\\\\\\\\x0020\"",
",",
"\" \"",
")",
".",
"replace",
"(",
"\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"",
",",
"\"\\\\\"",
")",
".",
"replace",
"(",
"\"... | https://github.com/davidpany/WMI_Forensics/blob/0ab08dca7938d26846497be9e450b7bb2ca7fff3/CCM_RUA_Finder.py#L540-L546 | |
Tribler/tribler | f1de8bd54f293b01b2646a1dead1c1dc9dfdb356 | src/tribler-core/tribler_core/components/libtorrent/download_manager/download_state.py | python | DownloadState.get_availability | (self) | return nr_seeders_complete | Return overall the availability of all pieces, using connected peers
Availability is defined as the number of complete copies of a piece, thus seeders
increment the availability by 1. Leechers provide a subset of piece thus we count the
overall availability of all pieces provided by the connecte... | Return overall the availability of all pieces, using connected peers
Availability is defined as the number of complete copies of a piece, thus seeders
increment the availability by 1. Leechers provide a subset of piece thus we count the
overall availability of all pieces provided by the connecte... | [
"Return",
"overall",
"the",
"availability",
"of",
"all",
"pieces",
"using",
"connected",
"peers",
"Availability",
"is",
"defined",
"as",
"the",
"number",
"of",
"complete",
"copies",
"of",
"a",
"piece",
"thus",
"seeders",
"increment",
"the",
"availability",
"by",... | def get_availability(self):
""" Return overall the availability of all pieces, using connected peers
Availability is defined as the number of complete copies of a piece, thus seeders
increment the availability by 1. Leechers provide a subset of piece thus we count the
overall availabilit... | [
"def",
"get_availability",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"lt_status",
":",
"return",
"0",
"# We do not have any info for this download so we cannot accurately get its availability",
"nr_seeders_complete",
"=",
"0",
"merged_bitfields",
"=",
"[",
"0",
"]"... | https://github.com/Tribler/tribler/blob/f1de8bd54f293b01b2646a1dead1c1dc9dfdb356/src/tribler-core/tribler_core/components/libtorrent/download_manager/download_state.py#L182-L216 | |
w3h/isf | 6faf0a3df185465ec17369c90ccc16e2a03a1870 | lib/thirdparty/pyreadline/modes/notemacs.py | python | NotEmacsMode.set_mark | (self, e) | Set the mark to the point. If a numeric argument is supplied, the
mark is set to that position. | Set the mark to the point. If a numeric argument is supplied, the
mark is set to that position. | [
"Set",
"the",
"mark",
"to",
"the",
"point",
".",
"If",
"a",
"numeric",
"argument",
"is",
"supplied",
"the",
"mark",
"is",
"set",
"to",
"that",
"position",
"."
] | def set_mark(self, e): # (C-@)
'''Set the mark to the point. If a numeric argument is supplied, the
mark is set to that position.'''
self.l_buffer.set_mark() | [
"def",
"set_mark",
"(",
"self",
",",
"e",
")",
":",
"# (C-@)",
"self",
".",
"l_buffer",
".",
"set_mark",
"(",
")"
] | https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/pyreadline/modes/notemacs.py#L512-L515 | ||
bdcht/amoco | dac8e00b862eb6d87cc88dddd1e5316c67c1d798 | amoco/logger.py | python | reset_log_file | (filename, level=logging.DEBUG) | set DEBUG log file for all loggers.
Args:
filename (str): filename for the FileHandler added
to all amoco loggers | set DEBUG log file for all loggers. | [
"set",
"DEBUG",
"log",
"file",
"for",
"all",
"loggers",
"."
] | def reset_log_file(filename, level=logging.DEBUG):
"""set DEBUG log file for all loggers.
Args:
filename (str): filename for the FileHandler added
to all amoco loggers
"""
global logfile
if logfile is not None:
logfile.close()
unset_log_file()
se... | [
"def",
"reset_log_file",
"(",
"filename",
",",
"level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"global",
"logfile",
"if",
"logfile",
"is",
"not",
"None",
":",
"logfile",
".",
"close",
"(",
")",
"unset_log_file",
"(",
")",
"set_file_logging",
"(",
"filenam... | https://github.com/bdcht/amoco/blob/dac8e00b862eb6d87cc88dddd1e5316c67c1d798/amoco/logger.py#L160-L173 | ||
gnemoug/sina_reptile | c3273681c1ba79273dd9197122b73135e10584a2 | SDK1/weibopy/api.py | python | API.add_list_member | (self, slug, *args, **kargs) | return bind_api(
path = '/%s/%s/members.json' % (self.auth.get_username(), slug),
method = 'POST',
payload_type = 'list',
allowed_param = ['id'],
require_auth = True
)(self, *args, **kargs) | [] | def add_list_member(self, slug, *args, **kargs):
return bind_api(
path = '/%s/%s/members.json' % (self.auth.get_username(), slug),
method = 'POST',
payload_type = 'list',
allowed_param = ['id'],
require_auth = True
)(self, *args, **kargs) | [
"def",
"add_list_member",
"(",
"self",
",",
"slug",
",",
"*",
"args",
",",
"*",
"*",
"kargs",
")",
":",
"return",
"bind_api",
"(",
"path",
"=",
"'/%s/%s/members.json'",
"%",
"(",
"self",
".",
"auth",
".",
"get_username",
"(",
")",
",",
"slug",
")",
"... | https://github.com/gnemoug/sina_reptile/blob/c3273681c1ba79273dd9197122b73135e10584a2/SDK1/weibopy/api.py#L641-L648 | |||
google-research/language | 61fa7260ac7d690d11ef72ca863e45a37c0bdc80 | language/search_agents/muzero/state_tree.py | python | NQStateTree.to_adjustments | (self) | return adjustments | Group the yield into `QueryAdjustments`. | Group the yield into `QueryAdjustments`. | [
"Group",
"the",
"yield",
"into",
"QueryAdjustments",
"."
] | def to_adjustments(self) -> List[QueryAdjustment]:
"""Group the yield into `QueryAdjustments`."""
leaves = self.root.leaves()
adjustments = []
while leaves:
leaf = leaves.pop(0)
if leaf not in [operator.value for operator in Operator] or not leaves:
continue
if leaves[0] in ['... | [
"def",
"to_adjustments",
"(",
"self",
")",
"->",
"List",
"[",
"QueryAdjustment",
"]",
":",
"leaves",
"=",
"self",
".",
"root",
".",
"leaves",
"(",
")",
"adjustments",
"=",
"[",
"]",
"while",
"leaves",
":",
"leaf",
"=",
"leaves",
".",
"pop",
"(",
"0",... | https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/search_agents/muzero/state_tree.py#L314-L333 | |
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/vpc/v20170312/models.py | python | ModifyAddressAttributeResponse.__init__ | (self) | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str | [
"r",
":",
"param",
"RequestId",
":",
"唯一请求",
"ID,每次请求都会返回。定位问题时需要提供该次请求的",
"RequestId。",
":",
"type",
"RequestId",
":",
"str"
] | def __init__(self):
r"""
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.RequestId = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"RequestId",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/vpc/v20170312/models.py#L13817-L13822 | ||
mgear-dev/mgear | 06ddc26c5adb5eab07ca470c7fafa77404c8a1de | scripts/mgear/maya/shifter/component/guide.py | python | ComponentGuide.symmetrize | (self) | return True | Inverse the transform of each element of the guide. | Inverse the transform of each element of the guide. | [
"Inverse",
"the",
"transform",
"of",
"each",
"element",
"of",
"the",
"guide",
"."
] | def symmetrize(self):
"""Inverse the transform of each element of the guide."""
if self.values["comp_side"] not in ["R", "L"]:
mgear.log("Can't symmetrize central component", mgear.sev_error)
return False
for name, paramDef in self.paramDefs.items():
if param... | [
"def",
"symmetrize",
"(",
"self",
")",
":",
"if",
"self",
".",
"values",
"[",
"\"comp_side\"",
"]",
"not",
"in",
"[",
"\"R\"",
",",
"\"L\"",
"]",
":",
"mgear",
".",
"log",
"(",
"\"Can't symmetrize central component\"",
",",
"mgear",
".",
"sev_error",
")",
... | https://github.com/mgear-dev/mgear/blob/06ddc26c5adb5eab07ca470c7fafa77404c8a1de/scripts/mgear/maya/shifter/component/guide.py#L392-L408 | |
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | examples/graph_saint.py | python | Net.set_aggr | (self, aggr) | [] | def set_aggr(self, aggr):
self.conv1.aggr = aggr
self.conv2.aggr = aggr
self.conv3.aggr = aggr | [
"def",
"set_aggr",
"(",
"self",
",",
"aggr",
")",
":",
"self",
".",
"conv1",
".",
"aggr",
"=",
"aggr",
"self",
".",
"conv2",
".",
"aggr",
"=",
"aggr",
"self",
".",
"conv3",
".",
"aggr",
"=",
"aggr"
] | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/examples/graph_saint.py#L37-L40 | ||||
kuri65536/python-for-android | 26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891 | python-modules/twisted/twisted/internet/base.py | python | BaseConnector.disconnect | (self) | Disconnect whatever our state is. | Disconnect whatever our state is. | [
"Disconnect",
"whatever",
"our",
"state",
"is",
"."
] | def disconnect(self):
"""Disconnect whatever our state is."""
if self.state == 'connecting':
self.stopConnecting()
elif self.state == 'connected':
self.transport.loseConnection() | [
"def",
"disconnect",
"(",
"self",
")",
":",
"if",
"self",
".",
"state",
"==",
"'connecting'",
":",
"self",
".",
"stopConnecting",
"(",
")",
"elif",
"self",
".",
"state",
"==",
"'connected'",
":",
"self",
".",
"transport",
".",
"loseConnection",
"(",
")"
... | https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-modules/twisted/twisted/internet/base.py#L997-L1002 | ||
lutris/lutris | 66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a | lutris/util/display.py | python | DBusScreenSaverInhibitor.inhibit | (self, game_name) | Inhibit the screen saver.
Returns a cookie that must be passed to the corresponding uninhibit() call.
If an error occurs, None is returned instead. | Inhibit the screen saver.
Returns a cookie that must be passed to the corresponding uninhibit() call.
If an error occurs, None is returned instead. | [
"Inhibit",
"the",
"screen",
"saver",
".",
"Returns",
"a",
"cookie",
"that",
"must",
"be",
"passed",
"to",
"the",
"corresponding",
"uninhibit",
"()",
"call",
".",
"If",
"an",
"error",
"occurs",
"None",
"is",
"returned",
"instead",
"."
] | def inhibit(self, game_name):
"""Inhibit the screen saver.
Returns a cookie that must be passed to the corresponding uninhibit() call.
If an error occurs, None is returned instead."""
try:
return self.proxy.Inhibit("(ss)", "Lutris", "Running game: %s" % game_name)
exc... | [
"def",
"inhibit",
"(",
"self",
",",
"game_name",
")",
":",
"try",
":",
"return",
"self",
".",
"proxy",
".",
"Inhibit",
"(",
"\"(ss)\"",
",",
"\"Lutris\"",
",",
"\"Running game: %s\"",
"%",
"game_name",
")",
"except",
"Exception",
":",
"return",
"None"
] | https://github.com/lutris/lutris/blob/66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a/lutris/util/display.py#L284-L291 | ||
bitcraze/crazyflie-lib-python | 876f0dc003b91ba5e4de05daae9d0b79cf600f81 | cflib/drivers/cfusb.py | python | _get_vendor_setup | (handle, request, value, index, length) | [] | def _get_vendor_setup(handle, request, value, index, length):
if pyusb1:
return handle.ctrl_transfer(usb.TYPE_VENDOR | 0x80, request,
wValue=value, wIndex=index, timeout=1000,
data_or_wLength=length)
else:
return handle.cont... | [
"def",
"_get_vendor_setup",
"(",
"handle",
",",
"request",
",",
"value",
",",
"index",
",",
"length",
")",
":",
"if",
"pyusb1",
":",
"return",
"handle",
".",
"ctrl_transfer",
"(",
"usb",
".",
"TYPE_VENDOR",
"|",
"0x80",
",",
"request",
",",
"wValue",
"="... | https://github.com/bitcraze/crazyflie-lib-python/blob/876f0dc003b91ba5e4de05daae9d0b79cf600f81/cflib/drivers/cfusb.py#L190-L197 | ||||
attardi/deepnl | e1ad450f2768a084f44b128de313f19c2f15100f | bin/knn.py | python | l2_nearest | (embeddings, e, k) | return sorted_distances[1:k] | Sort vectors according to their Euclidean distance from e
and return the k closest.
Returns list of (index, distance^2) | Sort vectors according to their Euclidean distance from e
and return the k closest.
Returns list of (index, distance^2) | [
"Sort",
"vectors",
"according",
"to",
"their",
"Euclidean",
"distance",
"from",
"e",
"and",
"return",
"the",
"k",
"closest",
".",
"Returns",
"list",
"of",
"(",
"index",
"distance^2",
")"
] | def l2_nearest(embeddings, e, k):
"""Sort vectors according to their Euclidean distance from e
and return the k closest.
Returns list of (index, distance^2)
"""
distances = ((embeddings - e) ** 2).sum(axis=1) # ** 0.5
sorted_distances = sorted(enumerate(distances), key=itemgetter(1))
return sorted_distan... | [
"def",
"l2_nearest",
"(",
"embeddings",
",",
"e",
",",
"k",
")",
":",
"distances",
"=",
"(",
"(",
"embeddings",
"-",
"e",
")",
"**",
"2",
")",
".",
"sum",
"(",
"axis",
"=",
"1",
")",
"# ** 0.5",
"sorted_distances",
"=",
"sorted",
"(",
"enumerate",
... | https://github.com/attardi/deepnl/blob/e1ad450f2768a084f44b128de313f19c2f15100f/bin/knn.py#L67-L75 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/xmlrpclib.py | python | Transport.send_request | (self, connection, handler, request_body) | [] | def send_request(self, connection, handler, request_body):
if (self.accept_gzip_encoding and gzip):
connection.putrequest("POST", handler, skip_accept_encoding=True)
connection.putheader("Accept-Encoding", "gzip")
else:
connection.putrequest("POST", handler) | [
"def",
"send_request",
"(",
"self",
",",
"connection",
",",
"handler",
",",
"request_body",
")",
":",
"if",
"(",
"self",
".",
"accept_gzip_encoding",
"and",
"gzip",
")",
":",
"connection",
".",
"putrequest",
"(",
"\"POST\"",
",",
"handler",
",",
"skip_accept... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/xmlrpclib.py#L1398-L1403 | ||||
aestrivex/bctpy | 32c7fe7345b281c2d4e184f5379c425c36f3bbc7 | docs/sphinxext/numpy_ext/docscrape.py | python | dedent_lines | (lines) | return textwrap.dedent("\n".join(lines)).split("\n") | Deindent a list of lines maximally | Deindent a list of lines maximally | [
"Deindent",
"a",
"list",
"of",
"lines",
"maximally"
] | def dedent_lines(lines):
"""Deindent a list of lines maximally"""
return textwrap.dedent("\n".join(lines)).split("\n") | [
"def",
"dedent_lines",
"(",
"lines",
")",
":",
"return",
"textwrap",
".",
"dedent",
"(",
"\"\\n\"",
".",
"join",
"(",
"lines",
")",
")",
".",
"split",
"(",
"\"\\n\"",
")"
] | https://github.com/aestrivex/bctpy/blob/32c7fe7345b281c2d4e184f5379c425c36f3bbc7/docs/sphinxext/numpy_ext/docscrape.py#L414-L416 | |
makerbot/ReplicatorG | d6f2b07785a5a5f1e172fb87cb4303b17c575d5d | skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/cool.py | python | CoolSkein.addCoolOrbits | (self, remainingOrbitTime) | Add the minimum radius cool orbits. | Add the minimum radius cool orbits. | [
"Add",
"the",
"minimum",
"radius",
"cool",
"orbits",
"."
] | def addCoolOrbits(self, remainingOrbitTime):
'Add the minimum radius cool orbits.'
if len(self.boundaryLayer.loops) < 1:
return
insetBoundaryLoops = self.boundaryLayer.loops
if abs(self.repository.orbitalOutset.value) > 0.1 * abs(self.perimeterWidth):
insetBoundaryLoops = intercircle.getInsetLoopsFromLoop... | [
"def",
"addCoolOrbits",
"(",
"self",
",",
"remainingOrbitTime",
")",
":",
"if",
"len",
"(",
"self",
".",
"boundaryLayer",
".",
"loops",
")",
"<",
"1",
":",
"return",
"insetBoundaryLoops",
"=",
"self",
".",
"boundaryLayer",
".",
"loops",
"if",
"abs",
"(",
... | https://github.com/makerbot/ReplicatorG/blob/d6f2b07785a5a5f1e172fb87cb4303b17c575d5d/skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/cool.py#L192-L217 | ||
lutris/lutris | 66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a | lutris/util/strings.py | python | split_arguments | (args) | return _split_arguments(args) | Wrapper around shlex.split that is more tolerant of errors | Wrapper around shlex.split that is more tolerant of errors | [
"Wrapper",
"around",
"shlex",
".",
"split",
"that",
"is",
"more",
"tolerant",
"of",
"errors"
] | def split_arguments(args):
"""Wrapper around shlex.split that is more tolerant of errors"""
if not args:
# shlex.split seems to hangs when passed the None value
return []
return _split_arguments(args) | [
"def",
"split_arguments",
"(",
"args",
")",
":",
"if",
"not",
"args",
":",
"# shlex.split seems to hangs when passed the None value",
"return",
"[",
"]",
"return",
"_split_arguments",
"(",
"args",
")"
] | https://github.com/lutris/lutris/blob/66675a4d5537f6b2a2ba2b6df0b3cdf8924c823a/lutris/util/strings.py#L162-L167 | |
tensorflow/lingvo | ce10019243d954c3c3ebe739f7589b5eebfdf907 | lingvo/core/conv_layers_with_time_padding.py | python | _ComputeConvOutputPaddingV2 | (paddings,
window,
stride,
padding_algorithm='SAME') | return out_paddings | Computes paddings for convolution and pooling output.
- If padding_algorithm='SAME': out_padding[i] == 0 if the in_padding
corresponding to that output is 0. This prevents the output from shrinking
unnecessarily when striding.
- If padding algorithm='VALID': out_padding[i] == 1 iff any in_padding
corre... | Computes paddings for convolution and pooling output. | [
"Computes",
"paddings",
"for",
"convolution",
"and",
"pooling",
"output",
"."
] | def _ComputeConvOutputPaddingV2(paddings,
window,
stride,
padding_algorithm='SAME'):
"""Computes paddings for convolution and pooling output.
- If padding_algorithm='SAME': out_padding[i] == 0 if the in_padding
corr... | [
"def",
"_ComputeConvOutputPaddingV2",
"(",
"paddings",
",",
"window",
",",
"stride",
",",
"padding_algorithm",
"=",
"'SAME'",
")",
":",
"if",
"stride",
"==",
"1",
"and",
"padding_algorithm",
"==",
"'SAME'",
":",
"return",
"paddings",
"paddings",
",",
"slice_len"... | https://github.com/tensorflow/lingvo/blob/ce10019243d954c3c3ebe739f7589b5eebfdf907/lingvo/core/conv_layers_with_time_padding.py#L142-L190 | |
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | paddlex/ppdet/engine/callbacks.py | python | WiferFaceEval.on_epoch_begin | (self, status) | [] | def on_epoch_begin(self, status):
assert self.model.mode == 'eval', \
"WiferFaceEval can only be set during evaluation"
for metric in self.model._metrics:
metric.update(self.model.model)
sys.exit() | [
"def",
"on_epoch_begin",
"(",
"self",
",",
"status",
")",
":",
"assert",
"self",
".",
"model",
".",
"mode",
"==",
"'eval'",
",",
"\"WiferFaceEval can only be set during evaluation\"",
"for",
"metric",
"in",
"self",
".",
"model",
".",
"_metrics",
":",
"metric",
... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppdet/engine/callbacks.py#L218-L223 | ||||
lykoss/lykos | 7859cb530b66e782b3cc32f0d7d60d1c55d4fef5 | src/hooks.py | python | end_banlist | (cli, server, bot_nick, chan, message) | Handle the end of the ban list.
Ordering and meaning of arguments for the end of ban list:
0 - The IRCClient instance (like everywhere else)
1 - The server the requester (i.e. the bot) is on
2 - The nickname of the requester (i.e. the bot)
3 - The channel holding the ban list
4 - A string cont... | Handle the end of the ban list. | [
"Handle",
"the",
"end",
"of",
"the",
"ban",
"list",
"."
] | def end_banlist(cli, server, bot_nick, chan, message):
"""Handle the end of the ban list.
Ordering and meaning of arguments for the end of ban list:
0 - The IRCClient instance (like everywhere else)
1 - The server the requester (i.e. the bot) is on
2 - The nickname of the requester (i.e. the bot)
... | [
"def",
"end_banlist",
"(",
"cli",
",",
"server",
",",
"bot_nick",
",",
"chan",
",",
"message",
")",
":",
"handle_endlistmode",
"(",
"cli",
",",
"chan",
",",
"\"b\"",
")"
] | https://github.com/lykoss/lykos/blob/7859cb530b66e782b3cc32f0d7d60d1c55d4fef5/src/hooks.py#L551-L564 | ||
python-trio/trio | 4edfd41bd5519a2e626e87f6c6ca9fb32b90a6f4 | trio/_core/_ki.py | python | currently_ki_protected | () | return ki_protection_enabled(sys._getframe()) | r"""Check whether the calling code has :exc:`KeyboardInterrupt` protection
enabled.
It's surprisingly easy to think that one's :exc:`KeyboardInterrupt`
protection is enabled when it isn't, or vice-versa. This function tells
you what Trio thinks of the matter, which makes it useful for ``assert``\s
... | r"""Check whether the calling code has :exc:`KeyboardInterrupt` protection
enabled. | [
"r",
"Check",
"whether",
"the",
"calling",
"code",
"has",
":",
"exc",
":",
"KeyboardInterrupt",
"protection",
"enabled",
"."
] | def currently_ki_protected():
r"""Check whether the calling code has :exc:`KeyboardInterrupt` protection
enabled.
It's surprisingly easy to think that one's :exc:`KeyboardInterrupt`
protection is enabled when it isn't, or vice-versa. This function tells
you what Trio thinks of the matter, which mak... | [
"def",
"currently_ki_protected",
"(",
")",
":",
"return",
"ki_protection_enabled",
"(",
"sys",
".",
"_getframe",
"(",
")",
")"
] | https://github.com/python-trio/trio/blob/4edfd41bd5519a2e626e87f6c6ca9fb32b90a6f4/trio/_core/_ki.py#L96-L109 | |
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/states/win_servermanager.py | python | installed | (
name,
features=None,
recurse=False,
restart=False,
source=None,
exclude=None,
**kwargs
) | return ret | Install the windows feature. To install a single feature, use the ``name``
parameter. To install multiple features, use the ``features`` parameter.
.. note::
Some features require reboot after un/installation. If so, until the
server is restarted other features can not be installed!
Args:
... | Install the windows feature. To install a single feature, use the ``name``
parameter. To install multiple features, use the ``features`` parameter. | [
"Install",
"the",
"windows",
"feature",
".",
"To",
"install",
"a",
"single",
"feature",
"use",
"the",
"name",
"parameter",
".",
"To",
"install",
"multiple",
"features",
"use",
"the",
"features",
"parameter",
"."
] | def installed(
name,
features=None,
recurse=False,
restart=False,
source=None,
exclude=None,
**kwargs
):
"""
Install the windows feature. To install a single feature, use the ``name``
parameter. To install multiple features, use the ``features`` parameter.
.. note::
... | [
"def",
"installed",
"(",
"name",
",",
"features",
"=",
"None",
",",
"recurse",
"=",
"False",
",",
"restart",
"=",
"False",
",",
"source",
"=",
"None",
",",
"exclude",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"\"force\"",
"in",
"kwargs",
... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/states/win_servermanager.py#L24-L192 | |
CvvT/dumpDex | 92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1 | python/idaapi.py | python | set_jumptable_info | (*args) | return _idaapi.set_jumptable_info(*args) | set_jumptable_info(ea, oi) | set_jumptable_info(ea, oi) | [
"set_jumptable_info",
"(",
"ea",
"oi",
")"
] | def set_jumptable_info(*args):
"""
set_jumptable_info(ea, oi)
"""
return _idaapi.set_jumptable_info(*args) | [
"def",
"set_jumptable_info",
"(",
"*",
"args",
")",
":",
"return",
"_idaapi",
".",
"set_jumptable_info",
"(",
"*",
"args",
")"
] | https://github.com/CvvT/dumpDex/blob/92ab3b7e996194a06bf1dd5538a4954e8a5ee9c1/python/idaapi.py#L6838-L6842 | |
ucbdrive/few-shot-object-detection | 148a039af7abce9eff59d5cdece296ad1d2b8aa0 | fsdet/evaluation/coco_evaluation.py | python | COCOEvaluator.__init__ | (self, dataset_name, cfg, distributed, output_dir=None) | Args:
dataset_name (str): name of the dataset to be evaluated.
It must have either the following corresponding metadata:
"json_file": the path to the COCO format annotation
Or it must be in detectron2's standard dataset format
so it can... | Args:
dataset_name (str): name of the dataset to be evaluated.
It must have either the following corresponding metadata:
"json_file": the path to the COCO format annotation
Or it must be in detectron2's standard dataset format
so it can... | [
"Args",
":",
"dataset_name",
"(",
"str",
")",
":",
"name",
"of",
"the",
"dataset",
"to",
"be",
"evaluated",
".",
"It",
"must",
"have",
"either",
"the",
"following",
"corresponding",
"metadata",
":",
"json_file",
":",
"the",
"path",
"to",
"the",
"COCO",
"... | def __init__(self, dataset_name, cfg, distributed, output_dir=None):
"""
Args:
dataset_name (str): name of the dataset to be evaluated.
It must have either the following corresponding metadata:
"json_file": the path to the COCO format annotation
... | [
"def",
"__init__",
"(",
"self",
",",
"dataset_name",
",",
"cfg",
",",
"distributed",
",",
"output_dir",
"=",
"None",
")",
":",
"self",
".",
"_distributed",
"=",
"distributed",
"self",
".",
"_output_dir",
"=",
"output_dir",
"self",
".",
"_dataset_name",
"=",
... | https://github.com/ucbdrive/few-shot-object-detection/blob/148a039af7abce9eff59d5cdece296ad1d2b8aa0/fsdet/evaluation/coco_evaluation.py#L29-L78 | ||
chin-gyou/dialogue-utterance-rewriter | 5433e43af1b14d7d3a8d2142f26e46db4322c061 | batcher.py | python | Batcher.__init__ | (self, data_path, vocab, hps, single_pass) | Initialize the batcher. Start threads that process the data into batches.
Args:
data_path: tf.Example filepattern.
vocab: Vocabulary object
hps: hyperparameters
single_pass: If True, run through the dataset exactly once
(useful for when you want to ... | Initialize the batcher. Start threads that process the data into batches.
Args:
data_path: tf.Example filepattern.
vocab: Vocabulary object
hps: hyperparameters
single_pass: If True, run through the dataset exactly once
(useful for when you want to ... | [
"Initialize",
"the",
"batcher",
".",
"Start",
"threads",
"that",
"process",
"the",
"data",
"into",
"batches",
".",
"Args",
":",
"data_path",
":",
"tf",
".",
"Example",
"filepattern",
".",
"vocab",
":",
"Vocabulary",
"object",
"hps",
":",
"hyperparameters",
"... | def __init__(self, data_path, vocab, hps, single_pass):
"""Initialize the batcher. Start threads that process the data into batches.
Args:
data_path: tf.Example filepattern.
vocab: Vocabulary object
hps: hyperparameters
single_pass: If True, run through the datase... | [
"def",
"__init__",
"(",
"self",
",",
"data_path",
",",
"vocab",
",",
"hps",
",",
"single_pass",
")",
":",
"self",
".",
"_data_path",
"=",
"data_path",
"self",
".",
"_vocab",
"=",
"vocab",
"self",
".",
"_hps",
"=",
"hps",
"self",
".",
"_single_pass",
"=... | https://github.com/chin-gyou/dialogue-utterance-rewriter/blob/5433e43af1b14d7d3a8d2142f26e46db4322c061/batcher.py#L241-L290 | ||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | struct.py | python | Struct.__init__ | (self, format) | Create a new Struct object.
:type format: bytes | unicode | Create a new Struct object. | [
"Create",
"a",
"new",
"Struct",
"object",
"."
] | def __init__(self, format):
"""Create a new Struct object.
:type format: bytes | unicode
"""
self.format = format
self.size = 0 | [
"def",
"__init__",
"(",
"self",
",",
"format",
")",
":",
"self",
".",
"format",
"=",
"format",
"self",
".",
"size",
"=",
"0"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/struct.py#L69-L75 | ||
yuanxiaosc/DeepNude-an-Image-to-Image-technology | 87d684ef59d2de4e8b38f66a71cdd392b203ab95 | Pix2Pix/conditional_adversarial_model.py | python | downsample | (filters, size, apply_batchnorm=True) | return result | [] | def downsample(filters, size, apply_batchnorm=True):
initializer = tf.random_normal_initializer(0., 0.02)
result = tf.keras.Sequential()
result.add(
tf.keras.layers.Conv2D(filters, size, strides=2, padding='same',
kernel_initializer=initializer, use_bias=False))
... | [
"def",
"downsample",
"(",
"filters",
",",
"size",
",",
"apply_batchnorm",
"=",
"True",
")",
":",
"initializer",
"=",
"tf",
".",
"random_normal_initializer",
"(",
"0.",
",",
"0.02",
")",
"result",
"=",
"tf",
".",
"keras",
".",
"Sequential",
"(",
")",
"res... | https://github.com/yuanxiaosc/DeepNude-an-Image-to-Image-technology/blob/87d684ef59d2de4e8b38f66a71cdd392b203ab95/Pix2Pix/conditional_adversarial_model.py#L7-L20 | |||
mitogen-hq/mitogen | 5b505f524a7ae170fe68613841ab92b299613d3f | mitogen/core.py | python | Latch._on_fork | (cls) | Clean up any files belonging to the parent process after a fork. | Clean up any files belonging to the parent process after a fork. | [
"Clean",
"up",
"any",
"files",
"belonging",
"to",
"the",
"parent",
"process",
"after",
"a",
"fork",
"."
] | def _on_fork(cls):
"""
Clean up any files belonging to the parent process after a fork.
"""
cls._cls_idle_socketpairs = []
while cls._cls_all_sockets:
cls._cls_all_sockets.pop().close() | [
"def",
"_on_fork",
"(",
"cls",
")",
":",
"cls",
".",
"_cls_idle_socketpairs",
"=",
"[",
"]",
"while",
"cls",
".",
"_cls_all_sockets",
":",
"cls",
".",
"_cls_all_sockets",
".",
"pop",
"(",
")",
".",
"close",
"(",
")"
] | https://github.com/mitogen-hq/mitogen/blob/5b505f524a7ae170fe68613841ab92b299613d3f/mitogen/core.py#L2525-L2531 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/urllib/request.py | python | URLopener._open_generic_http | (self, connection_factory, url, data) | Make an HTTP connection using connection_class.
This is an internal method that should be called from
open_http() or open_https().
Arguments:
- connection_factory should take a host name and return an
HTTPConnection instance.
- url is the url to retrieval or a host, r... | Make an HTTP connection using connection_class. | [
"Make",
"an",
"HTTP",
"connection",
"using",
"connection_class",
"."
] | def _open_generic_http(self, connection_factory, url, data):
"""Make an HTTP connection using connection_class.
This is an internal method that should be called from
open_http() or open_https().
Arguments:
- connection_factory should take a host name and return an
HTT... | [
"def",
"_open_generic_http",
"(",
"self",
",",
"connection_factory",
",",
"url",
",",
"data",
")",
":",
"user_passwd",
"=",
"None",
"proxy_passwd",
"=",
"None",
"if",
"isinstance",
"(",
"url",
",",
"str",
")",
":",
"host",
",",
"selector",
"=",
"splithost"... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/urllib/request.py#L1620-L1711 | ||
willhardy/django-seo | 3089686a3c490091315860979ad15ef2527c3e3e | rollyourown/seo/systemviews.py | python | SystemViews.populate | (self) | Populate this list with all views that take no arguments. | Populate this list with all views that take no arguments. | [
"Populate",
"this",
"list",
"with",
"all",
"views",
"that",
"take",
"no",
"arguments",
"."
] | def populate(self):
""" Populate this list with all views that take no arguments.
"""
from django.conf import settings
from django.core import urlresolvers
self.append(("", ""))
urlconf = settings.ROOT_URLCONF
resolver = urlresolvers.RegexURLResolver(r'^/', urlco... | [
"def",
"populate",
"(",
"self",
")",
":",
"from",
"django",
".",
"conf",
"import",
"settings",
"from",
"django",
".",
"core",
"import",
"urlresolvers",
"self",
".",
"append",
"(",
"(",
"\"\"",
",",
"\"\"",
")",
")",
"urlconf",
"=",
"settings",
".",
"RO... | https://github.com/willhardy/django-seo/blob/3089686a3c490091315860979ad15ef2527c3e3e/rollyourown/seo/systemviews.py#L43-L65 | ||
cool-RR/python_toolbox | cb9ef64b48f1d03275484d707dc5079b6701ad0c | python_toolbox/third_party/sortedcontainers/sortedlist.py | python | SortedKeyList.__repr__ | (self) | return '{0}({1!r}, key={2!r})'.format(type_name, list(self), self._key) | Return string representation of sorted-key list.
``skl.__repr__()`` <==> ``repr(skl)``
:return: string representation | Return string representation of sorted-key list. | [
"Return",
"string",
"representation",
"of",
"sorted",
"-",
"key",
"list",
"."
] | def __repr__(self):
"""Return string representation of sorted-key list.
``skl.__repr__()`` <==> ``repr(skl)``
:return: string representation
"""
type_name = type(self).__name__
return '{0}({1!r}, key={2!r})'.format(type_name, list(self), self._key) | [
"def",
"__repr__",
"(",
"self",
")",
":",
"type_name",
"=",
"type",
"(",
"self",
")",
".",
"__name__",
"return",
"'{0}({1!r}, key={2!r})'",
".",
"format",
"(",
"type_name",
",",
"list",
"(",
"self",
")",
",",
"self",
".",
"_key",
")"
] | https://github.com/cool-RR/python_toolbox/blob/cb9ef64b48f1d03275484d707dc5079b6701ad0c/python_toolbox/third_party/sortedcontainers/sortedlist.py#L2530-L2539 | |
OpenMDAO/OpenMDAO-Framework | f2e37b7de3edeaaeb2d251b375917adec059db9b | openmdao.lib/src/openmdao/lib/datatypes/domain/vector.py | python | Vector.flip_z | (self) | Convert to other-handed coordinate system. | Convert to other-handed coordinate system. | [
"Convert",
"to",
"other",
"-",
"handed",
"coordinate",
"system",
"."
] | def flip_z(self):
""" Convert to other-handed coordinate system. """
if self.z is None:
raise AttributeError('flip_z: no Z component')
self.z *= -1. | [
"def",
"flip_z",
"(",
"self",
")",
":",
"if",
"self",
".",
"z",
"is",
"None",
":",
"raise",
"AttributeError",
"(",
"'flip_z: no Z component'",
")",
"self",
".",
"z",
"*=",
"-",
"1."
] | https://github.com/OpenMDAO/OpenMDAO-Framework/blob/f2e37b7de3edeaaeb2d251b375917adec059db9b/openmdao.lib/src/openmdao/lib/datatypes/domain/vector.py#L414-L418 | ||
google/nogotofail | 7037dcb23f1fc370de784c36dbb24ae93cd5a58d | nogotofail/mitm/blame/app_blame.py | python | Server.prune_old_clients | (self) | Prune old clients that have not been heard from in a long time | Prune old clients that have not been heard from in a long time | [
"Prune",
"old",
"clients",
"that",
"have",
"not",
"been",
"heard",
"from",
"in",
"a",
"long",
"time"
] | def prune_old_clients(self):
"""Prune old clients that have not been heard from in a long time"""
for client in self.clients.values():
if not client.check_timeouts():
self.logger.info("Blame: Client %s timed out", client.address)
self.remove_client(client) | [
"def",
"prune_old_clients",
"(",
"self",
")",
":",
"for",
"client",
"in",
"self",
".",
"clients",
".",
"values",
"(",
")",
":",
"if",
"not",
"client",
".",
"check_timeouts",
"(",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Blame: Client %s time... | https://github.com/google/nogotofail/blob/7037dcb23f1fc370de784c36dbb24ae93cd5a58d/nogotofail/mitm/blame/app_blame.py#L431-L436 | ||
kanzure/nanoengineer | 874e4c9f8a9190f093625b267f9767e19f82e6c4 | cad/src/commands/PlayMovie/Ui_MoviePropertyManager.py | python | Ui_MoviePropertyManager.__init__ | (self, command) | Constructor for the B{Movie} property manager class that defines
its UI.
@param command: The parent mode where this Property Manager is used
@type command: L{movieMode} | Constructor for the B{Movie} property manager class that defines
its UI. | [
"Constructor",
"for",
"the",
"B",
"{",
"Movie",
"}",
"property",
"manager",
"class",
"that",
"defines",
"its",
"UI",
"."
] | def __init__(self, command):
"""
Constructor for the B{Movie} property manager class that defines
its UI.
@param command: The parent mode where this Property Manager is used
@type command: L{movieMode}
"""
_superclass.__init__(self, command)
self.showTo... | [
"def",
"__init__",
"(",
"self",
",",
"command",
")",
":",
"_superclass",
".",
"__init__",
"(",
"self",
",",
"command",
")",
"self",
".",
"showTopRowButtons",
"(",
"PM_DONE_BUTTON",
"|",
"PM_CANCEL_BUTTON",
"|",
"PM_WHATS_THIS_BUTTON",
")",
"msg",
"=",
"''",
... | https://github.com/kanzure/nanoengineer/blob/874e4c9f8a9190f093625b267f9767e19f82e6c4/cad/src/commands/PlayMovie/Ui_MoviePropertyManager.py#L63-L79 | ||
MarioVilas/winappdbg | 975a088ac54253d0bdef39fe831e82f24b4c11f6 | winappdbg/process.py | python | Process.is_address_readable | (self, address) | return mbi.is_readable() | Determines if an address belongs to a commited and readable page.
The page may or may not have additional permissions.
@note: Returns always C{False} for kernel mode addresses.
@type address: int
@param address: Memory address to query.
@rtype: bool
@return:
... | Determines if an address belongs to a commited and readable page.
The page may or may not have additional permissions. | [
"Determines",
"if",
"an",
"address",
"belongs",
"to",
"a",
"commited",
"and",
"readable",
"page",
".",
"The",
"page",
"may",
"or",
"may",
"not",
"have",
"additional",
"permissions",
"."
] | def is_address_readable(self, address):
"""
Determines if an address belongs to a commited and readable page.
The page may or may not have additional permissions.
@note: Returns always C{False} for kernel mode addresses.
@type address: int
@param address: Memory addres... | [
"def",
"is_address_readable",
"(",
"self",
",",
"address",
")",
":",
"try",
":",
"mbi",
"=",
"self",
".",
"mquery",
"(",
"address",
")",
"except",
"WindowsError",
"as",
"e",
":",
"if",
"e",
".",
"winerror",
"==",
"win32",
".",
"ERROR_INVALID_PARAMETER",
... | https://github.com/MarioVilas/winappdbg/blob/975a088ac54253d0bdef39fe831e82f24b4c11f6/winappdbg/process.py#L2693-L2715 | |
selfteaching/selfteaching-python-camp | 9982ee964b984595e7d664b07c389cddaf158f1e | exercises/1901040047/d08/mymodule/stats_word.py | python | stats_text_cn | (text) | 中文词频统计 | 中文词频统计 | [
"中文词频统计"
] | def stats_text_cn(text):
'''中文词频统计'''
if type(text)!=str: #添加参数型检查。
raise ValueError("文本为非字符串")
d = text.replace(',','').replace('-',' ').replace('.','').replace(':','').replace(';','').replace('"','').replace('!','').replace('?','').replace('、','').replace(',','').replace('。... | [
"def",
"stats_text_cn",
"(",
"text",
")",
":",
"if",
"type",
"(",
"text",
")",
"!=",
"str",
":",
"#添加参数型检查。",
"raise",
"ValueError",
"(",
"\"文本为非字符串\")",
"",
"d",
"=",
"text",
".",
"replace",
"(",
"','",
",",
"''",
")",
".",
"replace",
"(",
"'-'",
... | https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/exercises/1901040047/d08/mymodule/stats_word.py#L75-L89 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_pod_condition.py | python | V1PodCondition.last_probe_time | (self) | return self._last_probe_time | Gets the last_probe_time of this V1PodCondition. # noqa: E501
Last time we probed the condition. # noqa: E501
:return: The last_probe_time of this V1PodCondition. # noqa: E501
:rtype: datetime | Gets the last_probe_time of this V1PodCondition. # noqa: E501 | [
"Gets",
"the",
"last_probe_time",
"of",
"this",
"V1PodCondition",
".",
"#",
"noqa",
":",
"E501"
] | def last_probe_time(self):
"""Gets the last_probe_time of this V1PodCondition. # noqa: E501
Last time we probed the condition. # noqa: E501
:return: The last_probe_time of this V1PodCondition. # noqa: E501
:rtype: datetime
"""
return self._last_probe_time | [
"def",
"last_probe_time",
"(",
"self",
")",
":",
"return",
"self",
".",
"_last_probe_time"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_pod_condition.py#L79-L87 | |
LumaPictures/pymel | fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72 | pymel/tools/mel2py/melparse.py | python | p_primary_expression_paren | (t) | primary_expression : LPAREN expression RPAREN | primary_expression : LPAREN expression RPAREN | [
"primary_expression",
":",
"LPAREN",
"expression",
"RPAREN"
] | def p_primary_expression_paren(t):
'''primary_expression : LPAREN expression RPAREN'''
t[0] = Token(t[1] + t[2] + t[3], t[2].type) | [
"def",
"p_primary_expression_paren",
"(",
"t",
")",
":",
"t",
"[",
"0",
"]",
"=",
"Token",
"(",
"t",
"[",
"1",
"]",
"+",
"t",
"[",
"2",
"]",
"+",
"t",
"[",
"3",
"]",
",",
"t",
"[",
"2",
"]",
".",
"type",
")"
] | https://github.com/LumaPictures/pymel/blob/fa88a3f4fa18e09bb8aa9bdf4dab53d984bada72/pymel/tools/mel2py/melparse.py#L2624-L2627 | ||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3/s3forms.py | python | S3SQLInlineLink.validate | (self, form) | Validate this link, currently only checking whether it has
a value when required=True
Args:
form: the form | Validate this link, currently only checking whether it has
a value when required=True | [
"Validate",
"this",
"link",
"currently",
"only",
"checking",
"whether",
"it",
"has",
"a",
"value",
"when",
"required",
"=",
"True"
] | def validate(self, form):
"""
Validate this link, currently only checking whether it has
a value when required=True
Args:
form: the form
"""
required = self.options.required
if not required:
return
fname = self._f... | [
"def",
"validate",
"(",
"self",
",",
"form",
")",
":",
"required",
"=",
"self",
".",
"options",
".",
"required",
"if",
"not",
"required",
":",
"return",
"fname",
"=",
"self",
".",
"_formname",
"(",
"separator",
"=",
"\"_\"",
")",
"values",
"=",
"form",... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3/s3forms.py#L4238-L4257 | ||
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | tabular/src/autogluon/tabular/learner/abstract_learner.py | python | AbstractLearner.predict | (self, X: DataFrame, model=None, as_pandas=True) | return y_pred | [] | def predict(self, X: DataFrame, model=None, as_pandas=True):
if as_pandas:
X_index = copy.deepcopy(X.index)
else:
X_index = None
y_pred_proba = self.predict_proba(X=X, model=model, as_pandas=False, as_multiclass=False, inverse_transform=False)
problem_type = self.... | [
"def",
"predict",
"(",
"self",
",",
"X",
":",
"DataFrame",
",",
"model",
"=",
"None",
",",
"as_pandas",
"=",
"True",
")",
":",
"if",
"as_pandas",
":",
"X_index",
"=",
"copy",
".",
"deepcopy",
"(",
"X",
".",
"index",
")",
"else",
":",
"X_index",
"="... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/tabular/src/autogluon/tabular/learner/abstract_learner.py#L175-L193 | |||
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | ansible/roles/lib_git/library/git_commit.py | python | GitCLI._config | (self, get_args) | return results | Do a git config --get <get_args> | Do a git config --get <get_args> | [
"Do",
"a",
"git",
"config",
"--",
"get",
"<get_args",
">"
] | def _config(self, get_args):
''' Do a git config --get <get_args> '''
cmd = ["config", '--get', get_args]
results = self.git_cmd(cmd, output=True, output_type='raw')
return results | [
"def",
"_config",
"(",
"self",
",",
"get_args",
")",
":",
"cmd",
"=",
"[",
"\"config\"",
",",
"'--get'",
",",
"get_args",
"]",
"results",
"=",
"self",
".",
"git_cmd",
"(",
"cmd",
",",
"output",
"=",
"True",
",",
"output_type",
"=",
"'raw'",
")",
"ret... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/ansible/roles/lib_git/library/git_commit.py#L298-L304 | |
Nuitka/Nuitka | 39262276993757fa4e299f497654065600453fc9 | nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Taskmaster.py | python | Taskmaster._validate_pending_children | (self) | Validate the content of the pending_children set. Assert if an
internal error is found.
This function is used strictly for debugging the taskmaster by
checking that no invariants are violated. It is not used in
normal operation.
The pending_children set is used to detect cycles... | Validate the content of the pending_children set. Assert if an
internal error is found. | [
"Validate",
"the",
"content",
"of",
"the",
"pending_children",
"set",
".",
"Assert",
"if",
"an",
"internal",
"error",
"is",
"found",
"."
] | def _validate_pending_children(self):
"""
Validate the content of the pending_children set. Assert if an
internal error is found.
This function is used strictly for debugging the taskmaster by
checking that no invariants are violated. It is not used in
normal operation.
... | [
"def",
"_validate_pending_children",
"(",
"self",
")",
":",
"for",
"n",
"in",
"self",
".",
"pending_children",
":",
"assert",
"n",
".",
"state",
"in",
"(",
"NODE_PENDING",
",",
"NODE_EXECUTING",
")",
",",
"(",
"str",
"(",
"n",
")",
",",
"StateString",
"[... | https://github.com/Nuitka/Nuitka/blob/39262276993757fa4e299f497654065600453fc9/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Taskmaster.py#L652-L728 | ||
pymedusa/Medusa | 1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38 | lib/pkg_resources/__init__.py | python | fixup_namespace_packages | (path_item, parent=None) | Ensure that previously-declared namespace packages include path_item | Ensure that previously-declared namespace packages include path_item | [
"Ensure",
"that",
"previously",
"-",
"declared",
"namespace",
"packages",
"include",
"path_item"
] | def fixup_namespace_packages(path_item, parent=None):
"""Ensure that previously-declared namespace packages include path_item"""
_imp.acquire_lock()
try:
for package in _namespace_packages.get(parent, ()):
subpath = _handle_ns(package, path_item)
if subpath:
f... | [
"def",
"fixup_namespace_packages",
"(",
"path_item",
",",
"parent",
"=",
"None",
")",
":",
"_imp",
".",
"acquire_lock",
"(",
")",
"try",
":",
"for",
"package",
"in",
"_namespace_packages",
".",
"get",
"(",
"parent",
",",
"(",
")",
")",
":",
"subpath",
"=... | https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/lib/pkg_resources/__init__.py#L2302-L2311 | ||
carla-simulator/ros-bridge | dac9e729b70a3db9da665c1fdb843e96e7e25d04 | carla_ros_bridge/src/carla_ros_bridge/debug_helper.py | python | DebugHelper.destroy | (self) | Function (override) to destroy this object.
Terminate ROS subscriptions
:return: | Function (override) to destroy this object. | [
"Function",
"(",
"override",
")",
"to",
"destroy",
"this",
"object",
"."
] | def destroy(self):
"""
Function (override) to destroy this object.
Terminate ROS subscriptions
:return:
"""
self.node.logdebug("Destroy DebugHelper")
self.debug = None
self.node.destroy_subscription(self.marker_subscriber) | [
"def",
"destroy",
"(",
"self",
")",
":",
"self",
".",
"node",
".",
"logdebug",
"(",
"\"Destroy DebugHelper\"",
")",
"self",
".",
"debug",
"=",
"None",
"self",
".",
"node",
".",
"destroy_subscription",
"(",
"self",
".",
"marker_subscriber",
")"
] | https://github.com/carla-simulator/ros-bridge/blob/dac9e729b70a3db9da665c1fdb843e96e7e25d04/carla_ros_bridge/src/carla_ros_bridge/debug_helper.py#L37-L47 | ||
nortikin/sverchok | 7b460f01317c15f2681bfa3e337c5e7346f3711b | nodes/modifier_change/follow_active_quads.py | python | unwrap_mesh | (verts, faces, active_indexes, uv_verts=None, uv_faces=None, face_mask=None, mode=MODE.even) | return list(uv_vert_out), list(uv_face_out) | Unwrap mesh similar to Blender operator: follow active quad
:param verts: list of tuple(float, float, float)
:param faces: list of list of int
:param active_indexes: list of indexes, arbitrary number
:param uv_verts: list of tuple(float, float, float), only XY ate taken in account
:param uv_faces: l... | Unwrap mesh similar to Blender operator: follow active quad
:param verts: list of tuple(float, float, float)
:param faces: list of list of int
:param active_indexes: list of indexes, arbitrary number
:param uv_verts: list of tuple(float, float, float), only XY ate taken in account
:param uv_faces: l... | [
"Unwrap",
"mesh",
"similar",
"to",
"Blender",
"operator",
":",
"follow",
"active",
"quad",
":",
"param",
"verts",
":",
"list",
"of",
"tuple",
"(",
"float",
"float",
"float",
")",
":",
"param",
"faces",
":",
"list",
"of",
"list",
"of",
"int",
":",
"para... | def unwrap_mesh(verts, faces, active_indexes, uv_verts=None, uv_faces=None, face_mask=None, mode=MODE.even):
"""
Unwrap mesh similar to Blender operator: follow active quad
:param verts: list of tuple(float, float, float)
:param faces: list of list of int
:param active_indexes: list of indexes, arbi... | [
"def",
"unwrap_mesh",
"(",
"verts",
",",
"faces",
",",
"active_indexes",
",",
"uv_verts",
"=",
"None",
",",
"uv_faces",
"=",
"None",
",",
"face_mask",
"=",
"None",
",",
"mode",
"=",
"MODE",
".",
"even",
")",
":",
"bm",
"=",
"bmesh",
".",
"new",
"(",
... | https://github.com/nortikin/sverchok/blob/7b460f01317c15f2681bfa3e337c5e7346f3711b/nodes/modifier_change/follow_active_quads.py#L23-L86 | |
googleapis/python-ndb | e780c81cde1016651afbfcad8180d9912722cf1b | google/cloud/ndb/metadata.py | python | Property.key_to_property | (cls, key) | Return the property specified by a given __property__ key.
Args:
key (key.Key): key whose property name is requested.
Returns:
str: property specified by key, or None if the key specified
only a kind. | Return the property specified by a given __property__ key. | [
"Return",
"the",
"property",
"specified",
"by",
"a",
"given",
"__property__",
"key",
"."
] | def key_to_property(cls, key):
"""Return the property specified by a given __property__ key.
Args:
key (key.Key): key whose property name is requested.
Returns:
str: property specified by key, or None if the key specified
only a kind.
"""
... | [
"def",
"key_to_property",
"(",
"cls",
",",
"key",
")",
":",
"if",
"key",
".",
"kind",
"(",
")",
"==",
"Kind",
".",
"KIND_NAME",
":",
"return",
"None",
"else",
":",
"return",
"key",
".",
"id",
"(",
")"
] | https://github.com/googleapis/python-ndb/blob/e780c81cde1016651afbfcad8180d9912722cf1b/google/cloud/ndb/metadata.py#L228-L241 | ||
sqlalchemy/sqlalchemy | eb716884a4abcabae84a6aaba105568e925b7d27 | lib/sqlalchemy/event/attr.py | python | _CompoundListener.exec_once_unless_exception | (self, *args, **kw) | Execute this event, but only if it has not been
executed already for this collection, or was called
by a previous exec_once_unless_exception call and
raised an exception.
If exec_once was already called, then this method will never run
the callable regardless of whether it raise... | Execute this event, but only if it has not been
executed already for this collection, or was called
by a previous exec_once_unless_exception call and
raised an exception. | [
"Execute",
"this",
"event",
"but",
"only",
"if",
"it",
"has",
"not",
"been",
"executed",
"already",
"for",
"this",
"collection",
"or",
"was",
"called",
"by",
"a",
"previous",
"exec_once_unless_exception",
"call",
"and",
"raised",
"an",
"exception",
"."
] | def exec_once_unless_exception(self, *args, **kw):
"""Execute this event, but only if it has not been
executed already for this collection, or was called
by a previous exec_once_unless_exception call and
raised an exception.
If exec_once was already called, then this method will... | [
"def",
"exec_once_unless_exception",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"if",
"not",
"self",
".",
"_exec_once",
":",
"self",
".",
"_exec_once_impl",
"(",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")"
] | https://github.com/sqlalchemy/sqlalchemy/blob/eb716884a4abcabae84a6aaba105568e925b7d27/lib/sqlalchemy/event/attr.py#L295-L308 | ||
awslabs/autogluon | 7309118f2ab1c9519f25acf61a283a95af95842b | core/src/autogluon/core/data/label_cleaner.py | python | LabelCleaner.construct | (problem_type: str, y: Union[Series, np.ndarray, list, DataFrame], y_uncleaned: Union[Series, np.ndarray, list, DataFrame] = None, positive_class=None) | [] | def construct(problem_type: str, y: Union[Series, np.ndarray, list, DataFrame], y_uncleaned: Union[Series, np.ndarray, list, DataFrame] = None, positive_class=None):
if problem_type == SOFTCLASS:
return LabelCleanerSoftclass(y)
y = LabelCleaner._convert_to_valid_series(y)
if y_unclea... | [
"def",
"construct",
"(",
"problem_type",
":",
"str",
",",
"y",
":",
"Union",
"[",
"Series",
",",
"np",
".",
"ndarray",
",",
"list",
",",
"DataFrame",
"]",
",",
"y_uncleaned",
":",
"Union",
"[",
"Series",
",",
"np",
".",
"ndarray",
",",
"list",
",",
... | https://github.com/awslabs/autogluon/blob/7309118f2ab1c9519f25acf61a283a95af95842b/core/src/autogluon/core/data/label_cleaner.py#L29-L48 | ||||
jakelever/kindred | 298d4868d9c9babf82d44de1bba2a9874145ce5a | kindred/CandidateRelation.py | python | CandidateRelation.__init__ | (self,entities=None,knownTypesAndArgNames=None,sentence=None) | Constructor for Candidate Relation class
:param entities: List of entities in relation
:param knownTypesAndArgNames: List of tuples with known relation types and argument names associated with this candidate relation
:param sentence: Parsed sentence containing the candidate relation
:type entities: list of k... | Constructor for Candidate Relation class
:param entities: List of entities in relation
:param knownTypesAndArgNames: List of tuples with known relation types and argument names associated with this candidate relation
:param sentence: Parsed sentence containing the candidate relation
:type entities: list of k... | [
"Constructor",
"for",
"Candidate",
"Relation",
"class",
":",
"param",
"entities",
":",
"List",
"of",
"entities",
"in",
"relation",
":",
"param",
"knownTypesAndArgNames",
":",
"List",
"of",
"tuples",
"with",
"known",
"relation",
"types",
"and",
"argument",
"names... | def __init__(self,entities=None,knownTypesAndArgNames=None,sentence=None):
"""
Constructor for Candidate Relation class
:param entities: List of entities in relation
:param knownTypesAndArgNames: List of tuples with known relation types and argument names associated with this candidate relation
:param sent... | [
"def",
"__init__",
"(",
"self",
",",
"entities",
"=",
"None",
",",
"knownTypesAndArgNames",
"=",
"None",
",",
"sentence",
"=",
"None",
")",
":",
"if",
"entities",
"is",
"None",
":",
"entities",
"=",
"[",
"]",
"if",
"knownTypesAndArgNames",
"is",
"None",
... | https://github.com/jakelever/kindred/blob/298d4868d9c9babf82d44de1bba2a9874145ce5a/kindred/CandidateRelation.py#L14-L49 | ||
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/SearchIO/HmmerIO/hmmer2_text.py | python | Hmmer2TextParser.parse_hits | (self) | return hit_placeholders | Parse a HMMER2 hit block, beginning with the hit table. | Parse a HMMER2 hit block, beginning with the hit table. | [
"Parse",
"a",
"HMMER2",
"hit",
"block",
"beginning",
"with",
"the",
"hit",
"table",
"."
] | def parse_hits(self):
"""Parse a HMMER2 hit block, beginning with the hit table."""
hit_placeholders = []
while self.read_next():
if self.line.startswith("Parsed"):
break
if self.line.find("no hits") > -1:
break
if (
... | [
"def",
"parse_hits",
"(",
"self",
")",
":",
"hit_placeholders",
"=",
"[",
"]",
"while",
"self",
".",
"read_next",
"(",
")",
":",
"if",
"self",
".",
"line",
".",
"startswith",
"(",
"\"Parsed\"",
")",
":",
"break",
"if",
"self",
".",
"line",
".",
"find... | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/SearchIO/HmmerIO/hmmer2_text.py#L137-L168 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.