query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Tests that if opponent has played all D then player chooses D | def test_when_opponent_all_Ds(self):
self.responses_test([C, C, C, C], [D, D, D, D], [D, D, D], random_seed=5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strategy(self, opponent: Player) -> Action:\n if opponent.history[5:7] == [D, D]:\n return D\n return C",
"def play(self):\n p1 = self.player()\n p2 = axelrod.Player()\n p1.reset()\n p1.strategy(p2)\n # Genome contains only valid responses.\n ... | [
"0.69511986",
"0.6789717",
"0.6761671",
"0.6744202",
"0.66812885",
"0.6658824",
"0.64544934",
"0.6433817",
"0.6409068",
"0.64016336",
"0.6358125",
"0.6312081",
"0.6310836",
"0.62690103",
"0.62481374",
"0.62354577",
"0.62231493",
"0.6199679",
"0.6188224",
"0.618549",
"0.617422... | 0.6833241 | 1 |
Test that the first strategy is cooperation. | def test_strategy(self):
self.first_play_test(C) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_strategies(self):\n from supvisors.rpcinterface import RPCInterface\n # prepare context\n self.supervisor.supvisors.options.auto_fence = True\n self.supervisor.supvisors.options.conciliation_strategy = 1\n self.supervisor.supvisors.options.starting_strategy = 2\n ... | [
"0.6289681",
"0.6088446",
"0.60087097",
"0.58945894",
"0.5868465",
"0.5865525",
"0.58434075",
"0.58406204",
"0.5825577",
"0.5808575",
"0.5799182",
"0.57566017",
"0.57299274",
"0.5713963",
"0.5694108",
"0.5640021",
"0.5634952",
"0.5613418",
"0.5611763",
"0.56009203",
"0.556180... | 0.7043723 | 0 |
[Tag name][data] Adds or edits a tag | async def addtags(self, ctx, tag, *, data):
Tag = self.settings.ServerConfig(ctx.guild.id, 'Tags')
if not tag in Tag:
Tag[tag] = self.Conf.Tags
await ctx.send('Added Tag: {}'.format(tag))
else:
await ctx.send('Edited Tag: '.format(tag))
nowgmt = time.strftime("%H:%M:%S, %d/%m/%Y", time.gmtime(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tag(tag):\n remove_tag(tag)\n add_tag(tag)",
"def add(self, tag):\n self.tags[tag.name] = tag",
"def add_tag(self, dataset: \"Dataset\", tag: \"DatasetTag\"):\n raise NotImplementedError",
"def add_tag_data(tag):\n\n add_tag = Tag(tag=tag)\n db.session.add(add_tag)\n t... | [
"0.7547656",
"0.73122424",
"0.7146442",
"0.7079315",
"0.70158464",
"0.6972767",
"0.6942977",
"0.69232506",
"0.68210673",
"0.68094426",
"0.6789792",
"0.67696357",
"0.675033",
"0.6716757",
"0.6668717",
"0.6609845",
"0.6540188",
"0.65396667",
"0.65002435",
"0.6500017",
"0.648303... | 0.7690257 | 0 |
[role] Adds the role to the tag role so that users with the role add items to database | async def addtagrole(self, ctx, _role):
if _role == 0:
self.settings.ServerConfig(ctx.guild.id, 'TagRole', 0)
await ctx.send('Tag role set to: {}'.format(0))
else:
role = self.settings.Get(ctx, 'role', _role)
if not role: return await ctx.send('Can\'t find role: {}'.format(_role))
self.sett... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def tagrole(self, ctx):\r\n\t\trole = self.settings.Get(ctx, 'role', self.settings.ServerConfig(ctx.guild.id, 'TagRole'))\r\n\t\tif not role: return await ctx.send('Can\\'t find role: {}'.format(role))\r\n\t\tawait ctx.send('Tag role set to: {}'.format(role))",
"def add_role(self, role):\n if role.n... | [
"0.7687098",
"0.74410874",
"0.7360748",
"0.7293953",
"0.7293953",
"0.7221843",
"0.71918094",
"0.7147505",
"0.7137051",
"0.7064779",
"0.6971061",
"0.6953096",
"0.6871091",
"0.68253785",
"0.6823579",
"0.68036664",
"0.67957264",
"0.6769465",
"0.67585003",
"0.6700567",
"0.6698247... | 0.8451464 | 0 |
Displays what role is needed to use addTags. Admins have override | async def tagrole(self, ctx):
role = self.settings.Get(ctx, 'role', self.settings.ServerConfig(ctx.guild.id, 'TagRole'))
if not role: return await ctx.send('Can\'t find role: {}'.format(role))
await ctx.send('Tag role set to: {}'.format(role)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def addtagrole(self, ctx, _role):\r\n\t\tif _role == 0:\r\n\t\t\tself.settings.ServerConfig(ctx.guild.id, 'TagRole', 0)\r\n\t\t\tawait ctx.send('Tag role set to: {}'.format(0))\r\n\t\telse:\t\r\n\t\t\trole = self.settings.Get(ctx, 'role', _role)\r\n\t\t\tif not role: return await ctx.send('Can\\'t find role:... | [
"0.6766158",
"0.626771",
"0.62405634",
"0.60421985",
"0.5930429",
"0.5923225",
"0.59075016",
"0.5849822",
"0.5844874",
"0.58227783",
"0.5788901",
"0.577062",
"0.5751763",
"0.5734394",
"0.56860876",
"0.56808734",
"0.5679025",
"0.56646913",
"0.5592869",
"0.5566085",
"0.55451256... | 0.71883804 | 0 |
Saved de hashmap in een representatie mbv een dictionary met type en items als keys en de respectievelijke waardes als values. Value van type is een string. De items worden gerepresenteerd als een lijst van getallen met None op de open plaatsen (lin en quad) en een lijst van lijsten met None op de open plaatsen (sep) | def save(self):
dct = {
"type" : "" ,
"items" : list()
}
if self.type == "sep":
dct["type"] = self.type
for e in self.items:
if e.tableIsEmpty():
dct["items"].append(None)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reprOfStringToValueMap (stringMap : Map) -> String:\n\n entrySeparator = u\"§\"\n entryTemplate = \"%s: %s\"\n keyList = sorted(list(stringMap.keys()))\n result = \"\"\n \n for key in keyList:\n value = stringMap[key] \n result += (iif(result == \"\", \"\", entrySeparator)\n ... | [
"0.5671425",
"0.5593379",
"0.5499794",
"0.54469883",
"0.5431957",
"0.5421641",
"0.5404828",
"0.53982854",
"0.5349993",
"0.5316625",
"0.52968806",
"0.5269717",
"0.52630097",
"0.5237461",
"0.5197106",
"0.5195565",
"0.517675",
"0.51746243",
"0.5147131",
"0.51464987",
"0.5143329"... | 0.5893401 | 0 |
Converts x,y to tf.train.Example and serialize | def serialize_example(x, y):
input_features = tf.train.FloatList(value=x)
label = tf.train.FloatList(value=y)
features = tf.train.Features(
feature={
"input_features": tf.train.Feature(float_list=input_features),
"label": tf.train.Feature(float_list=label)
}
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize_example(B1,B2,B3,B4,B5,B6,B7,B8,B8A,B9,B10,B11,B12,NL,wealth,wealthpooled,wealthpooled5country,country,urbanrural,lon_coord,lat_coord,year):\n # Create a dictionary mapping the feature name to the tf.train.Example-compatible data type.\n feature = {\n #Band 1: Aerosols\n 'Band 1': _dtype_... | [
"0.68092746",
"0.6784134",
"0.6503282",
"0.65031725",
"0.6499005",
"0.6484382",
"0.64764315",
"0.6378839",
"0.6327915",
"0.6176846",
"0.6176846",
"0.61429334",
"0.6136616",
"0.60942453",
"0.60644764",
"0.5894673",
"0.5887579",
"0.5818207",
"0.577114",
"0.5767517",
"0.57360315... | 0.84300804 | 0 |
Shutdown the GTK thread. | def shutdown(self):
gtk.main_quit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown(self):\n for param in [self._device_name_param, self._lm_param, self._dic_param]:\n if rospy.has_param(param):\n rospy.delete_param(param)\n\n \"\"\" Shutdown the GTK thread. \"\"\"\n gtk.main_quit()",
"def shutdown(self):\n for param in [self._m... | [
"0.7493157",
"0.6893742",
"0.67108303",
"0.6661054",
"0.6578344",
"0.6556827",
"0.65500313",
"0.65122",
"0.6496316",
"0.6480773",
"0.6471413",
"0.6447762",
"0.643099",
"0.63635",
"0.63492876",
"0.6345046",
"0.6334765",
"0.6315781",
"0.631129",
"0.629733",
"0.62874407",
"0.6... | 0.75505215 | 0 |
Determine the categories of the given mutation | def classify(self, mutation) -> Set['Category']:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def classify(self, mutation) -> Set[Category]:\n def normalise(string):\n \"\"\"Remove double spaces, make lower case. Just remove some weirdness\"\"\"\n return re.sub(' +', ' ', string).lower()\n return {cat for string, cat in self.mapping.items()\n if normalise(... | [
"0.7249685",
"0.57687914",
"0.5706455",
"0.5538397",
"0.55157787",
"0.5499222",
"0.54764605",
"0.54542905",
"0.5443038",
"0.5443038",
"0.5443038",
"0.5405104",
"0.53759414",
"0.5355417",
"0.5334851",
"0.5285773",
"0.52854383",
"0.5284697",
"0.52531624",
"0.5236138",
"0.522909... | 0.80035084 | 0 |
Is this category contained by category 'other'? Notes Categories contain themselves. So >>> sports = Category('sports') >>> gym = Category('gym', parent=sports) >>> gym.is_in(sports) >>> True >>> gym.is_in(gym) >>> True | def is_in(self, other):
if self.name == other.name:
return True
else:
if self.parent:
return self.parent.is_in(other)
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, other) -> bool:\n\n return other in self.children or any(other in child for child in self.children)",
"def in_(self, other: Any) -> NoReturn:\n raise NotImplementedError(\n \"in_() not yet supported for \"\n \"relationships. For a simple \"\... | [
"0.6046577",
"0.5872043",
"0.5847019",
"0.56995517",
"0.5682203",
"0.56435144",
"0.56385046",
"0.5630443",
"0.55758584",
"0.55637133",
"0.54554915",
"0.54477495",
"0.54460293",
"0.54374176",
"0.54068583",
"0.5313128",
"0.529153",
"0.5269776",
"0.5257244",
"0.5226673",
"0.5179... | 0.73035234 | 0 |
The topmost parent category. If a category has no parent, it is its own root | def root(self) -> 'Category':
if self.parent:
return self.parent.root()
else:
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRoot(self):\n n = self\n while n.parent is not None:\n n = n.parent\n return n",
"def _highest_parent_(self):\n if self._parent_ is None:\n return self\n return self._parent_._highest_parent_",
"def parent(self):\n return self if self.is_ro... | [
"0.7098115",
"0.70974296",
"0.70600253",
"0.686388",
"0.6820908",
"0.67812836",
"0.67529446",
"0.67093736",
"0.6694144",
"0.6644529",
"0.6639872",
"0.6636833",
"0.6620389",
"0.65645194",
"0.65601057",
"0.6556674",
"0.6497858",
"0.6482828",
"0.6482828",
"0.6482828",
"0.6464569... | 0.75555605 | 0 |
All unique categories used in this classifier | def categories(self) -> List[Category]:
return list(set(self.mapping.values())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories(self):\n\t\treturn (sorted(self.dictData.keys()))",
"def categoricals(self):\n return base_64_to_object(self.categorical_hyperparameters_64)",
"def categories(self):\n return self.__categories",
"def getCategories(self):\n return self.categories.keys()",
"def cat... | [
"0.7506106",
"0.73227334",
"0.7208265",
"0.72041124",
"0.72034353",
"0.7166425",
"0.71495",
"0.71364886",
"0.7104631",
"0.7028423",
"0.69927675",
"0.6977006",
"0.696788",
"0.69555587",
"0.6951241",
"0.69501936",
"0.6931314",
"0.6906976",
"0.68834436",
"0.68730456",
"0.6836062... | 0.7444617 | 1 |
Build StringMatchClassifier from a yaml file. Yaml is much easier to edit in realworld classifiers that often include 50+ lines Example The YAML content | def string_match_classifier_from_yaml(f) -> StringMatchClassifier:
content = load(f, Loader=Loader)
mapping = {}
def parse_category(name: str, items: List[Union[str, Dict]],
parent: Category = None):
mapping_ = {}
current_cat = Category(name, parent=parent)
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_yaml(\n cls: type[CategorizationT],\n filepath: typing.Union[str, pathlib.Path, typing.TextIO],\n ) -> CategorizationT:\n try:\n yaml = sy.load(filepath.read(), schema=cls._strictyaml_schema)\n except AttributeError:\n with open(filepath) as fd:\n ... | [
"0.5849541",
"0.58348805",
"0.5797749",
"0.5711983",
"0.5606203",
"0.5529922",
"0.55192566",
"0.54874134",
"0.5477667",
"0.5477161",
"0.5455623",
"0.5439857",
"0.54185295",
"0.53903866",
"0.53647256",
"0.5290752",
"0.5287529",
"0.5283748",
"0.52713245",
"0.52573293",
"0.52268... | 0.7915985 | 0 |
Create a time delay between the strings and print the strings | def print_pause(string, t):
print(string)
time.sleep(t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cprint(msg):\n\n global last\n\n for s in msg.split(\"\\n\"):\n now = t.time()\n if now - last < gap:\n extra = gap - (now - last)\n t.sleep(extra)\n last = t.time()\n\n print(s)",
"def loading(delay):\r\n\r\n for i in range(3):\r\n\r\n ... | [
"0.68629223",
"0.67566776",
"0.6614424",
"0.6474933",
"0.64013803",
"0.63649964",
"0.63116467",
"0.62750256",
"0.6224809",
"0.6172111",
"0.6145519",
"0.6073276",
"0.6051598",
"0.605088",
"0.60172755",
"0.5983931",
"0.5940152",
"0.59334844",
"0.589889",
"0.58954006",
"0.588672... | 0.67764807 | 1 |
read in a waveform file and convert to 16 kHz mono | def load_wav_16k_mono(self, filename):
filename = utils.get_file_path('webapp/static/processed', filename)
file_contents = tf.io.read_file(filename)
wav, sample_rate = tf.audio.decode_wav(file_contents,
desired_channels=1)
wav = tf.squeeze(w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mono(filename,wout=True):\n n, data, data_dB,sr,ch=inputwav(filename)\n if ch==2:\n print('Converting to mono...')\n L=data[:,0]\n R=data[:,1]\n n=len(data)\n data_m=np.zeros((n,1))\n data_m=L/2.0+R/2.0\n if wout==True:\n print('Exporting...')\... | [
"0.75184876",
"0.7414172",
"0.73175704",
"0.70566976",
"0.7042731",
"0.7014093",
"0.6841203",
"0.6768417",
"0.6761383",
"0.66739964",
"0.65660936",
"0.65389454",
"0.65357524",
"0.6525629",
"0.6517646",
"0.6507581",
"0.647938",
"0.64350533",
"0.6417874",
"0.6363204",
"0.635996... | 0.766974 | 0 |
Return the matrixvector product of m x u. | def matrix_vector_prod(m,u):
each_product = []
for v in m:
each_product.append(dot_prod(v, u))
return each_product | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matvec(self, x):\n return self * x",
"def matrix_mult_vec(matrix_a, x):\n m = len(matrix_a)\n b = [0 for i in xrange(m)]\n for i in xrange(m):\n b[i] = dot_product(matrix_a[i], x)\n return b",
"def scalar_mult(v, u):\n return [v[i] * u[i] for i in range(len(v))]",
"def __matm... | [
"0.71702135",
"0.7055918",
"0.6835106",
"0.6689941",
"0.6673966",
"0.6635107",
"0.65746856",
"0.6568005",
"0.64973223",
"0.6490259",
"0.6488629",
"0.6476936",
"0.6387352",
"0.63686526",
"0.6335958",
"0.633055",
"0.6328782",
"0.6323971",
"0.6298101",
"0.6298101",
"0.62812924",... | 0.8554756 | 0 |
Return list of pythagorean triples as nondescending tuples of ints from 1 to n. Assume n is positive. | def pythagorean_triples(n):
triples = []
for i in range(1,n+1):
for j in range(1, n+1):
for k in range(1, n+1):
if i**2 + j**2 == k**2 and i <= j <= k:
triples.append((i,j,k))
return triples | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pythagorean_triples(n):\n l = []\n # loop over all a < b < c <= n\n for c in range(1, n + 1):\n for b in range(1, c):\n for a in range(1, b):\n if a*a + b*b == c*c:\n l.append((a, b, c))\n return l",
"def Pythagorean_Triplets(n):\n for num in... | [
"0.8094776",
"0.72984177",
"0.727847",
"0.7146135",
"0.6965781",
"0.67307967",
"0.66383916",
"0.648162",
"0.6431071",
"0.6350643",
"0.6244063",
"0.6171055",
"0.611668",
"0.6079294",
"0.6068943",
"0.6055166",
"0.604777",
"0.60399395",
"0.602407",
"0.60153395",
"0.6008699",
"... | 0.7996597 | 1 |
Makes a dictionary of an attribute in a feature class. This is to support testing so we can grab the max stream order for a HUC and check that it's the correct value. | def get_attribute_dict(feature_class, key, attribute, where_clause=None):
cursor = arcpy.da.SearchCursor(feature_class, [key, attribute], where_clause=where_clause)
output_dict = {}
for row in cursor:
output_dict[row[0]] = row[1]
return output_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\r\n attr_dict = {key: getattr(self, key) for key in self.FEATURES}\r\n attr_dict['created'] = attr_dict['created'].isoformat()\r\n return attr_dict",
"def dict(self) -> dict():\n\n dict_reg_hive = {}\n\n for _attribute in self.attributes._... | [
"0.6416297",
"0.60396713",
"0.6011409",
"0.5951639",
"0.5930991",
"0.59291244",
"0.5925059",
"0.59034055",
"0.58908457",
"0.5820729",
"0.5801812",
"0.57407475",
"0.5736824",
"0.57200104",
"0.56973714",
"0.56514084",
"0.564546",
"0.5619017",
"0.5611192",
"0.56027037",
"0.55929... | 0.620751 | 1 |
Helper function to return the traceback as a string | def _get_traceback(self, exc_info=None):
import traceback
import sys
return '\n'.join(traceback.format_exception(*(exc_info or sys.exc_info()))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_traceback_stxt():\n #/\n exc_cls, exc_obj, tb_obj = sys.exc_info()\n\n #/\n txt_s = traceback.format_exception(exc_cls, exc_obj, tb_obj)\n\n #/\n res = ''.join(txt_s)\n\n return res",
"def traceback(self):\r\n clean = self.raw_traceback\r\n lines = ['Traceback (most rec... | [
"0.84182703",
"0.809314",
"0.80824953",
"0.7780935",
"0.77703017",
"0.77410674",
"0.77168816",
"0.74873346",
"0.7456277",
"0.74082017",
"0.73907036",
"0.738198",
"0.735202",
"0.7304374",
"0.7287829",
"0.72533494",
"0.7235701",
"0.71940607",
"0.7024492",
"0.69965553",
"0.69751... | 0.8207802 | 1 |
Breadth First Search uses graph to do search from the initial_node to dest_node returns a list of actions going from the initial node to dest_node | def bfs(graph, initial_node, dest_node):
return queue_search(graph, initial_node, dest_node, queue.Queue()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def breadthFirstSearch(problem):\n \"*** YOUR CODE HERE ***\" \n startState = problem.getStartState()\n visitedNodes = []\n fringe = util.Queue()\n cost = 0 \n if (problem.isGoalState(startState) == True ):\n return [] # No Specific Actions\n else :\n fringe.push((startState... | [
"0.74586236",
"0.7455906",
"0.72902405",
"0.72630066",
"0.7232725",
"0.72139806",
"0.7194545",
"0.7153663",
"0.7138503",
"0.7109881",
"0.70911014",
"0.708523",
"0.7075581",
"0.7068329",
"0.7056453",
"0.70355266",
"0.7014375",
"0.69839436",
"0.6975992",
"0.69622797",
"0.694846... | 0.8197698 | 0 |
Dijkstra Search uses graph to do search from the initial_node to dest_node returns a list of actions going from the initial node to dest_node | def dijkstra_search(graph, initial_node, dest_node):
return queue_search(graph, initial_node, dest_node, queue.PriorityQueue(), True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph_search(self, initial_path, goal):\n nodes_considered = 0\n frontier = PathPriorityQueue([Path(initial_path, 0)])\n explored = set()\n while True:\n if frontier.is_empty():\n return \"FAIL\"\n path = frontier.pop()\n node = path.e... | [
"0.71104765",
"0.68910176",
"0.68581754",
"0.68133336",
"0.6658129",
"0.66358954",
"0.6523851",
"0.6509776",
"0.64800227",
"0.6451855",
"0.6429574",
"0.6386867",
"0.6381405",
"0.63649595",
"0.6363982",
"0.63397545",
"0.63363385",
"0.6318993",
"0.6293434",
"0.62933373",
"0.627... | 0.7611417 | 0 |
combine the data from all of the runs in the list at a given interval | def data_combinator(runs, interval):
agg_data = []
for run in runs:
data = pc.run_info(pc.combine_info("/Users/mchronert/Desktop/activities/"+run), interval)
agg_data += data
return agg_data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_extracted_list(input_list, subinterval):\n out = []\n wait = subinterval\n for i in input_list:\n if wait == subinterval:\n out.append(i)\n wait = 0\n else:\n wait += 1\n return out",
"def combine_runs(runs):\n if runs==[]: return []\n re... | [
"0.60435504",
"0.5920072",
"0.5906665",
"0.5798596",
"0.57419336",
"0.56897825",
"0.5647156",
"0.56082696",
"0.5595982",
"0.55646783",
"0.54823095",
"0.543882",
"0.5399207",
"0.53923905",
"0.5384958",
"0.53722364",
"0.53639483",
"0.5351272",
"0.53477305",
"0.53437805",
"0.534... | 0.7584016 | 0 |
r""" Resnet50 trained on Cifar10 with label corruption prob = 0.6, starting with seed=42, and without data augmentation | def resnet50_cifar10_corrupt0_6(pretrained=True, progress=True, use_data_parallel=False, **kwargs):
return _model('resnet50_cifar10_corrupt0_6', resnet50, pretrained, progress, use_data_parallel, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train():\n\n ### DO NOT CHANGE SEEDS!\n # Set the random seeds for reproducibility\n np.random.seed(42)\n\n ## Prepare all functions\n # Get number of units in each hidden layer specified in the string such as 100,100\n if FLAGS.dnn_hidden_units:\n dnn_hidden_units = FLAGS.dnn_hidden_units.split(\",\"... | [
"0.61901367",
"0.6173296",
"0.61728823",
"0.61093205",
"0.6067455",
"0.5970702",
"0.5963044",
"0.5954632",
"0.595203",
"0.59297544",
"0.5921719",
"0.59201986",
"0.5912598",
"0.5912598",
"0.5902296",
"0.5896998",
"0.58944196",
"0.58787423",
"0.58771896",
"0.58750635",
"0.58724... | 0.6222468 | 0 |
r""" Resnet50 trained on Cifar10 with label corruption prob = 1.0, starting with seed=42, and without data augmentation | def resnet50_cifar10_corrupt1(pretrained=True, progress=True, use_data_parallel=False, **kwargs):
return _model('resnet50_cifar10_corrupt1', resnet50, pretrained, progress, use_data_parallel, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train():\n\n ### DO NOT CHANGE SEEDS!\n # Set the random seeds for reproducibility\n np.random.seed(42)\n\n ## Prepare all functions\n # Get number of units in each hidden layer specified in the string such as 100,100\n if FLAGS.dnn_hidden_units:\n dnn_hidden_units = FLAGS.dnn_hidden_units.split(\",\"... | [
"0.61979675",
"0.61711574",
"0.61329263",
"0.6069946",
"0.60275334",
"0.59871596",
"0.5984235",
"0.5969245",
"0.5960109",
"0.5953578",
"0.59504455",
"0.5933466",
"0.58876216",
"0.58819646",
"0.5874375",
"0.5870128",
"0.5858061",
"0.58563364",
"0.58543473",
"0.5842274",
"0.583... | 0.6250411 | 0 |
Produce qubits that can be used by the ansatz circuit. | def _generate_qubits(self):
return cq.LineQubit.range(4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_qubits(self) -> Sequence[cirq.Qid]:\n return cirq.LineQubit.range(openfermion.count_qubits(self.hamiltonian))",
"def get_qubit_registers_for_adder(qc: QuantumComputer, num_length: int,\n qubits: Optional[Sequence[int]] = None)\\\n -> Tuple[Sequence[int... | [
"0.7295021",
"0.6242328",
"0.6181717",
"0.6162",
"0.61610645",
"0.6115761",
"0.6033602",
"0.60173666",
"0.5999683",
"0.5978787",
"0.5971419",
"0.5942918",
"0.58536386",
"0.5853114",
"0.5844787",
"0.5844492",
"0.583382",
"0.57925075",
"0.5777519",
"0.57146275",
"0.5709855",
... | 0.7309755 | 0 |
Apply the four rules of the game to the current game grid. Creates a new_grid to be manipulated by the rules. Nested forloop runs through the rows and columns of a 2D list. Each neighbor of the cell of interest is identified and neighbor totals are calculated. If statements are used to implement the rules of the game. | def make_move(grid, n_columns, n_rows):
# Generate the game grid to be manipulated
new_grid = [[0] * (n_columns + 1) for i in range(n_rows + 1)]
for i in range(n_rows):
for j in range(n_columns):
upper_left = grid[i-1][j-1] # neighbor to upper left of cell of interest
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_grid(self):\n\n screen.fill(GREY)\n\n for row in self.grid:\n for cell in row:\n if cell.root:\n color = GREEN\n elif cell.goal:\n color = RED\n elif cell.value:\n color = DARK_BL... | [
"0.6495653",
"0.64484656",
"0.642264",
"0.6191768",
"0.6130129",
"0.6080801",
"0.6049253",
"0.59872615",
"0.59566456",
"0.58835655",
"0.5882744",
"0.58461547",
"0.5834441",
"0.57707757",
"0.57700586",
"0.5746112",
"0.57235205",
"0.5721528",
"0.57213503",
"0.57207745",
"0.5719... | 0.6888119 | 0 |
Print the grid with dashes and x's. Translate the one's and zero's with dashes and x's. Print to std out. | def print_grid(n_rows, n_columns, grid):
# loop through the grid, print zeros as - and ones as X
for i in range(n_rows):
for j in range(n_columns):
if grid[i][j] == 0:
print('-', end= '')
else:
print('X', end= '')
print()
pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_grid(gr):\n for i in range(0,9):\n if((i % 3) == 0):\n print('- - - - - - - - - - - - - - - -')\n for j in range(0,9):\n if((j % 3) == 0):\n print('|', end='')\n \n val = str(gr[i][j])\n if(val == '0'):\n ... | [
"0.780924",
"0.7755005",
"0.7718164",
"0.7650883",
"0.7550544",
"0.7549656",
"0.7522073",
"0.75173753",
"0.7510759",
"0.7449605",
"0.7396495",
"0.7396495",
"0.7383149",
"0.73640716",
"0.73166454",
"0.7209535",
"0.7199041",
"0.71822524",
"0.7168182",
"0.7167548",
"0.7150936",
... | 0.8017813 | 0 |
Function used to control game. Create a 2D list of zero's with 30 rows and 80 columns. Call initialize_grid to apply the user specified starting "ON" cells. Call print_grid to display zero's as '' and one as 'X'. Set the max_iterations of the game to user specified amount, as an integer. Loop through max iterations of ... | def main():
n_rows = 30
n_columns = 80
grid = [[0] * (n_columns + 1) for i in range(n_rows + 1)]
initialize_grid(argv, grid)
print_grid(n_rows, n_columns, grid)
max_iterations = int(argv[1]) #argv imports as string, must change to int for count
loop_count = 0
while loop_cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_game(game,grid_size):\n row_wall = '----'*(grid_size+1)\n #first row\n str_print = ' | '\n for i in range(grid_size):\n #samll number\n if i < 9:\n str_print = str_print+str(i+1)+' | '\n else:\n str_print = str_print+str(i+1)+'| '\n print(str_p... | [
"0.62480915",
"0.6162638",
"0.6161956",
"0.61546975",
"0.61291194",
"0.6049269",
"0.598043",
"0.59630316",
"0.5954282",
"0.59391433",
"0.5891404",
"0.58901787",
"0.58364373",
"0.58224124",
"0.58150554",
"0.58117604",
"0.580178",
"0.5794376",
"0.5778398",
"0.5776013",
"0.57749... | 0.74113184 | 0 |
Translate Google adwords category names from one language into antoher using Google translate. | def translate_categories(categories, source_language, destination_language):
t = Translator()
# collect unique words
words = set([])
for category in categories:
for word in category.split('/'):
words.add(word)
words = list(words)
# remove blank word from start
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(self, language=None):",
"def translate():\n pass",
"def translate():\n text = request.args.get('text')\n\n # Send a request to Google's Translate REST API using your API credentials defined above\n ans = service.translations().list(source='en', target='zh-CN', q=text).execute()\n\... | [
"0.63309133",
"0.6107327",
"0.59375936",
"0.5927482",
"0.5897871",
"0.5847351",
"0.5773335",
"0.5752672",
"0.57161146",
"0.57140374",
"0.5709047",
"0.56486684",
"0.5642085",
"0.5638824",
"0.56145924",
"0.55868566",
"0.5585695",
"0.5549135",
"0.5545717",
"0.5537421",
"0.553586... | 0.6385091 | 0 |
Set a value in the configuration dictionary. | def setconfig(self, key, value):
self.config[key] = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(key: str, value: Any):\n _check_key(key)\n config = _read_config()\n config[key] = value\n _write_config(config)",
"def __setattr__(self, key, value):\n self._config.__setitem__(key, value)",
"def set(self, key, value):\n self.__config.setValue(key, QtCore.QVariant(value))\n ... | [
"0.8089307",
"0.8022321",
"0.7999449",
"0.78925335",
"0.7748806",
"0.7675543",
"0.7547704",
"0.7547003",
"0.7441997",
"0.7375292",
"0.73546743",
"0.72325546",
"0.72325546",
"0.712229",
"0.6982503",
"0.69816804",
"0.6941709",
"0.6904385",
"0.68798184",
"0.68798184",
"0.6868598... | 0.80856353 | 1 |
Clear the events table, and optionally the slides and rooms too. | def clear(self, clearall=False):
def closure(cur):
cur.execute("""
DELETE FROM events
""")
if clearall:
cur.execute("""
DELETE FROM slides
""")
cur.execute("""
DELETE FROM ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear(self):\n self.events={}",
"def clear_events():\n if request.method == 'POST':\n if not request.user.is_admin:\n raise Exception('Only admin users can clear events!')\n\n events = db.session.query(\n db.models.Event\n )\n ... | [
"0.6792364",
"0.6719757",
"0.65813655",
"0.6542314",
"0.6415372",
"0.63917637",
"0.63588816",
"0.6177918",
"0.6161885",
"0.6065517",
"0.59416753",
"0.5872802",
"0.5831055",
"0.5743936",
"0.5737371",
"0.5736536",
"0.57324296",
"0.571099",
"0.5707718",
"0.5705507",
"0.566241",
... | 0.72294223 | 0 |
Return the list of rooms and their unique ID. | def rooms(self):
def closure(cur):
cur.execute("""
SELECT id, name
FROM rooms
""")
ret = [ ]
for r in cur.fetchall():
ret.append({ 'id': r[0], 'name': r[1] })
return ret
return self.execute(closu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_room_list():\n room_list = []\n # 0\n room = Room(\n \"Patio. You are in a patio, it is surrounded by four long walls.\\n\\\n The south wall has a metal door.\",\n north = None,\n east = None,\n south = 2,\n west = None\n )\n room_list.append(room)\... | [
"0.74181354",
"0.7392563",
"0.734369",
"0.7115319",
"0.68132555",
"0.67156047",
"0.6657997",
"0.6587904",
"0.6543138",
"0.6535067",
"0.6504759",
"0.64367",
"0.6423249",
"0.6417045",
"0.6407678",
"0.63976073",
"0.6394096",
"0.63855153",
"0.62589383",
"0.6257023",
"0.6255645",
... | 0.7985916 | 0 |
Update the events table. As there is currently no reliable way to determine when events are deleted, the events table should always be cleared before updating. The rooms table will be updated automatically if a venue does not exist yet. | def update(self, events):
def closure(cur, events):
for e in events:
eid = e['id'].int & 0x7fffffff
rid = e['venue_id'] & 0x7fffffff
# TODO Upsert requires Postgres 9.5
cur.execute("""
SELECT id, name
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_events_in_database(self):\n for i in range(0, len(self._event_id_list), 1):\n e_id = self._event_id_list[i] # DB ID\n e_ind = self._event_index_list[i] # Index of the event\n e_db = Event.objects.get(id=e_id) # Event as stored in the DB\n e_db... | [
"0.6317904",
"0.6096783",
"0.55838174",
"0.5560127",
"0.55341095",
"0.54664016",
"0.53713465",
"0.5353653",
"0.5233746",
"0.5227581",
"0.5224242",
"0.5170779",
"0.51636",
"0.51259476",
"0.51183987",
"0.5055904",
"0.5050661",
"0.49661246",
"0.49647835",
"0.49558112",
"0.495154... | 0.7814776 | 0 |
Returns a list of neighbouring edges that are adjacent to cur | def get_neighbour_edges(self, cur: Union[str, int]) -> list:
return [edge for edge in self.edges if cur in edge] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbour_vertices(self, cur: Union[str, int]) -> list:\n\t\tvertices = [edge[0] if edge[1] == cur else edge[1] for edge in self.get_neighbour_edges(cur)]\n\t\treturn vertices",
"def neighbour(seq):\n it = iter(seq)\n it_next = itertools.islice(itertools.chain(iter(seq), [None]), 1, None)\n\n pr... | [
"0.713821",
"0.6878901",
"0.684514",
"0.6800554",
"0.6778823",
"0.6747758",
"0.6741381",
"0.6690278",
"0.6671425",
"0.66245055",
"0.6594854",
"0.6591538",
"0.6557763",
"0.65219295",
"0.64962137",
"0.64946204",
"0.6492736",
"0.64217293",
"0.6414693",
"0.6406191",
"0.63890874",... | 0.82909685 | 0 |
Returns a list of neighbouring vertices that are adjacent to cur | def get_neighbour_vertices(self, cur: Union[str, int]) -> list:
vertices = [edge[0] if edge[1] == cur else edge[1] for edge in self.get_neighbour_edges(cur)]
return vertices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbour_edges(self, cur: Union[str, int]) -> list:\n\t\treturn [edge for edge in self.edges if cur in edge]",
"def neighbours((u,v)):\r\n return ((u,v+1), (u+1,v), (u,v-1), (u-1,v))",
"def vertices(self):\r\n return self.adjacent.keys()",
"def neighbour(seq):\n it = iter(seq)\n it_n... | [
"0.7504102",
"0.6767677",
"0.66429615",
"0.6606651",
"0.6528841",
"0.65234286",
"0.6509406",
"0.65039486",
"0.6481793",
"0.6378591",
"0.6370347",
"0.63491464",
"0.6343429",
"0.6338669",
"0.6313196",
"0.6271166",
"0.62506574",
"0.62506574",
"0.62189263",
"0.6217621",
"0.621509... | 0.79300326 | 0 |
Returns a duplicate of the current graph | def duplicate(self):
return Graph(self.vertices[:], self.edges[:]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_copy_of_graph(self):\r\n return deepcopy(self)",
"def duplicate(self):\r\n graph = DistanceGraph(self.size)\r\n for node in self.edges:\r\n for edge in self.edges[node]:\r\n graph.edges[node][edge] = self.edges[node][edge]\r\n return graph",
"def cl... | [
"0.82292247",
"0.80588907",
"0.7854422",
"0.7740778",
"0.7604593",
"0.75646424",
"0.7530913",
"0.74936765",
"0.7435963",
"0.7431422",
"0.7316394",
"0.7297471",
"0.72086847",
"0.7181991",
"0.7020755",
"0.69729346",
"0.68975747",
"0.6889356",
"0.67915905",
"0.67202866",
"0.6720... | 0.87519115 | 0 |
Draws the graph using networkx and matplotlib | def draw(self):
nx_graph = self.parse_graph()
pos = nx.spring_layout(nx_graph, k=0.15, iterations=20) # to spread out the nodes
nx.draw(nx_graph, pos, edge_color="black", width=1, linewidths=1, node_size=500, node_color="pink", alpha=0.9, with_labels=True)
edge_labels = {(edge[0], edge[1]):edge[2] for edge in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_graph(self) -> None:",
"def draw(self):\n nx.draw_networkx(self.rc)",
"def display_graph(variables, relations):\n graph = as_networkx_graph(variables, relations)\n\n # Do not crash if matplotlib is not installed\n try:\n import matplotlib.pyplot as plt\n\n nx.draw_network... | [
"0.7959249",
"0.79517084",
"0.76535904",
"0.7607586",
"0.7573352",
"0.7567952",
"0.7517184",
"0.7503838",
"0.7467462",
"0.74501944",
"0.74295354",
"0.74252903",
"0.7399687",
"0.73923737",
"0.7324458",
"0.73227465",
"0.73187935",
"0.7297937",
"0.7262746",
"0.724233",
"0.724023... | 0.8144129 | 0 |
Obtain a minimum spanning tree from the connected graph using Kruskal's Algorithm | def kruskal_solve(self):
min_span_tree = Graph(self.graph.vertices, [])
edges = sorted(self.graph.edges[:], key=lambda x: x[2])
count = 0
while count < len(self.graph.vertices) - 1:
cur_edge = edges[0]
edges = edges[1:]
node1, node2, weight = cur_edge
if not min_span_tree.is_connected(node1, n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MinSpanningTreeKruskal(self):\n nodes = [n for n in self.nodes]\n edges = [e for e in self.edges]\n self.ResetGraph()\n for n in nodes:\n self.AddNode(n)\n n.neighbours = []\n\n \n edges.sort(key=lambda e: e.weight)\n \n for edge in ... | [
"0.8073324",
"0.7257561",
"0.7249896",
"0.70720726",
"0.70673037",
"0.70213974",
"0.7008656",
"0.6999974",
"0.6828237",
"0.68029386",
"0.67508215",
"0.6744012",
"0.66062886",
"0.66046107",
"0.659681",
"0.64816517",
"0.64716834",
"0.63787365",
"0.62990654",
"0.61601245",
"0.60... | 0.8310096 | 0 |
Obtain a minimum spanning tree from the connected graph using Prim's Algorithm | def prim_solve(self):
min_span_tree = Graph([self.graph.vertices[0]], [])
dup_graph = self.graph.duplicate()
for i in range(len(self.graph.vertices) - 1):
neighbour_edges = []
for cur in min_span_tree.vertices:
neighbour_edges += dup_graph.get_neighbour_edges(cur)
neighbour_edges.sort(key=lambda x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_spanning_tree(self, start_vertex):\n\n # Initialize sets of seen variables to far in the algorithm\n taken_edges = set()\n taken_vertices = set([start_vertex])\n all_vertices = set(self._edges.keys())\n \n # Create a list from the neighbors, heapify to turn int... | [
"0.7029954",
"0.69473666",
"0.68449444",
"0.67843765",
"0.6717303",
"0.6704193",
"0.66456646",
"0.6622588",
"0.66225183",
"0.66105676",
"0.65900546",
"0.6570395",
"0.6562047",
"0.6552557",
"0.6551784",
"0.6536425",
"0.6370941",
"0.63628864",
"0.63378435",
"0.62898964",
"0.627... | 0.73469836 | 0 |
Draws the before and after result of applying the minimum spanning tree algorithm | def draw_min_span_tree(self):
self.graph.draw()
min_span_tree = self.kruskal_solve()
min_span_tree.draw() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_minimum_spanning_tree():\n \n # A very simple graph\n g = UndirectedGraph([('A', 'B'), ('B', 'D'), ('D', 'C'), ('A', 'C')], \n weights=[7, 6, 2, 3])\n mst = g.minimum_spanning_tree('A')\n assert mst == UndirectedGraph([('B', 'D'), ('D', 'C'), ('A', 'C')], \n ... | [
"0.5909174",
"0.5867239",
"0.58313036",
"0.5818923",
"0.57028264",
"0.5694181",
"0.5631401",
"0.556421",
"0.55123764",
"0.55011684",
"0.5488266",
"0.5463977",
"0.54515946",
"0.54421526",
"0.5435857",
"0.5430902",
"0.54238933",
"0.5417596",
"0.5398625",
"0.5398125",
"0.5386369... | 0.7098307 | 0 |
Register flags for specifying model & data to use. | def define_model_and_data(model=None, dataset=None):
key_flags = []
if model:
flags.DEFINE_string(
name="model", default=None,
help=help_wrap("Model name to use. It should be defined on models/"
"and referenced in supervisor.py "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_flags(self):\n self.io_args.color = self.io_args.color_full\n self.io_args.rig_in = self.io_args.rig\n self.io_args.matches = os.path.join(self.io_args.output_root, \"matches.json\")\n self.io_args.rig_out = os.path.join(self.io_args.output_root, \"rig.json\")",
"def AddRegi... | [
"0.5807796",
"0.5777295",
"0.5722051",
"0.5687811",
"0.5631301",
"0.55600256",
"0.55578333",
"0.5543994",
"0.55258745",
"0.540445",
"0.54002875",
"0.53927445",
"0.5387778",
"0.5292474",
"0.5275104",
"0.5272009",
"0.52663434",
"0.5210927",
"0.5208599",
"0.52035505",
"0.5174219... | 0.6521049 | 0 |
implement > operator (internally used in sort function). A word is greater that another word, if the count is greater. for equal counts we use alphabetic order | def __gt__(self, other):
if self.count == other.count:
return self.word < other.count
return self.count > other.count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_by_count_desc_and_word(word_counts):\n\n return sorted(word_counts.items(), key=reversed_and_negated_tuple)",
"def sorted_by_count_and_word(word_counts):\n\n return sorted(word_counts.items(), key=reversed_tuple)",
"def comparator(a, b):\n a = re.split(\"[_=]\", a)[-2]\n b = re.split(\"[... | [
"0.6659736",
"0.6491459",
"0.6400454",
"0.63584495",
"0.6331146",
"0.60667944",
"0.6060104",
"0.6052846",
"0.60112846",
"0.5985805",
"0.5975649",
"0.5943373",
"0.59432",
"0.5864958",
"0.58457786",
"0.5799058",
"0.57948786",
"0.5739845",
"0.5739339",
"0.57341474",
"0.57153606"... | 0.7641977 | 0 |
Caculate distance between 2 point p1 & p2 | def distance(p1,p2):
return ((p1.x - p2.x)**2 + (p1.y - p2.y)**2)**0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(p1,p2):\n return ((p2.x - p1.x)*2 + (p2.y - p1.y))**0.5",
"def get_distance_between(self, p1, p2):\n\t\treturn math.sqrt(math.pow((p1.x - p2.x), 2) + math.pow((p1.y - p2.y), 2))",
"def distance_between_points(p1,p2):\n return math.sqrt((p2.x-p1.x)**2+(p2.y-p1.y)**2)",
"def distance_between... | [
"0.8811028",
"0.8728056",
"0.8709409",
"0.86857796",
"0.8678404",
"0.8666823",
"0.8664603",
"0.8660234",
"0.8639913",
"0.86309606",
"0.8630197",
"0.86067724",
"0.86014766",
"0.8598736",
"0.85981536",
"0.85942817",
"0.858709",
"0.85745925",
"0.85727",
"0.8564187",
"0.8556046",... | 0.8804484 | 1 |
Compute proximity between two strings and the scalar product between word counters. | def text_proximity(str_1: str, str_2: str) -> float:
tokens_1 = Counter(str_1.split(' '))
tokens_2 = Counter(str_2.split(' '))
return _normalized_scalar_product(tokens_1, tokens_2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expprox(string1, string2):\n return 1 - exp(-dist(string1, string2) ** 2)",
"def wordSimilarityRatio(sent_1,sent_2):",
"def word_rotator_similarity(x, y):\n return 1 - word_rotator_distance(x, y)",
"def similarity(a, b):\n distance = Levenshtein.distance(a, b)\n return 1 - (distance / max((le... | [
"0.69183373",
"0.65915394",
"0.63861835",
"0.63699895",
"0.6306902",
"0.6276694",
"0.62146086",
"0.621382",
"0.6193824",
"0.6152762",
"0.6144086",
"0.61311626",
"0.6113209",
"0.6105064",
"0.6103431",
"0.6101781",
"0.6072242",
"0.6067656",
"0.60537755",
"0.60511994",
"0.604866... | 0.803603 | 0 |
Switch to the tenant underwhich we want test browser calls | def switch_horizon_tenant(self):
logging.info("switching tenant {}".format(self.horizon_switch_tenant_url))
self.driver.get(self.horizon_switch_tenant_url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch_tenant(tenant_name, password, environment, tester_conf):\n if hasattr(environment.cfy, '_current_user'):\n environment.add_cleanup(\n environment.cfy.profiles.set,\n kwargs=environment.cfy._current_user,\n )\n else:\n creds_conf = tester_conf['cloudify']\... | [
"0.6529659",
"0.6412971",
"0.6204449",
"0.60955954",
"0.6006893",
"0.5964093",
"0.59607786",
"0.59541106",
"0.5926739",
"0.59156716",
"0.5905028",
"0.5847523",
"0.5846767",
"0.57944846",
"0.57919943",
"0.5786681",
"0.574774",
"0.57253754",
"0.57162416",
"0.5713635",
"0.565757... | 0.7773671 | 0 |
program core that GETs the URL, computes browser load time | def _load_page_measure_time(self, driver, source, tag):
self.driver.get(source)
navigationStart = driver.execute_script(
"return window.performance.timing.navigationStart")
responseStart = driver.execute_script(
"return window.performance.timing.responseStart")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_http_speed(self):\n log.msg(\"timing retrival time for %s\"\n %self.http_url)\n def got_response(body):\n self.report['http_response_time'] = (datetime.now() - self.http_request_start_time).total_seconds()\n self.report['http_success'] = True\n ... | [
"0.70124537",
"0.61090505",
"0.6088698",
"0.59986895",
"0.59677726",
"0.59145004",
"0.59123653",
"0.58430207",
"0.5766163",
"0.5745859",
"0.57255626",
"0.571218",
"0.5700025",
"0.5642966",
"0.56342745",
"0.5627361",
"0.5611413",
"0.55827636",
"0.5582066",
"0.55713505",
"0.556... | 0.64308107 | 1 |
Navigate to Images Page | def load_images_page(self):
logging.info("loading images page {}".format(self.horizon_images_url))
return self._load_page_measure_time(self.driver,self.horizon_images_url,
tag = "Images Page") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_images(self, page_number):",
"def test_image_links(self):\r\n print('\\nTest image links: ', end='', flush=True)\r\n driver = self.driver\r\n driver.get(MY_URL)\r\n all_images = driver.find_elements_by_tag_name('img')\r\n for image in all_images:\r\n src = i... | [
"0.71683556",
"0.6558667",
"0.6330021",
"0.6214343",
"0.6141092",
"0.6136924",
"0.61209655",
"0.60861087",
"0.6002587",
"0.5970089",
"0.59491193",
"0.5867471",
"0.58571094",
"0.5851499",
"0.5828727",
"0.5824134",
"0.5823961",
"0.579743",
"0.5787317",
"0.57831424",
"0.57729876... | 0.656143 | 1 |
Navigate to the Networks Page | def load_networks_page(self):
logging.info("loading networks page {}".format(self.horizon_networks_url))
return self._load_page_measure_time(self.driver, self.horizon_networks_url,
tag = "Networks Page") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def navigate_to_network_then_to_interfaces(driver):\n driver.find_element_by_xpath('//mat-list-item[@ix-auto=\"option__Network\"]').click()\n wait_on_element(driver, 0.5, 30, '//mat-list-item[@ix-auto=\"option__Interfaces\"]')\n driver.find_element_by_xpath('//mat-list-item[@ix-auto=\"option__Interfaces\"... | [
"0.66203135",
"0.61691964",
"0.6128031",
"0.60250354",
"0.59923965",
"0.5986763",
"0.59506345",
"0.59186566",
"0.5848732",
"0.5845646",
"0.58099276",
"0.5792502",
"0.57818943",
"0.5772862",
"0.57680553",
"0.57648844",
"0.57351536",
"0.5724515",
"0.5689531",
"0.5626081",
"0.56... | 0.6887423 | 0 |
Navigate to the Volumes Page | def load_volumes_page(self):
logging.info("loading volumes page {}".format(self.horizon_volumes_url))
return self._load_page_measure_time(self.driver, self.horizon_volumes_url,
tag = "Volumes Page") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_view_volume(self, volume, volumes_steps):\n volumes_steps.view_volume(volume.name)",
"def test_volumes_pagination(self, volumes_steps, create_volumes,\n update_settings):\n volume_names = list(generate_ids('volume', count=3))\n create_volumes(volume_na... | [
"0.6598046",
"0.63373923",
"0.5994742",
"0.59189004",
"0.58968365",
"0.57743293",
"0.5672001",
"0.55889237",
"0.5532465",
"0.54282194",
"0.5415197",
"0.54040956",
"0.5371264",
"0.5357885",
"0.5344388",
"0.5344113",
"0.5314223",
"0.52597964",
"0.5233691",
"0.52304494",
"0.5230... | 0.63926196 | 1 |
Parse `KeyValueType` `items` into `data`, `headers` and `files`. | def parse_items(items, data=None, headers=None, files=None):
if headers is None:
headers = {}
if data is None:
data = {}
if files is None:
files = {}
for item in items:
value = item.value
key = item.key
if item.sep == SEP_HEADERS:
target = head... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(self):\r\n for key, value in KLVParser(self.value, self.key_length):\r\n try:\r\n self.items[key] = self.parsers[key](value)\r\n except Exception:\r\n None",
"def parse_items(self):",
"def _parse_input(self):\r\n def _convert(item):\r\... | [
"0.60141337",
"0.58718884",
"0.5697836",
"0.5522168",
"0.53699714",
"0.53341717",
"0.5298565",
"0.52756697",
"0.52727205",
"0.527024",
"0.5262517",
"0.5255796",
"0.52172136",
"0.52094954",
"0.517458",
"0.51700616",
"0.51569",
"0.51460475",
"0.5132767",
"0.5072974",
"0.5058285... | 0.7081794 | 0 |
Test iproj on another generic distribution. | def test_pid_proj2():
d = bivariates['reduced or']
pid = PID_IG(d, [[0], [1]], [2])
assert pid[((0,), (1,))] == pytest.approx(-0.03122, abs=1e-4)
assert pid[((0,),)] == pytest.approx(0.34250, abs=1e-4)
assert pid[((1,),)] == pytest.approx(0.34250, abs=1e-4)
assert pid[((0, 1),)] == pytest.approx... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_project(self):\n basis = self.Dummy()\n state = 5\n assert basis.project(state) == (state + 1)\n assert basis.projection_error(state, relative=False) == 1\n assert basis.projection_error(state, relative=True) == 1/state",
"def test_set_project_itar_information(self):\n... | [
"0.57117695",
"0.5694633",
"0.56289965",
"0.55679655",
"0.54663575",
"0.54574525",
"0.5360506",
"0.5360506",
"0.535664",
"0.533123",
"0.5242382",
"0.5242382",
"0.5242382",
"0.5234249",
"0.5203385",
"0.5178049",
"0.5166117",
"0.5162857",
"0.5151918",
"0.5142145",
"0.51352394",... | 0.5765012 | 0 |
Test case for projects_id_comments_delete You can't delete the entire List | def test_projects_id_comments_delete(self):
project = Comment()
response = self.client.open('/project-tracker/projects/{id}/comments'.format(id=56),
method='DELETE',
data=json.dumps(project),
cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_issue_delete_comment(self):\n pass",
"def test_issue_delete_comment_reaction(self):\n pass",
"def test_delete_comment(self):\n response = self.client.delete(reverse('api:comments-detail', kwargs={'pk': self.comment1.id}))\n self.assertEqual(response.status_code, status.HTTP... | [
"0.7538064",
"0.7186663",
"0.71354496",
"0.7107133",
"0.7022211",
"0.7022211",
"0.68872124",
"0.68487823",
"0.6810696",
"0.67917436",
"0.6754982",
"0.6718552",
"0.66978097",
"0.669653",
"0.66894865",
"0.6686263",
"0.6629874",
"0.6628475",
"0.66138524",
"0.6577825",
"0.6477943... | 0.79522735 | 0 |
Test case for projects_id_comments_get List all comments on this project | def test_projects_id_comments_get(self):
response = self.client.open('/project-tracker/projects/{id}/comments'.format(id=56),
method='GET')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments(self):\n\t\treturn self._client.get_comments(self)",
"def get_comments(self, project, story):\n ret_val = []\n resource = \"projects/{0:d}/stories/{1:d}/comments\".format(project.id,\n story.id)\n params = {\"fields\": Comment.FIELDS}\n comments = self.... | [
"0.73526657",
"0.7235159",
"0.71570337",
"0.71272117",
"0.71002054",
"0.7082807",
"0.6978766",
"0.6961045",
"0.68796104",
"0.6829881",
"0.676059",
"0.673184",
"0.6708463",
"0.66963136",
"0.66928077",
"0.66826713",
"0.66751885",
"0.6665972",
"0.6646997",
"0.6637998",
"0.657638... | 0.82630426 | 0 |
Test case for projects_id_comments_patch You can't put the entire List | def test_projects_id_comments_patch(self):
project = Comment()
response = self.client.open('/project-tracker/projects/{id}/comments'.format(id=56),
method='PATCH',
data=json.dumps(project),
conten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_issue_get_comments(self):\n pass",
"def test_issue_edit_comment(self):\n pass",
"def test_projects_id_comments_post(self):\n project = Comment()\n response = self.client.open('/project-tracker/projects/{id}/comments'.format(id=56),\n metho... | [
"0.7005537",
"0.6911109",
"0.6698229",
"0.66503316",
"0.662829",
"0.6614505",
"0.6596675",
"0.65016913",
"0.6436199",
"0.6340969",
"0.62965775",
"0.62892133",
"0.62499595",
"0.6141073",
"0.6132673",
"0.6094428",
"0.6094136",
"0.60626733",
"0.60514086",
"0.6017415",
"0.6001806... | 0.75987107 | 0 |
Test case for projects_id_comments_post Create a new comment | def test_projects_id_comments_post(self):
project = Comment()
response = self.client.open('/project-tracker/projects/{id}/comments'.format(id=56),
method='POST',
data=json.dumps(project),
content_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_comment_creation(self):\n response = self.client.post(reverse('posts:comment_create'),\n data={\n 'post': self.post.id,\n 'user': self.user.id,\n '... | [
"0.78539693",
"0.77718616",
"0.76293397",
"0.74781877",
"0.739347",
"0.7100315",
"0.7100315",
"0.7090023",
"0.70112383",
"0.697841",
"0.69655275",
"0.69466275",
"0.6938937",
"0.69285727",
"0.69100267",
"0.6799138",
"0.67766714",
"0.67443997",
"0.6739937",
"0.67262363",
"0.671... | 0.80527073 | 0 |
Test case for projects_id_contacts_delete You can't delete the entire List | def test_projects_id_contacts_delete(self):
project = Contact()
response = self.client.open('/project-tracker/projects/{id}/contacts'.format(id=56),
method='DELETE',
data=json.dumps(project),
cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_contact_list(self):\n contact_list = ContactList.objects.first()\n\n url, parsed = self.prepare_urls('v1:contact_list-detail', subdomain=self.company.subdomain, kwargs={'pk':contact_list.id})\n \n response = self.client.delete(url, HTTP_HOST=parsed.netloc)\n self.... | [
"0.78514934",
"0.7374926",
"0.7266725",
"0.718799",
"0.7141157",
"0.71207666",
"0.7001174",
"0.7001174",
"0.6971916",
"0.6692171",
"0.6674646",
"0.6625675",
"0.66176724",
"0.65642524",
"0.65054184",
"0.64835584",
"0.6482259",
"0.6480837",
"0.6473447",
"0.6440988",
"0.64198637... | 0.8044259 | 0 |
Test case for projects_id_contacts_get List all contacts associated with this project | def test_projects_id_contacts_get(self):
response = self.client.open('/project-tracker/projects/{id}/contacts'.format(id=56),
method='GET')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_contacts(self):\n return self.contacts",
"def get_contacts(self):\n\n\t\treturn self.__contacts",
"def getcontacts():\n contacts = {}\n\n try:\n #get list of contact ids\n contactids = r.smembers(\"contacts\")\n\n #for each contact id get data\n for contactid i... | [
"0.7839124",
"0.7382741",
"0.72152394",
"0.7198767",
"0.71408844",
"0.7117154",
"0.71161073",
"0.7081493",
"0.7068587",
"0.7004598",
"0.6993691",
"0.69406533",
"0.69249153",
"0.69193196",
"0.69130397",
"0.6879185",
"0.68332976",
"0.6819428",
"0.6800808",
"0.67929614",
"0.6733... | 0.82982016 | 0 |
Test case for projects_id_contacts_patch You can't put the entire List | def test_projects_id_contacts_patch(self):
project = Contact()
response = self.client.open('/project-tracker/projects/{id}/contacts'.format(id=56),
method='PATCH',
data=json.dumps(project),
conten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_edit_contact_list(self):\n c1 = ContactFactory(company_id=self.company.id)\n contact_list = ContactList.objects.first()\n data = ContactListSerializer(contact_list).data\n\n data['title'] = 'Nestle'\n data['contact_ids'] = [c1.id]\n\n url, parsed = self.prepare_ur... | [
"0.72883403",
"0.70832515",
"0.6799027",
"0.6791032",
"0.66712385",
"0.6670964",
"0.666078",
"0.6647232",
"0.6543077",
"0.64140236",
"0.6353525",
"0.62380695",
"0.62257165",
"0.6216095",
"0.6210986",
"0.6159818",
"0.614496",
"0.6139482",
"0.6111963",
"0.6096888",
"0.60826397"... | 0.7536313 | 0 |
Test case for projects_id_contacts_post Add a new contact | def test_projects_id_contacts_post(self):
project = Contact()
response = self.client.open('/project-tracker/projects/{id}/contacts'.format(id=56),
method='POST',
data=json.dumps(project),
content_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_contacts(self):\n response = self.contacts.add(\"alex\", \"0708913841\")\n self.assertEqual(response, \"Successfully added contacts\" )",
"async def post(self):\n await self.handle_request(self.contacts_new_api, 1)",
"def test_create_contact(self):\n \n url = rev... | [
"0.7949077",
"0.7514629",
"0.75110257",
"0.74048936",
"0.72448313",
"0.7075887",
"0.7046514",
"0.6869396",
"0.68167496",
"0.67995465",
"0.67780775",
"0.6753959",
"0.66962546",
"0.6654049",
"0.6618246",
"0.6598331",
"0.6580695",
"0.6577041",
"0.6574029",
"0.65189326",
"0.65117... | 0.79977417 | 0 |
Test case for projects_id_contacts_put You can't put the entire List | def test_projects_id_contacts_put(self):
project = Contact()
response = self.client.open('/project-tracker/projects/{id}/contacts'.format(id=56),
method='PUT',
data=json.dumps(project),
content_ty... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_list_replace(self):\n for proj in Project.objects.all():\n ProjectMembership.objects.create(user=self.user,\n project=proj)\n self.user.save()\n self.story.projects.add(*list(Project.objects.filter(projecttranslation__name__in=(\"Finding a Bite: Food ... | [
"0.7327915",
"0.7204283",
"0.72033477",
"0.67620736",
"0.66989845",
"0.669293",
"0.66434866",
"0.65155023",
"0.64001423",
"0.6351564",
"0.62919354",
"0.6282717",
"0.6220328",
"0.61951756",
"0.61610985",
"0.6160724",
"0.61324203",
"0.611441",
"0.6112874",
"0.6084068",
"0.60789... | 0.7212684 | 1 |
Test case for projects_id_get get specific project by id | def test_projects_id_get(self):
response = self.client.open('/project-tracker/projects/{id}'.format(id=56),
method='GET')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_project(self, id):\n for project in self.projects:\n if project.id == int(id):\n ret_val = project\n break\n else:\n ret_val = None\n\n return ret_val",
"def get_project(db, id):\n \n for element in db:\n if element['pr... | [
"0.792782",
"0.78499204",
"0.77148956",
"0.7599433",
"0.7559296",
"0.7524254",
"0.72501665",
"0.72298914",
"0.719199",
"0.71628577",
"0.7076372",
"0.70147586",
"0.69691926",
"0.69549286",
"0.68873996",
"0.6883658",
"0.68633926",
"0.6850275",
"0.68304986",
"0.68092567",
"0.680... | 0.8277344 | 0 |
Test case for projects_id_put update an existing project | def test_projects_id_put(self):
project = Project()
response = self.client.open('/project-tracker/projects/{id}'.format(id=3.4),
method='PUT',
data=json.dumps(project),
content_type='application/j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_projects_put(self):\n project = Project()\n response = self.client.open('/project-tracker/projects',\n method='PUT',\n data=json.dumps(project),\n content_type='application/json')\n ... | [
"0.81604785",
"0.75980777",
"0.75980777",
"0.7500458",
"0.7390961",
"0.7259923",
"0.71718544",
"0.71173435",
"0.71147645",
"0.69204885",
"0.6855049",
"0.6816442",
"0.6794547",
"0.6777365",
"0.67306525",
"0.6724991",
"0.66709304",
"0.6614499",
"0.6565858",
"0.65616554",
"0.654... | 0.8415916 | 0 |
try registering a tool | def test_register(self):
username,userpass = self.testdata.find_account_for('toolsubmitter')
self.utils.account.login_as(username,userpass)
message = self.contribtool.register(TOOLNAME,TOOLDATA)
success_msg = 'Tool information successfully registered'
fail_msg = 'Tool with th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_tool(cls, tool_name: str, reset_function):\n if tool_name in cls.TOOLS:\n raise PedalToolAlreadyRegistered(tool_name)\n cls.TOOLS[tool_name] = ToolRegistration(tool_name, reset_function)",
"def register_other_tools(self):\n self.add_tool(SaveAsTool)\n self.add_... | [
"0.7119724",
"0.6363242",
"0.62860364",
"0.6170632",
"0.61630136",
"0.61319464",
"0.61184275",
"0.6088353",
"0.60612804",
"0.5999753",
"0.5944744",
"0.5878562",
"0.5847534",
"0.5842518",
"0.58084",
"0.5788473",
"0.576989",
"0.576602",
"0.57508147",
"0.57363915",
"0.57292",
... | 0.659483 | 1 |
try creating a tool | def test_create(self):
adminuser,adminpass = self.testdata.find_account_for('toolmanager')
self.utils.account.login_as(adminuser,adminpass)
self.contribtool.create(TOOLNAME) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateTool(tool_name, adb):\n if not tool_name:\n return BaseTool()\n\n ctor = TOOL_REGISTRY.get(tool_name)\n if ctor:\n return ctor(adb)\n else:\n print 'Unknown tool %s, available tools: %s' % (\n tool_name, ', '.join(sorted(TOOL_REGISTRY.keys())))\n sys.exit(1)",
"def __init__(self)... | [
"0.7138816",
"0.674259",
"0.6620302",
"0.65694636",
"0.6563388",
"0.65625006",
"0.6465202",
"0.6330793",
"0.6259287",
"0.62582386",
"0.6239101",
"0.6239101",
"0.6171976",
"0.61603737",
"0.6149126",
"0.61429274",
"0.6136209",
"0.61169505",
"0.6096762",
"0.6082505",
"0.60767466... | 0.71002924 | 1 |
try checking out a tool repository | def test_checkout_repository(self):
username,userpass = self.testdata.find_account_for('toolsubmitter')
self.contribtool.checkout_repository(TOOLNAME,username,userpass) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkGit(directory):",
"def checkout_repository(self,toolname,username,userpass):\n\n self.logger.info(\"checking out repository for the tool '%s'\" \\\n % (toolname))\n\n repo_url = self.repo_url_template % { 'hubname' : self.hubname,\n ... | [
"0.71959907",
"0.7070467",
"0.6455642",
"0.6443812",
"0.6233016",
"0.61705655",
"0.6142315",
"0.6128334",
"0.61182165",
"0.6109675",
"0.61017257",
"0.60902756",
"0.60762656",
"0.60590756",
"0.6029012",
"0.5992114",
"0.5905004",
"0.5884563",
"0.5875743",
"0.58673847",
"0.58608... | 0.7748996 | 0 |
try uploading files to a tool repository this test could fail because the files were already uploaded to the repository. | def test_upload(self):
username,userpass = self.testdata.find_account_for('toolsubmitter')
self.utils.account.login_as(username,userpass)
self.contribtool.upload(TOOLNAME,TOOLFILEDATA,username,userpass) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_upload_file1(self):\n pass",
"def test_local_uploader_upload_fails(self, mock):\r\n u = LocalUploader()\r\n file = FileStorage(filename='test.jpg')\r\n res = u.upload_file(file, container='user_3')\r\n err_msg = (\"Upload file should return False, \\\r\n ... | [
"0.68840677",
"0.67838186",
"0.6697778",
"0.669685",
"0.6506887",
"0.64800453",
"0.6426899",
"0.63991296",
"0.63564926",
"0.6355211",
"0.631035",
"0.6301128",
"0.62181616",
"0.6205094",
"0.616617",
"0.6156458",
"0.61401826",
"0.6116774",
"0.61146736",
"0.6112533",
"0.610581",... | 0.70617986 | 0 |
try launching the installed tool | def test_launch(self):
username,userpass = self.testdata.find_account_for('toolsubmitter')
self.utils.account.login_as(username,userpass)
self.contribtool.launch(TOOLNAME,username,userpass) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _doOpenTool(self):\n self._cmdOpenTool()",
"def test_install(self):\n\n\n adminuser,adminpass = self.testdata.find_account_for('toolmanager')\n\n self.utils.account.login_as(adminuser,adminpass)\n\n self.contribtool.install(TOOLNAME,adminuser,adminpass)",
"def on_tool(self):\n ... | [
"0.6820153",
"0.6487482",
"0.6487148",
"0.6283397",
"0.6231021",
"0.6196606",
"0.61219746",
"0.6111028",
"0.6092174",
"0.6066529",
"0.6026962",
"0.602373",
"0.6012944",
"0.5985569",
"0.5931272",
"0.5908863",
"0.5886388",
"0.5886388",
"0.5869839",
"0.5823822",
"0.5822041",
"... | 0.69957554 | 0 |
try editing the tool page with reasonable inputs | def test_edit_tool_page(self):
username,userpass = self.testdata.find_account_for('toolsubmitter')
self.utils.account.login_as(username,userpass)
self.contribtool.edit_tool_page(TOOLNAME,TOOLPAGEDATA) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit():",
"def edit_tool_page(self,toolname,data):\n\n self.logger.info(\"editing the tool information page for '%s'\" \\\n % (toolname))\n\n # navigate to the resource page edit forms\n po = self.catalog.load_pageobject('ToolsStatusInstalledPage',toolname)\n ... | [
"0.678698",
"0.65651256",
"0.6108619",
"0.61043316",
"0.59292734",
"0.5919997",
"0.59175444",
"0.58790976",
"0.5807817",
"0.5771664",
"0.57213056",
"0.56165123",
"0.55573577",
"0.5541328",
"0.552644",
"0.55165124",
"0.5500724",
"0.5452172",
"0.54455984",
"0.54309994",
"0.5402... | 0.7239939 | 0 |
try approving a tool | def test_approve(self):
username,userpass = self.testdata.find_account_for('toolsubmitter')
self.utils.account.login_as(username,userpass)
self.contribtool.approve(TOOLNAME,TOOLLICENSEDATA) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_launch(self):\n\n\n username,userpass = self.testdata.find_account_for('toolsubmitter')\n\n self.utils.account.login_as(username,userpass)\n\n self.contribtool.launch(TOOLNAME,username,userpass)",
"def approve(self,toolname,data):\n\n self.logger.info(\"approving the tool '%s... | [
"0.6702285",
"0.66051155",
"0.6317122",
"0.62871027",
"0.6216678",
"0.6048778",
"0.6022854",
"0.5933463",
"0.5794668",
"0.57708716",
"0.573364",
"0.56239754",
"0.56218135",
"0.559664",
"0.55302286",
"0.54937965",
"0.54704875",
"0.5464319",
"0.54447675",
"0.5437255",
"0.539726... | 0.73213416 | 0 |
try publishing a tool | def test_publish(self):
adminuser,adminpass = self.testdata.find_account_for('toolmanager')
self.utils.account.login_as(adminuser,adminpass)
self.contribtool.publish(TOOLNAME) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish(self,toolname):\n\n self.logger.info(\"publishing '%s'\" % (toolname))\n\n po = self.catalog.load_pageobject('ToolsStatusApprovedAdminPage',toolname)\n po.goto_page()\n\n # click the publish link\n publish_status,output = po.do_publish()\n\n # wait for the outp... | [
"0.6842895",
"0.6308079",
"0.62876385",
"0.61320245",
"0.60200137",
"0.5933823",
"0.58399594",
"0.57583684",
"0.57477105",
"0.573004",
"0.5704903",
"0.5648423",
"0.5631846",
"0.55870056",
"0.55545753",
"0.5528112",
"0.5528112",
"0.54937625",
"0.54732805",
"0.5465611",
"0.5463... | 0.73280954 | 0 |
Compute the close noncancer and cancer neighbors to the input to determine the status of the input | def nearest_neighbor(non_cancer_data, cancer_data):
#status is based on the mean of smallest elements of cancer and non_cancer groups
#sort
non_cancer_data = sorted(non_cancer_data)
cancer_data = sorted(cancer_data)
#choose nearest neighbors
non_cancer_neighbor = np.mean(non_cancer_data[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkNumNeighbors():",
"def investigate(self, nearest_neighbors):\n pass",
"def compute_controller(self):\n # region Input Info\n\n # here we implement an example for a consensus algorithm\n neig = self.get_neighbors()\n messages = self.get_messages()\n pos, rot = ... | [
"0.6244959",
"0.5817764",
"0.573169",
"0.56624854",
"0.56559217",
"0.5648396",
"0.563045",
"0.5625899",
"0.55937564",
"0.55898005",
"0.5549397",
"0.5544168",
"0.5535575",
"0.5534343",
"0.54949415",
"0.5485761",
"0.5479356",
"0.5476901",
"0.54709435",
"0.5470663",
"0.5469204",... | 0.62408763 | 1 |
Extract substation code from data row. | def parse_substation_code(row):
substation_regex = re.compile(r'\d{4,5}')
data_code = substation_regex.search(row)
return '\'' + row[data_code.end():data_code.end() + 7] + '\'' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_seat_row(bin_code_row):\n return decode_seat(bin_code_row, LIST_OF_SEAT_ROWS)",
"def get_category(cls, station_row):\n return station_row[0]",
"def sub_nr(self):\n return self._parse_sub_nr(self.sitemap)",
"def get_station_configuration(station_id, station_configuration):\n \n ... | [
"0.6035479",
"0.54217046",
"0.5290662",
"0.52731323",
"0.5268446",
"0.526388",
"0.52353895",
"0.52074397",
"0.51993144",
"0.51168567",
"0.5086211",
"0.5073383",
"0.5050183",
"0.49982622",
"0.4983962",
"0.4973588",
"0.49701568",
"0.49628595",
"0.49501124",
"0.4943627",
"0.4913... | 0.8350512 | 0 |
Extract date/time field from data row. | def parse_date_and_time(row):
datetime_regex = re.compile(r'\d{8}T\d{4}')
date_and_time = datetime_regex.search(row)
return '\'' + date_and_time.group() + '\'' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_field_data(self, _field, _line):\n if not _field:\n return None\n line_copy = _line\n for f in _field.split('.'):\n data_type = line_copy._fields[f].type\n line_copy = line_copy[f]\n if data_type == 'date':\n if line_copy:\n ... | [
"0.7048656",
"0.6721792",
"0.6585773",
"0.6578189",
"0.64627075",
"0.6410125",
"0.6401326",
"0.6387787",
"0.6226141",
"0.6146765",
"0.6133841",
"0.6045459",
"0.60313594",
"0.6020827",
"0.60062844",
"0.5977773",
"0.59393287",
"0.5914033",
"0.591367",
"0.590065",
"0.5893218",
... | 0.73774767 | 0 |
Extract depth field from data row. | def parse_depth(row):
depth = row[43:63].strip()
return '\'' + depth + '\'' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_depth_line(depth_line):\n data = depth_line.rstrip().split(\"\\t\")\n return data[0], tuple(int(d) for d in data[1:])",
"def get_depth(\n filepath,\n ):\n with xr.open_dataset(filepath) as fmesh:\n if 'refZMid' in fmesh.variables.keys():\n z = fmesh.data_vars['... | [
"0.60664207",
"0.59217393",
"0.5877236",
"0.58334523",
"0.5826558",
"0.5821364",
"0.5745728",
"0.57195723",
"0.57191163",
"0.57154286",
"0.57110316",
"0.56651556",
"0.56474566",
"0.55957127",
"0.55761844",
"0.55602646",
"0.5539543",
"0.5442519",
"0.5392313",
"0.53747755",
"0.... | 0.7379016 | 0 |
Pull date, time, depth, and data value from row. | def parse_row(row):
station_id = parse_substation_code(row)
date_and_time = parse_date_and_time(row)
depth = parse_depth(row)
quality_code = parse_quality_code(row)
value = parse_value(row)
return [station_id, date_and_time, depth, quality_code, value] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_from_row(x):\n\n import re\n\n data = []\n x = re.findall(\"<(TD|td)[^>*]+>(.*?)(</(td|TD)>)\", x, re.S)\n for rec in [tmp[1] for tmp in x]:\n if len(rec) == 0:\n data.append(None)\n continue\n # If no value\n if re.match(\"[-]+\", rec):\n ... | [
"0.6614232",
"0.6071792",
"0.6006179",
"0.58912724",
"0.5862483",
"0.58423465",
"0.58130795",
"0.57951176",
"0.5763571",
"0.5750192",
"0.5721182",
"0.5707198",
"0.5677642",
"0.5668646",
"0.5664663",
"0.56522816",
"0.563071",
"0.55977386",
"0.5585397",
"0.55829656",
"0.5570327... | 0.6693388 | 0 |
Lists the files created with earliest files created first as list Removing current log file from the list | def get_file_list_without_current_log():
full_list = sorted(filter(os.path.isfile, os.listdir('.')), key=os.path.getmtime)
full_list.remove("connect-log.log")
return full_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _most_recent_event_files(self):\n regex = re.compile(r\"\\w*events.log\")\n return [\n os.path.join(self._output_dir, x)\n for x in os.listdir(self._output_dir)\n if regex.search(x)\n ]",
"def select_superseded_by_new_file(logfiles):\n if len(logfiles)... | [
"0.6883264",
"0.68266535",
"0.6508133",
"0.6380411",
"0.63468295",
"0.6288173",
"0.6267701",
"0.6267701",
"0.62147945",
"0.61542094",
"0.6122174",
"0.61071897",
"0.61004645",
"0.6098549",
"0.6046838",
"0.6040869",
"0.6017607",
"0.59864366",
"0.59611887",
"0.5937643",
"0.59063... | 0.7751409 | 0 |
Using subprocess module to run tar command to tar first 5 files in the list | def compress_files(time_stamp, files_to_be_appended):
process = subprocess.run(["tar", "-czf", f"connect-log.{time_stamp}.tar.gz", files_to_be_appended[0],
files_to_be_appended[1],
files_to_be_appended[2],
files_to_be_appended... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_tarball(fileobj, path, callback=None):\n tar_cmd = [\"tar\", \"-zx\", \"--directory=%s\" % path]\n tar_proc = make_subprocess(tar_cmd, stderr=True, stdin=True)\n\n try:\n while True:\n chunk = fileobj.read(CHUNK_SIZE)\n if chunk == '':\n break\n\n ... | [
"0.6240035",
"0.6079148",
"0.6069795",
"0.60643286",
"0.6060481",
"0.6020235",
"0.58614236",
"0.58178926",
"0.57715046",
"0.5724574",
"0.56966203",
"0.565226",
"0.56094515",
"0.560592",
"0.5600271",
"0.5592912",
"0.55742025",
"0.5570388",
"0.5534809",
"0.54847836",
"0.5455829... | 0.66997415 | 0 |
N should be the system length temp is the temperature of the model thermizationSteps is the number of steps to evaluate before calculating the susceptability. This is an estimate based on the results shown in the ThermalizationTest.ipynb file. Since the cluster flip method is rather fast, we can increase this without c... | def calculateObservables(N, temp, thermalizationSteps=50, simulationSteps=100, skipSweeps=5, bootstrapM=500):
# Where we will store the magnetizations and energies
magnetizationArr = np.zeros(simulationSteps)
energyArr = np.zeros(simulationSteps)
# This isn't really a variable since the Wolff method r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ER_Theory(N,Kappa) :\n\tMu2 = Kappa - ( 2*Kappa*(1.0 - (Kappa/N))*math.log(N) )**0.5 + (( (Kappa*(1.0 - (Kappa/N)))/math.log(N) )**0.5)*( math.log( (2*math.pi*math.log((N**2)/(2*math.pi))) ) - 0.5772)\n\treturn Mu2",
"def simulation(N , T, sweeps, lattice = None, dimensions = 2, h = 0,\\\r\n ... | [
"0.5949058",
"0.57472867",
"0.5731854",
"0.56867546",
"0.56176406",
"0.5611611",
"0.5553457",
"0.5503641",
"0.5463964",
"0.5443737",
"0.54341555",
"0.5423535",
"0.53895754",
"0.53874874",
"0.53860545",
"0.5346902",
"0.5339758",
"0.5316133",
"0.53085434",
"0.5301927",
"0.52949... | 0.6052352 | 0 |
Recursively split and merge subsequences until the sequence is sorted in ascencing order. | def mergesort(sequence):
if len(sequence) <= 1:
return sequence
middle_index = len(sequence) // 2
left_half = mergesort(sequence[:middle_index])
right_half = mergesort(sequence[middle_index:])
return merge(left_half, right_half) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mergeSort(sequence):\n if len(sequence) <= 1:\n return sequence\n\n mid = len(sequence) // 2\n left = mergeSort(sequence[:mid])\n right = mergeSort(sequence[mid:])\n result = mergeSeq(left, right)\n return result",
"def merge_sort(alist):\n print(\"Splitting \", alist)\n # Temp... | [
"0.71595395",
"0.6428372",
"0.63263404",
"0.6250073",
"0.62155575",
"0.62136924",
"0.6177646",
"0.61723846",
"0.60708845",
"0.6058795",
"0.6022256",
"0.6011354",
"0.5982611",
"0.5962524",
"0.5955863",
"0.5945349",
"0.5945128",
"0.5943842",
"0.5938334",
"0.59306115",
"0.589652... | 0.6753704 | 1 |
Set the PB Id for this device. | def pb_id(self, pb_id: str):
# FIXME(BMo) instead of creating the object to check if the PB exists
# use a method on PB List?
# ProcessingBlock(pb_id)
self.set_state(DevState.ON)
self._pb_id = pb_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pb_id(self):\n return self._pb_id",
"def set_id(self, player_id):\n pass",
"def setID(self, idNb):\n self._id = idNb",
"def _set_id(self, value):\n pass",
"def player_b_id(self, player_b_id):\n\n self._player_b_id = player_b_id",
"def id(self, value):\n self.... | [
"0.64966524",
"0.61853826",
"0.6152964",
"0.6044323",
"0.6015985",
"0.6005453",
"0.5963273",
"0.59582216",
"0.58882314",
"0.5859666",
"0.5859666",
"0.5805439",
"0.57847154",
"0.5782313",
"0.57800746",
"0.5720057",
"0.5719524",
"0.57154655",
"0.5713418",
"0.56911194",
"0.55721... | 0.73184115 | 0 |
Return the PB configuration. | def pb_config(self):
pb = ProcessingBlock(self._pb_id)
return json.dumps(pb.config) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configuration(self) -> pulumi.Output['outputs.BrokerConfiguration']:\n return pulumi.get(self, \"configuration\")",
"def get_pb(cls):\n if cls.pb_singleton is None:\n # Init the config by reading conf file.\n with open(gflags.FLAGS.conf, 'r') as conf_file:\n ... | [
"0.76365185",
"0.7633313",
"0.74884564",
"0.7473088",
"0.7473088",
"0.73817724",
"0.7318932",
"0.7239872",
"0.7233952",
"0.72292024",
"0.72205544",
"0.7214669",
"0.7179086",
"0.7162158",
"0.71597296",
"0.71597296",
"0.71597296",
"0.71597296",
"0.71597296",
"0.71597296",
"0.71... | 0.81213135 | 0 |
Return the PB status. | def pb_status(self):
pb = ProcessingBlock(self._pb_id)
return pb.status | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status(self) -> Optional[pulumi.Input['GoogleRpcStatusArgs']]:\n return pulumi.get(self, \"status\")",
"def status(self):\n return self.job_proto.status",
"def get_status(self):\n return self.read_register(259, 0, 3)",
"def GetStatus(self):\r\n return self.status",
"def status(s... | [
"0.748426",
"0.74344295",
"0.73494816",
"0.7336648",
"0.7281781",
"0.7255409",
"0.7245639",
"0.7226043",
"0.7220577",
"0.7219067",
"0.7219067",
"0.7219067",
"0.7211349",
"0.72102946",
"0.72102946",
"0.72102946",
"0.7206343",
"0.7171258",
"0.7169861",
"0.7169861",
"0.7169861",... | 0.8183227 | 0 |
Return the PB type. | def pb_type(self):
pb = ProcessingBlock(self._pb_id)
return pb.type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self):\n return struct.unpack('<B', self.raw_data[0])[0]",
"def get_prob_type(self):\n return self.prob_type",
"def get_prob_type(self):\n return self.prob_type",
"def get_prob_type(self):\n return self.prob_type",
"def get_prob_type(self):\n return self.prob_typ... | [
"0.7150234",
"0.711675",
"0.711675",
"0.711675",
"0.711675",
"0.711675",
"0.71143746",
"0.7084533",
"0.67769337",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6726569",
"0.6... | 0.81068826 | 0 |
Return the PB SBI ID. | def sbi_id(self):
pb = ProcessingBlock(self._pb_id)
return pb.sbi_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slb_id(self) -> str:\n return pulumi.get(self, \"slb_id\")",
"def slb_id(self) -> Optional[str]:\n return pulumi.get(self, \"slb_id\")",
"def pb_id(self):\n return self._pb_id",
"def bundle_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"bundle_id\")",
"def bundl... | [
"0.7621479",
"0.7370411",
"0.699108",
"0.639967",
"0.6398751",
"0.6398751",
"0.63171685",
"0.6310983",
"0.60538524",
"0.60319006",
"0.59738487",
"0.59508866",
"0.59508866",
"0.59508866",
"0.5949153",
"0.5942801",
"0.59301674",
"0.59172165",
"0.5916395",
"0.5880143",
"0.587544... | 0.7872429 | 0 |
Return the PB version. | def pb_version(self):
pb = ProcessingBlock(self._pb_id)
return pb.version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version():\n return 1",
"def getVersion(self):\n return self.get('Version', type=\"numeric\")",
"def version_bytes(self) -> str:\n return pulumi.get(self, \"version_bytes\")",
"def version(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"version\")",
"def v... | [
"0.7539279",
"0.7402672",
"0.7380974",
"0.7366826",
"0.73500127",
"0.73500127",
"0.73500127",
"0.73500127",
"0.73500127",
"0.7346567",
"0.7304102",
"0.7264263",
"0.72521174",
"0.72521174",
"0.72521174",
"0.72521174",
"0.72402185",
"0.72220427",
"0.7211861",
"0.71895564",
"0.7... | 0.78863907 | 0 |
return True if there's only one positive in list a | def onlyonepositive(a):
nbr = 0
for e in a:
if e >= 0:
nbr += 1
if nbr>1: return False
return nbr==1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_positive(l):\n return any([p > 0 for p in l])",
"def nonzero(list_):\n for a in list_:\n if a!=0:\n return True\n return False",
"def one(xs):\n ret = False\n for x in xs:\n if x:\n if ret:\n return False\n ret = True\n ret... | [
"0.79136527",
"0.75286084",
"0.7246378",
"0.69286513",
"0.6856929",
"0.6703854",
"0.6646832",
"0.65774983",
"0.6548113",
"0.6373951",
"0.6364425",
"0.6286034",
"0.62806034",
"0.62806034",
"0.62806034",
"0.62572545",
"0.6236722",
"0.6236241",
"0.61793375",
"0.6179061",
"0.6149... | 0.8242905 | 0 |
look for an alignment of nbr_aligned in vertic, horiz or diag return 0 if no one, symbol of aligned if aligned, 3 if drawgame | def findAligned(self,nbr_aligned):
bVerbose = 0
# horiz:
for j in range(self.h):
nPrev = -1
nConsecutive = 0
for i in range(self.w):
val = self.world[j][i]
if val == nPrev:
nConsecutive += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_alignment(name):\n translate_alignment = {\n 'middle': 'center',\n 'center-left': 'left',\n 'center-right': 'right',\n 'bottom-left': 'left',\n 'bottom-right': 'right',\n 'bottom-center': 'center',\n }\n\n if name in translate_alignment:\n return ... | [
"0.64194375",
"0.62821376",
"0.62743527",
"0.62493867",
"0.6240633",
"0.6017552",
"0.593718",
"0.58469516",
"0.56892633",
"0.56892633",
"0.56892633",
"0.5585898",
"0.5584217",
"0.5571449",
"0.5571449",
"0.5516358",
"0.55143595",
"0.5503789",
"0.55022955",
"0.5496738",
"0.5485... | 0.71625704 | 0 |
Samples a normal distribution for germination and maturation times. Uses these values to compute an individual plant's growth time and c1 value. germination_time (float, float) the mean and standard deviation from which to sample a germination time from. maturation_time (float , float) the mean and standard deviation f... | def generate_growth_time(germination_time, maturation_time, r_max, r_0, k2, c2):
maturation_length = np.random.normal(maturation_time[0], maturation_time[1])
germination_length = np.random.normal(germination_time[0], germination_time[1])
# maturation_length = maturation_time[0] - maturation_time[1]
# ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_from_table_values(\n name=\"plant\", color=(0/255, 128/255, 0/255),\n germination_time=(3, 1), \n r_max=(1.0,1.0),\n maturation_time=(10, 1),\n stopping_color=(0, 0, 1),\n color_step=(10/255, 0, 0),\n c1=0.1,\n r_0=0.04\n ):\n\n c2 = 1\n k1, k2 = 0.3, 0.7\n unocclud... | [
"0.5154238",
"0.50906456",
"0.50869304",
"0.49714231",
"0.4955749",
"0.49182084",
"0.4824892",
"0.47782683",
"0.47753283",
"0.4694181",
"0.4691652",
"0.4644808",
"0.45964038",
"0.45715842",
"0.45476094",
"0.4538349",
"0.45376593",
"0.4447204",
"0.44462416",
"0.4428397",
"0.44... | 0.673778 | 0 |
Check whether this user is Googler or not. | def IsGoogler():
p = subprocess.run('goma_auth info',
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
shell=True)
if p.returncode != 0:
return False
lines = p.stdout.splitlines()
if len(lines) == 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gatekeeper():\n\n if user.name in GATEKEEPERS:\n return True\n\n return False",
"def has_user(self, user): # pylint: disable=unused-argument\r\n return False",
"def is_gaffer():\n try:\n import Gaffer\n return True\n except ImportError:\n return False",
"de... | [
"0.5658526",
"0.56523955",
"0.55609894",
"0.545761",
"0.542136",
"0.53906053",
"0.538762",
"0.53199047",
"0.52754885",
"0.52618027",
"0.5260349",
"0.52470076",
"0.5225015",
"0.5220754",
"0.5208855",
"0.5194109",
"0.51866645",
"0.5176642",
"0.5160453",
"0.5137892",
"0.5095791"... | 0.82736593 | 0 |
Parse gn_args as json and return config dictionary. | def ParseGNArgs(gn_args):
configs = json.loads(gn_args)
build_configs = {}
for config in configs:
key = config["name"]
if key not in ALLOWLISTED_CONFIGS:
continue
if 'current' in config:
build_configs[key] = config['current']['value']
else:
build_configs[key] = config['default']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_config(args):\n if args.get('--config-file'):\n config = parse_config_file(args.get('--config-file'))\n else:\n config = {\n 'oauth_token': args['--oauth-token'],\n 'channel_name': args['--channel-name'],\n 'cmd_rate': args['--cmd-rate'],\n ... | [
"0.681122",
"0.6523368",
"0.6468884",
"0.644024",
"0.6435658",
"0.63748336",
"0.63405865",
"0.62336934",
"0.6081828",
"0.60427666",
"0.601303",
"0.5979183",
"0.5968818",
"0.5929509",
"0.5907864",
"0.58867306",
"0.5880652",
"0.58764577",
"0.5863041",
"0.58328426",
"0.58026564"... | 0.800169 | 0 |
Get build targets from commandline. | def GetBuildTargetFromCommandLine(cmdline):
# Skip argv0, argv1: ['/path/to/python3', '/path/to/depot_tools/ninja.py']
idx = 2
# Skipping all args that involve these flags, and taking all remaining args
# as targets.
onearg_flags = ('-C', '-d', '-f', '-j', '-k', '-l', '-p', '-t', '-w')
zeroarg_flags = ('-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_targets(self):\n return self._combined_all_versioned_targets.targets",
"def get_targets(self, sort_by_dependency = False):\n\t\treturn self.__targets.get_targets(sort_by_dependency)",
"def get_buildall_target(self):\n raise NotImplementedError",
"def get_targets(self):\n\t\treturn self.prDo... | [
"0.6601787",
"0.61991537",
"0.61881906",
"0.61666006",
"0.6137935",
"0.6034638",
"0.6028355",
"0.60090566",
"0.5968992",
"0.5960824",
"0.5954286",
"0.59510213",
"0.59339863",
"0.59014314",
"0.5868651",
"0.5866488",
"0.58243793",
"0.5782831",
"0.5763116",
"0.576058",
"0.575570... | 0.7179802 | 0 |
Parse cmdline to get flag value for j | def GetJflag(cmdline):
for i in range(len(cmdline)):
if (cmdline[i] == '-j' and i + 1 < len(cmdline)
and cmdline[i + 1].isdigit()):
return int(cmdline[i + 1])
if (cmdline[i].startswith('-j') and cmdline[i][len('-j'):].isdigit()):
return int(cmdline[i][len('-j'):]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_commandline():\n parser = optparse.OptionParser()\n\n parser.add_option(\"-l\",\"--lamp\", default=100, type=int)\n parser.add_option(\"-c\",\"--doCompile\", action=\"store_true\", default=False)\n parser.add_option(\"--doLamp\", action=\"store_true\", default=False)\n\n opts, args = parse... | [
"0.64365405",
"0.6410326",
"0.6289912",
"0.6289912",
"0.6289912",
"0.62632984",
"0.61950153",
"0.6187541",
"0.61855596",
"0.6166411",
"0.61443275",
"0.60903186",
"0.6083637",
"0.6043933",
"0.59872675",
"0.59824777",
"0.5971987",
"0.59577477",
"0.5920041",
"0.5917615",
"0.5891... | 0.80322886 | 0 |
GetNinjalog returns the path to ninjalog from cmdline. | def GetNinjalog(cmdline):
# ninjalog is in current working directory by default.
ninjalog_dir = '.'
i = 0
while i < len(cmdline):
cmd = cmdline[i]
i += 1
if cmd == '-C' and i < len(cmdline):
ninjalog_dir = cmdline[i]
i += 1
continue
if cmd.startswith('-C') and len(cmd) > len(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCommandLine():\n import sys, os\n cmdline = os.path.abspath(sys.argv[0])\n for elem in sys.argv[1:]:\n cmdline += ' ' + ecohydrolib.util.getAbsolutePathOfItem(elem)\n return cmdline",
"def get_cli_string():\n return os.path.basename(sys.argv[0]) + \" \" + \" \".jo... | [
"0.5588373",
"0.54324126",
"0.52451783",
"0.5194326",
"0.5177162",
"0.511726",
"0.50581485",
"0.5055935",
"0.50081205",
"0.49547255",
"0.49529222",
"0.4951465",
"0.49281996",
"0.49199766",
"0.49046162",
"0.49046162",
"0.48872742",
"0.48494446",
"0.48481107",
"0.48060882",
"0.... | 0.81788594 | 0 |
Prints the privileges of the administrator. | def show_privileges(self):
print("\nAdministrator privileges: ")
for privilege in self.privileges:
print("- " + privilege) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_privileges(self):\n\t\tprint(\"An administrator has following privileges: \")\n\t\tfor item in self.privileges:\n\t\t\tprint(item)",
"def show_privileges(self):\n print(\"This admin user has the following privileges:\")\n for item in self.privileges:\n print(f\"- {item}\")",
"... | [
"0.87321246",
"0.8604651",
"0.8479883",
"0.8272347",
"0.81920725",
"0.8137227",
"0.7177757",
"0.64238846",
"0.621861",
"0.58872664",
"0.5852666",
"0.57607806",
"0.56933826",
"0.5691742",
"0.56716174",
"0.56637865",
"0.5658122",
"0.56551594",
"0.56508034",
"0.5645882",
"0.5641... | 0.8900624 | 0 |
GDrive specific changes to get link to raw file | def _transform_gdrive_url(self):
fileid = self.parsed.path.replace('/file/d/', '').split('/')[0]
self.url = self.GDRIVE_LINK_TEMPLATE.format(fileid=fileid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n credentials = get_credentials()\n http = credentials.authorize(httplib2.Http())\n service = discovery.build('drive', 'v3', http=http)\n\n fileId = '0B3wvsjTJuTRQMHhWY2JlLW9iSnM'\n new_file = r'./test/data/repos.zip'\n # request = service.files().get_media(fileId=fileId)\n # print... | [
"0.60444397",
"0.59902704",
"0.59704113",
"0.5878977",
"0.584915",
"0.58224016",
"0.57821333",
"0.57558644",
"0.57174796",
"0.57011086",
"0.56789714",
"0.567568",
"0.5661108",
"0.56431353",
"0.5630471",
"0.562891",
"0.5615263",
"0.5615123",
"0.5607094",
"0.5593683",
"0.553104... | 0.6976503 | 0 |
Compose bleach params upon filter instantiation | def test_compose_params(self):
filter = Bleach(**self.params)
self.assertEquals(self.params, filter.bleach_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filter_kwargs(self, *_, **__) -> Dict[str, Any]:",
"def get_filters(self):",
"def _get_filter_args(self, filter):\n kwargs = {}\n for arg in filter.args[1:]:\n kwargs[arg] = input(f'Type the {arg.replace(\"_\", \" \").title()}: ')\n return kwargs",
"def filter(self, fi... | [
"0.71912456",
"0.6726626",
"0.66933006",
"0.66047245",
"0.6561875",
"0.65087306",
"0.6484192",
"0.64073014",
"0.634722",
"0.630859",
"0.6233492",
"0.62135726",
"0.6206477",
"0.6184562",
"0.61685574",
"0.6127267",
"0.60728323",
"0.60195214",
"0.59213275",
"0.59028876",
"0.5897... | 0.6920757 | 1 |
Bleach filter can filter out tags | def test_can_filter_tags(self):
text = '<b><i>Example</i></b><!-- comment -->'
filter = Bleach(tags=['b'], strip=True)
filtered = filter.filter(text)
expected = '<b>Example</b>'
self.assertEquals(expected, filtered) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, filters):",
"def filter_tag(tags=None):\n tagdict = defaultdict(list)\n Besarkecil = lambda f: ' '.join(re.findall('[A-Z][^A-Z]*', f))\n for obj in list(tags):\n if len(obj.split(':')) == 2:\n k, v = obj.split(':')\n ... | [
"0.70160383",
"0.6746902",
"0.66870993",
"0.6576759",
"0.6261168",
"0.624502",
"0.6242148",
"0.62291527",
"0.6181457",
"0.6171481",
"0.6167472",
"0.6073619",
"0.60643786",
"0.60334784",
"0.5983406",
"0.5945215",
"0.5931446",
"0.59123325",
"0.58913463",
"0.5817208",
"0.5808415... | 0.753762 | 0 |
Bleach filter can filter out attributes | def test_can_filter_attributes(self):
text = '<b><a href="" target="_blank">Example</a></b>'
filter = Bleach(
tags=['a'],
attributes=dict(a=['href', 'title'])
)
filtered = filter.filter(text)
expected = '<a href="">Example</a>'
self.assertEquals(ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, filters):",
"def filter(self, *args, **kwargs):",
"def filter_attributes_choices(self): \n filter_attributes = [\n 'no filters',\n 'user_id',\n 'device_id',\n 'device_first_seen_ts',\n 'device_first_view_ts', \n... | [
"0.70792395",
"0.70239156",
"0.6754155",
"0.67471063",
"0.67362404",
"0.6380675",
"0.6313838",
"0.6263082",
"0.62301797",
"0.6168099",
"0.6127752",
"0.6056724",
"0.60106957",
"0.5980096",
"0.5960994",
"0.59234774",
"0.59154946",
"0.5902669",
"0.5888979",
"0.58759624",
"0.5852... | 0.7079341 | 0 |
Bleach filter can filter out inline styles | def test_can_filter_inline_styles(self):
text = '<a href="" style="color: red; border: 1px">Example</a>'
filter = Bleach(
tags=['a'],
attributes=['style', 'href'],
styles=['color'],
)
filtered = filter.filter(text)
expected = '<a href="" style=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_filter_inline_styles(self):\n text = '<a href=\"https://google.com\">Example</a>'\n filter = Bleach(\n tags=['a'],\n attributes=['href'],\n protocols=['http'],\n )\n filtered = filter.filter(text)\n expected = '<a>Example</a>'\n\n ... | [
"0.6594239",
"0.5665263",
"0.55692995",
"0.5564535",
"0.5551875",
"0.5536185",
"0.54827803",
"0.5428872",
"0.5401937",
"0.53712416",
"0.53503674",
"0.532025",
"0.52918446",
"0.52055675",
"0.5198793",
"0.5162466",
"0.5155935",
"0.51286256",
"0.51285195",
"0.5111287",
"0.510602... | 0.73529154 | 0 |
Bleach filter can filter out inline styles | def test_can_filter_inline_styles(self):
text = '<a href="https://google.com">Example</a>'
filter = Bleach(
tags=['a'],
attributes=['href'],
protocols=['http'],
)
filtered = filter.filter(text)
expected = '<a>Example</a>'
# assert link... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_can_filter_inline_styles(self):\n text = '<a href=\"\" style=\"color: red; border: 1px\">Example</a>'\n filter = Bleach(\n tags=['a'],\n attributes=['style', 'href'],\n styles=['color'],\n )\n filtered = filter.filter(text)\n expected = '... | [
"0.7353172",
"0.56646985",
"0.5569359",
"0.55654955",
"0.5553906",
"0.5535537",
"0.54822105",
"0.5429889",
"0.54026866",
"0.537104",
"0.5352389",
"0.53219706",
"0.52933806",
"0.5204843",
"0.5198707",
"0.5164209",
"0.5155588",
"0.51289475",
"0.51268584",
"0.51116693",
"0.51046... | 0.6594453 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.