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 |
|---|---|---|---|---|---|---|
Performs a timestep on the atomistic scale using system.universe object as the starting state. This entails vacuum minimizing, optionally solvating and solvent minimizing, equilibriating and finally running a series of MD runs to populate the cg_positions, cg_forces and cg_velocities state variables, and saving these v... | def atomistic_step(self):
# first minimize in vacuum, in either case,
# fixes problems with langevin bond deformation.
self.system.minimize()
if self.system.should_solvate:
with self.system.solvate() as sol:
with self.system.minimize(**sol) as mn:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_compute_timestep(self):\n\n myg = self.cc_data.grid\n\n cfl = self.rp.get_param(\"driver.cfl\")\n\n u = self.cc_data.get_var(\"x-velocity\")\n v = self.cc_data.get_var(\"y-velocity\")\n\n # the timestep is min(dx/|u|, dy|v|)\n xtmp = ytmp = 1.e33\n if not... | [
"0.6524394",
"0.6177675",
"0.61612016",
"0.59929496",
"0.5893698",
"0.5711051",
"0.5592193",
"0.5578783",
"0.5563007",
"0.55499583",
"0.55368036",
"0.5519254",
"0.5504861",
"0.5496873",
"0.54738367",
"0.5467854",
"0.5459295",
"0.54552984",
"0.54397774",
"0.54131395",
"0.53856... | 0.6680126 | 0 |
Decay learning rate by a factor of lr_decay every step epochs. | def lr_scheduler(optimizer, lr_decay=0.001, epoch=None, step=1):
if epoch is None or step == 1 or (epoch+1) % step == 0:
for param_group in optimizer.param_groups:
param_group['lr'] *= (1 - lr_decay)
return optimizer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step_decay(epoch):\n # initial_lrate = 1.0 # no longer needed\n #drop = 0.5\n #epochs_drop = number_epoch_drop\n #lrate = init_lr * math.pow(drop,\n #math.floor((1+epoch)/epochs_drop))\n lr = learning_rate\n if epoch >= 60:\n lr *= 1e-1\n print('Learning rate: ', lr)\n return ... | [
"0.8268444",
"0.8110469",
"0.80804604",
"0.7932867",
"0.78039527",
"0.7719412",
"0.7653398",
"0.7647185",
"0.7631224",
"0.7625286",
"0.75756466",
"0.7503117",
"0.7487916",
"0.74777293",
"0.7445169",
"0.7444742",
"0.74153996",
"0.7367138",
"0.73505414",
"0.7338876",
"0.7312451... | 0.70049274 | 55 |
Given list (haystack), return index (0based) of needle in the list. Return None if needle is not in haystack. Do this with recursion. You MAY NOT USE A `for` OR `while` LOOP. >>> recursive_index("hey", ["hey", "there", "you"]) 0 >>> recursive_index("you", ["hey", "there", "you"]) 2 >>> recursive_index("porcupine", ["he... | def recursive_index(needle, haystack):
def _recursive_index(needle, haystack, idx):
if idx == len(haystack):
return None
if haystack[idx] == needle:
return idx
return _recursive_index(needle, haystack, idx + 1)
return _recursive_index(needle, haystack, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sublist_index(haystack, needle):\n try:\n for i in xrange(len(haystack)):\n if haystack[i:i+len(needle)] == needle:\n return i\n except IndexError:\n pass\n raise ValueError",
"def recursive_search(needle, haystack, idx=0):\n\t# def _recursive_haystack(needle,... | [
"0.79988295",
"0.798666",
"0.6921343",
"0.685409",
"0.67765623",
"0.66359234",
"0.660139",
"0.6568466",
"0.6548577",
"0.65209126",
"0.65097624",
"0.64091104",
"0.6402255",
"0.6356822",
"0.635582",
"0.6350336",
"0.634753",
"0.6303125",
"0.6276631",
"0.6260524",
"0.62434167",
... | 0.84310704 | 0 |
Get all service environment variables by application. | def get_all(self, app_id):
# TODO: pine client for python
raw_query = '$expand=service&$filter=service/any(a:a/application%20eq%20{app_id})'.format(app_id=app_id)
return self.base_request.request(
'service_environment_variable', 'GET', raw_query=raw_query,
endpoint=self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_env_vars():\n env_vars = []\n leapp_vars = {k: v for (k, v) in os.environ.items() if k.startswith('LEAPP_') and k not in ENV_IGNORE}\n for k, v in leapp_vars.items():\n if k in ENV_MAPPING:\n env_vars.append(EnvVar(name=ENV_MAPPING.get(k), value=v))\n continue\n ... | [
"0.7233255",
"0.7197941",
"0.7095429",
"0.70275605",
"0.6895473",
"0.6891972",
"0.68501776",
"0.681335",
"0.67990285",
"0.6788304",
"0.6781381",
"0.6687076",
"0.66203666",
"0.6556492",
"0.6516397",
"0.64852554",
"0.64672554",
"0.6442972",
"0.64406425",
"0.64251894",
"0.642518... | 0.7795718 | 0 |
Helper to get index of sep symbol | def sep(self):
return self.sep_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sep_token(self):\r\n if self._sep_token is None:\r\n logger.error(\"Using sep_token, but it is not set yet.\")\r\n return self._sep_token",
"def bert_segment(tokenized_text):\n segment1 = [1 if token==\"[SEP]\" else 0 for token in tokenized_text]\n \n try:\n index_sep... | [
"0.6764064",
"0.6350212",
"0.6325993",
"0.6168787",
"0.6099411",
"0.60260916",
"0.60068893",
"0.595629",
"0.5856122",
"0.5838009",
"0.5816947",
"0.5810747",
"0.5802137",
"0.5796213",
"0.5729994",
"0.57297814",
"0.5729535",
"0.5718788",
"0.5706098",
"0.5674636",
"0.5607406",
... | 0.8004647 | 0 |
Basic function to download CIFAR10 dataset and parse it. Files are located in the internet. | def load_cifar10(data_path=".", test_size=0.2, random_state=1337):
test_path = os.path.join(data_path, "cifar-10-batches-py/test_batch")
train_paths = [os.path.join(data_path, "cifar-10-batches-py/data_batch_%i" % i) for i in range(1, 6)]
if not os.path.exists(test_path) or not all(list(map(os.path.exists,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _download_and_extract_cifar10(self):\n # Possibly download the dataset\n if not self.tgz_filename.is_file():\n print(f'Downloading CIFAR-10 dataset from {self.cifar_url}...', flush=True)\n Downloader().download_file(url=self.cifar_url, filename=self.tgz_filename)\n ... | [
"0.7225938",
"0.70100564",
"0.68562204",
"0.66537464",
"0.6459464",
"0.6406101",
"0.6388898",
"0.634119",
"0.63080895",
"0.6149012",
"0.61047465",
"0.6091133",
"0.5970208",
"0.59667355",
"0.59461474",
"0.590009",
"0.58956444",
"0.58836985",
"0.58744717",
"0.58556336",
"0.5838... | 0.5441362 | 72 |
Heap sort using heapify | def sort(items):
heapq.heapify(items)
items[:] = [heapq.heappop(items) for i in range(len(items))] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heap_sort(list):\n pass",
"def heapsort(A):\n \n buildHeap(A)\n for i in range(len(A)-1, 0, -1):\n A[0],A[i] = A[i],A[0]\n heapify(A, 0, i)",
"def heap_sort(self, A):\n pass",
"def heap_sort(self, A):\n pass",
"def heap_sort(arr):\n build_heap(arr)\n for i ... | [
"0.81768864",
"0.7989833",
"0.79545355",
"0.79545355",
"0.7935333",
"0.78901374",
"0.7843837",
"0.78383875",
"0.7795012",
"0.77830267",
"0.7778725",
"0.7778725",
"0.773969",
"0.7656561",
"0.75714934",
"0.755123",
"0.749478",
"0.7491041",
"0.7432164",
"0.7393374",
"0.7367743",... | 0.7449562 | 18 |
Pull comments on a specific post. | def comments(post_id: str, max: int = None):
for comment in client.comments(post_id=post_id, max=max):
print(json.dumps(comment)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_post_comments(post, user_agent=default_user_agent):\n post_permalink = post['permalink']\n\n response_data = requests.get(post_permalink, headers = {'User-agent': user_agent})\n post_data = response_data.json()[1]\n\n # right now this gets the title, eventually convert to unique id for each tit... | [
"0.7233179",
"0.6998926",
"0.6956484",
"0.68746746",
"0.66763055",
"0.6607733",
"0.6580923",
"0.65680546",
"0.65393335",
"0.6500729",
"0.6496682",
"0.6479715",
"0.6412365",
"0.64100033",
"0.63966966",
"0.6383909",
"0.635036",
"0.62818205",
"0.6272724",
"0.62024",
"0.6200088",... | 0.592944 | 31 |
Returns attribute from this resource or one of its ancestors. To prevent inadvertent method or private attribute access, only the optional keywords provided at initialization time are checked. | def __getattr__(self, attr):
for resource in lineage(self):
if attr in resource.__initial_attrs__:
value = self.__dict__[attr] = getattr(resource, attr)
return value
raise AttributeError(
'{!r} object has no attribute {!r}'.format(self, attr)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attr(self, key: str) -> Any:\n raise NotImplementedError(\"This method should be implemented by \"\n \"subclasses.\")",
"def get_attribute(self, lexeme: str) -> typing.Union[Attributes.Attributes]:\n return self._parent_node.get_attribute(lexeme)",
"def get_attr(s... | [
"0.66544986",
"0.65665203",
"0.6552779",
"0.6472262",
"0.64439404",
"0.64439404",
"0.64439404",
"0.6426991",
"0.63021535",
"0.62885743",
"0.62713706",
"0.6270974",
"0.62600195",
"0.6236606",
"0.6231993",
"0.62059987",
"0.62059987",
"0.6179806",
"0.6112755",
"0.6105166",
"0.60... | 0.60573244 | 26 |
Given a channel ID, the user removed as a member of this channel. | def channel_leave(token, channel_id):
auth_u_id = get_id_from_token(token)
channel = channels.get(channel_id)
if channel is None:
raise ValueError("channel does not exist")
if auth_u_id not in channel["all_members"]:
raise AccessError("Authorised user is not a member of the channel.")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channel_removeowner(token, channel_id, u_id):\n # Check if token is valid and raise AccessError if not\n curr_id = database.get_current_user(token)\n # gets current channel data\n curr_channel = database.get_channel_data(channel_id)\n # gets the permissions of current user from database\n use... | [
"0.7185566",
"0.7099654",
"0.6912234",
"0.6865133",
"0.6823768",
"0.67293745",
"0.65886575",
"0.6554098",
"0.6551014",
"0.65179527",
"0.64971566",
"0.64941543",
"0.6443602",
"0.63027996",
"0.6278223",
"0.62164664",
"0.6216203",
"0.6214652",
"0.6168788",
"0.6138426",
"0.612600... | 0.6755463 | 5 |
Make user with user id u_id an owner of this channel. | def channel_addowner(token, channel_id, u_id):
auth_u_id = get_id_from_token(token)
channel = channels.get(channel_id)
if channel is None:
raise ValueError("channel_id does not exist.")
if u_id in channel["owners"]:
raise ValueError("user is already an owner")
user = users.get(auth_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channel_addowner(token, channel_id, u_id):\n # Check if token is valid and raise AccessError if not\n curr_id = database.get_current_user(token)\n # gets current channel data\n curr_channel = database.get_channel_data(channel_id)\n # gets the permissions of current user from database\n user_p... | [
"0.70757926",
"0.66383916",
"0.62191343",
"0.62124354",
"0.61835265",
"0.6022658",
"0.6004127",
"0.59890777",
"0.59763783",
"0.58852845",
"0.5843609",
"0.5758281",
"0.5756693",
"0.57209295",
"0.57168055",
"0.56534123",
"0.56359696",
"0.56195617",
"0.5602514",
"0.557859",
"0.5... | 0.7193164 | 0 |
Take a string and return a valid filename constructed from the string | def format_filename(s: str):
# from: https://gist.github.com/seanh/93666
valid_chars = "-_.() %s%s" % (string.ascii_letters, string.digits)
filename = ''.join(c for c in s if c in valid_chars)
filename = filename.replace(' ', '_') # I don't like spaces in filenames.
return filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_valid_filename(s):\n assert(s is not \"\" or s is not None)\n s = str(s).strip().replace(' ', '_')\n return re.sub(r'(?u)[^-\\w.]', '', s)",
"def get_valid_filename(s):\n s = str(s).strip().replace(' ', '_')\n return re.sub(r'(?u)[^-\\w.]', '', s)",
"def format_filename(s):\n valid_ch... | [
"0.80965817",
"0.8055868",
"0.8053721",
"0.8053721",
"0.8053721",
"0.8001325",
"0.7995787",
"0.7928941",
"0.7913765",
"0.7826625",
"0.7727187",
"0.7595966",
"0.75823694",
"0.74955904",
"0.7467527",
"0.7412702",
"0.73259616",
"0.72336996",
"0.70264083",
"0.694541",
"0.69451904... | 0.8198603 | 0 |
Return a frozen version of the given value, which may be composed of lists, sets, dictionaries, tuples, and primitive immutable noncollection types. The frozen version replaces lists with tuples, sets with frozensets, and dicts with frozendicts. | def freeze(value):
if isinstance(value, list):
value = tuple(freeze(e) for e in value)
elif isinstance(value, set):
value = frozenset(freeze(e) for e in value)
elif isinstance(value, dict):
value = frozendict({k: freeze(v) for k, v in value.items()})
elif isinstance(value, tuple)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_frozen_set( val ):\n if isinstance(val, str):\n return frozenset([ val ])\n else:\n return frozenset(val)",
"def compress(value):\n\t# type: (Any, ) -> Any\n\n\t# sets are not processed because they cannot contain lists or bytearrays anyway.\n\n\tif isinstance(value, (tuple, list)): # ... | [
"0.658217",
"0.628285",
"0.6254482",
"0.61001176",
"0.6093511",
"0.5764389",
"0.5704209",
"0.56399447",
"0.54786265",
"0.54629564",
"0.54567105",
"0.54381984",
"0.54065895",
"0.5343774",
"0.5340002",
"0.53313535",
"0.53064585",
"0.5291094",
"0.52744466",
"0.5272368",
"0.52329... | 0.8504925 | 0 |
takes an entry in the episode list and gathers all the necessary data | def create_episode(e, debug=False):
#{"title": , "summary": , "image": , "link": , "season": , "number": , "rating"}
if debug:
print("beginning create_episode()")
episode = {}
# get BeautifulSoup data for extracting details
episode_url = "https://www.imdb.com/" + e["link"]
episode_sou... | {
"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 OnEnterEpisode(self):\n pass",
"def parse(self: object, data_row: l... | [
"0.67100006",
"0.6622114",
"0.6560611",
"0.63082504",
"0.62795895",
"0.62040836",
"0.61691594",
"0.6128275",
"0.6128275",
"0.6119228",
"0.6092632",
"0.6044156",
"0.6033343",
"0.5984419",
"0.59753954",
"0.59150517",
"0.5912779",
"0.58920836",
"0.58816344",
"0.5870627",
"0.5857... | 0.6316536 | 3 |
Pick the episode, gather its data and return all as a dictionary | def pick(episodes, debug=False):
if debug:
print("begin pick()")
# pick episodes
# if factored
if len(episodes["weights"]) != 0:
e = choices(episodes["episodes"],
weights = episodes["weights"])[0]
# otherwise
else:
e = choices(episodes["episodes"])[0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_episode_metadata(\n episode: Sequence[Any]) -> Dict[str, Any]:\n\n first_step = episode[0]\n if not first_step.timestep.first():\n raise ValueError('The first step in this episode is not first')\n custom_data = first_step.custom_data\n return custom_data.get('episode_metadata', {}) if custom_data... | [
"0.7065092",
"0.6679594",
"0.6595217",
"0.65266633",
"0.64933753",
"0.6459712",
"0.6393874",
"0.63612527",
"0.63046664",
"0.6285625",
"0.6236408",
"0.6147616",
"0.60734713",
"0.6004472",
"0.6000936",
"0.5998434",
"0.5986839",
"0.59458756",
"0.5932871",
"0.5892162",
"0.5837160... | 0.6522418 | 4 |
Initialize with a ResultInfo message | def __init__(self, result_info, server=None):
if server is None:
server = dpf.core._global_server()
self._server = server
self._stub = self._connect()
if isinstance(result_info, ResultInfo):
self._message = result_info._message
else:
self._me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, msg, result):\n if result:\n msg += \" \" + repr(result)\n super(CountError, self).__init__(msg)",
"def __init__(self, result, data='', msg='', safe=True, status=200):\n\n content = {'code': result, 'data': data, 'msg': msg}\n super(ResultResponse, self).... | [
"0.63554996",
"0.6350709",
"0.60515314",
"0.59515864",
"0.5937562",
"0.5833333",
"0.581884",
"0.57942593",
"0.57265574",
"0.5708434",
"0.5706333",
"0.57042915",
"0.56895477",
"0.56608665",
"0.5660642",
"0.5660642",
"0.56553495",
"0.5617859",
"0.56177014",
"0.558525",
"0.54508... | 0.72683376 | 0 |
Retrieves the analysis type. Returns | def analysis_type(self):
intOut = self._stub.List(self._message).analysis_type
return result_info_pb2.AnalysisType.Name(intOut).lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self):\n return self._getValue('type')",
"def get_type(self):\n return self.type",
"def get_type(self):\n return self.type",
"def get_type(self):\n return self._type_obj",
"def get_type(self):\n return self._type",
"def get_type(self):\n return self._typ... | [
"0.6945739",
"0.6911548",
"0.6911548",
"0.6893719",
"0.68596846",
"0.68596846",
"0.6829026",
"0.6792039",
"0.6767861",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
"0.6760933",
... | 0.81182647 | 0 |
Name of the job. | def job_name(self):
return self._stub.List(self._message).job_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._job",
"def job_name(self) -> str:\n return pulumi.get(self, \"job_name\")",
"def job_name(self) -> str:\n return self._step_execution_context.job_name",
"def get_job_name(self) -> Text:\n return self._job_name",
"def job_name(self) -> pulumi.Input[str]... | [
"0.92055297",
"0.9095246",
"0.8871955",
"0.8741038",
"0.8701382",
"0.8232552",
"0.8232552",
"0.80342335",
"0.767814",
"0.7604216",
"0.75740623",
"0.7571249",
"0.75332636",
"0.7480141",
"0.74607736",
"0.7218836",
"0.7158225",
"0.71291035",
"0.70952773",
"0.7053831",
"0.7031792... | 0.87240213 | 4 |
Name of the product. | def product_name(self):
return self._stub.List(self._message).product_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product_name(self):\n return self._product_name",
"def product(self):\n return self.__values['product_name']",
"def product_name(self) -> Optional[str]:\n return pulumi.get(self, \"product_name\")",
"def product(self) -> str:\n return pulumi.get(self, \"product\")",
"def get... | [
"0.8975254",
"0.8665332",
"0.85646296",
"0.80977803",
"0.76765513",
"0.7595088",
"0.7532947",
"0.7530335",
"0.75087094",
"0.7488499",
"0.7413268",
"0.73788196",
"0.7315053",
"0.71571875",
"0.7103264",
"0.7103264",
"0.7103264",
"0.7103264",
"0.7103264",
"0.7103264",
"0.7103264... | 0.85159564 | 3 |
Clean URL for Unicode characters. | def clean_url(url):
scheme, netloc, path, query, fragment = url_parse.urlsplit(url)
path = url_parse.quote(path)
url = url_parse.urlunsplit((scheme, netloc, path, query, fragment))
return url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_url(url):\r\n s = url\r\n url = url.encode('utf8')\r\n url = ''.join([urllib.quote(c) if ord(c) >= 127 else c for c in url])\r\n return url",
"def normalize_for_url(text: str) -> str:\n\n # German is our main language, so we are extra considerate about it\n # (unidecode turns ü into u... | [
"0.8015698",
"0.74899143",
"0.71671873",
"0.71366674",
"0.70364755",
"0.69907814",
"0.6953605",
"0.6901467",
"0.68972623",
"0.68697876",
"0.6840387",
"0.67886764",
"0.67799973",
"0.67724544",
"0.6761702",
"0.6757888",
"0.6710092",
"0.6689677",
"0.6646632",
"0.6604048",
"0.656... | 0.6788188 | 12 |
Add's a `driver` to the library WebDriverCache. | def register_driver(self, driver, alias):
return self._drivers.register(driver, alias) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_driver(key, driver_class, force=False):\n try:\n drivers[key]\n if not force:\n raise ValueError('DB driver \"{0}\" is already installed'.format(\n key\n\t ))\n except KeyError:\n pass\n\n drivers[key] = driver_class",
"def aisappium_set_driver_i... | [
"0.5694449",
"0.5447878",
"0.5443518",
"0.54061985",
"0.53648347",
"0.5158303",
"0.5150019",
"0.507942",
"0.50705284",
"0.5043933",
"0.5043933",
"0.5030286",
"0.5027392",
"0.50195575",
"0.5016399",
"0.49854746",
"0.49369007",
"0.48834395",
"0.48783207",
"0.48715258",
"0.48529... | 0.51836663 | 5 |
Create a reads classified proportion without total. | def create_vals_no_total():
return {key: val
for key, val in create_values().items()
if key != 'total'} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetProportion(self):\r\n\r\n return self.proportion",
"def leitner_proportions(df):\n denom = df.shape[0]\n prop_dict = {}\n\n for i in range(1,6):\n df_i = df[df['comfort_level'] == i]\n numer = df_i.shape[0]\n prop_dict[i] = numer / denom\n\n prop_df = pd.DataFrame.f... | [
"0.6337361",
"0.60495156",
"0.5923102",
"0.5914333",
"0.5806133",
"0.5739455",
"0.5713834",
"0.5694348",
"0.56822896",
"0.5681568",
"0.56719357",
"0.56428707",
"0.54619884",
"0.5415171",
"0.54098666",
"0.5408217",
"0.5402329",
"0.53892636",
"0.5383232",
"0.538287",
"0.5362658... | 0.0 | -1 |
Check whether 'x' is a sparse Tensor. | def is_sparse(x: Any, backend=None) -> bool:
module = get_module(backend)
return module.is_sparse(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sparse(tensor):\n return isinstance(tensor, sparse_tensor.SparseTensor)",
"def is_sparse(A):\n if isinstance(A, torch.Tensor):\n return A.layout == torch.sparse_coo\n raise TypeError(\"expected Tensor but got %s\" % (type(A).__name__))",
"def isspsparse(var):\n if 'theano.sparse' in s... | [
"0.8247727",
"0.78406423",
"0.7148474",
"0.67549086",
"0.6647786",
"0.6628899",
"0.6549",
"0.6520349",
"0.6478045",
"0.6407013",
"0.640399",
"0.6350579",
"0.6326124",
"0.6300947",
"0.62640554",
"0.6193246",
"0.6176675",
"0.61558",
"0.61308116",
"0.6111965",
"0.60640544",
"0... | 0.7597219 | 2 |
Check whether 'x' is a strided (dense) Tensor. | def is_dense(x: Any, backend=None) -> bool:
module = get_module(backend)
return module.is_dense(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_tcns(x):\n return type(x) is T.TensorConstant",
"def is_keras_tensor(x):\n if not is_tensor(x):\n raise ValueError('Unexpectedly found an instance of type `' +\n str(type(x)) + '`. '\n 'Expected a symbolic tensor instance.')\n return hasattr(... | [
"0.6362374",
"0.62143683",
"0.61998135",
"0.6169852",
"0.6113837",
"0.6050881",
"0.58987665",
"0.58963126",
"0.5887012",
"0.57821244",
"0.5754241",
"0.5749059",
"0.57374436",
"0.5733738",
"0.565673",
"0.56030405",
"0.5576624",
"0.5526071",
"0.5495965",
"0.5449765",
"0.5379795... | 0.6459444 | 0 |
A single block for ResNet v1, without a bottleneck. | def _building_block_v1(inputs, filters, training, projection_shortcut, strides,
data_format):
shortcut = inputs
if projection_shortcut is not None:
shortcut = projection_shortcut(inputs)
shortcut = batch_norm(inputs=shortcut, training=training,
data_format=d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet18(**kwargs):\n model = ResNet(BasicBlock, [2, 2, 2, 2], **kwargs)\n return model",
"def _build_model(self, x: tf.Tensor) -> tf.Tensor:\n x = ResNet._first_conv(x)\n x = ResNet._v2_block(x, 'block1', base_depth=64, num_units=3, stride=2)\n x = ResNet._v2_block(x, 'block2', ba... | [
"0.6466638",
"0.6457893",
"0.64530134",
"0.6451775",
"0.64472973",
"0.64461553",
"0.6367148",
"0.6348126",
"0.6324769",
"0.63237226",
"0.6302314",
"0.62333626",
"0.62042534",
"0.61990243",
"0.6181521",
"0.61813545",
"0.6176672",
"0.6141593",
"0.61339605",
"0.61156714",
"0.609... | 0.0 | -1 |
Creates variables in fp32, then casts to fp16 if necessary. This function is a custom getter. A custom getter is a function with the same signature as tf.get_variable, except it has an additional getter parameter. Custom getters can be passed as the `custom_getter` parameter of tf.variable_scope. Then, tf.get_variable ... | def _custom_dtype_getter(self, getter, name, shape=None, dtype=DEFAULT_DTYPE,
*args, **kwargs):
if dtype in CASTABLE_TYPES:
var = getter(name, shape, tf.float32, *args, **kwargs)
return tf.cast(var, dtype=dtype, name=name + '_cast')
else:
return getter(name, shape, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def float32_variable_storage_getter(getter, name, shape=None, dtype=None,\n initializer=None, regularizer=None,\n trainable=True,\n *args, **kwargs):\n storage_dtype = tf.float32 if trainable else dtype\n ... | [
"0.77795357",
"0.67645115",
"0.6704484",
"0.61997455",
"0.60959065",
"0.5969402",
"0.5952168",
"0.59272265",
"0.5917217",
"0.5720231",
"0.5573573",
"0.5573573",
"0.5479989",
"0.5459602",
"0.54420453",
"0.5352729",
"0.5308366",
"0.5292199",
"0.52698094",
"0.5214639",
"0.519207... | 0.67778546 | 1 |
Keep unique spans for a given set of labels, sort by offset. | def keep_spans(cls, labels: Set[str], spans: Iterator[Span]) -> List[Span]:
spans = filter(lambda sp: sp.label in labels, spans)
spans = cls.dedupe_sort_spans(spans)
return spans | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deduplicate_spans(spans, options):\n make_key = lambda s: (s.start, s.end, s.type)\n span_map = defaultdict(list)\n deduped = []\n for span in spans:\n key = make_key(span)\n if key not in span_map:\n deduped.append(span)\n else:\n span_map[key][0].serials... | [
"0.6250191",
"0.6012954",
"0.5968908",
"0.5865955",
"0.58189",
"0.56110775",
"0.5548297",
"0.5415131",
"0.5404233",
"0.5378522",
"0.5359723",
"0.5317473",
"0.52795595",
"0.5249259",
"0.5195729",
"0.5185027",
"0.51814306",
"0.5177846",
"0.513521",
"0.5127265",
"0.51246077",
... | 0.69826853 | 0 |
Get the state persistence accessor wrapped in a context manager. | def state(self, nodes: typing.Sequence[uuid.UUID], tag: typing.Optional['genmod.Tag'] = None) -> State:
return State(self._generation, nodes, tag) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Get(self):\n\n if not hasattr(self, \"_instance\"):\n self._instance = PersistenceManager()\n\n return self._instance",
"def get_manager():\n return __manager__",
"def get_instance():\n if PersistenceManager._instance is None:\n PersistenceManager._instance = P... | [
"0.6400023",
"0.6274284",
"0.6214055",
"0.588705",
"0.5745987",
"0.5705005",
"0.5677145",
"0.56712013",
"0.5666942",
"0.5660756",
"0.56255114",
"0.55925244",
"0.55895925",
"0.5572245",
"0.55230176",
"0.5453362",
"0.5444069",
"0.5419083",
"0.5371108",
"0.5361778",
"0.531654",
... | 0.0 | -1 |
Forces continuous values into bins at 0, .5, and 1 | def Catch(X,Tolerance=0):
if X < (.5-(Tolerance/2)):
return(0)
elif X > (.5+(Tolerance/2)):
return(1)
else:
return(.5) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bins(self, value):\n self.num_bins = int(value)",
"def binning_axis(self) -> int:\r\n return 0",
"def from_bins(bins):\n return 0.5*(bins[1:] + bins[:-1])",
"def normalize_cmap(self):\n vmax, vmin = np.max(self.values), np.min(self.values)\n self.midpoint = 1 - vmax/(vmax +... | [
"0.6561486",
"0.6530368",
"0.6210017",
"0.6061803",
"0.60417813",
"0.6037535",
"0.60061187",
"0.59155405",
"0.58616865",
"0.5849352",
"0.5844025",
"0.58300924",
"0.5821772",
"0.58137923",
"0.5807078",
"0.5779869",
"0.5738962",
"0.5714997",
"0.5700439",
"0.5700124",
"0.5696562... | 0.0 | -1 |
Takes a normalized Vector (one that sums to 1), and computes relative strength of the indicators. | def Influence(Weight):
N = len(Weight)
Expected = [[1/N]]*N
Out = []
for i in range(1, N):
Out.append(Weight[i]/Expected[i])
return(Out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalizeVector(v):\n normalizer = 1.0 / sum(v)\n\n normalized = [i * normalizer for i in v]\n return normalized",
"def normBySum(vector):\n\treturn np.divide(vector,float(sum(vector)))",
"def GetWeight(Vec, AddMean=0):\n New = abs(Vec) #Absolute Value\n if AddMean == 1: #Add the m... | [
"0.666706",
"0.662364",
"0.6569276",
"0.6564304",
"0.6478106",
"0.64592236",
"0.64122957",
"0.6402934",
"0.6357848",
"0.6323335",
"0.6323335",
"0.6323335",
"0.6319064",
"0.6305225",
"0.6304022",
"0.63021636",
"0.629188",
"0.62843806",
"0.62804526",
"0.6278564",
"0.62719584",
... | 0.0 | -1 |
Get the relative influence of numbers, treat NaN as influenceless. | def ReWeight(Vec):
Out = Vec
Exclude = isnan(Vec)
Out[Exclude] = 0 #set missing to 0
Out = Out / sum(Out) #normalize
return(Out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anti_differentiate(self):\n if not self.is_nan() :\n return RatTerm(RatNum(self.coeff.nominator,self.expt + 1), self.expt + 1)\n else :\n return RatTerm(RatNum(1, 0), 0)",
"def normalise(a):\n return (a - np.nanmin(a)) / np.nanmax(a - np.nanmin(a))",
"def test... | [
"0.5803472",
"0.5799682",
"0.578668",
"0.57468224",
"0.5741434",
"0.56646615",
"0.5659995",
"0.5651907",
"0.5615952",
"0.5613262",
"0.5604906",
"0.5602734",
"0.5572347",
"0.54901296",
"0.54893774",
"0.547997",
"0.54756844",
"0.5468636",
"0.5463638",
"0.54413277",
"0.5429806",... | 0.553269 | 13 |
Function which maps strings to default KernelLoss objects. | def _str_to_loss(self, loss_str: str) -> KernelLoss:
if loss_str == "svc_loss":
loss_obj = SVCLoss()
else:
raise ValueError(f"Unknown loss {loss_str}!")
return loss_obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_loss(name_loss):\n call_dict = {\n \"pixel_weighted_cross_entropy\": pixel_weighted_cross_entropy,\n \"MeanSquaredLogarithmicError\": tf.keras.losses.MeanSquaredLogarithmicError(),\n \"MeanAbsolutePercentageError\": tf.keras.losses.MeanAbsolutePercentageError(),\n \"MeanSq... | [
"0.62653315",
"0.60764617",
"0.58024836",
"0.5724632",
"0.57098025",
"0.5663101",
"0.5659429",
"0.55111545",
"0.5438147",
"0.5395816",
"0.5377557",
"0.532755",
"0.52873075",
"0.52296346",
"0.52212906",
"0.5209717",
"0.5169079",
"0.5089147",
"0.5080287",
"0.506357",
"0.4992839... | 0.6825977 | 0 |
Closes the database connection. | def close(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_db_connection(cls):\n db.close()",
"def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None",
"def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()",
"def close(self):\n if... | [
"0.84170973",
"0.83116543",
"0.81426126",
"0.81257427",
"0.8106315",
"0.8009051",
"0.7964611",
"0.7851327",
"0.78355294",
"0.7828412",
"0.77569056",
"0.773037",
"0.7723868",
"0.7723868",
"0.7723868",
"0.7717667",
"0.76985",
"0.7682671",
"0.76797616",
"0.7673158",
"0.7669065",... | 0.0 | -1 |
Plots modelled vs fact values, prediction intervals and anomalies | def plotModelResults(model, X_train=X_train, X_test=X_test, plot_intervals=False, plot_anomalies=False):
prediction = model.predict(X_test)
plt.figure(figsize=(15, 7))
plt.plot(prediction, "g", label="prediction", linewidth=2.0)
plt.plot(y_test.values, label="actual", linewidth=2.0)
plt.draw()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_observed_predictions(self):\n \n # Plot of X vs Y\n fig = plt.figure(figsize=(15,5))\n plt.subplot(1,3,1) \n for k in self.phd_filter['estimated_positions'].keys():\n plt.plot(self.phd_filter['estimated_positions'][k][0], self.phd_filter['estimated_positions'... | [
"0.72141445",
"0.7094132",
"0.7083906",
"0.7031311",
"0.6946831",
"0.6926368",
"0.68594",
"0.68517894",
"0.6832782",
"0.6826498",
"0.68244064",
"0.680611",
"0.67760015",
"0.67683166",
"0.67379886",
"0.6681417",
"0.6677499",
"0.6674758",
"0.6661941",
"0.6638399",
"0.66133505",... | 0.7127247 | 1 |
This method is used to convert the unicode string in to string | def decoding_strings(data):
if isinstance(data, str):
data = data.replace("b'", "")
return data
elif isinstance(data, bytes):
return data.decode()
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_unicode(self, _string):\n if not isinstance(_string, unicode):\n try:\n _string = unicode(_string)\n except:\n try:\n _string = _string.decode(\"utf-8\")\n except:\n _string = _string.decode(\"iso... | [
"0.75491333",
"0.7499308",
"0.73351",
"0.72353613",
"0.7216106",
"0.7187597",
"0.7149942",
"0.7133299",
"0.71237737",
"0.71027225",
"0.7099331",
"0.70950633",
"0.70932627",
"0.70698416",
"0.7064509",
"0.7049667",
"0.7048907",
"0.7036272",
"0.70092994",
"0.70004374",
"0.697480... | 0.0 | -1 |
Given a profile name, returns an icon string for it. (nonaccount profiles only) | def get_player_profile_icon(profilename: str) -> str:
from ba._enums import SpecialChar
appconfig = _ba.app.config
icon: str
try:
is_global = appconfig['Player Profiles'][profilename]['global']
except KeyError:
is_global = False
if is_global:
try:
icon = appc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_icon(icon_name):\n theme = 'Adwaita'\n size = '256x256'\n path = f'/usr/share/icons/{theme}/{size}/mimetypes/{icon_name}.png'\n return path",
"def icon(self) -> Optional[str]:\n if not self.profile_device.icons:\n return None\n\n if not self._icon:\n icon_... | [
"0.6854238",
"0.64918226",
"0.63131255",
"0.6252918",
"0.6091051",
"0.60665846",
"0.5969339",
"0.5947331",
"0.59099644",
"0.59091586",
"0.58574885",
"0.5828271",
"0.57584375",
"0.5742529",
"0.57087815",
"0.56968963",
"0.5680406",
"0.5660262",
"0.55977094",
"0.55735266",
"0.55... | 0.7548534 | 0 |
Gets all child tags from a Tag object. | def get_tags(self, root, recursive=True):
tags = []
for child in root.children:
tags.append(child)
if recursive:
tags += self.get_tags(child)
return tags | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_children_with_tag(self, tag):\n if tag in self._children_tag_table:\n result = self._children_tag_table[tag]\n else:\n result = []\n composite_children = [c for c in self._children.values() if isinstance(c, Composite)]\n grand_children = []\n for c i... | [
"0.7785448",
"0.7125386",
"0.6750205",
"0.6708256",
"0.6689808",
"0.6569747",
"0.6483488",
"0.6469391",
"0.64345026",
"0.6429645",
"0.6423411",
"0.6392926",
"0.63857615",
"0.6378785",
"0.63741195",
"0.6373151",
"0.6349225",
"0.6329951",
"0.6325245",
"0.63157076",
"0.63104516"... | 0.70660585 | 2 |
Sum along the right most `ndim` dimensions of `x`, | def sum_right_most(x, ndim):
if ndim == 0:
return x
axes = list(range(-ndim, 0))
return x.sum(axes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sum_to_0d(x):\n assert_equal(x.ndim, 1)\n return np.squeeze(np.sum(x, keepdims=True))",
"def fn(x):\n if x.ndim == 1:\n return np.sum(x**2)\n else:\n return np.sum(x**2, axis=1)",
"def sum(input, axis=None, dtype=None, keepdims=False, acc_dtype=None):\r\n\r\n ou... | [
"0.7435214",
"0.7172801",
"0.71126914",
"0.7001956",
"0.69788593",
"0.67381954",
"0.66838723",
"0.6625336",
"0.65609515",
"0.6529158",
"0.6526043",
"0.64935225",
"0.6470894",
"0.633765",
"0.6333073",
"0.61884475",
"0.61837065",
"0.6137801",
"0.61003137",
"0.6072012",
"0.60717... | 0.7416953 | 1 |
Create index list from lines. | def create_indices(filename, lines):
def find(key, condition):
"""Find and return index from str-list."""
for i, line in enumerate(lines):
if condition(line, key):
return i
return None
guard = ('INCLUDE_GUARD_KEN3_' +
filename.replace('/', '_').r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _mk_index(self):\n index = defaultdict(list)\n for line_no, line in enumerate(self._stripped_lines):\n if line:\n index[line].append(line_no)\n return index",
"def convert_to_idx(lines):\n for idx, l in enumerate(lines):\n line_temp = []\n for v... | [
"0.7470838",
"0.66146404",
"0.63532335",
"0.6253512",
"0.6164719",
"0.60606533",
"0.60555553",
"0.603775",
"0.6023929",
"0.6022914",
"0.59796697",
"0.596683",
"0.58972496",
"0.58872414",
"0.5877942",
"0.58715916",
"0.5844947",
"0.58292127",
"0.5813339",
"0.5806315",
"0.579762... | 0.67960334 | 1 |
Find and return index from strlist. | def find(key, condition):
for i, line in enumerate(lines):
if condition(line, key):
return i
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_containing_substring(search_list, substring, multiples=True):\n num_found = 0\n list_index = -1\n\n for index, s in enumerate(search_list):\n if substring in s:\n if num_found == 0:\n list_index = index\n\n num_found += 1\n\n if list_index == -1:\n ... | [
"0.7080057",
"0.70105356",
"0.6960064",
"0.6960064",
"0.68570274",
"0.67961943",
"0.67793834",
"0.67497116",
"0.6747304",
"0.67306036",
"0.6723902",
"0.6698197",
"0.668722",
"0.66468495",
"0.66204256",
"0.66114175",
"0.6609234",
"0.6593249",
"0.65769017",
"0.65769017",
"0.657... | 0.0 | -1 |
Calculate energy of res of pose and emap | def finalize_total_energy(self, pose, sfxn, emap):
pose = pose ## for newer versions remove line
e_val = 0
for segment_idx in range(len(segment_break_list)):
r_xyz = np.zeros([int(scaling_info_holder[segment_idx][4]), 3])
rg_sq = np.zeros([int(scaling_info_holder[segment_idx][4]), 1])
start_res = 1
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_Em(self):\n return (self.parameters.E0 +\n self.x * sqrt2 * self.parameters.sigma * self.mt)",
"def eval_intrares_energy(self, res, pose, sf, emap):\n\t\tpose = pose\n\t\temv = EMapVector()\n\t\tsf_env.eval_cd_1b(res,pose,emv)\n\t\tweighted_score_env = emv[env]*sec_struct_weight[p... | [
"0.704625",
"0.70070654",
"0.6839049",
"0.6818555",
"0.6770087",
"0.67504805",
"0.67279255",
"0.6692086",
"0.6666",
"0.6612041",
"0.6585237",
"0.65758276",
"0.6551705",
"0.6550678",
"0.65207213",
"0.6484665",
"0.6473886",
"0.6471563",
"0.6430816",
"0.6428676",
"0.6393545",
... | 0.66903895 | 8 |
Calculate energy of res of pose and set emap | def residue_pair_energy(self, res1, res2, pose, sf, emap):
pose = pose
emv = EMapVector()
sf_pair.eval_ci_2b(res1,res2,pose,emv)
weighted_score = -1*(emv[pair]*sec_struct_weight[pose.secstruct()[res1.seqpos()-1]]*sec_struct_weight[pose.secstruct()[res2.seqpos()-1]])
emap.set(self.scoreType, weighted_score) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calc_Em(self):\n return (self.parameters.E0 +\n self.x * sqrt2 * self.parameters.sigma * self.mt)",
"def eval_intrares_energy(self, res, pose, sf, emap):\n\t\tpose = pose\n\t\temv = EMapVector()\n\t\tsf_env.eval_cd_1b(res,pose,emv)\n\t\tweighted_score_env = emv[env]*sec_struct_weight[p... | [
"0.69217885",
"0.68843913",
"0.6773071",
"0.6709015",
"0.6675775",
"0.66019934",
"0.6544349",
"0.65412134",
"0.6497995",
"0.64723146",
"0.6425499",
"0.6390179",
"0.637182",
"0.63591033",
"0.628902",
"0.6278537",
"0.62712926",
"0.62496215",
"0.6246878",
"0.6237652",
"0.6237555... | 0.61363906 | 25 |
initialising attributs name, age, location of user | def __init__(self, first_name, second_name, age, location):
self.name = f'{first_name.title()} {second_name.title()}'
self.age = age
self.location = location
self.login_attempts = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, first_name, last_name, age, gender):\n self.first_name = first_name\n self.last_name = last_name\n self.age = age\n self.gender = gender",
"def __init__(self, first_name, last_name, age):\n self.first_name = first_name\n self.last_name = last_name\n ... | [
"0.70119715",
"0.6894753",
"0.6894753",
"0.6894753",
"0.6894753",
"0.6894753",
"0.6894753",
"0.6894753",
"0.6894753",
"0.6889974",
"0.688447",
"0.68693924",
"0.68597144",
"0.6754199",
"0.67511374",
"0.67297214",
"0.67051315",
"0.66829765",
"0.6633868",
"0.6633868",
"0.6633868... | 0.67778313 | 13 |
Divide two distributions such that sampling is the ratio of the samples. | def __truediv__(self, dist):
return CombinedDistribution(self, dist, truediv) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ratio_func(a, b):\n return a / b",
"def division(self, first_value, second_value):\n return first_value / second_value",
"def _ratio(counter1, counter2, smoothing, min_freq=0):\n # Ratios dict to be returned\n ratios = {}\n \n # Set up for smoothing\n # The number of outcomes is th... | [
"0.690283",
"0.6462106",
"0.6317237",
"0.62509865",
"0.62298214",
"0.6171728",
"0.61559194",
"0.6105849",
"0.6068294",
"0.6045363",
"0.60396135",
"0.6039457",
"0.6039457",
"0.6039457",
"0.6028892",
"0.6008458",
"0.6001065",
"0.59822917",
"0.5957532",
"0.59514403",
"0.59490365... | 0.0 | -1 |
Set camera to default position. | def reset_camera(base):
base.camera.setPos(0, -4, 2)
base.camera.lookAt(0, 0, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setCamera(self, viewX=0, viewY=0):\n self.viewX = viewX\n self.viewY = viewY",
"def __reset_camera(self):\n # Reset Camera\n self.scene.camera.pos = vector(5, 5, 12) # Hover above (5, 5, 0)\n # Ever so slightly off focus, to ensure grid is rendered in the right\n # ... | [
"0.75671625",
"0.7320458",
"0.7298492",
"0.7186523",
"0.7108725",
"0.7034699",
"0.70045793",
"0.6995633",
"0.69917685",
"0.6980095",
"0.695007",
"0.6930338",
"0.6899239",
"0.68932784",
"0.665726",
"0.6622766",
"0.65676427",
"0.65666807",
"0.65468967",
"0.6514829",
"0.64282364... | 0.7552778 | 1 |
Renders the home page. | def home(request):
assert isinstance(request, HttpRequest)
#article_list = Article.objects.order_by('-released_at')[:5]
login = request.user and request.user.is_authenticated()
article_list = get_article_list('-released_at',login)[:5]
auth_form = AuthenticationForm(None, request.POST or None)
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.0 | -1 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
login = request.user and request.user.is_authenticated()
article_list = get_article_list('-released_at',login)[:5]
auth_form = AuthenticationForm(None, request.POST or None)
return render(
request,
'app/about.html',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Find a user by their id. | def find_token_by_user_id(session, user_id):
return session.query(Token).filter(Token.user_id == user_id).one_or_none() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user_by_id(id: str) -> User:\n\n # Find the id user in the database, else return None\n return User.query.get(int(id))",
"def find_by_id(cls, _id):\n user = cls.query.filter_by(id=_id).first()\n return user",
"def get_single_user(self, id):\n for user in self.users:\... | [
"0.85170597",
"0.8379991",
"0.81252855",
"0.8093785",
"0.8059285",
"0.8045352",
"0.802402",
"0.7979092",
"0.78968066",
"0.7839037",
"0.7792301",
"0.7776318",
"0.77383953",
"0.7711587",
"0.76901484",
"0.76648784",
"0.7617758",
"0.76173764",
"0.76129395",
"0.7609611",
"0.759013... | 0.0 | -1 |
Test case for delete_organization | def test_delete_organization(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deleteorganizations_item(self):\n pass",
"def test_delete_admin_from_org(self):\n pass",
"def test_organization_unauthorized_clearence(self):\n self.client.force_authenticate(user=self.inventory_manager)\n response = self.client.delete(\"/organization/\")\n self.asse... | [
"0.8367292",
"0.78394914",
"0.7264057",
"0.7251315",
"0.71816695",
"0.71538395",
"0.70605683",
"0.70485324",
"0.7003784",
"0.6992505",
"0.6990538",
"0.6972781",
"0.6964057",
"0.6964057",
"0.6923985",
"0.69024324",
"0.68846905",
"0.6868554",
"0.6859544",
"0.68264276",
"0.68096... | 0.94729704 | 0 |
Test case for get_cloud_organization_api_key | def test_get_cloud_organization_api_key(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_test_organization_api_key(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def test_add_api_key_to_org(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_create_api_key(self):\n pass",
"def test_delete_api_key_from_... | [
"0.90997285",
"0.8918546",
"0.75713456",
"0.71691096",
"0.6989371",
"0.6844788",
"0.6751461",
"0.6676516",
"0.66394144",
"0.6539914",
"0.6527871",
"0.6481596",
"0.6444157",
"0.6416596",
"0.6354571",
"0.6323977",
"0.6318027",
"0.6281878",
"0.6217638",
"0.6193896",
"0.6181781",... | 0.96041065 | 0 |
Test case for get_organization_from_api_key | def test_get_organization_from_api_key(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_test_organization_api_key(self):\n pass",
"def test_get_cloud_organization_api_key(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_retrieve_l_organization(self):\n pass",
"def test_add_api_key_to_org(self):\n pass",
"def test_client_get... | [
"0.89144087",
"0.88077307",
"0.8030137",
"0.7411901",
"0.7375122",
"0.7012065",
"0.6837723",
"0.6705846",
"0.65713406",
"0.6560059",
"0.65467364",
"0.65115184",
"0.6490429",
"0.6445208",
"0.6390063",
"0.637227",
"0.6215229",
"0.6207169",
"0.61871433",
"0.6138815",
"0.6130954"... | 0.96943647 | 0 |
Test case for get_test_organization_api_key | def test_get_test_organization_api_key(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_cloud_organization_api_key(self):\n pass",
"def test_get_organization_from_api_key(self):\n pass",
"def test_add_api_key_to_org(self):\n pass",
"def test_create_api_key(self):\n pass",
"def test_get_organization(self):\n pass",
"def test_get_user_api_keys(s... | [
"0.9327082",
"0.91403574",
"0.7948581",
"0.7405442",
"0.7385897",
"0.7111489",
"0.7109408",
"0.6801211",
"0.67228097",
"0.6678715",
"0.6657073",
"0.6633174",
"0.66236293",
"0.6620424",
"0.66150975",
"0.65542704",
"0.6542644",
"0.64782923",
"0.63855046",
"0.638444",
"0.6272597... | 0.96149343 | 0 |
Load Pandas DataFrame from a Amazon Redshift query result using Parquet files on s3 as stage. This is a HIGH latency and HIGH throughput alternative to `wr.redshift.read_sql_query()`/`wr.redshift.read_sql_table()` to extract large Amazon Redshift data into a Pandas DataFrames through the UNLOAD command. This strategy h... | def unload(
sql: str,
path: str,
con: redshift_connector.Connection,
iam_role: Optional[str] = None,
aws_access_key_id: Optional[str] = None,
aws_secret_access_key: Optional[str] = None,
aws_session_token: Optional[str] = None,
region: Optional[str] = None,
max_file_size: Optional[fl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_data_from_s3(spark, s3_bucket):\n raw_path = os.path.join(s3_bucket, 'raw')\n table_names = [y for x, y, z in os.walk(raw_path)][0]\n subdirs = glob.glob(raw_path + '/*/')\n df_raw_all = {}\n for name, path in zip(table_names, subdirs):\n df_raw_all[name] = spark.read.parquet(path... | [
"0.5997857",
"0.59543014",
"0.59382516",
"0.59258854",
"0.5866642",
"0.5817244",
"0.57623106",
"0.57371503",
"0.5714087",
"0.56665355",
"0.5663919",
"0.56460536",
"0.5619082",
"0.56124324",
"0.5597356",
"0.55672616",
"0.5561693",
"0.555014",
"0.5545397",
"0.54992914",
"0.5479... | 0.7075965 | 0 |
Load Pandas DataFrame as a Table on Amazon Redshift using parquet files on S3 as stage. This is a HIGH latency and HIGH throughput alternative to `wr.redshift.to_sql()` to load large DataFrames into Amazon Redshift through the SQL COPY command. This strategy has more overhead and requires more IAM privileges than the r... | def copy( # pylint: disable=too-many-arguments
df: pd.DataFrame,
path: str,
con: redshift_connector.Connection,
table: str,
schema: str,
iam_role: Optional[str] = None,
aws_access_key_id: Optional[str] = None,
aws_secret_access_key: Optional[str] = None,
aws_session_token: Optional[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def covert_df_to_parquet(df, s3_path, database_name, table):\n wr.s3.to_parquet(\n df=df,\n path=f\"s3://{s3_path}\",\n dataset=True,\n mode=\"append\",\n database=database_name,\n table=table\n )",
"def load_sql(df):\n engine = create_engine(f'postgres://{user}... | [
"0.71729743",
"0.65380704",
"0.65008163",
"0.6389493",
"0.60908663",
"0.6062319",
"0.60543996",
"0.5992561",
"0.5827544",
"0.5782807",
"0.57407016",
"0.5710552",
"0.5623358",
"0.561092",
"0.5607632",
"0.5599428",
"0.5562551",
"0.55545986",
"0.5550455",
"0.54618484",
"0.544531... | 0.6846796 | 1 |
Sets the crf_version_id of this SubjectMatrixValuesRpc. | def crf_version_id(self, crf_version_id):
self._crf_version_id = crf_version_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crf_version_oid(self, crf_version_oid):\n\n self._crf_version_oid = crf_version_oid",
"def crf_version_name(self, crf_version_name):\n\n self._crf_version_name = crf_version_name",
"def cvr(self, cvr):\n\n self._cvr = cvr",
"def node_version(self, node_version):\n\n self._node... | [
"0.6372119",
"0.574843",
"0.52940446",
"0.5247686",
"0.5213914",
"0.5211336",
"0.49468553",
"0.49468553",
"0.4938295",
"0.49157378",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.48994377",
"0.... | 0.69869 | 0 |
Sets the crf_id of this SubjectMatrixValuesRpc. | def crf_id(self, crf_id):
self._crf_id = crf_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crf_version_id(self, crf_version_id):\n\n self._crf_version_id = crf_version_id",
"def crf_version_id(self, crf_version_id):\n\n self._crf_version_id = crf_version_id",
"def event_crf_id(self, event_crf_id):\n\n self._event_crf_id = event_crf_id",
"def rc_response_sets_id(self, rc_re... | [
"0.5619326",
"0.5619326",
"0.55401677",
"0.5324943",
"0.5258222",
"0.5220845",
"0.5203802",
"0.51807433",
"0.51807433",
"0.5115594",
"0.5051563",
"0.50460684",
"0.50096667",
"0.50047284",
"0.4986645",
"0.49853736",
"0.4960003",
"0.49552804",
"0.48896885",
"0.48621207",
"0.484... | 0.6769691 | 0 |
Sets the crf_name of this SubjectMatrixValuesRpc. | def crf_name(self, crf_name):
self._crf_name = crf_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crf_version_name(self, crf_version_name):\n\n self._crf_version_name = crf_version_name",
"def set_res_name(self, res_name):\n assert isinstance(res_name, str)\n self.res_name = res_name\n\n for atm in self.iter_atoms():\n atm.set_res_name(res_name)",
"def name(self, ... | [
"0.60410804",
"0.5482097",
"0.51953715",
"0.51550096",
"0.5142636",
"0.5133685",
"0.5108929",
"0.5108929",
"0.50849366",
"0.50849366",
"0.50674313",
"0.504726",
"0.5024021",
"0.5010257",
"0.5010257",
"0.50085884",
"0.49961376",
"0.49819005",
"0.4953161",
"0.4928691",
"0.49114... | 0.6920374 | 0 |
Sets the event_crf_id of this SubjectMatrixValuesRpc. | def event_crf_id(self, event_crf_id):
self._event_crf_id = event_crf_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crf_id(self, crf_id):\n\n self._crf_id = crf_id",
"def crf_id(self, crf_id):\n\n self._crf_id = crf_id",
"def event_id(self, event_id):\n\n self._event_id = event_id",
"def event_id(self, event_id):\n\n self._event_id = event_id",
"def crf_version_id(self, crf_version_id):\n... | [
"0.6028238",
"0.6028238",
"0.5504692",
"0.5504692",
"0.5407522",
"0.5407522",
"0.50571454",
"0.49532837",
"0.47866318",
"0.47866318",
"0.47692794",
"0.4723801",
"0.47207093",
"0.47078097",
"0.46962267",
"0.4696196",
"0.46801007",
"0.466422",
"0.4616036",
"0.46017292",
"0.4601... | 0.72915924 | 0 |
Sets the event_def_name of this SubjectMatrixValuesRpc. | def event_def_name(self, event_def_name):
self._event_def_name = event_def_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setName(self, *args):\n return _libsbml.Event_setName(self, *args)",
"def event_name(self, event_name):\n self['event_name'] = event_name",
"def event_name(self, event_name):\n\n self._event_name = event_name",
"def setName(self, funcName):\r\n # type: (str) -> None\r\n ... | [
"0.6460156",
"0.6238407",
"0.6155176",
"0.55467284",
"0.54734576",
"0.5460237",
"0.5343305",
"0.53183883",
"0.52695584",
"0.51850027",
"0.516283",
"0.515691",
"0.5141675",
"0.51405287",
"0.51140356",
"0.50734115",
"0.5059256",
"0.49979472",
"0.49973518",
"0.49971655",
"0.4997... | 0.74051213 | 0 |
Sets the event_definition_id of this SubjectMatrixValuesRpc. | def event_definition_id(self, event_definition_id):
self._event_definition_id = event_definition_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_id(self, event_id):\n\n self._event_id = event_id",
"def event_id(self, event_id):\n\n self._event_id = event_id",
"def workflow_definition(self, workflow_definition):\n\n self._workflow_definition = workflow_definition",
"def definition(self, definition):\n\n self._defi... | [
"0.5271029",
"0.5271029",
"0.5190124",
"0.5122959",
"0.5086737",
"0.5083863",
"0.49270618",
"0.48990944",
"0.4836904",
"0.4818143",
"0.47915685",
"0.4727285",
"0.47209057",
"0.46329468",
"0.46329468",
"0.46329468",
"0.46234152",
"0.46234152",
"0.46024126",
"0.45842344",
"0.45... | 0.72139573 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SubjectMatrixValuesRpc):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, SubjectMatrixValuesRpc):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.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.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Split data to 1 batch each device. | def split_and_load(batch, ctx_list):
new_batch = []
for i, data in enumerate(batch):
if isinstance(data, (list, tuple)):
new_data = [x.as_in_context(ctx) for x, ctx in zip(data, ctx_list)]
else:
new_data = [data.as_in_context(ctx_list[0])]
new_batch.append(new_dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _batchify(data: nd.NDArray, batch_size):\n # Work out how cleanly we can divide the dataset into bsz parts.\n nbatch = len(data) // batch_size\n # Trim off any extra elements that wouldn't cleanly fit (remainders).\n data = data[0: nbatch * batch_size]\n # Evenly divide the d... | [
"0.7008145",
"0.69225854",
"0.67516387",
"0.6708468",
"0.66717356",
"0.65759706",
"0.65389574",
"0.6516114",
"0.6464656",
"0.64498186",
"0.6442398",
"0.6420633",
"0.6341426",
"0.6263667",
"0.6261499",
"0.625235",
"0.62451035",
"0.61681885",
"0.61512464",
"0.6141118",
"0.61141... | 0.0 | -1 |
Count number of overlapping bases between two gapped sequences | def get_seq_overlap(seq1, seq2):
overlap = 0
for i in range(len(seq1)):
if seq1[i] != "-" and seq2[i] != "-":
overlap += 1
return overlap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_padding_bases(seq1, seq2):\n if len(seq1) <= len(seq2):\n shorter, longer = seq1, seq2\n else:\n shorter, longer = seq2, seq1\n\n n = 0\n for base1, base2 in zip(shorter, longer[: len(shorter)]):\n if base1 == base2:\n n += 1\n else:\n break\n... | [
"0.7884847",
"0.68455",
"0.67365044",
"0.6651194",
"0.66265994",
"0.6619583",
"0.6619583",
"0.65510297",
"0.64480793",
"0.63503885",
"0.6307667",
"0.6284628",
"0.6186376",
"0.61677766",
"0.6143582",
"0.6119594",
"0.6065874",
"0.6063083",
"0.6061504",
"0.6050711",
"0.6042906",... | 0.6507422 | 8 |
Returns list of indices of nongap characters 'ATGCTGCG' ==> [0,1,2,6,7,8,10,11] Used to go from local > align space | def local2align(seq):
lookup = []
for i in xrange(len(seq)):
if seq[i] == "-":
continue
lookup.append(i)
return lookup | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_aligned_codons(aln):\n # throw out codons with non mod 3 gaps\n ind2 = []\n for i in range(0, aln.alignlen(), 3):\n bad = False\n\n for key, val in aln.iteritems():\n codon = val[i:i+3]\n if \"-\" in codon and codon != \"---\":\n bad = True\n ... | [
"0.62848306",
"0.62767553",
"0.6238629",
"0.61884165",
"0.5964774",
"0.5954357",
"0.59518844",
"0.59261984",
"0.58450145",
"0.5817335",
"0.5780761",
"0.57116604",
"0.5668302",
"0.56452835",
"0.5633965",
"0.56252605",
"0.5618219",
"0.55584186",
"0.554481",
"0.55336905",
"0.552... | 0.5709744 | 12 |
Get encoded quantiles of numeric features. | def get_binned_data(
self, train: NumpyOrPandas, feats_to_select: Optional[List[str]] = None
) -> Optional[LAMLTransformer]:
if feats_to_select is None:
feats_to_select = get_columns_by_role(train, "Numeric", discretization=True)
if len(feats_to_select) == 0:
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantiles(self):\n return self._quantiles",
"def _get_quantiles(X, quantile_range):\n quantiles = []\n for feature_idx in range(X.shape[1]):\n if sparse.issparse(X):\n column_nnz_data = X.data[\n X.indptr[feature_idx]: X.indptr[feature_idx + 1]]\n colu... | [
"0.7324275",
"0.72971255",
"0.7259336",
"0.6983006",
"0.66440254",
"0.6478998",
"0.6452635",
"0.6416926",
"0.6342685",
"0.6302319",
"0.6302319",
"0.6302319",
"0.6247264",
"0.6237911",
"0.6234769",
"0.6211969",
"0.618884",
"0.6182734",
"0.61718935",
"0.6171128",
"0.6164048",
... | 0.0 | -1 |
Get transformer that implements categorical intersections. | def get_categorical_intersections(
self, train: NumpyOrPandas, feats_to_select: Optional[List[str]] = None
) -> Optional[LAMLTransformer]:
if feats_to_select is None:
categories = get_columns_by_role(train, "Category")
feats_to_select = categories
if len(categor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categorical_raw(\n self, train: NumpyOrPandas, feats_to_select: Optional[List[str]] = None\n ) -> Optional[LAMLTransformer]:\n if feats_to_select is None:\n feats_to_select = []\n for i in [\"auto\", \"oof\", \"int\", \"ohe\"]:\n feats_to_select.extend(... | [
"0.5426551",
"0.51930434",
"0.5188657",
"0.5052858",
"0.500414",
"0.49987206",
"0.499071",
"0.49887133",
"0.49800166",
"0.49664867",
"0.4951718",
"0.49336895",
"0.48987705",
"0.488561",
"0.4871424",
"0.4871424",
"0.4871424",
"0.4871424",
"0.47965837",
"0.4745702",
"0.47048604... | 0.64237744 | 0 |
Returns a normalized vector perpendicular (rotated 90 degrees) to the vector vec | def perpendicular_axis(vec):
axis = vec.rotate(-math.pi / 2) # rotate vector -90 degrees
axis = axis.norm() # turn axis vector into unit vector
return axis | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perpendicular_vector(v):\n if v[1] == 0 and v[2] == 0:\n if v[0] == 0:\n raise ValueError(\"zero vector\")\n else:\n return np.cross(v, [0, 1, 0])\n return np.cross(v, [1, 0, 0])",
"def get_perpendicular2d(vector):\n if vector[1] == 0:\n return np.asarray([... | [
"0.81203467",
"0.80106854",
"0.79575646",
"0.7785505",
"0.732732",
"0.7289606",
"0.7255063",
"0.72404546",
"0.71814793",
"0.7149743",
"0.7145698",
"0.7142937",
"0.7038935",
"0.69675374",
"0.6959855",
"0.68619686",
"0.68529046",
"0.68470615",
"0.68333167",
"0.6808642",
"0.6779... | 0.8683374 | 0 |
Applies network layers and ops on input image(s) x. | def forward(self, x):
sources = list()
loc = list()
conf = list()
# apply vgg up to conv4_3 relu
for k in range(23):
x = self.vgg[k](x)
s = self.L2Norm(x)
sources.append(s)
# apply vgg up to fc7
for k in range(23, len(self.vgg)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_network(inputs):\n return apply_layer(tf.sigmoid(apply_layer(inputs, 64)), 1)",
"def forward(self, x):\n for task_module_name in self.task_module_name_path[self.task_idx]:\n for layer in self.task_modules[task_module_name]:\n x = layer(x)\n #x = self.task_... | [
"0.65635645",
"0.6369926",
"0.6366342",
"0.6353145",
"0.6308525",
"0.63080144",
"0.6259044",
"0.6207936",
"0.61983746",
"0.6192247",
"0.6176785",
"0.6163958",
"0.61539495",
"0.61442596",
"0.61295325",
"0.61276245",
"0.6121304",
"0.6115892",
"0.61109567",
"0.60991436",
"0.6084... | 0.60015064 | 32 |
Retrieve the string repr. of the RegistrationException object. | def __str__(self) -> str:
message = (
f"ERROR: Registration Exception.\n"
f" - Internal error code: {str(self.code)}\n"
f" - Internal error message: {str(self.message)}"
)
return message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __as_unicode(self):\n # WARNING: Do not change this string - it is used to extract error from log\n strg = WMEXCEPTION_START_STR\n strg += \"\\nException Class: %s\\n\" % self.name\n strg += \"Message: %s\\n\" % self._message\n for key, value in viewitems(self.data):\n ... | [
"0.749842",
"0.72222346",
"0.69906265",
"0.69691235",
"0.6937523",
"0.691762",
"0.69019145",
"0.68849576",
"0.6799396",
"0.6784407",
"0.67715347",
"0.67320395",
"0.6574739",
"0.6517447",
"0.651728",
"0.6508988",
"0.6488416",
"0.6433797",
"0.6426011",
"0.64200926",
"0.6339011"... | 0.78266 | 0 |
Retrieve the string representation of the BackendException object. | def __str__(self) -> str:
message = (
f"ERROR: Backend Exception.\n"
f" - Internal error code: {str(self.code)}\n"
f" - Internal error message: {str(self.message)}"
)
return message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exception(self) -> str:\n return pulumi.get(self, \"exception\")",
"def __as_unicode(self):\n # WARNING: Do not change this string - it is used to extract error from log\n strg = WMEXCEPTION_START_STR\n strg += \"\\nException Class: %s\\n\" % self.name\n strg += \"Message: ... | [
"0.71852326",
"0.7098264",
"0.7072871",
"0.7015216",
"0.69805497",
"0.68559676",
"0.67502856",
"0.6691532",
"0.66701806",
"0.6605151",
"0.6521624",
"0.6443341",
"0.6442003",
"0.63994706",
"0.63986385",
"0.6370371",
"0.6358585",
"0.63517904",
"0.6344785",
"0.6337761",
"0.63357... | 0.7561719 | 0 |
Return Path from Uri. | def get_document_path(self):
return pathlib.Path(urlparse(self.get_document().uri).path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPath(self, uri):\n pass",
"def get_path(self, normalize = False):\r\n\r\n split = self.path_s.split(\"?\", 1)\r\n path = split[0]\r\n if not normalize: return path\r\n if not path.startswith((\"http://\", \"https://\")): return path\r\n return netius.legacy.urlpar... | [
"0.791147",
"0.679545",
"0.6724243",
"0.64580894",
"0.64074564",
"0.63912326",
"0.63852173",
"0.6373022",
"0.6370568",
"0.633539",
"0.6334164",
"0.63333106",
"0.6299274",
"0.6299274",
"0.6299274",
"0.6299274",
"0.6299274",
"0.6299274",
"0.6279207",
"0.6275787",
"0.6262758",
... | 0.58518964 | 41 |
Normalize the string start. It cut offs the first letter and put a '_' inbetween. | def normalize_prefix(string, logger_=_LOGGER):
string = str(string)
if not re.match("[0-9]", string):
if not re.match("^[lrmnLRMN]_", string):
new_string = string[0].upper() + "_" + string[1:]
return new_string
return string
logger.log(level="warning", message="Prefi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(self, s):\n s = normalizing_regexp.sub('_', s)\n if s[0:1] in string.digits:\n s = '_' + s\n return s",
"def normalize(item):\n item = item.lower().strip().rstrip('_')\n return item",
"def normalize(val):\n \n if val.find('-') != -1:\n val = val.replace('-... | [
"0.7221231",
"0.70597994",
"0.66686946",
"0.6646927",
"0.65241235",
"0.65032417",
"0.6496972",
"0.6385377",
"0.6342259",
"0.6327984",
"0.6315855",
"0.6309969",
"0.630159",
"0.6292959",
"0.6283978",
"0.6263716",
"0.625642",
"0.62433654",
"0.6195327",
"0.61696476",
"0.6153717",... | 0.63062644 | 12 |
Replace numbers in the suffix with a '' and generate the correct count and put in the right place. | def normalize_suffix_1(string, logger_=_LOGGER):
numbers_end_string_regex = r"(\d+$)"
count_regex = r"(_\d+_\D+)"
match = re.search(numbers_end_string_regex, string)
# If we find a number in the suffix of the string we delete it. And
# generate the correct count and put in the correct place in the s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suffix(rem):\n if rem == 0:\n suf = ''\n else:\n if rem <= 600: #Class A suffix -- only letters.\n rem = rem - 1\n suf = base34[rem // 25]\n if rem % 25 > 0:\n suf = suf + base34[rem % 25 - 1]# second class A letter, if present.\n else:... | [
"0.6414111",
"0.64021814",
"0.6279612",
"0.6185595",
"0.61830306",
"0.6145874",
"0.60086614",
"0.5974522",
"0.59581745",
"0.59356445",
"0.59253126",
"0.585895",
"0.5815321",
"0.58039665",
"0.5733078",
"0.5719689",
"0.5697997",
"0.5666063",
"0.562796",
"0.5605457",
"0.56007373... | 0.7131007 | 0 |
Find the index numbers in the string. Will cut out all numbers with this ["azAZ_00000_"] expression. | def replace_index_numbers(string, replace):
regex = r"(\w_\d+_)"
match = re.search(regex, string)
instance = match.groups()[0]
numbers = re.sub(r"[a-zA-Z]", "", instance)
return regex_search_and_replace(string, numbers, '_{}_'.format(str(
replace))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index(s):\n return int(s[s.find(\"[\")+1:s.find(\"]\")])",
"def str_to_tile_index(s, index_of_a = 0xe6, index_of_zero = 0xdb, special_cases = None):\n\n\tres = []\n\tfor c in s:\n\t\tindex = None\n\t\tif ord(c) >= ord('a') and ord(c) <= ord('z'):\n\t\t\tindex = ord(c) - ord('a') + index_of_a\n\t\telif... | [
"0.6119174",
"0.56710345",
"0.56212956",
"0.55663264",
"0.55365217",
"0.5532218",
"0.5519327",
"0.5512852",
"0.54841846",
"0.5438418",
"0.5425399",
"0.5397582",
"0.5362815",
"0.53598017",
"0.53598017",
"0.53533477",
"0.5346539",
"0.5325721",
"0.53242147",
"0.5317048",
"0.5314... | 0.5580598 | 3 |
Create a Python instance from the given DOM node. The node tag must correspond to an element declaration in this module. | def CreateFromDOM (node, default_namespace=None):
if default_namespace is None:
default_namespace = Namespace.fallbackNamespace()
return pyxb.binding.basis.element.AnyCreateFromDOM(node, default_namespace) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateFromDOM (node, default_namespace=None):\n if default_namespace is None:\n default_namespace = Namespace.fallbackNamespace()\n return pyxb.binding.basis.element.AnyCreateFromDOM(node, _fallback_namespace=default_namespace)",
"def CreateFromDOM (node, default_namespace=None):\n if default... | [
"0.6948991",
"0.6948991",
"0.6948991",
"0.69460166",
"0.6701228",
"0.6701228",
"0.6701228",
"0.66999686",
"0.6666949",
"0.66534513",
"0.662455",
"0.6596129",
"0.658783",
"0.6567276",
"0.65120965",
"0.6491551",
"0.64744383",
"0.6425789",
"0.6326075",
"0.63144565",
"0.6312461",... | 0.70109564 | 2 |
Get a string representation for the current platform. | def GetCurrentPlatform():
if sys.platform == 'darwin':
return 'mac'
if sys.platform == 'win32':
return 'win'
if sys.platform == 'linux2':
return 'linux'
raise RuntimeError('Unknown platform') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"platform\")",
"def platform_to_str(self, platform_in):\n parsed_platform = self.parse_platform(platform_in)\n if parsed_platform[2]:\n return \"%s/%s/%s\" % parsed_platform\n if parsed_platform[1]:\n ... | [
"0.7640341",
"0.7366076",
"0.7085245",
"0.7073968",
"0.7009672",
"0.7002626",
"0.69931203",
"0.6934315",
"0.6881404",
"0.6858437",
"0.684455",
"0.67702144",
"0.67349666",
"0.67190135",
"0.66208816",
"0.65868545",
"0.65863764",
"0.6571119",
"0.6512531",
"0.64905185",
"0.648916... | 0.66515714 | 14 |
Add random Gaussian noise (with standard deviation std) to X. | def jitter_data(X, std, datum_jitter=False):
if not isinstance(X, np.ndarray):
raise TypeError("X must be a numpy array")
if datum_jitter:
row = np.random.randint(0, X.shape[0])
d = X.shape[1]
X[row, :] = np.random.multivariate_normal(X[row, :], np.eye(d)*std)
return X
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_gaussian_noise(x, std):\n noise = x.new_zeros(x.size()).normal_(std=std)\n return x + noise",
"def add_gaussian_noise(X, mu=0, sigma=0.1):\n noise = np.random.normal(0.0, sigma, size=X.size)\n return X + noise.reshape(X.shape)",
"def noise(x: np.ndarray) -> np.ndarray:\n\n return np.rand... | [
"0.84058744",
"0.790265",
"0.7385121",
"0.7292683",
"0.729079",
"0.7266426",
"0.7166268",
"0.7139143",
"0.69855756",
"0.6931539",
"0.68964624",
"0.68964624",
"0.686858",
"0.6652289",
"0.66436845",
"0.6628734",
"0.6621534",
"0.65823233",
"0.6574629",
"0.65548795",
"0.649178",
... | 0.65399235 | 20 |
Format a time according to the given format. | def time(value, arg=None):
if value in (None, ''):
return ''
try:
return formats.time_format(value, arg)
except (AttributeError, TypeError):
try:
return time_format(value, arg)
except (AttributeError, TypeError):
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_time(self, time):\n hh = time[0:2]\n mm = time[2:4]\n ss = time[4:]\n return \"%s:%s:%s UTC\" % (hh,mm,ss)",
"def format_time(t):\r\n # again, workaround dateformat input requirement\r\n dt = aware_datetime(2000, 1, 1, t.hour, t.minute, t.second)\r\n return datefor... | [
"0.76744854",
"0.75314",
"0.745555",
"0.7402031",
"0.73496556",
"0.7304574",
"0.7248217",
"0.7147786",
"0.71042216",
"0.7059039",
"0.70212096",
"0.69663197",
"0.69639283",
"0.6959339",
"0.694308",
"0.68953085",
"0.6854175",
"0.6835471",
"0.671676",
"0.6703433",
"0.6698232",
... | 0.61463565 | 40 |
Compute the perclient accuracy of kNNPer for a list of clients. | def knn_per_avg_clients(federated_data: tff.simulation.datasets.ClientData,
split_data_fn: constants.SplitDataFnType,
sampled_client_ids: list[str],
ensemble_coefficient: float,
global_model: tf.keras.Model,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def knn(train_data, train_labels, test_data, test_labels, k):\n pred_labels = []\n for t in test_data:\n dist = calculate_distances(train_data, t)\n pred_class = majority_voting(dist, train_labels, k)\n pred_labels.append(pred_class)\n correct_pred_count = np.sum(pred_labels == test_l... | [
"0.66652966",
"0.65159595",
"0.65159595",
"0.6510725",
"0.63554925",
"0.6328444",
"0.6306881",
"0.62546194",
"0.6209811",
"0.6169944",
"0.6161569",
"0.61580527",
"0.61515915",
"0.6148571",
"0.6141719",
"0.6141719",
"0.613585",
"0.61353207",
"0.61259705",
"0.6121551",
"0.61211... | 0.62211835 | 8 |
Which layer output in the global model is used as the embedding. | def embedding_layer_index(dataset_name: str) -> int:
if dataset_name == 'emnist':
# Use the second to the last layer as the embedding. For EMNIST model, the
# embedding dimension is 512.
return -2
elif dataset_name == 'stackoverflow':
# For StackOverflow model, the output of the second layer is the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_embedding_output(self):\n return self.embedding_output",
"def embedding_layer(self):\n with tf.name_scope(\"Embedding_Layer\"):\n V_size = len(self.vocab)\n embed_dim = len(self.embed[0]) \n W_embed_ = tf.get_variable(\"W_embed\",shape=[V_size, embed_dim],tr... | [
"0.7206785",
"0.65779203",
"0.6368324",
"0.6350261",
"0.6317571",
"0.6106799",
"0.6067148",
"0.6040755",
"0.6002662",
"0.59997356",
"0.5981516",
"0.59393597",
"0.5919098",
"0.59138376",
"0.5870368",
"0.5862751",
"0.58581287",
"0.58424",
"0.583681",
"0.5826036",
"0.58247477",
... | 0.58515364 | 17 |
Only onvert datetimes that are first moment of day | def test_convert_to_eod_datetime(self):
assert convert_to_eod_datetime(date(2020, 1, 1)) == datetime(
2020, 1, 1, 23, 59, 59, 999999
)
assert convert_to_eod_datetime(datetime(2020, 1, 1)) == datetime(
2020, 1, 1, 23, 59, 59, 999999
)
assert convert_to_eod_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_min_date(self):\n\n to_datetime = lambda x: datetime.datetime.strptime(x, \"%Y-%m-%dT%H:%M:%S\")\n all_dates = [to_datetime(event['start']['dateTime'][:-2]) for event in self.formatted_events]\n self.min_date = min(all_dates).isoformat() + 'Z'",
"def is_first_day_of_month(timestamps... | [
"0.6333613",
"0.62629",
"0.6106948",
"0.60695213",
"0.60348964",
"0.59525067",
"0.59194034",
"0.5875135",
"0.58512455",
"0.5849189",
"0.5830906",
"0.58003247",
"0.5779817",
"0.5779817",
"0.57587755",
"0.570768",
"0.569676",
"0.5668294",
"0.5656879",
"0.56205714",
"0.55887073"... | 0.0 | -1 |
Get the label of this relation | def relation_label(self, rid):
relations = self._load_relations()
return relations[rid]["label"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label(self):\n return self._label",
"def get_label(self):\n\n return self._label",
"def label(self) -> str:\n return self._underlying.label",
"def get_label(self):\n return self.label",
"def get_label(self):\n return self.label",
"def get_label(self):\n r... | [
"0.7765079",
"0.7757239",
"0.7757034",
"0.7748383",
"0.7748383",
"0.7748383",
"0.7748383",
"0.773344",
"0.7722936",
"0.77152187",
"0.76963216",
"0.7694587",
"0.76940954",
"0.76722056",
"0.76722056",
"0.76722056",
"0.76722056",
"0.76722056",
"0.76722056",
"0.76722056",
"0.7659... | 0.8474983 | 0 |
Get the label of this entity type | def entity_type_label(self, type_id):
type_labels = self._load_entity_type_labels()
return type_labels[type_id]["label"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label(cls):\n return cls._type_name(cls.label)",
"def get_label(cls):\r\n return cls._type_name(cls.label)",
"def get_label(self):\n return self._label",
"def get_label(self):\n return self.label",
"def get_label(self):\n return self.label",
"def get_label(self)... | [
"0.86665726",
"0.86560655",
"0.80638635",
"0.8056775",
"0.8056775",
"0.8056775",
"0.8056775",
"0.8020551",
"0.80152273",
"0.8010162",
"0.8006077",
"0.79843944",
"0.7947949",
"0.792836",
"0.79240894",
"0.7915674",
"0.7882685",
"0.7876485",
"0.7876485",
"0.7876485",
"0.7876485"... | 0.8419579 | 2 |
(dict, dict) > void This function takes two vectors in the form of dictionnaries and adds them together. It only modifies the input of v1. | def add_vectors(v1,v2):
#iterates through second dictionnary
for key in v2:
#if key is in v1 and v2 then we would add the values
if key in v1:
v1[key] = v1[key] +v2[key]
#checks if the value at current key is 0
if v1[key] == 0:
# if value ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_dicts_of_vectors(d1,d2):\n \n \n for key in d2:\n \n #adds a key from d2 in d1 if the key doesnt exist in d1 \n if key not in d1:\n \n d1[key] = d2[key] \n \n \n #if key in d2 \n elif key in d1:\n \n ... | [
"0.77904284",
"0.70172906",
"0.6773894",
"0.67006165",
"0.66165036",
"0.6537785",
"0.65032035",
"0.64944863",
"0.6449679",
"0.64478683",
"0.64445156",
"0.6395278",
"0.6322595",
"0.6262542",
"0.6256518",
"0.623545",
"0.62072104",
"0.61411554",
"0.61297673",
"0.61224455",
"0.61... | 0.8485566 | 0 |
(dict,dict) > int This function takes 2 vectors in the form as dictionnaries for both inputs. It then returns the dot product the 2 vectors as input. | def get_dot_product(v1,v2):
#sets default dot product
dot_product = 0
for key in v2:
if key in v1:
# updates the dot product if key is present in both vectors
dot_product += v1[key]*v2[key]
#returns final dot product
return dot_product | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dot_product(vector_1, vector_2):\n result = 0\n for idx_1, value_1 in vector_1.items():\n if idx_1 in vector_2:\n result += value_1 * vector_2[idx_1]\n return result",
"def dot(a,b):\n acc = 0\n for k in b.keys():\n acc += a[k] * b[k]\n return acc",
"def dotproduc... | [
"0.80098444",
"0.7926375",
"0.7590323",
"0.7570805",
"0.75266075",
"0.7500883",
"0.7497483",
"0.74910325",
"0.73982996",
"0.73711026",
"0.7362979",
"0.73448074",
"0.7324401",
"0.7301347",
"0.72973365",
"0.72910786",
"0.728106",
"0.718888",
"0.71722794",
"0.71653205",
"0.71496... | 0.80899405 | 0 |
Checks whether the given list of genetic code is sorted in nondecreasing order. If the array (A) is None, return None. | def is_sorted(A: list) -> bool:
# If it's None, return None
if A is None:
return None
# If the length is 0 or 1, then
# it's sorted
if len(A) <= 1:
return True
# If not, let's loop through
curr = A[0]
for i in rang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_not_in_descending_order(a):\n for i in range(len(a) - 1):\n if a[i] > a[i + 1]:\n return False\n return True",
"def is_sorted_array(arr, increasing=True):\n # If only 1\n if len(arr) == 0:\n return True\n # If multiple values\n if increasing:\n return np.a... | [
"0.57564235",
"0.5746037",
"0.57452464",
"0.5689957",
"0.5679232",
"0.56140393",
"0.561256",
"0.5541488",
"0.5528832",
"0.5473361",
"0.546755",
"0.54452485",
"0.54323417",
"0.54323417",
"0.5426333",
"0.5348625",
"0.5346158",
"0.53455627",
"0.53300214",
"0.52938354",
"0.528478... | 0.6066341 | 0 |
Return type_of_habit from associated Habit model. | def get_type_of_habit(self,obj):
type_of_habit = obj.habit.type_of_habit
return type_of_habit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHabitatType(self):\n\t\treturn self.habitatType",
"def get_thermostat_type(self, home_id: str, room_id: str) -> Optional[str]:\n for module in self.modules.get(home_id, {}).values():\n if module.get(\"room_id\") == room_id:\n return module.get(\"type\")\n\n return N... | [
"0.73613846",
"0.57704407",
"0.5605953",
"0.5596343",
"0.5549498",
"0.5549498",
"0.54931337",
"0.54931337",
"0.54378486",
"0.54340917",
"0.5432066",
"0.54173887",
"0.53595924",
"0.53525895",
"0.53525895",
"0.5352308",
"0.5334593",
"0.53299564",
"0.53201526",
"0.5312231",
"0.5... | 0.8260561 | 0 |
create a User object if username and password validated. | def create(self, validated_data):
username = validated_data['username']
password = validated_data['password']
if len(username) > 5 and len(password) > 5:
newUser = User.objects.create_user(**validated_data) # username=username,password=password
return newUser
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, validated_data):\n user = get_user_model().objects.create(\n username=validated_data['username'],\n )\n user.set_password(validated_data['password'])\n user.save()\n return user",
"def _create_user(self, username, email, password, **extra_fields):\n ... | [
"0.77757794",
"0.77605474",
"0.7737402",
"0.77272046",
"0.772303",
"0.77115345",
"0.76027906",
"0.75828266",
"0.75827616",
"0.7578393",
"0.7567222",
"0.75330305",
"0.75313014",
"0.7509077",
"0.7480077",
"0.7478734",
"0.7463867",
"0.74631095",
"0.745699",
"0.74434",
"0.7436608... | 0.7760195 | 2 |
Initializes the player ship parameters. | def __init__(self, game):
pygame.sprite.Sprite.__init__(self)
self.game = game
self.unmasked_image, self.rect = utilities.load_image(data.filepath(settings.UNMASKED_BG_IMAGE_PATH))
self.masked_image, _= utilities.load_image(data.filepath(settings.MASKED_BG_IMAGE_PATH))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.x_coord = default_init\n self.y_coord = default_init\n self._init_random_coord() # generating random coordinates\n self.x_speed = default_init\n self.y_speed = default_init\n self.degrees = default_init\n self.radius = ship_def_radius",
... | [
"0.7129124",
"0.6894938",
"0.6802523",
"0.67904496",
"0.67899",
"0.67140913",
"0.67140913",
"0.6704183",
"0.6673803",
"0.66031694",
"0.659581",
"0.6536669",
"0.6523802",
"0.64885545",
"0.64769566",
"0.64751726",
"0.6430918",
"0.6413779",
"0.6407129",
"0.64014953",
"0.6375143"... | 0.0 | -1 |
Repopulate all searches in all products | def repopall(ctx):
c = ctx.obj['client']
if not c.login:
return False
r = requests.request("GET", urljoin(c.BASE_URL, '/apiproxy/JobService.js'), params={'accesskey': c.login, 'method': 'PopulateAllSearches'})
print(r.status_code, r.text)
if r.status_code == 200:
return True
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_products(self):\n\t\tpass",
"def fill_cache_table():\n products = []\n for query in ['bread', 'milk', 'rice']:\n grocery = grocery_search(query)\n products += get_all_products_from_grocery_search(grocery)\n\n orm = ORM()\n for product in products:\n orm.add_cache(**pr... | [
"0.6272295",
"0.6154413",
"0.6086174",
"0.6086174",
"0.6002872",
"0.5887954",
"0.5852883",
"0.57825315",
"0.5697235",
"0.5695402",
"0.56853735",
"0.56549454",
"0.55810046",
"0.55785966",
"0.5546704",
"0.55359447",
"0.5524229",
"0.55159795",
"0.5514854",
"0.5446314",
"0.544206... | 0.55287594 | 16 |
To check if the user is the owner of the object | def get_object(self, queryset=None):
obj = super(EditAccountSettings, self).get_object()
if not str(obj.username) == str(self.request.user):
raise Http404
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isowner(self, o):\n return self._owner is o",
"def has_ownership(self):\n user = self.request.user\n object = self.get_object()\n if object.owned_by(user):\n return True\n else:\n return False",
"def get_owner_object(self):\n return False",
... | [
"0.8412554",
"0.8118939",
"0.80923885",
"0.8086703",
"0.7998976",
"0.798726",
"0.7974111",
"0.77795166",
"0.77444464",
"0.7616189",
"0.7610267",
"0.7608425",
"0.75984615",
"0.7569729",
"0.75437963",
"0.7504844",
"0.74928355",
"0.74759656",
"0.7475695",
"0.7444278",
"0.7424422... | 0.0 | -1 |
A custom view to handle 404 error pages in Django | def handler404(request, *args, **argv):
response = render_to_response('404.html', {})
response.status_code = 404
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_404(request):\n return handle_error(request, django.http.HttpResponseNotFound(),\n \"404.html\")",
"def handler404(request):\n response = render_to_response('404.html', {})\n response.status_code = 404 # Other errors can be similarly configured\n return response",
... | [
"0.8791925",
"0.8602705",
"0.8516847",
"0.8480348",
"0.83480585",
"0.8312204",
"0.81107825",
"0.81103593",
"0.81103593",
"0.8101212",
"0.80692583",
"0.8048437",
"0.8040004",
"0.80230516",
"0.80069274",
"0.79748493",
"0.79325837",
"0.792883",
"0.7919976",
"0.7915966",
"0.79038... | 0.8298052 | 6 |
test method for update config node objects | def test_update_config_node(self):
config_node = self._create_config_node()
config_node_uuid = config_node['config-node']['uuid']
updated_name = data_utils.rand_name('new_config_node')
with self.override_role():
self.config_client.update_config_node(
config_no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_node_driveconfig(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_config_change():\n clean_tables()\n config = set_configuration()\n assert config['age']['value'] == \"72\"\n ... | [
"0.78854764",
"0.73083067",
"0.73083067",
"0.73083067",
"0.72954184",
"0.72635174",
"0.71841335",
"0.71324265",
"0.70363474",
"0.6961581",
"0.69414324",
"0.6867226",
"0.6772135",
"0.6770638",
"0.67575026",
"0.6721655",
"0.67100775",
"0.6690196",
"0.6653531",
"0.6651143",
"0.6... | 0.7541321 | 1 |
test method for delete config root service objects | def test_delete_config_root(self):
config_root = self._create_config_root()
config_root_uuid = config_root['config-root']['uuid']
with self.override_role():
self.config_client.delete_config_root(
config_root_uuid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_virtual_service(self):\n pass",
"def test_delete_namespaced_deployment_config(self):\n pass",
"def test_delete_namespaced_build_config(self):\n pass",
"def test_ipam_services_delete(self):\n pass",
"def test_delete_deployment(self):\n pass",
"def test_de... | [
"0.74798995",
"0.7432673",
"0.73822534",
"0.73602796",
"0.71391976",
"0.7043867",
"0.7030351",
"0.6898217",
"0.6898217",
"0.6897348",
"0.68919617",
"0.68813914",
"0.68755764",
"0.6867956",
"0.68589646",
"0.6850118",
"0.68431205",
"0.6800697",
"0.67916316",
"0.67829514",
"0.67... | 0.74364525 | 1 |
test method for update config root service objects | def test_update_config_root(self):
config_root = self._create_config_root()
config_root_uuid = config_root['config-root']['uuid']
updated_name = data_utils.rand_name('new_config_root')
with self.override_role():
self.config_client.update_config_root(
config_ro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ipam_services_update(self):\n pass",
"def test_update_system(self):\n pass",
"def test_update_reg_ex_config(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update_node_driveco... | [
"0.71538705",
"0.7104947",
"0.7010863",
"0.6943424",
"0.6943424",
"0.6943424",
"0.68949634",
"0.68669707",
"0.6860485",
"0.67874986",
"0.6770654",
"0.6751218",
"0.66939956",
"0.66888416",
"0.6648456",
"0.66169095",
"0.65933865",
"0.6554066",
"0.650099",
"0.6473253",
"0.646596... | 0.674286 | 12 |
test method for delete global system config service objects | def test_delete_global_system_config(self):
new_config = self._create_global_system_config()
with self.override_role():
self.config_client.delete_global_system_config(new_config['uuid']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ipam_services_delete(self):\n pass",
"def test_delete_hyperflex_sys_config_policy(self):\n pass",
"def test_delete_namespaced_deployment_config(self):\n pass",
"def test_delete_namespaced_build_config(self):\n pass",
"def tearDown(self):\n test_utils.delete_test_... | [
"0.7199809",
"0.7089512",
"0.7032081",
"0.69922334",
"0.69576204",
"0.6904479",
"0.68974847",
"0.684831",
"0.6819755",
"0.662143",
"0.6605294",
"0.6605294",
"0.66023314",
"0.6571069",
"0.6560798",
"0.6553273",
"0.6466658",
"0.6459688",
"0.6441004",
"0.6425311",
"0.6407294",
... | 0.78541297 | 0 |
Check if the user of the launch request is an instructor on the course. Returns boolean True if the user is an instructor, False otherwise | def is_instructor(self):
return bool(LTI_ROLES[INSTRUCTOR] & self.roles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_instructor(self):\n # pylint: disable=no-member\n return self.xmodule_runtime.get_user_role() == 'instructor'",
"def has_instructor(self, user, allow_superusers=True):\n return (user.is_superuser and allow_superusers) or len(self.instructors.filter(id=user.id)) > 0",
"def user_auth_... | [
"0.81386656",
"0.7532793",
"0.73093224",
"0.69978017",
"0.698345",
"0.6836744",
"0.6783884",
"0.67611086",
"0.6630022",
"0.6324745",
"0.6300194",
"0.6232442",
"0.6199148",
"0.6169614",
"0.61318046",
"0.6109507",
"0.6062059",
"0.5979534",
"0.59766513",
"0.594827",
"0.59482694"... | 0.75558037 | 1 |
Get or create the video targetted by the LTI launch request. Create the playlist if it does not preexist (it can only happen with consumer site scope passports). Returns core.models.video.Video The video instance targetted by the `resource_link_id` or None. | def get_or_create_video(self):
# Make sure LTI verification have run successfully
assert getattr(self, "_is_verified", False) or self.verify()
# If the video already exist, retrieve it from database
try:
return Video.objects.get(
lti_id=self.resource_link_id,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_video(self, node):\r\n video = Video()\r\n video.embed_code = self.get_embed_code(node)\r\n video.embed_type = self.get_embed_type(node)\r\n video.width = self.get_width(node)\r\n video.height = self.get_height(node)\r\n video.src = self.get_src(node)\r\n vi... | [
"0.5693211",
"0.5600944",
"0.55802214",
"0.55084",
"0.5409407",
"0.53344846",
"0.5296647",
"0.5253671",
"0.5245499",
"0.52425474",
"0.5238066",
"0.5161256",
"0.5144763",
"0.51414907",
"0.5114479",
"0.5111686",
"0.5095367",
"0.50950116",
"0.50758857",
"0.50685847",
"0.5065476"... | 0.82034284 | 0 |
Returns a function that can be used to apply L2 regularization to weights. Small values of L2 can help prevent overfitting the training data. | def l2_regularizer(scale):
if isinstance(scale, numbers.Integral):
raise ValueError('scale cannot be an integer: %s' % (scale,))
if isinstance(scale, numbers.Real):
if scale < 0.:
raise ValueError('Setting a scale less than 0 on a regularizer: %g.' %
scal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l2_regularization_penalty(self):\n return self.l2 * (np.linalg.norm(self.weights)**2)",
"def l2_regularization(cg, rate=0.01):\n W = VariableFilter(roles=[WEIGHT])(cg.variables)\n L2_cost = rate * l2_norm(W)\n\n return L2_cost",
"def l2(weights, name=None):\n with ops.op_scope([weigh... | [
"0.80925715",
"0.7583559",
"0.7576561",
"0.74582547",
"0.73601186",
"0.7323454",
"0.7208186",
"0.72009575",
"0.7194931",
"0.7173504",
"0.7140067",
"0.7136975",
"0.69583756",
"0.68992376",
"0.6839116",
"0.6785489",
"0.66890734",
"0.66434085",
"0.6614264",
"0.65683496",
"0.6568... | 0.77493834 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.