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 |
|---|---|---|---|---|---|---|
Returns the opening price of the current candle for this strategy. Just as a helper to use when writing super simple strategies. | def open(self) -> float:
return self.current_candle[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOpeningPrice(self):\n\t\treturn self.dataPoints[0].getDate(), self.dataPoints[0].getAdjustedValue()",
"def current_close_price(self) -> float:\n opening = self._prices.open[self._offset]\n closing = self._prices.close[self._offset]\n real_price = opening * (1.0 + closing)\n ret... | [
"0.78886503",
"0.7744816",
"0.74347943",
"0.71259505",
"0.6984432",
"0.67441314",
"0.66315013",
"0.6573357",
"0.64637935",
"0.6453192",
"0.6406941",
"0.61934096",
"0.6193294",
"0.61816436",
"0.6169989",
"0.6120484",
"0.6116162",
"0.6110662",
"0.6110662",
"0.6110662",
"0.60828... | 0.7795067 | 1 |
Current available margin considering leverage | def available_margin(self) -> float:
return self.position.exchange.available_margin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_margin(self, selling_price):\n selling_price = ( selling_price - self.product_price ) / 2\n return selling_price",
"def getMargin(self):\n assert False",
"def margin(self):\n sp = self.sale_price or zero\n if u.isempty(sp):\n return zero\n cp = self.... | [
"0.71312326",
"0.7116407",
"0.71075845",
"0.68276834",
"0.6468841",
"0.6410064",
"0.640664",
"0.6395331",
"0.63836384",
"0.61530566",
"0.6138118",
"0.6117257",
"0.6066831",
"0.6058126",
"0.59975266",
"0.5994183",
"0.58349615",
"0.57678425",
"0.57267517",
"0.57101387",
"0.5647... | 0.76585174 | 0 |
Compute the surface area of the surface described by the passed faces and vertices. | def calc_surface_area(faces, verts):
# Calculate the surface area of a mesh from it's triangle faces.
# faces: List of all the faces on the surface. Each face indexes three
# points from verts which make up the triangle face.
# verts: List of all the vertices on the surface.
area = 0
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_mesh_area(mesh):\n vertices = mesh.vertices\n faces = mesh.faces\n areas = [compute_triangle_area(vertices[face]) for face in faces]\n mesh_surface_area = sum(areas)\n return mesh_surface_area",
"def compute_surface_area(self):\n return np.sum(self._find_triangle_areas())",
"d... | [
"0.7736435",
"0.766968",
"0.6900118",
"0.6810979",
"0.6616467",
"0.6600451",
"0.6574982",
"0.65674746",
"0.65647465",
"0.6543246",
"0.6513538",
"0.64848363",
"0.64219403",
"0.6413926",
"0.638762",
"0.63795274",
"0.63532186",
"0.6349575",
"0.6332979",
"0.63273543",
"0.6275152"... | 0.8556049 | 0 |
The name of this object | def name(self):
return self.__name__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self.__name",
"def name(self):\n return self.__name",
"def name(self):\n return self.__name",
"def name(self):\n return self.__name",
"def name(self):\n return self.__name",
"def name(self):\n return self.__name",
"def name(self):\n ... | [
"0.9077835",
"0.9077835",
"0.9077835",
"0.9077835",
"0.9077835",
"0.9077835",
"0.9077835",
"0.9077835",
"0.9077835",
"0.9077835",
"0.9027527",
"0.89827055",
"0.89720935",
"0.89720935",
"0.89720935",
"0.89720935",
"0.89720935",
"0.89720935",
"0.89720935",
"0.89453995",
"0.8945... | 0.8978934 | 12 |
return the main RFC2046 name for this mime type e.g. if this object has names ('text/restructured', 'textxrst') then self.normalized() will always return the first form. | def normalized(self):
return self.mimetypes[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name(self):\n return self.normalize_name(self.name)",
"def normalize_name(self) -> str:\n name = self.path.name\n server_names = ContentType.server_names()\n for _ in range(2):\n # we iterate twice to handle cases of doubled prefixes like `classifier-mapper-`\n ... | [
"0.7130282",
"0.70322955",
"0.6688605",
"0.6638682",
"0.65132236",
"0.64169395",
"0.6368062",
"0.63629127",
"0.63417304",
"0.6341707",
"0.6301123",
"0.62752247",
"0.6247217",
"0.62343776",
"0.6218256",
"0.62170607",
"0.62110025",
"0.6202358",
"0.6201295",
"0.6201295",
"0.6196... | 0.6847344 | 2 |
Sets the api_key of this SetPerson. | def api_key(self, api_key):
if api_key is None:
raise ValueError("Invalid value for `api_key`, must not be `None`") # noqa: E501
self._api_key = api_key | {
"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\n self._api_key = api_key",
"def set_api_key(api_key):\n Movie.__ap... | [
"0.8073982",
"0.8073982",
"0.7744975",
"0.76712006",
"0.75286484",
"0.73994166",
"0.72658217",
"0.72505146",
"0.7105768",
"0.69818354",
"0.6979281",
"0.6776495",
"0.66678274",
"0.6606092",
"0.6591154",
"0.65145504",
"0.6486333",
"0.6380033",
"0.6323999",
"0.6298451",
"0.62656... | 0.7189714 | 8 |
Sets the person_id of this SetPerson. | def person_id(self, person_id):
self._person_id = person_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def person_phone_number(self, person_phone_number):\n\n self._person_phone_number = person_phone_number",
"def set_person(self, person):\n if person.upper() == UNKNOWN.upper():\n self.person_name = UNKNOWN\n self.person_id = 'XX'\n else:\n self.person_name = ... | [
"0.6302545",
"0.6207641",
"0.61405015",
"0.6101679",
"0.6101679",
"0.6052792",
"0.6052792",
"0.59599644",
"0.5833935",
"0.58247536",
"0.56445473",
"0.5567442",
"0.55331945",
"0.55026346",
"0.54883087",
"0.5415443",
"0.5406886",
"0.54040134",
"0.5398461",
"0.5331874",
"0.53318... | 0.8424934 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SetPerson):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.808826",
"0.808826",
"0.8054592",
"0.79827315",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.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.0 | -1 |
Determines the ideal threshold to use for the Canny edge detector. | def get_canny_thresholds(img):
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
v = np.median(gray)
lower = int(max(0, (1.0 - 0.33) * v))
upper = int(min(255, (1.0 + 0.33) * v))
return lower, upper | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canny(self, img):\n low_threshold, high_threshold = self.canny_params[\"thresholds\"]\n return cv2.Canny(img, low_threshold, high_threshold)",
"def canny(img, low_threshold, high_threshold):\n return cv2.Canny(img, low_threshold, high_threshold)",
"def canny(img, low_threshold, high_thresh... | [
"0.697952",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.68524957",
"0.67619413",
"0.6694065",
"0.6684285",
"0.6548697",
"... | 0.74063784 | 0 |
Thresholds an image according to a color palette. The color palette should include a mean color value in HSV, and its standard deviation. | def apply_color_threshold(img, colors):
hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV_FULL)
height, width, _ = img.shape
mask = np.zeros((height, width, 1), dtype=np.uint8)
for _, color in colors.iterrows():
submask = cv.inRange(
hsv,
(
color["m0"] - color["s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threshold(self, img):\n\n # Define range of green color in HSV\n if HALLWAY == True:\n lower_green = np.array([35,120,0])\n upper_green = np.array([80,255,255])\n else:\n lower_green = np.array([35,0,0])\n upper_green = np.array([80,255,200])\n\n... | [
"0.64911777",
"0.6471027",
"0.64458424",
"0.6438486",
"0.6374088",
"0.6292965",
"0.62871873",
"0.62792146",
"0.62792146",
"0.62559044",
"0.6246411",
"0.6212605",
"0.619378",
"0.61009073",
"0.6079753",
"0.6075744",
"0.603734",
"0.6000376",
"0.59727937",
"0.5965361",
"0.5910238... | 0.70732236 | 0 |
The main queryset, if any, the action is associated with | def queryset(cls):
return cls.model._default_manager.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return None",
"def get_queryset(self):\n return None",
"def get_queryset(self):\n if getattr(self, 'use_this_queryset', None):\n return self.use_this_queryset\n return self.model().objects.all()",
"def get_queryset(self):\r\n return self... | [
"0.7023088",
"0.7023088",
"0.6880943",
"0.68742186",
"0.6863433",
"0.68529034",
"0.68082607",
"0.67770046",
"0.67523354",
"0.67320716",
"0.666353",
"0.6648106",
"0.6619287",
"0.65919095",
"0.6539332",
"0.65030557",
"0.6499081",
"0.64764196",
"0.64601326",
"0.6458891",
"0.6457... | 0.6452185 | 21 |
Gets a query set, based on the results of the get_table_display_properties method, and a model. | def get_query_set(model_class, sort_column="id", sort_descending=True, filters={}):
sort_modifier = ""
if sort_descending:
sort_modifier = "-"
return model_class.objects.filter(**filters).order_by("%s%s"% (sort_modifier, sort_column)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getQuery(self, context, obj):\n return TestModel.all()",
"def __get__(self, model_instance, model_class):\r\n if model_instance is not None:\r\n query = Query(self.__model)\r\n if type(self.__property) == list:\r\n props = []\r\n for prop in s... | [
"0.6389508",
"0.6264638",
"0.610979",
"0.5991213",
"0.59355557",
"0.58383346",
"0.58293474",
"0.581497",
"0.58035845",
"0.5779282",
"0.57777196",
"0.5767666",
"0.5740834",
"0.57133913",
"0.5690339",
"0.56800884",
"0.56751376",
"0.5665364",
"0.5657337",
"0.5647885",
"0.5642487... | 0.61164534 | 2 |
Return a (k, v) iterator over all entries which match a predicate. | def filter(self, fn: Callable[[Tuple[K, List[V]]], bool]) -> Iterator[Tuple[K, List[V]]]:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, fn: Callable[[Tuple[K, List[V]]], bool]) -> Iterator[Tuple[K, List[V]]]:\n return (entry for entry in iter(self) if fn(entry))",
"def filter(self, predicate):\n def _filter(iterator):\n while True:\n item = next(iterator)\n if predicate(item... | [
"0.66125655",
"0.61352295",
"0.60639924",
"0.6010481",
"0.5856108",
"0.56188864",
"0.55807847",
"0.5561238",
"0.55338967",
"0.54691845",
"0.54691344",
"0.5412125",
"0.5379938",
"0.53385085",
"0.53156626",
"0.5302507",
"0.5221759",
"0.51682454",
"0.5138436",
"0.5096057",
"0.50... | 0.59762645 | 4 |
Return a (k, v) iterator over all entries which match a predicate. | def filter(self, fn: Callable[[Tuple[K, List[V]]], bool]) -> Iterator[Tuple[K, List[V]]]:
return (entry for entry in iter(self) if fn(entry)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, predicate):\n def _filter(iterator):\n while True:\n item = next(iterator)\n if predicate(item):\n return item\n return self.__class__(self, _filter)",
"def filter(iterable, predicate):\n\n for x in iterable:\n i... | [
"0.6135991",
"0.6064259",
"0.6007846",
"0.5976181",
"0.5856157",
"0.5618257",
"0.55829483",
"0.55613893",
"0.5533868",
"0.5470097",
"0.5469658",
"0.5414153",
"0.538038",
"0.53377146",
"0.531501",
"0.5301984",
"0.52228194",
"0.51671296",
"0.5139627",
"0.5098916",
"0.5089694",
... | 0.6612025 | 0 |
Split sentence into word list using regex. | def word_tokenize(sent):
pat = re.compile(r"[\w]+|[.,!?;|]")
if isinstance(sent, str):
return pat.findall(sent.lower())
else:
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_split(self, sentence):\n return re.split(self.word_split_pattern, sentence)",
"def split_sentence(s, tok=False):\n if tok:\n s = s.lower()\n s = s.replace('\\u2019', \"'\")\n s = digit_pattern.sub('0', s)\n words = []\n for word in s.split():\n if tok:\n ... | [
"0.8610105",
"0.78379446",
"0.7490137",
"0.74447644",
"0.7431033",
"0.7369901",
"0.73681104",
"0.73522204",
"0.7252719",
"0.72172534",
"0.71918994",
"0.71638274",
"0.71436006",
"0.7044809",
"0.70446634",
"0.7025652",
"0.6976989",
"0.6976989",
"0.6947828",
"0.6947828",
"0.6942... | 0.7347275 | 8 |
Updates the description of submission. | def submission_update_description(request, submission_pk):
try:
submission = models.CompetitionSubmission.objects.get(pk=submission_pk)
if submission.participant.user != request.user:
raise Http404()
submission.description = request.POST.get('updated_description')
submiss... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_description_update():\n global should_update_description\n should_update_description = True",
"def description(request):\n if request.method != 'POST':\n description = request.issue.description or \"\"\n return HttpTextResponse(description)\n if not request.issue.edit_allowed:\n if n... | [
"0.69428635",
"0.65734416",
"0.65000474",
"0.64588416",
"0.64396554",
"0.6303473",
"0.6122576",
"0.6122576",
"0.6122576",
"0.6122576",
"0.60856855",
"0.60856855",
"0.60856855",
"0.60856855",
"0.60856855",
"0.60856855",
"0.60856855",
"0.60856855",
"0.60856855",
"0.60856855",
"... | 0.76897484 | 0 |
Ctor for the Node class | def __init__(self, node_id, edges, name, msg_q, dl):
global debug_level
# Required for GHS operation
self.state = State.sleep
self.name = name
self.msg_q = msg_q
self.level = 0
self.node_id = node_id
self.father = -1 # Index of the edge along the father ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.root = Node('')",
"def __init__(self):\n self.__root = Node()",
"def __init__(self):\n self.root = self.Node(None)",
"def __init__(self, nodes=None):\r\n self.nodes = nodes",
"def __init__(self):\n self.root = self.Node()",
"def __init__(self)... | [
"0.8214298",
"0.818118",
"0.8176575",
"0.8159136",
"0.81559527",
"0.81387657",
"0.81387657",
"0.8127468",
"0.81191415",
"0.8098652",
"0.8098652",
"0.8098652",
"0.80169696",
"0.79011214",
"0.7881566",
"0.78327686",
"0.78232217",
"0.7812511",
"0.78097165",
"0.77803624",
"0.7770... | 0.0 | -1 |
Checks male last names, returns appropriate Boolean for if all male last names consistent | def male_last_names(inds, males):
lastNames = []
for male in males:
lastNames.append(get_last_name(inds, male))
return len(set(lastNames))==1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_check(l_name):\r\n if len(l_name) == 0:\r\n print('The last name must be filled in.')\r\n if len(l_name) < 2:\r\n print(l_name + ' is not a valid last name. It is too short.')",
"def check_name(name):\n name = sanitize_name(name)\n for letter in name:\n if letter not in ... | [
"0.6498474",
"0.64881516",
"0.64528984",
"0.62591255",
"0.6253744",
"0.6214615",
"0.6145466",
"0.6108552",
"0.6069297",
"0.6058247",
"0.6037373",
"0.60131437",
"0.5993291",
"0.59693694",
"0.5938852",
"0.59103674",
"0.58884156",
"0.5883329",
"0.5859397",
"0.5843328",
"0.584332... | 0.82525045 | 0 |
Finds last name from Individual dictionary | def get_last_name(people, individual):
surname = people[individual]['NAME'].split()
return surname[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ldap_get_lastname(self, user):\n result = super(Auth42, self)._search_not_empty(user)\n if result is not None:\n lastname = result.get(\"last-name\")[0]\n return lastname\n\n return None",
"def last_name():\r\n\r\n return surnames()",
"def last_name():\n ret... | [
"0.72112036",
"0.69756466",
"0.69105303",
"0.69057167",
"0.6858446",
"0.6858446",
"0.6756674",
"0.6755793",
"0.6733717",
"0.67331433",
"0.6726577",
"0.6714257",
"0.66793305",
"0.66255647",
"0.6622633",
"0.6608852",
"0.656535",
"0.656535",
"0.656535",
"0.656535",
"0.6538771",
... | 0.7792975 | 0 |
Function to return day month suffix | def suffix(d):
return "th" if 11<=d<=13 else {1:"st",2:"nd",3:"rd"}.get(d%10, "th") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_date_suffix(date_str: str):\n day = int(date_str[-2:])\n if 4 <= day <= 20 or 24 <= day <= 30:\n suffix = \"th\"\n else:\n suffix = [\"st\", \"nd\", \"rd\"][day % 10 - 1]\n return date_str + suffix",
"def format_month_day(time):\n month = [\"january\", \"february\", \"marc... | [
"0.69831526",
"0.6936477",
"0.6896886",
"0.68153685",
"0.676966",
"0.6754132",
"0.67474294",
"0.6746624",
"0.66505706",
"0.6630462",
"0.6629185",
"0.65843177",
"0.65214586",
"0.65110546",
"0.64901996",
"0.6481202",
"0.6398106",
"0.6386053",
"0.6383582",
"0.6379228",
"0.633839... | 0.67283314 | 8 |
Function to format date with day month suffix | def custom_strftime(format, t):
return t.strftime(format).replace("{S}", str(t.day) + suffix(t.day)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_month_day(time):\n month = [\"january\", \"february\", \"march\", \"april\",\n \"may\", \"june\", \"july\", \"august\",\n \"september\", \"october\", \"november\", \"december\"\n ][time.month - 1]\n day = str(time.day)\n return month + \" :n:\" + day",
"def... | [
"0.73730093",
"0.7279007",
"0.6906042",
"0.6798994",
"0.67893964",
"0.66856056",
"0.65882856",
"0.6582055",
"0.65588605",
"0.65267044",
"0.6460744",
"0.64078915",
"0.63255304",
"0.6296105",
"0.629047",
"0.62695056",
"0.6250555",
"0.6225367",
"0.62223995",
"0.61807775",
"0.613... | 0.71496093 | 2 |
Benchmark interface to the NASBench201 Benchmarks. The NASBench201 contains results for architectures on 4 different data sets. We have split the "api" file from NASBench201 in separate files per data set. The original "api" file contains all data sets, but loading this single file took too much RAM. We recommend to no... | def __init__(self, dataset: str,
rng: Union[np.random.RandomState, int, None] = None, **kwargs):
super(NasBench201BaseBenchmark, self).__init__(rng=rng)
data_manager = NASBench_201Data(dataset=dataset)
self.data = data_manager.load()
self.config_to_structure = NasBen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self,\n config_file: Path,\n default_fields: Iterable[str] = (\"methods\", \"datasets\"),\n save_artifacts: bool = True,\n save_folder: Optional[Path] = Path(\"artifacts\"),\n artifacts: Iterable[str] = (\"results\", \"methods\", \"predictions\"),\n ):\n... | [
"0.632675",
"0.59950143",
"0.59878725",
"0.5985616",
"0.58585376",
"0.5819067",
"0.5780908",
"0.5703",
"0.5697699",
"0.56956273",
"0.5628679",
"0.5617026",
"0.5602825",
"0.5596997",
"0.5593394",
"0.5568905",
"0.55184263",
"0.5494576",
"0.5484459",
"0.5483463",
"0.5456806",
... | 0.6444246 | 0 |
Sets the extend_spec of this ServerModel. | def extend_spec(self, extend_spec):
self._extend_spec = extend_spec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_spec(self):\n return self._extend_spec",
"def extend_param(self, extend_param):\n self._extend_param = extend_param",
"def spec(self, value: typing.Union[\"VolumeAttachmentSpec\", dict]):\n if isinstance(value, dict):\n value = typing.cast(\n VolumeAtta... | [
"0.6443294",
"0.55630785",
"0.5267754",
"0.5228461",
"0.51189834",
"0.5068432",
"0.49843132",
"0.49721426",
"0.49681425",
"0.48978725",
"0.48455185",
"0.47931293",
"0.47584438",
"0.46644542",
"0.46644542",
"0.46361274",
"0.4560138",
"0.45541787",
"0.45527098",
"0.4500503",
"0... | 0.7865963 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, ServerModel):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.808826",
"0.808826",
"0.8054592",
"0.79827315",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"0.79666996",
"... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.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.0 | -1 |
GET route which returns HTML template, | async def index(request: Request):
return templates.TemplateResponse(
"index.html", context={"request": request}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request, *args, **kwargs):\n return render(request, self.template_name)",
"def get(self, request, *args, **kwargs):\n return render(request, self.template_name)",
"def get(self, request, *args, **kwargs):\n return render(request, self.template_name)",
"def get(self, request... | [
"0.7551903",
"0.7551903",
"0.7551903",
"0.7551903",
"0.7551903",
"0.7324138",
"0.72405046",
"0.7203983",
"0.7172637",
"0.7168121",
"0.71578026",
"0.71572423",
"0.7154445",
"0.70578325",
"0.7040765",
"0.70315826",
"0.69778436",
"0.69667935",
"0.69458115",
"0.69165057",
"0.6908... | 0.0 | -1 |
Prediction given user and item ID | def predict_given_id(self, userID, itemID):
userID = np.array([[userID]]) - 1
itemID = np.array([[itemID]]) - 1
return self.predict([userID, itemID])[0][0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prediction_item(item_id):\r\n # Data preprosessing\r\n reader = Reader(rating_scale=(0, 5))\r\n load_df = Dataset.load_from_df(ratings_df, reader)\r\n a_train = load_df.build_full_trainset()\r\n\r\n predictions = []\r\n for ui in a_train.all_users():\r\n predictions.append(model.predic... | [
"0.85400647",
"0.8210016",
"0.79867476",
"0.79816115",
"0.7696162",
"0.7689913",
"0.7504147",
"0.74992925",
"0.73485106",
"0.7226085",
"0.7003321",
"0.6959786",
"0.6957221",
"0.68223125",
"0.6775812",
"0.6727188",
"0.67174923",
"0.66798383",
"0.6662989",
"0.6602646",
"0.65802... | 0.79462814 | 4 |
This method initialize the player's inventory and position on the maze | def __init__(self, maze):
pygame.init()
# Loads the character's inventory
self.inventory = 0
# Character's position on the grid and size (pixels)
self.image = pygame.image.load(MACGYVER_IMG).convert_alpha()
self.square_x = 1
self.square_y = 1
self.x_pos =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_position():\n __maze.init_position()",
"def __init__(self, pos, inventory=None):\n if inventory is None:\n self._inventory = {}\n else:\n self._inventory = deepcopy(inventory)\n self._pos = deepcopy(pos)",
"def setup(player, level):\n display('f1', 'inve... | [
"0.7522991",
"0.670759",
"0.66774213",
"0.66647094",
"0.6610935",
"0.6435626",
"0.6399999",
"0.6136124",
"0.61031806",
"0.6102315",
"0.60551834",
"0.6012518",
"0.5987825",
"0.5972301",
"0.59705096",
"0.5960765",
"0.5940087",
"0.5938841",
"0.5901059",
"0.58978504",
"0.5895169"... | 0.72020155 | 1 |
Assert that descriptor label is not None | def test_label(self):
self.assertIsNotNone(TestObject.test_setting.label)
self.assertEqual(TestObject.test_setting.label, "test_setting") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_label(self):\n try:\n t = self.OntTerm(label='diffuse')\n raise AssertionError(f'should fail {t!r}')\n except TypeError:\n pass",
"def test_label_not_in_config(self):\n with self.assertRaisesRegex(\n ValueError, 'The config \\'Label\\' field shoul... | [
"0.65601325",
"0.64786154",
"0.6402786",
"0.6376877",
"0.6236761",
"0.62211794",
"0.62094885",
"0.61948144",
"0.61773115",
"0.61555314",
"0.61418533",
"0.61308026",
"0.6122297",
"0.6117438",
"0.6062527",
"0.60474825",
"0.5989489",
"0.5951399",
"0.5919112",
"0.58981603",
"0.58... | 0.623294 | 5 |
Checks if a position (row, col) is valide | def is_in_the_grid(self, row: int, col: int) -> bool:
return 0 <= row < self.n_row and 0 <= col < self.n_col | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_position(self, somerow, somecol):\n valid_row = 0 <= somerow <= (self.size-1)\n valid_col = 0 <= somecol <= (self.size-1)\n #need to use self.size - 1 because while we're thinking of an 8x8 chess board, the computer is thinking of a 0x7 chess board\n return valid_row and va... | [
"0.80110043",
"0.7618726",
"0.7508517",
"0.7413245",
"0.7345735",
"0.7272231",
"0.72667396",
"0.72644436",
"0.72539383",
"0.720363",
"0.7176444",
"0.7158005",
"0.7153388",
"0.71518654",
"0.7144556",
"0.7120042",
"0.70162386",
"0.69930273",
"0.6987078",
"0.69520116",
"0.693856... | 0.6831199 | 28 |
Tests a fairly basic instantiation works. | def test_instantiation(self):
event = Event(
Guild(12345),
'Some title',
datetime(2020, 10, 10, 10, 10, tzinfo=utc),
'Some description')
self.assertEqual(event.guild.id, 12345)
self.assertEqual(event.title, 'Some title')
self.assertEqual(ev... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_constructor(self):\n pass",
"def test_can_instantiate(self):\n\n exc_thrown = False\n\n try:\n self.klass(*self.instantiate_args)\n except Exception:\n exc_thrown = True\n\n self.assertFalse(exc_thrown)",
"def test_constructor(self):\n as... | [
"0.800572",
"0.72862357",
"0.7213438",
"0.7210809",
"0.7122167",
"0.7098013",
"0.7022267",
"0.7016395",
"0.69373816",
"0.69247407",
"0.6903957",
"0.68756586",
"0.68744475",
"0.68744475",
"0.6848849",
"0.67911834",
"0.6773951",
"0.6766082",
"0.6744084",
"0.6728619",
"0.6727752... | 0.6334512 | 68 |
Ensures the changed date is associated to a timezone. | def test_date_change_fails_on_naive_datetime(self):
event = Event(
Guild(12345),
'Some title',
datetime(2020, 10, 10, 10, 10, tzinfo=utc),
'Some description')
with self.assertRaises(ValueError):
event.date = datetime(2020, 10, 10, 12, 10) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def may_the_timezone_be_with_it(self):\n self.timestamp = pytz.utc.localize(self.timestamp)",
"def test_timezones(self):\n a_user = User.objects.create()\n user = VSBUser.objects.create(user=a_user)\n\n today_datetime = timezone.datetime.today()\n today_datetime = timezone.date... | [
"0.6592536",
"0.6485479",
"0.6456845",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.6307272",
"0.620385",
"0.61555606",
"... | 0.5766525 | 33 |
Checks if the daily generates the same event but a day later. | def test_create_next_event_daily(self):
event = Event(
Guild(12345),
'Some title',
datetime(2020, 10, 10, 10, 10, tzinfo=timezone('Europe/Paris')),
'Some description',
EventRepetitionFrequency.daily)
next_event = event.create_next_event()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_once(today, last_send):\n if isinstance(today, datetime):\n if last_send is not None:\n if today.date() != last_send.date():\n return True\n return False\n return True\n else:\n raise Exception(\"{} is not a datetime instance\".format(today))"... | [
"0.6653626",
"0.66031647",
"0.64309585",
"0.62827253",
"0.6282151",
"0.6270408",
"0.6239076",
"0.61726797",
"0.6121542",
"0.6077242",
"0.6026527",
"0.60209274",
"0.6017933",
"0.59536636",
"0.59286076",
"0.5927406",
"0.58976585",
"0.5889603",
"0.5883304",
"0.5863175",
"0.58410... | 0.60805243 | 9 |
Checks if the daily generates the same event but a day later. | def test_create_next_event_fails_if_not_repeated(self):
event = Event(
Guild(12345),
'Some title',
datetime(2020, 10, 10, 10, 10, tzinfo=timezone('Europe/Paris')),
'Some description')
with self.assertRaises(ValueError):
event.create_next_event... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_once(today, last_send):\n if isinstance(today, datetime):\n if last_send is not None:\n if today.date() != last_send.date():\n return True\n return False\n return True\n else:\n raise Exception(\"{} is not a datetime instance\".format(today))"... | [
"0.6653626",
"0.66031647",
"0.64309585",
"0.62827253",
"0.6282151",
"0.6270408",
"0.6239076",
"0.61726797",
"0.6121542",
"0.60805243",
"0.6077242",
"0.6026527",
"0.60209274",
"0.6017933",
"0.59536636",
"0.59286076",
"0.5927406",
"0.58976585",
"0.5889603",
"0.5883304",
"0.5863... | 0.0 | -1 |
tokenize the text by removing stopwords,removing short words and lemmetization | def tokenize(text):
tokens = word_tokenize(text)
STOPWORDS = list(set(stopwords.words('english')))
# remove short words
tokens = [token for token in tokens if len(token) > 2]
# remove stopwords
tokens = [token for token in tokens if token not in STOPWORDS]
lemmatizer = WordNet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n \n #regular expression to avoid pucntuations or any special character\n tokenizer = nltk.RegexpTokenizer(r\"\\w+\")\n \n #tokenizing text\n tokens = tokenizer.tokenize(text)\n \n #initiating lemmatizer\n lemmatizer = WordNetLemmatizer()\n \n #iteratating throu... | [
"0.80628556",
"0.80628556",
"0.79217774",
"0.7894799",
"0.7874963",
"0.78218913",
"0.78193784",
"0.77917904",
"0.77667946",
"0.77605903",
"0.77367723",
"0.77003455",
"0.76959854",
"0.7683413",
"0.7663784",
"0.7660807",
"0.7651372",
"0.76081824",
"0.75985706",
"0.7567072",
"0.... | 0.80719614 | 0 |
Create a Plane from multiple Points | def plane_from_multiple_points(pnts: Iterable[Point]) -> Plane:
n = len(pnts)
x = [pnt.x for pnt in pnts]
y = [pnt.y for pnt in pnts]
z = [pnt.z for pnt in pnts]
pntc = Point(sum(x)/n, sum(y)/n, sum(z)/n)
x = [pnt.x-pntc.x for pnt in pnts]
y = [pnt.y-pntc.y for pnt in pnts]
z = [pnt.z-pn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_points_plane(points, plane):\n return [project_point_plane(point, plane) for point in points]",
"def create_plane(self):\n\n # First we calculate our point increment for both the x and y values\n inc_x = (self.xmax - self.xmin)/(self.xlen - 1)\n inc_y = (self.ymax - self.ymin)... | [
"0.73871446",
"0.7376205",
"0.7074176",
"0.67450684",
"0.6724389",
"0.66472244",
"0.664459",
"0.6625973",
"0.66091484",
"0.6585401",
"0.65773326",
"0.65773326",
"0.65700346",
"0.6522833",
"0.64595556",
"0.6365121",
"0.6355493",
"0.63021886",
"0.6288559",
"0.62862134",
"0.6266... | 0.8260042 | 0 |
Return a given number of bitwise left rotations of an integer n, for a given bit field width. | def rol(n, rotations, width=8):
rotations %= width
if rotations < 1:
return n
n &= mask(width)
return ((n << rotations) & mask(width)) | (n >> (width - rotations)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rol(n, rotations=1, width=8):\n rotations %= width\n if rotations < 1:\n return n\n n &= mask(width) ## Should it be an error to truncate here?\n return ((n << rotations) & mask(width)) | (n >> (width - rotations))",
"def rotate_left(x, d):\n d = d % N\n out = x << d\n excess = ou... | [
"0.7144216",
"0.70853406",
"0.7044525",
"0.6819774",
"0.6663163",
"0.6632736",
"0.6564524",
"0.65495884",
"0.65214574",
"0.65214574",
"0.6507071",
"0.65043354",
"0.6491099",
"0.64821196",
"0.6462259",
"0.64587927",
"0.64520216",
"0.6445841",
"0.63985",
"0.6271351",
"0.6270217... | 0.724426 | 0 |
Return a given number of bitwise right rotations of an integer n, for a given bit field width. | def ror(n, rotations, width=8):
rotations %= width
if rotations < 1:
return n
n &= mask(width)
return (n >> rotations) | ((n << (width - rotations)) & mask(width)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ror(n, rotations=1, width=8):\n rotations %= width\n if rotations < 1:\n return n\n n &= mask(width)\n return (n >> rotations) | ((n << (width - rotations)) & mask(width))",
"def rol(n, rotations, width=8):\n rotations %= width\n if rotations < 1:\n return n\n n &= mask(wid... | [
"0.76813394",
"0.73614526",
"0.7242411",
"0.7106442",
"0.7006793",
"0.6919777",
"0.69068336",
"0.6808133",
"0.67340535",
"0.67340535",
"0.66943073",
"0.6649728",
"0.66176414",
"0.6591214",
"0.6569241",
"0.6551736",
"0.64905155",
"0.6444957",
"0.64026994",
"0.62089187",
"0.618... | 0.772469 | 0 |
Retrieves the TidyPy configuration extenders that are available in the current Python environment. The returned dictionary has keys are the extender names and values are the extender classes. | def get_extenders():
# pylint: disable=protected-access
if not hasattr(get_extenders, '_CACHE'):
get_extenders._CACHE = {}
for entry in pkg_resources.iter_entry_points('tidypy.extenders'):
try:
get_extenders._CACHE[entry.name] = entry.load()
except Impor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exts(self):\n return type(self).class_ext()",
"def get_available_extensions() -> DefaultDict[str, Type]:\n all_extensions:DefaultDict[str, Type] = defaultdict(lambda:False)\n for current_class in Content.__subclasses__():\n for extension in current_class.extensions:\n ... | [
"0.6519807",
"0.6364768",
"0.61822474",
"0.6025312",
"0.5967902",
"0.5911663",
"0.57856417",
"0.5783588",
"0.5768759",
"0.5702149",
"0.5700969",
"0.5650702",
"0.5628545",
"0.559333",
"0.5587474",
"0.556967",
"0.55686146",
"0.555321",
"0.554957",
"0.55469054",
"0.5544485",
"... | 0.7153923 | 0 |
Check out if current_user is admin | def is_admin(self):
if not self.current_user:
return False
else:
return self.current_user in ["1"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_is_admin(current_user):\n return current_user['isAdmin'] == True",
"def check_admin():\n if not current_user.is_admin:\n abort(403)",
"def check_admin():\n if not current_user.is_admin:\n abort(403)",
"def check_admin():\n\tif not current_user.is_admin:\n\t\tabort(403)",
"d... | [
"0.8789819",
"0.8525574",
"0.8525574",
"0.8521",
"0.85114413",
"0.837079",
"0.8332496",
"0.83144623",
"0.830675",
"0.8301547",
"0.8278886",
"0.82786417",
"0.826534",
"0.8255011",
"0.82543236",
"0.82422405",
"0.8233658",
"0.8201192",
"0.8167224",
"0.81275296",
"0.8100704",
"... | 0.8730177 | 1 |
Get the stack variable by name. | def get_stack_variable(self, variable_name):
return self.parent_node.get_stack_variable(variable_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ref_by_name(self, name):\n if name in self.vars:\n return self.vars[name]\n #print 'Variable %s not found !' % name\n seq_name_and_index = name.split('|')\n\n if len(seq_name_and_index) == 2:\n seq_name, index = name.split('|')\n if seq_name in s... | [
"0.72303563",
"0.70539236",
"0.7047873",
"0.7047717",
"0.7011313",
"0.68835014",
"0.68583065",
"0.67830527",
"0.6782616",
"0.67365754",
"0.6716994",
"0.6676268",
"0.6666281",
"0.6525585",
"0.6519822",
"0.65083945",
"0.6473341",
"0.6452778",
"0.6450739",
"0.64375544",
"0.64371... | 0.77829504 | 0 |
Puts a new Message into the list of current messages. | def AddMessage(self, name, time, message):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_message(self, msg):\n self.messages.append(msg)",
"def add_message(self, message):\n self.message_list.append(message)",
"def _put_new_message_in_queue(self, message):\n message_type = message.TYPE_STRING\n self.messages[message_type].put(message)",
"def on_message(self, _... | [
"0.75607187",
"0.7532772",
"0.7312",
"0.71865",
"0.7114518",
"0.706964",
"0.7068563",
"0.7054731",
"0.6883128",
"0.6880611",
"0.6866038",
"0.6863518",
"0.6837741",
"0.67018485",
"0.6660102",
"0.6623192",
"0.6621867",
"0.6619591",
"0.6601185",
"0.6552199",
"0.6541815",
"0.65... | 0.6352273 | 28 |
Do not return anything, modify rooms inplace instead. | def wallsAndGates(self, rooms: List[List[int]]) -> None:
if not rooms or not rooms[0]:
return
m, n = len(rooms), len(rooms[0])
INF = 2147483647
q = []
for i in range(m):
for j in range(n):
if rooms[i][j] == 0:
q.append((... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rooms(self, rooms):\n\n self._rooms = rooms",
"def _add_rooms(self):\r\n rooms = self.model.get_all_rooms()\r\n\r\n for room in rooms:\r\n self._add_room(room)",
"def rooms(*args):\n send.system_message('\\n'.join(rooms()))",
"def all_rooms(self):\n pass",
... | [
"0.67927605",
"0.61488795",
"0.59840685",
"0.5949918",
"0.5939362",
"0.59097916",
"0.5801539",
"0.5786312",
"0.5766118",
"0.56981385",
"0.56586784",
"0.5652869",
"0.56474805",
"0.5636384",
"0.55814475",
"0.55698717",
"0.5540498",
"0.5533319",
"0.5533319",
"0.5527856",
"0.5494... | 0.5084055 | 62 |
Return the direct message channel of a user, if it exists. | def find_channel(channels, user):
for x in channels:
if 'is_member' in channels[x]:
continue
if channels[x]["user"] == user:
return channels[x]["id"]
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_channel(guild: discord.Guild) -> discord.TextChannel | None:\n if guild.system_channel is not None:\n return guild.system_channel\n\n for channel_candidate in guild.channels:\n if (\n isinstance(channel_candidate, discord.TextChannel)\n and channel_candidate.pe... | [
"0.69688034",
"0.6956167",
"0.65899336",
"0.6551603",
"0.6413107",
"0.62270945",
"0.6157712",
"0.61231846",
"0.60324025",
"0.5990242",
"0.5975288",
"0.5966888",
"0.5951397",
"0.58750236",
"0.5862272",
"0.58438396",
"0.5827542",
"0.57939774",
"0.5762975",
"0.57595366",
"0.5755... | 0.7037572 | 0 |
Returns the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = '{0} {1} {2}'.format(self.last_name, self.first_name, self.patronymic)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.8313066",
"0.82006806",
"0.8049215",
"0.80409706",
"0.8017754",
"0.7999701",
"0.79541886",
"0.7942144",
"0.7942144",
"0.7942144",
"0.7937664",
"0.79287225",
"0.7921711",
"0.790314",
"0.7892264",
"0.7890117",
"0.7878668",
"0.786143",
"0.78528684",
"0.7823523",
"0.7813124",
... | 0.71764547 | 100 |
Returns the short name for the user. | def get_short_name(self):
return self.first_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n # The user is identified by their email address\n return self.first_name",
"def get_shor... | [
"0.903208",
"0.903208",
"0.903208",
"0.88310844",
"0.8808017",
"0.86666644",
"0.8424345",
"0.8334892",
"0.83120877",
"0.8285306",
"0.8285306",
"0.81957304",
"0.8173249",
"0.8155176",
"0.8132797",
"0.81008893",
"0.8094934",
"0.80806524",
"0.79703724",
"0.79680914",
"0.7964076"... | 0.8181515 | 25 |
Translate the keys in inputdic to the corresponding config dictionary key name. Returns the transformed dictionary object useful for updating the config dictionary. | def transform_to_config(inputdic):
result = {}
for key, value in inputdic.iteritems():
if key in OPT_CONFIG_MAP:
result[OPT_CONFIG_MAP[key]] = value
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lowercase_keys(input_dict):\n if not isinstance(input_dict,dict):\n return input_dict\n\n safe = dict()\n for key,value in input_dict.items():\n safe[str(key).lower()] = value\n return safe",
"def lower_dict(input_dict):\r\n return {k.lower(): v for k, v in input_dict.iteritems()... | [
"0.6122121",
"0.60599196",
"0.58873427",
"0.584975",
"0.58185697",
"0.57851607",
"0.5715898",
"0.57027745",
"0.5640139",
"0.5615861",
"0.5612518",
"0.5601862",
"0.55823135",
"0.5513454",
"0.54629475",
"0.54262257",
"0.5378068",
"0.53639007",
"0.5359473",
"0.5325381",
"0.53183... | 0.67038935 | 0 |
Dot product of two vectors | def dot(self, other):
return self.x0 * other.x0 + self.x1 * other.x1 + self.x2 * other.x2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vec_dot(x, y):\r\n return sum(a * b for a, b in zip(x, y))",
"def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n return float(sum([a[i] * b[i] for i in range(len(a))]))",
"def dotproduct(vec1, v... | [
"0.8688895",
"0.86587024",
"0.86350816",
"0.8631175",
"0.861646",
"0.8581014",
"0.8580933",
"0.8529882",
"0.8509719",
"0.8441795",
"0.8423987",
"0.84158",
"0.84066904",
"0.84055364",
"0.8401772",
"0.8383433",
"0.835288",
"0.834979",
"0.83385503",
"0.8335736",
"0.825806",
"0... | 0.72364074 | 82 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Quota):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.80886984",
"0.80886984",
"0.8055307",
"0.7983415",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
"0.79673034",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748"
] | 0.0 | -1 |
Initialize an Operation object | def __init__(self, compute, project, zone=None, region=None):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, operation, constargs, randomargs):\n Operation.__init__(self)\n self.operation = operation\n self.constargs = constargs\n self.randomargs = randomargs\n if type(operation) is str:\n import CCAugmentation.outputs as cca_out\n import CCAugme... | [
"0.7833994",
"0.78275377",
"0.76954967",
"0.76899815",
"0.74790627",
"0.7237048",
"0.7167325",
"0.7164134",
"0.7104117",
"0.69557995",
"0.6924085",
"0.6888236",
"0.68535537",
"0.68535537",
"0.68535537",
"0.68535537",
"0.68535537",
"0.6827123",
"0.67712575",
"0.6733104",
"0.66... | 0.0 | -1 |
Get a bracketed string representation of numbers, dealing with the maximum number padding | def bracket_pad_num(num, maxnum):
# compute padding
numpad = len(str(maxnum)) - len(str(num))
return "[{}]{}".format(num, " " * numpad) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_number(value, size):\n\n return '{:0>{}}'.format(value, size)",
"def num_string(length):\n import math\n base = 10\n lines = []\n for ndigit in range(int(math.log10(length)) + 1):\n interval = int(math.pow(base, ndigit))\n lines.append(''.join(\n (str(n % base) + (' ' * (interval-... | [
"0.6959735",
"0.6449139",
"0.62706393",
"0.62167275",
"0.6180214",
"0.61329293",
"0.6070924",
"0.60601157",
"0.60272133",
"0.6023614",
"0.60096145",
"0.59646744",
"0.5941564",
"0.5877736",
"0.58604264",
"0.5859859",
"0.58556175",
"0.5812696",
"0.5804186",
"0.58005863",
"0.579... | 0.736934 | 0 |
Retrieves system information for a Windows platform. | def get_system_info() -> SystemInfo:
assert is_windows(), 'This function is only available on Windows systems'
from win32api import GetSystemInfo
return SystemInfo(*GetSystemInfo()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform_info(self):\n return platform.uname()._asdict()",
"def platform_info(self):\n return self.msg.platform_info",
"def get_system_information(self):\n\t\tsys = platform.uname()\n\t\treturn {\n\t\t\t'hostname': sys.node,\n\t\t\t'operating_system': sys.system,\n\t\t\t'version': sys.version... | [
"0.7187292",
"0.71207654",
"0.7067556",
"0.69963264",
"0.68888706",
"0.674019",
"0.674019",
"0.6692718",
"0.66555536",
"0.6594625",
"0.65554225",
"0.6482979",
"0.6474887",
"0.6449962",
"0.64400065",
"0.64203167",
"0.63907367",
"0.63850933",
"0.6363011",
"0.63433385",
"0.63346... | 0.7907725 | 0 |
r"""Get list of products | def products(self):
response = requests.get(self._url(self._PRODUCTS_PATH), headers=self._headers)
return response.json() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_products(self):\n return self._make_get_request(self._urls['products'])",
"def get_all_products(self):\n\t\tpass",
"def products(self):\n return list(Product.select())",
"def get_all_products():\n data = order_obj.get_all_products()\n return data",
"def get_products(self):\n ... | [
"0.8574725",
"0.8373549",
"0.8114118",
"0.8045253",
"0.8024993",
"0.80025667",
"0.8000654",
"0.794037",
"0.78866655",
"0.7780536",
"0.7732908",
"0.77196056",
"0.7713307",
"0.7693953",
"0.76658225",
"0.76449734",
"0.76303256",
"0.76124895",
"0.7609321",
"0.75504816",
"0.754239... | 0.80041075 | 5 |
CG object constructor. Args | def __init__(self, data_par, optimizer_par):
self.image_dim = data_par["image_dimension"]
self.num_coils = data_par["num_coils"]
self.mask = data_par["mask"]
self.DTYPE = data_par["DTYPE"]
self.DTYPE_real = data_par["DTYPE_real"]
self.do_incor = data_par["do_intensity_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n _gdi_.GraphicsObject_swiginit(self,_gdi_.new_GraphicsObject(*args, **kwargs))",
"def __init__(self, *args):\n _hypre.HyprePCG_swiginit(self, _hypre.new_HyprePCG(*args))",
"def __init__(self, r,g,b):\n self.__r = r; self.__g = g; self.__b = b",
"def ... | [
"0.7341816",
"0.72341704",
"0.6925055",
"0.67874783",
"0.6728036",
"0.66667324",
"0.661845",
"0.66081965",
"0.6580268",
"0.6560929",
"0.6555828",
"0.6549412",
"0.6545723",
"0.6543599",
"0.6524922",
"0.6505002",
"0.6496986",
"0.6470053",
"0.64621204",
"0.646068",
"0.6434688",
... | 0.0 | -1 |
Create a new Loader instance. N.B. no initialization arguments are necessary. | def __new__(cls, *args, **kwargs):
# Create an ArgumentSink matching the loader’s
# initialization arguments:
key = ArgumentSink(*args, **kwargs)
# If a loader already matches these arguments,
# return it immediately:
if key in cls.instances:
return c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, loader, *args, **kw):\r\n self._loader = loader",
"def __init__(self, loader, *args, **kw):\n self._loader = loader",
"def create_loader(self, *args, **kwargs):\n def loader():\n return self.load(*args, **kwargs)\n return loader",
"def test_loader(cls... | [
"0.796661",
"0.7921608",
"0.77419096",
"0.70732623",
"0.70186555",
"0.69590724",
"0.68924946",
"0.6875931",
"0.68047655",
"0.6752977",
"0.670738",
"0.6626284",
"0.6610816",
"0.6591698",
"0.65562177",
"0.6480171",
"0.64657277",
"0.64545316",
"0.6415686",
"0.64027727",
"0.63664... | 0.7663135 | 3 |
Return a set of the appnames for all installed finders that have one defined. | def installed_appnames():
appnames = set()
for finder in sys.meta_path:
if hasattr(finder, 'appname'):
appnames.add(finder.appname)
return appnames | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_app_names(self):\n groups = self['__store']\n lookup = {\n g.group_id: g.name[2:]\n for g in groups\n if (g.name.startswith('a_'))\n }\n return set(map(lookup.get, self.get_app_ids()))",
"def app_names(self):\n return self.get_app_names(... | [
"0.76047796",
"0.7488203",
"0.73413825",
"0.704697",
"0.6905417",
"0.68829584",
"0.680741",
"0.6807021",
"0.6746429",
"0.6610377",
"0.65917575",
"0.6587256",
"0.652385",
"0.6344741",
"0.6288226",
"0.6287357",
"0.6236343",
"0.60719603",
"0.60719603",
"0.60666347",
"0.60295606"... | 0.8243536 | 0 |
Get a list of the slice numbers that correspond to each PerFrameFunctionalGroupsSequence in a SEG. | def get_f2sInds(seg, sopuids):
# Get the list of ReferencedSOPInstanceUIDs:
rsopuids = get_RSOPuids_in_PFFGS(seg)
f2sInds = []
for i in range(len(rsopuids)):
if rsopuids[i] in sopuids:
# Find the matching index of rsopuids[i] in sopuids:
f2sInds.append(sop... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_DIVs(seg):\n \n # Initialise the list of divs:\n divs = [] \n \n sequences = seg.PerFrameFunctionalGroupsSequence\n \n for sequence in sequences:\n div = sequence.FrameContentSequence[0].DimensionIndexValues\n \n divs.append(div)\n \n return divs",
"def... | [
"0.66244906",
"0.61573184",
"0.58411527",
"0.58211315",
"0.5590392",
"0.5561899",
"0.5515728",
"0.54788506",
"0.54717696",
"0.53991514",
"0.53909665",
"0.53524226",
"0.5280014",
"0.52561",
"0.5252369",
"0.5249879",
"0.52403617",
"0.523983",
"0.52296495",
"0.52242",
"0.5170611... | 0.47973782 | 73 |
produces all the word ngrams for a given list of tokens. Requires a language parameter to use for stopwords | def ngrams(tokens,lang):
stopwords = stops.stopwords[lang]
max = len(tokens)
ngrams = []
left_punctuation = '!"%&\'()*+,-./:;<=>?[\\]^_`{|}~'
for i in range(1,max):
for j in xrange(0,len(tokens)-(i-1)):
if __check_features(tokens[j:j+i],stopwords):
ng_str = " ".jo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_ngrams(tokens, n=2):\n ngrams = zip(*(islice(group, idx, None) for idx, group in enumerate(tee(tokens, n))))\n return ngrams",
"def create_ngrams(word_list, n):\n yield zip(*[word_list[i:] for i in range(n)])",
"def n_grams(tokens, n):\n return zip(*[tokens[i:] for i in range(n)])",
... | [
"0.6968267",
"0.69581074",
"0.6918212",
"0.6892137",
"0.6892137",
"0.68825245",
"0.6816167",
"0.6796609",
"0.6778971",
"0.6746886",
"0.6716257",
"0.6701597",
"0.665163",
"0.6581921",
"0.6535903",
"0.6531173",
"0.6516492",
"0.6460738",
"0.64511335",
"0.64207375",
"0.64123255",... | 0.8528328 | 0 |
Loads the doctor's index page | def index(request):
try:
doctor = Doctor.objects.get(user=request.user)
except Doctor.DoesNotExist:
raise Http404("Doctor with current user instance unavailable!")
#counting patients who have recovered or are asymptomatic
asymptomatic_patients = doctor.patients.filter(asymptomatic=True)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n return self.load_view('index.html')",
"def show_index_page():\n\n return render_template('index.html')",
"def index():\n return render_template('index.html')",
"def index():\r\n return render_template('index.html')",
"def index():\n return render_te... | [
"0.6936895",
"0.68303794",
"0.6813333",
"0.68025875",
"0.6765869",
"0.6765869",
"0.6759551",
"0.67564166",
"0.6692327",
"0.66659033",
"0.66637605",
"0.6659348",
"0.66548085",
"0.66542065",
"0.66528636",
"0.6650163",
"0.66331095",
"0.66331095",
"0.66331095",
"0.6627191",
"0.66... | 0.0 | -1 |
retrives all appointment objects related to the current doctor object | def appointments(request):
try:
doctor = Doctor.objects.get(user=request.user)
except Doctor.DoesNotExist:
raise Http404("Doctor with current user instance not found!")
#now get the doctors appointments with the most recent first.
appointments = get_appointments_list(doctor.doctor_appoi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_appointments(self):\n current_date = timezone.now().date()\n filled_slots = self.slots.filter(\n appointment__isnull=False,\n date__gte=current_date\n )\n appointment_ids = filled_slots.values_list('appointment', flat=True)\n qs = Appointment.objects... | [
"0.7121257",
"0.7034839",
"0.673916",
"0.6565412",
"0.63046014",
"0.6107498",
"0.610056",
"0.6074228",
"0.60656846",
"0.5933303",
"0.5793861",
"0.56356",
"0.5633384",
"0.5517933",
"0.5440499",
"0.5418591",
"0.53979397",
"0.53903955",
"0.5377009",
"0.53523165",
"0.53053766",
... | 0.6756327 | 2 |
Returns True if this is a user with an actual account. Returns False for anonymous users and lazy users. | def is_regular_user(user):
return user.is_authenticated() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_user(self, user): # pylint: disable=unused-argument\r\n return False",
"def validUser(self):\n if self.state == SessionStates.LOGGED_OUT:\n return False\n\n # if self.user == None:\n # return False\n return True",
"def check_user(self):\n try:\n... | [
"0.738956",
"0.7314415",
"0.7228894",
"0.71581465",
"0.7090865",
"0.6946503",
"0.6904712",
"0.68925697",
"0.68469673",
"0.68270373",
"0.6822365",
"0.6786444",
"0.67663485",
"0.67577267",
"0.67544234",
"0.67281514",
"0.672356",
"0.6701546",
"0.6690461",
"0.66807765",
"0.667476... | 0.68388295 | 9 |
Return calendar object based on provider set in config file. | def get_calendar_provider(config, src_path):
economic_config = dict(config.items('Economic'))
if 'Google' == economic_config['calendar_provider']:
calendar = CalendarGoogle(config.items('Google'), src_path)
elif 'Office365' == economic_config['calendar_provider']:
calendar = CalendarOutlook(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar(self):\n if \"calendar\" in self._prop_dict:\n if isinstance(self._prop_dict[\"calendar\"], OneDriveObjectBase):\n return self._prop_dict[\"calendar\"]\n else :\n self._prop_dict[\"calendar\"] = Calendar(self._prop_dict[\"calendar\"])\n ... | [
"0.62211645",
"0.62211645",
"0.6213421",
"0.6082033",
"0.6082033",
"0.6062294",
"0.60610133",
"0.60527843",
"0.5885092",
"0.58679944",
"0.58628166",
"0.58314866",
"0.5800942",
"0.58008224",
"0.5785284",
"0.57648915",
"0.57648915",
"0.5751194",
"0.5557443",
"0.5522874",
"0.551... | 0.8296184 | 0 |
initialize this house at time of construction num_rooms >> Building1 = Building("1234 thomas st", 5) >>> Building1.address "1234 thomas st" >>> Building1.num_rooms 5 >>> Building1.rooms [] | def __init__(self, name: str, num_rooms: int):
self.name = name
self.num_rooms = num_rooms
self.rooms = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, address: str, num_rooms: int):\n self.address = address\n self.num_rooms = num_rooms\n self.rooms = []",
"def __init__(self, name, num_rooms):\n self.name = name\n self.num_rooms = num_rooms\n self.rooms = []",
"def __init__(self, bed_type=None, numb... | [
"0.8045171",
"0.7583234",
"0.6926041",
"0.6485473",
"0.6109603",
"0.5995821",
"0.5995393",
"0.5988035",
"0.59677184",
"0.58456737",
"0.583868",
"0.5825071",
"0.580231",
"0.5787389",
"0.57864606",
"0.5778791",
"0.5670895",
"0.56445706",
"0.5596578",
"0.5582485",
"0.5553496",
... | 0.7496072 | 2 |
Calculate the ground distance between two coordinates of the same type. Added the compensation of the eclipse effect to the earth, increasing accuracy. This is a approximation, and would get sloppy and inaccurate when closing to poles. | def get_distance_metres(aLocation1, aLocation2):
[dNorth, dEast, dDown] = get_position_error(aLocation1, aLocation2)
return math.sqrt((dNorth*dNorth) + (dEast*dEast)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_along_ground(wp1,wp2):\n\n #**************************************************************************\n # Convert UTM coordinates to global coordinates\n #**************************************************************************\n if isinstance(wp1, UTMWaypoint):\n wp1 = wp1.to_... | [
"0.6619319",
"0.6352049",
"0.6256598",
"0.62307733",
"0.6156658",
"0.601825",
"0.5964414",
"0.5940186",
"0.5922478",
"0.58921885",
"0.5880271",
"0.5880271",
"0.5880271",
"0.5880271",
"0.5880271",
"0.5875257",
"0.5865052",
"0.5861058",
"0.5856926",
"0.5856867",
"0.58405244",
... | 0.5811888 | 22 |
Delete experiment group. Uses [Caching](/references/polyaxoncli/caching) | def delete(ctx):
user, project_name, _group = get_project_group_or_local(ctx.obj.get('project'),
ctx.obj.get('group'))
if not click.confirm("Are sure you want to delete experiment group `{}`".format(_group)):
click.echo('Existing without delet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_group(self):\n pass",
"def test_delete_group(self):\n pass",
"def test_delete_group(self, inventoryloader):\n cg = inventoryloader.count_groups()\n ch = inventoryloader.count_hosts()\n inventoryloader.del_group('glance_api')\n assert 'glance_api' not in... | [
"0.7081196",
"0.7081196",
"0.6998126",
"0.69470227",
"0.68989986",
"0.689815",
"0.68853533",
"0.6788945",
"0.672335",
"0.6710481",
"0.66483057",
"0.6619441",
"0.65985656",
"0.65862286",
"0.65642035",
"0.65505075",
"0.6524466",
"0.6453418",
"0.6429767",
"0.6419238",
"0.6400692... | 0.8128636 | 0 |
Build an AdamW optimizer node. | def build(
self,
learning_rate_name: str,
step_name: str,
parameter_sequence_name: str,
gradient_sequence_name: str,
first_order_moment_sequence_name: str,
second_order_moment_sequence_name: str,
) -> str:
input_names = [
learning_rate_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n weight_decay,\n learning_rate=0.001,\n beta1=0.9,\n beta2=0.999,\n epsilon=1e-8,\n use_locking=False,\n name=\"AdamW\"):\n super(AdamWOptimizer, self).__init__(\n weight_decay,\n ... | [
"0.7222205",
"0.72050107",
"0.69759667",
"0.67298216",
"0.6584739",
"0.6543308",
"0.6527754",
"0.6491731",
"0.64646107",
"0.6461995",
"0.64614755",
"0.6443046",
"0.6430021",
"0.6418884",
"0.63456553",
"0.62928075",
"0.62825435",
"0.62640226",
"0.6263111",
"0.6214589",
"0.6198... | 0.6982835 | 2 |
Adds gaussian noise to a random subset of the given voxels. Clips values outside of the volume dimensions. | def noise(voxels, volume_dim, voxel_dim, protein_noise):
ab_std = 100.0 / np.array(voxel_dim)#200 nm seems to work well as std
gaussian = np.stack([np.random.normal(0, std, len(voxels)) for std in ab_std], axis=-1)
#Get random subset
non_noisy = int((1 - protein_noise) * len(voxels))
indices = np.ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_gaussian(m, v, repeat=1):\n if repeat > 1:\n v = v.squeeze()\n m = m.squeeze()\n sqrt_v = torch.cat([torch.sqrt(v)] * repeat, dim=0)\n m = torch.cat([m] * repeat, dim=0)\n else:\n sqrt_v = torch.sqrt(v)\n sample = m + torch.randn_like(sqrt_v) * sqrt_v\n ret... | [
"0.610539",
"0.59879637",
"0.58795106",
"0.5850977",
"0.5737938",
"0.57358915",
"0.57196695",
"0.56809366",
"0.5657817",
"0.56015205",
"0.5588407",
"0.55810636",
"0.5562998",
"0.5554184",
"0.55477196",
"0.55425054",
"0.5522562",
"0.55094403",
"0.54983723",
"0.54838973",
"0.54... | 0.7876331 | 0 |
Velocity in 3D space used for doppler. | def velocity(self):
return self._vel.to_list() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def velocity(self) -> np.ndarray:\n return self._state[3:5]",
"def getVelocity(self):\n return self.v",
"def vel(z, c = cp.cc.c_light_cm_s/1e5):\n # return z*c/(1+z)\n return c*((1+z)**2-1)/((1+z)**2+1)",
"def target_velocity(self, time):\n\n x_v = self.w*self.r*cos(self.w*time)\n ... | [
"0.6861428",
"0.66182065",
"0.65697485",
"0.65602016",
"0.6557046",
"0.6557046",
"0.6553394",
"0.6501147",
"0.6473816",
"0.6452121",
"0.64247364",
"0.6423634",
"0.6391132",
"0.6353622",
"0.6282447",
"0.6279429",
"0.6248403",
"0.6230474",
"0.62102526",
"0.618034",
"0.6167987",... | 0.6441926 | 10 |
The number of currently playing channels. | def channels_playing(self):
channels = c_int()
real = c_int()
ckresult(
_dll.FMOD_System_GetChannelsPlaying(self._ptr, byref(channels), byref(real))
)
return so(channels=channels.value, real_channels=real.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_channels(self):\n return len(self.channels)",
"def get_num_channels():\r\n check_mixer()\r\n return sdl.Mix_GroupCount(-1)",
"def n_channels(self):\n return self._n_channels",
"def channels(self) -> int:\n return len(self._channel_arrays)",
"def num_of_channels(self) -> int... | [
"0.83439845",
"0.8337465",
"0.8038289",
"0.80186456",
"0.79859024",
"0.79620993",
"0.7881973",
"0.7839828",
"0.7814055",
"0.78106886",
"0.77545315",
"0.7474994",
"0.7359621",
"0.7263346",
"0.6984194",
"0.6930139",
"0.6926109",
"0.6909449",
"0.6778121",
"0.6760461",
"0.675171"... | 0.6547628 | 34 |
The master ChannelGroup that all sounds ultimately route to. This is the default Channel Group that channels play on, unless a | def master_channel_group(self):
grp_ptr = c_void_p()
ckresult(_dll.FMOD_System_GetMasterChannelGroup(self._ptr, byref(grp_ptr)))
return get_class("ChannelGroup")(grp_ptr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def master_sound_group(self):\n grp_ptr = c_void_p()\n ckresult(_dll.FMOD_System_GetMasterSoundGroup(self._ptr, byref(grp_ptr)))\n return get_class(\"SoundGroup\")(grp_ptr)",
"def default_channel(self) -> int:\r\n ...",
"def single_channel():\n return True",
"def websocket_... | [
"0.75266814",
"0.60029924",
"0.57577604",
"0.55957776",
"0.5544824",
"0.5542121",
"0.5469739",
"0.5450687",
"0.54342544",
"0.54098696",
"0.53655285",
"0.53155196",
"0.53155196",
"0.53089744",
"0.53086746",
"0.5306724",
"0.52973247",
"0.5283985",
"0.526384",
"0.52495915",
"0.5... | 0.6999373 | 1 |
The URL of the proxy server used in Internet streaming. | def network_proxy(self):
server = create_string_buffer(256)
ckresult(
_dll.FMOD_System_GetNetworkProxy(self._ptr, byref(server), sizeof(server))
)
return server.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy_url(self):\n return self.__proxy_url",
"def proxy_url(self) -> str:\n return pulumi.get(self, \"proxy_url\")",
"def server_url(self):\n return self._session_coords.server_url",
"def myproxy_server(self):\n return self.__get_option('myproxy_server')",
"def server_url(se... | [
"0.8380048",
"0.83326226",
"0.7561614",
"0.74811375",
"0.74152505",
"0.74136806",
"0.73972946",
"0.73380685",
"0.72750473",
"0.7082336",
"0.69739366",
"0.695092",
"0.6934335",
"0.6880741",
"0.68484557",
"0.6841016",
"0.6841016",
"0.68294644",
"0.6816813",
"0.6732246",
"0.6683... | 0.0 | -1 |
The type of output interface used to run the mixer. | def output(self):
output = c_int()
ckresult(_dll.FMOD_System_GetOutput(self._ptr, byref(output)))
return OUTPUTTYPE(output.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_output_type(self):\n return self.__output_type",
"def _get_output_type(self):\n return self.__output_type",
"def _get_output_type(self):\n return self.__output_type",
"def _get_output_type(self):\n return self.__output_type",
"def _get_output_type(self):\n return self.__output_type"... | [
"0.7541918",
"0.7541918",
"0.7541918",
"0.7541918",
"0.7541918",
"0.7541918",
"0.7338003",
"0.6670487",
"0.658095",
"0.634959",
"0.6344547",
"0.63106906",
"0.6306722",
"0.6306722",
"0.6306722",
"0.6306722",
"0.6306722",
"0.6306722",
"0.6306722",
"0.6306722",
"0.6306722",
"0... | 0.559519 | 88 |
Retrieve the state of the FMOD recording API, ie if it is currently recording or not. | def is_recording(self, aaidee):
rec = c_int()
ckresult(_dll.FMOD_System_IsRecording(self._ptr, aaidee, byref(rec)))
return rec.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recording_status(self):\n return self._get('recording/status')",
"def state(self):\n return self._camera_data[\"recording_mode\"]",
"def recording(self) -> bool:\n\t\treturn self._raw_result['data']['recording']",
"def is_recording(self):\n return self._isrecording",
"def is_record... | [
"0.7727075",
"0.76155037",
"0.72715783",
"0.7142921",
"0.687966",
"0.6740921",
"0.66854143",
"0.64372754",
"0.64308774",
"0.6141246",
"0.5973937",
"0.5953596",
"0.5944144",
"0.5893034",
"0.58516556",
"0.58326066",
"0.57849574",
"0.57661974",
"0.573782",
"0.56939715",
"0.56788... | 0.6894106 | 4 |
Suspend mixer thread and relinquish usage of audio hardware while maintaining internal state. Used on mobile platforms when entering a backgrounded state to reduce CPU to 0%. All internal state will be maintained, i.e. created sound and channels will stay available in memory. | def mixer_suspend(self):
self._call_fmod("FMOD_System_MixerSuspend") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mixer_resume(self):\n self._call_fmod(\"FMOD_System_MixerResume\")",
"def suspend(self):\n self.__running = False",
"def disable_sound(self):\n\t\tif self.emitter['bgsound'] is not None:\n\t\t\tself.emitter['bgsound'].reset()\n\t\tif self.emitter['effects'] is not None:\n\t\t\tself.emitter['e... | [
"0.7054266",
"0.6506459",
"0.59882206",
"0.59818023",
"0.59224737",
"0.5898169",
"0.5876753",
"0.58206475",
"0.5810799",
"0.5803971",
"0.58021027",
"0.57869714",
"0.5760213",
"0.5745438",
"0.5742228",
"0.5722707",
"0.57144904",
"0.56822395",
"0.5629916",
"0.55521995",
"0.5550... | 0.8073767 | 0 |
Set each parameter buffer to the empty string. We create one more then our number because the xml scrapers use a 1 based array. | def clear_buffers(self):
self.m_param = ["" for x in range(self.NUM_BUFFERS + 1)]
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_parameters(self):\n self.parameters = []",
"def reset() -> None:\n Parameter.by_name = {}",
"def reset_parameters(self):\n for item in self.components.values():\n try:\n item.reset_parameters()\n except:\n pass",
"def clear(s... | [
"0.5738879",
"0.5540667",
"0.5492866",
"0.5412853",
"0.5338835",
"0.532717",
"0.5295993",
"0.52698076",
"0.52567196",
"0.5235577",
"0.5229119",
"0.5217787",
"0.51719695",
"0.5167302",
"0.51555645",
"0.5148673",
"0.5145352",
"0.5144697",
"0.5144697",
"0.5142247",
"0.51322615",... | 0.70046544 | 0 |
Return the value of the buffer at the given index. | def get_buffer(self, i):
if i not in range(1, self.NUM_BUFFERS + 1):
raise IndexError("Error: Could not get buffer %d. Must be "
"between 1 and 9" % i)
return self.m_param[i] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\n return self.buffer[index]",
"def getvalue(self, index):\n self._checkIndex(index)\n return self._items[index].value",
"def get(self, index):\n\n return self.values[index]",
"def get_value_by_index(self, index):\n return self['value'][index]",
"... | [
"0.7306871",
"0.7211793",
"0.7081612",
"0.7065998",
"0.7003457",
"0.7003457",
"0.7001755",
"0.69249576",
"0.69249576",
"0.6807916",
"0.6782481",
"0.6729516",
"0.6621285",
"0.65906787",
"0.65837234",
"0.6581055",
"0.6540811",
"0.65234315",
"0.6513325",
"0.65093386",
"0.6502319... | 0.6151618 | 62 |
Return the value of the given setting. | def value(self, setting_id):
if setting_id not in self.values:
return False
return self.values[setting_id] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_setting_value(self, title, setting):\r\n return self.parser.get(title, setting)",
"def get_setting(self, setting):\n return self.do_rpc(\"get_setting\", key=key)",
"def getValue(self, valueName):\n\t\treturn self.settings[valueName][0]",
"def get_value(self, instance):\n try:\n ... | [
"0.8710431",
"0.8165221",
"0.7387355",
"0.7361788",
"0.73493135",
"0.73353803",
"0.7213256",
"0.6888208",
"0.68330395",
"0.6755409",
"0.67106783",
"0.66637874",
"0.6599002",
"0.659334",
"0.65619045",
"0.65163887",
"0.64650804",
"0.64539284",
"0.6437209",
"0.64337283",
"0.6427... | 0.8045801 | 2 |
XXX another C++ function to trivially replace in Python returns the contents of the given file name as a string. | def read_file(self, file_name):
f = file(file_name, "r")
temp = f.read()
f.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_with_file_contents(fname):\n try:\n with open(os.path.expanduser(fname[0])) as source_file:\n result = source_file.read()\n except IOError:\n result = '< %s' % fname[0] # wasn't a file after all\n\n # TODO: IF pyparsing input parser logic gets fixed to support empty f... | [
"0.7040104",
"0.7009342",
"0.6590161",
"0.63753575",
"0.6346448",
"0.63049203",
"0.62630165",
"0.61881137",
"0.61391693",
"0.6120307",
"0.607243",
"0.6045624",
"0.6021109",
"0.6021109",
"0.599926",
"0.5915343",
"0.5868113",
"0.58678675",
"0.58024794",
"0.57847786",
"0.578003"... | 0.0 | -1 |
Augment the episode object with the finer details for it. It returns the episode object that we update. | def get_episode_details(self, episode):
url_data = episode.url.get()
# XXX Maybe we should just not return a list because we only use
# the first element.
#
if hasattr(url_data, '__iter__'):
url_data = url_data[0]
self.parser.set_buffer(1, url_data)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_episode(self, ep):\n #make da season\n ses = self._add_season(ep)\n dvdses = self._add_season(ep, dvd=True) \n self._add_episode(ep, ses)\n self._add_episode(ep, dvdses, dvd=True)",
"def get_episode(self, object_id):\n return self.get_object(\"episode\", o... | [
"0.66720575",
"0.66536885",
"0.64521825",
"0.613309",
"0.61237514",
"0.5915047",
"0.5808988",
"0.5766944",
"0.57404846",
"0.5734884",
"0.5713883",
"0.56592155",
"0.564594",
"0.5644749",
"0.5623442",
"0.5585618",
"0.55489135",
"0.5462838",
"0.5462575",
"0.5455837",
"0.5452271"... | 0.6632789 | 2 |
we return a list of Episode objects with their basic information filled in. | def get_episode_list(self, show):
# If the show has no episode guide url's, then there is nothing
# we can fetch..
#
if len(show.episode_guide_urls) == 0:
return []
episode_list = []
for url in show.episode_guide_urls:
self.logger.debug("get_epi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_episodes(self):\n return [series_episode for series_episode in SeriesEpisode.objects.filter(series=self)]",
"def episodes(self):\n for episode in self._root.iter('Episode'):\n entry = {}\n entry['season'] = int(episode.find('SeasonNumber').text)\n entry['ep... | [
"0.7616807",
"0.7316746",
"0.7273106",
"0.7102436",
"0.7064641",
"0.70478183",
"0.6988455",
"0.6969651",
"0.65611434",
"0.6425187",
"0.6329865",
"0.63154775",
"0.6302936",
"0.6284604",
"0.6260817",
"0.625828",
"0.62494147",
"0.62304825",
"0.6199332",
"0.61754",
"0.61321557",
... | 0.7140959 | 3 |
Finds distances of pts to y axis in 2D. Includes positive and negative signs. | def get_distances_to_y(pts):
y_axis = np.array([0,1])
num_pts = pts.shape[0]
distances = np.linalg.norm(pts - np.tile(y_axis, [num_pts, 1]), axis=1)
# discriminate between left and right side points since norm always returns
# positive distances .
signs = np.zeros((pts.shape[0],1))
for i, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dist_points(x,y):\n\n return abs(x[0]-y[0]) + abs(x[1]-y[1])",
"def distances_to_axis(endo_epi_pts, P1, P2, numSamples):\n # find rotation matrix that rotates from axis to y-axis\n axis = P1 - P2\n R = build_rotation_matrix(np.array([0,1]), axis)\n\n # apply rotation matrix (rotate to y axis)\... | [
"0.70587456",
"0.6744771",
"0.6630119",
"0.6604648",
"0.6461151",
"0.62484676",
"0.6231397",
"0.6224635",
"0.6216248",
"0.6170713",
"0.60452324",
"0.60411507",
"0.603682",
"0.6034862",
"0.60315603",
"0.60109437",
"0.6010932",
"0.5995506",
"0.59876275",
"0.5984581",
"0.5982215... | 0.8529984 | 0 |
Returns vtk line actor from numpy array pts. | def get_line_actor(pts, lw, color):
vtk_points = vtk.vtkPoints()
num_points = int(pts.shape[0]/2)
for pt in pts:
vtk_points.InsertNextPoint(pt)
lineArray = vtk.vtkCellArray()
for i in range(num_points):
line = vtk.vtkLine()
line.GetPointIds().SetId(0, i + i)
line... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line(points):\n return LineString(points)",
"def project_points_line(points, line):\n return [project_point_line(point, line) for point in points]",
"def __getitem__(self, *args):\n return _itkLineSpatialObjectPointPython.vectoritkLineSpatialObjectPoint3___getitem__(self, *args)",
"def __get... | [
"0.6503914",
"0.5874125",
"0.58599246",
"0.5733451",
"0.565335",
"0.5649078",
"0.5624995",
"0.5575697",
"0.55217576",
"0.5518915",
"0.5518862",
"0.54764694",
"0.5427476",
"0.5413464",
"0.53968054",
"0.53817827",
"0.53473705",
"0.53456235",
"0.5334599",
"0.53252035",
"0.529905... | 0.8130699 | 0 |
p, n = planeFit(points) Given an array, points, of shape (d,...) representing points in ddimensional space, fit an ddimensional plane to the points. Return a point, p, on the plane (the pointcloud centroid), and the normal, n. | def planeFit(points):
import numpy as np
from numpy.linalg import svd
points = np.reshape(points, (np.shape(points)[0], -1)) # Collapse trialing dimensions
assert points.shape[0] <= points.shape[1], "There are only {} points in {} dimensions.".format(points.shape[1], points.shape[0])
ctr = points.me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plane_fit(points):\n import numpy as np\n from numpy.linalg import svd\n\n points = np.reshape(\n points, (np.shape(points)[0], -1)\n ) # Collapse trialing dimensions\n assert (\n points.shape[0] <= points.shape[1]\n ), \"There are only {} points in {} dimensions.\".format(\n ... | [
"0.7457618",
"0.74260825",
"0.73493075",
"0.7333222",
"0.714758",
"0.6993397",
"0.6729394",
"0.6729394",
"0.6547002",
"0.6473493",
"0.6442118",
"0.6406759",
"0.6359698",
"0.63286614",
"0.62663555",
"0.62663555",
"0.6260767",
"0.61530703",
"0.6120936",
"0.6111161",
"0.609798",... | 0.74829066 | 0 |
Builds rotation matrix to rotate from global coordinate system x,y,z to local coord. system Returns transform vtk object to apply directly to actors | def get_vtktransform_rotate_global_to_local(v1, v2, v3):
x = np.array([1.0, 0.0, 0.0])
y = np.array([0.0, 1.0, 0.0])
z = np.array([0.0, 0.0, 1.0])
rot_mat = np.zeros((3, 3), dtype=float)
rot_mat[0, 0] = np.dot(v1, x)
rot_mat[0, 1] = np.dot(v1, y)
rot_mat[0, 2] = np.dot(v1, z)
rot_mat[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rot_world_space_to_local_space(m_obj, parent_m_obj):\n obj_world_mat = get_world_matrix(m_obj, 0)\n parent_inv_mat = get_world_inv_matrix(parent_m_obj, 0)\n\n local_space_mat = obj_world_mat * parent_inv_mat\n trans_matrix = oMa.MTransformationMatrix(local_space_mat)\n rot = trans_matrix.rotatio... | [
"0.64995134",
"0.64721566",
"0.63985884",
"0.635516",
"0.6326769",
"0.63116187",
"0.6227723",
"0.61180836",
"0.6054638",
"0.6054165",
"0.59675074",
"0.5959701",
"0.5953531",
"0.59484804",
"0.5929387",
"0.58985746",
"0.58823603",
"0.5855618",
"0.5835479",
"0.58333147",
"0.5833... | 0.70436144 | 0 |
Transitional function to handle all basic cases which we care about, in both Python 2 and 3, with both old and newstyle classes. Return True if the passed object is an instance of a class, else False. | def _isinstancetype(an_obj):
if an_obj is None: return False
if not PY3K:
return isinstance(an_obj, types.InstanceType)
typstr = str(type(an_obj))
# the following logic works, as PyRAF users expect, in both v2 and v3
return typstr=="<type 'instance'>" or \
(typstr.startswith("<cla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isclassinstance(object):\n if not hasattr(object, \"__class__\"):\n return False\n if isbuiltin(object.__class__):\n return False\n return True",
"def isclass(object):\r\n return isinstance(object, (type, types.ClassType))",
"def isclass(object):\n if not inspect.isclass(object... | [
"0.8303007",
"0.8186702",
"0.79424715",
"0.7894258",
"0.7894258",
"0.7881362",
"0.78795606",
"0.78322834",
"0.78322834",
"0.78322834",
"0.78322834",
"0.78322834",
"0.78322834",
"0.78244984",
"0.7818395",
"0.78174865",
"0.77855253",
"0.7761112",
"0.7747289",
"0.7725101",
"0.76... | 0.6964354 | 56 |
Assumes examples a nonempty list of Examples | def __init__(self, examples):
self.examples = examples
self.centroid = self.computeCentroid() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instantiate_examples(self, examples : [dict]) -> [dict]:\n raise NotImplementedError()",
"def create_examples(topics, sentences):\n input_examples = []\n \n for i in range(len(sentences)):\n input_examples.append(InputExample(text_a=topics[i], text_b=sentences[i], label='NoArgument'))\... | [
"0.71452624",
"0.6745725",
"0.6573195",
"0.643607",
"0.63873005",
"0.63228357",
"0.6085012",
"0.6057851",
"0.6049169",
"0.60010225",
"0.599418",
"0.5988481",
"0.59850174",
"0.5977241",
"0.5965003",
"0.5962252",
"0.59565073",
"0.594164",
"0.5935418",
"0.59295714",
"0.591907",
... | 0.0 | -1 |
Recursively gathers the shape of a nested list/tuple/dictionary of tensors as a list. | def get_shape(data):
def _get_shape(tensor):
return list(tensor.shape)
return recursively_apply(_get_shape, data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nested_list_size(inputs: Sequence[Any]) -> List[int]:\n if hasattr(inputs, \"tensors\"):\n return nested_list_size(inputs.tensors) # type: ignore\n if isinstance(inputs[0], dict):\n return nested_list_size(list(inputs[0].items()))\n if hasattr(inp... | [
"0.7247843",
"0.6855187",
"0.6834664",
"0.6804381",
"0.67804986",
"0.6755712",
"0.664125",
"0.66229486",
"0.66229486",
"0.6619679",
"0.6610411",
"0.6530387",
"0.6510876",
"0.65086836",
"0.65086836",
"0.6472076",
"0.64715195",
"0.64264685",
"0.64261806",
"0.64224535",
"0.63905... | 0.73074514 | 0 |
Recursively broadcast tensor in a nested list/tuple/dictionary of tensors to all devices. | def broadcast(tensor, from_process: int = 0):
if PartialState().distributed_type == DistributedType.TPU:
return _tpu_broadcast(tensor, src=from_process, name="accelerate.utils.broadcast")
elif PartialState().distributed_type in TORCH_DISTRIBUTED_OPERATION_TYPES:
return _gpu_broadcast(tensor, src... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_flattened_call_all(tensors, call):\n\n grouped_tensors = _group_by_tensor_type(tensors)\n for tensors in grouped_tensors.values():\n apply_flattened_call(tensors, call)",
"def _recursive_to_cuda(self, tensors: Union[Tuple[torch.Tensor], torch.Tensor]) \\\n -> Union[List[torch.Te... | [
"0.61313075",
"0.5747809",
"0.56867903",
"0.56478876",
"0.5644746",
"0.5510629",
"0.5479311",
"0.5434796",
"0.54284805",
"0.5386407",
"0.53714013",
"0.5368276",
"0.5346373",
"0.5340158",
"0.52826554",
"0.5262477",
"0.5256271",
"0.52503264",
"0.51660895",
"0.50993204",
"0.5078... | 0.46760324 | 51 |
Recursively concatenate the tensors in a nested list/tuple/dictionary of lists of tensors with the same shape. | def concatenate(data, dim=0):
if isinstance(data[0], (tuple, list)):
return honor_type(data[0], (concatenate([d[i] for d in data], dim=dim) for i in range(len(data[0]))))
elif isinstance(data[0], Mapping):
return type(data[0])({k: concatenate([d[k] for d in data], dim=dim) for k in data[0].keys(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate(tensors, axis=0):\n raise NotImplementedError",
"def concatenate(tensor_list, axis=0):\r\n # Check someone did not make the common mistake to do something like:\r\n # c = concatenate(x, y)\r\n # instead of\r\n # c = concatenate((x, y))\r\n if not isinstance(tensor_list, ... | [
"0.64532864",
"0.62484604",
"0.6240688",
"0.62098867",
"0.6202019",
"0.6148422",
"0.6148422",
"0.6134743",
"0.6126645",
"0.60264784",
"0.5921134",
"0.5845148",
"0.58356786",
"0.5813004",
"0.5810158",
"0.5797379",
"0.5709058",
"0.5642084",
"0.5592208",
"0.55727965",
"0.5473249... | 0.7078153 | 0 |
Recursively pad the tensors in a nested list/tuple/dictionary of tensors from all devices to the same size so they can safely be gathered. | def pad_across_processes(tensor, dim=0, pad_index=0, pad_first=False):
def _pad_across_processes(tensor, dim=0, pad_index=0, pad_first=False):
if dim >= len(tensor.shape):
return tensor
# Gather all sizes
size = torch.tensor(tensor.shape, device=tensor.device)[None]
siz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collate_pad_tensors(sample_list, pad_dim=0, pad_element=0):\n\n data_list = [d[0] for d in sample_list]\n label_list = [d[1] for d in sample_list]\n\n padded_data, lengths = pad_tensor_list(data_list, pad_dim, pad_element)\n\n return padded_data, lengths, torch.tensor(label_list)",
"def pad_and_c... | [
"0.64855236",
"0.6473482",
"0.6356846",
"0.62943286",
"0.6204135",
"0.61895996",
"0.61525124",
"0.59987724",
"0.5868541",
"0.586404",
"0.58514893",
"0.5816693",
"0.5783271",
"0.57756007",
"0.5763096",
"0.5729326",
"0.5726566",
"0.5650949",
"0.5650337",
"0.5646497",
"0.5639607... | 0.59294546 | 8 |
Finds the device on which a nested dict/list/tuple of tensors lies (assuming they are all on the same device). | def find_device(data):
if isinstance(data, Mapping):
for obj in data.values():
device = find_device(obj)
if device is not None:
return device
elif isinstance(data, (tuple, list)):
for obj in data:
device = find_device(obj)
if device... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device(self):\n return self._tensor.device",
"def get_device_of(tensor: torch.Tensor) -> int:\n if not tensor.is_cuda:\n return -1\n else:\n return tensor.get_device()",
"def get_device_of(self, tensor):\n if not tensor.is_cuda:\n return -1\n else:\n ... | [
"0.6362982",
"0.6313566",
"0.6219945",
"0.6212367",
"0.61497587",
"0.5939698",
"0.59257096",
"0.5886158",
"0.588394",
"0.57484937",
"0.57484937",
"0.57484937",
"0.57484937",
"0.57484937",
"0.5638733",
"0.5631637",
"0.56248826",
"0.5601376",
"0.5566792",
"0.5553158",
"0.551270... | 0.7836011 | 0 |
Return randomly cards to press or to drop. | def analysis(self, game_info):
available_cards_indices = []
for card_index in range(len(game_info['cards'])):
card = game_info['cards'][card_index]
cost_color, cost_value = card.get_cost()
if cost_value == 99:
return game_info['cards'][card_index], TO_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deal_card():\r\n cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]\r\n return (random.choice(cards))",
"def deal_card():\n cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]\n card = random.choice(cards)\n return card",
"def deal_card():\n cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1... | [
"0.7178616",
"0.70500433",
"0.6991288",
"0.6882847",
"0.67704254",
"0.66787887",
"0.6672548",
"0.66407263",
"0.66361135",
"0.6628324",
"0.65803224",
"0.6529814",
"0.6520453",
"0.6496503",
"0.64851326",
"0.6476854",
"0.64534616",
"0.6416093",
"0.6400513",
"0.63634586",
"0.6362... | 0.0 | -1 |
Visualize sidebyside an input image, the groundtruth mask and the prediction mask | def display_sample(display_list):
fig, axs = plt.subplots(1, len(display_list), figsize=(18, 18))
title = ['Input Image', 'True Mask', 'Predicted Mask']
for i in range(len(display_list)):
axs[i].set_title(title[i])
axs[i].imshow(tf.keras.preprocessing.image.array_to_img(display_list[i]))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_mask(i):\n ### To display binary masks, comment the folowing line\n # mask = np.argmax(testing_preds[i], axis=-1)\n ### To display probability maps, comment the folowing line\n mask = testing_preds[i,:,:,-1]\n mask = np.expand_dims(mask, axis=-1)\n img = PIL.Im... | [
"0.7171241",
"0.6965059",
"0.6795373",
"0.67824084",
"0.67269754",
"0.67233986",
"0.67086816",
"0.6630343",
"0.6546933",
"0.65399617",
"0.6529946",
"0.6450134",
"0.64173585",
"0.6327209",
"0.6318769",
"0.6300677",
"0.62338173",
"0.6162926",
"0.61628157",
"0.6161012",
"0.61005... | 0.5689519 | 62 |
>>> sanitize_filename("blue_grenade.png") ... blue_grenade_png | def sanitize_filename(file_path: str) -> str:
file_name = file_path.lower().replace(" ", "_").replace(".", "_")
file_name = "".join(
[
i if i in (string.ascii_letters + string.digits + "_") else ""
for i in file_name
]
)
return file_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_filename(filename):\n sanitized_filename = re.sub(r'[/\\\\:*?\"<>|]', '-', filename)\n sanitized_filename = sanitized_filename.replace('&', 'and')\n sanitized_filename = sanitized_filename.replace('\"', '')\n sanitized_filename = sanitized_filename.replace(\"'\", '')\n sanitized_filenam... | [
"0.76244116",
"0.7447786",
"0.73769057",
"0.7343912",
"0.72821826",
"0.7194061",
"0.71838367",
"0.7171428",
"0.71387476",
"0.71387476",
"0.7066849",
"0.70021117",
"0.6984457",
"0.69688344",
"0.69648814",
"0.6952601",
"0.6922187",
"0.6881285",
"0.6749883",
"0.6690138",
"0.6641... | 0.6949772 | 16 |
Yield successive nsized chunks from l. | def chunk(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7480959 | 31 |
Returns XYZ world coordinates of all bounding box corners of each object in objs. Params | def bbox_world_coordinates(*objs, depsgraph=None):
# To be on the safe side, we use the evaluated object after
# all modifiers etc. applied (done internally by bmesh)
dg = depsgraph or bpy.context.evaluated_depsgraph_get()
xyz = []
for obj in objs:
eval_obj = obj.evaluated_get(dg)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_bounding_boxes(self, scene):\n objs = scene[\"objects\"]\n rotation = scene[\"directions\"][\"right\"]\n\n xmin = []\n ymin = []\n xmax = []\n ymax = []\n\n for i, obj in enumerate(objs):\n [x, y, z] = obj[\"pixel_coords\"]\n\n [x1,... | [
"0.69030964",
"0.67822844",
"0.6638733",
"0.6475892",
"0.63679373",
"0.6184192",
"0.61332715",
"0.6038426",
"0.6036592",
"0.5986366",
"0.5985018",
"0.5966567",
"0.5950749",
"0.5882461",
"0.58651304",
"0.5845382",
"0.58382976",
"0.5833107",
"0.5796534",
"0.5791737",
"0.5770221... | 0.765541 | 0 |
Returns the mean classification accuracy for a batch of predictions. | def accuracy(self, predictions, truth):
return np.mean(np.argmax(predictions, axis=1) == truth) # <COGLINE> | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(labels, predictions, n_classes):\n\t\tequality = tf.equal(x = predictions, y = labels) # match the type of labels\n\t\treturn tf.reduce_mean(tf.cast(equality, tf.float32))",
"def compute_accuracy(self):\n if not self.is_training:\n logits = self.test_logits\n labels = self.data.test_la... | [
"0.82042474",
"0.80378073",
"0.7869719",
"0.7827168",
"0.7827168",
"0.7724348",
"0.7707755",
"0.7579729",
"0.7577609",
"0.7537667",
"0.7528489",
"0.75190234",
"0.75152487",
"0.7482457",
"0.7482238",
"0.7470171",
"0.7454156",
"0.74286866",
"0.7406115",
"0.73917204",
"0.7372701... | 0.76073426 | 7 |
Loads the weights from the trained model | def load_weights(self, weights):
weight = np.load(weights)
return weight | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_model_weights(self):\n raise NotImplementedError",
"def load_model(self):\n saved_path = self.config.path_tmp / self.model.model_name\n if saved_path.exists():\n self.model.load_weights(str(saved_path / 'model.vec'))",
"def load_model_weights(self, filename):\n s... | [
"0.8640362",
"0.78923076",
"0.7863533",
"0.78617215",
"0.7817007",
"0.7804112",
"0.77841645",
"0.7755443",
"0.7668582",
"0.7651668",
"0.7644608",
"0.76411474",
"0.76099044",
"0.758565",
"0.7574081",
"0.7567805",
"0.75566477",
"0.7535257",
"0.7534928",
"0.74842966",
"0.7364875... | 0.7098279 | 42 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.