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 |
|---|---|---|---|---|---|---|
Transforms a dictionary to an array | def dict_to_array(dict_array):
plottable_array = []
for k in dict_array:
for i in range(len(dict_array[k])):
plottable_array.append(dict_array[k][i])
return np.array(plottable_array) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _dict2arr(self, key):\r\n # Prepare the matrix for the output:\r\n arr = np.empty((self._n_process,\r\n self._n_process,\r\n self.frequencies.shape[0]))\r\n\r\n arr.fill(np.nan)\r\n\r\n # 'Translate' from dict form into matrix form:\r\n ... | [
"0.7716904",
"0.74117553",
"0.72586393",
"0.69404185",
"0.69150126",
"0.6749544",
"0.6522102",
"0.64815915",
"0.64781576",
"0.6413009",
"0.6413009",
"0.6413009",
"0.6303264",
"0.6301993",
"0.62771434",
"0.62330824",
"0.62071717",
"0.6206633",
"0.6193483",
"0.6190132",
"0.6182... | 0.7651671 | 1 |
File basename for each image | def filenames(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getImageName(self):\n return [os.path.basename(name) for name in self.meta['sources']]",
"def path_to_name(img):\n\n return os.path.dirname(img) + '_' + os.path.basename(img)",
"def filename(self,imgurl):\n if imgurl.find('/'):\n return imgurl.rsplit('/', 1)[1]",
"def get_name... | [
"0.7352464",
"0.71216285",
"0.7055906",
"0.70398676",
"0.6946448",
"0.6945898",
"0.68548864",
"0.6841654",
"0.6776121",
"0.67415255",
"0.67222184",
"0.6716121",
"0.6691554",
"0.6688086",
"0.667925",
"0.6625728",
"0.66162646",
"0.6607814",
"0.65538466",
"0.6549507",
"0.6545046... | 0.60657996 | 68 |
Creates a JSON file with the info found | def store_rdap_info_in_cache(ip_address: str, rdap_info: dict):
file_name = rdap_info_cache_file_name(ip_address)
with open(file_name, 'w') as json_file:
json_file.write(json.dumps(rdap_info, indent=4)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_result_json(json_object, result_json_file):\n write_json_to_file(json_object, result_json_file)",
"def create_gen_json(self, out_file):\n\n params = self.create_package_dict()\n with open(out_file, 'w') as fp:\n json.dump(params, fp)",
"def dump_to_json(fileinfos, out):\n... | [
"0.713244",
"0.7110851",
"0.7093901",
"0.7041432",
"0.70367",
"0.70236546",
"0.6980496",
"0.69653416",
"0.6905427",
"0.6867632",
"0.6849606",
"0.6849606",
"0.6838148",
"0.68260396",
"0.6813116",
"0.67767227",
"0.67631626",
"0.67221147",
"0.6720066",
"0.66981417",
"0.6652454",... | 0.0 | -1 |
Creates a JSON file with the info found | def get_rdap_info_from_cache(ip_address: str) -> dict:
file_name = rdap_info_cache_file_name(ip_address)
if os.path.isfile(file_name):
with open(file_name, 'r') as json_file:
return json.load(json_file)
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_result_json(json_object, result_json_file):\n write_json_to_file(json_object, result_json_file)",
"def create_gen_json(self, out_file):\n\n params = self.create_package_dict()\n with open(out_file, 'w') as fp:\n json.dump(params, fp)",
"def dump_to_json(fileinfos, out):\n... | [
"0.712988",
"0.7108602",
"0.7093646",
"0.7039333",
"0.7036551",
"0.7022436",
"0.697952",
"0.696619",
"0.69035053",
"0.68659693",
"0.6847049",
"0.6847049",
"0.68369484",
"0.6824748",
"0.68113416",
"0.67771864",
"0.67615473",
"0.6722681",
"0.67175215",
"0.6695074",
"0.6651835",... | 0.0 | -1 |
Check if the given user is admin on any of the given ``basenode_modelsclasses``. | def user_is_basenodeadmin(userobj, *basenode_modelsclasses):
for cls in basenode_modelsclasses:
if cls.objects.filter(admins__id=userobj.id).exists():
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_admin(userobj):\n from .node import Node\n from .subject import Subject\n from .period import Period\n from .assignment import Assignment\n return user_is_basenodeadmin(userobj, Node, Subject, Period, Assignment)",
"def user_is_nodeadmin(userobj):\n from .node import Node\n retur... | [
"0.75074613",
"0.71872145",
"0.67723936",
"0.6728365",
"0.6702719",
"0.6669622",
"0.6619164",
"0.6591834",
"0.6438673",
"0.64135385",
"0.63839084",
"0.6375339",
"0.63573587",
"0.63462526",
"0.63462526",
"0.62322205",
"0.6141669",
"0.6135056",
"0.6127203",
"0.6121994",
"0.6058... | 0.8979209 | 0 |
Check if the given user is admin on any node. | def user_is_nodeadmin(userobj):
from .node import Node
return user_is_basenodeadmin(userobj, Node) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_admin(userobj):\n from .node import Node\n from .subject import Subject\n from .period import Period\n from .assignment import Assignment\n return user_is_basenodeadmin(userobj, Node, Subject, Period, Assignment)",
"def user_is_admin(user):\n return user in admins",
"def is_admin(... | [
"0.8304065",
"0.8163822",
"0.8019229",
"0.80012506",
"0.774686",
"0.77353984",
"0.7713613",
"0.76530725",
"0.7613274",
"0.75473917",
"0.7542882",
"0.74798983",
"0.74511456",
"0.743682",
"0.738987",
"0.7372604",
"0.7344619",
"0.7332295",
"0.73101676",
"0.7278022",
"0.71394277"... | 0.8549383 | 0 |
Check if the given user is admin on any subject. | def user_is_subjectadmin(userobj):
from .subject import Subject
return user_is_basenodeadmin(userobj, Subject) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self, user):\n return user.name in self.admins",
"def isAdmin(self, user):\r\n if user.id in self.admins:\r\n return True\r\n return False",
"def user_is_admin(user):\n return user in admins",
"def user_is_admin(userobj):\n from .node import Node\n from .... | [
"0.79580945",
"0.78767395",
"0.78684896",
"0.76678365",
"0.76304615",
"0.7485977",
"0.74841315",
"0.7421653",
"0.74167055",
"0.7400035",
"0.73961306",
"0.7348216",
"0.73316985",
"0.72134113",
"0.7170893",
"0.71677554",
"0.7147372",
"0.71329534",
"0.7031011",
"0.701664",
"0.70... | 0.823072 | 0 |
Check if the given user is admin on any period. | def user_is_periodadmin(userobj):
from .period import Period
return user_is_basenodeadmin(userobj, Period) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_admin(user):\n return user in admins",
"def is_admin(self, user):\n return user.name in self.admins",
"def isAdmin(self, user):\r\n if user.id in self.admins:\r\n return True\r\n return False",
"def is_admin(user):\n return get_organisations_as_admin(user).co... | [
"0.8239995",
"0.81552756",
"0.8112879",
"0.7936112",
"0.7898472",
"0.7839825",
"0.7777998",
"0.7770304",
"0.7756928",
"0.7670378",
"0.7666143",
"0.7666079",
"0.7615323",
"0.76104283",
"0.7549296",
"0.75306493",
"0.74925554",
"0.74402565",
"0.73388255",
"0.7300378",
"0.7181295... | 0.8454804 | 0 |
Check if the given user is admin on any assignment. | def user_is_assignmentadmin(userobj):
from .assignment import Assignment
return user_is_basenodeadmin(userobj, Assignment) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self, user):\n return user.name in self.admins",
"def user_is_admin(user):\n return user in admins",
"def isAdmin(self, user):\r\n if user.id in self.admins:\r\n return True\r\n return False",
"def is_admin(user):\n return get_organisations_as_admin(user).co... | [
"0.81892455",
"0.8139496",
"0.81309795",
"0.8071692",
"0.8010314",
"0.7753458",
"0.7731317",
"0.77231574",
"0.77168936",
"0.7713241",
"0.7673352",
"0.7654865",
"0.76311195",
"0.7525682",
"0.7520479",
"0.74800175",
"0.74731725",
"0.74365914",
"0.7357623",
"0.735086",
"0.730093... | 0.8449063 | 0 |
Check if the given user is admin on any node, subject, period or assignment. | def user_is_admin(userobj):
from .node import Node
from .subject import Subject
from .period import Period
from .assignment import Assignment
return user_is_basenodeadmin(userobj, Node, Subject, Period, Assignment) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(self, user):\n return user.name in self.admins",
"def isAdmin(self, user):\r\n if user.id in self.admins:\r\n return True\r\n return False",
"def user_is_admin(user):\n return user in admins",
"def isAdmin(user):\n return isUserType(user, Admin)",
"def use... | [
"0.8234137",
"0.8219113",
"0.8179075",
"0.79652625",
"0.7921888",
"0.78848743",
"0.7857028",
"0.777923",
"0.77517045",
"0.7732461",
"0.76943475",
"0.7689893",
"0.76728696",
"0.7641392",
"0.76411873",
"0.7497458",
"0.7482674",
"0.7456843",
"0.7447776",
"0.73367286",
"0.7249717... | 0.86975163 | 0 |
Return ``True`` if ``userobj.is_superuser``, and fall back to calling | def user_is_admin_or_superadmin(userobj):
if userobj.is_superuser:
return True
else:
return user_is_admin(userobj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_superuser(self):\n return self.is_admin",
"def test_func(self):\n return self.request.user.is_superuser",
"def is_user_admin(request):\n return request.user.is_superuser",
"def is_superuser(connection, window_info, kwargs):\n return window_info and window_info.is_superuser",
"def... | [
"0.8101867",
"0.7593196",
"0.75198376",
"0.74640405",
"0.74637645",
"0.74127024",
"0.7219238",
"0.71891254",
"0.714725",
"0.714725",
"0.71365285",
"0.6957675",
"0.6896418",
"0.6885751",
"0.67016846",
"0.6677949",
"0.6645459",
"0.663719",
"0.6625612",
"0.661179",
"0.6594986",
... | 0.8356488 | 0 |
Returns ``True`` if the given ``userobj`` is examiner on any AssignmentGroup. | def user_is_examiner(userobj):
from .assignment_group import AssignmentGroup
return AssignmentGroup.published_where_is_examiner(userobj).exists() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_student(userobj):\n from .assignment_group import AssignmentGroup\n return AssignmentGroup.published_where_is_candidate(userobj).exists()",
"def is_examiner(self, user_obj):\n return self.examiners.filter(pk=user_obj.pk).count() > 0",
"def is_user_in_group(user, group):\n users = gr... | [
"0.6832588",
"0.6603086",
"0.64948434",
"0.6482435",
"0.6374413",
"0.6373371",
"0.6373371",
"0.6257962",
"0.6238265",
"0.6225209",
"0.6215527",
"0.6213494",
"0.62088627",
"0.61888325",
"0.6160366",
"0.61520356",
"0.6147361",
"0.61427367",
"0.6125478",
"0.61217946",
"0.6112844... | 0.75469923 | 0 |
Returns ``True`` if the given ``userobj`` is candidate on any AssignmentGroup. | def user_is_student(userobj):
from .assignment_group import AssignmentGroup
return AssignmentGroup.published_where_is_candidate(userobj).exists() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def where_is_candidate(cls, user_obj):\n return AssignmentGroup.objects.filter(cls.q_is_candidate(user_obj))",
"def where_is_candidate(cls, user_obj):\n return AssignmentGroup.objects.filter(cls.q_is_candidate(user_obj))",
"def user_is_examiner(userobj):\n from .assignment_group import Assignm... | [
"0.7243185",
"0.7243185",
"0.6884161",
"0.6395246",
"0.63796234",
"0.6249731",
"0.6229115",
"0.620254",
"0.61357117",
"0.6120343",
"0.61027586",
"0.60956186",
"0.6065006",
"0.6044624",
"0.6042915",
"0.60406387",
"0.6028769",
"0.60010755",
"0.5994618",
"0.5985737",
"0.59745675... | 0.7118363 | 2 |
returns number of collisions with obstacles. | def get_collisions(self) -> int:
if len(self.obstacles) == 0:
return 0
collision_list = [ob.detect_collision(self.agent)
for ob in self.obstacles]
return sum(collision_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_collisions(self) -> int:\n c = 0\n for o in self.obstacles:\n if not isinstance(o, Bomb):\n continue # only consider apples\n xy_diff = o.get_position()[:2] - self.agent.get_position()[:2]\n dist = np.linalg.norm(xy_diff)\n # obstacl... | [
"0.81196576",
"0.79980856",
"0.7808652",
"0.7637748",
"0.7572755",
"0.72783536",
"0.7093945",
"0.6678259",
"0.66152805",
"0.6540448",
"0.6500547",
"0.64132005",
"0.63525105",
"0.6293102",
"0.62838686",
"0.6276657",
"0.62761164",
"0.62751365",
"0.6267403",
"0.62049884",
"0.614... | 0.8029333 | 1 |
Returns the reward of an agent running in a circle (clockwise). | def calculate_reward(self):
vel = self.agent.get_linear_velocity()[:2]
pos = self.agent.get_position()[:2]
dist = np.linalg.norm(pos)
# position vector and optimal velocity are orthogonal to each other:
# optimal reward when position vector and orthogonal velocity
# point... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self):\n total = 0\n # Penalties for being close to obstacles:\n # -0.25 for being within some threshold\n # -1 for colliding (radii overlap)\n col_reward = -1\n close_reward = -0.25\n close_thresh = 0.2\n pred_mul = 0.05 # Factor to multip... | [
"0.69788706",
"0.6913847",
"0.68856907",
"0.6844754",
"0.68434155",
"0.6836729",
"0.6820504",
"0.6815808",
"0.67429125",
"0.6730215",
"0.6726372",
"0.6719421",
"0.6709121",
"0.6657038",
"0.6639742",
"0.6580254",
"0.6574125",
"0.65536547",
"0.65355223",
"0.6515359",
"0.6454454... | 0.7273742 | 0 |
Retrieves and parses the command line arguments created. This function returns these arguments as an ArgumentParser object. | def getArguments():
parser = argparse.ArgumentParser()
# Manditory arguments
parser.add_argument('img_path', type=str, help='path to input image')
parser.add_argument('checkpoint', type=str, help='path to a saved checkpoint')
#option arguments
parser.add_argument('--top_k', type=int, defau... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_arguments():\n\n args = Arguments()\n parser = argparse.ArgumentParser(\"Update river flow directions\")\n parser.add_argument('python_config_filename',\n metavar='python-config-filename',\n help='Full path to python configuration file',\n ... | [
"0.8101644",
"0.7891225",
"0.78739464",
"0.77414733",
"0.7707538",
"0.7707538",
"0.7690002",
"0.76611745",
"0.7660861",
"0.76363665",
"0.7617808",
"0.7615412",
"0.7611571",
"0.7601736",
"0.7596653",
"0.75512385",
"0.7536165",
"0.7499541",
"0.7475716",
"0.7473476",
"0.7470641"... | 0.72248435 | 89 |
Returns the out_seq_lens_nonmask 0/1 tensor after a layer. | def get_out_seq_lens_nonmask_after_a_layer(self, in_seq_lens_tensor, i):
out_lengths = in_seq_lens_tensor.clone()
out_lengths = ((out_lengths.float() - (self.conv_layers_infos[i][1] - 1) - 1) / self.conv_layers_infos[i][-1] + 1).floor().long()
out_nonmask = (~lengths_to_padding_mask(out_lengths)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mask_lm_output(self, mask_pos, mask_label, mask_type):\n mask_pos = fluid.layers.cast(x=mask_pos, dtype='int32')\n\n reshaped_emb_out = fluid.layers.reshape(\n x=self._enc_out, shape=[-1, self._emb_size])\n # extract masked tokens' feature\n mask_feat = fluid.layers.g... | [
"0.586713",
"0.582063",
"0.5786363",
"0.57802397",
"0.5481261",
"0.54467213",
"0.54245996",
"0.54244536",
"0.5329458",
"0.5323543",
"0.5323543",
"0.5323543",
"0.5315426",
"0.5312834",
"0.5308409",
"0.5300618",
"0.530058",
"0.52980006",
"0.5292053",
"0.5285012",
"0.5282428",
... | 0.78858453 | 0 |
Processes the data, stored in JSON format, in a given directory, saving it in the corresponding data model in Postgres. | def process_data(cursor, connection, filepath, function):
# get all files matching extension from directory
all_files = []
for root, dirs, files in os.walk(filepath):
files = glob.glob(os.path.join(root, '*.json'))
for f in files:
all_files.append(os.path.abspath(f))
# get t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_data(cur, conn, filepath, func):\n # get all files matching extension from directory\n all_files = []\n for root, dirs, files in os.walk(filepath):\n files = glob.glob(os.path.join(root,'*.json'))\n for f in files :\n all_files.append(os.path.abspath(f))\n\n # get t... | [
"0.6343805",
"0.6222039",
"0.62200797",
"0.62184113",
"0.62047994",
"0.618787",
"0.618787",
"0.6185985",
"0.61451817",
"0.6123075",
"0.61073065",
"0.6106066",
"0.60892123",
"0.6080363",
"0.6078231",
"0.6024474",
"0.6002126",
"0.5996768",
"0.5959587",
"0.5922004",
"0.5871835",... | 0.6041136 | 15 |
Returns the first_name plus the last_name, with a space in between. | def get_full_name(self):
full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name):\n return first_name + \" \" + last_name",
"def full_name(first_name, last_name):\n\t\n\treturn first_name + \" \" + last_name",
"def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()",
"def get_full_name(se... | [
"0.8313066",
"0.82006806",
"0.8049215",
"0.80409706",
"0.8017754",
"0.7999701",
"0.79541886",
"0.7942144",
"0.7942144",
"0.7942144",
"0.7937664",
"0.79287225",
"0.7921711",
"0.790314",
"0.7892264",
"0.7890117",
"0.7878668",
"0.786143",
"0.78528684",
"0.7823523",
"0.7813124",
... | 0.77466476 | 50 |
Returns the short name for the user. | def get_short_name(self):
return self.first_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n return self.username",
"def get_short_name(self):\n # The user is identified by their email address\n return self.first_name",
"def get_shor... | [
"0.90316343",
"0.90316343",
"0.90316343",
"0.8829965",
"0.88074076",
"0.8665172",
"0.8423785",
"0.8335693",
"0.8307673",
"0.8281205",
"0.8281205",
"0.81919736",
"0.8174178",
"0.8150322",
"0.81289876",
"0.80974096",
"0.80956835",
"0.8077189",
"0.79694206",
"0.79643494",
"0.796... | 0.81823653 | 24 |
Tests initializer and its properties. | def test_init(self):
hand = Dicehand()
self.assertIsInstance(hand, Dicehand)
self.assertEqual(hand.current_score, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_01_Init(self):\n pass",
"def testInitializer(self):\n request = http.HttpRequest()\n\n data, check, mutator = initialize.MELANGE_INITIALIZER.initialize(\n request, [], {})\n self.assertEqual(request, data.request)\n self.assertEqual(data, check.data)\n self.assertEqual(data,... | [
"0.74719346",
"0.72101635",
"0.7054714",
"0.7015979",
"0.6991314",
"0.69315845",
"0.690993",
"0.69092405",
"0.68982464",
"0.68671656",
"0.68605787",
"0.68587226",
"0.6844563",
"0.68384296",
"0.6835398",
"0.68326217",
"0.6804238",
"0.6800805",
"0.67782724",
"0.6777362",
"0.677... | 0.6440383 | 74 |
List all commit references Returns list includes all commit ref ids present Raises CodeNotInitialized error if not initialized (must initialize first) | def list_refs(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refs(self):\n p = Popen(['git', 'show-ref', '--no-head'], cwd=self.path, stdout=PIPE)\n for line in p.stdout:\n commit_id, refname = line.split()\n yield (CommitId(commit_id), refname)",
"def list_all_commits(refenv):\n refTxn = TxnRegister().begin_reader_txn(refenv)\n ... | [
"0.72545564",
"0.68439555",
"0.6703674",
"0.6617218",
"0.65344036",
"0.62877834",
"0.61376417",
"0.6025337",
"0.59926665",
"0.59783536",
"0.59316975",
"0.5928121",
"0.5904151",
"0.5899139",
"0.5882631",
"0.586003",
"0.58554137",
"0.5848888",
"0.5813637",
"0.5806741",
"0.58063... | 0.6815758 | 2 |
Sets the learning rate to the initial LR decayed by 10 every 30 epochs | def adjust_learning_rate(optimizer, batch):
lr = learning_rate
for i in range(len(steps)):
scale = scales[i] if i < len(scales) else 1
if batch >= steps[i]:
lr = lr * scale
if batch == steps[i]:
break
else:
break
for param_group in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l... | [
"0.79127383",
"0.79066503",
"0.78498656",
"0.7774931",
"0.77338964",
"0.7730826",
"0.7722896",
"0.7722237",
"0.77194464",
"0.7709206",
"0.76935464",
"0.7674053",
"0.7665731",
"0.7665731",
"0.7665731",
"0.7655236",
"0.76419014",
"0.7639727",
"0.76378405",
"0.76258314",
"0.7624... | 0.0 | -1 |
The ID of the Organization. | def id(self) -> str:
return pulumi.get(self, "id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def organization_id(self) -> str:\n return pulumi.get(self, \"organization_id\")",
"def organization_id(self):\n return self._organization_id",
"def organization_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"organization_id\")",
"def organization_id(self) -> Optio... | [
"0.88427335",
"0.8838588",
"0.83058923",
"0.81215197",
"0.81215197",
"0.7940116",
"0.7912713",
"0.77482307",
"0.7621505",
"0.7247468",
"0.72249633",
"0.71624565",
"0.7100551",
"0.70624644",
"0.7009935",
"0.6994091",
"0.69573253",
"0.6875446",
"0.6755191",
"0.6755191",
"0.6755... | 0.0 | -1 |
Converts the 8 byte array into a floating point number. | def toDouble(self, buff):
right, left = struct.unpack("<Ii", struct.pack("B" * 8, *buff[0:8]))
return float(left) + float(right)/(2**32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calculate_float(byte_array):\n\tif len(byte_array) != 4:\n\t\treturn None\n\n\t'''\n\tmsg_prefix = \"[_calculate_float] \"\n\tprint(f\"{msg_prefix}byte_array = {[hex(b) for b in byte_array]}\")\n\t\n\t# if OPC_BIT_ORDER == MB_BIT_ORDER:\n\tpack_fstr = '4B'\n\tprint(f\" --> Using '{pack_fstr}' as pack_str: f ... | [
"0.7508647",
"0.72493625",
"0.72330314",
"0.69877994",
"0.6918354",
"0.6918354",
"0.6895989",
"0.67235994",
"0.6585988",
"0.65764993",
"0.6544509",
"0.65440744",
"0.6491806",
"0.6463703",
"0.63883305",
"0.6269505",
"0.6265981",
"0.6203582",
"0.61874086",
"0.61519367",
"0.6144... | 0.5831713 | 35 |
Flask app instance fixture with an active request context. | def app(request):
_app = create_app(TestConfig)
request.instance.app = _app
ctx = _app.test_request_context()
ctx.push()
request.addfinalizer(ctx.pop)
return _app | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app(request) -> Application:\n global fixture\n if fixture is None:\n fixture = WebApplication()\n return fixture",
"def app():\n app = create_app(schema=create_schema())\n with app.test_request_context():\n yield app",
"def app():\n _app = create_app(TestConfig)\n ctx = ... | [
"0.8106654",
"0.71551263",
"0.7140039",
"0.7140039",
"0.7140039",
"0.70919913",
"0.7088383",
"0.70716965",
"0.7067297",
"0.6926916",
"0.68504953",
"0.68315095",
"0.67684615",
"0.676801",
"0.6758549",
"0.6719377",
"0.66713685",
"0.66111773",
"0.6599813",
"0.65381724",
"0.65169... | 0.7096249 | 5 |
Modify the name of some stars so it matches the simbad naming scheme | def correctname(star):
# Correction for the BPS stars.
if star.startswith('BS') or star.startswith('CS'):
star = 'BPS ' + star
#
return star | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_normalize_star_name(self):\n self.assertEqual(normalize_star_name(\"RR LYR\"), \"RR LYR\")\n self.assertEqual(normalize_star_name(\"V1339 CYG\"), \"V1339 CYG\")\n self.assertEqual(normalize_star_name(\"V838 MON\"), \"V0838 MON\")",
"def modify_player_name(player):\n\n final_name ... | [
"0.753977",
"0.6816095",
"0.6550652",
"0.6441952",
"0.63825786",
"0.6356087",
"0.6205159",
"0.6200491",
"0.6193214",
"0.61577076",
"0.6138408",
"0.6127415",
"0.6098515",
"0.60366595",
"0.599788",
"0.59791213",
"0.5920035",
"0.5911343",
"0.5898247",
"0.5887512",
"0.58669347",
... | 0.8185191 | 0 |
Inits the particle velocity and its allowed maximum speed. | def init_pvelocity(self, population):
for individual in population:
# the initial speed is set to zero
individual.features['velocity'] = [0] * len(individual.vector)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_pvelocity(self, individuals):\n for individual in individuals:\n # the initial speed is set to zero\n individual.features['velocity'] = [0] * len(individual.vector)\n\n return",
"def __init__(self):\n self.position = Vector2()\n self.velocity = Vector2()... | [
"0.72131735",
"0.6905405",
"0.6862289",
"0.67463565",
"0.6669385",
"0.6586608",
"0.65545017",
"0.6478389",
"0.64332765",
"0.6404541",
"0.63873726",
"0.6354943",
"0.63332903",
"0.6327783",
"0.6307448",
"0.63064015",
"0.6289939",
"0.6237919",
"0.61972696",
"0.6138388",
"0.61366... | 0.7059268 | 1 |
Inits the particle velocity and its allowed maximum speed. | def init_pvelocity(self, individuals):
for individual in individuals:
# the initial speed is set to zero
individual.features['velocity'] = [0] * len(individual.vector)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_pvelocity(self, population):\n for individual in population:\n # the initial speed is set to zero\n individual.features['velocity'] = [0] * len(individual.vector)\n\n return",
"def __init__(self):\n self.position = Vector2()\n self.velocity = Vector2()\n... | [
"0.7059268",
"0.6905405",
"0.6862289",
"0.67463565",
"0.6669385",
"0.6586608",
"0.65545017",
"0.6478389",
"0.64332765",
"0.6404541",
"0.63873726",
"0.6354943",
"0.63332903",
"0.6327783",
"0.6307448",
"0.63064015",
"0.6289939",
"0.6237919",
"0.61972696",
"0.6138388",
"0.613662... | 0.72131735 | 0 |
Save statistics as JSON to path. | def save(self, path):
if not is_dry():
with open(path, 'w') as f:
json.dump(self.to_dict(), f, indent=4)
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_stats_to_json(self, stats: Dict, path: str) -> None:\n if os.path.isfile(path):\n with open(path, 'r') as json_file:\n prev_data = json.load(json_file)\n json_file.close()\n with open(path, 'w') as json_file:\n stats['season'] = se... | [
"0.72718054",
"0.71823627",
"0.70791715",
"0.6993506",
"0.6980624",
"0.6925214",
"0.6916484",
"0.68657494",
"0.6827227",
"0.6803783",
"0.67951244",
"0.6783692",
"0.67772293",
"0.67621535",
"0.6758676",
"0.6756246",
"0.6756246",
"0.6756246",
"0.6751945",
"0.67517185",
"0.66916... | 0.6874262 | 7 |
Checking unique of email | def verification_unique_email(value: str) -> str:
user = User.objects.filter(email=value)
if len(user) == 0:
return value
else:
raise serializers.ValidationError('User with given credentials already exist') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_duplicate_email(self):\n self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n rv = self.signup('Bo', 'Theo', 'Bo_theo5@example.com', 'Bo1995', 'Bo1995')\n self.assertIn(b'Sorry email already exist', rv.data)",
"def unique_email(cls, email):\n user_db = User... | [
"0.74172384",
"0.7325195",
"0.7296276",
"0.720516",
"0.7200636",
"0.7079692",
"0.707929",
"0.7028647",
"0.69408876",
"0.6932549",
"0.69290817",
"0.69290817",
"0.69247174",
"0.69138837",
"0.6909467",
"0.6902798",
"0.68704295",
"0.68469507",
"0.6827975",
"0.6809443",
"0.6807443... | 0.73858577 | 1 |
Get the path of the underlying resource file on disk. | def _get_filesystem_path(self, request):
return self._get_path(filesystem_path(self.base_path, request, self.url_base), False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(self) -> Union[str, 'BytesIO']:\n return self._filepath",
"def get_path(self):\n try:\n return self._file.path\n except AttributeError:\n return os.path.abspath(self._file.name)",
"def path(self):\n return self.file_path()",
"def file_path(self):... | [
"0.78451467",
"0.77726066",
"0.7687821",
"0.7644883",
"0.7604024",
"0.7604024",
"0.7569047",
"0.75205386",
"0.7397398",
"0.73901826",
"0.73768204",
"0.7269436",
"0.72458535",
"0.71894246",
"0.71743417",
"0.71575576",
"0.7127923",
"0.70964015",
"0.7095085",
"0.7089015",
"0.708... | 0.0 | -1 |
Get an iterator over strings to inject into the wrapper document based on // META comments in the associated js file. | def _get_meta(self, request):
for key, value in self._get_metadata(request):
replacement = self._meta_replacement(key, value)
if replacement:
yield replacement | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getComments(source):\n\n markup = []\n for f in source:\n markup += extractMarkup(f)\n\n docs = collateDocs(markup)\n return docs",
"def getHTMLComments(self, text):\n return self.doSpecial(text, '<!--', '-->', self.fParseHTMLComments)",
"def get_includes(self):\r\n def vis... | [
"0.61930174",
"0.5363915",
"0.5353047",
"0.5278398",
"0.52765554",
"0.526923",
"0.52394974",
"0.52261084",
"0.5200615",
"0.5163169",
"0.5151243",
"0.5131049",
"0.5130511",
"0.5114781",
"0.51141745",
"0.51127803",
"0.508061",
"0.50769866",
"0.5033724",
"0.5027854",
"0.5024402"... | 0.0 | -1 |
Get an iterator over strings to inject into the wrapper document based on // META comments in the associated js file. | def _get_script(self, request):
for key, value in self._get_metadata(request):
replacement = self._script_replacement(key, value)
if replacement:
yield replacement | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getComments(source):\n\n markup = []\n for f in source:\n markup += extractMarkup(f)\n\n docs = collateDocs(markup)\n return docs",
"def getHTMLComments(self, text):\n return self.doSpecial(text, '<!--', '-->', self.fParseHTMLComments)",
"def get_includes(self):\r\n def vis... | [
"0.6194778",
"0.5365843",
"0.5352076",
"0.52793175",
"0.527703",
"0.5269388",
"0.52396077",
"0.5224519",
"0.5200928",
"0.5164034",
"0.5149325",
"0.51320857",
"0.51285404",
"0.5115131",
"0.5114966",
"0.51132226",
"0.5081829",
"0.5077876",
"0.503439",
"0.5030372",
"0.50251234",... | 0.4774178 | 63 |
Return the total number of nodes in the tree. | def size(self):
if self.val is None:
return 0
left_size = self.left.size() if self.left is not None else 0
right_size = self.right.size() if self.right is not None else 0
return left_size + right_size + 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(self):\n return self.__tree.node_count",
"def count_nodes(self):\n if self.children is None:\n return 0\n\n total_count = 0\n for child in self.children:\n if child is None:\n return 0\n child_count = child.count_nodes()\n ... | [
"0.85687757",
"0.85413194",
"0.8522654",
"0.8436459",
"0.8399668",
"0.83715934",
"0.8308868",
"0.8308209",
"0.8264485",
"0.8232832",
"0.82035106",
"0.818451",
"0.81750125",
"0.8153791",
"0.8153791",
"0.8148885",
"0.8125134",
"0.8054832",
"0.8052011",
"0.80375385",
"0.79811054... | 0.0 | -1 |
Return a positive or negative number representing tree balance. Trees higher on the left than the right should return a positive value, trees higher on the right than the left should return a negative value. An ideallybalanced tree should return 0. | def balance(self):
left_depth = self.left.depth() if self.left is not None else 0
right_depth = self.right.depth() if self.right is not None else 0
return left_depth - right_depth | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balance(self):\n if self.val is None:\n return 0\n return self.left.depth() - self.right.depth()",
"def balance(self, node=None):\n if node is None:\n node = self.root\n if self.root is None:\n return 0\n if not node.left and not nod... | [
"0.8039895",
"0.7723211",
"0.7540132",
"0.72661793",
"0.71379143",
"0.70001286",
"0.6991692",
"0.6952617",
"0.6926647",
"0.68191206",
"0.68046635",
"0.6773328",
"0.6770786",
"0.6658117",
"0.66456735",
"0.6588191",
"0.65737176",
"0.65671283",
"0.6554217",
"0.6418149",
"0.64058... | 0.79244626 | 1 |
Perform a single right tree rotation. | def _rotate_right(self):
pivot = self.left
if pivot is None:
return
self.val, pivot.val = pivot.val, self.val
self.left = pivot.left
if self.left is not None:
self.left.parent = self
pivot.left = pivot.right
pivot.right = self.right
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_right(self):\n\t\ttemp = self.left\n\t\tself.left = temp.right\n\t\ttemp.right = self\n\t\tself = temp",
"def _right_rotation(self, node):\n # First update the subtree sizes\n node.left_subtree_size = node.left.right_subtree_size\n node.left.right_subtree_size = self.total_size(no... | [
"0.77899694",
"0.77557087",
"0.7685741",
"0.7658409",
"0.75555164",
"0.750749",
"0.7470561",
"0.7454052",
"0.74441755",
"0.74391174",
"0.7371549",
"0.73649895",
"0.72439694",
"0.72438097",
"0.72063446",
"0.71717095",
"0.71227735",
"0.7084298",
"0.70462203",
"0.70268184",
"0.7... | 0.73943114 | 10 |
Perform a single left tree rotation. | def _rotate_left(self):
pivot = self.right
if pivot is None:
return
self.val, pivot.val = pivot.val, self.val
self.right = pivot.right
if self.right is not None:
self.right.parent = self
pivot.right = pivot.left
pivot.left = self.left
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rotate_left(self, og_root):\r\n new_root = og_root.right\r\n og_root.right = new_root.left\r\n if new_root.left:\r\n new_root.left.parent = og_root\r\n new_root.parent = og_root.parent\r\n if og_root is self.root: # if our original root of the rotation is the tre... | [
"0.7882461",
"0.7880566",
"0.78444725",
"0.7777407",
"0.76715195",
"0.7586295",
"0.7517077",
"0.75027514",
"0.74254084",
"0.7364508",
"0.73447937",
"0.73233616",
"0.7304442",
"0.7298041",
"0.72859406",
"0.7222976",
"0.71912783",
"0.7165202",
"0.71301687",
"0.7087952",
"0.7064... | 0.73927164 | 9 |
Return a generator with tree values from inorder traversal | def in_order(self):
stack = []
node = self
while stack or node:
if node:
stack.append(node)
node = node.left
else:
node = stack.pop()
yield node.val
node = node.right | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inorder_generator(self):\n\n for val in self.inorder_helper_generator(self.root):\n yield val",
"def inorder(self):\n if not self.is_empty():\n for p in self._subtree_inorder(self.root()):\n yield p",
"def inorder(self):\n if self.left:\n yield from self.left.inorde... | [
"0.80125874",
"0.76851505",
"0.7529662",
"0.74396837",
"0.74155194",
"0.7413878",
"0.73937726",
"0.73599786",
"0.72921896",
"0.7228334",
"0.7145247",
"0.71014524",
"0.7098346",
"0.7079174",
"0.70749915",
"0.70530444",
"0.7005203",
"0.69045246",
"0.68904316",
"0.6868409",
"0.6... | 0.7759304 | 1 |
Create a balanced binary search tree from a given range. | def create_best_case(cls, n):
return cls._sorted_list_to_bst(range(n), 0, n - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def balanced_tree(ordered):\n bt = BinaryTree()\n\n add_range(bt, ordered, 0, len(ordered)-1)\n\n return bt",
"def createBST(self, nums, start, end):\n if end < start:\n return None\n mid = int((start+end)/2)\n #create a new node\n root = TreeNode(nums[mid])\n ... | [
"0.6799043",
"0.6731972",
"0.64144486",
"0.6232138",
"0.61216563",
"0.60258806",
"0.59815013",
"0.59161216",
"0.58386874",
"0.581938",
"0.5810159",
"0.58092517",
"0.5717358",
"0.5651295",
"0.56093353",
"0.5604545",
"0.5598633",
"0.55935615",
"0.5586501",
"0.55844414",
"0.5565... | 0.5637386 | 14 |
Create an unbalanced binary search tree from a given range. The tree will be one long linear branch to the right. | def create_worst_case(cls, n):
node = Node(0)
parent = node
for i in range(1, n):
parent.right = Node(i, parent)
parent = parent.right
return node | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createBST(self, nums, start, end):\n if end < start:\n return None\n mid = int((start+end)/2)\n #create a new node\n root = TreeNode(nums[mid])\n root.left = self.createBST(nums, start,mid -1)\n root.right = self.createBST(nums, mid +1 ,end)\n return... | [
"0.69793135",
"0.6739142",
"0.66125846",
"0.6557313",
"0.652133",
"0.6499033",
"0.63829756",
"0.6209519",
"0.61940664",
"0.61718774",
"0.6138521",
"0.6096865",
"0.6078573",
"0.6054237",
"0.6042109",
"0.602197",
"0.60092854",
"0.59989035",
"0.5929552",
"0.59124994",
"0.5860782... | 0.5573177 | 40 |
r"""Calculates the first order density matrix from the zeroth and first | def get_p1(g0, g1, complexsymmetric, nelec):
if not complexsymmetric:
p1 = (np.dot(g0[:,0:nelec], g1[:,0:nelec].T.conj())
+ np.dot(g1[:,0:nelec], g0[:,0:nelec].T.conj()))
else:
p1 = (np.dot(g0[:,0:nelec], g1[:,0:nelec].T)
+ np.dot(g1[:,0:nelec], g0[:,0:nelec].T))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_order(self):\n for i in range(1,self.N+1):\n self.d1[i] = self.C[i] / 2 / i;",
"def get_density(matrix):\n return matrix.getnnz() / (matrix.shape[0] * matrix.shape[1])",
"def prepare_first_guess(\n self,\n rate_matrix_index,\n atomic_numbers,\n number_... | [
"0.7116722",
"0.6295839",
"0.6000621",
"0.5696214",
"0.5618397",
"0.5574115",
"0.55616623",
"0.55346024",
"0.55239815",
"0.55101705",
"0.5495276",
"0.5479238",
"0.54728246",
"0.54707515",
"0.5418903",
"0.5396695",
"0.5389974",
"0.53895426",
"0.5389471",
"0.5383282",
"0.537045... | 0.0 | -1 |
r"""Calculates the first order electronic energy. | def get_e1_elec(mol, g1, atom, coord, complexsymmetric: bool, nelec,
g0_ghf = None):
if g0_ghf is None:
m = scf.RHF(mol)
m.verbose = 0
m.kernel()
g0_rhf = m.mo_coeff
g0 = rhf_to_ghf(g0_rhf, nelec)
else:
g0 = g0_ghf
p0 = get_p0(g0, complexsymm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy_func(self):\n i = self.inl[0].to_flow()\n o = self.outl[0].to_flow()\n\n T_m = (T_mix_ph(i, T0=self.inl[0].T.val_SI) +\n T_mix_ph(o, T0=self.outl[0].T.val_SI)) / 2\n\n iam = (\n 1 - self.iam_1.val * abs(self.aoi.val) -\n self.iam_2.val * se... | [
"0.64859074",
"0.6399743",
"0.638939",
"0.62921494",
"0.62893265",
"0.6218373",
"0.62077016",
"0.6203341",
"0.61938953",
"0.61861736",
"0.6172226",
"0.6140906",
"0.6140512",
"0.6105476",
"0.6077488",
"0.6068834",
"0.6039056",
"0.5995692",
"0.59814215",
"0.59785604",
"0.597524... | 0.56724596 | 61 |
Return the first element of a linked list s. | def first(s):
assert is_link(s), "first only applies to linked lists."
assert s != empty, "empty linked list has no first element."
return s[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(s):\n assert is_link(s), 'fist only applies to a linked list.'\n assert s != empty, 'empty linked list has no first element.'\n return s[0]",
"def first(s):\n assert is_link(s), 'first only applies to linked lists.'\n assert s != empty, 'empty linked list has no first element.'\n retu... | [
"0.87514794",
"0.871503",
"0.85676473",
"0.75687796",
"0.746576",
"0.746576",
"0.7441065",
"0.7346828",
"0.7168149",
"0.6926616",
"0.67954206",
"0.6678216",
"0.6676683",
"0.66618425",
"0.66400766",
"0.66290796",
"0.6620714",
"0.66205895",
"0.65884966",
"0.657189",
"0.6551129"... | 0.86947113 | 2 |
Return the element at index i of linked list s. | def getitem_link(s, i):
while i > 0:
s, i = rest(s), i - 1
return first(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getitem(s, i):\n while i > 0:\n s, i = rest(s), i - 1\n return first(s)",
"def getNode(self, i):\n if i < 0 or i > self.list_size - 1:\n raise self.NoSuchNodeException()\n\n current = 0\n p = self.head\n\n while current < i:\n p = p.next_node\n ... | [
"0.71192235",
"0.67002785",
"0.6601827",
"0.65486467",
"0.65441895",
"0.6541904",
"0.6516193",
"0.65045977",
"0.6500233",
"0.64919174",
"0.64919174",
"0.6417553",
"0.63624185",
"0.6353479",
"0.633025",
"0.6302461",
"0.62867814",
"0.6258463",
"0.62567174",
"0.62474245",
"0.620... | 0.70254594 | 1 |
Return the element at index i of linked list s. | def getitem_link_recursive(s, i):
if i == 0:
return first(s)
return getitem_link_recursive(rest(s), i - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getitem(s, i):\n while i > 0:\n s, i = rest(s), i - 1\n return first(s)",
"def getitem_link(s, i):\n while i > 0:\n s, i = rest(s), i - 1\n return first(s)",
"def getitem_link(s, i):\n while i > 0:\n s, i = rest(s), i - 1\n return first(s)",
"def getNode(self, i):\n... | [
"0.7119663",
"0.70251864",
"0.70251864",
"0.66970545",
"0.65989643",
"0.6547159",
"0.6541305",
"0.6541108",
"0.6515459",
"0.6503586",
"0.64988256",
"0.641656",
"0.6361373",
"0.63502914",
"0.6329331",
"0.63011813",
"0.6285367",
"0.6258275",
"0.62558365",
"0.6246157",
"0.620575... | 0.6492229 | 12 |
test if a Point falls within the rectangle | def contains(self, point : Point):
return ( self.corner.x <= point.x <= (self.corner.x + self.width)
and self.corner.y <= point.y <= (self.corner.y + self.height)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inside(point, rectangle):\r\n\r\n ll = rectangle.getP1() # assume p1 is ll (lower left)\r\n ur = rectangle.getP2() # assume p2 is ur (upper right)\r\n\r\n return (ll.getX() < point.getX() < ur.getX() \\\r\n and ll.getY() < point.getY() < ur.getY())",
"def inside(point, rectangle):\n\n ... | [
"0.851891",
"0.84796774",
"0.8247252",
"0.81373984",
"0.80678076",
"0.7842683",
"0.7784277",
"0.77277476",
"0.77277476",
"0.76846856",
"0.7670078",
"0.7670078",
"0.7624003",
"0.7567171",
"0.7508195",
"0.74886453",
"0.74746567",
"0.7464967",
"0.7456796",
"0.7445112",
"0.743852... | 0.7168395 | 36 |
Returns an image with reduced opacity. | def reduce_opacity(im, opacity):
assert opacity >= 0 and opacity <= 1
if im.mode != 'RGBA':
im = im.convert('RGBA')
else:
im = im.copy()
alpha = im.split()[3]
alpha = PIL.ImageEnhance.Brightness(alpha).enhance(opacity)
im.putalpha(alpha)
return im | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reduce_opacity(image, opacity):\n assert 0 <= opacity <= 1\n if image.mode != 'RGBA':\n image = image.convert('RGBA')\n else:\n image = image.copy()\n alpha = image.split()[-1]\n alpha = ImageEnhance.Brightness(alpha).enhance(opacity)\n image.putalpha(alpha)\n return image",
... | [
"0.78166837",
"0.7802897",
"0.74435055",
"0.74339646",
"0.66039836",
"0.654266",
"0.65065664",
"0.6437203",
"0.6363465",
"0.63616127",
"0.6357519",
"0.6222415",
"0.6136852",
"0.6124519",
"0.6112217",
"0.6095265",
"0.60857534",
"0.60363156",
"0.596194",
"0.5949253",
"0.5938902... | 0.7742371 | 2 |
Get the label for an enum value. | def get(cls, key: t.Any, default: t.Optional[t.Any] = None) -> t.Any:
return cls.__labels__.get(key, default) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value_label(self, value):\n return self.label_config.get_index_label(value)",
"def label(self):\n # type: () -> str\n labels = self.__class__.__labels__\n return force_str(labels.get(self.value, self.name))",
"def get_label(cls):\r\n return cls._type_name(cls.label)",... | [
"0.75217116",
"0.7076176",
"0.68368405",
"0.68146014",
"0.6797892",
"0.66631883",
"0.66227305",
"0.6603492",
"0.65859795",
"0.6548247",
"0.65019107",
"0.65019107",
"0.65019107",
"0.65019107",
"0.6474116",
"0.6428022",
"0.64247847",
"0.6420268",
"0.6327167",
"0.6327167",
"0.63... | 0.0 | -1 |
Get all enum values. | def keys(cls) -> t.List[t.Any]:
return list(cls.__labels__.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def availableValues(self):\n return [x.name for x in self._field.enum_type.values]",
"def enums(self):\n return self._enums",
"def __iter__(self):\n return iter(self._enums)",
"def enum_names(self):\n return [enum.name for enum in self]",
"def all_values(cls) -> List[str]:\n ... | [
"0.7730608",
"0.7613282",
"0.69645846",
"0.691815",
"0.6907428",
"0.6606357",
"0.6532784",
"0.64909154",
"0.6423686",
"0.64169514",
"0.6411417",
"0.6303053",
"0.62709874",
"0.6203579",
"0.6201847",
"0.6198337",
"0.61571854",
"0.6127556",
"0.6093289",
"0.60720605",
"0.60539603... | 0.0 | -1 |
Return self <= other. | def __le__(self, other: t.Any) -> bool:
return self._op_bool('__le__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return self <= other and self >= other",
"def __ge__(self, other):\n return other <= self",
"def __lt__(self, other):\n return self <= other and self != other",
"def __lt__(self, other):\n return self <= other and self != other",
"def __gt__(self, othe... | [
"0.8944453",
"0.8897055",
"0.8612581",
"0.8612581",
"0.8536712",
"0.8521748",
"0.85075897",
"0.8476024",
"0.84713805",
"0.8454971",
"0.84511197",
"0.8400779",
"0.83994305",
"0.83994305",
"0.8355727",
"0.8344274",
"0.8344274",
"0.8342608",
"0.83416176",
"0.832795",
"0.8234658"... | 0.0 | -1 |
Return self < other. | def __lt__(self, other: t.Any) -> bool:
return self._op_bool('__lt__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __lt__(self, other):\n return self <= other and self != other",
"def __lt__(self, other):\n return self <= other and self != other",
"def __lt__(self, other):\n return self <= other and not self >= other",
"def __lt__(self, other):\n return self.__cmp__(other) < 0",
"def __l... | [
"0.8965322",
"0.8965322",
"0.89625365",
"0.8899276",
"0.88270986",
"0.87916887",
"0.87398475",
"0.8721928",
"0.8721928",
"0.86588275",
"0.8652368",
"0.86517364",
"0.8636092",
"0.863509",
"0.8611288",
"0.8607614",
"0.8603816",
"0.85785884",
"0.85785884",
"0.857542",
"0.8564155... | 0.80426747 | 77 |
Return self == other. | def __eq__(self, other: t.Any) -> bool:
return self._op_bool('__eq__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return self is other",
"def __eq__(self, other):\n return equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, othe... | [
"0.9198537",
"0.9198537",
"0.9066762",
"0.9051376",
"0.9051376",
"0.90299064",
"0.8804954",
"0.87542135",
"0.87542135",
"0.8745204",
"0.87217265",
"0.87139297",
"0.8660616",
"0.8639041",
"0.8623532",
"0.8623532",
"0.861087",
"0.86094683",
"0.85829055",
"0.8562941",
"0.8560450... | 0.8436448 | 80 |
Return self != other. | def __ne__(self, other: t.Any) -> bool:
return self._op_bool('__ne__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__ (self, other):\n return not self == other",
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\n return not self == other",
"def __ne__(self, other):\n return not self == other... | [
"0.9148029",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",
"0.90947676",... | 0.0 | -1 |
Return self > other. | def __gt__(self, other: t.Any) -> bool:
return self._op_bool('__gt__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gt__ (self, other) :\n return other.__lt__(self)",
"def __gt__(self, other):\n return other < self",
"def __gt__(self, other):\n return self.__cmp__(other) > 0",
"def __gt__(self, other):\n return not self <= other",
"def __gt__(self, other):\n return not (self <= o... | [
"0.88454837",
"0.8835185",
"0.8753906",
"0.8683397",
"0.86776686",
"0.8659025",
"0.8615596",
"0.8615596",
"0.8586407",
"0.8554844",
"0.8525102",
"0.84938896",
"0.8438852",
"0.84209204",
"0.83831155",
"0.8349508",
"0.83437634",
"0.83184385",
"0.8276745",
"0.826989",
"0.8246980... | 0.7719933 | 76 |
Return self >= other. | def __ge__(self, other: t.Any) -> bool:
return self._op_bool('__ge__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, other):\n return other <= self",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return self >= other and self != other",
"def __gt__(self, other):\n return self >= other and not self <= other",
"def __gt__(self, ... | [
"0.8868215",
"0.87380284",
"0.87380284",
"0.86720943",
"0.8660485",
"0.8653344",
"0.8634527",
"0.86128294",
"0.8596913",
"0.85859865",
"0.8554961",
"0.8554961",
"0.8517289",
"0.85038203",
"0.8427539",
"0.8415103",
"0.83936816",
"0.83912957",
"0.8383239",
"0.8365001",
"0.83650... | 0.0 | -1 |
Return self + other (add). | def __add__(self, other: t.Any) -> InspectableSet[_C]:
return self._op_copy('__add__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __add__(self, other):\n return self.add(other)",
"def __add__(self, other):\r\n return self.add(other)",
"def __radd__(self, other):\n return self + other",
"def __radd__(self, other):\n return self + other",
"def __add__(self, other):\n base = deepcopy(self)\n ... | [
"0.9266151",
"0.9131028",
"0.9082741",
"0.9082741",
"0.8897318",
"0.8894028",
"0.88478476",
"0.8839215",
"0.8839215",
"0.8839215",
"0.8839215",
"0.8839215",
"0.8839215",
"0.8839215",
"0.87909865",
"0.87903935",
"0.87903935",
"0.87563384",
"0.87374",
"0.8734846",
"0.8681814",
... | 0.0 | -1 |
Return other + self (reverse add). | def __radd__(self, other: t.Any) -> InspectableSet[_C]:
return self._op_copy('__radd__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __radd__(self, other):\n return self.__add__(other)",
"def __radd__(self, other):\n return self.__add__(other)",
"def __radd__(self, other):\n return self.__add__(other)",
"def __radd__(self, other):\n return self.__add__(other)",
"def __radd__(self, other):\n return ... | [
"0.881997",
"0.881997",
"0.881997",
"0.881997",
"0.881997",
"0.881997",
"0.881997",
"0.8806219",
"0.87315613",
"0.87315613",
"0.85658467",
"0.8463392",
"0.8453195",
"0.8402282",
"0.8402282",
"0.83812803",
"0.8362903",
"0.8356121",
"0.8286701",
"0.82825",
"0.82825",
"0.82635... | 0.74150825 | 59 |
Return self ^ other (nonintersecting). | def __xor__(self, other: t.Any) -> InspectableSet[_C]:
return self._op_copy('__xor__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __xor__(self, other):\r\n return self + other - 2 * self * other",
"def __xor__(self, other: Compound[Scalar]) -> Compound[Scalar]:\n return (self._pack_points(self._points_set ^ other._points_set)\n if isinstance(other, Multipoint)\n else NotImplemented)",
"def ... | [
"0.84818894",
"0.83444",
"0.8308525",
"0.7901888",
"0.78810185",
"0.78776187",
"0.78383535",
"0.779058",
"0.7560993",
"0.74933267",
"0.7492698",
"0.74822277",
"0.7207677",
"0.7163137",
"0.7150253",
"0.7122373",
"0.71088535",
"0.71088535",
"0.7108131",
"0.7101556",
"0.7101556"... | 0.7848521 | 6 |
Return other ^ self (nonintersecting). | def __rxor__(self, other: t.Any) -> InspectableSet[_C]:
return self._op_copy('__rxor__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __xor__(self, other):\r\n return self + other - 2 * self * other",
"def __xor__(self, other: Compound[Scalar]) -> Compound[Scalar]:\n return (self._pack_points(self._points_set ^ other._points_set)\n if isinstance(other, Multipoint)\n else NotImplemented)",
"def ... | [
"0.82412505",
"0.8110162",
"0.79612213",
"0.7638598",
"0.76208067",
"0.7591517",
"0.7577133",
"0.75469977",
"0.7477055",
"0.74234843",
"0.73884386",
"0.73327386",
"0.73101425",
"0.7221561",
"0.70296353",
"0.6947054",
"0.69418705",
"0.69279045",
"0.69252217",
"0.6899475",
"0.6... | 0.0 | -1 |
Operate self |= other (set.update). | def __ior__(self, other: t.Any) -> te.Self:
return self._op_inplace('__ior__', other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plus(self, other):\n return self | other",
"def __or__(self, other):\n return self.__add__(other)",
"def __or__(self, other):\n return self.union(other)",
"def __or__(self, other):\n return self.union(other)",
"def __or__(self, other: t.Any) -> InspectableSet[_C]:\n retur... | [
"0.77051324",
"0.7382704",
"0.73613715",
"0.73613715",
"0.72558963",
"0.7169955",
"0.71061593",
"0.7076517",
"0.70656335",
"0.70595676",
"0.69595873",
"0.69440824",
"0.69347656",
"0.6898588",
"0.68928754",
"0.68345946",
"0.67616576",
"0.67385364",
"0.6727595",
"0.66731083",
"... | 0.0 | -1 |
Compute the softmax of each element along an axis of X. | def softmax(X, theta=1.0, axis=None):
# make X at least 2d
y = np.atleast_2d(X)
# find axis
if axis is None:
axis = next(j[0] for j in enumerate(y.shape) if j[1] > 1)
# multiply y against the theta parameter,
y = y * float(theta)
# subtract the max for numerical stability
y =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i] - np.max(x[i])\n out[i] = np.exp(max_x) / np.sum(np.exp(max_x), axis=0)\n\n return out",
"def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).res... | [
"0.8647537",
"0.8523369",
"0.8500539",
"0.8451157",
"0.84243023",
"0.8400201",
"0.83814615",
"0.837764",
"0.8373465",
"0.83615685",
"0.83546996",
"0.8344348",
"0.8325426",
"0.831054",
"0.82723284",
"0.827226",
"0.8265038",
"0.82473034",
"0.82473034",
"0.82435113",
"0.8243375"... | 0.0 | -1 |
Tokenizes a piece of text into its word pieces. This uses a greedy longestmatchfirst algorithm to perform tokenization using the given vocabulary. | def tokenize(self, text):
# text = convert_to_unicode(text)
output_tokens = []
for token in split_by_whitespace(text):
chars = list(token)
if len(chars) > self.max_input_chars_per_word:
output_tokens.append(self.unk_token)
continue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_tokenize(text):\n for (regexp, replacement) in RULES1:\n text = sub(regexp, replacement, text)\n # add extra space to make things easier\n text = \" \" + text + \" \"\n for (regexp, replacement) in RULES2:\n text = sub(regexp, replacement, text)\n for regexp in CONTRACTIONS:\n... | [
"0.6765699",
"0.65813315",
"0.65585905",
"0.65456027",
"0.6538041",
"0.65281445",
"0.65089214",
"0.6502858",
"0.6488556",
"0.6468996",
"0.6445512",
"0.6411887",
"0.6392981",
"0.6369177",
"0.63690287",
"0.6361631",
"0.635727",
"0.6342989",
"0.6338711",
"0.6335916",
"0.6322786"... | 0.6360827 | 16 |
Load a Context from graph. "graph" can be a file name or a JSON dict Normally, it has been generated with Context.save_graph / Context.get_graph "zip" can be a file name, zipcompressed bytes or a Python ZipFile object. Normally, it has been generated with Context.save_zip / Context.get_zip | def load_graph(graph, *, zip=None, cache_ctx=None, static=False, mounts=True, shares=True):
import json
from ..core.context import Context as CoreContext
from ..core.manager import Manager
from ..core.unbound_context import UnboundManager
if isinstance(graph, str):
graph = json.load(open(gra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_graph(context, files):\n import os.path\n import glob\n import re\n\n log.debug(\"Loading %s graph.\" % context)\n for f in files:\n if(f[-5:] == \".rdfa\"):\n format = \"rdfa\"\n elif(f[-7:] == \".jsonld\"):\n format = \"json-ld\"\n else:\n ... | [
"0.6789077",
"0.66920346",
"0.62897027",
"0.6168677",
"0.61478627",
"0.59720665",
"0.5965968",
"0.5856801",
"0.5846317",
"0.5838423",
"0.5791137",
"0.5726219",
"0.5726219",
"0.5720814",
"0.57027924",
"0.56406105",
"0.56322354",
"0.56282884",
"0.56070465",
"0.5600951",
"0.5591... | 0.77333736 | 0 |
Obtain a list of filenames for a given directory path. | def getFilenameList(path, pattern='*.nii.gz'):
filename = [os.path.basename(x) for x in sorted(glob.glob(os.path.join(path, pattern)))]
return filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_files_into_directory(directory_path: str) -> [str]:\n for root, directory_names, file_names in walk(directory_path):\n return file_names",
"def get_filenames(self, path):\n files_list = list()\n for filename in os.listdir(path):\n files_list.append(os.path.join(path, f... | [
"0.8308879",
"0.8287068",
"0.8236069",
"0.80837864",
"0.79775625",
"0.79667723",
"0.7913663",
"0.7850088",
"0.7842796",
"0.7834892",
"0.7779485",
"0.77526844",
"0.77356493",
"0.7726837",
"0.7716379",
"0.76943487",
"0.7672312",
"0.7644733",
"0.7643164",
"0.76365656",
"0.762636... | 0.7230761 | 44 |
r""" Set the latex options for use in the ``_latex_`` function. The default values are set in the ``__init__`` function. | def set_latex_options(self, D):
for opt in D:
self._latex_options[opt] = D[opt] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latex_options(self):\n d = self._latex_options.copy()\n if \"tikz_scale\" not in d:\n d[\"tikz_scale\"] = self.parent().options[\"latex_tikz_scale\"]\n if \"line_width\" not in d:\n d[\"line_width\"] = self.parent().options[\"latex_line_width_scalar\"] * d[\"tikz_scal... | [
"0.7816669",
"0.6493056",
"0.6388511",
"0.6382365",
"0.6382365",
"0.635808",
"0.6065956",
"0.6029482",
"0.59998435",
"0.5958446",
"0.5947586",
"0.59201384",
"0.57823503",
"0.5775156",
"0.57368726",
"0.57368726",
"0.5703509",
"0.56770873",
"0.5657331",
"0.56073165",
"0.5580212... | 0.73919594 | 1 |
r""" Return whether ``e1`` precedes or equals ``e2`` in ``self``. | def le(self, e1, e2):
return self._poset.le(e1, e2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, other: Event) -> bool:\n return not self.__lt__(other)",
"def __le__(self, other):\n if other is not None and self is not None:\n return self < other or self == other\n return False",
"def lt(self, e1, e2):\n return self._poset.lt(e1, e2)",
"def __le__(... | [
"0.6589716",
"0.6545049",
"0.6531959",
"0.65286607",
"0.65174073",
"0.639823",
"0.63224095",
"0.63046795",
"0.62818086",
"0.6259136",
"0.6237471",
"0.6211141",
"0.62052226",
"0.6198139",
"0.6152663",
"0.61391604",
"0.61303353",
"0.6128444",
"0.61269134",
"0.61181134",
"0.6114... | 0.6556015 | 1 |
r""" Return whether ``e1`` strictly precedes ``e2`` in ``self``. | def lt(self, e1, e2):
return self._poset.lt(e1, e2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def le(self, e1, e2):\n return self._poset.le(e1, e2)",
"def __ge__(self, other: Event) -> bool:\n return not self.__lt__(other)",
"def __le__(self, other):\n if other is not None and self is not None:\n return self < other or self == other\n return False",
"def __le__(... | [
"0.6572952",
"0.6520262",
"0.6512741",
"0.64498454",
"0.63889456",
"0.6387271",
"0.6365831",
"0.63372254",
"0.62757057",
"0.62735915",
"0.6253832",
"0.6208517",
"0.6206497",
"0.61997575",
"0.61922944",
"0.6189724",
"0.6185585",
"0.61797905",
"0.61713547",
"0.61692333",
"0.616... | 0.69877523 | 0 |
r""" Return whether ``e2`` precedes or equals ``e1`` in ``self``. | def ge(self, e1, e2):
return self._poset.ge(e1, e2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lt(self, e1, e2):\n return self._poset.lt(e1, e2)",
"def le(self, e1, e2):\n return self._poset.le(e1, e2)",
"def __ge__(self, other: Event) -> bool:\n return not self.__lt__(other)",
"def __le__(self, other):\n if other is not None and self is not None:\n return se... | [
"0.6658449",
"0.6655476",
"0.6508565",
"0.6482809",
"0.6465154",
"0.644383",
"0.6370038",
"0.63051015",
"0.6259428",
"0.6253201",
"0.62274134",
"0.6194646",
"0.61799073",
"0.613873",
"0.61364263",
"0.6117638",
"0.6112853",
"0.611053",
"0.6110346",
"0.60962665",
"0.6084134",
... | 0.637423 | 6 |
r""" Return whether ``e2`` strictly precedes ``e1`` in ``self``. | def gt(self, e1, e2):
return self._poset.gt(e1, e2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lt(self, e1, e2):\n return self._poset.lt(e1, e2)",
"def le(self, e1, e2):\n return self._poset.le(e1, e2)",
"def __le__(self, other):\n if other is not None and self is not None:\n return self < other or self == other\n return False",
"def __le__(self, other):\r\n ... | [
"0.7070383",
"0.6675718",
"0.64887846",
"0.645184",
"0.64441544",
"0.6393986",
"0.6368268",
"0.63668334",
"0.6331114",
"0.63307333",
"0.63295215",
"0.6305683",
"0.62907207",
"0.6278156",
"0.6270422",
"0.62658924",
"0.62473226",
"0.6236213",
"0.62282884",
"0.62248707",
"0.6216... | 0.59826887 | 52 |
r""" Return whether the interval represented by ``other`` is contained in ``self`` as an interval of the Tamari lattice. In terms of intervalposets, it means that all relations of ``self`` are relations of ``other``. | def contains_interval(self, other):
if other.size() != self.size():
return False
for (i, j) in self._cover_relations:
if not other.le(i, j):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_contains_interval(self, other):\n if not self.contains_interval(other):\n return False\n for (i, j) in other.decreasing_cover_relations():\n if not self.le(i, j):\n return False\n return True",
"def is_compatible(self, other):\n return se... | [
"0.7303164",
"0.7185178",
"0.71768904",
"0.71729076",
"0.7110207",
"0.7005144",
"0.6987068",
"0.69728696",
"0.68731976",
"0.68686056",
"0.68535346",
"0.68229824",
"0.6807258",
"0.6784951",
"0.6761309",
"0.66867775",
"0.66463375",
"0.6642807",
"0.66059387",
"0.6605889",
"0.658... | 0.79377466 | 0 |
r""" Return whether the interval represented by ``other`` is contained in ``self`` as an interval of the Tamari lattice and if they share the same lower bound. As intervalposets, it means that ``other`` contains the relations of ``self`` plus some extra increasing relations. | def lower_contains_interval(self, other):
if not self.contains_interval(other):
return False
for (i, j) in other.decreasing_cover_relations():
if not self.le(i, j):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_interval(self, other):\n if other.size() != self.size():\n return False\n for (i, j) in self._cover_relations:\n if not other.le(i, j):\n return False\n return True",
"def upper_contains_interval(self, other):\n if not self.contains_in... | [
"0.79749465",
"0.7638944",
"0.7382139",
"0.727656",
"0.7237383",
"0.71163094",
"0.70886314",
"0.7050114",
"0.6860601",
"0.6846054",
"0.6839107",
"0.6827591",
"0.68213594",
"0.67856115",
"0.67761064",
"0.67476827",
"0.67462707",
"0.6710387",
"0.66964674",
"0.667997",
"0.667467... | 0.81195676 | 0 |
r""" Return whether the interval represented by ``other`` is contained in ``self`` as an interval of the Tamari lattice and if they share the same upper bound. As intervalposets, it means that ``other`` contains the relations of ``self`` plus some extra decreasing relations. | def upper_contains_interval(self, other):
if not self.contains_interval(other):
return False
for (i, j) in other.increasing_cover_relations():
if not self.le(i, j):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains_interval(self, other):\n if other.size() != self.size():\n return False\n for (i, j) in self._cover_relations:\n if not other.le(i, j):\n return False\n return True",
"def lower_contains_interval(self, other):\n if not self.contains_in... | [
"0.8059659",
"0.772167",
"0.74617964",
"0.7312473",
"0.7208544",
"0.7193589",
"0.71919703",
"0.7044007",
"0.69847894",
"0.6964435",
"0.69483966",
"0.683716",
"0.6807408",
"0.67711437",
"0.6766632",
"0.676104",
"0.67335397",
"0.6694637",
"0.66421455",
"0.6637771",
"0.6611745",... | 0.8068767 | 0 |
r""" Return whether the permutation ``perm`` is a linear extension of ``self``. | def is_linear_extension(self, perm):
return self._poset.is_linear_extension(perm) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_perm(self, perm, obj=None):\r\n return True",
"def has_perm(self, perm, obj=None):\n return True",
"def has_perm(self, perm, obj=None):\n return True",
"def getIsLinearPolymer(self):\n dataDict = self.__dict__\n lin = 0\n nonlin = 0\n for ccv in self.chemCompVars:\n ... | [
"0.58632904",
"0.5821687",
"0.5821687",
"0.579759",
"0.57735133",
"0.5770947",
"0.567643",
"0.56639373",
"0.5646176",
"0.5646176",
"0.5646176",
"0.5594732",
"0.5503903",
"0.5478585",
"0.54758316",
"0.54501325",
"0.5412721",
"0.5399368",
"0.5344117",
"0.5323995",
"0.52789855",... | 0.8365215 | 0 |
r""" Return if ``self`` corresponds to a final interval of the Tamari lattice, i.e. if its upper end is the largest element of the lattice. It consists of checking that ``self`` does not contain any increasing relations. | def is_final_interval(self):
return self.increasing_cover_relations() == [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upper_contains_interval(self, other):\n if not self.contains_interval(other):\n return False\n for (i, j) in other.increasing_cover_relations():\n if not self.le(i, j):\n return False\n return True",
"def is_last_position(self):\r\n return self... | [
"0.6479418",
"0.64089495",
"0.6126108",
"0.6088815",
"0.60829705",
"0.6030923",
"0.6011597",
"0.5993592",
"0.5969383",
"0.593304",
"0.5926919",
"0.59050965",
"0.5904199",
"0.5882829",
"0.5844235",
"0.58036524",
"0.58021",
"0.5776691",
"0.57760024",
"0.5774496",
"0.5755776",
... | 0.72138214 | 0 |
r""" Return the highest binary tree in the interval of the Tamari lattice represented by ``self``. This is a binary tree. It is the shape of the unique binary search tree whose rightbranch ordered forest (i.e., the result of applying | def upper_binary_tree(self):
return self.max_linear_extension().binary_search_tree_shape(left_to_right=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_binary_tree(self):\n return self.min_linear_extension().binary_search_tree_shape(left_to_right=False)",
"def maximal_chain_binary_trees(self):\n for it in self.maximal_chain_tamari_intervals():\n yield it.lower_binary_tree()",
"def max_node(self):\n node = self.root\n ... | [
"0.6639886",
"0.6622541",
"0.6597471",
"0.65474766",
"0.65418583",
"0.6508362",
"0.64743704",
"0.6455029",
"0.6391153",
"0.6388879",
"0.63683105",
"0.6350132",
"0.63259566",
"0.6318385",
"0.6304379",
"0.6282525",
"0.62450534",
"0.6230863",
"0.62118787",
"0.61549115",
"0.61186... | 0.7755227 | 0 |
r""" Return the minimal permutation for the right weak order which is a linear extension of ``self``. This is also the minimal permutation in the sylvester class of ``self.lower_binary_tree()`` and is a 312avoiding permutation. The right weak order is also known as the right permutohedron order. See | def min_linear_extension(self):
# The min linear extension is build by postfix-reading the
# final forest of ``self``.
def add(perm, i):
r"""
Internal recursive method to compute the min linear extension.
"""
for j in self.decreasing_children(i):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def positive_left_right_requirements(\n self,\n ) -> Tuple[Tuple[GriddedPerm, ...], Tuple[GriddedPerm, ...]]:\n left, right = [], []\n for (x, y) in self._tiling.active_cells:\n if self._fuse_row and y == self._row_idx:\n left.append(GriddedPerm.single_cell((0,), (... | [
"0.5742055",
"0.56642014",
"0.5377864",
"0.53692955",
"0.53034425",
"0.52656096",
"0.52521914",
"0.5223609",
"0.52226937",
"0.5212633",
"0.51633334",
"0.51604694",
"0.5150753",
"0.51216555",
"0.511901",
"0.5088567",
"0.5045728",
"0.50404614",
"0.5006358",
"0.49870428",
"0.496... | 0.5505459 | 2 |
r""" Return the maximal permutation for the right weak order which is a linear extension of ``self``. This is also the maximal permutation in the sylvester class of ``self.upper_binary_tree()`` and is a 132avoiding permutation. The right weak order is also known as the right permutohedron order. See | def max_linear_extension(self):
# The max linear extension is build by right-to-left
# postfix-reading the initial forest of ``self``. The
# right-to-leftness here is ensured by the fact that
# :meth:`increasing_children` and :meth:`increasing_roots`
# output their results in dec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_max(self):\n tmp = self\n while tmp.right is not None:\n tmp = tmp.right\n return tmp.parent.key",
"def guess_basis(self, max_length=6):\n assert (\n max_length <= self.max_len\n ), \"The class is not big enough to check that far!\"\n\n # Find the first l... | [
"0.57795334",
"0.56601286",
"0.55593073",
"0.5521661",
"0.53921425",
"0.5372439",
"0.5328536",
"0.5295232",
"0.5292131",
"0.5264604",
"0.5214739",
"0.52084714",
"0.52084714",
"0.5188284",
"0.5180557",
"0.5161244",
"0.5158255",
"0.51543593",
"0.51475847",
"0.5134097",
"0.51196... | 0.59591466 | 0 |
r""" If ``self`` represents the interval `[t_1, t_2]` of the Tamari lattice, return an iterator on all intervals `[t_1,t]` with `t \leq t_2` for the Tamari lattice. In terms of intervalposets, it corresponds to adding all possible relations of the form `n` precedes `m` with `n<m`. | def lower_contained_intervals(self):
size = self._size
yield self
r"""
we try to add links recursively in this order :
1 -> 2
2 -> 3
1 -> 3
3 -> 4
2 -> 4
1 -> 4
...
("Link" means "relation of the poset".)
One useful... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximal_chain_tamari_intervals(self):\n yield self\n n = self.size()\n cover_relations = list(self._cover_relations)\n for inv in self.tamari_inversions_iter():\n cover_relations.append((inv[1], inv[0]))\n yield TamariIntervalPoset(n, cover_relations)",
"def ... | [
"0.5925848",
"0.5730668",
"0.5659192",
"0.56245",
"0.5402259",
"0.53188336",
"0.5316845",
"0.5260959",
"0.5241734",
"0.523788",
"0.5201922",
"0.51808155",
"0.516979",
"0.51667464",
"0.5128814",
"0.51035994",
"0.5090904",
"0.5067161",
"0.5058965",
"0.50454223",
"0.5027604",
... | 0.5656669 | 3 |
r""" Internal recursive method to generate all possible intervals. At every step during the iteration, we have n size). | def add_relations(poset, n, m):
if n <= 0:
# if n<=0, then we go to the next m
n = m
m += 1
if m > size:
# if m>size, it's finished
return
if poset.le(n, m):
# there is already a link n->... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fn(n):\n if n == 0: return [\"\"]\n ans = []\n for k in range(n): \n for x in fn(k): \n for y in fn(n-k-1): \n ans.append(f\"{x}({y})\")\n return ans",
"def GenerateIntervals(n, max_length=10, mean_wait=15):\... | [
"0.6352581",
"0.63286364",
"0.61512315",
"0.61443317",
"0.61290574",
"0.61180174",
"0.60971594",
"0.6057316",
"0.5994038",
"0.5974683",
"0.5953923",
"0.5945686",
"0.58864427",
"0.58581275",
"0.5823267",
"0.5799951",
"0.5787465",
"0.5749941",
"0.57435983",
"0.57233053",
"0.571... | 0.0 | -1 |
r""" Return the cardinality of the interval, i.e., the number of elements (binary trees or Dyck words) in the interval represented by ``self``. | def interval_cardinality(self):
return len(list(self.lower_contained_intervals())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cardinality(self):\n return int(ifac(self.size))",
"def cardinality(self):\n estimate = self._alpha * math.pow(self._m, 2) / sum(math.pow(2, -x) for x in self._registers)\n\n if estimate <= 2.5 * self._m:\n # get number of registers equal to zero\n empty_registers =... | [
"0.7633491",
"0.7341404",
"0.71828",
"0.71765697",
"0.70462894",
"0.6899687",
"0.6812712",
"0.66870433",
"0.66574633",
"0.66261995",
"0.6599493",
"0.6571582",
"0.6556243",
"0.6540504",
"0.6493382",
"0.6466083",
"0.6446393",
"0.64450747",
"0.64338154",
"0.6425363",
"0.6397805"... | 0.7814444 | 0 |
Return ``True`` if ``self`` is a new Tamari interval. Here 'new' means that the interval is not contained in any facet of the associahedron. They have been considered in section 9 of [ChapTamari08]_. | def is_new(self):
c_up = self.upper_binary_tree().single_edge_cut_shapes()
c_down = self.lower_binary_tree().single_edge_cut_shapes()
return not any(x in c_up for x in c_down) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_new(self):\n return self.new",
"def is_interval(self):\n return True",
"def __eq__(self, other):\n if len(self.intervals) != len(other.intervals):\n return False\n for i in range(0, len(self.intervals)):\n if self.intervals[i] != other.intervals[i]:\n ... | [
"0.637299",
"0.587774",
"0.57343507",
"0.57025373",
"0.5622818",
"0.56020856",
"0.5555807",
"0.55446094",
"0.5536849",
"0.55205303",
"0.55034786",
"0.54871064",
"0.5405399",
"0.5373411",
"0.5373341",
"0.5318972",
"0.53136003",
"0.5268442",
"0.52096844",
"0.5206357",
"0.520534... | 0.63925064 | 0 |
Return ``True`` if ``self`` is a simple Tamari interval. Here 'simple' means that the interval contains a unique binary tree. These intervals define the simple modules over the incidence algebras of the Tamari lattices. | def is_simple(self):
return self.upper_binary_tree() == self.lower_binary_tree() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_simple(self):\n return _property_op(arctern.ST_IsSimple, self).astype(bool, copy=False)",
"def is_simple(self): # -> bool:\n ...",
"def is_simple() -> bool:\n raise NotImplementedError()",
"def simple(self) -> bool:\n return is_simple(self.string)",
"def is_interval(self... | [
"0.6882328",
"0.6653823",
"0.6290875",
"0.5967965",
"0.5826819",
"0.5814876",
"0.5780845",
"0.57364595",
"0.55654556",
"0.5443747",
"0.5287194",
"0.5232607",
"0.51946145",
"0.5171547",
"0.51477635",
"0.5114792",
"0.5019052",
"0.49524808",
"0.49475616",
"0.49231294",
"0.489200... | 0.73690724 | 0 |
Return ``True`` if ``self`` is a modern Tamari interval. This is defined by exclusion of a simple pattern in the Hasse diagram, namely there is no configuration ``y > x < z`` with `1 \leq y < x < z \leq n`. | def is_modern(self):
G = self.poset().hasse_diagram()
for x in G:
nx = list(G.neighbors_in(x))
nx.append(x)
if min(nx) < x and max(nx) > x:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_interval(self):\n return True",
"def is_interval(self):\n return len(self.interval_list) > 0",
"def withinInterval(self, t):\n if (self.initTime == self.endTime):\n return True\n if (self.initTime <= t and t <= self.endTime):\n return True\n else:... | [
"0.6395471",
"0.5786272",
"0.56226486",
"0.56130505",
"0.55765116",
"0.5544972",
"0.5480486",
"0.54479086",
"0.53899115",
"0.53122807",
"0.53010505",
"0.5261179",
"0.5235546",
"0.5211426",
"0.517683",
"0.5164644",
"0.51644605",
"0.5161366",
"0.51327384",
"0.51199466",
"0.5104... | 0.5704469 | 2 |
r""" Return the final forest of a binary tree, an intervalposet or a Dyck word. A final forest is an intervalposet corresponding to a final interval of the Tamari lattice, i.e., containing only decreasing relations. It can be constructed from a binary tree by its binary | def final_forest(element):
if isinstance(element, TamariIntervalPoset):
return element.initial_forest()
elif element in DyckWords():
binary_tree = element.to_binary_tree_tamari()
elif element in BinaryTrees() or element in LabelledBinaryTrees():
binary_tree = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def final_forest(self):\n return TamariIntervalPoset(self.size(), self.decreasing_cover_relations())",
"def get_forest(self, verbose):\n _antecessors = []\n for key, cluster in self.clusters.items():\n if cluster.leaf_cluster is True:\n _antecessors.append(cluster.antecessor)\n ... | [
"0.664336",
"0.64217067",
"0.6200857",
"0.6162942",
"0.60690755",
"0.56115425",
"0.5573999",
"0.5567873",
"0.55505455",
"0.54506177",
"0.53701293",
"0.53481877",
"0.53434867",
"0.5302948",
"0.52941865",
"0.52465",
"0.51175904",
"0.5112351",
"0.5101037",
"0.50895286",
"0.50586... | 0.83295697 | 0 |
Return the uid for the resource owner, or None if no owner is specified. | def _get_owner(self):
if self.resource.owner is not None:
try:
return pwd.getpwnam(self.resource.owner).pw_uid
except KeyError:
raise error.InvalidUser() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def owner_id(self) -> Optional[str]:\n return pulumi.get(self, \"owner_id\")",
"def owner(self) -> discord.User:\n if self.config.owner_id:\n return self.get_user(self.config.owner_id)\n if self.owner_ids:\n return self.get_user(self.config.owner_ids[0])\n return... | [
"0.7809404",
"0.7419874",
"0.73416525",
"0.71287185",
"0.7095224",
"0.70617944",
"0.6979447",
"0.6931481",
"0.69205785",
"0.68505704",
"0.6818856",
"0.68168163",
"0.6801481",
"0.6768118",
"0.67180115",
"0.67180115",
"0.67180115",
"0.669434",
"0.6691992",
"0.66591275",
"0.6659... | 0.80710846 | 0 |
Return the gid for the resource group, or None if no group is specified. | def _get_group(self):
if self.resource.group is not None:
try:
return grp.getgrnam(self.resource.group).gr_gid
except KeyError:
raise error.InvalidGroup() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group(self):\n if iswin32:\n raise NotImplementedError(\"XXX win32\")\n import grp\n\n entry = error.checked_call(grp.getgrgid, self.gid) # type:ignore[attr-defined]\n return entry[0]",
"def resource_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi... | [
"0.7353889",
"0.71745735",
"0.71745735",
"0.71745735",
"0.71745735",
"0.71745735",
"0.71745735",
"0.71745735",
"0.71745735",
"0.7151373",
"0.71342576",
"0.71137273",
"0.71137273",
"0.71137273",
"0.7052958",
"0.7047173",
"0.7025877",
"0.69023335",
"0.68276095",
"0.66883093",
"... | 0.82896197 | 0 |
Path with slashes for current os. Can include drive letter. | def os_path(self, **kw):
with_drive = kw.get("with_drive", True)
if os.name == "nt":
return self.windows_path(with_drive=with_drive)
return self.posix_path(with_drive=with_drive) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def posix_path(self, **kw):\n with_drive_letter = kw.get(\"with_drive\", True)\n return self._construct_path(\"/\", with_drive_letter)",
"def system_path(path):\n if is_windows(): return path.replace('/', '\\\\')\n else: return path.replace('\\\\', '/')",
"def windows_path(self, **kw):\n ... | [
"0.75585496",
"0.7386857",
"0.7312456",
"0.7211771",
"0.6884308",
"0.68527454",
"0.6818027",
"0.680745",
"0.67939514",
"0.67734885",
"0.6764585",
"0.6754212",
"0.67198575",
"0.66738766",
"0.66506284",
"0.65659195",
"0.6551156",
"0.65468466",
"0.6534581",
"0.6518932",
"0.64886... | 0.75232667 | 1 |
Check whether comms is configured to skip current day of week. | def _skip_day(self):
is_skip_day = False
current_day = datetime.datetime.now().strftime('%A').lower()
log.debug('Current day/skip days: "%s/%s"' %
(current_day.title(), str(self.skip_days)))
if current_day in [x.lower() for x in self.skip_days]:
log.info('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_no_bell_day():\n today = time.localtime()[:3]\n for r in no_bell:\n if today >= r[0] and today <= r[1]:\n return True\n return False",
"def is_exclude(self, day, now):\n if day in self._excludes:\n return True\n if \"holiday\" in self._excludes and now i... | [
"0.6229216",
"0.6094885",
"0.5883757",
"0.5790428",
"0.57841974",
"0.5761688",
"0.57170075",
"0.57170075",
"0.57158774",
"0.5682109",
"0.5667511",
"0.5658384",
"0.56528383",
"0.5635151",
"0.5627385",
"0.5614703",
"0.55858153",
"0.5582008",
"0.5580724",
"0.5550886",
"0.5541717... | 0.8169463 | 0 |
Show who's logged in. | def status(verbose):
user_data = Spotify.request('me', method='GET')
click.echo('Logged in as {}'.format(user_data['display_name']))
if verbose:
click.echo('Credentials stored in {}'.format(CREDS_PATH))
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user_info():\n\n return current_user",
"def who_am_i():\n request = req('GET', USER_API + 'session/whoami')\n r = request.json()\n user = {\n 'Email': demisto.get(r, 'data.email'),\n 'Login': demisto.get(r, 'data.login'),\n 'Name': demisto.get(r, 'data.name'),\n ... | [
"0.71050817",
"0.7102793",
"0.6969564",
"0.6889965",
"0.6889965",
"0.68593216",
"0.68593216",
"0.68593216",
"0.68593216",
"0.68593216",
"0.67712295",
"0.6762248",
"0.67338914",
"0.66948986",
"0.6687292",
"0.6687261",
"0.6682166",
"0.6664576",
"0.66428715",
"0.66223544",
"0.66... | 0.0 | -1 |
This function finds the k'th smallest number in a list of numbers. | def quick_select(lst, k):
if lst != []:
pivot = lst[(len(lst)//2)]
smallerlist = []
largerlist = []
count = 0
for i in range(0,len(lst)):
if lst[i] == pivot:
count += 1
elif lst[i] < pivot:
smallerlist.append(lst[i])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kthSmallest(A, k):\n if k >= len(A):\n return None\n return select(A, 0, len(A) - 1, k)",
"def findKthPositive(self, arr: 'List[int]', k: int) -> int:\n for elem in arr:\n if k < elem:\n return k\n k += 1\n return k",
"def k_smallest_sorted(a,... | [
"0.80562335",
"0.7572875",
"0.74936444",
"0.7487555",
"0.7426541",
"0.74083686",
"0.7375493",
"0.71833813",
"0.7161651",
"0.7111529",
"0.70311683",
"0.70228595",
"0.70095587",
"0.7008058",
"0.6942383",
"0.6916838",
"0.6906306",
"0.6870574",
"0.6868792",
"0.68436134",
"0.68378... | 0.63936013 | 46 |
Given a course row, extract and return its generic credit type. | def extract_generic_credit_type(self, course_row):
course_id = row[0]
credit_type_res = {re.compile("Communication"):"CS",
re.compile("Natural Science"):"NS",
re.compile("Humanities"):"H",
re.compile("Performance"):"HP",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_type(row):\n if row['PROJ_NO'].endswith('-CFD') or (\n row['SECTOR'] == 'None' and row['PROJ_REQ'] == '0'\n and row['PCV_NAME'] == row['LOCATION'] + ' COUNTRY FUND'):\n return Account.COUNTRY\n if (row['PROJ_NO'].startswith('SPF-')\n and 'MEMORIAL' in row['... | [
"0.571697",
"0.5716211",
"0.5675571",
"0.5277511",
"0.51541007",
"0.51441896",
"0.5140766",
"0.50944555",
"0.49909335",
"0.4979489",
"0.49476218",
"0.49386233",
"0.49356762",
"0.49297437",
"0.492916",
"0.49259803",
"0.49174622",
"0.48656136",
"0.48642662",
"0.4857517",
"0.481... | 0.87194234 | 0 |
Swaps one ingredient with a random choice within food_type | def level_one(self):
swap_spot = randint(0,len(self.current_recipe.toppings)-1)
#if statements are to stay within food type of original recipe
if self.current_recipe.recipe_type == 'soup':
new_ingredient = choice(soup_ingredients)
self.current_recipe.toppings[swap_spot] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level_two(self):\n #swaps a random ingredient by choosing a random place\n swap_spot = randint(0,len(self.current_recipe.toppings)-1)\n #chooses which food type to choose from\n extra_ingredient_type = choice(food_type_databases) \n new_ingredient = choice(extra_ingredient_ty... | [
"0.74766755",
"0.70364463",
"0.64447707",
"0.6291605",
"0.6277338",
"0.62259054",
"0.60727066",
"0.5950151",
"0.59413946",
"0.5832344",
"0.58005214",
"0.57584727",
"0.57061106",
"0.56767875",
"0.5663778",
"0.56465226",
"0.5643548",
"0.56365955",
"0.5626681",
"0.5579125",
"0.5... | 0.7448816 | 1 |
Will read in csv from path using Path method, index first column, parse dates, drop NA's, drop duplicates, and sort by the index. Returns dataframe | def load_and_clean(self,in_path):
in_path = Path(in_path)
try:
df = pd.read_csv(in_path, index_col = 0, parse_dates = True, infer_datetime_format = True)
except:
print("Could not read csv file. Please check the path")
finally:
#attempt to clean df
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_df_from_csv(self, filename):\n df = pd.read_csv(filename)\n df.set_index('Date', drop=True, inplace=True)\n df.index = pd.to_datetime(df.index)\n return df",
"def _load_stored_csv(path: Union[Path, str]) -> Union[pd.DataFrame, pd.Series]:\n data = pd.read_csv(path, index_c... | [
"0.70092547",
"0.6942048",
"0.68625337",
"0.68314505",
"0.6712367",
"0.6685995",
"0.665173",
"0.6639228",
"0.6632205",
"0.66221297",
"0.6602125",
"0.6567112",
"0.6538835",
"0.6446005",
"0.6388624",
"0.63881457",
"0.63867635",
"0.636467",
"0.6335628",
"0.63297826",
"0.6303138"... | 0.7496845 | 0 |
Returns pressure vs T solving the true HF at given density n | def p_HF(T, n):
mu, n0 = physics_solver_mu(n, T)
zeta = np.exp((mu - 2 * g_int * n) / kB / T)
p = g_int * (n**2 - 0.5 * n0**2) + kB * T * g52(zeta) / lambda_therm(T)**3
return p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def k_HF(T, n, h=1e-3):\n mu_p, _ = physics_solver_mu(n * (1 + h), T)\n mu_m, _ = physics_solver_mu(n * (1 - h), T)\n dn_dmu = 2 * h / (mu_p - mu_m) # second order diff\n return dn_dmu / n",
"def mu_HF_approx(t, n):\n eta = eta_HF(n)\n return 1 + t**(3. / 2) - 2 * np.sqrt(pi) / z32 * t * np.sq... | [
"0.6926451",
"0.6463779",
"0.6439212",
"0.6416179",
"0.6416179",
"0.62654305",
"0.6108837",
"0.60925996",
"0.60359204",
"0.60160613",
"0.5994781",
"0.59814984",
"0.5981231",
"0.5969728",
"0.59652793",
"0.58984286",
"0.58521503",
"0.57879454",
"0.57723206",
"0.5754058",
"0.573... | 0.77802855 | 0 |
Returns the isothermal compressibility k solve HF at density n(1 +/ h) and estimate the derivative dn / dmu | def k_HF(T, n, h=1e-3):
mu_p, _ = physics_solver_mu(n * (1 + h), T)
mu_m, _ = physics_solver_mu(n * (1 - h), T)
dn_dmu = 2 * h / (mu_p - mu_m) # second order diff
return dn_dmu / n | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EisensteinHu_Pk(self,\n z = 0.,\n k = np.logspace(-4., 2., 1001),\n sigma_8 = 0.83):\n\n om_m = self.Omega_m\n om_b = self.Omega_b\n n_tld = self.ns - 1.\n h = self.h\n theta = self.T_cmb/2.7\n \n if np.sum(self.M_nu) != 0.:\n ... | [
"0.6425773",
"0.62354225",
"0.62235534",
"0.61166614",
"0.6099622",
"0.6094324",
"0.6054225",
"0.600447",
"0.5948712",
"0.59182924",
"0.59136635",
"0.5908791",
"0.5897991",
"0.5896216",
"0.5893599",
"0.585329",
"0.58327484",
"0.5822616",
"0.58125347",
"0.58078116",
"0.5780541... | 0.7025756 | 0 |
return the inliers and outliers indices of motion vectors | def get_inliers(kp1, kp2, foe, tau):
inliers = []
outliers = []
for i in range(len(kp1)):
if is_inlier(kp1[i], kp2[i], foe, tau):
inliers.append(i)
else:
outliers.append(i)
return np.array(inliers), np.array(outliers) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_morris_sensitivity_indices(elem_effects):\n mu = np.absolute(elem_effects).mean(axis=1)\n assert mu.shape==(elem_effects.shape[0],elem_effects.shape[2])\n sigma = np.std(elem_effects,axis=1)\n return mu,sigma",
"def mad_outliers(t, x, w, bool=False, Nsigma=4):\n x_med = local_func(np.media... | [
"0.59944624",
"0.57402205",
"0.57189643",
"0.56669873",
"0.5606326",
"0.55766064",
"0.55566055",
"0.5526839",
"0.5503214",
"0.5500785",
"0.5477558",
"0.5469079",
"0.54556185",
"0.5437877",
"0.5432947",
"0.54277813",
"0.5420071",
"0.5392654",
"0.53390163",
"0.533327",
"0.53114... | 0.5424776 | 16 |
draw arrow line on a image | def draw_arrows(img, p1, p2, color):
for i in range(p1.shape[0]):
x = tuple(p1[i].ravel())
y = tuple(p2[i].ravel())
img = cv2.arrowedLine(img, x, y, color, thickness=3)
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _draw_arrow(event, x, y, flags, params):\n global img, source_img, state\n global p1, p2\n if event == cv2.EVENT_LBUTTONDOWN:\n state = True\n p1 = (x, y)\n img = source_img.copy()\n elif event == cv2.EVENT_LBUTTONUP:\n state = False\n ... | [
"0.81170404",
"0.7799005",
"0.77815694",
"0.7579667",
"0.718991",
"0.68335783",
"0.68266946",
"0.6779936",
"0.67792773",
"0.66819954",
"0.6663337",
"0.6625323",
"0.66172427",
"0.6610678",
"0.6580607",
"0.65383494",
"0.65356344",
"0.6488501",
"0.6473435",
"0.6468965",
"0.64294... | 0.7686908 | 3 |
Returns a given loaded plugin's config. | def config(self, plugin):
if self.plugin_manager is None:
self.logger.error(
"PluginManager has not been initialized! Can't return config "
"for plugin: %s" % plugin
)
raise PluginError("PluginManager has not yet been initialized")
try... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_plugin_config():\n return json.loads(os.getenv(\"DKU_CUSTOM_RECIPE_PLUGIN_CONFIG\"))",
"async def get_plugin_config(self, **kwargs) -> Any:\n namespace = self._get_namespace(**kwargs)\n return await self.AD.plugins.get_plugin_meta(namespace)",
"def get_config():\n return CONFIG",
... | [
"0.73384917",
"0.73221475",
"0.73209363",
"0.7239476",
"0.7210769",
"0.7185396",
"0.7185396",
"0.7182962",
"0.71165395",
"0.7082601",
"0.70430726",
"0.6989676",
"0.6968032",
"0.6892915",
"0.6892915",
"0.6892915",
"0.6892915",
"0.6892915",
"0.6892915",
"0.6892915",
"0.6892915"... | 0.7111672 | 9 |
Return True or False if the user is allowed to access the car or not | def is_access_allowed(self, user_id):
### DATABASE CODE GOES HERE
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_allowed(self) -> bool:\n return self.effect == ALLOW_ACCESS",
"def can_view(self, user):\r\n return True",
"def is_authorized(self, request, obj=None):\r\n if request.method == 'GET':\r\n return True\r\n else:\r\n return False",
"def is_authorized(self... | [
"0.7469996",
"0.71760786",
"0.7123571",
"0.7092544",
"0.7024046",
"0.70199245",
"0.69878054",
"0.6967835",
"0.69538414",
"0.69538414",
"0.69538414",
"0.6855625",
"0.67774516",
"0.6773134",
"0.67614025",
"0.6736425",
"0.6733458",
"0.6700007",
"0.6700007",
"0.669888",
"0.669536... | 0.7017369 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.