query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Test the correct errors are raised if Biopython is not available. | def test_config_no_biopython(monkeypatch):
monkeypatch.setattr(core, 'HAVE_BIOPYTHON', False)
assert core.HAVE_BIOPYTHON is False
args = Namespace(extended_validation='all')
with pytest.raises(ValueError):
core.Config.from_args(args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_config_have_biopython():\n assert core.HAVE_BIOPYTHON\n args = Namespace(extended_validation='all')\n config = core.Config.from_args(args)\n assert config.extended_validation == 'all'",
"def test_fastqc_notexec():\n try:\n obj = fastqc.FastQC(\"LICENSE\")\n except NotExecutableE... | [
"0.60472417",
"0.59132737",
"0.5679767",
"0.55962723",
"0.55735046",
"0.55669904",
"0.5553229",
"0.5509644",
"0.5472223",
"0.54605126",
"0.5453642",
"0.5441282",
"0.54319507",
"0.5415938",
"0.5410456",
"0.5409874",
"0.53916454",
"0.53776276",
"0.53769064",
"0.5348316",
"0.534... | 0.62092185 | 0 |
Test we detect Biopython. | def test_config_have_biopython():
assert core.HAVE_BIOPYTHON
args = Namespace(extended_validation='all')
config = core.Config.from_args(args)
assert config.extended_validation == 'all' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect():\n pass",
"def _detect(self):\n return True",
"def testIsBiconnected(self):\n self.assertEqual(is_biconnected(self.G1), True)\n self.assertEqual(is_biconnected(self.G2), False)",
"def should_build_ib():\n ib_util_found = False\n ib_lib_found = False\n ib_head... | [
"0.60462487",
"0.5662381",
"0.55574375",
"0.55203646",
"0.5468003",
"0.54534155",
"0.53503704",
"0.53503704",
"0.5321535",
"0.52881396",
"0.52752477",
"0.52368546",
"0.52000886",
"0.5146673",
"0.5136819",
"0.51240057",
"0.509844",
"0.50787854",
"0.50721985",
"0.50653446",
"0.... | 0.5940255 | 1 |
Test appending multiple downloads into a single file. | def test_download_to_file_append(req, tmpdir):
req.get(ENTREZ_URL, text='This works.\n')
outdir = tmpdir.mkdir('outdir')
filename = outdir.join('foo.txt')
expected = outdir.join('foo.txt')
config = core.Config(molecule='nucleotide', verbose=False, out='foo.txt')
core.download_to_file('FOO', con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_download1(self):\n pass",
"def test_download2(self):\n pass",
"def download_files(self):",
"def download(all):\n print(\"Downloading\")",
"def test_download(self):\n pass",
"def downloader(urls, path):\n counter = 1\n for media_file in urls:\n # Create the fi... | [
"0.6777141",
"0.6730461",
"0.6622148",
"0.64797187",
"0.6425932",
"0.63330853",
"0.6318154",
"0.62658906",
"0.62465984",
"0.61807144",
"0.61734396",
"0.61005056",
"0.6097292",
"0.60680044",
"0.60422486",
"0.60179025",
"0.598955",
"0.59725004",
"0.5953696",
"0.5926606",
"0.591... | 0.7592539 | 0 |
Test extended validation before writing. | def test_validate_and_write_extended_validation(req):
handle = StringIO()
req.get('http://fake/', text=u'>foo\nMAGIC')
r = requests.get('http://fake/')
config = core.Config(extended_validation='loads', molecule='protein')
core._validate_and_write(r, handle, 'FAKE', config)
assert handle.getvalu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate(self):\n pass",
"def __validate():\n # TODO: implement",
"def test_validators():",
"def test_validation(self):\n self.validationFails()",
"def validate():",
"def validate(self):\n ...",
"def validate(self):",
"def validate(self):",
"def test_field_rules():"... | [
"0.7042656",
"0.6733468",
"0.66923016",
"0.666434",
"0.6635853",
"0.66091865",
"0.65776545",
"0.65776545",
"0.6520776",
"0.64949775",
"0.64949775",
"0.64949775",
"0.64949775",
"0.64949775",
"0.64949775",
"0.64949775",
"0.64949775",
"0.6398088",
"0.6398088",
"0.6398088",
"0.63... | 0.74485034 | 0 |
Test getting a download stream handles exceptions. | def test_get_stream_exception(req):
req.get(ENTREZ_URL, exc=requests.exceptions.RequestException)
params = dict(id='FAKE')
with pytest.raises(DownloadError):
core.get_stream(ENTREZ_URL, params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_stream(self):\n pass",
"def test_file_download(self):\n\n # Downloading without auth = unauthorized error (401)\n with self.assertRaises(requests.exceptions.HTTPError):\n self.assertFalse(self.api.downloadFile('/media/part/files/1/test.pdf', 'test.pdf'))",
"def test... | [
"0.7340208",
"0.6803314",
"0.67575866",
"0.67487544",
"0.66739756",
"0.66731954",
"0.66725594",
"0.6651754",
"0.64714664",
"0.6464837",
"0.63992447",
"0.63616765",
"0.6331959",
"0.63270634",
"0.63261515",
"0.63195616",
"0.62991345",
"0.6268872",
"0.61475223",
"0.61062175",
"0... | 0.76500154 | 0 |
Test getting a download stream handles bad status codes. | def test_get_stream_bad_status(req):
req.get(ENTREZ_URL, text=u'Nope!', status_code=404)
params = dict(id='FAKE')
with pytest.raises(InvalidIdError):
core.get_stream(ENTREZ_URL, params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_stream_exception(req):\n req.get(ENTREZ_URL, exc=requests.exceptions.RequestException)\n params = dict(id='FAKE')\n with pytest.raises(DownloadError):\n core.get_stream(ENTREZ_URL, params)",
"def test_file_chunk_generator_with_bad_url(mock_get):\n url = 'www.example.com'\n mock... | [
"0.71951884",
"0.68888",
"0.67313933",
"0.66616815",
"0.6567206",
"0.6535835",
"0.64916086",
"0.64071435",
"0.635155",
"0.6336012",
"0.6319616",
"0.6313055",
"0.6244992",
"0.6199207",
"0.61868465",
"0.61866546",
"0.6169734",
"0.6151099",
"0.61127555",
"0.6112462",
"0.61009485... | 0.7255718 | 0 |
Test URL generation for API key | def test_generate_url_with_api_key():
config = core.Config(api_key='FAKE')
expected = "{}?{}".format(ENTREZ_URL, "retmode=text&id=FAKE&db=nucleotide&api_key=FAKE&rettype=gbwithparts")
assert expected == core.generate_url("FAKE", config)
config.format = 'gff3'
expected = "{}?{}".format(SVIEWER_URL, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_api_key(self):\n pass",
"def test_api_key(self):\n self.assertEqual(self.route4me.key, '11111111111111111111111111111111')",
"def test_add_api_key_to_org(self):\n pass",
"def test_generate_api_key():\n\n key = auth.generate_api_key() # returns a NamedTuple with api_ke... | [
"0.77718914",
"0.7511353",
"0.7062115",
"0.70539737",
"0.7016188",
"0.7004324",
"0.69317126",
"0.69125515",
"0.6899556",
"0.6894859",
"0.68166417",
"0.6765619",
"0.6725878",
"0.6664452",
"0.6595064",
"0.6595008",
"0.658102",
"0.6571271",
"0.6566767",
"0.6563885",
"0.65369767"... | 0.79853916 | 0 |
Test that the small tree contains a root value. | def test_root_value(small_tree):
assert small_tree.root.value == 3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_small_tree_has_root_value(small_tree):\n assert small_tree.root.right.value == 11",
"def test_root_large_tree_value(large_tree):\n assert large_tree.root.value == 11",
"def test_small_tree_has_no_root(small_tree):\n assert small_tree.root.left is None",
"def test_val_root_filled_tree(depth_... | [
"0.90258086",
"0.8421181",
"0.81683797",
"0.80954325",
"0.79102343",
"0.78552735",
"0.784492",
"0.7693691",
"0.7687923",
"0.75692046",
"0.75289965",
"0.73862946",
"0.7377434",
"0.72751",
"0.72711587",
"0.70437205",
"0.6977386",
"0.69767857",
"0.69623435",
"0.69555503",
"0.695... | 0.88009286 | 1 |
Test that there is no left child of the small tree. | def test_small_tree_has_no_root(small_tree):
assert small_tree.root.left is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tree_with_one_node_root_no_children(one_t):\n assert not one_t.root.left\n assert not one_t.root.right",
"def has_left(self):\n return self.left != None",
"def test_left_sided_tree_with_two_nodes_root_has_child(empty_t):\n empty_t.insert(10)\n empty_t.insert(5)\n assert empty_t.r... | [
"0.7628269",
"0.7396116",
"0.73536694",
"0.73440623",
"0.7323851",
"0.7244781",
"0.7193488",
"0.70159173",
"0.69852084",
"0.6982524",
"0.6960716",
"0.6857339",
"0.68238616",
"0.67927694",
"0.679249",
"0.67556167",
"0.6754398",
"0.67338854",
"0.67301023",
"0.672847",
"0.670975... | 0.82072014 | 0 |
Test that there is a value of the right child in the small tree. | def test_small_tree_has_root_value(small_tree):
assert small_tree.root.right.value == 11 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_small_tree_has_right_child_child(small_tree):\n assert small_tree.root.right.right.value == 27",
"def test_tree_with_one_node_has_correct_value(one_t):\n assert one_t.root.value == 10",
"def test_root_value(small_tree):\n assert small_tree.root.value == 3",
"def test_val_root_filled_tree(de... | [
"0.8579176",
"0.69598657",
"0.69145495",
"0.6835501",
"0.6834478",
"0.67782515",
"0.66623455",
"0.66231143",
"0.66171",
"0.65439016",
"0.65047574",
"0.6443494",
"0.6417503",
"0.63988703",
"0.63982207",
"0.63054246",
"0.62891006",
"0.6267407",
"0.6237089",
"0.6206176",
"0.6206... | 0.7728338 | 1 |
Test that there is a right child of the small tree. | def test_small_tree_has_right_child_child(small_tree):
assert small_tree.root.right.right.value == 27 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_right_sided_tree_with_two_nodes_root_has_child(empty_t):\n empty_t.insert(10)\n empty_t.insert(15)\n assert empty_t.root.right\n assert not empty_t.root.left",
"def is_right_child(self):\n if self.parent == None:\n return False\n\n return self.parent.right == self",
... | [
"0.7641996",
"0.74434966",
"0.717954",
"0.7019246",
"0.6967774",
"0.69477737",
"0.6912281",
"0.68781763",
"0.6797199",
"0.6698184",
"0.6681731",
"0.66418415",
"0.66311455",
"0.6553698",
"0.65529317",
"0.64987636",
"0.6466696",
"0.64635324",
"0.64635324",
"0.64625084",
"0.6458... | 0.8620883 | 0 |
Generate a set with a minimal number of banknotes | def generate(self):
# prepare data
banknote_quantity_max = [int(math.floor(self.money / self.banknotes[i])) for i in range(0, self.n)]
# model
mdl = Model(name='MinSetGenerator')
# decision variables
mdl.banknote_quantity = {i: mdl.integer_var(lb=0, ub=banknote_quan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_biomarkes(abundant, xxx):\n cc = []\n bk = set()\n lvl = 0\n\n for _, t in abundant:\n cc.append(t.split('.'))\n\n while lvl < len(max(cc)):\n bk = set()\n\n for c in cc:\n if lvl < len(c):\n bk |= set([c[lvl]])\n\n if len(bk) >= xxx:\n ... | [
"0.61206543",
"0.60467297",
"0.5945952",
"0.5873081",
"0.5808728",
"0.58037686",
"0.5771521",
"0.5753275",
"0.56810796",
"0.56564367",
"0.5638397",
"0.56355566",
"0.5576355",
"0.5565222",
"0.5560541",
"0.5557775",
"0.55472076",
"0.55464345",
"0.55194867",
"0.5493678",
"0.5491... | 0.70151883 | 0 |
Check whether exists another set with a minimal number of banknotes | def is_exist_another_solution(self):
# prepare data
notes_quantity_min = sum(self.banknote_quantity)
banknote_quantity_max = [int(math.floor(self.money / self.banknotes[i])) for i in range(0, self.n)]
# model
mdl = Model(name='MinSetChecker')
# decision variables
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_infrequent_subset(Ck, Lks):\n ksSubset = combinations(Ck, r=len(Ck)-1)\n for ks in ksSubset:\n if not Lks.issuperset([frozenset(ks)]):\n return True\n return False",
"def test_contains(self):\n s = djset()\n s.add([1, 2, 3])\n s.add([4, 5, 6])\n self... | [
"0.59751385",
"0.59414506",
"0.5938108",
"0.58064103",
"0.58059067",
"0.5717115",
"0.56468505",
"0.56367284",
"0.5627375",
"0.5582969",
"0.55733943",
"0.5560441",
"0.5472907",
"0.54553425",
"0.5448051",
"0.54383254",
"0.54306436",
"0.54231006",
"0.54181796",
"0.54130954",
"0.... | 0.625606 | 0 |
From Sqlmap Returns (basic conversion) HTML unescaped value >>> htmlunescape('a<b') 'a<b' | def htmlunescape(value):
retVal = value
if value and isinstance(value, str):
codes = (("<", '<'), (">", '>'), (""", '"'),
(" ", ' '), ("&", '&'), ("'", "'"))
retVal = reduce(lambda x, y: x.replace(y[0], y[1]), codes, retVal)
try:
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unescape(t):\r\n return (t\r\n .replace(\"&\", \"&\").replace(\"<\", \"<\").replace(\">\", \">\")\r\n .replace(\"'\", \"´\").replace(\""\", '\"').replace(''',\"'\")\r\n )",
"def html_unescape(text):\n return html.unescape(text)",
"def xhtml_unescape(va... | [
"0.70825934",
"0.7071044",
"0.69811505",
"0.68802",
"0.6750165",
"0.6678649",
"0.6585287",
"0.6580559",
"0.6545425",
"0.6541923",
"0.653157",
"0.6513827",
"0.6476411",
"0.64493966",
"0.6419319",
"0.63503563",
"0.635006",
"0.63456255",
"0.631522",
"0.6315084",
"0.63005626",
... | 0.7275439 | 0 |
From Sqlmap Returns filtered page content without script, style and/or comments or all HTML tags >>> getFilteredPageContent(u'foobartest') u'foobar test' | def get_filtered_page_content(page, onlyText=True, split=" "):
retVal = page
# only if the page's charset has been successfully identified
if isinstance(page, str):
retVal = re.sub(r"(?si)<script.+?</script>|<!--.+?-->|<style.+?</style>%s" %
(r"|<[^>]+>|\t|\n|\r" if onlyTex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_page(page):\n content = utils.any2unicode(page, 'utf8').strip()\n content = re.sub(r\"[^a-zA-Z]\", \" \", content)\n \n return content",
"def fix_page_content(filename, content):\n return JournalStaticPage(filename, content).body",
"def get_text_from_page(page_content: str) -> str:\n... | [
"0.61187595",
"0.6044113",
"0.5769857",
"0.54977685",
"0.5493789",
"0.54862213",
"0.5450206",
"0.5276105",
"0.5263728",
"0.5217712",
"0.5206948",
"0.51723135",
"0.5163936",
"0.5148837",
"0.51385295",
"0.51373094",
"0.510455",
"0.5087979",
"0.50860703",
"0.5041471",
"0.5037026... | 0.6476379 | 0 |
Check that an event admin for a different event can't get a tag. | def test_get_event_admin_correct_event(self):
self.seed_static_data()
params = {'id': 1, 'event_id': 1}
response = self.app.get('/api/v1/tag', headers=self.user2_headers, data=params)
self.assertEqual(response.status_code, 403) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post_event_admin(self):\n self.seed_static_data()\n params = {\n 'event_id': 2,\n 'tag_type': 'RESPONSE',\n 'name': {\n 'en': 'English Tag 2 Event 2',\n 'fr': 'French Tag 2 Event 2',\n },\n 'description': {\... | [
"0.65669644",
"0.6325694",
"0.5844845",
"0.5678775",
"0.55033827",
"0.5427271",
"0.54185647",
"0.536466",
"0.5351754",
"0.5336185",
"0.52735984",
"0.5238865",
"0.5234522",
"0.5223319",
"0.52078164",
"0.52011263",
"0.5167887",
"0.51529324",
"0.51504195",
"0.51264316",
"0.51249... | 0.6942056 | 0 |
Parse file into list of strings, some of which are hoped to have valid XML for a docket. Returns list of all 'good' dockets, where good means the string is wellformed XML. If any string in list has '' or '' in it, entire file will be rejected. | def parseBadFileAsString(self,myfile):
def removeTopDocketTags(string):
return re.sub(r'<dockets>\n<docket>','',string)
def removeBottomDocketTags(string):
return re.sub(r'</docket>\n</dockets>$','',string)
def makeListOfDocketsAsText(string):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threatCheck(file):\n\tglobal threatList\n\tthreatList = []\n\twith open(file) as f:\n\t\tfor line in f.readlines():\n\t\t\tentry = line.split(',')\n\t\t\tif entry[3] == 'Vulnerable' or entry[3] == 'Endangered' or entry[3] == 'Critically Endangered':\n\t\t\t\tthreatList.append(entry[2])\n\treturn len(threatList... | [
"0.54615986",
"0.54525554",
"0.54438585",
"0.5365079",
"0.5323219",
"0.53079414",
"0.529013",
"0.52852976",
"0.5273892",
"0.5187629",
"0.5176548",
"0.51764387",
"0.5174369",
"0.51624626",
"0.5141824",
"0.51382256",
"0.5135575",
"0.51249886",
"0.51228625",
"0.51198125",
"0.510... | 0.69328964 | 0 |
Overriding a forms' __init__ method to perform validation checks on the verb category level within the taxonomy | def initialise(self, FormClass, *args, **kwargs):
self.taxonomy = kwargs.pop('taxonomy', None)
# The original/old category, for update view case
self.old_category = kwargs.pop('category', None)
super(FormClass, self).__init__(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n super(CategoryForm, self).__init__(*args, **kwargs)\n\n if self.initial.get('protected'):\n self.fields['name'].disabled = True\n self.fields['protected'].disabled = True",
"def clean_level_(self):\n try:\n # Get the ver... | [
"0.6305087",
"0.6184841",
"0.5756757",
"0.5699593",
"0.567558",
"0.56258833",
"0.53758687",
"0.53758687",
"0.52496165",
"0.52444685",
"0.5201543",
"0.5200204",
"0.51989377",
"0.51971245",
"0.5184488",
"0.51700205",
"0.5154692",
"0.5148399",
"0.5117388",
"0.5108232",
"0.508530... | 0.7239037 | 0 |
Ensure the user does not input a level value equal to that of a preexisting verb category of the taxonomy | def clean_level_(self):
try:
# Get the verb categories of the taxonomy
verb_cats = VerbCategory.objects.filter(taxonomy=self.taxonomy)
except Taxonomy.DoesNotExist:
raise Http404('The taxonomy does not exist!')
else:
# Check categories for the ent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __check_input__(self):\n # | - __check_input__\n tmp = set(self.tree_level_labels)\n input_diff = tmp.symmetric_difference(self.level_entries.keys())\n if not input_diff == set():\n undefined_labels = []\n for i in input_diff:\n undefined_labels.... | [
"0.5470051",
"0.5153077",
"0.5141412",
"0.50964123",
"0.50700456",
"0.5001281",
"0.4957744",
"0.49151474",
"0.48706883",
"0.4863167",
"0.48525065",
"0.4838317",
"0.48381013",
"0.48132944",
"0.48017558",
"0.4790142",
"0.47901177",
"0.47769713",
"0.47293702",
"0.4697029",
"0.46... | 0.7883397 | 0 |
dexterity should be installed when we install documentgenerator | def test_dexterity_is_dependency_of_documentgenerator(self):
dependencies = self.portal.portal_setup.getProfileDependencyChain('collective.documentgenerator:default')
self.assertTrue(u'profile-plone.app.dexterity:default' in dependencies) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def docs(session):\n session.install('-rrequirements-dev.txt')\n session.install('-e', '.')\n run_sphinx(session)",
"def documento():\r\n\tpass",
"def setup_doc(request):\n if not request.user.is_superuser:\n messages.info(request, \"Logon to set up VNS\")\n return HttpResponseRedirec... | [
"0.5717058",
"0.5526926",
"0.5411139",
"0.53990114",
"0.5289636",
"0.5268645",
"0.523585",
"0.5222095",
"0.52014726",
"0.5199993",
"0.51526654",
"0.5081674",
"0.5065004",
"0.50619376",
"0.50328755",
"0.5009421",
"0.50085336",
"0.5003667",
"0.49927482",
"0.4989397",
"0.4983263... | 0.6871886 | 0 |
z3cform.datagridfield should be installed when we install documentgenerator | def test_z3cformdatagridfield_is_dependency_of_documentgenerator(self):
dependencies = self.portal.portal_setup.getProfileDependencyChain('collective.documentgenerator:default')
self.assertTrue(u'profile-collective.z3cform.datagridfield:default' in dependencies) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def db_fields(self):",
"def __init__(self):\n self.fields = [ \n \n# plugins.FieldWidget(\"widget\", descr=\"Start from widget\",\n# default=\"/\"),\n# plugins.FieldMarker(\"markersearch\", descr=\"Search for marker\"),\n# plugins.... | [
"0.51919913",
"0.5081313",
"0.5059667",
"0.5010525",
"0.5000373",
"0.49492037",
"0.48477876",
"0.48170084",
"0.4805563",
"0.4780437",
"0.4780437",
"0.47034585",
"0.4697584",
"0.46762303",
"0.46655083",
"0.46433333",
"0.46174502",
"0.46126264",
"0.45991832",
"0.45922363",
"0.4... | 0.7025836 | 0 |
Reset a exponent alpha. | def reset_alpha(self, alpha):
self.alpha, old_alpha = alpha, self.alpha
priorities = [(self.tree.get_val(i) + self.__e) ** -
old_alpha for i in range(self.tree.filled_size())]
self.priority_update(range(self.tree.filled_size()), priorities) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_alpha(self, alpha):\n self.alpha, old_alpha = alpha, self.alpha\n priorities = [self.tree.get_val(i) ** -old_alpha for i in range(self.tree.filled_size())]\n self.priority_update(range(self.tree.filled_size()), priorities)",
"def reset_alpha(self, alpha):\n self.alpha, old_a... | [
"0.68466955",
"0.68466955",
"0.6816263",
"0.6559019",
"0.6155329",
"0.6124676",
"0.5975661",
"0.59635854",
"0.5957908",
"0.5916377",
"0.581707",
"0.5794807",
"0.5793535",
"0.5769495",
"0.5699174",
"0.56960946",
"0.562096",
"0.5600996",
"0.55926716",
"0.55768263",
"0.55442667"... | 0.69440967 | 0 |
you can provde a key or a session to sign the URL if none provided will use the global Session.SECRET salt is some salt that can be used in signing if desired. variables_to_sign is a list of variables to be included in the signature. | def __init__(self, session=None, key=None, salt=b"", variables_to_sign=None):
super().__init__() # Yes, I know that this currently doesn't do anything.
self.session = session
self.key = key or Session.SECRET
self.salt = salt
self.variables_to_sign = variables_to_sign or []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_vars(self, url, vars):\n vars[\"_signature\"] = self._sign(url, vars)",
"def signWithSecret(self, secret):\r\n self.link(secret)\r\n self.sign()",
"def _sign(self, url, endpoint, endpoint_path, method_verb, *args, **kwargs):\n url = self._uri\n return url, {'params':... | [
"0.62953484",
"0.5759323",
"0.5612654",
"0.5488564",
"0.5365722",
"0.53199714",
"0.527087",
"0.5191166",
"0.5183228",
"0.5169085",
"0.5157569",
"0.51418686",
"0.5059225",
"0.500007",
"0.49755123",
"0.4961267",
"0.49414334",
"0.49344224",
"0.49244606",
"0.49146283",
"0.4906523... | 0.6941905 | 0 |
Gets the signing key, creating it if necessary. | def _get_key(self):
if not self.session:
key = self.key
else:
key = self.session.get("_signature_key")
if key is None:
key = str(uuid.uuid1())
self.session["_signature_key"] = key
return key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_synapse_signing_key(self):\n if not path.exists(self.synapse_signing_key_file):\n key_id = \"a_\" + self.random_string(4)\n key_content = generate_signing_key(key_id)\n with open(self.synapse_signing_key_file, \"w+\") as key_file:\n write_signing_keys(... | [
"0.6825752",
"0.6528289",
"0.65215135",
"0.6436934",
"0.6363638",
"0.631877",
"0.62843007",
"0.6236405",
"0.6234332",
"0.6222451",
"0.61797965",
"0.6166999",
"0.61510545",
"0.6143897",
"0.6137727",
"0.6134392",
"0.60274917",
"0.59892124",
"0.5976278",
"0.59609246",
"0.5952915... | 0.66602325 | 1 |
Signs a URL, adding to vars (the variables of the URL) a signature. | def sign_vars(self, url, vars):
vars["_signature"] = self._sign(url, vars) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_url(path, expiration, account_email, keytext,\n verb='GET', content_type='', content_md5=''):\n private_key = RSA.importKey(keytext)\n if not path.startswith('/'):\n path = '/'+path\n base_url = '%s%s' % (GCS_API_ENDPOINT, path)\n string_to_sign = SIGNATURE_STRING.format(ver... | [
"0.6500728",
"0.64656204",
"0.635007",
"0.63115203",
"0.5918391",
"0.59115523",
"0.58970284",
"0.58378965",
"0.57895446",
"0.57237625",
"0.56381124",
"0.56150156",
"0.56130207",
"0.55921096",
"0.55717814",
"0.5525691",
"0.54901725",
"0.5430866",
"0.54270196",
"0.5400615",
"0.... | 0.8386482 | 0 |
Mark given class as the entity for User. | def register_user(self, cls):
return self.register_entity('user', cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user(self, user):\n self._user = user",
"def set_user(self, user):\r\n self.user = user",
"def user_cls(self):\n return self.get_entity_cls('user')",
"def user(self, user):\n self.user_id = user.get_id()",
"def set_user(self, user: User):\n self.__user = user",
"def... | [
"0.6509538",
"0.6496744",
"0.6126291",
"0.6119982",
"0.61141914",
"0.60054684",
"0.60054684",
"0.60054684",
"0.60054684",
"0.60054684",
"0.60054684",
"0.60054684",
"0.60054684",
"0.60054684",
"0.5991271",
"0.59332556",
"0.5928648",
"0.5897934",
"0.58634055",
"0.58634055",
"0.... | 0.74358714 | 0 |
Mark given class as the entity for Permission. | def register_permission(self, cls):
return self.register_entity('permission', cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permission_cls(self):\n return self.get_entity_cls('permission')",
"def permission(self, permission):\n\n self._permission = permission",
"def permission(self, permission):\n\n self._permission = permission",
"def set_permission(\n permission: Permission,\n user_or_group: UserO... | [
"0.6191563",
"0.5956788",
"0.5956788",
"0.59558314",
"0.58906794",
"0.5868287",
"0.5775181",
"0.5672249",
"0.5669219",
"0.5610798",
"0.55715984",
"0.55715984",
"0.54696345",
"0.53542596",
"0.52936137",
"0.528369",
"0.5257457",
"0.5256102",
"0.524391",
"0.51908153",
"0.5171996... | 0.7145781 | 0 |
Mark given class as the entity for Bundle. | def register_bundle(self, cls):
return self.register_entity('bundle', cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bundle(class_: Type[T]) -> Type[T]:\n namespace = OrderedDict()\n for attr in dir(class_):\n if not attr.startswith(\"_\") and attr != \"metadata\":\n attr_object = getattr(class_, attr)\n namespace[attr] = attr_object\n return BundleMeta(class_.__name__, (), namespace) #... | [
"0.6200419",
"0.6171212",
"0.60723436",
"0.59452605",
"0.58904743",
"0.58904743",
"0.5647311",
"0.5567563",
"0.5504061",
"0.54242414",
"0.53449535",
"0.5311498",
"0.5121058",
"0.5120031",
"0.51176834",
"0.510102",
"0.50701016",
"0.50628865",
"0.5060153",
"0.5053349",
"0.50129... | 0.74612033 | 0 |
Mark given class as the entity for Group. | def register_group(self, cls):
return self.register_entity('group', cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_group(self, address, group):\n self.groups[address] = group",
"def group(self, group):\n self._group = group",
"def group(self, group):\n\n self._group = group",
"def group(self, group):\n\n self._group = group",
"def group(self, group):\n\n self._group = group",
... | [
"0.66240406",
"0.64159083",
"0.6386166",
"0.6386166",
"0.6386166",
"0.6299137",
"0.62925017",
"0.62784845",
"0.60574126",
"0.604557",
"0.5984747",
"0.59824955",
"0.59489924",
"0.587001",
"0.5849864",
"0.5833509",
"0.5803911",
"0.57778096",
"0.5695118",
"0.5686916",
"0.5671374... | 0.7534639 | 0 |
Mark given class as the entity for Attempt. | def register_attempt(self, cls):
return self.register_entity('attempt', cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attempt(self, attempt):\n\n self._attempt = attempt",
"def attempt_cls(self):\n return self.get_entity_cls('attempt')",
"def _class(self, _class):\n\n self.__class = _class",
"def _class(self, _class):\n\n self.__class = _class",
"def entity(self, entity):\n\n self._e... | [
"0.6293439",
"0.6087253",
"0.5680625",
"0.5680625",
"0.5511365",
"0.53011936",
"0.53011936",
"0.52569115",
"0.5208276",
"0.51021844",
"0.50543135",
"0.49860868",
"0.49604225",
"0.49561048",
"0.49194008",
"0.48939493",
"0.4889586",
"0.4883102",
"0.48630318",
"0.4858264",
"0.47... | 0.7433578 | 0 |
Return the entity registered for Bundle. | def bundle_cls(self):
return self.get_entity_cls('bundle') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetEntity(self):\n return self.__entity",
"def entity(self):\n return self._entity",
"def entity(self):\n return self._entity",
"def GetEntity(self):\n\t\treturn self.acad.ActiveDocument.Utility.GetEntity()",
"def register_bundle(self, cls):\n return self.register_entity('bund... | [
"0.6807404",
"0.6516922",
"0.6516922",
"0.62681806",
"0.6195618",
"0.6172222",
"0.6172222",
"0.6164801",
"0.6090738",
"0.6072496",
"0.60393006",
"0.5977017",
"0.59181803",
"0.5861657",
"0.5843958",
"0.58304024",
"0.5593018",
"0.5547911",
"0.5488324",
"0.54595906",
"0.54330087... | 0.67808473 | 1 |
Return the entity registered for Attempt. | def attempt_cls(self):
return self.get_entity_cls('attempt') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetEntity(self):\n return self.__entity",
"async def get_entity(self):\n if not self.entity and await self.get_input_entity():\n try:\n self._entity =\\\n await self._client.get_entity(self._input_entity)\n except ValueError:\n ... | [
"0.6523218",
"0.6447264",
"0.63593775",
"0.6327726",
"0.6327726",
"0.60202014",
"0.5867586",
"0.5776936",
"0.57724816",
"0.56494397",
"0.5592657",
"0.5584119",
"0.5584119",
"0.55728316",
"0.55628717",
"0.5502534",
"0.5401744",
"0.53906035",
"0.5357345",
"0.53007805",
"0.52839... | 0.705092 | 0 |
return True if N is square number | def is_square(N):
if N < 0:
print("N is negative number @is_square in ModulesFactorization.")
sys.exit()
sqrt_N=round(math.sqrt(N))
if N == sqrt_N*sqrt_N:
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_square(N):\n return N == round(N**(0.5))**2",
"def is_square(n):\r\n m = int(sqrt(n))\r\n return m * m == n",
"def is_square(n):\n if type(n) is not int:\n raise ValueError(\"Wrong given type, should be integer instead\")\n return n > -1 and math.sqrt(n) == int(math.sqrt(n))",
"d... | [
"0.88921505",
"0.8663732",
"0.8025654",
"0.7796842",
"0.75990134",
"0.7459169",
"0.7402554",
"0.7398521",
"0.7383941",
"0.73806375",
"0.73228544",
"0.7117085",
"0.70663697",
"0.70554364",
"0.69903105",
"0.6930154",
"0.68873316",
"0.6887043",
"0.6846944",
"0.6833844",
"0.68178... | 0.8697051 | 1 |
return positive integer N for string N_str | def PositiveInt(N_str):
try:
N = int(N_str)
except ValueError:
print("整数を入力してください。")
sys.exit()
if N <= 0:
print("0以下の整数です。1以上の自然数を入力してください。")
sys.exit()
return N | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_times(str, n):\n if n <= 0:\n return('n has to be non-negative')\n else:\n return(str * n)",
"def my_dp_O_N_FAILED(self, s):\n if s[0] == '0':\n return 0\n if len(s) == 1:\n return 1\n \n \"\"\" Following len(s) >= 2 \"\"\"\n ... | [
"0.7054025",
"0.62198836",
"0.61006796",
"0.6047664",
"0.59960014",
"0.597458",
"0.5920257",
"0.5876303",
"0.5868132",
"0.58672506",
"0.58189476",
"0.5807939",
"0.57942134",
"0.5793706",
"0.5792252",
"0.5786809",
"0.57753885",
"0.57610023",
"0.5738962",
"0.5732349",
"0.571940... | 0.727527 | 0 |
Check if the user was mentioned in the given message. | def mentioned(self, message: "Message") -> bool:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mentioned_in(self, message: Message) -> bool:\n if message.guild is None or message.guild.id != self.guild.id:\n return False\n\n if self._user.mentioned_in(message):\n return True\n\n return any(self._roles.has(role.id) for role in message.role_mentions)",
"def men... | [
"0.7721908",
"0.72947556",
"0.7270287",
"0.7094305",
"0.70847654",
"0.70275617",
"0.68945",
"0.6781079",
"0.6633923",
"0.651744",
"0.6505316",
"0.64962983",
"0.63860756",
"0.6355281",
"0.62822205",
"0.62443316",
"0.6185116",
"0.6181461",
"0.61404777",
"0.61131454",
"0.6073126... | 0.80363095 | 0 |
Check if the given string is an action. | def is_action_str(string: str) -> bool: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_action(self) -> bool:\n return self.is_action_str(self.content)",
"def is_string_action(func: CLIActionType) -> bool:\n return check_function_type(func, [HammerDriver, Callable[[str], None]], Optional[str]) is None",
"def isActionKey(event_string):\n\n actionKeys = [ \"Return\", \"Escape\",... | [
"0.7728049",
"0.73375154",
"0.687277",
"0.68027675",
"0.66827106",
"0.65902036",
"0.6505975",
"0.64217037",
"0.6407963",
"0.6218089",
"0.61802155",
"0.6137043",
"0.612445",
"0.6097758",
"0.60162944",
"0.59167874",
"0.5903043",
"0.58280855",
"0.5803196",
"0.57699203",
"0.57142... | 0.8675571 | 0 |
Returns the given string as an action. | def as_action_str(string: str) -> str: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_to_action(str):\n raise NotImplementedError",
"def get_action(command):\n return command.split(\" \")[0]",
"def is_action_str(string: str) -> bool:",
"def define_action(char):\n if char == \"checks\":\n return ActionType.CHECK\n elif char == \"folds\":\n return ActionTyp... | [
"0.8616799",
"0.6958503",
"0.69501036",
"0.6784521",
"0.6666197",
"0.66375476",
"0.6600629",
"0.64534956",
"0.6441584",
"0.6435479",
"0.6420219",
"0.6363733",
"0.6176962",
"0.614364",
"0.60980374",
"0.6083132",
"0.60809344",
"0.60809344",
"0.60809344",
"0.60620207",
"0.605870... | 0.79646474 | 1 |
Strip the action formatting from the given string. | def strip_action_str(string: str) -> str: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_action(self) -> str:\n return self.strip_action_str(self.content)",
"def stripFormatting(self, s):\n # stripColor has to go first because of some strings, check the tests.\n s = stripColor(s)\n s = stripBold(s)\n s = stripReverse(s)\n s = stripUnderline(s)\n ... | [
"0.7534198",
"0.66088766",
"0.6474476",
"0.61960036",
"0.6176254",
"0.6136924",
"0.6136924",
"0.6093519",
"0.60658264",
"0.6020465",
"0.599568",
"0.5958416",
"0.59549266",
"0.5893231",
"0.5802946",
"0.5727048",
"0.56940913",
"0.5693054",
"0.568232",
"0.5680192",
"0.56799215",... | 0.89726824 | 0 |
Check whether the message is an action. | def is_action(self) -> bool:
return self.is_action_str(self.content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_action(self, action):\n if self.board[action[0]][action[1]] == None:\n return True\n \n return False",
"def match_action(self, action):\n\n return hasattr(self, self._action_handler_name(action))",
"def check_type(self):\n if self.action < 0 or self.ac... | [
"0.7165937",
"0.70354944",
"0.6937857",
"0.64320385",
"0.63170636",
"0.62816095",
"0.6277914",
"0.6259409",
"0.62416196",
"0.6177585",
"0.6160382",
"0.6158344",
"0.6118185",
"0.6103044",
"0.6081431",
"0.6062426",
"0.5996191",
"0.5986556",
"0.5905781",
"0.59051764",
"0.5904808... | 0.8249713 | 0 |
Returns the message as an action. | def as_action(self) -> str:
return self.as_action_str(self.content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_action(self):\n return self.__action",
"def get_action(self):\n return self.__action",
"def create_action_msg(self, action):\n raise NotImplementedError(\"Don't know how to translate the action to a msg\")",
"def action(self):\n return self._action",
"def action(self):\n ... | [
"0.67650163",
"0.67649853",
"0.6624183",
"0.65623546",
"0.65623546",
"0.65623546",
"0.65623546",
"0.65623546",
"0.65623546",
"0.65537053",
"0.6530178",
"0.64753294",
"0.64666075",
"0.6461064",
"0.64377016",
"0.6340056",
"0.6218753",
"0.61965334",
"0.61937577",
"0.6175406",
"0... | 0.7495476 | 0 |
Strip the action formatting from the message. | def strip_action(self) -> str:
return self.strip_action_str(self.content) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_action_str(string: str) -> str:",
"def remove_unused_char(action_list):\r\n clean_action_list = []\r\n for action in action_list:\r\n effect_element = action['action']\r\n clearnedstr = (effect_element[effect_element.index(\"effect\")\r\n + len(\... | [
"0.721275",
"0.62852895",
"0.6171277",
"0.5884014",
"0.5840245",
"0.5785069",
"0.56816316",
"0.56810516",
"0.5679864",
"0.55925167",
"0.54373753",
"0.54164183",
"0.5408169",
"0.53954107",
"0.53867286",
"0.53814524",
"0.5342451",
"0.5337432",
"0.52963245",
"0.5288288",
"0.5239... | 0.8087658 | 0 |
Get all available stream names of a module | def getAllStreams(name):
global index
module = index.get_module(name)
if not module:
return None
streams = set()
for s in module.get_all_streams():
streams.add(s.get_stream_name())
return list(streams) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetStreamNames(self):\n if self._zipfile:\n for stream_name in self._zipfile.namelist():\n yield stream_name",
"def list_streams(self)->List[str]:\n stream_path = self._get_storage_path()\n stream_names = []\n all_streams = self._ls_dir()\n for strm in all_streams:... | [
"0.69426733",
"0.64697057",
"0.6339101",
"0.6268361",
"0.622487",
"0.6212241",
"0.6140346",
"0.60362804",
"0.60118866",
"0.599059",
"0.5970591",
"0.59448946",
"0.5888642",
"0.5825326",
"0.58059126",
"0.57862926",
"0.5755366",
"0.57007676",
"0.56770694",
"0.5670549",
"0.560570... | 0.78462434 | 0 |
Get the default stream name of a module | def getDefaultStream(name):
global index
module = index.get_module(name)
if not module:
raise ValueError("Module '{}' not found".format(name))
defaults = module.get_defaults()
if defaults:
return defaults.get_default_stream()
return module.get_all_streams()[0].get_stream_name() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stream_name(self):\n return self._stream_name",
"def stream_name(self):\n return self._stream_name",
"def log_stream_name(self) -> str:\n ...",
"def get_stream_alias(self) -> str:",
"def log_stream_name(self) -> typing.Optional[str]:\n return self._values.get('log_stream_nam... | [
"0.6737794",
"0.6737794",
"0.6623961",
"0.653456",
"0.65149754",
"0.65149754",
"0.64970565",
"0.64970565",
"0.63577265",
"0.6322237",
"0.61933964",
"0.6186538",
"0.61661714",
"0.6154561",
"0.6144581",
"0.6121341",
"0.6100625",
"0.60407394",
"0.60001075",
"0.5991742",
"0.59379... | 0.80794257 | 0 |
Get the enabled stream name of a module, or the default stream if not enabled | def getEnabledOrDefault(name):
if name == 'platform':
return 'el8'
if name not in enabledStreams:
return getDefaultStream(name)
enabled = enabledStreams[name]
return enabled.get_stream_name() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDefaultStream(name):\n global index\n module = index.get_module(name)\n if not module:\n raise ValueError(\"Module '{}' not found\".format(name))\n defaults = module.get_defaults()\n\n if defaults:\n return defaults.get_default_stream()\n\n return module.get_all_streams()[0].... | [
"0.71392494",
"0.64522684",
"0.61080575",
"0.61080575",
"0.60635865",
"0.60635865",
"0.58935094",
"0.5878183",
"0.58776337",
"0.57697684",
"0.57667184",
"0.56502503",
"0.5636581",
"0.5636581",
"0.5593862",
"0.554713",
"0.5498939",
"0.54252493",
"0.5367109",
"0.533411",
"0.530... | 0.7416444 | 0 |
Get module names that a stream depends on | def getDeps(stream):
return stream.get_dependencies()[0].get_runtime_modules() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDepStreams(stream):\n dep = stream.get_dependencies()[0]\n allDeps = []\n for m in dep.get_runtime_modules():\n deps = dep.get_runtime_streams(m)\n if deps:\n allDeps.append((m, deps[0]))\n return allDeps",
"def imports():\n for name, val in globals().items():\n ... | [
"0.7177386",
"0.6437847",
"0.6343517",
"0.6296538",
"0.6271704",
"0.61826694",
"0.61645204",
"0.6148593",
"0.60953635",
"0.60798955",
"0.60089207",
"0.5954224",
"0.5952785",
"0.59372693",
"0.5895971",
"0.58944315",
"0.5886773",
"0.58806723",
"0.58730894",
"0.5867702",
"0.5834... | 0.77787983 | 0 |
Get all available context for a module and a stream name | def getAllContexts(name, stream):
global index
module = index.get_module(name)
if not module:
return []
allStreams = module.get_all_streams()
allContexts = []
for s in allStreams:
if s.get_stream_name() == stream:
allContexts.append(s)
return allContexts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xontrib_context(name):\n spec = find_xontrib(name)\n if spec is None:\n return None\n m = importlib.import_module(spec.name)\n pubnames = getattr(m, \"__all__\", None)\n if pubnames is not None:\n ctx = {k: getattr(m, k) for k in pubnames}\n else:\n ctx = {k: getattr(m, k... | [
"0.6219044",
"0.62187123",
"0.59566826",
"0.5806043",
"0.5780251",
"0.5706612",
"0.5636643",
"0.5569738",
"0.5518517",
"0.54909873",
"0.53959274",
"0.53687716",
"0.53404284",
"0.53111374",
"0.5305881",
"0.52993786",
"0.5292798",
"0.52851295",
"0.5276902",
"0.52571344",
"0.525... | 0.80076534 | 0 |
Recursively enable a stream and its dependencies with their default streams, unless already enabled with a different stream. | def pickStream(name, stream):
if isEnabled(name):
return
allDeps = set()
allContexts = getAllContexts(name, stream)
for c in allContexts:
allDeps = allDeps.union(getDeps(c))
enabledDeps = []
for d in allDeps:
enabledDeps.append((d ,getEnabledOrDefault(d)))
for ctx ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_or_continue(S,cfg,bands,confluence_fp='default'):\n if confluence_fp=='default':\n return start_confluence_log_file(S,cfg,bands)\n continue_config(S,cfg,bands,confluence_fp)",
"def enable(\n verbose=False,\n silent=False,\n full_signature=True,\n copy_ok=True,\n calculate_me... | [
"0.48670077",
"0.483356",
"0.48210898",
"0.4794903",
"0.4747588",
"0.4735464",
"0.47152197",
"0.4679096",
"0.46170568",
"0.452739",
"0.45159292",
"0.44828388",
"0.44643793",
"0.44415295",
"0.44070897",
"0.44012928",
"0.4388118",
"0.43651462",
"0.4342453",
"0.43344104",
"0.431... | 0.6946649 | 0 |
Get a list of RPMs to blacklist | def getRpmBlacklist():
global index
enabledRpms = set()
for stream in enabledStreams.values():
enabledRpms = enabledRpms.union(stream.get_rpm_artifacts())
allRpms = set()
for name in index.get_module_names():
module = index.get_module(name)
for stream in module.get_all_strea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blacklist(self) -> List[str]:\n return self.raw_config.get(\"blacklist\", [])",
"def blacklist_remove():\n db = unitdata.kv()\n blacklist = db.get(BLACKLIST_KEY, [])\n for device in get_devices():\n try:\n blacklist.remove(device)\n except ValueError:\n rai... | [
"0.65307343",
"0.63255924",
"0.62569094",
"0.616089",
"0.60532945",
"0.5996806",
"0.5904636",
"0.58727056",
"0.58684236",
"0.58534366",
"0.58209705",
"0.57830745",
"0.5761726",
"0.5739948",
"0.57301134",
"0.5706825",
"0.569636",
"0.5680605",
"0.56762797",
"0.5670396",
"0.5670... | 0.81101996 | 0 |
Get all modular rpms in the repository | def getAllPackages(metadataPaths):
global index
index = createModuleIndex(metadataPaths)
allRpms = []
for name in index.get_module_names():
module = index.get_module(name)
for stream in module.get_all_streams():
allRpms.extend(stream.get_rpm_artifacts())
return allRpms | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modules():\n return [os.path.relpath(os.path.join(root, filename), 'groot_ansible')\n for root, _, filenames in os.walk('groot_ansible/playbooks/library') for filename in filenames if '.git' not in root.split(os.sep)\n ]",
"def getAllModules(self):\n\n modules = cmds.ls(type=\... | [
"0.6801965",
"0.67250276",
"0.6678874",
"0.656387",
"0.655304",
"0.64945525",
"0.646505",
"0.644537",
"0.6433724",
"0.640705",
"0.6401202",
"0.63888985",
"0.63857746",
"0.6370172",
"0.6369746",
"0.63690275",
"0.63672113",
"0.6319444",
"0.6249335",
"0.6230579",
"0.6226255",
... | 0.70210683 | 0 |
Insert data into an empty linked list and check whether header node's next has None | def test_insert_head_empty_list_2(test_linkedlist):
test_linkedlist.insert_head('A')
assert test_linkedlist.head.next is None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_head(self, data):\n node = Node(data)\n if self.is_empty():\n self.head = node\n else:\n node.next = self.head\n self.head.prev = node\n self.head = node",
"def add_first(self, data):\n # define the head as the new Node\n s... | [
"0.69598556",
"0.6849278",
"0.67394346",
"0.6602789",
"0.6595135",
"0.64504087",
"0.6411734",
"0.6335657",
"0.63337535",
"0.63198644",
"0.6302688",
"0.62967426",
"0.62671685",
"0.62671685",
"0.62614995",
"0.6217475",
"0.6202579",
"0.61525685",
"0.6090097",
"0.6051709",
"0.603... | 0.6989526 | 0 |
Insert head element to a single element linked list and check whether header node has expected data. | def test_insert_head_one_element_list_1(test_linkedlist):
test_linkedlist.insert_head('A')
test_linkedlist.insert_head('B')
assert test_linkedlist.head.data == 'B' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_insert_head_empty_list_1(test_linkedlist):\n test_linkedlist.insert_head('A')\n assert test_linkedlist.head.data == 'A'",
"def test_insert_head_empty_list_2(test_linkedlist):\n test_linkedlist.insert_head('A')\n assert test_linkedlist.head.next is None",
"def test_insert_head_one_element_l... | [
"0.7000382",
"0.6920265",
"0.68926394",
"0.6658777",
"0.664612",
"0.6491131",
"0.6382923",
"0.63249904",
"0.6275315",
"0.62428296",
"0.61293507",
"0.6121938",
"0.6120845",
"0.6103657",
"0.60847497",
"0.5946656",
"0.5900113",
"0.5896753",
"0.5894562",
"0.5886943",
"0.5839833",... | 0.7153454 | 0 |
Insert head element to a single element linked list and check whether header node.next points to second element | def test_insert_head_one_element_list_2(test_linkedlist):
test_linkedlist.insert_head('A')
test_linkedlist.insert_head('B')
assert test_linkedlist.head.next.data == 'A' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_insert_head_empty_list_2(test_linkedlist):\n test_linkedlist.insert_head('A')\n assert test_linkedlist.head.next is None",
"def test_insert_head_one_element_list_1(test_linkedlist):\n test_linkedlist.insert_head('A')\n test_linkedlist.insert_head('B')\n assert test_linkedlist.head.data ==... | [
"0.68290764",
"0.6784454",
"0.67691284",
"0.6407408",
"0.6398689",
"0.634001",
"0.6122741",
"0.6031908",
"0.6015013",
"0.5961826",
"0.5920558",
"0.5915399",
"0.59067553",
"0.5889279",
"0.5888695",
"0.58771574",
"0.5876606",
"0.5869111",
"0.58359754",
"0.5826269",
"0.5800353",... | 0.6998045 | 0 |
Insert head element to a two element linked list and check whether header node has expected data. | def test_insert_head_for_two_element_list_1(test_linkedlist):
test_linkedlist.insert_head('A')
test_linkedlist.insert_head('B')
test_linkedlist.insert_head('C')
assert test_linkedlist.head.data == 'C' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_insert_head_one_element_list_2(test_linkedlist):\n test_linkedlist.insert_head('A')\n test_linkedlist.insert_head('B')\n assert test_linkedlist.head.next.data == 'A'",
"def test_insert_head_empty_list_2(test_linkedlist):\n test_linkedlist.insert_head('A')\n assert test_linkedlist.head.nex... | [
"0.71093637",
"0.6993354",
"0.69920653",
"0.6874157",
"0.6395523",
"0.6193493",
"0.6157132",
"0.610049",
"0.59965223",
"0.5888415",
"0.58738816",
"0.5845826",
"0.58392084",
"0.5838037",
"0.57361645",
"0.5719376",
"0.5718986",
"0.56913036",
"0.5687391",
"0.56646043",
"0.564347... | 0.71451944 | 0 |
Insert last element to an empty element linked list and check whether header node has expected data | def test_insert_end_for_empty_list(test_linkedlist):
test_linkedlist.insert_end('A')
assert test_linkedlist.head.data == 'A' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insertAtEnd(self, e):\n # self.insertBeforeHeader(e) # this is not true since the head will be changed\n \n if self.is_empty(): # if this is the first insert method call,\n print(\"As you do not have any start node yet, the given element will be a start node.\")\n self._first_insert(e)\... | [
"0.6620652",
"0.65475994",
"0.6387041",
"0.63748395",
"0.63285327",
"0.63142574",
"0.6290541",
"0.625654",
"0.6144856",
"0.6062653",
"0.6061434",
"0.6054086",
"0.60341364",
"0.5983253",
"0.5946131",
"0.59438145",
"0.5936144",
"0.592606",
"0.5887565",
"0.58757454",
"0.587368",... | 0.7035622 | 0 |
Insert last element to a single element linked list and check whether the last node has expected data | def test_insert_end_for_one_element_list(test_linkedlist):
test_linkedlist.insert_end('A')
test_linkedlist.insert_end('B')
assert test_linkedlist.head.data == 'A' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_insert_end_for_empty_list(test_linkedlist):\n test_linkedlist.insert_end('A')\n assert test_linkedlist.head.data == 'A'",
"def test_insert_end(self):\n sll = SinglyLinkedList()\n a = Node('a')\n b = Node('b')\n c = Node('c')\n sll.insert_beg(a)\n sll.inser... | [
"0.72178334",
"0.69149065",
"0.69074094",
"0.6875248",
"0.6817494",
"0.6682206",
"0.65892625",
"0.6489145",
"0.6454365",
"0.64060044",
"0.6381768",
"0.6363875",
"0.6361612",
"0.6344563",
"0.6337286",
"0.63229567",
"0.63185537",
"0.6296967",
"0.62793654",
"0.62726855",
"0.6232... | 0.7321098 | 0 |
Create a 3 element linked list with a cycle and test whether cycle_present() function detects it | def test_cycle_present_true(test_linkedlist):
test_linkedlist.insert_end('A')
test_linkedlist.insert_end('B')
test_linkedlist.insert_end('C')
# create a cycle - connection from 3rd to 2nd element
test_linkedlist.head.next.next.next = test_linkedlist.head.next
# assert cycle_present() function re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_cycle(head):\n\n # We specify that an empty list won't have a cycle.\n if head is None:\n return False\n\n assert isinstance(head, Node)\n\n pass",
"def has_cycle(link):\r\n # collect_list = [link]\r\n # while not link == Link.empty:\r\n # collect_list.append(link.first)\r... | [
"0.6907678",
"0.687814",
"0.67647743",
"0.671243",
"0.6531942",
"0.6443912",
"0.6440989",
"0.64005125",
"0.63992447",
"0.6299232",
"0.62967825",
"0.62917066",
"0.61344707",
"0.6031512",
"0.6025081",
"0.5982313",
"0.59708685",
"0.5873659",
"0.58675855",
"0.57296795",
"0.564696... | 0.8052806 | 0 |
Class constructor. Creates one of seven basic shapes. | def __init__(self, shape_num):
self.shape_num = shape_num
if shape_num == 1:
self.width = 4
self.height = 4
self.grid = [[0 for x in range(self.height)] for y in range(self.width)]
self.grid[0][2] = 1
self.grid[1][2] = 1
self.grid[2... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, shape):\n\n self.shape = shape",
"def __init__(self, shape_num):\n\n\t\tself.shape_num = shape_num\n\t\tself.shape = shapes[shape_num].copy()\n\t\tself.width = len(self.shape[0])\n\t\tself.height = len(self.shape)",
"def __init__(self, shape):\n self.eyes = [(), ()]\n se... | [
"0.6991661",
"0.6827439",
"0.6623674",
"0.6510729",
"0.6309907",
"0.6284515",
"0.6269464",
"0.6269464",
"0.62600565",
"0.6234398",
"0.61847866",
"0.6112943",
"0.6112943",
"0.61017305",
"0.6051707",
"0.60218245",
"0.599573",
"0.5987703",
"0.59692216",
"0.59690464",
"0.5945936"... | 0.6911856 | 1 |
A high level description of the cell with global identifier gid. For example the morphology, synapses and ion channels required to build a multicompartment neuron. | def cell_description(self, gid):
tree = arbor.segment_tree()
tree.append(
arbor.mnpos,
arbor.mpoint(0, 0, 0, self.radius),
arbor.mpoint(self.length, 0, 0, self.radius),
tag=1,
)
labels = arbor.label_dict({"cable": "(tag 1)", "start": "(l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n\n return \"\\n<Grid ID: {} Name: {}>\".format(self.grid_id,\n self.grid_name)",
"def __repr__(self):\n\n return \"\\n Glitz ID: {} Title: {}\\n\".format(self.glitz_id,\n self.... | [
"0.62961143",
"0.59455574",
"0.59399664",
"0.58813816",
"0.58670366",
"0.5848497",
"0.58048916",
"0.57531345",
"0.5731641",
"0.5647178",
"0.55872154",
"0.55872154",
"0.55754495",
"0.5572215",
"0.55627483",
"0.55473393",
"0.553182",
"0.55220306",
"0.54978687",
"0.5445748",
"0.... | 0.7032956 | 0 |
Verify LMBiSeNet.post_process() is the same as Bilinear and Softmax post process | def test_lm_bisenet_post_process():
tf.InteractiveSession()
image_size = [96, 64]
batch_size = 2
classes = Camvid.classes
data_format = "NHWC"
model = LMBiSeNet(
image_size=image_size,
batch_size=batch_size,
classes=classes,
data_format=data_format,
)
p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_processing(conf_thresh, nms_thresh, output):\n # anchors = [12, 16, 19, 36, 40, 28, 36, 75, 76, 55, 72, 146, 142, 110, 192, 243, 459, 401]\n # num_anchors = 9\n # anchor_masks = [[0, 1, 2], [3, 4, 5], [6, 7, 8]]\n # strides = [8, 16, 32]\n # anchor_step = len(anchors) // num_anchors\n\n ... | [
"0.5815606",
"0.5808166",
"0.58040047",
"0.575359",
"0.57129437",
"0.5690851",
"0.56780434",
"0.5647363",
"0.5629743",
"0.5564466",
"0.55191976",
"0.5496618",
"0.54881227",
"0.5456672",
"0.54489857",
"0.544301",
"0.53556955",
"0.5354755",
"0.5352226",
"0.53475475",
"0.5321695... | 0.77813905 | 0 |
Custom Modules Menu for help | def menu_help(cls, **attr):
menu_help = MM("Help", c="default", f="help", **attr)(
MM("Contact us", f="contact"),
MM("About", f="about"),
MM(current.T("Ask MSW"), c="org", f="ask_msw"),
MM("spiegel.de", c="org", f="spiegel"),
)
return menu_help | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_help(self):\n print(\"Module \" + str(self))\n print(\"Available commands:\")\n for k in self.commands.values():\n n = k.get_name()\n if len(n) >= CONST_BINDCTL_HELP_INDENT_WIDTH:\n print(\" %s\" % n)\n print(textwrap.fill(k.get... | [
"0.69515866",
"0.6950947",
"0.6950947",
"0.6891426",
"0.6883034",
"0.68470794",
"0.68117195",
"0.6777707",
"0.6777707",
"0.67304593",
"0.67135394",
"0.6699524",
"0.6642193",
"0.66408026",
"0.66307276",
"0.6624621",
"0.6574334",
"0.65732974",
"0.65549225",
"0.65472573",
"0.653... | 0.71073353 | 0 |
ORG / Organization Registry | def org():
settings = current.deployment_settings
ADMIN = current.session.s3.system_roles.ADMIN
SECTORS = "Clusters" if settings.get_ui_label_cluster() \
else "Sectors"
stats = lambda i: settings.has_module("stats")
return M(c="org")(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atlas_organizations():\n pass",
"def organizations(self):\n self.elements('organizations')",
"def test_get_organization(self):\n pass",
"def test_retrieve_l_organization(self):\n pass",
"def org():\n\n sysroles = current.auth.get_system_roles()\n\n ADMIN = sysroles... | [
"0.67622626",
"0.64280254",
"0.6281099",
"0.6248272",
"0.61873627",
"0.6182633",
"0.6163306",
"0.60936064",
"0.60586184",
"0.60250324",
"0.5994845",
"0.5978774",
"0.5963733",
"0.5891216",
"0.5847455",
"0.5847007",
"0.58193946",
"0.57460207",
"0.5737204",
"0.5737204",
"0.57372... | 0.6491232 | 1 |
Return a new naturally sorted list from the items in iterable. The returned list is in natural sort order. The string is ordered lexicographically (using the Unicode code point number to order individual characters), except that multidigit numbers are ordered as a single character. Has two optional arguments which must... | def natural_sorted(iterable, key=None, reverse=False):
prog = re.compile(r"(\d+)")
def alphanum_key(element):
"""Split given key in list of strings and digits"""
return [int(c) if c.isdigit() else c for c in prog.split(element[0])]
return sorted(iterable, key=alphanum_key, reverse=reverse) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_nicely(l, key):\n convert = lambda text: int(text) if text.isdigit() else text\n alphanum_key = lambda item: [ convert(c) for c in re.split('([0-9]+)', key(item)) ]\n return sorted(l, key = alphanum_key)",
"def sorted_nicely(ls, key, rev=False):\n def convert(text):\n ... | [
"0.76012194",
"0.72604644",
"0.72291124",
"0.7211663",
"0.71234494",
"0.70481193",
"0.7033714",
"0.69929475",
"0.6972046",
"0.6964402",
"0.6964402",
"0.6928824",
"0.6904572",
"0.69022584",
"0.6884324",
"0.6873669",
"0.6862452",
"0.67815965",
"0.6772535",
"0.67579895",
"0.6745... | 0.7791482 | 0 |
Get the selection method. | def selection(self) -> str:
return self._selection | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSelection(self):\n return self.selection",
"def _getAsSelection(self):\n return self._asSelection",
"def GetSelection(self):\r\n\r\n return self.selection",
"def get_selection(self, selection_name, format=None):",
"def get_method_name(self) -> Optional[str]:\n current_mod... | [
"0.69442207",
"0.688181",
"0.6810091",
"0.6737498",
"0.67364687",
"0.6490553",
"0.6357488",
"0.63299996",
"0.63299996",
"0.6322587",
"0.6310337",
"0.6286217",
"0.62577385",
"0.62555695",
"0.6244326",
"0.6195419",
"0.61379856",
"0.61312324",
"0.6102224",
"0.6090719",
"0.608550... | 0.69850576 | 0 |
Fill the internal buffer with domains. | def fill_buffer(self, num_domains: int):
if self._randomizer is None:
raise pyrado.TypeErr(msg="The randomizer must not be None to call fill_buffer()!")
if not isinstance(num_domains, int) or num_domains < 0:
raise pyrado.ValueErr(given=num_domains, g_constraint="0 (int)")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domains(self, domains):\n\n self._domains = domains",
"def domain(self, domain):",
"def prepare_domain_restrictions(self):\n for index, restriction in enumerate(self._domain_restrictions):\n self.add_specific_domain_restriction(index+1, restriction)",
"def setDomainRange(self, do... | [
"0.58577764",
"0.5815134",
"0.56737477",
"0.5397528",
"0.5369211",
"0.5332131",
"0.5293622",
"0.52866274",
"0.52802956",
"0.52799034",
"0.52597743",
"0.5250782",
"0.52413416",
"0.5233103",
"0.5192772",
"0.51702565",
"0.5167267",
"0.5160602",
"0.51385796",
"0.5080049",
"0.5040... | 0.68794465 | 0 |
Go through the environment chain and remove all wrappers of type `DomainRandWrapper` (and subclasses). | def remove_all_dr_wrappers(env: Env, verbose: bool = False):
while any(isinstance(subenv, DomainRandWrapper) for subenv in all_envs(env)):
if verbose:
with completion_context(
f"Found domain randomization wrapper of type {type(env).__name__}. Removing it now",
col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_cleanup(self):\n pass",
"def CleanUpEnvironment(self):\n for prop in self._wrap_properties:\n self._adb.RunShellCommand('setprop %s \"\"' % (prop,))\n SetChromeTimeoutScale(self._adb, None)",
"def clean_env():\n for key in ['FOO', 'THOR', 'IRON', 'NAME', 'PERSONAL_DIR']:\n o... | [
"0.61490715",
"0.6136373",
"0.6094279",
"0.5847474",
"0.58205855",
"0.5792032",
"0.5697961",
"0.5677101",
"0.5677101",
"0.5677101",
"0.56502455",
"0.5646729",
"0.56398857",
"0.56398857",
"0.5638647",
"0.56314355",
"0.561462",
"0.5610801",
"0.5609453",
"0.5607916",
"0.55971336... | 0.8253526 | 0 |
Test draw an empty circuit | def test_empty_circuit(self):
filename = self._get_resource_path('test_empty.tex')
qc = QuantumCircuit(1)
circuit_drawer(qc, filename=filename, output='latex_source')
self.assertEqualToReference(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_include_empty_wires(self):\r\n\r\n dev = qml.device(\"default.qubit\", wires=[-1, \"a\", \"q2\", 0])\r\n\r\n @qml.beta.qnode(dev)\r\n def circuit():\r\n qml.Hadamard(wires=-1)\r\n qml.CNOT(wires=[-1, \"q2\"])\r\n return qml.expval(qml.PauliX(wires=\"q2... | [
"0.6924551",
"0.6568286",
"0.64662397",
"0.64222956",
"0.6421285",
"0.64043254",
"0.6376929",
"0.63387245",
"0.629913",
"0.62639713",
"0.6204953",
"0.61285377",
"0.6089309",
"0.6065642",
"0.605834",
"0.605694",
"0.5992427",
"0.59759027",
"0.5941306",
"0.5927979",
"0.591923",
... | 0.7348291 | 0 |
Test draw tiny circuit. | def test_tiny_circuit(self):
filename = self._get_resource_path('test_tiny.tex')
qc = QuantumCircuit(1)
qc.h(0)
circuit_drawer(qc, filename=filename, output='latex_source')
self.assertEqualToReference(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_small_circuit(self):\n # Specify a type of circuit used in this test\n self.check_circuit_type('small')",
"def test_normal_circuit(self):\n filename = self._get_resource_path('test_normal.tex')\n qc = QuantumCircuit(5)\n for qubit in range(5):\n qc.h(qubit)\... | [
"0.6801835",
"0.6699156",
"0.64904195",
"0.6419961",
"0.6361697",
"0.63490915",
"0.6336773",
"0.62877667",
"0.61095464",
"0.6101822",
"0.608317",
"0.6071821",
"0.60660523",
"0.6031293",
"0.5999905",
"0.5997176",
"0.59682024",
"0.589236",
"0.58785677",
"0.5865717",
"0.5857305"... | 0.7153058 | 0 |
Test draw deep circuit. | def test_deep_circuit(self):
filename = self._get_resource_path('test_deep.tex')
qc = QuantumCircuit(1)
for _ in range(100):
qc.h(0)
circuit_drawer(qc, filename=filename, output='latex_source')
self.assertEqualToReference(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_deep_circuit(self):\n # Specify a type of circuit used in this test\n self.check_circuit_type('deep')",
"def test_circuit_init(self):\n circuit, target = self.simple_circuit_no_measure()\n op = Chi(circuit)\n target = Chi(target)\n self.assertEqual(op, target)",... | [
"0.79749006",
"0.60347056",
"0.60028684",
"0.5929052",
"0.5861189",
"0.58604586",
"0.58148104",
"0.5752517",
"0.5734806",
"0.5658191",
"0.5636587",
"0.56252784",
"0.5622533",
"0.56093955",
"0.5568864",
"0.55531883",
"0.5541974",
"0.5538976",
"0.5533178",
"0.5518426",
"0.55044... | 0.7030379 | 1 |
Test draw huge circuit. | def test_huge_circuit(self):
filename = self._get_resource_path('test_huge.tex')
qc = QuantumCircuit(40)
for qubit in range(39):
qc.h(qubit)
qc.cx(qubit, 39)
circuit_drawer(qc, filename=filename, output='latex_source')
self.assertEqualToReference(filenam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_large_circuit(self):\n # Specify a type of circuit used in this test\n self.check_circuit_type('large')",
"def test_small_circuit(self):\n # Specify a type of circuit used in this test\n self.check_circuit_type('small')",
"def test_deep_circuit(self):\n filename = se... | [
"0.7120328",
"0.6945879",
"0.6453144",
"0.634923",
"0.6328613",
"0.6269708",
"0.61272216",
"0.6119357",
"0.61191165",
"0.60788524",
"0.6074225",
"0.594739",
"0.59119767",
"0.58624464",
"0.5825523",
"0.5784322",
"0.57635987",
"0.5749336",
"0.5729748",
"0.571905",
"0.571555",
... | 0.7038887 | 1 |
Test draw teleport circuit. | def test_teleport(self):
from qiskit.circuit.library import U3Gate
filename = self._get_resource_path('test_teleport.tex')
qr = QuantumRegister(3, 'q')
cr = ClassicalRegister(3, 'c')
qc = QuantumCircuit(qr, cr)
# Prepare an initial state
qc.append(U3Gate(0.3, 0.2,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_teleport(self):\n self.log.info('test_teleport')\n pi = np.pi\n shots = 2000\n qr = QuantumRegister(3, 'qr')\n cr0 = ClassicalRegister(1, 'cr0')\n cr1 = ClassicalRegister(1, 'cr1')\n cr2 = ClassicalRegister(1, 'cr2')\n circuit = QuantumCircuit(qr, cr... | [
"0.70418996",
"0.59007996",
"0.5837641",
"0.5707822",
"0.5655482",
"0.5596955",
"0.55728096",
"0.5569884",
"0.55201656",
"0.5503052",
"0.5479844",
"0.5465956",
"0.544724",
"0.5422527",
"0.54156864",
"0.54148895",
"0.5414744",
"0.540316",
"0.53964335",
"0.53924996",
"0.5389831... | 0.66358155 | 1 |
Test circuit with global phase | def test_global_phase(self):
filename = self._get_resource_path('test_global_phase.tex')
circuit = QuantumCircuit(3, global_phase=1.57079632679)
circuit.h(range(3))
circuit_drawer(circuit, filename=filename, output='latex_source')
self.assertEqualToReference(filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_circuit_init(self):\n circuit, target = self.simple_circuit_no_measure()\n op = Chi(circuit)\n target = Chi(target)\n self.assertEqual(op, target)",
"def test_run_circuit_oracle(self):\n oracle = QuantumCircuit(2)\n oracle.cz(0, 1)\n list_good_state = [\"... | [
"0.66650254",
"0.6191711",
"0.6108052",
"0.6046065",
"0.5985339",
"0.5931292",
"0.5901644",
"0.5862877",
"0.58613193",
"0.5844447",
"0.58427745",
"0.58308804",
"0.5826411",
"0.57839686",
"0.57804453",
"0.57281876",
"0.5726908",
"0.57202667",
"0.56702447",
"0.5621255",
"0.5610... | 0.76438737 | 0 |
Register a new Activity Stream feed URL to update every interval seconds. | def register(self, url, interval=300):
param_d = {
'url': url,
'interval': interval, # seconds
}
r = self._send_request('feeds/register', param_d, http_post=False)
# Return True on success.
if 'result' in r and r['result'] == 'success':
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_rss(url):",
"def add_feed(self, url, feed):\n print \"Adding the podcast: %s\" % url\n self.t.click(\"Sidebar\")\n self.shortcut('n')\n time.sleep(2)\n type(url + \"\\n\")\n time.sleep(10) #give it 10 seconds to add and update the feed\n self.click_podcast... | [
"0.58947414",
"0.57712126",
"0.57435876",
"0.5610155",
"0.5598217",
"0.55441993",
"0.55131596",
"0.5490333",
"0.54477894",
"0.53591835",
"0.53310436",
"0.5251577",
"0.5234932",
"0.52232367",
"0.5207392",
"0.5129045",
"0.5116691",
"0.5088758",
"0.50820553",
"0.506711",
"0.5053... | 0.61889106 | 0 |
Remove a certain URL form the list of Activity Stream feeds registered earlier. | def unregister(self, url):
param_d = {
'url': url,
}
r = self._send_request('feeds/unregister', param_d, http_post=False)
# Return True on success.
if 'result' in r and r['result'] == 'success':
return True
else:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_seen(self, url):\n self.seen.delete(url)",
"def remove(self, urls):\n path = \"authSettings/exemptedUrls?action=REMOVE_FROM_LIST\"\n return self._session.post(path, urls)",
"def remove_urls(lista_tweets):\n\n novos_tweets = []\n\n for tweet in lista_tweets:\n texto ... | [
"0.7107925",
"0.64206517",
"0.6121294",
"0.6053596",
"0.60072714",
"0.59609747",
"0.5941415",
"0.59172726",
"0.5895897",
"0.5816972",
"0.5728807",
"0.5713048",
"0.5704622",
"0.5679299",
"0.56752235",
"0.56640065",
"0.5656824",
"0.56449866",
"0.5618883",
"0.55948067",
"0.55839... | 0.65047264 | 1 |
Prints sorted item of the list data structure formated using the rows and columns parameters | def print_sorted_list(data, rows=0, columns=0, ljust=10):
if not data:
return
if rows:
# column-wise sorting
# we must know the number of rows to print on each column
# before we print the next column. But since we cannot
# move the cursor backwards (unless using ncurse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displaySorted(self):\r\n os.system('cls')\r\n for i in self.sortedList:\r\n print(str(i[2]) + \": \" + i[0].showRule())",
"def print_row(width, items):\n def fmt_item(x):\n if isinstance(x, np.ndarray):\n assert x.ndim == 0\n x = x.item()\n if i... | [
"0.6569567",
"0.6550878",
"0.6524419",
"0.64498854",
"0.6407262",
"0.63954085",
"0.62853277",
"0.6282342",
"0.6258152",
"0.6221673",
"0.6194902",
"0.6172055",
"0.6146181",
"0.61409026",
"0.6130194",
"0.61223423",
"0.6114192",
"0.60976356",
"0.6074979",
"0.60746396",
"0.606611... | 0.73106694 | 0 |
Get text templates for sms | def get_templates(self, template_name, **kwargs):
text = render_template("{template}.txt".format(template=template_name), **kwargs)
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_text(contents, template, is_sms = True):\n \n max_chars = 160 - len(SMS_SALUTATION)\n \n contents = replace_dollar_signs(contents)\n sms = template.substitute(contents)\n \n if is_sms:\n if len(sms) > max_chars:\n template_length = len(sms)-get_content_length(con... | [
"0.66384625",
"0.5941724",
"0.57845145",
"0.57653564",
"0.5687092",
"0.56843555",
"0.5681145",
"0.55595624",
"0.5449239",
"0.5425735",
"0.5397242",
"0.53627807",
"0.5276596",
"0.5267229",
"0.5267229",
"0.5267229",
"0.5267229",
"0.5267229",
"0.52559733",
"0.5247302",
"0.524566... | 0.6188881 | 1 |
Creates a new IR Learned Code from a IRCode and a IRCodeInfo. | def __init__(self, code, codeInfo):
self.Code = code #IRCode
self.CodeInfo = codeInfo #IRCodeInfo
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __new__(cls, code: RegisterCode, info: str):\n if not isinstance(code, RegisterCode):\n raise TypeError(\"Code must be one of RegisterCode\")\n return super().__new__(cls, code, str(info))",
"def recreate_code(code, codes_offsets, codes_lines):\n offsets = codes_offsets[id(code)]\... | [
"0.55522573",
"0.52894145",
"0.5265566",
"0.5017019",
"0.4987227",
"0.49768665",
"0.4955158",
"0.49432",
"0.49169284",
"0.49076864",
"0.48669353",
"0.48622426",
"0.4811263",
"0.48017865",
"0.4796054",
"0.47858155",
"0.47858155",
"0.47830468",
"0.47628322",
"0.4738658",
"0.472... | 0.6802893 | 0 |
Transmits a repeat of a previously transmitted code. his must be called within the gap period after transmitting the original code. This is required for codes that use seperate sequences for the code and the repeat identifier. | def transmitRepeat(self):
try:
result = PhidgetLibrary.getDll().CPhidgetIR_TransmitRepeat(self.handle)
except RuntimeError:
raise
if result > 0:
raise PhidgetException(result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_next_packet():\n #\"global\" required here to be able to read and write to SEQUENCE \n global SEQUENCE\n data = sys.stdin.buffer.read(DATA_SIZE)\n if (len(data) > 0):\n rtt_start = time.time()\n msg_obj = {\"sequence\": SEQUENCE, \"data\": b64encode(data).decode(), \"ack\": True, \"eof\": False}... | [
"0.63232994",
"0.6089056",
"0.56461316",
"0.56111425",
"0.5511506",
"0.5493618",
"0.5429207",
"0.5380129",
"0.53693646",
"0.5357285",
"0.5306283",
"0.5254036",
"0.5245807",
"0.5197269",
"0.5188506",
"0.51812416",
"0.5173638",
"0.5160593",
"0.5160593",
"0.5154831",
"0.514265",... | 0.6863742 | 0 |
Reads raw IR data. | def readRaw(self):
count = 2048 #this is as big as the library buffer, so the user doesn't have to poll as often
buf = [] #buffer that will hold the read raw data and be returned to the user
dataPtr = (c_int * count)()
length = c_int()
length.value = count;
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_raw_data(self):\n # Must be set by the user\n raise Exception(\"not implemented\")",
"def read_raw(self):\n return self._FITS.read_raw()",
"def read_data(self):\n raise NotImplementedError",
"def _read_data(self):",
"def read():\n # TODO",
"def readData(self):\n ... | [
"0.73799086",
"0.6494946",
"0.64116246",
"0.6363456",
"0.6314987",
"0.6298859",
"0.6213011",
"0.6164756",
"0.61377877",
"0.60885054",
"0.6075769",
"0.6051732",
"0.6051732",
"0.6000561",
"0.5983055",
"0.5955333",
"0.5945794",
"0.59205985",
"0.59205985",
"0.59154874",
"0.590040... | 0.6902751 | 1 |
Gets the last code that was recieved. | def getLastCode(self):
codePtr = (c_ubyte * IR_MAX_CODE_DATA_LENGTH)(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
dataLength = c_int(IR_MAX_CODE_DATA_LENGTH)
bitCount = c_int()
try:
result = PhidgetLibrary.getDll().CPhidgetIR_getLastCode(self.handle, codePtr, byref(dataLen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_event(self):\n return self.last_event_code",
"def getLastLearnedCode(self):\r\n codePtr = (c_ubyte * IR_MAX_CODE_DATA_LENGTH)()\r\n dataLength = c_int(IR_MAX_CODE_DATA_LENGTH)\r\n codeInfo = CPhidgetIR_CodeInfo()\r\n \r\n try:\r\n result = Phidget... | [
"0.7467118",
"0.70808333",
"0.6818239",
"0.6818239",
"0.6818239",
"0.6818239",
"0.65389955",
"0.648529",
"0.6458124",
"0.6458124",
"0.6458124",
"0.6458124",
"0.6388842",
"0.638534",
"0.6327297",
"0.6304387",
"0.6252619",
"0.62518626",
"0.6220969",
"0.6149291",
"0.6115518",
... | 0.7622817 | 0 |
Gets the last code the was learned. | def getLastLearnedCode(self):
codePtr = (c_ubyte * IR_MAX_CODE_DATA_LENGTH)()
dataLength = c_int(IR_MAX_CODE_DATA_LENGTH)
codeInfo = CPhidgetIR_CodeInfo()
try:
result = PhidgetLibrary.getDll().CPhidgetIR_getLastLearnedCode(self.handle, codePtr, byref(dataLength... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLastCode(self):\r\n codePtr = (c_ubyte * IR_MAX_CODE_DATA_LENGTH)(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)\r\n dataLength = c_int(IR_MAX_CODE_DATA_LENGTH)\r\n bitCount = c_int()\r\n \r\n try:\r\n result = PhidgetLibrary.getDll().CPhidgetIR_getLastCode(self.handle, codeP... | [
"0.70882255",
"0.6817966",
"0.65252477",
"0.6414747",
"0.6414747",
"0.6414747",
"0.6414747",
"0.6366159",
"0.6299188",
"0.6299188",
"0.6299188",
"0.6299188",
"0.6193091",
"0.61307126",
"0.6107682",
"0.60453266",
"0.6043935",
"0.59798914",
"0.5971125",
"0.5961705",
"0.59294826... | 0.8201471 | 0 |
Create new nodes from files only (no CSV), and add media. These objects will have a title (derived from filename), and a configdefined Islandora model, content type, and status. Media use is derived from config as well. | def create_from_files():
logging.info('"Create from files" task started using config file %s', args.config)
file_dir_path = config['input_dir']
files = os.listdir(file_dir_path)
for file_name in files:
filename_without_extension = os.path.splitext(file_name)[0]
if len(filename_without_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_media():\n input_csv = os.path.join(config['input_dir'], config['input_csv'])\n if os.path.exists(input_csv):\n with open(input_csv) as csvfile:\n csv_data = csv.DictReader(csvfile, delimiter=config['delimiter'])\n csv_column_headers = csv_data.fieldnames\n\n f... | [
"0.6899484",
"0.6054888",
"0.58803874",
"0.57928514",
"0.5420819",
"0.5370023",
"0.5346127",
"0.5283462",
"0.52506554",
"0.5231957",
"0.5210766",
"0.5093985",
"0.50406533",
"0.501919",
"0.5015375",
"0.49877536",
"0.49819472",
"0.49494064",
"0.49333236",
"0.49259782",
"0.49049... | 0.714121 | 0 |
A function that places a hyperlink within a paragraph object. | def add_hyperlink(paragraph, url, text, color, underline):
# This gets access to the document.xml.rels file and gets a new relation id value
part = paragraph.part
r_id = part.relate_to(url, docx.opc.constants.RELATIONSHIP_TYPE.HYPERLINK, is_external=True)
# Create the w:hyperlink tag and add nee... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_link(self, text, href):\n self.insert_text('\\n<a href=\"%s\">%s</a>' % (href, text))",
"def add_link(self, text, link, doc=None):\n if doc is None:\n doc = self.doc\n\n attributes = dict(height=13, width=800, align=None,\n style={'width': '800p... | [
"0.7194196",
"0.711099",
"0.6931182",
"0.6729301",
"0.6459507",
"0.6443439",
"0.6435088",
"0.6348411",
"0.63430583",
"0.63310754",
"0.6183733",
"0.61709255",
"0.6125358",
"0.6087342",
"0.6061669",
"0.6057206",
"0.6023001",
"0.5997185",
"0.59653616",
"0.5963516",
"0.5961892",
... | 0.7520187 | 0 |
Parse the video info from the list file | def _parse_list(self):
frame_path = [x.strip().split(' ') for x in open(self._image_set)]
self.video_list = [VideoRecord(item) for item in frame_path]
print('Sequence number/ video number:%d' % (len(self.video_list))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse():\n all_players = list(FACE_IMAGE_LOCATIONS.keys())\n face_encodings = VideoParser.__load_faces_encodings(all_players)\n player_occurrences = VideoParser.__get_player_occurrences(all_players, face_encodings)\n VideoParser.__save_parsed_video(player_occurrences)",
"def parse... | [
"0.6779816",
"0.65194994",
"0.6317407",
"0.6295546",
"0.6287042",
"0.6220349",
"0.62049514",
"0.6153184",
"0.61432546",
"0.61055183",
"0.60525054",
"0.6038838",
"0.6028858",
"0.6019547",
"0.6008906",
"0.596016",
"0.5949716",
"0.5949716",
"0.59392923",
"0.5934991",
"0.5922064"... | 0.78747493 | 1 |
Count device properties in tango database | def _count_device_properties(self):
db_info = self.db_instance.get_info()
db_info_list = db_info.split("\n")
num_properties = 0
for line in db_info_list:
if "Device properties defined" in line:
num_properties = line.split("=")[-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_count():\n apipath = \"/targets/devices\"\n url = SERVER + apipath\n params = {\n 'q': '(deviceType:ASA)',\n 'agg': 'count'}\n headers = {\n 'Accept': \"application/json\",\n 'Content-Type': \"application/json\",\n 'Authorization': \"bearer {}\".format(toke... | [
"0.7232637",
"0.6833704",
"0.677386",
"0.66516244",
"0.6515157",
"0.6435831",
"0.6418593",
"0.63793916",
"0.6332636",
"0.623051",
"0.62289196",
"0.615941",
"0.615941",
"0.615941",
"0.615941",
"0.61536556",
"0.61357987",
"0.610687",
"0.60905564",
"0.60675",
"0.6046463",
"0.6... | 0.80800503 | 0 |
Test initial device properties added to the tangoDB | def test_initial_device_properties(self):
expected_count = 1 # model_key property already present in db
self.assertEquals(expected_count, self._count_device_properties()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_store_property_after_reconnecting_to_the_device():",
"def test_write_device_properties_to_db(self):\n initial_count = self._count_device_properties()\n tango_sim_generator.write_device_properties_to_db(\n self.sim_device.name(), self.expected_model, self.db_instance\... | [
"0.7515061",
"0.74581534",
"0.6795936",
"0.67435575",
"0.67435575",
"0.6704687",
"0.6704687",
"0.66615325",
"0.6619589",
"0.65853965",
"0.64755106",
"0.643274",
"0.64094573",
"0.64094573",
"0.6301926",
"0.6301926",
"0.6227684",
"0.62258434",
"0.62068087",
"0.6171025",
"0.6169... | 0.75091547 | 1 |
Testing whether the device properties in the model are added to the tangoDB | def test_write_device_properties_to_db(self):
initial_count = self._count_device_properties()
tango_sim_generator.write_device_properties_to_db(
self.sim_device.name(), self.expected_model, self.db_instance
)
num_expected_properties = len(self.expected_mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_initial_device_properties(self):\n expected_count = 1 # model_key property already present in db\n self.assertEquals(expected_count, self._count_device_properties())",
"def test_store_property_after_reconnecting_to_the_device():",
"def check_device_state(self):",
"def test_att... | [
"0.73286724",
"0.62140524",
"0.6161287",
"0.5922223",
"0.58981586",
"0.5896649",
"0.58640945",
"0.5854194",
"0.58400106",
"0.5782783",
"0.5782267",
"0.5770153",
"0.5759309",
"0.5759194",
"0.57582355",
"0.5751846",
"0.5724441",
"0.5724441",
"0.5711718",
"0.5711576",
"0.5688705... | 0.714154 | 1 |
Testing whether the attributes quantities in the model are added to the TANGO sim device controller | def test_sim_control_attribute_list(self):
implemented_attr = helper_module.SIM_CONTROL_ADDITIONAL_IMPLEMENTED_ATTR
control_attributes = test_sim_test_interface.control_attributes(
self.expected_model
)
attributes = set(self.sim_control_device.get_attribut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_device_attribute_list(self):\n # test that the attributes from the running simulated device match the attributes\n # from in the simdd json file\n device_attributes = set(self.sim_device.get_attribute_list())\n default_attributes = helper_module.DEFAULT_TANGO_DEVICE_ATTRIBUTES\... | [
"0.6414206",
"0.6254846",
"0.62536204",
"0.62461764",
"0.623432",
"0.6112338",
"0.6103137",
"0.60764176",
"0.5972721",
"0.5910903",
"0.58160746",
"0.5808809",
"0.58",
"0.5781312",
"0.57746536",
"0.57669103",
"0.57643425",
"0.5759311",
"0.57515216",
"0.5723734",
"0.5718741",
... | 0.6465823 | 0 |
Setting the desired attribute value for the device's attribute from the simulator controller device | def test_sim_control_device_attribute_change(self):
desired_attribute_name = "temperature"
input_value = 100.0
self.sim_control_device.attribute_name = self.attr_name_enum_labels.index(
desired_attribute_name
)
self.sim_control_device.pause_act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def script_set_device(self,udid=None):\n self.desired_caps['udid'] = udid;",
"def set_attribute(self, attr, value):\n logger.debug(\"SET ATTRIBUTE {} to {}\".format(attr, value))",
"def set_attribute(self, name, value):\n\n pass",
"def _update_device_attr(\n self, device_id: str, ... | [
"0.65906084",
"0.6350218",
"0.61830956",
"0.61666596",
"0.60464954",
"0.60099",
"0.5992313",
"0.59657156",
"0.5952257",
"0.59496844",
"0.5879743",
"0.5847188",
"0.5838993",
"0.583859",
"0.58225757",
"0.5808653",
"0.57960904",
"0.57923305",
"0.5787347",
"0.5755368",
"0.5724444... | 0.6926932 | 0 |
Testing whether the attributes specified in the POGO generated XMI file are added to the TANGO device. | def test_device_attribute_list(self):
# First testing that the attribute with data format "IMAGE" is in the device.
attribute_name = "image1"
device_attributes = set(self.sim_device.get_attribute_list())
self.assertIn(
attribute_name,
device_attributes,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_device_attribute_list(self):\n # test that the attributes from the running simulated device match the attributes\n # from in the simdd json file\n device_attributes = set(self.sim_device.get_attribute_list())\n default_attributes = helper_module.DEFAULT_TANGO_DEVICE_ATTRIBUTES\... | [
"0.63320553",
"0.63164514",
"0.61544424",
"0.60058045",
"0.59952205",
"0.59781814",
"0.5861376",
"0.57632935",
"0.5697044",
"0.5669564",
"0.5661544",
"0.5622584",
"0.55868214",
"0.5585633",
"0.5573848",
"0.55706286",
"0.5506343",
"0.54805017",
"0.545378",
"0.5436845",
"0.5430... | 0.6337125 | 0 |
Testing whether the attributes specified in the fandango generated fgo file are added to the TANGO device. | def test_device_attribute_list(self):
# test that the attributes from the running simulated device match the attributes
# from in the fandango generated file
device_attributes = set(self.sim_device.get_attribute_list())
extra_attr_from_device = set(["NumAttributesNotAdded", "AttributesNo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_device_attribute_list(self):\n # test that the attributes from the running simulated device match the attributes\n # from in the simdd json file\n device_attributes = set(self.sim_device.get_attribute_list())\n default_attributes = helper_module.DEFAULT_TANGO_DEVICE_ATTRIBUTES\... | [
"0.63431334",
"0.61369073",
"0.609612",
"0.60764974",
"0.5959336",
"0.5766945",
"0.57135236",
"0.5707165",
"0.5706078",
"0.56799346",
"0.56355697",
"0.560508",
"0.5601962",
"0.560114",
"0.55919594",
"0.55814165",
"0.5522186",
"0.551569",
"0.54715294",
"0.5456782",
"0.545658",... | 0.6583468 | 0 |
Testing whether commands from running simulated device match commands from fandango file | def test_device_command_list(self):
actual_device_cmds = self.sim_device.get_command_list()
expected_cmd_list = self.sim_file_parser.get_device_command_metadata().keys()
self.assertEquals(
set(actual_device_cmds),
set(expected_cmd_list),
"The commands specifie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_match(self, command_bytes):",
"def _verifyCommand(self):\n for i in range(3):\n rc = self.subdevice.command_test() # Verify command is correct\n if rc is None:\n break",
"def test_device_command_list(self):\n default_cmds = helper_module.DEFAULT_TANGO_... | [
"0.686579",
"0.6190588",
"0.61735475",
"0.6020115",
"0.5998797",
"0.5967311",
"0.5941706",
"0.58935934",
"0.5856973",
"0.58003515",
"0.57989997",
"0.57601476",
"0.5729398",
"0.57259583",
"0.5711797",
"0.5648455",
"0.5644743",
"0.56248915",
"0.56072706",
"0.55872613",
"0.55554... | 0.6805937 | 1 |
Testing whether the attributes specified in the simdd json are added to the TANGO device. | def test_device_attribute_list(self):
# test that the attributes from the running simulated device match the attributes
# from in the simdd json file
device_attributes = set(self.sim_device.get_attribute_list())
default_attributes = helper_module.DEFAULT_TANGO_DEVICE_ATTRIBUTES
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_device_attribute_list(self):\n # test that the attributes from the running simulated device match the attributes\n # from in the fandango generated file\n device_attributes = set(self.sim_device.get_attribute_list())\n extra_attr_from_device = set([\"NumAttributesNotAdded\", \"... | [
"0.6757138",
"0.6639707",
"0.603285",
"0.57943916",
"0.5781796",
"0.57430536",
"0.5678223",
"0.5659225",
"0.5638481",
"0.55833596",
"0.5567453",
"0.55489945",
"0.5530007",
"0.5519677",
"0.55196536",
"0.5511401",
"0.5497804",
"0.54914",
"0.54877055",
"0.5468603",
"0.5462875",
... | 0.71292067 | 0 |
Testing whether commands from running simulated device match commands from simmdd json file | def test_device_command_list(self):
default_cmds = helper_module.DEFAULT_TANGO_DEVICE_COMMANDS
actual_device_cmds = set(self.sim_device.get_command_list()) - default_cmds
expected_cmd_list = self.sim_file_parser.get_device_command_metadata().keys()
self.assertEquals(
actual_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_device_command_list(self):\n actual_device_cmds = self.sim_device.get_command_list()\n expected_cmd_list = self.sim_file_parser.get_device_command_metadata().keys()\n self.assertEquals(\n set(actual_device_cmds),\n set(expected_cmd_list),\n \"The comma... | [
"0.69326276",
"0.65383285",
"0.62935674",
"0.5962256",
"0.580752",
"0.5662563",
"0.5652129",
"0.56469244",
"0.5636164",
"0.562125",
"0.5609909",
"0.5506132",
"0.54622304",
"0.54539406",
"0.544067",
"0.5423402",
"0.54215324",
"0.5406972",
"0.5395801",
"0.53840023",
"0.53741866... | 0.69376826 | 0 |
Test that the TANGO device Init command works correctly. | def test_device_init_command(self):
default_val = 0
self.assertEqual(self.sim_device.integer1, default_val)
# Write to the attribute integer1
self.sim_device.integer1 = 45
self.assertEqual(self.sim_device.integer1, 45)
# Reset the values of the device attributes to defaul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_device(self):\n pass",
"def test_create_device(self):\n pass",
"def test_create_device1(self):\n pass",
"def test_01_Init(self):\n pass",
"def test_init(self):\n self.assertEqual(self.device_key, self.factory.device_key)",
"def initialise(self):\n ... | [
"0.7282401",
"0.7282401",
"0.6997539",
"0.6789896",
"0.6767043",
"0.67537886",
"0.67022514",
"0.67022514",
"0.6655565",
"0.65647686",
"0.6561325",
"0.6535144",
"0.6534742",
"0.64849114",
"0.64815253",
"0.64324486",
"0.64249736",
"0.6416037",
"0.6411636",
"0.6399772",
"0.63997... | 0.7338796 | 0 |
Test that you can have multiple sim control devices running. | def test_multiple_sim_control_devices(self):
self.assertGreater(self.sim_control_device1.ping(), 0)
self.assertGreater(self.sim_control_device2.ping(), 0)
self.assertGreater(self.sim_control_device3.ping(), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_controller_switches(self):\n for name in self.our_controllers:\n self.start_controller(name)\n self.assertTrue(self.check_state(name, 'running'), \"{} is starting correctly\".format(name))\n time.sleep(1) # process some update() cycles\n self.stop_control... | [
"0.675677",
"0.6411198",
"0.6409038",
"0.6409038",
"0.63815534",
"0.6307721",
"0.625616",
"0.62448555",
"0.62051547",
"0.61276186",
"0.6113333",
"0.6086259",
"0.6072002",
"0.6033512",
"0.60321414",
"0.5989508",
"0.595629",
"0.58943605",
"0.58777815",
"0.58610326",
"0.5858526"... | 0.8147376 | 0 |
Asynchronously create the TokenInstance | async def create_async(
self,
grant_type: str,
client_sid: str,
client_secret: Union[str, object] = values.unset,
code: Union[str, object] = values.unset,
code_verifier: Union[str, object] = values.unset,
device_code: Union[str, object] = values.unset,
ref... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def create_token(self, *args, **kwargs) -> OAuth2Token:\n token = await super().create_token(*args, **kwargs)\n # NOTE: Save data from token to db here.\n return token",
"def create_token(self, token_id, data):\n raise exception.NotImplemented() # pragma: no cover",
"def asyn... | [
"0.67421234",
"0.6041978",
"0.5987314",
"0.5978837",
"0.5966229",
"0.5966229",
"0.5966229",
"0.591489",
"0.5881262",
"0.5881262",
"0.58688843",
"0.5868686",
"0.5779239",
"0.5765783",
"0.5763097",
"0.57302094",
"0.57297224",
"0.5726904",
"0.5722842",
"0.57181853",
"0.57093436"... | 0.6723087 | 1 |
Convert a description to grammar. Each line is a rule for a | def grammar(description, whitespace=r'\s*'):
G={' ':whitespace}
description = description.replace('\t',' ') # handle tabs in description
for line in split(description,"\n"):
lhs, rhs = split(line,"=>")
alternatives = split(rhs, ' | ')
G[lhs]=tuple(map(split, alternatives))
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grammar(description, whitespace = r'\\s*'):\n def split(text, sep = None, maxsplit = -1):\n \"Like str.split applied to text, but strips whitespace from each piece.\"\n return [t.strip() for t in text.strip().split(sep, maxsplit) if t]\n\n G = {' ': whitespace}\n description = descriptio... | [
"0.6861162",
"0.64110154",
"0.6409674",
"0.6297929",
"0.61312383",
"0.5980318",
"0.5977484",
"0.5864739",
"0.5814279",
"0.5779114",
"0.57233554",
"0.5705856",
"0.57030374",
"0.5701753",
"0.5641272",
"0.5619116",
"0.56173664",
"0.55892825",
"0.5587026",
"0.55722344",
"0.552155... | 0.71617424 | 0 |
Set the value of a variable. The variable will be defined in the runtime context of the preprocessor minilanguage. The value is either the result of safely evaluating the value token with `ast.literal_eval`, or the token itself if it cannot be evaluated. | def set(self, identifier, value_token, *, preprocessor=None):
try:
value = ast.literal_eval(value_token)
except (SyntaxError, ValueError):
value = value_token
setattr(self, identifier, value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_value(v):\r\n try:\r\n type (eval(v))\r\n except NameError:\r\n return \"\"\r\n return eval(v)",
"def set_value(v):\r\n try:\r\n type (eval(v))\r\n except NameError:\r\n return \"\"\r\n return eval(v)",
"def set_var(parser,token):\n parts =token.... | [
"0.66423774",
"0.66423774",
"0.6500075",
"0.6474883",
"0.6296716",
"0.62630725",
"0.6242456",
"0.60815567",
"0.60435575",
"0.5987802",
"0.59656864",
"0.59643215",
"0.5951412",
"0.5936918",
"0.58330405",
"0.57996327",
"0.5723935",
"0.57217634",
"0.56929225",
"0.5661026",
"0.56... | 0.76264775 | 0 |
r""" Interpret additional tokens if a condition is true. Note This keyword can be written as ``if`` (instead of ``if_``) in the preprocessor directives. | def if_(self, condition_token, keyword_token, *tokens, preprocessor=None):
condition = self._get_token_value(condition_token)
if not isinstance(condition, bool):
raise DoxhooksTypeError(condition, condition_token, "bool")
if condition:
self.interpret(keyword_token, *token... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_if(self):\r\n lab1 = self.class_name + \".L\" + str(self.label_index)\r\n self.label_index += 1\r\n lab2 = self.class_name + \".L\" + str(self.label_index)\r\n self.label_index += 1\r\n self.tokenizer.advance() # ignore 'if' keyword\r\n self.tokenizer.advance(... | [
"0.6379466",
"0.6259943",
"0.61396646",
"0.61340076",
"0.60854274",
"0.6037291",
"0.60143036",
"0.60072577",
"0.6006162",
"0.5856047",
"0.58316565",
"0.58316565",
"0.57916826",
"0.577586",
"0.5679327",
"0.5647371",
"0.5636845",
"0.56265545",
"0.56044257",
"0.5583414",
"0.5576... | 0.729511 | 0 |
Modify a context to allow lowercase boolean representations. | def lowercase_booleans(context_class):
context_class._convert_bool_to_str = _convert_to_lowercase_str
return context_class | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startcase_booleans(context_class):\n context_class._convert_bool_to_str = _convert_to_str\n return context_class",
"def _bool_encode(self, d):\n for k, v in d.items():\n if isinstance(v, bool):\n d[k] = str(v).lower()\n \n return d",
"def set_case_sensit... | [
"0.7548539",
"0.63619083",
"0.6342019",
"0.6148815",
"0.61256915",
"0.5853296",
"0.5798188",
"0.57786196",
"0.5686606",
"0.5661465",
"0.5574734",
"0.5535997",
"0.5514914",
"0.55106956",
"0.5468126",
"0.5459818",
"0.54399335",
"0.5392206",
"0.5390457",
"0.5377692",
"0.5372112"... | 0.83106977 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.