query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
No. 1 tests collection for DeviceAssociation. | def test_deviceassociation_1(base_settings):
filename = base_settings["unittest_data_dir"] / "deviceassociation-example.json"
inst = deviceassociation.DeviceAssociation.parse_file(
filename, content_type="application/json", encoding="utf-8"
)
assert "DeviceAssociation" == inst.resource_type
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_instance(self):\n self.assertEqual(True, type(self.Test.defined_associations['things']) is pyperry.association.HasMany)",
"def test_get_devices1(self):\n pass",
"def test_defined_associations(self):\n self.assertEqual(True, len(self.Test.defined_associations) > 0)",
"def test_de... | [
"0.63186795",
"0.62924093",
"0.62830204",
"0.62830204",
"0.62830204",
"0.62792283",
"0.62792283",
"0.624757",
"0.61836016",
"0.611244",
"0.6044153",
"0.5977334",
"0.59670866",
"0.59656906",
"0.5937387",
"0.59067976",
"0.5894439",
"0.5884807",
"0.58664834",
"0.58437556",
"0.58... | 0.67872405 | 0 |
Time complexity is O(log N), since the problem can be reduced down to binary search. If A[j] > j, then no entry after j can satisfy the given criterion. This is because each element in the array is at least 1 greater than the previous element. For the same reason , if A[j] < j, no entry before j can satisfy the given c... | def search_entry_equal_to_its_index(A):
L, R = 0, len(A) -1
while L <= R:
M = L + (R - L) // 2
if A[M] > M:
R = M - 1
elif A[M] == M:
return M
else:
# A[M] < M
L = M + 1
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BS(self, arr, N, X):\n lo = 0\n hi = N - 1\n while lo <= hi:\n mid = (lo + hi) // 2\n if arr[mid] == X:\n return True\n elif arr[mid] < X:\n lo = mid + 1\n else:\n hi = mid - 1\n return False",
... | [
"0.6312722",
"0.62923104",
"0.6226362",
"0.6148673",
"0.6132592",
"0.6132072",
"0.60798305",
"0.60679054",
"0.60506034",
"0.6018032",
"0.6006477",
"0.6005336",
"0.5975313",
"0.59663606",
"0.5922118",
"0.5916837",
"0.5898111",
"0.58858323",
"0.588001",
"0.58537954",
"0.5833917... | 0.6494884 | 0 |
>>> h_d_n(123) (1, 2, 3) >>> h_d_n(321) (3, 2, 1) >>> h_d_n(90) (0, 9, 0) | def h_d_n(x:int) -> tuple:
return(x // 100, (x % 100) // 10, x % 10) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateDeCrypt(asci: int, d: int, n: int) -> int:\n return pow(int(asci),d,n)",
"def d(n):\n return sum(divisors(n))",
"def d(s):\n return s + 1",
"def factorizacion_ds(n:int) -> Tuple[int,int]:\r\n if n<2:\r\n raise ValueError(\"n debe ser >=2\")\r\n d = n if not n&1 else (n - 1)... | [
"0.6135414",
"0.59373635",
"0.59330577",
"0.5917609",
"0.58610594",
"0.5802275",
"0.5800661",
"0.57471615",
"0.5747002",
"0.57074314",
"0.57021093",
"0.5676164",
"0.5650685",
"0.56254137",
"0.558355",
"0.55562544",
"0.5553181",
"0.55499274",
"0.55134493",
"0.55087435",
"0.548... | 0.719936 | 0 |
Detect and describe local keypoints. | def get_local_features(self, img):
kp, des = self.fe.detectAndCompute(img, None)
return kp, des | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_keypoint_detection(init_env, config_file):\n run_all_steps(init_env, config_file)",
"def surf_keypoint_detection(img):\n surf = cv2.xfeatures2d.SURF_create(510)\n kp, des = surf.detectAndCompute(img, None)\n return des",
"def get_keypoints():\n # Keypoints are not available in the COCO ... | [
"0.63097143",
"0.61336166",
"0.60220844",
"0.5738497",
"0.5622902",
"0.55199105",
"0.55028194",
"0.5497425",
"0.545911",
"0.5430861",
"0.54248726",
"0.54204404",
"0.5411404",
"0.53913933",
"0.5363734",
"0.5326334",
"0.52683765",
"0.5255654",
"0.52534306",
"0.5239289",
"0.5189... | 0.6142685 | 1 |
Sets up the argparse object for a specific dataset. | def init_cormorant_argparse(dataset):
parser = argparse.ArgumentParser(description='Cormorant network options.')
parser = setup_shared_args(parser)
# Datasets without additional arguments
if dataset.lower() in ["smp", "lba"]:
pass
# Datasets for classification tasks
elif dataset == "res"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse():\n parser = argparse.ArgumentParser()\n parser.add_argument('--dataset', default='ml-1m', help='which dataset to use')\n args = parser.parse_args()\n main(args)",
"def __init__(self):\n self.parser = argparse.ArgumentParser(prog='PROG')\n self.parser.add_argument(\"--idir\",... | [
"0.709905",
"0.6737217",
"0.6725684",
"0.6715105",
"0.66910356",
"0.6689633",
"0.66340303",
"0.6629519",
"0.6566277",
"0.65392494",
"0.64324933",
"0.6376761",
"0.6372934",
"0.6358038",
"0.63520265",
"0.6338287",
"0.6338084",
"0.633524",
"0.63297504",
"0.6312832",
"0.6287631",... | 0.70690745 | 1 |
Test that models/engine/file_storage.py conforms to PEP8. | def test_pep8_conformance_file_storage(self):
pep8s = pep8.StyleGuide(quiet=True)
result = pep8s.check_files(['models/engine/file_storage.py'])
self.assertEqual(result.total_errors, 0,
"Found code style errors (and warnings).") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pep8_conformance_test_file_storage(self):\n pep8s = pep8.StyleGuide(quiet=True)\n result = pep8s.check_files(['tests/test_models/test_engine/\\\ntest_file_storage.py'])\n self.assertEqual(result.total_errors, 0,\n \"Found code style errors (and warnings).\")",
... | [
"0.7939913",
"0.740642",
"0.740642",
"0.7346395",
"0.7346395",
"0.66497564",
"0.6502688",
"0.6492406",
"0.63181925",
"0.6306742",
"0.6300503",
"0.6291657",
"0.6269766",
"0.62613714",
"0.6225302",
"0.62200075",
"0.61967963",
"0.61587316",
"0.615522",
"0.6145747",
"0.61391056",... | 0.8031939 | 0 |
Test tests/test_models/test_file_storage.py conforms to PEP8. | def test_pep8_conformance_test_file_storage(self):
pep8s = pep8.StyleGuide(quiet=True)
result = pep8s.check_files(['tests/test_models/test_engine/\
test_file_storage.py'])
self.assertEqual(result.total_errors, 0,
"Found code style errors (and warnings).") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pep8_conformance_file_storage(self):\n pep8s = pep8.StyleGuide(quiet=True)\n result = pep8s.check_files(['models/engine/file_storage.py'])\n self.assertEqual(result.total_errors, 0,\n \"Found code style errors (and warnings).\")",
"def test_file_field():",
... | [
"0.750308",
"0.7247188",
"0.7087716",
"0.7005382",
"0.7005382",
"0.69971234",
"0.68696296",
"0.6790633",
"0.6790633",
"0.6779602",
"0.6669038",
"0.6602457",
"0.6590004",
"0.6556125",
"0.6523744",
"0.65025145",
"0.6485095",
"0.6340272",
"0.6330424",
"0.6330424",
"0.6236692",
... | 0.7583977 | 0 |
Test for the file_storage.py module docstring | def test_file_storage_module_docstring(self):
self.assertIsNot(file_storage.__doc__, None,
"file_storage.py needs a docstring")
self.assertTrue(len(file_storage.__doc__) >= 1,
"file_storage.py needs a docstring") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_file_storage_class_docstring(self):\n self.assertIsNot(FileStorage.__doc__, None,\n \"State class needs a docstring\")\n self.assertTrue(len(FileStorage.__doc__) >= 1,\n \"State class needs a docstring\")",
"def test_docstring(self):\n ... | [
"0.7408883",
"0.7304265",
"0.68893766",
"0.68893766",
"0.68422467",
"0.6720938",
"0.66850764",
"0.66716516",
"0.6499715",
"0.6474401",
"0.6443321",
"0.6381629",
"0.6381629",
"0.6371081",
"0.6322822",
"0.6282735",
"0.6265872",
"0.6205506",
"0.6188024",
"0.6153745",
"0.6124802"... | 0.8053633 | 0 |
Test for the FileStorage class docstring | def test_file_storage_class_docstring(self):
self.assertIsNot(FileStorage.__doc__, None,
"State class needs a docstring")
self.assertTrue(len(FileStorage.__doc__) >= 1,
"State class needs a docstring") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_file_storage_module_docstring(self):\n self.assertIsNot(file_storage.__doc__, None,\n \"file_storage.py needs a docstring\")\n self.assertTrue(len(file_storage.__doc__) >= 1,\n \"file_storage.py needs a docstring\")",
"def test_docstring(self)... | [
"0.7724605",
"0.7373347",
"0.7370406",
"0.70291007",
"0.70291007",
"0.70174724",
"0.69507873",
"0.68998235",
"0.6748319",
"0.6748319",
"0.6646066",
"0.6420071",
"0.6388432",
"0.6388432",
"0.6386928",
"0.6385066",
"0.62834305",
"0.6273837",
"0.6257467",
"0.6246449",
"0.6236639... | 0.79537505 | 0 |
Check mysql doesn't exists. Test that we can trigger a mysql connection failure and we fail gracefully to ensure we don't break people without mysql | def test_mysql_connect_fail(self):
if test_migrations._is_backend_avail(
'mysql', 'kickstand_cifail', self.PASSWD, self.DATABASE):
self.fail("Shouldn't have connected") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mysql_connect_fail(self):\n if _is_backend_avail('mysql', user=\"openstack_cifail\"):\n self.fail(\"Shouldn't have connected\")",
"def test_missing(server):\n\n assert \"non_existing_database\" not in server\n with pytest.raises(excepts.DBNotExists):\n server[\"non_existin... | [
"0.8019343",
"0.64847225",
"0.6414118",
"0.6394261",
"0.6361902",
"0.63209903",
"0.62543845",
"0.6211786",
"0.6167792",
"0.61182964",
"0.6047251",
"0.6041001",
"0.6038732",
"0.6023822",
"0.6023704",
"0.5986073",
"0.59562546",
"0.5951382",
"0.59086776",
"0.58945745",
"0.589357... | 0.7984295 | 1 |
Check postgres doesn't exists. Test that we can trigger a postgres connection failure and we fail gracefully to ensure we don't break people without postgres | def test_postgresql_connect_fail(self):
if test_migrations._is_backend_avail(
'postgres', 'kickstand_cifail', self.PASSWD, self.DATABASE):
self.fail("Shouldn't have connected") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_postgresql_connect_fail(self):\n if _is_backend_avail('postgresql', user=\"openstack_cifail\"):\n self.fail(\"Shouldn't have connected\")",
"def database_exists(database):\n try:\n test_connection_db = Database(database=database)\n test_connection_db.close()\n r... | [
"0.79075533",
"0.7150718",
"0.6752807",
"0.66953045",
"0.66447365",
"0.660909",
"0.6439612",
"0.63683623",
"0.6328746",
"0.6321043",
"0.6304608",
"0.6242608",
"0.6206685",
"0.61457425",
"0.6078942",
"0.6048207",
"0.603846",
"0.6034774",
"0.59535533",
"0.59409016",
"0.5940679"... | 0.7844154 | 1 |
Get the File Type Counter. | def get_num_files(self, file_type):
return self.file_type_counter.get(file_type, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_filetype(filepath, fileinfo, temppath):\n features = collections.Counter()\n\n # skip files in temp directory (only record primary file type here)\n if filepath.startswith(temppath):\n return features\n\n # skip if no fileinfo\n if not fileinfo:\n return features\n\n feature... | [
"0.7075743",
"0.6808621",
"0.6684209",
"0.660871",
"0.6603232",
"0.65423536",
"0.6539293",
"0.6506061",
"0.6490176",
"0.6285142",
"0.62413156",
"0.61309546",
"0.6097419",
"0.6095863",
"0.60910076",
"0.60835075",
"0.605242",
"0.60425013",
"0.60141003",
"0.6012714",
"0.59846336... | 0.78032047 | 0 |
Get the Total File Size for the Specified File Type. | def get_total_file_size(self, file_type):
return self.file_size_counter.get(file_type, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_files(self, file_type):\n return self.file_type_counter.get(file_type, 0)",
"def get_size(self, typ):\n return self.info.get_size(typ)",
"def get_file_size(self) -> int:\n return self.get_main_information()['FileSize']",
"def total_file_length(self):\n if self.is_multi... | [
"0.71219486",
"0.702957",
"0.7018137",
"0.6878474",
"0.6850464",
"0.67821544",
"0.6761017",
"0.6627649",
"0.6599945",
"0.65494007",
"0.6542609",
"0.65323985",
"0.6529978",
"0.652283",
"0.6522734",
"0.65056324",
"0.6504725",
"0.6465689",
"0.64619946",
"0.6411416",
"0.638301",
... | 0.88532853 | 0 |
Print the dimensions of the dataset. | def dataDimensions(data):
logging.info('Number of rows of data: %s' % len(data))
logging.info('Number of columns of data: %s' % len(data[1])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dimensions():",
"def print_shape(self, data):\n print(data.shape)",
"def test_dimensions(self):\n\t\t\n\t\t# default\t\n\t\tdetails = self.watcher.describe()\n\t\tprint(details)\n\t\t\n\t\t# default\t\n\t\tdetails = self.watcher.describe(layers=[self.first_layer])\n\t\tprint(details)\n\t\tN = detail... | [
"0.72835773",
"0.7208219",
"0.70247895",
"0.6825681",
"0.6780157",
"0.6741044",
"0.67365885",
"0.66827595",
"0.6679423",
"0.6673389",
"0.6670542",
"0.66320324",
"0.66320324",
"0.6608273",
"0.6598985",
"0.65961164",
"0.6579692",
"0.6556183",
"0.6556135",
"0.65442944",
"0.65418... | 0.73739463 | 0 |
Set the scroll region on the canvas | def set_scrollregion(self, event=None):
self.canvas.configure(scrollregion=self.canvas.bbox('all')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_configure(self, event):\n self.testCanvas.configure(scrollregion=self.testCanvas.bbox('all'))\n self.testCanvas.yview_moveto(1)",
"def __reconfig__(self, event):\r\n x, y = event.width//2, event.height//2\r\n self.canvas.config(scrollregion=(-x, -y, x, y))",
"def update_scrol... | [
"0.7618465",
"0.75891054",
"0.70867497",
"0.6937721",
"0.66451067",
"0.66319126",
"0.6626159",
"0.6525639",
"0.6470909",
"0.6445509",
"0.6432371",
"0.64242435",
"0.63335246",
"0.6312971",
"0.62980497",
"0.62910694",
"0.6274682",
"0.6224632",
"0.6214763",
"0.6129663",
"0.60695... | 0.82397264 | 0 |
Get the instance's families | def get_families(instance):
families = instance.data.get("families", [])
family = instance.data.get("family")
if family:
families.append(family)
return set(families) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_families(self):\n return self.__make_api_call('get/families')",
"def list_families(self):\n return self.__make_api_call('list/families')",
"def families(self):\n\n return [get_target_family_by_id(i) for i in self._family_ids]",
"def get_families(self):\n # Implemented from... | [
"0.7949288",
"0.7805857",
"0.730276",
"0.71409595",
"0.71386194",
"0.68486196",
"0.6693059",
"0.64362943",
"0.63239765",
"0.63228005",
"0.6175703",
"0.6123435",
"0.6111729",
"0.6105033",
"0.6057197",
"0.59759986",
"0.5844662",
"0.58399475",
"0.5798087",
"0.5798087",
"0.578143... | 0.8296791 | 0 |
Return the member nodes that are invalid | def get_invalid(cls, instance):
others = [i for i in list(instance.context) if
i is not instance and
set(cls.families) & get_families(i)]
if not others:
return []
other_ids = defaultdict(list)
for other in others:
for _id, mem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self, node):",
"def get_member_errors(rows):\n\n member_errors = []\n\n for row in rows:\n if row['svname'] not in ['FRONTEND', 'BACKEND'] and \\\n row['status'] not in ['UP', 'no check']:\n member_errors.append(row['pxname'] + ':' + row['svname'])\n\n return mem... | [
"0.6208121",
"0.61689955",
"0.61560327",
"0.6121829",
"0.5997731",
"0.58034176",
"0.57894987",
"0.57870746",
"0.5766943",
"0.5748134",
"0.5737588",
"0.5679277",
"0.56642914",
"0.5614621",
"0.5604182",
"0.5556039",
"0.55382854",
"0.55286926",
"0.54840016",
"0.5482115",
"0.5415... | 0.68075114 | 0 |
Overview of monthly spend by category for the last n months. | def monthly_overview():
df = (
monzo
[~monzo.category.isin(['general', 'transfer'])]
.pivot_table('amount', 'month', 'category',
aggfunc='sum', fill_value=0)
.reset_index()
.melt(id_vars=['month'], value_name='amount')
)
inc = df[df.category.eq('i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SumCostByMonthPerCategory(year, numberOfMonth, category):\n\n logs.logger.debug(\n \"Start to adds all amount of Cost objects based on the month of payment date and on the category.\")\n try:\n num_days = calendar.monthrange(year, numberOfMonth)[1]\n searchedCostByMonthFromDB = GetAl... | [
"0.6153713",
"0.58537513",
"0.58471185",
"0.5838708",
"0.56815994",
"0.5626167",
"0.5604199",
"0.5594761",
"0.55863005",
"0.5585975",
"0.55839974",
"0.55758244",
"0.55617726",
"0.55524075",
"0.55136883",
"0.55043674",
"0.54847926",
"0.54786766",
"0.5466748",
"0.54640615",
"0.... | 0.69854707 | 0 |
Ensure findlinks option endup being a list of strings. | def _fixup_find_links(find_links):
if isinstance(find_links, str):
return find_links.split()
assert isinstance(find_links, (tuple, list))
return find_links | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def produce_links_search(self, value_list:list) -> list:\n return [\n [self.produce_link_google(f) for f in value_list],\n [self.produce_link_qwant(f) for f in value_list],\n [self.produce_link_bing(f) for f in value_list],\n [self.produce_link_duckduckgo(f) for f... | [
"0.59844595",
"0.59079087",
"0.58242726",
"0.5810565",
"0.5720067",
"0.56380796",
"0.56306934",
"0.5554415",
"0.55288565",
"0.55027115",
"0.54880166",
"0.54853743",
"0.54810125",
"0.54488546",
"0.54431033",
"0.5396246",
"0.5343557",
"0.5296428",
"0.5295228",
"0.5291945",
"0.5... | 0.71301365 | 0 |
Fetch an egg needed for building. Use pip/wheel to fetch/build a wheel. | def fetch_build_egg(dist, req):
_DeprecatedInstaller.emit()
_warn_wheel_not_available(dist)
return _fetch_build_egg_no_warn(dist, req) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_essential(self):\n self.install_package(\"build-essential\")",
"def build():\n local('python' + python_version + ' setup.py bdist_egg')",
"def ensure_wheel():\n wheels = sorted(DIST.glob(\"*.whl\"))\n if not wheels:\n subprocess.check_call([\"pyproject-build\", \".\", \"--wheel... | [
"0.6031584",
"0.59851366",
"0.5983711",
"0.5879789",
"0.58144295",
"0.57931286",
"0.5760505",
"0.5605846",
"0.5510201",
"0.54663193",
"0.5444306",
"0.54275984",
"0.5427478",
"0.5391566",
"0.5365108",
"0.53289986",
"0.53218055",
"0.5299065",
"0.5275417",
"0.5265924",
"0.525300... | 0.7449293 | 0 |
Return a new requirement without the environment marker to avoid calling pip with something like `babel; extra == "i18n"`, which would always be ignored. | def strip_marker(req):
import pkg_resources # Delay import to avoid unnecessary side-effects
# create a copy to avoid mutating the input
req = pkg_resources.Requirement.parse(str(req))
req.marker = None
return req | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avoid_pip_isolation(env: Mapping[str, str]) -> dict[str, str]:\n new_env = {k: v for k, v in env.items() if k != \"PYTHONNOUSERSITE\"}\n if \"PYTHONPATH\" not in new_env:\n return new_env\n\n new_env[\"PYTHONPATH\"] = os.pathsep.join(\n [\n path\n for path in new_en... | [
"0.6552357",
"0.5994064",
"0.589006",
"0.5876299",
"0.57701266",
"0.5718214",
"0.56937885",
"0.5686367",
"0.5629351",
"0.55940837",
"0.5577624",
"0.549431",
"0.54820436",
"0.5460692",
"0.54408735",
"0.5440247",
"0.5432639",
"0.5432031",
"0.54307127",
"0.54157686",
"0.53946084... | 0.75084823 | 0 |
Initialize database connection and sessionmaker | def __init__(self):
engine = db_connect()
create_tables(engine)
self.Session = sessionmaker(bind=engine) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_db(self):\n\n # The user can provide a custom string\n if self.database is None:\n self.logger.error(\"You must provide a database url, exiting.\")\n sys.exit(1)\n\n self.engine = create_engine(self.database, convert_unicode=True)\n self.session = scoped_session(\n session... | [
"0.77571905",
"0.77500427",
"0.77498686",
"0.77142614",
"0.7675466",
"0.7598643",
"0.75940216",
"0.75440794",
"0.75440794",
"0.753408",
"0.7526113",
"0.7511898",
"0.7495771",
"0.7474186",
"0.737677",
"0.73386455",
"0.73346627",
"0.7311713",
"0.72757417",
"0.7271616",
"0.72439... | 0.79214334 | 0 |
Precompute hashtable for a string with 2 prime numbers and a multiplier. Using a rolling hash function, we can get the hashvalue for any substring in constant time. | def pre_compute_hashes(s, M1, M2, X):
n = len(s)
h1 = [0 for _ in range(n+1)]
h2 = [0 for _ in range(n+1)]
for i in range(1, n+1):
ch = ord(s[i-1])
h1[i] = (X*h1[i-1] + ch) % M1
h2[i] = (X*h2[i-1] + ch) % M2
return h1, h2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _precompute_substrings(self, p: int) -> List[int]:\n hash_vals: List[int] = [0]\n for i in range(len(self._s)):\n val = (hash_vals[i] * self.X + ord(self._s[i])) % p\n hash_vals.append(val)\n\n return hash_vals",
"def get_hash_value(table, prime, multiplier, start, ... | [
"0.7161889",
"0.68627113",
"0.664224",
"0.656542",
"0.6429222",
"0.6295608",
"0.62773484",
"0.6263875",
"0.6260028",
"0.6208387",
"0.6194183",
"0.61931044",
"0.615499",
"0.61416006",
"0.6121987",
"0.60881466",
"0.6085557",
"0.6082059",
"0.6034449",
"0.59991634",
"0.59969115",... | 0.69907576 | 1 |
Uses binary search to find the number of mismatches. It finds the leftmost mismatch and then looks at the substring hash after that index position and continues until the number of mismatches are more than k or the start pointer is more than or equal to end. | def find_num_matches(p1, p2, t1, t2, m1, m2, x, k, len_p, i):
start = 0
for mismatch in range(k):
# print(f'start: {start}, id: {id}')
id = start
end = len_p-1
while start <= end:
mid = start + (end-start)//2
p_h1, p_h2 = get_hash_value(
p1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lcs_hamming_only_matches(s1: str, s2: str, k: int, length: int, matches_lst: List):\n count = 0\n for i in range(0, len(s1) - length + 1):\n for j in range(0, len(s2) - length + 1):\n sub1 = s1[i: i + length]\n sub2 = s2[j: j + length]\n result = hamming_distance(s... | [
"0.6563195",
"0.63334215",
"0.619655",
"0.6072905",
"0.5992598",
"0.5792656",
"0.57802635",
"0.5761363",
"0.57300216",
"0.5706402",
"0.56756544",
"0.5673622",
"0.56674",
"0.5588823",
"0.55755645",
"0.557284",
"0.5536065",
"0.5526799",
"0.55215424",
"0.55209804",
"0.5507269",
... | 0.6899368 | 0 |
Calculate the mse for vector e. | def calculate_mse(e):
return 1/2*np.mean(e**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_mse(e):\n return 1/2*np.mean(e.dot(e))",
"def compute_MSE(e):\n\n return 1/2*np.mean(e**2)",
"def compute_RMSE(e):\n \"\"\"Corresponds to sqrt(2*MSE)\"\"\"\n \n return np.sqrt(2*compute_MSE(e))",
"def _mse(self):\n error = self._input * self._weights - self._label\n ... | [
"0.8627569",
"0.8492956",
"0.7717357",
"0.7474573",
"0.73560566",
"0.73297226",
"0.725569",
"0.72040147",
"0.7180668",
"0.716424",
"0.715627",
"0.7137266",
"0.71137995",
"0.71091557",
"0.71063846",
"0.70705134",
"0.70670843",
"0.70613927",
"0.70559907",
"0.7045481",
"0.703998... | 0.86390364 | 0 |
Set up UI within QGIS | def initGui(self):
# set srs
self._displayCrs = QgsCoordinateReferenceSystem()
self._displayCrs.createFromOgcWmsCrs('EPSG:4167')
self.iface.mapCanvas().mapSettings().setDestinationCrs(self._displayCrs)
# init layerManager
self._layerManager = LayerManager(self.iface, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(self):\n self.ui.setup_window()",
"def initUI(self):\n \n self.setWindowTitle(\"Intecol Flir camera\")\n self.setGeometry(300, 100, 1012, 622)",
"def inicialUI(self):\r\n\r\n self.setGeometry(500, 500, 500, 500)\r\n self.setWindownTitle(\"Pesquisa\")\r\n ... | [
"0.72260803",
"0.7211928",
"0.7206275",
"0.71976244",
"0.7164867",
"0.7164867",
"0.7149143",
"0.7126986",
"0.70783645",
"0.7038808",
"0.70362467",
"0.7032511",
"0.70274544",
"0.698081",
"0.69556254",
"0.69539404",
"0.69419616",
"0.6932011",
"0.69111043",
"0.69000256",
"0.6899... | 0.7779239 | 0 |
Track the current maptool (excluding rcl tool) to allow for rollback to previous tool when the Rcltool is deactivated | def mapToolChanged(self):
if (isinstance(self.iface.mapCanvas().mapTool(), GetRcl) == False and
isinstance(self.iface.mapCanvas().mapTool(), UpdateReviewPosition) == False):
self._currentMapTool = self.iface.mapCanvas().mapTool()
#self.highlighter.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPreviousMapTool(self):\n if self.iface.mapCanvas().mapTool() != self._currentMapTool:\n self.iface.mapCanvas().setMapTool(self._currentMapTool)",
"def set_current_tool_to_none(self):\n\n self.variables.active_tool = None\n self.variables.current_tool = None",
"def set_act... | [
"0.6610602",
"0.6047771",
"0.5808479",
"0.5766622",
"0.5683215",
"0.5666312",
"0.5622825",
"0.55997235",
"0.5575052",
"0.53866893",
"0.53748834",
"0.53327566",
"0.53001404",
"0.5243126",
"0.5231501",
"0.51420516",
"0.50829107",
"0.50697356",
"0.50646985",
"0.5024823",
"0.5017... | 0.6357746 | 1 |
Enable the 'configure aims' dialog | def configureAims(self):
self._config_ui.showDialog() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable(self):\n self.SetInteractive(1)",
"def configure(self):\n dlg = ConfigureDialog(QtGui.QApplication.activeWindow().currentWidget())\n dlg.identifierOccursCount = self._identifierOccursCount\n\n if dlg.exec_():\n self._config = dlg.getConfig()\n dlg.setConfi... | [
"0.6400439",
"0.6159485",
"0.6057136",
"0.60529816",
"0.6036737",
"0.5965732",
"0.59589297",
"0.58659977",
"0.5775678",
"0.57545274",
"0.5744145",
"0.57255495",
"0.5702786",
"0.5681207",
"0.56680506",
"0.56298286",
"0.5622051",
"0.5619457",
"0.5604328",
"0.5602475",
"0.559994... | 0.81929576 | 0 |
Enable the 'create new address' map tool | def startNewAddressTool(self):
self.iface.mapCanvas().setMapTool(self._createnewaddresstool)
self._createnewaddresstool.setEnabled(True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startUpdateAddressTool(self):\n\n self.iface.mapCanvas().setMapTool(self._updateaddtool)\n self._updateaddtool.setEnabled(True)",
"def startMoveAddressTool(self):\n\n self.iface.mapCanvas().setMapTool(self._moveaddtool)\n self._moveaddtool.setEnabled(True)",
"def new_map(self):\... | [
"0.7219506",
"0.7039836",
"0.6763633",
"0.6633369",
"0.65668374",
"0.59695303",
"0.59218526",
"0.58349395",
"0.5776906",
"0.5717231",
"0.57104254",
"0.5676744",
"0.56628376",
"0.5605186",
"0.55983114",
"0.549823",
"0.5495299",
"0.5492283",
"0.5473432",
"0.54679406",
"0.545776... | 0.84176415 | 0 |
Enable the 'get rcl tool' map tool | def startRclTool(self, parent = None):
self.rclParent = parent
self.iface.mapCanvas().setMapTool(self._rcltool)
self._rcltool.setEnabled(True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onMapToolActivated(self, e):\n pass",
"def mapToolChanged(self):\n \n if (isinstance(self.iface.mapCanvas().mapTool(), GetRcl) == False and\n isinstance(self.iface.mapCanvas().mapTool(), UpdateReviewPosition) == False): \n self._currentMapTool = sel... | [
"0.6035034",
"0.59180385",
"0.5910891",
"0.5775591",
"0.570419",
"0.5659089",
"0.5643911",
"0.5594283",
"0.55799174",
"0.5391594",
"0.5363833",
"0.53254557",
"0.531566",
"0.5236203",
"0.5193972",
"0.51902187",
"0.518054",
"0.5168814",
"0.5163724",
"0.5154438",
"0.51030445",
... | 0.60152096 | 1 |
Enable the 'move address' map tool | def startMoveAddressTool(self):
self.iface.mapCanvas().setMapTool(self._moveaddtool)
self._moveaddtool.setEnabled(True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startNewAddressTool(self):\n self.iface.mapCanvas().setMapTool(self._createnewaddresstool)\n self._createnewaddresstool.setEnabled(True)",
"def enableAddressLayer(self):\n\n self._deladdressaction.setEnabled(True)\n self._createnewaddressaction.setEnabled(True)\n self._move... | [
"0.70482296",
"0.6882556",
"0.6680604",
"0.6600201",
"0.6302381",
"0.6076492",
"0.5613634",
"0.5609297",
"0.5577446",
"0.5559024",
"0.5549096",
"0.5530175",
"0.5403303",
"0.53529227",
"0.5299035",
"0.52719486",
"0.52694035",
"0.5255019",
"0.523649",
"0.52247787",
"0.52008283"... | 0.802022 | 0 |
Enable the "update address" map tool | def startUpdateAddressTool(self):
self.iface.mapCanvas().setMapTool(self._updateaddtool)
self._updateaddtool.setEnabled(True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startNewAddressTool(self):\n self.iface.mapCanvas().setMapTool(self._createnewaddresstool)\n self._createnewaddresstool.setEnabled(True)",
"def enableAddressLayer(self):\n\n self._deladdressaction.setEnabled(True)\n self._createnewaddressaction.setEnabled(True)\n self._move... | [
"0.731475",
"0.68513423",
"0.65981966",
"0.63955295",
"0.5972027",
"0.5911757",
"0.5825655",
"0.5821094",
"0.5787878",
"0.5732821",
"0.5685454",
"0.5596522",
"0.5579056",
"0.556285",
"0.5560578",
"0.55568826",
"0.5414187",
"0.5379938",
"0.53794837",
"0.53684026",
"0.5366601",... | 0.8050349 | 0 |
Enable the "delete address" map tool | def startDelAddressTool(self):
self.iface.mapCanvas().setMapTool(self._deladdtool)
self._deladdtool.setEnabled(True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def erase_address(self):\n self.remove_pointer_or_layer()\n if self.geocoder_source_model is not None:\n self.geocoder_source_model.clear()\n if self.dlg.geocoder_search is not None:\n self.dlg.geocoder_search.clear()\n if self.toolbar_search is not None:\n ... | [
"0.6550085",
"0.6467427",
"0.6311727",
"0.62195885",
"0.6132217",
"0.61023366",
"0.60953397",
"0.60527706",
"0.5956514",
"0.5815314",
"0.57877815",
"0.5704363",
"0.56430364",
"0.5642785",
"0.5599457",
"0.5550336",
"0.5488163",
"0.54792076",
"0.5436945",
"0.54259276",
"0.53910... | 0.7489834 | 0 |
Review data changed, update review layer and table | def rDataChanged(self):
self._queues.uResolutionTab.refreshData()
self._layerManager.updateReviewLayer() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutate(self, info, id, input):\n user = info.context.user\n\n model, node_id = from_global_id(id)\n try:\n data_review = DataReview.objects.get(pk=node_id)\n except DataReview.DoesNotExist:\n raise GraphQLError(\"DataReview was not found\")\n\n # Check p... | [
"0.6250439",
"0.59114504",
"0.5905991",
"0.58744705",
"0.57848674",
"0.5783843",
"0.5747949",
"0.5709248",
"0.5637344",
"0.5614386",
"0.56124216",
"0.558743",
"0.55666566",
"0.5545397",
"0.55370015",
"0.55307335",
"0.550496",
"0.5492444",
"0.5486151",
"0.54773945",
"0.5464195... | 0.6456079 | 0 |
Feature data changed, update review layer and table | def fDataChanged(self):
self._layerManager.getAimsFeatures() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rDataChanged(self):\n\n self._queues.uResolutionTab.refreshData()\n self._layerManager.updateReviewLayer()",
"def updateAttributesAfterAdding(self):\n layer = self.sender()\n while self.addedFeatures:\n featureId = self.addedFeatures.pop()\n #begining the edi... | [
"0.6235317",
"0.60541224",
"0.6049854",
"0.57644933",
"0.56803846",
"0.5665546",
"0.5665546",
"0.56608504",
"0.559064",
"0.55822855",
"0.5540997",
"0.5530786",
"0.55232674",
"0.55232483",
"0.5520127",
"0.54641056",
"0.5430033",
"0.5420449",
"0.54120576",
"0.54066986",
"0.5397... | 0.6226966 | 1 |
Return instance of the Controller | def instance():
if Controller._instance == None:
Controller._instance = Controller()
return Controller._instance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller( self ):\n\t\ttry:\n\t\t\treturn self._controller\n\t\texcept Exception as e:\n\t\t\tself.logToConsole( \"controller: %s\" % str(e) )",
"def create_controller() -> Controller:\n _controller = Controller()\n return _controller",
"def _get_controller(self):\n return self.__controller",
... | [
"0.79567254",
"0.7908007",
"0.788236",
"0.7821275",
"0.7791155",
"0.7606602",
"0.73090816",
"0.7151729",
"0.66534436",
"0.6500115",
"0.64955103",
"0.6494055",
"0.64003295",
"0.6300476",
"0.62928957",
"0.6199271",
"0.6160714",
"0.6128002",
"0.61126775",
"0.6013205",
"0.5929797... | 0.83611196 | 0 |
The WT strain IDs matched with WT ORFs | def wt_strains(df):
ts_plates = []
dma_plates = []
for plate in df.Plate.unique():
if ('_26C_' in plate) or ('_37C_' in plate):
ts_plates.append(plate)
else:
dma_plates.append(plate)
wt_strain_ids_dma = df[(df['ORF'].isin(['YOR202W'])) &
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filter_otus_from_otu_table_ids(self):\r\n otu_table = parse_biom_table_str(dense_otu_table1)\r\n filtered_otu_table = filter_otus_from_otu_table(otu_table,\r\n set(otu_table.ObservationIds) - set(['34', '155', '152']), 0, inf, 0, inf)\r\... | [
"0.5487055",
"0.5474353",
"0.54263955",
"0.52766407",
"0.5237478",
"0.5204371",
"0.508735",
"0.50703365",
"0.5059241",
"0.50212437",
"0.5014215",
"0.50075287",
"0.49974915",
"0.4996851",
"0.4983923",
"0.49771553",
"0.4968982",
"0.49651924",
"0.49472168",
"0.49351105",
"0.4927... | 0.6810067 | 0 |
Plot data with inoutlier information using the first 2 PCs | def plot_in_outliers(data, mask, output):
oc = 'lightskyblue'
ic = 'navy'
plt.figure(figsize=(15, 18))
sns.set_style('white')
x_all = pd.DataFrame({'PC1': data[:, 0], 'PC2': data[:, 1]})
x_inliers = pd.DataFrame({'PC1': data[mask == 0, 0], 'PC2': data[mask == 0, 1]})
x_outliers = pd.DataFra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PlotOutlier(data_dict, feature_x, feature_y):\n data = featureFormat(data_dict, [feature_x, feature_y, 'poi'])\n for point in data:\n x = point[0]\n y = point[1]\n poi = point[2]\n if poi:\n color = 'red'\n else:\n color = 'blue'\n plt.scatt... | [
"0.6546934",
"0.6507884",
"0.64871204",
"0.6229395",
"0.6091009",
"0.58001107",
"0.5764339",
"0.57519376",
"0.57438624",
"0.5653837",
"0.56201476",
"0.56173015",
"0.55946594",
"0.5585635",
"0.5563802",
"0.5529469",
"0.55118716",
"0.5480892",
"0.5454786",
"0.5449976",
"0.54473... | 0.7036596 | 0 |
Calculate the maximum difference in percentage between mutant and wt populations on cumulative distribution of score as an estimate for penetrance | def estimate_penetrance(wt, mut):
# Find the maximum difference between two CDFs
maxx = 0
for i in range(len(wt)):
diff = wt[i]-mut[i]
if diff > maxx:
maxx = diff
return maxx * 100 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_drift_score(ref_col_prob, col_prob):\n\n return sum(abs(np.asarray(ref_col_prob) - np.array(col_prob)) * 100)",
"def mutual_info_score(self):\n _, _, I_CK = self._entropies()\n return I_CK / self.grand_total",
"def grade(population, target_sum, target_mult):\r\n summed = reduce(ad... | [
"0.6367103",
"0.63137776",
"0.624538",
"0.61520624",
"0.6144295",
"0.6119892",
"0.6105903",
"0.60700804",
"0.6008827",
"0.59998465",
"0.59672254",
"0.5960492",
"0.5921287",
"0.5896108",
"0.58913654",
"0.58866644",
"0.5866073",
"0.5849949",
"0.58120936",
"0.5789974",
"0.577659... | 0.72945195 | 0 |
Estimate penetrance for the group | def calculate_penetrace_per_group(df, group_features, neg):
# Group information
info = list(df[group_features].drop_duplicates().values[0])
num_cells = df.shape[0]
info.append(num_cells)
# Calculate penetrance
penetrance = np.nan
ks_penetrance = np.nan
wt_percentile = np.nan
mut_sc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pie_chart_score(self, grouped):\n picked_scenario = self.scenario_dict[\"%d\" % (self.scenario_num-1)]\n distinct_enum_X = self.data_dict[picked_scenario[\"X\"]]['distinct_enum']\n score = 0\n if min(grouped) < 0:\n score = 0\n elif distinct_enum_X == 1:\n ... | [
"0.5930809",
"0.5871412",
"0.57584465",
"0.570286",
"0.56643695",
"0.56087494",
"0.5525248",
"0.550499",
"0.5489124",
"0.5488275",
"0.5467969",
"0.5459607",
"0.5425661",
"0.54031116",
"0.53869504",
"0.5381044",
"0.5365898",
"0.5334589",
"0.53107226",
"0.52837145",
"0.52837145... | 0.6121099 | 0 |
Prepare the output file with average WT penetrance per plate | def prepare_wt_penetrance_results(df, neg, output):
df_output = pd.DataFrame(columns=['Plate', 'Sum - Num_cells', 'Penetrance', 'KS_Penetrance'])
plates = sorted(df.Plate.unique())
this_row = 0
for plate in plates:
df_p = df[(df['Plate'] == plate) & (df['Strain ID'].isin(neg))]
df_p = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_pre(df, df_rain, df_runoff, df_sm, watershed):\n\n df_xy = pd.read_csv(os.path.join(os.path.dirname(__file__), 'Lucky_hills_input_data', 'WGEW_gauge_locations.csv'))\n\n avgsm = df_sm.sm5.mean()\n\n for preName in df.preName:\n\n print(f'create .pre file for event {preName}')\n\n d... | [
"0.6286624",
"0.5683134",
"0.5586905",
"0.5525071",
"0.552144",
"0.5507411",
"0.5504974",
"0.5461099",
"0.54522216",
"0.5407216",
"0.53955317",
"0.5394013",
"0.5390017",
"0.53712225",
"0.53609866",
"0.535998",
"0.53588486",
"0.53359824",
"0.53238076",
"0.5320318",
"0.5318068"... | 0.6270066 | 1 |
Save high confidence outlier cells from strains with > penetrance of 90th WT penetrance | def save_outlier_cells(df_well, df_strain, df_strain_scores, output):
# Filter strains
wt_strain_ids = wt_strains(df_strain_scores)
df_strain = df_strain[df_strain['Strain ID'].isin(df_strain_scores['Strain ID'].unique())]
df_well = df_well[(df_well['Strain ID'].isin(wt_strain_ids)) &
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_high_gi(df):\n df = df[df['2h-iAUC'] <= 75]\n writer = pd.ExcelWriter('final_dataset_with_median.xlsx', engine='xlsxwriter')\n df.to_excel(writer, sheet_name='Sheet1')\n writer.save()",
"def early_warnings_sensitivity_analysis(series,\n indicators=['v... | [
"0.5806118",
"0.5517937",
"0.5420683",
"0.54034156",
"0.5347539",
"0.534004",
"0.5339723",
"0.53011847",
"0.5298448",
"0.5295308",
"0.52592945",
"0.52575207",
"0.52557695",
"0.52543205",
"0.52489877",
"0.52084166",
"0.52046674",
"0.5196227",
"0.51782423",
"0.51771146",
"0.517... | 0.6827614 | 0 |
Plot WT inlier cells and outlier cells from highly penetrant genes | def plot_cells(df, df_well, df_strain, df_score, neg, cell_features, data_features, output):
# Strains with high penetrance values
wt_penetrances = df_well[df_well['Strain ID'].isin(neg)]['Penetrance'].dropna().values
pene_threshold = stats.scoreatpercentile(wt_penetrances, 95)
high_pene_strains = df_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_in_outliers(data, mask, output):\n\n oc = 'lightskyblue'\n ic = 'navy'\n plt.figure(figsize=(15, 18))\n sns.set_style('white')\n x_all = pd.DataFrame({'PC1': data[:, 0], 'PC2': data[:, 1]})\n x_inliers = pd.DataFrame({'PC1': data[mask == 0, 0], 'PC2': data[mask == 0, 1]})\n x_outliers... | [
"0.64420354",
"0.5983264",
"0.59060514",
"0.5854271",
"0.5798881",
"0.5769779",
"0.57064456",
"0.5657062",
"0.563888",
"0.5605974",
"0.560229",
"0.5599474",
"0.5576867",
"0.5527959",
"0.5516743",
"0.55078536",
"0.5483265",
"0.5426917",
"0.5398972",
"0.53946674",
"0.53912854",... | 0.6301111 | 1 |
Open lenfile to determine length of each contig in ref.fa. | def openlenfile(lenfile):
with open(lenfile, 'r') as o:
text = o.read().split("\n")
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_length(fileName):\n with open(f_pass) as f:\n for i, l in enumerate(f):\n pass\n return i + 1",
"def file_len(fname):\n with open(fname) as f:\n for i, l in enumerate(f):\n pass\n Nrows = i + 1\n return Nrows",
"def file_len(f):\n\n ... | [
"0.6596299",
"0.65170276",
"0.6510556",
"0.64972013",
"0.6382751",
"0.634846",
"0.6290514",
"0.6267712",
"0.6207364",
"0.61850536",
"0.6170275",
"0.6133182",
"0.61330396",
"0.6116903",
"0.6094633",
"0.60247296",
"0.59479153",
"0.59410506",
"0.5937424",
"0.588958",
"0.58894855... | 0.6669815 | 0 |
Create dir for bedfiles. | def make_beddir():
bname = op.basename(ref).split(".fa")[0]
beddir = makedir(op.join(op.dirname(ref), 'bedfiles_%s' % bname))
return bname, beddir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createDir(self, dir_name):\n os.mkdir(os.path.join(self.user[\"Save\"], dir_name))",
"def make_case_dir(self):\n\n mkdir(directory=self.dir)\n mkdir(directory=self.sub_dir)",
"def make_dir(self):\n if not os.path.exists(self.d):\n try:\n os.mkdir(self.d... | [
"0.7125149",
"0.70820016",
"0.70502377",
"0.69840735",
"0.6936681",
"0.68457246",
"0.6840222",
"0.6807135",
"0.6796343",
"0.67916274",
"0.67853177",
"0.67853177",
"0.6780806",
"0.6770088",
"0.67424643",
"0.6727917",
"0.6727697",
"0.6726145",
"0.6721723",
"0.67215335",
"0.6704... | 0.7920128 | 0 |
Write contig/chrom, start, stop positions to bedfile. | def make_bed(lines, num):
f = get_prereqs(num)
with open(f, 'w') as o:
for contig, start, stop in lines:
o.write("%s\t%s\t%s\n" % (contig, start, stop)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self, outfile):\n outfile.write(\n '\\t'.join(\n [\n str(i) for i in [\n self.chrom, self.start, self.end, self.name,\n self.count, self.fold_change, self.log10p\n ]\n ]\n ... | [
"0.60150325",
"0.59635466",
"0.56702024",
"0.56527853",
"0.56182194",
"0.55816156",
"0.55281764",
"0.54684925",
"0.5462438",
"0.53775287",
"0.5333092",
"0.53054655",
"0.52583885",
"0.5236999",
"0.5216365",
"0.52040017",
"0.5203083",
"0.51540524",
"0.5143235",
"0.5138014",
"0.... | 0.6088629 | 0 |
If intervals.list files exist, use these instead of ref.fa.length file. | def make_bed_from_intervals(intdir):
intfiles = [f for f in fs(intdir) if f.endswith('.list')]
for intfile in intfiles:
num = intfile.split("_")[-1].replace(".list", "")
lines = []
with open(intfile, 'r') as o:
text = o.read().split("\n")
for line in text:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_positions():\n refdir = op.dirname(ref)\n intdir = op.join(refdir, 'intervals')\n # look for intervals directory with .list files\n if op.exists(intdir):\n print('\\tusing intervals dir to create bedfiles for %s' % ref)\n make_bed_from_intervals(intdir)\n return\n # loo... | [
"0.5596598",
"0.5420073",
"0.53824025",
"0.52861524",
"0.5261305",
"0.50874186",
"0.50684524",
"0.4995538",
"0.49851644",
"0.4981738",
"0.49681863",
"0.49664834",
"0.49223024",
"0.49208766",
"0.49206412",
"0.4918922",
"0.49170592",
"0.49125102",
"0.49114218",
"0.49038002",
"0... | 0.5453543 | 1 |
Use ref.order file to create bedfiles for parallelization. Evenly distributes contigs across X number of files specified to calculate thresh. | def make_beds_from_orderfile():
orderfile = ref.replace(".fa", "") + '.order'
print('\n\tCreating bedfiles from %s. Please confirm:\n\tAssuming .order file is of format:\n\t\tref_scaff<tab>contig_name<tab>start_pos<tab>stop_pos<tab>contig_length' % orderfile)
askforinput(tab='\t', newline='')
with open(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_bedfiles():\n df = pd.read_csv(\"%s.length\" % ref, sep='\\t', header=None)\n thresh = math.ceil(sum(df[1]) / globals()['jobs_per_pool'])\n lines = []\n fcount = 0\n fsum = 0\n for count,row in enumerate(df.index):\n contig, length = list(df.loc[row, :])\n fsum += length\n ... | [
"0.6590571",
"0.61164385",
"0.6017592",
"0.5689988",
"0.5628261",
"0.5574964",
"0.5478103",
"0.54726285",
"0.5446761",
"0.54318154",
"0.54137427",
"0.54006183",
"0.53667706",
"0.53506273",
"0.53197247",
"0.5316093",
"0.5272207",
"0.52560264",
"0.5221501",
"0.5205024",
"0.5189... | 0.6294389 | 1 |
Find positions to create bedfiles. First look for an intervals directory, then for a ref.order file. If neither exist, use ref.length file (ie, a lenfile) if this doesn't exist, create one from the ref.fa. A lenfile is a file created from the ref.fa that has lengths of each contig/chromosome. | def find_positions():
refdir = op.dirname(ref)
intdir = op.join(refdir, 'intervals')
# look for intervals directory with .list files
if op.exists(intdir):
print('\tusing intervals dir to create bedfiles for %s' % ref)
make_bed_from_intervals(intdir)
return
# look for a ref.or... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_beds_from_orderfile():\n orderfile = ref.replace(\".fa\", \"\") + '.order'\n print('\\n\\tCreating bedfiles from %s. Please confirm:\\n\\tAssuming .order file is of format:\\n\\t\\tref_scaff<tab>contig_name<tab>start_pos<tab>stop_pos<tab>contig_length' % orderfile)\n askforinput(tab='\\t', newlin... | [
"0.6035527",
"0.59248257",
"0.52282196",
"0.51990765",
"0.5198975",
"0.51359016",
"0.5092171",
"0.49188724",
"0.48909006",
"0.48892576",
"0.48381808",
"0.4836135",
"0.47870463",
"0.47688",
"0.47637847",
"0.4749879",
"0.47248846",
"0.47141135",
"0.47044",
"0.47014743",
"0.4699... | 0.83084154 | 0 |
Use ref.fa.length or ref.order file to write contig/chorm, start, stop to bedfile. | def make_bedfile(lines, fcount, from_orderfile=False):
f = get_prereqs(fcount)
text = []
with open(f, 'w') as o:
for line in lines:
if from_orderfile is False:
contig, length = line
text.append("%s\t%s\t%s" % (contig, 0, int(length)-1)) # contig \t start ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_beds_from_orderfile():\n orderfile = ref.replace(\".fa\", \"\") + '.order'\n print('\\n\\tCreating bedfiles from %s. Please confirm:\\n\\tAssuming .order file is of format:\\n\\t\\tref_scaff<tab>contig_name<tab>start_pos<tab>stop_pos<tab>contig_length' % orderfile)\n askforinput(tab='\\t', newlin... | [
"0.6323418",
"0.62829024",
"0.61649925",
"0.6098245",
"0.60466856",
"0.5953595",
"0.5946328",
"0.5867471",
"0.57360923",
"0.57180756",
"0.5669914",
"0.56460124",
"0.5614862",
"0.5594809",
"0.5577744",
"0.55528116",
"0.554931",
"0.55370843",
"0.55333304",
"0.55181164",
"0.5512... | 0.65602005 | 0 |
Use ref.fa.length file to create bedfiles. Evenly distributes basepairs across X number of files specified to calculate thresh. | def make_bedfiles():
df = pd.read_csv("%s.length" % ref, sep='\t', header=None)
thresh = math.ceil(sum(df[1]) / globals()['jobs_per_pool'])
lines = []
fcount = 0
fsum = 0
for count,row in enumerate(df.index):
contig, length = list(df.loc[row, :])
fsum += length
lines.appe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_positions():\n refdir = op.dirname(ref)\n intdir = op.join(refdir, 'intervals')\n # look for intervals directory with .list files\n if op.exists(intdir):\n print('\\tusing intervals dir to create bedfiles for %s' % ref)\n make_bed_from_intervals(intdir)\n return\n # loo... | [
"0.6323582",
"0.60488206",
"0.5817745",
"0.5746369",
"0.5689245",
"0.5664225",
"0.5551799",
"0.551062",
"0.5500697",
"0.54490316",
"0.543353",
"0.5415477",
"0.53688526",
"0.53139466",
"0.5303735",
"0.52852124",
"0.52845037",
"0.5283229",
"0.5273382",
"0.52659917",
"0.52022564... | 0.77063954 | 0 |
Avoid accidentally using incorrect bedfiles by removing any that exist. | def check_beddir():
bname, beddir = make_beddir()
files = [f for f in fs(beddir) if f.endswith('.bed')]
if len(files) > 0:
text = '\tThere are already existing bedfiles in %s. These will be deleted.' % beddir
print(Bcolors.WARNING + text + Bcolors.ENDC)
askforinput(tab='\t', newline=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup() -> None:\n\n for fname in glob(os.path.join(tdir, 'alexandria.*')):\n if os.path.splitext(fname)[1] not in {'.c', '.h'}:\n os.unlink(fname)",
"def _clean_input_dir():\n for existing_file in os.listdir(join(input_dir, 'analysis')):\n ... | [
"0.67623425",
"0.6754878",
"0.67248297",
"0.6710017",
"0.6476191",
"0.6463225",
"0.6392083",
"0.6380994",
"0.6339569",
"0.63066906",
"0.6296585",
"0.6264032",
"0.6262186",
"0.62532663",
"0.6250286",
"0.62268937",
"0.6203356",
"0.6201634",
"0.6197063",
"0.61752784",
"0.6161145... | 0.7251923 | 0 |
`other` is the state to transition to. | def __rshift__(self, other):
if not isinstance(other, State):
raise Error(
'expected a State instance, but got {}'.format(repr(other)))
self._transitions.append((self._event, other))
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\r\n if other:\r\n if self.state == other.state:\r\n return True",
"def switch_to_state(self, Rover, name):\n name.execute(Rover)\n self.curr_state = name",
"def state_changed(self, old_state, new_state, target_state):\n pass",
"de... | [
"0.60229385",
"0.5950636",
"0.58616793",
"0.5826824",
"0.57995635",
"0.57883424",
"0.57480127",
"0.57173836",
"0.5704981",
"0.5686667",
"0.5667739",
"0.566679",
"0.56586593",
"0.5653753",
"0.5637859",
"0.5632062",
"0.5630901",
"0.5603314",
"0.5575363",
"0.55619264",
"0.556186... | 0.6611836 | 0 |
Process given event `event`. Raises an `UnexpectedEventError` if given event was unexpected. | def process_event(self, event):
print('Current state: {}, Event to process: {}'.format(
self._current_state.name,
event))
# # Is the event expected?
# try:
# transition = self._current_state.events[type(event)]
# except KeyError:
# raise ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_event(event_processor, event):\n\n log = logging.getLogger(__name__)\n try:\n log.debug(\"Processing Event: %s - %s\" % (event[\"content_type\"], event[\"routing_key\"]))\n event_processor.process_event(event[\"content_type\"], event[\"routing_key\"], event[\"body\"])\n except:\n... | [
"0.70300627",
"0.6771751",
"0.67416",
"0.66380054",
"0.642705",
"0.6365013",
"0.6362536",
"0.62995046",
"0.6274929",
"0.6259453",
"0.61244756",
"0.6117413",
"0.6094892",
"0.60790133",
"0.59835047",
"0.5926056",
"0.59134126",
"0.5895901",
"0.58831525",
"0.5871841",
"0.5862529"... | 0.69930625 | 1 |
Executes the keyword provided by product driver | def test_execute_keyword():
keyword = 'store_in_repo'
data_repository = {'db_obj': False, 'war_file_type': 'Case', 'wt_results_execdir': None,\
'wt_logs_execdir': None, 'wt_name': 'test', 'step_num':None}
args_repository = {'datavar': 'a', 'datavalue': 'b'}
warrior.Framework.Utils.testcase_Utils.pS... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_method_for_keyword(self):\n\n kwargs, kw_status = self.get_argument_as_keywords()\n print_info(\"The Arguments passed for the current Step is: '{0}'\".format(kwargs))\n if kw_status:\n # Execute the corresponding method\n method_loader = self.exec_obj.im_class... | [
"0.6734542",
"0.66397667",
"0.6439564",
"0.6229538",
"0.6033111",
"0.6021556",
"0.59995455",
"0.56600654",
"0.5628254",
"0.5510531",
"0.5510531",
"0.5477481",
"0.546144",
"0.5443456",
"0.5430221",
"0.5398615",
"0.5371088",
"0.5365336",
"0.5324174",
"0.53204644",
"0.53204644",... | 0.70761853 | 0 |
Test the chooser when there are no news items, but the user has relevant permissions. | def test_chooser_has_perms_no_news(self):
response = self.client.get(reverse('wagtailnews:choose'))
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_chooser_no_perms(self):\n root_page = Page.objects.get(pk=2)\n root_page.add_child(instance=NewsIndex(\n title='News', slug='news'))\n root_page.add_child(instance=SecondaryNewsIndex(\n title='Secondary News', slug='secondary-news'))\n\n response = self.cl... | [
"0.73646075",
"0.61538947",
"0.6025898",
"0.5865416",
"0.58521277",
"0.5842307",
"0.582308",
"0.57966214",
"0.57383853",
"0.572046",
"0.5719911",
"0.5717424",
"0.5702386",
"0.56986713",
"0.56581986",
"0.5656366",
"0.56463605",
"0.56425077",
"0.56178695",
"0.5616088",
"0.56047... | 0.813045 | 0 |
Check the user is allowed to access the news index list | def test_news_index_has_perm(self):
self.assertStatusCode(self.url, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_staff_access(self):\r\n self.check_index_and_outline(self.client)",
"def can_view(self, user):\r\n return True",
"def test_news_index_no_perm(self):\n self.assertStatusCode(self.url, 403)",
"def has_super_access():\n current_user = frappe.get_doc('User', frappe.session.use... | [
"0.71869683",
"0.701034",
"0.6941104",
"0.6793444",
"0.67805856",
"0.67128044",
"0.66727525",
"0.66707075",
"0.66169983",
"0.6611218",
"0.65815014",
"0.65591043",
"0.6556533",
"0.6549251",
"0.6537417",
"0.6531668",
"0.65135354",
"0.65135354",
"0.65135354",
"0.64980245",
"0.64... | 0.72420925 | 0 |
Check the user is denied access to the news index list | def test_news_index_no_perm(self):
self.assertStatusCode(self.url, 403) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_everyone_denied(self):",
"def test_news_index_has_perm(self):\n self.assertStatusCode(self.url, 200)",
"def test_if_forbiden_for_authenticated_permissions(self):\r\n res = self.client_authenticated.get(reverse(LIST_USER_URL),data={})\r\n self.assertEqual(res.status_code, status.HTT... | [
"0.6909648",
"0.6811918",
"0.66676253",
"0.661869",
"0.6616912",
"0.6532068",
"0.6532068",
"0.6508571",
"0.6508571",
"0.6508571",
"0.6508571",
"0.6493177",
"0.6466608",
"0.64571303",
"0.6441584",
"0.64142835",
"0.6403795",
"0.63929635",
"0.6385503",
"0.63569266",
"0.6335534",... | 0.75531065 | 0 |
Test that the edit button appears | def test_edit_button_appears(self):
response = self.client.get(reverse('wagtailnews:index', kwargs={
'pk': self.index.pk}))
self.assertContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click_the_edit_button_that_appears(driver):\n driver.find_element_by_xpath(xpaths.users.eric_Edit_Button).click()",
"def test_update_custom_button(self):\n pass",
"def test_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk'... | [
"0.73463446",
"0.7318908",
"0.71983856",
"0.7112342",
"0.7079817",
"0.703186",
"0.69559354",
"0.69065946",
"0.68714213",
"0.6804673",
"0.66963583",
"0.66772723",
"0.66686046",
"0.66202444",
"0.6597754",
"0.6578515",
"0.654788",
"0.6525747",
"0.6478392",
"0.647718",
"0.647047"... | 0.76415926 | 0 |
Test that the unpublish button appears | def test_unpublish_button_appears(self):
response = self.client.get(reverse('wagtailnews:index', kwargs={
'pk': self.index.pk}))
self.assertContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_no_unpublish_button_appears(self):\n response = self.client.get(reverse('wagtailnews:index', kwargs={\n 'pk': self.index.pk}))\n self.assertNotContains(response, self.url)",
"def test_unpublish_as_publisher(self):\n e = self.make_event()\n e.published=True\n ... | [
"0.79772043",
"0.70692533",
"0.67827237",
"0.6501703",
"0.6320983",
"0.6103904",
"0.60975456",
"0.6091303",
"0.60491884",
"0.6046391",
"0.6036287",
"0.6016861",
"0.60101634",
"0.59801006",
"0.5962303",
"0.5924949",
"0.5915684",
"0.5897269",
"0.58937395",
"0.58638966",
"0.5822... | 0.8308116 | 0 |
Test that the unpublish button does not appear | def test_no_unpublish_button_appears(self):
response = self.client.get(reverse('wagtailnews:index', kwargs={
'pk': self.index.pk}))
self.assertNotContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unpublish_button_appears(self):\n response = self.client.get(reverse('wagtailnews:index', kwargs={\n 'pk': self.index.pk}))\n self.assertContains(response, self.url)",
"def test_unpublish_as_publisher(self):\n e = self.make_event()\n e.published=True\n e.sav... | [
"0.8303605",
"0.71829754",
"0.69715375",
"0.6870269",
"0.67917633",
"0.65356666",
"0.65167207",
"0.64881694",
"0.6480685",
"0.63422185",
"0.6219732",
"0.6219732",
"0.62114465",
"0.6083142",
"0.60725623",
"0.6066293",
"0.60468704",
"0.6006602",
"0.5987236",
"0.5967933",
"0.594... | 0.83218503 | 0 |
Test that the delete button appears on the index page | def test_delete_button_appears_index(self):
response = self.client.get(reverse('wagtailnews:index', kwargs={
'pk': self.index.pk}))
self.assertContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_custom_button(self):\n pass",
"def test_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertContains(response, self.url)",
"def test_no_delete_b... | [
"0.7964029",
"0.7892996",
"0.7400673",
"0.73430234",
"0.71478194",
"0.7119191",
"0.7053078",
"0.6989711",
"0.6853455",
"0.6781707",
"0.6727742",
"0.6702557",
"0.66956884",
"0.6683815",
"0.6649543",
"0.66001225",
"0.65985805",
"0.65659857",
"0.6558182",
"0.6522168",
"0.6506768... | 0.81418383 | 0 |
Test that the delete button does not appear on the index page | def test_no_delete_button_appears_index(self):
response = self.client.get(reverse('wagtailnews:index', kwargs={
'pk': self.index.pk}))
self.assertNotContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_button_appears_index(self):\n response = self.client.get(reverse('wagtailnews:index', kwargs={\n 'pk': self.index.pk}))\n self.assertContains(response, self.url)",
"def test_no_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit... | [
"0.7858739",
"0.78354084",
"0.7627659",
"0.75596243",
"0.74663603",
"0.7334929",
"0.70581496",
"0.7052979",
"0.7024209",
"0.68837976",
"0.6852879",
"0.67638767",
"0.67259175",
"0.671539",
"0.6689493",
"0.66716695",
"0.6657678",
"0.66534823",
"0.66348356",
"0.6614664",
"0.6606... | 0.80642617 | 0 |
Test that the delete button appears on the edit page | def test_delete_button_appears_edit(self):
response = self.client.get(reverse('wagtailnews:edit', kwargs={
'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))
self.assertContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_custom_button(self):\n pass",
"def test_no_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertNotContains(response, self.url)",
"def test_comme... | [
"0.8166414",
"0.7414952",
"0.723374",
"0.7127024",
"0.6995213",
"0.68870395",
"0.6840543",
"0.67911434",
"0.6724883",
"0.6652456",
"0.66225034",
"0.65894556",
"0.655768",
"0.6549066",
"0.6507977",
"0.6503928",
"0.6462864",
"0.6460414",
"0.64468193",
"0.64352983",
"0.637209",
... | 0.82615966 | 0 |
Test that the delete button does not appear on the edit page | def test_no_delete_button_appears_edit(self):
response = self.client.get(reverse('wagtailnews:edit', kwargs={
'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))
self.assertNotContains(response, self.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_button_appears_edit(self):\n response = self.client.get(reverse('wagtailnews:edit', kwargs={\n 'pk': self.index.pk, 'newsitem_pk': self.newsitem.pk}))\n self.assertContains(response, self.url)",
"def test_delete_custom_button(self):\n pass",
"def test_no_edit_but... | [
"0.7922662",
"0.78152597",
"0.74040025",
"0.7340192",
"0.7057694",
"0.6956841",
"0.6919261",
"0.68916804",
"0.6828039",
"0.6781857",
"0.67025316",
"0.6697165",
"0.66651994",
"0.658142",
"0.6545721",
"0.6544052",
"0.6535346",
"0.6535192",
"0.6469189",
"0.64268947",
"0.6397583"... | 0.8121819 | 0 |
Calculate lagged coherence of sig at frequency freq using the hanningtaper FFT method | def _lagged_coherence_1freq(sig, freq, fs, n_cycles=3):
# Determine number of samples to be used in each window to compute lagged coherence
n_samps = int(np.ceil(n_cycles * fs / freq))
# For each N-cycle chunk, calculate the fourier coefficient at the frequency of interest, freq
chunks = _nonoverlappi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_freqs(sig, fft_size):\n Lf = np.fft.fft(sig, fft_size)\n Lc = Lf[0:fft_size//2]\n La = np.abs(Lc[0:fft_size//2])\n Lg = np.angle(Lc[0:fft_size//2])\n return La, Lg",
"def lagged_coherence(sig, f_range, fs, n_cycles=3, f_step=1, return_spectrum=False):\n\n # Identify Fourier components o... | [
"0.6763134",
"0.6559883",
"0.6400544",
"0.6346103",
"0.6291018",
"0.62314177",
"0.6180077",
"0.6164072",
"0.6131286",
"0.61223423",
"0.6004857",
"0.60042465",
"0.5987924",
"0.5978381",
"0.5971407",
"0.59468603",
"0.5940557",
"0.5932638",
"0.59309757",
"0.5929165",
"0.5924323"... | 0.7040043 | 0 |
Split sig into nonoverlapping chunks of length N | def _nonoverlapping_chunks(sig, n_samples):
n_chunks = int(np.floor(len(sig) / float(n_samples)))
chunks = np.reshape(sig[:int(n_chunks * n_samples)], (n_chunks, int(n_samples)))
return chunks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_by_n(seq, n):\n while seq:\n yield seq[:n]\n seq = seq[n:]",
"def split_by_n( seq, n ):\n while seq:\n yield seq[:n]\n seq = seq[n:]",
"def split_seq(seq,size):\n for i in range(0,len(seq),size):\n if i+size<len(seq) and seq[i+size] - seq[i] == ... | [
"0.6515251",
"0.65040153",
"0.6353311",
"0.63250804",
"0.6303389",
"0.6263644",
"0.6134201",
"0.6105199",
"0.6078715",
"0.6029697",
"0.5970635",
"0.59692246",
"0.5947306",
"0.5942355",
"0.59412867",
"0.5921488",
"0.5913542",
"0.59111804",
"0.58984333",
"0.5897976",
"0.5883429... | 0.81064266 | 0 |
Solution to the bombbaby puzzle. Here, we are given some dynamical update rules, a pair (m,f) could be succeeded either by (m+f,f) or (m,m+f). Given two numbers (m,f), we are tasked with finding the shortest path (in generations) to generate (m,f) from (1,1), or to determine that the outcome is impossible. The 'real ch... | def solution(m,f):
m = int(m)
f = int(f)
# number of accumulated generations
n = 0
## A tail-recursive implementation with constant memory usage
## is easily possible, but unfortunately Python cannot handle/optimize
## tail recursion, and is still limited by maximum recursion d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mLFG(a,b,m):\n \n require_integers([\"a\",\"b\",\"m\"],[a,b,m])\n \n while True:\n yield a\n a,b = b,(a*b)%m",
"def aLFG(a,b,m):\n \n require_integers([\"a\",\"b\",\"m\"],[a,b,m])\n \n while True:\n yield a\n a,b = b,(a+b)%m",
"def ackermanFunc(m, n):\n\n... | [
"0.60956544",
"0.6033427",
"0.5956995",
"0.5933056",
"0.5878195",
"0.58694607",
"0.5835559",
"0.58092266",
"0.578852",
"0.576956",
"0.5687345",
"0.5661254",
"0.56494594",
"0.5646951",
"0.56302994",
"0.56298953",
"0.56073564",
"0.560453",
"0.55908364",
"0.55840373",
"0.5580158... | 0.76117283 | 0 |
Prompts the user to specify how long their train has been delayed. | def ask_previous_delay(context=None):
options = [
'How long have you been waiting for?',
'How long has your train been delayed?',
'What\'s the length of the delay?',
'How many minutes are you being delayed for?',
]
# Check for context
if context:
# Check for dep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setdelay(self):\n delay=self.inputdelay.getEntry()\n cmd=\"setDelay(\"+self.board+','+self.inpedge+','+delay+')'\n self.vb.io.execute(cmd,log=\"out\",applout=\"<>\")",
"def setTimeDelay(*args):\n args[0].TimeState.TimeDelay.time_delay = args[1]",
"def _delay(self, n=None):",
"def wait(self, ms=None... | [
"0.61388785",
"0.55709624",
"0.5552502",
"0.5459696",
"0.54312676",
"0.54147136",
"0.53658587",
"0.53658587",
"0.5360396",
"0.5349062",
"0.533876",
"0.5317978",
"0.5289466",
"0.5288345",
"0.5288043",
"0.52846265",
"0.5271598",
"0.52613497",
"0.52591294",
"0.5234578",
"0.52275... | 0.6142175 | 0 |
create attr searcher instances and execute their "run" method | def runAttrSearchers(self,conditions,admin_obj):
search_helper=SearchUserHelper(conditions,admin_obj)
attr_searchers=self.__getAllAttrSearchers(search_helper)
map(lambda x:apply(getattr(x,"run")),attr_searchers)
return search_helper | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n self.args = args\n self.matchers = []\n for a in args:\n if a is _:\n a = lambda k: True\n elif isinstance(a, basestring):\n a = a.__eq__\n elif isinstance(a, (list, tuple, set)):\n a = (... | [
"0.55047566",
"0.54139805",
"0.5282983",
"0.5266308",
"0.5251558",
"0.52377003",
"0.52111524",
"0.520506",
"0.5197755",
"0.51204234",
"0.5095355",
"0.50885457",
"0.5088183",
"0.5087449",
"0.50618327",
"0.5061558",
"0.50412923",
"0.5020508",
"0.4992534",
"0.49858615",
"0.49814... | 0.67694384 | 0 |
Command used to configure the specified analytic to connect to an RTSP stream, process the video, and publish the results to the specified database and kafka brokers (if any). | def config(ctx, stream_source, kafka_addr, db_addr, analytic_host, analytic_port, tags):
tag_map = {}
for tag_str in tags:
tag_map.update(parse_tag(tag_str))
a = analytic_pb2.AnalyticData(
addr="{!s}:{!s}".format(analytic_host, analytic_port))
client = aceclient.ConfigClient(host=analyti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video(ctx, video_file, analytic_addr):\n if not analytic_addr:\n analytic_addr = [\"localhost:50051\"]\n db = ctx.obj.db\n client = aceclient.AnalyticMultiClient()\n classes = {}\n cap = cv2.VideoCapture(video_file)\n window_names = []\n f_req = analytic_pb2.FrameRequest()\n for ... | [
"0.5585309",
"0.52380216",
"0.5229384",
"0.52075493",
"0.51906437",
"0.51906437",
"0.5142656",
"0.51353914",
"0.51277053",
"0.5063001",
"0.5056543",
"0.50216717",
"0.50200486",
"0.49780482",
"0.4960555",
"0.49345553",
"0.49277937",
"0.49211228",
"0.49086675",
"0.4890077",
"0.... | 0.5494512 | 1 |
Terminate the connection between the specified analytic and the video source. Does not terminate the service, so the service will still accept new configuration requests. | def kill(ctx, analytic_host, analytic_port):
client = aceclient.ConfigClient(host=analytic_host, port=analytic_port)
client.kill() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_advertising(self):\n self._periph.stop_advertising()",
"def __del__(self):\n try:\n self.api.transport.session.close()\n except Exception as e:\n log.debug(f\"Failed to close VSO API connection with: {e}\")",
"def terminate(self):\r\n for call in self.... | [
"0.605665",
"0.5903019",
"0.5880774",
"0.587189",
"0.5814706",
"0.56979114",
"0.5695248",
"0.56684774",
"0.56481856",
"0.56481856",
"0.56199515",
"0.55669135",
"0.5565821",
"0.5560698",
"0.55319697",
"0.54918116",
"0.5473794",
"0.5461876",
"0.5455388",
"0.54313624",
"0.542883... | 0.6198811 | 0 |
Applies the specified filter(s) to the stream processed by the StreamFilter at the host and port specified. | def filter(ctx, fil, filter_host, filter_port):
if not fil:
raise ValueError("Must specify at least one filtering operaion (of the form '<filter>=<value>'")
client = aceclient.FilterClient(host=filter_host, port=filter_port)
filters = {}
for f in fil:
filters.update(parse_tag(f))
cli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def streamfilter(ctx, grpc, grpc_port, port, filter_port, analytic_addr, verbose):\n frame_filter = FrameFilter()\n client = aceclient.AnalyticClient(addr=analytic_addr)\n\n def degrade_grpc(handler):\n orig_frame = handler.get_frame()\n frame = frame_filter.filter(orig_frame, handler)\n ... | [
"0.58591235",
"0.57476157",
"0.5415524",
"0.5403649",
"0.53767914",
"0.5333647",
"0.5264466",
"0.526356",
"0.523075",
"0.5219469",
"0.5203964",
"0.5161386",
"0.50555325",
"0.50518113",
"0.50470275",
"0.50247675",
"0.50084955",
"0.49869052",
"0.4960493",
"0.49510267",
"0.49438... | 0.6422648 | 0 |
Starts a GStreamer Server using the source provided (can be connected camera or external RTSP stream) on the specified endpoint. | def rtsp(ctx, src, endpoint, verbose):
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import Gst, GstRtspServer, GObject
from ace.rtspserver import GstServer
GObject.threads_init()
Gst.init(None)
if src.isdigit():
src = i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_destination_server(cls) -> None:\n\n def socket_handler(listener: socket.socket) -> None:\n sock = listener.accept()[0]\n try:\n with cls.server_context.wrap_socket(sock, server_side=True) as ssock:\n request = consume_socket(ssock)\n ... | [
"0.5576396",
"0.55203706",
"0.55177844",
"0.5503346",
"0.5464674",
"0.53272074",
"0.5271236",
"0.5249388",
"0.5188421",
"0.5176306",
"0.50517493",
"0.5045307",
"0.50389475",
"0.5033822",
"0.5014496",
"0.5000804",
"0.49984616",
"0.49983224",
"0.49781457",
"0.497796",
"0.496118... | 0.670236 | 0 |
Start up a 'StreamFilter' server which can be used to modify indivdual frames en route to an analytic. The endpoint running on the 'filter_port' can be used to change the types and magnitudes of the filters applied to each frame. | def streamfilter(ctx, grpc, grpc_port, port, filter_port, analytic_addr, verbose):
frame_filter = FrameFilter()
client = aceclient.AnalyticClient(addr=analytic_addr)
def degrade_grpc(handler):
orig_frame = handler.get_frame()
frame = frame_filter.filter(orig_frame, handler)
resp = c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n import time\n import argparse\n\n from bcipy.acquisition.datastream.generator import file_data, random_data\n\n default_channels = ['ch' + str(i + 1) for i in range(16)]\n\n parser = argparse.ArgumentParser()\n parser.add_argument('-f', '--filename', default=None,\n ... | [
"0.6144526",
"0.60026515",
"0.5819685",
"0.5770632",
"0.5730651",
"0.57251036",
"0.56445503",
"0.561699",
"0.5590339",
"0.5556246",
"0.55507064",
"0.55386966",
"0.55055994",
"0.54861856",
"0.5485871",
"0.5485389",
"0.5480771",
"0.54794383",
"0.544749",
"0.54197615",
"0.540285... | 0.67184466 | 0 |
Stream the contents of a video file to an analytic | def video(ctx, video_file, analytic_addr):
if not analytic_addr:
analytic_addr = ["localhost:50051"]
db = ctx.obj.db
client = aceclient.AnalyticMultiClient()
classes = {}
cap = cv2.VideoCapture(video_file)
window_names = []
f_req = analytic_pb2.FrameRequest()
for a in analytic_ad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_video(lane, fname, output):\n\tclip = VideoFileClip(fname)\n\toutput_name = output\n\toutput_clip = clip.fl_image(lane.pipeline)\n\toutput_clip.write_videofile(output_name, audio=False)\n\tprint ('Video processed successfully')",
"def stream_frames(video_capture):",
"def download_video(video_stream... | [
"0.64831686",
"0.6376277",
"0.62132955",
"0.6193396",
"0.6193396",
"0.6170949",
"0.61002314",
"0.6097967",
"0.6081561",
"0.6028888",
"0.60048175",
"0.5942202",
"0.58900416",
"0.58833396",
"0.58557004",
"0.5845093",
"0.5844236",
"0.5843379",
"0.58407396",
"0.5829075",
"0.58132... | 0.6725892 | 0 |
La funcion g calcula el costo exacto de la distancia recorrida desde el nodo inicial a la posicion actual. | def g(inicio,pos):
return (pos.costo-inicio.costo)*distancia_nodos(inicio,pos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost(self):\n\t\treturn self.g + self.h",
"def cost(self) -> float:",
"def get_cost(self) -> float:\n return math.e / self.fitness",
"def _compute_gasto_subtotal(self):\n beneficio = ingreso_subtotal - gasto_subtotal_comercial",
"def get_expected_cost(self):",
"def cost(self, dgvel):\n ... | [
"0.72515666",
"0.69171375",
"0.6674879",
"0.6629221",
"0.6358477",
"0.63319737",
"0.6319985",
"0.6062444",
"0.6057181",
"0.6047067",
"0.6013731",
"0.597569",
"0.59598047",
"0.5950799",
"0.59440684",
"0.5940004",
"0.58869034",
"0.588622",
"0.58777",
"0.58748436",
"0.5863089",
... | 0.83096606 | 0 |
La funcion h es el calculo heuristico del paso de la posicion actual al objetivo. | def h(pos,obj):
return D(pos)*(distancia_nodos(pos,obj)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(inicio,obj):\n return g(inicio,obj)+h(inicio,obj)",
"def update_H(self):",
"def mezclar_bolsa(self):",
"def h_o(self):\n return self._h_o",
"def lin_o_func(self):\n return self.hx",
"def get_lengte(self):",
"def h(self) -> float:\n return self._h",
"def h_a(self):\n retu... | [
"0.5981592",
"0.595853",
"0.59185004",
"0.58909196",
"0.57945514",
"0.57156384",
"0.56727326",
"0.56553644",
"0.5640878",
"0.558471",
"0.5576271",
"0.5562072",
"0.55479944",
"0.5541887",
"0.55355984",
"0.54809904",
"0.54614645",
"0.5390539",
"0.5376353",
"0.53762066",
"0.5350... | 0.62713224 | 0 |
This function creates new platforms from content provided by searching for urls (except those given in blacklisted_domains). | def _do_import_from_content(content, opr, to_save, blacklisted_domains=BLACKLISTED_DOMAINS):
if not content:
log.warn('No content, doing nothing')
return
urls = contentfiltering.find_all_urls(content)
log.info('Found %d urls: %r', len(urls), urls)
platforms = []
for url in urls:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _filter_platforms_by_platform_type(self, desired_platform):\n if desired_platform == constants.ANY:\n all_platforms = {}\n for platform in self.platforms.keys():\n all_platforms.update(self._filter_platforms_by_platform_type(platform))\n return all_platfor... | [
"0.5678516",
"0.56009096",
"0.5501956",
"0.5429828",
"0.53810084",
"0.5377172",
"0.53250057",
"0.52782",
"0.5211375",
"0.5185266",
"0.5103017",
"0.5075978",
"0.4974731",
"0.49613166",
"0.49106747",
"0.48921102",
"0.4882513",
"0.4880354",
"0.48738012",
"0.48594186",
"0.4853128... | 0.5897081 | 0 |
Finds closest visible traffic light, if one exists, and determines its location and color | def process_traffic_lights(self):
closest_light = None
line_wp_index = None
# We want to find the smallest "diff". Initialize to the maximum possible value: total number of waypoints
diff = len(self.base_waypoints.waypoints)
# List of positions that correspond to the line to st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_traffic_lights(self):\n #DONE find the closest visible traffic light (if one exists within LOOKAHEAD_WPS)\n if self.init:\n state = self.get_light_state(0)\n return -1, TrafficLight.UNKNOWN\n elif self.ntlwp:\n state = self.get_light_state(self.ntlw... | [
"0.70687",
"0.6820108",
"0.6765558",
"0.6732309",
"0.67009866",
"0.6546096",
"0.6458472",
"0.64289075",
"0.6398164",
"0.62806374",
"0.6242503",
"0.620407",
"0.60887104",
"0.6075117",
"0.60638815",
"0.60356575",
"0.6026577",
"0.59824544",
"0.5972425",
"0.5906958",
"0.5895115",... | 0.70480263 | 1 |
Get a smaller child | def _get_min_child(self, parent_idx):
if 2 * parent_idx + 2 > len(self._heap) - 1:
return 2 * parent_idx + 1
if self._heap[2 * parent_idx + 1] < self._heap[2 * parent_idx + 2]:
return 2 * parent_idx + 1
return 2 * parent_idx + 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_child(self, index):\n if self.empty():\n return None\n if self._has_left(index):\n left = self._left(index)\n small_child = left\n if self._has_right(index):\n right = self._right(index)\n if self._data[right] < self._d... | [
"0.6891468",
"0.6252703",
"0.62101245",
"0.6169312",
"0.6134797",
"0.61254615",
"0.6122612",
"0.60844123",
"0.6057117",
"0.60174835",
"0.5999285",
"0.5983017",
"0.59734476",
"0.59734476",
"0.59320736",
"0.5912668",
"0.5885431",
"0.587658",
"0.5871534",
"0.58636266",
"0.585351... | 0.6443669 | 1 |
Heap as a string | def __str__(self):
return str(self._heap) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self) -> str:\n return 'HEAP ' + str(self.heap)",
"def __str__(self) -> str:\n return 'HEAP ' + str(self.heap)",
"def __repr__(self):\n return \"heap:[\" + ','.join(map(str, self.ar[:self.n])) + \"]\"",
"def __str__(self):\n\n string = \"[\"\n for i in range(1, ... | [
"0.8182915",
"0.8182915",
"0.76799554",
"0.74971116",
"0.665363",
"0.6551035",
"0.64787817",
"0.6275183",
"0.6160656",
"0.6074545",
"0.6016981",
"0.59387195",
"0.59387195",
"0.5925933",
"0.5848498",
"0.58074236",
"0.57755023",
"0.5775258",
"0.57692087",
"0.57590175",
"0.57478... | 0.8424552 | 0 |
Constructor for the range of reading scores. | def __init__(self, low_score=0, high_score=0):
self.low_score = low_score
self.high_score = high_score | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, seq_name, first, last, score):\n self.sequence_name = seq_name\n self.first = int(first)\n self.last = int(last)\n self.score = int(score)",
"def __init__(self, name, number):\n self._name = name\n self._scores = []",
"def __init__(self,L,R) :\n s... | [
"0.7073958",
"0.66551566",
"0.66546947",
"0.66058695",
"0.65958124",
"0.6486821",
"0.6471238",
"0.6436775",
"0.64144105",
"0.6298782",
"0.62763983",
"0.6253294",
"0.62456226",
"0.6206915",
"0.6193982",
"0.6193982",
"0.6193982",
"0.6193982",
"0.6168166",
"0.6165295",
"0.614989... | 0.7093341 | 0 |
turn a string representing a version into a normalized version list. Version lists are directly comparable using standard operators such as >, <, ==, etc. | def normalize(version_string, max_version_parts=4):
version_list = []
for part_count, version_part in enumerate(version_string.split('.')):
try:
groups = _version_part_re.match(version_part).groups()
except Exception, x:
raise NotAVersionException(version_string)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_version(v):\n rv = []\n for x in v.split(\".\"):\n try:\n rv.append(int(x))\n except ValueError:\n for y in re.split(\"([0-9]+)\", x):\n try:\n if y != '':\n rv.append(int(y))\n except Va... | [
"0.6967106",
"0.68657637",
"0.6816986",
"0.66744596",
"0.65733165",
"0.64145917",
"0.6347782",
"0.6190191",
"0.6107062",
"0.604065",
"0.6039773",
"0.60347754",
"0.6015595",
"0.601328",
"0.59556323",
"0.58249134",
"0.5719705",
"0.5712309",
"0.5694737",
"0.5679233",
"0.56733465... | 0.6900444 | 1 |
Calculate and returns PCA of a set of images | def compute_pca(image_set):
# Check for valid input
assert(image_set[0].dtype == np.uint8)
# Reshape data into single array
reshaped_data = np.concatenate([image
for pixels in image_set for image in
pixels])
# Convert to floa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def performPCA(dataSet, numShapesInDataset, numPointsInShapes, num_components):\n\tdataMat = np.array(dataSet).reshape((numShapesInDataset, numPointsInShapes*2))\n\t\n\t\"\"\"Creating the covariance matrix\"\"\"\n\tcovarMat = np.cov(dataMat.T)\n\t\t\n\t\"\"\"Generating the eigen vectors and eigen values\"\"\"\n\te... | [
"0.7266325",
"0.72300565",
"0.7203943",
"0.71658593",
"0.7117749",
"0.707815",
"0.70040804",
"0.694592",
"0.68563604",
"0.68533",
"0.68456936",
"0.6804869",
"0.6677491",
"0.6675038",
"0.6665909",
"0.6647357",
"0.6598367",
"0.6597939",
"0.6594284",
"0.65899503",
"0.65850514",
... | 0.7844498 | 0 |
Flips an object label along x | def flip_label(obj_label, im_size):
flipped_label = copy.deepcopy(obj_label)
# Flip in 2D
x1 = flipped_label.x1
x2 = flipped_label.x2
half_width = im_size[0] / 2.0
diff = x1 - half_width
# width of bounding box
width_bb = x2 - x1
if x1 < half_width:
new_x2 = half_width ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip_image(image, label):\n # Flip the image\n cv2.flip(image, 1, image)\n\n # Flip the label\n label[1] = image.shape[1] - label[1]",
"def flip(self, x, y):\n self.pieces[x + (y * self.width)].flip()",
"def flip(self):",
"def set_flipped(self, x, y):\n self.pieces[x + (y * self... | [
"0.65310675",
"0.6329189",
"0.63237107",
"0.6162113",
"0.6015734",
"0.59960526",
"0.59187305",
"0.58995",
"0.57680875",
"0.5705692",
"0.561192",
"0.5600841",
"0.5592621",
"0.5592621",
"0.5592621",
"0.5592621",
"0.5592621",
"0.5592464",
"0.5582927",
"0.55639255",
"0.55598253",... | 0.7102782 | 0 |
Flips 2D image from left to right. The image is flipped using OpenCV's flip matrix function. The flipped 2D label is then calculated by splitting the image in half and deciding which split it belongs and adding the offset to align the bounding box. | def flip_2d_image_and_label(image, label):
image_flipped = cv2.flip(image, 1)
# Flip the label
width = image.shape[1]
half_width = width / 2
flipped_label = np.copy(label)
x1 = label[0]
x2 = label[2]
diff = x1 - half_width
# width of bounding box
width_bb = x2 - x1
assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip_image(image, label):\n # Flip the image\n cv2.flip(image, 1, image)\n\n # Flip the label\n label[1] = image.shape[1] - label[1]",
"def flip_image_vertical(image):\n return cv.flip(image, 1)",
"def flip_image_horizontal(image):\n return cv.flip(image, 0)",
"def flip_image(image, bbo... | [
"0.7331265",
"0.6832804",
"0.64910865",
"0.64310265",
"0.6410109",
"0.63891745",
"0.63586336",
"0.6356196",
"0.6341496",
"0.6339521",
"0.63043123",
"0.629815",
"0.62607116",
"0.62452435",
"0.6236246",
"0.6231211",
"0.62308",
"0.6210027",
"0.6149166",
"0.6148453",
"0.61456317"... | 0.7709797 | 0 |
Generates negative 2D bounding boxes. This is computed in a semibrute force fashion. For any given bounding box, we first try to calculate the desired shift based on the selected IoU. If this failes, we just randomly shift the centroid and generate new bounding boxes. If it lies within the desired IoU threshold bound, ... | def calculate_negative_2d_bb(obj_label,
boxes2d,
iou_threshold_min,
iou_threshold_max,
samples,
rand_sampl=False):
x1 = obj_label.x1
y1 = obj_label.y1
x2 = obj_la... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_negative_3d_bb(obj_label,\n boxes3d,\n iou_threshold_min,\n iou_threshold_max,\n samples):\n box_corners = od.compute_box_corners_3d(obj_label)\n # make sure this is not empty\n assert(... | [
"0.69121605",
"0.6865389",
"0.6467625",
"0.6369781",
"0.62754124",
"0.6056862",
"0.6002797",
"0.5892907",
"0.5846243",
"0.5825292",
"0.5823235",
"0.580352",
"0.5802652",
"0.5774881",
"0.57701665",
"0.5769676",
"0.5751968",
"0.5746477",
"0.5703305",
"0.5696509",
"0.56963754",
... | 0.7597889 | 0 |
Generates negative 3D bounding boxes. This is the 3D version of generate_negative_3d_bb. | def generate_negative_3d_bb(obj_label,
boxes3d,
iou_threshold_min,
iou_threshold_max,
samples):
box_corners = od.compute_box_corners_3d(obj_label)
# make sure this is not empty
assert(len(box_corn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_negative_2d_bb(obj_label,\n boxes2d,\n iou_threshold_min,\n iou_threshold_max,\n samples,\n rand_sampl=False):\n\n x1 = obj_label.x1\n y1 = obj_label.y1\n ... | [
"0.6293331",
"0.6009182",
"0.5801561",
"0.5799778",
"0.5769917",
"0.57271326",
"0.5657494",
"0.5643734",
"0.5588344",
"0.5588344",
"0.5566045",
"0.55655116",
"0.55625165",
"0.55415875",
"0.55285263",
"0.54892945",
"0.5468024",
"0.5447369",
"0.5443272",
"0.54351157",
"0.542643... | 0.7253786 | 0 |
Remove the amount of Water to the reserve | def useWater(self, used):
self.amount = max(0, self.amount - used) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purge(self):\n self.remaining = 0",
"def take(self):\n print(\"You fill the kettle with water.\")\n inventory.remove('kettle')\n collect('filled kettle')",
"def total_mass_above_sea(self):\n del self._total_mass_above_sea",
"def reserve(self, reserve):\n \n ... | [
"0.6256969",
"0.6184789",
"0.5923078",
"0.5892838",
"0.5775151",
"0.57341087",
"0.5725877",
"0.5659378",
"0.56568617",
"0.56459993",
"0.5637632",
"0.5615796",
"0.5587769",
"0.55730987",
"0.55355954",
"0.55175316",
"0.55123353",
"0.54984534",
"0.54881275",
"0.5482089",
"0.5462... | 0.6786882 | 0 |
Let the people drink water | def drinkWater(self, people):
for person in people:
amount_to_drink = person.drinks
self.amount = max(0, self.amount - amount_to_drink)
person.drinkWater() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def the_drinking(self):\n self.log.info('The drinking starts')\n self.hide_give_buttons()\n self.show_people()\n\n #\n state = 'day-{0}'.format(self.end_of_day)\n conversation_item = self.conversation.getNext(situation='drinking', state=state)\n if conversation_item... | [
"0.6789464",
"0.66233134",
"0.6290141",
"0.6263882",
"0.61978054",
"0.59505296",
"0.5919984",
"0.58950466",
"0.58649296",
"0.58483756",
"0.5819375",
"0.578152",
"0.5749425",
"0.57342714",
"0.57231146",
"0.57219404",
"0.5716021",
"0.5685382",
"0.56706995",
"0.56598645",
"0.564... | 0.73621035 | 0 |
Returns the value for a template tag '$tag(the_args)' | def get_template_arg(self, tag, the_args, for_class):
if the_args:
args = the_args.split(",")
args = [x.strip() for x in args]
else:
args = []
class_name = ""
if for_class:
class_name = for_class.name
bad_arg = False
tag ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag(self, *arguments, **kwargs):\n return self.get_output('tag', *arguments, **kwargs)",
"def getValue(tree, tag):\n try:\n return tree.find(tag).text\n except AttributeError:\n return None",
"def getAttrValue(self, *args):\n return _libsbml.XMLToken_getAttrValue(self, *ar... | [
"0.5939105",
"0.59040326",
"0.5888939",
"0.57253265",
"0.569288",
"0.5689616",
"0.5591041",
"0.5585122",
"0.55828136",
"0.55512434",
"0.549272",
"0.541498",
"0.5410943",
"0.53874797",
"0.5374467",
"0.53448373",
"0.5341634",
"0.53073204",
"0.5247413",
"0.52419",
"0.5231348",
... | 0.5962127 | 0 |
Invalidates the block in the chain. It will rewind network to blockhash and invalidate it. | def invalidateblock(self, block_hash: str) -> None:
return self.rpc_call("invalidateblock", block_hash) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalidate(self):\n self._compute_merkle_tree()\n self.block_header.merkle_root_hash = self.merkle_tree.hash",
"def invalidate_coinbase(self):\n self._invalidate_coinbase()",
"def invalidate(self):\n self._valid = False",
"def invalidate(self):\n self.valid = False",
... | [
"0.70624876",
"0.6787744",
"0.61735356",
"0.6151557",
"0.6120644",
"0.59164333",
"0.5888105",
"0.5814211",
"0.5808877",
"0.5800096",
"0.5723538",
"0.5618082",
"0.5498331",
"0.5486071",
"0.54791224",
"0.54429746",
"0.54033184",
"0.5396211",
"0.5395508",
"0.538714",
"0.53777325... | 0.7681075 | 0 |
Formats config for validation function. Flattens dictionary to a list Arguments | def format_config_for_validation(config_in: Dict) -> List:
config_out = []
for name, data in config_in.items():
flattened_data = {"name": name, **data}
config_out.append(flattened_data)
return config_out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self, config=None):\n for k, v in config.items():\n assert (\n k in self.arguments\n ), f\"\"\"{k} is not a valid argument. Support arguments are {self.format_arguments()}.\"\"\"\n\n if self.arguments[k].type is not None:\n try:\n ... | [
"0.6824246",
"0.6166993",
"0.59597707",
"0.59384215",
"0.59027624",
"0.58222824",
"0.57885796",
"0.5741923",
"0.57236814",
"0.57227635",
"0.5674388",
"0.5634317",
"0.5419856",
"0.53901297",
"0.53687",
"0.5358603",
"0.5355951",
"0.53520787",
"0.53442454",
"0.53175116",
"0.5267... | 0.68767613 | 0 |
Test that if an invalid state is set to correct map, the state does not update at all. | def test_set_none_state(self):
invalid_list = [None, "", False, 0]
for invalid in invalid_list:
self.cmap.set_dict(invalid)
assert self.cmap.get_dict() == {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_has_location_with_states_with_invalid_locations():\n state = State(\n \"hello.world\", \"invalid\", {ATTR_LATITUDE: \"no number\", ATTR_LONGITUDE: 123.12}\n )\n assert not location.has_location(state)",
"def checkMap(self):\n return True",
"def state_failsafe_validate(cfg, app, ... | [
"0.680259",
"0.6651317",
"0.6358816",
"0.63505447",
"0.6348836",
"0.6337155",
"0.62867904",
"0.628228",
"0.6227333",
"0.6178898",
"0.6178635",
"0.61377215",
"0.61201054",
"0.611849",
"0.60914856",
"0.6072236",
"0.60572577",
"0.60542274",
"0.60497314",
"0.6037945",
"0.60309803... | 0.6971147 | 0 |
initial coordinates for the turtle/ coordinates considered as origin | def initialCoordinates():
return (-250,-250) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def origin(self):\r\n\r\n return self.ox, self.oy, self.oz",
"def _set_origin(self):\n self += helper.circle(cx=self.__dict__['x'], cy=self.__dict__['y'], r=2, fill=\"black\", stroke=\"black\", style=\"fill-opacity: 50%\")\n self += helper.text(\"(0,0)\", x=self.__dict__['x']+5, y=se... | [
"0.70708233",
"0.6914195",
"0.67080975",
"0.6461778",
"0.64485896",
"0.64254487",
"0.64135253",
"0.6347302",
"0.62941587",
"0.6288959",
"0.6265186",
"0.6216833",
"0.6177759",
"0.6177411",
"0.6084805",
"0.6083994",
"0.60724795",
"0.6063167",
"0.6054364",
"0.6032474",
"0.603247... | 0.7647754 | 0 |
makes turtle go to origin | def setTurtle(t):
t.pu()
t.goto(initialCoordinates()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repositionTurtle(t, x, y):\n t.up()\n t.goto(x, y)\n t.down()",
"def goto(x, y):\n turtleTmp.setposition(x, y)",
"def moveturtle(x,y,t):\n t.penup()\n t.goto(x,y)\n t.pendown()",
"def move_turtle(self):\n self.forward(self.move_speed)",
"def gohome(turtle):\n turtle.penup()... | [
"0.7475702",
"0.736905",
"0.73032737",
"0.7127415",
"0.6943668",
"0.6722828",
"0.66932464",
"0.66498077",
"0.65949625",
"0.6371422",
"0.62884873",
"0.6270913",
"0.6056042",
"0.60459065",
"0.6020364",
"0.6002092",
"0.59924483",
"0.5959679",
"0.59550107",
"0.58771145",
"0.58325... | 0.741809 | 1 |
draws an appropriate coordinate plane for the first graph | def drawCoordinatePlane_income():
turtle = t.Screen()
turtle.title("Life Expectancy versus Income Category")
t2.speed(0)
t3.speed(0)
setTurtle(t0)
setTurtle(t1)
setTurtle(t2)
setTurtle(t3)
drawAxes(t0)
t1.left(90)
drawAxes(t1)
t0.pu()
t0.fd(-80)
t0.l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawCoordinatePlane_region():\r\n turtle2 = t.Screen()\r\n turtle2.title(\"Life Expectancy versus Region\")\r\n t2.speed(0)\r\n t3.speed(0)\r\n setTurtle(t0)\r\n setTurtle(t1)\r\n setTurtle(t2)\r\n setTurtle(t3)\r\n drawAxes(t0)\r\n t1.left(90)\r\n drawAxes(t1)\r\n t0.pu()\r... | [
"0.66490805",
"0.63432705",
"0.62373793",
"0.6199884",
"0.6068703",
"0.6065697",
"0.60353047",
"0.5993301",
"0.59508896",
"0.5927441",
"0.59041065",
"0.5883764",
"0.5868702",
"0.58631253",
"0.5818924",
"0.580754",
"0.57972467",
"0.57846",
"0.57245266",
"0.57064277",
"0.570055... | 0.6807993 | 0 |
draws an appropriate coordinate plane for the second graph(expectancy vs region) | def drawCoordinatePlane_region():
turtle2 = t.Screen()
turtle2.title("Life Expectancy versus Region")
t2.speed(0)
t3.speed(0)
setTurtle(t0)
setTurtle(t1)
setTurtle(t2)
setTurtle(t3)
drawAxes(t0)
t1.left(90)
drawAxes(t1)
t0.pu()
t0.fd(-80)
t0.lt(90)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_scenario(self, ax):\n ax.set_xlim((0,10))\n ax.set_ylim((0,10))\n\n # Unpack region's sizes and positions\n obs_x = self.obstacle_vert[0]\n obs_y = self.obstacle_vert[2]\n obs_w = self.obstacle_vert[1]-obs_x\n obs_h = self.obstacle_vert[3]-obs_y\n\n ... | [
"0.65499073",
"0.6496035",
"0.60228455",
"0.590703",
"0.5733049",
"0.5705189",
"0.5698288",
"0.56977296",
"0.56819504",
"0.566494",
"0.5626235",
"0.5581443",
"0.5571868",
"0.5522218",
"0.5506964",
"0.55012393",
"0.5491306",
"0.54904056",
"0.5480986",
"0.5471765",
"0.54591614"... | 0.7263626 | 0 |
filters data of a country based on income category and prints the information | def filter_income_graph(data, income):
MetaDct = data[1]
f_MetaDct = {}
for idx in MetaDct:
if idx != ',':
if MetaDct[idx].income == income:
f_MetaDct[idx] = MetaDct[idx].country
return f_MetaDct | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_filters():\n print(\"Welcome to bikeshare data! \\n\")\n\n # Taksk0.1: Users choose a city, create a list with length=CITY_DATA , \n #in future, it other cities are added codes will updated automatically\n all_cities=list(CITY_DATA)\n for i in range(len(all_cities)):\n message = (\"F... | [
"0.62728596",
"0.6063862",
"0.6025754",
"0.60016996",
"0.5907398",
"0.5881463",
"0.5825462",
"0.5820133",
"0.58178806",
"0.5791944",
"0.57916397",
"0.5762069",
"0.5724475",
"0.5720681",
"0.5717021",
"0.57140505",
"0.5703483",
"0.5701911",
"0.5672757",
"0.5659006",
"0.56552374... | 0.68259215 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.