query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Localize a start or end Timestamp to the timezone of the corresponding start or end Timestamp | def _maybe_localize_point(ts, is_none, is_not_none, freq, tz, ambiguous, nonexistent):
# Make sure start and end are timezone localized if:
# 1) freq = a Timedelta-like frequency (Tick)
# 2) freq = None i.e. generating a linspaced range
if is_none is None and is_not_none is not None:
# Note: We ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _convertTZ(self):\n tz = timezone.get_current_timezone()\n dtstart = self['DTSTART']\n dtend = self['DTEND']\n if dtstart.zone() == \"UTC\":\n dtstart.dt = dtstart.dt.astimezone(tz)\n if dtend.zone() == \"UTC\":\n dtend.dt = dtend.dt.astimezone(tz)",
... | [
"0.68994445",
"0.674742",
"0.6268819",
"0.6241484",
"0.6149798",
"0.6068247",
"0.57239527",
"0.5703186",
"0.56963354",
"0.5694475",
"0.5687302",
"0.5634148",
"0.56231475",
"0.56176126",
"0.55996066",
"0.5558983",
"0.5553681",
"0.5541549",
"0.5508256",
"0.55075294",
"0.546989"... | 0.58531207 | 6 |
Creates the padding layer. | def __init__(self, padding, padding_mode, **kwargs):
self._padding = padding
self._padding_mode = padding_mode
super(Pad1D, self).__init__(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def padding(self):\n\t\treturn self.paddings_shape_param('W')",
"def build(self):\n pad_size_tmp = list(self.pad_size)\n\n # This handles the case where the padding is equal to the image size\n if pad_size_tmp[0] == self.input_size[0]:\n pad_size_tmp[0] -= 1\n pad_size_... | [
"0.68063045",
"0.6526399",
"0.6523979",
"0.64836293",
"0.644709",
"0.6441153",
"0.6428144",
"0.63845706",
"0.63788134",
"0.63525003",
"0.63319176",
"0.63187206",
"0.63171107",
"0.6248544",
"0.62452084",
"0.62303895",
"0.62091464",
"0.61972284",
"0.61864936",
"0.61702937",
"0.... | 0.6177326 | 19 |
Creates a module with onedimensional convolutions. | def __init__(self, count, channels):
super().__init__()
self.count = count
self.channels = channels
# Organization of the distance data can be angles first, channels second,
# or channels first, angles second.
# E.g., for inputs with a shape of (angles, channels):
# [ [23.0, 27.0], [1.0, 27.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_adaptor(self, module):\n\n # Section 2.1 of P&C, this is σ in equation (1) but not specified. Assuming ReLU as that is used in IMPALA.\n nonlinearity = nn.ReLU()\n\n if isinstance(module, nn.Conv2d):\n # Copy the module, so we have an adaptor that does the right input->o... | [
"0.5940478",
"0.5604068",
"0.56007713",
"0.55801237",
"0.5502367",
"0.54502225",
"0.543333",
"0.5430317",
"0.53751534",
"0.5300303",
"0.52949625",
"0.528529",
"0.52744603",
"0.5253639",
"0.5252527",
"0.5252332",
"0.5246705",
"0.523286",
"0.5215111",
"0.52149254",
"0.5209179",... | 0.0 | -1 |
Creates a module with onedimensional convolutions. | def __init__(self, count, kernel_size, channels, padding_mode):
super().__init__()
self._count = count
self._kernel_size = kernel_size
self._channels = channels
self._padding_mode = padding_mode
if kernel_size % 2 == 0:
raise ValueError('Kernel size must be an odd number')
self._cnn_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_adaptor(self, module):\n\n # Section 2.1 of P&C, this is σ in equation (1) but not specified. Assuming ReLU as that is used in IMPALA.\n nonlinearity = nn.ReLU()\n\n if isinstance(module, nn.Conv2d):\n # Copy the module, so we have an adaptor that does the right input->o... | [
"0.5940478",
"0.5604068",
"0.56007713",
"0.55801237",
"0.5502367",
"0.54502225",
"0.543333",
"0.5430317",
"0.53751534",
"0.5300303",
"0.52949625",
"0.528529",
"0.52744603",
"0.5253639",
"0.5252527",
"0.5252332",
"0.5246705",
"0.523286",
"0.5215111",
"0.52149254",
"0.5209179",... | 0.0 | -1 |
Return the smallest power of two >= n. | def _next_power_of_two(self, n):
if n == 0:
return 1
return int(2 ** math.ceil(math.log2(n))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nextPowerOf2(n):\n count = 0; \n \n # First n in the below \n # condition is for the \n # case where n is 0 \n if (n and not(n & (n - 1))): \n return n \n \n while( n != 0): \n n >>= 1\n count += 1\n \n return 1 << count;",
"def next_pow_two(n):\n i =... | [
"0.8013303",
"0.7996467",
"0.79115164",
"0.77868235",
"0.7618029",
"0.7610764",
"0.7595847",
"0.75583386",
"0.7544554",
"0.7517651",
"0.75168914",
"0.74871844",
"0.74871844",
"0.74827355",
"0.74750406",
"0.74058086",
"0.738443",
"0.7332191",
"0.7304255",
"0.7261386",
"0.72567... | 0.82073 | 0 |
Initialize weights in the layer. | def initialize_weights(self):
for layer in self._cnn_layers:
weights_initializer.WeightsInitializer.initialize_layer_or_model(layer) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def initialize_weights(self):\n tf.nest.map_structure(\n weights_initializer.W... | [
"0.89309317",
"0.8804774",
"0.8739377",
"0.8717631",
"0.85709363",
"0.8532364",
"0.85138184",
"0.8380147",
"0.8304447",
"0.82256734",
"0.82256734",
"0.82256734",
"0.821292",
"0.81992537",
"0.8177291",
"0.8177291",
"0.81561476",
"0.8153665",
"0.81403416",
"0.8108106",
"0.80477... | 0.84537655 | 7 |
Initialize weights in the layer. | def initialize_weights(self):
tf.nest.map_structure(
weights_initializer.WeightsInitializer.initialize_layer_or_model,
self._layer_nest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_weights(self):\n weights_initializer.WeightsInitializer.initialize_layer_or_model(\n self._batch)",
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def _initialize_weights(self):\n pass",
"def init_weights_(self):\n rais... | [
"0.89309317",
"0.8804774",
"0.8717631",
"0.85709363",
"0.8532364",
"0.85138184",
"0.84537655",
"0.8380147",
"0.8304447",
"0.82256734",
"0.82256734",
"0.82256734",
"0.821292",
"0.81992537",
"0.8177291",
"0.8177291",
"0.81561476",
"0.8153665",
"0.81403416",
"0.8108106",
"0.8047... | 0.8739377 | 2 |
Applies the nest of layers to an input tensor. This function produces a nested output tensor, where the shape of the nest corresponds to the shape of the layer_nest provided at creation. Each layer in the layer_nest is applied to the same input tensors. | def call(self, inputs):
return tf.nest.map_structure(lambda l: l(inputs), self._layer_nest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_batch_dim(nest: types.NestedArray) -> types.NestedTensor:\n return tree.map_structure(lambda x: tf.expand_dims(x, axis=0), nest)",
"def squeeze_batch_dim(nest: types.NestedTensor) -> types.NestedTensor:\n return tree.map_structure(lambda x: tf.squeeze(x, axis=0), nest)",
"def auto_nest(func):\n def ... | [
"0.657762",
"0.6352146",
"0.63288695",
"0.5601798",
"0.52946013",
"0.5258396",
"0.5225452",
"0.51458424",
"0.51449",
"0.51360077",
"0.5133775",
"0.50649345",
"0.5060214",
"0.5058767",
"0.50157",
"0.5015072",
"0.49671987",
"0.49508137",
"0.49368224",
"0.492691",
"0.48876813",
... | 0.6119172 | 3 |
Create a NormalizeRange layer with the indicated range. | def __init__(self, minimum: float, maximum: float):
if minimum >= maximum:
raise Error('Can\'t normalize to empty range: ' +
f'[{self.minimum, self.maximum}]')
self.minimum = tf.constant(minimum, dtype=tf.float32)
self.maximum = tf.constant(maximum, dtype=tf.float32)
super().__in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _normalize_range():\n clipped = tf.clip_by_value(inputs, self.minimum, self.maximum)\n return -1 + 2 * (clipped - self.minimum) / length",
"def normalize_range(array, floor=0, ceil=1):\n scaler = MinMaxScaler(feature_range=(floor, ceil), copy=True)\n return scaler.fit_transform(array)",
"de... | [
"0.6795396",
"0.6443308",
"0.6362324",
"0.6209486",
"0.61801124",
"0.6000074",
"0.5929733",
"0.5900345",
"0.58882695",
"0.5781705",
"0.577912",
"0.57720727",
"0.57709634",
"0.5741095",
"0.5727708",
"0.5717495",
"0.5717495",
"0.57018244",
"0.56985587",
"0.56797254",
"0.5665134... | 0.54241925 | 43 |
Initialize weights in the layer. | def initialize_weights(self):
weights_initializer.WeightsInitializer.initialize_layer_or_model(
self._batch) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\n # Initialize weights\n self.apply(self._init_weights)",
"def initialize_weights(self):\n tf.nest.map_structure(\n weights_initializer.WeightsInitializer.initialize_layer_or_model,\n self._layer_nest)",
"def _initialize_weights(self):\n pass",
"d... | [
"0.8804774",
"0.8739377",
"0.8717631",
"0.85709363",
"0.8532364",
"0.85138184",
"0.84537655",
"0.8380147",
"0.8304447",
"0.82256734",
"0.82256734",
"0.82256734",
"0.821292",
"0.81992537",
"0.8177291",
"0.8177291",
"0.81561476",
"0.8153665",
"0.81403416",
"0.8108106",
"0.80477... | 0.89309317 | 0 |
Applies keras batchnorm on a flattened 2D tensor (batch x data). | def call(self, inputs, *args, **kwargs):
batch_dims = inputs.shape[:nest_utils.get_outer_rank(inputs, self._spec)]
num_batch_elems = tf.reduce_prod(batch_dims)
transformed_inputs = tf.reshape(inputs, (num_batch_elems, -1))
result = self._batch(transformed_inputs, *args, **kwargs)
return tf.reshape(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch_norm(input_tensor):\n epsilon = 1e-3\n batch_mean, batch_var = tf.nn.moments(input_tensor, [0])\n input_tensor = tf.nn.batch_normalization(input_tensor, mean=batch_mean, variance=batch_var, offset=None,\n scale=None, variance_epsilon=epsilon)\n\n re... | [
"0.7697959",
"0.753317",
"0.7447069",
"0.7246933",
"0.7222351",
"0.7203091",
"0.7115073",
"0.6961632",
"0.69505113",
"0.6886692",
"0.6882166",
"0.67736167",
"0.6742102",
"0.6725166",
"0.66999424",
"0.66313446",
"0.6621232",
"0.6561193",
"0.6510562",
"0.6476687",
"0.64601934",... | 0.0 | -1 |
Get the path to the project home. | def get_project_dir():
path = Path(__file__).parent.parent
project_dir = path.parent
return project_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_home_dir(self) -> str:\n ret = os.path.expanduser(\"~\")\n if not os.path.exists(ret):\n raise RuntimeError(\"The home directory does not exist.\")\n return ret",
"def get_home():\n try:\n return str(Path.home())\n except Exception:\n return None",
"d... | [
"0.7934719",
"0.7913755",
"0.7903147",
"0.77641314",
"0.77627724",
"0.7753166",
"0.77065283",
"0.76816046",
"0.75493234",
"0.74950826",
"0.7442712",
"0.7392828",
"0.73816085",
"0.73568374",
"0.7319875",
"0.7319875",
"0.7292292",
"0.7292292",
"0.7292292",
"0.7292292",
"0.7288"... | 0.7057881 | 35 |
Returns the validator class to use in this view. | def get_validator_class(self):
return self.validator_class | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_validator(self):\n return self.get_validator_class()(**self.get_validator_kwargs())",
"def _get_validator(self):\n validator_class = self.validator_class or AssertionValidator\n if validator_class:\n return validator_class()",
"def get_validator_class(self):\n val... | [
"0.8243274",
"0.79300845",
"0.7848973",
"0.7706779",
"0.73115677",
"0.69993067",
"0.6557864",
"0.6449363",
"0.63429374",
"0.63260525",
"0.63238233",
"0.62931705",
"0.6244525",
"0.6226183",
"0.61925113",
"0.6042169",
"0.5915851",
"0.587122",
"0.580683",
"0.57665175",
"0.576567... | 0.8920653 | 0 |
Returns document to validate in this view. | async def get_document(self):
try:
document = await self.request.json()
except json.JSONDecodeError:
document = {}
return document | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDocument(self, *args):\n return _libsbml.SBMLValidator_getDocument(self, *args)",
"def get_document(self):\n return self.document",
"def document(self):\n return self.parent.document()",
"def validate(self, document):\n self.validator.validate(document)",
"def document(se... | [
"0.74251187",
"0.7372481",
"0.68220884",
"0.6817491",
"0.67977846",
"0.6683308",
"0.65857834",
"0.649594",
"0.63451385",
"0.6337889",
"0.63335675",
"0.63308704",
"0.6223521",
"0.6173263",
"0.61398095",
"0.6122092",
"0.6109396",
"0.61067605",
"0.60435236",
"0.6036607",
"0.6028... | 0.6109238 | 17 |
If the document is not valid, return `BAD_REQUEST` response with errors dictionary. | async def document_invalid(self, document, errors):
return web.json_response(data=errors, status=HTTPStatus.BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalid_response():\n return Response(\n '{\"error\": \"Invalid request\"}',\n status=400,\n mimetype='application/json'\n )",
"async def document_valid(self, document):\n return web.json_response()",
"def on_request_validation_error(err):\n print(err)\n return j... | [
"0.68587387",
"0.67495114",
"0.6743826",
"0.6730809",
"0.67269254",
"0.66065073",
"0.65782106",
"0.64640516",
"0.6419074",
"0.63646865",
"0.62810177",
"0.6275731",
"0.61758095",
"0.6174962",
"0.61442274",
"0.6135431",
"0.61216074",
"0.6020187",
"0.6009151",
"0.6001028",
"0.59... | 0.81509954 | 0 |
Get the (command, config) key pair. | def _get_command_config(self, i):
key_pair = list(self._run_list[i].items())[0]
return key_pair | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_key(command):\n return command.split(\" \")[1]",
"def get_config(self):\n return 'c2Key', self.key",
"def get_config(self, key):\n return getattr(self.args, 'conf.{}'.format(key))",
"def getconfig(self, key):\n return self.config[key]",
"def get_config(self, key):\n r... | [
"0.7209971",
"0.69233465",
"0.6844203",
"0.6553127",
"0.6532074",
"0.6437736",
"0.64014226",
"0.63624126",
"0.6352354",
"0.63122886",
"0.62085354",
"0.61743104",
"0.61743104",
"0.6113063",
"0.609891",
"0.6040375",
"0.60321754",
"0.6031019",
"0.60293514",
"0.6011106",
"0.59493... | 0.7254623 | 0 |
Logpdf for a Gaussian distribution w. mean 0 std 1 | def log_pdf_normal(s):
return jnp.sum(norm.logpdf(s)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_gaussian_pdf(x, mu, Sigma):\n m, n, mn = x.shape, mu.shape, Sigma.shape\n assert m == n, \"x and mu must have same shape!\"\n assert len(m) == 1, \"Bad x shape!\"\n assert len(mn) == 2 and mn[0] == mn[1] == m[0], \"Bad Sigma shape!\"\n assert torch.allclose(Sigma, Sigma.t()), \"Sigma must be... | [
"0.7731581",
"0.76559496",
"0.75624776",
"0.74773353",
"0.7445615",
"0.7443862",
"0.73936796",
"0.7388543",
"0.7298472",
"0.7295141",
"0.72763586",
"0.72763586",
"0.7272544",
"0.72552335",
"0.72337765",
"0.722784",
"0.7215883",
"0.72064817",
"0.7203042",
"0.7201917",
"0.71812... | 0.73392856 | 8 |
Return a printable representation of the TLV object. See `TLV.__repr__()` for more information. | def __repr__(self):
return "PortDescriptionTLV(" + repr(self.value) + ")" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"PortIdTLV(\" + repr(self.subtype) + \", \" + repr(self.value) + \")\"",
"def __repr__(self):\n return \"SystemDescriptionTLV(\" + repr(self.value) + \")\"",
"def __repr__(self):\n return \"SystemNameTLV(\" + repr(self.value) + \")\"",
"def __repr__ (self):\... | [
"0.7246289",
"0.6985293",
"0.69278824",
"0.6383975",
"0.6234577",
"0.62188804",
"0.62085414",
"0.6200801",
"0.6112355",
"0.6078668",
"0.6075385",
"0.6075081",
"0.60710496",
"0.6063887",
"0.6058215",
"0.6053679",
"0.6036523",
"0.6030564",
"0.6027066",
"0.6027066",
"0.602252",
... | 0.70687973 | 1 |
Return a printable representation of the TLV object. See `TLV.__repr__()` for more information. | def __repr__(self):
return "SystemDescriptionTLV(" + repr(self.value) + ")" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"PortIdTLV(\" + repr(self.subtype) + \", \" + repr(self.value) + \")\"",
"def __repr__(self):\n return \"PortDescriptionTLV(\" + repr(self.value) + \")\"",
"def __repr__(self):\n return \"SystemNameTLV(\" + repr(self.value) + \")\"",
"def __repr__ (self):\n\... | [
"0.7246289",
"0.70687973",
"0.69278824",
"0.6383975",
"0.6234577",
"0.62188804",
"0.62085414",
"0.6200801",
"0.6112355",
"0.6078668",
"0.6075385",
"0.6075081",
"0.60710496",
"0.6063887",
"0.6058215",
"0.6053679",
"0.6036523",
"0.6030564",
"0.6027066",
"0.6027066",
"0.602252",... | 0.6985293 | 2 |
Return a printable representation of the TLV object. See `TLV.__repr__()` for more information. | def __repr__(self):
return "SystemNameTLV(" + repr(self.value) + ")" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"PortIdTLV(\" + repr(self.subtype) + \", \" + repr(self.value) + \")\"",
"def __repr__(self):\n return \"PortDescriptionTLV(\" + repr(self.value) + \")\"",
"def __repr__(self):\n return \"SystemDescriptionTLV(\" + repr(self.value) + \")\"",
"def __repr__ (se... | [
"0.7246289",
"0.70687973",
"0.6985293",
"0.6383975",
"0.6234577",
"0.62188804",
"0.62085414",
"0.6200801",
"0.6112355",
"0.6078668",
"0.6075385",
"0.6075081",
"0.60710496",
"0.6063887",
"0.6058215",
"0.6053679",
"0.6036523",
"0.6030564",
"0.6027066",
"0.6027066",
"0.602252",
... | 0.69278824 | 3 |
Determine next episode and send an AddonSignal to UpNext addon | def get_upnext_info(videoid, current_episode, metadata):
try:
next_episode_id = _find_next_episode(videoid, metadata)
except (TypeError, KeyError):
import traceback
common.debug(traceback.format_exc())
common.debug('There is no next episode, not setting up Up Next')
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def episode_step(self):\n self.nsteps += 1",
"def _update_episode(self):\n if self.episode_num > 0:\n self._publish_reward_topic(\n self.accumulated_episode_reward,\n self.episode_steps,\n self.episode_num\n )\n\n self.episod... | [
"0.6617169",
"0.64060324",
"0.61651",
"0.60502654",
"0.6035842",
"0.5962241",
"0.58771014",
"0.5829904",
"0.57190144",
"0.57032806",
"0.5609278",
"0.5608016",
"0.55934364",
"0.55825794",
"0.5579853",
"0.554337",
"0.5523904",
"0.54948837",
"0.5445082",
"0.5439062",
"0.5438413"... | 0.56608975 | 10 |
Unload a config entry. | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)
return unload_ok | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def async_unload_entry(hass, config_entry):\n unload_ok = await hass.config_entries.async_forward_entry_unload(\n config_entry, \"climate\"\n )\n return unload_ok",
"async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:\n hass.data.pop(DOMAIN)\n return True",
... | [
"0.697284",
"0.6888074",
"0.6779855",
"0.6747459",
"0.6689002",
"0.6657831",
"0.66162205",
"0.6603433",
"0.65925974",
"0.65595686",
"0.65411645",
"0.6507643",
"0.6507643",
"0.6507643",
"0.6507643",
"0.64977276",
"0.64931643",
"0.6469397",
"0.6469397",
"0.6462678",
"0.6459733"... | 0.6486601 | 19 |
Returns True if this is a comment node. | def is_comment(self):
return (self.__type & NODE_COMMENT) == NODE_COMMENT | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_comment(self) -> bool: # pragma: no cover TODO?\n return all(seg.is_comment for seg in self.segments)",
"def IsComment(self, pos):\n pos = max(0, pos-1)\n return 'comment' in self.FindTagById(self.GetStyleAt(pos))",
"def isComment(self, lineData, column):\n return self._getT... | [
"0.79120904",
"0.7662381",
"0.72815293",
"0.69495374",
"0.6905425",
"0.6846143",
"0.67593604",
"0.67586464",
"0.6670518",
"0.65992427",
"0.6316259",
"0.6275988",
"0.6141722",
"0.61098295",
"0.6091506",
"0.60755944",
"0.6073822",
"0.6019702",
"0.6006977",
"0.5949574",
"0.59487... | 0.8994824 | 0 |
Returns True if this node represents a tag. | def is_tag(self):
return (self.__type & NODE_TAG) == NODE_TAG and not self.is_root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_tag(t):\n return len(t) > 1 and t.startswith('#') and not t.startswith('##') and t",
"def has_tags(self):\n return bool(self.tags)",
"def has_tags_in_content(self):\n\t\treturn self.get_content() and re_tag.search(self.get_content())",
"def has_tag(self, tag):\n return tag in self.tag... | [
"0.7240326",
"0.71821105",
"0.70176226",
"0.69132286",
"0.69132286",
"0.6844631",
"0.683257",
"0.6789491",
"0.6384831",
"0.6304441",
"0.62710667",
"0.62529296",
"0.6241363",
"0.6241363",
"0.6210151",
"0.61965394",
"0.61740637",
"0.6164906",
"0.61567104",
"0.6084214",
"0.60823... | 0.8794559 | 0 |
Returns True if this node represents a flag (has no values). | def is_flag(self):
return (self.__type & NODE_TAG) and isinstance(self.__value, bool) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_flags_set(self):\n # TODO: unit test me\n return not any(\n (\n self.flag_bookmarked,\n self.flag_candidate,\n self.flag_final_causative,\n self.flag_for_validation,\n self.flag_molecular != \"empty\",\n ... | [
"0.7356424",
"0.69481957",
"0.69481957",
"0.68576056",
"0.6784374",
"0.6779199",
"0.6636929",
"0.6616299",
"0.6611534",
"0.66003025",
"0.65997267",
"0.65932417",
"0.6565266",
"0.6543698",
"0.65229577",
"0.65177953",
"0.6496749",
"0.6492469",
"0.64622575",
"0.646213",
"0.64614... | 0.8125009 | 0 |
Returns the parent for this node, or itself if this is the root. | def parent(self):
return self if self.is_root else self.__parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parent(self):\n return BinaryNode.or_none(self.parent)",
"def get_parent(self):\n if self.parent:\n return self.parent()\n else:\n return None",
"def parent(self):\n if self._parent is not None:\n return self._parent()\n else:\n ... | [
"0.856929",
"0.84282327",
"0.8328764",
"0.81057936",
"0.80961186",
"0.7988406",
"0.7948163",
"0.78941303",
"0.78779346",
"0.78615546",
"0.78330046",
"0.78330046",
"0.78330046",
"0.77881163",
"0.7783349",
"0.7783349",
"0.77624553",
"0.7753518",
"0.7716063",
"0.7708775",
"0.767... | 0.85828876 | 0 |
Returns the filename for this raw file. | def filename(self):
# pylint: disable=protected-access
return self.root.__value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_name(self):\n return str(self.get_file())",
"def filename(self):\n # TODO(aron): write tests for this\n\n return os.path.basename(self.file_on_disk.name)",
"def get_filename(self) -> str:\n return self._filename",
"def get_file_name(self):\n return self.__file_... | [
"0.85229015",
"0.8244313",
"0.82326823",
"0.82136124",
"0.8191065",
"0.8191065",
"0.8191065",
"0.8191065",
"0.8191065",
"0.8186688",
"0.81790274",
"0.8176685",
"0.80828065",
"0.80742437",
"0.80691797",
"0.804323",
"0.80240625",
"0.80173075",
"0.8003783",
"0.79880214",
"0.7981... | 0.74244094 | 56 |
Returns the unparsed value for this node. | def value(self):
return self.__value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unmarshal(self):\n return self.value",
"def value(self):\n return self.node_value",
"def read_value(self):\n return self.load_attr(\"value\")",
"def _value(self):\n if self.data is None:\n return self._original_value\n elif self.get_label:\n return... | [
"0.7555585",
"0.7368114",
"0.7309076",
"0.7152215",
"0.7113398",
"0.71029705",
"0.7019766",
"0.69859666",
"0.6967895",
"0.6951425",
"0.6940481",
"0.69335777",
"0.68943983",
"0.6880859",
"0.6861052",
"0.68494684",
"0.6841776",
"0.6815348",
"0.68119234",
"0.68119234",
"0.681192... | 0.68670005 | 15 |
Bind a variable of the given type with the current statement. Variables objects values can be queried to retrieve OUT param values. | def bind(self, bindname, sqltype, value=None):
datatype = _TYPES[sqltype.upper()]
var = self.cursor.var(datatype)
if value is not None:
var.setvalue(0,value)
self.bindparams[bindname.upper()] = var | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_for_value(self: Parser, node: doc.expr, var_name: str, value: Any) -> Any:\n if isinstance(value, (list, tuple, tvm.ir.Array)):\n for i, v in enumerate(value):\n bind_for_value(self, node, f\"{var_name}_{i}\", v)\n return value\n elif isinstance(value, Var):\n IRBuild... | [
"0.5718155",
"0.5630315",
"0.56282705",
"0.5616632",
"0.55968034",
"0.5493547",
"0.54558444",
"0.5431594",
"0.5388043",
"0.5301396",
"0.52867293",
"0.52445066",
"0.5210293",
"0.5190899",
"0.5041345",
"0.50267035",
"0.5009522",
"0.4987014",
"0.49470353",
"0.49455816",
"0.49305... | 0.6701316 | 0 |
Propagate the input vector forward through the neural network. | def forward_propagate(self):
for i in range(0, len(self.output_layer)):
output = 0
# Loop through each Neuron in the hidden layer
for neuron in self.hidden_layer:
output += neuron.weights[i] * neuron.output
# Update summation for output classifie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forwardPropagate(self, inputVector):\r\n # Preform the forward propagation through the layers\r\n # setting the output of one layer to the input of the next\r\n for layer in self.layers:\r\n inputVector = layer.forwardPropagate(inputVector)\r\n # The output of the last la... | [
"0.80711675",
"0.7814496",
"0.7641096",
"0.7629808",
"0.754058",
"0.75103784",
"0.7510134",
"0.74768597",
"0.7459633",
"0.7450454",
"0.7388287",
"0.7348218",
"0.73218983",
"0.7292622",
"0.72895765",
"0.72766644",
"0.7265557",
"0.72490364",
"0.7210622",
"0.7207798",
"0.7207621... | 0.71920455 | 24 |
Return new pop. The ELITE_SIZE best individuals are appended to new pop if they are better than the worst individuals in new pop | def generational_replacement(new_pop, individuals):
individuals.sort(reverse=True)
for ind in individuals[:ELITE_SIZE]:
new_pop.append(copy.copy(ind))
new_pop.sort(reverse=True)
return new_pop[:GENERATION_SIZE] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generational(new_pop, old_pop):\r\n\r\n # Sort both populations.\r\n old_pop.sort(reverse=True)\r\n new_pop.sort(reverse=True)\r\n \r\n # Append the best ELITE_SIZE individuals from the old population to the\r\n # new population.\r\n for ind in old_pop[:params['ELITE_SIZE']]:\r\n ne... | [
"0.79595697",
"0.6765262",
"0.67575866",
"0.6539169",
"0.65309393",
"0.6396165",
"0.6380798",
"0.6367837",
"0.63484055",
"0.6235316",
"0.61807036",
"0.6154458",
"0.6087684",
"0.60683477",
"0.60272914",
"0.6003212",
"0.5997903",
"0.5991835",
"0.5977085",
"0.5976463",
"0.595383... | 0.67628944 | 2 |
Return individuals. If the best of new pop is better than the worst of individuals it is inserted into individuals | def steady_state_replacement(new_pop, individuals):
individuals.sort(reverse=True)
individuals[-1] = max(new_pop + individuals[-1:])
return individuals | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generational(new_pop, old_pop):\r\n\r\n # Sort both populations.\r\n old_pop.sort(reverse=True)\r\n new_pop.sort(reverse=True)\r\n \r\n # Append the best ELITE_SIZE individuals from the old population to the\r\n # new population.\r\n for ind in old_pop[:params['ELITE_SIZE']]:\r\n ne... | [
"0.69968814",
"0.69953835",
"0.68902206",
"0.6673147",
"0.6641417",
"0.65611976",
"0.64394474",
"0.6333472",
"0.63141215",
"0.628392",
"0.6198198",
"0.6174558",
"0.6168565",
"0.61410123",
"0.61342406",
"0.6128879",
"0.6123241",
"0.6120936",
"0.6085956",
"0.60415244",
"0.60033... | 0.6182623 | 11 |
Convert a tuple to a mapping string. | def tuple_to_string(letter_word_pair):
letter, word = letter_word_pair
return '{letter}: {word}'.format(letter=letter, word=word) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _tupstr(tuple_):\n return ', '.join(list(map(str, tuple_)))",
"def str_tuple(item):\n return \"{}:{}\".format(item[0], item[1])",
"def tuple_to_string(transcript_info):\n\n return \"\\t\".join(transcript_info.data_attributes())",
"def _tuple_to_str(self, the_tuple):\r\n ret = \"\"\r\n ... | [
"0.69497496",
"0.6596529",
"0.639058",
"0.6390457",
"0.6103224",
"0.60849404",
"0.5948123",
"0.5934937",
"0.5831839",
"0.58157665",
"0.5740703",
"0.5671038",
"0.5651732",
"0.56392044",
"0.55840087",
"0.5553429",
"0.55464953",
"0.551565",
"0.5497186",
"0.5492532",
"0.5444475",... | 0.702475 | 0 |
Get all the product_categories data Ignore > GET Returns the product_categories data. | def item_categories(request):
all_item_categories = ItemType.objects.all() # Get all product_categories
if request.method == 'GET':
if all_item_categories:
item_category_serializer = ItemCategorySerializer(all_item_categories, many=True)
return Response(item_category_serializer.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)",
"def list(self, request):\n product_category = ProductCategory.objects.all()\n\n # Support filtering ProductCategorys by area id\n # name = self.request.query_params.get... | [
"0.7681457",
"0.7563185",
"0.7509101",
"0.74188405",
"0.741363",
"0.7391255",
"0.7342178",
"0.732911",
"0.72756416",
"0.72460496",
"0.7164718",
"0.71486217",
"0.70930475",
"0.7091469",
"0.70764405",
"0.702341",
"0.701301",
"0.6967838",
"0.6946917",
"0.69173676",
"0.69093025",... | 0.73078334 | 8 |
Get all the product_categories data Ignore > GET Returns the product_categories data. | def categories(request, pk):
if Category.objects.filter(item_type_id=pk).exists(): # Checks if product_category exists with given id.
all_categories = Category.objects.filter(item_type_id=pk)
else:
return Response(messages.CATEGORY_ITEM_DOES_NOT_EXIST, status=status.HTTP_404_NOT_FOUND)
if r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)",
"def list(self, request):\n product_category = ProductCategory.objects.all()\n\n # Support filtering ProductCategorys by area id\n # name = self.request.query_params.get... | [
"0.76814175",
"0.7564187",
"0.75102305",
"0.7419327",
"0.74134034",
"0.7391983",
"0.73433155",
"0.7329331",
"0.7308691",
"0.7276488",
"0.72475564",
"0.71650213",
"0.71495235",
"0.70929056",
"0.7092253",
"0.70773965",
"0.7024152",
"0.7015201",
"0.69690156",
"0.6947148",
"0.691... | 0.6778492 | 30 |
Get all the product_categories data Ignore > GET Returns the product_categories data. | def items(request, pk):
if Item.objects.filter(category_id=pk).exists(): # Checks if product_category exists with given id.
all_items = Item.objects.filter(category_id=pk)
else:
return Response(messages.ITEMS_DOES_NOT_EXIST, status=status.HTTP_404_NOT_FOUND)
if request.method == 'GET':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)",
"def list(self, request):\n product_category = ProductCategory.objects.all()\n\n # Support filtering ProductCategorys by area id\n # name = self.request.query_params.get... | [
"0.76814175",
"0.7564187",
"0.75102305",
"0.7419327",
"0.74134034",
"0.7391983",
"0.73433155",
"0.7329331",
"0.7308691",
"0.7276488",
"0.72475564",
"0.71650213",
"0.71495235",
"0.70929056",
"0.7092253",
"0.70773965",
"0.7024152",
"0.7015201",
"0.69690156",
"0.6947148",
"0.691... | 0.0 | -1 |
Get all the product_categories data Ignore > GET Returns the product_categories data. | def cart_detail(request, pk):
data = request.data
try:
user = validations_utils.user_validation(pk) # Validates if user exists or not.
token_user_id = validations_utils.user_token_validation(
request.auth.user_id, pk) # Validates user's Token authentication.
except ValidationEx... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories(self):\n _url = urljoin(self.base_url, self.API_CATEGORIES)\n return requests.get(_url)",
"def list(self, request):\n product_category = ProductCategory.objects.all()\n\n # Support filtering ProductCategorys by area id\n # name = self.request.query_params.get... | [
"0.76814175",
"0.7564187",
"0.75102305",
"0.7419327",
"0.74134034",
"0.7391983",
"0.73433155",
"0.7329331",
"0.7308691",
"0.7276488",
"0.72475564",
"0.71650213",
"0.71495235",
"0.70929056",
"0.7092253",
"0.70773965",
"0.7024152",
"0.7015201",
"0.69690156",
"0.6947148",
"0.691... | 0.0 | -1 |
Constructor for base class Person's name | def __init__(self, name):
# Person class has an attribute called name
self.name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, base):\n if isinstance(base, str):\n self._name = base\n else:\n raise TypeError(NAME_CREATE_ERROR)",
"def __init__(self, name: str):\n self.name = name",
"def __init__(self, name):\n self.name = name\n self.birthday = None\n se... | [
"0.781313",
"0.699353",
"0.6988692",
"0.6988692",
"0.6988692",
"0.6985439",
"0.6974231",
"0.69125396",
"0.68925595",
"0.6817481",
"0.68146926",
"0.68146926",
"0.68146926",
"0.68146926",
"0.68146926",
"0.68146926",
"0.68146926",
"0.68146926",
"0.68146926",
"0.68146926",
"0.681... | 0.75173634 | 1 |
Try to get the users home directory | def get_home_directory():
try:
directory=os.path.expanduser("~")
except EnvironmentError:
directory=None
return directory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_home():\n from os.path import expanduser\n home = expanduser('~')\n return home",
"def get_user_homedir():\n return os.path.expanduser(\"~\")",
"def get_home_dir(self) -> str:\n ret = os.path.expanduser(\"~\")\n if not os.path.exists(ret):\n raise RuntimeError(\"Th... | [
"0.8538528",
"0.8410052",
"0.83198804",
"0.82374805",
"0.8123965",
"0.8045228",
"0.8024794",
"0.78633654",
"0.7849291",
"0.7849291",
"0.78382003",
"0.77970535",
"0.77954364",
"0.76852405",
"0.75492793",
"0.7500374",
"0.7429111",
"0.7381332",
"0.73506993",
"0.7156498",
"0.7087... | 0.86352926 | 0 |
Try to get the environment variable | def get_environment_variable(name):
variable = None
try:
variable = os.environ[name]
except KeyError:
pass
return variable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_env(key: str) -> str:\n value = os.getenv(key)\n assert isinstance(value, str), (\n f\"the {key} environment variable must be set and a string, \" f\"{value=}\"\n )\n return value",
"def getenv_check(e):\n res = os.getenv(e)\n if res == None:\n print(e... | [
"0.7922523",
"0.7904368",
"0.7747956",
"0.7744829",
"0.771275",
"0.76997155",
"0.7694719",
"0.7635385",
"0.7578197",
"0.7578146",
"0.7576736",
"0.75353616",
"0.7526878",
"0.7498512",
"0.7468079",
"0.7444384",
"0.74365205",
"0.74335724",
"0.7429172",
"0.7413361",
"0.7394916",
... | 0.7812868 | 2 |
Whether to use L2 weight decay for `param_name`. | def _do_use_weight_decay(self, param_name):
if not self._weight_decay:
return False
if self._exclude_from_weight_decay:
for r in self.exclude_from_weight_decay:
if re.search(r, param_name) is not None:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _do_use_weight_decay(self, param_name):\n if not self.weight_decay_rate:\n return False\n if self.exclude_from_weight_decay:\n for r in self.exclude_from_weight_decay:\n if re.search(r, param_name) is not None:\n return False\n return True",
"def _do_use_weight_decay(self, ... | [
"0.70576096",
"0.70576096",
"0.70576096",
"0.70576096",
"0.70576096",
"0.70423925",
"0.6972458",
"0.6972458",
"0.6972458",
"0.6972458",
"0.61478865",
"0.61143965",
"0.60728186",
"0.5874968",
"0.57316977",
"0.5686603",
"0.5607701",
"0.5540735",
"0.5532297",
"0.5527218",
"0.549... | 0.70372206 | 6 |
Find gtool3 axis file with given axis name `name` from path listed as `search_path`. Return path of the found axis file or `None` unless found. | def find_axfile(name, search_path=[u".", u"$GT3AXISDIR", u"$GTOOLDIR/gt3"]):
axis_path = map(os.path.expandvars, search_path)
axis_path = [a for a in axis_path if a.find('$') < 0]
axis_path = [a for a in axis_path if os.path.exists(a)]
if (opt_debug):
print('*** axis_path:')
print(axis_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SearchPath(name):\n search_path = os.getenv('PATH', os.defpath).split(os.pathsep)\n for directory in search_path:\n if directory:\n path = os.path.join(directory, name)\n if os.path.isfile(path) and os.access(path, os.X_OK):\n return path\n return None",
"def search_file(filename, sear... | [
"0.6184748",
"0.58979213",
"0.5890973",
"0.58522314",
"0.558576",
"0.55716026",
"0.5541444",
"0.5541444",
"0.5410422",
"0.5398494",
"0.5370474",
"0.533268",
"0.53245276",
"0.52962524",
"0.52576935",
"0.52200776",
"0.5149255",
"0.513129",
"0.5103574",
"0.5078814",
"0.5074145",... | 0.81556225 | 0 |
Create a BulletML instance based on YAML. | def FromYAML(cls, source):
# Late import to avoid a circular dependency.
try:
import bulletml.bulletyaml
import yaml
except ImportError:
raise ParseError("PyYAML is not available")
else:
try:
return yaml.load(source)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_yaml(cls, yml: str):\n\n return cls.from_dict(feast_yaml.yaml_loader(yml, load_single=True))",
"def from_yaml(cls, model: nn.Module, yaml_path: str) -> pl.LightningModule:\n with open(yaml_path, \"r\") as stream:\n kwargs = yaml.full_load(stream)\n\n return cls(model, **k... | [
"0.65108067",
"0.63942486",
"0.6239388",
"0.6003386",
"0.597558",
"0.58594686",
"0.5834136",
"0.5807748",
"0.57719135",
"0.57485634",
"0.56852",
"0.56000435",
"0.54869735",
"0.54771805",
"0.54528856",
"0.5418611",
"0.54178613",
"0.53845954",
"0.53789043",
"0.5367835",
"0.5366... | 0.61952394 | 3 |
return replacement for tag which is a string. If in the form , then strip if no replacements for label, then return "NOREPLACEMENT" else return a random replacement | def getReplacement(tag):
global repd
# read files to load global
# dictionary if hasn't been read before
if len(repd.keys()) == 0:
readDirectory()
# tag shouldn't have <>, but be safe
if tag.startswith("<"):
end = tag.find(">")
tag = tag[1:end]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_attribute(text, tag, obj_group, eliminate=False):\n\n group = get_tag_group(tag)\n if mapping(tag) == 'relation':\n # Actual relation tag, else position tag.\n if tag == '<R>':\n relation_list = gvars.METAINFO['relation_phrases'][obj_group['relation']]\n relation_cand = random.choice(... | [
"0.58716357",
"0.58229244",
"0.5793549",
"0.5784294",
"0.5600314",
"0.5595942",
"0.54749954",
"0.54682237",
"0.5433384",
"0.54327196",
"0.5429653",
"0.54279774",
"0.54167116",
"0.5409871",
"0.53206944",
"0.5303598",
"0.52705145",
"0.5253558",
"0.52434784",
"0.5234095",
"0.522... | 0.6774744 | 0 |
Format an ammount in pence as an ammount in GBP. | def money_format(ammount):
d = Decimal(ammount) / Decimal("100")
return u'£%s' % d.quantize(Decimal("0.01")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_value(self, v):\n return \"%.4g\" % v",
"def represent_percent(self, dlpkgs, numpkgs, length):\n if dlpkgs == 0:\n return '{0:^{1}s}'.format('-', length)\n else:\n return '{0:^{1}s}'.format(self.pct(dlpkgs, numpkgs), length)",
"def get_gpa(current_bucket_g... | [
"0.6491079",
"0.6308885",
"0.61206007",
"0.5935626",
"0.59288746",
"0.5915569",
"0.5905836",
"0.589344",
"0.5875807",
"0.5835357",
"0.58302593",
"0.58274287",
"0.5810727",
"0.5772225",
"0.575328",
"0.57445943",
"0.5727824",
"0.5723134",
"0.57109773",
"0.5701605",
"0.5695287",... | 0.6878547 | 0 |
Node x node_state matrix. | def state_nodes(self) -> np.ndarray:
return np.array([[nd[c] for c in ["alive", "infected", "immune", "isolated", "masked"]]
for nv, nd in self.g_.nodes.data()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_nodes(self):\n \n # For all state nodes\n node = 0\n \n for i in range(self.x0_n):\n for j in range(self.x1_n):\n for k in range(self.x2_n):\n \n # State\n x = np.array([ self.xd[0][i] , ... | [
"0.7241113",
"0.72191995",
"0.64411753",
"0.6420786",
"0.64107",
"0.63057274",
"0.62295747",
"0.6165247",
"0.61496335",
"0.6143668",
"0.6041189",
"0.59956837",
"0.5946004",
"0.5889206",
"0.58653194",
"0.58580774",
"0.5847802",
"0.5841347",
"0.5820161",
"0.57469934",
"0.574655... | 0.7016654 | 2 |
Return a config setting | def get_config(self, name):
return self.configs[name][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setting(self, config, name, default=None):\n\n return config.get(name, default) if config else default",
"def get_config(setting, config=CONFIG):\n try:\n return config[setting]\n except KeyError:\n raise ImproperlyConfigured(\"Set the {} setting\".format(setting))",
"def get_con... | [
"0.7657275",
"0.76526624",
"0.7504242",
"0.7489367",
"0.7414477",
"0.74127877",
"0.7371357",
"0.7323078",
"0.7279464",
"0.7257825",
"0.71541905",
"0.7146362",
"0.7141664",
"0.7127709",
"0.7081458",
"0.70422393",
"0.7019799",
"0.6997422",
"0.6997422",
"0.6997422",
"0.6997422",... | 0.72391963 | 10 |
Write a JSON file | def json_write(data, path, **kwargs):
with open(_fsdecode(path), 'wt') as file:
_json_dump(data, file, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)",
"def _write_json(self):\n with open(self._file_path, 'w') as f:\n json.dump(self._content, f, indent=4, separators=None,\n encod... | [
"0.8308374",
"0.8299397",
"0.827724",
"0.827724",
"0.8214866",
"0.81938595",
"0.8163343",
"0.81385314",
"0.80963945",
"0.80523306",
"0.80359995",
"0.80319965",
"0.8029772",
"0.801234",
"0.8006942",
"0.7998761",
"0.79928875",
"0.7966954",
"0.79610646",
"0.79517615",
"0.7918418... | 0.7765633 | 34 |
Returns starting state of the board. | def initial_state():
return [[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY],
[EMPTY, EMPTY, EMPTY]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_state(self):\r\n return np.zeros(self.board_size, dtype=np.int8)",
"def start_state():\n return chess.Board()",
"def startingState(self):\n # Returns starting position and 4 false because no corners are visited yet\n return (self.startingPosition, (False, False, False, False))... | [
"0.8081514",
"0.7890486",
"0.7534929",
"0.72789717",
"0.72789717",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
"0.72262055",
... | 0.0 | -1 |
Returns player who has the next turn on a board. | def player(board):
x_counter = 0
o_counter = 0
for i in range(3):
for j in range(3):
if board[i][j] == X:
x_counter += 1
elif board[i][j] == O:
o_counter += 1
# print(f"x: {x_counter}")
# print(f"o: {o_counter}")
if x_cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_player(board, prev_player):\n opp = Othello.opponent(prev_player)\n if Othello.any_legal_move(opp, board):\n return opp\n elif Othello.any_legal_move(prev_player, board):\n return prev_player\n return None",
"def next_player(self,board, prev_player):\r\n... | [
"0.7911148",
"0.7521969",
"0.74204457",
"0.73687756",
"0.71954805",
"0.69775087",
"0.69621766",
"0.69253695",
"0.69208723",
"0.69010353",
"0.6845991",
"0.6841043",
"0.6838282",
"0.68265843",
"0.67751175",
"0.67751175",
"0.6769739",
"0.6713109",
"0.67060393",
"0.66561204",
"0.... | 0.0 | -1 |
Returns the optimal action for the current player on the board. | def minimax(board):
current_player = player(board) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_action(self):\n if self.bestAction is None:\n self.calculate_best_action()\n return self.bestAction",
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = min... | [
"0.77687955",
"0.76336724",
"0.75853777",
"0.75287056",
"0.75184536",
"0.74660885",
"0.74603",
"0.7425707",
"0.7417552",
"0.7395776",
"0.7374339",
"0.73361117",
"0.73148525",
"0.7307234",
"0.72848594",
"0.72660655",
"0.72660655",
"0.7251144",
"0.7233601",
"0.7203659",
"0.7174... | 0.0 | -1 |
Evaluate whether a word can be found in a Boggle board. | def find(board, word, available_tiles=None, current_path=[]):
# If there are no available tiles, it means that a new search has started,
# either for a new word, or a search that begins at a new position on the
# board (looking for a new path to find the word). In this case, the
# available tiles are ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(board, word):\r\n for i, row in enumerate(board):\r\n for j, square in enumerate(row):\r\n if square == word[0]:\r\n res = neighbors(board, word, i, j)\r\n if res:\r\n return True\r\n return False",
"def check_word(word):\r\n if... | [
"0.702353",
"0.7012819",
"0.6971651",
"0.6795284",
"0.67463535",
"0.67044175",
"0.6698798",
"0.669703",
"0.6694517",
"0.66888475",
"0.66460234",
"0.6609016",
"0.6602355",
"0.65934014",
"0.6575317",
"0.65568274",
"0.65563655",
"0.65426075",
"0.6540241",
"0.65332115",
"0.651930... | 0.0 | -1 |
Load all elements from self.element_paths. This populates self.loaded_elements. | def load_elements(self):
for path in self.element_paths:
self.process_path(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_dependencies(self):\n all_elements = expand_dependencies(\n self.elements, ':'.join(self.element_paths))\n self.elements = all_elements",
"def LoadAllSubElements(self, recursive=False):\n pass",
"def _load_all(self):\n if self._loaded_all is True:\n return... | [
"0.7635657",
"0.6357328",
"0.6117186",
"0.6090534",
"0.60454404",
"0.5919273",
"0.5791661",
"0.5780232",
"0.5743728",
"0.56964123",
"0.5619189",
"0.5576207",
"0.55558985",
"0.5554553",
"0.54997844",
"0.54957306",
"0.5468874",
"0.54412687",
"0.54066837",
"0.5405423",
"0.536447... | 0.90531063 | 0 |
Load and add all element dependencies to self.elements. | def load_dependencies(self):
all_elements = expand_dependencies(
self.elements, ':'.join(self.element_paths))
self.elements = all_elements | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_elements(self):\n for path in self.element_paths:\n self.process_path(path)",
"def _set_elements(self, elements):\n self._elements = elements",
"def _load_attrs_requirements(self) -> None:\n if self.element not in self.attr_requirements:\n return\n sel... | [
"0.75069433",
"0.58750045",
"0.5820944",
"0.5700825",
"0.56621534",
"0.5629692",
"0.55607593",
"0.5516276",
"0.5473411",
"0.54728276",
"0.5464895",
"0.5446507",
"0.53853947",
"0.5378851",
"0.536921",
"0.5359193",
"0.53327394",
"0.5326197",
"0.53081894",
"0.53064513",
"0.52611... | 0.86729217 | 0 |
Randomizes the order of data samples and their corresponding labels | def randomize(x, y, x_len):
permutation = np.random.permutation(y.shape[0])
shuffled_x = x[permutation, :]
shuffled_y = y[permutation]
shuffled_x_len = x_len[permutation]
return shuffled_x, shuffled_y, shuffled_x_len | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle_labels(self):\n random.shuffle(self.y_train)\n random.shuffle(self.y_test)",
"def inlabel_shuffle(data):\n num_zero_data = np.sum(data[:,-1]==0)\n label_zero_data = data[:num_zero_data,:]\n label_one_data = data[num_zero_data:,:]\n np.random.shuffle(label_zero_data)\n np.random.shu... | [
"0.7610801",
"0.72624075",
"0.71498376",
"0.71094793",
"0.7101863",
"0.70504063",
"0.6969117",
"0.6969117",
"0.6969117",
"0.69373816",
"0.69088066",
"0.6856464",
"0.6789744",
"0.6737744",
"0.6674642",
"0.6634555",
"0.6630403",
"0.6464263",
"0.6435945",
"0.6421794",
"0.6305728... | 0.0 | -1 |
Get the full path of the image file in the kapture. If image file name is missing, this gives the top directory of the images. | def get_image_fullpath(kapture_dir_path: str, image_filename: Optional[str] = None) -> str:
return get_record_fullpath(kapture_dir_path, image_filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_path(self) -> Optional[str]:\n if not self.image or not self.image.file_path:\n return None\n return self.image.file_path",
"def img_dir(self):\n try:\n return dirname(self.img_files[0])\n except:\n return \"Not available\"",
"def root_... | [
"0.7438605",
"0.7431139",
"0.726623",
"0.7253213",
"0.7232405",
"0.7224804",
"0.71323526",
"0.7118172",
"0.70742583",
"0.7046817",
"0.7022887",
"0.7008672",
"0.69825804",
"0.6981243",
"0.69773847",
"0.6953627",
"0.69344705",
"0.68576354",
"0.68468916",
"0.6834266",
"0.6816343... | 0.782768 | 0 |
Generates a random card out of a deck. | def get_card(self):
card = random.randint(1,13)
return card | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_a_card(cards):\n import random\n card_drawn = random.choices(card_deck)\n cards.append(card_drawn[0])\n return",
"def generate_deck(deck_number: int) -> List[Card]:\n all_cards = list(product([i for i in range(2, 15)], CARD_SUITS)) * deck_number\n shuffle(all_cards)\n return [Card(*... | [
"0.74808776",
"0.7417163",
"0.72672516",
"0.7250951",
"0.7250429",
"0.72410744",
"0.7190901",
"0.71423733",
"0.71354586",
"0.70854247",
"0.7053803",
"0.7018945",
"0.6994085",
"0.6973632",
"0.695019",
"0.683378",
"0.68132895",
"0.68086743",
"0.67532504",
"0.66249406",
"0.66108... | 0.73450255 | 2 |
Compute area within extreme points divided by total rectangular area. | def extreme_points_area(x):
n = len(x)
pos_min = np.argmin(x)
pos_max = np.argmax(x)
x_iter = x[1:-1]
if len(x_iter):
xinit = 0
xmin = pos_min
xmax = pos_max
xlast = n
yinit = x[0]
ymin = x[pos_min]
ymax = x[pos_max]
ylast = x[-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_area(self):\n return numpy.prod([r[1] - r[0] for r in self.range_])",
"def area(self):\n if isinstance(self.crs, GeographicalCRS):\n major_axis = self.crs.ellipsoid.a\n minor_axis = self.crs.ellipsoid.b\n\n area = 0.0\n if major_axis == minor_ax... | [
"0.7508512",
"0.72963566",
"0.717188",
"0.7147863",
"0.7116873",
"0.6952968",
"0.68500996",
"0.68384135",
"0.6811012",
"0.6809647",
"0.6805067",
"0.67864555",
"0.67833245",
"0.6777446",
"0.6748803",
"0.67321765",
"0.67079955",
"0.66916",
"0.6682642",
"0.6677476",
"0.66736674"... | 0.70748335 | 5 |
Convert torch.Tensor to np.ndarray. | def tensor2np(x):
return x.cpu().numpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _torch_to_numpy(tensor):\n return tensor.detach().cpu().numpy()",
"def to_numpy(tensor):\n raise NotImplementedError",
"def to_numpy(x):\n if isinstance(x, torch.Tensor):\n x = x.cpu().detach().numpy()\n return x",
"def to_numpy(tensor: torch.Tensor) -> np.ndarray:\n\n return (\... | [
"0.8792341",
"0.8669351",
"0.8364438",
"0.81377304",
"0.78867817",
"0.78581226",
"0.7845422",
"0.76115113",
"0.7564423",
"0.7490343",
"0.74059236",
"0.73312527",
"0.7305127",
"0.73012763",
"0.7248118",
"0.7237875",
"0.71136487",
"0.7094349",
"0.70864075",
"0.70842844",
"0.708... | 0.7812185 | 7 |
fill Nan value by normal range | def fill_nan(data, fm, filename):
print("fill Nan begining...")
# fill categorical variable
categorical_variable_fill = pd.read_excel("./data/VariableFill.xlsx", dtype={'Name': str, 'Value': float})
categorical_features = categorical_variable_fill['Variable'].values
categorical_variable_fill.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_nan(A):\n\tinds = np.arange(A.shape[0])\n\tgood = np.where(np.isfinite(A))\n\tA[np.isnan(A)] = np.interp(inds[np.isnan(A)], inds[good], A[good])\n\treturn A",
"def fill_nan(array):\n idx = np.arange(array.shape[0])\n good = np.where(np.isfinite(array))\n interp = interpo... | [
"0.74053985",
"0.7231394",
"0.68640417",
"0.685288",
"0.67846423",
"0.676639",
"0.66914076",
"0.66877216",
"0.66795295",
"0.66183907",
"0.6612339",
"0.654159",
"0.6490551",
"0.6470656",
"0.64445406",
"0.63924974",
"0.6383988",
"0.6360333",
"0.6338555",
"0.6331448",
"0.6330061... | 0.5447881 | 93 |
Constructor text text to be shown by the label (string) hg reference to the Mercurial interface object (Hg) useClient flag indicating to use the command server client if possible (boolean) parent parent widget (QWidget) | def __init__(self, text, hg=None, useClient=True, parent=None):
super(HgDialog, self).__init__(parent)
self.setupUi(self)
self.setWindowFlags(Qt.Window)
self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
self.buttonBox.button(QDialogButtonBox.Cancel).setDefa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, text='', **kwargs):\n Control.__init__(self, text=text, **kwargs)",
"def __init__(self, parent, text_link=None):\n Frame.__init__(self, parent)\n if text_link is None:\n text_link = StringVar(value=\"Running\")\n self._text = text_link\n self._labe... | [
"0.5928803",
"0.5702405",
"0.5594525",
"0.55567986",
"0.54743636",
"0.54666114",
"0.5429643",
"0.542671",
"0.54149055",
"0.5407002",
"0.53744245",
"0.537253",
"0.535889",
"0.53240734",
"0.5316818",
"0.53126323",
"0.5258187",
"0.52488935",
"0.5247784",
"0.5246498",
"0.52418435... | 0.80289763 | 0 |
Write a Python3 function bigram(l1,l2) which takes two sorted lists of positions as argument. The function returns "True" if there is a position p in the first list such that there is a position p+1 in the second list. In all other cases the function returns "False". Your solution should exploit the fact that both list... | def bigram(l1, l2):
# This was an attempt to implement a less naive way of intersection...
# it1 = iter(l1)
# it2 = iter(l2)
# sol = False
#
# n1 = next(it1)
# n2 = next(it2)
# while True:
# try:
# if n1 == n2 + 1:
# return True
# else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bigram_dice_coefficient(a, b):\r\n if not len(a) or not len(b): return 0.0\r\n if len(a) == 1: a=a+u'.'\r\n if len(b) == 1: b=b+u'.'\r\n \r\n a_bigram_list=[]\r\n for i in range(len(a)-1):\r\n a_bigram_list.append(a[i:i+2])\r\n b_bigram_list=[]\r\n for i in range(len(b)-1):\r\n ... | [
"0.64831394",
"0.61874086",
"0.61735415",
"0.61718506",
"0.61527866",
"0.60873675",
"0.6081667",
"0.6061148",
"0.6059269",
"0.6033057",
"0.6003269",
"0.59748554",
"0.59735286",
"0.5955158",
"0.5949899",
"0.5943981",
"0.591692",
"0.58902246",
"0.58521664",
"0.58456236",
"0.584... | 0.81768507 | 0 |
take 1D float array of rewards and compute discounted reward | def discount_rewards(r):
discounted_r = np.zeros_like(r)
running_add = 0
for t in reversed(xrange(0, r.size)):
running_add = running_add * gamma_099 + r[t]
discounted_r[t] = running_add
return discounted_r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r",
"def discoun... | [
"0.8100923",
"0.78397125",
"0.7792625",
"0.7742053",
"0.7653779",
"0.75987715",
"0.7583268",
"0.75820553",
"0.7579539",
"0.7536054",
"0.7519005",
"0.7467692",
"0.7456702",
"0.7433794",
"0.7426565",
"0.74062765",
"0.73950297",
"0.7370545",
"0.73564714",
"0.7328519",
"0.7201842... | 0.75047183 | 11 |
Center a windows in the middle of the screen or in the middle of other windows(refWindows param) | def centerWindows(root, dim=None, refWindows=None):
root.update_idletasks()
if dim is None:
gw, gh, gx, gy = getGeometry(root)
else:
gw, gh = dim
if refWindows:
rw, rh, rx, ry = getGeometry(refWindows)
x = rx + (rw - gw) / 2
y = ry + (rh - gh) / 2
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(win):\n win.update_idletasks()\n width = 1120\n frm_width = win.winfo_rootx() - win.winfo_x()\n win_width = width + 2 * frm_width\n height = 630\n titlebar_height = win.winfo_rooty() - win.winfo_y()\n win_height = height + titlebar_height + frm_width\n x = win.winfo_screenwidth()... | [
"0.7794874",
"0.7700708",
"0.7459691",
"0.74552596",
"0.7453495",
"0.74151826",
"0.7383021",
"0.7224289",
"0.7178479",
"0.7178479",
"0.7149634",
"0.7146523",
"0.70277214",
"0.6996693",
"0.6930769",
"0.6908446",
"0.67433846",
"0.67166156",
"0.6688325",
"0.66503334",
"0.6580081... | 0.82741517 | 0 |
Adds variable to the tracker Specify `retain_grad=True` to retrieve the gradient later. | def track(self, variable, name, retain_grad=False):
if retain_grad:
variable.retain_grad()
self.tracker[name] = variable | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_variable(self, name, var):\n self.variables.append(_3ds_named_variable(name, var))",
"def add_variable(self, name, var):\n self.variables.append(_3ds_named_variable(name, var))",
"def add_variable(self, variable):\n self.variables.append(variable)",
"def addDataPoint(self, variab... | [
"0.617043",
"0.617043",
"0.6157285",
"0.598745",
"0.5977273",
"0.5921425",
"0.58956003",
"0.58581215",
"0.58335394",
"0.5780345",
"0.5755561",
"0.55705684",
"0.5561932",
"0.55532116",
"0.55370265",
"0.5524503",
"0.55208063",
"0.5471912",
"0.5440033",
"0.5429114",
"0.5390405",... | 0.8229804 | 0 |
Different weight initialization from common_layers.Embedding | def TransformerTokenEmbedding(
num_embeddings, embedding_dim, padding_idx, freeze_embed=False
):
m = nn.Embedding(num_embeddings, embedding_dim, padding_idx=padding_idx)
nn.init.normal_(m.weight, mean=0, std=embedding_dim ** -0.5)
nn.init.constant_(m.weight[padding_idx], 0)
if freeze_embed:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_embedding(self):\n self.embedding.weight.data.uniform_(-1./self.num_embeddings, 1./self.num_embeddings)",
"def init_weights(self):\n self.embedding.weight.data.uniform_(-0.1, 0.1)\n self.word.bias.data.fill_(0)\n self.word.weight.data.uniform_(-0.1, 0.1)",
"def init_weight(... | [
"0.8204156",
"0.797552",
"0.76939917",
"0.7583173",
"0.75475466",
"0.7537421",
"0.7537421",
"0.7537421",
"0.7458322",
"0.7446863",
"0.73706645",
"0.7345725",
"0.7306496",
"0.7288981",
"0.72795814",
"0.72660625",
"0.72338545",
"0.7164262",
"0.715719",
"0.7125709",
"0.7114372",... | 0.0 | -1 |
Check if this region overlaps with the specified region. | def overlaps(self, region):
region = as_region(region)
if region.chromosome != self.chromosome:
return False
if self.end is None or region.start is None or region.start <= self.end:
if self.start is None or region.end is None or region.end >= self.start:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_overlapping(self, region):\n if self.x2 < region.x1:\n return False # this box is left the other\n if self.x1 > region.x2:\n return False # this box is right the other\n if self.y2 < region.y1:\n return False # this box is above the other\n if ... | [
"0.8246767",
"0.7543783",
"0.70364356",
"0.6981594",
"0.6944355",
"0.68853915",
"0.6782944",
"0.676671",
"0.67281455",
"0.6679296",
"0.6670172",
"0.6617655",
"0.661104",
"0.65755457",
"0.65698165",
"0.6490953",
"0.6443232",
"0.6414982",
"0.64059013",
"0.63828504",
"0.637298",... | 0.8480086 | 0 |
Returns a dictionary of chromosomes and their length in bp. | def chromosome_lengths(self):
chr_lens = {}
for r in self.regions(lazy=True):
if chr_lens.get(r.chromosome) is None:
chr_lens[r.chromosome] = r.end
continue
if r.end > chr_lens[r.chromosome]:
chr_lens[r.chromosome] = r.end
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_chromosome_length(genome):\n \n chr_list = {}\n \n for key in genome:\n chr_list[key] = len(genome[key])\n\n return chr_list",
"def chromosome_sizes(probes, to_mb=False):\n chrom_sizes = collections.OrderedDict()\n for chrom, rows in probes.by_chromosome():\n chrom_size... | [
"0.75496536",
"0.66036624",
"0.6350277",
"0.61505413",
"0.6149478",
"0.6002446",
"0.59674436",
"0.5910675",
"0.5891672",
"0.5815247",
"0.5791125",
"0.5685908",
"0.5680378",
"0.5620447",
"0.5620323",
"0.56183904",
"0.55881983",
"0.54658467",
"0.5447979",
"0.5433671",
"0.542723... | 0.70785457 | 1 |
Return a dictionary with region index as keys and regions as values. | def regions_dict(self):
regions_dict = dict()
for i, r in enumerate(self.regions):
regions_dict[getattr(r, 'ix', i)] = r
return regions_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index_array(self):\n return self.region_pairs",
"def regions(self):\n return self._regions",
"def get_regions(self):\n return self._regions",
"def region(self):\n return regions.lookup(self.state)",
"def get_region_dict(self):\n if self.initiated is False:\n ... | [
"0.6927725",
"0.68251985",
"0.6579689",
"0.6553879",
"0.64824224",
"0.63487697",
"0.63045734",
"0.62803394",
"0.6271578",
"0.623713",
"0.62114185",
"0.62047946",
"0.6151121",
"0.6120668",
"0.6116931",
"0.60923696",
"0.60923696",
"0.6017518",
"0.60157436",
"0.6007226",
"0.5998... | 0.8633694 | 0 |
The name of the Cloud SQL instance. This does not include the project ID. | def instance(self) -> pulumi.Input[str]:
return pulumi.get(self, "instance") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._client.project_name + '/instances/' + self.instance_id",
"def cloud_name(self):\n return self._cloud_name",
"def name(self):\n _LOGGER.debug(self._shelly_cloud_device_name + ' >>> ' +\n self._shelly_cloud_entity_name + ' >>> name() >>> ' ... | [
"0.82057816",
"0.7243859",
"0.71185035",
"0.70248747",
"0.69606775",
"0.6943128",
"0.69157416",
"0.6888162",
"0.6888162",
"0.68759733",
"0.6849932",
"0.6831371",
"0.67943126",
"0.67609423",
"0.67609423",
"0.67609423",
"0.67609423",
"0.67377084",
"0.6736271",
"0.67343193",
"0.... | 0.0 | -1 |
The collation value. See MySQL's | def collation(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "collation") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collation(self) -> str:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> str:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> Optional[str]:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> pulumi.Output[str]:\n return pul... | [
"0.8569059",
"0.8569059",
"0.8433642",
"0.82214725",
"0.76354074",
"0.72184956",
"0.69456476",
"0.6850033",
"0.6586899",
"0.64879304",
"0.63003206",
"0.62411195",
"0.6016116",
"0.56670624",
"0.5613647",
"0.55497694",
"0.5377761",
"0.5371824",
"0.5371154",
"0.5320178",
"0.5234... | 0.82135564 | 5 |
The collation value. See MySQL's | def collation(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "collation") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collation(self) -> str:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> str:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> Optional[str]:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> pulumi.Output[str]:\n return pul... | [
"0.8567984",
"0.8567984",
"0.8433204",
"0.8220999",
"0.76349694",
"0.721865",
"0.6944622",
"0.68489176",
"0.65879124",
"0.64878386",
"0.6300796",
"0.624138",
"0.6015533",
"0.56657356",
"0.56127495",
"0.5549721",
"0.537839",
"0.5371238",
"0.5370059",
"0.531868",
"0.5234486",
... | 0.8212918 | 4 |
The name of the Cloud SQL instance. This does not include the project ID. | def instance(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "instance") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._client.project_name + '/instances/' + self.instance_id",
"def cloud_name(self):\n return self._cloud_name",
"def name(self):\n _LOGGER.debug(self._shelly_cloud_device_name + ' >>> ' +\n self._shelly_cloud_entity_name + ' >>> name() >>> ' ... | [
"0.82063854",
"0.72441554",
"0.7120339",
"0.70252013",
"0.6960602",
"0.69432664",
"0.6916303",
"0.6888547",
"0.6888547",
"0.68760103",
"0.68502605",
"0.6832102",
"0.6796444",
"0.67627484",
"0.67627484",
"0.67627484",
"0.67627484",
"0.67395926",
"0.673649",
"0.67351305",
"0.67... | 0.0 | -1 |
Get an existing Database resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
charset: Optional[pulumi.Input[str]] = None,
collation: Optional[pulumi.Input[str]] = None,
deletion_policy: Optional[pulumi.Input[str]] = None,
insta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state(state_id):\n try:\n ''' Check that state_id exists '''\n query = State.select().where(State.id == state_id)\n if not query.exists():\n raise LookupError('state_id')\n\n state = State.get(State.id == state_id)\n return state.to_dict(), 200\n except L... | [
"0.6021642",
"0.59884006",
"0.5983825",
"0.59671116",
"0.59578335",
"0.5930545",
"0.5905646",
"0.56713885",
"0.565114",
"0.56206614",
"0.56055135",
"0.5584476",
"0.55702674",
"0.5557215",
"0.55412495",
"0.5514626",
"0.5498871",
"0.5449847",
"0.54265296",
"0.541536",
"0.538985... | 0.66290784 | 0 |
The collation value. See MySQL's | def collation(self) -> pulumi.Output[str]:
return pulumi.get(self, "collation") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collation(self) -> str:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> str:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> Optional[str]:\n return pulumi.get(self, \"collation\")",
"def collation(self) -> Optional[pulumi.Input[str]]:\n r... | [
"0.8569059",
"0.8569059",
"0.8433642",
"0.82135564",
"0.82135564",
"0.76354074",
"0.72184956",
"0.69456476",
"0.6850033",
"0.6586899",
"0.64879304",
"0.63003206",
"0.62411195",
"0.6016116",
"0.56670624",
"0.5613647",
"0.55497694",
"0.5377761",
"0.5371824",
"0.5371154",
"0.532... | 0.82214725 | 3 |
The name of the Cloud SQL instance. This does not include the project ID. | def instance(self) -> pulumi.Output[str]:
return pulumi.get(self, "instance") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._client.project_name + '/instances/' + self.instance_id",
"def cloud_name(self):\n return self._cloud_name",
"def name(self):\n _LOGGER.debug(self._shelly_cloud_device_name + ' >>> ' +\n self._shelly_cloud_entity_name + ' >>> name() >>> ' ... | [
"0.82057816",
"0.7243859",
"0.71185035",
"0.70248747",
"0.69606775",
"0.6943128",
"0.69157416",
"0.6888162",
"0.6888162",
"0.68759733",
"0.6849932",
"0.6831371",
"0.67943126",
"0.67609423",
"0.67609423",
"0.67609423",
"0.67609423",
"0.67377084",
"0.6736271",
"0.67343193",
"0.... | 0.0 | -1 |
Construct a new object given a pointer to the data and size. If no data pointer is provided then the memory is allocated internally. | def __init__(self, data_size=0, data_pointer=None, copy=False):
if data_size < 0:
raise Exception()
self._data_size = data_size
if copy and (data_pointer is None):
raise Exception()
will_allocate = (data_pointer is None) or copy
if will_allocate and d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, size=1):\n self._data = self._make_array(size)\n self._size = 0\n self._capacity = size",
"def create(self, object_id, size, metadata=None):\n # Turn the metadata into the right type.\n metadata = bytearray(\"\") if metadata is None else metadata\n buff = libplasm... | [
"0.66146785",
"0.66128993",
"0.63897145",
"0.6321279",
"0.62860477",
"0.6261782",
"0.6236371",
"0.6169531",
"0.6167711",
"0.6141167",
"0.6129323",
"0.6025222",
"0.59644043",
"0.59644043",
"0.5957934",
"0.593991",
"0.59268063",
"0.5849021",
"0.5838201",
"0.5833561",
"0.5820868... | 0.73440295 | 0 |
Get the pointer to the stored data. | def get_pointer(self):
return self._data_pointer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataPointer( cls, instance ):\n try:\n return long(instance.__array_data__[0],0)\n except AttributeError:\n instance = cls.asArray( instance )\n try:\n return long(instance.__array_interface__['data'][0])\n exc... | [
"0.72619206",
"0.7211616",
"0.70361733",
"0.6830311",
"0.6592283",
"0.6572181",
"0.6572181",
"0.6572181",
"0.6572181",
"0.6523979",
"0.6523979",
"0.6519656",
"0.64906514",
"0.6473726",
"0.64700675",
"0.64700675",
"0.64700675",
"0.6460517",
"0.64325434",
"0.64281726",
"0.64281... | 0.8546946 | 0 |
Get the size in bytes of the stored data. | def get_size(self):
return self._data_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(self):\n return self.data.size",
"def size(self):\n return len(self.data)",
"def size(self):\n return len(self.data)",
"def size(self):\n return len(self.data)",
"def size(self):\n return len(self.data)",
"def size(self):\n return len(self.data)",
"def... | [
"0.8554088",
"0.8269618",
"0.8269618",
"0.8269618",
"0.8269618",
"0.8269618",
"0.8243779",
"0.82353884",
"0.82257944",
"0.8176822",
"0.81373274",
"0.811432",
"0.81109315",
"0.8100845",
"0.8100845",
"0.80716527",
"0.80678904",
"0.80555564",
"0.80555564",
"0.80495596",
"0.80443... | 0.8826528 | 0 |
Yields all nodes above or below this node searched undirected. This is almost a dfs since it yields in order going down the graph rather than bottom up. It also has a few modes where it is edge direction sensitive for stopping | def undirected_dfs(self,
node_or_name: Union[str, Node],
stop_at: Optional[Set[Node]] = None,
stop_down_at: Optional[Set[Node]] = None,
stop_up_at: Optional[Set[Node]] = None,
start_up: bool = False,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes_below(self, node):\n nodes_below = set(self.directed_dfs(node))\n nodes_above = set(self.undirected_dfs(\n node, start_up=True, stop_down_at=nodes_below))\n return tuple(self.undirected_dfs(node, stop_up_at=nodes_above))",
"def nodes_above(self, node, visited=None):\n ... | [
"0.67942923",
"0.67890185",
"0.65324897",
"0.6232672",
"0.60915154",
"0.60857934",
"0.60571855",
"0.6043218",
"0.60384023",
"0.6013603",
"0.5992653",
"0.5987384",
"0.59691733",
"0.59556824",
"0.5929222",
"0.59107494",
"0.5904299",
"0.58934546",
"0.5883198",
"0.58733183",
"0.5... | 0.6028463 | 9 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
while True:
try:
cities = ['chicago', 'new york city', 'washington']
city = input("Would y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66718096",
"0.6536446",
"0.64608175",
"0.63732874",
"0.6349621",
"0.6310782",
"0.62876326",
"0.6260145",
"0.6230216",
"0.62113076",
"0.62061083",
"0.61823773",
"0.61707395",
"0.6170415",
"0.6160548",
"0.6158978",
"0.6154724",
"0.61454946",
"0.6130887",
"0.61055917",
"0.610... | 0.5848818 | 50 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
months = ['january', 'february', 'march', 'april', 'may', 'june']
days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']
df = pd.read_csv(CITY_DATA[city])
df['Start Time'] = pd.to_datetime(df['Start Time']) # convert the Start Time column t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81323016",
"0.8109424",
"0.80464303",
"0.8042689",
"0.8009603",
"0.8007148",
"0.7999635",
"0.7998743",
"0.79891264",
"0.7979305",
"0.7974435",
"0.7961534",
"0.79565644",
"0.79476094",
"0.7946865",
"0.7908892",
"0.7908559",
"0.7904986",
"0.79014856",
"0.7893825",
"0.7889581... | 0.7882678 | 21 |
Displays statistics on the most frequent times of travel. | def frequency_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
if df['month'].nunique() != 1 and df['day_of_week'].nunique() != 1: # user choose no filter
most_common_month = df['month'].value_counts().idxmax() # display the most common month
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.0 | -1 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# display most commonly used start station
most_common_start_station = df['Start Station'].value_counts().idxmax()
print("\nThe most commonly used start station is {}.".format(most_common... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.7302693 | 26 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# display total travel time
total_trip_duration = df['Trip Duration'].sum()
print("\nThe total travel time is {}.".format(total_trip_duration))
# display mean travel time
mean_trip_duration = d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.7814464 | 39 |
tests of models and database logic asserts object is instance of correct class asserts object name attribute has expected value asserts object has an id attribute asserts objects.id is expected value | def test_todo_create(client):
# creates Model.Todo object
with db.atomic():
todo = models.Todo.create(name='Shopping')
assert isinstance(todo, models.Todo)
assert todo.name == 'Shopping'
assert hasattr(todo, 'id')
assert todo.id is 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create(self):\n\t\tself.obj.save()\n\t\tself.assertEqual(1, self.obj.id)",
"def test_singleinstancecreation(self):\n b1 = BaseModel()\n self.assertEqual(type(b1.id), str)\n self.assertEqual(type(b1.created_at), datetime)\n self.assertEqual(type(b1.updated_at), datetime)",
"... | [
"0.69882184",
"0.69734335",
"0.6824537",
"0.681469",
"0.67970675",
"0.6790972",
"0.6768191",
"0.6717103",
"0.67151994",
"0.6701958",
"0.6664275",
"0.66028625",
"0.658482",
"0.6584448",
"0.6536941",
"0.65315866",
"0.6522887",
"0.6516057",
"0.6515608",
"0.6502915",
"0.65008086"... | 0.0 | -1 |
Get features from `SampleInstance`s. | def get_instance_features(instance, tokenizer_src, tokenizer_trg, max_seq_length, bucket):
def _find_bucket_length(source_tokens, target_tokens):
source_ids = tokenizer_src.convert_tokens_to_ids(source_tokens)
target_ids = tokenizer_trg.convert_tokens_to_ids(target_tokens)
num = max(len(sour... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_features(self):\n self.extract_features_static()\n self.extract_features_dynamic()",
"def get_features(self):\n return self._features",
"def _extract_features(self):\n # print(os.getpid())\n return {n:self._extract_feature(f) for (n,f) in self.features.items()}",
... | [
"0.6981046",
"0.6769057",
"0.6655368",
"0.6645348",
"0.65763974",
"0.6519435",
"0.6430781",
"0.6419805",
"0.6394939",
"0.63461775",
"0.6323746",
"0.6235022",
"0.62105256",
"0.61981386",
"0.6167581",
"0.61341345",
"0.613287",
"0.610485",
"0.60923654",
"0.6089789",
"0.6089789",... | 0.0 | -1 |
Timestamp when the backup job started. | def created_at(self):
return self._backup_started | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backup_time(self) -> str:\n return pulumi.get(self, \"backup_time\")",
"def getStartTime(self):\n assert not self.isWaitingToStart(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__jobInfo.startTime",
"def start_timestamp(self):\n return self._start_timestamp",
"def run... | [
"0.71669775",
"0.7066047",
"0.7054497",
"0.662983",
"0.6620418",
"0.65972984",
"0.6594025",
"0.6591857",
"0.6589067",
"0.658903",
"0.65832704",
"0.65832704",
"0.65832704",
"0.6572546",
"0.65366316",
"0.65366316",
"0.64700294",
"0.64688253",
"0.64671844",
"0.64671844",
"0.6467... | 0.7744889 | 0 |
Timestamp when the backup job started. | def backup_started(self):
return self._backup_started | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_at(self):\n return self._backup_started",
"def backup_time(self) -> str:\n return pulumi.get(self, \"backup_time\")",
"def getStartTime(self):\n assert not self.isWaitingToStart(), \"Too early to tell: %s\" % self\n return \"%s\" % self.__jobInfo.startTime",
"def start_tim... | [
"0.7744705",
"0.71653694",
"0.7068945",
"0.70576024",
"0.66323113",
"0.6621853",
"0.6598387",
"0.6597276",
"0.6594547",
"0.6590594",
"0.6590402",
"0.65845066",
"0.65845066",
"0.65845066",
"0.65747315",
"0.65399826",
"0.65399826",
"0.6471695",
"0.64709413",
"0.6468601",
"0.646... | 0.6435794 | 28 |
Return representation of the class instance for output purposes. | def as_dict(self):
result = {}
for attr in self.__attr:
result[attr] = getattr(self, attr)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self.to_str()",
"def __repr__(self):\n return self... | [
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"0.7896083",
"... | 0.0 | -1 |
Test default product price being 10. | def test_default_product_price(self):
prod = Product('Test Product')
self.assertEqual(prod.price, 10) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_default_product_price(self):\r\n prod = Product('Test Product')\r\n self.assertEqual(prod.price, 10)",
"def test_default_product_price(self):\n prod = product('Test Product')\n self.assertEqual(prod.price, 10)\n self.assertEqual(prod.weight, 20)",
"def test_default_p... | [
"0.87333673",
"0.8610413",
"0.8580199",
"0.7287374",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.72686666",
"0.7263497",
"0.717852",
"0.6858057",
"0.6813622",
"0.67408824",
"0.67408824",
"0.6709257",
"0.6688696",
"0.66599596",
"0.6654696",
"0.6654... | 0.8738257 | 4 |
return a string representing this KafkaClient. | def __repr__(self):
return '<KafkaClient clientId={0} brokers={1} timeout={2}>'.format(
self.clientId,
sorted(self.clients.keys()),
self.timeout,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return \"Client(id=%r addr:%s name:%s level:%d state:%d)\" % (\n self.id, str(self.addr), self.name, self.security_level, self.state)",
"def __str__(self):\n\n return ('Client: {x[client]}\\n'\n 'Target: {x[target]}\\n'\n 'tot_requests: ... | [
"0.69234496",
"0.6726105",
"0.66784215",
"0.66651124",
"0.64718163",
"0.63709724",
"0.63679576",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816",
"0.6364816... | 0.81627357 | 0 |
Returns the coordinator (broker) for a consumer group Returns the broker for a given consumer group or Raises ConsumerCoordinatorNotAvailableError | def _get_coordinator_for_group(self, consumer_group):
if self.consumer_group_to_brokers.get(consumer_group) is None:
yield self.load_consumer_metadata_for_group(consumer_group)
returnValue(self.consumer_group_to_brokers.get(consumer_group)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_coordinator_callback(self, consumer_group, response):\n coordinator_id = self.kafka_client._find_coordinator_id_process_response(response)\n topics = self._consumer_groups[consumer_group]\n if not topics:\n topic_partitions = None # None signals to fetch all known offsets... | [
"0.64969236",
"0.62019634",
"0.61968255",
"0.61306095",
"0.61141384",
"0.60849464",
"0.58904696",
"0.58374584",
"0.5776488",
"0.57398665",
"0.5629955",
"0.5607302",
"0.5594828",
"0.5563348",
"0.55587935",
"0.5483728",
"0.5375463",
"0.52972525",
"0.52929074",
"0.5274464",
"0.5... | 0.8121062 | 0 |
This is the 'cover' page of the ubermelon site | def index():
return render_template("index.html") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_cover(outfile: TextIO) -> None:\n outfile.write(\" <div id=\\\"cover_page\\\">\\n\")\n for i in range(1, 29):\n outfile.write(\" <img id=\\\"cover_img\" + str(i) + \"\\\" class=\\\"cover_img\\\" \"\n \"src=\\\"media/cover images/cover\" + str(i) + \".jpg\\\" />\\... | [
"0.63827765",
"0.61867326",
"0.6147762",
"0.61313784",
"0.60662",
"0.60441816",
"0.6040292",
"0.6029152",
"0.60253024",
"0.5868859",
"0.58671296",
"0.58009434",
"0.57949984",
"0.57220346",
"0.5710475",
"0.56992435",
"0.5687899",
"0.5681802",
"0.568055",
"0.5666379",
"0.561083... | 0.0 | -1 |
Converts a list of strings to a string by concatenating all elements of the list | def collapse(L):
output = ""
for s in L:
output = output + s
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringer(list):\n\tstring = \"\"\n\tfor x in list:\n\t\tstring = string + str(x)\n\treturn string",
"def list2string(a_list):\n\n the_string = ''\n for elem in a_list:\n the_string += str(elem)\n return the_string",
"def list_to_str(list_to_convert):\n return ' '.join(to_str(item) for it... | [
"0.8453612",
"0.78367066",
"0.77747875",
"0.7706896",
"0.7661305",
"0.7660147",
"0.75969124",
"0.7586449",
"0.7480391",
"0.74601054",
"0.74566245",
"0.74075365",
"0.74075365",
"0.7393631",
"0.7386813",
"0.7351883",
"0.7333915",
"0.73312396",
"0.7292322",
"0.7261133",
"0.71730... | 0.652044 | 54 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
is_group_site = dictionary.get('isGroupSite')
is_private_channel_site = dictionary.get('isPrivateChannelSite')
is_team_site = dict... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.7456073 | 92 |
Helper to rebuild the original request url query string or fragments are not included. | def get_request_uri(request):
# DEV: Use django.http.request.HttpRequest._get_raw_host() when available
# otherwise back-off to PEP 333 as done in django 1.8.x
if hasattr(request, "_get_raw_host"):
host = request._get_raw_host()
else:
try:
# Try to build host how Django would... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_request_uri_query(self, request):\n if \"?\" in request.path:\n request.path, _, query_string = request.path.partition(\"?\")\n if query_string:\n query_params = query_string.split(\"&\")\n for query in query_params:\n if \"=... | [
"0.754696",
"0.7342816",
"0.7342816",
"0.70667267",
"0.70667267",
"0.68757457",
"0.6598784",
"0.6559473",
"0.65557426",
"0.65422744",
"0.644316",
"0.63533276",
"0.6313638",
"0.6297168",
"0.62563896",
"0.62563896",
"0.6247136",
"0.62402457",
"0.6226706",
"0.62001884",
"0.61861... | 0.0 | -1 |
Input pipeline, returns a dictionary of batched and padded tensors. | def get_batch(self, batch_size, preprocessing_fn=None, mode='training', drop_long_sequences=False):
data_file_patterns = self.dataset.get_data_filepatterns(mode=mode)
dataset_r = self.decoder.examples_reader([data_file_patterns], bool(mode == 'training'),
self.capaci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(\n self,\n batched_input: List[Dict[str, Any]],\n multimask_output: bool, ) -> List[Dict[str, paddle.Tensor]]:\n input_images = paddle.stack(\n [self.preprocess(x[\"image\"]) for x in batched_input], axis=0)\n image_embeddings = self.image_encod... | [
"0.6261723",
"0.62249404",
"0.6206061",
"0.6205686",
"0.6104238",
"0.6039111",
"0.59211016",
"0.5912527",
"0.59049195",
"0.5871039",
"0.58701247",
"0.5858868",
"0.5856919",
"0.5839526",
"0.5838521",
"0.58376753",
"0.5790803",
"0.5784844",
"0.5783347",
"0.5775979",
"0.5772352"... | 0.0 | -1 |
Initialize the timestamps that are associated with the workflow state and the optional messages. | def __init__(
self, created_at, started_at=None, stopped_at=None, messages=None
):
super(StateCanceled, self).__init__(
type_id=STATE_CANCELED,
created_at=created_at
)
self.started_at = started_at if started_at is not None else created_at
self.stopped_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init(self) -> None:\n now = time()\n\n # Timestamps for tracking compute durations by task group.\n # Start with length 2 so that we always can compute a valid dt later.\n self.time = [now] * 2\n # The amount of compute since the last timestamp\n self.compute = {}\n ... | [
"0.5973129",
"0.5948285",
"0.59350395",
"0.5913916",
"0.5857353",
"0.5837863",
"0.5815878",
"0.5801525",
"0.58012897",
"0.58010244",
"0.5794571",
"0.5782072",
"0.5760623",
"0.5693283",
"0.56862205",
"0.5667927",
"0.5660621",
"0.5660384",
"0.56407046",
"0.56260806",
"0.5601290... | 0.51903826 | 85 |
Initialize the timestamps that are associated with the workflow state and the optional error messages. | def __init__(
self, created_at, started_at=None, stopped_at=None, messages=None
):
super(StateError, self).__init__(
type_id=STATE_ERROR,
created_at=created_at
)
self.started_at = started_at if started_at is not None else created_at
self.stopped_at = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_workflow():\n pass",
"def initialize_run( # type: ignore\n self,\n state: Optional[State],\n task_states: Dict[Task, State],\n context: Dict[str, Any],\n task_contexts: Dict[Task, Dict[str, Any]],\n parameters: Dict[str, Any],\n ) -> FlowRunnerInitializeR... | [
"0.58676404",
"0.58566487",
"0.58555996",
"0.58538616",
"0.5795137",
"0.57923263",
"0.5778303",
"0.5746853",
"0.57439834",
"0.5689063",
"0.5670631",
"0.56698287",
"0.5648191",
"0.5635707",
"0.56312555",
"0.5589077",
"0.5582113",
"0.5562618",
"0.5560296",
"0.55550575",
"0.5554... | 0.65543795 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.