query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Return the config this pressure regulator | def _get_conf(self):
self.press_conf = self.sysconf['PressureRegulators']
return self.press_conf['PressureRegulator%d' % self.id_] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getConfig(self):\n return self.cp",
"def get_config(self):\n if self.allow_reco():\n return self.chs_config()\n else:\n return self.get_config_j(self.id)",
"def config(self):\n return self[CONFIG_KEY]",
"def get_config(self):\n return self.config",... | [
"0.7364102",
"0.7162993",
"0.70298266",
"0.70129544",
"0.68971854",
"0.6864645",
"0.68532395",
"0.68102187",
"0.67950267",
"0.67949224",
"0.6758253",
"0.6717158",
"0.6702697",
"0.6646132",
"0.6629755",
"0.66264457",
"0.66105473",
"0.66105473",
"0.65918076",
"0.65671664",
"0.6... | 0.80336404 | 0 |
Test adding tags for the same image on different systems. | def test_add_same_image_two_system(self):
record = self.good_record()
record['tag'] = self.tag
# Create a fake record in mongo
id1 = self.images.insert(record.copy())
# add testtag for systema
status = self.m.add_tag(id1, self.system, 'testtag')
self.assertTrue(st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tag_valid_image(self):\n alpine = self.docker.images.get(constant.ALPINE)\n self.assertTrue(alpine.tag(\"demo\", constant.ALPINE_SHORTNAME))\n\n alpine = self.docker.images.get(constant.ALPINE)\n for tag in alpine.tags:\n self.assertIn(\"alpine\", tag)",
"def test_... | [
"0.75611115",
"0.72333485",
"0.704776",
"0.67949885",
"0.6753016",
"0.6734491",
"0.67330766",
"0.6697126",
"0.66869664",
"0.66498786",
"0.662864",
"0.65521395",
"0.6549868",
"0.65104306",
"0.6508785",
"0.64903665",
"0.64876723",
"0.64101654",
"0.6354522",
"0.63456297",
"0.632... | 0.7190431 | 2 |
Checks if two numerical objects are equal. | def allequal(a, b, flavor="numpy"):
# print("a-->", repr(a))
# print("b-->", repr(b))
if not hasattr(b, "shape"):
# Scalar case
return a == b
if ((not hasattr(a, "shape") or a.shape == ()) and
(not hasattr(b, "shape") or b.shape == ())):
return a == b
if a.shap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def almost_equals(self, other, decimal=...): # -> bool:\n ...",
"def __eq__(self, other):\n return abs(self - other) < 10e-10",
"def __eq__(self, other):\n firstnum = self.num*other.den\n secondnum = self.den*other.num\n\n return firstnum == secondnum",
"def __eq__(self,ot... | [
"0.7246507",
"0.7225622",
"0.7159263",
"0.7139542",
"0.7132195",
"0.7044081",
"0.7033474",
"0.70318377",
"0.70144206",
"0.6970927",
"0.6961681",
"0.69399214",
"0.69315916",
"0.6911886",
"0.6875946",
"0.68719536",
"0.6852595",
"0.68454874",
"0.67935365",
"0.6788172",
"0.676942... | 0.0 | -1 |
Get the name of the method currently running in the test case. | def _getMethodName(self):
return self.id().split('.')[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getcurrentmethod(self):\n if self._methodname == None:\n print(\"No method defined.\")\n else:\n return self._methodname",
"def current_method_name():\n return inspect.currentframe().f_back.f_code.co_name",
"def get_method_name(self):\n\t\treturn self.method_name",
... | [
"0.82925445",
"0.81650645",
"0.7900149",
"0.7823562",
"0.73134035",
"0.72436297",
"0.72393906",
"0.71738243",
"0.7155481",
"0.70777166",
"0.7024848",
"0.6986332",
"0.6963352",
"0.6940749",
"0.6940749",
"0.6851649",
"0.6832518",
"0.6806613",
"0.67740643",
"0.67095894",
"0.6680... | 0.7778627 | 4 |
Renders the home page. | def home(request):
key = '000102030405060708090A0B0C0D0E0F'
nonce = 'BBAA99887766554433221103'
associated = ''
#if request.GET.get('U'):
# message = 'You submitted: %r' % request.GET['U']
#else:
# message = 'You submitted nothing'
#UID = ''+request.GET.get('U').upper().encode()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.0 | -1 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
{
'title':'About',
'message':'Your application description page.',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85651284",
"0.85034347",
"0.844895",
"0.84050864",
"0.8394327",
"0.82936406",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.827099",
"0.82678735",
"0.82434386",
"0.823932... | 0.7612725 | 73 |
Returns the probability of the given symbol sequence. If the sequence is labelled, then returns the joint probability of the symbol, state sequence. Otherwise, uses the forward algorithm to find the probability over all label sequences. | def probability(self, sequence):
return 2 ** (self.log_probability(self._transform(sequence))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prob(self, sequence):\n prob = 1\n for event, context in self.extract_ngrams(sequence):\n prob *= self.cond_prob(event, context)\n return prob",
"def compute_probability_of_state(state):\n p = compute_log_probability_of_text(state[\"text\"], state[\"char_to_ix\"], \n ... | [
"0.68839604",
"0.6499277",
"0.6472834",
"0.6328833",
"0.61921704",
"0.5998444",
"0.5985997",
"0.5931303",
"0.5879241",
"0.5799542",
"0.57469636",
"0.56880707",
"0.568152",
"0.56542677",
"0.5649391",
"0.56468433",
"0.56374705",
"0.5614503",
"0.5577622",
"0.5522938",
"0.5519233... | 0.6490703 | 2 |
Returns the entropy over labellings of the given sequence. This is | def entropy(self, unlabeled_sequence):
unlabeled_sequence = self._transform(unlabeled_sequence)
T = len(unlabeled_sequence)
N = len(self._states)
alpha = self._forward_probability(unlabeled_sequence)
beta = self._backward_probability(unlabeled_sequence)
normalisation = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence_entropy(sequence):\n c = Counter(sequence.upper())\n tot = float(sum(c.values()))\n c = {k: v / tot for k, v in c.items()}\n return -1 * sum(c * np.log2(c) for b, c in c.items())",
"def get_entropy(self, rows):\n label_count = defaultdict(int)\n total_count = 0\n for... | [
"0.79127014",
"0.7532878",
"0.73214394",
"0.720897",
"0.71098214",
"0.7071864",
"0.702859",
"0.6960563",
"0.691392",
"0.69071317",
"0.6846925",
"0.68352145",
"0.68168706",
"0.67918366",
"0.6785051",
"0.67221826",
"0.6721118",
"0.6699978",
"0.667438",
"0.6671003",
"0.66579336"... | 0.78193897 | 1 |
Returns the pointwise entropy over the possible states at each position in the chain, given the observation sequence. | def point_entropy(self, unlabeled_sequence):
unlabeled_sequence = self._transform(unlabeled_sequence)
T = len(unlabeled_sequence)
N = len(self._states)
alpha = self._forward_probability(unlabeled_sequence)
beta = self._backward_probability(unlabeled_sequence)
normalisat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entropy(self, unlabeled_sequence):\n unlabeled_sequence = self._transform(unlabeled_sequence)\n\n T = len(unlabeled_sequence)\n N = len(self._states)\n\n alpha = self._forward_probability(unlabeled_sequence)\n beta = self._backward_probability(unlabeled_sequence)\n nor... | [
"0.71834224",
"0.6821405",
"0.6642767",
"0.6528834",
"0.6441101",
"0.6433605",
"0.6428668",
"0.64260423",
"0.63964605",
"0.638001",
"0.63366336",
"0.6313555",
"0.6309273",
"0.6305014",
"0.6301187",
"0.6290599",
"0.6287545",
"0.6270159",
"0.62573195",
"0.6236785",
"0.62110555"... | 0.75228584 | 0 |
Supervised training maximising the joint probability of the symbol and state sequences. This is done via collecting frequencies of transitions between states, symbol observations while within each state and which states start a sentence. These frequency distributions are then normalised into probability estimates, whic... | def train_supervised(self, labelled_sequences, estimator=None):
# default to the MLE estimate
if estimator is None:
estimator = lambda fdist, bins: MLEProbDist(fdist)
# count occurrences of starting states, transitions out of each state
# and output symbols observed in each... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_hmm_params(state_sequences, pseudocount=1, moving=True, time_sigma=1):\n state_sequences = numpy.asarray(state_sequences)\n n, t = state_sequences.shape\n s = state_sequences.max() + 1 # number of states\n initial_counts = numpy.bincount(state_sequences[:,0], minlength=s) + pseudocount\n ... | [
"0.65054643",
"0.6471151",
"0.62719405",
"0.61039656",
"0.6078046",
"0.6046927",
"0.6046126",
"0.59930086",
"0.59897006",
"0.5960667",
"0.5952568",
"0.5944236",
"0.5936748",
"0.5870317",
"0.58509916",
"0.58415407",
"0.5822081",
"0.5807926",
"0.579743",
"0.57895184",
"0.578428... | 0.0 | -1 |
self <= other If has smaller guarantees and bigger assumptions | def __le__(self, other):
if self.assumptions >= other.assumptions and self.guarantees <= other.guarantees:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__(self, other):\n return not self <= other",
"def __gt__(self, other):\n return not (self <= other)",
"def __ge__(self, other):\n return other <= self",
"def __gt__(self, other):\n return self >= other and not self <= other",
"def __gt__(self, other):\n return ot... | [
"0.8116965",
"0.80971444",
"0.8062258",
"0.8019732",
"0.80024683",
"0.79757977",
"0.7962772",
"0.7962772",
"0.79600155",
"0.7896681",
"0.78799975",
"0.78799975",
"0.78704715",
"0.78632945",
"0.77820885",
"0.7766774",
"0.7763486",
"0.7763486",
"0.77383524",
"0.77357376",
"0.77... | 0.8150679 | 0 |
Name of the claim. | def name(self) -> Optional[str]:
return pulumi.get(self, "name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def claim_id(self) -> str:\n return self._claim_id",
"def claim_id(self) -> str:\n return self._claim_id",
"def name(self) -> str:\n return pulumi.get(self, \"name\")",
"def name(self) -> str:\n return pulumi.get(self, \"name\")",
"def name(self) -> str:\n return pulumi.g... | [
"0.69480026",
"0.69480026",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
"0.6939856",
... | 0.0 | -1 |
Status of the claim. | def status(self) -> str:
return pulumi.get(self, "status") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Status(self):\r\n\t\treturn self._get_attribute('status')",
"def status(self):\n return self.status",
"def Status(self):\n return self._get_attribute('status')",
"def status(self):\n\t\treturn self._status",
"def status(self):\r\n return self._status",
"def status(self):\r\n ... | [
"0.69229513",
"0.6906016",
"0.6884428",
"0.6883107",
"0.6882165",
"0.6882165",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
"0.6870787",
... | 0.6883289 | 17 |
XX Transformation on Top 3 Percentage after T3 Parameter | def PP_FH_T3P_T3_TRS(Dataframe):
Feature_DF = Dataframe.loc[:,['HNAME','PP_FH_T3P_T3']]
Feature_DF.loc[:,'PP_FH_T3P_T3_TRS'] = Feature_DF.loc[:,'PP_FH_T3P_T3'].apply(lambda x : (1+x)**(-9/4))
Feature_DF = Feature_DF.loc[:,['HNAME','PP_FH_T3P_T3_TRS']]
return Feature_DF | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def t3(df, price, t3, n, v_factor=0.7):\n\n def gd(df, price, gd, n):\n df = ema(df, price, gd + \"_ema\", n)\n df = ema(df[n - 1 :], gd + \"_ema\", gd + \"_ema_2\", n)\n df[gd] = (1 + v_factor) * df[gd + \"_ema\"] - v_factor * df[\n gd + \"_ema_2\"\n ]\n df = df.dr... | [
"0.5856855",
"0.56863564",
"0.5594318",
"0.5594318",
"0.53349996",
"0.53150386",
"0.5283696",
"0.5271115",
"0.52598387",
"0.5250857",
"0.52461076",
"0.5236481",
"0.5233829",
"0.516889",
"0.51579803",
"0.5129075",
"0.5117188",
"0.5107475",
"0.5086285",
"0.505564",
"0.5055015",... | 0.49407262 | 29 |
Returns a list of all layers as GiraffeLayer objects. | def get_all(self):
layer_names = rs.LayerNames()
layers = []
for layer_name in layer_names:
layer = GiraffeLayer(layer_name)
layers.append(layer)
return layers | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_structural(self):\n\n layer_names = rs.LayerNames()\n\n layers = []\n\n for layer_name in layer_names:\n\n layer = GiraffeLayer(layer_name)\n \n if layer.is_structural():\n\n layers.append(layer)\n\n # sort layers to make sure numb... | [
"0.79669935",
"0.7171498",
"0.70627826",
"0.70416015",
"0.6986805",
"0.6780714",
"0.6766127",
"0.67393017",
"0.6716084",
"0.6710214",
"0.6704702",
"0.6668216",
"0.66612744",
"0.6653154",
"0.6581886",
"0.6533086",
"0.6517881",
"0.6508187",
"0.64933634",
"0.64700365",
"0.641920... | 0.92332536 | 0 |
Returns a list of all layers containing structural geometry GiraffeLayer objects. | def get_all_structural(self):
layer_names = rs.LayerNames()
layers = []
for layer_name in layer_names:
layer = GiraffeLayer(layer_name)
if layer.is_structural():
layers.append(layer)
# sort layers to make sure numbered nodes are adde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all(self):\n\n layer_names = rs.LayerNames()\n\n layers = []\n\n for layer_name in layer_names:\n\n layer = GiraffeLayer(layer_name)\n \n layers.append(layer)\n\n return layers",
"def get_layers(self):\n layers = set()\n for element i... | [
"0.75777113",
"0.7088463",
"0.69397646",
"0.6882227",
"0.68685305",
"0.68376607",
"0.68082297",
"0.6729954",
"0.6685632",
"0.66477555",
"0.65172905",
"0.63729656",
"0.6323629",
"0.6323134",
"0.6298923",
"0.62672704",
"0.62451935",
"0.62417066",
"0.6195974",
"0.6191396",
"0.61... | 0.7833516 | 0 |
Returns group number from layer; 1 if not specified. | def get_grp(self):
grp = -1
if self.depth > 2:
inp = ri.RhinoInput(self.path[2])
grp = inp.get_no()
return grp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groupnumber(self):\n return self._groupnumber",
"def get_layer_uid(layer_name=''):\n if layer_name not in _LAYER_UIDS:\n _LAYER_UIDS[layer_name] = 1\n return 1\n else:\n _LAYER_UIDS[layer_name] += 1\n return _LAYER_UIDS[layer_name]",
"def get_layer_uid(layer_name=''... | [
"0.7192667",
"0.6920197",
"0.6920197",
"0.6920197",
"0.69140816",
"0.6823321",
"0.6754982",
"0.6703755",
"0.66476613",
"0.6625472",
"0.65048903",
"0.6455445",
"0.64536494",
"0.64536494",
"0.64536494",
"0.6442686",
"0.64387804",
"0.6438356",
"0.64313877",
"0.64016515",
"0.6356... | 0.6814648 | 6 |
Returns a string representation of the group number (e.g. 'grp 2'). | def get_grp_string(self):
grp = self.get_grp()
if grp == -1:
return ""
return "grp " + str(grp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return str(self.group)",
"def groupnumber(self):\n return self._groupnumber",
"def group(self):\n return self.tr(self.groupId())",
"def group(self):\n return self.tr(self.groupId())",
"def group(self):\n return self.tr(self.groupId())",
"def group(... | [
"0.7552225",
"0.74796945",
"0.7341174",
"0.7341174",
"0.7341174",
"0.7341174",
"0.73225874",
"0.730608",
"0.72892374",
"0.72892374",
"0.7236151",
"0.711732",
"0.711387",
"0.7096566",
"0.7085367",
"0.70578635",
"0.6985835",
"0.6969956",
"0.69641614",
"0.69641614",
"0.6947814",... | 0.88940936 | 0 |
Returns group name from layer (last child only). | def get_name(self):
return ri.RhinoInput(self.last).get_name() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_group(self):\n return BaseLayer.groups-1",
"def get_group_name(self):\n return self.groupname",
"def getName(self):\n return _libsbml.Group_getName(self)",
"def group_name(self):\n\n return self._group_name",
"def group_name(self) -> str:\n return pulumi.get(self... | [
"0.7325166",
"0.71610826",
"0.6897385",
"0.6894295",
"0.6817255",
"0.6807535",
"0.67075425",
"0.66837865",
"0.65827185",
"0.6576098",
"0.654753",
"0.654753",
"0.654753",
"0.654753",
"0.65430963",
"0.65301126",
"0.6506161",
"0.6467307",
"0.6436257",
"0.6436257",
"0.6415069",
... | 0.0 | -1 |
Returns True if node overlaps with specified node (distance smaller than tolerance). | def identical_to(self, n):
return (self.distance_to(n) < gc.tolerance) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def within_tolerance(x, y, tolerance): \r\n return abs(x) <= tolerance and abs(y) <= tolerance",
"def add_or_find_node(self,x,tolerance=0.0,**kwargs):\n hit=self.select_nodes_nearest(x)\n if hit is not None:\n dist = mag( x - self.nodes['x'][hit] )\n if dist<=tolerance:\... | [
"0.6222662",
"0.6040541",
"0.60179216",
"0.5998821",
"0.59777945",
"0.5946743",
"0.5881702",
"0.5812505",
"0.5799818",
"0.5798592",
"0.5772407",
"0.5759526",
"0.5742526",
"0.5739809",
"0.5734192",
"0.56595534",
"0.5651255",
"0.56475025",
"0.56287694",
"0.56274414",
"0.5546057... | 0.5362141 | 33 |
Returns True if node overlaps with specified node (distance smaller than tolerance). | def identical_to(self, elem):
return (self.n == elem.n) and (math.fabs(self.dx - elem.dx) < 0.001) and (math.fabs(self.dy - elem.dy) < 0.001) and (math.fabs(self.dz - elem.dz) < 0.001) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def within_tolerance(x, y, tolerance): \r\n return abs(x) <= tolerance and abs(y) <= tolerance",
"def add_or_find_node(self,x,tolerance=0.0,**kwargs):\n hit=self.select_nodes_nearest(x)\n if hit is not None:\n dist = mag( x - self.nodes['x'][hit] )\n if dist<=tolerance:\... | [
"0.62235373",
"0.60417277",
"0.6017198",
"0.59962267",
"0.59748036",
"0.59469044",
"0.5881697",
"0.58102363",
"0.5799841",
"0.57990503",
"0.57735866",
"0.57579315",
"0.574236",
"0.57410544",
"0.5733932",
"0.5657837",
"0.56493354",
"0.5645117",
"0.56286967",
"0.56271154",
"0.5... | 0.0 | -1 |
Gets point on element. | def get_point_on(self, s):
x = self.n1.x * (1 - s) + self.n2.x * s
y = self.n1.y * (1 - s) + self.n2.y * s
z = self.n1.z * (1 - s) + self.n2.z * s
return [x, y, z] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_point(self):\n return self.point",
"def getPoint(self):\n return self.point",
"def getPoint(self):\n return self.point",
"def getPoint(self):\n return self._point",
"def get_point(self):\n return self._x, self._y",
"def point(self) -> Point:\n return self... | [
"0.835847",
"0.82616526",
"0.82616526",
"0.81159586",
"0.7725062",
"0.7648367",
"0.76407677",
"0.7176387",
"0.7162149",
"0.7142321",
"0.71152306",
"0.7036916",
"0.7003902",
"0.6928432",
"0.6897619",
"0.68819773",
"0.68799776",
"0.68776673",
"0.6852355",
"0.68474734",
"0.68434... | 0.0 | -1 |
Returns true for overlapping line elements (identical start and endnodes). | def identical_to(self, elem):
return (self.n1 == elem.n1) and (self.n2 == elem.n2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n line1 = Line(1, 5)\n line2 = Line(5, 8)\n print(LineUtil.is_overlap(line1, line2))",
"def is_overlap(line1, line2):\n if line1.p1 < line2.p1 and line1.p2 <= line2.p1:\n # if line 1 lies to the left of line 2 return false.\n return False\n elif line1.p1 <... | [
"0.7314831",
"0.7264755",
"0.703308",
"0.69608694",
"0.6934424",
"0.6931716",
"0.69141126",
"0.6851039",
"0.6838046",
"0.67416203",
"0.67291987",
"0.67214185",
"0.6697512",
"0.66692203",
"0.6656751",
"0.66246486",
"0.6600144",
"0.65877837",
"0.65746444",
"0.65007037",
"0.6498... | 0.0 | -1 |
Returns true for overlapping line elements (identical start and endnodes). | def identical_to(self, elem):
return (self.n1 == elem.n1) and (self.n2 == elem.n2) and (self.n3 == elem.n3) and (self.n4 == elem.n4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n line1 = Line(1, 5)\n line2 = Line(5, 8)\n print(LineUtil.is_overlap(line1, line2))",
"def is_overlap(line1, line2):\n if line1.p1 < line2.p1 and line1.p2 <= line2.p1:\n # if line 1 lies to the left of line 2 return false.\n return False\n elif line1.p1 <... | [
"0.7315853",
"0.7266369",
"0.70323503",
"0.6961533",
"0.69358623",
"0.6933298",
"0.6915751",
"0.68520886",
"0.6838582",
"0.67419267",
"0.67303336",
"0.6722234",
"0.6698242",
"0.66697013",
"0.66577274",
"0.66251487",
"0.6600332",
"0.65885097",
"0.65754807",
"0.6501691",
"0.649... | 0.0 | -1 |
Returns first element in the list that is identical to the specified element. Returns None if none found. | def get_identical_to(self, element):
already_in_list = False
for item in self._list:
if element.identical_to(item):
return item
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FindElement(self, element):\r\n for eachElement in self.__listOfElements:\r\n if eachElement == element:\r\n return eachElement\r\n raise RepositoryError(\"Inexisting Element\")",
"def first(l):\n return next(iter(l), None)",
"def find(self, item):\n cur = ... | [
"0.6928628",
"0.6664379",
"0.6614283",
"0.6515508",
"0.65057755",
"0.645102",
"0.63338006",
"0.63242817",
"0.63242817",
"0.62833655",
"0.6239928",
"0.6193401",
"0.6154385",
"0.6135455",
"0.61287624",
"0.61195546",
"0.6109622",
"0.59877133",
"0.59846914",
"0.5965998",
"0.59646... | 0.8181914 | 0 |
Split a bit array into ints. | def splitint(ba):
l = []
# TODO: Endianness
for ba in WeirdBytes.split(ba):
l.append(ba[0] * 256 + ord(ba[1:].tobytes()))
return l | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_bits_bit_array(x, bit_array):\n\n mask = bit_array - 1\n\n lower = x & mask\n upper = x & ~mask\n\n return lower, upper",
"def _split_bits(i: int) -> typing.Tuple[bool, bool, bool, bool, bool, bool, bool, bool]:\n\t\n\tassert i in range(256)\n\treturn (\n\t\tbool(i & (1 << 7)),\n\t\tbool(i ... | [
"0.73277426",
"0.68412477",
"0.6565105",
"0.62031746",
"0.6179825",
"0.6056002",
"0.60511047",
"0.5958182",
"0.5899734",
"0.5797293",
"0.5795561",
"0.5706004",
"0.56279415",
"0.56251097",
"0.5550867",
"0.5531118",
"0.5530149",
"0.5521462",
"0.5501583",
"0.5497111",
"0.5484639... | 0.6734039 | 2 |
Create a new term with this symbol as the root. | def __call__(self, *args: TermLike) -> 'Term':
return Term(self, args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_root_symbols(self):\n RootSymbol = Symbol(Token(None,None,'R00t.Symbol'))\n RootSymbol.GlobalSymbolDict=self.GlobalSymbolDict\n StartDocSymbol = Symbol(Token(None,None,'%^'))\n StartDocSymbol.regex = Set('%^')\n StartDocSymbol.is_lit = True\n StartDocSymbol.Glob... | [
"0.6450101",
"0.6105432",
"0.6082891",
"0.60292435",
"0.6014609",
"0.5968481",
"0.59280413",
"0.5869991",
"0.58518934",
"0.5846083",
"0.58154607",
"0.58072805",
"0.5803352",
"0.5803352",
"0.5755001",
"0.5751741",
"0.57507956",
"0.57272995",
"0.5722304",
"0.5710949",
"0.569907... | 0.6155234 | 1 |
Return an iterator of the variables in this object. The same variable may be yielded in any order and may appear multiple | def variables(value: SupportsVariables) -> Iterator[Variable]:
try:
return value._variables()
except AttributeError:
raise TypeError(f'object of type {type(value).__name__} has no variables()') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variableIter(self):\n for (para, start), variable in self.variables.iteritems():\n yield para, start, variable",
"def __iter__(self) -> Iterable[MemoryVariable]:\n return iter(self.variables)",
"def __iter__(self):\n return (x for x in vars(self))",
"def __iter__(self):\n ... | [
"0.8414037",
"0.7844284",
"0.7725696",
"0.7643488",
"0.744267",
"0.7426621",
"0.7168361",
"0.71665126",
"0.7165517",
"0.7071918",
"0.7046949",
"0.68584573",
"0.6846193",
"0.67662907",
"0.6573478",
"0.6548196",
"0.65226144",
"0.65035176",
"0.64988697",
"0.6410619",
"0.6405992"... | 0.68935907 | 11 |
Return the number of positions in this term. | def __len__(self) -> int:
return 1 + sum(len(child) for child in self.children) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_position_count(self):\n return self.positions.count()",
"def getNumPositions(self, rings=None):\n if rings is None:\n rings = self.i1\n return sum(self.getNumPosInRing(ringNum) for ringNum in range(rings + 1))",
"def position(self):\n return len(self) #, len(self.... | [
"0.81835973",
"0.68556446",
"0.685382",
"0.6821072",
"0.6816034",
"0.68041867",
"0.67467004",
"0.67251",
"0.6670175",
"0.6643238",
"0.66113096",
"0.66113096",
"0.6597022",
"0.6544887",
"0.653452",
"0.65257496",
"0.6520335",
"0.6490746",
"0.64888775",
"0.6471186",
"0.64597875"... | 0.0 | -1 |
Return whether this substitution maps the given variable. | def __contains__(self, variable: Variable) -> bool:
return variable in self.mapping | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_assignment_for(self, var):\n return self.variable_to_value.get(var) != None",
"def __contains__(self, var: object) -> builtins.bool:\n if isinstance(var, str):\n if var and var[0] == '$':\n var = var[1:]\n return var.casefold() in self._fixup\n re... | [
"0.6323309",
"0.6204919",
"0.6058787",
"0.6035251",
"0.60158265",
"0.60059625",
"0.598844",
"0.5920656",
"0.58932817",
"0.5816335",
"0.5807873",
"0.5797708",
"0.57731915",
"0.56832165",
"0.5679164",
"0.5656838",
"0.5631099",
"0.5553596",
"0.5545783",
"0.5482354",
"0.54695636"... | 0.76077884 | 0 |
Return the number of variables explicitly mapped by this substitution. | def __len__(self) -> int:
return len(self.mapping) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_vars(self):\n return self.nvars",
"def nVariables(self):\n return len(self.variables)",
"def num_vars(self):\n return len(self.bounds.lb)",
"def num_vars(self):\n return self._nvars",
"def get_num_variables(self):\n return len(self.variables)",
"def nvar(self):\... | [
"0.77121",
"0.77020174",
"0.7688018",
"0.7680288",
"0.7653693",
"0.75567627",
"0.7534869",
"0.71056914",
"0.70670295",
"0.70512265",
"0.7041865",
"0.69848734",
"0.68954927",
"0.6884084",
"0.68595517",
"0.66598195",
"0.6646155",
"0.660915",
"0.6536152",
"0.6432906",
"0.6418905... | 0.59523016 | 40 |
Compute the losses related to the bounding boxes, the L1 regression loss and the GIoU loss targets dicts must contain the key "boxes" containing a tensor of dim [nb_target_boxes, 4] The target boxes are expected in format (center_x, center_y, h, w), normalized by the image size. | def loss_boxes(self, outputs, targets, indices, num_boxes):
assert "pred_boxes" in outputs
idx = self._get_src_permutation_idx(indices)
src_boxes = outputs["pred_boxes"][idx]
target_boxes = torch.cat([t["boxes"][i] for t, (_, i) in zip(targets, indices)], dim=0)
loss_bbox = F.l1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss_boxes(self, outputs, targets, indices, num_boxes):\n assert 'pred_boxes' in outputs\n idx = self._get_src_permutation_idx(indices)\n src_boxes = outputs['pred_boxes'][idx]\n tgt_idx = [i[torch.where(i >= 0)[0]] for i in indices]\n target_boxes = torch.cat([t['boxes'][i] ... | [
"0.7716223",
"0.7665465",
"0.7585646",
"0.7569419",
"0.7256136",
"0.7181975",
"0.6731168",
"0.65823036",
"0.63735175",
"0.635332",
"0.63450617",
"0.63165164",
"0.6277394",
"0.6242719",
"0.6242719",
"0.61979765",
"0.6173729",
"0.6136315",
"0.61252975",
"0.61077106",
"0.6102318... | 0.7613895 | 2 |
Builds .csv used to test the model on a single song | def create_song_feats(path):
features = read_process_song(path, debug=True)
df = pd.DataFrame(features)
df.to_csv('./Features/single_song_features/song_features.csv', index=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_csv(self, verbose: bool = False) -> None: \n Path(self.csv_dir).mkdir(exist_ok=True)\n with open(f\"{self.csv_dir}/train.csv\", \"wt\", encoding=\"utf-8\", newline=\"\") as train_file:\n with open(f\"{self.csv_dir}/test.csv\", \"wt\", encoding=\"utf-8\", newline=\"\") a... | [
"0.63500184",
"0.616128",
"0.6114967",
"0.6078611",
"0.6057715",
"0.60389507",
"0.60370547",
"0.59869236",
"0.59596616",
"0.5944694",
"0.5932446",
"0.5913824",
"0.5890918",
"0.587931",
"0.57506084",
"0.5742212",
"0.5732016",
"0.57085234",
"0.5670833",
"0.5617694",
"0.560411",... | 0.612877 | 2 |
Test what the server's preferred cipher is when a client will accept all ciphers. | def test_preferred_cipher(host, method):
ssl_method = getattr(SSL, method.replace('.', '_') + '_METHOD')
context = SSL.Context(ssl_method)
context.set_cipher_list("ALL:COMPLEMENTOFALL")
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
sock = SSL.Connection(context, sock)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_result(self):\n connection = Connection(Context(SSLv23_METHOD), None)\n ciphers = connection.get_cipher_list()\n assert isinstance(ciphers, list)\n for cipher in ciphers:\n assert isinstance(cipher, str)",
"def test_single_cipher(host, method, cipher):\n ssl_met... | [
"0.6985817",
"0.65768576",
"0.6492589",
"0.64127094",
"0.64127094",
"0.6362245",
"0.6303513",
"0.6250056",
"0.61485523",
"0.6106125",
"0.6083616",
"0.6069483",
"0.60153574",
"0.60078907",
"0.5981133",
"0.5969831",
"0.5921775",
"0.57993746",
"0.57654536",
"0.5762733",
"0.57606... | 0.77433765 | 0 |
Packs the object class into a flatbuffer and loads it into a buf class. | def _pack_and_load_buf_class(self, monsterT):
b = flatbuffers.Builder(0)
b.Finish(monsterT.Pack(b))
monster = _MONSTER.Monster.GetRootAs(b.Bytes, b.Head())
return monster | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _packb2(obj, **options):\n fp = io.BytesIO()\n _pack2(obj, fp, **options)\n return fp.getvalue()",
"def _tobuffer(self, object_):\n\n raise NotImplementedError",
"def _packb3(obj, **options):\n fp = io.BytesIO()\n _pack3(obj, fp, **options)\n return fp.getvalue()",
"def serialize... | [
"0.6267611",
"0.62357104",
"0.61939365",
"0.6162604",
"0.6131656",
"0.6044398",
"0.6039254",
"0.60138",
"0.6002598",
"0.59820473",
"0.5959682",
"0.5958311",
"0.5919625",
"0.59124446",
"0.59067434",
"0.59009355",
"0.58377874",
"0.5808121",
"0.5803058",
"0.579564",
"0.5787495",... | 0.7002983 | 0 |
Set an observation field (value) on an observation. Will fail if this observation field is already set for this observation. | def put_observation_field_values(
observation_id: int,
observation_field_id: int,
value: Any,
access_token: str,
user_agent: str = None,
) -> JsonResponse:
# TODO: Also implement a put_or_update_observation_field_values() that deletes then recreates the field_value?
# TODO: Return some meani... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_value(self, field, value):\n field = self.find_first(field)\n if field is not None:\n field.value = value",
"def _setValue(self, field, value):\n self._contents[field] = value",
"def setfield(self, field, value):\n self.__setitem__(field, value)",
"def setFieldV... | [
"0.71760434",
"0.69998103",
"0.66731304",
"0.6571199",
"0.6310081",
"0.6297575",
"0.6287574",
"0.62096095",
"0.6205896",
"0.620086",
"0.61494344",
"0.6133556",
"0.60556406",
"0.6050824",
"0.6024566",
"0.60107625",
"0.5986964",
"0.59416837",
"0.59341383",
"0.5932015",
"0.59310... | 0.7203113 | 0 |
Add member to an existing legacy with the given ``id``. | def add_members(id): # pylint: disable=I0011,W0622
l = Legacy.query.get_or_404(id)
if current_app.config.get('IGNORE_AUTH') is not True: # pragma: no cover
if l.owner_id != g.user.id:
raise Http403('Access denied')
if not l.can_modify(g.user.id):
raise Http403('Acces... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_member_by_id_to_group(self):\n pass",
"def test_add_member_by_id_to_group1(self):\n pass",
"def add_member_to_group(self, group_id, member_id):\n route_values = {}\n if group_id is not None:\n route_values['groupId'] = self._serialize.url('group_id', group_id... | [
"0.6556188",
"0.6377354",
"0.61756414",
"0.60752475",
"0.59395975",
"0.58920157",
"0.58600855",
"0.5701118",
"0.56903875",
"0.5546106",
"0.5508893",
"0.54982805",
"0.54884595",
"0.54678047",
"0.546401",
"0.5462977",
"0.545927",
"0.54212016",
"0.5406761",
"0.5406584",
"0.53980... | 0.64171326 | 1 |
returns the serial number of CommCell | def serial_number(self):
return self._serialno | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commcell_id(self):\n return self._commcell_id",
"def serial_num(self) -> int:\n return self._serial_num",
"def get_serial_number(self):\n\n\t\treturn struct.unpack('<Q', self.boot_sector_data[72 : 80])[0]",
"def getSerialNumber(self):\n address = [op.BootloaderMemoryRegions.EEPROM,0,... | [
"0.76603115",
"0.7385171",
"0.71359926",
"0.6958152",
"0.6900556",
"0.6818933",
"0.68054515",
"0.67963517",
"0.6761389",
"0.6666167",
"0.6642223",
"0.6635861",
"0.6606503",
"0.65657973",
"0.6565521",
"0.6547258",
"0.6459553",
"0.6456449",
"0.6456449",
"0.644271",
"0.6413664",... | 0.73062015 | 2 |
Converts string values to decimal | def str_to_decimal(self, decimal_str, key, enforce_row_break=False):
break_err = False
break_err_msg = ""
try:
decimal_value = Decimal(decimal_str)
except Exception as err:
if key == "Payment Amount" and decimal_str == "":
decimal_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_price(str_val):\n return float(str_val.replace('.', '').replace(',', '.'))",
"def convert(self, value):\n return self.ASCIIToDecimal(value)",
"def strToDec(string):\n\tstring = string.lstrip(\"0\")\n\tif len(string) == 0:\n\t\treturn 0\n\telse:\n\t\treturn eval(string)",
"def str_to_decimal... | [
"0.70377254",
"0.69351965",
"0.67682767",
"0.67324036",
"0.657888",
"0.6574748",
"0.6456516",
"0.6446038",
"0.6415506",
"0.64003366",
"0.6391353",
"0.63884366",
"0.6189878",
"0.61835194",
"0.6160136",
"0.60959184",
"0.60900253",
"0.60620433",
"0.6057923",
"0.60459054",
"0.603... | 0.6477078 | 6 |
Compute accuracy for a batch of labels and predictions. Each element is treated as an example. | def compute_accuracy(labels=None, predictions=None):
labels = np.array(labels, dtype=np.int32)
if len(labels.shape) == 2:
labels = np.argmax(labels, -1)
return np.sum(np.equal(labels, predictions)) / np.size(labels) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(preds, labels):\n correct = preds == labels\n return correct.sum().float() / correct.shape[0]",
"def accuracy(labels, predictions, n_classes):\n\t\tequality = tf.equal(x = predictions, y = labels) # match the type of labels\n\t\treturn tf.reduce_mean(tf.cast(equality, tf.float32))",
... | [
"0.8135272",
"0.8097308",
"0.79288477",
"0.78843224",
"0.7865152",
"0.78462017",
"0.7840848",
"0.78369653",
"0.7820592",
"0.77736133",
"0.7760978",
"0.7689005",
"0.7673955",
"0.7671619",
"0.7647355",
"0.76070946",
"0.7597386",
"0.75773644",
"0.75752765",
"0.7569619",
"0.75567... | 0.80671287 | 2 |
new model instance without making it persistence inst = User.new(name='John Read') inst.name = 'Read John' update name later | def new(cls, **kwargs):
return cls(**kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_object(self, attrs, instance=None):\n if instance:\n # Update existing instance\n instance.username = attrs.get('username', instance.username)\n instance.first_name = attrs.get('first_name', instance.first_name)\n instance.last_name = attrs.get('last_n... | [
"0.68109316",
"0.6505687",
"0.6357072",
"0.6275481",
"0.6273771",
"0.62523466",
"0.624619",
"0.62446755",
"0.624303",
"0.61602557",
"0.60692024",
"0.6023681",
"0.6005055",
"0.59828675",
"0.596291",
"0.5943477",
"0.59244114",
"0.5902789",
"0.58922374",
"0.58499134",
"0.5843217... | 0.0 | -1 |
Returns a dictionary mapping the promoted names of all inputs in a system to their associated metadata. | def get_promoted_vars(ode, iotypes, metadata_keys=None, get_remote=True):
_iotypes = (iotypes,) if isinstance(iotypes, str) else iotypes
return {opts['prom_name']: opts for opts in ode.get_io_metadata(iotypes=_iotypes, get_remote=get_remote,
me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_inputs():\n inputs = {}\n for obj in vars(acsploit.input).values():\n if hasattr(obj, 'INPUT_NAME'):\n inputs[obj.INPUT_NAME] = obj\n\n return inputs",
"def get_input_metadata(self):\n return []",
"def as_dict(self):\n for k, v in zip(self._input_names, self._flatte... | [
"0.6233568",
"0.61666703",
"0.5987027",
"0.58523077",
"0.5706986",
"0.56838644",
"0.5653026",
"0.56081414",
"0.5578854",
"0.5530492",
"0.5526164",
"0.55202925",
"0.5508108",
"0.5478396",
"0.54627746",
"0.53941876",
"0.5390551",
"0.5369427",
"0.53577024",
"0.5334807",
"0.53185... | 0.5311232 | 21 |
Create and save a user with the given username, email, and password. | def _create_user(self, email, password, **extra_fields):
if not email:
raise ValueError('The given username must be set')
email = self.normalize_email(email)
# Lookup the real model class from the global app registry so this
# manager method can be used in migrations. This is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se... | [
"0.85967624",
"0.8440654",
"0.84264034",
"0.8423257",
"0.84063315",
"0.8393488",
"0.83878005",
"0.8341707",
"0.8334409",
"0.8332718",
"0.83224976",
"0.8288854",
"0.82819235",
"0.827502",
"0.8269521",
"0.8267577",
"0.81637603",
"0.8159258",
"0.8158126",
"0.81423306",
"0.813671... | 0.0 | -1 |
nanpercentile for an array stack with optional nodata masked | def stack_percentile(arrs, q=50, nodata=None):
a = check_stack(arrs)
if nodata is not None:
a = mask_stack(a, nodata=nodata)
nan_per = np.nanpercentile(a, q=q, axis=0)
return nan_per | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_rasters(stack, statistic, no_data_value=None, dtype=None):\n if statistic not in STATISTICS:\n percentile = parse_percentile_statistic(statistic)\n if percentile is None:\n raise KeyError('Unknown statistic \"{}\"'.format(statistic))\n else:\n statistic = \"... | [
"0.63267726",
"0.6302219",
"0.6102591",
"0.61024135",
"0.5969299",
"0.58652663",
"0.5820062",
"0.5817118",
"0.5805178",
"0.5759323",
"0.57574844",
"0.57533103",
"0.57481605",
"0.56940603",
"0.5691162",
"0.56719875",
"0.5654355",
"0.56528306",
"0.56312996",
"0.5590644",
"0.559... | 0.7688776 | 0 |
Slice a list into consecutive disjoint 'chunks' of length equal to size. The last chunk is padded if necessary. >>> list(chunk(range(1,10),3)) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] | def chunk( seq, size, pad=None ):
n = len(seq)
mod = n % size
for i in xrange(0, n-mod, size):
yield seq[i:i+size]
if mod:
padding = [pad] * (size-mod)
yield seq[-mod:] + padding | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_chunk(list, chunk_size):\n for i in range(0, len(list), chunk_size):\n yield list[i:i + chunk_size]",
"def chunker(seq: list, size: int) -> list:\n if isinstance(seq, list) == False:\n raise ValueError(\"`seq` must be a list\")\n return list(seq[pos:pos + size] for pos in... | [
"0.78375936",
"0.77317",
"0.7645982",
"0.763814",
"0.7610402",
"0.756489",
"0.7553069",
"0.7493975",
"0.74935275",
"0.7433296",
"0.74267614",
"0.73935676",
"0.73484564",
"0.73320794",
"0.73021394",
"0.7299738",
"0.72494906",
"0.7235695",
"0.7231955",
"0.72203577",
"0.7151175"... | 0.7251605 | 16 |
Given two gene names, find the minimum distances from 1 to 2. | def samp_dist(gene2, gene1, gene_data=None, ctrl=False, monte_draws=None):
gene_tetra, gene_ct, gene_ids, gene_names = gene_data
if ctrl:
gene_locs = np.logical_or(gene_ids == gene_names[gene1], \
gene_ids == gene_names[gene2])
dist = []
for _ in range(m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min_gene_distance(sequence_record, starting_values=None):\n min_distance = len(sequence_record.seq) if starting_values is None else starting_values[0]\n min_gene1 = 'none' if starting_values is None else starting_values[1]\n min_gene2 = 'none' if starting_values is None else starting_values[2]\n ... | [
"0.7241295",
"0.69850314",
"0.6731652",
"0.6721595",
"0.67209893",
"0.66970587",
"0.6681193",
"0.665249",
"0.6648725",
"0.6567148",
"0.65654033",
"0.65502816",
"0.6537336",
"0.6532635",
"0.6457843",
"0.643359",
"0.6419397",
"0.6401111",
"0.6388038",
"0.6377393",
"0.6342633",
... | 0.0 | -1 |
Return a list of all field names, sorted by increasing integer value. | def sortedFields(cls):
return [
i[0] for i in sorted(cls._nameToValue.items(), key=lambda item: item[1])
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sorted_fields(cls):\n return sorted(\n cls.get_fields(), key=lambda x: (x._primary and 1 or 2, x._order))",
"def getFields(self):\n return sorted(self.schema.fields, key=lambda f: f.name)",
"def fields(self):\n return [f[1] for f in sorted(self.dd.fields.items())]",
"d... | [
"0.7370952",
"0.73105896",
"0.72635776",
"0.71579903",
"0.704704",
"0.70253444",
"0.700296",
"0.67956656",
"0.67882055",
"0.67859364",
"0.6776998",
"0.6686851",
"0.66483814",
"0.6624377",
"0.6623569",
"0.66147864",
"0.6599662",
"0.6558389",
"0.6402054",
"0.6325312",
"0.631709... | 0.8207635 | 0 |
data is a dict of nested JSON structures, returns a flattened array of tuples. Skips entry when value is None | def flatten_json_struct(data, count_fields=[], datetime_fields=[]):
for k,v in data.items():
if v and type(v) != dict and type(v) != list:
if k in datetime_fields and re_prog.match(v):
#print('> yielding date {0}'.format(k))
yield k, date_parser.parse(v).date()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _empty_nested_list(\n data: Union[np.ndarray, List[Any], Tuple[Any, ...], Dict[str, Any]]\n) -> Union[List[Any], Tuple[Any, ...], Dict[str, Any]]:\n if isinstance(data, dict):\n return {k: _empty_nested_list(data[k]) for k in data}\n elif isinstance(data, tuple):\n return tuple(_empty_nested_list(x)... | [
"0.6842089",
"0.6820154",
"0.6688809",
"0.65413386",
"0.6475943",
"0.6444665",
"0.6330448",
"0.60858274",
"0.600981",
"0.59459925",
"0.58953494",
"0.5847279",
"0.5736129",
"0.57271",
"0.56994766",
"0.56341416",
"0.5624279",
"0.5588512",
"0.55831474",
"0.5582972",
"0.5578938",... | 0.57129836 | 14 |
Return a dictionary of files in a given directory. | def findFilesToCompress(sourcePath, includeMatch=None):
toZip = {}
if os.path.isdir(sourcePath):
# Remove any trailing slash
searchDir = os.path.normpath(sourcePath)
for path in cake.filesys.walkTree(searchDir, includeMatch=includeMatch):
toZip[os.path.normcase(path)] = path
else:
toZip[os.p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_files_in_directory(self):\n lesson_file_dict = dict()\n lesson_file_dict[\"files\"] = []\n\n directory_list = listdir(self.sub_dir)\n for directory in directory_list:\n if isfile(join(self.sub_dir, directory)):\n lesson_file_dict[\"files\"].append(dire... | [
"0.75549364",
"0.7449276",
"0.7422119",
"0.736985",
"0.7360078",
"0.719877",
"0.71831876",
"0.70783466",
"0.69813365",
"0.6980949",
"0.69597375",
"0.6942227",
"0.69310325",
"0.68242615",
"0.6788942",
"0.6709317",
"0.6701406",
"0.66559637",
"0.6634095",
"0.65626276",
"0.651219... | 0.0 | -1 |
Return the train, validation and test loaders along with all the data in a dictionary | def get_loaders(img_size=CONFIG["matrix_size"], batch_size=CONFIG["batch_size"],
used_keypoints=CONFIG["used_keypoints"], interpolation_frames=CONFIG["interpolation_frames"],
noise_frames=CONFIG["noise_frames"], all_data=None, all_labels=None):
if all_data is None or all_labels is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_loaders(train_dataset, val_dataset, test_dataset, batch_size=128):\n train_loader = DataLoader(train_dataset, batch_size=batch_size, num_workers=8,\n shuffle=True)\n\n val_loader = DataLoader(val_dataset, batch_size=batch_size, num_workers=8,\n ... | [
"0.7572915",
"0.7511243",
"0.74776614",
"0.7305095",
"0.72230756",
"0.71920186",
"0.7184559",
"0.70862246",
"0.70575106",
"0.70548326",
"0.6979909",
"0.69338477",
"0.6887154",
"0.6884118",
"0.687477",
"0.6870386",
"0.68336225",
"0.68132395",
"0.68129456",
"0.6807856",
"0.6807... | 0.6932351 | 12 |
returns True if other position represents same location | def __eq__(self, other):
raise NotImplemented("must be implemented by subclass") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n return self.longitude == other.getLongitude() and self.latitude == other.getLatitude()",
"def is_same_as(self, other) -> bool:\n return self.x == other.x and self.y == other.y",
"def __eq__(self, o... | [
"0.7986605",
"0.7852323",
"0.7516798",
"0.74917173",
"0.7433622",
"0.7433622",
"0.7422571",
"0.7350741",
"0.73447037",
"0.7186705",
"0.7127218",
"0.7101694",
"0.7065542",
"0.7063472",
"0.70602334",
"0.704766",
"0.7021493",
"0.7009034",
"0.69889456",
"0.69862336",
"0.6972174",... | 0.0 | -1 |
returns Trueif other does not represent the same location | def __ne__(self, other):
return not (self == other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sameLocation(self, other):\n if not isinstance(other,Point):\n return False\n return self.longitude == other.getLongitude() and self.latitude == other.getLatitude()",
"def __ne__(self, other: 'LocationOutput') -> bool:\n return not self == other",
"def is_same_as(self, other... | [
"0.8072579",
"0.7745788",
"0.7535908",
"0.75218225",
"0.7481221",
"0.7481221",
"0.7422515",
"0.7329563",
"0.7303456",
"0.7264103",
"0.7217026",
"0.72133094",
"0.7210718",
"0.71244305",
"0.7121458",
"0.71213335",
"0.71142185",
"0.7061039",
"0.701802",
"0.69940174",
"0.6982181"... | 0.0 | -1 |
return position representing p's parent (or None if p is root) | def parent(self, p):
raise NotImplemented("must be implemented by subclass") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent(self, p):\n node = self._validate(p)\n return self._make_position(node._parent)",
"def parent(self, p):\n node = self._validate(p)\n return self._make_position(node.parent)",
"def parent(self, p):\n node = self._validate_position(p)\n return self._make_position(node... | [
"0.8622031",
"0.84799755",
"0.8450864",
"0.84306884",
"0.84306884",
"0.84306884",
"0.8398229",
"0.7683136",
"0.7486962",
"0.7446012",
"0.73986936",
"0.733961",
"0.7303275",
"0.7144026",
"0.71219456",
"0.7119334",
"0.7106015",
"0.7106015",
"0.70795184",
"0.7077925",
"0.7022706... | 0.0 | -1 |
return position representing p's left child return None if p does not have left child | def left(self, p):
raise NotImplementedError("must be implemented by subclass") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_child(self, position):\n child = 2 * position + 1\n if child > len(self.table) - 1:\n return None\n return child",
"def leftChild(self, pos):\n return 2 * pos",
"def leftChild(self, pos):\n return 2 * pos",
"def left_child(self, pos): \n r... | [
"0.8258376",
"0.8036058",
"0.8036058",
"0.7974871",
"0.7956995",
"0.7902215",
"0.78962487",
"0.78635323",
"0.78635323",
"0.76100457",
"0.75265926",
"0.7433537",
"0.74037945",
"0.7401251",
"0.738327",
"0.736355",
"0.7356271",
"0.7340543",
"0.7327947",
"0.72778374",
"0.7246405"... | 0.68674093 | 45 |
return position representing p's right child return None if p does not have right child | def right(self, p):
raise NotImplemented("must be implemented by subclass") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_child(self, position):\n child = 2 * position + 2\n if child > len(self.table) - 1:\n return None\n return child",
"def right_child(self, pos): \n return (2 * pos) + 1",
"def rightChild(self, pos):\n return (2 * pos) + 1",
"def rightChild(self, pos)... | [
"0.8070593",
"0.78679556",
"0.78477085",
"0.78477085",
"0.7464369",
"0.7301759",
"0.7279855",
"0.7237174",
"0.7237174",
"0.7183739",
"0.7169301",
"0.7163722",
"0.7162927",
"0.71591437",
"0.7113997",
"0.7077287",
"0.7060216",
"0.7045055",
"0.7015009",
"0.6877244",
"0.68614954"... | 0.0 | -1 |
return position representing p's parent (or None if p is root) takes O(1) time | def parent(self, p):
node = self._validate(p)
return self._make_position(node._parent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parent(self, p):\n node = self._validate(p)\n return self._make_position(node._parent)",
"def parent(self,p):\n node = self._validate(p)\n return self._make_position(node._parent)",
"def parent(self, p):\n node = self._validate(p)\n return self._make_position(node.parent)"... | [
"0.82087725",
"0.7973447",
"0.7958434",
"0.7951559",
"0.78672683",
"0.7441747",
"0.72985494",
"0.714055",
"0.7086747",
"0.7060516",
"0.7025149",
"0.7023469",
"0.6985865",
"0.6948683",
"0.6946149",
"0.6909739",
"0.6901966",
"0.6881963",
"0.68113965",
"0.6751398",
"0.6743457",
... | 0.7926873 | 5 |
return position representing p's left child return None if p does not have left child takes O(1) time | def left(self, p):
node = self._validate(p)
return self._make_position(node._left) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def left_child(self, position):\n child = 2 * position + 1\n if child > len(self.table) - 1:\n return None\n return child",
"def left_child(self, pos): \n return 2 * pos",
"def left(self, p):\n node = self._validate(p)\n return self._make_position(node._left)",
"d... | [
"0.81495553",
"0.7734944",
"0.7729298",
"0.76686305",
"0.76686305",
"0.7613958",
"0.7578224",
"0.7538548",
"0.74052393",
"0.7370039",
"0.7345865",
"0.73096263",
"0.7248049",
"0.7243174",
"0.7235285",
"0.7224026",
"0.72235936",
"0.7214862",
"0.72140324",
"0.71670574",
"0.71264... | 0.75508595 | 8 |
return position representing p's right child return None if p does not have right child takes O(1) time | def right(self, p):
node = self._validate(p)
return self._make_position(node._right) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_child(self, position):\n child = 2 * position + 2\n if child > len(self.table) - 1:\n return None\n return child",
"def right_child(self, pos): \n return (2 * pos) + 1",
"def rightChild(self, pos):\n return (2 * pos) + 1",
"def rightChild(self, pos)... | [
"0.7734472",
"0.74995315",
"0.72996885",
"0.72996885",
"0.7293852",
"0.7245865",
"0.68574494",
"0.68453544",
"0.68451065",
"0.67991126",
"0.67569363",
"0.6755892",
"0.66951215",
"0.6695121",
"0.6678725",
"0.667528",
"0.66552854",
"0.66552854",
"0.66042024",
"0.659179",
"0.658... | 0.6539674 | 25 |
place data at left child of position p raise valueError if left child already exists takes O(1) time | def _add_left(self, p, data):
node = self._validate(p)
if node._left is not None:
raise ValueError("left Child Exists")
node._left = self._Node(data, parent=node)
return self._make_position(node._left) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_left(self, value, p):\n if not isinstance(p, int):\n raise TypeError('p must be int type')\n if self._arr[p] == None:\n raise ValueError('Invalid parent position')\n left_child_index = p*2+1 \n if self._arr[left_child_index] is not None:\n raise ... | [
"0.776567",
"0.7119983",
"0.7112861",
"0.707022",
"0.7042716",
"0.6911105",
"0.6644453",
"0.66101384",
"0.6452569",
"0.63870496",
"0.63332206",
"0.6312539",
"0.62454665",
"0.6217022",
"0.6217022",
"0.62160677",
"0.62148696",
"0.62148696",
"0.62131464",
"0.6189904",
"0.6179032... | 0.7568734 | 1 |
Tests an incorrect login | def test_login_fail(self):
client = Client('username', 'password')
self.setSessionResponse(401)
with self.assertRaises(AuthenticationError):
client.authenticate() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_incorrect_login(self):\n response = self.client.post(\n '/users/login',\n data=dict(username=\"dsadsa\", password=\"dsadsadsa\"),\n follow_redirects=True\n )\n self.assertIn(b\"Username and password do not match\", response.data)",
"def test_wrong_lo... | [
"0.84880286",
"0.84317297",
"0.8272008",
"0.8259824",
"0.82290643",
"0.80524504",
"0.7995939",
"0.79582214",
"0.7938139",
"0.79251784",
"0.7919863",
"0.7913591",
"0.7855273",
"0.7826933",
"0.78185296",
"0.78050685",
"0.77969587",
"0.7781252",
"0.7772011",
"0.77654827",
"0.775... | 0.7273799 | 85 |
Tests an unauthenticated API call | def test_call_unauthenticated(self):
with Client('username', 'password') as client:
self.setSessionResponse(401)
with self.assertRaises(APIError):
data = client.call(**self.build_parameters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_unauthenticated(self):\n del self.client.request_kwargs['auth']\n self.verify_get_response(self.client.get(STATUS_PATH))",
"def test_api_call_without_token(self):\n res = self.client().get('/actors')\n data = json.loads(res.data)\n\n self.assertEqual(res.status_cod... | [
"0.83876103",
"0.8235073",
"0.80186033",
"0.79228914",
"0.79023075",
"0.78553134",
"0.7846997",
"0.7843057",
"0.7780716",
"0.7780716",
"0.774295",
"0.7730784",
"0.77101266",
"0.7704427",
"0.76944745",
"0.7672193",
"0.76658446",
"0.76658446",
"0.76482385",
"0.75622684",
"0.755... | 0.85280406 | 0 |
initialize the ship and set it's starting position | def __init__(self,ai_settings, screen):
super(Ship,self).__init__()
self.screen = screen
self.ai_settings = ai_settings
# Load ship and get its rect
self.image = pygame.image.load('images/spaceship.bmp')
self.image = pygame.transform.scale(self.image, (50,50))
self.rect = self.image.get_rect()
self.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNewShip(self):\r\n self._ship = Ship(GAME_WIDTH/2,SHIP_BOTTOM+SHIP_HEIGHT/2,SHIP_WIDTH,\r\n SHIP_HEIGHT,'ship.png')",
"def __init__(self):\n self.x_coord = default_init\n self.y_coord = default_init\n self._init_random_coord() # generating random coordinates\n ... | [
"0.7205004",
"0.7157199",
"0.71470773",
"0.71470773",
"0.70630354",
"0.7061542",
"0.70499146",
"0.70175",
"0.70161426",
"0.701257",
"0.6981781",
"0.6978864",
"0.6976054",
"0.6972159",
"0.6956734",
"0.69411254",
"0.68897957",
"0.68078583",
"0.6804945",
"0.67869765",
"0.6785183... | 0.7264171 | 0 |
Add new data to the end of the window. | def process(self, data):
if data.ndim != 2:
raise ValueError("data must be 2-dimensional.")
n = data.shape[1]
if n > self.length:
raise ValueError("data must be shorter than window length.")
if self._out is None:
self._preallocate(data.shape[0])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, data):\n self.data_list.append(data)",
"def add_data(self, data):\n self._data += data",
"def add(self, data):\n self.databuffer.append(data)\n if len(self.databuffer) > self.buffersize:\n self._flush()",
"def append_data(self, data):\n self.... | [
"0.6545548",
"0.64517677",
"0.63595736",
"0.63595605",
"0.6341855",
"0.63378584",
"0.63278043",
"0.630744",
"0.62234145",
"0.6171027",
"0.6146325",
"0.6140748",
"0.612832",
"0.61139613",
"0.6091756",
"0.6068961",
"0.60685366",
"0.60572153",
"0.6047666",
"0.60187095",
"0.60067... | 0.0 | -1 |
Center each row of the input. | def process(self, data):
return data - np.mean(data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_lines(self):\n window_center = Rectangle.center(self.window_width, self.window_height)\n for line in self.lines.values():\n line.pos = Vector(*window_center)\n line.set_vertices()",
"def add_table_centered(stdscr, table):\n keys = [str(i[0]) for i in table]\n ... | [
"0.6249289",
"0.6100179",
"0.6038177",
"0.58134633",
"0.5771165",
"0.57609034",
"0.57575035",
"0.5720656",
"0.5718885",
"0.57153875",
"0.5662119",
"0.5647746",
"0.56198776",
"0.5596424",
"0.55633557",
"0.55078083",
"0.54944295",
"0.54799813",
"0.54746485",
"0.5445221",
"0.544... | 0.0 | -1 |
Read and parse metadata.json. | def read_output_metadata(metadata_json: str, **kwargs: str) -> Dict:
return load_metadata(read_json(metadata_json, **kwargs)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_metadata(self):\n self._wait_for_read_with_timeout(self.metadata_read_fd)\n flat_json = os.read(self.metadata_read_fd, MAX_METADATA_SIZE)\n os.close(self.metadata_read_fd)\n try:\n return json.loads(flat_json)\n except ValueError:\n self.logger.exc... | [
"0.79010355",
"0.72264344",
"0.7028332",
"0.6997594",
"0.6977069",
"0.69191295",
"0.6885079",
"0.68367594",
"0.6829574",
"0.653561",
"0.6475757",
"0.64667153",
"0.6399547",
"0.6399547",
"0.6399547",
"0.6360954",
"0.6330128",
"0.6266606",
"0.6218381",
"0.6179446",
"0.6145005",... | 0.6926957 | 5 |
Result represent the error code, while bad things happend, and the data gives a blank string default. Using JsonResponse to make sure the `ContentType` header is set to 'application/json'. | def __init__(self, result, data='', msg='', safe=True, status=200):
content = {'code': result, 'data': data, 'msg': msg}
super(ResultResponse, self).__init__(content, status=status, safe=safe) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_json_error(msg, status_code):\n return Response(response=json.dumps({'message': str(msg)}), status=status_code, mimetype=\"application/json\")",
"def json_error(message):\n return json_response(isError=True, message=message)",
"def error_return(content, status):\n content = '{' + '\"status\... | [
"0.75817037",
"0.7458934",
"0.73782563",
"0.7371604",
"0.7320189",
"0.73107296",
"0.7297682",
"0.72959375",
"0.7208738",
"0.7164884",
"0.7153183",
"0.70774215",
"0.7071372",
"0.70559645",
"0.7016999",
"0.70072836",
"0.70011187",
"0.6922885",
"0.68948406",
"0.6836938",
"0.6811... | 0.0 | -1 |
Returns Token from given nft symbol. Is None when nft does not exists. | def get_nft(self, nft):
for t in self:
if t["symbol"].lower() == nft.lower():
return Nft(t, api=self.api)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_token(self, symbol):\r\n for token in self:\r\n if token[\"symbol\"].lower() == symbol.lower():\r\n return token\r\n return None",
"def get_token(self, tid):\n if self.lliagraph:\n return self.lliagraph.get_token(tid)\n else:\n r... | [
"0.7349107",
"0.67751765",
"0.6737298",
"0.5925432",
"0.577959",
"0.5756325",
"0.57218367",
"0.5631335",
"0.5587796",
"0.55218124",
"0.55190486",
"0.5506603",
"0.5501858",
"0.5496333",
"0.54883254",
"0.5482925",
"0.5474357",
"0.5462292",
"0.5450967",
"0.54298794",
"0.541593",... | 0.6747514 | 2 |
Return Mongo DB production database | def get_mongo_db(host, port, name):
client = MongoClient(host, port)
db = client[name]
return db | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_db():\n from pymongo import MongoClient\n client = MongoClient('localhost:27017')\n db = client.seattle\n return db",
"def api_db():\n return pymongo.MongoClient(SCITRAN_PERSISTENT_DB_URI).get_database()",
"def get_db():\n if not hasattr(g, 'mongo_db'):\n g.db = get_mongo_db()\... | [
"0.7969433",
"0.7927073",
"0.77684784",
"0.7743693",
"0.7702004",
"0.76989746",
"0.7655741",
"0.75508654",
"0.7472527",
"0.74214506",
"0.71722853",
"0.7160695",
"0.7158235",
"0.7099991",
"0.70959604",
"0.7081028",
"0.70255846",
"0.7011804",
"0.69888663",
"0.6972335",
"0.69420... | 0.729099 | 10 |
Function to get data from NOAA COOPS API and convert it to a pandas dataframe for convenient analysis. | def get_data(
begin_date, end_date, stationid, product, datum=None, bin_num=None,
interval=None, units='metric', time_zone='gmt'):
# Convert dates to datetime objects so deltas can be calculated
begin_datetime = parse_known_date_formats(begin_date)
end_datetime = parse_known_date_formats(end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_national_data():\n cursor = nat_data_coll.find({})\n df = pd.DataFrame(list(cursor))\n if df.empty:\n app.logger.error(\"While getting national data: no data\")\n return df",
"def query_api(self):\n try:\n data = requests.get(\"http://api.covid19india.org/csv/latest/c... | [
"0.6459701",
"0.63612103",
"0.6331867",
"0.6316186",
"0.6306325",
"0.6211756",
"0.61987174",
"0.6128713",
"0.60769314",
"0.5975549",
"0.5940969",
"0.59346795",
"0.5916585",
"0.5905093",
"0.59049475",
"0.58896726",
"0.58578175",
"0.58462614",
"0.584198",
"0.5837298",
"0.581956... | 0.0 | -1 |
Create a new instance of a Point subclass from a raw set of fields. The subclass chosen is determined by the given SRID; a ValueError will be raised if no such subclass can be found. | def hydrate_point(srid, *coordinates):
try:
point_class, dim = Point.class_for_srid(srid)
except KeyError:
point = Point(coordinates)
point.srid = srid
return point
else:
if len(coordinates) != dim:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_shapely(cls, shape):\n return super(Point, cls).from_shapely(shape)",
"def createFromPoint(cls, point, **kwargs):\n return cls(point.x, point.y, **kwargs)",
"def __init__(self, point_a: AbstractPoint, point_b: AbstractPoint, point_c: AbstractPoint):\n if all(isinstance(entry, Abst... | [
"0.5169176",
"0.5025223",
"0.49656075",
"0.4965117",
"0.49465698",
"0.49281922",
"0.49171948",
"0.49160737",
"0.48885196",
"0.4839027",
"0.47801748",
"0.475332",
"0.4730804",
"0.470936",
"0.46889234",
"0.46745083",
"0.46454856",
"0.46444038",
"0.4642309",
"0.46253127",
"0.461... | 0.6776477 | 0 |
Dehydrator for `timedelta` values. | def dehydrate_timedelta(value):
months = 0
days = value.days
seconds = value.seconds
nanoseconds = 1000 * value.microseconds
return Structure(ord(b"E"), months, days, seconds, nanoseconds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def traverse(self, traverser, **kwargs):\n return traverser.timedelta(self, **kwargs)",
"def dehydrate_duration(value):\n return Structure(ord(b\"E\"), value.months, value.days, value.seconds, int(1000000000 * value.subseconds))",
"def from_dict(cls, dikt) -> 'TimeDelta':\n return util... | [
"0.66172826",
"0.651516",
"0.6508516",
"0.63897973",
"0.5950936",
"0.5882012",
"0.5879211",
"0.58485186",
"0.5835481",
"0.58318996",
"0.58122337",
"0.5798751",
"0.579867",
"0.57608426",
"0.57407755",
"0.5737115",
"0.57333076",
"0.57197917",
"0.5666528",
"0.55132335",
"0.54029... | 0.7711872 | 0 |
Tests sea level values using zero dimension array. | def test_sea_level_0d_array():
h = np.array(0.0)
expected_h = np.array(0.0)
expected_T = np.array(_C2K(15))
expected_p = np.array(sp.constants.atm)
expected_rho = np.array(1.2250)
h, T, p, rho = coesa.table(h)
assert_array_equal(h, expected_h)
assert_array_almost_equal(T, expected_T)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sea_level_nd_array():\n h = np.array([0.0, 0.0, 0.0])\n expected_h = np.array([0.0, 0.0, 0.0])\n expected_T = np.array([288.15] * 3)\n expected_p = np.array([101325.0] * 3)\n expected_rho = np.array([1.2250] * 3)\n\n h, T, p, rho = coesa.table(h)\n\n assert_array_equal(h, expected_h)\... | [
"0.67662776",
"0.59702754",
"0.57677776",
"0.57375073",
"0.56588256",
"0.56059086",
"0.55705494",
"0.5512625",
"0.5496674",
"0.5457192",
"0.54499155",
"0.5385876",
"0.5346242",
"0.53134364",
"0.5311432",
"0.5304796",
"0.5302218",
"0.5296138",
"0.5295707",
"0.52942514",
"0.529... | 0.70393413 | 0 |
Test the api can register a user. | def test_api_can_register_a_user(self):
self.assertEqual(status.HTTP_201_CREATED, self.response.status_code)
self.assertIn('message', self.response.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_register(self):\n response = self.client.post(\n CONSTS.USER_REGISTER_URL,\n data=self.user_data,\n format='json'\n )\n self.assertEqual(response.status_code, status.HTTP_201_CREATED)\n self.assertEqual(User.objects.count(), 1)\n ... | [
"0.8402977",
"0.83601165",
"0.83365864",
"0.82963544",
"0.82276756",
"0.8185485",
"0.81503123",
"0.81171894",
"0.8094968",
"0.8088332",
"0.80621403",
"0.8044355",
"0.80366176",
"0.79909694",
"0.7984357",
"0.79785156",
"0.7976179",
"0.795855",
"0.7950294",
"0.7944072",
"0.7926... | 0.8333049 | 3 |
Test a user can not login with invalid details. | def test_invalid_login(self):
self.response = self.client.post(
"/api/users/login/",
self.invalid_login_data,
format="json")
self.assertEqual(self.response.status_code,
status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_wrong_login_input(self):\n self.user.list_of_accounts = [{'username': 'dalton',\n 'pwd': 'chromelegend',\n 'email': 'legionless@yahoo.com'}]\n msg = self.user.login(\"legionless@yahoo.com\", \"legendchrome\")\n ... | [
"0.7833883",
"0.77813697",
"0.76535255",
"0.7640459",
"0.76311785",
"0.75923365",
"0.75761896",
"0.75257677",
"0.7497334",
"0.7495319",
"0.7471569",
"0.74563515",
"0.7455776",
"0.7423045",
"0.73835576",
"0.73806405",
"0.7341859",
"0.7331634",
"0.7320016",
"0.7316458",
"0.7285... | 0.7182434 | 33 |
Test a user can not login with invalid details. | def test_invalid_registration(self):
self.response = self.client.post(
"/api/users/",
self.invalid_reg_data,
format="json")
self.assertEqual(self.response.status_code,
status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_wrong_login_input(self):\n self.user.list_of_accounts = [{'username': 'dalton',\n 'pwd': 'chromelegend',\n 'email': 'legionless@yahoo.com'}]\n msg = self.user.login(\"legionless@yahoo.com\", \"legendchrome\")\n ... | [
"0.7833883",
"0.77813697",
"0.76535255",
"0.7640459",
"0.76311785",
"0.75923365",
"0.75761896",
"0.75257677",
"0.7497334",
"0.7495319",
"0.7471569",
"0.74563515",
"0.7455776",
"0.7423045",
"0.73835576",
"0.73806405",
"0.7341859",
"0.7331634",
"0.7320016",
"0.7316458",
"0.7285... | 0.0 | -1 |
Test an error is returned when missing an email address in login credentials. | def test_wrong_email_on_login(self):
self.response = self.client.post(
"/api/users/login/",
{"user": {
"email": 'kake@gmail.com',
"password": "fakemail",
}
},
format="json")
self.assertEqual('A user with this ema... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sad_login_wrong_email(self):\n\n rv = self.login(\"wrong@email.com\")\n assert rv.status_code in [404]\n assert b\"The provided email is invalid\" in rv.data",
"def test_invalid_email(self):\n rv = self.login('Bo_wrong@example.com', 'Bo1995')\n self.assertIn(b'Invalid ... | [
"0.85105586",
"0.8382855",
"0.836104",
"0.8212657",
"0.79361886",
"0.7743904",
"0.7737394",
"0.7735185",
"0.77228993",
"0.7655904",
"0.76197416",
"0.75854903",
"0.7584186",
"0.75163114",
"0.75147456",
"0.75065386",
"0.7434621",
"0.74029726",
"0.73942095",
"0.7365318",
"0.7343... | 0.7932811 | 5 |
Test if the username is invalid | def test_register_with_invalid_username(self):
self.response = self.client.post(
"/api/users/",
{"user": {
"username": "&*@#$",
"email": 'kakecom@gmail.com',
"password": "irquoa12345678",
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_username(self, username):\n if self.username_regex.search(username) is not None:\n print(\"Correct username\")\n return True\n else: \n print(\"Wrong username\")\n return False",
"def valid_username(u):\n return u and USER_RE.match(u)",
"d... | [
"0.83255446",
"0.82509655",
"0.8221559",
"0.82015383",
"0.81746817",
"0.81701344",
"0.8086736",
"0.8052139",
"0.8001906",
"0.7989033",
"0.7986227",
"0.79766697",
"0.7951915",
"0.79170257",
"0.7895261",
"0.7891169",
"0.7867845",
"0.7864536",
"0.78182584",
"0.7816741",
"0.78080... | 0.69822305 | 76 |
Test if the email is wrong | def test_wrong_email(self):
self.response = self.client.post(
"/api/users/",
{"user": {
"username": "Iroqua",
"email": 'kakegmailcom',
"password": "irquoa12345678",
}
},
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invalid_email(self):\n rv = self.login('Bo_wrong@example.com', 'Bo1995')\n self.assertIn(b'Invalid email! Please try again', rv.data)",
"def test_invalid_email_when_logging_in(self):\n pass",
"def test_is_invalid_email(self):\n self.assertFalse(is_valid_email('helloworld'))... | [
"0.79971975",
"0.7796475",
"0.7788002",
"0.763457",
"0.7546365",
"0.7539987",
"0.74676365",
"0.7443447",
"0.73738724",
"0.73661333",
"0.73565894",
"0.7319191",
"0.7318801",
"0.73035604",
"0.72671545",
"0.71934676",
"0.7189699",
"0.7183591",
"0.71684045",
"0.71564156",
"0.7152... | 0.75794816 | 4 |
Skip iterator to a desired CorpusPosition. | def skip(self, position):
if not self._is_position_in_corpus(position):
raise ValueError('{0} not in corpus'.format(position))
self._staged_next = None
self._has_staged = False
self._next_search_pos = position | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip(self, skip):\n self._evaluated = False\n self._offset = skip\n return self",
"def skip(self, num_to_skip):\n next(itertools.islice(self.itr, num_to_skip, num_to_skip), None)\n self.len -= num_to_skip\n return self",
"def skip(self, n=None):\n while n > 0:\n ... | [
"0.66828394",
"0.6638398",
"0.6410728",
"0.62192374",
"0.61876327",
"0.6172346",
"0.60496247",
"0.6005457",
"0.59472585",
"0.5939624",
"0.5900731",
"0.58112496",
"0.5773165",
"0.5652451",
"0.5505572",
"0.5439275",
"0.5435747",
"0.541275",
"0.5355357",
"0.53320324",
"0.5322291... | 0.71973765 | 0 |
Loads the contents of filename as a JSON file. | def load_data(filename):
with open(filename) as json_file:
data = json.load(json_file)
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(filename):\n\n with open(filename, encoding=constants.load_encoding) as file:\n return loads(file.read())",
"def loadJsonFromFile(filename):\n with open(filename) as f:\n return json.loads(f.read())",
"def load_json(file_name):\n return json.load(open(file_name))",
... | [
"0.8040198",
"0.7991508",
"0.7930434",
"0.78412294",
"0.78368855",
"0.7793891",
"0.77684355",
"0.7746029",
"0.773849",
"0.77200186",
"0.77046734",
"0.7699271",
"0.76959044",
"0.7693968",
"0.7692608",
"0.76683223",
"0.76669884",
"0.766567",
"0.7663537",
"0.76591617",
"0.762967... | 0.7286211 | 50 |
Turns the data in car_data into a list of lists. | def cars_dict_to_table(car_data):
table_data = [["ID", "Car", "Price", "Total Sales"]]
for item in car_data:
table_data.append([item["id"], format_car(item["car"]), item["price"], item["total_sales"]])
return table_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_list(self):\n return list(self.data)",
"def to_list(cls, data):\n\t\tif isinstance(data, Atom) == False:\n\t\t\traise Exception(\"data must be a class object\")\n\t\tx,y,z = (data.atom_loc)[0], (data.atom_loc)[1], (data.atom_loc)[2]\n\t\treturn [x,y,z]",
"def create_list(self, data):\n\n t... | [
"0.64753574",
"0.6090332",
"0.60332704",
"0.59672207",
"0.5882299",
"0.58822083",
"0.58749104",
"0.5866535",
"0.58619845",
"0.58619076",
"0.58441275",
"0.5836344",
"0.5834248",
"0.5820374",
"0.579551",
"0.5647919",
"0.56450874",
"0.56363773",
"0.5631572",
"0.5626972",
"0.5608... | 0.541539 | 37 |
Return a human readable representation of the model instance. | def __str__(self):
return "{}".format(self.word) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",... | [
"0.79865694",
"0.778825",
"0.778825",
"0.7578485",
"0.7573961",
"0.7508439",
"0.73869205",
"0.725669",
"0.725669",
"0.72521317",
"0.7250976",
"0.72447103",
"0.72447103",
"0.7238946",
"0.72377145",
"0.72135806",
"0.7196659",
"0.71778005",
"0.7177506",
"0.7173099",
"0.7172897",... | 0.0 | -1 |
Return a human readable representation of the model instance. | def __str__(self):
return "{}".format(self.user.username) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",
"def __str__(self):\n model = self._meta.verbose_name.title()\n return f\"{model:s}: {self.name:s}\"",... | [
"0.79865694",
"0.778825",
"0.778825",
"0.7578485",
"0.7573961",
"0.7508439",
"0.73869205",
"0.725669",
"0.725669",
"0.72521317",
"0.7250976",
"0.72447103",
"0.72447103",
"0.7238946",
"0.72377145",
"0.72135806",
"0.7196659",
"0.71778005",
"0.7177506",
"0.7173099",
"0.7172897",... | 0.0 | -1 |
Plot boxes onto provided image | def plot_boxes_cv2(img, trackers, boxes, colours, savename=None, class_names=None):
img = np.copy(img)
n_boats = 0
for tracker in trackers:
if class_names:
x1 = int(tracker[0])
y1 = int(tracker[1])
x2 = int(tracker[2])
y2 = int(tracker[3])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_boxes(self, im, boxes):\n for bbox in boxes:\n l = [int(x) for x in bbox[\"coords\"]]\n l = self.scalebox(l)\n icon = self.classes_to_icons[bbox[\"label\"]]\n overlay_im_to_background(im, icon, l[0], l[1] - icon.shape[0] - 5)\n cv2.rectangle(im... | [
"0.7306879",
"0.72772634",
"0.7190542",
"0.70854527",
"0.7071549",
"0.6901199",
"0.68812376",
"0.6877141",
"0.6874605",
"0.6849658",
"0.6841709",
"0.6817973",
"0.6787107",
"0.67817944",
"0.6774231",
"0.67714643",
"0.6697756",
"0.6689917",
"0.6683297",
"0.66325843",
"0.6610356... | 0.66354454 | 19 |
>>> heapify([4, 2, 1, 7, 8]) [1, 2, 4, 7, 8] | def heapify(seq):
minheap = [0] + seq
for i in range(len(seq)//2, 0, -1): #len(seq)//2 -= 1 to index 1
minHeapify(minheap, i, seq)
seq[:] = minheap[1:]
return seq | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heapify(x):\n pass",
"def heap_sort(list):\n pass",
"def _heapify(self):\n for _ in range(len(self.elements)):\n for i in range(len(self.elements)-1, 0, -1):\n parentPosition = (i-1)/2 # defaults to int i.e. 7/2=3, and 6/2=3\n if parentPosition < 0:\n ... | [
"0.8471072",
"0.78113234",
"0.7751871",
"0.7742837",
"0.76084954",
"0.7559564",
"0.74976206",
"0.7469926",
"0.7428644",
"0.74095255",
"0.7405103",
"0.74036896",
"0.7385255",
"0.7385255",
"0.73362833",
"0.73135567",
"0.7304848",
"0.7247598",
"0.7247598",
"0.7168721",
"0.715773... | 0.7953675 | 1 |
Sets the translate_session_save_interval of this ComAdobeCqSocialTranslationImplTranslationServiceConfigManagerProperties. | def translate_session_save_interval(self, translate_session_save_interval):
self._translate_session_save_interval = translate_session_save_interval | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate_session_save_batch_limit(self, translate_session_save_batch_limit):\n\n self._translate_session_save_batch_limit = translate_session_save_batch_limit",
"def set_session_persistence(self, loadbalancer, val):\n loadbalancer.session_persistence = val",
"def sessiontimeout(self, session... | [
"0.6269623",
"0.5287493",
"0.50312513",
"0.50257015",
"0.4757888",
"0.46145415",
"0.45532042",
"0.44522175",
"0.44045702",
"0.42460123",
"0.42438817",
"0.42293322",
"0.42163268",
"0.42162403",
"0.42162403",
"0.4192631",
"0.41705135",
"0.41205096",
"0.41166076",
"0.4116084",
"... | 0.80380845 | 0 |
Sets the translate_session_save_batch_limit of this ComAdobeCqSocialTranslationImplTranslationServiceConfigManagerProperties. | def translate_session_save_batch_limit(self, translate_session_save_batch_limit):
self._translate_session_save_batch_limit = translate_session_save_batch_limit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_batch_save_limit(session_key):\n limits = get_limits('kvstore', session_key)\n NotableEventUpdate.BATCH_SAVE_LIMIT = limits.max_documents_per_batch_save",
"def translate_session_save_interval(self, translate_session_save_interval):\n\n self._translate_session_save_interval = translat... | [
"0.6474148",
"0.570471",
"0.5410948",
"0.53935945",
"0.5315855",
"0.52651685",
"0.5243527",
"0.5214078",
"0.51726365",
"0.51091903",
"0.51091903",
"0.51091903",
"0.51091903",
"0.51091903",
"0.5107333",
"0.5096785",
"0.5066154",
"0.5026088",
"0.50030863",
"0.49911758",
"0.4967... | 0.85377395 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ComAdobeCqSocialTranslationImplTranslationServiceConfigManagerProperties):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Determine the fitness of an individual. Lower is better. | def fitness(individual, target, p, y):
miss_classes = hamming_w(individual, p, y)
return abs(target - miss_classes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_individual_fitness(individual):\r\n fitness = 0\r\n # A COMPLETER\r\n \r\n #Si distance avec le point objectif diminue, alors fitness augmente ?\r\n \r\n return fitness",
"def fitness(individual):\n different_pos = 0\n return different_pos",
"def fitness(self):\n # TO BE ... | [
"0.81147265",
"0.78222865",
"0.7811273",
"0.7646568",
"0.7443457",
"0.7423554",
"0.7365922",
"0.7358433",
"0.7322929",
"0.7318908",
"0.7289259",
"0.7285436",
"0.7264597",
"0.72315824",
"0.7062467",
"0.6992794",
"0.69571406",
"0.6926966",
"0.6903503",
"0.6820749",
"0.6819962",... | 0.6845455 | 19 |
Return a sorted list of blob names (and blob folder names) based on optional glob_pattern. Blob folder refers to the concept of logical folders which are implemented via slash delimited prefixes. Behavior (blob names refers to both blobs and blob folder names) | def list(self, glob_pattern=""):
# strip relative path so we don't step outside our emulated storage area
glob_pattern = force_local_path(glob_pattern)
# analyze glob_pattern to determine how to return blob names
# if glob_pattern is a folder
if not glob_pattern:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _glob_list(pattern, full_path=False):\n if full_path:\n return sorted(glob.glob(pattern))\n else:\n return sorted([os.path.basename(fpath) for fpath in glob.glob(pattern)])",
"def sglob(files_pattern):\n return sorted(glob.glob(files_pattern))",
"def glob(patterns: list[str]) -> Tabl... | [
"0.7334489",
"0.6934129",
"0.6670205",
"0.666725",
"0.6657339",
"0.657051",
"0.65385926",
"0.651115",
"0.6478867",
"0.6459211",
"0.6435592",
"0.6424879",
"0.6417216",
"0.6358363",
"0.6285486",
"0.6266929",
"0.6250912",
"0.6244419",
"0.6233926",
"0.623373",
"0.6217513",
"0.6... | 0.8087635 | 0 |
Make value of nth bin equal to the difference between the nth and (n1)th bins. | def bin_differences(tobject):
_new_tobject = _ROOTObjectFunctions._project_or_clone(tobject, "e")
for _bin_proxy, _bin_proxy_1, _bin_proxy_2 in zip(_new_tobject[1:-2], tobject[2:-1], tobject[1:-2]):
if _bin_proxy_2.value:
_bin_proxy.value = _bin_proxy_1.value - _bin_proxy_2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff21b(n):\n return 2 * (n - 21) if n > 21 else 21-n",
"def get_new_n(self, bin_):\n def get_from(array):\n for possible_new_n in array:\n if possible_new_n not in self.been_bin_sorted:\n return possible_new_n\n return None\n new_n = g... | [
"0.58912456",
"0.5832593",
"0.58241975",
"0.58151746",
"0.5663124",
"0.56045324",
"0.5592667",
"0.54663086",
"0.54642564",
"0.5448572",
"0.5406774",
"0.5403839",
"0.5402152",
"0.5381044",
"0.5362183",
"0.5326075",
"0.5315039",
"0.5276019",
"0.5274793",
"0.526608",
"0.52429163... | 0.0 | -1 |
Make value of nth bin equal to the ratio between the nth and (n1)th bins. | def bin_ratios(tobject):
_new_tobject = _ROOTObjectFunctions._project_or_clone(tobject, "e")
for _bin_proxy, _bin_proxy_num, _bin_proxy_denom in zip(_new_tobject[1:-2], tobject[2:-1], tobject[1:-2]):
if _bin_proxy_denom.value:
_bin_proxy.value = _bin_proxy_num.value / _bin_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uniform_weights(n):\n return np.ones((n, 1)) / n",
"def from_bins(bins):\n return 0.5*(bins[1:] + bins[:-1])",
"def solve_n_bins(x):\n from scipy.stats import iqr\n\n x = np.asarray(x)\n hat = 2 * iqr(x) / (len(x) ** (1 / 3))\n\n if hat == 0:\n return int(np.sqrt(len(x)))\n else... | [
"0.6021508",
"0.59351414",
"0.59173334",
"0.59173334",
"0.5872936",
"0.57774955",
"0.57098085",
"0.5676805",
"0.562128",
"0.5603318",
"0.558714",
"0.55699676",
"0.55556774",
"0.5543458",
"0.55359584",
"0.548906",
"0.54884505",
"0.5469232",
"0.5449464",
"0.544235",
"0.5431037"... | 0.0 | -1 |
Return the number of DB shards contained in the orchestrator. This might differ from the number of ``DBNode`` objects, as each ``DBNode`` may start more than one shard (e.g. with MPMD). | def num_shards(self) -> int:
return self.db_nodes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shards_count(self) -> Optional[int]:\n return pulumi.get(self, \"shards_count\")",
"def num_shards(self) -> int:\n return pulumi.get(self, \"num_shards\")",
"def num_shards(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"num_shards\")",
"def num_shards(self) -> Opt... | [
"0.7893104",
"0.7815075",
"0.75359267",
"0.7502012",
"0.72905684",
"0.72905684",
"0.71199805",
"0.701844",
"0.69309354",
"0.6927588",
"0.6927588",
"0.6862912",
"0.67417467",
"0.66606396",
"0.6613518",
"0.640761",
"0.63694006",
"0.63018805",
"0.6116569",
"0.59187835",
"0.58683... | 0.84355783 | 0 |
Sets the max number of connected clients at the same time. When the number of DB shards contained in the orchestrator is more than two, then every node will use two connections, one incoming and another outgoing. | def set_max_clients(self, clients: int = 50_000) -> None:
self.set_db_conf("maxclients", str(clients)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit_num_clients(self):\n return self._limit_num_clients",
"def limit_num_clients(self, limit_num_clients):\n\n self._limit_num_clients = limit_num_clients",
"def maxclients(self) -> Optional[int]:\n return pulumi.get(self, \"maxclients\")",
"def concurrent_connections(self):\n ... | [
"0.7187791",
"0.70082897",
"0.6835186",
"0.63426864",
"0.6102583",
"0.6006576",
"0.6005317",
"0.5965594",
"0.5965182",
"0.59143496",
"0.5879589",
"0.58573884",
"0.5840301",
"0.58362967",
"0.5830154",
"0.5750706",
"0.56727254",
"0.56692916",
"0.5640685",
"0.5614158",
"0.559578... | 0.78794193 | 0 |
Returns True if the given string value is numeric | def is_number(value):
try:
float(value)
return True
except ValueError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_numeric(inString):\r\n return is_int(inString) or is_float(inString)",
"def is_number(string):\r\n try:\r\n float(string)\r\n return True\r\n except ValueError: return False",
"def is_numeric(s):\n \n if s == False or s == None or s == \"\" or s == True:\n retur... | [
"0.86201906",
"0.8325891",
"0.82855505",
"0.8275385",
"0.8262571",
"0.82433796",
"0.81927913",
"0.81634045",
"0.8153832",
"0.8140655",
"0.8134592",
"0.8129057",
"0.81245744",
"0.8113852",
"0.8113852",
"0.8113852",
"0.8088837",
"0.807676",
"0.80367434",
"0.8036503",
"0.8031850... | 0.74789715 | 40 |
Returns the provided code string as a List of lines | def clean_code(code, code_type):
if code_type.startswith(BOOTSTRAP):
if code_type.endswith(CLEAN):
return code.split("\n")
code = code.replace("\\", "\\\\")
if code_type.startswith(PERMUTATION):
if code_type.endswith(CLEAN):
return code.split("\n")
if code_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_multiline(self):\n lines = []\n line = self._get_line()\n lines.append(line)\n if line[3:4] == \"-\":\n code = line[:3]\n while 1:\n nextline = self._get_line()\n lines.append(nextline)\n if nextline[:3] == code... | [
"0.7149604",
"0.67990094",
"0.6634741",
"0.66259533",
"0.6465751",
"0.6436136",
"0.6405281",
"0.6331768",
"0.6308648",
"0.6303427",
"0.6188598",
"0.61554766",
"0.6115057",
"0.61119914",
"0.6109016",
"0.6095383",
"0.6037794",
"0.59987706",
"0.59749615",
"0.59737635",
"0.596386... | 0.0 | -1 |
Throws an error if an invalid file is provided file mode | def file_mode_checks(value):
if not value.endswith(F_SUFFIX):
raise argparse.ArgumentTypeError(
"\nFile resource must be:\n"
+ " 1) Obfuscated {hex}.cache.js GWT permutation file"
)
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_file(path, mode, exception=RuntimeError, isdir=False):\n what = (\"directory\" if isdir else \"file\")\n if not os.access(path, os.F_OK):\n raise exception(\"Cannot access %s '%s'.\" % (what, path))\n if isdir and not os.path.isdir(path):\n raise exception(\n \"Expected '... | [
"0.691023",
"0.66409904",
"0.65004313",
"0.63731295",
"0.62926304",
"0.6231472",
"0.62210363",
"0.61989087",
"0.6196588",
"0.61902595",
"0.61467874",
"0.6146147",
"0.6094825",
"0.6085729",
"0.6076162",
"0.60666376",
"0.6050041",
"0.6041934",
"0.603239",
"0.6023282",
"0.601707... | 0.63161695 | 4 |
Subsample a collection of selected indices to a desired positivetonegative ratio. For example, matched_column_indicator = [T, F, F, T, F, F, F, T, F, F] unmatched_column_indicator = [F, T, T, F, T, T, T, F, T, T] indices = [0, 2, 4, 5, 8, 9] min_negatives_per_image = 0 max_negatives_per_positive = 3.0 then, positive_in... | def _subsample_selection_to_desired_neg_pos_ratio(self,
indices,
match,
max_negatives_per_positive,
min_negative... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _selected_indices(self, subset):\n # We want the DataFrame to be indexed the same way its values array is\n ftr = self.frametracks.reset_index(drop=True)\n if subset is not None:\n ftr['tmpindex'] = ftr.index.values\n ftr = ftr.set_index('particle').reindex(subset).se... | [
"0.6508356",
"0.5909718",
"0.58503026",
"0.56628716",
"0.5611257",
"0.559915",
"0.55701727",
"0.5494852",
"0.5481999",
"0.54488444",
"0.53899944",
"0.53868467",
"0.53641534",
"0.5360043",
"0.5332017",
"0.5324358",
"0.53179055",
"0.5301822",
"0.52886236",
"0.5267198",
"0.52581... | 0.8170736 | 0 |
Normalizes 3 vectors, XYZ. In the case of a vector with 0 magnitude, to avoid NaN errors, the 0 vector is simply returned. | def normalize(X, Y, Z):
# Calculate magnitude of vectors
mag_X = math.sqrt(sum([x ** 2 for x in X]))
mag_Y = math.sqrt(sum([x ** 2 for x in Y]))
mag_Z = math.sqrt(sum([x ** 2 for x in Z]))
# Normalize vectors (handling 0 cases)
if mag_X != 0:
X = [x / mag_X for x in X]
else... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise( vectors ):\n vectors = asarray( vectors, _aformat(vectors))\n vectors = reshape( vectors, (-1,3)) # Numpy 23.7 and 64-bit machines fail here, upgrade to 23.8\n mags = reshape( magnitude( vectors ), (-1, 1))\n mags = where( mags, mags, 1.0)\n return divide_safe( vectors, mags)",
"def... | [
"0.72456294",
"0.7037",
"0.6766935",
"0.6733509",
"0.67076963",
"0.666693",
"0.66467744",
"0.664183",
"0.664031",
"0.66388994",
"0.6632613",
"0.6620889",
"0.6541342",
"0.651753",
"0.65014917",
"0.6496014",
"0.6474939",
"0.6458934",
"0.64552623",
"0.64438313",
"0.64179087",
... | 0.7477829 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.