query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Execute rally verify configureverifier, which generates tempest.conf | def configure_verifier(deployment_dir):
cmd = ['rally', 'verify', 'configure-verifier', '--reconfigure',
'--id', str(getattr(config.CONF, 'tempest_verifier_name'))]
output = subprocess.check_output(cmd)
LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8"))
LOGGER.d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_verifier(deployment_dir):\n cmd = ['rally', 'verify', 'configure-verifier', '--reconfigure',\n '--id', str(getattr(config.CONF, 'tempest_verifier_name'))]\n output = subprocess.check_output(cmd)\n LOGGER.info(\"%s\\n%s\", \" \".join(cmd), output)\n\n LOGGER.debug(\"Looking for t... | [
"0.7838847",
"0.622833",
"0.62158334",
"0.6102185",
"0.5732694",
"0.5659994",
"0.5577749",
"0.5537725",
"0.55346674",
"0.5523457",
"0.55181223",
"0.54858464",
"0.545961",
"0.5390529",
"0.5359512",
"0.53589606",
"0.53571224",
"0.53334934",
"0.5332391",
"0.53290427",
"0.5324495... | 0.77928317 | 1 |
Generate test list based on the test mode. | def generate_test_list(self, **kwargs):
LOGGER.debug("Generating test case list...")
self.backup_tempest_config(self.conf_file, '/etc')
if kwargs.get('mode') == 'custom':
if os.path.isfile(self.tempest_custom):
shutil.copyfile(
self.tempest_custom,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_test_list(tdir):\n\n # Skip this if it already exists\n if os.path.exists(os.path.join(tdir.name, \"kstest-list\")):\n return\n\n kstest_log = os.path.join(tdir.name, \"kstest.log\")\n with open(kstest_log) as f:\n for line in f.readlines():\n if not line.startswit... | [
"0.7224584",
"0.7033538",
"0.7009234",
"0.6971499",
"0.6883801",
"0.6699291",
"0.6692297",
"0.66435987",
"0.6586937",
"0.65175205",
"0.64307505",
"0.6429683",
"0.6429683",
"0.64266276",
"0.63944846",
"0.63704103",
"0.6363472",
"0.6362816",
"0.6362721",
"0.6325249",
"0.6308668... | 0.77115947 | 0 |
Exclude blacklisted test cases. | def apply_tempest_blacklist(self, black_list):
LOGGER.debug("Applying tempest blacklist...")
if os.path.exists(self.raw_list):
os.remove(self.raw_list)
os.rename(self.list, self.raw_list)
cases_file = self.read_file(self.raw_list)
with open(self.list, 'w', encoding='u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filterOneTest(self, test_name):\n super(VtsKernelLibcutilsTest, self).filterOneTest(test_name)\n asserts.skipIf(\n test_name.split('.')[0] not in self.include_test_suite,\n 'Test case not selected.')",
"def __init__(self, *args, **kwargs):\n # skip\n self.ski... | [
"0.6759479",
"0.6593039",
"0.6538416",
"0.6421674",
"0.63595855",
"0.6344502",
"0.6321146",
"0.6319996",
"0.63163024",
"0.63071465",
"0.63039666",
"0.62864035",
"0.6255693",
"0.6232969",
"0.6214806",
"0.6176559",
"0.61570907",
"0.6153694",
"0.6152689",
"0.6143904",
"0.6131018... | 0.0 | -1 |
Execute tempest test cases. | def run_verifier_tests(self, **kwargs):
cmd = ["rally", "verify", "start", "--load-list",
self.list]
cmd.extend(kwargs.get('option', []))
LOGGER.info("Starting Tempest test suite: '%s'.", cmd)
with open(
os.path.join(self.res_dir, "tempest.log"), 'w+',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runTests(self):\n \n pass",
"def run(self):\n if self.all:\n cmd = self.apply_options(self.test_all_cmd)\n self.call_and_exit(cmd)\n else:\n cmds = (self.apply_options(self.unit_test_cmd, (\"coverage\",)),)\n if self.coverage:\n ... | [
"0.7431895",
"0.7316442",
"0.7209012",
"0.7179872",
"0.71231836",
"0.7121675",
"0.71080434",
"0.7036912",
"0.7021455",
"0.70080346",
"0.7001285",
"0.6985134",
"0.6979656",
"0.6899745",
"0.68837917",
"0.6879019",
"0.68778473",
"0.68600625",
"0.68519163",
"0.6844928",
"0.683144... | 0.0 | -1 |
Parse and save test results. | def parse_verifier_result(self):
stat = self.get_verifier_result(self.verification_id)
try:
num_executed = stat['num_tests'] - stat['num_skipped']
try:
self.result = 100 * stat['num_success'] / num_executed
except ZeroDivisionError:
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parse(self): \n\n results = self.parser.parse()\n self.assertEqual(results, test_case_data['parse_output'])",
"def __parse(self, results):\n in_doc = False\n document_txt = None\n cases = []\n for line in results:\n line = line.rstrip()\n ... | [
"0.6879487",
"0.6688299",
"0.6649461",
"0.6597607",
"0.6562047",
"0.64070547",
"0.62938046",
"0.6256871",
"0.611408",
"0.61135256",
"0.6107557",
"0.6100069",
"0.60896564",
"0.60574466",
"0.6056988",
"0.6002144",
"0.6000668",
"0.59979934",
"0.5993954",
"0.5988928",
"0.5985693"... | 0.70347 | 0 |
Set image name as tempest img_name_regex | def update_rally_regex(self, rally_conf='/etc/rally/rally.conf'):
rconfig = configparser.RawConfigParser()
rconfig.read(rally_conf)
if not rconfig.has_section('openstack'):
rconfig.add_section('openstack')
rconfig.set('openstack', 'img_name_regex', f'^{self.image.name}$')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_name(self, name=None):\n\n if name:\n new_name = name.split(\"/\")[-1].split(\".png\")[0]\n if new_name.startswith((\"AWS-\", \"Amazon-\")):\n new_name = new_name.split(\"-\", 1)[1]\n # Replace non-alphanumeric with underscores (1:1 mapping)\n ... | [
"0.70110047",
"0.6836254",
"0.66424894",
"0.6519122",
"0.6492873",
"0.63962543",
"0.6302101",
"0.6265177",
"0.62476915",
"0.6225492",
"0.6153673",
"0.613266",
"0.6126359",
"0.59868824",
"0.59406656",
"0.58305895",
"0.5810994",
"0.57725203",
"0.57725203",
"0.57647455",
"0.5746... | 0.5443021 | 42 |
Detect and update the default role if required | def update_default_role(self, rally_conf='/etc/rally/rally.conf'):
role = self.get_default_role(self.cloud)
if not role:
return
rconfig = configparser.RawConfigParser()
rconfig.read(rally_conf)
if not rconfig.has_section('openstack'):
rconfig.add_section('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _overrideRole(self, newRole, args):\n oldRole = args.get('role', None)\n args['role'] = newRole\n return oldRole",
"def changeRole(self, node, role):",
"def _set_override_role_called(self):\n self.__override_role_called = True",
"async def temprole(self, ctx: commands.Context,... | [
"0.7115389",
"0.66387266",
"0.65806973",
"0.6452636",
"0.6433589",
"0.6405648",
"0.6374333",
"0.63238055",
"0.6319324",
"0.630769",
"0.630502",
"0.6269636",
"0.6241185",
"0.61868477",
"0.6167082",
"0.61618745",
"0.61153567",
"0.6087079",
"0.6085021",
"0.60780394",
"0.60377514... | 0.6722509 | 1 |
Update auth section in tempest.conf | def update_auth_section(self):
rconfig = configparser.RawConfigParser()
rconfig.read(self.conf_file)
if not rconfig.has_section("auth"):
rconfig.add_section("auth")
if env.get("NEW_USER_ROLE").lower() != "member":
tempest_roles = []
if rconfig.has_opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def override_config(self):\n super(AuthedConfigFixture, self).override_config()\n self.conf.register_opts(auth_token._OPTS, group='keystone_authtoken')\n self.conf.set_override('auth_uri', 'http://127.0.0.1:35357',\n group='keystone_authtoken')",
"def set_auth_c... | [
"0.7055258",
"0.6269132",
"0.6093893",
"0.60797375",
"0.6063509",
"0.6012555",
"0.59593356",
"0.59593356",
"0.59572875",
"0.5940929",
"0.5885352",
"0.58571965",
"0.5832692",
"0.5775332",
"0.5770373",
"0.57187825",
"0.5698276",
"0.56846017",
"0.5671843",
"0.563528",
"0.5626709... | 0.767204 | 0 |
Update network section in tempest.conf | def update_network_section(self):
rconfig = configparser.RawConfigParser()
rconfig.read(self.conf_file)
if self.ext_net:
if not rconfig.has_section('network'):
rconfig.add_section('network')
rconfig.set('network', 'public_network_id', self.ext_net.id)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_compute_section(self):\n rconfig = configparser.RawConfigParser()\n rconfig.read(self.conf_file)\n if not rconfig.has_section('compute'):\n rconfig.add_section('compute')\n rconfig.set(\n 'compute', 'fixed_network_name',\n self.network.name if... | [
"0.696991",
"0.6750749",
"0.63753676",
"0.6196263",
"0.59945536",
"0.5972814",
"0.59464866",
"0.5930914",
"0.590459",
"0.5895841",
"0.58937216",
"0.58452964",
"0.5844862",
"0.5843245",
"0.5838263",
"0.5832796",
"0.5832103",
"0.5824422",
"0.5822572",
"0.5797349",
"0.57946074",... | 0.7767487 | 0 |
Update compute section in tempest.conf | def update_compute_section(self):
rconfig = configparser.RawConfigParser()
rconfig.read(self.conf_file)
if not rconfig.has_section('compute'):
rconfig.add_section('compute')
rconfig.set(
'compute', 'fixed_network_name',
self.network.name if self.networ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_tempest_update_params(\n tempest_conf_file, image_id=None, flavor_id=None,\n compute_cnt=1, image_alt_id=None, flavor_alt_id=None,\n admin_role_name='admin', cidr='192.168.120.0/24',\n domain_id='default'):\n # pylint: disable=too-many-branches,too-many-arguments,too-ma... | [
"0.68594015",
"0.6751863",
"0.6320202",
"0.6044343",
"0.6011546",
"0.58627504",
"0.58251506",
"0.5803778",
"0.579407",
"0.57885367",
"0.57636315",
"0.5726174",
"0.5714447",
"0.5692595",
"0.56901807",
"0.5688542",
"0.56050336",
"0.55926406",
"0.5581348",
"0.5575753",
"0.555043... | 0.7990638 | 0 |
Update validation section in tempest.conf | def update_validation_section(self):
rconfig = configparser.RawConfigParser()
rconfig.read(self.conf_file)
if not rconfig.has_section('validation'):
rconfig.add_section('validation')
rconfig.set(
'validation', 'connect_method',
'floating' if self.ext_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_config(self):\n pass",
"def validate_config(self):\n pass",
"def _validate_config(self):\n pass",
"def validate_settings(_cfg, _ctx):\n pass",
"def validate_config():\n\n # diff/sync settings, not including templates (see below)\n nori.setting_check_list('action', [... | [
"0.65538985",
"0.65538985",
"0.6428385",
"0.6422519",
"0.6317255",
"0.62712306",
"0.62712306",
"0.58824056",
"0.58824056",
"0.58192813",
"0.57234484",
"0.56826675",
"0.5652729",
"0.5652712",
"0.56522995",
"0.56318414",
"0.5625317",
"0.5567985",
"0.55444556",
"0.55250084",
"0.... | 0.7201769 | 0 |
Update scenario section in tempest.conf | def update_scenario_section(self):
rconfig = configparser.RawConfigParser()
rconfig.read(self.conf_file)
filename = getattr(
config.CONF, f'{self.case_name}_image', self.filename)
if not rconfig.has_section('scenario'):
rconfig.add_section('scenario')
rcon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure(self, section):",
"def test_update_scenario(self):\n pass",
"def test_set_new_section_property():\n\n value = '1'\n testutils.deploy_config_raw(\"\")\n\n prop.set_prop('info', 'sdk', value)\n assert prop.get_prop('info', 'sdk') == value\n\n testutils.undeploy()\n\n return... | [
"0.61347264",
"0.60817313",
"0.60120815",
"0.5875747",
"0.5773806",
"0.5770869",
"0.57243615",
"0.5709222",
"0.5686607",
"0.5598393",
"0.5580826",
"0.5557054",
"0.55527663",
"0.551544",
"0.5515208",
"0.54568624",
"0.54538155",
"0.5447713",
"0.5440486",
"0.5423029",
"0.5410496... | 0.6915758 | 0 |
Update dashboard section in tempest.conf | def update_dashboard_section(self):
rconfig = configparser.RawConfigParser()
rconfig.read(self.conf_file)
if env.get('DASHBOARD_URL'):
if not rconfig.has_section('dashboard'):
rconfig.add_section('dashboard')
rconfig.set('dashboard', 'dashboard_url', env.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dashboards_v2_update(self):\n pass",
"def dashboard():",
"def conf_update(self):\n pass",
"def configure(self, section):",
"def dashboard(self):\r\n return {}",
"def put_cloudwatch_dashboard(self):\n\n cloudwatch_config = self.provider_config[\"cloudwatch\"]\n dash... | [
"0.6211464",
"0.6072598",
"0.5836697",
"0.57798123",
"0.5621353",
"0.5581383",
"0.5558267",
"0.547862",
"0.54553175",
"0.53960663",
"0.53905696",
"0.53771514",
"0.5368407",
"0.53436995",
"0.53193396",
"0.53101474",
"0.5291737",
"0.5288086",
"0.5276987",
"0.52725184",
"0.52718... | 0.7722257 | 0 |
Create all openstack resources for tempestbased testcases and write tempest.conf. | def configure(self, **kwargs): # pylint: disable=unused-argument
if not os.path.exists(self.res_dir):
os.makedirs(self.res_dir)
self.deployment_id = rally.RallyBase.create_rally_deployment(
environ=self.project.get_environ())
if not self.deployment_id:
raise ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_config_roots(self):\n with self.override_role():\n self._create_config_root()",
"def _init_test_project_dir(self, project_dir):\n templates = glob.glob(f'{project_dir}/*.yml.template')\n for template_path in templates:\n # Replace env vars in template\n ... | [
"0.63005394",
"0.6280783",
"0.6268205",
"0.61768544",
"0.6080363",
"0.59952384",
"0.59927434",
"0.5990479",
"0.59720606",
"0.5965786",
"0.59333175",
"0.59139013",
"0.5901",
"0.58964276",
"0.588819",
"0.5879842",
"0.58784026",
"0.5877564",
"0.5873684",
"0.58731353",
"0.5862182... | 0.5555531 | 86 |
Cleanup all OpenStack objects. Should be called on completion. | def clean(self):
self.clean_rally_conf()
rally.RallyBase.clean_rally_logs()
if self.image_alt:
self.cloud.delete_image(self.image_alt)
if self.flavor_alt:
self.orig_cloud.delete_flavor(self.flavor_alt.id)
super().clean() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(self):\n\n pass",
"def cleanup(self):\n self._tmp_obj.cleanup()",
"def cleanup(self):\n logging.debug(\"cleanup called\")\n self.delete_networks()\n self.delete_machines()",
"def cleanup(self):\n pass",
"def cleanup(self):\n pass",
"def cleanup... | [
"0.750954",
"0.7480204",
"0.74759394",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74246347",
"0.73958975",
"0.7355814",
"0.7355814",
"0.73338693",
"0.73283964",
"... | 0.0 | -1 |
The overall result of the test. | def is_successful(self):
skips = self.details.get("skipped_number", 0)
if skips > 0 and self.deny_skipping:
return testcase.TestCase.EX_TESTCASE_FAILED
if self.tests_count and (
self.details.get("tests_number", 0) != self.tests_count):
return testcase.Test... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTestResults():",
"def test_print_results(self):\n calculated = super().predict_and_print()\n self.assertEqual(calculated, EXP_PRINT_OUTPUT_BASE.format(.18, .1, 0.186, self.test_model.model.train_time) +\n \"Max tree max_depth: 1\\n\"\n \"Number... | [
"0.7217664",
"0.7101899",
"0.6951403",
"0.6928828",
"0.68356526",
"0.68329054",
"0.68168074",
"0.67951506",
"0.67595416",
"0.67595416",
"0.6757254",
"0.6735284",
"0.67171884",
"0.669154",
"0.6682778",
"0.66215",
"0.66185975",
"0.6607094",
"0.65925574",
"0.65826654",
"0.658266... | 0.0 | -1 |
Cleanup all OpenStack objects. Should be called on completion. | def clean(self):
super().clean()
if self.user2:
self.orig_cloud.delete_user(self.user2.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(self):\n\n pass",
"def cleanup(self):\n self._tmp_obj.cleanup()",
"def cleanup(self):\n logging.debug(\"cleanup called\")\n self.delete_networks()\n self.delete_machines()",
"def cleanup(self):\n pass",
"def cleanup(self):\n pass",
"def cleanup... | [
"0.750954",
"0.7480204",
"0.74759394",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74699354",
"0.74246347",
"0.73958975",
"0.7355814",
"0.7355814",
"0.73338693",
"0.73283964",
"... | 0.0 | -1 |
Both lowercase and uppercase work. | def test_case(self):
expected = dict(seconds=1)
self.assertEqual(expected, util.parse_relative_time_string("+1s"))
self.assertEqual(expected, util.parse_relative_time_string("+1S")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_case_really():",
"def lower(self) -> str:",
"def change_case(word):\n return word.upper() if case == \"upper\" else word.lower()",
"def UCase(text):\n return text.upper()",
"def lower(self) -> String:\n pass",
"def upper(self) -> String:\n pass",
"def invert_capitalization(wor... | [
"0.7888038",
"0.74145114",
"0.7300231",
"0.7298207",
"0.7234407",
"0.72248316",
"0.7159596",
"0.7100405",
"0.70785433",
"0.7038743",
"0.7024058",
"0.69719297",
"0.68534386",
"0.68456966",
"0.6818771",
"0.67926633",
"0.67692226",
"0.6749288",
"0.6728544",
"0.672317",
"0.672317... | 0.0 | -1 |
Use short forms of all relative quantities. | def test_combined(self):
expected = dict(
seconds=1, minutes=2, hours=3, days=4, weeks=5, months=6, years=7)
self.assertEqual(
expected,
util.parse_relative_time_string("+1s 2min 3h 4d 5w 6mo 7y")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_quantities(self):\n return (\n pynini.cdrewrite(self.units_map, \"\", \"\", self.sigma_star, direction=\"ltr\") *\n pynini.cdrewrite(self.singularize_map, \"1 \", \"\", self.sigma_star, direction=\"ltr\") *\n pynini.cdrewrite(self.thousands_map, \"\", self.trip... | [
"0.6512724",
"0.59939337",
"0.5711577",
"0.541956",
"0.5362634",
"0.53039896",
"0.52917475",
"0.5228152",
"0.5227453",
"0.5224564",
"0.51927465",
"0.51301813",
"0.5122503",
"0.51153004",
"0.50611734",
"0.50595826",
"0.5059474",
"0.50424314",
"0.5035468",
"0.50253",
"0.5024932... | 0.0 | -1 |
Use long forms of all relative quantities. | def test_combined_long(self):
expected = dict(
seconds=1, minutes=2, hours=3, days=4, weeks=5, months=6, years=7)
self.assertEqual(
expected,
util.parse_relative_time_string(
"+1seconds 2minutes 3hours 4days 5weeks 6months 7years")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_quantities(self):\n return (\n pynini.cdrewrite(self.units_map, \"\", \"\", self.sigma_star, direction=\"ltr\") *\n pynini.cdrewrite(self.singularize_map, \"1 \", \"\", self.sigma_star, direction=\"ltr\") *\n pynini.cdrewrite(self.thousands_map, \"\", self.trip... | [
"0.5763751",
"0.57263374",
"0.5530851",
"0.53156966",
"0.52988696",
"0.5267081",
"0.5256319",
"0.5236607",
"0.51762974",
"0.50967425",
"0.5052649",
"0.50231206",
"0.49980336",
"0.4981215",
"0.49359396",
"0.4921764",
"0.491773",
"0.49041143",
"0.48668915",
"0.48621738",
"0.484... | 0.0 | -1 |
Use singular long forms of all relative quantities. | def test_combined_long_singular(self):
expected = dict(
seconds=1, minutes=2, hours=3, days=4, weeks=5, months=6, years=7)
self.assertEqual(
expected,
util.parse_relative_time_string(
"+1second 2minute 3hour 4day 5week 6month 7year")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_quantities(self):\n return (\n pynini.cdrewrite(self.units_map, \"\", \"\", self.sigma_star, direction=\"ltr\") *\n pynini.cdrewrite(self.singularize_map, \"1 \", \"\", self.sigma_star, direction=\"ltr\") *\n pynini.cdrewrite(self.thousands_map, \"\", self.trip... | [
"0.6412024",
"0.53993636",
"0.51782227",
"0.51773006",
"0.5174996",
"0.5163263",
"0.51273453",
"0.51256734",
"0.50906944",
"0.50828797",
"0.50539",
"0.50407094",
"0.50339645",
"0.5032934",
"0.5030906",
"0.49861586",
"0.49768457",
"0.49484769",
"0.49396574",
"0.49372008",
"0.4... | 0.0 | -1 |
Test that parsing can handle repeated +foos | def test_multiple_plusses(self):
self.assertEqual(
dict(seconds=3, hours=2), util.parse_relative_time_string("+3s +2h")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_smoke():\n raise SkipTest\n parse('[8]')\n parse('[show \"hey\"]')\n parse('[frob thing with thong]')\n parse('[\"this\" \"thing\"]')\n parse('[[] []]')\n parse('[key: value key2: value2 orphan]')\n parse('[1 + (2 + 3)]')\n parse('[funcs: [term/on-red 8 \"foo\"]]')",
"def test... | [
"0.61089253",
"0.6051582",
"0.5927639",
"0.5911758",
"0.5836167",
"0.5828901",
"0.5684214",
"0.56775075",
"0.5607498",
"0.55419064",
"0.5386963",
"0.5331841",
"0.52932787",
"0.5281664",
"0.52596104",
"0.52579725",
"0.52496994",
"0.52182776",
"0.5215907",
"0.52148813",
"0.5205... | 0.5020983 | 52 |
Test that parsing can handle various kinds of inserted whitespace. | def test_whitespace_insensitive(self):
expected = dict(seconds=3)
# I have raged because of this.
self.assertEqual(expected, util.parse_relative_time_string("+3s"))
self.assertEqual(expected, util.parse_relative_time_string(" +3s"))
self.assertEqual(expected, util.parse_relative_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_whitespace(self):\n self.assertRaises(ParseException, self.flag.parseString, ' ')",
"def test_whitespace(self):\n\n tokens = list(Lexer(\" \\n\\t \\t\\n\\n\\t\\t\\n \").generate_tokens())\n self.assertEqual(tokens, [])",
"def test_preserved_whitespace_in_pre_and_textarea(self):\n ... | [
"0.79419816",
"0.7760519",
"0.72913486",
"0.723292",
"0.7200425",
"0.7050657",
"0.69689065",
"0.69117516",
"0.68184376",
"0.6778215",
"0.6687617",
"0.6571169",
"0.6524297",
"0.6511256",
"0.6507385",
"0.64757293",
"0.64296514",
"0.6411742",
"0.64069945",
"0.63685375",
"0.63432... | 0.65624 | 12 |
Don't repeat units, it's a mistake. | def test_repeated_unit(self):
self.assertEqual(
dict(seconds=3), util.parse_relative_time_string("+3s +3seconds"))
with self.assertRaises(ValueError):
util.parse_relative_time_string("+3s +4seconds") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def useUnits():",
"def unit(self) -> str:",
"def units(self):\n pass",
"def _fix_units(cube, definition):\n\n if cube.var_name != 'pr':\n cube.convert_units(definition.units)",
"def consume_units(self, units):\n pass",
"def consume_units_unconditionally(self, units):\n pass... | [
"0.7053097",
"0.6475925",
"0.6444394",
"0.6353991",
"0.6254716",
"0.6219291",
"0.61247426",
"0.60846806",
"0.6044864",
"0.60322154",
"0.6015435",
"0.60091335",
"0.6004741",
"0.5984957",
"0.59821856",
"0.5966261",
"0.5961657",
"0.59276956",
"0.5874179",
"0.5864317",
"0.5854550... | 0.0 | -1 |
Fuck m. It could mean minutes or months. | def test_ambiguous_m(self):
with self.assertRaises(ValueError):
util.parse_relative_time_string("+3m") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unit_mo(self):\n return (((self.time_base * 60.0) * 24.0) * 365.0) / 12",
"def unit_mo(self):\n return (((self.time_base * 60.0) * 24.0) * 365.0) / 12",
"def minutes(input=None):\n return get(input).minutes",
"def mm(self):\n return '%02d' % self._month",
"def Month(self):\n ... | [
"0.6905258",
"0.68023515",
"0.6735644",
"0.66758174",
"0.6309507",
"0.6303951",
"0.62606466",
"0.62517",
"0.6237802",
"0.62091005",
"0.61038035",
"0.60716474",
"0.60693926",
"0.60643584",
"0.60643584",
"0.6048454",
"0.6048005",
"0.6045694",
"0.6035083",
"0.5966593",
"0.592882... | 0.59682554 | 19 |
Turns a waze linestring into a geojson linestring | def get_linestring(value):
line = value['line']
coords = [(x['x'], x['y']) for x in line]
return geojson.Feature(
geometry=geojson.LineString(coords),
properties=value
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lineToPolygon(geom):\n assert(geom[\"type\"] == \"LineString\")\n # LineString is only the exterior line of a polygon (no holes possible)\n return geojson.Polygon(coordinates=[geom[\"coordinates\"]], validate=True)",
"def parse_point(line):\n return json.loads(line)",
"def ways2geometry(overpas... | [
"0.67091656",
"0.6261151",
"0.6204115",
"0.61178505",
"0.6099191",
"0.5865695",
"0.5834806",
"0.5778352",
"0.57694143",
"0.5755196",
"0.5703966",
"0.5692615",
"0.568841",
"0.56757134",
"0.5596205",
"0.5546677",
"0.55370474",
"0.54986805",
"0.54589975",
"0.54281527",
"0.537382... | 0.73890424 | 0 |
Given a dict with keys of segment id, and val a list of waze jams (for now, just jams), the properties of a road segment, and the total number of snapshots we're looking at, update the road segment's properties to include features | def get_features(waze_info, properties, num_snapshots):
# Waze feature list
# jam_percent - percentage of snapshots that have a jam on this segment
if properties['segment_id'] in waze_info:
# only count one jam per snapshot on a road
num_jams = len(set([x['properties']['snapshotId']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_segmentation_map(segmap, object_map):\n obj_pix = object_map != 0\n segmap[obj_pix] = object_map[obj_pix]\n return segmap",
"def map_segments(datadir, filename):\n items = json.load(open(filename))\n\n # Only look at jams for now\n items = [get_linestring(x) for x in items if x['even... | [
"0.5607581",
"0.547822",
"0.5368693",
"0.5272165",
"0.51953465",
"0.5120909",
"0.51085174",
"0.5026395",
"0.4963226",
"0.4891959",
"0.48770952",
"0.48622277",
"0.48405787",
"0.48178878",
"0.48024377",
"0.4794791",
"0.47820604",
"0.47804672",
"0.47776642",
"0.47595677",
"0.473... | 0.5887457 | 0 |
Map a set of waze segment info (jams) onto segments drawn from | def map_segments(datadir, filename):
items = json.load(open(filename))
# Only look at jams for now
items = [get_linestring(x) for x in items if x['eventType'] == 'jam']
items = util.reproject_records(items)
# Get the total number of snapshots in the waze data
num_snapshots = max([x['propertie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def watershed_segment(M,xM=None,yM=None):\n\n if xM != None and yM != None:\n sel = np.ones((int(ceil(23.9*xM)),int(ceil(23.9*yM)))) # for opening\n sel2 = np.ones((int(ceil(127.2*xM)),int(ceil(127.2*yM)))) # for local thresholding\n sel3 = np.ones((int(ceil(11.9*xM)),int(ceil(11.9*yM)))) #... | [
"0.55145633",
"0.5488799",
"0.544273",
"0.5393466",
"0.53590786",
"0.5282899",
"0.52790564",
"0.52568614",
"0.5226479",
"0.5168571",
"0.51627374",
"0.5147692",
"0.5122647",
"0.5085006",
"0.507419",
"0.5074113",
"0.5067044",
"0.5063809",
"0.50582534",
"0.50517637",
"0.50384414... | 0.67416376 | 0 |
Turns a json file into a geojson file of linestrings Used mainly for visualization/debugging It is not a simplified set of linestrings, but rather a linestring for each jam instance (even if multiple jam instances are on the same segment) | def make_map(filename, datadir):
items = json.load(open(filename))
geojson_items = []
for item in items:
geojson_items.append(get_linestring(item))
with open(os.path.join(datadir, 'waze.geojson'), 'w') as outfile:
geojson.dump(geojson.FeatureCollection(geojson_items), outfile) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lines_to_json():\n from os import walk\n lines = {}\n\n filenames = list(walk('lines'))[0][2]\n for file in filenames:\n line_name = file[:-4]\n dict = {\n \"name\": line_name,\n \"rulers\": [],\n \"stations\": [],\n }\n fp = open('lines/... | [
"0.66820174",
"0.6604937",
"0.64030886",
"0.6192156",
"0.60641205",
"0.59143716",
"0.58849424",
"0.5786112",
"0.5771482",
"0.5677702",
"0.5658378",
"0.5658378",
"0.56573534",
"0.56010014",
"0.55277485",
"0.5522806",
"0.55086166",
"0.5486713",
"0.5436277",
"0.54358983",
"0.542... | 0.6512101 | 2 |
change self.O to index of V | def trans_o(self):
temp_array = []
for j in range(self.O.shape[1]):
for i in range(self.V.shape[1]):
if self.V[0, i] == self.O[0, j]:
temp_array.append(i)
self.O = mat(temp_array) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_v_item(self, vindex, new_val):\n\n i = [((0, 0),),\n ((1, 1),),\n ((2, 2),),\n ([1, 2], [2, 1]),\n ([2, 0], [0, 2]),\n ([0, 1], [1, 0])]\n\n for j, k in i[vindex]:\n self[j, k] = new_val",
"def position(self, u, v):\n ... | [
"0.616067",
"0.5951123",
"0.5940856",
"0.59249765",
"0.589935",
"0.58980864",
"0.5833399",
"0.5831099",
"0.57763237",
"0.57763237",
"0.5732142",
"0.5729264",
"0.571432",
"0.5690176",
"0.5676093",
"0.56725025",
"0.5644405",
"0.56342834",
"0.5614423",
"0.55696946",
"0.5519098",... | 0.7162628 | 0 |
Mostly a copy of BucketIterator.__iter__, but yielding the batches as lists of sentences instead of Batch objects. | def iter_batches_as_lists(self):
while True:
self.init_epoch()
for idx, minibatch in enumerate(self.batches):
# fast-forward if loaded from state
if self._iterations_this_epoch > idx:
continue
self.iterations += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self) -> Iterator[Batch]:\n return self.get_iterator()",
"def yield_batches(self, texts):\n batch = []\n for text in self._iter_texts(texts):\n batch.append(text)\n if len(batch) == self.batch_size:\n yield batch\n batch = []\n... | [
"0.69556385",
"0.68531173",
"0.68480146",
"0.6809403",
"0.6779955",
"0.66480255",
"0.65036225",
"0.6502744",
"0.6464221",
"0.63525033",
"0.62465197",
"0.6236124",
"0.62299806",
"0.6210764",
"0.61090827",
"0.60915214",
"0.60846895",
"0.60806215",
"0.60689926",
"0.60080016",
"0... | 0.5815948 | 37 |
You can't sell stocks you bought in previous rounds. | def _validateSale(self, player: Player, company: PublicCompany, amount: int, kwargs: MutableGameState):
my_purchases = kwargs.purchases[kwargs.stock_round_count].get(player, [])
my_stock = player.hasStock(company)
potential_owners = company.potentialPresidents()
validations = [
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cannot_sell_more_than_stock(self):\n reply = self.admin_add_product()\n\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n sale = dict(products = [\n {\n \"prod_name\":\"NY_denims\", \n \... | [
"0.6875273",
"0.67457604",
"0.6707187",
"0.66265756",
"0.6544243",
"0.6483956",
"0.64721864",
"0.6461632",
"0.64583033",
"0.64509934",
"0.6384715",
"0.6352751",
"0.6285283",
"0.62718886",
"0.62589777",
"0.6212371",
"0.6205551",
"0.61705136",
"0.6152634",
"0.6145874",
"0.61439... | 0.60318184 | 34 |
Used in situations where there are multiple companies that are performing a sale. | def validateSales(self, move: StockRoundMove, kwargs: MutableGameState) -> bool:
data = [self._validateSale(move.player, company, amount, kwargs)
for company, amount in move.for_sale]
return reduce(
lambda x, y: x and y,
data
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Trading(Seller,Buyer):\n if Seller.has_sold == False:\n if Buyer.like_buy >= Seller.like_sell:\n Seller.has_sold = True\n Buyer.has_bought = True\n Seller.sold_objects += 1\n Buyer.bought_objects += 1\n print('A trade has been made')\n e... | [
"0.56623155",
"0.5586672",
"0.5497795",
"0.54298383",
"0.5423017",
"0.54101044",
"0.5384244",
"0.5360452",
"0.5356939",
"0.5356164",
"0.5341028",
"0.52707535",
"0.51846695",
"0.51781535",
"0.51774424",
"0.5175732",
"0.5168322",
"0.51191956",
"0.5117365",
"0.5112092",
"0.50652... | 0.50700855 | 20 |
This method is so that child classes can define additional object state checks before cloning (e.g. see ModelWrapperBase which should not clone if the modelcaching manager has already been set) | def additional_cloning_checks(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _try_clone_model(model):\n try:\n return copy.deepcopy(model)\n except Exception:\n warnings.warn(\n \"Failed to clone model. Model state might be mutated during verification.\"\n )\n return model",
"def sanitize_clone(self):\n pass",
"def clone(self):\n ... | [
"0.622249",
"0.6182846",
"0.6147965",
"0.61453974",
"0.60161626",
"0.60104495",
"0.5994128",
"0.5990812",
"0.5983475",
"0.5928679",
"0.5925357",
"0.59229016",
"0.58280325",
"0.581751",
"0.5797897",
"0.57970923",
"0.5795579",
"0.5782216",
"0.57797414",
"0.5779336",
"0.57745355... | 0.73478645 | 0 |
Used when the entire index for model is updated. | def index_queryset(self, **kwargs):
return self.get_model().objects.filter(last_modified__lte=datetime.datetime.now()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _idx_changed(self, idx):\n self.refresh_memory()",
"def index_later(self):\n return",
"def reindex(self):\n raise NotImplementedError()",
"def __on_query_edited(self):\n self.__refresh_search_results()",
"def updateModel(self):\n pass",
"def reindex(self):",
"def ... | [
"0.715991",
"0.7071355",
"0.6966145",
"0.674346",
"0.6701415",
"0.669448",
"0.669448",
"0.65612817",
"0.65583634",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.6505963",
"0.... | 0.0 | -1 |
`r` is in units of h^1 where h is the smoothing length of the object in consideration. The kernels are in units of h^3, hence the need to divide by h^2 at the end. Defined kernels at the moment are `uniform`, `sphanarchy`, `gadget2`, `cubic`, `quintic` | def inp_kernel(r, ktype):
if ktype == 'uniform':
if r < 1.:
return 1./((4./3.)*pi)
else:
return 0.
elif ktype == 'sph-anarchy':
if r <= 1.: return (21./(2.*pi)) * ((1. - r)*(1. - r)*(1. - r)*(1. - r)*(1. + 4.*r))
else: return 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _kernel(r: float, h: float) -> float:\n sigma_2 = 10 / (7 * np.pi * h * h)\n q = abs(r / h)\n\n if q <= 1.0:\n q2 = q * q\n W = 1.0 - 1.5 * q2 * (1.0 - 0.5 * q)\n W *= sigma_2\n elif q <= 2.0:\n two_minus_q = 2 - q\n two_minus_q_c = np.power(two_minus_q, 3)\n ... | [
"0.7583277",
"0.6430362",
"0.6089587",
"0.5911174",
"0.58562016",
"0.58238995",
"0.5730164",
"0.5669449",
"0.5650246",
"0.5610997",
"0.5575138",
"0.556798",
"0.5559911",
"0.5557502",
"0.55436075",
"0.5539063",
"0.5527549",
"0.54914933",
"0.54859227",
"0.5459113",
"0.5433242",... | 0.6187202 | 2 |
h^2 2 integral(W(r) dz) from x = 0 to sqrt(1.b^2) for various values of `b` | def get_kernel(ktype):
kernel = np.zeros(kernsize + 1)
this_kern = partial(inp_kernel, ktype=ktype)
bins = np.arange(0, 1., 1./kernsize)
bins = np.append(bins, 1.)
for ii in range(kernsize):
y, yerr = integrate.quad(integral_func(this_kern, bins[ii]), 0, np.sqrt(1.-bins[ii]**2))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _intKernel(b, h=1., kernelspline=1., dim=3):\n ## Distances are all in smoothing length 'h' and hence z integral runs from 0 to zmax_2D\n ## Integral is symmetric about zero, so (-zmax_2D to 0) + (0 to zmax_2D) is just double (0 to zmax_2D)\n ## Price's eqn 30 but modified to give\n zmax_2D = np.sq... | [
"0.65825295",
"0.6349067",
"0.63249916",
"0.6249499",
"0.6218899",
"0.6218899",
"0.6197607",
"0.6125584",
"0.6116413",
"0.61035043",
"0.60024196",
"0.5992483",
"0.5974543",
"0.5918778",
"0.59006196",
"0.5895426",
"0.57886285",
"0.57810473",
"0.576925",
"0.57505536",
"0.574437... | 0.0 | -1 |
Saves the computed kernel for easy lookup as .npz file | def create_kernel(ktype='sph-anarchy'):
kernel = get_kernel(ktype)
header = np.array([{'kernel': ktype, 'bins': kernsize}])
np.savez('kernel_{}.npz'.format(ktype), header=header, kernel=kernel)
print (header)
return kernel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, filename):\n np.savez(temp_dir + '/' + filename + '.npz', chip_ids=self.chip_ids, core_ids=self.core_ids, cx_ids=self.cx_ids)",
"def save(self, model_out_file):\n\t\tvariables_dict = {v.name: v for v in tf.global_variables()}\n\t\tvalues_dict = self.sess.run(variables_dict)\n\t\tnp.savez(op... | [
"0.6442163",
"0.6418604",
"0.6242592",
"0.62161463",
"0.6036001",
"0.59375066",
"0.5916903",
"0.5870925",
"0.5862356",
"0.58407557",
"0.582576",
"0.5815789",
"0.58025026",
"0.5755386",
"0.5704577",
"0.5699239",
"0.5672944",
"0.56612027",
"0.56331027",
"0.5628472",
"0.5596223"... | 0.6803789 | 0 |
This function must probably be fixed. | def compile_all_mechanisms():
#attempt to set up a folder with all unique mechanism mod files, compile, and
#load them all
if not os.path.isdir(os.path.join('mods')):
print os.listdir('.')
os.mkdir(os.path.join('mods'))
neurons = glob(join('L5*'))
print neurons
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degibber(self):",
"def __call__(self) -> None:",
"def exo2():",
"def support(self):",
"def exercise_b2_106():\r\n pass",
"def regular(self):",
"def exercise_b2_53():\r\n pass",
"def exercise_b2_107():\r\n pass",
"def __call__(self):\n\t\treturn",
"def cx():",
"def exercise_b2_113()... | [
"0.6153057",
"0.615021",
"0.6081874",
"0.6007024",
"0.5964929",
"0.59557754",
"0.5946659",
"0.5874505",
"0.5852786",
"0.58491945",
"0.57989144",
"0.57970655",
"0.57970655",
"0.57955885",
"0.57955885",
"0.57955885",
"0.57955885",
"0.57955885",
"0.57245666",
"0.568598",
"0.5667... | 0.0 | -1 |
Custom save method to autoset the phs field. | def save(self, *args, **kwargs):
self.phs = self.set_phs()
super(Study, self).save(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, *args, **kwargs):\n if not self.pkhash:\n self.pkhash = compute_hash(self.script)\n super(DataOpener, self).save(*args, **kwargs)",
"def save(self, *args, **kwargs):\n super().save(*args, **kwargs)",
"def save(self, *args, **kwargs):\n super().save(*args, *... | [
"0.6665393",
"0.6541349",
"0.6541349",
"0.6539829",
"0.63699436",
"0.6302961",
"0.627035",
"0.62583447",
"0.62583447",
"0.62583447",
"0.62583447",
"0.62583447",
"0.62433136",
"0.6223159",
"0.6214938",
"0.61958426",
"0.6168871",
"0.61671007",
"0.6163853",
"0.613194",
"0.61283"... | 0.7240601 | 0 |
Automatically set phs from the study's accession number. Properly format the phs number for this study, so it's easier to get to in templates. | def set_phs(self):
return 'phs{:06}'.format(self.i_accession) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_spondaic(self, scansion: str) -> str:\n mark_list = string_utils.mark_list(scansion)\n vals = list(scansion.replace(\" \", \"\"))\n new_vals = self.SPONDAIC_PENTAMETER[:-1] + vals[-1]\n corrected = \"\".join(new_vals)\n new_line = list(\" \" * len(scansion))\n for... | [
"0.51352465",
"0.5065886",
"0.50378156",
"0.49864033",
"0.49230617",
"0.4835675",
"0.4805406",
"0.4756666",
"0.47290546",
"0.4711049",
"0.46981743",
"0.46366873",
"0.45931435",
"0.45776656",
"0.4569041",
"0.45661506",
"0.4560519",
"0.45518896",
"0.4550762",
"0.45448464",
"0.4... | 0.59272975 | 0 |
Gets the absolute URL of the detail page for a given Study instance. | def get_absolute_url(self):
return reverse('trait_browser:source:studies:pk:detail', kwargs={'pk': self.pk}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n return ('publication_detail', (), {'slug': self.slug})",
"def exam_url(self, obj):\n request = self.context.get(\"request\")\n return reverse(\"exam-detail\", args=[obj.id], request=request)",
"def details_url(self):\n if self._data.get('details_url'):\... | [
"0.6810438",
"0.6689379",
"0.6567158",
"0.64550245",
"0.64396584",
"0.64053893",
"0.63963675",
"0.6392365",
"0.63474274",
"0.63005847",
"0.62952244",
"0.6280981",
"0.62611544",
"0.62428",
"0.62371224",
"0.6232598",
"0.62293047",
"0.6219801",
"0.62155926",
"0.6194746",
"0.6167... | 0.7098282 | 0 |
Produce a url to initially populate checkboxes in the search page based on the study. | def get_search_url(self):
return reverse('trait_browser:source:studies:pk:traits:search', kwargs={'pk': self.pk}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataset_search_url(self):\n return reverse('trait_browser:source:studies:pk:datasets:search', kwargs={'pk': self.pk})",
"def form_search_url(self):\r\n self.reformat_search_for_spaces()\r\n self.target_yt_search_url_str = self.prefix_of_search_url + self.yt_search_key + self.filter_u... | [
"0.5623152",
"0.5556928",
"0.55449784",
"0.5331433",
"0.52878296",
"0.52027786",
"0.5178475",
"0.51745033",
"0.51574606",
"0.51473963",
"0.5132062",
"0.51022416",
"0.51008046",
"0.5066496",
"0.50376517",
"0.5019615",
"0.501772",
"0.50154096",
"0.5013686",
"0.50117487",
"0.500... | 0.60279405 | 0 |
Produce a url to search datasets wtihin the study. | def get_dataset_search_url(self):
return reverse('trait_browser:source:studies:pk:datasets:search', kwargs={'pk': self.pk}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataset_url(self, dataset: Dict) -> str:\n return f\"{self.site_url}/dataset/{dataset['name']}\"",
"def url(self) -> str:\n return self.DATASET_URLS[self.name]",
"def get_search_url(free_text_search):\n url = baseUrl + \"data/\"\n if not free_text_search:\n url += \"warehouse... | [
"0.7010941",
"0.66344947",
"0.6386537",
"0.6122667",
"0.60913324",
"0.60644984",
"0.5981221",
"0.5981221",
"0.5922729",
"0.58895314",
"0.5875229",
"0.58479536",
"0.5847596",
"0.5828358",
"0.5824677",
"0.5810934",
"0.5793076",
"0.5771518",
"0.57501584",
"0.57501584",
"0.573606... | 0.765159 | 0 |
Get html for study's name linking to study detail page. | def get_name_link_html(self):
url_text = "{{% url 'trait_browser:source:studies:pk:detail' pk={} %}} ".format(self.pk)
return URL_HTML.format(url=url_text, name=self.i_study_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def study():\n return render_template('study.html')",
"def get_study_info(study_link):\n template = \"https://clinicaltrials.gov{}\"\n study_link = study_link.replace(' ', '+')\n return template.format(study_link)",
"def get_study_name_from_id(self, study_id: int) -> str:\n raise NotImplemente... | [
"0.68769675",
"0.6697346",
"0.61508894",
"0.60814106",
"0.60482645",
"0.6036819",
"0.588089",
"0.58306956",
"0.5795159",
"0.57281035",
"0.56913704",
"0.5666021",
"0.5664573",
"0.5647374",
"0.5640818",
"0.5606993",
"0.56017995",
"0.559533",
"0.5540547",
"0.5521373",
"0.5483745... | 0.8060419 | 0 |
Return a count of the number of tags for which traits are currently tagged in this study. | def get_all_tags_count(self):
return apps.get_model('tags', 'Tag').objects.filter(
all_traits__source_dataset__source_study_version__study=self,
all_traits__source_dataset__source_study_version__i_is_deprecated=False
).distinct().count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_traits_tagged_count(self):\n return SourceTrait.objects.filter(\n source_dataset__source_study_version__study=self\n ).current().exclude(all_tags=None).count()",
"def get_non_archived_traits_tagged_count(self):\n return apps.get_model('tags', 'TaggedTrait').objects.cur... | [
"0.8226051",
"0.7614737",
"0.7482339",
"0.73601985",
"0.6980459",
"0.6858096",
"0.67520094",
"0.6747932",
"0.67395145",
"0.6732069",
"0.6557751",
"0.6545756",
"0.6491599",
"0.6463144",
"0.6365109",
"0.6287284",
"0.6277681",
"0.6229974",
"0.6214309",
"0.60938543",
"0.60671884"... | 0.73767453 | 3 |
Return a count of the number of tags for which current traits are tagged, but archived, in this study. | def get_archived_tags_count(self):
return apps.get_model('tags', 'TaggedTrait').objects.archived().filter(
trait__source_dataset__source_study_version__study=self
).current().aggregate(
models.Count('tag', distinct=True))['tag__count'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_archived_traits_tagged_count(self):\n return apps.get_model('tags', 'TaggedTrait').objects.archived().filter(\n trait__source_dataset__source_study_version__study=self\n ).current().aggregate(\n models.Count('trait', distinct=True)\n )['trait__count']",
"def get... | [
"0.85525626",
"0.8337307",
"0.808836",
"0.7484111",
"0.7208109",
"0.6977215",
"0.6822008",
"0.6755481",
"0.66966176",
"0.6484534",
"0.63340545",
"0.62938446",
"0.6283145",
"0.6265508",
"0.6221511",
"0.6198768",
"0.6086896",
"0.6075747",
"0.6005409",
"0.5969021",
"0.59272254",... | 0.84307426 | 1 |
Return a count of the number of tags for which current traits are tagged and NOT archived in this study. | def get_non_archived_tags_count(self):
return apps.get_model('tags', 'TaggedTrait').objects.current().non_archived().filter(
trait__source_dataset__source_study_version__study=self
).aggregate(
models.Count('tag', distinct=True)
)['tag__count'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_non_archived_traits_tagged_count(self):\n return apps.get_model('tags', 'TaggedTrait').objects.current().non_archived().filter(\n trait__source_dataset__source_study_version__study=self).aggregate(\n models.Count('trait', distinct=True))['trait__count']",
"def get_archived_tr... | [
"0.8467494",
"0.8112197",
"0.78891003",
"0.7850834",
"0.7500608",
"0.71294785",
"0.7103285",
"0.6557854",
"0.65265596",
"0.65047705",
"0.649833",
"0.64623296",
"0.6449028",
"0.6413315",
"0.6307243",
"0.6264373",
"0.6264373",
"0.6233762",
"0.62306404",
"0.61675465",
"0.6117030... | 0.8097123 | 2 |
Return a queryset of all of the current TaggedTraits from this study. | def get_all_tagged_traits(self):
return apps.get_model('tags', 'TaggedTrait').objects.filter(
trait__source_dataset__source_study_version__study=self,
).current() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_archived_tagged_traits(self):\n return apps.get_model('tags', 'TaggedTrait').objects.archived().filter(\n trait__source_dataset__source_study_version__study=self\n ).current()",
"def get_all_traits_tagged_count(self):\n return SourceTrait.objects.filter(\n sourc... | [
"0.6514019",
"0.6437152",
"0.6416004",
"0.6301729",
"0.61813736",
"0.61287004",
"0.61267114",
"0.6058266",
"0.5956338",
"0.59383553",
"0.5782794",
"0.5782794",
"0.57523257",
"0.568733",
"0.5643809",
"0.5636289",
"0.55189633",
"0.5469623",
"0.5362374",
"0.53501254",
"0.5303839... | 0.8149221 | 0 |
Return a queryset of the current archived TaggedTraits from this study. | def get_archived_tagged_traits(self):
return apps.get_model('tags', 'TaggedTrait').objects.archived().filter(
trait__source_dataset__source_study_version__study=self
).current() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def archived_tags(self):\n archived_tagged_traits = apps.get_model('tags', 'TaggedTrait').objects.archived().filter(trait=self)\n return apps.get_model('tags', 'Tag').objects.filter(\n pk__in=archived_tagged_traits.values_list('tag__pk', flat=True))",
"def get_non_archived_tagged_traits(... | [
"0.77290195",
"0.75084317",
"0.72397757",
"0.71252674",
"0.65865415",
"0.64593077",
"0.64155614",
"0.62145716",
"0.61490464",
"0.60586834",
"0.6027033",
"0.58406144",
"0.5763332",
"0.56548536",
"0.5611018",
"0.5603707",
"0.5603707",
"0.5603707",
"0.55999005",
"0.5566254",
"0.... | 0.8213264 | 0 |
Return a queryset of the current nonarchived TaggedTraits from this study. | def get_non_archived_tagged_traits(self):
return apps.get_model('tags', 'TaggedTrait').objects.current().non_archived().filter(
trait__source_dataset__source_study_version__study=self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_archived_tagged_traits(self):\n return apps.get_model('tags', 'TaggedTrait').objects.archived().filter(\n trait__source_dataset__source_study_version__study=self\n ).current()",
"def get_all_tagged_traits(self):\n return apps.get_model('tags', 'TaggedTrait').objects.filter... | [
"0.775637",
"0.73766696",
"0.708502",
"0.68280214",
"0.6783516",
"0.6571693",
"0.6464671",
"0.6396007",
"0.63075525",
"0.611397",
"0.6077231",
"0.60213524",
"0.59917337",
"0.590065",
"0.5870306",
"0.58424973",
"0.5763946",
"0.57431793",
"0.56793123",
"0.56793123",
"0.56793123... | 0.82755035 | 0 |
Return the count of all current traits that have been tagged in this study. | def get_all_traits_tagged_count(self):
return SourceTrait.objects.filter(
source_dataset__source_study_version__study=self
).current().exclude(all_tags=None).count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_non_archived_traits_tagged_count(self):\n return apps.get_model('tags', 'TaggedTrait').objects.current().non_archived().filter(\n trait__source_dataset__source_study_version__study=self).aggregate(\n models.Count('trait', distinct=True))['trait__count']",
"def get_archived_tr... | [
"0.7672161",
"0.7633912",
"0.7162639",
"0.7084544",
"0.67033195",
"0.66352296",
"0.6590511",
"0.64851606",
"0.6463744",
"0.63729537",
"0.6240862",
"0.6184167",
"0.6182421",
"0.60347986",
"0.60346127",
"0.6001969",
"0.6001855",
"0.5997859",
"0.5997859",
"0.5991083",
"0.5980368... | 0.85028684 | 0 |
Return the count of current traits that have been tagged (and the tag archived) in this study. | def get_archived_traits_tagged_count(self):
return apps.get_model('tags', 'TaggedTrait').objects.archived().filter(
trait__source_dataset__source_study_version__study=self
).current().aggregate(
models.Count('trait', distinct=True)
)['trait__count'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_non_archived_traits_tagged_count(self):\n return apps.get_model('tags', 'TaggedTrait').objects.current().non_archived().filter(\n trait__source_dataset__source_study_version__study=self).aggregate(\n models.Count('trait', distinct=True))['trait__count']",
"def get_archived_ta... | [
"0.8268371",
"0.80618906",
"0.79486185",
"0.75812364",
"0.7075274",
"0.6992174",
"0.69508713",
"0.66764146",
"0.6522477",
"0.6356951",
"0.63389266",
"0.62884736",
"0.6141169",
"0.6141169",
"0.6046133",
"0.5984525",
"0.5980168",
"0.5971963",
"0.5918252",
"0.5876502",
"0.586792... | 0.85503507 | 0 |
Return the count of current traits that have been tagged (and the tag not archived) in this study. | def get_non_archived_traits_tagged_count(self):
return apps.get_model('tags', 'TaggedTrait').objects.current().non_archived().filter(
trait__source_dataset__source_study_version__study=self).aggregate(
models.Count('trait', distinct=True))['trait__count'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_traits_tagged_count(self):\n return SourceTrait.objects.filter(\n source_dataset__source_study_version__study=self\n ).current().exclude(all_tags=None).count()",
"def get_archived_traits_tagged_count(self):\n return apps.get_model('tags', 'TaggedTrait').objects.archive... | [
"0.823464",
"0.8140047",
"0.7480824",
"0.7419102",
"0.71749496",
"0.70208025",
"0.6762968",
"0.67440826",
"0.65510833",
"0.6394683",
"0.63454866",
"0.6240015",
"0.6186335",
"0.6186335",
"0.615093",
"0.615016",
"0.6122516",
"0.6041667",
"0.59720755",
"0.5931473",
"0.58819157",... | 0.8264949 | 0 |
Return the most recent SourceStudyVersion linked to this study. | def get_latest_version(self):
try:
version = self.sourcestudyversion_set.filter(
i_is_deprecated=False
).order_by( # We can't use "latest" since it only accepts one field in Django 1.11.
'-i_version',
'-i_date_added'
).first()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_version(self):\n study = self.source_study_version.study\n current_study_version = self.source_study_version.study.get_latest_version()\n if current_study_version is None:\n return None\n # Find the same dataset associated with the current study version.\n ... | [
"0.7559727",
"0.7077481",
"0.6922376",
"0.68969524",
"0.6865629",
"0.6647644",
"0.6573123",
"0.64721805",
"0.6470273",
"0.6398663",
"0.6269095",
"0.6241272",
"0.62055796",
"0.61247975",
"0.61089414",
"0.61071545",
"0.61031723",
"0.6082287",
"0.60816973",
"0.60259306",
"0.5994... | 0.7674174 | 0 |
Return a dbGaP link to the page for the latest SourceStudyVersion. | def get_latest_version_link(self):
return self.get_latest_version().dbgap_link | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_link(self):\n release_link = url_for('data.data', selected_release=self.DATASET_RELEASE)\n return Markup(f\"<a href='{release_link}'>{self.DATASET_RELEASE}</a>\")",
"def set_dbgap_link(self):\n return self.STUDY_VERSION_URL.format(self.full_accession)",
"def get_latest_version(... | [
"0.6841118",
"0.6463157",
"0.6224093",
"0.57410735",
"0.56654507",
"0.5629362",
"0.55557",
"0.5552489",
"0.5513178",
"0.5491778",
"0.54240173",
"0.53660846",
"0.5361276",
"0.53601146",
"0.5352483",
"0.53248584",
"0.52955514",
"0.5282903",
"0.5276562",
"0.5262418",
"0.5259679"... | 0.6467567 | 1 |
Custom save method to autoset full_accession and dbgap_link. | def save(self, *args, **kwargs):
self.full_accession = self.set_full_accession()
self.dbgap_link = self.set_dbgap_link()
super(SourceStudyVersion, self).save(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, *args, **kwargs):\n self.full_accession = self.set_full_accession()\n self.dbgap_link = self.set_dbgap_link()\n super(SourceDataset, self).save(*args, **kwargs)",
"def save(self, *args, **kwargs):\n self.full_accession = self.set_full_accession()\n self.dbgap_lin... | [
"0.73582214",
"0.7209021",
"0.6393143",
"0.6363915",
"0.6306047",
"0.62788814",
"0.5810558",
"0.57993186",
"0.5722098",
"0.57087",
"0.570662",
"0.56933665",
"0.567312",
"0.5658324",
"0.5658324",
"0.56490225",
"0.56343424",
"0.56319344",
"0.56160986",
"0.56087613",
"0.5595003"... | 0.71559155 | 2 |
Automatically set full_accession from the study's phs value. | def set_full_accession(self):
return self.STUDY_VERSION_ACCESSION.format(self.study.phs, self.i_version, self.i_participant_set) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_full_accession(self):\n return self.DATASET_ACCESSION.format(\n self.i_accession, self.i_version, self.source_study_version.i_participant_set)",
"def set_full_accession(self):\n return self.VARIABLE_ACCESSION.format(\n self.i_dbgap_variable_accession, self.i_dbgap_vari... | [
"0.69272184",
"0.6779552",
"0.5763856",
"0.51321983",
"0.50852907",
"0.5062284",
"0.5008536",
"0.49571142",
"0.46755826",
"0.46588916",
"0.46557772",
"0.46504992",
"0.46206248",
"0.45762715",
"0.45750052",
"0.4568539",
"0.4559341",
"0.4549361",
"0.45215124",
"0.44915038",
"0.... | 0.72539365 | 0 |
Automatically set dbgap_link from dbGaP identifier information. | def set_dbgap_link(self):
return self.STUDY_VERSION_URL.format(self.full_accession) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dbgap_link(self):\n return self.VARIABLE_URL.format(\n self.source_dataset.source_study_version.full_accession, self.i_dbgap_variable_accession)",
"def set_dbgap_link(self):\n return self.DATASET_URL.format(self.source_study_version.full_accession, self.i_accession)",
"def upda... | [
"0.59333754",
"0.56734145",
"0.5608507",
"0.55640787",
"0.5480624",
"0.5438552",
"0.5386511",
"0.52137035",
"0.5121944",
"0.49963725",
"0.49718344",
"0.49320933",
"0.4931212",
"0.49076504",
"0.4907363",
"0.48347703",
"0.48316193",
"0.4791243",
"0.4774549",
"0.47308743",
"0.46... | 0.5525023 | 4 |
Return an ordered queryset of previous versions. | def get_previous_versions(self):
return self.study.sourcestudyversion_set.filter(
i_version__lte=self.i_version,
i_date_added__lt=self.i_date_added
).order_by(
'-i_version',
'-i_date_added'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_previous_version(self):\n return self.get_previous_versions().first()",
"def update_previous_all_versions():\n\n # get all the ids\n version_ids = m.meta.Session.query(distinct(tst.TestVersion.id)).filter_by(archived=False).\\\n join('methods').filter_by(short_name='Online').\\\n ... | [
"0.6681544",
"0.65478915",
"0.6312672",
"0.6222891",
"0.6191354",
"0.61462396",
"0.60991406",
"0.5949714",
"0.5930343",
"0.59164745",
"0.58782697",
"0.587286",
"0.5844892",
"0.58411556",
"0.57994163",
"0.57472384",
"0.5726047",
"0.57105625",
"0.5678144",
"0.5673545",
"0.56406... | 0.8416572 | 0 |
Return the previous version of this study. | def get_previous_version(self):
return self.get_previous_versions().first() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_previous_version(self):\n previous_study_version = self.source_dataset.source_study_version.get_previous_version()\n if previous_study_version is not None:\n try:\n previous_trait = SourceTrait.objects.get(\n source_dataset__source_study_version=pr... | [
"0.76663053",
"0.7525812",
"0.7337205",
"0.7286422",
"0.72301817",
"0.71594524",
"0.7139116",
"0.7111315",
"0.710192",
"0.7072759",
"0.7060298",
"0.70384383",
"0.70250046",
"0.69853616",
"0.6982506",
"0.6953244",
"0.69062996",
"0.690354",
"0.6884494",
"0.68721044",
"0.6863742... | 0.85586053 | 0 |
Return a queryset of SourceTraits that are new in this version compared to past versions. | def get_new_sourcetraits(self):
previous_study_version = self.get_previous_version()
SourceTrait = apps.get_model('trait_browser', 'SourceTrait')
if previous_study_version is not None:
qs = SourceTrait.objects.filter(
source_dataset__source_study_version=self
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_previous_versions(self):\n return self.study.sourcestudyversion_set.filter(\n i_version__lte=self.i_version,\n i_date_added__lt=self.i_date_added\n ).order_by(\n '-i_version',\n '-i_date_added'\n )",
"def get_new_sourcedatasets(self):\n ... | [
"0.6562757",
"0.6290495",
"0.6281095",
"0.6281095",
"0.6224384",
"0.61902857",
"0.6117538",
"0.60669696",
"0.59755343",
"0.59755343",
"0.59755343",
"0.59755343",
"0.59755343",
"0.59755343",
"0.59033275",
"0.58881015",
"0.5698667",
"0.5668605",
"0.5618832",
"0.5610577",
"0.560... | 0.7811303 | 0 |
Return a queryset of SourceDatasets that are new in this version compared to past versions. | def get_new_sourcedatasets(self):
previous_study_version = self.get_previous_version()
SourceDataset = apps.get_model('trait_browser', 'SourceDataset')
if previous_study_version is not None:
qs = SourceDataset.objects.filter(source_study_version=self)
# We can probably wr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_previous_versions(self):\n return self.study.sourcestudyversion_set.filter(\n i_version__lte=self.i_version,\n i_date_added__lt=self.i_date_added\n ).order_by(\n '-i_version',\n '-i_date_added'\n )",
"def test_no_deprecated_datasets_in_quer... | [
"0.6738969",
"0.6347704",
"0.6347704",
"0.6347704",
"0.6267281",
"0.6221294",
"0.6144477",
"0.58199567",
"0.58199567",
"0.58199567",
"0.55291677",
"0.5501097",
"0.5491006",
"0.5466397",
"0.5387165",
"0.5362838",
"0.5351967",
"0.5326075",
"0.5303191",
"0.52874905",
"0.528596",... | 0.7908077 | 0 |
Apply tags from traits in the previous version of this Study to traits from this version. | def apply_previous_tags(self, user):
previous_study_version = self.get_previous_version()
if previous_study_version is not None:
SourceTrait = apps.get_model('trait_browser', 'SourceTrait')
TaggedTrait = apps.get_model('tags', 'TaggedTrait')
DCCReview = apps.get_model... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_previous_tags(self, creator):\n TaggedTrait = apps.get_model('tags', 'TaggedTrait')\n DCCReview = apps.get_model('tags', 'DCCReview')\n StudyResponse = apps.get_model('tags', 'StudyResponse')\n previous_trait = self.get_previous_version()\n if previous_trait is not None... | [
"0.67002356",
"0.5798329",
"0.5789118",
"0.5662857",
"0.5602511",
"0.5436931",
"0.53949434",
"0.53218657",
"0.53102833",
"0.52779347",
"0.5261458",
"0.51905525",
"0.5164367",
"0.5156515",
"0.5149465",
"0.51158303",
"0.50836796",
"0.50706464",
"0.5012632",
"0.49430275",
"0.494... | 0.7317276 | 0 |
Custom save method to autoset full_accession and dbgap_link. | def save(self, *args, **kwargs):
self.full_accession = self.set_full_accession()
self.dbgap_link = self.set_dbgap_link()
super(SourceDataset, self).save(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, *args, **kwargs):\n self.full_accession = self.set_full_accession()\n self.dbgap_link = self.set_dbgap_link()\n super(SourceTrait, self).save(*args, **kwargs)",
"def save(self, *args, **kwargs):\n self.full_accession = self.set_full_accession()\n self.dbgap_link ... | [
"0.7209021",
"0.71559155",
"0.6393143",
"0.6363915",
"0.6306047",
"0.62788814",
"0.5810558",
"0.57993186",
"0.5722098",
"0.57087",
"0.570662",
"0.56933665",
"0.567312",
"0.5658324",
"0.5658324",
"0.56490225",
"0.56343424",
"0.56319344",
"0.56160986",
"0.56087613",
"0.5595003"... | 0.73582214 | 0 |
Gets the absolute URL of the detail page for a given SourceDataset instance. | def get_absolute_url(self):
return reverse('trait_browser:source:datasets:detail', kwargs={'pk': self.pk}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n\t\treturn reverse('source-detail', args=[str(self.id)])",
"def get_absolute_url(self):\n return reverse('trait_browser:source:studies:pk:detail', kwargs={'pk': self.pk})",
"def get_absolute_url(self):\n return ('publication_detail', (), {'slug': self.slug})",
"def ... | [
"0.7320892",
"0.71635264",
"0.6769658",
"0.66936725",
"0.6665065",
"0.66157633",
"0.66050607",
"0.658594",
"0.65774614",
"0.65592086",
"0.6530993",
"0.6519312",
"0.6510253",
"0.65062296",
"0.65050864",
"0.64783823",
"0.64783823",
"0.6441861",
"0.6411554",
"0.6410512",
"0.6402... | 0.75452507 | 0 |
Automatically set full_accession from the dataset's dbGaP identifiers. | def set_full_accession(self):
return self.DATASET_ACCESSION.format(
self.i_accession, self.i_version, self.source_study_version.i_participant_set) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_full_accession(self):\n return self.VARIABLE_ACCESSION.format(\n self.i_dbgap_variable_accession, self.i_dbgap_variable_version,\n self.source_dataset.source_study_version.i_participant_set)",
"def set_full_accession(self):\n return self.STUDY_VERSION_ACCESSION.format(... | [
"0.69682556",
"0.6225129",
"0.5945919",
"0.54449517",
"0.5160533",
"0.5116956",
"0.5025976",
"0.49088228",
"0.47938767",
"0.47933",
"0.4758362",
"0.47100648",
"0.4704993",
"0.46769676",
"0.4670057",
"0.46583503",
"0.46069586",
"0.46018344",
"0.45937777",
"0.45649543",
"0.4514... | 0.72782624 | 0 |
Automatically set dbgap_link from dbGaP identifier information. | def set_dbgap_link(self):
return self.DATASET_URL.format(self.source_study_version.full_accession, self.i_accession) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dbgap_link(self):\n return self.VARIABLE_URL.format(\n self.source_dataset.source_study_version.full_accession, self.i_dbgap_variable_accession)",
"def update_gpdbid_file(array):\n \n standby_datadir = os.path.normpath(array.standbyMaster.getSegmentDataDirectory())\n\n # MPP-13... | [
"0.59333754",
"0.5608507",
"0.55640787",
"0.5525023",
"0.5480624",
"0.5438552",
"0.5386511",
"0.52137035",
"0.5121944",
"0.49963725",
"0.49718344",
"0.49320933",
"0.4931212",
"0.49076504",
"0.4907363",
"0.48347703",
"0.48316193",
"0.4791243",
"0.4774549",
"0.47308743",
"0.469... | 0.56734145 | 1 |
Get html for the dataset name linked to the dataset's detail page, with description as popover. | def get_name_link_html(self, max_popover_words=80):
if not self.i_dbgap_description:
description = '—'
else:
description = Truncator(self.i_dbgap_description).words(max_popover_words)
return POPOVER_URL_HTML.format(url=self.get_absolute_url(), popover=description,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataset_details(name, analyst):\n\n template = None\n allowed_sources = user_sources(analyst)\n dataset_object = Dataset.objects(name = name,\n source__name__in=allowed_sources).first()\n if not dataset_object:\n error = (\"Either no data exists for this dataset... | [
"0.6402002",
"0.6215334",
"0.6196248",
"0.6154834",
"0.5915565",
"0.58727175",
"0.5843847",
"0.5768029",
"0.57574415",
"0.57549495",
"0.57196856",
"0.57194483",
"0.5701436",
"0.56974375",
"0.5693088",
"0.5690996",
"0.5678522",
"0.5666621",
"0.5646503",
"0.56364393",
"0.562901... | 0.67517895 | 0 |
Find the most recent version of this dataset. | def get_latest_version(self):
study = self.source_study_version.study
current_study_version = self.source_study_version.study.get_latest_version()
if current_study_version is None:
return None
# Find the same dataset associated with the current study version.
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_version(self):\n version = self.get_current_version()\n\n # read the recent file list\n if version is None:\n version = self.get_version_from_recent_files()\n\n return version",
"def get_latest_version(self):\n try:\n version = self.sourcestud... | [
"0.72924036",
"0.7165979",
"0.7094863",
"0.689178",
"0.68007094",
"0.67894995",
"0.6763486",
"0.67255384",
"0.67026746",
"0.6646939",
"0.66431236",
"0.66066355",
"0.6586733",
"0.658399",
"0.6573558",
"0.6563115",
"0.6465068",
"0.64497256",
"0.6445124",
"0.64347154",
"0.640898... | 0.789287 | 0 |
Gets a list of trait_flavor_names for harmonized traits in this trait set version. | def get_trait_names(self):
return self.harmonizedtrait_set.values_list('trait_flavor_name', flat=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_trait_flavor_name(self):\n return '{}_{}'.format(self.i_trait_name, self.harmonized_trait_set_version.harmonized_trait_set.i_flavor)",
"def all_trait_names ( self ):\n return self.__class_traits__.keys()",
"def trait_names ( self, **metadata ):\n return self.traits( **metadata ).ke... | [
"0.67714554",
"0.6423445",
"0.62995416",
"0.6120722",
"0.60873955",
"0.5738161",
"0.5715752",
"0.57114977",
"0.5705768",
"0.56979",
"0.56829286",
"0.564801",
"0.5582354",
"0.55700886",
"0.5551664",
"0.5513089",
"0.54857224",
"0.54564124",
"0.5443423",
"0.5440488",
"0.54381365... | 0.8556329 | 0 |
Get html for component traits, in panels by harmonization unit and harmonized trait. | def get_component_html(self):
return '\n'.join([hunit.get_component_html() for hunit in self.harmonizationunit_set.all()]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component_html(self):\n study_list = '\\n'.join([study.get_name_link_html() for study in self.get_source_studies()])\n age_list = '\\n'.join([trait.get_name_link_html() for trait in self.component_age_traits.all()])\n component_html = '\\n'.join([\n trait.get_component_html(... | [
"0.75004405",
"0.70377713",
"0.54875576",
"0.5482249",
"0.5458651",
"0.52498436",
"0.5206607",
"0.5192135",
"0.51305157",
"0.51200366",
"0.50843626",
"0.50515443",
"0.50131196",
"0.4975536",
"0.4961757",
"0.49572256",
"0.49349296",
"0.49261338",
"0.49246195",
"0.4895742",
"0.... | 0.6926201 | 2 |
Gets the absolute URL of the detail page for a given HarmonizedTraitSet instance. | def get_absolute_url(self):
return reverse('trait_browser:harmonized:traits:detail', kwargs={'pk': self.pk}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n return self.harmonized_trait_set_version.get_absolute_url()",
"def get_absolute_url(self):\n return reverse('trait_browser:source:traits:detail', kwargs={'pk': self.pk})",
"def get_absolute_url(self):\n return reverse('trait_browser:source:studies:pk:detail', ... | [
"0.72508293",
"0.70623827",
"0.6548072",
"0.64680207",
"0.59867966",
"0.59867966",
"0.59520835",
"0.59289813",
"0.592246",
"0.5918289",
"0.58953965",
"0.58434725",
"0.5838052",
"0.5814749",
"0.57711065",
"0.57669204",
"0.57653147",
"0.575038",
"0.57430536",
"0.5742923",
"0.57... | 0.7418204 | 0 |
Get a queryset of all the SourceTraits components for this harmonization unit (age, batch, or source). | def get_all_source_traits(self):
return self.component_source_traits.all() | self.component_batch_traits.all() | self.component_age_traits.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_sourcetraits(self):\n previous_study_version = self.get_previous_version()\n SourceTrait = apps.get_model('trait_browser', 'SourceTrait')\n if previous_study_version is not None:\n qs = SourceTrait.objects.filter(\n source_dataset__source_study_version=sel... | [
"0.6352468",
"0.60128826",
"0.57998437",
"0.56801885",
"0.5599534",
"0.5557096",
"0.5557096",
"0.52780604",
"0.52433515",
"0.5181923",
"0.5181923",
"0.5181923",
"0.5181923",
"0.5181923",
"0.5181923",
"0.5181923",
"0.5181923",
"0.5181923",
"0.49282494",
"0.49022794",
"0.490198... | 0.71494865 | 0 |
Get a list containing all of the studies linked to component traits for this unit. | def get_source_studies(self):
return list(set([trait.source_dataset.source_study_version.study for trait in self.get_all_source_traits()])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def studies(self):\n return self._study_queryset",
"def get_all_tagged_traits(self):\n return apps.get_model('tags', 'TaggedTrait').objects.filter(\n trait__source_dataset__source_study_version__study=self,\n ).current()",
"def orthanc_studies(self):\n return [orthanc.stu... | [
"0.6521775",
"0.631228",
"0.6173921",
"0.5707282",
"0.5669657",
"0.5585801",
"0.557777",
"0.5572094",
"0.5565817",
"0.5506995",
"0.5487372",
"0.54773843",
"0.5472401",
"0.5445943",
"0.5405772",
"0.53850967",
"0.537402",
"0.53681386",
"0.53642213",
"0.5360461",
"0.53498906",
... | 0.66928583 | 0 |
Get html for a panel of component traits for the harmonization unit. Includes an inline list of included studies if applicable. | def get_component_html(self):
study_list = '\n'.join([study.get_name_link_html() for study in self.get_source_studies()])
age_list = '\n'.join([trait.get_name_link_html() for trait in self.component_age_traits.all()])
component_html = '\n'.join([
trait.get_component_html(harmonizatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component_html(self, harmonization_unit):\n source = [tr.get_name_link_html() for tr in (\n self.component_source_traits.all() & harmonization_unit.component_source_traits.all())]\n harmonized_trait_set_versions = [trait_set_version for trait_set_version in (\n self.comp... | [
"0.73980016",
"0.71138966",
"0.5560296",
"0.5343086",
"0.5249588",
"0.5139348",
"0.51112926",
"0.5068411",
"0.5066079",
"0.5065291",
"0.4935733",
"0.48982418",
"0.48671803",
"0.48227435",
"0.4816911",
"0.47910064",
"0.47818005",
"0.47653103",
"0.47544286",
"0.47376806",
"0.46... | 0.8093886 | 0 |
Pretty printing of SourceTrait objects. | def __str__(self):
return '{trait_name} ({phv}): dataset {pht}'.format(trait_name=self.i_trait_name,
phv=self.full_accession,
pht=self.source_dataset.full_accession) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump(self):\n outputs = [\"Code object : %s\" % self.name]\n outputs.append(\" Type : %s\" % self.object_type)\n for source_line in self.source:\n # Each line is a (line_number, code) pair\n outputs.append('%d: %s' % source_line)\n return \"\".join(outputs)",
... | [
"0.60505056",
"0.6029232",
"0.58964765",
"0.5857656",
"0.57326186",
"0.571953",
"0.5682614",
"0.5619173",
"0.5597114",
"0.55387765",
"0.55296856",
"0.55260795",
"0.550827",
"0.55069834",
"0.550047",
"0.5474934",
"0.54651344",
"0.54585516",
"0.54190594",
"0.5414919",
"0.539751... | 0.5528177 | 11 |
Custom save method to autoset full_accession and dbgap_link. | def save(self, *args, **kwargs):
self.full_accession = self.set_full_accession()
self.dbgap_link = self.set_dbgap_link()
super(SourceTrait, self).save(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, *args, **kwargs):\n self.full_accession = self.set_full_accession()\n self.dbgap_link = self.set_dbgap_link()\n super(SourceDataset, self).save(*args, **kwargs)",
"def save(self, *args, **kwargs):\n self.full_accession = self.set_full_accession()\n self.dbgap_lin... | [
"0.73582214",
"0.71559155",
"0.6393143",
"0.6363915",
"0.6306047",
"0.62788814",
"0.5810558",
"0.57993186",
"0.5722098",
"0.57087",
"0.570662",
"0.56933665",
"0.567312",
"0.5658324",
"0.5658324",
"0.56490225",
"0.56343424",
"0.56319344",
"0.56160986",
"0.56087613",
"0.5595003... | 0.7209021 | 1 |
Automatically set full_accession from the variable's dbGaP identifiers. | def set_full_accession(self):
return self.VARIABLE_ACCESSION.format(
self.i_dbgap_variable_accession, self.i_dbgap_variable_version,
self.source_dataset.source_study_version.i_participant_set) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_full_accession(self):\n return self.DATASET_ACCESSION.format(\n self.i_accession, self.i_version, self.source_study_version.i_participant_set)",
"def set_full_accession(self):\n return self.STUDY_VERSION_ACCESSION.format(self.study.phs, self.i_version, self.i_participant_set)",
... | [
"0.66088516",
"0.6157562",
"0.53482604",
"0.5188747",
"0.51160794",
"0.5022504",
"0.50135124",
"0.49394724",
"0.49343747",
"0.48210892",
"0.47820124",
"0.4719237",
"0.4669664",
"0.4625832",
"0.46101683",
"0.4575124",
"0.45396692",
"0.45073032",
"0.45045888",
"0.4492379",
"0.4... | 0.722903 | 0 |
Automatically set dbgap_link from dbGaP identifier information. | def set_dbgap_link(self):
return self.VARIABLE_URL.format(
self.source_dataset.source_study_version.full_accession, self.i_dbgap_variable_accession) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dbgap_link(self):\n return self.DATASET_URL.format(self.source_study_version.full_accession, self.i_accession)",
"def update_gpdbid_file(array):\n \n standby_datadir = os.path.normpath(array.standbyMaster.getSegmentDataDirectory())\n\n # MPP-13245, use single mechanism to manage gp_dbid f... | [
"0.56734145",
"0.5608507",
"0.55640787",
"0.5525023",
"0.5480624",
"0.5438552",
"0.5386511",
"0.52137035",
"0.5121944",
"0.49963725",
"0.49718344",
"0.49320933",
"0.4931212",
"0.49076504",
"0.4907363",
"0.48347703",
"0.48316193",
"0.4791243",
"0.4774549",
"0.47308743",
"0.469... | 0.59333754 | 0 |
Gets the absolute URL of the detail page for a given SourceTrait instance. | def get_absolute_url(self):
return reverse('trait_browser:source:traits:detail', kwargs={'pk': self.pk}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n\t\treturn reverse('source-detail', args=[str(self.id)])",
"def get_absolute_url(self):\n return reverse('trait_browser:source:studies:pk:detail', kwargs={'pk': self.pk})",
"def get_absolute_url(self):\n return reverse('trait_browser:harmonized:traits:detail', kwargs=... | [
"0.7119291",
"0.7097896",
"0.6950301",
"0.6894759",
"0.6431965",
"0.63921607",
"0.636551",
"0.635845",
"0.62975645",
"0.62486935",
"0.6246613",
"0.62231576",
"0.6212547",
"0.6189846",
"0.6181484",
"0.6181484",
"0.61728066",
"0.6160209",
"0.6159289",
"0.615591",
"0.6154543",
... | 0.7710777 | 0 |
Return queryset of archived tags linked to this trait. | def archived_tags(self):
archived_tagged_traits = apps.get_model('tags', 'TaggedTrait').objects.archived().filter(trait=self)
return apps.get_model('tags', 'Tag').objects.filter(
pk__in=archived_tagged_traits.values_list('tag__pk', flat=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_archived_tags(self):\n non_archived_tagged_traits = apps.get_model('tags', 'TaggedTrait').objects.non_archived().filter(trait=self)\n return apps.get_model('tags', 'Tag').objects.filter(\n pk__in=non_archived_tagged_traits.values_list('tag__pk', flat=True))",
"def get_archived_ta... | [
"0.7533448",
"0.74357784",
"0.6842906",
"0.6513351",
"0.6450949",
"0.63617426",
"0.6330386",
"0.630018",
"0.6280889",
"0.62478477",
"0.6202606",
"0.610521",
"0.60856485",
"0.6033715",
"0.60267216",
"0.60267216",
"0.60267216",
"0.60267216",
"0.60267216",
"0.60267216",
"0.60267... | 0.8736017 | 0 |
Return queryset of nonarchived tags linked to this trait. | def non_archived_tags(self):
non_archived_tagged_traits = apps.get_model('tags', 'TaggedTrait').objects.non_archived().filter(trait=self)
return apps.get_model('tags', 'Tag').objects.filter(
pk__in=non_archived_tagged_traits.values_list('tag__pk', flat=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_non_archived_tagged_traits(self):\n return apps.get_model('tags', 'TaggedTrait').objects.current().non_archived().filter(\n trait__source_dataset__source_study_version__study=self)",
"def archived_tags(self):\n archived_tagged_traits = apps.get_model('tags', 'TaggedTrait').object... | [
"0.80429226",
"0.7348492",
"0.6551791",
"0.6469715",
"0.64208716",
"0.63318914",
"0.63318914",
"0.6299178",
"0.6227882",
"0.6208177",
"0.6100119",
"0.6100119",
"0.6100119",
"0.6100119",
"0.6100119",
"0.6100119",
"0.6100119",
"0.6100119",
"0.60505265",
"0.60505265",
"0.6050489... | 0.8711702 | 0 |
Get html for the trait name linked to the trait's detail page, with description as popover. | def get_name_link_html(self, max_popover_words=80):
if not self.i_description:
description = '—'
else:
description = Truncator(self.i_description).words(max_popover_words)
return POPOVER_URL_HTML.format(url=self.get_absolute_url(), popover=description,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name_link_html(self, max_popover_words=80):\n url_text = \"{{% url 'trait_browser:harmonized:traits:detail' pk={} %}} \".format(\n self.harmonized_trait_set_version.pk)\n if not self.i_description:\n description = '—'\n else:\n description = Trunc... | [
"0.7173213",
"0.5908587",
"0.58575296",
"0.58464485",
"0.57854205",
"0.5763104",
"0.5562001",
"0.55412966",
"0.5497627",
"0.54678494",
"0.5463515",
"0.5406294",
"0.5376284",
"0.5343716",
"0.5327474",
"0.5324101",
"0.5305742",
"0.5296317",
"0.5279121",
"0.5275096",
"0.52688044... | 0.64885026 | 1 |
Return the most recent version of a trait. | def get_latest_version(self):
current_study_version = self.source_dataset.source_study_version.study.get_latest_version()
if current_study_version is None:
return None
# Find the same trait associated with the current study version.
try:
current_trait = SourceTrai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_version(self):\n from leonardo_system.pip import check_versions\n return check_versions(True).get(self.name, None).get('new', None)",
"def latest_version(self):\n state = self.coordinator.data\n\n try:\n # fake a new update\n # return \"foobar\"\n ... | [
"0.6343139",
"0.6289052",
"0.61462194",
"0.605551",
"0.6044234",
"0.5944283",
"0.59256196",
"0.589782",
"0.578745",
"0.5734667",
"0.56906104",
"0.5669337",
"0.5609379",
"0.5605236",
"0.55892533",
"0.5564086",
"0.555119",
"0.5531066",
"0.5506513",
"0.5503882",
"0.549832",
"0... | 0.7126002 | 0 |
Returns the version of this SourceTrait from the previous study version. | def get_previous_version(self):
previous_study_version = self.source_dataset.source_study_version.get_previous_version()
if previous_study_version is not None:
try:
previous_trait = SourceTrait.objects.get(
source_dataset__source_study_version=previous_stu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_latest_version(self):\n current_study_version = self.source_dataset.source_study_version.study.get_latest_version()\n if current_study_version is None:\n return None\n # Find the same trait associated with the current study version.\n try:\n current_trait =... | [
"0.7203941",
"0.7022413",
"0.6539211",
"0.6528101",
"0.64088005",
"0.64069474",
"0.6406507",
"0.6177494",
"0.6143733",
"0.6135707",
"0.6052708",
"0.60357195",
"0.5994113",
"0.5994113",
"0.5989174",
"0.5963759",
"0.5963759",
"0.5963759",
"0.5963759",
"0.5931803",
"0.5931803",
... | 0.84758323 | 0 |
Apply tags from the previous version of this SourceTrait to this version. | def apply_previous_tags(self, creator):
TaggedTrait = apps.get_model('tags', 'TaggedTrait')
DCCReview = apps.get_model('tags', 'DCCReview')
StudyResponse = apps.get_model('tags', 'StudyResponse')
previous_trait = self.get_previous_version()
if previous_trait is not None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_previous_tags(self, user):\n previous_study_version = self.get_previous_version()\n if previous_study_version is not None:\n SourceTrait = apps.get_model('trait_browser', 'SourceTrait')\n TaggedTrait = apps.get_model('tags', 'TaggedTrait')\n DCCReview = apps... | [
"0.67532045",
"0.560491",
"0.53911746",
"0.5234013",
"0.5228578",
"0.5195925",
"0.5186795",
"0.51826936",
"0.51673084",
"0.51250494",
"0.5079544",
"0.5074929",
"0.50660247",
"0.49464282",
"0.4945864",
"0.49275744",
"0.49202943",
"0.4895651",
"0.48858866",
"0.48719358",
"0.486... | 0.61335063 | 1 |
Custom save method for making the trait flavor name. Automatically sets the value for the harmonized trait's trait_flavor_name. | def save(self, *args, **kwargs):
self.trait_flavor_name = self.set_trait_flavor_name()
# Call the "real" save method.
super(HarmonizedTrait, self).save(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_trait_flavor_name(self):\n return '{}_{}'.format(self.i_trait_name, self.harmonized_trait_set_version.harmonized_trait_set.i_flavor)",
"def save(self, *args, **kwargs):\n self.name = unique_slugify(\n self.name,\n instance=self,\n queryset=AccountTeam.object... | [
"0.7468916",
"0.55278254",
"0.5415232",
"0.51928246",
"0.5119848",
"0.511083",
"0.5096135",
"0.5090444",
"0.5069976",
"0.5035967",
"0.50008094",
"0.49549702",
"0.49256065",
"0.4919068",
"0.49156654",
"0.48997",
"0.48877004",
"0.48810652",
"0.48521546",
"0.4827719",
"0.4825961... | 0.86165404 | 0 |
Automatically set trait_flavor_name from the trait's i_trait_name and the trait set's flavor name. Properly format the trait_flavor_name for this harmonized trait so that it's available for easy use later. | def set_trait_flavor_name(self):
return '{}_{}'.format(self.i_trait_name, self.harmonized_trait_set_version.harmonized_trait_set.i_flavor) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, *args, **kwargs):\n self.trait_flavor_name = self.set_trait_flavor_name()\n # Call the \"real\" save method.\n super(HarmonizedTrait, self).save(*args, **kwargs)",
"def get_trait_names(self):\n return self.harmonizedtrait_set.values_list('trait_flavor_name', flat=True)"... | [
"0.6485175",
"0.572448",
"0.52455056",
"0.5239741",
"0.5102045",
"0.50971866",
"0.5092614",
"0.5031202",
"0.50118196",
"0.49256253",
"0.48779806",
"0.48407742",
"0.47497308",
"0.47167596",
"0.4700613",
"0.46749374",
"0.46679375",
"0.4615291",
"0.45903933",
"0.4571786",
"0.455... | 0.85946906 | 0 |
Gets the absolute URL of the detail page for a given HarmonizedTrait instance. In this special case, goes to the detail page for the related trait set. | def get_absolute_url(self):
return self.harmonized_trait_set_version.get_absolute_url() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_absolute_url(self):\n return reverse('trait_browser:harmonized:traits:detail', kwargs={'pk': self.pk})",
"def get_absolute_url(self):\n return reverse('trait_browser:source:traits:detail', kwargs={'pk': self.pk})",
"def get_absolute_url(self):\n return reverse('trait_browser:source... | [
"0.76464415",
"0.71848196",
"0.64087236",
"0.62061286",
"0.6132978",
"0.61097914",
"0.6106136",
"0.6106136",
"0.6096563",
"0.6088155",
"0.60717404",
"0.59662586",
"0.5956779",
"0.59459764",
"0.593614",
"0.5929176",
"0.5916748",
"0.5908745",
"0.5904925",
"0.58962184",
"0.58962... | 0.6393083 | 3 |
Get html for the trait name linked to the harmonized trait's detail page, with description as popover. | def get_name_link_html(self, max_popover_words=80):
url_text = "{{% url 'trait_browser:harmonized:traits:detail' pk={} %}} ".format(
self.harmonized_trait_set_version.pk)
if not self.i_description:
description = '—'
else:
description = Truncator(self.i_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name_link_html(self, max_popover_words=80):\n if not self.i_description:\n description = '—'\n else:\n description = Truncator(self.i_description).words(max_popover_words)\n return POPOVER_URL_HTML.format(url=self.get_absolute_url(), popover=description,\n ... | [
"0.65362686",
"0.5995364",
"0.5972799",
"0.5874273",
"0.58588713",
"0.582794",
"0.58238804",
"0.56961626",
"0.5597435",
"0.55740833",
"0.5513988",
"0.5506095",
"0.5495636",
"0.549422",
"0.5491055",
"0.54814446",
"0.5465395",
"0.54473466",
"0.5423525",
"0.54104114",
"0.5383758... | 0.73566204 | 0 |
Get html for inline lists of source and harmonized component phenotypes for the harmonized trait. | def get_component_html(self, harmonization_unit):
source = [tr.get_name_link_html() for tr in (
self.component_source_traits.all() & harmonization_unit.component_source_traits.all())]
harmonized_trait_set_versions = [trait_set_version for trait_set_version in (
self.component_har... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component_html(self):\n return '\\n'.join([hunit.get_component_html() for hunit in self.harmonizationunit_set.all()])",
"def get_component_html(self):\n study_list = '\\n'.join([study.get_name_link_html() for study in self.get_source_studies()])\n age_list = '\\n'.join([trait.get_nam... | [
"0.70497555",
"0.69843435",
"0.5943376",
"0.59310067",
"0.5700649",
"0.5586195",
"0.5549065",
"0.5441129",
"0.5421613",
"0.54212123",
"0.54004914",
"0.5393318",
"0.53882074",
"0.53824496",
"0.5381582",
"0.5377059",
"0.5372054",
"0.53646225",
"0.53409606",
"0.53304595",
"0.531... | 0.707962 | 0 |
Pretty printing of HarmonizedTraitEncodedValue objects. | def __str__(self):
return 'encoded value {} for {}\nvalue = {}'.format(self.i_category, self.harmonized_trait, self.i_value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pprint(self):\r\n for i in self.items():\r\n print '%s => %r'%i",
"def pprint(self):\n\t\tPrettyPrintUnicode().pprint(self.data)",
"def PrettyPrint(self):\r\n print(self.data)\r\n return",
"def __str__(self):\n return '\\n'+'\\n'.join([\"%-15s: %s\" % (qq(w), str(v)... | [
"0.64984983",
"0.62469554",
"0.6195777",
"0.61902934",
"0.6169539",
"0.6151282",
"0.6125573",
"0.6070319",
"0.6042068",
"0.6039289",
"0.6027863",
"0.597896",
"0.5963519",
"0.59448206",
"0.59373057",
"0.59328187",
"0.5917587",
"0.5878207",
"0.58527887",
"0.585157",
"0.58463466... | 0.70111173 | 0 |
construct the gan nets | def __init__(self, generator, discriminator, noise_dim, save_path):
self.generator = generator
self.discriminator = discriminator
self.noise_dim = noise_dim
self.save_path = save_path
self.check_points_path = os.path.join(save_path, 'check_points')
self.output_image_path ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_net(nz=100):\n\tif opts.celeba:\n\t\tgen = get_gen_celebA(nz=nz)\n\t\tdis = get_dis_celebA(nz=nz)\n\n\tif opts.mnist:\n\t\tgen = get_gen_mnist(nz=nz)\n\t\tdis = get_dis_mnist(nz=nz)\n\n\treturn gen, dis",
"def build_net(nz=100):\n\tif opts.celeba:\n\t\tinput_gen, gen = get_bigan_gen_celebA(nz = nz)\n\t... | [
"0.73574686",
"0.71291894",
"0.7068094",
"0.69769394",
"0.6693575",
"0.664224",
"0.6635808",
"0.6570795",
"0.6456566",
"0.6433498",
"0.6331582",
"0.6329371",
"0.63155353",
"0.6283213",
"0.62759465",
"0.6244422",
"0.61727893",
"0.6164598",
"0.61465764",
"0.61280817",
"0.611882... | 0.0 | -1 |
start training and save models | def train(self, dataset, batch_size, epochs, algorithm,
discriminator_training_loop, discriminator_optimizer, generator_optimizer,
images_per_row, continue_training=False, inception_score=False):
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
compone... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train(self):\n self.epoch = 0\n self.step = 0\n self.start_time = time.time()\n for self.epoch in range(self.opt.num_epochs):\n self.run_epoch()\n if (self.epoch + 1) % self.opt.save_frequency == 0:\n self.save_model()",
"def train(self):\n ... | [
"0.83097243",
"0.81837803",
"0.81129706",
"0.7997005",
"0.79127514",
"0.7864483",
"0.77565855",
"0.7608207",
"0.7597609",
"0.7541524",
"0.74920756",
"0.7389706",
"0.7369859",
"0.7335076",
"0.72997665",
"0.7297261",
"0.7280751",
"0.7272683",
"0.72139543",
"0.71695447",
"0.7141... | 0.0 | -1 |
generate images using the latest saved check points and the images will be saved in 'save_path/images/' | def generate_image(noise_list, save_path):
check_points_path = os.path.join(save_path, 'check_points')
output_image_path = os.path.join(save_path, 'images')
components.create_folder(output_image_path, False)
latest_checkpoint = tf.train.latest_checkpoint(check_points_path)
assert... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_img(self):\r\n self.extract_info_from_file()\r\n path_0 = os.path.join(self.output_path, self.field_id, self.patient_id + self.ext)\r\n path_1 = os.path.join(self.output_path, self.field_id + '_' + self.instance, self.patient_id + self.ext)\r\n if self.shot == '0': # first sho... | [
"0.711237",
"0.67032856",
"0.6631163",
"0.6493553",
"0.6490636",
"0.64827114",
"0.64728135",
"0.64322054",
"0.64124805",
"0.64074713",
"0.63913244",
"0.63624316",
"0.63335747",
"0.6307022",
"0.630442",
"0.62582576",
"0.62520474",
"0.6236078",
"0.6206135",
"0.6205042",
"0.6150... | 0.71468616 | 0 |
Get html and text templates for emails | def get_templates(self, template_name, **kwargs):
html = render_template("{template}.html".format(template=template_name), **kwargs)
text = render_template("{template}.txt".format(template=template_name), **kwargs)
return html, text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_mail_template(request, issue, full_diff=False):\n context = {}\n template = 'mails/comment.txt'\n if request.user == issue.owner:\n query = models.Message.query(\n models.Message.sender == request.user.email(), ancestor=issue.key)\n if query.count(1) == 0:\n template = 'mails/review.t... | [
"0.68286717",
"0.67967486",
"0.6495276",
"0.6431159",
"0.6386001",
"0.6278794",
"0.6275666",
"0.6215126",
"0.61568344",
"0.6130036",
"0.6121335",
"0.60818094",
"0.6071741",
"0.60698164",
"0.6057962",
"0.6044899",
"0.6044858",
"0.6043684",
"0.60387933",
"0.6032939",
"0.6031323... | 0.644731 | 3 |
Build personalization instance from a dict | def create_personalization(self, **kwargs):
personalization = Personalization()
_diff = set(emailconf.PERSONALIZATION_KEYS).intersection(set(kwargs.keys()))
if _diff:
for key in _diff:
item = kwargs.get(key)
if item:
if key in email... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls, dictionary):\n return cls(**dictionary)",
"def create(cls, dictionary):\n return cls(**dictionary)",
"def build_personalization(personalization):\n mock_personalization = Personalization()\n for to_addr in personalization['to_list']:\n personalization.add_to(to_addr)\... | [
"0.63244694",
"0.63244694",
"0.6232753",
"0.6030198",
"0.5900351",
"0.58583313",
"0.5845706",
"0.58420676",
"0.58329755",
"0.5826959",
"0.58106136",
"0.579965",
"0.5711809",
"0.57004213",
"0.57004213",
"0.57004213",
"0.57004213",
"0.57004213",
"0.57004213",
"0.57004213",
"0.5... | 0.6677979 | 0 |
Get message object for email | def get_message(self, **kwargs):
message = Mail()
if "from_email" in kwargs:
sender = Email()
message_content = kwargs.get("message_content", "")
sender.name = message_content.get("sender", emailconf.DEFAULT_SENDER)
sender.email = kwargs.get("from_email", ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_message(obj):\n if isinstance(obj, email.Message.Message):\n return obj\n if hasattr(obj, \"read\"):\n obj = obj.read()\n try:\n msg = email.message_from_string(obj)\n except email.Errors.MessageParseError:\n msg = None\n return msg",
"def get_message(self, emai... | [
"0.81638974",
"0.73664725",
"0.727265",
"0.70660275",
"0.70523316",
"0.7026484",
"0.69540864",
"0.69446623",
"0.6911165",
"0.6865885",
"0.68581146",
"0.6838314",
"0.6807621",
"0.67979205",
"0.67979205",
"0.67596495",
"0.67257774",
"0.67173916",
"0.6697638",
"0.66749895",
"0.6... | 0.7179712 | 3 |
Send message to receiver via gateway | def send_message(self, message):
try:
msg = sg.client.mail.send.post(request_body=message)
app.logger.info("{error} with {response}".format(error=msg.status_code, response=msg.body))
app.logger.info("Successfully sent message: {msg}".format(msg=msg))
except Exception ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(self, message):\n pass",
"def send(self, msg):\n self.message('Me', msg)",
"def send_message(message, destination):\n\n #Your code here\n pass",
"def send(self, response):\n self.mh.send_message(response)",
"def send(self, msg):\n pass",
"def send(self, msg):\n p... | [
"0.6986188",
"0.6879321",
"0.68774897",
"0.6874424",
"0.68134725",
"0.68134725",
"0.68134725",
"0.6764438",
"0.67448246",
"0.67113894",
"0.66773957",
"0.6648835",
"0.6641105",
"0.6636179",
"0.6608425",
"0.6595972",
"0.6537428",
"0.6510587",
"0.6510233",
"0.6495874",
"0.649058... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.