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 |
|---|---|---|---|---|---|---|
Save a simulated fragmented file version of the file. Trunfactor specifies how much of the data, sequentially from the start of file, should be written to the new file. | def savefragment(filepath, fname, outpath, truncfactor=0.5, preserve_name=False):
# Read data
infile = open(filepath, 'rb')
data = infile.read()
infile.close()
# Write truncated filepath
if not preserve_name:
fpath = genSavePath(outpath, fname, modstring=f"truncated{truncfactor}")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_data(infbfile,begin_N,dur_N,outfbfile):\n infbfile.seek_to_sample(begin_N)\n for i in range(begin_N,(begin_N+dur_N)):\n data = infbfile.read_sample()\n data.tofile(outfbfile)",
"def save(self, fname):\n lh_data = self.data[:len(self.lh_vertno)]\n rh_data = self.data[-l... | [
"0.53168994",
"0.52053297",
"0.50609237",
"0.5041503",
"0.5023959",
"0.49947497",
"0.49635452",
"0.495652",
"0.49504188",
"0.49476227",
"0.494738",
"0.49422064",
"0.49133167",
"0.4913253",
"0.49015784",
"0.48993456",
"0.48802665",
"0.48687673",
"0.4865208",
"0.48493338",
"0.4... | 0.62867725 | 0 |
Detects Xepr instances which are waiting for connections from XeprAPI clients. For this to work, the API has to be enabled in Xepr (menu "Processing" > submenu "XeprAPI" > menu item "Enable Xepr API"). Xepr instances which already are connected to an XeprAPI client are not listed. | def getXeprInstances():
apilib = _loadapilib()
instances = _findInst(apilib)
return dict([(p, t) for p, t in instances]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _wait_active(client, request_id, max_num):\n logging.info('Waiting for instances to be active')\n while True:\n res = client.describe_spot_fleet_instances(SpotFleetRequestId=request_id)\n if len(res['ActiveInstances']) == max_num:\n logging.info('Instances are active now.')\n ... | [
"0.6325874",
"0.57466775",
"0.55821526",
"0.5577072",
"0.54760903",
"0.54682326",
"0.543734",
"0.5412187",
"0.5394259",
"0.53219014",
"0.5313654",
"0.52691233",
"0.5248033",
"0.5224936",
"0.52046394",
"0.5202071",
"0.52012694",
"0.5174187",
"0.51666844",
"0.51602364",
"0.5159... | 0.6125134 | 1 |
Closes the API and tells Xepr to shut down its API support as well. After that, the API support of Xepr has to be re enabled manually by the Xepr operator (menu "Processing" > submenu "XeprAPI" > menu item "Enable Xepr API") to be able to establish the Xepr API again. | def XeprClose(self):
with self._lock:
for func in self._dynamicmethods:
delattr(self, func)
self._dynamicmethods = []
self._printmsg('Closing API...', newline=False)
if self._API.XeprDisableAPI(1) == SUCCESS:
self._printmsg('done.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n self.__aceQLHttpApi.close()",
"def _close(self):\n log.Debug('dpbx.close():')",
"def close(self):\n self.controller.DisableDevice()\n self.controller.StopPolling()\n self.controller.Disconnect(False)",
"def close(self):\n if self.dev_open:\n ... | [
"0.6518419",
"0.6297029",
"0.6261232",
"0.6248867",
"0.61627144",
"0.6101848",
"0.6072765",
"0.60054755",
"0.6004206",
"0.6000544",
"0.5971086",
"0.5967516",
"0.59390146",
"0.593771",
"0.5916162",
"0.59158105",
"0.59158105",
"0.590212",
"0.5895577",
"0.5895577",
"0.5895577",
... | 0.83324784 | 0 |
Refreshes the Xepr GUI. | def XeprGUIrefresh(self):
with self._lock:
self._API.XeprRefreshGUI() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh(self):\n\t\tself.win.refresh()\n\t\tfor c in self.components:\n\t\t\tc.refresh()",
"def refresh_dialog(self):\n self._client.update_elements()",
"def refresh(self):\n self.Refresh()",
"def Refresh(self):\n pass",
"def refresh(self):\n self.__refresh()",
"def refresh(... | [
"0.7118413",
"0.6885529",
"0.6867989",
"0.66451275",
"0.65044814",
"0.6423347",
"0.6417798",
"0.6398829",
"0.63724816",
"0.6371857",
"0.63682497",
"0.6328148",
"0.63234603",
"0.63234603",
"0.6223904",
"0.62109405",
"0.6206273",
"0.6206273",
"0.6206273",
"0.6157153",
"0.609169... | 0.85330975 | 0 |
Check whether dataset is available. | def datasetAvailable(self):
dset = None
try:
dset = self._getcopy()
except Exception:
pass
if dset is not None:
self._parent.destroyDset(dset)
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_available(dataset_name=None):\r\n for file_list in data_resources[dataset_name]['files']:\r\n for file in file_list:\r\n if not os.path.exists(os.path.join(data_path, dataset_name, file)):\r\n return False\r\n return True",
"def check_dataset_exists(dataset):\n ... | [
"0.7826292",
"0.7441684",
"0.72973037",
"0.7230916",
"0.7226951",
"0.70393974",
"0.7030351",
"0.70008165",
"0.6950723",
"0.6928618",
"0.6912717",
"0.69047856",
"0.683975",
"0.6828007",
"0.67924714",
"0.667985",
"0.6654125",
"0.6600955",
"0.6577739",
"0.6553427",
"0.6533301",
... | 0.78361577 | 0 |
Decrypt this guardian's share of one or more ballots | def decrypt_ballot_shares(
request: DecryptBallotSharesRequest = Body(...),
scheduler: Scheduler = Depends(get_scheduler),
) -> Any:
ballots = [
CiphertextAcceptedBallot.from_json_object(ballot)
for ballot in request.encrypted_ballots
]
context = CiphertextElectionContext.from_json_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pam_secret(self, key):\n\n\n privateKeyA=self.rand() \n privateKeyB=self.rand() \n publicKeyA = int(pow(genrated,privateKeyA,prime))\n publicKeyB = int(pow(genrated,privateKeyB,prime))\n\n resp = self.process(\n requests.get(f\"{self.api_url}/secretman/GetSecre... | [
"0.629344",
"0.5591807",
"0.5542672",
"0.54974806",
"0.54797286",
"0.54184014",
"0.540358",
"0.53940344",
"0.5366817",
"0.5345882",
"0.5340164",
"0.522527",
"0.51924723",
"0.5167279",
"0.51538104",
"0.5105933",
"0.5103906",
"0.5103906",
"0.5098788",
"0.50672245",
"0.5058073",... | 0.6520781 | 0 |
Check the value for limits according to topic. If out of limit, notify over telegram | def limitsExsess(topic, value):
if isNotifyTime(topic):
if "temperature" in topic:
val = float(value)
if val < MIN_TEMPERATURE or val > MAX_TEMPERATURE:
notifyTelegram("Temperature out of bounds: "+value+"degC")
return True
if "CO" in topic:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowedLimit(self, number, msg=None):\n return allowed_limit(number, msg)",
"async def max(self, ctx, limit: int):\n self.data_check(ctx)\n server = ctx.message.server\n\n self.riceCog2[server.id][\"max\"] = limit\n dataIO.save_json(self.warning_settings,\n ... | [
"0.6885966",
"0.6692245",
"0.66228366",
"0.6284632",
"0.627446",
"0.6245816",
"0.62092686",
"0.61613834",
"0.613513",
"0.609418",
"0.6056963",
"0.6042189",
"0.60258657",
"0.5984116",
"0.59698874",
"0.59312063",
"0.59092206",
"0.5906563",
"0.58542055",
"0.5850616",
"0.5809356"... | 0.78263 | 0 |
Convert the units of a bispectrum descriptor. Since these do not really have units this function does nothing yet. | def convert_units(array, in_units="None"):
if in_units == "None" or in_units is None:
return array
else:
raise Exception("Unsupported unit for bispectrum descriptors.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_units(self):\n for prod in (\"ier\", \"ier_inc_rain\"):\n self.data[prod].data[:] /= 1e6",
"def backconvert_units(array, out_units):\n if out_units == \"None\" or out_units is None:\n return array\n else:\n raise Exception(\"Unsupported unit for b... | [
"0.7362858",
"0.697799",
"0.68368673",
"0.6746229",
"0.67332226",
"0.6689847",
"0.6652228",
"0.6625354",
"0.6573514",
"0.6546448",
"0.65275437",
"0.64689595",
"0.6373749",
"0.63324165",
"0.6316742",
"0.6294838",
"0.6258834",
"0.62498343",
"0.6219283",
"0.62110245",
"0.6167998... | 0.7536837 | 0 |
Sum up all 1's in a list, and calculate the product sum Return the original list and the summed If the list only contains one 1, dont calculate the sum >>> sum_ones((1, 1, 2), 112) [(1, 1, 2), (2, 2)], [2, 4] >>> sum_ones((1, 2), 2) [(1, 2)], [2] >>> sum_ones((2, ), 2) [(2,)], [2] | def sum_ones(part, prod):
if part in sum_ones_memory:
partList, prodList = sum_ones_memory[part]
else:
n1 = part.count(1)
partList = [part]
prodList = [prod]
if n1 > 1:
npart = tuple(filter(lambda x: x != 1, part))
npart = (n1,) + npart
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_list(numbers):\n\t\n\tif len(numbers) == 0:\n\t\treturn 0 \n\n\tsum = numbers[0] +sum_list(numbers[1:])\n\treturn sum",
"def zero_sum(list):\n if not list:\n return 0\n else:\n return sum(list)",
"def mult_and_sum(*arg_list):\r\n result = numpy.empty(arg_list[0].shape, dtype=... | [
"0.595099",
"0.58707553",
"0.5846285",
"0.5818005",
"0.58091325",
"0.5784409",
"0.5705578",
"0.5697676",
"0.56917393",
"0.5681991",
"0.56177396",
"0.555534",
"0.5501804",
"0.5495922",
"0.546188",
"0.546188",
"0.5457171",
"0.5431213",
"0.5431213",
"0.54213077",
"0.53874594",
... | 0.7017122 | 0 |
Adds to the partition provided `number` in all its combinations | def add_number(partitions, number):
# Add to each list in partitions add 1
prods = partitions.values()
nKeys = [(1,) + x for x in partitions.keys()]
# apply sum_ones on each partition, and add results to partitions
# Done use reduce, the continues list creation is just too slow
#partitions = r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, number):\n\n for n in list(self.num):\n if n + number not in self.pair:\n self.pair.add(n + number)\n if number not in self.num:\n self.num.add(number)",
"def add(self, number):\n bisect.insort(self.arr, number)",
"def add(self, number):\n... | [
"0.6787744",
"0.6068892",
"0.57908505",
"0.5640544",
"0.5640544",
"0.56027186",
"0.5575665",
"0.5567512",
"0.5543029",
"0.55217093",
"0.5484204",
"0.5459124",
"0.54481226",
"0.54335606",
"0.5411571",
"0.54085",
"0.53956294",
"0.53827155",
"0.536468",
"0.5321466",
"0.5317977",... | 0.7305611 | 0 |
Generate all partitions for partitions number `value` | def partitions(value, show_progress=False):
p = {(1,): 1}
for num in range(2, value+1):
p = add_number(p, num)
if show_progress:
print(('%d' % num) + '.'*num)
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partitions(n):\n for a in range(2,n//2+1):\n yield a, n-a",
"def partitions(n, k):\n if k == 1:\n yield (n,)\n return\n for i in range(1, n):\n for p in partitions(n-i, k-1):\n yield (i,) + p",
"def fixed_size_partitioner(num_shards, axis=0):\n def _partitio... | [
"0.62917763",
"0.6152162",
"0.5948146",
"0.5925437",
"0.5881951",
"0.5843679",
"0.58393574",
"0.58084816",
"0.57997406",
"0.57366866",
"0.57020015",
"0.56715804",
"0.5613356",
"0.55816793",
"0.551945",
"0.5429442",
"0.54274815",
"0.54197305",
"0.54184514",
"0.5406913",
"0.540... | 0.7284648 | 0 |
flags are locally scoped and will only effect the supplied pattern, nothing more | def __init__(self, pattern, flags=0):
if flags:
str_flags = hre.decodeflags(flags)
pattern = r"(?%s:%s)"%(str_flags, pattern)
super(Regex, self).__init__(pattern) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, pattern):\r\n self.pattern = pattern",
"def add_regex_flag(vocab, pattern_str):\n flag_id = vocab.add_flag(re.compile(pattern_str).match)\n return flag_id",
"def flag():\n pass",
"def __init__(self, pattern):\n self._pattern = pattern.lower()",
"def __init__(self, ... | [
"0.61030114",
"0.60706294",
"0.60552096",
"0.59832364",
"0.5979558",
"0.5806734",
"0.5704767",
"0.56000733",
"0.55459285",
"0.55117047",
"0.54956514",
"0.5492899",
"0.54871315",
"0.5471751",
"0.54650545",
"0.54639566",
"0.54463387",
"0.54463387",
"0.5410023",
"0.53698367",
"0... | 0.6474127 | 0 |
Lookahead matching of the given parse expression. C{FollowedBy} does not advance the parsing position within the input string, it only verifies that the specified parse expression matches at the current position. C{FollowedBy} always returns a null token list. | def __init__(self, expr):
pattern = r"(?=%s)" % _silent_pattern(expr) # standard lookahead
super(FollowedBy, self).__init__(pattern, silent=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(self, input_reader):\n retval = []\n # skip the whitespace here to prevent errors at the end of the string\n if input_reader.getIgnoreState():\n input_reader.skipWhite()\n retval.append(self.__rule.match(input_reader))\n try:\n while True:\n ... | [
"0.57092345",
"0.51224923",
"0.50611615",
"0.5051354",
"0.5044692",
"0.50340766",
"0.5002219",
"0.49619815",
"0.49585378",
"0.4927308",
"0.4903575",
"0.49026915",
"0.48927513",
"0.4887522",
"0.48688808",
"0.485787",
"0.4854168",
"0.48492277",
"0.4842384",
"0.47809103",
"0.478... | 0.614381 | 0 |
matches beginning of a line (lines delimited by \n characters) | def __init__(self):
super(LineStart, self).__init__(r"^", regex.MULTILINE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def beginning_of_line():\n app = get_app()\n before_cursor = app.current_buffer.document.current_line_before_cursor\n\n return bool(\n len(before_cursor) == 0 and not app.current_buffer.document.on_first_line\n )",
"def test_single_match_returns_line(self):\n eq_(self.line,line_matches_... | [
"0.6724533",
"0.6564636",
"0.6491154",
"0.6476332",
"0.6458178",
"0.63772756",
"0.63512397",
"0.6270179",
"0.61780316",
"0.61767286",
"0.6069144",
"0.6049681",
"0.6032598",
"0.6013289",
"0.59645575",
"0.59616494",
"0.59479475",
"0.59277445",
"0.59225243",
"0.59197265",
"0.588... | 0.6926507 | 0 |
adds resultsname in place, no copy as with method | def setResultsNameInPlace(expr, name, listAllMatches=False):
expr.setResultsName(name)
return expr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_results(self, name):\n self.results[name] = copy.deepcopy(self.dict)\n return self.results[name]",
"def setResultsName(self, name, **kwargs):\n return self",
"def setResultsName(self, name, **kwargs):\n self.structure.set_name(name)\n return self",
"def add_to_resul... | [
"0.7488943",
"0.68073475",
"0.653575",
"0.6451395",
"0.63623095",
"0.63264364",
"0.628756",
"0.6123773",
"0.60992354",
"0.60139364",
"0.5929875",
"0.59268665",
"0.5869892",
"0.5869892",
"0.5866788",
"0.58469075",
"0.578019",
"0.57685715",
"0.5736709",
"0.57096404",
"0.5701012... | 0.71201277 | 1 |
Function to calculate sharpe ratio | def sharpe_ratio(r1, r2, rf, o1, o2, cov):
def sr(x):
w1 = x[0]
w2 = 1 - w1
Rp = w1 * r1 + w2 * r2
STDEVp = math.sqrt(portfolio_variance(o1, o2, cov)(x))
R = (Rp - rf) / STDEVp
return R
return sr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sharpe_ratio(allocs, prices):\n\tport_val = get_portfolio_value(prices, allocs, start_val=1.0)\n\tsharpe_ratio = get_portfolio_stats(port_val, daily_rf=0.0, samples_per_year=252)[3]\n\treturn -sharpe_ratio",
"def sharpe_ratio(self, r_f):\n return (\n self.cumulative_returns().last('1D')... | [
"0.71775174",
"0.6924688",
"0.6842624",
"0.65903723",
"0.64614457",
"0.63057446",
"0.621388",
"0.6211801",
"0.62085533",
"0.6188876",
"0.61764693",
"0.6168705",
"0.61206347",
"0.59352535",
"0.58917314",
"0.5888528",
"0.5863196",
"0.5852122",
"0.580885",
"0.5797968",
"0.579179... | 0.6978456 | 1 |
An ugly solution that works and runs in O(len(S)+len(W)max(len(W[i])) in time and space | def ugly_solution(self, S: str, words: List[str]) -> int:
count = 0
k, v = [], []
for key, value in groupby(S):
k.append(key)
v.append(list(value))
kk, vv = [], []
for word in words:
kkk, vvv = [], []
for key, value in groupby(word):
kkk.append(key)
vvv.append... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(s):",
"def better_solution(self, S: str, words: List[str]) -> int:\n def encode(S):\n return zip(*[(k, len(list(v))) for k, v in groupby(S)])\n\n k, v = encode(S)\n count = 0\n for word in words:\n kk, vv = encode(word)\n if k != kk:\n continue\n count += int(a... | [
"0.66980284",
"0.6310912",
"0.5983516",
"0.5870128",
"0.5866691",
"0.5809376",
"0.5785435",
"0.5728468",
"0.5718472",
"0.5660262",
"0.5630392",
"0.56271183",
"0.56244045",
"0.56228566",
"0.5622619",
"0.56053615",
"0.5599059",
"0.5550877",
"0.5534361",
"0.55255306",
"0.552341"... | 0.63939565 | 1 |
start_sleep_time time for wich all backoff process always will be sleep border_sleep_time maximum time wich procces will be wait, if service will not answer factor factor to multiply wait time jitter if True, proccess will be sleep random time between start_sleep_time and start_sleep_time factor | def backoff(start_sleep_time=0.1, border_sleep_time=30, factor=2, jitter=True):
if start_sleep_time < 0.001:
logger.warning('start_sleep_time fewer than 0.001 and will be set to 0.001')
start_sleep_time = 0.001
def decorator(target):
@wraps(target)
def retry(*args, **kwargs):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backoff_time(attempt, retry_backoff=2., max_delay=30.):\n delay = retry_backoff * (2 ** attempt)\n # Add +-25% of variation.\n delay += delay * ((random.random() - 0.5) / 2.)\n return min(delay, max_delay)",
"def determine_sleep_times(self):\n\n determined_sleep_time = \\\n random.randr... | [
"0.6575967",
"0.64338106",
"0.6302687",
"0.6217478",
"0.6202927",
"0.6117126",
"0.6097843",
"0.6096164",
"0.60948235",
"0.60805535",
"0.6042051",
"0.6040414",
"0.6029319",
"0.5992592",
"0.598864",
"0.5986761",
"0.59843516",
"0.5946478",
"0.5908621",
"0.5894738",
"0.5891776",
... | 0.7326327 | 0 |
Returns frequency of the token | def _frequency_of(self, token):
frequency_value_of_word = self._word_2_frequency.get(token)
if not frequency_value_of_word:
return 0
return frequency_value_of_word | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def freq(self) -> int:",
"def freq():",
"def frequency(self, word):\n if word in self:\n return self[word].tokens\n return 0",
"def computeWordsFrequencies(self):\n token_stream = self._tokenize(self.readable)\n token_map = self._countTokens(token_stream)\n # pri... | [
"0.8070311",
"0.78679377",
"0.76784575",
"0.74142516",
"0.7385732",
"0.7375787",
"0.735579",
"0.7177395",
"0.7167934",
"0.7024137",
"0.70036995",
"0.69915587",
"0.69732666",
"0.6970479",
"0.69324076",
"0.69139016",
"0.6905725",
"0.6893925",
"0.6890974",
"0.68878806",
"0.68825... | 0.8163045 | 0 |
Tokenizes the utterance and corrects each token | def correct(self, utterance):
tokens = self._tokenizer(utterance.lower())
corrected_tokens = [self._correct_token(token) for token in tokens]
return self._retokenizer(corrected_tokens) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_tokens_and_lemmetize(self, tweet_tokens: list) -> list:\n\n cleaned_tokens = []\n\n pos_dict = {'V': 'v', 'N': 'n'}\n for token, tag in pos_tag(tweet_tokens):\n token = re.sub('(https?:\\/\\/(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]\\\n +[a-zA-Z0-9]\\.[^\\s]... | [
"0.64839673",
"0.64127326",
"0.63831973",
"0.63160646",
"0.62622374",
"0.62543154",
"0.6233098",
"0.6205803",
"0.62020516",
"0.6178733",
"0.61561644",
"0.61272216",
"0.6113682",
"0.61115193",
"0.61115193",
"0.6100868",
"0.6097759",
"0.6081727",
"0.6078775",
"0.60780025",
"0.6... | 0.7098633 | 0 |
Returns the one edit distances of the token | def _one_edit_token_distances(token):
splitted_token_pairs = [(token[:i], token[i:]) for i in range(len(token) + 1)]
deleted_distances = (
left_split + right_split[1:] for left_split, right_split in splitted_token_pairs if right_split)
inserted_variations = (
left_split +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _two_edits_token_distances(token):\n return (\n two_edits_distance_of_word for one_edit_distance_of_word in NorvigCorrector._one_edit_token_distances(\n token) for two_edits_distance_of_word in NorvigCorrector._one_edit_token_distances(\n one_edit_distance_of... | [
"0.7460531",
"0.6638046",
"0.66191673",
"0.6553232",
"0.6533313",
"0.6435335",
"0.6410075",
"0.63724303",
"0.6183879",
"0.6125283",
"0.6087842",
"0.5997161",
"0.59966505",
"0.5862038",
"0.5844792",
"0.58082",
"0.5770743",
"0.56975096",
"0.5694219",
"0.56764853",
"0.5661425",
... | 0.74810326 | 0 |
Returns the two edit distances of the token | def _two_edits_token_distances(token):
return (
two_edits_distance_of_word for one_edit_distance_of_word in NorvigCorrector._one_edit_token_distances(
token) for two_edits_distance_of_word in NorvigCorrector._one_edit_token_distances(
one_edit_distance_of_word)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _one_edit_token_distances(token):\n splitted_token_pairs = [(token[:i], token[i:]) for i in range(len(token) + 1)]\n deleted_distances = (\n left_split + right_split[1:] for left_split, right_split in splitted_token_pairs if right_split)\n inserted_variations = (\n le... | [
"0.73686165",
"0.7345276",
"0.73087025",
"0.72469914",
"0.6769684",
"0.675673",
"0.6731244",
"0.67224896",
"0.6405587",
"0.62889516",
"0.6235302",
"0.6150123",
"0.6112475",
"0.60474837",
"0.60397756",
"0.60285234",
"0.6020914",
"0.5996137",
"0.59572864",
"0.59506327",
"0.5943... | 0.7739078 | 0 |
Creates the deleted variation to dictionary words | def _create_deleted_variation_2_dictionary_words(self):
deleted_variation_2_dictionary_words = defaultdict(set)
for word in self._word_2_frequency.keys():
deleted_variations = chain(self._one_edit_deleted_variations(word), self._two_edits_deleted_variations(word))
for deleted_var... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def constitute_word_dict(self):\r\n\r\n #IS THIS NECESSARY WITH DATABASE??\r\n\r\n if self.using_shelf:\r\n for k_temp in self.get_words():\r\n self.delete_word(k_temp)\r\n\r\n for i_temp in [a_temp for a_temp in self.indexes()\r\n if Index(a_tem... | [
"0.6810291",
"0.6484141",
"0.6279463",
"0.61285645",
"0.60841674",
"0.60628283",
"0.60328877",
"0.60259354",
"0.6014623",
"0.599867",
"0.5962856",
"0.5923651",
"0.5922238",
"0.5905566",
"0.5870536",
"0.58691525",
"0.5840234",
"0.5830632",
"0.58221495",
"0.5821239",
"0.5805232... | 0.8154589 | 0 |
Returns the one edit deleted variations of the token | def _one_edit_deleted_variations(token):
splitted_token_pairs = [(token[:i], token[i:]) for i in range(len(token) + 1)]
return (left_split + right_split[1:] for left_split, right_split in splitted_token_pairs if right_split) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _two_edits_deleted_variations(token):\n return (\n two_edits_distance_of_word for one_edit_distance_of_word in\n SymmetricDeleteCorrector._one_edit_deleted_variations(token) for two_edits_distance_of_word in\n SymmetricDeleteCorrector._one_edit_deleted_variations(one_edi... | [
"0.75817436",
"0.614762",
"0.60068387",
"0.5992109",
"0.5739046",
"0.5739046",
"0.5627935",
"0.55786633",
"0.5472322",
"0.54617894",
"0.52510107",
"0.52435124",
"0.5187034",
"0.5068616",
"0.5025506",
"0.5009688",
"0.50048673",
"0.4995821",
"0.49677786",
"0.4938722",
"0.492104... | 0.7687418 | 0 |
Returns the two edit deleted variations of the token | def _two_edits_deleted_variations(token):
return (
two_edits_distance_of_word for one_edit_distance_of_word in
SymmetricDeleteCorrector._one_edit_deleted_variations(token) for two_edits_distance_of_word in
SymmetricDeleteCorrector._one_edit_deleted_variations(one_edit_distanc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _one_edit_deleted_variations(token):\n splitted_token_pairs = [(token[:i], token[i:]) for i in range(len(token) + 1)]\n return (left_split + right_split[1:] for left_split, right_split in splitted_token_pairs if right_split)",
"def _two_edits_token_distances(token):\n return (\n ... | [
"0.7830289",
"0.6501761",
"0.6358295",
"0.61561555",
"0.60037905",
"0.5835675",
"0.5647721",
"0.5647721",
"0.5622455",
"0.5511201",
"0.5399774",
"0.5336072",
"0.5334806",
"0.5281815",
"0.5241469",
"0.5086132",
"0.50707567",
"0.5040011",
"0.5039645",
"0.502873",
"0.50018567",
... | 0.79751015 | 0 |
creates random name using prefix and podstfix list | def name_generator():
prefix_list = [
"admiring", "adoring", "affectionate", "agitated", "amazing", "angry",
"awesome", "beautiful", "blissful", "bold", "boring", "brave", "busy",
"charming", "clever", "cool", "compassionate", "competent",
"confident", "crazy", "dazzling", "determine... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_name(prefix='test'):\n rndbytes = os.urandom(8)\n md5 = hashlib.md5()\n md5.update(rndbytes)\n return '{}_{}'.format(prefix, md5.hexdigest()[:7])",
"def generate_name(prefix):\n suffix = generate_uuid()[:8]\n return '{0}_{1}'.format(prefix, suffix)",
"def fixture_make_unique_name()... | [
"0.7150694",
"0.6983631",
"0.66490257",
"0.65892994",
"0.6525399",
"0.6470662",
"0.64642584",
"0.63855755",
"0.6346495",
"0.6342627",
"0.6325903",
"0.6323696",
"0.6320582",
"0.6301048",
"0.62752664",
"0.6265931",
"0.6225501",
"0.62056917",
"0.61992645",
"0.6192563",
"0.618883... | 0.70794344 | 1 |
this returns a density dependent population process of an SIR model | def sir_model():
ddpp = rmf.DDPP()
ddpp.add_transition([-1,1,0],lambda x:x[0]+2*x[0]*x[1])
ddpp.add_transition([0,-1,+1],lambda x:x[1])
ddpp.add_transition([1,0,-1],lambda x:3*x[2]**3)
ddpp.set_initial_state([.3,.2,.5]) # We first need to define an initial stater
return ddpp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def d_SIR(u,parametres):\r\n S = u[0]\r\n I = u[2]\r\n N = parametres[0]\r\n demo = parametres[1]\r\n beta = parametres[2]\r\n gamma = parametres[3]\r\n return np.array([[-beta*I/N,0,-beta*S/N,0,0],[0,0,0,0,0],[beta*I/N,0,beta*S/N-gamma,0,0],[0,0,gamma,0,0],[0,0,0,0,0]])",
"def density(temp,... | [
"0.594957",
"0.5948744",
"0.57866687",
"0.5670235",
"0.55575085",
"0.5497227",
"0.5432012",
"0.5432012",
"0.54252124",
"0.5406989",
"0.53866404",
"0.53780395",
"0.53753906",
"0.53392345",
"0.532365",
"0.53202826",
"0.53138345",
"0.53130454",
"0.53034365",
"0.5302921",
"0.5301... | 0.59713703 | 0 |
Takes two sequences of data and return the sum of the absolute differences between all | def absolute_difference(new_data, old_data):
diff = 0
assert len(new_data) == len(old_data)
for new, old in zip(new_data, old_data):
diff += np.sum(np.abs(new-old))
return diff | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute_difference(x1: np.ndarray, x2: np.ndarray) -> float:\n assert isinstance(x1, np.ndarray) and isinstance(x2, np.ndarray)\n return np.absolute(x1 - x2).sum()",
"def minusRes(res1, res2):\n return [(x - y) for x, y in zip(res1, res2)]",
"def calcSum2(data1, data2): \n \n data11 = data1... | [
"0.7245496",
"0.65538746",
"0.6548169",
"0.6521336",
"0.6393904",
"0.6391251",
"0.6290411",
"0.62849253",
"0.6262603",
"0.61964387",
"0.61614966",
"0.6133634",
"0.61204493",
"0.6114484",
"0.60988724",
"0.6095925",
"0.60876584",
"0.60465556",
"0.6027689",
"0.6021893",
"0.60155... | 0.7623687 | 0 |
get node data from a json file | def getNodeData(self, file):
with open('./data/{}.json'.format(file), 'r') as json_file:
try:
objs = []
data = json_file.read()
dic = json.loads(data)['data']
for i in dic:
objs.append(Entity(i['id'], i['name']))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(node):\n return node['data']",
"def get_json_data(json_file):\n logging.log(logging.DEBUG, \"Extracting JSON file %s\" % json_file)\n with open(json_file, \"r\") as json_d:\n d = json.load(json_d)\n return d",
"def getEdgeData(self, file):\n\n with open('./data/{}.json'.f... | [
"0.68290836",
"0.6781301",
"0.6769785",
"0.66034156",
"0.6499282",
"0.64148074",
"0.6403095",
"0.63928735",
"0.6382607",
"0.63717014",
"0.63713247",
"0.6370972",
"0.6365524",
"0.6348017",
"0.63064176",
"0.62792647",
"0.6270903",
"0.62460166",
"0.62435853",
"0.62405324",
"0.62... | 0.74540293 | 0 |
get edge data from a json file | def getEdgeData(self, file):
with open('./data/{}.json'.format(file), 'r') as json_file:
try:
data = json_file.read()
return json.loads(data)['data']
except Exception as e:
print(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_json1():\n s = JsonSource()\n g = s.parse(os.path.join(RESOURCE_DIR, 'valid.json'))\n nodes = {}\n edges = {}\n for rec in g:\n if rec:\n if len(rec) == 4:\n edges[(rec[0], rec[1])] = rec[3]\n else:\n nodes[rec[0]] = rec[1]\n\n... | [
"0.6612572",
"0.64917535",
"0.6468805",
"0.64079446",
"0.6126041",
"0.6125289",
"0.611786",
"0.6089167",
"0.60870355",
"0.6072723",
"0.60507375",
"0.60412115",
"0.6011671",
"0.59364545",
"0.5920987",
"0.5885477",
"0.587848",
"0.5866589",
"0.5837983",
"0.58012176",
"0.5772618"... | 0.8260459 | 0 |
get config values from config.json | def getConfig(self, config):
with open('./config.json', 'r') as json_file:
try:
data = json_file.read()
return json.loads(data)[config]
except Exception as e:
print(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config():\n handle = open(\"config.json\", \"r\")\n raw_json = handle.read()\n handle.close()\n return json.loads(raw_json)",
"def get_config():\n\n return json.loads(CONFIG_FILE.read_text())",
"def config():\n with open(config_path) as config_file:\n data = json.load(config_fi... | [
"0.7822822",
"0.77645606",
"0.7666279",
"0.76599467",
"0.7431984",
"0.7382189",
"0.71417624",
"0.71175736",
"0.710821",
"0.70374674",
"0.70326966",
"0.69988185",
"0.6972378",
"0.6971484",
"0.69543666",
"0.69187796",
"0.69164115",
"0.6905965",
"0.68725795",
"0.68205625",
"0.68... | 0.78410286 | 0 |
Check if the current user is registered in the group. Also useful to perform checks to make sure that the current file was last saved by the current user | def is_registered(self):
if self.user == getpass.getuser():
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def es_utilizado(self):\n group = Group.objects.filter(id=self.id)\n group = group.all()[0] if group.exists() else None\n # group = Group.objects.get(name=self.nombre)\n return group.user_set.all().exists() if group is not None else False",
"def uploaded_by_group(self) -> bool:\n ... | [
"0.690413",
"0.67884076",
"0.6780551",
"0.6506758",
"0.6494973",
"0.6420326",
"0.6378534",
"0.6368675",
"0.6305088",
"0.6275783",
"0.6195581",
"0.61794806",
"0.61671656",
"0.6150682",
"0.61350936",
"0.61300755",
"0.61207616",
"0.60981613",
"0.60970503",
"0.6087024",
"0.608025... | 0.71394736 | 0 |
Set method for locking or unlocking a specified file over the network Setting the locked method to true will generate a locked file version Setting the locked method to false will delete the locked file version | def locked(self, status):
self._locked = status # regardless of network condition, set the state
# test for locked file types and set/delete data if necessary
if status == True and not os.path.isfile(self._lockedFile):
lockedInfoDict = self.get_contact_info()
with open... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file(self, file_h):\n if os.path.exists(file_h):\n self._file = file_h\n self._lockedFile = self._file + consts.LOCKED_NOTIFIER\n self.locked = self.is_locked\n else:\n self._file = None\n self._lockedFile = None",
"def is_locked(self):\n ... | [
"0.6429591",
"0.62945414",
"0.62620234",
"0.6154761",
"0.61190027",
"0.60099566",
"0.5973717",
"0.58742625",
"0.58742625",
"0.58257365",
"0.5809529",
"0.57795733",
"0.57549113",
"0.57517904",
"0.5742705",
"0.5740216",
"0.57396597",
"0.57032406",
"0.5677568",
"0.5675368",
"0.5... | 0.6693105 | 0 |
Reads the contact information on the locked file being queried | def read_contact_info(self):
if not os.path.isfile(self._lockedFile):
LOGGER.error(['AIE7601', 'match_false'], {'file': self._file})
return None
with open(self._lockedFile) as f:
contactInfo = f.read()
contactInfo = json.loads(contactInfo)
LOGGER.deb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simple_contacts(filename):\n\n try:\n file_path = open(filename, 'r', encoding='utf-8')\n\n except FileNotFoundError:\n pretty_print(\"Cannot open contacts.txt\", \":\")\n sleep(3)\n\n else:\n with file_path:\n print_list = []\n email_dict = {}\n ... | [
"0.6030336",
"0.58627254",
"0.5794467",
"0.571189",
"0.5666441",
"0.55783695",
"0.55464315",
"0.5537097",
"0.54523414",
"0.54176277",
"0.5404614",
"0.53873605",
"0.5383962",
"0.5369375",
"0.5341976",
"0.5339391",
"0.52636397",
"0.5230393",
"0.5212816",
"0.51953137",
"0.519079... | 0.7421391 | 0 |
Generates contact information from the current user. Used to insert information about the current session to a locked file | def get_contact_info(self):
outputDict = {"USERNAME": consts.USERNAME,
"IP": consts.IPADDRESS,
"MACHINE": consts.HOSTNAME,
"EMAIL": 'ckenne24@student.scad.edu',
"PHONE": '203-722-6620'} # ::: TO DO::: dynamically get pho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_contact(self, update, context):\n user = update.effective_user\n chat_id = update.effective_chat.id\n phone = update.message.contact.phone_number\n log.info(\n \"TEL from %s, %s, @%s, %s\", user.username, user.full_name, chat_id, phone,\n )\n\n # Here's a... | [
"0.6068317",
"0.59416777",
"0.5837409",
"0.578141",
"0.5709636",
"0.569902",
"0.56854504",
"0.56514823",
"0.563346",
"0.5628087",
"0.5613098",
"0.5603869",
"0.55927914",
"0.55591536",
"0.55484784",
"0.55438",
"0.55161154",
"0.5503551",
"0.5472641",
"0.5457811",
"0.5456469",
... | 0.63363904 | 0 |
initialize simulation for n receivers. | def init_sim(self,n):
self.beacon = beacon(ENABLE_BEACON_DELAY)
self.data = data_utils(n)
random.seed()
if n < 3:
print 'Number of receivers %i is less than three.' %n
print 'Simulation controller will not run.'
print 'Now exiting.'
sys.ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialise_sim(self):\n pass",
"def initialize_simulation(self) -> Simulation:\n pass",
"def initialize(self,t0=0.0):\n \n # An connection_distribution_list (store unique connection(defined by weight,syn,prob))\n self.connection_distribution_collection = ConnectionDistrib... | [
"0.69506",
"0.64275706",
"0.63273084",
"0.62234366",
"0.6148517",
"0.61418355",
"0.6120078",
"0.61150783",
"0.6010363",
"0.5956427",
"0.5942656",
"0.58964765",
"0.5848229",
"0.5831818",
"0.5811069",
"0.5795932",
"0.5783453",
"0.57297236",
"0.5719643",
"0.5719192",
"0.5715589"... | 0.7817745 | 0 |
Create a verilator based simulation model for specified unit and load it to Python | def toVerilatorSimModel(unit: Unit,
unique_name: str,
build_dir: Optional[str],
target_platform=DummyPlatform(),
do_compile=True):
if build_dir is None:
build_dir = "tmp/%s" % unique_name
# with tempdir(suff... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simple_creation():\n # Get model file\n create.main(\"mlp\", \"10:12:8\", \"model_test.tar\")",
"def cli_simulate(model_file, output_dir, exporter, overwrite, compression,\n confirm, progress: int, progress_tag, output_same,\n simtime_total, simtime_lims, max_sweeps... | [
"0.65765846",
"0.65580773",
"0.6550769",
"0.6546276",
"0.6504218",
"0.6469117",
"0.63433236",
"0.627054",
"0.62532395",
"0.6251698",
"0.6249102",
"0.6248536",
"0.62141037",
"0.61618936",
"0.6083821",
"0.60495144",
"0.6038472",
"0.60380536",
"0.5984989",
"0.5971478",
"0.596941... | 0.6919998 | 0 |
Loads the query molecule from SMILES, molblock or InChI. | def load_query(self, query_string: str) -> np.ndarray:
rdmol = load_molecule(query_string)
fp = build_fp(rdmol, self.fp_type, self.fp_params, 0)
return np.array(fp, dtype=np.uint64) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_molecule(self):\n self.pymol = pybel.readstring(self.input_format, self.file_dic['input'])",
"def _set_molecule_from_smiles(self, mol_smiles):\n try:\n self.mol_graph = Chem.MolFromSmiles(mol_smiles)\n except Exception:\n raise LoadingError(f'{mol_smiles} coul... | [
"0.6670654",
"0.6001101",
"0.5710529",
"0.56766015",
"0.56631404",
"0.5651736",
"0.56413436",
"0.5599945",
"0.5409557",
"0.5342238",
"0.5283499",
"0.5217227",
"0.51927537",
"0.5192512",
"0.51640475",
"0.51393247",
"0.5125168",
"0.5119117",
"0.51116127",
"0.5100645",
"0.504425... | 0.61572385 | 1 |
Append observer in waiters and send message for get starting data | async def attach(self, observer, data_id):
# init table for waiters if need
self.waiters_first_msg.setdefault(data_id, [])
# if user want get information, that user already wait (in subscribers), send error
if observer in self.waiters_first_msg[data_id]:
asyncio.get_event_lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe(observer):",
"def subscribe(observer):",
"def notifyObservers(self):",
"def start(self):\n self.observer.start()",
"def notify(self):\n for observer in self.observers:\n observer(self.obj)",
"def __init__(self, observer):\r\n self.AllData = []\r\n self... | [
"0.6195174",
"0.6195174",
"0.6134825",
"0.59606004",
"0.5884273",
"0.5874226",
"0.5856661",
"0.58515745",
"0.5820923",
"0.5779754",
"0.57091755",
"0.57087344",
"0.5685442",
"0.5676267",
"0.5667569",
"0.56597275",
"0.562525",
"0.56158704",
"0.5600424",
"0.55934954",
"0.5593495... | 0.6811588 | 0 |
Send message to microservice for get starting data | async def _send_message_for_get_starting_data(self, data_id):
body = json.dumps(
dict(
action='get_starting',
data_id=data_id
)
).encode('utf-8')
await self._send_message_in_queue(self.queue_crypto_quotes_service, body) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\n return self.params.send_params()",
"def start( self ):\n\n self.service()",
"def onstart(self, sender, **kwargs):\n #Example publish to pubsub\n #self.vip.pubsub.publish('pubsub', \"some/random/topic\", message=\"HI!\")\n\n #Exmaple RPC call\n #self.... | [
"0.6436687",
"0.6173941",
"0.5911074",
"0.5895981",
"0.5873411",
"0.5822935",
"0.5810223",
"0.5786783",
"0.5746238",
"0.57382137",
"0.5737131",
"0.5708002",
"0.5708002",
"0.5697802",
"0.56788045",
"0.56786233",
"0.56777674",
"0.56777674",
"0.56653273",
"0.5652313",
"0.5651069... | 0.65215296 | 0 |
Method to send an http post request to google analytics with the specified events. | def send(self, events, validation_hit=False, postpone=False, date=None):
# check for any missing or invalid parameters among automatically collected and recommended event types
self._check_params(events)
self._check_date_not_in_future(date)
if postpone is True:
# build even... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload(self, events):\n if len(events) == 0:\n return\n\n headers = {'Content-Type': 'application/json'}\n if self.config.access_key is not None:\n headers['x-analytics-key'] = self.config.access_key\n\n return requests.post(\n self.config.ingest_url... | [
"0.6711665",
"0.62720424",
"0.62670887",
"0.61956185",
"0.6026201",
"0.5925697",
"0.58145595",
"0.57575643",
"0.57574177",
"0.5739429",
"0.5726341",
"0.56397337",
"0.5555134",
"0.5510911",
"0.5506685",
"0.5491807",
"0.5491508",
"0.5475669",
"0.5462015",
"0.5427705",
"0.537889... | 0.6399683 | 1 |
Method to send the events provided to Ga4mp.send(events,postpone=True) | def postponed_send(self):
for event in self._event_list:
self._http_post([event], postpone=True)
# clear event_list for future use
self._event_list = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(self, events):\n if not self._last_connection and self.max_connect_time:\n self._last_connection = time.time()\n log.debug(\"Sending %i messages\", len(events))\n start = time.time()\n skipped = 0\n sent = 0\n for e in events:\n routing_key ... | [
"0.66752946",
"0.6622529",
"0.6494706",
"0.6443658",
"0.6292387",
"0.625667",
"0.621399",
"0.6105599",
"0.60990536",
"0.6045782",
"0.5952999",
"0.5915013",
"0.58958846",
"0.5810091",
"0.5784288",
"0.57736",
"0.5758093",
"0.57533085",
"0.57154965",
"0.57087296",
"0.5696536",
... | 0.6935207 | 0 |
Method to append event name and parameters keyvalue pair to parameters dictionary. | def append_event_to_params_dict(self, new_name_and_parameters):
params_dict.update(new_name_and_parameters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_parameter():\n parameter_info = {}\n argget = utils.create_common_parameter_list(example_string='''\nExample:\n \"python add_event_subscriptions.py -i 10.10.10.10 -u USERID -p PASSW0RD --destination https://10.10.10.11 --eventtypes Alert --context test\"\n''')\n add_helpmessage(argget)\n args ... | [
"0.68617225",
"0.62716216",
"0.6232052",
"0.6038",
"0.60304385",
"0.5938188",
"0.59378177",
"0.5865848",
"0.5854884",
"0.58266795",
"0.5789419",
"0.5729528",
"0.5708161",
"0.5707308",
"0.56872445",
"0.56527895",
"0.562703",
"0.56114787",
"0.558981",
"0.5583605",
"0.5574064",
... | 0.86380863 | 0 |
Method to check whether the event payload parameters provided meets supported parameters. | def _check_params(self, events):
# check to make sure it's a list of dictionaries with the right keys
assert type(events) == list, "events should be a list"
for event in events:
assert type(event) == dict, "each event should be a dictionary"
assert "name" in event, '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _CheckUnknownParameters(event_type, known_params, given_params):\n unknown_parameters = (\n set(given_params) -\n set(known_params))\n if unknown_parameters:\n raise exceptions.UnknownEventTypeParameters(\n unknown_parameters, event_type)",
"def _check_parameters_support(self, parameter... | [
"0.67511195",
"0.66740525",
"0.6658935",
"0.66236603",
"0.6601524",
"0.6599001",
"0.65948415",
"0.654032",
"0.64032465",
"0.6403099",
"0.63868374",
"0.6351361",
"0.6346865",
"0.6340865",
"0.6333561",
"0.63206863",
"0.62974364",
"0.62974364",
"0.6297307",
"0.624125",
"0.623159... | 0.70182455 | 0 |
Method is a helper function to add user properties to outgoing hits. | def _add_user_props_to_hit(self, hit):
for key in self._user_properties:
try:
if key in ["user_id", "non_personalized_ads"]:
hit.update({key: self._user_properties[key]})
else:
if "user_properties" not in hit.keys():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user_property(self, property, value):\n self._user_properties.update({property: value})",
"def _collect_properties(self):\n properties = {\n 'userid': self.user_id,\n 'title': self.get_fullname()\n }\n if not self.ogds_user:\n return properties... | [
"0.54060847",
"0.53914547",
"0.5311348",
"0.5277481",
"0.52685785",
"0.51766896",
"0.51704776",
"0.51350677",
"0.51231086",
"0.5059008",
"0.50121903",
"0.49840477",
"0.49707344",
"0.48758975",
"0.48634145",
"0.47971946",
"0.47815537",
"0.47756538",
"0.47756028",
"0.47628966",
... | 0.8418524 | 0 |
Private method to convert a datetime object into a timestamp | def _datetime_to_timestamp(self, dt):
return time.mktime(dt.timetuple()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datetime_to_timestamp(obj: \"datetime\") -> \"Timestamp\":\n td = datetime_to_epoch_timedelta(obj)\n ts = Timestamp()\n ts.seconds = td.seconds + td.days * _SECONDS_PER_DAY\n ts.nanos = td.microseconds * _NANOS_PER_MICROSECOND\n return ts",
"def to_stamp(datetime_):\r\n try:\r\n retu... | [
"0.72915614",
"0.7261263",
"0.7230859",
"0.72280365",
"0.72121686",
"0.7209182",
"0.7165147",
"0.7133808",
"0.7081074",
"0.70417845",
"0.70254016",
"0.701384",
"0.6949144",
"0.69176286",
"0.68709433",
"0.6847967",
"0.6819334",
"0.680639",
"0.68053293",
"0.67908376",
"0.672243... | 0.7956671 | 0 |
Method to check that provided date is not in the future. | def _check_date_not_in_future(self, date):
if date is None:
pass
else:
assert (
date <= datetime.datetime.now()
), "Provided date cannot be in the future" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_in_past(date: dt.datetime) -> bool:\n return date < dt.datetime.now()",
"def date_in_future(date) -> bool:\n is_in_the_future = time_after(date)\n return is_in_the_future",
"def check_past_date(self, date: datetime) -> bool:\n try:\n date += timedelta(minutes=10)\n ... | [
"0.7830144",
"0.78268987",
"0.7666937",
"0.7171819",
"0.7074505",
"0.70292217",
"0.6953728",
"0.6893718",
"0.6834612",
"0.68208104",
"0.6793942",
"0.67898786",
"0.675023",
"0.668981",
"0.6677652",
"0.6641531",
"0.66341525",
"0.66302",
"0.6622533",
"0.66169786",
"0.65040976",
... | 0.8926335 | 0 |
Tests whether ``put_afk_timeout_into`` is working as intended. | def test__put_afk_timeout_into():
for input_value, defaults, expected_output in (
(AFK_TIMEOUT_DEFAULT, False, {'afk_timeout': AFK_TIMEOUT_DEFAULT}),
(60, False, {'afk_timeout': 60}),
):
data = put_afk_timeout_into(input_value, {}, defaults)
vampytest.assert_eq(data, expected_out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_timeout(self) -> None:",
"def has_set_timeout(self) -> bool:\n return False",
"def is_timeout(self) -> bool:\n return self.runtime.timeout <= 0.0",
"def test_timeout_processing(self):\n # setup\n self.transaction_behaviour.processing_time = None\n\n # operation\n... | [
"0.68487453",
"0.6385761",
"0.61897486",
"0.6164593",
"0.61386365",
"0.61113673",
"0.6101769",
"0.6094305",
"0.60300237",
"0.60300094",
"0.5981271",
"0.5962097",
"0.5956315",
"0.59308213",
"0.59132403",
"0.58779216",
"0.5873864",
"0.583141",
"0.582798",
"0.58113694",
"0.57715... | 0.8338849 | 0 |
Add user and profile to context. | def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['user'] = self.request.user
context['profile'] = self.request.user.profile
return context | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile(request):\n auth, created = AuthProfile.objects.get_or_create(user=request.user)\n if not request.user.is_authenticated():\n raise Exception(\"Not Logged in\")\n\n token, created = Token.objects.get_or_create(user=request.user)\n context = {}\n context['TOKEN'] = token.key\n\n ... | [
"0.6517379",
"0.6254326",
"0.6094922",
"0.60652465",
"0.6037776",
"0.6030282",
"0.59925145",
"0.59905326",
"0.5950769",
"0.5945794",
"0.5915224",
"0.5913894",
"0.58779365",
"0.58496886",
"0.58473426",
"0.58443123",
"0.57948256",
"0.5792512",
"0.5786131",
"0.57842964",
"0.5783... | 0.74891156 | 0 |
Updates the node bounding box | def update_bbox(self):
centX, centY = self.center
brush_thickness = self.brush[0]
margin = self.__size + brush_thickness + BOUNDARY_MARGIN
self.bbox = [int(centX - margin), int(centY - margin),
int(centX + margin), int(centY + margin)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bbox(self, node):\n node_id = node.get('id')\n #inkex.utils.debug(\"Check if \" + str(node_id) + \" is in \" + str(self.node_info))\n info = self.node_info[node_id] \n \n x = info.x\n y = info.y\n width = info.width\n height = info.height\n\n ... | [
"0.687665",
"0.65105706",
"0.6498005",
"0.6465831",
"0.641638",
"0.6379551",
"0.63483",
"0.63036704",
"0.6291714",
"0.6290422",
"0.6238107",
"0.6209221",
"0.6204145",
"0.61941063",
"0.6172504",
"0.61315244",
"0.61048",
"0.60585755",
"0.6051173",
"0.60298294",
"0.60298294",
... | 0.6619484 | 1 |
Updates the node center | def update_center(self):
self.grfx[0].center = self.center
self.update_bbox() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_node_centers(self):\n # Node positions\n self.node_centers = []\n\n if self.n_states == 2:\n self.figsize = (10, 4)\n self.xlim = (-5, 5)\n self.ylim = (-2, 2)\n self.node_centers = [[-4,0], [4,0]]\n elif self.n_states == 3:\n ... | [
"0.70560575",
"0.6983045",
"0.6964067",
"0.69160515",
"0.68689096",
"0.6836963",
"0.67228144",
"0.6679501",
"0.65991706",
"0.6593941",
"0.6592841",
"0.65812576",
"0.657037",
"0.65615946",
"0.6547778",
"0.6541835",
"0.6539385",
"0.6529367",
"0.652537",
"0.65042",
"0.64802927",... | 0.78363216 | 0 |
Updates the connector color set (outline and filling colors for all different modes) | def update_color(self):
colorset = self.colorset
self.grfx[0].colorset = colorset
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_color(self):\n self.plot(update_traces=False, update_waveforms=True)",
"def set_colors(self, ):\n try:\n odd = self._parent.settings.get_key('interface.odd_color')\n even = self._parent.settings.get_key('interface.even_color')\n self.dialog.instruments.se... | [
"0.6235561",
"0.62288016",
"0.62165153",
"0.6197588",
"0.61697716",
"0.61198795",
"0.60795707",
"0.6046393",
"0.602881",
"0.5954413",
"0.5944893",
"0.5944547",
"0.59150326",
"0.5883077",
"0.58579695",
"0.5791961",
"0.5767286",
"0.56907225",
"0.567721",
"0.5672064",
"0.5667342... | 0.6424872 | 0 |
Updates the connector brush set (line thickness and style for all different modes) | def update_brush(self):
brushset = self.brushset
self.grfx[0].brushset = brushset
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_color(self):\r\n \r\n \r\n colorset = self.colorset\r\n \r\n self.grfx[0].colorset = colorset\r\n pass",
"def SetConnectionPen(self, pen):\r\n\r\n self._dottedPen = pen\r\n self._dirty = True",
"def update_lines(self):\n self._checkfigure()\n for ld in s... | [
"0.55857426",
"0.55402994",
"0.55136853",
"0.5499298",
"0.549224",
"0.5472288",
"0.5430496",
"0.54174554",
"0.54016674",
"0.53672564",
"0.52902114",
"0.5260264",
"0.51613456",
"0.5153392",
"0.51249695",
"0.511491",
"0.50836724",
"0.50835735",
"0.50830746",
"0.5077155",
"0.506... | 0.713593 | 0 |
Returns a dict with valid tileset config test data. This config makes use of custom tile types, string values, integer values, and boolean values. Tile values 2, 3, 4, 5, 6, and 7 are basic tiles. Tile value 1 is a custom tile that faces right. Tile value 3 is a custom2 tile. Tile value 5 is positioned at 32, 128 Tile ... | def get_valid_config_data():
# Valid JSON config for testing
JSON_config = '''{
"1": {
"type": "custom",
"faces": "right"
},
"3": {
"type": "custom2"
},
"5": {
"x": 32,
"y": 128
},
"7": {
"is_collidable": false
}
}'''
# Expected values for the parsed tileset config
expected_confi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fixture_tile_list():\n return {\n \"version\": 1,\n \"revision\": 1,\n \"timestamp\": \"2018-06-19T23:04:32.442Z\",\n \"timestamp_ms\": 1529449472442,\n \"result_code\": 0,\n \"result\": [\n {\n \"tileType\": \"TILE\",\n \"us... | [
"0.645837",
"0.5994021",
"0.57005423",
"0.56361276",
"0.5413695",
"0.5405445",
"0.5320153",
"0.53163576",
"0.52881116",
"0.52785176",
"0.52640116",
"0.52409047",
"0.5214152",
"0.521286",
"0.5201781",
"0.5196488",
"0.5195086",
"0.51907146",
"0.51883835",
"0.5168212",
"0.514945... | 0.74695957 | 0 |
Kicks a member from voice. | async def voicekick(self, ctx, member: discord.Member, reason: str=None):
if not (member.voice is not None and member.voice.channel is not None):
return await ctx.send('That user is not in a voice channel.')
overwrite = discord.PermissionOverwrite(connect=False)
overwrite = {ctx.guil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kick_member(self, *args, **kwargs):\n return self.bot.kick_chat_member(self.id, *args, **kwargs)",
"async def kick(self, ctx, *, member):\n kickmsg = ['Poor %s is out!', 'These people don\\'t understand!', 'Seeya %s!']\n try:\n await self.Aya.kick(member)\n await se... | [
"0.70917535",
"0.6701306",
"0.66946244",
"0.66391265",
"0.6553563",
"0.65528697",
"0.6551806",
"0.63521826",
"0.634649",
"0.6206999",
"0.6151701",
"0.6095203",
"0.60931796",
"0.60874003",
"0.6033611",
"0.60330963",
"0.60183454",
"0.6015031",
"0.60025275",
"0.59779143",
"0.589... | 0.71342415 | 0 |
Construct temporary .pylintrc search paths. | def pylintrc_search_paths(tmp_path_factory):
search_paths = {dir_name: str(tmp_path_factory.mktemp(dir_name))
for dir_name in DIR_LIST}
return search_paths | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_pylintrc_path(pylintrc_files, mocker):\n search_paths, expected_path, __ = pylintrc_files\n mocker.patch(\"pylint.config.os.path.expanduser\",\n return_value=search_paths[HOME_DIR])\n actual_path = get_pylintrc_path(\n search_paths=list(search_paths.values()),\n ... | [
"0.662011",
"0.650711",
"0.6226583",
"0.5570983",
"0.5460117",
"0.54496396",
"0.5440895",
"0.5436888",
"0.53861815",
"0.53402513",
"0.53386796",
"0.53209335",
"0.5306118",
"0.5263746",
"0.52620554",
"0.5228226",
"0.5217716",
"0.52044374",
"0.5197145",
"0.51968545",
"0.5183719... | 0.737298 | 0 |
Write a script for testing Pylint to a temporary directory. | def pylint_test_script(pylintrc_search_paths):
script_path = osp.join(
pylintrc_search_paths[SCRIPT_DIR], "test_script.py")
with open(script_path, mode="w",
encoding="utf-8", newline="\n") as script_file:
script_file.write(PYLINT_TEST_SCRIPT)
return script_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_tests(project_name, root_dir):\r\n test_path = get_file_path(root_dir, \"tests\", \"%s_tests.py\" % project_name) #Get the path for setup.py\r\n test_content = get_test_text(project_name)\r\n \r\n test_file = open(test_path, 'w')\r\n test_file.write(test_content)\r\n test_file.close()\r... | [
"0.6096249",
"0.6032377",
"0.5950862",
"0.593867",
"0.5890548",
"0.5798267",
"0.5785909",
"0.57421994",
"0.5741357",
"0.5741214",
"0.572069",
"0.56900096",
"0.5683055",
"0.5643151",
"0.56162775",
"0.5615845",
"0.5593304",
"0.5564635",
"0.5535172",
"0.55192435",
"0.5500983",
... | 0.7018658 | 0 |
Store test .pylintrc files at the paths and determine the result. | def pylintrc_files(pylintrc_search_paths, request):
search_paths = pylintrc_search_paths
# Determine the bad names that should be reported
pylintrc_locations = request.param
bad_names = [ALL_DIR]
for search_path_name, search_path in search_paths.items():
if search_path_name in pylintrc_loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_pylintrc_path(pylintrc_files, mocker):\n search_paths, expected_path, __ = pylintrc_files\n mocker.patch(\"pylint.config.os.path.expanduser\",\n return_value=search_paths[HOME_DIR])\n actual_path = get_pylintrc_path(\n search_paths=list(search_paths.values()),\n ... | [
"0.66452694",
"0.6459445",
"0.6170688",
"0.59876823",
"0.582488",
"0.5818325",
"0.5776186",
"0.568071",
"0.56714493",
"0.56066376",
"0.56009126",
"0.55990326",
"0.5571086",
"0.5561749",
"0.5561562",
"0.5551839",
"0.5498108",
"0.5487645",
"0.5454416",
"0.5452476",
"0.54209703"... | 0.7167423 | 0 |
Test that get_pylintrc_path finds the expected one in the hiearchy. | def test_get_pylintrc_path(pylintrc_files, mocker):
search_paths, expected_path, __ = pylintrc_files
mocker.patch("pylint.config.os.path.expanduser",
return_value=search_paths[HOME_DIR])
actual_path = get_pylintrc_path(
search_paths=list(search_paths.values()),
home_path=sea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_pylintrc():\n # is there a pylint rc file in the current directory ?\n if exists('pylintrc'):\n return abspath('pylintrc')\n if isfile('__init__.py'):\n curdir = abspath(os.getcwd())\n while isfile(join(curdir, '__init__.py')):\n curdir = abspath(join(curdir, '..')... | [
"0.68032706",
"0.6448468",
"0.6284805",
"0.6265563",
"0.5905181",
"0.5899702",
"0.58623224",
"0.5832469",
"0.5802742",
"0.5788268",
"0.5768383",
"0.5759849",
"0.5758396",
"0.57533956",
"0.57498854",
"0.5731606",
"0.57209617",
"0.57180184",
"0.57164896",
"0.5670219",
"0.566472... | 0.80268943 | 0 |
Test that entire pylint widget gets results depending on pylintrc. | def test_pylint_widget_pylintrc(
pylint_test_script, pylintrc_files, mocker, qtbot):
search_paths, __, bad_names = pylintrc_files
mocker.patch("pylint.config.os.path.expanduser",
return_value=search_paths[HOME_DIR])
mocker.patch("spyder.plugins.pylint.widgets.pylintgui.getcwd_or_hom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pylint_widget_noproject(pylint_test_script, mocker, qtbot):\n main_window = MainWindowMock()\n main_window.projects.get_active_project_path = mocker.MagicMock(\n return_value=None)\n pylint_sw = Pylint(parent=main_window)\n pylint_widget = PylintWidget(parent=pylint_sw)\n pylint_widg... | [
"0.67564845",
"0.6632729",
"0.64372236",
"0.6360425",
"0.631944",
"0.62945527",
"0.6275919",
"0.62694365",
"0.6235758",
"0.6235356",
"0.61929816",
"0.6172255",
"0.6162868",
"0.6126283",
"0.60482913",
"0.5955209",
"0.5931774",
"0.5890925",
"0.58670413",
"0.58547294",
"0.582058... | 0.807906 | 0 |
Validates the given 1based page number. | def validate_number(self, number):
try:
number = int(number)
except (TypeError, ValueError):
raise PageNotAnInteger('That page number is not an integer')
if number < 1:
raise EmptyPage('That page number is less than 1')
return number | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_page_number(self, page_number):\n try:\n page_number = int(page_number)\n except ValueError:\n raise PageNotAnInteger('That page number is not an integer')\n if page_number < 1:\n raise EmptyPage('That page number is less than 1')\n if page_... | [
"0.78904337",
"0.608078",
"0.5907446",
"0.58686286",
"0.5767173",
"0.57246196",
"0.56576866",
"0.5597573",
"0.5579648",
"0.55630326",
"0.55414945",
"0.5502022",
"0.5393261",
"0.53803545",
"0.53577507",
"0.5327163",
"0.5299837",
"0.5276072",
"0.52355504",
"0.5227572",
"0.52175... | 0.76098096 | 1 |
Prepare object points for a chessboard pattern | def get_obj_points_from_chessboard_dimensions(chessboard_dimensions: Tuple[int, int] = (9, 6)):
# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
x, y = chessboard_dimensions
object_points: np.ndarray = np.zeros((x * y, 3), np.float32)
object_points[:, :2] = np.mgrid[0:x, 0:y].T.resha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pointsSetUp(self):\r\n self.background.draw(self.surface)\r\n for i in range(len(self.points)):\r\n self.points[i].organize()\r\n self.points[i].update()\r\n self.points[i].addNumber(i)\r\n self.points[i].setActiveTurn()",
"def place_obj(self):\r\n ... | [
"0.64446527",
"0.6197618",
"0.61572576",
"0.61388654",
"0.61300224",
"0.6035208",
"0.6033167",
"0.602081",
"0.6014104",
"0.6005579",
"0.6002765",
"0.59935117",
"0.59837615",
"0.5969495",
"0.5947238",
"0.5927367",
"0.5891806",
"0.58882946",
"0.5868722",
"0.5861847",
"0.5855113... | 0.6439109 | 1 |
return ``True`` if this object is initialized with current schema\ and return ``False`` otherwise. | def is_init(self):
cur = self.connection.cursor()
masterdata = list(cur.execute(
'SELECT * FROM sqlite_master WHERE name="metadata"'
))
if len(masterdata) == 0:
return False
schema_version = list(cur.execute(
'SELECT value FROM metadata ' +
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_initialised(self) -> bool:\n return _schema.has_schema(self._engine)",
"def _is_initialized(self) -> bool:\n return len(self) > 0",
"def isInitialized(self):\n\t\tif self.isTypeSet and self.isCfgSet:\n\t\t\treturn True\n\t\telse:\n\t\t\treturn False",
"def initialize(self) -> bool:\n ... | [
"0.8566377",
"0.70202136",
"0.68050253",
"0.6754496",
"0.6735238",
"0.6682235",
"0.6647975",
"0.66320235",
"0.6615343",
"0.661172",
"0.6484367",
"0.6484367",
"0.6474015",
"0.6436641",
"0.6405033",
"0.6385124",
"0.63354135",
"0.6331027",
"0.6293815",
"0.62921417",
"0.62463856"... | 0.80022717 | 1 |
Generates arp request and sends it out of 'port_out' of 'dp' forwarder | def _arp_send(dp, port_out, arp_code, ip_sender, ip_target, eth_dst='ff:ff:ff:ff:ff:ff',eth_src=None,eth_target='00:00:00:00:00:00'):
ofp = dp.ofproto
parser = dp.ofproto_parser
pkt = packet.Packet()
# HACK: to reply as real interface on virtual machine
if dp.id in LAN_TYPE_FORWARDERS and dp.id =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_edge_inet_dp_join(self, dp, port, apn):\n\n ofp = dp.ofproto\n parser = dp.ofproto_parser\n\n ##All ARP requests that come from APN are forwarded to Controller which then handle them\n LOG.debug('TOPO MNGR: Redirecting all ARP req from APN: ' + apn.name + ' to controller by OFr... | [
"0.70389175",
"0.68457484",
"0.6765341",
"0.66586983",
"0.6375743",
"0.6263277",
"0.62261516",
"0.62181216",
"0.62036407",
"0.619166",
"0.6029766",
"0.596769",
"0.5959465",
"0.5918179",
"0.5871038",
"0.5856786",
"0.58424866",
"0.57656527",
"0.5752623",
"0.57328135",
"0.565906... | 0.7966862 | 0 |
Generates ICMP packet and sends it out of 'port_out' on forwarder 'dp' | def _icmp_send(dp, port_out, ip_src=DISCOVERY_IP_SRC, ip_dst=DISCOVERY_IP_DST,
eth_src='02:b0:00:00:00:b5', eth_dst='02:bb:bb:bb:bb:bb',
icmp_type=8, icmp_code=0):
ofp = dp.ofproto
parser = dp.ofproto_parser
pkt = packet.Packet()
pkt.add_protocol(ethernet.ethernet(ethertyp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _arp_send(dp, port_out, arp_code, ip_sender, ip_target, eth_dst='ff:ff:ff:ff:ff:ff',eth_src=None,eth_target='00:00:00:00:00:00'):\n\n ofp = dp.ofproto\n parser = dp.ofproto_parser\n pkt = packet.Packet()\n\n # HACK: to reply as real interface on virtual machine\n if dp.id in LAN_TYPE_FORWARDERS... | [
"0.7209012",
"0.6993463",
"0.648588",
"0.64849937",
"0.64377546",
"0.64139664",
"0.62656873",
"0.6234963",
"0.6189293",
"0.6100794",
"0.6088297",
"0.60644233",
"0.59741366",
"0.58863854",
"0.5831862",
"0.5823556",
"0.58225137",
"0.5741862",
"0.57396793",
"0.5738106",
"0.56858... | 0.8093102 | 0 |
Used to parse payload of ICMP packets used for selfdiscovery which contains dictionary | def _icmp_parse_payload(pkt):
payload = ''
icmp_pkt = pkt.get_protocol(icmp.icmp)
for char in icmp_pkt.data.data:
payload+=(chr(char))
parsed_payload = ast.literal_eval(payload.rstrip('\0'))
return(parsed_payload) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_icmp(pkt, packets, i, start_point):\r\n icmp_type = int(pkt[start_point:start_point+2], 16)\r\n start_point = start_point + 2\r\n icmp_code = int(pkt[start_point:start_point+2], 16)\r\n start_point = start_point + 2\r\n icmp_checksum = pkt[start_point:start_point+4]\r\n packets[i][2].a... | [
"0.69481534",
"0.68800527",
"0.6696721",
"0.6606795",
"0.6302321",
"0.61934835",
"0.61117524",
"0.6082407",
"0.60768354",
"0.60135335",
"0.59729457",
"0.59665066",
"0.59422326",
"0.5932177",
"0.5875507",
"0.58529854",
"0.5764105",
"0.57236487",
"0.5700653",
"0.5675754",
"0.56... | 0.72770196 | 0 |
Generator of Tunnel identifiers (in MAC addr. format) | def get_tid():
mac_char='0123456789abcdef'
mac_addr='02:'
available=0
while available == 0:
for i in range(5):
for y in range(2):
mac_addr = mac_addr + random.choice(mac_char)
mac_addr = mac_addr + ':'
mac_addr = mac_addr[:-1]
if mac_addr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enumerate_network(arg):\n\n network = ip_network(arg, strict=False)\n data = list(map(str, network.hosts()))\n data.insert(0, str(network.network_address))\n if network.prefixlen != network.max_prefixlen:\n data.append(str(network.broadcast_address))\n return data",
"def get_unique_netw... | [
"0.5769114",
"0.5737529",
"0.55646247",
"0.5467259",
"0.5378289",
"0.5342663",
"0.53416985",
"0.5327515",
"0.5310284",
"0.52937657",
"0.5292094",
"0.52841973",
"0.52473617",
"0.52334154",
"0.519637",
"0.5145079",
"0.5144612",
"0.5142393",
"0.5127744",
"0.5116163",
"0.5108347"... | 0.574784 | 1 |
Add new inner (BSS side) forwarder joined our network. | def on_inner_dp_join(self, dp):
ofp = dp.ofproto
parser = dp.ofproto_parser
#Deletion of already existing OF flows
LOG.debug('TOPO MNGR: Deleting flow table configuration of newly added forwarder ID: ' + str(dp.id) )
dp.send_msg(parser.OFPFlowMod(datapath=dp, command=ofp.OFPFC_D... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addNeighbor(self, neighbor):",
"def append_neighbour(self, neighbour):\n self.connected_to.append(neighbour)\n neighbour.connected_to.append(self)",
"def add_neighbours(self, router1, router2):\n router1 = self.routers[router1]\n router2 = self.routers[router2]\n\n router... | [
"0.5993939",
"0.596971",
"0.5930252",
"0.585118",
"0.5838516",
"0.57371885",
"0.5717631",
"0.5717378",
"0.57051635",
"0.56735325",
"0.5652761",
"0.56406254",
"0.5629999",
"0.5607531",
"0.55954224",
"0.55444705",
"0.5523582",
"0.55130565",
"0.55095875",
"0.55094314",
"0.548756... | 0.6400863 | 0 |
This method handles change of forwarders state target ev.enter is False Forwarder got disconnected | def forwarder_state_changed(self, ev):
dp = ev.dp
ofp = dp.ofproto
parser = dp.ofproto_parser
if ev.enter is True:
# in plain MAC setup, this should install only ICMP and ARP re-route rules, watchout for hardcoded DP id
self.on_inner_dp_join(dp)
##For evr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_processing_enter(cfg, app, win):",
"def _detected_relay_state_change(self, event):\n # ensure there is a delay if any additional state change occurs to\n # avoid confusing the LUNOS hardware controller\n self._record_relay_state_change()\n\n entity = event.data.get(\"entity_... | [
"0.5625857",
"0.561023",
"0.55520225",
"0.55520225",
"0.5507927",
"0.5499831",
"0.5485146",
"0.5446665",
"0.54091686",
"0.539391",
"0.5344798",
"0.5336561",
"0.5331514",
"0.5331445",
"0.5329964",
"0.53298074",
"0.5307046",
"0.5276215",
"0.5254924",
"0.52535224",
"0.52432555",... | 0.80070484 | 0 |
Serialize action into buffer. | def serialize(self, buf, offset):
super(GPRSAction,self).serialize(buf, offset)
ofproto_parser.msg_pack_into("!H", buf, offset+8, self.subtype) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self, buff):\n try:\n _x = self.name\n length = len(_x)\n if python3 or type(_x) == unicode:\n _x = _x.encode('utf-8')\n length = len(_x)\n buff.write(struct.pack('<I%ss'%length, length, _x))\n _x = self.type_name\n length = len(_x)\n if python3 or ... | [
"0.6001708",
"0.57553136",
"0.569683",
"0.5632987",
"0.55927765",
"0.5574655",
"0.5556825",
"0.5542753",
"0.549518",
"0.54617316",
"0.5395273",
"0.53816247",
"0.53811455",
"0.53482443",
"0.53440183",
"0.53345907",
"0.5328822",
"0.53269553",
"0.53243476",
"0.531923",
"0.531634... | 0.6823138 | 0 |
Serialize PushGPRSNS action into buffer. | def serialize(self, buf, offset):
super(GPRSActionPushGPRSNS,self).serialize(buf, offset)
imsi_bytes = imsi_to_bytes(self.imsi)
LOG.debug("push_gprsns.serialize self="+pprint.pformat(self))
ofproto_parser.msg_pack_into("!HxxIHBBHBBBBBBBBBx", buf, offset+8,
self.subtype... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize(self, buf, offset):\n super(GPRSAction,self).serialize(buf, offset)\n ofproto_parser.msg_pack_into(\"!H\", buf, offset+8, self.subtype)",
"def serialize(self, buf, offset):\n super(GPRSActionPushUDPIP,self).serialize(buf, offset)\n ofproto_parser.msg_pack_into(\"!Hxx4s4s... | [
"0.7202917",
"0.66513556",
"0.65017486",
"0.5595762",
"0.54294664",
"0.5408272",
"0.538384",
"0.53148985",
"0.5144256",
"0.50898355",
"0.5052901",
"0.504501",
"0.5036003",
"0.50215316",
"0.5021419",
"0.4943677",
"0.4918316",
"0.49109283",
"0.48899528",
"0.48833308",
"0.486870... | 0.75911236 | 0 |
Serialize PushUDPIP action into buffer. | def serialize(self, buf, offset):
super(GPRSActionPushUDPIP,self).serialize(buf, offset)
ofproto_parser.msg_pack_into("!Hxx4s4sHH", buf, offset+8,
self.subtype, self.da, self.sa, self.dp, self.sp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_pushSerialized(pNamespace):",
"def serialize(self, buf, offset):\n super(GPRSAction,self).serialize(buf, offset)\n ofproto_parser.msg_pack_into(\"!H\", buf, offset+8, self.subtype)",
"def serialize(self, buf, offset):\n super(GPRSActionPushGPRSNS,self).serialize(buf, offset)\n\n... | [
"0.6497084",
"0.6239922",
"0.60241103",
"0.5547205",
"0.5528384",
"0.5382345",
"0.5369563",
"0.5329033",
"0.52733326",
"0.52644396",
"0.5262801",
"0.52563524",
"0.52469605",
"0.5224134",
"0.52055746",
"0.5179876",
"0.51671505",
"0.5147744",
"0.50966257",
"0.5049666",
"0.50458... | 0.7250111 | 0 |
Disassemble classes, methods, functions, or code. With no argument, disassemble the last traceback. | def dis(x=None):
result = []
if x is None:
distb()
return
if isinstance(x, types.InstanceType):
x = x.__class__
if hasattr(x, 'im_func'):
x = x.im_func
if hasattr(x, 'func_code'):
x = x.func_code
if hasattr(x, '__dict__'):
items = x.__dict__.items(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dis(x=None):\n if x is None:\n distb()\n return\n if isinstance(x, types.InstanceType):\n x = x.__class__\n if hasattr(x, 'im_func'):\n x = x.im_func\n if hasattr(x, 'func_code'):\n x = x.func_code\n if hasattr(x, '__dict__'):\n items = x.__dict__.items(... | [
"0.615091",
"0.57982975",
"0.57259184",
"0.5615364",
"0.55653363",
"0.55528146",
"0.5528827",
"0.5510344",
"0.54850596",
"0.5462706",
"0.5446093",
"0.5377027",
"0.5375238",
"0.5354665",
"0.5336946",
"0.5331819",
"0.5316269",
"0.5284975",
"0.52627206",
"0.5256457",
"0.5221092"... | 0.6127796 | 1 |
Find the offsets in a byte code which are start of lines in the source. Generate pairs (offset, lineno) as described in Python/compile.c. | def findlinestarts(code):
byte_increments = [ord(c) for c in code.co_lnotab[0::2]]
line_increments = [ord(c) for c in code.co_lnotab[1::2]]
result = []
lastlineno = None
lineno = code.co_firstlineno
addr = 0
for byte_incr, line_incr in zip(byte_increments, line_increments):
if byte_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findlinestarts(code):\n byte_increments = [ord(c) for c in code.co_lnotab[0::2]]\n line_increments = [ord(c) for c in code.co_lnotab[1::2]]\n\n lastlineno = None\n lineno = code.co_firstlineno\n addr = 0\n for byte_incr, line_incr in zip(byte_increments, line_increments):\n if byte_inc... | [
"0.79010475",
"0.6719782",
"0.66840935",
"0.66244036",
"0.6570264",
"0.6559854",
"0.6527472",
"0.63632685",
"0.6142014",
"0.613968",
"0.60964674",
"0.6068779",
"0.6019877",
"0.60187554",
"0.60158813",
"0.6015849",
"0.5945159",
"0.59155715",
"0.58966374",
"0.5891578",
"0.57854... | 0.8088187 | 0 |
Return root Tk() instance or Frame. (if created as frame, return frame, else return master) | def getRoot(self):
if self.isFrame: return self.frame
else: return self.master | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def widget(self) -> tk.Frame:\r\n return self.main_frame",
"def get_master_widget(self, top: Widget=None) -> Widget:\n if top is None:\n top = self.c.frame.top\n master = top.leo_master or top\n return master",
"def _getTkWdg():\n global g_tkWdg\n if not g_tkWdg:\n ... | [
"0.7010709",
"0.69224274",
"0.6666383",
"0.64904845",
"0.6253199",
"0.6125347",
"0.60954154",
"0.6086796",
"0.6058302",
"0.6010646",
"0.5984231",
"0.59828",
"0.59828",
"0.59828",
"0.597996",
"0.5928371",
"0.5913232",
"0.5887579",
"0.58865285",
"0.58780074",
"0.58614576",
"0... | 0.72190964 | 0 |
return True if canvas is empty | def c_empty(self):
return self.canvas.find_all()==() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_buffer_empty(self): \n if self.buffer.shape == (0, 5):\n return True\n else:\n return False",
"def empty(self):\n return len(self.layers) == 0",
"def isBufferEmpty(self):\n return self.ecg_buffer.empty()",
"def is_empty(self):\n return le... | [
"0.77237153",
"0.76357627",
"0.7319792",
"0.729806",
"0.72561604",
"0.72561604",
"0.72433543",
"0.72324526",
"0.7216406",
"0.72047114",
"0.72007596",
"0.7191478",
"0.71773005",
"0.7171273",
"0.7171273",
"0.7171273",
"0.7171273",
"0.7171273",
"0.7166267",
"0.71652865",
"0.7165... | 0.8021844 | 0 |
remove the last item drawed on canvas | def c_undo(self):
try:
self.canvas.delete(self.canvas.find_all()[-1])
self.update()
return True
except: return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undraw(self):\n \n if not self.canvas: return\n if not self.canvas.isClosed():\n #self.canvas.delete(self.id)\n _tkExec(self.canvas.delete, self.id)\n if self.canvas.autoflush:\n #_root.update()\n _tkCall(_root.update)\n ... | [
"0.73996705",
"0.7088066",
"0.7041244",
"0.69705874",
"0.6903878",
"0.686023",
"0.6848304",
"0.6843921",
"0.68169755",
"0.6808803",
"0.6757331",
"0.67393214",
"0.6654051",
"0.6647528",
"0.66299224",
"0.65866596",
"0.6546326",
"0.65115553",
"0.648313",
"0.648077",
"0.648077",
... | 0.7089448 | 1 |
return pos and dir in tuple as ((x,y), dir) | def get(self):
return ((self.x, self.y), self.dir) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pos(self):\n return (self.x, self.y)",
"def get_position(self):\n return (self.x_pos, self.y_pos)",
"def get_pos(x, y):\r\n return normalize(x) // 2, normalize(y) // 4",
"def get_pos(self):\n return (self.x/3, 3**0.5*self.y/3, self.r/3)",
"def get_coord_in_direction(self, po... | [
"0.73528427",
"0.71841997",
"0.6858731",
"0.685618",
"0.6795162",
"0.66718763",
"0.66441745",
"0.6634082",
"0.65731037",
"0.65377384",
"0.65252733",
"0.6496505",
"0.6415428",
"0.64131814",
"0.6409765",
"0.64024806",
"0.63738513",
"0.6352657",
"0.6352657",
"0.6352657",
"0.6322... | 0.8125648 | 0 |
Makes the point go forward by x pixels in dir | def forward(self, x):
self.x = (self.x+(x*(math.cos(self.dir))))
self.y = (self.y+(x*(math.sin(self.dir))))
return (self.x, self.y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_forward(self):\n self.x, self.y = self.compute_positions()",
"def forward_character():\r\n set_point(point()+1)",
"def forward(self, amount):\n newX = self._x + round(amount * math.sin(math.radians(self._rotation)), 2)\n newY = self._y - round(amount * math.cos(math.radians(self.... | [
"0.7059315",
"0.6894002",
"0.66802937",
"0.667741",
"0.6607247",
"0.6591154",
"0.6550676",
"0.6534507",
"0.64682215",
"0.6462259",
"0.64148843",
"0.6414298",
"0.6394705",
"0.6365585",
"0.63058364",
"0.62997663",
"0.62896514",
"0.62759936",
"0.6250437",
"0.62298954",
"0.619899... | 0.7757055 | 0 |
Rotate dir by "angle" degrees left | def left(self, angle):
self.dir -= math.radians(angle) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left(self, angle: Degrees):\n prev = self.angle\n self.angle = self.angle - angle\n if self.angle < 0:\n self.angle += 360.0",
"def left(self, angle):\r\n self.rotation -= angle",
"def left(self, angle):\n self._rotate(angle)",
"def right(self, angle):\r\n ... | [
"0.7691436",
"0.7684255",
"0.75198334",
"0.7476443",
"0.7369223",
"0.733845",
"0.7328095",
"0.72798973",
"0.72391224",
"0.7205431",
"0.7138064",
"0.70180005",
"0.69820297",
"0.6977292",
"0.69525814",
"0.6881465",
"0.6875089",
"0.6872205",
"0.6857804",
"0.68568367",
"0.6847976... | 0.8165693 | 0 |
Same as left but by angle degrees right | def right(self, angle):
self.dir += math.radians(angle) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right(self, angle):\r\n self.rotation += angle",
"def rotate_left_right(self):\n\t\treturn",
"def rotate_right_left(self):\n\t\treturn",
"def right(self, angle: Degrees):\n prev = self.angle\n self.angle = (self.angle + angle) % 360.0",
"def left(self, angle):\n self.right(-... | [
"0.78844625",
"0.7836506",
"0.7820595",
"0.7691349",
"0.74083984",
"0.7182636",
"0.7090768",
"0.7068519",
"0.7015137",
"0.7012727",
"0.69686496",
"0.69575316",
"0.68744814",
"0.6862696",
"0.67455",
"0.67438626",
"0.6725787",
"0.67244244",
"0.6699518",
"0.66730887",
"0.6668584... | 0.794279 | 0 |
reset the x, y and dir attributes set them to the given pos at creation (0 by default) | def reset(self):
self.x = self.initX
self.y = self.initY
self.dir= self.initDir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPos(self,pos):\n self.Xpos,self.Ypos=pos",
"def __init__(self, pos=(0,0), dire = 0):\r\n self.initX = self.x = pos[0]\r\n self.initY = self.y = pos[1]\r\n self.initDir = self.dir = math.radians(dire)",
"def set_position(self, x, y):\n self.tx = -x\n self.ty = -y... | [
"0.7370828",
"0.71187603",
"0.6974645",
"0.6962133",
"0.69575024",
"0.6955875",
"0.6885961",
"0.6853029",
"0.683717",
"0.67974186",
"0.67750627",
"0.6773557",
"0.6759446",
"0.67568797",
"0.67138445",
"0.66729176",
"0.65741587",
"0.6550942",
"0.65407187",
"0.65238667",
"0.6523... | 0.73692876 | 1 |
check if buffer is empty | def is_empty(self):
return self.buff==[] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isBufferEmpty(self):\n return self.ecg_buffer.empty()",
"def is_buffer_empty(self): \n if self.buffer.shape == (0, 5):\n return True\n else:\n return False",
"def bufferIsFull(self):\n return len(self.buffer) == self.bufferSize",
"def is_full(self)... | [
"0.8481212",
"0.8138869",
"0.81171405",
"0.77690786",
"0.77690786",
"0.77690786",
"0.77690786",
"0.76674646",
"0.74999297",
"0.7459257",
"0.740098",
"0.7346949",
"0.7346949",
"0.7346949",
"0.7346949",
"0.7346949",
"0.7346949",
"0.7346949",
"0.73412776",
"0.7338832",
"0.732243... | 0.839308 | 1 |
remove an item from buffer and return it | def pop(self):
return self.buff.pop(-1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n data = self.buffer.getvalue()\n self.buffer.seek(0)\n self.buffer.truncate()\n return data",
"def pop_item(self, index):\n ix, obj = self.items\n if index < len(ix):\n self.d_buffer.pop(ix[index])\n else:\n raise IndexError('Buffer does not ... | [
"0.71644026",
"0.7026645",
"0.69669145",
"0.69313484",
"0.6892832",
"0.6758544",
"0.6690899",
"0.66607386",
"0.66448075",
"0.6554949",
"0.64810735",
"0.6477074",
"0.6459086",
"0.64279103",
"0.6414904",
"0.641293",
"0.634858",
"0.6341995",
"0.6341995",
"0.6322717",
"0.62970805... | 0.7178539 | 0 |
add an item to the buffer | def add(self, item):
if len(self.buff)==self.size: self.buff.pop(0)
self.buff.append(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(self, item):\n self.items.append(item)\n self.length += 1",
"def add_to_bag(self, item):\n self._bag.append(item)",
"def push(self, item):\n self._data.append(item)",
"def add(self, item):\n self.contents.append(item)",
"def push(self, item: Any) -> None:\n ... | [
"0.7763345",
"0.7459934",
"0.74492633",
"0.73964185",
"0.7394174",
"0.7379183",
"0.73638815",
"0.7354412",
"0.73435956",
"0.73304933",
"0.73304933",
"0.73304933",
"0.73304933",
"0.73304933",
"0.7324654",
"0.7315504",
"0.7277273",
"0.7221862",
"0.72122985",
"0.7211663",
"0.720... | 0.861456 | 0 |
Set the name for the slider | def setName(self, name):
self.label.setText(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_name(self, name):\n self.options['name'] = name",
"def set_name(self, name):\n\t\tself.name_ = name",
"def set_name(self, name):\n self.settings[\"name\"] = name",
"def set_name(self, name):\n self.name = name\n self.labels.change_name(name)",
"def set_name(self, name):\... | [
"0.7245413",
"0.72082627",
"0.7175868",
"0.71171975",
"0.7107551",
"0.7107551",
"0.7107551",
"0.7107551",
"0.7107551",
"0.70956314",
"0.70956314",
"0.70956314",
"0.70956314",
"0.7082746",
"0.70528257",
"0.7050544",
"0.7021297",
"0.6976529",
"0.6952984",
"0.6952984",
"0.693313... | 0.75466573 | 0 |
Set the value for the slider and the spinbox | def setValue(self, value):
ratio = (value - self.range[0]) / (self.range[1] - self.range[0])
self._changed = False
self.slider.setValue(ratio * 100)
self._changed = False
self.spinbox.setValue(value)
self._changed = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetValue(self, val):\n self.spin.SetValue(val)\n self.slider.SetValue(100*(val-self.minval)/(self.maxval-self.minval))",
"def valoresSpin():\n try:\n var.ui.spinEdad.setValue(16)\n except Exception as error:\n print('Error valores spin: %s' % str(error))",
... | [
"0.8019232",
"0.7288955",
"0.7197321",
"0.701569",
"0.69149137",
"0.6797844",
"0.6789823",
"0.67501086",
"0.67231417",
"0.6673392",
"0.66575426",
"0.65889734",
"0.6568332",
"0.6533974",
"0.65043247",
"0.64979696",
"0.6493205",
"0.64843595",
"0.6430149",
"0.64179516",
"0.64022... | 0.79265803 | 1 |
Retrieve a player's uid given they're name and platform | def nametouid(self, player: str, platform: ALPlatform) -> int:
new_base_url: str = "https://api.mozambiquehe.re/nametouid?"
additional_params = {
'player': player,
'platform': platform.value
}
result = self._make_request(additional_params=additional_params, new_b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_player(self, name=None, platform=None, uid=None):\n\n results = yield from self.get_players(name=name, platform=platform, uid=uid)\n return results[0]",
"def get_player_by_uid(\n self, uid: str, platform: ALPlatform, skip_tracker_rank=False\n ) -> ALPlayer:\n basic_play... | [
"0.6880495",
"0.67808336",
"0.6429038",
"0.6421816",
"0.61491287",
"0.6111204",
"0.6078377",
"0.60274875",
"0.6017213",
"0.5983376",
"0.59329355",
"0.5932323",
"0.5906337",
"0.5897506",
"0.588646",
"0.588646",
"0.588646",
"0.5871862",
"0.5848459",
"0.58467454",
"0.58465564",
... | 0.77609485 | 0 |
Adds the given player's UUID to the list of tracked players | def add_player_by_uid(self, player_uid: int, platform: ALPlatform) -> list:
return self.events_by_uid(str(player_uid), platform=platform, action=ALAction.ADD) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_player(self, player):\n\t\tself.players.append(player)",
"def addPlayer(self, playerID, playerElo, index):\n\n self.idList.insert(index, playerID)\n self.eloList.insert(index, playerElo)",
"def add_player(self, player):\r\n self.players[player.id] = copy.copy(player)\r\n ret... | [
"0.71620226",
"0.66145873",
"0.6583641",
"0.6421349",
"0.6377049",
"0.62434125",
"0.62323105",
"0.61883676",
"0.6101932",
"0.5872413",
"0.58420855",
"0.583317",
"0.5813686",
"0.57830197",
"0.5776576",
"0.57275444",
"0.5726717",
"0.57026947",
"0.5688031",
"0.56804264",
"0.5636... | 0.7141295 | 1 |
Query the server for the given player / platform and return a list of their events | def events(self, player_name: str, platform: ALPlatform, action: ALAction) -> list:
params: dict = {
'platform': platform.value,
'player': player_name,
'history': 1,
'action': action.value
}
return self._make_request(additional_params=params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def do_playerlist():\n\n download = urllib.request.urlopen(server_api2)\n data = json.loads(download.read())\n player_list = []\n try:\n for i in data['players']['sample']:\n player_list.append(i['name'])\n except KeyError:\n if data['on... | [
"0.59362257",
"0.5845402",
"0.5651614",
"0.5641668",
"0.5631598",
"0.5601766",
"0.5549841",
"0.5540904",
"0.54937965",
"0.5475101",
"0.54540646",
"0.54217774",
"0.53965926",
"0.5361535",
"0.5313909",
"0.5260443",
"0.52544105",
"0.5245204",
"0.5244015",
"0.51975507",
"0.518726... | 0.73692006 | 0 |
Query the server for the given player's UID / platform and return a list of their events | def events_by_uid(self, uid: str, platform: ALPlatform, action: ALAction) -> list:
params: dict = {
'platform': platform.value,
'uid': uid,
'history': 1,
'action': action.value
}
return self._make_request(additional_params=params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events(self, player_name: str, platform: ALPlatform, action: ALAction) -> list:\n params: dict = {\n 'platform': platform.value,\n 'player': player_name,\n 'history': 1,\n 'action': action.value\n }\n return self._make_request(additional_params=p... | [
"0.69545186",
"0.60738385",
"0.59118974",
"0.58794445",
"0.5730681",
"0.5725648",
"0.5697164",
"0.55760676",
"0.5558568",
"0.5488674",
"0.5450456",
"0.54442245",
"0.5414193",
"0.53970325",
"0.53413105",
"0.52829474",
"0.5251254",
"0.52501976",
"0.5238327",
"0.51965046",
"0.51... | 0.6309805 | 1 |
Prepare cube for tests. | def setUp(self):
self.cube = _create_2d_cube() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n self.orography_cube = set_up_threshold_cube()\n self.percentiles_cube = set_up_percentiles_cube()",
"def setUp(self):\n self.precip_cube = setup_precipitation_cube()\n self.oe_cube = setup_orographic_enhancement_cube()\n self.vel_x = set_up_xy_velocity_cube(\... | [
"0.6925194",
"0.6767546",
"0.6649443",
"0.66417235",
"0.6315537",
"0.6255097",
"0.61865866",
"0.6153492",
"0.6049269",
"0.6007402",
"0.5999484",
"0.59469235",
"0.587496",
"0.58691937",
"0.58679867",
"0.58539665",
"0.5844027",
"0.58297664",
"0.5817659",
"0.58157086",
"0.580913... | 0.76851386 | 0 |
Test rolling_window_statistics over time coordinate. | def test_rolling_window_time(self):
cube_time_sum = rolling_window_statistics(self.cube,
coordinate='time',
operator='sum',
window_length=2)
expected_data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rolling_with_non_window_op(con, ibis_windows, spark_range):\n table = con.table(\"time_indexed_table\")\n context = (\n pd.Timestamp(\"20170102 07:00:00\", tz=\"UTC\"),\n pd.Timestamp(\"20170105\", tz=\"UTC\"),\n )\n result_pd = table.mutate(\n count_1h=table[\"value\"].co... | [
"0.6921305",
"0.68341964",
"0.6522597",
"0.65145284",
"0.64855874",
"0.64805263",
"0.63059545",
"0.612616",
"0.60977197",
"0.608205",
"0.5973177",
"0.58838135",
"0.5823563",
"0.57382536",
"0.572127",
"0.5679405",
"0.5648791",
"0.564112",
"0.56372875",
"0.56219643",
"0.5574735... | 0.7689785 | 0 |
Test rolling_window_statistics over latitude coordinate. | def test_rolling_window_latitude(self):
cube_lat_mean = rolling_window_statistics(self.cube,
coordinate='latitude',
operator='mean',
window_length=3)
expe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_rolling_window_time(self):\n cube_time_sum = rolling_window_statistics(self.cube,\n coordinate='time',\n operator='sum',\n window_length=2)\n exp... | [
"0.6361515",
"0.5893057",
"0.57790065",
"0.5740249",
"0.5442331",
"0.53272176",
"0.53247106",
"0.53071976",
"0.52695274",
"0.52675396",
"0.5216561",
"0.5208686",
"0.5191926",
"0.5147597",
"0.5087674",
"0.5055235",
"0.5054563",
"0.5036732",
"0.5036584",
"0.50346494",
"0.503363... | 0.7912801 | 0 |
Return content of SLL in humanreadable form. | def __str__(self) -> str:
content = ''
if self.head is not None:
content = str(self.head)
cur = self.head.next
while cur is not None:
content += ' -> ' + str(cur)
cur = cur.next
return 'SLL [' + content + ']' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary(self):\n return get_paragraphs(self.description)[0]",
"def analyse_slt(self):\n slt_content = self.get_slt()\n # SLT is only available in internal builds.\n if slt_content != None:\n self.formatter.section_start('SLT')\n self.formatter.output_list(sel... | [
"0.6009445",
"0.5970806",
"0.5943531",
"0.58704644",
"0.58370364",
"0.5823974",
"0.5801404",
"0.57882625",
"0.57671016",
"0.5763196",
"0.5763196",
"0.5763196",
"0.5746133",
"0.5734627",
"0.57184327",
"0.5711513",
"0.5682485",
"0.56596804",
"0.5652599",
"0.5616605",
"0.5612615... | 0.6354961 | 1 |
Office365 Outlook client context | def __init__(self, auth_context):
self._resource = "https://outlook.office365.com"
super(OutlookClient, self).__init__(auth_context)
self._pendingRequest = ODataRequest(self, V4JsonFormat("minimal"))
self._pendingRequest.beforeExecute += self._build_specific_query | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_client(self):\n return workflow_ctx.internal.handler.rest_client",
"def outlook(self):\n if \"outlook\" in self._prop_dict:\n if isinstance(self._prop_dict[\"outlook\"], OneDriveObjectBase):\n return self._prop_dict[\"outlook\"]\n else :\n ... | [
"0.55623454",
"0.550653",
"0.5458932",
"0.54345864",
"0.540564",
"0.53858006",
"0.529377",
"0.5292701",
"0.52796125",
"0.5193349",
"0.5184064",
"0.5147242",
"0.5138333",
"0.511263",
"0.50996125",
"0.50981236",
"0.5088751",
"0.50259906",
"0.50184834",
"0.50147486",
"0.50108236... | 0.6708075 | 0 |
Api to add images to the car | def add_car_image(request):
try:
parsed_data = get_json_data(request)
if not authenticate_user(parsed_data):
ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL])
return HttpResponse(ret.serialize(f))
car_id = parsed_data["car_id"]
car = Car.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_car_index_image(request):\n\n try:\n parsed_data = get_json_data(request)\n if not authenticate_user(parsed_data):\n ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL])\n return HttpResponse(ret.serialize(f))\n \n car_id = parsed_data[\"... | [
"0.6910971",
"0.6743566",
"0.6423908",
"0.63757104",
"0.63624233",
"0.63452667",
"0.6329673",
"0.6299511",
"0.6270978",
"0.6270978",
"0.6270978",
"0.6270978",
"0.6253819",
"0.62360173",
"0.6212775",
"0.619199",
"0.6189333",
"0.61782897",
"0.6168795",
"0.61622983",
"0.6146073"... | 0.72720706 | 0 |
Api that get all images of a certain car_id | def get_car_images(request):
try:
parsed_data = get_json_data(request)
car = Car.objects.get(car_id=parsed_data["car_id"])
images = CarImage.objects.filter(car=car)
image_path = []
for image in images:
image_path.append(ImageSerializer(image).serialize())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_city_images(request, city_id):\n try:\n city_images = CityImage.objects.filter(city=city_id)\n except CityImage.DoesNotExist:\n return Response(status=status.HTTP_404_NOT_FOUND)\n\n serializer = CityImageSerializer(city_images, many=True)\n return Response(serializer.data)",
... | [
"0.6803292",
"0.6663593",
"0.65214324",
"0.64842665",
"0.64832675",
"0.6476719",
"0.64447606",
"0.64101243",
"0.64048415",
"0.6395973",
"0.63517296",
"0.635148",
"0.6348054",
"0.6332059",
"0.6329344",
"0.63088846",
"0.62225556",
"0.62047935",
"0.6185176",
"0.61598706",
"0.615... | 0.79177487 | 0 |
api to add car This function needs to be authenticated data = { | def add_car(request):
try:
parsed_data = get_json_data(request)
if not authenticate_user(parsed_data):
ret = Response(AUTHENTICATION_FAIL, error_code[AUTHENTICATION_FAIL])
return HttpResponse(ret.serialize(f))
user = User.objects.get(username=parsed_data["usernam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_add_car():\n session_id = request.args.get('session-id', None)\n user_id = request.args.get('user-id', None)\n if check_authentication(session_id, user_id) and is_admin_user(user_id):\n return render_template('new_car.html', user=user_id, session_id=session_id,\n ... | [
"0.6976403",
"0.68692696",
"0.6787214",
"0.64364094",
"0.642609",
"0.62968695",
"0.6116073",
"0.60255545",
"0.6019659",
"0.59333986",
"0.58781105",
"0.5815925",
"0.5803441",
"0.5771502",
"0.56991774",
"0.5679903",
"0.56668764",
"0.56538844",
"0.5627919",
"0.56167316",
"0.5611... | 0.699394 | 0 |
Delete the car with the car_id receive a json object data = { car_id = "1" } return {status, error_code} | def delete_car(request):
try:
parsed_data = get_json_data(request)
car = Car.objects.get(car_id=parsed_data["car_id"])
car.delete()
ret = Response(SUCCESS, error_code[SUCCESS])
except ObjectDoesNotExist as e:
ret = Response(NONEXIST_DATA, error_code[NONEXIST_DATA].for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_car(id):\n car = Car.query.get(id)\n\n db.session.delete(car)\n db.session.commit()\n\n return carSchema.jsonify(car)",
"def test_delete_car_valid_id():\n initial_number_of_cars = len(client.get(\"/\").json())\n\n response = client.delete(\"/1\")\n assert response.status_code == STAT... | [
"0.8185845",
"0.7373735",
"0.72583807",
"0.70575875",
"0.67972386",
"0.67968684",
"0.67750496",
"0.6759448",
"0.6742534",
"0.6725134",
"0.6653738",
"0.6637086",
"0.6585412",
"0.6579141",
"0.65774304",
"0.657693",
"0.6498493",
"0.64876956",
"0.6442214",
"0.6414477",
"0.6407549... | 0.8570252 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.