query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Combine existing chunks to recreate the file. The chunks must be present in the cwd. The new file will be written to cwd. | def combine(self):
import re
print 'Creating file', self.__filename
bname = (os.path.split(self.__filename))[1]
bname2 = bname
# bugfix: if file contains characters like +,.,[]
# properly escape them, otherwise re will fail to match.
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_vcf_chunks(out_dir, path_name, path_size, chunks, overwrite):\n vcf_path = os.path.join(out_dir, path_name + \".vcf\")\n if overwrite or not os.path.isfile(vcf_path):\n first = True\n for chunk_i, chunk in enumerate(chunks):\n clip_path = chunk_base_name(path_name, out_dir,... | [
"0.65807515",
"0.6522695",
"0.5830749",
"0.56331223",
"0.5603233",
"0.55737466",
"0.5561251",
"0.5557075",
"0.5543502",
"0.55282074",
"0.5523479",
"0.55110836",
"0.547458",
"0.54524946",
"0.5427168",
"0.54180014",
"0.5275911",
"0.5269838",
"0.52052176",
"0.5198629",
"0.518618... | 0.6982434 | 0 |
two BaseWrapper instances are equal enough | def assert_wrappers_equal(first, second):
assert first.sk_params == second.sk_params
assert first.history_ == second.history_
if not first.model_ or not second.model_:
assert first.model_ == second.model_
else:
assert_models_equal(first.model, second.model) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inheritedClassesEquality(self):\n self.assertTrue(Record(1, 2) == DerivedRecord(1, 2))\n self.assertFalse(Record(1, 2) == DerivedRecord(1, 3))\n self.assertFalse(Record(1, 2) == DerivedRecord(2, 2))\n self.assertFalse(Record(1, 2) == DerivedRecord(3, 4))",
"def test_identical... | [
"0.6653726",
"0.6650997",
"0.65729487",
"0.64894223",
"0.6444425",
"0.64114064",
"0.63375264",
"0.63026255",
"0.6292803",
"0.6269224",
"0.6257633",
"0.6256101",
"0.62419796",
"0.62266093",
"0.6213192",
"0.6190846",
"0.6179785",
"0.6126253",
"0.61250675",
"0.6109466",
"0.60955... | 0.67075044 | 0 |
The names of the arguments to the function which are contained in the PyArgKeywords list | def arg_names(self):
return self._arg_names | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names(self):\n result = []\n result.extend(self.positional_arguments)\n if self.arbitary_positional_arguments is not None:\n result.append(self.arbitary_positional_arguments)\n if self.arbitary_keyword_arguments is not None:\n result.append(self.arbitary_keywor... | [
"0.7080962",
"0.69528246",
"0.6950511",
"0.6814684",
"0.68055576",
"0.67487407",
"0.6712614",
"0.6712274",
"0.6702668",
"0.6666874",
"0.6628423",
"0.66158634",
"0.6563383",
"0.64373004",
"0.64143133",
"0.6394061",
"0.6304303",
"0.6285481",
"0.6278419",
"0.6258944",
"0.6256494... | 0.6993237 | 1 |
Create FunctionDef responsible for casting python argument to C | def Python_to_C(c_object):
try :
cast_function = py_to_c_registry[(c_object.dtype, c_object.precision)]
except KeyError:
errors.report(PYCCEL_RESTRICTION_TODO, symbol=c_object.dtype,severity='fatal')
cast_func = FunctionDef(name = cast_function,
body = [],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def C_to_Python(c_object):\n try :\n cast_function = c_to_py_registry[(c_object.dtype, c_object.precision)]\n except KeyError:\n errors.report(PYCCEL_RESTRICTION_TODO, symbol=c_object.dtype,severity='fatal')\n\n cast_func = FunctionDef(name = cast_function,\n body ... | [
"0.70022583",
"0.67676306",
"0.6716482",
"0.65700346",
"0.6408847",
"0.6320961",
"0.6177105",
"0.61178625",
"0.609686",
"0.60915",
"0.6037971",
"0.60285324",
"0.5978813",
"0.5958597",
"0.59014344",
"0.58797467",
"0.58504516",
"0.58494455",
"0.5848168",
"0.5846862",
"0.5815121... | 0.7423723 | 0 |
Create FunctionDef responsible for casting c argument to python | def C_to_Python(c_object):
try :
cast_function = c_to_py_registry[(c_object.dtype, c_object.precision)]
except KeyError:
errors.report(PYCCEL_RESTRICTION_TODO, symbol=c_object.dtype,severity='fatal')
cast_func = FunctionDef(name = cast_function,
body = [],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Python_to_C(c_object):\n try :\n cast_function = py_to_c_registry[(c_object.dtype, c_object.precision)]\n except KeyError:\n errors.report(PYCCEL_RESTRICTION_TODO, symbol=c_object.dtype,severity='fatal')\n cast_func = FunctionDef(name = cast_function,\n body = ... | [
"0.72192234",
"0.68052465",
"0.6632314",
"0.64130855",
"0.6358928",
"0.63258225",
"0.6155145",
"0.6139662",
"0.60484755",
"0.60477465",
"0.60254824",
"0.6015706",
"0.59863913",
"0.59403557",
"0.58158",
"0.57880235",
"0.57846373",
"0.5784282",
"0.5761604",
"0.57465273",
"0.573... | 0.69464856 | 1 |
Generate function Call of c/python api PyErr_SetString | def PyErr_SetString(exception, message):
func = FunctionDef(name = 'PyErr_SetString',
body = [],
arguments = [Variable(dtype = PyccelPyObject(), name = 'o'),
Variable(dtype = NativeString(), name = 's')],
results = [])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failure_code(sub):\r\n return '''{\r\n %(failure_var)s = %(id)s;\r\n if (!PyErr_Occurred()) {\r\n PyErr_SetString(PyExc_RuntimeError,\r\n \"Unexpected error in an Op's C code. \"\r\n \"No Python exception was set.\");\r\n }\r\n goto __... | [
"0.60588336",
"0.5961557",
"0.58332723",
"0.5556526",
"0.55433345",
"0.54902726",
"0.5450629",
"0.5449993",
"0.5403903",
"0.53904366",
"0.53624654",
"0.533152",
"0.53102547",
"0.529605",
"0.52905834",
"0.52848315",
"0.52823675",
"0.5257808",
"0.5237709",
"0.52302915",
"0.5175... | 0.7551365 | 0 |
Generate TypeError exception from the variable information (datatype, precision) | def generate_datatype_error(variable):
dtype = variable.dtype
if isinstance(dtype, NativeBool):
precision = ''
if isinstance(dtype, NativeComplex):
precision = '{} bit '.format(variable.precision * 2 * 8)
else:
precision = '{} bit '.format(variable.precision * 8)
messag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_value_error_for_computing_missing_type():\n with pytest.raises(ValueError):\n compute_type(\"missing_type\", {})",
"def test_type_error(self):\n self._error_test(TypeError)",
"def test_invalid_expression_type(self, parse_input_mocked_metadata):\n with pytest.raises(TypeError, m... | [
"0.6931209",
"0.6566379",
"0.6381943",
"0.63050914",
"0.62194294",
"0.61516786",
"0.6136856",
"0.61005616",
"0.60737664",
"0.60367274",
"0.60167736",
"0.6010583",
"0.6010164",
"0.5982661",
"0.59672403",
"0.59668577",
"0.59405553",
"0.5933665",
"0.5899024",
"0.5894452",
"0.588... | 0.81578225 | 0 |
exercising some Letter methods | def test_letter_methods(self):
# shift
l = get_character("G")
self.assertEqual(l.x, 0)
self.assertEqual(l.y, 0)
l.shift(2, 2)
self.assertEqual(l.x, 2)
self.assertEqual(l.y, 2)
# scale adjusts the scale attributes
orig_width = l.scale_x
orig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_letters(word, guesses):\n pass",
"def letter_for(label):\n return \"ABCDEFGHIJ\"[label]",
"def init_letters():\n return ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',\n 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',\n 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',\n ... | [
"0.68726075",
"0.6728515",
"0.6708404",
"0.6602445",
"0.6602445",
"0.6602445",
"0.6595359",
"0.65413225",
"0.6491447",
"0.64886683",
"0.6447457",
"0.64450705",
"0.64275444",
"0.63569146",
"0.63441706",
"0.627932",
"0.6252092",
"0.62292844",
"0.6165212",
"0.6158538",
"0.613655... | 0.68069106 | 1 |
Helper method to get baseline file. | def get_test_baseline(self, file_name):
return os.path.abspath(
os.path.join(
os.path.abspath(__file__),
u'..',
u'baselines',
file_name)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetBaseline(self, filename, directory, upstream_only = False):\n\n local_filename = os.path.join(directory, filename)\n local_directory = local_filename[:local_filename.rfind(\"/\")]\n if upstream_only:\n last_index = local_filename.rfind(\".\")\n if last_index > -1:\n local_filename... | [
"0.72251785",
"0.66584283",
"0.65599346",
"0.6401578",
"0.6180834",
"0.60123277",
"0.5969603",
"0.5948323",
"0.59022737",
"0.5869274",
"0.583606",
"0.5801047",
"0.5801047",
"0.5801047",
"0.57897425",
"0.57875085",
"0.56959826",
"0.56877124",
"0.56490695",
"0.56345946",
"0.563... | 0.79847074 | 0 |
Return a list of all the cells in the grid. We start increasing x first, i.e. 0th cell is the first cell, 1cell is the one with the next x in the list and y unchanged, .... Return array An array of size n_cells n_dims. | def cells_list(self):
xx, yy = np.meshgrid(self.x_spacings, self.y_spacings)
return np.vstack([yy.ravel(), xx.ravel()]).transpose() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_cells_from_dims(num_verts_x: int, num_verts_y: int):\n num_cells_x = num_verts_x - 1\n num_cells_y = num_verts_y - 1\n num_cells = num_cells_x*num_cells_y\n cell_array = np.zeros((num_cells, 4), dtype=int)\n cell_num = 0\n\n # I am sure this could be done in a more efficient way.\n ... | [
"0.7313377",
"0.70912474",
"0.70496106",
"0.70136446",
"0.70017177",
"0.69983876",
"0.6967043",
"0.6942949",
"0.69047695",
"0.6899912",
"0.6888806",
"0.6857896",
"0.68333375",
"0.6820522",
"0.6802178",
"0.6766183",
"0.66904247",
"0.66788596",
"0.6637702",
"0.66127455",
"0.660... | 0.77503717 | 0 |
Wrapper to run Praat 'To Textgrid (silences)' function. | def detect_silences(sound, sil_threshold, sil_duration):
textgrid = call(sound, 'To TextGrid (silences)', 100, 0.0, sil_threshold, sil_duration, 0.1, 'silence', 'speech')
return textgrid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__ (self,win,text='Press a key to continue',**kwargs):\n\n self.win = win\n \n self.text = visual.TextStim(win,text=text,**kwargs)",
"def __init__ (self,win,text='Press a key to continue',**kwargs):\n\n self.win = win\n \n self.text = visual.TextStim(win,text=t... | [
"0.5339875",
"0.5339875",
"0.52565366",
"0.5225016",
"0.5224651",
"0.52221847",
"0.52040446",
"0.5149263",
"0.50935054",
"0.509346",
"0.50882745",
"0.50577587",
"0.50410724",
"0.50378585",
"0.5034093",
"0.5024333",
"0.5018697",
"0.50046563",
"0.4991087",
"0.49812207",
"0.4980... | 0.59195006 | 0 |
Saves chunked speech intervals as WAV file. | def save_chunks(chunk_sound, out_path, video_id):
chunk_start_ms = int(chunk_sound.get_start_time()*1000)
chunk_end_ms = int(chunk_sound.get_end_time()*1000)
chunk_duration = chunk_end_ms - chunk_start_ms
chunk_fn = '{0}_{1}_{2}.wav'.format(video_id, chunk_start_ms, chunk_end_ms)
chunk_file_path = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_wav(file_name, signal, fs):\n wavfile.write(file_name, fs, np.int16(signal/np.max(np.abs(signal)) * (2**(16)/2-1)))",
"def save_audio(self, name=DEFAULT_OUT_NAME):\n print(\"Saving...\")\n wf = wave.open(name+'.wav', 'wb')\n wf.setnchannels(DEFAULT_CHANNELS)\n wf.setsampwi... | [
"0.6919104",
"0.6847627",
"0.672993",
"0.6697336",
"0.66271955",
"0.6598934",
"0.65593815",
"0.65480053",
"0.65218306",
"0.6511665",
"0.64606607",
"0.6440448",
"0.63984156",
"0.6338785",
"0.63294864",
"0.6315476",
"0.63118845",
"0.63059294",
"0.6304708",
"0.6291267",
"0.62757... | 0.6976282 | 0 |
Takes input ends of all feed pipes and feeds odd numbers starting from low until high both inclusive. in a round robin fashion. process ends by feeding 1 to all pipes. 1 is a sentinel value. | def distributor(ls_feed_pipe_open,low,high):
def getNumber(low,high):
i = low
if i%2 == 0: #if i is even, then start from i+1 odd.
i += 1
while i<=high:
yield i
i+=2 #no need to check for even numbers, so skip it here at begining
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def odd():\n num = 0\n while True:\n yield num * (num & 1)\n num += 1",
"def infinite_odd_generator():\n current = 1\n while True:\n yield current\n current = current + 2",
"def input_pipe():\n x = ''\n while True:\n x = yield x\n yiel... | [
"0.5789352",
"0.5761657",
"0.5741719",
"0.564393",
"0.52422297",
"0.51917",
"0.50984246",
"0.50861835",
"0.5054945",
"0.50331575",
"0.50145054",
"0.5011917",
"0.50026035",
"0.49603093",
"0.49603093",
"0.4935153",
"0.49219003",
"0.49094537",
"0.4875977",
"0.4841634",
"0.483971... | 0.68875015 | 0 |
will take numbers sequentially from feed_pipe, verify if it is prime. any primes found will be returned as a dict to main process. dict contains only one key value pair. val is always a list. | def generatePrime(ls_primes, feed_pipe,return_dict):
local_primes = []
while True:
n = feed_pipe.recv()
if n == -1: # sentinel given by distributor.
break
else:
is_prime = True
##check for divisibility
## no need to check for 2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def worker(nums, outdict):\n for n in nums:\n outdict[n] = primes2(n)",
"def primes():\n D = {} # map composite integers to primes witnessing their compositeness\n q = 2 # first integer to test for primality\n while True:\n if q not in D:\n yield q # not mar... | [
"0.62043977",
"0.60420763",
"0.6040586",
"0.59742284",
"0.5961007",
"0.59362507",
"0.5920342",
"0.5811969",
"0.5799837",
"0.57528454",
"0.5740674",
"0.5735719",
"0.5734782",
"0.5734576",
"0.5731913",
"0.5719384",
"0.5716878",
"0.5673636",
"0.5661564",
"0.56440914",
"0.5617547... | 0.78329885 | 0 |
Reject unsuported chain parts | def _select_simple_chainparts(chain_parts):
for cp in chain_parts:
if reject_substr_res.search(cp['chainPartName']):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_chain():",
"def reject(self):\n pass",
"def test_blind_sig_chain_wrong_intermediary(self): # pylint: disable=too-many-locals\n\n test_levels = 4\n msg = os.urandom(1024)\n wrong_level = 2\n\n ca = ECCBlind()\n signer_obj = ca\n fake_intermediary = ... | [
"0.67994744",
"0.5958347",
"0.5583729",
"0.5497606",
"0.54252285",
"0.54134977",
"0.53917265",
"0.53915894",
"0.53751105",
"0.53494143",
"0.53485787",
"0.5343248",
"0.5343216",
"0.53384286",
"0.5323294",
"0.5297185",
"0.5291411",
"0.52887464",
"0.5273759",
"0.5243703",
"0.523... | 0.6198813 | 1 |
Marshal information deom the selected chainParts to create a 'simple_partition' label. | def _make_simple_partition_label(chain_dict):
cps = chain_dict['chainParts']
if not (_select_simple_chainparts(cps)):
raise NotImplementedError(
'chain fails substring selection: not "simple": %s' % (
chain_dict['chainName']))
label = 'simplepartition(['
for cp ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_partitionsTest_label(chain_parts):\n\n assert len(chain_parts) == 1\n scenario = chain_parts[0]['hypoScenario']\n \n assert scenario == 'partitionsTest'\n\n \n\n return \"\"\"\n partgen(\n [(20et, 0eta320)]\n \n simple([(40et, 0eta320) (50et, 0eta320)])\n ... | [
"0.65343463",
"0.53522164",
"0.52719545",
"0.52471644",
"0.51894504",
"0.5177348",
"0.5096431",
"0.5087608",
"0.4973218",
"0.4973218",
"0.4970022",
"0.4951215",
"0.49493623",
"0.49468526",
"0.49310818",
"0.492718",
"0.49157664",
"0.49112102",
"0.49103266",
"0.48851392",
"0.48... | 0.6581646 | 0 |
Marshal information from the selected chainParts to create a vbenf label. Use a Reducer for elimination of unusable jets | def _make_vbenf_label(chain_parts):
# toy label for development: run simple and dijet independently.
# simple makes Et cuts on two jets. Independently (sharing possible)
# of jets choosean by simple, the dijet
# scenario requires a dijet of mass > 900, and opening angle in phi > 2.6
assert len(ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chainDict2jetLabel(chain_dict):\n\n # suported scenarios \n router = {\n 'simple': _make_simple_label,\n 'HT': _make_ht_label,\n 'vbenf': _make_vbenf_label,\n 'dijet': _make_dijet_label,\n 'combinationsTest': _make_combinationsTest_label,\n 'partitionsTest': _mak... | [
"0.53284836",
"0.52070326",
"0.50032526",
"0.4924041",
"0.48997957",
"0.48227805",
"0.4819547",
"0.4782699",
"0.47695082",
"0.4746857",
"0.4743185",
"0.47308764",
"0.4726845",
"0.46611047",
"0.46597615",
"0.463954",
"0.46242067",
"0.46234703",
"0.45942166",
"0.45858887",
"0.4... | 0.61593163 | 0 |
dijet label. supports dijet cuts, and cuts on particpating jets | def _make_dijet_label(chain_parts):
assert len(chain_parts) == 1
scenario = chain_parts[0]['hypoScenario']
assert scenario.startswith('dijet')
arg_res = [
re.compile(r'^(?P<lo>\d*)(?P<key>djmass)(?P<hi>\d*)$'),
re.compile(r'^(?P<lo>\d*)(?P<key>j1et)(?P<hi>\d*)$'),
re.compi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_info(config, cut, label):\n cfg = filter(lambda c: c['name'] == cut, config['physics']['cuts'])[0]\n text = \"\"\n if 'max' not in cfg:\n text += \"#geq \"\n text += str(cfg['min'])\n if 'max' in cfg and cfg['max'] != cfg['min']:\n text += '-' + str(cfg['max']) + ' ' + labe... | [
"0.5650385",
"0.54846936",
"0.54270923",
"0.5375306",
"0.53342646",
"0.5226105",
"0.5209129",
"0.51919734",
"0.51784825",
"0.5173263",
"0.5163355",
"0.51560795",
"0.5154937",
"0.51164854",
"0.5109441",
"0.5093374",
"0.50911057",
"0.5076122",
"0.50540954",
"0.50480634",
"0.504... | 0.6397082 | 0 |
ht label. ht cuts, and cuts on particpating jets | def _make_ht_label(chain_parts):
assert len(chain_parts) == 1, '_make_ht_label, no. of chain parts != 1'
scenario = chain_parts[0]['hypoScenario']
assert scenario.startswith('HT'), '_make_ht_label(): scenario does not start with HT'
arg_res = [
re.compile(r'^(?P<lo>\d*)(?P<key>ht)(?P<hi>\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_thin(self, orig_label):\n pil_thin = thin(orig_label)\n # Keep the original label and set non-thinning label as 0\n orig_label[~pil_thin] = 0\n\n return orig_label",
"def kohonen():\n# plb.close('all')\n \n dim = 28*28\n data_range = 255.0\n \n # load in da... | [
"0.5253033",
"0.5244755",
"0.5173087",
"0.51096773",
"0.5103869",
"0.50852627",
"0.5053167",
"0.4967331",
"0.49329308",
"0.4927268",
"0.4886447",
"0.4883699",
"0.48704627",
"0.48665786",
"0.48657504",
"0.48568624",
"0.484965",
"0.48423848",
"0.48153552",
"0.4808797",
"0.47966... | 0.5767312 | 0 |
make test label for combinations helper with two simple children. | def _make_combinationsTest_label(chain_parts):
assert len(chain_parts) == 1
scenario = chain_parts[0]['hypoScenario']
assert scenario == 'combinationsTest'
return """
combgen(
[(2)(20et, 0eta320)]
simple([(40et, 0eta320) (50et, 0eta320)])
simple([... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sums():\n assert label_parent(1, 2) == 3\n assert label_parent (1, 4) == 8\n # Should ignore arg order\n assert label_parent(4, 1) == 8",
"def _make_partitionsTest_label(chain_parts):\n\n assert len(chain_parts) == 1\n scenario = chain_parts[0]['hypoScenario']\n \n assert scenari... | [
"0.6137433",
"0.6108757",
"0.60195917",
"0.5986544",
"0.5936767",
"0.58589",
"0.5759686",
"0.56950617",
"0.5624841",
"0.55902916",
"0.55750483",
"0.5560212",
"0.5554626",
"0.55542696",
"0.5553175",
"0.5553175",
"0.55467266",
"0.5503819",
"0.5457172",
"0.5451371",
"0.54313546"... | 0.6972838 | 0 |
(Set, float, float, int, str) > list Filters a set of Products according to the parameters. This function is responsible to determine if filtering with tags should be applied or not. | def get_matching_products(products, lat, lng, radius, tags):
if tags:
tag_list = tags.split(',')
return list([
product for product in products
if is_matching_product_with_tags(
product,
lat,
ln... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_generic(products, listings, result=None):\n print \"Apply Generic Filtering \"\n if result == None:\n result = {}\n matched_listings = []\n for alist in listings:\n manufacturer, renamed_manufacturer = find_manufacturer(products, alist)\n if manufacturer == False:\n ... | [
"0.66341794",
"0.6542159",
"0.63417774",
"0.6290791",
"0.61444324",
"0.61051065",
"0.5993559",
"0.5917431",
"0.5875063",
"0.5852951",
"0.578841",
"0.5734029",
"0.57259727",
"0.5694228",
"0.5673258",
"0.565935",
"0.5637606",
"0.56313235",
"0.5576161",
"0.5563928",
"0.5539448",... | 0.6570375 | 1 |
(Product, float, float, radius) > boolean Check if the coordinates of a shop is within a radius (in meters) using the Vincenty's formulae. | def is_matching_product(product, lat, lng, radius):
return vincenty(
(lat, lng),
(product.shop.lat, product.shop.lng)
).meters <= radius | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_matching_product_with_tags(product, lat, lng, radius, tags):\n return vincenty(\n (lat, lng),\n (product.shop.lat, product.shop.lng)\n ).meters <= radius and any(tag in product.shop.tags for tag in tags)",
"def __contains__(self, position):\n return sum([(c1... | [
"0.64729494",
"0.59081954",
"0.5859355",
"0.58463377",
"0.5835103",
"0.5793143",
"0.5749297",
"0.5747117",
"0.571432",
"0.5694992",
"0.5625121",
"0.55783933",
"0.5532883",
"0.5531398",
"0.55265725",
"0.5519289",
"0.54891366",
"0.5458684",
"0.54542017",
"0.5451329",
"0.5381592... | 0.7570688 | 0 |
(Product, float, float, radius, list) > boolean Check if the coordinates of a shop is within a radius (in meters) using the Vincenty's formulae and if the shop contains any of the tags provided. | def is_matching_product_with_tags(product, lat, lng, radius, tags):
return vincenty(
(lat, lng),
(product.shop.lat, product.shop.lng)
).meters <= radius and any(tag in product.shop.tags for tag in tags) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_matching_product(product, lat, lng, radius):\n return vincenty(\n (lat, lng),\n (product.shop.lat, product.shop.lng)\n ).meters <= radius",
"def shops_within_radius(self, lat, lng, radius, tags=None):\n center_point = geoindex.GeoPoint(lat, lng)\n poi... | [
"0.7254775",
"0.61709523",
"0.5765121",
"0.57588995",
"0.5667875",
"0.5657872",
"0.5615331",
"0.5498272",
"0.54953516",
"0.5392794",
"0.5387623",
"0.5384196",
"0.53837055",
"0.5313938",
"0.52996296",
"0.5263196",
"0.5251948",
"0.5240129",
"0.5167428",
"0.51551384",
"0.5082203... | 0.78412956 | 0 |
Create a copy of a facemap proc file, but pointing to a new video. By default, the new proc file is created in the same folder as the new videofile and named videofile_proc.npy. | def copy_facemap_roi(procfile, videofile, outputfile=None):
videodata = np.load(procfile, allow_pickle=True).item()
videodata['filenames'] = [[videofile]]
if outputfile is None:
outputfile = os.path.splitext(videofile)[0]+'_proc.npy'
if os.path.isfile(outputfile):
print(f'File {outputf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_video(input_file, output_file):\n input_video = VideoFileClip(input_file)\n output_video = input_video.fl_image(detect_lane.fit_and_plot)\n output_video.write_videofile(output_file, audio=False)",
"def process_video(lane, fname, output):\n\tclip = VideoFileClip(fname)\n\toutput_name = output\... | [
"0.6444913",
"0.6132553",
"0.6021357",
"0.6021357",
"0.5793323",
"0.575927",
"0.56994724",
"0.5620519",
"0.5565024",
"0.5488642",
"0.54845893",
"0.5479945",
"0.5418265",
"0.5404724",
"0.53233945",
"0.5318268",
"0.5299321",
"0.5261676",
"0.52610755",
"0.51977015",
"0.51628315"... | 0.8082349 | 0 |
Find the onsets in the array representing the synchronization light. This function assumes the onsets are periodic (with randomness within 0.5T and 1.5T). The function can also fix missing onsets. | def find_sync_light_onsets(sync_light, invert=True, fixmissing=False):
# -- Find changes in synch light --
sync_light_diff = np.diff(sync_light, prepend=0)
if invert:
sync_light_diff = -sync_light_diff
sync_light_diff[sync_light_diff < 0] = 0
sync_light_threshold = 0.2*sync_light_diff.max()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_onsets(self):\n get_onsets = ess.OnsetRate()\n # onset_times is np array\n self.onset_times, onset_rate = get_onsets(self.audio)\n # Onset as sample number in the audio signal\n index2delete = []\n previous_time = -9999999\n for index, itime in enumerate(se... | [
"0.6857784",
"0.6249284",
"0.58837444",
"0.5452273",
"0.53577805",
"0.5303218",
"0.52744794",
"0.52505463",
"0.51989776",
"0.51802486",
"0.51636773",
"0.50905186",
"0.507182",
"0.5051442",
"0.5007559",
"0.50056607",
"0.49910834",
"0.4961425",
"0.4949146",
"0.493811",
"0.49135... | 0.7570172 | 0 |
Estimate whether the animal was running during each trial. This function first smooths the running trace according to smoothsize (noncausal), it then uses the average of N presamples before the onset to to estimate whether running was higher than the threshold. | def estimate_running_each_trial(running_trace, trial_onset, smoothsize=10, presamples=4,
threshold=3, showfig=False):
smoothwin = np.ones(smoothsize)/(smoothsize)
running_trace_smooth = np.convolve(running_trace, smoothwin, mode='same')
trial_onset_ind = np.where(trial_onset)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def punches(self):\n #:TODO Need to parameterize n\n # Initialize smoothing function\n # Also because I can't take the second derivitive\n\n n = 3\n assert (len(self.averages)==len(self.timestamps))\n size = len(self.averages)\n slopes = []\n for t in [0,size... | [
"0.5619866",
"0.5553437",
"0.5524997",
"0.53908414",
"0.5296018",
"0.5253825",
"0.5213897",
"0.52011967",
"0.51841336",
"0.5176683",
"0.51282734",
"0.5120962",
"0.51179755",
"0.5112065",
"0.50441957",
"0.50383514",
"0.503653",
"0.50297564",
"0.4981896",
"0.4948819",
"0.493829... | 0.7172721 | 0 |
Create instance of PyRPS. redis_url Redis instance address (tuple containing (hostname, port)). namespace Namespace to separate Pub/Sub instance from another running on the same redis host. | def __init__(self, namespace, redis_url=("localhost", 6379)):
self.namespace = namespace
if isinstance(redis_url, tuple):
self.redis = StrictRedis(host=redis_url[0], port=redis_url[1])
elif isinstance(redis_url, str):
self.redis = StrictRedis(host=redis_url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_to_redis():\n return Redis(host=redis_host, port=redis_port, db=0)",
"def __init__(self):\n try:\n config = redis_settings[\"REDIS_BACKEND\"]\n self.servers = config[\"servers\"]\n self.port = config[\"port\"]\n self.db = config[\"db\"]\n ... | [
"0.65858567",
"0.6510327",
"0.6420053",
"0.6199663",
"0.6159909",
"0.61511815",
"0.6020774",
"0.5985737",
"0.593212",
"0.5925699",
"0.5880181",
"0.5879944",
"0.5878096",
"0.5852507",
"0.5827931",
"0.5803593",
"0.5802949",
"0.5757128",
"0.56726545",
"0.56652087",
"0.5645896",
... | 0.7303635 | 0 |
Publish new message into queue. queue Queue name. message Message data. ttl How long the message should stay alive. | def publish(self, queue, message, ttl=3600):
# Get next message ID
message_id = self.redis.incr(self._ns_nextid())
# Push message to queue
self.redis.setex(self._ns_message(queue, message_id), ttl, message)
# List all consumers of given queue
consumers = self.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish(self, queue, message):\n\n # Instead of passing a queue to the constructor, the publish checks if\n # the target queue exists. If not, it declares the target queue\n if not self.queue:\n self.channel.queue_declare(queue=queue)\n self.queue = queue\n\n s... | [
"0.66769063",
"0.6397617",
"0.627912",
"0.61567104",
"0.60542965",
"0.5991828",
"0.5984815",
"0.59224325",
"0.59119457",
"0.5885555",
"0.58437407",
"0.5831145",
"0.5831145",
"0.57749146",
"0.5731569",
"0.572015",
"0.57037824",
"0.5698528",
"0.5670229",
"0.56518567",
"0.563889... | 0.81558275 | 0 |
Return key for subscribers list for given queue. | def _ns_subscriptions(self, queue):
return self._ns(queue, "consumers") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_name(name):\n return 'hotqueue:%s' % name",
"def QueueId(self):\n\t\treturn self._get_attribute('queueId')",
"def get_queue_items(self, queue_name):\n proc = start_proc([\"/usr/bin/sudo\", \"rabbitmqctl\", \"list_queues\"],\n shell=False)\n for ... | [
"0.6073377",
"0.5581305",
"0.55699074",
"0.5561635",
"0.55190897",
"0.5469011",
"0.540408",
"0.5387118",
"0.5387118",
"0.5283115",
"0.5264972",
"0.5261164",
"0.52112347",
"0.51992536",
"0.5160349",
"0.5156108",
"0.51445335",
"0.5114686",
"0.5114686",
"0.5114686",
"0.5114686",... | 0.5925365 | 1 |
Unsubscribe from message queue and destroy it. Do not call if you want persistent queues or if you access one queue from multiple processes. | def unsubscribe(self):
# Unsubscribe
self.pyrps.redis.srem(self.pyrps._ns_subscriptions(self.queue), self.consumer_id)
# Remove message queue
self.pyrps.redis.delete(self.pyrps._ns_queue(self.queue, self.consumer_id)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_queue(self):\n response = self.queue.delete()\n if self._is_error_call(response):\n raise RuntimeError('SQS could not delete queue: %s' % response)\n self.queue, self.queue_name = None, None",
"def __clear_message_queue(self):\r\n self.__lib.CC_ClearMessageQueue... | [
"0.7262633",
"0.6581309",
"0.6575992",
"0.6442243",
"0.6403433",
"0.63751954",
"0.63708746",
"0.63472867",
"0.6332669",
"0.6327779",
"0.6296495",
"0.6264714",
"0.6237197",
"0.61690885",
"0.61690885",
"0.61690885",
"0.61690885",
"0.61690885",
"0.61083573",
"0.6106147",
"0.6098... | 0.8235168 | 0 |
Instead of rendering each wall block, we create a single shape which can be drawn in a single call, rather than a call for each wall block | def create_wall_shape(self):
self.shape_walls = arcade.ShapeElementList()
self.shape_walls.center_x = 0
self.shape_walls.center_y = 0
self.shape_walls.angle = 0
point_list = []
color_list = []
# create the walls into a single shape
walls = self.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_walls(self):\n for x in range(self.width):\n self.add_thing(Wall(), (x, 0))\n self.add_thing(Wall(), (x, self.height - 1))\n\n for y in range(self.height):\n self.add_thing(Wall(), (0, y))\n self.add_thing(Wall(), (self.width - 1, y))",
"def _draw... | [
"0.6985171",
"0.6947199",
"0.689782",
"0.6734781",
"0.6710795",
"0.67082715",
"0.66530377",
"0.6573703",
"0.6563552",
"0.64633447",
"0.64461184",
"0.6377385",
"0.63731766",
"0.63545173",
"0.6318463",
"0.63116866",
"0.6260402",
"0.62379223",
"0.6211161",
"0.61905986",
"0.61559... | 0.7463419 | 0 |
Create/Update the sprite shape for an entity and add/update the entry for it in `self.entities_shapelist` | def update_shape_sprite(self, entity: Entity):
shape_sprite: ShapeSprite = entity.shape_sprite
if entity.id not in self.entities_shapelist:
entity_shapelist = arcade.ShapeElementList()
# we need to convert from general colours to arcade specific col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_entity(self, entity: Entity):\n \n if entity.shape_sprite:\n return self.update_shape_sprite(entity)\n \n left = (entity.x - entity.half_width)\n right = (entity.x + entity.half_width)\n # because arcade 0 on y is the bottom of the screen not the top\n ... | [
"0.61834466",
"0.58497405",
"0.5760513",
"0.5680979",
"0.55177814",
"0.5469176",
"0.5436238",
"0.54036695",
"0.5392178",
"0.5378375",
"0.53718156",
"0.53654325",
"0.53457034",
"0.5342032",
"0.5310451",
"0.5253857",
"0.5238692",
"0.52258265",
"0.5207183",
"0.52023184",
"0.5193... | 0.82262385 | 0 |
Get the pixel positions for positioning a menu in the center of the screen | def get_menu_coords(self, menu):
menu_center_x = (self.width // 2)
menu_center_y = (self.height // 2)
# get a mapping of the menu co-ordinates for relative positioning of things inside the menu
menu_cords = (
(menu_center_x - (menu.width // 2), menu_center_y + (menu.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMenuItemPixels(cls):\n return cls.menuItemPixels",
"def getCenter(self):\n return [self.tx/self.tw, self.ty/self.tw]",
"def screen_coordinates(pos):\n\n return [int((pos[0] % screen_width) / px), screen_height - int((pos[1] % screen_height) / px)]",
"def get_pix_pos(self):\r\n ... | [
"0.668973",
"0.6660493",
"0.65916294",
"0.65874016",
"0.65281975",
"0.6518283",
"0.64817595",
"0.64489305",
"0.64457977",
"0.64295113",
"0.64295113",
"0.6412496",
"0.64010537",
"0.6398035",
"0.6398035",
"0.6398035",
"0.6398035",
"0.6364081",
"0.63268316",
"0.63001156",
"0.628... | 0.74038523 | 0 |
Computes logits based on features from the model | def logits_on_features(self, h, batch):
batch = batch.to(h.device)
# Extract features with the model
features = h.view(batch.size, -1)
# Log loss
logits = self.head(features)
return logits | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logits(self, model, batch):\n device = list(model.parameters())[0].device\n batch = batch.to(device)\n inputs = batch.inputs\n # Extract features with the model\n features = model(*inputs)\n logits = self.logits_on_features(features, batch)\n return logits",
"... | [
"0.7213141",
"0.6972253",
"0.6765194",
"0.6761858",
"0.67392176",
"0.6513034",
"0.64970493",
"0.64832693",
"0.6462769",
"0.64080673",
"0.6387591",
"0.6311425",
"0.6272004",
"0.62515974",
"0.62422395",
"0.62104046",
"0.62095785",
"0.62022495",
"0.61950845",
"0.6186781",
"0.618... | 0.71031106 | 1 |
Compute the NLL loss given features h and targets y This assumes that the features have already be computed with the model | def nll_on_features(self, h, batch, reduction="mean"):
batch = batch.to(h.device)
y = batch.outputs
# Extract features with the model
features = h.view(batch.size, -1)
# Log loss
logits = self.head(features)
log_probs = F.log_softmax(logits, dim=-1)
nll_lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss(self, X, y=None):\n X = X.astype(self.dtype)\n mode = 'test' if y is None else 'train'\n\n # We are gonna store everythin in a dictionnary hidden\n hidden = {}\n hidden['h0'] = X.reshape(X.shape[0], np.prod(X.shape[1:]))\n\n for i in range(self.L):\n id... | [
"0.67652905",
"0.6620769",
"0.66202563",
"0.6577398",
"0.6380125",
"0.6372819",
"0.63684165",
"0.63215613",
"0.6316717",
"0.6303203",
"0.6277401",
"0.62723595",
"0.6269626",
"0.62407196",
"0.62390345",
"0.6234942",
"0.62235326",
"0.6202289",
"0.61824965",
"0.61645675",
"0.614... | 0.72924393 | 0 |
Build this task's classification head. | def build_head(self, n_features, device=None):
# By default this is a linear layer
self.head = self.create_compatible_head(n_features, device) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def head(self) -> tf.estimator.Head:\n\n task_type = self._problem_statement.tasks[0].type\n if task_type.HasField('one_dimensional_regression'):\n return tf.estimator.RegressionHead()\n num_classes = (\n self._tf_transform_output.num_buckets_for_transformed_feature(\n self.raw_labe... | [
"0.6749117",
"0.60415906",
"0.60092235",
"0.5853955",
"0.5802875",
"0.5693355",
"0.5665179",
"0.5637631",
"0.5628371",
"0.5621177",
"0.56188375",
"0.56188375",
"0.56188375",
"0.55739766",
"0.5559742",
"0.55255944",
"0.5508331",
"0.5490201",
"0.5489764",
"0.5484875",
"0.546793... | 0.6520812 | 1 |
Test data for this task | def test_data(self):
return self._test_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTestData(self):\n raise NotImplementedError",
"def test_process_data(self):\n pass",
"def test_data(self, data):\n print('-'*30)\n print('Starting test: {}'.format(data['name']))\n self.set_resolution(data['resolution']['width'], data['resolution']['height'])\n ... | [
"0.77121603",
"0.74460846",
"0.73213947",
"0.7164332",
"0.7164332",
"0.7164332",
"0.7164332",
"0.714354",
"0.7103978",
"0.69678515",
"0.68217576",
"0.68121225",
"0.6750978",
"0.67116654",
"0.67001045",
"0.66699296",
"0.6623456",
"0.66211283",
"0.6617969",
"0.6593253",
"0.6550... | 0.75773656 | 1 |
Dataloader type for this task | def dataloader(self):
return DataLoader | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataloader(self):\n\n # load / split data\n train_data = self.data.get_train_data()\n if self.args.use_dev:\n train_data, dev_data = self.data.split_data(train_data)\n test_data = self.data.get_test_data()\n\n #print(train_data[0])\n #print(dev_data[0])\n ... | [
"0.64198226",
"0.6303011",
"0.62908787",
"0.6223448",
"0.6176214",
"0.6175871",
"0.59194773",
"0.59120303",
"0.5911008",
"0.59027666",
"0.5870242",
"0.584646",
"0.5842133",
"0.5794101",
"0.57517266",
"0.574646",
"0.56932807",
"0.5689548",
"0.5668795",
"0.5666431",
"0.56519496... | 0.67818266 | 0 |
Concatenate two task's datasets | def concatenate_tasks(
tasks,
concat_train=True,
concat_valid=True,
concat_test=True,
):
new_task = deepcopy(tasks[0])
new_task._name = "+".join(task.name for task in tasks)
if concat_train:
new_task._train_data = ConcatDataset(
[task.train_data for task in tasks])
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate_data():",
"def concat(self: TAvalancheDataset, other: TAvalancheDataset) -> TAvalancheDataset:\n return self.__class__([self, other])",
"def Concat(datasets):\n\n dataset_num = len(datasets)\n dataset = datasets[0]\n for i in range(1, dataset_num):\n dataset.concatenate(d... | [
"0.685715",
"0.6508406",
"0.6459176",
"0.63558143",
"0.63046694",
"0.617627",
"0.6152155",
"0.5977995",
"0.58850974",
"0.58077186",
"0.5803393",
"0.57910776",
"0.5675971",
"0.5674531",
"0.5653291",
"0.5594489",
"0.55606794",
"0.55558187",
"0.55526024",
"0.5524445",
"0.5524164... | 0.7752744 | 0 |
The exception of ValueError when format was unsupported. | def _raise_format_error(self, name: str, format_str: str, source_format: str):
raise ValueError(f"The '{ name }' should be { format_str }, rather than { source_format }") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_format(self):\n raise NotImplementedError()",
"def test_old_data_format_error(self):\n assert_raises(ValueError, get_data, self.testv1)",
"def _unknown_format(self, format):\n\n raise errors.NotAcceptable('unknown data format: ' + format)",
"def test_decode_raises_when_forma... | [
"0.7590254",
"0.72390485",
"0.721036",
"0.6805415",
"0.6779957",
"0.6535371",
"0.6451091",
"0.6289927",
"0.620279",
"0.6175287",
"0.61463153",
"0.6133835",
"0.60960364",
"0.6054621",
"0.6033631",
"0.60062885",
"0.6004486",
"0.5990601",
"0.59883577",
"0.5986072",
"0.5967362",
... | 0.7319483 | 1 |
The train iterator that executes a standard training flow per batch. | def _train_batch(self):
# start epoch
for i, (source, target) in enumerate(self.train_dataset):
result = self._batch_iter(source, target, i)
# yield
yield result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_train_iterator(self) -> Iterable[Batch]:\n if self._train_name not in self._datasets:\n raise ValueError(\"Training data not provided.\")\n return self.get_iterator(self._train_name)",
"def train_batch_iter(self, batch_size, num_epochs):\n return self.batch_iter(0, batch_s... | [
"0.7524614",
"0.7506505",
"0.7341301",
"0.7287756",
"0.7240162",
"0.71176016",
"0.7104605",
"0.70856947",
"0.70841146",
"0.6950423",
"0.6944791",
"0.6935007",
"0.6922542",
"0.6916224",
"0.6903519",
"0.68901885",
"0.6874518",
"0.68721944",
"0.6839896",
"0.68311983",
"0.6816215... | 0.79244447 | 0 |
Reset the process of training, which includes the loss meter reset, epoch reset and model's weights reset. | def reset_train(self):
self.model.apply(self._reset_weights)
self.epoch_loss.reset()
self.epoch = 0
del self.batch_process
self.batch_process = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n self.train_loss.reset_states()\n self.train_accuracy.reset_states()\n self.val_loss.reset_states()\n self.val_accuracy.reset_states()\n self.train_mIoU.reset_states()\n self.val_mIoU.reset_states()",
"def train_loop_begin(self):\r\n for _, train_los... | [
"0.80868524",
"0.7918954",
"0.7916748",
"0.7766766",
"0.7735061",
"0.76176995",
"0.7499007",
"0.7421006",
"0.7351169",
"0.72698146",
"0.7228589",
"0.7210134",
"0.71855277",
"0.70681477",
"0.701447",
"0.6989159",
"0.69768757",
"0.6957746",
"0.6951352",
"0.6948265",
"0.69307107... | 0.9016183 | 0 |
UiView of sett module | def ui_view(request):
return render(request, 'sett_ui_view.html', {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ui(self):\n return ui",
"def init_ui(self):\n raise NotImplementedError",
"def init_ui(self):\n raise NotImplementedError",
"def prepare_UI(self):",
"def view(self):",
"def show(self):",
"def updateSettingsUI(self):\n\n pass",
"def __init__(self):\n self.view = ... | [
"0.7031982",
"0.6457756",
"0.6457756",
"0.6440338",
"0.64161724",
"0.63023686",
"0.6291685",
"0.6243074",
"0.61494553",
"0.61151314",
"0.6093119",
"0.6090017",
"0.6085131",
"0.60317594",
"0.60222656",
"0.60190624",
"0.60181403",
"0.6016506",
"0.5963193",
"0.59621996",
"0.5954... | 0.7076183 | 0 |
Calls open file dialog, possible to choose only '.xlsx .xls .xlsm .xlsb' | def callDialog(self):
self.pathTuple = filedialog.askopenfilenames(filetypes=[("Excel files", ".xlsx .xls .xlsm .xlsb")])
self.fileNames = [basename(path.abspath(name)) for name in self.pathTuple] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_file():\n filepath = filedialog.askopenfilename(initialdir = \"./\",title = \"Seleccionar archivo\",filetypes = ((\"xls files\",\"*.xls\"),(\"xlsx files\",\"*.xlsx\")))\n if not filepath:\n return\n\n window.title(filepath)\n lbl_url[\"text\"] = filepath\n btn_generate['state'] = 'no... | [
"0.75951433",
"0.7013304",
"0.7009427",
"0.6953197",
"0.69224757",
"0.6823879",
"0.669363",
"0.6688277",
"0.66736335",
"0.6672926",
"0.66545457",
"0.66527754",
"0.6618524",
"0.65777797",
"0.6551159",
"0.65394413",
"0.65350693",
"0.65235656",
"0.6490343",
"0.6485696",
"0.64783... | 0.7704559 | 0 |
Returns tuple of paths stored at class instance | def getPaths(self):
return self.pathTuple | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paths(self):\n return tuple(self._path)",
"def get_paths(self):\n paths = []\n for f in dir(self):\n o = getattr(self, f)\n if callable(o) and hasattr(o, '_path'):\n paths.append(getattr(o, '_path'))\n return paths",
"def get_class_paths(_cla... | [
"0.7493626",
"0.72214353",
"0.71332705",
"0.6974973",
"0.67577744",
"0.6682504",
"0.66712487",
"0.66641986",
"0.66585755",
"0.66585755",
"0.66517574",
"0.6619837",
"0.6619723",
"0.66154474",
"0.65316343",
"0.6466854",
"0.64451087",
"0.63843393",
"0.6338825",
"0.6330856",
"0.6... | 0.7340977 | 1 |
Triggers a manual build of the project. | async def trigger_build(self, *, branch=None, message=None): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trigger_build(self, postdata):\n pass",
"def build(self):\n logging.info('Build %s of %s (%s)', self._build, self.name,\n self.working_dir)\n self._build += 1\n self._event = None\n status = self._builder.execute_script(self.working_dir, self.script)\n ... | [
"0.69045925",
"0.6808615",
"0.6769827",
"0.6756172",
"0.65721595",
"0.6517098",
"0.6494844",
"0.6461456",
"0.6375029",
"0.6318517",
"0.6312991",
"0.6210087",
"0.6203009",
"0.6105097",
"0.60498416",
"0.59993887",
"0.5988052",
"0.5903205",
"0.5868917",
"0.5858315",
"0.5857097",... | 0.690302 | 1 |
Gets a specific number of builds from the project. | async def get_builds(self, *, quantity=10): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBuild(number):",
"def getBuild(number):",
"def getBuilds():",
"def get_first_n_built_chunk_ids(self, number):\n try:\n conn = psycopg2.connect(\"dbname='{0}'\".format(DATABASE))\n cur = conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)\n cur.execute(\"S... | [
"0.728129",
"0.728129",
"0.6382856",
"0.62236434",
"0.6215881",
"0.6080445",
"0.6080445",
"0.59587866",
"0.59204555",
"0.57647854",
"0.5759255",
"0.5724999",
"0.5719008",
"0.56793606",
"0.56029767",
"0.5565936",
"0.55610716",
"0.5540158",
"0.54715705",
"0.54323786",
"0.541285... | 0.73818636 | 0 |
Return `ret_value` `times` times. If generator will receive some value from outside, update `ret_value` | def exercise_gen(ret_val, times): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def counter_wrapper(generator):\n for value in generator:\n yield value",
"def counter_wrapper_2(generator):\n yield from generator",
"def _mc_gen():\r\n n = 1\r\n while True:\r\n yield n\r\n n += 1",
"def random_values():\n while True:\n yield random()",
"def Cou... | [
"0.6483438",
"0.6218066",
"0.6070627",
"0.60574543",
"0.5988066",
"0.58443666",
"0.5823438",
"0.57975304",
"0.5627555",
"0.5625004",
"0.5599266",
"0.5565379",
"0.55576694",
"0.5519748",
"0.5512081",
"0.5501229",
"0.54756796",
"0.5460212",
"0.5435833",
"0.54218477",
"0.5420322... | 0.7192209 | 0 |
Update `exercise_gen`, so it will ignore all exceptions | def exercise2():
g1 = exercise_gen("I'll ignore errors", 300)
assert next(g1) == "I'll ignore errors"
assert g1.send('new val') == 'new val'
assert g1.throw(Exception) == 'new val'
assert next(g1) == 'new val' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exercise_gen(ret_val, times):",
"def experiment3():\n raise FAKE_ERROR",
"def test_post_codegen_error_query(self):\n with tempfile.TemporaryDirectory() as tmpdirname:\n translator = AstUprootTranslator()\n with pytest.raises(GenerateCodeException):\n translato... | [
"0.5758369",
"0.56753606",
"0.5549753",
"0.53802556",
"0.53689146",
"0.53568685",
"0.5292572",
"0.528666",
"0.5275125",
"0.5251637",
"0.5170305",
"0.51676023",
"0.51614165",
"0.51531315",
"0.5127131",
"0.5115587",
"0.51139444",
"0.5084856",
"0.50776774",
"0.50622576",
"0.5061... | 0.6592326 | 0 |
Create the reference file of a test using the response received. The file will be created in the git references folder provided in the settings file | def create_reference(
self, response_checker=default_checker.default_journey_checker
):
# Check that the file doesn't already exist
filename = self.get_file_name()
filepath = os.path.join(config["REFERENCE_FILE_PATH"], filename)
if os.path.isfile(filepath):
logge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ref(request):\n r = referencepytest.ref(request)\n this_dir = os.path.abspath(os.path.dirname(__file__))\n r.set_data_location(os.path.join(this_dir, '..', 'reference'))\n return r",
"def test_with_new_file(self):\n repository = self.create_repository(tool_name='Test')\n review_requ... | [
"0.65603554",
"0.62640995",
"0.62635124",
"0.62011635",
"0.6008765",
"0.5936762",
"0.5884765",
"0.5857535",
"0.5827133",
"0.5797445",
"0.5793405",
"0.5725234",
"0.57189417",
"0.571022",
"0.5687655",
"0.5664678",
"0.5638524",
"0.56348014",
"0.5630147",
"0.5594338",
"0.55792326... | 0.70232326 | 0 |
Compare the response (which is a dictionary) to the reference First, the function retrieves the reference then filters both ref and resp Finally, it compares them | def compare_with_ref(
self, response, response_checker=default_checker.default_journey_checker
):
def ref_resp2files(output_file, output_json):
"""
Create a file for the filtered response and for the filtered reference
"""
with open(output_file, "w") ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_original_response_with_copy(context):\n original = context.response.json()\n copy = context.response_copy\n\n def compare_top_level_values():\n # get the list of fields that are JSON values not arrays\n keys = [val for val in original.iterkeys() if not isinstance(original[val], (... | [
"0.6025328",
"0.57968277",
"0.57027745",
"0.56979775",
"0.5373415",
"0.532791",
"0.5307729",
"0.52962",
"0.52779275",
"0.5272271",
"0.51982015",
"0.5154221",
"0.514683",
"0.5144544",
"0.51169497",
"0.5078921",
"0.5072906",
"0.5058429",
"0.5058264",
"0.505702",
"0.5056039",
... | 0.7237854 | 0 |
Create a file for the filtered response and for the filtered reference | def ref_resp2files(output_file, output_json):
with open(output_file, "w") as reference_text:
reference_text.write(output_json) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_file(self):\n if self.args.keyfilter:\n self.filter_keys()\n if self.args.datafilter:\n self.filter_values()\n json.dump(self.outputdata, self.outfile, indent=self.args.indent)\n self.outfile.write('\\n')",
"def create_reference(\n self, respons... | [
"0.602621",
"0.59944147",
"0.5985722",
"0.5863088",
"0.5780173",
"0.5737445",
"0.5735932",
"0.5701409",
"0.56273806",
"0.5584363",
"0.5571645",
"0.55378807",
"0.551075",
"0.54842454",
"0.5458675",
"0.5398169",
"0.5377229",
"0.5367841",
"0.5365113",
"0.5354977",
"0.5352039",
... | 0.631874 | 0 |
Print differences between reference and response in console | def print_diff(ref_file, resp_file):
# open reference
with open(ref_file) as reference_text:
reference = reference_text.readlines()
# open response
with open(resp_file) as response_text:
response = response_text.readlines()
# P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_with_ref(\n self, response, response_checker=default_checker.default_journey_checker\n ):\n\n def ref_resp2files(output_file, output_json):\n \"\"\"\n Create a file for the filtered response and for the filtered reference\n \"\"\"\n with open... | [
"0.6958349",
"0.6202376",
"0.6095348",
"0.5904432",
"0.5885077",
"0.5830992",
"0.5810929",
"0.57152325",
"0.5700688",
"0.5698527",
"0.56759423",
"0.56628805",
"0.56229484",
"0.55711806",
"0.55609244",
"0.55433357",
"0.5525367",
"0.549411",
"0.5481868",
"0.5465276",
"0.5456778... | 0.73701763 | 0 |
Proces elements from the input queue until empty. | def run(self) -> None:
while True:
try:
input_element = self.input_queue.get_nowait()
self.process(input_element)
except Empty:
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_queue_fast(self):\n while self.queue:\n self.queue.popleft()()",
"def _wait_empty(self):\n while True:\n if self.queue.empty():\n # We still have to wait for the last queue item being processed\n # (queue.empty() returns True before qu... | [
"0.7123321",
"0.6928471",
"0.6863272",
"0.68230313",
"0.681069",
"0.67634106",
"0.6683323",
"0.6645927",
"0.66053593",
"0.66042024",
"0.65760016",
"0.65450245",
"0.65428",
"0.65332437",
"0.64878625",
"0.6477527",
"0.6431174",
"0.63786554",
"0.6355708",
"0.6354153",
"0.6338230... | 0.71853554 | 0 |
Process every input using the given worker class. | def multiprocess(inputs: list, worker_class: Any, num_threads: int = 40):
input_queue = Queue() # type: ignore
output_queue = Queue() # type: ignore
for input_elm in inputs:
input_queue.put(input_elm)
threads = [worker_class(input_queue, output_queue)
for _ in range(num_threa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processInputs(self):",
"def process_inputs(self, inputs):",
"def run(self):\n self.class_inst_obj.processor(self.msg)",
"def process(self):\n raise NotImplementedError",
"def run(self) -> None:\n\n while True:\n try:\n input_element = self.input_queue.get_... | [
"0.62040085",
"0.6178794",
"0.5952422",
"0.59248585",
"0.5817719",
"0.56970406",
"0.5652122",
"0.56006",
"0.5596137",
"0.555472",
"0.555472",
"0.555472",
"0.55169404",
"0.54495186",
"0.5403452",
"0.5399591",
"0.5373088",
"0.5360921",
"0.5338759",
"0.53068113",
"0.53002506",
... | 0.64647937 | 0 |
Function allows for current user information modification. There is feature for change of default picture that is assigned during registration of new user. Part of change user picture is connected with save_image() function located in `utils.py` where name of original picture file is processing and then saved new_proje... | def account():
form = UpdateAccountForm()
new_project_form = ProjectForm()
if form.validate_on_submit():
if form.picture.data: # if statement responsible for change of default picture
picture_file = save_image(form.picture.data)
current_user.img_file = picture_file
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account():\n\n form = UpdateUserForm()\n\n if form.validate_on_submit():\n print(form)\n if form.picture.data:\n username = current_user.username\n pic = add_profile_pic(form.picture.data,username)\n current_user.profile_image = pic\n\n current_user.u... | [
"0.63029945",
"0.6147011",
"0.60409224",
"0.5987003",
"0.5972466",
"0.59428054",
"0.5842993",
"0.5805387",
"0.5803387",
"0.5779269",
"0.57783127",
"0.5758194",
"0.57569313",
"0.5720132",
"0.57105464",
"0.57057136",
"0.56755704",
"0.56709665",
"0.56596",
"0.56305",
"0.5622149"... | 0.6888967 | 0 |
Function that render form for email input that is destination of utils.send_reset_email function responsible for sending email to user with token that is available for specific period of time and reset user's password | def reset_password():
if current_user.is_authenticated:
return redirect(url_for('main.home'))
form = RequestResetForm()
if form.validate_on_submit():
user = User.query.filter_by(email=form.email.data).first()
send_reset_email(user) # located in utils.py
flash('An email has... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_password_request():\n form = ResetPasswordRequestForm()\n if form.validate_on_submit():\n try:\n user = User.query.filter_by(email=form.email.data).first_or_404()\n except Exception:\n flash('This Email ID is Not Registered', 'error')\n return render_t... | [
"0.7280214",
"0.7197617",
"0.7117962",
"0.7043637",
"0.704304",
"0.6989297",
"0.6984096",
"0.69258046",
"0.6875457",
"0.6868493",
"0.6868304",
"0.6856506",
"0.6787877",
"0.6750242",
"0.67212576",
"0.6699849",
"0.66945165",
"0.66842115",
"0.6680731",
"0.66321975",
"0.6630563",... | 0.7324574 | 0 |
Returns pandas dataframe which has latest record for each manual id after merging all "sheet_name" in the previously indexed_files which are present in "indexed_files_dir" | def zeta0_creation(self, indexed_files_dir, merge_columns):
indexed_files = [file for file in os.listdir(indexed_files_dir) if not file.startswith("~")]
indexed_files_dict = {}
indexed_files_dict.clear()
dateList = []
del dateList[:]
for file in indexed_files:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_walkupseq_files(latest_tsca_id):\n paths = glob.glob('walkupseq_files/*sample_info*')\n\n dfs = []\n for f in paths:\n tmp = pd.read_table(f, encoding='latin1')\n dfs.append(tmp)\n\n df = pd.concat(dfs, axis=0)\n df.to_csv('walkupseq_files/walkupseq_all_combined_%s.txt'%lates... | [
"0.5289423",
"0.52650183",
"0.52591753",
"0.52265924",
"0.51847774",
"0.5076782",
"0.5037608",
"0.50096446",
"0.5009643",
"0.5001173",
"0.4953621",
"0.494462",
"0.493642",
"0.49348438",
"0.49298787",
"0.48461",
"0.48410356",
"0.48382828",
"0.4834661",
"0.48010856",
"0.4796004... | 0.63463265 | 0 |
Helper function for break/clear parsing may be overridden. lookupmodule() translates (possibly incomplete) file or module name into an absolute file name. | def lookupmodule(self, filename):
if os.path.isabs(filename) and os.path.exists(filename):
return filename
f = os.path.join(sys.path[0], filename)
if os.path.exists(f) and self.canonic(f) == self.mainpyfile:
return f
root, ext = os.path.splitext(filename)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup_module(filename):\r\n\r\n # stolen from pdb\r\n import os\r\n import sys\r\n\r\n if os.path.isabs(filename) and os.path.exists(filename):\r\n return filename\r\n f = os.path.join(sys.path[0], filename)\r\n if os.path.exists(f): # and self.canonic(f) == self.mainpyfile:\r\n ... | [
"0.6935571",
"0.6808267",
"0.62503785",
"0.620861",
"0.60548043",
"0.5981422",
"0.59169036",
"0.58730257",
"0.58359164",
"0.5832401",
"0.58213973",
"0.5811231",
"0.5761079",
"0.5698767",
"0.5639836",
"0.5639836",
"0.56236005",
"0.55848193",
"0.5536372",
"0.5535091",
"0.550816... | 0.7024272 | 0 |
Wait n seconds before returning ok | def timeout(n):
time.sleep(int(n))
return 'ok', 200 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait(n=3):\n sleep(n)",
"def waitUntilSuccess():",
"def functionThatWillTimeOut():\n time.sleep(5)",
"def wait_for(test, timeout_seconds=DEFAULT_TIMEOUT):\n start = time.time()\n while True:\n if test():\n return True\n if time.time() - start > timeout_seconds... | [
"0.71733505",
"0.7147747",
"0.68212134",
"0.6718219",
"0.6702025",
"0.6661689",
"0.6661689",
"0.6661689",
"0.6635981",
"0.65762943",
"0.65646064",
"0.6553791",
"0.65345186",
"0.649197",
"0.6484155",
"0.64481616",
"0.6447762",
"0.6443559",
"0.6374297",
"0.63630664",
"0.6290266... | 0.8150463 | 0 |
int ploidy return all possible genotypes, completely determined by ploidy | def all_genotype(ploidy):
return ["".join(comb) for comb in cwr("ACGT-", ploidy)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genotype(args) :\n from genotyper import genotype_samples\n genotype_samples(args)",
"def collapse_genotypes(pL,gL):\n if len(gL) < 2:\n return gL\n else:\n uniqueL = [] # list of unique genotypes relative to ploidy\n for g in gL:\n s = ''\n for i in xra... | [
"0.69029266",
"0.6711919",
"0.6711495",
"0.6549798",
"0.5954817",
"0.59225327",
"0.57624036",
"0.5698024",
"0.56348896",
"0.5612911",
"0.5511534",
"0.54864615",
"0.5481483",
"0.5451472",
"0.54416704",
"0.542101",
"0.5358761",
"0.5353916",
"0.53418523",
"0.53012073",
"0.529263... | 0.78792745 | 0 |
str genotype str base return P(base in genotype) | def prob_t_N(genotype, base):
cnter = Counter(genotype)
return cnter.get(base, 0) * 1/len(genotype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label(genotype_type):\n if genotype_type == \"Hom\":\n return 0\n elif genotype_type == \"Het\":\n return 1\n elif genotype_type == \"Hom_alt\":\n return 2",
"def all_genotype(ploidy):\n return [\"\".join(comb) for comb in cwr(\"ACGT-\", ploidy)]",
"def genotype(args) :... | [
"0.60589737",
"0.5741285",
"0.5715102",
"0.5583383",
"0.5533688",
"0.55254024",
"0.5489838",
"0.5393062",
"0.5336175",
"0.5331854",
"0.5328015",
"0.5308519",
"0.5293455",
"0.5247759",
"0.5218406",
"0.5206605",
"0.5196159",
"0.51130825",
"0.5110904",
"0.50777864",
"0.50563097"... | 0.5752146 | 1 |
str genotype iterableobj bases_all_reads, list or np.array return P(data|genotype) == likelihood | def likelihood_genotype(genotype, bases_all_reads, error_rates):
likelihood = 1
for observed_base in bases_all_reads:
p = 0
for base in "ACGT-":
l = prob_t_N(genotype, base) * error_rates[base][observed_base]
p += l
likelihood *= p
return likelihood | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genotype(args) :\n from genotyper import genotype_samples\n genotype_samples(args)",
"def calculate_genotype_probabilities(self):\n for name, member in self.members.items():\n member.genotype_probabilities = self.genotype_probabilities_of(name)",
"def genotypes(self):\n retur... | [
"0.58311933",
"0.5258182",
"0.51413745",
"0.51239264",
"0.50704426",
"0.5054357",
"0.50419044",
"0.50068015",
"0.49709237",
"0.49687204",
"0.49641567",
"0.4958727",
"0.4943448",
"0.49398604",
"0.49218807",
"0.49215811",
"0.4891338",
"0.48754093",
"0.4873586",
"0.48568666",
"0... | 0.702063 | 0 |
The base exception class of connection exceptions. | def __init__(self, error_msg):
super(ConnectionException, self).__init__(error_msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, msg):\n\n super(DBConnectionError, self).__init__(msg)\n self.msg = msg",
"def _create_exception(self, pgres=None, msg=None, cursor=None):\n assert pgres is None or cursor is None, \\\n \"cannot specify pgres and cursor together\"\n\n if cursor and cursor... | [
"0.6604351",
"0.6386638",
"0.6341203",
"0.6303432",
"0.62695044",
"0.62493557",
"0.6177012",
"0.6173146",
"0.6118006",
"0.60822475",
"0.60723776",
"0.60721236",
"0.6066645",
"0.60590744",
"0.60276735",
"0.60103536",
"0.59800124",
"0.5904314",
"0.5867853",
"0.58674383",
"0.586... | 0.7421417 | 0 |
Reloads the Polls file. | def reloadpolls(self, irc, msg, args):
try:
self.polls = yaml.load(open(self.pollFile, 'r'), Loader=yamlordereddictloader.Loader)
except FileNotFoundError as e:
log.warning("Couldn't open file: %s" % e)
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reloadfile(self, ):\n self.loadfile()",
"def refresh(self):\n self.config.read(self.filename)\n self.loadRecentFiles()",
"def reload(self):\n puts('Reloading application...')\n local('touch ../reload.txt')",
"def reload(self):\n\n pass",
"def reload(self):",
... | [
"0.74811375",
"0.6804164",
"0.6666194",
"0.66235316",
"0.65775543",
"0.65775543",
"0.65237594",
"0.64763457",
"0.6454685",
"0.6289295",
"0.62368816",
"0.6080593",
"0.6055079",
"0.60324496",
"0.5997774",
"0.5995909",
"0.59953433",
"0.5965536",
"0.5963405",
"0.59284127",
"0.589... | 0.7334716 | 1 |
[channel] Vote on a poll. Channel is only needed if used in a PM. | def vote(self, irc, msg, args, channel, pid, yaynay):
if yaynay not in ['yay', 'nay']:
irc.error("Valid Answers are 'yay' or 'nay'.")
return
if channel in self.polls.keys():
if self.polls[channel][pid]['concluded']:
irc.reply("Poll #%s is finished, it... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def votes(self, irc, msg, args, channel, pid):\n if channel and msg.args[0] in irc.state.channels:\n if msg.args[0] != channel:\n if ircdb.checkCapability(msg.prefix, 'admin') or ircdb.checkCapability(msg.prefix, 'owner'):\n irc.error(\"Not Implemented\")\n ... | [
"0.6393847",
"0.6147241",
"0.59954494",
"0.5947859",
"0.5874632",
"0.5840181",
"0.5776968",
"0.5758922",
"0.5722969",
"0.57202333",
"0.5576358",
"0.5565325",
"0.5534625",
"0.548925",
"0.54667646",
"0.5447865",
"0.539419",
"0.53278154",
"0.53092563",
"0.53039765",
"0.528682",
... | 0.6149552 | 1 |
List waiters within the given configuration. | def ListWaiters(self, request, context):
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waiters(self):\n waiters = []\n\n for name, item in self._definition.get('waiters', {}).items():\n name = self._get_name('waiter', Waiter.PREFIX + name)\n waiters.append(Waiter(name, item))\n\n return waiters",
"def get_list_of_configlets(configlets):\n\n futures... | [
"0.71054786",
"0.6426477",
"0.586981",
"0.57586163",
"0.5726431",
"0.5626258",
"0.55491465",
"0.5529439",
"0.5473015",
"0.54290795",
"0.5414866",
"0.53946763",
"0.53753406",
"0.536865",
"0.5325333",
"0.5261703",
"0.5254371",
"0.5234681",
"0.52307975",
"0.51577234",
"0.5136059... | 0.6771325 | 1 |
Save seed into temp file. | def saveseed(self, seed):
savefile = gettempdir() + '/last_test_seed_fate.tmp'
if args.verbose:
print('Saving run into ' + savefile)
with open(savefile, 'w') as f:
f.write(str(seed)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_seed(self, seed: np.ndarray):\n print(\"Reconstructed trace saved as seed to \", CONFIG_DIR)\n np.savetxt(CONFIG_DIR / self.name_seed, seed.view(float).reshape(-1, 2))",
"def insert_test( hash, random, seq ):\n try:\n with open(os.path.join(SEED_DIRECTORY, \"%s_%s\" % (hash, 0)),... | [
"0.71522933",
"0.6273968",
"0.62532884",
"0.6251843",
"0.604025",
"0.60345274",
"0.60236645",
"0.6002649",
"0.5998057",
"0.5997992",
"0.5983726",
"0.5970545",
"0.5964728",
"0.5925001",
"0.5925001",
"0.5902035",
"0.5890514",
"0.58809185",
"0.5874178",
"0.58705467",
"0.5869121"... | 0.8186387 | 0 |
Returns an HTML script element for including a script from the admin media url (or other location if an absolute url is given). | def include_admin_script(script_path):
if not absolute_url_re.match(script_path):
script_path = '%s%s' % (settings.ADMIN_MEDIA_PREFIX, script_path)
return '<script type="text/javascript" src="%s"></script>' % script_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_js(self):\n \n portal_url = getSite().absolute_url()\n \n return \"\"\"\n <script type=\"text/javascript\" src=\"%s/++resource++swfobject.js\"></script>\n <script type=\"text/javascript\" src=\"%s/++resource++audio_player.js\"></script> \n <script type... | [
"0.5999079",
"0.56655055",
"0.5653992",
"0.56134677",
"0.5572652",
"0.5382267",
"0.5336885",
"0.5328502",
"0.53220886",
"0.53072685",
"0.5276165",
"0.52621883",
"0.5245122",
"0.5236014",
"0.523167",
"0.5201591",
"0.51624304",
"0.51335704",
"0.51318634",
"0.51224566",
"0.51154... | 0.7652485 | 0 |
The index view, for the home page. Shows Campaigns this UserProfile is in. | def index(request):
context = dict()
if request.user.is_authenticated():
context['campaigns'] = [
CampaignSerializer(c).serialize() for c in
request.user.userprofile.campaigns.order_by('pk')]
return render(request, 'voter_validation/index.html', context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(request): \n \n all_projects = models.Project.objects.all()\n projects = get_objects_for_user(request.user, 'view_project', all_projects)\n \n fbads_settings = FacebookAdsSettings.objects.first()\n return render_to_response('index.html',{\n 'projects': p... | [
"0.6278449",
"0.5947191",
"0.57573825",
"0.57182586",
"0.5707867",
"0.5703257",
"0.56390655",
"0.5605963",
"0.55317235",
"0.5515906",
"0.5514333",
"0.5508371",
"0.54833335",
"0.5471401",
"0.5455781",
"0.54364294",
"0.5406502",
"0.5397928",
"0.53924406",
"0.53866136",
"0.53479... | 0.6828237 | 0 |
Shows validation UI for a given campaign, if this UserProfile is authorized to do data entry for the specified Campaign. This is also the endpoint for searching for Voters as part of validation. If doing a search, assume that a sufficient number of the specified fields is present (taken care of in frontend form validat... | def validate(request, campaign_id):
if not request.user.userprofile.in_campaign(campaign_id):
return HttpResponseRedirect(reverse("voter_validation:index"))
campaign_id = int(campaign_id)
campaign = get_object_or_404(Campaign, id=campaign_id)
# Get the number of signatures validated by the cur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(request):\n context = dict()\n if request.user.is_authenticated():\n context['campaigns'] = [\n CampaignSerializer(c).serialize() for c in\n request.user.userprofile.campaigns.order_by('pk')]\n return render(request, 'voter_validation/index.html', context)",
"def v... | [
"0.5706519",
"0.5386401",
"0.5315525",
"0.530953",
"0.51058286",
"0.51058286",
"0.48647565",
"0.4818601",
"0.47097164",
"0.46946898",
"0.46497676",
"0.4634922",
"0.46242386",
"0.45637044",
"0.449959",
"0.44929436",
"0.44728902",
"0.44613764",
"0.44438702",
"0.4442745",
"0.443... | 0.62158144 | 0 |
This is the base Exception class for all step failures. It can be manually raised from recipe code to cause the build to turn red. | def StepFailure(self):
return recipe_api.StepFailure | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raise_step_error(self, error: Exception, step: str):\n error_message = \"{}\\nFailed: Error={}\".format(step, str(error))\n logging.error(error_message)\n self.slacker.send_thread_reply(error_message)\n raise Exception(error_message)",
"def raise_on_error(self):\n if not self... | [
"0.65778327",
"0.6160697",
"0.6118424",
"0.6045226",
"0.6028757",
"0.59925586",
"0.59890693",
"0.5984237",
"0.5979543",
"0.5880542",
"0.58220655",
"0.58042306",
"0.58023226",
"0.57811123",
"0.57735544",
"0.56904095",
"0.56897426",
"0.5686951",
"0.56869185",
"0.5652853",
"0.56... | 0.6969654 | 0 |
StepWarning is a subclass of StepFailure, and will translate to a yellow build. | def StepWarning(self):
return recipe_api.StepWarning | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _warn(self, warning=None):\r\n debug.err('Warning: %s' % warning)\r\n\r\n if core.FW_conf['settings'].TestRun.ExecutionMode == 'Leader' and warning != None:\r\n executeInFollower(\"self.warn('%s')\" % (warning,))\r\n\r\n if type(warning) != types.ListType:\r\n warning... | [
"0.680333",
"0.6467354",
"0.6363371",
"0.6182617",
"0.6118767",
"0.60774654",
"0.6036392",
"0.6019372",
"0.6014528",
"0.6010554",
"0.5999503",
"0.5906176",
"0.5892281",
"0.5887475",
"0.5859568",
"0.5821751",
"0.5817227",
"0.5793164",
"0.5664179",
"0.5653461",
"0.5625123",
"... | 0.792026 | 0 |
InfraFailure is a subclass of StepFailure, and will translate to a purple build. This exception is raised from steps which are marked as `infra_step`s when they fail. | def InfraFailure(self):
return recipe_api.InfraFailure | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _identify_fail(failure):\n logger.warning(failure.getErrorMessage())\n logger.warning(\"Failed to setup & obtain identity\")\n return",
"def failure_exception(cls, state, exception):\r\n return PlatformMessage(method=\"__reply__\", kwargs={\"__result__\": \"fail\", \"state\": state, \"errcode... | [
"0.5803383",
"0.5730745",
"0.565321",
"0.5649556",
"0.56122845",
"0.5440349",
"0.5320383",
"0.52736396",
"0.5240046",
"0.5213798",
"0.5201333",
"0.5083693",
"0.50791305",
"0.50574607",
"0.5027117",
"0.50205135",
"0.5006612",
"0.5000682",
"0.49848235",
"0.49722403",
"0.4962557... | 0.6850455 | 0 |
StepTimeout is a subclass of StepFailure and is raised when a step times out. | def StepTimeout(self):
return recipe_api.StepTimeout | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raise_timeout(self, *args, **kwargs):\n\n self.log.error(\"Task timeout encountered.\")\n raise TimeoutError",
"def handler(*args, **kwargs):\n raise TimeoutException(\"Test aborted due to timeout. Test was \" +\n \"expected to finish in less than {} second(s).\".format(time_l... | [
"0.6783338",
"0.6670357",
"0.6458349",
"0.6233549",
"0.620531",
"0.6151229",
"0.61305606",
"0.6103031",
"0.59383696",
"0.5915559",
"0.5886344",
"0.5850895",
"0.58435684",
"0.58397263",
"0.5815907",
"0.5812256",
"0.576869",
"0.5734896",
"0.5714007",
"0.56782407",
"0.56605077",... | 0.7499932 | 0 |
The currently active (open) result from the last step that was run. This is a `types.StepData` object. | def active_result(self):
return self.step_client.previous_step_result() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result(self):\n # most pythonic way to get last in last is -1\n return self.history[-1]",
"def current_progress_data(self):\n return self._current_progress_data",
"def previous_step_result(self):\n return self._previous_step_result",
"def cur_step(self):\n return self._cur_... | [
"0.7012832",
"0.6931432",
"0.6929647",
"0.67603475",
"0.66973376",
"0.6685482",
"0.66834754",
"0.66508675",
"0.66325194",
"0.65645987",
"0.6562965",
"0.65574545",
"0.65385914",
"0.6496028",
"0.6484237",
"0.6467374",
"0.6467374",
"0.6467374",
"0.64124614",
"0.6401742",
"0.6391... | 0.78945726 | 0 |
Nest allows you to nest steps hierarchically on the build UI. Calling ```python | def nest(self, name):
step_result = self(name, [])
with self.m.context(name_prefix=name, increment_nest_level=True):
yield step_result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_step(self):\n pass",
"def build_step(self):\n pass",
"def test_build_page_nested(build_resources, cli):\n books, _ = build_resources\n src = books.joinpath(\"nested\")\n page = src.joinpath(\"contents\", \"markdown.md\")\n html = src.joinpath(\"_build\", \"_page\", \"content... | [
"0.5666077",
"0.5666077",
"0.5635756",
"0.5634427",
"0.53961426",
"0.5334729",
"0.52571476",
"0.52398247",
"0.5215903",
"0.5194408",
"0.5111144",
"0.51089895",
"0.505281",
"0.50474066",
"0.5011156",
"0.50028014",
"0.49496236",
"0.4938487",
"0.4927877",
"0.48954463",
"0.485139... | 0.5708708 | 0 |
Insert single row into a table | def _insert_table_row(self, db: str, table: str, row: Dict[str, Any]):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_row(self, table: str, row_data: dict):\r\n\r\n columns = \"\".join([f\"'{i}',\" for i in row_data]).rstrip(\",\")\r\n keys = \"\".join([f\"'{row_data[i]}',\" for i in row_data]).rstrip(\",\")\r\n sql_statement = f\"INSERT INTO {table} ({columns}) VALUES({keys});\"\r\n try:\r\... | [
"0.7340923",
"0.7256007",
"0.7239077",
"0.7177126",
"0.71218693",
"0.70833904",
"0.7065664",
"0.69191945",
"0.68331724",
"0.682139",
"0.68028295",
"0.67609316",
"0.6746725",
"0.6736111",
"0.673245",
"0.6703915",
"0.6692947",
"0.6680959",
"0.66731584",
"0.6654706",
"0.6627586"... | 0.7353583 | 0 |
Compares two response objects based on their NVCness. Only returns true if both responses are in agreement with either responding NVC or not NVC. | def compare(obj_a, obj_b):
return (tuple_to_string(obj_a) == 'NVC') == (tuple_to_string(obj_b) == 'NVC') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_vn_in_api_server(self):\n self.api_verification_flag = True\n self.api_s_vn_obj = self.api_s_inspect.get_cs_vn(\n domain=self.domain_name, project=self.project_name,\n vn=self.vn_name, refresh=True)\n if not self.api_s_vn_obj:\n self.logger.debug(\"V... | [
"0.57760257",
"0.57723004",
"0.57442796",
"0.5704212",
"0.5581943",
"0.55500567",
"0.5549865",
"0.55349195",
"0.55025715",
"0.54922974",
"0.544647",
"0.5440523",
"0.54150635",
"0.5412424",
"0.5370746",
"0.5357937",
"0.535282",
"0.5340017",
"0.53387195",
"0.5306857",
"0.529481... | 0.6934954 | 0 |
Runs main gobject loop. | def run_main_loop():
mainloop = GObject.MainLoop() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loop( self ):\n import gtk\n while self.count >= 1:\n log.debug( 'GTK loop restarting' )\n while gtk.events_pending():\n gtk.main_iteration()\n log.debug( 'GTK loop exiting' )\n try:\n del self.t_loop\n except AttributeError, er... | [
"0.760594",
"0.7460419",
"0.72110164",
"0.7099442",
"0.7034407",
"0.691706",
"0.6902692",
"0.68630695",
"0.6785323",
"0.67737657",
"0.6773619",
"0.6746319",
"0.6662695",
"0.66581476",
"0.66040593",
"0.6601622",
"0.65761584",
"0.6574493",
"0.65733767",
"0.6544273",
"0.65289533... | 0.8040331 | 0 |
Initialie dbus system bus acquire adapter/interface for org.bluez.GattManager1 register application for 'org.bluez.GattService1' | def __init__(self):
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
self.bus = dbus.SystemBus()
self.adapter = self._find_adapter()
if not self.adapter:
IFaceNotFoundException('%s interface not found' % GATT_MANAGER_IFACE)
self.service_manager = dbus.Interface(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, alias, adapter=None):\n\n dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)\n\n self.bus = dbus.SystemBus()\n\n if not adapter:\n adapter = self._find_adapter()\n if not adapter:\n logger.error(\"Could not find any adapter implementin... | [
"0.7221227",
"0.61894155",
"0.6014742",
"0.59280574",
"0.5923623",
"0.57182866",
"0.57111996",
"0.56961524",
"0.56900334",
"0.56577533",
"0.5630222",
"0.5583196",
"0.5564716",
"0.5501188",
"0.54448515",
"0.54448307",
"0.5401305",
"0.5356949",
"0.5353707",
"0.5304931",
"0.5298... | 0.77838093 | 0 |
Adds service to previously initialize app. | def add_service(self, service):
self.app.add_service(service) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addService(self, service):\n\t\tself.services.append(service)\n\t\treturn self",
"def add(self, service: AbstractService):\n self.services.append(service)",
"def initService(self):",
"def add_app(self):\n \n pass",
"def add_service(self, zeroconf, service_type, name):\n self... | [
"0.70407766",
"0.6967143",
"0.6634693",
"0.6463807",
"0.6374438",
"0.628673",
"0.62649804",
"0.6252654",
"0.62386537",
"0.62090975",
"0.61053437",
"0.6091435",
"0.605257",
"0.6042793",
"0.60172504",
"0.599833",
"0.599623",
"0.59924555",
"0.5940163",
"0.58883333",
"0.5873045",... | 0.8112667 | 0 |
Return the date (UTC) from 10 days ago formatted as YYYYMMDD. | def _ten_days_ago() -> str:
ten_days_ago = gmtime(mktime(gmtime()) - TEN_DAYS_SECONDS)
return strftime(DATE_FORMAT, ten_days_ago) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ago(self):\n return human(self.timestamp/1000.0, precision=1, abbreviate=True)",
"def relativeTime(date):\n diff = datetime.utcnow() - date\n\n if diff.days > 7 or diff.days < 0:\n return date.ctime()\n elif diff.days == 1:\n return '1 day ago'\n elif diff.days > 1:\n return '%d days ago'... | [
"0.63436246",
"0.6039876",
"0.5983086",
"0.5962784",
"0.58728963",
"0.581312",
"0.58069855",
"0.5791033",
"0.5787348",
"0.5763219",
"0.56588507",
"0.5579537",
"0.5577654",
"0.55374175",
"0.5471164",
"0.539841",
"0.53682923",
"0.5352607",
"0.53389454",
"0.53330094",
"0.5331382... | 0.7581562 | 0 |
Return the last month (UTC) formatted as YYYYMM. | def _last_month() -> str:
time_now = gmtime()
return (
f"{time_now.tm_year}-{time_now.tm_mon - 1:02d}" if time_now.tm_mon > 1
else f"{time_now.tm_year - 1}-12"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_month_day():\r\n return (datetime.now().replace(day=1) + relativedelta(months=1) + timedelta(days=-1)).strftime(\r\n '%d-%m-%Y')",
"def make_last_month_period(dt=None):\n if not dt:\n dt = datetime.utcnow()\n dt = dt.replace(day=1) - timedelta(days=1)\n return dt.strftime('%Y%m... | [
"0.7890911",
"0.77757496",
"0.7772196",
"0.74962604",
"0.7192194",
"0.6839517",
"0.6807995",
"0.6761683",
"0.6746424",
"0.6616606",
"0.66151744",
"0.6588002",
"0.6588002",
"0.6579385",
"0.6565151",
"0.65579987",
"0.65383244",
"0.64961576",
"0.6473222",
"0.64433897",
"0.639331... | 0.8435946 | 0 |
Retrieve the latest exchange rate from the given ECB data. | def _get_latest_ecb_rate(data: bytes) -> float:
root = etree.fromstring(data)
values = root.xpath('.//generic:ObsValue/@value', namespaces=root.nsmap)
last_value = len(values) - 1
return float(values[last_value]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_and_store_latest_ecb_exrates():\n response = requests.get(DAILY_ECB_URL)\n # Raise exception if status_code != 200 or ConnectionError\n response.raise_for_status()\n info = ET.fromstring(response.content)[2][0]\n datestamp = datetime.strptime(info.attrib['time'], \"%Y-%m-%d\").date()\n ... | [
"0.7017314",
"0.6967795",
"0.6684886",
"0.6548335",
"0.65449774",
"0.65055674",
"0.6461167",
"0.6431432",
"0.64266616",
"0.6394351",
"0.62385744",
"0.62312907",
"0.62306887",
"0.62064004",
"0.61375725",
"0.6130839",
"0.6130635",
"0.6115328",
"0.60870564",
"0.6060977",
"0.5914... | 0.759938 | 0 |
Retrieve and store the 15min delayed BTC market price in EUR. | def _get_btc_eur_15min(self) -> None:
with requests.get(BITCOIN_TICKER) as response:
response.raise_for_status()
json_data = response.json()
self.btc_eur_15min = json_data["EUR"]["15m"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getprice():\n\n print(\"Get price\")\n latest_price = get_latest_price(item_code)\n return latest_price",
"def do_work(self) -> None:\n self._get_btc_eur_15min()\n print(\n f\"1 BTC = {self.btc_eur_15min} EUR\"\n f\"\\t\\t(15min delayed market price)\"\n )\... | [
"0.65415394",
"0.6299414",
"0.62688947",
"0.6254417",
"0.62187046",
"0.6205762",
"0.620122",
"0.61773175",
"0.61718124",
"0.6161998",
"0.6105141",
"0.60968745",
"0.6074585",
"0.6072953",
"0.601132",
"0.5992859",
"0.5969653",
"0.5964009",
"0.5900362",
"0.5885169",
"0.586665",
... | 0.70017016 | 0 |
Retrieve and store last month's EUR to GBP average rate. | def _get_eur_gbp_last_month(self) -> None:
last_month = _last_month()
data = _get_ecb_data(FREQUENCY_MONTHLY, last_month, last_month)
self.eur_gbp_last_month = _get_latest_ecb_rate(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_eur_gbp_last_daily(self) -> None:\n data = _get_ecb_data(FREQUENCY_DAILY, _ten_days_ago(), _today())\n\n self.eur_gbp_last_day = _get_latest_ecb_rate(data)",
"def get_avg(self):\r\n df = pd.read_csv(\"MonthlyRate.csv\")\r\n df = df[df.CurrencyCode == self.choice]\r\n m... | [
"0.65970474",
"0.6344092",
"0.5897189",
"0.5880332",
"0.58152103",
"0.5769175",
"0.57214457",
"0.5711045",
"0.55768675",
"0.5523535",
"0.5501505",
"0.5479372",
"0.5457628",
"0.54402447",
"0.542044",
"0.5388946",
"0.5384516",
"0.5383942",
"0.53801686",
"0.53687716",
"0.5363499... | 0.7096632 | 0 |
Retrieve and store the latest daily EUR to GBP average rate. | def _get_eur_gbp_last_daily(self) -> None:
data = _get_ecb_data(FREQUENCY_DAILY, _ten_days_ago(), _today())
self.eur_gbp_last_day = _get_latest_ecb_rate(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitcoinaverage(site):\n url = \"https://apiv2.bitcoinaverage.com/frontend/constants/exchangerates/local\"\n try:\n session = requests.Session()\n cfscrape_requests = cfscrape.create_scraper(sess=session)\n ret = cfscrape_requests.get(url, timeout=(15, 15)).json()[\"rates\"]\n ... | [
"0.65365905",
"0.62230974",
"0.61657596",
"0.6133238",
"0.60252744",
"0.5859477",
"0.58187735",
"0.58073163",
"0.5803112",
"0.5690306",
"0.56884164",
"0.56819123",
"0.56722516",
"0.5655974",
"0.56529254",
"0.56445503",
"0.5622465",
"0.5596036",
"0.559005",
"0.5584927",
"0.558... | 0.714428 | 0 |
Calculate the 15min delayed BTC market price in GBP. | def _get_btc_gbp_15min(self) -> None:
self._get_eur_gbp_last_daily()
self.btc_gbp_15min = self.btc_eur_15min * self.eur_gbp_last_day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_work(self) -> None:\n self._get_btc_eur_15min()\n print(\n f\"1 BTC = {self.btc_eur_15min} EUR\"\n f\"\\t\\t(15min delayed market price)\"\n )\n\n self._get_eur_gbp_last_month()\n print(\n f\"1 EUR = {self.eur_gbp_last_month} GBP\"\n ... | [
"0.6735869",
"0.6266725",
"0.61613244",
"0.6135455",
"0.6012119",
"0.5998848",
"0.5924012",
"0.5846881",
"0.58299065",
"0.58050394",
"0.5770253",
"0.5769695",
"0.576529",
"0.5724111",
"0.57105625",
"0.5661389",
"0.563068",
"0.56113887",
"0.560933",
"0.5585725",
"0.5583436",
... | 0.7985306 | 0 |
Instantiate and run the worker. | def main() -> None:
worker = Worker()
worker.do_work() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_and_run_worker(self):\n\n # Run processing on QThread worker - prevents GUI lock up\n # Create processing object, map control data\n processing_hub = ProcessingHub(control=self.control)\n\n # Create worker thread, connect signals to methods in this class and start, which call... | [
"0.7279886",
"0.7101314",
"0.70331264",
"0.7012368",
"0.70091134",
"0.69631004",
"0.6924996",
"0.68743694",
"0.6871539",
"0.6871292",
"0.68372667",
"0.6789902",
"0.67830294",
"0.6669269",
"0.6668853",
"0.6661168",
"0.6640133",
"0.6624162",
"0.6593175",
"0.6540589",
"0.6489322... | 0.7226993 | 1 |
Return the cosmology that is being used | def get_cosmology(cosmology=conf.cosmology):
if cosmology.lower() not in available_cosmologies:
raise ValueError(
"Unrecognised cosmology {}. Available cosmologies are {}".format(
cosmology, ", ".join(available_cosmologies)
)
)
elif cosmology.lower() in _a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_cos_dscp(self):\n return self.__cos_dscp",
"def set_cosmology(self, cosmo):\n self.cosmo = cosmo\n self.h70 = cosmo['h'] # Hubble parameter, H0 = 100h km/s/Mpc\n self.Om = cosmo['omega_M_0'] # Omega_matter\n self.Ol = cosmo['omega_lambda_0'] # Omega_Lambda",
"def _get_co... | [
"0.6441433",
"0.64167005",
"0.6164821",
"0.6161581",
"0.6125467",
"0.60074854",
"0.59982276",
"0.5963294",
"0.5915752",
"0.58894485",
"0.5884741",
"0.57696545",
"0.5693378",
"0.5673406",
"0.5641914",
"0.56051314",
"0.56012136",
"0.55621797",
"0.55592734",
"0.55408865",
"0.547... | 0.7251539 | 0 |
Return the Planck15 cosmology coded up in lalsuite | def Planck15_lal_cosmology():
return cosmo.LambdaCDM(H0=67.90, Om0=0.3065, Ode0=0.6935) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cie_lab(self):\n K = Fraction(1, 3) * Fraction(29, 6) ** 2\n e = Fraction(6, 29) ** 3\n x, y, z = (n / m for n, m in zip(self.cie_xyz, D65))\n fx, fy, fz = (\n n ** Fraction(1, 3) if n > e else K * n + Fraction(4, 29)\n for n in (x, y, z)\n )\n ... | [
"0.55920184",
"0.549476",
"0.54696536",
"0.54056984",
"0.53960073",
"0.5380349",
"0.53594655",
"0.53576845",
"0.53418833",
"0.53027004",
"0.5290028",
"0.5287675",
"0.5284653",
"0.52330744",
"0.51322997",
"0.50801104",
"0.5078625",
"0.50296295",
"0.50066954",
"0.5004581",
"0.4... | 0.70417845 | 0 |
Return the base cosmology but with the Riess2019 H0 value. For details | def Riess2019_H0_cosmology(base_cosmology):
_base_cosmology = get_cosmology(base_cosmology)
return cosmo.LambdaCDM(
H0=74.03, Om0=_base_cosmology.Om0, Ode0=_base_cosmology.Ode0
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sound_horizon_EH(self):\n om_m = self.omega_cb\n om_b = self.omega_b\n om_n = np.sum(self.omega_nu)\n h = self.h \n if self.M_nu_tot == 0.: rs = 44.5*np.log(9.83/om_m)/np.sqrt(1+10*om_b**0.75)*h\n else: rs = 55.154*np.exp(-72.3*(om_n+0.0006)*... | [
"0.6274564",
"0.6107101",
"0.60727805",
"0.58837694",
"0.5814193",
"0.5814193",
"0.56165946",
"0.55797195",
"0.5553944",
"0.5534817",
"0.553009",
"0.55183256",
"0.5515757",
"0.5511963",
"0.5507393",
"0.54924595",
"0.5484746",
"0.5456038",
"0.5441649",
"0.54290783",
"0.5415065... | 0.70496 | 0 |
Returns the supported components e.g. set(['mmic_autodock_vina',...]). Returns Set[str] | def tactic_comps(cls) -> Set[str]:
return set(["mmic_autodock_vina"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_supported_components(self):\n props = [cdav.SupportedCalendarComponentSet()]\n response = self.get_properties(props, parse_response_xml=False)\n response_list = response.find_objects_and_props()\n prop = response_list[unquote(self.url.path)][\n cdav.SupportedCalendarC... | [
"0.7520092",
"0.6942378",
"0.6502353",
"0.64853776",
"0.64341474",
"0.6051912",
"0.603774",
"0.58496153",
"0.58443105",
"0.58355975",
"0.5832998",
"0.5783114",
"0.5783114",
"0.577528",
"0.57419336",
"0.57056123",
"0.56868654",
"0.5655444",
"0.5626463",
"0.5625516",
"0.5606547... | 0.7170247 | 1 |
Load the specified mojofile, and return its model id. | def load_model(self, mojofile: str) -> str:
return self._request("GET /loadmojo", params={"file": mojofile}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model(self, filename):\r\n pass",
"def load_model(self, file=None):\n return None",
"def load_model(self, file_name=None):\n try:\n if file_name:\n self.agent.load_model(file_name)\n else:\n self.agent.load_model()\n print... | [
"0.6718768",
"0.654268",
"0.61337996",
"0.6125505",
"0.6113581",
"0.6078083",
"0.60401374",
"0.60291064",
"0.5945967",
"0.5840561",
"0.5827812",
"0.5739245",
"0.5689958",
"0.5678766",
"0.5677562",
"0.5670736",
"0.56696165",
"0.5610047",
"0.5605511",
"0.55876744",
"0.5587407",... | 0.78735054 | 0 |
Shutdown / kill the server. Sometimes the ``POST /shutdown`` request may fail. In any case we attempt to terminate the process with the SIGKILL signal if it still seems to be running. | def shutdown(self):
try:
self._request("POST /shutdown")
time.sleep(0.300)
except requests.exceptions.ConnectionError:
pass
if self._process and self._process.poll() is None:
self._process.kill()
if self._session:
self._session.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown():\n os.kill(os.getpid(), signal.SIGTERM)",
"def shutdown():\n self_pid = os.getpid()\n logging.info('Forcibly terminating program (PID=%s)', self_pid)\n os.kill(self_pid, signal.SIGKILL)",
"def stop(self):\n self.shutdown_ = True\n if self.running():\n os.kill... | [
"0.8043204",
"0.7408491",
"0.74051774",
"0.73047185",
"0.7299",
"0.7294056",
"0.72432417",
"0.7183416",
"0.7163862",
"0.7163367",
"0.7136405",
"0.71052444",
"0.70983547",
"0.70959175",
"0.70620507",
"0.70323277",
"0.70266837",
"0.7002895",
"0.6961565",
"0.696054",
"0.69446033... | 0.81470776 | 0 |
Update the kernelspecs table. | def refresh_kernelspecs() -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_kernels() -> None:\n ...",
"def modify_devices(self):\n\n for i in self._nodes.items():\n node = i[1]\n devices = node[\"devices\"]\n other_devices = devices[\"other_devices\"]\n kernel_devices = devices[\"kernel_devices\"]\n dpdk_devic... | [
"0.5808753",
"0.5629541",
"0.5591042",
"0.5496405",
"0.54948765",
"0.5418482",
"0.52984756",
"0.5270303",
"0.5197712",
"0.5154047",
"0.5119544",
"0.5119544",
"0.51178193",
"0.5101636",
"0.50797075",
"0.5073883",
"0.5045194",
"0.50378954",
"0.50309587",
"0.5014471",
"0.5006939... | 0.7550118 | 0 |
Creates a new terminal and returns the name. | def create_terminal() -> str:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"Terminal('{}')\".format(self.name)",
"def addTerminal(self, name, **opts):\n opts.update(renamable=True, removable=True)\n name = self.nextTerminalName(name)\n term = NetTerminal(self, name, **opts)\n self.terminals[name] = term\n if term.i... | [
"0.6440198",
"0.6267893",
"0.62144405",
"0.60047346",
"0.5891908",
"0.5890155",
"0.5865237",
"0.57142264",
"0.5690836",
"0.5674329",
"0.56701756",
"0.56039375",
"0.5576599",
"0.5536455",
"0.5528613",
"0.5440345",
"0.5381108",
"0.5373771",
"0.52840245",
"0.52517766",
"0.521793... | 0.80201596 | 0 |
Update the kernels table. | def refresh_kernels() -> None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_kernelspecs() -> None:\n ...",
"def callUpdateTable(self):\r\n self.updateTable()",
"def gpu_kernels(self, node, name):\r\n raise MethodNotDefined, 'gpu_kernels'",
"def run(self):\n\n self.sess.run(self.update_operations)",
"def update(self, x_train_single, updated_h):\n ... | [
"0.6155734",
"0.57529676",
"0.5730305",
"0.56955045",
"0.56193566",
"0.5611958",
"0.5498789",
"0.5324433",
"0.5293424",
"0.5292726",
"0.5291626",
"0.52879345",
"0.5268349",
"0.5242812",
"0.52361995",
"0.52361995",
"0.51978123",
"0.5197042",
"0.51949096",
"0.5192662",
"0.51908... | 0.7096408 | 0 |
Creates a new kernel and returns the ID | def create_kernel(name: str) -> str:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kernel(self, kernel_id):",
"def testCreateKernel(self):\n try:\n contextID, retErr = PyOpenCLInterface.CreateContext(self.testResources.listDevicesIDs, self.testResources.dictProperties)\n self.assertEqual(retErr, 0)\n # create program\n programID, retEr... | [
"0.6998178",
"0.6430162",
"0.59596896",
"0.59022087",
"0.58619636",
"0.58563536",
"0.5824651",
"0.5798457",
"0.5699474",
"0.56958765",
"0.5624578",
"0.5619856",
"0.560809",
"0.5569131",
"0.5542638",
"0.5518145",
"0.5472115",
"0.5447868",
"0.5417481",
"0.54118687",
"0.5337183"... | 0.7782273 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.