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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jorgebastida/gordon | 4c1cd0c4dea2499d98115672095714592f80f7aa | examples/apigateway/helloworld/hellopy.py | python | handler | (event, context) | return "Hello from python!" | [] | def handler(event, context):
return "Hello from python!" | [
"def",
"handler",
"(",
"event",
",",
"context",
")",
":",
"return",
"\"Hello from python!\""
] | https://github.com/jorgebastida/gordon/blob/4c1cd0c4dea2499d98115672095714592f80f7aa/examples/apigateway/helloworld/hellopy.py#L4-L5 | |||
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/datetime.py | python | _ord2ymd | (n) | return year, month, n+1 | ordinal -> (year, month, day), considering 01-Jan-0001 as day 1. | ordinal -> (year, month, day), considering 01-Jan-0001 as day 1. | [
"ordinal",
"-",
">",
"(",
"year",
"month",
"day",
")",
"considering",
"01",
"-",
"Jan",
"-",
"0001",
"as",
"day",
"1",
"."
] | def _ord2ymd(n):
"ordinal -> (year, month, day), considering 01-Jan-0001 as day 1."
# n is a 1-based index, starting at 1-Jan-1. The pattern of leap years
# repeats exactly every 400 years. The basic strategy is to find the
# closest 400-year boundary at or before n, then work with the offset
# f... | [
"def",
"_ord2ymd",
"(",
"n",
")",
":",
"# n is a 1-based index, starting at 1-Jan-1. The pattern of leap years",
"# repeats exactly every 400 years. The basic strategy is to find the",
"# closest 400-year boundary at or before n, then work with the offset",
"# from that boundary to n. Life is m... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/datetime.py#L82-L142 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/ctypes/__init__.py | python | CFUNCTYPE | (restype, *argtypes, **kw) | CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype.
restype: the result type
argtypes: a sequence specifying the argument types
The function prototype can be called in different ways to create a
callable object:
prototype(integer address) -... | CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype. | [
"CFUNCTYPE",
"(",
"restype",
"*",
"argtypes",
"use_errno",
"=",
"False",
"use_last_error",
"=",
"False",
")",
"-",
">",
"function",
"prototype",
"."
] | def CFUNCTYPE(restype, *argtypes, **kw):
"""CFUNCTYPE(restype, *argtypes,
use_errno=False, use_last_error=False) -> function prototype.
restype: the result type
argtypes: a sequence specifying the argument types
The function prototype can be called in different ways to create a
ca... | [
"def",
"CFUNCTYPE",
"(",
"restype",
",",
"*",
"argtypes",
",",
"*",
"*",
"kw",
")",
":",
"flags",
"=",
"_FUNCFLAG_CDECL",
"if",
"kw",
".",
"pop",
"(",
"\"use_errno\"",
",",
"False",
")",
":",
"flags",
"|=",
"_FUNCFLAG_USE_ERRNO",
"if",
"kw",
".",
"pop"... | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/ctypes/__init__.py#L73-L104 | ||
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/util.py | python | is_installable_dir | (path) | return False | Return True if `path` is a directory containing a setup.py file. | Return True if `path` is a directory containing a setup.py file. | [
"Return",
"True",
"if",
"path",
"is",
"a",
"directory",
"containing",
"a",
"setup",
".",
"py",
"file",
"."
] | def is_installable_dir(path):
"""Return True if `path` is a directory containing a setup.py file."""
if not os.path.isdir(path):
return False
setup_py = os.path.join(path, 'setup.py')
if os.path.isfile(setup_py):
return True
return False | [
"def",
"is_installable_dir",
"(",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"return",
"False",
"setup_py",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"'setup.py'",
")",
"if",
"os",
".",
"path... | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv/lib/python2.7/site-packages/pip/util.py#L191-L198 | |
hhursev/recipe-scrapers | 478b9ddb0dda02b17b14f299eea729bef8131aa9 | recipe_scrapers/sunbasket.py | python | SunBasket.title | (self) | return self.soup.find("h1").get_text() | [] | def title(self):
return self.soup.find("h1").get_text() | [
"def",
"title",
"(",
"self",
")",
":",
"return",
"self",
".",
"soup",
".",
"find",
"(",
"\"h1\"",
")",
".",
"get_text",
"(",
")"
] | https://github.com/hhursev/recipe-scrapers/blob/478b9ddb0dda02b17b14f299eea729bef8131aa9/recipe_scrapers/sunbasket.py#L12-L13 | |||
jfkirk/tensorrec | 80690737ac039a5b41fc99e67372c4f67d8cfc51 | tensorrec/tensorrec.py | python | TensorRec.__init__ | (self,
n_components=100,
n_tastes=1,
user_repr_graph=LinearRepresentationGraph(),
item_repr_graph=LinearRepresentationGraph(),
attention_graph=None,
prediction_graph=DotProductPredictionGraph(),
loss_g... | A TensorRec recommendation model.
:param n_components: Integer
The dimension of a single output of the representation function. Must be >= 1.
:param n_tastes: Integer
The number of tastes/reprs to be calculated for each user. Must be >= 1.
:param user_repr_graph: AbstractRepresen... | A TensorRec recommendation model.
:param n_components: Integer
The dimension of a single output of the representation function. Must be >= 1.
:param n_tastes: Integer
The number of tastes/reprs to be calculated for each user. Must be >= 1.
:param user_repr_graph: AbstractRepresen... | [
"A",
"TensorRec",
"recommendation",
"model",
".",
":",
"param",
"n_components",
":",
"Integer",
"The",
"dimension",
"of",
"a",
"single",
"output",
"of",
"the",
"representation",
"function",
".",
"Must",
"be",
">",
"=",
"1",
".",
":",
"param",
"n_tastes",
"... | def __init__(self,
n_components=100,
n_tastes=1,
user_repr_graph=LinearRepresentationGraph(),
item_repr_graph=LinearRepresentationGraph(),
attention_graph=None,
prediction_graph=DotProductPredictionGraph(),
... | [
"def",
"__init__",
"(",
"self",
",",
"n_components",
"=",
"100",
",",
"n_tastes",
"=",
"1",
",",
"user_repr_graph",
"=",
"LinearRepresentationGraph",
"(",
")",
",",
"item_repr_graph",
"=",
"LinearRepresentationGraph",
"(",
")",
",",
"attention_graph",
"=",
"None... | https://github.com/jfkirk/tensorrec/blob/80690737ac039a5b41fc99e67372c4f67d8cfc51/tensorrec/tensorrec.py#L28-L134 | ||
eth-sri/eran | 973e3b52d297d079d5402edec8f7922d824b8cc2 | tf_verify/deepzono_nodes.py | python | DeepzonoConvbias.__init__ | (self, image_shape, filters, bias, strides, pad_top, pad_left, pad_bottom, pad_right, input_names, output_name, output_shape) | Arguments
---------
image_shape : numpy.ndarray
of shape [height, width, channels]
filters : numpy.ndarray
the 4D array with the filter weights
bias : numpy.ndarray
array with the bias (has to have as many elements as the filter has out channels)
... | Arguments
---------
image_shape : numpy.ndarray
of shape [height, width, channels]
filters : numpy.ndarray
the 4D array with the filter weights
bias : numpy.ndarray
array with the bias (has to have as many elements as the filter has out channels)
... | [
"Arguments",
"---------",
"image_shape",
":",
"numpy",
".",
"ndarray",
"of",
"shape",
"[",
"height",
"width",
"channels",
"]",
"filters",
":",
"numpy",
".",
"ndarray",
"the",
"4D",
"array",
"with",
"the",
"filter",
"weights",
"bias",
":",
"numpy",
".",
"nd... | def __init__(self, image_shape, filters, bias, strides, pad_top, pad_left, pad_bottom, pad_right, input_names, output_name, output_shape):
"""
Arguments
---------
image_shape : numpy.ndarray
of shape [height, width, channels]
filters : numpy.ndarray
the 4D... | [
"def",
"__init__",
"(",
"self",
",",
"image_shape",
",",
"filters",
",",
"bias",
",",
"strides",
",",
"pad_top",
",",
"pad_left",
",",
"pad_bottom",
",",
"pad_right",
",",
"input_names",
",",
"output_name",
",",
"output_shape",
")",
":",
"DeepzonoConv",
".",... | https://github.com/eth-sri/eran/blob/973e3b52d297d079d5402edec8f7922d824b8cc2/tf_verify/deepzono_nodes.py#L587-L609 | ||
naparuba/shinken | 8163d645e801fa43ee1704f099a4684f120e667b | shinken/objects/service.py | python | Services.explode_services_duplicates | (self, hosts, s) | Explodes services holding a `duplicate_foreach` clause.
:param hosts: The hosts container
:param s: The service to explode
:type s: Service | Explodes services holding a `duplicate_foreach` clause. | [
"Explodes",
"services",
"holding",
"a",
"duplicate_foreach",
"clause",
"."
] | def explode_services_duplicates(self, hosts, s):
"""
Explodes services holding a `duplicate_foreach` clause.
:param hosts: The hosts container
:param s: The service to explode
:type s: Service
"""
hname = getattr(s, "host_name", None)
if hn... | [
"def",
"explode_services_duplicates",
"(",
"self",
",",
"hosts",
",",
"s",
")",
":",
"hname",
"=",
"getattr",
"(",
"s",
",",
"\"host_name\"",
",",
"None",
")",
"if",
"hname",
"is",
"None",
":",
"return",
"# the generator case, we must create several new services",... | https://github.com/naparuba/shinken/blob/8163d645e801fa43ee1704f099a4684f120e667b/shinken/objects/service.py#L1735-L1762 | ||
CLUEbenchmark/CLUEPretrainedModels | b384fd41665a8261f9c689c940cf750b3bc21fce | create_pretraining_data.py | python | create_masked_lm_predictions | (tokens, masked_lm_prob,
max_predictions_per_seq, vocab_words, rng) | return (output_tokens, masked_lm_positions, masked_lm_labels) | Creates the predictions for the masked LM objective. | Creates the predictions for the masked LM objective. | [
"Creates",
"the",
"predictions",
"for",
"the",
"masked",
"LM",
"objective",
"."
] | def create_masked_lm_predictions(tokens, masked_lm_prob,
max_predictions_per_seq, vocab_words, rng):
"""Creates the predictions for the masked LM objective."""
cand_indexes = []
for (i, token) in enumerate(tokens):
if token == "[CLS]" or token == "[SEP]":
continue
#... | [
"def",
"create_masked_lm_predictions",
"(",
"tokens",
",",
"masked_lm_prob",
",",
"max_predictions_per_seq",
",",
"vocab_words",
",",
"rng",
")",
":",
"cand_indexes",
"=",
"[",
"]",
"for",
"(",
"i",
",",
"token",
")",
"in",
"enumerate",
"(",
"tokens",
")",
"... | https://github.com/CLUEbenchmark/CLUEPretrainedModels/blob/b384fd41665a8261f9c689c940cf750b3bc21fce/create_pretraining_data.py#L349-L422 | |
Huangying-Zhan/DF-VO | 6a2ec43fc6209d9058ae1709d779c5ada68a31f3 | tools/evaluation/odometry/kitti_odometry.py | python | KittiEvalOdom.compute_RPE | (self, gt, pred) | return rpe_errors | Compute RPE
Args:
gt (dict): ground-truth poses as [4x4] array
pred (dict): predicted poses as [4x4] array
Returns:
trans_errors (list): list of rpe translation error
rot_errors (list): list of RPE rotation error | Compute RPE
Args:
gt (dict): ground-truth poses as [4x4] array
pred (dict): predicted poses as [4x4] array
Returns:
trans_errors (list): list of rpe translation error
rot_errors (list): list of RPE rotation error | [
"Compute",
"RPE",
"Args",
":",
"gt",
"(",
"dict",
")",
":",
"ground",
"-",
"truth",
"poses",
"as",
"[",
"4x4",
"]",
"array",
"pred",
"(",
"dict",
")",
":",
"predicted",
"poses",
"as",
"[",
"4x4",
"]",
"array",
"Returns",
":",
"trans_errors",
"(",
"... | def compute_RPE(self, gt, pred):
"""Compute RPE
Args:
gt (dict): ground-truth poses as [4x4] array
pred (dict): predicted poses as [4x4] array
Returns:
trans_errors (list): list of rpe translation error
rot_errors (list): list of ... | [
"def",
"compute_RPE",
"(",
"self",
",",
"gt",
",",
"pred",
")",
":",
"rpe_errors",
"=",
"{",
"'trans'",
":",
"[",
"]",
",",
"'rot'",
":",
"[",
"]",
"}",
"pred_keys",
"=",
"list",
"(",
"pred",
".",
"keys",
"(",
")",
")",
"for",
"cnt",
"in",
"ran... | https://github.com/Huangying-Zhan/DF-VO/blob/6a2ec43fc6209d9058ae1709d779c5ada68a31f3/tools/evaluation/odometry/kitti_odometry.py#L467-L492 | |
GoogleCloudPlatform/cloudml-samples | efddc4a9898127e55edc0946557aca4bfaf59705 | sklearn/sklearn-template/template/trainer/task.py | python | run_experiment | (flags) | Testbed for running model training and evaluation. | Testbed for running model training and evaluation. | [
"Testbed",
"for",
"running",
"model",
"training",
"and",
"evaluation",
"."
] | def run_experiment(flags):
"""Testbed for running model training and evaluation."""
# Get data for training and evaluation
dataset = utils.read_df_from_bigquery(
flags.input, num_samples=flags.num_samples)
# Get model
estimator = model.get_estimator(flags)
# Run training and evaluation
_train_and... | [
"def",
"run_experiment",
"(",
"flags",
")",
":",
"# Get data for training and evaluation",
"dataset",
"=",
"utils",
".",
"read_df_from_bigquery",
"(",
"flags",
".",
"input",
",",
"num_samples",
"=",
"flags",
".",
"num_samples",
")",
"# Get model",
"estimator",
"=",
... | https://github.com/GoogleCloudPlatform/cloudml-samples/blob/efddc4a9898127e55edc0946557aca4bfaf59705/sklearn/sklearn-template/template/trainer/task.py#L74-L85 | ||
agoragames/leaderboard-python | 4bc028164c259c3a31c7e6ccb2a8ecb83cfb1da2 | leaderboard/leaderboard.py | python | Leaderboard.rank_member | (self, member, score, member_data=None) | Rank a member in the leaderboard.
@param member [String] Member name.
@param score [float] Member score.
@param member_data [String] Optional member data. | Rank a member in the leaderboard. | [
"Rank",
"a",
"member",
"in",
"the",
"leaderboard",
"."
] | def rank_member(self, member, score, member_data=None):
'''
Rank a member in the leaderboard.
@param member [String] Member name.
@param score [float] Member score.
@param member_data [String] Optional member data.
'''
self.rank_member_in(self.leaderboard_name, m... | [
"def",
"rank_member",
"(",
"self",
",",
"member",
",",
"score",
",",
"member_data",
"=",
"None",
")",
":",
"self",
".",
"rank_member_in",
"(",
"self",
".",
"leaderboard_name",
",",
"member",
",",
"score",
",",
"member_data",
")"
] | https://github.com/agoragames/leaderboard-python/blob/4bc028164c259c3a31c7e6ccb2a8ecb83cfb1da2/leaderboard/leaderboard.py#L117-L125 | ||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/pydoc.py | python | TextDoc.docmodule | (self, object, name=None, mod=None) | return result | Produce text documentation for a given module object. | Produce text documentation for a given module object. | [
"Produce",
"text",
"documentation",
"for",
"a",
"given",
"module",
"object",
"."
] | def docmodule(self, object, name=None, mod=None):
"""Produce text documentation for a given module object."""
name = object.__name__ # ignore the passed-in name
synop, desc = splitdoc(getdoc(object))
result = self.section('NAME', name + (synop and ' - ' + synop))
all = getattr(ob... | [
"def",
"docmodule",
"(",
"self",
",",
"object",
",",
"name",
"=",
"None",
",",
"mod",
"=",
"None",
")",
":",
"name",
"=",
"object",
".",
"__name__",
"# ignore the passed-in name",
"synop",
",",
"desc",
"=",
"splitdoc",
"(",
"getdoc",
"(",
"object",
")",
... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/pydoc.py#L1049-L1148 | |
pyrocko/pyrocko | b6baefb7540fb7fce6ed9b856ec0c413961a4320 | src/moment_tensor.py | python | MomentTensor.m6_up_south_east | (self) | return to6(self.m_up_south_east()) | Get moment tensor in up-south-east convention as a six-element array.
:returns: ``(muu, mss, mee, mus, mue, mse)`` | Get moment tensor in up-south-east convention as a six-element array. | [
"Get",
"moment",
"tensor",
"in",
"up",
"-",
"south",
"-",
"east",
"convention",
"as",
"a",
"six",
"-",
"element",
"array",
"."
] | def m6_up_south_east(self):
'''
Get moment tensor in up-south-east convention as a six-element array.
:returns: ``(muu, mss, mee, mus, mue, mse)``
'''
return to6(self.m_up_south_east()) | [
"def",
"m6_up_south_east",
"(",
"self",
")",
":",
"return",
"to6",
"(",
"self",
".",
"m_up_south_east",
"(",
")",
")"
] | https://github.com/pyrocko/pyrocko/blob/b6baefb7540fb7fce6ed9b856ec0c413961a4320/src/moment_tensor.py#L792-L798 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/screenlogic/sensor.py | python | ScreenLogicChemistrySensor.sensor | (self) | return self.coordinator.data[SL_DATA.KEY_CHEMISTRY][self._key] | Shortcut to access the pump sensor data. | Shortcut to access the pump sensor data. | [
"Shortcut",
"to",
"access",
"the",
"pump",
"sensor",
"data",
"."
] | def sensor(self):
"""Shortcut to access the pump sensor data."""
return self.coordinator.data[SL_DATA.KEY_CHEMISTRY][self._key] | [
"def",
"sensor",
"(",
"self",
")",
":",
"return",
"self",
".",
"coordinator",
".",
"data",
"[",
"SL_DATA",
".",
"KEY_CHEMISTRY",
"]",
"[",
"self",
".",
"_key",
"]"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/screenlogic/sensor.py#L169-L171 | |
nsacyber/WALKOFF | 52d3311abe99d64cd2a902eb998c5e398efe0e07 | api_gateway/serverdb/role.py | python | Role.__init__ | (self, name, description='', resources=None) | Initializes a Role object. Each user has one or more Roles associated with it, which determines the user's
permissions.
Args:
name (str): The name of the Role.
description (str, optional): A description of the role.
resources (list(dict[name:resource, permissions... | Initializes a Role object. Each user has one or more Roles associated with it, which determines the user's
permissions. | [
"Initializes",
"a",
"Role",
"object",
".",
"Each",
"user",
"has",
"one",
"or",
"more",
"Roles",
"associated",
"with",
"it",
"which",
"determines",
"the",
"user",
"s",
"permissions",
"."
] | def __init__(self, name, description='', resources=None):
"""Initializes a Role object. Each user has one or more Roles associated with it, which determines the user's
permissions.
Args:
name (str): The name of the Role.
description (str, optional): A description of ... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"description",
"=",
"''",
",",
"resources",
"=",
"None",
")",
":",
"self",
".",
"name",
"=",
"name",
"self",
".",
"description",
"=",
"description",
"self",
".",
"resources",
"=",
"[",
"]",
"if",
"res... | https://github.com/nsacyber/WALKOFF/blob/52d3311abe99d64cd2a902eb998c5e398efe0e07/api_gateway/serverdb/role.py#L13-L27 | ||
un33k/django-ipware | 335a5683cca50ab743882d0a59a1ef4403341ac0 | ipware/utils.py | python | get_ip_info | (ip_str) | return ip, is_routable_ip | Given a string, it returns a tuple of (IP, Routable). | Given a string, it returns a tuple of (IP, Routable). | [
"Given",
"a",
"string",
"it",
"returns",
"a",
"tuple",
"of",
"(",
"IP",
"Routable",
")",
"."
] | def get_ip_info(ip_str):
"""
Given a string, it returns a tuple of (IP, Routable).
"""
ip = None
is_routable_ip = False
clean_ip = cleanup_ip(ip_str)
if is_valid_ip(clean_ip):
ip = clean_ip
is_routable_ip = is_public_ip(ip)
return ip, is_routable_ip | [
"def",
"get_ip_info",
"(",
"ip_str",
")",
":",
"ip",
"=",
"None",
"is_routable_ip",
"=",
"False",
"clean_ip",
"=",
"cleanup_ip",
"(",
"ip_str",
")",
"if",
"is_valid_ip",
"(",
"clean_ip",
")",
":",
"ip",
"=",
"clean_ip",
"is_routable_ip",
"=",
"is_public_ip",... | https://github.com/un33k/django-ipware/blob/335a5683cca50ab743882d0a59a1ef4403341ac0/ipware/utils.py#L101-L111 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/hubert/modeling_tf_hubert.py | python | TFHubertLayerNormConvLayer.call | (self, hidden_states: tf.Tensor) | return hidden_states | [] | def call(self, hidden_states: tf.Tensor) -> tf.Tensor:
hidden_states = self.conv(hidden_states)
hidden_states = self.layer_norm(hidden_states)
hidden_states = self.activation(hidden_states)
return hidden_states | [
"def",
"call",
"(",
"self",
",",
"hidden_states",
":",
"tf",
".",
"Tensor",
")",
"->",
"tf",
".",
"Tensor",
":",
"hidden_states",
"=",
"self",
".",
"conv",
"(",
"hidden_states",
")",
"hidden_states",
"=",
"self",
".",
"layer_norm",
"(",
"hidden_states",
... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/hubert/modeling_tf_hubert.py#L598-L602 | |||
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/nltk/stem/porter.py | python | PorterStemmer.setto | (self, s) | setto(s) sets (j+1),...k to the characters in the string s, readjusting k. | setto(s) sets (j+1),...k to the characters in the string s, readjusting k. | [
"setto",
"(",
"s",
")",
"sets",
"(",
"j",
"+",
"1",
")",
"...",
"k",
"to",
"the",
"characters",
"in",
"the",
"string",
"s",
"readjusting",
"k",
"."
] | def setto(self, s):
"""setto(s) sets (j+1),...k to the characters in the string s, readjusting k."""
length = len(s)
self.b = self.b[:self.j+1] + s + self.b[self.j+length+1:]
self.k = self.j + length | [
"def",
"setto",
"(",
"self",
",",
"s",
")",
":",
"length",
"=",
"len",
"(",
"s",
")",
"self",
".",
"b",
"=",
"self",
".",
"b",
"[",
":",
"self",
".",
"j",
"+",
"1",
"]",
"+",
"s",
"+",
"self",
".",
"b",
"[",
"self",
".",
"j",
"+",
"leng... | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/stem/porter.py#L270-L274 | ||
PyCQA/pylint | 3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb | pylint/checkers/utils.py | python | find_except_wrapper_node_in_scope | (
node: nodes.NodeNG,
) | return None | Return the ExceptHandler in which the node is, without going out of scope. | Return the ExceptHandler in which the node is, without going out of scope. | [
"Return",
"the",
"ExceptHandler",
"in",
"which",
"the",
"node",
"is",
"without",
"going",
"out",
"of",
"scope",
"."
] | def find_except_wrapper_node_in_scope(
node: nodes.NodeNG,
) -> Optional[Union[nodes.ExceptHandler, nodes.TryExcept]]:
"""Return the ExceptHandler in which the node is, without going out of scope."""
for current in node.node_ancestors():
if isinstance(current, astroid.scoped_nodes.LocalsDictNodeNG):... | [
"def",
"find_except_wrapper_node_in_scope",
"(",
"node",
":",
"nodes",
".",
"NodeNG",
",",
")",
"->",
"Optional",
"[",
"Union",
"[",
"nodes",
".",
"ExceptHandler",
",",
"nodes",
".",
"TryExcept",
"]",
"]",
":",
"for",
"current",
"in",
"node",
".",
"node_an... | https://github.com/PyCQA/pylint/blob/3fc855f9d0fa8e6410be5a23cf954ffd5471b4eb/pylint/checkers/utils.py#L977-L990 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/tkinter/__init__.py | python | Text.__init__ | (self, master=None, cnf={}, **kw) | Construct a text widget with the parent MASTER.
STANDARD OPTIONS
background, borderwidth, cursor,
exportselection, font, foreground,
highlightbackground, highlightcolor,
highlightthickness, insertbackground,
insertborderwidth, insertofftime,
... | Construct a text widget with the parent MASTER. | [
"Construct",
"a",
"text",
"widget",
"with",
"the",
"parent",
"MASTER",
"."
] | def __init__(self, master=None, cnf={}, **kw):
"""Construct a text widget with the parent MASTER.
STANDARD OPTIONS
background, borderwidth, cursor,
exportselection, font, foreground,
highlightbackground, highlightcolor,
highlightthickness, insertbackgrou... | [
"def",
"__init__",
"(",
"self",
",",
"master",
"=",
"None",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"Widget",
".",
"__init__",
"(",
"self",
",",
"master",
",",
"'text'",
",",
"cnf",
",",
"kw",
")"
] | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/tkinter/__init__.py#L2908-L2931 | ||
nanoporetech/tombo | afdb4d87249806d3a171d009f948f5b8558d35a0 | tombo/tombo_helper.py | python | parse_locs_file | (locs_fn) | return dict((cs, np.array(sorted(cs_poss)))
for cs, cs_poss in raw_locs.items()) | Parse BED files containing genomic locations (assumes single base
locations, so end coordinate is ignored). | Parse BED files containing genomic locations (assumes single base
locations, so end coordinate is ignored). | [
"Parse",
"BED",
"files",
"containing",
"genomic",
"locations",
"(",
"assumes",
"single",
"base",
"locations",
"so",
"end",
"coordinate",
"is",
"ignored",
")",
"."
] | def parse_locs_file(locs_fn):
"""Parse BED files containing genomic locations (assumes single base
locations, so end coordinate is ignored).
"""
n_added, n_failed = 0, 0
raw_locs = defaultdict(set)
with open(locs_fn) as locs_fp:
for line in locs_fp:
try:
chrm,... | [
"def",
"parse_locs_file",
"(",
"locs_fn",
")",
":",
"n_added",
",",
"n_failed",
"=",
"0",
",",
"0",
"raw_locs",
"=",
"defaultdict",
"(",
"set",
")",
"with",
"open",
"(",
"locs_fn",
")",
"as",
"locs_fp",
":",
"for",
"line",
"in",
"locs_fp",
":",
"try",
... | https://github.com/nanoporetech/tombo/blob/afdb4d87249806d3a171d009f948f5b8558d35a0/tombo/tombo_helper.py#L475-L506 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.5/django/contrib/formtools/wizard/views.py | python | WizardView.get_step_index | (self, step=None) | return self.get_form_list().keyOrder.index(step) | Returns the index for the given `step` name. If no step is given,
the current step will be used to get the index. | Returns the index for the given `step` name. If no step is given,
the current step will be used to get the index. | [
"Returns",
"the",
"index",
"for",
"the",
"given",
"step",
"name",
".",
"If",
"no",
"step",
"is",
"given",
"the",
"current",
"step",
"will",
"be",
"used",
"to",
"get",
"the",
"index",
"."
] | def get_step_index(self, step=None):
"""
Returns the index for the given `step` name. If no step is given,
the current step will be used to get the index.
"""
if step is None:
step = self.steps.current
return self.get_form_list().keyOrder.index(step) | [
"def",
"get_step_index",
"(",
"self",
",",
"step",
"=",
"None",
")",
":",
"if",
"step",
"is",
"None",
":",
"step",
"=",
"self",
".",
"steps",
".",
"current",
"return",
"self",
".",
"get_form_list",
"(",
")",
".",
"keyOrder",
".",
"index",
"(",
"step"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.5/django/contrib/formtools/wizard/views.py#L502-L509 | |
mozilla/mozillians | bd5da47fef01e4e09d3bb8cb0799735bdfbeb3f9 | mozillians/common/templatetags/helpers.py | python | field_with_attrs | (bfield, **kwargs) | return bfield | Allows templates to dynamically add html attributes to bound
fields from django forms.
Copied from bedrock. | Allows templates to dynamically add html attributes to bound
fields from django forms. | [
"Allows",
"templates",
"to",
"dynamically",
"add",
"html",
"attributes",
"to",
"bound",
"fields",
"from",
"django",
"forms",
"."
] | def field_with_attrs(bfield, **kwargs):
"""Allows templates to dynamically add html attributes to bound
fields from django forms.
Copied from bedrock.
"""
if kwargs.get('label', None):
bfield.label = kwargs['label']
bfield.field.widget.attrs.update(kwargs)
return bfield | [
"def",
"field_with_attrs",
"(",
"bfield",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"kwargs",
".",
"get",
"(",
"'label'",
",",
"None",
")",
":",
"bfield",
".",
"label",
"=",
"kwargs",
"[",
"'label'",
"]",
"bfield",
".",
"field",
".",
"widget",
".",
... | https://github.com/mozilla/mozillians/blob/bd5da47fef01e4e09d3bb8cb0799735bdfbeb3f9/mozillians/common/templatetags/helpers.py#L73-L82 | |
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/path/shapes.py | python | gear | (
count: int,
top_width: float,
bottom_width: float,
height: float,
outside_radius: float,
transform: Matrix44 = None,
) | return converter.from_vertices(vertices, close=True) | Returns a `gear <https://en.wikipedia.org/wiki/Gear>`_ (cogwheel) shape as
a :class:`Path` object, with the center at (0, 0, 0).
The base geometry is created by function :func:`ezdxf.render.forms.gear`.
.. warning::
This function does not create correct gears for mechanical engineering!
Args:... | Returns a `gear <https://en.wikipedia.org/wiki/Gear>`_ (cogwheel) shape as
a :class:`Path` object, with the center at (0, 0, 0).
The base geometry is created by function :func:`ezdxf.render.forms.gear`. | [
"Returns",
"a",
"gear",
"<https",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Gear",
">",
"_",
"(",
"cogwheel",
")",
"shape",
"as",
"a",
":",
"class",
":",
"Path",
"object",
"with",
"the",
"center",
"at",
"(",
"0",
"0",
"0",... | def gear(
count: int,
top_width: float,
bottom_width: float,
height: float,
outside_radius: float,
transform: Matrix44 = None,
) -> Path:
"""
Returns a `gear <https://en.wikipedia.org/wiki/Gear>`_ (cogwheel) shape as
a :class:`Path` object, with the center at (0, 0, 0).
The base ... | [
"def",
"gear",
"(",
"count",
":",
"int",
",",
"top_width",
":",
"float",
",",
"bottom_width",
":",
"float",
",",
"height",
":",
"float",
",",
"outside_radius",
":",
"float",
",",
"transform",
":",
"Matrix44",
"=",
"None",
",",
")",
"->",
"Path",
":",
... | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/path/shapes.py#L206-L237 | |
ReactionMechanismGenerator/RMG-Py | 2b7baf51febf27157def58fb3f6cee03fb6a684c | arkane/ess/adapter.py | python | ESSAdapter.load_geometry | (self) | Return the optimum geometry of the molecular configuration.
If multiple such geometries are identified, only the last is returned. | Return the optimum geometry of the molecular configuration.
If multiple such geometries are identified, only the last is returned. | [
"Return",
"the",
"optimum",
"geometry",
"of",
"the",
"molecular",
"configuration",
".",
"If",
"multiple",
"such",
"geometries",
"are",
"identified",
"only",
"the",
"last",
"is",
"returned",
"."
] | def load_geometry(self):
"""
Return the optimum geometry of the molecular configuration.
If multiple such geometries are identified, only the last is returned.
"""
pass | [
"def",
"load_geometry",
"(",
"self",
")",
":",
"pass"
] | https://github.com/ReactionMechanismGenerator/RMG-Py/blob/2b7baf51febf27157def58fb3f6cee03fb6a684c/arkane/ess/adapter.py#L78-L83 | ||
nedbat/coveragepy | d004b18a1ad59ec89b89c96c03a789a55cc51693 | coverage/cmdline.py | python | unshell_list | (s) | return s.split(',') | Turn a command-line argument into a list. | Turn a command-line argument into a list. | [
"Turn",
"a",
"command",
"-",
"line",
"argument",
"into",
"a",
"list",
"."
] | def unshell_list(s):
"""Turn a command-line argument into a list."""
if not s:
return None
if env.WINDOWS:
# When running coverage.py as coverage.exe, some of the behavior
# of the shell is emulated: wildcards are expanded into a list of
# file names. So you have to single-q... | [
"def",
"unshell_list",
"(",
"s",
")",
":",
"if",
"not",
"s",
":",
"return",
"None",
"if",
"env",
".",
"WINDOWS",
":",
"# When running coverage.py as coverage.exe, some of the behavior",
"# of the shell is emulated: wildcards are expanded into a list of",
"# file names. So you ... | https://github.com/nedbat/coveragepy/blob/d004b18a1ad59ec89b89c96c03a789a55cc51693/coverage/cmdline.py#L812-L823 | |
makehumancommunity/makehuman | 8006cf2cc851624619485658bb933a4244bbfd7c | makehuman/lib/sorter.py | python | Sorter._getDecorated | (keyFn, objects) | return [
(keyFn(object), i, object)
for i, object in enumerate(objects)] | Static method that decorates the objects of a list
to tuples containing an orderable key generated
by applying keyFn on the objects, an index,
and the object.
:param keyFn: Ordering method (function that takes
an object as parameter and returns a corresponding
or... | Static method that decorates the objects of a list
to tuples containing an orderable key generated
by applying keyFn on the objects, an index,
and the object. | [
"Static",
"method",
"that",
"decorates",
"the",
"objects",
"of",
"a",
"list",
"to",
"tuples",
"containing",
"an",
"orderable",
"key",
"generated",
"by",
"applying",
"keyFn",
"on",
"the",
"objects",
"an",
"index",
"and",
"the",
"object",
"."
] | def _getDecorated(keyFn, objects):
"""
Static method that decorates the objects of a list
to tuples containing an orderable key generated
by applying keyFn on the objects, an index,
and the object.
:param keyFn: Ordering method (function that takes
an object ... | [
"def",
"_getDecorated",
"(",
"keyFn",
",",
"objects",
")",
":",
"return",
"[",
"(",
"keyFn",
"(",
"object",
")",
",",
"i",
",",
"object",
")",
"for",
"i",
",",
"object",
"in",
"enumerate",
"(",
"objects",
")",
"]"
] | https://github.com/makehumancommunity/makehuman/blob/8006cf2cc851624619485658bb933a4244bbfd7c/makehuman/lib/sorter.py#L219-L241 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/bdf/cards/axisymmetric/axisymmetric.py | python | RINGFL.__init__ | (self, ringfl: int, xa: float, xb: float,
comment: str='') | Creates the RINGFL card | Creates the RINGFL card | [
"Creates",
"the",
"RINGFL",
"card"
] | def __init__(self, ringfl: int, xa: float, xb: float,
comment: str='') -> None: # this card has missing fields
"""
Creates the RINGFL card
"""
#Ring.__init__(self)
if comment:
self.comment = comment
self.ringfl = ringfl
self.xa = xa
... | [
"def",
"__init__",
"(",
"self",
",",
"ringfl",
":",
"int",
",",
"xa",
":",
"float",
",",
"xb",
":",
"float",
",",
"comment",
":",
"str",
"=",
"''",
")",
"->",
"None",
":",
"# this card has missing fields",
"#Ring.__init__(self)",
"if",
"comment",
":",
"s... | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/cards/axisymmetric/axisymmetric.py#L244-L255 | ||
mozman/ezdxf | 59d0fc2ea63f5cf82293428f5931da7e9f9718e9 | src/ezdxf/entities/image.py | python | ImageBase.export_entity | (self, tagwriter: "TagWriter") | Export entity specific data as DXF tags. | Export entity specific data as DXF tags. | [
"Export",
"entity",
"specific",
"data",
"as",
"DXF",
"tags",
"."
] | def export_entity(self, tagwriter: "TagWriter") -> None:
"""Export entity specific data as DXF tags."""
super().export_entity(tagwriter)
tagwriter.write_tag2(SUBCLASS_MARKER, self._SUBCLASS_NAME)
self.dxf.count_boundary_points = len(self.boundary_path)
self.dxf.export_dxf_attribs... | [
"def",
"export_entity",
"(",
"self",
",",
"tagwriter",
":",
"\"TagWriter\"",
")",
"->",
"None",
":",
"super",
"(",
")",
".",
"export_entity",
"(",
"tagwriter",
")",
"tagwriter",
".",
"write_tag2",
"(",
"SUBCLASS_MARKER",
",",
"self",
".",
"_SUBCLASS_NAME",
"... | https://github.com/mozman/ezdxf/blob/59d0fc2ea63f5cf82293428f5931da7e9f9718e9/src/ezdxf/entities/image.py#L98-L124 | ||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/data/options/list_option.py | python | ListOption._get_str | (self, value) | [] | def _get_str(self, value):
if isinstance(value, list):
return ','.join([str(i) for i in value]) | [
"def",
"_get_str",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"return",
"','",
".",
"join",
"(",
"[",
"str",
"(",
"i",
")",
"for",
"i",
"in",
"value",
"]",
")"
] | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/data/options/list_option.py#L42-L44 | ||||
idanr1986/cuckoo-droid | 1350274639473d3d2b0ac740cae133ca53ab7444 | analyzer/android_on_linux/lib/api/androguard/dvm.py | python | FieldIdItem.get_class_idx | (self) | return self.class_idx | Return the index into the type_ids list for the definer of this field
:rtype: int | Return the index into the type_ids list for the definer of this field | [
"Return",
"the",
"index",
"into",
"the",
"type_ids",
"list",
"for",
"the",
"definer",
"of",
"this",
"field"
] | def get_class_idx(self) :
"""
Return the index into the type_ids list for the definer of this field
:rtype: int
"""
return self.class_idx | [
"def",
"get_class_idx",
"(",
"self",
")",
":",
"return",
"self",
".",
"class_idx"
] | https://github.com/idanr1986/cuckoo-droid/blob/1350274639473d3d2b0ac740cae133ca53ab7444/analyzer/android_on_linux/lib/api/androguard/dvm.py#L2131-L2137 | |
grow/grow | 97fc21730b6a674d5d33948d94968e79447ce433 | grow/deployments/destinations/git_destination.py | python | GitDestination.read_file | (self, path) | return self.storage.read(path) | [] | def read_file(self, path):
path = os.path.join(self.repo_path, self.config.root_dir.lstrip('/'),
path.lstrip('/'))
return self.storage.read(path) | [
"def",
"read_file",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"repo_path",
",",
"self",
".",
"config",
".",
"root_dir",
".",
"lstrip",
"(",
"'/'",
")",
",",
"path",
".",
"lstrip",
"(",
"'/'... | https://github.com/grow/grow/blob/97fc21730b6a674d5d33948d94968e79447ce433/grow/deployments/destinations/git_destination.py#L125-L128 | |||
smicallef/spiderfoot | fd4bf9394c9ab3ecc90adc3115c56349fb23165b | modules/sfp_countryname.py | python | sfp_countryname.detectCountryFromPhone | (self, srcPhoneNumber) | return self.sf.countryNameFromCountryCode(countryCode.upper()) | Lookup name of country from phone number region code.
Args:
srcPhoneNumber (str): phone number
Returns:
str: country name | Lookup name of country from phone number region code. | [
"Lookup",
"name",
"of",
"country",
"from",
"phone",
"number",
"region",
"code",
"."
] | def detectCountryFromPhone(self, srcPhoneNumber):
"""Lookup name of country from phone number region code.
Args:
srcPhoneNumber (str): phone number
Returns:
str: country name
"""
if not isinstance(srcPhoneNumber, str):
return None
t... | [
"def",
"detectCountryFromPhone",
"(",
"self",
",",
"srcPhoneNumber",
")",
":",
"if",
"not",
"isinstance",
"(",
"srcPhoneNumber",
",",
"str",
")",
":",
"return",
"None",
"try",
":",
"phoneNumber",
"=",
"phonenumbers",
".",
"parse",
"(",
"srcPhoneNumber",
")",
... | https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/modules/sfp_countryname.py#L58-L86 | |
openstack/sahara | c4f4d29847d5bcca83d49ef7e9a3378458462a79 | sahara/utils/proxy.py | python | create_proxy_user_for_job_execution | (job_execution) | Creates a proxy user and adds the credentials to the job execution
:param job_execution: The job execution model to update | Creates a proxy user and adds the credentials to the job execution | [
"Creates",
"a",
"proxy",
"user",
"and",
"adds",
"the",
"credentials",
"to",
"the",
"job",
"execution"
] | def create_proxy_user_for_job_execution(job_execution):
'''Creates a proxy user and adds the credentials to the job execution
:param job_execution: The job execution model to update
'''
username = 'job_{0}'.format(job_execution.id)
password = key_manager.store_secret(proxy_user_create(username))
... | [
"def",
"create_proxy_user_for_job_execution",
"(",
"job_execution",
")",
":",
"username",
"=",
"'job_{0}'",
".",
"format",
"(",
"job_execution",
".",
"id",
")",
"password",
"=",
"key_manager",
".",
"store_secret",
"(",
"proxy_user_create",
"(",
"username",
")",
")... | https://github.com/openstack/sahara/blob/c4f4d29847d5bcca83d49ef7e9a3378458462a79/sahara/utils/proxy.py#L57-L76 | ||
bakwc/PySyncObj | 012aeb1b34be7b98f3b5c33e735836a9fc0c4cba | pysyncobj/utility.py | python | Utility.executeCommand | (self, node, command) | Executes command on the given node.
:param node: where to execute the command
:type node: Node or str
:param command: the command which should be sent
:type command: list
:returns: result
:rtype: any object
:raises: UtilityException in case of error | Executes command on the given node. | [
"Executes",
"command",
"on",
"the",
"given",
"node",
"."
] | def executeCommand(self, node, command):
"""
Executes command on the given node.
:param node: where to execute the command
:type node: Node or str
:param command: the command which should be sent
:type command: list
:returns: result
:rtype: any object
... | [
"def",
"executeCommand",
"(",
"self",
",",
"node",
",",
"command",
")",
":"
] | https://github.com/bakwc/PySyncObj/blob/012aeb1b34be7b98f3b5c33e735836a9fc0c4cba/pysyncobj/utility.py#L26-L37 | ||
geopython/pycsw | 43a5c92fa819a3a3fdc8a8e3ef075d784dff73fc | pycsw/server.py | python | Csw.sru | (self) | return self.sruobj | enable SRU | enable SRU | [
"enable",
"SRU"
] | def sru(self):
""" enable SRU """
if not self.sruobj:
self.sruobj = sru.Sru(self.context)
return self.sruobj | [
"def",
"sru",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"sruobj",
":",
"self",
".",
"sruobj",
"=",
"sru",
".",
"Sru",
"(",
"self",
".",
"context",
")",
"return",
"self",
".",
"sruobj"
] | https://github.com/geopython/pycsw/blob/43a5c92fa819a3a3fdc8a8e3ef075d784dff73fc/pycsw/server.py#L274-L279 | |
cylc/cylc-flow | 5ec221143476c7c616c156b74158edfbcd83794a | cylc/flow/task_message.py | python | send_messages | (workflow, task_job, messages, event_time) | [] | def send_messages(workflow, task_job, messages, event_time):
workflow = os.path.normpath(workflow)
try:
pclient = get_client(workflow)
except WorkflowStopped:
# on a remote host this means the contact file is not present
# either the workflow is stopped or the contact file is not pre... | [
"def",
"send_messages",
"(",
"workflow",
",",
"task_job",
",",
"messages",
",",
"event_time",
")",
":",
"workflow",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"workflow",
")",
"try",
":",
"pclient",
"=",
"get_client",
"(",
"workflow",
")",
"except",
"... | https://github.com/cylc/cylc-flow/blob/5ec221143476c7c616c156b74158edfbcd83794a/cylc/flow/task_message.py#L104-L129 | ||||
Kismuz/btgym | 7fb3316e67f1d7a17c620630fb62fb29428b2cec | btgym/research/model_based/runner.py | python | OUpRunner.__init__ | (self, name='OUp_synchro', **kwargs) | [] | def __init__(self, name='OUp_synchro', **kwargs):
super(OUpRunner, self).__init__(name=name, **kwargs)
# True data_generating_process params:
self.dgp_params = {key: [] for key in self.env.observation_space.shape['metadata']['generator'].keys()}
self.dgp_dict = {key: 0 for key in self.e... | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"'OUp_synchro'",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"OUpRunner",
",",
"self",
")",
".",
"__init__",
"(",
"name",
"=",
"name",
",",
"*",
"*",
"kwargs",
")",
"# True data_generating_process pa... | https://github.com/Kismuz/btgym/blob/7fb3316e67f1d7a17c620630fb62fb29428b2cec/btgym/research/model_based/runner.py#L10-L18 | ||||
team-ocean/veros | f62d6a2fe459a807fa6f3799c8aaa0a5fb70560f | veros/core/thermodynamics.py | python | surf_densityf | (state) | return KernelOutput(forc_rho_surface=vs.forc_rho_surface) | surface density flux | surface density flux | [
"surface",
"density",
"flux"
] | def surf_densityf(state):
"""
surface density flux
"""
vs = state.variables
vs.forc_rho_surface = vs.maskT[:, :, -1] * (
density.get_drhodT(state, vs.salt[:, :, -1, vs.taup1], vs.temp[:, :, -1, vs.taup1], npx.abs(vs.zt[-1]))
* vs.forc_temp_surface
+ density.get_drhodS(state,... | [
"def",
"surf_densityf",
"(",
"state",
")",
":",
"vs",
"=",
"state",
".",
"variables",
"vs",
".",
"forc_rho_surface",
"=",
"vs",
".",
"maskT",
"[",
":",
",",
":",
",",
"-",
"1",
"]",
"*",
"(",
"density",
".",
"get_drhodT",
"(",
"state",
",",
"vs",
... | https://github.com/team-ocean/veros/blob/f62d6a2fe459a807fa6f3799c8aaa0a5fb70560f/veros/core/thermodynamics.py#L304-L317 | |
TUDelft-CNS-ATM/bluesky | 55a538a3cd936f33cff9df650c38924aa97557b1 | bluesky/traffic/traffic.py | python | Traffic.airwaycmd | (self, key) | return False, f"No airway legs found for {key}" | Show conections of a waypoint or airway. | Show conections of a waypoint or airway. | [
"Show",
"conections",
"of",
"a",
"waypoint",
"or",
"airway",
"."
] | def airwaycmd(self, key):
''' Show conections of a waypoint or airway. '''
reflat, reflon = bs.scr.getviewctr()
if bs.navdb.awid.count(key) > 0:
return self.poscommand(key)
# Find connecting airway legs
wpid = key
iwp = bs.navdb.getwpidx(wpid,reflat,reflon)
... | [
"def",
"airwaycmd",
"(",
"self",
",",
"key",
")",
":",
"reflat",
",",
"reflon",
"=",
"bs",
".",
"scr",
".",
"getviewctr",
"(",
")",
"if",
"bs",
".",
"navdb",
".",
"awid",
".",
"count",
"(",
"key",
")",
">",
"0",
":",
"return",
"self",
".",
"pos... | https://github.com/TUDelft-CNS-ATM/bluesky/blob/55a538a3cd936f33cff9df650c38924aa97557b1/bluesky/traffic/traffic.py#L731-L754 | |
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/filepost.py | python | choose_boundary | () | return uuid4().hex | Our embarassingly-simple replacement for mimetools.choose_boundary. | Our embarassingly-simple replacement for mimetools.choose_boundary. | [
"Our",
"embarassingly",
"-",
"simple",
"replacement",
"for",
"mimetools",
".",
"choose_boundary",
"."
] | def choose_boundary():
"""
Our embarassingly-simple replacement for mimetools.choose_boundary.
"""
return uuid4().hex | [
"def",
"choose_boundary",
"(",
")",
":",
"return",
"uuid4",
"(",
")",
".",
"hex"
] | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/esp8266_clients/venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/filepost.py#L13-L17 | |
chaitjo/personalized-dialog | 4f94e3dc1376e4e6aa1e5be3ec08b9f56871c98e | MemN2N/memn2n/memn2n_dialog.py | python | add_gradient_noise | (t, stddev=1e-3, name=None) | Adds gradient noise as described in http://arxiv.org/abs/1511.06807 [2].
The input Tensor `t` should be a gradient.
The output will be `t` + gaussian noise.
0.001 was said to be a good fixed value for memory networks [2]. | Adds gradient noise as described in http://arxiv.org/abs/1511.06807 [2]. | [
"Adds",
"gradient",
"noise",
"as",
"described",
"in",
"http",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1511",
".",
"06807",
"[",
"2",
"]",
"."
] | def add_gradient_noise(t, stddev=1e-3, name=None):
"""Adds gradient noise as described in http://arxiv.org/abs/1511.06807 [2].
The input Tensor `t` should be a gradient.
The output will be `t` + gaussian noise.
0.001 was said to be a good fixed value for memory networks [2].
"""
with tf.name_... | [
"def",
"add_gradient_noise",
"(",
"t",
",",
"stddev",
"=",
"1e-3",
",",
"name",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"name",
",",
"\"add_gradient_noise\"",
",",
"[",
"t",
",",
"stddev",
"]",
")",
"as",
"name",
":",
"t",
"=",
... | https://github.com/chaitjo/personalized-dialog/blob/4f94e3dc1376e4e6aa1e5be3ec08b9f56871c98e/MemN2N/memn2n/memn2n_dialog.py#L232-L244 | ||
deepmind/mathematics_dataset | 900a0813b1997f45a4d0a8e448a652f37e4b5685 | mathematics_dataset/sample/polynomials.py | python | _sample_with_brackets | (depth, variables, degrees, entropy, length,
force_brackets=True) | Internal recursive function for: constructs a polynomial with brackets. | Internal recursive function for: constructs a polynomial with brackets. | [
"Internal",
"recursive",
"function",
"for",
":",
"constructs",
"a",
"polynomial",
"with",
"brackets",
"."
] | def _sample_with_brackets(depth, variables, degrees, entropy, length,
force_brackets=True):
"""Internal recursive function for: constructs a polynomial with brackets."""
# To generate arbitrary polynomial recursively, can do one of:
# * add two polynomials, with at least one having bra... | [
"def",
"_sample_with_brackets",
"(",
"depth",
",",
"variables",
",",
"degrees",
",",
"entropy",
",",
"length",
",",
"force_brackets",
"=",
"True",
")",
":",
"# To generate arbitrary polynomial recursively, can do one of:",
"# * add two polynomials, with at least one having br... | https://github.com/deepmind/mathematics_dataset/blob/900a0813b1997f45a4d0a8e448a652f37e4b5685/mathematics_dataset/sample/polynomials.py#L399-L456 | ||
OctoPrint/OctoPrint | 4b12b0e6f06c3abfb31b1840a0605e2de8e911d2 | src/octoprint/plugin/types.py | python | TemplatePlugin.get_template_configs | (self) | return [] | Allows configuration of injected navbar, sidebar, tab and settings templates (and also additional templates of
types specified by plugins through the :ref:`octoprint.ui.web.templatetypes <sec-plugins-hook-ui-web-templatetypes>` hook).
Should be a list containing one configuration object per template to ... | Allows configuration of injected navbar, sidebar, tab and settings templates (and also additional templates of
types specified by plugins through the :ref:`octoprint.ui.web.templatetypes <sec-plugins-hook-ui-web-templatetypes>` hook).
Should be a list containing one configuration object per template to ... | [
"Allows",
"configuration",
"of",
"injected",
"navbar",
"sidebar",
"tab",
"and",
"settings",
"templates",
"(",
"and",
"also",
"additional",
"templates",
"of",
"types",
"specified",
"by",
"plugins",
"through",
"the",
":",
"ref",
":",
"octoprint",
".",
"ui",
".",... | def get_template_configs(self):
"""
Allows configuration of injected navbar, sidebar, tab and settings templates (and also additional templates of
types specified by plugins through the :ref:`octoprint.ui.web.templatetypes <sec-plugins-hook-ui-web-templatetypes>` hook).
Should be a list ... | [
"def",
"get_template_configs",
"(",
"self",
")",
":",
"return",
"[",
"]"
] | https://github.com/OctoPrint/OctoPrint/blob/4b12b0e6f06c3abfb31b1840a0605e2de8e911d2/src/octoprint/plugin/types.py#L395-L563 | |
cbfinn/maml_rl | 9c8e2ebd741cb0c7b8bf2d040c4caeeb8e06cc95 | rllab/algos/cma_es_lib.py | python | CMAEvolutionStrategy.get_selective_mirrors | (self, number=None, pop_sorted=None) | return res | get mirror genotypic directions of the `number` worst
solution, based on ``pop_sorted`` attribute (from last
iteration).
Details:
Takes the last ``number=sp.lam_mirr`` entries in
``pop_sorted=self.pop_sorted`` as solutions to be mirrored. | get mirror genotypic directions of the `number` worst
solution, based on ``pop_sorted`` attribute (from last
iteration). | [
"get",
"mirror",
"genotypic",
"directions",
"of",
"the",
"number",
"worst",
"solution",
"based",
"on",
"pop_sorted",
"attribute",
"(",
"from",
"last",
"iteration",
")",
"."
] | def get_selective_mirrors(self, number=None, pop_sorted=None):
"""get mirror genotypic directions of the `number` worst
solution, based on ``pop_sorted`` attribute (from last
iteration).
Details:
Takes the last ``number=sp.lam_mirr`` entries in
``pop_sorted=self.pop_sort... | [
"def",
"get_selective_mirrors",
"(",
"self",
",",
"number",
"=",
"None",
",",
"pop_sorted",
"=",
"None",
")",
":",
"if",
"pop_sorted",
"is",
"None",
":",
"if",
"hasattr",
"(",
"self",
",",
"'pop_sorted'",
")",
":",
"pop_sorted",
"=",
"self",
".",
"pop_so... | https://github.com/cbfinn/maml_rl/blob/9c8e2ebd741cb0c7b8bf2d040c4caeeb8e06cc95/rllab/algos/cma_es_lib.py#L3530-L3550 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/vesync/switch.py | python | VeSyncLightSwitch.__init__ | (self, switch) | Initialize Light Switch device class. | Initialize Light Switch device class. | [
"Initialize",
"Light",
"Switch",
"device",
"class",
"."
] | def __init__(self, switch):
"""Initialize Light Switch device class."""
super().__init__(switch)
self.switch = switch | [
"def",
"__init__",
"(",
"self",
",",
"switch",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"switch",
")",
"self",
".",
"switch",
"=",
"switch"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/vesync/switch.py#L100-L103 | ||
rhinstaller/anaconda | 63edc8680f1b05cbfe11bef28703acba808c5174 | pyanaconda/core/configuration/storage_constraints.py | python | StorageConstraints.must_be_on_linuxfs | (self) | return set(self._get_option("must_be_on_linuxfs").split()) | Mount points that must be on a linux file system.
:return: a set of mount points | Mount points that must be on a linux file system. | [
"Mount",
"points",
"that",
"must",
"be",
"on",
"a",
"linux",
"file",
"system",
"."
] | def must_be_on_linuxfs(self):
"""Mount points that must be on a linux file system.
:return: a set of mount points
"""
return set(self._get_option("must_be_on_linuxfs").split()) | [
"def",
"must_be_on_linuxfs",
"(",
"self",
")",
":",
"return",
"set",
"(",
"self",
".",
"_get_option",
"(",
"\"must_be_on_linuxfs\"",
")",
".",
"split",
"(",
")",
")"
] | https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/core/configuration/storage_constraints.py#L115-L120 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pandas/indexes/base.py | python | Index._assert_take_fillable | (self, values, indices, allow_fill=True,
fill_value=None, na_value=np.nan) | return taken | Internal method to handle NA filling of take | Internal method to handle NA filling of take | [
"Internal",
"method",
"to",
"handle",
"NA",
"filling",
"of",
"take"
] | def _assert_take_fillable(self, values, indices, allow_fill=True,
fill_value=None, na_value=np.nan):
""" Internal method to handle NA filling of take """
indices = _ensure_platform_int(indices)
# only fill if we are passing a non-None fill_value
if allow_fi... | [
"def",
"_assert_take_fillable",
"(",
"self",
",",
"values",
",",
"indices",
",",
"allow_fill",
"=",
"True",
",",
"fill_value",
"=",
"None",
",",
"na_value",
"=",
"np",
".",
"nan",
")",
":",
"indices",
"=",
"_ensure_platform_int",
"(",
"indices",
")",
"# on... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pandas/indexes/base.py#L1523-L1540 | |
SeldonIO/alibi | ce961caf995d22648a8338857822c90428af4765 | alibi/confidence/model_linearity.py | python | LinearityMeasure.score | (self, predict_fn: Callable, x: np.ndarray) | return lin | Parameters
----------
predict_fn
Prediction function
x
Instance of interest
Returns
-------
Linearity measure | [] | def score(self, predict_fn: Callable, x: np.ndarray) -> np.ndarray:
"""
Parameters
----------
predict_fn
Prediction function
x
Instance of interest
Returns
-------
Linearity measure
"""
input_shape = x.shape[1:]
... | [
"def",
"score",
"(",
"self",
",",
"predict_fn",
":",
"Callable",
",",
"x",
":",
"np",
".",
"ndarray",
")",
"->",
"np",
".",
"ndarray",
":",
"input_shape",
"=",
"x",
".",
"shape",
"[",
"1",
":",
"]",
"if",
"self",
".",
"is_fit",
":",
"assert",
"in... | https://github.com/SeldonIO/alibi/blob/ce961caf995d22648a8338857822c90428af4765/alibi/confidence/model_linearity.py#L409-L444 | ||
pretix/pretix | 96f694cf61345f54132cd26cdeb07d5d11b34232 | src/pretix/presale/views/customer.py | python | LoginView.form_valid | (self, form) | return HttpResponseRedirect(self.get_success_url()) | Security check complete. Log the user in. | Security check complete. Log the user in. | [
"Security",
"check",
"complete",
".",
"Log",
"the",
"user",
"in",
"."
] | def form_valid(self, form):
"""Security check complete. Log the user in."""
customer_login(self.request, form.get_customer())
return HttpResponseRedirect(self.get_success_url()) | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"customer_login",
"(",
"self",
".",
"request",
",",
"form",
".",
"get_customer",
"(",
")",
")",
"return",
"HttpResponseRedirect",
"(",
"self",
".",
"get_success_url",
"(",
")",
")"
] | https://github.com/pretix/pretix/blob/96f694cf61345f54132cd26cdeb07d5d11b34232/src/pretix/presale/views/customer.py#L129-L132 | |
sebastien/cuisine | f6f70268ef1361db66815383017f7c8969002154 | src/cuisine.py | python | group_create_linux | (name, gid=None) | Creates a group with the given name, and optionally given gid. | Creates a group with the given name, and optionally given gid. | [
"Creates",
"a",
"group",
"with",
"the",
"given",
"name",
"and",
"optionally",
"given",
"gid",
"."
] | def group_create_linux(name, gid=None):
"""Creates a group with the given name, and optionally given gid."""
options = []
if gid:
options.append("-g '%s'" % (gid))
sudo("groupadd %s '%s'" % (" ".join(options), name)) | [
"def",
"group_create_linux",
"(",
"name",
",",
"gid",
"=",
"None",
")",
":",
"options",
"=",
"[",
"]",
"if",
"gid",
":",
"options",
".",
"append",
"(",
"\"-g '%s'\"",
"%",
"(",
"gid",
")",
")",
"sudo",
"(",
"\"groupadd %s '%s'\"",
"%",
"(",
"\" \"",
... | https://github.com/sebastien/cuisine/blob/f6f70268ef1361db66815383017f7c8969002154/src/cuisine.py#L1846-L1851 | ||
osmr/imgclsmob | f2993d3ce73a2f7ddba05da3891defb08547d504 | pytorch/pytorchcv/models/wrn.py | python | wrn_conv1x1 | (in_channels,
out_channels,
stride,
activate) | return WRNConv(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=1,
stride=stride,
padding=0,
activate=activate) | 1x1 version of the WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
stride : int or tuple/list of 2 int
Strides of the convolution.
activate : bool
Whether activate th... | 1x1 version of the WRN specific convolution block. | [
"1x1",
"version",
"of",
"the",
"WRN",
"specific",
"convolution",
"block",
"."
] | def wrn_conv1x1(in_channels,
out_channels,
stride,
activate):
"""
1x1 version of the WRN specific convolution block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
... | [
"def",
"wrn_conv1x1",
"(",
"in_channels",
",",
"out_channels",
",",
"stride",
",",
"activate",
")",
":",
"return",
"WRNConv",
"(",
"in_channels",
"=",
"in_channels",
",",
"out_channels",
"=",
"out_channels",
",",
"kernel_size",
"=",
"1",
",",
"stride",
"=",
... | https://github.com/osmr/imgclsmob/blob/f2993d3ce73a2f7ddba05da3891defb08547d504/pytorch/pytorchcv/models/wrn.py#L59-L83 | |
ddbourgin/numpy-ml | b0359af5285fbf9699d64fd5ec059493228af03e | numpy_ml/neural_nets/utils/utils.py | python | conv1D | (X, W, stride, pad, dilation=0) | return np.squeeze(Z2D, axis=1) | A faster (but more memory intensive) implementation of a 1D "convolution"
(technically, cross-correlation) of input `X` with a collection of kernels in
`W`.
Notes
-----
Relies on the :func:`im2col` function to perform the convolution as a single
matrix multiplication.
For a helpful diagram... | A faster (but more memory intensive) implementation of a 1D "convolution"
(technically, cross-correlation) of input `X` with a collection of kernels in
`W`. | [
"A",
"faster",
"(",
"but",
"more",
"memory",
"intensive",
")",
"implementation",
"of",
"a",
"1D",
"convolution",
"(",
"technically",
"cross",
"-",
"correlation",
")",
"of",
"input",
"X",
"with",
"a",
"collection",
"of",
"kernels",
"in",
"W",
"."
] | def conv1D(X, W, stride, pad, dilation=0):
"""
A faster (but more memory intensive) implementation of a 1D "convolution"
(technically, cross-correlation) of input `X` with a collection of kernels in
`W`.
Notes
-----
Relies on the :func:`im2col` function to perform the convolution as a singl... | [
"def",
"conv1D",
"(",
"X",
",",
"W",
",",
"stride",
",",
"pad",
",",
"dilation",
"=",
"0",
")",
":",
"_",
",",
"p",
"=",
"pad1D",
"(",
"X",
",",
"pad",
",",
"W",
".",
"shape",
"[",
"0",
"]",
",",
"stride",
",",
"dilation",
"=",
"dilation",
... | https://github.com/ddbourgin/numpy-ml/blob/b0359af5285fbf9699d64fd5ec059493228af03e/numpy_ml/neural_nets/utils/utils.py#L668-L717 | |
hyperledger/aries-cloudagent-python | 2f36776e99f6053ae92eed8123b5b1b2e891c02a | aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py | python | MediationManager.remove_key | (
self, recipient_key: str, message: Optional[KeylistUpdate] = None
) | return message | Prepare keylist update remove.
Args:
recipient_key (str): key to remove
message (Optional[KeylistUpdate]): append update to message
Returns:
KeylistUpdate: Message to send to mediator to notify of key removal. | Prepare keylist update remove. | [
"Prepare",
"keylist",
"update",
"remove",
"."
] | async def remove_key(
self, recipient_key: str, message: Optional[KeylistUpdate] = None
) -> KeylistUpdate:
"""Prepare keylist update remove.
Args:
recipient_key (str): key to remove
message (Optional[KeylistUpdate]): append update to message
Returns:
... | [
"async",
"def",
"remove_key",
"(",
"self",
",",
"recipient_key",
":",
"str",
",",
"message",
":",
"Optional",
"[",
"KeylistUpdate",
"]",
"=",
"None",
")",
"->",
"KeylistUpdate",
":",
"message",
"=",
"message",
"or",
"KeylistUpdate",
"(",
")",
"message",
".... | https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/protocols/coordinate_mediation/v1_0/manager.py#L505-L522 | |
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | cherrypy/_cperror.py | python | HTTPRedirect.__call__ | (self) | Use this exception as a request.handler (raise self). | Use this exception as a request.handler (raise self). | [
"Use",
"this",
"exception",
"as",
"a",
"request",
".",
"handler",
"(",
"raise",
"self",
")",
"."
] | def __call__(self):
"""Use this exception as a request.handler (raise self)."""
raise self | [
"def",
"__call__",
"(",
"self",
")",
":",
"raise",
"self"
] | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/cherrypy/_cperror.py#L282-L284 | ||
ucsb-seclab/karonte | 427ac313e596f723e40768b95d13bd7a9fc92fd8 | eval/multi_bin/all_bins/taint_analysis/coretaint.py | python | CoreTaint.add_taint_glob_dep | (self, master, slave, path) | Add a taint dependency: if master gets untainted, slave should be untainted
:param master: master expression
:param slave: slave expression
:param path: path
:return: | Add a taint dependency: if master gets untainted, slave should be untainted
:param master: master expression
:param slave: slave expression
:param path: path
:return: | [
"Add",
"a",
"taint",
"dependency",
":",
"if",
"master",
"gets",
"untainted",
"slave",
"should",
"be",
"untainted",
":",
"param",
"master",
":",
"master",
"expression",
":",
"param",
"slave",
":",
"slave",
"expression",
":",
"param",
"path",
":",
"path",
":... | def add_taint_glob_dep(self, master, slave, path):
"""
Add a taint dependency: if master gets untainted, slave should be untainted
:param master: master expression
:param slave: slave expression
:param path: path
:return:
"""
if not self.is_tainted(master... | [
"def",
"add_taint_glob_dep",
"(",
"self",
",",
"master",
",",
"slave",
",",
"path",
")",
":",
"if",
"not",
"self",
".",
"is_tainted",
"(",
"master",
")",
":",
"return",
"leafs",
"=",
"list",
"(",
"set",
"(",
"[",
"l",
"for",
"l",
"in",
"master",
".... | https://github.com/ucsb-seclab/karonte/blob/427ac313e596f723e40768b95d13bd7a9fc92fd8/eval/multi_bin/all_bins/taint_analysis/coretaint.py#L624-L639 | ||
andyzsf/TuShare | 92787ad0cd492614bdb6389b71a19c80d1c8c9ae | tushare/datayes/subject.py | python | Subject.NewsContentByTime | (self, newsPublishDate='', beginTime='', endTime='', field='') | return _ret_data(code, result) | 获取某天某一段时间内的新闻全文等信息。输入新闻发布的日期、起止时间,获取该时间段内的新闻全文等信息,如:新闻ID、标题、摘要、正文、来源链接、初始来源、作者、发布来源、发布时间、入库时间等。(注:1、自2014/1/1起新闻来源众多、新闻量日均4万左右,2013年及之前的网站来源少、新闻数据量少;2、数据实时更新。) | 获取某天某一段时间内的新闻全文等信息。输入新闻发布的日期、起止时间,获取该时间段内的新闻全文等信息,如:新闻ID、标题、摘要、正文、来源链接、初始来源、作者、发布来源、发布时间、入库时间等。(注:1、自2014/1/1起新闻来源众多、新闻量日均4万左右,2013年及之前的网站来源少、新闻数据量少;2、数据实时更新。) | [
"获取某天某一段时间内的新闻全文等信息。输入新闻发布的日期、起止时间,获取该时间段内的新闻全文等信息,如:新闻ID、标题、摘要、正文、来源链接、初始来源、作者、发布来源、发布时间、入库时间等。",
"(",
"注:1、自2014",
"/",
"1",
"/",
"1起新闻来源众多、新闻量日均4万左右,2013年及之前的网站来源少、新闻数据量少;2、数据实时更新。",
")"
] | def NewsContentByTime(self, newsPublishDate='', beginTime='', endTime='', field=''):
"""
获取某天某一段时间内的新闻全文等信息。输入新闻发布的日期、起止时间,获取该时间段内的新闻全文等信息,如:新闻ID、标题、摘要、正文、来源链接、初始来源、作者、发布来源、发布时间、入库时间等。(注:1、自2014/1/1起新闻来源众多、新闻量日均4万左右,2013年及之前的网站来源少、新闻数据量少;2、数据实时更新。)
"""
code, result = self.client.getD... | [
"def",
"NewsContentByTime",
"(",
"self",
",",
"newsPublishDate",
"=",
"''",
",",
"beginTime",
"=",
"''",
",",
"endTime",
"=",
"''",
",",
"field",
"=",
"''",
")",
":",
"code",
",",
"result",
"=",
"self",
".",
"client",
".",
"getData",
"(",
"vs",
".",
... | https://github.com/andyzsf/TuShare/blob/92787ad0cd492614bdb6389b71a19c80d1c8c9ae/tushare/datayes/subject.py#L67-L72 | |
peplin/pygatt | 70c68684ca5a2c5cbd8c4f6f039503fe9b848d24 | pygatt/backends/bgapi/packets.py | python | BGAPICommandPacketBuilder.flash_ps_dump | () | return pack('<4B', 0, 0, 1, 1) | [] | def flash_ps_dump():
return pack('<4B', 0, 0, 1, 1) | [
"def",
"flash_ps_dump",
"(",
")",
":",
"return",
"pack",
"(",
"'<4B'",
",",
"0",
",",
"0",
",",
"1",
",",
"1",
")"
] | https://github.com/peplin/pygatt/blob/70c68684ca5a2c5cbd8c4f6f039503fe9b848d24/pygatt/backends/bgapi/packets.py#L85-L86 | |||
awslabs/gluon-ts | 066ec3b7f47aa4ee4c061a28f35db7edbad05a98 | src/gluonts/mx/trainer/callback.py | python | Callback.on_validation_batch_end | (
self, training_network: nn.HybridBlock
) | Hook that is called after each validation batch. This hook is never
called if no validation data is available during training.
Parameters
----------
training_network
The network that is being trained. | Hook that is called after each validation batch. This hook is never
called if no validation data is available during training. | [
"Hook",
"that",
"is",
"called",
"after",
"each",
"validation",
"batch",
".",
"This",
"hook",
"is",
"never",
"called",
"if",
"no",
"validation",
"data",
"is",
"available",
"during",
"training",
"."
] | def on_validation_batch_end(
self, training_network: nn.HybridBlock
) -> None:
"""
Hook that is called after each validation batch. This hook is never
called if no validation data is available during training.
Parameters
----------
training_network
... | [
"def",
"on_validation_batch_end",
"(",
"self",
",",
"training_network",
":",
"nn",
".",
"HybridBlock",
")",
"->",
"None",
":"
] | https://github.com/awslabs/gluon-ts/blob/066ec3b7f47aa4ee4c061a28f35db7edbad05a98/src/gluonts/mx/trainer/callback.py#L97-L108 | ||
barneygale/quarry | eac47471fc55598de6b4723a728a37d035002237 | quarry/types/buffer/v1_7.py | python | Buffer1_7.discard | (self) | Discards the entire buffer contents. | Discards the entire buffer contents. | [
"Discards",
"the",
"entire",
"buffer",
"contents",
"."
] | def discard(self):
"""
Discards the entire buffer contents.
"""
self.pos = len(self.buff) | [
"def",
"discard",
"(",
"self",
")",
":",
"self",
".",
"pos",
"=",
"len",
"(",
"self",
".",
"buff",
")"
] | https://github.com/barneygale/quarry/blob/eac47471fc55598de6b4723a728a37d035002237/quarry/types/buffer/v1_7.py#L57-L62 | ||
enthought/traitsui | b7c38c7a47bf6ae7971f9ddab70c8a358647dd25 | traitsui/qt4/range_editor.py | python | SimpleSliderEditor.update_object_on_scroll | (self, pos) | Handles the user changing the current slider value. | Handles the user changing the current slider value. | [
"Handles",
"the",
"user",
"changing",
"the",
"current",
"slider",
"value",
"."
] | def update_object_on_scroll(self, pos):
"""Handles the user changing the current slider value."""
value = self._convert_from_slider(pos)
self.control.text.setText(self.string_value(value))
try:
self.value = value
except Exception as exc:
from traitsui.api ... | [
"def",
"update_object_on_scroll",
"(",
"self",
",",
"pos",
")",
":",
"value",
"=",
"self",
".",
"_convert_from_slider",
"(",
"pos",
")",
"self",
".",
"control",
".",
"text",
".",
"setText",
"(",
"self",
".",
"string_value",
"(",
"value",
")",
")",
"try",... | https://github.com/enthought/traitsui/blob/b7c38c7a47bf6ae7971f9ddab70c8a358647dd25/traitsui/qt4/range_editor.py#L168-L177 | ||
oilshell/oil | 94388e7d44a9ad879b12615f6203b38596b5a2d3 | Python-2.7.13/Lib/timeit.py | python | Timer.repeat | (self, repeat=default_repeat, number=default_number) | return r | Call timeit() a few times.
This is a convenience function that calls the timeit()
repeatedly, returning a list of results. The first argument
specifies how many times to call timeit(), defaulting to 3;
the second argument specifies the timer argument, defaulting
to one million.... | Call timeit() a few times. | [
"Call",
"timeit",
"()",
"a",
"few",
"times",
"."
] | def repeat(self, repeat=default_repeat, number=default_number):
"""Call timeit() a few times.
This is a convenience function that calls the timeit()
repeatedly, returning a list of results. The first argument
specifies how many times to call timeit(), defaulting to 3;
the secon... | [
"def",
"repeat",
"(",
"self",
",",
"repeat",
"=",
"default_repeat",
",",
"number",
"=",
"default_number",
")",
":",
"r",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"repeat",
")",
":",
"t",
"=",
"self",
".",
"timeit",
"(",
"number",
")",
"r",
... | https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/timeit.py#L208-L232 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/form_processor/backends/sql/update_strategy.py | python | _convert_type_check_length | (property_name, value) | [] | def _convert_type_check_length(property_name, value):
try:
return PROPERTY_TYPE_MAPPING.get(property_name, lambda x: x)(value)
except ValueError as e:
raise CaseValueError('Error processing case update: Field: {}, Error: {}'.format(property_name, str(e))) | [
"def",
"_convert_type_check_length",
"(",
"property_name",
",",
"value",
")",
":",
"try",
":",
"return",
"PROPERTY_TYPE_MAPPING",
".",
"get",
"(",
"property_name",
",",
"lambda",
"x",
":",
"x",
")",
"(",
"value",
")",
"except",
"ValueError",
"as",
"e",
":",
... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/form_processor/backends/sql/update_strategy.py#L61-L65 | ||||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/Django-1.11.29/django/core/management/commands/inspectdb.py | python | Command.normalize_col_name | (self, col_name, used_column_names, is_relation) | return new_name, field_params, field_notes | Modify the column name to make it Python-compatible as a field name | Modify the column name to make it Python-compatible as a field name | [
"Modify",
"the",
"column",
"name",
"to",
"make",
"it",
"Python",
"-",
"compatible",
"as",
"a",
"field",
"name"
] | def normalize_col_name(self, col_name, used_column_names, is_relation):
"""
Modify the column name to make it Python-compatible as a field name
"""
field_params = {}
field_notes = []
new_name = col_name.lower()
if new_name != col_name:
field_notes.app... | [
"def",
"normalize_col_name",
"(",
"self",
",",
"col_name",
",",
"used_column_names",
",",
"is_relation",
")",
":",
"field_params",
"=",
"{",
"}",
"field_notes",
"=",
"[",
"]",
"new_name",
"=",
"col_name",
".",
"lower",
"(",
")",
"if",
"new_name",
"!=",
"co... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/Django-1.11.29/django/core/management/commands/inspectdb.py#L172-L226 | |
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | Extensions/Settings/ColorScheme/StyleEditor.py | python | StyleEditor.updateForeground | (self, color) | [] | def updateForeground(self, color):
self.currentPropertyAttrib[1] = color | [
"def",
"updateForeground",
"(",
"self",
",",
"color",
")",
":",
"self",
".",
"currentPropertyAttrib",
"[",
"1",
"]",
"=",
"color"
] | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/Extensions/Settings/ColorScheme/StyleEditor.py#L202-L203 | ||||
OpenXenManager/openxenmanager | 1cb5c1cb13358ba584856e99a94f9669d17670ff | src/OXM/window_host.py | python | oxcWindowHost.on_treeusers_cursor_changed | (self, widget, data=None) | Selected row in treeusers treeview | Selected row in treeusers treeview | [
"Selected",
"row",
"in",
"treeusers",
"treeview"
] | def on_treeusers_cursor_changed(self, widget, data=None):
"""
Selected row in treeusers treeview
"""
pass | [
"def",
"on_treeusers_cursor_changed",
"(",
"self",
",",
"widget",
",",
"data",
"=",
"None",
")",
":",
"pass"
] | https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/OXM/window_host.py#L65-L69 | ||
IOActive/jdwp-shellifier | e82ec26193861ba58179aae7f3fa93654b7abc8a | jdwp-shellifier.py | python | runtime_exec_payload | (jdwp, threadId, runtimeClassId, getRuntimeMethId, command) | return True | [] | def runtime_exec_payload(jdwp, threadId, runtimeClassId, getRuntimeMethId, command):
#
# This function will invoke command as a payload, which will be running
# with JVM privilege on host (intrusive).
#
print ("[+] Selected payload '%s'" % command)
# 1. allocating string containing our command ... | [
"def",
"runtime_exec_payload",
"(",
"jdwp",
",",
"threadId",
",",
"runtimeClassId",
",",
"getRuntimeMethId",
",",
"command",
")",
":",
"#",
"# This function will invoke command as a payload, which will be running",
"# with JVM privilege on host (intrusive).",
"#",
"print",
"(",... | https://github.com/IOActive/jdwp-shellifier/blob/e82ec26193861ba58179aae7f3fa93654b7abc8a/jdwp-shellifier.py#L558-L602 | |||
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/apps/reminders/views.py | python | KeywordsListView._fmt_keyword_data | (self, keyword) | return {
'id': keyword.couch_id,
'keyword': keyword.keyword,
'description': keyword.description,
'editUrl': reverse(
EditStructuredKeywordView.urlname,
args=[self.domain, keyword.couch_id]
) if keyword.is_structured_sms() else r... | [] | def _fmt_keyword_data(self, keyword):
return {
'id': keyword.couch_id,
'keyword': keyword.keyword,
'description': keyword.description,
'editUrl': reverse(
EditStructuredKeywordView.urlname,
args=[self.domain, keyword.couch_id]
... | [
"def",
"_fmt_keyword_data",
"(",
"self",
",",
"keyword",
")",
":",
"return",
"{",
"'id'",
":",
"keyword",
".",
"couch_id",
",",
"'keyword'",
":",
"keyword",
".",
"keyword",
",",
"'description'",
":",
"keyword",
".",
"description",
",",
"'editUrl'",
":",
"r... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/reminders/views.py#L319-L332 | |||
XuezheMax/flowseq | 8cb4ae00c26fbeb3e1459e3b3b90e7e9a84c3d2b | experiments/translate.py | python | sample | (dataset, dataloader, flownmt, result_path, outfile, tau, n_len, n_tr) | [] | def sample(dataset, dataloader, flownmt, result_path, outfile, tau, n_len, n_tr):
flownmt.eval()
lengths = []
translations = []
num_insts = 0
start_time = time.time()
num_back = 0
for step, (src, tgt, src_masks, tgt_masks) in enumerate(dataloader):
trans, lens = flownmt.translate_sam... | [
"def",
"sample",
"(",
"dataset",
",",
"dataloader",
",",
"flownmt",
",",
"result_path",
",",
"outfile",
",",
"tau",
",",
"n_len",
",",
"n_tr",
")",
":",
"flownmt",
".",
"eval",
"(",
")",
"lengths",
"=",
"[",
"]",
"translations",
"=",
"[",
"]",
"num_i... | https://github.com/XuezheMax/flowseq/blob/8cb4ae00c26fbeb3e1459e3b3b90e7e9a84c3d2b/experiments/translate.py#L91-L113 | ||||
vivisect/vivisect | 37b0b655d8dedfcf322e86b0f144b096e48d547e | vtrace/platforms/base.py | python | TracerBase.platformSetSignal | (self, sig=None) | Set the current signal to deliver to the process on cont.
(Use None for no signal delivery. | Set the current signal to deliver to the process on cont.
(Use None for no signal delivery. | [
"Set",
"the",
"current",
"signal",
"to",
"deliver",
"to",
"the",
"process",
"on",
"cont",
".",
"(",
"Use",
"None",
"for",
"no",
"signal",
"delivery",
"."
] | def platformSetSignal(self, sig=None):
'''
Set the current signal to deliver to the process on cont.
(Use None for no signal delivery.
'''
self.setMeta('PendingSignal', sig) | [
"def",
"platformSetSignal",
"(",
"self",
",",
"sig",
"=",
"None",
")",
":",
"self",
".",
"setMeta",
"(",
"'PendingSignal'",
",",
"sig",
")"
] | https://github.com/vivisect/vivisect/blob/37b0b655d8dedfcf322e86b0f144b096e48d547e/vtrace/platforms/base.py#L683-L688 | ||
danmacnish/cartoonify | 39ea84d96b3e93f0480e6d6158bea506d01278ca | cartoonify/app/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py | python | FasterRCNNInceptionResnetV2FeatureExtractor.restore_from_classification_checkpoint_fn | (
self,
first_stage_feature_extractor_scope,
second_stage_feature_extractor_scope) | return variables_to_restore | Returns a map of variables to load from a foreign checkpoint.
Note that this overrides the default implementation in
faster_rcnn_meta_arch.FasterRCNNFeatureExtractor which does not work for
InceptionResnetV2 checkpoints.
TODO: revisit whether it's possible to force the
`Repeat` namescope as create... | Returns a map of variables to load from a foreign checkpoint. | [
"Returns",
"a",
"map",
"of",
"variables",
"to",
"load",
"from",
"a",
"foreign",
"checkpoint",
"."
] | def restore_from_classification_checkpoint_fn(
self,
first_stage_feature_extractor_scope,
second_stage_feature_extractor_scope):
"""Returns a map of variables to load from a foreign checkpoint.
Note that this overrides the default implementation in
faster_rcnn_meta_arch.FasterRCNNFeatureE... | [
"def",
"restore_from_classification_checkpoint_fn",
"(",
"self",
",",
"first_stage_feature_extractor_scope",
",",
"second_stage_feature_extractor_scope",
")",
":",
"variables_to_restore",
"=",
"{",
"}",
"for",
"variable",
"in",
"tf",
".",
"global_variables",
"(",
")",
":"... | https://github.com/danmacnish/cartoonify/blob/39ea84d96b3e93f0480e6d6158bea506d01278ca/cartoonify/app/object_detection/models/faster_rcnn_inception_resnet_v2_feature_extractor.py#L173-L214 | |
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/zmq/error.py | python | _check_rc | (rc, errno=None) | internal utility for checking zmq return condition
and raising the appropriate Exception class | internal utility for checking zmq return condition
and raising the appropriate Exception class | [
"internal",
"utility",
"for",
"checking",
"zmq",
"return",
"condition",
"and",
"raising",
"the",
"appropriate",
"Exception",
"class"
] | def _check_rc(rc, errno=None):
"""internal utility for checking zmq return condition
and raising the appropriate Exception class
"""
if rc < 0:
from zmq.backend import zmq_errno
if errno is None:
errno = zmq_errno()
from zmq import EAGAIN, ETERM
if errno ... | [
"def",
"_check_rc",
"(",
"rc",
",",
"errno",
"=",
"None",
")",
":",
"if",
"rc",
"<",
"0",
":",
"from",
"zmq",
".",
"backend",
"import",
"zmq_errno",
"if",
"errno",
"is",
"None",
":",
"errno",
"=",
"zmq_errno",
"(",
")",
"from",
"zmq",
"import",
"EA... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/zmq/error.py#L98-L113 | ||
RhetTbull/osxphotos | 231d13279296ee4a242d3140d8abe7b5a5bcc9c0 | osxphotos/export_db.py | python | ExportDB.set_stat_edited_for_file | (self, filename, stats) | return self._set_stat_for_file("edited", filename, stats) | set stat info for edited version of image (in Photos' library)
filename: filename to set the stat info for
stat: a tuple of length 3: mode, size, mtime | set stat info for edited version of image (in Photos' library)
filename: filename to set the stat info for
stat: a tuple of length 3: mode, size, mtime | [
"set",
"stat",
"info",
"for",
"edited",
"version",
"of",
"image",
"(",
"in",
"Photos",
"library",
")",
"filename",
":",
"filename",
"to",
"set",
"the",
"stat",
"info",
"for",
"stat",
":",
"a",
"tuple",
"of",
"length",
"3",
":",
"mode",
"size",
"mtime"
... | def set_stat_edited_for_file(self, filename, stats):
"""set stat info for edited version of image (in Photos' library)
filename: filename to set the stat info for
stat: a tuple of length 3: mode, size, mtime"""
return self._set_stat_for_file("edited", filename, stats) | [
"def",
"set_stat_edited_for_file",
"(",
"self",
",",
"filename",
",",
"stats",
")",
":",
"return",
"self",
".",
"_set_stat_for_file",
"(",
"\"edited\"",
",",
"filename",
",",
"stats",
")"
] | https://github.com/RhetTbull/osxphotos/blob/231d13279296ee4a242d3140d8abe7b5a5bcc9c0/osxphotos/export_db.py#L287-L291 | |
MIC-DKFZ/trixi | 193c6cfcbe6c28576d3ee745f8a23f88a8029029 | trixi/logger/message/slackmessagelogger.py | python | SlackMessageLogger.show_image | (self, image, *args, **kwargs) | Sends an image file to a chat using an existing slack bot.
Args:
image (str or np array): Path to the image file to be sent to the chat. | Sends an image file to a chat using an existing slack bot. | [
"Sends",
"an",
"image",
"file",
"to",
"a",
"chat",
"using",
"an",
"existing",
"slack",
"bot",
"."
] | def show_image(self, image, *args, **kwargs):
"""
Sends an image file to a chat using an existing slack bot.
Args:
image (str or np array): Path to the image file to be sent to the chat.
"""
try:
if isinstance(image, str):
with open(image... | [
"def",
"show_image",
"(",
"self",
",",
"image",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"image",
",",
"str",
")",
":",
"with",
"open",
"(",
"image",
",",
"'rb'",
")",
"as",
"img_file",
":",
"self"... | https://github.com/MIC-DKFZ/trixi/blob/193c6cfcbe6c28576d3ee745f8a23f88a8029029/trixi/logger/message/slackmessagelogger.py#L153-L169 | ||
GoogleCloudPlatform/PerfKitBenchmarker | 6e3412d7d5e414b8ca30ed5eaf970cef1d919a67 | perfkitbenchmarker/windows_virtual_machine.py | python | BaseWindowsMixin._SmbclientRemoteCopy | (self, local_path, remote_path,
copy_to, network_drive) | Copies a file to or from the VM using smbclient.
Args:
local_path: Local path to file.
remote_path: Optional path of where to copy file on remote host.
copy_to: True to copy to vm, False to copy from vm.
network_drive: The smb specification for the remote drive
(//{ip_address}/{sh... | Copies a file to or from the VM using smbclient. | [
"Copies",
"a",
"file",
"to",
"or",
"from",
"the",
"VM",
"using",
"smbclient",
"."
] | def _SmbclientRemoteCopy(self, local_path, remote_path,
copy_to, network_drive):
"""Copies a file to or from the VM using smbclient.
Args:
local_path: Local path to file.
remote_path: Optional path of where to copy file on remote host.
copy_to: True to copy to vm, F... | [
"def",
"_SmbclientRemoteCopy",
"(",
"self",
",",
"local_path",
",",
"remote_path",
",",
"copy_to",
",",
"network_drive",
")",
":",
"local_directory",
",",
"local_file",
"=",
"os",
".",
"path",
".",
"split",
"(",
"local_path",
")",
"remote_directory",
",",
"rem... | https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/6e3412d7d5e414b8ca30ed5eaf970cef1d919a67/perfkitbenchmarker/windows_virtual_machine.py#L324-L359 | ||
batiste/django-page-cms | 8ba3fa07ecc4aab1013db457ff50a1ebe1ac4d06 | pages/templatetags/pages_tags.py | python | pages_breadcrumb | (context, page, url='/') | return context | Render a breadcrumb like menu.
Override ``pages/breadcrumb.html`` if you want to change the
design.
:param page: the current page
:param url: not used anymore | Render a breadcrumb like menu. | [
"Render",
"a",
"breadcrumb",
"like",
"menu",
"."
] | def pages_breadcrumb(context, page, url='/'):
"""
Render a breadcrumb like menu.
Override ``pages/breadcrumb.html`` if you want to change the
design.
:param page: the current page
:param url: not used anymore
"""
lang = context.get('lang', pages_settings.PAGE_DEFAULT_LANGUAGE)
page... | [
"def",
"pages_breadcrumb",
"(",
"context",
",",
"page",
",",
"url",
"=",
"'/'",
")",
":",
"lang",
"=",
"context",
".",
"get",
"(",
"'lang'",
",",
"pages_settings",
".",
"PAGE_DEFAULT_LANGUAGE",
")",
"page",
"=",
"get_page_from_string_or_id",
"(",
"page",
","... | https://github.com/batiste/django-page-cms/blob/8ba3fa07ecc4aab1013db457ff50a1ebe1ac4d06/pages/templatetags/pages_tags.py#L282-L298 | |
mlflow/mlflow | 364aca7daf0fcee3ec407ae0b1b16d9cb3085081 | mlflow/utils/autologging_utils/__init__.py | python | get_autologging_config | (flavor_name, config_key, default_value=None) | Returns a desired config value for a specified autologging integration.
Returns `None` if specified `flavor_name` has no recorded configs.
If `config_key` is not set on the config object, default value is returned.
:param flavor_name: An autologging integration flavor name.
:param config_key: The key f... | Returns a desired config value for a specified autologging integration.
Returns `None` if specified `flavor_name` has no recorded configs.
If `config_key` is not set on the config object, default value is returned. | [
"Returns",
"a",
"desired",
"config",
"value",
"for",
"a",
"specified",
"autologging",
"integration",
".",
"Returns",
"None",
"if",
"specified",
"flavor_name",
"has",
"no",
"recorded",
"configs",
".",
"If",
"config_key",
"is",
"not",
"set",
"on",
"the",
"config... | def get_autologging_config(flavor_name, config_key, default_value=None):
"""
Returns a desired config value for a specified autologging integration.
Returns `None` if specified `flavor_name` has no recorded configs.
If `config_key` is not set on the config object, default value is returned.
:param ... | [
"def",
"get_autologging_config",
"(",
"flavor_name",
",",
"config_key",
",",
"default_value",
"=",
"None",
")",
":",
"config",
"=",
"AUTOLOGGING_INTEGRATIONS",
".",
"get",
"(",
"flavor_name",
")",
"if",
"config",
"is",
"not",
"None",
":",
"return",
"config",
"... | https://github.com/mlflow/mlflow/blob/364aca7daf0fcee3ec407ae0b1b16d9cb3085081/mlflow/utils/autologging_utils/__init__.py#L427-L441 | ||
Epistimio/orion | 732e739d99561020dbe620760acf062ade746006 | src/orion/core/evc/conflicts.py | python | MissingDimensionConflict.detect | (cls, old_config, new_config, branching_config=None) | Detect all missing dimensions in `new_config` based on `old_config`
:param branching_config: | Detect all missing dimensions in `new_config` based on `old_config`
:param branching_config: | [
"Detect",
"all",
"missing",
"dimensions",
"in",
"new_config",
"based",
"on",
"old_config",
":",
"param",
"branching_config",
":"
] | def detect(cls, old_config, new_config, branching_config=None):
"""Detect all missing dimensions in `new_config` based on `old_config`
:param branching_config:
"""
for conflict in NewDimensionConflict.detect(new_config, old_config):
yield cls(old_config, new_config, conflict.... | [
"def",
"detect",
"(",
"cls",
",",
"old_config",
",",
"new_config",
",",
"branching_config",
"=",
"None",
")",
":",
"for",
"conflict",
"in",
"NewDimensionConflict",
".",
"detect",
"(",
"new_config",
",",
"old_config",
")",
":",
"yield",
"cls",
"(",
"old_confi... | https://github.com/Epistimio/orion/blob/732e739d99561020dbe620760acf062ade746006/src/orion/core/evc/conflicts.py#L787-L792 | ||
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/ipython-4.0.0-py3.3.egg/IPython/core/application.py | python | BaseIPythonApplication.load_config_file | (self, suppress_errors=True) | Load the config file.
By default, errors in loading config are handled, and a warning
printed on screen. For testing, the suppress_errors option is set
to False, so errors will make tests fail. | Load the config file. | [
"Load",
"the",
"config",
"file",
"."
] | def load_config_file(self, suppress_errors=True):
"""Load the config file.
By default, errors in loading config are handled, and a warning
printed on screen. For testing, the suppress_errors option is set
to False, so errors will make tests fail.
"""
self.log.debug("Sear... | [
"def",
"load_config_file",
"(",
"self",
",",
"suppress_errors",
"=",
"True",
")",
":",
"self",
".",
"log",
".",
"debug",
"(",
"\"Searching path %s for config files\"",
",",
"self",
".",
"config_file_paths",
")",
"base_config",
"=",
"'ipython_config.py'",
"self",
"... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/ipython-4.0.0-py3.3.egg/IPython/core/application.py#L243-L288 | ||
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | rope/base/history.py | python | History.tobe_undone | (self) | The last done change if available, `None` otherwise | The last done change if available, `None` otherwise | [
"The",
"last",
"done",
"change",
"if",
"available",
"None",
"otherwise"
] | def tobe_undone(self):
"""The last done change if available, `None` otherwise"""
if self.undo_list:
return self.undo_list[-1] | [
"def",
"tobe_undone",
"(",
"self",
")",
":",
"if",
"self",
".",
"undo_list",
":",
"return",
"self",
".",
"undo_list",
"[",
"-",
"1",
"]"
] | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/rope/base/history.py#L177-L180 | ||
omz/PythonistaAppTemplate | f560f93f8876d82a21d108977f90583df08d55af | PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/dialects/mysql/base.py | python | TIMESTAMP.__init__ | (self, timezone=False, fsp=None) | Construct a MySQL TIMESTAMP type.
:param timezone: not used by the MySQL dialect.
:param fsp: fractional seconds precision value.
MySQL 5.6.4 supports storage of fractional seconds;
this parameter will be used when emitting DDL
for the TIMESTAMP type.
.. note::
... | Construct a MySQL TIMESTAMP type. | [
"Construct",
"a",
"MySQL",
"TIMESTAMP",
"type",
"."
] | def __init__(self, timezone=False, fsp=None):
"""Construct a MySQL TIMESTAMP type.
:param timezone: not used by the MySQL dialect.
:param fsp: fractional seconds precision value.
MySQL 5.6.4 supports storage of fractional seconds;
this parameter will be used when emitting DDL
... | [
"def",
"__init__",
"(",
"self",
",",
"timezone",
"=",
"False",
",",
"fsp",
"=",
"None",
")",
":",
"super",
"(",
"TIMESTAMP",
",",
"self",
")",
".",
"__init__",
"(",
"timezone",
"=",
"timezone",
")",
"self",
".",
"fsp",
"=",
"fsp"
] | https://github.com/omz/PythonistaAppTemplate/blob/f560f93f8876d82a21d108977f90583df08d55af/PythonistaAppTemplate/PythonistaKit.framework/pylib/site-packages/sqlalchemy/dialects/mysql/base.py#L848-L868 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/turtle.py | python | TurtleScreen.register_shape | (self, name, shape=None) | Adds a turtle shape to TurtleScreen's shapelist.
Arguments:
(1) name is the name of a gif-file and shape is None.
Installs the corresponding image shape.
!! Image-shapes DO NOT rotate when turning the turtle,
!! so they do not display the heading of the turtle!
... | Adds a turtle shape to TurtleScreen's shapelist. | [
"Adds",
"a",
"turtle",
"shape",
"to",
"TurtleScreen",
"s",
"shapelist",
"."
] | def register_shape(self, name, shape=None):
"""Adds a turtle shape to TurtleScreen's shapelist.
Arguments:
(1) name is the name of a gif-file and shape is None.
Installs the corresponding image shape.
!! Image-shapes DO NOT rotate when turning the turtle,
!! ... | [
"def",
"register_shape",
"(",
"self",
",",
"name",
",",
"shape",
"=",
"None",
")",
":",
"if",
"shape",
"is",
"None",
":",
"# image",
"if",
"name",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"\".gif\"",
")",
":",
"shape",
"=",
"Shape",
"(",
"\"im... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/turtle.py#L1108-L1141 | ||
twilio/twilio-python | 6e1e811ea57a1edfadd5161ace87397c563f6915 | twilio/rest/conversations/v1/service/__init__.py | python | ServiceInstance.users | (self) | return self._proxy.users | Access the users
:returns: twilio.rest.conversations.v1.service.user.UserList
:rtype: twilio.rest.conversations.v1.service.user.UserList | Access the users | [
"Access",
"the",
"users"
] | def users(self):
"""
Access the users
:returns: twilio.rest.conversations.v1.service.user.UserList
:rtype: twilio.rest.conversations.v1.service.user.UserList
"""
return self._proxy.users | [
"def",
"users",
"(",
"self",
")",
":",
"return",
"self",
".",
"_proxy",
".",
"users"
] | https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/conversations/v1/service/__init__.py#L468-L475 | |
miroblog/deep_rl_trader | 1aafa451f0f00ad3e27c43241a596a62d608ba72 | modified_keras_rl_core/core.py | python | Processor.process_reward | (self, reward) | return reward | Processes the reward as obtained from the environment for use in an agent and
returns it.
# Arguments
reward (float): A reward as obtained by the environment
# Returns
Reward obtained by the environment processed | Processes the reward as obtained from the environment for use in an agent and
returns it. | [
"Processes",
"the",
"reward",
"as",
"obtained",
"from",
"the",
"environment",
"for",
"use",
"in",
"an",
"agent",
"and",
"returns",
"it",
"."
] | def process_reward(self, reward):
"""Processes the reward as obtained from the environment for use in an agent and
returns it.
# Arguments
reward (float): A reward as obtained by the environment
# Returns
Reward obtained by the environment processed
"""
... | [
"def",
"process_reward",
"(",
"self",
",",
"reward",
")",
":",
"return",
"reward"
] | https://github.com/miroblog/deep_rl_trader/blob/1aafa451f0f00ad3e27c43241a596a62d608ba72/modified_keras_rl_core/core.py#L545-L555 | |
tabacha/ProSafeLinux | a744882dd57e468fe70c4eeb5f91877105d9b069 | psl_typ.py | python | PslTyp.get_set_help | (self) | return None | argparse help argument for set operation | argparse help argument for set operation | [
"argparse",
"help",
"argument",
"for",
"set",
"operation"
] | def get_set_help(self):
"argparse help argument for set operation"
return None | [
"def",
"get_set_help",
"(",
"self",
")",
":",
"return",
"None"
] | https://github.com/tabacha/ProSafeLinux/blob/a744882dd57e468fe70c4eeb5f91877105d9b069/psl_typ.py#L66-L68 | |
ypxie/HDGan | d98e2a85f7ae6ce7bfacd1c15e519558d97cb931 | HDGan/neuralDist/pretrainedmodels/torchvision.py | python | resnet18 | (num_classes=1000, pretrained='imagenet') | return model | Constructs a ResNet-18 model. | Constructs a ResNet-18 model. | [
"Constructs",
"a",
"ResNet",
"-",
"18",
"model",
"."
] | def resnet18(num_classes=1000, pretrained='imagenet'):
"""Constructs a ResNet-18 model.
"""
model = models.resnet18(pretrained=False)
if pretrained is not None:
settings = pretrained_settings['resnet18'][pretrained]
model = load_pretrained(model, num_classes, settings)
return model | [
"def",
"resnet18",
"(",
"num_classes",
"=",
"1000",
",",
"pretrained",
"=",
"'imagenet'",
")",
":",
"model",
"=",
"models",
".",
"resnet18",
"(",
"pretrained",
"=",
"False",
")",
"if",
"pretrained",
"is",
"not",
"None",
":",
"settings",
"=",
"pretrained_se... | https://github.com/ypxie/HDGan/blob/d98e2a85f7ae6ce7bfacd1c15e519558d97cb931/HDGan/neuralDist/pretrainedmodels/torchvision.py#L158-L165 | |
fatchord/WaveRNN | 3595219b2f2f5353f0867a7bb59abcb15aba8831 | utils/checkpoints.py | python | restore_checkpoint | (checkpoint_type: str, paths: Paths, model, optimizer, *,
name=None, create_if_missing=False) | Restores from a training session saved to disk.
NOTE: The optimizer's state is placed on the same device as it's model
parameters. Therefore, be sure you have done `model.to(device)` before
calling this method.
Args:
paths: Provides information about the different paths to use.
model:... | Restores from a training session saved to disk. | [
"Restores",
"from",
"a",
"training",
"session",
"saved",
"to",
"disk",
"."
] | def restore_checkpoint(checkpoint_type: str, paths: Paths, model, optimizer, *,
name=None, create_if_missing=False):
"""Restores from a training session saved to disk.
NOTE: The optimizer's state is placed on the same device as it's model
parameters. Therefore, be sure you have done `model.to(devic... | [
"def",
"restore_checkpoint",
"(",
"checkpoint_type",
":",
"str",
",",
"paths",
":",
"Paths",
",",
"model",
",",
"optimizer",
",",
"*",
",",
"name",
"=",
"None",
",",
"create_if_missing",
"=",
"False",
")",
":",
"weights_path",
",",
"optim_path",
",",
"chec... | https://github.com/fatchord/WaveRNN/blob/3595219b2f2f5353f0867a7bb59abcb15aba8831/utils/checkpoints.py#L79-L128 | ||
ucbdrive/3d-vehicle-tracking | 8ee189f6792897651bb56bb2950ce07c9629a89d | faster-rcnn.pytorch/lib/model/utils/logger.py | python | Logger.histo_summary | (self, tag, values, step, bins=1000) | Log a histogram of the tensor of values. | Log a histogram of the tensor of values. | [
"Log",
"a",
"histogram",
"of",
"the",
"tensor",
"of",
"values",
"."
] | def histo_summary(self, tag, values, step, bins=1000):
"""Log a histogram of the tensor of values."""
# Create a histogram using numpy
counts, bin_edges = np.histogram(values, bins=bins)
# Fill the fields of the histogram proto
hist = tf.HistogramProto()
hist.min = floa... | [
"def",
"histo_summary",
"(",
"self",
",",
"tag",
",",
"values",
",",
"step",
",",
"bins",
"=",
"1000",
")",
":",
"# Create a histogram using numpy",
"counts",
",",
"bin_edges",
"=",
"np",
".",
"histogram",
"(",
"values",
",",
"bins",
"=",
"bins",
")",
"#... | https://github.com/ucbdrive/3d-vehicle-tracking/blob/8ee189f6792897651bb56bb2950ce07c9629a89d/faster-rcnn.pytorch/lib/model/utils/logger.py#L49-L75 | ||
glutanimate/review-heatmap | c758478125b60a81c66c87c35b12b7968ec0a348 | src/review_heatmap/libaddon/utils.py | python | deepMergeLists | (original, incoming, new=False) | return result | Deep merge two lists. Optionally leaves original intact.
Procedure:
Reursively call deep merge on each correlated element of list.
If item type in both elements are
a. dict: Call deepMergeDicts on both values.
b. list: Call deepMergeLists on both values.
c. any o... | Deep merge two lists. Optionally leaves original intact. | [
"Deep",
"merge",
"two",
"lists",
".",
"Optionally",
"leaves",
"original",
"intact",
"."
] | def deepMergeLists(original, incoming, new=False):
"""
Deep merge two lists. Optionally leaves original intact.
Procedure:
Reursively call deep merge on each correlated element of list.
If item type in both elements are
a. dict: Call deepMergeDicts on both values.
b.... | [
"def",
"deepMergeLists",
"(",
"original",
",",
"incoming",
",",
"new",
"=",
"False",
")",
":",
"result",
"=",
"original",
"if",
"not",
"new",
"else",
"deepcopy",
"(",
"original",
")",
"common_length",
"=",
"min",
"(",
"len",
"(",
"original",
")",
",",
... | https://github.com/glutanimate/review-heatmap/blob/c758478125b60a81c66c87c35b12b7968ec0a348/src/review_heatmap/libaddon/utils.py#L105-L147 | |
ShivamSarodia/ShivyC | e7d72eff237e1ef49ec70333497348baf86be425 | shivyc/il_gen.py | python | ILCode.__init__ | (self) | Initialize IL code. | Initialize IL code. | [
"Initialize",
"IL",
"code",
"."
] | def __init__(self):
"""Initialize IL code."""
self.commands = {}
self.cur_func = None
self.label_num = 0
self.static_inits = {}
self.literals = {}
self.string_literals = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"commands",
"=",
"{",
"}",
"self",
".",
"cur_func",
"=",
"None",
"self",
".",
"label_num",
"=",
"0",
"self",
".",
"static_inits",
"=",
"{",
"}",
"self",
".",
"literals",
"=",
"{",
"}",
"self",
... | https://github.com/ShivamSarodia/ShivyC/blob/e7d72eff237e1ef49ec70333497348baf86be425/shivyc/il_gen.py#L19-L28 | ||
UFAL-DSG/tgen | 3c43c0e29faa7ea3857a6e490d9c28a8daafc7d0 | tgen/rank_nn.py | python | NNRanker._update_nn | (self, bad_feats, good_feats, rate) | Direct call to NN weights update. | Direct call to NN weights update. | [
"Direct",
"call",
"to",
"NN",
"weights",
"update",
"."
] | def _update_nn(self, bad_feats, good_feats, rate):
"""Direct call to NN weights update."""
self.nn.update(bad_feats, good_feats, rate) | [
"def",
"_update_nn",
"(",
"self",
",",
"bad_feats",
",",
"good_feats",
",",
"rate",
")",
":",
"self",
".",
"nn",
".",
"update",
"(",
"bad_feats",
",",
"good_feats",
",",
"rate",
")"
] | https://github.com/UFAL-DSG/tgen/blob/3c43c0e29faa7ea3857a6e490d9c28a8daafc7d0/tgen/rank_nn.py#L79-L81 | ||
peplin/pygatt | 70c68684ca5a2c5cbd8c4f6f039503fe9b848d24 | pygatt/backends/gatttool/device.py | python | GATTToolBLEDevice.register_disconnect_callback | (self, callback) | [] | def register_disconnect_callback(self, callback):
self._backend._receiver.register_callback("disconnected", callback) | [
"def",
"register_disconnect_callback",
"(",
"self",
",",
"callback",
")",
":",
"self",
".",
"_backend",
".",
"_receiver",
".",
"register_callback",
"(",
"\"disconnected\"",
",",
"callback",
")"
] | https://github.com/peplin/pygatt/blob/70c68684ca5a2c5cbd8c4f6f039503fe9b848d24/pygatt/backends/gatttool/device.py#L65-L66 | ||||
playframework/play1 | 0ecac3bc2421ae2dbec27a368bf671eda1c9cba5 | python/Lib/ctypes/macholib/dyld.py | python | dyld_find | (name, executable_path=None, env=None) | Find a library or framework using dyld semantics | Find a library or framework using dyld semantics | [
"Find",
"a",
"library",
"or",
"framework",
"using",
"dyld",
"semantics"
] | def dyld_find(name, executable_path=None, env=None):
"""
Find a library or framework using dyld semantics
"""
name = ensure_utf8(name)
executable_path = ensure_utf8(executable_path)
for path in dyld_image_suffix_search(chain(
dyld_override_search(name, env),
dyld_... | [
"def",
"dyld_find",
"(",
"name",
",",
"executable_path",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"name",
"=",
"ensure_utf8",
"(",
"name",
")",
"executable_path",
"=",
"ensure_utf8",
"(",
"executable_path",
")",
"for",
"path",
"in",
"dyld_image_suffix... | https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/ctypes/macholib/dyld.py#L122-L135 | ||
markmckinnon/Autopsy-Plugins | 99f8a485bda437eb0508f35fcf843c303bd367c4 | Executable Programs For Plugins/Samparse/Database.py | python | SQLiteDb.__init__ | (self) | Initializes the database file object. | Initializes the database file object. | [
"Initializes",
"the",
"database",
"file",
"object",
"."
] | def __init__(self):
"""Initializes the database file object."""
super(SQLiteDb, self).__init__()
self._connection = None
self._cursor = None
self.filename = None
self.read_only = None
self.reserved_word_list_dict = {'ABORT':0, 'ACTION':0, 'ADD':0, 'AFTER':0, 'ALL':0, 'ALTER':0, 'ANALYZE':0, ... | [
"def",
"__init__",
"(",
"self",
")",
":",
"super",
"(",
"SQLiteDb",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_connection",
"=",
"None",
"self",
".",
"_cursor",
"=",
"None",
"self",
".",
"filename",
"=",
"None",
"self",
".",
"read_on... | https://github.com/markmckinnon/Autopsy-Plugins/blob/99f8a485bda437eb0508f35fcf843c303bd367c4/Executable Programs For Plugins/Samparse/Database.py#L10-L31 | ||
astropy/astroquery | 11c9c83fa8e5f948822f8f73c854ec4b72043016 | astroquery/utils/process_asyncs.py | python | async_to_sync | (cls) | return cls | Convert all query_x_async methods to query_x methods
(see
http://stackoverflow.com/questions/18048341/add-methods-to-a-class-generated-from-other-methods
for help understanding) | Convert all query_x_async methods to query_x methods | [
"Convert",
"all",
"query_x_async",
"methods",
"to",
"query_x",
"methods"
] | def async_to_sync(cls):
"""
Convert all query_x_async methods to query_x methods
(see
http://stackoverflow.com/questions/18048341/add-methods-to-a-class-generated-from-other-methods
for help understanding)
"""
def create_method(async_method_name):
@class_or_instance
def ne... | [
"def",
"async_to_sync",
"(",
"cls",
")",
":",
"def",
"create_method",
"(",
"async_method_name",
")",
":",
"@",
"class_or_instance",
"def",
"newmethod",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"verbose",
"=",
"kwargs",
".",
"pop"... | https://github.com/astropy/astroquery/blob/11c9c83fa8e5f948822f8f73c854ec4b72043016/astroquery/utils/process_asyncs.py#L11-L53 | |
FederatedAI/FATE | 32540492623568ecd1afcb367360133616e02fa3 | python/fate_arch/federation/pulsar/_pulsar_manager.py | python | PulsarManager._create_session | (self) | return s | [] | def _create_session(self):
# retry mechanism refers to https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.Retry
retry = Retry(total=MAX_RETRIES, redirect=MAX_REDIRECT,
backoff_factor=BACKOFF_FACTOR)
s = requests.Session()
# initialize ... | [
"def",
"_create_session",
"(",
"self",
")",
":",
"# retry mechanism refers to https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.Retry",
"retry",
"=",
"Retry",
"(",
"total",
"=",
"MAX_RETRIES",
",",
"redirect",
"=",
"MAX_REDIRECT",
",",
"backoff_f... | https://github.com/FederatedAI/FATE/blob/32540492623568ecd1afcb367360133616e02fa3/python/fate_arch/federation/pulsar/_pulsar_manager.py#L34-L45 | |||
stoq/stoq | c26991644d1affcf96bc2e0a0434796cabdf8448 | stoqlib/lib/validators.py | python | validate_decimal | (value) | return _validate_type(Decimal, value) | Validates an Decimal.
Returns if the value is a valid Decimal, or, in case it's a string,
if it can be converted to an Decimal. | Validates an Decimal. | [
"Validates",
"an",
"Decimal",
"."
] | def validate_decimal(value):
"""Validates an Decimal.
Returns if the value is a valid Decimal, or, in case it's a string,
if it can be converted to an Decimal.
"""
return _validate_type(Decimal, value) | [
"def",
"validate_decimal",
"(",
"value",
")",
":",
"return",
"_validate_type",
"(",
"Decimal",
",",
"value",
")"
] | https://github.com/stoq/stoq/blob/c26991644d1affcf96bc2e0a0434796cabdf8448/stoqlib/lib/validators.py#L218-L224 | |
nadineproject/nadine | c41c8ef7ffe18f1853029c97eecc329039b4af6c | staff/views/settings.py | python | helptexts | (request) | return render(request, 'staff/settings/helptexts.html', context) | [] | def helptexts(request):
helps = HelpText.objects.all()
if helps:
latest = HelpText.objects.filter().order_by('-order')[0]
latest_order = latest.order + 1
else:
latest = None
latest_order = 0
selected = None
message = None
selected_help = request.GET.get('selected_... | [
"def",
"helptexts",
"(",
"request",
")",
":",
"helps",
"=",
"HelpText",
".",
"objects",
".",
"all",
"(",
")",
"if",
"helps",
":",
"latest",
"=",
"HelpText",
".",
"objects",
".",
"filter",
"(",
")",
".",
"order_by",
"(",
"'-order'",
")",
"[",
"0",
"... | https://github.com/nadineproject/nadine/blob/c41c8ef7ffe18f1853029c97eecc329039b4af6c/staff/views/settings.py#L93-L133 | |||
general03/flask-autoindex | 424246242c9f40aeb9ac2c8c63f4d2234024256e | .eggs/Werkzeug-1.0.1-py3.7.egg/werkzeug/wrappers/auth.py | python | WWWAuthenticateMixin.www_authenticate | (self) | return parse_www_authenticate_header(header, on_update) | The `WWW-Authenticate` header in a parsed form. | The `WWW-Authenticate` header in a parsed form. | [
"The",
"WWW",
"-",
"Authenticate",
"header",
"in",
"a",
"parsed",
"form",
"."
] | def www_authenticate(self):
"""The `WWW-Authenticate` header in a parsed form."""
def on_update(www_auth):
if not www_auth and "www-authenticate" in self.headers:
del self.headers["www-authenticate"]
elif www_auth:
self.headers["WWW-Authenticate"]... | [
"def",
"www_authenticate",
"(",
"self",
")",
":",
"def",
"on_update",
"(",
"www_auth",
")",
":",
"if",
"not",
"www_auth",
"and",
"\"www-authenticate\"",
"in",
"self",
".",
"headers",
":",
"del",
"self",
".",
"headers",
"[",
"\"www-authenticate\"",
"]",
"elif... | https://github.com/general03/flask-autoindex/blob/424246242c9f40aeb9ac2c8c63f4d2234024256e/.eggs/Werkzeug-1.0.1-py3.7.egg/werkzeug/wrappers/auth.py#L23-L33 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.