query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Remove trailing zeros (and the trailing decimal point that might be left) from the hours, which is a float. | def format_hours(self, data):
return unicode('%f' % data).rstrip('0').rstrip('.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AstroDecHours2DecDay(decimalHours):\n \n return decimalHours / 24",
"def _lead_time_to_string(lead_time_hours):\n\n error_checking.assert_is_geq(lead_time_hours, 0)\n return '{0:03d}'.format(int(numpy.round(lead_time_hours)))",
"def normalise_time(time_str):\n\n hour = time_str.split(\":\")[... | [
"0.60905784",
"0.5748976",
"0.5713018",
"0.5689071",
"0.55027246",
"0.5477129",
"0.54370457",
"0.5431138",
"0.54268163",
"0.5401181",
"0.5371905",
"0.535964",
"0.53177106",
"0.5313104",
"0.53107476",
"0.5304056",
"0.5301728",
"0.5299804",
"0.52817905",
"0.5264034",
"0.525151"... | 0.70133984 | 0 |
Determine whether this is a night class. | def format_evening(self, data):
return (self.input['start_time'].hour - 12) >= profile.evening_threshold | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_armed_night(self):\n return self in (\n ArmingState.ARMED_STAY_NIGHT,\n ArmingState.ARMED_STAY_NIGHT_BYPASS_PROA7,\n ArmingState.ARMED_STAY_NIGHT_INSTANT_PROA7,\n ArmingState.ARMED_STAY_NIGHT_INSTANT_BYPASS_PROA7,\n )",
"def _nightmode_active(self)... | [
"0.6527473",
"0.6414756",
"0.6175922",
"0.602546",
"0.5998195",
"0.5900918",
"0.58496946",
"0.57989836",
"0.57856333",
"0.5643815",
"0.5620943",
"0.56155616",
"0.56085783",
"0.55528224",
"0.5540289",
"0.55359757",
"0.5533042",
"0.5521824",
"0.54942524",
"0.5462528",
"0.543737... | 0.0 | -1 |
Return a Spec which will validate every value, but which will conform values not meeting the Spec to a default value. | def default_spec(
tag_or_pred: Union[Tag, SpecPredicate],
*preds: SpecPredicate,
default: Any = None,
conformer: Optional[Conformer] = None,
) -> Spec:
tag, preds = tag_maybe(tag_or_pred, *preds)
if len(preds) != 1:
raise ValueError("Must provide exactly one Spec predicate for 'default'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_default(self, value):\n return self.__validate(value, self.validate_default_element)",
"def testDefault(self):\n for val in (1, {}, 'test', None):\n prop = make_prop(default=val)\n self.assertEqual(val, prop.interpret(recipe_api.PROPERTY_SENTINEL, {}))",
"def test_schema_default_mi... | [
"0.612875",
"0.59103674",
"0.59051394",
"0.59044427",
"0.5830519",
"0.5766347",
"0.5623701",
"0.5590664",
"0.55527115",
"0.550996",
"0.54377204",
"0.5407819",
"0.53949434",
"0.5346402",
"0.53418934",
"0.53382105",
"0.5294812",
"0.52543616",
"0.5215354",
"0.5208035",
"0.518366... | 0.5461201 | 10 |
Return a spec that can validate strings containing email addresses. Email string specs always verify that input values are strings and that they can | def email_spec(
tag: Tag = "email", conformer: Optional[Conformer] = None, **kwargs
) -> Spec:
@pred_to_validator(f"Value '{{value}}' is not type 'str'", complement=True)
def is_str(x: Any) -> bool:
return isinstance(x, str)
child_validators = []
for email_attr in _EMAIL_RESULT_FIELDS:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_valid(email_string):\n if not email_string:\n raise WrongInput(\"Input cannot be blank\")\n if not isinstance(email_string, str):\n raise WrongInput(\"Invalid email address\")\n\n if '@' not in email_string or '.' not in email_string:\n raise WrongInput('Invalid email addres... | [
"0.70175207",
"0.68795985",
"0.6784048",
"0.67066634",
"0.6557823",
"0.6530631",
"0.6491231",
"0.64875734",
"0.6387207",
"0.63726294",
"0.6368719",
"0.63425255",
"0.63215315",
"0.6276348",
"0.6220629",
"0.6212647",
"0.6200464",
"0.6178973",
"0.61641055",
"0.61536276",
"0.6151... | 0.7692693 | 0 |
Get the comments of the Post object | def get_comments(self):
self.comments = graph.get_connections(post['id'], 'comments') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments(self):\n\t\treturn self._client.get_comments(self)",
"def get_comments(id_post):\n return Comms.objects.filter(post__id=id_post)",
"def comments(self, request, pk=None):\n post = self.get_object()\n comments = Comment.objects.filter(post=post).order_by('created_at')\n s... | [
"0.7950904",
"0.78599524",
"0.7510495",
"0.75018305",
"0.7459841",
"0.7444467",
"0.73467",
"0.7286224",
"0.7286224",
"0.72833335",
"0.7244442",
"0.71981066",
"0.7115018",
"0.71108985",
"0.7093227",
"0.7093227",
"0.7093227",
"0.7066476",
"0.7031515",
"0.70136917",
"0.6995091",... | 0.8358504 | 0 |
Generate a random string of fixed length | def random_string(string_length=10):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(string_length)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))",
"def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",... | [
"0.86810505",
"0.8573398",
"0.8549153",
"0.85291016",
"0.852194",
"0.84337574",
"0.8433061",
"0.84165514",
"0.8411733",
"0.8390179",
"0.8346973",
"0.8344882",
"0.8341727",
"0.83356076",
"0.8323762",
"0.82998705",
"0.8290879",
"0.82825434",
"0.82822",
"0.8281794",
"0.82652897"... | 0.78558993 | 71 |
(x, y) Positions of Horizontal lines, return a list | def _getHLinesPoints(self, character, size):
if character in _HORIZONTAL_MAP.keys():
hline_map = _HORIZONTAL_MAP[character] #(3 dimension tuple)
else:
hline_map = _HORIZONTAL_MAP['*']
# i*(size+1) fit the position series in the rows
hline_points = [(i*(si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def makeLeftRightline(self):\r\n left_lines = []\r\n right_lines = []\r\n for i in self.lines:\r\n for x1,y1,x2,y2 in i:\r\n if x1 == x2:\r\n #Vertical Lines\r\n pass\r\n else:\r\n m = (y2 - y1) /... | [
"0.68665314",
"0.6787137",
"0.6616824",
"0.6606193",
"0.6603586",
"0.6523512",
"0.6519659",
"0.6514005",
"0.64926636",
"0.63878745",
"0.63795507",
"0.63550705",
"0.6351874",
"0.63415223",
"0.6334288",
"0.6307821",
"0.628389",
"0.62729794",
"0.626088",
"0.62410575",
"0.6195096... | 0.6853692 | 1 |
(x, y) Positions of vertical lines, return a list | def _getVLinesPoints(self, character, size):
vline_map = _VERTICAL_MAP[character]
vline_positions = [(1, 0), (1, size+1), (size+2, 0), (size+2, size+1)]
vline_points = [vline_positions[i] for i in range(4) if vline_map[i] == 1]
return vline_points | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vertical(self, x, y):\n\n return [row[x] for row in self._board]",
"def _vLine(self, x):\n _left, top, _width, height = self.plot.getPlotBoundsInPixels()\n\n dataPos1 = self.plot.pixelToData(x, top, check=False)\n dataPos2 = self.plot.pixelToData(x, top + height, check=False)\... | [
"0.7081453",
"0.6651377",
"0.66304505",
"0.6569236",
"0.65361035",
"0.6528759",
"0.6526476",
"0.6515634",
"0.6435364",
"0.6362914",
"0.63264936",
"0.63061404",
"0.6236618",
"0.62273675",
"0.6205779",
"0.6159849",
"0.61541903",
"0.6139878",
"0.6111455",
"0.61095685",
"0.606590... | 0.68428665 | 1 |
Turn the children of node into a dict, keyed by tag name. This is only a shallow conversation child nodes are not recursively processed. | def xml_children_as_dict(node):
return dict((e.tag, e.text) for e in node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_children(node: etree.Element) -> t.Mapping[str, etree.Element]:\n return {child.tag: child for child in node}",
"def get_children(self):\n if self._child_val is not None:\n return {self._child_key: self._child_val}\n if self._children is not None:\n return dict(se... | [
"0.7260039",
"0.6857858",
"0.6763899",
"0.67602456",
"0.6744296",
"0.6611385",
"0.6578196",
"0.65404546",
"0.65226346",
"0.64374834",
"0.63099986",
"0.62476134",
"0.6239519",
"0.61952513",
"0.60669154",
"0.6023519",
"0.6011944",
"0.5996984",
"0.59876925",
"0.59859884",
"0.595... | 0.7581949 | 0 |
Transform an Element tree to a list of entities recursively. Possible child entities are added to each entity `_children` list. | def element_to_objects(tree):
entities = []
for element in tree:
cls = MAPPINGS.get(element.tag, None)
if not cls:
continue
attrs = xml_children_as_dict(element)
transformed = transform_attributes(attrs)
if hasattr(cls, "fill_extra_attributes"):
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_children(self):\n\n for child in self.children:\n yield child\n for sub_child in child.all_children():\n yield sub_child",
"def _children(self):\n for codeobj in self.body:\n if isinstance(codeobj, CodeEntity):\n yield codeobj",... | [
"0.58883345",
"0.5800416",
"0.5793394",
"0.569851",
"0.567552",
"0.56672955",
"0.56266534",
"0.56160915",
"0.56075317",
"0.55881494",
"0.5578008",
"0.5553922",
"0.55355644",
"0.5533695",
"0.55321294",
"0.55286294",
"0.5526044",
"0.54763865",
"0.54687625",
"0.5464507",
"0.5459... | 0.75227904 | 0 |
Save the form, creating a user if validation passes. The user will be created with the provided username, email address, password, and full name. If there are failures in creating this user, or there's an existing user with the given name, an error will be raised. Creation always occurs in its own transaction, ensuring... | def save(self):
if not self.errors:
username = self.cleaned_data['username']
try:
with transaction.atomic():
return User.objects.create_user(
username=username,
password=self.cleaned_data['password1'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se... | [
"0.7636745",
"0.7633561",
"0.7625627",
"0.76068926",
"0.75905216",
"0.7583154",
"0.75717664",
"0.75357467",
"0.7505619",
"0.74959433",
"0.74842966",
"0.7406905",
"0.7400508",
"0.73897624",
"0.73879075",
"0.7384229",
"0.7354026",
"0.7343632",
"0.7340874",
"0.7323432",
"0.73223... | 0.8243964 | 0 |
Absolute path for the package. | def get_pack_path():
return get_package_path().replace("\\", "/").replace("src", "") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_package_path(self) -> str:\n return self._app_package_path",
"def get_package_path():\n package_name = get_package_name()\n return package_name.replace('.', '/')",
"def package_dir(self):\r\n return \".\"",
"def path(self):\n path = os.path.join(self.base_dir, self.store().repl... | [
"0.78314",
"0.77375686",
"0.7661747",
"0.7619996",
"0.7466306",
"0.74315745",
"0.7268875",
"0.7261624",
"0.72011375",
"0.71791935",
"0.71791935",
"0.71301985",
"0.70722663",
"0.7069",
"0.7052365",
"0.70192754",
"0.6948155",
"0.6925366",
"0.6904686",
"0.6865187",
"0.6864142",
... | 0.7032795 | 15 |
Construct the URL for a particular API call. This method is used internally to come up with the URL to use when making RPCs to the Cloud Datastore API. | def build_api_url(project, method, base_url):
return API_URL_TEMPLATE.format(
api_base=base_url, api_version=API_VERSION, project=project, method=method
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __build_url(self, api_call, **kwargs):\n kwargs['key'] = self.api_key\n if 'language' not in kwargs:\n kwargs['language'] = self.language\n if 'format' not in kwargs:\n kwargs['format'] = self.__format\n api_query = urlencode(kwargs)\n\n return \"{0}{1}?... | [
"0.77305657",
"0.7546644",
"0.7546644",
"0.7305107",
"0.7298044",
"0.71652263",
"0.7124695",
"0.7096156",
"0.7063505",
"0.703609",
"0.6946037",
"0.6911422",
"0.68210614",
"0.6805163",
"0.6799172",
"0.6729972",
"0.66943413",
"0.6666511",
"0.6663158",
"0.6650004",
"0.66153646",... | 0.70072347 | 10 |
Number of bytes before evicting or None if this cache never evicts. | def limit_bytes(self):
return self._limit_bytes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_size(self):\n return 0",
"def get_size(self):\n return len(self.cache)",
"def cache_size(self):\n return len(self._cache)",
"def size(self):\n\t\treturn len(self.cache)",
"def cache_size(self):\n return self.cachesize",
"def size(self):\n return len(self.cache... | [
"0.71117264",
"0.66159964",
"0.65699637",
"0.6548371",
"0.6473349",
"0.64241904",
"0.6375474",
"0.63718534",
"0.6301681",
"0.6155175",
"0.6001963",
"0.6001963",
"0.6001963",
"0.6001963",
"0.5983991",
"0.5983638",
"0.598139",
"0.5917217",
"0.5912438",
"0.589802",
"0.5832829",
... | 0.0 | -1 |
Current sum of `nbytes` of all objects in the cache. | def current_bytes(self):
return self._current_bytes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_size(self):\n return 0",
"def totalsize(self):\n return sum([sz for sz in self.iterate()])",
"def cache_size(self):\n return self.cachesize",
"def size(self):\n\t\treturn len(self.cache)",
"def get_size(self):\n return len(self.cache)",
"def __get_cache_size(self):\n... | [
"0.68132645",
"0.6643716",
"0.657197",
"0.6530644",
"0.6492846",
"0.64674234",
"0.64640534",
"0.6407826",
"0.6391903",
"0.6388461",
"0.6367094",
"0.6212229",
"0.6089934",
"0.6088264",
"0.6074018",
"0.6056775",
"0.6048905",
"0.60218287",
"0.60188",
"0.5998338",
"0.5989065",
... | 0.0 | -1 |
Try to get an object from the cache. Raises `KeyError` if it is not found. (Threadsafe and lockless.) | def __getitem__(self, where):
return self._data[where] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_get(item: str) -> object:\n\titem = str(item)\n\tcache = cache_find(item)\n\n\t# cache_find() will return none if the cache does not exist\n\t# the returned location is guaranteed to exist, so no point checking again.\n\n\tif cache is not None:\n\t\ttry:\n\t\t\tcached = pickle.load(open(cache, \"rb\"))\n... | [
"0.75848955",
"0.7477291",
"0.71280116",
"0.7013496",
"0.6966401",
"0.6947844",
"0.6928862",
"0.68085426",
"0.67581034",
"0.6747027",
"0.6736363",
"0.6723115",
"0.67164624",
"0.6715248",
"0.6715248",
"0.6712343",
"0.67122704",
"0.666485",
"0.66196424",
"0.6606576",
"0.659246"... | 0.0 | -1 |
Return a list of actions available for the service Returns a list of available actions for the service. | def get_actions(self):
if self.description == exceptions.NotAvailableError:
raise exceptions.NotAvailableError('Can\'t get actions because a description for this service is'
' not available.')
return list(self.actions.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_available_actions(self):\n return self.actions",
"def actions(self):\n return self._action_list",
"def get_actions(self):\n return []",
"def get_list_of_actions(self):\n return self.actions",
"def get_actions(self):\n return self.agent.get_actions()",
"def actio... | [
"0.7910947",
"0.76743203",
"0.76711476",
"0.7629608",
"0.7533723",
"0.7300489",
"0.72807014",
"0.72304475",
"0.72264194",
"0.71850127",
"0.71850127",
"0.71342677",
"0.71342677",
"0.71342677",
"0.7094187",
"0.70902497",
"0.7058974",
"0.7043642",
"0.70093775",
"0.69916785",
"0.... | 0.8303406 | 0 |
Get the service actions Gets the actions available for the service. | def _get_actions_request(self):
all_actions = {}
service_description = self.description
root = minidom.parseString(service_description)
actions = root.getElementsByTagName('action')
for action in actions:
action_name = action.getElementsByTa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_actions(self):\n\n if self.description == exceptions.NotAvailableError:\n raise exceptions.NotAvailableError('Can\\'t get actions because a description for this service is'\n ' not available.')\n return list(self.actions... | [
"0.79665446",
"0.7591718",
"0.75200814",
"0.73988086",
"0.73988086",
"0.73789567",
"0.7368557",
"0.73604137",
"0.73237854",
"0.73179847",
"0.73179847",
"0.73179847",
"0.7298801",
"0.72076637",
"0.7166271",
"0.7042201",
"0.7040598",
"0.69572574",
"0.69073594",
"0.6891974",
"0.... | 0.68208176 | 23 |
Set the current value. | def setValue(self, value):
super().setValue(int(value * self._precision)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_value (self):\n raise NotImplementedError",
"def setCurrent(self, value):\n\n\t\tself._current = self._setpoint - value",
"def value(self, value):\n\n\t\tself.__value = value",
"def change_value(self,val):\n self.val = val",
"def set_value(self,x):\n self._value = x",
"de... | [
"0.81568444",
"0.8114963",
"0.80853546",
"0.8072348",
"0.8061439",
"0.8061439",
"0.7939145",
"0.7939145",
"0.7939145",
"0.7929117",
"0.7897316",
"0.7878255",
"0.7878255",
"0.7878255",
"0.7878255",
"0.7878255",
"0.7878255",
"0.7859156",
"0.77963006",
"0.7779137",
"0.7759601",
... | 0.0 | -1 |
Takes an integer, n. Returns another note n half steps above or below (if n is negative) the current note. Doesn't modify in place. | def half_step(self, n):
return Note(ALL_NOTES[ALL_NOTES.index(self.name) + n],
self.string, self.guitar, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def band(n, steps):\n return math.floor(n * steps) / steps",
"def hollow(t, n):\n lt(t)\n skip(t, n)\n rt(t)",
"def zero_crossing_after(self, n):\n n_in_samples = int(n * self.samplerate)\n search_end = n_in_samples + self.samplerate\n if search_end > self.duration:\n ... | [
"0.6083122",
"0.60713494",
"0.5902596",
"0.58930653",
"0.58917224",
"0.58860815",
"0.5865177",
"0.58369845",
"0.58003354",
"0.5797726",
"0.5748247",
"0.57364064",
"0.57016605",
"0.56733173",
"0.56664217",
"0.5649698",
"0.5609922",
"0.5598912",
"0.55972207",
"0.5596575",
"0.55... | 0.74231535 | 0 |
Return repr for the module. The method is deprecated. The import machinery does the job itself. | def module_repr(module): # reliably restored by inspect
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_repr(*args,**kw):\n pass",
"def __repr__(self) -> str:\n return f\"<Module[{self.path}]>\"",
"def __repr__(self):\n location = attr(self, '__spec__.origin',\n '__file__',\n '__package__')\n name = attr(self, '__nam... | [
"0.7779252",
"0.7502372",
"0.73999244",
"0.68969315",
"0.67722857",
"0.65842247",
"0.6581517",
"0.6531543",
"0.652574",
"0.6469559",
"0.63845503",
"0.634502",
"0.63084537",
"0.6306228",
"0.62950504",
"0.62477756",
"0.6235535",
"0.61757797",
"0.6148386",
"0.6124769",
"0.602555... | 0.81104344 | 1 |
Create an instance of an eduid actions app. Note that we use EduIDBaseApp as the class for the Flask app, since the actions app is used unauthenticated. | def actions_init_app(name: str, config: dict) -> ActionsApp:
app = ActionsApp(name, config)
app.logger.info(f'Init {name} app...')
return app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n app = create_app()\n return app",
"def app():\n return create_app()",
"def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n ... | [
"0.69662046",
"0.68466157",
"0.66533786",
"0.6487776",
"0.64575016",
"0.64253587",
"0.6420107",
"0.6412767",
"0.6400847",
"0.6399896",
"0.63797295",
"0.6342284",
"0.6338992",
"0.63266504",
"0.6240923",
"0.6237907",
"0.6226871",
"0.62232953",
"0.6200927",
"0.6189253",
"0.61833... | 0.68776673 | 1 |
Turn off LEDs and outputs when exiting | def __exit__(self):
self._stop_all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terminate():\n leds.on()\n time.sleep(1)\n leds.off()\n\n GPIO.cleanup()",
"def turn_off(self):\n print(\"Turning the lights off\")\n self.led.all_off()\n self.client.publish(STATE_TOPIC, OFF) #publish",
"def emitters_off(self):\n self.wp.digitalWrite(self.LEDON_PIN,... | [
"0.77255505",
"0.77159023",
"0.75750864",
"0.75483537",
"0.7536057",
"0.7473403",
"0.73853135",
"0.73784566",
"0.72791034",
"0.72229457",
"0.72085327",
"0.71990645",
"0.7043129",
"0.7034531",
"0.70190907",
"0.70035017",
"0.69853485",
"0.695546",
"0.69553006",
"0.6938466",
"0.... | 0.0 | -1 |
Renders the home page. | def home(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/index.html',
context_instance = RequestContext(request,
{
'title':'Home Page',
'year':datetime.now().year,
})
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.7541308 | 93 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
context_instance = RequestContext(request,
{
'title':'About',
'message':'Your application description page.',
'year':datetime.now().year,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85647076",
"0.8502948",
"0.8448504",
"0.840492",
"0.83937883",
"0.8293176",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82675153",
"... | 0.77379674 | 59 |
Returns the backend secret key, if one is not set, raises an exception. | def get_key():
try:
return settings.get('backend')['secret_key']
except AttributeError:
raise AuthTokenGenerationException() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_secret_key():\n return get_config_handler().get_secret_key()",
"def secret_key(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"secret_key\")",
"def resolve_secretkey(self):\n # check the instance variable\n secretkey = self.secretkey\n if secretkey is no... | [
"0.740991",
"0.72881347",
"0.7180862",
"0.7080635",
"0.69605947",
"0.68877786",
"0.6857803",
"0.6857803",
"0.67391616",
"0.6735519",
"0.6697383",
"0.6656861",
"0.6639082",
"0.6599269",
"0.65581244",
"0.6543948",
"0.6477433",
"0.64675254",
"0.6464149",
"0.6453989",
"0.64080083... | 0.82533854 | 0 |
Get the variable objects of the entire model. Coupled variables only appear one Returns | def get_variables(self):
self._enforce_coupling()
dv = []
for scenario in self.scenarios:
if scenario.group_master:
dv.extend(scenario.active_variables())
else:
dv.extend(scenario.uncoupled_variables())
for body in self.bodies:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vars(self):\n return [Var(i,self.dims[i]) for i in range(self.nvar)] # TODO: use stored state info (=1 sometimes)",
"def variables(model: Model) -> AbstractSet[str]:\n assert is_model(model)\n return model.keys()",
"def variables(model: Model) -> AbstractSet[str]:\r\n assert is_model(model)\r\... | [
"0.69809604",
"0.67586887",
"0.6725519",
"0.6493153",
"0.64928144",
"0.6486224",
"0.6468553",
"0.64267725",
"0.6426089",
"0.64059377",
"0.6399455",
"0.63930416",
"0.6377041",
"0.6375854",
"0.6367982",
"0.6366723",
"0.636509",
"0.6352685",
"0.6345068",
"0.632137",
"0.6320647",... | 0.62799186 | 27 |
[driver call] Sum the coupled variable derivatives in each group. | def enforce_coupling_derivatives(self):
for body in self.bodies:
if body.group_master:
# Sum and store in the group master
for body2 in self.bodies:
if body.group == body2.group and not body2.group_master:
body.add_coupled_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def additional_derivatives(self, increment_filter, k):\n ######################################################################\n # derivatives for specified energy-group paremeters\n if self.energy_group.is_set:\n f = self.energy_func\n self.jacobian[k, 0, 0] = (\n ... | [
"0.6496992",
"0.6496992",
"0.6372585",
"0.61464995",
"0.61373943",
"0.6133822",
"0.60601354",
"0.6014248",
"0.5947428",
"0.58376366",
"0.5711516",
"0.5655745",
"0.56268305",
"0.56252724",
"0.56044024",
"0.55773115",
"0.5555578",
"0.5519436",
"0.5508947",
"0.55020934",
"0.5497... | 0.614615 | 4 |
The function that counts amount of stairs that can be build from n cubes. >>> amount_of_stairs(7) 5 >>> amount_of_stairs(9) 8 | def amount_of_stairs(n):
matrix = [[0] * n for i in range(n)]
for i in range(0, n):
for j in range(1, i):
matrix[i][j] = sum(matrix[i - j - 1][:j])
matrix[i][i] = 1
# print_matrix(matrix)
return sum(matrix[n-1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def climbing_stairs(n):\n\tif n < 2:\n\t\treturn 1\n\tif n == 2:\n\t\treturn 2\n\treturn climbing_stairs(n-1) + climbing_stairs(n-2)",
"def get_number_of_cheeses(self):\n number = 0\n for i in range(len(self._stools)):\n number += len(self._stools[i])\n return number",
"def coun... | [
"0.6498105",
"0.6472958",
"0.632501",
"0.62172204",
"0.6009327",
"0.5802506",
"0.5796389",
"0.5773984",
"0.5763846",
"0.5738816",
"0.5697463",
"0.5604147",
"0.55285203",
"0.5522436",
"0.5449694",
"0.54457366",
"0.5438354",
"0.54047304",
"0.53974926",
"0.5385177",
"0.53755003"... | 0.72338855 | 0 |
Checks if a file is an allowed extension. | def has_file_allowed_extension(
filename: Union[Path, str],
extensions: tuple[str, ...]) -> bool:
return filename.lower().endswith(extensions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_allowed_extension(filename):\n return '.' in filename and filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS",
"def allowed_file(filename, allowed_extension):\n return '.' in filename and get_file_ext(filename) in allowed_extension",
"def is_allowed_file(filename, allowed_ext):\n ext = filename.... | [
"0.895309",
"0.8786745",
"0.8764468",
"0.87614024",
"0.8612598",
"0.8612598",
"0.8612598",
"0.8612598",
"0.8612598",
"0.8612598",
"0.85909545",
"0.85909545",
"0.85555506",
"0.8541878",
"0.8525629",
"0.8525629",
"0.85190576",
"0.85190576",
"0.85155004",
"0.8498841",
"0.8496414... | 0.8492449 | 30 |
An instance of the PacketOutTriggerActions class. | def PacketOutTriggerActions(self):
from ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.packetouttriggeractions_gfja2v0t3v0vhjpz2dlckfjdglvbnm import PacketOutTriggerActions
return PacketOutTriggerActions(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateTriggerOuts(self):\n return self._server.update_trigger_outs(self._serial)",
"def actions(self):\r\n return Actions(self)",
"def actions(self):\r\n return actions.Actions(self)",
"def actions(self) -> Sequence[_A_out]:\n return self._actions",
"def actions(self):\n ... | [
"0.5967217",
"0.59590346",
"0.5897474",
"0.57588875",
"0.562812",
"0.562463",
"0.562463",
"0.562463",
"0.5525335",
"0.54589486",
"0.536653",
"0.53536224",
"0.53213054",
"0.5303016",
"0.5270425",
"0.5269684",
"0.5268832",
"0.52646893",
"0.52313286",
"0.5230719",
"0.5230719",
... | 0.8502182 | 0 |
An instance of the TableFeaturesLearnedInformation class. | def TableFeaturesLearnedInformation(self):
from ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.tablefeatureslearnedinformation_dxjlc0xlyxjuzwrjbmzvcm1hdglvbg import TableFeaturesLearnedInformation
return TableFeaturesLearnedInformation(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TableStatLearnedInformation(self):\n\t\tfrom ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.tablestatlearnedinformation_vtdgf0tgvhcm5lzeluzm9ybwf0aw9u import TableStatLearnedInformation\n\t\treturn TableStatLearnedInformation(self)",
"def PortFeaturesLearnedInformation(self):\n\t\tfrom ixne... | [
"0.75207824",
"0.6805895",
"0.6543652",
"0.65086424",
"0.62825716",
"0.62164634",
"0.61660147",
"0.6141782",
"0.6028704",
"0.6028704",
"0.602079",
"0.5967823",
"0.59301996",
"0.587462",
"0.58664143",
"0.58467",
"0.580116",
"0.57805187",
"0.57760876",
"0.57445854",
"0.5703335"... | 0.85443795 | 0 |
Signifies the Transport source address. | def FlowAggregatedStatTransportSource(self):
return self._get_attribute('flowAggregatedStatTransportSource') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_source_address(self, srcAddr):\n self.source.address = srcAddr",
"def add_source_address(self, srcAddr):\n self.source.address = srcAddr",
"def stellar_address(self) -> str:\n return kin_utils.encode_check('account', bytes(self._verify_key)).decode()",
"def sign_transaction(self,... | [
"0.56791204",
"0.56791204",
"0.5506528",
"0.54140216",
"0.5379268",
"0.5301819",
"0.52535075",
"0.523186",
"0.52251893",
"0.5118141",
"0.5118141",
"0.5078447",
"0.50657755",
"0.50494176",
"0.50494176",
"0.50494176",
"0.50494176",
"0.50494176",
"0.5025921",
"0.50249124",
"0.49... | 0.0 | -1 |
Specifies the IP DSCP value for advertising. | def FlowStatIpDscp(self):
return self._get_attribute('flowStatIpDscp') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dscp(self, dscp):\n\n self._dscp = dscp",
"def ip_dscp(self) -> int:\n return pulumi.get(self, \"ip_dscp\")",
"def setIpValue(self, ip_id, value): \n v = value\n # Eliminating basic outliers\n if ip_id not in self.dGrph:\n print(ip_id, ' does not exist in graph... | [
"0.6484483",
"0.55637646",
"0.54944223",
"0.5494273",
"0.5494273",
"0.5494273",
"0.5490381",
"0.5490381",
"0.5490381",
"0.542548",
"0.5362474",
"0.5318872",
"0.5172366",
"0.51169336",
"0.5097106",
"0.5058167",
"0.50461566",
"0.50451946",
"0.5036664",
"0.50323707",
"0.5025071"... | 0.4716991 | 61 |
Specifies the Transport source address. | def FlowStatTransportSource(self):
return self._get_attribute('flowStatTransportSource') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setAddressSource(self, address_source):\n # type: (str)->None\n\n self._validator.validate_one(\n 'source', VALID_OPTS['source'], address_source)\n self._ifAttributes['source'] = address_source",
"def add_source_address(self, srcAddr):\n self.source.address = srcAddr",
... | [
"0.7036338",
"0.6684712",
"0.6684712",
"0.6259917",
"0.6154926",
"0.6128129",
"0.6092474",
"0.59848195",
"0.5900155",
"0.5845694",
"0.58325934",
"0.5823885",
"0.5784185",
"0.5784185",
"0.5784185",
"0.5784185",
"0.5784185",
"0.5784185",
"0.5784185",
"0.5760593",
"0.57578874",
... | 0.0 | -1 |
Specifies the input mode for the Port number. | def PortNumberInputMode(self):
return self._get_attribute('portNumberInputMode') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_input_channel_mode(\n self, mode: InputChannelModeStr | core.QProcess.InputChannelMode\n ):\n self.setInputChannelMode(INPUT_CHANNEL_MODES.get_enum_value(mode))",
"def QueueStatPortNumberInputMode(self):\n\t\treturn self._get_attribute('queueStatPortNumberInputMode')",
"def setInput(se... | [
"0.6767038",
"0.65875036",
"0.6459351",
"0.64409643",
"0.6419133",
"0.6304073",
"0.6254771",
"0.6254771",
"0.6237",
"0.6171674",
"0.6125615",
"0.61145383",
"0.6076672",
"0.60720176",
"0.6016952",
"0.6016952",
"0.6016952",
"0.5944292",
"0.59397984",
"0.593963",
"0.59181464",
... | 0.76803464 | 0 |
The bitmap of OFPTC_ values. | def TableFeatureConfig(self):
return self._get_attribute('tableFeatureConfig') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmap(self):\n return self.pixels.get_cmap()",
"def get_bitmap(isnull):\n import numpy as np\n bitlst = []\n for i in range(1+len(isnull)//8):\n bits = ''.join('10'[bool(b)] for b in isnull[i*8:i*8+8])\n if len(bits) < 8:\n bits = bits + '0'*(8 - len(bits))\n bi... | [
"0.5810645",
"0.5700761",
"0.5665459",
"0.5641819",
"0.55706537",
"0.5497071",
"0.54657763",
"0.5414189",
"0.5404686",
"0.53943187",
"0.5382167",
"0.5365137",
"0.5351365",
"0.53372",
"0.5324567",
"0.5279016",
"0.51924556",
"0.51690865",
"0.51597816",
"0.5159392",
"0.5137598",... | 0.0 | -1 |
Indicates the ID of the vendor for which vendor message is triggered. | def TriggeredVendorMessageId(self):
return self._get_attribute('triggeredVendorMessageId') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendorid(self):\n return self._vendorid",
"def vendor_id(self):\n return self._vendor_id",
"def vendor_id(self):\n return self._device.vendor_id",
"def VendorId(self):\n\t\treturn self._get_attribute('vendorId')",
"def TriggeredVendorMessage(self):\n\t\treturn self._get_attribute('... | [
"0.8108222",
"0.80373335",
"0.7979808",
"0.7954791",
"0.74161243",
"0.72979033",
"0.7136423",
"0.6996187",
"0.69281113",
"0.69009787",
"0.68895435",
"0.6778201",
"0.66585284",
"0.6569222",
"0.6536528",
"0.62903434",
"0.62766194",
"0.6190926",
"0.6179042",
"0.6074065",
"0.6059... | 0.78079027 | 4 |
Specifies the unique Vendor identifier. | def VendorId(self):
return self._get_attribute('vendorId') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendor_id(self):\n return self._device.vendor_id",
"def vendor(self) -> str:\n return self.properties[DBUS_ATTR_VENDOR]",
"def vendorid(self, vendorid):\n\n self._vendorid = vendorid",
"def vendorid(self):\n return self._vendorid",
"def set_vendor_name(self, vendor_name_pref... | [
"0.7277175",
"0.726339",
"0.7190837",
"0.70811135",
"0.705163",
"0.70468676",
"0.7020424",
"0.69051844",
"0.66860443",
"0.6472521",
"0.64280957",
"0.6265304",
"0.6225899",
"0.6184756",
"0.60359037",
"0.6003881",
"0.59282756",
"0.5881754",
"0.57423985",
"0.5707649",
"0.5702248... | 0.7163851 | 3 |
Make an iterator with only the distinct elements of the previous. | def distinct(iterable):
def distincting(iterable_):
set_of_distinct_values = set()
for i in iterable_:
if i not in set_of_distinct_values:
set_of_distinct_values.add(i)
yield i
return distincting(iterable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UniqueIterator(iterator):\r\n so_far = set()\r\n def no_dups(x):\r\n if x in so_far:\r\n return False\r\n else:\r\n so_far.add(x)\r\n return True\r\n\r\n return IteratorFilter(iterator, no_dups)",
"def distinct(self):\n memory = set()\n\n ... | [
"0.712984",
"0.69498545",
"0.63750994",
"0.63386154",
"0.609624",
"0.6035334",
"0.60226166",
"0.5995098",
"0.5937099",
"0.5929672",
"0.58956736",
"0.5890808",
"0.5849846",
"0.5841922",
"0.5789085",
"0.5738298",
"0.57317764",
"0.5730549",
"0.57058895",
"0.5696055",
"0.56783247... | 0.6323311 | 4 |
Make and iterator of the original iterator without the first n elements | def drop(iterable, n):
counter = 0
for element in iterable:
if counter < n:
counter += 1
else:
yield element | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop(iterable, n, islice=islice):\n return islice(iterable, n, None)",
"def skip(self, n):\n return self.__class__(itertools.islice(self, n, None))",
"def iterate(iterator, n):\n # throw away n-1 elements\n for index in range(1, n):\n next(iterator, None)\n\n return next(iterator,... | [
"0.7343581",
"0.70723677",
"0.70262074",
"0.6894939",
"0.6836157",
"0.68224984",
"0.68224984",
"0.6781769",
"0.6781769",
"0.675287",
"0.6728892",
"0.67214763",
"0.6655382",
"0.66458553",
"0.66308755",
"0.66095483",
"0.6544969",
"0.6499964",
"0.64923674",
"0.64555466",
"0.6405... | 0.7611087 | 0 |
Produce the first element in the iterable that satisfies the predicate | def find(iterable, predicate, n=1):
counter = 0
for element in iterable:
if predicate(element) and counter < n:
yield element | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(iterable: Iterable[T1], predicate: Callable[[T1], bool]) -> Union[T1, None]:\n for x in iterable:\n if predicate(x):\n return x\n return None",
"def first(l: iter, predicate):\n for ele in l:\n if predicate(ele):\n return ele\n raise RuntimeError(\"Found ... | [
"0.875641",
"0.8685349",
"0.8514689",
"0.82310855",
"0.8127862",
"0.7429055",
"0.72127527",
"0.72125894",
"0.7203109",
"0.7168477",
"0.6947826",
"0.6886322",
"0.67830545",
"0.67830545",
"0.6729166",
"0.66754663",
"0.6649191",
"0.6636001",
"0.6579417",
"0.6546993",
"0.6522551"... | 0.64534044 | 25 |
Make an iterator of elements partitioned by the n | def grouped(iterable, n):
batch_window = [None for _ in range(n)]
cur_size = 0
for item in iterable:
batch_window[cur_size] = item
cur_size += 1
if cur_size >= n:
batched = batch_window[:]
batch_window = [None for _ in range(n)]
cur_size = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grouper(iterable, n):\n for i in range(0, len(iterable), n):\n yield iterable[i:i+n]",
"def split_by_n( seq, n ):\n while seq:\n yield seq[:n]\n seq = seq[n:]",
"def partitions(n):\n for a in range(2,n//2+1):\n yield a, n-a",
"def split_by_n(seq, n):\n while se... | [
"0.7678563",
"0.76778716",
"0.7611001",
"0.7536878",
"0.7513408",
"0.7480646",
"0.74746865",
"0.7473927",
"0.7455825",
"0.7433185",
"0.74208385",
"0.7334393",
"0.7330477",
"0.72577804",
"0.7255069",
"0.7251888",
"0.7245996",
"0.7244626",
"0.7226198",
"0.7209792",
"0.7200454",... | 0.0 | -1 |
Tests whether an iterable is know to have a finite size | def has_definite_size(iterable):
return hasattr(iterable, '__len__') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(things: Union[Sized, Iterable[Any]]) -> bool:\n\n length_func = getattr(things, '__len__', None)\n if length_func is not None and callable(length_func):\n return int(length_func()) == 0\n else:\n it = iter(cast(Iterable, things))\n try:\n next(it)\n exce... | [
"0.7063603",
"0.7026751",
"0.6805391",
"0.6724496",
"0.6649148",
"0.66034913",
"0.64612824",
"0.64559686",
"0.64088696",
"0.63896203",
"0.6338412",
"0.6316985",
"0.63134444",
"0.62955576",
"0.62948525",
"0.62808776",
"0.62752277",
"0.6262199",
"0.62331426",
"0.6190826",
"0.61... | 0.8755772 | 0 |
Make an iterator that contains the first n elements from the original | def take(iterable, n):
def taking(iterable_):
for i, e in enumerate(iterable_):
if i < n:
yield e
return taking(iterable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take(iterable, n):\n return list(itertools.islice(iterable, n))",
"def take(n, iterable):\n return list(itertools.islice(iterable, n))",
"def take(n, iterable):\n return list(itertools.islice(iterable, n))",
"def take(n, iterable):\n return list(islice(iterable, n))",
"def take(n, iterable)... | [
"0.7705128",
"0.76642597",
"0.76642597",
"0.76344866",
"0.76344866",
"0.7370344",
"0.73366565",
"0.7243548",
"0.72425574",
"0.72387034",
"0.7236423",
"0.7179746",
"0.7123456",
"0.7116049",
"0.70677453",
"0.7064955",
"0.703641",
"0.6956968",
"0.6947608",
"0.6941125",
"0.689593... | 0.735849 | 6 |
Make an iterator that returns the merged values for each key using an associative reduce function.The values contained in this iterable must be 2tuples in the form (k, v). | def reduceby(iterable, reducer, key=getitem(0), value=getitem(1)):
def reducing(iterable_, reducer_, key_, value_):
group_by = dict()
for element in iterable_:
(k, v) = (key_(element), value_(element))
if k in group_by:
group_by[k] = reducer_(group_by[k], v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduceWith(aggregation_fn, key, values ):\n yield (key, aggregation_fn(values))",
"def reducer(self, key, values):\n yield key, suma_parejas(values)",
"def itermerged(self):\n for key in self:\n val = _dict_getitem(self, key)\n yield val[0], b', '.join(val[1:])",
"d... | [
"0.67802644",
"0.6679581",
"0.62577575",
"0.6204293",
"0.61985016",
"0.6137127",
"0.6135621",
"0.61050326",
"0.6038061",
"0.6030691",
"0.59990436",
"0.5938379",
"0.59082264",
"0.59082264",
"0.5900001",
"0.58542186",
"0.58452874",
"0.58110094",
"0.57847077",
"0.576603",
"0.574... | 0.64439225 | 2 |
Make an iterator that returns elements from the first iterable until it is exhausted, then proceeds to the next iterable, until all of the iterables are exhausted. Used for treating consecutive sequences as a single sequence. | def union(iterable, *iterables):
return iter(it.chain(iterable, *iterables)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cycle(iterator: Iterable[Any]) -> Iterable[Any]:\n while True:\n yield from iterator",
"def iter_sequence_infinite(seq):\n while True:\n for item in seq:\n yield item",
"def simple_seq(seq):\n for i in seq:\n yield i",
"def get_consistent_generator(iterable):\n try:\n ... | [
"0.7216539",
"0.6916156",
"0.68749154",
"0.6867774",
"0.6813539",
"0.6706356",
"0.6577647",
"0.6492222",
"0.6448965",
"0.6371426",
"0.6310235",
"0.62763745",
"0.62645686",
"0.62645686",
"0.62645686",
"0.6256274",
"0.6251094",
"0.625052",
"0.62380314",
"0.61965287",
"0.6189783... | 0.59028757 | 54 |
Creates and saves a User with the given username, email and password. | def _create_user(self, username, email, password,
is_staff, is_superuser, **extra_fields):
now = timezone.now()
if not username:
raise ValueError('The given username must be set')
if not email:
raise ValueError('The given email must must be set')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password,username, **extra_fields):\r\n if not email:\r\n raise ValueError('The given email must be set')\r\n if not username:\r\n raise ValueError('The given username must be set')\r\n email = self.normalize_email(email)\r\n user = se... | [
"0.8602561",
"0.8470825",
"0.8463268",
"0.84178436",
"0.8414166",
"0.8392658",
"0.8346436",
"0.83459455",
"0.83149815",
"0.83070403",
"0.82893085",
"0.82771355",
"0.8271227",
"0.82580346",
"0.82134545",
"0.81979746",
"0.8176045",
"0.81720084",
"0.81641585",
"0.8163804",
"0.81... | 0.78602916 | 66 |
Checks if the files and directories needed for the project exist. | def verify_paths(paths=DEFAULT_PATHS):
if isinstance(paths, dict):
paths = list(paths.values())
for path in paths:
if os.path.exists(path):
continue
if os.path.isdir(path):
os.mkdir(path)
continue
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_build_exists(self):\n path = self.base_dir + \"/\" + self.app_name + \"/\" + \"build\"\n from django_swagger_utils.core.utils.check_path_exists import check_path_exists\n build_dir = check_path_exists(path)\n if build_dir:\n raise Exception(\"Build Directory Already... | [
"0.72309875",
"0.71987915",
"0.7094458",
"0.69025993",
"0.6883536",
"0.6856779",
"0.6856779",
"0.6856779",
"0.6856779",
"0.6856779",
"0.6856779",
"0.6856779",
"0.6836048",
"0.67974985",
"0.67629766",
"0.67591685",
"0.6753242",
"0.6740381",
"0.673777",
"0.67337126",
"0.6713437... | 0.0 | -1 |
Return this network in Cytoscape.js format. | def to_json(self):
return requests.get(self.__url).json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return str(self.nodes)",
"def to_networkx(self):\n return nx_util.to_networkx(requests.get(self.__url).json())",
"def __str__(self):\n\n return \"Network: {0}\".format(self.topology)",
"def to_json(self) -> str:\n return json.dumps(nx.node_link_data(self.grap... | [
"0.7028872",
"0.68952924",
"0.6844989",
"0.68420476",
"0.6764548",
"0.66565263",
"0.66548514",
"0.6609477",
"0.6527535",
"0.6478864",
"0.6472735",
"0.6466728",
"0.6455989",
"0.6455989",
"0.64259905",
"0.64259905",
"0.64259905",
"0.6394526",
"0.63000244",
"0.6268964",
"0.62522... | 0.0 | -1 |
Get edge table column information as DataFrame | def get_edge_columns(self):
return self.__get_columns('edge') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targets_to_dataframe(conn):\n return connect_database.get_table_into_pandas('target_info',conn)",
"def graphcols(self):\n columns = []\n table = self.__parent_table\n for col in self.__column_list:\n columns.append(table.table_column(col).title())\n return columns",
... | [
"0.6327146",
"0.62038314",
"0.59673405",
"0.5939877",
"0.59303206",
"0.59048885",
"0.58863497",
"0.5860798",
"0.5856057",
"0.57721335",
"0.5762139",
"0.57534015",
"0.573",
"0.5645121",
"0.56198794",
"0.55803704",
"0.55692357",
"0.5559671",
"0.55586886",
"0.5544524",
"0.553624... | 0.7181354 | 0 |
Parse a text stream to TSV If the source is a string, it is converted to a lineiterable stream. If it is a file handle or other object, we assume that we can iterate over the lines in it. The result is a generator, and what it contains depends on whether the second argument is set and what it is set to. If the second a... | def un(source, wrapper=list, error_bad_lines=True):
if isinstance(source, six.string_types):
source = six.StringIO(source)
# Prepare source lines for reading
rows = parse_lines(source, error_bad_lines)
# Get columns
if is_namedtuple(wrapper):
columns = wrapper._fields
wrapp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_tsv_gen(rows, le='\\n'):\n\theader_string = None\n\t\n\tfor row in rows:\n\t\theaders = []\n\t\tfields = []\n\t\t\n\t\tfor header, value in row.items():\n\t\t\tif(header_string is None):\n\t\t\t\theaders.append(header)\n\t\t\t\n\t\t\tif(not isinstance(value, basestring)):\n\t\t\t\tvalue = str(value)\n... | [
"0.5944113",
"0.57947356",
"0.55084944",
"0.5427973",
"0.54033643",
"0.53251314",
"0.5262656",
"0.52109015",
"0.5161971",
"0.5116362",
"0.5105722",
"0.5048277",
"0.5020609",
"0.50056183",
"0.50056183",
"0.5003528",
"0.4985776",
"0.49713722",
"0.49690014",
"0.49604994",
"0.495... | 0.5119908 | 9 |
Generates Random UPPERCASE names for the satellite taken from | def name_generator(size=8, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name_generator():\n firsts = [\"Albrecht\", \"Lysa\", \"Yvette\", \"Jésus\", \"Amanitus\"]\n lasts = [\"Andersson\", \"Natt och Dag\", \"av Pommern\", \"Krusmynta\"]\n\n random.seed()\n first = firsts[random.randint(0, len(firsts)-1)]\n last = lasts[random.randint(0, len(lasts)-1)]\n\n name =... | [
"0.7327721",
"0.707392",
"0.6974958",
"0.68869686",
"0.67731446",
"0.6770719",
"0.6593898",
"0.6561983",
"0.65487593",
"0.6532856",
"0.6501004",
"0.6475828",
"0.6474855",
"0.6464203",
"0.64436793",
"0.64298314",
"0.64131874",
"0.63714904",
"0.6359181",
"0.63221407",
"0.631780... | 0.6477153 | 11 |
Set the name of the satellite | def set_name(name=False):
if not name:
name = name_generator()
return name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_satellite(self):\n if \"MYD\" in self.in_file:\n self.satellite = \"AQUA\"\n elif \"MOD\" in self.in_file:\n self.satellite = \"TERRA\"\n else:\n raise ValueError('Cant get the satellite name from file name.')",
"def set_name(self, name):\n sel... | [
"0.73487014",
"0.698678",
"0.68256956",
"0.67233664",
"0.67033076",
"0.66748214",
"0.66487384",
"0.65940905",
"0.6588379",
"0.6588379",
"0.6588379",
"0.6588379",
"0.6564524",
"0.65587306",
"0.65587306",
"0.65587306",
"0.65587306",
"0.65587306",
"0.65565455",
"0.6539961",
"0.6... | 0.0 | -1 |
Called after self._add_event_detect. Apply event callback for channels registered in the class instance. Each callback is unique to the GPIO channel. | def _add_event_callback(self):
for gpio_channel in self.registered_gpio:
self.gpio_add_event_callback(gpio_channel) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_event_detect(self):\n for gpio_channel in self.registered_gpio:\n self.gpio_add_event_detect(gpio_channel, bouncetime=300)",
"def register_callbacks(self):\n self.either_edge_cb = self.pi.callback(\n self.gpio,\n pigpio.EITHER_EDGE,\n self.either... | [
"0.67375094",
"0.64251214",
"0.62030655",
"0.61408705",
"0.59544384",
"0.5858522",
"0.58123916",
"0.57710665",
"0.5765734",
"0.5745426",
"0.57290393",
"0.56938887",
"0.5681292",
"0.56422",
"0.5623273",
"0.56046975",
"0.5547447",
"0.5528487",
"0.54450613",
"0.54438585",
"0.542... | 0.77328724 | 0 |
Verify that map view returns status 200 (ok) after get request to map url. | def test_map_view_status_code(self):
self.assertEqual(self.response .status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_view_success_code(self):\n response = self.client.get(self.get_url())\n self.assertEqual(response.status_code, 200)",
"def test_view_success_code(self):\n response = self.client.get(self.get_url())\n self.assertEqual(response.status_code, 200)",
"def test_view_success_code(... | [
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"0.7622898",
"... | 0.84819865 | 0 |
Verify that get_first_and_last_datetime_of_update_data method returns first and last objects datetime. | def test_update_datetime_if_data_exists(self, mock_installation_statistics_model_objects_aggregate):
mock_min_datetime_of_update_data = datetime(2017, 6, 1, 14, 56, 18)
mock_max_datetime_of_update_data = datetime(2017, 7, 2, 23, 12, 8)
mock_installation_statistics_model_objects_aggregate.return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_save_2_datetime(self):\n date = BaseModel()\n updat_at1 = date.updated_at\n updat_at2 = datetime.now()",
"def test_equal_inputs(self):\n from sosbeacon.utils import get_latest_datetime\n\n lhs = rhs = datetime(2012, 9, 20, 2, 59)\n\n result = get_latest_datetime... | [
"0.6844397",
"0.65602547",
"0.65533274",
"0.64703345",
"0.6449467",
"0.6254372",
"0.6254372",
"0.6254372",
"0.62263596",
"0.6198185",
"0.6051665",
"0.60414016",
"0.6024587",
"0.60034823",
"0.59716654",
"0.59531987",
"0.5919156",
"0.5915776",
"0.59010535",
"0.58577",
"0.583256... | 0.6655227 | 1 |
Verify that get_first_and_last_datetime_of_update_data method returns `datetime.now` if no objects. | def test_update_datetime_if_no_data(
self, mock_datetime, mock_installation_statistics_model_objects_aggregate
):
mock_first_datetime_of_update_data = mock_last_datetime_of_update_data = datetime(2017, 7, 2, 23, 12, 8)
mock_datetime.now.return_value = mock_first_datetime_of_update_data
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_save_2_datetime(self):\n date = BaseModel()\n updat_at1 = date.updated_at\n updat_at2 = datetime.now()",
"def test_update_datetime_if_data_exists(self, mock_installation_statistics_model_objects_aggregate):\n mock_min_datetime_of_update_data = datetime(2017, 6, 1, 14, 56, 18)... | [
"0.681882",
"0.66625893",
"0.65170926",
"0.6390524",
"0.6378512",
"0.6307116",
"0.6307116",
"0.6307116",
"0.6199195",
"0.6189714",
"0.6157081",
"0.61567795",
"0.61407083",
"0.6103742",
"0.6068989",
"0.6030908",
"0.5982087",
"0.59638274",
"0.5962616",
"0.5932534",
"0.5903678",... | 0.6892485 | 0 |
Verify that graphs view returns status 200 (ok) after get request to graphs url. | def test_graphs_view_status_code(self):
self.assertEqual(self.response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_view_success_code(self):\n response = self.client.get(self.get_url())\n self.assertEqual(response.status_code, 200)",
"def test_view_success_code(self):\n response = self.client.get(self.get_url())\n self.assertEqual(response.status_code, 200)",
"def test_view_success_code(... | [
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866",
"0.75006866"... | 0.8339215 | 0 |
Verify that graphs view uses correct htmltemplate after get request to graphs url. | def test_graphs_view_html(self):
self.assertTemplateUsed(self.response, 'charts/graphs.html') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_correct_template_is_used(self):\n login = self.client.login(username='test_user1', password='test_user1_test')\n response = self.client.get(reverse('search:all_charts'))\n\n self.assertEqual(response.context['user'].username, 'test_user1')\n self.assertEqual(response.status_cod... | [
"0.66038966",
"0.6581853",
"0.6515921",
"0.64633584",
"0.64621556",
"0.63226765",
"0.6307232",
"0.62546587",
"0.6245686",
"0.62181187",
"0.6206271",
"0.61565185",
"0.6127607",
"0.6086524",
"0.6086524",
"0.6042333",
"0.6007158",
"0.5948066",
"0.5947409",
"0.59262556",
"0.58723... | 0.811668 | 0 |
Given a board_state, return which positions are empty | def filter_occupied(board_state):
my_list = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
for i in range(0, 9):
if board_state[i] != " ":
my_list.remove(str(i+1))
return my_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_empty_space(self, state):\r\n for i in range(3):\r\n for j in range(3):\r\n if state[i][j] == 0:\r\n return (i, j)",
"def get_empty_cells(state):\n cells = []\n for row_index, row in enumerate(state.board):\n for col_index, cell in enumera... | [
"0.7847441",
"0.7761535",
"0.7732985",
"0.7570854",
"0.7416806",
"0.7392229",
"0.72894406",
"0.7058619",
"0.70533353",
"0.7004213",
"0.6910325",
"0.6903279",
"0.6900608",
"0.6872458",
"0.6862784",
"0.68594456",
"0.68568677",
"0.68026525",
"0.67946136",
"0.6787461",
"0.6746235... | 0.6479922 | 45 |
Sets the request_id of this TokenizeRequestSchema. | def request_id(self, request_id):
self._request_id = request_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRequestId(self, reqid) :\n self.request_id = reqid",
"def x_request_id(self, x_request_id):\n self._x_request_id = x_request_id",
"def token_requestor_id(self, token_requestor_id):\n if self.local_vars_configuration.client_side_validation and token_requestor_id is None: # noqa: E50... | [
"0.73498404",
"0.6620742",
"0.6048909",
"0.56540567",
"0.55922943",
"0.5573893",
"0.54666466",
"0.53656846",
"0.5259798",
"0.5194064",
"0.51352465",
"0.5127068",
"0.50855887",
"0.5034557",
"0.5018912",
"0.50164056",
"0.50096655",
"0.49917254",
"0.49917254",
"0.49917254",
"0.4... | 0.76198393 | 1 |
Sets the token_type of this TokenizeRequestSchema. | def token_type(self, token_type):
if self.local_vars_configuration.client_side_validation and token_type is None: # noqa: E501
raise ValueError("Invalid value for `token_type`, must not be `None`") # noqa: E501
self._token_type = token_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_type(self, token_type: str):\n if token_type is None:\n raise ValueError(\"Invalid value for `token_type`, must not be `None`\") # noqa: E501\n\n self._token_type = token_type",
"def token_type(self, token_type: str):\n if token_type is None:\n raise ValueErr... | [
"0.80330044",
"0.80330044",
"0.7013236",
"0.64766717",
"0.63912064",
"0.63912064",
"0.6076267",
"0.6076267",
"0.56238824",
"0.56220764",
"0.56220764",
"0.55687374",
"0.55546194",
"0.55546194",
"0.5423428",
"0.5369772",
"0.5310111",
"0.5285315",
"0.5270757",
"0.5264764",
"0.52... | 0.77934474 | 2 |
Sets the token_requestor_id of this TokenizeRequestSchema. | def token_requestor_id(self, token_requestor_id):
if self.local_vars_configuration.client_side_validation and token_requestor_id is None: # noqa: E501
raise ValueError("Invalid value for `token_requestor_id`, must not be `None`") # noqa: E501
self._token_requestor_id = token_requestor_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_id(self, request_id):\n\n self._request_id = request_id",
"def request_id(self, request_id):\n\n self._request_id = request_id",
"def request_id(self, request_id):\n\n self._request_id = request_id",
"def thread_originator_id(self, thread_originator_id):\n\n self._thre... | [
"0.5755886",
"0.5755886",
"0.5755886",
"0.5726782",
"0.5670085",
"0.5610082",
"0.55606",
"0.5514039",
"0.5169761",
"0.50821924",
"0.505953",
"0.50458366",
"0.5025752",
"0.49358973",
"0.48991376",
"0.4864697",
"0.4864149",
"0.48001945",
"0.4797444",
"0.47611874",
"0.4728667",
... | 0.8351506 | 0 |
Sets the funding_account_info of this TokenizeRequestSchema. | def funding_account_info(self, funding_account_info):
if self.local_vars_configuration.client_side_validation and funding_account_info is None: # noqa: E501
raise ValueError("Invalid value for `funding_account_info`, must not be `None`") # noqa: E501
self._funding_account_info = funding_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def funding_account_account_number(self, funding_account_account_number):\n\n self._funding_account_account_number = funding_account_account_number",
"def funding_account_account_name(self, funding_account_account_name):\n\n self._funding_account_account_name = funding_account_account_name",
"def... | [
"0.65112096",
"0.6323324",
"0.5809116",
"0.5666299",
"0.54330826",
"0.5425872",
"0.5405871",
"0.53462505",
"0.53286564",
"0.5328155",
"0.5300253",
"0.5275839",
"0.5261788",
"0.5261788",
"0.5261788",
"0.5261788",
"0.5182563",
"0.5182563",
"0.51349175",
"0.50428694",
"0.5026704... | 0.785599 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, TokenizeRequestSchema):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, TokenizeRequestSchema):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.84560555",
"0.83913696",
"0.8143685",
"0.81403786",
"0.8131871",
"0.8093231",
"0.80915105",
"0.80915105",
"0.80915105",
"0.8084564",
"0.8084564",
"0.8075547",
"0.8075547",
"0.8065006",
"0.80417657",
"0.80417657",
"0.80417657",
"0.80417657",
"0.80417657",
"0.80417657",
"0.8... | 0.0 | -1 |
Return OrderedSet with names of data variables that are compatible with data variable variable_name. If variable variable_name is a spatial data variable, compatible variables are those data variables that are not spatial or that are spatial and share the same spatial dimensions. If variable variable_name is not a spat... | def compatible_data_variable_names(self,
variable_name):
result = mds.ordered_set.OrderedSet()
data_variable_names = self.data_variable_names()
assert variable_name in data_variable_names, variable_name
if not self.is_spatial_variable(variable_name):
result = dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variables(self):\n # created variable from `get_variable`\n allname = [name for _, (name, t) in self._variable_info.iteritems()\n if t == 'variable']\n allvars = [v for v in K.get_all_variables() if v.name in allname]\n # related variables to all `Tensor`\n ... | [
"0.5893307",
"0.58347607",
"0.5765724",
"0.57477033",
"0.572593",
"0.5720542",
"0.5705743",
"0.5680977",
"0.55414075",
"0.5536672",
"0.55209094",
"0.55151117",
"0.5497452",
"0.5466993",
"0.53826064",
"0.5338747",
"0.5327425",
"0.52686435",
"0.52678",
"0.5201096",
"0.5174992",... | 0.87011254 | 0 |
Creates a card with the given rank and face down. | def __init__(self, rank, suit):
self.rank = rank
self.suit = suit
self.face = 'down'
self.fileName ='D:/CSC-131/DECK/'+str(rank)+str(suit)+'.gif' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def card_factory(rank,suit):\n pass",
"def __init__(self, rank):\n self.rank = rank\n self.face = 'down'",
"def __init__(self, rank=\"\", suit=\"\"):\n self.suit = suit\n self.rank = rank\n self.face_up = False",
"def create_deck():\r\n deck = []\r\n faces = [2,3,4... | [
"0.7095335",
"0.63684714",
"0.6309469",
"0.62574476",
"0.60994494",
"0.6016408",
"0.6013961",
"0.5972459",
"0.5773373",
"0.5771672",
"0.5769164",
"0.5754624",
"0.5690354",
"0.56862485",
"0.5660643",
"0.55733377",
"0.55711347",
"0.555589",
"0.5550198",
"0.5522343",
"0.5517482"... | 0.5205305 | 43 |
Returns the string representation of a deck. | def __str__(self):
result = ''
for c in self._cards:
result = result + str(c) + '\n'
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_deck(self):\n deck = Deck(self.get_cards())\n return deck.as_string()",
"def __str__(self):\n string = \"Deck contains \"\n\n for i in range(len(self.deck)):\n string += str(self.deck[i].get_suit()) + str(self.deck[i].get_rank()) + \" \"\n return string",
"... | [
"0.8333217",
"0.8268616",
"0.8213674",
"0.7972169",
"0.7950319",
"0.7931906",
"0.79195374",
"0.7855504",
"0.7601301",
"0.75710964",
"0.74562913",
"0.73240936",
"0.73237187",
"0.732187",
"0.72841036",
"0.72491306",
"0.7195142",
"0.7109588",
"0.7040223",
"0.6987197",
"0.6957928... | 0.7212482 | 16 |
Returns an array of xoffsets. Each value in the array is the x position of a pixel instance defined in the PixelGrid. | def get_x_offsets_from_pixel_grid(grid: PixelGrid) -> Union[np.ndarray, float]:
if grid.gap_every_columns > 0:
total_width = (
grid.columns * grid.col_width
+ ((grid.columns - 1) // grid.gap_every_columns) * grid.column_gap_width
)
else:
total_width = grid.columns... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_Xc_starts(self):\r\n start_list = [np.random.randint(low=0, high=self.total_windows-self.buffer_needed) for _ in range(self.total_points)]\r\n return np.array(start_list)",
"def OffsetX(*args, **kwargs):\n return _gdi_.NativePixelData_Accessor_OffsetX(*args, **kwargs)",
"def xstagg... | [
"0.6918548",
"0.654743",
"0.6515938",
"0.6497255",
"0.6425341",
"0.64216954",
"0.6294858",
"0.62887293",
"0.62520087",
"0.62445563",
"0.62286615",
"0.6189061",
"0.6153028",
"0.6131424",
"0.6128472",
"0.61228925",
"0.6082386",
"0.6079995",
"0.6055966",
"0.6048606",
"0.6048606"... | 0.78270084 | 0 |
Create the application, registers blueprints and extensions, and returns it. | def create_app(config='dev'):
config_object = {'dev': DevConfig, 'test': TestConfig}[config]
app = Flask(__name__)
app.config.from_object(config_object)
if app.config.get('PROFILE'):
from werkzeug.contrib.profiler import ProfilerMiddleware
app.wsgi_app = ProfilerMiddleware(app.wsgi_app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app():\n return create_app()",
"def app():\n app = create_app()\n return app",
"def create_app():\n app = Flask(__name__, instance_relative_config=False)\n app.config.from_object('config.Config')\n\n # Initialize Plugins\n bootstrap = Bootstrap(app) # noqa: F841\n\n with app.app_co... | [
"0.8189471",
"0.8152559",
"0.7991859",
"0.7977983",
"0.7760573",
"0.7690337",
"0.76827323",
"0.7681575",
"0.7656166",
"0.76512545",
"0.7632496",
"0.75735",
"0.7560233",
"0.7514638",
"0.7503362",
"0.7497067",
"0.74948543",
"0.74687636",
"0.7463896",
"0.7453019",
"0.74473095",
... | 0.7132426 | 48 |
Get Empty function config. | def get_block_config():
ret = {}
ret[keyword.function] = []
ret[keyword.inputs] = []
ret[keyword.expect] = []
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(self):\n return None",
"def config(self, function):\n self.cfgs.append(ConfigScope(function))\n return self.cfgs[-1]",
"def getConfigAll(self):\n return self.configAll(False)",
"def empty_env(self):\n return ()",
"def get_cfg_defaults():\n return _C.clone()",
... | [
"0.5951805",
"0.59515333",
"0.59462583",
"0.59119135",
"0.58918387",
"0.5867156",
"0.5847659",
"0.57957315",
"0.5753244",
"0.5742711",
"0.5727392",
"0.5712172",
"0.570951",
"0.56892467",
"0.5688181",
"0.5688181",
"0.56732297",
"0.5673223",
"0.56701404",
"0.56701404",
"0.56525... | 0.0 | -1 |
Get the GeoDataFrame CRS. | def crs(self):
return self.dataframe.crs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gdf(self) -> gpd.GeoDataFrame:\n return self.just_geometry_gdf.join(self.df)",
"def crs(self):\n return self._crs",
"def getCRS(shp):\r\n if not isinstance(shp, geopandas.geodataframe.GeoDataFrame):\r\n shp = geopandas.read_file(shp)\r\n return shp.crs['init'][5:]",
"def _get_r... | [
"0.6566438",
"0.6419426",
"0.6336395",
"0.63172936",
"0.6312406",
"0.6305759",
"0.61883086",
"0.61677456",
"0.5923359",
"0.5826093",
"0.5802992",
"0.5792684",
"0.57650685",
"0.5762439",
"0.5734245",
"0.5690498",
"0.568912",
"0.5651842",
"0.5639576",
"0.561977",
"0.55920565",
... | 0.7056332 | 0 |
Get the maximum quadrant length. | def qmax(self):
return self.qy_len if self.min_qside == 'x' else self.qx_len | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length(self):\n return float(np.max([self.width(),self.height()]))",
"def Qmax(self):\n return (4 * np.pi * np.sin(self.two_theta_max()*radians/2)\n / self.wavelength)",
"def _maxValueLength(self):\n returnvalue = 0\n for row in self._value:\n for item ... | [
"0.6771864",
"0.6669108",
"0.6642492",
"0.662019",
"0.65605235",
"0.6408936",
"0.64052385",
"0.6396603",
"0.63908577",
"0.63589996",
"0.63525677",
"0.63278747",
"0.6325065",
"0.62992054",
"0.6297609",
"0.6275307",
"0.62622637",
"0.6251574",
"0.62482846",
"0.6241698",
"0.62239... | 0.7324198 | 0 |
Splits a tree into quadrants. 1 | 3 | 0 | 2 | def split(self, thresh=0):
new_tree_bounds = []
new_tree_ids = []
self.contains_null = False
for qi, quad in enumerate(self.tree):
left, bottom, right, top = quad.bounds
xcenter = left + (right - left) / 2.0
ycenter = top - (top - bottom) / 2.0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(root, Dk, maxDepth, minRows, currDepth):\n \n left, right = root['branches']\n del(root['branches'])\n \n# if not left and not right:\n# return\n \n # Check if the node is a leaf\n if not len(left): \n root['left'] = root['right'] = getLeafClass(right)\n ... | [
"0.6583471",
"0.64418817",
"0.6355388",
"0.6193927",
"0.6182106",
"0.61574066",
"0.6064047",
"0.6007731",
"0.5979361",
"0.59219855",
"0.5844368",
"0.58430094",
"0.57728237",
"0.5758766",
"0.5697045",
"0.5685386",
"0.5668723",
"0.5633028",
"0.5617432",
"0.5613467",
"0.5601344"... | 0.59322256 | 9 |
Set the timezone for the guild | async def _timezone(self, ctx: commands.Context, tz: str = None):
self.check_if_exist(ctx.guild)
self.daily_guilds[str(ctx.guild.id)]["tz"] = tz
self.daily_info.update("guilds", self.daily_guilds)
await ctx.reply("New daily timezone is {0}".format(tz)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setNodeTimeZone(self,node,timezone):\n post_data = {'timezone': str(timezone)}\n data = self.connect('put',\"nodes/%s/time\" % (node), post_data)\n return data",
"def set_timezone(conn, timezone):\n with Tx(conn) as c:\n c.execute('SET timezone = %s', (timezone,))",
"def time... | [
"0.65474457",
"0.65401435",
"0.6457082",
"0.62095654",
"0.6106381",
"0.60420215",
"0.60392404",
"0.59839654",
"0.59594226",
"0.59594226",
"0.59327596",
"0.59327596",
"0.59327596",
"0.59327596",
"0.59327596",
"0.5905557",
"0.5778015",
"0.5736061",
"0.5726324",
"0.5638293",
"0.... | 0.7884588 | 0 |
Call 'func' on each item in 'iterable'. | def foreach(func, iterable):
for x in iterable:
func(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map(iterable, function):\n for x in iterable:\n yield function(x)",
"def intercept(iterable, function):\n\n def intercepting(iterable_):\n for item in iterable_:\n function(item)\n yield item\n\n return intercepting(iterable)",
"def map(function, iterable):\n\n ... | [
"0.7166672",
"0.71502095",
"0.6984798",
"0.6834976",
"0.65874875",
"0.65806806",
"0.65209717",
"0.6227549",
"0.6213204",
"0.61754006",
"0.6128727",
"0.6104333",
"0.60436624",
"0.6041439",
"0.6031788",
"0.6030694",
"0.5927013",
"0.5923421",
"0.5912032",
"0.59004873",
"0.589778... | 0.7998205 | 0 |
Simply returns the number of entries (left) in the given iterable. | def count(iterable):
return sum(1 for _ in iterable) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cnt(iterable):\n return len(iterable) if iterable is not None else 0",
"def count(iterable: Iterable) -> int:\n return sum(1 for x in iterable)",
"def count(iterable):\n return sum(1 for _ in iterable)",
"def size(iterable):\n try:\n return iterable.__len__()\n except AttributeError... | [
"0.7319926",
"0.71874005",
"0.7136388",
"0.7017185",
"0.6975545",
"0.64892286",
"0.6130235",
"0.6115067",
"0.6085461",
"0.59828246",
"0.5972138",
"0.59679675",
"0.5951258",
"0.5911455",
"0.58182657",
"0.5777934",
"0.5767184",
"0.5761598",
"0.5753736",
"0.5741467",
"0.57409734... | 0.74642205 | 0 |
Return the last item of an iterable or 'default' if there's none. | def last(iterable, *default):
assert len(default) <= 1
iterable = iter(iterable)
try:
x = next(iterable)
except StopIteration:
if default:
return default[0]
raise
for x in iterable:
pass
return x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last(iterator):\n item = None\n for item in iterator:\n pass\n return item",
"def last(iterable):\n it = iter(iterable)\n item = next(it)\n for item in it:\n pass\n return item",
"def last(iterable):\n d = deque(iterable, maxlen=1)\n try:\n return d.pop()\n ... | [
"0.75964594",
"0.7564683",
"0.75622606",
"0.7543977",
"0.7075122",
"0.67438215",
"0.66316557",
"0.6368011",
"0.6286694",
"0.6271557",
"0.6193984",
"0.6191005",
"0.61890703",
"0.61284655",
"0.6064187",
"0.60277647",
"0.59869605",
"0.5980858",
"0.595729",
"0.5913434",
"0.591174... | 0.8993513 | 0 |
Return a Pandas dataframe with the data for this table | def dataframe(self):
return self.get_target().dataframe() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_DataFrame (self):\n return DataFrame(self.table)",
"def get_df(self) -> pd.DataFrame:\n return pd.DataFrame(self.fetchall(), columns=self.headers())",
"def dataframe(self):\n if not self.all_records:\n print('No rows cached.')\n return\n dict_list = [row... | [
"0.8454383",
"0.8314705",
"0.8160777",
"0.79148126",
"0.78738374",
"0.7871999",
"0.7859952",
"0.784017",
"0.7792931",
"0.7779588",
"0.7775638",
"0.77650785",
"0.7675365",
"0.7675365",
"0.7675365",
"0.7675365",
"0.7675365",
"0.7666086",
"0.7647487",
"0.76207113",
"0.7606968",
... | 0.73193055 | 31 |
Returns the geographic extent of the project as geojson. | def get_geographic_extent(self, project):
if project.geographic_extent is not None:
return json.loads(project.geographic_extent.json)
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geoextent(self):\r\n return self.series_extent",
"def extent(self):\n rx0 = gxapi.float_ref()\n ry0 = gxapi.float_ref()\n rz0 = gxapi.float_ref()\n rx1 = gxapi.float_ref()\n ry1 = gxapi.float_ref()\n rz1 = gxapi.float_ref()\n self.gxvox.get_area(rx0, ry... | [
"0.6902008",
"0.6667629",
"0.6542314",
"0.651294",
"0.6448455",
"0.6448455",
"0.6448455",
"0.64271414",
"0.6373081",
"0.63291425",
"0.6254535",
"0.6215859",
"0.6171476",
"0.6167112",
"0.6167112",
"0.61101866",
"0.60702485",
"0.6042508",
"0.5979499",
"0.5972277",
"0.59689075",... | 0.8332281 | 0 |
Method for SerializerMethodField `num_observations`. Returns the overall number of observations contributed to the project. | def get_num_contributions(self, project):
return project.observations.exclude(
status='draft').exclude(status='pending').count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getObservationCount(self):\r\n return self._s_obs",
"def observation_count(self):\n if not self.can_update():\n self._handle_error(910, [self.type])\n return self.tc_requests.observation_count(\n self.api_type, self.api_branch, self.unique_id, owner=self.owner\n ... | [
"0.6473792",
"0.62188417",
"0.59300524",
"0.5904186",
"0.5695756",
"0.5684433",
"0.56251985",
"0.5623508",
"0.55709887",
"0.55505437",
"0.5517805",
"0.54952973",
"0.54730725",
"0.5469481",
"0.54521984",
"0.5423298",
"0.538021",
"0.53452367",
"0.53356785",
"0.53244096",
"0.531... | 0.6916351 | 0 |
Get an existing IoMAMPolicyByName resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'IoMAMPolicyByName':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = dict()
__props__["access_recheck_offline_timeout"] = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n etag: Optional[pulumi.Input[str]] = None,\n folder: Optional[pulumi.Input[str]] = None,\n policy_data: Optional[pulumi.Input[str]] = None) -> 'IAMPolicy':\n... | [
"0.6428517",
"0.5867557",
"0.57824975",
"0.5579071",
"0.5445415",
"0.5402389",
"0.5319058",
"0.5314378",
"0.5306884",
"0.5192482",
"0.50869536",
"0.5049483",
"0.5044871",
"0.5044871",
"0.49563617",
"0.49190697",
"0.48722032",
"0.4810996",
"0.4808218",
"0.48007855",
"0.4778619... | 0.75251055 | 0 |
Creates ComSpec object based on generic keyvalue settings from a dictionary. | def _createComSpecFromDict(self, ws, portInterface, comspec):
self._validate_com_spec_keys_against_port_interface(comspec, portInterface)
if isinstance(portInterface,autosar.portinterface.SenderReceiverInterface):
dataElementName = None
rawInitValue = None
initValue ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(dict):\n return SIO_SDC(**dict)",
"def from_internal_dict(cls, params):\n options = cls({}) # basic default options\n opt_dict = options.__dict__\n\n for key, val in opt_dict.items():\n options.__dict__[key] = params.get(key, val)\n\n return options",
... | [
"0.6055727",
"0.5826158",
"0.5595303",
"0.5569334",
"0.5539644",
"0.55225486",
"0.55225486",
"0.5458269",
"0.5419622",
"0.5414873",
"0.53930664",
"0.5370344",
"0.5366786",
"0.53523934",
"0.53351355",
"0.53228956",
"0.528916",
"0.52839875",
"0.52444184",
"0.52425486",
"0.52384... | 0.5295914 | 16 |
Return the name of the Task. | def name(self) -> str:
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_name(self) -> str:\n return self._task_name",
"def task_name(self):\n pass",
"def getTaskName(self):\n return self._taskName",
"def task(self) -> str:\n return self._task",
"def TaskDisplayName(cls, task):\n if not task: return None\n return '//' + cls.TaskRelativ... | [
"0.92163503",
"0.91201246",
"0.8945559",
"0.8117824",
"0.8086446",
"0.7937094",
"0.77616125",
"0.76558375",
"0.7628284",
"0.758033",
"0.7551472",
"0.7477411",
"0.73992556",
"0.7316304",
"0.7296364",
"0.7281387",
"0.7281387",
"0.7255314",
"0.7195708",
"0.71620613",
"0.70829296... | 0.0 | -1 |
Return the list of ActionTemplates that compose the Task. | def action_templates(self) -> List[ActionTemplate]:
return self._action_templates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_templates(self):\n from .task_template import TaskTemplate\n return [TaskTemplate.load(task_template_id) for task_template_id in self.task_template_ids]",
"def task_template_ids(self):\n return self._get('task_templates')",
"def get_actions(self):\n return []",
"def get_l... | [
"0.6737043",
"0.63033897",
"0.62612194",
"0.61882806",
"0.6166203",
"0.6124521",
"0.60509527",
"0.60289854",
"0.59311414",
"0.5930836",
"0.5891498",
"0.5889099",
"0.58194256",
"0.57941437",
"0.5780824",
"0.5780824",
"0.5778392",
"0.57731456",
"0.57659805",
"0.5749439",
"0.572... | 0.79610664 | 0 |
See docs of torch.nn.Conv3d | def transpose_to_pytorch(array: np.ndarray) -> np.ndarray:
shape = (
DIM_NN['batch'],
DIM_NN['channels'],
DIM_NN['depth'],
DIM_NN['height'],
DIM_NN['width'],
)
array = np.transpose(array, shape)
return array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1):\r\n return nn.Conv3d(in_planes, out_planes, kernel_size=3, stride=stride,\r\n padding=dilation, groups=groups, bias=False, dilation=dilation)",
"def BasicConv3d(in_planes, out_planes, kernel_size, stride=(1, 1, 1), padding... | [
"0.74626017",
"0.73825383",
"0.732641",
"0.72430784",
"0.7218245",
"0.72089267",
"0.71919787",
"0.7191581",
"0.7191581",
"0.7178833",
"0.71573454",
"0.71203244",
"0.71165806",
"0.7112739",
"0.7112739",
"0.7112739",
"0.7112739",
"0.7112739",
"0.7112739",
"0.7112739",
"0.709862... | 0.0 | -1 |
See docs of tf.nn.conv3d | def transpose_to_tensorflow(array: np.ndarray) -> np.ndarray:
shape = (
DIM_PT['batch'],
DIM_PT['depth'],
DIM_PT['height'],
DIM_PT['width'],
DIM_PT['channels'],
)
array = np.transpose(array, shape)
return array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conv3d(value, weights, padding=\"SYMMETRIC\"):\n return tf.nn.conv3d(value, weights, strides=[1, 1, 1, 1, 1], padding=\"SAME\")",
"def BasicConv3d(in_planes, out_planes, kernel_size, stride=(1, 1, 1), padding=(0, 0, 0),\n bias=False, dw_t_conv=False):\n return nn.Conv3d(in_planes, out_pl... | [
"0.76698303",
"0.755532",
"0.7442117",
"0.7331939",
"0.7301148",
"0.7301148",
"0.72941005",
"0.7293377",
"0.7293377",
"0.7293377",
"0.7293377",
"0.7293377",
"0.7293377",
"0.7293377",
"0.7282493",
"0.72780955",
"0.72749895",
"0.72712696",
"0.72595316",
"0.7247597",
"0.7237898"... | 0.0 | -1 |
Get the argmax in a list of results. Unlike regular numpy.argmax(), in case we have more then one maximum value it returns a random one | def find_best_result_arg_with_tie_breaker(results_list, max_or_min="max"):
if max_or_min != "max" and max_or_min != "min":
raise ValueError("max_or_min param must be either 'max' or 'min'")
best_value = results_list.max() if max_or_min == "max" else results_list.min()
# find all values close to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argmax(values):\n\tvalues = np.array(values)\n\tmx = np.max(values)\n\tval = np.where(values==mx)[0]\n\treturn np.random.choice(val)",
"def random_argmax(x: np.ndarray) -> int:\n indices = all_argmax(x)\n return np.random.choice(indices)",
"def custom_argmax(arr):\n return np.random.choice(np.flat... | [
"0.8335981",
"0.78323936",
"0.7790045",
"0.75007236",
"0.7341612",
"0.71394706",
"0.7128849",
"0.7097402",
"0.7097402",
"0.7097402",
"0.70241296",
"0.6949926",
"0.6916381",
"0.6916381",
"0.69122714",
"0.6858852",
"0.6855909",
"0.6834124",
"0.6832451",
"0.6831044",
"0.67736924... | 0.6555367 | 31 |
get DataFrame from csv file path. | def _load(self, config: Dict):
return pd.read_csv(config['path']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(path):\n df = pd.read_csv(path)\n\n return df",
"def read_csv(path):\n return pd.read_csv(path)",
"def read_from_csv(path):\n if not os.path.exists(path):\n return None\n if not path.endswith('.csv'):\n return None\n\n with open(path, 'r') as file:\n data = p... | [
"0.831804",
"0.8251531",
"0.8209664",
"0.8186841",
"0.81797963",
"0.81024796",
"0.8050509",
"0.80370086",
"0.78838986",
"0.78338367",
"0.78338367",
"0.77670795",
"0.7678553",
"0.76650953",
"0.76582754",
"0.76582754",
"0.76582754",
"0.76490504",
"0.7602862",
"0.7547502",
"0.74... | 0.7224887 | 34 |
Set the value of the APIKey input for this Choreo. ((required, string) The API Key provided by Freebase.) | def set_APIKey(self, value):
super(ImageInputSet, self)._set_input('APIKey', value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetAPIKey(self, api_key):\n self._api_key = api_key",
"def SetAPIKey(self, api_key):\n self._api_key = api_key",
"def SetAPIKey(self, api_key):\n self._analyzer.SetAPIKey(api_key)",
"def api_key(self, api_key):\n if api_key is None:\n raise ValueError(\"Invalid value for `api_k... | [
"0.8012527",
"0.8012527",
"0.78095466",
"0.7491508",
"0.7445488",
"0.7354048",
"0.71039265",
"0.69850457",
"0.68536586",
"0.68143976",
"0.68125784",
"0.6755509",
"0.6747393",
"0.66371185",
"0.6522695",
"0.6442849",
"0.6420981",
"0.632513",
"0.6323666",
"0.6307235",
"0.6235425... | 0.6429928 | 16 |
Retrieve the value for the "Response" output from this Choreo execution. ((string) The response from the Freebase Image API returns the thumbnail in base 64encoded format.) | def get_Response(self):
return self._output.get('Response', None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_thumbnail(self):\n try:\n app1_segment = self._segments['APP1']\n except KeyError:\n thumbnail_hex_string = None\n else:\n thumbnail_hex_string = app1_segment.thumbnail_hex_string\n\n if not thumbnail_hex_string:\n raise RuntimeError(\... | [
"0.6062687",
"0.60492873",
"0.5906654",
"0.563572",
"0.56325966",
"0.56128675",
"0.5591999",
"0.55828226",
"0.5496876",
"0.54930705",
"0.54826397",
"0.5467993",
"0.5461682",
"0.54597026",
"0.5407381",
"0.5395234",
"0.53920555",
"0.5359705",
"0.53267264",
"0.53168243",
"0.5313... | 0.62218374 | 5 |
Preprocess text and fits a LDA model. | def fit(self, texts):
print('Processing text and fitting LDA...')
texts = preprocess_text(texts)
stemmed_texts = [
list(set(self.tokenizer.stem(text))) for text in texts]
self.lda_dictionary = Dictionary(stemmed_texts)
lda_corpus = [
self.lda_dictionary.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocessing(text, tokenization=0, rm_stopwords=0, numbers_to_text=0, to_tfidf=0):\n\ttrain_data = pd.DataFrame(columns=['text', 'response'])\n\n\tprep_0 = [strip_non_alphanum(line) for line in text]\n\tprep_1 = [line for line in prep_0 if line.rstrip()]\n\tprep_2 = [strip_multiple_whitespaces(line) for line ... | [
"0.660912",
"0.6531881",
"0.6451974",
"0.643631",
"0.64359623",
"0.63797843",
"0.6361688",
"0.63324934",
"0.633029",
"0.6323765",
"0.63109434",
"0.6249419",
"0.6168914",
"0.61598635",
"0.6154446",
"0.61540663",
"0.6147701",
"0.61305416",
"0.60570306",
"0.6056732",
"0.60520154... | 0.75705445 | 0 |
Should return 201 for category added | def test_add_category_success(self):
category = json.dumps({
'name': 'Asian',
})
response = self.client.post('/category', data=category,
headers={"Authorization": self.token})
self.assertEqual(response.status_code, 201)
self.assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_category(self):\n self.add_success(self.test_data['pants'])",
"def test_create_category(self):\n res = self.client().post('/categories/', data=self.category)\n self.assertEqual(res.status_code, 201)\n self.assertIn('Stews', str(res.data))",
"def test_create_category(sel... | [
"0.74706477",
"0.745538",
"0.7299563",
"0.7270053",
"0.7212493",
"0.7097182",
"0.7087772",
"0.70748115",
"0.6928631",
"0.6922248",
"0.6901459",
"0.68503654",
"0.68328047",
"0.6827661",
"0.6805902",
"0.675383",
"0.6749674",
"0.6747731",
"0.6732778",
"0.6710432",
"0.6706673",
... | 0.7421862 | 2 |
Should return 201 for category added | def test_add_category_existing_name(self):
category = json.dumps({
'name': 'Asian',
})
self.client.post('/category', data=category,
headers={"Authorization": self.token})
response = self.client.post('/category', data=category,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_category(self):\n self.add_success(self.test_data['pants'])",
"def test_create_category(self):\n res = self.client().post('/categories/', data=self.category)\n self.assertEqual(res.status_code, 201)\n self.assertIn('Stews', str(res.data))",
"def test_add_category_succes... | [
"0.74706477",
"0.745538",
"0.7421862",
"0.7299563",
"0.7270053",
"0.7212493",
"0.7097182",
"0.70748115",
"0.6928631",
"0.6922248",
"0.6901459",
"0.68503654",
"0.68328047",
"0.6827661",
"0.6805902",
"0.675383",
"0.6749674",
"0.6747731",
"0.6732778",
"0.6710432",
"0.6706673",
... | 0.7087772 | 7 |
Should return 400 for empty name | def test_add_category_empty_name(self):
category = json.dumps({
'name': "",
})
response = self.client.post('/category', data=category,
headers={"Authorization": self.token})
self.assertEqual(response.status_code, 400)
self.assertIn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testMissingNameAttribute(self):\n data = {'bidule': 'toto'}\n response = requests.post(url=self.url, json=data)\n headers = response.headers\n\n self.assertEqual(response.status_code, 400, WRONG_STATUS_CODE_MSG)\n self.assertEqual(\n headers['Content-Type'], 'text/... | [
"0.77169096",
"0.73643553",
"0.73529947",
"0.71199685",
"0.6973055",
"0.69669956",
"0.69198424",
"0.69103205",
"0.6897051",
"0.687267",
"0.6848081",
"0.6819262",
"0.67757225",
"0.6765988",
"0.6760132",
"0.6706189",
"0.6694191",
"0.66769755",
"0.6655904",
"0.6640981",
"0.66170... | 0.66143423 | 21 |
Should return 401 for no categories found | def test_get_a_single_category_invalid_token(self):
self.test_add_category_success()
token = ""
response = self.client.get('/categories/1',
headers={"Authorization": token})
self.assertEqual(response.status_code, 401)
self.assertIn('Token not fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_category_invalid_token(self):\n self.test_add_category_success()\n token = \"\"\n response = self.client.get('/categories',\n headers={\"Authorization\": token})\n self.assertEqual(response.status_code, 401)\n self.assertIn('Token no... | [
"0.7906582",
"0.76371086",
"0.7406835",
"0.72049767",
"0.7046015",
"0.70299006",
"0.7026891",
"0.70023763",
"0.69535375",
"0.69476676",
"0.6917809",
"0.68591356",
"0.6852263",
"0.68424934",
"0.68272406",
"0.68222725",
"0.6762305",
"0.6758753",
"0.6756027",
"0.6756027",
"0.675... | 0.7770553 | 1 |
Return attributes contained in this model as a dictionary | def toDict(self, exclude=None, include=None):
dict = {}
for attr, value in self.__dict__.items():
corrected_name = attr[1:] # remove first underscore
if exclude is not None and corrected_name in exclude:
continue
if include is not None an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attributes(self):\n return dict(self.attributes) # return the attributes",
"def get_attributes(self):\n return dict(self.attributes) # return the attributes",
"def get_attributes(self):\n return dict(self.attributes) # return the attributes",
"def attributes(self):\n return... | [
"0.8748013",
"0.8748013",
"0.8748013",
"0.84205115",
"0.832725",
"0.832692",
"0.8319541",
"0.8278484",
"0.8256336",
"0.81552625",
"0.8123491",
"0.8114465",
"0.8114465",
"0.8022473",
"0.79944044",
"0.79668665",
"0.7926675",
"0.7895532",
"0.786637",
"0.77931875",
"0.77894783",
... | 0.0 | -1 |
Test searchsorted as numpy function. | def test_searchsorted_numpy_func(self):
q = self.q.flatten()
self.assertNDArrayEqual(np.searchsorted(q, [1.5, 2.5] * self.ureg.m), [1, 2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def searchsorted(a, v, side=\"left\", sorter=None):\n\n return call_origin(numpy.where, a, v, side, sorter)",
"def searchsorted(self, **kwargs): # noqa: PR02\n return SeriesDefault.register(pandas.Series.searchsorted)(self, **kwargs)",
"def test_search_list_found(self):\r\n self.assertEqual(s... | [
"0.6279717",
"0.62778676",
"0.61127937",
"0.6048838",
"0.6030165",
"0.59891117",
"0.59398174",
"0.59398174",
"0.59398174",
"0.59398174",
"0.59210557",
"0.5914617",
"0.58851093",
"0.5840959",
"0.5840959",
"0.5840959",
"0.58362526",
"0.5805804",
"0.5805328",
"0.5799236",
"0.579... | 0.85145366 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.