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 |
|---|---|---|---|---|---|---|
Sets the safe_name of this MetadataGetMetadataPropertyResponse200. | def safe_name(self, safe_name):
self._safe_name = safe_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def property_name(self, name: str) -> None:\n name = str(name)\n if len(name) > 100:\n name = name[:100]\n self.prop_name = name",
"def set_name(self, name):\n return self.set_meta('name', name)",
"def get_name(self, name):\n name.value = self._get_name(name.value.... | [
"0.5420325",
"0.5361161",
"0.5346482",
"0.5223214",
"0.51978594",
"0.5180247",
"0.5145387",
"0.51444584",
"0.511654",
"0.50235724",
"0.50176543",
"0.50036055",
"0.4995013",
"0.4944977",
"0.49249235",
"0.49249235",
"0.49249235",
"0.49249235",
"0.49249235",
"0.48859897",
"0.488... | 0.5697767 | 0 |
Sets the owner_id of this MetadataGetMetadataPropertyResponse200. | def owner_id(self, owner_id):
self._owner_id = owner_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner_id(self, owner_id):\n self._owner_id = owner_id",
"def owner_id(self, owner_id):\n if owner_id is None:\n raise ValueError(\"Invalid value for `owner_id`, must not be `None`\") # noqa: E501\n\n self._owner_id = owner_id",
"def set_owner(self, owner):\n self.__o... | [
"0.6760593",
"0.6578586",
"0.6437985",
"0.6345639",
"0.62267643",
"0.6188845",
"0.6138685",
"0.5942714",
"0.5942714",
"0.5942714",
"0.5942714",
"0.5933741",
"0.59291255",
"0.59291255",
"0.59291255",
"0.59291255",
"0.5900895",
"0.5834471",
"0.57057893",
"0.56453705",
"0.561660... | 0.6731123 | 1 |
Sets the id of this MetadataGetMetadataPropertyResponse200. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id(self, _id):\n self.metadata[\"id\"] = _id",
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n\n\t\tif id is not None and not isinstance(id, int):\n\t\t\traise SDKException(Constants.DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: int', None, None)\n\t\t\n\t\tself.__id = id\... | [
"0.63858414",
"0.6154459",
"0.60163325",
"0.5910276",
"0.5817565",
"0.58106434",
"0.57723314",
"0.5620549",
"0.5620549",
"0.5620549",
"0.5620549",
"0.5620549",
"0.5548563",
"0.5548563",
"0.5548563",
"0.5548563",
"0.5548563",
"0.5548563",
"0.5548563",
"0.5548563",
"0.5548563",... | 0.0 | -1 |
Sets the name of this MetadataGetMetadataPropertyResponse200. | def name(self, name):
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n return self.set_meta('name', name)",
"def property_name(self, name: str) -> None:\n name = str(name)\n if len(name) > 100:\n name = name[:100]\n self.prop_name = name",
"def name(self, value):\n self.mol.SetProp('_Name', str(value))",
... | [
"0.61210793",
"0.60815775",
"0.5965639",
"0.58949",
"0.58295333",
"0.5790032",
"0.5772176",
"0.5772176",
"0.5772176",
"0.5772176",
"0.5772176",
"0.57188904",
"0.56791943",
"0.56716466",
"0.56680197",
"0.5629307",
"0.5616656",
"0.5607745",
"0.5602644",
"0.5602644",
"0.5562854"... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, MetadataGetMetadataPropertyResponse200):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Return transection of 2 dicts, value based on the second dict. | def make_transection(dict1, dict2):
_res = {}
for _key in dict1:
if dict2.get(_key, None):
_res[_key] = dict2.get(_key)
return _res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_two_dicts(self, x, y):\n z = x.copy()\n z.update(y)\n return z",
"def merge_two_dicts(x, y):\n\tz = x.copy()\n\tz.update(y)\n\treturn z",
"def merge_two_dicts(x, y):\r\n z = x.copy()\r\n z.update(y)\r\n return z",
"def Map(a, b):\n out = {}\n for key, value in a.... | [
"0.6411219",
"0.6406409",
"0.63682616",
"0.6355881",
"0.62652725",
"0.62346476",
"0.62346476",
"0.62346476",
"0.62346476",
"0.62346476",
"0.62346476",
"0.62346476",
"0.62346476",
"0.62209195",
"0.619405",
"0.6150861",
"0.61296916",
"0.6110062",
"0.60986817",
"0.60906684",
"0.... | 0.78952986 | 0 |
Save the current model state as a PyTorch checkpoint so it can be loaded later. | def save_checkpoint(self, checkpoint_path='checkpoint.pth'):
# Move the model back to the cpu so it can be loaded onto machines
# without gpu's as well.
self.model.to('cpu')
checkpoint = {
'model_architecture': self.model_architecture,
'input_size': self.input_si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_checkpoint(self, model):\n # print(f\"save model {self.save_model_path}\")\n torch.save(model.state_dict(), self.save_model_path)",
"def save_checkpoint(model, save_path):\n torch.save(model.state_dict(), save_path)",
"def save_checkpoint(self, filename='checkpoint.pth'):\n tor... | [
"0.8545657",
"0.8301963",
"0.80807185",
"0.8047903",
"0.79739624",
"0.79565525",
"0.7951821",
"0.79486936",
"0.7916611",
"0.78942174",
"0.7884984",
"0.7872908",
"0.7846716",
"0.78396654",
"0.7817836",
"0.77990985",
"0.77044314",
"0.7682124",
"0.767263",
"0.76718336",
"0.76465... | 0.8142014 | 2 |
set to zero values larger than upper_threshold | def zero_upper_range(x, upper_threshold):
x = np.asarray(x, dtype=complex)
count = 0
for i in range(0, x.shape[0], 1):
if x[i].real > upper_threshold:
x[i] = complex(0, 0j)
count+=1
print("zeroed samples: ", count)
return x; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpperThreshold(self, upper_threshold):\r\n\t\tself.UpperThreshold = upper_threshold",
"def zero_lower_range(x, lower_threshold):\r\n x = np.asarray(x, dtype=complex)\r\n count = 0\r\n for i in range(0, x.shape[0], 1):\r\n if x[i].real < lower_threshold:\r\n x[i] = complex(0, 0j)... | [
"0.72706443",
"0.65403014",
"0.64137733",
"0.6320009",
"0.62305266",
"0.6165832",
"0.61273754",
"0.60762894",
"0.6067357",
"0.60122204",
"0.60122204",
"0.60122204",
"0.5999308",
"0.594086",
"0.59129816",
"0.58861923",
"0.58529925",
"0.5815436",
"0.58067846",
"0.57999873",
"0.... | 0.7275719 | 0 |
Get the cycle value. | def cycle(self):
return self._cycle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cycleInterval(self):\n return self.processCycleInterval",
"def get_duty_cycle(self):\n return self._mixer.duty_cycle",
"def calculate(self, cycle):\n # at first cycle just return the initial value\n if cycle == 0:\n self.current_value.append(self.current_value[0])\n ... | [
"0.7036989",
"0.6872306",
"0.6794951",
"0.6439719",
"0.6369555",
"0.6299084",
"0.6281027",
"0.6240008",
"0.6211102",
"0.61720306",
"0.616593",
"0.6137996",
"0.6132796",
"0.61175",
"0.61065483",
"0.6058376",
"0.60472214",
"0.5992888",
"0.5989826",
"0.5944338",
"0.5932194",
"... | 0.7457267 | 0 |
The invalidate() method triggers a redraw of the widget. | def invalidate(self):
# This very simple implementation of invalidate() just notifies the container
assert(self._parent)
self._parent.child_invalidated(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalidate(self):\n\t\tself.invalidate_rect(self.viewed_rect())",
"def invalidate(self):\n self.set_viewport(self.x, self.y, self.w, self.h, True)",
"def redraw(self):\n self.vispy_widget.canvas.update()",
"def invalidate_canvas(self):\n\n if self.window:\n x, y, w, h = se... | [
"0.8024422",
"0.7516997",
"0.70788324",
"0.7077513",
"0.6871071",
"0.68590826",
"0.68569636",
"0.6817851",
"0.6727636",
"0.6686542",
"0.66534036",
"0.66211206",
"0.64183414",
"0.64183414",
"0.6407928",
"0.6345243",
"0.62813276",
"0.6264092",
"0.6188824",
"0.6180518",
"0.60912... | 0.65398383 | 12 |
Return docker image name. | def docker_image_name(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_name():\n try:\n return os.environ['AIRFLOW_IMAGE']\n except KeyError:\n raise Exception(\"Please provide docker image name to pytest using environment variable AIRFLOW_IMAGE\")",
"def build_image_name(self, tag):\n return self.repository_name + ':' + tag",
"def contain... | [
"0.7595361",
"0.7496212",
"0.74817425",
"0.7301941",
"0.7281677",
"0.72610414",
"0.71842706",
"0.70049363",
"0.6996756",
"0.6996756",
"0.69679266",
"0.68323594",
"0.6816819",
"0.6778676",
"0.67522925",
"0.65728354",
"0.6569516",
"0.65458554",
"0.6545557",
"0.6545557",
"0.6513... | 0.88263226 | 0 |
Used to initialize an object of the Tag images class Sets the value of an api key and secret that will be used to access the immaga api. | def __init__(self):
#print ("Object created")
self.apikey='acc_4fc1a435b3188b5'
self.secret = 'f49c4be14a048d5de7e7f6c564b52022'
self.fileToIdMap = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, apikey, secret):\n self.apikey = apikey\n self.secret = secret",
"def __init__(self, apiKey, apiSecret):\n self.apiKey = apiKey\n self.apiSecret = apiSecret",
"def __init__(self, access_key, secret_key, **kwargs):\r\n pass",
"def __init__(self,ima... | [
"0.7338047",
"0.71174985",
"0.69308114",
"0.6831729",
"0.6798931",
"0.6640764",
"0.65946454",
"0.65909046",
"0.6477678",
"0.6416036",
"0.64157826",
"0.64157826",
"0.64157826",
"0.6381126",
"0.63754076",
"0.63645685",
"0.63314426",
"0.63117063",
"0.6281324",
"0.62380874",
"0.6... | 0.7314177 | 1 |
Creates a graph from saved GraphDef file and returns a Graph object. | def create_model_graph(model_info):
with tf.Graph().as_default() as graph:
model_path = os.path.join(FLAGS.model_dir, model_info['model_file_name'])
tf.logging.info('Model path: ' + model_path)
with gfile.FastGFile(model_path, 'rb') as f:
graph_def = tf.GraphDef()
gra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_graph():\n # Creates graph from saved graph_def.pb.\n with tf.gfile.FastGFile(os.path.join(\n FLAGS.model_dir, pbfilename), 'rb') as f:\n graph_def = tf.GraphDef()\n graph_def.ParseFromString(f.read())\n _ = tf.import_graph_def(graph_def, name='')",
"def create_graph():\n # Creates ... | [
"0.7890266",
"0.78362",
"0.7805612",
"0.7740064",
"0.76060516",
"0.7559079",
"0.7468323",
"0.7405169",
"0.72379494",
"0.7231459",
"0.7206656",
"0.7146248",
"0.7093667",
"0.70155597",
"0.70097727",
"0.691572",
"0.690586",
"0.6876043",
"0.6864873",
"0.6863852",
"0.6860719",
"... | 0.0 | -1 |
Converts all nonzero entries using the given function | def convert(self, function=pointwise_mi):
self.normalise()
feat_prob = Counter()
for feat_set in self.itervalues():
for feat in feat_set:
feat_prob[feat] += feat_set[feat]
for feat_set in self.itervalues():
code_prob = sum(feat_set.values(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nonzero_values(a):\r\n return a.flatten()[flatnonzero(a)]",
"def zero_to_ones(L):\n return [-1 if val == 0 else 1 for val in L]",
"def nozero(arr):\n vals=sorted(list(set(np.array(arr).flatten())))\n if vals[0]<0:\n print(\"correcting for div/zero by replacing 0 with\",vals[1])\n ... | [
"0.63381726",
"0.63106346",
"0.59972936",
"0.59958595",
"0.5917592",
"0.58701617",
"0.58595145",
"0.581413",
"0.5793217",
"0.5790725",
"0.5737466",
"0.57343805",
"0.57190806",
"0.57059574",
"0.5697768",
"0.56553376",
"0.5636973",
"0.5621256",
"0.5612097",
"0.55889195",
"0.557... | 0.0 | -1 |
Get map from RiboViz environment variables, to their values, if defined. The environment variables are listed in | def get_environment_vars():
return {env: os.environ[env] for env in
params.ENV_DIRS if env in os.environ} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_environment_map(self):\n return {'oxmeta': self.env}",
"def _get_interpreter_values(token='ZEPPELIN_INTERPRETER') -> dict:\n env_variables = {}\n for env_variable in os.environ:\n if env_variable.startswith(token):\n env_variables[env_variable] = os.environ[env_variable]\n\... | [
"0.6672966",
"0.660904",
"0.6466582",
"0.6400713",
"0.6262502",
"0.6230417",
"0.62221503",
"0.6167637",
"0.61143255",
"0.6113093",
"0.61004776",
"0.6089901",
"0.6089901",
"0.6089901",
"0.6089901",
"0.60691655",
"0.6033121",
"0.60219294",
"0.6004032",
"0.59725934",
"0.59708786... | 0.6061806 | 16 |
Replace environment variable tokens with their complementary environment variable values in configuration parameter values that support environment variable tokens. All other parameters are left unchanged. | def update_config_with_env(env_vars, config):
env_vars_copy = dict(env_vars) # Leave original as-is.
undefined_vars = {env: DEFAULT_ENV_DIR for env in
params.ENV_DIRS if env not in env_vars}
env_vars_copy.update(undefined_vars)
env_tokens = {ENV_TOKEN_FORMAT.format(env): value
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_variables(self, text, context):\n text = text.replace('__VENV_DIR__', context.env_dir)\n text = text.replace('__VENV_NAME__', context.env_name)\n text = text.replace('__VENV_PROMPT__', context.prompt)\n text = text.replace('__VENV_BIN_NAME__', context.bin_name)\n text... | [
"0.6351287",
"0.63502896",
"0.6109458",
"0.59891343",
"0.5983278",
"0.59424126",
"0.5897801",
"0.58843017",
"0.5880326",
"0.5871094",
"0.5847034",
"0.5846227",
"0.5837747",
"0.5809841",
"0.5800253",
"0.57734406",
"0.57511365",
"0.57123786",
"0.5706505",
"0.5680857",
"0.566684... | 0.58184534 | 13 |
Replace environment variable tokens with their complementary environment variable values in configuration parameter values that support environment variable tokens. All other parameters are left unchanged. | def apply_env_to_config(config):
env_vars = get_environment_vars()
update_config_with_env(env_vars, config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_variables(self, text, context):\n text = text.replace('__VENV_DIR__', context.env_dir)\n text = text.replace('__VENV_NAME__', context.env_name)\n text = text.replace('__VENV_PROMPT__', context.prompt)\n text = text.replace('__VENV_BIN_NAME__', context.bin_name)\n text... | [
"0.6350414",
"0.63495916",
"0.61105937",
"0.59872717",
"0.59829587",
"0.5941703",
"0.58991563",
"0.5883859",
"0.587989",
"0.5870388",
"0.58481526",
"0.58461076",
"0.5838412",
"0.58201045",
"0.58094984",
"0.57986414",
"0.57747144",
"0.5751932",
"0.57130444",
"0.5707288",
"0.56... | 0.0 | -1 |
Attach a lot of summaries to a Tensor (for TensorBoard visualization). | def variable_summaries(var):
with tf.name_scope('summaries'):
mean = tf.reduce_mean(var)
tf.summary.scalar('mean', mean)
with tf.name_scope('stddev'):
stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean)))
tf.summary.scalar('stddev', stddev)
tf.summary.scalar('max', tf.reduce_max(var... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_summary(self):\n for k, v in self.metrics.items():\n tf.summary.scalar(k, v)\n \n self.summary_op = tf.summary.merge_all()",
"def build_summaries(self):\n\n # Loss summary.\n tf.summary.scalar('loss', self.loss)\n\n merged = tf.summary.merge_all()\n self.summary_op = merged\n ... | [
"0.7071791",
"0.6970259",
"0.6970259",
"0.6800256",
"0.67872906",
"0.67407334",
"0.66669947",
"0.66576326",
"0.66193783",
"0.66085786",
"0.6595776",
"0.65836215",
"0.6581151",
"0.655297",
"0.6500364",
"0.6459978",
"0.64145213",
"0.6294558",
"0.62718755",
"0.62713677",
"0.6265... | 0.5624983 | 74 |
Tests the expire mechanism. | def test03Expire(self):
s = utils.FastStore(max_size=100)
key = "test1"
s.Put(key, 1)
# This should not raise
self.assertEqual(s.Get(key), 1)
s.ExpireObject(key)
self.assertRaises(KeyError, s.Get, key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_expires(self):\n # We aren't bother going to test the actual time in expires, that\n # way lies pain with broken tests later.\n up = self.get(self.good_data)\n hdrs = dict(up.get_headers(1))\n lm = datetime(*utils.parsedate_tz(hdrs['Last-Modified'])[:7])\n exp = d... | [
"0.77401775",
"0.77253497",
"0.74827534",
"0.73988396",
"0.73616546",
"0.73359716",
"0.7223288",
"0.7177638",
"0.71427613",
"0.71310085",
"0.70606315",
"0.7056773",
"0.69616413",
"0.69434726",
"0.6923482",
"0.6920353",
"0.69165075",
"0.69164497",
"0.68938494",
"0.6880996",
"0... | 0.625145 | 84 |
Adds snippet mapping to XUnit results This method injects testsnippet mappings into XUnit test results provided via stdin. It then saves the modified XUnit results to a file (if output_file is specified) or prints them to stdout (if output_file is not specified). | def inject_snippet_mapping(
data_json: str,
root_dir: str,
stdin_lines: List[str],
output_file: str = None
) -> None:
grep_tags, source_tags, ignored_tags, source_methods = (
analyze.analyze_json(data_json, root_dir))
xunit_tree = etree.fromstring(''.join(stdin_lines))
for elem in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_outputs(self, monkeypatch, script_runner):\n monkeypatch.setattr(\"builtins.input\", lambda _: \"n\")\n _ = script_runner.run(\n \"spectrafit\",\n \"spectrafit/test/test_data.txt\",\n \"-i\",\n \"spectrafit/test/test_input_2.json\",\n )\n ... | [
"0.52753115",
"0.5105577",
"0.5007354",
"0.49727327",
"0.49370566",
"0.4909723",
"0.48898146",
"0.48776826",
"0.48700637",
"0.48604727",
"0.4830978",
"0.48222542",
"0.48195934",
"0.47960544",
"0.47797915",
"0.47585177",
"0.47288483",
"0.47284773",
"0.4692374",
"0.468757",
"0.... | 0.69448084 | 0 |
Get indices of agents in array | def get_agent_indices(array):
agent_indices = np.argwhere(array != 0)
return agent_indices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_indices_of_type(array, agent_type):\t\n\tagent_indices = np.argwhere(array == agent_type)\n\treturn agent_indices",
"def get_vacancy_indices(array):\t\n\tvacancy_indices = np.argwhere(array == 0)\n\treturn vacancy_indices",
"def agent_locs_idx(self):\n return tuple(self.agent_locs.T)",
"... | [
"0.7976538",
"0.70531416",
"0.70311135",
"0.6646779",
"0.6600509",
"0.64596474",
"0.63922334",
"0.63716406",
"0.6315002",
"0.6268353",
"0.6263609",
"0.6165633",
"0.6158411",
"0.61511016",
"0.6067781",
"0.60366654",
"0.60299534",
"0.60228944",
"0.6012805",
"0.59855855",
"0.591... | 0.85050434 | 0 |
Get indices of agents in array | def get_agent_indices_of_type(array, agent_type):
agent_indices = np.argwhere(array == agent_type)
return agent_indices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_indices(array):\t\n\tagent_indices = np.argwhere(array != 0)\n\treturn agent_indices",
"def get_vacancy_indices(array):\t\n\tvacancy_indices = np.argwhere(array == 0)\n\treturn vacancy_indices",
"def agent_locs_idx(self):\n return tuple(self.agent_locs.T)",
"def atom_idxs(self):\n\n ... | [
"0.85050434",
"0.70531416",
"0.70311135",
"0.6646779",
"0.6600509",
"0.64596474",
"0.63922334",
"0.63716406",
"0.6315002",
"0.6268353",
"0.6263609",
"0.6165633",
"0.6158411",
"0.61511016",
"0.6067781",
"0.60366654",
"0.60299534",
"0.60228944",
"0.6012805",
"0.59855855",
"0.59... | 0.7976538 | 1 |
Get indices of vacancies in array | def get_vacancy_indices(array):
vacancy_indices = np.argwhere(array == 0)
return vacancy_indices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_indices(array):\t\n\tagent_indices = np.argwhere(array != 0)\n\treturn agent_indices",
"def occ_indices(self):\n indices = []\n for index,item in enumerate(self):\n if item==1:\n indices.append(index)\n return indices",
"def getCavityInds(board):\n ... | [
"0.6924578",
"0.67764175",
"0.66333616",
"0.6404924",
"0.6271628",
"0.61819667",
"0.6155188",
"0.6143064",
"0.61233395",
"0.6095246",
"0.60415274",
"0.6010839",
"0.59939235",
"0.59420985",
"0.5935518",
"0.5873053",
"0.5868035",
"0.5846514",
"0.5841468",
"0.5787059",
"0.577237... | 0.84648967 | 0 |
Return a list of wordtokenlists, one per document. Words are optionally lemmatized with WordNet. | def load_docs(direc, lemmatize, labelMapFile='labels.csv'):
labelMap = {} # docID => gold label, loaded from mapping file
with open(os.path.join(direc, labelMapFile)) as inF:
for ln in inF:
docid, label = ln.strip().split(',')
assert docid not in labelMap
labelMap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lemmatize_docs(docs):\r\n wordnet_lemmatizer = WordNetLemmatizer()\r\n for i in range(len(docs)):\r\n docs[i] = [wordnet_lemmatizer.lemmatize(w, t) for (w, t) in docs[i]]\r\n return docs",
"def lemmatized_words(tokens):\n lemmas = []\n for word in tokens:\n lemma = wn.morphy(word... | [
"0.72156936",
"0.72077274",
"0.6970358",
"0.6919822",
"0.6880137",
"0.6867316",
"0.6831428",
"0.67758334",
"0.6775461",
"0.67690396",
"0.67457765",
"0.6739425",
"0.6726132",
"0.6718005",
"0.6707851",
"0.66765314",
"0.6675399",
"0.6665653",
"0.6658649",
"0.6655086",
"0.6623254... | 0.0 | -1 |
Converts a Microsoft filetime number to a Python datetime. The new datetime object is time zonenaive but is equivalent to tzinfo=utc. | def _filetime_to_dt(ft):
# Get seconds and remainder in terms of Unix epoch
s, ns100 = divmod(ft - EPOCH_AS_FILETIME, HUNDREDS_OF_NANOSECONDS)
# Convert to datetime object
dt = datetime.utcfromtimestamp(s)
# Add remainder in as microseconds. Python 3.2 requires an integer
dt = dt.replace(m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fileTime(ft):\n return datetime(1601, 1, 1) + timedelta(microseconds=ft / 10)",
"def filetime_to_time(filetime):\r\n total = filetime.dwHighDateTime << 32 | filetime.dwLowDateTime\r\n return total / 10000000 - SECONDS_BETWEEN_EPOCHS",
"def microseconds_to_datetime(ms):\n return datetime... | [
"0.66038",
"0.64271015",
"0.6318054",
"0.6016368",
"0.60009575",
"0.59586394",
"0.5908033",
"0.5838013",
"0.5741333",
"0.56662536",
"0.556872",
"0.55569816",
"0.55468",
"0.55346006",
"0.5509647",
"0.5491392",
"0.5456959",
"0.5437118",
"0.5429036",
"0.5412592",
"0.5404405",
... | 0.6847953 | 0 |
Returns the maximum element size representable in a given number of bytes. | def maximum_element_size_for_length(length):
return (2**(7*length)) - 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxsize(self) -> int:\n return self._maxsize",
"def max_bytes(self) -> int:\n return self.width * self.height * 3",
"def maxsize(self):\r\n return self._maxsize",
"def maximum_size(self):\n return self._maximum_size",
"def max_size_bytes(self) -> Optional[float]:\n re... | [
"0.7550465",
"0.74025136",
"0.7332234",
"0.72707653",
"0.725339",
"0.7113349",
"0.6979818",
"0.69535756",
"0.6915955",
"0.6903534",
"0.6900205",
"0.6843633",
"0.683692",
"0.680336",
"0.67847925",
"0.6776855",
"0.67743033",
"0.67694736",
"0.6762796",
"0.6736242",
"0.67008376",... | 0.7842188 | 0 |
Reads an encoded unicode string value from a filelike object. | def read_unicode_string(stream, size):
value = u''
if size > 0:
data = stream.read(size)
data = data.partition(chr(0))[0]
value = unicode(data, 'utf_8')
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_file_utf8_readwrite(self):\n FileWriter(self.unicode_path).write_utf8(self.unicode_string)\n unicode_text = FileReader(self.unicode_path).read_utf8()\n self.assertEqual(unicode_text, self.unicode_string)",
"def test_file_bin_read_unicode_as_bin(self):\n FileWriter(self.unicod... | [
"0.6948822",
"0.6704859",
"0.669271",
"0.6627385",
"0.6526737",
"0.63893414",
"0.6336577",
"0.6312232",
"0.6283252",
"0.6249848",
"0.6115912",
"0.6042883",
"0.6033836",
"0.60238254",
"0.60097724",
"0.5980385",
"0.5964693",
"0.5931856",
"0.59117645",
"0.58821106",
"0.58538556"... | 0.6468235 | 5 |
Encodes an unsigned integer value. If length is not None, uint will be encoded in that many bytes; otherwise, uint will be encoded in the minimum number of bytes required. If uint is None or 0, the minimum number of bytes required is 0. | def encode_unsigned_integer(uint, length=None):
if uint is None:
uint = 0
if uint > ((2**((MAXIMUM_UNSIGNED_INTEGER_LENGTH if length is None else length) * 8)) - 1):
raise ValueError('Cannot encode unsigned integer value %i as it would have an encoded representation longer than %i bytes.' % (uint, (MAXIMUM_UNSI... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wUInt(self, value):\n self.w(struct.pack(self.endian + \"I\", value))",
"def _EncodeWithBytesLength(value: Any,\n bytes_len: int) -> bytes:\n if isinstance(value, str):\n value = int(value)\n\n max_val = (1 << (bytes_len * 8)) - 1\n if valu... | [
"0.6292111",
"0.6215636",
"0.6208055",
"0.6119022",
"0.602818",
"0.5937389",
"0.59157234",
"0.5832344",
"0.5765607",
"0.5750855",
"0.5619181",
"0.5619181",
"0.5488594",
"0.5488594",
"0.5481343",
"0.5440878",
"0.54195607",
"0.54000723",
"0.5393811",
"0.53793865",
"0.5347306",
... | 0.80095994 | 0 |
Encodes a signed integer value. If length is not None, sint will be encoded in that many bytes; otherwise, sint will be encoded in the minimum number of bytes required. If sint is None or 0, the minimum number of bytes required is 0. | def encode_signed_integer(sint, length=None):
if sint is None:
sint = 0
if not (-(2**(7+(8*((MAXIMUM_SIGNED_INTEGER_LENGTH if length is None else length)-1)))) <= sint <= (2**(7+(8*((MAXIMUM_SIGNED_INTEGER_LENGTH if length is None else length)-1))))-1):
raise ValueError('Cannot encode signed integer value %i as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_int(n):\n return struct.pack(\">I\", n)",
"def _SignedVarintEncoder():\n\n local_int2byte = struct.Struct('>B').pack\n\n def EncodeSignedVarint(write, value, unused_deterministic=None):\n if value < 0:\n value += (1 << 64)\n bits = value & 0x7f\n value >>= 7\n while value:\n ... | [
"0.6160891",
"0.61495453",
"0.6095626",
"0.6045101",
"0.6044109",
"0.5948104",
"0.5934116",
"0.5894467",
"0.5781891",
"0.5776574",
"0.5776574",
"0.5750566",
"0.572282",
"0.5718657",
"0.5670719",
"0.56644106",
"0.5617225",
"0.55705786",
"0.5550196",
"0.5541467",
"0.5530392",
... | 0.8030049 | 0 |
R1.3 Write a short Python function, minmax(data), that takes a sequence of one or more numbers, and returns the smallest and largest numbers, in the form of a tuple of length two. Do not use the builtin functions min or max in implementing your solution. | def minmax(data):
smallest = data[0]
largest = data[0]
for i in range(0,len(data)):
if data[i] < smallest:
smallest = data[i]
elif data[i] > largest:
largest = data[i]
return(smallest,largest) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min_max(x):\n if not x: return None\n if len(x) == 1:\n return x[0], x[0] # the first is min and the second is max\n min_val = x[0]\n max_val = x[0]\n for i in xrange(1, len(x)):\n if x[i] < min_val:\n min_val = x[i]\n elif x[i] > max_val:\n max_val = x[i]",
"def min_max(input):\... | [
"0.8156692",
"0.8069395",
"0.79071265",
"0.7875383",
"0.7786648",
"0.774679",
"0.7727443",
"0.77216727",
"0.77189654",
"0.770506",
"0.76852876",
"0.76503164",
"0.7635642",
"0.7630576",
"0.7630112",
"0.75509715",
"0.74221134",
"0.7398315",
"0.7334721",
"0.73272157",
"0.7309860... | 0.8767605 | 0 |
Constructs blockdiagonal matrices from a list of batched 2D tensors. | def block_diagonal(matrices, dtype=tf.float32):
matrices = [tf.convert_to_tensor(matrix, dtype=dtype) for matrix in matrices]
blocked_rows = tf.Dimension(0)
blocked_cols = tf.Dimension(0)
batch_shape = tf.TensorShape(None)
for matrix in matrices:
full_matrix_shape = matrix.get_shape().with_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_diagonal(matrices, dtype=tf.float32):\n matrices = [tf.convert_to_tensor(matrix, dtype=dtype)\n for matrix in matrices]\n blocked_rows = tf.Dimension(0)\n blocked_cols = tf.Dimension(0)\n batch_shape = tf.TensorShape(None)\n for matrix in matrices:\n full_matrix_shape... | [
"0.6632318",
"0.6613682",
"0.655527",
"0.5562392",
"0.5511607",
"0.5471755",
"0.5449592",
"0.54316026",
"0.54224735",
"0.53800976",
"0.53526396",
"0.53514004",
"0.5349552",
"0.53482145",
"0.53291816",
"0.52584076",
"0.5256403",
"0.52407396",
"0.52090025",
"0.51927626",
"0.518... | 0.6619513 | 1 |
Returns 3D tensor with same shape as input | def call(self, x, mask=None):
if K.backend() == 'theano' or K.backend() == 'CNTK':
raise NotImplementedError("This is not implemented for theano anymore.")
else:
if self.built:
import tensorflow as tf
from kyu.tensorflow.ops import safe_truncated_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reshape_tensor3d(self, x):\n if self.dim_ordering == 'th':\n tx = K.reshape(x, (-1, self.nb_filter, self.cols * self.rows))\n else:\n tx = K.reshape(x, (-1, self.cols * self.rows, self.nb_filter))\n tx = K.transpose(tx, (0, 2, 1))\n if self.bilinear_mode ==... | [
"0.706386",
"0.7039885",
"0.68363255",
"0.67445177",
"0.6630869",
"0.6461961",
"0.6452509",
"0.6332897",
"0.63136244",
"0.6231587",
"0.62188554",
"0.6209604",
"0.6149685",
"0.6147571",
"0.6147571",
"0.61347353",
"0.6130023",
"0.61150545",
"0.6108112",
"0.6086586",
"0.60811853... | 0.0 | -1 |
Takes state as an input and returns all indexes that are blank | def allowed_positions(self, curr_state):
return [i for i, val in enumerate(curr_state) if np.isnan(val)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_empty_space(self, state):\r\n for i in range(3):\r\n for j in range(3):\r\n if state[i][j] == 0:\r\n return (i, j)",
"def empty_cells(state):\n cells = []\n\n for i, row in enumerate(state):\n for j, col in enumerate(row):\n if ... | [
"0.76093525",
"0.7468441",
"0.7295901",
"0.7269713",
"0.6574166",
"0.64868623",
"0.6456239",
"0.6417287",
"0.6342308",
"0.63299274",
"0.63008666",
"0.6279291",
"0.6252789",
"0.62336254",
"0.6222215",
"0.6155667",
"0.6147377",
"0.6135551",
"0.6135358",
"0.6124764",
"0.6077776"... | 0.6915941 | 6 |
Takes the current state as input and returns all possible (unused) values that can be placed on the board | def allowed_values(self, curr_state):
used_values = [val for val in curr_state if not np.isnan(val)]
agent_values = [val for val in self.all_possible_numbers if val not in used_values and val % 2 !=0]
env_values = [val for val in self.all_possible_numbers if val not in used_values and val % 2 =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_moves(board_state):\n for x, y in itertools.product(range(len(board_state)), range(len(board_state[0]))):\n if board_state[x][y] == 0:\n yield (x, y)",
"def find_possible_actions(board_state):\n empty_slot_indices = [ind+1 for ind,\n val in enumerate(board_state) if v... | [
"0.6636697",
"0.63490367",
"0.63475925",
"0.6340006",
"0.620984",
"0.620984",
"0.620984",
"0.6203299",
"0.614875",
"0.6129455",
"0.6121966",
"0.609962",
"0.6083529",
"0.6052959",
"0.6052515",
"0.6048239",
"0.60178345",
"0.6011302",
"0.59714323",
"0.5966179",
"0.5935112",
"0... | 0.66015315 | 3 |
Gets the gas measurement running status from the gas_measuring bit. | def _get_gas_measuring_status(self):
readValue = self._read_register_1ubyte(self.BME680_EAS_STATUS_0)
return True if ((readValue & 0b01000000) == 0b01000000) else False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_measuring_status(self):\n readValue = self._read_register_1ubyte(self.BME680_EAS_STATUS_0)\n\n return True if ((readValue & 0b00100000) == 0b00100000) else False",
"def _get_state(self):\n # gst's get_state function returns a 3-tuple; we just want the\n # status flag in posit... | [
"0.64783454",
"0.6166575",
"0.60416126",
"0.58871764",
"0.57596236",
"0.5689763",
"0.5662393",
"0.5607609",
"0.5563968",
"0.54711574",
"0.54394174",
"0.543099",
"0.5428076",
"0.53595954",
"0.5358985",
"0.53451943",
"0.5344086",
"0.5331095",
"0.5327449",
"0.5326428",
"0.532067... | 0.7603017 | 0 |
Return the config, or make a default one. | def load_config(cfile):
# put in default config file if necessary
if not cfile.exists():
cp = configparser.ConfigParser()
cp['DEFAULT'] = {
'msg': 'You need an account section for each user, please setup',
'last': '1972-01-01:T00:00:00+00.00'
}
cp['accou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config() -> Optional[Config]:\n return CurrentConfig.get()",
"def get_config() -> Config:\n return get_or_set('config', build_configuration)",
"def default(self):\n return self._configs[0] if len(self._configs) else None",
"def get_config():\n return CONFIG",
"def get_config():\n ... | [
"0.7944727",
"0.77648294",
"0.74178535",
"0.7354041",
"0.7164997",
"0.71308655",
"0.7113548",
"0.71006525",
"0.70656115",
"0.6978565",
"0.69735235",
"0.6942252",
"0.69135696",
"0.69135696",
"0.68702006",
"0.68581367",
"0.68534225",
"0.6834092",
"0.68217975",
"0.6803289",
"0.6... | 0.0 | -1 |
Save image as png. | def save(self, path: str) -> None:
if self._encoded_image:
path = self._path_as_png(path)
self._encoded_image.save(path)
else:
print("Error! Image was not encoded yet.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_png(self, filename):\n post_script = self.canvas.postscript().encode()\n img = Image.open(io.BytesIO(post_script))\n img.save(filename, format=\"PNG\")",
"def save_image(self):\r\n filename = filedialog.asksaveasfilename(title='Save Image As...',\r\n filetypes=((\"Port... | [
"0.7827139",
"0.7578182",
"0.73077273",
"0.7283767",
"0.7254829",
"0.72451997",
"0.72343475",
"0.7185318",
"0.7178833",
"0.71666765",
"0.7151643",
"0.71448463",
"0.7142283",
"0.7131713",
"0.7130738",
"0.7082769",
"0.7042542",
"0.7010139",
"0.6972415",
"0.69459313",
"0.6936680... | 0.63678974 | 65 |
Split string every n characters. | def _split(string: str, n: int):
return [string[start : start + n] for start in range(0, len(string), n)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_n(s, n):\n return [s[k:k + n] for k in range(0, len(s), n)]",
"def split_string(self, string, n):\n if len(string) == 0:\n return ['']\n blocks = []\n while len(string) > 0:\n blocks.append(string[:n])\n string = string[n:]\n return blocks",
"def split_text(text, n=... | [
"0.80854625",
"0.7924512",
"0.75947547",
"0.7311565",
"0.7300342",
"0.71256155",
"0.71256155",
"0.68727595",
"0.6869807",
"0.6779561",
"0.6720155",
"0.6628983",
"0.65802544",
"0.6482735",
"0.6408883",
"0.6385943",
"0.63355434",
"0.6279037",
"0.62563705",
"0.6196401",
"0.61926... | 0.8229423 | 0 |
Display the welcome page | def index(request):
search_form = SearchForm()
return render(request, 'store/index.html', {'search_form': search_form}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def welcome(self):\n print(\"Welcome to \" + self.title+\".\\n\")",
"def welcome():\n return render_template(\"NFL.html\")",
"def welcome(self):\n if self.user:\n return self.render('welcome.html')\n self.redirect('/register')",
"def welcome(self):\n print(\"\\t\\t\\... | [
"0.8136997",
"0.7884278",
"0.7660725",
"0.76355094",
"0.7624307",
"0.7608136",
"0.7516166",
"0.746833",
"0.74668956",
"0.74534273",
"0.7408694",
"0.7386988",
"0.7346197",
"0.7327606",
"0.7248024",
"0.7216696",
"0.7202219",
"0.7183113",
"0.7170697",
"0.71466744",
"0.7141775",
... | 0.0 | -1 |
Returns the user who performed the request or ``None``. Implementations should override this method. | def __call__(self, req):
return req.remote_user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(self):\n return str(self.request.user.id)",
"def target_user(self):\n return self.request.user",
"def get_user(self):\n return self.get('users/self')",
"def get_user(self):\n return None",
"def get_current_user():\n request = get_current_request()\n return get... | [
"0.8058133",
"0.80314475",
"0.78908825",
"0.77858555",
"0.77130955",
"0.76979434",
"0.76979434",
"0.76767296",
"0.76522017",
"0.7595974",
"0.75733936",
"0.7568656",
"0.75179994",
"0.75179994",
"0.75179994",
"0.75179994",
"0.75179994",
"0.7503244",
"0.7501827",
"0.7501827",
"0... | 0.7929881 | 2 |
Returns the user who performed the request or ``None``. | def authenticate(req):
# Since authentication could be expensive (e.g. database access),
# we cache the result in `environ['rex.user']`.
if 'rex.user' not in req.environ:
auth_type = Authenticate.top()
req.environ['rex.user'] = auth_type()(req)
return req.environ['rex.user'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, req):\n return req.remote_user",
"def get_user(self):\n return str(self.request.user.id)",
"def target_user(self):\n return self.request.user",
"def get_current_user():\n request = get_current_request()\n return getattr(request, 'user', None)",
"def get_user(se... | [
"0.79704005",
"0.79478294",
"0.7914513",
"0.78707606",
"0.7775508",
"0.7743685",
"0.7657617",
"0.7593116",
"0.7463337",
"0.74622995",
"0.74622995",
"0.74540883",
"0.7448083",
"0.7448083",
"0.7448083",
"0.7448083",
"0.7448083",
"0.74434984",
"0.74357957",
"0.74002576",
"0.7392... | 0.0 | -1 |
Determine the glibc version. If running in Docker, this is done by interrogating libc.so.6; outside docker, we can use os.confstr(). | def target_glibc_version(self, app):
if self.use_docker:
try:
output = self.tools.docker.check_output(
["ldd", "--version"],
image_tag=app.target_image,
)
# On Debian/Ubuntu, ldd --version will give you output of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kernel_version():\r\n try:\r\n return utils.run('uname -r').stdout.strip()\r\n except:\r\n logging.info(\"Not Found\")\r\n return -1",
"def osversion():\n return platform()",
"def libc_ver(executable=None, lib='', version='', chunksize=16384):\n if not executable:\n ... | [
"0.67481524",
"0.6445227",
"0.63593394",
"0.63422006",
"0.6330256",
"0.63095325",
"0.6250788",
"0.6247566",
"0.612814",
"0.61073667",
"0.6093997",
"0.6072668",
"0.6072668",
"0.60015935",
"0.59942347",
"0.5980634",
"0.5978849",
"0.59579396",
"0.59515923",
"0.59385496",
"0.5924... | 0.7560223 | 0 |
The Docker image tag for an app. | def docker_image_tag(self, app):
return f"briefcase/{app.bundle}.{app.app_name.lower()}:{app.target_vendor}-{app.target_codename}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_tag(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"image_tag\")",
"def image(self):\n return \"{}/{}:{}\".format(\n self.namespace,\n self.name,\n self.build.commit.tag if self.build.commit.tag\n else self... | [
"0.6631285",
"0.66244906",
"0.65574026",
"0.6544671",
"0.6429471",
"0.63669485",
"0.63392276",
"0.631756",
"0.63062376",
"0.6117049",
"0.6077721",
"0.60664666",
"0.60215396",
"0.5999348",
"0.5997951",
"0.5936384",
"0.59169096",
"0.5890594",
"0.58686674",
"0.58462656",
"0.5816... | 0.82153183 | 0 |
f = sigmoid(h_, x) i = sigmoid(h_, x) o = sigmoid(h_, x) c' = tanh(h_, x) c = f c_ + i c' h = o tanh(c) | def __call__(self, h_, x):
# h_: the concatenation of previous hidden state
# and memory cell state
# x_i/x: the current input state for input gate
# x_f/x: the current input state for forget gate
# x_o/x: the current input state for output gate
# x_c/x: the current in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigmoid(z):\r\n \r\n return vSigmoid(z);",
"def _tanh_to_sigmoid(x):\n return x * 0.5 + 0.5",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(z):\n return 1 / (1 + e ** -z)",
"def _tanh_sigmoid(tensor):\n return 2 * sigmoi... | [
"0.778385",
"0.7780358",
"0.77095145",
"0.77095145",
"0.7699292",
"0.76791716",
"0.76727927",
"0.766363",
"0.76360923",
"0.760253",
"0.7552193",
"0.7547578",
"0.7525224",
"0.7525224",
"0.7523873",
"0.751443",
"0.75021064",
"0.74947006",
"0.74947006",
"0.74947006",
"0.74947006... | 0.0 | -1 |
r"""Find other nodes in the same community. e.g. If the node starts with letter "i", the other nodes start with letter "i" in the same community dict group are its community neighbors. | def get_community_member(self, partition, community_dict, node, kind):
comm = community_dict[partition[node]]
return [x for x in comm if x.startswith(kind)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_common_neighbour_node_pairs(self):\n node_pairs = []\n for node1 in self.graph.nodes():\n for node2 in self.graph.nodes():\n if node1 != node2:\n neighbour_count = self.neighbour_counts[(node1, node2)]\n if neighbour_count >= 1:... | [
"0.6407181",
"0.60777986",
"0.6049951",
"0.60212266",
"0.5999063",
"0.59837407",
"0.5870106",
"0.58532846",
"0.58491075",
"0.5847378",
"0.5843382",
"0.578352",
"0.5780858",
"0.57684267",
"0.57539135",
"0.5750825",
"0.5710576",
"0.5681089",
"0.5676345",
"0.56633115",
"0.565925... | 0.0 | -1 |
r"""Get a batch of neighborhood embedding tensor according to input id. | def get_neigh_info(self, user, item):
batch_u_neigh = self.u_neigh[user]
batch_i_neigh = self.i_neigh[item]
return batch_u_neigh, batch_i_neigh | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embedded(self, word_ids, embedding_tensor, scope=\"embedding\"):\n with tf.variable_scope(scope):\n with tf.device(\"/cpu:0\"):\n inputs = tf.nn.embedding_lookup(embedding_tensor, word_ids)\n return inputs",
"def get_embed(input_data, vocab_size, embed_dim):\n # todo 需要编程:\n # 1、构建嵌入矩... | [
"0.6467756",
"0.6342823",
"0.63305527",
"0.6327372",
"0.6166272",
"0.611713",
"0.60754913",
"0.6049201",
"0.6048646",
"0.6010365",
"0.5964401",
"0.59567195",
"0.5818743",
"0.58130175",
"0.5803962",
"0.5752994",
"0.57426816",
"0.57211095",
"0.570835",
"0.56867427",
"0.5673889"... | 0.0 | -1 |
Initialize your data structure here. Set the size of the queue to be k. | def __init__(self, k: int):
self.k = k
self.q = ['#'] * k
self.front = 0
self.rear = 0
self.empty = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, k):\n self.queue = []\n self.size = k",
"def __init__(self, k):\n self.queue = [0]*k\n self.headIndex = 0\n self.count = 0\n self.capacity = k",
"def __init__(self, k: int):\n self.queue = [0]*k\n self.headIndex = 0\n self.count ... | [
"0.85155606",
"0.8471658",
"0.8441451",
"0.8408407",
"0.8363247",
"0.8300094",
"0.80658275",
"0.8065754",
"0.7868953",
"0.7860204",
"0.7748154",
"0.768231",
"0.7668362",
"0.76038784",
"0.7504321",
"0.73879427",
"0.71936107",
"0.6974544",
"0.6911939",
"0.690878",
"0.6888063",
... | 0.712905 | 17 |
Get the front item from the queue. | def Front(self) -> int:
q, k, front, rear, empty = self.q, self.k, self.front, self.rear, self.empty
if self.isEmpty():
return -1
return q[front] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def Front(self):\r\n if (len(self.queue) >= 1):\r\n return self.queue[0]\r\n else:\r\n return -1",
"def fr... | [
"0.90385115",
"0.89434814",
"0.846308",
"0.8426328",
"0.8357853",
"0.83309764",
"0.83309764",
"0.83211964",
"0.83211964",
"0.82988536",
"0.8279939",
"0.8216258",
"0.8213497",
"0.8213348",
"0.8209029",
"0.8205413",
"0.81683636",
"0.812805",
"0.81277895",
"0.8076473",
"0.799508... | 0.0 | -1 |
Get the last item from the queue. | def Rear(self) -> int:
q, k, front, rear, empty = self.q, self.k, self.front, self.rear, self.empty
if self.isEmpty():
return -1
return q[rear] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last(self):\n if self.is_empty():\n raise ValueError('Queue is empty!')\n return self.last_node().element().value()",
"def last(self):\n return self.deque[-1]",
"def last_item(self):\n return self.container[self.length-1]",
"def Rear(self):\r\n if (len(self.q... | [
"0.82451856",
"0.80613",
"0.8023248",
"0.77849776",
"0.7629952",
"0.7628782",
"0.76055205",
"0.75932163",
"0.7584632",
"0.75637347",
"0.7543559",
"0.75429386",
"0.7518005",
"0.7494505",
"0.746898",
"0.7461607",
"0.74455327",
"0.73941535",
"0.73889613",
"0.73865324",
"0.737336... | 0.0 | -1 |
Checks whether the empty queue is empty or not. | def isEmpty(self) -> bool:
q, k, front, rear, empty = self.q, self.k, self.front, self.rear, self.empty
if front == rear and empty:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def ... | [
"0.88339007",
"0.88261926",
"0.8809006",
"0.8809006",
"0.87976897",
"0.8657412",
"0.86178124",
"0.8523619",
"0.85154",
"0.85117793",
"0.8463068",
"0.8441851",
"0.8412663",
"0.8385898",
"0.8366842",
"0.83660173",
"0.82652265",
"0.8244517",
"0.8228875",
"0.82199997",
"0.8219999... | 0.0 | -1 |
Checks whether the empty queue is full or not. | def isFull(self) -> bool:
q, k, front, rear, empty = self.q, self.k, self.front, self.rear, self.empty
if front == rear and not empty:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isFull(self):\n return len(self.queue) == self.size",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0... | [
"0.86530983",
"0.8465255",
"0.8435378",
"0.8426017",
"0.8426017",
"0.83605266",
"0.83285874",
"0.8209579",
"0.8119518",
"0.81084037",
"0.80805624",
"0.80589753",
"0.800462",
"0.79773045",
"0.78969467",
"0.7885501",
"0.788042",
"0.78365314",
"0.78163135",
"0.78163135",
"0.7809... | 0.736034 | 57 |
Get the front element. | def peek(self):
if not self.s2.isEmpty():
return self.s2.peek()
while not self.s1.isEmpty():
self.s2.push(self.s1.pop())
return self.s2.peek() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def isEmpty(self):
return self.s1.isEmpty() and self.s2.isEmpty() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.9053733",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462... | 0.0 | -1 |
Sends a 401 response that enables basic auth | def authenticate():
return Response(
'Could not verify your access level for that URL.\n'
'You have to login with proper credentials', 401,
{'WWW-Authenticate': 'Basic realm="Login Required"'}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate():\n return Response('Not Authorized', 401, {'WWW-Authenticate': 'Basic realm=\"api\"'})",
"def authenticate():\n return Response(\n '', 401, {'WWW-Authenticate': 'Basic realm=\"Login Required\"'}\n )",
"def authenticate():\n return Response(\n 'You have to login with pro... | [
"0.8093736",
"0.80926424",
"0.7958403",
"0.7852648",
"0.7843114",
"0.7824419",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
"0.7810746",
... | 0.774767 | 33 |
Generates a unique filename to store image. Also stores original filename. | def _gen_image_filename(instance, filename):
# First, store the original filename in the model
instance.original_filename = filename
return _unique_path(instance.owner.pk, filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_image_filename():\n now = datetime.now().strftime('%a-%w-%b-%H:%M:%S')\n return 'CCTV_{0}.jpg'.format(now)",
"def filename_generate(image_class, size=12, chars=string.ascii_uppercase + string.ascii_lowercase + string.digits):\n\tnew_filename = time.strftime(\"%d-%m-%Y_\")\n\tnew_filename = new... | [
"0.7982899",
"0.7708101",
"0.76466966",
"0.7639321",
"0.75900793",
"0.75539184",
"0.75164586",
"0.7424421",
"0.7408833",
"0.73893046",
"0.7331677",
"0.7297422",
"0.72926384",
"0.7260037",
"0.7200859",
"0.718217",
"0.7162352",
"0.7157697",
"0.7139449",
"0.7078593",
"0.7068687"... | 0.8410429 | 0 |
Generates a unique filename for storage | def _unique_path(user_id, filename, category='images'):
ext = os.path.splitext(filename)[-1]
new_filename = '{}{}'.format(uuid.uuid4(), ext)
return os.path.join(category, str(user_id), new_filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_filename(filename: str) -> str:\n return f\"{str(uuid.uuid4())}.{get_extension(filename)}\"",
"def get_file_name() -> str:\n import uuid\n uniq_append_string = uuid.uuid4().hex\n return \"LOCAL_STORAGE_{}\".format(uniq_append_string)",
"def _generate_filename(instance, filename, prefix... | [
"0.81155145",
"0.8114019",
"0.79228014",
"0.78405267",
"0.75812864",
"0.751177",
"0.7436106",
"0.7432536",
"0.7410929",
"0.73962206",
"0.7367662",
"0.735312",
"0.7324727",
"0.73191124",
"0.7297621",
"0.7267686",
"0.72442544",
"0.7241578",
"0.723954",
"0.72048855",
"0.71788514... | 0.7050707 | 31 |
Helperfunction to generate a truncated normal distribution for initializing layers. Currently have a fixed mean and STD. That should probably be changed so it is passed in as params (TODO). | def truncated_normal_(tensor):
mean = 0
std = 1/float(np.sqrt(tensor.shape[0]))
size = tensor.shape
tmp = tensor.new_empty(size + (4,)).normal_()
valid = (tmp < 2) & (tmp > -2)
ind = valid.max(-1, keepdim=True)[1]
tensor.data.copy_(tmp.gather(-1, ind).squeeze(-1))
tensor.data.mul_(std).a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def truncated_normal_initializer(mean=0.0, stddev=1.0, seed=None,\n dtype=dtypes.float32):\n def _initializer(shape, dtype=_assert_float_dtype(dtype)):\n return random_ops.truncated_normal(shape, mean, stddev, dtype, seed=seed)\n return _initializer",
"def _truncated_normal_i... | [
"0.79967463",
"0.7877042",
"0.74116564",
"0.732361",
"0.72766256",
"0.7251886",
"0.72215515",
"0.72215515",
"0.7195864",
"0.7195864",
"0.71218616",
"0.71171254",
"0.7010709",
"0.6982884",
"0.6949134",
"0.69401187",
"0.69056576",
"0.69056576",
"0.69056576",
"0.69056576",
"0.69... | 0.7161805 | 10 |
Initialize weights according `He normal` distribution. With mean = 0, std = sqrt(2 / num_input) | def he_normal(weight_shape):
if len(weight_shape) == 4:
fW, fH, fC, _ = weight_shape
return np.random.normal(0, np.sqrt(2 / (fW*fH*fC)), weight_shape)
num_input, _ = weight_shape
return np.random.normal(0, np.sqrt(2 / num_input), weight_shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weights_initializer(self):\n self.weights = [np.random.normal(0, 1 / np.sqrt(x), (x, y)) for x, y in list(zip(self.structure[1:], self.structure[:-1]))]",
"def _random_weight_initialization(self, mean=0, stddev=1):\n self.slp_weights = np.random.normal(mean, stddev, size=(self.n_rbfs, self.n_ta... | [
"0.7503431",
"0.7408427",
"0.7367561",
"0.73403424",
"0.7089664",
"0.70541257",
"0.70263755",
"0.7019481",
"0.69573337",
"0.6924313",
"0.6890969",
"0.68354094",
"0.68337166",
"0.6804938",
"0.67935914",
"0.6783018",
"0.677927",
"0.6733174",
"0.67174727",
"0.67163056",
"0.67162... | 0.7247501 | 4 |
Initialize weights according `He uniform` distribution within the range [limit, limit]. With limit = sqrt(6 / num_input) | def he_uniform(weight_shape):
if len(weight_shape) == 4:
fW, fH, fC, _ = weight_shape
return np.random.uniform(-np.sqrt(6 / (fW*fH*fC)), np.sqrt(6 / (fW*fH*fC)), weight_shape)
num_input, _ = weight_shape
return np.random.uniform(-np.sqrt(6 / num_input), np.sqrt(6 / num_input), weight_shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weightGenerate(self):\n\t\tfor i in range(0, self.numberOfInput):\n\t\t\tself.weight.append(random.random()-0.5)",
"def initialize_weights(self, n_features, random=True):\n\t\tif random:\n\t\t\tlimit = 1 / math.sqrt(n_features)\n\t\t\tself.weights = np.random.uniform(-limit, limit, (n_features, ))\n\t\telse:... | [
"0.6984782",
"0.6899529",
"0.6888395",
"0.6883296",
"0.6883296",
"0.6880714",
"0.68685216",
"0.685865",
"0.685865",
"0.685865",
"0.68468636",
"0.67407966",
"0.6729194",
"0.6724258",
"0.66541606",
"0.66156274",
"0.6608521",
"0.6519209",
"0.6504529",
"0.6504529",
"0.64602476",
... | 0.6569129 | 17 |
Initialize weights according `Xavier normal` distribution. With mean = 0, std = sqrt(2 / (num_input + num_output)) | def xavier_normal(weight_shape):
if len(weight_shape) == 4:
fW, fH, fC, num_fitls = weight_shape
return np.random.normal(0, np.sqrt(2 / (fW*fH*fC + num_fitls)), weight_shape)
num_input, num_output = weight_shape
return np.random.normal(0, np.sqrt(2 / (num_input + num_output)), weight_shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_weights(self):\n nn.init.xavier_normal_(self.out.weight)",
"def XavierInit(self):\n\n raw_std = (2 / (self.num_input + self.num_output))**0.5\n if 'relu' == self.act_function:\n init_std = raw_std * (2**0.5)\n elif 'sigmoid' == self.act_function:\n init... | [
"0.7733447",
"0.76863474",
"0.76384735",
"0.7346416",
"0.72480375",
"0.7084787",
"0.7034354",
"0.70235884",
"0.69945717",
"0.6968175",
"0.6960539",
"0.6950034",
"0.6838631",
"0.6808113",
"0.6804572",
"0.6796685",
"0.67875403",
"0.6761561",
"0.67271864",
"0.67271864",
"0.67106... | 0.717963 | 5 |
Initialize weights according `Xavier uniform` distribution within the range [limit, limit]. With limit = sqrt(6 / (num_input + num_output)) | def xavier_uniform(weight_shape):
if len(weight_shape) == 4:
fW, fH, fC, num_fitls = weight_shape
return np.random.uniform(-np.sqrt(6 / (fW*fH*fC + num_fitls)), np.sqrt(6 / (fW*fH*fC + num_fitls)), weight_shape)
num_input, num_output = weight_shape
return np.random.uniform(-np.sqrt(6 / (num_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_weights_xavier(self):\n\t\tself.weights = [np.random.uniform(-1/sqrt(size1), 1/sqrt(size1)) for size1, size2 in zip(self.sizes[:-1], self.sizes[1:])]\n\t\tself.biases = [np.zeros([size, ]) for size in self.sizes[1:]]",
"def init_weight(self):\r\n xavier_init(self.output_proj, distribution='... | [
"0.7463634",
"0.7329519",
"0.7169856",
"0.71683425",
"0.71683425",
"0.71455485",
"0.71455485",
"0.71455485",
"0.696932",
"0.68744695",
"0.6844391",
"0.6712294",
"0.67112017",
"0.6709123",
"0.6692562",
"0.66801274",
"0.66656244",
"0.6633836",
"0.6623387",
"0.6623387",
"0.66047... | 0.66768354 | 16 |
Initialize weights according standard normal distribution with mean 0 variance 1. | def standard_normal(weight_shape):
return np.random.normal(size=weight_shape) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weights_initializer(self):\n self.weights = [np.random.normal(0, 1 / np.sqrt(x), (x, y)) for x, y in list(zip(self.structure[1:], self.structure[:-1]))]",
"def init_weights(self):\n \n self.w = np.random.randn(self.D) / np.sqrt(self.D)",
"def _random_weight_initialization(self, mean=0,... | [
"0.8134225",
"0.80269206",
"0.79447985",
"0.7880094",
"0.77717716",
"0.77559775",
"0.7735253",
"0.7613813",
"0.75843936",
"0.7583921",
"0.7532536",
"0.7529892",
"0.74988186",
"0.7456885",
"0.7423406",
"0.74045783",
"0.73446226",
"0.7336515",
"0.7332253",
"0.73213094",
"0.7286... | 0.7049347 | 50 |
Generate a presigned URL to invoke an S3.Client method Not all the client methods provided in the AWS Python SDK are supported. | def create_presigned_url_expanded(objName):
# Generate a presigned URL for the S3 client method
s3_client = boto3.client('s3')
try:
response = s3_client.generate_presigned_url('get_object',
Params={
'Bucket': 'ece1779-a3-bucket',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):\n pass",
"def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):\n pass",
"def generate_presigned_url(ClientMethod=None, Params=None, ExpiresIn=None, HttpMethod=None):\n p... | [
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.73038787",
"0.7218132",
"0.7218132",
"0.7218132",
... | 0.6564837 | 24 |
Creates a weight variable sampled from a normal distribution | def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variable(initial) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WeightInitializer():\n return np.random.uniform(-1, 1)",
"def normal_sample(mu, sigma):\n return mu + sigma * torch.randn_like(sigma)",
"def standard_normal(weight_shape):\n return np.random.normal(size=weight_shape)",
"def init_weights(self):\n \n self.w = np.random.randn(self.D) ... | [
"0.7149723",
"0.70733315",
"0.70507354",
"0.6966155",
"0.6960368",
"0.6891495",
"0.68173784",
"0.6793721",
"0.6790546",
"0.6764205",
"0.6637477",
"0.66283286",
"0.66279685",
"0.65788096",
"0.65788096",
"0.65788096",
"0.65788096",
"0.65788096",
"0.65748507",
"0.6542784",
"0.65... | 0.6190509 | 53 |
Calculate reward for a single step transition | def _calculate_single_step_reward(
self,
state: EnvState,
action: int,
transition_function_reward_output: chex.Array,
params: EnvParams,
) -> int:
cost = jnp.dot(transition_function_reward_output, params.cost_components)
reward = -1 * cost
return rewar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_reward(self):\n if self.status():\n return self.current_step/self.ep_length # the reward is proportional to the duration \n else:\n return 0",
"def _compute_reward(self): \n reward = -1\n return reward",
"def reward(input):\n state = np.array([input[0], input[1... | [
"0.8068978",
"0.76587135",
"0.7587889",
"0.7578856",
"0.7549204",
"0.7503443",
"0.7481505",
"0.74812055",
"0.7467154",
"0.73962283",
"0.7393348",
"0.7391761",
"0.73647404",
"0.73616785",
"0.7330723",
"0.72702837",
"0.7244375",
"0.7224694",
"0.72191805",
"0.718389",
"0.7179192... | 0.78513455 | 1 |
Get uid (unique ID) for the given WKN. | def get_uid(new_data, metadata, conn):
for awe in new_data["all_wkn_entry"]:
for key in ["wkn","isin"]:
if awe[key] == "":continue
if key == "wkn":
s = select([metadata.tables["WKN"]]).where(metadata.tables["WKN"].c.WKN == awe[key]).order_by(
metad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uid(self) -> str:\n return pulumi.get(self, \"uid\")",
"def uid(self):\n return safeInt(self.tag(\"uid\"))",
"def known_uid():\n return '48ee71d9-20f0-41fc-a99f-c518121a880e'",
"def uid():\r\n u = str(uuid.uuid4())[:22]\r\n u = u.replace(\"-\",\"_\")\r\n return u",
"def uid(se... | [
"0.6630768",
"0.65594506",
"0.65360737",
"0.6527823",
"0.64277464",
"0.6392679",
"0.6379589",
"0.6347621",
"0.6347621",
"0.6347621",
"0.63460857",
"0.6330956",
"0.63282406",
"0.6312921",
"0.6261474",
"0.6186197",
"0.6186197",
"0.6186197",
"0.6181958",
"0.6181958",
"0.61774105... | 0.5522843 | 74 |
r""" Either use a fixed alpha, or compute it with an exponential decay (if ``alpha0=None``). | def decreasing_alpha__GLR(alpha0=None, t=1, exponentBeta=EXPONENT_BETA, alpha_t1=ALPHA_T1):
assert exponentBeta > 1.0, "Error: decreasing_alpha__GLR should have a exponentBeta > 1 but it was given = {}...".format(exponentBeta) # DEBUG
if alpha0 is not None:
return alpha0
return alpha_t1 / max(1, t)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_alpha_init(alpha, decay):\n\tif not decay or decay <= 0:\n\t\treturn alpha\n\telse:\n\t\treturn float(alpha * decay)",
"def test_exp_decay(self, alpha: float):\n x = np.linspace(0, 1, 100)\n y = np.exp(alpha * x)\n\n alpha_guess = guess.exp_decay(x, y)\n\n self.assertAlmostEq... | [
"0.75204176",
"0.74296445",
"0.68969023",
"0.6835959",
"0.6742396",
"0.66513157",
"0.6622966",
"0.6614713",
"0.6572307",
"0.65696436",
"0.651566",
"0.6473145",
"0.64678293",
"0.6439873",
"0.6428237",
"0.63604295",
"0.63410145",
"0.6238688",
"0.62384784",
"0.623135",
"0.622354... | 0.5845948 | 44 |
Get PredefinedMessage datastore entity or create it if not existing. | def GetOrCreatePredefinedMessage(message_type, lab_name, content):
exisiting_predefined_message_entity = GetPredefinedMessage(
message_type=message_type, lab_name=lab_name, content=content)
if exisiting_predefined_message_entity:
return exisiting_predefined_message_entity
else:
return datastore_enti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetPredefinedMessage(message_type, lab_name, content):\n predefined_message_entities = (\n datastore_entities.PredefinedMessage.query()\n .filter(datastore_entities.PredefinedMessage.type == message_type).filter(\n datastore_entities.PredefinedMessage.lab_name == lab_name).filter(\n ... | [
"0.68195426",
"0.65582556",
"0.57011265",
"0.5647662",
"0.5533371",
"0.54775923",
"0.5372559",
"0.534231",
"0.5339693",
"0.5339149",
"0.5256763",
"0.5224388",
"0.51546174",
"0.5071481",
"0.50631547",
"0.5060428",
"0.50558394",
"0.5046496",
"0.5036136",
"0.5033243",
"0.5029295... | 0.7676765 | 0 |
Prepare a PredefinedMessage to attach to a Note. | def PreparePredefinedMessageForNote(
message_type, message_id=None, lab_name=None, content=None, delta_count=1):
predefined_message_entity = None
if message_id:
predefined_message_entity = ndb.Key(
datastore_entities.PredefinedMessage, message_id).get()
if (not predefined_message_entity
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _construct_message(self):\n self.message[\"text\"] = \"\"\n if self.from_:\n self.message[\"text\"] += \"From: \" + self.from_ + \"\\n\"\n if self.subject:\n self.message[\"text\"] += \"Subject: \" + self.subject + \"\\n\"\n\n self.message[\"text\"] += self.bod... | [
"0.5902068",
"0.54789835",
"0.5411161",
"0.5397969",
"0.53778887",
"0.528457",
"0.51821566",
"0.51811504",
"0.5179907",
"0.5102841",
"0.50877404",
"0.50477374",
"0.5024491",
"0.50166047",
"0.50101256",
"0.49584654",
"0.4940626",
"0.49365306",
"0.49365306",
"0.49202845",
"0.49... | 0.6577584 | 0 |
Create a client for Google Cloud Pub/Sub. | def _CreatePubsubClient():
client = pubsub_client.PubSubClient()
client.CreateTopic(DEVICE_NOTE_PUBSUB_TOPIC)
client.CreateTopic(HOST_NOTE_PUBSUB_TOPIC)
return client | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCloudPubSubService(version):\n credentials = _GetCredentials()\n\n service = build('pubsub', version, credentials=credentials)\n\n return service",
"def from_service_account_json(cls, service_account_path) -> 'PubSubClient':\n client = pubsub.PublisherClient.from_service_account_json(\n filen... | [
"0.68315613",
"0.64384186",
"0.64002514",
"0.6348541",
"0.6153353",
"0.6098759",
"0.6075227",
"0.59679025",
"0.5934572",
"0.58524835",
"0.5823112",
"0.5803386",
"0.57960606",
"0.5783726",
"0.5775977",
"0.5761972",
"0.5746739",
"0.5709166",
"0.5681782",
"0.5663954",
"0.5631636... | 0.7936616 | 0 |
Return the indices in the flat array corresponding to a set of coordinates | def get_pixel_indices(self, lats, lons):
raise NotImplementedError("MapBase.get_pixel_indices()") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Indexes(self, latitudes, longitudes):\n res = self._transform.TransformPoints(\n np.column_stack((longitudes, latitudes)))\n res = list(zip(*res))\n x, y = np.array(res[0]), np.array(res[1])\n idx_col = self._inv_txf[0] + self._inv_txf[1] * x + self._inv_txf[2] * y\n idx_row = self._inv_t... | [
"0.72544056",
"0.699644",
"0.6787217",
"0.6750489",
"0.6670096",
"0.66512316",
"0.66321975",
"0.66313195",
"0.6595267",
"0.6552188",
"0.6534111",
"0.6522179",
"0.64935875",
"0.6447055",
"0.64188486",
"0.64162827",
"0.64118046",
"0.6407785",
"0.63986856",
"0.6343847",
"0.63007... | 0.60723346 | 40 |
Return the flattened pixel indices from an array multidimensional pixel indices. | def xypix_to_ipix(self, xypix, colwise=False):
return np.ravel_multi_index(xypix, self.npix,
order='F' if colwise else 'C',
mode='raise') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flattened_indices_from_row_col_indices(row_indices, col_indices, num_cols):\n return (row_indices * num_cols) + col_indices",
"def matrix_to_flat(self, idx_rows):\n idx = []\n for i in range(self.nts):\n idx.append(self._matrix_to_flat_by_ts(idx_rows, i))\n return idx",
"de... | [
"0.6252088",
"0.62251836",
"0.6077881",
"0.6068672",
"0.5996116",
"0.5976292",
"0.59661597",
"0.59558946",
"0.58537644",
"0.5807536",
"0.57411146",
"0.5738056",
"0.5619338",
"0.5607238",
"0.5600172",
"0.5591637",
"0.55899405",
"0.55746365",
"0.55503386",
"0.55487794",
"0.5542... | 0.0 | -1 |
Return array multidimensional pixel indices from flattened index. | def ipix_to_xypix(self, ipix, colwise=False):
return np.unravel_index(ipix, self.npix,
order='F' if colwise else 'C') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indices(self):\n return tuple([slice(*r) for r in self.location])",
"def atom_idxs(self):\n\n return np.array([atom.atom_idxs for atom in self])",
"def get_img_indices():\n if K.image_dim_ordering() == 'th':\n return 0, 1, 2, 3\n else:\n return 0, 3, 1, 2",
"def masked_i... | [
"0.6260054",
"0.6242442",
"0.6184225",
"0.60626626",
"0.6027308",
"0.6007625",
"0.60039455",
"0.599313",
"0.59860826",
"0.59833086",
"0.59655774",
"0.5961935",
"0.5952346",
"0.5943402",
"0.59407127",
"0.59323806",
"0.5924884",
"0.59163314",
"0.59142196",
"0.5895938",
"0.58873... | 0.0 | -1 |
Return the indices in the flat array corresponding to a set of coordinates | def get_pixel_indices(self, lons, lats, ibin=None):
lons = np.array(lons, ndmin=1)
lats = np.array(lats, ndmin=1)
if len(lats) != len(lons):
raise RuntimeError('Map.get_pixel_indices, input lengths '
'do not match %i %i' % (len(lons), len(lats)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Indexes(self, latitudes, longitudes):\n res = self._transform.TransformPoints(\n np.column_stack((longitudes, latitudes)))\n res = list(zip(*res))\n x, y = np.array(res[0]), np.array(res[1])\n idx_col = self._inv_txf[0] + self._inv_txf[1] * x + self._inv_txf[2] * y\n idx_row = self._inv_t... | [
"0.7254887",
"0.699754",
"0.67885065",
"0.675102",
"0.66709274",
"0.665266",
"0.6634117",
"0.6632299",
"0.659693",
"0.6552572",
"0.6535903",
"0.6522798",
"0.6495028",
"0.64486927",
"0.64199436",
"0.64179915",
"0.6411644",
"0.64080685",
"0.6399557",
"0.6344093",
"0.63018507",
... | 0.57171065 | 96 |
Return the indices in the flat array corresponding to a set of coordinates | def get_pixel_indices(self, lats, lons):
return self._hpx.get_pixel_indices(lats, lons) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Indexes(self, latitudes, longitudes):\n res = self._transform.TransformPoints(\n np.column_stack((longitudes, latitudes)))\n res = list(zip(*res))\n x, y = np.array(res[0]), np.array(res[1])\n idx_col = self._inv_txf[0] + self._inv_txf[1] * x + self._inv_txf[2] * y\n idx_row = self._inv_t... | [
"0.7254887",
"0.699754",
"0.67885065",
"0.675102",
"0.66709274",
"0.665266",
"0.6634117",
"0.6632299",
"0.659693",
"0.6552572",
"0.6535903",
"0.6522798",
"0.6495028",
"0.64486927",
"0.64199436",
"0.64179915",
"0.6411644",
"0.64080685",
"0.6399557",
"0.6344093",
"0.63018507",
... | 0.6255908 | 24 |
Return the indices in the flat array corresponding to a set of coordinates | def get_map_values(self, lons, lats, ibin=None):
theta = np.pi / 2. - np.radians(lats)
phi = np.radians(lons)
pix = hp.ang2pix(self.hpx.nside, theta, phi, nest=self.hpx.nest)
if self.data.ndim == 2:
return self.data[:, pix] if ibin is None else self.data[ibin, pix]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Indexes(self, latitudes, longitudes):\n res = self._transform.TransformPoints(\n np.column_stack((longitudes, latitudes)))\n res = list(zip(*res))\n x, y = np.array(res[0]), np.array(res[1])\n idx_col = self._inv_txf[0] + self._inv_txf[1] * x + self._inv_txf[2] * y\n idx_row = self._inv_t... | [
"0.72544056",
"0.699644",
"0.6787217",
"0.6750489",
"0.6670096",
"0.66512316",
"0.66321975",
"0.66313195",
"0.6595267",
"0.6552188",
"0.6534111",
"0.6522179",
"0.64935875",
"0.6447055",
"0.64188486",
"0.64162827",
"0.64118046",
"0.6407785",
"0.63986856",
"0.6343847",
"0.63007... | 0.0 | -1 |
return a counts map with sparse index scheme | def sparse_counts_map(self):
if self.hpx._ipix is None:
flatarray = self.data.flattern()
else:
flatarray = self.expanded_counts_map()
nz = flatarray.nonzero()[0]
data_out = flatarray[nz]
return (nz, data_out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_count_map(self) -> Dict[int, int]:\n res: Dict[int, int] = {}\n for sequence_data in self.model.values():\n sequence_data: NGramsSequence = cast(NGramsSequence, sequence_data)\n for count in sequence_data.next_count.values():\n count: int = cast(int, co... | [
"0.6841851",
"0.67011094",
"0.6609091",
"0.6609091",
"0.6513716",
"0.6469802",
"0.6457373",
"0.62947905",
"0.6243027",
"0.6240269",
"0.6223811",
"0.61610305",
"0.6085046",
"0.60753167",
"0.60748726",
"0.60277265",
"0.60225505",
"0.5991211",
"0.5991063",
"0.5974214",
"0.595231... | 0.8131948 | 0 |
Returns the time vector as fraction hour. | def _calc_time(time_lines: list) -> np.ndarray:
time = [time_to_fraction_hour(line.split()[1]) for line in time_lines]
return np.array(time) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decimal_hour(t):\n datetime = t.datetime\n result = []\n for d in datetime:\n hour = d.hour\n minute = d.minute\n second = d.microsecond / 1e6\n dec_hour = hour + (minute/60.) + (second/3600.)\n result.append(dec_hour)\n return np.array(result)",
"def calculate_... | [
"0.65941995",
"0.61760056",
"0.6048775",
"0.6026652",
"0.5995671",
"0.59538686",
"0.59003335",
"0.5672246",
"0.56660575",
"0.5608669",
"0.5608581",
"0.55726975",
"0.5562232",
"0.5562232",
"0.5562232",
"0.5562232",
"0.55042464",
"0.5496841",
"0.5491331",
"0.5459446",
"0.545422... | 0.5784948 | 7 |
Test user should not be able to register with invalid email | def test_user_cannot_register_with_wrong_email_format(self):
response = self.client.post(SIGNUP_URL,
data=json.dumps(
{'username': 'dannyb', 'email': 'danny@', 'password': 'pass254'}),
content_type='a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_registeration_invalid_email(self):\n response = self.signup_a_user(self.user_invalid_email)\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n self.assertEqual(response.data[\"errors\"][\"email\"],\n [\"Enter a valid email address.\"]\n ... | [
"0.8737688",
"0.84907985",
"0.84139776",
"0.83752763",
"0.8337045",
"0.8324125",
"0.8315399",
"0.83049977",
"0.8301585",
"0.82962465",
"0.82946223",
"0.8288698",
"0.8286378",
"0.8286378",
"0.8286378",
"0.8286378",
"0.8286378",
"0.82782334",
"0.8275745",
"0.8270123",
"0.826947... | 0.76170814 | 61 |
Test user should not be able to register with invalid username | def test_user_cannot_register_with_invalid_username(self):
response = self.client.post(SIGNUP_URL,
data=json.dumps(
{'username': '#_danny', 'email': 'danny@gmail.com', 'password': 'pass12345'}),
conte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_user_invalid_username(self):\r\n print(\"Create user invalid username (already taken)\")\r\n u_id = 3\r\n username = \"100\"\r\n password = \"test9999\"\r\n u_type = 1\r\n\r\n prev_noUsers = len(User.query.all())\r\n self.assertEqual(self.system.crea... | [
"0.8449825",
"0.8332466",
"0.8231165",
"0.8222407",
"0.8163457",
"0.8116442",
"0.8113157",
"0.8104145",
"0.81000876",
"0.80743545",
"0.79099417",
"0.78933805",
"0.78923935",
"0.7865561",
"0.784811",
"0.78367937",
"0.7833348",
"0.7829486",
"0.7796298",
"0.77872574",
"0.7785243... | 0.79658014 | 10 |
Test for authenication when password is wrong User should not be able to login | def test_wrong_password(self):
self.test_user.save()
response = self.client.post(LOGIN_URL,
data=json.dumps(
{'username': 'dannyb', 'password': 'andela'}),
content_type='application/json')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_auth_user_fail_bad_password(self):\n\n self.assertFalse(User.authenticate(self.user1.username, \"invalid\"))",
"def test_user_authenticate_invalid_password(self):\n\n user = User.authenticate(\"test1\", \"wrong_password\")\n\n self.assertEqual(user, False)",
"def test_bad_password... | [
"0.85138005",
"0.8218992",
"0.8177",
"0.810058",
"0.8025282",
"0.8020052",
"0.80168617",
"0.797291",
"0.7922583",
"0.7918626",
"0.79020077",
"0.7876341",
"0.78631777",
"0.7853416",
"0.78429997",
"0.7826973",
"0.77978176",
"0.7783886",
"0.7777516",
"0.77253133",
"0.77187395",
... | 0.79139096 | 10 |
Marks a task as read. | def mark_as_read(self):
params = {"ffauth_device_id": self._DiscretelyAuthenticatedObject__device_id,
"ffauth_secret": self._DiscretelyAuthenticatedObject__device_token}
data = {"data": str({"recipient": {"guid": self._DiscretelyAuthenticatedObject__guid, "type": "user"}})}
req... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self):\n if self.status == 'read':\n return\n self.status = 'read'\n self.emit('read')\n self.emit('modified')",
"def read(self, read):\n\n self._read = read",
"def register_read(self):\n self._reads_since_check += 1",
"def mark_as_read(entry):\n ... | [
"0.66925806",
"0.656951",
"0.64890313",
"0.6362167",
"0.63124907",
"0.6099884",
"0.6024473",
"0.60049987",
"0.59801733",
"0.59156305",
"0.58996105",
"0.5898545",
"0.574459",
"0.5699632",
"0.56549096",
"0.5638324",
"0.5616749",
"0.55888474",
"0.5537343",
"0.5501016",
"0.549111... | 0.7376024 | 0 |
Loads json from file | def load_from_json(path):
fh = open(path)
contents = fh.read()
fh.close()
return json.loads(contents) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(file_name):\n return json.load(open(file_name))",
"def load_json(self, file):\n with open(file, 'r', encoding=\"utf8\") as f:\n self.extend(json.load(f))",
"def load_json(filepath: str):\n with open(filepath, encoding=\"utf-8\") as f:\n return json.load(f)",... | [
"0.83734065",
"0.8212851",
"0.8179637",
"0.8166586",
"0.81396335",
"0.81394315",
"0.8132075",
"0.811249",
"0.81076866",
"0.8101009",
"0.8075771",
"0.8015636",
"0.79999757",
"0.7999837",
"0.7967178",
"0.7939863",
"0.7916428",
"0.7907553",
"0.79033124",
"0.7892164",
"0.78888685... | 0.0 | -1 |
Make a row dict for a cell mapping like ttypes.TResult.columns. | def make_to_dict(item, include_timestamp):
return {
'%s:%s' % (cell.family, cell.qualifier): (cell.value, cell.timestamp) if include_timestamp else cell.value
for cell in item
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cell_map(row: TRowResult) -> Dict[bytes, TCell]:\n if row.sortedColumns is not None:\n return {c.columnName: c.cell for c in row.sortedColumns}\n elif row.columns is not None:\n return row.columns\n else: # pragma: no cover\n raise RuntimeError(\"Neither columns nor sortedCo... | [
"0.7327666",
"0.7059982",
"0.6923021",
"0.685189",
"0.67974716",
"0.67613393",
"0.66556305",
"0.65854764",
"0.6485794",
"0.6478379",
"0.6451945",
"0.6451945",
"0.6433892",
"0.6433892",
"0.6433892",
"0.6430846",
"0.636577",
"0.6357546",
"0.6289144",
"0.6271964",
"0.62572855",
... | 0.578092 | 45 |
Make a row dict for sorted column results from scans. | def make_ordered_to_dict(sorted_columns, include_timestamp):
od = OrderedDict()
for column in sorted_columns:
if include_timestamp:
value = (column.cell.value, column.cell.timestamp)
else:
value = column.cell.value
od[column.columnName] = value
return od | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dict(row):\n return dict((key[0], value) for key, value in zip(colnames, row))",
"def make_dicts(cursor, row):\n return dict((cursor.description[idx][0], value)\n for idx, value in enumerate(row))",
"def make_dicts(cursor, row):\n return dict((cursor.description[idx][0], va... | [
"0.68233067",
"0.65694994",
"0.65694994",
"0.64695543",
"0.6464205",
"0.64259243",
"0.63842666",
"0.62376654",
"0.61771697",
"0.611025",
"0.611025",
"0.611025",
"0.6105864",
"0.606467",
"0.6026796",
"0.6007196",
"0.59750414",
"0.5935884",
"0.59159786",
"0.589662",
"0.58914626... | 0.6143541 | 9 |
Test that extra_prefixes works properly as a property. | def test_extra_prefixes(self) -> None:
lib = hammer_tech.library_from_json('{"openaccess techfile": "test/oa"}') # type: hammer_tech.Library
prefixes_orig = [hammer_tech.PathPrefix(prefix="test", path="/tmp/test")]
prefixes = [hammer_tech.PathPrefix(prefix="test", path="/tmp/test")]
l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_prefix(self):\n self.chck_triple('prefix')",
"def test_ipam_prefixes_list(self):\n pass",
"def test_ipam_prefixes_update(self):\n pass",
"def test_ipam_prefixes_available_prefixes_create(self):\n pass",
"def test_ipam_prefixes_create(self):\n pass",
"def test_i... | [
"0.7211293",
"0.70284677",
"0.68328136",
"0.67578906",
"0.6701586",
"0.66839415",
"0.6635539",
"0.6489706",
"0.64229876",
"0.63655794",
"0.6343765",
"0.62912714",
"0.61899525",
"0.60675776",
"0.6006809",
"0.5964736",
"0.5819423",
"0.58191967",
"0.57797784",
"0.57596666",
"0.5... | 0.77714616 | 0 |
Test that we can load a yaml tech plugin | def test_yaml_tech_file(self) -> None:
tech_yaml = """
name: My Technology Library
installs:
- path: test
base var: "" # means relative to tech dir
libraries: []
"""
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_yaml_filename = os.path.join(t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_yaml_spec(self):\n pass",
"def test_load_yaml(self):\n sample_file = os.path.join(os.path.dirname(__file__), \"sample-config.yaml\")\n self.assertTrue(os.path.exists(sample_file), \"Did not found {}\".format(sample_file))\n self.configurator.load_yaml_file(sample_file)\n\... | [
"0.74287874",
"0.67121106",
"0.6606011",
"0.65671206",
"0.6526244",
"0.6470282",
"0.6448433",
"0.6442283",
"0.6399541",
"0.63569313",
"0.6304567",
"0.62926954",
"0.62887657",
"0.62726283",
"0.62291235",
"0.62012583",
"0.61976874",
"0.61424625",
"0.6138169",
"0.6118438",
"0.60... | 0.7653699 | 0 |
Test that GDS map file support works as expected. | def test_gds_map_file(self) -> None:
import hammer_config
tech_dir, tech_dir_base = HammerToolTestHelpers.create_tech_dir("dummy28")
tech_json_filename = os.path.join(tech_dir, "dummy28.tech.json")
def add_gds_map(in_dict: Dict[str, Any]) -> Dict[str, Any]:
out_dict = deepd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_map():\n config = load_json_fixture(\"basic-addon-config.json\")\n\n config[\"map\"] = [\"backup:rw\", \"ssl:ro\", \"config\"]\n vd.SCHEMA_ADDON_CONFIG(config)",
"def test_check_map(self):\r\n\r\n header, mapping_data = check_map(self.valid_mapping_data_golay)\r\n\r\n expect... | [
"0.6605901",
"0.6330498",
"0.63260454",
"0.63170296",
"0.6304642",
"0.62582344",
"0.62582344",
"0.61899036",
"0.6184879",
"0.61555594",
"0.614609",
"0.61402524",
"0.6122969",
"0.60845405",
"0.60789454",
"0.6066711",
"0.60316306",
"0.6022553",
"0.601964",
"0.59942186",
"0.5962... | 0.80800724 | 0 |
Test that wires can be parsed correctly from JSON. | def test_wire_parsing_from_json(self) -> None:
grid_unit = StackupTestHelper.mfr_grid()
metal_dict = StackupTestHelper.create_test_metal(3) # type: Dict[str, Any]
direct_metal = Metal.from_setting(grid_unit, StackupTestHelper.create_test_metal(3)) # type: Metal
json_string = json.dumps... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_json_spec(self):\n pass",
"def testfromjson(self):\n dicty = {\"id\": 5, \"class\": \"string\", \"list\": [], \"set\": {}}\n self.assertEqual([dicty], Base.from_json_string(json.dumps([dicty])))",
"def testfromjson(self):\n dicty = {\"id\": 5, \"class\": \"string\", \"l... | [
"0.6915474",
"0.6851825",
"0.67324346",
"0.66244113",
"0.6623567",
"0.6587573",
"0.65488607",
"0.64956224",
"0.6491288",
"0.6483365",
"0.6446446",
"0.633767",
"0.6332856",
"0.6292434",
"0.6281167",
"0.6278382",
"0.6259279",
"0.62448704",
"0.62444687",
"0.62429386",
"0.6236468... | 0.7311737 | 0 |
Standardize a T x D time series along its first dimension For dimensions with zero variance, divide by one instead of zero | def standardize_ts(a, scale=1.0):
stds = np.std(a, axis=0, keepdims=True)
stds[stds==0] = 1
return (a - np.mean(a, axis=0, keepdims=True))/(scale*stds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardize(tX):\n features = tX.T\n features_len = len(features)\n means = np.reshape(np.mean(features, axis=1), [features_len, 1])\n stds = np.reshape(np.std(features, axis=1), [features_len, 1])\n features_std = (features - means) / stds\n new_tX = features_std.T\n return new_tX",
"de... | [
"0.70649874",
"0.6813302",
"0.6772515",
"0.6771375",
"0.6760634",
"0.6736333",
"0.66912407",
"0.66744256",
"0.664757",
"0.664757",
"0.6626826",
"0.65421873",
"0.65001184",
"0.6480435",
"0.6467105",
"0.645713",
"0.6410001",
"0.63597214",
"0.632472",
"0.63240105",
"0.6295455",
... | 0.71407187 | 0 |
Returns our explicitly included environment variables we want to capture (server name, port and remote addr if pii is enabled). | def _get_environ(environ):
# type: (Dict[str, str]) -> Iterator[Tuple[str, str]]
keys = ["SERVER_NAME", "SERVER_PORT"]
if _should_send_default_pii():
# make debugging of proxy setup easier. Proxy headers are
# in headers.
keys += ["REMOTE_ADDR"]
for key in keys:
if key i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_environ_config_vars():\n # only allow secret key and database uri for now\n envvars = [\"SQLALCHEMY_DATABASE_URI\", \"SECRET_KEY\"]\n results = {}\n for key in envvars:\n if key in os.environ:\n results[key] = os.environ[key]\n return results",
"def get_undercloud_env_va... | [
"0.70499027",
"0.70495206",
"0.69876915",
"0.6684475",
"0.66723776",
"0.66307026",
"0.66265416",
"0.6595433",
"0.65826774",
"0.6525843",
"0.6505354",
"0.65031946",
"0.6482839",
"0.6463833",
"0.6397952",
"0.6360229",
"0.63431317",
"0.63373363",
"0.6330945",
"0.6300883",
"0.628... | 0.68850404 | 3 |
Sets the bbox of this Mosaic. | def bbox(self, bbox):
if bbox is None:
raise ValueError("Invalid value for `bbox`, must not be `None`") # noqa: E501
self._bbox = bbox | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bbox(self, bbox):\n self.bbox = bbox",
"def setBoundingBox(self, *args):\n return _libsbml.GraphicalObject_setBoundingBox(self, *args)",
"def set_bounding_box(self, top_left_y: int, top_left_x: int, bottom_right_y: int, bottom_right_x: int) -> None:\n self.top_left_y = top_left_y\n... | [
"0.8254409",
"0.6432",
"0.62349147",
"0.610715",
"0.6059332",
"0.58962005",
"0.585053",
"0.57841855",
"0.57841855",
"0.5746802",
"0.5718645",
"0.5709271",
"0.56825316",
"0.56825316",
"0.5667116",
"0.5662998",
"0.56617916",
"0.5658419",
"0.56393504",
"0.563394",
"0.5618366",
... | 0.71150315 | 1 |
Sets the id of this Mosaic. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id):\n self.__id = id",
"def set_id(self, id_):\n\n self.id_ = id_",
"def SetId(self, id):\n self.id = int(id)",
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n self.id = id\n print(\"self id = \" + str(self.id))",
"def i... | [
"0.7865969",
"0.7814204",
"0.7803734",
"0.76677203",
"0.73719805",
"0.7366238",
"0.7366238",
"0.7366238",
"0.7366238",
"0.7366238",
"0.7362012",
"0.7358944",
"0.7327361",
"0.7327361",
"0.7327361",
"0.7327361",
"0.7327361",
"0.7327361",
"0.7327361",
"0.7327361",
"0.7327361",
... | 0.0 | -1 |
Sets the interval of this Mosaic. | def interval(self, interval):
self._interval = interval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_looping_interval(self, interval: float) -> None:\n \n self._looping_interval = interval",
"def interval(self, interval: int):\n if interval is None:\n raise ValueError(\"Invalid value for `interval`, must not be `None`\")\n self._interval = interval",
"def _assign... | [
"0.67454135",
"0.67060167",
"0.6583133",
"0.65030754",
"0.65030754",
"0.6030693",
"0.59308594",
"0.59201604",
"0.5808056",
"0.5808056",
"0.5698562",
"0.56982684",
"0.5615518",
"0.5602129",
"0.55985624",
"0.5571867",
"0.5568434",
"0.5537268",
"0.5506214",
"0.55010426",
"0.5495... | 0.72398937 | 0 |
Sets the name of this Mosaic. | def name(self, name):
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501
self._name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n self.name = name",
"def set_name(self, name):\n ... | [
"0.7972409",
"0.7972409",
"0.7972409",
"0.7972409",
"0.7972409",
"0.7942964",
"0.79131967",
"0.7911063",
"0.79105645",
"0.7878922",
"0.7878922",
"0.7853204",
"0.7848985",
"0.7848504",
"0.7809177",
"0.7809177",
"0.7804251",
"0.7804251",
"0.775785",
"0.7755286",
"0.77445513",
... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Mosaic):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8455985",
"0.83913255",
"0.81440157",
"0.8140831",
"0.8132328",
"0.80937284",
"0.809181",
"0.809181",
"0.809181",
"0.808509",
"0.808509",
"0.8076134",
"0.8076134",
"0.8065528"
] | 0.0 | -1 |
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
restore_to_original_site = dictionary.get('restoreToOriginalSite')
site_owner_list = None
if dictionary.get('siteOwnerList') != No... | {
"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.83180064",
"0.81692255",
"0.81692255",
"0.81188524",
"0.8089153",
"0.7978471",
"0.7949498",
"0.7922631",
"0.78985846",
"0.7894865",
"0.78879577",
"0.78826904",
"0.78814775",
"0.78771174",
"0.78584737",
"0.78399473",
"0.7803621",
"0.7803621",
"0.7803621",
"0.7803621",
"0.78... | 0.0 | -1 |
The RMG simulation homepage. | def index(request):
return render_to_response('rmg.html', context_instance=RequestContext(request)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n\n return render_template('rosemead_homepage.html')",
"def home():\n return render_template(\n 'index.html',\n title= \"Pi-Lapse\",\n year=datetime.now().year,\n image = Cam.do.GetLastImage(),\n \n )",
"def homepage():\r\n print(__name__ + \" invo... | [
"0.7260679",
"0.70108455",
"0.6926129",
"0.6823249",
"0.68013775",
"0.67950684",
"0.6777395",
"0.67561144",
"0.6724185",
"0.6691306",
"0.6678866",
"0.66230935",
"0.66212445",
"0.66202027",
"0.66172886",
"0.6606083",
"0.65896195",
"0.6582721",
"0.6582721",
"0.65627635",
"0.653... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.